custom grabcheck

Bloodbane said:
Hmm.... I think I need to confirm couple things first
- Are these functions for preventing player from grabbing certain enemies OR to set special response against certain enemies?
- Can Kimokahn, Goro, Kintaro or Motaro be grabbed?

Are to set special response against certain enemies.
And not, the bosses cant be grabbed. Only with some  attacks script the special bosses.
 
Well... i try some modifications and find something useful.

This is the normal animation, the animation 3 (freespecial 13) not work, goes to idle.
Code:
anim follow10
        delay   1
	offset	82 177
	bbox	69 76 37 103
	frame	data/chars/midas/at7b.png
        @cmd    grabcheckG "ANI_FREESPECIAL14" "ANI_FREESPECIAL15" "ANI_FREESPECIAL13"
	frame	data/chars/midas/at7b.png

anim freespecial13
	cancel 	16 19 0  s  freespecial16
	loop	0
        fastattack 1
	offset  82 177
	bbox	0 0 0 0
	delay   5
	frame	data/chars/midas/at7b.png
	delay   16
	frame	data/chars/midas/at7b.png
	delay	6
	frame	data/chars/midas/at1.png
	delay   10
	attack30  102 81 44 13 5 0 0 0 0
        seal    3 1
        nokill  1
	frame	data/chars/midas/at2.png
	attack  0 0 0 0
	delay   6
	frame	data/chars/midas/at1.png
	frame	data/chars/midas/at3.png
	delay   10
	attack30  102 81 44 13 5 0 0 0 0
        nokill  1
	frame	data/chars/midas/at4.png
	attack  0 0 0 0
	delay   6
	frame	data/chars/midas/at3.png
	frame	data/chars/midas/at1.png
	delay   10
	attack30  102 81 44 13 5 0 0 0 0
        nokill  1
	frame	data/chars/midas/at2.png
	attack  0 0 0 0
	delay   6
	frame	data/chars/midas/at1.png
	frame	data/chars/midas/at3.png
	delay   10
	attack30  102 81 44 13 5 0 0 0 0
        nokill  1
	frame	data/chars/midas/at4.png
	attack  0 0 0 0
	delay   6
	frame	data/chars/midas/at3.png
	delay   10
	frame	data/chars/midas/at2a.png
	attack30  123 104 25 14 5 0 1 0 20 
        nokill  1
	frame	data/chars/midas/at2b.png
	attack  0 0 0 0 0 0 0 0 0
	delay	10
	frame	data/chars/midas/break2.png
	delay	2
        sound   data/chars/midas/yaa.wav
	frame	data/chars/midas/break2.png
	frame	data/chars/midas/at5.png
        hitfx   data/sounds/beat2.wav
	attack30 77 78 49 47 5 1 0 0 10
        nokill  0
        staydown   200 300
        dropv   4 1 0 0
	frame	data/chars/midas/at6.png
	frame	data/chars/midas/at6.png
        attack  0 0 0 0
	sound   data/sounds/punch.wav
	frame	data/chars/midas/at7.png
	frame	data/chars/midas/at7.png
	frame	data/chars/midas/at8.png
	frame	data/chars/midas/at8.png
	delay   30
	frame	data/chars/midas/at8.png
	delay   5
	frame	data/chars/midas/at8.png
	delay	9
	frame	data/chars/midas/at7.png
	bbox	103 167 14 10
	frame	data/chars/midas/at6.png

