Solved 2 bosses share the same bar

Question that is answered or resolved.

dantedevil

Well-known member
It's possible create a way for the two different enemies bosses share the same health bar?

Like the Rude Bros. in Vendetta?

bYpPjNu.png
 
Last edited:
Solution
Oh I thought you don't need this anymore  ;D

Anyways, first, you need to have one boss spawn the other boss (doesn't have to be on screen) with this function:

Code:
void spawnMate(void vName, float fX, float fY, float fZ)
{//Spawns Mate next to caller
 //Spawned Mate & caller will know each other
 //vName: Model name of entity to be spawned in
 //fX: X location adjustment
 //fZ: Y location adjustment
 //fY: Z location adjustment

   void self = getlocalvar("self"); //Get calling entity
   int Health = getentityproperty(self, "health");
   int Map = getentityproperty(self, "map");
   void Mate; //Spawn object.
	
   Mate = spawn01(vName, fX, fY, fZ); //Spawn Mate
   changeentityproperty(Mate, "map", Map); //Match Mate's remap with self's...
Ah, I knew you'd ask this issue
That happened because when one of enemies is killed, the rest will be killed by knocking them down

I'm going to figure out how to kill the rest without making them fall in strange way
 
Bloodbane said:
Ah, I knew you'd ask this issue
That happened because when one of enemies is killed, the rest will be killed by knocking them down

I'm going to figure out how to kill the rest without making them fall in strange way

Perhaps this script of the "bosser" entity is useful to you. This entity eliminates the other enemies and always falls normally, even when I eliminate an enemy with a fatality.
Code:
@script
    if(frame==1){
      void vEntity;                                     //Target entity placeholder.
      int  iEntity;                                     //Entity enumeration holder.
      int  iType;                                       //Entity type.
      int  iHP;                                         //Entity HP
      int  iMax      = openborvariant("ent_max");       //Entity count.

       //Enumerate and loop through entity collection.
      for(iEntity=0; iEntity<iMax; iEntity++){    
        vEntity = getentity(iEntity);                 //Get target entity from current loop.
        iType   = getentityproperty(vEntity, "type"); //Get target type.
        iHP   = getentityproperty(vEntity, "health"); //Get target health

        //Enemy type?
        if (iType == openborconstant("TYPE_ENEMY") && iHP > 0){
          damageentity(vEntity, vEntity, 2000, 1, openborconstant("ATK_NORMAL"));
        }
      } 
      changeopenborvariant("slowmotion", 1);
      setindexedvar("Dead", 1);
    }
    if(frame==2){
      void self = getlocalvar("self");
      changeopenborvariant("slowmotion", 0);
      killentity(self);
    }
@end_script

 
Sorry for the late reply, I was busy making a game for 3 days jam

Anyways, try this slightly updated Equalo:
Code:
name	 Equalo
type	 none
shadow	 0


anim	idle
@script
    void self = getlocalvar("self");
    void Parent = getentityproperty(self, "parent"); // Get parent
    int Health = getentityproperty(self, "health"); // Get entity's health

    if(Parent){ //Have parent?
      int PHealth = getentityproperty(Parent, "health"); // Get parent's health
      int EHealth = getglobalvar("Equalo");

      if(EHealth == NULL()){
        EHealth = 5000;
      }

      if(EHealth <= 0){
        damageentity(Parent, self, 1, 0, openborconstant("ATK_NORMAL"));
      } else if(PHealth <= 0){
        setglobalvar("Equalo", PHealth);
        killentity(self);
      } else if(PHealth < EHealth){
        setglobalvar("Equalo", PHealth);
      } else if(PHealth > EHealth) {
        changeentityproperty(Parent, "health", EHealth);
      }
    }
@end_script
        loop    1
	delay	2
	offset	1 1
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif
 
Bloodbane said:
Sorry for the late reply, I was busy making a game for 3 days jam

Anyways, try this slightly updated Equalo:
Code:
name	 Equalo
type	 none
shadow	 0


anim	idle
@script
    void self = getlocalvar("self");
    void Parent = getentityproperty(self, "parent"); // Get parent
    int Health = getentityproperty(self, "health"); // Get entity's health

    if(Parent){ //Have parent?
      int PHealth = getentityproperty(Parent, "health"); // Get parent's health
      int EHealth = getglobalvar("Equalo");

      if(EHealth == NULL()){
        EHealth = 5000;
      }

      if(EHealth <= 0){
        damageentity(Parent, self, 1, 0, openborconstant("ATK_NORMAL"));
      } else if(PHealth <= 0){
        setglobalvar("Equalo", PHealth);
        killentity(self);
      } else if(PHealth < EHealth){
        setglobalvar("Equalo", PHealth);
      } else if(PHealth > EHealth) {
        changeentityproperty(Parent, "health", EHealth);
      }
    }
@end_script
        loop    1
	delay	2
	offset	1 1
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif


Thanks for your time my friend!

About the problem, now it works worse than before...

https://youtu.be/1jJ1mlC41vI
:(




I have done some tests and discovered that everything is normalized, if before we stop the movement of the enemy. In this case try using my ANIM_FALL15, since it is the only one where the enemy has the stop script.
Code:
@script
    void self = getlocalvar("self");
    void Parent = getentityproperty(self, "parent"); // Get parent
    int Health = getentityproperty(self, "health"); // Get entity's health

    if(Parent){ //Have parent?
      int PHealth = getentityproperty(Parent, "health"); // Get parent's health
      int EHealth = getglobalvar("Equalo");

      if(EHealth == NULL()){
        EHealth = 5000;
      }

      if(EHealth <= 0){
        damageentity(Parent, self, 1, 1, openborconstant("ATK_NORMAL15"));
      } else if(PHealth <= 0){
        setglobalvar("Equalo", PHealth);
        killentity(self);
      } else if(PHealth < EHealth){
        setglobalvar("Equalo", PHealth);
      } else if(PHealth > EHealth) {
        changeentityproperty(Parent, "health", EHealth);
      }
    }
@end_script


Code:
anim fall15
	loop	0
      delay	9
        offset  82 177
	bbox	38 159 98 19
        @cmd    stop
	frame	data/chars/gang1/bee/pain8.png
        @cmd    degravity 0
	frame	data/chars/gang1/bee/fall4.png

As you can see in this video it looks a little better:
https://youtu.be/qWsC6-duQKA

I think the solution would be for the script to stop the enemy (@cmd stop) and then use the ATK_NORMAL to fall, but with a "drop v" of 2 2, to make it look normal.

PD: And I have one more question...
How do I use different Spawn custom, when I use a spawnscript in the level?
 
Hmmm... I'll think of something. I'm trying to figure out how to kill enemy without disrupting his/her FALL animation

How do I use different Spawn custom, when I use a spawnscript in the level?

You either:
1. Make new spawnscript which contains both contents of spawnscript and custom SPAWN
OR
2. Copy the contents of spawnscript into custom SPAWN script
 
    How do I use different Spawn custom, when I use a spawnscript in the level?


You either:
1. Make new spawnscript which contains both contents of spawnscript and custom SPAWN
OR
2. Copy the contents of spawnscript into custom SPAWN script
Thanks for this my friend!


About the other, I will continue waiting for you to find the solution.
;)
 
I've figured out a way to prevent a enemies from getting knocked down again. This is the updated equalo.txt:

Code:
name	 Equalo
type	 none
shadow	 0


anim	idle
@script
    void self = getlocalvar("self");
    void Parent = getentityproperty(self, "parent"); // Get parent
    int Health = getentityproperty(self, "health"); // Get entity's health

    if(Parent){ //Have parent?
      int PHealth = getentityproperty(Parent, "health"); // Get parent's health
      int EHealth = getglobalvar("Equalo");

      if(EHealth == NULL()){
        EHealth = 5000;
      }

      if(EHealth <= 0){
        int PFall = getentityproperty(Parent, "aiflag", "falling");

        changeentityproperty(Parent, "health", 0);
        if(PFall == 1){
          changeentityproperty(Parent, "damage_on_landing", 5);
        } else {
          damageentity(Parent, self, 1, 1, openborconstant("ATK_NORMAL"));
        }
      } else if(PHealth <= 0){
        setglobalvar("Equalo", PHealth);
        killentity(self);
      } else if(PHealth < EHealth){
        setglobalvar("Equalo", PHealth);
      } else if(PHealth > EHealth) {
        changeentityproperty(Parent, "health", EHealth);
      }
    }
@end_script
        loop    1
	delay	2
	offset	1 1
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif

I haven't tested this with fatality yet. I'm going to find something to test that
 
Bloodbane said:
I've figured out a way to prevent a enemies from getting knocked down again. This is the updated equalo.txt:

Code:
name	 Equalo
type	 none
shadow	 0


anim	idle
@script
    void self = getlocalvar("self");
    void Parent = getentityproperty(self, "parent"); // Get parent
    int Health = getentityproperty(self, "health"); // Get entity's health

    if(Parent){ //Have parent?
      int PHealth = getentityproperty(Parent, "health"); // Get parent's health
      int EHealth = getglobalvar("Equalo");

      if(EHealth == NULL()){
        EHealth = 5000;
      }

      if(EHealth <= 0){
        int PFall = getentityproperty(Parent, "aiflag", "falling");

        changeentityproperty(Parent, "health", 0);
        if(PFall == 1){
          changeentityproperty(Parent, "damage_on_landing", 5);
        } else {
          damageentity(Parent, self, 1, 1, openborconstant("ATK_NORMAL"));
        }
      } else if(PHealth <= 0){
        setglobalvar("Equalo", PHealth);
        killentity(self);
      } else if(PHealth < EHealth){
        setglobalvar("Equalo", PHealth);
      } else if(PHealth > EHealth) {
        changeentityproperty(Parent, "health", EHealth);
      }
    }
@end_script
        loop    1
	delay	2
	offset	1 1
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif

I haven't tested this with fatality yet. I'm going to find something to test that


Bravo!

I just tried it with fatality and everything works perfect!
Thank you very much dear friend!
 
Back
Top Bottom