PDA

View Full Version : Segregated dice results among one sole multiple roll



Tchikibo
September 3rd, 2024, 14:08
Hello all,

My title may not appear as clear as I want. I'll explain my intention.
I am coding an entire ruleset based on the CoreRPG ruleset and am implementing new mechanics for rolls.
What I want is to extract as much data from the roll as possible. Not just the total result. For exemple, for custom saving rolls, I have made custom d20's. One dLife and one dDeath.
For a test, I want my players to roll what part wins among them. Thus, I want to compare both dice result as well as the total. How could I achieve such result ?

Thank you in advance.

superteddy57
September 3rd, 2024, 14:23
You can see many examples of how to setup and register result handlers for rolls in CoreRPG and 5E. In that function it is prior to outputting the result to chat. In the rRoll, that is passed into the resulting function, will contain a table of the roll. This nested table can be accessed by using rRoll.aDice. This would contain more data and can be manipulated to adjust the chat output.

Trenloe
September 3rd, 2024, 15:39
For a test, I want my players to roll what part wins among them. Thus, I want to compare both dice result as well as the total. How could I achieve such result ?
FG dice rolls are asynchronous - i.e. the FG code sets up the dice structure and then the roll begins, and the FG code ends at that point. The FG code picks up again in the result handler after the dice have landed.

To compare multiple dice rolls from different players you'll need to track the results of all dice rolls and then know when all dice rolls have been completed, and write code to then review the results and output an appropriate message.

So, what you want to do can get pretty complex, especially if you're not familiar with FG asynchronous rolls, script variable scope and OOB messaging.

The 5E scripts\manager_action_damage.lua file has an example of tracking result states in a local LUA table. See the "TRACK DAMAGE STATE" section at the end of that file.

The key is that the roll results should be tracked in a central place - in the 5E damage state tracking this is in the script space for that script - the "ActionDamage" global script package. So a lot of the code (setting and reviewing results) will need to be handled by the GM via OOB messaging from the player side.

Tchikibo
September 3rd, 2024, 17:18
Thank you a lot,
I will try to play around with the rolls and try to poke around where you nudged me.