Page 1 of 1
Need a workaround for bots and GetPlayerList()
Posted: 26 May 2018, 09:19
by Forboding Angel
Code: Select all
Spring.Echo("[Default Mex Layout] Map size is: " .. mapx + mapz)
local players = Spring.GetPlayerList()
local count = 0
for i = 1, #players do
local playerID = players[i]
if not select(3, Spring.GetPlayerInfo(playerID)) then
count = count + 1
end
end
Spring.SetGameRulesParam("peopleCount", count)
teamIDCount = Spring.GetGameRulesParam("peopleCount")
Spring.Echo("[Default Mex Layout] Number of teamIDs in this match: " .. teamIDCount)
This only counts human players. I need it to count bots as well. I only need a count of allyteams that are in the game. This is important because it defines how many metal spots are placed in a game. I have some mitigating logic that does some rounding up so that the impact from, say a 3v3bots will output enough spots deemed for a 2v2, but I would like to not be hamstrung in this fashion.
Re: Need a workaround for bots and GetPlayerList()
Posted: 27 May 2018, 12:56
by Silentwings
https://github.com/Balanced-Annihilatio ... ds.lua#L76 can be easily modified to count all different types of player/team/AI.