Creating a pickup: Difference between revisions

From Eternity Wiki
Jump to navigationJump to search
m (Add disclaimer and ammo section.)
(Add weapon section.)
Line 127: Line 127:


===Weapon===
===Weapon===
Create a new lump, called EWEAPON. Add the following to EDFROOT, on a line after the stdinclude.
lumpinclude("EWEAPON") // A new ammo pickup
Now, start editing EWEAPON.
thingtype BlueLauncher
{
  doomednum  30004    // 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 BlueLauncher // The actual effects that happen when the item is picked up (can be a comma separated list).
    message "You got an offensively blue missile launcher." // The message given when picked up.
    sound  wpnup        // The sound made when the item is picked up.
  }
  states
  @"
  Spawn:
    BLUL A -1
    stop
  "@
}
weapongiver BlueLauncher
{
  weapon MissileLauncher            // The weaponinfo name given by the weapongiver.
  ammogiven AmmoMissile, 2, 1, 5, 2 // Ammo type given, and values in order, normal, dropped,
                                    // DM w/ weapons stay, coop w/ weapons stay.
  ammogiven AmmoCell, 10            // You can define as many as you want. In this case, it gives 10 cells always
                                    // (but is doubled for certain skill levels).
}
Now either type "summon BlueLauncher" (not case-sensitive) in the console, or place a thing with doomednum 30004 in the map. When you pick it  up, it should give you a rocket launcher, some rockets, and cells.


===Artifact===
===Artifact===

Revision as of 14:42, 28 January 2018

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 pickup will have its own unique lump which contains the necessary EDF. 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 when defining the the thingtypes that our pickups require.

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.

Please note that you can call the lumps whatever you want. The lump names used here (besides EDFROOT) are just example lump names.

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 editing 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.
}

Now either type "summon UglyKit" (not case-sensitive) in the console, or place a thing with doomednum 30001 in the map. When you pick it up, it should heal you up to 150 health, and if your health is less than 30 prior to pickup then it will display the lowmessage.

Armor

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

lumpinclude("EARMOR") // A new armor pickup

Now, start editing EARMOR.

thingtype RedArmor 
{
  doomednum   30002   // 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 RedArmor   // The actual effects that happen when the item is picked up (can be a comma separated list).
   message "Picked up the HyperArmor!" // The message given when picked up.
   sound   itemup    // The sound made when the item is picked up.
  }

  states
  @"
  Spawn:
    RARM A 6
    RARM B 7 bright
    loop
  "@
}

armoreffect RedArmor
{
  saveamount  150 // The number the armor % is set to.
  savefactor  2   // The numerator for the damage absorption fraction (2/n).
  savedivisor 3   // The denominator for the damage absorption fraction (n/3).
                  // These two properties combine to the armor absorbing 2/3 the damage the player would usually would take (66%).
}

Now either type "summon RedArmor" (not case-sensitive) in the console, or place a thing with doomednum 30002 in the map. When you pick it up, it should set your armor to 150. In addition, 66% of damage dealt to you will be absorbed by the armor.

Ammo

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

lumpinclude("EAMMO") // A new ammo pickup

Now, start editing EAMMO.

thingtype RedAmmoBox
{
  doomednum   30003    // 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 RedAmmoBox // The actual effects that happen when the item is picked up (can be a comma separated list).
    message "You got lazily-recolored ammo." // The message given when picked up.
    sound   itemup     // The sound made when the item is picked up.
  }

  states
  @"
  Spawn:
    RAMM A -1
    stop
  "@
}

ammoeffect RedAmmoBox
{
  ammo       AmmoClip // The type of ammo given
  amount     75       // The amount of ammo given

  +ignoreskill        // ignoreskill is a flag. When + it makes it so it ignores skills that double ammo
}

Now either type "summon RedAmmoBox" (not case-sensitive) in the console, or place a thing with doomednum 30003 in the map. When you pick it up, it should give you 75 bullets, regardless of difficulty.

Power-up

Weapon

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

lumpinclude("EWEAPON") // A new ammo pickup

Now, start editing EWEAPON.

thingtype BlueLauncher
{
  doomednum   30004    // 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 BlueLauncher // The actual effects that happen when the item is picked up (can be a comma separated list).
    message "You got an offensively blue missile launcher." // The message given when picked up.
    sound   wpnup        // The sound made when the item is picked up.
  }

  states
  @"
  Spawn:
    BLUL A -1
    stop
  "@
}

weapongiver BlueLauncher
{
  weapon MissileLauncher            // The weaponinfo name given by the weapongiver.
  ammogiven AmmoMissile, 2, 1, 5, 2 // Ammo type given, and values in order, normal, dropped,
                                    // DM w/ weapons stay, coop w/ weapons stay.
  ammogiven AmmoCell, 10            // You can define as many as you want. In this case, it gives 10 cells always
                                    // (but is doubled for certain skill levels).
}

Now either type "summon BlueLauncher" (not case-sensitive) in the console, or place a thing with doomednum 30004 in the map. When you pick it up, it should give you a rocket launcher, some rockets, and cells.

Artifact

Sprite-based pickup

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