1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Modders Guide to Orbis

Discussion in 'Orbis Modmod' started by Ahwaric, Jul 12, 2009.

  1. Ahwaric

    Ahwaric Shrubbery-hugger

    Joined:
    Nov 12, 2005
    Messages:
    1,217
    Location:
    Kraków, Poland
    I guess I should started this thread a long time ago. Anyway, here are descriptions of new tags and overall changes to Orbis code that can be of use to modders.

    Remeber there is a xlsm editor that comes with every Orbis patch. It can make your modding much easier. It is an edited version of FfH editor, so if you have used it, you will know how it works.
    You may recognize many of the tags from Fall Further. That is because they come from FF :)

    First, GlobalDefinesAlt.xml (Global Defines sheet in editor)

    RANGE_COMBAT_DAMAGE: affects damage from ranged combat
    RANGE_COMBAT_XP_PERCENTAGE : % damage done needed for granting 1 xp from ranged combat
    PROMOTION_INVISIBLE_SHROUD: promotion granted by Nox Nocis
    TERRAIN_TEMPERATURE_TOLERANCE: Number of turns after which terrain changes to colder/hotter.
    WITHDRAW_PROMOTION: Promotion granted to units on withdrawal
    ORC_CIVILIZATION, ORC_LEADER, ANIMAL_CIVILIZATION, ANIMAL_LEADER, DEMON_CIVILIZATION, DEMON_LEADER: define barbarian factions leaders and civilizations
    EVIL_TILE_THRESHOLD
    MAX_ANIMAL_ESCALATIONS: Max extra strength for ancient animals
    MAX_ORC_STACK_SPAWN_SIZE: Number of units that spawn in one stack for Orc barbarians
    GONE_TO_HELL_THRESHOLD_PERCENTAGE: % of hellish tiles required for Gone to Hell victory
     

    Attached Files:

  2. Ahwaric

    Ahwaric Shrubbery-hugger

    Joined:
    Nov 12, 2005
    Messages:
    1,217
    Location:
    Kraków, Poland
    Tags and fields from files included in the editor:

    CIV4LeaderHeadInfos.xml (Leader sheet)
    FLAVOR_MAGIC: Science and magic flavours got separated for more flexibility, this field is also listed for techs, units etc.
    ERA_RENAISSANCE: music for renaissance era added in Orbis
    bMinorLeader: marks unit as a minor, independantly from the minor trait; used for colony creation
    iHatedCivicAttitudeChange
    iHatedCivicAttitudeDivisor
    iHatedCivicAttitudeChangeLimit: max negative relations from running a civic
    HatedCivic: hated civic
    Image: leader popup, used for defeat popup
    DefeatQuote: quote, as above
    RELIGION_CULT_OF_THE_DRAGON: religion weigth for cult of the dragon, set to -100 for every leader (so can't be adopted)

    CIV4CivilizationInfos.xml (Civilizations sheet)
    bUnique Buildings: buildings with bUnique tag, allowed for this civilization
    bUnique Unit: same as above but for units; both are editor only for easy use (in actuall file contionues unique building and unit list)
    bLimitedSelection: Only units listed for the civ are allowed, other blocked
    iTemperatureChangePerTurn: 1 towards desert, -1 towards snow
    FeatureHealthPercentChanges: modifies health from features for the civ
    FeatureYieldChanges: as above, but for feature yields
    ImprovementYieldChanges: as above, but for improvement yields
    TerrainYieldChanges: as above, but for terrain yields

    CIV4TechInfos.xml (Techs sheet)
    CommerceFlexible: Espionage allows tech to adjust espionage rate

    CIV4BuildingInfos.xml (Buildings Sheet)
    PowerYieldModifiers: allows to modify food, production and trade if the city has power (exclusively used by Mechanos)

    CIV4BonusInfos.xml (Bonus Sheet)
    FeatureBooleans FEATURE_KELP FEATURE_SWAMP: to allow bonuses to spawn on new features

    CIV4ImprovementInfos.xml (Improvement Sheet)
    SpawnUnitCiv
    bSpawnOnlyForOwner
    iSpawnAtOnceLimit
    bExplorable
    iLairCreationWeight
    iBasePlotCounterModify

    CIV4PromotionInfos.xml (Promotions Sheet)
    iPromotionDuration
    iPromotionRandomApplyChance
    iGroupSizeChange
    iDamageOnRemove
    iChanceMiscast
    iNoBadExplore
    bIgnoreTerrainCosts
    bMoveImpassable
    bFlatMoveCost
    bNoDefenseBonus
    bAllowDefenseBonuses
    TempUnitCombat
    bNonWarWeariness
    iExtraSupport
    bFreeUnit
    bIndependant
    iSlaveGenerationChance
    iAirCombat
    iAirCombatLimitBoost
    iCombatDmgCapBoost
    iExtraDropRange
    iCombatExtraDuration
    iChangeDuration
    iDurationAlter
    iDurationPerTurn
    iSpyEscape
    iSpyDeception
    iSpyIntercept
    iSpyPreparation
    bSpyLoyal
    iSpyPoison
    iSpyUnhappy
    iSpyUnrest
    PrereqInBorderEnemy
    PrereqInBorderNone
    PrereqInBorderRival
    PrereqInBorderTeam
    PrereqInBorderSelf
    PrereqInCity
    PrereqTier
    PrereqWeaponTier
    PrereqPermission
    bAutoAcquire
    bMustMaintain
    bNoXP
    iGoldCost
    PrereqbAllowNULLUnitCombat
    bEffectProm
    PythonPostCombatLost
    PythonPostCombatWon
    PythonOnRemove
    PrereqUnits
    PrereqUnitClassesOnTile
    PrereqUnitClassesNOTOnTile
    PrereqUnitTypesOnTile
    PrereqUnitTypesNOTOnTile
    PrereqPromotionsOnTile
    PrereqPromotionsNOTOnTile
    PrereqCivics
    PrereqCivilizations
    PrereqTraits
    PrereqReligions
    PrereqCorporations
    PrereqBonusORs
    PrereqFeatures
    PrereqTerrains
    PrereqImprovements
    PrereqBuildingANDs
    PrereqBuildingORs
    PromotionOverwrites
    PromotionReplacedBy
    PromotionDegradesTo
    PromotionAllows
    PromotionExcludes

    CIV4SpellInfos.xml (Spells Sheet)
    bSummonMaster
    iPromotionDuration
    Quote

    CIV4UnitInfos.xml(Units Sheet)
    iSpyEscapeProb: base modifier to spy escape after mission chances
    iSpyDeceptionProb: base modifier to spy avoiding discovery
    iSpyInterceptProb: base modifier to chances to reveal a spy
    PythonOnDeath: "Function run any time that the unit attempts to be killed. If the function returns a 1, the kill process will not continue (like Immortality). This call is made AFTER Immortal rebirth stops the kill function. There is a python exposed command to disable this call from being made by the unit anymore (PyUnit.setDisablePyDeath(true)), and this function will not run when the unit is killed at the end of converting."
    Images: for great people, list of pictures for birth popup
    Quotes: for great people, list of quotes for birth popup (use the same number as image)
    DenyPromotions: Unit is uncapable of having any promotion listed in these fields
    AllowPromotions "Grants the unit permission to gain listed promotions regardless of unit-centric prerequisites (PrereqUnitClass, PrereqUnits, PrereqTier, PrereqWeaponTier). Also the unit must list any promotion in this field if the promotion is flagged as <bRequiresPermission>"

    more to come...
     
  3. Ahwaric

    Ahwaric Shrubbery-hugger

    Joined:
    Nov 12, 2005
    Messages:
    1,217
    Location:
    Kraków, Poland
    CIV4BuildingClassInfos.xml
    bUnique: building is unavaliable unless allowed in civ entry

    CIV4UnitClassInfos.xml
    bUnique: as above, but for unit

    CIV4TraitInfos.xml
    TerrainExperienceModifiers: changes experience (%) from cobat on specific terrain
    PeakYieldChanges: sets yields for peak tiles (i.e. for Khazad)
    GlobalSeaPlotYieldChanges: extra yields from water tiles
    FeatureChangeYields: extra yield from feature
    FeatureProductionChanges: extra production (%) from chopping forests
    FeatureGrowthChanges: modifies chances for feature spread
    iHurryPopulationModifier: modifies hammers from population rush (extra hammers applied for next item in queque)
    PeaceCommerceModifiers: commerce modifer applied only when at peace
    SpecialistYieldChanges: extra yields from specialists
    SpecialistCommerceChanges: extra commerce from specialists
    iModReligionSpreadChance: modifies religion spread chances; -100% disables religion founding

    CIV4CorporationInfo.xml
    FreeBuildingClass: free building acquired on guild spread
    FreePromotion: free promotion applied for valid units in cities with the guild
    UnitCombatFreeExperiences: free xp for specific unit combats
    iDefense: extra defense applied in cities with the guild (building type, so ignored by cannons)
    iUpgradeCostModifier: upgrade cost modifier (%) in cities with guild

    CIV4HandicapInfo.xml
    iUnownedWaterTilesPerGameAnimal: self explanatory, used in water animals generation
    iAnimalEscalationTurnsElapsed: defines number of turns for strenght enhancements on wild animals
    iLairsPerCycle: number of lairs created by every lair creation cycle (defined in gamespeedinfo.xml)
    iPercentDemonsPerUnownedEvilPlot: demon creation
    iDemonGlobalCountSpawnBoostInterval
    iDemonGlobalCountSpawnBoostRate
    iDemonSpawnRateGlobalCounterEnhancementPercent
    iDemonGlobalCounterFreeXPPercent: free xp granted for demon civ units on creation (% of AC)
    iDemonPerTurnKnownTechsPercent
    iDemonBonus
    iAIDemonBonus

    CIV4GoodyInfo.xml
    iMaxTurnsElapsed: max game turns that the goody is valid
    BarbarianCivilization: for spawned barbarians, sets which civ they spawn for
     
  4. Ahwaric

    Ahwaric Shrubbery-hugger

    Joined:
    Nov 12, 2005
    Messages:
    1,217
    Location:
    Kraków, Poland
    this one too
     
  5. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    I'm changing the Armageddon counter in python using CyGame().changeGlobalCounter(integer). The counter changes just fine, but the responsible civilization doesn't seem to get credit/blame for the change. Is there a python function to assign blame/credit for Armageddon changes?
     
  6. xienwolf

    xienwolf Deity

    Joined:
    Oct 4, 2007
    Messages:
    10,589
    Location:
    Location! Location!
  7. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    Ah! so there is a pPlayer function that changes the counter? Is it python accessible and can you tell me what it is?
     
  8. xienwolf

    xienwolf Deity

    Joined:
    Oct 4, 2007
    Messages:
    10,589
    Location:
    Location! Location!
  9. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    Maybe it's not accessible in Orbis?

    Here is the code that works partially. It changes global counter (in either direction as intended) but does not give credit to player:
    Code:
    	def onUnitPromoted(self, argsList):
    		'Unit Promoted'
    		pUnit, iPromotion = argsList
    		player = PyPlayer(pUnit.getOwner())
    
    (snip)
    
    # Elohim start
    		pPlayer = gc.getPlayer(pUnit.getOwner())
    
    		# Diamond Soul
    		if iPromotion == gc.getInfoTypeForString('PROMOTION_MONK_14'):
    			if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
    				CyGame().changeGlobalCounter(-1)
    				if pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_OCTOPUS_OVERLORDS') or \
    				pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_COUNCIL_OF_ESUS') or \
    				pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
    					pUnit.setReligion(-1)
    			elif pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
    				CyGame().changeGlobalCounter(1)
    				if pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_RUNES_OF_KILMORPH') or \
    				pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_RUNES_OF_KILMORPH') or \
    				pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_THE_ORDER'):
    					pUnit.setReligion(-1)
    Here is my changed code. This just gives a callback error "CyPlayer does not have attribute changeGlobalCounter()"
    Code:
    	def onUnitPromoted(self, argsList):
    		'Unit Promoted'
    		pUnit, iPromotion = argsList
    		player = PyPlayer(pUnit.getOwner())
    (snip)
    
    # Elohim start
    		pPlayer = gc.getPlayer(pUnit.getOwner())
    
    		# Diamond Soul
    		if iPromotion == gc.getInfoTypeForString('PROMOTION_MONK_14'):
    			if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
    				pPlayer.changeGlobalCounter(-1)
    				if pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_OCTOPUS_OVERLORDS') or \
    				pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_COUNCIL_OF_ESUS') or \
    				pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
    					pUnit.setReligion(-1)
    			elif pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
    				pPlayer.changeGlobalCounter(1)
    				if pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_RUNES_OF_KILMORPH') or \
    				pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_RUNES_OF_KILMORPH') or \
    				pUnit.getReligion() == gc.getInfoTypeForString('RELIGION_THE_ORDER'):
    					pUnit.setReligion(-1)
    Using "player" didn't work either (I always get CyPlayer and PyPlayer confused).
     
  10. xienwolf

    xienwolf Deity

    Joined:
    Oct 4, 2007
    Messages:
    10,589
    Location:
    Location! Location!
  11. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    Thanks xienwolf! It works!

    xienwolf or Ahwaric,

    Please ignore if you don't like feature requests, but two things that would have made my life easier:
    1. pCity.setOriginalOwner(iNewOriginalOwner) - I sure wish there was such a python function (for my modified Tolerant implementation)
    2. bRivalTerritory - Can this be made changeable by promotion?
     
  12. xienwolf

    xienwolf Deity

    Joined:
    Oct 4, 2007
    Messages:
    10,589
    Location:
    Location! Location!
  13. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    And what's that name? (I looked in schema and Ahwaric's post above for likely suspects...but can't find anything)
     
  14. xienwolf

    xienwolf Deity

    Joined:
    Oct 4, 2007
    Messages:
    10,589
    Location:
    Location! Location!
  15. arcticnightwolf

    arcticnightwolf Emperor

    Joined:
    Jun 8, 2008
    Messages:
    1,301
    Location:
    Prague, Czech Republic
    i have a question ... is there any function which returns all sub-entities of entity ??
    i mean something like (py) listUnits = getAllEntities(UNIT_UNITTYPE) (/py) ...

    or i have to do it one by one
     
  16. xienwolf

    xienwolf Deity

    Joined:
    Oct 4, 2007
    Messages:
    10,589
    Location:
    Location! Location!
    for i in range(gc.getNumUnitTypes()):
    list.asppend(gc.getUnitInfo(i))


    or something along those lines. If you mean to list everything in an XML file. If you mean all units currently in the game, you would have to loop all players and loop their individual unit lists.
     
  17. arcticnightwolf

    arcticnightwolf Emperor

    Joined:
    Jun 8, 2008
    Messages:
    1,301
    Location:
    Prague, Czech Republic
    oh, thanks a lot! ... :D
     
  18. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    Is there such a thing as pPlayer.getGlobalCounterContrib() or equivalent function? Basically, I want access in python to the player's contribution to the global counter. (I already know how to change it. I want to know how to get it.)
     
  19. Opera

    Opera Deity

    Joined:
    Sep 21, 2008
    Messages:
    4,643
    Yes, getGlobalCounterContrib() exists and you can use it with a player :)
     
  20. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    Thanks Opera! Sometimes you just know the answer without needing to ask.

    Ahwaric implemented my AC credit change for spells. Yea me!

    It's interesting that he didn't change this for onSetPlayerAlive. I tried changing this in my modmodmod and it had mixed results:

    1. When I eliminated the evil Sheiam, I did get credit for the resulting AC drop (balanced in part by an increase from razing a RoK city).

    2. When good Banner built Mercurian Gate, it seems that both Banner and Mercurians got blamed for big AC increases (I think 5 for Mercs).

    I'm not absolutely sure that #2 came from my change, but I suspect it has something to do with Ahwaric's "various reasons" for not changing onSetPlayerAlive. Does anyone know what is going on here?
     

Share This Page