Jump to content
Sign in to follow this  
ZombiesLoveBrainiacs

Customizable random zombie speeds

Recommended Posts

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 by ZombiesLoveBrainiacs

Share this post


Link to post
Share on other sites

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... 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...