monomartin
Active member
hello friends need help
I want to add two parameters to this
keep it like this but if Player 1 detects that exists within the range change the animation
and if it detects that there are two players at a time within the range , player 1 and player 2 switch to another animation
the idea is that if a player approaches change the animation, but if there are two players in the game , wait for
the two players are in the range x z and switch to another animation
I hope I understand thanks
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
}
}
}
I want to add two parameters to this
keep it like this but if Player 1 detects that exists within the range change the animation
and if it detects that there are two players at a time within the range , player 1 and player 2 switch to another animation
the idea is that if a player approaches change the animation, but if there are two players in the game , wait for
the two players are in the range x z and switch to another animation
I hope I understand thanks
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
}
}
}