SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 08-09-22, 02:17 PM   #1
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,214
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by Jeff-Groves View Post
You mean the Random?
I'm thinking the Random numbers are start and final
So if Random(15, 20)
The numbers are drawn from 15 to 20
No, Ship:Random is one of those commands whose arguments are pretty obvious. I mean the parameter of commands like Ship:ShipWaitAction, or the second parameter of Ship:TurnToHeading. They seem to always be in the range 0-1

Else, Plane:Strafe is another of those commands that accept a numeric parameter, but all the instances I found of it go from -20 to 100. Could that be an angle relative to current aircraft heading?
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 08-09-22, 02:27 PM   #2
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,328
Downloads: 130
Uploads: 0


Default

# void ShipWaitAction(fMinutes) -- action -- ship waits for given time [minutes]
TurnToHeading(newHeading, fThrottle) -- action -- turns ship to a new heading given by "newHeading" [deg] using given throttle (0..1];
# can be used with getbearing/heading functions;
__________________
I don't do Stupid. So don't ask.
Jeff-Groves is offline   Reply With Quote
Old 08-09-22, 02:31 PM   #3
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,214
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by Jeff-Groves View Post
# void ShipWaitAction(fMinutes) -- action -- ship waits for given time [minutes]
TurnToHeading(newHeading, fThrottle) -- action -- turns ship to a new heading given by "newHeading" [deg] using given throttle (0..1];
# can be used with getbearing/heading functions;


what about Plane:Strafe, and btw where do you get that information from?
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 08-09-22, 02:32 PM   #4
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,328
Downloads: 130
Uploads: 0


Default

It's all listed in the Stock Ship.aix file

But things like Strafe and Flock? No definitions I have found.
__________________
I don't do Stupid. So don't ask.
Jeff-Groves is offline   Reply With Quote
Old 08-09-22, 02:37 PM   #5
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,214
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by Jeff-Groves View Post
It's all listed in the Stock Ship.aix file
Okay, I thought you had performed one of your wizard tricks

Unfortunately I have not the game installed and I can't check that file. Could you please copy/paste those command syntax instructions for me?
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 08-09-22, 02:39 PM   #6
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,328
Downloads: 130
Uploads: 0


Default



Give me a minute.

OK. Here it all is,



################################################## #################################################
#
# Ship main:
#
################################################## #####################
################# Tactics methods #####################
################################################## #####################

# void AddRole(RoleID, MinShips, MaxShips)
#
# Adds a role with the given RoleID to the current tactic
#
# MinShips: minimum number of ships that need to be assigned the role
# MaxShips: maximum number of ships that need to be assigned the role

# void AssignRole(RoleID, ShipType, ShipMinSpeed, Option)
#
# Tries to assigns given role to ships of given type which can achieve speeds greater than ShipMinSpeed;
# ships are selected in the order given by Option.
# (ship count is bounded by AddRole params; it tries to add the maximum number of ships given in AddRole)
# If there aren't enough ships in this group, it borrows ships from roles with redundant ships. If there still aren't
# enough ships, the current tactic ends
#
# Option can have one of the values
# ASSIGN_CLOSEST_TO_CONTACT: assigns ships in increasing
# order of distance to contact
# ASSIGN_ANY: assigns ships in no particular order

# int CanContinueCurrentTactic()
#
# Verifies if there are enough ships left in each role for the current tactic;
# returns true if all roles in current tactic have enough ships;
# should be called by the commander of the group

# void EndCurrentTactic()
#
# Terminates current operation (tactic) for all involved ships

# int GetCurrentTacticID()
#
# Returns the current tactic(operation) ID

# int GetCurrentTacticMinShips()
#
# Retrieves the minimum number of ships required by the current tactic

# int GetRole()
#
# Retrieves the role of the current ship.

# bool IsCommander()
#
# True if the current ship is the commander of a group (or is not part of a group)

# int IsRoleInCurrentTactic(RoleID)
#
# Determines if the role given by RoleID is a role of the current tactic.


# void SetLineFormation(RoleID, MaxSlotCount, SpanDist, Orientation) // MaxSlotsCount = 0 => no limit
#
# Sets formation for RoleID as a line consisting of a maximum of MaxSlotCount slots
# that can be occupied by ships in that role, spanning over a distance of Dist meters, and
# the orientation given by Orientation.
#
# RoleID: role for which the formation is configured
# MaxSlotCount: maximum number of ships that can be part of the formation
# (if 0, there can be any number of ships in the formation)
# SpanDist: spanning distance of the formation (total length of the line of ships)
#
# Orientation: can have one of these values
# LINE_ORIENTATION_ACROSS: ships in formation will position themselfes
# perpendicular to the formation's heading
# LINE_ORIENTATION_ALONG: ships in formation will position themselfes
# along the formation's heading (parallel to the heading)

# void SetTactic(TacticID, MinShips)
#
# Sets a tactic (represented by TacticID) as the current tactic followed by this group
# MinShips: minimum number of ships requiered by the tactic; if there aren't at least MinShips ships in the group,
# the tactic is not started

# void WaitForFormation()
#
# Makes current ship wait for its formation to reach destination

################################################## #################
####################### Utility methods ########################
################################################## #################

# void AvoidTorpedoes() Ship tries to avoid torpedoes
# bool CanFireCannons() True if the ship can fire its cannons
# bool CanFireDCRacks() True if DCs can be thrown from DC Racks
# bool CanFireDCThrowers() True if DCs can be thrown from DC Throwers
# bool CanFireHHogs() True if the ship can fire HHogs
# bool CanFireStarShells() True if the ship can fire star shells
# bool CanFollowWaypoint() True if this ship may follow waypoints
# bool ContactDetected() True if a contact has been detected
# bool ContactIs(Type) Returns 1 if contact is the specified type.
# bool ContactIsInsideGroupArea() True if the contact is positioned somewhere between or below merchants in the group
# bool ContactPresenceIs(PresenceType, bOldPresence)
# Returns true if contact has presence of PresenceType.
# If bOldPresence is 1, it will return the old contact presence, else if it is 0, it will return the current contact presence.
# PresenceType can be:
# PRESENCE_LOOKOUT = 0
# PRESENCE_RADAR = 1
# PRESENCE_HYDROPHONE = 2
# PRESENCE_SONAR = 3
# PRESENCE_SENSORS = 15
# PRESENCE_LOOSING = 16
# PRESENCE_NEW = 32
# PRESENCE_PROCESSED = 64
# void FireCannons() Fires cannons
# void FireDCRacks() Fires DC Racks
# void FireDCThrowers() Fires DC Throwers
# void FireHHogs() Fires HHogs
# void FireStarShells() Fires star shells
# void FollowWaypoints(fPatrolRate) The ship follows given waypoints; fPatrolRate dictates how often
# the ship searches around the given waypoint path for threats
# usually, fPatrolRate = SHIP_PATROL_RATE (used in a rate event happen method)
# float GetContactBearing() 0-360 clockwise, 0 = north
# float GetContactDepth() Retrieves contact depth [m]
# float GetContactLostTime() Returns the lost time of our contact. Recomended to use it with ContactPresenceIs(PRESENCE_LOOSING).
# float GetContactRelDist() Distance from ship to contact [m]
# float GetContactSpeed() Returns contact speed [kts]
# int GetCrewRating() Returns crew rating for current ship
# returned values may be:
# CREW_POOR
# CREW_NOVICE
# CREW_COMPETENT
# CREW_VETERAN
# CREW_ELITE
# float GetCurrentHeading() 0-360 clockwise, 0 = north
# float GetCurrentFormationHeading() 0-360 clockwise, 0 = north
# float GetCurrentSpeed() [m/s]
# float GetDamage() Returns the amount of damage inflicted to the ship as a float in [0.0, 1.0]
# 1.0 corresponding to the maximum amount of damage a ship can take
# float GetFormationContactBearing() Retrieves contact bearing relative to the center of the formation
# this ship is part of
# float GetMyWeight() Retrieves ship weight in tons
# int GetShipCountInGroup(ShipType) Returns the number of ships with given type in this ship's group
# int GetShipsDestroyedRecentlyInGroup() Returns the number of ships destroyed in this ship's group since last call or since tactic creation
# if this is the first call of this method

