[GS] Any Lua function to change strategy resouces amount?

Windflier

Chieftain
Joined
Dec 15, 2017
Messages
39
Since the strategy resouces are stackable in the GS, I wonder if there are some Lua function to change the amount of strategy resouce a player have.
By looking into the TopPanel_Expansion2.lua file, I find these new function:
Code:
GetResourceAmount(resource.ResourceType);
GetResourceStockpileCap(resource.ResourceType);
GetReservedResourceAmount(resource.ResourceType);
GetResourceAccumulationPerTurn(resource.ResourceType);
GetResourceImportPerTurn(resource.ResourceType);
GetBonusResourcePerTurn(resource.ResourceType);
GetUnitResourceDemandPerTurn(resource.ResourceType);
GetPowerResourceDemandPerTurn(resource.ResourceType);
But all of these are "Get" function, not some thing that can change data in game. Anyone knows if there is any function that can change strategy resouces amount?
 
In the new Player panel in Firetuner there's a button that lets you add resources to a player(+10 per click). Right clicking it and reading its function shows this, which may be how it works:

local resourceInfo = GameInfo.Resources["RESOURCE_IRON"];
local playerResources = Players[g_TunerSelectedPlayer]:GetResources();
playerResources:ChangeResourceAmount(resourceInfo.Index, 10);
 
You have to be a little careful with functions from Firetuner, since it is it's own hybrid beast and implementation. Functions that are valid for Firetuner are not always valid within a GameplayScript or within a UI context. I don't see Player:GetResources():ChangeResourceAmount() shown as being a valid Gameplay or UI function on either Gedemon's or ChimpanG/Chrisy15's Object, Function, Hooks spreadsheets. It may or may not work outside of Firetuner.
 
You have to be a little careful with functions from Firetuner, since it is it's own hybrid beast and implementation. Functions that are valid for Firetuner are not always valid within a GameplayScript or within a UI context. I don't see Player:GetResources():ChangeResourceAmount() shown as being a valid Gameplay or UI function on either Gedemon's or ChimpanG/Chrisy15's Object, Function, Hooks spreadsheets. It may or may not work outside of Firetuner.
After testing, this function doesn't work in Gamplay or UI function, sadly. Maybe there is indeed no functions we can use.
 
Top Bottom