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

Teleporting and moving tokens between preset points

1761681630

Edited 1761838918
Hey! I'm pretty new to the community but I hope to share positive code bits with you guys to make your jobs easier as DMs (and maybe later on Players as well). Origin story of my mod (possibly more mods later on): I was looking for a mod to teleport tokens between maps to setup a new campaign for my future players and I was able to find a few but they were a bit too confusing for me to setup. Luckily I have some experience in coding, and JS is not a new language to me, so based on the amazing solution behind the MapTeleporters  I have come up with my own solution and made my version of automated token traveling between points. Name & Link: TokenTraveler v1.4 Commands: !TokenTraveler --notification-off    → disables GM whisper notifications !TokenTraveler --notification-on     → enables GM whisper notifications Default: notifications ON The way it works (I have also included it in the documentation on my GitHub page in case I'd forget to update it here): You can place down any token on any layer (I recommend the DM layer if you want to keep it hidden but you can also place down a random token on the token layer as well, give it a portal/jump pad/etc. picture to make an interactive object). Give it the following name: Traveler:name:number Example1: Traveler:RavengaardCity:1 Traveler:RavengaardCity:2 Here, RavengaardCity:1 and :2 will be connected and  the tokens (any kind of token that steps on it) will  travel back and forth between the 2 nodes. Example2:    Traveler:RavengaardCity:1 Traveler:RavengaardCity:2 Traveler:RavengaardCity:3 Here, RavengaardCity:1, :2 and :3 will be connected and  the tokens (any kind of token that steps on it) will  travel in sequence (1>2>3>1>2>3...etc.). When traveling between maps, it clones the triggering token with all of its features (that I know of), creates the clone on the new map and removes the original token. (This is because due to my knowledge, the pageid can't be changed on existing tokens since they are tied to the current map.) When traveling between 2 points on the same map , it moves the tokens with roll20's original token moving function/animation. Planned updates: Add options for changing teleportation sequence pattern (ascending, descending, random, odd-even(1>3>5, 2>4>6) [Done] Add multiple entry points to 1 endpoint version (like teleportation circle) [Done] Add multiple selectable endpoints with 1 entry point Add optional sound options to play a sound effect when teleporting If you have any suggestions on what I could add next, how to optimize it more or what other project/idea I should tackle next, feel free to leave a message. Take care,     Roharx. Important info (I will take a look at these requirements so they will not be necessary in the future):   Make sure the tokens you want to teleport (eg.: player tokens) have a name in their name field (Token Settings > General > Name). Make sure the tokens  you want to teleport  (eg.: player tokens)  have a picture, otherwise roll20 will not create the new token on the next map and the original token will still be removed from the map Updates:   v1.0 sequence pattern system update:   Now supports an optional pattern parameter in Traveler names: Traveler:<GroupName>:<NodeId>:<Mode> Example: Traveler:RavengaardCity:1:odd-even Modes: ascending  - (default) 1→2→3→1→... descending - reverse  3→2→1→3→... random     - teleport to a random node (not self) odd-even   - 1→3→5→1, 2→4→6→2... Notes: You can put these options into any of the Traveler nodes in any form and they will work accodringly. Example: Traveler:RavengaardCity:1:odd-even Traveler:RavengaardCity:3:descending Traveler:RavengaardCity:2:random Example's sequence: 1>3>2>random(1 or 2)   v1.1 cooldown bugfix : Fixed bug that wanted to reference the global teleportation cooldown before initializing it. v1.2 teleportation circle mode: Added new teleportation circle mode: Usage: Traveler:RavengaardCity:1:circle-entry Traveler:RavengaardCity:2:circle-entry Traveler:RavengaardCity:3:circle-exit In this example: 1 →3, 2 →3, 3 never teleports These entries will never be teleported to and exits will never teleport you away. Notes: You can also link them together: Traveler:RavengaardCity:1:circle-entry Traveler:RavengaardCity:1:circle-exit Traveler:RavengaardCity:2:circle-entry Traveler:RavengaardCity:2:circle-exit In this example: 1:entry →1:exit, 2:entry →2:exit As long as exits for the specific number exist, they will always teleport to that exit. If there is no exit for the specific number (example: no 2:circle-exit), it will always teleport to the lowest numbered exit (example: 1:circle-exit) v1.3 Better Messages: Updated teleportation messages to look nicer and easier to read. Exiting a portal on a different map now sends the map's new name as well. Player cameras now follow the tokens both on the same map and across other maps v1.4 Camera Follow: Requirements: The Controlled By (Token Settings > Details) field needs to contain the player . Notes: The GM map will not move to let them stay with the other players on the same map
Looks good, easier to configure than teleport or mc - mapchange I'll have a play tomorrow
Installed it and as a test entered the turn notifications off command and got the following error For reference, the error message generated was: TypeError: Cannot read properties of undefined (reading 'cooldown') TypeError: Cannot read properties of undefined (reading 'cooldown') at apiscript.js:32536:29 at /home/node/d20-api-server/pubsub.js:63:16 at Object.publish (/home/node/d20-api-server/pubsub.js:68:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1310:14) at updateLocalCache (/home/node/d20-api-server/api.js:1693:18) at /home/node/d20-api-server/api.js:1908:11 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489)
Norman said: Installed it and as a test entered the turn notifications off command and got the following error For reference, the error message generated was: TypeError: Cannot read properties of undefined (reading 'cooldown') TypeError: Cannot read properties of undefined (reading 'cooldown') at apiscript.js:32536:29 at /home/node/d20-api-server/pubsub.js:63:16 at Object.publish (/home/node/d20-api-server/pubsub.js:68:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1310:14) at updateLocalCache (/home/node/d20-api-server/api.js:1693:18) at /home/node/d20-api-server/api.js:1908:11 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) Hey, it was a bug about cooldown not existing before it wanted to reference it, I've uploaded a new update to the GitHub page, hopefully it will fix the issue :D
1761730834

