Jump to content
amirtech

EnableAI (INT) when i go to trigger

Recommended Posts

Hi Guys, I Have Problem , I Want to Create A Trigger for  AI ,when i go to a trigger  int script is activated and when i Coming out of trigger , Int script is disable

my int scriptAI is (((( this dofire target1; this allowdamage false; this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]   ))))
Please  help :( tnx

Share this post


Link to post
Share on other sites

your init field in AI is not the best way to script something.

anyway, just add a triggerActivated condition.

Say you named your trigger trig1:

if (isServer) then { this spawn { waitUntil {sleep 0.5; triggerActivated trig1}; _this dofire target1; _this allowdamage false; _this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}] }  };

  • Thanks 1

Share this post


Link to post
Share on other sites
On 10/20/2017 at 8:41 PM, pierremgi said:

your init field in AI is not the best way to script something.

anyway, just add a triggerActivated condition.

Say you named your trigger trig1:

if (isServer && triggerActivated trig1) then {this dofire target1; this allowdamage false; this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]   };



 

if (isServer && triggerActivated trig1) then {this dofire target1; this allowdamage false; this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]   };

Where to enter the code 

int solider or trig1

see my photo


BOoEDUK.jpg


ozrhejK.jpg

Share this post


Link to post
Share on other sites

Referring to <this> for doFire and so on, <this> must be the unit(s) who fire. So init field of each units supposed to fire.

But your script will not work as you want to shoot civilians. Search for other topics to make it work.

 

Something to be tested:

 

  if (isServer) then {
   this spawn {  
    waitUntil {sleep 0.5; triggerActivated trig1};
     while {alive _this} do {
       _this doTarget target1;  
       if ((_this weaponDirection primaryWeapon _this)vectorDotProduct vectorNormalized (getpos b1 vectordiff getpos _this) >0.99) then {

          _this forceWeaponFire [primaryWeapon _this,currentweaponMode _this]
       };
     };
   };
 };

 

 

 

 

 

  • Like 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

×