Difference between revisions of "Roam"
m (Updated BBcode to new site.) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
== Solution: Wander Behavior == | == Solution: Wander Behavior == | ||
− | This method is really great and causes no lag. You can restrict a unit to a certain (circular region) by using the leash property. Setting a leash distance requires to be within a radius X that you specify around the point where they received the | + | This method is really great and causes no lag. You can restrict a unit to a certain (circular region) by using the leash property. Setting a leash distance requires to be within a radius X that you specify around the point where they received the behavior. |
===Applying the Behavior to all units of a certain type=== | ===Applying the Behavior to all units of a certain type=== | ||
Line 9: | Line 9: | ||
From there, all you need to set is the '''Stats - Delay''' and '''Stats - Range''' to whatever you want. Note that if Range is left to 0, the units will just not move. | From there, all you need to set is the '''Stats - Delay''' and '''Stats - Range''' to whatever you want. Note that if Range is left to 0, the units will just not move. | ||
− | Once that's done, you need to add the Behavior to the roaming units. If the roam effect is applied to all units of a certain unit type, just go to the Unit tab and add the | + | Once that's done, you need to add the Behavior to the roaming units. If the roam effect is applied to all units of a certain unit type, just go to the Unit tab and add the behavior to the unit's '''Behaviors +''' field. |
Line 23: | Line 23: | ||
This method might cause lag... it really isn't recommended! The only advantage is that you have complete control as of the boundaries of the Roam effect. | This method might cause lag... it really isn't recommended! The only advantage is that you have complete control as of the boundaries of the Roam effect. | ||
− | http:// | + | http://omegacode.0sites.org/BBCode/BBCode3.php?ID=20 |
Move Observers | Move Observers | ||
Events | Events |
Latest revision as of 09:54, 2 May 2011
The good old "Junkyard Dog AI" from StarCraft I is gone. Now, how could someone make his units roam around?
Solution: Wander Behavior
This method is really great and causes no lag. You can restrict a unit to a certain (circular region) by using the leash property. Setting a leash distance requires to be within a radius X that you specify around the point where they received the behavior.
Applying the Behavior to all units of a certain type
Go to the Behavior tab of the Data Editor and create a new object of type Wander.
From there, all you need to set is the Stats - Delay and Stats - Range to whatever you want. Note that if Range is left to 0, the units will just not move.
Once that's done, you need to add the Behavior to the roaming units. If the roam effect is applied to all units of a certain unit type, just go to the Unit tab and add the behavior to the unit's Behaviors + field.
Applying Behavior to a specific unit
If you want it applied to only some specific units (instead of all units of a certain unit type), do not put the Behavior under "Behaviors +". Instead, create a similar trigger:
-PLEASE FILL WITH CORRESPONDING TRIGGER-
Laggy solution: Triggers
This method might cause lag... it really isn't recommended! The only advantage is that you have complete control as of the boundaries of the Roam effect.
http://omegacode.0sites.org/BBCode/BBCode3.php?ID=20
Move Observers Events ------- Any Event you want to activate the Roam Local Variables Conditions Actions Trigger - Run Reorder (Ignore Conditions, Don't Wait until it finishes) Trigger - Stop all instances of Move Observers
Don't forget to add an Event! (Note: This trigger is used to initiate the roam since the "Idle" event isn't met as long as the units haven't moved at least once)
http://vgshorts.com/BBCode/BBCode3.php?ID=19
Reorder Events Unit - Any Unit Becomes idle Local Variables Conditions (Owner of (Triggering unit)) == 15 Actions General - Wait 2.5 Game Time seconds Unit - Order (Triggering unit) to ( Move targeting (Random point in Field)) (Replace Existing Orders)
This trigger makes any Player 15 idle unit start roaming every 2.5 seconds.