Trigger Happy (Teleportation Tutorial)

Hello! It seems that a lot of people liked the idea of teleportation, This small post teleports the “token/player” to a separate place. It can be on another scene, and the player will follow. Troubleshooting is at the bottom if you need any further help.

As that is covered, some things to go over:

Have Trigger Happy Installed.
Have Furnace Installed.
Have Dynamic effects Installed.
Have a Journal Entry named Trigger Happy.

image

Macro - Start here

To start off, make a macro.
Name it: TeleportToToken
Make sure it is set to: Script
Disable Execute Macro As GM

Dynamic Active Effects
DAE.teleportToToken(token, args[0], args[1], args[2])
Dynamic Effects
DynamicEffects.teleportToToken(token, args[0], args[1], args[2])

Save.

Note:

You don’t have to change anything here. We’ll be using it later.
image

Actor

Now we have to make an actor. Create a normal character. Name it anything you want. For this tutorial, we’ll call this Stairs.

Now, before we put this character on the board, we need to unlink it.
For this tutorial, we’ll also change the token of this character to a transparent picture.

Tip: While we’re here, put Display name to Owner, this will help you recognise what token you’re trying to teleport later. Thank me later.

Note: You only need this 1 Actor from now on. No need to clutter your Actors directory

Token

Now, drag this Actor onto the board. Then Double Right-Click on it. This should bring up Token Configuration again.

This is going to be our Teleportation from token, so I’ll name it Stairs1 For this tutorial.

image

Now we are done with the Teleporting From Token. Place this where you want them to teleport from as they step onto it.

Tip: After you’ve placed the Token, you can make it bigger by changing the Width/Height values in Image

Endpoint/Other Side
So now that we have a place to teleport from, we need a token to teleport to. This token can be made on a new scene, or on the same scene if wanted. Drag the previously made Actor of Stairs Onto the board once more, make sure you place it where you want the Player/user to land.

Double Right-click this new Token, and re-name it. For this tutorial, we’ll call this one Stairs2.

You can make the same changes to this token as to the last one.
Now we have an endpoint.

Trigger Happy

Now we get to the Trigger Happy part of this, which should be fairly straight forward.
Now that we’ve made our tokens, Stairs1 and Stairs2, we’ll use them here. What I’ll input into The Trigger Happy Journal Entry is(ctrl-shift-v to clear formatting on paste):

@Token[Stairs1] @Trigger[capture move] @ChatMessage[/TeleportToToken Stairs2 0 0]

@Token[Stairs2] @Trigger[capture move] @ChatMessage[/TeleportToToken Stairs1 0 0]

To explain the above text:

@Trigger[move] means "when someone Moves ONTO this @token[Stairs1]
This will happen: @ChatMessage[/TeleportToToken Stairs2 0 0]

It sends a Chat message: /TeleportToToken Stairs2 0 0
Where TeleportToToken is the Macro we created. Stairs2 is the token we’re teleporting TO.
The 0 0 Is offset, Where the first 0 is X and the second 0 is Y

The second line is for “moving back”. As these are stairs, I want my players to move back too, therefor I switched the token names, so when someone steps onto Stairs2 they get teleported to Stairs1.

From here on out, you can edit names of stairs as you want, but it should teleport any token that steps onto the Token(s).

Random Room Teleporter

To create a random room teleporter with the above context, it is easy.
To start off you’ll have to have the 2 characters, just like above.
Place a token they have to step onto to teleport to a random room.
Rename it, as shown above. In this example, we’re going to call ours Wildcard Portal.

Now, we need to make a Roll-table.
In this example, I’ll call this roll-table: Room Table
In this Roll-table, we’ll put in our different rooms. They all have to be text.
Room1
Room2
Room3

These are going to be our Exit Tokens Name.
So place out the token they where you see fit, at the entrance of the random room(s).
Re-name them after 1 of the options in the Roll-table.

Macro
Now we’ll make the macro to be used as the random teleport
Name it: RandomMap
Make sure it is set to: Script
Disable Execute Macro As GM
Macro:

let table = game.tables.entities.find(t => t.name === 'Room Table');
let result = table.roll().results[0];
DynamicEffects.teleportToToken(token, result.text, 0, 0)

image
Room Table Is the name of the Roll-table we made earlier.

Trigger Happy
Now for Trigger Happy, just as the previous one for the normal teleport, we need to execute this macro instead.

@Token[Wildcard Portal] @Trigger[move] @ChatMessage[/RandomMap]

Where @Token[Wildcard Portal] is the token we’re teleporting from, and /RandomMap is what we named the macro.

image

