Jump to content

getVirtualZombie() is no longer a thing in B32, how do I spawn a zombie now?


ethanwdp

Recommended Posts

I've combed over the LuaManager class to make sure it was still a thing, and it wasn't there. Seeing as that's pretty much the only way I can spawn a zombie, what am I supposed to do?

Something like

 

ISUICheatMenu.SpawnZombieNow = function()
    if ISUICheatMenu.ZombieBrushEnabled == true then
        local mx = getMouseX();
        local my = getMouseY();
        local player = getPlayer();
        local wz = player:getZ();
        local wx, wy = ISCoordConversion.ToWorld(mx, my, wz);

    
        for i = 1,ISUICheatMenu.ZombiesToSpawn do
            getVirtualZombieManager():createRealZombieNow(wx,wy,wz);
        end
    end
end

 

no longer works.

 

Edit: I compared the LuaManager of Build 31 to that of Build 32, and it turns out that the Build 32 LuaManager exposes a lot. After doing a bit of Google, I can apparently access the properties in exposed classes, but I don't know how.

Link to comment
Share on other sites

The same for me, but have a look on the challenges.

There are zombies spawned, with another command (which I didn't know before).

 

Edit: createZombie();

I've tried that before, and it didn't work. I'll have another shot at it.

Link to comment
Share on other sites

I have not checked it out myself for my mod and build32.

But i will have a look on it the next days.

 

It is working in the challenge, so it should work also in our mods.

I looked in the challenge, and it's using create horde. I did a bit more poking around in the class files, and it turns out that the new ZombiePopulationManager took the reigns of VirtualZombieManager. Guess I'll try that next.

Link to comment
Share on other sites

Sorry i was wrong, i found it in the steps.lua:

function FightStep:OpenWindow()    if FightStep.window:IsOpen() then       FightStep.zombie = createZombie(FightStep.zombieSpawnX, FightStep.zombieSpawnY, 0, nil, 0,IsoDirections.E);       while not FightStep.zombie:getDescriptor():isFemale() do           FightStep.zombie:removeFromWorld();           FightStep.zombie:removeFromSquare();           FightStep.zombie = createZombie(FightStep.zombieSpawnX, FightStep.zombieSpawnY, 0, nil, 0,IsoDirections.E);       end       FightStep.zombie:setUseless(true);       return true;    end    return false;end

So it seems to be

createZombie(x, y, z, nil, 0, ViewDirection);

 

But what is the nil and the zero?

I think we have to test it out.

 

Or can any dev/modder explain a bit?

Link to comment
Share on other sites

Okay, checked the class-files and found the interesting line:

 

public static IsoZombie createZombie(float x, float y, float z, SurvivorDesc desc, int palette, IsoDirections dir)

 

 

Tried it and it works.

I can now again spawn Zombies on single tiles on our server.

Link to comment
Share on other sites

Okay, checked the class-files and found the interesting line:

 

public static IsoZombie createZombie(float x, float y, float z, SurvivorDesc desc, int palette, IsoDirections dir)

 

 

Tried it and it works.

I can now again spawn Zombies on single tiles on our server.

Sorry for the late reply, was a bit busy.

I figured it out, spawnHorde(x,y,x2,y2,z, numberToSpawn) works perfectly . Here's what I did:

ISUICheatMenu.SpawnZombieNow = function()

    if ISUICheatMenu.ZombieBrushEnabled == true then

        local mx = getMouseXScaled(); -- uses scaled, so that it's still accurate at different zoom levels

        local my = getMouseYScaled();

        local player = getPlayer();

        local wz = player:getZ();

        local wx, wy = ISCoordConversion.ToWorld(mx, my, wz);

    

        if not string.match(getCore():getVersionNumber(), "32") then -- checks for build 32

            for i = 1,ISUICheatMenu.ZombiesToSpawn do--ISUICheatMenu.ZombiesToSpawn was handled in the toggle function not shown(blame forum formatting for not-one line one-line comment)

                getVirtualZombieManager():createRealZombieNow(wx,wy,wz); -- if it isn't build 32, uses the old method

            end

        else

            if string.match(getCore():getVersionNumber(), "32") then -- handles this differently if it is build 32

                spawnHorde(wx,wy,wx,wy,wz,ISUICheatMenu.ZombiesToSpawn) --if it is build 32, uses same variable for x and y twice to remove randomness. I'll have to add a for statement later to make this work for build 32 and above.(note: in notepad++ this is actually a single line comment, blame forum formatting).

            end

        end

    end

end

 

As it would turn out, spawnHorde also works for any number of zombies, including a single one.

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