team won condition

team won condition

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
daryl
Posts: 186
Joined: 08 Oct 2006, 10:33

team won condition

Post by daryl » 03 Jan 2019, 16:14

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!
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6070
Joined: 29 Apr 2005, 01:14

Re: team won condition

Post by FLOZi » 03 Jan 2019, 18:26

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.
1 x

User avatar
daryl
Posts: 186
Joined: 08 Oct 2006, 10:33

Re: team won condition

Post by daryl » 23 Jan 2019, 10:50

I want a list of winning players only...i try as soon as possibile.
thx
0 x

sprunk
Posts: 82
Joined: 29 Jun 2015, 07:36

Re: team won condition

Post by sprunk » 23 Jan 2019, 19:07

Keep in mind that just like there are multiple teams in an allyteam, there can also be multiple players in one team (aka commsharing).
0 x

User avatar
Jools
XTA Developer
Posts: 2788
Joined: 23 Feb 2009, 16:29

Re: team won condition

Post by Jools » 24 Jan 2019, 17:28

Just keep in mind that player = team and team = ally in spring parlance. I know it's confusing but that's how it is.
0 x

User avatar
daryl
Posts: 186
Joined: 08 Oct 2006, 10:33

Re: team won condition

Post by daryl » 24 Jan 2019, 19:14

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.
0 x

Post Reply

Return to “Lua Scripts”