Members | Sign In
All Forums > Mission Scripting
avatar

Setting up an ambush and fleet organisation

posted May 18, 2012 07:27:29 by aodendaal
I have the following code:
<start>
<create type ="station" raceKeys="friendly" hullKeys="base" x="96000" y="0" z="46000" name="DS288"/>
</start>

<event>
<if_inside_sphere name="Artemis" centerX="96000" centerY="0" centerZ="46000" radius ="10000"/>
<if_variable name="beenAmbushedAtDS288" comparator="!=" value="1" />
<set_variable name="beenAmbushedAtDS288" value="1"/>
<create type="enemy" name="F73" x="92500" y="0" z="40500" angle="180" raceKeys="Kralien enemy" hullKeys="small" fleetnumber="28"/>
<create type="enemy" name="F62" x="91750" y="0" z="39050" angle="180" raceKeys="Kralien enemy" hullKeys="small" fleetnumber="28"/>
<create type="enemy" name="035" x="90300" y="0" z="40300" angle="180" raceKeys="Kralien enemy" hullKeys="medium" fleetnumber="28"/>
<log text="Ambush at DS288"/>
</event>


As the player approaches the space station the enemies pop up out of the nearby nebula (not described
above) and they point towards the station; but I want them to aggressively attack the player instead
of hovering where they are created.

Do I need to use <add_ui> for each enemy? Can I assign the AI to the fleet or the fleet leader?
How do I know who's the fleet leader?
[Last edited May 18, 2012 07:34:31]
hobbyist game developer
page   1
1 reply
avatar
Mike_Substelny said May 19, 2012 02:09:54
Yes, you should use add_ai. The problem that you are having is that the default enemy AI cannot see very far in a nebula, so they generally ignore everything.

Unless you clear it and build a stack from scratch you don't know who will be the leader. All you really need is one line per ship:

<add_ai name ="F73" type ="CHASE_PLAYER" value1="15000" value2="12000"/>
<add_ai name ="F62" type ="CHASE_PLAYER" value1="15000" value2="12000"/>
<add_ai name ="O35" type ="CHASE_PLAYER" value1="15000" value2="12000"/>

This would cause them to chase Artemis if it comes within 15000 meters in open space or 12000 meters in a nebula.
"Damn the torpedoes! Four bells, Captain Drayton!"

(Likely actual words of Admiral David Farragut, USN, at the battle of Mobile Bay. Four bells was the signal for the engine room to make full steam ahead).
Login below to reply: