View Full Version : Customdie as Standard?
Oberoten
February 28th, 2008, 08:53
Is there any way to get a customdie like the D3 to be the default to be rolled for a dice?
I imagine that I will have to look in CHAT_CHAT.LUA for the OnDiceLanded function?
But how do I make a regular D6 landing there call the D3 up instead?
Oberoten
March 1st, 2008, 07:18
Anyone have any solution to this one? I am still dissecting the code... and I am sure I could make it react to any dropped ones or 10s... but that would include any kind of dice...
joshuha
March 1st, 2008, 14:31
Yeah its doable. I can put up some code later today and show you.
Oberoten
March 1st, 2008, 20:46
I'd be much obligued.
joshuha
March 2nd, 2008, 01:35
In chat_chat.lua under the onDiceLanded replace the dragInfo.isType("dice") section with this:
elseif draginfo.isType("dice") then
dielist = draginfo.getDieList();
for i=1,table.maxn(dielist) do
if dielist[i].type == "d6" then
dielist[i].result = math.ceil(dielist[i].result/2);
end
end
local entry = {};
entry.text = draginfo.getStringData();
entry.font = "systemfont";
entry.dice = dielist;
entry.diemodifier = draginfo.getNumberData();
if User.isHost() then
if ChatManager.getDieRevealFlag() then
entry.dicesecret = false;
end
entry.sender = GmIdentityManager.getCurrent();
else
entry.sender = User.getIdentityLabel();
end
deliverMessage(entry);
applyModifierStackToRoll(draginfo);
return true;
end
Oberoten
March 2nd, 2008, 07:29
Glorious. :)
Now the Wild-Die is the standard die for my Ars Magica ruleset. :) Many thanks.
- Obe
Oberoten
March 5th, 2008, 20:19
Oh... Just spotted a small problem with this code...
It doesn't add the dice-modifiers to the final roll.
joshuha
March 5th, 2008, 20:25
Move this up to the second line in the above code:
applyModifierStackToRoll(draginfo);
Oberoten
March 5th, 2008, 22:16
After the Dielist? *tries this*
That gives me the modifier, but not the name of the modifier for some reason...
Oberoten
March 6th, 2008, 18:14
Hmmmm...
... when I removed the deliverMessage lines it works perfectly.
I also noticed that it only really breaks when I have /die reveal on.
Oberoten
March 6th, 2008, 18:49
... Perfectly aside from not delivering the description of the roll. But at the least now it adds in the value.
joshuha
March 6th, 2008, 19:05
Try this (I replaced the entry.text line and moved the applyModStack up):
elseif draginfo.isType("dice") then
applyModifierStackToRoll(draginfo);
dielist = draginfo.getDieList();
for i=1,table.maxn(dielist) do
if dielist[i].type == "d6" then
dielist[i].result = math.ceil(dielist[i].result/2);
end
end
local entry = {};
entry.text = draginfo.getDescription();
entry.font = "systemfont";
entry.dice = dielist;
entry.diemodifier = draginfo.getNumberData();
if User.isHost() then
if ChatManager.getDieRevealFlag() then
entry.dicesecret = false;
end
entry.sender = GmIdentityManager.getCurrent();
else
entry.sender = User.getIdentityLabel();
end
deliverMessage(entry);
return true;
end
Oberoten
March 6th, 2008, 19:49
That did the trick for both the D3, D2 and Wild-Die. :) Many thanks. :)
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.