Jump to content

Recommended Posts

_civkilled = addMissionEventHandler ["EntityKilled",{if (((_this select 1) == player) && (side (_this select 0) == civilian)) then {[[], "ray_lose_fnc", true, true] call BIS_fnc_MP; [[(_this select 1)], "ray_killer_fnc", true, true] call BIS_fnc_MP; }else{}; }];

 

I have this type of code... it works correctly. But if i kill the second teammate in the group of the player (blufor) the trigger fires...

Thanks :)

Share this post


Link to post
Share on other sites

if someone (from the players, blufor) is killing a civilian the mission should end as lose. -> that is working

the mission also end as lose if someone is teamkilling (blufor). You can kill the first teammate and nothing will happen, but if you kill the second one the mission end also as lose? <- thats my problem...
 

Share this post


Link to post
Share on other sites
10 hours ago, Flightcaptain93 said:

_civkilled = addMissionEventHandler ["EntityKilled",{if (((_this select 1) == player) && (side (_this select 0) == civilian)) then {[[], "ray_lose_fnc", true, true] call BIS_fnc_MP; [[(_this select 1)], "ray_killer_fnc", true, true] call BIS_fnc_MP; }else{}; }];

 

I have this type of code... it works correctly. But if i kill the second teammate in the group of the player (blufor) the trigger fires...

Thanks :)

I can see the part where the script handles killing civilians, but it's not readily apparent where it's supposed to handle killing teammates?

 

You probably need to add an OR statement to your script to deal with killing teammates. Something like this:

(side (_this select 0) == civilian || side (_this select 0) == west)

Note that the second statement does not check the  player's side (i.e., side (_this select 0) == side(player)) as they will be moved to another side after their rating drops low enough.

Edited by dchan200

Share this post


Link to post
Share on other sites
16 hours ago, dchan200 said:

I can see the part where the script handles killing civilians, but it's not readily apparent where it's supposed to handle killing teammates?

 

You probably need to add an OR statement to your script to deal with killing teammates. Something like this:


(side (_this select 0) == civilian || side (_this select 0) == west)

Note that the second statement does not check the  player's side (i.e., side (_this select 0) == side(player)) as they will be moved to another side after their rating drops low enough.

:) no there should be no punishment for killing teammates. the first statement (_this select 1) == player) checks if the killer is an player. the second one (_this select 0) == civilian) if an civilian was killed. if both of them are true my script should be executed. That works... but accidentally the trigger fires when the player killes 2 blufor units.... and that is weird. I dont get why the script does this??? mayby i miss something important?

Share this post


Link to post
Share on other sites
_civkilled = addMissionEventHandler [ "EntityKilled", {
	params[ "_killed", "_killer", "_instigator" ];
	
	if ( (_instigator isEqualTo player) && (side group _killed isEqualTo civilian) ) then {
		[] remoteExec [ "ray_lose_fnc", 0, true ];
		[ _killer ] remoteExec [ "ray_killer_fnc", 0, true ];
	};
}];

A killed unit automatically becomes civilian, so when killing team mates when checking their side they will be civilians. Instead check the side of the group they belong to.

  • 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

×