Great project modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

Great Projects are special buildings a nation can build, typically a monument, which can change the map by adding rivers and ambient objects, as well as giving bonuses.

Creating a Great Project requires editing multiple different files for a full implementation.

Great Projects[edit | edit source]

Great Projects themselves are found in /Europa Universalis IV/common/great_projects/*.txt. They follow this format:

<project> = {
    # Province the project starts in
    start = <province id>

    # Date built in real life (If you start the game at a date later than this, then the project will show up)
    date = year.month.date

    # How much it costs to build
    build_cost = <ducats>

    # If the project can be moved
    can_be_moved = yes/no

    # Starting tier of the project
    starting_tier = <tier>

    # Project type
    type = canal/monument

    # Conditions to build the project
    build_trigger = {
        <conditions>
    }

    # What happens when the project is built
    on_built = {
        <do stuff> # For example; add_prestige = 25
        # For canal, do add_canal = <canal_name>
    }

    # What happens when the project is destroyed
    on_destroyed = {
        <do stuff> # For example; add_prestige = -25
        # For canal, do remove_canal = <canal_name>
    }

    # Conditions to use project
    can_use_modifiers_trigger = {
        <conditions>
    }

    # Conditions to upgrade project
    can_upgrade_trigger = {
        <conditions>
    }

    # Conditions for if the project will be destroyed when conquered
    keep_trigger = {
        <conditions>
    }

    # Tiers
    tier_<tier> = {
        # Time it takes to upgrade the project
        upgrade_time = {
            months = <months>
        }

        # Cost to upgrade the project
        cost_to_upgrade = {
            factor = <ducats>
        }

        # What modifiers are given to the province the project is located in
        province_modifiers = {
            <modifiers>
        }

        # What modifiers are given to the area of the province the project is located in
        area_modifier = {
            <modifiers>
        }

        # What modifiers are given to the nation that owns the monument
        country_modifiers = {
            <modifiers>
        }

        # What happens when the upgrade is complete
        on_upgraded = {
            <do stuff> #For example; add_prestige = 25
        }
    }
}

Note: In vanilla there are 4 tiers, including the ruined/not-yet-built tier, which goes as following; tier_0, tier_1, tier_2, tier_3

Great Project Image[edit | edit source]

A template for Monument images

A great project will need an image for the province buildings view.

You will need to create an image in /Europa Universalis IV/gfx/interface/great_projects/great_project_<project_name>.dds, this image should be 300x150 and saved with file type DirectDraw Surface (.dds). You will also need to add this image in /Europa Universalis IV/interface/<filename>.gfx as following:

spriteTypes = { # If editing an existing .gfx file then this line will likely already be there, so you might not need to write this. However, make sure the following are inside this.
    spriteType = {
        name = "GFX_great_project_<project_name>"	
        texturefile = "gfx//interface//great_projects//great_project_<project_name>.dds"
    }
}

Adjacencies[edit | edit source]

A canal requires a special adjacency to be defined in adjacencies.csv.

<id>;<id>;canal;<id>;-1;-1;-1;-1;comment

The first two ids are the sea zones the canal will link. The third id is the province defined in the great project file.

Map[edit | edit source]

An example tile: dragon_canal_river.bmp

Canals will spawn a new river on the map when the project is complete. This is handled via a special river tile that is linked to your great project.

To create the river tile, you need to crop the map to a resolution with a product of 128 (i.e. 128x128, 256x256, etc.). Do this by copying the rivers.bmp and cropping the desired section, that way the color table is retained.

Within the tile, add your new river, following the normal rules for adding rivers.

Save this file as <project>_river.bmp, where <project> is the name of your project.

Important: note the coordinates of your tile's top and bottom left corner within the original rivers.bmp. You'll need to do this before actually cropping.

In default.map, you need to add a new canal definition:

canal_definition = {
	name = "<project_name>" # Name of your great project.
	x = <x>                 # The x-coordinate of the top-left corner of your tile.
	y = <y>                 # The map height minus the y-coordinate of the bottom left corner of your tile.
}
Working out Y coordinate using Victorum Universalis's rivers.bmp by San Felipe aka Darth Modus

The map height value here was taken from Victorum Universalis's rivers.bmp file. NOTE! Height maps can vary depending on the map file you used. For example, the map height for EU4 vanilla is 2048px. So, please bear this in mind before working out the Y coordinate for your canal, otherwise, your canal might spawn at a different location to the one intended.

Y coordinate = 1176 (first value of green dot on this canal map example) NOTE! This is not the final value you will put in default.map To get the final value, you must follow these steps below:

  1. List item Open your rivers.bmp using your preferred app (I use GIMP but you can also use Photoshop etc).
  2. List item Use a rectangular select tool to select and highlight your chosen canal area in rivers.bmp (this is known as the rectangle select tool in GIMP which is one of my preferred graphics editing apps next to Photoshop) and hover over the top and bottom left corners of the area selected (represented here in red and green dots) before jotting the values down somewhere. You do not need to work out or do anything with the coordinate of your red dot; that always stays the same.
  3. List item Subtract whatever value the green dot is on your canal map from the height of your rivers.bmp (main) map file. In this example, we will subtract 1176 (value of green dot) from the height of this rivers.bmp map (taken from Victorum Universalis) which is 2304px.

Once you have the first value of the green dot The formula for this is as follows: Y = MH (map height) - GD (first value of green dot) Y = 2304 - 1176 = 1128 Y coordinate = 1128 (final value)

Therefore, the final Y coordinate value that goes into default.map is 1128, giving the final entry of:

canal_definition = { name = "kra_canal" x = 4151 y = 1128 }

The above explanation and entry were written by San Felipe aka Darth Modus - Victorum Universalis creator and EU4 modder.

For example, if your tile's bottom-left y coordinate was 1407, you'd do 2048 - 1407 to get 641, which is the value you should put in the definition.

Decisions[edit | edit source]

For the player or AI to interact with a canal great project, you need to create two decisions, one allowing it to be built, and another for cancelling construction.

Here are two templates:

country_decisions = {
    construct_<project> = {
        major = yes
        potential = {
            is_random_new_world = no
            OR = {
                ai = no
                AND = {
                    treasury = 60000
                    owns_or_vassal_of = <province id>
                }
            }
            has_discovered = <province id>
            <province id> = {
                range = ROOT
                NOT = { has_great_project = <project> }
                NOT = { has_construction = canal }
            }
        }
        allow = {
            owns_or_vassal_of = <province id>
            is_subject = no
            treasury = 30000
        }
        effect = {
            add_treasury = -30000
            <province id> = {
                add_great_project = <project>
            }
        }
        ai_will_do = {
            factor = 1
        }
    }
    
    cancel_<project> = {
        major = yes
        potential = {
            ai = no
            owns_or_vassal_of = <province id>
            is_subject = no
            <province id> = {
                has_construction = canal
            }
        }
        allow = {
            <province id> = {
                has_construction = canal
            }
        }
        effect = {
            <province id> = {
                cancel_construction = yes
            }
        }
        ai_will_do = {
            factor = 0
        }
    }
}

Localisation[edit | edit source]

A great project will need to the following localisation keys defined:

<project>: "Name"
Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localizationRun files
Scripting Scripted functionAdvisorsAgesBookmarksBuildingsCasus belliColonial regionsCountriesCultureDecisionsDefinesDiplomatic actionsDisastersEmpire of ChinaEstatesEventsFactionsGovernmentGreat projectsHistoryHoly Roman EmpireIdea groupsInstitutionsMercenariesMissionsModifiersNation designerOn ActionsParliamentPeace treatiesPoliciesRebel typesReligionSubject typesTechnologyTrade companiesTrade goodsUnits
Map MapNation designerRandom New WorldTrade nodes
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumJoroDox mod making toolMod structureTroubleshootingThe ValidatorRun files
Guides Adding a provinceSave-game editingScripting Tutorial