Force player to change team

Discussion in 'Mapping Questions & Discussion' started by shewowkees, Jun 7, 2016.

  1. shewowkees

    shewowkees L1: Registered

    Messages:
    9
    Positive Ratings:
    6
    Hello everybody, i'm new here and your site is very well made, i'm glad i found it. :)
    I wanted to know wether or not it was possible to force player to change team at some point during the game?
    I want to do make a map like muselk's medics vs engineers. So far i suceeded at restricting waepons, sentries and classes.
    But i'm struggling with the issue i mentionned earlier. Is it even possible without using server plugins?
    I hope you can help me. :)
     
  2. 【EmNudge】

    【EmNudge】 L4: Comfortable Member

    Messages:
    180
    Positive Ratings:
    37
    it really depends on how you're implementing this.
    Would you be switching everybody to one team? That's not a gamemode, that just placing everybody on one team.
    Are you trying to even out the teams in a very specific manner?

    Ignoring this, I would not recommend rebuilding a sourcemod gamemode in hammer. Medics will be able to pick up ammo and there isn't much of a way to restrict that.
     
  3. shewowkees

    shewowkees L1: Registered

    Messages:
    9
    Positive Ratings:
    6
    Ideally, once an engineer (red) dies he'd join the blu team. So it has to be done player by player.
    It's just that currently there are like five servers running this mode and these are always full. I think i'd be great if there was an alternative to play this gamemode since the mod ran by these servers isn't public yet.
    since medics are melee only, they can't screw things up using ammo .
    What i can do however is that after prep time, i allow red players to spawn only in a trigger hurt with a message saying that they now must join blu if they want to be able to play but that'd be a bit clunky wouldn't it?
    Also, does the game_text display the message for every player on this server? Is there a way to send the message only in a zone or only to specific players?
     
  4. norfolk terrier

    norfolk terrier L3: Member

    Messages:
    135
    Positive Ratings:
    196
    Do you mind linking a prefab of the restricting weapons, classes, and sentries? That is something I have been mildly interested in doing for a while.
     
  5. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    753
    Positive Ratings:
    213
    That's a game mode, not a map. I believe Muselk has said in videos that its a custom plugin built by his friend Tava.

    Is it possible to swap players within a map, but it has limitations.

    You need a point_clientcommand, 2x filter_activator_tfteam (one for red, one for blue), and as many trigger_multiple brushes as you need. In this example I have named my point_clientcommand as "ClientCommand" so I can sent it inputs.

    In short, you create a trigger_multiple brush and give it the following outputs:
    • OnStartTouch > ClientCommand > Command > jointeam blue > 0.00
    • OnStartTouch > ClientCommand > Command > joinclass random > 0.10
    This makes the player execute the join team command, then a moment later pick a random class when they touch the trigger_multiple brush. Naturally replace the 'jointeam blue' with 'jointeam red' if you want them to join the red team instead of blue. You don't have to include the command to specify which class they join and you can replace the 'random' with the name of the class you want to force. If you don't include it, the player is taken to the class selection screen to pick which class they want.

    A precaution you'll want to take is filtering the trigger_multiples to the opposite team it will make the player join. In other words, if the brush will make the player join the red team, filter it for blue team members only. This way if a red player enters the brush, they won't be forced to join red (despite already being on red) and won't have a random class forced on them. And of course as we are using trigger_multiple brushes, you can have them enabled all the time or toggle when they are enabled or disabled via inputs.

    Now about that limitation. This will only work if the server hosting the map has the sv_allow_point_servercommand set to "always", which many servers do not have enabled by default. If they don't have it enabled, this will not work.
     
    • Thanks Thanks x 1
  6. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    753
    Positive Ratings:
    213
    I believe the Ultimate Mapping Resource Pack includes an update to func_nobuild zones that allows you to allow or disallow specific buildings within their volume.
     
  7. Izotope

    aa Izotope Never releases maps

    Messages:
    609
    Positive Ratings:
    571
    This CVar does not apply to the client command entity.
     
  8. shewowkees

    shewowkees L1: Registered

    Messages:
    9
    Positive Ratings:
    6
    Woah thanks dude !
    The restriction is quite annoying but what you told me will just make all of this lots easier. I won't even have to send a message to the players to tell them to change class, all this will be done automatically. I think that using all that, i can make medic vs engi maps that don't even need the host server to run any mods !
    Since the few servers that run this map are full, promoting these vanilla maps will allow a fast widespread of this fun gamemode. I hope it'll all work, thanks a lot ! :)

    Norfolk terrier, i will post two prefabs after that:

    The one that doesn't need server commands:
    It's a trick using the info_player_teamspawn's flags to sent undesired classes to an area that tells them to switch classes as it kills them. Then the only way for them to survive is to pick the appropriate class.

    The weapon restrict method is way more clean, it just kills all the entities corresponding to the undesired waepons.


    The one that uses server commands:
    It will use werewolf's methods to handle all this in a much cleaner way but as he said, it'll need sv_allow_point_servercommand to be set to allways.

    EDIT:
    Izotope, i hadn't seen your answer, can you be more specific? will clientcommands (or whatever is it's name) allways run? if not, what restriction to this are there?
     
  9. Izotope

    aa Izotope Never releases maps

    Messages:
    609
    Positive Ratings:
    571
    point_clientcommand is not restricted by the sv_allow_point_servercommand CVar, meaning the commands you send to this entity won't be blocked.
    Ergo, you don't need to worry about servers without this cvar.
     
    • Useful Useful x 1
  10. shewowkees

    shewowkees L1: Registered

    Messages:
    9
    Positive Ratings:
    6
    Thanks dude, so making map in this gamemode doesn't need a server mod at all :) I'll make an example map thanks everyone anyway ! :D
    PS: Norfolk terrier, i managed to do what i said yesterday however i can't do it anymore, i don't know the reason. Anyway the weapon restriction is easily findable on google and the sentry restriction is done through playing around with func_nobuild :)
     
  11. zahndah

    aa zahndah professional letter

    Messages:
    718
    Positive Ratings:
    627
    Im pretty sure you cant forcejoin players on to 'full' teams, so the server would either need the disable team balance command enabled, or the sv_allow_point_servercommand Cvar enabled and you use a point_servercommand to disable the team balance thing.
     
  12. shewowkees

    shewowkees L1: Registered

    Messages:
    9
    Positive Ratings:
    6
    Yeah but my goal is to make this mode available without using the server mod which is exclusively available on muselk's server (and i think it's a shame).
    So i spend the whole day on this and i suceeded. I had a lot of trouble with the eureka wrench but i found a workaround so right now here's how it works;

    the server needs to have this specific cvars;

    mp_respawnwavetime 0
    mp_teams_unbalance_limit 0
    mp_autoteambalance 0

    The red engies spawn. Three of them go blue. All blue players automatically switch to medic. Non-3rd slot weapons are deleted for medic. No engineer can place sentries. When an engineer dies, he goes to team blue and becomes a medic.

    I implemented that successfully i just need to test it now since i can't really know if it works with only one player. I'll make a tutorial about it right away :)
     
    • Thanks Thanks x 1
Tags: