From 5e2e21a41747045abbf685595e78c0801c4942ac Mon Sep 17 00:00:00 2001 From: Eero af Heurlin Date: Mon, 25 Jul 2016 02:28:26 +0300 Subject: [PATCH] improvements --- .../createDropoffLZ.sqf | 10 +++--- .../createEnemySquads.sqf | 2 ++ helotraining_rewrite.Altis/createPickupLZ.sqf | 14 +++++--- helotraining_rewrite.Altis/init.sqf | 1 + helotraining_rewrite.Altis/mission.sqm | 8 ++--- .../spawnSmokeBySquad.sqf | 34 +++++++++++++++++++ 6 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 helotraining_rewrite.Altis/spawnSmokeBySquad.sqf diff --git a/helotraining_rewrite.Altis/createDropoffLZ.sqf b/helotraining_rewrite.Altis/createDropoffLZ.sqf index 100819b..2ac2f00 100644 --- a/helotraining_rewrite.Altis/createDropoffLZ.sqf +++ b/helotraining_rewrite.Altis/createDropoffLZ.sqf @@ -44,30 +44,32 @@ private _assignTo = [_assignToPlayer, west]; // PONDER: make a parent task "ferry squad X" ?? private _taskid = format["dropoff_%1", lzCounter]; -[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],_lzLocation,"AUTOASSIGNED",1,true, _taskType, true] call BIS_fnc_taskCreate; +[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],_lzLocation,"AUTOASSIGNED",1,true, "move", true] call BIS_fnc_taskCreate; -private _handleDropoff=false; private _trg = createTrigger["EmptyDetector",getPos _lzLocation, true]; _trg setTriggerArea[lzSize,lzSize,0,false]; _trg setTriggerActivation["WEST","PRESENT",false]; _trg setTriggerTimeout [2.5, 2.5, 2.5, true]; -_trg setTriggerStatements[ format["((%1 in thisList) && (isTouchingGround %1))", _bindToVehicle], "_handleDropoff = true;", ""]; +_trg setTriggerStatements[ format["((%1 in thisList) && (isTouchingGround %1))", _bindToVehicle], "", ""]; // TODO: implement deadline so the task doesn't linger forever scopeName "main"; while {true} do { scopeName "mainloop"; + diag_log "createDropoffLZ: ticking"; if ({alive _x} count units _squad == 0) then { + diag_log format["createDropoffLZ: Everyone from %1 is dead!", _squad]; // Everybody died before getting there :( [_taskid, "FAILED" ,true] spawn BIS_fnc_taskSetState; breakOut "mainloop"; }; - if (_handleDropoff) then + if (triggerActivated _trg) then { + diag_log format["createDropoffLZ: triggered, unloading %1", _squad]; private _veh = [list _trg] call playerVehicleInList; private _handle = [_lzLocation, _veh, _squad, _taskid] spawn ejectSquad; waitUntil {isNull _handle}; diff --git a/helotraining_rewrite.Altis/createEnemySquads.sqf b/helotraining_rewrite.Altis/createEnemySquads.sqf index 65ab9ea..5943c59 100644 --- a/helotraining_rewrite.Altis/createEnemySquads.sqf +++ b/helotraining_rewrite.Altis/createEnemySquads.sqf @@ -26,4 +26,6 @@ if (_includeAA) then "O_soldier_AA_F" createUnit [_enemyPosition, _groupEnemy,"",0.75, "CORPORAL"]; }; +diag_log format["createEnemySquad %1 positioned to %2", _groupEnemy, _enemyPosition]; + [_groupEnemy] \ No newline at end of file diff --git a/helotraining_rewrite.Altis/createPickupLZ.sqf b/helotraining_rewrite.Altis/createPickupLZ.sqf index c2607c2..7172c55 100644 --- a/helotraining_rewrite.Altis/createPickupLZ.sqf +++ b/helotraining_rewrite.Altis/createPickupLZ.sqf @@ -45,14 +45,15 @@ if (!(_assignExtra isEqualTo false)) then // PONDER: make a parent task "ferry squad X" ?? private _taskid = format["pickup_%1", lzCounter]; -[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],_lzLocation,"AUTOASSIGNED",1,true, "meet", 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; + -private _handlePickup=false; private _trg = createTrigger["EmptyDetector",getPos _lzLocation, true]; _trg setTriggerArea[lzSize,lzSize,0,false]; _trg setTriggerActivation["WEST","PRESENT",false]; _trg setTriggerTimeout [2.5, 2.5, 2.5, true]; -_trg setTriggerStatements["([thisList] call playerVehicleInListBool)", "_handlePickup = true;", ""]; +_trg setTriggerStatements["([thisList] call playerVehicleInListBool)", "", ""]; // TODO: implement deadline so the task doesn't linger forever @@ -60,16 +61,19 @@ scopeName "main"; while {true} do { scopeName "mainloop"; + diag_log "createPickupLZ: ticking"; if ({alive _x} count units _squad == 0) then { + diag_log format["createPickupLZ: Everyone from %1 is dead!", _squad]; // Everybody died before we got there :( [_taskid, "FAILED" ,true] spawn BIS_fnc_taskSetState; breakOut "mainloop"; }; - if (_handlePickup) then + if (triggerActivated _trg) then { + diag_log format["createPickupLZ: triggedred, loading up %1", _squad]; private _newLZLocation = (lzList - [_lzLocation]) call BIS_fnc_SelectRandom; private _veh = [list _trg] call playerVehicleInList; private _handle = [_veh, _squad, _taskid] spawn loadSquad; @@ -79,7 +83,7 @@ while {true} do waitUntil {isNull _handle}; breakOut "mainloop"; }; - sleep 1; + sleep 2; }; deleteVehicle _trg; diff --git a/helotraining_rewrite.Altis/init.sqf b/helotraining_rewrite.Altis/init.sqf index 583021a..e7ccee2 100644 --- a/helotraining_rewrite.Altis/init.sqf +++ b/helotraining_rewrite.Altis/init.sqf @@ -9,6 +9,7 @@ createSquad = compile preProcessfile "createSquad.sqf"; createEnemySquads = compile preProcessfile "createEnemySquads.sqf"; loadSquad = compile preProcessfile "loadSquad.sqf"; ejectSquad = compile preProcessfile "ejectSquad.sqf"; +spawnSmokeBySquad = compile preProcessfile "spawnSmokeBySquad.sqf"; deleteSquads = compile preProcessfile "deleteSquads.sqf"; playerVehicleInList = compile preProcessfile "playerVehicleInList.sqf"; diff --git a/helotraining_rewrite.Altis/mission.sqm b/helotraining_rewrite.Altis/mission.sqm index ff9cc89..ac300fa 100644 --- a/helotraining_rewrite.Altis/mission.sqm +++ b/helotraining_rewrite.Altis/mission.sqm @@ -16,10 +16,10 @@ class EditorData }; class Camera { - pos[]={14282.739,122.37674,15861.688}; - dir[]={0.084973976,-0.58932984,0.80349606}; - up[]={0.061992381,0.80780429,0.58616567}; - aside[]={0.99452043,2.505476e-007,-0.10517917}; + pos[]={14253.876,161.88496,15821.944}; + dir[]={0.081877343,-0.63147533,0.7711519}; + up[]={0.066685185,0.77530128,0.62804556}; + aside[]={0.99447972,4.1961903e-007,-0.10559266}; }; }; binarizationWanted=0; diff --git a/helotraining_rewrite.Altis/spawnSmokeBySquad.sqf b/helotraining_rewrite.Altis/spawnSmokeBySquad.sqf new file mode 100644 index 0000000..46f00f7 --- /dev/null +++ b/helotraining_rewrite.Altis/spawnSmokeBySquad.sqf @@ -0,0 +1,34 @@ +diag_log format["spawnSmokeBySquad called, _this: %1", _this]; +private _bindToSquad = _this select 0; +private _smokeLozation = _this select 1; +private _smokeColor = _this select 2; + +private _trg = createTrigger["EmptyDetector",getPos _smokeLozation, true]; +_trg setTriggerArea[50,50,0,false]; +_trg setTriggerActivation["WEST","PRESENT",false]; +private _trgCond = format["count (%1 arrayIntersect thisList) > 0", units _squad]; +diag_log format["spawnSmokeBySquad _trgCond: %1", _trgCond]; +_trg setTriggerStatements[_trgCond, "", ""]; + +// TODO: switch color based on arguments +while {triggerActivated _trg} do +{ + _hour = daytime; + if (_hour > 5 && _hour < 19) then + { + _smoke= "SmokeShellGreen" createVehicle _smokeLozation; + sleep 40; + deleteVehicle _smoke; + } + else + { + _chemlight= "Chemlight_green" createVehicle _smokeLozation; + _smoke= "SmokeShellGreen" createVehicle _smokeLozation; + sleep 40; + deleteVehicle _chemlight; + deleteVehicle _smoke; + }; + diag_log format["spawnSmokeBySquad: spawned smoke to %1", _smokeLoc]; +}; +diag_log format["spawnSmokeBySquad done, _this: %1", _this]; +deleteVehicle _trg;