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

Double kill system won't work

Status
Not open for further replies.
Level 11
Joined
Jun 26, 2014
Messages
504
  • 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.
 
Level 28
Joined
Sep 26, 2009
Messages
2,515
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.
 
Status
Not open for further replies.
Top