Solved Script hurt + remap

Question that is answered or resolved.

dantedevil

Well-known member
I have been researching and browsing the forum, but I have not been able to find information about it. :cautious:
My idea is to modify this script, so that when it inflicts damage on the opponent, it forces him to change the palette, for the one we want. 😁

It would be something like: 👇

@cmd hurtRemap 20 2

Damage 20, remap 2.

C++:
void hurt(int Damage)
{ // Damage without altering opponent's animation + less damage if opponent has less health
// Mainly used for slams
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);
   void target = getlocalvar("Target" + self);

   if(target==NULL())
   {
     target = getentityproperty(self, "grabbing");
     setlocalvar("Target" + self, target);
   }
   if(target!=NULL())
   {
     int THealth = getentityproperty(target,"health"); //Get target's health
     int TAniPos = getentityproperty(target,"animpos"); //Get target's animation frame
     if(THealth > Damage)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL7")); // Damage target with desired damage
       updateframe(target, TAniPos);
     } else {
       int Damage2 = THealth - 1;
       damageentity(target, self, Damage2, 1, openborconstant("ATK_NORMAL7")); //Damage target with less damage
       updateframe(target, TAniPos);
     }
   }
}


I have made several attempts on my own, but I am not very clear about the parameters to modify the script. 😩
 
I have been researching and browsing the forum, but I have not been able to find information about it. :cautious:
My idea is to modify this script, so that when it inflicts damage on the opponent, it forces him to change the palette, for the one we want. 😁

It would be something like: 👇

@cmd hurtRemap 20 2

Damage 20, remap 2.

C++:
void hurt(int Damage)
{ // Damage without altering opponent's animation + less damage if opponent has less health
// Mainly used for slams
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);
   void target = getlocalvar("Target" + self);

   if(target==NULL())
   {
     target = getentityproperty(self, "grabbing");
     setlocalvar("Target" + self, target);
   }
   if(target!=NULL())
   {
     int THealth = getentityproperty(target,"health"); //Get target's health
     int TAniPos = getentityproperty(target,"animpos"); //Get target's animation frame
     if(THealth > Damage)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL7")); // Damage target with desired damage
       updateframe(target, TAniPos);
     } else {
       int Damage2 = THealth - 1;
       damageentity(target, self, Damage2, 1, openborconstant("ATK_NORMAL7")); //Damage target with less damage
       updateframe(target, TAniPos);
     }
   }
}


I have made several attempts on my own, but I am not very clear about the parameters to modify the script. 😩
@dantedevil
Unless you want to use the "damageentity" function to cause a scripted damage, I recommend to use didhit/ondoattack/takedamage events instead of @cmd scripts in order to detect collisions and then do any effect you want. The code you posted if I'm not wrong is used in conjunction with scripted grabs because you will get the target using an previously saved variable "target"+self.
I could code an example but I need more details about how it should work, like what conditions will trigger the code.
 
Last edited:
Thanks for your answer my friend!

My idea is to use the script in a special SubZero grab. In this special movement, SubZero holds the opponent and lifts him up in the air by the neck, there he begins to take away his health, while the enemy flickers between the frozen and the normal palette.

It is for this reason that I cannot use the "forcemap" command with a simple attack, since it is a slam script.
 
Thanks for your answer my friend!

My idea is to use the script in a special SubZero grab. In this special movement, SubZero holds the opponent and lifts him up in the air by the neck, there he begins to take away his health, while the enemy flickers between the frozen and the normal palette.

It is for this reason that I cannot use the "forcemap" command with a simple attack, since it is a slam script.
Can you post the Sub-Zero's full animation? I suggest to use drawmethod tint instead of changing map, but I need to see the entire animation to think if it's better to put on animationscript event or in ondraw/update.
 
As you can see in the animation, the idea is that when the enemy takes damage, it causes the enemy to change the palette.
It's exactly the same as the "forcemap" command that we can use in normal attacks.
The idea would be to replicate this in slam scripts.

