Enable and fix minibosses: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
m BOSS1: ifai 0
m BOSS2: ifai 0
Line 392: Line 392:
         setactor[THISACTOR].y BOSSY
         setactor[THISACTOR].y BOSSY
         setactor[THISACTOR].z BOSSZ
         setactor[THISACTOR].z BOSSZ
         updatesectorz monstx monsty monstz BOSSSECTOR
         updatesectorz BOSSX BOSSY BOSSZ BOSSSECTOR
         changespritesect THISACTOR BOSSSECTOR
         changespritesect THISACTOR BOSSSECTOR
     }
     }

Revision as of 20:02, 17 February 2007

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 to become their miniboss counterparts without any bugs so you can put them in user maps and\or CON hacks.

Intoduction

FOREWARNING: 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

Have you ever wanted to put the Overlord, Cycloid Emperor, or even the Alien Queen in user maps without ending the episode and without any bugs? Have you seen this before and wanted to do something about it?

4.15.8 Making the Mini-Boss
       Map Name: NONE

       The mini-boss is simply the episode end boss, but when killed, his
       death doesn't start the end sequence.  Plus, he's a lot easier to
       beat in "mini-boss" status.  To change an end boss to a mini-boss,
       simply place the boss sprite where you want it, and give it a palette
       value of 21.  To spawn a mini-boss, place a Respawn sprite where you
       want it to spawn, give it a hitag value of 2630, a lotag value equal
       to the lotag of the switch or Touchplate that toggles it, and a
       palette value of 21.

       NOTE #1: The second and third episode bosses cannot be made into
       mini-bosses without hacking the con files.  3D Realms mistakenly
       gave them only 1 health point when their palette value is anything
       but 0.  If you do make them mini-bosses, realize that they will be
       extremely easy to kill.
Taken from Jonah Bishop's Duke Nukem 3D MapFAQ v2.1. © 2000 Jonah Bishop

You've come to the right place!

The Battlelord is programmed sufficently enough to allow its placement in maps, and the official levels do contain some mini Battlelords. If you have already played Duke Nukem 64, will probably have related that in the levels Hotel Hell (E3L8.map) and Freeway (E3L11.map) there are mini Overlords instead of some mini Battlelords.

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?

Definitions

Open DEFS.CON. Search for "define BOSS1 2630".

Look at this:

define BOSS1 2630
define BOSS1STAYPUT 2631
define BOSS1SHOOT 2660
define BOSS1LOB 2670
define BOSSTOP 2696
define BOSS2 2710
define BOSS3 2760

Change it to this:

define BOSS1 2630
define BOSS1STAYPUT 2631
define BOSS1SHOOT 2660
define BOSS1LOB 2670
define BOSSTOP 2696
define BOSS2 2710
define BOSS2STAYPUT 2711
define BOSS3 2760
define BOSS3STAYPUT 2761

These two new defines enable STAYPUT versions of the Overlord and Cycloid Emperor. STAYPUT versions of actors do not leave their original sector.

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
  }

state boss1code

Search for "state boss1code" in GAME.CON.

ifaction ABOSS1FROZEN

Scroll down to this:

 ifaction ABOSS1FROZEN
 {
   ifcount THAWTIME
   {
     ai AIBOSS1SEEKENEMY
     spritepal 21
   }
   else
     ifcount FROZENDRIPTIME
   {
     ifactioncount 26
     {
       spawn WATERDRIP
       resetactioncount
     }
   }

Change it to this:

 ifaction ABOSS1FROZEN
 {
   ifcount THAWTIME
   {
     ai AIBOSS1SEEKENEMY
       getlastpal
   }
   else
     ifcount FROZENDRIPTIME
   {
     ifactioncount 26
     {
       spawn WATERDRIP
       resetactioncount
     }
   }

ifai 0

Scroll down to this:

 ifai 0
 {
   ifspritepal 0
     ai AIBOSS1RUNENEMY
   else
   {
     strength BOSS1PALSTRENGTH
     ai AIBOSS1SHOOTENEMY
   }
 }

Change it to this:

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

  ifai 0
  {
    ifspritepal 0
      ai AIBOSS1RUNENEMY
    else
    {
     strength BOSS1PALSTRENGTH
     stopallsounds
     sound BOS1_RECOG
     ai AIBOSS1SHOOTENEMY
     clipdist 16
    }
  }

actor BOSS1

Search for "actor BOSS1" in GAME.CON.

Look at this:

actor BOSS1STAYPUT BOSS1STRENGTH cactor BOSS1 enda
actor BOSS1 BOSS1STRENGTH fall state boss1code enda

Change it to this:

actor BOSS1 BOSS1STRENGTH fall state boss1code enda
actor BOSS1STAYPUT BOSS1STRENGTH fall cactor BOSS1 enda
useractor enemy BOSS1SHOOT BOSS1STRENGTH fall cactor BOSS1 ai AIBOSS1SHOOTENEMY enda // This actor automatically shoots the player.
useractor enemy BOSS1LOB BOSS1STRENGTH fall cactor BOSS1 ai AIBOSS1LOBBED enda // This actor automatically lobs MORTERs at the player.

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.

ifaction ABOSS2FROZEN

Scroll down to this:

 ifaction ABOSS2FROZEN
 {
   ifcount THAWTIME
   {
     ai AIBOSS2SEEKENEMY
       spritepal 21
   }
   else
     ifcount FROZENDRIPTIME
   {
     ifactioncount 26
     {
       spawn WATERDRIP
       resetactioncount
     }
   }

Change it to this:

 ifaction ABOSS2FROZEN
 {
   ifcount THAWTIME
   {
     ai AIBOSS2SEEKENEMY
       getlastpal
   }
   else
     ifcount FROZENDRIPTIME
   {
     ifactioncount 26
     {
       spawn WATERDRIP
       resetactioncount
     }
   }

ifai 0

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 BOSSX BOSSY BOSSZ BOSSSECTOR
       changespritesect THISACTOR BOSSSECTOR
   }
   else
   {
       getactor[THISACTOR].x BOSSX
       getactor[THISACTOR].y BOSSY
       getactor[THISACTOR].z BOSSZ
   }

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

actor BOSS2

Search for "actor BOSS2" in GAME.CON.

Look at this:

actor BOSS2 BOSS2STRENGTH fall state boss2code enda

Change it to this:

actor BOSS2 BOSS2STRENGTH fall state boss2code enda
useractor enemystayput BOSS2STAYPUT BOSS2STRENGTH fall cactor BOSS2 enda

BOSS3

Artificial Intelligence

Scroll down to this:

ai AIBOSS3SEEKENEMY ABOSS3WALK BOSS3WALKVELS seekplayer
ai AIBOSS3RUNENEMY ABOSS3RUN BOSS3RUNVELS faceplayerslow
ai AIBOSS3LOBENEMY ABOSS3LOB BOSS3STOPPED faceplayer
ai AIBOSS3DYING ABOSS3DYING BOSS3STOPPED faceplayer
ai AIBOSS3PALSHRINK ABOSS3WALK PALBOSS3SHRUNKRUNVELS faceplayer

Change it to this:

ai AIBOSS3SEEKENEMY ABOSS3WALK BOSS3WALKVELS seekplayer
ai AIBOSS3RUNENEMY ABOSS3RUN BOSS3RUNVELS faceplayerslow
ai AIBOSS3LOBENEMY ABOSS3LOB BOSS3STOPPED faceplayer
ai AIBOSS3DYING ABOSS3DYING BOSS3STOPPED faceplayer
ai AIBOSS3PALSHRINK ABOSS3WALK PALBOSS3SHRUNKRUNVELS furthestdir

That last bit is changed because otherwise BOSS3 would simply sit there while playing its walking animation.

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.

ifaction ABOSS3FROZEN

Scroll down to this:

  ifaction ABOSS3FROZEN
  {
    ifhitweapon
    {
      ifwasweapon FREEZEBLAST
      {
        strength 0
        break
      }

Change it to this:

  ifaction ABOSS3FROZEN
  {
    ifcount THAWTIME
    {
      ai AIBOSS3SEEKENEMY
        getlastpal
    }
    else
      ifcount FROZENDRIPTIME
    {
      ifactioncount 26
      {
        spawn WATERDRIP
        resetactioncount
      }
    }

ifai 0

Scroll down to this:

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

Change it to this:

   getsector[THISACTOR].lotag BOSSLOTAG // This prevents BOSS3 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 AIBOSS3RUNENEMY
    else
    {
     strength BOSS3PALSTRENGTH // This is the main bug fix. If you do not change this, the mini-bosses will only have 1 health.
     stopallsounds
     sound BOS3_RECOG
     ai AIBOSS3LOBENEMY
     clipdist 16 // This is here so that the RPGs fired from the bosses do not explode in their faces.
    }
  }

actor BOSS3

Search for "actor BOSS3" in GAME.CON.

Look at this:

actor BOSS3 BOSS3STRENGTH fall state boss3code enda

Change it to this:

actor BOSS3 BOSS3STRENGTH fall state boss3code enda
useractor enemystayput BOSS3STAYPUT BOSS3STRENGTH fall cactor BOSS3 enda

BOSS4

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

NOTE: Currently the BOSS4 section of this tutorial is incomplete, and it is something that has never been documented before. Follow the instructions below at your own risk. If you do not wish to take a risk with your code, then skip directly to the Conclusion.

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 ABOSS4FROZEN       0  1  5
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 PALBOSS4WALKVELS 48
move BOSS4WALKVELS 128
move BOSS4STOPPED

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

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

state checkboss4seekstate
 ai AIBOSS4SEEKENEMY
 ifspritepal 0 nullop
 else   // a fake way of doing a ifspritepal NOT.
   move PALBOSS4RUNVELS seekplayer
ends

Note that "state boss4palshrunkstate" and "state checkpalboss4seekstate" are 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
 getlastpal
ends

useractor enemystayput BOSS4STAYPUT BOSS4STRENGTH
  state boss4_init
  cactor BOSS4 
enda

useractor enemy BOSS4 BOSS4STRENGTH
  state boss4_init
  state boss4code
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.