mirror of
https://github.com/rambo/arma3_missions.git
synced 2024-08-30 16:52:13 +00:00
fixing triggers
This commit is contained in:
parent
5e2e21a417
commit
a8a91f7483
@ -29,8 +29,8 @@ lzCounter = lzCounter + 1;
|
|||||||
publicVariable "lzCounter";
|
publicVariable "lzCounter";
|
||||||
|
|
||||||
private _shortestDesc = format["LZ %1", lzCounter];
|
private _shortestDesc = format["LZ %1", lzCounter];
|
||||||
private _longdesc = format["%1 wants to fly to this location", _squad];
|
private _longdesc = format["%1 wants to fly to this location", _bindToSquad];
|
||||||
private _shortdesc = format["Drop off %1", _squad];
|
private _shortdesc = format["Drop off %1", _bindToSquad];
|
||||||
if (_lzAA and _lzhot) then
|
if (_lzAA and _lzhot) then
|
||||||
{
|
{
|
||||||
_longdesc = _longdesc + "<br/><strong>Be advised:</strong> Intel reports heavy enemy activity with AA assets at the location";
|
_longdesc = _longdesc + "<br/><strong>Be advised:</strong> Intel reports heavy enemy activity with AA assets at the location";
|
||||||
@ -50,18 +50,27 @@ private _trg = createTrigger["EmptyDetector",getPos _lzLocation, true];
|
|||||||
_trg setTriggerArea[lzSize,lzSize,0,false];
|
_trg setTriggerArea[lzSize,lzSize,0,false];
|
||||||
_trg setTriggerActivation["WEST","PRESENT",false];
|
_trg setTriggerActivation["WEST","PRESENT",false];
|
||||||
_trg setTriggerTimeout [2.5, 2.5, 2.5, true];
|
_trg setTriggerTimeout [2.5, 2.5, 2.5, true];
|
||||||
_trg setTriggerStatements[ format["((%1 in thisList) && (isTouchingGround %1))", _bindToVehicle], "", ""];
|
private _trgCond = format["((%1 in thisList) && (isTouchingGround %1))", _bindToVehicle];
|
||||||
|
diag_log format["createDropoffLZ: _trgCond %s", _trgCond];
|
||||||
|
_trg setTriggerStatements[_trgCond , "", ""];
|
||||||
|
|
||||||
// TODO: implement deadline so the task doesn't linger forever
|
// TODO: implement deadline so the task doesn't linger forever
|
||||||
scopeName "main";
|
scopeName "main";
|
||||||
while {true} do
|
while {true} do
|
||||||
{
|
{
|
||||||
scopeName "mainloop";
|
scopeName "mainloop";
|
||||||
diag_log "createDropoffLZ: ticking";
|
diag_log format["createDropoffLZ: ticking %1", _this];
|
||||||
|
|
||||||
if ({alive _x} count units _squad == 0) then
|
if (( _taskid call BIS_fnc_taskCompleted)) then
|
||||||
{
|
{
|
||||||
diag_log format["createDropoffLZ: Everyone from %1 is dead!", _squad];
|
diag_log format["createPickupLZ: task %1 was marked complete", _taskid];
|
||||||
|
breakOut "mainloop";
|
||||||
|
};
|
||||||
|
|
||||||
|
private _squadAliveCount = {alive _x} count units _bindToSquad;
|
||||||
|
if ((_squadAliveCount < 1)) then
|
||||||
|
{
|
||||||
|
diag_log format["createDropoffLZ: Everyone from %1 is dead!", _bindToSquad];
|
||||||
// Everybody died before getting there :(
|
// Everybody died before getting there :(
|
||||||
[_taskid, "FAILED" ,true] spawn BIS_fnc_taskSetState;
|
[_taskid, "FAILED" ,true] spawn BIS_fnc_taskSetState;
|
||||||
breakOut "mainloop";
|
breakOut "mainloop";
|
||||||
@ -69,9 +78,9 @@ while {true} do
|
|||||||
|
|
||||||
if (triggerActivated _trg) then
|
if (triggerActivated _trg) then
|
||||||
{
|
{
|
||||||
diag_log format["createDropoffLZ: triggered, unloading %1", _squad];
|
diag_log format["createDropoffLZ: triggered, unloading %1", _bindToSquad];
|
||||||
private _veh = [list _trg] call playerVehicleInList;
|
private _veh = [list _trg] call playerVehicleInList;
|
||||||
private _handle = [_lzLocation, _veh, _squad, _taskid] spawn ejectSquad;
|
private _handle = [_lzLocation, _veh, _bindToSquad, _taskid] spawn ejectSquad;
|
||||||
waitUntil {isNull _handle};
|
waitUntil {isNull _handle};
|
||||||
breakOut "mainloop";
|
breakOut "mainloop";
|
||||||
};
|
};
|
||||||
@ -80,4 +89,4 @@ while {true} do
|
|||||||
|
|
||||||
deleteVehicle _trg;
|
deleteVehicle _trg;
|
||||||
// Make sure there are no lingering enemy or own units
|
// Make sure there are no lingering enemy or own units
|
||||||
[_enemies + [_squad]] call deleteSquads;
|
[_enemies + [_bindToSquad]] call deleteSquads;
|
||||||
|
@ -46,8 +46,11 @@ if (!(_assignExtra isEqualTo false)) then
|
|||||||
// PONDER: make a parent task "ferry squad X" ??
|
// PONDER: make a parent task "ferry squad X" ??
|
||||||
private _taskid = format["pickup_%1", lzCounter];
|
private _taskid = format["pickup_%1", lzCounter];
|
||||||
[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],_lzLocation,"AUTOASSIGNED",1,true, "move", true] call BIS_fnc_taskCreate;
|
[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],_lzLocation,"AUTOASSIGNED",1,true, "move", true] call BIS_fnc_taskCreate;
|
||||||
[_squad, _lzLocation, 'green'] spawn spawnSmokeBySquad;
|
|
||||||
|
|
||||||
|
if (bSmoke) then
|
||||||
|
{
|
||||||
|
[_squad, _lzLocation, 'green'] spawn spawnSmokeBySquad;
|
||||||
|
};
|
||||||
|
|
||||||
private _trg = createTrigger["EmptyDetector",getPos _lzLocation, true];
|
private _trg = createTrigger["EmptyDetector",getPos _lzLocation, true];
|
||||||
_trg setTriggerArea[lzSize,lzSize,0,false];
|
_trg setTriggerArea[lzSize,lzSize,0,false];
|
||||||
@ -61,7 +64,13 @@ scopeName "main";
|
|||||||
while {true} do
|
while {true} do
|
||||||
{
|
{
|
||||||
scopeName "mainloop";
|
scopeName "mainloop";
|
||||||
diag_log "createPickupLZ: ticking";
|
diag_log format["createPickupLZ: ticking %1", _this];
|
||||||
|
|
||||||
|
if (( _taskid call BIS_fnc_taskCompleted)) then
|
||||||
|
{
|
||||||
|
diag_log format["createPickupLZ: task %1 was marked complete", _taskid];
|
||||||
|
breakOut "mainloop";
|
||||||
|
};
|
||||||
|
|
||||||
if ({alive _x} count units _squad == 0) then
|
if ({alive _x} count units _squad == 0) then
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,8 @@ scopeName "main";
|
|||||||
while {true} do
|
while {true} do
|
||||||
{
|
{
|
||||||
scopeName "ejectloop";
|
scopeName "ejectloop";
|
||||||
if (({(_x in _vehicle) && (alive _x)} count units _group) == 0) then
|
diag_log format["ejectSquad: ticking %1", _this];
|
||||||
|
if (({(_x in _vehicle) && (alive _x)} count units _squad) == 0) then
|
||||||
{
|
{
|
||||||
// No squad units left alive inside
|
// No squad units left alive inside
|
||||||
[_fromTaskId, "SUCCEEDED" ,true] spawn BIS_fnc_taskSetState;
|
[_fromTaskId, "SUCCEEDED" ,true] spawn BIS_fnc_taskSetState;
|
||||||
|
@ -14,6 +14,7 @@ scopeName "main";
|
|||||||
while {true} do
|
while {true} do
|
||||||
{
|
{
|
||||||
scopeName "loadingLoop";
|
scopeName "loadingLoop";
|
||||||
|
diag_log format["loadSquad: ticking %1", _this];
|
||||||
if ({alive _x} count units _squad == 0) then
|
if ({alive _x} count units _squad == 0) then
|
||||||
{
|
{
|
||||||
// Everybody died before boarding :(
|
// Everybody died before boarding :(
|
||||||
|
@ -1,34 +1,40 @@
|
|||||||
diag_log format["spawnSmokeBySquad called, _this: %1", _this];
|
diag_log format["spawnSmokeBySquad called, _this: %1", _this];
|
||||||
private _bindToSquad = _this select 0;
|
private _bindToSquad = _this select 0;
|
||||||
private _smokeLozation = _this select 1;
|
private _smokeTgt = _this select 1;
|
||||||
|
private _smokeLocation = getPos _smokeTgt;
|
||||||
private _smokeColor = _this select 2;
|
private _smokeColor = _this select 2;
|
||||||
|
|
||||||
private _trg = createTrigger["EmptyDetector",getPos _smokeLozation, true];
|
private _trg = createTrigger["EmptyDetector", _smokeLocation, true];
|
||||||
_trg setTriggerArea[50,50,0,false];
|
_trg setTriggerArea[50,50,0,false];
|
||||||
_trg setTriggerActivation["WEST","PRESENT",false];
|
_trg setTriggerActivation["WEST","PRESENT",false];
|
||||||
private _trgCond = format["count (%1 arrayIntersect thisList) > 0", units _squad];
|
private _keepSpawning = true;
|
||||||
diag_log format["spawnSmokeBySquad _trgCond: %1", _trgCond];
|
|
||||||
_trg setTriggerStatements[_trgCond, "", ""];
|
|
||||||
|
|
||||||
// TODO: switch color based on arguments
|
// TODO: switch color based on arguments
|
||||||
while {triggerActivated _trg} do
|
while {_keepSpawning} do
|
||||||
{
|
{
|
||||||
|
diag_log format["spawnSmokeBySquad: spawning smoke to %1", _smokeLocation];
|
||||||
_hour = daytime;
|
_hour = daytime;
|
||||||
if (_hour > 5 && _hour < 19) then
|
if (_hour > 5 && _hour < 19) then
|
||||||
{
|
{
|
||||||
_smoke= "SmokeShellGreen" createVehicle _smokeLozation;
|
_smoke= "SmokeShellGreen" createVehicle _smokeLocation;
|
||||||
sleep 40;
|
sleep 40;
|
||||||
deleteVehicle _smoke;
|
deleteVehicle _smoke;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_chemlight= "Chemlight_green" createVehicle _smokeLozation;
|
_chemlight= "Chemlight_green" createVehicle _smokeLocation;
|
||||||
_smoke= "SmokeShellGreen" createVehicle _smokeLozation;
|
_smoke= "SmokeShellGreen" createVehicle _smokeLocation;
|
||||||
sleep 40;
|
sleep 40;
|
||||||
deleteVehicle _chemlight;
|
deleteVehicle _chemlight;
|
||||||
deleteVehicle _smoke;
|
deleteVehicle _smoke;
|
||||||
};
|
};
|
||||||
diag_log format["spawnSmokeBySquad: spawned smoke to %1", _smokeLoc];
|
_keepSpawning = false;
|
||||||
|
{
|
||||||
|
if (_x inArea _trg && alive _x) then
|
||||||
|
{
|
||||||
|
_keepSpawning = true;
|
||||||
|
};
|
||||||
|
} forEach (units _bindToSquad);
|
||||||
};
|
};
|
||||||
diag_log format["spawnSmokeBySquad done, _this: %1", _this];
|
diag_log format["spawnSmokeBySquad done, _this: %1", _this];
|
||||||
deleteVehicle _trg;
|
deleteVehicle _trg;
|
||||||
|
Loading…
Reference in New Issue
Block a user