anim follow7
loop 0
attackone 1
fastattack 1
delay 2
move 2
offset 87 177
bbox 0 0 0 0
frame data/chars/heroes/subzero/catch4.png
frame data/chars/heroes/subzero/catch4.png
frame data/chars/heroes/subzero/catch4.png
@cmd stop
delay 1
@cmd cancelgrab2
frame data/chars/heroes/subzero/catch4.png
move 0
delay 9
@cmd slamstart2
@cmd position 0 37 0 -1 0
frame data/chars/heroes/subzero/grabat00.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4
@cmd antiwall 50 -15 -1
@cmd position 0 23 16 -1 0
frame data/chars/heroes/subzero/grabe00.png
sound data/chars/heroes/subzero/rat1.wav
@cmd position 0 38 18 -1 0
frame data/chars/heroes/subzero/grabe01.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 ## > HERE REMAP TO FROZEN
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd position 0 43 18 -1 0
frame data/chars/heroes/subzero/grabe03.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 ## > HERE REMAP TO NORMAL
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd position 0 43 18 -1 0
sound data/chars/heroes/subzero/rat1.wav
frame data/chars/heroes/subzero/grabe03.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 ## > HERE REMAP TO FROZEN
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd antiwall 50 -15 -1
@cmd position 0 43 18 -1 0
frame data/chars/heroes/subzero/grabe03.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 ## > HERE REMAP TO NORMAL
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd position 0 43 18 -1 0
sound data/chars/heroes/subzero/rat1.wav
frame data/chars/heroes/subzero/grabe03.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 ## > HERE REMAP TO FROZEN
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd position 0 43 18 -1 0
frame data/chars/heroes/subzero/grabe03.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 ## > HERE REMAP TO NORMAL
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd antiwall 50 -20 -1
@cmd position 0 43 18 -1 0
sound data/chars/heroes/subzero/rat1.wav
frame data/chars/heroes/subzero/grabe03.png
delay 1
@cmd depost 0
@cmd finish 10 2 0 0.5 0 0
frame data/chars/heroes/subzero/grabe03.png
delay 9
frame data/chars/heroes/subzero/grabe03.png
frame data/chars/heroes/subzero/grabe01.png
bbox 76 70 34 107
frame data/chars/heroes/subzero/edown00.png
 
As you can see in the animation, the idea is that when the enemy takes damage, it causes the enemy to change the palette.
It's exactly the same as the "forcemap" command that we can use in normal attacks.
The idea would be to replicate this in slam scripts.
I didn't test but you can try something like this:

C:
void hurt2(int Damage, int tintEnable, int tintMode, int colorRed, int colorGreen, int colorBlue)
{// Damage without altering opponent's animation + less damage if opponent has less health
 // Mainly used for slams
    void self = getlocalvar("self");
    void target = getlocalvar("Target" + self);

    if(target==NULL())
    {
        target = getentityproperty(self, "grabbing");
        setlocalvar("Target" + self, target);
    }
    if(target!=NULL())
    {
        int THealth = getentityproperty(target,"health"); //Get target's health
        int TAniPos = getentityproperty(target,"animpos"); //Get target's animation frame
        if(THealth > Damage)
        {
        damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL7")); // Damage target with desired damage
        updateframe(target, TAniPos);
        changedrawmethod(target, "enabled", tintEnable);
        changedrawmethod(target, "tintmode", tintMode);
        changedrawmethod(target, "tintcolor", rgbcolor(colorRed, colorGreen, colorBlue));
        } else {
        int Damage2 = THealth - 1;
        damageentity(target, self, Damage2, 1, openborconstant("ATK_NORMAL7")); //Damage target with less damage
        updateframe(target, TAniPos);
        changedrawmethod(target, "enabled", tintEnable);
        changedrawmethod(target, "tintmode", tintMode);
        changedrawmethod(target, "tintcolor", rgbcolor(colorRed, colorGreen, colorBlue));
        }
    }
}

