item_inventory

Modified

12-Jul-2023

Highly customizable item that can be stored in player inventory based on visual interface, and applies bunch of optional effects on players. Item_inventory contains a lot of trigger conditions. It's possible to make other entities require specific item, abort to have an item, force to drop item e.t.c. You can also make this item usable at player's will from inventory menu (self-activation). This is how you can implement gas masks, invincibility, speed boots, healing potions, keys to locked doors, remote controllers, capture the flag, air tanks and many more! Those entities are fully integrated with item_inventory, each including inventory related keyvalues:

  1. func_button
  2. func_door
  3. func_door_rotating
  4. func_rot_button
  5. func_tankcontrols
  6. func_traincontrols
  7. momentary_door
  8. trigger_changelevel
  9. trigger_hurt
  10. trigger_multiple
  11. trigger_once
  12. trigger_teleport
  13. func_water

Keyvalues


OnDestroy Function ondestroyfn : Name of the function to use from already parsed .as script files when entity is destroyed (killed) in any way. If the function belongs to namespace, you must use prefix with the namespace name (e.g. mynamespace::MyFunction) for the keyvalue.

Name targetname : Set name of item_inventory so other entities can trigger it. Only 'On' and 'Toggle' trigger use-types are accepted which makes item be picked up by player '!activator'. Kill-targeting this entity will remove item_inventory and stop it from respawning, also removing from inventory.

Pitch Yaw Roll (X Y Z) angles : Where Z means Y and Y means Z, that is, when you're thinking Hammer-grid. (Hammer uses Z for height and Y for depth, while every other sane 3D-application does this the other way round; nonetheless this keyvalue description has the letters in the conventional order) This, technically, is a 3D-vector containing Euler-angles to describe either the entity's rotation or direction of effect. E.g. a func_door_rotating will use this as its initial rotation, while a trigger_push will keep its original alignment and use this for the direction of its push-effect instead. Euler-angles are a hierarchical system to determine an object's orientation in 3D-space. A yaw-value of 0 would mean the entity would face east. (right in top-down view) 90 would mean it would face north. (up in top-down-view) After yaw, pitch is applied. Think aiming up/down with your character in first person. At last, the roll-value is applied. Think your character falling over sideways in first person. Some entities, mostly point entities, do not use the angles keyvalue for any purpose.

Render FX renderfx : Set custom render FX effect. Only works when "Render Mode" is set to different than 'Normal'

  • 0 : Normal : Default rendering.
  • 1 : Slow Pulse : Transparency slow fading in and out in a loop.
  • 2 : Fast Pulse : Transparency fast fading in and out in a loop.
  • 3 : Slow Wide Pulse : Transparency slow fading in and out widely in a loop.
  • 4 : Fast Wide Pulse : Transparency fast fading in and out widely in a loop.
  • 9 : Slow Strobe : Regular slow appearing/dissapearing.
  • 10 : Fast Strobe : Regular fast appearing/dissapearing.
  • 11 : Faster Strobe : Regular very fast appearing/dissapearing.
  • 12 : Slow Flicker : Random slow appearing/dissapearing.
  • 13 : Fast Flicker : Random fast appearing/dissapearing.
  • 5 : Slow Fade Away : Not working. Fading out slowly until reaching invisibility. Works once when entity spawns or have changed it's "Render FX" at a runtime (e.g. through env_render). Requires high "FX Amount"
  • 6 : Fast Fade Away : Not working. Fading out quickly until reaching invisibility. Works once when entity spawns or have changed it's "Render FX" at a runtime (e.g. through env_render). Requires high "FX Amount"
  • 7 : Slow Become Solid : Not working. Fading in slowly from invisible to fully visible. Works once when entity spawns or have changed it's "Render FX" at a runtime (e.g. through env_render). Requires low or zero "FX Amount"
  • 8 : Fast Become Solid : Not working. Fading in quickly from invisible to fully visible. Works once when entity spawns or have changed it's "Render FX" at a runtime (e.g. through env_render). Requires low or zero "FX Amount"
  • 14 : Constant Glow : Sprites with 'Glow' render mode only. Disables sprite resizing.
  • 15 : Distort : Random distortion, looped.
  • 16 : Hologram (Distort + fade) : 'Random distortion' + 'Pulse' applied, looped.
  • 19 : Glow Shell : Applies nice animated glowing shell on model. Color can be applied. "FX Amount" manipulates glow shell size.

