Jump to content
Sign in to follow this  
Lucky44

How to immobilize a player unit during an animation ???

Recommended Posts

I've searched high and low and can't find anything on this.

I'm trying to make sure that a player who's performing a certain Action (via an addAction that puts the player into a Move animation) can't walk away in the middle of the animation.

I thought the player was locked out of control of movement like that, but apparently not. Is there a way to make sure the player must stay put through the duration of the animation/Move?

EDIT: OK, more tests are needed. It seems to lock the player into the animation automatically now. I am going to have to figure out what happened on the other time I tested it and it let me move. I'll get back about this.

Edited by Lucky44

Share this post


Link to post
Share on other sites

while {animationstate player == YOUR ANIMATION} do {
    player enableSimulation false;
} else {
    player enableSimulation true;
};

not sure if you can have an else in a while loop, but give it a try

Share this post


Link to post
Share on other sites

If you need the player to stay in one place have a loop in the script with a suitable condition e.g. the one above (not just true so it stops when you want it to):

while {true} do {

player setVelocity [0,0,0];

sleep 0.1;

};

even pressing the movement keys will do nothing, he will stay in the same spot.

Share this post


Link to post
Share on other sites

Thanks, folks. Appreciated.

I think the animation/move itself will disable the keyboard commands. I just haven't figured out why it didn't that one time I was testing it...probably just an anomalous bug.

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  

×