[SOLVED] Enemies not dying until a knockdown+damage feature/value?

Mr.Q!

Well-known member
I was looking for something like this in the manual but couldn't find it. Is it possible by now? In the Double Dragon games, enemies don't die until you they get a knockdown even if they have 0 energy left, so since openbor allows to knockdown enemies even by having a '0' damage value, is it possible to kill an enemy by a combination of both avobe 0 damage value + knockdown?
 
This requires takedamagescript in enemies text

I've made something like this before but the finisher isn't a knockdown
I'll modify the script to use knock down finisher instead :)

[couple minutes later]

Done, here's the script:
Finisher.c
Code:
void main()
{// Endure script (to protect entity from non knockdown finishing blow)
    void self = getlocalvar("self"); //Get calling entity.
    int HP = getentityproperty(self, "health"); //Get current HP
    int Damage = getlocalvar("damage"); //Get received damage
    int Knock = getlocalvar("drop"); //Get knockdown power

    if(HP <= Damage && HP <= 1 && Knock == 0){
      changeentityproperty(self, "health", 1);
    }
}

Save this in data/scripts folder
Declare this in enemies text with:
Code:
takedamagescript data/scripts/finisher.c

With this set, the enemy can receive damage like normal until his/her reaches 1. After that, any non knockdown attack won't kill him/her. He/she still plays PAIN as usual
 
Great work, BB. I was going to reply here but I got busy.

Just remind to use Plombo's code redirection trick, or you will be consuming more memory than you should. The way it is now, if he has 40 enemies, this code will be compiled into memory 40 times.

It's easy to fix, you just need to use two files:
finisher.c
finisher_actual.c


Save this code as "finisher_actual.c" under the scritps folder

Code:
void actual_main()
{// Endure script (to protect entity from non knockdown finishing blow)
    void self = getlocalvar("self"); //Get calling entity.
    int HP = getentityproperty(self, "health"); //Get current HP
    int Damage = getlocalvar("damage"); //Get received damage
    int Knock = getlocalvar("drop"); //Get knockdown power

    if(HP <= Damage && HP <= 1 && Knock == 0){
      changeentityproperty(self, "health", 1);
    }
}
(notice the main was remanted to "actual_main")

Then save this file as "finisher.c" in the scripts folder:

Code:
#import "data/scripts/finisher_actual.c"

void main()
{
    actual_main();

}
This is the code forward file. It will import the actual code.

After this, you can call the file
Code:
takedamagescript data/scripts/finisher.c
 
this sounds nice, will give it a try, but does it work the way I say? I mean, there're attacks that knockdown enemies which don't necessarly kill them , like custom grabs or aerial combo launchers, it should workl like that, knockdown + positive damage values, so that way combo launchers which have 0 damage value still work
 
Bloodbane said:
This requires takedamagescript in enemies text

I've made something like this before but the finisher isn't a knockdown
I'll modify the script to use knock down finisher instead :)

[couple minutes later]

Done, here's the script:
Finisher.c
Code:
void main()
{// Endure script (to protect entity from non knockdown finishing blow)
    void self = getlocalvar("self"); //Get calling entity.
    int HP = getentityproperty(self, "health"); //Get current HP
    int Damage = getlocalvar("damage"); //Get received damage
    int Knock = getlocalvar("drop"); //Get knockdown power

    if(HP <= Damage && HP <= 1 && Knock == 0){
      changeentityproperty(self, "health", 1);
    }
}

Save this in data/scripts folder
Declare this in enemies text with:
Code:
takedamagescript data/scripts/finisher.c

With this set, the enemy can receive damage like normal until his/her reaches 1. After that, any non knockdown attack won't kill him/her. He/she still plays PAIN as usual

Hello Bloodbane! :) I checked your script in DDR. and there is one strangeness. When enemies fall in the "Hole" they do not die. and remain there forever...
 
Because dying on a pit is different from dying from an attack.

But it's easy to fix:
Code:
void main()
{// Endure script (to protect entity from non knockdown finishing blow)
    void self = getlocalvar("self"); //Get calling entity.
    int HP = getentityproperty(self, "health"); //Get current HP
    int Damage = getlocalvar("damage"); //Get received damage
    int Knock = getlocalvar("drop"); //Get knockdown power
    int Type = getlocalvar("attacktype");// Get attack type

if(Type != openborconstant("ATK_PIT"))
    { // Not falling into a hole?

    if(HP <= Damage && HP <= 1 && Knock == 0){
      changeentityproperty(self, "health", 1);
      }
    }
}
 
