Adjust position in ground attack

dantedevil

Well-known member
I have some problems when use this scrip in the No Mercy moves:
Code:
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); }
      }
    }
}

With some heros I need the player get close enough to the fallen enemy and the enemy will be displayed behind the player.  This way the execution looks the way I need.
But cant make this work properly.
So I wanna know how can make the player move always to the same position (specific distance) when enemy is fallen and thwn execute the No Mercy. And display the player over the fallen enemy if I need.
 
O Ilusionista said:
use the range MIN MAX setting for the move and if it connects, change to a follow anim and use scriptslam to bind the target

Ahh ok, you mean like in the DD Reloaded og Maggas.
I see that system there today.
Let me see if work properly in my case.
Thanks!
 
O Ilusionista said:
use the range MIN MAX setting for the move and if it connects, change to a follow anim and use scriptslam to bind the target
Well my friend,  I found some problems using this method.
In the No Mercy of Batman,  I need Batman get close to the fallen enemy,  always to the same distance, but without flip the enemy or Batman.
I want the two entities Remain in the same direction.
I see the Conditionalflip script,  but seems need an update to use in my case.

The main problem occurs when I execute the Ground Attack, while Batman is standing next to the head of the fallen enemy.
In this case the @cmd position causes the enemy flip facing Batman, beyond the value of "facing" is set 0.
I have no idea how to avoid that.
 
The main idea is adjust the position of the player to the enemy. And the enemy need remain exactly in the same place and position.
I thik with thisimage you can understand better:
F9uAJjy.jpg

Like you see here,  if Batman is close to the head an execute the No Mercy,  when the follow comes with the slamstart2, if the enemy flip and that's no look good.

I try to create a script base in adjustX.
Here the script:
Code:
void groundAt()
{// Special script for Ground attacks
    void self = getlocalvar("self");
    void target = getlocalvar("Target" + self);

    if(target==NULL())
    {
      target = getentityproperty(self, "opponent");
      setlocalvar("Target" + self, target);
    }

    if(target!=NULL())
    {
      int x = getentityproperty(target,"x"); //Get target's x coordinate
      int z = getentityproperty(target,"z"); //Get target's z coordinate

      changeentityproperty(self, "position", x, 50); //Grounding
      changeentityproperty(self, "position", z, 1); //Grounding
    }
}

But no work like I need.
The idea is set the desire x distance to tha player and the z cooords. In this case I set z 1 to put the player over the enemy and 50 is the distance of the player to the fallen enemy.

The idea is great and will be very useful,  but the script not work properly.
More wonderful would by modify this script to call in an animation and set the x, y and z coords.
Something like:
@cmd grounAt 50 20 1
50 the x coords distance locate the player to the fallen enemy.
20 y coords distance.
And 1 z coords.
 
Finally find a solution!
This script works perfect for the ground attacks:
Code:
void teletarget(int dx, int dy, int dz)
{// Targetting opponent then teleport to target
    void self = getlocalvar("self");
    void target = getentityproperty(self, "opponent");
    int dir = getentityproperty(self, "direction");

    if(dir==0){ // Facing left?
      dx = -dx ;
    }

    if(target!=NULL()){
      int Tx = getentityproperty(target, "x");
      int Tz = getentityproperty(target, "z");

      changeentityproperty(self, "position", Tx+dx, Tz+dz, dy); //Teleport to target!
    } 
}

Maybe need a modification to verify the animation of the enemy.
This way can check is the fallen enemy close or not before execute the teleport.
 
Back
Top Bottom