Solved DOT Damage Absorb Problem

Question that is answered or resolved.

Crimsondeath

Active member
Hi everyone, I have an issue with the DOT (Damage Over Time) command. I’m using a script that converts damage into MP.

C++:
...
void damageabsorb() {
    void self = getlocalvar("self");
    float damage = getlocalvar("damage");
    float mp = getentityproperty(self, "mp");
    float mpgain = damage/2;

    changeentityproperty(self, "mp", mp+mpgain);
}
...

The script “absorbs” half of the damage received and restores MP to the damage taker (this part works fine).

However, when the opponent’s attack includes the DOT command:
Code:
...
    loop    0
    offset    35 122
    range    50 80
    bbox    20 20 35 95
    delay    7
    frame    data/chars/robodroid/special2d.gif
    frame    data/chars/robodroid/special2c.gif
    delay    14
    frame    data/chars/robodroid/special3a.gif
    delay    7
    jugglecost    15
    dot    1 100 4 1 10 <--- Here
    sound    data/sounds/burnpain.wav
    hitflash    Flash_Fire
    hitfx    data/sounds/no-hit.wav
    burn    55 30 60 35 21 16 1 0 15 0
...

It seems that the script also absorbs DOT damage and restores MP as if the damage taker were receiving normal hits, causing the MP recovery to become disproportionate (almost fill his MP bar xd).

I’m not sure if there’s a way to properly handle DOT damage or if it would be easier to just disable it for this kind of attacks entirely.

Any ideas? Thanks :)
 
Hi everyone, I have an issue with the DOT (Damage Over Time) command. I’m using a script that converts damage into MP.

C++:
...
void damageabsorb() {
    void self = getlocalvar("self");
    float damage = getlocalvar("damage");
    float mp = getentityproperty(self, "mp");
    float mpgain = damage/2;

    changeentityproperty(self, "mp", mp+mpgain);
}
...

The script “absorbs” half of the damage received and restores MP to the damage taker (this part works fine).

However, when the opponent’s attack includes the DOT command:
Code:
...
    loop    0
    offset    35 122
    range    50 80
    bbox    20 20 35 95
    delay    7
    frame    data/chars/robodroid/special2d.gif
    frame    data/chars/robodroid/special2c.gif
    delay    14
    frame    data/chars/robodroid/special3a.gif
    delay    7
    jugglecost    15
    dot    1 100 4 1 10 <--- Here
    sound    data/sounds/burnpain.wav
    hitflash    Flash_Fire
    hitfx    data/sounds/no-hit.wav
    burn    55 30 60 35 21 16 1 0 15 0
...

It seems that the script also absorbs DOT damage and restores MP as if the damage taker were receiving normal hits, causing the MP recovery to become disproportionate (almost fill his MP bar xd).

I’m not sure if there’s a way to properly handle DOT damage or if it would be easier to just disable it for this kind of attacks entirely.

Any ideas? Thanks :)
@Crimsondeath Friend, are you using the damageabsorb script inside the takadamage event? If yes, try to migrate it to the ondoattack event and see if it solves the problem.

Call it this way in the character header.

ondoattackscript data/scripts/your_file_name.c

Then, put this code inside.
Code:
void main()
{
      if(getlocalvar("which")){
            void self = getlocalvar("self");
            float damage = getlocalvar("damage");
            float mp = getentityproperty(self, "mp");
            float mpgain = damage/2;

            changeentityproperty(self, "mp", mp+mpgain);
      }
}

I don't know if this is what you want to achieve, but worked fine in my tests.
Basically the mp gain still works, but in another event which runs before the takedamage. I even extended the DOT time to check if it will not add any mp, but I saw the damage converted to mp only during the collision.

 
@Crimsondeath Friend, are you using the damageabsorb script inside the takadamage event? If yes, try to migrate it to the ondoattack event and see if it solves the problem.

Call it this way in the character header.



Then, put this code inside.
Code:
void main()
{
      if(getlocalvar("which")){
            void self = getlocalvar("self");
            float damage = getlocalvar("damage");
            float mp = getentityproperty(self, "mp");
            float mpgain = damage/2;

            changeentityproperty(self, "mp", mp+mpgain);
      }
}

