• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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