Modders Guide to FfH2

Kael

Deity
Joined
May 6, 2002
Messages
17,401
Location
Ohio
The BtS version of FfH2 is being rewritten from the ground up with mod modders in mind. This article will detail the new attributes and features available for easy use.

A few guidelines for this project:

1. We won't be hardcoding anything in the SDK. This exposes mini-modders to issues when they remove an object that is referenced in the SDK and crashes start occuring. If hardcoding is required it will be done in python.

2. We won't be taking requests for new features. Sorry about this, I know a lot of people are going to see this list, love what we have done and ask for a few more attributes. Not only do I stay very busy just coding the ideas for the FfH2 team, I don't want to add features that we won't use. That decreases the performance and risk of compatibility issues for no advantage in FfH2.

3. We will always make the source code available for those that would like to use it. We have no desire to try to hide the effort of our work, and we are flattered when we see it appear in other projects. If it makes your mod better, or even just saves you a little time you are free to use any part of FfH2.

4. I can't promise a lot of support. Sorry about that, my primary goal is FfH2 and we have a lot of work to do on it. What is provided is done so "as is". I do try to spend a fair amount of time documenting and writing articles but I can't promise that I will be very responsive to crashes or issues you are having using this code.

5. I invite people to use our ideas, lore, code, etc. The only thing I ask is that you not use the Fall from Heaven name. We reserve that for "official" FfH team releases. You can say your mod is "based on Fall from Heaven" but don't call it "Fall form Heaven III", "Fall from Heaven: Age of Magic" or any name that uses Fall from Heaven in the title.

6. Permission is not given to use the Fall from Heaven brand, characters, etc in for profit games. If you are interested in doing that please send me a PM.


Downloads:

New Files:

CIV4SpellInfos.xml-
CIV4UnitSpellSchema.xml-
CIV4AlignmentInfos.xml-
CIV4DamageInfos.xml-

CvSpellInterface.py-
CvPediaSpell.py-

New Attributes:

Global Defines

ALIGNMENT_ATTITUDE_GOOD_TO_GOOD- Base alignment adjustment good AI players have toward good players
ALIGNMENT_ATTITUDE_GOOD_TO_NEUTRAL- Base alignment adjustment good AI players have toward neutral players
ALIGNMENT_ATTITUDE_GOOD_TO_EVIL- Base alignment adjustment good AI players have toward evil leaders
ALIGNMENT_ATTITUDE_NEUTRAL_TO_GOOD- Base alignment adjustment neutral AI players have toward good players
ALIGNMENT_ATTITUDE_NEUTRAL_TO_NEUTRAL- Base alignment adjustment neutral AI players have toward neutral players
ALIGNMENT_ATTITUDE_NEUTRAL_TO_EVIL- Base alignment adjustment neutral AI players have toward evil leaders
ALIGNMENT_ATTITUDE_EVIL_TO_GOOD- Base alignment adjustment evil AI players have toward good players
ALIGNMENT_ATTITUDE_EVIL_TO_NEUTRAL- Base alignment adjustment evil AI players have toward neutral players
ALIGNMENT_ATTITUDE_EVIL_TO_EVIL- Base alignment adjustment evil AI players have toward evil leaders
APOCALYPSE_KILL_CHANCE- Chance that Apocalypse will kill a living unit
BARBARIAN_EXPERIENCE_MODIFIER- Percentage modifier to the expereince gained from defeating barbarain units
BONUS_MANA- Bonus type for mana
BONUSCLASS_MANA- Bonus class for mana
COMBAT_APPLY_CHANCE- Percentage chance that a promotion is applied to enemy during combat
CRUSADE_SPAWN_CHANCE- Chance a Demagog will spawn from a town each turn a player is on a Crusade
FEATURE_REQUIRE_RESIST_AMOUNT- Resistance amount requried to enter feature plots that require resistance
FEATURE_UPGRADE_CHANCE- Percentage chance that an improvement will upgrade to its FeatureUpgradeType each turn
FLAMES_EXPIRE_CHANCE- Percentage chance that flames will die out each turn
FLAMES_EXPIRE_EFFECT- What flames become after they expire
FLAMES_FEATURE- Feature used for the flames effect
FLAMES_SPREAD_CHANCE- Percentage chance that flames will spread to surrounding tiles or through fire damage
FLAMES_SPEAD_EFFECT- What the Flames feature spreads
FREE_XP_MAX- Free XP per turn from promotions stops after this number
GLOBAL_COUNTER_LIMIT_DEFAULT- Base limit of the global counter
GLOBAL_COUNTER_LIMIT_PER_PLAYER- Limit increase to the global counter per player
GREAT_COMMANDER_PROMOTION- Promotion that indicates a unit with a bonded Great Commander
HELLFIRE_CHANCE- Chance in 10,000 that a tile will be converted to Hellfire when the ritual is built
HIDDEN_NATIONALITY_PROMOTION- Promotion that grants a unit Hidden Nationality
IMPROVEMENT_UNIQUE_CHANCE- Chance that a unique improvement will appear on the map
INVISIBLE_TYPE- Base Invisibility Type
LOKI_UNREST_CHANCE- Chance that Loki causes unrest in cities each turn
MUTATED_PROMOTION- Promotion that marks a unit that has been mutated
MUTATION_CHANCE- Percent chance that each mutation promotion will be applied to a mutated unit
ORDER_SPAWN_CHANCE- Percent chance that a unit will spawn when the Order spreads to a city
PLANAR_GATE_CHANCE- Chance in 10,000 that a Planar Gate will summon a creature each turn
POISONED_PROMOTION- Promotion that indicates a unit is poisoned
RANDOM_CIVILIZATION- Holds the random alignment leaders (NONE to disable)
RAZE_COST_BASE- Base effect on the Global Counter when cities are razed
RAZE_COST_PER_POPULATION- Effect on the Global Counter for each population point past the limit
RAZE_COST_PER_POPULATION_OVER- City populations must be above this before the per population adjustment is applied
RELIGION_ADOPTION_CHANCE- Base chance a unit adopts a religion in the city it is built in
SLAVE_UNITCLASS- Unitclass created from enslavement
SOMNIUM_BASE_DELAY_TURNS- Minimum amount of turns between Somnium games with one opponent
SPECIALUNIT_SPELL- This specialunit type doesn't get duration boosts and dies each turn
SPELL_RESIST_CHANCE_BASE- Base Chance of a unit to resist a spell before modifiers
SPELL_RESIST_CHANCE_MAX- Maximum spell resistance chance
SPELL_RESIST_CHANCE_MIN- Minimum spell resistance chance
STARTING_SETTLER_PROMOTION- Promotion that the beginning settlers start with (NONE to not grant any)
TILES_PER_SPAWN- Amount of unowned tiles per spawn before lairs stop spawning
TREANT_SPAWN_CHANCE- Chance that a Treant will spawn from an ancient forest
WEAPON_PROMOTION_TIER1- The tier 1 weapon promotion that is given to units
WEAPON_PROMOTION_TIER2- The tier 2 weapon promotion that is given to units
WEAPON_PROMOTION_TIER3- The tier 3 weapon promotion that is given to units
WEAPON_REQ_BONUS_TIER1- Bonus required for the tier 1 weapon promotion (NONE to not require any)
WEAPON_REQ_BONUS_TIER2- Bonus required for the tier 2 weapon promotion (NONE to not require any)
WEAPON_REQ_BONUS_TIER3- Bonus required for the tier 3 weapon promotion (NONE to not require any)
WRATH_CONVERT_CHANCE- Change that the Wrath event will convert each living unit


