| 08-07-2008, 11:33 AM | #1 |
Can anybody point me to a good resource for creating JASS regions (not rects) and how to use them, what functions to use with them etc. I actually need to create a region in the shape of a segment of a circle / triangle (if i find segment of circle too much code for it to be worth it). Thanks. |
| 08-07-2008, 01:03 PM | #2 |
There really are no resources for these things. Perhaps because reading common.j is quite enough? JASS:native CreateRegion takes nothing returns region native RemoveRegion takes region whichRegion returns nothing native RegionAddRect takes region whichRegion, rect r returns nothing native RegionClearRect takes region whichRegion, rect r returns nothing native RegionAddCell takes region whichRegion, real x, real y returns nothing native RegionAddCellAtLoc takes region whichRegion, location whichLocation returns nothing native RegionClearCell takes region whichRegion, real x, real y returns nothing native RegionClearCellAtLoc takes region whichRegion, location whichLocation returns nothing JASS:native IsUnitInRegion takes region whichRegion, unit whichUnit returns boolean native IsPointInRegion takes region whichRegion, real x, real y returns boolean native IsLocationInRegion takes region whichRegion, location whichLocation returns boolean JASS:native TriggerRegisterEnterRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event // EVENT_GAME_ENTER_REGION constant native GetTriggeringRegion takes nothing returns region constant native GetEnteringUnit takes nothing returns unit // EVENT_GAME_LEAVE_REGION native TriggerRegisterLeaveRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event constant native GetLeavingUnit takes nothing returns unit If you got specific questions about how to use one of these natives... |
| 08-07-2008, 01:28 PM | #3 |
I apologise Vex, i wasn't specific enough. While I am capable of looking up the function names, knowing how to use them properly is different. Assuming that a region is created empty (let me know if I am wrong): For the function RegionAddCell (and similar)... This function would normally be used in a loop to create a 'line' of cells, or fill a certain shape with cells based around coordinates (depending on the formulae for x and y), yes? What is the size of a cell, and can you show me an example of how it would be used and then refered to (as in setting a unit group based on the units in said region). |
| 08-07-2008, 02:14 PM | #4 |
The size of a cell is 32*32. http://www.wc3campaigns.net/showthread.php?t=101317 You can use RegionAddCell as the function SetTerrainPathable. But remember , for a region you can use rects as well. So if you plan to modify my function DiskPathing instead of the first loop you can simply use a rect. EDIT : What sort of segment circle do you need ? Make a picture should be a good idea :p |
| 08-07-2008, 05:09 PM | #5 |
Here is a list of JASS functions with comments but so far only like a hundred functions are commented, it would be great if more people would add their comments. |
| 08-08-2008, 06:37 AM | #6 |
When i say a circle segment I mean a wedge (cake slice :P) of about 45 degrees, radius 300. |
| 08-08-2008, 08:06 AM | #7 |
For that sort of a region, I would recommend using something like this: RegionEvent System, except grim001 removed all the stuff about it from his thread. If you seriously need such a region and can't settle for a periodic check in that area instead, I would contact him. |
| 08-08-2008, 11:07 AM | #8 |
Thank you all that replied. I have decided that it is too much trouble to go to for a slightly improved result (by using a non-rectangular region) for all the effort involved. It seems I didn't know what I was getting into. Thanks again. |
| 06-04-2009, 08:18 AM | #9 |
I know this might be too late to even matter, however if you want a region that works as a cake slice... Can't you use the UnitsInRange event instead and add a condition that determines if the entering unit is between 2 specific angles (AngleBetweenPoints) to get the form of a slice cake? |
