Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Script] Traps, Water, Difficult Movement, whatever... adding map hazards.

1431169850

Edited 1431170768
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
<a href="https://gist.github.com/BaldarSilveraxe/1fedbb8cf5" rel="nofollow">https://gist.github.com/BaldarSilveraxe/1fedbb8cf5</a>...
1431170152

Edited 1431170807
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
1) Use the pathing tool to add rectangles or polygonal shapes to the GM layer. 2) Free hand and circles not supported. 3) Recommend you draw with fill color, this will turn transparent if the path is a supported path. That’s it. The API will look to do something based on tokens entering that shape on the object layer. It will check for a Macro with a name = to the path color (i.e. macro named ‘#FF0000’) activeTrap = function(hazzard, token) { var objValues = getObjValue(hazzard, objExtractKeysPath), featureMacro = findObjs({ _type: 'macro', name: objValues.stroke })[0]; //DO SOMETHING WITH 'featureMacro' log(hazzard) log(token) log(featureMacro) },
1431170331
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
So hoping Vince likes this.... but you never know.
1431179155
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
This really needs a recursive path created around walls on the DL layer.
1431179370
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
<a href="https://qiao.github.io/PathFinding.js/visual/" rel="nofollow">https://qiao.github.io/PathFinding.js/visual/</a>
1431180826
vÍnce
Pro
Sheet Author
Stephen S. said: So hoping Vince likes this.... but you never know. We'll see. We'll see.
1431192166
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
<a href="http://buildnewgames.com/astar/" rel="nofollow">http://buildnewgames.com/astar/</a> This is what we need!
1431192608
The Aaron
Pro
API Scripter
I've written A* before for several games. It's not really that hard. The hard part is getting the graph data built.
1431192941
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
So... one of the lucky things about dungeon draw (or any approach like it) is the use of tiles the size of the grid. You know the canvas obstructions based on the tiles. This makes partolling tokens easy... you know the likely path a player took... if they want to be specific they can use waypoints. This could add a lot of value to the canvas!
1431211230
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
So far so good! Works off a simple 1 or 0 map. Now just need get to work where a tile could have one or more walls.
1431211612
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
This could be used for random dungeon generation too.
1431212754
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
For large encoutners... this could really save the GM time... bad guys keep trying to get into melee range (or run away) on their turn automatically.