Is there any way to set up the minimap so when you click over it, the game will detect the click as if you were clicking on the terrain behind the map? Maybe by modifying something in the SC2Layout files?
You would have to get the UI position of the click and project that position into the game world. I think there was a library released about a month back that will allow you to project a UI position into World position and vice versa, unsure of the name though.
I don't have access to an editor right now but you should be able to detect the UI position and multiply that by a certain value (depending on the size of your map) and you should get an approximate x/y position on the map if your maths are right. Bigger maps would yield more accurate results. You can use a repeating loop (WHILE loop) to update the cursor position and use Mouse Button Clicked as an event in a separate trigger.
That is a good idea, and I've actually tried making a workaround like that. Getting the button click and mouse position worked correctly. However, I was never able to detect the mouse release this way, and my map really depends on it. You see, when you hold the mouse down, you continue shooting. So if you start shooting by clicking over the map (on the button), you won't stop shooting by releasing the mouse.
If you know how I can get around that, then I can continue pursuing this idea. Otherwise I'll want to continue looking for a different solution.
Btw: A weird thing I noticed when placing a button over the map was that the mouse move event would correctly detect the mouse world position under the minimap, which it did not previously do when there was no button there. So there was no need to use UI coordinates and translate them.
Just set a switch to TRUE then the mouse button is clicked DOWN, then use another trigger with the event "Left (or right) Mouse button clicked UP" with actions that set the switch to FALSE. Then you can use a while loop that fires while the "Shoot" switch is TRUE.
I'm going to assume you didn't read the whole thread. No mouse click triggers will fire when you click on the minimap.
Mouse click triggers will also not fire if you click a dialog button. Consequently, the mouse release trigger will not fire if you have clicked on a dialog button. This makes it (as far as I can tell) impossible to detect when you have released the mouse after clicking a dialog button. This is what makes a dialog button an insufficient workaround for detecting mouse clicks above the minimap.
Oh I see. I wasn't sure what you meant about that at first. The only thing I can think of that might work then is to replace the minimap with an image.
If anyone is interested in doing the same, you can enable mouse clicks through the minimap by adding the value <AcceptsMouse val="false"/> to "MinimapPanelTemplate/Minimap" in MinimapPanel.SC2Layout
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Is there any way to set up the minimap so when you click over it, the game will detect the click as if you were clicking on the terrain behind the map? Maybe by modifying something in the SC2Layout files?
You would have to get the UI position of the click and project that position into the game world. I think there was a library released about a month back that will allow you to project a UI position into World position and vice versa, unsure of the name though.
Even if I'd do that, I still need the click to be registered. Currently it is not.
@Builder_Bob: Go
I don't have access to an editor right now but you should be able to detect the UI position and multiply that by a certain value (depending on the size of your map) and you should get an approximate x/y position on the map if your maths are right. Bigger maps would yield more accurate results. You can use a repeating loop (WHILE loop) to update the cursor position and use Mouse Button Clicked as an event in a separate trigger.
@BasharTeg: Go
That is a good idea, and I've actually tried making a workaround like that. Getting the button click and mouse position worked correctly. However, I was never able to detect the mouse release this way, and my map really depends on it. You see, when you hold the mouse down, you continue shooting. So if you start shooting by clicking over the map (on the button), you won't stop shooting by releasing the mouse.
If you know how I can get around that, then I can continue pursuing this idea. Otherwise I'll want to continue looking for a different solution.
Btw: A weird thing I noticed when placing a button over the map was that the mouse move event would correctly detect the mouse world position under the minimap, which it did not previously do when there was no button there. So there was no need to use UI coordinates and translate them.
@Builder_Bob: Go
Just set a switch to TRUE then the mouse button is clicked DOWN, then use another trigger with the event "Left (or right) Mouse button clicked UP" with actions that set the switch to FALSE. Then you can use a while loop that fires while the "Shoot" switch is TRUE.
@BasharTeg: Go
I'm going to assume you didn't read the whole thread. No mouse click triggers will fire when you click on the minimap.
Mouse click triggers will also not fire if you click a dialog button. Consequently, the mouse release trigger will not fire if you have clicked on a dialog button. This makes it (as far as I can tell) impossible to detect when you have released the mouse after clicking a dialog button. This is what makes a dialog button an insufficient workaround for detecting mouse clicks above the minimap.
Oh I see. I wasn't sure what you meant about that at first. The only thing I can think of that might work then is to replace the minimap with an image.
@BasharTeg: Go
That could work. I'll keep that in mind as a backup solution if there is no other way.
Bump
Maybe this can be done by modifying something in the SC2Layout files?
bump
Solved!
If anyone is interested in doing the same, you can enable mouse clicks through the minimap by adding the value <AcceptsMouse val="false"/> to "MinimapPanelTemplate/Minimap" in MinimapPanel.SC2Layout