Weird Model change behaviors...

oldyz

Well-known member
i have this code that changes a character to a "shuffler" model, & i wanted to make 2 variants -
one version that forces the 3rd model change to start the spawn animation at frame 0 - using this code everything seems fine:
Code:
@script
	void self = getlocalvar("self");
	if(frame == 1){
changeentityproperty(self, "model", "pharaon2X", 0);

} else if(frame == 3){
changeentityproperty(self, "model", "pharaon2X-8", 0);

} else if(frame == 5){
changeentityproperty(self, "model", "pharaon2X-9", 0);

} else if(frame == 7){
changeentityproperty(self, "model", "pharaon2X-10", 0);

} else if(frame == 9){
changeentityproperty(self, "model", "pharaon2X-12", 0);

}
@end_script

@script
    void self = getlocalvar("self");
    if( frame == 0){
      int Sr = (rand() & 0x7fffffff) % 92 ;
            if (Sr >= 0 && Sr <= 17){
        changeentityproperty(self, "animpos", 8);
      }else if (Sr >= 18 && Sr <= 35){
        changeentityproperty(self, "animpos", 2);
      }else if (Sr >= 36 && Sr <= 53){ 
        changeentityproperty(self, "animpos", 0);
      }else if (Sr >= 54 && Sr <= 71){ 
        changeentityproperty(self, "animpos", 6);
      }else if (Sr >= 72 && Sr <= 89){ 
        changeentityproperty(self, "animpos", 4);
      }
    }
	@end_script

	frame data/chars/pharaon/51 #0
        frame data/chars/pharaon/51 #1
        frame data/chars/pharaon/51 #2
        frame data/chars/pharaon/51
	frame data/chars/pharaon/51 #4
	frame data/chars/pharaon/51
	frame data/chars/pharaon/51 #6
        frame data/chars/pharaon/51
        frame data/chars/pharaon/51 #8
        frame data/chars/pharaon/51

but the problem is with this other variant that is supposed to make the spawn animation begin at frame 6

@script
void self = getlocalvar("self");
if(frame == 1){
changeentityproperty(self, "model", "pharaon2X", 6);

} else if(frame == 3){
changeentityproperty(self, "model", "pharaon2X-8", 6);

} else if(frame == 5){
changeentityproperty(self, "model", "pharaon2X-9", 6);

} else if(frame == 7){
changeentityproperty(self, "model", "pharaon2X-10", 6);

} else if(frame == 9){
changeentityproperty(self, "model", "pharaon2X-12", 6);

}
@end_script

@script
    void self = getlocalvar("self");
    if( frame == 0){
      int Sr = (rand() & 0x7fffffff) % 92 ;
            if (Sr >= 0 && Sr <= 17){
        changeentityproperty(self, "animpos", 8);
      }else if (Sr >= 18 && Sr <= 35){
        changeentityproperty(self, "animpos", 2);
      }else if (Sr >= 36 && Sr <= 53){
        changeentityproperty(self, "animpos", 0);
      }else if (Sr >= 54 && Sr <= 71){
        changeentityproperty(self, "animpos", 6);
      }else if (Sr >= 72 && Sr <= 89){
        changeentityproperty(self, "animpos", 4);
      }
    }
@end_script

frame data/chars/pharaon/51 #0
        frame data/chars/pharaon/51 #1
        frame data/chars/pharaon/51 #2
        frame data/chars/pharaon/51
frame data/chars/pharaon/51 #4
frame data/chars/pharaon/51
frame data/chars/pharaon/51 #6
        frame data/chars/pharaon/51
        frame data/chars/pharaon/51 #8
        frame data/chars/pharaon/51

