Could someone further explain Anim upper

PS_VITA

Active member
Hi, could someone please elaborate on how Anim upper is used and does it always require for the player to jump? Is there a similar function that does not require the player jump?

I'm trying to add a random value for enemies to defend themselves when the player performs running attacks.  Currently the A.i isn't fast or smart enough to avoid getting hit by them. (Hence I was looking into anim upper)

 
PS VITA said:

PS VITA,

Anim Upper plays when all the following conditions are met:

1. The entity is AI controlled.
2. The entity is in idle state.
3. There is hostile target in the Range of Upper.
4. The target is in a jump state.

That's pretty much it. It's a legacy functionality and has no equivalent elsewhere.

I'd open up Bloodbane's Crime Busters module. IIRC it has some good examples of reactionary AI.

DC
 
I have some ideas in mind such as making enemies immune to runattack, reducing damage from runattack and making runattack less reliable. That's similar to Ilu Tips about balancing enemies attack but instead it's used to balance players runattack.

However, do you worry so much that runattack could destroy enemies? IMO regular enemies such as Galsias and Dugs don't need protection from runattacks.
For bosses, some bosses are really hard to touch let alone to combo (Yamato, Stray and Moguralian King) so attacking them with runattack is good and being able to hit them feels really good  8).
 
Bloodbane said:
I have some ideas in mind such as making enemies immune to runattack, reducing damage from runattack and making runattack less reliable. That's similar to Ilu Tips about balancing enemies attack but instead it's used to balance players runattack.

However, do you worry so much that runattack could destroy enemies? IMO regular enemies such as Galsias and Dugs don't need protection from runattacks.
For bosses, some bosses are really hard to touch let alone to combo (Yamato, Stray and Moguralian King) so attacking them with runattack is good and being able to hit them feels really good  8).

I started by making the run attack have a shorter hit box and it's working okay, but I wanted the enemies to duck in say 45% of the time when they see the player performing a run attack.

I still need to download the crime busters module.

Thanks.
 
but I wanted the enemies to duck in say 45% of the time when they see the player performing a run attack.

I've done trial n error to get that effect and finally I got this ondoattackscript:
Rundodger.c
Code:
void main()
{// Dodges runattack with 45% chance
// Only performed if enemy is in IDLE or WALK
// When he/she dodges, he/she will perform FOLLOW4 animation
    void self = getlocalvar("self"); //Get calling entity.
    void target = getentityproperty(self,"opponent");
    void Anim = getentityproperty(self, "animationID");
    void EAnim = getentityproperty(target, "animationID");
    int r = rand()%50 + 50;

    if(EAnim == openborconstant("ANI_RUNATTACK") && r > 55 && (Anim == openborconstant("ANI_IDLE") || Anim == openborconstant("ANI_WALK"))){
      changeopenborvariant("lasthitc", 0);
      changeentityproperty(self, "velocity", 0, 0);
      performattack(self, openborconstant("ANI_FOLLOW4"));
    }
}

Declare that in enemy's header text with this:
ondoattackscript data/scripts/rundodger.c

I've tested this myself and enemies can dodge runattack perfectly with this script  8) (if conditions are met).
This script has one flaw though : enemy needs to interact with player 1st before it works.
I have ideas on how to solve that flaw but for now, you can try that script :).
 
Bloodbane said:
but I wanted the enemies to duck in say 45% of the time when they see the player performing a run attack.

I've done trial n error to get that effect and finally I got this ondoattackscript:
Rundodger.c
Code:
void main()
{// Dodges runattack with 45% chance
// Only performed if enemy is in IDLE or WALK
// When he/she dodges, he/she will perform FOLLOW4 animation
    void self = getlocalvar("self"); //Get calling entity.
    void target = getentityproperty(self,"opponent");
    void Anim = getentityproperty(self, "animationID");
    void EAnim = getentityproperty(target, "animationID");
    int r = rand()%50 + 50;

    if(EAnim == openborconstant("ANI_RUNATTACK") && r > 55 && (Anim == openborconstant("ANI_IDLE") || Anim == openborconstant("ANI_WALK"))){
      changeopenborvariant("lasthitc", 0);
      changeentityproperty(self, "velocity", 0, 0);
      performattack(self, openborconstant("ANI_FOLLOW4"));
    }
}

Declare that in enemy's header text with this:
ondoattackscript data/scripts/rundodger.c

I've tested this myself and enemies can dodge runattack perfectly with this script  8) (if conditions are met).
This script has one flaw though : enemy needs to interact with player 1st before it works.
I have ideas on how to solve that flaw but for now, you can try that script :).

