Imperialism 3 - Now with 100% more Lua!

Got a quick question for @Prof. Garfield ...

I set canBuildSettings in most cities across my map, and these are working well, but for one thing I have noticed. I will use the Boer cities as an example.
Due to a local setting for the Boer cities, I can build the Boer Inf and Cav unit, but despite have the preq improvement (local Ind) to build Labourers, I cannot.

Would it be correct assume that because I have one local rule in place for units in that map zone, it is not allowing other local settings? Like the allimprovement setting for the Labourer?

I attach my file for your inspection, sir.

EDIT:

Fixed it - Had contradictory Labourer canBuildSettings (with both Uni and Local Ind) orders in place...:)
 

Attachments

Last edited:
@tootall_2012

Just a quick update with the labourer bug fix, an update to the barb unit's stats, and some more cities added to the Native Rifle build list.

Open this zip and copy/paste the contents...Everything can overwrite safely. Let me know how things go.
 

Attachments

I set canBuildSettings in most cities across my map, and these are working well, but for one thing I have noticed. I will use the Boer cities as an example.
Due to a local setting for the Boer cities, I can build the Boer Inf and Cav unit, but despite have the preq improvement (local Ind) to build Labourers, I cannot.

Would it be correct assume that because I have one local rule in place for units in that map zone, it is not allowing other local settings? Like the allimprovement setting for the Labourer?

I attach my file for your inspection, sir.

I see you found the problem, but just to be clear: Unless you use the forbidden alternate production parameter, being able to build one unit/improvement/wonder shouldn't have any impact on whether you can build any other item.
 
Understood, all I had done was really use the (un-noticed) extra canbuild setting to add another requirement to training labourers.

With Lua - Every day is a day at school!
 
One more question for @Prof. Garfield , if he can indulge me...

Can a specific unit be made exempt from the effects of the dangerous terrain effects made in the "onturn" lua file?

I'd like to make units like the Berbers immune to desert damage, for instance.
 
One more question for @Prof. Garfield , if he can indulge me...

Can a specific unit be made exempt from the effects of the dangerous terrain effects made in the "onturn" lua file?

I'd like to make units like the Berbers immune to desert damage, for instance.

Here's one way to do it (untested code)

Code:
local object = require("object")
local desertImmune = {}
desertImmune[object.uBerbers.id] = true

function onTurn.onTurn(turn)
    for unit in civ.iterateUnits() do
        if unit.location.terrainType % 16 == desertTerrain then
            local newDamage = math.floor(unit.hitpoints/2)
            if not desertImmune[unit.type.id] then
                unit.damage = math.min(unit.type.hitpoints-1,unit.damage+newDamage)
            end
        end
        if unit.location.terrainType % 16 == glacierTerrain then
            local newDamage = math.floor(unit.hitpoints/2)
            unit.damage = math.min(unit.type.hitpoints-1,unit.damage+newDamage)
    end
    if unit.location.terrainType % 16 == jungleTerrain then
            local newDamage = math.floor(unit.hitpoints/2)
            unit.damage = math.min(unit.type.hitpoints-1,unit.damage+newDamage)
    end
    end
end

You might just want to check
Code:
if unit.owner.isHuman then
and exempt the AI from this kind of damage, since it isn't programmed to deal with it.
 
Made some changes to the tech tree, hopefully nothing hair-raising - I wanted to make things more sensible in the steel/artillery/naval/vehicle chain that affects the late game.

I am going to test things out in my playthrough, and see how the progression to modern steel weapons and ships pans out...
 
Tech tree update working out fine so far, no loops or crashes...(fingers crossed) New Barb stats are interesting.
Zulus are more of a pain to defeat, and next I plan to test out Prof's idea to make certain barbs immune to terrain.

In the meantime, my favourite popup just appeared...Many dead Chasseurs will pile up in front of my forts!
MG1.png
 
Just a little player note:
I like how mini-campaigns can erupt in each playthrough. In my seemingly never-ending war with the French, they have used Madagascar as a base to kill (and capture) my poor labourers
on the South-East African coast. Their cowardly naval attacks on my unarmed freighters also called for the introduction of light cruiser escorts all the way from Europe down to Port Stanley.
I peeled two of these fast cruisers off to South Africa to help out. Now these two schnell-boots are based in Sofala, doing hit and run raids, and sinking the French gunboats in the area.
They will soon be joined by a cargo ship for any stray workers my navy "rescues."

This kind of organic mini-war is exactly what I wanted to give the player. Lua has made it possible, and fun. With no African colonial navy,
I shipped down two advanced vessels from Europe to a low tech colony, where they are running riot. Good times. And fairly realistic.
 
Here's another update:

