Friday Night Funkin' Cookbook
Friday Night Funkin' CookbookExpertCustom Menu

Custom Menu

Reading time: 1 minute

cautionCaution

This is an unreleased (coming soon) feature, not even available in test builds!

When enabling your mod, you might have an entirely custom menu you want to send the user to. Accomplishing this is simple, but requires a module. A very simple setup would be as follows:

import funkin.modding.module.Module;
import funkin.InitState;

import funkin.ui.MusicBeatState;

class TestMenu extends MusicBeatState {
  // Empty... you should put some code here
}

// A module is needed, specifically for the modules onCreate event

class Test extends Module
{
  public function new()
  {
    super("Test", 0);
  }

  var titleState:Bool = false;

  public override function onCreate(event:ScriptEvent):Void
  {
    super.onCreate(event);

    if (!titleState)
    {
        // Tells the game to go to our menu instead of the TitleState!
        InitState.customTitleState = new TestMenu();
        titleState = true; // if this was called again, just so it doesn't get created once more. (It shouldn't)
    }
  }
}

Now upon loading the game with your mod in the enabled list, you'll load the custom menu you specified. TitleState will not be reached, and you will now be in charge of where the user goes.

cautionCaution

This article will be expanded upon when content gets released.


Contributors:
Kade-gtihub
Last modified:
Created:
Category:  Expert
Tags: