I've looked at 3 different tutorials here, and I'm still stumped. I have a button in a dialog i made, and I just want the player to be able to calldown a unit in the same way as they would a M.U.L.E. when they press it.
When i detect that the dialog button was pressed by a player, how do i then assign the calldown effect to the player?
Also you could make an off map unit which has the create unit ability and when the dialog button is clicked, order that unit to use the ability you wish to use, in this case the create unit. This will enable you to select where the units are created.
I still can't seem to get it to work. I can get the thor to calldown to a specific location/point but i cant give teh player the control to choose where he'll land.
//
my map is set up so that when a player accumulates six vespian gas, a dialog pops up on the left hand side of the screen. That dialog stays there until they click the only button in the dialog. A new dialog cannot be created for that player if one is already showing. Once the button is clicked, I can determine which player clicked it, and then destroy the dialog so it no longer shows - until the next time the player accumulates six vespian gas.
Once the player clicks on the dialog button, I want to make the user then have to choose a point on the map to call down a unit. The unit is easily changeable, and in this case, I have it set to call down a Thor.
The problem I'm having is, I can run the Calldown effect with [Environment - Create Effect At Point] and that will handle all of the Calldown animations, unit spawn, etc. But, from what I can tell, I have to specify a point on the map in the trigger where I want the Thor to land. Not in-game.
I tried giving a neutral unit the ability to Build-Thor and then Order that unit to do so, but I can't figure out how to apply the Calldown effects and letting the current player choose where it should land.
That's a bit more complicated, but certainly possible. Have it so that when the player clicks the button, a boolean variable array is set to ON. Make the variable global with an array size matching the number of players in the game. Call it Drop Enabled.
Create two Real variable arrays to store the position of the mouse on the X/Y coordinate plane. Again, make the size of the arrays for both match the number of players in the game. Call these variables 'X Pos' and 'Y Pos.'
Now create a new trigger with the event type Mouse Moved and call it "Drop Pos Tracker." Use an If/Then/Else statement in actions. For the conditions of the If/Then/Else statement, add Drop Enabled[Triggering Player] == True. Under actions, set X Pos = Mouse Moved World Pos X. Then set Y Pos = Mouse Moved World Pos Y.
Now the game will track the player's mouse position in the game world after he clicks the "Drop" button.
Make a new trigger called "Drop Execute." Make the event "Mouse Clicked" like this: "UI - Player Any Player clicks Left mouse button Down." Use an If/Then/Else statement like you did in "Drop Pos Tracker" with the same condition, Drop Enabled[Triggering Player] == True. Under actions, set Drop Enabled[Triggering Player] == false and execute the drop pod effect at coordinates X Pos, Y Pos.
That should set up what you are looking for, basically. You'll have to do some tweaking to make it perfect.
There's no tidy way to make a dialog based targeted ability.
I'd consider removing the ability to choose a target point and simply drop the unit in either a pre-defined location or near some hero/special unit.
If you really must have target selection, consider the above suggestion of having a hidden unit with a selection of calldown abilities, or failing that, an absolute last resort, "player clicks" triggers.
I do this in my map. Basically I've got it setup like so.
Create unit Effect.
Create Persisitant Effect.
When the Dialog Button is clicked I have a trigger that sets a variable to something like "PlayerTargeting"
And I have another trigger that's tracking mouse clicks. When they click and the Variable "PlayerTargeting" is set it'll run the Persistant effect at mouse click position, which summons a unit after a 2 second delay there. I have an actor that plays the droppod art at this time. Then I unset the PlayerTargeting variable and am good to go.
Okay, I'll save the trigger down-click detection as a last resort... but I do have a question then about the hidden unit idea. How do I issue the hidden unit to preform the action (allowing the appropriate player to point where it should preform the calldown) without giving control of the hidden unit to the player? If I give control of it to a specific player then other players wont be able to use it simultaniously.
Assuming then that there has to be a hidden unit for each player that has the calldown ability, is there a way to allow the player to choose when to use it? The dialog idea allows the player to choose when to use it, rather than just having it done automatically as soon as it's available. Maybe the dialog button changes the unit selection to the hidden unit that has the calldown ability?
I'll start working on the PlayerTargeting thing assuming that's the direction I'm going to have to take - but we'll see.
I've looked at 3 different tutorials here, and I'm still stumped. I have a button in a dialog i made, and I just want the player to be able to calldown a unit in the same way as they would a M.U.L.E. when they press it.
When i detect that the dialog button was pressed by a player, how do i then assign the calldown effect to the player?
driving me crazy :(
Use the Create Effect at Point action using the position of the unit as the point
Also you could make an off map unit which has the create unit ability and when the dialog button is clicked, order that unit to use the ability you wish to use, in this case the create unit. This will enable you to select where the units are created.
I still can't seem to get it to work. I can get the thor to calldown to a specific location/point but i cant give teh player the control to choose where he'll land.
//
my map is set up so that when a player accumulates six vespian gas, a dialog pops up on the left hand side of the screen. That dialog stays there until they click the only button in the dialog. A new dialog cannot be created for that player if one is already showing. Once the button is clicked, I can determine which player clicked it, and then destroy the dialog so it no longer shows - until the next time the player accumulates six vespian gas.
Once the player clicks on the dialog button, I want to make the user then have to choose a point on the map to call down a unit. The unit is easily changeable, and in this case, I have it set to call down a Thor.
The problem I'm having is, I can run the Calldown effect with [Environment - Create Effect At Point] and that will handle all of the Calldown animations, unit spawn, etc. But, from what I can tell, I have to specify a point on the map in the trigger where I want the Thor to land. Not in-game.
I tried giving a neutral unit the ability to Build-Thor and then Order that unit to do so, but I can't figure out how to apply the Calldown effects and letting the current player choose where it should land.
@playpong: Go
Any ideas?
That's a bit more complicated, but certainly possible. Have it so that when the player clicks the button, a boolean variable array is set to ON. Make the variable global with an array size matching the number of players in the game. Call it Drop Enabled.
Create two Real variable arrays to store the position of the mouse on the X/Y coordinate plane. Again, make the size of the arrays for both match the number of players in the game. Call these variables 'X Pos' and 'Y Pos.'
Now create a new trigger with the event type Mouse Moved and call it "Drop Pos Tracker." Use an If/Then/Else statement in actions. For the conditions of the If/Then/Else statement, add Drop Enabled[Triggering Player] == True. Under actions, set X Pos = Mouse Moved World Pos X. Then set Y Pos = Mouse Moved World Pos Y.
Now the game will track the player's mouse position in the game world after he clicks the "Drop" button.
Make a new trigger called "Drop Execute." Make the event "Mouse Clicked" like this: "UI - Player Any Player clicks Left mouse button Down." Use an If/Then/Else statement like you did in "Drop Pos Tracker" with the same condition, Drop Enabled[Triggering Player] == True. Under actions, set Drop Enabled[Triggering Player] == false and execute the drop pod effect at coordinates X Pos, Y Pos.
That should set up what you are looking for, basically. You'll have to do some tweaking to make it perfect.
There's no tidy way to make a dialog based targeted ability.
I'd consider removing the ability to choose a target point and simply drop the unit in either a pre-defined location or near some hero/special unit.
If you really must have target selection, consider the above suggestion of having a hidden unit with a selection of calldown abilities, or failing that, an absolute last resort, "player clicks" triggers.
I do this in my map. Basically I've got it setup like so.
Create unit Effect.
Create Persisitant Effect.
When the Dialog Button is clicked I have a trigger that sets a variable to something like "PlayerTargeting"
And I have another trigger that's tracking mouse clicks. When they click and the Variable "PlayerTargeting" is set it'll run the Persistant effect at mouse click position, which summons a unit after a 2 second delay there. I have an actor that plays the droppod art at this time. Then I unset the PlayerTargeting variable and am good to go.
@Eiviyn: Go
Okay, I'll save the trigger down-click detection as a last resort... but I do have a question then about the hidden unit idea. How do I issue the hidden unit to preform the action (allowing the appropriate player to point where it should preform the calldown) without giving control of the hidden unit to the player? If I give control of it to a specific player then other players wont be able to use it simultaniously.
Assuming then that there has to be a hidden unit for each player that has the calldown ability, is there a way to allow the player to choose when to use it? The dialog idea allows the player to choose when to use it, rather than just having it done automatically as soon as it's available. Maybe the dialog button changes the unit selection to the hidden unit that has the calldown ability?
I'll start working on the PlayerTargeting thing assuming that's the direction I'm going to have to take - but we'll see.
That worked perfectly. Thanks for the help guys.