Jump to content
Ronin[NR]

The new Sector Module

Recommended Posts

If i have a sector called Capture being contested by both blufor & opfor with no default owner, how do i set it so they have 20 tickets each at start then start counting down every 120 seconds once sides start occupying.

i have set to a ratio of 0.8 ownership limit ? And set a win condition once tickets reach zero.

Any help would be appreciated :)

Skunk

Share this post


Link to post
Share on other sites

Thanks Larrow,

And to clarify...

1. The mySector1, 2, 3 names are the names of the actual sector modules?

2. If I want to remove the OPFOR win conditions from that trigger, I remove anything past the || line in the condition. What would I have to change in the OnAct?

3. In the OnAct, just to make sure, you put in flase - I'll assume that to be a type-o and meant to be false. Just want to be on the same page.

4. In the OnAct, do I need to repeat what you did for each of my three sectors?

Edited by SpectreRSG

Share this post


Link to post
Share on other sites
And to clarify...

1. The mySector1, 2, 3 names are the names of the actual sector modules?

Correct, the name you gave them in the name field in the module edit box.
2. If I want to remove the OPFOR win conditions from that trigger, I remove anything past the || line in the condition. What would I have to change in the OnAct?
Condition

isServer && ({_x getVariable "owner" == west}count [mySector1, mySector2, mySector3] == 3)

OnAct

{_x enableSimulation false}forEach [mySector1, mySector2, mySector3];
[["end1", true, 2],"BIS_fnc_endMission",west,false] call BIS_fnc_MP;

This is now only monitoring for a BLUFOR win and nothing else, not even a BLUFOR loss (as you would need the || back in to know that OPFOR owned all three to be able to fail BLUFOR). Is this actually what you want?

If not then go back to how it was in my last post and just remove the two BIS_fnc_MP lines that have the word east in them.

3. In the OnAct, just to make sure, you put in flase - I'll assume that to be a type-o and meant to be false. Just want to be on the same page.
:slaps forehead: Ah yes, that would be my dyslexic fingers :D , last post updated.
4. In the OnAct, do I need to repeat what you did for each of my three sectors?
No. by this point (as the trigger has fired) we know someone has all three sectors, so we only need to check one to know who the actual winner was. (as originally written, you can see above there is no need for the check now as the trigger is only firing if all three are owned by BLUFOR). Edited by Larrow

Share this post


Link to post
Share on other sites
Is this actually what you want?

Yes, I want OPFOR to win based on a timer. Which I'm still having issues with. I have a trigger with End #2 for an OPFOR victory.

I'll do further testing and if I run into any issues I'll update this post.

Share this post


Link to post
Share on other sites
how do i set it so they have 20 tickets each at start then start counting down every 120 seconds once sides start occupying.
Is that, a side must own the sector for 120 seconds to decrease the opposing sides tickets OR once some one has captured the sector every 120 seconds remove a point from the team that does not own it (during the 120 seconds the sector could swap ownership)?

Share this post


Link to post
Share on other sites

yes start removing tickets every 2 mins after capturing and allow swap ownership :)

Share this post


Link to post
Share on other sites
yes start removing tickets every 2 mins after capturing and allow swap ownership :)
Mmmm doesnt quite answer the question but ill have a stab a what i think you want.

init.sqf

if (!isDedicated) then {
//false shows the score of both sides
//true only the score of the players side is shown
hintTicketSide = false;

//A client side function to hint ticket scores
fnc_HintTickets = {
	_HStringEast = format ["East = %1",_this select 0];
	_HStringWest = format ["West = %1",_this select 1];
	if (hintTicketSide) then {
		if (side player == west) then {
			hintSilent _HStringWest;
		}else{
			hintSilent _HStringEast;
		};
	}else{
		hintSilent format["%1\n%2",_HStringWest,_HStringEast]
	};
};
};


