Jump to content
Sign in to follow this  
chow86

Excluding certain vehicles from a list

Recommended Posts

I want to disable the ability of civilian units to move within a certain trigger area when the player is also in this trigger area (as these units tend to do weird things/ be distracting/get themselves killed).  However, I want to except from this two vehicles that are vital to the mission.

The following script works to disable the AI of civilians when the player is in the area, and enable it when he is not.  However, it doesn't work to except the two vehicles.  The only theory I have got so far is that it is something to do with agents, but I am not sure how to handle these.
 

while {planeattack==false} do {

	{
			if ((_x != offroad1) or (_x != offroad2) or (vehicle _x != offroad1) or (vehicle _x != offroad2) or (_x != driver1) or (_x != driver2)) then { 
				if (canproceed==false) then
				{
					_x disableai "path";
				}
				else
				{
					_x enableai "path";
				};
			};
	} foreach civiliansindanger;
	sleep 4;
};

offroad1 and offroad2 = the vehicles

driver1 and driver2 = their drivers

civiliansindanger = a repeating trigger of all civilians in the area

canproceed = determined by 2 triggers.  It's true if the player is out of the trigger area.

 

Any help would be appreciated.

Share this post


Link to post
Share on other sites

That if condition does nothing - it is always true.

 

If you have a list of units (civiliansInDanger) and you want to exclude units who are inside either of the two vehicles (offroad1, offroad2), you can do this:

civiliansToStop = civiliansInDanger select {
  !((vehicle _x) in [offroad1, offroad2])
};

 

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  

×