Jump to content

Automatically kill some zombies


tormentedmage

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.

Link to comment
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

 

Link to comment
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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...