Jump to content
Sign in to follow this  
Aebian

Hit EventHandler explain please

Recommended Posts

Hi,

I try to get a EventHandler working. I wanna select the shooter that fired at me. I'm using currently this but its not working:

_knight addeventhandler [{hit},{["_knight,   _shooter, ]} hint "_shooter"]

How I do this? The Biki and 1 hour of google.ca use didn't bring up the right answer =/

Share this post


Link to post
Share on other sites

simple who shot

_knight addeventhandler ["hit",{hint format ["shooter %1",(_this select 1)]}]  ;

full info

_knight addeventhandler ["hit",{hint format ["Hit : %1\n shooter : %2\n Damage : %3",(_this select 0),(_this select 1),(_this select 2)]}]

If you ever need to see what info the EVH returns just use hint str _this and then use (_this select xx) where xx points to the element of the array you wish to use

_knight addeventhandler ["hit",{hint str _this}]; 

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Thanks for the help. Your first code worked. Nut is there a way to use the shooter for future arguments?

I wanna do something with the shooter if the shoot at me.

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/ArmA_2:_Event_Handlers#Hit

Passed array: [unit, causedBy, damage]

_knight addEventHandler["hit",{_this execVM "someFile.sqf"}];

scriptName "someFile.sqf";
private["_shooter"];
_shooter = _this select 1;
/*
YOUR
CODE
HERE
*/

or

_knight addEventHandler["hit",{_this call someVar}];
_knight addEventHandler["hit",{_this spawn someVar}];

someVar = {
private["_shooter"];
_shooter = _this select 1;
/*
YOUR
CODE
HERE
*/
};

Greez KiloSwiss

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  

×