Improved Unique Player Naming Logic

Improved Unique Player Naming Logic 2021-9-2 v2.1

Yaki

aa
Sep 3, 2018
422
261
Improved Unique Player Naming Logic - Minimal setup time! No lag! Efficient!
Unique player naming is difficult and can be cumbersome to achieve within a map on its own. This prefab will make it easy for you (a map maker, I presume) to do in your map.

This logic improves on an outdated version (found here on TF2Maps).

What this logic improves on from the last version is:
  • All naming logic is condensed to where it only needs to be activated by a single relay. Then boom! It works.
  • No longer needs an supermassive map-wide trigger to use.
  • Works faster and with less stress on the server to operate.
FAQ : How do I set this up?
  1. Place a way to Trigger "relay_name_players". (A trigger_multiple over respawn would do! Can be one big trigger or individual ones)
  2. Place all other logic in the map, typically somewhere that is inaccessible by the player.
    • You can easily place this anywhere by using a func_instance and hooking up this file to it. Look at Idolon's guide on Instances and You for more info.
  3. That's it.
FAQ : What do I need to know as a Map Maker when I use the Improved Unique Player Naming Logic system?
  1. This system only needs one way to boot up, and it can be done at any time and does not need a player (or !activator) to start it. The best way (I imagine) for this to fire up is when a player spawns into the map. In this way, all players will have a unique name.
  2. This uses OnUser4
    • OnUser4 is used to "echo" back to the Naming system to see if the player is still in the server and that the name is or isn't being used. This one is preferably kept clear of use at all times, so the game can write the state of the name back to this system.
  3. If ever you wanted to write attributes to the player or write a unique OnUser to them, put the I/O's in the trigger_multiple named naming_logic that's in this prefab.

FAQ : How does the logic work?

At the beginning of a round, the Improved Unique Player Naming Logic system will activate.

First, it will write to all named players and check to see if any names are taken. If no, continues to #1. If yes, it'll account for any name(s) taken and write again to the player for OnUser4 to tell the Improved Unique Player Naming system that their name is, well, taken! (It sets the logic_branch for that player to False, which means the name is being used)
  1. When the round starts (or a player touches the one trigger_multiple), it will proc the relay_name_players.
  2. From there, it will pick all players and add an addoutput "OnUser4 naming_logic:StartTouch::0:1", then FireUser4. This means all players will touch the naming_logic trigger immediately and anywhere in the map.
  3. The naming_logic trigger filters by unnamed players, and can only deal with one player at a time due to OnStartTouchAll. It then fires DisableAndEndTouch to refresh itself. (using StartTouch will always proc a trigger, even while disabled!)
  4. The queue system is made up of logic_branch entities that assign and decline player names. If a logic_branch is set to True, it will assign the unique name and stop there. If it is False, it will skip itself and move to the next logic_branch and see if that one is True.
  5. If all logic_branches are taken, it will automatically reset all logic_branch entities to True, and force players to send out an "echo" to see if they are still in the server. If a player is there, then their assigned logic_branch is set to False.
  6. The last piece of the puzzle is a way to trigger all of this. It is done by a player respawning into a trigger_multiple that procs the relay "relay_name_players", which does all of this over again!
Please read the article for Egg War in the Special Thanks.

Special Thanks
:
 
Last edited:

Yaki

aa
Sep 3, 2018
422
261
I can't believe this bug has been elusive for more than two years.
  • Fixed bug when the system resets itself. Rewriting to player 12 would actually echo back to branch 13...
For the future, you can use this in an instance by just toggling the second visgroup in the prefab.

Read the rest of this update entry...
 

Yaki

aa
Sep 3, 2018
422
261
  • Removed logic where names were cleared at the beginning the round to reset everything
    • Players are now named named_player_* (instead of player_*) for better sorting/organization
  • Added logic to account for potentially duplicate names, in order to keep names unique per-player.
  • Added additional notes for map makers.

I have been using a bulkier version of this for awhile that I thought was better. The bulkier version was to save the names between rounds using a env_global and logic_auto per-named-player, BUT IT TURNS OUT the game already saves the names between rounds, without me having to create a system to do so!

So to celebrate my findings I'm updating this one. This is the one I'll be using in my maps. Have fun!

Read the rest of this update entry...
 
Last edited: