Founding cities only on specific tiles

the problem during initalization is a real problem.

Can you try, if a premade map works?

CITY_RUINS is the 3rd improvement in the list, so it is numbered 2 (the first one starts at 0, remember). I think this is why there's a 2 there.

Little hint:
PHP:
if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_WHATEVER')

is what you need.
It get's the number for you ;).



Some thoughts:
The code will maybe kill the civs, which have the ruins-settler as starting unit.
Because if the settler doesn't start on a plot with a ruin, so that you can't build a city directly after gamestart, AND you have no city, the game will consider the player as dead.
There's a need for a check, if the first city is already founded.
 
yeah fury road starts with a settlement so that isn't a problem

the way you've got the code there was the way I had it was just trying it the other way to see if it would make it work.... It didn't

problem is fury road doesn't have a premade map.

I also tried to set it up in the normal bts game to see if it worked there, incase it was fury road that caused the problem, but for some reason i couldn't get it to pick up the new settler unit. I it added to the unit XML am i forgetting ssomewhere else i need to update?
 
yeah fury road starts with a settlement so that isn't a problem

the way you've got the code there was the way I had it was just trying it the other way to see if it would make it work.... It didn't

problem is fury road doesn't have a premade map.

I also tried to set it up in the normal bts game to see if it worked there, incase it was fury road that caused the problem, but for some reason i couldn't get it to pick up the new settler unit. I it added to the unit XML am i forgetting ssomewhere else i need to update?

By "pick up" do you mean the game refused to acknowledge the new settler (I assume you added it to the code) and you couldn't even give yourself one in worldbuilder? If you could place it, did you remember to make it so that a certain civilization started with that unit?

Perhaps Fury Road makes schema changes?

I'd download Fury Road and try myself, except I've patched to 3.19 and Fury Road (I think) is only for 3.17 because of the custom DLL) and I just deleted my 3.17 version (because all the mods I had had upgraded, so there was no reason to keep it around).

I will try adding the code to my normal BTS and see what happens.
 
Some thoughts:
The code will maybe kill the civs, which have the ruins-settler as starting unit.
Because if the settler doesn't start on a plot with a ruin, so that you can't build a city directly after gamestart, AND you have no city, the game will consider the player as dead.
There's a need for a check, if the first city is already founded.
They'll certainly be at a major disadvantage but you can check by making the Excavator in my example a UU of some civ and playing with or against them - no death. (or in the base game you can wander around a few turns before founding your first city for the same result).

I also tried to set it up in the normal bts game to see if it worked there, incase it was fury road that caused the problem, but for some reason i couldn't get it to pick up the new settler unit. I it added to the unit XML am i forgetting ssomewhere else i need to update?
If you made the unit like I did, with UNIT_SETTLER as the UnitClass, then it's a UU - you need to either add it to a civ (in CivilizationInfos), or add the unit using the World Builder while a game is in progress. Or you could make it a non-unique unit by giving it its own UnitClass, in which case there are a lot of things you need to edit (but there's a tutorial).
 
yeah fury road starts with a settlement so that isn't a problem

That could also be the problem.
I don't know, how the settlements are created. Maybe through a settler, which automatically founds a city,...you see the problem?

problem is fury road doesn't have a premade map.

Start a normal fury road game, go into the worldbuilder, and save the map as szenario.
Then load the szenario in your modded version.

I it added to the unit XML am i forgetting ssomewhere else i need to update?

If there are schema changes, like TC01 suggested, you would have to update it right.
But you would get lots of error messages when loading a game, so i guess, that's not the problem.
 
I was able to get it to work in normal BTS using this code:

Code:
	def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		pPlot = CyMap().plot(iPlotX, iPlotY)
		for i in range(pPlot.getNumUnits()):
			pUnit = pPlot.getUnit(i)
			if pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_SETTLER'):
				return False
			elif pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_EXCAVATOR'):
				if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_CITY_RUINS'):		
					return False
				return True
		return False

It's exactly the same as the code in post 54 except for the fact that I indented every line once. I then copied the Settler but changed the UnitType to UNIT_EXCAVATOR, and overrode the default python callback defines to read my code. It worked.

XML errors are very annoying because I've found that if they are catastrophic enough, you don't even get an error message. Python errors usually at least give you an exception... I'd suggest removing the code in CIV4CivilizationInfos.xml that makes one civ get an Excavator instead of a Settler. Then see if you can at least load the game and worldbuilder yourself an excavator. If you can, this is probably what The_J is suggesting...
 
yeah what I meant with the normal bts situation is that I copied the settler code and then just changed the unit name, i.e. the second line of code. and then added caos python code as well loaded a normal bts game went to world builder but the new settler type wasn't there it also wasn't in the civilopedia either, it just didn't register in the game. but i didn't get any XML error messages or anything so I just don't know why it won't show up.

It appears in the fury road version. I'm at just at a loss for what is going on with it, just feels doomed to failure! hehe

The idea with this settler is to slow the growth of some civs in my fury road mod mod if you wanna know what i plan with it you can check out Fury Road LS Mod Mod in the Fury Road forum
 
yeah what I meant with the normal bts situation is that I copied the settler code and then just changed the unit name, i.e. the second line of code. and then added caos python code as well loaded a normal bts game went to world builder but the new settler type wasn't there it also wasn't in the civilopedia either, it just didn't register in the game. but i didn't get any XML error messages or anything so I just don't know why it won't show up.

It appears in the fury road version. I'm at just at a loss for what is going on with it, just feels doomed to failure! hehe

The idea with this settler is to slow the growth of some civs in my fury road mod mod if you wanna know what i plan with it you can check out Fury Road LS Mod Mod in the Fury Road forum

If you only changed the UnitInfo, and not the text tags describing the unit, your UNIT_EXCAVATOR will still come up as Settler. Try changing TXT_KEY_UNIT_SETTLER (or whatever it is) in the Excavator unit to "Excavator" (no text key). This happened to me, but fortunately I make my changes to the top or bottom of all files, and I know that Lion is the first Civ 4 unit, and it did say "Settler, Unique Unit, Replaces Settler."
 
aaah yes i forgot about that, changing the txt key...

although even if i do get it to work in bts, which we now know is at least possible because you guys have done it, it won't really help me move my fury road mod forwards cause i still don't know why its not working there??

I'll try that pre-made map idea for fury road tomorrow
 
aaah yes i forgot about that, changing the txt key...

although even if i do get it to work in bts, which we now know is at least possible because you guys have done it, it won't really help me move my fury road mod forwards cause i still don't know why its not working there??

Actually, it IS useful if you can get it working, because it means we know that the error lies in Fury Road, not in your code. If you can get it to work in BTS, you should probably go to the Fury Road forums and ask for help there.
 
yeah true I'll have another go at trying to get the bts version working tomorrow I reset everything i did today with it so i'll have to go through it do it again.

Ok I've tried the fury road premade map idea that the_J suggested and it loaded ok with the pre made map it didn't freeze on the initializing screen, but the excavator could still found anywhere.

I'm still stuck on the BTS attempt for some reason I just can't get the new unit to become part of the game, I've added it to the unit xml it has a different description, I've cleared the cache to make sure it runs the new info, but it still won't appear, and i get no xml errors either, i just don't get whats wrong?

i think i must have modding gremlins or something?
 
Top Bottom