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

1474124967

Edited 1474125041
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I've got a non-standard use question for the script. I've got some hazards coming up that are not a standard circle/square. Any suggestions on how I might use the script to autoresolve those? The hazards are some flowing streams of toxic material with gasses rising from them. I could just put a bunch of standard trap tokens along the route, but I'm wondering if there might not be a better way.
Very cool concept Scott!
1474128649
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Scott C. said: I've got a non-standard use question for the script. I've got some hazards coming up that are not a standard circle/square. Any suggestions on how I might use the script to autoresolve those? The hazards are some flowing streams of toxic material with gasses rising from them. I could just put a bunch of standard trap tokens along the route, but I'm wondering if there might not be a better way. When I need to set up these kinds of hazards in my game, I usually set it up as a chain of separate trap tokens using square collisions. I can see how this could sort of pollute the map with too many GM layer tokens. I'll think about future enhancements I could make to help out with this. Maybe something along the lines of being able to use the polygon tool to draw out a collision trigger area.
1474129413

Edited 1474129543
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
@Gary W.:Heh, I'm running an Iron Gods campaign for some friends (or at least based on Iron Gods). The party is larger than the 4 the AP is designed for, so I get to give my evil side free reign. The rising gases, which are the vapor from boiling numerian fluids, have a variety of effects and should prove particularly nasty when paired with the hover ability of the mutant manticore that they are about to fight. Mwahahahahaha :) There is of course at least one way that they can negate the hazard (because I'm not totally evil), but we'll have to see if they even think to try something to get rid of it. @Stephen: Yeah, was thinking that might be a good future feature (although might not be worth it code intensiveness wise, is that even a phrase?)
1474131054

Edited 1474131081
Ada L.
Marketplace Creator
Sheet Author
API Scripter
It would be challenging to program. Currently TokenCollisions only handles collisions between circular and rectangular-shaped tokens, and even that takes some fancy mathematics.
1474218840

Edited 1474219607
So I took the liberty of making a trap script creation macro that makes the process of creating a trap much easier. For the full benefit of this macro, you should install Token Mod by TheAaron as well. Enjoy! /w gm **COPY THE FOLLOWING INTO GM NOTES** {"damage": "?{Trap damage?|1d6+1}","fx": "?{FX Effect? (Leave blank for none)|explode-fire}","message": "?{Message?|A magical glyph flashes to life and then erupts in a whirling storm of fire!}","missHalf": ?{Half damage on a successful save?|true},"notes": "?{Notes?|This trap alerts nearby monsters.}","gmOnly": ?{Output to GM?|true},"save": "?{Save stat?|dex}","saveDC": ?{Save DC?|14},"spotDC": ?{Perception DC?|12}} /w gm **If you have Token Mod, click the token you want to use, then press this button:** [Trap Marker](!token-mod --set statusmarkers|!cobweb)[Reveal Marker](!token-mod --set statusmarkers|!bleeding-eye)
1474230692
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Nice! I was thinking about adding some sort of chat menu for the script like this in the near future, but it looks like you've saved me some of the work. :)
1474230978
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Oh, Stephen, I came up with another question. Is there a reason why entering <br> into say the message doesn't actually have an effect?
1474234190
Ada L.
Marketplace Creator
Sheet Author
API Scripter
It does this because it needs to escape the content of the GM Notes so it can read it as JSON. This has the side-effect of also escaping HTML tags in the message string.
1474234558
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
ah, so, there's no way to put line breaks into the message then.
1474236107
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Right. No other HTML will work inside messages either. It'll all be escaped.
Hi guys, I am having some issues with the passive searching, my token instead of finding the trap it is being pull by the trap and then the trap activates, can you please give some advise on how make the passive searching work so my PCs can detect the trap? I installed first the it's a trap and then the 3.5 theme. thanks, Moises H.
1474245170

Edited 1474245256
Ada L.
Marketplace Creator
Sheet Author
API Scripter
If you're trying to passive search by moving the token into the trap's area, the trap will activate. Passive searching only requires that the token has line of sight to the trap. If you're still having issues. Please share the JSON you have set in the trap's GM Notes.
Also, I know this is obvious, but I'm just going to mention this in case there's someone out there who hasn't thought of this yet. When you're done making your traps, give them a character sheet, and add their completed token to the sheet. Then you can drag out the same trap to the GM layer any time you want. It makes building maps with traps on them SO much faster.
Howdy guys, I just returned after a weeks hiatus and the latest update broke my script. I get this error whenever I try to activate a trap. (5-ogl) Any idea on what I'm doing wrong? TypeError: Cannot read property 'total' of undefined TypeError: Cannot read property 'total' of undefined at apiscript.js:13678:39 at apiscript.js:13567:9 at checkFinishedOps (eval at (/home/node/d20-api-server/api.js:1:0), :758:7) at eval (eval at (/home/node/d20-api-server/api.js:1:0), :838:8) at null._onTimeout (/home/node/d20-api-server/node_modules/underscore/underscore.js:768:19) at Timer.listOnTimeout (timers.js:92:15)
1475110620

Edited 1475111886
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ravenknight, please share a sample of the JSON for the trap that is giving you trouble. This could help me tremendously in diagnosing the problem. I made some changes recently to refactor all of the existing trap themes. Although I tested them as extensively as I can in my sandbox, I wouldn't be surprised if something broke. It also looks like the 5E-OGL sheet was updated recently. When the sheets get updated, that tends to break things too. These trap themes can be fragile. ;;;>.> The trap themes now also have HtmlBuilder as a dependency. If that's missing, installing that might fix things.
Hi Stephen, and thanks. I added HTML-builder but the problem still persists. The JSON I'm using is the one found on the very top of this thread. { "attack": 4, "damage": "2d8 + 6", "message": "A pressure plate gives way and darts fire forth from hidden compartments in the walls!", "notes": "If the character is hit, they also become poisoned.", "spotDC": 14 }
1475123251
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Hmmm.... I just tried your JSON to set up a trap using It's A Trap 2.6 installed from One-Click and the latest 5E-OGL trap theme (v 1.2), but it's working properly here. For some reason, the 5E-OGL theme isn't available through OneClick. Do you have version 1.2 installed for that?
I'm an idiot. :/ And 1.2 works fine when you install all of it. Thanks a lot for your help and patience Stephen.
1475139643

Edited 1475139961
Ziechael
Forum Champion
Sheet Author
API Scripter
Side note: since the update when my sandbox spins up I get about 5x the following message: "ERROR - It's A Trap!: TrapTheme does not exist - DnD-3.5. Using default TrapTheme." Followed later on by: "It's A Trap!: Registered TrapTheme - DnD-3.5." Not sure where the second '.' is coming from in the error message though...? Ok, after a quick test it seems to not work at present either giving the following error message in chat: With this trap json: { "attack": 4, "damage": "2d8 + 6", "message": "TEST DON'T WORRY" }
1475154878
Ada L.
Marketplace Creator
Sheet Author
API Scripter
You'll need to install the HtmlBuilder script (available through OneClick), which is a new dependency of It's A Trap. It seems that the OneClick system doesn't install new dependencies automatically when a new version of a script requires it. I'll put in a bug report about this so that perhaps in the future this will be taken care of automagically.
1475156884
Ziechael
Forum Champion
Sheet Author
API Scripter
Well shucks, that makes perfect sense when you put it like that... thanks :)
This is my JSON. I have three problems. I am using the shaped 5E theme. {"attack": 4,"damage": "1d6+1", "fx": "nova-fire" ,"message": "A magical glyph flashes to life and then erupts in a whirling storm of fire!","notes": "This trap alerts nearby monsters.","gmOnly": true,"spotDC": 12, "Sound": Zombies } FIRST: Despite what I check in the script configuration menu I get my token sent to the map layer. Is there a bit I can add to the JSON to determine the layer it gets sent to? B: I can't get the FX to work. I've found that form-color  is what works for FX hence nova-fire . I've been unsuccessful in getting it to work. FINALLY: Can't get the sound aspect to work. I renamed the track in the jukebox to "Zombies" thinking that would be the problem but no luck. I did scroll through the forum posts and learned some stuff, I especially liked Trigshots macro for creating traps but I've been unable to resolve this.
1475675629
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Thanks for providing these details, Ian. This will really help us get this fixed for you sooner.  FIRST: You can configure whether traps' tokens are sent to the map layer or the graphics layer using the script's revealTrapsToMap user option on its One-Click page. I might consider adding a JSON option to configure this as well though in the next version. B: Your FX is correctly configured. It is probably not going off because it is hitting another bug that causes it to stop early before it gets to the code that produces the FX. FINALLY: You need to put double-quotes around Zombies. E.g. "Sound": "Zombies". Let me know if that helps get things to work.
So I've been helping a friend out by adding scripts for her, and she doesn't like the fact that admiral ackbar announces it. However, she likes everything else about it. How exactly do I change that, but leave everything else?
1475686189
Ada L.
Marketplace Creator
Sheet Author
API Scripter
On the One-Click page there is an announcer option. By default, this is Admiral Ackbar, but it can be changed.
Ahh, I had not been using the One-Click page -_-. Thanks for the help
1475787973

