How do I restrain unit's ability to move and patrol?

demotry241

Don't Ever Categorize Yourself.
Reaction score
105
How do I restrain unit's ability to move and patrol?

because when I use the trigger:

Events
Unit - A unit Is issued an order targeting a point
Conditions
(Issued order) Equal to (Order(move))
Actions
Unit - Order (Ordered unit) to Stop
------------
the outcome of this makes the warcraft crash.

oh yeah. i also have another trigger with its event:

Unit - A unit Is issued an order with no target

but its a different trigger.
------------

any idea on how i can restrain move and patrol order without crashing?

any help would be appreciated

thank you.

problem: answered.
 

darkbeer

Beer is Good!
Reaction score
84
Code:
Events
Unit - A unit Is issued an order targeting a point
Conditions
(Issued order) Equal to (Order(move))
Actions
Trigger - Disable Trigger XX / XX is the trigger with the Order - with no target event
Unit - Order (Ordered unit) to Stop
Trigger enable Trigger XX

would be a way
 

demotry241

Don't Ever Categorize Yourself.
Reaction score
105
The solution didnt work. both on right click on ground and issue-ing the move order.

details:

I attached a "game-auto-text timed" to see if the trigger works, and it works.

*if i issue the units to stop, the auto text got shown also\trigger runs also
*units doesnt stop when i used the move order or right click ground.

*I did set up the condition (Issued order) Equal to (Order(move))


any more solution to this problem?
thanks for the effort.
 

darkbeer

Beer is Good!
Reaction score
84
sure you disabled the right trigger??

you need to disable the one which is executed when your unit gets the stop order,
--> the trigger with the [Unit is issued an order with no target] event

show that trigger as well please, the one above shouldnt give any problems alone
 

demotry241

Don't Ever Categorize Yourself.
Reaction score
105
Triggers:
TRIGGER #1

Horizontal Defender 1
Events
Unit - A unit Is issued an order with no target
Conditions
And - All (Conditions) are true
Conditions
((Owner of (Ordered unit)) Equal to Player 1 (Red)) or ((Owner of (Ordered unit)) Equal to Player 6 (Orange))
(1st Horizontal Defender <gen> contains (Ordered unit)) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Issued order) Equal to (Order(holdposition))
Then - Actions
Set Target_Dest[(Player number of (Owner of (Ordered unit)))] = (Position of (Ordered unit))
Set TempX[(Player number of (Owner of (Ordered unit)))] = (X of Target_Dest[(Player number of (Owner of (Ordered unit)))])
Set TempX[(Player number of (Owner of (Ordered unit)))] = (TempX[(Player number of (Owner of (Ordered unit)))] + Move_Distance)
If (TempX[(Player number of (Owner of (Ordered unit)))] Greater than (Max X of 1st Horizontal Defender <gen>)) then do (Set TempX[(Player number of (Owner of (Ordered unit)))] = (Max X of 1st Horizontal Defender <gen>)) else do (Do nothing)
Set Target_Dest[(Player number of (Owner of (Ordered unit)))] = (Point(TempX[(Player number of (Owner of (Ordered unit)))], (Center Y of 1st Horizontal Defender <gen>)))
Unit - Make (Ordered unit) face Target_Dest[(Player number of (Owner of (Ordered unit)))] over 0.00 seconds
Unit - Order (Ordered unit) to Move To Target_Dest[(Player number of (Owner of (Ordered unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Issued order) Equal to (Order(stop))
Then - Actions
Set Target_Dest[(Player number of (Owner of (Ordered unit)))] = (Position of (Ordered unit))
Set TempX[(Player number of (Owner of (Ordered unit)))] = (X of Target_Dest[(Player number of (Owner of (Ordered unit)))])
Set TempX[(Player number of (Owner of (Ordered unit)))] = (TempX[(Player number of (Owner of (Ordered unit)))] - Move_Distance)
If (TempX[(Player number of (Owner of (Ordered unit)))] Less than (Min X of 1st Horizontal Defender <gen>)) then do (Set TempX[(Player number of (Owner of (Ordered unit)))] = (Min X of 1st Horizontal Defender <gen>)) else do (Do nothing)
Set Target_Dest[(Player number of (Owner of (Ordered unit)))] = (Point(TempX[(Player number of (Owner of (Ordered unit)))], (Center Y of 1st Horizontal Defender <gen>)))
Unit - Make (Ordered unit) face Target_Dest[(Player number of (Owner of (Ordered unit)))] over 0.00 seconds
Unit - Order (Ordered unit) to Move To Target_Dest[(Player number of (Owner of (Ordered unit)))]
Else - Actions
Do nothing


TRIGGER #2

Trigger OFF
Events
Unit - A unit Is issued an order targeting a point
Conditions
(Issued order) Equal to (Order(move))
Actions
Game - Display to (All players) the text: Testing
Trigger - Turn off Horizontal Defender 1 <gen>
Unit - Order (Ordered unit) to Stop
Trigger - Turn on Horizontal Defender 1 <gen>



Those are the Triggers.

the variables are.

Move_Distance = REAL = 192
Target_Dest = Point Array(10) = None
TempX = Real Array(10) = None
 

Alphabet

New Member
Reaction score
12
To make the unit stop, pause it, then order it to stop and then unpause it. For some reason it doesn't work to just order it to stop.

And in case you'd like also to disable the right-click move, make the conditions like this:
Code:
Conditions
    Or - Any (Conditions) are true
        Conditions
            (Issued order) Equal to (Order(move))
            (Issued order) Equal to (Order(smart))
However, as far as I know, this won't disable moving through ordering the unit to attack (a unit or a point) nor ordering the unit to patrol. In case you need to disable them also, add orders attack and patrol to the conditions and the event 'Unit is issued an order targeting an object' (which is also required for disabling movement targeting units).
 

demotry241

Don't Ever Categorize Yourself.
Reaction score
105
Is that so.....bummer.


Again, Thanks for the Replies. I really appreciate it.

problems: answered.
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
It causes an infinite loop.
Because the event fires when a unit is issued an order.
And in the trigger you are giving a unit an order.

Do you see what is going on?

EDIT: Sorry didn't read the triggers properly xD
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top