Jump to content
QuiveringT

AI Loses Their Weapon When Animation Cancels

Recommended Posts

I am using this code to make an AI look like he is repairing a radio tower (found here: https://community.bistudio.com/wiki/BIS_fnc_ambientAnim), however, he loses his primary weapon upon animation canceling:

[this,"REPAIR_VEH_KNEEL", "ASIS"] call BIS_fnc_ambientAnim; 
0 = this spawn {waitUntil {behaviour _this == "combat"}; 
 _this call BIS_fnc_ambientAnim__terminate;}

This solves a previous problem I was having about AI not canceling their animations when their group enters combat. However, now that I can successfully get the AI to enter combat with the rest of their group, specifically the "REPAIR_VEH_x" animations cause the AI to lose their main weapon. As you can probably guess, this is quite the issue. I am using modded loadouts, but I have also tested it with vanilla loadouts.

 

What is the best way to solve this?

 

@pierremgi Since you literally wrote the code found on the wiki, do you have any suggestions?

Share this post


Link to post
Share on other sites

Yep! It seems the BI function is half-coded for that.

 

Replace by:

[this,"REPAIR_VEH_KNEEL", "ASIS"] call BIS_fnc_ambientAnim;  
0 = this spawn {waitUntil {behaviour _this == "combat"}; _this addWeapon (_this getVariable ["BIS_fnc_ambientAnim__weapon",nil]);
 _this call BIS_fnc_ambientAnim__terminate;}

 

Don't forget, it's double underscore each time for bis_fnc_ambientAnim__something

Share this post


Link to post
Share on other sites
12 hours ago, pierremgi said:

Yep! It seems the BI function is half-coded for that.

 

Replace by:

[this,"REPAIR_VEH_KNEEL", "ASIS"] call BIS_fnc_ambientAnim;  
0 = this spawn {waitUntil {behaviour _this == "combat"}; _this addWeapon (_this getVariable ["BIS_fnc_ambientAnim__weapon",nil]);
 _this call BIS_fnc_ambientAnim__terminate;}

 

Don't forget, it's double underscore each time for bis_fnc_ambientAnim__something

 

Thanks for that, this does work, but now the rifleman doesn't spawn with his silencer (he has one in the editor). presumably, he also will be missing his scope if he had one. Can you update your code for this?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×