Jump to content
Sign in to follow this  
M.Evans

Return from Script (loop problem) disable script

Recommended Posts

One of my fellow members is having a problem with a simple animation script. And we do not know how to fix this problem. The situation we are trying to accomplish is in the action menu be able to select the choice "at ease" and the animation will play, and then hit another choice "return" which will return you to regular standing. (this is a player thing) not an AI issue

1st script (at ease)

player playmove "AMOVPERCMSTPSNONWNONDNON_EASEIN";

player playmove "AMOVPERCMSTPSNONWNONDNON_EASE";

#Update

player playmove "AMOVPERCMSTPSNONWNONDNON_EASE";

player disableAI "ANIM";

goto "Update";

second script (return script)

player switchmove "AMOVPERCMSTPSNONWNONDNON_EASEOUT";

atease.sqs = 0;

Main problem we are having with this is that once in the at ease, state, we will get stuck and cannot get out of the animation. Any suggestions?

Share this post


Link to post
Share on other sites

disableAI is not working for players, only AI units, so delete that.

this is the problem, it runs the at ease animation in a neverending loop.

#Update
player playmove "AMOVPERCMSTPSNONWNONDNON_EASE";
goto "Update";

break it off with a condition of some sort.

im going to switch it to sqf format, wich makes a difference in how you execute it, instead of exec you use execVM, and the scriptname is .sqf not .sqs.

player playmove "AMOVPERCMSTPSNONWNONDNON_EASEIN";
player playmove "AMOVPERCMSTPSNONWNONDNON_EASE";

_EaseIn = true;
while {_EaseIn} do {
player playmove "AMOVPERCMSTPSNONWNONDNON_EASE";
if (player getVariable ["easeOut", false]) then {
	_EaseIn = false;
	hint "set to false";
};
sleep 0.01;
};
player switchmove "AMOVPERCMSTPSNONWNONDNON_EASEOUT";

and when you want to ease out / end the above animation do this:

player setVariable ["easeOut", true, true];

for example in a easeout action.

Also a second note, im pretty sure there is a animation for at ease and hold pose.

or you can search for animationstate and use waituntil the getVariable instead of looping the animation.

Edited by Demonized
removed disableAI "anim", since it has no function on players.

Share this post


Link to post
Share on other sites

So what the problem is, now we have the player able to do the animation but he will not stay in that position, he is just on a timer until the animation is done. so we need it to stay in that animation until we click another button that tells him to get out of the animation.

Share this post


Link to post
Share on other sites

i tested what i posted, player stand still with hands on back, when i pressed the radio trigger wich assigned the variable to me i eased out and could move again...

Share this post


Link to post
Share on other sites

nah it doesnt wrk, the guy will keep moving his arms back and forth, and when you hit return, you can no longer re enter the at ease position.

Share this post


Link to post
Share on other sites
nah it doesnt wrk, the guy will keep moving his arms back and forth, and when you hit return, you can no longer re enter the at ease position.

you are doing something else wrong, i retested, working.

is the sleep set to 0.01?

anyway, do exactly as above and it works.

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  

×