hello
i wanted to alter a Scriptvar value in the entity .txt file
for exemple
in animation script.c
@cmd damchg will make the entity change to a follow anim if its health in lower than 90 and Scriptvar is less than number
Is there a way to rename the value in Scriptvar flag from 1 to 2 so that it will play anim follow11 once its health reaches lower than 70%
entity .txt
the problem here is that the entity keeps playing follow10 once he goes to idle
Scriptvar value should be 1 once it finishes playing anim follow10...
script var will then remain until the entity is removed from play
Entity vars remain until manually removed or the engine is shut down
i wanted to alter a Scriptvar value in the entity .txt file
for exemple
in animation script.c
@cmd damchg will make the entity change to a follow anim if its health in lower than 90 and Scriptvar is less than number
void damchg()
{
void self = getlocalvar("self");
int Flag = getscriptvar("Flag" + self);
int MHealth = getentityproperty(self,"maxhealth"); //get max hp
int PHealth = 100*getentityproperty(self,"health")/MHealth; //work out hp percentage
if(Flag == NULL()){
Flag=0; // <---- Scriptvar is set to 0
}
if(PHealth<=90 && Flag < 1){performattack(self, openborconstant("ANI_FOLLOW10"));
}
else if(PHealth<=70 && Flag < 2){performattack(self,openborconstant("ANI_FOLLOW11"));
}
}
Is there a way to rename the value in Scriptvar flag from 1 to 2 so that it will play anim follow11 once its health reaches lower than 70%
entity .txt
anim idle
loop 1
delay 3
offset 100 189
bbox 79 97 50 91
frame data/chars/beyond/3overlord/idle39.gif
@cmd damchg
frame data/chars/beyond/3overlord/idle43.gif
anim follow10
@script
void self = getlocalvar("self");
if(frame==100){ // set variable at 1st frame
setscriptvar("Flag" + self,1); <---- Flag should change from 0 to 1
}
@end_script
loop 0
delay 12
offset 100 189
bbox 0 0 0 0
landframe 110 dust
frame data/chars/beyond/3overlord/chg01.gif
the problem here is that the entity keeps playing follow10 once he goes to idle
Scriptvar value should be 1 once it finishes playing anim follow10...
script var will then remain until the entity is removed from play
Entity vars remain until manually removed or the engine is shut down