Bonus Attributes:

bModifierPerBonus- If this is set to true (1) then the bonus's effects are cumulative (ex: so a bonus with +1 happiness would give +1 for each amount of the bonus the city has access to instead of just +1 if it has it or not)
iBadAttitude- This value is multiplied by the leaders iAttitudeBadBonus value to determine an attitude adjustment for using this bonus type
iDiscoverRandModifier- Percent the bonus modifies the chance improvements find new resources
iGreatPeopleRateModifier- Percent amount the bonus modifies the great people rate
iHealChange- Amount the bonus effects the heal rate of friendly units within your borders
iHealChangeEnemy- Amount the bonus effects the heal rate of enemy units within your borders
iMaintenanceModifier- Effect having the resource has ont he cities maintenance costs
iMutateChance- Chance that units built in the city will begin mutated
iResearchModifier- Percent amount the bouns effects the players research amount
DamageType- If a unit has affinity to this bonus this is the damage type that affinity grants (ex: death mana has this set to DAMAGE_DEATH)
FreePromotion- If having access to this bonus in a city grants a promotion to units in that city

Building Attributes:

bApplyFreePromotionOnMove- If the FreePromotion this building offers is granted to units that pass through the city (instead of just to units built in the city)
bEquipment- If the building can be picked up as equipment (ex: Crown of Akharien).
bHideUnits- If the building causes all your teams units in your lands to become invisible (ex: Nox Noctis).
bNoCivicAnger- If the Building keeps you from suffering from civic anger (if another civ has a civic that your people want).
bRequiresCaster- If the building dissapears if a unit that can't create it with a spell isnt in the city
bSeeInvisible- If the building disables invisibility in your lands.
bUnhappyProduction- If you geta bonus hammer from every unhappy citizen in your cities.
iCrime- Buildings modifier on the cities crime rate.
iFreePromotionPick- The amount of free promotions that are granted to units built in the city
iGlobalResistEnemyModify- Modifier to your opponents resistance chances vs your spells
iGlobalResistModify- Modifier to your resistance chances vs your enemies spells
iModifyGlobalCounter- The amount that creating the building modifies the global counter
iPlotRadius- If this building modifies the cities plot radius, only 1 or 3 are valid entries.
iResistMagic- Modifier to the Magic Resistance of units in the city
FreeBonus2- Extra bonus the building provides
FreeBonus3- Extra bonus the building provides
PrereqTrait- If the building requires a trait in order to be built
RemovePromotion- If the building removes a promotion from units passing through the city
SpecialistCommerceChanges- Modifiers to specialists commerce rates in your empire.

Civic Attributes:

bCompassionHigh- Marked if havng this civic allows this player to qualify for the high compassion attitude modifier
bCompassionLow- Marked if havng this civic allows this player to qualify for the low compassion attitude modifier
bHidden- If the civic isn't displayed in diplomacy (so others don't know you have it).
bNoDiplomacyWithEnemies- The player cannot initiate diplomacy with enemies when this civic is selected
bPrereqWar- This civic can only be selected when the player is at war
iAttitudeShadeMod- Modifier on attitude with other leaders that have this civic.
iCoastalTradeRoutes- Modifier to the amount of trade routes in coastal cities
iEnslavementChance- Chance that slaves will be captured from defeated living units
iFoodConsumptionPerPopulation- To change the base amount of food consumed per person
BlockAlignment- Alignment that cannot choose this civic.
PrereqAlignment- Alignment that is required to choose this civic
PrereqCivilization- Civilization that is required to choose this civic
PrereqReligion- Religion that is required to choose this civic

Civilization Attributes:

bGraphicalOnly- Civilizations with this set can't be selected from the load game menu.
CivTrait- This trait is applied to all leaders of this Civilization
DefaultRace- This promotion will be given to all units that aren't world units and don't already have a race promotion assigned
Hero- The Hero of the Civ (used in some display strings and spells).
MaintainFeatures- Features listed here won't be removed when improvements are added.

