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: 195
Joined: 08 Oct 2006, 10:33

team won condition

Post 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!
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: team won condition

Post 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.
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: team won condition

Post by daryl »

I want a list of winning players only...i try as soon as possibile.
thx
sprunk
Posts: 100
Joined: 29 Jun 2015, 07:36

Re: team won condition

Post 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).
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: team won condition

Post 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.
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: team won condition

Post 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.
Post Reply

Return to “Lua Scripts”