Render Mode rendermode : Render mode determines how this entity is rendered.

  • 0 : Normal : Normal rendering. Entity will receive light, except if it is a sprite. "FX Amount" is obsolete when this is used.
  • 1 : Color : Brush entities only: Instead of rendering the texture, the whole entity will appear in one color, set by "FX Color". "FX Amount" sets the transparency. 0 means invisible. 255 means fully opaque.
  • 2 : Texture : Texture-only rendering. Entity will not receive light. Instead, only the texture will be rendered as is. "FX Amount" sets the transparency. 0 means invisible. 255 means fully opaque. This is used for transparent things such as windows. Tip: If you have a window separating a dark and a bright room using only one entity, you can apply a brighter glass texture to the side of the window seen from within the dark room than to the side seen from the bright room. That way, the window's brightness will look realistic from both sides, instead of from just one. Generally, darker rooms require the render amount to be lower, making the glass more transparent, or it would look illogically bright.
  • 3 : Glow : Sprites only. The sprite will appear in the same size regardless of your distance to it. In addition to that, the further away you are from it, the less visible it will be. (It's only barely visible at about 500 units far away) Good for light coronas. This renders the sprite in additive mode.
  • 4 : Solid : Brush entities only. All textures of the brush entity starting with '{' will have the last color of their palette (usually blue, black or purple) be rendered fully transparent. This is used for textures with see-through parts, such as grates and railings. Requires "FX Amount" to be set to a value greater than 0, commonly 255.
  • 5 : Additive : Works just as the "Render Mode" 'Texture', except that the entity's appearance will be added to the background instead of forming a mean. This means, black pixels of textures will be fully transparent, while full-bright pixels are added with a factor of "FX Amount" divided by 255. This is often used for sprites indicating a glowing light, as well as for overlay func_illusionaries to give a computer texture the appearance of having many small, glowing lights, screens and whatever other elements. Render-amount of 255 makes it bright. 0 makes it invisible.

FX Amount (1 - 255) renderamt : Render amount to use when other than "Render Mode" 'Normal' is used.

FX Color (R G B) rendercolor : Used with "Render Mode" 'Color' and 'Glow' to set color. Also sets color of 'Glow Shell' "Render Mode".

Gravity Setting movetype : Determines how items behave after spawn.

  • -1 : Unmoveable : Make item completely unmovable by any external influence, unless changed at runtime by e.g. trigger_changevalue.
  • 0 : Fall to the ground (default) : Entity fall to first brush beneath it. Note that not all entities with collision may block items to fall through them.
  • 5 : Hover in the air : Items won't fall from it's starting position.
  • 8 : Hover in the air, ignore brush collision : Items won't fall from it's starting position and won't be affected by brush collision.

Solid Setting solid : Determines item solidity.

  • -1 : Hollow : Disables solidity completely.
  • 0 : Touch on edge, non-blocking (default) : Default setting that makes item behave as trigger.
  • 2 : Touch on edge, blocking (requires hull sizes!) : Makes item solid, it enables collision but requires hull sizes to be specified.

Custom Model model : You need to specify model of item_inventory.

Skin skin : Model skin to use, if model have multiple skins.

Body body : Model body to use, if model have multiple bodies.

Sequence Name sequencename : Default model sequence name to set.

Sequence Number (overrides name) sequence : Change model sequence by specifying it's number.

Scale Model scale : Model size scale, higher values for bigger model. Hull is resized as well.

Custom Min Hull Size (X Y Z) minhullsize : If set, this will overwrite the monster's default minimum hullsize. Minimum and maximum hullsize form a solid cuboid which define the monster's collision hull. Think of them as two span-vectors originating from the monster's origin.

Custom Max Hull Size (X Y Z) maxhullsize : If set, this will overwrite the monster's default maximum hullsize. Minimum and maximum hullsize form a solid cuboid which define the monster's collision hull. Think of them as two span-vectors originating from the monster's origin.

Sound Replacement File soundlist : Set the path to a sound replacement file for the item. The path begins in 'svencoop/sound/mapname', whereas 'mapname' would be your map's name. You can go to the parent directory using '../'. A valid sound replacement file contains one or more lines with two sound-paths, which are seperated by a space and wrapped into quotes. The first sound is the sound to be replaced. The second sound is the new sound. Sound-paths start in the sound directory. You cannot go to the parent directory using '../' in that case. These sounds do not need to be precached using a custom_precache point entity.

Target target : Entity to trigger when item is picked up. Trigger use-type is 'Toggle'.

Delay Before Trigger delay : Delay before trigger entity specified in "Target".

Kill Target killtarget : Same as target, except that this supposedly causes the specified entity/entities to be removed from the game. Not all entities which have a target to trigger will also handle killtarget. You may want to use a trigger_relay to make sure it is working.

Item name item_name : Name of the item to refer to. This is not a "targetname". You can trigger this item by a "targetname" and you can refer to this item by it's "Item name".

Item group name item_group : You can assign this item to group. You can refer to item group from other item-related keyvalues as well.

Display name (HUD) display_name : It's a display name of item that show up at the inventory menu window.

Description (HUD) description : It's a description of the item player can read at the the inventory menu window.

Item icon (HUD) item_icon : Name of the sprite file to use as item hud icon. Provide the full file name and path relative to the 'sprites' directory.

Self-activation limit (0 = infinite) activate_limit : If "Holder:Allowed to self-activate" is set to 'Yes', this is a number of times player can activate this item.

Collection limit (0 = infinite) collect_limit : How many item duplicates player can hold in his inventory. '0' for no limit.

Item weight (0-100) weight : Item weight. The limit for all items in inventory is '100', Over that value player cannot pick up more items.

Collect: Entity target names filter_targetnames : Only enitites with given name(s) can pick up this item.

Collect: Entity class names filter_classnames : Optional filter. Only entities with given class(es) can pick up this item.

Collect: Teams filter_teams : Optional filter. Only players that are part of given team(s) name can pick up this item.

Collect: NPC classifications filter_npc_classifications : Optional filter. Only Monsters with given class(es) are able to pick up this item.

  • 0 : No filter : Keep default.
  • -1 : None
  • 1 : Machine
  • 2 : Player
  • 3 : Human Passive
  • 4 : Human Military
  • 5 : Alien Military
  • 6 : Alien Passive
  • 7 : Alien Monster
  • 8 : Alien Prey
  • 9 : Alien Predator
  • 10 : Insect
  • 11 : Player Ally
  • 12 : Player Hornet/Snark
  • 13 : Alien Hornet/Snark
  • 14 : X-Race
  • 15 : X-Race: Shocktrooper/Voltigore
  • 16 : Team 1 : Use it to classify to custom team.
  • 17 : Team 2 : Use it to classify to custom team.
  • 18 : Team 3 : Use it to classify to custom team.
  • 19 : Team 4 : Use it to classify to custom team.

Collect: Need item(s) item_name_required : Name of required item(s) (held in inventory) to pick up this item.

Collect: Need item(s) from group(s) item_group_required : Name of group(s) (in which item(s) from player inventory belongs) required to pick up this item.

Collect: Item count in group need have (0 = all) item_group_required_num : Total number of items that are part of specified group(s) required to pick up this item. Specify a group names in keyvalue above.

Collect: Item(s) moved item_name_moved : Allow to pick up this item only when specified item_inventory wasn't relocated yet (and is not in someone's inventory).

