Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Player - Player 1 (Red) types a chat message containing -setname as A substring
Conditions
Actions
Player - Set name of (Triggering player) to (Substring((Entered chat string), 10, (Length of (Entered chat string))))
And since you said 'teach' not just give, I'll explain some of it.
The Event checks if a player writes -setname anywhere in an Entered Chat String. Then it sets the name of the player to the substring of the Entered Chat String from the 10th letter to the last character. I use the function Length of Entered Chat String to find what out what number is the last letter.
Why do we use a substring starting at the 10th letter? So that we cut out the "-setname" part. If we didn't, a player writing "-setname Shazbot" would have his name changed to "-setname Shazbot" instead of just "Shazbot".
Each letter in a substring has an associated number. Above you can see how Shazbot, the actual name we want starts at the 10th letter. That's why the player name must be set to substring from the 10th letter to the last letter (Length of Enter Chat String). And remember you need to add events for other players besides red if you want them to be able to rename themselves!
edit: Sorry, hammerfist, I didn't look before posting, it took me a while to think of a good enough explanation :/
Remember that Warcraft III has its own maximum string for a player name (15 letters) so in this case it should not be Length of Enter Chat String, it should be 10, 24 since 24th letter is the final maximum string (15th max string for a player's name)
This is how I made it, haven't tested it public yet but think it will work:
Set Name 1
Events
Player - Player 1 (Red) types a chat message containing -name as A substring
Conditions
Actions
Set EnteredString = (Entered chat string)
Player - Set name of Player 1 (Red) to (Substring(EnteredString, 7, 100))
Trigger - Turn off (This trigger)
Good luck man! This is how it works -name Example will trigger the effect and then the entered string between 7 (minus the -name) and 100. (you can have the 100 a bit lower so they can't have a name that has 100 letters xD Sorry for bad english, thats not my primary language.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.