Page 1 of 1
Current Side
Posted: 12 Dec 2010, 19:52
by kalda341
Does anyone know of a spring lua variable that would allow me to execute a command if you are playing as a certain faction?
Re: Current Side
Posted: 12 Dec 2010, 19:56
by zwzsg
http://springrts.com/wiki/Lua_Scripting
Spring.GetTeamInfo 5th returned value.
Re: Current Side
Posted: 13 Dec 2010, 02:24
by CarRepairer
Beware however, if you develop using an empty script with spring.exe, that value is nil (or empty string) so be sure that you account for that.
Re: Current Side
Posted: 13 Dec 2010, 11:51
by hoijui
yeah true.. it is usually not a good idea to rely on that. as in spring, you can change faction during the game (capture or resurrect an enemy construction unit, loose your own construction units), you should rather rely on the current units in the team, if possible.
Re: Current Side
Posted: 13 Dec 2010, 16:48
by knorke
CarRepairer wrote:Beware however, if you develop using an empty script with spring.exe, that value is nil (or empty string) so be sure that you account for that.
omg i was wondering why it would not work.
wtfisthatshit.jpg
Re: Current Side
Posted: 14 Dec 2010, 00:05
by knorke
Code: Select all
local localplayerID = Spring.GetLocalTeamID()
local _,_,_,_,f = Spring.GetTeamInfo(localplayerID)
local _,faction = Spring.GetSideData (f)
Spring.Echo ("You are playing as faction:" .. faction)
Also attached the widget I talked about in the "Custom GUI" thread, it replaces "metal" with "wood" for Arm and with "gold" for Core.
Turns out it was all fine, Spring just fails to set faction when playing over spring.exe directly. So use a lobby.
To change the resource/faction names see
function widget:Initialize()
at the end of the file.
Re: Current Side
Posted: 14 Dec 2010, 02:06
by kalda341
Thanks.
Re: Current Side
Posted: 14 Dec 2010, 12:52
by Forboding Angel
get moar wood! hur hur

Re: Current Side
Posted: 14 Dec 2010, 19:34
by kalda341
?
Re: Current Side
Posted: 07 Jun 2011, 20:17
by Pithikos
CarRepairer wrote:Beware however, if you develop using an empty script with spring.exe, that value is nil (or empty string) so be sure that you account for that.
What do you mean with an empty script? The configuration file?
Re: Current Side
Posted: 07 Jun 2011, 21:17
by FLOZi
he means if you run spring.exe directly and not via a lobby.