AppleHair / FNF-UnrestDiffs

The Unrestricted Difficulties framework is a softcoded FNF mod, which provides FNF modders with more control over difficulties and variations
https://gamebanana.com/mods/512797
Other
3 stars 0 forks source link

New Songs in Alt-Level Data Help #6

Closed Emerald42069 closed 3 months ago

Emerald42069 commented 4 months ago

When adding the song ghastly to week 2 using the difficulty dsidediff in the variation default (while every other song uses dside as the variation) freeplay crashes whenever opened with no error message and when getting to the song in story mode it send a error that reads "There was a critical error retrieving data for this song on "dsidediff" difficulty with variation "dside". Click OK to return to the main menu" It seems to be trying to finding that data for ghastly for the dside variation but I dont know how to change it. I thought it could be the alt-level data so I changed the pat to the alt-levels from "UD\levels-alt\variations\dside" to "UD\levels-alt\difficulties\dsidediff" and the error still persists if you know anyway to fix this it would be a huge help.

AppleHair commented 4 months ago

I'll need to try to reproduce this bug. I'll let you know when I find the problem.

AppleHair commented 3 months ago

So I discovered the problem with freeplay, and made a PR that fixes it. There's no way to prevent this from Hscript, so you'll have to hide the song from freeplay for now. I'll try to figure out the problem in story mode next.

AppleHair commented 3 months ago

Ok, so again, I discovered the problem with story mode and made a PR that fixes it, but this time, THERE IS a way you can fix it right now through Hscript.

You just need to add this module:

[!CAUTION] This fix will be added to UD 1.1.0, so when UD 1.1.0 comes out, YOU'LL NEED TO DELETE THIS MODULE FROM YOUR MOD.


import flixel.FlxG;
import funkin.modding.module.Module;
import funkin.play.PlayState;
import funkin.play.PlayStatePlaylist;

class StoryModeValidVariFix extends Module {

function new() {
    super("story-mode-valid-vari-fix");
}

/**
 * Makes sure the valid variation is used when
 * switching to the next song in story mode.
 */
 public override function onCreate(event:ScriptEvent):Void {
    super.onCreate(event);
    FlxG.signals.preStateCreate.add(function(state):Void {
        if (!Std.isOfType(state, PlayState) || !PlayStatePlaylist.isStoryMode) {return;}
        if (state.currentSong == null) {return;}

        state.currentVariation = state.currentSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty);
    });
}

}