[Trigger] my courier system

Level 8
Joined
Apr 17, 2013
Messages
381
any suggestion for my triggers? :vw_wtf:

  • Trasfer Items
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Trasfer Items
    • Actions
      • Set Trasport_Active = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to Flying Courier
        • Then - Actions
          • Unit - Order (Casting unit) to Move To (Position of (Random unit from (Units owned by (Owner of (Casting unit)) matching (((Matching unit) is A Hero) Equal to True))))
          • Wait until ((Number of units in (Units within 100.00 of (Position of (Casting unit)) matching (((Matching unit) is A Hero) Equal to True))) Equal to 1), checking every 1.00 seconds
          • Unit Group - Pick every unit in (Units within 100.00 of (Position of (Casting unit)) matching ((((Matching unit) is A Hero) Equal to True) and ((Owner of (Casting unit)) Equal to (Owner of (Matching unit))))) and do (Actions)
            • Loop - Actions
              • Hero - Give (Item carried by (Casting unit) in slot 1) to (Picked unit)
              • Hero - Give (Item carried by (Casting unit) in slot 2) to (Picked unit)
              • Hero - Give (Item carried by (Casting unit) in slot 3) to (Picked unit)
              • Hero - Give (Item carried by (Casting unit) in slot 4) to (Picked unit)
              • Hero - Give (Item carried by (Casting unit) in slot 5) to (Picked unit)
              • Hero - Give (Item carried by (Casting unit) in slot 6) to (Picked unit)
              • Set Trasport_Active = False
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A Hero) Equal to True
                • Then - Actions
                  • Item - Pick every item in (Region centered at (Position of (Random unit from (Units owned by (Owner of (Casting unit)) matching (((Matching unit) is A Hero) Equal to True)))) with size (300.00, 300.00)) and do (Actions)
                    • Loop - Actions
                      • Hero - Create (Item-type of (Picked item)) and give it to (Casting unit)
                      • Item - Remove (Picked item)
                  • Unit - Order (Casting unit) to Move To ((Owner of (Casting unit)) start location)
                • Else - Actions
        • Else - Actions
  • Transport run
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to Flying Courier
        • Then - Actions
          • Unit - Order (Casting unit) to Move To (Position of (Random unit from (Units owned by (Owner of (Casting unit)) matching (((Matching unit) is A Hero) Equal to True))))
          • Wait until ((Number of units in (Units within 100.00 of (Position of (Casting unit)) matching (((Matching unit) is A Hero) Equal to True))) Equal to 1), checking every 1.00 seconds
          • Unit Group - Pick every unit in (Units within 100.00 of (Position of (Casting unit)) matching ((((Matching unit) is A Hero) Equal to True) and ((Owner of (Casting unit)) Equal to (Owner of (Matching unit))))) and do (Actions)
            • Loop - Actions
              • Hero - Give (Item carried by (Casting unit) in slot 1) to (Picked unit)
              • Hero - Give (Item carried by (Casting unit) in slot 2) to (Picked unit)
              • Hero - Give (Item carried by (Casting unit) in slot 3) to (Picked unit)
              • Hero - Give (Item carried by (Casting unit) in slot 4) to (Picked unit)
              • Hero - Give (Item carried by (Casting unit) in slot 5) to (Picked unit)
              • Hero - Give (Item carried by (Casting unit) in slot 6) to (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A Hero) Equal to True
                • Then - Actions
                  • Item - Pick every item in (Region centered at (Position of (Random unit from (Units owned by (Owner of (Casting unit)) matching (((Matching unit) is A Hero) Equal to True)))) with size (300.00, 300.00)) and do (Actions)
                    • Loop - Actions
                      • Hero - Create (Item-type of (Picked item)) and give it to (Casting unit)
                      • Item - Remove (Picked item)
                  • Unit - Order (Casting unit) to Move To ((Owner of (Casting unit)) start location)
                • Else - Actions
        • Else - Actions
  • Burst
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Burst
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Trasport_Active Equal to True
        • Then - Actions
          • Trigger - Run Trasport run <gen> (ignoring conditions)
        • Else - Actions
  • Return Home
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Return Home
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to Flying Courier
        • Then - Actions
          • Unit - Order (Casting unit) to Move To ((Owner of (Casting unit)) start location)
        • Else - Actions


any suggestions?
 
Level 29
Joined
Oct 24, 2012
Messages
6,545
change casting unit to triggering unit.
waits will bug this up if casted more than once.
this leaks
  • Unit - Order (Casting unit) to Move To ((Owner of (Casting unit)) start location)
u have a lot of point leaks and some group leaks. they should be fixed. this will help http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
rule of thumb anything u use twice or more store into a variable and use the variable instead. this increases efficiency and speed

this will help u with efficiency and learning some other things about triggers. http://www.hiveworkshop.com/forums/tutorial-submission-283/things-gui-user-should-know-233242/
 
Level 13
Joined
Nov 7, 2011
Messages
216
Hmmmm...

At the Transfer items ability, it doesn't check if the hero apprpached is your hero or the enemy's hero. Plus, if the Hero moves to a different point while the courier is on its way, the courier won't follow.

And the burst spell doesn't need to be triggered, because with the way that it's triggered, you won't be able to use Burst as away of escaping enemies since it will force the courier to go to the Hero even if it wasn't needed. Don't do a trigger with burst. It's a skill that won't make the unit forget its orders.

Try Testing it in-game, nothing's better than testing it yourself.
 
Level 29
Joined
Oct 24, 2012
Messages
6,545
the other thing that needs to be redone is the group loops in both triggers. if there are multiple heroes in range it will run the loop multiple times. That should be redone. just use the triggering unit and give all items to him or from him.

Also if ur giving the unit a new order the burst ability shouldnt matter if u use it or not
 
Level 29
Joined
Oct 24, 2012
Messages
6,545
u should upload the map to this site not use another site. Also sry i cant do this atm im on my phone and wont be free to do anything till late tomorrow. about 16 hrs or so. if u cant fix it urself or cant find anyone else to do it i will do it after i update the spell for one of the hives members. u should try to fix it urself tho as u should know these things when using GUI. practice will just help u get better
 
Level 5
Joined
May 14, 2013
Messages
48
You should have used this.

  • Transfer Items
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Transfer Items
    • Actions
      • Set Transport_Active = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Pack Horse
              • (Unit-type of (Triggering unit)) Equal to Albatross
        • Then - Actions
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Unit - Order (Triggering unit) to give (Item carried by (Triggering unit) in slot (Integer A)) to (Random unit from (Units owned by (Owner of (Triggering unit)) matching (((Matching unit) is A Hero) Equal to True)))
        • Else - Actions
This is still not finished but hope this works out with yours.
 
Top