Culture from Expeditions

Starrynite120

Prince
Joined
Jul 15, 2015
Messages
472
I've been working on this script for awhile and I can't figure out why its not working, so I figured I'd post it here to see if anyone else can figure it out. The script is supposed to give you culture whenever you finish an expedition if you have a policy in the knowledge tree.

function OnBuildFinished(playerID, iX, iY, improvementID, buildID)
local expeditionInfo = GameInfo.Builds["BUILD_EXPEDITION"]
local expeditionID = expeditionInfo.ID;
local bonus = 20;
local player = Players[playerID];
local policyInfo = GameInfo.Policies["POLICY_KNOWLEDGE_4"];

if (buildID == expeditionID and player:HasPolicy(policyInfo)) then
player:ChangeCulture(bonus)
end
end
GameEvents.BuildFinished.Add(OnBuildFinished);

EDIT: I resolved the problem. I had a function before this function in the text that wasn't working that was making all functions below it fail. This code works properly.
 
Top Bottom