Jump to content
Sign in to follow this  
BEAKSBY

Issue with sideEnemy?

Recommended Posts

Has anyone had issues with sideEnemy before?

I'm running the following in my initServer.sqf

_handle = _x addEventHandler [ "Killed", { 

             _unit = _this select 0; 
             _killer = _this select 1; 
             _handle = _unit getVariable [ "DNA_EH_Killed_Money", -1 ]; 


      	if ((side group _killer != side group _unit) && (side group _killer != sideEnemy)) then {
hint format ["side group _killer: %1 \n side group _unit: %2", side group _killer, side group _unit];
{...more code}
};

...and when a player kills a friendly on the map he turns purple, yet the hint

side group _killer
still diplays he is still on his original side, and the code after the if statement is also executed as if the condition was TRUE?

I thought it would display as "renegade" or "enemy"?

How then do I ensure that if a player kills one of his own the following is FALSE?

((side group _killer != side group _unit) && (side group _killer != sideEnemy)) 

Share this post


Link to post
Share on other sites

maybe even

!(side _killer isEqualTo sideEnemy)

Share this post


Link to post
Share on other sites

Not sure about sideEnemy, maybe that one is a bit outdated.

Try checking "rating" against -2000 instead.

Alternately if you're not just looking for renegades, you can use this to check if someone is hostile:

_unit countEnemy [_killer] > 0;

Edited by Tajin

Share this post


Link to post
Share on other sites
Has anyone had issues with sideEnemy before?

I'm running the following in my initServer.sqf

_handle = _x addEventHandler [ "Killed", { 

             _unit = _this select 0; 
             _killer = _this select 1; 
             _handle = _unit getVariable [ "DNA_EH_Killed_Money", -1 ]; 


      if ((side group _killer != side group _unit) && (side group _killer != sideEnemy)) then {
hint format ["side group _killer: %1 \n side group _unit: %2", side group _killer, side group _unit];
{...more code}
};

...and when a player kills a friendly on the map he turns purple, yet the hint still diplays he is still on his original side, and the code after the if statement is also executed as if the condition was TRUE?

I thought it would display as "renegade" or "enemy"?

How then do I ensure that if a player kills one of his own the following is FALSE?

((side group _killer != side group _unit) && (side group _killer != sideEnemy)) 

I'd guess your code is executed before the actual side change... side _unit returns ENEMY pretty reliable if the rating is in big negative

Share this post


Link to post
Share on other sites
(side _killer != sideEnemy)

?

I went with this one and it works.

To DarkWanderer's point

I'd guess your code is executed before the actual side change...
I think this is no longer true, as the addEventHandler "Killed" respects the if condition in my code now that I replaced it with side _killer != sideEnemy.

Thanks again everyone

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  

×