Imperialism 3 - Now with 100% more Lua!

CurtSibling

ENEMY ACE™
Joined
Aug 31, 2001
Messages
29,447
Location
Innsmouth
Dust off those pith helmets, gentlemen! It's time for the grand campaign!
maxim1b.png


Imperialism Version III v6
NEW UPDATE! - 09/5/21
Important! Requires ToTPP version 0.16

Current scenario zip is attached below:

Imperialism III features include:
  • New stats and balance for all units. Battles will be more exciting and with varied results.
  • Cities now grow much slower, and Republics no longer experience happiness super-growth.
  • The new Lua framework makes development of cities more challenging and logical.
  • City improvements now have prerequisites and population size requirements.
  • Barracks must be built in order to train soldiers. Other units need certain improvements.
  • Heavy industry takes a long time to grow, so becomes more of a strategic choice.
  • Certain cities and areas allow you to train specific colonial units and armies.
  • World wonders now all have city conditions that must be met.
  • Agents are now buildable (but expensive) with one specific capital city wonder.
  • Engineers can be trained at any time in the capital. They have a high cost.
  • New higher difficulty levels, only for the bravest colonial heroes.
  • Tweaked techs leading to the trade menu. Now available to all civs from the start.
  • Updated Terrain1 and Terrain2 files featuring new rivers and oceans.
  • Minor unit obsolescence tweaks and some redone resource tiles.
  • New Lua features added. Mfg Goods and Truck plunder events.
  • Minor edits to unit stats. Russian elite regiment power reduced.
  • New buildings and wonders icons.
  • New terrain graphic tweaks.
  • New imperialistic City.bmp graphics.
  • New easier to read People.bmp graphics.
  • Tweak to Versailles wonder. Obsolete with Democracy.
  • New sounds for naval and some barb wonders.
  • Some tweaks to unit stats, and some barbs are now un-bribable.
  • New City national UI graphics for each Imperial faction.
Plenty more to discover, and I will create an info readme here in the thread soon.

Basically, the goal is the same as earlier versions, build your home nation's infrastructure, seek out new
areas to conquer or trade with. You can either build a socialist utopia, or a monarchist autocracy. Each
empire begins with a slew of capable forces and enough units to grap some territory or defend what they
have, but all have economies that are straining. Growth and science must be husbanded to gain access
to the eventual 1900s-era weapons and the supremacy these will bring...But that is a long road!

I'm hope some people will give this totally new version a roll, and be warned, this is indeed the grandest
of all campaigns so far. The adoption of Lua has really opened doors in what can be done in CIV2, working
with ToTPP, giving challenging restrictions of city development...No more increment-building dreadnoughts
in that backwater colony far from the industrial heartlands.

Now the home cities are the heart of your empire, where you will ship out your best troops to the frontiers.
The AI handles things differently too, I have seen three-way battles in China, Boer lands and the Balkans,
with empires swiping cities and losing them again. All empires present a challenge, with some being an
exercise in management, with mighty rewards to reap later, and others being in the thick of it from the start.

I recommend jumping in and trying things out. If you are unsure what units do what, take a look at the icon,
and you'll see what each unit is for. Cavalry for recon and soft attacks, artillery for city attacks, and infantry
for stack defence. Special units like generals, elites, agents and marines are useful in a myriad situations.
Look at the pedia entry and see what the unit can do. I will list a read with all unit roles and uses soon.

Finally, I wish to thank @Fairline for his peerless unit work, giving this scenario the sort of looks that bring the
era to vibrant life. And to @JPetroski and @Prof. Garfield for their endless patience with my early attempts
with Lua, and helping with advice and examples. I still have much to learn, but this is my first foray.

The scenario here is very much a work in progress, and I will add features and update as I increase my
ambition. For now, things are in a playable state, and I am happy to hear feedback or bug reports from you!

Enjoy, and may the sun never set on your empire.
pruss1c.jpg

Imperial glory awaits you!
 

Attachments

  • Imp3 v6.zip
    13.2 MB · Views: 137
Last edited:
Reserved post for Readme info.
==============================

Some hints about the build prerequisites on various city improvements:

It is highly recommended to build a Barracks and Local Industry in a new city.

In order to begin naval expansion, a Harbour and International Port are needed.

Advanced units like Heavy Artillery and the Armoured Cruiser need a Factory and Steel Mill.

The Factory requires both a Bank, and a Grand Rail Station. City must be size 6.

