Skip to content

Commit 1e8650c

Browse files
committed
Updated do_halo.sqf
- Player AI Squad now included in HALO
1 parent d4a3160 commit 1e8650c

File tree

1 file changed

+80
-40
lines changed

1 file changed

+80
-40
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,104 @@
1-
private [ "_dialog", "_backpack", "_backpackcontents" ];
1+
private ["_unit_list_halo", "_backpack", "_backpackcontents", "_unit_backpacks"];
22

3-
if ( isNil "GRLIB_last_halo_jump" ) then { GRLIB_last_halo_jump = -6000; };
4-
5-
if ( GRLIB_halo_param > 1 && ( GRLIB_last_halo_jump + ( GRLIB_halo_param * 60 ) ) >= time ) exitWith {
6-
hint format [ localize "STR_HALO_DENIED_COOLDOWN", ceil ( ( ( GRLIB_last_halo_jump + ( GRLIB_halo_param * 60 ) ) - time ) / 60 ) ];
7-
};
8-
9-
_dialog = createDialog "liberation_halo";
103
dojump = 0;
11-
halo_position = getpos player;
12-
134
_backpackcontents = [];
5+
_unit_backpacks = [];
146

15-
[ "halo_map_event", "onMapSingleClick", { halo_position = _pos } ] call BIS_fnc_addStackedEventHandler;
7+
createDialog "liberation_halo";
8+
halo_position = getPosATL player;
169

10+
["halo_map_event", "onMapSingleClick", { halo_position = _pos }] call BIS_fnc_addStackedEventHandler;
1711
"spawn_marker" setMarkerTextLocal (localize "STR_HALO_PARAM");
1812

1913
waitUntil { dialog };
2014
while { dialog && alive player && dojump == 0 } do {
2115
"spawn_marker" setMarkerPosLocal halo_position;
22-
2316
sleep 0.1;
2417
};
2518

26-
if ( dialog ) then {
19+
if (dialog) then {
2720
closeDialog 0;
2821
sleep 0.1;
2922
};
3023

3124
"spawn_marker" setMarkerPosLocal markers_reset;
3225
"spawn_marker" setMarkerTextLocal "";
26+
["halo_map_event", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
27+
28+
if (player distance2D halo_position < 200) exitWith {
29+
hintSilent "Too close to player!";
30+
};
31+
32+
_unit_list_halo = (units group player) select {
33+
!(isPlayer _x) && { alive _x } && { lifestate _x != "INCAPACITATED" } &&
34+
{ isNull objectParent _x } && { _x distance2D player < 50 };
35+
};
36+
37+
hint format ["AI Selected for HALO: %1", count _unit_list_halo];
38+
39+
{
40+
private _unit = _x;
41+
private _unit_backpack = backpack _unit;
42+
private _unit_contents = backpackItems _unit;
43+
44+
if (_unit_backpack != "" && _unit_backpack != "B_Parachute") then {
45+
_unit_backpacks pushBack [_unit, _unit_backpack, _unit_contents];
46+
};
3347

34-
[ "halo_map_event", "onMapSingleClick" ] call BIS_fnc_removeStackedEventHandler;
48+
if (!isNull objectParent _unit) then { moveOut _unit; sleep 0.2; };
49+
removeBackpack _unit;
50+
_unit addBackpack "B_Parachute";
51+
_unit setVelocity [0, 0, 0];
3552

36-
if ( dojump > 0 ) then {
37-
GRLIB_last_halo_jump = time;
38-
halo_position = halo_position getPos [random 250, random 360];
39-
halo_position = [ halo_position select 0, halo_position select 1, GRLIB_halo_altitude + (random 200) ];
40-
halojumping = true;
53+
private _offsetX = random 10 - 5;
54+
private _offsetY = random 10 - 5;
55+
private _newPos = [
56+
(halo_position select 0) + _offsetX,
57+
(halo_position select 1) + _offsetY,
58+
GRLIB_halo_altitude + 200
59+
];
60+
_unit setPosATL _newPos;
61+
sleep 0.2;
62+
} forEach _unit_list_halo;
63+
64+
_backpack = backpack player;
65+
if (_backpack != "" && _backpack != "B_Parachute") then {
66+
_backpackcontents = backpackItems player;
67+
removeBackpack player;
68+
sleep 0.1;
69+
};
70+
player addBackpack "B_Parachute";
71+
player setPosATL [halo_position select 0, halo_position select 1, GRLIB_halo_altitude + 200];
72+
73+
[player, halo_position] remoteExec ["paraDrop", player];
74+
sleep 1;
75+
76+
{
77+
[_x, halo_position] remoteExec ["paraDrop", _x];
78+
sleep 1;
79+
} forEach _unit_list_halo;
80+
81+
waitUntil { !alive player || isTouchingGround player };
82+
sleep 2;
83+
84+
if (_backpack != "" && _backpack != "B_Parachute") then {
85+
removeBackpack player;
4186
sleep 0.1;
42-
cutRsc ["fasttravel", "PLAIN", 1];
43-
playSound "parasound";
44-
sleep 2;
45-
_backpack = backpack player;
46-
if ( _backpack != "" && _backpack != "B_Parachute" ) then {
47-
_backpackcontents = backpackItems player;
48-
removeBackpack player;
87+
player addBackpack _backpack;
88+
clearAllItemsFromBackpack player;
89+
{ player addItemToBackpack _x } foreach _backpackcontents;
90+
};
91+
92+
{
93+
private _unit = _x select 0;
94+
private _saved_backpack = _x select 1;
95+
private _saved_contents = _x select 2;
96+
97+
if (alive _unit) then {
98+
removeBackpack _unit;
4999
sleep 0.1;
100+
_unit addBackpack _saved_backpack;
101+
clearAllItemsFromBackpack _unit;
102+
{ _unit addItemToBackpack _x } forEach _saved_contents;
50103
};
51-
player addBackpack "B_Parachute";
52-
53-
player setpos halo_position;
54-
55-
sleep 4;
56-
halojumping = false;
57-
waitUntil { !alive player || isTouchingGround player };
58-
if ( _backpack != "" && _backpack != "B_Parachute" ) then {
59-
sleep 2;
60-
player addBackpack _backpack;
61-
clearAllItemsFromBackpack player;
62-
{ player addItemToBackpack _x } foreach _backpackcontents;
63-
};
64-
};
104+
} forEach _unit_backpacks;

0 commit comments

Comments
 (0)