It’s March 1876 (turn 75) and I’ve completed my European conquest of Germany save the lone city of Goteborg in Scandinavia which should fall shortly. That leaves Germany primarily with possessions in Africa and China where it has been very active on both fronts.

France also launched a pre-emptive attack on me 10 turns previously but I was easily able to repulse their initial onslaught and have since captured Amsterdam, Brussels, Paris, Lyon and Marseilles from them. All the same the conquest of this country has been more difficult than expected both in funds and units (particularly artillery) and the constant harassment of the very powerful British navy (though I just signed a cease fire with that nation the previous turn). I’m now on pause as I try to reinforce my frontline with fresh troops.

My Far Eastern campaign has been successful as well as I’ve managed to expel Japan from Manchuria, Korea and northern China where I’ve liberated Peking, Tatung and Pantow. That leaves them only in possession of Hongchow in China proper. On the other hand, this leaves me in direct contact with the German Chinese city acquisitions (delimited by the triangle of Tsingtao - Sian - Shanghai).

Economically, my gold surplus has remained relatively stable and though the capture of enemy cities has provided much welcome extra cash my offensives have been costly and the extra improvements I have to support has prevented me from accumulating a large gold reserve in my treasury.

I like this economic challenge as I continually have to balance between my military needs and civilian economy (as supporting all my 833 improvements costs 1793 gold per turn to maintain). Making the Grand Rail Station a prerequisite building for the Mfg Goods was the correct decision as it 1) prevents the player from building an overabundance of these units and 2) thereby forces them to rely much more on their overall managerial skills instead of using the trades units to buy their way to victory.

So far, I’ve only managed to build four extra Mfg Goods (3 in Moscow) and only just delivered 2 of them to New-York for a total bonus of 3800 gold thereby increasing my treasury to 4112 gold pieces.

Research wise my tech rate is down to one advance per 22 turns and I currently have discovered 27 techs, 2 of which I acquired through trade. By comparison the Americans have 38, Britain 36, France 33, Germany 30 and Japan and the Independents 28 each. I'm not certain exactly how many techs you can research during the game though a very rough count indicates at least 60. As the scenario is 400 turns long, even if I managed to reduce my overall average game tech rate to say 1 tech per 12-15 turns that would mean I probably won't be able to research more than 26 to 33 advances for a maximum total of 60 out of 99.

I currently possess 83 schools and 46 universities with a reaseach rate of 40% and as I've indicated I've converted roughly 25% of my citizens to taxmen to achieve my small gold surplus. Therefore, converting them to scientist or increasing the science research rate is not really an option for me as I would quickly return to deficits again.

For now this is just a rough estimate but this very slow pace is no doudt a result of the 400/10 tech paradigm you've selected for the scenario. I'll be able to give a more accurate picture once I've completed the game but I suspect one of my recommendations might be to lower the tech paradigm.

Just a quick note: as other designers I've tested their games for may attest, my play by play feedback is to provide them with a sense of whether the game is behaving as they intended and if not whether they feel adjustments are required. Any recommendations I make are just that recommendations and it's up to them to decide whether they wish to act on them or not.


@tootall_2012
Just a quick update with the labourer bug fix, an update to the barb unit's stats, and some more cities added to the Native Rifle build list.
Open this zip and copy/paste the contents...Everything can overwrite safely. Let me know how things go.

Thanks. I somehow missed to see this update. I downloaded it today.

One more question for @Prof. Garfield , if he can indulge me...
Can a specific unit be made exempt from the effects of the dangerous terrain effects made in the "onturn" lua file?
I'd like to make units like the Berbers immune to desert damage, for instance.

Yes, I highly recommend you go forth with this change as I previously indicated the Barbarian units went from being a regular threat to almost inconsequential since attrition has been implemented.
Made some changes to the tech tree, hopefully nothing hair-raising - I wanted to make things more sensible in the steel/artillery/naval/vehicle chain that affects the late game.

I am going to test things out in my playthrough, and see how the progression to modern steel weapons and ships pans out...

I'm not sure if it's too late for me to incorporate a different tech tree into the game. As I mentioned above, at this time, I've only discovered 27 advances and are currently researching 'Ironclad Ships'. Let me know if you think it isn't too late to make the switch.

Just a little player note:
I like how mini-campaigns can erupt in each playthrough. In my seemingly never-ending war with the French, they have used Madagascar as a base to kill (and capture) my poor labourers
on the South-East African coast. Their cowardly naval attacks on my unarmed freighters also called for the introduction of light cruiser escorts all the way from Europe down to Port Stanley.
I peeled two of these fast cruisers off to South Africa to help out. Now these two schnell-boots are based in Sofala, doing hit and run raids, and sinking the French gunboats in the area.
They will soon be joined by a cargo ship for any stray workers my navy "rescues."

