Need Help With Defeat

Pyroflame

New Member
Reaction score
4
How can I make it so that when all heros of players one through seven, it defeats them all; as opposed to defeating them one at a time (possibly defeating the host and ruining the game).

So far I have:

~ Events ~
Unit - A unit owned by Player 1 (Red) Dies
Unit - A unit owned by Player 2 (Red) Dies
Unit - A unit owned by Player 3 (Red) Dies
Unit - A unit owned by Player 4 (Red) Dies
Unit - A unit owned by Player 5 (Red) Dies
Unit - A unit owned by Player 6 (Red) Dies
Unit - A unit owned by Player 7 (Red) Dies

~ Conditions ~
((Dying unit) is (A Hero) equal to True

And that's it.

I know I'd have to count units owned by players one through seven some how as a total, and if it were to equal 0 then defeat them all. I'm not sure how to do this though.
 

Exide

I am amazingly focused right now!
Reaction score
448
If your enemy/computer players doesn't have a Hero you can do this:

Trigger:
  • Untitled Trigger 001
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set DefeatGroup = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in DefeatGroup) Equal to 0
        • Then - Actions
          • -------- Defeat Players Here.. --------
        • Else - Actions
      • Custom script: call DestroyGroup(udg_DefeatGroup)


You can also create this group at the start of the game, like this:

Trigger:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Add Paladin 0000 <gen> to DefeatGroup
      • Unit Group - Add Archmage 0001 <gen> to DefeatGroup
      • Unit Group - Add Mountain King 0002 <gen> to DefeatGroup
      • Unit Group - Add Blood Mage 0003 <gen> to DefeatGroup


Trigger:
  • Untitled Trigger 001
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Number of units in DefeatGroup) Equal to 0
    • Actions
      • -------- Defeat Players Here.. --------


You can do it in lots of ways. It depends on your map.
 

Azlier

Old World Ghost
Reaction score
461
I'm quite sure that heroes aren't cleaned from unit groups on death.
 

Pyroflame

New Member
Reaction score
4
Thanks, but there is one computer, which has 4 heros to be exact.

Each player chooses from one of twelve custom heros at the start of the game, from taverns. And the only reason I checked to see if the dying unit was a hero, was becuase some heros have summons.

But I do see what you were doing with the Unit Groups. So maybe perhaps when a player purchases his hero I would need to add (purchased unit) to the unit group? Then if the player decides to -repick, I would have to remove it? Or again, when the hero dies, it would get removed from the group. And when the group hits 0, game over?
 

Exide

I am amazingly focused right now!
Reaction score
448
Like I said: You can do this in tons of different ways, it depends on your map.
In order to help you further, with a more detailed trigger, I need to see your triggers for chosing heroes. -So that you can assign them to variables.

I, personally, always create a unit array variable named Hero. Then set Hero[*Player number*] = *unit*.
-That way I always know where to get a certain unit.

I suggest you do something similar, then use a loop to add these units into a unit group. Then you can use my trigger in post #2 of this thread.
 

HydraRancher

Truth begins in lies
Reaction score
197
You could do:
Trigger:
  • Defeat
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
      • Unit - A unit owned by Player 2 (Red) Dies
      • Unit - A unit owned by Player 3 (Red) Dies
      • Unit - A unit owned by Player 4 (Red) Dies
      • Unit - A unit owned by Player 5 (Red) Dies
      • Unit - A unit owned by Player 6 (Red) Dies
      • Unit - A unit owned by Player 7 (Red) Dies
    • Conditions
      • (Dying unit) is (A Hero) equal to True
    • Actions
      • For each integer A from 1 to 7 do actions
        • Defeat Player(Integer A) with message You Fail

if I understand what you want
 

Pyroflame

New Member
Reaction score
4
You could do:
Trigger:
  • Defeat
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
      • Unit - A unit owned by Player 2 (Red) Dies
      • Unit - A unit owned by Player 3 (Red) Dies
      • Unit - A unit owned by Player 4 (Red) Dies
      • Unit - A unit owned by Player 5 (Red) Dies
      • Unit - A unit owned by Player 6 (Red) Dies
      • Unit - A unit owned by Player 7 (Red) Dies
    • Conditions
      • (Dying unit) is (A Hero) equal to True
    • Actions
      • For each integer A from 1 to 7 do actions
        • Defeat Player(Integer A) with message You Fail

if I understand what you want

Not quite, wanted it to only defeat everyone after everyone is dead. I'll look into what exide said.
 
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