genesis92x / VcomAI-3.0

Vcom AI 3.0
75 stars 39 forks source link

AI sometimes do not react when loaded in vehicles VCOM MOD 3.3.3 steam version #150

Open Explodie opened 5 years ago

Explodie commented 5 years ago

Describe the bug I have found that fairly frequently AI just sit around waiting to die instead of disembarking a vehicle under fire. Noted at same time in the logs is this:

22:12:17 Error in expression <_ClstEmy; private _DisembarkLocation1 = getPosWorld _nearestFriend;

if (_Disemb> 22:12:17 Error position: <getPosWorld _nearestFriend;

if (_Disemb> 22:12:17 Error getposworld: Type Array, expected Object 22:12:17 File \vcomai\Vcom\Functions\VCM_Functions\fn_VehicleMove.sqf [VCM_fnc..., line 34

To Reproduce Almost every time you attack a vehicle loaded with AI - can shoot them they sit calm in the vehicle waiting to die.

Expected behavior AI should react to being under fire, and if vehicle is stationary they should disembark.

VCOM Version:

Additional mods used:

POSSIBLY FIXED

in fn_VehicleMove.sqf

find: private _DisembarkLocation1 = getPosWorld _nearestFriend;

replace with:

    private _allZeros = [0,0,0];
    if (_nearestFriend isEqualTo _allZeros) exitWith {};

    private _DisembarkLocation1 = getPosWorld _nearestFriend;

This has stopped the error from appearing in my log files and fixed the behavior of the AI. I believe the change I've made was the original intention of the code, it's just that the getPosWorld in fn_VehicleMove.sqf did not like being fed an array (ie _rtrn = [0,0,0]) as populated in VCM_fnc_ClstEmy if there's nobody near.

PS: if this is already fixed in DEV then my bad... if not then I hope this helps!