ModModder's Guide

right, DLL changes can't be modular. You can use CyPlot::getScriptData() and CyPlot::setScriptData(std::string szNewValue) but do remember that other things can use this as well, so you need to take that into account. (usually done by pickle.)
Gotcha. It looks like that python would be insufficient. I need several persistant variables per plot for my nefarious scheme :mischief:

On a related note, how difficult would it be to override current climate/hell dynamics? I've found the python that seems to handle the changes, but I don't know how far-reaching the system goes. Everything based on terrain should be fine, what I have planned works underneath that. I suppose what I'm asking is, do climate values or the plot counter directly affect units, spells, cities, or anything?
 
Thanks. Can't wait for 1.3.1!

Oh, actually, one more question... I've read that the dll project isn't up to date (1.3). This is slightly confusing, as there's one right here. Will that be the old dll, left there because there wasn't a new one to overwrite it, or something else I haven't thought of?
 
How would one go about adding a variable (integer) to terrain? Or more accurately, to plots? Is it possible through XML and python, or do I have to go .dll diving?

Look into SdToolKitAdvanced . It's included in RifE and allows any number of "variables" per "plot". (Not really variables and not just plots.) Main disadvantage is that it is slow. Use for prototyping and if it's fast enough you're done. If it's awesome enough, Valkrionn will probably steal it.

Don't use the getScriptData! It you do, it will break if anyone else tries to do something similar. That is why SdToolKitAdvanced exists, to enable many modules to store data.
 
When is 1.31 coming out? I need it for the health stuff.

BTW. I found a way to make my units work. After making them again, and again, and again, for about ~150 times I made versions that work. Personally, don't know how and don't care.
 
Is it possible to add a flavor start definition for my custom civ modularly? The GetCivFlavourData() data function in CvFlavourInterface.py seems like the place it would go. But that function doesn't have the magic modular python spell at the bottom of it, so I'm guessing that function isn't modular.

Is there somewhere else to describe this that I'm missing (really would be nice if that function read in the data from xml instead of being hardcoded, but oh well), or is it impossible to do flavour start modularly at this point?

Would be a shame, because my Psychic Dwarves like gems.
 
Is it possible to add a flavor start definition for my custom civ modularly? The GetCivFlavourData() data function in CvFlavourInterface.py seems like the place it would go. But that function doesn't have the magic modular python spell at the bottom of it, so I'm guessing that function isn't modular.

Is there somewhere else to describe this that I'm missing (really would be nice if that function read in the data from xml instead of being hardcoded, but oh well), or is it impossible to do flavour start modularly at this point?

Would be a shame, because my Psychic Dwarves like gems.

Unfortunately, no, and it can't be made modular. However, if you provide us with the flavor info, I'd be more than glad to put it in. Format should be as follows, so it's only loaded if they are in game:

Code:
	if gc.getInfoTypeForString("CIVILIZATION_YourCivHere") != -1:
		pCivFlavourInfo = CivFlavourInfo("CIVILIZATION_YourCivHere")
		pCivFlavourInfo.addPreference(YourPreferencesHere)
		civFlavourInfos[pCivFlavourInfo.civ] = pCivFlavourInfo
 
I've got a problem...
When I activate my module, I can't see any Promotions when I look them up in the Worldbuilder.

heres a part of my file:
Code:
<PromotionInfo>		<!-- Equipped Commander  -->
			<Type>PROMOTION_EQUIPPED_COMMANDER</Type>
			<Description>can use Bronce, Iron and Mithril Weapons</Description>
			<bAutoAcquire>1</bAutoAcquire>
			<bEffectProm>0</bEffectProm>
			<bMustMaintain>1</bMustMaintain>
			<bNoXP>1</bNoXP>
			<PrereqCivilizations>
		                <PrereqCivilization>CIVILISATION_KHAZAK</PrereqCivilization>
			</PrereqCivilizations>
			<UnitCombats>
				<UnitCombat>				  
                                        <UnitCombatType>UNITCOMBAT_COMMANDER</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
			</UnitCombats>
			<PromotionAllows>
				<Promotion>PROMOTION_BRONZE_WEAPONS</Promotion>
				<Promotion>PROMOTION_IRON_WEAPONS</Promotion>
				<Promotion>PROMOTION_MITHRIL_WEAPONS</Promotion>
			</PromotionAllows>
			<PromotionPrereq>PROMOTION_INFLUENCE</PromotionPrereq>
			<iExtraCombatStr>1</iExtraCombatStr>
                        <iExtraCombatDefense>1</iExtraCombatDefense>
			<Button>Art/Civs/Other/FortCommander/commander1.dds</Button>
		</PromotionInfo>
this promotion should able Fort Commanders to get Bronce... weapons

An other problem is that the <autoacquire> doesn't work (thats why I tried to give the promo with the worldbuilder.
 
