DICE PACKS BUNDLE
Page 2 of 2 First 12
  1. #11
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Quote Originally Posted by Tielc View Post
    From what I understand I can do this when loading my scripts with extension.xml. Can I do the replace function on a per-control basis as well? Can I just change my lua on say onHealthChanged for a single box or other instances like that?
    Overriding functions is only possible with Global script packages because they are ran during initialization of the ruleset code. You can't override individual functions in a control script. You need to overwrite the whole control script LUA file or <script> element.
    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!

  2. #12

    Join Date
    Jan 2015
    Location
    Grand Rapids, MI
    Posts
    136
    Quote Originally Posted by Trenloe View Post
    Overriding functions is only possible with Global script packages because they are ran during initialization of the ruleset code. You can't override individual functions in a control script. You need to overwrite the whole control script LUA file or <script> element.
    Okay, thanks for the heads up!

  3. #13
    If you want to add the new coin type something like this should work.

    Code:
    table.insert(GameSystem.currencies,"CR");
    I was mucking about with this for a friend running Darksun. I'll attach the extension. I didn't test it other than look that the coin type worked.
    Attached Files Attached Files
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  4. #14
    Quote Originally Posted by drvolk View Post
    You could try to do it like this:

    Add a own manager for replacing global functions to your base.xml or extension.xml:

    <script name="replaceFuncManager" file="scripts/manager_func_replace.lua" />
    ...
    function onInit()
    -- replace the function reference with you own one
    PartyLootManager.buildPartyCoins = buildPartyCoinsReplace;
    end
    How would this work for scripts that don't have a "script name" like charwizard.lua?
    charwizard.lua is only 'included' in the base.xml for the 5E ruleset and doesn't have a '<script name="...' so I cannot override the function by doing ScriptName.function = newfunction

    Specifically, I'm trying to override calcSummaryStats() in charwizard.lua.
    Last edited by GEONE; June 1st, 2022 at 07:30.

  5. #15
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,649
    Blog Entries
    1
    The character wizard is very complex and is always being updated.
    SW recommend that you dont overwrite anything in that area.

  6. #16

    Join Date
    Apr 2010
    Location
    Australia
    Posts
    895
    Is there a way to override a single global variable/constant in a CoreRPG script file?

    Eg.

    In the scripts/manager_language.lua, I want to change the following global constant:

    CHAR_LANGUAGE_LIST = "languagelist";
    to
    CHAR_LANGUAGE_LIST = "traits.languagelist";

    Presently I do this by copying the manager_language.lua file from CoreRPG into my ruleset, I make the above change, and then overwrite the <script name="LanguageManager" file="scripts/manager_language.lua" /> in my base.xml file.

    Is there a better way to do this with respect to layering?
    Timezone: Australian EST (GMT +10).
    Systems/Rulesets: GURPS 4th Edition.
    Campaigns (Ultimate License Holder)
    GURPS Traveller - The Empty Peace
    GURPS Shadowrun - Power Plays
    GURPS Banestorm - Dark Clouds Rising

  7. #17
    Quote Originally Posted by ronnke View Post
    Is there a way to override a single global variable/constant in a CoreRPG script file?

    Eg.

    In the scripts/manager_language.lua, I want to change the following global constant:

    CHAR_LANGUAGE_LIST = "languagelist";
    to
    CHAR_LANGUAGE_LIST = "traits.languagelist";

    Presently I do this by copying the manager_language.lua file from CoreRPG into my ruleset, I make the above change, and then overwrite the <script name="LanguageManager" file="scripts/manager_language.lua" /> in my base.xml file.

    Is there a better way to do this with respect to layering?

    I think you can just put LanguageManager.CHAR_LANGUAGE_LIST = "traits.languagelist"; inside an onInit() anywhere. Or more preferably create a new LanguageManager script file (something like NewLanguageManager) with only an onInit() that does the same thing and also stores the old CHAR_LANGUAGE_LIST in its own variable called something like OLD_CHAR_LANGUAGE_LIST.
    Then make sure to include it in the base xml <script name="NewLanguageManager" file="scripts/new_manager_language.lua" />

  8. #18

    Join Date
    Apr 2010
    Location
    Australia
    Posts
    895
    Quote Originally Posted by GEONE View Post
    I think you can just put LanguageManager.CHAR_LANGUAGE_LIST = "traits.languagelist";
    Worked like a charm.

    Thanks!
    Timezone: Australian EST (GMT +10).
    Systems/Rulesets: GURPS 4th Edition.
    Campaigns (Ultimate License Holder)
    GURPS Traveller - The Empty Peace
    GURPS Shadowrun - Power Plays
    GURPS Banestorm - Dark Clouds Rising

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

Log in

Log in