SOLVED
Hey, I'm new here I thought you'd be able to help me out with this problem I have... I'm using GUI triggers.
Basically I want it to give all "Chicken House"s an egg every 15 seconds, but, if there's less than 6 eggs in an inventory slot, it should fill this up to 6 eggs (by adding 1 every 15 seconds), before giving an egg to a new spot. I tried to do it like this, and it seems to work sometimes, but sometimes it gets stuck with like, 3 spots with 6 eggs, and one with 3-4 eggs. Please help me out
For event I'm using a periodic timer.
Hey, I'm new here I thought you'd be able to help me out with this problem I have... I'm using GUI triggers.
Basically I want it to give all "Chicken House"s an egg every 15 seconds, but, if there's less than 6 eggs in an inventory slot, it should fill this up to 6 eggs (by adding 1 every 15 seconds), before giving an egg to a new spot. I tried to do it like this, and it seems to work sometimes, but sometimes it gets stuck with like, 3 spots with 6 eggs, and one with 3-4 eggs. Please help me out
For event I'm using a periodic timer.
Trigger:
- Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User))) and do (Actions)
- Loop - Actions
- -------- Eggs --------
- Unit Group - Pick every unit in (Units owned by (Picked player) matching ((Unit-type of (Matching unit)) Equal to Chicken House)) and do (Actions)
- Loop - Actions
- Set done = False
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Life of (Picked unit)) Equal to (Max life of (Picked unit))
- Then - Actions
- For each (Integer B) from 1 to 2, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Integer B) Equal to 1
- Then - Actions
- For each (Integer A) from 1 to 6, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Item-type of (Item carried by (Picked unit) in slot (Integer A))) Equal to Egg) and ((Charges remaining in (Item carried by (Picked unit) in slot (Integer A))) Less than 6)
- Then - Actions
- Item - Set charges remaining in (Item carried by (Picked unit) in slot (Integer A)) to ((Charges remaining in (Item carried by (Picked unit) in slot (Integer A))) + 1)
- Set done = True
- Custom script: exitwhen true
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- For each (Integer A) from 1 to 6, do (Actions)
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Number of items carried by (Picked unit)) Less than 6) and (done Equal to False)
- Then - Actions
- Item - Create Egg at (Position of (Picked unit))
- Unit - Order (Picked unit) to Right-Click (Last created item)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- For each (Integer B) from 1 to 2, do (Actions)
- Else - Actions
- If - Conditions
- Loop - Actions
- -------- ------ --------
- Loop - Actions