Jump to content
Sign in to follow this  
Ghosthawk

How to make AI playing animations?

Recommended Posts

Hi,

I am just playing around with some animations but don't get all of them to work:

I want to have a AI repairing a wheel of a vehicle.

I know how it would work to create a hostage:

1. Name Unit hostage

2. put this in a trigger: hostage playMove "AmovPercMstpSsurWnonDnon"; hostage disableAI "ANIM";

But this animation to repair a car does not work:

man playAction "Acts_carFixingWheel";

Could someone help me?

Share this post


Link to post
Share on other sites

Try:

[unit, "REPAIR_VEH_KNEEL", "ASIS"] call BIS_fnc_ambientAnim;

I have also noticed that many animations don't work anymore since patch 1.02. I'm running the dev branch and hope for a fix soon.

Share this post


Link to post
Share on other sites
Try:

[unit, "REPAIR_VEH_KNEEL", "ASIS"] call BIS_fnc_ambientAnim;

I have also noticed that many animations don't work anymore since patch 1.02. I'm running the dev branch and hope for a fix soon.

Thank you very much, it works!

Do you have a list or something with these animations?

I would like to add more stuff like that to my missions to make everything look nicer.

Share this post


Link to post
Share on other sites

If you want to check the animation list ingame you can use the functions viewer in the editor (icon somewhere in the top-bar) and open up the function (category A3 -> ambient, i think).

Share this post


Link to post
Share on other sites

Thank you very much. I will check this out!

Ok. The example with the chair works.

But how do i know what belongs into the red field?

[unit, "REPAIR_VEH_KNEEL", "ASIS"] call BIS_fnc_ambientAnim;

Edited by Ghosthawk

Share this post


Link to post
Share on other sites

So are playMove and switchMove etc. being fazed out?? Is there a biki on this function or related functions? I never know when when I should or shouldn't be using old calls.

Share this post


Link to post
Share on other sites

GhostHawk,

In the functions viewer (go to editor) look up ambientAnim or ambientAnimcombat

