vtt-lair / foundry-group-initiative

Module for Foundry VTT that allows you to roll grouped initiative.
MIT License
3 stars 4 forks source link

Roll All and Roll NPCs #17

Closed Helm70 closed 2 years ago

Helm70 commented 2 years ago

I've noticed recently that the "roll all" and "roll npcs" button seems to be non-functional. It works for the first attempt but locks up afterwards. Rolling individual initiatives seems to be ok.

I'm running Foundry 0.8.9 and D&D 5e 1.5.5

Aymeeeric commented 2 years ago

Yes, same thing here... The module does not work anymore on "roll all" and "roll npcs" (Foundry 0.8.9 and D&D 5e 1.5.5).

vtt-lair commented 2 years ago

@Helm70 and @Aymeeeric can you possibly give me more details?

I've tried using both buttons on a first attempt and subsequent attempts without issue:

The only time where it doesn't roll is if ALL the combatants already have an initiative, however this is standard core functionality of Foundry, that you can't roll if all the combatants already have initiative.

KasaiSV commented 2 years ago

I'm having the same exact issue. Everything I've tested below has been with only the Group Initiative module (and any dependency modules) active, and nothing else. Also, for what it's worth, I had a game back on 11/19/2021 during which I can safely say the issue was not happening.

The first encounter that I begin after launching/refreshing FVTT works fine and the initiative buttons function without issue. Once I have ended that encounter, if I try to start another one, either on the same scene or a different scene, the two buttons are completely non-functional. Additionally, the error doesn't require initiative to be rolled in the first encounter. If I create an encounter, immediately delete it, and then create a second one, it will not function.

This only happens when the "Roll group initiative" option is selected in the Combat Tracker Settings. Additionally, while I'm in the first encounter (the functioning one) I can add additional tokens to the encounter, both prior to and after hitting the "Begin Combat" button at the bottom of the tracker, and the buttons continue to work. I can also hit the "Reset Initiative" button and am able to use the buttons successfully without issue, as long as it is the same encounter. Once the encounter ends and I begin a new one, none of this works.

I'm hoping this might help shed some light on things: In some cases, instead of the buttons doing nothing, they disappear after being clicked on and I am given an error that reads as follows: unknown

Here is a picture showing the buttons being gone: image

Once I get the error popup, until restarting FVTT I will continue getting the error (along with the disappearing buttons) whenever I make a new encounter and try to use the "Roll All" or "Roll NPC" buttons. The combat ID listed in the error is the same each time, until I restart FVTT, but the next time I run across the error, the ID will be different.

So to quickly summarize the steps I take to reproduce the problem:

  1. Open FVTT and create a new combat encounter (insuring that the group initiative option is selected).
  2. End the combat encounter. This can be done either by clicking the trashcan icon, or by clicking the "begin combat" button followed by the "end combat" button. It does not matter if the "Roll All" or "Roll NPC" buttons were used during this encounter.
  3. Create a new combat encounter.
  4. Attempt to click the "Roll All" or "Roll NPC" buttons.
  5. The buttons will either do absolutely nothing with no feedback, or they will disappear from the combat tracker and will spit out the error I attached above. I do not know what determines whether they simply don't work/spit the error.
Helm70 commented 2 years ago

I started Foundry VTT without any modules enabled and again, group initiative works ok the first time I "roll all" or "roll npcs" but for the 2nd encounter, the buttons become unresponsive.

vtt-lair commented 2 years ago

Thanks for the details. Will see what is going on here... from the error shared it almost looks like it's not ending the combat for some reason, even though it's ended,

vtt-lair commented 2 years ago

For interest sake, @KasaiSV, @Helm70 do you guys have lipWrapper installed?

KasaiSV commented 2 years ago

I do and have had it enabled when testing.

Aymeeeric commented 2 years ago

I'm having the same exact issue. Everything I've tested below has been with only the Group Initiative module (and any dependency modules) active, and nothing else. Also, for what it's worth, I had a game back on 11/19/2021 during which I can safely say the issue was not happening.

The first encounter that I begin after launching/refreshing FVTT works fine and the initiative buttons function without issue. Once I have ended that encounter, if I try to start another one, either on the same scene or a different scene, the two buttons are completely non-functional. Additionally, the error doesn't require initiative to be rolled in the first encounter. If I create an encounter, immediately delete it, and then create a second one, it will not function.

This only happens when the "Roll group initiative" option is selected in the Combat Tracker Settings. Additionally, while I'm in the first encounter (the functioning one) I can add additional tokens to the encounter, both prior to and after hitting the "Begin Combat" button at the bottom of the tracker, and the buttons continue to work. I can also hit the "Reset Initiative" button and am able to use the buttons successfully without issue, as long as it is the same encounter. Once the encounter ends and I begin a new one, none of this works.

I'm hoping this might help shed some light on things: In some cases, instead of the buttons doing nothing, they disappear after being clicked on and I am given an error that reads as follows: unknown

Here is a picture showing the buttons being gone: image

Once I get the error popup, until restarting FVTT I will continue getting the error (along with the disappearing buttons) whenever I make a new encounter and try to use the "Roll All" or "Roll NPC" buttons. The combat ID listed in the error is the same each time, until I restart FVTT, but the next time I run across the error, the ID will be different.

So to quickly summarize the steps I take to reproduce the problem:

  1. Open FVTT and create a new combat encounter (insuring that the group initiative option is selected).
  2. End the combat encounter. This can be done either by clicking the trashcan icon, or by clicking the "begin combat" button followed by the "end combat" button. It does not matter if the "Roll All" or "Roll NPC" buttons were used during this encounter.
  3. Create a new combat encounter.
  4. Attempt to click the "Roll All" or "Roll NPC" buttons.
  5. The buttons will either do absolutely nothing with no feedback, or they will disappear from the combat tracker and will spit out the error I attached above. I do not know what determines whether they simply don't work/spit the error.

This is exactly what is happening to me. @vtt-lair : lipWrapper installed here :)

vtt-lair commented 2 years ago

@KasaiSV thanks for the detailed report. I was able to replicate your issue... now to try and figure out what is going wrong

vtt-lair commented 2 years ago

@KasaiSV , @Aymeeeric , @Helm70 I found the issue! I registered taking over the Roll NPC and Roll All functionality with my functions with libWrapper, but never unregistered the functions when deleting combat.

As such, when creating a new encounter. The functions were linked to the old combat data and when clicking Roll NPC or Roll All, it saw that there was already initiatives and just noped out.

I've fixed it, just want to run through a few test still and have a family thing on in an hour. So will try and release this fix tonight (for me) still.

Thanks again... the detailed report really helped me figure out the issue!

Helm70 commented 2 years ago

I really appreciate your quick response into resolving this.

vtt-lair commented 2 years ago

Just released the new version, please let me know if it's behaving like a good module now

Helm70 commented 2 years ago

Working fine now. Much appreciated!

Aymeeeric commented 2 years ago

Same here! Thanks a lot @vtt-lair.