Solved Entity hit only in specific animation

Question that is answered or resolved.

dantedevil

Well-known member
I have this entity for all the stages fatalities.
This entity is located in the min walkable z coord and at 180 high.

Code:
name    stagefat
type     trap
speed 0
candamage    enemy
antigravity 100




anim idle
    loop    0
    offset  1 1
        delay   1
    frame    data/chars/misc/empty.png

#############################################################

#STAGE FATALITY 1-3 / HIT & RUN
anim follow1
    loop    1
    offset  892 56
        delay   5
        hitfx   data/sounds/empty.wav
        #attackone 1
        forcedirection 99
        attack45  0 0 1784 56 100 1 1 1 0 10   
    frame    data/chars/misc/stagefat/stfat1_3.png
        attack  0 0 0 0
    frame    data/chars/misc/stagefat/stfat1_3.png

#############################################################

#STAGE FATALITY 2-1 / WATER FALL
anim follow2
    loop    1
    offset  750 56
        delay   5
        hitfx   data/sounds/empty.wav
        #attackone 1
        forcedirection 99
        attack41  0 0 1500 56 100 1 1 1 0 10   
    frame    data/chars/misc/stagefat/stfat2_1.png
        attack  0 0 0 0
    frame    data/chars/misc/stagefat/stfat2_1.png

#############################################################

#STAGE FATALITY 5-2 / SHOCK RAILS
anim follow3
    loop    1
    offset  619 56
        delay   5
        hitfx   data/sounds/empty.wav
        #attackone 1
        forcedirection 99
        attack42  0 0 1238 56 100 1 1 1 0 10   
    frame    data/chars/misc/stagefat/stfat5_2.png
        attack  0 0 0 0
    frame    data/chars/misc/stagefat/stfat5_2.png

#############################################################

#STAGE FATALITY 5-2-2 / TRAIN FALL
anim follow4
    loop    1
    offset  750 56
        delay   5
        hitfx   data/sounds/empty.wav
        #attackone 1
        forcedirection 99
        attack43  0 0 1500 56 100 1 1 1 0 10   
    frame    data/chars/misc/stagefat/stfat2_1.png
        attack  0 0 0 0
    frame    data/chars/misc/stagefat/stfat2_1.png

#############################################################



#STAGE FATALITY 7-3 / IMPALED
anim follow5
    loop    1
    offset  6 56
        delay   5
        hitfx   data/sounds/empty.wav
        #attackone 1
        forcedirection 99
        followanim 6
        followcond 1
        attack44  0 0 12 56 100 1 1 1 0 1
    frame    data/chars/misc/stagefat/stfat7_3.png
        attack  0 0 0 0
    frame    data/chars/misc/stagefat/stfat7_3.png

anim follow6
        loop    0
    offset  6 56
        delay   2
    frame    data/chars/misc/stagefat/stfat7_3.png
        @cmd    killentity getlocalvar("self")
    frame    data/chars/misc/stagefat/stfat7_3.png

#############################################################



#STAGE FATALITY 8-1 / IMPALED2
anim follow7
    loop    1
    offset  619 56
        delay   5
        hitfx   data/sounds/empty.wav
        #attackone 1
        forcedirection 99
        attack45  0 0 1238 56 100 1 0 1 0 10   
    frame    data/chars/misc/stagefat/stfat5_2.png
        attack  0 0 0 0
    frame    data/chars/misc/stagefat/stfat5_2.png


#############################################################

This way the enemies never can touch the entity, only when heros perform the stage fatalities.

Here the fall of the enemies for the special stage fatality:
Code:
#-------------------Upper SPECIAL Stage Fatallity----------------#

anim fall27
    loop    0
    offset    82 177
    delay   20
        dropframe  2
    landframe  3 dust
        jumpframe 1 5 -0.3 -0.5
    sound   data/sounds/m5fall.wav
    frame    data/chars/gang1/bee/fall1.png
    sound   data/sounds/m5fall.wav
    frame    data/chars/gang1/bee/fall2.png
    delay   999
        hitfx   data/sounds/empty.wav
    bbox    56 120 66 41
    attack  45 135 55 25 5 1 0 1 0
    frame    data/chars/gang1/bee/fall3.png
    delay   1
    sound   data/sounds/fall1.wav
        frame   data/chars/gang1/bee/fall4.png
        @cmd    anichange "ANI_FOLLOW15" 0
        frame   data/chars/gang1/bee/fall4.png

Here my problem:
I have some enemies like Sawada, that can jump very high and touch the entity.
This looks very bad.