This is so awesome!

Hey - I just found out that on the double dragon module the "run attack" is actually a freespecial
would it work with your script if I change  " EAnim == openborconstant("ANI_RUNATTACK") " to "EAnim == openborconstant("ANI_FREESPECIAL66") "
 
PS VITA said:
Hey - I just found out that on the double dragon module the "run attack" is actually a freespecial
would it work with your script if I change  " EAnim == openborconstant("ANI_RUNATTACK") " to "EAnim == openborconstant("ANI_FREESPECIAL66") "

Try it yourself :).

Ilu said:
you can try using "findtarget" it there is no opponent.

Thanks for the tip.
I had doubt about its effectiveness when there are 2 or more players. Buuut on second thought, if findtarget picked wrong player causing enemy to fail dodging runattack, let's just say enemy is confused ;D.
 
Bloodbane said:
PS VITA said:
Hey - I just found out that on the double dragon module the "run attack" is actually a freespecial
would it work with your script if I change  " EAnim == openborconstant("ANI_RUNATTACK") " to "EAnim == openborconstant("ANI_FREESPECIAL66") "

Try it yourself :).

It didn't work
 
It's hard to tell the cause since the script works with 45% chance so you should try with 100% chance version.

But before that,
I had doubt about its effectiveness when there are 2 or more players

After more thought, I realized that the 1st version isn't effective during multiplayer also (even without the flaw) sooo I'll post the updated version which fixed the flaw.
Code:
void main()
{// Dodges runattack with 45% chance
// Only performed if enemy is in IDLE or WALK
// When he/she dodges, he/she will perform FOLLOW4 animation
    void self = getlocalvar("self"); //Get calling entity.
    void Anim = getentityproperty(self, "animationID");

    if(Anim == openborconstant("ANI_IDLE") || Anim == openborconstant("ANI_WALK")){
      void target = findtarget(self);
      void EAnim = getentityproperty(target, "animationID");
      int r = rand()%50 + 50;

      if(EAnim == openborconstant("ANI_RUNATTACK") && r > 55){
        changeopenborvariant("lasthitc", 0);
        changeentityproperty(self, "velocity", 0, 0);
        performattack(self, openborconstant("ANI_FOLLOW4"));
      }
    }
}

You set range in enemy's IDLE and WALK like this:
Code:
anim	idle
	range	0 150
	rangez	-15 15
...

anim	walk
	range	0 150
	rangez	-15 15
...

For testing purpose, here's the 100% chance version:
Code:
void main()
{// Dodges runattack
// Only performed if enemy is in IDLE or WALK
// When he/she dodges, he/she will perform FOLLOW4 animation
    void self = getlocalvar("self"); //Get calling entity.
    void Anim = getentityproperty(self, "animationID");

    if(Anim == openborconstant("ANI_IDLE") || Anim == openborconstant("ANI_WALK")){
      void target = findtarget(self);
      void EAnim = getentityproperty(target, "animationID");
      int r = rand()%50 + 50;

      if(EAnim == openborconstant("ANI_RUNATTACK")){
        changeopenborvariant("lasthitc", 0);
        changeentityproperty(self, "velocity", 0, 0);
        performattack(self, openborconstant("ANI_FOLLOW4"));
      }
    }
}
 
*SIGHS*

I tried the 100% version with the new range parameters and it didn't work for me :(
My enemy tends to run alot as I'm trying to do the run attack.

how can I include a running state besides the idle and walk one?

Is it something like this?


Code:
if (Anim == openborconstant("ANI_RUN")  || openborconstant("ANI_IDLE") || Anim == openborconstant("ANI_WALK"))

how many parenthesis symbols at the end?

Code:
void main()
{// Dodges runattack
// Only performed if enemy is in IDLE or WALK
// When he/she dodges, he/she will perform FOLLOW animation
    void self = getlocalvar("self"); //Get calling entity.
    void Anim = getentityproperty(self, "animationID");

    if (Anim == openborconstant("ANI_RUN")  ||  (Anim == openborconstant("ANI_IDLE") || Anim == openborconstant("ANI_WALK")){
      void target = findtarget(self);
      void EAnim = getentityproperty(target, "animationID");
      int r = rand()%50 + 50;

      if(EAnim == openborconstant("ANI_FREESPECIAL66")){
        changeopenborvariant("lasthitc", 0);
        changeentityproperty(self, "velocity", 0, 0);
        performattack(self, openborconstant("ANI_FOLLOW60"));
      }
    }
}
 
Back
Top Bottom