Classes:Inventory
Note: Wait! Stop! Before you copy this actor's definition into your mod, remember the following things:
|
| Inventory | |||
|---|---|---|---|
| Actor type | Internal | Game | |
| DoomEd Number | None | Class Name | Inventory |
Using in ACS
Actors that inherit from an Inventory class can be used as a parameter for the following functions:
- CheckActorInventory
- CheckInventory
- CheckWeapon
- ClearActorInventory
- ClearInventory
- GiveActorInventory
- GiveInventory
- SetWeapon
- TakeActorInventory
- TakeInventory
Using in DECORATE
Inventory is the base class for all items that can be picked up or placed into the inventory by other means. This class itself has no special functionality and is never used directly. Its only purpose is to be a base class for other items. Any item derived directly from Inventory won't do anything even though it is a fully working inventory item. Such items may be used as counters or status markers.
Inventory items are special actors that can be picked up and/or placed into a player's or monster's inventory.
To define an inventory item you have to inherit from one of the predefined inventory classes:
- Inventory - used for items without special function.
- PowerupGiver - used for items that give a special powerup to the player
- Health - used for items that immediately increase the player's health
- HealthPickup - used for items that are placed in the inventory and give health when being used.
- BasicArmorPickup - used for armor items
- BasicArmorBonus - used for items that increase the amount of armor
- Ammo - used for ammunition items
- Weapon - used for weapons
- Key - used for keys
- PuzzleItem - used for Puzzle items.
- WeaponPiece - used for weapon pieces. These are used to create weapons that have to be put together from more than one item.
- MapRevealer - used to give the player the automap
- Backpack - used to increase the player's ammo carrying capacity.
- CustomInventory - used to define items with simple DECORATE based behavior.
- FakeInventory - used to replicate simple pickups like the ones defined with the old DECORATE definitions.
The Inventory base class defines the following properties which are available to all inventory subclasses:
- Inventory.Amount value
- Sets the amount of inventory items given by this item. Mostly used for item types that give larger quantities.
- Inventory.DefMaxAmount
- Sets the maximum amount the player can carry of this item to the game's default. That is normally 16 for Heretic and 25 for the other games, but can be changed in MAPINFO through the GameInfo section.
- Inventory.MaxAmount value
- Sets the maximum amount the player can carry of this item.
- Inventory.InterHubAmount value
- Sets the maximum amount the player can keep of this item when traveling between hubs or non-hub levels. The default value of one replicates the original behavior of Heretic and Hexen. This property replaces the deprecated INVENTORY.INTERHUBSTRIP.
- Inventory.Icon sprite
- Defines the icon this item used when displayed in the HUD or status bar.
- Inventory.PickupMessage message
- Defines the message that is printed when the player picks up this item. Strings from the LANGUAGE lump can be used by passing the string's identifier prefixed with '$'. For Health items, this can be overriden by the Health.LowMessage property.
- Inventory.PickupSound sound
- Defines the sound that is played when a player picks up this item.
- Inventory.PickupFlash actor
- Defines what actor should appear when the item is picked up; normally this would be used with the PickupFlash actor to make a flash appear as the player picks up the item. If this is not specified there will be no flash when the item is picked up.
- Inventory.UseSound sound
- Defines the sound that is played when a player uses this item.
- Inventory.RespawnTics value
- Defines the time it takes until this item respawns (if respawn is enabled) in 1/35 of a second.
- Inventory.GiveQuest value
- Also give a quest item for controlling Strife's dialogs when picking up this one. value can be in the range of [1..31]
- Inventory.ForbiddenTo classname[, classname2[, classname3[, ...]]] (development version r3296+ only)
- Prevents players using one of the listed classes (use actor names, not Player.DisplayName) from picking up this type of inventory item. Note that unless playing in cooperative mode, a forbidden player will still try to pickup a Weapon or WeaponPiece for ammunition, as in Hexen. Use an empty string (e.g., Inventory.ForbiddenTo "") to clear an inventory item of inherited interdictions.
- Inventory.RestrictedTo classname[, classname2[, classname3[, ...]]] (development version r3296+ only)
- Prevents players not using one of the listed classes (use actor names, not Player.DisplayName) from picking up this type of inventory item. Note that unless playing in cooperative mode, a forbidden player will still try to pickup a Weapon or WeaponPiece for ammunition, as in Hexen. Use an empty string (e.g., Inventory.ForbiddenTo "") to clear an inventory item of inherited restrictions.
(Further, some of the subclasses have their own additional properties.)
The Inventory base class also defines some new flags (note: The INVENTORY. prefix is not necessary. However, to make things easier to read it is recommended to be used):
- INVENTORY.QUIET
- When being picked up this item doesn't make any sound.
- INVENTORY.AUTOACTIVATE
- This item activates automatically when being picked up.
- INVENTORY.UNDROPPABLE
- This item cannot be dropped once it has been picked up. Note that this also prevents the actor from being removed when ClearInventory is called.
- INVENTORY.INVBAR
- This item is placed into the visible inventory when picked up.
- INVENTORY.HUBPOWER
- This item is kept when travelling between levels of the same hub.
- INVENTORY.PERSISTENTPOWER
- This item is kept when travelling between levels, even outside of a hub.
- INVENTORY.INTERHUBSTRIP (deprecated)
- This item is taken away when traveling between hubs or single levels. Replaced by the more flexible Inventory.InterHubAmount property.
- INVENTORY.PICKUPFLASH (deprecated)
- When being picked up a PickupFlash actor is spawned. This is the blue effect you can observe on Heretic and Hexen. This flag has been deprecated and it is recommended that you use the Inventory.PickupFlash property instead.
- INVENTORY.ALWAYSPICKUP
- This item is always picked up no matter whether the player can use it or not. This only applies to items that activate automatically.
- INVENTORY.FANCYPICKUPSOUND
- The pickup sound is played in surround mode.
- INVENTORY.BIGPOWERUP
- Marks this item as a 'powerful' item which is controlled by the 'mega powerups respawn' dmflag option
- INVENTORY.KEEPDEPLETED
- This item will remain in the player's inventory bar even after the last one is used. If the item also has an inventory icon, it will be drawn darkened when the quantity is 0.
- INVENTORY.IGNORESKILL
- Normally, the amount of ammo picked up from an inventory item is doubled on the easiest and hardest skill levels. If this flag is set, the item will ignore the skill setting and only give the specified ammo amount. This flag is typically used on a magazine for reloading weapons so that only one round is inserted into the magazine per round of ammunition depleted from the main ammo pool.
- INVENTORY.ADDITIVETIME
- If set, when a player picks up a second powerup of this type before the first has worn off, the new powerup's duration will be added to the old, rather than overwriting it. For example, if a powerup has a duration of 60 seconds, and a player who currently has the powerup with 21 seconds left picks up a second one, normally the new powerup will override the old and the duration will be reset to 60 seconds. With this flag set, the duration would be extended to 81 seconds instead.
- INVENTORY.UNTOSSABLE (development version r3049+ only)
- If set, the item cannot be tossed with the drop console command.
To create items that automatically activate when being picked up set inventory.maxamount to 0 and add the +INVENTORY.AUTOACTIVATE flag.
DECORATE definition
ACTOR Inventory native
{
Inventory.Amount 1
Inventory.MaxAmount 1
Inventory.InterHubAmount 1
Inventory.UseSound "misc/invuse"
Inventory.PickupSound "misc/i_pkup"
action native A_JumpIfNoAmmo(state label);
action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO,
class<Actor> pufftype = "BulletPuff", float range = 0, float lifesteal = 0);
action native A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet,
class<Actor> pufftype = "BulletPuff", int flags = 1, float range = 0);
action native A_FireCustomMissile(class<Actor> missiletype, float angle = 0, bool useammo = true, int spawnofs_xy = 0,
float spawnheight = 0, bool aimatangle = false);
action native A_RailAttack(int damage, int spawnofs_xy = 0, int useammo = true, color color1 = "", color color2 = "",
bool silent = false, float maxdiff = 0, class<Actor> pufftype = "BulletPuff",
float spread_xy = 0, float spread_z = 0);
action native A_Light(int extralight);
action native A_Light0();
action native A_Light1();
action native A_Light2();
action native A_LightInverse();
action native A_WeaponReady();
action native A_Lower();
action native A_Raise();
action native A_FirePistol();
action native A_FireShotgun();
action native A_FireShotgun2();
action native A_OpenShotgun2();
action native A_LoadShotgun2();
action native A_CloseShotgun2();
action native A_FireCGun();
action native A_FireSTGrenade(class<Actor> grenadetype = "Grenade");
action native A_FireMissile();
action native A_FirePlasma();
action native A_FireRailgun();
action native A_FireRailgunLeft();
action native A_FireRailgunRight();
action native A_RailWait();
action native A_BFGsound();
action native A_FireBFG();
action native A_FireOldBFG();
action native A_ReFire(state hold = "");
action native A_ClearReFire();
action native A_CheckReload();
action native A_GunFlash(state flash = "", int flags = 0);
action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2,
class<Actor> pufftype = "BulletPuff", int flags = 0, float range = 0,
float spread_xy = 2.8125, float spread_z = 0, float lifesteal = 0);
action native A_CheckForReload(int counter, state label, bool dontincrement = false);
action native A_ResetReloadCounter();
action native A_RestoreSpecialPosition();
action native A_RestoreSpecialDoomThing();
action native A_RestoreSpecialThing1();
action native A_RestoreSpecialThing2();
States
{
HideDoomish:
TNT1 A 1050
TNT1 A 0 A_RestoreSpecialPosition
TNT1 A 1 A_RestoreSpecialDoomThing
Stop
HideSpecial:
ACLO E 1400
ACLO A 0 A_RestoreSpecialPosition
ACLO A 4 A_RestoreSpecialThing1
ACLO BABCBCDC 4
ACLO D 4 A_RestoreSpecialThing2
Stop
Held:
TNT1 A -1
Stop
HoldAndDestroy:
TNT1 A 1
Stop
}
}
- Chex Quest actors
- Chex Quest internal actors
- Chex Quest 3 actors
- Chex Quest 3 internal actors
- Doom actors
- Doom internal actors
- Doom II actors
- Doom II internal actors
- Heretic actors
- Heretic internal actors
- Hexen actors
- Hexen internal actors
- Strife actors
- Strife internal actors
- ZDoom actors
- ZDoom internal actors
- Internal
- DECORATE guides