Enable and fix minibosses

From EDukeWiki
Revision as of 16:54, 8 November 2006 by Hendricks266 (talk | contribs) (Reformatted, added gamevars, added WIP warning, fixed BOSS2 water effect, fixed BOSS4 shrinking, fixed BOSS4 spritepal issue)
Jump to navigation Jump to search

Please note that this tutorial is a work-in-progress. If you find any errors, please edit the talk page for this article.

This tutorial is for how to enable the actors BOSS1, BOSS2, BOSS3, and BOSS4 become their miniboss counterparts without any bugs so you can put them in user maps and\or CON hacks.

Intoduction

From now on I will refer to the bosses as follows:

  • BOSS1 - Ep. 1 - Battlelord
  • BOSS2 - Ep. 3 - Cycloid Emperor
  • BOSS3 - Ep. 2 - Overlord (Yes, these two are mixed up. Do not try to switch them to what they should be.)
  • BOSS4 - Ep. 4 - Alien Queen

The Battlelord is programmed sufficently enough to allow its placement in maps, and the official levels do contain some mini Battlelords. In order to successfully perform the actions described in this tutorial, you will need to understand that while the Battlelord, Overlord, and Cycloid Emperor are already enabled and just require an easy bug fix or two, the Alien Queen will require some CON coding skill, time, patience, and effort for reasons described below.

When I say "Change it to this:", I want you to copy the text below it in the box and overwrite the text in the box above by pasting it when the old text is completely selected, but in your .CON files of course. There is not much point in changing the web page!

Also, when I say "Open <insert name of .CON file here>.", I want you to open whatever .CON file the text in the box below is in. I am just stating the defaults.

Ready to begin?

Strengths and Gamevars

Open USER.CON. Scroll down to here:

define BOSS1STRENGTH            4500
define BOSS1PALSTRENGTH         1000
define BOSS2STRENGTH            4500
define BOSS3STRENGTH            4500
define BOSS4STRENGTH            6000

Change it to this:

define BOSS1STRENGTH            4500
define BOSS1PALSTRENGTH         1000
define BOSS2STRENGTH            4500
define BOSS2PALSTRENGTH         1000
define BOSS3STRENGTH            4500
define BOSS3PALSTRENGTH         1000
define BOSS4STRENGTH            6000
define BOSS4PALSTRENGTH         1333

gamevar BOSSX 0 2
gamevar BOSSY 0 2
gamevar BOSSZ 0 2
gamevar BOSSSPRPAL 0 2
gamevar BOSSLOTAG 0 2
gamevar BOSSSECTOR 0 2

The strengths from mini BOSS2 and BOSS3 was put the same as BOSS1, oblivious because the big versions are the same. BOSS4 is proportional as 4500 - 1000 to 6000 - 1333. The gamevars need to remain the exact same thing as what is shown here.

Note that the strengths do not have to be what is described here. All that matters is that these eight defines exist.

BOSS1

state checkboss1hitstate

Search for "state checkboss1hitstate" in GAME.CON. Scroll down to this:

  ifdead
  {
    ifspritepal 0
      globalsound DUKE_TALKTOBOSSFALL
    else
    {
      ifrnd 64
        globalsound DUKE_TALKTOBOSSFALL
      ifwasweapon FREEZEBLAST
      {
        sound SOMETHINGFROZE
        spritepal 1
        move 0
        action ABOSS1FROZEN
        strength 0
        break
      }
    }

    sound BOS1_DYING

    addkills 1
    ai AIBOSS1DYING
  }

Change it to this:

  ifdead
  {
    ifspritepal 0
      globalsound DUKE_TALKTOBOSSFALL
    else
    {
      ifwasweapon FREEZEBLAST
      {
        sound SOMETHINGFROZE
        spritepal 1
        move 0
        action ABOSS1FROZEN
        strength 0
        break
      }
    }

    sound BOS1_DYING

    addkills 1
    ai AIBOSS1DYING
  }

BOSS2

state checkboss2hitstate

Search for "state checkboss2hitstate" in GAME.CON. Scroll down to this:

  ifdead
  {
    ifspritepal 0
      globalsound DUKE_TALKTOBOSSFALL
    else
    {
      ifrnd 64
        globalsound DUKE_TALKTOBOSSFALL
      ifwasweapon FREEZEBLAST
      {
        sound SOMETHINGFROZE
        spritepal 1
        move 0
        action ABOSS2FROZEN
        strength 0
        break
      }
    }

    sound BOS2_DYING

    addkills 1

    ai AIBOSS2DYING
  }

Change it to this:

  ifdead
  {
    ifspritepal 0
      globalsound DUKE_TALKTOBOSSFALL
    else
    {
      ifwasweapon FREEZEBLAST
      {
        sound SOMETHINGFROZE
        spritepal 1
        move 0
        action ABOSS2FROZEN
        strength 0
        break
      }
    }

    sound BOS2_DYING

    addkills 1
    ai AIBOSS2DYING
  }

state boss2code

Search for "state boss2code" in GAME.CON. Scroll down to this:

  ifai 0
  {
    ifspritepal 0
     ai AIBOSS2RUNENEMY
    else
    {
      strength 1
      sound BOS2_ATTACK ai AIBOSS2SHOOTENEMY
    }
  }

