Jump to content
Sign in to follow this  
m1ndgames

Sector Handling via Script - BIS_fnc_moduleSector

Recommended Posts

Hi,

is it possible to create and modify the sectors using only script? The Idea is to have more flexibillity when initializing the Sector locations.

I'm trying it like this, using BIS_fnc_moduleSector:

// Create Tickets
[bLUFOR, 1000] call BIS_fnc_respawnTickets;
[OPFOR, 1000] call BIS_fnc_respawnTickets;
[iNDEPENDENT, 1000] call BIS_fnc_respawnTickets;

// Bleed System
[[bLUFOR,OPFOR,INDEPENDENT], 0.6, 10, 10] call BIS_fnc_bleedTickets;

// Create Sectors
[sector_a] call BIS_fnc_moduleSector;
[sector_a,BLUFOR] call BIS_fnc_moduleSector;

[sector_b] call BIS_fnc_moduleSector;
[sector_b,OPFOR] call BIS_fnc_moduleSector;

[sector_c] call BIS_fnc_moduleSector;
[sector_c,INDEPENDENT] call BIS_fnc_moduleSector;

[sector_d] call BIS_fnc_moduleSector;

In the editor i would now link an area to the sector, and add a Trigger to the Area to define the Zone. How can/should i progress using only script?

Share this post


Link to post
Share on other sites

I couldnt find a way to modify the sectors, so i created a workaround by moving the Trigger to which the Area Module is attached to.

But i have issues with removing a value from an array, error:

20:12:59 Error in expression <m_Sector_B_C = _Random_Template_Sectors - location_blufor;

location_opfor = _R>

20:12:59 Error position: <- location_blufor;

location_opfor = _R>

20:12:59 Error Generic error in expression

20:12:59 File mpmissions\__cur_mp.Altis\WarZones_Sectors.sqf, line 14

WarZones_Template_Sectors.hpp

Templates_Sector = [
[[23225.752,3.1900001,18440.73],[23277.715,3.1900001,18456.316],[23265.676,3.1900001,18405.834]],
[[23525.969,91.983055,21121.223],[25241.434,87.181221,21830.838],[25433.451,9.782629,20342.787]]
];

WarZones_Sectors.sqf

// Load Sector Templates
#include "WarZones_Template_Sectors.hpp";

// Get a Random Template from the Array
_Random_Template = Templates_Sector select floor random count Templates_Sector;

// Get the three Sector locations from Template
_Random_Template_Sectors = _Random_Template select 0;

// BLUFOR Sector
location_blufor = _Random_Template_Sectors select floor random count _Random_Template_Sectors;

// Remove BLUFOR from Sectors
_Random_Sector_B_C = _Random_Template_Sectors - location_blufor;

// OPFOR Sector
location_opfor = _Random_Sector_B_C select floor random count _Random_Sector_B_C;

// Independent Sector
location_independent = _Random_Sector_B_C - location_opfor;

// Move Respawn Marker to Sector
respawn_west setMarkerPos location_blufor;
respawn_east setMarkerPos location_opfor;
respawn_guerrila setMarkerPos location_independent;

// Modify the Sector Triggers
sector_blufor_trigger setTriggerArea [25,25, 0, false ];
sector_opfor_trigger setTriggerArea [25,25, 0, false ];
sector_independent_trigger setTriggerArea [25,25, 0, false ];

// Declare Sectors as Public
publicVariable "location_blufor";
publicVariable "location_independent";
publicVariable "location_opfor";

Share this post


Link to post
Share on other sites
How can/should i progress using only script?

If you read BIS_fnc_moduleSector starting at around line 420 there is a list of variables that the logic retrieves each cycle that you can change. The module also tracks the trigger position. Reading down to about line 800 should give you a good idea what is tracked/re-calculated each cycle.

But i have issues with removing a value from an array, error:

You are going one level to deep i think....

Templates_Sector = [
   [[23225.752,3.1900001,18440.73],[23277.715,3.1900001,18456.316],[23265.676,3.1900001,18405.834]],
   [[23525.969,91.983055,21121.223],[25241.434,87.181221,21830.838],[25433.451,9.782629,20342.787]]
];  

// [[23225.752,3.1900001,18440.73],[23277.715,3.1900001,18456.316],[23265.676,3.1900001,18405.834]]
_Random_Template = Templates_Sector select floor random count Templates_Sector;

// [23225.752,3.1900001,18440.73]
_Random_Template_Sectors = _Random_Template select 0;

// 23225.752
location_blufor = _Random_Template_Sectors select floor random count _Random_Template_Sectors;

// [23225.752,3.1900001,18440.73] - 23225.752
_Random_Sector_B_C = _Random_Template_Sectors - location_blufor;

Share this post


Link to post
Share on other sites

Hi, thanks for your reply! :)

I changed a lot, this is an early (but working) version:

WarZones_Template_Sectors.hpp

_Templates_Sector = [
[
	[23225,18440],[23277,18456],[23265,18405]
],
[
	[23525,21121],[25241,21830],[25433,20342]
]
];

WarZones_Sectors.sqf

// Load Sector Templates
#include "WarZones_Template_Sectors.hpp";

// Get a Random Template from the Array
_Random_Sectors = _Templates_Sector call BIS_fnc_selectRandom;

// Shuffle the Sector Positions
_Shuffled_Sectors = _Random_Sectors call BIS_fnc_arrayShuffle;

// BLUFOR Sector
_location_blufor = _Shuffled_Sectors select 0;

// OPFOR Sector
_location_opfor = _Shuffled_Sectors select 1;

// Independent Sector
_location_independent = _Shuffled_Sectors select 2;

// Define x/y
_location_blufor_x = _location_blufor select 0;
_location_blufor_y = _location_blufor select 1;

_location_opfor_x = _location_opfor select 0;
_location_opfor_y = _location_opfor select 1;

_location_independent_x = _location_independent select 0;
_location_independent_y = _location_independent select 1;

// Create Bases
_base_blufor = [_location_blufor_x,_location_blufor_y] execVM "WarZones_Sectors_BLUFOR.sqf";
waitUntil {isNull _base_blufor};

_base_opfor = [_location_opfor_x,_location_opfor_y] execVM "WarZones_Sectors_OPFOR.sqf";
waitUntil {isNull _base_opfor};

_base_independent = [_location_independent_x,_location_independent_y] execVM "WarZones_Sectors_INDEPENDENT.sqf";
waitUntil {isNull _base_independent};

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  

×