FG Spreadshirt Swag
Page 1 of 4 123 ... Last
  1. #1

    Custom Dice Base

    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.
    Attached Files Attached Files

  2. #2
    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:

    Code:
    <?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.
    Attached Files Attached Files

  3. #3

  4. #4
    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.

  5. #5
    Wait... wait... I might have figured this out...

  6. #6
    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!

  7. #7
    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.

  8. #8
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,649
    Blog Entries
    1
    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?

  9. #9
    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.

  10. #10
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,649
    Blog Entries
    1
    There is about half of the required information here...

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
  •  
5E Product Walkthrough Playlist

Log in

Log in