|
|
(10 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
− | If it bleeds, it leads. Beings inherit from the [[Modding:Thing|Thing]] base class which handles some basic properties in common with items. In addition the [[Modding:Player|Player]] inherits this class, so anything you can do to creatures can be done to the player as well.
| + | Within the context of modding a 'being' can refer to: |
| | | |
− | == Prototype ==
| + | * The [[Modding:being_blueprint (0.9.9.7)|being blueprint]], a structure used to define beings |
− | | + | * The [[Modding:being_API (0.9.9.7)|being API]], a set of functions which can be used to manipulate beings during gameplay |
− | New beings are created from being prototypes. Think of a being prototype as a recipe for creating new beings. There can be multiple former humans, but they all came from the same prototype. Prototypes are declared by passing a table with the desired properties to the Beings function. [[#Engine Hooks|Engine hooks]] may also be included in the prototype. Mostly, the prototype's properties just describe beings' initial properties (occasionally with different names). Beings' properties can also mostly be changed after they are instantiated. Required fields are underlined. Sometimes required fields can safely be omitted, but this will generate a message in the log file.
| + | * The [[Modding:being_object (0.9.9.7)|being object]], an object that inherits from [[Modding:thing|thing]] which represents creatures in-game as standard, alterable objects |
− | {|style="border: 2px solid darkred; border-spacing: 0; font-size: 90%; margin: 0.25em 0.5em;"
| + | |
− | |colspan=3 style="background: darkred; color: yellow; font-size: 120%; text-align: center"|'''Being Prototype'''
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''string'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|<span style="text-decoration:underline;">name</span>
| + | |
− | |This is the being's name.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''string'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|name_plural
| + | |
− | |This is the being's name_plural. By default, this is the name with an "s" appended.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''string'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|<span style="text-decoration:underline;">ascii</span>
| + | |
− | |This is the being's picture. It should be a single character string.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''string'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|id
| + | |
− | |This is the being's sid. It must be distinct from other string ids. (The numeric id is automatically assigned.) Only the first 20 characters will be used. The default is the first word of the name in all lowercase.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer''' '''list'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|overlay
| + | |
− | |This field is only used in the graphical version. It describes a color transformation to be applied to the being's sprite. This will create overlay_red, overlay_green, overlay_blue, and overlay_alpha fields in the being prototype.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|XP
| + | |
− | |This is the being's expvalue. By default, it is three times the being's danger squared plus twenty.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''boolean''' or [[Modding:Cell|Cell ID]]
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|corpse
| + | |
− | |The determines the corpse left by the being. If the value is true, a new corpse cell will automatically be created. Otherwise this field is interpretted as a cell id. After a being is declared, this field will have been translated to a number. The default is true.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|[[Modding:Item|Item Prototype]]
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|weapon
| + | |
− | |If this field is included, a new item will be declared and automatically equipped for beings generated from this prototype. The item prototype will automatically be a natural ranged weapon, have an id assigned, have zero weight, have no sprite, and have the IF_NODROP and IF_NOAMMO flags.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|<span style="text-decoration:underline;">sprite</span>
| + | |
− | |This is the being's sprite. (Use 0 for no sprite.)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|[[Modding:Constants#Colors|Color]]
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|<span style="text-decoration:underline;">color</span>
| + | |
− | |This is the being's color.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|toDam
| + | |
− | |This is the being's toDam. (This bonus only applies to melee attacks.) The default is 0.
| + | |
− | |-style="background: #333;" | + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|toHit
| + | |
− | |This is the being's toHit. The default is 0.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|speed
| + | |
− | |This is the being's speed. (Remember, the maximum allowed speed is 255.) The default is 100.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|armor
| + | |
− | |This is the being's armor. The default is 0.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|<span style="text-decoration:underline;">danger</span>
| + | |
− | |This is a [[Monster Generation|monster generation]] parameter.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|<span style="text-decoration:underline;">weight</span>
| + | |
− | |This is a [[Monster Generation|monster generation]] parameter.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|<span style="text-decoration:underline;">minLev</span>
| + | |
− | |This is a [[Monster Generation|monster generation]] parameter.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|maxLev
| + | |
− | |This is a [[Monster Generation|monster generation]] parameter. The default is 200.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|HP
| + | |
− | |This is the being's hpmax and starting hp. The default is 10.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|bulk
| + | |
− | |This parameter is unused. The default is 100.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|group
| + | |
− | |Monsters from different groups will fight each other if they use the default AI. Oddly, the default is "weapon-other" which, as a string, translates to 0. The player is in group 1.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|attackchance
| + | |
− | |This is the being's attackchance The default is 75.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|toHitMelee
| + | |
− | |This is the being's toHitMelee. The default is 0.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|[[Modding:Constants#Being Flags|Being Flag]] '''list'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|flags
| + | |
− | |The flags in this list will be included in the being's flag set. Upon instantiation, a flagSet property is added to the prototype will include these flags (and possibly some automatic flags) in set format. The default is an empty list.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''string'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|sound_id
| + | |
− | |If included and the being doesn't have sound bindings configured, then it will look for sound bindings under its sound_id.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|[[Modding:AI|AI ID]]
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|ai_type
| + | |
− | |This determines the being's AI. By default, the old pascal AI is used. (The pascal AI doesn't have an id.)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|vision
| + | |
− | |This is the being's vision. The default is 9. (The player also has vision 9 by default.)
| + | |
− | |-style="background: #333;" | + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|res_bullet
| + | |
− | |This is the being's res_bullet. The default is 0.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|res_melee
| + | |
− | |This is the being's res_melee. The default is 0.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|res_shrapnel
| + | |
− | |This is the being's res_shrapnel. The default is 0.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|res_acid
| + | |
− | |This is the being's res_acid. The default is 0.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|res_fire
| + | |
− | |This is the being's res_fire. The default is 0.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|res_plasma
| + | |
− | |This is the being's res_plasma. The default is 0.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''string'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|<span style="text-decoration:underline;">desc</span>
| + | |
− | |This is the description of the being displayed in the more information view.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''string'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|kill_desc
| + | |
− | |If included, this being will have a special kill description in the mortem.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''string'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|kill_desc_melee
| + | |
− | |As kill_desc, but for melee kills.
| + | |
− | |}
| + | |
− | == Engine Hooks ==
| + | |
− | | + | |
− | Specifying one or more of these hooks in the prototype will allow for greater customization.
| + | |
− | {|style="border: 2px solid darkred; border-spacing: 0; font-size: 90%; margin: 0.25em 0.5em;"
| + | |
− | |colspan=2 style="background: darkred; color: yellow; font-size: 120%; text-align: center"|'''Being Hooks'''
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[#being_OnCreate|OnCreate]]([[Modding:Being|Being]] self)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[#being_OnAction|OnAction]]([[Modding:Being|Being]] self)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[#being_OnDie|OnDie]]([[Modding:Being|Being]] self, '''boolean''' overkill)
| + | |
− | |}
| + | |
− | | + | |
− | {{Anchor|being_OnCreate}}
| + | |
− | ;OnCreate([[Modding:Being|Being]] self)
| + | |
− | :This is called when the being is created.
| + | |
− | ----
| + | |
− | {{Anchor|being_OnAction}}
| + | |
− | ;OnAction([[Modding:Being|Being]] self)
| + | |
− | :This is called at the beginning of each of the being's turns. (Note that turns are only differentiated if time elapses in between.)
| + | |
− | ----
| + | |
− | {{Anchor|being_OnDie}}
| + | |
− | ;OnDie([[Modding:Being|Being]] self, '''boolean''' overkill)
| + | |
− | :This is called when the being dies. ''overkill'' is true if the being was gibbed.
| + | |
− | == Properties ==
| + | |
− | | + | |
− | Beings also have all the [[Modding:Thing|Thing]] properties in addition to those listed below. For beings, the resistance fields are inherent resistances that apply to all attacks.
| + | |
− | {|style="border: 2px solid darkred; border-spacing: 0; font-size: 90%; margin: 0.25em 0.5em;"
| + | |
− | |colspan=3 style="background: darkred; color: yellow; font-size: 120%; text-align: center"|'''Being'''
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Byte'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|attackchance
| + | |
− | |This is how likely (in percent) a monster is to use a ranged attack on its turn. The exact interpretation may depend on the AI. This property is read-only.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Integer'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|hp
| + | |
− | |This is the being's current [[health]].
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Word'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|hpmax
| + | |
− | |This is the being's maximum health.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Byte'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|vision
| + | |
− | |This is the being's vision radius. (It is up to the AI to respect this radius.)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''LongInt'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|scount
| + | |
− | |This is the being's speed count or energy. It counts up by the being's speed every 0.1s, and when it reaches 5000, the being gets to act. For details, see [[Time#Fractional Time|here]].
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''ShortInt'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|tohit
| + | |
− | |This [[accuracy]] modifier is applied to all of the being's attacks.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''ShortInt'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|todam
| + | |
− | |This damage modifier is applied to all the being's melee attacks.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''ShortInt'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|todamall
| + | |
− | |This damage modifier is applied to all the being's attacks.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''ShortInt'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|tohitmelee
| + | |
− | |This accuracy modifier is applied to the being's melee attacks.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Byte'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|speed
| + | |
− | |This is the rate at which the being's scount increases. It affects the speed of all actions.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Byte'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|armor
| + | |
− | |This is the being's natural armor. It appears as [[protection]] against all attacks.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Word'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|expvalue
| + | |
− | |This is the amount of [[experience]] that is awarded to the player when the being dies.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''ShortInt'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|techbonus
| + | |
− | |This usually corresponds to [[Whizkid]] levels; it affects the number of mods that can be applied and the level of assemblies that can be constructed.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''ShortInt'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|pistolbonus
| + | |
− | |This usually corresponds to [[Son of a Gun]] levels; it affects pistol firing time and damage.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''ShortInt'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|rapidbonus
| + | |
− | |This usually corresponds to [[Triggerhappy]] levels; it affects the number of shots fired by rapid-fire weapons.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''ShortInt'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|bodybonus
| + | |
− | |This is the property used to implement [[Badass]]. Each point reduces [[knockback]] by one, and anything above zero stops health decay.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Byte'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|reloadtime
| + | |
− | |This is the percentage of normal reload time that the being takes to reload. (It is used to implement [[Reloader]].)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Byte'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|firetime
| + | |
− | |This is the percentage of normal fire time that the being takes to fire. (It is used to implement [[Finesse]].)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Byte'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|movetime
| + | |
− | |This is the percentage of normal movement time that the being takes to move. For the player, anything less than 100 applies a corresponding dodge bonus. (This is used to implement [[Hellrunner]].)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Word'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|soundact
| + | |
− | |This is the being's .act sound.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Word'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|soundhit
| + | |
− | |This is the being's .hit sound.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Word'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|sounddie
| + | |
− | |This is the being's .die sound.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Word'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|soundattack
| + | |
− | |This is the being's .attack sound.
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Word'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|soundmelee
| + | |
− | |This is the being's .melee sound.
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''Word'''
| + | |
− | |style="vertical-align:top; padding-right: 2ex;"|soundhoof
| + | |
− | |This is the being's .hoof sound.
| + | |
− | |}
| + | |
− | == API ==
| + | |
− | | + | |
− | The [[Modding:Thing#API|Thing API]] can also be used with beings.
| + | |
− | {|style="border: 2px solid darkred; border-spacing: 0; font-size: 90%; margin: 0.25em 0.5em;"
| + | |
− | |colspan=2 style="background: darkred; color: yellow; font-size: 120%; text-align: center"|'''Being Interface'''
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|[[Modding:Being|Being]]
| + | |
− | |being.[[#being_new|new]]([[Modding:Being|Being ID]] id)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_destroy|destroy]]('''boolean''' silent)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_kill|kill]]('''boolean''' overkill)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_ressurect|ressurect]]('''integer''' rrange)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_apply_damage|apply_damage]]('''integer''' damage, [[Modding:Constants#BodyTarget|BodyTarget]] target, [[Modding:Constants#DamageType|DamageType]] damageType)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''string'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_get_name|get_name]]('''boolean''' known, '''boolean''' capitalized)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|[[Modding:Item|Item]]
| + | |
− | |[[Modding:Being|Being]]:[[#being_get_inv_item|get_inv_item]]('''integer''' slot)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_set_inv_item|set_inv_item]]('''integer''' slot, [[Modding:Item|Item]] item)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|[[Modding:Item|Item]]
| + | |
− | |[[Modding:Being|Being]]:[[#being_get_eq_item|get_eq_item]]([[Modding:Constants#Equip Slots|Equip Slot]] slot)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_set_eq_item|set_eq_item]]([[Modding:Constants#Equip Slots|Equip Slot]] slot, [[Modding:Item|Item]] item)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_play_sound|play_sound]]('''Sound ID''' sound)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_get_total_resistance|get_total_resistance]]([[Modding:Constants#Resistance|Resistance]] resistance, [[Modding:Constants#BodyTarget|BodyTarget]] target)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''boolean'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_use|use]]('''integer''' slot)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''boolean'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_wear|wear]]('''integer''' slot)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''boolean'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_pickup|pickup]]([[Modding:Coord|Coord]] pos)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_attack|attack]]([[Modding:Coord|Coord]] or [[Modding:Being|Being]] target)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_fire|fire]]([[Modding:Coord|Coord]] target, [[Modding:Item|Item]] weapon)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''boolean'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_reload|reload]]()
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_direct_seek|direct_seek]]([[Modding:Coord|Coord]] target)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''boolean'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_path_find|path_find]]([[Modding:Coord|Coord]] target, '''integer''' cutoff, '''integer''' maximum)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_path_next|path_next]]()
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|[[Modding:Coord|Coord]]
| + | |
− | |[[Modding:Being|Being]]:[[#being_flock_target|flock_target]]('''integer''' range, '''integer''' mind, '''integer''' maxd)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_msg|msg]]('''string''' msg_player, '''string''' msg_being)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|[[Modding:Item|Item]]
| + | |
− | |[[Modding:Being|Being]]:[[#being_select_slot_by_letter|select_slot_by_letter]]('''string''' letter)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_phase|phase]]([[Modding:Cell|Cell ID]] cell)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_spawn|spawn]]([[Modding:Being|Being ID]] being)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''boolean'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_is_visible|is_visible]]()
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''boolean'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_is_player|is_player]]()
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''integer'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_set_items|set_items]]([[Modding:ItemSet|ItemSet]] set)
| + | |
− | |-style="background: #333;"
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|'''void'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_nuke|nuke]]('''integer''' time)
| + | |
− | |-
| + | |
− | |style="text-align: right; vertical-align:top; padding-right: 2ex;"|[[Modding:Item|Item]], '''boolean'''
| + | |
− | |[[Modding:Being|Being]]:[[#being_pick_mod_item|pick_mod_item]]('''string''' modletter, '''integer''' techbonus)
| + | |
− | |}
| + | |
− | | + | |
− | {{Anchor|being_new}}
| + | |
− | ;being.new([[Modding:Being|Being ID]] id) → [[Modding:Being|Being]]
| + | |
− | :This creates a newly allocated being of the appropriate type. The being won't exist on the map until it is placed by e.g. Level.drop_being.
| + | |
− | ----
| + | |
− | {{Anchor|being_destroy}}
| + | |
− | ;[[Modding:Being|Being]]:destroy('''boolean''' silent)
| + | |
− | :Deallocates the memory associated with the being and removes it from the level (if applicable). The normal results of killing a being (e.g. leaving a corpse) are ignored. The ''silent'' parameter is optional. If true, applicable OnKill and OnKillAll hooks and events will also be ignored.
| + | |
− | ----
| + | |
− | {{Anchor|being_kill}}
| + | |
− | ;[[Modding:Being|Being]]:kill('''boolean''' overkill)
| + | |
− | :Kills the being. If the optional ''overkill'' parameter is true, then the being will be gibbed.
| + | |
− | ----
| + | |
− | {{Anchor|being_ressurect}}
| + | |
− | ;[[Modding:Being|Being]]:ressurect('''integer''' rrange)
| + | |
− | :Resurrects a single corpse that is found within a square of side-length 2 × ''rrange'' + 1, centered around the being. Nearer corpses are preferred. The corpse must not have another being standing on it and must be within sight of the being (as determined by the enemy line-of-sight algorithm). The resurrected being (if any) will have BF_NOEXP set. Messages are included.
| + | |
− | ----
| + | |
− | {{Anchor|being_apply_damage}}
| + | |
− | ;[[Modding:Being|Being]]:apply_damage('''integer''' damage, [[Modding:Constants#BodyTarget|BodyTarget]] target, [[Modding:Constants#DamageType|DamageType]] damageType)
| + | |
− | :Deals damage to the being using the given body target and damage type. (The default damage type is bullet damage.)
| + | |
− | ----
| + | |
− | {{Anchor|being_get_name}}
| + | |
− | ;[[Modding:Being|Being]]:get_name('''boolean''' known, '''boolean''' capitalized) → '''string'''
| + | |
− | :Returns the name of the being. If ''known'' is true, "the" is added, otherwise "a" or "an" is added. If BF_UNIQUENAME is set for the being, then no article is used in either case. If ''capitalized'' is true, then the first letter will be capitalized.
| + | |
− | ----
| + | |
− | {{Anchor|being_get_inv_item}}
| + | |
− | ;[[Modding:Being|Being]]:get_inv_item('''integer''' slot) → [[Modding:Item|Item]]
| + | |
− | ;[[Modding:Being|Being]].inv['''integer''' slot] → [[Modding:Item|Item]]
| + | |
− | :Returns the item in the given slot in the being's inventory. If the slot is empty, nil is returned instead.
| + | |
− | ----
| + | |
− | {{Anchor|being_set_inv_item}}
| + | |
− | ;[[Modding:Being|Being]]:set_inv_item('''integer''' slot, [[Modding:Item|Item]] item)
| + | |
− | ;[[Modding:Being|Being]].inv['''integer''' slot] = [[Modding:Item|Item]] item
| + | |
− | :Sets the given slot in the being's inventory to the given item. If the slot wasn't empty before, the previous constents are lost.
| + | |
− | ----
| + | |
− | {{Anchor|being_get_eq_item}}
| + | |
− | ;[[Modding:Being|Being]]:get_eq_item([[Modding:Constants#Equip Slots|Equip Slot]] slot) → [[Modding:Item|Item]]
| + | |
− | ;[[Modding:Being|Being]].eq[[[Modding:Constants#Equip Slots|Equip Slot]] slot] → [[Modding:Item|Item]]
| + | |
− | :Returns the item in the given equipment slot of the being. If the slot is empty, nil is returned instead. There are additional shorthands for each equipment slot: the ''eq'' table has .weapon, .prepared, .armor, and .boots fields.
| + | |
− | ----
| + | |
− | {{Anchor|being_set_eq_item}}
| + | |
− | ;[[Modding:Being|Being]]:set_eq_item([[Modding:Constants#Equip Slots|Equip Slot]] slot, [[Modding:Item|Item]] item)
| + | |
− | ;[[Modding:Being|Being]].eq[[[Modding:Constants#Equip Slots|Equip Slot]] slot] = [[Modding:Item|Item]] item
| + | |
− | :Sets the being's equipment slot to the given item. Any item that was previously in that slot is lost. There are additional shorthands for each equipment slot: the ''eq'' table has .weapon, .prepared, .armor, and .boots fields.
| + | |
− | ----
| + | |
− | {{Anchor|being_play_sound}}
| + | |
− | ;[[Modding:Being|Being]]:play_sound('''Sound ID''' sound)
| + | |
− | :Plays the given sound as if it came from the being's position.
| + | |
− | ----
| + | |
− | {{Anchor|being_get_total_resistance}}
| + | |
− | ;[[Modding:Being|Being]]:get_total_resistance([[Modding:Constants#Resistance|Resistance]] resistance, [[Modding:Constants#BodyTarget|BodyTarget]] target) → '''integer'''
| + | |
− | :Calculates the being's effective resistance against attacks of the given target (default is body). This accounts for inherent resists as well as equipment bonuses.
| + | |
− | ----
| + | |
− | {{Anchor|being_use}}
| + | |
− | ;[[Modding:Being|Being]]:use('''integer''' slot) → '''boolean'''
| + | |
− | ;[[Modding:Being|Being]]:use([[Modding:Item|Item]] item) → '''boolean'''
| + | |
− | :This makes the being use the given consumable item from its inventory. The function always returns false. (Bug: it is supposed to return true on success.)
| + | |
− | ----
| + | |
− | {{Anchor|being_wear}}
| + | |
− | ;[[Modding:Being|Being]]:wear('''integer''' slot) → '''boolean'''
| + | |
− | ;[[Modding:Being|Being]]:wear([[Modding:Item|Item]] item) → '''boolean'''
| + | |
− | :This makes the being wear the given eqipment from its inventory. Returns true on success and false on failure.
| + | |
− | ----
| + | |
− | {{Anchor|being_pickup}}
| + | |
− | ;[[Modding:Being|Being]]:pickup([[Modding:Coord|Coord]] pos) → '''boolean'''
| + | |
− | :This makes the being pick up the item at the given position. ''pos'' is optional; it defaults to the being's position. Returns true on success and false on failure.
| + | |
− | ----
| + | |
− | {{Anchor|being_attack}}
| + | |
− | ;[[Modding:Being|Being]]:attack([[Modding:Coord|Coord]] or [[Modding:Being|Being]] target)
| + | |
− | :This makes the being do a standard melee attack against the targeted being or coord.
| + | |
− | ----
| + | |
− | {{Anchor|being_fire}}
| + | |
− | ;[[Modding:Being|Being]]:fire([[Modding:Coord|Coord]] target, [[Modding:Item|Item]] weapon)
| + | |
− | :This makes the being fire at ''target'' with ''weapon''.
| + | |
− | ----
| + | |
− | {{Anchor|being_reload}}
| + | |
− | ;[[Modding:Being|Being]]:reload() → '''boolean'''
| + | |
− | :This makes the being reload its currently equipped weapon. The return value is true if there being had at least some of the appropriate ammo to attempt reloading with.
| + | |
− | ----
| + | |
− | {{Anchor|being_direct_seek}}
| + | |
− | ;[[Modding:Being|Being]]:direct_seek([[Modding:Coord|Coord]] target) → '''integer'''
| + | |
− | :This makes the being take a step towards the target. The being will always try to travel in a direct path. The return value is either 0, 1, 2, or 3. 0 indicates success, 1 indicates that a wall blocked the move, 2 indicates that a door blocked the move, and 3 indicates that a being blocked the move.
| + | |
− | ---- | + | |
− | {{Anchor|being_path_find}}
| + | |
− | ;[[Modding:Being|Being]]:path_find([[Modding:Coord|Coord]] target, '''integer''' cutoff, '''integer''' maximum) → '''boolean'''
| + | |
− | :This attempts to calculate a path between the being and ''target''. The ''cutoff'' and ''maximum'' parameters are somewhat technical, but basically they indicate how much time should be spend searching for a path. DoomRL uses 40, 200 for bosses and 10, 40 for normal enemies. The path will be remembered by the being, and can be followed using path_next. Modders should keep in mind that path-finding is a somewhat expensive operation, especially for large ''cutoff'' and ''maximum''. The return value indicates whether a path was found.
| + | |
− | ----
| + | |
− | {{Anchor|being_path_next}}
| + | |
− | ;[[Modding:Being|Being]]:path_next() → '''integer'''
| + | |
− | :This causes the being to take a step along the path last calculated by path_find. The return value follows the pattern of direct_seek.
| + | |
− | ----
| + | |
− | {{Anchor|being_flock_target}}
| + | |
− | ;[[Modding:Being|Being]]:flock_target('''integer''' range, '''integer''' mind, '''integer''' maxd) → [[Modding:Coord|Coord]]
| + | |
− | :This looks for the closest being of the same type to the being (within a square ''range''). If the being is farther than ''maxd'' away, then its position is returned. If it is closer than ''mind'', then a position opposite from the closest with respect to the being is returned. Otherwise (or if there is no nearby being of the same type), a random coord from the scanning area is returned.
| + | |
− | ----
| + | |
− | {{Anchor|being_msg}}
| + | |
− | ;[[Modding:Being|Being]]:msg('''string''' msg_player, '''string''' msg_being)
| + | |
− | :If the being is the player, then ''msg_player'' is displayed. If the being is not the player, but visible to the player, the ''msg_being'' is displayed. If either message is nil it is ignored.
| + | |
− | ----
| + | |
− | {{Anchor|being_select_slot_by_letter}}
| + | |
− | ;[[Modding:Being|Being]]:select_slot_by_letter('''string''' letter) → [[Modding:Item|Item]]
| + | |
− | :Returns the one of the being's equipment where "a" is for armor, "b" is for boots, "w" is for weapon, and "p" is for the prepared slot. If the slot is empty, nil is returned.
| + | |
− | ----
| + | |
− | {{Anchor|being_phase}}
| + | |
− | ;[[Modding:Being|Being]]:phase([[Modding:Cell|Cell ID]] cell)
| + | |
− | :If ''cell'' is omitted, then the being is displaced randomly as if it used a [[phase device]] (without the flashy interface stuff). If the cell is included, the being is displaced to a random cell of the given cell id. If the chosen cell is occupied, a nearby cell is used. If no such cell exists, a random cell is chosen.
| + | |
− | ----
| + | |
− | {{Anchor|being_spawn}}
| + | |
− | ;[[Modding:Being|Being]]:spawn([[Modding:Being|Being ID]] being)
| + | |
− | ;[[Modding:Being|Being]]:spawn([[Modding:Being|Being]] being)
| + | |
− | :Drops a new being of the appropriate type (or the given being) nearby. The dropped being is set with the BF_NOEXP flag.
| + | |
− | ----
| + | |
− | {{Anchor|being_is_visible}}
| + | |
− | ;[[Modding:Being|Being]]:is_visible() → '''boolean'''
| + | |
− | :Determines if the player can see the being.
| + | |
− | ----
| + | |
− | {{Anchor|being_is_player}}
| + | |
− | ;[[Modding:Being|Being]]:is_player() → '''boolean'''
| + | |
− | :Determines if the being is the player.
| + | |
− | ----
| + | |
− | {{Anchor|being_set_items}}
| + | |
− | ;[[Modding:Being|Being]]:set_items([[Modding:ItemSet|ItemSet]] set) → '''integer'''
| + | |
− | :Counts the number of the being's equipped items that belong to the given set.
| + | |
− | ----
| + | |
− | {{Anchor|being_nuke}}
| + | |
− | ;[[Modding:Being|Being]]:nuke('''integer''' time)
| + | |
− | :Sets the nuke timer to ''time'' and changes the cell under the being to the nuke cell. By default, ''time'' is 1. (Setting the nuke time to 0 will disable the countdown.)
| + | |
− | ----
| + | |
− | {{Anchor|being_pick_mod_item}}
| + | |
− | ;[[Modding:Being|Being]]:pick_mod_item('''string''' modletter, '''integer''' techbonus) → [[Modding:Item|Item]], '''boolean'''
| + | |
− | :This only works for the player. This gives the player the item select menu used by mods, and calculates whether the mod is legal (using the given ''techbonus''). This includes assembly checking. The first return value is the item on success. The second return value is true on success and false on failure. (''modletter'' should be the length one string corresponding to the mod type.)
| + | |