• 🏆 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!

[Solved] Help!!

Status
Not open for further replies.
Level 1
Joined
Jan 8, 2012
Messages
2
I need a trigger to let:

---------------------------------------------------------
Units of one type,

move to,

one type of building,

and the owner of the building (were those units must go) is the owner of the target near those units.

---------------------------------------------------------


It is a mess I know, I will send the trigger that I already have.

  • Pack Horse
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Town Hall
            • Then - Actions
              • Unit - Create 1 Pack Horse (Neutral) for Neutral Passive at (Position of (Picked unit)) facing Default building facing degrees
            • Else - Actions
              • Do nothing
      • Unit Group - Pick every unit in (Units of type Pack Horse (Neutral)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Move To (Position of (Random unit from (Units owned by (Owner of (Random unit from (Units within 200.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Town Hall)))) of type Capital)))


This part:
  • Unit Group - Pick every unit in (Units of type Pack Horse (Neutral)) and do (Actions)
    • Loop - Actions
      • Unit - Order (Picked unit) to Move To (Position of (Random unit from (Units owned by (Owner of (Random unit from (Units within 200.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Town Hall)))) of type Capital)))
 
Last edited by a moderator:
I can't understand what you want exactly, but I'll take a rough guess.

Every 10 seconds you want to create a pack horse that no one can control at all town halls.
You then want that unit to move to a random more advanced building that is owned by the town hall that the pack horse was created at.

You should also learn about leaks as they are an important part to learning how to create a map in Wc3. Also is required for a map to get approved here.
  • Pack Horse
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Town Hall) and do (Actions)
        • Loop - Actions
          • Set Point = (Position of (Picked unit))
          • Unit - Create 1 Chicken for Neutral Passive at Point facing 270.00 degrees
          • Custom script: call RemoveLocation(udg_Point)
          • Custom script: bj_wantDestroyGroup = true
          • Unit - Order (Last created unit) to Right-Click (Random unit from (Units owned by (Owner of (Picked unit)) of type Capital))
 
Level 25
Joined
Sep 26, 2009
Messages
2,383
Don't use
  • Unit Group - Pick every unit in (Units of type Town Hall) and do (Actions)
    • Loop - Actions
Since it always leaks.
If your units return to their original spot halfway through, it may be because they are Neutral Passive. Create those units for Player1-12 to see if the problem still presists.
Also get rid of leaks
 
Level 20
Joined
Jun 27, 2011
Messages
1,864
I can't understand what you want exactly, but I'll take a rough guess.

Every 10 seconds you want to create a pack horse that no one can control at all town halls.
You then want that unit to move to a random more advanced building that is owned by the town hall that the pack horse was created at.

You should also learn about leaks as they are an important part to learning how to create a map in Wc3. Also is required for a map to get approved here.
  • Pack Horse
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Town Hall) and do (Actions)
        • Loop - Actions
          • Set Point = (Position of (Picked unit))
          • Unit - Create 1 Chicken for Neutral Passive at Point facing 270.00 degrees
          • Custom script: call RemoveLocation(udg_Point)
          • Custom script: bj_wantDestroyGroup = true
          • Unit - Order (Last created unit) to Right-Click (Random unit from (Units owned by (Owner of (Picked unit)) of type Capital))

  • Custom script: set bj_wantDestroyGroup = true
Only prevents unit group leaks.
 
Here you go.
My trigger didn't leak, it was just a less efficient way.
Would be easier to just do it all in Jass...
  • Pack Horse
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Town Hall) and do (Actions)
        • Loop - Actions
          • Set Point = (Position of (Picked unit))
          • Unit - Create 1 Pack Horse (Neutral) for Neutral Passive at Point facing 270.00 degrees
          • Custom script: call RemoveLocation(udg_Point)
          • -------- --------
          • Set UnitGroup = (Units owned by (Owner of (Picked unit)) of type Capital)
          • Custom script: set udg_Unit = FirstOfGroup(udg_UnitGroup)
          • Unit - Order (Last created unit) to Right-Click Unit
          • Custom script: call DestroyGroup(udg_UnitGroup)
 
Last edited:
Status
Not open for further replies.
Top