Edited 1475788485
Hello there, I'm having a few issues with the script though I would like to say I love that it's a thing. Makes my Mummy adventure prep easier and cooler! So first thing, regarding the passive spot. How do I make sure my players have the right passive spot if they've got trap sense to notice traps? Second, when I use the first dart trap default, it seems to work fine save for DM notes which do not appear. I get a  ' (From ItsATrap-Pathfinder):accouncer is not defined' In yellow above the output and no dm notes. I've got the announcer filled out in the single click options, even changed it to Pharoah Ackbar II to fit the game. Edit: any way to get this working for chests or doors which are enabled by DM rather than someone walking on it? 
1475846591

Edited 1475846612
Ada L.
Marketplace Creator
Sheet Author
API Scripter
The "accouncer" bug is a known issue. I'll have it fixed in the next version of this script, whenever I have time again to work on it. Sorry for the inconvenience. :/ I'm not sure what you mean by the chests and doors. Do you mean having a trigger for them to appear in a separate space?
I mean is there some macro I can write to a token script to trip a trap on my own without having someone walk over it, indeed making it immune to the 'walking over it' thing? For example so I can make sure a chest pops up only when the player is trying to unlock it.
1475854580
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Not currently. That sounds like a good idea for a future enhancement though.
Help, I am using the It's a trap! default Theme and I am using the following JSON: { "api":"!token-mod --ids -KTRled3kS6c0S2mse56 -KTRlx7qlD4M5cxYJ_2y --set layer|map", "message":"test" } I do not get an error and the "test" message appears.  The problem is the api script does not run.  If I cut and pasta !token-mod --ids -KTRled3kS6c0S2mse56 -KTRlx7qlD4M5cxYJ_2y --set layer|map in to chat window it works fine.  What am I doing wrong.  
1475860023
The Aaron
Pro
API Scripter
Do you have Players Can IDS turned on in TokenMod?  Probably the user this comes through as is 'api'.  When TokenMod validates if they are allowed to use the --ids argument, it would get playerIsGM('api') === false and reject the command without the players having permission to use --ids. I can add an exception for 'api' as a playerid, but I'd never considered doing it before.  =D  Let me know if that fixes it.
Thanks that was the problem.
1475862612
The Aaron
Pro
API Scripter
Great!
1475865680
Ziechael
Forum Champion
Sheet Author
API Scripter
ChaosCowboy said: I mean is there some macro I can write to a token script to trip a trap on my own without having someone walk over it, indeed making it immune to the 'walking over it' thing? For example so I can make sure a chest pops up only when the player is trying to unlock it. When I want things like that I keep a transparent token with a small aura that only the DM can see nearby, that way I can use that to 'trigger' the trap as and when I want to ;)
1475882163
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Update: It's A Trap v2.7 <a href="https://github.com/Cazra/roll20-api-scripts/tree/T" rel="nofollow">https://github.com/Cazra/roll20-api-scripts/tree/T</a>... Passive searching now supports a maximum search distance for traps using the 'searchDist' JSON option. Trap JSON now supports a "triggers" property which contains a list of names or IDs of other traps that this trap will trigger. The script now installs a token action macro to manually select and activate traps. Fixed "accouncer" bug.
I have gotten the sound AND the FX to work. However I am now running into issues with targeting. It is preset to go off on the center of the trap. I would like the option to have it go off on the token.&nbsp; for instance my JSON now looks like this "fx": "bomb-fire" This now works wonderfully. I don't know if its the update you just did or what. However if I were to use the command /fx bomb-fire @{target|Foe|token_id} Then the target would be one which I would designate using the mouse. Obviously for our purposes that just won't do. I've also tested it, just for kicks, and it invalidates the entire trap. So then I noticed that you have the victimId property. Is there way I can set the FX on a trap that is 10x10 squares and a stopAt property of "none" or "edge" to go off on the token instead of the center of the trap? My next best guess to make this work would be /fx bomb-fire @{victimId} Is this possible with the current version? It seems like it should be if one is clever enough to figure it out. It's 3:04 AM here though and I have work at 9. So I'm gonna reach out and see if you have anything to add before I try at it again.
1476021296
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Avatar of Woah said: I have gotten the sound AND the FX to work. However I am now running into issues with targeting. It is preset to go off on the center of the trap. I would like the option to have it go off on the token.&nbsp; for instance my JSON now looks like this "fx": "bomb-fire" This now works wonderfully. I don't know if its the update you just did or what. However if I were to use the command /fx bomb-fire @{target|Foe|token_id} Then the target would be one which I would designate using the mouse. Obviously for our purposes that just won't do. I've also tested it, just for kicks, and it invalidates the entire trap. So then I noticed that you have the victimId property. Is there way I can set the FX on a trap that is 10x10 squares and a stopAt property of "none" or "edge" to go off on the token instead of the center of the trap? My next best guess to make this work would be /fx bomb-fire @{victimId} Is this possible with the current version? It seems like it should be if one is clever enough to figure it out. It's 3:04 AM here though and I have work at 9. So I'm gonna reach out and see if you have anything to add before I try at it again. I'll see about putting that enchancement to FX in the next version. Marie said: Hey, first of all - that script is awesome. But I have a question about the area of effect - if the trap is triggert when more then one person is in the area it gives out the message 2 times, one for each token. Is it possible to put one name in each? So that you get a specific message for each token (maybe with different dmg for each when the dmg is lower if you stand further away)? That's all specific to the trap theme being used. All the trap themes I've implemented, except for the default one, will display names and separate attacks/saves/damage for each character in the area.
Stephen L. said: If you're trying to passive search by moving the token into the trap's area, the trap will activate. Passive searching only requires that the token has line of sight to the trap. If you're still having issues. Please share the JSON you have set in the trap's GM Notes. Sorry Stephen I didnt read your comment because I lost this thread until today, I sent you a private message, so my JSON is: { "fx": "bomb-magic", "message": "Encuentras la tumba de Helene Aerdune", "sound": "Fantasma", "spotDC": 12 } Another question is:&nbsp;How I know the token has line of sight with the trap? I mean, I even put the PC token below the trap token and it doesnt activates. Thanks, Moises H
1476173102