Event Attributes:

iCrime- Amount the event modifies the crime rate of the city.
iGlobalCounter- Amount the event modifies the global counter (Armageddon Counter).
PrereqAlignment- Alignment required to select this event option.
PrereqBonus- The player has to have at least 1 of this bonus to select this event option.
PrereqCivilization- Civilization required to select this event option.
PrereqReligion- Religion required in the city to select this event option.
PrereqStateReligion- State religion required to select this event option.

EventTrigger Attributes:

iPrereqCrime- The city must have this crime rate before this event will trigger.
iPrereqGlobalCounter- The global counter must be at this level or higher before this eventtrigger can occur
PrereqAlignment- This eventtrigger will only happen for leaders of this alignment
PrereqCivilizationPleased- This civilization must be pleased with the player before this event will trigger for the player.
PrereqLeader- This event will only trigger for this leader.
PrereqTrait- This eventtrigger will only happen for leaders with this trait

Feature Attributes:

bFlammable- If this feature can catch fire (for flames spread)
FeatureUpgrade- The plot has a chance per turn equal to the FEATURE_UPGRADE_CHANCE of turning into the set feature
PrereqStateReligion- if this feature requires a specific state religion before it can spawn (ex: Ancient Forests)
RequireResist- If resitance is required before untis can move through plots with this features (ex: Flames and fire resistance).

Handicap Attributes:

iAIFreeXP- Free experience that is given to all the AI units.
iLairSpawnRate- The chance that lairs will spawn unit for this difficulty type

Improvement Attributes:

bRequiresPeak- If this Improvement is only valid on peaks.
bUnique- If this is a "Unique Feature", setting this will give the improvement a chance to be spawned by the random map generator
iAppearanceProbability- chance (in 10,000) that this improvement will be placed on applicable plots by the random map generator
iHealRateChange- If this improvement effects the heal rate of units in the plot.
iRange- Range that the improvements range defense modifier is applied.
iRangeDefenseModifier- Amount of defense modifier given.
iVisibilityChange- If this improvement effects the sight range of units on the tile
BonusConvert- If this improvement creates a bonus on the tile (ex: Death Mana improvement changes the raw mana Bonus to Death Mana)
FeatureUpgrade- If this improvement has a chance to turn into a feature.
PrereqCivilization- If set only the set Civilizations will be able to upgrade to this improvement.
PythonAtRange- If the plot is PythonActive this python function will trigger when a unit comes within 1 space fo this plot
PythonOnMove- If the plot is PythonActive this python function will trigger when a unit enters this plot
SpawnUnitType- If this improvement has a chance to spawn barbarian units.

Leader Attributes:

bFemale- 0 if the leader is male, 1 for female
bGraphicalOnly- If set this leader can't be selected form the load game menus.
iAttitudeBadBonus- This value is modified by a bonuses iBadAttitude to determine an attitude adjustment
iAttitudeCompassionHigh- The attitude modifier that is applied towards leaders using a high compassion civic
iAttitudeCompassionLow- The attitude modifier that is applied towards leaders using a low compassion civic
iAttitudeFromFemales- Modifier to attitude from female leaders (ex: Falamar gets +2 from female leaders)
iAttitudeFromMales- Modifier to attitude from male leaders
iAttitudeToFemales- Modifier to attitude this leaders gives to female leaders (ex: Falamar gives +2 to female leaders)
iAttitudeToMales- Modifier to attitude this leader gives to male leaders (ex: Os-Gabella gives -4 to male leaders)
iSomniumAggressiveness- How risky this leaqders Somnium play is when controlled by the AI.
Alignment- The leaders starting alignment
FavoriteTech- The tech the leader prefers.
FavoriteUnitCombat- UNit Combat the leader prefers to build.
FavoriteWonder- This leader will give a +4 attitude adjustment to a leader that owns this wonder
PermanentTrait- The trait that cannot be removed by the Adaptive trait
ReligionWeightModifiers- Modification the leader gives to any configured religion. Setting a value to -100 or lower will make the leader unable to adopt the religion.

Promotion Attributes

bAIControl- If the promotion caused the unit to come under AI control (the AI will be very agressive with them)
bBoarding- A domain land unit with this promotion can attack domain water units
bOnlyDefensive- Keeps the unit from being able to attack
bDispellable- If this promotion can be dispelled by the bDispel setting on spells
bDoubleFortifyBonus- Doubles the fortify bonus for units with this promotion
bEquipment- (disabled)
bFear- When defending attacking living units may break off combat, when attacking if combat is successful living units in the defending plot have a chance to flee to other plots
bFlying- Allows the unit to travel over all tiles with a flat movement cost.
bHeld- If set this promotion will keep the unit from being able to move or use abilities.
bHiddenNationality- Keeps the unit nationality from being displayed and allows the unit to attack without causing war. Units with Hidden Nationality cant capture other units.
IgnoreBuildingDefense- This promotion will allow a unit to ignore defensive bonuses granted from buildings (like walls).
bImmortal- Instead of dying a unit with this promotion will be reborn in his captial. Doing so removes this promotion
bImmuneToCapture- If the unit can't be captured
bImmuneToDefensiveStrike-
bImmuneToFear- If this makes unit is immune to fear
bImmuneToMagic- If this makes the unit immune to resistible spells (the unit will still be effected by spells that cant be resisted)
bInvisible- (disabled)
bMutation- If this promotion can be randomly applied by mutation
bNotAlive- Units with this promotion won't be marked as alive
bPrereqAlive-
bRace-
RemovedByCasting-
bRemovedByCombat-
bRemovedWhenHealed-
bSeeInvisible-
bTargetWeakestUnit-
bTargetWeakestUnitCounter-
bTwincast-
bValidate-
bWaterWalking-
iAIWeight-
iBetrayalChance- Chance per turn the unit will turn barbarian
iBetterDefenderThanPercent-
iCasterResistModify-
iCombatCapturePercent-
iCombatHealPercent-
iCombatLimit-
iCombatPercentDefense-
iCombatPercentGlobalCounter-
iCombatPercentInBorders-
iDefensiveStrikeChance-
iDefensiveStrikeDamage-
iExpireChance-
iExtraCombatStr-
iExtraCombatDefense-
iFreeXPPerTurn-
iFreeXPFromCombat-
iGoldFromCombat-
iGroupSize- Overrides the units group size (ex: the Hero promotion is set to 1 so the unit shows as a solo model, this could also be used to visually different regiment sizes)
iMinLevel-
iModifyGlobalCounter-
iModifyGlobalCounterOnCombat-
iResistMagic-
iSpellCasterXP-
iSpellDamageModify-
iWorkRateModify-
CaptureUnitCombat- Specified unit combat will be captured instead of killed
PromotionCombatApply-
PromotionImmune1-
PromotionImmune2-
PromotionImmune3-
PromotionRandomApply-
PromotionSummonPerk-
BonusPrereq-
PromotionPrereqOr3-
PromotionPrereqOr4-
PromotionPrereqAnd-
PromotionNextLevel-
PyPerTurn-
UnitArtStyleType-
PromotionCombatType- Promotion this promotion grants a combat bonus/penalty against
iPromotionCombatMod- Amount of a bonus/penalty the PromotionCombatType appies to
DamageTypeCombats-
BonusAffinties-
DamageTypeResists-

