how to trigger more idle animations ?

rafhot

Member
hi

i have set
maxidles 5
on my models.txt

and my player character have 5 different idle animations

i want change those idles in game

Code:
anim	idle
	@cmd	lvAtt "ANI_IDLE2" 2 2
loop	1
	delay	9
	offset	640 231
	bbox	626 127 33 97
	frame	data/chars/1robert/r_1-0.pcx

	frame	data/chars/1robert/r_1-1.pcx
	frame	data/chars/1robert/r_1-2.pcx
	frame	data/chars/1robert/r_1-3.pcx
	frame	data/chars/1robert/r_1-4.pcx
	frame	data/chars/1robert/r_1-5.pcx
	frame	data/chars/1robert/r_1-6.pcx
	frame	data/chars/1robert/r_1-7.pcx
	frame	data/chars/1robert/r_1-8.pcx
        frame	data/chars/1robert/r_1-9.pcx

and to do this im using those functions to detect the level of my char and switch the animation:
Code:
void changeAni(char ani)
{
	void self = getlocalvar("self");
	changeentityproperty(self, "animation", openborconstant(ani));
	
}

void lvAtt(char ani,int lv,int above)
{
    void self = getlocalvar("self");
    void ind = getentityproperty(self,"playerindex"); 
	if (above){
		if (getglobalvar("level."+ind)>=lv){changeAni(ani);}
	}else{
		if (getglobalvar("level."+ind)<lv){changeAni(ani);}
	}
}

everything works fine but the idle2 dont loop  only the first frame of the idle2 animation is triggered and if i move the character it change normal to his walk animation and if i stop again it goes back to idle2 and again without execute the loop animation, only the first frame remain static

i notice too if i reach really close of an enemy the loop start to work, like it have some kind of range to trigger, but i tried to set custom ranges and then it stoped to trigger the loop even near enemies.
if i use follow animations or freespecial animations the same happend the custom idle dont loop

im doing something wrong? there is another change ani  function to do this?
im little lost here  :)


edit
i did some more tests and yes, the idles are triggered by range,  so i need to make a fake idle animation using follow or freespecial but i dont know how to do it
 
i did some more tests and yes, the idles are triggered by range,  so i need to make a fake idle animation using follow or freespecial but i dont know how to do it

Yes, and this is intended behavior. You could always just customize the ranges. Other than that, just use a follow anim and the set idle flag.

DC
 
if i use
changeentityproperty(self, "aiflag", "idling", 0);
in my follow6 animation  the animation works like an idles with the frames in loop mode as should be, but i cannot move  the character and it does not activate any command

if i use
changeentityproperty(self, "aiflag", "idling", 1);
it freeze the animation in the first frame (does not execute the loop) and allow me to move my character with proper walk animation and attacks

i dont know how to proper set those flags
here is my  entire animation code

Code:
anim	follow6
@script
void self = getlocalvar("self");

           if(frame ==0)
	{
            changeentityproperty(self, "aiflag", "idling", 1);
            changeentityproperty(self, "aiflag", "jumping", 0);
            changeentityproperty(self, "takeaction", NULL() );
	 }
	@end_script

	@cmd	lvAtt "ANI_FOLLOW7" 10 10
	 loop	1

	delay	7
	offset	640 231
	bbox	612 128 42 99
	frame	data/chars/1robert/r_2-0.pcx
	frame	data/chars/1robert/r_2-1.pcx
	frame	data/chars/1robert/r_2-2.pcx
	frame	data/chars/1robert/r_2-3.pcx
	frame	data/chars/1robert/r_2-4.pcx
	frame	data/chars/1robert/r_2-5.pcx
	frame	data/chars/1robert/r_2-6.pcx
	frame	data/chars/1robert/r_2-7.pcx
	frame	data/chars/1robert/r_2-8.pcx
	frame	data/chars/1robert/r_2-9.pcx
	frame	data/chars/1robert/r_2-10.pcx
	frame	data/chars/1robert/r_2-11.pcx
	frame	data/chars/1robert/r_2-12.pcx
	frame	data/chars/1robert/r_2-13.pcx
	frame	data/chars/1robert/r_2-14.pcx
	frame	data/chars/1robert/r_2-15.pcx

i dont know how to do
 
I advice you to use idlemode.
Example:
changeentityproperty(self, "aiflag", "idlemode", 2);

if you change idlemode to 2, you access into: idle2 animation
so you can make idle anims without ranges.
when you want to change an idle animation use "idlemode" prop.
 
i failed to make it work, so in the end i have used all my custom idles inside the idle animation

and the end result i solved the problem using this (credit to lagarto):

