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

Can the It's a Trap API and Token Mod API Scripts move a "non-victim" target to the GM Layer?

Greetings, all. I've created a Pac-Man like map for my players to run through. I have the It's a Trap and TokenMod API scripts enabled. I can set up my "trap" icon. When my player moves over it, it displays the appropriate message. But what I'm trying to do is have it affect a third icon - a "power pellet" - so that when the player moves over the trap, it moves the power pellet to the GM Layer. I tested moving the power pellet by creating a macro - !tokenmod --ids energizer_1 --set layer|gmlayer - that if I run will move the power pellet. But I can seem to make it work when the player - the "victim" of the trap - steps on the trap space. When I enter that code into the TokenMod menu option for the It's a Trap, it moves my player icon to the GM layer, not the power pellet. I'm cetain that I could manually click on each power pellet and run the macro, or use the built-in menu options to move the power pellet, but I was hoping to automate the process by having the player move over the trap to move the power pellet.  Is there a way to accoomplish this? Is there possibly a different API script that exists that I need to use? Thanks all for any assistance.
1591506729
The Aaron
Roll20 Production Team
API Scripter
energizer_1 isn't going to be the id for the power pellet, if it's even anything. I don't know much about it's a trap, you probably will need to individually set up the command with the explicit id of each pellet, or write a custom script to hide the power pellet closest to the triggering player. 
Hey,The Aaron. I figured it out! Thanks again for your assistance. Your note about the token id inspired me to think about it differently. here's what I did you figure it out... Prerequisites: It's a Trap and TokenMod API scripts Needed tokens: I have six tokens on the Objects layer  - my player, four "ghost" tokens, and one "power pellet" token. I have one token on the GM layer to represent the trap space. Requirements: I do not want the ghosts to set off the trap. Also, I do not want the power pellet to set off the trap, because it needs to be placed where the trap token is. I only want the player to set off the trap. I do not want the player moved to any different layer. I only want to move the power pellet to the GM layer Solution: 1 - create the trap, set the Trigger Collision to None, and the Delay Activation to 0. 2 - Click the IgnoreTokenIds for the trap, and change the dropdown to set selected tokens -but do NOT click Submit just yet... 3 - Switch to the Objects Layer, and highlight your four ghost. Then hit submit on the window. 4 - Go back to the GM Layer, select your trap, and run It's a Trap. Look at the IgnoreTokenIds. You will see four long strings of values: example: -M9B_L_njuX7qTw0PsUf,-M9BZ1Fq_zNeUCr5SHh1,-M9BZgyTU0_L0Dr1Omq8,-M9BY8SGIvaMM58w7lFn you can actually copy this info and put it to the side. These are the TokenIDs for your four ghosts. But, we need to get the TokenID of the power pellet also.. 5 - Repeat steps 2,3, and 4, but this time highlight the four ghosts AND the power pellet. when you go back and look at the IgnoreTokenIDs, you will see five values... example: -M9B_L_njuX7qTw0PsUf,-M9BZ1Fq_zNeUCr5SHh1,-M9BZgyTU0_L0Dr1Omq8,-M9BY8SGIvaMM58w7lFn,-M9C-YomD7NDUqRabmkU That fifth TokenID - M9C-YomD7NDUqRabmkU - is for the power pellet. jot this down, because you will need it for the external API script. 6 - Click on the external API script button and enter the following script: !token-mod --ids -M9C-YomD7NDUqRabmkU --set layer|gmlayer --ignore-selected notice the single dash in front of the TokenId. Make sure it is there. 7 - Test your trap. Go Back to the Objects layer, and place the power pellet over the trap. It should not disappear, because the trap is currently ignoring it. Next, run your ghosts over the trap. Again, it should not trigger, because the ghosts are also ignored. Finally, run your player over the trap. The trap message should go off, and the power pellet shoud "disappear" by moving to the GM layer. If you are creating multiple power pellets, I found it easy to set the basic settings of the trap first, make multiple copies of the trap, then for each trap, perform the functions to get all of the TokenIDs. I hope this helps anyone else looking for a way to remove tokens via player movement over a trap space. It will take some time to set up, but it definitely works.