![]() _instance.maxHealth = MyFirstSRModConfig. _instance.maxHealth = MyFirstSRModConfig.MaxHealth3 _instance.maxHealth = MyFirstSRModConfig.MaxHealth2 _instance.maxHealth = MyFirstSRModConfig.MaxHealth1 ![]() Public static void Postfix(PlayerModel _instance, ref PlayerState.Upgrade upgrade) Your Patch_MaxHealth.cs should now look something like this: using UnityEngine MaxHealth4 = cfg.Read("MaxHealth4", new UMFConfigInt(999, 1, 9999), "The player's max health with the fourth health upgrade") MaxHealth3 = cfg.Read("MaxHealth3", new UMFConfigInt(999, 1, 9999), "The player's max health with the third health upgrade") ![]() MaxHealth2 = cfg.Read("MaxHealth2", new UMFConfigInt(999, 1, 9999), "The player's max health with the second health upgrade") MaxHealth1 = cfg.Read("MaxHealth1", new UMFConfigInt(999, 1, 9999), "The player's max health with the first health upgrade") MaxHealth0 = cfg.Read("MaxHealth0", new UMFConfigInt(999, 1, 9999), "The player's max health without any health upgrades.") MaxHealth = cfg.Read("MaxHealth", new UMFConfigInt(999, 1, 9999), "This is the player's max health.") Private static readonly string configVersion = "1.1" UMFPatch.ApplyPatch("MaxHealthPatch", UMFPatchMaxHealth) Your MyFirstSRModConfig.cs should now look something like this: using System PlayerModel.maxHealth = MyFirstSRModConfig.MaxHealth //Set the max health to our config value. If (playerModel != null) //Make sure that the PlayerModel has been retrieved. If (!Levels.isSpecial() & SRSingleton.Instance?.GameModel != null) //Makes sure we are in game and that the GameModel exists. If (!timeDirector.HasPauser()) timeDirector.Pause() Log("MyFirstSRMod v" + UMFMod.GetModVersion().ToString(), true) Using (UMFLog log = new UMFLog()) log.Log(text, clean) ![]() Internal static void Log(string text, bool clean = false) //Set this to the number of harmony patches in your mod. Your MyFirstSRMod.cs should now look something like this: using UnityEngine So to ensure the maxHealth is always set after those we can apply it using Unity Scripting's Update function, which require some extra checks to ensure we are in the game. However we have to set this in a way that it is done after ApplyUpgrade and Reset which is why the other methods are normally better for this case. This would set maxHealth to whatever the config value is set to, in the default case 999. ().maxHealth = MyFirstSRModConfig.MaxHealth We can set this value directly using the following line: In Slime Rancher the PlayerModel class instance can be accessed through the GameModel instance class which in turn can be retrieved from the SceneContext using the SRSingleton class. You can find this method by looking through the game code which will take some experience and analyzing.įor this particular scenario this method is not the best to use. This method uses only Unity Scripting and the game's own code to modify the max health value. MyFirstSRMod.Log("Error loading mod settings: " + e.Message + "(" + e.InnerException?.Message + ")") MyFirstSRMod.Log("Finished loading settings.") MaxHealth = cfg.Read("MaxHealth", new UMFConfigInt(999, 1, 9999), "This is the player's max health.") MyFirstSRMod.Log("Finished UMF Settings.") cfg.Write("MaxVersion", new UMFConfigString("9.99999")) //Uncomment if you think your mod may break with the next major UMF release.Ĭfg.Write("UpdateURL", new UMFConfigString("")) Ĭfg.Write("ConfigVersion", new UMFConfigString(configVersion)) cfg.Write("SupportsHotLoading", new UMFConfigBool(false)) //Uncomment if your mod can't be loaded once the game has started.Ĭfg.Read("LoadPriority", new UMFConfigString("Normal")) Ĭfg.Write("MinVersion", new UMFConfigString("0.52.1")) MyFirstSRMod.Log("The config file was outdated and has been deleted. If (cfgVer != string.Empty & cfgVer != configVersion) String cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()) Private static readonly string configVersion = "1.0" There are 2 unique graphics in the mod, 1 for the Party Crate and 1 for every other crate.Your config class should now look something like this: using System Vaccable Crates is the simples mod out of the 3, allowing you to vac up crates. Lucky Plorts adds a feature where if a Lucky Slime eats a Stony Hen, the Lucky Slime will not get launched up into the air, and will make 2 Lucky Plorts. Shadow Slimes are a red-black vertical gradient, but watch out, because they hurt on touch, and they can grow up to 3x their size upon being agitated! Shadow Slimes eat hens, and have no favorite food. The Shadow Slime is formed by leaving a Phosphor Rad Largo out in the sunlight, or, leaving a Phosphor Rad Largo to bake in the sun, which ever one you like to use. Type 'help srcm' in the UMF Console for a list of console commands added by this mod. Shadow Slimes adds a new slime type the Shadow Slime. Usage Instructions: Press B (by default) to open the Cheat Menu while in-game. This section will go over all 3 of these mods. All 3 of these mods were published recently (as of 12/31/20).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |