• 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] GUI Whole Map Unit Group Check

Status
Not open for further replies.
Level 4
Joined
Aug 16, 2013
Messages
80
(GUI preferably, just so I can edit it myself, I don't know how to code jass.)

Hi everybody, I have this trigger that I have been trying to create but its not working at all. The trigger pretty much checks the whole map, assigns different types of crops into a unit group, and then uses an If statement to check every singular crop. If the crop has 100 health, that crop will receive 1 mana(and will be damaged by 20). If not, then that crop will not get the 1 mana, and will still get damaged for 20.


Once the crop has reached full mana, it will be removed and drop a fruit(certain types of crops will not be removed, they will drop a fruit and have its mana go down to 0.)

The problem is, is that I can't get it to work, on top of that there're multiple types of crops that will be checked to see if they have 100 health. Also, each crop has a different amount of max mana.

Example:

Turnips = 6 max mana
Strawberries = 4 max mana (Strawberries can be regrown, so they will not be removed but will have their mana reset to 0.)




  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Turnip Crop))
      • Set Temp_Crop_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Strawberry Crop))
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Picked unit)) Equal to 100.00
            • Then - Actions
              • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 1.00)
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 20.00)
              • Trigger - Turn on Fruits Check <gen>
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Life of (Picked unit)) Not equal to 100.00
                • Then - Actions
                  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 20.00)
                • Else - Actions

  • Fruits Check
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Max mana of (Picked unit)) Equal to 6.00
              • (Mana of (Picked unit)) Equal to 6.00
            • Then - Actions
              • Hero - Create Turnip Seed and give it to (Picked unit)
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Max mana of (Picked unit)) Equal to 4.00
                  • (Mana of (Picked unit)) Equal to 4.00
                • Then - Actions
                  • Hero - Create Strawberry Seed and give it to (Picked unit)
                  • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 4.00)
                • Else - Actions
                  • Trigger - Turn off (This trigger)
I'm using seeds instead of fruits being dropped right now, I was going to replace them later.
 
Last edited:
Level 13
Joined
Mar 24, 2013
Messages
1,105
1st of all unit groups are not additive, you cannot set it to all the turnips then set it to all strawberries. It will be set to just the strawberries right now. Just add them all to the group on 1 line. Also I think your Fruit Check trigger should have no periodic timer and just run it every 10 seconds. Although I'm not really understanding it, seems to me that its turned on, checks to see if the Turnips mana == 6 then if it is give it an item then remove it from the game? I'm sure the item is going with it. Also it seems that you're not separating the seeds by the picked units type, so Turnip seeds would actually be creating strawberry seeds, however the item is being instantly removed so you aren't seeing that atm. (also if the unit doesn't have an inventory I guess the item just disappears idk) Heres some pseudo, on my way to bed. also why are you slowly killing its hp, but never reference it anywhere?

  • Crops Check
  • Events
  • Time - Every 10.00 seconds of game time
  • Conditions
  • Actions
  • Set Temp_Crop_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Turnip Crop)) or matching ((Unit-type of (Matching unit)) Equal to Strawberry Crop))
  • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
  • Loop - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Life of (Picked unit)) Less than or Equal to 100.00
  • Then - Actions
  • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 1.00)
  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 20.00)
  • Run Fruits Check <gen>
    • Else - Actions
  • Fruits Check
  • Events
  • Conditions
  • Actions
  • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
  • Loop - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Mana of (Picked unit)) Equal to 6.00
  • Unit type of Matching Unit == Turnip
    • Then - Actions
    • Set TempPoint == Position of Picked Unit
    • Create Turnip seed at TempPoint
    • Unit - Remove (Picked unit) from the game
  • call RemoveLocation(udg_TempPoint)
    • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Mana of (Picked unit)) Equal to 4.00
  • Unit type of Matching Unit == Strawberry
    • Then - Actions
    • Set TempPoint == Position of Picked Unit
    • Create Strawberry seed at TempPoint
  • call RemoveLocation(udg_TempPoint)
    • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 4.00)
    • Else - Actions
  • call DestroyGroup(Temp_Crop_Something)
 
Level 4
Joined
Aug 16, 2013
Messages
80
Okay, I'll try this.

