Traps

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
User avatar
PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

Traps

Post by PinkRose »

How do you do traps?

Right now I have a clean hall way with a visible Pit on the Hidden layer and a Neon Green (so I can see it) token on top on the Hidden layer that says Untriggered Trap Below in the Player Notes.
When the trap is triggered, I delete the Neon Green token And then change the Pit token from Hidden to Object.

Is that the easiest way?
How do you do it?
I am a special snowflake!

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: Traps

Post by Lee »

I employ several approaches, but you'd probably best be served if you apply wolph's BoT, specifically the parts involving traps. No need to reinvent the wheel if you have one at hand, so they say ;)

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Traps

Post by wolph42 »

well... you can, BUT it most likely does require some coding as there is not something like a 'universal trap' usually a test needs to be rolled to trigger it. So what I did is create the tools for it with one example. How it works is relatively simple:
- place trap (= a standard token)
- write code that executes when someone steps on it. This can be as simple as [r:if(d20+dexBonus < 15):"You triggered a trap"]
- link code to it that is activated when someone steps on it (=macro button)
- initialize pads (=macro button)
ready!

now every time someone moves over it, MT runs the trap code. There is a manual explaining it better then this.

User avatar
PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

Re: Traps

Post by PinkRose »

Having difficulties.
First, amazing work. I looked at this a few years ago, and you've really put a lot of effort into this.
My problem is lastPath.
What is it? How do I set it? Why is it a problem?
I am a special snowflake!

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Traps

Post by wolph42 »

I need a bit more info. Lastpath is an array of Flores that the Pc token just moved. I don't see how that's a problem.

User avatar
PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

Re: Traps

Post by PinkRose »

I restarted MapTool, reloaded my original save, re-imported your stuff, and it's all working.
I may have altered something without knowing.
Seems to be working perfectly now.

Also, I was trying to reverse engineer from your campaign file and I get:
Unknown Library token "Lib:Sheet"
Just so you know.

I do appreciate you helping.
I am a special snowflake!

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Traps

Post by wolph42 »

"Lib:Sheet" ?? never heard off, you sure its not something from your campaign? What were you doing when you got that message?

User avatar
PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

Re: Traps

Post by PinkRose »

If I'm the only one experiencing it, then it must be an issue on my end.
I really love the Pit Trap token.
I do have another question though, how would you do a net trap?
Specifically, I want the image and roll to trigger when someone passes halfway through the token, like a trip wire.
I am a special snowflake!

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: Traps

Post by Lee »

That's tricky if doing it with tokens intersection in mind, and can only be accomplished if the token's not snapped to grid (to be able to evaluate partial intersections) with the help of Wiki: movedOverToken(). If a token's snapped to the grid, you'll have to take it out of the grid, check and snap it right back.

You can, of course, use coordinates stored somewhere and check if a token's area crosses any of the values found within while moving, instead.
Last edited by Lee on Tue Jan 15, 2013 6:35 pm, edited 1 time in total.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Traps

Post by wolph42 »

you can do that by adding a transparent token in the middle and assign the macro to that token. So if you have eg a net-token of size 3x3 then you can place the transparent token in the middle and link the macro event to that transparent token. This way when the player walk over that token its triggered, but would they walk over the side of the net it won't. The event macro (linked to the transparent token) should contain the token id of the net-token so you can use the ''image-swap' trick on that one instead. I hope this makes sense.

actually this resembles real life as the trip wire and the net are seperate in that case as well.

The other way is as lee described, by using the event area tools and designate the exact coord as the 'trigger area'. But I think that the transparent token trick is easier to set up (and you can also move it during the game, while a designated area is not).

edit: note that you can 'deform' tokens so they do not need to be square, but can also be rectangle sized. Just keep in mind NOT to rotate them! (as movedovertoken ignores that)

User avatar
PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

Re: Traps

Post by PinkRose »

Thanks for the replies.
A little (a lot) beyond me though.
I only reverse engineer code to make it work for me, I don't actually code.

Code: Select all

The event macro (linked to the transparent token) should contain the token id of the net-token so you can use the ''image-swap' trick on that one instead.
This is the part I can't do. I don't see a spot for the token id that is called for when a token passes over the transparent token.
I see the eventPadTriggered = arg(4)
But changing arg(4) to NetToken1 didn't work.
Is the token id different than the name? Where do I find it?

PS I tried to search, in case that's your first thought, but token is used too much on the boards and id is too short of a search term.
I am a special snowflake!


User avatar
PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

Re: Traps

Post by PinkRose »

Ok. So now there are quotes. Thanks.
Now I get the following in chat

Code: Select all

java.lang.NumberFormatException: For input string: "x" error executing expression x = json.get(entryPoint, "x").
I am a special snowflake!

User avatar
PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

Re: Traps

Post by PinkRose »

The more I think about this, the more I think I'm making this too complicated.
Doing it manually will be a better fit for my games.

So I've just added 2 macros to the object to show the Net then hide the net.

But thank you for the attention and time to my (lack of) problem.
I am a special snowflake!

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Traps

Post by wolph42 »

giving up so soon?
I had a look and I noticed that you addressed the wrong variable (I wrote this about 14 months ago so it was not very clear to me). eventpadtriggered is an json array (containing the coords of where the token moved over the pad) NOT a token name. 'padName' is the tokenname (a bit of a duh here). so try that one.

After all I assumed you wanted to change the image for the net-trap when a player moved over it. With that in mind I would assume that

Code: Select all

[h, token(padName): setTokenImage(getTokenHandout())]
is rather a dead give away to which variable you need to change...

edit: by the way, when you have the net/transparent tokens finished including the altimage (assuming you make one), can you post them here. I like the idea and I'll add them to the BoT.
One suggestion: the net-trap starts on the object layer and when a token moves over the 'tripwire' token you can not only change the pic into a smaller net but also add a token state in the form of a net overlay. This state you can add to the token as soon as its trapped which will look like its actually in the net.
In short: gimme the images and I'll implement it in the example campaign.

Post Reply

Return to “MapTool”