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

Group Initiative - one token but add multiple initiatives to tracker

1553451111
vÍnce
Pro
Sheet Author
A recent post was looking for a way to include multiple initiative rolls for the same token/character.  While I can manually create "placeholder/dummy" tokens on the map with the same name as the token/character, in order to get 3 separate initiatives, this is very kludgy. Add multiple characters and npc's to the mix and... Would it be possible to modify/add a feature to Groupinitiative to handle such a feature?
1553458499
The Aaron
Roll20 Production Team
API Scripter
It would, but I have some other scripts that can do this for you. I want to rewrite GroupInitiative to do several things, but simply haven’t had the time. Using some helper snippets is easier currently. 
1553461858
The Aaron
Roll20 Production Team
API Scripter
Here's one: on('ready', () => { const multiplyTurn = (token_id,count) => { let to = JSON.parse(Campaign().get('turnorder')||'[]'); let turn = {pr:-10000}; to = to.filter((o) => { if(o.id !== token_id){ return true; } if( o.id === token_id ) { if(o.pr>turn.pr) { turn = o; } } return false; }); if(turn.id){ [...Array(parseInt(count)).keys()].forEach((n)=>{ to.push(Object.assign({},turn,{pr:(parseInt(turn.pr)-(20*n))})); }); } Campaign().set({ turnorder: JSON.stringify(to.sort((a,b)=>parseFloat(b.pr)-parseFloat(a.pr))) }); }; on('chat:message', (msg) => { if( 'api'===msg.type && /^!dup-turn/.test(msg.content) ){ let args = msg.content.split(/\s+/); let count = args[1]||2; msg.selected.forEach((m)=>multiplyTurn(m._id,count)); } }); });
1553468236
vÍnce
Pro
Sheet Author
Thank you very much Aaron.  So I made an quick init macro to place 3 markers on the tracker for the selected token; [[1d10&{tracker}]] !dup-turn 3 That's cool, but... i s there a way to re-roll the init instead of using a flat number? Perhaps by re-using the initial token's initiative roll (ideally) or maybe as an argument w/mod? !dup-turn --3 --1d10 --dex-mod ;-)
1553470168
The Aaron
Roll20 Production Team
API Scripter
Not really.  I read the other thread.  That's going to take some custom work.
1553491636
The Aaron
Roll20 Production Team
API Scripter
Custom work taken. =D
1553491853
vÍnce
Pro
Sheet Author
The Aaron said: Custom work taken. =D I just knew you couldn't resist.  ;-)
1553491903
vÍnce
Pro
Sheet Author
I really think there are a fare number of systems that could benefit from this.