Escaping from grab question

mtrain

New member
I am trying to make an escaping move from grabbing by enemy, by pressing special button. But player must perform an alternate special move. So what i make:

Players special:
Code:
anim special
	loop	0
	delay	10
	offset	155 138
	@cmd    bigcounter
	frame	data/chars/axel/x/1090.gif

And script:
Code:
void bigcounter()
{// counterattack from big grab
   void self = getlocalvar("self");
   int player = getlocalvar("player");
   void target = getentityproperty(self, "opponent");
   void EName = getentityproperty(target,"defaultname"); // Get enemies real name.
   int anim_id = getentityproperty(target, "animationid");

	if (EName == "Big" && anim_id == openborconstant("ANI_GRAB")){
 
 	changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW20"));
	}
}

The problem is that player still perform regular special move instead Follow20 while being grabbed. But if change enemies "ANI_GRAB", for example, to "ANI_FALL" or "ANI_WALK" player will perform Follow20.
Thank you)
 
That won't work cause player's animation clearly has changed
You should record grabbed state with entity variable or local variable then check this value in SPECIAL animation to perform counter
That's what I did in Crime Buster v2.5 to create ANTIGRAB with SPECIAL animation

Example from Athena:
anim special
@script
    if(frame == 0){
      void self = getlocalvar("self");
      if(getlocalvar("GSign" + self) != 1){
        changeentityproperty(self, "animation", openborconstant("ANI_FREESPECIAL4"));
      }
    }
@end_script
delay 3
        energycost 0
offset 51 152
frame data/chars/athena/sp201.gif
        sound  data/chars/athena/fx.wav
frame data/chars/athena/sp202.gif
        frame data/chars/athena/sp203.gif
frame data/chars/athena/sp204.gif
        frame data/chars/athena/sp205.gif
frame data/chars/athena/sp206.gif
        frame data/chars/athena/sp207.gif
        blast 10 5 80 153 10 1
frame data/chars/athena/sp208.gif
frame data/chars/athena/sp209.gif
        frame data/chars/athena/sp210.gif
frame data/chars/athena/sp211.gif
        frame data/chars/athena/sp210.gif
        frame data/chars/athena/sp209.gif
frame data/chars/athena/sp208.gif
frame data/chars/athena/sp207.gif
attack 0
        frame data/chars/athena/sp206.gif
frame data/chars/athena/sp205.gif
        frame data/chars/athena/sp204.gif
frame data/chars/athena/sp203.gif
        frame data/chars/athena/sp202.gif
frame data/chars/athena/sp201.gif

anim freespecial4
delay 1
        energycost 3
offset 33 95
        hitflash shock
        hitfx  data/sounds/jolted.wav
frame data/chars/athena/diem01.gif
delay 5
offset 67 143
        @cmd    limiter 3
frame data/chars/athena/spcial01.gif
        sound  data/chars/athena/aaaah.wav
frame data/chars/athena/spcial02.gif
        frame data/chars/athena/spcial03.gif
frame data/chars/athena/spcial04.gif
        frame data/chars/athena/spcial05.gif
frame data/chars/athena/spcial06.gif
        frame data/chars/athena/spcial07.gif
        damageonlanding 0 1
        attack17 3 9 131 152 10 1 1
        dropv  3 3 0
frame data/chars/athena/spcial08.gif
        frame data/chars/athena/spcial09.gif
frame data/chars/athena/spcial10.gif
        frame data/chars/athena/spcial11.gif
frame data/chars/athena/spcial12.gif
        frame data/chars/athena/spcial13.gif
frame data/chars/athena/spcial14.gif
        frame data/chars/athena/spcial15.gif
frame data/chars/athena/spcial16.gif
        frame data/chars/athena/spcial17.gif
frame data/chars/athena/spcial18.gif
        frame data/chars/athena/spcial19.gif
frame data/chars/athena/spcial20.gif
        frame data/chars/athena/spcial21.gif
frame data/chars/athena/spcial22.gif
        frame data/chars/athena/spcial23.gif
attack 0
        frame data/chars/athena/spcial04.gif
frame data/chars/athena/spcial03.gif
        frame data/chars/athena/spcial02.gif
frame data/chars/athena/spcial01.gif

Her SPECIAL is her ANTIGRAB while FREESPECIAL4 is her real special
In this example, I use local variable named "GSign" + self which is set in this animation:
anim grabbed
@script
    void self = getlocalvar("self");

    setlocalvar("GSign" + self, 1);
@end_script
offset 29 92
bbox 7 2 28 91
delay 25
frame data/chars/athena/pain01.gif

This local variable is reset in Athena's IDLE animation (together with other local variables)
 
That won't work cause player's animation clearly has changed
This is working, but, as i wrote earlier, not while enemy grabbing player

Thank you, BB, i am trying this right now)
And it is working well) Can you explain me what is "GSign" + self means?
 
Ok, i have test it and all works fine. I have modified a little your script, BB, and got next:

Code:
void biggrab(int Q)
{//gives a variable for checking bigcounter
    void self = getlocalvar("self");

    setlocalvar("GSign" + self, Q);	
}

Code:
void bigcounter()
{// counterattack from big grab
   void self = getlocalvar("self");

    if (getlocalvar("GSign" + self) != 1 && getlocalvar("GSign" + self) != 2){
        changeentityproperty(self, "animation", openborconstant("ANI_FREESPECIAL8"));//Real special
      }

	if (getlocalvar("GSign" + self) == 1 ){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW25"));//Escape from big grab1
      }

	if (getlocalvar("GSign" + self) == 2 ){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW26"));//Escape from big grab2
      }

  }

But i get a next problems. How to make enemy to perform a grab.
1st problem is: enemy have a several close ranged attacks, so a chance to perform a regular GRAB move is very low. So how to make enemy perform a regular grab? I tried dograb script in combination attack->followcond->follow which have a dograb script but OpenBOR crushes every time when dograb script starts. Here it is:

Code:
void dograb()
{
void self;
void target;
int d;
int x;
int y;
int z;
int xadj;

/* Get self and target. */
self = getlocalvar("self");
target = getentityproperty(self, "opponent");

/* Get position and directional values. */
d = getentityproperty(self, "direction");
x = getentityproperty(self, "x");
y = getentityproperty(self, "a");
z = getentityproperty(self, "z");
xadj = 56;

/*Reverse X adjustment if facing left. */
if(!d) xadj = -xadj;

/* Set position adjustments */
x += xadj;
z -= 1;

/* Apply position adjustment to target. */
changeentityproperty(target, "position", x, z, y);

/* Apply grab*/
dograb(self, target, 0);
}

2nd problem is: Easier way to force enemy to perform slam is by using slamstart, position, depost, finish script pack. BUT while enemy holding player this way, none of the keys active until enemy release player. So question is how to make "escape from grab" move in this case? I search a forum and saw several threads where guys solve this, but i dont really get that, so i wrote here. Thank you.
 
1st problem is: enemy have a several close ranged attacks, so a chance to perform a regular GRAB move is very low. So how to make enemy perform a regular grab?

Even to this day, I don't know how to force enemy/player/npc to grabbing or grabbed state  :(
To solve attack vs grab problem, I simply adjust minimum attack range not lesser than grabdistance. For instance if enemy has close range attack who range is 0 60 and he/she also able to grab with grabdistance 30, I adjusted the attack's range to 30 60
 
Back
Top Bottom