Issue is your prereqcivilization tag. You list CIVILISATION_KHAZAK. Should be CIVILIZATION_KHAZAD, unless you've added a Khazak civ. :p

Anytime you have promotions/units/whatever not show in Worldbuilder (or the Pedia; You should have the same issue with it), check any list tags you have. By list I mean those like PrereqCiv or PromotionAllows; Tags which allow any number of type references.
 
before, i've leaved of the hole <PrereqCivilizations>...</PrereqCivilizations> to make it general.
The Khazak(d) was only to check, if <bAutoacquire> needs a civ in the promo to work. it does't worked, too.

And in the window of the Worldbuilder, not only my new promotion was not mentioned (before it was), the whole window was empty. very strange:confused:
 
Maybe it's the UnitCombat. Most Fort Commanders aren't UNITCOMBAT_COMMANDER, but for some reason UNITCOMBAT_SIEGE.
 
For the flavor start thing, do we just tell you what kind of terrain we want or something? Becouse it would be something like this:

Code:
if gc.getInfoTypeForString("CIVILIZATION_PPQ") != -1:
		pCivFlavourInfo = CivFlavourInfo("CIVILIZATION_PPQ")
		pCivFlavourInfo.addPreference([B]***[/B])
		civFlavourInfos[pCivFlavourInfo.civ] = pCivFlavourInfo

Where *** is:

Grasslands or flood plains, preferably grasslands and grassland hills. Some forest but not a lot. Preferably near a river.
And definitively not near a coast, in fact far from the sea or major bodies of water.

Anything else required?
 
again two questions:p

the mobile fortress can only move at railways, with this code:

Code:
               <bFlatMoveCost>1</bFlatMoveCost>
	       <RouteNatives>
	                <RouteNative>
			        <RouteType>ROUTE_RAILROAD</RouteType>
			        <bRouteNative>1</bRouteNative>
		        </RouteNative>
		</RouteNatives>

1. (How) Can I use this in a promotion?

2. (How) Can I create a new roadtype? / where is the 2. file I have to change? (BuildInfo is the first)
 
again two questions:p

the mobile fortress can only move at railways, with this code:

Code:
               <bFlatMoveCost>1</bFlatMoveCost>
	       <RouteNatives>
	                <RouteNative>
			        <RouteType>ROUTE_RAILROAD</RouteType>
			        <bRouteNative>1</bRouteNative>
		        </RouteNative>
		</RouteNatives>

1. (How) Can I use this in a promotion?

2. (How) Can I create a new roadtype? / where is the 2. file I have to change? (BuildInfo is the first)

1. There are no tags for that in the PromotionInfo, so unfortunatrely not.

2. Misc/CIV4RouteInfos.xml
 
For the flavor start thing, do we just tell you what kind of terrain we want or something? Becouse it would be something like this:

Code:
if gc.getInfoTypeForString("CIVILIZATION_PPQ") != -1:
		pCivFlavourInfo = CivFlavourInfo("CIVILIZATION_PPQ")
		pCivFlavourInfo.addPreference([B]***[/B])
		civFlavourInfos[pCivFlavourInfo.civ] = pCivFlavourInfo

Where *** is:

Anything else required?

I'm assuming he wants an exact definition so he doesn't have to go looking stuff up... To make it easier for Valk, you have to do the legwork...

