Alternative idle when there is a few MP

16-bit Fighter

Active member
I wonder how to make a char change his MP when it's under a certain number. The best I have been able to do is :

Code:
anim idle
	@script
    	       void self = getlocalvar("self");
     	       if (getentityproperty(self,"mp")<10)
{ 
		setidle (self, openborconstant("ANI_FOLLOW1"));
     	       }
	@end_script

It works but the problem is that in the Follow1 anim just the first frame is played (of course until MP is egal or over 10), so there is no loop with the other frames. Moreover, I'd prefer to create a function. I tried in the file animationscript with a function I call in the idle anim of the char but in this case, nothing happens. Here are the function I created:

Code:
void mpidle ( int Cost)
{
    void self = getlocalvar("self");
    void MP = getentityproperty(self,"mp");
    if(MP<Cost)
   {
	setidle (self, openborconstant("ANI_FOLLOW1"));
	}
}

Thanks in advance for any help!
 
Hi 16-bit Fighter!

I made some tests and I think that this script can help you.

Here is the function in animation script:
Code:
void aniMp(void ani, int limit, int type)
{//Execute defined animation with MP check
 //Type 1: less than limit
 //Type 2: more than limit, reset to normal idle animation
	void self = getlocalvar("self");
	int mp 	  = getentityproperty(self, "mp");

	if(type == 1){
		if(mp < limit){
			executeanimation(self, openborconstant(ani), 1);
		}
	}
	
	if(type == 2){
		if(mp > limit){
			setidle(self, openborconstant(ani));
		}
	}
}

Here is the character animation. Note that you will need to set the command "idle 1", that allow follow4 animation works like a idle animation and can be interrupted by key inputs, just like in IDLE animation.
Code:
anim idle
	loop	1
	delay	16
	offset	62 126
	bbox 	50 55 23 74
	@cmd aniMp "ANI_FOLLOW4" 40 1
	frame	data/chars/axel/idle00.gif
	frame	data/chars/axel/idle01.gif
	
anim follow4
	idle 	1
	loop	1
	delay	16
	offset	62 126
	bbox 	50 55 23 74
	@cmd aniMp "ANI_IDLE" 40 2
	frame	data/chars/axel/idle04.gif
	frame	data/chars/axel/idle05.gif

And if you are using "typemp 0", will need to put the same function in the follow4 animation with "type 2" to reset the normal idle, unless if you press any button. But if typemp is 1, you will need to attack for recover mp and will automatically reset to normal idle when press any button, no need to repeat the function with type 2.

I hope it helps!
 
I believe it is in the manual, but if not it's a frame attribute that sets idle state for rest of the animation. Meaning you can cancel out with anything, even just walking.

DC
 
I didn't know either that this command exists but it's actually in the manual:

Code:
idle {flag}

    ~Allows current frame to be interrupted by key inputs just like in IDLE animation.
        0 = Disable key interrupt (default). Also resets previous frame's setting.
        1 = Enable key interrupt.
    ~For example, if this is set to 1 in ATTACK1 animation, player can cancel the animation by pressing Up and plays WALK instead.
    ~This command works from defined frame to last frame unless resetted.
 
Back
Top Bottom