Can obstacles have more than 1hp?

Mr.Q!

Well-known member
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 mean, no matter how much HP i spawn them in my stages, they all die in 1 hit, what's the alternative way?
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 would need to take a look at the entity file to understand better.
 
+1 to what @Kratus said. Obstacle types are optimized to be extra light on CPU time - other than the "fly off screen" option, they don't have pain and death animations without adding script or using different types. They do have a normal hitpoint count though, much as you want. Must be something else interfering and killing them

DC
 
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!
 

Attachments

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!
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.
 
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.
@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);
        }
    }
}
 
@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);
        }
    }
}
@Mr.Q! Like I suspected, there's a script interfering in the obstacle damage.

I don't remember exactly the previous context but I remember that you wanted to bypass the "nokill" command in order to destroy obstacles even if this command is declared at the model header. This explains why there's a damageentity line, forcing an extra damage.

So, in this new context, I had some ideas:

1) Create a list as a filter for all the models where this script should work (or should skip);
2) Just comment the damageentity line to disable it in case you don't need to bypass the "nokill" anymore;
 
Back
Top Bottom