Hello again. People were asking about a tab for minions on the character sheet (currently only a tab for minion-maker), so I thought I would update you on how my group currently handles minions.
I’ve gotten into writing API code, so this part only works if you have a “Pro” level account on Roll20. First you need to add the “TokenMod” script to your game, and turn on “Players can use --ids:”, then you create a new script, and put my code in:
on('ready',function(){
"use strict";
var handleInput = function(msg) {
if ((msg.content.indexOf("!minion") !== -1 ) && (msg.selected)) {
let speaker = 'player|'+msg.playerid,
rollcolor = '{{color-Green=1}} ',
numselected = msg.selected.length,
rollstr = '&{template:scrpg} ';
if (numselected > 1) {rollstr += '{{name=Minion Roll}} {{labelless=1}} '};
if (msg.content.indexOf("--gray") !== -1 ) {rollcolor = '';}
else if (msg.content.indexOf("--green") !== -1 ) {rollcolor = '{{color-Green=1}} ';}
else if (msg.content.indexOf("--yellow") !== -1 ) {rollcolor = '{{color-Yellow=1}} ';}
else if (msg.content.indexOf("--red") !== -1 ) {rollcolor = '{{color-Red=1}} ';};
for (let i = 0; i < numselected; i++) {
let token_id = msg.selected[i]._id,
token = getObj("graphic", msg.selected[i]._id),
token_name = token.get('name') || 'Minion Roll',
markers = token.get('statusmarkers').split(':'),
diesize = (12-token.get('currentSide')*2),
imgs = _.map(token.get('sides').split(/\|/),(i)=>{return i;}).length;
if (imgs == 5) {
if (msg.content.indexOf("--degrade") !== -1) {sendChat(speaker,"!token-mod --ignore-selected --ids "+token_id+" --set currentside|+")}
else if (msg.content.indexOf("--upgrade") !== -1) {
sendChat(speaker,"!token-mod --ignore-selected --ids "+token_id+" --set currentside|-");
};
let dievalue = Math.floor(Math.random() * diesize) + 1;
if (numselected == 1) {rollstr += '{{name='+token_name+'}} {{suffix='+markers[0]+'}} ';};
if ((i % 4 == 0) && (i != 0)) {rollstr += '\n&{template:scrpg} {{labelless=1}} ';};
if (i % 4 == 0) {rollstr += '{{die1-d'+diesize+'=1}} {{roll1=[['+dievalue+']]}} {{r1name=d'+diesize+' = }} '+rollcolor;};
if (i % 4 == 1) {rollstr += '{{die2-d'+diesize+'=1}} {{roll2=[['+dievalue+']]}} {{r2name=d'+diesize+' = }} ';};
if (i % 4 == 2) {rollstr += '{{die3-d'+diesize+'=1}} {{roll3=[['+dievalue+']]}} {{r3name=d'+diesize+' = }} ';};
if (i % 4 == 3) {rollstr += '{{die4-d'+diesize+'=1}} {{roll4=[['+dievalue+']]}} {{r4name=d'+diesize+' = }} ';};
};
};
if (msg.content.indexOf("--roll") !== -1) {sendChat(speaker,rollstr);};
};
};
on('chat:message', handleInput);
});
Once you have done that, you can activate the code from any 5-sided token in your game. The 5 images can be anything you want, but I recommend being able to tell which die they represent, such as:
With 1 or more of these tokens selected, type in chat (or a macro):
!minion --roll --gray
(It defaults to green, but you can change it to yellow, red, or in this example gray)
If the token is on it’s 1st image, a d12 will be rolled… on it’s 5th image a d4 will be rolled. If your GM has 6 d6 minions (on their 4th image), but one of them has dropped to a d4 (on it’s 5th image), select the group, then use this text, and you’d get this in chat:
If multiple tokens are selected it defaults to “Minion Roll”, or if you only select 1 token, it will put that token’s name, and current status marker into the chat. (We use custom status markers to differentiate Attack minions from Boost minions, and so on)
The code also allows for:
!minion --degrade
to change a token to it’s next image, or:
!minion --upgrade
to change the token back to it’s previous image.
I recommend setting these 3 lines as Token actions for your minions, so there will be 3 buttons on the top of the screen any time you select 1 or more of your 5-sided tokens.