Wow, this is an awesome feature, and personally I can't wait to use it! Thanks for requesting it Mr. Q, and thanks Bloodbane and Ilusionista for making it happen!
 
If this could be applied with a way to make characters only use "finishing attacks" while attacking a dying opponent, it would be great for a Battletoads style game if the modder wanted to replicate their finishers.

x)
 
O Ilusionista said:
Because dying on a pit is different from dying from an attack.

But it's easy to fix:

Thanks Ilu, forgot about holes :)

NickyP said:
thanks Bloodbane and Ilusionista for making it happen!

You're welcome :)

DJGameFreakTheIguana said:
If this could be applied with a way to make characters only use "finishing attacks" while attacking a dying opponent, it would be great for a Battletoads style game

Hmmm... forcing to use finishing attacks require other script to change animation to those attacks. But this takedamagescript could be used to prevent killing enemy with non finishing attacks ;)
 
Alright, I've just tested it and it does prevent finishing enemy with throws. I'm going to find solution to this :)

[some time later]

Okay, found the solution and the fixed script becomes this:
Code:
void main()
{// Endure script (to protect entity from non knockdown finishing blow)
    void self = getlocalvar("self"); //Get calling entity.
    int HP = getentityproperty(self, "health"); //Get current HP
    int Damage = getlocalvar("damage"); //Get received damage
    int Knock = getlocalvar("drop"); //Get knockdown power
    int Type = getlocalvar("attacktype");

    if(Type != openborconstant("ATK_PIT") && Type != openborconstant("ATK_LAND")){
      if(HP <= Damage && HP <= 1 && Knock == 0){
        changeentityproperty(self, "health", 1);
      }
    }
}
 
Bloodbane said:
Alright, I've just tested it and it does prevent finishing enemy with throws. I'm going to find solution to this :)

[some time later]

Okay, found the solution and the fixed script becomes this:
Code:
void main()
{// Endure script (to protect entity from non knockdown finishing blow)
    void self = getlocalvar("self"); //Get calling entity.
    int HP = getentityproperty(self, "health"); //Get current HP
    int Damage = getlocalvar("damage"); //Get received damage
    int Knock = getlocalvar("drop"); //Get knockdown power
    int Type = getlocalvar("attacktype");

    if(Type != openborconstant("ATK_PIT") && Type != openborconstant("ATK_LAND")){
      if(HP <= Damage && HP <= 1 && Knock == 0){
        changeentityproperty(self, "health", 1);
      }
    }
}

Now works perfect my friend!

Thanks!
 
Update:

MrQ reported a bug which happens to be caused by this script. Damon Caskey gave me the solution. Now the function should be like this:
Code:
void main()
{// Endure script (to protect entity from non knockdown finishing blow)
    void self = getlocalvar("self"); //Get calling entity.
    int HP = getentityproperty(self, "health"); //Get current HP
    int Damage = getlocalvar("damage"); //Get received damage
    int Knock = getlocalvar("drop"); //Get knockdown power
    int Type = getlocalvar("attacktype");

    if(Type != openborconstant("ATK_PIT") && Type != openborconstant("ATK_LAND") && Type != openborconstant("ATK_BOSS_DEATH")){
      if(HP <= Damage && HP <= 1 && Knock == 0){
        changeentityproperty(self, "health", 1);
      }
    }
}
 
Ok man just tested it and it gives me this error:

Can't compile script 'takedamagescript' data/chars/2wllms/awilliam.txt

remember also it's "actual_main" instead of just "void main"
 
Oh if you're using actual_main then just replace the function name into actual_main like this:
Code:
void actual_main()
{// Endure script (to protect entity from non knockdown finishing blow)
    void self = getlocalvar("self"); //Get calling entity.
    int HP = getentityproperty(self, "health"); //Get current HP
    int Damage = getlocalvar("damage"); //Get received damage
    int Knock = getlocalvar("drop"); //Get knockdown power
    int Type = getlocalvar("attacktype");

    if(Type != openborconstant("ATK_PIT") && Type != openborconstant("ATK_LAND") && Type != openborconstant("ATK_BOSS_DEATH")){
      if(HP <= Damage && HP <= 1 && Knock == 0){
        changeentityproperty(self, "health", 1);
      }
    }
}
 
Back
Top Bottom