• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Random move...

Status
Not open for further replies.
Level 3
Joined
Jul 13, 2010
Messages
46
do:




  • Events
  • Map Initalization
  • Actions
  • Variable - Set movepoint - position of Unit
  • Events
  • Time - Every 0.01
  • Actions
  • Variable - Set range - Distance between position of unit and movepoint
hope it helps.

  • Events
  • Value of real variable - range less than or equal to 50
  • Actions
  • Variable - Set movepoint - random point in region
  • Unit - order Unit to attack move to movepoint
 
  • Trigger
  • Events
    • Time - Every 1.00 seconds of game-time
  • Conditions
  • Actions
    • Set Points[1] = (Position of (Your unit))
    • Set Points[2] = (Points[1] offset by (Random real number between 150.00 and 300.00) towards (Random angle))
    • Unit - Order (Your unit) to Move to Points[2]
    • Custom script: call RemoveLocation (udg_Points[1])
    • Custom script: call RemoveLocation (udg_Points[2])
Edit: Damn backup ;p
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hmmm it don't work - just the unit moves one time but not a second time... here are my triggers:

  • Trig 1
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Trigger - Run Trig 2 <gen> (ignoring conditions)
  • Trig 2
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • Set Points[1] = (Position of (Picked unit))
      • Set Points[2] = (Points[1] offset by (Random real number between 150.00 and 300.00) towards (Random angle) degrees)
      • Unit - Order (Entering unit) to Move To Points[2]
      • Custom script: call RemoveLocation (udg_Points[1])
      • Custom script: call RemoveLocation (udg_Points[2])

Variable : Type: Point, 2 array
Custom script : i don't know what this is , just copy from Pharaoh_ :D

Please help! :cry:
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Trust me, use this ability instead:

attachment.php


Equip this ability in ANY unit you want in their "Abilities - Normal"
 

Attachments

  • untitled.JPG
    untitled.JPG
    207.3 KB · Views: 189
Level 3
Joined
Jul 13, 2010
Messages
46
  • Trigger
  • Events
    • Time - Every 1.00 seconds of game-time
  • Conditions
  • Actions
    • Set Points[1] = (Position of (Your unit))
    • Set Points[2] = (Points[1] offset by (Random real number between 150.00 and 300.00) towards (Random angle))
    • Unit - Order (Your unit) to Move to Points[2]
    • Custom script: call RemoveLocation (udg_Points[1])
    • Custom script: call RemoveLocation (udg_Points[2])
but every second the point is set.The unit would walk and stop on the spot.the trigger i mentioned runs a check on whether the unit has reached the area and generates an area afterwards.
 
(Note to author: I'm sorry to go into this subject deeper, if you want a unit to move randomly: use Wander, like defskull mentioned a few times before).

but every second the point is set.The unit would walk and stop on the spot.the trigger i mentioned runs a check on whether the unit has reached the area and generates an area afterwards.
Still, "every 0.01 seconds" is NOT good: I always use every 0.032 seconds (JASS), or every 0.03 seconds (GUI).
And since it's just to check the distance between two points, every 0.30 seconds would do (also goes unnoticed).

Additionally, your triggers do not support multiple units (only 1 unit, if you want more units to randomly wander it'll fail).
And of course, you do not remove the leak (only change the variable to another location, it still leaks that way).
 
I edited the above system. You do need to set up one thing now: check the first trigger ("vis") and change the "RunnerType" to the unit type of the runner. That'd be all.

I could do the touch runner-thing as well (not hard), but then it would require you to understand how I do things like that :p (I would create the runners via triggers, store them in a variable and then create a new event for every runner).
 

Attachments

  • Wander.w3m
    16.8 KB · Views: 43
Last edited:
Status
Not open for further replies.
Top