DICE PACKS BUNDLE
  1. #1

    BRP Active Powers

    I'm working on switching from maptools to Fantasy Grounds.

    In maptools I had developed macros that my players could click to resolve power/spell effects. For example a damage spell would roll to see if it worked, roll what the damage will be if it is a success, and either remove the pp or show the amount of pp to be removed.

    I havn't run a game in Fantasy Grounds yet but it doesn't look like much of that specific functionality is built in. I think it will roll for the success of the skill, but otherwise just allow you to access the library for that powers details.

    So that leaves me with a 2 part question. 1) where is that functionality within a campaign or 2) where might I start to build in that functionality on power double click or drag and drop?

    I was thinking I might copy some code from one of the other rulesets to start but I dont know which rulesets might have that functionality.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Actually, it's quite rare for any ruleset to do auto reduction of PP or similar. Some of the rulesets do auto-reduction of ammunition on each ranged attack, but not always. The reason FG doesn't usually do this sort of thing is that players will frequently set powers off, or use the same power multiple times against different targets when it is actually one use of the power.

    But, if you wanted to try to automate this, you'd need to put the code in the roll handler for the power:
    1) The power dice are rolled in the rollDice() function in charsheet_listclasses.xml - in the "charsheet_power" windowclass at lines 740-746. Line 745 is the throwDice command - note that the "type" of the throw is set to "dice".

    Dice rolling is asynchronous - as FG has to wait for the dice to stop rolling before it can look at the result. Hence the code in the character sheet ends with the ChatManager.throwDice command - the code does not pause and wait for the dice to roll and land. This is handled by a onDiceLanded function in scripts\chat_chat.lua:

    2) onDiceLanded function in scripts\chat_chat.lua. This processes the result of the dice roll. It checks through the roll and looks at the type of the roll using draginfo.isType. As the type in step #1 above was set to "dice" the code basically checks for any description and the chance of the dice roll succeeding, stores that data for later; applies and modifiers and then sends the dice roll (with the added data) on for further processing in the deliverDice function.

    3) The deliverDice function. This basically steps through any pairs of dice to calculate a total, and then if "crucial rolls" are enabled in the campaign options it will check for critical rolls, fumbles, successes, failires, etc.. Building up appropriate message text as it goes. Then the final roll result is delivered to chat with deliverMessage(entry);

    -----------------

    So, if you wanted to do something special with powers you'd want to use a different roll type in step 1 - perhaps "powers" and also add in data to the roll (usually in the description) that details how many power points were used.
    Then in step #2 copy the current code for roll type of "dice" and add in any specific entries for the new roll type of "power" - extract the number of power points used from the description (like the current code does for the success chance) and store it in the roll data for later processing.
    Finally, in step #3, use the skill roll and power points used to calculate how many the current power points should be reduced and then reduce the current PP for the character - best way to do this is to go directly to the database for the currently active character as this code is not running in the character sheet.

    If the PP use is always fixed, no matter what the success level of the skill roll for the power, then you could subtract them in step 1 - when the code is still running in the character sheet. Otherwise you have to wait for step #3 to determine the use based off the success level.

    Hope that helps explain the process of rolling dice in the BRP ruleset, and the options you might have to implement PP auto reduction when a power skill is rolled.
    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!

  3. #3
    That's very helpful. Thanks for the information and suggestions.

  4. #4
    I've had a chance to look into this more and have more questions. This may be more detailed that I can manage but might as well go big right?

    When an item from the powers section on the character sheet is rolled (drag and drop or double click) the roll shows as draginfo.isType dice. I cant find anywhere to change what the draginfo type is set to.

    I noticed you suggested adding something in the description of the power. Would I be able to check, say, powertype from charsheet_listclasses in the rollDice() function that would pop up a window on the DM screen showing the the power details and then if the DM clicks on something, maybe just in the window at all, it would adjust the casters pp count 1 time?

    doing that would allow for multiple levels so if the PC uses a level 3 spell the DM could click it 3 times and remove the proper pp.

    I'm going to stop there before I enlarge my scope too much more.

  5. #5
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Quote Originally Posted by flekhabren View Post
    When an item from the powers section on the character sheet is rolled (drag and drop or double click) the roll shows as draginfo.isType dice. I cant find anywhere to change what the draginfo type is set to.
    I mentioned this in post #2 above - even called out the exact line it is in: 1) The power dice are rolled in the rollDice() function in charsheet_listclasses.xml - in the "charsheet_power" windowclass at lines 740-746. Line 745 is the throwDice command - note that the "type" of the throw is set to "dice".

    Quote Originally Posted by flekhabren View Post
    I noticed you suggested adding something in the description of the power. Would I be able to check, say, powertype from charsheet_listclasses in the rollDice() function that would pop up a window on the DM screen showing the the power details and then if the DM clicks on something, maybe just in the window at all, it would adjust the casters pp count 1 time?
    You don't want to have windows popping up as part of actions - FG does not handle this well and you most certainly don't want this popping up on the GM side each time a player uses a power.

    You really have two option:
    1. Go with manually checking of PP - usually this is the player responsibility, just like it would be in a face-to-face game (the GM can check the PC sheet to see if the player has done it correctly if they wish).
    2. Use some level of automation. As I mentioned in post #2 you could add some text to the description of the roll (probably changing the type from just "dice" to "power" or something similar) and then parse out those details in the result of the dice roll.

    For getting data from the roll description, look at the 5E ruleset as an example - the scripts\manager_action_attack.lua file has a number of string.match(rRoll.sDesc entries that parse certain data out of the roll description (set before the roll starts) - for example, the critical threshold is stored in the roll description as [CRIT 20] for example.

    To be honest, I'd work on this in stages - get the power window displaying the info you want and allowing a base roll to be made - handle all the results manually (player removing pp etc.) and then once you're comfortable with this, maybe (and I mean maybe) think of doing some level of automation.

    I see it time and again on these forums where GMs try to automate everything and they end up spending a lot of time trying to code and getting frustrated, some even calling it quits because they tried to do too much when starting out. Role Playing is about playing - not about trying to automate everything and turn the experience into a computer game. If that's where you and your players want to go, then that's cool - but be prepared for a lot of coding. You're much better taking baby steps - the first step should be getting the basics in the interface and handle the majority of the results manually.
    Last edited by Trenloe; November 5th, 2016 at 17:18.
    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!

  6. #6
    Quote Originally Posted by Trenloe View Post
    I mentioned this in post #2 above - even called out the exact line it is in: 1) The power dice are rolled in the rollDice() function in charsheet_listclasses.xml - in the "charsheet_power" windowclass at lines 740-746. Line 745 is the throwDice command - note that the "type" of the throw is set to "dice".
    sorry I over looked that in my rereads.

    Thanks for the advice. I will take it to heart. hopefully...

    I think I want to try and take on as much of the 'leg work' as possible so the players dont have to, but it is a fair point that in a table top setting they would be doing that anyway.

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
  •  
FG Spreadshirt Swag

Log in

Log in