The i try the next and work like i need:
Code:
anim follow10
        delay   1
	offset	82 177
	bbox	69 76 37 103
	frame	data/chars/midas/at7b.png
        @cmd    grabcheckG "ANI_FREESPECIAL14" "ANI_FREESPECIAL15" "ANI_FREESPECIAL13"
	frame	data/chars/midas/at7b.png
	cancel 	18 21 0  s  freespecial16
        fastattack 1
	bbox	0 0 0 0
	delay   5
	frame	data/chars/midas/at7b.png
	delay   16
	frame	data/chars/midas/at7b.png
	delay	6
	frame	data/chars/midas/at1.png
	delay   10
	attack30  102 81 44 13 5 0 0 0 0
        seal    3 1
        nokill  1
	frame	data/chars/midas/at2.png
	attack  0 0 0 0
	delay   6
	frame	data/chars/midas/at1.png
	frame	data/chars/midas/at3.png
	delay   10
	attack30  102 81 44 13 5 0 0 0 0
        nokill  1
	frame	data/chars/midas/at4.png
	attack  0 0 0 0
	delay   6
	frame	data/chars/midas/at3.png
	frame	data/chars/midas/at1.png
	delay   10
	attack30  102 81 44 13 5 0 0 0 0
        nokill  1
	frame	data/chars/midas/at2.png
	attack  0 0 0 0
	delay   6
	frame	data/chars/midas/at1.png
	frame	data/chars/midas/at3.png
	delay   10
	attack30  102 81 44 13 5 0 0 0 0
        nokill  1
	frame	data/chars/midas/at4.png
	attack  0 0 0 0
	delay   6
	frame	data/chars/midas/at3.png
	delay   10
	frame	data/chars/midas/at2a.png
	attack30  123 104 25 14 5 0 1 0 20 
        nokill  1
	frame	data/chars/midas/at2b.png
	attack  0 0 0 0 0 0 0 0 0
	delay	10
	frame	data/chars/midas/break2.png
	delay	2
        sound   data/chars/midas/yaa.wav
	frame	data/chars/midas/break2.png
	frame	data/chars/midas/at5.png
        hitfx   data/sounds/beat2.wav
	attack30 77 78 49 47 5 1 0 0 10
        nokill  0
        staydown   200 300
        dropv   4 1 0 0
	frame	data/chars/midas/at6.png
	frame	data/chars/midas/at6.png
        attack  0 0 0 0
	sound   data/sounds/punch.wav
	frame	data/chars/midas/at7.png
	frame	data/chars/midas/at7.png
	frame	data/chars/midas/at8.png
	frame	data/chars/midas/at8.png
	delay   30
	frame	data/chars/midas/at8.png
	delay   5
	frame	data/chars/midas/at8.png
	delay	9
	frame	data/chars/midas/at7.png
	bbox	103 167 14 10
	frame	data/chars/midas/at6.png

That not the idea for the original script,  but works.
I think be better a final correction in the script for Bloodbane.

 
Hmmm... if that's the case here's the updated functions:

void checkgrab(void target)
{ // Opponent Checker
// This script checks hero's current opponent. If he/she/it is Special Boss, returns 1, if he's Final Boss entity this function returns 0
// If he/she/it's just another enemy return 2, Otherwise it returns 3.

    if(getentityproperty(target, "type") == openborconstant("TYPE_ENEMY")){
      char Tname = getentityproperty(target, "defaultname");

      if(Tname == "KIMOKAHN" )
      { // Final Boss
        return 0;
      } else if(Tname == "GORO" || Tname == "KINTARO" || Tname == "MOTARO" )
      { // Special Bosses
        return 1;
      } else {
        return 2;
      }
    } else {
      return 3;
    }
}

void grabcheckG(void Ani1, void Ani2, void Ani3, void Ani4)
{ // Hero's groundgrab checker
// This script prevents hero from grabbing Bosses with the incorrect animation.
//  Ani1 = Animation to play if enemie is GORO, KINTARO, MOTARO
//  Ani2 = Animation to play if enemie is KIMOKAHN
//  Ani3 = Animation to play if enemy but not anyone on the mentioned characters
//  Ani4 = Animation to play if not enemy

    void self = getlocalvar("self");
    void target = getentityproperty(self, "opponent");

    if(target!=NULL()){

      if(getentityproperty(target, "a") == 0){
        int Check = checkgrab(target);

        if(Check == 0)
        {
          changeentityproperty(self, "animation", openborconstant(Ani2));
        } else if(Check == 1){
          changeentityproperty(self, "animation", openborconstant(Ani1));
        } else if(Check == 2){
          setlocalvar("Target" + self, target);
          changeentityproperty(self, "animation", openborconstant(Ani3));
        }
      } else {
        changeentityproperty(self, "animation", openborconstant(Ani4));
      }

    }
}