anim follow7
loop 0
attackone 1
fastattack 1
delay 2
move 2
offset 87 177
bbox 0 0 0 0
frame data/chars/heroes/subzero/catch4.png
frame data/chars/heroes/subzero/catch4.png
frame data/chars/heroes/subzero/catch4.png
@cmd stop
delay 1
@cmd cancelgrab2
frame data/chars/heroes/subzero/catch4.png
move 0
delay 9
@cmd slamstart2
@cmd position 0 37 0 -1 0
frame data/chars/heroes/subzero/grabat00.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4
@cmd antiwall 50 -15 -1
@cmd position 0 23 16 -1 0
frame data/chars/heroes/subzero/grabe00.png
sound data/chars/heroes/subzero/rat1.wav
@cmd position 0 38 18 -1 0
frame data/chars/heroes/subzero/grabe01.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 1 1 0 0 255 ## > HERE REMAP TO FROZEN
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd position 0 43 18 -1 0
frame data/chars/heroes/subzero/grabe03.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 0 0 0 0 0## > HERE REMAP TO NORMAL
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd position 0 43 18 -1 0
sound data/chars/heroes/subzero/rat1.wav
frame data/chars/heroes/subzero/grabe03.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 4 1 1 0 0 255 ## > HERE REMAP TO FROZEN
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd antiwall 50 -15 -1
@cmd position 0 43 18 -1 0
frame data/chars/heroes/subzero/grabe03.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 0 0 0 0 0 ## > HERE REMAP TO NORMAL
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd position 0 43 18 -1 0
sound data/chars/heroes/subzero/rat1.wav
frame data/chars/heroes/subzero/grabe03.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 4 1 1 0 0 255 ## > HERE REMAP TO FROZEN
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd position 0 43 18 -1 0
frame data/chars/heroes/subzero/grabe03.png
sound data/chars/heroes/subzero/freez.wav
@cmd hurt2 4 0 0 0 0 0 ## > HERE REMAP TO NORMAL
@cmd position 0 43 16 -1 0
frame data/chars/heroes/subzero/grabe02.png
@cmd antiwall 50 -20 -1
@cmd position 0 43 18 -1 0
sound data/chars/heroes/subzero/rat1.wav
frame data/chars/heroes/subzero/grabe03.png
delay 1
@cmd depost 0
@cmd finish 10 2 0 0.5 0 0
frame data/chars/heroes/subzero/grabe03.png
delay 9
frame data/chars/heroes/subzero/grabe03.png
frame data/chars/heroes/subzero/grabe01.png
bbox 76 70 34 107
frame data/chars/heroes/subzero/edown00.png
 
Well my dear friend, I finally got home and was able to try them.
For some reason I don't understand, the script only works by changing the frozen effect (BLUE) the first time. :unsure:
This means that only the first of these lines works:
@cmd hurt2 4 1 1 0 0 255 ## > HERE REMAP TO FROZEN

The other 2 lines like this do not cause the enemy to change color, they only do damage to the enemy. 😕
 
Last edited:
Well my dear friend, I finally got home and was able to try them.
For some reason I don't understand, the script only works by changing the frozen effect (BLUE) the first time. :unsure:
This means that only the first of these lines works:
@cmd hurt2 4 1 1 0 0 255 ## > HERE REMAP TO FROZEN

The other 2 lines like this do not cause the enemy to change color, they only do damage to the enemy. 😕
Strange, I did some tests after posting the code and it worked in the SORX. I saw I forgot to update the first @cmd hurt2 occurrence, I don't know if it can be the problem.
Maybe you have another script interfering in the drawmethod, I would like to see the entire character text file to confirm it.

1686888935944.png
 
I was finally able to complete the move!
I couldn't get the effect of flickering between the blue color and the normal palette, but I modified the movement to solve the problem.
This was the result:

7JzEFyK.gif


