genesis92x / VcomAI-3.0

Vcom AI 3.0
75 stars 39 forks source link

VCOM AI sniper engage #149

Open joeyo123 opened 5 years ago

joeyo123 commented 5 years ago

Describe the bug Receiving an error message when the special ai setting for marksmen/snipers is enabled; the error message "Error undefined variable in expression: vcm_fnc_sniperengage" is shown To Reproduce Steps to reproduce the behavior:

  1. Turn on vcom ai sniper setting
  2. tell them to engage a target (with zeus or something similar)
  3. error pops up

Expected behavior Well i supposed the specific ai setting for sniper ai would mean they would stay where they are and engage from a long distance rather than do what regular ai do and flank/assault the enemy position

Screenshots https://steamcommunity.com/sharedfiles/filedetails/?id=1850860673

VCOM Version: current updated steam version

Additional mods used: bug was able to be replicated on vanilla arma 3 (only vcom installed)

Additional context Add any other context about the problem here.

GoldJohnKing commented 4 years ago

I'm using 3.3.3-develop branch script version downloaded from github, I got more detailed information about sniper engage bug.

The First error I encounter:

11:38:51 Error in expression <etSkill 0.9;
_x allowFleeing 0;          
{
_x setSkill _x;
} forEach VCM_AIDIFA;

if >
11:38:51   Error position: <setSkill _x;
} forEach VCM_AIDIFA;

if >
11:38:51   Error setskill: type array,Object expected
11:38:51 File Vcom\Functions\VCM_Functions\fn_SniperEngage.sqf [VCM_fnc_SniperEngage]..., line 53

https://github.com/genesis92x/VcomAI-3.0/blob/6bd9aaefe3c93d41218473c8e47faacd06b7f2ac/Vcom/Functions/VCM_Functions/fn_SniperEngage.sqf#L52-L54

This error was caused by Magical Value _x, the first and the second _x are all entities of "VCM_AIDIFA" instead of first "_x"=="_Snipers" and second "_x"=="VCM_AIDIFA". You cannot use _x in multiple forEach like this.

So I use solid values

_x setSkill ["aimingShake",0.1];
_x setSkill ["aimingSpeed",0.75];
_x setSkill ["aimingAccuracy",0.8];

to replace the original one

{
    _x setSkill _x;
} forEach VCM_AIDIFA;

and the error solved. You might have a better solution.

After I overided above function to make it correct, the next error shows up:

13:00:10   Error position: <forceWeaponFire [ primaryWeapon _x,(sele>
13:00:10   Error Type Any, String Expected
13:00:10 File Vcom\Functions\VCM_Functions\fn_SniperEngage.sqf [VCM_fnc_SniperEngage]..., line 80

https://github.com/genesis92x/VcomAI-3.0/blob/6bd9aaefe3c93d41218473c8e47faacd06b7f2ac/Vcom/Functions/VCM_Functions/fn_SniperEngage.sqf#L80

I'm not sure what caused the second error, so I just deleted that line.

Then I start a mission and during init process, this error pops up:

14:50:16   Error position: <_x spawn {sleep 2;if !(unitPos _this isE>
14:50:16   Error missing;
14:50:16 File Vcom\Functions\VCM_Functions\fn_SniperEngage.sqf [VCM_fnc_SniperEngage]..., line 81

https://github.com/genesis92x/VcomAI-3.0/blob/6bd9aaefe3c93d41218473c8e47faacd06b7f2ac/Vcom/Functions/VCM_Functions/fn_SniperEngage.sqf#L81

I dont know about this at all... So I submit the reply tohelp you developers have a more detailed information about sniper engage issue than the issue poster's.

The development of sniper engage function is still in a very early stage, I suggest users who read this issue to disable that function until further changes.