Great project modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

Great Projects are special decisions a country can take, typically to build a canal, which can change the map by adding rivers and ambient objects.

Creating a Great Project requires editing multiple different files for a full implementation. Note that the following information will detail implementing a canal.

Great Projects[edit]

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

<project> = {
    ambient_object = <object>   # A ambient_object from ambient_object.txt in the map folder.
    province = <id>             # The province that is granted the modifier
    is_canal = yes              # Whether this Great Project should load a river tile
    time = 120                  # Time in months it takes for the Great Project to be built
    
    # Applied to the province defined above on project completion
    modifier = {
        <province modifiers>
    }
}

Adjacencies[edit]

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]

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.
}

The y-coordinate here is not intuitive, the y-coordinate you'll get in a program like Photoshop needs to be subtracted from the map height to get the correct value for the definition.

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]

For the player or AI to interact with a 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]

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

<project>_title: "Name"
<project>: "Name"
great_project_<project>: "Name"
Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localization
Scripting AdvisorsAgesBookmarksBuildingsCasus belliColonial regionsCountriesCultureDecisionsDefinesDiplomatic actionsDisastersEstatesEventsFactionsGovernmentGreat projectsHistoryIdea groupsInstitutionsMissionsModifiersNation designerPoliciesReligionRebel typesSubject typesTechnologyTrade companiesTrade goodsUnits
Map MapRandom New WorldTrade nodes
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumJoroDox mod making toolMod structureTroubleshootingThe Validator
Guides Adding a province