定義域

本頁面所適用的版本可能已經過時,最後更新於1.0

定義域是實在的實例,如果想知道如何篩選準確的定義域,請查看事件目標,如果想知道定義域的類型,查看#定義域類型

深入介紹

正如其他p社遊戲一樣,Vic3也有ROOT,PREV,THIS,FROM這些定義域。

對於特定的定義域,通常而言由特定的字符,比如var,p,s,c,law_type加上:連接名字來使用定義域,比如說s:STATE_MINNESOTA就定義了名為STATE_MINNESOTA的state_region類型定義域。

定義域可以通過 事件目標 鏈接,事件目標是一系列通過定義域得到輸出定義域的函數。

s就是一種 事件目標,而且有requires data屬性,因此需要通過: 加上特定的名稱以定義一個定義域。又因為s是一個有global link屬性的事件目標。因此可以獨立使用

而至於region_state就沒有global link屬性,因此需要依賴 . 在一個 state_region定義域後連接。

.可以快捷連接定義域。最常見的例子是s:STATE_MINNESOTA.region_state:USA,首先定義了一個state_region類型定義域,然後通過.連接到state類型的定義域。可以通過多個. 連接定義域,s:STATE_MINNESOTA.region_state:USA.var:usa_state_flag_block就是一個例子

然而不確定的定義域不能快捷鏈接,因為上一級定義域不確定,diplomatic_play類型的定義域通常不確定,因此需要在大括號內使用事件目標

random_diplomatic_play = { 
    # random,every通常用在效果里面 any通常用在条件里
    # random,every和 any都是不确定的, 不能用.快速连接
    limit = {
        is_war = yes
    }
    initiator = { change_infamy = 5 } # initiator是diplomatic_play类型的scope的事件目标, 输出一个country类型的定义域
}

這是詳盡的例子:

example_event.1 = {
	type = country_event # 定义了ROOT为发生的国家,而不是发生的人物或者地区
    random_diplomatic_play = {
        limit = {
            is_war = yes
            any_scope_play_involved = {
                THIS = ROOT # THIS 就是当前的定义域。 在这里 THIS就是any_scope_play_involved
            }
            NOR = { # not or 
                initiator = ROOT # initiator 和 target 是diplomatic_play的事件目标
                target = ROOT
            }
        }
        initiator = { #  initiator 仅能使用在 diplomatic scope 这一定义域
            save_scope_as = initiator_scope # 因此,为了让其他定义域调用,需要保存定义域
        }
        target = {
            save_scope_as =  target_scope
        }
        if = { limit = { ROOT = { is_diplomatic_play_enemy_of = scope:initiator_scope } } # 转移定义域到ROOT
            if = { limit = { scope:initiator_scope = { infamy >= infamy_threshold:infamous } } # 在ROOT定义域里使用initiator的scope
                ROOT = { change_infamy = 5 }
            }
            ROOT = {
                set_owes_obligation_to = {
                    country = scope:target_scope
                    setting = yes
                }
            }
            remove_target_backers = { ROOT } # 移除外交博弈目标支持者,只能显示,没有效果,令人沮丧
        }
    }
 }

地區定義域

首先,有必要甄別"state region"和"state"

西班牙的國旗 西班牙為例, 其擁有一個名為 "STATE_GRANADA"的"state region". "STATE_GRANADA"被西班牙的國旗 西班牙大不列顛的國旗 大不列顛同時擁有, "STATE_GRANADA" 也因此裂成了兩個 "split state". 大不列顛的國旗 大不列顛有一個 "British STATE_GRANADA" 而 西班牙的國旗 西班牙也有一個 "Spianish STATE_GRANADA". 整一塊"state region" STATE_GRANADA 就變成了兩個叫做 "British STATE_GRANADA" 和 "Spianish STATE_GRANADA"的」states「. 「state」的名稱由占有地塊相對數量決定,比如說西班牙的國旗 西班牙有 STATE_GRANADA的絕大多數地塊,因此"Spianish STATE_GRANADA"直接就叫做"STATE_GRANADA"

這是模組製作中一個很重要的概念,一言以蔽之:

  1. 地理性質的,一整塊的稱為"state region"
  2. 國家對"state region"占有的部分稱為 "state",無論這個國家擁有全部還是部分。

舉例子來說:

s:STATE_AMAZONAS = { # 这是地理意义上的state region
     add_homeland = brazilian 
 }
 s:STATE_AMAZONAS.region_state:BRZ = { # 这是这是巴西占有的state
     set_state_type = incorporated
 }

原版的state region 在這裡,你可以很容易找到這些的名字

要了解如何改變地區特質你可以去創意工坊參見 "More State Modifiers".

建築定義域

Although technically there is a building scope, in practice, game logic that involves buildings is done indirectly through the state scope. Here's an example I use in one of my mods. Check if a specific country, in a specific state region it owns, has a specific building in level 2.

c:SIA = {
 	any_scope_state = {
 		state_region = s:STATE_NORTH_BORNEO
 		any_scope_building = {
 			is_building_type = building_sulfur_mine
 			level >= 2					
 		}
 	}
 }

The letter to scope buildings is "b". However it's uses are very limited and is mostly used for basic world building.

if = {
 	limit = {
 		exists = state.b:building_sulfur_mine
 	}
 	add = state.b:building_sulfur_mine.level
 }

其他定義域

其他的定義域大同小異,都是特定符號加上:

國家定義域

Scoping to a country you use the letter "c", for example:

c:SIA = {
     add_treasury = 100 # example of game logic
 }

A list of all the vanilla countries is available here, and is useful to easily find the tag you need.

文化定義域

Culture scope seems to work in a similar fashion to buildings scope, indirectly referenced. However has more use cases.

Scoping to a culture you use the letters "cu", for example:

state_region = {
 	is_homeland = cu:greek
 }


利益集團定義域

Scoping to an interest group you use the letters "ig", for example:

ig:ig_landowners = {
	remove_ideology = ideology_paternalistic # example of game logic
	add_ideology = ideology_republican_paternalistic
}


The different interest groups tags are:

Pretty name Tag name
Armed Forces ig_armed_forces
Devout ig_devout
Industrialists ig_industrialists
Intelligentsia ig_intelligentsia
Landowners ig_landowners
Petite bourgeoisie ig_petty_bourgeoisie
Rural Folk ig_rural_folk
Trade unions ig_trade_unions

市場商品定義域

Scoping to a market good you use the letters "mg", for example:

mg:tools = { 
     save_scope_as = cool_tools # game logics
 }


定義域類型

none value bool flag country technology technology_status culture state province pop pop_type building building_type interest_group market market_goods interest_marker strategic_region diplomatic_action diplomatic_pact diplomatic_play diplomatic_relations character state_region war theater religion institution institution_type law law_type journalentry trade_route decree commander_order commander_order_type front battle interest_group_trait ideology goods canal_type country_definition civil_war state_trait country_creation country_formation hq objective battle_side political_movement combat_unit party shipping_lane