Killing hero if player resource equals 0

Cfw_Master

New Member
Reaction score
1
Hello, I have another question:

How can I kill the hero that a player owns if their gold becomes 0?

Thanks in advance and +rep as always :D
 

RaiJin

New Member
Reaction score
40
Code:
Melee Initialization
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
         Do Multiple ActionsFor each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                 Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Player((Integer A))) Current gold) Equal to (==) 0
                    Then - Actions
                        Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to (==) True) and ((Owner of (Matching unit)) Equal to (==) (Player((Integer A)))))) and do (Actions)
                            Loop - Actions
                                Unit - Kill (Picked unit)
                    Else - Actions

that should do it
 

Tom Jones

N/A
Reaction score
437
Something like this may also work:
Trigger:
  • Test
    • Events
      • Player - Player 1 (Red)'s Current gold becomes Equal to 0.00
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
 

Cfw_Master

New Member
Reaction score
1
Ah yes. Thanks a lot for your help :D (+rep)

I didn't use those triggers because it gave me a different idea that works too. Just forgot about the unit group :rolleyes:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top