Cool feature.
I ran into a slight issue though...
warning: Error running OnRelease script in <deleted object>: ...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua(702): attempt to concatenate field `PL' (a nil value)
stack traceback:
...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua(702): in function <...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua:678>
...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua(1142): in function `LaunchGame'
...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua(1167): in function <...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua:981>
...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua(2164): in function `OnClick'
...d alliance\gamedata\mohodata.scd\lua\maui\button.lua(133): in function <...d alliance\gamedata\mohodata.scd\lua\maui\button.lua:122>
- Code: Select all
local ratingTable = {}
for i = 1, numAvailStartSpots do
if gameInfo.PlayerOptions[i] then
LOG("Rating of player " .. i .. " : " .. gameInfo.PlayerOptions[i].PL)
rating = gameInfo.PlayerOptions[i].PL
ratingTable[rating] = i
end
end
Problem is at
.. gameInfo.PlayerOptions[i].PLIn skirmish mode (using an init file to load faf and phantom-x), the AIs I'm testing with don't have ratings (unless I missed something), so this code bombs out. I can use fixed spawns for testing purposes, but you may want to look at some exception handling for a scenario where there are no player ratings (i.e. AIs).