Code:
anim	idle
	@script
	void self = getlocalvar("self");
	void ind = getentityproperty(self,"playerindex");


	if ( getentityvar(self,"running") == 1 )
	{
   	setentityvar(self,"running",NULL());
   	performattack(self,openborconstant("ANI_FOLLOW5"),1);
        }

    if(frame ==0)
	{
	     if(getglobalvar("level."+ind) )


	     {
	     if(getglobalvar("level."+ind)>=20)updateframe(self,50);
	     }

	     {
	     if(getglobalvar("level."+ind)>=15)updateframe(self,40);
	     }

	     {
	     if(getglobalvar("level."+ind)>=10)updateframe(self,29);
	     }

	     {
  	     if(getglobalvar("level."+ind)>=5)updateframe(self,11);
	     }


	}

	@end_script
	loop	1
	delay	9
	offset	640 231
	bbox	626 127 33 97
	frame	data/chars/1robert/r_1-0.pcx
	frame	data/chars/1robert/r_1-1.pcx
	frame	data/chars/1robert/r_1-2.pcx
	frame	data/chars/1robert/r_1-3.pcx
	frame	data/chars/1robert/r_1-4.pcx
	frame	data/chars/1robert/r_1-5.pcx
	frame	data/chars/1robert/r_1-6.pcx
	frame	data/chars/1robert/r_1-7.pcx
	frame	data/chars/1robert/r_1-8.pcx
	frame	data/chars/1robert/r_1-9.pcx
	@cmd	updateframe getlocalvar("self") 0
	frame	none
	delay	7
	offset	640 231
	bbox	612 128 42 99
	frame	data/chars/1robert/r_2-0.pcx
	frame	data/chars/1robert/r_2-1.pcx
	frame	data/chars/1robert/r_2-2.pcx
	frame	data/chars/1robert/r_2-3.pcx
	frame	data/chars/1robert/r_2-4.pcx
	frame	data/chars/1robert/r_2-5.pcx
	frame	data/chars/1robert/r_2-6.pcx
	frame	data/chars/1robert/r_2-7.pcx
	frame	data/chars/1robert/r_2-8.pcx
	frame	data/chars/1robert/r_2-9.pcx
	frame	data/chars/1robert/r_2-10.pcx
	frame	data/chars/1robert/r_2-11.pcx
	frame	data/chars/1robert/r_2-12.pcx
	frame	data/chars/1robert/r_2-13.pcx
	frame	data/chars/1robert/r_2-14.pcx
	frame	data/chars/1robert/r_2-15.pcx
	@cmd	updateframe getlocalvar("self") 11
	frame	none
	delay	9
	offset	640 231
	bbox	623 128 39 104
	frame	data/chars/1robert/r_0-0.pcx
	frame	data/chars/1robert/r_0-1.pcx
	frame	data/chars/1robert/r_0-2.pcx
	frame	data/chars/1robert/r_0-3.pcx
	frame	data/chars/1robert/r_0-4.pcx
	frame	data/chars/1robert/r_0-5.pcx
	frame	data/chars/1robert/r_0-6.pcx
	frame	data/chars/1robert/r_0-7.pcx
	frame	data/chars/1robert/r_0-8.pcx
	frame	data/chars/1robert/r_0-9.pcx
	@cmd	updateframe getlocalvar("self") 29
	frame	none
	delay	9
	offset	640 231
	bbox	616 135 34 92
	loop	1 1
	frame	data/chars/1robert/r_3-1.pcx
	frame	data/chars/1robert/r_3-2.pcx
	frame	data/chars/1robert/r_3-3.pcx
	frame	data/chars/1robert/r_3-4.pcx
	frame	data/chars/1robert/r_3-5.pcx
	frame	data/chars/1robert/r_3-6.pcx
	frame	data/chars/1robert/r_3-7.pcx
	frame	data/chars/1robert/r_3-8.pcx
	frame	data/chars/1robert/r_3-9.pcx
	@cmd	updateframe getlocalvar("self") 40
	frame	none
	delay	9
	offset	640 231
	bbox	620 141 35 84
	frame	data/chars/1robert/r_4-0.pcx
	frame	data/chars/1robert/r_4-1.pcx
	frame	data/chars/1robert/r_4-2.pcx
	frame	data/chars/1robert/r_4-3.pcx
	frame	data/chars/1robert/r_4-4.pcx
	frame	data/chars/1robert/r_4-5.pcx
	frame	data/chars/1robert/r_4-6.pcx
	frame	data/chars/1robert/r_4-7.pcx
	frame	data/chars/1robert/r_4-8.pcx
	frame	data/chars/1robert/r_4-9.pcx
	frame	data/chars/1robert/r_4-10.pcx
	frame	data/chars/1robert/r_4-11.pcx
	frame	data/chars/1robert/r_4-12.pcx
	frame	data/chars/1robert/r_4-13.pcx
	frame	data/chars/1robert/r_4-14.pcx
	@cmd	updateframe getlocalvar("self") 50
	frame	none

all my 5 different idles are inside the idle animation
so it check the level of my character and use updateframe to put in the animation part that matches with the idle i want, works for what i need


thanks for the tip whitedragon, for the next character i will try to use idlemode and see if i can make it to work as i want
 
Back
Top Bottom