Bloodbane
Well-known member
I've made some takedamagescripts for my mods. I'm sharing them here, starting from basic ones:
1. blink.c
This takedamagescript changes entity's palette to 1st alternate palette or 1st remap in an instant (blink of an eye) before reverts to current palette or remap
Usually used by enemies and bosses in platformers to show that they have taken damage from player
2. invis.c
This takedamagescript sets temporary invincibility (2 seconds) when entity is hit by any attack
Usually used by players in platformers to protect player from getting another attack after first attack. Can be used by enemies too
3. nostun.c
This takedamagescript cancels frozen or stun effect from attacks entity received. Technically it cuts freezetime to 1 tick making it as if freeze or stun effect is never taken
Used by entities which can't be frozen nor stunned
4. endure.c
As name implies, this takedamagescript prevents entities from killing blow resulting in endure effect
Great to be used by enemies or bosses which runs away after player 'finished' them (combined with desperation script)
The next ones are combined or modifed ones for special purposes
1. blinkS.c
This takedamagescript is combination of original blink.c above with nostun.c. The flaw of original blink.c is that when entity is hit by freeze attack, entity will be frozen using blink palette/remap. This combined script solves that flaw
2. Cendure.c
This is modified endure.c which allows entities to be finished with attack2 attacktype
If you have rapid attacks special or supers and you want enemies to receive all attacks without getting killed before finishing blow, this is the script you need
. Of course, this means you must set all finisher attacks (attacks which are allowed to finish enemy) to attack2 attacktype
To use this takedamagescript, simply copy desired one such as blink.c then declare it like this in entity's header:
takedamagescript data/scripts/blink.c
1. blink.c
Code:
void main()
{// Blink effect script
void self = getlocalvar("self"); //Get calling entity.
int Health = getentityproperty(self,"health");
if(Health > 0){
changeentityproperty(self, "colourmap", 1);
changeentityproperty(self, "maptime", 14 + openborvariant("elapsed_time"));
}
}
This takedamagescript changes entity's palette to 1st alternate palette or 1st remap in an instant (blink of an eye) before reverts to current palette or remap
Usually used by enemies and bosses in platformers to show that they have taken damage from player
2. invis.c
Code:
void main()
{// Temporary invincibility script
void self = getlocalvar("self"); //Get calling entity.
int Health = getentityproperty(self,"health");
int eTime = openborvariant("elapsed_time");
if(Health > 0){
changeentityproperty(self, "invincible", 1);
changeentityproperty(self, "invinctime", eTime + 400);
changeentityproperty(self, "blink", 1);
}
}
This takedamagescript sets temporary invincibility (2 seconds) when entity is hit by any attack
Usually used by players in platformers to protect player from getting another attack after first attack. Can be used by enemies too
3. nostun.c
Code:
void main()
{// Anti stun script
void self = getlocalvar("self"); //Get calling entity.
changeentityproperty(self, "freezetime", 1);
}
This takedamagescript cancels frozen or stun effect from attacks entity received. Technically it cuts freezetime to 1 tick making it as if freeze or stun effect is never taken
Used by entities which can't be frozen nor stunned
4. endure.c
Code:
void main()
{// Endure script (to prevent entity from death)
void self = getlocalvar("self"); //Get calling entity.
int HP = getentityproperty(self, "health");
int Damage = getlocalvar("damage"); //Get received damage
if(HP <= Damage && HP <= 5){
changeentityproperty(self, "health", 1);
}
}
As name implies, this takedamagescript prevents entities from killing blow resulting in endure effect
Great to be used by enemies or bosses which runs away after player 'finished' them (combined with desperation script)
The next ones are combined or modifed ones for special purposes
1. blinkS.c
Code:
void main()
{// Blink effect + anti stun script
void self = getlocalvar("self"); //Get calling entity.
int Health = getentityproperty(self,"health");
if (Health > 0){
changeentityproperty(self, "colourmap", 1);
changeentityproperty(self, "maptime", 20 + openborvariant("elapsed_time"));
changeentityproperty(self, "freezetime", 1);
}
}
This takedamagescript is combination of original blink.c above with nostun.c. The flaw of original blink.c is that when entity is hit by freeze attack, entity will be frozen using blink palette/remap. This combined script solves that flaw
2. Cendure.c
Code:
void main()
{// Endure script (to prevent entity from death)
// Endure all attacktypes except attack2
void self = getlocalvar("self"); //Get calling entity.
int HP = getentityproperty(self, "health");
int Damage = getlocalvar("damage"); //Get received damage
if(HP <= Damage && HP <= 5 && Type != openborconstant("ATK_NORMAL2")){
changeentityproperty(self, "health", 1);
}
}
This is modified endure.c which allows entities to be finished with attack2 attacktype
If you have rapid attacks special or supers and you want enemies to receive all attacks without getting killed before finishing blow, this is the script you need
To use this takedamagescript, simply copy desired one such as blink.c then declare it like this in entity's header:
takedamagescript data/scripts/blink.c