EDF weapon reference: Difference between revisions

From Eternity Wiki
Jump to navigationJump to search
(Add ID and state parameters.)
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
TODO: Initial spiel.
Weapon info define weapons, simple as. They have unique names, or mnemonics, for easy identification. They're currently referenced solely by weapongivers (see [[EDF item effects and inventory]] for more info on those).


{{See|User:Altazimuth/Weapon info flags}}
If a weapon info's mnemonic is not unique, the latest definition of a weapon info with that mnemonic replaces any earlier ones. Like most other identifiers in EDF (but not lump names or subnames), weapon info mnemonics are completely case-insensitive.
 
New objects, created via EDF files or wad lumps, can be later tweaked with weapon deltas. New weapon info should not be given a '''dehackednum''' property, as this is reserved solely for internal weapons so that mods that modify weapons with DeHackEd (BEX) patches remain compatible with Eternity.
 
{{See|Weapon info flags}}
{{Backto|EDF}}
{{Backto|EDF}}


==Eternity Alfheim syntax==
==Eternity Alfheim syntax==
For versions of Eternity from Alfheim up, EDF weaponinfo support the following syntax. Make sure to add:
EDF weaponinfo supports pre-Alfheim and Alfehim syntax. Make sure to add:
  setdialect("ALFHEIM")
  setdialect("ALFHEIM")
before using this syntax:
before using this syntax:
Line 25: Line 29:
    
    
   ammotype              <artifact mnemonic>
   ammotype              <artifact mnemonic>
  ammotype2              <artifact mnemonic>
    
    
   upstate                <frame>
   upstate                <frame>
Line 31: Line 36:
   attackstate            <frame>
   attackstate            <frame>
   flashstate            <frame>
   flashstate            <frame>
  holdstate              <frame>
  attackstate2          <frame>
  flashstate2            <frame>
  holdstate2            <frame>
  fullscreenoffset      <number>
    
    
   ammouse                <number>
   ammouse                <number>
  ammouse2              <number>
 
  selectionorder        <floating-point number>
  slotnumber            <number>
  slotselectionorder    <floating-point number>
    
    
   nextincycle            <weapon info mnemonic>
   sisterweapon          <weapon info mnemonic>
  previncycle            <weapon info mnemonic>
    
    
   cflags                <flag list>
   flags                  <flag list>
   addflags              <flag list>
   addflags              <flag list>
   remflags              <flag list>
   remflags              <flag list>
Line 43: Line 58:
   mod                    <MOD name OR number>
   mod                    <MOD name OR number>
    
    
   recoil                <number>
   recoil                <floating-point number>
   hapticrecoil          <number>
   hapticrecoil          <number>
   haptictime            <number>
   haptictime            <number>
Line 49: Line 64:
   upsound                <sound>
   upsound                <sound>
   readysound            <sound>
   readysound            <sound>
 
  tracker                <string, TO BE REMOVED>
    
    
   firstdecoratestate    <frame>
   firstdecoratestate    <frame>
Line 63: Line 76:
:Default = (nothing)
:Default = (nothing)
:Sets the weapon info from which this will copy properties. All of the properties except '''dehackednum''' will be copied from the base actor type.
:Sets the weapon info from which this will copy properties. All of the properties except '''dehackednum''' will be copied from the base actor type.
 
