Quick Modding Questions Thread

Does the Modifier "MODIFIER_PLAYER_UNITS_ADJUST_INITIATION_YIELD_POPULATION" work as like "The first time you convert a city to your religion, gain a population" like I think it does? and if so does it need amounts or types defined in it to make it work?
 
Does the Modifier "MODIFIER_PLAYER_UNITS_ADJUST_INITIATION_YIELD_POPULATION" work as like "The first time you convert a city to your religion, gain a population" like I think it does? and if so does it need amounts or types defined in it to make it work?

The only Modifier which I see using that Type is Fez, which reads "Each time you convert a city for the first time earn 20 Science per Population of that city."

With the following arguments:
BeDb9cj.png


 
Does the Modifier "MODIFIER_PLAYER_UNITS_ADJUST_INITIATION_YIELD_POPULATION" work as like "The first time you convert a city to your religion, gain a population" like I think it does? and if so does it need amounts or types defined in it to make it work?

So, I'm not familiar with that specific ModifierType - but I've just looked it up quickly. I don't think it does anything to population, as such - in the game, the use of this ModifierType is linked to the ModifierId MINOR_CIV_FEZ_INITIATION_SCIENCE_POPULATION. It doesn't have any Subject or Owner requirements, so it's hard to understand the context for me.

That particular ModifierId has two ModifierArguments - one defining YIELD_SCIENCE and the other defining an amount of 20.

My guess is that it is used to grant an amount of a specified yield when something happens. I can't find a text entry that gives an indication of what this something is, though.
 
The only Modifier which I see using that Type is Fez, which reads "Each time you convert a city for the first time earn 20 Science per Population of that city."

With the following arguments:
BeDb9cj.png


Ahhhhh I see I see. Would it be possible to use yield_food? or just global yields like science gold etc.?
 
Ahhhhh I see I see. Would it be possible to use yield_food? or just global yields like science gold etc.?

YIELD_FOOD is valid for a YieldType value, generally. But for this kind of provision (to the civilization as a whole), it'd need testing I suspect. Not sure how it would distribute said food.
 
YIELD_FOOD is valid for a YieldType value, generally. But for this kind of provision (to the civilization as a whole), it'd need testing I suspect. Not sure how it would distribute said food.

Ok I was able to get this code to work with gold science and culture but not food. Is there some modifier I can use that gives population or food on converting a city?

EDIT: I found 'EFFECT_ADJUST_CITY_POPULATION' or MODIFIER_PLAYER_NEAREST_CITY_ADD_POPULATION is there a way to connect that to like when you convert a city and to the capital.
 
Last edited:
This also didn't work:

Code:
INSERT OR REPLACE INTO Requirements
  (RequirementId, RequirementType, Inverse)
VALUES ('REQUIRES_PLOT_HAS_NOT_DESERT_HILLS', 'REQUIREMENT_PLOT_TERRAIN_TYPE_MATCHES', 1);

INSERT OR REPLACE INTO RequirementArguments
  (RequirementId, Name, Value)
VALUES ('REQUIRES_PLOT_HAS_NOT_DESERT_HILLS', 'TerrainType', 'TERRAIN_DESERT_HILLS');

INSERT OR REPLACE INTO RequirementSetRequirements
  (RequirementSetId, RequirementId)
VALUES ('RECON_ALPINE_EXCLUDE_DESERT_HILLS', 'REQUIRES_PLOT_HAS_NOT_DESERT_HILLS');

INSERT OR REPLACE INTO RequirementSets
  (RequirementSetId, RequirementSetType)
VALUES ('RECON_ALPINE_EXCLUDE_DESERT_HILLS', 'REQUIREMENTSET_TEST_ALL');

UPDATE Modifiers SET SubjectRequirementSetId = 'RECON_ALPINE_EXCLUDE_DESERT_HILLS' WHERE ModifierId = 'ALPINE_IGNORE_HILLS_MOVEMENT_PENALTY';

I'm going to read more on the "EFFECT_ATTACH_MODIFIER" EffectTypes, might be able to uncover something.

Might also be able to use the Maryannu Chariot Archer modifier to circumvent it.

Edit: Found "EFFECT_ATTACH_MODIFIER_IF_PROMOTION_CLASS_MATCHES". Will see tomorrow if I can do anything with it.
______

