Thread: MoreCore Ruleset
-
March 30th, 2020, 13:48 #2021
-
March 30th, 2020, 14:05 #2022
Also true. Apply a modifier for the negative value.
-
March 30th, 2020, 15:07 #2023
Phystus Ok so you subtract dice by way of the Modifier box. That is working. Could you please write a one liner description for the Help file and Ill include in the next update. Many thanks.
Meguido Im really sorry. I am struggling to follow your directions.
I have added a new Roll /vermine
that accepts any sort of combination /vermine #+#+#-# etc. So it could be /vermine (p1)+(p2) or /vermine (p1)+(p2)-(a) etc
it will sum all the values and throw that many dice.
it will check the modifier box - if there is a value there it will use that as the target number.
if there is no value there it will set the target to 5.
all dice that roll the target or higher will count as a success.
reports to chat
Please advise if ok
mc-vermine.jpg
-
March 30th, 2020, 15:58 #2024
/ubiquity #d#[+#d#...] (roll #d6, evens count as successes. Can add multiple pools of dice into a single roll. Use Modifier box to add or remove dice.)
How's that?
~P
-
March 30th, 2020, 17:45 #2025
-
March 30th, 2020, 18:40 #2026
- Join Date
- Sep 2017
- Location
- France (Gard)
- Posts
- 44
I just want add difficulty to modifier in modcollector
Image1.jpg
Manager_action_ability
--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
CustomDiceManager.add_roll_type("vermine", performAction, onLanded, true, "all");
end
function getDieMax(sType)
Debug.console("getDieMax: ", sType);
local sDie = string.match(sType, "d(%d+)");
if tonumber(sDie) > 1000 then
tempmax = tonumber(sDie);
while tempmax > 20 do
tempmax = tempmax - 1000;
end
else tempmax = tonumber(sDie);
end
max = tempmax;
return max;
end
function performRoll(draginfo, rActor, nSkillLev, sAbilityStat, bSecretRoll)
local rRoll = { };
rRoll.sType = "vermine";
rRoll.aDice = { };
rRoll.nMod = 0;
rRoll.nSkillLev = nSkillLev;
rRoll.sDesc = "";
rRoll.sDesc = rRoll.sDesc .. " " .. StringManager.capitalize(sAbilityStat);
local count = nSkillLev;
Debug.console("count:", count);
while count > 0 do
table.insert(rRoll.aDice, "d10");
count = count - 1;
end
rRoll.bSecret = bSecretRoll;
ActionsManager.performAction(draginfo, rActor, rRoll);
end
function initLastDice(aDice)
aSavedDice = {};
for i , v in ipairs (aDice) do
aSavedDice[i] = { type=v.type, result=0, exploded=true };
end
return aSavedDice;
end
function onLanded(rSource, rTarget, rRoll, nSkillLev)
Debug.console("onLanded: ", rSource, rTarget, rRoll);
if not nSuccesses then nSuccesses = 0;
end
if not nFails then nFails = 0;
end
local nSuccessLevel = 5;
rRoll.nSuccessLevel = nSuccessLevel;
for i , v in ipairs (rRoll.aDice) do
if rRoll.aDice[i].result == 10 then
nSuccesses = nSuccesses + 1;
elseif rRoll.aDice[i].result >= nSuccessLevel then
nSuccesses = nSuccesses + 1;
elseif rRoll.aDice[i].result < nSuccessLevel then
nFails = nFails + 1;
end
end
rRoll.nFails = nFails;
rRoll.nSuccesses = nSuccesses;
Debug.console("nSuccesses1: ", nSuccesses, " nFails1: ", nFails, "nSuccessLevel1:", nSuccessLevel);
local rMessage = ActionsManager.createActionMessage(rSource, rRoll);
rMessage = createChatMessage(rSource, rRoll, sDesc1);
rMessage.type = "dice";
rMessage.text = rMessage.text .. "\nDiff = ".. rRoll.nSuccessLevel;
rMessage.text = rMessage.text .. "\nSucces: " .. rRoll.nSuccesses;
if nSuccesses == 0 then
rMessage.text = rMessage.text .. "\n[Echec]";
end
Comm.deliverChatMessage(rMessage);
nSuccesses = nil;
nFails = nil;
end
function createChatMessage(rSource, rRoll)
local rMessage = ActionsManager.createActionMessage(rSource, rRoll);
rMessage.dicedisplay = 0;
return rMessage;
end
Attribute
exp
<number_charabilityscore name="vigueur" source="stats.vigueur.core">
<anchored to="vig" position="insidetopleft" offset="9,6" height="20" width="20" />
<script>
function action(draginfo)
local nodeWin = window.getDatabaseNode();
if nodeWin then
local rActor = ActorManager.getActor("pc", nodeWin.getChild("..."));
local nAttribLev = getValue();
nAttribLev = nAttribLev + (DB.getValue(nodeWin, "stats." .. self.target[1] .. ".mod", 0));
ActionAbility.performRoll(draginfo, rActor, nAttribLev, self.target[1]);
end
end
function onDragStart(button, x, y, draginfo)
return action(draginfo);
end
function onDoubleClick(x,y)
return action();
end
</script>
<target>vigueur</target>
</number_charabilityscore>
-
March 30th, 2020, 22:17 #2027
Meguido
Code:local sDesc1, nMod = ModifierStack.getStack(true); if nMod == 0 then nMod = 5; end if nMod < 5 then sDifficulty = "Simple Action"; elseif nMod < 7 then sDifficulty = "Easy Action"; elseif nMod < 9 then sDifficulty = "Difficult Action"; elseif nMod < 10 then sDifficulty = "Very Difficult Action"; else sDifficulty = "Impossible Action"; end
-
March 30th, 2020, 22:18 #2028
Thank you Phystus that is perfect
Thank you Kronovan. Are you able to transfer your data to World Builder? You will find it a much more useful tool I think.
-
March 30th, 2020, 22:27 #2029
- Join Date
- Sep 2017
- Location
- France (Gard)
- Posts
- 44
I integrate it where ? into manager_action_ability
thank
-
March 30th, 2020, 22:40 #2030
Here is my roll. You will need to work out how to use it in the fashion you are. Instructions are in the Basic User Manual or wait a couple of days for this to be published.
Code:-- -- Please see the license.html file included with this distribution for -- attribution and copyright information. -- -- MoreCore v0.60 register "vermine" local sCmd = "vermine"; function onInit() CustomDiceManager.add_roll_type(sCmd, performAction, onLanded, true, "all", nil, nil, onDiceTotal) end function performAction(draginfo, rActor, sParams) -- Debug.chat("16"); Debug.console("performAction: ", draginfo, rActor, sParams); local rRoll = createRoll(sParams); ActionsManager.performAction(draginfo, rActor, rRoll); Debug.console("performAction: ", rRoll); end --- --- This function creates the roll object based on the parameters sent in --- function createRoll(sParams) -- Debug.chat("28"); local rRoll = {}; rRoll.sType = sCmd; rRoll.nMod = 0; -- Removed to allow ChatManager.createBaseMessage function to create the right name - active character or player name if no characters are active. --rRoll.sUser = User.getUsername(); rRoll.aDice = {}; -- Now we check that we have a properly formatted parameter, or we set the sDesc for the roll with a message. if not sParams:match("(%d+)%s(.*)") then rRoll.sDesc = "Parameters not in correct format. Should be in the format of \"# <desc>\""; return rRoll; end local sDesc1, nMod = ModifierStack.getStack(true); -- Debug.chat("nMod: ", nMod); if nMod == 0 then nMod = 5; end if nMod < 5 then sDifficulty = "Simple Action"; elseif nMod < 7 then sDifficulty = "Easy Action"; elseif nMod < 9 then sDifficulty = "Difficult Action"; elseif nMod < 10 then sDifficulty = "Very Difficult Action"; else sDifficulty = "Impossible Action"; end local sDice, sDesc = sParams:match("([^%s]+)%s*(.*)"); -- Debug.chat("sDice, sDesc, sParams: ", sDice, sDesc, sParams); -- Build a table of rolls, split by the + signs between them local sDelim = "+" local aDielist = StringManager.split(sDice, sDelim, 1); -- Debug.chat("aDielist: ", aDielist); local nDice = 0; for k,v in pairs(aDielist) do nDice = nDice + v -- Debug.chat("nDice: ", nDice); end if nDice <= 0 then nDice = 1; end sDice = nDice .. "d10"; -- Now roll them local aDice = StringManager.convertStringToDice(sDice); rRoll.sDesc = sDesc; rRoll.aDice = aDice; rRoll.nMod = nMod; rRoll.sDifficulty = sDifficulty; -- Debug.chat("sDesc: ", sDesc, " aDice: ", aDice, " nMod: ", nMod); return rRoll; end --- --- This function steps through each die result and checks if it is greater than or equal to the success target number --- adding to the success count if it is. --- function countSuccesses(rRoll) -- Debug.chat("65"); -- Sort rRoll.aDice table based off a.result (the dice result) local nSuccessess = 0; for _,v in ipairs(rRoll.aDice) do if (v.result >= rRoll.nMod) then nSuccessess = nSuccessess + 1; end -- Debug.chat("nSuccessess: ", nSuccessess); end -- Debug.chat("nSuccessess final: ", nSuccessess); rRoll.nSuccessess = nSuccessess; return rRoll; end --- --- This function creates a chat message that displays the results. --- function createChatMessage(rSource, rRoll) -- Debug.chat("85"); local rMessage = ActionsManager.createActionMessage(rSource, rRoll); rMessage.dicedisplay = 1; -- display total rMessage.text = rMessage.text .. " vs " .. rRoll.sDifficulty .. "\n# Successes = " .. rRoll.nSuccessess; return rMessage; end --- --- This function creates the help text message for output. --- function createHelpMessage() local rMessage = ChatManager.createBaseMessage(nil, nil); rMessage.text = rMessage.text .. "The \"/successes\" command is used to roll a set of dice and report the number of dice that meet or exceed a success target number.\n"; rMessage.text = rMessage.text .. "You can specify the number of dice to roll, the type of dice, and the success target number"; rMessage.text = rMessage.text .. "by supplying the \"/successes\" command with parameters in the format of \"#d# #\", where the first # is the "; rMessage.text = rMessage.text .. "number of dice to be rolled, the second number is the number of dice sides, and the number following the "; rMessage.text = rMessage.text .. "space being the success target number for each dice."; Comm.deliverChatMessage(rMessage); end function onDiceTotal( messagedata ) -- Debug.chat("108"); local sMyTotal = string.match(messagedata.text, "sses...(%d+)"); Debug.console("onDiceTotal: ", sMyTotal, messagedata); return true, tonumber(sMyTotal); end --- --- This is the callback that gets triggered after the roll is completed. --- function onLanded(rSource, rTarget, rRoll) -- Debug.chat("118"); rRoll = countSuccesses(rRoll); Debug.console("performAction: ", rRoll); rMessage = createChatMessage(rSource, rRoll); Debug.console("performAction: ", rMessage); rMessage.type = sCmd; Comm.deliverChatMessage(rMessage); end
Thread Information
Users Browsing this Thread
There are currently 4 users browsing this thread. (1 members and 3 guests)
Bookmarks