定义域:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.0
无编辑摘要
(文本替换 - 替换“{{Version|”为“{{版本|”)
 
(未显示1个用户的11个中间版本)
第1行: 第1行:
{{Version|1.0}}
{{ 版本|1.0}}
定义域是实在的实例,如果想知道如何筛选准确的定义域,请查看[[事件目标]],如果想知道定义域的类型,查看[[#定义域类型]]


  定义域是实在的实例,如果想知道如何筛选准确的定义域,请查看[[事件目标]], 果想知道 定义域 的类型,查看[[#Types of scope]]
=深入介绍=
  其他p社游戏一样,Vic3也有ROOT,PREV,THIS,FROM这些 定义域


=== 深入介绍 ===
  对于特定的定义域,通常而言由特定的字符,比如var,p,s,c,law_type加上<code>:</code>连接名字来使用定义域,比 说<code>s:STATE_MINNESOTA</code>就定义了名为STATE_MINNESOTA的state_region类型 定义域。
其他p社游戏一样,Vic3也有ROOT,PREV,THIS,FROM这些 定义域。


For specific scope, it starts with certain letter, such as var,p,s,c,law_type. Using them with <code>:</code> followed by ceratain name can call the scope, e.g, <code>s:STATE_MINNESOTA</code> call a state_region scope names STATE_MINNESOTA.
定义域可以通过 [[事件目标]] 链接,事件目标是一系列通过定义域得到输出定义域的函数。


Scope can be linked by [[Event targets]], they are series of function to linked to output scopes from input scopes.
<code>s</code>就是一种 [[ 事件目标]] ,而且有requires data属性,因此需要通过<code>:</code> 加上特定的名称以定义一个定义域。又因为<code>s</code>是一个有global link属性的[[事件目标]]。因此可以独立使用


<code>s</code> is an [[Event targets]], also it requires data, therefore it must followed by <code>:</code> than the ceratain name to call the scope. Due to <code>s</code> is global link [[Event targets]], It can be used independentlly.
而至于<code>region_state</code> 就没有global link 属性,因此需要依赖 <code>.</code> 在一个 state_region 定义域后连接。
<code>region_state</code> is not global link so it sould follow by <code>.</code> after a state_region scope.


By <code>.</code> can quickly link scopes. The most common example is <code>s:STATE_MINNESOTA.region_state:USA</code>, firstly is state_region scope than by <code>.</code> link to state. Further, add one more <code>.</code> is possible, just like <code>s:STATE_MINNESOTA.region_state:USA.var:usa_state_flag_block</code>
<code>.</code> 可以快捷连接定义域。最常见的例子是<code>s:STATE_MINNESOTA.region_state:USA</code> ,首先定义了一个state_region类型定义域,然后通过<code>.</code> 连接到state类型的定义域。可以通过多个<code>.</code> 连接定义域,<code>s:STATE_MINNESOTA.region_state:USA.var:usa_state_flag_block</code> 就是一个例子


However, some of scope can not be quickly switch, due to the parent scope is uncertain. diplomatic_play usually is uncertain scope, and then [[Event targets]] should be considered
然而不确定的定义域不能快捷链接,因为上一级定义域不确定,diplomatic_play类型的定义域通常不确定,因此需要在大括号内使用[[ 事件目标]]


<syntaxhighlight lang=perl>
<syntaxhighlight lang=perl>
random_diplomatic_play = { 
random_diplomatic_play = { 
    # random,every are to used in really effect, any is to used in trigger
    # random,every 通常用在效果里面 any 通常用在条件里
    # random,every and any is all uncertain, can not use . to link next scope
    # random,every any 都是不确定的, 不能用. 快速连接
    limit = {
    limit = {
      is_war = yes
      is_war = yes
    }
    }
    initiator = { change_infamy = 5 } # initiator is event target of diplomatic_play, it outputs a country
    initiator = { change_infamy = 5 } # initiator 是diplomatic_play类型的scope的事件目标, 输出一个country类型的定义域
}
}
</syntaxhighlight>
</syntaxhighlight>


 
这是详尽的例子:
 
 
Here are detailed example of scope happends:
<syntaxhighlight lang=perl>
<syntaxhighlight lang=perl>
example_event.1 = {
example_event.1 = {
type = country_event # It means that, root is the country which happend the event, instead of state.
type = country_event # 定义了ROOT为发生的国家,而不是发生的人物或者地区
    random_diplomatic_play = {
    random_diplomatic_play = {
      limit = {
      limit = {
        is_war = yes
        is_war = yes
        any_scope_play_involved = {
        any_scope_play_involved = {
          THIS = ROOT # THIS is the current scope, in there the THIS is any_scope_play_involved
          THIS = ROOT # THIS 就是当前的定义域。 在这里 THIS 就是any_scope_play_involved
        }
        }
        NOR = { # not or 
        NOR = { # not or 
          initiator = ROOT # initiator and target is the event target of diplomatic_play
          initiator = ROOT # initiator target 是diplomatic_play的事件目标
          target = ROOT
          target = ROOT
        }
        }
      }
      }
      initiator = { # this scope can only used in diplomatic scope
      initiator = { # initiator 仅能使用在 diplomatic scope 这一定义域
        save_scope_as = initiator_scope # therefore, it should be save to be handled in other scopes
        save_scope_as = initiator_scope # 因此,为了让其他定义域调用,需要保存定义域
      }
      }
      target = {
      target = {
        save_scope_as =  target_scope
        save_scope_as =  target_scope
      }
      }
      if = { limit = { ROOT = { is_diplomatic_play_enemy_of = scope:initiator_scope } } # to judge on ROOT scope
      if = { limit = { ROOT = { is_diplomatic_play_enemy_of = scope:initiator_scope } } # 转移定义域到ROOT
        if = { limit = { scope:initiator_scope = { infamy >= infamy_threshold:infamous } } # now we handdle saved scope in other scope
        if = { limit = { scope:initiator_scope = { infamy >= infamy_threshold:infamous } } # 在ROOT定义域里使用initiator的scope
          ROOT = { change_infamy = 5 }
          ROOT = { change_infamy = 5 }
        }
        }
第62行: 第59行:
          }
          }
        }
        }
        remove_target_backers = { ROOT } # remove_target_backers can only effects on diplomatic_play scope.
        remove_target_backers = { ROOT } # 移除外交博弈目标支持者,只能显示,没有效果,令人沮丧
       # however, this effect just can display, it do not really make ROOT exit the war, it is frustrating.
      }
      }
    }
    }
第69行: 第65行:
</syntaxhighlight>
</syntaxhighlight>


===  地区定义域 ===
=地区定义域=
First of all, let me clear up the difference between a  and a mere .
 首先,有必要甄别"state region"和"state"
 首先,有必要甄别"state region"和"state" 的区别


 用{{Flag|西班牙}}为例, 其拥有一个名为 "STATE_GRANADA"的"state region". "STATE_GRANADA"被{{Flag|西班牙}}和{{Flag|大不列颠}}同时拥有, "STATE_GRANADA" 也因此裂成了两个 "split state". {{Flag|大不列颠}}有一个 "British STATE_GRANADA" 而 {{Flag|西班牙}}也有一个 "Spianish STATE_GRANADA". 整一块"state region" STATE_GRANADA 就变成了两个叫做 "British STATE_GRANADA" 和 "Spianish STATE_GRANADA"的”states“. “state”的名称由占有地块相对数量决定,比如说{{Flag|西班牙}}有 STATE_GRANADA的绝大多数地块,因此"Spianish STATE_GRANADA"直接就叫做"STATE_GRANADA"
 用{{Flag|西班牙}}为例, 其拥有一个名为 "STATE_GRANADA"的"state region". "STATE_GRANADA"被{{Flag|西班牙}}和{{Flag|大不列颠}}同时拥有, "STATE_GRANADA" 也因此裂成了两个 "split state". {{Flag|大不列颠}}有一个 "British STATE_GRANADA" 而 {{Flag|西班牙}}也有一个 "Spianish STATE_GRANADA". 整一块"state region" STATE_GRANADA 就变成了两个叫做 "British STATE_GRANADA" 和 "Spianish STATE_GRANADA"的”states“. “state”的名称由占有地块相对数量决定,比如说{{Flag|西班牙}}有 STATE_GRANADA的绝大多数地块,因此"Spianish STATE_GRANADA"直接就叫做"STATE_GRANADA"
第90行: 第85行:
</syntaxhighlight>
</syntaxhighlight>


A list of all the vanilla state regions is available [[List_of_state_regions|here]], and is useful to easily find the tag you need.
原版的state region 在[[List_of_state_regions| 这里]] ,你可以很容易找到这些的名字
 
To learn how to change state traits you may wanna check out the workshop mod "More State Modifiers".


==== State triggers ====
要了解如何改变地区特质你可以去创意工坊参见 "More State Modifiers".
WIP


=== Building scope ===
= 建筑定义域=
Although technically there is a building scope, in practice, game logic that involves buildings is done indirectly through the state scope.
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.
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.
第122行: 第114行:
</syntaxhighlight>
</syntaxhighlight>


=其他定义域=
其他的定义域大同小异,都是特定符号加上:


==== Building triggers ====
== 国家定义域==
*is_building_type = building_sulfur_mine
Scoping to a country you use the letter "'''c'''", for example:
*level >= 2
<syntaxhighlight lang=perl>
c:SIA = {
   add_treasury = 100 # example of game logic
}
</syntaxhighlight>


=== 其他定义域===
A list of all the vanilla countries is available [[Countries#List|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.
Culture scope seems to work in a similar fashion to buildings scope, indirectly referenced. However has more use cases.


第141行: 第138行:




====  利益集团定义域 ====
==利益集团定义域==
Scoping to an interest group you use the letters "'''ig'''", for example:
Scoping to an interest group you use the letters "'''ig'''", for example:
<syntaxhighlight lang=perl>
<syntaxhighlight lang=perl>
第172行: 第169行:
|}
|}


==== Market Good scope ====
== 市场商品定义域==
Scoping to a market good you use the letters "'''mg'''", for example:
Scoping to a market good you use the letters "'''mg'''", for example:
<syntaxhighlight lang=perl>
<syntaxhighlight lang=perl>
第181行: 第178行:




==== Types of scope ====
= 定义域类型=
none
none
value
value

2023年9月5日 (二) 21:40的最新版本

定义域是实在的实例,如果想知道如何筛选准确的定义域,请查看事件目标,如果想知道定义域的类型,查看#定义域类型

深入介绍

正如其他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