伟大工程修改

本页面讲述的内容长期有效


奇迹是一种特殊的决议,比较常见的是修建运河,通过变更目标环境替换成可通行的河流。

创造一个奇迹需要修改多个不同的文件才能达成。注意,本文将以运河为例描述如何创造一个“奇迹”。

奇迹工程

奇迹可以在/Europa Universalis IV/common/great_projects/*.txt中找到。 格式如下:

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

注意: 原版游戏中有4个等级,包括被摧毁/未建成等级,如下所示:tier_0, tier_1, tier_2, tier_3

Great Project Image

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.csv 中定义一个特殊的链接关系。

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

前两个 <id> 为运河将链接的海域省份ID;第三个 <id> 是奇迹所在省份ID(注意:必须与奇迹文件中定义的省份相符)

地图

例子示意图: dragon_canal_river.bmp

当运河工程完成后,运河所在省份会形成一条新的河流。正是通过这条特殊的瓦片河流图块链接到你的运河。

创建瓦片河流,你必须将图片裁剪成128(即128*128,256*256等)分辨率。从 rivers.bmp 中拷贝所需要的截面,以达成图层颜色统一的目标。

瓦片中新增需要的河流(运河), 规则与一般新建河流规则相同。

将文件名保存为 <project>_river.bmp 格式, 当中的 <project> 即为奇迹名称。

重点: 注意,在你实际操作之前,请务必留意原图 rivers.bmp 中瓦片图块的左上与左下的坐标。

default.map 中, 你需要自定义一条新的运河:

canal_definition = {
	name = "<project_name>" # 奇迹名称
	x = <x>                 # X轴坐标对应瓦片图块的左上角坐标(其实也是左下角的x坐标)
	y = <y>                 # 地图高度 减去 你的瓦片的左下角的y-坐标
}

这里的y-坐标不是直观可见的,你在像Photoshop这样的程序中得到的y坐标,需要从地图高度(原版地图是2048像素)中减去它才能获得定义的正确值。(这个操作是把Photoshop的第四象限坐标,转换成普通的第一象限坐标。)

例如,如果你的瓦片的左下角y坐标是 1407,你应该用 2048 - 1407 得到 641,那才是你需要写进定义的值。

奇迹决议

为了使玩家或者AI可以建造奇迹,我们一般需要设置两个决议:一个用于启动建造;一个用于取消建造。
决议模板:

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

本地化

当然,奇迹建造若需要正常显示也少不了在本地化中添加相应条目:

<project>_title: "Name"
<project>: "Name"
great_project_<project>: "Name"


参考资料

三条运河的关键字:

  1. kiel_canal
  2. suez_canal
  3. panama_canal