编辑“事件模组制作

警告:您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您登录创建一个账户,您的编辑将归属于您的用户名,且将享受其他好处。

该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。

最后版本 您的文本
第2行: 第2行:
{{需要翻译}}
{{需要翻译}}
{{需要完善}}
{{需要完善}}
'''事件'''是每个完善的模组的核心;是在游戏过程中可能发生在玩家身上的一系列或大或小的故事片段。
Events are the meat of every well-rounded mod; smaller and larger bits of story that can happen to a player during the campaign.


== 位置==
== Location ==
事件的代码需要放在位于[[ 模组结构#Mod 文件夹|Mod文件夹]] 中的<code>events</code>目录中的.txt文件中。每个文件可以容纳任意多个事件。如有需要,<code>events</code> 目录下可以再建立子文件夹来存放事件文件。
Events belong in a .txt file inside the <code>events</code> directory directly below your [[Mod structure#Mod folder|root mod folder]]. Each file can hold as many events as one would like. The <code>events</code> directory may also have sub-folders containing their own event files, if one prefers.


== 结构 ==
== Structure ==


整体结构与[[ck2: 事件模组制作|CK2 的事件]] 相似,语法进行了一些调整,并添加了大量的额外功能,其中许多是可选的。以下是最基本的事件(其中每个元素会在后面的小节中进行解释):
The overall structure is similar to that of a [[CKII:Event_modding|CK2 event]], with some tweaks to the syntax and a whole lot of extra features, many of them optional. The barest possible event is laid out here, and each element is described individually in a later section.
<syntaxhighlight lang="coffeescript">
 
namespace = example
<pre>
example.1 = {
example.1 = {
desc = example.1.desc
desc = example.1.desc
第19行: 第19行:
}
}
}
}
</syntaxhighlight>
</pre>
There you go! Add this to your mod, trigger it from the in-game console using "event triggers [example.1]", and you have got yourself a working event! Everything else is optional, but necessary to really flesh out the events.


好了!将这段代码添加到你的模组中,在游戏内控制台输入"event example.1"来触发它,你就会得到一个可用的事件!这就是一个最基本的事件的结构,所有其他的内容都是可选的,但是编撰一个生动的事件时它们是必不可少的。以下是一个更为详细的事件示例(仅包含基础内容):
=== ID and namespace ===
The ID uniquely identifies your event.


<syntaxhighlight lang="coffeescript">
=== Flags ===
## 这是一个基础事件,可将其作为其他事件的基础(参考)。不过,您可能希望先删除这段注释垃圾。
These are top-level variables that determine your event's kind and appearance. They have a limited set of values.
superexample.1337 = { # 请使用注释(比如这个!)在此处填写事件名称,这样其他模组编写者就可以在不知道ID的情况下找到你正在处理的事件。
type = character_event
title = "A Modding Example Worthy of Kings" # 专业提示:在编写时,你可以使用字符串,稍后再用本地化替换它。
desc = birth.1003.b # 对于Sublime用户而言,有一个非常出色的功能,即“在文件中查找”,非常适用于在本地化文件中探索。
 
theme = mental_break
left_portrait = root
 
option = { # 在选项中使用注释来说明选项的内容或功能(例如:“不,我谴责你这个异端!”或“与孩子进行决斗”),这与事件标题的做法相似,这是一个很好的习惯。
name = stewardship_domain_special.1424.a
}
}
</syntaxhighlight>
 
=== ID 和命名空间 ===
命名空间(Namespaces)可以是任何由字母和数字组成的字符串(不包含'.'字符),会被用作前缀,形式为 <code><namespace>.<id></code> 。ID是对于一个事件的唯一标识。
 
如果一个事件文件使用一个命名空间,那么它必须在文件开头声明 <code>namespace = <namespace></code> 。对每个使用该命名空间的文件都需要进行声明。
 
=== 标志 ===
标志(Flags)是决定你的事件种类和外观的顶级变量。它们有一组有限的取值。


{| class="wikitable"
{| class="wikitable"
|-
|-
! Flag !! 意义 !! 可能的取值
! Flag !! Meaning !! Possible values
|-
|-
| type 
| type 
|| 事件的类型决定了根(root)的作用域(scope)。
|| The kind of event. It determines what sort of scope the root is.
||
|| * character_event
* character_event
* none (when an event doesn't use the root scope at all)
* letter_event
* duel_event
* none (当一个事件完全不使用根作用域时)
* empty (使一个无角色事件能被触发。注意:这意味着输入 type = empty )
|-
|-
| hidden 
| hidden || Set this to true, and the event will not be shown at all; it will happen in the background. Useful for doing maintenance events that are not immediately relevant to the player.
|| 将此设置为true,事件将不会显示;它将在后台执行。适用于进行对玩家并不立即相关的维护事件。
|| true, false
|| true, false
|}
|}


== 人物肖像 ==
== Portraits ==
在《十字军之王3》中,人物肖像是3D的,而且是动态的啦!肖像由肖像位置和动画决定。
In Crusader Kings III, portraits are now in 3D, and can now be animated as well! What follows is a list of the different portrait positions, as well as a list of animations for them.


=== 人物肖像定位 ===
=== Portrait Positions ===


[[File:Example event.png|thumb|left| 人物肖像效果]]
[[File:Example event.png|thumb|left|Portrait Positions]]


{| class="wikitable"
{| class="wikitable"
第76行: 第52行:
! Portrait Position !! Description
! Portrait Position !! Description
|-
|-
| left_portrait || 在事件框的左侧显示肖像。
| left_portrait || Shown on the left side of the event scene.
|-
|-
| right_portrait || 在事件框的右侧显示肖像。
| right_portrait || Shown on the right side of the event scene.
|-
|-
| lower_left_portrait || 在事件框的左下方显示肖像。
| lower_left_portrait || Shown on the lower left part of the event scene.
|-
|-
| lower_center_portrait || 在事件框的下方中间显示肖像。
| lower_center_portrait || Shown on the lower center part of the event scene.
|-
|-
| lower_right_portrait || 在事件框的右下方显示肖像。
| lower_right_portrait || Shown on the lower right part of the event scene.
|}
|}


这是一个同时使用所有人物肖像位置的示例,效果截图如上图:
Here is an example of all of the portrait positions in use at the same time, along with a screenshot:
<pre>
<pre>
example_event.1001 = {
example_event.1001 = {
left_portrait = {
left_portrait = {
character = ROOT # 此处指定的人物会出现在事件框的指定位置,表现出指定的动画
character = ROOT # Whoever this is scoped to will show up in this event window position, exhibiting the chosen animation.
animation = fear # 注意,拥有某些角色的基因特质(比如巨人、侏儒)会改变人物模型,从而有不同的动作模组;如果你要求一个没有这个动作的模型的人物做将这些特有的动作,可能导致游戏崩溃
animation = fear # Take note that characters with SOME genetic traits (for example, gigantism, dwarfism) that change their character models have different animations, and if you assign one of THOSE animations to a character that does not have that model, crashes may occur.
}
}
right_portrait = {
right_portrait = {
第110行: 第86行:
</pre>
</pre>


肖像可以使用以下参数:
=== Animations ===
 
{| class="wikitable"
|-
! 参数 !! 描述 !! 示例
|-
| character|| 展示哪个角色的肖像 ||<code>character = scope:event_target</code>
|-
| animation|| 角色将显示哪种动画 ||<code>animation = anger</code>
|-
| triggered_animation|| 如果符合条件,人物将显示这种动画。如果不符合,将显示以<code>animation = </code>语句设置的动画。 ||<pre>triggered_animation = {
trigger = {}
animation = fear
}</pre>
|-
| triggered_outfit|| 设置事件中使用的服装 ||<pre>triggered_outfit = {
trigger = {}
outfit_tags = no_clothes (可以使用多个tag,格式:outfit_tags = { tag1 tag2 })
remove_default_outfit = yes/no
}</pre>
|-
| hide_info|| 避免显示人物的任何信息 (提示文字、盾徽、clicks等),只显示人物肖像 ||<code>hide_info = yes/no</code>
|}
 
=== 人物动画 ===
{|class="wikitable"
{|class="wikitable"
|-
|-
!colspan="6"| 与事件兼容的动画ID
!colspan="4"|Animation
|-
|-
| idle
| happiness
| chancellor
| dismissal
| steward
| prison_dungeon
| marshal
| admiration
| spymaster
| chaplain
|-
|-
| anger
| rage
| disapproval
| disbelief
| disgust
| disgust
| schadenfreude
| stress
| personality_compassionate
|-
| pain
| ecstasy
| fear
| fear
| rage
|-
|-
| sadness
| anger
| flirtation_left
| shame
| shame
| boredom
|-
| shock
| shock
| worry
| worry
| boredom
| scheme
| grief
| personality_bold
|-
|-
| paranoia
| personality_callous
| dismissal
| personality_irrational
| personality_content
| flirtation
| flirtation
| flirtation_left
| love
| schadenfreude
|-
|-
| stress
| happiness
| ecstasy
| admiration
| lunatic
| scheme
|-
|-
| beg
| disbelief
| pain
| personality_cynical
| poison
| personality_rational
| aggressive_axe
| personality_dishonorable
| aggressive_mace
| aggressive_sword
|-
|-
| aggressive_dagger
| idle
| aggressive_spear
| paranoia
| aggressive_hammer
| personality_vengeful
| celebrate_axe
| disapproval
| celebrate_mace
| celebrate_sword
|-
|-
| celebrate_dagger
| sick
| celebrate_spear
| beg
| celebrate_hammer
| personality_zealous
| loss_1
| newborn
| chess_certain_win
| chess_cocky
|-
|-
| laugh
| love
| lantern
| sadness
| eyeroll
| personality_honorable
| eavesdrop
| personality_forgiving
| assassin
| toast
|-
|-
| toast_goblet
| personality_greedy
| drink
| personality_coward
| drink_goblet
| severelyinjured
| newborn
| sick
| severelywounded
| severelywounded
|-
|-
| prisonhouse
| prisondungeon
| war_attacker
| war_attacker
| war_defender
| war_defender
| war_over_tie
| war_over_win
| war_over_win
|-
| grief
| war_over_loss
| pregnant
| personality_honorable
| personality_dishonorable
| personality_bold
| personality_coward
|-
| personality_greedy
| personality_content
| personality_vengeful
| personality_forgiving
| personality_rational
| personality_irrational
|-
| personality_compassionate
| personality_callous
| personality_zealous
| personality_cynical
| frontend_center_idle
| frontend_left_idle
|-
| frontend_right_idle
| throne_room_chancellor
| throne_room_kneel_1
| throne_room_kneel_2
| throne_room_curtsey_1
| throne_room_messenger_1
|-
| throne_room_messenger_2
| throne_room_messenger_3
| throne_room_conversation_1
| throne_room_conversation_2
| throne_room_conversation_3
| throne_room_conversation_4
|-
| throne_room_cheer_1
| throne_room_cheer_2
| throne_room_applaud_1
| throne_room_bow_1
| throne_room_bow_2
| throne_room_bow_3
|-
| throne_room_one_handed_passive_1
| throne_room_one_handed_passive_2
| throne_room_two_handed_passive_1
| throne_room_writer
| test_case_1
| throne_room_ruler
|}
|}


== 主题 ==
=== Themes ===
主题(Themes)是一类用于角色肖像的背景、照明环境和音效的集合。它们在 common/event_themes/ 目录中声明。
{| class="wikitable"
{| class="wikitable"
|-
|-
第362行: 第248行:
|}
|}


可以使用 <code>override_background</code>, <code>override_icon</code>, <code>override_sound</code>, and <code>override_environment</code> 来覆盖主题的各个元素。
override_background, override_icon, override_sound, override_environment


==== 背景 ====
==== Backgrounds ====
{| class="wikitable"
{| class="wikitable"
!colspan="4"|Background
!colspan="4"|Background
第429行: 第315行:
|}
|}


=== 环境 ===
==== Environments ====
当您选择了一个背景之后,系统会自动选择适当的环境。仅在必要时才进行更改。
When you've selected a background, the appropriate environment is automatically selected. Only overwrite it when necessary.
{| class="wikitable"
{| class="wikitable"
!colspan="3"| Environment
!colspan="3"| Environment
第534行: 第420行:
|}
|}


== 触发器 ==
=== Trigger ===
这是另一个使事件具有使用价值的要求。
This is an additional requirement for an event to work.


<pre>
==== on_trigger_fail ====
trigger = { # 只有这些条件都满足,这个事件才可以触发(对于事件本身而言,这是一个巨大的IF语句)。
Runs when the trigger fails.
culture = {
has_innovation = innovation_guilds # 检查你的文化是否已解锁行会。
}
}
</pre>
 
还可以使用 <code>trigger_if</code> 将某些要求锁定在自己的触发器后面。只有在 <code>limit</code> 为真时,才会检查 <code>trigger_if</code> 中的要求。如果想在 <code>trigger_if</code> 为假时检查另一组要求,可以选择添加 <code>trigger_else</code> 。
 
<pre>
trigger = {
any_held_county = { # 检查是否持有一个建造了铁匠铺的地产
any_county_province = {
has_building_or_higher = blacksmiths_01
}
}
 
trigger_if = { # 如果角色有贪婪的特质,需求增加500金币
limit = { has_trait = greedy }
gold > 500
}
trigger_else = { # 否则,必须至少拥有50点虔诚和10金币。
piety > 50
     gold > 10
}
}
</pre>
 
=== 触发失败 ===
on_trigger_fail 在trigger检验失败的时候运行。
 
== 描述 ==
{{需要完善}}
Description 解释如何组合多个字符串来构成描述,包括类似于first_valid和所有备选项的内容。


== 立即执行 ==
=== Description ===
这是一个效果脚本块:当事件被触发时,它将立即运行,甚至在标题、描述和肖像被运算确定和渲染之前。这个脚本块常见的用途是:设置变量和保存作用域,以便在文本或肖像中使用;施展玩家无法控制其发生的功能性效果。
Explain how a description can be composed of multiple strings; with stuff like first_valid, and all the alternatives.


会提示 "has happened"。
=== Immediate ===
This is a block of effect script: it will be ran ''immediately'' as your event is triggered, before the title, description, portraits, are even evaluated let alone rendered. This block is useful for setting variables and saving scopes to use in your text or for portraits; or for functional effects that you want to happen without the player having any control over it.


<pre>
"has happened" tooltip.
immediate = { # 无论选择哪个选项,当事件出现在屏幕上时,它都会起作用。
add_gold = 50 # 给玩家增加50金钱
}
</pre>


== 选项 ==
=== Options ===
用户可以点击事件所提供选项。每个事件可以有任意数量的选项,包括没有选项(一个常见的例子是隐藏事件)。每个选项在事件的顶级块中定义,如下所示:
Options within events are able to be pressed by the user. Each event may have any number of options, including none at all (a common example includes hidden events). Each option in defined in the main event block, like so:
<pre>
<pre>
example.1 = {
example.1 = {


#[...]
[...]


option = {
option = {
# 选项内容
# option info
}
}


#[...]
[...]


}
}
</pre>
</pre>
The table below describes available keys within the <code>option</code> block:


以下是一个更复杂的例子:
<pre>
option = { # 选项名
name = stewardship_domain_special.1424.a
trigger_event = { # 让另一个事件发生
id = yearly.1012 # 事件ID是访问级别最高的内容(因此,只要事件存在,其ID就是有效、可访问的)。
days = { 7 14 } # 获取两个值之间的随机数(无法确定是否包括两个边界值),任何接受 "= {X Y}" 格式的内容如果只需要一个确定值则可以写成 "= X"。
}
hidden_effect = { # 隐藏选项提示中的内容
scope:county = { # 获取存储在作用域 "county" 中的位置信息。
add_county_modifier = { # 添加修正(奖励或惩罚)
modifier = governance_land_cleared_for_settlement_modifier
                 # 确保使用的修正类型正确,列表为https://ck3.parawikis.com/wiki/%E4%BF%AE%E6%AD%A3%E5%88%97%E8%A1%A8(在本例中为伯爵领)。
days = 3650 # 效果的持续时间,也可以用 days = {X Y}
}
}
}
ai_chance = {
base = 50 # 选择这个选项相比其他选项的机会有多大?(不必是0到100,可以是任何数值)
modifier = {  # 你可以根据各种因素来改变这个值,此处示范根据AI角色的特质进行修改。
add = 15
has_trait = sadistic # 特质可以在 ..\game\common\traits\00_traits.txt 中找到
}
modifier = {
add = -40 # 做减法则是加负数(5 + -10 = -5)。
has_trait = compassionate
}
}
}
</pre>
下表描述了 <code>option</code> 块中可用的键:
{| class="wikitable"
{| class="wikitable"
! Key
! Key
! 必需
! Required
! 描述
! Description
! 例子
! Example


|-
|-
| name
| name
|
| Yes
| 指向事件选项按钮文本的本地化键。
| Points to a localization key for the event option button text.
| name=example.1.a
| name=example.1.a


|-
|-
| (effects)
| (effects)
|
| No
| 选项可能产生的任何[[Effects|效果]] 都可以直接写在 <code>option</code> 块中。
| Any [[effect]]s that the option may have can be written directly in the <code>option</code> block.
| play_music_cue = mx_cue_banquet
| play_music_cue = mx_cue_banquet


|-
|-
| trigger
| trigger
|
| No
| 定义了一个必须满足的[[ 触发器]] ,以使选项有效并对用户可用。请注意,这与[[# 触发器| 事件的触发器]] 不同。
| Defines a [[trigger]] that has to be fulfilled for the option to be valid and thus available to the user. Not to be confused with the [[#Trigger|main event trigger]].
|
|
<pre>
<pre>
第665行: 第482行:
|-
|-
| show_as_unavailable
| show_as_unavailable
|
| No
| 如果选项无效,但此触发器有效,则选项将显示但被禁用。此行为还受EVENT_OPTIONS_SHOWN_HIDE_UNAVAILABLE定义的影响。
| If the option is invalid, but this trigger is, the option will be shown, but disabled. This behavior is also influenced by the EVENT_OPTIONS_SHOWN_HIDE_UNAVAILABLE define.
|
|
<pre>
<pre>
第673行: 第490行:
}
}
</pre>
</pre>
|-
| trait
| 否
| 如果玩家具有指定的特质,则在此选项的左侧显示它。将鼠标悬停在上面时,会显示该选项可用的原因是由于拥有该特质。这仅仅是为了增加趣味性,实际上并不影响选项的功能性。
|
trait = honest
|-
| skill
| 否
| 在选项的左侧显示指定的技能。将鼠标悬停在其上会显示选项可用,因为你的该技能水平较高。这只是为了增加趣味性,实际上并不影响选项的功能。
|
skill = prowess
|-
| add_internal_flag
| 否
| 可以取值为“特殊(special)”或“危险(dangerous)”。值"special"将选项以黄色突出显示,"dangerous"则以红色突出显示。这只是为了增加趣味性,实际上并不影响选项的功能。
|
add_internal_flag = special


|-
|-
| highlight_portrait
| highlight_portrait
|
| No
| 当将光标悬停在此选项上时,高亮显示该角色的肖像。默认会对选项的效果所影响的角色的肖像高亮显示,此键值通常用于高亮其他的肖像。
| Highlights the event portrait of this character while this option is hovered. This is in addition to the automatic highlighting when hovering an event option that has an effect that affects portrait characters.
| highlight_portrait = scope:custom
| highlight_portrait = scope:custom
|-
| fallback
| 否
| 设为是(yes)的时候:如果其他选项都不能满足其触发器,即使此选项的触发器也未满足,它也将显示出来。你可以将此选项与 <code>trigger = { always = no }</code> 结合使用,以创建一个只作为最后手段显示的选项。
| fallback = yes
|-
| exclusive
| 否
| 如果选项标记为exclusive = yes并且满足了触发条件,它将是唯一显示的选项。如果多个选项被标记为exclusive = yes并且每个选项都满足了各自的触发条件,那么它们都会被显示。
| exclusive = yes
|-
| flavor
| 否
| 在选项的提示中显示的风味文本。风味可以是本地化键(loc key)或具有first_valid的动态描述。
| flavor = my_events.1001.a.flavor
|}
|}


== 后处理 ==
=== After ===
'''After''' 这是一个在事件完成并选择了一个选项后运行的效果脚本块。与[[#Immediate]]脚本块完全相同。如果事件没有选项(例如隐藏事件),则不会执行任何操作。<br>
This is a block of effect script that runs after the event has ran its course and an option has been chosen. Won't do anything if the event has no options (for hidden events, for example).
它最常用于清理任务,删除可能会在不打算时持续存在的变量、字符和其他类型的数据。<br>
举个例子,在事件 <code>fp2_struggle.2009</code> 《抓到神秘盗贼》(Catching Thieves of Myth) 中,<code>after</code>块用于检查是否有保存的范围(用作布尔值),以决定在事件结束后是否应该删除事件生成的角色。
<pre>
after = {
if = {
limit = { NOT = { exists = scope:fp2_2009_thief_permanence_scope } } # 如果存在,则作为布尔值为真
scope:fp2_2009_garduna_young_thief = { silent_disappearance_effect = yes } # 我们将年轻的小偷除掉,因为他对未来的事态已经不再有用。
}
}
</pre>
 
== 部件 ==
{{Expand|}} Widgets 有哪些部件,并给出截图
 
==  触发动作 (on_action) ==
On Actions(触发动作)是游戏代码调用时,每次执行特定动作(如孩子出生、角色继承土地或使用牵制)时运行的脚本。<br>
这允许模组制作者在调用相关的"On Actions"时,拦截并运行自己的脚本。<br>
触发动作分为两个主要类型:
# 从代码中调用的内容。
# 脚本中调用的内容。
 
这些 on_action 脚本有一点奇怪,因为它不允许追加效果和触发器,这使得创建一个具有良好兼容性的模组变得不可能。然而,你可以通过以下方式实现类似的效果:
<pre>
on_birth_child = {
on_actions = { # "on_action" 内的 "on_actions" 已经被追加,因此可以安全地使用下面表格中的现有 on_action。
on_action_my_on_action
}
}
on_action_my_on_action = {
trigger = { ... }
effect = {... }
}
</pre>
如果您编写的脚本如下所示,触发器和效果将不会追加,因此在修改相同的 on_actions 的模组之间可能会发生冲突:
<pre>
on_birth_child = { # 下表中的一个 on_action
trigger = { ... }
effect = {... } # 触发和效果被覆盖,而非追加。
}
</pre>
 
=== on_actions中的变量 ===
表格中的内容来自 ''/common/on_action/on_actions.info'' 文件.
{| class="wikitable"
|+
!名称
!描述
!可能的数据类型
!例子
|-
|trigger
|on_actions可以有触发器。如果一个on_action触发并且其触发器返回false,则什么都不会发生。
|boolean
|<pre>
trigger = {
trigger_conditions = yes
}
</pre>
|-
|weight_multiplier
|如果此项是随机动作列表中的候选项(请参见下文),则用于操作其权重。
|integer
|<pre>
weight_multiplier = {
base = 1
modifier = {
add = 1
trigger_conditions = yes
}
}
</pre>
|-
|events
|只要触发器的返回结果为真,"events"括号中列出的事件将会触发。
|
|<pre>
events = {
event_id_1
delay = { days = 365 } # 延迟意味着在延迟时间过去之后,所有列在其后的事件才会被触发。 注意:出于性能原因,只有在 on_action 执行时以及延迟完成后,事件才能成功触发。所有的触发条目都支持延迟,无论是用于事件还是 on_action。
event_id_2
delay = { months = { 6 12 } } # 设置新的延迟会覆盖之前的延迟。延迟支持随机范围。
event_id_3
}
</pre>
|-
|random_events
|选择一个事件进行触发。
|
|<pre>
random_events = { # 选择一个事件进行触发。
chance_to_happen = 25 # 一个几率决定是否会对所涉及的事件进行评估


chance_of_no_event = { # 一个可以格式化为脚本值的条目(因此可以具有条件条目)。出于性能原因,与“chance_to_happen”分开。仅在chance_to_happen为true时进行评估。
=== Widgets ===
value = 0
What types of widgets are there, with screenshots for each of what they look like.
if = {
limit = { trigger_conditions = yes }
add = 10
}
}


100 = event_id_1 # 数字是选择特定事件的权重。该权重受到事件的weight_multiplier条目的影响。(如果事件没有定义weight_multiplier,权重将为1)
== On_actions ==
200 = event_id_2
{{Expand‎|with=An explanation on what on_actions are, and how and for what they are used.}}
100 = 0 # 如果一个事件的条目为“0”,即使存在其他有效的事件,也有可能没有事件触发。这对于确保罕见事件不总是触发非常重要,因为其他可能的事件都无效。
On_actions are divided into two main types:
# Those that are called from code.
# Those that are called from script.


}
=== On_actions from code ===
</pre>
|-
|first_valid
|选择第一个使触发器返回 true 的事件。
|List<event>
|<pre>
first_valid = { # 选择第一个使触发器返回 true 的事件。
event_id_1
event_id_2
fallback_event_without_trigger
}
</pre>
|-
|on_actions
|一个 on_action 可以触发其他 on_action,遵循与事件相同的规则。
|List<on_action>
|<pre>
on_actions = { #一个 on_action 可以触发其他 on_action,遵循与事件相同的规则。
on_action_1
on_action_2
on_action_3
}
</pre>
|-
|random_on_actions
|就像事件一样,对于on_actions,它们也受其weight_multipliers的影响,该值默认为1。
|
|<pre>
random_on_actions = {
100 = on_action_1
200 = on_action_2
100 = 0
}
</pre>
|-
|first_valid_on_action
|
|List<on_action>
|<syntaxhighlight>
first_valid_on_action = {
on_action_1
on_action_2
}
</pre>
|-
|effect
|on_action可以运行效果(effect)。它可以访问与触发它的脚本链/代码功能相同的默认(default)范围或保存(saved)范围(scope)。请注意,它与on_action触发的事件同时发生,而不是在之前。此处运行的效果会创建一个与on_action触发的事件不同的链,因此您不能在效果中操作值,然后可靠地在同时触发的事件中访问这些值。在这里设置的范围或局部变量不会传递到由on_action触发的任何事件。
|
|<pre>
effect = {
effects = yes
}
 
</pre>
|-
|fallback
|on_actions 可以定义一个回退 on_action。如果没有事件或 on_actions 被 on_action 运行,就会调用回退。避免创建无限回退循环,否则可能会阻止游戏时间的推进!
|on_action
|<pre>
fallback = another_on_action
</pre>
|}
 
 
=== 来自代码的 On_actions ===
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="15%" | 名称
! width="15%" | Name
! width="15%" | 描述
! width="15%" | Description
! width="25%" | From code
! width="25%" | From code
! width="20%" | 预计作用域
! width="20%" | Expected scope
! width="20%" | 其他
! width="20%" | Other
|-
|-
|on_prestige_level_loss
|on_prestige_level_loss
第978行: 第593行:
|
|
|Yes
|Yes
|Casus belli
|Character
|
|
|-
|-
第1,271行: 第886行:
|
|
|Yes
|Yes
|Casus belli
|None
|
|
|-
|-
第1,455行: 第1,070行:
|}
|}


=== 脚本中的On_actions ===
=== On_actions from script ===
{{Expand‎}}
{{Expand‎}}


== 策略 ==
== Strategy ==
=== 触发事件 ===
=== Triggering the event ===
{{Expand‎}}
{{Expand‎}}
Should probably become its own page.
Should probably become its own page.
第1,467行: 第1,082行:
Pinging events, message events.
Pinging events, message events.


Other fancy ideas.
Other fancy ideas..


{{Modding navbox}}
{{Modding navbox}}
[[Category:模组制作]]
[[Category:模组制作]]
[[en:Event modding]]
[[en:Event modding]]
请注意您对十字军之王3百科的所有贡献都被认为是在知识共享署名-非商业性使用-相同方式共享下发布,请查看在十字军之王3百科:版权的细节。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源。 未经许可,请勿提交受版权保护的作品!

为防止机器编辑,请完成下方验证

取消 编辑帮助(在新窗口中打开)