What i am wanting to achieve is for the player to follow a ship defined in mission through a wormhole. For this to happen i think it would be best for said ship to only start its hyperspace on sight of player ship or maybe if it has been targeted by playership any thoughts on this and how would i achieve this?
Would it be best to create my own AI or use ExitingTraderAI
Upon the target ship exiting from Witchspace i wish to change the AI to either pirate or trader haven't decided which. Would i achieve this in the ship script through.
switchAITo: pirateAI.plist ..............etc
I think mainly what i am after is a few pointers before i take the plunge with AI
Upon the target ship exiting from Witchspace i wish to change the AI to either pirate or trader haven't decided which. Would i achieve this in the ship script through.
switchAITo: pirateAI.plist ..............etc
I think mainly what i am after is a few pointers before i take the plunge with AI
The easiest to do is start with a copy of parts from exitingTraderAI. Just remember: when the player follows, the current AI is restarted with the GLOBAL state, but with the waiting message: "EXITED WITCHSPACE".
That message can be used to change AI after the jump, like exitingTrader does with
Thanks for reply.
One question just to clarify things for me the GLOBAL state is this just the first "stack" in the AI.plist.
So in above code the GLOBAL state would be in stack
Tso GLOBAL is the first state a object with given AI will enter into from the AI stack.
Yes, that is the one the system looks for to start things. You could do your stuff already in that state, but it is common practice to immediately jump to an other state in that enter to work in a state with a more descriptive name.
Just one warning. performHyperSpaceExit adds a new ship with the same role at the current witch-space entry point. (don't confuse this with the jumping ship because that only appears in the other system after a jump). This is to keep the number of ships in the current system constant. It is mainly used for traders. For every trader that jumps out of the system near the station, another is added near the witch-space entry point.
For custom AI scripts this is often undesired and the use of performHyperSpaceExitWithoutReplacing is better.
Just one warning. performHyperSpaceExit adds a new ship with the same role at the current witch-space entry point. (don't confuse this with the jumping ship because that only appears in the other system after a jump). This is to keep the number of ships in the current system constant. It is mainly used for traders. For every trader that jumps out of the system near the station, another is added near the witch-space entry point.
For custom AI scripts this is often undesired and the use of performHyperSpaceExitWithoutReplacing is better.
Ah thanks for your help i didn't use performHyperSpaceExitWithoutReplacing because i thought if you follow this ship it wouldn't appear in next system. Many thanks