Creating a monster: Difference between revisions

From Eternity Wiki
Jump to navigationJump to search
m (Fixed code not being in one big block.)
m (Finished off commenting for the Zombieman.)
Line 45: Line 45:
     }
     }
   
   
     firstdecoratestate S_POSS_STND
     firstdecoratestate S_POSS_STND               // Defines the first DECORATE state that this thingtype occupies. Not required unless
     states
                                                // the intention is to make the DECORATE states of this thing accessible from other thing types.
     @"
 
     Spawn:
     states                                       // This declares that the following block is the thingtype's states.
       POSS AB 10 A_Look
     @"                                           // The equivalent to an opening curly brace.
     Spawn:                                       // State the thing is spawned at.
       POSS AB 10 A_Look                         // Call the function A_Look, using sprites POSSA and POSSB, each for 10 frames.
      loop                                      // Loop back to the start of this label.
    See:                                        // State the monster goes into after seeing a target.
      POSS AABBCCDD 4 A_Chase                  // Call the function A_Chase, calling it twice for sprites POSSA-D, each time for 4 frames.
       loop
       loop
    See:
     Missile:                                     // State the monster goes into when deciding to shoot its target.
      POSS AABBCCDD 4 A_Chase
       POSS E 10 A_FaceTarget                   // Call the action function A_FaceTarget.
      loop
       POSS F  8 A_MissileAttack(MBFBetaPlasma1) // Call the action function A_MissileAttack with parameter MBFBetaPlasma1,
     Missile:
                                                // and leave the rest of the parameters as default (all 0 in this case).
       POSS E 10 A_FaceTarget
       POSS F  8 A_MissileAttack(MBFBetaPlasma1)
       POSS E  8  
       POSS E  8  
       goto See
       goto See                                 // Jump to state See. Note that the next line after a goto MUST be labelled,
     Pain:
                                                // unlike ZDoom.
     Pain:                                       // State it goes into when hit by attack that successfully triggers this pain state.
       POSS G 3
       POSS G 3
       POSS G 3 A_Pain
       POSS G 3 A_Pain
       goto See
       goto See
     Death:
     Death:                                       // State it goes into when killed or otherwise destroyed.
       POSS H 5
       POSS H 5
       POSS I 5 A_Scream
       POSS I 5 A_Scream
Line 70: Line 74:
       POSS L -1
       POSS L -1
       stop
       stop
     XDeath:
     XDeath:                                     // Optional state it goes into when killed with very high damage.
       POSS M      5
       POSS M      5
       POSS N      5 A_XScream
       POSS N      5 A_XScream
       POSS O      5 A_Fall
       POSS O      5 A_Fall
       POSS PQRST  5
       POSS PQRST  5
       POSS U    -1
       POSS U    -1                             // This frame has infinite duration as it has been given a length of -1.
       stop
       stop                                     // This is the equivalent of setting the next frame to 0. If the last frame
     Raise:
                                                // has a finite duration (not -1), then it will disappear. otherwise it's often
                                                // used after -1 duration frames when nothing is expected to follow.
     Raise:                                       // Optional state that the corpse goes into when revived by an Arch-vile.
       POSS KJIH 5
       POSS KJIH 5
       goto See
       goto See
     "@
     "@                                           // The equivalent to a closing brace.
  }
  }

Revision as of 07:58, 22 June 2016

Though not quite as easy as creating a simple decoration, creating a monster is still a relatively basic task. In this tutorial we will define two monsters: one which only uses IWAD assets, and one that uses brand new sprites. We will also start using includes in order to keep both these monsters in separate EDF lumps.

Much like creating a simple decoration, we will start by creating a text lump named EDFROOT, but for this tutorial we will also make another two text lumps called EZOMBIE and EARACORB. We will include these lumps in EDFROOT so that the monsters defined in the files can be used.

stdinclude("root.edf") // Includes the file base/root.edf, which in turns includes the other files
                       // that are required for definition of all sprites, sounds, things etc.