Here the attacks of him:
Code:
anim attack2
        range   120 200
        rangez  -40 40
    offset    82 177
    delay    1
    bbox    62 72 45 107
    frame    data/chars/gang3/sawada/jkick201.png
    delay    7
        @cmd    targetL 5 0 0
        @cmd    leap 5
    bbox    51 77 47 67
        sound   data/sounds/m3hm.wav
    frame    data/chars/gang3/sawada/jkick400.png
    frame    data/chars/gang3/sawada/jkick400.png
    frame    data/chars/gang3/sawada/jkick400.png
    frame    data/chars/gang3/sawada/jkick400.png
    delay    10
    bbox    70 90 42 40
    frame    data/chars/gang3/sawada/jkick202.png
    frame    data/chars/gang3/sawada/jkick203.png
    delay    7
        sound   data/sounds/m3at4.wav
    hitfx   data/sounds/beat3b.wav
        hitflash  flash2
    attack    93 63 23 47 15 1
    frame    data/chars/gang3/sawada/jkick204.png
    attack    106 69 33 43 15 1
    frame    data/chars/gang3/sawada/jkick205.png
    attack    112 84 37 28 15 1
    frame    data/chars/gang3/sawada/jkick206.png
    attack    99 107 54 21 15 1
    frame    data/chars/gang3/sawada/jkick207.png
    delay    12
    attack    99 119 58 24 15 1
    frame    data/chars/gang3/sawada/jkick208.png
    delay    7
    bbox    62 84 38 48
    attack    92 133 45 31 15 1
    frame    data/chars/gang3/sawada/jkick209.png
    attack    87 134 33 39 15 1
    frame    data/chars/gang3/sawada/jkick210.png


anim attack4
        range   0 70
        rangez  -50 50
    offset    82 177
    delay    1
    bbox    62 72 45 107
        sound   data/sounds/m3at3.wav
    frame    data/chars/gang3/sawada/jkick201.png
    delay    8
        @cmd    targetL 4 0 0
        @cmd    leap 4
    frame    data/chars/gang3/sawada/jkick201.png
    delay    12
    bbox    51 77 47 67
    frame    data/chars/gang3/sawada/jkick400.png
    frame    data/chars/gang3/sawada/jkick401.png
    delay    24
    hitfx   data/sounds/beat3b.wav
        hitflash  flash2
    attack    95 114 38 36 15 1
    bbox    51 77 47 67
    frame    data/chars/gang3/sawada/jkick402.png
    frame    data/chars/gang3/sawada/jkick402.png
    bbox    51 77 47 67
    attack    0 0 0 0
    delay    1
    frame    data/chars/gang3/sawada/jkick210.png

I try to make inmunity in this animations, but not work. Sawada always fall.
I use this method:


I think the only way, would be a script, so that the Stage Fatality can only cause damage to the enemy, if this is in the ANIM_FALL27.

I try using this, but not work.

Code:
int ani0020(int iAni, int iTAni){
   
    /*
    ani0020
    Damon Vaughn Caskey
    Perform alternate animation if target is within range and in specified animation.

    iAni:    Alternate attack.
    iTAni:    Target animation.
    */

    void vSelf      = getlocalvar("self");                    //Caller.                                                        
    void vOpp       = findtarget(vSelf, iAni);                //Nearest target in range of alternate attack.
   
    if (vOpp)                                                //Found a target?
    {
        if(getentityproperty(vOpp, "animationID") == iTAni)    //Animation match?
        {
            ani0009(vSelf, iAni, 0);                        //Perform alternate attack.
            return 1;                                        //Return 1.
        }
    }

    return 0;                                                //Return 0.
}
 
Last edited:
Solution
Hey Dante i'm back!
Okay, my idea is not to use the standard attack command but use an animation script instead, which will damage only type enemy on a specific animation. Its easy to use and you don't need to mess with immune attack systems.

Here is the animation script:

