Jump to content
Sign in to follow this  
tormentedmage

Automatically kill some zombies

Recommended Posts

I was impressed by a mod called Undying Zombies which automatically reanimates some corpses.

https://steamcommunity.com/sharedfiles/filedetails/?id=1101500811
The mod is incredibly simple but works pretty well,so I tried making an opposite mod which automatically kills some zombies.  
I downloaded some similar mods and learned from them a lot but my mods didn't work at all.
I would appreciate it if you would give me some advice or simple examples.

Share this post


Link to post
Share on other sites
--Kill all zombies around the current player
function kill_all(range)
	range = range or 15
	range = range*range
	local p = getPlayer()
	local zlist = p:getCell():getZombieList()
	local playerX,playerY,playerZ = p:getX(),p:getY(),p:getZ();
	local cnt1 = zlist:size()-1;
	for i=0,cnt1 do
		local zombie = zlist:get(i);
		local diffX,diffY = playerX - zombie:getX(),playerY - zombie:getY();
		local distsq = diffX*diffX + diffY*diffY;
		if distsq <= range then
			zombie:Kill(p)
		end
	end
end

 

Share this post


Link to post
Share on other sites

Thank you for the reply.

Is it possible to automatically kill or reduce10% of zombies anywhere on the map everyday?

I always get bored after I build decent bases because zombies are not respawned unless I kill them.

If a mod automatically reduce a total amount of zombies,new zombies will regularly appear near my houses and I'll enjoy fighting against them.

The problem will be solved if zombies migrate more but unfortunately they don't.

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