• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Help with an Trigger (Killing count system)

Status
Not open for further replies.
Level 3
Joined
Nov 25, 2013
Messages
31
Hey! so i have this idea for a feature in a map i'm working on and i decided to try to copy an old trigger i got from another project some years ago but it dosen't work quit as i want it to at the moment and i have very little experience when it comes to this type of triggers.

How i want it to work:
- When a player kills a unit it starts counting them, one kill= one sacrefice in this case. When the player has killed let's say 25 units they get a message they can research a research that requires 25 kills and then it goes on to 50, 75 100


At the moment it works somewhat, but it's not correct on the kills and after it reaches it's first research it dosen't require 25 more kills in this case for next research but only 1.

Here is the trigger that i was given a few years back and tried to replicate somewhat
count.png
 
Based on what you've described, you shouldn't need this many variables or a hashtable involved. Really all you need is an integer to count the kills. See if this makes sense:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Killing unit)) Equal to Player 7 (Green)
    • Actions
      • Set VariableSet killCount_Green = (killCount_Green + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • killCount_Green Equal to 25
        • Then - Actions
          • -------- Cool Stuff --------
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • killCount_Green Equal to 50
        • Then - Actions
          • -------- More Cool Stuff --------
        • Else - Actions
 
Based on what you've described, you shouldn't need this many variables or a hashtable involved. Really all you need is an integer to count the kills. See if this makes sense:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Killing unit)) Equal to Player 7 (Green)
    • Actions
      • Set VariableSet killCount_Green = (killCount_Green + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • killCount_Green Equal to 25
        • Then - Actions
          • -------- Cool Stuff --------
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • killCount_Green Equal to 50
        • Then - Actions
          • -------- More Cool Stuff --------
        • Else - Actions
That did it! thank you very much
 
If you're going to implement Ghan's example into your map then you should definitely use Arrays.
  • Example
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set VariableSet PN = (Player number of (Owner of (Killing unit)))
      • Set VariableSet KillCount[PN] = (KillCount[PN] + 1)
In most cases you can replace variables like "RedVariable" or "BlueVariable" with an Array, using that Player's Number as the Index.

KillCount[1] = Player 1's Kills
KillCount[2] = Player 2's Kills
KillCount[3] = Player 3's Kills
etc...
 
Status
Not open for further replies.
Back
Top