NOTE: I expanded grabcheckG with 4th parameter which defines animation to play if checked opponent is not enemy such as obstacle. So don't forget to define that parameter (doesn't matter if you'd like to define same animation)

HTH
 
Well, i set the 4th parameter and update the script.
Code:
anim follow10
        delay   1
	offset	82 177
	bbox	69 76 37 103
	frame	data/chars/midas/at7b.png
        @cmd    grabcheckG "ANI_FREESPECIAL14" "ANI_FREESPECIAL15" "ANI_FREESPECIAL13" "ANI_FREESPECIAL15"
	frame	data/chars/midas/at7b.png

Now Openbor crash...
Code:
Runtime error: argument count(3) doesn't match, check your function call: (null).
There's an exception while executing script 'animationscript' data/chars/midas/midas.txt

If i set only three parameters  with the update script in the animation the Openbor not crash but still go to the idle in the animation 3.
 
Yes, update the 2 files .
Code:
void grabcheckG(void Ani1, void Ani2, void Ani3, void Ani4)
{ // Hero's groundgrab checker
// This script prevents hero from grabbing Bosses with the incorrect animation.
//  Ani1 = Animation to play if enemie is GORO, KINTARO, MOTARO
//  Ani2 = Animation to play if enemie is KIMOKAHN
//  Ani3 = Animation to play if enemy but not anyone on the mentioned characters
//  Ani4 = Animation to play if not enemy

    void self = getlocalvar("self");
    void target = getentityproperty(self, "opponent");

    if(target!=NULL()){

      if(getentityproperty(target, "a") == 0){
        int Check = checkgrab(target);

        if(Check == 0)
        {
          changeentityproperty(self, "animation", openborconstant(Ani2));
        } else if(Check == 1){
          changeentityproperty(self, "animation", openborconstant(Ani1));
        } else if(Check == 2){
          setlocalvar("Target" + self, target);
          changeentityproperty(self, "animation", openborconstant(Ani3));
        }
      } else {
        changeentityproperty(self, "animation", openborconstant(Ani4));
      }

    }
}
Code:
void checkgrab(void target)
{ // Opponent Checker
// This script checks hero's current opponent. If he/she/it is Special Boss, returns 1, if he's Final Boss entity this function returns 0
// If he/she/it's just another enemy return 2, Otherwise it returns 3.

    if(getentityproperty(target, "type") == openborconstant("TYPE_ENEMY")){
      char Tname = getentityproperty(target, "defaultname");

      if(Tname == "KIMOKAHN" )
      { // Final Boss
        return 0;
      } else if(Tname == "GORO" || Tname == "KINTARO" || Tname == "MOTARO" )
      { // Special Bosses
        return 1;
      } else {
        return 2;
      }
    } else {
      return 3;
    }
}
 
dantedevil, something just crossed my mind. How many characters use grabcheckG function?
If you modified a function which is used by multiple characters, you must fix ALL of them.
 
So have you set 4 parameters to both of them? or I should say to all declared grabcheckG function in their text?
 
I check it and works, thanks!!!
You are Great!

I have a question now, one of the players have a freespecial make a little jump forward then grab the enemy spinning around the neck and smashing on the floor, like Alex in Rocket Viper 2.  In some ocations the enemy is in the air when the player grab him and not look good, its see like a force move.
I wanna make a modification of this cancelgrab courtesy of Lagarto, and make the hero perform cancel if the enemy is in the air.
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"));
             }
           }
        }
Its possible?

I think is the best solution.
 
I understand your problem but I think your solution is a waste

I believe it's best to just use grabcheckG function. That function is to prevent player from grabbing certain enemies AND also to prevent grabbing airborne enemies

 
Back
Top Bottom