Code:
void fatrage(int RxMin, int RxMax, int RzMin, int RzMax, int RyMin, int RyMax)
{// Damage entity on a specific animation
// Rx = x distance to find type
// Rz = z distance to find type
// Ani = Animation to change
    void vself = getlocalvar("self");
    float x = getentityproperty(vself, "x");
    float y = getentityproperty(vself, "a");
    float z = getentityproperty(vself, "z");

    void vEntity;                                       //Target entity...
Hey Dante, nice to see you working on your mod again! I was waiting for the demo but you ruined my Christmas man!  ;D

Okay, about this i have an very easy solution(script) but right now i'm going to sleep. So if someone else will not give you a solution, then i will tomorow  ;)
 
magggas said:
Hey Dante, nice to see you working on your mod again! I was waiting for the demo but you ruined my Christmas man!  ;D

Okay, about this i have an very easy solution(script) but right now i'm going to sleep. So if someone else will not give you a solution, then i will tomorow  ;)

Ha ha ha  ;D

Thanks my friend!
 
Hey Dante i'm back!
Okay, my idea is not to use the standard attack command but use an animation script instead, which will damage only type enemy on a specific animation. Its easy to use and you don't need to mess with immune attack systems.

Here is the animation script:

Code:
void fatrage(int RxMin, int RxMax, int RzMin, int RzMax, int RyMin, int RyMax)
{// Damage entity on a specific animation
// Rx = x distance to find type
// Rz = z distance to find type
// Ani = Animation to change
    void vself = getlocalvar("self");
    float x = getentityproperty(vself, "x");
    float y = getentityproperty(vself, "a");
    float z = getentityproperty(vself, "z");

    void vEntity;                                       //Target entity placeholder.
    void vAniID;
    int  iEntity;                                       //Entity enumeration holder.
    int  iType;                                         //Entity name.
    int  iMax      = openborvariant("ent_max");         //Entity count.
    int TDir;

    float Tx;
    float Ty;
    float Tz;
    float Disx;
    float Disz;
    float Disy;

    //Enumerate and loop through entity collection.
    for(iEntity=0; iEntity<iMax; iEntity++){
      vEntity = getentity(iEntity);                 //Get target entity from current loop.
      iType   = getentityproperty(vEntity, "type"); //Get target name
      vAniID  = getentityproperty(vEntity,"animationID");

      if(iType == openborconstant("TYPE_ENEMY")){
        if(vAniID == openborconstant("ANI_FALL27")){
          Tx = getentityproperty(vEntity, "x");
          Ty = getentityproperty(vEntity, "a");
          Tz = getentityproperty(vEntity, "z");
          TDir = getentityproperty(vEntity, "direction");
          Disx = Tx - x;
          Disz = Tz - z;
          Disy = Ty - y;

          if(Disx >= RxMin && Disx <= RxMax && Disz <= -RzMin && Disz <= RzMax && Disy >= RyMin && Disy <= RyMax && TDir == 1){
            damageentity(vEntity, vself, 100, 1, openborconstant("ATK_NORMAL45"));
            changeentityproperty(vEntity, "direction", 1);
            tossentity(vEntity, 3, 2, 0);
          }else if(Disx >= RxMin && Disx <= RxMax && Disz <= -RzMin && Disz <= RzMax && Disy >= RyMin && Disy <= RyMax && TDir == 0){
            damageentity(vEntity, vself, 100, 1, openborconstant("ATK_NORMAL45"));
            changeentityproperty(vEntity, "direction", 0);
            tossentity(vEntity, 3, -2, 0);
          }
        }
      }
    }
}

Now first  you have to just add the script function to an .c file and  then declare it as animation script to the entity like this : animationscript data/scripts/whatever.c

This is how will be on the entitys animation:

Code:
anim follow1
	loop	1
	offset  892 56
        delay   5
      @cmd  fatrage 0 1784 -10 0 0 150 	
	frame	data/chars/misc/stagefat/stfat1_3.png
      @cmd  fatrage 0 1784 -10 0 0 150 
	frame	data/chars/misc/stagefat/stfat1_3.png

As you can see this is only for the attack45. You can just make clone functions inside the .c file with just a different attack type and then just add the different functions to the different follow animations of your entity.

Ps: You may need to edit the values of this tooto controll the fall hight and length: tossentity(vEntity, 3, -2, 0);

Ps2: You cannow spawn the entity on the ground, it does not matter. Just take care to set the rage values right.

I hope that will help you! It's really easier than it looks and fits well your need!
 
Solution
Nice script, I will some tests with it myself.

Just a tip: instead of "ent_max", use "count_entities". You will be using less resources (white dragon explained it some months ago).
 
dantedevil said:
Sorry my friend, but not work!

For some reason, the entity never hurts the enemy.
I mean, the attack never makes contact.

You should just give the correct rage values here: @cmd  fatrage 0 1784 -10 0 0 150. This depends on where you have spawned the entity, and the first 2 values depend from the entitys direction too. Just try it like @cmd  fatrage -1784 1784 -10 10 -150 150 first.



O Ilusionista said:
Nice script, I will some tests with it myself.

Just a tip: instead of "ent_max", use "count_entities". You will be using less resources (white dragon explained it some months ago).

Ah, i already forgot about this. Thanks for reminding me about.
 
magggas said:
dantedevil said:
Sorry my friend, but not work!

For some reason, the entity never hurts the enemy.
I mean, the attack never makes contact.

You should just give the correct rage values here: @cmd  fatrage 0 1784 -10 0 0 150. This depends on where you have spawned the entity. Just try it like @cmd  fatrage -1784 1784 -10 10 -150 150 first.

You right, now works ok.
I'll have to learn how to adjust the range exactly.
Well, on many levels the Stage Ftality can be performed in a certain area and not in the whole level.
 
dantedevil said:
Well, on many levels the Stage Ftality can be performed in a certain area and not in the whole level.

I guessed that, that is why i posted a version of the script with ragemin-ragemax values. So you will be able to be precise on where the attack applies.

Hope you will get it fast working!
 
magggas said:
dantedevil said:
Well, on many levels the Stage Ftality can be performed in a certain area and not in the whole level.

I guessed that, that is why i posted a version of the script with ragemin-ragemax values. So you will be able to be precise on where the attack applies.

Hope you will get it fast working!

I already understand it!
I have managed to adjust it to perfection.
Thank you very much my friend!
 
Hey Maggas!

I have a question about this script.
Code:
void fatrage(int RxMin, int RxMax, int RzMin, int RzMax, int RyMin, int RyMax)
{// Damage entity on a specific animation
// Rx = x distance to find type
// Rz = z distance to find type
// Ani = Animation to change
    void vself = getlocalvar("self");
    float x = getentityproperty(vself, "x");
    float y = getentityproperty(vself, "a");
    float z = getentityproperty(vself, "z");

    void vEntity;                                       //Target entity placeholder.
    void vAniID;
    int  iEntity;                                       //Entity enumeration holder.
    int  iType;                                         //Entity name.
    int  iMax      = openborvariant("ent_max");         //Entity count.
    int TDir;

    float Tx;
    float Ty;
    float Tz;
    float Disx;
    float Disz;
    float Disy;

    //Enumerate and loop through entity collection.
    for(iEntity=0; iEntity<iMax; iEntity++){
      vEntity = getentity(iEntity);                 //Get target entity from current loop.
      iType   = getentityproperty(vEntity, "type"); //Get target name
      vAniID  = getentityproperty(vEntity,"animationID");

      if(iType == openborconstant("TYPE_ENEMY")){
        if(vAniID == openborconstant("ANI_FALL27")){
          Tx = getentityproperty(vEntity, "x");
          Ty = getentityproperty(vEntity, "a");
          Tz = getentityproperty(vEntity, "z");
          TDir = getentityproperty(vEntity, "direction");
          Disx = Tx - x;
          Disz = Tz - z;
          Disy = Ty - y;

          if(Disx >= RxMin && Disx <= RxMax && Disz <= -RzMin && Disz <= RzMax && Disy >= RyMin && Disy <= RyMax && TDir == 1){
            damageentity(vEntity, vself, 100, 1, openborconstant("ATK_NORMAL45"));
            changeentityproperty(vEntity, "direction", 1);
            tossentity(vEntity, 3, 2, 0);
          }else if(Disx >= RxMin && Disx <= RxMax && Disz <= -RzMin && Disz <= RzMax && Disy >= RyMin && Disy <= RyMax && TDir == 0){
            damageentity(vEntity, vself, 100, 1, openborconstant("ATK_NORMAL45"));
            changeentityproperty(vEntity, "direction", 0);
            tossentity(vEntity, 3, -2, 0);
          }
        }
      }
    }
}

Is it possible to modify it so that it can damage the enemy in 4 specific animacones, instead of one?

Currently I can only damage it in FALL27.

But it could be modified for example to cause damage in the animatios:

FALL27
FALL2
FALL4
IDLE

The idea is to use this fatality when the enemy falls into an acid hole.
That's why it would be necessary to include many animations, so that you can automatically pass to the animation of death,
 
Change this:
Code:
if(vAniID == openborconstant("ANI_FALL27")){

To this:
Code:
if(vAniID == openborconstant("ANI_FALL27") || vAniID == openborconstant("ANI_FALL2") || vAniID == openborconstant("ANI_FALL4") || vAniID == openborconstant("ANI_IDLE")){
 
magggas said:
Change this:
Code:
if(vAniID == openborconstant("ANI_FALL27")){

To this:
Code:
if(vAniID == openborconstant("ANI_FALL27") || vAniID == openborconstant("ANI_FALL2") || vAniID == openborconstant("ANI_FALL4") || vAniID == openborconstant("ANI_IDLE")){

You are great my friend!

Thanks!
 
Back
Top Bottom