Jump to content
Sign in to follow this  
iTicTactical

Target Kill Identification/Response

Recommended Posts

Hey all,

 

In my scenario player_1 and player_2 have an opportunity to kill sentry_1. To be dynamic, I want to code in a radio response from the player who killed him. Something simple like "Dropped him." for example.

 

I know how to code the speech, what I don't know is how to identify which player killed sentry_1. I've looked at if and or but I can't figure out how to compile it into a working script.

 

Any guidance is appreciated. Cheers!

Share this post


Link to post
Share on other sites

So what you need is a "killed" eventhandler

 

from the Wiki:

this addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; }];

 

So you would add something like that to the target or sentry_1. Select 1 would be the Killer.

  • Like 2

Share this post


Link to post
Share on other sites
4 hours ago, froggyluv said:

So what you need is a "killed" eventhandler

 

from the Wiki:

this addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; }];

 

So you would add something like that to the target or sentry_1. Select 1 would be the Killer.

 

Thanks for the reply. It looks like I've got the eventHandler to work simply from using this addEventHandler ["killed", "hint format ['Killed by %1',_this select 1]"]; but I want to swap the response from a hint to something like a groupChat format. Assuming that you can alter that particular code, changing hint format to groupChat doesn't work. If not, what would the code look like if I had to use a separate script? I've tried _instigator groupChat "Dropped him."; but that doesn't want to work either.

Share this post


Link to post
Share on other sites

You are missing the params?

this addEventHandler ["killed", {
  params ["_unit", "_killer", "_instigator", "_useEffects"];
  _instigator groupChat "Dropped him."
}];

 

  • 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
Sign in to follow this  

×