riseattack or riseattack 2?

Ahh ok.
This two scripts are present in World Heroes mod.

Code:
void riseattack(int Rx, int Rz, void Ani)
{// Riseattack with range check
    void self = getlocalvar("self");
    void target = findtarget(self); //Get nearest player
    float x = getentityproperty(self, "x");
    float z = getentityproperty(self, "z");

    if(target!=NULL()){
      float Tx = getentityproperty(target, "x");
      float Tz = getentityproperty(target, "z");
      float Disx = Tx - x;
      float Disz = Tz - z;

      if(Disx < 0){
        Disx = -Disx;
      }
      if(Disz < 0){
        Disz = -Disz;
      }

      if( Disx <= Rx && Disz <= Rz ) // Target within range?
      {
        if(Tx < x){
          changeentityproperty(self, "direction", 0);
        } else {
          changeentityproperty(self, "direction", 1);
        }
        changeentityproperty(self, "animation", openborconstant(Ani)); //Change the animation
      } 
    }
}

void riseattack2(int Rx, int Rz, void Ani)
{// Riseattack with range check
    void self = getlocalvar("self");
    void target = findtarget(self); //Get nearest player
    float x = getentityproperty(self, "x");
    float z = getentityproperty(self, "z");

    if(target!=NULL()){
      float Tx = getentityproperty(target, "x");
      float Tz = getentityproperty(target, "z");
      float Disx = Tx - x;
      float Disz = Tz - z;

      if(Disx < 0){
        Disx = -Disx;
      }
      if(Disz < 0){
        Disz = -Disz;
      }

      if( Disx <= Rx && Disz <= Rz ) // Target within range?
      {
        changeentityproperty(self, "animation", openborconstant(Ani)); //Change the animation
      } 
    }
}
 
I see these two scripts in different characters:

Riseattack only in anim rise
Code:
anim rise
	loop	0
	offset	95 170
	delay	6
	frame	data/chars/brocken/rise1.gif
	frame	data/chars/brocken/rise2.gif
      @cmd    riseattack 120 40 "ANI_FOLLOW3"
	frame	data/chars/brocken/rise3.gif
	frame	data/chars/brocken/rise4.gif
      frame	data/chars/brocken/rise5.gif
	frame	data/chars/brocken/rise6.gif
      delay	3
      offset	91 166
      frame	data/chars/brocken/rise6.gif
      offset	89 162
      frame	data/chars/brocken/rise6.gif


Riseattack2 is present in several animations and more than once

Code:
anim follow4
      loop	0
      delay   12
      offset	75 170
      jumpframe 1 4 2.5 0.5 dus
      landframe 14 dus
      drawmethod 286 286 0 0 0 0 0
      frame	data/chars/assassin/j1.gif
      delay   4
      frame	data/chars/assassin/j2.gif
      bbox	55 78 47 75
      sound	data/sounds/jumpp.wav
      frame	data/chars/assassin/j2.gif
      @cmd    riseattack2 120 20 "ANI_FOLLOW6"
      frame	data/chars/assassin/j3.gif
      frame	data/chars/assassin/j4.gif
      @cmd    riseattack2 90 20 "ANI_FOLLOW6"
      frame	data/chars/assassin/j4.gif
      frame	data/chars/assassin/j5.gif
      frame	data/chars/assassin/j5.gif
      frame	data/chars/assassin/j6.gif
      @cmd    riseattack2 100 20 "ANI_FOLLOW6"
      frame	data/chars/assassin/j6.gif
      frame	data/chars/assassin/j7.gif
      frame	data/chars/assassin/j7.gif
      frame	data/chars/assassin/j3.gif
      delay   40
      @cmd    riseattack2 145 20 "ANI_FOLLOW6"
      frame	data/chars/assassin/j2.gif
      delay   10
      sound	data/sounds/step.wav
      frame	data/chars/assassin/jl1.gif
      frame	data/chars/assassin/j1.gif

