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

[JASS] Death

Status
Not open for further replies.
Level 2
Joined
Jun 10, 2007
Messages
19
I am pretty good at triggers but, I have never used Custom Script, it seems REALLY confusing. I need some1 to give me a tutorial. I am trying to make an event that when you die it says that "Owner of Killing unit's name" (in owner of killing unit's color) has killed "owner of killed unit's name" (in owner of killed units color) Help would be greatly appreciated.:confused:
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
JASS:
function GetPlayerColourTag takes player whichPlayer returns string
    local playercolor playerColour = GetPlayerColor(whichPlayer)
    local string colourString
    if playerColour == PLAYER_COLOR_RED then
        set colourString = "|cFFFF0202"
    elseif playerColour == PLAYER_COLOR_BLUE then
        set colourString = "|cFF0041FF"
    elseif playerColour == PLAYER_COLOR_CYAN then
        set colourString = "|cFF1BE6D8"
    elseif playerColour == PLAYER_COLOR_PURPLE then
        set colourString = "|cFF530080"
    elseif playerColour == PLAYER_COLOR_YELLOW then
        set colourString = "|cFFFFFC00"
    elseif playerColour == PLAYER_COLOR_ORANGE then
        set colourString = "|cFFFE890D"
    elseif playerColour == PLAYER_COLOR_GREEN then
        set colourString = "|cFF1FBF00"
    elseif playerColour == PLAYER_COLOR_PINK then
        set colourString = "|cFFE55AAF"
    elseif playerColour == PLAYER_COLOR_LIGHT_GRAY then
        set colourString = "|cFF949596"
    elseif playerColour == PLAYER_COLOR_LIGHT_BLUE then
        set colourString = "|cFF7DBEF1"
    elseif playerColour == PLAYER_COLOR_AQUA then
        set colourString = "|cFF0F6145"
    elseif playerColour == PLAYER_COLOR_BROWN then
        set colourString = "|cFF4D2903"
    endif
    set playerColour = null
    return colourString
endfunction

Soo...

JASS:
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, GetPlayerColorTag(GetOwningPlayer(GetKillingUnit())) + GetPlayerName(GetOwningPlayer(GetKillingUnit())) + "|r has killed " + GetPlayerColorTag(GetOwningPlayer(GetTriggerUnit())) + GetPlayerName(GetOwningPlayer(GetTriggerUnit())) + "|r" )
 
Arghh... Poot! You stole my code!

lol:
JASS:
function GetPlayerColorString takes player p returns string
    //Credits to Andrewgosu from TH for the color codes//
    local playercolor c = GetPlayerColor(p)
    if c == PLAYER_COLOR_RED then
        return "|cffFF0202"
    elseif c == PLAYER_COLOR_BLUE then
        return "|cff0041FF"
    elseif c == PLAYER_COLOR_CYAN then
        return "|cff1BE5B8"
    elseif c == PLAYER_COLOR_PURPLE then
        return "|cff530080"
    elseif c == PLAYER_COLOR_YELLOW then
        return "|cffFFFC00"
    elseif c == PLAYER_COLOR_ORANGE then
        return "|cffFE890D"
    elseif c == PLAYER_COLOR_GREEN then
        return "|cff1FBF00"
    elseif c == PLAYER_COLOR_PINK then
        return "|cffE45AAF"
    elseif c == PLAYER_COLOR_LIGHT_GRAY then
        return "|cff949596"
    elseif c == PLAYER_COLOR_LIGHT_BLUE then
        return "|cff7DBEF1"
    elseif c == PLAYER_COLOR_AQUA then
        return "|cff0F6145"
    elseif c == PLAYER_COLOR_BROWN then
        return "|cff4D2903"
    else
        return "|cffFFFFFF"
    endif
endfunction

Anyways, I don't think playercolors need to be nulled, even if they are handles. They are permanent playercolors (I think, unless modified) so they do not need to be nulled, same thing with players as I mentioned before. Well, that is what I think...

But, your's might be safer. Anyways, here is the post you supposedly ripped my code from:
http://hiveworkshop.com/forums/showthread.php?t=35214

Lol... I bet you didn't but the codes seem the same, except for different vars and ways. :grin:
 
Level 2
Joined
Jun 10, 2007
Messages
19
Thx, but i found another trigger way.

Hey thx all of you for the script, but i found it out in triggers. The problem was (Just figured out today when changing map name) i was putting it in the wrong spot! I didnt understand where to put the maps custom script. But thx anyway!
P.S. Anybody who doesn't want to use custom script for this you need to do this: 1: Make a string variable for color codes with an array of how ever many players you want. 2:Make a trigger for setting variable at map initialization. 3: Here is my trigger
  • Events
    • - Map initialization
  • Conditions
    • - None
  • Actions
    • - Set Pcolorcodes[1]=|cffff0303
    • - Set Pcolorcodes[2]=|cff0042ff
    • - Set Pcolorcodes[3]=|cff1ce6b9
    • - Set Pcolorcodes[4]=|cff540081
    • - Set Pcolorcodes[5]=|cfffffc01
    • - Set Pcolorcodes[6]=|cfffe8a0e
    • - Set Pcolorcodes[7]=|cff20c000
    • - Set Pcolorcodes[8]=|cffe55bb0
    • - Set Pcolorcodes[9]=|cff959697
    • - Set Pcolorcodes[10]=|cff7ebff1
    • - Set Pcolorcodes[11]=|cff106246
    • - Set Pcolorcodes[12]=|cff4e2a04
4: In triggers put this variable in the string before the name of the player. It should end up as:
... (has just killed) (Pcolorcodes[(Player Number of (owner of (Dying Unit)))]+(Player number of (owner of (Dying Unit)))(|r for 200 gold!))):infl_thumbs_up:
 
Status
Not open for further replies.
Top