• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Make gate open when certain number of unit killed

Status
Not open for further replies.
Level 2
Joined
Sep 20, 2016
Messages
10
first of all, I'm new...
I learn how to make a gate open when a unit is killed
but now I want to make it so all the unit must get killed and the gate will open
when you kill all the guard then the gate will open, the gate wont open if you kill only 1 unit

I make it simple like this but it doesn't work. and I do not know how to find help on google

*oh I forgot, can someone tell me how to post picture on forum?*
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,178
I make it simple like this but it doesn't work.
Which is to be expected as what it does is not what you want it to do.

Add conditions to check if all the units are dead. The condition block operates in "and" mode so you will want 3 separate conditions in it which do something functionally like the pseudo code "Xis dead" where X is replaced with each of the units.

Depending on how/where the units are there may be more elegant, more generic solutions which avoid hardcoding units.
 
Level 2
Joined
Sep 20, 2016
Messages
10
Which is to be expected as what it does is not what you want it to do.

Add conditions to check if all the units are dead. The condition block operates in "and" mode so you will want 3 separate conditions in it which do something functionally like the pseudo code "Xis dead" where X is replaced with each of the units.

Depending on how/where the units are there may be more elegant, more generic solutions which avoid hardcoding units.

so I make it kinda like "A and B, A and C, B and C" condition?
which condition type should I chose?
 
Level 2
Joined
Sep 20, 2016
Messages
10
thanks, now I understand the condition stuff
  • Untitled Trigger 001
    • Events
      • Unit - Gnoll 0006 <gen> Dies
      • Unit - Gnoll Overseer 0004 <gen> Dies
    • Conditions
      • (Gnoll Overseer 0004 <gen> is dead) Equal to (Gnoll 0006 <gen> is dead)
    • Actions
      • Destructible - Open Iron Gate (Horizontal) 0000 <gen>
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,178
(Gnoll Overseer 0004 <gen> is dead) Equal to (Gnoll 0006 <gen> is dead)
Surely you meant "(Gnoll Overseer 0004 <gen> is dead) Equal to (True)"? With the condition repeated for each unit you want dead.

Conditions block can have any number of conditions under it, similar to Events and Actions. All such conditions are automatically subjected to logical and.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Even if you were to change the condition to "(Gnoll Overseer 0004 <gen> is dead) Equal to (True)," I don't see the purpose of it if the event runs off the event of that specific unit dying. It will also run prematurely if Gnoll Overseer 0004 were to die first, but Gnoll 0006 isstill alive. I would just do something like this:

  • Open Gate
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Gnoll 0005 <gen> is dead) Equal to True
      • (Gnoll 0006 <gen> is dead) Equal to True
      • (Gnoll Overseer 0004 <gen> is dead) Equal to True
    • Actions
      • Destructible - Open Iron Gate (Horizontal) 0000 <gen>
      • Trigger - Turn off Open Gate
 
Level 2
Joined
Sep 20, 2016
Messages
10
Even if you were to change the condition to "(Gnoll Overseer 0004 <gen> is dead) Equal to (True)," I don't see the purpose of it if the event runs off the event of that specific unit dying. It will also run prematurely if Gnoll Overseer 0004 were to die first, but Gnoll 0006 isstill alive. I would just do something like this:

  • Open Gate
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Gnoll 0005 <gen> is dead) Equal to True
      • (Gnoll 0006 <gen> is dead) Equal to True
      • (Gnoll Overseer 0004 <gen> is dead) Equal to True
    • Actions
      • Destructible - Open Iron Gate (Horizontal) 0000 <gen>
      • Trigger - Turn off Open Gate

so if I use that trigger, it will checked all the unit on map that died and then making it sure that only "gnoll" unit that count to open the gate right?
does it more buggy? like if I kill that same type of unit but on different section on the map and the gate will open too?
if I use specified unit, do the world editor only chose that specified unit or still counting for duplicate unit? or every unit on the map have it own id?
sorry for bad grammar, cmiiw
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
it will checked all the unit on map that died and then making it sure that only "gnoll" unit that count to open the gate right?
No. Whenever a unit dies, it checks to see if Gnoll 0005, 0006, and Overseer 0004 are all dead before opening the gate.

does it more buggy? like if I kill that same type of unit but on different section on the map and the gate will open too?
No because Gnoll 0005, 0006, and 0004 are all variables assigned specifically to the 3 preplaced units in your map.
 
Status
Not open for further replies.
Top