Jump to content

Spawning Dead Bodies


Pat_Bren

Recommended Posts

Hello all,

I'm doing a mod set in a different world to Project Zomboid, one without zombies, but where basically a long time before the game most people died instantly. As such, the world is filled with lots of smelly old bodies. What I would like to know is if it's possible to spawn zombies that are pre-dead in such a way that they are in the same places/numbers as "living" zombies would be, ie. spawned using the black and white BMP file in WorldEd? I know there's a "spawn dead zombie" function somewhere, but I want the world to be filled with thousands of dead bodies and I can't work out all the co-ordinates for them obviously, and I want the bodies to be similarly laid out as the zombies, ie. much more in towns and none in the countryside.

Link to comment
Share on other sites

I was going to mention the "spawn dead zombie" command but then you mentioned it. My only suggestion would be to use loops on the creation of the world (I guess the OnInitWorld event does this?) to spawn all of the bodies and to overwrite the function that spawns zombies. You could loop through all of the cells and spawn the approximate number of zombies in each cell based on the relative coordinates.

 

The real question is how proficient at coding you are, as this could be a mighty undertaking and I'm not going to write this for you, if I even could.

Link to comment
Share on other sites

Well, it depends. If I could see the code that spawns the zombies, I'm sure I could just change a little thing or two and make it work by overwriting the original. Would that be possible, or is it all Java that's far, far away and locked off?

Link to comment
Share on other sites

It should be possible through lua, but it won't be trivial - especially since you want to spawn the corpses throughout the world, which probably means that you'll have to access cells that are there only "virtually".

 

It might be worth looking into turbotutone's erosion mod for the spawning of things.

 

Also take a look at the java source code for this:

http://theindiestone.com/zomboidjavadocs/zombie/VirtualZombieManager.html#addDeadZombiesToMap%28int,%20zombie.iso.RoomDef%29

Link to comment
Share on other sites

Hey guys, I THINK I got it working, though I'm not sure how efficient it is (probably not at all) and there's still one little problem I want to get rid of. Anyway, here's what I did: Add "Events.OnZombieUpdate.Add(spawnBody);" so that when a zombie is updated, it immediately kills it.

 

My spawnBody method:

 

local function spawnBody(zombie)
    if zombie:getHealth() > 0 then
        zombie:Kill(zombie);
    end
end

 

Seems easy enough. As I said, I doubt it's efficient, and also there may be problems if you move into another chunk, I haven't checked. Just one small related problem: when I use that, the dead zombies get blood pools under them. Seeing as my thing is set a long time after the bodies died, the blood would be all gone, so is there any easy way to get rid of the blood pools under dead zombies?

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