Now, if you want these room to teleport to another random room, like let’s say a tower, you’ll have to make a Exit Token, and a Entrance Token for each map/floor. So the entrance tokens needs to be re-named individually, like Floor1, Floor2, Floor3, and the exits also needs to be named individually:
Wildcard1, Wildcard2, Wildcard3.
They all also need to be put into Trigger Happy individually.
It will cause problems to just put out a token with the same name, so just trust me. It is less confusing, a bit more work, and won’t cause bugs.

Troubleshooting


Problem 1 - Token Stuck after teleportation/Copies of Token 1
Make sure, if you’re using a folder for Trigger Happy, that the Journal you’re using is not named “Trigger Happy”. This will make the token teleport twice and make some weird bugs. Just re-name the Journal Entry.


Problem 2 - It doesn’t teleport/Doesn’t work correctly
Text Formatting might’ve followed. Go into Source code and delete the formatting.
To get to source code, press <> while editing the text.

If you have any doubts of what should be there, here is a “normal” one:

Remove anything along the lines of:

<span style="background-color: rgba(27, 31, 35, 0.05); color: #24292e; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace; font-size: 13.6px;">

Problem 3 - Copies of characters 2
If you’re struggling with copies of characters being spawned, you might be struggling with multiple tokens with the same name. If the teleportation tokens have copies, they will spawn copies. Each Token Needs a different name, both Sender and Reciever Teleportation token.

Reason

If your trigger happy specification (or indeed your macros) call DynamicEffects.teleportToToken more than once for the same actor token you will get new copies of the token for (up to) the number of times you called the function. The teloportToToken function does the following:
1. find destination token (the argument to the teleportToToken function)
2. create a copy of the actor token at the location of destination token found in step 1
3. activate scene where the destination token exists (might be the same scene)
4. delete original actor token
If you call the function more than once (and the delete has not yet happened) it will create another copy of the actor token.

The function is supposed to be executed by the player whose token is to be teleported. Usually that means you want you player to step onto/activate the teleport. If you do it as DM then the scene change will happen for YOU not the player, (the token will still be created and then the original deleted) and when the token is deleted the player will be informed they have no token with vision and the scene will go black.

The whole teleport thing works without the GM being present on the scene where the teleports activate. So you can have players on different scenes as they move over teleports. This is the way it is supposed to work. I have had the party spread out over 3 different dungeon levels as they try to go up and down stairs.

@tposney


Any other problems?

You can either leave a comment here, in Kakarotos Discord Server, or in Foundrys #Module-Discussion. Just ping @Kevin-#0001 Or @Kakaroto.

2 Likes

Hi,

Love the teleport, they work great.

One small problem I have experienced is that when a player goes through a teleport to another map, they token is deleted and re-created, the new scene is loaded however the player can’t pan their map.
The fix at the moment is that if they click anywhere off the map (side bar, top of the browser, off screen) they can then pan the map. But if they teleport and then immediately try to pan the map once the screen has switched it does not work. There are no errors being thrown in the console. Any ideas what could be causing this? I have a feeling this is something to do with the way FoundryVTT is executing this code, but wondering if there is anyway we can stop this from happening, its not a game ender but is annoying for my players.

Thanks!

I believe that was a core bug in Foundry 0.6.0, updating to 0.6.2 should fix the problem. Make sure you haven’t set your Game to use a specific version of Foundry and it should auto update the next time you launch it.

I am currently using Core 0.6.2 but still having the issue occur. I’ll inquire about it in the Foundry discord. Thanks.

Weird, last person with that issue confirmed updating to 0.6.2 fixed it for them. Make sure another module is not causing the problem, then check with the foundry support if that doesn’t help. Might be hard to debug since it’s a pretty specific situation that happens through a module rather than from a core feature, so not sure how much more help they could give as well.

That was a foundry bug, which has now been fixed. It was the same problem if you pulled a token to the scene. And it was not fixed in 0.6.2, from recollection not until 0.6.4 but I could be telling a fiv.

Foundry 0.6.5
TriggerHAppy 0.5
DynamicEffects 0.5.76
Furnace 2.1

Hello there @mbenson111 ! It looks like you’re running into testing problems by yourself?
That is an error for: A GM not being online.
Dynamic effects need a GM to be online to work, therefore I recommend having a second tab open(ctrl + shift + n) where you can test as a player and a GM at the same time.

If you’re further running into this problem, it happens because a player loads before a GM.
I would recommend just connecting as the GM before all your players.

Why it teleports the player to that scene is because it doesn’t actually need GM permission to switch scene.

Hope this helps ^^

Thank you. That was it.