Collect: CAN'T have item item_name_canthave : Name of item(s) in player inventory that prevents from picking up this item off the ground.

Collect: CAN'T have item from group item_group_canthave : Name of group(s) (in which item(s) from player inventory belongs) that prevents from picking up this item off the ground.

Collect: Item count in group CAN'T have (0 = all) item_group_canthave_num : Total number of items that are part of specified group(s) that prevents from picking up this item from a ground. Specify a group names in keyvalue above.

Collect: Item(s) NOT moved item_name_not_moved : Allow to pick up this item only when specified entities (of item_inventory class) has been moved from it's starting position.

Carried: Hide item (3rd person) carried_hidden : Hide item from 3rd person view. When 'No' is selected, the item model is floating above player head when equipped.

  • 0 : No
  • 1 : Yes

Carried: Skin carried_skin : Change models' skin of carried item (only when it's not hidden).

Carried: Body carried_body : Change models' body of carried item (only when it's not hidden).

Carried: Sequence Name carried_sequencename : Change models' sequence of carried item (only when it's not hidden).

Carried: Sequence Number (overrides name) carried_sequence : Change models' sequence by specifying it's number.

Return: Wait (-1 = never) return_timelimit : After this amount of time the item returns to it's starting position (when dropped somewhere else).

Return: Delay respawn (materialisation) return_delay_respawn : Allows to specify if item_inventory will wait for respawn after returning to it's default position.

  • 0 : No
  • 1 : Yes

