In order to facilitate multiple upgrade levels, I am building a system where I have base unitdefs as configs (basedefs), and the unitdefs (Ignore the unused folder... those are old units no longer used) themselves call the configs. The way that I can change various unit tags is via a normalized static variable that I put in the base def.
For example, here is a list of some of the static variables I use in the basedef:
Code: Select all
unitName = "eheavytank3"
isUpgraded = false
isUpgraded2 = false
isUpgraded3 = false
humanName = "Crusher"
objectName = "eheavytank4.s3o"
script = "eheavytank4_lus.lua"
tech = [[tech2]]
armortype = [[armored]]
supply = [[4]]
Unitname is obvious enough. isUpgraded is used in both unit and weapon basedef customparams. It triggers alterations to some stats in POST (search for isUpgraded in alldefs_post). This way, I can quickly and mathematically alter stats of upgrade units without actually changing any unitdef values by hand.
Humanname, also obvious as are object and script.
Tech, armortype and supply are all unit customparams values.
******************
Ok, so I've established what I'm doing.
It gets a little more complicated when you factor in factories and their upgraded counterparts, because you have to change buildlists. The way I have gotten around that is to use unitdefs_pre to define the buildlists. I then define a static variable in the factory basedef, and in the unitdef I change the static variable value to match whatever buildlist that factory should be using.
*******************
Everything works perfectly!
As in, nothing is broken, upgrades are applied, literally everything works. But then I have this in infolog:
Code: Select all
[f=-000001] Loading GameData Definitions
[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/eartytank_basedef.lua: error = 2, units/ehover/basedefs/eartytank_basedef.lua, [string "units/ehover/basedefs/eartytank_basedef.lua"]:16: attempt to concatenate global 'supply' (a nil value)
[f=-000001] [unitdefs.lua] Error: Bad return table from: units/ehover/basedefs/ebasefactory_basedef.lua
[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/eheavytank3_basedef.lua: error = 2, units/ehover/basedefs/eheavytank3_basedef.lua, [string "units/ehover/basedefs/eheavytank3_basedef.l..."]:16: attempt to concatenate global 'supply' (a nil value)
[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/elacerator_basedef.lua: error = 2, units/ehover/basedefs/elacerator_basedef.lua, [string "units/ehover/basedefs/elacerator_basedef.lu..."]:17: attempt to concatenate global 'supply' (a nil value)
[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/elighttank3_basedef.lua: error = 2, units/ehover/basedefs/elighttank3_basedef.lua, [string "units/ehover/basedefs/elighttank3_basedef.l..."]:16: attempt to concatenate global 'supply' (a nil value)
[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/emissiletank_basedef.lua: error = 2, units/ehover/basedefs/emissiletank_basedef.lua, [string "units/ehover/basedefs/emissiletank_basedef...."]:17: attempt to concatenate global 'supply' (a nil value)
[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/eriottank2_basedef.lua: error = 2, units/ehover/basedefs/eriottank2_basedef.lua, [string "units/ehover/basedefs/eriottank2_basedef.lu..."]:16: attempt to concatenate global 'supply' (a nil value)
[f=-000001] [Gameplay Speed] Set to normal
[f=-000001] [defs.lua] loading all *Defs tables: 692ms
[f=-000001] Game::LoadDefs (GameData): 746 ms
It should be noticed that there is a bad return table from the factory basedef. That sounds fairly serious, until you consider that it's working as intended. But obviously something is screwy here, and I would like to know what.
That said, I am having a lot of trouble tracking it down. Could some enterprising soul give me a hand?
Like I said, functionally, it is working correctly. Here is a screenshot containing all of the units using the above outlined methods:

I need fresh eyes, cause I'm at a total loss. I think that the bad return table has something to do with it, but it's so unspecific that I don't know how to diagnose.