• 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.

Need help with some triggers (kinda chat-based)

Status
Not open for further replies.
Level 2
Joined
Apr 4, 2005
Messages
12
Hello! :p I need some help, I'm making a map where you can name your character, so when a player types something, a floating text will be beside a character (hero to be specific,) and I also want to know how to do so the name that the player enters will appear in dialogues.Plz help! :oops:

Oh... :!: :!: :!: I just remembered, I would also like to know how to change a players name (like in DBZ tribute where the player's name changes to Goku, etc.)

Hope this makes sense...

Plz help, and thanks in advanced :D

EDIT: Plz,plz someone help me, I relly need to know ;)
 
Level 6
Joined
Feb 4, 2005
Messages
302
For the latter, you can use the function Player - Set Name.

For the former, I guess, you can create a String variable for each player. When the player types the name, set the String to "Event Response - Entered Chat String". The problem with this method is... let me show you an example.

Player types -name Edric Storm
The hero would be named "-name Edric Storm". >.< I dunno how to remove a certain part of it.

Thus, to solve the method about the hero name, I guess you could put a BIG message on the screen saying "DO NOT TYPE ANYTHING UNTIL YOU WANT TO NAME YOUR HERO"

Just an idea, I'm sure someone can come up with a better one over this.
 
Level 13
Joined
May 5, 2004
Messages
1,330
Telefragged almost said everything. To refer to a part of a typed chat message, use the event "Player - Player 1 (Red) types a chat message containing -name as A Sub String". This way the trigger will fire when Player 1 types, for example, "-name DarkShadow" (yeah, you need a trigger for every player)

The Action is a "Set Variable"-function (so you can refer to the name everytime you need it). Here I use a string-variable called "NamePlayer1":

Set NamePlayer1 = (Substring((Entered chat string), 6, 999))

"Substring" is a function that takes a substring out of any other string, here it's "Event Response - Entered Chat String". The numbers after tell the function from which letter it should start (here the 6th one so we ignore the part containing -name ) and where it should end (I used 999 so the player can type a name of any length)

Know, we create the floating text using:
Floating Text - Create floating text that reads NamePlayer1 [<- the variable] above [the unit] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency

and so we can refer to it (NamePlayer1Float is a FloatingText-Variable):
Set NamePlayer1Float = (Last created floating text)


Ok, I guess you want the text to move with the unit, so you need to create another trigger to move the text:
Events
Time - Every 0.01 seconds of game time
Actions
Floating Text - Change the position of NamePlayer1Float to [the unit] with Z offset0.00
 
Level 2
Joined
Apr 4, 2005
Messages
12
DarkShadow said:
Telefragged almost said everything. To refer to a part of a typed chat message, use the event "Player - Player 1 (Red) types a chat message containing -name as A Sub String". This way the trigger will fire when Player 1 types, for example, "-name DarkShadow" (yeah, you need a trigger for every player)

The Action is a "Set Variable"-function (so you can refer to the name everytime you need it). Here I use a string-variable called "NamePlayer1":

Set NamePlayer1 = (Substring((Entered chat string), 6, 999))

"Substring" is a function that takes a substring out of any other string, here it's "Event Response - Entered Chat String". The numbers after tell the function from which letter it should start (here the 6th one so we ignore the part containing -name ) and where it should end (I used 999 so the player can type a name of any length)

Know, we create the floating text using:
Floating Text - Create floating text that reads NamePlayer1 [<- the variable] above [the unit] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency

and so we can refer to it (NamePlayer1Float is a FloatingText-Variable):
Set NamePlayer1Float = (Last created floating text)


Ok, I guess you want the text to move with the unit, so you need to create another trigger to move the text:
Events
Time - Every 0.01 seconds of game time
Actions
Floating Text - Change the position of NamePlayer1Float to [the unit] with Z offset0.00
Wow you're smart :shock: :shock: anyways.. THNX SOOO MUCH :roll: :D

EDIT: Wow, once again, thnx. You just taught me what variables are...yay and I also made a trigger to change a players in game name.. example: my name would be furnace78 but know since I know about variables,I can change player names with triggers :) thnx :)
 
Status
Not open for further replies.
Top