• 🏆 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!

Killing count trigger

Status
Not open for further replies.
Level 24
Joined
Jul 9, 2009
Messages
4,097
Hi guys I need help to get an trigger that makes an killing window that shows how many kills every player have. Like the one in Angel Arena BUT it shall count how many units each player has killed not heroes.

Can you send some screens that shows how to make it?
 
Last edited by a moderator:
Level 5
Joined
May 10, 2009
Messages
88
This is very basic, but it works :D


  • Kills Count
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • -------- Do this for every palyer --------
      • Leaderboard - Create a leaderboard for (All players) titled Kills
      • Leaderboard - Sort (Last created leaderboard) by Value in Descending order
      • Leaderboard - Add Player 1 (Red) to (Last created leaderboard) with label Red Kills and value Red_Kills
      • Leaderboard - Add Player 2 (Blue) to (Last created leaderboard) with label Blue Kills and value Blue_Kills
      • Leaderboard - Add Player 3 (Teal) to (Last created leaderboard) with label Teal Kills and value Teal_Kills
      • Leaderboard - Add Player 4 (Purple) to (Last created leaderboard) with label Purple Kills and value Purple_Kills
      • Leaderboard - Show (Last created leaderboard)
  • Kills Counting
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • -------- Do this for every palyer --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Killing unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to (Red_Kills + 1)
          • Set Red_Kills = (Red_Kills + 1)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Killing unit)) Equal to Player 2 (Blue)
            • Then - Actions
              • Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to (Blue_Kills + 1)
              • Set Blue_Kills = (Blue_Kills + 1)
            • Else - Actions
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,207
Lode, use an array instead of multiple selection, it is garunteed to be easier to impliment (no multiple selection) and work isntantly for all players.

For example.
Kills[0] could be the kills for Player(0) (Player Red)
Kills[1] could be the kills for Player(1) (Player Blue)

Thus To find the right index to update, all you need to do is get id of the player who did the killing and use that as the index to the variable. Equaly you can use that to do the updating.
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
Lode, use an array instead of multiple selection, it is garunteed to be easier to impliment (no multiple selection) and work isntantly for all players.

For example.
Kills[0] could be the kills for Player(0) (Player Red)
Kills[1] could be the kills for Player(1) (Player Blue)

Thus To find the right index to update, all you need to do is get id of the player who did the killing and use that as the index to the variable. Equaly you can use that to do the updating.

Heres an example what DSR said:
  • Board
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set PlayersInGame = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))) // all players that are in-game, without computers
      • Leaderboard - Create a leaderboard for PlayersInGame titled Kills // the board
      • Set Killboard = (Last created leaderboard) // using an veriable
      • Player Group - Pick every player in PlayersInGame and do (Actions)
        • Loop - Actions
          • Leaderboard - Add (Picked player) to Killboard with label (Name of (Picked player)) and value PlayerKills[(Player number of (Picked player))] // all players that are in-game are added
Counting kills with an array-veriable:

  • Count Kills
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False // heroes do not count as kills
    • Actions
      • Set PlayerKills[(Player number of (Owner of (Killing unit)))] = (PlayerKills[(Player number of (Owner of (Killing unit)))] + 1) // the owner of the killing unit get +1 kill
      • Leaderboard - Change the value for (Owner of (Killing unit)) in Killboard to PlayerKills[(Player number of (Owner of (Killing unit)))] // changing its value (kills value) in the board (Killboard from the 1st trigger)
      • Leaderboard - Sort Killboard by Value in Descending order // sorting the values
 
Status
Not open for further replies.
Top