HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Uncontrollable Units

05-29-2009, 10:48 PM#1
Immoralis
How do you make units that are owned by the player but are controlled by a basic AI to cast spells that you designated and function basically like another players unit? Basically the units in castle fight if you are familiar with that.
05-29-2009, 11:15 PM#2
Anitarf
The only way I know of involves making the units unselectable (but not unkillable like the locust ability does), tell us if that's ok.
05-30-2009, 01:43 AM#3
BestZero
AFAIK, Overwriting the unit's given command is the best way we can do. Whenever they are given a command from player, assign a new command to it. Castle Fight also uses this method.
05-30-2009, 03:22 AM#4
Immoralis
Unselectable is undesireable

I tried to overide the orders by doing

Event: Issued order a target point

Action: Order unit to stop

however that doesnt work so I added a wait 0.01 second before the stop but then mass clicking will cause it to move. Also an infinte loop happens if I do this Unit is issued target unit.

=/
05-30-2009, 03:55 AM#5
BestZero
I'm pretty sure you don't need the use of wait as I have tried it before and it worked fine.

For the infinite loop problem, just disable the trigger and enable it after the issue unit function or try adding filter(condition) to it so that the event won't fire the trigger infinity times.
05-30-2009, 04:09 AM#6
Immoralis
Code:
NO Right Click
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
        (Triggering unit) Equal to Peasant 0002 <gen>
    Actions
        Trigger - Turn off (This trigger)
        Unit - Order (Triggering unit) to Stop
        Trigger - Turn on (This trigger)

Yea this doesnt work :(
05-30-2009, 05:11 AM#7
fX_
you need to pause-stop-unpause the unit i think.

Collapse JASS:
set (boolean) unitIsPaused = IsUnitPaused(myUnit)
call PauseUnit(myUnit, true)
call IssueImmediateOrder(myUnit, "stop")
call PauseUnit(myUnit, unitIsPaused)
or something like that
05-30-2009, 11:09 AM#8
BestZero
Tried it, it really didn't work. Well if you can use JASS, using single timer with 0.00 may be the solution for this. I don't think there is a way that GUI can handle this (with MUI, of course) because basically the event fires before a unit actually takes the order so wait is no go.
05-30-2009, 12:54 PM#9
Hans_Maulwurf
Trigger:
Ordered
Collapse Event
Unit - A unit Is issued an order targeting an object
Unit - A unit Is issued an order targeting a point
Unit - A unit Is issued an order without a target
Collapse Condition
(Issued order) Is (Order(smart))
(Triggering unit) Equal to Peasant 0002 <gen>
Collapse Actions
Unitgroup - Add (Triggering unit) to Ordered
Trigger - Turn on Stop <gen>

Trigger:
Stop
Collapse Event
Zeit - Every 0.03 seconds of game time
Conditions
Collapse Actions
Collapse Unitgroup - Pick every unit in Ordered and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Stoppen
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Bedingungen
(Current order of (Picked unit)) Is (Order(stop))
Collapse 'THEN'-Aktionen
Unitgroup - Remove (Picked unit) from Ordered
'ELSE'-Aktionen
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Bedingungen
(Number of units in Ordered) Is 0
Collapse 'THEN'-Aktionen
Trigger - Turn off (This trigger)
'ELSE'-Aktionen

Give the uncontrolable units the ward classification, so people can only order them "smart" (or make the Stop trigger deactivate the Order trigger while ordering "stop")

Jass solution would be better though