The Modern Housing requires both a Theatre, and a Grand Rail Station. City must be size 8.

The Secret Police HQ requires both a Colonial Police, and a Magistrate. City must be size 8.

Much more will be added. In the meantime, if you have any production problems, post here and I will try to help.

I can't give you coal or steel, though! :)
 
Last edited:
Installation:

Extract all folders and files from "Imp3v3" into an "Imperialism 3" folder.
Extract the "Imp3Sound" contents into a "Sound" folder.

Use the 15.1 version of ToTPP, Make sure all folders below are listed.
(Sound folder should be there too)
Imp3 Files1.png

If all looks good, then load up ToT, accept the Lua events (default option) and run!

Any problems, let me know - Have fun!
 
I realised during play, that gaining Steel will stop you building any WIP Steam Yachts until Steel Mills are made.
To make sure the player always has some kind of cargo ship capability, I made Steam Yachts never go obsolete.

Steam Yacht, nil, 2, 9.,0, 0a,2d, 2h,1f, 5,2, 4, SE, 000000000000000

To fix this issue, change the preq after the unit name to "nil", as noted above.
 
I'm thinking of swapping out some of the elite units with national General units, so each faction has a "super unit" to lead imperial campaigns.

While being "super", they are not unkillable (especially by another general!) and I will make them nigh-irreplaceable.

They will also be placed at the far-away frontier of a colonial area, as to not make waves in European affairs.

The Elite Grenadiers, Foot Guards, Imperial Guards, French Voltigeurs would be replaced with such a unit. Japan would gain a new general unit.
The USA and British empire would remain the same. The other civ's generals would have identical stats. I have the unit art ready...What do you all think?

Generals1.png
 
Last edited:
Hi Curt,

I started playing your version 4 of the scenario (with the new leaders) a couple of days ago and been having a truly great time so far. No surprise for me but the quality of your graphics are absolutely first rate and just make the playing experience all that much more fun.

I decided to play as the Russians and since Japan seized Port Arthur almost from the begining of the game I have been at war with them in the Far East. Around March 1872 the German launched a sneak attack on me and I'm now fighting a two front war but fortunately had been preparing for such an eventually from the start and are holding my own against them and are slowly starting to get the upper hand in Manchuria.

My cash flow has been problematic from the beginning and I've been running a deficit from the start which I can't quite redress and the game starting selling some of my improvements in the last few turns. If it hadn't been for the fact that I started with 10 or so trade units which I almost all delivered to New York (for a pay off of between 1200 to 2000 gold) I would have been in even greater trouble. For now I've tried to convert as many of my citizens to Tax specialist as I can. The fact that St-Petersburg is the only city that can build Mfg goods, until I discover Railroads, makes it difficult to get the upper hand on the situation and has had a negative impact on my science rate which currently stands at 1 discovery per 47 turns. Hopefully I can slowly redress the situation otherwise it might make it difficult to keep up with the other powers scientifically.

I've reached september 1872 and have run into a lua bug which occurs when the French player captures the city of Rome. I've attached the error message and the save game for the turn just before the error occurs. After loading the scenario you just need to press enter, since it was the end of the Russian turn, and let the AI play until the French player captures the city.

Otherwise, to date, a great job in the design and playability.
 

Attachments

  • error message turn sept 1872.txt
    10.7 KB · Views: 74
  • 1872aug_2.sav
    619.1 KB · Views: 99
Last edited:
I've reached september 1872 and have run into a lua bug which occurs when the French player captures the city of Rome. I've attached the error message and the save game for the turn just before the error occurs. After loading the scenario you just need to press enter, since it was the end of the Russian turn, and let the AI play until the French player captures the city.
Oops! I'm 99% sure that adding this line to the top of file onSchism.lua in the LuaRulesEvents directory will solve the problem. It did in version 3 (I don't currently have 4 installed).
Code:
local legacy = require("legacyEventEngine")
Please let me know if this solves the problem for you.
 
Hi Curt,

I started playing your version 4 of the scenario (with the new leaders) a couple of days ago and been having a truly great time so far. No surprise for me but the quality of your graphics are absolutely first rate and just make the playing experience all that much more fun.

I decided to play as the Russians and since Japan seized Port Arthur almost from the begining of the game I have been at war with them in the Far East. Around March 1872 the German launched a sneak attack on me and I'm now fighting a two front war but fortunately had been preparing for such an eventually from the start and are holding my own against them and are slowly starting to get the upper hand in Manchuria.

