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 .
×
D&D 2024 has arrived! Pre-order the new core rulebooks now and get an exclusive pre-order bonus for free!
Create a free account

[Script] It's A Trap! v2.3

1513115059
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Patch Starfinder theme v3.0.1: Fixed a bug in the new Starfinder Trap Theme that was causing traps targeting starship AC or starship TL to target KAC instead. Pull request pending:&nbsp; <a href="https://github.com/Roll20/roll20-api-scripts/pull/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/pull/</a>...
so I am setting traps and notice it is not outputting any damages when it is triggered - any suggestion?
1514904749
Ada L.
Marketplace Creator
Sheet Author
API Scripter
It's working fine here. I would suggest though that you share the following information to help track down the problem: What trap theme are you using? Share what your trap has in its GM Notes. Please be sure to put this in a code block... ...like this.
Stephen, again thanking you for this great script before asking: Is it possible for some tokens to activate the trap and some others not to? In this case, I have an "ooze jungle" full of pits where nasty liquids and, of course, oozes lie. Those pits are concealed by the naturally prolific vegetation of the area. But I want the oozes, jellies, and other surface-sticking creatures living there not to fall into the them (and not to reveal the presence of a pit to the PCs).
1514915238
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Currently the script doesn't let users specify traps to only affect certain tokens or make certain tokens exempt from triggering/being affected by them. Since you're using a bunch of pit traps, one thing you could do is give each of the oozes the 'fluffy wing' status icon. This will let the script know that the oozes are 'flying' and by default traps won't affect or be triggered by flying creatures, unless you change their 'affect flying tokens' property to 'yes'.
Oh, great! What you say works perfectly in this case. Thanks!
In fact, it works whenever there are no flying creatures, and even when there are, you can just change the icon representing 'actual fly'.
1514936184

Edited 1514936307
Stephen L. said: It's working fine here. I would suggest though that you share the following information to help track down the problem: What trap theme are you using? Share what your trap has in its GM Notes. Please be sure to put this in a code block... ...like this. 1) I do not know what you mean by this. Sheet is OGL (also on the api is set for OGL) 2)&nbsp; {"message":"A saw quickly approaches you","stopAt":"none","revealWhenSpotted":true,"revealLayer":"objects","sound":"Buzzsaw","damage":"5","spotDC":16,"triggerPaths":["-L1pHAVCKusCvXAJFOPE"],"attack":5}
1514990547
Ada L.
Marketplace Creator
Sheet Author
API Scripter
The It's A Trap script by itself only supports basic, system-agnostic properties for traps. If you want to set properties on traps using D&D 5 rules, you'll need to also install the D&D 5 trap theme script and set it to use the OGL sheet.
1515002478

Edited 1515002495
so I already have 2 of them installed - "Its a trap!" & "It's a Trap D&D 5E Generic (set to OGL sheet)" as for the "It's a trap! D&D 5e OGL theme" it tells me to use the generic because it is "deprecated". so you're telling me to install the 5e ogl one? do I delete the generic?
Nover C. said: so I already have 2 of them installed - "Its a trap!" & "It's a Trap D&D 5E Generic (set to OGL sheet)" as for the "It's a trap! D&D 5e OGL theme" it tells me to use the generic because it is "deprecated". so you're telling me to install the 5e ogl one? do I delete the generic? The only two you need, to setup traps are Its's a trap! &&nbsp;It's A Trap! - D&D 5E Generic. that's it.
then yeah - those are the ones I had installed and the traps aren't outputting the damage info when I move a token to it
Nover C. said: then yeah - those are the ones I had installed and the traps aren't outputting the damage info when I move a token to it I'm sure it's a configuration problem. But without seeing your config, it's very hard to try to troubleshoot. Screen short your it's a trap config from the chat window and post here so we can see what is going on.
<a href="https://imgur.com/a/WcOAI" rel="nofollow">https://imgur.com/a/WcOAI</a>
Which browser are you using?
Browser isnt the issue. I have the traps in 2 games. It works in 1 one of them fine and not the other one.&nbsp;
Nover C. said: <a href="https://imgur.com/a/WcOAI" rel="nofollow">https://imgur.com/a/WcOAI</a> Ok i went over and setup a trap just as you described in your image and i reproduced that it didn't roll for damage. 1) I'm assuming you are setting a PATH as a trigger 2)Under&nbsp;Theme-specific properties Damage&nbsp; You have "5" set. That means it will ALWAYS be 5 dmg.&nbsp;You need to change that to a represent the type of "die" roll you want.&nbsp; Unless you always want it to be 5 dmg regardless. 3) Make sure the "trap" objects are on the GM layer to start with Besides that, i think the problem is that it doesn't work for "Pathed" traps. If you change it to "self" and had your token go over that object, it should roll, for damage as expected.&nbsp;
1515076857

