Jump to content
Kieran Hayns

Trigger target all of Opfor & Kill at a distance

Recommended Posts

Sorry to raise two questions in one post.

 

Im currently creating a zombie mission. During certain scenes and in certain areas i want ALL Opfor units to stop moving by disabling their Move AI when the player enters a trigger.

However i cant seem to get the disableAI action to target all of opfor.

 

My second questions is similar in that i want to make it that any zombies that are a certain distance away from a player unit die/are deleted.  Again i need a trigger that will target and kill any enemies that stray to far from the players

 

Thanks in advance

 

 

Share this post


Link to post
Share on other sites

For the first question just place an object at the center of where you would place the trigger and then place a trigger with a condition:

 

NameOfObject distance NameOfPlayer < 100

 

where 100 is the distance in meters. Then on activation:

 

{ if (side _x == opfor) then { _x disableAI "MOVE"; }; }forEach allUnits;

For the second question the same logic can work. Will leave it for you to find. Just notify if there is any trouble 👍

  • Like 1

Share this post


Link to post
Share on other sites
On 10/31/2021 at 7:35 PM, Kieran Hayns said:

Im currently creating a zombie mission. During certain scenes and in certain areas i want ALL Opfor units to stop moving by disabling their Move AI when the player enters a trigger.

However i cant seem to get the disableAI action to target all of opfor.

 

 

"During certain scenes and certain areas" is vague. ALL opfor is not (except if you just consider the opfor inside the concerned area)... All terms must be clear.

 

For All opfor (on map)

Trigger(s) anyPlayer present, repeatable, server only, (work in SP or MP)

in on activation field :  {_x disableAi "path"} forEach (allUnits select {side _x == EAST};

in deact field {_x enableAi "path"} forEach (allUnits select {side _x == EAST};

 

For ofpor in area of the concerned trigger:

anyPlayer present, repeatable, server only,

in on activation field :  {_x disableAi "path"} forEach (allUnits select {side _x == EAST && _x inArea thisTrigger});
in deact field {_x enableAi "path"} forEach (allUnits select {side _x == EAST && _x inArea thisTrigger);

That will freeze first zombies (inside)... but not arriving one (because the trigger stays active)!

For better result, you need to "rearm" the trigger,i.e. deact it, then re-act it, by an extra toggling variable. See this post. It's one method.

If multiple triggers, the variables must be adapted to each trigger.

 

On 10/31/2021 at 7:35 PM, Kieran Hayns said:

My second questions is similar in that i want to make it that any zombies that are a certain distance away from a player unit die/are deleted.  Again i need a trigger that will target and kill any enemies that stray to far from the players

 

Several methods.

If your zombies are opfor, you can attach  trigger(s) at player(s) then kill opfor outside the trigger centered on player... even if creating/deleting zombies is not optimized in this case.

Frankly, I'd rather use the mission performance setting in editor and dynamic simulation, which can hide / unhide units along with distance of player(s). Do some tests with short distance and see what occurs.

 

@JohnKalo a trigger is already an object (type: "emptyDetector"). No need to add an object as distance's reference. Just use thisTrigger in fields of the trigger (or name it).

  • Thanks 1

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

×