Jump to content
Sign in to follow this  
RiesWeug

Making a TDM server with killstreaks

Recommended Posts

Hello everyone!

Me and my friend are trying to make a server, and we are trying to code our own mission. We want to have vehiclerespawn, and a kill objective. We are verry noobish at scripting, so we need your help. Please remember we are noobs, and some explanation might be usefull. Also, I'm Dutch so my English is not that good.

VehicleRespawn

We were trying to search a script for this, but we didn't find any working ones.

Kill Objective

We are thinking of adding a trigger over the whole map, which checks if blufor kills or opfor kills are equal to 20. How do we do this, and is this the best way to do it?

Killstreaks

I don't know how to do this, not a clue!

Thanks!

Share this post


Link to post
Share on other sites

Vehicle Respawn - Place down a Module -> MP -> VehicleRespawn, set it's values and synch it with your vehicle.

Kill Objective - Trigger isn't a good plan, use Killed Eventhandlers to count instead. This has been done before so search and you'll find it.

KillStreaks - http://www.callofduty.com/ maybe? :) Probably could keep track of that as you keep track of deaths, record each killer as a variable with kill count and reset it on death?

Share this post


Link to post
Share on other sites

Press F5 to enter Synchronize Mode. Then drag from the vehicle respawn module onto the vehicle itself. A dark blue line will appear and connect the two objects. Press F1 to get back into "Place Unit" mode.

Share this post


Link to post
Share on other sites

I'll take a shot at trying to count team kills and executing code when each team achieves the set kill amount.

Just a 5-10 minute script but i think it will work

Init.sqf

WestKillCount = 0;
EastKillCount = 0;
MaxTeamKills = 20;

publicvariable "WestKillCount";
publicvariable "EastKillCount";
publicvariable "MaxTeamKills";

playerKilled = CompileFinal preprocessFileLineNumbers "playerKilled.sqf";
player addMPEventHandler ["mpkilled", {[_this select 0, _this select 1] Spawn playerKilled}];

if (isServer) then {ExecVM "WestFancyloop.sqf"};

//also make a EastFancyloop.sqf and change the code to proper team for east and run this: if (isServer) then {ExecVM "EastFancyloop.sqf"}; 

playerKilled.sqf

_victim = _this select 0;
_killer = _this select 1;


if (_victim == _killer) exitWith {}; 


         if (_victim != _killer && side _victim == east) then {

    WestKillCount = WestKillCount + 1;
    publicvariable "WestKillCount";

  };

       if (_victim != _killer && side _victim == west) then {

    EastKillCount = EastKillCount + 1;
    publicvariable "EastKillCount";

  };

  waitUntil {alive player};

WestFancyloop.sqf



WestKillsEnd = true;

        //loop
	 while {WestKillsEnd} do {

          if (WestKillCount == MaxTeamKills) then {


           //Do  fancy stuff here when west reaches 20 kills


		//then exit loop when done
		WestKillsEnd = false; 

};
   sleep 10;	

    };

Edited by falconx1

Share this post


Link to post
Share on other sites

it's pretty much the same as what i posted except u can use "objectName" setVariable [killstreak, value, (public)] bolean example: player or killer setVariable["killstreak", 1,true]; then set to nill when killer dies but looking at his mission scripts or asking him is the best option for a new coder. Iv'e never made a killstreak script yet but i know how it's done logic wise.

Share this post


Link to post
Share on other sites
I'll take a shot at trying to count team kills and executing code when each team achieves the set kill amount.

Just a 5-10 minute script but i think it will work

Init.sqf

WestKillCount = 0;
EastKillCount = 0;
MaxTeamKills = 20;

publicvariable "WestKillCount";
publicvariable "EastKillCount";
publicvariable "MaxTeamKills";

playerKilled = CompileFinal preprocessFileLineNumbers "playerKilled.sqf";
player addMPEventHandler ["mpkilled", {[_this select 0, _this select 1] Spawn playerKilled}];

if (isServer) then {ExecVM "WestFancyloop.sqf"};

//also make a EastFancyloop.sqf and change the code to proper team for east and run this: if (isServer) then {ExecVM "EastFancyloop.sqf"}; 

playerKilled.sqf

_victim = _this select 0;
_killer = _this select 1;


if (_victim == _killer) exitWith {}; 


         if (_victim != _killer && side _victim == east) then {

    WestKillCount = WestKillCount + 1;
    publicvariable "WestKillCount";

  };

       if (_victim != _killer && side _victim == west) then {

    EastKillCount = EastKillCount + 1;
    publicvariable "EastKillCount";

  };

  waitUntil {alive player};

WestFancyloop.sqf



WestKillsEnd = true;

        //loop
	 while {WestKillsEnd} do {

          if (WestKillCount == MaxTeamKills) then {


           //Do  fancy stuff here when west reaches 20 kills


		//then exit loop when done
		WestKillsEnd = false; 

};
   sleep 10;	

    };

Thanks you so much! Im not a coder though, so I don't know what to put in the do fancy stuff section. I just want to restart the mission at that point.

Share this post


Link to post
Share on other sites

if you want it to end mission etc then you need to make a file called Description.ext and put it in your mission directory then put this code in the file:

keep in mind all this code is untested it's just a quik mockup of logic, but glancing at it appears to be workable to me, you can try it, test it or what ever you want:P

Description.ext

///////////////////////////////////////////////////////////
class CfgDebriefing
//--- endings // blue side first
{  
class End1
{ //West winner
	title = "Mission Complete";
	subtitle = "";
	description = "Your team has won the battle.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.0,0.3,0.6,1};
};

class End2
{ //East loser
	title = "Mission Failed";
	subtitle = "";
	description = "Your team has lost the battle.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.5,0.0,0.0,1};
};





};
///////////////////////////////////////////////////////////

here is the modded loop to call the proper ending for each team.

WestFancyloop.sqf //:P



WestKillsEnd = true;

        //loop
        while {WestKillsEnd} do {

          if (WestKillCount == MaxTeamKills) then {


           //Do fancy stuff here when west reaches 20 kills
    ["End1","BIS_fnc_endMission",west] call BIS_fnc_MP; 
           ["End2","BIS_fnc_endMission",east] call BIS_fnc_MP;  


           //then exit loop when done
           WestKillsEnd = false; 

   };
      sleep 10;    

    };  

Edited by falconx1

Share this post


Link to post
Share on other sites
if you want it to end mission etc then you need to make a file called Description.ext and put it in your mission directory then put this code in the file:

keep in mind all this code is untested it's just a quik mockup of logic, but glancing at it appears to be workable to me, you can try it, test it or what ever you want:P

Description.ext

///////////////////////////////////////////////////////////
class CfgDebriefing
//--- endings // blue side first
{  
class End1
{ //West winner
	title = "Mission Complete";
	subtitle = "";
	description = "Your team has won the battle.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.0,0.3,0.6,1};
};

class End2
{ //East loser
	title = "Mission Failed";
	subtitle = "";
	description = "Your team has lost the battle.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.5,0.0,0.0,1};
};





};
///////////////////////////////////////////////////////////

here is the modded loop to call the proper ending for each team.

WestFancyloop.sqf //:P



WestKillsEnd = true;

        //loop
        while {WestKillsEnd} do {

          if (WestKillCount == MaxTeamKills) then {


           //Do fancy stuff here when west reaches 20 kills
    ["End1","BIS_fnc_endMission",west] call BIS_fnc_MP; 
           ["End2","BIS_fnc_endMission",east] call BIS_fnc_MP;  


           //then exit loop when done
           WestKillsEnd = false; 

   };
      sleep 10;    

    };  

I tried it out with 5 kills, but nothing seems to happen. Also, I got more lines of code in my description.ext, but I don't think that has anything to do with it.

Do you have teamviewer or something?

Share this post


Link to post
Share on other sites

It was the side check causing a problem so made changes. i just tested this modded code and it works.

all you have to do is mod the playerKilled.sqf and use all the code below. if it don't work after that something in your other files is wrong.

playerKilled.sqf

_victim = _this select 0;
_killer = _this select 1;
_Victim_Team = side (group _victim); 
_Killer_Team = side (group _killer); 

//Don't count Teamkill's
if (_Victim_Team == _Killer_Team )  exitWith {}; 

if (_victim == _killer) exitWith {}; 


         if (_victim != _killer && _Victim_Team == east) then {

    WestKillCount = WestKillCount + 1;
    publicvariable "WestKillCount";

    //hint format ["Victim Faction: {%1} west kills: {%2} max team kills: {%3} ",_Victim_Team, WestKillCount, MaxTeamKills];
  };

        if (_victim != _killer && _Victim_Team == west) then {

    EastKillCount = EastKillCount + 1;
    publicvariable "EastKillCount";

    //hint format ["Victim Faction: {%1} east kills: {%2} max team kills: {%3} ",_Victim_Team, EastKillCount, MaxTeamKills];
  };

  waitUntil {alive player}; 

Edited by falconx1

Share this post


Link to post
Share on other sites
It was the side check causing a problem so made changes. i just tested this modded code and it works.

all you have to do is mod the playerKilled.sqf and use all the code below. if it don't work after that something in your other files is wrong.

playerKilled.sqf

_victim = _this select 0;
_killer = _this select 1;
_Victim_Team = side (group _victim); 
_Killer_Team = side (group _killer); 

//Don't count Teamkill's
if (_Victim_Team == _Killer_Team )  exitWith {}; 

if (_victim == _killer) exitWith {}; 


         if (_victim != _killer && _Victim_Team == east) then {

    WestKillCount = WestKillCount + 1;
    publicvariable "WestKillCount";

    //hint format ["Victim Faction: {%1} west kills: {%2} max team kills: {%3} ",_Victim_Team, WestKillCount, MaxTeamKills];
  };

        if (_victim != _killer && _Victim_Team == west) then {

    EastKillCount = EastKillCount + 1;
    publicvariable "EastKillCount";

    //hint format ["Victim Faction: {%1} east kills: {%2} max team kills: {%3} ",_Victim_Team, EastKillCount, MaxTeamKills];
  };

  waitUntil {alive player}; 

Still doesn't seem to work. I really don't know what is causing it. We set the max kills to 5 to test it, and nothing happens. We do got other stuff in the description file. Does that matter? Maybe you can pm me your skype or something, so we can use screen sharing.

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  

×