I have a watchman type unit that is supposed to wander, but obviously not too far away from the town it is guarding... I didnt want to have to create a bunch of regions and then move them to the position of the watchmen everytime one is trained... so i gave the town hall an aura and had it check to see if the unit had the buff when it was given an order. if it didnt it would order the unit to return to the town hall... but it doesn't work. here is the trigger:
each unit is assigned a custom value when it is created, the custom value assigns it to which town it was created at, and is unique to each town. so all the custom value stuff is a way of refferencing each town hall. any clues why this won't work?
Edit: Shura has pointed out the infinite loop problem caused by the "Unit is issued an order targeting a point(move) event. that's just there as a relic of when I've tried changing triggering unit to ordered unit, casting unit, etc, to try to get it to detect when the wander ability is used. which just isn't happening. if i can't get this configuration to work, is there another way to keep wandering units in a general area (other than creating a region and a specific unit leaves region event)
Trigger:
- Herding
- Events
- Unit - A unit Begins channeling an ability
- Unit - A unit Begins casting an ability
- Unit - A unit Starts the effect of an ability
- Unit - A unit Finishes casting an ability
- Unit - A unit Stops casting an ability
- Unit - A unit Is issued an order targeting an object
- Unit - A unit Is issued an order targeting a point
- Unit - A unit Is issued an order with no target
- Conditions
- (Unit-type of (Triggering unit)) Equal to Watchman
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Triggering unit) has buff Home ) Equal to True
- Then - Actions
- Do nothing
- Else - Actions
- Set CustomValue = (Custom value of (Triggering unit))
- Set TempGroup = (Units in (Playable map area) matching ((((Matching unit) is A town-hall-type unit) Equal to True) and ((Custom value of (Matching unit)) Equal to CustomValue)))
- Unit Group - Pick every unit in TempGroup and do (Actions)
- Loop - Actions
- Set TempPoint = (Position of (Picked unit))
- Unit - Order (Triggering unit) to Move To TempPoint
- Loop - Actions
- If - Conditions
- Custom script: call RemoveLocation (udg_TempPoint)
- Custom script: call DestroyGroup (udg_TempGroup)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Events
each unit is assigned a custom value when it is created, the custom value assigns it to which town it was created at, and is unique to each town. so all the custom value stuff is a way of refferencing each town hall. any clues why this won't work?
Edit: Shura has pointed out the infinite loop problem caused by the "Unit is issued an order targeting a point(move) event. that's just there as a relic of when I've tried changing triggering unit to ordered unit, casting unit, etc, to try to get it to detect when the wander ability is used. which just isn't happening. if i can't get this configuration to work, is there another way to keep wandering units in a general area (other than creating a region and a specific unit leaves region event)