__state [framenumber, functiontothink];
is very messy if you have many animation,you need to spend a lot of time to do this
2)Hexen 2 style
__state [++ firstframe .. lastframe];
idk how its works,but it seems better then quake style
3)by nexttink and think
Code: Select all
void()Draw=
{
if(self.weaponframe == 15)
{
W_SetCurrentAmmo();
self.state = NONE;
return;
}
self.weaponframe += 1;
self.think = Draw;
self.nextthink = time + 0.1;
}
4)maybe best(or not?) way,i found on this forum
Code: Select all
void() player_reload1 = [$reload1, player_reload2] {self.weaponframe = 10;}; //Replace 10 with your start frame.
void() player_reload2 = [$reload2, player_reload3] {self.weaponframe = (self.weaponframe + 1);}; //This advances the frame count by 1.
void() player_reload3 =
{
if(self.weaponframe == 17) //If the animation has reached its end....
{
self.weaponframe = 0; //Set the frame back to the idle frame.
return; //Exit this function.
}
else //If the animation still has some frames left to play...
{
player_reload2(); //Continue the animation..
return; //Exit this function.
}
};