• 🏆 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] Leak?Can it be done better?

Status
Not open for further replies.
Level 8
Joined
Apr 23, 2011
Messages
322
Are these 2 triggers ok, efficiant, etc.

  • Food rot
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in Food no rot <gen> and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Picked item)) Equal to Chicken Meat
            • Then - Actions
              • Item - Set life of (Picked item) to ((Current life of (Picked item)) - 1.00)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Picked item)) Equal to Pig Meat
                • Then - Actions
                  • Item - Set life of (Picked item) to ((Current life of (Picked item)) - 1.00)
                • Else - Actions
  • Food dies
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Picked item)) Equal to Chicken Meat
              • ((Picked item) is in Food no rot <gen>) Equal to False
            • Then - Actions
              • Item - Remove (Picked item)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Picked item)) Equal to Pig Meat
                  • ((Picked item) is in Food no rot <gen>) Equal to False
                • Then - Actions
                  • Item - Remove (Picked item)
                • Else - Actions
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
you can merge the conditions in the first trigger to one if statement, because you are doing the same action, just put there or condition and put both of them in there

the same goes for the second one, you can merge it

other then that, I see no problems or leaks, because afaik item enuming doesnt leak
 
Status
Not open for further replies.
Top