HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Giving an "order" variable as an order.

07-14-2006, 04:54 AM#1
Gerk
Another one of those great maybe-I'm-an-idiot-and-it-completely-passed-me-by moments.

As one should know, there's a variable of the type "Order". Setting it to correspond with a given order is simple enough...but is there a way to GIVE the variable as the order it was bound to be? The inclusion of such a capability seems like a no-brainer, but nevertheless it manages to elude me.

Anyone have an idea where to look?

Perhaps, failing that, some brilliantly concocted scheme to preserve orders as they are given, for later, would be really nifty.
07-14-2006, 06:01 AM#2
Alevice
Do you mean something like:

Set MyOrder = move
Order Footman to do MyOrder at Point

If so, you can't. At least in GUI. It should be interesting that while in GUI the order type exists, in Jass doesn't (or at least i couldn't find its definition, neither a function that uses any var of that type). To issue orders there you can use either use a string like "attack" or "move", or using an integer value.

For what you want, you might want to store the order, the destination point (or unit), and call a jass function. Like:

Trigger:
Order
Collapse Events
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 with no target
Conditions
Collapse Actions
Custom script: local widget TargetWidget
-------- OrderType is just an integer, and the assigned values are just constants made up --------
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Target unit of issued order) Not equal to No unit
Collapse Then - Actions
Set TargetUnit = (Target unit of issued order)
Set OrderType = OrderWithTargetObject
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Target destructible of issued order) Not equal to No destructible
Collapse Then - Actions
Set TargetDestruct = (Target destructible of issued order)
Set OrderType = OrderWithTargetObject
Collapse Else - Actions
-------- Poor evaluation for point, couldn't think of anything better --------
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(X of (Target point of issued order)) Not equal to 0.00
(Y of (Target point of issued order)) Not equal to 0.00
Collapse Then - Actions
Set TargetPoint = (Target point of issued order)
Set OrderType = OrderWithTargetPoint
Collapse Else - Actions
Set IssuedOrder = (Issued order)
Set OrderType = OrderWithoutTarget
Unit - Order (Last created unit) to Stop
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
OrderType Equal to OrderWithTargetObject
Collapse Then - Actions
If (TargetUnit Not equal to No unit) then do (Custom script: set TargetWidget = udg_TargetUnit) else do (Custom script: set TargetWidget = udg_TargetDestruct)
Custom script: call IssueTargetOrder(GetTriggerUnit(),OrderId2String(udg_IssuedOrder),TargetWidget)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
OrderType Equal to OrderWithTargetPoint
Collapse Then - Actions
Custom script: call IssuePointOrderLoc(GetTriggerUnit(),OrderId2String(udg_IssuedOrder),udg_TargetPoint)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
OrderType Equal to OrderWithoutTarget
Collapse Then - Actions
Custom script: call IssueImmediateOrder(GetTriggerUnit(),OrderId2String(udg_IssuedOrder))
Else - Actions

It should be noted that i have not tried it, and if it works, it is not the most efficient implementation, but hopeuflly you will get the idea of how it works.
07-14-2006, 06:31 AM#3
Gerk
Yikes! That's one long code.

I was looking at an artificial implementation, but I was only able to preserve a movement-to-a-point order (as in, a static point, no pursuance of people/objects). Any good ideas regarding how to preserve an order targeting an object/unit?
07-14-2006, 05:28 PM#4
Alevice
In theory, my trigger shgould cover that as well. Read the code carefully, and the gates of heaven will open to you ;)
07-15-2006, 04:31 AM#5
Alevice
Hey there. Attached is a map with a cleaner demonstration of my suggestion. While many of the spells don't work in the demo due to the cooldown, stuff like Hide work well.

Hopefully it will be useful for you.
Attached Files
File type: w3xordertest.w3x (18.8 KB)