OpenBor is ignoring the number 6 & starts the spawn animations of these 2 variants
if(frame == 1){
changeentityproperty(self, "model", "pharaon2X", 6);

} else if(frame == 3){
changeentityproperty(self, "model", "pharaon2X-8", 6);
at frames 1 & 3

to fix it i tried this other method:
Code:
@script
	void self = getlocalvar("self");
	if(frame == 1){
changeentityproperty(self, "animation", openborconstant("ANI_follow1"));

} else if(frame == 3){
changeentityproperty(self, "animation", openborconstant("ANI_follow2"));

} else if(frame == 5){
changeentityproperty(self, "animation", openborconstant("ANI_follow3"));

} else if(frame == 7){
changeentityproperty(self, "animation", openborconstant("ANI_follow4"));

} else if(frame == 9){
changeentityproperty(self, "animation", openborconstant("ANI_follow5"));

}
@end_script

@script
    void self = getlocalvar("self");
    if( frame == 0){
      int Sr = (rand() & 0x7fffffff) % 92 ;
            if (Sr >= 0 && Sr <= 17){
        changeentityproperty(self, "animpos", 8);
      }else if (Sr >= 18 && Sr <= 35){
        changeentityproperty(self, "animpos", 2);
      }else if (Sr >= 36 && Sr <= 53){ 
        changeentityproperty(self, "animpos", 0);
      }else if (Sr >= 54 && Sr <= 71){ 
        changeentityproperty(self, "animpos", 6);
      }else if (Sr >= 72 && Sr <= 89){ 
        changeentityproperty(self, "animpos", 4);
      }
    }
	@end_script

	frame data/chars/pharaon/02 #0



        frame data/chars/pharaon/02 #1

        frame data/chars/pharaon/02 #2


        frame data/chars/pharaon/02


	frame data/chars/pharaon/02 #4



	frame data/chars/pharaon/02



	frame data/chars/pharaon/02 #6



        frame data/chars/pharaon/02


        frame data/chars/pharaon/02 #8


        frame data/chars/pharaon/02

frame data/chars/pharaon/02

anim follow1
	delay 1
	offset	93 175
        bbox 0 0 0 0
@script
	void self = getlocalvar("self");
	if(frame == 1){
        changeentityproperty(self, "model", "pharaon2X", 6);
        }
	@end_script
        frame data/chars/pharaon/02
frame data/chars/pharaon/02

anim follow2
	delay 1
	offset	93 175
        bbox 0 0 0 0
@script
	void self = getlocalvar("self");
	if(frame == 1){
changeentityproperty(self, "model", "pharaon2X-8", 6);
        }
	@end_script
        frame data/chars/pharaon/02
frame data/chars/pharaon/02

anim follow3
	delay 1
	offset	93 175
        bbox 0 0 0 0
@script
	void self = getlocalvar("self");
	if(frame == 1){
changeentityproperty(self, "model", "pharaon2X-9", 6);
        }
	@end_script
        frame data/chars/pharaon/02
frame data/chars/pharaon/02


anim follow4
	delay 1
	offset	93 175
        bbox 0 0 0 0
@script
	void self = getlocalvar("self");
	if(frame == 1){
changeentityproperty(self, "model", "pharaon2X-10", 6);
        }
	@end_script
        frame data/chars/pharaon/02
frame data/chars/pharaon/02


anim follow5
	delay 1
	offset	93 175
        bbox 0 0 0 0
@script
	void self = getlocalvar("self");
	if(frame == 1){
changeentityproperty(self, "model", "pharaon2X-12", 6);
        }
	@end_script
        frame data/chars/pharaon/02
frame data/chars/pharaon/02

but now the conflict is at anim follow1 - the engine makes uses of model2x's anim follow1's frames & if i change it to anim follow6 it ignores the 6 & does the spawn animation from the start
 
Oldyz, I think it is wrong:
Code:
changeentityproperty(self, "model", "pharaon2X", 6);

Looking at the manual and in the game source, there is no 6 value - and, as far as I know, this doesn't accept a bitwise value either.
"model" - Change the model by name, follow the name is another argument, 0 means keep current animation, 1 means reset to default.

Internally, the engine fires the function set_model_ex, which again only accepts 2 values
//change model, anim_flag 1: reset animation 0: use original animation
void set_model_ex(entity *ent, char *modelname, int index, s_model *newmodel, int anim_flag)

Even if you use "changeplayerproperty(playerindex, propname, value)", it still accepts 2 values only
Property names:
"model" - Change the model by name, follow the name is another argument, 0 means keep current animation, 1 means reset to default.
 
O_Ilusionista

I got the idea from some old thread on the forum - someone mentioned that the last number (the cero) was supposed to be the animation frame
either that or i just made an assumption

so the way to do it is to change the model from an anim follow# animation to another anim follow# animation?

because i wanted to "re-use" anim spawn frames: example
if the entity is "xenomorph-B" & it changes to XenomorphB-12, i want it to display spawn animation frames 7 to 12 -
But if entity is "xenomorph-B" & changes to XenomorphB-15 - i would like it to display all 12 spawn animation frames
 
Back
Top Bottom