if (isServer) then {

//Start a thread to monitor the sector
_handle = [] spawn {

	//Setup default variables
	//east = 0, west = 1
	_Tickets = [20, 20];
	_captureTime = 120;
	_Sector = Capture;
	_AreaLost = false;
	_GameOver = false;

	while {(!(_GameOver))} do {
		//WaitUntil someone actually owns the sector
		waitUntil { _Sector getVariable "owner" != sideUnknown};
		_SectorOwner = _Sector getVariable "owner";
		//Start timer
		_captureEnd = time + _captureTime;
		_AreaLost = false;
		while {time < _captureEnd} do {
			sleep 0.5;
			if ((_Sector getVariable "owner") != _SectorOwner) exitWith {_AreaLost = true};
		};
		if (!(_AreaLost) ) then {
			//Decrease opposing tickets
			_SectorOwner = _SectorOwner call BIS_fnc_sideID;
			_opposingTeam = ((_SectorOwner * -1) + 1);  //0 = 1 , 1 = 0
			_Tickets set [_opposingTeam , (_Tickets select _opposingTeam) - 1];
			//If opposingTeam have run out of tickets
			if ((_Tickets select _opposingTeam) == 0) then {
				//Debrief WON
				[["end1", true, 2],"BIS_fnc_endMission",(_SectorOwner call BIS_fnc_sideType),false] call BIS_fnc_MP;
				//Debrief LOST
				[["end2", false, 2],"BIS_fnc_endMission",(_opposingTeam call BIS_fnc_sideType),false] call BIS_fnc_MP;
				_GameOver = true;
			};
			//Send a hint to all clients showing tickets
			[_Tickets,"fnc_HintTickets",true,false] call BIS_fnc_MP;
		};
	};
};
};

No one online tonight atm so ive not been able to test it.

EDIT: Done a little testing using some captured units a fixed an error.

Edited by Larrow
Fixed error in code

Share this post


Link to post
Share on other sites

That's spot on tyvm, I really appreciate you taking the time to show me this Larrow :)

If i wanted to decrease the ticket amount by more tickets is this the code I alter ?

opposingTeam = ((_SectorOwner * -1) + 1);  //0 = 1 , 1 = 0

Share this post


Link to post
Share on other sites

_Tickets set [_opposingTeam , (_Tickets select _opposingTeam) - [color="#FF0000"]1[/color]];

Change the 1 in this line for the amount of tickets taken off each capture period.

Your Welcome.

Share this post


Link to post
Share on other sites

Does anyone know how to setup the rewards for this module? I'm trying to get certain vehicle and spawns to become available for whatever specific side captures the sector.. There's no documentation on it on the wiki yet.

Share this post


Link to post
Share on other sites

@SpectreRSG I would call with the trigger a skript which checks if the area has been captured and from wich side, right now Im at work so I cant give you an examle code, yet Im a noob in scripting.

Im just curios, the SectorModul provides some lines where you can set the time until the area should be captured.

The standard is for the infantry at "1".

I changed this one to any number but the time to capture did not change. Yet the description of that line says it should.

Does anyone know how to increase the time without a script or do these lines are WIP?

And in my mission I want that only 3 soldiers and more can capture the area, I guess that has to be a script again?

I already have a working (but buggy) script for a AAS mode BUT I wanted to check if the way with sector & areas is way simpler and less performance consuming.

Share this post


Link to post
Share on other sites
Im just curios, the SectorModul provides some lines where you can set the time until the area should be captured.

The standard is for the infantry at "1".

Dont read the tooltip for these as time, think of these more as a multiplier of how many points each of this type of vehicle are worth towards winning the sector.

The actual points each vehicle is worth are actually defined in the config of each vehicle, defined under threat.

Very roughly the way it works is :-

Say 2 riflemen one opfor the other blufor are stood in a sector each of them in their config has a threat value of [1, 0.1, 0.1].

score per = threat array added together, multiplied by their cost value (cost in sector module settings), so

b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(1) = 1.2
o_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(1) = 1.2

So the sector is contested as both sides are scoring 1.2 per tick.

Another blufor rifleman walks into the area. This time he is a player so he also gets to multiply his threat rating by player cost.

b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(1) = 1.2
b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(1) = 1.2 * cost player (1) = 1.2
________ total threat blufor = 2.4

o_soldier_f 	[1, 0.1, 0.1] = 1.2 * cost inf(1) = 1.2
________ total threat opfor = 1.2

1.2 per tick in favour of blufor. (a cost of 1 for a player makes no real difference as threat * 1 == threat)

Ok so lets propose another scenario a opfor Ifrit with just a driver holding an area, how many blufor soldiers do we need to secure the area?

Ifrit has a cost of 2 (wheeled cost), + 1 for the driver (inf) = 3

4 blufor riflemen = 4 * 1 (inf cost) = 4

