Modders Guide to FfH2

How would I code a check in python to see if a specific AI civilization exists, and not have an event trigger if they do? For example, if the Lanun are not in the game or already destroyed, then an event for Lanun pirates could occur.
 
Another question - is there an uncomplicated way to have all the plots that meet a specific requirement in a chosen city have the same effect occur at once?
What I want to do is have an event where all farms in the same city control get a -1 or +1 gold for the duration of the event (which will be as long as the player follows the Aristocracy civic).
I'm hoping it is xml, but python will work if it's not too painful.
 
How would I code a check in python to see if a specific AI civilization exists, and not have an event trigger if they do? For example, if the Lanun are not in the game or already destroyed, then an event for Lanun pirates could occur.

Here's a bit of code from RifE's CustomFunctions file, determines what code is ran each turn:

Code:
iAreThereScionsHere = CyGame().getNumCivActive(iScionCiv)

If that is equal to 0, allow your event. Otherwise, don't.



Unfortunately, I don't know the answer to your second question, there.
 
getNumCivActive is a FF only function. you can simply loop over the players though
Code:
	iLizCiv1 = gc.getInfoTypeForString('CIVILIZATION_MAZATL')
	
	iAreThereLizardsHere=0
	for iPlayer in range(gc.getMAX_PLAYERS()):
		pPlayer = gc.getPlayer(iPlayer)	
		if pPlayer.getCivilizationType()==iLizCiv1:
			iAreThereLizardsHere+=1
pretty sure you need python for the farm event.
 
getNumCivActive is a FF only function. you can simply loop over the players though
Code:
	iLizCiv1 = gc.getInfoTypeForString('CIVILIZATION_MAZATL')
	
	iAreThereLizardsHere=0
	for iPlayer in range(gc.getMAX_PLAYERS()):
		pPlayer = gc.getPlayer(iPlayer)	
		if pPlayer.getCivilizationType()==iLizCiv1:
			iAreThereLizardsHere+=1
pretty sure you need python for the farm event.

Ah. Unfortunate, that adds a bit of python to it. :lol:
 
getNumCivActive is a FF only function. you can simply loop over the players though
Code:
	iLizCiv1 = gc.getInfoTypeForString('CIVILIZATION_MAZATL')
	
	iAreThereLizardsHere=0
	for iPlayer in range(gc.getMAX_PLAYERS()):
		pPlayer = gc.getPlayer(iPlayer)	
		if pPlayer.getCivilizationType()==iLizCiv1:
			iAreThereLizardsHere+=1
pretty sure you need python for the farm event.

Thanks! Just to clarify though - will the function return 0 for destroyed civs as well as never in the game ones?
 
if you want to check if a player is still alive you can use pPlayer.isAlive()
 
In the Leader Attributes I noticed there is a bFemale, is that being utilized in anything.
I can see a possibility for various Events, or Leader Traits and such.
 
In the Leader Attributes I noticed there is a bFemale, is that being utilized in anything.
I can see a possibility for various Events, or Leader Traits and such.

Certain leader attitude modifiers (Os-Gabella hates men) and events (Falamar's Pron events).
 
I'm creating a barb unit via an event. The creation works fine, but is there a way to set the unit's move to 0 so it does not leave the square via python in CvRandomEventInterface in the do function? And is there also a way to set a duration for the created unit in the same function so it disbands automatically after X number of turns?

Here's what I have:

Code:
def doTreantRage3(argsList):
	iEvent = argsList[0]
	kTriggeredData = argsList[1]
	pPlot = gc.getMap().plot(kTriggeredData.iPlotX, kTriggeredData.iPlotY)
	if pPlot.getNumUnits() == 0:
		bPlayer = gc.getPlayer(gc.getBARBARIAN_PLAYER())
		newUnit = bPlayer.initUnit(gc.getInfoTypeForString('UNIT_TREANT'), pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
 
try newUnit.setDuration(iTurns)

don't know of a python function that allows you to modify the basemoves, but you could use the same promotion that keeps Acheron in his City.
 
Yes it is, and that's something that both Orbis and RifE have removed. ;)

I'd love to steal your leash mechanic but it involve dll work, which is out of my league :lol:

So, any suggestion on how to reduce movement without hampering spellcasting ability? How about creating 2 units (like Brigit held and Brigit free?)
 
The immobile timer is a BtS thing, so it is available in FfH2 as well. It does stop casting.


DOMAIN_IMMOBILE units can still cast spells. If you want you could create a copy of Acheron that is identical to the normal dragon except for having this domain. Making him change back when captured could be a bit tricky, but not too bad. The easiest way would likely be adding this code to def onUnitCreated in CvEventManager.py:
Code:
		if unit.getUnitType() == gc.getInfoTypeForString('UNIT_ACHERON_IMMOBILE'):
			if not pPlayer.isBarbarian():
				newUnit = pPlayer.initUnit(gc.getInfoTypeForString('UNIT_ACHERON'), unit.getX(), unit.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
				newUnit.convert(unit)


.
 
It is a Barbarian unit, so you can control the actions it takes completely via python if you want to. Giant Spiders are controlled in this manner to prevent them from moving at all unless units are in range for them to attack. In your case you would have to check surrounding tiles for potential spell targets, but the cost of the python should be minimal if the unit is only created by event and lasts a short period of time.
 
I'd love to steal your leash mechanic but it involve dll work, which is out of my league :lol:

So, any suggestion on how to reduce movement without hampering spellcasting ability? How about creating 2 units (like Brigit held and Brigit free?)

I was actually talking about removing the block on Casting put in place by Held; Basically, Held units can cast.
 
A lot of mods have (or used to have if they've now become full downloads) installers that copied the FFH 2 directory.

How do you configure an installer to do this? I have a mod of Final Frontier (named, coincidentally, FFPlus) that currently requires the user to copy the Final Frontier mod folder and extract the zip over it. I'd love to set it up with an installer instead.

I seem to remember someone posting it in this thread but a quick search for "Installer" only turned up some discussion about the default Fall from Heaven 2 installer.
 
A lot of mods have (or used to have if they've now become full downloads) installers that copied the FFH 2 directory.

How do you configure an installer to do this? I have a mod of Final Frontier (named, coincidentally, FFPlus) that currently requires the user to copy the Final Frontier mod folder and extract the zip over it. I'd love to set it up with an installer instead.

I seem to remember someone posting it in this thread but a quick search for "Installer" only turned up some discussion about the default Fall from Heaven 2 installer.

Thief. :p

Check the Inno Script Tutorial in my sig; The script I used as the base would copy the old FFPlus folder and make a new RifE folder.
 
Back
Top Bottom