# Double kill system won't work

Status
Not open for further replies.

#### Krakenn99

Level 11
• Double Kill
• Events
• Unit - A unit Dies
• Conditions
• ((Dying unit) is A Hero) Equal to True
• Actions
• Set DKILL = ((Player number of (Owner of (Killing unit))) + 1)
• Countdown Timer - Start Timer_DKill as a One-shot timer that will expire in 15.00 seconds
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• DKILL Equal to 2
• Then - Actions
• Player - Add 100 to (Owner of (Killing unit)) Current gold
• Game - Display to (All players) for 30.00 seconds the text: ((Name of (Owner of (Killing unit))) + just got a |cffff0000double kill|r! He is granted extra |cffffcc00100 gold|r!)
• Sound - Play Double_kill___Sound_Effect <gen>
• Else - Actions
• Timer
• Events
• Time - Timer_DKill expires
• Conditions
• Actions
• Set DKILL = 0
So I've been strugglin to make this work. I still cannot see where the problem is.

#### Nichilus

Level 24
The first problem I see is that you use variable, not an array.
Everytime you kill hero, you do this: DKILL = ((Player number of (Owner of (Killing unit))) + 1). The (Player number of (Owner of (Killing unit)) part returns number of the killer. For example I think it's number 2 for player 2 (Blue). So what you do is DKILL = 2 + 1 = 3 for player blue. 3 is not equal to 2 no matter how many times you kill anyone.

It should be:
index = (Player number of (Owner of (Killing unit)))
DKILL[index] = DKILL[index] + 1.

Then you need to solve the logic of decrementing this value (or setting it to 0) once timer runs out.

#### IcemanBo

Level 37
Set DKILL = ((Player number of (Owner of (Killing unit))) + 1)
That's totaly wrong. You mixed something up. Maybe you mean something like: Set Kills[PlayerNumber] = Kills[PlayerNumber] + 1

It won't work correctly like this for more units, because you only use ONE timer. So it can be overwritten easily.

#### Krakenn99

Level 11
I will try to fix it. Thanks.

Status
Not open for further replies.

Replies
14
Views
1K
Replies
2
Views
591
Replies
6
Views
695
Replies
10
Views
935
Replies
7
Views
711