Holder: Hold time limit (0 = never) holder_timelimit : Maximum time the item can be held on for, then it's returning if possible.

Holder: Delay between self-activations (0 = none) holder_time_activate_wait : If 'Holder:Allowed to self-activate' is set to 'Yes', this is a delay between which player can activate this item.

Holder: Wearing out trigger time (0 = none) holder_time_wearout : Time before "Holder: Hold time limit" reach it's limit to trigger target specified in "Target: On wearing out" keyvalue. If you set it to e.g. 4, it will trigger a target 4 seconds before this item's "Holder: Hold time limit" ends. It's useful if you want to trigger a sound or a game_text informing player that item will be worn out soon. Example: player picked up power-up which have "Holder: Hold time limit" set to 10, and "Holder: Wearing out trigger time" to 3, so 3 seconds before item is removed from player (in other words, before "Holder: Hold time limit" ends) game_text specified in "Target: On wearing out" is triggered with message "Warning! 3 seconds for buff to end!".

Holder: Allowed to self-activate holder_can_activate : Set it to 'Yes' allows players to activate this item by themselves from inventory menu.

  • 0 : No
  • 1 : Yes

Holder: Hold time limit doesn't start until item activated holder_timelimit_wait_until_activated : If set to 'Yes', hold time limit doesn't start until item is activated by player through inventory menu.

  • 0 : No
  • 1 : Yes

Holder: Allowed to drop holder_can_drop : Determines whenever item can be dropped manually by player from within inventory menu.

  • 0 : No
  • 1 : Yes

Holder: Keep item on death holder_keep_on_death : Self-explanatory. Note that player will lost this item after respawn if keyvalue below isn't set to 'Yes'.

  • 0 : No
  • 1 : Yes

Holder: Keep item on respawn holder_keep_on_respawn : Self-explanatory. Remember that player can also lose his item on death, if "Keep item on death" is set to 'No', the player won't keep this item.

  • 0 : No
  • 1 : Yes

Target: On collect (self) target_on_collect : Trigger specified target(s) when item is successfully collected (uses 'Toggle' trigger state). Player who collected it is passed as the '!activator'.

Target: On collect (team) target_on_collect_team : Same as above, but passes whole team (in which player belongs, including this player) as '!activator'.

Target: On collect (others) target_on_collect_other : Same as above, but passes everyone else but player as '!activator'.

Target: On can't collect (self) target_cant_collect : Trigger specified target(s) when item collecting attempt failed (uses 'Toggle' trigger state). Player who failed to collect item is passed as the '!activator'.

Target: On can't collect (team) target_cant_collect_team : Same as above, but passes whole team (in which player belongs, including this player) as '!activator'.

Target: On can't collect (others) target_cant_collect_other : Same as above, but passes everyone else but player as '!activator'.

Target: On drop (self) target_on_drop : Trigger specified target(s) when item is dropped (uses 'Toggle' trigger state). Player who dropped it is passed as the '!activator'.

Target: On drop (team) target_on_drop_team : Same as above, but passes whole team (in which player belongs, including this player) as '!activator'.

Target: On drop (others) target_on_drop_other : Same as above, but passes everyone else but player as '!activator'.

Target: On can't drop (self) target_cant_drop : Trigger specified target(s) when item is drop failed (uses 'Toggle' trigger state). Player who failed dropping item it is passed as the '!activator'.

Target: On can't drop (team) target_cant_drop_team : Same as above, but passes whole team (in which player belongs, including this player) as '!activator'.

Target: On can't drop (others) target_cant_drop_other : Same as above, but passes everyone else but player as '!activator'.

Target: On self-activate (self) target_on_activate : Trigger specified target(s) when player activate item from inventory menu, only if "Allowed to self-activate" is set to 'Yes' (uses 'Toggle' trigger state). Player who activated it is passed as the '!activator'.

Target: On self-activate (team) target_on_activate_team : Same as above, but passes whole team (in which player belongs, including this player) as '!activator'.

Target: On self-activate (others) target_on_activate_other : Same as above, but passes everyone else but player as '!activator'.

Target: On can't self-activate (self) target_cant_activate : If "Allowed to self-activate" is set to 'Yes' and item activation limit hit 0, this is a target to trigger when player attempts to activate it again (uses 'Toggle' trigger state). Player who failed it is passed as the '!activator'.