Religion Attributes

bHidden-
bSneakAttack-
bUpdateSight-
iGlobalCounterFound-
iGlobalCounterSpread-
Alignment-
AlignmentBest-
AlignmentWorst-

Tech Attributes:

bWater-
PreferredAlignment-
PrereqReligion-

Terrain Attributes:

ArtDefineTag2-
bNormalize- if it is set to false (0) this terrain type won't be used in random map generation (ex: hell terrain is set to 0)
iPlotCounterDown- if the plot counter goes below this number the terrain switches to the TerrainDown attribute (ex: 10)
TerrainDown- the terrain type the plot switches to if it gets below the iPlotCounterDown value (ex: TERRAIN_GRASS)
iPlotCounterUp- if the plot counter goes above this number the terrain switches to the TerrainUp attribute (ex: 9)
TerrainUp-the terrain type the plot switches to if it gets above the iPlotCounterUp value (ex: TERRAIN_BROKEN_LANDS)

Trait Attributes:

bAdaptive-
bAgnostic-
bBarbarianAlly-
bIgnoreFood-
bInsane-
bSelectable-
bSprawling-
iFreeXPFromCombat-
iMaxCities-
iPillagingGold-
iStartingGold-
iSummonDuration-
iUpgradeCostModifier-

Unit Attributes

bAbandon-
bAutoRaze-
bDisableUpgradeTo-
bExplodeInCombat-
bFreeXP-
bImmortal-
bImmuneToDefensiveStrikes-
bNeverObsolete-
bNoWarWeariness-
iCombatDefense-
iDefensiveStrikeChance-
iDefensiveStrikeDamage-
iDurationFromCombat-
iEnslavementChance-
iFreePromotionPick-
iGoldFromCombat-
iMinLevel-
iMiscastChance-
iModifyGlobalCounter-
iPrereqGlobalCounter-
iTier- Indication of the units tier, used for spells and such (nothing hardcoded).
iWeaponTier-
iWithdrawlProbDefensive-
DiploVoteType-
EquipmentPromotion-
PrereqAlignment-
PrereqBuildingClass- Unit requires this BuildingClass (instead of a specific building) to be built (ex: training yard class requirement for axemen is fulfilled either by a normal training yard or the bannor specific training yard replacement). If the Civ can't build a building of this class this requirement is ignored (ex: Doviello Axemen don't need training yards).
PrereqCivic-
PromotionFromCombat-
Image-
UnitConvertFromCombat-
iUnitConvertFromCombatChance-
UnitCreateFromCombat-
iUnitCreateFromCombatChance-
PythonPostCombatLost-
PythonPostCombatWon-
DamageTypeCombats-
BonusAffinities-
 
The Spell System:

