5E Character Create Playlist

Thread: LUA help

  1. #1

    LUA help

    I am trying again to make my own ruleset, and i am getting there...slowly.

    I can just about handle the xml at the moment, but not lua.

    At the moment the roll button rolls 2D6 and compares them to the target number in the "level" box:

    elseif rollable_button_attack then
    rActor = ActorManager.getActor(sActor, node.getParent().getParent().getParent());
    sType = "ability";
    sDesc = "[SKILL]";
    sTargetDesc = DB.getValue(node, "name", "");
    nTarget = DB.getValue(node, "level", "");
    rRoll = { sType = sType, sDesc = sDesc, aDice = aDice, nMod = nMod, sTargetDesc = sTargetDesc, nTarget = nTarget };
    if draginfo then
    draginfo.setCustomData(node);
    end;

    How would i modify that to add the dice total to the number in the "level" box?

    If you could explain why you suggest what you do suggest, that will help me learn.

    Thanks,

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    I'm not sure what you're trying to do, so I could be wrong here... If you just want to add what is currently in the "level" field to the roll total, then assign that value to nMod before you roll.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    I changed it to this:

    elseif rollable_button_attack then
    rActor = ActorManager.getActor(sActor, node.getParent().getParent().getParent());
    sType = "ability";
    sDesc = "[ATTACK]";
    nMod = DB.getValue(node, "level", "");
    rRoll = { sType = sType, sDesc = sDesc, aDice = aDice, nMod = nMod, sTargetDesc = sTargetDesc, nTarget = nTarget };
    if draginfo then
    draginfo.setCustomData(node);
    end;

    At the moment, there is say a 4 in the numerical box for that attack. When i click on the dice button, it rolls 2D6 and compares the total to the 4. If it rolls a 2 and a 4, it gives this:

    [ATTACK]
    (0+4)=(4): [Failure] by 2 (2 4 6)


    What i want it to do is give:

    [ATTACK] (2 4 10)

    i.e. rolling both dice, totalling them and adding the nMod value to the total. This is using the GURPS ruleset to start with, and this text is above the different roll descriptions:

    if node then
    local rActor = ActorManager.getActor(sActor, node);
    local sType = "dice";
    local sDesc = "[ROLL]";
    local sTargetDesc = ""
    local nTarget = 0;
    local aDice = { "d6","d6" };
    local nMod = 0;
    local sWeapon = "";
    local sDamage = "";
    local sMode = "";
    local nRoF = 1;
    local nRcl = 1;
    local sOperator = "";
    local nNum = 0

    local rRoll = { sType = sType, sDesc = sDesc, aDice = aDice, nMod = nMod };

  4. #4
    I'm sort of confused by your explanation, but it sounds like the level should be the target number to beat for the roll?

    If there's any comparison to a target number going on; then you'll need to handle it differently.

    There are a couple different ways that the D&D rulesets handle a similar situation for saving throws.

    1. The target number of the roll (such as saving throw DC) is embedded in the description string (i.e. "[DC 15]"); and then when the roll is resolved, the DC information is parsed out from the description text, and compared against the roll total.

    2. The target number of the roll is assigned to a custom field in the roll structure (i.e. rRoll.nTarget = nDC); and then when the roll is resolved, the DC information is pulled from the custom roll field, and compared against the roll total.

    Regards,
    JPG

  5. #5
    Quote Originally Posted by Moon Wizard View Post
    I'm sort of confused by your explanation, but it sounds like the level should be the target number to beat for the roll?

    If there's any comparison to a target number going on; then you'll need to handle it differently.

    There are a couple different ways that the D&D rulesets handle a similar situation for saving throws.

    1. The target number of the roll (such as saving throw DC) is embedded in the description string (i.e. "[DC 15]"); and then when the roll is resolved, the DC information is parsed out from the description text, and compared against the roll total.

    2. The target number of the roll is assigned to a custom field in the roll structure (i.e. rRoll.nTarget = nDC); and then when the roll is resolved, the DC information is pulled from the custom roll field, and compared against the roll total.

    Regards,
    JPG
    No, no target number needed, just a total. 2D6 + the number in the box.

    This though is interesting because some later bits will need TN's.

Thread Information

Users Browsing this Thread

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

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