sman1975
Emperor
Hello,
I'm working on a mod that would add free melee units when a game starts in the Industrial Eras or later. The easiest way to do this is to modify the Era.xml file.
Unfortunately, the units the game normally spawns depends on the highest combat strength unit available at that point of the Tech Tree. Often this isn't the unit you want.
So, it would save a lot of time, hassle, and game instability, if I could grant a free tech to all Civs via SQL. Using LUA is too late in the process - the units have already spawned.
For example, I want to start the game in the Modern Era (WW1). Normally, the game spawns Riflemen units, as they are the best available. I'd prefer to use Great War Infantry, but since no one has Replaceable Parts discovered, this won't happen. Same thing for starting in the Atomic (WW2) Era. I get GWI, but would prefer the standard Infantry unit.
What I need is a SQL-based statement that can somehow sense the game's starting Era, then award an appropriate Tech (e.g. Replaceable Parts, Plastics, etc.).
I've been using code like this, but I need to some how make it conditional, based on start Era:
Any hope for me? Am hoping so, since my original approach simply spawned the units via LUA, but when you spawn a lot of units at game start, more often than not, the game unceremoniously CTD's...
EDIT: And P.S. - Yes, I've tried Triggers, but the results would have been comical if they weren't so sad...
I'm working on a mod that would add free melee units when a game starts in the Industrial Eras or later. The easiest way to do this is to modify the Era.xml file.
Unfortunately, the units the game normally spawns depends on the highest combat strength unit available at that point of the Tech Tree. Often this isn't the unit you want.
So, it would save a lot of time, hassle, and game instability, if I could grant a free tech to all Civs via SQL. Using LUA is too late in the process - the units have already spawned.
For example, I want to start the game in the Modern Era (WW1). Normally, the game spawns Riflemen units, as they are the best available. I'd prefer to use Great War Infantry, but since no one has Replaceable Parts discovered, this won't happen. Same thing for starting in the Atomic (WW2) Era. I get GWI, but would prefer the standard Infantry unit.
What I need is a SQL-based statement that can somehow sense the game's starting Era, then award an appropriate Tech (e.g. Replaceable Parts, Plastics, etc.).
I've been using code like this, but I need to some how make it conditional, based on start Era:
Code:
INSERT INTO Civilization_FreeTechs (CivilizationType, TechType)
SELECT Type, 'TECH_REPLACEABLE_PARTS' FROM Civilizations
WHERE Type <> 'CIVILIZATION_BARBARIAN';
Any hope for me? Am hoping so, since my original approach simply spawned the units via LUA, but when you spawn a lot of units at game start, more often than not, the game unceremoniously CTD's...
EDIT: And P.S. - Yes, I've tried Triggers, but the results would have been comical if they weren't so sad...