Jump to content
Sign in to follow this  
lockjaw-65-

Spawned AI wont engage enemy

Recommended Posts

I have made a large scale mission where at various times and points I have snemy ai and friendly ai spawn. I have noticed that they wont engage each other. I play tested and I was able to stand right in the middle of an enemy group and none of them tried to kill me. I also noticed that spawned friendly units did not engage spawned enemy units either??

I have searched on this but found nothing relevant. I have units from both sides already on the map from mission start so its not that?

Any help would be great....

Share this post


Link to post
Share on other sites

Script lag can also cause this behaviour.. if you have a heavy part of the mission (lots of units spawning in at once) that could be part of the problem. Have you tried with a lower unit count to see if the problem still exists?

Share this post


Link to post
Share on other sites

createCenter shouldn't be needed if units of the same side are spawned in at mission start (center gets auto created).

Share this post


Link to post
Share on other sites

I dont think its the create centre as in the beggining the spawned AI do engage. So with this in mind I am thinking its more script lag that Savage suggested. I will try it tonight by lowering the ai count and see if this works. thanks all!

Share this post


Link to post
Share on other sites

I've also encounterd problems with mid-mission spawned units.

You should have dummy units of each faction on the map (hideobject true, enablesimulation false, setcaptive true, setpos [-10000,-10000,-10]). A mid-mission spawned unit then should

[unit] joinsilent grpNull;

[unit] joinsilent dummy;

[unit] joinsilent grpNull;

and eventually (if not meant to remain ungrouped) [unit] joinsilent finalleader;

This solves the problem of factionless mid-mission spawned units.

Share this post


Link to post
Share on other sites

don't use setcaptive, as setCaptive sets the units side to civilian

Share this post


Link to post
Share on other sites

Setcaptive just makes other factions see that 'captive' unit as civilian, so to speak. It remains on its side. Anybody who joins the setcaptive unit, receives the faction "behind" the setcaptive.

An armed setcaptive unit still attacks enemies, but is not attacked by anybody. Actually a setcaptive unit is nothing, even not civilian. When there is east setfriend [civilian,0] for example, east units do not attack that setcaptive unit. Setcaptive also overrides a bad rating, such as -10000.

The code mentioned in my first post belongs right after your code that spawns your mid-mission units.

Following goes into the init lines of the dummies:

this setskill 0; removeallweapons this; this hideobject true; this enablesimulation false; this setcaptive true; this setpos [-10000,-10000,-10];

Actually anybody joining them, should instantly be ungrouped from them. Otherwise subordinated AI will move towards their position.

Edited by RogueTrooper

Share this post


Link to post
Share on other sites

Sorry for long delay but i did give up on this mission for a while. but now I really want it to be finished. Just to clarify on this do I put this code after every individual unit that is spawned or every group?

[unit] joinsilent grpNull;

[unit] joinsilent dummy;

[unit] joinsilent grpNull;

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×