[GS] Gathering Storm LUA Objects

ReggieB

Chieftain
Joined
Mar 28, 2018
Messages
36
Hi all, I'm trying to make a mod for the gathering storm expansion, but I need to reference some lua objects that were introduced with the expansion. I managed to find this thread on these forums describing most of the old lua objects. But so far, I haven't found any list of lua objects updated for gathering storm. Specifically, I'm looking for a way to get the player's current diplomatic victory points, and the player's current "science victory points" (what the game code calls exoplanet expedition lightyears). Thanks in advance for any suggestions!
 
I tried looking in some Civ GS lua files and I found this, it should return number of points towards specific vistory. I found it in CivVI\DLC\Expansion2\UI\Replacements\WorldRankings_Expansion2.lua :670

Game.GetVictoryProgressForTeam(victoryType, teamData.TeamID);
 
All functions only available in UI context.
Code:
local pPlayer:table = Players[ePlayerID];
local iTotalDiploPoints:number = GlobalParameters.DIPLOMATIC_VICTORY_POINTS_REQUIRED;
local iDiploPoints:number = pPlayer:GetStats():GetDiplomaticVictoryPoints()
local lightYears:number        = pPlayer:GetStats():GetScienceVictoryPoints();
local totalLightYears:number   = pPlayer:GetStats():GetScienceVictoryPointsTotalNeeded();
local lightYearsPerTurn:number = pPlayer:GetStats():GetScienceVictoryPointsPerTurn();
 
Thanks a lot, that sounds like just what I am looking for! As a follow up question, is there some way to get these functions to return a value in Firaxis Life Tuner? I think I have those functions working for the mod I'm making, but it would be nice to be able to debug things from the Live Tuner. However just typing the functions directly into the Life Tuner returns a nil value, is there something I'm missing? Thanks again!
 
So far I have tried typing a few different commands in the "Lua Console" panel. Some generic lua commands seem to work there, like "print(2+2);" but I'm having trouble testing the more complicated commands. Do I need to select a specific "Lua State" from the dropdown menu? Or type something specific to give the commands the correct context? I've read into these two guides to the live tuner, but so far I haven't found anything that help with just evaluating simple commands in the lua console. Is there some other resource I should look into for advice? Thanks.
 
Do I need to select a specific "Lua State" from the dropdown menu?
Yes, it is crucial. It is the context you want to be "in". But for general-purpose testing, for UI select "InGame" and for Gameplay "GameCore_Tuner" (if I remember correclty).
Then type
Players[0]:GetStats():GetDiplomaticVictoryPoints()
to check player 0 (usually you).
 
Thanks again! In those contexts the commands seem to be working great. Like you say, most of them (except getting the required victory points) only seem to work from the "InGame" UI console, and not the "GameCore_Tuner" Gameplay console. But that should be good enough to make debugging the mod much easier. I really appreciate the help!
 
Top Bottom