w00kien00kie Posted August 2, 2022 Share Posted August 2, 2022 (edited) This is a new mod aimed at modders so they can easily add new Custom Game Options to their overhauls without having to write any C# code (well very little anyway). The game options are just added via a standard 7days XML patch file and then the variables can be used in any other Harmony patch (this is the only C# you need to do). All you need to do to use is download the Compiled mod, add your own <gameoptions .../> xml to the windows.xml and then use the variables anywhere in your Harmony patches. Compiled Modhttps://gitlab.com/wookienookie/customgameoptionsmod/-/archive/main/customgameoptionsmod-main.zip Source Code (if you want to poke around the actual code, this is not need to run the mod) https://gitlab.com/wookienookie/CustomGameOptions Example of Custom Options in game : I've included an example windows.xml config patch in /XUi_Menu/windows.xml NOTE : The 'name' parameter in the <gameoption> xml MUST start with the work 'Custom' otherwise the code will treat it as a normal vanilla gameoption and everything will error! (Highly advise to set a value for the new xml parameter default_value="" for each <gameoption> you add ) You will need to add Localization as well, ive included a Localisation.txt example but you dont have to use that location for your own text changes. Note : Localization in <GameOptions/> is a bit odd but not hard, ill write some notes up with examples later. There is also an example of how to use the variables within your Harmony patches (commented out by default) in the source code : I have tested this in SP, MP and on a dedicated server BUT this is still a new approach and i am expecting some issues. Please thoroughly test within your own mods/overhauls. Any problems let me know. This mod is just using standard C# code and supported Harmony patches (i.e. doesnt need BepInEx). Im sure ive forgotten to add all the notes i needed to so will update this first post as and when i remember what ive missed. Wookie Nookie Edited August 2, 2022 by w00kien00kie (see edit history) 2 Link to comment Share on other sites More sharing options...
Guppycur Posted August 2, 2022 Share Posted August 2, 2022 Ok so how would a non programmer like me use this. Let's say I want an option to make it rain all of the time. ...I get that your code does the UI stuff for me but I'd still have to write the bit that makes it rain, and reference your setting, right? So in a more realistic scenario, I could use this to turn mods on and off, right? If the latter is the case, can you write a sample code that does this, then we can just add the modfolder name to it or something? Link to comment Share on other sites More sharing options...
w00kien00kie Posted August 2, 2022 Author Share Posted August 2, 2022 As you said, this will need some code to actually use the variables, hence why it's more aimed at modders. Turning on and off mods is something I've thought about doing in the past, we may be able to use this approach to do this now. I'll have a think about it 1 Link to comment Share on other sites More sharing options...
ntaklive Posted August 3, 2022 Share Posted August 3, 2022 (edited) 21 hours ago, Guppycur said: Ok so how would a non programmer like me use this. Let's say I want an option to make it rain all of the time. ...I get that your code does the UI stuff for me but I'd still have to write the bit that makes it rain, and reference your setting, right? So in a more realistic scenario, I could use this to turn mods on and off, right? If the latter is the case, can you write a sample code that does this, then we can just add the modfolder name to it or something? 21 hours ago, w00kien00kie said: As you said, this will need some code to actually use the variables, hence why it's more aimed at modders. Turning on and off mods is something I've thought about doing in the past, we may be able to use this approach to do this now. I'll have a think about it A modlet, that can enable/disable other modlets and load modlets from your custom "mods" folders, already exists. Link Edited August 3, 2022 by ntaklive (see edit history) Link to comment Share on other sites More sharing options...
FuriousRamsay Posted January 17, 2023 Share Posted January 17, 2023 How would one control the options when setting up a dedicated server? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now