look in \Rise from Erebus\Assets\python\entrypoints\CVFlavourInterface.py for examples. (I dunno why there's a space between c and e... it's not supposed to be there and isn't there when I type out my post...)

E.g.:
Code:
	pCivFlavourInfo = CivFlavourInfo("CIVILIZATION_KHAZAD")
	pCivFlavourInfo.addPreference("PLOT_PEAK", 8)
	pCivFlavourInfo.addPreference("PLOT_HILLS", 4)
	pCivFlavourInfo.addPreference("YIELD_COMMERCE", 2)
	pCivFlavourInfo.addPreference("BONUS_GOLD", 1)
	pCivFlavourInfo.addPreference("BONUS_PIG", 1)
	pCivFlavourInfo.addPreference("BONUS_MUSHROOMS", 1)
	pCivFlavourInfo.addPreference("TERRAIN_COAST", -1)
	civFlavourInfos[pCivFlavourInfo.civ] = pCivFlavourInfo

The Khazad like Peaks and hills a lot, prefer tiles with high commerce, and are somewhat likely to get gold, pigs, or mushrooms. They are slightly less likely to start near the coast.
 
I'm assuming he wants an exact definition so he doesn't have to go looking stuff up... To make it easier for Valk, you have to do the legwork...

look in \Rise from Erebus\Assets\python\entrypoints\CVFlavourInterface.py for examples. (I dunno why there's a space between c and e... it's not supposed to be there and isn't there when I type out my post...)

E.g.:
Code:
	pCivFlavourInfo = CivFlavourInfo("CIVILIZATION_KHAZAD")
	pCivFlavourInfo.addPreference("PLOT_PEAK", 8)
	pCivFlavourInfo.addPreference("PLOT_HILLS", 4)
	pCivFlavourInfo.addPreference("YIELD_COMMERCE", 2)
	pCivFlavourInfo.addPreference("BONUS_GOLD", 1)
	pCivFlavourInfo.addPreference("BONUS_PIG", 1)
	pCivFlavourInfo.addPreference("BONUS_MUSHROOMS", 1)
	pCivFlavourInfo.addPreference("TERRAIN_COAST", -1)
	civFlavourInfos[pCivFlavourInfo.civ] = pCivFlavourInfo

The Khazad like Peaks and hills a lot, prefer tiles with high commerce, and are somewhat likely to get gold, pigs, or mushrooms. They are slightly less likely to start near the coast.

Thanks, I would have done that but I honestly had no idea how to do it. I tried to find it but you know, not knowing where to look did harm to my efforts.

I will go seek it out ASAP. And do the coding my self.
Just one thing thou, what exactly is defined there? Is it just a list of preferred stuff? Or is it what gets thrown into their N x M tiles from the starting position?
And what to hell do the numbers mean? I assume that -1 is a NOT but what do the others mean? How does it work?
Bolding is just for emphasis so that the questions can be noticed among my rambling.


When I do figure it out, it will be edited into this post:

Code:
if gc.getInfoTypeForString("CIVILIZATION_PPQ") != -1:
		pCivFlavourInfo = CivFlavourInfo("CIVILIZATION_PPQ")
		pCivFlavourInfo.addPreference([COLOR="Red"][I]posting... please hold[/I][/COLOR])
		civFlavourInfos[pCivFlavourInfo.civ] = pCivFlavourInfo
 
heres a part of my file:
Code:
<PromotionInfo>		<!-- Equipped Commander  -->
			<Type>PROMOTION_EQUIPPED_COMMANDER</Type>
			<Description>can use Bronce, Iron and Mithril Weapons</Description>
			<bAutoAcquire>1</bAutoAcquire>
			<bEffectProm>0</bEffectProm>
			<bMustMaintain>1</bMustMaintain>
			<bNoXP>1</bNoXP>
			<PromotionAllows>
				<Promotion>PROMOTION_BRONZE_WEAPONS</Promotion>
				<Promotion>PROMOTION_IRON_WEAPONS</Promotion>
				<Promotion>PROMOTION_MITHRIL_WEAPONS</Promotion>
			</PromotionAllows>
this promotion should able Fort Commanders to get Bronce... weapons

Snipped part of your definition out, but this is the important part... Once you figure out what you're doing wrong to get the promotion available in-game, it's not going to do what you want it to do. PromotionAllows only lets the promotion ignore which UnitCombats the promotions are for. If it allowed the promotion, ignoring all prereqs, then your code above would instantly promote all Fort Commanders to Mithril Weapons (because it would ignore the requirement to have mithril). Since it doesn't do that, you should also know that it doesn't ignore the requirement to be in a city or for the unit to have access to tier 1/2/3 weapons.

To actually do what you want, the best course of action is probably a Fort Commander unique unit that has access to tier 3 weapons and a unique fort improvement that has bActAsCity. There are, however, other ways to allow it. I wouldn't change the requirements on Bronze, Iron, Mithril... that could have unintended effects. In general, it's probably a bad idea to CHANGE existing items (as opposed to adding effects to existing items or adding new items), unless you know what you're doing and that's the only way to get the desired effect. You could, though, use python to add the Bronze, Iron, Mithril promotions to Fort Commanders. Either a pyPerTurn function, or wait until 1.31 when Valk will add tag for python to be executed on promo gained. Then create an autoAcquire promotion which requires Bronze and Commander type, and have the pyOnPromoTaken (or whatever it's called) give the unit Bronze Weapons.

Or, and I think this will work, but you'll have to test it, give an autoAcquire promotion that requires Bronze and Commander type, then have it expire at the end of the turn and degrade to Bronze Weapons. The only thing is that you'd want to block the promo from coming back after the unit already has Bronze Weapons. In this case, you could add a tag to Bronze Weapons that blocks the original "bridge" promo. Adding a PromotionExclude isn't likely to cause any unintended effects like changing the requirements on weapons. Reasonably, Bronze Weapons should block Bronze Weapon bridge, Iron Weapons should block Iron and Bronze bridge, and Mithril should block all bridge promos. The only issue is that it takes one turn longer for your commanders to be promoted, but that shouldn't be a big deal.

The real question is, why are bothering? A fort commander can't attack, so why give him Bronze Weapons? They're already strong enough to defend against almost anything at the stage in the game where you can get them and their strength upgrades as they age. The only time they're weak is against a good sized stack (which you can usually hit with a ranged attack first), or if you build a new fort late in the game, in which case you need to defend it with other units.
 
Top Bottom