Solved Followcond only if ienemy is killed by the attack

Question that is answered or resolved.

dantedevil

Well-known member
It´s possible create a followcond for it is only active if the enemy is killed by the attack?

Somethig like this (5º):

followcond {value}
This command is to make the entity performs FOLLOW{#} if an attackbox in the animation hits.
value determines the condition requirements before FOLLOW{#} is played.
1, this animation will followup as long as it hits an entity.

2, this animation will followup as long as it hits an enemy (Or player if an enemy uses it).

3, this animation will followup as long as it hits an enemy and the target does not get killed or block the attack.

4, this animation will followup as long as it hits an enemy, and the target is not killed, does not block the attack, and is not set to be ungrabbable.

5, this animation will followup as long as it hits an enemy, and the target is killed by the attack.

Which FOLLOW animation played is determined by 'followanim'.
 
Last edited:
Solution
No, I mean players need to use same animation for the fatality attempt

Anyways, here's what I've made yesterday, it's a didhitscript:

fatal.c

void main(){
    void self = getlocalvar("self");
    void vAniID = getentityproperty(self,"animationID");
    void target = getentityproperty(self,"opponent");
    int THealth;

    if(vAniID == openborconstant("ANI_FREESPECIAL4")){
      THealth = getentityproperty(target, "health");

      if(THealth <= 50){
        setentityvar(self, 0, "Kill");
      }
    }
}

Declare this script like this:

didhitscript data/scripts/fatal.c

This script works like this: if attackbox in FREESPECIAL4 connects, the connected opponent will be checked his/her/its HP. If it's...
NP, I'll move the topic.

As for Follow, no it does not have that functionality, and it will not be added in the future. Use the didhit event.

DC
 
didhit event is one of the script events that autofires in response to certain events.

Place this into your model file - exactly like an animation script:

Code:
didhitscript <name of your script file>

It fires whenever the entity hits something. I'm not at a PC where I can write you a code sample, but it would basically amount to looking at the damage vs. current HP and then acting accordingly.

DC




 
Ok, thanks.
I want use this to make a better way to implement the  fatalities.
The idea is the hero only perform certain animation if the attack kill the enemy.
So a example will be great to understand this.
Keep in mind this is only for enemies, so must exist a exception for items and obstacles.

I think this topic will be very useful to all people want create fatalities in their mods.
 
That's no problem at all - just add a check for the entity type. The didhit event was made specifically to handle cases like yours.

Incidentally, it also fires when an item is picked up - the item is treated as the attacker and whoever is getting item is the defender. This lets you script items to do whatever you like when picked up.

DC
 
I could think of a didhitscript for this purpose but I need to know something.
I assume that fatality works like this: when move connects, it will perform fatality if enemy HP is low enough to be finished by the attack but if HP is not low enough, the move only becomes non fatality. So that means fatality deals some damage which kills the enemy. The question is do everyone deal same damage in their fatality?
I asked this cause if everyone deal same damage, then I could make generic fatality didhitscript which checks current opponent's health. But if not, I'll have to make a rather simpler didhitscript and have each character check the health himself/herself
 
Thanks for your help BB!

I think the first option is perfect, everyone deal same damage in their fatality.
Because the attack for start the fatality is a grabattack, so the bosses have set CANTGRAB and no problem.

Thanks!
 
Good :)
I aim for generic fatality didhitscript to make it easier for you and me to use (it's waste to have different didhitscript for each character unless one or two has extra use)

Oh yes, in order to have generic didhitscript, you need to use same animation for the fatality attempt animation :)
 
No, I mean players need to use same animation for the fatality attempt

Anyways, here's what I've made yesterday, it's a didhitscript:

fatal.c

void main(){
    void self = getlocalvar("self");
    void vAniID = getentityproperty(self,"animationID");
    void target = getentityproperty(self,"opponent");
    int THealth;

    if(vAniID == openborconstant("ANI_FREESPECIAL4")){
      THealth = getentityproperty(target, "health");

      if(THealth <= 50){
        setentityvar(self, 0, "Kill");
      }
    }
}

Declare this script like this:

didhitscript data/scripts/fatal.c

This script works like this: if attackbox in FREESPECIAL4 connects, the connected opponent will be checked his/her/its HP. If it's 50 or below, entity variable (number 0) will be filled with simple line "Kill"

So what does this line for? the script in FREESPECIAL4 is the one who will take that line.
An example:
anim freespecial4
@script
    if(frame==3){
      void self = getlocalvar("self");
      void Hit = getentityvar(self, 0);

      if(Hit=="Kill"){
        setentityvar(self, 0, NULL());
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
      }
    }
@end_script
delay 15
offset 70 105
bbox 61 37 47 68
hitflash slash
hitfx data/sounds/slash.wav
        frame data/chars/ninja/slash1.png
delay 3
attack  25 49 125 10 0 0 1
        frame data/chars/ninja/slash2.png
attack  74 37 127 17 0 0 1
        frame data/chars/ninja/slash3.png
delay 10
attack  0
        frame data/chars/ninja/slash4.png

anim follow2
delay 10
offset 70 105
bbox 53 68 30 61
hitflash slash
hitfx data/sounds/slash.wav
        frame data/chars/ninja/bslash1.png
delay 5
attack  63 48 153 46 50 1
dropv 2 4 0
        frame data/chars/ninja/bslash2.png
        frame data/chars/ninja/bslash3.png
delay 10
attack  0
        frame data/chars/ninja/bslash4.png

Script in FREESPECIAL4 checks that entity variable. At 4th frame, if the message "Killed" is accepted, the animation will be changed to FOLLOW2
For your mod, you can change FREESPECIAL4 to same animation you use for fatality attempt, and FOLLOW2 to fatality animation. I also marked minimum HP for fatality in fatal.c script if you need to change the value

Ack, I just remembered that I forgot to check opponent type in this script  :'( . Alright, it should be simple fix, give me time to do it :D
 
Solution
Spectacular !!!
Simply fantastic my friend!

Works great, just had to adjust my mod, which was very easy.

Currently all my players had a freespecial 20 that could run only during grab. If the attack eliminated the enemy, triggered the fatality.
The enemy during the "anim death" fired an object, which could only hit the player who eliminated. And so triggered the fatality animation player. Too complex and certainly was not perfect, but it worked.
But it did not work, as your system obviously.

I close this topic and suggest that this is a direct contribution to the tutorials section for anyone wishing to implement fatalities in your mod.

Thank you very much friend!
 
You're welcome :D

Oh yes, here's the updated fatal.c which has type check:

Code:
void main(){
    void self = getlocalvar("self");
    void vAniID = getentityproperty(self,"animationID");
    void target = getentityproperty(self,"opponent");
    void iType;
    int THealth;

    if(vAniID == openborconstant("ANI_FREESPECIAL4")){
      THealth = getentityproperty(target, "health");
      iType   = getentityproperty(target, "type");

      if(THealth <= 50 && iType == openborconstant("TYPE_ENEMY")){
        setentityvar(self, 0, "Kill");
      }
    }
}
 
Bloodbane said:
No, I mean players need to use same animation for the fatality attempt

Anyways, here's what I've made yesterday, it's a didhitscript:

fatal.c

void main(){
    void self = getlocalvar("self");
    void vAniID = getentityproperty(self,"animationID");
    void target = getentityproperty(self,"opponent");
    void iType;
    int THealth;

    if(vAniID == openborconstant("ANI_FREESPECIAL4")){
      THealth = getentityproperty(target, "health");
      iType  = getentityproperty(target, "type");

      if(THealth <= 50 && iType == openborconstant("TYPE_ENEMY")){
        setentityvar(self, 0, "Kill");
      }
    }
}

Declare this script like this:

didhitscript data/scripts/fatal.c

This script works like this: if attackbox in FREESPECIAL4 connects, the connected opponent will be checked his/her/its HP. If it's 50 or below, entity variable (number 0) will be filled with simple line "Kill"

So what does this line for? the script in FREESPECIAL4 is the one who will take that line.
An example:
anim freespecial4
@script
    if(frame==3){
      void self = getlocalvar("self");
      void Hit = getentityvar(self, 0);

      if(Hit=="Kill"){
        setentityvar(self, 0, NULL());
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
      }
    }
@end_script
delay 15
offset 70 105
bbox 61 37 47 68
hitflash slash
hitfx data/sounds/slash.wav
        frame data/chars/ninja/slash1.png
delay 3
attack  25 49 125 10 0 0 1
        frame data/chars/ninja/slash2.png
attack  74 37 127 17 0 0 1
        frame data/chars/ninja/slash3.png
delay 10
attack  0
        frame data/chars/ninja/slash4.png

anim follow2
delay 10
offset 70 105
bbox 53 68 30 61
hitflash slash
hitfx data/sounds/slash.wav
        frame data/chars/ninja/bslash1.png
delay 5
attack  63 48 153 46 50 1
dropv 2 4 0
        frame data/chars/ninja/bslash2.png
        frame data/chars/ninja/bslash3.png
delay 10
attack  0
        frame data/chars/ninja/bslash4.png

Script in FREESPECIAL4 checks that entity variable. At 4th frame, if the message "Killed" is accepted, the animation will be changed to FOLLOW2
For your mod, you can change FREESPECIAL4 to same animation you use for fatality attempt, and FOLLOW2 to fatality animation. I also marked minimum HP for fatality in fatal.c script if you need to change the value

Ack, I just remembered that I forgot to check opponent type in this script  :'( . Alright, it should be simple fix, give me time to do it :D

It's possible update this scripts to use 2 freespecials?
Something like freespecial 4 and 5.
I need this update to use 2 fatalities for each character.
 
It should work.
@Dante, I suggest you to start study the codes everyone give to you, so you can start to understand it and not just copy and paste.

I don't want to sound rude, in fact I am trying to make you evolve. For example, your question was just a simple OR statement, which is kinda too simple to understand.
 
As suggested by magggas and mentioned by Ilu, it should work :)

magggas said:
The thing is i'm not sure what trigers to the FREESPECIAL4 or FREESPECIAL5 (i mean not sure how they get activated),

It simply check player's or to be exact, entity's current animation

and i'm not sure if you need to set an seperate "setentityvar" for each freespecial too. (because i never understud how these "setentityvar" work)

I'm sure dante won't need seperate entity variable for this as one is sufficient for this purpose

BTW if you want to understand how entity variable work, you could use update script to display current value of the variable. With that, you can see how it works especially when its value changes  :)
 
Back
Top Bottom