Jump to content
lexx

Animation issues

Recommended Posts

Out of curiosity... Or rather, "what's the trick"?

 

If I say...

X switchMove "Acts_welcomeOnHUB02_AIWalk";

... the NPC starts moving... but in this case, he stops once the animation is done.

This is something that doesn't happen with some other animations.. I don't know why that is, though, and I am wondering if there's a way around it.. Tried to get through the A3 campaign scripts, to see how they did it, but as a non-programmer, this is some serious labyrinth.

 

I know there are workarounds with anim event handler, etc. but from my experience, this never gives a good result. You always see the animation stopping for a brief moment on switch, which is ugly. I'd rather have the game connect the animations by itself.

 

In the example above, the next animation in line would be "Acts_welcomeOnHUB02_AIWalk_2", which is even in the "ConnectTo[] =" mentioned... yet it does not seems to want to continue on its own.

 

Can I make the animations "connect" myself with a class copy in the addon config.cfg file and setting whatever value? Or is this maybe in the animation file itself?

It's kinda driving me crazy (again.. as always), because I just can't see the logic in it.

Share this post


Link to post
Share on other sites

Yes, but this won't play the hub animations. I'm certain switchMove is the right thing to do here, it's just that the animation stops and doesn't go over into the next one. If we take "Acts_Ending_Adams1" as example, it works-- once x1 is done, it automatically goes over into x2, x3, etc. exactly how it should be.

 

Either I have missed something, or I can't see a difference in their config file entries either. So tl;dr - this whole thing is a mystery to me.

Share this post


Link to post
Share on other sites

Hey Lexx.  If you have a series of animations you want to play one after the other, the animDone  eventhandler may help.  You switchmove the first animation, and create an animDone EH on the unit that switchmoves the next animation when first one done.

 

Not sure if it will be smooth or not, but its worth a try.  Good luck dude.

Share this post


Link to post
Share on other sites

Yeah, but like I wrote in the first post, that's what I have made only bad experiences with. You always see the first animation stop for a moment until the next animation starts, etc. This is ugly. Not to forget the amount of bloat code you generate with this.

 

Besides, I honestly don't believe that this is how it was done in the vanilla campaign. In fact, I am forcing myself through the files for a while now, and I really can't see what they made so specifically different.

Here's an example:

In cfgHubs.hpp the animation, sentence block, etc. is defined. initHubIntro2.sqf will then play this, which looks like this:

Start:


    {_gUnit disableAI _x} forEach ["ANIM","AUTOTARGET","FSM","MOVE","TARGET"];

    _gUnit enableSimulation false;
    _pUnit enableSimulation false;

    _gUnit switchMove "";
    _pUnit switchMove "";

 

Then some other stuff, then we play the animation:


    _pUnit setpos _pPos;
    _pUnit setdir _pDir;
    (group _pUnit) setFormDir _pDir;

    _gUnit setpos _gPos;
    _gUnit setdir _gDir;
    (group _gUnit) setFormDir _gDir;

    {_gUnit disableAI _x} forEach ["AUTOTARGET","MOVE","TARGET"];
    {_gUnit enableAI _x} forEach ["ANIM","FSM"];

    //set guide behaviour to "CARELESS"
    (group _gUnit) setBehaviour "CARELESS";
    (group _gUnit) setCombatMode "BLUE";

    _pUnit switchMove _pAnim;
    _gUnit switchMove _gAnim;

    _gUnit enableSimulation true;
    _pUnit enableSimulation true;

    _gUnit kbAddTopic [_topic,_bikb,""];
    _pUnit kbAddTopic [_topic,_bikb,""];

 

_pUnit is the player, while _gUnit is the guide. There is *nothing* in that code that I have done much different, yet my critter (guide) animation stops at the end, while in the vanilla campaign it continues without issues.

 

And that's exactly what I don't understand.

 

 

/edit: Oh my fucking god, I did it. Who the hell *ever* would have thought that you have to set the unit to *careless* for it to work... this is just so very, very not obvious, and I think I've never read about anyone ever writing that anywhere. Set the unit to careless and the animation plays through, don't do this and the animation will stop...

Share this post


Link to post
Share on other sites

I don't know how BIS does it, and I see your point.  Why do the extra work, when there should be a way to flow the animations....

 

However, I just created a test mission with a player and  guy named "dude" in front of him.  Via the console I executed the two statements below, and it performed as desired (both anims ran sequentially and looked smooth).  Try it out.

dude switchMove "Acts_welcomeOnHUB02_AIWalk"; 
dude addEventHandler ["AnimDone",{hint "2nd move playing"; dude switchMove "Acts_welcomeOnHUB02_AIWalk_2"}];

 

Share this post


Link to post
Share on other sites

I've just edited my post with the solution.

Thanks for rubber ducking me, though. If I hadn't ranted on like above, I probably wouldn't have found out about it now...

  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, lexx said:

I've just edited my post with the solution.

Thanks for rubber ducking me, though. If I hadn't ranted on like above, I probably wouldn't have found out about it now...

Glad to help man.  I got a chuckle out of "rubber ducking" as I had to google it to understand it.  :)

Share this post


Link to post
Share on other sites

Some of those animations like walking, you can disableAI "ANIM" on the unit first, then do the switchMove. They will remain in that animation until you free them. But not always, such as the car repair animation is an exception. The event handler works well too, especially if you want a sequence of animations.

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

×