I was hoping the item given to the crop would just drop near the crop, since the crop wouldn't have an inventory. Also, the reason why the crop gets damaged is because the players in the map will have to heal the plants with an AOE healing spray, that's the whole reason why it needs to be at 100 Health. The healing spray heals 100 health, in this case, waters the plant, and by the end of the day, the plant will receive 1 mana if that plant has 100 health(I will be changing the periodic time to like, 180-240 minutes or something, pretty much when a day passes by.)

Edit: The mana of the crops instantly go up to max mana in 10 seconds, they don't increment by 1 mana. Also, once they're at max mana, the seed doesn't spawn at all. The crop however does get hurt for 20 health every 10 seconds. The strawberry plant doesn't have its mana returned back to 0.




This is what I have down.


  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Turnip Crop) or ((Unit-type of (Matching unit)) Equal to Strawberry Crop)))
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Picked unit)) Less than or equal to 100.00
            • Then - Actions
              • Unit - Set mana of (Picked unit) to ((Life of (Picked unit)) + 1.00)
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 20.00)
              • Trigger - Run Fruits Check <gen> (checking conditions)
            • Else - Actions


  • Fruits Check
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of (Picked unit)) Equal to 6.00
              • (Unit-type of (Matching unit)) Equal to Turnip Crop
            • Then - Actions
              • Custom script: call RemoveLocation(udg_Temp_Point_Fruit_Spawn)
              • Set Temp_Point_Fruit_Spawn = (Position of (Picked unit))
              • Item - Create Turnip Seed at Temp_Point_Fruit_Spawn
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of (Picked unit)) Equal to 4.00
                  • (Unit-type of (Matching unit)) Equal to Strawberry Crop
                • Then - Actions
                  • Set Temp_Point_Fruit_Spawn = (Position of (Picked unit))
                  • Item - Create Strawberry Seed at Temp_Point_Fruit_Spawn
                  • Custom script: call RemoveLocation(udg_Temp_Point_Fruit_Spawn)
                  • Unit - Set mana of (Picked unit) to ((Life of (Picked unit)) - 4.00)
                • Else - Actions
 
Last edited:
Level 4
Joined
Aug 16, 2013
Messages
80
It's still the same result(unless if I'm doing something wrong), the unit gains full mana in 10 seconds and is damaged for 20. I also tried replacing the Crops Check picked units to the variable and the trigger doesn't execute after that.

I put the picked unit in a unit variable.

  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Turnip Crop) or ((Unit-type of (Matching unit)) Equal to Strawberry Crop)))
      • Set Crop_Picked_Unit = (Picked unit)
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Picked unit)) Less than or equal to 100.00
            • Then - Actions
              • Unit - Set mana of (Picked unit) to ((Life of (Picked unit)) + 1.00)
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 20.00)
              • Trigger - Run Fruits Check <gen> (checking conditions)
            • Else - Actions
And replaced the picked units in Fruits Check with the unit variable.

  • Fruits Check
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of Crop_Picked_Unit) Equal to 6.00
              • (Unit-type of Crop_Picked_Unit) Equal to Turnip Crop
            • Then - Actions
              • Custom script: call RemoveLocation(udg_Temp_Point_Fruit_Spawn)
              • Set Temp_Point_Fruit_Spawn = (Position of Crop_Picked_Unit)
              • Item - Create Turnip Seed at Temp_Point_Fruit_Spawn
              • Unit - Remove Crop_Picked_Unit from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of Crop_Picked_Unit) Equal to 4.00
                  • (Unit-type of Crop_Picked_Unit) Equal to Strawberry Crop
                • Then - Actions
                  • Set Temp_Point_Fruit_Spawn = (Position of Crop_Picked_Unit)
                  • Item - Create Strawberry Seed at Temp_Point_Fruit_Spawn
                  • Custom script: call RemoveLocation(udg_Temp_Point_Fruit_Spawn)
                  • Unit - Set mana of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 4.00)
                • Else - Actions
 
Last edited:
change these also.
  • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
  • Loop - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Life of (Picked unit)) Less than or equal to 100.00
  • Then - Actions
  • Unit - Set mana of (Picked unit) to ((Life of (Picked unit)) + 1.00)
  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 20.00)
put some game messages in there to see what is and isn't working.
If you don't know what i mean then go to the debugging chapter in my tutorial things a guier should know.
 
