Grab script bug

Toranks

Active member
If a enemy grabs me, and hits any other player or NPC with this grab, when the enemy releases me or I releases myself pussing buttons, the player or NPC hitten teleports to my position, and I remain frozen.
On this video can be seen how the boss with the mask hits the white NPC while grabbing me. When I releases myself, the NPC teleports to where I should be released.

Any ideas where or what script to look for the bug? slamstart script? finish script?
 
Hello, in Your video Character stay on character and cant movie? it is a bug? If yes, or if no, anyway please make reserve arhive all of the files and upload somewhere if You can.
 
Looks like the issue is when you hit someone your opponent changes.  Make sure the hit box for this move is on the grabbed entity and not on the grabbing entity.
 
msmalik681 said:
Looks like the issue is when you hit someone your opponent changes.  Make sure the hit box for this move is on the grabbed entity and not on the grabbing entity.

I can't do this because the grabbed entity is always a fall7 animation with differents positions used by slamstart. If I give to this animation an attack box, this applies for all slamstarts, and I do not want this.
I think the cause must be in the slamstart or finish script programming, but I'm not sure. (On the video the grab is using slamstart2)

Code:
void slamstart()
{ // Slam Starter for grab slams
// Use finish or throw 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, 0, 1, openborconstant("ATK_NORMAL7")); // Slam Starter
   }
}

void slamstart2()
{ // Slam Starter for nongrab slams
// Use finish or throw after using this
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);

   if(target==NULL())
   {
     target = getentityproperty(self, "opponent");
     setlocalvar("Target" + self, target);
   }
   if(target!=NULL())
   {
     damageentity(target, self, 0, 1, openborconstant("ATK_NORMAL7")); // Slam Starter
   }
}


void slamstart3()
{ // Slam Starter for nongrab slams release if obstacle 
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);


   if(target==NULL())
   {
     target = getentityproperty(self, "opponent");
     setlocalvar("Target" + self, target);
   }

   if(target!=NULL())
   {

	if(getentityproperty(target, "type")==openborconstant("TYPE_OBSTACLE"))
	{
    	performattack(self, openborconstant("ANI_PAIN"));
	bindentity(target, NULL());
	}
	else
   	{
     	damageentity(target, self, 0, 1, openborconstant("ATK_NORMAL7")); // Slam Starter
   	}
  }
}


void finish(int Damage, int Type, int x, int y, int z, int Face)
{ // Damage as slam finisher
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);
   int SDir = getentityproperty(target,"direction");
   int MDir;

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

   if(Face==1){ // Opposite facing?

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

   if(target==NULL())
   {
     target = getentityproperty(self, "grabbing");
     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(Type==1)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL")); // 1st Finisher
     }

     if(Type==2)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL9")); // 2nd Finisher
     }

     tossentity(target, y, x, z); // Toss opponent ;)
     changeentityproperty(target, "direction", MDir);

     setlocalvar("Target"+self, NULL()); //Clears variable
   }
}
 
This happens becaus when you hit, you break the grab process, but the target was still valid on the attacker - this is why we use clearL function.

You can try to add this on the pain animation just to check it if will work.
@cmd depost 0
@cmd clearL

But recently, I've changed my script functions from localvar to entityvar - they work way better for this, because I can reffer to them anytime.
 
O Ilusionista said:
This happens becaus when you hit, you break the grab process, but the target was still valid on the attacker - this is why we use clearL function.

You can try to add this on the pain animation just to check it if will work.
@cmd depost 0
@cmd clearL

But recently, I've changed my script functions from localvar to entityvar - they work way better for this, because I can reffer to them anytime.

On what pain animation? Fall7 animation of the player?
 
O Ilusionista said:
Put, for testing, on the boss pain animation.

On basic pain animation of the boss? I don't understand why but... It keeps happening the same.

I have discover that if the boss hits me while grabbing the NPC this bug doesn't happen, but it does if the boss grabs me, and hits the NPC with me.

 

Attachments

  • AOF - 0064.png
    AOF - 0064.png
    204.1 KB · Views: 7
WOW, that's unexpected.

Do you remember the fix you proposed to me on the other post about the crash?

Since I've added those lines, the grabbed character freezes for a second when this bug happens, and falls to the ground.
Instead of always being frozen and glued to the enemy, it is much better!
It would be perfect if I could get the complete launch animation and the grabbed character be thrown, but compared to years without solving this bug is a good advance!! Thanks!

Your fix:
http://www.chronocrash.com/forum/index.php?topic=5048.0
 
Back
Top Bottom