help with boss enemy

jonsilva

New member
hello

ive made boss character
i whanted to make him play an animation when his life reaches 80%
then 50% then 20%...

i already have a script that makes this work
void damage(int hp,char ani)
{
void self=getlocalvar("self");
if (getentityproperty(self,"health")<=(getentityproperty(self,"maxhealth")*hp/100))
{
changeentityproperty(self,"animation",openborconstant(ani));
}

enemy.txt
anim idle
loop 1
delay 10
@cmd damage 80 "ANI_FOLLOW1"
offset 106 89
bbox 0 9 190 75
frame data/chars/MISC/car/sta1.GIF


but this will make the character play follow1 every time it returns to idle and hes health is below 80%

is there a way to make the character only play follow1 one time ?
I think this type of boss was already made in other borgames ???
 
if you are using slams
and using the @ cmd clearL in idle or after the slam
it will erase the flag 1 and make the character keep playing the follow animation forever...

in my boss character ive removed the @cmd clearL to make the @cmd damadge work... but weird thing happen... one time the character grabbed the flash.. most times he doesnt grab the player.. and the game crashes with no errors...
i was saving this issues to the end of the game...
 
Thanks I had no idea clearL removed the flag variable im guessing that script can be changed just to clear target entity but that was not my issue i fixed with this modded script:

@script
void self = getlocalvar("self");
int Flag = getlocalvar("Flag" + self);

if(Flag == NULL()){
  Flag=0;
}
if(Flag==0){
setlocalvar("Flag" + self,1);
performattack(self, openborconstant("ANI_FOLLOW1"));
}
if(Flag==1){
setlocalvar("Flag" + self,2);
performattack(self, openborconstant("ANI_FOLLOW1"));
}
if(Flag==2){
setlocalvar("Flag" + self,3);
performattack(self, openborconstant("ANI_FOLLOW1"));
}
@end_script
 
Back
Top Bottom