[BNW] Can't build civilian units

nguyenforthewin13

Chieftain
Joined
Jul 5, 2017
Messages
35
Originally, I thought I just couldn't produce civilian units in my mod. The problem has changed somewhat.

I'm not sure why, but in my mod, it is impossible for any of the Civs to produce unmodded units - that is, brand new units (almost all uniques) that I added into the scenario. At first, I thought it was just an issue with Archaeologists, but then I realized I couldn't build Caravans, Cargo Ships, or Workers either, and then after that I noticed I couldn't build base-game units like Destroyers and Missile Cruisers. Does anybody know why this might be happening? All of the original units the new civs can't produce are on the map where I placed them in World Builder and are visible in the Tech Tree, but for whatever reason, I cannot build them with any civ in my scenario. I can't build a Nuclear Missile, but I can build the M113 Mechanized Infantry I added in. Again, what could cause this to happen?

EDIT: I also just noticed that while I can purchase Missionaries with Faith, I can't purchase Inquisitors. As for Gold purchases, I can only purchase the same units I can produce.
 
Last edited:
descriptions of your troubles isn't going to give enough of a clue as to what is wrong. a look at the mod-portion of the scenario (as opposed to the map) would be needed. If the overall size of the mod is very large, it may be necessary to copy the mod-folder from the game's mods folder to some other location and eliminate all the dds files before zipping and attaching (or uploading to a file-sharing site).
 
Alright, I've zipped the file up sans art and sans sounds. It is a rather large mod.

If possible, could you also investigate my Syria civ? Some weird thing with that civ causes it, but not the others, to crash when I start a game as it. I may have fixed the problem already, but I'm not sure since I haven't tested it yet. Thanks.

EDIT: Okay, playing Syria still crashes the game. No clue what the problem is because it is undetectable via logs. Please, if you can, take a look at it.
 

Attachments

  • Europe 2014 Condensed.zip
    415 KB · Views: 111
Last edited:
Okay, LeeS, I found the cause of the problem in SQLite - somehow, the obsolete tech of every single non-modded unit got set to Advanced Ballistics, which is why I was incapable of building anything. Every Civ, since this is a modern scenario, has Advanced Ballistics.

My questions then though are: why did this happen? I don't think I set the Obsolete Tech of all these units to be Advanced Ballistics. And why did it affect the base-game units, but not the modded ones? I'm going to scour my XML to see if I did anything weird.

If push comes to shove, I will just set the Obsolete Tech for all the affected units to Future Tech and see if that fixes the problem, since Future Tech can obviously never be researched fully.

As for the Syrian civ problem, I still have no clue.

EDIT: Alright, so these are the references I have to Advanced Ballistics in my code.

Code:
        <Update>
            <WhereType="UNIT_BATTLESHIP"/>
            <Set ObsoleteTech="TECH_ADVANCED_BALLISTICS"/>
        </Update>
        <Update>
            <Where Type="UNIT_BOMBER"/>
            <Set ObsoleteTech="TECH_ADVANCED_BALLISTICS"/>
        </Update>
        <Update>
            <Where Type="UNIT_AMERICAN_B17"/>
            <Set ObsoleteTech="TECH_ADVANCED_BALLISTICS"/>
        </Update>

Did I do this wrong? I'm guessing that some error I did in the way I set the new Obsolete Techs affected all the other units, and that the unmodded units are unaffected because they are not part of the original database.

EDIT 2: Oh wait, I'm dumb. I can see now from the code right there - in that first row, I forgot a space between Where and Type. My bad.
 
Last edited:
You have this twice
Code:
<UpdateDatabase>XML/Buildings/BuildingClasses.xml</UpdateDatabase>
This will not cause a CTD, however.

With the dds files removed I wasn't able to run the mod so wasn't able to see what if anything the game was giving as an error re the Syria civ. But I don't see anything obviously wrong with the code, so perhaps the issue is with the map ?

I saw the same thing with the oops in your update but you already posted about it.
 
