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

Separate initiatives for each attack.

1688990280

Edited 1688990302
Hi, I'm a GM for a system that should not be named for fear of derailing the topic. If you have to ask it is "that" system, but I rather not go into details. So anyway the combat demands separate initiatives for each attacks and I want to find out if there's a way to automate it a bit. My current roll in the character sheet is: <button type="roll" name="roll_iniative" value="&{template:default} {{name=Initiative}} {{Roll:= [[1d100+@{dex_rea_mod}+@{breadth}-@{weapon_pen} ?{Modifiers|0} &{tracker}]]}}"></button> . I don't know if it matters but it is in a repeating section. I've looked around a little and there seemed to be some scripts that did similar things but I'm not savvy enough to understand how it works and adapt it to the system I'm running. What I would like is to button on the sheet and get a query for how many attacks will be done and get that many initiatives in the turn order. But honestly, I'll be happy with any solution. Thanks for reading and I'm happy with whatever help you can give!
1689063135
GiGs
Pro
Sheet Author
API Scripter
As a pro user, ytou can probably code this with a Mod script - checkout the Scriptcards thread. I've seen solutions posted before for Shadowrun and HERO syste, but I don't remember what they were. They might not all have used MODs. To replicate your initiative buttons, it iwll be important to kow which attributes are in a repeating section, and what the repeating section is called.
Okay, I've had a look through the sheet. The repeating section is named repeating_weapons. The only attribute used for the initiative that is within the repeating section is named attr_weapon_pen. The other two attributes used are outside the repeating section. I've experimented a little with a mod script The Aaron made for Palladium 4 years ago. So far I've managed to get it to give multiple turns but not with the attributes that modify it. I still not know a good way to get the script to get the attributes yet.
1689075289
GiGs
Pro
Sheet Author
API Scripter
You're probably being too vague for people tp help you. People will need to know the sheet and game. A link to Aaron's script would likely help too.
Right, the game I'm running is Fatal using a customized version of the sheet that's available in the game settings. Link to html and css here . Here's the link to the script Aaron made. If there's anything else I've missed then I'll be happy to provide it. In the meantime I will fiddle with the script and see if I can't figure something out.
1689077211

Edited 1689077440
GiGs
Pro
Sheet Author
API Scripter
I admit, I was struggling to imagine what the system could be, but that does answer that question. The situation you are having is one that is definitely doable. How do you determine how many actions each character gets? Also, it looks like the sheet is a custom sheet. It might be possible to build the multiple-actions roll into the button on the sheet (I can't remember if roll20 natively supports multiple actions) but if not, you'll need a Mod script solution, but you can have the launcher built into the repeating section.
1689077869

Edited 1689077882
GiGs
Pro
Sheet Author
API Scripter
I see why its not on the roll20 github (aside from the obvious) - it uses Tables for layout a lot, and that is now banned. If you are the sheet creator, I'd look into ways of changing from html tables to css grid. The code is easier, but it's a lot of work to change a sheet that already exists with lots of tables already.
1689078014
GiGs
Pro
Sheet Author
API Scripter
I'm not seeing the roll button you showed in the first post. Is that something you want to add to the sheet but isn't there yet? Also, still need to know how you decide how many attacks per round a character gets. Also, if its based on weapon, what happens if a fighter changes their weapon mid turn. Does that create new rolls?
1689078273

Edited 1689078694
The number off attacks is determined by the weapons type and the skill the character have with the weapon in question. I think this part could be solved with a query. Do you need the specifics or is this enough? I was messing with the button so it isn't working in the sheet I gave you but it should be on line 411. Currently I've got it working as long as the players manually input their initiative modifier manually. I rather have the script get the modifier itself so I can spare my players additional tedium.  A player can't really change weapon mid turn as it takes up most of their round doing so and they'll also need to make a roll to change their mind mid turn. Here's how my current script is looking. on('ready', () => { const multiplyTurn = (token_id,count,inimod) => { 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:(randomInteger(100)+parseInt(inimod))})); }); } Campaign().set({ turnorder: JSON.stringify(to.sort((a,b)=>parseFloat(b.pr)-parseFloat(a.pr))) }); }; on('chat:message', (msg) => { if( 'api'===msg.type && /^!initiative/.test(msg.content) ){ let args = msg.content.split(/\s+/); let count = args[1]||2; let inimod = args[2]||0; msg.selected.forEach((m)=>multiplyTurn(m._id,count,inimod)); } }); }); Edited as I replied before reading the whole thing.
I've updated the sheet now so it has a working button again.
1689080033
GiGs
Pro
Sheet Author
API Scripter
One issue with this line: to.push(Object.assign({},turn,{pr:(randomInteger(100)+parseInt(inimod))})); is that you can sometimes have a character with multiple attacks have exactly the same initiative with more than 1 attack. E,g, someone with 3 attacks could have 89, 53, 53. Is this a problem?
No, that is how the system is written. I can't find a single mention on what to do on tied initiative.
I got it working in a fully automatic fashion. I had to bundle the different modifiers into one attribute and then change the button to send a call to the script. Thank you for helping me out.
1689101933

Edited 1689105186
GiGs
Pro
Sheet Author
API Scripter
I don't feel like I didn't do much, hehe. You mentioned you had a working button. Is there anything you still need help with?