# void Goto(fThrottleRatio, bZigZagOn) Goes forward with given throttleRatio (optionally zigzagging)
# void GotoAction(bZigZag, bUseBreaks, fEpsilon) -- action -- goes forward(optionally zigzagging and/or breaks to
# Achieve desired speed and arrival time) to current destination
# fEpsilon is the acceptable error to destination ( in meters )
# bool HasContacts() True if the ship has enemy contacts
# bool IsDocked() True if the ship is docked
# bool IsNeutral() True if the ship is neutral
# bool IsType(ShipType) True if current ship is of given type
# float Random(a, b) A random real number between a and b
# void SetGotoForwardDist(fDist) Sets destination used by GotoAction at fDist meters in front of the ship; (works with formations)
# void SetGotoDestRelToContact(fDist) Sets destination used by GotoAction; it is relative to main contact (works with formations)
# void SetGotoDestRelToContactKeepFormationOrientation(fD ist) Sets destination at fDist meters from the line that passes through the
# contact's position and perpendicular to current ship/formation heading
# void SetGotoDestRelToGroupCenter(fDist) Sets destination at fDist meters from the center of merchant group center(if no merchants in group,
# destination is set relative to the group commander)
# void SetGotoDestRelToGroupCenterAlongGroupHeading(fDist ) Sets destination at fDist meters from the center of merchant group center(if there
# are no merchants in group, destination is set relative to the group commander)
# void SetRamDestination() Sets destination at contact position for ramming
# void SetSensorFactor(sensorType, factor) Sets a modifier for given sensor type (factor in (0, 1]
# sensorType can have one of the following values:
# SENSOR_LOOKOUT
# SENSOR_RADAR
# SENSOR_HYDROPHONE
# SENSOR_SONAR
# void SetThrottleRatio(fThRatio) Value in [-1, 1]
# void SetThrottle(fThrottle) Value in [-1, 1]

# void ShipWaitAction(fMinutes) -- action -- ship waits for given time [minutes]
# void Spiral(fThrottle, maxSpiralTime, float fStartRudder, float fStopRudder) -- action --
# Spirals around current position with given throttle, for at most maxSprialTime seconds.
# It will interpolate between StartRudder and StopRudder in maxSpiralTime time.
# void StartFiringDCs() Starts firing DCs regardles of distance to contact or contact presence
# void StopFiringDCs() Stops firing DCs unless ships are near contact
# void TimeEventHappen(Minutes) Used to trigger events at given interval of time
# bool TorpedoDetected() True if a torpedo has been detected nearby
# void TurnToHeading(newHeading, fThrottle) -- action -- turns ship to a new heading given by "newHeading" [deg] using given throttle (0..1];
# can be used with getbearing/heading functions;
# void TurnFormationToHeading(newHeading, fThrottle) -- action -- turns the whole formation to a new heading given by "newHeading" [deg] using given throttle (0..1];
# can be used with getbearing/heading functions;
__________________
I don't do Stupid. So don't ask.
Jeff-Groves is offline   Reply With Quote
Old 02-26-23, 09:07 AM   #7
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 874
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by gap View Post
Else, Plane:Strafe is another of those commands that accept a numeric parameter, but all the instances I found of it go from -20 to 100. Could that be an angle relative to current aircraft heading?
A little late but I finally deciphered what the argument of Strafe function means today. It's altitude. Plane will attempt a strafing run keeping close to specified altitude.

