Modders Guide to FfH2

@Xienwolf: Yeah, that's exactly what I'm looking for.

Just my luck; I looked through the SDK code, and it turns out there already is a getWeaponTier() function, it's just not exposed to python. Now my only issue is actually compiling the SDK; it's giving me an undeclared identifier error right now. I think it's got something to do with the Undercouncil's gambling ring resolution. Is there an easy way to fix this?
Code:
CvGame.cpp(576) : error C2065: 'm_pabGamlbingRing' : undeclared identifier

yes spell it correctly;) It's a typo. but it should only cause errors if you try to compile a DEBUG.dll not a final release
 
If an identifier is Undeclared, that means you didn't tell the *.h file to expect you to use it. So you'll have to add the array to CvGame.h.

If an Identifier is not Initialized, it just means you didn't tell that particular function to expect to use it, so you just have to declare it in the function itself.


A bit odd of you to get that on a first attempt at compiling though. I assume you haven't touched the code at all yet? If not, go back to the un-altered code and make sure you can compile it first. Though it sounds like you understand what you need to do in order to expose something to python, so I'd assume you know your way around the SDK a little by now?

EDIT: Spellcheck for the win! Good thing Ploe caught it :)
 
Yes, DLL Export doesn't actually mean anything. It makes the function available to the .exe file, which we are incapable of changing, so it won't do anything with it. (According to what I have read).

To expose something to Python, you need to use the Cy____Interface files. So in your case you want to go into CyUnitInterface1.cpp and add:

Code:
		.def("getWeaponTier", &CyUnit::getWeaponTier, "int ()")

First part defines how you call it from Python, second part defines what the Python links to in the DLL, third part defines what will be returned, and what needs to be supplied (returned(supplied), so in this case an integer and nothing)

(Reasonably certain)
 
Python question:

How do you change the happiness/unhappiness levels and production totals in a city? (Or in a whole civ?) I think I know how to determine what they are, but that's it.
 
I am looking to create a Route that will connect resources but will not provide a movement bonus. I plan on moving roads to construction and this will allow to connect resources at the beginning of the game.

here is the code I have. would someone be so kind as to look it over and tell me what I need to change?

Code:
		<RouteInfo>
			<Type>ROUTE_PATH</Type>
			<Description>TXT_KEY_ROUTE_PATH</Description>
			<iValue>2</iValue>
			<iAdvancedStartCost>5</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMovement>30</iMovement>
			<iFlatMovement>30</iFlatMovement>
			<BonusType>NONE</BonusType>
			<PrereqOrBonuses/>
			<Yields/>
			<TechMovementChanges/>
			<Button>Art/Interface/Buttons/Builds/BuildRoad.dds</Button>
		</RouteInfo>
 
Does anybody know how to query for a mouseover in python? I know how to get the Mouse position, but I'd rather not have to set up IF/THEN statements for every possible location which I may want to change.

Also, does anyone know how to detect a mouse-click through Python? And of course a release of MouseClick.
 
I have no idea, but it would be nice to know. I'm wanting to implement Broader Alignments in my modmod, but not include the alignment bar or make the numerical alignment always show (like in Fall Further). I think it would be much better if the numerical alignment was a mouseover for when the mouse is on top of the Good/Neutral/Evil alignment indicator.
 
Does anybody know how to query for a mouseover in python? I know how to get the Mouse position, but I'd rather not have to set up IF/THEN statements for every possible location which I may want to change.

Also, does anyone know how to detect a mouse-click through Python? And of course a release of MouseClick.

In CvEventManager.onMouseEvent . It seems to have all the argument required to check what ever you want.

Tcho !
 
Umm....What could be causing world builder to act like this? I just made a bunch of changes, so it is almost certainly my fault, but it would be nice to know. Only the map mode and reveal tiles mode have their menus working, and it won't let me place anything. World builder doesn't fully close when I try to close it either.
 
Looking at that function now. It accepts (self, Argslist), and then details precisely what the Argslist is. Looks like it opens up the City Editing Menu, or places an object (both are for WorldBuilder I assume), and can handle Back and Forward (for Pedia).

So how can I call it from CvMainInterface.py? I want to know if it is hovering over a button, and when it has clicked on it so that I can have the graphics change, just like they do for the Advisor Buttons.

Magister: Precisely what is "a lot of changes" entailing? Most likely it was one of them though. Always best to make 1 change at a time and then test all possible impacts of it.
 
Well lets see....There were lots of other changes (some of which might be behind the CtDs), but I wasn't having worldbuilder until these:

