Dynamic Mod Menu (3.0.*)
Dynamic Mod Menu (3.0.*)
Ever felt like your edicts list becomes cluttered by edicts whose sole purpose is to open the settings of a mod? Here is a lightweight weight and performance-friendly mod that can solve that issue!
For players
This mod adds a button on the main menu (opened up by pressing escape) that opens the Mod Menu. You can then select the mod you want to access the settings of. Simple right?
The mods simply have to register themselves. If you don’t see the mod you’re looking for, you can kindly ask its modder to come see this mod description, so they can see if they want to make their mod register itself.
Place this mod below SWFR and any other mod altering interface/mainmenu_view.gui.
This mod changes checksum and has nearly no compatibility issues.
This mod alters interface/mainmenu_view.gui.
If you don’t see the button on the “escape menu”, another mod is altering that file. To solve it, you can simply place DMM below it (or at the bottom of the load order).
This mod is save game compatible.
Mods supporting DMM
This is a non-exhaustive list, if you know of other mods supporting DMM, feel free to comment 😉
- by FirePrince
- by OldEnt, Rodahtnov and Fiiral
- by mario0244
- by James Fire
- by TheFlyingPotato
- by FirePrince and others
- by mr_trousers and TheFlyingPotato
- by BurningRaptor
- by SableDrake
- by mario0244
- by Malthus and many others
- by Seamoo
- by jasonpepe
- by James Fire
- by OldEnt
- by SableDrake
For modders
Welcome! The configuration is really straightforward, don’t be afraid 😉
DMM works in 2 part:
- Your mod needs to register itself (give a unique flag and the text that should displayed on the button)
- You need to add a country_event and subscribe it to an on_action
OldEnt made an if you want to see what it looks like.
Registering the mod
At game start and on save game load (use on_actions), execute this effect:
dmm_register_mod = { DMM_NAME = my_amazing_mod.22 DMM_FLAG = my_amazing_mod_unique_flag }
Replace “my_amazing_mod.22” by what you want displayed on the button. I highly recommend using a localisation key.
Replace “my_amazing_mod_unique_flag” by something that is unique to your mod. I highly recommend using at least the full name of the mod (“origin_mod” is not enough!).
DO NOT put any spaces. You’ve been warned! If you want spaces in the text displayed on the button, you have to use a localisation key.
Adding the event and the on_action
Simply add this event (as usual don’t forget the namespace):
country_event = { id = my_amazing_namespace.111 is_triggered_only = yes hide_window = yes trigger = { from = { has_leader_flag = my_amazing_mod_unique_flag } } immediate = { # open my settings menu } }
Of course reuse the same flag name you set before. In the immediate, you can for example fire the event that opens up your settings menu.
And subscribe the previous event to this on_action:
dmm_mod_selected = { events = { my_amazing_namespace.111 } }
And that’s it! Yes! 22 lines of code only! Now you don’t need an edict anymore!
If you don’t want to add a hard dependency on DMM (ie you don’t want to set it as required), but only want to add a soft dependency, you can add an edict (that fires your settings menu) that is only visible if DMM is not installed.
To do that, put in the potential clause :
NOT = { has_global_flag = dmm_installed }
Here’s a bunch of utility stuff:
If for you want to unregister your mod (for example before the player uninstall it), simply use dmm_deregister_mod = { DMM_FLAG = my_amazing_mod_unique_flag }.
You can check if your mod is registered using dmm_is_registered_mod = { DMM_FLAG = my_amazing_mod_unique_flag }.
Hide the button
If you want to hide the button for some reason (crisis happened so remove crisis spawn), you can use
dmm_hide_button_all = { DMM_FLAG = my_amazing_mod_unique_flag }
To show it, use
dmm_show_button_all = { DMM_FLAG = my_amazing_mod_unique_flag }
If you want to inverse the show/hide for a specific country, then scope to that country and use
dmm_add_button_exception = { DMM_FLAG = my_amazing_mod_unique_flag }
To remove it, simply use
dmm_remove_button_exception = { DMM_FLAG = my_amazing_mod_unique_flag }
If you hide it to all and have an exception on a country (the host of the game for example), then only that country will see the button. Remember that AIs can’t access DMM anyway.
Template for settings menu
You probably know it, GUI modding in Stellaris is quite hard and annoying. But having a good looking event is really nice. So I created a template you can freely use and change!
Checkout for more info on it!
Credits
Thanks to Mario for allowing me to use this mod name.
Thanks to OldEnt for making an example template.
Thanks to The Stellaris Modding Den and mr_trousers.
Legal Stuff
Do not copy any content from this mod without permission. This includes modpacking of course (instead do a steam collection and let your user merge locally).
You have my permission to use the template (event and gui code). Make sure to rename the elements if you change them. Please credit 😉