Thread: Game_player_equip tutorial

Results 1 to 25 of 25
  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.

  2. #2
    a person RNG's Avatar  
    Contributor
    Join Date
    Sep 2006
    Posts
    3,842

    Re: Game_player_equip tutorial

    Quote Originally Posted by Silencer View Post
    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.
    lol, do not activate game_player_equip system with plauerspawn isotope, it will eventually reboot and burn microchips overwriting cooling system memory, causing nuklear meltdown and energical black hole destroying half of the world and creating subcontinous leak in space continuum. also malfunctioning the coffee maker

  3. #3
    trigger_delay & func_lazy TrEmPlEr's Avatar  
    Artist
    Join Date
    Jul 2002
    Location
    Valve Hammer Editor 3.5 beta
    Posts
    2,279

    Re: Game_player_equip tutorial

    Good tutorial, RNG Great Spam.

    here
    Modstatus: Unknown

  4. #4
    a person RNG's Avatar  
    Contributor
    Join Date
    Sep 2006
    Posts
    3,842

    Re: Game_player_equip tutorial

    thank you. ywhat, i thought game_plasyer_equip was shit obvious with rule dont spawn 100 buckshots because it spasm everything and kills your speakers. whatever these are needed in 4.0 times coz so many ppl would ASK in the future withotiut. im not dissing, i just need noodles and alcoholaol

  5. #5
    Administrator JPolito's Avatar  
    Manager
    Join Date
    Apr 2004
    Posts
    7,554

    Re: Game_player_equip tutorial

    So when something is given via this entity, players will then start spawning with it?

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

    Re: Game_player_equip tutorial

    Quote Originally Posted by JPolito View Post
    So when something is given via this entity, players will then start spawning with it?
    The sole existence of this entity makes it being used for respawn equipment loadout, no matter whether it has a name or not. The Use only spawnflag disables that behaviour, so you have to trigger it to obtain equipment. You could get the same effect by setting the master to a multisource and then never unlock that multisource. (No matter the master's state, you can still trigger the entity the normal way.)

  7. #7
    Unregistered User Fice's Avatar
    Join Date
    Nov 2005
    Location
    Germany
    Posts
    99

    Re: Game_player_equip tutorial

    Nice tutorial silencer!
    I now realize why it caused so much trouble for me

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

    Re: Game_player_equip tutorial

    Thanks! =) I can see mappers make good use of this.

  9. #9
    Sniper is a spy! cyberdaemon's Avatar
    Join Date
    Feb 2002
    Location
    Estonia
    Posts
    4,408

    Re: Game_player_equip tutorial

    Quote Originally Posted by RNG View Post
    also malfunctioning the coffee maker
    Oh NOOO
    A well regulated Militia, being necessary to the security of a free State,
    the right of the people to keep and bear Arms, shall not be infringed.

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

    Re: Game_player_equip tutorial

    Attached an example map with source file.

  11. #11
    Mapper Nih's Avatar  
    Manager
    Join Date
    Dec 2002
    Location
    Denmark
    Posts
    5,478

    Re: Game_player_equip tutorial

    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.
    Quote Originally Posted by Silencer View Post
    The sole existence of this entity makes it being used for respawn equipment loadout, no matter whether it has a name or not. The Use only spawnflag disables that behaviour, so you have to trigger it to obtain equipment. You could get the same effect by setting the master to a multisource and then never unlock that multisource. (No matter the master's state, you can still trigger the entity the normal way.)
    I'm a bit confused by this. If a player triggers a game_player_equip with a master, the player will receive the loadout specified only once, but players will respawn without weapons? Or what do you mean by "It will still cause the default loadout information to be gone."?

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

    Re: Game_player_equip tutorial

    Default loadout information = the either default load of 9mmhandgun, medkit, crowbar and 2 9mmclips or the map config loadout.

    Also quote from http://dhost.info/entguide/entities/...yer_equip.html : "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." - As I said, this includes the default loadout you'd usually have when your cfg does not specify anything by itself or does not exist.

  13. #13
    Mapper Nih's Avatar  
    Manager
    Join Date
    Dec 2002
    Location
    Denmark
    Posts
    5,478

    Re: Game_player_equip tutorial

    I don't get it. You say the game_player_equip with a locked master will NOT alter what weapons players have when respawning, but the default loadout is removed? What does the default loadout become then?

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

    Re: Game_player_equip tutorial

    Quote Originally Posted by Nih View Post
    What does the default loadout become then?
    Empty-handed victim, Half-Quake-style.

    Though, I think it'll let you have the suit, but that's all.

    I don't think I said it wouldn't alter the loadout, but that it would not add its contents to the loadout.

  15. #15
    Check Model Showcase Thread! Recaldy's Avatar
    Join Date
    Feb 2010
    Location
    "South Texas"
    Posts
    242

    Re: Game_player_equip tutorial

    Saved me a question to ask others. Pretty helpfull, thanks!

  16. #16
    I have no eye deer! TheBard108's Avatar
    Join Date
    Mar 2006
    Location
    Deep underground in Snark Cafes TOP secret reserch labs
    Posts
    641

    Re: Game_player_equip tutorial

    would be nice if there was a flag that let this work on trigger_respawn
    SnarkCafe Admin / mapper
    We're back http://snarkcafe.net/


  17. #17
    Still learning wolf-3d's Avatar  
    Tester
    Join Date
    Jan 2011
    Location
    Somewhere Warm.
    Posts
    1,462

    Re: Game_player_equip tutorial

    Does anyone know the bit value for flag ""Re-equip on use" used in entity: game_player_equip, according to
    http://dhost.info/entguide/entities/...yer_equip.html it should be 4 but that does not work and the FDG hasn't been updated yet. (Flag 4: "Re-equip on use", my mistake).

    1: "Use only" is correct as I can succesfully bitwise that, which switches on/off the default load as expected.
    (Nope: triggering can cause a default load, which mimics removal of spawnflag 1.)

    Also, Quote: "Alternatively, you could trigger the game_player_equip through the special game_playerspawn targetname. DO NOT DO THAT. " If you are refering to targetname as in the Baseclass or keyvalue: targetname attribute: "Name" of entity: Game_player_equip, then I do not understand as this equaltes to target_source or are you refering to a entity:game_playerspawn not listed in the FDG ?
    Last edited by wolf-3d; 14-05-2011 at 10:29 PM.

  18. #18
    Still learning wolf-3d's Avatar  
    Tester
    Join Date
    Jan 2011
    Location
    Somewhere Warm.
    Posts
    1,462

    Re: Game_player_equip tutorial

    Game_player_equip (gpe)
    Correction to Wolf-3d, I have found out the "Re-equip on use" flag is 4
    (I was referencing flags instead of spawnflags and did not realise the default behaviour of gpe on a trigger, mimics the NOR of spawnflag 1. Perhaps the "Entity-specific flags" description should be changed to "Entity-specific spawnflags" so that literal idiots like myself from posting such stupid questions. (Only joking, I realise the whole project is WIP)

    Minor point I have noticed that ammo_9mm & weapon_wrench (http://www.svencoop.com/manual/mapping-config.html) do not work because gpe is looking for class values instead.
    (i.e. You should use: ammo_9mmclip "num_clips" or ammo_9mmbox 1, weapon_pipewrench 1)
    Perhaps someone can add a note that the displayed values are cfg file specific.

    Lastly item_battery works fine, but item_healthkit drops to the floor infront of player and I can't seem to pick it up at the moment. (Will use a work around via default load to achieve what I want but if anyone finds out why or gets it to work would be interested to know about it.)

    Sorry for the initial confusion but this is my first "play around" with gpe, and the lack of console 3 errors plus the mimic response threw me.
    Last edited by wolf-3d; 14-05-2011 at 10:30 PM.

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

    Re: Game_player_equip tutorial

    The spawnflag-values in that guide refer to bit values, yes. The bit with value 4 is the third. (2^2 = 4 (The first bit has index 0 with value 2^0=1)).

    Putting "game_playerspawn" targetname, for whatever reason, rigs the behaviour of the entity to cause unreasonable bugs (specifically giving the player more ammo than he can carry). I can only guess that in the instant of player-spawning, the player is in a specific state in which he is not supposed to pick anything up, and game_player_equip can somehow fudge in between procedures. Simply avoid using "game_playerspawn" in combination with it for now.

    The wrench is called weapon_pipewrench, not weapon_wrench.
    Valid 9mm ammo types are:
    ammo_9mmclip (17 rounds)
    ammo_9mmAR (50 rounds)
    ammo_9mmbox (200 rounds)

    ammo_9mm is no valid entity. The mapping guide you are referencing has wrong entries.

    Item_healthkit only restores health till 100. (Specifically, till what your "starthealth" CFG-entry is set to (but defaults to 100))

    And yes, I need to finish the guide at dhost. I'll start on that once the next major SC release occurs.

  20. #20
    Registered User Larry's Avatar
    Join Date
    Feb 2002
    Location
    Germany
    Posts
    189

    Re: Game_player_equip tutorial

    One question:
    One game_player_equip works fine, but as soon as i insert 2 or 3 which are triggered by a trigger_multiple svencoop wont start.
    I used flag:
    -only use

    and did try with flag:
    -only re-equip
    too.

    Is there a way to include several game_player_equip which are only triggered by the player who walks through a trigger? Would save me some ammo and weapon_entities.

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

    Re: Game_player_equip tutorial

    How does it not start?

  22. #22
    a person RNG's Avatar  
    Contributor
    Join Date
    Sep 2006
    Posts
    3,842

    Re: Game_player_equip tutorial

    lol old thread

    still i recommend a blank game_player_equip, BAM

  23. #23
    Registered User Larry's Avatar
    Join Date
    Feb 2002
    Location
    Germany
    Posts
    189

    Re: Game_player_equip tutorial

    Ok, setup is as following:
    3 trigger_multiples:
    target "equip1" "equip2" and "equip3" each.
    delay before reset is set to 0 each.
    trigger flag is set to "on enter" each.

    3 game_player_equips are named accordingly ("equip1" and so on).
    each one has a different loadout.
    each one has flags set: "use only"

    Game stops at loading screen.
    Using only one equip works, disables the loadout of cfg, you described that already.
    using more than one > game loading status forever.

    EDIT: Seems i have to work with a multisource and (team) master as you described and did in test maps. simple triggering the game player equip works only for one in map.

    EDIT2: Got it to work, but setting the master is essential, without it you get result game not starting really.
    And this entity gets really nasty when you set to much amounts for ammo. So better set one amount lower. Sorry for digging an old threat
    Last edited by Larry; 27-04-2012 at 04:00 PM.

  24. #24
    I have no eye deer! TheBard108's Avatar
    Join Date
    Mar 2006
    Location
    Deep underground in Snark Cafes TOP secret reserch labs
    Posts
    641

    Re: Game_player_equip tutorial

    I'd still like aa flag that let this work on trigger_respawn (hint hint 4.7!)
    SnarkCafe Admin / mapper
    We're back http://snarkcafe.net/


  25. #25
    Registered User
    Join Date
    Oct 2016
    Posts
    107

    Re: Game_player_equip tutorial

    Alright, I have begun climbing that mountain of info that is the SC manual as well as some other sites. But I some times get burned out and lost in the sea of info.

    I got this to work.

    http://www.svencoop.com/manual/mapping-config.html

    But not this.

    http://forums.svencoop.com/showthrea...equip-tutorial

    I am not sure how that actually works and why it can not be as easy as making the info_player_start right click to properties as the monster entity is, where you can simply change it's health and other things from there.

    But that is neither here nor there. What name am I suppose to give the game_player_equip? The mapname or anything like "asdfghjkl" if I should choose? Then how am I suppose to disable the SmartEdit and then add the key values? Then and how am I suppose to use a func_button or trigger_multiple?

    I want this to be instantaneous as if you were born with the weapons in your hands, not have to run around and hit buttons or trigger things unless I am understanding it all wrong.

    However, which process is the least complicated of the two (Not with standing I already got the one to work.) and how do I go about fixing my map to implement it? Thank you.

Posting Permissions

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