Skip to content

Commit

Permalink
Fixed bugged state AI are in after using TakeWeapon
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 committed May 29, 2024
1 parent 8e0e0c6 commit 0209029
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions addons/hitreactions/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@
(_this select 1) call CBA_fnc_removePerFrameHandler;

_unit action ["TakeWeapon", _thrownWeapon, _weapon];

// "TakeWeapon" action bugs out unit where they don't switch weapons
// Resetting loadout fixes bugged state
[{
(_this select 0) hasWeapon (_this select 1)
}, {
(_this select 0) setUnitLoadout getUnitLoadout (_this select 0);
}, [_unit, _weapon], 5] call CBA_fnc_waitUntilAndExecute;
}, 5, _this] call CBA_fnc_addPerFrameHandler;
}, [_unit, _weapon, _thrownWeapon, CBA_missionTime + 300], random [2, 3, 4]] call CBA_fnc_waitAndExecute;
}] call CBA_fnc_addEventHandler;

0 comments on commit 0209029

Please sign in to comment.