Jump to content
ethanwdp

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

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.

Share this post


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

Share this post


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

Share this post


Link to post
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?

Share this post


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

Share this post


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

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


×
×
  • Create New...