Change it to this:

   getsector[THISACTOR].lotag BOSSLOTAG // This prevents BOSS2 from going into water to prevent issues.
   ifvare BOSSLOTAG 1
   {
       setactor[THISACTOR].x BOSSX
       setactor[THISACTOR].y BOSSY
       setactor[THISACTOR].z BOSSZ
       updatesectorz monstx monsty monstz BOSSSECTOR
       changespritesect THISACTOR BOSSSECTOR
   }
   else
   {
       getactor[THISACTOR].x BOSSX
       getactor[THISACTOR].y BOSSY
       getactor[THISACTOR].z BOSSZ
   }

  ifai 0
  {
    ifspritepal 0
      ai AIBOSS2RUNENEMY
    else
    {
     clipdist 8 // This is here so that the RPGs fired from the bosses do not explode in their faces.
     strength BOSS2PALSTRENGTH // This is the main bug fix. If you do not change this, the mini-bosses will only have 1 health.
     sound BOS2_ATTACK
     ai AIBOSS2SHOOTENEMY
    }
  }

BOSS3

state checkboss3hitstate

Search for "state checkboss3hitstate" in GAME.CON. Scroll down to this:

  ifdead
  {
    ifspritepal 0
      globalsound DUKE_TALKTOBOSSFALL
    else
    {
      ifrnd 64
        globalsound DUKE_TALKTOBOSSFALL
      ifwasweapon FREEZEBLAST
      {
        sound SOMETHINGFROZE
        spritepal 1
        move 0
        action ABOSS3FROZEN
        strength 0
        break
      }
    }

    addkills 1
    ai AIBOSS3DYING

    sound BOS3_DYING
    sound JIBBED_ACTOR9

  }

Change it to this:

  ifdead
  {
    ifspritepal 0
      globalsound DUKE_TALKTOBOSSFALL
    else
    {
      ifwasweapon FREEZEBLAST
      {
        sound SOMETHINGFROZE
        spritepal 1
        move 0
        action ABOSS3FROZEN
        strength 0
        break
      }
    }

    sound BOS3_DYING 

    addkills 1
    ai AIBOSS3DYING
  }

state boss3code

Search for "state boss3code" in GAME.CON. Scroll down to this:

 ifai 0
 {
   ifspritepal 0
     ai AIBOSS3RUNENEMY
   else
   {
     strength 1
     ai AIBOSS3LOBENEMY
   }
 }

Change it to this:

  ifai 0
  {
    ifspritepal 0
      ai AIBOSS3RUNENEMY
    else
    {
     clipdist 8 // This is here so that the RPGs fired from the bosses do not explode in their faces.
     strength BOSS3PALSTRENGTH // This is the main bug fix. If you do not change this, the mini-bosses will only have 1 health.
     sound BOS3_ATTACK1
     ai AIBOSS3LOBENEMY
    }
  }

BOSS4

BOSS4 is a bit more complicated because there is no programming at all for it to be a miniboss.

Animations, Movements, and Artificial Intelligence

First, go to where it says:

action ABOSS4WALK          0 4  5  1  30
action ABOSS4DYING        40 9  1  1  20
action ABOSS4ABOUTTOSHOOT 20 1  5  1  40
action ABOSS4SHOOT        25 2  5  1  10
action ABOSS4LAYIT        50 3  5  1  120
action BOSS4FLINTCH       40 1  1  1  1
action ABOSS4DEAD         49

move BOSS4WALKVELS 128
move BOSS4STOPPED

ai AIBOSS4LAYEGGS ABOSS4WALK BOSS4WALKVELS randomangle geth
ai AIBOSS4SHOOT ABOSS4ABOUTTOSHOOT BOSS4STOPPED faceplayer
ai AIBOSS4DYING ABOSS4DYING BOSS4STOPPED faceplayer

Change it to this:

action ABOSS4WALK          0 4  5  1  30
action ABOSS4DYING        40 9  1  1  20
action ABOSS4ABOUTTOSHOOT 20 1  5  1  40
action ABOSS4SHOOT        25 2  5  1  10
action ABOSS4LAYIT        50 3  5  1  120
action BOSS4FLINTCH       40 1  1  1  1
action ABOSS4DEAD         49
action ABOSS4FROZEN       0  1  5

move BOSS4WALKVELS 128
move BOSS4STOPPED
move PALBOSS4SHRUNKRUNVELS 72

ai AIBOSS4LAYEGGS ABOSS4WALK BOSS4WALKVELS randomangle geth
ai AIBOSS4SHOOT ABOSS4ABOUTTOSHOOT BOSS4STOPPED faceplayer
ai AIBOSS4DYING ABOSS4DYING BOSS4STOPPED faceplayer
ai AIBOSS4PALSHRINK ABOSS4WALK PALBOSS4SHRUNKRUNVELS furthestdir
ai AIBOSS4SEEKENEMY ABOSS4WALK PALBOSS4SHRUNKRUNVELS seekplayer

