PDA

View Full Version : Help with the tables



kenneth_burnell
April 12th, 2013, 17:50
I am adding tables, but one of the tables that I have add from within the game needs to use a specific roll. I have already set the roll results but need to change the dice that are rolled for the table. I want it to roll 3d6, but I am not sure how to set it up so it will do that. A little help plz.

Trenloe
April 17th, 2013, 21:22
Unfortunately, you can't do this without modifying the ruleset LUA code. The table functionality is coded to decide which single die (including d100 as a single die) to roll based on the max number the table goes up to using the following code in the manage_table.lua script file (from the 3.5e ruleset):

-- Determine die to roll for this table
function getTableDice(nodeTable)
local nMax = 0;
for _,v in pairs(DB.getChildren(nodeTable, "tablerows")) do
local nTo = DB.getValue(v, "torange", 0);
if nTo > nMax then
nMax = nTo;
end
end

local aDice = {};
if nMax <= 2 then
table.insert(aDice, "d2");
elseif nMax <= 3 then
table.insert(aDice, "d3");
elseif nMax <= 4 then
table.insert(aDice, "d4");
elseif nMax <= 6 then
table.insert(aDice, "d6");
elseif nMax <= 8 then
table.insert(aDice, "d8");
elseif nMax <= 10 then
table.insert(aDice, "d10");
elseif nMax <= 12 then
table.insert(aDice, "d12");
elseif nMax <= 20 then
table.insert(aDice, "d20");
else
table.insert(aDice, "d100");
table.insert(aDice, "d10");
end

return aDice;
end
It is possible to change the hard coding for this script to use 3d6 if the maximum number in the table is between 12 and 18, here is an example of the code to add between the d12 and d20 sections:

elseif nMax <= 12 then
table.insert(aDice, "d12");
elseif nMax <= 18 then
table.insert(aDice, "d6");
table.insert(aDice, "d6");
table.insert(aDice, "d6");
elseif nMax <= 20 then
table.insert(aDice, "d20");
Note
- You need to add d6 three times to the dice table, you can't add "3d6" at once.
- The table will just show "d6" by the dice rolling button, but it will roll 3d6 and use the result to return the relevant entry in the table.

Edit: Here is a screenshot of the results of using the above code and a table with the max number = 18:
https://dl.dropboxusercontent.com/u/39085830/Screenshots/3d6Table.JPG

kenneth_burnell
April 18th, 2013, 01:00
Thanks for the help this was very helpful. Now I do have tables that need to have a modifier for the table. So if one table gets a certain result the next table that it would roll on has a modifier for it. So lets say that the first table rolls 35% and when it brings up the next table to roll it should be modified +1 to the d20 that it rolls for that table. Any suggestions?

Trenloe
April 18th, 2013, 01:14
Didn't realise this until I looked at the code - you can trigger a table roll from the chat line, with the following syntax:

/rollon tablename -c [column name] [-d dice] [-hide]
So, in my test table in the screenshot above, I could use the following, without having to modify the ruleset - this forces the table to roll 3d6:

/rollon Test Table -c d6 -d 3d6

Back to your question about adding modifiers for a second table roll. I can't see anything in the code for this, so there would have to be more than a simple modification to the table code to include a modifier to the next table roll. It could be done, but it's beyond a simple look...

kenneth_burnell
April 18th, 2013, 01:59
ok well if you happen to get a chance to take a look into it that would be cool, and thank you again for all the help so far.

Trenloe
April 18th, 2013, 02:13
ok well if you happen to get a chance to take a look into it that would be cool
Not much chance of that I'm afraid, sorry.