Usually obstacle entities accept more than 1 hp by default, currently I'm using it in the walls at the SOR3 stage 3 (the bulldozer stage).I mean, no matter how much HP i spawn them in my stages, they all die in 1 hit, what's the alternative way?
I added your obstacle entity in my game (disabling all scripts) and the health works fine.Here it is. Present script files are about:
Animations scripts library - lib001.c
Obstacles turning to face the attacker - facingpain.c
Randomize items after death - item.c
I am pretty clueless about this!
@Kratus I did what you suggested and I was still getting the problem, so I moved into all my playables and I have this script to hit obstacles and not play anything instead of the normal hitfx from players when they hit them and the problem was solved! I think you were the one who made it, you think you can check this one more time? Here it is:I added your obstacle entity in my game (disabling all scripts) and the health works fine.
There's a chance of the obstacle's takedamage script interfering, or even player's didhit/ondoattack depending on the code you are using.
#import "data/scripts/main_audio.c"
void main()
{//Play current sound stored in the "HITFX" variable
void self = getlocalvar("self");
void target = getlocalvar("damagetaker");
void atkType = getlocalvar("attacktype");
void anim = getentityproperty(self, "animationID");
void type = getentityproperty(target, "type");
void hitFx = getentityvar(self, "hitfx"+anim);
int hitC = getentityvar(self, "hitConfirm");
//PERFORM SOME CHECKS BEFORE PLAY ANY SOUND
if(!getlocalvar("blocked")){ //DIDN'T BLOCK THE HIT??
//AVOID DAMAGE ON LANDING ATTACKS
if(atkType != openborconstant("ATK_LAND") && type != openborconstant("TYPE_OBSTACLE")){
//HIT WAS CONFIRMED BY THE ONDOATTACK SCRIPT??
if(hitC != NULL()){
//IS THERE A SOUND SAVED IN A VARIABLE??
if(hitFx != NULL()){
int loop = 0;
int speed = 100;
sound(hitFx, loop, speed); //PLAY SOUND!!
setentityvar(self, "hitConfirm", NULL()); //CLEAR THE VARIABLE TO PLAY ONCE
}
}
}
//IGNORE "NOKILL" COMMAND AND DAMAGE OBSTACLES IN CASE THE LAST HIT DIDN'T KILL IT
void dead = getentityproperty(target, "animationID");
int damage = getentityproperty(target, "maxhealth");
if(type == openborconstant("TYPE_OBSTACLE") && !dead){
damageentity(target, self, damage, 1, atkType);
}
}
}
@Mr.Q! Like I suspected, there's a script interfering in the obstacle damage.@Kratus I did what you suggested and I was still getting the problem, so I moved into all my playables and I have this script to hit obstacles and not play anything instead of the normal hitfx from players when they hit them and the problem was solved! I think you were the one who made it, you think you can check this one more time? Here it is:
Code:#import "data/scripts/main_audio.c" void main() {//Play current sound stored in the "HITFX" variable void self = getlocalvar("self"); void target = getlocalvar("damagetaker"); void atkType = getlocalvar("attacktype"); void anim = getentityproperty(self, "animationID"); void type = getentityproperty(target, "type"); void hitFx = getentityvar(self, "hitfx"+anim); int hitC = getentityvar(self, "hitConfirm"); //PERFORM SOME CHECKS BEFORE PLAY ANY SOUND if(!getlocalvar("blocked")){ //DIDN'T BLOCK THE HIT?? //AVOID DAMAGE ON LANDING ATTACKS if(atkType != openborconstant("ATK_LAND") && type != openborconstant("TYPE_OBSTACLE")){ //HIT WAS CONFIRMED BY THE ONDOATTACK SCRIPT?? if(hitC != NULL()){ //IS THERE A SOUND SAVED IN A VARIABLE?? if(hitFx != NULL()){ int loop = 0; int speed = 100; sound(hitFx, loop, speed); //PLAY SOUND!! setentityvar(self, "hitConfirm", NULL()); //CLEAR THE VARIABLE TO PLAY ONCE } } } //IGNORE "NOKILL" COMMAND AND DAMAGE OBSTACLES IN CASE THE LAST HIT DIDN'T KILL IT void dead = getentityproperty(target, "animationID"); int damage = getentityproperty(target, "maxhealth"); if(type == openborconstant("TYPE_OBSTACLE") && !dead){ damageentity(target, self, damage, 1, atkType); } } }