Edited 1515077095
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Turns out it was a bug. I've put in a fix for it and it's waiting to get merged in. You can get the updated script from here early:&nbsp; <a href="https://github.com/Roll20/roll20-api-scripts/pull/558" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/pull/558</a> Another work-around until it gets merged in is to set the trap's Aura 1 radius to 0. Then it will display damage for any tokens overlapping the trap token itself when another token crosses its trigger path.
Just noticed that traps using the Pathfinder theme do not allow a save and an attack roll simultaneously. Strange, since such a situation is fairly common in that system.
1515093691
Ada L.
Marketplace Creator
Sheet Author
API Scripter
That's intentional. The script doesn't support separate effects for what happens when an attack hits or a save fails. To do traps that require both an attack and save, you'll have to set it up as two separate traps. One trap should handle the attack roll part and the other should handle the save.
Stephen L. said: That's intentional. The script doesn't support separate effects for what happens when an attack hits or a save fails. To do traps that require both an attack and save, you'll have to set it up as two separate traps. One trap should handle the attack roll part and the other should handle the save. A work around would be to put the attack and/or damage on the description box
All right, got it. Thank you both for your replies.
The script is really good, but there is a message every time when the token approach to the trap: "(From Trap theme: 5E-Generic): Cannot read property 'get' of undefined" I use the shaped sheet, and I defined it in the one-click.
1516804412
Ada L.
Marketplace Creator
Sheet Author
API Scripter
bruno said: The script is really good, but there is a message every time when the token approach to the trap: "(From Trap theme: 5E-Generic): Cannot read property 'get' of undefined" I use the shaped sheet, and I defined it in the one-click. Could you provide the GM notes for your trap?
The GM notes: {"damage":"8d6","missHalf":true,"save":"dex","saveDC":14,"spotDC":20,"revealLayer":"objects","stopAt":"none","message":"Burn baby burn!"}
1516820117
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Strange... Your trap is working fine for me using the 5E Generic theme with the Shaped sheet. No error message like the one above.
The trap works with 3 players, but other 4 players and NPCs have that error.
1516827390

Edited 1516827418
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I'm still not getting any error. Typically, when there's a message like that in the chat, there will be a stack trace to go along with it. If there's a stack trace in your API output console, could you share that?&nbsp;
The It's A Trap and sheet output and the last line is the stack trace: "5eShapedScript 1516843609013 INFO : -=&gt; ShapedScript v11.5.0 &lt;=-" "It's A Trap!: Registered TrapTheme - 5E-Generic." "☒☠☒ Initialized It's A Trap! using theme '5E-Generic' ☒☠☒" "5eShapedScript 1516843611158 INFO : Detected sheet version as : 15.7.2" "TypeError: Cannot read property 'get' of undefined\n at TrapTheme.getSheetRepeatingRow.then.rowAttrs (apiscript.js:9721:26)\n at process._tickCallback (internal/process/next_tick.js:109:7)"
1516894265
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Thanks, this helped me to track down the source of the bug. For whatever reason, it wasn't able to find the Perception skills for those characters. This was generating unexpected values for some of the TrapTheme code, particularly for finding attributes in repeating sections. I put in a patch for it on the Roll20 API repository, but it may take a few days for it to get merged into the One-Click system. Until then, you can grab the source for the new version here:&nbsp; <a href="https://raw.githubusercontent.com/Cazra/roll20-api" rel="nofollow">https://raw.githubusercontent.com/Cazra/roll20-api</a>... This patch probably won't fix the passive perception for those characters that are having problems, but it will prevent that error from showing up. To fix those characters, I would make sure that their skill list contains a row named "Perception" and check/uncheck its proficiency circle to make sure that its value is getting updated internally.
Thanks for the fix. There is not passives in Attributes & Abilities in sheets with that problem.
I fix it with !shaped-config, in Display I turn Passive Skills on, and !shaped-apply-defaults in all tokens.
My players are activating the traps when they move around it. What can I do?
1517513715
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Do your traps or your players' tokens have extra space transparent between the actual picture and the bounding box? The collision detection used by It's A Trap does collisions based entirely on tokens' bounding boxes with the boxes of other tokens or with paths/polygons. So if their bounding box is larger than their token, the invisible space of their tokens could be moving through the trap area or vice versa.
The traps tokens are from roll20. My players' tokens:
1517516773
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ok... again, have you checked their bounding boxes for overlap?
How I verify it?
1517517547

