Problem with that is I want to attack it, not just move the position - my previous example of 'move' was just for testing and I left it. Moving to the position of a unit (not to the unit itself) does work though.
The attack 'ends' if my target that I've queued up is no longer in vision, that would explain why it worked when I targeted one of my own units.
This is a problem though, because the mechanic I'm working on is going to end up as a 'tracking' mechanic. If you queue up an attack on a unit that no longer has vision, it will make a best attempt to find that unit based on when the target unit was last visible (aka chase the unit into fog for X number of seconds).
It works when I retain vision, but when I replaced the order with a manually set order like you suggested, it still doesn't work.
I'm not sure if it has something to do with the position of the order where it doesn't want to take it, or what? I will try having the unit move back and forth to see if that works.
With this suggestion, I thought about it a little, and instead of having the current queued order replace and have the rest of the orders before that get placed before the existing queue, I would just save the order for later (after rebuilding the queue) and place the recent order to the end. I get much better results with the queuing.. but I'm still having an issue with getting the attack order to stick on that unit. Videos to follow.
OrderQueueManipulation-UnitEventsUnit-Ghost[4.06,60.00] is issued an order to Attack
Local Variables
order = (Triggering order) <Order>
unit = (Triggering unit) <Unit>
end = 0 <Integer>
i = 0 <Integer>
unit orders = (Triggering order) <Order[64]>
Conditions
(Target type for order) == Unit
Actions
------- The trigger must be turned off to stop it self-firing.
Trigger - Turn Order Queue Manipulation - Unit Off
------- First get all unit orders.
------- Skip last order as that is the triggering order.
Variable - Set end = ((Count of orders on unit) - 2)
General - For each integer i from 0 to end with increment 1, do (Actions)
Actions
Variable - Set unit orders[i] = (unit order at index i)
------- Clear all unit orders with the corrected order.
Variable - Set order = ((Ability command for order) targeting Ghost [19.94,59.93])
Unit - Order unit to ( Stop) (Replace Existing Orders)
------- Now refill the orders from top to bottom.
General - For each integer i from 0 to end with increment 1, do (Actions)
Actions
Unit - Order unit to unit orders[i] (After Existing Orders)
Unit - Order unit to order (After Existing Orders)
------- The trigger must be turned on again to pickup new orders.
Trigger - Turn Order Queue Manipulation - Unit On
Move to position of unit does work, but the purpose is to be able to target the unit directly. It is only set to move as a test, my ultimate goal is to have it issue the attack order instead.. and the path isn't completely blocked.
I'll post some videos in a little bit showing what it does.
The reason why it goes 'before existing orders' is because it is a queued action.
Let say this is your order queue:
0 - Move to point
1 - Move to point
2 - Attack to point
3 - Move to point
Then, with my current script - it takes an attack on a unit, and changes it to move to unit, it would do this:
0 - Attack to unit -> 0 - Move to unit
THEN
0 - Move to point
1 - Move to point
2 - Attack to point
3 - Move to point
4 - Move to unit
This would keep the current queue intact, and modify the most recent queued up command and have it stay at the end. When I initially target the unit I really want to move to, it doesn't actually move to it (this is a queued order, which after the order at position 3 is executed, the unit is no longer in range or in vision for order 4, and the unit stops). If I target a different unit, it redirects it to the target and ends up moving to the unit just fine, out of range and out of vision as well.
Not sure if I'm explaining the issue well at all.. I could try to get a video of it for an example if that would help.
Sorry I know this thread is a little old, but I'm working on queue manipulation myself and noticed this..
So I've modified this example so that it watches for an attack on a unit (focused on one unit for control) and moved the variables to be global instead of local.
The problem I am running into here is when I actually target the Ghost (this ghost - Ghost [19.94, 59.93]) - it doesn't really 'replace' the order. When I target other units, it issues the move order to the correct unit just fine.. only when I target the unit I actually want to move to, then it has a problem. Any ideas?
OrderQueueManipulationEventsUnit-Ghost[4.06,60.00]isissuedanordertoAttackLocalVariablesConditions(Targettypefor(Triggeringorder))==UnitActions------- The trigger must be turned off to stop it self-firing.Trigger-Turn(Currenttrigger)Off------- First get all unit orders.------- Skip last order as that is the triggering order.Variable-Setend=((CountofordersonGhost[4.06,60.00])-2)General-Foreachintegerifrom0toendwithincrement1,do(Actions)ActionsVariable-Setunitorders[0]=(Ghost[4.06,60.00]orderatindexi)------- Clear all unit orders with the corrected order.------- In this case I offest the order by 2,2 just for demonstration purposes.Variable-Setorder=(MovetargetingGhost[19.94,59.93])Unit-OrderGhost[4.06,60.00]toorder(ReplaceExistingOrders)------- Now refill the orders from top to bottom.General-Foreachintegerifromendto0withincrement-1,do(Actions)ActionsUnit-OrderGhost[4.06,60.00]tounitorders[0](BeforeExistingOrders)------- The trigger must be turned on again to pickup new orders.Trigger-TurnMoveQueueOn
I'm trying to mess around with the editor to get command queuing to behave similar to SC1.
What I'm trying to replicate is queuing up an attack order on a unit that eventually goes into fog. For instance, shift attacking a unit when it is visible and it happens to go outside vision.
In SC1, the queued attack on a unit that enters fog is still pursued for a little bit of time (roughly 10-15 seconds) before giving up, if it does manage to see the unit after chasing into fog within that time frame it will execute the attack.
In SC2 I am seeing that the queued attack order is cancelled if the path length is over a certain amount, regardless if the unit moved or not.
I'm not entirely sure if this makes sense, but I'm curious if anyone has been able to figure out if data needs to be modified, or if it needs to be triggered in a custom queue. Any suggestions?
If this isn't helpful enough, I can put into detail how to make the triggers add experience to your hero. its pretty simple if you look at the events list under triggers.. you might get a clue.
First step: Create your hero using the Hero making guide found Here
Second step: Go to Behaviors under Data and create a behavior name (whichever you want, I used veterancy) and behavior type to be Veterancy
Third step: Set the following fields like mine, do not add veterancy levels
Fourth step: Create another behavior named (whichever stat you like, I picked Agility) and behavior type to be Buff
Fifth step: THIS IS THE MOST IMPORTANT STEP set the fields "Max Stack Count" and "Max Stack Count Per Caster" to a high number, I picked 255 for a max of stats.
Sixth step: go into the modification field and scroll down till you see damage (unscaled) and change the type of damage, for me I changed melee and ranged to 10
Seventh step: Be sure to add the veterancy behavior to your hero, click on your hero under the Unit section in Data, click on the Behavior field, and add veterancy.
TRIGGERS
Eighth step: First, I started with creating variables for all the things I will be using for the level dialog and such. Incase you are unaware on how to do that, you right click in the empty space on the left side of your trigger editor, mouse over to new, and then mouse over to new variable and click.
Ninth Step: Click on the newly created variable and mouse over to where you see type in the center of the trigger page, click on it and scroll down to dialog. Then you can rename it to whatever you like by right clicking on the variable and renaming it, I chose to name it Stats Dialog.
Tenth Step: Next, I created more variables to use, I created 3 dialog items, 3 integers, and a real variable. I named them like so. I set the XP Needed to 100 and the Hero Level to 1 to start things off.
Eleventh Step: Now, right click in the empty space on the left and mouse over to new, then mouse down to new trigger. This part is a little tedious but this is where we make a dialog box that shows your current level, xp, and attribute points.
1. I started out by making an event for this trigger, a map initialization trigger so that this will run right away.
2. I created a dialog 300x300 and placed it at the center of the screen (for testing purposes). Then I set the Stats dialog variable so that I can easily manipulate this dialog at a later time. Then I set it to show so that we can see the dialog that was just created.
3. Next I made a dialog item(label) and set the variable to Level Dialog Item. Next I moved the label 50x50 from the top left of the dialog so it looks better. Next I use the combine text for setting the text and I set the label accordingly. This way it will say "Level: " then the current level of the hero.
4. Again, I make another dialog item that is XP dialog item, then I used the Combine Text Multiple to make it show the current XP and how much XP is needed left. I set the size of the item so that it can show all the numbers correctly without chopping to the next line, and then I moved it 50x75, 25 units further than the last item so it shows in a list.
5. Now I created a dialog item and then set it to Agility Dialog Item. I set the size of it and then moved it 25 more units than the previous item. I set the text just like the Level text I set earlier. Now you are done with the dialog portion.
Twelfth Step: This next step is pretty simple. All I did here was set an event for when the unit gains experience, it runs the trigger. I set a local (Real) variable named Gained XP. Then down at the actions I just had it modify the Total XP variable to add to the Gained XP variable, then it would refresh the XP dialog item text. You can just copy this action trigger from the first trigger we made because it will display the same thing.
Thirteenth Step: This step isn't so bad either. I set an Event timer for every .2 seconds of the game (you can make it faster or slower if you like) then I made a local variable that is called Total XP. This local variable actually is a conversion variable. So when you create an integer variable, make sure you click the link at the bottom of the integer, and set the variable to do Conversion -> Convert Real to Integer. Next is the condition, every .2 seconds the game will check to see if your total experience is higher than how much you need to level, then it runs the trigger. Next, I modified 3 variables and set another one, Just modify your hero level to increase by 1, modify your agility count to increase by 2, and then subtract the Local Total XP - the XP needed. I will go over the set variable in the next step. Then, I created an action that adds an ability to a unit, you want to add 2 agility to your hero, from your hero. This way it will make the hero cast agility on itself to increase the numbers. Then you can take your dialog items that you set in the first trigger, and copy them over to this one, this will just update your labels on the dialog.
Fourteenth Step: This step is for creating the Set Variable action to make it automatically increase the amount of experience needed for each level.
First I set the first variable to XP Needed, then I changed the value to the Arithmetic Multiple (Integer). Here I chaged the operator to addition.
Then I double clicked on Integer+ to create another value that will be XP Needed as well. After that I double clicked on Integer+ again to make another Value that will be Arithmetic Multiple (Integer).
I set the operator to *, then I double clicked on Integer+ to set the first value to Hero Level, then I double clicked on Integer+ again to create another value, I set this to 100.
Now your variable should look something like this..
What this does is that when every level passes by, it will take the XP needed number, then multiply the product of the hero level and 100. This will automatically set your next levels all the way to whatever level max you want.
With this setup, every time my Hero levels, it will add 2 agility to the hero. It will appear as a buff and it wont expire. You can add as many different attributes as you'd like (as long as heroes can attain unlimited buffs)
I did a post for a different method in creating hero levels, much easier too I may add. I could make a guide with pictures soon if people want to. I still have yet to try out modifying attribute points.
Instead of using the Veterancy to set the individual levels. You just create the veterancy behavior with no levels on it, set the flags to hidden, and then apply it to your unit. Now your unit can gain experience but you can't see where your total is, this is where triggers come into play.
Global Variable
-> Real Variable (for your total xp)
Event
-> Unit gains experience
Variables
-> Real Variable (Trigger XP) - Triggering Experience
Action
-> Modify (Real) - Total XP + Trigger XP
This will add your experience up in a variable, and just imagine what you can accomplish just using the triggers and leveling. I found this way much easier to make levels for your hero instead of messing with the glitchy veterancy behavior.
To see your total experience, just create a dialog box and items that display your current level and your total xp, or xp needed, or whatever you wish.
0
@willuwontu: Go
Problem with that is I want to attack it, not just move the position - my previous example of 'move' was just for testing and I left it. Moving to the position of a unit (not to the unit itself) does work though.
0
So I tested it a little bit more.
The attack 'ends' if my target that I've queued up is no longer in vision, that would explain why it worked when I targeted one of my own units.
This is a problem though, because the mechanic I'm working on is going to end up as a 'tracking' mechanic. If you queue up an attack on a unit that no longer has vision, it will make a best attempt to find that unit based on when the target unit was last visible (aka chase the unit into fog for X number of seconds).
0
@SomeoneTookMyNameTT: Go
It works when I retain vision, but when I replaced the order with a manually set order like you suggested, it still doesn't work.
I'm not sure if it has something to do with the position of the order where it doesn't want to take it, or what? I will try having the unit move back and forth to see if that works.
0
Works on different unit
Does not work on intended unit
0
@willuwontu:
With this suggestion, I thought about it a little, and instead of having the current queued order replace and have the rest of the orders before that get placed before the existing queue, I would just save the order for later (after rebuilding the queue) and place the recent order to the end. I get much better results with the queuing.. but I'm still having an issue with getting the attack order to stick on that unit. Videos to follow.
0
Move to position of unit does work, but the purpose is to be able to target the unit directly. It is only set to move as a test, my ultimate goal is to have it issue the attack order instead.. and the path isn't completely blocked.
I'll post some videos in a little bit showing what it does.
0
Thanks for your response on this.
The reason why it goes 'before existing orders' is because it is a queued action.
Let say this is your order queue:
0 - Move to point
1 - Move to point
2 - Attack to point
3 - Move to point
Then, with my current script - it takes an attack on a unit, and changes it to move to unit, it would do this:
0 - Attack to unit -> 0 - Move to unit
THEN
0 - Move to point
1 - Move to point
2 - Attack to point
3 - Move to point
4 - Move to unit
This would keep the current queue intact, and modify the most recent queued up command and have it stay at the end. When I initially target the unit I really want to move to, it doesn't actually move to it (this is a queued order, which after the order at position 3 is executed, the unit is no longer in range or in vision for order 4, and the unit stops). If I target a different unit, it redirects it to the target and ends up moving to the unit just fine, out of range and out of vision as well.
Not sure if I'm explaining the issue well at all.. I could try to get a video of it for an example if that would help.
0
Sorry I know this thread is a little old, but I'm working on queue manipulation myself and noticed this..
So I've modified this example so that it watches for an attack on a unit (focused on one unit for control) and moved the variables to be global instead of local.
The problem I am running into here is when I actually target the Ghost (this ghost - Ghost [19.94, 59.93]) - it doesn't really 'replace' the order. When I target other units, it issues the move order to the correct unit just fine.. only when I target the unit I actually want to move to, then it has a problem. Any ideas?
0
Hey everyone,
I'm trying to mess around with the editor to get command queuing to behave similar to SC1.
What I'm trying to replicate is queuing up an attack order on a unit that eventually goes into fog. For instance, shift attacking a unit when it is visible and it happens to go outside vision.
In SC1, the queued attack on a unit that enters fog is still pursued for a little bit of time (roughly 10-15 seconds) before giving up, if it does manage to see the unit after chasing into fog within that time frame it will execute the attack.
In SC2 I am seeing that the queued attack order is cancelled if the path length is over a certain amount, regardless if the unit moved or not.
I'm not entirely sure if this makes sense, but I'm curious if anyone has been able to figure out if data needs to be modified, or if it needs to be triggered in a custom queue. Any suggestions?
0
@xandramas: Go
Here we go.. I added a more detail step by step in triggering it. I hope it clears more things up.
0
If this isn't helpful enough, I can put into detail how to make the triggers add experience to your hero. its pretty simple if you look at the events list under triggers.. you might get a clue.
0
Yeah I uploaded to imageshack and tried to paste the link directly and it doesnt work.. I have attachments on there showing the pictures though.
0
First step: Create your hero using the Hero making guide found Here
Second step: Go to Behaviors under Data and create a behavior name (whichever you want, I used veterancy) and behavior type to be Veterancy
Third step: Set the following fields like mine, do not add veterancy levels
Fourth step: Create another behavior named (whichever stat you like, I picked Agility) and behavior type to be Buff
Fifth step: THIS IS THE MOST IMPORTANT STEP set the fields "Max Stack Count" and "Max Stack Count Per Caster" to a high number, I picked 255 for a max of stats.
Sixth step: go into the modification field and scroll down till you see damage (unscaled) and change the type of damage, for me I changed melee and ranged to 10
Seventh step: Be sure to add the veterancy behavior to your hero, click on your hero under the Unit section in Data, click on the Behavior field, and add veterancy.
TRIGGERS
Eighth step: First, I started with creating variables for all the things I will be using for the level dialog and such. Incase you are unaware on how to do that, you right click in the empty space on the left side of your trigger editor, mouse over to new, and then mouse over to new variable and click.
Ninth Step: Click on the newly created variable and mouse over to where you see type in the center of the trigger page, click on it and scroll down to dialog. Then you can rename it to whatever you like by right clicking on the variable and renaming it, I chose to name it Stats Dialog.
Tenth Step: Next, I created more variables to use, I created 3 dialog items, 3 integers, and a real variable. I named them like so. I set the XP Needed to 100 and the Hero Level to 1 to start things off.
Eleventh Step: Now, right click in the empty space on the left and mouse over to new, then mouse down to new trigger. This part is a little tedious but this is where we make a dialog box that shows your current level, xp, and attribute points.
1. I started out by making an event for this trigger, a map initialization trigger so that this will run right away.
2. I created a dialog 300x300 and placed it at the center of the screen (for testing purposes). Then I set the Stats dialog variable so that I can easily manipulate this dialog at a later time. Then I set it to show so that we can see the dialog that was just created.
3. Next I made a dialog item(label) and set the variable to Level Dialog Item. Next I moved the label 50x50 from the top left of the dialog so it looks better. Next I use the combine text for setting the text and I set the label accordingly. This way it will say "Level: " then the current level of the hero.
4. Again, I make another dialog item that is XP dialog item, then I used the Combine Text Multiple to make it show the current XP and how much XP is needed left. I set the size of the item so that it can show all the numbers correctly without chopping to the next line, and then I moved it 50x75, 25 units further than the last item so it shows in a list.
5. Now I created a dialog item and then set it to Agility Dialog Item. I set the size of it and then moved it 25 more units than the previous item. I set the text just like the Level text I set earlier. Now you are done with the dialog portion.
Twelfth Step: This next step is pretty simple. All I did here was set an event for when the unit gains experience, it runs the trigger. I set a local (Real) variable named Gained XP. Then down at the actions I just had it modify the Total XP variable to add to the Gained XP variable, then it would refresh the XP dialog item text. You can just copy this action trigger from the first trigger we made because it will display the same thing.
Thirteenth Step: This step isn't so bad either. I set an Event timer for every .2 seconds of the game (you can make it faster or slower if you like) then I made a local variable that is called Total XP. This local variable actually is a conversion variable. So when you create an integer variable, make sure you click the link at the bottom of the integer, and set the variable to do Conversion -> Convert Real to Integer. Next is the condition, every .2 seconds the game will check to see if your total experience is higher than how much you need to level, then it runs the trigger. Next, I modified 3 variables and set another one, Just modify your hero level to increase by 1, modify your agility count to increase by 2, and then subtract the Local Total XP - the XP needed. I will go over the set variable in the next step. Then, I created an action that adds an ability to a unit, you want to add 2 agility to your hero, from your hero. This way it will make the hero cast agility on itself to increase the numbers. Then you can take your dialog items that you set in the first trigger, and copy them over to this one, this will just update your labels on the dialog.
Fourteenth Step: This step is for creating the Set Variable action to make it automatically increase the amount of experience needed for each level.
First I set the first variable to XP Needed, then I changed the value to the Arithmetic Multiple (Integer). Here I chaged the operator to addition.
Then I double clicked on Integer+ to create another value that will be XP Needed as well. After that I double clicked on Integer+ again to make another Value that will be Arithmetic Multiple (Integer).
I set the operator to *, then I double clicked on Integer+ to set the first value to Hero Level, then I double clicked on Integer+ again to create another value, I set this to 100.
Now your variable should look something like this..
What this does is that when every level passes by, it will take the XP needed number, then multiply the product of the hero level and 100. This will automatically set your next levels all the way to whatever level max you want.
With this setup, every time my Hero levels, it will add 2 agility to the hero. It will appear as a buff and it wont expire. You can add as many different attributes as you'd like (as long as heroes can attain unlimited buffs)
0
I did a post for a different method in creating hero levels, much easier too I may add. I could make a guide with pictures soon if people want to. I still have yet to try out modifying attribute points.
0
Instead of using the Veterancy to set the individual levels. You just create the veterancy behavior with no levels on it, set the flags to hidden, and then apply it to your unit. Now your unit can gain experience but you can't see where your total is, this is where triggers come into play.
Global Variable
-> Real Variable (for your total xp)
Event
-> Unit gains experience
Variables
-> Real Variable (Trigger XP) - Triggering Experience
Action
-> Modify (Real) - Total XP + Trigger XP
This will add your experience up in a variable, and just imagine what you can accomplish just using the triggers and leveling. I found this way much easier to make levels for your hero instead of messing with the glitchy veterancy behavior.
To see your total experience, just create a dialog box and items that display your current level and your total xp, or xp needed, or whatever you wish.