HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Simulating Blight... kinda

09-17-2007, 01:24 PM#1
Xaran Alamas
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
TaintedReality
Collapse JASS:
native IsTerrainPathable            takes real x, real y, pathingtype t returns boolean

Collapse 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
Xaran Alamas
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
TaintedReality
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
Xaran Alamas
Thanks... though what's 2Pi?
09-18-2007, 08:00 AM#6
Tide-Arc Ephemera
2 times pi maybe?
09-18-2007, 08:03 AM#7
Xaran Alamas
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
burningice95
no. 2pi = 360/0 degrees.
09-18-2007, 08:16 AM#9
Xaran Alamas
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
Xaran Alamas
Heya again. could someone please provide some sample code? I can't get it figured out :-/ thanks.
09-25-2007, 01:06 AM#11
Pheonix-IV
I'm not sure what the JASS is, but this will do it in GUI and should hopefully help point you in the right direction.

Trigger:
FakeBlight
Collapse Events
Unit - A unit Finishes construction
Conditions
Collapse Actions
Set temppoint1 = (Position of (Constructed structure))
Collapse For each (Integer A) from 1 to 45, do (Actions)
Collapse Loop - Actions
Set temppoint3 = (temppoint1 offset by 50.00 towards ((Real((Integer A))) x 8.00) degrees)
Collapse For each (Integer B) from 1 to 20, do (Actions)
Collapse Loop - Actions
Set temppoint2 = (temppoint1 offset by ((Real((Integer B))) x 30.00) towards (Angle from temppoint1 to temppoint3) degrees)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Terrain pathing at temppoint2 of type Buildability is off) Equal to True
Then - Actions
Collapse Else - Actions
Environment - Change terrain type at temppoint2 to Ashenvale - Leaves using variation -1 in an area of size 1 and shape Circle
Custom script: call RemoveLocation (udg_temppoint2)
Custom script: call RemoveLocation (udg_temppoint3)
Custom script: call RemoveLocation (udg_temppoint2)

--EDIT--

Oh, you probably don't need the temppoint3 stuff, just use integer A on the angle for temppoint 2. I was using temppoint3 as a debug to try and work out why it seemed to be skipping a step, but it was unrelated.
09-25-2007, 09:40 AM#12
Xaran Alamas
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 :)