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]Locksmith

1786725229
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Locksmith - Automatic Lock-Picking & Knock for D&D 5e (Legacy + Beacon) Roll20 doesn't have a native way to trigger "a player interacts with a locked door," so lock-picking has always meant the GM manually comparing a roll to a DC they're keeping track of somewhere else. I built Locksmith to close that gap for my own table, and figured it might be useful to others too. [ Video Demo ] [ Code Until One-Click Merge ] What it does Set a difficulty on a door or window once (or mark it Unpickable, or Magic-only for Knock), and from then on your players just make Thieves' Tools checks as normal - Locksmith automatically finds the nearest locked door/window in range and resolves it. Works with both the legacy (5e) and Beacon (5.5e) character sheets. Automatic Thieves' Tools resolution - success posts an Unlock button Knock spell support, detected automatically, can bypass Magic-only locks No custom data storage for lock state - the DC lives directly in the door/window's  color property A GM setup menu, with on-map status labels (they turn yellow if a key-holder is already on the map) A full keys and keyrings system - hand out keys directly or generate a custom loot macro for treasure. Each player gets a !keyring report to Use/Give/Drop their keys Can optionally create a !keyring token action for players Full in-game documentation via !lock --help Installation One-Click install (search "Locksmith"), or grab Locksmith.js directly from the repo folder. Getting started Select a door or window, run !lock, and use the Set row to configure it. That's it - !lock --help covers everything else, both for you and for your players. Feedback welcome - this has been built and refined through actual play at my table, so if something doesn't work the way you'd expect, let me know. This script was released early for playtesting, for free, on my  Patreon .
Hi Keith! Another great script from the script king! Would it be possible to add penalties to locks? Example, failing a lockpick by 5 damages the picks. Or failing by 10 or more jams the lock, etc... Great script! Thanks for sharing!!!
1786895928
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Pak! Thanks! There is a lot I would like to add to this, but there are some real limitations. The DC is stored in the color code. This makes it possible to set and then copy/paste, transmogrify, or duplicate them along with pages. Doors and Windows do not have many places where data can be stored,so the color code is it. At the same time, I don't want to shift that color too much visually. I want the user to be able to see doors as orange and windows as cyan. Each step away from the pure color indicates a change in DC. This is also why I cap the DC. The harder the door gets to open, the less it keeps its color. So the amount of data is limited. I have advocated that every Roll20 object should have a description or data field, that just holds a string. There is so much stuff that can be done with that. Doors could store descriptions, descriptions of their keys, noises to play when opened, riddles, all kinds of stuff. Right now though, we're about at the limit of data points I find comfortable storing.
Can't wait to add this to our game.  When a character uses the Knock spell, does it have to be cast from their character sheet or can it be called from another script like Tim's Spellbook, which we also use in  our game.
1786908948
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It looks for key words in the template produced by the character sheet. If Tim's Spell book triggers those sheet abilities, it should work.
Nice! I've been looking for something to handle doors with.  What key words are it looking for? Can these terms be in a ScriptCard? So they need to be in the title or text?
1787162409
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks Eric! It looks for the rolltemplate or msg.type produced by the sheet for the thieves tools or knock spells. If your ScriptCards script triggers the sheet abilities rather than constructing from scratch, it should work. I got very specific on the searching because I wanted to reduce the chance of false positives, and the script also needs to know how to find the result numbers accurately in the case of the tools. For instance, if you don't have advantage or disadvantage set on the legacy script, but are simply always rolling two d20s, it's smart enough to ask for comfirmation on the intended result.
Hi Keith, I commented on your locksmith video a few days ago with: "Setting up walls like that in a city environment without blocking the view behind the house from a top-down view? Only block the walls; I've been trying to work around the dynamic lighting and the foreground setting to make it work." I am attempting to set up the hub town of Phandalin with a map of the town for the players to walk throughout and interact with each of the buildings; in doing that, there will be walls and doors leading to different areas. The intention is to use this as a main hub for all of the elements of Lost Mine of Phandelver and other extra aftermath of that campaign. The issue is that with the global illumination and the walls, there is a large chunk of the map that will remain dark and blocked behind the buildings. I have a separate PNG for roofs in the foreground layer and the base is on the map layer. I am using the dynamic light with the walls. I have considered just swapping all of the walls to transparent walls and just using the conditional fade for the roofs to cover that issue; however, the walls within the building wouldn't block vision in that way, and the doors will still block the vision as is. I am stumped on this one. If you have any suggestions or mod recommendations to assist with this, I would greatly appreciate it.
1787926025
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Xtreyu! Would explorer mode help alleviate the issue? I'm sorry, I've read that paragraph several times and am having trouble understanding what you want to happen vs. what is happening.
Explorer mode would make the dark areas go away, yes, however, it would also heavily weigh on the browser and cause a lot of lag. the map is 120 x 120. My apologies if I didn't cover the issue well. My intention is to kind of have the vision of the players be like that top picture, where the players can see the whole town, but when they get close, swap to inside the building and respect the vision inside the buildings. I am having a hard time trying to make something like that work and not cause it to be a laggy mess. I hope that covered what I meant,
Not sure if this is best for you, but what I have done in the past is make up the interior of each building but them on a separate page and then use the Teleport script so that when the players put their token on it they are sent to the proper page. Takes some time to set up, but find that it cuts down on the lag as there is not as much on one page.
I love the Locksmith mod, but I am trying to create a [thieve'sTools] macro and when I run it as a macro I get [no token found], but if I run it from a character sheet, it works. Is there a way to make a macro that works? I try to keep my players off of their character sheets as much as possible, giving them macros for almost anything they might do. 
1791133918

Edited 1791133952
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hey al e! Can you post the text of the macro? The script looks for some very specific clues in the chat text. And do they have their token selected when they run it? Also, which character sheet are you using?
1791143166
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Actually, it occurred to me that players might benefit from being able to put that easily on an action. It isn't technically exposed to the API, but can be sniffed out on a Beacon sheet from the store attribute. In the next update, there will be a button in the control panel to add the sheet macro to the character's list of token actions. It will be called "Pick." with a period at the end to protect it form accidental deletion by Token Action Maker. You will also be able to add it to any character with the command: !lock --pick-action Characters who want to store that macro code somewhere else can open the token actino button to copy the raw code, but the script has the advantage of updating the code should something change the ID for some reason.
I was away from my computer for a bit. The macro generated by the sheet (5E classic sheet): @{Test|wtype}&{template:simple} {{rname=Thieves' Tools}} {{mod=7}} {{r1=[[@{Test|d20}+7[Mods]@{Test|pbd_safe}]]}} {{always=1}} {{r2=[[@{Test|d20}+7[Mods]@{Test|pbd_safe}]]}} {{global=@{Test|global_skill_mod}}} @{Test|charname_output} it works from the sheet, but not if entered into the chat with the token selected. Thanks for the fix, I look forward to the next update.
1791175621
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hmm. Not sure. It could throw errors if you have more than one character name "Test" in your campaign. If I take your macro and replace every occurrence of "Test" with the name of a character in my campaign, it works correctly. Try this it will work for any selected 2014 character token: @{selected|wtype}&{template:simple} {{rname=Thieves' Tools}} {{mod=7}} {{r1=[[@{selected|d20}+7[Mods]@{selected|pbd_safe}]]}} {{always=1}} {{r2=[[@{selected|d20}+7[Mods]@{selected|pbd_safe}]]}} {{global=@{selected|global_skill_mod}}} @{selected|charname_output}
No it doesn't work, thanks for trying. I will have them pick locks from their sheets.
1791244690
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'll try to remember to post here when the merge happens. In the meantime: Is this a 2014 sheet game, a 2024 sheet game, a hybrid, and if a hybrid, which is the base? Trying to investigate why it doesn't work for you.
2014 classic sheet.
1791939646

Edited 1791940542
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Locksmith 1.0.1 update Note: Something went wrong with the merge. The following feature will be available when it is cleared. Small update to Locksmith. It adds one thing: a “Pick.” token action. Until now, a player had to open their character sheet and roll Thieves’ Tools from there. Locksmith still works that way, but there’s now a button on the token itself. Click Pick. on the token’s action bar and it makes that character’s Thieves’ Tools roll from their sheet. Proficiency, advantage and everything else the sheet normally handles still applies, and Locksmith picks up the roll the same way it always has. How to set it up Select one or more tokens and click Add Pick. Token Action in the !lock menu. Each token’s character gets the button. Players can do the same for their own token by selecting it and typing !lock --pick-action. A few things to know It works on both the 5e (legacy) and 5.5e (Beacon) sheets. The character needs Thieves’ Tools in their tool proficiencies. If they only carry the tools without being proficient, the script tells you it found nothing and doesn’t add the button. If a character’s Thieves’ Tools proficiency gets deleted and added again, click Add Pick. Token Action again to refresh the button. The help handout (!lock --help) has a short section on this. Let me know if anything doesn’t work the way you’d expect, especially on the 5e (legacy) sheet, which I’ve had less chance to test.