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 .
×
Advertisement Create a free account

[Request] Adapting Group Initiative

1441406817
What would it take to adapt The Aaron's Group Initiative script to a different system? This is the basic macro I use to add tokens to initiative: [[@{selected|basic_speed} + (([[@{selected|Dexterity}]])/10000) + (1d100/1000000) &{tracker:=}]] 'basic_speed' is the primary attribute for initiative determination.  It typically ranges between 4.00 and 12.00, in increments of 0.25.  The next two factors are for breaking ties.  The first thing that is used to break a tie is the highest Dexterity score.  The last thing is just a random die roll, in the case where basic_speed and Dexterity are both the same.  The addition and division steps are just so that I can get them to boil down to a single, sortable number, with 6 decimal places.  It was the best way I could think of to make it work. It currently has an odd glitch that pops up, where occasionally the result ends up with more than 6 decimal places (up to 9 more), and I have no idea why.  I end up re-rolling initiative for those tokens when it happens because so many digits really is way too long for the turn tracker.  If I could think of another way to do it, I'd like to reduce the length of the final number to fewer significant digits. I've taken a look at his script....and got lost.  :-)  Beyond my depth.
1441407564

Edited 1441408456
Silvyre
Forum Champion
From what I understand, GroupInitiative is system-agnostic. This should fix the decimal issue: [[ round([[@{selected|basic_speed} + @{selected|Dexterity}/1e4 + 1d100/1e6]]*1e6)/1e6 &{tracker} ]]
1441412745
Well, I'll look again then.  What I read lead me to believe that it only calculated initiative using 1 primary method, with a few options, none of which seemed to match what I was looking for. Thanks for the pointer on the decimal issue; that's the voice of experience.  Multiply so it's not a decimal, round it, then divide it back to where it was. I did have to add () brackets around @{selected|Dexterity} , otherwise it wasn't doing the division prior to adding Dexterity to basic_speed.
1441456912
The Aaron
Forum Champion
API Scripter
If you set up an attribute on each character with this formula:  @{basic_speed} + (([[@{Dexterity}]])/10000) + (1d100/1000000) You can us that attribute with the --Bare type and it will calculate with that formula. If you run !group-init --help there is an option to set the number of decimal places.  The really long numbers are due to inaccuracies in the IEEE754 Floating-Point representation used by Javascript.
1441460935
Thanks that seems to mostly work.  It appears to crash the API sandbox if more than 8 characters are selected and added to the turn order at the same time.  Too much math?
1441460988
The Aaron
Forum Champion
API Scripter
What is the error you get?
1441462064
The Aaron
Forum Champion
API Scripter
It's probably related to this bug:&nbsp; <a href="https://app.roll20.net/forum/post/2217884/api-regr" rel="nofollow">https://app.roll20.net/forum/post/2217884/api-regr</a>...
1441463775
Now I can't duplicate it. &nbsp;It may have been related to some characters I had earlier--I've deleted them now as they were just for doing some testing. &nbsp;Up to 15 characters at a time works now; I'll let you know if it comes up again and post the error.
1441464556
The Aaron
Forum Champion
API Scripter
Cool beans. =D
1441815047
Hey guys, sort of late to the party here. &nbsp;Been looking for a bit and have not found whether/how to adapt to Actoba's DnD 5.0 Character Sheets. &nbsp;The results I'm getting are based on DEX, what I need is a bonus based on Initiative:Total. &nbsp;Thoughts?
1441820580
The Aaron
Forum Champion
API Scripter
Have you read through:&nbsp; <a href="https://app.roll20.net/forum/post/1908986/script-g" rel="nofollow">https://app.roll20.net/forum/post/1908986/script-g</a>... I use it with Actoba's character sheet all the time, you just need to adjust your rules. &nbsp;I believe this should work to configure it: !group-init --del-group 1 !group-init --add-group --Bare initiative_overall
1441834966
No, I had not. &nbsp;I had been looking at what must have been your original thread. &nbsp; Works like a charm. Just discovered the maplock, too. Thanks, you are The Man! Wait, no, you are... The Aaron!&nbsp;
1441848931
The Aaron
Forum Champion
API Scripter
=D &nbsp;Great! &nbsp;Glad it's working out for you. =D
1441942687
Got some strangeness going on --&nbsp; Seemed to be working great yesterday, today the GI seems to be subtracting 5 from the NPC rolls. As I mentioned, I'm using Actoba's 5.0 sheets, I've whittled down my API's to just the GroupInit. and isGM, I am using the --add group lines as mentioned two posts earlier. &nbsp;I "re-installed" and re-saved, etc. then went one by one through the examples given on the first page where GI is introduced (ex,&nbsp;!group-init --add-group --Stat-DnD dexterity; &nbsp;!group-init --add-group --Bare dexterity --Bare initiative;&nbsp;!group-init --add-group --Bare initiative; etc.) and they all work fine -- typically I will preface each with !group-init --del-group 1 . &nbsp;Then when I use:&nbsp; !group-init --add-group --Bare initiative_overall , all the NPC's have initiatives based on the roll minus 5. &nbsp;The PC initiatives reflect the number as it should be. &nbsp;Additionally, some of the PC's are in the NPC "section" and vicey-versey. Knowing the trope "a foolish inconsistency is the hobgoblin of little minds," &nbsp;what in the bejeesus could I be doing wrong? &nbsp;
1441947897
The Aaron
Forum Champion
API Scripter
You only need to run those commands to configure GroupInitiative one time, then it's stored in the state. &nbsp;After that, you just run: !group-init If you want to PM me an invite and GM me, I can jump in and take a look at your setup.