Skip to content

Commit aa7ccfa

Browse files
authored
Tweaked autocombat
1 parent 3df12b5 commit aa7ccfa

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

addons/AIO_AIMENU/setBehaviour.sqf

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ switch (_mode) do
121121
for "_i" from 0 to ((count _units) -1) do
122122
{
123123
_unit = _units select _i;
124-
_unit disableAI "TARGET";
125124
_unit disableAI "AUTOTARGET";
125+
_unit disableAI "AUTOCOMBAT";
126126
_unit doWatch objNull;
127127
_unit doTarget objNull;
128128
};
@@ -132,17 +132,19 @@ switch (_mode) do
132132
_behav set [_i, (behaviour (_units select _i))];
133133
};
134134

135-
private _remUnits = _units;
136-
private _delUnits = [];
137135
_commStr = ["Cancel target.", "Disengage.", "Ignore all targets.", "Fire at my targets only.", "I'll call the targets."];
138136
player groupChat (selectRandom _commStr);
139137
AIO_targetting_disabled = true;
138+
[_units, _behav] spawn {
139+
params ["_units","_behav"];
140+
private _remUnits = _units;
141+
private _delUnits = [];
140142
while {count _remUnits != 0 && AIO_targetting_disabled} do {
141143
for "_i" from 0 to (count _units) do
142144
{
143145
if (!(alive (_units select _i)) OR (behaviour (_units select _i) == "COMBAT") OR (behaviour (_units select _i) != (_behav select _i))) then
144146
{
145-
(_units select _i) enableAI "TARGET";
147+
(_units select _i) enableAI "AUTOCOMBAT";
146148
(_units select _i) enableAI "AUTOTARGET";
147149
_delUnits = _delUnits + [(_units select _i)];
148150
};
@@ -152,18 +154,19 @@ switch (_mode) do
152154
};
153155
_commStr = ["Check for targets.", "Auto-targetting allowed.", "Target the enemy at will."];
154156
player groupChat (selectRandom _commStr);
157+
};
155158
};
156159
case 4:
157160
{
161+
AIO_targetting_disabled = false;
158162
for "_i" from 0 to ((count _units) -1) do
159163
{
160164
_unit = _units select _i;
161-
_unit enableAI "TARGET";
165+
_unit enableAI "AUTOCOMBAT";
162166
_unit enableAI "AUTOTARGET";
163167
};
164168
_commStr = ["Check for targets.", "Auto-targetting allowed.", "Target the enemy at will."];
165169
player groupChat (selectRandom _commStr);
166-
AIO_targetting_disabled = false;
167170
};
168171
case 5:
169172
{

0 commit comments

Comments
 (0)