mirror of
https://github.com/rambo/arma3_missions.git
synced 2024-08-30 16:52:13 +00:00
Bunch of inexpert late-night edits, trying to make this multiplayer
This commit is contained in:
parent
c29642761b
commit
4cfe4d31e5
@ -1,5 +1,7 @@
|
||||
|
||||
_centrePos = _this select 0;
|
||||
_playerno = _this select 1;
|
||||
|
||||
|
||||
_centreX = _centrePos select 0;
|
||||
_centrePos set [0, _centreX - 1000 + (floor random 500)];
|
||||
@ -10,11 +12,13 @@ _groupEnemy = createGroup east;
|
||||
"O_soldier_AA_F" createUnit [_position, _groupEnemy,"",0.9, "CORPORAL"];
|
||||
|
||||
|
||||
AAArray = AAArray + [_groupEnemy];
|
||||
AAMDArray set [_playerno, (AAMDArray select _playerno) + [_groupEnemy]];
|
||||
publicVariable "AAMDArray";
|
||||
|
||||
|
||||
_enemyCount = count AAArray;
|
||||
_enemyCount = count (AAMDArray select _playerno);
|
||||
if (_enemyCount > 5) then
|
||||
{
|
||||
null = [(AAArray select 0), "aa"] execVM "deleteSquad.sqf";
|
||||
};
|
||||
null = [((AAMDArray select _playerno) select 0), "aa", _playerno] execVM "deleteSquad.sqf";
|
||||
};
|
||||
|
||||
|
@ -1,41 +1,60 @@
|
||||
//null = [target, [positionA, positionB, positionC...], previousLocation] execVM "createObj.sqf";
|
||||
//null = [(playersArray select _playerno), [positionA, positionB, positionC...], previousLocation] execVM "createObj.sqf";
|
||||
|
||||
waitUntil {!(isNil "missionInitComplete")};
|
||||
|
||||
|
||||
target = _this select 0;
|
||||
lzLocs = _this select 1;
|
||||
prevLZ = _this select 2;
|
||||
_target = _this select 0;
|
||||
_lzLocs = _this select 1;
|
||||
_prevLZ = _this select 2;
|
||||
_playerno = _this select 3;
|
||||
_player = playersArray select _playerno;
|
||||
|
||||
lzLoc = (lzLocs - [prevLZ]) call BIS_fnc_SelectRandom;
|
||||
_lzLoc = (_lzLocs - [_prevLZ]) call BIS_fnc_SelectRandom;
|
||||
|
||||
diag_log format["createObj called, _target: %1, _playerno: %2, _player: %3", _target, _playerno, _player];
|
||||
|
||||
// TODO: handle the case of player crash/death, reset the task etc
|
||||
|
||||
|
||||
|
||||
tsk1 = target createSimpleTask ["NextLZ"];
|
||||
tsk1 setSimpleTaskDescription ["Fly to and land at the next LZ", "Next LZ", "LZ"];
|
||||
tsk1 setSimpleTaskDestination (getPos lzLoc);
|
||||
target setCurrentTask tsk1;
|
||||
//_tsk1 = (playersArray select _playerno) createSimpleTask ["NextLZ"];
|
||||
//_tsk1 setSimpleTaskDescription [format["Fly to and land within %1m of the next LZ", lzSize], "Next LZ", "LZ"];
|
||||
//_tsk1 setSimpleTaskDestination (getPos _lzLoc);
|
||||
//(playersArray select _playerno) setCurrentTask _tsk1;
|
||||
_taskid = format["p%1_lz%2", _playerno, _lzLoc];
|
||||
[west,[_taskid],[format["Fly to and land within %1m of the next LZ", lzSize], "Next LZ", "LZ"],(getPos _lzLoc),true,5,true, "move", true] call BIS_fnc_taskCreate;
|
||||
|
||||
trg = createTrigger["EmptyDetector",getPos lzLoc]; trg setTriggerArea[2000,300,0,false];
|
||||
trg setTriggerActivation["WEST","PRESENT",false];
|
||||
trg setTriggerTimeout [2.5, 2.5, 2.5, true];
|
||||
trg setTriggerStatements["(vehicle target != target) && ((vehicle target) in thislist) && (isTouchingGround (vehicle target))", "null = [trg, tsk1, target, lzLoc, lzLocs] execVM 'landingComplete.sqf'", ""];
|
||||
|
||||
null = [(getPos lzLoc), target] execVM 'createSquad.sqf';
|
||||
|
||||
_trg = createTrigger["EmptyDetector",getPos _lzLoc];
|
||||
_trg setTriggerArea[lzSize,lzSize,0,false];
|
||||
_trg setTriggerActivation["WEST","PRESENT",false];
|
||||
_trg setTriggerTimeout [2.5, 2.5, 2.5, true];
|
||||
_trgcond = format["(vehicle (playersArray select %1) != (playersArray select %1)) && (vehicle ((playersArray select %1)) in thislist) && (isTouchingGround (vehicle (playersArray select %1)))", _playerno];
|
||||
_trgaction = format["null = [thisTrigger, '%2', (playersArray select %1), %3, %4, %1] execVM 'landingComplete.sqf'", _playerno, _taskid, _lzLoc, _lzLocs];
|
||||
diag_log format["LZ trigger condition: %1", _trgcond];
|
||||
diag_log format["LZ trigger action: %1", _trgaction];
|
||||
_trg setTriggerStatements[_trgcond, _trgaction, ""];
|
||||
|
||||
|
||||
null = [(getPos _lzLoc), (playersArray select _playerno), _playerno] execVM 'createSquad.sqf';
|
||||
|
||||
//Make the LZ hot if the roll demands it
|
||||
if ((random 1) < hotLZChance) then
|
||||
{
|
||||
null = [(getPos lzLoc)] execVM 'enemySquad.sqf';
|
||||
null = [(getPos _lzLoc), _playerno] execVM 'enemySquad.sqf';
|
||||
hintSilent "LZ is hot";
|
||||
};
|
||||
if ((random 1) < AAChance) then
|
||||
{
|
||||
null = [(getPos lzLoc)] execVM 'AASquad.sqf';
|
||||
null = [(getPos _lzLoc), _playerno] execVM 'AASquad.sqf';
|
||||
hint "LZ has AA!";
|
||||
};
|
||||
|
||||
landingComplete = false;
|
||||
landingCompleteArray set [_playerno, false];
|
||||
publicVariable "landingCompleteArray";
|
||||
|
||||
if (bSmoke) then
|
||||
{
|
||||
null = [(getPos lzLoc)] execVM 'spawnSmoke.sqf';
|
||||
};
|
||||
null = [(getPos _lzLoc), _playerno] execVM 'spawnSmoke.sqf';
|
||||
};
|
||||
|
@ -1,7 +1,10 @@
|
||||
if (ferrying) exitWith {};
|
||||
|
||||
_spawnPos = _this select 0;
|
||||
_target = _this select 1;
|
||||
_playerno = _this select 2;
|
||||
|
||||
if (ferryingArray select _playerno) exitWith {};
|
||||
|
||||
|
||||
_groupTaxi = createGroup west;
|
||||
"B_Soldier_F" createUnit [_spawnPos, _groupTaxi,"",0.5, "CORPORAL"];
|
||||
@ -9,4 +12,5 @@ _groupTaxi = createGroup west;
|
||||
"B_Soldier_F" createUnit [_spawnPos, _groupTaxi,"",0.5, "PRIVATE"];
|
||||
"B_Soldier_F" createUnit [_spawnPos, _groupTaxi,"",0.5, "PRIVATE"];
|
||||
|
||||
squadArray = squadArray + [_groupTaxi];
|
||||
squadMDArray set [_playerno, (squadMDArray select _playerno) + [_groupTaxi]];
|
||||
publicVariable "squadMDArray";
|
||||
|
@ -1,13 +1,19 @@
|
||||
//if (!ferrying) exitWith {};
|
||||
_group = _this select 0;
|
||||
_side = _this select 1;
|
||||
_playerno = _this select 2;
|
||||
diag_log format["deleteSquad called, _this: %1", _this];
|
||||
|
||||
|
||||
switch (_side) do
|
||||
{
|
||||
case "west": {squadArray = squadArray - [_group]};
|
||||
case "east": {enemyArray = enemyArray - [_group]};
|
||||
case "aa": {AAArray = AAArray - [_group]};
|
||||
case "west": { squadMDArray set [_playerno, (squadMDArray select _playerno) - [_group]] };
|
||||
case "east": { enemyMDArray set [_playerno, (enemyMDArray select _playerno) - [_group]] };
|
||||
case "aa": { AAMDArray set [_playerno, (AAMDArray select _playerno) - [_group]] };
|
||||
};
|
||||
|
||||
{deleteVehicle _x} forEach units _group;
|
||||
{deleteVehicle _x} forEach units _group;
|
||||
|
||||
publicVariable "squadMDArray";
|
||||
publicVariable "enemyMDArray";
|
||||
publicVariable "AAMDArray";
|
||||
|
@ -1,7 +1,11 @@
|
||||
if (!ferrying) exitWith {};
|
||||
|
||||
_group = _this select 0;
|
||||
_vehicle = _this select 1;
|
||||
_playerno = _this select 2;
|
||||
|
||||
diag_log format["ejectSquad called, _this: %1", _this];
|
||||
|
||||
if (!(ferryingArray select _playerno)) exitWith {};
|
||||
|
||||
|
||||
deleteWaypoint [_group,1];
|
||||
|
||||
@ -12,4 +16,5 @@ deleteWaypoint [_group,1];
|
||||
wp = _group addwaypoint [lz1,5,1];
|
||||
wp setwaypointType "MOVE";
|
||||
|
||||
ferrying = false;
|
||||
ferryingArray set [_playerno, false];
|
||||
publicVariable "ferryingArray";
|
||||
|
@ -1,4 +1,5 @@
|
||||
_centrePos = _this select 0;
|
||||
_playerno = _this select 1;
|
||||
|
||||
_centreX = _centrePos select 0;
|
||||
_centrePos set [0, _centreX + 100 + (floor random 300)];
|
||||
@ -17,4 +18,5 @@ _groupEnemy = createGroup east;
|
||||
"O_soldier_M_F" createUnit [_position, _groupEnemy,"",0.3, "PRIVATE"];
|
||||
"O_soldier_AR_F" createUnit [_position, _groupEnemy,"",0.3, "PRIVATE"];
|
||||
|
||||
enemyArray = enemyArray + [_groupEnemy];
|
||||
enemyMDArray set [_playerno, (enemyMDArray select _playerno) + [_groupEnemy]];
|
||||
publicVariable "enemyMDArray";
|
||||
|
@ -1,12 +1,13 @@
|
||||
null = execVM "briefing.sqf";
|
||||
|
||||
_maxplayers = 4;
|
||||
_lzCount = 86;
|
||||
//Handle parameters
|
||||
|
||||
//Time of day
|
||||
_time = paramsArray select 0;
|
||||
if (_time != 1) then
|
||||
{
|
||||
skiptime _time;
|
||||
skipTime (_time - daytime + 24 ) % 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -31,9 +32,42 @@ _AAParam = paramsArray select 4;
|
||||
AAChance = if (_AAParam > 0) then {_AAParam / 100} else {0.0};
|
||||
publicVariable "AAChance";
|
||||
|
||||
squadArray = [];
|
||||
enemyArray = [];
|
||||
AAArray = [];
|
||||
lzList = [];
|
||||
_x = 0;
|
||||
while {_x < _lzCount} do
|
||||
{
|
||||
_lz = missionNamespace getVariable ("lz" + format["%1", _x + 1]);
|
||||
lzList = lzList + [_lz];
|
||||
_x = _x + 1;
|
||||
};
|
||||
|
||||
publicVariable "lzList";
|
||||
|
||||
squadMDArray = [];
|
||||
enemyMDArray = [];
|
||||
AAMDArray = [];
|
||||
ferryingArray = [];
|
||||
landingCompleteArray = [];
|
||||
squadLoadedArray = [];
|
||||
playersArray = [];
|
||||
|
||||
|
||||
for [{_iX = 0}, {_iX < _maxplayers}, {_iX = _iX + 1}] do
|
||||
{
|
||||
squadMDArray set [_iX, []];
|
||||
enemyMDArray set [_iX, []];
|
||||
AAMDArray set [_iX, []];
|
||||
ferryingArray set [_iX, false];
|
||||
landingCompleteArray set [_iX, false];
|
||||
squadLoadedArray set [_iX, false];
|
||||
playersArray set [_iX, null];
|
||||
};
|
||||
publicVariable "squadMDArray";
|
||||
publicVariable "enemyMDArray";
|
||||
publicVariable "AAMDArray";
|
||||
publicVariable "ferryingArray";
|
||||
publicVariable "landingCompleteArray";
|
||||
publicVariable "squadLoadedArray";
|
||||
|
||||
missionInitComplete = true;
|
||||
publicVariable "missionInitComplete";
|
||||
|
@ -1,19 +1,15 @@
|
||||
waitUntil {!(isNil "missionInitComplete")};
|
||||
|
||||
_target = _this select 0;
|
||||
_lzCount = _this select 1;
|
||||
_playerno = _this select 1;
|
||||
playersArray set [_playerno, _target];
|
||||
|
||||
lzList = [];
|
||||
diag_log format["initPlayer called, _target: %1, _playerno: %2", _target, _playerno];
|
||||
|
||||
|
||||
_x = 0;
|
||||
while {(_x < _lzCount)} do
|
||||
{
|
||||
_lz = missionNamespace getVariable ("lz" + format["%1", _x + 1]);
|
||||
lzList = lzList + [_lz];
|
||||
_x = _x + 1;
|
||||
};
|
||||
|
||||
null = [_target, lzList, []] execVM "createObj.sqf";
|
||||
ferrying = false;
|
||||
_target allowDamage false;
|
||||
_target addItem "SatchelCharge_Remote_Mag";
|
||||
_target addweapon "NVGoggles";
|
||||
ferryingArray set [_playerno, false];
|
||||
landingCompleteArray set [_playerno, false];
|
||||
publicVariable "ferryingArray";
|
||||
publicVariable "landingCompleteArray";
|
||||
null = [_target, lzList, [], _playerno] execVM "createObj.sqf";
|
||||
(playersArray select _playerno) addItem "SatchelCharge_Remote_Mag";
|
||||
(playersArray select _playerno) addweapon "NVGoggles";
|
||||
|
@ -1,37 +1,51 @@
|
||||
//null = [trigger, task, player, previousLocation, locations] execVM "landingComplete.sqf";
|
||||
//null = [trigger, task, player, previousLocation, locations, player_number] execVM "landingComplete.sqf";
|
||||
|
||||
_trg = _this select 0;
|
||||
_tsk = _this select 1;
|
||||
landedTarget = _this select 2;
|
||||
prevLZ = _this select 3;
|
||||
locs = _this select 4;
|
||||
_taskid = _this select 1;
|
||||
_target = _this select 2;
|
||||
_prevLZ = _this select 3;
|
||||
_locs = _this select 4;
|
||||
_playerno = _this select 5;
|
||||
|
||||
vehiclePlayer = vehicle landedTarget;
|
||||
diag_log format["landingComplete called, _this: %1", _this];
|
||||
|
||||
|
||||
_vehiclePlayer = vehicle (playersArray select _playerno);
|
||||
|
||||
deletevehicle _trg;
|
||||
_tsk setTaskState "SUCCEEDED";
|
||||
null = [_taskid, "SUCCEEDED", False] spawn BIS_fnc_taskSetState;
|
||||
hint 'Landing successful!';
|
||||
|
||||
_squadCount = count squadArray;
|
||||
_enemyCount = count enemyArray;
|
||||
null = [(squadArray select _squadCount - 1), vehiclePlayer] execVM 'ejectSquad.sqf';
|
||||
_squadArray = squadMDArray select _playerno;
|
||||
_enemyArray = enemyMDArray select _playerno;
|
||||
_squadCount = count _squadArray;
|
||||
_enemyCount = count _enemyArray;
|
||||
null = [(_squadArray select _squadCount - 1), _vehiclePlayer, _playerno] execVM 'ejectSquad.sqf';
|
||||
|
||||
if (_enemyCount > 1) then
|
||||
{
|
||||
null = [(enemyArray select 0), "east"] execVM "deleteSquad.sqf";
|
||||
null = [(_enemyArray select 0), "east", _playerno] execVM "deleteSquad.sqf";
|
||||
};
|
||||
if (_squadCount > 1) then
|
||||
{
|
||||
null = [(squadArray select 0), "west"] execVM "deleteSquad.sqf";
|
||||
null = [(_squadArray select 0), "west", _playerno] execVM "deleteSquad.sqf";
|
||||
};
|
||||
|
||||
landingComplete = true;
|
||||
landedTarget removeSimpleTask _tsk;
|
||||
landingCompleteArray set [_playerno, true];
|
||||
publicVariable "landingCompleteArray";
|
||||
[_taskid] call BIS_fnc_deleteTask;
|
||||
|
||||
null = [vehiclePlayer, (squadArray select _squadCount -1)] execVM "loadSquad.sqf";
|
||||
|
||||
trgLoaded = createTrigger["EmptyDetector",getPos lzLoc];
|
||||
trgLoaded setTriggerArea[40,5,0,false];
|
||||
trgLoaded setTriggerActivation["NONE","PRESENT",false];
|
||||
trgLoaded setTriggerTimeout [3, 3, 3, true];
|
||||
trgLoaded setTriggerStatements["squadLoaded", "null = [landedTarget, locs, prevLZ] execVM 'createObj.sqf'; hint 'Fly to the next LZ!';", ""];
|
||||
null = [_vehiclePlayer, (_squadArray select _squadCount -1), _playerno] execVM "loadSquad.sqf";
|
||||
|
||||
_trgLoaded = createTrigger["EmptyDetector",getPos _prevLZ];
|
||||
_trgLoaded setTriggerArea[lzSize,lzSize,0,false];
|
||||
_trgLoaded setTriggerActivation["WEST","PRESENT",false];
|
||||
_trgLoaded setTriggerTimeout [3, 3, 3, true];
|
||||
_trgcond = format["(squadLoadedArray select %1)", _playerno];
|
||||
_trgaction = format["null = [(playersArray select %1), %2, %3, %1] execVM 'createObj.sqf'; hint 'Fly to the next LZ!';", _playerno, _locs, _prevLZ];
|
||||
diag_log format["load condition: %1", _trgcond];
|
||||
diag_log format["load action: %1", _trgaction];
|
||||
_trgLoaded setTriggerStatements[_trgcond, _trgaction, ""];
|
||||
// TODO: should we delete _trgLoaded somewhere ??
|
||||
|
||||
|
@ -1,15 +1,19 @@
|
||||
if (ferrying) exitWith {};
|
||||
|
||||
_vehicle = _this select 0;
|
||||
_group = _this select 1;
|
||||
_playerno = _this select 2;
|
||||
diag_log format["loadSquad called, _this: %1", _this];
|
||||
|
||||
if (ferrying) exitWith {};
|
||||
|
||||
squadLoaded = false;
|
||||
if ((ferryingArray select _playerno)) exitWith {};
|
||||
|
||||
if ({alive _x} count units _group == 0)
|
||||
then
|
||||
{
|
||||
squadLoaded = true;
|
||||
hint "They're all dead!";
|
||||
squadLoadedArray set [_playerno, true];
|
||||
publicVariable "squadLoadedArray";
|
||||
diag_log format["squadLoadedArray: %1, ferryingArray: %2, _playerno: %3", squadLoadedArray, ferryingArray, _playerno];
|
||||
exit;
|
||||
};
|
||||
|
||||
@ -20,14 +24,18 @@ then
|
||||
wp = _group addwaypoint [_vehicle,5,1];
|
||||
wp setwaypointType "GETIN";
|
||||
|
||||
while {not squadLoaded} do
|
||||
while {not (squadLoadedArray select _playerno)} do
|
||||
{
|
||||
diag_log format["Squad %1 is loading to %2", _group, _vehicle];
|
||||
if ({alive _x} count units _group == {_x in _vehicle} count units _group)
|
||||
then
|
||||
{
|
||||
squadLoaded=true;
|
||||
diag_log format["Squad %1 is DONE loading to %2", _group, _vehicle];
|
||||
squadLoadedArray set [_playerno, true];
|
||||
publicVariable "squadLoadedArray";
|
||||
};
|
||||
sleep 2;
|
||||
};
|
||||
ferrying = true;
|
||||
|
||||
ferryingArray set [_playerno, true];
|
||||
publicVariable "ferryingArray";
|
||||
diag_log format["squadLoadedArray: %1, ferryingArray: %2, _playerno: %3", squadLoadedArray, ferryingArray, _playerno];
|
||||
|
Binary file not shown.
@ -1,8 +1,8 @@
|
||||
|
||||
_smokeLoc = _this select 0;
|
||||
_playerno = _this select 1;
|
||||
|
||||
|
||||
while {!landingComplete} do
|
||||
while {!(landingCompleteArray select _playerno)} do
|
||||
{
|
||||
_hour = daytime;
|
||||
if (_hour > 5 && _hour < 19) then
|
||||
|
Loading…
Reference in New Issue
Block a user