Jump to content
Sign in to follow this  
seragavlg

Add EH to AI soldiers

Recommended Posts

I create ai soldier during mission:

unit6 = "FR_Rodriguez"createUnit [position player,group player];

unit6 addEventHandler ["FiredNear",{(_this select 0) setvehicleammo 1}];

hint"Test_1";

or

unit6 = "FR_Rodriguez"createUnit [position player,group player];

unit6 addEventHandler ["Fired",{(_this select 0) setvehicleammo 1}];

hint"Test_2";

- and this evehthandler don't work((

What i do wrong?

Share this post


Link to post
Share on other sites
What i do wrong?

1st not explaining what you want to do..

2nd thing you did wrong was posting your issue in the wrong place.

are you tying to have infinitive amount of ammo ?

if so

_unit addEventHandler ["Fired",{(_this select 0) setvehicleammo 1}];

works fine

Share this post


Link to post
Share on other sites

offtopic:

1.

ArmA 2 : CONFIGS AND SCRIPTING (addons)

Discussion on editing CPP's, SQS', SQF's and getting your work from O2 to Arma 2

or

ArmA 2 - MISSION EDITING & SCRIPTING

For discussing the technical aspects of creating custom ArmA 2 missions as well as scripting.

for my ques both of all

2.

unit6 addEventHandler ["Fired",{(_this select 0) setvehicleammo 1}]; not work(

Share this post


Link to post
Share on other sites

try

_unit6 = "FR_Rodriguez" createUnit [position player,group player,"this addEventHandler ['Fired',{(_this select 0) setvehicleammo 1}] ;", 0.5, "private"];

Share this post


Link to post
Share on other sites

thx nuxil!!!

All work.

---------- Post added at 07:03 PM ---------- Previous post was at 06:07 PM ----------

hmm........

unit6 = "FR_Rodriguez" createUnit [position player,group player,"this addEventHandler ['Fired',{(_this select 0) setvehicleammo 1}] ;", 1, "COLONEL"];

unit6 setskill ["aimingAccuracy",1];

unit6 setskill ["aimingShake",1];

unit6 setskill ["aimingSpeed",1];

unit6 setskill ["endurance",1];

unit6 setskill ["spotDistance",1];

unit6 setskill ["spotTime",1];

unit6 setskill ["courage",1];

unit6 setskill ["reloadSpeed",1];

unit6 setskill ["commanding",1];

unit6 setskill ["general",1];

unit6 addEventHandler ["Killed",{[_this select 0,_this select 1,west] Spawn UnitKilled}];

hint"ready for battle";

after i need to remove both EH:

unit6 removeAllEventHandlers "killed";

unit6 removeAllEventHandlers "fired";

Killed - removed, but fired???(after initialization this eh won't remove)

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  

×