I'm an idiot. This works:

Code:
UPDATE ModifierArguments SET Value ='TERRAIN_GRASS_HILLS' WHERE ModifierId ='ALPINE_IGNORE_HILLS_MOVEMENT_PENALTY' AND Value = 'HILLS';

INSERT OR REPLACE INTO Modifiers
    (ModifierId, ModifierType)
VALUES ('ALPINE_IGNORE_PLAINS_HILLS_MOVEMENT_PENALTY', 'MODIFIER_PLAYER_UNIT_ADJUST_IGNORE_TERRAIN_COST'),
       ('ALPINE_IGNORE_TUNDRA_HILLS_MOVEMENT_PENALTY', 'MODIFIER_PLAYER_UNIT_ADJUST_IGNORE_TERRAIN_COST'),
       ('ALPINE_IGNORE_SNOW_HILLS_MOVEMENT_PENALTY', 'MODIFIER_PLAYER_UNIT_ADJUST_IGNORE_TERRAIN_COST');
    
INSERT OR REPLACE INTO ModifierArguments
    (ModifierId, Name, Value)
VALUES ('ALPINE_IGNORE_PLAINS_HILLS_MOVEMENT_PENALTY', 'Type', 'TERRAIN_PLAINS_HILLS'),
       ('ALPINE_IGNORE_PLAINS_HILLS_MOVEMENT_PENALTY', 'Ignore', '1'),
       ('ALPINE_IGNORE_TUNDRA_HILLS_MOVEMENT_PENALTY', 'Type', 'TERRAIN_TUNDRA_HILLS'),
       ('ALPINE_IGNORE_TUNDRA_HILLS_MOVEMENT_PENALTY', 'Ignore', '1'),
       ('ALPINE_IGNORE_SNOW_HILLS_MOVEMENT_PENALTY', 'Type', 'TERRAIN_SNOW_HILLS'),
       ('ALPINE_IGNORE_SNOW_HILLS_MOVEMENT_PENALTY', 'Ignore', '1');
      
INSERT OR REPLACE INTO UnitPromotionModifiers
    (UnitPromotionType, ModifierId)
VALUES ('PROMOTION_ALPINE', 'ALPINE_IGNORE_PLAINS_HILLS_MOVEMENT_PENALTY'),
       ('PROMOTION_ALPINE', 'ALPINE_IGNORE_TUNDRA_HILLS_MOVEMENT_PENALTY'),
       ('PROMOTION_ALPINE', 'ALPINE_IGNORE_SNOW_HILLS_MOVEMENT_PENALTY');

Spent the whole day on this, looking for increasingly convoluted options, when the answer was
right in my face :mischief:
 
Last edited:
Is there a way to do If/then statement type stuff with sql like if convert then MODIFIER_PLAYER_NEAREST_CITY_ADD_POPULATION?
 
@Pikachaoomega

Example 1
UPDATE Improvements SET PrereqTech = 'TECH_ENGINEERING'
WHERE ImprovementType = 'IMPROVEMENT_LUMBER_MILL' AND EXISTS (SELECT * FROM GlobalParameters WHERE Name = 'RES_MAX_ERA' AND Value = '2');
This is
if RES_MAX_ERA in GlobalParameters is 2 then move IMPROVEMENT_LUMBER_MILL to TECH_ENGINEERING

Example 2
UPDATE Boosts SET ResourceType = (SELECT CASE WHEN RType IS NULL THEN NULL ELSE 'RESOURCE_'||RType END FROM REurBoostsView WHERE Boosts.BoostID = REurBoostsView.BoostID);
This is a conditional update on one field, it puts either NULLs or a value from another table with 'RESOURCE_' prefix

Example 3
INSERT INTO Building_YieldChanges (BuildingType, YieldType, YieldChange)
SELECT 'BUILDING_SUKIENNICE_UPGRADE', 'YIELD_GOLD', 2
FROM Buildings
WHERE BuildingType = 'BUILDING_SUKIENNICE';
This is
if 'BUILDING_SUKIENNICE' exists then make 'BUILDING_SUKIENNICE_UPGRADE' yield 2 gold
 
It might work assuming the game pays any attention to the RequirementSet.

There's also a MODIFIER_SINGLE_CITY_GRANT_BUILDING_IN_CITY_IGNORE which I think just plops the building regardless of any requisites being satisfied so far as other buildings that are normally prerequisites, etc.

Not sure how the plain old MODIFIER_SINGLE_CITY_GRANT_BUILDING_IN_CITY differs in its implementation since the EffectTypes between the two "grant building" ModifierTypes are different.
 
@Pikachaoomega

Example 1
UPDATE Improvements SET PrereqTech = 'TECH_ENGINEERING'
WHERE ImprovementType = 'IMPROVEMENT_LUMBER_MILL' AND EXISTS (SELECT * FROM GlobalParameters WHERE Name = 'RES_MAX_ERA' AND Value = '2');
This is
if RES_MAX_ERA in GlobalParameters is 2 then move IMPROVEMENT_LUMBER_MILL to TECH_ENGINEERING

Example 2
UPDATE Boosts SET ResourceType = (SELECT CASE WHEN RType IS NULL THEN NULL ELSE 'RESOURCE_'||RType END FROM REurBoostsView WHERE Boosts.BoostID = REurBoostsView.BoostID);
This is a conditional update on one field, it puts either NULLs or a value from another table with 'RESOURCE_' prefix

Example 3
INSERT INTO Building_YieldChanges (BuildingType, YieldType, YieldChange)
SELECT 'BUILDING_SUKIENNICE_UPGRADE', 'YIELD_GOLD', 2
FROM Buildings
WHERE BuildingType = 'BUILDING_SUKIENNICE';
This is
if 'BUILDING_SUKIENNICE' exists then make 'BUILDING_SUKIENNICE_UPGRADE' yield 2 gold


Ok! I think I get this! So Is there a way I guess to check when a city converts or if like the religion crosses threshholds in numbers of cities or something that can be used like this?
 
Ok! I think I get this! So Is there a way I guess to check when a city converts or if like the religion crosses threshholds in numbers of cities or something that can be used like this?
No, for such cases look at @LeeS post.
You asked if you could do sort of if-then in the sql, so I showed you how. But these are all things that happen before the game starts. Once the game is running, you can’t change anything in the database. All is read only.
And whatever effects you wanna achieve during the gameplay, you need to either code them in advance by using e.g. modifiers or item parameters or Lua scripts, etc.
And from your second post it seems that you are looking for some gameplay effect and this what @LeeS was addressing.
 
No, for such cases look at @LeeS post.
You asked if you could do sort of if-then in the sql, so I showed you how. But these are all things that happen before the game starts. Once the game is running, you can’t change anything in the database. All is read only.
And whatever effects you wanna achieve during the gameplay, you need to either code them in advance by using e.g. modifiers or item parameters or Lua scripts, etc.
And from your second post it seems that you are looking for some gameplay effect and this what @LeeS was addressing.
Oh! Ok! thank you! sorry about that!
 
Tried adding damage to a specific terrain type:

Code:
INSERT OR REPLACE INTO Modifiers
  (ModifierId, ModifierType, SubjectRequirementSetId)
VALUES ('UNIT_IN_DESERT_TAKE_DAMAGE', 'MODIFIER_ALL_UNITS_ATTACH_MODIFIER', null),
       ('UNIT_IN_DESERT_TAKE_DAMAGE_MODIFIER', 'MODIFIER_PLAYER_UNITS_ADJUST_HEAL_PER_TURN', 'FOOD_PLOT_HAS_DESERT_REQUIREMENTS');
    
INSERT OR REPLACE INTO ModifierArguments
  (ModifierId, Name, Value)
VALUES ('UNIT_IN_DESERT_TAKE_DAMAGE', 'ModifierId', 'UNIT_IN_DESERT_TAKE_DAMAGE_MODIFIER'),
       ('UNIT_IN_DESERT_TAKE_DAMAGE_MODIFIER', 'Amount', '-30'),
       ('UNIT_IN_DESERT_TAKE_DAMAGE_MODIFIER', 'Type', 'ALL');

That loaded but had no effect at all. Also tried _ALL_PLAYERS_. Giving medics negative healing does work.

Is there a way I might be able to accomplish this?

EDIT: I can add damage to units through gradient desert storms by increasing frequency and disabling damage to infrastructure,pop,etc, and leaving only damage to units. I'll try that if I can't find a direct solution.
 