Since I already had a script in use with the name "hurt2", I had to rename the one you created to avoid problems.
I put yours "hurtTint".

This is the finished animation:

anim follow9
loop 0
attackone 1
fastattack 1
delay 2
move 2
offset 82 177
bbox 0 0 0 0
frame data/chars/heroes/subzero/catch01.png
frame data/chars/heroes/subzero/catch01.png
frame data/chars/heroes/subzero/catch01.png
@cmd stop
delay 1
@cmd cancelgrab2
frame data/chars/heroes/subzero/catch01.png
move 0
delay 12
@cmd slamstart2
@cmd position 0 48 0 -1 0
frame data/chars/heroes/subzero/catch01.png
delay 20
@cmd antiwall 50 -17 -1
@cmd position 0 43 0 -1 0
frame data/chars/heroes/subzero/catch02.png
delay 10
@cmd position 0 48 15 -1 0
frame data/chars/heroes/subzero/catch03.png
sound data/chars/heroes/chosen/powers/ice/icy.wav
@cmd hurtTint 2 1 1 0 0 255
@cmd position 0 30 35 -1 0
frame data/chars/heroes/subzero/catch04.png
@cmd position 0 31 33 -1 0
frame data/chars/heroes/subzero/catch05.png
@cmd hurt2 2
@cmd position 0 30 35 -1 0
frame data/chars/heroes/subzero/catch04.png
@cmd position 0 31 33 -1 0
frame data/chars/heroes/subzero/catch05.png
sound data/chars/heroes/chosen/powers/ice/icy.wav
@cmd hurt2 2
@cmd position 0 30 35 -1 0
frame data/chars/heroes/subzero/catch04.png
@cmd position 0 31 33 -1 0
frame data/chars/heroes/subzero/catch05.png
@cmd hurt2 2
@cmd position 0 30 35 -1 0
frame data/chars/heroes/subzero/catch04.png
@cmd antiwall 50 -17 -1
@cmd position 0 31 33 -1 0
frame data/chars/heroes/subzero/catch05.png
sound data/chars/heroes/chosen/powers/ice/icy.wav
@cmd hurt2 2
@cmd position 0 30 35 -1 0
frame data/chars/heroes/subzero/catch04.png
delay 20
@cmd position 0 31 33 -1 0
frame data/chars/heroes/subzero/catch05.png
delay 8
@cmd position 8 15 28 -1 0
frame data/chars/heroes/subzero/catch06.png
@cmd position 8 -10 33 -1 0
frame data/chars/heroes/subzero/catch07.png
delay 25
@cmd position 0 -28 23 -1 1
frame data/chars/heroes/subzero/catch08.png
delay 6
sound data/chars/heroes/scorpion/at4.wav
@cmd position 1 -23 47 -1 1
frame data/chars/heroes/subzero/catch09.png
@cmd position 6 15 85 -1 -1
frame data/chars/heroes/subzero/catch10.png
@cmd position 9 50 33 -1 -1
frame data/chars/heroes/subzero/catch11.png
sound data/sounds/land.wav
@cmd antiwall 50 -10 -1
@cmd hurtTint 0 0 0 0 0 0
@cmd position 9 38 1 1 -1
frame data/chars/heroes/subzero/catch12.png
delay 5
@cmd depost 0
@cmd finish 20 4 -1 2.5 0 1
@cmd spawn01 "down" 70 0 -2
frame data/chars/heroes/subzero/catch12.png
delay 30
frame data/chars/heroes/subzero/catch12.png
delay 12
bbox 76 70 34 107
frame data/chars/heroes/subzero/atb06.png
frame data/chars/heroes/subzero/at01.png

Thanks for your help my friend! 😃
 
Great job, friend! The effect fits perfectly :)
Glad you like my friend!

I think this script will be very useful for different effects in attacks. ☺️
Now I'm going to use it with Raiden, but changing the color, obviously. 😉

I really thank you very much! (y)
 
Back
Top Bottom