Can't build unit with nil prerequisites and allowed to my tribe

Pablostuka

King
Joined
Mar 27, 2002
Messages
810
Location
Galway, IE
Hi all,

I am struggling with two unit types that I can't build where I should. For some reason I cannot build them despite not having any particular tech prerequisites, not going obsolete, and being allowed in the @UNITS_ADVANCED section. There are no typos in the Rules file as the scenario loads normally.

See for instance the following two units (@UNITS) with no prerequisites, no expiration, etc:

Republican infantry, nil, 0, 2.,0, 6a,4d, 2h,1f, 2,0, 0, nil, 0000000000000000
Anarchist militia (CNT/FAI), nil, 0, 1.,0, 4a,4d, 1h,1f, 1,0, 1, nil, 0000001000000000


See their configuration in @UNITS_ADVANCED

00000100, 00000000, -1, 0000000000000000,0000000000000000,0000000000000000, 10000000 ;Republican infantry
00000100, 00000000, -1, 0000000000000000,0000000000000000,0000000000000000, 10000000 ;Anarchist militia (CNT/FAI)


Section A, flag 00000100 means that only the Republican Spanish can build them. As you can see, both units have the same flags, same prerequisites, etc, just different stats, AI role and alpine flag.

In game, only the second unit is buildable (Anarchist militia (CNT/FAI)), but not the first (Republican infantry), see screenshot:

2022-02-12 03_38_35-What shall we build in Málaga_.png


But the unit is buildable as per Pedia (otherwise I'd see the red text "You cannot build this unit"):

2022-02-12 03_47_47-.png



I am having the exact same issue with the Nationalist infantry for the other tribe, I can build other units with the same flags but not that one :).

Given these 2 are units placed in slots 5 & 6 of the Units file, I thought that maybe the reason behind this would be because of the Gunpowder advance, which "Makes obsolete all defensive role units with a defence strength less than that of the unit in the musketeer slot of the RULES.TXT.". But no, because:

1) The tribes don't have the Gunpowder tech, I have disabled it just in case.
2) The AI role for the unit I can't build is 0 = Attack , so it's not a defensive unit.
3) I have temporarily amended the stats of the "musketeer slot" unit to have less defence than the infantry.

So I ran out of ideas and got tired of trying things with no luck. Any ideas?

Many thanks,

Pablo
 
It's not only the Gunpowder advance which triggers special obsolescence behavior. The units in the Musketeers slot (7) and the Knights slot (19) do this as well. If either of those units are buildable (regardless of what technology enables this) that can also cause other units to become obsolete.

EDIT: Sorry, I see you already tried editing the defense value of the unit in the Musketeers slot. Did you do the same to the Knights slot?

I've seen design guides that recommend not using those unit slots (7 and 19) at all, or using them only for barbarian units that no AI or human tribe will ever be able to build.
 
Last edited:
the Knights slot (19) do this as well. If either of those units are buildable (regardless of what technology enables this) that can also cause other units to become obsolete.

Did you do the same to the Knights slot?

Thanks for that, no, I didn't do the same, didn't even remember about the knights, only about the musketeers and the gunpowder advance. But the weird thing is that these unit slots worked fine before I re-did the tech tree entirely so must be something with techs. I will investigate, thanks for the tips.


Thanks! Will check definately. Argh I feel like a newbie again :D
 
I've seen design guides that recommend not using those unit slots (7 and 19) at all, or using them only for barbarian units that no AI or human tribe will ever be able to build.

I make it a point to try and use these slots for naval or air units as that seems to stop the issue.
 
FYI, the code generator for buildability settings has a checkbox to override the standard Civ II rules for making an item available. I'm pretty sure it overrides that hiding of units. (Of course, you'll have to also specify all the regular building requirements as conditions for building the units then.)
 
Thanks for that, no, I didn't do the same, didn't even remember about the knights, only about the musketeers and the gunpowder advance. But the weird thing is that these unit slots worked fine before I re-did the tech tree entirely so must be something with techs. I will investigate, thanks for the tips.
Then I'd try removing all techs from the tribe with the issues. When they have absolutely zero advances, can you build the unit in question? If not, then the issue must be related to the availability of another unit (which also has a nil prerequisite). But if that works, then you can add one tech at a time and check to see when the problem starts. The issue would either be that tech slot, or with a unit enabled by that tech.

FYI, the code generator for buildability settings has a checkbox to override the standard Civ II rules for making an item available. I'm pretty sure it overrides that hiding of units. (Of course, you'll have to also specify all the regular building requirements as conditions for building the units then.)
Medieval Millennium has fully customized Lua code for onCanBuild(), and I can confirm that this makes it possible to avoid all of the built-in obsolescence behaviors of tech or unit slots.
 
Yes that's exactly what I am going to do. I had also issues removing techs from a particular tribe (I opened another thread on it) so I'll start from scratch.

I have exported my map to .MP using Mapedit (took the opportunity to expand some areas and do some tweaks). Then later I'll start a brand new original game on it (having replaced the original rules.txt with mine) choosing my tribes, and will save it as a scenario. Then I will run @Prof. Garfield 's script to migrate my cities and units into the new game. Hopefully this will fix all issues I am facing both from tech tree and unti obsolescence.

Fingers crossed
 
Hi, quick update. I did what I said I'd do in my previous post and that fixed everything except the unit obsolescence.

In the end, I switched the musketeer and knight unit slots for a rocket and a naval unit, and the issue was instantly fixed, I can build everything I'm supposed to. That was quick! Thanks @Knighttime, @CurtSibling, @JPetroski for your advice on these special slots. I didn't have that issue in my MGE scen so was not familiar with it :)
 
Top Bottom