• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

Kills BAR

Status
Not open for further replies.
Level 4
Joined
Jul 18, 2008
Messages
76
HEY GUYS. how do i create a hero-kills window?
only for hero-kills, a player get 1 kill.
I also want it to count up to 100 kills and the one who gets 100 kills wins the map.
Thanks.
 
Level 6
Joined
May 7, 2009
Messages
228
Search the forums
I'm sure plenty of people have explained it already

Anyway, here's the basics
Use a variable array to store the number of kills each player has

Whenever a hero dies, increment the killcount for the killing player and update the leaderboard. Check if the killcount is now 100, and if so, end the game.
 
Level 6
Joined
Apr 24, 2008
Messages
174
I made 2 simple triggers for you.
They are leakfree and MUI.
Add this trigger:

  • Leaderboard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set Leaderboard_Players = (All players matching (((Matching player) slot status) Equal to Is playing))
      • Leaderboard - Create a leaderboard for Leaderboard_Players titled Heroes Killed
      • Set Leaderboard = (Last created leaderboard)
      • For each (Integer A) from 1 to (Number of players in Leaderboard_Players), do (Actions)
        • Loop - Actions
          • Set Heroes_Killed[(Integer A)] = 0
          • Leaderboard - Add (Picked player) to Leaderboard with label ((Name of (Player((Integer A)))) + kills:) and value Heroes_Killed[(Player number of (Player((Integer A))))]
      • Leaderboard - Show Leaderboard
      • Custom script: call DestroyForce(udg_Leaderboard_Players)
That will add the leaderboard.

  • Kill Counts
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • Set Heroes_Killed[(Player number of (Owner of (Killing unit)))] = (Heroes_Killed[(Player number of (Owner of (Killing unit)))] + 1)
      • Leaderboard - Change the value for (Owner of (Killing unit)) in Leaderboard to Heroes_Killed[(Player number of (Owner of (Killing unit)))]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Heroes_Killed[(Player number of (Owner of (Killing unit)))] Equal to 100
        • Then - Actions
          • Game - Victory (Owner of (Killing unit)) (Show dialogs, Show scores)
        • Else - Actions
That will update the leaderboard and show the new kills.
If the kills reaches 100, the killer wins the game.
 
Status
Not open for further replies.
Top