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

[Trigger] Calling a custom script

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
I have the following custom script:
JASS:
function PlayerColouredText takes player p, string txt returns string
    local playercolor pc = GetPlayerColor(p)
    if pc == PLAYER_COLOR_RED then
        set txt = "|cffFF0202"+txt+"|r"
    elseif pc == PLAYER_COLOR_BLUE then
        set txt = "|cff0041FF"+txt+"|r"
    elseif pc == PLAYER_COLOR_CYAN then
        set txt = "|Cff1BE5B8"+txt+"|r"
    elseif pc == PLAYER_COLOR_PURPLE then
        set txt = "|CFF530080"+txt+"|r"
    elseif pc == PLAYER_COLOR_YELLOW then
        set txt = "|CFFFFFC00"+txt+"|r"
    elseif pc == PLAYER_COLOR_ORANGE then
        set txt = "|CFFFE890D"+txt+"|r"
    elseif pc == PLAYER_COLOR_GREEN then
        set txt = "|CFF1FBF00"+txt+"|r"
    elseif pc == PLAYER_COLOR_PINK then
        set txt = "|CFFE45AAF"+txt+"|r"
    elseif pc == PLAYER_COLOR_LIGHT_GRAY then
        set txt = "|CFF949596"+txt+"|r"
    elseif pc == PLAYER_COLOR_LIGHT_BLUE then
        set txt = "|CFF7DBEF1"+txt+"|r"
    elseif pc == PLAYER_COLOR_AQUA then
        set txt = "|CFF0F6145"+txt+"|r"
    elseif pc == PLAYER_COLOR_BROWN then
        set txt = "|CFF4D2903"+txt+"|r"
    else  // A safty function
        set txt = "|CFFFFFFFF"+txt+"|r"
    endif
    set pc = null
    return txt
endfunction

I was wondering how i would use this for when a random player triggers an event?
 
Level 17
Joined
Jun 17, 2007
Messages
1,433
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set Player_Colours[1] = |c00ff0303
    • Set Player_Colours[2] = |c000042ff
    • Set Player_Colours[3] = |c001ce6b9
    • Set Player_Colours[4] = |c00540081
    • Set Player_Colours[5] = |c00fffc01
    • Set Player_Colours[6] = |c00feba0e
    • Set Player_Colours[7] = |c0020c000
    • Set Player_Colours[8] = |c00e55bb0
    • Set Player_Colours[9] = |c00959697
    • Set Player_Colours[10] = |c007ebff1
    • Set Player_Colours[11] = |c00106246
    • Set Player_Colours[12] = |c004e2a04
Is the setup. An example of use would be something like
  • Game - Display to (All players) for 5.00 seconds the text: (Player_Colours[(Player number of (Triggering player))] + |r has triggered an event.)
To store the players name inside the array, use something like this:
  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • Set Player_Colours[(Integer A)] = ((Player_Colours[(Integer A)] + (Name of (Player((Integer A))))) + |r)
Feel free to post if you need more explanation.
 
Level 7
Joined
Oct 14, 2008
Messages
340
you could use a string variable and do:

  • Custom script: set udg_TempString = PlayerColouredText(PLAYER, STRING)
followed by
  • Game - Display to (All players) the text: (TempString)
 
Level 9
Joined
Jun 7, 2008
Messages
440
See. I would use the GUI Version of the trigger, But i also have another set where i have the hero names set as part of the player name. If i set player names as colored arrays, Will i mess up the other custom script?
 
Level 9
Joined
Jun 7, 2008
Messages
440
What type of event would i use to set the:
  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • Set Player_Colours[(Integer A)] = ((Player_Colours[(Integer A)] + (Name of (Player((Integer A))))) + |r)
 
Status
Not open for further replies.
Top