HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

double kill, triple kill.?

01-26-2005, 09:17 AM#1
vile
ok i have a problem
i have put a trigger for the double kill and all that
it goes like this

Double Kills
Events
Unit - A unit owned by Player 2 (Blue) Dies
Unit - A unit owned by Player 3 (Teal) Dies
Unit - A unit owned by Player 4 (Purple) Dies
Unit - A unit owned by Player 5 (Yellow) Dies
Unit - A unit owned by Player 6 (Orange) Dies
Unit - A unit owned by Player 8 (Pink) Dies
Unit - A unit owned by Player 9 (Gray) Dies
Unit - A unit owned by Player 10 (Light Blue) Dies
Unit - A unit owned by Player 11 (Dark Green) Dies
Unit - A unit owned by Player 12 (Brown) Dies
Conditions
((Dying unit) is A Hero) Equal to True
Actions
Wait 1.00 seconds
If ((Owner of (Killing unit)) Equal to Player 1 (Red)) then do (Skip remaining actions) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 7 (Green)) then do (Skip remaining actions) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Neutral Hostile) then do (Skip remaining actions) else do (Do nothing)
Set DoubleKills[(Player number of (Owner of (Killing unit)))] = (DoubleKills[(Player number of (Owner of (Killing unit)))] + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DoubleKills[(Player number of (Owner of (Killing unit)))] Equal to 2
Then - Actions
Sound - Play DoubleKill <gen>
If ((Owner of (Killing unit)) Equal to Player 2 (Blue)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF0042FF + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Double Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 3 (Teal)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF1CE6B9 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Double Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 4 (Purple)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF540081 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Double Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 5 (Yellow)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFFFFFC00 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Double Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 6 (Orange)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFFFE8A0E + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Double Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 8 (Pink)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFFE55BB0 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Double Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 9 (Gray)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF959697 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Double Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 10 (Light Blue)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF7FBFF1 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Double Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 11 (Dark Green)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF008000 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Double Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 12 (Brown)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF492A04 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Double Kill!))) else do (Do nothing)
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DoubleKills[(Player number of (Owner of (Killing unit)))] Equal to 3
Then - Actions
Sound - Play TripleKill <gen>
If ((Owner of (Killing unit)) Equal to Player 2 (Blue)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF0042FF + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Triple Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 3 (Teal)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF1CE6B9 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Triple Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 4 (Purple)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF540081 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Triple Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 5 (Yellow)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFFFFFC00 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Triple Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 6 (Orange)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFFFE8A0E + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Triple Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 8 (Pink)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFFE55BB0 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Triple Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 9 (Gray)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF959697 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Triple Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 10 (Light Blue)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF7FBFF1 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Triple Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 11 (Dark Green)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF008000 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Triple Kill!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 12 (Brown)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF492A04 + ((Name of (Owner of (Killing unit))) + |rjust got a |CFFF20031Triple Kill!))) else do (Do nothing)
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DoubleKills[(Player number of (Owner of (Killing unit)))] Equal to 4
Then - Actions
Sound - Play ultrakill <gen>
If ((Owner of (Killing unit)) Equal to Player 2 (Blue)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF0042FF + ((Name of (Owner of (Killing unit))) + |rGOT AN |CFFF20031ULTRA KILL! 4 KILLS IN A ROW!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 3 (Teal)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF1CE6B9 + ((Name of (Owner of (Killing unit))) + |rGOT AN |CFFF20031ULTRA KILL! 4 KILLS IN A ROW!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 4 (Purple)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF540081 + ((Name of (Owner of (Killing unit))) + |rGOT AN |CFFF20031ULTRA KILL! 4 KILLS IN A ROW!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 5 (Yellow)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFFFFFC00 + ((Name of (Owner of (Killing unit))) + |rGOT AN |CFFF20031ULTRA KILL! 4 KILLS IN A ROW!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 6 (Orange)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFFFE8A0E + ((Name of (Owner of (Killing unit))) + |rGOT AN |CFFF20031ULTRA KILL! 4 KILLS IN A ROW!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 8 (Pink)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFFE55BB0 + ((Name of (Owner of (Killing unit))) + |rGOT AN |CFFF20031ULTRA KILL! 4 KILLS IN A ROW!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 9 (Gray)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF959697 + ((Name of (Owner of (Killing unit))) + |rGOT AN |CFFF20031ULTRA KILL! 4 KILLS IN A ROW!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 10 (Light Blue)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF7FBFF1 + ((Name of (Owner of (Killing unit))) + |rGOT AN |CFFF20031ULTRA KILL! 4 KILLS IN A ROW!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 11 (Dark Green)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF008000 + ((Name of (Owner of (Killing unit))) + |rGOT AN |CFFF20031ULTRA KILL! 4 KILLS IN A ROW!))) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 12 (Brown)) then do (Game - Display to (All players) for 10.00 seconds the text: (|CFF492A04 + ((Name of (Owner of (Killing unit))) + |rGOT AN |CFFF20031ULTRA KILL! 4 KILLS IN A ROW!))) else do (Do nothing)
Else - Actions
Do nothing


and another trigger which resets it

Double Kills Reset
Events
Unit - A unit owned by Player 2 (Blue) Dies
Unit - A unit owned by Player 3 (Teal) Dies
Unit - A unit owned by Player 4 (Purple) Dies
Unit - A unit owned by Player 5 (Yellow) Dies
Unit - A unit owned by Player 6 (Orange) Dies
Unit - A unit owned by Player 8 (Pink) Dies
Unit - A unit owned by Player 9 (Gray) Dies
Unit - A unit owned by Player 10 (Light Blue) Dies
Unit - A unit owned by Player 11 (Dark Green) Dies
Unit - A unit owned by Player 12 (Brown) Dies
Conditions
((Dying unit) is A Hero) Equal to True
Actions
Set DoubleKillOwner = (Killing unit)
Wait 14.00 seconds
Set DoubleKills[(Player number of (Owner of DoubleKillOwner))] = 0


it works perfectly

the problem is that sometimes when someone kills someone, suddenly it says double kill, or triple kill

whats the problem?
PLEASE help.
01-26-2005, 11:00 AM#2
Anitarf
Because during those 14 seconds of waiting, another unit may become the DoubleKillOwner, and when the time runs out, that unit's double kills get reset instead of the unit that became the DoubleKillOwner first. Thant unit can then kill another hero long after those 14 seconds have expired and get a double kill.

There are other isssues with your code: if a player were to kill a hero, and then, after 13 seconds, he would kill another hero, he would, naturally, get a double kill. But, if he kills another hero just two seconds later, it won't become a tripple kill, because in the meantime, 14 seconds have passed since the first kill and that player's double kills are reset to 0.

Instead, I would do the whole thing like this: have an additional integer variable array called DoubleCountdown. Whenever a player kills a hero, DoubleCountdown would be set to 14 for that player, and then, in a periodic event, it would be dereased by 1 every second. If a player's DoubleCountdown would reach 0, his double kills would be reset to 0. As long as the player kept killing enemy heroes fast enough, his DoubleCountdown would never reach 0, because it would be reset to 14 on time.

And all those lines just to get different colored text are a pain to see. You can just use a string variable array to store the colors of each player. For example, ColorString[2] would be "|cff0042ff".
01-26-2005, 08:22 PM#3
vile
thanks so much for this awesome reply

as for the colored text
i tried to use a string a long time ago
unfortunately, when it displays it, it displays the color code and not the color itself when using a string
:(
01-26-2005, 08:51 PM#4
iNfraNe
then u prolly missed the 2 alpha chars. color code wont display as color code if it doesnt have the correct shape (=|caarrggbb) if u miss a char there, it wont display. I know u prolly know this, but that is the only problem that can arise.
01-26-2005, 10:28 PM#5
Anitarf
I agree, it has to work, a string is a string, it doesn't matter if it's a variable or a preset string: the trigger composes it all into one string and then displays it, converting color codes into colors as it does.
01-27-2005, 03:22 AM#6
vile
Quote:
Originally Posted by Anitarf
I agree, it has to work, a string is a string, it doesn't matter if it's a variable or a preset string: the trigger composes it all into one string and then displays it, converting color codes into colors as it does.

i tried it several times and i didnt miss any code
ill try it again and if it wont work again ill paste it here, maybe you could help me out
cheers
01-27-2005, 05:18 AM#7
Al3ks
here's something u can do instead of all those if statements, make a strings array like this

Actions
Set color[1] = |c00ff0303
Set color[2] = |c000042ff
Set color[3] = |c001ce6b9
Set color[4] = |c00540081
Set color[5] = |c00fffc01
Set color[6] = |c00ff8000
Set color[7] = |c0020c000
Set color[8] = |c00e55bb0
Set color[9] = |c00959697
Set color[10] = |c007ebff1
Set color[11] = |c00106246
Set color[12] = |c004e2a04

and.......

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
multikill_count[(Player number of (Owner of (Killing unit)))] Greater than 3
Then - Actions
Game - Display to (All players) for 10.00 seconds the text: ((color[(Player number of (Owner of (Killing unit)))] + (Name of (Owner of (Killing unit)))) + |r just got a |c0000ff40MEGA KILL!!!|r)
Else - Actions
01-27-2005, 07:31 AM#8
aaero
I just thought I'd jump in here and mention that Aleks really makes an excellent point for a good way to "clean up" your trigger.

In addition, I would do what Anitarf suggested and reformat how you do your triggers (by adding that additional variable and adding an additional trigger that constantly lowers the value of DoubleKills until it reaches zero). Your main trigger could be a lot smaller, just:

Code:
Double Kills
Events
Unit - A unit owned by Player 2 (Blue) Dies
Unit - A unit owned by Player 3 (Teal) Dies
Unit - A unit owned by Player 4 (Purple) Dies
Unit - A unit owned by Player 5 (Yellow) Dies
Unit - A unit owned by Player 6 (Orange) Dies
Unit - A unit owned by Player 8 (Pink) Dies
Unit - A unit owned by Player 9 (Gray) Dies
Unit - A unit owned by Player 10 (Light Blue) Dies
Unit - A unit owned by Player 11 (Dark Green) Dies
Unit - A unit owned by Player 12 (Brown) Dies
Conditions
((Dying unit) is A Hero) Equal to True
Actions
Wait 1.00 seconds
If ((Owner of (Killing unit)) Equal to Player 1 (Red)) then do (Skip remaining actions) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Player 7 (Green)) then do (Skip remaining actions) else do (Do nothing)
If ((Owner of (Killing unit)) Equal to Neutral Hostile) then do (Skip remaining actions) else do (Do nothing)
Set DoubleKills[(Player number of (Owner of (Killing unit)))] = (DoubleKills[(Player number of (Owner of (Killing unit)))] + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
       DoubleKills[(Player number of (Owner of (Killing unit)))] Equal to 2
    Then - Actions
      Game - Display to (All players) for 10.00 seconds the text: ((color[(Player number of (Owner of (Killing unit)))] + (Name of (Owner of (Killing unit)))) + |r just got a |c0000ff40Double Kill!!!|r)
   Else - Actions
         If - Conditions
               DoubleKills[(Player number of (Owner of (Killing unit)))] Equal to 3
         Then - Actions
               Game - Display to (All players) for 10.00 seconds the text: ((color[(Player number of (Owner of (Killing unit)))] + (Name of (Owner of (Killing unit)))) + |r just got a |CFFF20031Triple Kill!!!|r)
          Else - Actions
                       If - Conditions
                             DoubleKills[(Player number of (Owner of (Killing unit)))] Equal to 3
                       Then - Actions
                             Game - Display to (All players) for 10.00 seconds the text: ((color[(Player number of (Owner of (Killing unit)))] + (Name of (Owner of (Killing unit)))) + |r just got a |CFFF20031ULTRA KILL!!!|r)

Just trying to help you along :)
01-27-2005, 07:51 AM#9
Anitarf
Adding further ideas for code optimisation: you could also make a string array for various double/triple/multi/mega kills. That way, instead of a few if/then/elses, you could just set it all up in an init trigger, for example

set KillsText[2] = " has got a |cffff0404DOUBLE KILL!|r"
...

and then display the appropriate string using the DoubleKills[player number(owner of(killing unit))] as the index.
01-27-2005, 07:21 PM#10
vile
THANK U GUYS SO MUCH UR A GENIUS THE DOUBLE KILL WORKED!!
i have busted my ass for days trying to figure out wtf is wrong with it
thanks alot!!
01-28-2005, 08:56 AM#11
vile
very odd, the string color works now..
01-28-2005, 10:38 AM#12
iNfraNe
nothing odd about that ;) it was odd it didnt work. But you easily forget the alpha chars... so that must have been the prob.