1) I'm working on an ability that makes an unit fly for a short time. So, I just used the upgrade method to make the unit mover type Flyer, but then, I also need to change the collide, and it can not be changed with Behaviors/Upgrades (or at least I don't know how). So, anyone know how to change the unit collide fields and then revert it back when the effect is done?
2) There are neutral units that spawns on one side and move-attack to the other side of the map (think like DotA path). The problem is: they are stopping midway when they get stunned or moved instantly with any ability trigger, like if their current order get canceled.
I tried to use the Unit becomes IDLE event, but the unit is considered IDLE when they BECOME stunned, and not when they leave the stun, and since they can't receive orders while stunned, it doesn't work.
Is there any way to make them keep move/attacking until the destination point besides keep picking all units in the map every 1 second and ordering them to move-attacl to the destination point again?
Eh, I'm not enough of a data editor to know how to fix #1, but #2 seems easy. Just introduce a "lag" in the form of a wait that lasts as long as the stun is before issuing a command. That should pick up the unit being stunned, wait till it is done being stunned, then issue the order. Of course, if you have various stun lengths, you'll want to set the "lag" to the longest one.
I.E. (Assumign 4 sec is maximum stun duration):
Unit stunned for 2 sec, becomes idle
Trigger picks up Idle unit, Waits for 4 sec
Trigger issues command to unit
Unit stunned for 4 sec, becomes idle
....
etc
solve number one by the ability causing the unit to morph into another unit with all the abilities you want. your duration can be regulated in a few ways but the one that comes to mind is setting energy regen rate on that unit to 1 and setting max energy to whatever time in seconds you want it to last. make it morph back when the mana pool fills.
That is a good way to "bandaid" it :P, but the problem is that it doesn't only occur with stun effects. There are also some other effects in my map that causes it as I said, like Wander from fear, move instantly trigger from some abilities, etc. While the wait + reorder might work if I just apply it to each effect that cause the loss of order on the units, I believe that there is a better way to do it.
What happens with trigger variables refering to the old unit if I use the morph style? I mean, if there is a trigger for some ability running with the variable set to the unit X, and now the unit X is morphed into another unit (with the same abilities but no ground collide which is the case), do the variables get lost or they update to the new unit?
As for the duration it is not really a problem, since it is like a fly ability, it has a specific duration, so I could just "unmorph" the unit after Y seconds.
You can create a behavior with an expire effect that's something like Issue Order "Move Again" (which can just be some blank ability)
then you can create a trigger with the event: Unit uses ability MoveAgain,
and cause that unit to move toward your desired location.
OR
You can create a function/action definition which takes a time X and a unit as a parameters. Make the function wait X seconds then issue your desired attack-move order, then you can apply this action to any trigger effects which cause loss of control.
There's a great many other ways to implement this too. I would personally just put in a 5 or 10 second timer that picks all units against some conditions, such as the stationary validator and orders them to move again. Frankly, I'm a bit surprised that stunning actually removes a unit's attack orders.
As for #2, morphing won't interfere with variables like that. If unit is stored in the variable: KILLA UNIT and morphs, KILLA UNIT will still refer to that same unit.
Nice to know about the morph thing, i'll probably do it.
Tho, is it possible to change collide with catalog fields? That probably would be the best way to do it if it is possible. Still, it's fine that the morph method will work as intended.
As for the Issue Order ability with trigger, I don't understand how that trigger would ever run. Does the Issue Order in "blank" ability just runs everytime?
The ability would be called something like "Move Again" but it wouldn't actually do anything. It would exist solely to be registered by a trigger with the event "Unit uses the ability Move Again"
Yea now I understand what you said
Tho, seems like all solutions to this problem involves the "keep ordering them back to move-attack" method.
Yes, it works, but, the question is... is it efficient? Isn't there a way to just reorder the unit ?
Thanks for the suggestions everyone
But, if you have a more efficient way to do these, plz let me know ^^
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
1) I'm working on an ability that makes an unit fly for a short time. So, I just used the upgrade method to make the unit mover type Flyer, but then, I also need to change the collide, and it can not be changed with Behaviors/Upgrades (or at least I don't know how). So, anyone know how to change the unit collide fields and then revert it back when the effect is done?
2) There are neutral units that spawns on one side and move-attack to the other side of the map (think like DotA path). The problem is: they are stopping midway when they get stunned or moved instantly with any ability trigger, like if their current order get canceled. I tried to use the Unit becomes IDLE event, but the unit is considered IDLE when they BECOME stunned, and not when they leave the stun, and since they can't receive orders while stunned, it doesn't work. Is there any way to make them keep move/attacking until the destination point besides keep picking all units in the map every 1 second and ordering them to move-attacl to the destination point again?
Eh, I'm not enough of a data editor to know how to fix #1, but #2 seems easy. Just introduce a "lag" in the form of a wait that lasts as long as the stun is before issuing a command. That should pick up the unit being stunned, wait till it is done being stunned, then issue the order. Of course, if you have various stun lengths, you'll want to set the "lag" to the longest one.
I.E. (Assumign 4 sec is maximum stun duration):
Unit stunned for 2 sec, becomes idle
Trigger picks up Idle unit, Waits for 4 sec
Trigger issues command to unit
Unit stunned for 4 sec, becomes idle
....
etc
@Metrael: Go
solve number one by the ability causing the unit to morph into another unit with all the abilities you want. your duration can be regulated in a few ways but the one that comes to mind is setting energy regen rate on that unit to 1 and setting max energy to whatever time in seconds you want it to last. make it morph back when the mana pool fills.
@UltiDrgn: Go
That is a good way to "bandaid" it :P, but the problem is that it doesn't only occur with stun effects. There are also some other effects in my map that causes it as I said, like Wander from fear, move instantly trigger from some abilities, etc. While the wait + reorder might work if I just apply it to each effect that cause the loss of order on the units, I believe that there is a better way to do it.
@happy04: Go
What happens with trigger variables refering to the old unit if I use the morph style? I mean, if there is a trigger for some ability running with the variable set to the unit X, and now the unit X is morphed into another unit (with the same abilities but no ground collide which is the case), do the variables get lost or they update to the new unit? As for the duration it is not really a problem, since it is like a fly ability, it has a specific duration, so I could just "unmorph" the unit after Y seconds.
bumping
Bump again \;
@Metrael:
For #1:
You can create a behavior with an expire effect that's something like Issue Order "Move Again" (which can just be some blank ability)
then you can create a trigger with the event: Unit uses ability MoveAgain,
and cause that unit to move toward your desired location.
OR
You can create a function/action definition which takes a time X and a unit as a parameters. Make the function wait X seconds then issue your desired attack-move order, then you can apply this action to any trigger effects which cause loss of control.
There's a great many other ways to implement this too. I would personally just put in a 5 or 10 second timer that picks all units against some conditions, such as the stationary validator and orders them to move again. Frankly, I'm a bit surprised that stunning actually removes a unit's attack orders.
As for #2, morphing won't interfere with variables like that. If unit is stored in the variable: KILLA UNIT and morphs, KILLA UNIT will still refer to that same unit.
@xenrathe: Go
Nice to know about the morph thing, i'll probably do it. Tho, is it possible to change collide with catalog fields? That probably would be the best way to do it if it is possible. Still, it's fine that the morph method will work as intended.
As for the Issue Order ability with trigger, I don't understand how that trigger would ever run. Does the Issue Order in "blank" ability just runs everytime?
@Metrael:
The ability would be called something like "Move Again" but it wouldn't actually do anything. It would exist solely to be registered by a trigger with the event "Unit uses the ability Move Again"
@xenrathe: Go
Yea now I understand what you said Tho, seems like all solutions to this problem involves the "keep ordering them back to move-attack" method. Yes, it works, but, the question is... is it efficient? Isn't there a way to just reorder the unit ?
Thanks for the suggestions everyone But, if you have a more efficient way to do these, plz let me know ^^