My cash flow has been problematic from the beginning and I've been running a deficit from the start which I can't quite redress and the game starting selling some of my improvements in the last few turns. If it hadn't been for the fact that I started with 10 or so trade units which I almost all delivered to New York (for a pay off of between 1200 to 2000 gold) I would have been in even greater trouble. For now I've tried to convert as many of my citizens to Tax specialist as I can. The fact that St-Petersburg is the only city that can build Mfg goods, until I discover Railroads, makes it difficult to get the upper hand on the situation and has had a negative impact on my science rate which currently stands at 1 discovery per 47 turns. Hopefully I can slowly redress the situation otherwise it might make it difficult to keep up with the other powers scientifically.

I've reached september 1872 and have run into a lua bug which occurs when the French player captures the city of Rome. I've attached the error message and the save game for the turn just before the error occurs. After loading the scenario you just need to press enter, since it was the end of the Russian turn, and let the AI play until the French player captures the city.

Otherwise, to date, a great job in the design and playability.

Thanks for the feedback! Really glad you are having fun with the scen.

The Russians are intended to the "challenge" tribe to play - But if you think the MFG goods should be buildable with a more accessible improvement like "local industry", let me know.

If you can report on the bug fix, that would be great. :)
 
Update:

Ran @tootall_2012 's save with @Prof. Garfield 's fix, French cavalry took Rome, no error this time.
(Rome has a capital improvement, which was causing a schism reference)

Splendid work, Prof - :)


Best of luck with the game, @tootall_2012 !

PS
My humble advice is to get a stack of cannons and horsemen under a general.
Japan has some juicy cities near Vladisvostok just asking for conquest!
 
@Prof. Garfield , I request your advice, sir.

Tried an experiment in OnTurn.Lua file to make deserts, jungles and glaciers more dangerous for units.

local onTurn = {}
function onTurn.onTurn(turn)
for unit in civ.iterateUnits() do
if unit.location.terrainType % 16 == desertTerrain then
local newDamage = math.floor(unit.hitpoints/3)
unit.damage = unit.damage+newDamage
end
if unit.location.terrainType % 9 == glacierTerrain then
local newDamage = math.floor(unit.hitpoints/3)
unit.damage = unit.damage+newDamage
end
end
if unit.location.terrainType % 7 == jungleTerrain then
local newDamage = math.floor(unit.hitpoints/3)
unit.damage = unit.damage+newDamage
end
end
return onTurn

Apart from the integers for glacier and jungle terrain perhaps being wrong (not sure how acquire the right numbers),
Lua is sending me this error:

... TOT\1_Imperialism III Update\LuaCore\generalLibrary.lua:2729: The Global table doesn't have a value associated with desertTerrain.
stack traceback:
[C]: in function 'error'
... TOT\1_Imperialism III Update\LuaCore\generalLibrary.lua:2729: in metamethod '__index'
...pdate\LuaTriggerEvents\UniversalTriggerEvents\onTurn.lua:4: in function 'UniversalTriggerEvents\onTurn.onTurn'
...mperialism III Update\LuaTriggerEvents\triggerEvents.lua:100: in function 'triggerEvents.onTurn'
N:\CIV2 TOT\1_Imperialism III Update\events.lua:126: in function <N:\CIV2 TOT\1_Imperialism III Update\events.lua:119>


Seems the Global table doesn't like anything I try.
Is there some file where I should be updating details?
 
Last edited:
A couple issues:
First, you need to define desertTerrain, glacierTerrain, and jungleTerrain as local variables before you use them in the file
Code:
local desertTerrain = 0
local glacierTerrain = 7
local jungleTerrain = 9
Or, you could define them as part of the object table. (I explained the global table issue elsewhere.)
Also,
Code:
if unit.location.terrainType % 9 == glacierTerrain then
if unit.location.terrainType % 7 == jungleTerrain then
should be
Code:
if unit.location.terrainType % 16 == glacierTerrain then
if unit.location.terrainType % 16 == jungleTerrain then

Terrain types are 0-15, in the order they appear in the rules. The terrainType key for tile objects returns an 8 bit number, the last 4 bits of which give the terrain type (the first bit tells if there is river on the terrain, another bit covers specials on the ocean, and the 2 remaining bits determine if a special animation is happening). We only want a number corresponding to the last 4 bits, and we achieve this by using % 16 (A % B computes the remainder of A divided by B).