At low or negative values this parameter doesn't seem to make any difference, probably because it is overridden by need to avoid impact with water.

Edit: Another complication I see in my testing is that if a plane has fixed machine guns, it will attempt to aim at target leading it to not keep ordered altitude. This might be connected with fighter planes crashing into sea way more often than heavier bombers.

Last edited by kapuhy; 02-26-23 at 04:14 PM.
kapuhy is offline   Reply With Quote
Old 02-26-23, 10:08 AM   #8
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,767
Downloads: 443
Uploads: 2


Default

Most interesting find - I wonder what "height" the planes begin to get "jittery" and attempt to avoid collision with the water? In SH4, I attempted to have a grouping of torpedo bombers come down to wave top for their anticipated attack runs, and instead they continued to fly at least 200m up. In the game though, with a Betty TB that had spawned from one of the AirBases, while my sub was on the surface travelling (a different experiment), I observed the Betty TB approaching in the distance, most likely at its default 500m height, then "spiral" down, and instead of coming in from my 270 relative, where it had been approaching from, came in from my 235 and was no more than 50m off the water for its attack run, though it did drop too soon, and the torpedo was easily avoided... but if the game can have a plane do that, why can we not call for that behavior?? lol
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 02-26-23, 01:51 PM   #9
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 874
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by propbeanie View Post
Most interesting find - I wonder what "height" the planes begin to get "jittery" and attempt to avoid collision with the water?
I'll be testing this, but I suspect it will turn out to be their respective minimum height as set in sim file. It would make sense, why else have minimum height set for a plane if you're not using it as a trigger for AvoidImpact action? If so, the jittery behaviour might be result of basically telling the plane "Strafe at around 15 to 20 meters but no lower than 50".
kapuhy is offline   Reply With Quote
Old 03-10-23, 11:42 AM   #10
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,214
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by kapuhy View Post
A little late but I finally deciphered what the argument of Strafe function means today. It's altitude. Plane will attempt a strafing run keeping close to specified altitude.

At low or negative values this parameter doesn't seem to make any difference, probably because it is overridden by need to avoid impact with water.
Cool, thank you for letting us know

Quote:
Originally Posted by kapuhy View Post
Edit: Another complication I see in my testing is that if a plane has fixed machine guns, it will attempt to aim at target leading it to not keep ordered altitude. This might be connected with fighter planes crashing into sea way more often than heavier bombers.
Good point. Fixed aircraft guns have a small elevation/training angle, in the order of few degrees (otherwise they would never fire). Maybe increasing their elevation angle and/or tweaking their firing arcs might alleviate the problem

Quote:
Originally Posted by propbeanie View Post
Most interesting find - I wonder what "height" the planes begin to get "jittery" and attempt to avoid collision with the water? In SH4, I attempted to have a grouping of torpedo bombers come down to wave top for their anticipated attack runs, and instead they continued to fly at least 200m up. In the game though, with a Betty TB that had spawned from one of the AirBases, while my sub was on the surface travelling (a different experiment), I observed the Betty TB approaching in the distance, most likely at its default 500m height, then "spiral" down, and instead of coming in from my 270 relative, where it had been approaching from, came in from my 235 and was no more than 50m off the water for its attack run, though it did drop too soon, and the torpedo was easily avoided... but if the game can have a plane do that, why can we not call for that behavior?? lol
Quote:
Originally Posted by kapuhy View Post
I'll be testing this, but I suspect it will turn out to be their respective minimum height as set in sim file. It would make sense, why else have minimum height set for a plane if you're not using it as a trigger for AvoidImpact action? If so, the jittery behaviour might be result of basically telling the plane "Strafe at around 15 to 20 meters but no lower than 50".
I agree with kapuhy, minimum height might be the main "culprit", but other unrelated AI routines might also interfere. Their existence can be easily tested by setting min. height to very low values
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.