Jump to content

Recommended Posts

Hi there...

 

I tried to script a mission where the ai stand next to the player and execute an specific animation. When this animation is done the ai should execute another animation and so on and on...

 

I tried these lines but between the second and third animation the ai get back into the normal animation and it is not smooth enough between the second and third animation. I hope everybody understands what I mean :)

 

 

         anima5 = [] spawn {
    
    a5 switchmove "Acts_AidlPercMstpSnonWnonDnon_warmup_3_loop";
    animLoop = a5 addEventHandler ["AnimDone", {
        a5 switchMove "Acts_AidlPercMstpSnonWnonDnon_warmup_3_out"
     }];
};

 

 

...//here are some more lines in the script//...

 

 

        anima5 = [] spawn {
    
    a5 switchmove "Acts_ShowingTheRightWay_in";
    animLoop = a5 addEventHandler ["AnimDone", {
        a5 switchMove "Acts_ShowingTheRightWay_loop"
     }];
};

 

 

 

Share this post


Link to post
Share on other sites

You can use the following to stop normal animations from kicking in:

a5 disableAI "ANIM";

Then only the animations you play via switchMove, playMove or playAction will animate the unit.  If you need the unit to return to normal behavior and animation at the end of your script, you can do this:

a5 enableAI "ANIM";

Good luck and enjoy!

  • Like 2

Share this post


Link to post
Share on other sites

I already had this in my script

 

    [a5,"STAND","FULL",{(player distance _this) < 5}] call BIS_fnc_ambientAnim; 
    a5 disableAi "MOVE"; a5 disableAi "ANIM"; a5 allowDamage false;

Share this post


Link to post
Share on other sites

If you want smooth transitions, use playMove and/or playAction. Using switchMove skips any transitions. Also, for playMove and playAction to work as expected (with smooth transitions), the animation states must be linked together in the config. Certain animation states are not linked in this way and thus you must use switchMove for unit to perform them, and thus there will be no transition in these cases.

  • Like 1

Share this post


Link to post
Share on other sites

OK. Can you tell me how it should look like. I have no idea how to write this in a config file.

The idea is that a soldier stands right next to the player with this animation (Acts_AidlPercMstpSnonWnonDnon_warmup_3_loop). After some time he should switch to this animation (Acts_AidlPercMstpSnonWnonDnon_warmup_3_out) and smoothly in the next two (Acts_ShowingTheRightWay_in/Acts_ShowingTheRightWay_loop).

Share this post


Link to post
Share on other sites
2 hours ago, Kalle Arsch said:

OK. Can you tell me how it should look like. I have no idea how to write this in a config file.

The idea is that a soldier stands right next to the player with this animation (Acts_AidlPercMstpSnonWnonDnon_warmup_3_loop). After some time he should switch to this animation (Acts_AidlPercMstpSnonWnonDnon_warmup_3_out) and smoothly in the next two (Acts_ShowingTheRightWay_in/Acts_ShowingTheRightWay_loop).

 

First you could check whether your 4 desired animations are already "connected" with the normal movement states in the config (and each other).  In your "init.sqf", try something like this:

sleep 1;
systemChat "Anim 1";
a5 playMove "Acts_AidlPercMstpSnonWnonDnon_warmup_3_loop";
sleep 5;
systemChat "Anim 2";
a5 playMove "Acts_AidlPercMstpSnonWnonDnon_warmup_3_out";
sleep 5;
systemChat "Anim 3";
a5 playMove "Acts_ShowingTheRightWay_in";
sleep 5;
systemChat "Anim 4";
a5 playMove "Acts_ShowingTheRightWay_loop";

Run that and see if your man plays all the desired animations.  If he does, that's great & means they are already "connected".  If not, you'll probably need to make an addon.

 

Share this post


Link to post
Share on other sites

The animations don't work with playMove...

 

They are all original from the game and work with the switchMove command. I only want to put it smoothly together.

So why I had to make an addon??

Share this post


Link to post
Share on other sites

My opinion is just do what MadRussian said using switchMove instead (since they don't work with playMove).  The only issue is that when transitioning from one animation to the other it is abrupt, but there is no getting around that.

  • Like 1

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

×