Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
I've devised a small system that stored every unit's order so it can be recalled easily by adding the unit to TempGroupOrder and running the Last Order trigger as you see below in the first two screenshots. This worked perfectly fine with the downside of it being in GUI and not being able to use order IDs meaning that I would have to copy and paste the same triggers for each different order (ie move, attack, smart, etc)
I then decided to revamp the system using some jass to make it work with all orders in the future without having to use repetitive GUI for new orders but for some reason ordering the unit to a unit or destructible doesn't work while a point target still works. Any one have any ideas on how to fix this?
Edit: Only the New System needs fixing to make it work for units and destructibles, it only works for points atm.
That screen was the old system that worked, the new one stores the order in the custom script line here: set udg_lastorder[udg_lasttemp] = GetIssuedOrderId()
Also it works for point targets not widgets for some odd reason
@Pyrogasm
I'd rather have my own as I can modify it more easily to suit my needs rather than that one as mine just needs 1 small fix to make it work properly
Maybe take a look at this for some guidance. In one of my maps I needed a dummy to mimic my actual unit so I ordered them by issuing the same orders to the dummy. This should only be a tweak or two away from saving the last order.
I cut some of the excess code out.
Part of your difficulty is coming from the fact that GUI does not let you have widgets, which means you're having to filter to figure out what the object is. When it so happens you don't actually care what the object is, you just want to save the order to whatever the object is.
Mimic
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
Actions
Custom script: local widget w
Set TempUnit = (Triggering unit)
Custom script: if GetHandleId(GetTriggerEventId()) == 40 then // This is the number that represents the event -- "targeting an object"
Custom script: set w = GetOrderTarget()
Custom script: call IssueTargetOrderById(udg_someUnit, GetIssuedOrderId(), w) // Rather than order the unit, just save all this information.
Custom script: elseif GetHandleId(GetTriggerEventId()) == 39 then // "targeting a point"
Set TempPoint = (Target point of issued order)
Custom script: call IssuePointOrderByIdLoc(udg_someUnit, GetIssuedOrderId(), udg_TempPoint) // same
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: else // "no target"
Custom script: call IssueImmediateOrderById(udg_someUnit, GetIssuedOrderId()) // same
@pOke
My filtering worked fine in the first system that that used all GUI and I bug tested to see if it got the right variable and it does depending on the target, so I'm still puzzled on why it's not working, the code is supposed to take any unit/dest/item var isn't it?
Edit: All right, I think I've got it working now. My problem was that I was saving the units last order, but then when I would try to change the order, the cancelled order was overwriting what ought to be the actual last order. Take a look at the trigger, and my test map.
Last Order
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
Actions
Set lastOrderIndex = (Custom value of (Triggering unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
lastOrderCheck[lastOrderIndex] Equal to True
Then - Actions
Custom script: set udg_lastOrderId2[udg_lastOrderIndex] = udg_lastOrderId[udg_lastOrderIndex]
Set lastOrderType2[lastOrderIndex] = lastOrderType[lastOrderIndex]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
lastOrderType2[lastOrderIndex] Equal to 1
Then - Actions
Custom script: set lastOrderTarget2[udg_lastOrderIndex] = lastOrderTarget[udg_lastOrderIndex]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
lastOrderType2[lastOrderIndex] Equal to 2
Then - Actions
Custom script: if udg_lastOrderPoint2[udg_lastOrderIndex] != null then
So a few things. Currently this only begins to work upon the unit being given its second order. Meaning if you call this on a newly created unit, it will do nothing. If you order that unit to then do "something" once then try to call this, it will also do nothing.
However upon the unit having a first and second order it will work properly.
Another issue that you'll have to decide if it is important is how stuns are handled. A stun issues an order, meaning that the unit's "last order" will become "stun" however it is really just a pseudo stop when not caused from an ability. You can easily filter out the stun by using an If when the order id is <851973>.
It might be obvious, it might not, but if the last order's target does not exist, it will also do nothing. (i.e. ordered to pick up an item that is already in a units inventory or destroyed)
Also, the two widget arrays I use are declared in a globals block. So in order to utilize the convenience of widgets you must have JNGP.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.