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] Terrain Generator

1485550982

Edited 1487613416
Sebastian O.
API Scripter
What does it do? Did you ever needed to quickly create a map becouse your adventurers got ambushed while marching thru the forest, desert or other open space? You had to fill the page with some texture, sprinkle some trees and other props around so it doesn't look barren and after 15 minutes you were ready while the players were falling asleep waiting for you or you could use Terrain Generator script and have it done in few seconds, spend minute or two to add some personal touches (camp, flipped wagon, house) and have a nice unique map for your encounter. But how? Install the script using 1-click install Create rollable table(s) with assets used for ground, trees, rocks, etc. (upload your assets directly from your PC) Use one of the following commands: !TGFillBG [pageName] [rollableTableName] [itemNames] [size] pageName - name of the page on which you want to fill the background rollableTableName - name of the rollable table that contains the ground texture itemNames - name (or names separated by ',') of the item with ground texture from rollableTableName (if there is more then one item supplied or there are few items with the same name the script will select random item from the list) size - size (in units) of a texture (the texture will be repeated require number of times to fill the whole page For example: !TGFillBG quick_encounter ground_textures grass 15 !TGSpawnTrees [pageName] [rollableTableName] [itemNames] [size] [sparsity] [variation] [randomRotation] pageName, rollableTableName, itemNames and size are the same as in !TGFillBG sparsity - how sparse the item will be distributed on the page, for example if sparsity is set to 30 to map will be divided to 30 unit by 30 unit squares and each square will contain only one object variation - how much you want to object size to vary, for example with size 10 and variation 5, each object will be created with size between 10 units and 15 units selected randomly randomRotation - how much do you want to object to be rotated randomly, 0 means object wan't be rotated at all, 360 means all object will have a random rotation in 360 degrees Note: despite of its name, it can be used to spawn other scenery elements then trees (rocks, shrubs, etc.) and it works fine for all of them For example: !TGSpawnTrees quick_encounter trees summer_tree1,summer_tree2,autumn_tree1 5 15 2.5 360 Your pageName rollableTableName and itemNames can't contain spaces so keep it in main when naming them and when you want to supply more then one name for itemNames separate them by ',' only (bad: 'tree1, tree2 , tree3', good: 'tree1,tree2,tree3') Show me! Let's start with empty page Add grass texture as background: !TGFillBG encounter_page floors grass5 15 Drop some rocks around: !TGSpawnTrees encounter_page rocks rock1,rock2,rock3,rock4 0.2 30 0.3 360 And finally add some trees: !TGSpawnTrees encounter_page trees atree1,atree2,atree3,atree4 5 25 5 360 And we are done, you can manualy add a campfire, bedrolls and you have a perfect place for your party to be ambushed. Here is a desert created similarly to above forest, just with different assets: If you have any questions/sugestions you can post them here or send me a message here on roll20 Update: You can now use * to select all items in rollable table (ex. !TGFillBG pageName tableName * 15)
1485551492

Edited 1485551527
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Very cool, gonna have to play with this when I'm not swamped in updating scripts.
Okay, this is the first script that is going to make me finally use Rollable Tables.
1485557079

Edited 1485557194
Sebastian originally created script for our compaign. I find it super usefull. I don't have to prepare maps for random encounters. Now I can just generate terrain on the fly. Here is video of me generating simple map.  Link Useful macros: Background macro: !TGFillBG ?{Page} ?{rollableTableName} ?{itemNames} ?{size} Rocks and Trees macro: !TGSpawnTrees ?{Page} ?{rollableTableName} ?{itemNames} ?{size} ?{sparsity} ?{sizeVariation} ?{randomRotation}
1485557866
PaprikaCC
Pro
API Scripter
Okay this is really cool!
1485560288
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
So, just watched the example video, and I've got a question/critique. Do you always have to specify which table items you are using or can you just specify a table and it'll take a random entry for everytime it needs to pull a tree/rock.
Scott C. said: So, just watched the example video, and I've got a question/critique. Do you always have to specify which table items you are using or can you just specify a table and it'll take a random entry for everytime it needs to pull a tree/rock. You always have to specify an items for the table. You can kind of do what you are describing by using the same name for some (or all) of the items in the table. Then if you use select that name it will put all the items with it in to the random pool.
1485567242
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
hmm, ok, thanks.
1485577819
plexsoup
Marketplace Creator
Sheet Author
API Scripter
Sounds fantastic. Looking forward to trying this out.
1485668384
PaprikaCC
Pro
API Scripter
Would you be able to add a flag to just add everything from a table at once? That way I don't have to specify item names every time new terrain details are generated.
Here you go click . If you want to select all items in the rollable table use * as item names (!TGFillBG pageName tableName * 15). I've also updated the link in the original post.
1487535117
PaprikaCC
Pro
API Scripter
Will you be making this available through 1-click install? I would try and save this post but sadly there isn't that functionality :/
It's already available thru 1-click install, you can find it under the name "Terrain Generator"
Why does this only work with user loaded images? Is that a restriction of the API? I really like what you've come up with here, but I can't use it with any of the assets that I've purchased through the marketplace. Kind of Frustrating.
1487580316
plexsoup
Marketplace Creator
Sheet Author
API Scripter
@Elena S. It's a restriction of the API. <a href="https://wiki.roll20.net/API:Objects#imgsrc_and_ava" rel="nofollow">https://wiki.roll20.net/API:Objects#imgsrc_and_ava</a>...
That stinks. Seriously, if you're getting the resource from an image in a rollable table it's obviously already a valid resource. GRRRRR! Blast all hackers who make these sort of restrictions necessary! Oh well. **sigh** Guess I'll just have to start digging through all the resources I use in GIMP to paint maps and upload a nice selection so I can give this the college try!
1487583452
plexsoup
Marketplace Creator
Sheet Author
API Scripter
The good news is, a lot of marketplace assets allow you to download them. So you could download, then re-upload a few of your favourites for the terrain generator to use.
1487584261
Ziechael
Forum Champion
Sheet Author
API Scripter
Also lend a&nbsp; vote here if you have one spare :)