• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Would Set Name of unit cause a desync?

Status
Not open for further replies.
Level 3
Joined
Mar 27, 2014
Messages
24
I'm curious. Two players playing same map with different languages of warcraft. Would this function cause a desync?
  • Unit - Set Name of (Triggering unit) to ((Name of (Triggering unit)) + (|nLevel + ((String((Level of (Triggering unit)))) + |r)))
Since it refers to the unit directly, and both player clients would return different value of (Name of (Triggering unit)). Sadly i can't test it myself.
 
Level 3
Joined
Mar 27, 2014
Messages
24
If so, how unit will be named with this function? For example, if i'm gonna rename peon with this. And there will be 2 players, one with eng client, one with russian. Will it be "Peon" or "Раб" in russian? Or will peon have own name for each player?
 
If so, how unit will be named with this function? For example, if i'm gonna rename peon with this. And there will be 2 players, one with eng client, one with russian. Will it be "Peon" or "Раб" in russian? Or will peon have own name for each player?

It won't translate it unless you tell it to. You can get the translated version of a string using the native GetLocalizedString.

For example:
JASS:
call SetUnitName(someUnit, "Peon")

Would rename someUnit's name to "Peon", even on a Russian client. However, this:
JASS:
call SetUnitName(someUnit, GetLocalizedString("Peon"))

Will set it to the localized version of "Peon". So for a Russian client, it would show "Раб". On an English client, it would show "Peon".
 
Level 3
Joined
Mar 27, 2014
Messages
24
It won't translate it unless you tell it to. You can get the translated version of a string using the native GetLocalizedString.

For example:
JASS:
call SetUnitName(someUnit, "Peon")

Would rename someUnit's name to "Peon", even on a Russian client. However, this:
JASS:
call SetUnitName(someUnit, GetLocalizedString("Peon"))

Will set it to the localized version of "Peon". So for a Russian client, it would show "Раб". On an English client, it would show "Peon".
Interesting information, i didn't know that you can use translated/original strings in code. Thanks.
 
oops, I forgot to include a GUI example. Here is what it would look like if you wanted to take advantage of it in GUI, just make a variable "TempString", use this custom script, and it will overwrite TempString with the localized version:
  • Set TempString = (Name of (Triggering unit))
  • Custom script: set udg_TempString = GetLocalizedString(udg_TempString)
  • -------- You can use "TempString" below this and it will be the localized (translated) version based on the person's client --------
 
Status
Not open for further replies.
Top