* *
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 24, 2017, 12:47:57 AM

Login with username, password and session length

Attacking attached entities to hurt boss

  • 8 Replies
  • 635 Views
*

Offline DJGameFreakTheIguana

  • Hero Member
  • *****
  • 550
  • Baddest Sonic Fan Alive
Attacking attached entities to hurt boss
« on: July 17, 2017, 02:09:25 AM »
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)

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3169
  • Dark Dragon
Re: Attacking attached entities to hurt boss
« Reply #1 on: July 17, 2017, 11:49:27 PM »
 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.

*

Offline DJGameFreakTheIguana

  • Hero Member
  • *****
  • 550
  • Baddest Sonic Fan Alive
Re: Attacking attached entities to hurt boss
« Reply #2 on: July 20, 2017, 07:37:15 AM »
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.

Quote
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: [Select]
@cmd spawn01 "Eggpawn" 0 0 0
x)

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3169
  • Dark Dragon
Re: Attacking attached entities to hurt boss
« Reply #3 on: July 23, 2017, 01:35:23 AM »
 That's the basic, here's how to let spawned entity knows who spawned it :

Code: [Select]
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:

Quote
takedamagescript data/scripts/pain.c

 Here's pain.c:

Code: [Select]
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:

Quote
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 :)

*

Offline DJGameFreakTheIguana

  • Hero Member
  • *****
  • 550
  • Baddest Sonic Fan Alive
Re: Attacking attached entities to hurt boss
« Reply #4 on: July 25, 2017, 07:24:07 AM »
Ok, I've set the scripts up but the spawn isn't working.
Code: [Select]
        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)

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3169
  • Dark Dragon
Re: Attacking attached entities to hurt boss
« Reply #5 on: July 25, 2017, 09:01:52 AM »
 As usual, have you loaded Flowerbomb?

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

Quote
    @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

*

Offline DJGameFreakTheIguana

  • Hero Member
  • *****
  • 550
  • Baddest Sonic Fan Alive
Re: Attacking attached entities to hurt boss
« Reply #6 on: July 25, 2017, 04:55:47 PM »
As usual, have you loaded Flowerbomb?
Yeah, I had this setup before I tried to apply the script.

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

Quote
    @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)

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3169
  • Dark Dragon
Re: Attacking attached entities to hurt boss
« Reply #7 on: July 26, 2017, 03:47:44 AM »
 Yes but you'd need to replace takedamagescript with ondeathscript
 Like this:
Quote
ondeathscript   data/scripts/deathpain.c

deathpain.c

Code: [Select]
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

*

Offline DJGameFreakTheIguana

  • Hero Member
  • *****
  • 550
  • Baddest Sonic Fan Alive
Re: Attacking attached entities to hurt boss
« Reply #8 on: July 26, 2017, 03:41:36 PM »
Ok, got it right the first time, and thankfully it only works when the played kills the minion and not them dying on their own. Thanks Blood, this will be a big help.

x)

 

Recent

Members
  • Total Members: 6634
  • Latest: dre10g
Stats
  • Total Posts: 47092
  • Total Topics: 3229
  • Online Today: 25
  • Online Ever: 316
  • (January 04, 2013, 09:43:02 AM)
Users Online
Users: 0
Guests: 17
Total: 17