EDF item effects and inventory: Difference between revisions

From Eternity Wiki
Jump to navigationJump to search
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
Define what happens when an item is picked up and used (and eventually, dropped from the inventory - this is not complete yet). A tutorial on defining each of these can be found at [[Creating a pickup]].
Define what happens when an item is picked up and used (and eventually, dropped from the inventory - this is not complete yet). A tutorial on defining each of these can be found at [[Creating a pickup]].


==Thing type defined pick-up==
==Thing type based pick-up==
The recommended way to define pick-up effects is by adding the '''pickupeffect''' section in the [[thingtype]] definition of a class.
The recommended way to define pick-up effects is by adding the '''pickupeffect''' section in the [[thingtype]] definition of a class.


Line 11: Line 11:
   pickupeffect
   pickupeffect
   {
   {
   effects             <name>, ...
   effects     <name>, ...
   flags               <flags>
   flags       <flags>
   changeweapon         <name>
   changeweapon <name>
   message             <text>
   message     <text>
   sound               <name>
   sound       <name>
   }
   }
   ...
   ...
Line 21: Line 21:
For explanation of the fields, see the sprite-based block definition's corresponding fields.
For explanation of the fields, see the sprite-based block definition's corresponding fields.


==Sprite-triggered pick-ups==
==Sprite based pick-ups==
===pickupeffect===
===pickupeffect===
Defines what happens when player picks up an item with the '''SPECIAL''' [[Thing type flags|flag]]. Commonly in DOOM and Heretic, pick-up effects are associated with the visual sprites of the things, instead of being mapped directly to the thing class.
Defines what happens when player picks up an item with the '''SPECIAL''' [[Thing type flags|flag]]. Commonly in DOOM and Heretic, pick-up effects are associated with the visual sprites of the things, instead of being mapped directly to the thing class.
Line 37: Line 37:
====Explanation of fields====
====Explanation of fields====
*'''sprite'''
*'''sprite'''
:Default: do not use sprite.
:Default: no sprite.
:If set as a four-character sprite name, this will associate any [[thingtype]] with the '''SPECIAL''' [[Thing type flags|flag]] whose current sprite shows as this value to trigger this '''pickupeffect'''.
:If set as a four-character sprite name, this will associate any [[thingtype]] with the '''SPECIAL''' [[Thing type flags|flag]] whose current sprite shows as this value to trigger this '''pickupeffect'''.
:Example: <code>sprite BON1</code>
:Example: <code>sprite BON1</code>
Line 55: Line 55:
*'''changeweapon'''
*'''changeweapon'''
:Default: nothing.
:Default: nothing.
:If set, causes the item to change player's current weapon to the designated one whenever picked up. This is based on how the [[Doom Wiki:Berserk|Berserk pack]] acts in DOOM.
:If set, causes the item to change player's current weapon to the designated one whenever picked up. Expects a [[weaponinfo]] definition. This is based on how the [[Doom Wiki:Berserk|Berserk pack]] acts in DOOM.
:Example: <code>changeweapon Fist</code>
:Example: <code>changeweapon Fist</code>
*'''message'''
*'''message'''
Line 143: Line 143:
  }
  }
====powereffect====
====powereffect====
Power givers give a power to the player.
Power givers buff the player with a temporary or level-permanent effect. They're typical of artifacts such as the radiation suit or the blur sphere.
  powereffect <name>
  powereffect <name>
  {
  {
Line 153: Line 153:
   [+-]overridesself // if +, getting the power again while still under its influence is allowed
   [+-]overridesself // if +, getting the power again while still under its influence is allowed
  }
  }
'''Type''' can be any of the following:
*'''PowerAllmap''': Doom computer area map, Heretic map scroll
*'''PowerFlight''': Heretic wings of wrath
*'''PowerGhost''': Heretic shadow sphere
*'''PowerInvulnerable''': Doom invulnerability artifact, Heretic ring of invulnerability
*'''PowerIronFeet''': Doom radiation shielding suit
*'''PowerLightAmp''': Doom light amplification visor
*'''PowerPartialInvisibility''': Doom blur artifact
*'''PowerSilent''': Eternity silencer
*'''PowerStrength''': Doom berserk pack
*'''PowerTorch''': Heretic torch
*'''PowerTotalInvisibility''': Eternity total invisibility
*'''PowerWeaponLevel2''': Heretic tome of power
====weapongiver====
====weapongiver====
Weapon givers give a Weapon type artifact to the player, and optionally any number of Ammo artifact types.
Weapon givers give a Weapon type artifact to the player, and optionally any number of Ammo artifact types.

Latest revision as of 10:32, 1 January 2022

Define what happens when an item is picked up and used (and eventually, dropped from the inventory - this is not complete yet). A tutorial on defining each of these can be found at Creating a pickup.

Thing type based pick-up[edit]

The recommended way to define pick-up effects is by adding the pickupeffect section in the thingtype definition of a class.

The fields are as such:

thingtype <name>
{
 ...
 pickupeffect
 {
  effects      <name>, ...
  flags        <flags>
  changeweapon <name>
  message      <text>
  sound        <name>
 }
 ...
}

For explanation of the fields, see the sprite-based block definition's corresponding fields.

Sprite based pick-ups[edit]

pickupeffect[edit]

Defines what happens when player picks up an item with the SPECIAL flag. Commonly in DOOM and Heretic, pick-up effects are associated with the visual sprites of the things, instead of being mapped directly to the thing class.

In the base game definitions, you can find the pick-up effects defined in sprites.edf.

pickupeffect <name>
{
 sprite       <name>
 effects      <name>, ...
 flags        <flags>
 changeweapon <name>
 message      <text>
 sound        <name>
}

Explanation of fields[edit]

  • sprite
Default: no sprite.
If set as a four-character sprite name, this will associate any thingtype with the SPECIAL flag whose current sprite shows as this value to trigger this pickupeffect.
Example: sprite BON1
  • effects
Default: no effect.
This is a list of effects incurred on player when picking up the item. Each one must be defined in EDF as one of the following: ammoeffect, armoreffect, artifact, healtheffect, powereffect or weapongiver.
Example: effects Berserk, BerserkHealth
  • flags