there will be a section that looks like this

 STRING - equipment level id, describing how heavily is the unit equipped.
      > "NONE"          - no goggles, headgear, vest, weapon
      > "LIGHT"          - no goggles, headgear, vest
      > "MEDIUM"         - no goggles, headgear
      > "FULL"          - full gear = no touches 
     > "RANDOM" (default)    - gear is randomized according to the animation set
      [color=#ff0000]> "ASIS"          - Leave unit gear as it was when unit spawned
[/color][color=#0000ff](I added this last one as I copied from a reference I had without having to open the game)[/color][color=#ff0000][/color]

It may have a few extra options, but its done so that a unit with an rpg doesn't sit in a chair with the launcher clipping through it.

@Icono - I don't think so but these are easier to use and simpler to set up without having to worry about the transitions and timing the actual animation names.

Share this post


Link to post
Share on other sites
@Icono - I don't think so but these are easier to use and simpler to set up without having to worry about the transitions and timing the actual animation names.

Also, the BIS_fnc_ambientAnim and BIS_fnc_ambientAnimCombat are used to -as the name says- enhance the atmosphere here and there. It is quite useful for making camps or backround stuff for cutscenes. But it works as a loop, so the unit will do the same (set of) animation/s over and over again. If you want to play some specific animation just once you still have to use the "old" way. Sadly, there is no easy BIS-Function for that (afaik) though it would be useful. But as i said before some animations seem to be broken, at least in my missions the cutscenes are ruined since the last patch.

Share this post


Link to post
Share on other sites
GhostHawk,

In the functions viewer (go to editor) look up ambientAnim or ambientAnimcombat

there will be a section that looks like this

 STRING - equipment level id, describing how heavily is the unit equipped.
      > "NONE"          - no goggles, headgear, vest, weapon
      > "LIGHT"          - no goggles, headgear, vest
      > "MEDIUM"         - no goggles, headgear
      > "FULL"          - full gear = no touches 
     > "RANDOM" (default)    - gear is randomized according to the animation set
      [color=#ff0000]> "ASIS"          - Leave unit gear as it was when unit spawned
[/color][color=#0000ff](I added this last one as I copied from a reference I had without having to open the game)[/color][color=#ff0000][/color]

It may have a few extra options, but its done so that a unit with an rpg doesn't sit in a chair with the launcher clipping through it.

@Icono - I don't think so but these are easier to use and simpler to set up without having to worry about the transitions and timing the actual animation names.

Thanks!

Share this post


Link to post
Share on other sites

The problem I have with the Functions viewer for any code you want, including animations, is that is has NO Freaking direction on how to implement it into the mission.

It will give you the code for the movements, but explains NOTHING on how to use it.

So, I have to come here (not a complaint) to learn how from kevsnotrev or IndeedPete.

Why the HELL don't they explain it a bit more with examples like this:

"here is the animation code"

"here is example of how to use it, either in unit or trigger"

(explained in a bit of detail so I don't have to ask 5000 times on this forum for a simple answer...........:936:

Share this post


Link to post
Share on other sites

My test mission in my signature is just done by putting the command in the units init.

Haven't had time to test out any other Method to start up the animation.

Might give that a go on a trigger tomorrow morning. I also have to figure out how to stop these animations or loop them add some are really short.

---------- Post added at 17:12 ---------- Previous post was at 17:07 ----------

My phone is playing up I can't get sig to show. Will have to link later (at work)

Edited by KevsnoTrev

Share this post


Link to post
Share on other sites

@Kommiekat: Well, once you understood the principle it is basically the same for every function. They're all called like:

[param1, param2, ...] call BIS_fnc_someFunction;

And if you expect some return value then

whichGuy = ["Peter", "Jack", "Franky the Melon"] call BIS_fnc_selectRandom;

It doesn't matter if they're called from init line, trigger or script. However, i've had problems when it comes to using my own functions in triggers or init lines (but not in scripts) which contained sleep commands. In that case i used:

nul = [blah1, blah2] spawn IP_someFunction;

Apart from that the functions viewer helps you to get and overview of the available functions, get the parameters right and you gain access to the function's source code, so you can change it or use parts of it for your own stuff.

@KevsnoTrev: See Cobra's last post in this thread if you're using BIS_fnc_ambientAnim or use your own condition to end it if you're using BIS_fnc_ambientAnimCombat:

[someGuy, "SIT_LOW", "ASIS", [color="#FF0000"]{player distance someGuy < 5}[/color], "AWARE"] call BIS_fnc_ambientAnimCombat;

Share this post


Link to post
Share on other sites
@KevsnoTrev: See Cobra's last post in this thread if you're using BIS_fnc_ambientAnim or use your own condition to end it if you're using BIS_fnc_ambientAnimCombat:
[someGuy, "SIT_LOW", "ASIS", {player distance someGuy < 5}, "AWARE"] call BIS_fnc_ambientAnimCombat;

Thanks IndeedPete, that will most definitely help. I will update mission with that info from Cobra also.

I am aware of the parameter to take the unit from ambientanimcombat - I am working on a combination of knowsabout and neartargets to make it seems like they have detected the player, but its taking some time.

They see me then do nothing then they know about me as some other guy sees me but they don't see me and know about me at the same time, its frustrating.

At least they don't shoot me at 1000m.....;-)

Share this post


Link to post
Share on other sites

If they're hostile already you can just leave the condition as the function will handle that by itself. I don't know how exactly but i've experienced that they got up automatically as they noticed the enemy (me).

Share this post


Link to post
Share on other sites

funny i haven't actually put hostiles in the animation as yet.

I just found "BIS_fnc_ambientAnim__terminate" in the fn_ambientAnim.sqf - it will end the animation (like Cobra said in the other thread) and it removes eventhandlers etc to clean up nicely. can be used on single unit or array of units.

It does not do it smooth, it just jumps the unit to standing and they stand there dumbfounded like they woke from a great sleep.

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
Sign in to follow this  

×