Page 1 of 1

team won condition

Posted: 03 Jan 2019, 16:14
by daryl
Hello all ,
I need help about a widget:
I want to write a file with a list of winner teams.

At the moment I do a list of loser teams (it's more easy):

Code: Select all

function widget:TeamDied(TeamID)

	local GetPlayerInfo = Spring.GetPlayerInfo
	local Echo = Spring.Echo
	file = io.open ("rpt.wrm","a")
	local name = GetPlayerInfo(TeamID)

	file:write("\n" .. name .. "= death2")
	file:close()

end

But i want a list of winning team, (would be widget:GameOver() and I don't know how use this function. can you help me please???
thx!

Re: team won condition

Posted: 03 Jan 2019, 18:26
by FLOZi
GameOver() returns a table listing winning allyTeams, so if you want teams (teams or players?) you'll need to iterate over that table and use Spring.GetTeamList(allyTeamID) and iterate over the result too.

Re: team won condition

Posted: 23 Jan 2019, 10:50
by daryl
I want a list of winning players only...i try as soon as possibile.
thx

Re: team won condition

Posted: 23 Jan 2019, 19:07
by sprunk
Keep in mind that just like there are multiple teams in an allyteam, there can also be multiple players in one team (aka commsharing).

Re: team won condition

Posted: 24 Jan 2019, 17:28
by Jools
Just keep in mind that player = team and team = ally in spring parlance. I know it's confusing but that's how it is.

Re: team won condition

Posted: 24 Jan 2019, 19:14
by daryl
so i need simple gadget that write the winner player name, at end of game, in infolog.txt

for example;

"daryl won the battle"
"sprunk won the battle"
etc.