DICE PACKS BUNDLE
  1. #1
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620

    Can we have a code-snippet as an example on how to force a roll to use a skin?

    Seeing as I am always pecking away at my Rulesets and want to be able to use the lovely dice-skins I have bought.

    How do I programaticaly force a roll-type to use a skinned dice?
    Per example, I might want to use the metal dice for roll-type "skills" and a arcane dice for magic in my ruleset.
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Search for DiceRollManager.addDamageDice in the 5E ruleset scripts\manager_action_damage.lua file as an example. That's going to add the specific dice skin based off the damage roll damage type/s and the damage type to skin mapping setup in the campaign.
    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
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    I am probably being dense here but is there any way to just force the diceroll to use a single dice-skin at all times? Bypassing the custom-rolls list entirely just to simplify getting a first version out the door...
    I was hoping eventualy to get a dice-skin attatched to my NPC-sheet as well per example.
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Quote Originally Posted by Oberoten View Post
    I am probably being dense here but is there any way to just force the diceroll to use a single dice-skin at all times?
    The skins and relationships between damage types are stored centrally in the DiceRollManager global script package - CoreRPG ruleset scripts\manager_dice_roll.lua

    The current way the dice are implemented is at various points within the damage and heal action managers (for most d20 based rulesets) to assign the dice skins based off the damage type when the dice are being added to the rRoll LUA table. So, in theory, you could pass a hard coded damage type:

    DiceRollManager.addDamageDice(rRoll.aDice, vClause.dice, { dmgtype = "fire" });

    But this would have to be coded in the damage handler script itself.

    As the standard code uses damage types, you don't want to change the damage types as that will impact the ruleset code in other ways. What ruleset are you using by the way?

    To avoid messing with the standard damage handlers, you could change the dice mapping before a damage roll and then change it afterwards - see the 5E ruleset scripts\data_options_5E.lua for examples of DiceRollManager.registerDamageTypeKey. So, if you know that an NPC always does bludgeoning damage, and you want to change the dice skins for their attack, use DiceRollManager.registerDamageTypeKey("bludgeoning ", "storm"); to set to the "storm" skin mapping before setting up the damage roll and resetting to the previous dice skin mapping value afterward - you can get the previous value with DiceRollManager.getDiceSkinKey("damage-type-" .. "bludgeoning").sDefaultKey
    Last edited by Trenloe; January 27th, 2023 at 09:24.
    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!

  5. #5
    Ultimately, the global script is just setting up frameworks around setting the attributes for individual dice into Lua tables per dice. You can see this in action in the DiceRollManager.helperAddDice function. Most of the rest of the DiceRollManager script is for setting up damage/heal rolls specifically.

    However, the script also has the concept of registering straight dice rolls based on roll type used in ActionsManager without any extra types. This is used as the fallbacks for damage/heal rolls. For example, the D&D rulesets use DiceRollManager.registerHealKey(), which is just a call to DiceRollManager.setDiceSkinKey("heal", { sDefaultKey = sDefaultKey });

    To set up with no default, but still allow the users to customize:
    DiceRollManager.setDiceSkinKey("attack", { });

    To set up "attack" rolls using "storm" set of skins as a default:
    DiceRollManager.setDiceSkinKey("attack", { sDefaultKey = "storm" });

    If you want to specify a skin set for your roll, you would need to specify the new set first. For dice skin sets, the first default which the user owns will be used. If they don't own, then the next one will be tried.
    local tSet = {
    { diceskin = 68 }, { diceskin = 78 }, { diceskin = 38 }, { diceskin = 48 },
    { diceskin = 58 }, { diceskin = 18 }, { diceskin = 28 }, { diceskin = 88 },
    { diceskin = 102 },
    { diceskin = 0, dicebodycolor="B0C4DE", dicetextcolor="000000" },
    };
    DiceRollManager.setDiceSkinDefaults("storm", tSet);

    Regards,
    JPG

  6. #6
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    Thank you guys. This was very useful and I am now heading towards setting up a per npc function. (I am dang tired of my players being unsure of which NPC rolled what)
    There is probably going to be a different set of dice for knowledge-skills, physical skills and talents as well for the PCs as well as some sort of differentiation between the arts and forms for the Ars Magica system. Heck with the way the dice are set up and the magicsystem is set up this is nearly perfect for it.

    Once again, thank you for taking the time to explain this in a way that I actually understand.
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

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
  •  
STAR TREK 2d20

Log in

Log in