
ゼロから始めるEU4Modding:第1回 ディシジョンを作ろう~decisionsフォルダを覗く~
前回のあらすじ:一通りMod作成を始める土台が固まった
まず、Mod作成の中でも一番簡単であろうディシジョンの作成に向けて、既存のディシジョンフォルダとファイルの構造を見ていきます。
decisions
「Europa Universalis IV」ファイルの中にあり、ディシジョンを格納しています。今回のメインディッシュです。

今回は、decisionsの中にあるOttoman.txtの中身を覗いてみます。その名の通り、オスマン帝国のディシジョンを記述しているファイルです。
今回はその中でも"make_constantinople_capital"というディシジョンを見てみます。こんな感じです。
country_decisions = {
make_constantinople_capital = {
potential = {
OR = {
tag = TUR
tag = RUM
}
owns = 151
NOT = { capital = 151 }
NOT = { has_country_flag = relocated_capital_constantinople }
normal_or_historical_nations = yes
OR = {
ai = no
is_playing_custom_nation = no
}
}
allow = {
is_at_war = no
primary_culture = turkish
religion_group = muslim
controls = 151
owns = 149 # Edirne
owns = 316 # Bithnyia
owns = 317 # Bursa
owns = 1764 # Burgas
151 = {
is_state = yes
}
}
effect = {
set_country_flag = relocated_capital_constantinople
set_global_flag = greek_need_restore_constantinople
add_stability = 1
add_core = 151
151 = {
move_capital_effect = yes
change_culture = turkish
change_religion = ROOT
rename_capital = Kostantiniyye
}
if = {
limit = {
NOT = { has_global_flag = constantinople_restored }
}
151 = {
add_base_tax = 4
add_base_production = 4
add_base_manpower = 3
}
set_global_flag = constantinople_restored
}
set_government_rank = 3
}
ai_will_do = {
factor = 1
}
do_not_core = 151 # Constantinople
}
}
各要素毎に見ていきます。
country_decisions
country_decisions = {
}
このcountry_decisionsの波括弧の中にディシジョンを記述します。この中に書かないとディシジョンとして認識されないので注意してください。
ディシジョンタイトル
make_constantinople_capital = {
}
これはディシジョンのタイトルとなります。
後々説明しますが、localizationファイルの中でこのタイトルと対応するテキストをくっつけて、アンダーバーなどが含まれない名称で表示させることができます。localizationに対応させない場合はこのタイトルがそのまま名称として表示されます。
このディシジョンタイトルは、必ず他のディシジョンタイトルと被らないようにしなければなりません。
表示条件(Potential)
potential = {
OR = {
tag = TUR
tag = RUM
} # 操作国家タグがTUR/RUMである
owns = 151 # 州id:151(コンスタンティノープル)を所有する
NOT = { capital = 151 } # コンスタンティノープルが首都でない
NOT = { has_country_flag = relocated_capital_constantinople } # relocated_capital_constantinopleのフラグがない
normal_or_historical_nations = yes # 当該国が通常国家、もしくは歴史的国家である
OR = {
ai = no
is_playing_custom_nation = no # 当該国がAI操作でない、もしくはカスタム国家ではない
}
}
potentialの波括弧の中でディシジョンを表示する条件を記述します。
この場合、
「1.当該国の国家タグがTUR(オスマン帝国)もしくはRUM(ルーム)である」
「2.州ID:151(コンスタンティノープル)を所有する」
「3.コンスタンティノープルが首都ではない」「4."relocated_capital_constantinople"の国家フラグが立っていない」
「5.当該国が通常国家、もしくは歴史的国家である」
「6.当該国がAI操作でない、もしくはカスタム国家ではない」
という条件を満たした場合にディシジョンを表示するようになっています。
※通常国家(Normal nation)、歴史的国家(Historical nation)、カスタム国家(Custom nation)はスタートアップ時の設定によるもの
実行条件(Allow)
allow = {
is_at_war = no
primary_culture = turkish
religion_group = muslim
controls = 151
owns = 149 # Edirne
owns = 316 # Bithnyia
owns = 317 # Bursa
owns = 1764 # Burgas
151 = {
is_state = yes
}
}
allowの波括弧の中に実行条件を記述します。
この場合は、
「1.戦時中でない」
「2.主要文化がトルコである」
「3.国教がムスリム宗教グループである」
「4.州id:151(コンスタンティノープル)を支配(control)している(支配=占領or所有)」
「5-8.州id:149, 316, 317, 1764を所有する」
「9.コンスタンティノープルはステートである」
これらの条件が揃った場合、ディシジョンを実行できるようになります。


※Potential、Allowの中で使える条件については、EU4 Wiki(en)のTriggersのページに一覧表があります。
効果(Effect)
effect = {
set_country_flag = relocated_capital_constantinople
set_global_flag = greek_need_restore_constantinople
add_stability = 1
add_core = 151
151 = {
move_capital_effect = yes
change_culture = turkish
change_religion = ROOT
rename_capital = Kostantiniyye
}
if = {
limit = {
NOT = { has_global_flag = constantinople_restored }
}
151 = {
add_base_tax = 4
add_base_production = 4
add_base_manpower = 3
}
set_global_flag = constantinople_restored
}
set_government_rank = 3
}
effectの波括弧内にディシジョン選択時の効果を記述します。
この場合は、
「国家フラグ"relocated_capital_constantinople"を立てる」
「全国フラグ(Global flag)"greek_need_restore_constantinople"を立てる」
「安定度1を追加」
「コンスタンティノープルを中核化」
「コンスタンティノープルの文化をトルコ文化に変更、首都に設定、州の宗教を国教に変更、Kostantiniyyeに改名」
「"constantinople_restored"の全国フラグが立っていない場合、コンスタンティノープルの基本税収+4、基本生産+4、基本人的資源+3、"constantinople_restored"の全国フラグを立てる」
「政府ランクを帝国に設定」
となります。
※if節の中にあるlimitについてですが、ifの条件としてlimit内の記述が使われることになります。EU4ではどうやら通常のプログラミングのようにifを使うわけではないみたいです。ややこしいですね。
ちなみにlimitは本来Scopesの中に入れて使うもので、Scopesで収集してきたものをlimit内の条件でふるいにかけるイメージです。
※Effectの中で使える効果については、Triggersと同じくEU4 Wiki(en) Effectsに一覧があります。
AIの実行可否、行動制限
ai_will_do = {
factor = 1
}
do_not_core = 151 # Constantinople
ai_will_do内ではfactorの値を設定します。
factor=0の場合、AIがディシジョンを選択することはありません。
factor=1の場合、AIはディシジョンを選択してきます。
AIに選択させたくないディシジョンを作る場合は、factor=0に設定しましょう。
do_not_coreでは、州idを指定します。AIはこれによって指定された州を中核化しなくなります。
今回のディシジョンはコンスタンティノープルを中核化するものであるため、中核化してしまうと君主点が無駄になってしまいます。それを防ぐため、do_not_coreでコンスタンティノープルを中核化しないように指定されています。
※AIの行動制限には、do_not_coreの他にdo_not_integrate(同君下位国を統合しない)があるらしい。これはイコール以下で国家タグを指定する。
do_not_integrate = SWE
こんな感じ。
書くのに疲れたので今回はここで終わりです。
次回:ディシジョンを作ろう2