Jump to content
Heidelberg

End mission by killcount + server rotation

Recommended Posts

I have two questions.

 

First; how do I make it so that if a player on the server reaches a certain amount of kills, the game finishes?

Second question; after the game finishes, how do I make it so that the server switches to another mission file that I have (switching between several different maps after each finished game)

 

Thanks in advance.

Share this post


Link to post
Share on other sites

publicEvenetHandlers FTW

 

this runs on the server killCheck runs when the unit is first killed and checks if their sides equal each other, if so then it counts it as a teamkill/suicide. then if its not a teamkill/suicide it runs setKills on the client and incriments the amount of kills the player has by 1 and then runs killLimitCheck on the server to determine if the amount of kills that player has is greater than or equal to killLimit it will run whatever is inside the if statement, i just put a hint there for now. as for mission rotation read this https://community.bistudio.com/wiki/server.cfg and scroll down to where you see it talking about mission rotation. if you run the end mission command then it should end the mission and run to the next one

 

this runs on the server

killLimit = 3;

"killCheck" addPublicVariableEventHandler
{
	private ["_data"];
	_data = (_this select 1);
	_unit = (_data select 0);
	_killer = (_data select 1);
	_CID = owner _killer;
	_teamKill = false;
	
	if (side _unit == side _killer) then
	{
		_teamKill = true;
	};
	
	if (!_teamKill) then
	{
		setKills = 1;
		_CID publicVariableClient "setKills";
	};
};


"killLimitCheck" addPublicVariableEventHandler
{
	_kills = (_this select 1);
	
	if (_kills >= killLimit) then
	{
		"KILL LIMIT REACHED" remoteExec ["hint"];
	};
};

 

this runs on the client

kills = 0;

player addEventHandler ["Killed",
{
	_unit = (_this select 0);
	_killer = (_this select 1);
	killCheck = [_unit, _killer];
	publicVariableServer "killCheck";
}];


"setKills" addPublicVariableEventHandler
{
	_add = (_this select 1);
	
	kills = kills + _add;
	
	killLimitCheck = kills;
	publicVariableServer "killLimitCheck";
};

 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, gokitty1199 said:

publicEvenetHandlers FTW

 

this runs on the server killCheck runs when the unit is first killed and checks if their sides equal each other, if so then it counts it as a teamkill/suicide. then if its not a teamkill/suicide it runs setKills on the client and incriments the amount of kills the player has by 1 and then runs killLimitCheck on the server to determine if the amount of kills that player has is greater than or equal to killLimit it will run whatever is inside the if statement, i just put a hint there for now. as for mission rotation read this https://community.bistudio.com/wiki/server.cfg and scroll down to where you see it talking about mission rotation. if you run the end mission command then it should end the mission and run to the next one

 

this runs on the server


killLimit = 3;

"killCheck" addPublicVariableEventHandler
{
	private ["_data"];
	_data = (_this select 1);
	_unit = (_data select 0);
	_killer = (_data select 1);
	_CID = owner _killer;
	_teamKill = false;
	
	if (side _unit == side _killer) then
	{
		_teamKill = true;
	};
	
	if (!_teamKill) then
	{
		setKills = 1;
		_CID publicVariableClient "setKills";
	};
};


"killLimitCheck" addPublicVariableEventHandler
{
	_kills = (_this select 1);
	
	if (_kills >= killLimit) then
	{
		"KILL LIMIT REACHED" remoteExec ["hint"];
	};
};

 

this runs on the client


kills = 0;

player addEventHandler ["Killed",
{
	_unit = (_this select 0);
	_killer = (_this select 1);
	killCheck = [_unit, _killer];
	publicVariableServer "killCheck";
}];


"setKills" addPublicVariableEventHandler
{
	_add = (_this select 1);
	
	kills = kills + _add;
	
	killLimitCheck = kills;
	publicVariableServer "killLimitCheck";
};

 

 

Correct me if i'm wrong.

So if I place BIS_fnc_endMissionServer to be executed once killLimit is reached, the mission will end for all clients, and start rotating to another mission file when I use the  lines from https://community.bistudio.com/wiki/server.cfg ?

 

Thanks for the reply.

Share this post


Link to post
Share on other sites
24 minutes ago, Heidelberg said:

 

Correct me if i'm wrong.

So if I place BIS_fnc_endMissionServer to be executed once killLimit is reached, the mission will end for all clients, and start rotating to another mission file when I use the  lines from https://community.bistudio.com/wiki/server.cfg ?

 

Thanks for the reply.

i believe that will take everyone back to the lobby but im not 100% sure on that. someone else should give a good answer.

Share this post


Link to post
Share on other sites
26 minutes ago, gokitty1199 said:

i believe that will take everyone back to the lobby but im not 100% sure on that. someone else should give a good answer.

I do believe it's the case, if I use the mission rotation in my server.cfg, it will automatically rotate to another mission file once the game is done due to killLimit being reached. Quoted from https://community.bistudio.com/wiki/server.cfg "Once the mission is done and if there are still players on the server, it will automatically switch to the next in the cycle."

Imma have to test that to see if it works out.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, Heidelberg said:

I do believe it's the case, if I use the mission rotation in my server.cfg, it will automatically rotate to another mission file once the game is done due to killLimit being reached. Quoted from https://community.bistudio.com/wiki/server.cfg "Once the mission is done and if there are still players on the server, it will automatically switch to the next in the cycle."

Imma have to test that to see if it works out.

let us know please

Share this post


Link to post
Share on other sites
On 23/5/2018 at 2:37 AM, gokitty1199 said:

let us know please

Yes, seems like the case. After reaching killLimit, the "mission complete" screen appears and with the mission rotation config in server.cfg, it rotatoes to the next mission file. It works!

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, Heidelberg said:

Yes, seems like the case. After reaching killLimit, the "mission complete" screen appears and with the mission rotation config in server.cfg, it rotatoes to the next mission file. It works!

sweet thats good to know, thanks man.

  • Like 1

Share this post


Link to post
Share on other sites

hi.

How can I count kills from opfor units with that in singleplayer?

Or score the kills from spawned opfor units to civ player?

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

×