Asmodeuz 54 Posted August 4, 2017 I have placed six (BIS) Sectors that can be captured by either BLUFOR or OPFOR. Now, I want BLUFOR start bleeding tickets with 1 ticket per 10 seconds when OPFOR has captured two sectors. The same goes to OPFOR when BLUFOR has captured two sectors. For this I've set the Dominance ratio in the Bleed Tickets module to 0.2. With this setup everything works as expected so long when only either of the two sides captures two sectors of the available total of six sectors. The aforementioned setup "breaks" immediately when both sides capture two sectors (doesn't need to happen at the same time). I'll explain below how the setup breaks: let's say BLUFOR is the first one to capture two sectors, OPFOR tickets will bleed (1 ticket/10 seconds) so long that also OPFOR captures two sectors then when OPFOR captures two sectors BLUFOR will start bleeding (1 ticket/10 seconds) BUT OPFOR ticket bleeding will stop even if the situation is now 50/50 when both sides own two sectors (and there's two neutral sectors) when the aforementioned situation has been reached BLUFOR now needs to capture additional two sectors (totaling to four sectors) so that OPFOR would start bleeding tickets. When BLUFOR owns four sectors (out of six) OPFOR will bleed two tickets per 10 seconds Can someone offer some insight on what is happening there? Is the Dominance ratio option broken or is this just another user error? Share this post Link to post Share on other sites
56Curious 23 Posted August 4, 2017 If they were to capture over this amount, does it break? Share this post Link to post Share on other sites
Larrow 2794 Posted August 5, 2017 On 04/08/2017 at 2:14 PM, Asmodeuz said: Is the Dominance ratio option broken or is this just another user error? User error, It was not designed to work this way. It is designed so there can only ever be 1 dominant side and should be out of all sectors, as it loops all sides checking if dominant ratio has been reached, once both sides reach this value the last side checked will be the dominant, so the other will bleed even though they maybe equal but are over the ratio. If you want to do this you need to dump the bleed tickets module and work out capture ratios and bleeding yourself. e.g untested, something like... //initServer.sqf TAG_fnc_checkDominance = { params[ "_logic", "_owner", "_ownerOld" ]; //Dont check if sideunknown ( all sectors report capture side unknown at mission start - or default owner ) if !( _owner isEqualTo sideUnknown ) then { //sides taking part _sides = [ east, west ]; //sides number of sectors _sidesSectors = [ east call BIS_fnc_moduleSector, west call BIS_fnc_moduleSector ]; _max = selectMax _sidesSectors; _min = selectMin _sidesSectors; //Does one side have 2 more than the other if ( _max - _min >= 2 ) then { //Get losing side _bleedSide = _sides select ( _sidesSectors find _min ); //call bleed on the side _bleedSide call TAG_fnc_bleedTickets; }else{ //else stop bleed sideUnknown call TAG_fnc_bleedTickets; }; }; }; TAG_fnc_bleedTickets = { params[ "_side" ]; //stop loop if already running if !( isNil "TAG_bleedTickets_loop" ) then { terminate TAG_bleedTickets_loop; TAG_bleedTickets_loop = nil; }; //if no side is dominant then exit if ( _side isEqualTo sideUnknown ) exitWith {}; //Start bleed loop TAG_bleedTickets_loop = [ _side ] spawn { params[ "_side" ]; while { true } do { [ _side, -1 ] call BIS_fnc_respawnTickets; //1 ticket sleep 10; //every 10 seconds }; }; }; //may need to add some kind of wait or check for sector initialisation here //on all sectors { //Subscribe to sector owner change [ _x, "ownerChanged", TAG_fnc_checkDominance ] call BIS_fnc_addScriptedEventHandler; }forEach ( missionNamespace getVariable ["BIS_fnc_moduleSector_sectors",[]] ); 1 Share this post Link to post Share on other sites
Asmodeuz 54 Posted August 6, 2017 Larrow, thank you for coming up with that not-so-short code! I took it for a short test run in all its glory and this is what it gives when testing (on a dedicated server) 10:05:59 Error in expression < call BIS_fnc_addScriptedEventHandler; }forEach missionNamespace getVariable ["> 10:05:59 Error position: <forEach missionNamespace getVariable ["> 10:05:59 Error foreach: Type Namespace, expected Array It's a tad shame that the BIS sector system didn't work as I was expecting it to. But at least the system "scales upwards" so to say... meaning that when you set Dominance ratio to 0.5 and tickets to be bled eg. to 3 in a six sector configuration with 4 sectors owned 1 ticket will be bled with 5 sectors 2 tickets and with owning all the six sectors 3 tickets That was what I had been after all the time.. though I certainly had hoped that it would have been possible to start bleeding tickets that way using a value smaller than 0.5 for the Dominance ratio. Larrow if you're willing to continue on the code you just provided there I can certainly test the iterations but continuing from there on my own is out of the scope for me. Share this post Link to post Share on other sites
Larrow 2794 Posted August 6, 2017 Try wrapping that last line in parenthesis.. }forEach ( missionNamespace getVariable ["BIS_fnc_moduleSector_sectors",[]] ); The forEach was trying to loop missionNamespace rather than the array returned from the variable. Still untested. 8 hours ago, Asmodeuz said: But at least the system "scales upwards" so to say... meaning that when you set Dominance ratio to 0.5 and tickets to be bled eg. to 3 in a six sector configuration with My test code wont scale upwards as is but is not to hard to change to get it to do this. If I have a little time later I will test what I have written. Share this post Link to post Share on other sites
Asmodeuz 54 Posted August 6, 2017 2 hours ago, Larrow said: Try wrapping that last line in parenthesis.. }forEach ( missionNamespace getVariable ["BIS_fnc_moduleSector_sectors",[]] ); The forEach was trying to loop missionNamespace rather than the array returned from the variable. Still untested. Wrapping in parenthesis did the trick. No more errors for that one. That fixed I did test the code using the following configuration: six sectors and all sectors neutral when the mission starts. When using if ( _max - _min >= 2 ) I had to capture 3 sectors for the bleeding to start for the enemy side. Enemy did not capture a single sector so the last three sectors remained neutral. When using if ( _max - _min >= 1 ) I had to capture 2 sectors for the bleeding to start for the enemy side. Enemy did not capture a single sector so the last four sectors remained neutral. After capturing the amount of sectors needed to start the bleeding all additionally captured sectors produced the following error message: 22:12:55 Error in expression < isNil "TAG_bleedTickets_loop" ) then { terminate "TAG_bleedTickets_loop"; }; > 22:12:55 Error position: <terminate "TAG_bleedTickets_loop"; }; > 22:12:55 Error terminate: Type String, expected Script 22:12:55 File mpmissions\__cur_mp.VR\initServer.sqf, line 34 One notion is also that when using scripted style introduced herein to bleed tickets I observed strange behavior in the sector status indicator that is on the right hand side of the screen when I was testing on a dedicated server. I would need to record a video of the behaviour since I won't bother explaining it with my English skills :) Still on the other hand this behaviour can not be observed when testing through the in-game editor. Share this post Link to post Share on other sites
Larrow 2794 Posted August 6, 2017 terminate "TAG_bleedTickets_loop"; Should not be in "" and also could do with resetting.. terminate TAG_bleedTickets_loop; TAG_bleedTickets_loop = nil; 1 hour ago, Asmodeuz said: I had to capture 3 sectors for the bleeding to start for the enemy side. Weird Ill have to see what the return is for a sides sectors if they have none. 1 hour ago, Asmodeuz said: I observed strange behavior in the sector status indicator that is on the right hand side of the screen when I was testing on a dedicated server Ill find a little time to test it out tonight see whats happening and remove any more mistakes I have made :D . 1 hour ago, Asmodeuz said: since I won't bother explaining it with my English skills :) Your English seems fine to me, I can understand what your explaining. Share this post Link to post Share on other sites
Asmodeuz 54 Posted August 20, 2017 Hey, I was out of the loop for a while and will still be for some time because of moving house. Also since I don't have that heaven sent internet connection anymore I had in the previous household (with which I was content enough to have a dedicated server of my own for Arma 3) only testing I will be able to do for the time being is to test through the in-game editor multiplayer. Currently I'm on the lookout where to migrate the A3 server.. aaand whatever the solution will be I bet it will cost dearly *sigh* On 6.8.2017 at 11:53 PM, Larrow said: terminate "TAG_bleedTickets_loop"; Should not be in "" and also could do with resetting.. terminate TAG_bleedTickets_loop; TAG_bleedTickets_loop = nil; Getting rid of the quotation marks there indeed fixed the "Error in expression" error message. So in this regard the code you have provided here so far is error free and working as expected. Should you have available time I'd certainly be interested in testing out if your code could do the same "scaling upwards" that BIS' sector system is capable of. Share this post Link to post Share on other sites