Jump to content
Sign in to follow this  
BEAKSBY

Separating Sector Modules from Bleed Ticket Modules

Recommended Posts

HI Folks,

I have some sector modules in my mission that I do not want affected by the Bleed Tickets Module. I have unlinked them and even tried linking them to a second Bleed Tickets Module with Ticket=0 (no ticket will be bleeded).

Is there any way to separate a sector module from the Bleed Tickets Module, just so I can benefit from the other features they offer?

Share this post


Link to post
Share on other sites

The Bleed Ticket Module is for sector dominance. What are these other feature you presume you can benefit from?

Share this post


Link to post
Share on other sites
The Bleed Ticket Module is for sector dominance. What are these other feature you presume you can benefit from?

I would like to have some sectors not affected the dominance ratio and therefor not affect the bleeding of tickets. So if for example an armory sector is controlled, I set up conditions in another script to allow the player to spawn weapons, similarly with a Motor Pool sector to spawn vehicles...etc. I want to benefit from the progress bar and notification of controlling side gui.

Wondering if the above is possible?

I also have strategic sectors that when controlled work with the bleed ticket module.

I also set it up so a player can spawn from any sector they control.

Edited by BEAKSBY

Share this post


Link to post
Share on other sites

You will have to remove the BleedTicket module from your map and write your own script (use Moricky's fn_bleedTickets as a base to work from). The module is hard coded to take all sectors into account, you cant even use the scriptedEventHandler it provides as the dominance has already been calculated before this comes into effect.

This line

_sectors = true call bis_fnc_moduleSector;

is where the script gets a list of sectors it needs to check.

Let us know how you get on.

Share this post


Link to post
Share on other sites

As Larrow mentioned, I've removed the BleedTicket module from the map and started modifying Moricky's fn_bleedTickets.

I've added

[[EAST,WEST],(1/6),1,1] call BEAKS_fnc_BEAKSbleedTickets;

to my initSever.sqf

and here's my modified bleedTickets function below. I've commented in CAPS on section I modified.

fn_BEAKSbleedTickets

/* 
BIS_fnc_bleedTickets 
https://community.bistudio.com/wiki/BIS_fnc_bleedTickets 

   Author: Karel Moricky 

   Description: 
   Initialize ticket bleeding. Works with sector modules. 
   When a side holds majority of sectors, other non-friendly sides will start losing respawn tickets (set by BIS_fnc_respawnTickets)

   "dominantSideChanged" scripted event handler (see BIS_fnc_addScriptedEventHandler) is called every time the dominant side changes.

   Parameter(s): 
       0 (Optional): ARRAY of SIDEs - involved sides. Setting empty array will terminate ticket bleeding (default: all sides)
        1 (Optional): NUMBER - dominance ratio in range 0-1, i.e., how large portion of sectors must a side hold for others to start bleeding (default: 0.5)
        2 (Optional): NUMBER - how many tickets will be bled every step during full dominance (default: 3)
        3 (Optional): NUMBER - delay in seconds between every bleeding step (default: 5)

   Returns: 
   BOOL 
*/ 
//Hint "Hello BEAKS_fnc_bleedTickets";
sleep 3;	//KEEP THIS OR BLEED TICKETS DO NOT WORK FOR SOME REASON

if !(isserver) exitwith {"BIS_fnc_BEAKSbleedTickets can run only on server" call bis_fnc_error; false};

private ["_sides","_ticketBleedRatio","_ticketBleedMax","_delay","_sidesFiltered"];
_sides = [_this,0,missionnamespace getvariable ["bis_fnc_bleedTickets_sides",[east,west,resistance]],[[]]] call bis_fnc_param;
_ticketBleedRatio = [_this,1,missionnamespace getvariable ["bis_fnc_bleedTickets_ticketBleedRatio",0.5],[0]] call bis_fnc_param;
_ticketBleedMax = [_this,2,missionnamespace getvariable ["bis_fnc_bleedTickets_ticketBleedMax",3],[0]] call bis_fnc_param;
_delay = [_this,3,5,[0]] call bis_fnc_param;

//--- Remove duplicates and elements which are not sides 
_sidesFiltered = []; 
{ 
   if (typename _x == typename sideunknown) then { 
       if !(_x in _sidesFiltered) then {_sidesFiltered set [count _sidesFiltered,_x];};
    }; 
} foreach _sides; 
bis_fnc_bleedTickets_sides = _sidesFiltered; 

//--- Announce 
bis_fnc_bleedTickets_enabled = count _sides > 0; 
publicvariable "bis_fnc_bleedTickets_enabled"; 

//--- Terminate existing loop 
if !(isnil "bis_fnc_bleedTickets_loop") then {terminate bis_fnc_bleedTickets_loop;};

//--- Execute bleeding loop 
if (bis_fnc_bleedTickets_enabled) then { 
   bis_fnc_bleedTickets_loop = [_ticketBleedRatio,_ticketBleedMax,_delay] spawn {

       _ticketBleedRatio = _this select 0; 
       _ticketBleedMax = _this select 1; 
       _delay = _this select 2; 
       _dominantSide = sideunknown; 

       while {true} do { 
           // _sectors = true call bis_fnc_moduleSector;	// --- Get all sectors --- REPLACE WITH STRATEGIC OBJECTIVE SECTORS ONLY _sectors = [sector1,sector2,sector3];
           _sectors = [sector1,sector2,sector3];
		_ticketBleedSectorLimit = count _sectors * _ticketBleedRatio; 
	//hint format ["_ticketBleedSectorLimit: %1 \n count _sectors: %2 \n _ticketBleedRatio: %3", _ticketBleedSectorLimit, count _sectors, _ticketBleedRatio];
	//sleep 3;
           if (_ticketBleedSectorLimit != 0) then { 
               _dominantSideOld = _dominantSide;         
               _dominantSide = sideunknown; 
               _dominantSideRatio = 0; 

               //--- Get sector status 
               _sides = +(missionnamespace getvariable ["bis_fnc_bleedTickets_sides",[east,west,resistance,civilian]]);
                { 
                   _side = _x; 
                   _sideTickets = _side call bis_fnc_respawnTickets; 
                   if (_sideTickets < 0) then { 
                       _sides set [_foreachindex,sideunknown]; //--- Remove sides without tickets
                    } else { 
                       _sideSectorsCount = _side call bis_fnc_moduleSector; // --- Get number of sectors held by a side --- 

		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		//DO NOT INCLUDE Armory, Motor Pool and Radio Tower Sectors THEREFORE NEED TO REDUCE _sideSectorsCount by 1 
		{			
			if ((sectorMotorPool getVariable 'owner') == _x) then {_sideSectorsCount = _sideSectorsCount - 1};
			if ((sectorArmory getVariable 'owner') == _x) then {_sideSectorsCount = _sideSectorsCount - 1};
			if ((sectorRadioTower getVariable 'owner') == _x) then {_sideSectorsCount = _sideSectorsCount - 1};
		} forEach _sides;
		hint format ["_sideSectorsCount %1 \n _ticketBleedSectorLimit: %2", _sideSectorsCount, _ticketBleedSectorLimit];
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

		if(_sideSectorsCount > _ticketBleedSectorLimit) then { 
                           _dominantSide = _side; 
                           _dominantSideRatio = (_sideSectorsCount - _ticketBleedSectorLimit) / _ticketBleedSectorLimit;
                        }; 
                   }; 
               } foreach _sides; 
               _sides = _sides - [sideunknown]; 

               //--- Tickets bleeding 
               _sectorTicketBleedRatio = -_ticketBleedMax * _dominantSideRatio;
                if (_sectorTicketBleedRatio != 0) then { 
                   { 
                       _side = _x; 
                       if (_side != _dominantSide && _dominantSide != sideunknown) then {
                            [_side,_sectorTicketBleedRatio] call bis_fnc_respawnTickets;
                        }; 
                   } foreach _sides; 
               }; 

               //--- Call custom code when the dominance changes 
               if (_dominantSide != _dominantSideOld) then { 
                   [missionnamespace,"dominantSideChanged",[_dominantSide,_dominantSideOld,_sides]] spawn bis_fnc_callScriptedEventHandler;
                }; 
           }; 

           _time = time + _delay; 
           waituntil {time > _time}; 
       }; 
   }; 
}; 
true  

The problem is when I test in MP the client side is not counting any sectors _sideSectorsCount they control, even the ones I don't want counted.

Share this post


Link to post
Share on other sites

{            
               if ((sectorMotorPool getVariable 'owner') == _x) then {_sideSectorsCount = _sideSectorsCount - 1};
               if ((sectorArmory getVariable 'owner') == _x) then {_sideSectorsCount = _sideSectorsCount - 1};
               if ((sectorRadioTower getVariable 'owner') == _x) then {_sideSectorsCount = _sideSectorsCount - 1};
           } forEach _sides;

Remove this forEach, leave the if statements just remove the loop, you are already in a sides loop. As you have written it will remove too many from the count.

or replace that structure with something like..

_sideSectorsCount = _SidesSectorsCount - {_x getVariable "owner" == _side}count [sectorMotorPool, SectorArmory, SectorRadioTower]

The problem is when I test in MP the client side is not counting any sectors _sideSectorsCount they control, even the ones I don't want counted.

This is a server side script and is meant to be. The only way to monitor if things are behaving properly client side is to monitor their sides bleedTickets. Or pass your hint across the network so you can see whats happening.

I don't believe this is right either for the ratio. (1/6) so 0.16

A side is dominant if it owns 1 sixth of the sectors, yet you only have 3 sectors included in the check [sector1,sector2,sector3]

So a side would be dominant if it owned just 0.5 of a sector.

Surely this should be num sectors needed to be dominant / total num sectors e.g 2/3 = 0.6r.

_ticketBleedSectorLimit = 3 * 0.6 == 2

A team must own 2 sectors to be dominant.

Although i maybe off base with that dependent on what your going for.

Edited by Larrow

Share this post


Link to post
Share on other sites

Ok, thanks Larrow,

I realized I may have to change the way _sectorTicketBleedRatio is calculated as well as some other parameters. I have three sectors that control bleeding.

Scenario 1) If only one is contolled and the other two are neutral, then bleeding should occur on the other side.

Scenario 2) If 2 are controlled by one side and the third remains neutral then bleeding should double and

Scenario 3) if all three are controlled the bleed rate should triple.

Scenario 4) If 2 are controlled by opposite sides ( and the third is neutral) then no bleeding should occur until the third is controlled thus tipping the ballance of controlled sectors to that side. Bleeding should occur at a similar rate as then first scenario I mentioned.

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  

×