Zombies API
bs_zombies is big, but what other resources need is a short list. Everything is on the bs_zombies API page with file and line.
Is this ped a zombie?
Section titled “Is this ped a zombie?”Client:
if exports.bs_zombies:IsWalkerPed(ped) then local id = exports.bs_zombies:WalkerIdOf(ped) -- registry id, nil if not a walkerendlocal crawler = exports.bs_zombies:IsCrawlerPed(ped)IsWalkerPed/WalkerIdOf also answer from the bsZombie statebag for a networked ped this client hasn’t adopted yet. Use them, don’t check models, the model can be the vanilla one.
Other client helpers: Live() (adopted walkers table), Count(), HostedCount(), HasWalker(id), IsBeingAttacked(), HordeActive(), PlayerProtectedInVehicle().
Hurting zombies from your code
Section titled “Hurting zombies from your code”The server registry owns health. Client damage is reported by the shooter, but for something you own on the server (a turret, a trap) go through:
-- serverexports.bs_zombies:GadgetHit(src, walkerId, damage, x, y, range, weapon)It checks the walker is within range of x, y. bs_gadgets’ turret uses it, check bs_gadgets/server for the flow (client finds target, server checks fire rate and ammo, then GadgetHit).
Pull walkers to a point:
-- serverexports.bs_zombies:EventNoise(x, y, z, loud)The decoy gadget calls it every pulse.
Event spawns
Section titled “Event spawns”For scripted things (bs_events horde waves use these):
-- serverexports.bs_zombies:EventSpawn(x, y, 'walker', { tag = 'myres:wave1', hpScale = 1.0 })exports.bs_zombies:EventDrive('myres:wave1', x, y, z, seconds) -- push tagged walkers towards a pointlocal n = exports.bs_zombies:EventCount('myres:wave1')exports.bs_zombies:EventClear('myres:wave1', keepAsNormal)Tagged walkers skip the far-cull while tagged. They still count against the pool caps, you can’t spawn past Streaming.PoolGuard.maxNetworked. And the spawn floor (100 m from every player) still applies.
World info
Section titled “World info”-- serverexports.bs_zombies:SafeZones() -- zone listexports.bs_zombies:SafeZonesPadded()exports.bs_zombies:Total() -- registry countexports.bs_zombies:Heat(zoneId)exports.bs_zombies:Snapshot()Statebags
Section titled “Statebags”| Bag | On | |
|---|---|---|
bsZombie | ped | registry id. If it’s there, it’s ours |
zType, zGait, zCrawl, zFeed, zReach, zState, zMhp, zGround, zApp | ped | networked mode state |
bsZombieDead | ped | networked corpse |
Never delete a networked walker yourself. The server tracks unexpected deletes, re-creates the walker if a player is near, and flags the owner in bs_guard (zombie_entity_deleted). If you need them gone, use the event tag + EventClear, or ask the registry.
bs_world’s population sweep already skips anything with bsZombie. If your resource also cleans peds, check IsWalkerPed first.
GlobalState.bsZombieMode is 'networked' or 'legacy'. Most exports work the same in both.
bs19.org · Privacy · Terms · Cookie settings