DICE PACKS BUNDLE
Page 76 of 109 First ... 2666747576777886 ... Last
  1. #751
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    in this line:

    local nResult = rRoll.aDice[1].result;

    you are "capturing" the rRoll.aDice[1].result and storing it as nResult.

    I dont know if that description uses the correct terms - Im no programmer!

    Have a look at the rest of the output from the Debug

    Also - regarding aDice - that is an array.
    It stores several pieces of information about each dice that was thrown - the dice size and the dice result and the dice value (one of which you can manipulate) and dice type and expression and it stores it for each dice thrown. The first dice is known as aDice[1] and the second dice is aDice[2]

    Anyway your modifiers are not stored in the aDice part - but they are there elsewhere in the rRoll data

    try doing things like

    Debug.chat("nBonuses: ", rRoll.nBonuses);
    Debug.chat("s'nMod: ", rRoll.s'nMod);
    Debug.chat("s'sType: ", rRoll.s'sType);

    etc

    Then work out what you need to do next...

  2. #752

    Join Date
    Nov 2017
    Location
    North Carolina, USA
    Posts
    266
    This vid describes what I am wanting to do, does it not? Apply the mod to the target number before the roll. All I will need to do is edit and add the top half of your script from AAF and retain the nResult portion from mine.


    Basic Ruleset Creation Tutorial Series 007
    https://www.youtube.com/watch?v=5wRR5vi-X8c

  3. #753
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    What you are looking for is something like this:

    Code:
    local nDamage = 0;
    for _,v in ipairs(rRoll.aDice) do
    	nDamage = nDamage + v.result;
    end
    nDamage = nDamage + rRoll.nMod +rRoll.nBonuses;
    but you should try to follow my nudges above to increase understanding of why this works or is needed.

  4. #754

    Join Date
    Nov 2017
    Location
    North Carolina, USA
    Posts
    266
    Nudges followed, videos reviewed, other rulesets perused. Still a blindfolded drunk in a knife fight. I have an understanding of some LUA phrasing. But its like knowing what taco, hacienda and pantalones mean and trying to say in spanish "While wearing my red pants, I ate tacos at the house."

  5. #755

  6. #756

    Join Date
    Nov 2017
    Location
    North Carolina, USA
    Posts
    266
    Its not a damage script, its my managerRolls skill roll. Here's what I am experimenting with so far:

    function Skill(rSource, rTarget, rRoll)
    Debug.chat("rRoll: ", rRoll);

    local sModDesc, nMod = ModifierStack.getStack(true);

    local nSkillScore = tonumber(rRoll.SkillScore);
    Debug.chat("nSkillScore: ", nSkillScore);

    local nTarget = nSkillScore + nMod;
    Debug.chat("nTarget: ", nTarget);

    local nResult = rRoll.aDice[1].result;
    Debug.chat("nResult: ", nResult);

    local sResult = '';

    if nResult > nSkillScore then

    if nResult % 5 == 0 then
    sResult = ' (' .. nResult .. " vs EML " .. nSkillScore .. ") = Critical Failure ";
    else
    sResult = ' (' .. nResult .. " vs EML " .. nSkillScore .. ") = Marginal Failure ";
    end
    else
    if nResult % 5 == 0 then
    sResult = ' (' .. nResult .. " vs EML " .. nSkillScore .. ") = Critical Success ";
    else
    sResult = ' (' .. nResult .. " vs EML " .. nSkillScore .. ") = Marginal Success ";
    end
    end

    local rMessage = ActionsManager.createActionMessage(rSource, rRoll);

    rMessage.text = rMessage.text .. sResult;
    Comm.deliverChatMessage(rMessage);

    return true
    end

  7. #757

  8. #758

    Join Date
    Nov 2017
    Location
    North Carolina, USA
    Posts
    266
    It will find the SkillScore and the nMod, it just wont do the math. nSkillScore + nMod

  9. #759

  10. #760

    Join Date
    Nov 2017
    Location
    North Carolina, USA
    Posts
    266
    s'rRoll: ' | { s'nBonuses' = s'0', s'aDice' = { #1 = { s'value' = #87, s'type' = s'd100', s'result' = #87 }, s'expr' = s'd100' }, s'nMod' = #-20, s'sType' = s'wpn1_a_emlRollAction', s'bSecret' = bFALSE, s'SkillScore' = s'65', s'sDesc' = s'Attack EML Test Result For ML 80 - 15 PP [-20]' }

    s'nSkillScore: ' | #65

    s'nTarget: ' | #65

    s'nResult: ' | #87

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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
  •  
STAR TREK 2d20

Log in

Log in