here is a animation script to loop a animation x amount of times before letting the animation continue. this is untested as I am getting ready for work let me know if there are any issues.
so usage is simple just call the command then how many frames back you want to go from the called command then the limit before it continues the animation. Remember to set the max mp as some point in the animation. if you leave the limit blank it will loop forever. remember to use "loopOn" at the start of the animation and "loopOff" at the end.
example:
Code:
void loopFrame (int moveback, int limit)
{//fixed loop script by msmalik681
void self = getlocalvar("self"); //get caller
int frame = getentityproperty(self, "animpos"); //get current frame position
int counter = getentityvar(self,"counter"); //get the counter.
if(limit == NULL())
{
updateframe(self, frame - moveback);
}
else if(counter < limit)
{
setentityvar(self,"counter", 1 + counter); // increment counter
updateframe(self, frame-moveback); //move back to set frame
}
else { setentityvar(self,"counter", 0); } //reset loop counter
}
void loopOn ()
{
void self = getlocalvar("self"); //get caller
setentityvar(self,"counter", 0); // reset counter
}
void loopOff ()
{
void self = getlocalvar("self"); //get caller
setentityvar(self,"counter", NULL()); // null counter
}
so usage is simple just call the command then how many frames back you want to go from the called command then the limit before it continues the animation. Remember to set the max mp as some point in the animation. if you leave the limit blank it will loop forever. remember to use "loopOn" at the start of the animation and "loopOff" at the end.
example:
Code:
anim idle
loop 0
delay 10
offset 71 300
bbox 27 33 108 256
@cmd loopOn
frame data/chars/Hero/idle_00
frame data/chars/Hero/idle_01
frame data/chars/Hero/idle_02
frame data/chars/Hero/idle_03
@cmd loopFrame 3 30
#this will loop back to idle_01 30 times.
frame data/chars/Hero/idle_04
frame data/chars/Hero/idle_03
frame data/chars/Hero/idle_02
frame data/chars/Hero/idle_01
@cmd loopFrame 2
#this will loop back to idle_02 continuously.
@cmd loopOff
#it will never reach this command but you should have this at the end.
frame data/chars/Hero/idle_00