Jump to content

No zombie spawn in the vincinity of the player


houndfoxie25

Recommended Posts

Hello !

 

I'm currently trying to integrate custom spawnpoints to my mod (that originally only contained a replacement for prisoner coveralls).

So far, I managed to create a custom spawnpoint (in a random prison cell of the Rosewood penitenciary), modify the player's starting gear and erase from distribution prisoner coveralls to replace them by my new convict clothes ^^

 

However, every time my player spawns in the prison, the closest zombies spawn outside. maybe sometimes one or two inside but really nothing else... It makes it uninteresting since you have the whole penitenciary for yourself...

The strangest thing is that if I spawn somewhere else and then teleport the player inside the prison, it's well populated and makes for a great challenge ! But not when the player spawns IN the prison, I have no idea why since other mods making the player spawn in the prison aren't affected by that problem. So I've tried to manually spawn zombies, taking inspiration from pillow's mod, but without succes :


Prison_Cell_Spawn.SpawnZombiesInCells = function()
    print("Run spawn zombies in cells.");

    --algorithm to spawn zombies
    --south bblock east side 7682 x 11943 to 7682 x 11908, south block west side 7696 x 11943 to 7696 x 11908
    --north block east side is 7682 x 11854 to 768x x 11819, north block west side 7696 x 11855 to 7696 x 11819
    -- new prison cell is every 3 squares
    --104 total cells

    local xposeast = 7682;
    local xposwest  = 7696;
    local zpos = 0;
    local ypos = 0;
    local yposnorth = 11855;
    local yposnorthmin = 11817;
    local ypossouthmin = 11907;
    local ypossouth = 11943;
    local sq = getCell():getGridSquare(7683,11943,0);
    ZombieSpawn = getPlayer():getModData();
    --createHordeFromTo(7714,11851,7714,11851,1);


    -- do south side
    while ypossouth >= ypossouthmin do
        --do south side, east
        if ZombRand(ZombieSpawn.spawnincellchance)+1 == 1
         then
                print("spawn 1 at :" .. xposeast .. " x " .. ypossouth .. " x " .. zpos);
                addZombiesInOutfit(xposeast,ypossouth, 0, 1, Inmate, 0);
                addZombiesInOutfit(xposeast,ypossouth, 1, 1, Inmate, 0);
        end
        --do south side, west
        if ZombRand(ZombieSpawn.spawnincellchance)+1 == 1
         then
                print("spawn 1 at :" .. xposeast .. " x " .. ypossouth .. " x " .. zpos);
                addZombiesInOutfit(xposwest,ypossouth, 0, 1, Inmate, 0);
                addZombiesInOutfit(xposwest,ypossouth, 1, 1, Inmate, 0);
        end
        ypossouth = ypossouth-1;
    end --end south side


-- do north side
    while yposnorth >= yposnorthmin do
        --do north side, east
        if ZombRand(ZombieSpawn.spawnincellchance)+1 == 1  
         then
                print("spawn 1 at :" .. xposeast .. " x " .. yposnorth .. " x " .. zpos);
                addZombiesInOutfit(xposeast,yposnorth, 0, 1, Inmate, 0);
                addZombiesInOutfit(xposeast,yposnorth, 1, 1, Inmate, 0);
        end
        --do north side, west
        if ZombRand(ZombieSpawn.spawnincellchance)+1 == 1
         then
                print("spawn 1 at :" .. xposeast .. " x " .. yposnorth .. " x " .. zpos);
                addZombiesInOutfit(xposwest,yposnorth, 0, 1, Inmate, 0);
                addZombiesInOutfit(xposwest,yposnorth, 1, 1, Inmate, 0);
        end
        yposnorth = yposnorth-1;
    end --end north side

end --end spawn zombies in cell function

The function above is supposed to be called on a new player creation, but it never happens. I see three solutions to my problem :

1. Spawn the player at a random location and teleport him/her instantly in the prison when the game starts.

2. Manage to force the spawn of zombies (what I've tried, without success).

3. Resolve the problem that makes it so no zombies spawn when selecting my mod.

 

But in all three cases, I've reached the end of my rope and I dunno how to do :( Any help is welcome, ofc if you have remarks on my code I'm open to suggestions !! ^^ (the file is included)

Thank you very much all ! :D

Prison_Cell_Spawn.lua

Link to comment
Share on other sites

Hey all !

 

Just to inform you, I found a workaround, quite imperfect. But it seems the absence of Z when spawning is due to the game not spawning Z's in the starting building. And since the ENTIRE prison is considered the same building well... It's a bit of a shame...

So my workaround would be to spawn the player in the prisoner yard. Could work, but it's still a far cry from what I wanted :( Can anyone tell me how to include a command to directly teleport the player at coordinates upon start please ? (and not spawn, the objective being that the player would spawn somewhere allowing Z to spawn in prison, then be teleported, all right at the start of the game).

 

Thanks by advance ! :D

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