Ok this looks good but when you go to do this you will find that the bar takes ages to move in favour of blufor, let look at the threat calculation for these.

b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(1) = 1.2
b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(1) = 1.2
b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(1) = 1.2
b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(1) = 1.2 * cost player (1) = 1.2
________ total threat blufor = 4.8

o_mrap_02 _f	[0.8, 0.6, 0.3] = 1.7 * cost wheeled veh(2) = 3.4
o_soldier_f 	[1, 0.1, 0.1] = 1.2 * cost inf(1) = 1.2
________ total threat opfor = 4.6

As you can see because of the threat values of the ifrit our 4 blufor soldiers are only gaining a .2 threat advantage over opfor.

These threat scores are also further processed to work out the percentage of ownership.

So our 2 vs 1 above would be:-

blufor total score = 2.4

opfor total score = 1.2

total score of both sides = 3.6

blufor = 2.4 / 3.6 = 0.66 = 66%

opfor = 1.2 / 3.6 = 0.34 = 34%

bar moves 0.66 - 0.34 = 0.32 in favour of blufor

The 4 inf vs mrap + 1 inf would be:-

blufor total score = 4.8

opfor total score = 4.6

total score of both sides = 9.4

blufor = 4.8 / 9.4 = 0.51 = 51%

opfor = 4.6 / 9.4 = 0.49 = 49%

bar moves 0.51 - 0.49 = 0.02 in favour of blufor

So changing the cost of say inf is going to have no effect on the speed of capture if it is inf against inf. The only time the cost will make a difference is when inf are facing off against a different class like a vehicle.

inf vs inf @ inf cost of 2

b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(2) = 2.4
b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(2) = 1.2 * cost player (1) = 2.4
________ total threat blufor = 4.8

o_soldier_f 	[1, 0.1, 0.1] = 1.2 * cost inf(2) = 2.4
________ total threat opfor = 2.4

blufor total score = 4.8

opfor total score = 2.4

total score of both sides = 7.2

blufor = 4.8 / 7.2 = 0.66 = 66%

opfor = 2.4 / 7.2 = 0.34 = 34%

bar moves 0.66 - 0.34 = 0.32 in favour of blufor. Exactly the same as our result for 2 vs 1 @ inf cost of 1

4 inf vs 1 wheeled + 1 inf @ inf cost of 2

b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(2) = 2.4
b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(2) = 2.4
b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(2) = 2.4
b_Soldier_f    [1, 0.1, 0.1] = 1.2 * cost inf(2) = 2.4 * cost player (1) = 2.4
________ total threat blufor = 9.6

o_mrap_02 _f	[0.8, 0.6, 0.3] = 1.7 * cost wheeled veh(2) = 3.4
o_soldier_f 	[1, 0.1, 0.1] = 1.2 * cost inf(2) = 2.4
________ total threat opfor = 5.8

total score of both sides = 9.6 + 5.8 = 15.4

blufor 9.6 / 15.4 = 0.62 or 62%

opfor 5.8 / 15.4 = 0.38 or 38%

bar moves 0.62 - 0.38 = 0.24 in favour of blufor. Instead of the 0.02 advantage they had with a inf cost of 1.

The post became a little bit bigger than i wished but hopefully youve gained some knowledge of how the sectors are actually working and what the values are doing.

Share this post


Link to post
Share on other sites

My eyes just glossed over, Larrow. Nice work. Lol.

Any word on how to implement unlockable spawn points and vehicle rewards using the module? I attempted to sync vehicles to one sector and then the area - both didn't work. The vehicle was there regardless of the sync or whomever captured the point (or if it was even captured).

Ideally, I want to sync a spawn and an attack helo to one sector captured by that given side. I was hoping for there to be much more documentation on this module...

Share this post


Link to post
Share on other sites

Ive got the rewards sort of working.

SECTOR MODULE

In Expression box type
if ((_this select 1) == west) then  {(_this select 0) enableSimulation false}

Make sure task description in the sector module is empty.(else the automatic reward description will not show)

Create a vehicleRespawnModule

position = starting position

position selection = newest

notification = enable

force respawn = enable

Sync the trigger that denotes the sectors area to a vehicle respawn module.

Sync to this an empty blufor hunter.

Create a modules->object modifiers->hide/show

set it to hide, sync it with the hunter

