STAR TREK 2d20
  1. #1

    (5e) Issue with CombatManager.setCustomTurnEnd ?

    I have the following code as a test in an extension :

    in the onit I have :

    CombatManager.setCustomTurnEnd(turnEnd)

    followed by :

    function turnEnd()
    Debug.console("newturnendfunction")
    end

    All is working fine until it is a turn end AND a round end, then it seems that the turnend function is called twice. Once before and once after the round end function.

    Am I being stupid, or is this happening for others also?

    Cheers, Steve.

  2. #2
    Quote Originally Posted by Stv View Post
    I have the following code as a test in an extension :

    in the onit I have :

    CombatManager.setCustomTurnEnd(turnEnd)

    followed by :

    function turnEnd()
    Debug.console("newturnendfunction")
    end

    All is working fine until it is a turn end AND a round end, then it seems that the turnend function is called twice. Once before and once after the round end function.

    Am I being stupid, or is this happening for others also?

    Cheers, Steve.
    I just ran your code and I can confirm. It is firing every time a character in the CT turn's is over AS WELL as when the round is over. If I have two characters in the CT and an NPC, it fires after each one and again when the round is over. So if I just click the Next Round button instead of the Next Actor button, it fires FOUR times (one for each actor in the CT and once for when the round is over).

    I tried also using CombatManager.setCustomTurnStart(), but that fires the same amount of times. I'm not sure what you are looking to do, but if you want something to fire each ROUND, you should look at CombatManager.setCustomRoundStart() or even setCustomCombatReset().

    Hope that helps.
    Last edited by jackkerouac; June 1st, 2020 at 03:26.

  3. #3
    Thanks for checking for me Jack, although not what I wanted to hear :P
    I need something to fire on the end of an actors turn, but also something different to fire on a turn end.
    Guess I'll have to find some part of the base functions to override instead of using the 'setCustom' funtions.
    I thought the way I had attacked it was the correct way, maybe it is and that part of the code is buggy.

    Thanks again for confiming.

    Cheer, Steve.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    The turn end gets ran whenever there’s a change in the current unit slot - which happens at the end of the round too. There’s another custom function in the CoreRPG effects package, I can't remember what it’s called as I’m not in front of my computer, it’s something like customActorEndTurn - it has "actor" in the name.
    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!

  5. #5
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    I was getting a bit confused. The custom event I was thinking of was fCustomOnEffectActorEndTurn in CoreRPG scripts\manager_effects.lua. But this only gets called if there are effects on the actor.

    In the custom turnEnd script you have in post #1, add nodeCT as an event variable. You can check this and if it's the first node in the CT you can assume it's the beginning of the round? I don't know, just thinking out loud...
    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!

  6. #6
    I had a play with a workaround earlier Trenloe, if I use a temporary flag, I can set/reset it depending on if the round end has been triggered, if it does, then don't trigger the turn end (as it will already have been processed before the round end).
    It's a bit messy, but it works


    Thanks for you help



    Although there is something else you could also maybe help with..... :P

    What event is triggered if you manually change the current actor in the CT by using the left hand buttons ?


    Cheers, Steve.
    Last edited by Stv; June 1st, 2020 at 11:00.

  7. #7
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Quote Originally Posted by Stv View Post
    What event is triggered if you manually change the current actor in the CT by using the left hand buttons ?
    There's no central handler than I can see. In 5e it fires the onActiveChanged handler in ct\scripts\ct_entry.lua.
    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!

  8. #8
    Quote Originally Posted by Trenloe View Post
    There's no central handler than I can see. In 5e it fires the onActiveChanged handler in ct\scripts\ct_entry.lua.
    Thanks for the heads up.
    I'll take a look at that and see if it can do what I need.

    Cheers, Steve.

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 Product Walkthrough Playlist

Log in

Log in