gasileyes.blogg.se

Best slime rancher mods
Best slime rancher mods








best slime rancher mods
  1. #Best slime rancher mods mod
  2. #Best slime rancher mods update
  3. #Best slime rancher mods code

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

#Best slime rancher mods update

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.

#Best slime rancher mods code

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.

#Best slime rancher mods mod

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" Your config class should now look something like this: using System










Best slime rancher mods