Creating a pickup: Difference between revisions
Altazimuth (talk | contribs) (Add link to resources prior to moving out of user-space.) |
Altazimuth (talk | contribs) (Change tutorial to use Alfheim dialect.) |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
Before starting out you should grab the resources for this tutorial from [[File:Pickup Assets.7z]], and make sure to either rename or delete all the EDF files currently present (as it's already completed). | Before starting out you should grab the resources for this tutorial from [[File:Pickup Assets.7z]], and make sure to either rename or delete all the EDF files currently present (as it's already completed). | ||
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 | 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 thingtypes that our pickups require, as well as [[EDF_thing_reference#Eternity_Alfheim_syntax|Alfheim syntax]]. | ||
stdinclude("root.edf") // Includes the file base/root.edf, which in turns includes the other files | 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. | // that are required for definition of all sprites, sounds, things etc. | ||
setdialect("Alfheim") // Sets the dialect to Alfheim, which will impact all the lumpincluded files. | |||
// This means that the syntax "thingtype Whatever : Mobj, doomednum" can be used. | |||
'''Please note that you can call the lumps whatever you want. The lump names used here (besides EDFROOT) are just example lump names.''' | '''Please note that you can call the lumps whatever you want. The lump names used here (besides EDFROOT) are just example lump names.''' | ||
Line 20: | Line 23: | ||
Now, start editing EHEALTH. | Now, start editing EHEALTH. | ||
thingtype UglyKit | // This defines the thingtype UglyKit as a thing with doomednum 30001. Mobj is currently a dummy value. | ||
thingtype UglyKit : Mobj, 30001 | |||
{ | { | ||
flags SPECIAL // Sets flags for item, which in this case means it's a collectable item. | flags SPECIAL // Sets flags for item, which in this case means it's a collectable item. | ||
Line 30: | Line 33: | ||
message "You got health, but you didn't like it..." // The message given when picked up. | 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. | sound itemup // The sound made when the item is picked up. | ||
} | } | ||
states | states | ||
@" | @" | ||
Spawn: | Spawn: | ||
Line 58: | Line 61: | ||
Now, start editing EARMOR. | Now, start editing EARMOR. | ||
thingtype RedArmor | // This defines the thingtype RedArmor as a thing with doomednum 30002. Mobj is currently a dummy value. | ||
thingtype RedArmor : Mobj, 30002 | |||
{ | { | ||
flags SPECIAL // Sets flags for item, which in this case means it's a collectable item. | 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. | 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. | |||
} | } | ||
Line 82: | Line 85: | ||
{ | { | ||
saveamount 150 // The number the armor % is set to. | saveamount 150 // The number the armor % is set to. | ||
savefactor 2 // The numerator for the damage | savefactor 2 // The numerator for the damage multiplier fraction (2/n). | ||
savedivisor 3 // The denominator for the damage | savedivisor 3 // The denominator for the damage multiplier fraction (n/3). | ||
// These two properties combine to the | // These two properties combine to the player taking 2/3 times the damage they usually would (66%). | ||
} | } | ||
Line 96: | Line 99: | ||
Now, start editing EAMMO. | Now, start editing EAMMO. | ||
thingtype RedAmmoBox | // This defines the thingtype RedAmmoBox as a thing with doomednum 30003. Mobj is currently a dummy value. | ||
thingtype RedAmmoBox : Mobj, 30003 | |||
{ | { | ||
flags SPECIAL // Sets flags for item, which in this case means it's a collectable item. | flags SPECIAL // Sets flags for item, which in this case means it's a collectable item. | ||
Line 126: | Line 129: | ||
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. | 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. | ||
=== | ===Weapon=== | ||
Create a new lump, called | Create a new lump, called EWEAPON. Add the following to EDFROOT, on a line after the stdinclude. | ||
lumpinclude(" | lumpinclude("EWEAPON") // A new ammo pickup | ||
Now, start editing | Now, start editing EWEAPON. | ||
thingtype | // This defines the thingtype BlueLauncher as a thing with doomednum 30004. Mobj is currently a dummy value. | ||
thingtype BlueLauncher : Mobj, 30004 | |||
{ | { | ||
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. | pickupeffect // This defines what happens when the item is picked up. | ||
{ | { | ||
effects | effects BlueLauncher // The actual effects that happen when the item is picked up (can be a comma separated list). | ||
message "You got | message "You got an offensively blue missile launcher." // The message given when picked up. | ||
sound | sound wpnup // The sound made when the item is picked up. | ||
} | } | ||
states | states | ||
@" | @" | ||
Spawn: | Spawn: | ||
BLUL A -1 | |||
stop | |||
"@ | "@ | ||
} | } | ||
weapongiver BlueLauncher | |||
{ | { | ||
weapon MissileLauncher // The weaponinfo given by the weaponinfo | |||
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 | Now either type "summon BlueLauncher" (not case-sensitive) in the console, or place a thing with doomednum 30005 in the map. When you pick it up, it should give you a rocket launcher, some rockets, and cells. | ||
=== | ===Power-up=== | ||
Create a new lump, called | Create a new lump, called EPOWER. Add the following to EDFROOT, on a line after the stdinclude. | ||
lumpinclude(" | lumpinclude("EPOWER") // A new ammo pickup | ||
Now, start editing | Now, start editing EPOWER. | ||
thingtype | // This defines the thingtype Torch as a thing with doomednum 30005. Mobj is currently a dummy value. | ||
thingtype Torch : Mobj, 30005 | |||
{ | { | ||
doomednum | doomednum 30005 // This is the thing number used to place the object in a map. | ||
addflags SPECIAL|COUNTITEM|FLOATBOB // Sets flags for item, which in this case means it's a collectable item, counts in the items end tally, and floats. | |||
pickupeffect // This defines what happens when the item is picked up. | pickupeffect // This defines what happens when the item is picked up. | ||
{ | { | ||
effects | effects Torch // The actual effects that happen when the item is picked up (can be a comma separated list). | ||
message "You got | message "You got a hideous torch." // The message given when picked up. | ||
sound | sound getpow // The sound made when the item is picked up. | ||
} | } | ||
states | states | ||
@" | @" | ||
Spawn: | Spawn: | ||
TRCH ABC 3 bright | |||
loop | |||
"@ | "@ | ||
} | } | ||
powereffect Torch | |||
{ | { | ||
duration 120 // How long the power lasts in seconds. | |||
type PowerTorch // The type of power given, in this case Heretic's flickering torch. | |||
} | } | ||
Now either type "summon | Now either type "summon Torch" (not case-sensitive) in the console, or place a thing with doomednum 30005 in the map. When you pick it up, it should provide you with the Heretic-style | ||
===Artifact=== | ===Artifact=== | ||
Line 205: | Line 209: | ||
Now, start editing EKEY. | Now, start editing EKEY. | ||
thingtype GreyCard | // This defines the thingtype GreyCard as a thing with doomednum 30002. Mobj is currently a dummy value. | ||
thingtype GreyCard : Mobj, 30006 | |||
{ | { | ||
flags SPECIAL // Sets flags for item, which in this case means it's a collectable item. | flags SPECIAL // Sets flags for item, which in this case means it's a collectable item. | ||
Line 243: | Line 247: | ||
require GreyCard | require GreyCard | ||
mapcolor "#AAAAAA" // This is matched as closely as possible to the current palette | mapcolor "#AAAAAA" // This is matched as closely as possible to the current palette | ||
message "You need a grey card to activate this door" | message "You need a grey card to activate this door" | ||
remotemessage "You need a grey card to activate this object" | remotemessage "You need a grey card to activate this object" |
Latest revision as of 14:06, 29 December 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.
Before starting out you should grab the resources for this tutorial from File:Pickup Assets.7z, and make sure to either rename or delete all the EDF files currently present (as it's already completed).
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 thingtypes that our pickups require, as well as Alfheim 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. setdialect("Alfheim") // Sets the dialect to Alfheim, which will impact all the lumpincluded files. // This means that the syntax "thingtype Whatever : Mobj, doomednum" can be used.
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[edit]
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[edit]
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.
// This defines the thingtype UglyKit as a thing with doomednum 30001. Mobj is currently a dummy value. thingtype UglyKit : Mobj, 30001 { 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 @" 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[edit]
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.
// This defines the thingtype RedArmor as a thing with doomednum 30002. Mobj is currently a dummy value. thingtype RedArmor : Mobj, 30002 { 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 multiplier fraction (2/n). savedivisor 3 // The denominator for the damage multiplier fraction (n/3). // These two properties combine to the player taking 2/3 times the damage they usually would (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[edit]
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.
// This defines the thingtype RedAmmoBox as a thing with doomednum 30003. Mobj is currently a dummy value. thingtype RedAmmoBox : Mobj, 30003 { 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.
Weapon[edit]
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.
// This defines the thingtype BlueLauncher as a thing with doomednum 30004. Mobj is currently a dummy value. thingtype BlueLauncher : Mobj, 30004 { 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 given by the weaponinfo 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 30005 in the map. When you pick it up, it should give you a rocket launcher, some rockets, and cells.
Power-up[edit]
Create a new lump, called EPOWER. Add the following to EDFROOT, on a line after the stdinclude.
lumpinclude("EPOWER") // A new ammo pickup
Now, start editing EPOWER.
// This defines the thingtype Torch as a thing with doomednum 30005. Mobj is currently a dummy value. thingtype Torch : Mobj, 30005 { doomednum 30005 // This is the thing number used to place the object in a map. addflags SPECIAL|COUNTITEM|FLOATBOB // Sets flags for item, which in this case means it's a collectable item, counts in the items end tally, and floats. pickupeffect // This defines what happens when the item is picked up. { effects Torch // The actual effects that happen when the item is picked up (can be a comma separated list). message "You got a hideous torch." // The message given when picked up. sound getpow // The sound made when the item is picked up. } states @" Spawn: TRCH ABC 3 bright loop "@ } powereffect Torch { duration 120 // How long the power lasts in seconds. type PowerTorch // The type of power given, in this case Heretic's flickering torch. }
Now either type "summon Torch" (not case-sensitive) in the console, or place a thing with doomednum 30005 in the map. When you pick it up, it should provide you with the Heretic-style
Artifact[edit]
Create a new lump, called EKEY. Add the following to EDFROOT, on a line after the stdinclude.
lumpinclude("EKEY") // A new ammo pickup
Now, start editing EKEY.
// This defines the thingtype GreyCard as a thing with doomednum 30002. Mobj is currently a dummy value. thingtype GreyCard : Mobj, 30006 { 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 GreyCard // The actual effects that happen when the item is picked up (can be a comma separated list). message "Picked up a grey keycard." // The message given when picked up. sound itemup // The sound made when the item is picked up. flags ALWAYSPICKUP|LEAVEINMULTI // These flags set it so it's always picked up, but isn't removed in multiplayer. } states @" Spawn: GKEY A -1 stop "@ } artifact GreyCard { +invbar // This means that the key will show up in the Heretic-style inventory bar. icon GKEYA0 // The icon for the graphic in the (Heretic-style) inventory bar. // Bear in mind these offsets are combined with the patch offsets instead of overriding them. icon.offset.x -15 // Patch-style x offset for inventory bar (positive is left). icon.offset.y -26 // Patch-style y offset for inventory bar (positive is up). artifacttype Key // This designates this artifact as a key. This means that the idk cheat would give this new item. // The other types are Normal, Ammo, Puzzle, Power, Weapon, and Quest. Of these types Normal // is the default. You will likely only ever need to make Normal (implicitly), Ammo, or Key artifacts. } // Don't worry about this, as lockdefs will probably be covered another day lockdef 300 { require GreyCard mapcolor "#AAAAAA" // This is matched as closely as possible to the current palette message "You need a grey card to activate this door" remotemessage "You need a grey card to activate this object" }
Now either type "summon GreyCard" (not case-sensitive) in the console, or place a thing with doomednum 30006 in the map. When you pick it up open your inventory bar (you'll need keys bound for that) and it should be in there.
Sprite-based pickup[edit]
Sprite-based pickups are what almost all IWAD pickups use, and are mostly there for backwards-compatibility.