• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Alternative for my resource system please..

Status
Not open for further replies.
Level 9
Joined
Jul 20, 2009
Messages
427
I came up with this resource system,which allows me to order units to harvest crops and check if item charge of crop it has is of certain amount then automatically delivers them to the nearest farm..I'm no expert when it comes to triggering so basically I need someone who could help me make a revised version of my triggers,a more efficient system than what I have..
Here's the triggers>(For sure first thing that will be noticed are the leaks,truth is I really have not tried to make this leakless coz what I intended to do is first try to make it work then fix the leaks)

  • harvestcrop Copy
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Citizen man1)) and do (Actions)
        • Loop - Actions
          • Set Unit = (Picked unit)
          • Set Tornado_Unit = No unit
          • Set Temp_Loc_1 = (Position of Unit)
          • Set Temp_Real_1 = 100000000.00
          • Set Temp_Group = (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to crop)))
          • Unit Group - Pick every unit in Temp_Group and do (Actions)
            • Loop - Actions
              • Set Temp_Loc_2 = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between Temp_Loc_1 and Temp_Loc_2) Less than Temp_Real_1
                • Then - Actions
                  • Set Tornado_Unit = (Picked unit)
                  • Set Temp_Real_1 = (Distance between Temp_Loc_1 and Temp_Loc_2)
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charges remaining in (Item carried by (Picked unit) of type Grain)) Less than 5
            • Then - Actions
              • Unit - Order (Picked unit) to Attack Tornado_Unit
            • Else - Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Citizen man1)) and do (Actions)
        • Loop - Actions
          • Set Unit = (Picked unit)
          • Set Tornado_Unit = No unit
          • Set Temp_Loc_1 = (Position of Unit)
          • Set Temp_Real_1 = 100000000.00
          • Set Grupo = (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Farm)))
          • Unit Group - Pick every unit in Grupo and do (Actions)
            • Loop - Actions
              • Set Temp_Loc_2 = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between Temp_Loc_1 and Temp_Loc_2) Less than Temp_Real_1
                • Then - Actions
                  • Set Tornado_Unit = (Picked unit)
                  • Set Temp_Real_1 = (Distance between Temp_Loc_1 and Temp_Loc_2)
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charges remaining in (Item carried by (Picked unit) of type Grain)) Equal to 5
            • Then - Actions
              • Unit - Order (Picked unit) to Orc Spirit Walker - Spirit Link Tornado_Unit
            • Else - Actions
  • getgrainfarmer
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Citizen man1
      • (Unit-type of (Attacked unit)) Equal to crop
    • Actions
      • Animation - Play (Attacking unit)'s stand work animation
      • Wait 1.00 seconds
      • Item - Set charges remaining in (Item carried by (Attacking unit) of type Grain) to ((Charges remaining in (Item carried by (Attacking unit) of type Grain)) + 1)
  • setfarmgrain
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Farm) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Spirit Link) Equal to True
            • Then - Actions
              • Item - Set charges remaining in (Item carried by (Picked unit) of type Grain) to ((Charges remaining in (Item carried by (Picked unit) of type Grain)) + 5)
            • Else - Actions
 
Status
Not open for further replies.
Top