Thread: Game_player_equip tutorial

Results 1 to 25 of 25

Threaded View

  1. #1
    QPU-aligned Silencer's Avatar  
    Contributor
    Join Date
    May 2006
    Posts
    6,078

    Thumbs up Game_player_equip tutorial

    I thought I'd make a thorough tutorial for the game_player_equip entity since many people are unsure how to use it or afraid of messing their map up horribly with it - in fact, that fear is totally justified. However, it is very well possible to use this entity to get some nice things done without messing everything up.

    First of all an explanation of what it even does: The game_player_equip entity, which exists since Half-Life, will, when placed into a map, overwrite the default player equipment loadout settings with its own. In addition, a player who triggers the entity through e.g. a func_button or a trigger_multiple, will gain all the items specified in this entity. If the entity's "Use only" spawnflag (first bit) is checked, the entity will NOT hand out the equipment set on it to (re-)spawning players. Instead, the entity can then only be used by triggering it. It will still cause the default loadout information to be gone.

    About loadouts: In Half-Life's Multiplayer mode, the default load contains a weapon_9mmhandgun, 2 ammo_9mmclip and a weapon_crowbar. In the case of Sven Co-op, it are exactly the same, with the addition of weapon_medkit. There is the exception, that the current map has a mapname.cfg, in which's case the loadout information will be taken from that file. However, the game_player_equip will also overwrite that loadout information, unfortunately including "starthealth" and "startarmor".

    How to set equipment on a game_player_equip entity: After you have given it a name, disable the Smart Edit mode in VHE, and add additional keyvalues. The keyname shall be the name of the entity, the value shall be the amount of the corresponding item. Examples:
    Code:
    Key: weapon_shotgun    Value: 1
    Key: ammo_buckshot     Value: 5
    Key: item_battery      Value: 4
    WARNING: Do not hand out more to a player than he can carry. Otherwise it will lie around in the position the player was when he got the loadout untill someone collects it. If mp_weaponstay is enabled, it will take especially long to get rid of all the too many weapons.

    Going a bit more into detail now. You can have more than just one game_player_equip in your map. Their equipment contents will combine and overwrite the default loadout together. This is where a nice twist comes in: You can enable/disable whether a game_player_equip gives its stuff to a (re-)spawning player at runtime. For that, you will have to use the "master"-keyvalue. In the game_player_equip's properties it might say "Team master". This is bullshit and has been forgotten to edit in the FGD when copying it over from another mod. You can gladly ignore the "Team"-part of the phrase, leaving you with the word "master". In there, specify the name of a multisource entity. By now altering the state of the multisource, you can enable/disable the game_player_equip. (It starts disabled after loading the map) This is best done triggering the multisource through a trigger_relay with a trigger state of Toggle. Input from other entities is possible too, but often confusing. (The Pro Mapper will tell you that a multisource entity acts as an AND-Gate. What a multisource is, however, is a different thing. Look it up elsewhere.) This can be nicely used to have the players unlock certain weapons/ammo/items in a map first to then have them possess those right from respawn onwards instead of making them have to find and collect them over and over again.

    Alternatively, you could trigger the game_player_equip through the special game_playerspawn targetname. DO NOT DO THAT. Doing that is the number one source of problems with the game_player_equip entity, since this part of it acts buggy, even if you trigger it through a trigger_relay. You can stack ammo on the player, eventually overwriting game data memory where unwanted, creating unexpected effects in game and causing random access memory leaks/holes.

    An example map with source has been attached to this post.
    Attached Files Attached Files
    Last edited by Silencer; 25-07-2009 at 01:31 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •