PDA

View Full Version : Custom Dice Base



mcortez
November 2nd, 2018, 22:37
First let me preface this with *This in no way compares with the efforts of MoreCore or DORCore rulesets* this was just my little work to learn how to make an extension, while adding in the ability to have custom dice icons show up after results are rolled and to allow me to easily make my own modular dice extensions.

This effort would not have been possible without the existing contributions to the community by Trenloe, Neil G. Foster and the other community extension and ruleset authors that share their work and help others here on these forums. Thank You All!!!

All that said, this little extension makes it fairly easy to add your own custom dice, including custom dice rollers that can be accessed by right-clicking the 3D dice provided by Fantasy Grounds including displaying your own custom art/icons for each of the resulting dice in the chat window. I developed it for use directly with the CoreRPG ruleset and may well behave badly if used in conjunction with other rulesets or extensions that override CoreRPG's ActionsManager.createActionMessage function. There may well be better ways of achieving the same goals.

If you use CoreRPG, you should be able to simply drop this extension in your extensions director and you should see almost no changes -- the numbers on the dice will be a little different, since they won't be getting drawn via a Font anymore and will now instead be using bitmaps from included PNGs for all of the sides of all of the default dice.

If you want to add icons for your own new custom dice, you can do so by simply creating a very small extension of your own -- and I'll post a quick how-to next -- that defines your new Dice, Icons/Graphics, and then this plugin will handle rendering those icons in the chat window . You can even add some rudimentary custom dice logic. If all you are looking to do is add new custom rollers, and you aren't particular about the art displayed in the chat window - I highly recommend you look instead to using MoreCore's or DORCore's dice mechanisms instead.

mcortez
November 2nd, 2018, 22:44
Using the Custom Dice Base Extension should be relatively straight forward. Here's an example where I add Infinity Die from the Infinity RPG from Modiphius based on their 2d20 systems. An Infinity Die is a six sided die having a 1, a 2, three blank sides, and an "Effect" side. The 1 & 2 count towards the dice total, the blanks do nothing, and the Effect side counts towards a seperate Effects Total and does not contribute directly to the dice total (although generated effects might contribute - but that would be for a seperate more comprehensive extension.)

To create an extension to add this die we need to do three things:
1. Create Icons for the 4 seperate sides represented (1,2,Blank,Effect) and register those icons
2. Define the die so that Fantasy Grounds knows that it can roll them from the standard D6 by right clicking on it
3. Script the die so that it's resulting values, and "effects" are handled.

This can be done by creating an extension that leverages the Custom Dice Base extension with as little as 6 new files - 4 of which are the PNGs for the icons (and you can actually just copy 3 of those from the base extension), 1 XML file and 1 LUA file.

1. In your Fantasy Grounds extensions folder (on my Windows 10 desktop this is located at C:\Users\[username]\AppData\Roaming\Fantasy Grounds\extensions create a new folder for your dice extension, in this case I called mine InfinityDice.

2. In this folder place your 4 icon images.

3. Create an XML file for your dice extension named extension.xml, and put the following XML into it:



<?xml version="1.0" encoding="iso-8859-1"?>
<root version="3.3">
<properties>
<name>Infinity Dice</name>
<version>1</version>
<author>MCortez</author>
<description>Dice for Infinity the RPG</description>
<dependency>
<name>Custom Dice Base</name>
</dependency>
</properties>

<base>
<!-- Define the custom Infinity die -->
<customdie name="dN">
<icon>dNicon</icon>
<model>d6</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)

local modresult = 0;

if result == 1 or result == 2 or result == 6 then
modresult = result;
end

return modresult;
end
</script>
</customdie>

<!--
The way the custom dice base extension maps the icons for each possible result,
is done by defining a die for each possible result from the onValue() function defined above.
Each die then gets mapped to an Icon resource. In this example we therefore need 4 definitions
-->
<die name="dN.0"><icon>dNicon.0</icon></die>
<die name="dN.1"><icon>dNicon.1</icon></die>
<die name="dN.2"><icon>dNicon.2</icon></die>
<die name="dN.6"><icon>dNicon.N</icon></die>

<!--
Define the various icons and what PNG files should be loaded for them.
In this case I've re-used the graphic for the generic dNicon, in case the new
custom die needs to be rendered before being rolled.
-->
<icon name="dNicon" file="dN.0.png" />
<icon name="dNicon.1" file="dN.1.png" />
<icon name="dNicon.2" file="dN.2.png" />
<icon name="dNicon.0" file="dN.0.png" />
<icon name="dNicon.N" file="dN.N.png" />

<!-- Load the script that handles the special "Effect" side of the dN dice. Not all custom dice types will require such a script. -->
<script name="dNCustomResultWedge" file="dn_custom_result_wedge.lua"/>
</base>
</root>


That should be it. You should now be able to load up your Campaign and after making sure to enable both the Custom Base Dice and Infinity Dice extensions, an option for dN dice should now appear when right clicking on the 3D D6 and selecting Custom Dice.

I've attached a copy of the above as well.

That's it for now. I hope this all helps out other inspiring extension and ruleset authors.

damned
November 3rd, 2018, 00:50
Well done mcortez.

JimSocks
June 22nd, 2019, 20:12
Man, I am up against a wall on this one...

I have it all set up, but the new extension I have made is showing up in the selection menu with a red X next to it and I have no idea why...

I am trying to make a d6 where only the 6 is a special symbol. I am failing.

JimSocks
June 22nd, 2019, 22:12
Wait... wait... I might have figured this out...

JimSocks
June 23rd, 2019, 01:44
Score! I have two custom sets at once now. 1 D6 that has a symbol if a 6 is rolled, another with a symbol if a 1 is rolled. Money in the BANK. I wish I could make them actually differently colored 3d dice but I'll take what I can get!

pr6i6e6st
July 19th, 2019, 06:52
i have no idea how to really do much for coding. i need two sets of dice. a d6 with a success on a 6, and a d6 with a success on a 6 as well as a fail on a 1. (alien RPG).

i've got a notepad++ and have the files all splayed out here, but i'm not sure what i'm really doing.

damned
July 19th, 2019, 08:12
What else should the dice do?
How many dice do you roll?
What happens on 1-5 and 2-5?
What do the successes and failures do?
How would you rort the results of the roll?

JimSocks
July 19th, 2019, 19:09
In that game I think the other numbers are completely irrelevant.

Full disclosure: that’s what I was making MY dice for too (the alien RPG!). Although I don’t yet have the rule book so I was guessing. I wasn’t aware that one set of dice needed a special result on both a 1 and a 6, so... back to the drawing board.

damned
July 20th, 2019, 02:09
There is about half of the required information here...

pr6i6e6st
July 20th, 2019, 02:38
There is about half of the required information here...

Yeah I eventually figured it out, took quite a while but I got both base and stress dice

pr6i6e6st
July 20th, 2019, 02:38
In that game I think the other numbers are completely irrelevant.

Full disclosure: that’s what I was making MY dice for too (the alien RPG!). Although I don’t yet have the rule book so I was guessing. I wasn’t aware that one set of dice needed a special result on both a 1 and a 6, so... back to the drawing board.

I got it figured out. Once I get the graphics done, I can send you the files

pr6i6e6st
July 20th, 2019, 02:59
What else should the dice do?
How many dice do you roll?
What happens on 1-5 and 2-5?
What do the successes and failures do?
How would you rort the results of the roll?
I have it figured out, but just to explain this:

You have two sets of d6. Base die, and stress die. Whenever you make a roll, you roll your base die. Each 6 (looks like a + sign on the dice) you get a success. Nothing else matters on this die.

