• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Trigger Help

Status
Not open for further replies.
Level 13
Joined
Sep 24, 2007
Messages
1,023
this is the trigger for changing the color of a unit and moving it to another region heres the trigger
Untitled Trigger 001
  • Events
    • Time - Elapsed game time is 5.00 seconds
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Red Blood Cell
    • Actions
      • Unit Group - Pick every unit in (Units in right foot <gen>) and do (Actions)
        • Loop - Actions
      • Unit - Change color of (Triggering unit) to (Color of Player 2 (Blue))
      • Unit - Order (Picked unit) to Move To (Center of right ankel to right hip <gen>)
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
  • Move Blue Blood Cells :D
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in right foot <gen>) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Blood Cell
            • Then - Actions
              • Unit - Change color of (Picked unit) to (Color of Player 2 (Blue))
              • Unit - Order (Picked unit) to Move To (Center of right ankel to right hip <gen>)
            • Else - Actions
Done. :) Enjoy.
 
Level 13
Joined
Sep 24, 2007
Messages
1,023
this isnt working
  • right foot to ankel
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in right foot <gen>) and do (Actions)
        • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Picked unit)) Equal to Red Blood Cell
        • Then - Actions
          • Unit - Change color of (Picked unit) to (Color of Player 2 (Blue))
          • Unit - Order (Picked unit) to Move To (Center of right ankel to right hip <gen>)
        • Else - Actions
 
Level 5
Joined
Jul 11, 2007
Messages
152
Your problem is that the actions aren't lining up correctly.
Here's what you have:

  • right foot to ankel
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in right foot <gen>) and do (Actions)
        • Loop - Actions
      • **If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Picked unit)) Equal to Red Blood Cell
        • Then - Actions
          • Unit - Change color of (Picked unit) to (Color of Player 2 (Blue))
          • Unit - Order (Picked unit) to Move To (Center of right ankel to right hip <gen>)
        • Else - Actions
Check out the **
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
It is not being looped because it is not under the Loop - Actions category.
Although it is below the trigger it is not within that part of the trigger.
I hope that makes sense yea?
 
Level 5
Joined
Jul 11, 2007
Messages
152
  • Move Blue Blood Cells Correctly
    • Unit Group - Pick every unit in (Units in right foot <gen>) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)

  • Move Blue Blood Cells Almost
    • Unit Group - Pick every unit in (Units in right foot <gen>) and do (Actions)
      • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
There's the comparison. Redmarine you had it in the loop so it would work correctly, Gallin was off by just a line when he was looking at yours so that's why his wouldn't loop or work.

So here's what you want Gallin

  • Move Blue Blood Cells Correctly
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in right foot <gen>) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Blood Cell
            • Then - Actions
              • Unit - Change color of (Picked unit) to (Color of Player 2 (Blue))
              • Unit - Order (Picked unit) to Move To (Center of right ankel to right hip <gen>)
            • Else - Actions
 
Level 22
Joined
Feb 26, 2008
Messages
891
The code needs to be indented under where it says Loop - Actions.
What you have is that the unit group loop loops through, but does nothing, then, after it's finished, it goes down to the next action in list (the if statement) and executes it once.

You need to make it such that the unit group loop executes that if statement in the loop itself.
 
Level 5
Joined
Jul 11, 2007
Messages
152
  • Move Blue Blood Cells Correctly
    • Unit Group - Pick every unit in (Units in right foot <gen>) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)

  • Move Blue Blood Cells Almost
    • Unit Group - Pick every unit in (Units in right foot <gen>) and do (Actions)
      • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Here's the difference for you via the triggers, as said before the IF part needs to be within the Loop -Actions.
 
Level 13
Joined
Sep 24, 2007
Messages
1,023
would this work
  • right foot to ankel
  • Events
    • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (right foot)) and do (If ((Unit-type of (Picked unit)) Equal to Red Blood Cell) then do (Unit - Order (Picked unit) to Move To (Center of right ankel to right hip <gen>)) else do (Do nothing))
 
Level 22
Joined
Feb 26, 2008
Messages
891
Click and hold down on the If function.
Then move it up little by little.
You should see a gray bar show up as you move it upward.
Maneuver this gray bar so that it is indented under the Loop - Actions heading.
Then release the mouse.

See if you can get it.
(The bar may be black or so. It's not necessarily uniform.)
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
Just type (Ctrl + X or C) on your if/the/else function. Highlight the loop and press (Ctrl + V). Voila! that should take care of it.
And no! if you try to do that within the group trigger it most be matching unit. Not picking.
 
Status
Not open for further replies.
Top