Scenario Crashing

Heerlo

Jedi Master Hearlo
Joined
Jan 19, 2012
Messages
2,438
So I've been working on a scenario in WB, and I'm having a problem where when I take the first turn, the game crashes. This scenario is based on an actual game I played on vanilla, and I'm trying to make a BNW version of it. Because of this, I've had to place cities and improvements, choose social policies that were already chosen, and so forth. This scenario is still in the early stages, and most of the world has not been set up the way it's supposed to be yet.

So, I guess my question is, is this crashing normal for a scenario in its early stages? Will this stop as I get things set up right? Or is there just something wrong with my World Builder? I just wanted to hear from some of you more experienced WB users before I put in anymore work on this, only to have it not work at all later on.

Thanks.
 
Anyone?
 
Your scenario should be just a worldbuilder map at this point, correct? I'm pretty sure you can attach that to a post. Might make it easier to decide where the problem is if someone here in the modding community who's done scenarios a time or two can look at the scenario to see if there's something you're doing wrong.

Unfortunately I myself haven't done a lot with scenarios other than creating custom maps and assigning player start locations.

One thing, though, if you're trying to run the map/scenario in BNW, and the original map came from a Vanilla game it might be something as simple as the luxuries introduced in G&K or BNW not being placed on the map anywhere. I don't know for sure if this would cause your scenario to crash, but I would look over your map for things of that nature.
 
Your scenario should be just a worldbuilder map at this point, correct? I'm pretty sure you can attach that to a post. Might make it easier to decide where the problem is if someone here in the modding community who's done scenarios a time or two can look at the scenario to see if there's something you're doing wrong.

Unfortunately I myself haven't done a lot with scenarios other than creating custom maps and assigning player start locations.

One thing, though, if you're trying to run the map/scenario in BNW, and the original map came from a Vanilla game it might be something as simple as the luxuries introduced in G&K or BNW not being placed on the map anywhere. I don't know for sure if this would cause your scenario to crash, but I would look over your map for things of that nature.

The original map is from vanilla, and I've already placed several different civs and some improvements and units, so it's not just an empty map. I'll check out the luxury resource thing you mentioned and I'll include the map attachment to this post.

Thanks.
 

Attachments

hmm...apparently that may not work. I can't get my computer to recognize the attachment as anything but a .php after I download it. And it won't try to unzip or otherwise look at the file. Usually after I start 7z I can double-click on a .php download and it opens a folder with the 'real' files within it.
 
There are a number of things that I have discovered will crash scenarios.

Strangely, a number of issues arise with preplacing cities. I have found that it is best to place the cities with lua. Here is just such a function... change the civilization names to suit your scenario:

For Major Civilizations... this will found three cities in order, so the first will be the capital and thereafter, they will be founded in the order of your city list.

Code:
--found Denmark Cities

function  FoundDenmark()

	if Game.GetElapsedGameTurns() == 0 then

	-- Set up Denmark Player

		for iPlayer=0, GameDefines.MAX_MAJOR_CIVS-1 do 

		local pDenmark = Players[iPlayer]

			if (GameInfo.Civilizations.CIVILIZATION_DENMARK.ID == pDenmark:GetCivilizationType()) then
	
			pDenmark:Found(95, 10)
			pDenmark:Found(88, 12)
			pDenmark:Found(98, 7)
			print (pDenmark:GetName() ,"...is founding cities");

			end
		end
	end
end

Events.SequenceGameInitComplete.Add(FoundDenmark)

For city states (more than one city if you wish...)

Code:
--found Angles Cities

function  FoundAngles()

	if Game.GetElapsedGameTurns() == 0 then

	-- Set up Angles Player

		for iPlayer=GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS-1, 1 do 

		local pAngles = Players[iPlayer]

			if (GameInfo.MinorCivilizations.MINOR_CIV_ANGLES.ID == pAngles:GetMinorCivType()) then
	
			pAngles:Found(83, 17)
			pAngles:Found(81, 7)
			--print (pAngles:GetName() ,"...is founding cities");

			end
		end
	end
end

Events.SequenceGameInitComplete.Add(FoundAngles)

You'll want to change Angles to whatever city state you choose, and the civ name must be adjusted of course.

