Thread: Using the Comm.throwDice method
-
August 6th, 2014, 20:15 #1
- Join Date
- Jul 2009
- Posts
- 66
Using the Comm.throwDice method
Creating a numbercontrol that rolls a dice and adds modifiers. I am using the Comm.throwDice function but not sure what i need to pass in the dice variable. Can anyone give me an example for having it roll a d20? Thank you.
-
August 6th, 2014, 21:11 #2
- Join Date
- Apr 2011
- Posts
- 2,253
Here is an example:
Code:local sDragType = "dice"; local aDice = {"d20"}; local iModifier = 2; local sDescription = "d20+2 Test" Comm.throwDice(sDragType, aDice, iModifier, sDescription);
-
August 7th, 2014, 23:23 #3
- Join Date
- Jul 2009
- Posts
- 66
is there a function that rolls a dice and returns the result?
-
August 7th, 2014, 23:41 #4
- Join Date
- Apr 2011
- Posts
- 2,253
The best way to do that is to use the action scripts in the CoreRPG compatible rulesets as an example. Pick the ruleset you are most comfortable with and look in the /scripts folder for the manager_action_*.lua files. Replace the * with the type of action you want to look at. The onInit should register a results handler. Look at the function name in the 2nd parameter. Here is an example from manager_action_skill.lua of the 3.5E ruleset:
Code:ActionsManager.registerResultHandler("skill", onRoll);
Code:local nTotal = ActionsManager.total(rRoll);
One thing to be aware of is if you are making a new action type don't forget to add it to the manager_gamesystem.lua file in the actions section.
-
August 7th, 2014, 23:49 #5
You also might find this thread useful: https://www.fantasygrounds.com/forum...ike-Initiative
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks