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

Creating a random bandit button using TokenMod

I'm trying to make a macro attached as an ability to a multisided token that creates  a random bandit, choosing from several images but also several mook character sheets. Heres my plan and how far i've got (not far): Create a roll query with an inline roll as the result that is the same as the number of sides of the multisided token:  ?{side|[[1d55]]} This is so that i can call that number to apply to multiple things, firstly to change the currentside of the token using token mod: !token-mod --set currentside|?{side} My idea is to then use the  ?{side}  roll to pull either from another table or from the name of the side on this table what bandit type that equals: i.e. roll=1-20 normal melee bandit, 21-30 ranged bandit, 31-40 caster, 41-55 Armored bandit I'd use this to change the 'represents' field of the token using tokenmod again to the corresponding type of bandit.  The issue i'm coming up against is it doesn't seem like you can send a specific result to a rollable table and get the corresponding answer. Is this possible, or is there an alternate way to do what i'm attempting? If i could get this to work i'm planning on adding a further query for setting what kind of difficulty the bandit is: i.e. easy: normal melee bandit=bandit, ranged bandit=scout, caster=acolyte , Armored=thug medium: normal melee bandit=thug/berserker, ranged bandit=spy, caster=priest/druid , Armored=knight etc.
A workaround could be to have the melee, ranged, caster abilities on a single sheet, and have the token name change to "melee," "ranged," "caster," or "armored."  Then simply use only the abilities appropriate for the token's name.  You can also assume one of the bars represents AC (without it actually being associated) and adjust that for the different ACs.
1594222701
The Aaron
Roll20 Production Team
API Scripter
You should be able to create a Roll Table with character ids and another for images and supply them in the right place for TokenMod. Or just a die roll for the side. 
the issue i'm coming against is that i want the image and the character id to match up, so it gets the same side from both roll tables rather than  picking randomly from both, that way i can get it to switch the token to the right image AND the right character
1594305477

Edited 1594306002
Is there a way to send a dice roll to a roll table and get a specific answer? So i could have one table with token images and one with character id's which match up with those images? Eventually my plan is to have it so that you activate this macro and it randomly picks from a list of possible character sheets (bandit, spy, berserker, priest, bandit captain, knight etc.) then randomly picks a token image that is appropriate for that character. My method for this was to have a rollable table with the first 20 token images being bandit appropriate, the next 10 being spy appropriate and so on and give the names for these tokens as either the names or IDs of the corresponding character sheet. So can you randomly choose a side on a multi sided token and then get that sides name as the token id/character name for the represent field? Or have it pick a random side from this table and then from another table pick the same side to get the character name/ID?
1594307321
The Aaron
Roll20 Production Team
API Scripter
There isn't a way to do choose to roll a subset of a table.  You could use a rollable table of TokenMod commands to configure a token with TokenMod. Something like: !token-mod [[ 1t[Bandits] ]]
The Aaron said: There isn't a way to do choose to roll a subset of a table.  You could use a rollable table of TokenMod commands to configure a token with TokenMod. Something like: !token-mod [[ 1t[Bandits] ]] as usual, genius
1594307648
The Aaron
Roll20 Production Team
API Scripter
Hahahahaha, now I'm hoping that works!  If it doesn't, I can update it so it does, but I'm pretty sure it will. 
1594307687
The Aaron
Roll20 Production Team
API Scripter
If that works, you might be able to use RecursiveTable to make a more complicated random generator. 
The Aaron said: Hahahahaha, now I'm hoping that works!  If it doesn't, I can update it so it does, but I'm pretty sure it will.  ok i'm prob doing something wrong but it aint working heres what i've got: Macro i run while i have multisided token selected !token-mod [[ 1t[TMbandits] ]] TMbandits table items: --set currentside|[[1d20]] represents|@{bandit|character_id} --set currentside|[[1d10+20]] represents|@{scout|character_id} --set currentside|[[1d10+30]] represents|@{acolyte|character_id} --set currentside|[[1d20]] represents|@{' bandit captain' |character_id} it doesn't seem to do anything, if i run these as whole macros they run fine
lark86 said: The Aaron said: Hahahahaha, now I'm hoping that works!  If it doesn't, I can update it so it does, but I'm pretty sure it will.  ok i'm prob doing something wrong but it aint working heres what i've got: Macro i run while i have multisided token selected !token-mod [[ 1t[TMbandits] ]] TMbandits table items: --set currentside|[[1d20]] represents|@{bandit|character_id} --set currentside|[[1d10+20]] represents|@{scout|character_id} --set currentside|[[1d10+30]] represents|@{acolyte|character_id} --set currentside|[[1d20]] represents|@{' bandit captain' |character_id} it doesn't seem to do anything, if i run these as whole macros they run fine This is how I use recursive Tables with Powercards to implement the Treasure hoards from the 5e DMG !rt[Delimiter:^^|Sort:true] !power --template|treasurehoard|[[6d6*100]];[[3d6*100]];[[2d6*10]];na;[[1t[Treasure-Hoard-Challenge-0-4]]];Small Hoard  so yours should probably be something like !rt !token-mod [[ 1t[TMbandits] ]]
still doesn't seem to be working even with !rt
1594508446
The Aaron
Roll20 Production Team
API Scripter
Try leaving the ! Off of !token-mod and see whether is sent to chat. That might make the problem obvious. 
1594547354

Edited 1594547509
The Aaron said: Try leaving the ! Off of !token-mod and see whether is sent to chat. That might make the problem obvious.  Ok I've tried that this is what i get: !rt token-mod [[1t[TMbandits]]] result in chat: token-mod --set currentside|14 represents|-MAzvF--y4SpWkHnvd6L *If I copy paste the above result into the chat with an '!' at the beginning it works, but if I add '!' before "token-mod" in the code it doesn't token-mod [[1t[TMbandits]]] result in chat: token-mod  --set currentside|[[1d20]] represents|@{bandit|character_id} *Same as above.
1594558972
The Aaron
Roll20 Production Team
API Scripter
Try adding : !rt token-mod [[1t[TMbandits]]] --ids @{selected|token_id}
The Aaron said: Try adding : !rt token-mod [[1t[TMbandits]]] --ids @{selected|token_id} Ok that fixed it, thanks load dude