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 .
×

[Script] Vehicle - A script for handling vehicles and mounts

1793471465

Edited 1793637744
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Vehicle - A script for handling vehicles and mounts Moving a group of tokens that are all standing on a boat, a wagon or a giant eagle has always been fiddly in Roll20. You either select everyone and hope nobody gets left behind, or move them one at a time. Vehicle handles this. It will be available through One-Click shortly. [ Demo video ] [ Code - Until One click merge ] What it does You mark a token as a vehicle. From then on, whenever it is moved or turned, every token on it is carried along and keeps its place on board. If the vehicle turns, the passengers swing around with it, and they can also turn to keep their facing. That is a setting for each vehicle, since top-down art usually wants it and portrait art usually doesn't. Passengers can still move on their own, and moving a passenger never moves the vehicle. If someone jumps overboard or dismounts, they just drag their token off, and they are no longer carried. Vehicles are kept behind other tokens so the passengers stay visible on top. Setting up a vehicle or mount Select the token, type !vehicle for the menu, and click Define. That's all most vehicles need. A token counts as aboard if at least half of it is over the vehicle. You can change that amount for each vehicle. A lot of vehicle art has empty space around the edges, for shadows or so it fits the grid. To tell the script where the passengers actually stand, draw a rectangle over that part of the vehicle on the token layer, select the vehicle and the rectangle together, and click Set area. The rectangle is removed afterward. Show area draws a temporary yellow outline so you can check it. !vehicle --list shows every vehicle on the page with its picture and settings, and you can change them from there. Click a vehicle's picture to pull everyone's view to it, or its name to pull only your own. Things to know Passengers move when the vehicle is dropped, not while it is being dragged. Undo on a vehicle move puts the vehicle back but not the passengers. Only tokens on the token layer are carried, and a vehicle on another vehicle is not carried. The vehicle settings live in a short tag in the token's tooltip, so a copied vehicle keeps them. Players will see the tag if the tooltip is shown to them. Setup commands are GM only. Anyone who can move a vehicle can move its passengers. Written for the current Roll20 tabletop (Jumpgate). As always, if something behaves oddly, tell me what you did and what happened, and I'll take a look. Many of my scripts are posted early on my Patreon
That's really cool and useful.  Thanks for creating it. 
Keith, I'm about to start a Forgotten Realms Moonshae campaign in the new year and was trying to figure out how to handle ship movement and combat. This is the perfect solution.
1793552726
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Excellent! It should be merged into One Click this week. I'll post here when it happens.
I am excited about this one. Thanks Keithcurtis.
1793574245
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I managed to sneak in a few improvements before the PR gets merged. Vehicles no longer "sweep up" unboarded tokens. Only tokens aboard during vehicle definition or that are moved aboard manually or by something that provides a hook, like token-mod or scriptCards, are "aboard". This means vehicles no longer sweep up new passengers just by passing over them. Vehicles can carry other vehicles, and a token is considered to be a passenger of the smallest nested vehicle it overlaps. I.e. you can load a lifeboat, and then deploy the life boat with passengers. Regardless of token rotation settings, a carried vehicle will always rotate facing with the master vehicle.