mtrain
New member
I`m trying to make a "sitting-standing" move for enemy using @cmd attack1 script.
Here is the script:
Here is the enemy code:
The question is:
Can you help me modify script, that he will allow to stop at the 0 frame and if player will be in defined range animation will continue from the 1st frame? To avoid of creating additional follows? I think that this is imposible because follow10 must be updating by looping, but maybe you have any other ideas?
Here is the script:
void attack1(int RxMin, int RxMax, int Rz, void Ani)
{// Attack interruption with range check
void self = getlocalvar("self");
void target = findtarget(self); //Get nearest player
float x = getentityproperty(self, "x");
float z = getentityproperty(self, "z");
int dir = getentityproperty(self, "direction");
if(target!=NULL()){
float Tx = getentityproperty(target, "x");
float Tz = getentityproperty(target, "z");
float Disx = Tx - x;
float Disz = Tz - z;
if(Disz < 0){
Disz = -Disz;
}
if( Disx >= RxMin && Disx <= RxMax && Disz <= Rz && dir == 1) // Target within range on right facing?
{
performattack(self, openborconstant(Ani)); //Change the animation
} else if( Disx >= -RxMax && Disx <= -RxMin && Disz <= Rz && dir == 0) // Target within range on left facing?
{
performattack(self, openborconstant(Ani)); //Change the animation
}
}
}
Here is the enemy code:
anim follow10
#custom spawn 0 sitting
loop 1
offset 290 275
delay 5
frame data/chars/Galsia/110.gif
@cmd attack1 100 200 100 "ANI_Follow11"
frame data/chars/Galsia/110.gif
The question is:
Can you help me modify script, that he will allow to stop at the 0 frame and if player will be in defined range animation will continue from the 1st frame? To avoid of creating additional follows? I think that this is imposible because follow10 must be updating by looping, but maybe you have any other ideas?