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

how to make a unit move again when it stops from its issue order

Status
Not open for further replies.
Level 6
Joined
Nov 5, 2013
Messages
132
You can use this system too
Every 0.02 second
  • Acciones
    • Grupo de unidad - Pick every unit in (Unit in (Playable map area)) and do (Actions)
      • Bucle: Acciones
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • Si: Condiciones
            • ((Current order of (picked unit)) igual a (Order(stop))) or ((Current order of (Picked unit)) igual a (Order(smart)))
          • Entonces: Acciones
            • Unidad - Order (Picked unit) to mover a (Center of PointX <gen>)
          • Otros: Acciones
This works to evite bugs in the movement (recomended to TDs)
 
Hmm what does smart mean? so if i put smart is = not true does that mean that the unit isnt moving?

Yes that is what smart means.

You can use this system too
Every 0.02 second
  • Acciones
    • Grupo de unidad - Pick every unit in (Unit in (Playable map area)) and do (Actions)
      • Bucle: Acciones
        • If (All Conditions are True) then do (Then Actions) else do Else Actions
          • Si: Condiciones
            • ((Current order of (picked unit)) igual a (Order(stop))) or ((Current order of (Picked unit)) iguala (Order(smart)))
          • Entonces: Acciones
            • Unidad - Order (Picked unit) to mover a (Center of PointX <gen>)
          • Otros: Acciones


The above is bad to use since it leaks unit group and location. Also creating a unit group repeatedly is very costly performance wise. That is why i suggested a global unit group. Also order stop is instant then it refers to the smart command. That is why catching order stop is very rare so it should not be in there.
Also as rules for site everything must be in English.

@TO
Add unit to a global group never destroy this group. Never do set group equal units in range. Only use add units in a unit enters map trigger and remove units from the group in unit leaves map trigger.
 
Level 5
Joined
Jun 13, 2012
Messages
113
kk thanks

  • pick every unit from unit group and do
    • loop
      • if all conditions are true then do actions
        • if conditions
          • issued order of picked unit equal to order "smart"
        • then
          • do actions here.
        • else
I did the above on my phone so actions may be wrong

Um the loop up there is that just the name?

Nvm i get it

Hmm still not working my unit still doesnt move when it reachs its location.

Basicly i made my unit move in a random location on the map. So i want it too loop and allow my unit to walk all over the map without stop. My unit still stops moving when it reachs its point. so this trigger doesnt work o-o
 
Last edited by a moderator:
Level 10
Joined
Apr 18, 2009
Messages
601
Can you please explain the problem a bit more in detail. You have:
• A unit moving in your map.
- The unit is supposed to move continuously, without ever stopping.
- When the unit reaches it's destination, it should immediately start moving to another random location.

Have I got the picture?

I've attached a prototype map that simulates this behaviour with a unit within a smaller region. Please test the map in action and tell me if this is the behaviour you're after. If this is it, I can explain a solution. If the general idea presented in this map is not what you're looking for, then please explain more in detail what you're after.

I've assumed things like:
- The unit is not controllable by a human player that can issue it orders (it's solely AI).
- We're explicitly triggering a specific unit within the map. The code is not general but specific for this one unit.
 

Attachments

  • Make Unit Move Continuously.w3x
    17.8 KB · Views: 53
Level 10
Joined
Apr 18, 2009
Messages
601
Yes it is what im looking for but i issue order them to move to a random location of playable map area. Is that possible with out using dumby? and how do u do it with more then one unit?

Yes, it certainly is possible to do that without using dummy units. This is just a relatively simple solution that I probably would've used myself for one unit moving around. Is it just a few units that should have this behaviour to move around randomly? How many? 3? An undefined amount that changes over time? Are they placed at the map from start or will they enter and leave the map as time goes on? All this changes how sophisticated of a solution you'll want to go for.
 
Level 10
Joined
Apr 18, 2009
Messages
601
Then my method is probably not ideal.

Someone more knowledgeable than myself might be able to tell you if it's possible to queue issue orders with jass code. If it is then I suggest making a trigger looking something like this:

  • Move Next
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(move))
      • (Unit-type of (Triggering unit)) Equal to Moving Unit Type
    • Actions
      • Custom script: jass code for queuing following issue order: Order (Triggering Unit) to Move To (Random point in (Playable map area))
Does anybody know how to queue orders in code? Do you get the general idea, gritpatrick?
 
Status
Not open for further replies.
Top