D3bot icon indicating copy to clipboard operation
D3bot copied to clipboard

Allow bots to become bosses

Open arthurgeron opened this issue 6 years ago • 2 comments

I've set my zombiesurvival to select bots as possible bosses when there are no playerbosses available, on gamemode/init.lua:1226 I've added the following lines:

    if #zombies == 0 then
        for _, ent in pairs(D3bot.GetBots()) do
            if ent:Team() == TEAM_UNDEAD and not ent:GetZombieClassTable().Boss then
                table.insert(zombies, ent)
            end
        end
    end

But I think somehow D3BOT is forcing zombies to not spawn as bosses, even if the gamemode has set them to be, what could I possibily change or did I do something wrong?

Thank you for your time :)

arthurgeron avatar Sep 02 '19 00:09 arthurgeron

I can't find anything meaningful at line 1226 in my version of ZS, but i assume you added that to function GM:CalculateNextBoss(). If so, then it should be ok.

D3bot isn't blocking bots from becoming bosses, but with too few players bosses may be disabled. And depending on the version of ZS you are using, bots don't add to the total player count.

I assume you just need to tweak the GM.BossZombiePlayersRequired value in gamemode/sh_globals.lua (or gamemode/shared/sh_globals.lua).

Dadido3 avatar Sep 05 '19 21:09 Dadido3

Just tested it here. It works fine when i add your snippet to GM:CalculateNextBoss():

function GM:CalculateNextBoss()
	local livingbosses = 0
	local zombies = {}
	for _, ent in pairs(team.GetPlayers(TEAM_UNDEAD)) do
		if ent:GetZombieClassTable().Boss and ent:Alive() then
			livingbosses = livingbosses + 1
			if livingbosses >= 3 then return end
		else
			if ent:GetInfo("zs_nobosspick") == "0" then
				table.insert(zombies, ent)
			end
		end
	end
	if #zombies == 0 then
		for _, ent in pairs(D3bot.GetBots()) do
			if ent:Team() == TEAM_UNDEAD and not ent:GetZombieClassTable().Boss then
				table.insert(zombies, ent)
			end
		end
	end
	table.sort(zombies, BossZombieSort)
	local newboss = zombies[1]
	local newbossclass = ""

	if newboss and newboss:IsValid() then newbossclass = GAMEMODE.ZombieClasses[newboss:GetBossZombieIndex()].Name end
	net.Start("zs_nextboss")
	net.WriteEntity(newboss)
	net.WriteString(newbossclass)
	net.Broadcast()

	return newboss
end

So it must be something in your gamemode.

Dadido3 avatar Sep 05 '19 21:09 Dadido3