Level 4
Joined
Aug 16, 2013
Messages
80
Okay, this is what I came up with.

  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Turnip Crop) or ((Unit-type of (Matching unit)) Equal to Strawberry Crop)))
      • Set Crop_Picked_Unit = (Picked unit)
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of Crop_Picked_Unit) Less than or equal to 100.00
            • Then - Actions
              • Game - Display to (All players) the text: (String((Life of Crop_Picked_Unit)))
              • Game - Display to (All players) the text: (String((Mana of Crop_Picked_Unit)))
              • Unit - Set mana of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) + 1.00)
              • Unit - Set life of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 20.00)
              • Trigger - Run Fruits Check <gen> (checking conditions)
            • Else - Actions
  • Fruits Check
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Test 1
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of Crop_Picked_Unit) Equal to 6.00
              • (Unit-type of Crop_Picked_Unit) Equal to Turnip Crop
            • Then - Actions
              • Custom script: call RemoveLocation(udg_Temp_Point_Fruit_Spawn)
              • Set Temp_Point_Fruit_Spawn = (Position of Crop_Picked_Unit)
              • Item - Create Turnip Seed at Temp_Point_Fruit_Spawn
              • Unit - Remove Crop_Picked_Unit from the game
              • Game - Display to (All players) the text: Test 2
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of Crop_Picked_Unit) Equal to 4.00
                  • (Unit-type of Crop_Picked_Unit) Equal to Strawberry Crop
                • Then - Actions
                  • Set Temp_Point_Fruit_Spawn = (Position of Crop_Picked_Unit)
                  • Item - Create Strawberry Seed at Temp_Point_Fruit_Spawn
                  • Custom script: call RemoveLocation(udg_Temp_Point_Fruit_Spawn)
                  • Unit - Set mana of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 4.00)
                  • Game - Display to (All players) the text: Test 3
                • Else - Actions
Images below is what happened in-game.

The unit variable, Crop_Picked_Unit returns a value of 0.000 for both Health and Mana.
 
Last edited:
Level 4
Joined
Aug 16, 2013
Messages
80
Yeah my bad, they're fixed now.

It's just test 1 is executing, forgot to delete a test 2 in the Crops Trigger.


  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Turnip Crop) or ((Unit-type of (Matching unit)) Equal to Strawberry Crop)))
      • Set Crop_Picked_Unit = (Picked unit)
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of Crop_Picked_Unit) Less than or equal to 100.00
            • Then - Actions
              • Game - Display to (All players) the text: (String((Life of Crop_Picked_Unit)))
              • Game - Display to (All players) the text: (String((Mana of Crop_Picked_Unit)))
              • Unit - Set mana of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) + 1.00)
              • Unit - Set life of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 20.00)
              • Trigger - Run Fruits Check <gen> (checking conditions)
            • Else - Actions
  • Fruits Check
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Test 1
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of Crop_Picked_Unit) Equal to 6.00
              • (Unit-type of Crop_Picked_Unit) Equal to Turnip Crop
            • Then - Actions
              • Custom script: call RemoveLocation(udg_Temp_Point_Fruit_Spawn)
              • Set Temp_Point_Fruit_Spawn = (Position of Crop_Picked_Unit)
              • Item - Create Turnip Seed at Temp_Point_Fruit_Spawn
              • Unit - Remove Crop_Picked_Unit from the game
              • Game - Display to (All players) the text: Test 2
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of Crop_Picked_Unit) Equal to 4.00
                  • (Unit-type of Crop_Picked_Unit) Equal to Strawberry Crop
                • Then - Actions
                  • Set Temp_Point_Fruit_Spawn = (Position of Crop_Picked_Unit)
                  • Item - Create Strawberry Seed at Temp_Point_Fruit_Spawn
                  • Custom script: call RemoveLocation(udg_Temp_Point_Fruit_Spawn)
                  • Unit - Set mana of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 4.00)
                  • Game - Display to (All players) the text: Test 3
                • Else - Actions
 

Attachments

  • Trigger 4.png
    Trigger 4.png
    920 KB · Views: 79
Last edited:
Level 4
Joined
Aug 16, 2013
Messages
80
No, test 1 is the only message that's working in the Fruits Check trigger.

Crop_Picked_Unit displays a message of 0.000 Health and Mana.
 
