Creating a pickup

From Eternity Wiki
Revision as of 18:23, 24 January 2018 by Altazimuth (talk | contribs) (Add health section.)
Jump to navigationJump to search

Creating a pickup is effectively creating a simple decoration, but with a few more steps. You should read that tutorial first before continuing on here. In this tutorial we will define several pickups, each with its own section. In addition, the multiple ways in which a pickup can be defined will also be explored.

Much like creating a simple decoration, we will start by creating a text lump named EDFROOT, but for this tutorial each section will have its own unique lump name. We will include these lumps in EDFROOT so that the relevant pickups defined in the files can be used. For this tutorial we will use DECORATE state syntax.

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.

Thing-based pickup

Thing-based pickups offer a more streamlined end-user experience than sprite-based pickups, and so it is suggested that you use thing-based pickups. In addition, thing-based pickups take priority over sprite-based pickups, and if a pickup has both available, it will only use the one that is in its thingtype definition.

Health

Create a new lump, called EHEALTH. Add the following to EDFROOT, on a line after the stdinclude.

lumpinclude("EHEALTH") // A new health pickup

Now, start editting EHEALTH.

thingtype UglyKit
{
  doomednum   30001   // This is the thing number used to place the object in a map.
  flags       SPECIAL // Sets flags for item, which in this case means it's a collectable item.

  pickupeffect        // This defines what happens when the item is picked up.
  {
    effects UglyKit   // The actual effects that happen when the item is picked up (can be a comma separated list).
    message "You got health, but you didn't like it..." // The message given when picked up.
    sound   itemup    // The sound made when the item is picked up.
  } 

  states // This declares that the following block is the thingtype's states.
  @"
  Spawn:
    UMED A -1
    stop
  "@
}

healtheffect UglyKit
{
  amount    15  // The amount of health given per pickup.
  maxamount 150 // The maximum amount the pickup will heal up to.

  lowmessage "You got health, but you're not sure how to feel about it." // The message displayed if the player
                                                                         // has less then twice the health given.
}

Armor

Ammo

Power-up

Weapon

Artifact

Sprite-based pickup

Sprite-based pickups are what almost all IWAD pickups use, and are mostly there for backwards-compatibility.