Trigger after killing 3 units?

BadWires

New Member
Reaction score
0
Hey guys,

Could anyone explain to me how I could make a trigger that happens when the user kills 3 lava crab critters?
 

Severon

New Member
Reaction score
7
create a global variable of type integer(for this example I'll use crabby) and then have a trigger that fires everytime a unit is kill of type lava crab and set variable crabby=crabby+1
then set action to if crabby=3 do actions(desired actions)
 
Reaction score
54
Code:
You are going to need an array to store the kills.

Event
 A unit dies
Condition
 Unit-type of Dying Unit is Lava Crab
Actions
 Modify Property: numberKills[Owner of (Killing Unit)] = +1
 If (numberKills[Owner of (Killing Unit) == 3)
  Your actions go here.
 

Flare

Stops copies me!
Reaction score
662
Trigger:
  • Disabled Trigger
    • Events
      • Unit - Any Unit dies
    • Local Variables
      • KillingPlayer = 0 <Integer>
    • Conditions
      • (Unit type of (Triggering unit)) == Marine
    • Actions
      • Variable - Set KillingPlayer = (Killing player)
      • Variable - Set Counter[KillingPlayer] = (Counter[0] + 1)
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • Counter[KillingPlayer] == 3
        • Then
          • ------- Do your actions here
          • ------- If this trigger is only needed for one player, you can remove the array usage of the global Counter variable, and add a condition to check if the Killing Player is equal to Player X
          • ------- And return Counter to a value of 0, if necessary
        • Else

Something like that? Just make yourself a global integer variable called Counter (or whatever you want) and do the above

EDIT: Fix'd
 

BadWires

New Member
Reaction score
0
Ah thanks guys. I didn't know you could make global variables and that was throwing me off!

:thup:
 

Im_On_56k

Hm...
Reaction score
116
Incase you ever want it to run every 3 kills instead of just the first 3 kills you can change the if statement from the posts above from
Code:
Kills[player] == 3

to

Code:
(Kills[player] mod 3) == 0

You can always set the kill counter back to 0, but that's not exactly keeping track of total kills now is it :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top