Grab Script Issue - automatically deducts -1 HP from grabbed opponent?

MysticalMist

Active member
As I'm testing my game, I'm noticing one persistent bug that I've yet to work around.

When the player does a throw/slam, the first thing that happens is that the enemy immediately takes 1 point of damage. Worst case, if that's all that's left of the enemy's HP prior - the enemy will die, break free from the player and not even fall normally, it just remains in its fall7 state as it blinks out.

I noticed that in the script, it does intentionally take away one point of HP from the entity but I'm not sure how to improve it to where it doesn't risk the enemy having a glitchy death on accident again.

Code:
void grabStart()
{//Grab Starter for grab moves
 //Use SLAM or THROW after using this
    void self    = getlocalvar("self");
    void target    = getentityproperty(self, "grabbing");

    //IS THERE A GRABBED ENTITY?? PROCEED!!
    if(target != NULL()){
        setentityvar(self, "grabbed", target); //SAVE THE GRABBED ENTITY AS A NEW TARGET INSIDE AN ENTITYVAR
        damageentity(target, self, 0, 1, openborconstant("ATK_NORMAL7")); //PUT THE ENTITY IN A FALLING STATE
        changeentityproperty(target, "aiflag", "frozen", 1); //USED TO AVOID GRAB INTERRUPTION WHEN THE NODROPEN IS OFF AND ANY PLAYER IS RESPAWNED
    }
}

void grabStart2()
{//Grab Starter for non-grab moves
 //Use SLAM or THROW after using this
    void self    = getlocalvar("self");
    void target    = getentityproperty(self, "opponent");

    //IS THERE A DAMAGED ENTITY?? PROCEED!!
    if(target != NULL()){
        setentityvar(self, "grabbed", target); //SAVE THE GRABBED ENTITY AS A NEW TARGET INSIDE AN ENTITYVAR
        damageentity(target, self, 0, 1, openborconstant("ATK_NORMAL7")); //PUT THE ENTITY IN A FALLING STATE
        changeentityproperty(target, "aiflag", "frozen", 1); //USED TO AVOID GRAB INTERRUPTION WHEN THE NODROPEN IS OFF AND ANY PLAYER IS RESPAWNED
    }
}
 
I noticed that in the script, it does intentionally take away one point of HP from the entity
The damageentity() line does apply any damage to the opponent, the "1" number is in the "drop" parameter, which puts the opponent in a falling instance due to the knockdown.

1722220373312.png


1722220281335.png
The damage parameter in this script is zero, probably you are using the followanim/followcond in order to trigger a follow animation and perform a throw/slam. If it's the case, you must have a "zero" damage attack box in the previous animation that will trigger the followanim/followcond feature, otherwise you can kill the opponent before the throw/slam starts.

1722220704773.png

1722220785676.png
 
However, in this case, this is just a normal grab in terms of players grabbing enemies. I'm not using any followconds/anims in this case.
Are you meaning default grabbing attacks, like grabattack/grabforward/grabbackward etc?
And have the fall7 any bbox? Usually this animation does not have a bbox to avoid interruptions, I would like to take a look at your throw/slam and fall7 animations.
 
Are you meaning default grabbing attacks, like grabattack/grabforward/grabbackward etc?
And have the fall7 any bbox? Usually this animation does not have a bbox to avoid interruptions, I would like to take a look at your throw/slam and fall7 animations.

Well, for example, here's the fall7 animation for one of my basic enemies:
Code:
anim fall7
delay 1000
    offset    32 78
    frame    data/chars/diamond/hurt/0.png
        offset    33 74
    frame    data/chars/diamond/hurt/1.png
    offset    48 70
    frame    data/chars/diamond/hurt/grbed1.png
        offset    49 89
    frame    data/chars/diamond/hurt/grbed2.png
        offset    38 79
    frame    data/chars/diamond/hurt/grbed3.png

And here's the grabbackward (suplex) for one of my player characters:


Code:
anim grabbackward
    attackone    0
    quakeframe 3 1 8
    fastattack    1
    otg 1
    offset    55 114
    @cmd grabStart
    @cmd slamstart 9999
    delay 1
    frame    data/chars/coco/grabwalk/0.png
    sound data/sounds/Coco_atk03.wav
    delay 20
    @cmd position 0 40 30 -1 1
    offset    55 114
    attack.damage.force 0
    attack.effect.hit.sound.path data/sounds/silence.wav
    attack.position.x 0
    attack.position.y 0
    attack.size.x 0
    attack.size.y 0
    frame    data/chars/coco/grabwalk/0.png
    @cmd position 3 15 25 -1 1
    delay    24
    offset    80 114
    frame    data/chars/coco/backgrab/2.png
        delay  18
    offset    80 114
            attack.block.penetrate 1
    attack.damage.force 50
    attack.damage.type 1
    attack.effect.hit.flash.disable 0
    attack.position.x -27
    attack.position.y 59
    attack.reaction.fall.force 1
    attack.reaction.fall.velocity.x 3.0
    attack.reaction.fall.velocity.y 2.0
    attack.reaction.pause.time 20
    attack.size.x 61
    attack.size.y 57
    attack.size.z.background 0
    sound data/sounds/slam.wav
    @cmd position 2 -60 0 -1 1
    @cmd    spawn01 "SlamFlash" -50 -5 -5
    frame    data/chars/coco/backgrab/3.png
    offset    75 117
        attack.damage.force 0
    attack.position.x 58
    attack.position.y 97
    attack.size.x 0
    attack.size.y 0
    @cmd    depost 0
    @cmd    slam 40 1 -1 3 0 0
    @cmd    clearL
    frame    Data/Chars/Coco/backgrab/4.png
 
Well, for example, here's the fall7 animation for one of my basic enemies:
Code:
anim fall7
delay 1000
    offset    32 78
    frame    data/chars/diamond/hurt/0.png
        offset    33 74
    frame    data/chars/diamond/hurt/1.png
    offset    48 70
    frame    data/chars/diamond/hurt/grbed1.png
        offset    49 89
    frame    data/chars/diamond/hurt/grbed2.png
        offset    38 79
    frame    data/chars/diamond/hurt/grbed3.png

And here's the grabbackward (suplex) for one of my player characters:


Code:
anim grabbackward
    attackone    0
    quakeframe 3 1 8
    fastattack    1
    otg 1
    offset    55 114
    @cmd grabStart
    @cmd slamstart 9999
    delay 1
    frame    data/chars/coco/grabwalk/0.png
    sound data/sounds/Coco_atk03.wav
    delay 20
    @cmd position 0 40 30 -1 1
    offset    55 114
    attack.damage.force 0
    attack.effect.hit.sound.path data/sounds/silence.wav
    attack.position.x 0
    attack.position.y 0
    attack.size.x 0
    attack.size.y 0
    frame    data/chars/coco/grabwalk/0.png
    @cmd position 3 15 25 -1 1
    delay    24
    offset    80 114
    frame    data/chars/coco/backgrab/2.png
        delay  18
    offset    80 114
            attack.block.penetrate 1
    attack.damage.force 50
    attack.damage.type 1
    attack.effect.hit.flash.disable 0
    attack.position.x -27
    attack.position.y 59
    attack.reaction.fall.force 1
    attack.reaction.fall.velocity.x 3.0
    attack.reaction.fall.velocity.y 2.0
    attack.reaction.pause.time 20
    attack.size.x 61
    attack.size.y 57
    attack.size.z.background 0
    sound data/sounds/slam.wav
    @cmd position 2 -60 0 -1 1
    @cmd    spawn01 "SlamFlash" -50 -5 -5
    frame    data/chars/coco/backgrab/3.png
    offset    75 117
        attack.damage.force 0
    attack.position.x 58
    attack.position.y 97
    attack.size.x 0
    attack.size.y 0
    @cmd    depost 0
    @cmd    slam 40 1 -1 3 0 0
    @cmd    clearL
    frame    Data/Chars/Coco/backgrab/4.png
Really I see no bbox in the fall7, but I'm wondering about the "@cmd slamstart 9999" function in this animation, since the grabstart does the same job. Please, can you post the slamstart script?
 
Really I see no bbox in the fall7, but I'm wondering about the "@cmd slamstart 9999" function in this animation, since the grabstart does the same job. Please, can you post the slamstart script?

Sure thing

Code:
void slamstart(int iDrop)
{ // Slam Starter
// Use finish after using this
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);

   if(target==NULL())
   {
     target = getentityproperty(self, "grabbing");
     setlocalvar("Target" + self, target);
   }
   if(target!=NULL())
   {
     damageentity(target, self, 1, iDrop, openborconstant("ATK_NORMAL7")); // Slam Starter
   }
}
 
I just tried that and the problem still persists for some odd reason.
I suggest checking if your version of the @cmd position is possibly doing 1 damage too, plus try to remove all the attack boxes to see if it solves the problem.
Certainly this damage is coming from somewhere, but I never had this issue coming from the scripted grabs. You may have other scripts interfering.
 
