Modders Guide to FfH2

Awesome, thanks Kael. I wouldn't have expected in to be in the Units section.

@ xienwolf: I know the spawned units are always barbarian, I'm thinking more along the lines of the Clan/Doviello building them since they have the barbarian trait. I also gave graveyards a production boost with necromancy so that's the reason I want to build them as well.
 
Just wondering, if I were to add more world spells (for example, religion specific world spells), would casting them interfere with the ability to cast the current ones? Does the Global tag mean that the spell itself can only be cast once or that once casting a world spell the civ cannot cast any world spell again (without the ritual)? Or is it maybe something in between, where that civ cannot cast hat spell again? This would be really important to know before adding non-civ-specific worldspells
 
Just wondering, if I were to add more world spells (for example, religion specific world spells), would casting them interfere with the ability to cast the current ones? Does the Global tag mean that the spell itself can only be cast once or that once casting a world spell the civ cannot cast any world spell again (without the ritual)? Or is it maybe something in between, where that civ cannot cast hat spell again? This would be really important to know before adding non-civ-specific worldspells

Every player has an attribute that identifies if he has cast his global spell yet or not. If it is cast then he cant cast anymore (outside of something, like the ritual, turning that switch back which would re-enable all global spells).

So you could give a player access to 3 global spells, but the player would only be able to cast one of them per game.

The reason its done this way is that I didn't need to program anything to track this, I just use the feat system (the same thing that keeps of if you have exceeded a population limit, build your first melee unit, or hooked up your first happiness resource). To do what you want we would need to create an array that tracked each spell and see if the player had cast it, disabling that specific spell if it had been cast before (no, I have no need of that function in FfH so I wont be creating/managing an array for it).
 
Awesome, thanks Kael. I wouldn't have expected in to be in the Units section.

@ xienwolf: I know the spawned units are always barbarian, I'm thinking more along the lines of the Clan/Doviello building them since they have the barbarian trait. I also gave graveyards a production boost with necromancy so that's the reason I want to build them as well.

i don't think this is what you meant, and i don't think its been brought up before, but you got me thinking about some adverse affects of mana nodes that would kinda justify the penalty of using them as far as other civs go. so that its not merely a matter of them disapproving, but having a real reason to fear those mana types.

to explain. what if the more death mana nodes in the game the more productive graveyards were, either in producing numbers, or in the level of those spawned. The same would go for entropy mana and hellfires, General barbarian spawn rates could be increased by the amount of chaos mana in the game. assuming none of these were removed in recent patches(i forget)

you could go one further and have the likely hood of forest and jungle growth affected by the number of nature nodes. ice mana slowing the thaw, sun mana increasing it, etc, etc. basically more dominions-y