Edited 1476174208
Hi there, Trying to get it to work with OGL... getting this error: IT'S A TRAP!!! ERROR: invalid TrapEffect JSON. MISS! Using this on the trap notes: { "damage": "2d6", "message": "The floor opens beneath you revealing a pit. You try to catch on to the ledge", "notes": "A creature attempting to skirt around the pit using one of these ledges must succeed on a DC 10 Dexterity (Acrobatics) check.A creature that triggers the trap or fails the Dexterity check to skirt around the edge of the pit must attempt a DC 15 Dexterity saving throw to catch the edge. On a failed save, the creature falls 20 feet to the dirt floor of the pit, taking 2d6 bludgeoning damage and landing prone.", "fx": "", "save": "dex", "missHalf": false, "saveDC": 15, "spotDC": 15, "searchDist": 10, "sound": "Pitfall Trap - SidnSound", }
1476185417
Ziechael
Forum Champion
Sheet Author
API Scripter
Pord said: { "damage": "2d6", "message": "The floor opens beneath you revealing a pit. You try to catch on to the ledge", "notes": "A creature attempting to skirt around the pit using one of these ledges must succeed on a DC 10 Dexterity (Acrobatics) check.A creature that triggers the trap or fails the Dexterity check to skirt around the edge of the pit must attempt a DC 15 Dexterity saving throw to catch the edge. On a failed save, the creature falls 20 feet to the dirt floor of the pit, taking 2d6 bludgeoning damage and landing prone.", "fx": "", "save": "dex", "missHalf": false, "saveDC": 15, "spotDC": 15, "searchDist": 10, "sound": "Pitfall Trap - SidnSound", } Try the following: { "damage": "2d6", "message": "The floor opens beneath you revealing a pit. You try to catch on to the ledge", "notes": "A creature attempting to skirt around the pit using one of these ledges must succeed on a DC 10 Dexterity (Acrobatics) check.A creature that triggers the trap or fails the Dexterity check to skirt around the edge of the pit must attempt a DC 15 Dexterity saving throw to catch the edge. On a failed save, the creature falls 20 feet to the dirt floor of the pit, taking 2d6 bludgeoning damage and landing prone.", "save": "dex", "missHalf": false, "saveDC": 15, "spotDC": 15, "searchDist": 10, "sound": "Pitfall Trap - SidnSound" } Main points of note, no ',' after the final parameter and complete removal of not-required parameters (ie. fx)
1476186522

