Mod-Modders Guide to Fall Further

Changing religion though python is quite simple.

unit.getReligion()
newUnit.setReligion(iReligion)


Making a unit depend on a trait can be easily handled in python, but not in xml.
 
That works fine then... now that I think about it I think I know how, with the same can/cannot build lists that other things are tied to. Do'h. Brain just needed a nudge in the right direction.
 
Blocking it off in Python seems to have worked just fine. Thanks again.

With Python I was able to get even more specific and block it off to a single leader, so it worked MUCH better.
 
Should

Code:
def spellLieToOO(caster):
        caster.setReligion('RELIGION_OCTOPUS_OVERLORDS')
for
Code:
			<PyResult>spellLieToOO(pCaster)</PyResult>
work as the only python effects of the spell, or do I need more code than that?

I feel pretty odd about having to ask since MC said it'd be easy, and it looks like it should be easy, but I figure I must have the code wrong because it has all the attached sound/light/fury of the spell I've given it in xml, but does nothing to the unit religion. Obviously I have the rest of the xml stuff coded in, not just PyResult >_>
 
iReligion is an integer representing the index of the religion in the CIV4ReligionInfos.xml, not the string representing the religion's name.


If you want to hard code it then
Code:
def spellLieToOO(caster):
        caster.setReligion(2)
