Terrain Overlays for difficult terrain, cover, etc.

For everything about graphics/tokens developed by users and offered for others to use in their games.

Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by wolph42 »

and I've found a better (faster !!) solution ! It requires one line of code to find the difficult terrain tokens ONLY where the token has walked!

Attached a self explanatory campaing file, see the campaign panel for the macro.

Cheerz!
Attachments
diff. terrain.cmpgn
(225.28 KiB) Downloaded 151 times


User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by wolph42 »

CoveredInFish wrote:Why am I not surprised? :mrgreen:

What a clever trick, nice!
:mrgreen: thnx!

What's really funny, and this I just realise, is that you can use the lastPath to define an area e.g. a difficult terrain area, store that and use json.difference with the lastPath of a player token to filter out the coords of that have traversed this area. But I think my zero-zero trick is easier to set up and maintain.

Edit: but it *does* open up a whole WORLD of possibilities to create eventAreas... hmm who knows.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by wolph42 »

by the way, I noticed AMs remark on getTokens being slow and I did some tests, while using DpC=0 isn't really slow, it isn't really fast either, for a long walk over say 50 tokens its takes about a second to burb them up. (it does not matter whether you walk over the tokens or not, if you have a lot of tokens on the object layer and you drag a token over many cells: slow)

So.... trick to: define the area with the use of getLastPath, store it on a lib token and retrieve when needed. Before doing all that I defined a large area to see how wel it works. It works VERY well!
OLD (see below for live version): http://dl.dropbox.com/u/9052014/Difficu ... area.cmpgn

What you do is:
- trace with a token over the entire red area (using space bar to set waypoints)
- get the last path of the token
- store it
- then use json.intersection with the lastpath of a player token with this area and all relevant coords pop-up in no time.

This way you can define several areas (overlapping as well!!) and do the intersection trick per area. As you get ALL the coords of ALL cells traversed you can simply do a count of number of items in the array to know how many 'special' area cells have been traversed. In short: you don't need the gettokens anyore. This way its going a similar way as with the Bag of Tricks, save the fact that you have to reinitialize each time you move overlay tokens around.

This is FAST! BUT its more hassle to set up as you need to 'draw' the entire area with your moving token

Note: you can even create a check macro that places a token on each of the coords, to see if you have the whole area covered... hmm come to think of it... you could scan the area for overlay tokens, store there coords as an area and use that!! He ho best of both worlds!

Edit: live version: http://dl.dropbox.com/u/9052014/Difficu ... area.cmpgn
Edit2: out of curiosity, if the shaded area is difficult terrain and a token walks from A to B along the red path (see pic) what exactly is its total movecount and why?
diff terrain.jpg
diff terrain.jpg (23.33 KiB) Viewed 5311 times

User avatar
patnodewf
Cave Troll
Posts: 97
Joined: Sun Jan 15, 2012 3:44 am

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by patnodewf »

wolph42 wrote:out of curiosity, if the shaded area is difficult terrain and a token walks from A to B along the red path (see pic) what exactly is its total movecount and why?
For Pathfinder, for diagonal movement, you would need the one_two_one measurement.
PRD wrote:Diagonals: When measuring distance, the first diagonal counts as 1 square, the second counts as 2 squares, the third counts as 1, the fourth as 2, and so on.
For Pathfinder difficult terrain...
PRD wrote:Each square of difficult terrain counts as 2 squares of movement. Each diagonal move into a difficult terrain square counts as 3 squares.
For your diagram, the count looks like 5 squares to me:
  • First movement (first diagonal): +1
  • Second movement into difficult terrain: +2
  • Third movement (second diagonal): +2
Measuring diagonal movement into difficult terrain is 3 squares. If your diagram showed "B" as difficult terrain, under Pathfinder's rules, the total should be 6. It doesn't appear that a diagonal movement into difficult terrain cares about the one_two_one structure for calculating the number of squares. So I'm thinking if you moved one more diagonally from "B" it would be just +1 square.

(hope that helped)
My form-fillable PDF Character Sheet for Pathfinder can be found here.

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by CoveredInFish »

Okay, me using 1-2-1 and house ruling that each cell of diff. terrain gives +1 comes to the same total.
But then its actually the same rules ...

EDIT: this new method really looks fast. And scanning the map for tokens with a given state (eg) is easy enough for setup.OR summoning the tokens to show the diff terrain. I like to mark the difficult terrain so players can see. *sigh* probably I have to change it ... again



User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by wolph42 »

Is there actually a function dat shows the move distance a token just travelled? Like Getlastpath but then just a number showing the move count?

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by CoveredInFish »

Oh yeah, we totally should use that. It'll consider the move metrics.
Wiki: getMoveCount()

(I've written this Guide to onTokenMove when it was all new ... its my goto page when I wanna know what functions exist in that context)

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by wolph42 »

check! well that makes it fairly easy then. use that function and add the number of entries in the json.intersection result!

Edit: updated live version with total move counter. Works pretty well!

Im wondering though... if you make one step onto diff. terrain its 1+1, so how much is it if you move one step back? Currently the example campaign will again calc. 1+1, so I think you should remove the first entry from getLastPath(0). Am I right in that assumption??

To elaborate a bit say you have square 1,2 and 3 where 2 is difficult terrain. If you move from 1 to 3 it totals to 3 steps. If you however first move to 2, wait and then move to 3 then all of a sudden it calculates 4 steps. To prevent this from happening you need to remove the first entry from lastpath before you calculate the intersection. (updated in life campaign file.)

edit2: new update in live version

User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by Bone White »

CoveredInFish wrote:(I've written this Guide to onTokenMove when it was all new ... its my goto page when I wanna know what functions exist in that context)
That's what I referred to for my onTokenMove macros, and it was excellently useful. Never did get to thanking you about that one, so thanks!

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by CoveredInFish »

wolph42 wrote:Im wondering though... if you make one step onto diff. terrain its 1+1, so how much is it if you move one step back? Currently the example campaign will again calc. 1+1, so I think you should remove the first entry from getLastPath(0). Am I right in that assumption??

Yeah, you're right. I already did that, but hasnt communicated it. If you check the code I did you will see json.remove(getLastPath(0),0) - I removed the first cell because when you leave it you'll already have paid the diffTerrain-penalty.

@BW
Great, I'm glad its useful :)


User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Terrain Overlays for difficult terrain, cover, etc.

Post by CoveredInFish »

Sure thing, but it wont happen today :-( too much work to do.

EDIT: okay. I got a look. I think I already saw that :?: It does not yet remove the cell the token leaves. I dont get why there are huge hard-coded coordinate lists in all onTokenMove-macros. Oh, and its really fast :-)

Post Reply

Return to “Tilesets, Token Libraries, and Complete Maps”