So, I really like DungeonDraft, and want to incorporate it into my workflow. The import function in MapTool 1.7.0 works very well, and creates the vision/movement blocking required. But my existing campaign uses tokens for doors, with VBL drawn/removed over the token for open and closed states. DungeonDraft allows you to place portals, such as windows and doors, but of course in the import process, these are just part of the background map it seems.
I tried opening the dd2vtt file created by DungeonDraft, and it turns out it's a JSON text file. The portals are all broken out in an array:
Code: Select all
"portals": [
{
"position": {
"x": 46,
"y": 28
},
"bounds": [
{
"x": 45.5,
"y": 28
},
{
"x": 46.5,
"y": 28
}
],
"rotation": 0,
"closed": true,
"freestanding": false
},
Code: Select all
[h: newDoors = ""]
[r, foreach(jPortal, jPortals, ""), code:{
[h: pos = json.get(jPortal, "position")]
[h: xpos = (json.get(pos, "x")-0.5) * 50]
[h: ypos = (json.get(pos, "y")-0.5) * 50]
[h: facing = if(json.get(jPortal, "rotation") == 0, 90, 0)]
[h: update = json.set("{}", "x", xpos, "y", ypos, "layer", "Object", "useDistance", 1, "facing", facing) ]
[h: newDoor = copyToken("Door", 1, "GM Area", update) ]
[h: newDoors = listAppend(newDoors, newDoor)]
}]
[h: selectTokens(newDoors, 0, ",")]
[h, macro("MakeDoor@Lib:Door"): ""]