• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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