Announcement

Collapse
No announcement yet.

MP TvT Tickets forConquest

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • MP TvT Tickets forConquest

    I'll edit this for use but pretty happy to share ahead of time:

    Code:
    //tickets.sqf
    
    // *************configurable values to set below here
    _ticketLimit = 100; //set this for the # of respawn tickets for each team
    
    // ***************************************************************
    
    // ******************************** set initial counters and announce that this ticket script running to all clients
    observer globalChat format ["Repsawn ticket system is running on the server. Your team has %1 tickets.", _ticketLimit];
    
    if (isServer) then
    {
    	[west, _ticketLimit] call BIS_fnc_respawnTickets;
    	[east, _ticketLimit] call BIS_fnc_respawnTickets;
    
    	// loop will also broadcast the tickets score to all players
    	// loop will also trigger mission end when tickets expire for either side
    	// loop will check for players in the other sides capture zone and decrease their tickets accordingly
    	_run = true;
    	player sideChat "This is the server";
    	while {_run} do
    	{
    		//player sideChat "Loop is running";
    		//get current scores
    		_westScore = [west] call BIS_fnc_respawnTickets;
    		_eastScore = [east] call BIS_fnc_respawnTickets;
    		//player groupChat format ["West: %1 ---- East: %2",_westScore, _eastScore];
    		//broadcast scores
    		[[format ["West: %1 --- East: %2",_westScore,_eastScore]], "TG_fnc_globalHint", true, true] spawn BIS_fnc_MP;
    
    		//check for expired tickets to end mission ** THESE VARIABLES TRIGGER MISSION COMPLETION USING TRIGGERS IN THE MISSION **
    		if (_westScore < 1) then
    		{
    			missionState = "opforWon";
    			publicVariable "missionState";
    			_run = false;
    		};
    		if (_eastScore < 1) then
    		{
    			missionState = "bluforWon";
    			publicVariable "missionState";
    			_run = false;
    		};
    				
    		//decrease tickets for each player that is in the enemy zone
    		_bluZonePlayers = [];
    		_opZonePlayers = [];
    		_bluZonePlayers = list trigBluZone;
    		_opZonePlayers = list trigOpZone;
    		[west, 0 - (count _bluZonePlayers)] call BIS_fnc_respawnTickets;
    		[east, 0 - (count _opZonePlayers)] call BIS_fnc_respawnTickets;
    		
    		//sleep to save resources and slow the counter
    		sleep 5;
    	};
    };
    Big thanks to Chichco for helping me through the debugging!
    |TG-189th| Unkl
    ArmA 3 Game Officer
    Dean of Tactical Gamer University
    189th Infantry Brigade Member
    SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN
    "We quickly advance in the opposite direction and take cover in a house on the SW side of town." - BadStache

Connect

Collapse

TeamSpeak 3 Server

Collapse

Advertisement

Collapse

Twitter Feed

Collapse

Working...
X