The idea is that both teams are given 3 possible locations for a scud that are being selected at random from a pool of 6 locations.
Also the guerilla start location is selected at random from a pool of 3 locations.
I have done this by placing a game logic that calls a script through the initline.
This script basically deletes the units and vehicles at the unselected locations, the issue I have is that for every player the locations selected are different and the gamelogic seems to be run local for everyone.
So atm this presents the issue where every player will run that script deleting different locations, so the more players are on the map the bigger chance of no locations being left.
I am rather new to scripting and I never got around localization issues like this so I would appreciate any help, if needed I can upload the mission file somewhere.
randomizeMission.sqf (through initline of gamelogic):
Code: Select all
// selecting start location guerilla side
gueStartLoc = round (random 2);
hint format ["gueStartLoc: %1", gueStartLoc];
sleep 10;
// selecting 3 possible scud locations out of the pool
_loc1 = round (random 5);
_loc2 = round (random 5);
_loc3 = round (random 5);
while {_loc1 == _loc2} do
{
_loc2 = round (random 5);
};
while {(_loc1 == _loc3) or (_loc2 == _loc3)} do
{
_loc3 = round (random 5);
};
possibleScudLocations = [_loc1,_loc2,_loc3];
hint format ["%1, %2, %3",_loc1,_loc2,_loc3];
sleep 10;
scudLocation = possibleScudLocations select (round (random 2));
hint format ["Scudlocation: %1", scudLocation];
sleep 10;
// deleting unnecessary Russian base markers
for [{_i=0}, {_i<6}, {_i=_i+1}] do
{
if ( ! (_i in possibleScudLocations)) then
{
_deletingRussianMarkers = [_i] execVM "deleteRussianMarkers.sqf";
waitUntil {scriptDone _deletingRussianMarkers};
};
};
// setting up the Scud and trucks at remaining Russian bases
{
if (_x != scudLocation) then
{
switch (_x) do
{
case 0 :
{
_pos = getPos rasmanScud;
_dir = getDir rasmanScud;
deleteVehicle rasmanScud;
rasmanTruck = "KamazRefuel" createVehicle (_pos);
rasmanTruck setPos _pos;
rasmanTruck setDir _dir;
};
case 1 :
{
_pos = getPos lalezarScud;
_dir = getDir lalezarScud;
deleteVehicle lalezarScud;
lalezarTruck = "KamazRefuel" createVehicle (_pos);
lalezarTruck setPos _pos;
lalezarTruck setDir _dir;
};
case 2 :
{
_pos = getPos mineScud;
_dir = getDir mineScud;
deleteVehicle mineScud;
mineTruck = "KamazRefuel" createVehicle (_pos);
mineTruck setPos _pos;
mineTruck setDir _dir;
};
case 3 :
{
_pos = getPos jilavurScud;
_dir = getDir jilavurScud;
deleteVehicle jilavurScud;
jilavurTruck = "KamazRefuel" createVehicle (_pos);
jilavurTruck setPos _pos;
jilavurTruck setDir _dir;
};
case 4 :
{
_pos = getPos anarScud;
_dir = getDir anarScud;
deleteVehicle anarScud;
anarTruck = "KamazRefuel" createVehicle (_pos);
anarTruck setPos _pos;
anarTruck setDir _dir;
};
case 5 :
{
_pos = getPos garmsarScud;
_dir = getDir garmsarScud;
deleteVehicle garmsarScud;
garmsarTruck = "KamazRefuel" createVehicle (_pos);
garmsarTruck setPos _pos;
garmsarTruck setDir _dir;
};
};
};
} forEach possibleScudLocations;
// switch (scudLocation) do
// {
// case 0 :
// {
// null = rasmanScud addEventHandler["fired"];
// };
// };
Code: Select all
//selecting the base to delete
_russianBase = _this select 0;
// checking which base to delete and delete all object present in that base
switch (_russianBase) do
{
case 0 :
{
deleteMarker "rasmanMarker";
};
case 1 :
{
deleteMarker "lalezarMarker";
};
case 2 :
{
deleteMarker "mineMarker";
};
case 3 :
{
deleteMarker "jilavurMarker";
};
case 4 :
{
deleteMarker "anarMarker";
};
case 5 :
{
deleteMarker "garmsarMarker";
};
};
deleteRussianBase.sqf (called through initline of each unit/vehicle on the bases with parameters)
Code: Select all
waitUntil{scriptDone randomizeHandle};
_location = _this select 0;
_vehicle = _this select 1;
if (! (_location in possibleScudLocations)) then
{
deleteVehicle _vehicle;
};
Code: Select all
waitUntil{scriptDone randomizeHandle};
_falarMarkerPos = getMarkerPos "Falar";
_mulladostMarkerPos = getMarkerPos "Mulladost";
// setting up start location for Guerilla side
switch (gueStartLoc) do
{
case 0 :
{
player setVehiclePosition [_mulladostMarkerPos,["Mulladost"], 25];
};
case 1 :
{
player setVehiclePosition [_falarMarkerPos,["Falar"], 25];
};
};