Joebles
Chieftain
- Joined
- Jun 9, 2014
- Messages
- 62
So, I'm relatively new to the modding scene, but I've spent the past week or so delving the wiki, these forums, and picking apart other peoples' mods and the game's XML, Lua, and source code.
The current project I'm working on involves a Trait that grants you settlers when you reach the Classical and Renaissance eras, and I found some code (provided by whoward for Carloso in another thread I believe) that I thought I could adapt for what I was doing.
The code:
Well, after hitting my head against the wall for a couple hours tonight I thought I would just ask for help. I have a general knowledge of coding, but no knowledge of Lua specifically, and it's possible that I messed up the syntax somewhere. From what I can tell in Fire Tuner and the logs, the .lua file isn't even being run by the mod (and when I put print commands in to test, nothing shows up). I've imported the .lua file into the VFS, but maybe I needed to do something else? Any suggestions?
The current project I'm working on involves a Trait that grants you settlers when you reach the Classical and Renaissance eras, and I found some code (provided by whoward for Carloso in another thread I believe) that I thought I could adapt for what I was doing.
The code:
Spoiler :
local iMySpecialCiv = GameInfoTypes.CIVILIZATION_SPECIAL
Events.SerialEventEraChanged.Add(function(iEra, iPlayer)
Events.SerialEventEraChanged.Add(function(iEra, iPlayer)
local pPlayer = Players[iPlayer]
if ((pPlayer:GetCivilizationType() == iMySpecialCiv) and (iEra < 3)) then
end)
if ((pPlayer:GetCivilizationType() == iMySpecialCiv) and (iEra < 3)) then
pPlayer:AddFreeUnit(GameInfo.Units["UNIT_SETTLER"].ID, UNITAI_SETTLE)
endWell, after hitting my head against the wall for a couple hours tonight I thought I would just ask for help. I have a general knowledge of coding, but no knowledge of Lua specifically, and it's possible that I messed up the syntax somewhere. From what I can tell in Fire Tuner and the logs, the .lua file isn't even being run by the mod (and when I put print commands in to test, nothing shows up). I've imported the .lua file into the VFS, but maybe I needed to do something else? Any suggestions?