• 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.

Unit kill counter

Status
Not open for further replies.
Level 3
Joined
May 30, 2008
Messages
32
Hi I want to make a basic Trigger that can count specific unit then turn off trigger like this.

  • unit count
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Unit - Set the custom value of (Dying unit) to 1
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Trigger - Turn off respawn Rat slime <gen>

I know this trigger is all wrong and everything, but it an example. I like the trigger to count specific unit dying to certian number then it activate Trigger turn off.

I'm hoping for a simple counting trigger.
 
Level 3
Joined
Feb 14, 2009
Messages
23
event is ok
action
set killcount=killcount+1 (real variable)
for each integer A blabla do
if killcount=your desired number
then turn off trigger
 
Level 3
Joined
May 30, 2008
Messages
32
Like this

  • kill count again
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Set Killcount[0] = Killcount[1]
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Trigger - Turn off respawn Rat slime <gen>
 
Level 3
Joined
May 30, 2008
Messages
32
What you are doing makes no sense.

Ok when a player kill certian amount of monster then the trigger will keep track of it and when the number reach to the desire amount it will turn them off.

Like I have rat and I want the hero to kill 10 rat then turn off that trigger that spawn the rat.
 
Level 3
Joined
May 30, 2008
Messages
32
ok This is the trigger im trying to turn off this trigger keep spawning them over and over none stop

  • respawn Rat slime
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to a slime
          • (Unit-type of (Triggering unit)) Equal to a rat
    • Actions
      • Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Random point in test region <gen>) facing (Position of (Triggering unit))


So I want a counter that can count how many kill a player kill and have it to turn this one off so it will stop spawning.
 
Level 22
Joined
Jun 24, 2008
Messages
3,050
A respawn or a counter?
Look at this:

  • Title
  • Events
  • Unit - A unit owned by Player 12 (Brown) Dies
  • Conditions
  • Or - Any (Conditions) are true
  • Conditions
  • (Unit-type of (Triggering unit)) Equal to a slime
  • (Unit-type of (Triggering unit)) Equal to a rat
  • (IntegerVariable[Player number of (killing unit)] > 10
  • Actions
  • Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Random point in test region <gen>) facing (Position of (Triggering unit))
  • Set IntegerVariable[Player number of (Killing unit)] = (IntegerVariable[Player number of (Killing unit)]) +1
This way it will only count the 10 first.
 
Level 5
Joined
Jan 25, 2006
Messages
103
based on your last post you are asking a lot.
Why don't you add more conditions directly to the trigger you want to turn off.
Also replace unit-type of "triggering" unit with "dying" unit.
That should stop the trigger from spawning units endlessly, since your current trigger works for each unit that dies owned by player 12, not for those 2 specific units you have in the condition.
 
Level 3
Joined
May 30, 2008
Messages
32
A respawn or a counter?
Look at this:

  • Title
  • Events
  • Unit - A unit owned by Player 12 (Brown) Dies
  • Conditions
  • Or - Any (Conditions) are true
  • Conditions
  • (Unit-type of (Triggering unit)) Equal to a slime
  • (Unit-type of (Triggering unit)) Equal to a rat
  • (IntegerVariable[Player number of (killing unit)] > 10
  • Actions
  • Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Random point in test region <gen>) facing (Position of (Triggering unit))
  • Set IntegerVariable[Player number of (Killing unit)] = (IntegerVariable[Player number of (Killing unit)]) +1
This way it will only count the 10 first.


U ask is it a counter or a respawn, it a counter. I think the way u made it is when a player kill the unit and it will respawn till 10 time then it quit after that is that correct?
 
Level 3
Joined
May 30, 2008
Messages
32
Ok I tried my best , but I can't seem to get to what u got and I use Viarable for Kill count while you use IntegerVariable[Player number of (killing unit)] > 10

so can u please show me how u did the last part in action

  • Set Killcount[(Player number of (Owner of (Killing unit)))] = Killcount[(Player number of (Owner of (Killing unit)))]

This is what I did, and couldn't mimic what u ask me to do.

  • kill count again Copy
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to a slime
          • (Unit-type of (Triggering unit)) Equal to a rat
          • (Player number of (Matching player)) Equal to 10
    • Actions
      • Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Center of test region <gen>) facing Default building facing degrees
      • Set Killcount[(Player number of (Owner of (Killing unit)))] = Killcount[(Player number of (Owner of (Killing unit)))]
 

EPW

EPW

Level 4
Joined
Feb 27, 2009
Messages
60
Okay...

Sorry, I am back...
I am the one who usually helps him with the triggers...
Okay, here is what he wanted...he wanted like, if Team I has 4,000 kills of one spawn, then it goes to the next spawn...
anyway,
I solved the problem...

Here is the trigger:
  • unit count
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Or - Any (Conditions) are true
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to a slime
      • (Unit-type of (Triggering unit)) Equal to a rat
      • (Player number of (Picked player)) Equal to 10
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in UnitKillCount) Equal to 10
    • Then - Actions
      • Unit Group - Remove all units from UnitKillCount
      • Trigger - Turn off (This trigger)
    • Else - Actions
      • Unit Group - Add (Triggering unit) to UnitKillCount
      • Wait 3.00 seconds
      • Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Center of test region <gen>) facing Default building facing (270.0) degrees
For Variable:

Variable Name: [Anything you want]
Variable Type: Unit Group (group)
Do NOT set Array
Click Okay
PROBLEM SOLVED :pal:
PS i figured out how to use the forum!
 
Last edited:
Level 3
Joined
May 30, 2008
Messages
32
  • RespawnA
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to a slime
          • (Unit-type of (Triggering unit)) Equal to a rat
          • (Player number of (Picked player)) Equal to 10
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in UnitKillCount) Equal to 10
        • Then - Actions
          • Unit Group - Remove all units from UnitKillCount
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Add (Triggering unit) to UnitKillCount
          • Wait 3.00 seconds
          • Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Center of test region <gen>) facing Default building facing degrees


Ok it Solve my problem I had to get a friend EastpwnWest to help. Thank you everybody!
 
Level 3
Joined
May 30, 2008
Messages
32
This makes no sense whatsoever.

I ask for a simple! Trigger that count kills from certian Unit then it turn off other trigger that spawn them over and over so they won't spawn anymore after they die.

In result I got this. It not what I ask for, but it work and I agree it don't make sense but it work. lol

If anybody can give simple or explain simple trigger like the first guy that post I really would like them.
 
Level 18
Joined
Oct 18, 2007
Messages
930
Ok here is your trigger that you asked for in your first post

  • Kill Counter
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) slot status) Equal to Is playing
    • Actions
      • Set Integer = (Player number of (Owner of (Killing unit)))
      • Set KillScore[Integer] = (KillScore[Integer] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • KillScore[Integer] Equal to 10
        • Then - Actions
          • Trigger - Turn off respawn Rat slime <gen>
          • Set KillScore[Integer] = 0
          • -------- PUT SOME ACTIONS HERE IF YOU WANT --------
        • Else - Actions
      • -------- PUT SOME ACTIONS HERE IF YOU WANT --------
I use 2 global variables.

integer array KillScore

integer Integer



Why? Duh!
 
Status
Not open for further replies.
Top