• 🏆 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] Trigger Problem

Status
Not open for further replies.
  • Human Build Stables
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Blacksmith
      • (Unit-type of (Triggering unit)) Equal to Stables
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Human
                • Then - Actions
                  • Player - Limit training of Knight to -1 for (Picked player)
                • Else - Actions
            • Else - Actions
              • Do nothing
that doesn't work, even though I have blacksmith and stables.

  • Human Build Lumber Mill
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Lumber Mill
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Human
                • Then - Actions
                  • Player - Limit training of Blacksmith to -1 for (Picked player)
                  • Player - Limit training of Stables to -1 for (Picked player)
                  • Player - Limit training of Church to -1 for (Picked player)
                  • Player - Limit training of Archer to -1 for (Picked player)
                • Else - Actions
            • Else - Actions
              • Do nothing
but this works



What happened?
(I know it sucks, I also want it to be better :p)
 
Level 30
Joined
Sep 30, 2008
Messages
1,460
I believe its caused because the top trigger has 2 conditions.

In the current format, it requires both of them to be true in order for the trigger to work. So basically, its saying "if the triggering unit is the blacksmith and the stables", which just won't work :)

Just put the 2 conditions inside an "or condition" and it should work :)

Hopefully ^^
 
Level 30
Joined
Sep 30, 2008
Messages
1,460
well when or
it will show the knight even though the other building is not built

Right, I think I understand now :)

You will need to create a boolean variable for each building which will be set to "false" by default. They will need to be an array so you can set a different value for each player :) so something like blacksmith_built[] and stable_built[]

At the top of your trigger you will need to create a few new actions which sets the boolean variable to true once a building has been finished. For example:

Unit - A unit Finishes construction

If (unit type of triggering unit) is equal to blacksmith
set blacksmith_built[player number of (owner of triggering unit)] = true

If (unit type of triggering unit) is equal to stable
set stable_built[player number of (owner of triggering unit)] = true

Then, do a quick IF to check if they are both variables are set to true for the triggering player. If both are true, then both buildings must exist. Then add the rest of your triggers within this IF.

Again, make sure the first two conditions are part of an "of condition" or it won't work :p

hope this helps!
 
Level 5
Joined
May 3, 2009
Messages
129
  • Untitled Trigger 001
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • ((Owner of (Triggering unit)) slot status) Equal to Is playing
      • (Race of (Owner of (Triggering unit))) Equal to Human
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Blacksmith
              • (Number of units in (Units owned by (Owner of (Triggering unit)) of type Blacksmith)) Equal to 1
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to stables
              • (Number of units in (Units owned by (Owner of (Triggering unit)) of type Stables)) Equal to 1
        • Then - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Lumber Mill
        • Then - Actions
        • Else - Actions
ive done it like this so it will be all in one trigger
 
Level 5
Joined
May 3, 2009
Messages
129
well works fine or you can change the eqal to 1 to
  • (Number of units in (Units owned by (Owner of (Triggering unit)) of type Blacksmith)) Greater than or equal to 1
if you have more then 1 blacksmith


and remove your (do nothing)

it does nothing anyway
 
Status
Not open for further replies.
Top