| 06-04-2006, 09:21 PM | #2 | |
You're making a rectangle. Quote:
Of course it's going to select nothing, the distance between MinY and MaxY is 0, so therefore nothing gets selected ^^. Use http://www.wc3jass.com/viewtopic.php?t=237. To use it, first you will need to create a group variable, which here I will name 'TempGroup'. You'll need something like this: Trigger: ![]() Custom Script: set udg_TempGroup = CreateGroup()![]() Custom Script: call GroupAddUnitsInTriangle(udg_TempGroup,x1,y1,x2,y2,x3,y3)Where x1 and y1 are the coordinates of the first point, x2 and y2 are the coordinates of the second, etc. Then use: Trigger: Unit Group - Pick every unit in (TempGroup) and do (Actions) |
| 06-04-2006, 09:24 PM | #3 | ||
Quote:
I did that so that the triangle's point is at the hero... If that made any sense, anyways. Quote:
Thing is, I don't which order the dots are connected. |
| 06-04-2006, 09:42 PM | #4 | ||
Quote:
But you're creating a rectangle. Rectangles with the same minY and maxY are lines. Quote:
It doesn't matter. I even drew up a lovely image for you =D. |
| 06-04-2006, 10:30 PM | #5 |
Alright, thanks. |
| 06-05-2006, 03:49 PM | #6 |
To clarify: rects in WC3 are always rectangular, the coordinates you specify aren't the coordinates of the corners, but the coordinates along which the vertical and horizontal sides will be placed. |
| 06-05-2006, 07:33 PM | #8 |
JASS:function IsPointInTriangle takes real x1, real y1, real x2, real y2, real x3, real y3, real x, real y returns boolean local real calc1 = (y-y1)*(x2-x1) - (x-x1)*(y2-y1) local real calc2 = (y-y3)*(x1-x3) - (x-x3)*(y1-y3) local real calc3 = (y-y2)*(x3-x2) - (x-x2)*(y3-y2) return (calc1*calc2>0) and (calc3*calc2>0) endfunction Function made by Daelin, taken from the JASS Vault. |
| 06-05-2006, 07:36 PM | #9 |
Is it just me or would an equilateral triangle be better suited to this situation instead of the scaline and right ones that are presented in your posts? |
| 06-05-2006, 09:10 PM | #10 | |
Quote:
Tide, I already posted http://www.wc3jass.com/viewtopic.php?t=237 ><. So yes, someone does have an algorithm for it =P. |
| 06-07-2006, 12:45 AM | #11 |
Sorry to revie this, but is there a way to get a triangle in GUI? |
| 06-07-2006, 01:19 AM | #12 |
No, unless you make a method yourself (which would be stupid considering you can get all units within it with just two lines of custom script). And it would probly be tough in GUI. And then you would have to use globals if you wanted it to return values. So basically, you could possibly do it, but it would be a lot of work for no reason. Edit: What you could do is make a ton of very skinny (actually I guess it would be very short) rectangular preplaced regions, then add them together into a global region variable. Then you could move that around and select all units in it. Don't think you could rotate it though. So again, lots of work when you could just use one nice JASS function and do it all for you =P. |
| 06-07-2006, 01:24 AM | #13 |
Hmmm... well that sucks, because I have yet to learn JASS (Yes I know it would be easy with all the resources, maybe I'll try over summer...) and dont know if I could impliment this... |
| 06-07-2006, 01:28 AM | #14 |
If you just want to add units within a triangular region to a unit group, just use these steps. 1. Copy all the code found http://www.wc3jass.com/viewtopic.php?t=237 into your Custom Script section. (At the top of the tree in the Trigger Editor, it says your map name and has a little map icon on the left). 2. Make a global variable named TempGroup, with type Unit Group. 3. Use this custom script: Trigger: ![]() Custom Script: set udg_TempGroup = CreateGroup()
![]() Custom Script: call GroupAddUnitsInTriangle(udg_TempGroup,x1,y1,x2,y2,x3,y3)Where x1, y1 is the first point, x2,y2 the second, etc. Now you can pick every unit in TempGroup and do whatever you want to em. Very easy steps ; ). Only problem might be figuring out what points you want to use. |
| 06-07-2006, 01:31 AM | #15 |
Oh, that makes sense. But figuring out points would be easy in my case, because I'd like to just use a set region... so I can just check from the editor. Thanks. EDIT: One question. When using that script what it does is make a unit group and then pick every unit in the x1,y1,x2,y2,x3,y3 area right? So how would I decide where that area is? |
