I'm trying to check if when the player clicks the mouse, if the x & y position is inside a region. I have many regions (over 60), and I have to know what region they click. Perhaps also save that region as a variable so I can perform actions with the unit attached to that region..
I'm familiar with the x & y mouse position trigger but can't seem to relate it to region bounds..
Update: I made a local point variable returning the 2D position of my mouse click. I suppose I could make 64 'if' statements to find which region that point is in, but hopefully there is a better way?
Make a if-then action. As a condition: make a comparison called "region contains point". If it returns true then it should be in the region. Remember that you can merge regions and make negative regions. They are very useful for complex shapes.
Edit: upon reading your post again, you want to know which region your player has clicked, not the other way around. I would suggest making an array with your 60 regions and then loop through them and check which one it is. Put the check in a function and make it return the region (or index of it). The annoying part is to make store the regions into the array, since you would have to make 60 SetVariable calls.
I'm trying to check if when the player clicks the mouse, if the x & y position is inside a region. I have many regions (over 60), and I have to know what region they click. Perhaps also save that region as a variable so I can perform actions with the unit attached to that region..
I'm familiar with the x & y mouse position trigger but can't seem to relate it to region bounds..
Update: I made a local point variable returning the 2D position of my mouse click. I suppose I could make 64 'if' statements to find which region that point is in, but hopefully there is a better way?
Make a if-then action. As a condition: make a comparison called "region contains point". If it returns true then it should be in the region. Remember that you can merge regions and make negative regions. They are very useful for complex shapes.
Edit: upon reading your post again, you want to know which region your player has clicked, not the other way around. I would suggest making an array with your 60 regions and then loop through them and check which one it is. Put the check in a function and make it return the region (or index of it). The annoying part is to make store the regions into the array, since you would have to make 60 SetVariable calls.