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

Spawn Default Token and ScriptCards

Hello, Can someone provide example code to  call SpawnDefaultToken from Script cards. I want the player to be able to respawn skeletons that he summons (Necromancer). I have all the ScrptCards code working, but I can't seem to get the handoff to !spawn to work. Thank you!
1739398695

Edited 1739803737
timmaugh
Forum Champion
API Scripter
Two things... First, in order for Spawn to work from within ScriptCards, you have to have SelectManager installed, too. SelectManager is a part of the Metascript Toolbox. There are more bells and whistles available if you get the whole Toolbox, so that's what I'd suggest. When you run a script (like Spawn) from another script (like ScriptCards), certain things are different about the message compared to when a player sends the message. SelectManager helps change those things back. It installs already pre-configured to give back the selected tokens, but  I believe Spawn also requires SelectManager to be configured to give back both of the other properties it can manage, so you have to run this command in your game one time: !smconfig +playerid +who You should get a message back reporting the updated settings. Now SelectManager will give the script-spawned-script-call message 1) the selected tokens, 2) the "who" property (the name of the person who sent the message - even a character name), and 3) the "playerid" property (with, you guessed it, the id of the player who was responsible for the initial message). Once that's done, you should be able to run your ScriptCards command.  If it does NOT work, post your command here and we can help with whatever else might be going wrong.
Thank you, I will try this out.