Jump to content
fawlty

enable ai path within trigger radius

Recommended Posts

Guys I'm trying to enable ai path for all enemy ai within the radius of a trigger.

I've used this to delete after leaving a played area

call{{deleteVehicle _x} forEach nearestObjects [junk_1, ["all"], 75];}                  (junk_1 being the trigger name)

but want to enable path as we approach a zone 

Thanks

Share this post


Link to post
Share on other sites

This might be what you are looking for:

{_x enableAI "PATH";} foreach thislist

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks Johnny, I used this in the condition, (Opfor present)

this && player inArea thisTrigger

and it worked great. Save me using modules for each ai to move.

  • Like 1

Share this post


Link to post
Share on other sites

Any suggestions of disabling  ai path once the player leaves the trigger zone?

 

I tried disableAI "PATH"  with another trigger

plus

this or player inArea thisTrigger

No Go

Share this post


Link to post
Share on other sites

You may use the same trigger, repeatable (so on deact works) thisList can't be used on deact, so you may pass a variable on AIs who have path enabled, then script for them at deact:

cond: this && player inArea thisTrigger

on act: {_x enableAI "PATH"; _x setVariable ["pathEnabled",TRUE] } forEach thisList

on deact: {_x disableAI "PATH"; _x setVariable ["pathEnabled",nil] } forEach (allUnits select { !isNil {_x getVariable "pathEnabled"} })

 

  • Like 3

Share this post


Link to post
Share on other sites

Hey Pierre, Getting a invalid number in expression error, so it's a no-go.

Share this post


Link to post
Share on other sites
1 hour ago, fawlty said:

Hey Pierre, Getting a invalid number in expression error, so it's a no-go.

Tested. That works for me.

Probably by copying / pasting the code and as usual, an invisible character added by this page.

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Right again Pierre, must have been a copy and past issue.

Checked it out this morning and works as it should.

Thanks again for you help.

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

×