ZombiesLoveBrainiacs Posted November 11, 2019 Share Posted November 11, 2019 (edited) Choose your own % of Runners, Walkers, Shamblers - and Crawlers! You missed those, didn't you. By default, you should get ~5% Runners, 60% Walkers, ~33% Shamblers, and ~2% Crawlers. Only works if you choose "Random" for zombie speeds in Sandbox. Not sure if this is 100% reliable, but it seems to work so far. ZombieSpeeds = {} ZombieSpeeds.counter = 0 -- counter to delay execution, otherwise it doesn't seem to work ZombieSpeeds.randomizeSpeed = function(zombie) ZombieSpeeds.counter = ZombieSpeeds.counter + 1 if ZombieSpeeds.counter ~= 200 then return end ZombieSpeeds.counter = 0 local data = zombie:getModData(); if data.zombieType == nil then -- we didn't set a zombieType yet -- so lets set a zombieType local random = ZombRand(101) if random > 98 then zombie:toggleCrawling(); -- how to set, not toggle? data.zombieType = "crawler" -- elseif random > 97 then -- zombie:setForceFakeDead(true); -- not working? -- data.zombieType = "fakedead" elseif random > 95 then data.zombieType = "runner" elseif random > 60 then data.zombieType = "shambler" else data.zombieType = "walker" end -- now do something with the zombieTypes if data.zombieType == "runner" then zombie:changeSpeed(1); elseif data.zombieType == "walker" then zombie:changeSpeed(2); elseif data.zombieType == "shambler" then zombie:changeSpeed(3); end zombie:DoZombieStats() -- doesn't seem to work without applying the stats like this end end Events.OnZombieUpdate.Add(ZombieSpeeds.randomizeSpeed); RandomZombieSpeeds.zip Edited November 12, 2019 by ZombiesLoveBrainiacs Cory and Arsenal26 2 Link to comment Share on other sites More sharing options...
Arsenal26 Posted November 12, 2019 Share Posted November 12, 2019 I'm holding off on enabling Runners until I can um..... run, But this sounds like it will make zombies much more organic instead of having a horde of zombies going exactly the same speed... Link to comment Share on other sites More sharing options...
Planet Algol Posted January 2, 2020 Share Posted January 2, 2020 (edited) To enable fakedead zombies: zombie:setFakeDead(true) To make sure a zombie isn't a crawler before toggling crawler: if zombie:getSeppedMod() >= 0.55 then zombie:toggleCrawling() end Note that fakedead and crawlers zombies are persistent, so between moving between to cells, and loading saves, the population of them will accumulate. I find that I have to redo, and possibly reset the zombie speed when moving between cells. So I do this at then end of the equivalent function I use to do what you do: if data.SpecialZedType == "Shambler" then if ZombRand(999) == 0 zombie:changeSpeed(3) zombie:DoZombieStats() end end if data.SpecialZedType == "Runner" then if ZombRand(999) == 0 then zombie:changeSpeed(1); zombie:DoZombieStats() end end Edited January 15, 2020 by Planet Algol I was stoned when I first posted this and included extraneous code. ZombiesLoveBrainiacs 1 Link to comment Share on other sites More sharing options...
MultiNightsniper Posted January 14, 2020 Share Posted January 14, 2020 Could you add the possibility of changing the percentage of sprinters or is that already in the code and I'm just blind. If the latter could you reply to this with the specific lines of text that would need to be changed? Link to comment Share on other sites More sharing options...
Planet Algol Posted January 15, 2020 Share Posted January 15, 2020 elseif random > 95 then data.zombieType = "runner" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now