Edited 1517517712
Ada L.
Marketplace Creator
Sheet Author
API Scripter
When you select a token, you'll see a rectangle around it with transform handles. That's the token's bounding box. If at any point during the movement the bounding box of a token would pass through the bounding box of the trap (assuming the trap itself is the triggering mechanism rather than a triggering path), then the trap will be activated. This mistake could be easy to make especially if you aren't using a grid in your game.
I tested and I think it's the Size property from page. If the Size is 1 there is no problem, but the map with Size 0.5 for exemple have that problem.
1517520334

Edited 1517520607
Ada L.
Marketplace Creator
Sheet Author
API Scripter
The grid size for the page is irrelevant. All of the collision algorithms are done using the tokens' pixel sizes and coordinates. At most it would just increase the granularity with which you can move the player tokens about the grid. Have you also checked that your traps' bounding boxes are aligned with the grid?
The trap are aligned with grid, the players' token too.
1517581173

Edited 1517581740
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Are any of your trap tokens rectangular? By default, the script expects that all trap and character tokens are circular. However, you could tell it that a trap is rectangular by setting its Trap Shape property to square.
1517592036

Edited 1517592474
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Patch v3.7.4 I just put in a patch to the It's A Trap script. By default now, traps will have their Trap Shape initialized to 'rectangle', since this is probably the most common shape users will use for a trap, especially when playing on a grid. <a href="https://github.com/Roll20/roll20-api-scripts/pull/570" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/pull/570</a>
1517612800

Edited 1517613038
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Update: It's A Trap! v3.8 This version includes the new property Ignore Tokens which allows you to set certain tokens to be ignored by the trap. These tokens will neither trigger the trap nor be affected by it when it activates. Additionally, all properties that require the user to select tokens or paths (such as Trigger Paths, Trap Shape, and Ignore Tokens) now use set, add, and remove operations. Set will replace the property's list with the currently selected tokens. Add will add the selected tokens to the property's existing list. Remove will remove the selected tokens from the property's existing list. I've also fixed a minor bug concerning deleted trigger paths. While we're waiting for this new version to get merged into One-Click, you can get the script early from here:&nbsp; <a href="https://github.com/Cazra/roll20-api-scripts/blob/3" rel="nofollow">https://github.com/Cazra/roll20-api-scripts/blob/3</a>...
Stephen L. said: This version includes the new property Ignore Tokens which allows you to set certain tokens to be ignored by the trap. These tokens will neither trigger the trap nor be affected by it when it activates. Awesome Stephen, thanks a bunch!
1518306926

Edited 1518310057
This looks amazing!!! {I need to take an API boot-camp i think..} Thanks for all the hard work Stephen
1518364362
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Oh, this update came at a great time, now instead of setting people's status to "fly" when the trap is set to ignore them, and just have it ignore them period. Good work!
1520437129

Edited 1520437228
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Update: Pathfinder Trap Theme v3.5 In this update, I've added support in the trap theme for Roll20's official Pathfinder sheet. Pull request pending: <a href="https://github.com/Roll20/roll20-api-scripts/pull/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/pull/</a>... Also in this update, the "Pathfinder" sheet option (for the sheet created by Sam M. and co.) has been renamed to "Pathfinder Community". Because of this, if were using the community sheet, then you'll likely see errors in the chat asking you to set the fields for various character sheet attributes. Just change the sheet to "Pathfinder Community" and you should be fine. To make use of the PF theme script while its pull request is still pending, you'll also need to add a script to mock up its user options state: on('ready', () =&gt; { &nbsp; &nbsp; state.itsatrapthemepathfinder = { &nbsp; &nbsp; &nbsp; &nbsp; useroptions: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sheet: 'Pathfinder Official', &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; ac: 'ac', &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; fortSaveModifer: 'fortSave', &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; refSaveModifier: 'refSave', &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; willSaveModifier: 'willSave', &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; perceptionModifier: 'perc', &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; cmd: "cmd", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; enablePassivePerception: "1" &nbsp; &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; &nbsp; passPercAttempts: {}, &nbsp; &nbsp; &nbsp; &nbsp; trapSpotterAttempts: {} &nbsp; &nbsp; }; &nbsp; &nbsp; globalconfig.itsatrapthemepathfinder = undefined; &nbsp; &nbsp; log('TEST - mocking up globalconfigs for ItsATrap PF Theme.'); });