Kill system

Status
Not open for further replies.
Level 7
Joined
Apr 7, 2009
Messages
241
Anyone know how to make a system like in DotA that tells everyone when a player has killed another player? like when I kill a player named hogger:

I-am-murloc has killed Hogger!
 
Level 9
Joined
Jun 25, 2009
Messages
427
Maybe something like this:

  • Kills
    • Events:
      • Unit - A unit Dies
    • Conditions:
      • (Dying unit) is a Hero equal to True
    • Actions:
      • Game - Text to (All Players): ((Name of (Owner of (Killing unit)+has owned+ (Name of (Owner of (Dying Unit))
 
Level 7
Joined
Apr 7, 2009
Messages
241
Maybe something like this:

  • Kills
    • Events:
      • Unit - A unit Dies
    • Conditions:
      • (Dying unit) is a Hero equal to True
    • Actions:
      • Game - Text to (All Players): ((Name of (Owner of (Killing unit)+has owned+ (Name of (Owner of (Dying Unit))

good idea, but what if I want the names to be displayed in color, so that if I am the red player then my name will be red when the message comes up
 
Level 9
Joined
May 28, 2007
Messages
365
Import this into your map's custom script section.

function GetPlayerNameColored takes player p returns string
local playercolor pc = p
local string s
if pc == PLAYER_COLOR_RED then
set s = "|cffFF0000"
elseif pc == PLAYER_COLOR_BLUE then
set s = "|cff0000FF"
elseif pc == PLAYER_COLOR_CYAN then
set s = "|cff00FFFF"
elseif pc == PLAYER_COLOR_PURPLE then
set s = "|cff800080"
elseif pc == PLAYER_COLOR_YELLOW then
set s = "|cffFFFF00"
elseif pc == PLAYER_COLOR_ORANGE then
set s = "|cffFF8000"
elseif pc == PLAYER_COLOR_GREEN then
set s = "|cff00FF00"
elseif pc == PLAYER_COLOR_PINK then
set s = "|cffFF80C0"
elseif pc == PLAYER_COLOR_LIGHT_GRAY then
set s = "|cffC0C0C0"
elseif pc == PLAYER_COLOR_LIGHT_BLUE then
set s = "|cff8080FF"
elseif pc == PLAYER_COLOR_AQUA then
set s = "|cff008040"
elseif pc == PLAYER_COLOR_LIGHT_BLUE then
set s = "|cff804000"
else
set s = "|cff808080"
endif
set pc = null
return s+GetPlayerName(p)+|r
endfunction

Then make custom script

call DisplayTextToForce(theforce, GetPlayerNameColor(GetOwningPlayer(GetKillingUnit())) + "killed" + GetPlayerNameColor(GetOwningPlayer(GetTriggerUnit())))
 
Level 9
Joined
Jun 25, 2009
Messages
427
Import this into your map's custom script section.

function GetPlayerNameColored takes player p returns string
local playercolor pc = p
local string s
if pc == PLAYER_COLOR_RED then
set s = "|cffFF0000"
elseif pc == PLAYER_COLOR_BLUE then
set s = "|cff0000FF"
elseif pc == PLAYER_COLOR_CYAN then
set s = "|cff00FFFF"
elseif pc == PLAYER_COLOR_PURPLE then
set s = "|cff800080"
elseif pc == PLAYER_COLOR_YELLOW then
set s = "|cffFFFF00"
elseif pc == PLAYER_COLOR_ORANGE then
set s = "|cffFF8000"
elseif pc == PLAYER_COLOR_GREEN then
set s = "|cff00FF00"
elseif pc == PLAYER_COLOR_PINK then
set s = "|cffFF80C0"
elseif pc == PLAYER_COLOR_LIGHT_GRAY then
set s = "|cffC0C0C0"
elseif pc == PLAYER_COLOR_LIGHT_BLUE then
set s = "|cff8080FF"
elseif pc == PLAYER_COLOR_AQUA then
set s = "|cff008040"
elseif pc == PLAYER_COLOR_LIGHT_BLUE then
set s = "|cff804000"
else
set s = "|cff808080"
endif
set pc = null
return s+GetPlayerName(p)+|r
endfunction

Then make custom script

call DisplayTextToForce(theforce, GetPlayerNameColor(GetOwningPlayer(GetKillingUnit())) + "killed" + GetPlayerNameColor(GetOwningPlayer(GetTriggerUnit())))

Actually in MY MAP, i just did something like this
  • Player Colored Names
    • Events:
      • Time - Elapsed Game time is 1.00 seconds
    • Conditions:
      • Player's 1 (Red) slot status equal to unused
    • Actions:
      • Set Player_Colored_Names[1]=|c000000|r (or something like that)
      • Set Player_Colored_Names[2]=|cBFSDCDF|r (just examples)
      • Then set every player's colours here
Then in the previous trigger i wrote just change from

  • Kills
    • Events:
      • Unit - A unit Dies
    • Conditions:
      • (Dying unit) is a Hero equal to True
    • Actions:
      • Game - Text to (All Players): ((Name of (Owner of (Killing unit)+has owned+ (Name of (Owner of (Dying Unit))
[/QUOTE]

TO

  • Kills
    • Events:
      • Unit - A unit Dies
    • Conditions:
      • (Dying unit) is a Hero equal to True
    • Actions:
      • Game - Text to (All Players): ((Player_Colored_Names[Player Number(Owner of (Killing unit)]+has owned+ (Player_Colored_Names[Player Number(Owner of (Dying Unit)])
And that's how it is in my map :) (something like this)

Hope it'll help

EDIT: If you need help to set something like this (the arrays, etc) just tell me here, i'll maybe make a custom test map for you ;)

Tiche3:grin:
 
Level 7
Joined
Apr 7, 2009
Messages
241
Import this into your map's custom script section.

function GetPlayerNameColored takes player p returns string
local playercolor pc = p
local string s
if pc == PLAYER_COLOR_RED then
set s = "|cffFF0000"
elseif pc == PLAYER_COLOR_BLUE then
set s = "|cff0000FF"
elseif pc == PLAYER_COLOR_CYAN then
set s = "|cff00FFFF"
elseif pc == PLAYER_COLOR_PURPLE then
set s = "|cff800080"
elseif pc == PLAYER_COLOR_YELLOW then
set s = "|cffFFFF00"
elseif pc == PLAYER_COLOR_ORANGE then
set s = "|cffFF8000"
elseif pc == PLAYER_COLOR_GREEN then
set s = "|cff00FF00"
elseif pc == PLAYER_COLOR_PINK then
set s = "|cffFF80C0"
elseif pc == PLAYER_COLOR_LIGHT_GRAY then
set s = "|cffC0C0C0"
elseif pc == PLAYER_COLOR_LIGHT_BLUE then
set s = "|cff8080FF"
elseif pc == PLAYER_COLOR_AQUA then
set s = "|cff008040"
elseif pc == PLAYER_COLOR_LIGHT_BLUE then
set s = "|cff804000"
else
set s = "|cff808080"
endif
set pc = null
return s+GetPlayerName(p)+|r
endfunction

Then make custom script

call DisplayTextToForce(theforce, GetPlayerNameColor(GetOwningPlayer(GetKillingUnit())) + "killed" + GetPlayerNameColor(GetOwningPlayer(GetTriggerUnit())))

I get an error on the "return s+GetPlayerName(p)+|r" part of the script.
Unexpected: |
 
Level 9
Joined
Jun 25, 2009
Messages
427
The thing is I want the names to show up with color :p

Already wrote how Set Player_Colored_Names[1] (the[1] is player's one number, so you set string array to |c000|r something, find the colours and it works, tomorrow, if i have time, i'll make you a custom test map for this.

Good night for me

Good Luck, tomorrow, i'll look into it ;D

Tiche3:grin:
 
Sorry, I didn't fully look into the code. =P
JASS:
function GetPlayerNameColored takes player p returns string
    local playercolor pc = GetPlayerColor(p)
    local string s
    if pc == PLAYER_COLOR_RED then
        set s = "|cffFF0000"
    elseif pc == PLAYER_COLOR_BLUE then
        set s = "|cff0000FF"
    elseif pc == PLAYER_COLOR_CYAN then
        set s = "|cff00FFFF"
    elseif pc == PLAYER_COLOR_PURPLE then
        set s = "|cff800080"
    elseif pc == PLAYER_COLOR_YELLOW then
        set s = "|cffFFFF00"
    elseif pc == PLAYER_COLOR_ORANGE then
        set s = "|cffFF8000"
    elseif pc == PLAYER_COLOR_GREEN then
        set s = "|cff00FF00"
    elseif pc == PLAYER_COLOR_PINK then
        set s = "|cffFF80C0"
    elseif pc == PLAYER_COLOR_LIGHT_GRAY then
        set s = "|cffC0C0C0"
    elseif pc == PLAYER_COLOR_LIGHT_BLUE then
        set s = "|cff8080FF"
    elseif pc == PLAYER_COLOR_AQUA then
        set s = "|cff008040"
    elseif pc == PLAYER_COLOR_LIGHT_BLUE then
        set s = "|cff804000"
    else
        set s = "|cff808080"
    endif
    set pc = null
    return s+GetPlayerName(p)+"|r"
endfunction

Should work.
 
Status
Not open for further replies.
Top