5E Product Walkthrough Playlist
  1. #1

    FGU Effects default to rounds in extensions

    Hi there.

    A little while ago there was a glitch where the effects did not adhere to the time extent setting. Round, Minute, Hour and so on. It just defaulted to Round. That glitch has been fixed, unless you have an extension that affect the effects.

    The following code is enough to recreate the bug:

    function onEffectTextAddStart(rEffect)
    end

    function onInit()
    EffectManager.setCustomOnEffectAddStart(onEffectTe xtAddStart);
    end

  2. #2
    I'm not sure what the issue you're reporting is. If you have an extension that is affecting the base rulesets, you'll need to take that up with the extension developer.

    Regards,
    JPG

  3. #3
    I am the extension developer.

    The issue lies in the CoreRPG ruleset. Specifically in the file managing effects: CoreRPG/scripts/manager_effect.lua
    In that file there's an available api setCustomOnEffectAddStart.

    Normally it is possible to set a time unit when editing a spell/ability effect, round, minute, and so on. For some reason that data is stripped when using the above api.

    Regards

  4. #4
    Is this the wrong location for extension development issues?

  5. #5
    I'm sure one of the mods can move this thread into the Workshop for you, no need to re-post there.
    Perhaps your extension has a copy of the old function? When FG pushes updates it is your responsibility as extension developer to check the new ruleset versions for changes (and merge those changes into your extensions wherever needed).

    EDIT: I don't know what ruleset you are working with, but it looks from your example as though you have a function "onEffectTextAddStart" which should be a copy of an official function (with your changes).
    What you need to do is recreate those same changes in the new copy of that function which is being distributed with that ruleset. For 3.5E/PF1e that would be:
    Code:
    function onEffectAddStart(rEffect)
    	rEffect.nDuration = rEffect.nDuration or 1;
    	if rEffect.sUnits == "minute" then
    		rEffect.nDuration = rEffect.nDuration * 10;
    	elseif rEffect.sUnits == "hour" or rEffect.sUnits == "day" then
    		rEffect.nDuration = 0;
    	end
    	rEffect.sUnits = "";
    end
    However, I would suggest a slightly different approach.
    Using these instructions, you can protect your extension from future changes by running the original function and then running your function (essentially triggering your function off of the triggering of the original). This can be done as long as you don't need to stop part of the original from running (and even then there are sometimes workarounds).
    Last edited by bmos; December 4th, 2020 at 17:53.

  6. #6
    MOD: Moved to Workshop for development questions
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Feature Request

  7. #7
    Oh! I see.

    I did not consider that the ruleset I was using would use the same api to the coreset. That makes a lot of sense and I have been able to find and understand what is wrong

    Thank you! It's appreciated!

  8. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,408
    EDIT: I completely missed that @bmos had already basically said the same. It's been one of those days...


    Quote Originally Posted by ParanoidBunbun View Post
    The following code is enough to recreate the bug:

    function onEffectTextAddStart(rEffect)
    end

    function onInit()
    EffectManager.setCustomOnEffectAddStart(onEffectTe xtAddStart);
    end
    What ruleset are you writing the extension for?

    CoreRPG doesn't know how long a round is - as it's generic, so if you only use CoreRPG code then it will set duration = the duration passed, which will be in rounds.

    Rulesets that layer on top of CoreRPG use the function set with EffectManager.setCustomOnEffectAddStart to calculate the number of rounds if the duration isn't in rounds.

    For example, the following is from the 5E ruleset:

    Code:
    function onEffectAddStart(rEffect)
    	rEffect.nDuration = rEffect.nDuration or 1;
    	if rEffect.sUnits == "minute" then
    		rEffect.nDuration = rEffect.nDuration * 10;
    	elseif rEffect.sUnits == "hour" or rEffect.sUnits == "day" then
    		rEffect.nDuration = 0;
    	end
    	rEffect.sUnits = "";
    end
    The code you provide to recreate the "bug" is actually what's causing the issue - you're overwriting the ruleset onEffectAddStart function with nothing, so there is no time unit conversion and therefore duration is always in rounds, no matter what the units are.
    Last edited by Trenloe; December 4th, 2020 at 18:12.
    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!

  9. #9
    My extension is made for Pathfinder, which inherit the DnD 3.5 ruleset that has the same function.

    Before now I didn't quite consider that the other rulesets are also using the core api... Which seems obvious on hindsight.

    Now that I understand the issue, I'll figure something out

  10. #10
    For prosperity, this is my solution.

    function onEffectTextAddStart(rEffect)
    EffectManager35E.onEffectAddStart(rEffect);
    end

    function onInit()
    EffectManager.setCustomOnEffectAddStart(onEffectTe xtAddStart);
    end
    The setCustomOnEffectAddStart function adds the function unto a local variable, so I wasn't able to get that (no gets are provided either). So I call the method that would've been overwritten directly instead.

    We'll see how safe this is long term, but this works well for now

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