This is my Lua_ScriptSetUp.lua:
And in modinfo, this file is imported as gameplay script:
But when I test it, when the ChangeCityProduction function is being called, the Gamplay Script function such as AddProgress() fail, but the UI Context function such as GetCurrentGovernment works.
So my gameplay script file is registered as UI Context script? Why did this happen?
Also, I call this function in other UI Context script, this is where the ExposedMembers coming in place, I call this function in other UI Context script:
I wonder if this is the problem, if it is, then what's the solution?
Code:
ExposedMembers.GameEvents = GameEvents;
function ChangeCityProduction(pCity,number)
pCity:GetBuildQueue():AddProgress(number);
end
GameEvents.OnChangeCityProduction.Add(ChangeCityProduction)
Code:
<AddGameplayScripts id="SetupLua">
<Properties>
<LoadOrder>98</LoadOrder>
</Properties>
<File>Lua_ScriptSetUp.lua</File>
</AddGameplayScripts>
So my gameplay script file is registered as UI Context script? Why did this happen?
Also, I call this function in other UI Context script, this is where the ExposedMembers coming in place, I call this function in other UI Context script:
Code:
GameEvents = ExposedMembers.GameEvents;
GameEvents.OnChangeCityProduction.Call(pCity,10);