A3-Conquest.Altis / scripts / AEGIS / Random / Spawn_DAC.sqf
Spawn_DAC.sqf
Raw
// Spawn_DAC.sqf: Used to randomally generate DAC Zones of Units
// Inital Definitions
private _sectorType = _this select 0;
private _distance = _this select 1;
private _name = _this select 2;
private _sectorPos = _this select 3;
private _moduleOwnerSide = _this select 4;
private _modulePriorOwnerSide = _this select 5;
private _sectorFaction = 2;
while {_name in DAC_CheckZones} do {_name = _name + "i"};

// Verify valid side, then last and current side not same
if (str(_moduleOwnerSide) == "EAST" || str(_moduleOwnerSide) == "WEST" || str(_moduleOwnerSide) == "GUER") then {
	if !(_moduleOwnerSide == _modulePriorOwnerSide) then {
		// Determine Faction Side
		if (str(_moduleOwnerSide) == "EAST") then {
			_sectorFaction = 0;
		};
		if (str(_moduleOwnerSide) == "WEST") then {
			_sectorFaction = 1;
		};
		if (str(_moduleOwnerSide) == "GUER") then {
			_sectorFaction = 2;
		};
		
		// Spawn Faction Units in Captured Sector
		if (_sectorType == 0) then {
			waituntil{DAC_NewZone == 0}; [_sectorPos,_distance,_distance,0,0,([_name,[2,0,0],[1,2,9,3],[],[],[],[_sectorFaction,_sectorFaction,_sectorFaction,_sectorFaction]])] call DAC_fNewZone;
			// Provide Money to Captor
			_reward = 1000;
			null = [_moduleOwnerSide, _reward] execVM "scripts\AEGIS\Database\sectorReward.sqf";
		};
		if (_sectorType == 1) then {
			waituntil{DAC_NewZone == 0}; [_sectorPos,_distance,_distance,0,0,([_name,[2,0,0],[1,2,9,3],[],[],[],[_sectorFaction,_sectorFaction,_sectorFaction,_sectorFaction]])] call DAC_fNewZone;
			// Provide Money to Captor
			_reward = 500;
			null = [_moduleOwnerSide, _reward] execVM "scripts\AEGIS\Database\sectorReward.sqf";
		};
	};
};