Jump to content

Recommended Posts

how do i addscore when a enemy unit is killed anywhere on the map my unit  gains 10 points? 

Share this post


Link to post
Share on other sites

You can use the addScore function in a killed Event Handler like this:

if(isServer) then {
	unitKilled = {
		{
			if(side _x isEqualTo WEST) then {
				_x addScore 10;	//Or whatever you want (addScore only works in MP)
			};
		} forEach allPlayers;
	};

	{
		if(side _x isEqualTo EAST) then {
			_x addEventHandler ["killed", unitKilled];
		};
	} forEach allUnits;
};

(create a init.sqf in your mission directory and paste the code above)

This works for MP

The Unit which has killed the enemy will get the score in addition to the default score

Share this post


Link to post
Share on other sites
5 hours ago, Tschuuut said:

You can use the addScore function in a killed Event Handler like this:


if(isServer) then {
	unitKilled = {
		{
			if(side _x isEqualTo WEST) then {
				_x addScore 10;	//Or whatever you want (addScore only works in MP)
			};
		} forEach allPlayers;
	};

	{
		if(side _x isEqualTo EAST) then {
			_x addEventHandler ["killed", unitKilled];
		};
	} forEach allUnits;
};

(create a init.sqf in your mission directory and paste the code above)

This works for MP

The Unit which has killed the enemy will get the score in addition to the default score

THANKYOU ill try it out when i get home 

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

×