i think some of this is already sorta present in the node flares mechanic(sorry, haven't played in a while.) and is fire spreading more likely with fire mana, or is that just with a high AC?

i believe the number of nodes is already being tracked, or atleast it was, since barbarians are, or were, getting affinity bonuses for every mana node in the game. so not sure how much more work there would be.

just thought i'd throw that out there.
 
if i am reading this right(my eyes crossed a couple hours ago)
when a vote comes up in one of the councils it simply cycle every unit in that nation to see if they can contribute an extra vote to that nations choice? thats how chalid, goetia, and teutorix's vote mechanic works?
 
Reasonably certain that they add 1 point to the "Vote Count" of their controlling player when created, and subtract one when they are lost. Much cleaner, and the variable already exists most likely since each person gets a "vote score" in vanilla civ.
 
Reasonably certain that they add 1 point to the "Vote Count" of their controlling player when created, and subtract one when they are lost. Much cleaner, and the variable already exists most likely since each person gets a "vote score" in vanilla civ.


thats what i suspected at first, but not what i am seeing.

the only function tied to this i see is getvotes, which has the lines


for(pLoopUnit = firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = nextUnit(&iLoop))
{
if (GC.getUnitInfo(pLoopUnit->getUnitType()).getDiploVoteType() != NO_VOTESOURCE)
{
iVotes += 1;
}
}



i am guessing this might be a better method, since the other method would require a check each time a unit dies to see if you need to reduce the vote count, where as this one is called just a couple of times every 10-15 turns(depending on the council voting), whenever it needs to be displayed, and when the final vote needs to be tallied.

incidently, checking only against != no_votesource means that teutorix seems to grant a free vote in either the over or the under council, because he doesn't disband when you change between the two, unlike the goetia and chalid.(just checked, i got 2 votes even though all i had was teutorix)

*edited for stupidity*
i am *guessing* you actually want to check against " == evote" but i am unsure about the variable. my kingdom for some function headers.
 
looking at the code again, both use prereq religion, there is a prereq civic, and it is being checked in the function, but both chalid and goetia seem to have theirs set to none, while their religions are set to empyrean and esus. again with the assumptions(gotta stop doing that).

so yeah xienwolf, as long as you can join either council regardless of religion, you should be able to have the hero of the one council giving you a free vote in the other. nice.

the actual code is in doturn, here is a snippet, sorry, java script is off, or i'd hide it

if (m_pUnitInfo->isAbandon())
{
bool bValid = true;
if (m_pUnitInfo->getPrereqCivic() != NO_CIVIC)
{
bValid = false;
for (int iI = 0; iI < GC.getDefineINT("MAX_CIVIC_OPTIONS"); iI++)
{
if (GET_PLAYER(getOwnerINLINE()).getCivics((CivicOptionTypes)iI) == m_pUnitInfo->getPrereqCivic())
{
bValid = true;
}
}
if (GET_PLAYER(getOwnerINLINE()).isAnarchy())
{
bValid = true;
}
}
if (bValid == true)
{
if (m_pUnitInfo->getStateReligion() != NO_RELIGION)
{
bValid = false;
if (GET_PLAYER(getOwnerINLINE()).getStateReligion() == m_pUnitInfo->getStateReligion())
{
bValid = true;
}
}


if bvalid is false, it calls kill on the unit(it also does some screen text to notify you), so if i read all this correctly, they will abandon you if you dont have the religion or civic they require, because its done on doturn(), if you actually give them to yourself through the editor they will leave you when you end turn. i tried it with most of the non civ specific heroes and lost them all.

while there is a prereq alignment in the unit infos, i don't see this function using it, while there could be another function using the isabandon() mechanic, i havent found it yet( i personally am planning on putting the check in whenever the civic changes, if possible), and i checked bambur, chalid, donal, and a couple of others, none of them have there prereqalignment set, MagisterCultuum. though it would be easy enough to add. or did i misunderstand you

*edited to try and space the code*
*spacing didn't work, but editing for stupidity
 
I mistyped. I meant religion. Of course, units can also abandon for civics (you could make council specific heroes that require certain membership if you want), but no hero does.
 
To place code, use the brackets: [ code ] [ /code ], then it preserves your spaces within that.

And the Abandon Function is called from the XML attribute <bAbandon> in the CIV4UnitInfos.xml (It will check for Pre-req Religion & Pre-req Civic fields being satisfied each turn, if not satisfied, they are lost).
 
I'm a bit unsatistified about balance in Marathon speed due to combat experience,
how can i mod experience got from combat, back to Vanilla levels (less experience from combat)?
To balance things i would be also interested to give less %/turn that Mages get free xp and change Hero promotion to 1xp every 3 turns
I have a really marginal knowledge in modding, so if it is doable only through Python or SDK can anyone make a really precise guide how to do it?
 
As I said in the balance thread:
I really think that Twincast and Spell Extension 1 and 2 need to have some effect on direct damage spells rather than only summons.

I'd like it if the extension promotions each would add 1 to the range of each spell with range of at least 1. Preferably, this would involve a new tag (although I you could probably use the existing <iAirRangeChange> tag if you want to), and the spell would add 1 to its range per promotion with this tag. (I'm thinking that it might be good for a new piece of equipment to have this effect too)

It might be best to make Twincast just cause the unit to cast the spell twice. Better yet, to make each spell be cast once more for every promotion with <bTwincast>1 (currently if you have multiple promotions with this tag their bonuses no not stack)


I think that Melstron should be reduced to range 1, but that extension promotions should boost its range to 2 and then 3.



Also, could you make it so that a spell could do damage of multiple types, without needing python? For instance, I'm thinking that the Ritualists' Ring of Fire spell should do Fire and Unholy damage, whereas similar Order and maybe Empyrean spells should do both Fire and Holy damage. This would probably require setting the damage and damage limits separately for each damage type.



Being able to define prerequisite terrain and features in the xml defines instead of python could be useful too.
 
Is there a way to block a unit from purchasing a promotion (preferably python)? I was thinking that there was a define in CvGameUtils.py that I could use, but I don't see one. If there isn't currently a way, is there any chance I could convince you to add one?


Most of the blocks I wanted to add would be to require a unit have a certain religion in order to get the promotions. There is a <StateReligionPrereq> tag in the promotion files, but I see no way to limit these promotions to a unit's religion. It might be a good idea to add such a tag to the schema.

I realize I could add a religion specific spell that grants each of promotions, requires extra xp, and raises the unit's level, which essentially has the same effect, but that gets kind of ridiculous after a point.


Another easy way to get around this would be to go back to the old way of having promotions that mark a unit's religion. Could you tell me where a unit's religion is given, so I can make it grant the promotion too? It wouldn't be hard to give it to all the religion's UUs, but how would I give ti to Esus recon units, for example.


I'd also like to be able to give promotions civic, level, alignment, and civ requirements, but those seem less important so it is probably best to leave them to be dealt with in a python block. The ability to have python blocks for this is much mores useful than the tags, as then it could also depend on the AC, terrain, wonders owned, Score, combinations of religions and civics, vassalage, permanent alliances, etc.
 
I would like to know if someone has the xml with the old summons spells which were removed, so for example that a nature 2 mage can cast both poison blade and poisonous plant. More choices, more fun (for me).

thanks!

Here is the .30 spell xml.

Edit: it isn't letting me attach it, so I'll paste it.

Edit2: unfortunately, it surpasses the limit on post size. I'm not sure how I'm suppose to get it to you.


If you are just trying to add summons, you can easily copy the code for any of the other summon spells, just changing the unit, prereq promotions, and maybe the butttom.
 
Back
Top Bottom