At the moment, your code will do more than 100% damage to units. One way to deal with that would be
Code:
unit.damage = math.min(unit.type.hitpoints-1,unit.damage+newDamage)
which would always leave the unit with 1 hp.
There is also
Code:
gen.killUnit(dyingUnit)
to kill the unit (and apply any events that should happen if the unit dies).
 
Hi Prof. Garfield and Curt,

Oops! I'm 99% sure that adding this line to the top of file onSchism.lua in the LuaRulesEvents directory will solve the problem. It did in version 3 (I don't currently have 4 installed).
Code:
local legacy = require("legacyEventEngine")
Please let me know if this solves the problem for you.

I did a quick test this morning and the fix worked. I will continue to play after work today. Thank you!

Thanks for the feedback! Really glad you are having fun with the scen.

The Russians are intended to the "challenge" tribe to play - But if you think the MFG goods should be buildable with a more accessible improvement like "local industry", let me know.

If you can report on the bug fix, that would be great. :)

I haven't played the other powers to date but I figured that historically the Russians would be the more 'backward' economically and scientifically during this period and that seems to be case in your scenario.

It's too early to give a definitive answer on the Mfg Goods but the fact that the Russians already start the game with a deficit of over 500 gold per turn places a great burden on them. The fact that they start with over 4000 gold in the treasury only serves to delay the inevitable. I was hoping that building the 'Local Industry' improvements in many of my cities would help to diminish this imbalance but it hasn't to date.

We will have to see. Perhaps capturing Japanese cities will provide me with some extra funds.

Best of luck with the game, @tootall_2012 !

PS
My humble advice is to get a stack of cannons and horsemen under a general.
Japan has some juicy cities near Vladisvostok just asking for conquest![/USER]

To be honest, the Japanese came very close to capturing Vladivostok as their assault was being supported by naval and ground troops in addition to a Japanese General. I was able to deploy a Russian General of my own just in the nick of time to save the city and subsequently dispatch two of their generals. I now have 2 generals of my own operating in Manchuria and are deploying the necessary forces with the ultimate plan to capture Port Arthur.
 
Last edited:
Hi Curt,

Just a quick update on the economic situation. It’s August 1873 and I’ve managed to reduce my initial gold deficit of minus 500 gold per turn to roughly minus 50. I was able to accomplish this in part by building ‘Local Industry’ and ‘Magistrate’ improvements in the cities where it made sense but also mostly by converting roughly 25% of my 450 plus citizens into Taxmen.

In the meantime, as I was able to deliver the final 2 St-Petersburg 'Mfg Goods' units to New-York I pocketed an extra 3200 gold which has given me at least a 60 turn breather and put a stop to the AI selling of my improvements.

As I was able to finalize the starting ‘Amphibious Warfare’ research, I then selected to research ‘Banking’ which I should be able to complete in roughly 40 turns or so (my current research rate is 1 tech per 47 turns). After that I should be able to start building banks in my more prosperous cities and hopefully start generating a gold surplus.

After fighting off hordes of Japanese and German units I believe I’ve finally been able to thin their numbers and have gone over the offensive and managed to capture Harbin and Hsinking in Manchuria and Krakow and Konigsberg from Germany, cashing in an extra 320 gold in total for these cities.

I’m still concerned about my research rate and the chance that I might fall behind technologically but for now there isn’t too much I can do about it.

I like how you’ve restricted the building of some unique units to specific cities/regions, like the Cossacks to the Ukraine basin or Tartar Calvary to Outer Mongolia. I’m not sure why you did the same for Elite Regiments, as I would have thought they might be more associated to specific building requirements.

It’s a very big map with a lot of cities and units, and therefore each turn takes time to complete, so it’s going to be a long game to play. That isn’t a criticism at all but merely a statement of fact. Therefore I don’t expect to be necessarily giving you a play by play of my game but merely to touch base if I run into bugs or have specific questions.

So far the scenario is running very smoothly and I haven’t encountered any other lua bugs to date. I continue to greatly enjoy this very well made scenario.
 
@Prof. Garfield , I request your advice, sir.

Tried an experiment in OnTurn.Lua file to make deserts, jungles and glaciers more dangerous for units.

Did you want me to test this in my current scenario? If so, are you able to send me the appropriate lua files with the associated functionality or have you done other changes to them since?
 
Top Bottom