Usually when a unit uses a targeted ability or effect, the player's cursor turns in to a crosshairs and allows them to select the target.
My question is, how do I do this with Triggers?
I am aware of the functions "Order Unit" and "Create Effect", but all of those seem to require a point be entered in the Trigger (no option to solicit player input).
For any who are interested, I have implemented a hack to accomplish this using Triggers. Note that I am using dialog boxes rather than command buttons for my spells, since they change frequently during game play.
This is not pretty and ideally I would like to be able to use the built-in methods to do this (i.e. whatever happens when you use targeted command card abilities). If you have a better method or idea of how I can more easily make it work like a command card ability, please post it!!
Here's how it works:
1) I have two global variables: TargetingPlayers = False <Boolean[16]> and PendingSpells = 0 <Integer[16]>.
2) I have a Trigger that runs on event "any player clicks a dialog box". If the dialog box clicked corresponds to a spell which requires a target, then TargetingPlayers[(Triggering Player)] = True and PendingSpells[(Triggering Player)] = spellID (the spell ID is looked up based on the dialog that was clicked).
3) I have a different Trigger that runs on event "any player clicks mouse button". Whenever a player clicks a mouse button, this checks all the values in TargetingPlayers. If any of the values in TargetingPlayers is True, then the coordinates of the mouse click are recorded in local variables and then the spell in PendingSpells[(Triggering Player)] is cast, passing the proper mouse coordinates in as a point. TargetingPlayers and PendingSpells are then reset to their default values since the spell has been cast.
ISSUES with this are:
- Requires Triggers that run all the time on all mouse clicks (and key clicks too because I want players to be able to set hotkeys for the dialog box spells). This generates a fair amount of traffic.
- I'm not sure how to change the player cursor to crosshairs to indicate they are in targeting mode. This happens automatically when targeted effects are applied by an ability being used from the command card.
Usually when a unit uses a targeted ability or effect, the player's cursor turns in to a crosshairs and allows them to select the target.
My question is, how do I do this with Triggers?
I am aware of the functions "Order Unit" and "Create Effect", but all of those seem to require a point be entered in the Trigger (no option to solicit player input).
Does anyone know how to do this?
@kappyd23s: Go
For any who are interested, I have implemented a hack to accomplish this using Triggers. Note that I am using dialog boxes rather than command buttons for my spells, since they change frequently during game play.
This is not pretty and ideally I would like to be able to use the built-in methods to do this (i.e. whatever happens when you use targeted command card abilities). If you have a better method or idea of how I can more easily make it work like a command card ability, please post it!!
Here's how it works:
1) I have two global variables: TargetingPlayers = False <Boolean[16]> and PendingSpells = 0 <Integer[16]>.
2) I have a Trigger that runs on event "any player clicks a dialog box". If the dialog box clicked corresponds to a spell which requires a target, then TargetingPlayers[(Triggering Player)] = True and PendingSpells[(Triggering Player)] = spellID (the spell ID is looked up based on the dialog that was clicked).
3) I have a different Trigger that runs on event "any player clicks mouse button". Whenever a player clicks a mouse button, this checks all the values in TargetingPlayers. If any of the values in TargetingPlayers is True, then the coordinates of the mouse click are recorded in local variables and then the spell in PendingSpells[(Triggering Player)] is cast, passing the proper mouse coordinates in as a point. TargetingPlayers and PendingSpells are then reset to their default values since the spell has been cast.
ISSUES with this are:
- Requires Triggers that run all the time on all mouse clicks (and key clicks too because I want players to be able to set hotkeys for the dialog box spells). This generates a fair amount of traffic.
- I'm not sure how to change the player cursor to crosshairs to indicate they are in targeting mode. This happens automatically when targeted effects are applied by an ability being used from the command card.