How to store an order queue? Or remove an order from the order queue of a unit?
Edit: Never mind, you can use an order array... didn't see that array checkbox...
That's great and all that you managed to solve your problem, however it would have been really helpful if you had posted for your solution so that when other people (like me) use the search function for a similar problem, they can see what others have done to solve the problem.
As for me, I am curious primarily how to remove a specific order from a units queue. I am developing a custom resource system (one that uses triggers to check for resources) and I want to setup a trigger so that after the player places a building into a workers build queue, after it checks that the player does not have available resources, it removes the build order from the queue, but continues with the rest of the queue.
Can anyone explain how to remove an order from the queue? I didn't see a single function that served that exact purpose, so I'm wondering what other setup I can use. I am also familiar with the scripting language if it is necessary or makes it easier.
Ok from what I gather, the "return order" function is used to grab the orders from a unit, and it can be indexed to look for specific ones, so I am guessing an order array is used to store every order past the first one, then the unit just has it's orders replaced with the newly made queue.
Ok for those search function users that are looking for the solution to "Removing an order from queue" for your triggers, I have a little solution for you.
Here is an action definition that you can use to make your life easier.
RemoveUnitCurrentOrderOptions:ActionReturnType:(None)ParametersUnit=NoUnit<Unit>GrammarText:Unitskipsitscurrentaction.HintText:(None)CustomScriptCodeLocalVariablesUnitOrderArray=NoOrder<Order[100]>
NumberOfOrders = 0 <Integer>
i = 0 <Integer>
Actions
Variable - Set NumberOfOrders = (Count of orders on Unit)
General - For each integer i from 1 to NumberOfOrders with increment 1, do (Actions)
Actions
Variable - Set UnitOrderArray[i] = (Unit order at index i)
Unit - Order Unit to ( Stop) (Replace Existing Orders)
General - For each integer i from 1 to NumberOfOrders with increment 1, do (Actions)
Actions
Unit - Order Unit to UnitOrderArray[i] (After Existing Orders)
Simply create this Action Declaration in your trigger editor, and whenever you want to remove the current order from the unit's Queue, just simply use this action and reference the unit in the parameter.
If you need to remove a certain order within the order queue, a little adjustment to the declaration can be made, but aside from that this should allow you to have orders skipped when you need it (such as not having enough custom resources for a structure)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
How to store an order queue? Or remove an order from the order queue of a unit?
Edit: Never mind, you can use an order array... didn't see that array checkbox...
That's great and all that you managed to solve your problem, however it would have been really helpful if you had posted for your solution so that when other people (like me) use the search function for a similar problem, they can see what others have done to solve the problem.
As for me, I am curious primarily how to remove a specific order from a units queue. I am developing a custom resource system (one that uses triggers to check for resources) and I want to setup a trigger so that after the player places a building into a workers build queue, after it checks that the player does not have available resources, it removes the build order from the queue, but continues with the rest of the queue.
Can anyone explain how to remove an order from the queue? I didn't see a single function that served that exact purpose, so I'm wondering what other setup I can use. I am also familiar with the scripting language if it is necessary or makes it easier.
Ok from what I gather, the "return order" function is used to grab the orders from a unit, and it can be indexed to look for specific ones, so I am guessing an order array is used to store every order past the first one, then the unit just has it's orders replaced with the newly made queue.
Now all thats left is for me to make this work.
@Zackreaver: Go
Ok for those search function users that are looking for the solution to "Removing an order from queue" for your triggers, I have a little solution for you.
Here is an action definition that you can use to make your life easier.
Simply create this Action Declaration in your trigger editor, and whenever you want to remove the current order from the unit's Queue, just simply use this action and reference the unit in the parameter.
If you need to remove a certain order within the order queue, a little adjustment to the declaration can be made, but aside from that this should allow you to have orders skipped when you need it (such as not having enough custom resources for a structure)