This kind of organic mini-war is exactly what I wanted to give the player. Lua has made it possible, and fun. With no African colonial navy,
I shipped down two advanced vessels from Europe to a low tech colony, where they are running riot. Good times. And fairly realistic.

I totally concur. I truly feel like I'm running separate campaings in my game. Each having to deal with it's own special requirements and needs and unique adversaries. I've said it before but it's worth repeating this is a truly well designed and fun scenario to play. There are just so many different factors you have to keep track off. Very well done indeed!
 
Last edited:
Thanks for the excellent post/feedback, and the kind words too, sir!

I am going to very soon try out the barb-terrain upgrade, and the new tech-tree seems to work fine. It might be a case for a new playthrough, to stop chaos in your game.
I will be back on Monday with a new update, and I am very please to hear the scenario is mostly in balance and shaping up - I appreciate your help greatly. :)
 
Having a weird issue....some of the units are showing as original TOT units.

Am I missing a setting or something, please?

Thanks!
 

Attachments

  • Screenshot from 2021-03-28 20-21-47.png
    Screenshot from 2021-03-28 20-21-47.png
    151.6 KB · Views: 54
Ok then what you need to do (or perhaps @CurtSibling would be willing to at some poimt) is to go into the rules, @unitadvanced (towards the bottom) and then change the appropriate colum (towards the.right but I don't recall offhand--there are instructions in the rules) and change the value of the unit to -1.
 
That's odd...I'll look into it.

I had indeed made some of the units hide their SPR setting in order to make my alpha SPR file that was made for them work properly.
As far as I know, @tootall_2012 is not having the same issue as @miccal2000 , I am not either...

So I am wondering if there is some setting in his (or mmy onw) ToT options that needs to be addressed?
My GFX menu is greyed out too...
 
OK, tested it. When I used the "over-ride SPR" option in @UNITS_ADVANCED, it voids the tribe colour SPR I am using for generic units.
Except for the worker and engineer units, who need the SPR over-ridden to show the SPR colours, which doesn't make sense to me...
I am guessing this is what @miccal2000 is seeing. There should be a file called "Static.spr" in his Imperialism III folder...Can he report if he has it?

Attached, and recommended to drop into the Imperialism III folder.
 

Attachments

Here's one way to do it (untested code)

Code:
local object = require("object")
local desertImmune = {}
desertImmune[object.uBerberCavalry.id] = true

function onTurn.onTurn(turn)
    for unit in civ.iterateUnits() do
        if unit.location.terrainType % 16 == desertTerrain then
            local newDamage = math.floor(unit.hitpoints/2)
            if not desertImmune[unit.type.id] then
                unit.damage = math.min(unit.type.hitpoints-1,unit.damage+newDamage)
            end
        end
        if unit.location.terrainType % 16 == glacierTerrain then
            local newDamage = math.floor(unit.hitpoints/2)
            unit.damage = math.min(unit.type.hitpoints-1,unit.damage+newDamage)
    end
    if unit.location.terrainType % 16 == jungleTerrain then
            local newDamage = math.floor(unit.hitpoints/2)
            unit.damage = math.min(unit.type.hitpoints-1,unit.damage+newDamage)
    end
    end
end

You might just want to check
Code:
if unit.owner.isHuman then
and exempt the AI from this kind of damage, since it isn't programmed to deal with it.

Nice work, Prof - I have some AI Berbers ready to enter the desert next turn, so we will see how they fare.
Also, if I want to add more units to the immunity, I would just add a new line to that "true" table?
If all goes will, I will create jungleimmune and glacierimmune and add some units to that too.
 
Oddly enough, the worker and engineer both lost their colours when I reloaded, and when I removed their spr-override "1",
they both of course showed the tribe colour on their shirts like they are meant to. Why they needed the "1" previously is
one of those wonderful CIV2 mysteries that even David Paulides would be stumped over.

I'll wait and see what happens with @miccal2000 's sitaution. We'll crack this, I am sure.
 
I've added two new rows of units for the scenario, in order to combine the update with the generals version. I also am hoping to get
a unit promotion system going that will transform lucky winning units to the "elite" version or a "guards" type. More on that later.

Also, I have added in the generals for each tribe, and the "upgrade" units. I want the French Foreign Legion to be recruitable in North
Africa too. Guerillas will be a new barb in Mexico. Japan now has Imperial infantry again. I have four blank slots, reserved for barbs.

Here is the roster at the moment:
Units_Elites.png

I am open to ideas! Region-based natives and baddies to harrass the colonials are most welcome.
 
Last edited:
Back
Top Bottom