STAR TREK 2d20
Page 1 of 3 123 Last
  1. #1

    Example of coding new type of roll?

    MoreCore seems like it's added tons of useful new rolls for various systems. Great work!

    Has anyone posted a complete example of how you add a new roll? In other words, all the Lua/XML you would need to add a new type of roll to CoreRPG or to MoreCore? I assume this has been posted before but I wasn't able to find it.

    Many thanks in advance,
    Joe

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    Hi altepeter

    The first thing to do is use a roll from /scripts (as opposed to /desktop/scripts) as your base Template. Use one that is close already in usage as your template.

    1. In your /scripts/manager_custom_mynewroll.lua roll set the Roll type:
    local sCmd = "mynewroll";
    2. Include this new script in /base.xml
    <script name="CustomDiceMyNewRoll" file="scripts/manager_custom_mynewroll.lua" />
    3. Create a new Button Icon for the roll and store in /graphics/icons folder
    4. Define in /graphics/graphics_icons.xml
    <icon name="mynewroll" file="graphics/icons/button_mynewroll.png" />
    5. Setup the auto Icon definition in /campaign/template_campaign.xml
    Add to the <template name="button_rolls_type"> in 3 places - 2 as mynewroll (icons and values) and 1 as MyNewRoll (tooltips).
    Add to the <template name="button_rolls"> in 3 places - 2 as mynewroll (icons and values) and 1 as MyNewRoll (tooltips).
    6. Add to /campaign/record_cas.xml
    Add to the <string_column name="clichatcommand"> just above the elseif == nil statement
    elseif sCommand == "mynewroll" then
    nodeWin.getChild("rollstype").setValue("mynewroll" );
    7. Add it to the /dicehelp command via /scripts/dicehelp.lua
    Add it to the function createHelpMessage()

    And then package up those changed files and send to me (with permission to use/include/share) so that it can be included in the next version of MoreCore and you wont have to redo your changes after the next update.

  3. #3
    Oh very handy. I was just tinkering with this earlier today. I was playing with the boon bane Rolls trying to make the icon in the chat window red for banes and green for boons. When I changed the "d" and "r" for banes it had an unexpected result for me. The icon indeed changed to a red icon, but the rolls were d20s. I imagine it had something to do with me not changing the template stuff. Will explore it when I am home from work.

  4. #4
    The other option is to use the die-codes/tools in the UDR (Universal Die Roller) in DORCore - it might suit your needs better without having to "code" anything.
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

  5. #5
    Hey damned

    So as mentioned above I have been tinkering with the banes/boons trying to customize them a little. I was trying to change the die icon that shows up in the chat to red for banes and green for boons. When I made the a change in the manager_custom_bane.lua (see below) after defining the dice in gamelements.xml and graphics_icons.xml the result is that the banes now roll d20 though the icon chat change worked. I am not able to figure out why this change caused this result. Can you point me to what is happening?

    Code:
    --    table.insert(rRoll.aDice, "d" .. sSize);
        table.insert(rRoll.aDice, "r" .. sSize);
    Attached Images Attached Images

  6. #6
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    Have a look at the Stunt Die mechanic - its /stunt
    See what dice it uses... Hint its not d6.
    Ill make the change in my copy - post what what you find here.

  7. #7
    Yeah I have been looking at different things. I looked at stunt I also looked at critical damage in 5e which is where I got the idea to change the "d" to "r". I guess I am failing see what about that seemingly innocuous change makes the die selection "default" to d20 rather than parse the #d# code
    Last edited by mozmonar; March 10th, 2018 at 00:47. Reason: Typo

  8. #8

  9. #9
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    The red die is not a d6 it is a d1006.
    The next build of MoreCore will contain:

    Red Dice d4-d20 called using d1004,d1006,d1008,d10010,d10012,d10020
    Green Dice d4-d20 called using d2004,d2006,d2008,d20010,d20012,d20020
    Blue Dice d4-d20 called using d3004,d3006,d3008,d30010,d30012,d30020

    So in the /bane script you change Line #71 from:
    table.insert(rRoll.aDice, "d" .. sSize);
    to
    table.insert(rRoll.aDice, "d100" .. sSize);

    and if you want Boons to be blue or green you would use d300 or d200....

  10. #10
    My ultimate goal would be to create a single roll for boon/bane and and a way to increment a counter on the character sheet like a boon number field and a bane number field. Then when you want to roll your boon or banes the /boonbane (whatever it is called) gets rolled it subtracts banes from boons. If the value is positive it rolls that number of boons...if the result is negative it rolls that number of banes...if the result is 0 then it rolls nothing. That way you could have a single /roll entry on the character sheet. I worked out how to make the banes negative by changing the the following bits below.

    Code:
    --  nBane = 0 - rRoll.aDice[1].result;
      nBane = rRoll.aDice[1].result;
    
    ...
    
    --    table.insert(rRoll.aDice, "d" .. sSize);
        table.insert(rRoll.aDice, "-d" .. sSize);

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