alleycat 28 Posted March 6, 2016 I am trying to detect teamkills from a MPKilled event handler. if ((side _unit) != (side _causedBy)) then { systemchat "kill"; }; if ((side _unit) == (side _causedBy)) then { //Suicide if (_unit == _causedBy) then { systemchat "suicide"; } //It's a teamkill else { systemchat "teamkill"; }; }; _unit is the unit that was killed. _causedBy is the killer. When I shoot a friendly AI, it always counts as a normal kill. My suspicion is that the moment I kill a friendly the game turns me into a renegade and the side check passes. So I was looking for a way to compare configs of units. For CSAT, all infantry soldiers have "O_Soldier_base_F" as a parent. So I was looking for a way to compare whether shooter and victim share the same parents. I have looked at: https://community.bistudio.com/wiki/inheritsFrombut that does not seem to do what I want. As a last resort I can check for similar uniforms of both units. 1 Share this post Link to post Share on other sites
Larrow 2822 Posted March 6, 2016 A dead unit is side civilian. Check its groups side instead or if its a player you can use playerSide or maybe BIS_fnc_objectSide if you know the unit type is always going to associated with its default config side (e.g its not a Blufor unit grouped into a EAST group) 1 Share this post Link to post Share on other sites
alleycat 28 Posted March 6, 2016 Thanks for the tip. BIS_fnc_objectSide works, it checks the side the player is before any dynamic change. 1 Share this post Link to post Share on other sites
Tajin 349 Posted March 7, 2016 Not exactly. "BIS_fnc_objectSide" checks the default side of a unit, as defined in its config. That won't work if you let a unit switch sides or similar. Using playerSide is probably a better idea. You could also use "HandleDamage" instead. That EH is a bit more complex, but it fires before the actual death occurs, which gives you more options (like logging the recieved damage for later use). You could even use that to reduce damage recieved from friendlies by a certain amount, mirror it, or negate it completely. Share this post Link to post Share on other sites
Tajin 349 Posted March 8, 2016 So I just stumbled across the "HandleScore" eventhandler. This could make your teamkill-check really easy. The only slightly complex part about it is that you have to re-add this Eventhandler on respawn. Everything else is a breeze. You basically only have to do an "isPlayer" check and test if the score-change is negative. Share this post Link to post Share on other sites