A few tricky things

Arctic Circle

Prince
Joined
Apr 24, 2008
Messages
473
Hello fellow modders!

While I've managed to make some interesting things with the Jotnar mod, for example re-introduce the 'great wall' from vanilla civ as a civilization specific wonder (instaed of a world spell), made sure that all cities (conqured or built) starts with a Steadding etc..

Some things are a little tricky and I'd appriciate some tips or links.

- Make units unbuildable, so that you can't build them, only upgrade a unit to that unit. where is this set?

- How do I set in python that cities can't grow more then 10? I've written a few examples. But they do not seem to work. Example below:

Code:
	def cannotGrow(self,argsList):
		pCity = argsList[0]
		pPlayer = gc.getPlayer(pCity.getOwner())
		if pCity.getPopulation() >= 10:
			if gc.getPlayer(pPlayer).getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_JOTNAR'):
				return True
			else:
				return False
		else:
			return False

- How do I create a unit that have a change each turn to change into another unit?

Thank you

 
1. You probably want the <iMinLevel> tag in the units xml. If you don't really want the units to have a minimum level but you want them for upgrades only, you could set this level to 1. That is now War Elephants work.



2. The cannotGrow function only exists in mods by Vehem or those that borrow from him. (He added it in his Doviello Icehouse mod and I believe it was included in FF too.) The DLL would not read the function otherwise, so if this is a mod for "vanilla FfH" then it won't work. I'm assuming this is the problem since FF hasn't been updated to the latest BtS or FfH patch yet. (I also thought I'd mention that your "else:"s are superfluous. The function ends when it first hits a return statement, so there is no reason to make it return false only if it has already returned true.)


3. I'm not entirely sure what you are asking. I'll assume you mean "chance" the first time you say change. This would probably best be handled through a <PyPerTurn> function for the unit. In vanilla FfH this tag exists only for promotions, but Fall Further includes the changes I convinced Grey Fox to add to Broader Alignments so you could make it unit-specific or promotion-specific there. The actual call is handled like the Python part of a spell, in CvSpellInterface.py. Here you would generate a random number, see if it is less than some number, and if so use the convert function to change the unit to some other unit. It could of course get more complicated if you wish, perhaps including dozens of possible transformations and tech/religion/alignment/civic/level requirements for some of them.
 
1. You probably want the <iMinLevel> tag in the units xml. If you don't really want the units to have a minimum level but you want them for upgrades only, you could set this level to 1. That is now War Elephants work.

Thank you. Will try it.


2. The cannotGrow function only exists in mods by Vehem or those that borrow from him. (He added it in his Doviello Icehouse mod and I believe it was included in FF too.) The DLL would not read the function otherwise, so if this is a mod for "vanilla FfH" then it won't work. I'm assuming this is the problem since FF hasn't been updated to the latest BtS or FfH patch yet. (I also thought I'd mention that your "else:"s are superfluous. The function ends when it first hits a return statement, so there is no reason to make it return false only if it has already returned true.)

I have latest FFH, with latest FF on that. And it is a modular mod. Now it -is- possible that some of the files in my modular mod is not exactly up to date. Would you possibly have any idea if it could be something like that, and if it is so .. which files should I be looking at?

Yes. I use un-necessary structure when I code. It is the same in Java, C, C# or whatever. If it makes it easier to read, I write it that way. Its just how I like it.

3. I'm not entirely sure what you are asking. I'll assume you mean "chance" the first time you say change. This would probably best be handled through a <PyPerTurn> function for the unit. In vanilla FfH this tag exists only for promotions, but Fall Further includes the changes I convinced Grey Fox to add to Broader Alignments so you could make it unit-specific or promotion-specific there. The actual call is handled like the Python part of a spell, in CvSpellInterface.py. Here you would generate a random number, see if it is less than some number, and if so use the convert function to change the unit to some other unit. It could of course get more complicated if you wish, perhaps including dozens of possible transformations and tech/religion/alignment/civic/level requirements for some of them.

Hmm. Isn't there some things that do this allready, wolves, lions etc? From a lion pack to a lion pride etc?

I think i'd need some example to start with.

Thank you very much for your answer.. :)
 
I have latest FFH, with latest FF on that. And it is a modular mod. Now it -is- possible that some of the files in my modular mod is not exactly up to date. Would you possibly have any idea if it could be something like that, and if it is so .. which files should I be looking at?



I was under the impression that FF was not yet updated to the latest FfH version. A BtS 3.17 compatible version of FF is not out yet. FF isn't modular either. I guess you mean that you are have modular mods on top of FF? I never really work with modular, and I doubt that modular mod would alter CvGameUtils.py. They only effect xml, not python or SDK.



Hmm. Isn't there some things that do this allready, wolves, lions etc? From a lion pack to a lion pride etc?

I think i'd need some example to start with.

If you want them to upgrade from combat then it is simple to use the <UnitConvertFromCombat> and <iUnitConvertFromCombatChance> tags, like those animals use. If you want a random chance per turn then it is more complicated.
 
I was under the impression that FF was not yet updated to the latest FfH version. A BtS 3.17 compatible version of FF is not out yet. FF isn't modular either. I guess you mean that you are have modular mods on top of FF? I never really work with modular, and I doubt that modular mod would alter CvGameUtils.py. They only effect xml, not python or SDK.

Hmm. Ok, the lasterst FF available.

And I use modular mod, but edit the python in the main files. And it works marvelously with modular mod and FF.

If you want them to upgrade from combat then it is simple to use the <UnitConvertFromCombat> and <iUnitConvertFromCombatChance> tags, like those animals use. If you want a random chance per turn then it is more complicated.

Oh. But what about the spiders? I am rather sure that at least it used to be so that baby spders turned into giant ones?
 
Oh. But what about the spiders? I am rather sure that at least it used to be so that baby spders turned into giant ones?

Yeah, it used to be that way. Kael removed the python code when he made lions and spiders upgrade the way that wolfs already did, a few versions ago.
 
Top Bottom