Unitgroup dead= trigger

BruteBrutal

New Member
Reaction score
1
Hey,

Want the next gate to open when all spawned or created creeps in a region is dead.

At the moment the trigger is only bound to the type of creep killed that works too, but I'd prefer to use the region.

Second of all the trigger open the gate everytime ONE unit dies. Not as it should be when the LAST one dies.

What am I doing wrong here. Can't figure out what the condition should be. Variable +1?

Looks like this at the moment, which is way off...

Trigger:
  • Gates Copy 2
    • Events
      • Unit - A unit Dies
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Attacked unit) is in (Units in 1lvl <gen>)) Equal to True
          • 1enemy Equal to (Unit-type of (Attacked unit))
    • Actions
      • Destructible - Open Elven Gate (Vertical) 0004 <gen>
 

Tawnttoo

New Member
Reaction score
36
Trigger:
  • Dead
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Units lvl 1 <gen> contains (Triggering unit)) Equal to True
    • Actions
      • Set TempGroup = (Units in (Units lvl 1))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempGroup) Equal to 0
            • Then - Actions
              • Destructible - Open Elven Gate (Vertical) 0004 <gen>
            • Else - Actions
      • Custom script: call DestroyGroup (udg_TempGroup)
 

X-maul

AKA: Demtrod
Reaction score
201
Trigger:
  • Gate
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set TempGroup = (Units in No region owned by Neutral Hostile)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Equal to 0
        • Then - Actions
          • Destructible - Open No destructible
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)

Use this trigger.

OFFTOPIC:
Trigger:
  • Dead
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Units lvl 1 <gen> contains (Triggering unit)) Equal to True
    • Actions
      • Set TempGroup = (Units in (Units lvl 1))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempGroup) Equal to 0
            • Then - Actions
              • Destructible - Open Elven Gate (Vertical) 0004 <gen>
            • Else - Actions
      • Custom script: call DestroyGroup (udg_TempGroup)
why would you want to use a
Trigger:
  • Unit Group - Pick every unit in TempGroup and do (Actions)

??
you should use the if/then/else only
 

X-maul

AKA: Demtrod
Reaction score
201
uhmm - if you create a new action and press "I" the first thing apearing will be If/Then/Else :)
(in there you can put an condition, in this case it is an integer condition which checks number of units in a unit group)
- can make you a demo map if you need it?
 

BruteBrutal

New Member
Reaction score
1
i know that but what conditions that would trigger a group and then open the gate AFTER ALL is dead i cant find anywhere... so please.. a demo would be nice :)
 

X-maul

AKA: Demtrod
Reaction score
201
Ok, here you go - there is only 2 triggers in the map, and I've added comments to explain what they do.
 

Attachments

  • Gate.w3x
    13.6 KB · Views: 138

BruteBrutal

New Member
Reaction score
1
Very nice, thank you, now I get it, understand variables now too.

However the last part the custom script is unclear and i had to inactivate it

Trigger:
  • Custom script: call DestroyGroup(enemy_lvl1)


my variable= enemy_lvl1

what's wrong, and whats it for?
 

X-maul

AKA: Demtrod
Reaction score
201
you have to make it
Code:
Custom script: call DestroyGroup([COLOR="Red"]udg_[/COLOR]enemy_lvl1)
udg = user defined global - a global is someting you will get to know when you learn JASS - thats a variable you define in the editor...

anyway you just need to write udg_ when using custom script to clear it - and thats in every custom script.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top