LeeS, I fixed a bunch of bugs and added additional stuff to the mod in the past few hours. These are the two bugs I'm trying to deal with:

1. Playing Syria causing the game to crash at the loadscreen (also, most Lua codes fail to fire when playing Syria)
2. Not being able to purchase Inquisitors (I can purchase Missionaries, but the reason Inquisitors can't be purchased by any players, religion founders or not, is unclear to me. It may be that the game doesn't consider the religions enhanced because of the way the Lua implements religions, but at the same time, I think I recall being able to use Inquisitors in the Earth 2014 mod).

And small warning: the mod seems to be mostly stable, with the exception of the Syria problem, but the map is really gigantic and has 446 cities on it. My computer handles it just fine, but I just wanted to note that. So here's the compressed version of the full mod as it is right now, if you have the time to look at it. Thanks for all the help over the past few days.

I've put the mod here in three pieces because it was too big to upload as one file. Basically, just unzip all the folders, and place the Art folder inside the Europe 2014 folder and the Atlases inside the Art folder. There is a massive amount of Art, which makes up like 99% of all the space. Again, thanks for the help.

EDIT: Whelp, things just got a bit worse. Apparently the same issue is also happening for the Jordanian civ. So both Jordan and Syria are crashing the game. But not Israel, apparently.
 

Attachments

  • Atlases.zip
    22.3 MB · Views: 138
  • Art.zip
    17.7 MB · Views: 139
  • Europe 2014 (v 1).zip
    1.7 MB · Views: 103
Last edited:
from the Conquest of the New World Scenario:
Code:
	for iPlayer = 0, 10, 1 do
		local pPlayer = Players[iPlayer];
		if (pPlayer:IsAlive()) then
			local civType = pPlayer:GetCivilizationType();
			if (civType == GameInfo.Civilizations["CIVILIZATION_SPAIN"].ID) then
				capital = pPlayer:GetCapitalCity();
				eReligion = GameInfoTypes["RELIGION_CHRISTIANITY"];
				eBelief4 = GameInfoTypes["BELIEF_FEED_WORLD"];
				eBelief1 = GameInfoTypes["BELIEF_HOLY_WARRIORS"];
				eBelief2 = GameInfoTypes["BELIEF_CHURCH_PROPERTY"];
				eBelief3 = GameInfoTypes["BELIEF_MONASTERIES"];
				eBelief5 = GameInfoTypes["BELIEF_HOLY_ORDER"];
				Game.FoundPantheon(iPlayer, eBelief1);
				Game.FoundReligion(iPlayer, eReligion, nil, eBelief2, eBelief3, -1, -1, capital);
				Game.EnhanceReligion(iPlayer, eReligion, eBelief4, eBelief5);
			elseif (civType == GameInfo.Civilizations["CIVILIZATION_ENGLAND"].ID) then
				capital = pPlayer:GetCapitalCity();
				eReligion = GameInfoTypes["RELIGION_PROTESTANTISM"];
				eBelief4 = GameInfoTypes["BELIEF_RELIGIOUS_COMMUNITY"];
				eBelief1 = GameInfoTypes["BELIEF_HOLY_WARRIORS"];
				eBelief2 = GameInfoTypes["BELIEF_TITHE"];
				eBelief3 = GameInfoTypes["BELIEF_MEETING_HOUSES"];
				eBelief5 = GameInfoTypes["BELIEF_MISSIONARY_ZEAL"];
				Game.FoundPantheon(iPlayer, eBelief1);
				Game.FoundReligion(iPlayer, eReligion, nil, eBelief2, eBelief3, -1, -1, capital);
				Game.EnhanceReligion(iPlayer, eReligion, eBelief4, eBelief5);
			end
		end
	end
	for iPlayer = 0, 9, 1 do
		local pPlayer = Players[iPlayer];
		if (pPlayer:IsAlive()) then
			local civType = pPlayer:GetCivilizationType();
			capital = pPlayer:GetCapitalCity();
			if (capital ~= nil) then
				if (civType == GameInfo.Civilizations["CIVILIZATION_SPAIN"].ID) then
					capital:AdoptReligionFully(GameInfoTypes["RELIGION_CHRISTIANITY"]);
				elseif (civType == GameInfo.Civilizations["CIVILIZATION_PORTUGAL"].ID) then
					capital:AdoptReligionFully(GameInfoTypes["RELIGION_CHRISTIANITY"]);
				elseif (civType == GameInfo.Civilizations["CIVILIZATION_FRANCE"].ID) then
					capital:AdoptReligionFully(GameInfoTypes["RELIGION_PROTESTANTISM"]);
				elseif (civType == GameInfo.Civilizations["CIVILIZATION_NETHERLANDS"].ID) then
					capital:AdoptReligionFully(GameInfoTypes["RELIGION_PROTESTANTISM"]);
				elseif (civType == GameInfo.Civilizations["CIVILIZATION_ENGLAND"].ID) then
					capital:AdoptReligionFully(GameInfoTypes["RELIGION_PROTESTANTISM"]);
				end
			end
		end
	end
