-
Notifications
You must be signed in to change notification settings - Fork 6
ZenZombieController
NOTE: This mod is included in my modpack and can be enabled/disabled via ZenZombieController in ZenModPackConfig.json
This mod allows scripted control over zombie movements.
Its main purpose is to prevent script-spawned zombies from wandering off on adventures.
For example, when an airdrop or SurvivorMission or DynamicHelicopterCrash mod spawns zombies into the game, they have no boundary limit, so if a player is patient (or the zombies are spawned before a player even comes close) then the zombies can wander off over time sometimes hundreds of meters away, leaving the target location unbothered by zeds so the player can loot the airdrop/mission/heli/etc without a challenge.
This mod forces any zombie which is NOT spawned by the Central Loot Economy (ie. vanilla XML files) to have a 20 meter radius where they will return "home" to their spawn point if they wander beyond this distance.
You can adjust this in the config, example provided below.
You can also use script code to tell zombies where to go. I haven't done much testing with this feature, but in theory you should be able to make zombies walk wherever you want them to go (assuming the path is not particularly challenging - I have not got advanced pathfinding code like the InediaAI mod does for example - my pathfinding is very simple and designed for zombies spawned in open areas).
Here is an example of how to tell a zombie to walk to a location (ideally this location should be reasonably close by to where the zombie currently is, like within 100 meters):
void ZenStartMoveToTarget(vector pos, float minDist = 1, bool overridePreviousCommand = false) {}
ZombieBase zed = SomeKindOfZombie();
zed.ZenStartMoveToTarget("123 0 123"); // Will walk to within 1 meter of 123,0,123 (surface Y automatically calculated)
Enabling the parameter overridePreviousCommand=true will force the zombie to cancel any currently active animation (ie. attacking, jumping etc) - not recommended, leave it off in most cases.
The parameter minDist is the minimum distance to the target before the zombie is no longer controlled by this movement code and allowed to return to its vanilla behaviour. If not specified then the zombie needs to be within 1 meter of the given position before it's given back to vanilla control.
You can also override its default wander range if you need to:
void SetZenZombieWanderRange(float radius = 0, vector homePos = vector.Zero, float minimumReturnDistance = 0) {}
// radius = Distance from "homePos" it's allowed to wander (0 = use JSON config MaxWanderRange)
// homePos = The vector location it considers its base/home return point (vector.Zero = use current position)
// minimumReturnDistance = vector.Distance(homePos, GetPosition()) < this value before it's considered within range of "home"
Config file: profiles/Zenarchist/ZenZombieController.json
{
"ConfigVersion": "1.29.1", // Don't touch
"EnableScriptedZombieWanderLimit": 1, // Forces zombies spawned via scripts (eg. airdrops) to stay in MaxWanderRange perimeter
"CheckTimerSeconds": 10, // Check zombie distance every X seconds
"MaxWanderRange": 20.0, // If zombie exceeds this distance from its spawn point, return home kicks in
"MinimumReturnDistance": 0.3, // Minimum PERCENTAGE distance to home X wander range (ie. 0.3 x 20 = return within 6 meters of spawn point)
"DisableControllerAfterAggro": 1, // Once a zombie is aggro'ed by a player, disable this controller forever and allow vanilla to take over
"MinutesToWaypointTimeout": 5, // If zombie cannot get to the next waypoint within 5 minutes, give up entirely and let vanilla take over
"TeleportIfNoPlayersNearby": 1 // If no player is within 500 meters, just teleport the zombie back to its spawn point instead of walking
"ForceZombiesWalkAtNight": 0, // If enabled (1), this forces zombies to WALK at night time (to encourage night time looting)
"DayStartHour": -1, // Override for daytime start hour (optional, -1 = use vanilla game check)
"NightStartHour": -1 // Override for night start hour (optional, -1 = use vanilla game check)
}All my mods are open-source and published under the Mozilla Public License Version 2.0. Any mods based on my code must be open-source - no obfuscation!
You can modify/reupload/repack my mods if you like, but please credit any original authors/3D model/3rd-party asset creators, and keep in mind any future updates I make will not be automatically applied to repacked mods so make sure to check back from time to time for bugfixes and improvements.
If you find my mods useful, please consider buying me a coffee - it's not expected but very much appreciated: https://buymeacoffee.com/zenarchist
- General Setup Guide
- Core Mod Setup Guide
- ZenModPack Master Config
- Various Info
- Known Bugs & Issues
- Report Bug
My utility style mods for debugging etc.
Mods which affect game mechanics:
- ZenAlcohol
- ZenAllowMapBagSlot
- ZenAntiCombatLogout
- ZenAutoConvertStash
- ZenAutoStackItems
- ZenAutoWinterDetect
- ZenAutoRun
- ZenBasebuildingConfig
- ZenBatteryPASPersistence
- ZenBetterChatFont
- ZenBrokenGlasses
- ZenBuildingDescription
- ZenCarAttachments
- ZenCarBatteryIcon
- ZenCarCompass
- ZenCarGlovebox
- ZenCarsCutDownTrees
- ZenCanteenTablets
- ZenCatchRain
- ZenCauseOfDeath
- ZenChickenCoops
- ZenCraftingSounds
- ZenCraftRagHands
- ZenComboLocks
- ZenCombineJSON
- ZenDropRuinedClothing
- ZenDynamicZoneLoot
- ZenEarPlugs
- ZenFireFuel
- ZenFireWood
- ZenFireplaceStick
- ZenFishingConfig
- ZenFixCarAttachmentGUI
- ZenGraves
- ZenGroundCleaning
- ZenHideGearInCars
- ZenHints
- ZenHologram
- ZenHologramControls
- ZenImmersiveChatHUD
- ZenImmersiveLogin
- ZenInformWeaponStateBug
- ZenInventoryAnimation
- ZenKnifeGardens
- ZenLeftovers
- ZenLogPiles
- ZenMagObfuscation
- ZenMap
- ZenMicCheck
- ZenNotifications
- ZenOpenCansRock
- ZenPainting
- ZenPimpMyRide
- ZenRadioPlugin
- ZenRebuildableWells
- ZenRepairJSON
- ZenRepairPumps
- ZenRepairWells
- ZenServerGUI
- ZenShove
- ZenSplitUI
- ZenSleep
- ZenStaminaSlope
- ZenTerritories
- ZenWeaponEngrave
- ZenWoodHealth
- ZenZombieDoors
Mods which add gear to the game:
- ZenArtillery
- ZenBackwardsCaps
- ZenBookshelf
- ZenBunnyMasks
- ZenCamoCamp
- ZenCarWorkbench
- ZenChess
- ZenChristmasTreeCraft
- ZenConcussionGrenade
- ZenDoubleArmbands
- ZenFlask
- ZenFlint
- ZenGhillie
- ZenJameson
- ZenLadders
- ZenMusic
- ZenNotes
- ZenRaidAlarm
- ZenRaybans
- ZenRunes
- ZenStaticObjects
- ZenSwissKnife
- ZenTimeBomb
- ZenTireRack
- ZenTreasure
- ZenTreehouse
- ZenVikingAxe
- ZenZippoLighter
Mods which run purely server-side:
- ZenBloodDrips
- ZenCampSites
- ZenDynamicZoneLoot
- ZenLootCyclingDetection
- ZenNightConfig
- ZenPersistentTrees
- ZenShelterCargo
- ZenTreesplosions
- ZenZombieController
- ZenZombieConfig
- ZenJameson
My standalone mods