Quick Modding Questions Thread

A check of the contents of file Expansion2_Icons_Civilizations.xml shows the following:
Absolute facepalm for not thinking to check that. Thanks Lee.
 
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.
 
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 ?
 
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....
 
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.
 
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"
 
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.
 
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.

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.
 
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....
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.
 
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.
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:
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?
 
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.
 
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.
 
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.
 
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
 
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
Oh yeah, this Civ6 modding spree of mine has had its fair share of :wallbash: moments so far, hehe.
 
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)
 
Individaul Ubnits are assigned to Ability Classes in table "TypeTags"
Code:
	<TypeTags>
		<Row Type="UNIT_EGYPTIAN_CHARIOT_ARCHER" Tag="CLASS_LIGHT_CHARIOT"/>
		<Row Type="UNIT_SUMERIAN_WAR_CART" Tag="CLASS_HEAVY_CHARIOT"/>
		<Row Type="UNIT_HEAVY_CHARIOT" Tag="CLASS_HEAVY_CHARIOT"/>
		<Row Type="UNIT_TANK" Tag="CLASS_HEAVY_CHARIOT"/>
		<Row Type="UNIT_MODERN_ARMOR" Tag="CLASS_HEAVY_CHARIOT"/>
	</TypeTags>
Any unit assigned to an individual Ability Class will share in the effect of a UnitAbility that is assigned to be effective for that class of unit:
Code:
	<TypeTags>
		<Row Type="ABILITY_HEAVY_CHARIOT" Tag="CLASS_HEAVY_CHARIOT"/>
		<Row Type="ABILITY_LIGHT_CHARIOT" Tag="CLASS_LIGHT_CHARIOT"/>
	</TypeTags>
An individual unit can be assigned to multiple different Ability-Classes, and will share in the UnitAbility effects of any Unit Ability which is thus made valid for that Class of "Ability"

UnitAbilities (and their modifiers) are not directly tied to individual units -- they are tied to Ability-Classes, which in turn have individual units assigned to them. The Ability-Class (ie, "ABILITY_CLASS" in the "Tags" table) is used as a convenient catch-all for multiple units when desired without needing to individually code an Ability as being valid for a specific unit or combination of units anywhere else in the database.

Individual units can and often are by Firaxis assigned to their own special Ability-Class. So far as I know (at least in the Vanilla expansion) the only unit that was assigned to the "CLASS_LIGHT_CHARIOT" was the Egyptian unique chariot-archer unit. In this way unique or special units can have their own "private" set of abilities without needing to add a bunch of extra single-case Boolean type stuff as was so often done in Civ5 with Promotions and the like.

[edit] Without directly looking at which modifiers are attached to a given UnitAbility, and what those individual modifiers actually do, there's no quick and easy answer as to what the difference between two discreet Ability-Classes are.

The Light Chariot Ability is an extra 2 movement when starting a turn on "clear" terrain as I recall, but I don't remember what the Heavy Chariot ability is off the top of my head.

[edit edit] A quick check of the UnitAbilities.xml file shows that the Heavy Chariot ability is to only give +1 movement on "clear" terrain, so essentially the difference in the two Abilities / Modifiers gives the Egyptian Chariot-Archer an extra extra move in the proper conditions.
 
Last edited:
Back
Top Bottom