This is enough to get it going, task is shown with quest reward, on taking ownership of the sector a respawning hunter is created.

_______________

The module seems very lacking in this respect.

Task reward descriptions are only created if you have either a vehicle respawn or respawn position synced to the area trigger.

The sector area trigger only fires if the sector module is disabled/deleted. (so you get the reward but then the sector is locked down)

I was trying to do an example of a sector that can repeatedly captured by either blufor or opfor and each time you captured it a ifrit or hunter depending on faction is spawned.

Straight away you have no reward description to your task as it needs to be certain modules as mentioned above. Unless you write the task description out yourself including the picture etc (A quick fix would of been a spawning module (thought there used to be one) that can be tied to the sector)

The area trigger only fires when the sector gets locked down by deleting or disabling the sector module. (this kills repeatable capture points, you could get around this via the expression box to set a global variable dependant on who the owner is to be able to activate another trigger, but this then kills automatic task descriptions /sigh)

TBO its seems its loads of triggers and modules to try and get what you want out of it, would be quicker to script it myself.

Share this post


Link to post
Share on other sites

That worked thanks. I guess I was getting the sync wrong.

The next variant is how I would make it determine which side captures it, and the vehicle of the appropriate side spawning.

Right now I have a CSAT and NATO vehicle spawning on the respawn module, when ANYONE captures the point. Recommendations?

Edit: just read the bottom part of your post. If you come across a solution for the vehicle spawn depending on what faction owns the sector, please let me know. I'll be figuring out this fangled multiple respawn selector template. :/

Edited by SpectreRSG

Share this post


Link to post
Share on other sites

Updated: it looks like you're right. If I take out that lock down in the expression for the sector module, for that cap point, it doesn't spawn the vehicles; so its not isolated to you as well.

I would hope BI would change this in the modules scripting.

Edited by SpectreRSG

Share this post


Link to post
Share on other sites

Fancy putting this through some testing for me SpectreRSG, or anyone for that matter. Sector_Module_vehRespawn

Done alot of testing in editor and some in dedicated seems ok, let me know.

Gave up trying to do it with the modules and wrote a little script instead.

Respawn modules are fake, they are there just so the sector module applies the rewards to the task description.

The gamelogic gc1 runs my script, it needs to be synced to the sector module and to all the vehicles for respawning.

Vehicles are spawned dependant on sector owner. Each monitors for desertion on moving a certain distance from spawn point.

There are other values see vehRespawnLogic.sqf for details.

Edited by Larrow

Share this post


Link to post
Share on other sites

Hello Larrow thank you very much for your help with that modul, know I understood what all this stands for.

I've changed this particular value to 0.018 so with three guys the point will be captured in about 05:15 Minutes.

Share this post


Link to post
Share on other sites

double post ... damn browser

Edited by Beigen

Share this post


Link to post
Share on other sites

I'll take me a day or so to look through what you did there Larrow. Thanks, you'll be hearing from me soon (hopefully)

Edit: so essentially if I take those two scripts you made, put them in my mission. And essentially just make a gamelogic for each vehicle(s) I want to spawn at that given sector and sync them up, in addition to syncing up to the sector module (and have the gamelogic call up the script for each different vehicle spawn) it would work?

Do the names of the game logic, vehicles, and vehicle respawn modules affect anything in the scripting?

And just to be clear, the vehicles spawn where they're placed in the editor? Not at the Vehicle Respawn module?

Lastly, could I use the simple vehicle respawn script in the editor placed vehicle without any weirdness or anything in your scripts causing conflicts?

Edited by SpectreRSG

Share this post


Link to post
Share on other sites

Basically you put down just one gameLogic which runs vehRespawnLogic.sqf this script looks at everything synced to the gameLogic.

vehRespawnLogic.sqf

It makes a list of ALL vehicles synced to the gamelogic and saves their positions, cargo (items, magazines and weapons), side and name. It also takes a reference to the sector module it is synced to.

This script then loops forever or until the sector module becomes finalised. On detecting a change in ownership of the sector it then passes all vehicles of the side of the new owner to the vehRespawn.sqf to be spawned.

vehRespawn.sqf (automatically run by vehRespawnLogic.sqf, not designed to be used separately)

Takes all vehicles passed to it and if they are not already alive spawns them at the saved position with their name and adds all the saved cargo.

Each vehicle is then monitored:-

If they die they are respawned back at the saved position, only if their side is still the owner.

If they become deserted after they are moved away from the sector they are then moved back to the saved position.

PARAMS

[logic, delay, desertedTimeOut, respawnCount, deleteWreck, showNotification, desertionDistance, movedDistance] execVM "vehRespawnLogic.qsf"

logic - Name/Reference of the logic module this script is run from. (This always needs to be included)

delay (5)- Time in seconds, delay before spawning, whether this is spawned from owner change or because it died

desertedTimeOut (10)- Time in seconds, If there are no players of this vehicles side within desertionDistance of it for this amount of time it will be moved back to its starting position.

respawnCount (-1)- Number, decreased each time it dies, -1 is infinite number of respawns. (needs more testing)

deleteWreck ([true,10])- ARRAY, [true/false, time], whether to delete dead vehicles and time for them to be deleted after they are dead.

showNotification (true)- true/false, shows the notification message on a vehicle being respawned, shown to all clients of the vehicles side.

desertionDistance (50)- Distance in meters, Distance of players of the same side have to be within to stop the vehicle becoming deserted.

movedDistance (50)- Distance in meters, Distance vehicle has to moved away from its starting position before it monitored for desertion.

Values in () are the current defaults. Remember this is a test piece and as said in my last post still needs a thorough testing for errors.

___________________________________

so essentially if I take those two scripts you made, put them in my mission.
Yes
And essentially just make a gamelogic for each vehicle(s) I want to spawn at that given sector and sync them up, in addition to syncing up to the sector module
No, 1 gameLogic synced to the sector module and synced to as many vehicles as you like from as many sides as you like (e.g the example mission has 1 gamelogic synced to the sector module, it then has 3 Opfor Ifrit's and 3 Blufor Hunters synced to it aswell).
Do the names of the game logic, vehicles, and vehicle respawn modules affect anything in the scripting?
GameLogic no although maybe handy to name to be able to pass to the script.

Vehicles, not necessary but the vehicles are respawned with their names so you can have a reference to them somewhere else in script.

Vehicle respawn modules are there ONLY to fill in sector task descriptions to show each vehicle they are synced to as rewards.

And just to be clear, the vehicles spawn where they're placed in the editor? Not at the Vehicle Respawn module?
Yes
Lastly, could I use the simple vehicle respawn script in the editor placed vehicle without any weirdness or anything in your scripts causing conflicts?
Doubt it, read description above, this script basically already is a respawn script, adding the other one would most likely mess things up as they would have two killed events on them. Also im currently not saving the init of the vehicle so anything placed here (other than if it adds items, magazines or weapons to the vehicles cargo) will not be transfered to the spawned vehicles. (Something i could add if needed). Edited by Larrow

Share this post


Link to post
Share on other sites

I'm struggling to work out how to fire script or a Trigger on sector capture. Tried a few things in the expression box but no joy. I've read back through the thread but I'm none the wiser.

Anyone have time to explain a simple one? I've got a Sector owned by Opfor that gets capped by Blurfor all working. Need a script to fires when it changes hands. Ideally a trigger.

---------- Post added at 02:30 PM ---------- Previous post was at 01:32 PM ----------

Hah, I'm a bit of a moron. Cracked it

It should be something like this

sector expression

player setvariable ["sector",_this,true]

trigger cond

(player getvariable "sector" select 1 ) == opfor

script

if ((player getvariable "sector" select 1 ) == opfor) then {Hint "OPFOR"};

returned different info by changing the selection number

modulename select 0

current owner select 1

previous owner select 2

Beaten to it.

It may be better to change the player to a gamelogic name.

Edited by Magicpanda

Share this post


Link to post
Share on other sites

Is the Sector module supposed to work for JIP players? I made and played a mission with four sectors and some of our players reported they had no markers on the map, and tasks were rather randomly working as well.

Also, the HUD sector icons seem to get incorrect colors in multiplayer (dedicated server). My sectors started as owned by BLUFOR, but the icons were... cyan. The icon color was briefly correct when the sector was being captured, but after capturing it went back to cyan. Anyone else seeing this or am I doing something wrong?

Share this post


Link to post
Share on other sites
Also, the HUD sector icons seem to get incorrect colors in multiplayer (dedicated server).
I have also noticed this, it is not just you.

As for the JIP i have not tested it.

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

×