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

Quick Modding Questions Thread

Discussion in 'Mod Creation Help' started by Leyrann, Oct 28, 2018.

  1. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,335
    Location:
    Illinois, USA
    A check of the contents of file Expansion2_Icons_Civilizations.xml shows the following:
    Code:
    <GameInfo>
    	<IconTextureAtlases>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="22" IconsPerRow="8" IconsPerColumn="2"      Filename="XP2_CivSymbols22.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="30" IconsPerRow="8" IconsPerColumn="2"      Filename="XP2_CivSymbols30.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="32" IconsPerRow="8" IconsPerColumn="2"      Filename="XP2_CivSymbols32.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="36" IconsPerRow="8" IconsPerColumn="2"      Filename="XP2_CivSymbols36.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="44" IconsPerRow="8" IconsPerColumn="2"      Filename="XP2_CivSymbols44.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="45" IconsPerRow="8" IconsPerColumn="2"      Filename="XP2_CivSymbols45.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="48" IconsPerRow="8" IconsPerColumn="2"      Filename="XP2_CivSymbols48.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="50" IconsPerRow="8" IconsPerColumn="2"      Filename="XP2_CivSymbols50.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="64" IconsPerRow="8" IconsPerColumn="2"      Filename="XP2_CivSymbols64.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="80" IconsPerRow="8" IconsPerColumn="2"      Filename="XP2_CivSymbols80.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="128" IconsPerRow="8" IconsPerColumn="2"     Filename="XP2_CivSymbols128.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="200" IconsPerRow="8" IconsPerColumn="2"     Filename="XP2_CivSymbols200.dds"/>
    		<Row Name="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" IconSize="256" IconsPerRow="8" IconsPerColumn="2"     Filename="XP2_CivSymbols256.dds"/>
    	</IconTextureAtlases>
    	<IconDefinitions>
    		<Row Name="ICON_CIVILIZATION_HUNGARY"   Atlas="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" Index="0"/>
    		<Row Name="ICON_CIVILIZATION_INCA"      Atlas="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" Index="1"/>
    		<Row Name="ICON_CIVILIZATION_MALI"      Atlas="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" Index="2"/>
    		<Row Name="ICON_CIVILIZATION_PHOENICIA" Atlas="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" Index="3"/>
    		<Row Name="ICON_CIVILIZATION_OTTOMAN"   Atlas="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" Index="4"/>
    		<Row Name="ICON_CIVILIZATION_MAORI"     Atlas="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" Index="5"/>
    		<Row Name="ICON_CIVILIZATION_CANADA"    Atlas="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" Index="6"/>
    		<Row Name="ICON_CIVILIZATION_SWEDEN"    Atlas="ICON_ATLAS_EXPANSION_2_CIVILIZATIONS" Index="7"/>
    	</IconDefinitions>
    </GameInfo>
     
    Sostratus likes this.
  2. Sostratus

    Sostratus Emperor

    Joined:
    Jul 31, 2017
    Messages:
    1,457
    Gender:
    Male
    Location:
    Minnesota, USA
    Absolute facepalm for not thinking to check that. Thanks Lee.
     
    NewYorkValues likes this.
  3. Sostratus

    Sostratus Emperor

    Joined:
    Jul 31, 2017
    Messages:
    1,457
    Gender:
    Male
    Location:
    Minnesota, USA
    So I've been using the modifier type MODIFIER_SINGLE_CITY_ADJUST_IMPROVEMENT_HOUSING to try and conditionally give a base game improvement (say a mine) housing as part of a leader ability. This is the same way that improvements like the stepwell get extra housing with tech. However, my goal was only to grant +0.5 per mine, just like a farm. I know that in the Improvements table, to implement 0.5 they seem to use Housing=1, TilesRequired=2. When I implement 0.5 directly in the modifier argument, it seems to round down to 0. (When I put in an integer like 1, it works properly.)
    Does anyone know a way to set half housing for improvements conditionally? I can't just change the values in the improvements table because then they would be for all civs.
     
  4. __jack__

    __jack__ Chieftain

    Joined:
    Dec 29, 2009
    Messages:
    86
    How do you pass the viking DLC as a criteria in modinfo ? ModInUse doesn t seem to work and I can't use the leader playable to adjust the content related to the DLC additional city states ?
     
  5. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    76
    Where the hell are the details about National Parks? I've been searching everywhere for them. If they are a hardcoded thing, is it possible to give them yields? I'm trying to create a governor promotion that gives all the National Park tiles +1 Culture....
     
  6. edoipi

    edoipi Chieftain

    Joined:
    Oct 20, 2019
    Messages:
    17
    Gender:
    Male
    Is it possible to trigger some event based on historic moment? What I want to do is grant free relic whenever one kind of historic moment triggers and I don't really see any way to do that.
     
  7. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,335
    Location:
    Illinois, USA
    There is an lua Event called "GameHistoryMomentRecorded" that passes arguments "momentIndex" and "unknown". I have not used this lua event as yet but I assume the gamecore fires this lua "event trigger" whenever a Historical Moment occurs.

    "momentIndex" ought to be giving the row "index" number from table "Moments" I would guess for the MomentType that was triggered.
    "unknown" is the second of the two arguments passed by the gamecore but at the moment ChimpanG (nor anyone else I think) has not figured out what the data for this argument represents.

    ---------------------------

    @SocialMechanic

    I don't recall that National Parks are really defined anywhere. There's no database table for them. They just exist as 'elements' of the game (like Trading Posts) but are not actually registered anywhere within the game database that I am aware of. UNIT_NATURALIST can create national parks because the definition of the unit within table <Units> has
    Code:
    ParkCharges="1"
     
    edoipi likes this.
  8. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    76
    Gotcha. Thanks LeeS
     
  9. edoipi

    edoipi Chieftain

    Joined:
    Oct 20, 2019
    Messages:
    17
    Gender:
    Male
    Thanks, I didn't get into lua at all. So it may be impossible but it is still worth investigating if I find time and energy for it.
     
  10. edoipi

    edoipi Chieftain

    Joined:
    Oct 20, 2019
    Messages:
    17
    Gender:
    Male
    Just tried it and it seems that "moment index" is just an incrementing integer - first moment in game has it set as 0, fourth gets 4. Perhaps there is a structure from which I can get more info on that event. Just wanted to share what I discovered so far. By the way thanks for your modding guide, it would be so much harder to get into civ luas without it.
     
  11. Infixo

    Infixo Deity

    Joined:
    Jan 9, 2016
    Messages:
    3,417
    Gender:
    Male
    Location:
    Warsaw
    Support is very limited.
    If you want to adjust tourism then ADJUST_CITY_NATIONAL_PARK_TOURISM. For generic yields you may try on the city level using REQUIREMENT_CITY_HAS_NATIONAL_PARK.
     
  12. Infixo

    Infixo Deity

    Joined:
    Jan 9, 2016
    Messages:
    3,417
    Gender:
    Male
    Location:
    Warsaw
    If this effect is achieved via modifiers, then you should be able to use requirements with them.
    Edit. Ok, I read again what the problem is. Modifiers only support integer values, so you can't make conditional 0.5.
     
    Last edited: Nov 26, 2019
  13. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    76
    Thank you!!
     
  14. Lord Shadow

    Lord Shadow General

    Joined:
    Oct 14, 2005
    Messages:
    1,970
    Gender:
    Male
    Location:
    Buenos Aires
    Quick question:

    If I create a modifier and don't connect it to any trait, promotion, etc... does it immediately trigger and apply to entities within its parameters (Collections, SubjectRequirementSetId)?

    Case in point, I'm trying to give AI players a combat bonus against Barbarians. To that effect, I've mainly repurposed the modifier from the Discipline policy card, and appended PLAYER_IS_AI to its subject's requirement set. Like so:
    Code:
    INSERT INTO    Modifiers
            (ModifierId,                            ModifierType,                                        OwnerRequirementSetId,    SubjectRequirementSetId,            RunOnce,    Permanent    )
    VALUES    ('MODIFIER_AI_BARBARIAN_COMBAT',        'MODIFIER_PLAYER_UNITS_ADJUST_BARBARIAN_COMBAT',    NULL,                    'PLAYER_IS_AI',                        0,            1            );
    
    INSERT INTO    ModifierArguments
            (ModifierId,                        Name,                Value                )
    VALUES    ('MODIFIER_AI_BARBARIAN_COMBAT',    'Amount',            5                    );
    
    Do I need to do anything else or with the modifier become active automatically?
     
  15. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,335
    Location:
    Illinois, USA
    It does not become active unless attached to a game object via one of the X_Modifiers tables. Or unless it is listed as the modifier to attach to one or all of a player's units, cities, etc., by some other modifier which is attached to a game object.

    UnitAbiities can be used to skin this cat I would think. You would need to attach the modifier to a new Ability, and set up the Ability to be valid for all Unit "Classes" that are combat units. Then the modifier can be attached to the Ability via table UnitAbilityModifiers. So long as the UnitAbility does not have "Inactive" set to true it ought to be applied to all units that can qualify for the Ability as an inherent part of the game without needing any further code to attach the modifier to anything, I would think.
     
  16. Lord Shadow

    Lord Shadow General

    Joined:
    Oct 14, 2005
    Messages:
    1,970
    Gender:
    Male
    Location:
    Buenos Aires
    Okay, bizarre results. So I created a unit ability and associated it to CLASS_ALL_COMBAT_UNITS, which exists by default. Then I changed the requirement set of the modifier (now attached to the ability) to PLAYER_IS_HUMAN for testing purposes.

    Now, I started a test game in the Information Era to cover more ground quickly and test various units. Turns out one Spec Ops unit somehow has a +35 advantage vs. Barbarians, and other units (including other Spec Ops) have all sorts of numbers between that and +5. It seems completely random. What did I break? Is CLASS_ALL_COMBAT_UNITS broken? The modifier is exactly the same one the Discipline card uses, plus the requirement set.
     
  17. Lord Shadow

    Lord Shadow General

    Joined:
    Oct 14, 2005
    Messages:
    1,970
    Gender:
    Male
    Location:
    Buenos Aires
    Update!

    It appeared to be weird behaviour related to applying a modifier to units (through an ability) instead of their parent, as the policy card does.

    I've seemingly worked around the issue applying the modifier instead to the traits TRAIT_LEADER_MAJOR_CIV and MINOR_CIV_DEFAULT_TRAIT.

    Strange stuff.
     
  18. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,335
    Location:
    Illinois, USA
    It is "interesting"1 the way logical deduction works in one part of the game but not in another. I would have thought the UnitAbility method would have worked properly, but it also makes perfect sense that applying to the Player Level which then implements the modifier as needed not only works but does not result in "doubling" and "trebling" and "quintupling" of the effect.

    1 Where "interesting" has its own special sort of :wallbash: definition
     
  19. Lord Shadow

    Lord Shadow General

    Joined:
    Oct 14, 2005
    Messages:
    1,970
    Gender:
    Male
    Location:
    Buenos Aires
    Oh yeah, this Civ6 modding spree of mine has had its fair share of :wallbash: moments so far, hehe.
     
  20. Lonecat Nekophrodite

    Lonecat Nekophrodite Prince

    Joined:
    Jan 10, 2019
    Messages:
    398
    Gender:
    Male
    In Units.xml there's a unit tag class.
    Code:
          <Row Tag="CLASS_HEAVY_CHARIOT" Vocabulary="ABILITY_CLASS"/>
           <Row Tag="CLASS_LIGHT_CHARIOT" Vocabulary="ABILITY_CLASS"/> 
    What are the differences between the two? did it affects movement speeds over different grounds? and did it also associated to respective cavalry classes too? (Heavy and Light respectively)
     

Share This Page