• 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.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

[Trigger] Color message

Status
Not open for further replies.
Level 8
Joined
Aug 19, 2007
Messages
294
Hello i need help with a "Text Message"

  • Text Message
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Triggering unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
    • Actions
Game - Display to (All players) the text: "Name of owner of killing unit(in the player color)" + Just killed + "name of owner of triggering unit(in the player color)" + ´s Hero (+300 Gold)

I hope you can finish my trigger
 
Level 8
Joined
Mar 12, 2008
Messages
437
Or you can save the colours as a string variable, one for each player.

Example:
Colourstring[1] (red) = |cffFF0000
Colourstring[2] (blue) = |cff0000FF

I don't know the exact codes for the colours, but you get the point.

And then for viewing the string, use Colourstring[(Player number of (Owner of (Killing unit)))]
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Or you can save the colours as a string variable, one for each player.

Example:
Colourstring[1] (red) = |cffFF0000
Colourstring[2] (blue) = |cff0000FF

I don't know the exact codes for the colours, but you get the point.

And then for viewing the string, use Colourstring[(Player number of (Owner of (Killing unit)))]
I thought of that but what if player 1 color was changed at initialization to any color that won't work, he will still need a function to get the player color.
 
You need a Jass function. I suggest this one:
JASS:
function GetPlayerNameColoured takes player p returns string
    local playercolor pc = GetPlayerColor(p)
    local string s
    if pc == PLAYER_COLOR_RED then
        set s = "|cffFF0202"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_BLUE then
        set s = "|cff0041FF"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_CYAN then
        set s = "|Cff1BE5B8"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_PURPLE then
        set s = "|CFF530080"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_YELLOW then
        set s = "|CFFFFFC00"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_ORANGE then
        set s = "|CFFFE890D"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_GREEN then
        set s = "|CFF1FBF00"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_PINK then
        set s = "|CFFE45AAF"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_LIGHT_GRAY then
        set s = "|CFF949596"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_LIGHT_BLUE then
        set s = "|CFF7DBEF1"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_AQUA then
        set s = "|CFF0F6145"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_BROWN then
        set s = "|CFF4D2903"+GetPlayerName(p)+"|r"
    else // A safty function
        set s = "|CFFFFFFFF"+GetPlayerName(p)+"|r"
    endif
    set pc = null
    return s
endfunction

Make a global string called TempString, set the player whose colour you want to get to a global called TempPlayer, then do
custom script: set udg_TempString = GetPlayerNameColoured(udg_TempPlayer)

now you can use TempString, the coloured player name, in the message.
 
You need a Jass function. I suggest this one:
JASS:
function GetPlayerNameColoured takes player p returns string
    local playercolor pc = GetPlayerColor(p)
    local string s
    if pc == PLAYER_COLOR_RED then
        set s = "|cffFF0202"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_BLUE then
        set s = "|cff0041FF"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_CYAN then
        set s = "|Cff1BE5B8"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_PURPLE then
        set s = "|CFF530080"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_YELLOW then
        set s = "|CFFFFFC00"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_ORANGE then
        set s = "|CFFFE890D"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_GREEN then
        set s = "|CFF1FBF00"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_PINK then
        set s = "|CFFE45AAF"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_LIGHT_GRAY then
        set s = "|CFF949596"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_LIGHT_BLUE then
        set s = "|CFF7DBEF1"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_AQUA then
        set s = "|CFF0F6145"+GetPlayerName(p)+"|r"
    elseif pc == PLAYER_COLOR_BROWN then
        set s = "|CFF4D2903"+GetPlayerName(p)+"|r"
    else // A safty function
        set s = "|CFFFFFFFF"+GetPlayerName(p)+"|r"
    endif
    set pc = null
    return s
endfunction
Make a global string called TempString, set the player whose colour you want to get to a global called TempPlayer, then do

custom script: set udg_TempString = GetPlayerNameColoured(udg_TempPlayer)

now you can use TempString, the coloured player name, in the message.
Read how I say to do it with Jass ffs. I explained it well enough for a four year old to understand.
 
Status
Not open for further replies.
Top