Attacking attached entities to hurt boss

DJGameFreakTheIguana

Active member
Had some ideas about using bosses that has attached(Spawned) entities to it that will deal damage to the boss they're attached to by either taking damage or being killed. I even plan on doing this for a boss that would seem to need multiple hit boxes through the use of invisible entities.

So how can I go about getting this done? At the moment I have a boss set up for this, it has a lot of life so killing it directily will take a while, but more damage would be done by killing it's summoned entities.

x)
 
Hmmm... it depends on how you want it, i.e if you want attached entity to transfer its damage to the boss, that would require takedamagescript. OTOH if you want attached entity to hurt the boss on its death, that would require ondeathscript or at least animation script

Either way, attached entities must be linked with the boss so they could communicate via script.
 
Bloodbane said:
Hmmm... it depends on how you want it, i.e if you want attached entity to transfer its damage to the boss, that would require takedamagescript. OTOH if you want attached entity to hurt the boss on its death, that would require ondeathscript or at least animation script
Oh I'm asking for both, separate bosses of course.

Either way, attached entities must be linked with the boss so they could communicate via script.
I figured I would need this. It's done by directly spawning like this right?
Code:
@cmd	spawn01 "Eggpawn" 0 0 0

x)
 
That's the basic, here's how to let spawned entity knows who spawned it :

Code:
void spawnMin(void Name, int Num, float fX, float fY, float fZ)
{//Spawns minion next to caller and let minion stores self
 //Name: Minion's name
 //Num: Entity variable number to store self (on minion's entity variable)
 //fX: X location adjustment relative to left edge
 //fY: Y location adjustment
 //fZ: Z coordinate

   void self = getlocalvar("self"); //Get calling entity
   void vSpawn; //Spawn object

   vSpawn = spawn01(Name, fX, fY, fZ); //Spawn minion
   setentityvar(vSpawn, Num, self);
}

It calls spawn01 function so make sure that function is available

Then in minion's text, add this:

takedamagescript data/scripts/pain.c

Here's pain.c:

Code:
void main()
{// Takes own damage to give it to spawner
    void self = getlocalvar("self"); //Get calling entity.
    int Damage = getlocalvar("damage"); //Get received damage
    void Par = getentityvar(self,1);

    if(Par){
      damageentity(Par, self, Damage, 0, openborconstant("ATK_NORMAL"));      
    }
}

And example is this:

anim freespecial
delay 10
offset  90 100
frame data/chars/knbot/robod01.gif
@cmd spawnMin "RoHand" 1 -60 0 5
@cmd spawnMin "RoHand" 1 60 0 5
frame data/chars/knbot/robod01.gif
@cmd beidle
frame data/chars/knbot/robod01.gif

This Robo will spawn a pair of RoHands with spawnMin function. When player attacks RoHand, it will deliver damage it takes to Robo

This is basic example, we could expand this further if needed :)
 
Ok, I've set the scripts up but the spawn isn't working.
Code:
        loop    1
	delay	300
	offset	193 173
	bbox 165 80 56 93
    @cmd    spawnMin "Flowerbomb_"  100  0  30
    @cmd    spawnMin "Flowerbomb_"  150  0 -30
    @cmd    spawnMin "Flowerbomb_" -100  0  30
    @cmd    spawnMin "Flowerbomb_" -150  0 -30
	frame	data/chars/Flower/4.gif
	delay	8
	frame	data/chars/Flower/3.gif
	frame	data/chars/Flower/4.gif
	delay	18
	frame	data/chars/Flower/5.gif
	delay	30
	frame	data/chars/Flower/4.gif
	frame	data/chars/Flower/4.gif

x)
 
As usual, have you loaded Flowerbomb?

Oh yes, spawnMin has 5 parameters but you only filled 4 of them. It should be like this:

    @cmd    spawnMin "Flowerbomb_" 1 100  0  30
    @cmd    spawnMin "Flowerbomb_" 1 150  0 -30
    @cmd    spawnMin "Flowerbomb_" 1 -100  0  30
    @cmd    spawnMin "Flowerbomb_" 1 -150  0 -30
 
Bloodbane said:
As usual, have you loaded Flowerbomb?
Yeah, I had this setup before I tried to apply the script.

Oh yes, spawnMin has 5 parameters but you only filled 4 of them. It should be like this:

    @cmd    spawnMin "Flowerbomb_" 1 100  0  30
    @cmd    spawnMin "Flowerbomb_" 1 150  0 -30
    @cmd    spawnMin "Flowerbomb_" 1 -100  0  30
    @cmd    spawnMin "Flowerbomb_" 1 -150  0 -30

I see, fixed and tested, it works now.  :)

All I need now is the deathscript for boss taking damage when the minion dies. This is intended for the boss I just tested the damage script on. I changed something though. I wanted the spawn coords of the minions to change randomly, so I changed the boss and made it so it spawns them with each attack, and the minions kill themselves when they disappear. Is there a way I can get the death script to work only if the player kills them?

x)
 
Yes but you'd need to replace takedamagescript with ondeathscript
Like this:
ondeathscript data/scripts/deathpain.c

deathpain.c

Code:
void main()
{// Deals damage to spawner on death
    void self = getlocalvar("self"); //Get calling entity.
    void Par = getentityvar(self,1);

    if(Par){
      damageentity(Par, self, 50, 0, openborconstant("ATK_NORMAL"));      
    }
}

The damage given to boss on death is 50, you can change that value to suit your need
 
Back
Top Bottom