I can see so, but I was responding to another gentleman who posted some plugins that don't work the way this discussion op wants.HoverCatz
I posted code ^ up there, you don't see it? Is it hidden?
https://umod.org/community/rust/39153-reduce-sulfur-spawn-rates?page=1#post-9
Reduce sulfur spawn rates
- 1
- 2
HoverCatz
I just started a project to try and limit ore spawning (per ore). It can't increase spawns, just limit them (by canceling/removing ores as they spawn depending on your wanted spawn-percentage).
Merged postFirst attempt (pls don't kill me).
Save this code asΒ PrefabLimiter.csΒ and put it inΒ oxide/plugins asΒ oxide/plugins/PrefabLimiter.cs
You will find the spawn-chances inside the file oxide/data/PrefabLimiter.json
To lower the chance of Sulfur spawn, set the value for any or all [ores/sulfur-ore, ores_sand/sulfur-ore, ores_snow/sulfur-ore] to anything lower than 100 inside the config - then reload the plugin with /prefabLimiterReload.
π 100 means guaranteed spawn!
π€¬ 0 means they won't spawn.
π§ 1-99 is a chance in percentage.
The command prefabLimiterReload will reload your config so your changes takes effect.
If a prefab isn't in the config, then it will be treated with 100%.using Oxide.Core; using System.Collections.Generic; namespace Oxide.Plugins { [Info("PrefabLimiter", "HoverCatz", "1.0.0")] class PrefabLimiter : RustPlugin { Dictionary<string, int> spawnChances = new Dictionary<string, int>(); void OnServerInitialized() { /* Load config */ spawnChances = Interface.Oxide.DataFileSystem.ReadObject<Dictionary<string, int>>("PrefabLimiter") ?? spawnChances; if (spawnChances == null) spawnChances = new Dictionary<string, int>(); if (spawnChances.Count <= 0) AddDefaultConfig(); Interface.Oxide.DataFileSystem.WriteObject("PrefabLimiter", spawnChances); Puts($"PrefabLimiter successfully initialized. Loaded {spawnChances.Count} config values."); } private void AddDefaultConfig() { spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores/metal-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores/stone-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores/sulfur-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_sand/metal-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_sand/stone-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_sand/sulfur-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_snow/metal-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_snow/stone-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_snow/sulfur-ore.prefab", 100); // 100% chance to spawn // Add more prefabs here if you want // https://www.corrosionhour.com/rust-prefab-list/ } void Unload() { Interface.Oxide.DataFileSystem.WriteObject("PrefabLimiter", spawnChances); } [ConsoleCommand("prefabLimiterReload")] void ReloadConfig(ConsoleSystem.Arg _) { /* Reload config */ spawnChances = Interface.Oxide.DataFileSystem.ReadObject<Dictionary<string, int>>("PrefabLimiter") ?? spawnChances; if (spawnChances == null) spawnChances = new Dictionary<string, int>(); if (spawnChances.Count <= 0) AddDefaultConfig(); Interface.Oxide.DataFileSystem.WriteObject("PrefabLimiter", spawnChances); Puts($"PrefabLimiter successfully reloaded {spawnChances.Count} config values."); } void OnEntitySpawned(BaseNetworkable entity) { int intChance; string name = entity.name; if (!spawnChances.TryGetValue(name, out intChance)) return; // Doesn't exist in our list? 100% chance to spawn if (intChance == 100) return; // 100% chance, spawn. else if (intChance == 0) { entity.AdminKill(); // Destroy the Prefab! No chance check. return; } float fChance = intChance / 100f; float rnd = UnityEngine.Random.value; if (rnd > fChance) entity.AdminKill(); // Destroy the Prefab! } } }
Thanks for making this wonderful plugin. Does your plugin have a name?Β
Does it exist in the category PLUGINS -> RUST ? I'd like to find him there.
jure12Thanks for making this wonderful plugin. Does your plugin have a name?Β
Does it exist in the category PLUGINS -> RUST ? I'd like to find him there.
I tried it. Looks like it doesn't works. I set 0% chance for sulfur and it's still spawns.HoverCatz
I just started a project to try and limit ore spawning (per ore). It can't increase spawns, just limit them (by canceling/removing ores as they spawn depending on your wanted spawn-percentage).
Merged postFirst attempt (pls don't kill me).
Save this code asΒ PrefabLimiter.csΒ and put it inΒ oxide/plugins asΒ oxide/plugins/PrefabLimiter.cs
You will find the spawn-chances inside the file oxide/data/PrefabLimiter.json
To lower the chance of Sulfur spawn, set the value for any or all [ores/sulfur-ore, ores_sand/sulfur-ore, ores_snow/sulfur-ore] to anything lower than 100 inside the config - then reload the plugin with /prefabLimiterReload.
π 100 means guaranteed spawn!
π€¬ 0 means they won't spawn.
π§ 1-99 is a chance in percentage.
The command prefabLimiterReload will reload your config so your changes takes effect.
If a prefab isn't in the config, then it will be treated with 100%.using Oxide.Core; using System.Collections.Generic; namespace Oxide.Plugins { [Info("PrefabLimiter", "HoverCatz", "1.0.0")] class PrefabLimiter : RustPlugin { Dictionary<string, int> spawnChances = new Dictionary<string, int>(); void OnServerInitialized() { /* Load config */ spawnChances = Interface.Oxide.DataFileSystem.ReadObject<Dictionary<string, int>>("PrefabLimiter") ?? spawnChances; if (spawnChances == null) spawnChances = new Dictionary<string, int>(); if (spawnChances.Count <= 0) AddDefaultConfig(); Interface.Oxide.DataFileSystem.WriteObject("PrefabLimiter", spawnChances); Puts($"PrefabLimiter successfully initialized. Loaded {spawnChances.Count} config values."); } private void AddDefaultConfig() { spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores/metal-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores/stone-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores/sulfur-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_sand/metal-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_sand/stone-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_sand/sulfur-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_snow/metal-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_snow/stone-ore.prefab", 100); // 100% chance to spawn spawnChances.Add("assets/bundled/prefabs/autospawn/resource/ores_snow/sulfur-ore.prefab", 100); // 100% chance to spawn // Add more prefabs here if you want // https://www.corrosionhour.com/rust-prefab-list/ } void Unload() { Interface.Oxide.DataFileSystem.WriteObject("PrefabLimiter", spawnChances); } [ConsoleCommand("prefabLimiterReload")] void ReloadConfig(ConsoleSystem.Arg _) { /* Reload config */ spawnChances = Interface.Oxide.DataFileSystem.ReadObject<Dictionary<string, int>>("PrefabLimiter") ?? spawnChances; if (spawnChances == null) spawnChances = new Dictionary<string, int>(); if (spawnChances.Count <= 0) AddDefaultConfig(); Interface.Oxide.DataFileSystem.WriteObject("PrefabLimiter", spawnChances); Puts($"PrefabLimiter successfully reloaded {spawnChances.Count} config values."); } void OnEntitySpawned(BaseNetworkable entity) { int intChance; string name = entity.name; if (!spawnChances.TryGetValue(name, out intChance)) return; // Doesn't exist in our list? 100% chance to spawn if (intChance == 100) return; // 100% chance, spawn. else if (intChance == 0) { entity.AdminKill(); // Destroy the Prefab! No chance check. return; } float fChance = intChance / 100f; float rnd = UnityEngine.Random.value; if (rnd > fChance) entity.AdminKill(); // Destroy the Prefab! } }
- 1
- 2