// New monsters:
lumpinclude("EZOMBIE")  // A new monster using already defined assets
lumpinclude("EARACORB") // A new monster using brand new sprites

Now we will start editing EZOMBIE to define on of our new monsters. For this tutorial we will start using DECORATE state syntax.

thingtype MutatedZombie
{
   doomednum   30001    // This is the thing number used to place the object in a map.

   basictype   Monster  // This uses a predefined set of flags for this object. basictype Monster is equivalent
                        // to setting cflags as SOLID | SHOOTABLE | COUNTKILL | FOOTCLIP | SPACMONSTER | PASSMOBJ.

   spawnhealth 30       // The amount of health the monster spawns with.
   painchance  128      // The likelihood that the monster goes to a pain state if it is hit.
                        // Percentage chance is (painchance/256)*100, so for this monster it would be 50%.

   speed       8        // 

   radius      20.0     // The radius and height set the physical size
   height      56.0     // of the object, for collision detection.

   droptype    AmmoClip // The thingtype dropped by the monster when it dies.

   seesound    sawup    // The sounds made when the monster sees, attacks, is put in pain state, dies,
   attacksound sawhit   // and makes ambient noise respectively. These particular sounds are defined by sounds.edf
   painsound   sawful   // and are the DeHackEd names for the chainsaw noises.
   deathsound  sawidl
   activesound sawhit

   obituary_normal "was turned to goo by a mutated zombie" // The message displayed when the player is killed by this
                                                           // monster, using a a projectile or other miscellaneous attack.

   acs_spawndata        // The identification number used by various parameterised specials, like Thing_Spawn.
   {                    // it also limits the number to a game namespace. Heretic objects use "modes heretic"
      num   255         // instead of "modes doom".
      modes doom
   }

   firstdecoratestate S_POSS_STND               // Defines the first DECORATE state that this thingtype occupies. Not required unless
                                                // the intention is to make the DECORATE states of this thing accessible from other thing types.
   states                                       // This declares that the following block is the thingtype's states.
   @"                                           // The equivalent to an opening curly brace.
   Spawn:                                       // State the thing is spawned at.
      POSS AB 10 A_Look                         // Call the function A_Look, using sprites POSSA and POSSB, each for 10 frames.
      loop                                      // Loop back to the start of this label.
   See:                                         // State the monster goes into after seeing a target.
      POSS AABBCCDD 4 A_Chase                   // Call the function A_Chase, calling it twice for sprites POSSA-D, each time for 4 frames.
      loop
   Missile:                                     // State the monster goes into when deciding to shoot its target.
      POSS E 10 A_FaceTarget                    // Call the action function A_FaceTarget.
      POSS F  8 A_MissileAttack(MBFBetaPlasma1) // Call the action function A_MissileAttack with parameter MBFBetaPlasma1,
                                                // and leave the rest of the parameters as default (all 0 in this case).
      POSS E  8 
      goto See                                  // Jump to state See. Note that the next line after a goto MUST be labelled,
                                                // unlike ZDoom.
   Pain:                                        // State it goes into when hit by attack that successfully triggers this pain state.
      POSS G 3
      POSS G 3 A_Pain
      goto See
   Death:                                       // State it goes into when killed or otherwise destroyed.
      POSS H 5
      POSS I 5 A_Scream
      POSS J 5 A_Fall
      POSS K 5
      POSS L -1
      stop
   XDeath:                                      // Optional state it goes into when killed with very high damage.
      POSS M      5
      POSS N      5 A_XScream
      POSS O      5 A_Fall
      POSS PQRST  5
      POSS U     -1                             // This frame has infinite duration as it has been given a length of -1.
      stop                                      // This is the equivalent of setting the next frame to 0. If the last frame
                                                // has a finite duration (not -1), then it will disappear. otherwise it's often
                                                // used after -1 duration frames when nothing is expected to follow.
   Raise:                                       // Optional state that the corpse goes into when revived by an Arch-vile.
      POSS KJIH 5
      goto See
   "@                                           // The equivalent to a closing brace.
}