CivilizationAce
Warlord
- Joined
- Jan 17, 2017
- Messages
- 240
So having got all my ducks in a row (or so I thought) I added a .lua file to my mod. I added it to the in-Game Actions — AddGameplayScripts. However, not even the first print statement result appears in the Lua Console when I take a barbarian encampment. Here are the relevant parts of the code:
Anyone got any idea about what I've done wrong please?
Code:
function OnLoadScreenClose()
Events.ImprovementActivated.Add(OnImprovementActivated)
end
function OnImprovementActivated(iX, iY, iPlayer, moot1, iImprovementIndex, moot2, moot3, moot4)
print("OnImprovementActivated start")
pPlayer ~= -1 and Players[iPlayer] or Map.GetPlot(iX,iY):GetOwner()
if iImprovementIndex == GameInfo.Improvements["IMPROVEMENT_BARBARIAN_CAMP"].Index then
print("About to GenerateUnit")
GenerateUnit(pPlayer,1) -- 1/30 in final build
end
end
Events.LoadScreenClose.Add(OnLoadScreenClose)