game_player_equip

Modified

12-Jul-2023

The game_player_equip entity is a powerful entity for managing player weapons/items/ammo loadout. You can gradually enable more and more game_player_equip entities to increase the players' arsenal as your map progresses, or allow players to trigger it directly. This entity exhibits strange behaviour when used incorrectly, so set it up carefully: Basically, you disable smart edit mode when viewing its properties in Valve Hammer Editor, then add new keyvalues, whereas the key's name be the name of the weapon-/item-/ammo-entity to supply, and value the quantity in which it shall be provided, per player. When providing an uzi, provide either weapon_uzi or weapon_uziakimbo, never both. For weapon quantity, always set 1. Never supply more than the player can pick up/carry. If at least one game_player_equip entity is enabled, the default weapon and ammo loadout from your map's config file will be ignored entirely. So if your map is using game_player_equip entities, you will probably want to have one game_player_equip entity that is always enabled to provide a default loadout. Whether a game_player_equip entity is enabled or not depends on the state of its master. If no master is set, it's always enabled. When the game_player_equip is triggered normally, it will equip the activating player. Be careful with that, as giving a player things he cannot pick up/carry will spawn and lie around till collected, possibly flooding the server.

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 game_player_equip so other entities can trigger it to apply inventory changes. Every trigger use-type works uniformly. Can be kill-targeted.

Target target : Set the targetname of a player to be the only one to ever receive equipment from this game_player_equip, if the 'Filter playername'-flag is set. This can be used for creating maps with roleplaying (when paired with the CVar mp_dropweapons set to '0'), or preventing a player from using the same triggerable game_player_equip entity multiple times per life.

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

Kill Target killtarget : Entity to remove when equipment is applied.

Team Master master : Currently unusable.

Equip mode equipmode : Set equipping mode.

  • 0 : Give items : Provide players with items/weapons/ammo as described above.
  • 1 : Modify inventory : Allows to change .cfg file inventory and enable "Inventory Mode" to be used.

Inventory mode inventorymode : Allows advanced inventory manipulation, changes player's equip on respawn.

  • 0 : Set items : Overrides inventory with given items.
  • 1 : Add items : Adds given items to inventory. If any item already exists, the values are sum together.
  • 2 : Subtract items : Removes given items from inventory. If any item already exists, the values are substracted from them.
  • 3 : Remove items : Removes given items from inventory (if they exists).
  • 4 : Restock items : Set items if given value is greater than current value.
  • 5 : Limit items : Set items if given value is lesser than current value.

Flags


  • 1 : USE Only : If set, the game_player_equip entity will not equip respawning players, but only react to direct triggering, equipping its activator. This makes its master obsolete.

  • 2 : Filter Playername : If selected, this game_player_equip will only equip players with a targetname 'Player targetname' (see below).

  • 4 : Re-Equip on Use : If set, the game_player_equip entity will strip all weapons/ammo from the triggering player and then re-equip him. This is useful for preventing the aforementioned overflow.

  • 8 : Append Map CFG : If selected, also give weapons specified in this map configuration file (mapname.cfg) instead of ignoring it.