Resource icon

C3X: EXE Mod including Bug Fixes, Stack Bombard, and Much More Release 20

FYI: I have been experimenting and this is how the extra unit is created - you try and build a unit that has reached the number limit. You get the pop-up and go to city view. You pick a building instead of another unit, one where you have enough shields to build it immediately. Bingo: you get the building and a free unit.

I've set limits for every unit, why not, however it is tricky to manage since it's not clear when you'll hit the limits, I can't even see an easy way to find out how many cities I have. It woud be helpful to know on some menu or list how many units of each type you are free to build if a limit has been set. I spend a lot of time managing production and trying to work out if it is worth trying to build something, you can waste a lot of shields for the big units when you are forced to switch. It's easy to set too many cities to build units when you've only one more to go.
Maybe the info could be a part of the military advisor view? Though I'm not sure how it would work to find per unit.
 
FYI: I have been experimenting and this is how the extra unit is created - you try and build a unit that has reached the number limit. You get the pop-up and go to city view. You pick a building instead of another unit, one where you have enough shields to build it immediately. Bingo: you get the building and a free unit.

I've set limits for every unit, why not, however it is tricky to manage since it's not clear when you'll hit the limits, I can't even see an easy way to find out how many cities I have. It woud be helpful to know on some menu or list how many units of each type you are free to build if a limit has been set. I spend a lot of time managing production and trying to work out if it is worth trying to build something, you can waste a lot of shields for the big units when you are forced to switch. It's easy to set too many cities to build units when you've only one more to go.

Edited to add: looks like you also need a full set of shields for the unit you were trying to build.
Thanks for the info. I've figured out what's going on here, it was basically an oversight on my part. That popup about the unit limit being reached gets opened during the unit creation logic and after you close it the game finishes running that logic which spawns some unit. I forgot that you could switch to a building during that time, of course if you do then spawning a unit is a mistake. By the way, the unit that you get from that glitch is one with the same type ID as the ID of the building you selected to build. That's because cities track the ID of what they're producing and whether it's a building or a unit, if you run the unit spawner with a building in production it interprets the city's production ID as a unit type ID. Anyway, this will be fixed in future versions.

I'll see if I can find a good way to show the current unit limits to the player. The military advisor screen would make sense although it might not be easy to modify. It's also not convenient to check all the time. Ideally I could place the limits right there in the city screen.
 
Been playing Tides of Crimson, and wow, the Ai is great at artillery pushing. - partly because the mod has a mix of "pure artillery" without defence, and "ranged units" that have normal attack as well as bombard. The AI will happily escort it's artillary with even more artillary!

Other than that, I have a weird wish. It would be nice if there was a setting so armies spawned by MGL's are automatically upgraded to the latest available unit in the chain when spawned. -This would effectively allow mods to use unique unit armies, for both flavour and gameplay.
Right now, the best that can be done is either having Military great leaders upgrade (which wouldn't guarantee the AI brings it back to upgrade), or having a base army unit that then needs to be upgraded (which would take two turns and wouldn't get upgraded by the ai unless the closest city happens to have a barracks.)
 
Thanks for the info. I've figured out what's going on here, it was basically an oversight on my part. That popup about the unit limit being reached gets opened during the unit creation logic and after you close it the game finishes running that logic which spawns some unit. I forgot that you could switch to a building during that time, of course if you do then spawning a unit is a mistake. By the way, the unit that you get from that glitch is one with the same type ID as the ID of the building you selected to build. That's because cities track the ID of what they're producing and whether it's a building or a unit, if you run the unit spawner with a building in production it interprets the city's production ID as a unit type ID. Anyway, this will be fixed in future versions.
The small fix for changing production to something other than a unit while the popup for reaching the unit-limit is running works very well (I copied the code lines you added in the injected_code.c directly from github because the bug was quite annoying) Thank you for dealing with the problem so quickly! :thumbsup:
 
I'll see if I can find a good way to show the current unit limits to the player. The military advisor screen would make sense although it might not be easy to modify. It's also not convenient to check all the time. Ideally I could place the limits right there in the city screen.
I'm wondering if there's a way to apply the unit cap in "real time" by calculating fielded and pending units together. Civ4 works with limited units (three missionaries per faith at a time), and as soon as any combo of active/producing is reached, they're blocked from the city build selection.
 
