void target(float Velx, float Velz, float dx, float dz, int Stop)
{// Targetting opponent before leaping or dashing.
// Velx = x Velocity
// Velz = z Velocity
// dx = x added distance
// dz = z added distance
// Stop = flag to stop moving if no target is found
void self = getlocalvar("self");
int dir = getentityproperty(self, "direction");
float x = getentityproperty(self, "x");
float z = getentityproperty(self, "z");
if (dir == 0){ //Is entity facing left?
dx = -dx; //Reverse X direction to match facing
}
setlocalvar("T"+self, findtarget(self)); //Get nearest player
if( getlocalvar("T"+self) != NULL()){
void target = getlocalvar("T"+self);
float Tx = getentityproperty(target, "x");
float Tz = getentityproperty(target, "z");
if(Tx < x){
changeentityproperty(self, "direction", 0);
} else {
changeentityproperty(self, "direction", 1);
}
x = x+dx;
z = z+dz;
float Disx = Tx - x;
float Disz = Tz - z;
//Set both distance as positive value
if(Disx < 0){
Disx = -Disx;
}
if(Disz < 0){
Disz = -Disz;
}
// Calculate velocity for targetting
if(Disz < Disx)
{
if(Tx < x){
setlocalvar("x"+self, -Velx);
} else { setlocalvar("x"+self, Velx); }
setlocalvar("z"+self, Velx*(Tz-z)/Disx);
} else {
if(Tz < z){
setlocalvar("z"+self, -Velz);
} else { setlocalvar("z"+self, Velz); }
setlocalvar("x"+self, Velz*(Tx-x)/Disz);
}
} else {
if(Stop == 1)
{
setlocalvar("z"+self, 0);
setlocalvar("x"+self, 0);
} else {
setlocalvar("z"+self, 0);
if(dir==0){
setlocalvar("x"+self, -Velx);
} else { setlocalvar("x"+self, Velx); }
}
}
}
void targetL(float Vy, float dx, float dz)
{// Targetting opponent before performing targetted leap attack
// Vy = y Velocity
// dx = x added distance
// dz = z added distance
void self = getlocalvar("self");
int dir = getentityproperty(self, "direction");
float x = getentityproperty(self, "x");
float z = getentityproperty(self, "z");
if (dir == 0){ //Is entity facing left?
dx = -dx; //Reverse X direction to match facing
}
setlocalvar("T"+self, findtarget(self)); //Get nearest player
if( getlocalvar("T"+self) != NULL()){
void target = getlocalvar("T"+self);
float Tx = getentityproperty(target, "x");
float Tz = getentityproperty(target, "z");
if(Tx < x){
changeentityproperty(self, "direction", 0);
} else {
changeentityproperty(self, "direction", 1);
}
x = x+dx;
z = z+dz;
setlocalvar("x"+self, (Tx-x)/(22*Vy));
setlocalvar("z"+self, (Tz-z)/(22*Vy));
} else {
setlocalvar("z"+self, 0);
setlocalvar("x"+self, 0);
}
}
void grabcheck2()
{// Prevents enemy from performing the slam if he/she doesn't have any target
void self = getlocalvar("self");
void target = getlocalvar("Target" + self);
if(target==NULL())
{
performattack(self, openborconstant("ANI_IDLE")); //Don't perform the slam.
}
}
since it has an attackbox, it attacks the player in air. It doesn't lead into the slam but it knocks the player out of air. Is their some kind of script that makes this not hit the player in air?
how to make a script that counts how many times an attack happens ? I would like to make it so that when the enemy does this attack a few times, it gets dizzy after doing it again. Then it resets.
Strange, I just checked it and there's no function which could prevent enemy from grabbing player in mid air IOW the slam should work against jumping player
I could modify grabcheck function to prevent enemy from grabbing player in mid air but why would you need that?
I could think of couple script to do that but why not give MP to enemy? then add mpcost in enemy's attack and a script to change to dizzy animation if MP is not enough?
You can give mp regeneration ability to the enemy or just resets enemy's MP in dizzy animation
When it hits a player in mid air, it knocks the player out of the air. I wanted the player to be able to react to the enemy's dash and be able to do a jump attack
For example, Damnd from Final Fight jumps to the side and whistles for a set of enemies. The next time he does the move, he spawns a different set of enemies.
Oh I see. Just add noreflect 1 after the attackbox to prevent the knock down effect. It won't affect the script cause the script only needs to acquire the player enemy has grabbed not the knockdown status
AFAIK Damnd calls enemies based on his current health i.e when his health is more than half, he summons 2 weak thugs (Bred, Simons or Dug, I forgot) but when his health is lesser than half, he summons Poison and Hollywood. I don't think he ever calls more than twice
Regardless, it's doable with script
So any ideas on how I would do t?
anim attack2
@script
if(frame==0){
void self = getlocalvar("self");
int Count = getentityvar(self, 1);
if(Count > 2){
setentityvar(self, 1, 0);
changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW2"));
}
}
if(frame==10){
void self = getlocalvar("self");
int Count = getentityvar(self, 1);
if(Count==NULL()){
Count = 0;
}
setentityvar(self, 1, Count+1);
}
@end_script ...