STAR TREK 2d20
Page 1 of 5 123 ... Last
  1. #1

    5E - Turn Based Effects

    This is now available on DMs Guild Here

    This simple extension adds in a flag
    Code:
    ONTURN
    which can be added to any effect. This will deactivate the effect after it fires, and then on anyone's turn end it would reactivate. The idea is to support Ranger's Colossus Slayer feature with a persistent effect.
    Code:
    Colossus Slayer; IFT: wounded; DMG: 1d8; ONTURN;
    This way the ranger can always have the effect on them and active in the combat tracker and it will only apply the damage when it can, and only once per turn. This could be used for any other effect that can only trigger once per turn, Rogue's sneak attack is another that it can work with (although you'd be assuming that they can always proc it through advantage or an ally within 5').

    Let me know if there are any questions, comments, bugs, requests, or any other general feedback.

    Thanks and Enjoy!

    Version 1.1: Fixed a bug where some standard effects weren't being parsed properly, like ADVATK and such.
    Version 2.0: Changed keyword from TURN to ONTURN so it doesn't have potential overlap with AD&D ruleset.
    Version 2.1: Allow setting the effects as GM only for visibility when they deactivate/reactivate.
    Version 2.2: Update which should make this play nicely with other extensions.
    Version 2.3: Fixed a bug where it wasn't working in some cases.
    Version 2.4: Fixed an issue with this not working correctly for players.
    Last edited by kentmccullough; August 20th, 2020 at 20:53.

  2. #2
    Amazing. I can not wait to try this out.
    Last edited by wmljohn; April 9th, 2020 at 16:04.

  3. #3
    Updated to version 2.2 this version should play nicely with any other extensions.

  4. #4
    Quote Originally Posted by kentmccullough View Post
    Updated to version 2.2 this version should play nicely with any other extensions.
    Does this mean you dont need me to look at the code to integrate?
    ---
    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.

  5. #5
    It does yes, but you may be interested in looking at how I made that happen, imo, should probably be a best practice.

    Instead of overwriting the EffectsManager5E.hasEffect and such outright, I make a local variable of what it is, and call that inside my new custom handler so that any previous ways it worked will still work so I could just inject my own code into it.

    Code:
    local getEffectsByType = nil;
    local hasEffect = nil;
    
    function onInit()
    	CombatManager.setCustomTurnEnd(endTurn);
    	
    	getEffectsByType = EffectManager5E.getEffectsByType;
    	hasEffect = EffectManager5E.hasEffect;
    	
    	EffectManager5E.getEffectsByType = customGetEffectsByType;
    	EffectManager5E.hasEffect = customHasEffect;
    end
    
    
    function customGetEffectsByType(rActor, sEffectType, aFilter, rFilterActor, bTargetedOnly)
    	local results = getEffectsByType(rActor, sEffectType, aFilter, rFilterActor, bTargetedOnly) or {};
            -- custom code here
    
            return results;
    end
    Once I realized that it made it simple to not mess up your extension or any other that's overwriting those functions, at least as long as my loadorder is later. If someone's load order is later, but does this, then my custom code will be called also, and everything will be fine.

  6. #6
    Hey man! I was loading your extension but not yet using it but it somehow was screwing up my game last night with latest FGU. 5E enhancer was also loaded. I was getting tbe_ files error but I’ll try to reproduce and get you more details today. Examples of things failing: spiritual weapon couldn’t roll damages, barbarian couldn’t make a cons saving throw, etc.
    5E DM, Player, FG conversions, learning LUA, engineer, geek, Ultimate License, Unity Supporter.

    DMs Guild Creator

  7. #7
    Do you have the latest version? That would be 2.3 I introduced a bug in 2.2 but it should be fixed now.

  8. #8
    I was on 2.2 indeed! Now for some tests!
    5E DM, Player, FG conversions, learning LUA, engineer, geek, Ultimate License, Unity Supporter.

    DMs Guild Creator

  9. #9
    Updated to Version 2.4:
    - Fixed an issue with this not working correctly for players. I'm now using OOB messages so that things can be properly handled on host end (who owns the CT nodes)

  10. #10
    Are you on github by any chance? I'd rather pull a new version than come here and download+copy
    5E DM, Player, FG conversions, learning LUA, engineer, geek, Ultimate License, Unity Supporter.

    DMs Guild Creator

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

Log in

Log in