Description- Name of the spell.
Civilopedia- Pedia entry for the spell.
Strategy- Unused.
Help- Additional text that is added to the mouseover text.
PromotionPrereq1- Promotion required to use this spell.
PromotionPrereq2- Promotion required to use this spell.
UnitPrereq- The only unit that can use this spell (ex: UNIT_DWARVEN_DRUID can use the Crush spell).
UnitClassPrereq- The only unitclass that can use this spell (ex: only UNITCLASS_WARRIOR can use the Drown spell).
UnitCombatPrereq- Only this unitcombat can use this spell (ex: only UNITCOMBAT_MELEE Khazad units can use the Create Battering Ram spell).
UnitInStackPrereq- Requires this unit to me in the casters stack to use this spell (example: you can only use the Add to Flesh Golem spell if there is a UNIT_FLESH_GOLEM in the casters stack).
BuildingPrereq- If this is set this spell can only be used if the unit is in a city with this building.
BuildingClassOwnedPrereq- If this is set the player has to have at least one of this buildingclass to enable this spell.
bCivilizationPrereq- Only this Civilization can use this spell (ex: only CIVILIZATION_BALSERAPHS can use the Ass to Freak Show spell).
FeatureOrPrereq1- This spell can only be used in plots that have this feature or the feature in FeatureOrPrereq2.
FeatureOrPrereq2- This spell can only be used in plots that have this feature or the feature in FeatureOrPrereq1.
ImprovementPrereq- This spell can only be used in plots that have this improvement.
PromotionInStackPrereq- A unit in the units stack but have this promotion to enable this spell.
ReligionPrereq- A unit must have this religion to use this spell (ex: only RELIGION_THE_ORDER units with Channeling 2 and Divine promotions can cast Bless).
StateReligionPrereq- The player must be this state religion before the spell can be used (ex: only a RELIGION_OCTOPUS_OVERLORDS player can use the Drown spell).
TechPrereq- The technology must be research before the player can use this spell (ex: TECH_ENGINEERING must be known to use the Create Battering Ram spell).
bAllowAI- If this is set to 1 the AI is allowed to use the spell.
AdjacentToWaterOnly- If this is set to 1 the spell can only be cast when the caster is within 1 tile of water.
bCasterMustBeAlive- The caster must be alive to use this ability (such as being able to be added to a Flesh Golem).
bCasterNoDuration- The caster must not have a duration to uswe this ability (such as being able to be added to a Flesh Golem).
bCausesWar- If this is set to 1 the player will get a popup warning him that this spell could cause a war is the game detects a neutral unit within range.
bGlobal- A player can only cast 1 global spell per game. Setting this to 1 uses the player global spell ability when its cast.
bInBordersOnly- If this is set to 1 this spell can only be cast within the players borders.
bInCityOnly- If this is set to 1 this spell can only be cast within cities (setting a spell to 1 for both bInBordersOnly and bInCityOnly means that it can only be cast in the players own cities).
bPrereqSlaveTrade- The Slave Trade diplovote action must be passed to enable a spell with this set.
iAIWeight- A modifier that adjusts the value the AI uses to select which spell it will cast.
iCasterMinLevel- The unit must be at least this level to use this spell.
bDisplayWhenDisabled- If this is set to 1 the spell icon won't be shown at all if the spell is disable (instead of being shown greyed out).
bHasCasted- If this is set to 1 casting this spell uses up the casters 1 spell per turn ability.
bIgnoreHasCasted- If this is set to 1 this spell can be cast even if the caster has already cast a spell this turn (ex: Spellstaff).
bResistable- If this is set to 1 targets have a chance to resist this spell.
iRange- sets the range the spell effects, if it isn't set it only effects the casters tile (for damage, immobile, add or remove promotions)
iResistModify- modifier the victim's resistance chance, the higher this value the easier the spell is to resist

Damage Spells
iDamage- Base percent damage the spell will do do to targets before modifiers are applied
iDamageLimit- Maximum damage the spell will do to targets (ie: a spell with this set to 75 will never push a unit beyond 75% damage, a spell must have this at 100 to be able to kill targets with damage)
DamageType- Sets the type of damage the spell does (ex: DAMAGE_FIRE)

Buff Spells
AddPromotionType1- Adds this promotion all units within the range unless they are immune according to the immune targets specifier
AddPromotionType2- Additional promotion added as above
AddPromotionType3- Additional promotion added as above
RemovePromotionType1- Removes the specified promotion to all units within range unless they are immune
RemovePromotionType2- Additional promotion removed as above
RemovePromotionType3- Additional promotion removed as above
bBuffCasterOnly- If this is selected the add or remove promotion effect will only be applied to the caster

ConvertUnitType- Changes the caster into the selected unit type (Wane uses this to change the caster into a Shade).
CreateBuildingType- Creates the building in the city the caster is in.
CreateFeatureType- Creates the selected feature in the casters plot.
CreateImprovementType- Creates the selected improvement in the casters plot.
SpreadReligion- Spreads the selected religion into the city the caster is in.

Summon Spells
CreateUnitType- Unit that will be summoned
iCreateUnitNum- Number of units that are summoned (ex: meteor swarm is 3)
bCopyCastersPromotions- If set the summoned creatures gets all the casters promotions.
bPermanentUnitCreate- set to 1 no duration will be set on the unit
CreateUnitPromotion- Promotion summoned units start with

Immune Targets
bImmuneTeam- If set damage and add promotion spells won't effect units that are on the casters team.
bImmuneNeutral- If set damage and add promotion spells won't effect units that aren't on the casters team and aren't enemies.
bImmuneEnemy- If set damage and add promotion spells won't effect enemy units.
bImmuneFlying- If set damage and add promotion spells won't effect flying units
bImmuneNotAlive- If set damage and add promotion spells won't effect non-living units

bAbility- Abilities aren't disabled when spellcasting is blocked.
bDispel-
bPush-
bRemoveHasCasted-
bSacrificeCaster-
iChangePopulation-
iCost-
iDelay-
iImmobileTurns-
iMiscastChance-
PyMiscast-
PyResult-
PyRequirement-
Effect-
Sound-
HotKey-
bAltDown-
bShiftDown-
bCtrlDown-
bGraphcialOnly-
iHotKeyPriority-
Button-

New SDK functions:

CvGame

int getGlobalCounter();-
int getTrueGlobalCounter();-
int getMaxGlobalCounter();-
int getTrueMaxGlobalCounter();-
void changeGlobalCounter(int iChange);-
int getGlobalCounterLimit();-
void changeGlobalCounterLimit(int iChange);-

CvPlayer

void addTrait(TraitTypes eTrait);-
void removeTrait(TraitTypes eTrait);-

CvPlot

int getplotCounter();-
void changePlotCounter(int iChange);-

CvUnit

bool canCast(int spell, bool bTestVisible);- If the unit can cast the selected spell
void cast(int spell);- Forces the unit to cast the spell (ignores all restrictions)
int getDuration() const;- The duration is how long until the unit will be destroyed
void changeDuration(int iChange);- change the units duration
bool isResisted(const CvUnit* pCaster, int iModify) const;- returns true if the spell is resisted, false if it isnt
int chooseSpell();- has the AI pick the spell he thinks would be best form those that are available to this unit
void doDamage(int iDmg, int iDmgLimit, CvUnit* pAttacker);-apply damage to the unit
void doEscape();- pull the unit back to his capital
bool isAlive() const;- returns true if the unit is alive
PromotionTypes getRace() const;- returns a promotion that sets the untis race
int getReligion() const;- returns the units religion
void setWeapons();- sets the units weapon upgrade