====Ammunition====
*'''ammotype'''
:The [[EDF item effects and inventory|artifact]] of the inventory type to consume when firing. Omit this if weapon consumes no ammo.
*'''ammouse'''
:Default: 0
:Sets the number of ammo items to consume per shot. If not set, it will not consume ammo.
*'''ammotype2
:The ammo type for the optional alternative fire.
*'''ammouse2'''
:Default: 0
:Sets the number of optional alternative ammo items to consume per shot. If not set, it will not consume ammo.


====States====
====States====
*'''firstdecoratestate'''
*'''firstdecoratestate'''
:Sets the first frame in a sequential list of dummy frames that use the internal Decorate-style defined '''states''' of this actor for [[EDF delta structures|framedelta]] compatibility. It's not required unless the intention is to make the Decorate states of this thing accessible from other thing types. Default games' (Doom, Heretic) thing types use externalized frames for all thing types, for compatibility.
:Sets the first frame in a sequential list of dummy frames that use the internal Decorate-style defined '''states''' of this actor for [[EDF delta structures|framedelta]] compatibility. It's not required unless the intention is to make the Decorate states of this weapon accessible from other weapon info. Default games' (Doom, Heretic) weapon info use externalized frames for all weapon info, for compatibility.
*'''states'''
*'''states'''
{{see|DECORATE state syntax}}
{{see|DECORATE state syntax}}
:Default = nothing
:Default = nothing
:Defines frames using [http://zdoom.org/wiki/DECORATE DECORATE]-style state definitions. This means it won't be necessary to define separate [[frame]] blocks for each individual frame. See the DECORATE reference at the ZDoom wiki for documentation on its syntax. Using the '''states''' field instead of any of the ones below results in more concise text, but also the newly created frames won't be accessible from outside (other thingtypes, Dehacked patches or delta structures), unless you use the '''firstdecoratestate''' field as well. Like normally, [[List of codepointers|codepointers]] may or may not be preceded by '''A_'''. The DECORATE code has to be implemented via a heredoc: a text string that spans on multiple lines. Unlike a regular string which uses quotation marks, the heredoc is marked by @" and "@ respectively. Example on an shotgun-like (the '=' sign is optional):
:Defines frames using [http://zdoom.org/wiki/DECORATE DECORATE]-style state definitions. This means it won't be necessary to define separate [[frame]] blocks for each individual frame. See the DECORATE reference at the ZDoom wiki for documentation on its syntax. Using the '''states''' field instead of any of the ones below results in more concise text, but also the newly created frames won't be accessible from outside (other weaponinfo, Dehacked patches or delta structures), unless you use the '''firstdecoratestate''' field as well. Like normally, [[List of codepointers|codepointers]] may or may not be preceded by '''A_'''. The DECORATE code has to be implemented via a heredoc: a text string that spans on multiple lines. Unlike a regular string which uses quotation marks, the heredoc is marked by @" and "@ respectively. Example on an shotgun-like weapon (the '=' sign is optional):
  states =
  states =
   @"
   @"
Line 99: Line 122:
*'''upstate'''
*'''upstate'''
:Default = S_NULL
:Default = S_NULL
:Sets the frame which a weapon starts in when it is raised.If the object is supposed to have any dynamic purpose or be visible, do not leave the '''upstate''' at S_NULL.
:Sets the frame which a weapon starts in when it is raised. If the object is supposed to have any dynamic purpose or be visible, do not leave the '''upstate''' at S_NULL. Equivalent to the '''Select''' Decorate state.
*'''downstate'''
*'''downstate'''
:Default = S_NULL
:Default = S_NULL
:Sets the frame which a weapon starts in when it is being lowered. If the object is supposed to have any dynamic purpose or be visible, do not leave the '''downstate''' at S_NULL.
:Sets the frame which a weapon starts in when it is being lowered. If the object is supposed to have any dynamic purpose or be visible, do not leave the '''downstate''' at S_NULL. Equivalent to the '''Deselect''' Decorate state.
*'''readystate'''
*'''readystate'''
:Default = S_NULL
:Default = S_NULL
:Sets the frame which a thing starts in when it is ready to be fired. If the object is supposed to have any dynamic purpose or be visible, do not leave the '''readystate''' at S_NULL.
:Sets the frame which a weapon starts in when it is ready to be fired. If the object is supposed to have any dynamic purpose or be visible, do not leave the '''readystate''' at S_NULL. Equivalent to the '''Ready''' Decorate state.
*'''attackstate'''
*'''attackstate'''
:Default = S_NULL
:Default = S_NULL
:Sets the frame which a weapon goes to if the user tries to perform a primary attack. Though not necessary, it is suggested for weapons to have an attackstate for primary firing purposes.
:Sets the frame which a weapon goes to if the user tries to perform a primary attack. Though not necessary, it is suggested for weapons to have an attackstate for primary firing purposes. Equivalent to the '''Fire''' Decorate state.
*'''flashstate'''
*'''flashstate'''
:Default = S_NULL
:Default = S_NULL
:Sets the frame which a weapon jumps to if a [[List of codepointers|codepointer]] causes a weapon to flash.
:Sets the frame which a weapon jumps to if a [[List of codepointers|codepointer]] causes a weapon to flash. Equivalent to the '''Flash''' Decorate state.
*'''holdstate'''
*'''holdstate'''
:Default = S_NULL
:Default = S_NULL
:Sets the frame jumped to by [[A_ReFire]] if the player is still holding the primary attack button.
:Sets the frame jumped to by [[ReFire|A_ReFire]] if the player is still holding the primary attack button. Equivalent to the '''Hold''' Decorate state. New to Heretic.
 
*'''attackstate2''', '''flashstate2''', '''holdstate2'''
*'''attackstate2''', '''flashstate2''', '''holdstate2'''
:Default = S_NULL
:Default = S_NULL
: The equivalent of '''attackstate''', '''flashstate''', and '''holdstate''', but for alternate fire.
: The equivalent of '''attackstate''', '''flashstate''', and '''holdstate''', but for alternate fire. Equivalent to '''AltFire''', '''AltFLash''', '''AltHold''' respectively from the Decorate syntax.
*'''fullscreenoffset'''
: Amount to move weapon when going fullscreen, without status bar. Needed by some Heretic weapons.
 
====Selection Order and Weapon Slots====
*'''selectionorder'''
:Default = -1.0
:Sets the priority for selection of the weapon. The lower the number, the higher its priority.
*'''slotnumber'''
:Default = -1
:Sets the weapon slot that the weapon occupies in the global weapon slots structure. For assigning to player class weapon slots, read [[weapon slots]].
*'''slotselectionorder'''
:Default = -1.0
:Sets the in-slot priority for the weapon in the global weapon slots structure. The lower the number, the higher its priority. Read [[weapon slots]] if you wish to understand the specifics of how in-slot priority works interacts with player class weapon slots.
 
====Sister Weapon====
*'''sisterweapon'''
:Default = ""
:Defines a weapon that is also provided when this weapon is picked up. This is can be used either for [[doom_wiki:Tome of Power|Tome of Power]] variants, or for weapons with two different firing modes (used by Strife weapons).
 
====Flags====
*'''flags'''
:Default = ""
:This field controls a number of weapon info properties using bit flags, where each bit in the field stands for some effect, and has the value of being either on or off. See the [[Weapon info flags]] List, for the values which can be used in this field. Remember that if whitespace or disallowed characters are used, this field's value must be enclosed in quotation marks.
*'''addflags'''
:Default = ""
:This field specifies a combined list of flags to be added to the weapon's existing flags values (this works the same as the flags field above). Flags in this list are "turned on" in the weapon. If flags are listed here which are already "on," there is no effect on those flags. This field is most useful within weapondelta sections and in concert with weapon info inheritance.
*'''remflags'''
:Default = ""
:This field specifies a combined list of flags to be subtracted from the weapon's existing flags values (this works the same as the flags field above). Flags in this list are "turned off" in the weapon, as if they had never been listed. If flags are listed here which are not already "on," there is no effect on those flags. This field is most useful within weapondelta sections and in concert with weapon info inheritance. This field will be applied AFTER the addflags field is applied, so it could potentially turn off flags turned on by that field.
 
=====List of flags=====
*'''NOTHRUST''': prevents weapon from thrusting others by damage.
*'''NOHITGHOSTS''': prevents hitscan attacks fired by this weapon from hitting '''GHOST''' targets.
*'''NOTSHAREWARE''': disable this weapon from shareware versions of the game.
*'''DISABLEAPS''': for compatibility uses, this disables the ammo-per-shot field.
*'''SILENCEABLE''': weapon can be silenced by the silencer powerup.
*'''SILENT''': weapon is always silent
*'''NOAUTOFIRE''': prevents refiring if player presses fire before switching to this weapon. The Doom rocket launcher and BFG9000 have this flag.
*'''FLEEMELEE''': weapon causes monsters to flee if enabled to so in settings.
*'''ALWAYSRECOIL''': weapon always causes recoil, even if the setting is disabled.
*'''HAPTICRECOIL''': causes haptic feedback on recoil.
*'''READYSNDHALF''': if it has a ready sound, only play it half the time.
*'''AUTOSWITCHFROM''': change current weapon to something better if ammo is found.
*'''POWEREDUP''': weapon is marked as powered-up by the Tome (as in Heretic).
*'''FORCETOREADY''': force state to ready if weapon is powered/unpowered by Tome.
*'''PHOENIXRESET''': special flag to support Phoenix Rod's peculiar behaviour when switched by Tome.
*'''DEPOWERSWITCH''': causes weapon to visually lower and raise when Tome of Power runs out.
 
====Damage Properties====
*'''mod'''
:Default = UNKNOWN (0)
:Originally standing for "Means of Death", this field allows you to associate a '''[[damagetype]]''' to the weapon info (though this property needs to be applied to projectiles for non-hitscan weapons). Then, you'll be able to make thing types resistant to the given damage type by using the thingtype '''damagefactor''' field. You can give them specific pain or death states as well. This property also have the role in multiplayer to specify what obituaries are shown depending on which weapon the player uses.
:The mnemonics were initially hard-coded, but are now available inside ''base\things.edf'' as '''damagetype''' blocks. Notice that the default damage types (means of death) have been differentiated for each player attack, as well as for the various slime types and whatnot, so as to have the obituaries differentiated.
 
====Recoil & Haptics Properties====
*'''recoil'''
:Default = 0.0
:This field designates the backwards thrust provided to the player when they fire the weapon (in 32nds of map-units). By default users have to opt-in to weapons having recoil, but if the flag ALWAYSRECOIL is set on the weapon then it will cause recoil regardless of the player's settings.

Latest revision as of 15:54, 22 July 2020

Weapon info define weapons, simple as. They have unique names, or mnemonics, for easy identification. They're currently referenced solely by weapongivers (see EDF item effects and inventory for more info on those).

If a weapon info's mnemonic is not unique, the latest definition of a weapon info with that mnemonic replaces any earlier ones. Like most other identifiers in EDF (but not lump names or subnames), weapon info mnemonics are completely case-insensitive.

New objects, created via EDF files or wad lumps, can be later tweaked with weapon deltas. New weapon info should not be given a dehackednum property, as this is reserved solely for internal weapons so that mods that modify weapons with DeHackEd (BEX) patches remain compatible with Eternity.

See Weapon info flags
Back to EDF

Eternity Alfheim syntax[edit]

EDF weaponinfo supports pre-Alfheim and Alfehim syntax. Make sure to add:

setdialect("ALFHEIM")

before using this syntax:

weaponinfo <unique name> : <inherited weaponinfo>, <dehackednum>
{
  <other attributes>
}

Header properties[edit]

  • <inherited weaponinfo> must be a value, even if the weaponinfo doesn't inherit from anything else. In that case, it must be Weapon, which is a placeholder value belonging to no real weaponinfo.
  • <dehackednum> -1 if not used. If -1, it can be omitted, leaving just this:
weaponinfo <unique name> : <inherited weaponinfo> {<attributes>}
  • If header properties are used, the pre-Alfheim syntax inherits and dehackednum attributes are not used.

Syntax[edit]

weaponinfo <unique name> [: <parent type> [, <dehackednum>]]
{
  dehackednum            <unique number>
  inherits               <weaponinfo>
  
  ammotype               <artifact mnemonic>
  ammotype2              <artifact mnemonic>
  
  upstate                <frame>
  downstate              <frame>
  readystate             <frame>
  attackstate            <frame>
  flashstate             <frame>
  holdstate              <frame>
  attackstate2           <frame>
  flashstate2            <frame>
  holdstate2             <frame>

  fullscreenoffset       <number>
  
  ammouse                <number>
  ammouse2               <number>
  
  selectionorder         <floating-point number>
  slotnumber             <number>
  slotselectionorder     <floating-point number>
  
  sisterweapon           <weapon info mnemonic>
  
  flags                  <flag list>
  addflags               <flag list>
  remflags               <flag list>
  
  mod                    <MOD name OR number>
  
  recoil                 <floating-point number>
  hapticrecoil           <number>
  haptictime             <number>
  
  upsound                <sound>
  readysound             <sound>
  
  firstdecoratestate     <frame>
  states                 <DECORATE state syntax heredoc>
}

Explanation of fields[edit]

ID / Type Info[edit]

  • dehackednum
Default = -1
Fake array index number, for Dehacked patch (BEX or DEH file) compatibility. It has to be an unique number if not -1. Safe numbers are from 10000 up.
  • inherits
Default = (nothing)
Sets the weapon info from which this will copy properties. All of the properties except dehackednum will be copied from the base actor type.

Ammunition[edit]

  • ammotype
The artifact of the inventory type to consume when firing. Omit this if weapon consumes no ammo.
  • ammouse
Default: 0
Sets the number of ammo items to consume per shot. If not set, it will not consume ammo.
  • ammotype2
The ammo type for the optional alternative fire.
  • ammouse2
Default: 0
Sets the number of optional alternative ammo items to consume per shot. If not set, it will not consume ammo.

States[edit]

  • firstdecoratestate
Sets the first frame in a sequential list of dummy frames that use the internal Decorate-style defined states of this actor for framedelta compatibility. It's not required unless the intention is to make the Decorate states of this weapon accessible from other weapon info. Default games' (Doom, Heretic) weapon info use externalized frames for all weapon info, for compatibility.
  • states
See DECORATE state syntax
Default = nothing
Defines frames using DECORATE-style state definitions. This means it won't be necessary to define separate frame blocks for each individual frame. See the DECORATE reference at the ZDoom wiki for documentation on its syntax. Using the states field instead of any of the ones below results in more concise text, but also the newly created frames won't be accessible from outside (other weaponinfo, Dehacked patches or delta structures), unless you use the firstdecoratestate field as well. Like normally, codepointers may or may not be preceded by A_. The DECORATE code has to be implemented via a heredoc: a text string that spans on multiple lines. Unlike a regular string which uses quotation marks, the heredoc is marked by @" and "@ respectively. Example on an shotgun-like weapon (the '=' sign is optional):
states =
  @"
  Ready:
     SHTG A 1 A_WeaponReady
     loop
  Deselect:
     SHTG A 1 A_Lower
     loop
  Select:
     SHTG A 1 A_Raise
     loop
  Fire:
     SHTG A 3
     SHTG A 7 A_FireShotgun
     SHTG BC 5
     SHTG D 4
     SHTG CB 5
     SHTG A 3
     SHTG A 7 A_ReFire
     goto Ready
  Flash:
     SHTF A 4 Bright A_Light1
     SHTF B 3 Bright A_Light2
     goto LightDone
 "@
  • upstate
Default = S_NULL
Sets the frame which a weapon starts in when it is raised. If the object is supposed to have any dynamic purpose or be visible, do not leave the upstate at S_NULL. Equivalent to the Select Decorate state.
  • downstate
Default = S_NULL
Sets the frame which a weapon starts in when it is being lowered. If the object is supposed to have any dynamic purpose or be visible, do not leave the downstate at S_NULL. Equivalent to the Deselect Decorate state.
  • readystate
Default = S_NULL
Sets the frame which a weapon starts in when it is ready to be fired. If the object is supposed to have any dynamic purpose or be visible, do not leave the readystate at S_NULL. Equivalent to the Ready Decorate state.
  • attackstate
Default = S_NULL
Sets the frame which a weapon goes to if the user tries to perform a primary attack. Though not necessary, it is suggested for weapons to have an attackstate for primary firing purposes. Equivalent to the Fire Decorate state.
  • flashstate
Default = S_NULL
Sets the frame which a weapon jumps to if a codepointer causes a weapon to flash. Equivalent to the Flash Decorate state.
  • holdstate
Default = S_NULL
Sets the frame jumped to by A_ReFire if the player is still holding the primary attack button. Equivalent to the Hold Decorate state. New to Heretic.
  • attackstate2, flashstate2, holdstate2
Default = S_NULL
The equivalent of attackstate, flashstate, and holdstate, but for alternate fire. Equivalent to AltFire, AltFLash, AltHold respectively from the Decorate syntax.
  • fullscreenoffset
Amount to move weapon when going fullscreen, without status bar. Needed by some Heretic weapons.

Selection Order and Weapon Slots[edit]

  • selectionorder
Default = -1.0
Sets the priority for selection of the weapon. The lower the number, the higher its priority.
  • slotnumber
Default = -1
Sets the weapon slot that the weapon occupies in the global weapon slots structure. For assigning to player class weapon slots, read weapon slots.
  • slotselectionorder
Default = -1.0
Sets the in-slot priority for the weapon in the global weapon slots structure. The lower the number, the higher its priority. Read weapon slots if you wish to understand the specifics of how in-slot priority works interacts with player class weapon slots.

Sister Weapon[edit]

  • sisterweapon
Default = ""
Defines a weapon that is also provided when this weapon is picked up. This is can be used either for Tome of Power variants, or for weapons with two different firing modes (used by Strife weapons).

Flags[edit]

  • flags
Default = ""
This field controls a number of weapon info properties using bit flags, where each bit in the field stands for some effect, and has the value of being either on or off. See the Weapon info flags List, for the values which can be used in this field. Remember that if whitespace or disallowed characters are used, this field's value must be enclosed in quotation marks.
  • addflags
Default = ""
This field specifies a combined list of flags to be added to the weapon's existing flags values (this works the same as the flags field above). Flags in this list are "turned on" in the weapon. If flags are listed here which are already "on," there is no effect on those flags. This field is most useful within weapondelta sections and in concert with weapon info inheritance.
  • remflags
Default = ""
This field specifies a combined list of flags to be subtracted from the weapon's existing flags values (this works the same as the flags field above). Flags in this list are "turned off" in the weapon, as if they had never been listed. If flags are listed here which are not already "on," there is no effect on those flags. This field is most useful within weapondelta sections and in concert with weapon info inheritance. This field will be applied AFTER the addflags field is applied, so it could potentially turn off flags turned on by that field.
List of flags[edit]
  • NOTHRUST: prevents weapon from thrusting others by damage.
  • NOHITGHOSTS: prevents hitscan attacks fired by this weapon from hitting GHOST targets.
  • NOTSHAREWARE: disable this weapon from shareware versions of the game.
  • DISABLEAPS: for compatibility uses, this disables the ammo-per-shot field.
  • SILENCEABLE: weapon can be silenced by the silencer powerup.
  • SILENT: weapon is always silent
  • NOAUTOFIRE: prevents refiring if player presses fire before switching to this weapon. The Doom rocket launcher and BFG9000 have this flag.
  • FLEEMELEE: weapon causes monsters to flee if enabled to so in settings.
  • ALWAYSRECOIL: weapon always causes recoil, even if the setting is disabled.
  • HAPTICRECOIL: causes haptic feedback on recoil.
  • READYSNDHALF: if it has a ready sound, only play it half the time.
  • AUTOSWITCHFROM: change current weapon to something better if ammo is found.
  • POWEREDUP: weapon is marked as powered-up by the Tome (as in Heretic).
  • FORCETOREADY: force state to ready if weapon is powered/unpowered by Tome.
  • PHOENIXRESET: special flag to support Phoenix Rod's peculiar behaviour when switched by Tome.
  • DEPOWERSWITCH: causes weapon to visually lower and raise when Tome of Power runs out.

Damage Properties[edit]

  • mod
Default = UNKNOWN (0)
Originally standing for "Means of Death", this field allows you to associate a damagetype to the weapon info (though this property needs to be applied to projectiles for non-hitscan weapons). Then, you'll be able to make thing types resistant to the given damage type by using the thingtype damagefactor field. You can give them specific pain or death states as well. This property also have the role in multiplayer to specify what obituaries are shown depending on which weapon the player uses.
The mnemonics were initially hard-coded, but are now available inside base\things.edf as damagetype blocks. Notice that the default damage types (means of death) have been differentiated for each player attack, as well as for the various slime types and whatnot, so as to have the obituaries differentiated.

Recoil & Haptics Properties[edit]

  • recoil
Default = 0.0
This field designates the backwards thrust provided to the player when they fire the weapon (in 32nds of map-units). By default users have to opt-in to weapons having recoil, but if the flag ALWAYSRECOIL is set on the weapon then it will cause recoil regardless of the player's settings.