I created the Divine 2 promotion (giving Divine the same effects as Channeling2 and Divine 2 as Channeling3),
removed the channeling promotions from priests (giving divine2 to high priests),
removed the Channeling promotion prereqs from priest spells,
made high priest spells require divine2,
made Command require Divine instead of channeling,
fixed a typo in part that was added to CvSpellInterface from Marnok's mod,
replaced all units' PROMOTION_FLYING with PROMOTION_WINGED,
gave a couple more units PROMOTION_WINGED,
added one spell that lets Winged units get the Flying promotion and one that lets them lose it,
I added more TerrainImpassibles and Feature Impossibles to Frost Giants,
allowed Drowns/Muirin/Stygian Guards to enter oceans after Malevolent Designs,
allowed earlier ships to enter oceans after Astronomy ,
gave Wilboman and Frost Giants the Elemental racial promotion,
adjusted the cost, strength, and movement points of a couple of units,
went back to using python for heal (my xml-only approach didn't work, and I hadn't actually touched the python part of Kael's version),
Changed the prereq tech and promotions for Medic 2&3
made Infernal Cities start with Demons Altars instead of Obsidian Gates (I had already made Obsidian Gates temporary buildings from the Dimensional2 spell),
made The Rites of Oghma repeatable,
added the first level promotion of the 4 new spheres to mobius witches' list of possible free promotions,
granted the new sphere's promotions to adepts/mages/archmages (the same way the other spheres are given),
made a couple wonders grant a free mana,
changed Summon animal to a Nature 3 spell,
moved Vitalize to Creation 2 (currently the only creation spell),
made the Train Magic spell (a place holder for until I make Govannon and his students train magic passively) actually grant channeling 1 instead of doing nothing,
lowered the appearance chance of villages and lairs (Marnok's mod had made them way too common)
I made changed the bHasCasted and bIgnoreHasCasted tags for a couple spells, and made one cause war
I think I also deleted portions of some of Marnok's promotions to make them easier to read, since those fields were optional with your schema
 
I was wondering exactly how the blasting workshop gives units built with the Golem promotion the ability to cast fireballs.
 
Can a trait only apply a promotion to a specific unit_combat? or could it work for all units from a specific civ? or just units with another specific promotion?
 
What do you mean by trait, and apply? If you mean can it be set up to give a promotion to only one unitcombat, then definitely yes. Most bonuses from traits don't really apply to units. The extra xp, lower level requirements, or pillaging gold would ally to all unitcombats. Promotions can also grant extra xp from combat though.
 
What do you mean by trait, and apply? If you mean can it be set up to give a promotion to only one unitcombat, then definitely yes. Most bonuses from traits don't really apply to units. The extra xp, lower level requirements, or pillaging gold would ally to all unitcombats. Promotions can also grant extra xp from combat though.

I mean to have a Leader Trait give a promotion to all units, or all units that start with a specific promotion, ie. elven, dwarven, golem, ect.
 
Traits can only grant promotions to specific unitcombats. You could however set a promotion as a civ's default race to have it apply to all of a civs units. Well, actually only living units without a race and not world or national units.

It would be quite nice to have the ability to do so though traits though.
 
Hrm, nothing that looks suspicious, so I'd guess you have to sit and check for typos now.

I'm still having the occasional CtD, but I seem to have solved the worldbuilder problem. I think it was caused by having one of my new spells refer to a non-existent Civilopedia entry. Changing it to the basic placeholder entry that most spells have seems to have fixed the problem.

I assume it is that, since I don't see how adding the Illians' Priest of the Hand (monk UU, but more like religion's priests, immune to cold), Ice Druid (Druid UU with ice and enchantment instead of nature and life, immune to cold), and Heir of Taranis (Immortal UU, can't get promotions since it has no unitcombat, but it would still have all the promotions of the units before it. It is only strength 1 but has 3 Ice affinity), creating an Illian only divine spell, changing the stats of Auric Ulvin, making the Hyborem/Basium/Auric's death use a <PythonPostCombatLost> to remove their traits instead of relying on event manager, or giving the Frost and Blizzard Spells a small chance to remove forests/ancient forests/jungles (with a slightly larger chance to reduce them to new forests) on the effected tiles could have helped.




Hmm..is there some way to make sure that a unit will never get a religion when it is built, or will lose it when upgraded? I don't think there is, but it would be useful. It could block Grigori Medics from being high priest equivalents, and stop the Illians from having priests worshiping/getting spells from both Auric Ulvin and the 7 main religions.


Edit: ok, I had the worldbuilder problem again. Then I closed the program and restarted it, and the problem was gone again.
 
Back
Top Bottom