napolitanod / Danger-Zone

localized zone effects with trigger options supporting animations, lasting effects, active effects, macros and integrations with other Foundry modules.
GNU General Public License v3.0
19 stars 1 forks source link

Token Interaction with Danger Zone #102

Closed WinterrrWarlock closed 1 week ago

WinterrrWarlock commented 1 month ago

The only thing that doesn't work for me is the Token Interaction button so i can apply damage. I am using version 1.76 for Foundry VTT 11 ( can't upgrade as I have too many dependencies that haven't moved to V12) whenever I click Token Interaction this generates in the console.

TypeError: An error occurred while rendering DangerZoneDangerFormTokenResponse 144. key.split is not a function or its return value is not iterable [No packages detected] at Object.getProperty (commons.js:2536:24) at Localization.localize (foundry.js:7586:27) at Object.selectOptions (foundry.js:8202:43) at Object.c (handlebars.min.js:27:19853) at Object.eval [as main] (eval at createFunctionContext (handlebars.min.js:29:1808), :125:159) at c (handlebars.min.js:27:15429) at d (handlebars.min.js:27:15744) at e (handlebars.min.js:28:22748) at renderTemplate (foundry.js:7743:10) at async DangerZoneDangerFormTokenResponse._renderInner (foundry.js:5973:16) at async DangerZoneDangerFormTokenResponse._renderInner (foundry.js:6543:18) at async DangerZoneDangerFormTokenResponse._render (foundry.js:5818:19) at async DangerZoneDangerFormTokenResponse._render (foundry.js:6532:5)

Any help would be appreciated :)

napolitanod commented 1 month ago

The ongoing improvements to dnd5e system can cause conflicts over time. I'm guessing the issue is a result of a change that the dnd5e system made with how damage types are structured. If you are comfortable updating module code, the update can be done in the Danger Zone module code following the instructions below.

This is fixed in v12 if you can wait until you are on that version. I just don't have a v11 code environment to code or test in. I can't say if you will hit other errors after the below update is made, but the below update is likely needed.

  1. Save a copy of danger zone script scripts/apps/constants.js in case you need to revert.

  2. Open danger zone file: scripts/apps/constants.js

  3. search for: export function damageTypes()

4a. change these lines of existing code

export function damageTypes() {
    switch(game.world.system){
        case "dnd5e":
           return Object.assign(game.dnd5e.config.damageTypes, game.dnd5e.config.healingTypes) 

4b. replace the above lines with

export function damageTypes() {
    switch(game.world.system){
        case "dnd5e":
                const damageEntries = {};
                for ( let [k, v] of Object.entries(Object.assign(game.dnd5e.config.damageTypes, game.dnd5e.config.healingTypes)) ) {
                    damageEntries[k] = v.label;
                }
                return damageEntries
WinterrrWarlock commented 1 month ago

So far that worked! The only other weird issue I have is that if I set the canvas to shake, it completely freezes foundry. The reason I even wanted this is that I have a Warforged Construct in my party that heals based off of lightning damage, and when a storm rolls through she has a chance to lightning rod herself. I wanted a cool way to target her with a lightning strike and have it roll for healing.

napolitanod commented 1 month ago

That might be what I think is a Sequencer bug I found in my earlier testing (see https://github.com/fantasycalendar/FoundryVTT-Sequencer/issues/265).

I have code to prevent the bug from happening in v12 but not in v11. If this is the same thing, check out the settings for the shake on the Canvas danger part and see if the frequency is set to 0. If it is, try setting it to a positive number and see if that fixes it.

WinterrrWarlock commented 1 month ago

Yeah, I set it to 1 and it no longer happens! Honestly man the stuff you've come up with is an absolute game changer. I have spent months fine tuning automation for my campaign, and it plays more like a video game :P it's really cool to be able to add life with motion to a map. Now Lightning Strikes don't just have to be theater of the mind :P