Pick up a weapon (Is it possible?)

Discussion in 'Mapping Questions & Discussion' started by Destskelen, Apr 13, 2019.

  1. Destskelen

    Destskelen L1: Registered

    Positive Ratings:
    Good day, mappers! :cap: Recently, I found an old video where you can pick up weapons on the TF2 server. Is it possible to ban weapons on the map so that later you can pick up a specific gun? I would be happy to have more information, thanks!

    | Just pick up a weapon when the game starts without them
    | Ban certain weapons
    Last edited: Apr 13, 2019
  2. Da Spud Lord

    aa Da Spud Lord Occasionally I make maps

    Positive Ratings:
    It is possible to remove certain weapons from players in your map. Weapons in TF2 are just special types of entities. Like all entities, they can be removed from the game by sending them the "Kill" input through the I/O system. Simply target them based on their classname and send the appropriate inputs whenever a player spawns. Note that some weapons, such as all of the pre-Jungle Inferno flamethrowers, share the same entity class, so you have to either remove all of them or allow all of them. For example, it is not possible to remove the Phlogistinator but allow the stock Flamethrower since they share the same class and thus can't be targeted individually, but it is possible to ban the Dragon's Fury and allow the other flamethrowers since the Dragon's Fury has its own entity class.

    A couple things to note about removing weapons in this way: One, firing the Kill input will only remove weapons that have already been spawned at that moment, but it will not prevent future instances of those weapons from spawning in the future. For example, if a player dies and respawns, they will respawn with all of their weapons. To prevent players from spawning with banned weapons, you'll need to set up some sort of trigger or other player spawning detection system to re-fire the Kill inputs. Second, this method will remove ALL instances of the weapon from the game. It is not possible to target specific players, so any time that these inputs are fired, all players will invariably be affected.

    About players picking up weapons: I'm a bit confused as to what you mean by this. I think the entity that you are looking for is tf_dropped_weapon, which is the entity class for weapons dropped by players as of the Gun Mettle update, but to my knowledge nobody has figured out how to use the entity in a TF2 map. I tried doing a buttload of experimenting with it a while ago, but the best I was capable of doing is assigning it a model, at which point I was capable of flinging it around like a physics prop, but I could not pick it up. Aside from the method noted above, there is no way to force players to use a specific weapon, and there is no way to give players weapons in TF2 either; inventory management entities such as game_player_equip don't work in TF2 to my knowledge. It's worth a shot if you're willing to try, though.
    • Thanks Thanks x 1
  3. ficool2

    ficool2 L4: Comfortable Member

    Positive Ratings:
    game_player_equip does work for only obj_sentrygun, obj_dispenser, obj_teleporter and obj_attachment_sapper (those are counted as special "weapons", although its very glitchy)
    • Thanks Thanks x 1
    • Like Like x 1