black_hawk_mw2_87 74 Posted October 30, 2019 Hello everyone, hello community! 🙂 I am about to start testing a new multiplayer style. A new type to me, of course - sector control. I have a tutorial video of how to create such a mission. - inside this video you can see that a sector module has been created, synchronized to a trigger which represents the capture area - it is easy to set x numbers of such areas with modules and triggers to cover the whole map or a larger area, for example, with the option to choose the percentage of presence in order to retake it - let's say I want to create 10 such areas. I need a script that checkes if: example 1: more than 50% of them are taken by one side or another (which means 6 in my case), OR example 2: all of them are taken by one side or another. I think it will be easier to check the second condition, but I am not sure because it won't be easy to hold off all 9 sectors under your control while trying to retake the last one. You will need to place a lot of AIs around them or have a lot of teammates playing with you with proper good skills. So, after all, we need a script for one of these options to be checked, or may be you can mention and add another one as a better solution. In this case, do I need to name the modules OR the triggers and what would the script look like? When a condition is fulfilled it should end the scenario - for example if you play for the BLUFOR (west) or OPFOR (east) and you win or you loose, such a condition can be checked in order to end the scenario. I hope you get the idea. It will be interesting if there's additional condition to make the game longer in a win-loose ratio, let's say 2:1 or 3:2 rounds won for one of the teams. I wonder if this can be done... Thank you in advance and cheers! 🙂 1 Share this post Link to post Share on other sites
wogz187 1086 Posted October 30, 2019 (edited) @black_hawk_mw2_87, The point of using modules is that the script work is already finished*. Perhaps re-imagine the design instead. If you can make a fun mission with 10 sectors you should be able to make a fun mission with 3 or 5 (use odd numbers to force an area of contention). All you really need is an end condition. Have fun! Edited October 30, 2019 by wogz187 I understand this is not necessarily true for every module 2 Share this post Link to post Share on other sites
black_hawk_mw2_87 74 Posted October 30, 2019 (edited) 1 hour ago, wogz187 said: @black_hawk_mw2_87, The point of using modules is that the script work is already finished*. Perhaps re-imagine the design instead. If you can make a fun mission with 10 sectors you should be able to make a fun mission with 3 or 5 (use odd numbers to force an area of contention). All you really need is an end condition. Have fun! Thank you. I actually need some sort of presence-type condition from the connected triggers, I guess. Or if all of them are somehow fully triggered by BLUFOR or OPFOR (west and east), one of the sides is the winner. Edited: if I call the triggers t1, t2, t3 etc. I can shack if they are activated by a condition: Guarded by BLUFOR/OPFOR. Or something like that. I can use in another trigger: TriggerActivated t1,t2,t3... Or how exactly do I need to write this line for multiple names to be checked for activation? Re-edited: should this condition line be like: triggerActivated t1 && t2 && t3 etc.? 🙂 Edited October 30, 2019 by black_hawk_mw2_87 Share this post Link to post Share on other sites
wogz187 1086 Posted October 30, 2019 @black_hawk_mw2_87, Quote triggerActivated t1 && t2 && t3 triggerActivated t1 && triggerActivated t2; triggerActivated t1 or (triggerActivated t2 && triggerActivated t3); syntax is like that. Have fun! 2 Share this post Link to post Share on other sites
Larrow 2820 Posted October 30, 2019 Use the provided scripted event for sectors on owner changed. Spoiler //initServer.sqf { _x setVariable[ "ownerChanged_ID", [ _x, "ownerChanged", { params[ "_sector", "_owner" ]; if !( _owner isEqualTo sideUnknown ) then { _percentToWin = 0.5; _competingSides = [ east, west ]; _allSectors = true call BIS_fnc_moduleSector; { _x params[ "_side" ]; _allSectorsOfSide = _allSectors select{ _x getVariable[ "owner", sideUnknown ] isEqualTo _side }; if ( count _allSectorsOfSide >= ( count _allSectors * _percentToWin ) ) exitWith { { [ _x, "ownerChanged", _x getVariable "ownerChanged_ID" ] call BIS_fnc_removeScriptedEventHandler; }forEach _allSectors; _winner = _side; _loser = ( _competingSides - [ _winner ] ) select 0; [ "Win", true, true, true, true ] remoteExec[ "BIS_fnc_endMission", _winner, true ]; [ "Lose", false, 5, true, true ] remoteExec[ "BIS_fnc_endMission", _loser, true ]; if ( isDedicated ) { uiSleep 5; [] call BIS_fnc_endMissionServer; }; }; }forEach _competingSides; }; }] call BIS_fnc_addScriptedEventHandler ]; }forEach ( true call BIS_fnc_moduleSector ); Adjust _percentToWin as needed. 4 Share this post Link to post Share on other sites
black_hawk_mw2_87 74 Posted October 31, 2019 5 hours ago, wogz187 said: @black_hawk_mw2_87, triggerActivated t1 && triggerActivated t2; triggerActivated t1 or (triggerActivated t2 && triggerActivated t3); syntax is like that. Have fun! You are right. I actually know that, but I was too tired to get it right... after a whole day at work. So, I am going to test this today... after work. Thank you, dude! 🙂 1 Share this post Link to post Share on other sites
black_hawk_mw2_87 74 Posted October 31, 2019 4 hours ago, Larrow said: Use the provided scripted event for sectors on owner changed. Hide contents //initServer.sqf { _x setVariable[ "ownerChanged_ID", [ _x, "ownerChanged", { params[ "_sector", "_owner" ]; if !( _owner isEqualTo sideUnknown ) then { _percentToWin = 0.5; _competingSides = [ east, west ]; _allSectors = true call BIS_fnc_moduleSector; { _x params[ "_side" ]; _allSectorsOfSide = _allSectors select{ _x getVariable[ "owner", sideUnknown ] isEqualTo _side }; if ( count _allSectorsOfSide >= ( count _allSectors * _percentToWin ) ) exitWith { { [ _x, "ownerChanged", _x getVariable "ownerChanged_ID" ] call BIS_fnc_removeScriptedEventHandler; }forEach _allSectors; _winner = _side; _loser = ( _competingSides - [ _winner ] ) select 0; [ "Win", true, true, true, true ] remoteExec[ "BIS_fnc_endMission", _winner, true ]; [ "Lose", false, 5, true, true ] remoteExec[ "BIS_fnc_endMission", _loser, true ]; if ( isDedicated ) { uiSleep 5; [] call BIS_fnc_endMissionServer; }; }; }forEach _competingSides; }; }] call BIS_fnc_addScriptedEventHandler ]; }forEach ( true call BIS_fnc_moduleSector ); Adjust _percentToWin as needed. Thank you very much. This looks like a good and easy fix to my needs, a good solution. Q1: Where should I put this - in init.sqf, initplayer.sqf or a trigger? Q2: What else, besides the part from the script you mentioned, should I change in the editor? Do I need to add something or change something? Please, be more specific in order to make sure I can complete my goal. 🙂 Thank you in advance! 🙂 Share this post Link to post Share on other sites