Level 4
Joined
Aug 16, 2013
Messages
80
Ah I see.

But the trigger of how the plants get 1 mana if they have 100 health or lower isn't how its suppose to be.

The trigger should only work if the plant has equal to 100 health, no more or no less. Then the plant will get the 1 mana. Because, players in game will have to water the crops with an AOE healing spray.

So I'm not sure because of this, can the 2 triggers still be combined.

Because some players crops will not be at full health when the day is over(theirs will be damaged by 20), and some players crops will be at full health(but will get 1 mana, and be damaged for 20.)
 
Level 4
Joined
Aug 16, 2013
Messages
80
Every plant has 100 HP max, the healing spray does a 100 HP heal which makes the plants at max health again.



So you see, this is what would happen..

Day 1

Player waters crop which heals the crop to max health, 100.

Day 1 Ends and the crop gets 1 mana, as well as the crop gets damaged for 20.

Day 2

Player waters crop, which then makes the crop at 100 HP, which is at max HP.

Day 2 ends, the watered crops gain 1 mana, and will be damaged for 20.





I pretty much planned this out and it should work properly.

Each day is on a periodic timer which is 240 seconds.

But crops who don't have max health, which is 100, will not get that 1 mana.
 
Level 4
Joined
Aug 16, 2013
Messages
80
Yeah I did, this should have checked it. When I go in-game, the results are 0.000 health, and 0.000 mana.

  • Game - Display to (All players) the text: (String((Life of Crop_Picked_Unit)))
    • Game - Display to (All players) the text: (String((Mana of Crop_Picked_Unit)))

This was a part of the "Crops Check" Trigger. Just below this display message, the crops get damaged and get the 1 mana.
 
Last edited:
Level 4
Joined
Aug 16, 2013
Messages
80
  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Turnip Crop) or ((Unit-type of (Matching unit)) Equal to Strawberry Crop)))
      • Set Crop_Picked_Unit = (Picked unit)
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of Crop_Picked_Unit) Equal to 100.00
            • Then - Actions
              • Game - Display to (All players) the text: (String((Life of Crop_Picked_Unit)))
              • Game - Display to (All players) the text: (String((Mana of Crop_Picked_Unit)))
              • Unit - Set mana of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) + 1.00)
              • Unit - Set life of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 20.00)
              • Trigger - Run Fruits Check <gen> (checking conditions)
            • Else - Actions
 
  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Turnip Crop) or ((Unit-type of (Matching unit)) Equal to Strawberry Crop)))
      • Set Crop_Picked_Unit = (Picked unit)
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of Crop_Picked_Unit) Equal to 100.00
            • Then - Actions
              • Game - Display to (All players) the text: (String((Life of Crop_Picked_Unit)))
              • Game - Display to (All players) the text: (String((Mana of Crop_Picked_Unit)))
              • Unit - Set mana of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) + 1.00)
              • Unit - Set life of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 20.00)
              • Trigger - Run Fruits Check <gen> (checking conditions)
            • Else - Actions


Change it to this....

  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Turnip Crop) or ((Unit-type of (Matching unit)) Equal to Strawberry Crop)))
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Set Crop_Picked_Unit = (Picked unit)
            • If - Conditions
              • (Life of Crop_Picked_Unit) Equal to 100.00
            • Then - Actions
              • Game - Display to (All players) the text: (String((Life of Crop_Picked_Unit)))
              • Game - Display to (All players) the text: (String((Mana of Crop_Picked_Unit)))
              • Unit - Set mana of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) + 1.00)
              • Unit - Set life of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 20.00)
              • Trigger - Run Fruits Check <gen> (checking conditions)
            • Else - Actions
 
Level 4
Joined
Aug 16, 2013
Messages
80
  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Turnip Crop) or ((Unit-type of (Matching unit)) Equal to Strawberry Crop)))
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of Crop_Picked_Unit) Equal to 100.00
            • Then - Actions
              • Game - Display to (All players) the text: (String((Life of Crop_Picked_Unit)))
              • Game - Display to (All players) the text: (String((Mana of Crop_Picked_Unit)))
              • Unit - Set mana of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) + 1.00)
              • Unit - Set life of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 20.00)
              • Trigger - Run Fruits Check <gen> (checking conditions)
            • Else - Actions
          • Set Crop_Picked_Unit = (Picked unit)
