hey there, i am looking for a plugin that allow to remove/despawn all Animals in a define zone. Maybe with ZoneManager Zones....
I use NPC´s and a selfbuild market. And if a animal comes close to an NPC it fall through the floor and dont come back to his spawn
I tried "npcfreeze" flag in Zonemanager, but it dont work![]()
Rust Remove all animals in zone
Discussion in 'Plugin Requests' started by ScHigGn, Sep 8, 2016.
-
Maybe you should ask support from ZoneManager thread, Zones Manager | Oxide
But i can check if i can add plugin that add noAnimal option for you. -
Moderator edit: please do not link random files.
I added // ADDED BY EXEL80 comment when i added something
Code:[Flags] public enum ZoneFlags// : long { None = 0, AutoLights = 1, Eject = 1 << 1, PvpGod = 1 << 2, PveGod = 1 << 3, SleepGod = 1 << 4, UnDestr = 1 << 5, NoBuild = 1 << 6, NoTp = 1 << 7, NoChat = 1 << 8, NoGather = 1 << 9, NoPve = 1 << 10, NoWounded = 1 << 11, NoDecay = 1 << 12, NoDeploy = 1 << 13, NoKits = 1 << 14, NoBoxLoot = 1 << 15, NoPlayerLoot = 1 << 16, NoCorpse = 1 << 17, NoSuicide = 1 << 18, NoRemove = 1 << 19, NoBleed = 1 << 20, KillSleepers = 1 << 21, NpcFreeze = 1 << 22, NoDrown = 1 << 23, NoStability = 1 << 24, NoUpgrade = 1 << 25, EjectSleepers = 1 << 26, NoPickup = 1 << 27, NoCollect = 1 << 28, NoDrop = 1 << 29, NoAnimals = 1 << 30 // ADDED BY EXEL80 }
Code:private void OnNpcEnterZone(Zone zone, BaseNPC entity) { HashSet<Zone> zones; if (!npcZones.TryGetValue(entity, out zones)) npcZones[entity] = zones = new HashSet<Zone>(); if (!zones.Add(zone)) return; if (HasZoneFlag(zone, ZoneFlags.NpcFreeze)) npcNextTick.SetValue(entity, 999999999999f); if (HasZoneFlag(zone, ZoneFlags.NoAnimals)) // ADDED BY EXEL80 entity.Kill(); Puts("OnNpcEnterZone: {0}", entity.GetType()); }
Code:private void OnNpcExitZone(Zone zone, BaseNPC entity, bool all = false) { HashSet<Zone> zones; if (!npcZones.TryGetValue(entity, out zones)) return; if (!all) { if (!zones.Remove(zone)) return; if (zones.Count <= 0) npcZones.Remove(entity); } else { foreach (var zone1 in zones) { if (!HasZoneFlag(zone1, ZoneFlags.NpcFreeze)) continue; npcNextTick.SetValue(entity, Time.time); if (!HasZoneFlag(zone1, ZoneFlags.NoAnimals)) continue; // ADDED BY EXEL80 entity.Kill(); break; } npcZones.Remove(entity); } Puts("OnNpcExitZone: {0}", entity.GetType()); }
Last edited by a moderator: Sep 11, 2016 -
Thank you, plugin load. But i get these error...
but this error i get before also. Now i know why npcfreeze dont work.
maybe u know why i get this error ?
Code:[Oxide] 00:16 [Info] Loaded plugin ZoneManager v2.4.4 by Reneb / Nogrod [Oxide] 00:16 [Info] [ZoneManager] Loaded 12 Zone definitions ArgumentException: Field nextTick defined on type NPCAI is not a field on the target object which is of type BaseNPC. Parameter name: obj ArgumentException: Field nextTick defined on type NPCAI is not a field on the target object which is of type BaseNPC. Parameter name: obj [Oxide] 00:16 [Info] [ZoneManager] OnNpcEnterZone: BaseNPC [Oxide] 00:16 [Info] [ZoneManager] OnNpcEnterZone: BaseNPC
-
I didnt get that error when i tested it. Maybe you are typed some options wrong or your zone files are corrupted.
Try ask it from dev, Zones Manager | Oxide