If you found cities this way, you'll also need to adjust population as they will have the minimum... This code will set overall starting pop. You'll have to do something a little different if you want individual cities to have different populations.

Code:
-- sets starting populations for cities

function SetPop()

	if Game.GetElapsedGameTurns() == 0 then

		for iPlayer=0, GameDefines.MAX_CIV_PLAYERS - 1 do

		local pPlayer = Players[iPlayer];

			if pPlayer:IsEverAlive() then 
			
			-- Enumerate cities
			
				for pCity in pPlayer:Cities() do

					if pCity ~= nil  then 
					
					pCity:ChangePopulation(1)
					--print ("Setting population for...", pCity:GetName());
												
    				end
				end
			end
		end
	end
end

Events.SequenceGameInitComplete.Add(SetPop)

And you will want to kill off spawning city state settlers...

Code:
-- Kill city state settlers.

function KillCSSettlers()

	if Game.GetElapsedGameTurns() == 0 then		
	
		for iPlayer=GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS-1, 1 do

		local pPlayer = Players[iPlayer];

			if (pPlayer:IsAlive()) then

				for pUnit in pPlayer:Units() do
     
					if (pUnit:GetUnitClassType() == GameInfoTypes.UNITCLASS_SETTLER) then

					pUnit:Kill()
					--print ("Killing city state settlers");

					end
				end
			end
		end
	end
end

Events.SequenceGameInitComplete.Add(KillCSSettlers)

If you want these cities to have buildings at start, I think you can set that up via xml, but you can also do it with lua.

I've been working on my scenario for almost 2 years, off and on, and I have found that founding the cities this way gets over certain glitches in world builder.

I hope this helps.
 
I tried the luxury resource thing that LeeS mentioned, by adding a copper resource(G&K luxury, I believe), but it didn't seem to help anything.

I don't think city placement or city states are the problem either. This scenario has several civs(and eventually all of them)starting with all technologies. I left all the cities in the same places as they were, and made all civs start without any technologies and set every civ back to the ancient era, and that fixed the problem. This is obviously not a feasible solution for this scenario, though. Is there any way around this?
 
I don't think city placement or city states are the problem either. This scenario has several civs(and eventually all of them)starting with all technologies. I left all the cities in the same places as they were, and made all civs start without any technologies and set every civ back to the ancient era, and that fixed the problem. This is obviously not a feasible solution for this scenario, though. Is there any way around this?

Actually, from your description, I would be willing to bet that city states are exactly what is causing the problem. I had a similar issue when making the scenario for my mod Earth 2014, wherein creating a modern era scenario would cause a first or second turn crash. My scenario would work fine as long as none of the civs were advanced, but giving them modern era techs would cause a crash. Eventually I figured out that the city states were the culprit (Craig_Sutter helped me come to this conclusion), and I resolved this problem the same way as mentioned up-thread, by using lua to found the city states. If I were you, I'd make a copy of my map as a backup and then edit the scenario by taking out all of the city states. If you play it, and it works, then you know that you are getting the same error that I got and will probably have to settle for the same solution.
 
Actually, from your description, I would be willing to bet that city states are exactly what is causing the problem. I had a similar issue when making the scenario for my mod Earth 2014, wherein creating a modern era scenario would cause a first or second turn crash. My scenario would work fine as long as none of the civs were advanced, but giving them modern era techs would cause a crash. Eventually I figured out that the city states were the culprit (Craig_Sutter helped me come to this conclusion), and I resolved this problem the same way as mentioned up-thread, by using lua to found the city states. If I were you, I'd make a copy of my map as a backup and then edit the scenario by taking out all of the city states. If you play it, and it works, then you know that you are getting the same error that I got and will probably have to settle for the same solution.

Ok, I'll try that.
 
I tried that and it still crashes. Anyway, thanks for trying.
 
I would still recommend placing all cities with lua. I have noticed that buildings requiring a resource like the stable do not work if a resource winds up in the cultural area of preplaced cities or painted cultural borders. This is the case if I use worldbuilder to randomly generate resources at least... I am not certain about preplaced resources. The cultural borders so created do not appear to be recognized by the game as belonging to any city in particular at least for the purposes of functions that operate by detecting said resources.
 
Back
Top Bottom