PDA

View Full Version : Adding in new dice-mechanics to the CoreRPG foundation?



Oberoten
November 14th, 2014, 11:56
Culd someone give me a quick rundown on how to add new dice-functions in the new CoreRPG? In the older rulesets this was all under onDiceLanded in the chatmanager ut I can't seem to find it's equivalent in the CoreRPG.

- Oberoten (working on Ars Magica 3.0...)

Valarian
November 14th, 2014, 13:01
I'd like to know this as well. It seems to be separated out in to two main phases, but I can't seem to get a dice handler to work properly. It'll roll the dice but not display anything in the chat.

All I've found are, they may help:
https://www.fantasygrounds.com/refdoc/Comm.xcp
http://www.fantasygrounds.com/forums/showthread.php?21408-Creating-a-dice-rolling-callback-script-like-manager_action_heal-lua
http://www.fantasygrounds.com/forums/showthread.php?19313-Dice-Rolls-in-FG-Core-3-0

Trenloe
November 14th, 2014, 14:01
Most of the functionality is handled in scripts\manager_actions.lua - the action flow is described in the comments at the beginning of that file. What happens when the dice are rolled and land is based on the action type (rRoll.sType) which is used to trigger specific handlers before the dice are rolled (modifier handler) when the dice land (result handler). There's not a great example of this in the CoreRPG ruleset (the only action type that is a roll is "dice" as defined in scripts\manager_gamesystem.lua), but if you have a look in the 3.5e ruleset, for example, there are a lot more available "actions" defined in scripts\manager_gamesystem.lua. scripts\action_ability.lua is a good example of registering, rolling and handling the result of the roll for actions = "ability". It has two handlers registered in onInit: a modifier handler and a result handler that are all tied to determining modifiers to the "ability" action before the roll is made (in the modhandler function modRoll) and then processing and displaying the result of the roll in the result handler function onRoll.

If you follow this route, you'll need to make sure that your action type is a valid one setup in the "actions" array in scripts\manager_gamesystem.lua otherwise FG won't recognise it.

It's a different way of looking at things and can take a bit to get used to, but this action process (info in the header of manager_actions.lua) is a nice way of allowing actions to be added to a ruleset that are essentially encapsulated in their own LUA script file.

Oberoten
November 14th, 2014, 18:40
Many thanks. That at the least gives me something to start with. Kudos.

- Obe

Valarian
January 26th, 2015, 13:31
I've managed to get the Yggdrasill dice mechanics coded up as a dice handler in the CoreRPG based ruleset I started for that. It's just the character sheet at the moment, but the dice are rolling from the sheet - both drag and drop and double-click. I seem to have lost the modifier box (where I'm putting the skill bonus) on the dice handler rolls though. I've got the modifier = true in the Actions manager script. Not sure what's going on there.

The mechanic, for those interested, is a number of d10 rolls (dependent on an attribute). From the dice rolled, the top 2 results are taken. If the character suffers a severe wound, that drops to the top 1 result. So, if 3 dice are rolled only 1 or 2 of the dice are shown in the result. In addition, there's an exploding dice mechanic if a 10 is rolled on any of the initial d10s. The additional die keeps being added as long as a 10 is rolled.