5E Product Walkthrough Playlist

Thread: Rest function

  1. #1

    Rest function

    I know just enough about programming to be dangerous. So I'm considering trying to create my first extension.

    For my first extension, I want something simple. I want to make a Story note pop up when the Long Rest function is used (preferably making everyone see it, not just me). Just a reminder for us to adjust the date in the calendar, use rations, and other house-keeping chores.

    Is this possible? If so, any experienced extension developers willing to point me in the right direction before I begin?

    Thanks!

    PS Another option is to create a function that forces the Story pop-up and then runs the Long Rest function, but I'd prefer to tie into the Long Rest function is possible. Mostly as a learning experience.
    Fantasy Grounds Unity Lives! Good job, Smiteworks!

  2. #2

  3. #3
    That's the extension that gave me the idea. I figured I could use it as a template.

    Just hoping someone knows where/how to tie into the Long Rest function.
    Fantasy Grounds Unity Lives! Good job, Smiteworks!

  4. #4

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    Call CombatManager.setCustomCombatReset() with your custom function in your onInit() function, and that function should get called whenever there is a rest.

  5. #5
    The function that Andraax mentioned is called whenever the initiative is reset, so probably not exactly what you are looking for.

    You'd have to override the rest function for the ruleset. Probably having an extension with a global script that does something like this:
    Code:
    local fSavedRestFunction = null;
    function onInit()
      fSavedRestFunction = CombatManager2.rest;
      CombatManager2.rest = rest;
    end
    function rest(bLong)
      fSavedRestFunction(bLong);
      -- New pop-up message code
    end
    Remember that the long rest only triggers on the host, so you would need to have the host pop up a window and share with players; or use OOB commands to force a window to pop up on the player machines.

    Regards,
    JPG

  6. #6
    Thanks for the advice! I appreciate it. Just realized I'm out of town this weekend. But when i get back, I will take a stab at it and come back w/ questions.
    Fantasy Grounds Unity Lives! Good job, Smiteworks!

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
  •  
5E Character Create Playlist

Log in

Log in