Removing target and setting target on other ship

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4814
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Removing target and setting target on other ship

Post by phkb »

If I remove a target from another ship in the middle of a complex battle (ie. a battle where there is more than 1 ship on the players side -- I'm sure there are even more complex scenarios, but that will do for the moment!), will that ship then automatically find another target, or do I need to force the AI to do a search for another target?

Also, can I remove a target from another ship's potential list of targets. So, if I remove a target from a ship, how do I stop that ship from re-acquiring the same target again?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Removing target and setting target on other ship

Post by cim »

phkb wrote:
If I remove a target from another ship in the middle of a complex battle (ie. a battle where there is more than 1 ship on the players side -- I'm sure there are even more complex scenarios, but that will do for the moment!), will that ship then automatically find another target, or do I need to force the AI to do a search for another target?

Also, can I remove a target from another ship's potential list of targets. So, if I remove a target from a ship, how do I stop that ship from re-acquiring the same target again?
Removing the current target will send the ship a target lost event, which will cause it to re-evaluate its AI, which will usually cause it to acquire a new target from its list of known hostiles.

If you want to make it harder for it to reacquire the same target as before, you'll also need to do ship.removeDefenseTarget(oldTarget);

Events during the battle are likely to add it back at some point however, unless the removed target ceases firing on allied (non-player) ships.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4814
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Removing target and setting target on other ship

Post by phkb »

Thanks cim!
Post Reply