Last edited:
One more from me - which I think is a quick question, based on hypothesising rather than any practical test (shame on me).

The Traits table allows you to define a TraitType. I believe this is the only place to define a TraitType, irrespective of that TraitType. As such, is it safe to assume that any TraitType defined therein can be applied into any other table that accepts a TraitType entry?

The most basic usage of the TraitType are things like civilization- or leader-specific abilities, buildings, improvements - that kind of thing.

Along the lines of that context, is the only practical use of TraitType on something like a building to restrict which civilizations/leaders can access it? Or can you use a set of criteria to apply a TraitType? Or is the limitation imposed by the fields in the individual Buildings, Districts and Improvements tables.

Perhaps I'm asking the same question as I was before and the only answer is to use a Modifier to grant a dummy building that is a prerequisite of the building you wish to build. It's a shame RequirementSet cannot be used to drive this kind of logic, though - or maybe it can, and I just cannot get my head around which order things sit in right now. I've put in bold what I think the one-sentence version of this post is.
 
@maconnolly
If you quickly go through database schema then you will notice that there is no such thing as "conditional trait". A trait is either obligatory (text not null) or not (text). You cannot apply any criteria to a trait, there is simply no such mechanics.
Modifiers can be conditional. They have requirements, both for an owner and subjects.

As such, is it safe to assume that any TraitType defined therein can be applied into any other table that accepts a TraitType entry?
Technically yes. But it doesn't mean that it would make sense because what matters are modifiers that define a trait. They have to be valid and make sense for the object that you want to assign them to (via a trait).
 
If you quickly go through database schema then you will notice that there is no such thing as "conditional trait". A trait is either obligatory (text not null) or not (text). You cannot apply any criteria to a trait, there is simply no such mechanics.
Modifiers can be conditional. They have requirements, both for an owner and subjects.

Technically yes. But it doesn't mean that it would make sense because what matters are modifiers that define a trait. They have to be valid and make sense for the object that you want to assign them to (via a trait).

Yep, that all makes sense. Appreciate the speedy response. To be honest, I think what I did was ask a question that I worded so poorly, it probably hid what I was trying to ask!

But in simple terms, I think I get it - and I am fairly clear on the 'fastest/easiest' way to achieve what I'm thinking about at this time; which is allowing buildings to be built, based on criteria that can't be defined through the Buildings table, but can be recognised through Modifier logic.
 
How do I load an AST file from the CivRoyale folder via Asset Editor? They are not showing up despite CivRoyale being in the Assets folder.
--

What is column Spacing in RandomEvents doing? Is it the distance between tiles where events of that type may trigger? Is it the distance events of this type must maintain from one another? Minimum amount of turns between events of that type? Or something else?

Column Animation and Sound in RandomEvent_Presentation cannot be Null, but is there a way to turn off random event movies?
 
Last edited:
I spent days trying to figure out a way to have units take damage on desert after moving, only to encounter a bug:

gOUoO1P.png


Instead of dying, it disappears and takes no extra damage :lol:.

I might have to settle for it. At -5 it shouldn't be very frequent. But if there's a workaround, I would appreciate it.

EDIT: What I really need is ADJUST_DAMAGE_PER_TURN. Adjust_Damage changes the base health on Desert, but it goes up +30 as soon as I leave. Adjust_Heal_Per_Turn has the above effect.

Where can I find the weight/chance of a resource appearing in a given terrain? Selecting Terrain Types is easy, but I can't figure out how to change the relative chance of each valid terrain.
 
Last edited:
Hi,
so I just wanted to know if there is some sort of tutorial for adding a new resource to the game? In particular, I'd like to know how to add icons correctly. I tried taking a look at another mod that adds a new resource, but there seem to be lots of files that I don't really know how to deal with (xlp, blp, stuff like that) just using Modbuddy.
I do have experience with non-graphical mods that only use xml/sql stuff, so I'm able to get the resource to work in-game, it's just really the graphical aspect that I have no idea on how to tackle.
If there is now particular tutorial on how to add resources, perhaps you can link me to another one that comes very close to it when it comes to adding icons? That would be thoroughly appreciated. There are many tutorials around here and I can't tell if, for example, adding an icon for a civ works essentially the same as adding an icon for a resource (the latter has several variants for example, like a normal one and an in-text variant...).
 
Back
Top Bottom