For every point of stress you have, when you roll base die, you also roll a number of stress die equal to your stress level. These die add to your base die, in that you also want a 6 (+ sign) but if you roll a 1(facehugger symbol) you panic, and roll all your stress die to compare to a panic table to determine what effect takes hold of you.

I don’t have it rigged to automatically roll on the panic table, but that’s fine, as I don’t know yet if that’s every time or if there are exceptions.

pr6i6e6st
July 20th, 2019, 03:48
Ok I’m not sure why, but the dS (stress dice) are displaying the rolls vertically (breaking frame) while the dB (base dice) are displaying properly. Is there a conflict with placement and the dS line somewhere? That’s the only thing I think really changed aside from what numbers to look for in the rolls

Edit, and I suppose I duplicated the code that looks for a 6 so that the stress dice look for both a 6 and a 1 and return different results (6=success, 1=fail)

pr6i6e6st
July 20th, 2019, 05:04
i've never attached a file here before, so here goes, just finished and i think they're working great. let me know.

Alien RPG Base and Stress Die
Extension reads as “Alien RPG Dice”

updated to include all the missing numbers, as you need those on occasion, it seems
updated to group successes of either dS or dB together, rather than seeing two "successes" results if you used a dice pool extension and rolled both sets of dS and dB at once.
updated to change base dice to a yellow texture. somewhat reflects the actual base die, and differentiates it from the stress die.
updated to fix the extension as Trenloe suggested, and swapped the dice colours as i had the colours wrong last time
FML updated again because when i swapped colours, i forgot to use the correct naming convention for the stress dice icons
update lets try this again. i've used 7zip and it looks like it works, though it's made my images have a lesser resolution, so i'll have to check on that, but for now, this appears to work this time
updated so now the chat will only read results that come up. (for example, if you roll a bunch of stress and base dice together, and only successes come up, the chat will only tell you how many successes there are. if only fails come up, it will tell you how many fails you rolled, and if both come up, it will tell you how many of each, rather than showing results of 0)

here's an example of what comes up
28010

Voxpopuli
July 21st, 2019, 17:16
Great job! Thanks for the extension. Looking forward for a theme extension ;) to put us in the Alien mood! This is gonna be a great RPG!

Voxpopuli
July 21st, 2019, 17:58
I downloaded the extensions and move it to my Fantasy Ground Data file under extension, as well as the Custom Dice Extension. The Stress Dice extension does not appear in choices when I created a campaign in CoreRPG. The Custom Dice Extension appears as a choice as well as my other extensions

Trenloe
July 21st, 2019, 18:02
updated to change base dice to a yellow texture. somewhat reflects the actual base die, and differentiates it from the stress die.
27999
The extension file hasn't been Zipped correctly - it has the extension folder included. It needs to be Zipped from within the extension folder.

pr6i6e6st
July 21st, 2019, 19:22
The extension file hasn't been Zipped correctly - it has the extension folder included. It needs to be Zipped from within the extension folder.

Ah, I’ll fix that later for everyone, thanks for letting me know

pr6i6e6st
July 22nd, 2019, 02:27
The extension file hasn't been Zipped correctly - it has the extension folder included. It needs to be Zipped from within the extension folder.

there, i think i fixed it, as well as i swapped the colours

Voxpopuli
July 22nd, 2019, 03:52
Still does not show for me as an extension.

Trenloe
July 22nd, 2019, 03:57
Still does not show for me as an extension.
The extension is called "Alien RPG Dice"

Voxpopuli
July 22nd, 2019, 20:23
Sorry I don't see that extension name for me it is still StressDice.ext and I see no Alien RPG Dice as a choice.

pr6i6e6st
July 22nd, 2019, 21:09
Sorry I don't see that extension name for me it is still StressDice.ext and I see no Alien RPG Dice as a choice.

The file you download says stressdice.ext, but within Fantasy Grounds (make sure you restart the application) with the CoreRPG ruleset, it should show up as Alien RPG Dice.

pr6i6e6st
July 22nd, 2019, 21:17
Sorry I don't see that extension name for me it is still StressDice.ext and I see no Alien RPG Dice as a choice.

Also make sure you have the custom base extension from OP

Edit: to any mods or admins, I feel like I’ve potentially hijacked OP’s thread here, perhaps we can move my part of the discussion to a fresh thread? I feel kind of intrusive at the moment

Voxpopuli
July 22nd, 2019, 23:15
Sorry to be dense... must be my age, are we talking about the DOEBase.ext? I have that well as the CustomDiceBase.ext and yours. I have re-downloaded everything again and re-started FG from my steam account and I cannot see the extension. I'm sure its me somehow who is not doing something right.

pr6i6e6st
July 22nd, 2019, 23:26
Sorry to be dense... must be my age, are we talking about the DOEBase.ext? I have that well as the CustomDiceBase.ext and yours. I have re-downloaded everything again and re-started FG from my steam account and I cannot see the extension. I'm sure its me somehow who is not doing something right.

Sorry, yeah the customdicebase.ext and the one I made.

So I’m assuming you have placed the files in your extension folder of fantasy grounds, you could try this: create a folder in the extensions folder and extract my files into that. Make sure there’s no extra folders within that, and restart fantasy grounds. I’m not sure if I’m not making the ext archive correctly or not now, but I know it works if all the files are in a folder in the extensions

Trenloe
July 22nd, 2019, 23:42
The reason that the "Alien RPG Dice" extension can't be seen in FG is that it's been compressed with RAR compression. It needs to be ZIP compression.

pr6i6e6st
July 22nd, 2019, 23:44
The reason that the "Alien RPG Dice" extension can't be seen in FG is that it's been compressed with RAR compression. It needs to be ZIP compression.

Ohhh. My bad. I’ll have to see if I can fix that. Thank you

pr6i6e6st
July 23rd, 2019, 01:48
The reason that the "Alien RPG Dice" extension can't be seen in FG is that it's been compressed with RAR compression. It needs to be ZIP compression.


Sorry to be dense... must be my age, are we talking about the DOEBase.ext? I have that well as the CustomDiceBase.ext and yours. I have re-downloaded everything again and re-started FG from my steam account and I cannot see the extension. I'm sure it's me somehow who is not doing something right.

ok, really sorry for the trouble guys, as I said, I've never done this before, so thank you for your cooperation and patience. it looks like it works, I tested the file and the only concern I found is the stress dice appear to be a lower resolution or something, so I'll have to work on that, but for now, you should finally have something easily functional, I hope haha.

Voxpopuli
July 23rd, 2019, 02:41
Bingo! It works! Thanks a lot for your time pr6i6st!

pr6i6e6st
July 23rd, 2019, 03:05
Bingo! It works! Thanks a lot for your time pr6i6st!

Fantastic!

Phew, now for my next task, a character sheet.

Thank you mcortez for this. It’s been a great learning experience atop of a great extension!

YakubDrak
April 7th, 2020, 11:37
Thanks mcortez for this extension, and pr6i6e6st for the exemple ! Very useful in my attempt for HeroQuest ;)
Is there a code to launch the special dice, like when I put "2d6" in an action tab then grab it into dialog tab ?

vedrana
August 11th, 2020, 14:18
I've been trying to get this extension to work with FGU and got most of it working except for the dice results being blank in the chat box.

I removed the FGF and replaced it with a generic TTF under /graphics/fonts and edited the base.xml to include the TTF tag instead of the FGF.

Not sure what step i'm missing to get numbers to populate in the chat box for FGU

skanberg
November 10th, 2021, 17:30
I've been trying to get this extension to work with FGU and got most of it working except for the dice results being blank in the chat box.

I removed the FGF and replaced it with a generic TTF under /graphics/fonts and edited the base.xml to include the TTF tag instead of the FGF.

Not sure what step i'm missing to get numbers to populate in the chat box for FGU

Did you ever figure out what the issue is? I'm facing the same problem, at the moment.