STAR TREK 2d20
  1. #1

    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.

  2. #2
    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);
    Please let me know if you have any questions.

  3. #3
    is there a function that rolls a dice and returns the result?

  4. #4
    Quote Originally Posted by kalannar View Post
    is there a function that rolls a dice and returns the result?
    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);
    The onRoll function is where you want to look. You should see this line in the onRoll function which gets the total of the dice result:

    Code:
    local nTotal = ActionsManager.total(rRoll);
    Then you can write code to use it however you want.

    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.

  5. #5
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in