I suggest checking if your version of the @cmd position is possibly doing 1 damage too, plus try to remove all the attack boxes to see if it solves the problem.
Certainly this damage is coming from somewhere, but I never had this issue coming from the scripted grabs. You may have other scripts interfering.
Alright, I'll double-check the position cmds for my enemies/players.

In the meantime, here's the script I used for position if it helps with more context, I changed the damage values to 0 there as well but to no avail thus far:


Code:
void position(int tFrame, float dx, float dy, float dz, int face, void noWeight)
{//Modify grabbed entity's position relative to grabber
 //Use grabstart 1st before using this
    void self        = getlocalvar("self");
    void target        = getentityvar(self,"grabbed");
    int dead        = getentityproperty(target,"dead");

    //THERE'S A NEW TARGET SAVED IN THE VARIABLE??
    if(target != NULL()){

        //USED WHEN PLAYER DIES BY TIME OVER AND THE GRABBER IS THE ENEMY
        if(dead){
            bindentity(target, NULL());
            damageentity(target, self, 0, 0, openborconstant("ATK_NORMAL"));
            damageentity(self, self, 0, 0, openborconstant("ATK_NORMAL"));
            setentityvar(self, "grabbed", NULL());
        }else
       
        //DEFAULT
        {
            updateframe(target, tFrame);
            bindentity(target, self, dx, dz, dy, face, 0);
        }
    }
}
 
Alright, I'll double-check the position cmds for my enemies/players.

In the meantime, here's the script I used for position if it helps with more context, I changed the damage values to 0 there as well but to no avail thus far:


Code:
void position(int tFrame, float dx, float dy, float dz, int face, void noWeight)
{//Modify grabbed entity's position relative to grabber
 //Use grabstart 1st before using this
    void self        = getlocalvar("self");
    void target        = getentityvar(self,"grabbed");
    int dead        = getentityproperty(target,"dead");

    //THERE'S A NEW TARGET SAVED IN THE VARIABLE??
    if(target != NULL()){

        //USED WHEN PLAYER DIES BY TIME OVER AND THE GRABBER IS THE ENEMY
        if(dead){
            bindentity(target, NULL());
            damageentity(target, self, 0, 0, openborconstant("ATK_NORMAL"));
            damageentity(self, self, 0, 0, openborconstant("ATK_NORMAL"));
            setentityvar(self, "grabbed", NULL());
        }else
     
        //DEFAULT
        {
            updateframe(target, tFrame);
            bindentity(target, self, dx, dz, dy, face, 0);
        }
    }
}
I see that you are using the same grab scripts I posted some time ago, honestly in my SORX game it never happened. I suggest checking other scripts like didhit, ondoattack and takedamage.
 
I see that you are using the same grab scripts I posted some time ago, honestly in my SORX game it never happened. I suggest checking other scripts like didhit, ondoattack and takedamage.
One of the only other scripts that my enemies use often (outside of bosses), is a script that just has essential functions such as "dasher", "leaper", "spawn01-05", etc.
 
One of the only other scripts that my enemies use often (outside of bosses), is a script that just has essential functions such as "dasher", "leaper", "spawn01-05", etc.
Try to gradually remove every feature individually like scripts, attack boxes, etc until the damage does not occur. Try it in a very simple throw/slam animation with just the @cmd grabstart/position and with one or two frames, plus remove most script events too.
This way you will gradually filter until you isolate where the problem possibly is.
 
Try to gradually remove every feature individually like scripts, attack boxes, etc until the damage does not occur. Try it in a very simple throw/slam animation with just the @cmd grabstart/position and with one or two frames, plus remove most script events too.
This way you will gradually filter until you isolate where the problem possibly is.

Ok so, uh, looking back at the scripts. Turns out I changed the values from 1 to 0 in terms of damage for majority of the functions... except for the "@cmd slamstart", which turned out to be a fundamental part of using the grabscript... o_O

But hey, it's working and so far, I don't see any -1 damage ticks when I use a grab/slam. Thank you @Kratus for being so patient and helpful with me. 😅

My only worry is that since I tinkered a good deal with the slam/grab scripts, I may have unknowingly set myself up for a future bug for all I know, but everything seems good for now.
 
Ok so, uh, looking back at the scripts. Turns out I changed the values from 1 to 0 in terms of damage for majority of the functions... except for the "@cmd slamstart", which turned out to be a fundamental part of using the grabscript... o_O

But hey, it's working and so far, I don't see any -1 damage ticks when I use a grab/slam. Thank you @Kratus for being so patient and helpful with me. 😅

My only worry is that since I tinkered a good deal with the slam/grab scripts, I may have unknowingly set myself up for a future bug for all I know, but everything seems good for now.
No problem buddy, glad the problem is solved :)
 
Back
Top Bottom