• 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

Status
Not open for further replies.
Level 5
Joined
Nov 28, 2010
Messages
20
Hello Dudes (and Dudettes)!

I need a little help for my map,maybe you know i have a map called "Hollow Attack" (i have a link in my signature) and i want a new feature in new version of the map.

What i need is when you kill an enemy,a trigger will activate and if you kill another enemy in a time (eg. 0.25 seconds) it will be a double kill and will add you and to the "dungeon door" destructible 20 health.
I made trigger and it didn't actually work so i am requesting you guys for making a trigger for me :)

Ps. i want it to be 0.25 sec because main point is you hit them at the same time so if you could just do that,it'd be pretty awesome.

Oh and i dont use JASS so it'd be pretty awesome if you could do it with simple triggers

Thanks! :3

(Oh and i will surely give credit sooo,don't worry 'bout that. :) )
 
Level 13
Joined
Oct 10, 2009
Messages
439
Just use an Array timer, setting the [X] to the (player number of (owner of killing unit)) setting it to w/e time you want it to be,

create a trigger that runs whenever timer XXX[1]etc finishes, then set playerkills[1] == 0
Create this trigger for each player, (Gets a bit more involved if you want to mash all players into one trigger, results in hashtables and calling integerfunctions from a timer)

And then simply, whenever a unit dies,
  • set (Playerkills[Player number of(Owner of killing unit)] = Playerkills[[Player number of(Owner of killing unit)] + 1
Then check to see if (Playerkills[Player number of(Owner of killing unit)] is equal to 2, And you have your doublekill! You can check to see if it is three for a triple kill etc.
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
  • Double Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to [your unit-type]
    • Actions
      • Set Kills[(Player number of (Owner of (Killing unit)))] = (Kills[(Player number of (Owner of (Killing unit)))] + 1)
      • Countdown Timer - Start Timer[(Player number of (Owner of (Killing unit)))] as a One-shot timer that will expire in 0.25 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Kills[(Player number of (Owner of (Killing unit)))] Equal to 2
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of (Owner of (Killing unit))) + just got a double kill!)
        • Else - Actions
You will need to do this trigger for each player:

  • Timer 1
    • Events
      • Time - Timer[1] expires
    • Conditions
    • Actions
      • Set Kills[1] = 0
I'm not quite sure what you mean by the dungeon door - please explain :smile:

Thanks to slash for the idea!
 
Remember, give rep to those who helped you
One more and I call moderator ;)

@Mr_Bean - It'd would be nice to improve the trigger via replacing (Dying unit) with (Triggering unit) plus I'd rather check if we should actually timer again if it's already running. Additionaly you can use integer variable to negate the '(Player number of (Owner of (Killing unit)))' spamming - to make script a little faster.

  • Double Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to [your unit-type]
    • Actions
      • Custom script: set udg_i = GetPlayerId(GetOwningPlayer(GetKillingUnit()))
      • Set Kills[i] = (Kills[i] + 1)
      • Custom script: if udg_Kills[udg_i] == 0 then
      • Countdown Timer - Start Timer[i] as a One-shot timer that will expire in 0.25 seconds
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Kills[i] Equal to 2
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of (Owner of (Killing unit))) + just got a double kill!)
        • Else - Actions
Additionaly: only timers with array 1 & 0 are initializted. Calling for egzample timer[3] won't do a shit if you haven't created it first via CreateTimer() function. It would be nice to initialize those timers at map initialization trigger (one for eahc player) - make sure you use comapisron:
JASS:
if <timer array> != null then
    set timer[arrayIndexHere] = CreateTimer()
endif
To prevent leaks.
 
Last edited:
Status
Not open for further replies.
Top