Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bots to become bosses #31

Open
arthurgeron opened this issue Sep 2, 2019 · 2 comments
Open

Allow bots to become bosses #31

arthurgeron opened this issue Sep 2, 2019 · 2 comments

Comments

@arthurgeron
Copy link

arthurgeron commented Sep 2, 2019

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 :)

@Dadido3
Copy link
Owner

Dadido3 commented Sep 5, 2019

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
Copy link
Owner

Dadido3 commented Sep 5, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants