• 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.

Keeping Units moving

Status
Not open for further replies.
Level 7
Joined
Jul 24, 2008
Messages
294
Hello, Please look at the bottem of the page for what i'm currently looking help for. Sorry.

-------------------------------------------------------------------------------------
Hello, I'm looking for a little trigger help.. It's been awhile since i'v used W3 editor so please bare with me. - Thanks

I need help with making a trigger to keep units moving to random locations around the map.

  • Ranger Spawn
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Ranger
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To (Random point in (Playable map area))
        • Else - Actions
I'm looking for some help to keep the "Ranger" moving to random points every 20 seconds or so. I haven't used W3 editor in awhile so i'm a bit rusty. Thanks again for any help. :)

I'm using
  • Ranger Move
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Ranger
    • Actions
      • Unit - Order (Triggering unit) to Attack-Move To (Random point in (Playable map area))
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Wait 20.00 seconds
          • Unit - Order (Triggering unit) to Attack-Move To (Random point in (Playable map area))
But i'm not sure if this will work, right now it does. any feed back would be much apricitated. - *Sorry bad spelling ^-^*
 
Last edited:
Level 4
Joined
May 4, 2008
Messages
113
I would do the following:

Code:
Events
 Every 20.00 seconds of game-time

Actions
 Pick every unit in (Units of type Ranger) and do:
  Loop - Actions:
   Order (Picked unit) to Attack-Move to (Random point in <region>)

Leaks a group and a point, by the way. If you don't know how to remove leaks then I suggest you look up a tutorial, its very important :D.
 
Level 5
Joined
Oct 17, 2006
Messages
151
On topic: What he said! (just saying it so theres something related to the thread in my post ^_^)

off topic: do little occasional leaks like these really make a difference in the map? Theres so much room and these little tiny 32 bit arrays leaking doesnt make me consider that it might cause a problem...
 
Level 4
Joined
May 4, 2008
Messages
113
I don't actually know, however I've seen a map with a fair few triggers running with no leak removal and it was hell.

ALWAYS, ALWAYS, ALWAYS remove leaks.

Even if you are very, very lazy, don't skip over thinking it won't be a problem. You're better off not having any at all.
 
Level 7
Joined
Jul 24, 2008
Messages
294
I would do the following:

Code:
Events
 Every 20.00 seconds of game-time

Actions
 Pick every unit in (Units of type Ranger) and do:
  Loop - Actions:
   Order (Picked unit) to Attack-Move to (Random point in <region>)

Leaks a group and a point, by the way. If you don't know how to remove leaks then I suggest you look up a tutorial, its very important :D.


Thanks for the advice, I looked through the w3 tutorials on the site and maybe it is to early for my eyes to work properly but i couldnt see it (haha)

thanks again for the help. :)
 
Level 12
Joined
Mar 16, 2006
Messages
992
Personally, I would create a few regions, a randomizing trigger to cycle between them, and have a trigger that tells them what to do next when they reach their destination, or to have them camp at that location for a little bit.

Ordering them to randomly attack the map will lead to them running into walls or looking stupid when it's a point they can't physically reach.
 
Level 7
Joined
Jul 24, 2008
Messages
294
Personally, I would create a few regions, a randomizing trigger to cycle between them, and have a trigger that tells them what to do next when they reach their destination, or to have them camp at that location for a little bit.

Ordering them to randomly attack the map will lead to them running into walls or looking stupid when it's a point they can't physically reach.

Generaly, The units will find somthing to fight long before they reach there target. and the map will be an open area.

I have rethought the proccses of it all though. Thanks for the help.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
When ever its order becomes equal to stop, order it to move to another random location.

And leaks are not really the main problem, its the affect of them that is. They slow down certain opperations and so reduce the preformance of all map triggers. Also they can crash older computers on game end due to the ammount of memory that needs to be flushed.
 
Level 7
Joined
Jul 24, 2008
Messages
294
When ever its order becomes equal to stop, order it to move to another random location.

And leaks are not really the main problem, its the affect of them that is. They slow down certain opperations and so reduce the preformance of all map triggers. Also they can crash older computers on game end due to the ammount of memory that needs to be flushed.


Thanks again for the help, I had not noticed there was a Order = Stop condition.

I have another question if anyone want's to help.

I'm currious, is there any way to make a unit cast a spell (On its self, or Self cast) Via, trigger-Unit - Order (Triggering unit) to ---(Add command here)---

Any help or suggestions would be appricieated(Damn my horrible spelling)
---------------------------------------------------------------------------------------
Ran into another problem if anyone wants to help.
I'm using the following trigger but the units do not move when there suppose to, I'm not sure what is wrong with the trigger but if anyone can see whats wrong please point it out. Thanks.

  • Keep Units Moving
    • Events
      • Unit - A unit owned by Player 1 (Red) Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(stop))
    • Actions
      • 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 Ranger - |cffffcc00Level 1|r Level 1
              • (Unit-type of (Triggering unit)) Equal to Ranger - |cffffcc00Level 2|r Level 2
              • (Unit-type of (Triggering unit)) Equal to Ranger - |cffffcc00Level 3|r Level 3
              • (Unit-type of (Triggering unit)) Equal to Warrior - |cffffcc00Level 1|r Level 1
              • (Unit-type of (Triggering unit)) Equal to Warrior - |cffffcc00Level 2|r Level 2
              • (Unit-type of (Triggering unit)) Equal to Warrior - |cffffcc00Level 3|r Level 3
        • Then - Actions
          • Wait 5.00 game-time seconds
        • Else - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Random point in (Playable map area))
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
When units stop from moving or smarting, I do not think an order is issued. Stop only is issued if the player presses the button manually I think.
I believe you can detect it however by checking a unit's current order and if it is stop, then the unit has stopped.
Your actions make little sense, as currently if it is equal to any of those unit types you get it to wait (pointless action) otherwise if it is not one of them it is ordered to attack to a random location.

You get triggers to cast spells via orders. You issue the unit you want to cast the spell an order. The order you issue for custom object editor spells is that of the spell it was based on with the exception of channel, which can be set to run on any order.
Note however that spells cast this way are not affected by game play spell restrictions. You can still order a unit to cast a spell when it should not normally be able to and it will cast it like normal. Basically ordering a unit to cast a spell ignores cooldown and mana requirements, thus it is generally recommended to let the default AI cast spells as much as possiable to avoid bugs.
 
Level 7
Joined
Jul 24, 2008
Messages
294
  • Keep Units Moving
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Current order of (Triggering unit)) Equal to (Order(stop))
    • Actions
      • 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 Ranger - |cffffcc00Level 1|r Level 1
              • (Unit-type of (Triggering unit)) Equal to Ranger - |cffffcc00Level 2|r Level 2
              • (Unit-type of (Triggering unit)) Equal to Ranger - |cffffcc00Level 3|r Level 3
              • (Unit-type of (Triggering unit)) Equal to Warrior - |cffffcc00Level 1|r Level 1
              • (Unit-type of (Triggering unit)) Equal to Warrior - |cffffcc00Level 2|r Level 2
              • (Unit-type of (Triggering unit)) Equal to Warrior - |cffffcc00Level 3|r Level 3
        • Then - Actions
          • Wait 5.00 seconds
          • Unit - Order (Triggering unit) to Attack-Move To (Random point in (Playable map area))
        • Else - Actions
          • Do nothing
That got it to work, thanks for all your help.

The trigger btw, is for a mini game in which you controll buildings- that can recruit units. But you have no direct controll of the units.
 
Status
Not open for further replies.
Top