would work, as OO is the 3rd religion the file lists and it starts at index 0. Using -1 would remove the religion, 0 would set FoL, 1 would set Order, 3 would set RoK, 4 AV, 5 the Empyrean, and 6 CoE. Of course, if you wanted to rearrange the file (so that the religions would be in order based on aliment, for example) then the spells would all be thrown off (as would some graphics if you didn't change the gamefont).


It is better to use:
Code:
def spellLieToOO(caster):
        caster.setReligion(gc.getInfoTypeForString('RELIGION_OCTOPUS_OVERLORDS'))



I'd personally prefer:

Code:
def spellConvert(caster, sReligion):
	iReligion = gc.getInfoTypeForString(sReligion)
	caster.setReligion(iReligion)

Code:
	<PyResult>spellConvert(pCaster, 'RELIGION_OCTOPUS_OVERLORDS')</PyResult>

So you could use the same python code for multiple xml spells converting to different religions.

iReligion is also what .getReligion() returns, so it should be easy to add a spell that lets a priest spread its own religion to units in its stack. Some weird indexing issues have made it so that it never seems to effect the first unit in the stack when I tried adding such a spell a while back (without risking a crash).
 
Behold, I have been educated.

The Python if-then-else code is simple, but when it starts pulling things from xml/other sources is where I start to trail off and get confused - which is why having the people who made the mod behave in the first place is an utterly invaluable resource to people like me who are trying to beat the code into a slightly different shape. :D Thanks. And I'm only looking at the unit swapping it's own religion so the final code is fantastic.
 
Back to religions and Python... is there an easy way to tell if a religion has already been founded? As in a sort of "if religionfounded = getinfo (ASHEN_VEIL)" sort of list?

Additionally a way to tell if the AI/Player in question has any state religion at all?
 
if CyGame.isReligionFounded(gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL')):

if pPlayer.getStateReligion() != gc.getInfoTypeForString('RELIGION_COUNCIL_OF_ESUS'):

(getStateReligion() should return -1 if there is no state religion)

I was going to link you to Zebra 9's Civ IV Python API, but then I realized that I had downloaded it and a link to My Documents probably wouldn't work so well.
 
You are a man among men Magister.

(That's alright, I have google ;-) Found the API myself.)
 
Allright - is there any sort of setting or code bit I can muck with that makes the AI slightly less stupidly suicidal about tribute when it's a Vassal? With my score at 2564, Dain with one city, a score of 275, and an army of a grand total of two adepts and a mage, with refused to give me his mana in tribute.
 
How is that suicidal? You can't attack him when he is already your vassal :P

Not sure where you would fiddle with things for that effect. Personally I'd be inclined to move it the other way though (Vassals less likely to grant you mana for free)
 
LeaderheadInfos:
Code:
<VassalRefuseAttitudeThreshold>NONE</VassalRefuseAttitudeThreshold>
<iVassalPowerModifier>0</iVassalPowerModifier>

Messing around with those made the AI less eager to pledge blood and soul to the first civ happening onto Feudalism. Less suicidal is a tall order, but those are the two I know about.
 
How is that suicidal? You can't attack him when he is already your vassal :P

It's suicidal because when a vassal refuses a tribute, it unvassals and war is automatically declared. Part of the whole Vassal system is the Master has the right to demand the Vassal give up any resources it may have that he wants.

The only reason I bother to Vassal civs is to get access to the palace mana, since even Conquerors can't build the other civ's palaces and still keep their own...
 
It's auto-war if they refuse? In that case they should be a bit less hesitant I suppose, but it sure doesn't seem right on either end of the scales. Personal preference would be that the capital of any civ which has just been eliminated should spawn a raw mana node if razed (hrm... maybe make the tile of any capital city provide the Mana which the Civ is supposed to embody (and remove it from their palace)? Make it a bit hard for the FF Civs to decide on what to have, but then you'd have a reward if you razed or not).

Probably be slightly easier to create "Relics" for each Civ which are placed in their last city when captured. They would be a building which is mobile (ie - Dragon's Horde) and provides that Civ's base Mana (just the primary mana of the civ, not the full palace). Then you cover both razing and keeping of the city elegantly.

And for vassals, I really think that they ought to cost a TON of maintenance if their score is too much lower than their master's score. That way a vassalization to stop a long and drawn out war (near-equals), or a master who provides for his Vassal will gain the full standard benefits, and someone who cracks the whip to exploit their palace has to pay out the nose to keep them in line.
 
I dunno. It seems far more thematic for a Conqueror trait - you let them have the administration of the capital city, you handle the main administration of everywhere else and all the effort goes to somewhere.

A lot of it is mainly because there is no such relic system. I'd actually be inclined to create one - python scripting it right? If there's a function to handle discerning if that was the enemy's last city... I could probabaly roll it out pretty fast. Ideally, it'd be a choice for the conqering civ of the three palace mana that civ spawns with, through an event, then it drops the relic which is just Conquest Mana: Law, or somesuch that can be put in YOUR capital.

Alright, now I've gotten myself exited. Is there function for "last city of X civ, run event code X"? Or a nudge in the right direction?
 
Look at how the Illians trigger the ability ot cast the Awake from Slumber ritual. There is a specific call for when a civilization is destroyed, and whatever pieces of that are exposed to python are linked in with the Illians and nowhere else I can think of right now. Once you identify that call to point out that a Civ has been destroyed, you just have to check what their Unique Building is for the Palace and see what resources it provides for free. Then look at how Hyborem's Whisper works to see how to give the player a 3 option pop-up, design your relics and you are done.

Heck, you could even have a check to see if the Leader (capturing the city) has Conqueror Trait and allow them to pick twice (Or preferably have them get a different popup where they choose one mana to NOT gain. Automatically granting them both Mana in cases like Mercurian/Hippus where there are only 2 Mana anyway)
 
Look at how the Illians trigger the ability ot cast the Awake from Slumber ritual. There is a specific call for when a civilization is destroyed, and whatever pieces of that are exposed to python are linked in with the Illians and nowhere else I can think of right now.

Hmmm. No dice.
if eProject == gc.getInfoTypeForString('PROJECT_STIR_FROM_SLUMBER'):
if pPlayer.getPlayersKilled() == 0:
return True
It only cares if you've killed a civ - not which one, sadly.

I tried looking at the Python code for the defeat popup messages too, but that seems to be run from a different side of it than I'd need it to be... the idea may need to be shelved for now as I can't think of anywhere else the defeat code might pop up.
 
I'd look at the callbacks and see if there is one for onCityCaptured next (not onCityAcquiredAndKept or onCityRazed preferably, but if there is no call before the decision is made, then look for both of those options)

If you find such a function, then check if the player losing the city has any other cities (getNumCities) and do it that way.
 
Back
Top Bottom