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

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

December 12 (7 years ago)
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: https://github.com/Roll20/roll20-api-scripts/pull/...
January 02 (7 years ago)
so I am setting traps and notice it is not outputting any damages when it is triggered - any suggestion?
January 02 (7 years ago)
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:
  1. What trap theme are you using?
  2. Share what your trap has in its GM Notes. Please be sure to put this in a code block...
...like this.
January 02 (7 years ago)
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).
January 02 (7 years ago)
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'.
January 02 (7 years ago)
Oh, great! What you say works perfectly in this case. Thanks!
January 02 (7 years ago)
In fact, it works whenever there are no flying creatures, and even when there are, you can just change the icon representing 'actual fly'.
January 02 (7 years ago)

Edited January 02 (7 years ago)

Stephen L. said:


It's working fine here. I would suggest though that you share the following information to help track down the problem:
  1. What trap theme are you using?
  2. 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) 
{"message":"A saw quickly approaches you","stopAt":"none","revealWhenSpotted":true,"revealLayer":"objects","sound":"Buzzsaw","damage":"5","spotDC":16,"triggerPaths":["-L1pHAVCKusCvXAJFOPE"],"attack":5}
January 03 (7 years ago)
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.
January 03 (7 years ago)

Edited January 03 (7 years ago)
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?
January 03 (7 years ago)

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! & It's A Trap! - D&D 5E Generic. that's it.
January 03 (7 years ago)
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
January 04 (7 years ago)

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.
January 04 (7 years ago)
https://imgur.com/a/WcOAI
Which browser are you using?
January 04 (7 years ago)
Browser isnt the issue. I have the traps in 2 games. It works in 1 one of them fine and not the other one. 
January 04 (7 years ago)
Nover C. said:
https://imgur.com/a/WcOAI

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 Theme-specific properties Damage  You have "5" set. That means it will ALWAYS be 5 dmg. You need to change that to a represent the type of "die" roll you want.  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. 

January 04 (7 years ago)

Edited January 04 (7 years ago)
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: https://github.com/Roll20/roll20-api-scripts/pull/558

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.
January 04 (7 years ago)
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.
January 04 (7 years ago)
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.
January 04 (7 years ago)

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
January 05 (7 years ago)
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.
January 24 (7 years ago)
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!"}
January 24 (7 years ago)
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.
January 24 (7 years ago)

Edited January 24 (7 years ago)
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? 
The It's A Trap and sheet output and the last line is the stack trace:

"5eShapedScript 1516843609013 INFO : -=> ShapedScript v11.5.0 <=-"
"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)"
January 25 (7 years ago)
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: https://raw.githubusercontent.com/Cazra/roll20-api...

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?
February 01 (6 years ago)
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:

February 01 (6 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ok... again, have you checked their bounding boxes for overlap?
How I verify it?
February 01 (6 years ago)

Edited February 01 (6 years ago)
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.
February 01 (6 years ago)

Edited February 01 (6 years ago)
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.
February 02 (6 years ago)

Edited February 02 (6 years ago)
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.

February 02 (6 years ago)

Edited February 02 (6 years ago)
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.

https://github.com/Roll20/roll20-api-scripts/pull/570
February 02 (6 years ago)

Edited February 02 (6 years ago)
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: https://github.com/Cazra/roll20-api-scripts/blob/3...

February 05 (6 years ago)
Ravenknight
KS Backer

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!
February 10 (6 years ago)

Edited February 11 (6 years ago)
This looks amazing!!!

{I need to take an API boot-camp i think..}

Thanks for all the hard work Stephen
February 11 (6 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter
February 12 (6 years ago)
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!
March 07 (6 years ago)

Edited March 07 (6 years ago)
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:
https://github.com/Roll20/roll20-api-scripts/pull/...

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', () => {
    state.itsatrapthemepathfinder = {
        useroptions: {
            sheet: 'Pathfinder Official',
        //    ac: 'ac',
        //    fortSaveModifer: 'fortSave',
        //    refSaveModifier: 'refSave',
        //    willSaveModifier: 'willSave',
        //    perceptionModifier: 'perc',
        //    cmd: "cmd",
            enablePassivePerception: "1"
        },
        passPercAttempts: {},
        trapSpotterAttempts: {}
    };
    globalconfig.itsatrapthemepathfinder = undefined;
    log('TEST - mocking up globalconfigs for ItsATrap PF Theme.');
});