Edited 1761731462
Retested - OK This is looking really nice, I've tested each of the sequence operations and they're working as expected.  Possible improvements: 1. is there a way to get the name of the page the token has been moved to? e.g. (From TokenTraveler): Party teleported to a new map (TestMap2)  (Thing Node 1, Mode: ascending). 2. option to follow the token to the new map? this would make it a bit quicker for GMs Going to fit it into my Traveller game now as a way for players to move between decks on their starship. Now it is in a usable state you should get it hosted on the Roll20 Githubwhere Roll20 can hopefully approve it and make it available yo other users.
Norman said: Retested - OK This is looking really nice, I've tested each of the sequence operations and they're working as expected.  Possible improvements: 1. is there a way to get the name of the page the token has been moved to? e.g. (From TokenTraveler): Party teleported to a new map (TestMap2)  (Thing Node 1, Mode: ascending). 2. option to follow the token to the new map? this would make it a bit quicker for GMs Going to fit it into my Traveller game now as a way for players to move between decks on their starship. Now it is in a usable state you should get it hosted on the Roll20 Githubwhere Roll20 can hopefully approve it and make it available yo other users. Hey, to my knowledge both 1 and 2 should be doable and currently I'm planning on tackling both features when I get back home from work. I'll update the post if I was successful at implementing these features.
1761750716

Edited 1761750755
I have updated the map part so now it also sends the name of the map the players were sent to and made the messages nicer. For now I will keep it in the GitHub repository until all of my functions are finished and fully bug tested but I'm excited to share it with Roll20 and possibly get it approved. At the moment I'm looking into moving the player's camera to the other map utilizing the flags you can drag in your map library. This might take a while because it's a more complex task but hopefully I'll be able to solve it.
Map change messages, looking good, a big improvement.
I have been able to solve the camera movement part as well, I'll clean the code up to look nice and optimize it a bit more, then in a few hours I'll upload it to GitHub
Excellent work mate, let me know once you've cleaned/tidied the code and I'll give it a final 'once over'. I've already added it to my Traveller game and I have some plans for what to do with it in my Fantasy Trip & Dragon Warrior games.