View Single Post
Old 08-09-22, 05:01 AM   #110
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 873
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by gap View Post
[*]Does the question mark before a precondition, work the same way as the logical operator 'not' in other programming languages?
Exclamation mark? Yes, that's exactly what it does.


Quote:
Originally Posted by gap View Post
Why 'Plane:HasCannons() and Plane:CanFireCannons()'? Wouldn't 'Plane:HasBombs() and Plane:CanFireBombs()' be more logical preconditions for the 'BombCourseStrafe(Plane)' and 'BombCourseSlow(Plane)' strategies?
Jeff's wrote above that Strafe action might not work well without these conditions. I don't see difference in behaviour but added them just in case. As for Plane:HasBombs() and Plane:CanFireBombs(), they are already preconditions to this strategy's parent strategy.

Quote:
Originally Posted by gap View Post
[*]Do the 'Ship:SetThrottleRatio(1.0)' commands apply to the attacking aircraft or to the attacked sea unit? In the latter case, shouldn't them be part of ship, rather than aircraft, AI strategies?[/LIST]
In this case they apply to the plane.

In SH5, command syntax is:

UnitType:Command(parameters) where unit type might be Plane, Sub or Ship (edit: and, possibly, CostalDefense - it's not used by any scripts but has its own AI commander so... possibly). Now, commands only work with certain types so if you try to write Plane:SetThrottleRatio, game will CTD or ignore command. But if you put Ship:SetThrottleRatio in a strategy used by the plane, game will happily accept it and apply to the plane. I don't know why it works like this, but it does. It was similar with submarine deck guns, which started working after putting "Ship" type condition in their script.

EDIT: by the way,I attach the airplane script as it is now if you or someone else would like to take a look.
Attached Files
File Type: txt Airplane.aix.txt (12.7 KB, 5 views)

Last edited by kapuhy; 08-09-22 at 05:37 AM.
kapuhy is offline   Reply With Quote