Jump to content
Sign in to follow this  
DeadWeight85

Adding an Event Handler (SP)

Recommended Posts

I am wanting to capture when a unit is killed, and display it sort of as a rudimentary kill tracker. I have added the event handler, with an output to but it seems to not see when the object I have is destroyed. I am sure I am missing something, but I cannot figure it out.

 

I have placed the event handler in script that is called when the addaction is used:

 

addMissionEventHandler ["EntityKilled", {hint format ["%1 was killed",name (_this select 0)];}];

 

Share this post


Link to post
Share on other sites
Guest

I think it's just "Killed" but you can use "DamageHandler"

Share this post


Link to post
Share on other sites

Tried this tonight but throws an error

Error in expression <r + 1;

Error position: <damage _skeet) > 0.1) then 
Error damage: Type String, expected Object
_skeet = "Skeet_Clay_F";
counter = 0;
 
fnc_showHits = {
hintSilent format ["You've hit %1",counter];
};
 
fnc_trackHits = {
counter = counter + 1;
 
publicVariable "Hits";
};
 
if ((damage _skeet) > 0.1) then 
{
_skeet addEventHandler ["killed", fnc_trackHits];
}
else {
"Hits" addPublicVariableEventHandler {call fnc_showHits};
};

Share this post


Link to post
Share on other sites

simply because _skeet = "Skeet_Clay_F"; which is a string, you need to actually match it up with an object that is in game, so like _skeet = "Skeet_Clay_F" createVehicle getPos _skeetMachine; this will make an actually in game object.

Also if this is for single you have added in a lot of stuff for mp that will fail because it's in single.

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  

×