HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Un-orderable Player Units

09-14-2009, 02:41 PM#1
Spellbound
I'm thinking triggers need to be used for this, which is why it's here. Anyway, is there a way, with or without triggers, to make one of your own units ignore any order you give them without interrupting their current action? I need the units to remain as a player units and not an ally's or neutral hostile/passive because the enemy needs to view that unit as an enemy and you as a player unit.
09-14-2009, 02:49 PM#2
Rising_Dusk
Yeah, catch anytime they're issued an order of any kind, cancel the order, and reissue their last order.
09-14-2009, 02:51 PM#3
Themerion
The Ward classification makes a player unable to order a unit anything but "smart". You can still order the unit other orders by triggers.
  • In the Object Editor - Add the unit classification 'ward' to the unit-type.
  • Use some kind of script to keep units' current order in check (see LastOrder by Rising_Dusk).
  • If a player issues an order with a target, (issued order == "smart"), force the unit to take up his last order (using the script).

In order to force a unit to do something directly, you have to do it in a different thread (otherwise it won't work, for some reason). This is how it's done:

Code:
 - Start one-shot timer that expires in 0 seconds
 - When timer expires, order the unit.
09-14-2009, 03:26 PM#4
TheWye
Quote:
Yeah, catch anytime they're issued an order of any kind, cancel the order, and reissue their last order.

So that means you need to store every order so that they are reissueable? What if the order is not detectable, like drop items?
09-14-2009, 03:59 PM#5
Spellbound
Quote:
Use some kind of script to keep units' current order in check (see LastOrder by Rising_Dusk).

How would that script go? I get the feeling JASS should be used there, but I only know a few scripts in JASS.
09-15-2009, 09:08 AM#6
Themerion
First of all, you need vJASS / JassNewGen editor. Then, go to the scripts section (of wc3campaigns) and look up:
  • UnitIndexingUtilities (which is a requirement for...)
  • LastOrder
I should mention that UnitIndexingUtilities uses Custom Values / UnitUserData (if you don't know what it is, then you're fine :P )

To implement these scripts in your map, just make a trigger for each of them and do Menu Bar->Edit->Convert To Custom Text.

Now, provided you use the "ward" approach (remember, the player can only issue "smart" orders to wards):
Trigger:
Collapse Events
Unit - A unit is issued an order targeting a point
Unit - A unit is issued an order targeting an object
Collapse Conditions
(Issued order) Equal to (Order(smart))
Collapse Actions
Custom Script: call IssueLastOrder( GetOrderedUnit() )

I think this will be sufficient. If Dusk hasn't made sure that IssueLastOrder works in order callbacks, you have to do a timer with 0 seconds expireation time as well. But try this first :P
09-15-2009, 09:52 AM#7
Spellbound
I found out another solution for my problem. But thankyou for your time anyway :)
09-15-2009, 03:54 PM#8
Alevice
I rememebr finding a bug involving pause unit+hide+something else that somehow made the unit ignore any orders until current executing order is finished. For example, if the unit is ordered to attack, no matter which order you gave to him after, he would not stop until the attacked unit is killed.

It was very weird and I never knew how to reproduce it after that.