special grabs (avoid grab items)

dantedevil

Well-known member
Hello!

I create a few special grabs, air grabs and ground grabs in freespecials.
The grabs works perfect, the only problem is heros grab items like an enemy.

Haw can avoid this?

I have a script courtesy of Bloodbane to avoid grab Bosses. Its possible change this script to avoid grab this bosses and items?

Here the script:
Code:
 void cancelgrab()
{// Check grabbed opponent's name
// If it's forbidden to grab him/her, revert to IDLE
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);

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

     if(Tname == "Goro" || Tname == "Kintaro" || Tname == "Motaro" || Tname == "Kimokahn")
     {
       setidle(self);
     }
   }
}
 
I haven't tested it and I am not very experienced with it, but I THINK it should work and I will try my best.

You need to check if the target is an item or obstacle, like this:

void cancelgrab()
{// Check grabbed opponent's name
// If it's forbidden to grab him/her, revert to IDLE
  void self = getlocalvar("self");
  void target = getlocalvar("Target" + self);

  if(target==NULL())
  {
    target = getentityproperty(self, "opponent");
    setlocalvar("Target" + self, target);
  }
  if(target!=NULL())
  {
    char Tname = getentityproperty(target, "defaultname");
    char iType = getentityproperty(target, "type");

    if(Tname == "Goro" || Tname == "Kintaro" || Tname == "Motaro" || Tname == "Kimokahn") || (iType == openborconstant("TYPE_OBSTACLE") || iType ==openborconstant("TYPE_ITEM"))
    {
      setidle(self);
    }
  }
}

As far as I undertstand, the logic is right. You just need if the syntax is right too.
Try it and post the result.
 
Thanks, but sorry dont work...

Actually this is mu version of cancel grab with modifications for Bloodbane to me.

Code:
void cancelgrab()
        {// Check grabbed opponent's name
        // If it's forbidden to grab him/her, revert to IDLE
           void self = getlocalvar("self");
           void target = getlocalvar("Target" + self);

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

             if(Tname == "GORO" || Tname == "KINTARO" || Tname == "MOTARO" || Tname == "KIMOKAHN")
             {
                 changeentityproperty(self, "animation", openborconstant("ANI_FREESPECIAL15"));
             }
           }
        }
 
The syntax is almost right, use openborconstant("TYPE_OBSTACLE") instead of "TYPE_OBSTACLE" and openborconstant("TYPE_item") instead of "TYPE_item".
 
Not work.

Here the script with your update:
Code:
void cancelgrab()
        {// Check grabbed opponent's name
        // If it's forbidden to grab him/her, revert to IDLE
           void self = getlocalvar("self");
           void target = getlocalvar("Target" + self);

           if(target==NULL())
           {
             target = getentityproperty(self, "opponent");
             setlocalvar("Target" + self, target);
           }
           if(target!=NULL())
           {
             char Tname = getentityproperty(target, "defaultname");
             char iType = getentityproperty(target, "type");

             if(Tname == "GORO" || Tname == "KINTARO" || Tname == "MOTARO" || Tname == "KIMOKAHN") || (iType == openborconstant("TYPE_OBSTACLE") || iType ==openborconstant("TYPE_ITEM"))
             {
                 changeentityproperty(self, "animation", openborconstant("ANI_FREESPECIAL15"));
             }
           }
        }

Here the error log:
Script error: data/scripts/grabscript.c, line 776: Unknown error '||' (in production 'stmt')

            if(Tname == "GORO" || Tname == "KINTARO" || Tname == "MOTARO" || Tname == "KIMOKAHN") || (iType == openborconstant("TYPE_OBSTACLE") || iType ==openborconstant("TYPE_ITEM"))
                                                                                                  ^



Script error: data/scripts/grabscript.c, line 777: Invalid function call or expression '{' (in production 'postfix_expr2')

            {
            ^



Script error: data/scripts/grabscript.c, line 778: Unknown error ';' (in production 'stmt_list2')

                changeentityproperty(self, "animation", openborconstant("ANI_FREESPECIAL15"));
                                                                                              ^



Script error: data/scripts/grabscript.c, line 781: Invalid external declaration '}' (in production 'external_decl')

        }
 
Here is:

Code:
void cancelgrab()
        {// Check grabbed opponent's name
        // If it's forbidden to grab him/her, revert to IDLE
           void self = getlocalvar("self");
           void target = getlocalvar("Target" + self);

           if(target==NULL())
           {
             target = getentityproperty(self, "opponent");
             setlocalvar("Target" + self, target);
           }
           if(target!=NULL())
           {
             char Tname = getentityproperty(target, "defaultname");
             char iType = getentityproperty(target, "type");

             if(Tname == "GORO" || Tname == "KINTARO" || Tname == "MOTARO" || Tname == "KIMOKAHN" || iType == openborconstant

("TYPE_OBSTACLE") || iType ==openborconstant("TYPE_ITEM"))
             {
                 changeentityproperty(self, "animation", openborconstant("ANI_FREESPECIAL15"));
             }
           }
        }

 
Thanks Lagarto, works perfect!

Maybe you can help with this now:

Can you show me how make a script attack to hit all on screen for this 4 attacks?

Attack30 - Burn - Shock - Attack17

Thanks.
 
Dantedevil, could you provide more details?

I mean, is it a player atacking all enemies, npcs and obstacles on screen?
 
You could try this animationscript:

Code:
void damage_all_enemies(int damage, int drop, void atk_type)
{

 	int  iEntity; 
        void vEntity;
        void self        = getlocalvar("self");
        int  iMax        = openborvariant("ent_max");   
       
        


        for(iEntity=0; iEntity<iMax; iEntity++)
        {

        
        vEntity = getentity(iEntity);
		if(getentityproperty(vEntity, "type")==openborconstant("TYPE_enemy"))
		{
		
		damageentity(vEntity,self,damage,drop,openborconstant(atk_type));

	
		}

	}
		




}

damage: well, it's the damage

Drop:
0 = non knockdown
1 = knockdown


Atk_type:
Shock = "ATK_SHOCK"
Burn  = "ATK_BURN"
attack17 = "ATK_NORMAL17"
Attack30 = "ATK_NORMAL30"

*with my openbor version (3849), ATK_NORMAL above 10 doesn't work even if I set at models.txt

example:

Code:
anim attack1

        @cmd  	damage_all_enemies 20 1 "ATK_shock"
	delay	3
	offset	94 145
	bbox	79 53 32 85
	frame	data/chars/Dragon/pg38.gif
	offset	63 151
	bbox	61 55 17 70
	
	delay	8
	frame	data/chars/Dragon/attack1.gif
	offset	94 145
	bbox	79 53 32 85
	delay	3
	attack	0
	frame	data/chars/Dragon/pg38.gif



 
Works perfect my friend!!!
Thanks!

I only change the number  of attacks under of 10 and all its ok.

Its possible update the staydown feature with this script?
 
Well, you could add a parameter for staydown there, something like this:

Code:
void damage_all_enemies(int damage, int drop,int stay,  void atk_type)
{

 	int  iEntity; 
        void vEntity;
        void self        = getlocalvar("self");
        int  iMax        = openborvariant("ent_max");   
       
        


        for(iEntity=0; iEntity<iMax; iEntity++)
        {

        
        vEntity = getentity(iEntity);
		if(getentityproperty(vEntity, "type")==openborconstant("TYPE_enemy"))
		{
		
		damageentity(vEntity,self,damage,drop,openborconstant(atk_type));
		changeentityproperty(vEntity, "staydown", "rise", stay);

	
		}

	}
		




}

example:

Code:
anim attack1

	delay	3
	offset	94 145
	bbox	79 53 32 85
	frame	data/chars/Dragon/pg38.gif
	offset	63 151
	bbox	61 55 17 70
	@cmd	damage_all_enemies 20 1 5000 "ATK_BURN"
	delay	8
	frame	data/chars/Dragon/attack1.gif
	offset	94 145
	bbox	79 53 32 85
	delay	3
	attack	0
	frame	data/chars/Dragon/pg38.gif
 
Works great my friend!

Thanks for everything.

I see in all scripts attack with staydown feature allways have only a set for rise, never for a riseattack.

This be very useful.
 
hehe, that is just a coincidence. With script, staydown has 3 subproperties: "rise" ,  "riseattack" and  "riseattack_stall" (no idea what that one do).

So, you can replace "rise" for "riseattack" (or even for "riseattack_stall" ) on that script, if you want to.
 
Back
Top Bottom