I want a player to add or remove a specific ability from a unit by pressing a hotkey. I don't want to use a trigger. Is it possible to do this using the data editor?
A unit has a targeted ability with the "smart-click" flag enabled. As long as the unit is selected, if the player right-clicks on the map, the unit will automatically fire the ability at the target point. This is great because it lets me simulate right-click firing without the need for a trigger.
The problem is that as long as this ability is enabled the player cannot move the unit normally, because firing the ability cancels out the move order.
I want the player to be able to disable this ability instantly with a hotkey, so that he can move the unit, and then enable it instantly so the unit can fire the ability.
Yes, but they have to hit the Move hotkey every time they want to issue a new move order. If I can disable the fire ability with a hotkey, then the player can click-move as many times as they want before enabling the ability again.
Is there any particular reason they have to be able to right-click the ability? The reason I ask is, it would seem more intuitive to me to use a hotkey to use an ability, rather than use a hotkey to turn an ability on and off, unless it was a buff of some sort.
The map will be setup as an action RTS and will use projectile-based abilities for the hero's main attack. Being able to rapidly fire the attack is a key concept and the only way I know to do it (without triggers) is to set it up as a smart-click ability.
Ok. Well that makes sense. I don't know a sure fire way to do this via data off the top of my head. I think a trigger would work better for you anyway, but if that's not an option..... Perhaps there is a way of creating a validator that can read if a hidden behavior is on or off the character. The ability wont' trigger without the validator, and the validator won't return unless the behavior is on the character. This would require 2 abilities in addition to the actual ability, 1 to apply the behavior and one to remove it.
edit for clarification: You could then add these behavior abilities to a button on the command card, which, of course, can use the hotkey to toggle.
I don't know if that will work, but that's the first thing that comes to mind.
Well, this one will teach you about applying and removing behaviors, and using validators to check those behaviors. It's a bit far off from what you want to do, but the core mechanics should help you understand what is needed.
Simple. Make the ability require a specific behaviour. Open requirements, make a new one, and set the "Use" field to require a custom behaviour "completed at unit".
Now give this behaviour to a toggle ability (eg cloak) and give that your desired hotkey.
I have to say that this would probably be highly unintuitive.
I want a player to add or remove a specific ability from a unit by pressing a hotkey. I don't want to use a trigger. Is it possible to do this using the data editor?
@swanky_yankie: Go
Edit: I think I spoke too soon. What kind of ability are you talking about?
I'll try to explain what I'm going for.
A unit has a targeted ability with the "smart-click" flag enabled. As long as the unit is selected, if the player right-clicks on the map, the unit will automatically fire the ability at the target point. This is great because it lets me simulate right-click firing without the need for a trigger.
The problem is that as long as this ability is enabled the player cannot move the unit normally, because firing the ability cancels out the move order.
I want the player to be able to disable this ability instantly with a hotkey, so that he can move the unit, and then enable it instantly so the unit can fire the ability.
@swanky_yankie: Go
Can't they just hit M(Move) then ?
Yes, but they have to hit the Move hotkey every time they want to issue a new move order. If I can disable the fire ability with a hotkey, then the player can click-move as many times as they want before enabling the ability again.
It seems more intuitive to me.
@swanky_yankie: Go
Is there any particular reason they have to be able to right-click the ability? The reason I ask is, it would seem more intuitive to me to use a hotkey to use an ability, rather than use a hotkey to turn an ability on and off, unless it was a buff of some sort.
The map will be setup as an action RTS and will use projectile-based abilities for the hero's main attack. Being able to rapidly fire the attack is a key concept and the only way I know to do it (without triggers) is to set it up as a smart-click ability.
@swanky_yankie: Go
Ok. Well that makes sense. I don't know a sure fire way to do this via data off the top of my head. I think a trigger would work better for you anyway, but if that's not an option..... Perhaps there is a way of creating a validator that can read if a hidden behavior is on or off the character. The ability wont' trigger without the validator, and the validator won't return unless the behavior is on the character. This would require 2 abilities in addition to the actual ability, 1 to apply the behavior and one to remove it.
edit for clarification: You could then add these behavior abilities to a button on the command card, which, of course, can use the hotkey to toggle.
I don't know if that will work, but that's the first thing that comes to mind.
I'm only against triggers because key-press events cause network lag.
I figured it would involve validators, but I know nothing about them. Are there any good tutorials that could get me started?
@swanky_yankie: Go
Well, this one will teach you about applying and removing behaviors, and using validators to check those behaviors. It's a bit far off from what you want to do, but the core mechanics should help you understand what is needed.
@Snappybean: Go
Thanks for the input. :)
Simple. Make the ability require a specific behaviour. Open requirements, make a new one, and set the "Use" field to require a custom behaviour "completed at unit".
Now give this behaviour to a toggle ability (eg cloak) and give that your desired hotkey.
I have to say that this would probably be highly unintuitive.
That works perfectly, Eiviyn, thank you!
The system is fairly intuitive because the player only controls one unit on my map. Controlling multiple units would be unintuitive with this setup.
But why can't map-makers simply bind functions to the mouse buttons in the data editor? :(
edit: This works better than I had hoped :)
@Eiviyn: Go
Much easier than my idea. Good info to have.
Don't you think, that normal hotkey would be better than this? Player can just hold down hotkey, and rapidly click - same effect.