Attack variation when enemy is "stun/dizzy"

NED

Well-known member
My game system uses few stun anims :

"pain32"
"pain33"
"follow1"

I would like my run + A4 attack move to be replaced by a follow* if the enemy you're going to attack is one of these stun/dizzy anims.

How can I obtain this game mechanics?

Thanks
 
as a total guess you could try to add a keyscript when A4 is hit during a run check for any players in range if yes and they are stunned preform variation else preform normal attack.
 
msmalik681 said:
as a total guess you could try to add a keyscript when A4 is hit during a run check for any players in range if yes and they are stunned preform variation else preform normal attack.

Yes, this basically. Or instead of putting the check in keyscript you can put in on the first frame of the standard run + A4 animation. But keyscript is better, especially if this is a generic mechanic.
 
Thanks!
I finally used some edit of the PIN code I used before.

The idea is :
-put the comand on regular run attack's first frame (and 2nd too)
-The script detect if there is a close enemy in desired anims
-then it cancels to attack variation

Code:
void dizzdetc(void Ani , int RxMin, int RxMax, int Rz)
{// Checks closest enemy's animation & range
// If it's accepted, perform custom attack (ajout de differents "dizzy") - (les ajouter tous!!!) NE BINDE PAS a l'enemi
/*Originally smartbomb by
    Damon Vaughn Caskey
    07152008*/

    void self = getlocalvar("self");			//Caller.
    float x = getentityproperty(self, "x");
    float z = getentityproperty(self, "z");
    float b = getentityproperty(self, "base");
    void vEntity;                                       //Target entity placeholder.
    int  iEntity;                                       //Entity enumeration holder.
    int  iType;                                         //Entity type.
    int  iMax      = openborvariant("ent_max");         //Entity count.

    //Enumerate and loop through entity collection.
    for(iEntity=0; iEntity<iMax; iEntity++){
      vEntity = getentity(iEntity);                 //Get target entity from current loop.
      iType   = getentityproperty(vEntity, "type"); //Get target type.

      //Enemy type?
      if (iType == openborconstant("TYPE_ENEMY")){
        float Tx = getentityproperty(vEntity, "x");
        float Ty = getentityproperty(vEntity, "a");
	float Tz = getentityproperty(vEntity, "z");
	void EAnim = getentityproperty(vEntity, "animationID");
        int EHealth = getentityproperty(vEntity, "health");

        if( (EAnim == openborconstant("ANI_PAIN32") || EAnim == openborconstant("ANI_PAIN33") || EAnim == openborconstant("ANI_FOLLOW1")) && Ty == b && EHealth > 0){
          float Disx = Tx - x;
          float Disz = Tz - z;

          if(Disz < 0){
            Disz = -Disz;
          }

          if( (Disx >= RxMin && Disx <= RxMax && Disz <= Rz) || (Disx >= -RxMax && Disx <= -RxMin && Disz <= Rz)){
            performattack(self, openborconstant(Ani));
          }
        }
      }
    }
}

Seems to be OK.
Don't hesitate to say if you feel it weird, or can provoke problems in particular situations.
 
What the...? Why in the world would you be using my smartbomb code to do this? That script loops over every entity currently in play - completely pointless for what you are doing.

I actually wrote a function for Mr. Q specifically to do what you are asking. I'll see if I can dig it up for you.

DC
 
I knew it was not a regular use for it  :-\
Initially your Smart bomb code have been edited to become a pin move with the help of BB

Damon Caskey said:
I actually wrote a function for Mr. Q specifically to do what you are asking. I'll see if I can dig it up for you.

DC

Yes, if you can share me this, I'll be pleased to use it.
 
After checking this previous code again.
Sure it looks not appropried for what I try to do.

So your different code is welcome

magggas said:
Exactly this can do the ani0020.h script which i think he is already using  ;)
I would totally use this script, but It can't allow multiple pain anim detect to activate :-\

Code:
#include "data/scripts/ani0009.h"

int ani0020(int iAni, int iTAni){
    
	/*
	ani0020
	Damon Vaughn Caskey
	Perform alternate animation if target is within range and in specified animation.

	iAni:	Alternate attack.
	iTAni:	Target animation.
	*/

    void vSelf      = getlocalvar("self");					//Caller.                                                         
    void vOpp       = findtarget(vSelf, iAni);				//Nearest target in range of alternate attack.
	
	if (vOpp)												//Found a target?
	{
		if(getentityproperty(vOpp, "animationID") == iTAni)	//Animation match?
		{
			ani0009(vSelf, iAni, 0);						//Perform alternate attack.
			return 1;										//Return 1.
		}
	}

	return 0;												//Return 0.
}

Also, how to define the range allowed to activate the move variation?
Thanks
 
For the moment, I'm using DC's ani0020 script.
But since I don't know how to make it allowing multiple enemy anims to trigger, I use it 3 times.

I know this is certainly not the correct way.
Code:
anim	freespecial18
	damageonlanding 0 1
	forcedirection	-1
	jugglecost	6
	subentity	dus
	spawnframe	3 0
	loop	0
	delay	5
	offset	96 177
#CANCEL TO DIZZY RUN ATTACK (optional)
#      @cmd dizzdetc "ANI_FREESPECIAL59" -65 110 10#-65 65 10#xmin/xmax /zwidth(up-dwn)(OLD)
      @cmd ani0020 openborconstant("ANI_FREESPECIAL59") openborconstant("ANI_PAIN32")#P1 go to (X), if enemy is (X)
      @cmd ani0020 openborconstant("ANI_FREESPECIAL59") openborconstant("ANI_PAIN33")#P1 go to (X), if enemy is (X)
      @cmd ani0020 openborconstant("ANI_FREESPECIAL59") openborconstant("ANI_FOLLOW1")#P1 go to (X), if enemy is (X)
	bbox	72 80 48 98
...
...
...

If so, I'll be pleased to know how to compile it in one function.
Also how to add the possibility to handle range? (so the script works only in the specified range)

Thanks
 
That's the one to use. Sorry it's taken me so long, I'm in process of moving right now.

Using it multiple times per frame is exactly how you set up for more alternates, so actually you are doing it right.

As for range, the function uses the alternate animation's range settings - that is intentional behavior. Just adjust the range of the alternate animation to suit your needs.

DC
 
Back
Top Bottom