I managed to track down the bug related to the "Disables Diseases From Flood Plains" tech flag. The problem there is simply that the original developers called the wrong function. Instead of checking if players have a tech with that flag, the code checks if players have a tech of a given ID and pass that flag as the ID. That flag is encoded with a value of 8, so the code checks if players have tech #8, which is Writing under the standard game rules. That tracks with my experience that flood plains disease is a problem in the very early game but at some point even before the medieval era it disappears. I had assumed that the rate of disease was tied to how many years passed, like volcanic eruptions, but turns out it's actually Writing that cures disease.

I'm not sure this bug was even worth fixing, after all who would want to suffer flood plains disease all the way to the early industrial era? Disease is one of the worst and most annoying game mechanics. For that reason I'll leave the bug fix off by default unlike all the other fixes.


Other than that, I have a weird wish. It would be nice if there was a setting so armies spawned by MGL's are automatically upgraded to the latest available unit in the chain when spawned. -This would effectively allow mods to use unique unit armies, for both flavour and gameplay.
Right now, the best that can be done is either having Military great leaders upgrade (which wouldn't guarantee the AI brings it back to upgrade), or having a base army unit that then needs to be upgraded (which would take two turns and wouldn't get upgraded by the ai unless the closest city happens to have a barracks.)
I'll look into this. It might be awkward because of the way the military academy requirement for upgrading armies is tied into the upgrade logic. Earlier I looked into removing that requirement but in the end decided it was more trouble than it was worth.


I'm wondering if there's a way to apply the unit cap in "real time" by calculating fielded and pending units together. Civ4 works with limited units (three missionaries per faith at a time), and as soon as any combo of active/producing is reached, they're blocked from the city build selection.
That's possible and it could be done in the straight forward way of checking what every city is producing and has in its queue to sum up how many units of a given type are pending. It would be more efficient to maintain a set of counters of how many of each type of unit are queued or being produced, and update those counters whenever city production changes, but that would require more effort to program. Half the reason I didn't program it that way to begin with is that I was lazy and the other half is that I find it annoying in Civ 4 how the unit limits stop you from queueing up units. Often I need, say, 5 missionaries but can only queue up 3 or 4 and then after I use the first ones I forget to queue up more. I wish Civ 4 would let me queue as many as I wanted and apply the limit only before the units enter production. In Civ 3 you can change production at any time so there's even less need to apply the limits ahead of time.
 
I managed to track down the bug related to the "Disables Diseases From Flood Plains" tech flag. The problem there is simply that the original developers called the wrong function. Instead of checking if players have a tech with that flag, the code checks if players have a tech of a given ID and pass that flag as the ID. That flag is encoded with a value of 8, so the code checks if players have tech #8, which is Writing under the standard game rules. That tracks with my experience that flood plains disease is a problem in the very early game but at some point even before the medieval era it disappears. I had assumed that the rate of disease was tied to how many years passed, like volcanic eruptions, but turns out it's actually Writing that cures disease.
Thank you very much for this find. :)

Is tech #8 connected only to the position of that tech in the editor, so each tech on position 8 of the editor (starting with tech 0, so by counting the advances in the editor it is the ninth advance) triggers the cure from disease, or is it additionally also necessary to be connected to the headline of the pediaicons entry of the tech Writing ?

With other words, to switch the cure from disease by modding, is it sufficient to switch the entry for the tech Writing in the editor to a tech with a different name and pediaicons entry placed in era 3 or 4 of the game, or is for such a switch the new tech additionally still needing the civilopedia entry for the tech Writing? Is it sufficient that the techs Sanitation and Writing are only switched in the editor, but can keep their original pediaicons entries or must the tech Sanitation now keep the headline of the pediaicons entry of the tech Writing (and the tech Writing a new pediaicons entry - may be Sanitation) ?

There are situations in mods and scenarios, where it can be very useful to have "tiles of doom".
 
Last edited:
I mean, I wouldn't expect civilopedia entries to matter, since they aren't tied to tech ID the same way. Would be nice to be able to move it around more simply though.
 
I mean, I wouldn't expect civilopedia entries to matter, since they aren't tied to tech ID the same way. Would be nice to be able to move it around more simply though.
The pediaIcons file and the civilopedia file are two different civ 3 text files. The city view graphics per example seem to be tied to the pediaIcon entries, that´s why CCM 2.5 has very different civilopedia headline entries for many of the buildings which are in that mod with heavily modified city view graphics.
 
This has happened to me several times. I have taken over a city and there is a choice capture or destroy the city. Several times I have accidentally destroyed the city when I did not want to. Would it be possible to have a "are you sure" dialog box?
 
cena.png
 