Firaxis 1st uses the Game.FoundPantheon, then Game.FoundReligion, then Game.EnhanceReligion

In such cases where Firaxis provides a template known to work, I usually follow that template.
 
I mulled over your suggestion for a little bit, and then I considered two things: namely, that I suck at Lua, and then, that this code would only found a religion in a major civ's capital and not anywhere else, at least in the form it is currently written (this is an issue because Sunni Islam is founded in Medina, Islam's second holiest city, since Mecca is not on the map, and Medina is not the capital of Saudi Arabia).

So I just went for a much simpler solution - because every religion on the map is already enhanced and therefore should be able to produce Inquisitors, I just did this:

Code:
        <Update>
            <Where Type="UNIT_INQUISITOR"/>
            <Set RequiresEnhancedReligion="false"/>
        </Update>

And I went in-game, and it works. I can buy Inquisitors now. So really, I just have two problems left: Jordan and Syria keep crashing the game when I try to play as them. I'm going to take a look at those Civs through SQLite, but last time I checked I couldn't find anything. Then I'll do some experiments - namely, swapping those civs for other civs in their place through the World Builder and seeing whether or not the game crashes. I want to see if the issue is part of the civs themselves, or some other element, such as the map.

I'm really trying to wrap up this bug-fixing because when I leave for College in a week, I'll only have a MacBook so I'll be unable to continue modding. Fortunately, I'm almost done, but the Jordan-Syria issue is giving me a headache. I've successfully play-tested every Civ but them, so we'll see how this works out. If I absolutely can't figure this out, I'll just release the mod anyway and make Syria and Jordan unplayable until I know what's wrong. The other 20 civs still work.
 
The problem with Syria and Jordan appears to be Civ specific. The reason I know is that I swapped the Jordanian and Syrian civs for the UK and France respectively, and managed to play each one after doing that. I'm just going to redo the entire XML file for the Civilizations in that case, and see if that fixes things.

EDIT: Okay, I looked all over the XML and I couldn't find anything. I'm at an impasse here. I have no idea where to look because nothing indicative of a particular error is showing up in the logs. I'm going to test the Civs sans scenario to see if it has to do with them alone or the way they're interacting with the other components.
 
Last edited:
I get the same crash at least with Jordan. I did not try to confirm that I get the same crash with Syria. The crash appears to occur at the same time as Earth2014PlayerSetup fires its code from Events.SequenceGameInitComplete. Ie, as soon as the game is ready to display the "Start Journey" button. When I play as Jordan I do not get the messages printed into the lua log showing that anything from Earth2014PlayerSetup.lua is being executed, but when I play as Isreal I do.

also, I thought you had changed the minimum area size for lakes. But in file Earth2014PlayerSetup you still have "10" on this line:
Code:
if pCapital:IsCoastal(10) then
You can change the hard-code "10" to GameDefines.MIN_WATER_SIZE_FOR_OCEAN so the lua code will pick up any changes you make to the define for minimum sea size. Altering this however had no effect on Jordan crashing.

