I have a unit with an effect-target ability. And I have a dialog button. I want the result of pressing the dialog button to be like I selected the unit and clicked the ability, so cursor become a "select point" one, and next click on a surface will execute the ability. How to do this? I know how to select the unit, but how to turn an ability into select target mode?
You can't. But you can do a workaround. One of the things you can do is when the dialog button is clicked, create an invisible unit somewhere on the map (make sure it's invulnerable.) Then with mouse tracking, run a loop to continuously move the invisible unit to the position of the mouse cursor. In this stage, when the player registers a left click, order the unit with the effect-target ability to use his ability targeting the invisible unit. Then kill the invisible unit, break the loop, stop the mouse tracking, and disable the left-click registration.
I have a unit with an effect-target ability. And I have a dialog button. I want the result of pressing the dialog button to be like I selected the unit and clicked the ability, so cursor become a "select point" one, and next click on a surface will execute the ability. How to do this? I know how to select the unit, but how to turn an ability into select target mode?
You can't. But you can do a workaround. One of the things you can do is when the dialog button is clicked, create an invisible unit somewhere on the map (make sure it's invulnerable.) Then with mouse tracking, run a loop to continuously move the invisible unit to the position of the mouse cursor. In this stage, when the player registers a left click, order the unit with the effect-target ability to use his ability targeting the invisible unit. Then kill the invisible unit, break the loop, stop the mouse tracking, and disable the left-click registration.
@BasharTeg: Go
Yeah, I was about to do something like this. Just was curious about the subj.