DICE PACKS BUNDLE
  1. #2021
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    Quote Originally Posted by Phystus View Post
    Not a valid use case. It only honors negative modifiers. Try /ubiquity 3d6+2d6-1.
    Thats not how I read your initial description but thats ok.

    When I do this:
    /ubiquity 3d6+2d6-2
    I get Parameters not in correct format...

  2. #2022
    Phystus's Avatar
    Join Date
    Aug 2008
    Location
    Central Indiana
    Posts
    451
    Blog Entries
    20
    Also true. Apply a modifier for the negative value.

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

  4. #2024
    Phystus's Avatar
    Join Date
    Aug 2008
    Location
    Central Indiana
    Posts
    451
    Blog Entries
    20
    /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

  5. #2025
    Quote Originally Posted by damned View Post
    I havent seen that one.
    Places and Groups have been deprecated in favour of World Builder.
    Can you confirm if World Builder works for you or not?
    I havent tested it with TDE.
    World Builder is working fine for me when loading the TDE extension.

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

  7. #2027
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    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
    is what I used

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

  9. #2029

    Join Date
    Sep 2017
    Location
    France (Gard)
    Posts
    44
    I integrate it where ? into manager_action_ability
    thank

  10. #2030
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    Quote Originally Posted by meguido View Post
    I integrate it where ? into manager_action_ability
    thank
    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)

  1. ShirokuHakudo

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
  •  
FG Spreadshirt Swag

Log in

Log in