| 09-17-2007, 01:24 PM | #1 |
Heya, well in a little project of mine I have my buildings expand a different terrain type (using the terrain changing triggers) around them in a similer way to blight but I don't need the whole 'can only build on blight' thing, it's just aesthetic. No, what I'm here to ask about is this: One of the problems with just setting terrain in a circle is that it doesn't effect pathing meaning buildable and unbuildable terrain is covered by this new terrain so there's no visible means of differentiating for structure placement. I need to be able to check the pathing type of cells in a circle around a given point and only apply the new terrain to the buildable/passable cells. I remember such a function on WC3Sear.ch but alas I don't know where it is now :( So any help would be appreciated, thanks :) |
| 09-17-2007, 07:33 PM | #2 |
JASS:native IsTerrainPathable takes real x, real y, pathingtype t returns boolean JASS:PATHING_TYPE_AMPHIBIOUSPATHING, PATHING_TYPE_ANY, PATHING_TYPE_BLIGHTPATHING, PATHING_TYPE_BUILDABILITY, PATHING_TYPE_FLOATABILITY, PATHING_TYPE_FLYABILITY, PATHING_TYPE_PEONHARVESTPATHING, PATHING_TYPE_WALKABILITY And remember it returns the opposite of what it should, for some reason. |
| 09-17-2007, 08:49 PM | #3 |
Er... that's not quite what I wanted. What I meant was I need some way of checking all cells within a circle for what their pathing is, but I don't know the right maths type thing to figure that out. |
| 09-17-2007, 10:38 PM | #4 |
Just use a loop inside a loop, one with an increasing angle and one with an increasing distance. Whenever the angle gets to 2Pi, set it back to 0 and increase the distance. This of course won't perfectly select each point only once - some tiles will get checked more than once. But really, in this instance efficiency isn't worth the extra effort (since it's not going to lag anyways), and it will look the same in-game as if it only checked each tile once. |
| 09-18-2007, 07:56 AM | #5 |
Thanks... though what's 2Pi? |
| 09-18-2007, 08:00 AM | #6 |
2 times pi maybe? |
| 09-18-2007, 08:03 AM | #7 |
Wouldn't that be more or less infinity? (Sorry if this is some maths term, my maths is... not so great) |
| 09-18-2007, 08:14 AM | #8 |
no. 2pi = 360/0 degrees. |
| 09-18-2007, 08:16 AM | #9 |
Ah. Thanks, I'll try it out. Thanks for the help everyone. Edit: Ok my jass must be rusty as I can't get it working... could someone please provide some sample code? Thanks |
| 09-24-2007, 09:25 PM | #10 |
Heya again. could someone please provide some sample code? I can't get it figured out :-/ thanks. |
| 09-25-2007, 09:40 AM | #12 |
Thanks Pheo, I'll try it out. Edit: I ended up using temppoint3 too as it didn't seem to work otherwise but it's working great now, thanks :) |
