• Check out the results of the Techtree Contest #19!
  • 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Rename Player

Status
Not open for further replies.
Level 4
Joined
Sep 24, 2007
Messages
67
I need help with a something that I haven't been able to figure out by teaching myself or learning from other's maps. Here it is:
How to change your name ingame, for example, Red types "-rename <name>" and it changes his name from Red to <name>. Let's say his starting name is Jack and so ingame he types "-rename Bob" and his name becomes Bob. If anyone could explain a way to do this I would be grateful.
 
Well you get the event to trigger when the player types -rename as a sub string. Then you check if the -rename is in the right location to stop any misfires occuring. Finaly you change the players name to the substring of the entered chat string that contains the desired name but not the activator (-rename is not included in the name).

It is that simple.
 
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Length of (Entered chat string)) Greater than 27
      • Then - Actions
        • Set name = (Substring((Entered chat string), 7, 27))
      • Else - Actions
        • Set name = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
    • Player - Set name of (Triggering player) to name
This is what I have for action. "name" is a string-type variable.
 
  • Actions
    • Player - Set name of (Triggering player) to (Substring((Entered chat string), 7, 27))
Or use this more efficent method since if I am not mistaken WC3 permits substrings of longer than the actual string without altering or repeating the contense.

I should test that out. =0
 
There should be a Condition then a If/Then/Else multi actions before the Player-type action.

Here's the condition for starters:
  • (Substring((Entered chat string), 1, 6)) Equal to -name
Make sure the "-name" has a space after the "e" like this -name .
 
The first condition should be string comparison and for the "If" condition, it should be integer comparison.
 
Status
Not open for further replies.
Back
Top