偉大工程修改

模組製作· 约 12 分钟阅读

本頁面講述的內容長期有效。

奇蹟是一種特殊的決議,比較常見的是修建運河,通過變更目標環境替換成可通行的河流。

創造一個奇蹟需要修改多個不同的文件才能達成。注意,本文將以運河為例描述如何創造一個「奇蹟」。

奇蹟工程

奇蹟可以在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_.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/.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(注意:必須與奇蹟文件中定義的省份相符)

地圖

例子示意图:
dragon_canal_river.bmp
例子示意圖: dragon_canal_river.bmp

當運河工程完成後,運河所在省份會形成一條新的河流。正是通過這條特殊的瓦片河流圖塊連結到你的運河。

創建瓦片河流,你必須將圖片裁剪成128(即128*128,256*256等)解析度。從 rivers.bmp 中拷貝所需要的截面,以達成圖層顏色統一的目標。

瓦片中新增需要的河流(運河), 規則與一般新建河流規則相同。

將文件名保存為 _river.bmp 格式, 當中的 即為奇蹟名稱。

重點: 注意,在你實際操作之前,請務必留意原圖 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 = {type =<project> instant = yes/no}
}
}
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