Thanks for the info. I've figured out what's going on here, it was basically an oversight on my part. That popup about the unit limit being reached gets opened during the unit creation logic and after you close it the game finishes running that logic which spawns some unit. I forgot that you could switch to a building during that time, of course if you do then spawning a unit is a mistake. By the way, the unit that you get from that glitch is one with the same type ID as the ID of the building you selected to build. That's because cities track the ID of what they're producing and whether it's a building or a unit, if you run the unit spawner with a building in production it interprets the city's production ID as a unit type ID. Anyway, this will be fixed in future versions.

I'll see if I can find a good way to show the current unit limits to the player. The military advisor screen would make sense although it might not be easy to modify. It's also not convenient to check all the time. Ideally I could place the limits right there in the city screen.

Nice work, thanks! LImits in the city screen would be ace, ideally the number of units left, i.e. limit minus number already built = free to build X more

I do have another little niggle:

Building generating resources : Love this feature, always wanted to add a flat defined bonus to buildings, but not quite figured out the display. I set '"Coal Mine": yields Buildbonus2' and created a bonus resource of that name that adds shields (blank icon). Worked great, little shields appear next to the mine in the improvements list. Added a few more with gold and food, or a mixture, all good. However the little icons disappear if you set the food to a minus (need to feed those miners). It still appears to work, but there's no indication that it does. Adding 'show-bonus' did nothing. Am I missing something or does a minus food break the icons?
 
Is tech #8 connected only to the position of that tech in the editor, so each tech on position 8 of the editor (starting with tech 0, so by counting the advances in the editor it is the ninth advance) triggers the cure from disease, or is it additionally also necessary to be connected to the headline of the pediaicons entry of the tech Writing ?
Just the first thing. The game simply checks for tech #8, which is the ninth tech in the list since the first one is #0. That happens to be Writing under the standard game rules. Whatever tech you place in that slot of the list will be the one that stops disease from flood plains. It's a very strange rule but that's because it's a bug, the original developers did not intend for it to work like that.

I have taken over a city and there is a choice capture or destroy the city. Several times I have accidentally destroyed the city when I did not want to. Would it be possible to have a "are you sure" dialog box?
Yes it would be possible. In fact it would be relatively easy.

However the little icons disappear if you set the food to a minus (need to feed those miners). It still appears to work, but there's no indication that it does. Adding 'show-bonus' did nothing. Am I missing something or does a minus food break the icons?
You're not missing anything, I never did get around to adding icons for negative yields. I remember someone asked for that before. I looked into it and there's no reason it couldn't be done. The only little issue is that the game doesn't already have small red icons for all yield types, IIRC it was food that was missing. So I put the matter aside for a while and then just kind of forgot about it. It is something I'd like to do though, maybe soon. The yield display feels incomplete without it.
 
Just the first thing. The game simply checks for tech #8, which is the ninth tech in the list since the first one is #0. That happens to be Writing under the standard game rules. Whatever tech you place in that slot of the list will be the one that stops disease from flood plains. It's a very strange rule but that's because it's a bug, the original developers did not intend for it to work like that.


Yes it would be possible. In fact it would be relatively easy.


You're not missing anything, I never did get around to adding icons for negative yields. I remember someone asked for that before. I looked into it and there's no reason it couldn't be done. The only little issue is that the game doesn't already have small red icons for all yield types, IIRC it was food that was missing. So I put the matter aside for a while and then just kind of forgot about it. It is something I'd like to do though, maybe soon. The yield display feels incomplete without it.

Thanks - I'll go ahead and add this feature and use, it's so good - hope negative food icons get added at some point. Anyway to turn off all the little icons? Hide-non-bonus just does lux and strategic right? BTW I experimented with multiple bonus resource assigned to a building and it didn't seem to work - made it easier to add lots of variations without creating a mass of new resources.

Idea: Since the number of strategic resources a civ has have is a known variable (I assume) you could add an extra feature to the unit numbers function by having the option to multiply it by the number of resources a unit requires, or a fraction (double is quite a jump), so if you had two iron you could build more swordsmen than you've defined, with a default of x1. You would have to allow for multiple resources required for a unit, checking for the lowest value first. Just a thought. It adds the extra dimension of a large civ running on one resource fighting to get another so they can build more decent units and small civs with more than one getting a boost.
 
Last edited:
The only little issue is that the game doesn't already have small red icons for all yield types, IIRC it was food that was missing.
Perhaps the food-eaten graphic from the growth box could be used/resised (as a placeholder at least)?

I have a couple of questions (with probably obvious answers) regarding the resource yields myself:

1. If you have multiple improvements in a city which produce the same bonus resource, will you get the increased yields from each improvement?