There's nothing in database.log except a report that Unit_Settler and Unit_Mech don't exist so cannot be referenced in table UnitGameplay2DScripts. This is not much of an issue, tho, and will also not lead to the CTD. Removing the settler unit entirely from the game will have an effect though if you try to run the mod in a normal game set-up since no civ can have a settler, so instant defeat or else nothing really to do at all except wander the map aimlessly.
 
Last edited:
Other than that small issue with the one lua file I found I don't see that there's really anything wrong with any of the lua files. It is probably just a timing co-incidence issue where the lua files would want to fire their code at about the same time as the game encounters the CTD issue, and so the lua files never get a chance to execute.

If there was something wrong database-wise that was causing the crash you'd get it always regardless of which player you chose to play as, and you would usually be getting it long before the point where the cash is currently happening.
 
disabling the code within Earth2014PlayerSetup.lua and Earth2014ReligionSetup.lua has no effect on the CTD when playing as Jordan. So it's not anything in the lua code of those files.
 
So looking at the Lua code you mentioned in the Europe 2014 Player Setup, with this tidbit:

Code:
if pCapital:IsCoastal(10) then

I'm going to venture a guess that because this bit of code is related to the placement of Cargo Ships on the map, it would automatically place Cargo Ships in player capitals on a body of water that is 10 tiles or more in area. The reason I hadn't noticed though is because all the coastal capitals are on areas that are oceans regardless of the changes I made to lakes, so all the Civs were getting Cargo Ships as they were supposed to. The bad thing with this bit of code is that if I did have a Civ on a Lake anywhere 10 to 23 tiles in size, they would still get Cargo Ships. So I've fixed that now.

I'm going to just remake the entire Civ code for Jordan and Syria by deleting them and making new ones, since the issue appears to be Civ-specific as the Civ switching showed, and doesn't have to do with the map or the fact that those civs are 20th and 22nd in the game lineup (Serbia, which I note, is 21st and they can be played just fine). There may be some error with the Civ or Leader files I have been totally negligent to notice, and just redoing the file completely could solve the problem even if I don't know necessarily what it is.

EDIT: Okay, after deleting and remaking each XML file for Jordan and Syria's Civilizations and Leaders, nothing has changed. I'm super confused at this point, honestly. There is absolutely nothing obvious to me that would make these Civs crash.
 
Last edited:
Jordan became playable for me after eliminating the civ's soundtrack tag
Code:
<!--	<SoundtrackTag>ETHIOPIA</SoundtrackTag> -->
Have not verified that Syria also becomes playable by eliminating its soundtrack tag.

Not sure why the game did not like it, but it did not. Music and soundtracks are irritating anyway because the game expects string-matching for some things. Like the way a Leader's War and Peace themes have to be specified in a certain format to match up with the TypeName of the Leader from the Leaders table or else the game will not recognize the war and peace tracks as being associated with that leader.
 
Wow, that is the last thing I would have expected to crash the game since the soundtracks were playing for those civs just fine in the diplo screens. I literally made a separate Jordan and Syria mod to test the civs in isolation and was just about to run it to make sure the problem was civ-specific, but that’s good to know. I’ll add in different music probably for Jordan (and Syria if it turns out to be the same problem), because I don’t want them to go entirely without music.

EDIT: So intriguingly enough, Jordan's civ functions fine in a situation where they exist as a standalone mod. Same with Syria. Going to test the soundtrack tags now.

EDIT 2: Jordan worked after the soundtrack tag removal. Jordan did not. So that' s basically the last major issue we have.

EDIT 3: I did some experimenting, and set Jordan's soundtrack tag to ARABIA. Well, it worked and I was able to play them without crashing, which suggests the issue was not that Jordan had a soundtrack tag but that the tag was ETHIOPIA. Still not sure why the tag there caused a problem, but that's fine. At least Jordan has a working soundtrack tag now. I'm going test Syria with the ARABIA tag to see if that works instead of a blank soundtrack tag. Whatever the case, there is some weird funk going on with the soundtrack tag system.
 
Last edited:
Top Bottom