• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

MoralMonster

Second Lieutenant
9 Badges
Apr 2, 2011
173
340
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV
  • Victoria 2
  • 500k Club
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Common Sense
Hi everyone. I am trying to create some small mod that will help the AI to maintain its economy. And would like to know, is it possible to write an event that will check if a state has certain building and if yes, it will INSTANTLY upgrade it (I mean, with "create_building" command). And I wonder if it's possible to find the building I need, save it in custom scope, and then type something like

scope:my_state = {

create_building = {
type = building_government_administration
level = scope: previous_building.level
}

If anyone did things like this, please answer me. I need to understand the limits if V3 scripting.
 
You'll want the effect add_building_level if you're adding a level to an existing building rather than creating a new building.

This effect doesn't appear to be used in vanilla (outside the file test_events.txt), but it should do what you want based on the documentation.

Also for both create_building and add_building_level effects, the "type" is specified as building = <building_script_name>.

So your example should be
Code:
create_building = {
    building = building_government_administration
    level = scope:previous_building.level
}

I don't know if the level parameter can use a variable, but I don't see why not, though it should probably be set as just a regular var:var_name type of variable.

Anyway, again for a building that already exists

Code:
add_building_level = {
    building = <building_script_name>
    level = <amount>
}

should do what you want.
 
You'll want the effect add_building_level if you're adding a level to an existing building rather than creating a new building.

This effect doesn't appear to be used in vanilla (outside the file test_events.txt), but it should do what you want based on the documentation.

Also for both create_building and add_building_level effects, the "type" is specified as building = <building_script_name>

When you talk about documentation, you mean paradox wiki or there is some other documentation?

UPD. I have tested the following event option code, and it doesn't seem to work:

option = {
random_scope_state = {
limit = {
is_incorporated = yes
tax_capacity < tax_capacity_usage
}
add_building_level = {
building = building_government_administration
level = 1
}
}
}
 
Last edited:
It might require checking that there is already a government admin building to use add_building_level.

For documentation, I mean the effect localization and trigger localization folders, the actual localization files that give the tooltips, and whatever examples I can find in the vanilla files. That's how I found this effect.

You can test the create_building effect too, I just think it'll either overwrite the current level or have no effect if the specified level is less than the current level.