Edited 1476187403
Ziechael said: Pord said: { "damage": "2d6", "message": "The floor opens beneath you revealing a pit. You try to catch on to the ledge", "notes": "A creature attempting to skirt around the pit using one of these ledges must succeed on a DC 10 Dexterity (Acrobatics) check.A creature that triggers the trap or fails the Dexterity check to skirt around the edge of the pit must attempt a DC 15 Dexterity saving throw to catch the edge. On a failed save, the creature falls 20 feet to the dirt floor of the pit, taking 2d6 bludgeoning damage and landing prone.", "fx": "", "save": "dex", "missHalf": false, "saveDC": 15, "spotDC": 15, "searchDist": 10, "sound": "Pitfall Trap - SidnSound", } Try the following: { "damage": "2d6", "message": "The floor opens beneath you revealing a pit. You try to catch on to the ledge", "notes": "A creature attempting to skirt around the pit using one of these ledges must succeed on a DC 10 Dexterity (Acrobatics) check.A creature that triggers the trap or fails the Dexterity check to skirt around the edge of the pit must attempt a DC 15 Dexterity saving throw to catch the edge. On a failed save, the creature falls 20 feet to the dirt floor of the pit, taking 2d6 bludgeoning damage and landing prone.", "save": "dex", "missHalf": false, "saveDC": 15, "spotDC": 15, "searchDist": 10, "sound": "Pitfall Trap - SidnSound" } Main points of note, no ',' after the final parameter and complete removal of not-required parameters (ie. fx) Yup.... worked... didnt spot that thanks. Just got to fix this part now: "ReferenceError: accouncer is not defined\n at Object.announceTrap (apiscript.js:7667:16)\n at apiscript.js:8567:18" Seems to be in reference with the&nbsp;"notes"
1476192166
Ziechael
Forum Champion
Sheet Author
API Scripter
Stephen has fixed that bug in a pull requests a few days back. It should be live via one-click in a few more days by normal time frames, or you can grab the code from his&nbsp; github .
Hello everyone, I'm trying to use the 2.7 script with the OGL theme of this and am having trouble getting any of the definitions to "activate." I tried using the example code included in the OGL Theme readme page, but even those just produce a blank trap box in the chat. To be clear, I've one-click installed both the base script at latest (2.7) and 5E-OGL (v1.2).&nbsp; When a player passes a trap, it does rubber-band them back to the trap square and display the base message, but nothing else. This is what my GM notes has: { "damage": "2d6", "message": "A 6 ft diameter hole appears in the floor before you", "missHalf": false, "notes": "Portable hole is 10ft deep", "gmOnly": false, "save": "dex", "saveDC": 17, "spotDC": 13 } And this is what it returns in chat: In the gif it shows that this box is supposed to contain rolls for the save and the damage, but I don't know why they aren't appearing. As an aside, is there any way to change the header of the bar so that it doesn't say "IT'S A TRAP!!!" using the one-click version? Or would I have to import?
1476661461
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Not sure. Your trap JSON is working just fine for me. You did remember to set the script's trap theme to "5E-OGL", right? There isn't a way to change the text in the trap's header bar. This is intentional to make it unambiguous which script generated the message.
Yeah, here's my as-is for the theme: &nbsp; Maybe it would also be relevant to post my script lineup: I have both the base It's a Trap! and the 5E theme applied, plus when I added the base one it added a whole bunch of those Math ones. I have the character sheet tied to the token which is representing the trap. I didn't change anything else on it, like my bars are all empty and I don't have auras set for passive detection or anything. Should I not have both scripts? In terms of the scripts, I haven't messed with any of them except for changing the name of the announcer on the base script.&nbsp; Is there any other relevant data I can give you? Maybe I have to do something to my player's character sheets?
1476679175
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Are your characters' tokens bound to their characters?