AstralC 0 Posted August 28, 2019 Hello! I'm trying to have a killed event handler that causes a hint / something I choose to be executed on the killer and not the player who is actually killed, however I can't seem to figure out how I would do it. It always seems to only hint to the player killed. Does anybody know how I would make this work? I'm fairly new so idk what the solution to this is. Share this post Link to post Share on other sites
wogz187 1085 Posted August 28, 2019 @AstralC, Quote Does anybody know how I would make this work? I'm fairly new so idk what the solution to this is. Me too. Something like this perhaps, this addEventHandler ["killed", { killed = _this select 0; killer = _this select 1; systemchat format ["%1", killer]; }; I'll test it as soon as I get the editor loaded up. Share this post Link to post Share on other sites
AstralC 0 Posted August 28, 2019 10 minutes ago, wogz187 said: @AstralC, Me too. Something like this perhaps, this addEventHandler ["killed", { killed = _this select 0; killer = _this select 1; systemchat format ("%1", killer) } I'll test it as soon as I get the editor loaded up. No I was needing something that would do something only for the killer, like a hint appearing only on the killers screen and not the actual person killed. I'm making a KDR script that would need this for the killer: profileNamespace setVariable ["p_kills", (profileNamespace getVariable "p_kills") + 1]; profileNamespace setVariable ["p_kdr", ((profileNamespace getVariable "p_kills") / (profileNamespace getVariable "p_deaths"))]; titleText [format ["Your KDR is now %1!.\nYou have %2 kills, and %3 deaths.", (profileNamespace getVariable "p_kdr"), (profileNamespace getVariable "p_kills"), (profileNamespace getVariable "p_deaths")], "PLAIN"]; Share this post Link to post Share on other sites
wogz187 1085 Posted August 28, 2019 Okay. I have no idea. Maybe something like this, addMissionEventHandler ["entityKilled", {params ["_killed","_killer"];if (local _killer) then {hint format ["%1", _killer];}}]; It returns the killer, maybe that's a start. 1 Share this post Link to post Share on other sites
beno_83au 1362 Posted August 28, 2019 https://community.bistudio.com/wiki/remoteExec this addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; ["Test"] remoteExec ["hintSilent",_killer]; }]; This is one way of doing it, but if you're creating a MP mission you're usually going to need remoteExec anyway. There's also the "MPKilled" event handler (as well as others), but it just depends on what you want to achieve. "Killed" may be best for now. 3 Share this post Link to post Share on other sites
bumyplum 10 Posted August 29, 2019 Would you not be able to use player variables instead of profileNamespace? You'd be able to do something along the lines of player addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; _killer setVariable["p_kills", ((_killer getVariable ["p_kills", 0])+1, true); }]; Just a thought 🙂 Share this post Link to post Share on other sites
beno_83au 1362 Posted August 29, 2019 40 minutes ago, bumyplum said: Would you not be able to use player variables instead of profileNamespace? You'd be able to do something along the lines of player addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; _killer setVariable["p_kills", ((_killer getVariable ["p_kills", 0])+1, true); }]; Just a thought 🙂 The OP wants something that's executed on the killer though, and even specifies a hint as an example. If written correctly, you're example would add 1 to that variable, but it's not executing any code on the killer's client. Share this post Link to post Share on other sites