| 08-22-2006, 11:17 PM | #1 |
Is it possible to get the order from a unit (such as: walk to position x/y, build at position x/y, cast spell on unit or at position x/y, etc...), store it in a variable and use it (e.g. give it another unit, give it to the same unit at a later moment, etc) ? |
| 08-22-2006, 11:25 PM | #2 |
Yes and it's quite simple. You just have to store the order id and the target. You can then reissue the order at any time to any unit. |
| 08-22-2006, 11:46 PM | #3 |
I very much doubt it's so "quite simple" The difficulty is: how to find out which type of order it is: is it a movement order, a build order, or an order targeting a unit? and then to correctly return the order |
| 08-23-2006, 09:09 AM | #4 |
It is that simple if you detect the order when it's issued, since then you know exactly which order it is. Otherwise, you'd have to chechk the order id and issue the correct type of order yourself. |
| 08-23-2006, 11:57 AM | #5 |
thing is, I can't detect the order when it's issued; instead I query it once the unit has reached a certain point. To get more into detail: for my purpose this is going to serve as a teleporter (with additional unit filtering functions, but that's not the point here) Let's say a peon is ordered to build a structure on the other side of the teleporter, it will carry that building order, walk into the teleporting region, - that's the point I need to store its order - be teleported to the other side, and then should be re-issued it's building order. Might as well be a hero ordered to heal/attack another unit on the other side of the teleporter, or just to walk to a certain point, so it's important that the unit is re-issued the correct order type. |
| 08-23-2006, 12:03 PM | #6 |
What do you specifically need? |
| 08-23-2006, 03:06 PM | #7 |
GetUnitCurrentOrder (returns the integer order id). |
| 08-23-2006, 04:52 PM | #8 |
what I need? I've stated the problem above: store a unit's current order, find out which type of order it is, and correctly return it to the unit after it has passed through a teleporter, i.e. after the unit's position has been changed. Let's take the native as blu already posted: GetUnitCurrentOrder(u) So I got the integer now, which could look like 8327125 What then? How do we know which type of order it is - that's the big question here! I might find out coordinates using GetOrderPointX/Y, or if it's a target widget GetOrderTarget. To reassign the order, I need to know whether it's a buildorder, a pointorder, or a targetorder. How can you tell???? Just storing the order as integer Code:
set order_int=GetUnitCurrentOrder(u) Code:
IssueImmediateOrderById(u, order_int) simply doesn't work that way, since it can't be an immediateorder. |
| 08-23-2006, 05:00 PM | #9 |
Well there is a way, try using order strings. Move is ''move'', Stop is ''stop'', and Hurl Boulder is ''creepthunderbolt''... The events: Unit - xx is issued an order {targeting xx/with no target} Store all above into arrays... is it enough? |
| 08-23-2006, 05:57 PM | #10 |
you're missing the point. it's not about getting any order from any unit instantly after an order has been issued, but it's about getting the order of a certain unit that is inside a certain rect, and decide which type of order it is, so it can be re-assigned correctly. storing any possible order string in a large array can't help me decide whether the unit is ordered a building order, a point order or a target order, so I can't see how this would solve the problem. But thanks for your efforts anyway. |
| 08-23-2006, 06:02 PM | #11 |
What you should do is get the orders when they are issued, and store their type (build, pointorder, widget order...) for the unit, either with attachable variables or using the custom value of the unit, then when the unit gets to that region you can do your stuff. |
| 08-23-2006, 06:10 PM | #12 |
I think WC3 just ignores orders if they are of the wrong type, so you could try issueing point and target orders for all orderids. |
| 08-23-2006, 10:07 PM | #13 | |
Quote:
hmm... - so if i want to heal a unit with my hero (on the other side), it would just loop though seven figures of order id combinations? - still don't know what to do with building orders. - I can't see the advantage of getting the orders at the point they're issued as opposed to the point they're of interest (i.e. when a certain unit enters a region) both GetUnitCurrentOrder(u) (my way) and GetIssuedOrderId() (you way) return an integer, which won't tell anything, and is of little use...until someone cracks that thing in this forum. |
