This is really strange. I just downloaded it on Thursday (August 22nd). Now when I go to my history to grab the link, it gives the "File not found" stuff.
Yea, sorry I got super busy yesterday and didn't feel like working on it last night after I got home.
Anyways, fixed the problem:
function CheckReligion(playerID)
local player = Players[playerID]
local era = player:GetCurrentEra()
local eraUnits = {
[0] = {...
I'll look into it in a little while. I think i know what the problem is.
Never noticed it because I always tested by founding a religion on turn 0 and it worked how I expected it to.
Absolutely no idea. Sorry. I've never messed with anything having to do with UI or notifications or anything of the sort. Basically I just happened to have already done a unit spawning thing before so I knew the basics, but I'm not very good with Lua in general.
Yep.
Okay this works:
function CheckReligion(playerID)
local player = Players[playerID]
local era = player:GetCurrentEra()
local eraUnits = {
[0] = { GameInfoTypes.UNIT_WARRIOR },
[1] = { GameInfoTypes.UNIT_SWORDSMAN, GameInfoTypes.UNIT_COMPOSITE_BOWMAN }...
Hmm, that's odd. table.getn is a core lua function.
Sorry, I'm not at home right now. I'll play around with it some when I get home and see what I can figure out.
No. Sorry
Edit: The only thing that I can think of that might work is something like this:
function CheckReligion(playerID)
local player = Players[playerID]
local era = player:GetCurrentEra()
local eraUnits = {
[0] = { GameInfoTypes.UNIT_WARRIOR },
[1] = (...
No, that wouldn't work at all. I'm not sure if it would crash, though. But an index of an array can only have one value.
Not unless you changed something. It works correctly for me.
It "works" as is, for me. I just tested. But it's spawning units from an era behind (and settlers in the Ancient era. Apparently Lua arrays start with 1, but GetCurrentEra starts at 0.)
Anyways, to fix:
Change the "eraUnits" line to this
local eraUnits = {[0] =...
I'm not positive, but I kind of doubt it.
"GameInfoTypes.UNIT_MARINE" returns an index (basically...the row number) from the Units table in the game database. "GameInfoTypes.UNITCLASS_MARINE" would return a different index from a different table (actually, i'm not even sure you can do...
function CheckReligion(playerID)
local player = Players[playerID]
local era = player:GetCurrentEra()
local eraUnits = {GameInfoTypes.UNIT_WARRIOR, GameInfoTypes.UNIT_SWORDSMAN, GameInfoTypes.UNIT_LONGSWORDSMAN, GameInfoTypes.UNIT_MUSKETMAN, GameInfoTypes.UNIT_RIFLEMAN...
I tested it. After checking the Lua log, I realized that I put != instead of ~=.
function CheckReligion(playerID)
local player = Players[playerID]
local pCiv = player:GetCivilizationType()
if (pCiv == GameInfoTypes.CIVILIZATION_AMERICA) then
local pReligion =...
The line that says: "for id, tempPlayer in pairs(Players)"
Should be: "for id, tempPlayer in pairs(Players) do"
Need the do at the end.
The way I pasted it works too. IE, declaring your function, then using add on the function name. The way he has it set up will run every turn...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.