5E Character Create Playlist
  1. #1
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,622

    Creating a Skill-List & a Stress Die

    ... I seem to be unable to make either heads or tails of this.

    What I need (and try to create) is a list of skills that should contain :

    Skillname as a string,
    Specialization as a string
    Cost / Level as a Numbercontrol
    A level as a Numbercontrol
    And finally a "Cost Total" taken from : Cost * ((Level^2)/2+Level/2)

    I'd prefer to have this in a scroll-list adding new lines as one keeps typing in new skills and finally drop a "Total XP Spent" somewhere on the character-sheet but I am thinking once I have the basic framework in place THAT I should at the least be able to do by Trial & Error.

    And for some reason my mind seems to be unwilling and unable to wrap itself around how to do this in the LUA, XML combination used in FG2...

    The Second problem

    I need to create a open-ended Dice that Auto-Sums itself : IE, if the D10 comes down a 10, it should re-roll and then sum the rolls together, if it keeps landing a 10 keep adding and rolling.

    ... if I have that much I am sure I should be able to add the infamous ArsMagica stress-die. (Well it sure is stressing me when I can't get it to work.)
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  2. #2
    Stress die:
    This one is fairly simple (though, of course, this change for it will make it so that every time you roll a d10, you end up getting the open-ended feature)

    In chat_chat.lua, you need to modify the following code:
    Code:
    function onDiceLanded(draginfo)
           if draginfo.isType("fullattack") then
                   -- Full attack stuff goes here.  Don't change any of this.. right now anyway
           elseif draginfo.isType("dice") then
                     for k, v in pairs(draginfo.getDiceList()) do
                            if v.type == "d10" and v.result == 10 then
                                    throwDice("dice",{"d10"},draginfo.getNumberData() + 10,"Open-ended d10")
                             end
                   end
                   applyModifierStackToRoll(draginfo);
           end
    end
    What that should do:
    (haven't tested the code just yet, but I think that's how I did it last time I was tinkering with it)... every time you roll a d10 (anywhere), and it comes up a 10, it will automatically reroll it until it doesn't come up a 10.


    Ways to fix that:
    Make a section of... erm... well, actually I have no clue about Ars Magica, so I don't know where you'd want to add it. But... anyway! Somewhere on the character sheet, or the desktop, or somewhere... ... add in a box:

    Code:
    <genericcontrol>
            <script>
                    function onDrag(button, x, y, draginfo)
                        draginfo.setType("stress");
                        draginfo.setDescription("Stress die");
                        draginfo.setSlot(1);
                        draginfo.setDieList({ "d10" });
                        draginfo.setNumberData(0);
                        return true;
                   end
            </script>
    </genericcontrol>
    ... then, we go to desktop_classes.xml, and add the line in red:

    Code:
        <windowclass name="chat">
            <sheetdata>
                <chatwindow name="chat">
                    <droptypes>
                        <type>dice</type>
                        <type>number</type>
                        <type>string</type>
                        <type>fullattack</type>
                        <type>stress</type>
                    </droptypes>
                </chatwindow>
            </sheetdata>
        </windowclass>
    ... finally, we go back to chat_chat.lua, and modify our earlier code:
    Code:
    function onDiceLanded(draginfo)
           if draginfo.isType("fullattack") then
                   -- Full attack stuff goes here.  Don't change any of this.. right now anyway
           elseif draginfo.isType("stress") then
                      for k, v in pairs(draginfo.getDiceList()) do
                            if v.type == "d10" and v.result == 10 then
                                    throwDice("dice",{"d10"},draginfo.getNumberData() + 10,"Open-ended d10")
                             end
                    end
                     applyModifierStackToRoll(draginfo);
            elseif draginfo.isType("dice") then
                     applyModifierStackToRoll(draginfo);
           end
    end
    ... and that should do it.

    I hope that helps a little (and I hope that my code actually works... I just woke up. ).
    "He is everything I have ever aspired to be."
    "Your aspiration is to be impaled on a halberd? Your parents must be proud."

  3. #3
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,622
    Alas not much luck, and I can't even give a error-message since it has so far managed to crash FG every time I try it.

    Maybe I could just do something in the chatmanager.lua with a normal randomizer and skip the graphic dice...
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  4. #4
    *frown*

    I wonder which part I screwed up the code on... >.<

    Sorry.
    "He is everything I have ever aspired to be."
    "Your aspiration is to be impaled on a halberd? Your parents must be proud."

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
  •  
Cosmere RPG Beta Launch

Log in

Log in