Jump to content

Recommended Posts

I need either a script or in trigger action that will kill AI units that leave the area.

I want to also separate the types, example: I have an inner radius lets say 250 by 250 that AI infantry units must stay in. If they leave this area then they will die.

Then I have an outer radius, 500 by 500, that allows AI Land vehicles to operate through, they are also allowed in the inner radius but if they leave the outer radius then they will be destroyed.

The land vehicles include all land vehicles, not just tracked and tanks.

I have thought of using multiple triggers to compare what is in the larger circle which is not in the smaller circle at which the trigger will kill the AI that is not within both triggers but I am not sure how to do that or if there is an easier way.

Share this post


Link to post
Share on other sites

Give each unit a name. Then name them within the trigger and only the named units will be deleted.

Share this post


Link to post
Share on other sites

For the outer trigger, set the faction as present, and in the activation put:    {_x setDamage 1} foreach thisList; 

That will kill any AI from that faction when they enter the trigger.

  • Like 2

Share this post


Link to post
Share on other sites
On 9/16/2019 at 6:26 AM, Joe98 said:

Give each unit a name. Then name them within the trigger and only the named units will be deleted.

Yes, this is one way to do it. But, when im using a script to spawn a lot of ai units naming them will be an issue as well as updating a trigger.

 

On 9/16/2019 at 9:45 AM, Gunter Severloh said:

For the outer trigger, set the faction as present, and in the activation put:    {_x setDamage 1} foreach thisList; 

That will kill any AI from that faction when they enter the trigger.

I am trying to keep them within a given radius, using this method I would have to create a lot of triggers outside that radius which is inefficient. 

Share this post


Link to post
Share on other sites

I'm just thinking out loud but perhaps  a third trigger to mark the "outside area". Define all three areas with inArea.
And something like,

wandering=units thislist;
if (in outside area && not in inside area) then {{_x setDamage 1} forEach wandering;};

If I get a chance I'll try to actually test something like this today.

Share this post


Link to post
Share on other sites

So dont spawn the units and the problem goes away.

 

Instead, create the units and place them in an out of the way location on the map.

 

Then, use triggers to move them to new locations. Much better than spawning.

 

Share this post


Link to post
Share on other sites
On 9/15/2019 at 9:42 PM, Joedapro said:

I have an inner radius lets say 250 by 250 that AI infantry units must stay in. If they leave this area then they will die.

Then I have an outer radius, 500 by 500, that allows AI Land vehicles to operate through, they are also allowed in the inner radius but if they leave the outer radius then they will be destroyed.

 

Hello there Joedapro !

 

I really don't understand why you think that the ai will leave the from the position that you have spawned them or place them with or without wp.

I also can't understabd why you should do something like this.

Did you tried to use the https://community.bistudio.com/wiki/BIS_fnc_taskPatrol

Share this post


Link to post
Share on other sites

Here is a way , but as said why you want to do this ?!

 

GF_marker_1 = getMarkerPos "marker_1";
GF_distance = 50;


GF_Cleaner = {

	while{alive _this}do{
		if((_this distance GF_marker_1) > GF_distance)then{
			deleteVehicle _this;
			uisleep 3;
		};
	};
};


[]spawn{
	while{true}do{
		{		
			if(
			(alive _x) 
			&& (!(isPlayer _x))
			&& (!(_x getVariable ["Var_GF_Cleaner",false]))
			)then{
				_x spawn GF_Cleaner;
				};						
				_x setVariable ["Var_GF_Cleaner",true];
		}forEach allUnits;
		uisleep 3;
	};
};

 

  • Like 1

Share this post


Link to post
Share on other sites
9 hours ago, GEORGE FLOROS GR said:

 

Hello there Joedapro !

 

I really don't understand why you think that the ai will leave the from the position that you have spawned them or place them with or without wp.

I also can't understabd why you should do something like this.

Did you tried to use the https://community.bistudio.com/wiki/BIS_fnc_taskPatrol

For some reason my ai flee from the battlefield which I have to kill them off because if i use zeus to move them back in then they will just continue heading in the direction that they were fleeing. The waypoint is still there but they run away from it sometimes. Not all ai just a few but if its the group leader then the entire group will flee.

  • Like 1

Share this post


Link to post
Share on other sites
On 10/11/2019 at 11:10 AM, Joedapro said:

For some reason my ai flee from the battlefield

 

Have you tried vcom scipt etc ?

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

×