Default: no flags.
This is an optional set of one or more flags, joined together by | (vertical bar). The flags you can use are:
  • ALWAYSPICKUP: item shall always be picked, even if according to the effects, there would be no need for the item. Example: health potions in DOOM.
  • LEAVEINMULTI: if game is multiplayer, keep item on the ground for every players to find it. Commonly used by access keys.
  • NOSCREENFLASH: if picked up, item will not flash player's screen.
  • SILENTNOBENEFIT: only has effect in conjunction with ALWAYSPICKUP: if picked up when unneeded, all user feedback (message, sound, flash) is suppressed.
  • COMMERCIALONLY: only relevant for demo compatibility, marks the item as DOOM 2 (the "commercial" release) specific. The megasphere has this flag. Not needed for new mods.
  • GIVESBACKPACKAMMO: commonly used by the entries with the BackpackItem in effects (which doubles player's ammo capacity) to also provide the backpack ammo amount for each available ammo artifact in the game.
  • changeweapon
Default: nothing.
If set, causes the item to change player's current weapon to the designated one whenever picked up. Expects a weaponinfo definition. This is based on how the Berserk pack acts in DOOM.
Example: changeweapon Fist
  • message
Default: no message.
What message to display at the top of the view when picking up the item. This doesn't cover special cases such as the medikit low health message or the special BFG9000 variants.
Example: message "picked up an item."
  • sound
Default: none
Sets the sound to play when picking up the item.
Example: sound itemup

Note: the pfxname field (which you may encounter in the base EDF) is only needed for compatibility with a deprecated feature.

Effect definitions[edit]

From a pickupeffect's effects field, one can add from many different types of item effect definitions:

Base definitions[edit]

artifact[edit]

An artifact is an item which, when collected, goes into the player's inventory.

artifact <name>
{
 amount         <int> // amount gained with one pickup
 maxamount      <int> // max amount that can be carried in inventory
 interhubamount <int> // max amount carryable between levels in different hubs;
                      // -1 if this field should not apply at all
 sortorder      <int> // key used for sorting the player's inventory
 icon           <str> // name of icon graphic for invbar
 usesound       <str> // sound made when item is used
 useeffect      <str> // name of item effect to use for activation
 useaction      <action function> // codepointer and arguments called (e.g. A_GauntletAttack(1))
 
 [+-]undroppable      // if +, cannot be dropped from inventory
 [+-]invbar           // if +, appears in invbar; otherwise, invisible
 [+-]keepdepleted     // if +, will remain in inventory with amount of zero
 [+-]fullamountonly   // if +, cannot pickup unless full amount is needed
 [+-]noshareware      // if +, non-shareware
 
 // artifacttype determines what sort of artifact this is.  
 artifacttype   <str> // "Normal", "Ammo", "Key", "Puzzle", "Power", "Weapon",
                      // or "Quest"
                      
 // The following fields apply only to certain artifact types. They have no
 // effect if specified on other types.
 
 // Ammo
 ammo.backpackamount    <int> // amount of this ammo type given by a Backpack
 ammo.backpackmaxamount <int> // max amount after collecting a Backpack
}

healtheffect[edit]

A health effect gives the player health in one of many possible ways.

healtheffect <name>
{
 amount     <int> // amount of health to give
 maxamount  <int> // max amount this item can health to.
 lowmessage <str> // alternate message to give instead of pickupfx message when
                  // health is less than amount; if starts with $, is a BEX mnemonic.
 
 [+-]alwayspickup  // if +, item is picked up even when unneeded (e.g. Health Bonus)
 [+-]sethealth     // if +, item SETS health rather than adding to it (e.g. Megasphere)
}

armoreffect[edit]

An armor effect defines the properties of player armor

armoreffect <name>
{
 saveamount    <int> // amount of armor given
 savefactor    <int> // numerator of fraction determining save percentage
 savedivisor   <int> // denominator of fraction determining save percentage
 maxsaveamount <int> // max amount his item can give; if player has greater
                     // armor, the item cannot be picked up at all
                     
 [+-]alwayspickup    // item is picked up even when unneeded (e.g. Armor Bonus)
 [+-]additive        // if +, adds to the current amount of armor
 [+-]setabsorption   // if +, sets absorption values (savefactor & savedivisor)
}

ammoeffect[edit]

Ammo givers give an Ammo type artifact to the player.

ammoeffect <name>
{
 ammo       <str> // Name of an Ammo-type artifact definition
 amount     <int> // Amount to give for an ordinary pickup
 dropamount <int> // Amount to give if dropped by an enemy
 
 [+-]ignoreskill  // if +, does not double on skills that give double ammo  
}

powereffect[edit]

Power givers buff the player with a temporary or level-permanent effect. They're typical of artifacts such as the radiation suit or the blur sphere.

powereffect <name>
{
 duration   <int>  // Length of time to last in tics
 type       <str>  // Name of power to give
 
 [+-]additivetime  // if +, adds to current duration
 [+-]permanent     // if +, lasts forever  
 [+-]overridesself // if +, getting the power again while still under its influence is allowed
}

Type can be any of the following:

  • PowerAllmap: Doom computer area map, Heretic map scroll
  • PowerFlight: Heretic wings of wrath
  • PowerGhost: Heretic shadow sphere
  • PowerInvulnerable: Doom invulnerability artifact, Heretic ring of invulnerability
  • PowerIronFeet: Doom radiation shielding suit
  • PowerLightAmp: Doom light amplification visor
  • PowerPartialInvisibility: Doom blur artifact
  • PowerSilent: Eternity silencer
  • PowerStrength: Doom berserk pack
  • PowerTorch: Heretic torch
  • PowerTotalInvisibility: Eternity total invisibility
  • PowerWeaponLevel2: Heretic tome of power

weapongiver[edit]

Weapon givers give a Weapon type artifact to the player, and optionally any number of Ammo artifact types.

weapongiver <name>
{
 weapon     <str> // Name of a weaponinfo to give to the player
 // Note that you can specify as many ammogiven properties as you want in a single weapongiver
 ammogiven  <ammo>, <amount> [, <dropammount> [, <dmammount> [, <coopweaponsstay>]]] // Ammo type artifact given, and the amounts
                                                                                     // given based on how it was picked up. If the
                                                                                     // last three are left blank, only "amount" is used.
}

Delta structures[edit]

The following can be used to replace already defined effects. They can be cascaded (i.e. any number of loaded mods can change the previous definition and all its deltas). For each of them, the name field represents the name of the base to modify. They are the following:

healthdelta
{
 name <name>
 ...
}
armordelta
{
 name <name>
 ...
}
ammodelta
{
 name <name>
 ...
}
powerdelta
{
 name <name>
 ...
}
weapongiverdelta
{
 name <name>
 clearammogiven   // if added, removes the "given ammo" definitions
 ...
}
artifactdelta
{
 name <name>
 ...
}