Jump to content
Neonz27

How can I subtract one ticket each second for each sector controlled?

Recommended Posts

I need a way to bleed tickets once per second as the Bleed Tickets module does, but with the bleed amount being equivalent to the number of sectors controlled by that team.

For example, if Blufor has 5 objectives while Opfor has 3, Opfor will lose 5 tickets each second while Blufor will lose 3 tickets each second.
Below are a few things I have tried so far which seemed to either not work or freeze my game. I apologize if I have no clue what I'm doing.
 

[sector_alpha, "ownerChanged", {
	params["_sector", "_owner", "_ownerOld"];
	
	while { true } do {
		[_owner, 1] call BIS_fnc_respawnTickets;
		sleep 1;
	};
}] call BIS_fnc_addScriptedEventHandler;

 

[sector_alpha, "ownerChanged", {
	params["_sector", "_owner", "_ownerOld"];
	
	waitUntil {
		sleep 1;
		[_owner, 1] call BIS_fnc_respawnTickets;
	};
}] call BIS_fnc_addScriptedEventHandler;

 

Share this post


Link to post
Share on other sites
Spoiler

//initServer.sqf

TAG_tickRate = 1; //seconds
TAG_nextTick = time + TAG_tickRate;

addMissionEventHandler[ "EachFrame", {
	if ( time >= TAG_nextTick ) then {
		[ west, -( [ east ] call BIS_fnc_moduleSector ) ] call BIS_fnc_respawnTickets;
		[ east, -( [ west ] call BIS_fnc_moduleSector ) ] call BIS_fnc_respawnTickets;
		
		TAG_nextTick = time + TAG_tickRate;
	};
}];

 

 

  • 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

×