anim follow5
      loop	0
      delay   12
      offset	75 170
      jumpframe 1 4 2.5 -0.5 dus
      landframe 14 dus
      drawmethod 286 286 0 0 0 0 0
      frame	data/chars/assassin/j1.gif
      delay   4
      frame	data/chars/assassin/j2.gif
      bbox	55 78 47 75
      sound	data/sounds/jumpp.wav
      frame	data/chars/assassin/j2.gif
      @cmd    riseattack2 120 20 "ANI_FOLLOW6"
      frame	data/chars/assassin/j3.gif
      frame	data/chars/assassin/j4.gif
      @cmd    riseattack2 90 20 "ANI_FOLLOW6"
      frame	data/chars/assassin/j4.gif
      frame	data/chars/assassin/j5.gif
      frame	data/chars/assassin/j5.gif
      frame	data/chars/assassin/j6.gif
      @cmd    riseattack2 100 20 "ANI_FOLLOW6"
      frame	data/chars/assassin/j6.gif
      frame	data/chars/assassin/j7.gif
      frame	data/chars/assassin/j7.gif
      frame	data/chars/assassin/j3.gif
      delay   40
      @cmd    riseattack2 145 20 "ANI_FOLLOW6"
      frame	data/chars/assassin/j2.gif
      delay   10
      sound	data/sounds/step.wav
      frame	data/chars/assassin/jl1.gif
      frame	data/chars/assassin/j1.gif

What is the different use for each?
 
riseattack and riseattack2 functions are animation change functions for enemies. Usually used in enemy's RISE animation to perform riseattack.
Benefit of using this functions is that fallen enemies won't skip their risetime setting and staydown effect.

These 2 functions are obsoleted by this function:

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
      }
    }
}

Back to your question, the main difference between riseattack and riseattack2 is the latter is to be combined with targetting function such as dash and leap . Or I should say, riseattack2 is used to make rise attack in which enemy performs targetted attack at player.

Example:
anim rise
offset 62 97
delay 8
frame data/chars/brian/rise01.gif
        offset 72 110
frame data/chars/brian/rise02.gif
        offset 89 110
        @cmd    riseattack2 200 40 5 4 "ANI_FOLLOW2"
frame data/chars/brian/rise03.gif
        frame data/chars/brian/rise04.gif

anim follow2
        followanim 1
        followcond 2
delay 8
offset 48 107
        hitfx  data/sounds/bukk.wav
        frame data/chars/brian/tackle02.gif
        delay  42
        @cmd    dash
        blast 55 29 70 81 15 1
        offset 81 107
frame data/chars/brian/tackle03.gif
        delay  8
        @cmd    stop
        frame data/chars/brian/tackle04.gif
        attack  0
        frame data/chars/brian/tackle05.gif
frame data/chars/brian/tackle06.gif

I admit it was a waste to make riseattack2 since you could get same result with using riseattack or attack1 function then set targetting function in the animation.
 
Thanks my friend!
This be very useful.
With your function the fallen enemies won't skip their risetime setting and staydown effect?
Can be used for players?
 
With your function the fallen enemies won't skip their risetime setting and staydown effect?

Yep, cause it is declared in RISE animation which is only played after risetime setting and staydown effect have wear off

Can be used for players?

No. It's automatic animation change. Works great for AI controlled entities but not players
 
Thank for everything my friend.
The staydown feature of your riseattack script works with the staydown of this finish script courtesy of your help?

Code:
void finish(int Damage, int Type, int x, int y, int z, int Face, int Stay)
{ // Damage as slam or throw finisher
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);
   int SDir = getentityproperty(target,"direction");
   int MDir;

   if(Face==0){ // Same facing?
       MDir = SDir;
   }

   if(Face==1){ // Opposite facing?

     if(SDir==0){ // Facing left?
       MDir = 1;
     } else { MDir = 0;}
   }

   if(target==NULL())
   {
     target = getentityproperty(self, "grabbing");
     setlocalvar("Target" + self, target);
   }
   if(target!=NULL())
   {
     int dir = getentityproperty(target,"direction"); //Get opponent's facing direction
     if(dir==0){ // Facing left?
       x = -x;
     }

     if(Type==1)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL")); // 1st Finisher
     }

     if(Type==2)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL9")); // 2nd Finisher
     }

     if(Type==3)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL10")); // 3rd Finisher
     }

     if(Type==4)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL11")); // 4th Finisher
     }

     tossentity(target, y, x, z); // Toss opponent ;)
     changeentityproperty(target, "staydown", "rise", Stay); 
     changeentityproperty(target, "direction", MDir);
 
Of course. Staydown effect is applied even before enemy is knocked down while riseattack function is run on RISE animation
 
Back
Top Bottom