Target: On can't self-activate (team) target_cant_activate_team : Same as above, but passes whole team (in which player belongs, including this player) as '!activator'.

Target: On can't self-activate (others) target_cant_activate_other : Same as above, but passes everyone else but player as '!activator'.

Target: On use by trigger (self) target_on_use : Trigger specified target(s) when item is used by trigger (uses 'Toggle' trigger state). Player is passed as the 'activator!'.

Target: On use by trigger (team) target_on_use_team : Same as above, but passes whole team (in which player belongs, including this player) as '!activator'.

Target: On use by trigger (others) target_on_use_other : Same as above, but passes everyone else but player as '!activator'.

Target: On wearing out (self) target_on_wearing_out : Trigger specified target(s) when item's "Wearing out trigger time" ends (which must be greater than 0 but less than "Holder: Hold time limit" value), see "Holder: Wearing out trigger time" above for more info (uses 'Toggle' trigger state). Player who owns this item is passed as the '!activator'.

Target: On wearing out (team) target_on_wearing_out_team : Same as above, but passes whole team (in which player belongs, including this player) as '!activator'.

Target: On wearing out (others) target_on_wearing_out_other : Same as above, but passes everyone else but player as '!activator'.

Target: On return (self) target_on_return : Trigger specified target(s) when item returns to it's starting position (uses 'Toggle' trigger state).

Target: On return (team) target_on_return_team : Same as above, but passes whole team (in which player belongs, including this player) as '!activator'.

Target: On return (other) target_on_return_other : Same as above, but passes everyone else but player as '!activator'.

Target: On materialise after return target_on_materialise : Trigger specified target when item gets materialised after a drop or return (uses 'Toggle' trigger state).

Target: On destroy target_on_destroy : Trigger specified target when item gets destroyed by environment (uses 'Toggle' trigger state).

Effects: Wait until item is self-activated? effects_wait_until_activated : If "Allowed to self-activate" is set to 'Yes', this will determine if effects should be applied only when player activate an item from inventory menu.

  • 0 : No
  • 1 : Yes

Effects: Permanent? (Until respawn) effects_permanent : Specify if effects below effect applied on player are permanent ('Yes') or temporary ('No'). If option 'No' is chosen, the effects ends after "Holder: Hold Time Limit" is hit, and if 'Yes' is selected, effect ends after respawn.

  • 0 : No
  • 1 : Yes

Effects: Glow shell color (R G B) effect_glow : Color of glow shell effect to apply. '0 0 0' for none.

Effects: Block weapons effect_block_weapons : Prevent player from using weapons ('Yes'/'No').

  • 0 : No
  • 1 : Yes

Effects: Invulnerable effect_invulnerable : Makes player invulnerable ('Yes'/'No').

  • 0 : No
  • 1 : Yes

Effects: Invisible effect_invisible : Makes player invisible (for enemies) ('Yes'/'No').

  • 0 : No
  • 1 : Yes

Effects: Non-solid effect_nonsolid : Makes player not-solid for different dynamic objects ('Yes'/'No').

  • 0 : No
  • 1 : Yes

Effects: Time before drown (seconds) effect_respiration : Additional amount of time before drown (can be negative!).

Effects: Friction modifier (%) effect_friction : Percent of friction to change on player.

Effects: Gravity modifier (%) effect_gravity : Percent of gravity to change on player.

Effects: Speed modifier (%) effect_speed : Percent of speed to change on player. Weapon_minigun does not affect this value.

Effects: Damage modifier (%) effect_damage : Player damage modifier in percent.

Flags


  • 128 : TOUCH Only : Pick this item up only by touching it.

  • 256 : USE Only : Pick this item up only by using it ('USE' key).

  • 512 : Can Use w/o LoS : Player can pick up this item even when it's not within his line of sight.

  • 1024 : Disable Respawn : Disables default item respawning.

  • 2048 : Not in Deathmatch : Obsolete in Sven Co-op. Makes the entity don't appear in Multiplayer Games.

Use semicolon ';' to separate multiple item/target/group names in filters and conditions.

If both 'TOUCH only' and 'USE only' flags are selected, the item can only be collected by trigger, but only if player is the !activator.

Item can be collected on trigger, touch and use when none of flags above are selected.

You can specify a group of affected players in all trigger fields making it possible to have different action for different players.