state boss4palshrunkstate
      ifcount SHRUNKDONECOUNT { cstat 257 ai AIBOSS4SEEKENEMY }
 else ifcount SHRUNKCOUNT { sizeto 40 40 }
 else { state genericshrunkcode }
ends

Note that "state boss4palshrunkstate" is supposed to be there. You should put it there because that is a very convenient space for it.

state checkboss4hitstate

Next, go to this:

state checkboss4hitstate
  ifrnd 2
    spawn BLOODPOOL

  ifdead
  {
    globalsound DUKE_TALKTOBOSSFALL

    addkills 1
    ai AIBOSS4DYING

    sound BOS4_DYING
    sound BOSS4_DEADSPEECH
  }
  else
  {
    soundonce BOS4_PAIN
    debris SCRAP1 1
    guts JIBS6 1

    ifaction ABOSS4LAYIT
      break

    ifrnd 16
    {
      action BOSS4FLINTCH
      move 0
    }
  
  }
ends

Change it to this:

state checkboss4hitstate
  ifrnd 2
    spawn BLOODPOOL

  ifdead
  {
    ifvarn BOSSSPRPAL 0
     {
      ifwasweapon FREEZEBLAST
       {
         sound SOMETHINGFROZE
         spritepal 1
         move 0
         action ABOSS4FROZEN
         strength 0
         break
       }
     }

    globalsound DUKE_TALKTOBOSSFALL // Note that since the Alien Queen is female, this line is incorrect. She *is* a bitch.

   addkills 1
    ai AIBOSS4DYING

    sound BOS4_DYING
  }
  else
  {
    soundonce BOS4_PAIN
    debris SCRAP1 1
    guts JIBS6 1

    ifaction ABOSS4LAYIT
      break

    ifrnd 16
   {
      action BOSS4FLINTCH
      move 0
    }
  }
ends

state boss4code

After that, go to:

state boss4code

  ifai 0
    ai AIBOSS4LAYEGGS
  else
    ifaction BOSS4FLINTCH
    {
      ifactioncount 3
        ai AIBOSS4LAYEGGS
    }
  else
    ifai AIBOSS4LAYEGGS
      state boss4layeggs
  else
    ifai AIBOSS4SHOOT
      state boss4shootstate

  ifai AIBOSS4DYING
    state boss4dyingstate
  else
  {
    ifhitweapon
      state checkboss4hitstate
    else
      ifp palive
        ifpdistl 1280
      {
        addphealth -1000
        palfrom 63 63
      }
  }
ends

Change it to this:

state boss4code
  ifaction ABOSS4FROZEN
  {
    ifcount THAWTIME
    {
      ai AIBOSS4SHOOT
      getlastpal
    }
    else
      ifcount FROZENDRIPTIME
    {
      ifactioncount 26
      {
        spawn WATERDRIP
        resetactioncount
     }
    }

    ifhitweapon
    {
      ifwasweapon FREEZEBLAST
      {
        strength 0
        break
      }
      addkills 1

      lotsofglass 30
      sound GLASS_BREAKING
      ifrnd 84 spawn BLOODPOOL
      killit
   }
    ifp pfacing
      ifpdistl FROZENQUICKKICKDIST
        pkick
    break
  }
  ifai 0
  {
    ifvarn BOSSSPRPAL 0 { strength BOSS4PALSTRENGTH }
    ai AIBOSS4LAYEGGS
  }
 else
    ifaction BOSS4FLINTCH
    {
      ifactioncount 3
        ai AIBOSS4LAYEGGS
    }
  else
    ifai AIBOSS4LAYEGGS
      state boss4layeggs
  else
    ifai AIBOSS4SHOOT
      state boss4shootstate
  else
    ifai AIBOSS4PALSHRINK
      state boss4palshrunkstate

  ifai AIBOSS4DYING
    state boss4dyingstate
  else
  {
    ifhitweapon
      state checkboss4hitstate
    else
      ifp palive
       ifvare BOSSSPRPAL 0
        {
          ifpdistl 1280
        {
          addphealth -1000
          sound SQUISHED
          palfrom 64 64
          break
        }
        }
    }
ends

actor BOSS4

Then, go to:

actor BOSS4STAYPUT BOSS4STRENGTH

  fall
  cactor BOSS4
  spritepal 6
  state boss4code
  getlastpal

enda

actor BOSS4 BOSS4STRENGTH

  fall
  cactor BOSS4
  spritepal 6
  state boss4code
  getlastpal

enda

Change it to this:

state boss4_init
 ifaction 0 { getactor[THISACTOR].pal BOSSSPRPAL }
 fall
 spritepal 6
 state boss4code
 getlastpal
ends

useractor enemystayput BOSS4STAYPUT BOSS4STRENGTH
  state boss4_init
  cactor BOSS4 
enda

useractor enemy BOSS4 BOSS4STRENGTH
  state boss4_init
enda

Conclusion

After that, you should be all set!

To insert a miniboss in a user map, create the boss sprite you want, and then give it a palette of something other than 0. I recommend pal 3 because pal 21 makes some minor changes to the first three boss' sprites, while the Alien Queen looks red with pal 21. In the end, all that matters is that the spritepal is not 0.