Solved Grab attack question.

Question that is answered or resolved.

DD Tokki

Well-known member
grab.PNG

I'd like to know how to keep a captured enemy standing without knocking it down when performing a finishing attack.
 
View attachment 4195

I'd like to know how to keep a captured enemy standing without knocking it down when performing a finishing attack.
@DD Tokki

I'm using a similar feature for Max during the grab jump move. In case the player didn't perform any attack, he will release the opponent in an idle instance as soon as reaches the ground. You could maybe adapt the script to fit in your game.

C:
anim vault #GRAB JUMP FRONT
    energycost 0 1 6
    loop    0
    delay    12
    offset    150 187
    @cmd sound "data/sounds/sor3_jumping.wav"
    @cmd grabStart
    @cmd position 0 30 0 0 0
    frame    data/chars/heroes/max/grabjump00.png
    @cmd leaper 0 2.4 0
    @cmd keyMove 1 0
    frame    data/chars/heroes/max/grabjump01.png
    frame    data/chars/heroes/max/grabjump01.png
        delay    2
    frame    data/chars/heroes/max/grabjump01.png
    @cmd landFrame
        delay    8
    @cmd sound "data/sounds/sor3_jumpland.wav"
    frame    data/chars/heroes/max/grabjump00.png
    @cmd grabEnd
    frame    data/chars/heroes/max/grabjump00.png
    @cmd clearL
    frame    data/chars/heroes/max/grabjump00.png

C:
void grabEnd()
{//End grab jump and free enemy on the ground if no attack is performed (MAX GRAB JUMP)
    void self    = getlocalvar("self");
    void target    = getentityvar(self,"grabbed");
    int dead    = getentityproperty(target,"dead");

    if(target != NULL()){

        //USED WHEN PLAYER DIES BY TIME OVER AND THE GRABBER IS THE ENEMY
        if(dead){
            finishGrab();
            setentityvar(self, "grabbed", NULL());
        }else

        //DEFAULT
        {
            changeentityproperty(target,"damage_on_landing",0);
            changeentityproperty(target,"aiflag","projectile",0);
            changeentityproperty(target,"aiflag","falling",0);
            changeentityproperty(target,"aiflag","drop",0);
            changeentityproperty(target,"aiflag","frozen", 0); //USED TO AVOID GRAB INTERRUPTION WHEN THE NODROPEN IS OFF AND ANY PLAYER IS RESPAWNED
            changeentityproperty(target,"takeaction", "common_animation_normal");
            setidle(target);
            finishGrab();
            setentityvar(self, "grabbed", NULL());
        }
    }
}

 
@DD Tokki

I'm using a similar feature for Max during the grab jump move. In case the player didn't perform any attack, he will release the opponent in an idle instance as soon as reaches the ground. You could maybe adapt the script to fit in your game.

C:
anim vault #GRAB JUMP FRONT
    energycost 0 1 6
    loop    0
    delay    12
    offset    150 187
    @cmd sound "data/sounds/sor3_jumping.wav"
    @cmd grabStart
    @cmd position 0 30 0 0 0
    frame    data/chars/heroes/max/grabjump00.png
    @cmd leaper 0 2.4 0
    @cmd keyMove 1 0
    frame    data/chars/heroes/max/grabjump01.png
    frame    data/chars/heroes/max/grabjump01.png
        delay    2
    frame    data/chars/heroes/max/grabjump01.png
    @cmd landFrame
        delay    8
    @cmd sound "data/sounds/sor3_jumpland.wav"
    frame    data/chars/heroes/max/grabjump00.png
    @cmd grabEnd
    frame    data/chars/heroes/max/grabjump00.png
    @cmd clearL
    frame    data/chars/heroes/max/grabjump00.png

C:
void grabEnd()
{//End grab jump and free enemy on the ground if no attack is performed (MAX GRAB JUMP)
    void self    = getlocalvar("self");
    void target    = getentityvar(self,"grabbed");
    int dead    = getentityproperty(target,"dead");

    if(target != NULL()){

        //USED WHEN PLAYER DIES BY TIME OVER AND THE GRABBER IS THE ENEMY
        if(dead){
            finishGrab();
            setentityvar(self, "grabbed", NULL());
        }else

        //DEFAULT
        {
            changeentityproperty(target,"damage_on_landing",0);
            changeentityproperty(target,"aiflag","projectile",0);
            changeentityproperty(target,"aiflag","falling",0);
            changeentityproperty(target,"aiflag","drop",0);
            changeentityproperty(target,"aiflag","frozen", 0); //USED TO AVOID GRAB INTERRUPTION WHEN THE NODROPEN IS OFF AND ANY PLAYER IS RESPAWNED
            changeentityproperty(target,"takeaction", "common_animation_normal");
            setidle(target);
            finishGrab();
            setentityvar(self, "grabbed", NULL());
        }
    }
}

thank you
When I write the grabEnd code in the script, the game stops and I can't proceed.
Is it correct to do it in animationscript?

animationscript data/scripts/script.c
 
When I write the grabEnd code in the script, the game stops and I can't proceed.
You need to adapt the script to use the variables and functions related to the grab system in your game. For example, the finishGrab() is similar to the @cmd finish and the getentityvar(self,"grabbed") is similar to the getlocalvar("target"+self).

animationscript data/scripts/script.c
Yes, this is correct.
 
Back
Top Bottom