New Python functions:

None.

Significant Changes:

1. Non-barbarian animals are no longer move limited
2. Animals are no longer killed when the barbarians spawn
3. Buildings modify space production is now applied to all projects (called rituals in FfH).
4. jdog5000's AIAutoPlay has been implmented. To use it go into the python console and type "CyGame().setAIAutoPlay(X)" where X is the amount of turns you want the AI to play for.
5. Implemented Lutefisk Mafias rotating camera, Ctrl-left to turn the camera 90 degrees to the left, Ctrl-right to turn right.


Art Resources:


If you're looking for 2d art resources these are some of my favorite art websites on the web. There is a lot of good stuff out there, and much of it will be very similiar to the art thats already in FfH. Check out the credits thread for links to lots of amazing artists.​


Recommendations:


1. Try to block spells in SDK prereq functions whenever possible.

Keep in mind that every unit in the game checks to see which spells it can cast every turn. If a spell only uses a python function for requirements and you have 300 units in the game then that python functions will be run 300 times per turn. If you can put a limit in one of the SDK prereqs (lets say its limited to a specific unitclass) then even with the same python requirement check it will only occur for the units that meet the SDK conditions. This can dramatically effect performance when there are a lot of units on the map.

Sometimes its better to split spells into multiple spells if that allows you to apply SDK qualifiers, which is why the Create Den and Take Equipment spells were split into multiple spells.​
 
Scenario Engine:

Game Options:

GAMEOPTION_BARBARIAN_WORLD- Barbs start with a city per player in the game. Cities are randomly placed.
GAMEOPTION_DOUBLE_ANIMALS- Animals last longer and spawn at double the normal rate (this is called Wilderness in game).
GAMEOPTION_DOUBLE_BONUSES- Double the normal amount of resources are placed (this is called Blessings of Amathaon in game). This will be applied if the randomize resources mapscript function is used.
GAMEOPTION_DOUBLE_EVENTS- Game has twice the chance of events triggering (this is called Living World in game).
GAMEOPTION_DOUBLE_GLOBAL_COUNTER- The Armageddon Counter grows and shrinks at twice the normal rate (called End Times in game).
GAMEOPTION_NO_GLOBAL_COUNTER- Removes the Armageddon Counter from the game (called Hallowed Ground in game).
GAMEOPTION_NO_HYBOREM_OR_BASIUM- Hyborem isnt spawned by Infernal Pact and the Mercurian Gate can't be built (called Compact Enforced in game).
GAMEOPTION_NO_LAIRS- No lairs are spawned on the map. This really doesnt have much use in scenarios since by default a scenario doesnt create new lairs.
GAMEOPTION_NO_PLOT_COUNTER- Removes the hell terrain effect from the game. This can improve performance considerably.
GAMEOPTION_NO_SETTLERS- No players can build settlers.
GAMEOPTION_SLOWER_XP- Units gain xp from combat at half the normal rate.
GAMEOPTION_THAW- The world starts colder (lots of tundra/snow tiles) and gradually melts to normal terrain. If you want to use this option make your worldbuild script with the final version terrain and the game will randomly "freeze" it when the game starts and it will thaw to the version you made.
GAMEOPTION_FLEXIBLE_DIFFICULTY- The game adjusts the difficulty based on the players ranking.
GAMEOPTION_NO_UNIQUE_IMPROVEMENTS- No world features are placed on the map, this isnt a typical scenario option since scenarios dont randomly generate world features anyway.
GAMEOPTION_NO_RELIGION_0- Fellowship of Leaves is blocked from the game.
GAMEOPTION_NO_RELIGION_1- The Order is blocked from the game.
GAMEOPTION_NO_RELIGION_2- Octopus Overlords is blocked from the game.
GAMEOPTION_NO_RELIGION_3- Runes of Kilmorph is blocked from the game.
GAMEOPTION_NO_RELIGION_4- The Ashen Veil is blocked from the game.
GAMEOPTION_NO_RELIGION_5- The Empyrean is blocked from the game.
GAMEOPTION_NO_RELIGION_6- Council of Esus is blocked from the game.
GAMEOPTION_NO_WORLD_SPELLS- No player can use their world spell.
GAMEOPTION_NO_ACHERON- Acheron can never be built by the barbarian player.
GAMEOPTION_NO_DUIN- Duin can never be built by any player.
GAMEOPTION_NO_ORTHUS- Orthus will never spawn.
GAMEOPTION_BLUE_MARBLE_TERRAIN- Uses the Blue Marble terrain art instead of seZereths fantasy terrain.
GAMEOPTION_AI_NO_BUILDING_PREREQS- AI doesnt need to have buildings to produce units (doesn't need a training yard to make axemen for example).
GAMEOPTION_AI_NO_MINIMUM_LEVEL- AI doesnt need to fulfill minimum level requirements to create/upgrade units (so Archmages can be built for example).
GAMEOPTION_CHALLENGE_CUT_LOSERS- The lowest ranked player is cut every 50 turns until only 5 players remain (called Final Five in game).
GAMEOPTION_CHALLENGE_HIGH_TO_LOW- Player has to become the highest ranked, then is switched to the lowest ranked civ, has to bring that to the highest ranked and then is switch to the lowest ranked civ again. He has to finish the game with that last civ.
GAMEOPTION_CHALLENGE_INCREASING_DIFFICULTY- The game difficulty increases every 50 turns until it is at deity.
GAMEOPTION_ADVENTURE_MODE- All unit models are a single unit mesh and model size is greatly increased.
GAMEOPTION_CAPTURE_ALL_BUILDINGS- No buildings are lost when cities are captured.
GAMEOPTION_NO_BUILDINGS- No player can build buildings.
GAMEOPTION_NO_PROJECTS- No player can build rituals.
GAMEOPTION_NO_TECHS- No player can research techs.
GAMEOPTION_NO_HEALING_FOR_HUMANS- Human controlled units never heal.
GAMEOPTION_NO_UNITS_FOR_HUMANS- Human players can never train units.
GAMEOPTION_NO_INFLATION- there is no inflation in the game.
GAMEOPTION_NO_MAINTENANCE- There are no maintenance costs for units or cities.
GAMEOPTION_NO_WAR_WEARINESS- There is no War Weariness for any player.
GAMEOPTION_ALWAYS_OPEN_BORDERS- All players always have open borders with each other.
GAMEOPTION_ALWAYS_RAZE- All players are forced to raze captured cities.​

Mapscript functions:

Randomize Lairs- Randomly places lairs (barrows/ruins/dungeons/towers/ship wrecks/goblin forts/etc) on the map. This won't remove lairs that are placed by the mapscript.
Randomize Unique Improvements- Randomly places world features on the map. This won't remove world features that are placed by the mapscript.
Randomize Resources (exists in base civ4)- Removes all resources from the map and then randomly places new ones. It will place double the normal amount if the Double Bonuses game option is used.
Randomize Goody Huts- Randomly places goody huts, it wont remove any that have been placed by the mapscript.
Random Start Location (exists in base Civ4)- This is set on the player data. With this set the players start location will be randomly selected instead of being fixed.​


Python functions:

The following functions exist in the ScenarioFunctions.py file. This file is only used when a scenario is running (so these checks don't effect the normal game) and allow us to apply special rules for a specific scenario. Every scenario has a gameoption specified for it so that we can distinguish between different scenarios in this functions.

[n]cannotResearch[/b]- Block techs that can't be researched.
cannotTrain- Block units that can't be trained. This is how we keep Perpentach from being able to build Settlers in the Momus
doTurn- This runs every turn. Use it to perform and turn based actions you want to occur. Its the heart of most of the scenario specific functions.
gameStart- Special things you want to happen when the scenario starts. We use this to present the scenario popup and do some map setup for things that can't be stored in worldbuilder script files.
getGoalTag- The Goal tag is a special red text string that is displayed just over the players scores. We use it to display the goals of the scenario the player for things as simple as "Defeat Sheelba!" or "Kill 65 more Infernal units".
onCityAcquired- Any special functions you want to occur when cities are captured. We use this to trigger events when certain cities are captured in scenarios like the Radiant Guard.
onCityBuilt- Any special function you want to occur when a new city is founded. We use this in the Black Tower to allow the player to pick the type of civilization he would like to found the city as.
onMoveJungleAltar- If a unit moves onto a jungle altar feature and the plot is Python Active (see new SDK functions below) this will trigger. We use the game option of the scenario + the coordinates of the plot to trigger different results for different altars.
onMovePortal- Exactly as the onMoveJungleAltar, but for portals.
onMoveWarningPost- Exactly as the onMoveJungleAltar, but for Warning Posts.
onReligionFounded- Triggered when a religion is founded. We use it in the Lord of the Balors scenario to gift special units to players that found the different religions.
onTechAcquired- Triggered when a tech is earned. We use this to gift Rosier to the player when he discovers Order from Heaven.
onUnitCreated- This trigger for any unit that is created, no matter how. We use this to apply global promotions, like giving all the players units in the Beneath the Heel scenario the Bounty Hunter promotion and pushing AI logic. Like pushing a mission for all the Infernal units to attack Bourne in the Lord of the Balors scenario.
onUnitKilled- Trigger whenever a unit is killed. We use this to track the amount of infernal units killed in Lord of the Balors, and convert any defeated living units into undead ones under Sheaim control in the Black Tower scenario.
onVictory- This runs when the player wins the scenario. We use it to popup victory text and reward trophies.
openChest- Any special chest results you want to occur in your scenario. If you return False from this function the normal chest results won't occur. If you return True normal chest results will still happen. We use it in Gift of Kylorin to handle all the chest contents.
playerDefeated- Any special function you want to occur when a player is defeated. We use it to trigger events in the Splintered Court and use it frequently just to post custom defeated messages for the various leaders in the scenarios.


New SDK functions:

ScenarioCounter (game)- A game specific int value that you can use to track whatever scenario specific data you want. We use it to track the amount of units killed in the Through the Fire scenario or the day cycle inthe Splintered Court.
[tab]CyGame().changeScenarioCounter(int iChange)
[tab]CyGame().getScenarioCounter()

ScenarioCounter (unit)- A unit specific int value you can use to hold data ofr your scenario. We use it in the Splintered Court scenario to store the units normal unit type when he's a werewolf.
[tab]pUnit.setScenarioCounter(int iNewValue)
[tab]pUnit.getScenarioCounter()

Move Disabled- The AI or humans (depending on the setting) wont be able to enter plots with this set. We use the AI limit it in Gift of Kylorin to keep the monsters from roaming into areas they aren't supposed to. We use the human block to keep the human player for goign to far west in the Through the Fire scenario.
[tab]pPlot.isMoveDisabledAI()
[tab]pPlot.setMoveDisabledAI(bool bNewValue)
[tab]pPlot.isMoveDisabledHuman()
[tab]pPlot.setMoveDisabledHuman(bool bNewValue)

Build Disabled- Plots with this set can't have any build actions performed on them (roads/mines/farms/etc cant be built). We use it in the Cult to keep players from being able to build a road through the dungeon area or other silliness.
[tab]pPlot.isBuildDisabled()
[tab]pPlot.setBuildDisabled(bool bNewValue)

Found Disabled- Plots with this set can't have cities built on them. We use this in the Cult to keep players form being able to found cities int he dungeon area.
[tab]pPlot.isFoundDisabled()
[tab]pPlot.setFoundDisabled(bool bNewValue)

Python Active- Python active plots will process any onMove python scripts form improvements or features in them. If a plot has its python active disabled those onMove python scripts won't trigger. We use it to make a Python onMove function only trigger once (such as with the Guardian of Pristin Pass).
[tab]pPlot.isPythonActive()
[tab]pPlot.setPythonActive(bool bNewValue)

Minimum Level- If this is set on a only units of certain level will be able to enter it. We use this on the Ring of Cancer to only allow units of 15 or higher to enter the plot.
[tab]pPlot.setMinLevel(int iNewValue)​


Special Objects:

Portals- The portal improvement will trigger the onMovePortal function (which is scenario specific). The plot itself holds the portal destinations which are typically set in gameStart, though its possible to change them at anytime with python commands.
[tab]pPlot.getPortalExitX()
[tab]pPlot.getPortalExitY()
[tab]pPlot.setPortalExitX(int iNewValue)
[tab]pPlot.setPortalExitY(int iNewValue)

Walls- Walls are features that block sight and can't be passed. If you are using walls in your dungeon you probably want to remove the flying promotion from all units in it (we do that in unitCreated) so they can't fly over your walls.

Doors- Doors are features that stop movement, block sight when closed and have a cool visual effect of opening when a unit goes on one. As with Walls units with flying will be able to fly over them.

Warning Post- These are the invisible triggers of FfH. They kick off the onMoveWarningPost function (as long as Python is active for the plot). They are frequently used in our scenarios to trigger events, dialog popups or perform effects.

Held Promotion- God bless the held promotion. I use it all the time on creatures that I dont ever want to move. Its perfect for planting a guard on a treasure, at a choke point or as the permanent defender of a city. And its a fairly easy python call to unteather the creature by removing the promotion.

Treasure Chests- There is a python function that allows you to intercept treasure chest results for scenarios. As such you can allow the results to occur as they do int he epic game, create your own list of random results for your scenario or place specific results in specific chests as we do in Gifts of Kylorin.​
 
Kael, any possibility to get you to list off some titles/authors of good reads for those of us interested in getting into modding. Any other pointers would be appreciated; like, which should a person start learning first c++, python, xml...? Which files should a modder start reading?

A few months ago, I tried to jump in the middle reading this big long thread about which compiler to use. What I got out of it was the best route to go was to try and find a copy of VC++7 or go through this lengthy procedure with 2007(?) to be able to compile. What environment(s) are you guys using?
 
Learn XML first. You pretty much have to to mod civ 4 but it's so easy there's nothing to learn. Except what all the variables does, which is usually but not always easy to figure out.
Just open an XML file in any text editor and start changing values.

Python is easier to learn (and easier to debug) than c++, there's also a tutorial on these forums.
 
Questions about Leaderattributes:

iUseDeathAttitudeChange,iUseEntropyAttitudeChange: are those still hardcoded or can I change the bonustypes in xml somewhere?

iHighCompassionAttitudeChange,iLowCompassionAttitudeChange: what do these do exactly, looking for health-happiness in general or are they tied to FFH specific civics?

What's the permanent trait about?

At last: is it possible to add more alignments via xml only as there's a xml file for that and will it work or do I need to adjust the SDK?
 
I dont know about the Death and Entropy attributes, I havent added them yet so Im not sure how Im going to do it. But I wont hard code anything in the SDK so I will have to figure out something.

I'll put descriptions behind all the attributes eventually, but the permanent attribute is set on leaders so thats the attribute they cant lose through the adaptive trait. So for Varn its set to creative, for Cassiel is philosophical, etc.

You would need to also adjust CvEnums.h if you want to add more alignments. Just like most of the other minor object types.
 
Ok thx. Think I'll just wait for your updated sourcefile then:)

For the Death and Entropy thingy I suggest a form like this:

Code:
<iUseBonusAttitudeChanges>
   <BonusTypes>
     <BonusType>BONUS_DEATH</BonusType>
     <iAttitudeChange>-2</iAttitudeChange>
   </BonusTypes>
   <BonusTypes>
     <BonusType>BONUS_ENTROPY</BonusType>
     <iAttitudeChange>1</iAttitudeChange>
   </BonusTypes>
</iUseBonusAttitudeChanges>

You forgot to add these to your list above this why I was wondering:
iHighCompassionAttitudeChange,iLowCompassionAttitudeChange

Thx for the reply you're doing a great job and I'll just practice patience;)
 
Ooo, nice list and some very useful things that will help the rest of us modders out. I noticed it didn't list any new python functions, but I'm assuming that most of the functions your adding to the SDK will be exposed to python, correct?

Keep up the good work Kael and thanks many times over for everything you've contributed to the community, I wouldn't know half of what I do without your tutorial threads. :)
 
Kael, would it be possible to make the spellinfos.xml accept unitclasses instead of single unittypes? I'd love to make the unitclass_worker being able to rejoin cities.

Edit:well ok the AI sucks with that but in general unitclasses/buildingclasses instead of single types there would definitly increase possibilities.
 
I added the source code to the first post. Woodelf owuld you sticky this thread please.
 
Yes, but it is already compiled so it can't be changed, the one supplied here isn't compiled so it is still alterable.
 
I updated the code in the first post to the "l" patch version.
 
Will you post a changelog for the updated code as well? I think that it may be useful.

Im trying to get some versioning utility setup to track this, it would take to much time to do manually. Ploep sent me some cool stuff which may work but I havent got it implmented yet.
 
Top Bottom