I am trying to make a trigger that runs an action once you right click a unit. I've messed with the mouse right click function but it doesn't reference any units. How would I go about doing this?
It is. Everytime a unit is highlighted, store it as currently highlighted unit for the triggering player. When a player presses the right mouse button down, run your actions with the stored unit for that player.
Okay so I tried using the Bank - Store Unit and Restore Unit, so that part is good but I need to set up a bank file? I opened a bank file in map initialization but I have no idea how banks work and idk what key and sections are.. can you help me with the triggers on setting it up or is there a better way without using a bank file to get the same desired trigger effect.
No need to use banks for this. Create a global variable of type unit. Everytime the player highlights a unit, set the global variable to the triggering unit. Once he unhighlights the unit, set the variable to "No Unit".
If the map is designed for multiplayer you can make the variable an array and use triggering player as array index when setting or reading it.
If you are trying to get it so while having a unit selected, it performs an ability with a right click, you can use smart commands. It takes a little bit of configuration but you'll have a more efficient result.
Rollback Post to RevisionRollBack
Starcraft2 mapping is an art. It is inspired by the soul and crafted from within and brought out, but not all artists have the skills to create it, which is why I need data/trigger editors. Come find me if you want to be part of something great.
To post a comment, please login or register a new account.
I am trying to make a trigger that runs an action once you right click a unit. I've messed with the mouse right click function but it doesn't reference any units. How would I go about doing this?
don't think this one is possible actually.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
It is. Everytime a unit is highlighted, store it as currently highlighted unit for the triggering player. When a player presses the right mouse button down, run your actions with the stored unit for that player.
or just issue order the currently selected unit by triggering player
Won't work, as right click does not select units. Also the player might have multiple units selected.
@Mille25: Go
Okay so I tried using the Bank - Store Unit and Restore Unit, so that part is good but I need to set up a bank file? I opened a bank file in map initialization but I have no idea how banks work and idk what key and sections are.. can you help me with the triggers on setting it up or is there a better way without using a bank file to get the same desired trigger effect.
Thanks.
@Risquetal: Go
No need to use banks for this. Create a global variable of type unit. Everytime the player highlights a unit, set the global variable to the triggering unit. Once he unhighlights the unit, set the variable to "No Unit".
If the map is designed for multiplayer you can make the variable an array and use triggering player as array index when setting or reading it.
@Mille25: Go
I did just this and its perfect thank you!
One thing, I set the variable as array but how do I set up the triggering player as array index as you said?
Edit: Oh did you mean Set - Variable[Triggering Player] = (Triggering Unit)?
@Risquetal: Go
Correct. Just make sure that the array has enough elements for all possible triggering player values.
@Mille25: Go
So I make array value 8 for 8 players and what of dimensions?
@Risquetal: Go
1 Dimension would be all you need
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
@willuwontu: Go
Okay thank you very much :D
If you are trying to get it so while having a unit selected, it performs an ability with a right click, you can use smart commands. It takes a little bit of configuration but you'll have a more efficient result.