PDA

View Full Version : Creating a different Initiative Extension for 5e/CoreRPG



DannyDM
October 10th, 2022, 19:33
I've been trying to create an initiative sorting system for 5e primarily, but I suppose it could be applied to other rpgs easily. It's intended to be an implementation from this video by Taking20 (skip to 6:02 for the actual system): https://youtu.be/SXleyDvtqls.

For those (understandably) disinclined to watch the video, the initiative is as follows: Roll the PCs and friendly NPCs as normal, roll only the highest Initiative value for the foes, then sort the two groups with the highest two placed on top, intersperse the groups together one-by-one (PC, NPC, and so on). There would be background randomization to the non-highest initiative foes and friendly NPCs. Any additional combatants added after initiative is rolled are added to the bottom of the initiative order, regardless of faction and without rolling their initiative.


---Example 1:
PC A: 16
PC B: 4
PC C: 13

FOE F: 16 (highest initiative)
FOE G: -
FOE H: -
FOE I: -

Result
1. PC A
2. FOE F
3. PC C
4. FOE G
5. PC B
6. FOE H
7. FOE I

---Example 2:
PC A: 15
PC B: 17
PC C: 19

FOE K: 21
FOE L: -

Result
1. FOE K
2. PC C
3. FOE L
4. PC B
5. PC A


After a few hours of diving into the CoreRPG files and the 5e ruleset, I'm stumped because I do not know where to begin. My initial thought is to override (if possible in lua) the CombatManager.setCustomSort() but in reality I seek to preserve the order it provides and merely add a step to it. The use of the "friendfoe" value would also simplify the sorting process.

Any suggestions, tutorials, or similar extensions?

Thanks, DannyDM

Trenloe
October 10th, 2022, 19:45
Welcome to the FG forums! I've moved this thread to The Workshop forum as that's the best place to ask about coding. The Armory -> Extensions sub-forum is primarily used for sharing completed extensions.

CombatManager.setCustomSort() is probably where you'd need to do some coding. You'd also need to decide when to trigger the sorting using the windowlist control applySort function: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996645260/windowlist#applySort

As this initiative ordering relies on all initiatives being rolled before applying the sorting - but you'd also need some additional code to setup the values before the sorting. It might be easiest to add a button to the CT that does this - so the GM can wait for all initiatives to be rolled before the custom code to pre-sort and then actually sort the records in the CT.

damned
October 10th, 2022, 22:25
in terms of applying the sort I wouldnt adjust the sort order.
Id be doing something like:

have players roll - collect the rolls - this would likely be a new button the charsheet
have a gm button to roll - this would likely be a new button the ct
compare the highest result

If the GM result is highest,
assign the first NPC 20 init
assign the first PC 19 init
assign the second NPC 18 init
assign the second NPC 17 init etc

this way you dont have to change the sort order, you have to manage applying an appropriate Init only

thats at least how I think I would tackle it

lprchaun
March 3rd, 2023, 20:44
I have just completed writing the extension to accomplish this.
I will be putting it on FG Forge, but because it is the first time for me to do this, I need to be verified, then the extension needs to be verified.
I will update this thread along with one in the workshop when it is available.
56560
56561

damned
March 3rd, 2023, 22:19
Well done lprchaun

lprchaun
March 4th, 2023, 19:28
Well done lprchaun

Thanks

added a post here.
https://www.fantasygrounds.com/forums/showthread.php?77125-Alternating-Initiative&p=680532#post680532