I don't know if this is what you want to achieve, but worked fine in my tests.
Basically the mp gain still works, but in another event which runs before the takedamage. I even extended the DOT time to check if it will not add any mp, but I saw the damage converted to mp only during the collision.

Ok Thanks Kratus :D . I tested and works great for most attacks in the game, but there is a problem I discovered using it.

Some attacks like Grab Attacks use script damage:
Code:
anim    grabdown
    loop    0
    offset    65 208
    delay    7
    attackone    0
    OTG    1
    @cmd    bind 1 44 0 62 0
    @cmd    forceanim "ANI_FOLLOW66" 0
    sound    data/sounds/vo_jolkattack1.wav
    frame    data/chars/jolk/grabattack1.gif
    @cmd    bind 1 50 0 116 0
    hitfx    data/sounds/indirect.wav
    attack    50 65 75 100 20 16 0 0 0 0
    frame    data/chars/jolk/grabattack1d.gif
    delay    24
    @cmd    bind 1 10 0 186 0
    attack    35 5 75 110 20 16 0 0 0 0
    frame    data/chars/jolk/grabattack1e.gif
    delay    3
    @cmd    bind 1 44 0 62 0
    hitflash    Flash
    attack    70 110 65 100 24 16 0 0 0 0
    frame    data/chars/jolk/grabattack1.gif
    delay    1
    @cmd    spawn01 "Hitfloor_1" 52 0 0 1
    sound    data/sounds/indirect.wav
    @cmd    spawn01 "Flash_1" 52 23 1
    @cmd    spawnAni "QuakeCall" 0 0 0 "ANI_FOLLOW1"
    @cmd    antiwall 52 -53 -2
    @cmd    bind 1 52 0 0 0
    attack    85 120 60 90 15 16 1 0 0 0
    frame    data/chars/jolk/grabattack1c.gif
    delay    12
    attack    0 0 0 0 0
    @cmd    depost 0
    frame    data/chars/jolk/grabattack1c.gif
    delay    1
    offset    63 181
    @cmd    finish 24 -1 3 0 0 "ATK_NORMAL19" 1 <--- Here
    @cmd    bind 0 0 0 0 0
    frame    data/chars/jolk/taunt1a.gif
    @cmd    unBinded
    frame    data/chars/jolk/taunt1a.gif
    @cmd    clearL
    frame    data/chars/jolk/taunt1a.gif
    frame    data/chars/jolk/taunt1a.gif
finish.c code:
C++:
 void finish(int Damage, int x, int y, int z, int Face, char DamageType, int proyectil, int damagelanding){ // Damage as slam finisher
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);
   int SDir = getentityproperty(target,"direction");
   int DType = openborconstant(DamageType);
   int MDir;
   int hits = getentityproperty(self,"rush_count");

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

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

    if(Face==2){ // Opposite facing?
      if(SDir==0){
        MDir = 1;
      } else {
        MDir = 1;
      }
   }


  if(target==NULL()){
    if(getentityvar(self, "grabbed")==NULL()){
      target = getentityproperty(self, "grabbing");
    }else{
      target = getentityvar(self, "grabbed");
    }
    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(damagelanding == 1){
      damageentity(target, self, 0, 100, DType);
      changeentityproperty(target, "damage_on_landing", Damage);
    }else{
      damageentity(target, self, Damage, 100, DType);
    }
    hits = changeentityproperty(self, "rush_count", hits+1);
    tossentity(target, y, x, z); // Toss opponent ;)
    changeentityproperty(target, "direction", MDir);
    changeentityproperty(target, "projectile", proyectil);
    setentityvar(self, "grabbed", NULL());
  }
}

To sum up, I use damageentity (damageentity(target, self, Damage, Knockdownpower, Type); ) for some attacks, the takedamagescript works great with this, the problem is just the DOT damage.

I don't know if it's a good idea to calculate the damage inside scripts like finish.c so the opponent recovers MP after "being hit", some entities don't have MP .
 
Last edited:
I don't know if it's a good idea to calculate the damage inside scripts like finish.c so the opponent recovers MP after "being hit", some entities don't have MP .
I think it can work fine. I did some tests and didn't see any change in the mp for entities that does not have any mp declared at the header.
 
Back
Top Bottom