Nothing happens, the display message doesn't even appear in-game.
 
Level 4
Joined
Aug 16, 2013
Messages
80
It wouldn't allow me to put it under
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)

It redirects under the Else, but isn't actually under the else.

Unless if I did something wrong, because I tried to put it under the
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
and it wouldn't let me, it redirects.
 
Level 4
Joined
Aug 16, 2013
Messages
80
Nothing happens, the debug codes aren't being executed either.

  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Turnip Crop) or ((Unit-type of (Matching unit)) Equal to Strawberry Crop)))
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • Set Crop_Picked_Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of Crop_Picked_Unit) Equal to 100.00
            • Then - Actions
              • Game - Display to (All players) the text: (String((Life of Crop_Picked_Unit)))
              • Game - Display to (All players) the text: (String((Mana of Crop_Picked_Unit)))
              • Unit - Set mana of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) + 1.00)
              • Unit - Set life of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 20.00)
              • Trigger - Run Fruits Check <gen> (checking conditions)
            • Else - Actions

The plants are constructed units, so once the plant is done constructing, could that plant just be placed into a integer(certain constructed units, not all constructed units, like for example a house wouldn't be included in this integer), and then after 240 seconds give 1 mana to each constructed unit in that integer as long as it has 100 HP?

It might result in the same problem we're having now, I'm not sure.
 
Level 4
Joined
Aug 16, 2013
Messages
80
I got it to work! Finally.. omg after days of stressing over this it works out perfectly.. I had major errors, I over sought a couple of things which you told me to fix. The whole reason why it wouldn't execute is because you gotta let the crop get damaged first, and then heal it, and etc.. it gets mana and all.

The crops will get damaged for 20 but don't receive the 1 mana until AFTER the next 10 seconds(the 2nd time the periodic trigger executes) go by and you heal them.

Day goes by and crops -20 health.

You heal them, and then another day goes by and they get 1 mana and -20 health.

You need to have the crop to have max mana, but you'll have to let a day go by for when it has max mana, because if a crop has 100 health and max mana then the crop will not drop the seed. So you have to wait(when it has max mana) and not heal the crop for the seed to drop.

Thank you so much, you helped me a lot with this.

Well, here it is.

  • Crops Check
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Crop_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Turnip Crop) or ((Unit-type of (Matching unit)) Equal to Strawberry Crop)))
      • Unit Group - Pick every unit in Temp_Crop_Group and do (Actions)
        • Loop - Actions
          • Set Crop_Picked_Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of Crop_Picked_Unit) Equal to 100.00
            • Then - Actions
              • Game - Display to (All players) the text: (String((Life of Crop_Picked_Unit)))
              • Game - Display to (All players) the text: (String((Mana of Crop_Picked_Unit)))
              • Unit - Set mana of Crop_Picked_Unit to ((Mana of Crop_Picked_Unit) + 1.00)
              • Unit - Set life of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 20.00)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of Crop_Picked_Unit) Equal to 6.00
                  • (Unit-type of Crop_Picked_Unit) Equal to Turnip Crop
                • Then - Actions
                  • Custom script: call RemoveLocation(udg_Temp_Point_Fruit_Spawn)
                  • Set Temp_Point_Fruit_Spawn = (Position of Crop_Picked_Unit)
                  • Item - Create Turnip Seed at Temp_Point_Fruit_Spawn
                  • Unit - Remove Crop_Picked_Unit from the game
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Mana of Crop_Picked_Unit) Equal to 4.00
                      • (Unit-type of Crop_Picked_Unit) Equal to Strawberry Crop
                    • Then - Actions
                      • Set Temp_Point_Fruit_Spawn = (Position of Crop_Picked_Unit)
                      • Item - Create Strawberry Seed at Temp_Point_Fruit_Spawn
                      • Custom script: call RemoveLocation(udg_Temp_Point_Fruit_Spawn)
                      • Unit - Set mana of Crop_Picked_Unit to ((Mana of Crop_Picked_Unit) - 4.00)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Life of Crop_Picked_Unit) Less than 100.00
                        • Then - Actions
                          • Unit - Set life of Crop_Picked_Unit to ((Life of Crop_Picked_Unit) - 20.00)
                        • Else - Actions
Best farming system I have seen / help make.
 
Status
Not open for further replies.
Top