-
March 8th, 2018, 21:17 #1
- Join Date
- Jul 2007
- Posts
- 3
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
-
March 8th, 2018, 21:45 #2
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.
-
March 9th, 2018, 00:12 #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.
-
March 9th, 2018, 01:24 #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
-
March 10th, 2018, 00:25 #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);
-
March 10th, 2018, 00:33 #6
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.
-
March 10th, 2018, 00:45 #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
-
March 10th, 2018, 00:49 #8
Dont change that code.
If you type /stunt in the chat window see what rolls and is displayed.
-
March 10th, 2018, 00:59 #9
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....
-
March 10th, 2018, 01:51 #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