How to make a melee only room?

Discussion in 'Mapping Questions & Discussion' started by Hudman2002, Dec 1, 2015.

  1. Hudman2002

    Hudman2002 L1: Registered

    Messages:
    7
    Positive Ratings:
    0
    I am currently making a trading server where I want to have a heavy boxing arena where the boxers are physically limited to melee weapons by the map itself. I already have a system set up where you can only be heavy in the arena, but I'm wondering if there's a way to either:

    1. Be limited to melee when inside of an area but be able to use normal weapons when you exit
    2. Be limited to melee once you enter an area

    Thank you in advance for helping me out!
     
  2. worMatty

    aa worMatty Repacking Evangelist

    Messages:
    1,071
    Positive Ratings:
    832
    Greetings.

    When making your melee arena, you probably want to do the following things:
    • Force players to switch to their melee weapon slot.
    • Prevent them from changing to any other weapon slot.
    • Protecting them from damage from any other source. E.G. Other players' projectile weapons, from outside your melee space.
    Create a point_clientcommand point entity and name it something like clientcommand. This entity sends commands to players' clients, so we can use it to tell clients to switch to slot 3, the melee weapon slot.

    Create a filter_tf_damaged_by_weapon_in_slot point entity and name it something like filter_melee. Make sure the Filter mode parameter is set to Allow. Set the Weapon Slot parameter to Melee. We will use this filter entity to ensure that the only type of damage that can hurt players in the arena will be melee damage.

    Create a trigger_add_tf_player_condition brush covering your melee fighting area. Set Condition to TF_COND_CANNOT_SWITCH_FROM_MELEE and Duration to -1. This prevents players from switching away from their melee weapon whilst standing inside the volume.

    Go to the Outputs tab of the trigger_add_tf_player_condition and give it the following outputs:

    [​IMG]

    A player's incoming weapon damage will be tested against our filter entity whilst they stand in this volume, and anything which does not come from a melee weapon will not hurt them. The player's client will also receive a command to switch to weapon slot 3 upon entering the volume, and slot 1 when leaving it. The slot 1 output is just for convenience, so that players are switched to their primary weapon automatically. It also indicates they have left the melee arena.

    Finally, you'll want to prevent pyros from interfering with the melee fighting by airblasting from the side, or scouts stunning players using the Sandman. Build a hollow func_physbox_multiplayer around the volume using the nodraw texture. On its Flags tab, make sure that only Debris - Don't collide with the player or other debris, and Motion Disabled are ticked. This physbox will allow players to walk through it, but projectiles, bullets, flame and energy beams will be stopped.

    There are a couple of downsides to this method. One is that AI bots will not switch weapon when they enter the melee arena, but they won't be able to hurt players with their ordinary weapons, anyway. Another is that the point_clientcommand slot# logic is not watertight: If a player has his own complex weapon switching key bind aliases, or does not use the Fast Weapon Switching mode in TF2's options, they will not immediately switch weapons. In the case of the latter, the weapon selection menu will appear, with slot 3 pre-selected, so that the player only needs to click his mouse button to select his melee weapon.

    There is a work-around to these problems. You could change the Condition of the trigger_add_tf_player_condition to TF_COND_MELEE_ONLY. This forces the player to switch to their melee weapon, but also forces them in to third-person view, gives them a speed boost and shrinks their character model, just like Merasmus' melee-only global spell in Doomsday Event. If you choose to use this condition, you should remove the point_clientcommand logic. You might actually prefer this mode over ordinary melee fighting, as the third-person perspective and increased speed makes it easier to dodge enemies. Plus, it's a lot more interesting.
     
    • Thanks Thanks x 5