2. Are they subject to the normal calculations vis-a-vis corruption and the despotism penalty? (I think the latter has been explicitly answered before but I can't remember)
 
Here's a CivIII bug you might not have tackled yet - the offset overlay when you use landmark terrain on a custom map - instead of neatly covering a square it sits over the grid lines, centred on an intersection. It's a mess so is of limited use: it cannot be used near water for example and it's not obvious which square is actually the LM one. If fixed you basically get a whole new set of possible terrain types: steppes, scrubland, peat bogs, ancient forests, foothills or whatever. Ever looked into it?
 
That's not really a "bug" per say, more of a technical limitation on how the game does graphics.

One thing that would be nice is if there was a way of getting landmark terrain in the epic game, either through worldgen or IDK... some worker action? Maybe landmark forests for plant forest.
 
Thanks - I'll go ahead and add this feature and use, it's so good - hope negative food icons get added at some point. Anyway to turn off all the little icons? Hide-non-bonus just does lux and strategic right? BTW I experimented with multiple bonus resource assigned to a building and it didn't seem to work - made it easier to add lots of variations without creating a mass of new resources.
I'll get the negative yield icons working soon.

Right now there's no way to hide the yields. You can turn off the resource icons that appear over the building icons by setting hide-non-bonus. That hides the strat and lux icons, the bonus ones are already hidden unless otherwise specified. It would be easy to make it possible to hide the yield icons too, but is that something you really want? I didn't bother including that as an option because I thought it would be confusing & annoying for players to have extra yields coming seemingly from nowhere.

Multiple bonus resources on the same building should work, I don't know why it wouldn't. To clarify, do you mean multiple of the same bonus resource or different ones? I'm pretty sure I tested different ones but I might not have considered multiple instances of the same resource.


Idea: Since the number of strategic resources a civ has have is a known variable (I assume) you could add an extra feature to the unit numbers function by having the option to multiply it by the number of resources a unit requires, or a fraction (double is quite a jump), so if you had two iron you could build more swordsmen than you've defined, with a default of x1. You would have to allow for multiple resources required for a unit, checking for the lowest value first. Just a thought. It adds the extra dimension of a large civ running on one resource fighting to get another so they can build more decent units and small civs with more than one getting a boost.
It would be relatively easy to make unit limits vary based on resource counts, so you could specify, for example, "Swordsman: 3 per Iron" like you can do "3 per-city" now. One little catch there is that players might have multiple trade networks, though the simple solution would be to take the resource counts from the capital's network and ignore the others. The real problem though is that the resources wouldn't really be consumed by the units that require them, so unlocking Med Infantry would let you build a new set of units based on your iron resources but you'd have those units in addition to, not instead of, the old swordsmen. Tracking resources consumed by units would be another layer of complexity, possible but definitely not easy. Same for having multiple resource limits on the same unit type.


Perhaps the food-eaten graphic from the growth box could be used/resised (as a placeholder at least)?
I have a couple of questions (with probably obvious answers) regarding the resource yields myself:
1. If you have multiple improvements in a city which produce the same bonus resource, will you get the increased yields from each improvement?
2. Are they subject to the normal calculations vis-a-vis corruption and the despotism penalty? (I think the latter has been explicitly answered before but I can't remember)
Maybe. I'll program it and use a reddened food icon for now. We can experiment with different icons later.

1. Yes.
2. Yes for corruption but no for the despotism penalty. Yields from buildings are added to the total that the city collects from its tiles. That total then goes through building modifiers and corruption. However the building yields aren't affected by the despotism penalty because the penalty is applied on a per-tile basis and the building yields aren't associated with any tile.


Here's a CivIII bug you might not have tackled yet - the offset overlay when you use landmark terrain on a custom map - instead of neatly covering a square it sits over the grid lines, centred on an intersection. It's a mess so is of limited use: it cannot be used near water for example and it's not obvious which square is actually the LM one. If fixed you basically get a whole new set of possible terrain types: steppes, scrubland, peat bogs, ancient forests, foothills or whatever. Ever looked into it?
That's interesting, I've never even heard of this never mind tackled it. Can you be more specific about what the bug is, like what you see in game versus what you expect to see?


One thing that would be nice is if there was a way of getting landmark terrain in the epic game, either through worldgen or IDK... some worker action? Maybe landmark forests for plant forest.
Oh right, I remember looking into this before. I could modify the map generator but if I were to do that I'd rather go all the way and replace it with a Lua script. Making it so that workers plant LM forests should be simple, though.
 
Top Bottom