Jump to content
Sign in to follow this  
Merad

disableing all AI in an area.

Recommended Posts

//Grabs all the objects within 1000 of SleepZone Marker
Sleepers = nearestObjects [sleepZone,["All"],1000];

//Tells them to go to sleep.
Foreach "Sleepers" disableAI "Move";
Foreach "Sleepers" disableAI "Target";
Foreach "Sleepers" disableAI "Autotarget";

What I'm trying to do is have all the units in a specific area frozen until the players trip a trigger.

Unfortunatly the above doesn't work when I run it from the init.sqf

Can anyone help?

Thanks!

Share this post


Link to post
Share on other sites

Ui... this kind of foreach is new to me.... try this

Sleepers = nearestObjects [sleepZone,["Man","Car","Tank","Air"],1000];

{
_x disableAI "Move";
_x disableAI "Target";
_x disableAI "Autotarget";  
} foreach Sleepers;

P.S. nearestobjects "ALL" will get everyhing... cars, tanks, fences, buildings... and thats not what you want^^

Share this post


Link to post
Share on other sites

BTW: Better than disabling specific AI aspects is to turn it off completely using enablesimulation command ;)

Share this post


Link to post
Share on other sites

@Gaia, BTW do you know if its possible to disable the new micro AI? I want to control civs via script but of they get in danger the ai is taking them over and they are ignoring my domove commands (behaviour is careless).

Share this post


Link to post
Share on other sites

Would it not be better to have the trigger call a script that then places the AI on the map, that way no processing of them before they are triggered!

Share this post


Link to post
Share on other sites

It's a lot more difficult to spawn all this for me. The area in question has upwards of 80 AI units alone. Trying to figure out how to place each one in the specific formations they need to be in seems like a much more difficult task.

Share this post


Link to post
Share on other sites

Do they have to be placed in very exacting positions or just small localised areas.

I agree if you want exacting positions its laborious to do many with a script, but if general areas, then a load of markers on the map for each group is relatively easy.

You could also use the editor to place them, then extract the position info from the mission file to put into your own script.

Just depends on how big a mission you are building, if you have 2-3 towns with that many troops the performance could slow down a lot.

Share this post


Link to post
Share on other sites
Do they have to be placed in very exacting positions or just small localised areas.

I agree if you want exacting positions its laborious to do many with a script, but if general areas, then a load of markers on the map for each group is relatively easy.

You could also use the editor to place them, then extract the position info from the mission file to put into your own script.

Just depends on how big a mission you are building, if you have 2-3 towns with that many troops the performance could slow down a lot.

Exact. You have two sides fighting (sudden outbreak of fighting in a formation).

I'm having a lot of trouble getting the given script to fire.

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  

×