十字军之王3
ParaWikis
最新百科
都市天际线2百科
英雄无敌3百科
维多利亚3百科
奇妙探险队2百科
罪恶帝国百科
英白拉多:罗马百科
热门百科
群星百科
欧陆风云4百科
十字军之王2百科
十字军之王3百科
钢铁雄心4百科
维多利亚2百科
ParaWikis
申请建站
ParaWikis
ParaCommons
最近更改
随机页面
加入QQ群
工具
链入页面
相关更改
特殊页面
页面信息
页面值
帮助
译名手册
字词转换
编辑指南
编辑规范
练手沙盒
资助我们
×
欢迎访问十字军之王3百科!
注册一个账号
,一起参与编写吧!这里是
当前的工程
。
全站已采用新UI,任何使用上的问题请点击
这里
。欢迎所有对百科感兴趣的同学加入QQ群:
497888338
。
阅读
编辑
编辑源代码
查看历史
讨论
编辑“
触发器
”(章节)
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
== Trigger syntax == === Scope comparison === A scope comparison is a statement with two scopes on either side of an <code>=</code> sign. It is true if both objects are the same, and false otherwise. Scopes in a scope comparison can be database scopes, event targets, saved scopes or variables. Note: even if both scopes are not the same objects, they do need to be of the same scope type. Ex: this trigger checks whether whoever holds the kingdom of France is the same character as the father of the current character scope. <pre>title:k_france.holder = father</pre> In a scope comparison, both sides need to be valid. In this example, the current character must have a father, and the Kingdom of France must be created, otherwise the scope comparison throws an error in the error log, so the existence of both scopes needs to be checked at some point before the comparison is made. The existence of the scope on the left-hand side of the comparison itself by using <code>?=</code>: <pre>title:k_france.holder ?= father</pre> === Value comparison === A value comparison is a statement with two numerical values on either side of either * an equal sign <code>=</code> * a comparison symbol ** strictly greater than <code>></code> ** greater than or equal to <code>>=</code> ** lower than <code><</code> ** lower than or equal to <code><=</code> It is true if the comparison is mathematically correct. Numerical values in a value comparison can be: * a number * a named value * a [[script_value]] * a saved scope value * a [[variable]] storing a number Ex: this trigger checks whether the current character scope's gold is strictly greater than 1000. <pre>gold > 1000</pre> === Code triggers === Code triggers have a predetermined syntax. They usually require a specific scope type context to work. Code triggers can take several forms: ==== Basic triggers ==== Basic triggers check whether the statement has the expected positive or negative result. Ex: this trigger is true if the current character scope is ''not'' an AI. <code>is_ai = no</code> ==== Simple triggers ==== Simple triggers check whether they are true depending on the argument provided on the right hand side of the <code>=</code> sign. The argument is either: * a scope Ex: this trigger checks whether the current character scope is a vassal of the saved scope <code>scope:actor</code>. <pre>is_vassal_of = scope:actor</pre> * a database key Ex: this trigger checks whether the current character scope has the trait defined with the <code>infirm</code> key. <pre>has_trait = infirm</pre> ==== Complex triggers ==== Complex triggers use several parameters in a script block. Those parameters can be a scope, a database key, a numerical value or a flag value. Ex: this trigger checks whether the current character scope has an active scheme of the murder type targeting their liege. <pre>is_scheming_against = { target = liege type = murder }</pre> Some code triggers have both a simple form and a complex form. ==== In-line complex triggers ==== Some complex triggers can be written in one line to return a value. It is written in quotation marks, with the additional argument in brackets. For example, a script value would look like this:<syntaxhighlight lang="c"> distance_to_liege_sval = { value = "realm_to_title_distance_squared(liege.capital_county)" } </syntaxhighlight>This feature is not documented and doesn't work with all triggers. From testing, it seems to only support triggers with this line in their description: <code>Traits: <, <=, =, !=, >, >=</code> If a trigger has multiple arguments, like <code>has_trait_xp</code> which requires trait and track, they are added with a | <code>value = "has_trait_xp(lifestyle_traveler|danger)"</code> So far, this is the only known trigger with this multi-argument syntax. === scripted_triggers === Scripted_triggers are macros that enable replacing a set of triggers with a single statement, to make script more legible and avoid repetition. They are usually defined in <code>common/scripted_triggers</code>, and can then be used anywhere triggers are allowed. They are sometimes defined locally in event files (see [[events]]), in which case they can only be used in events from the same file. ==== Basic scripted_triggers ==== Simple scripted_triggers check whether a predetermined set of triggers is evaluated as a whole as true (<code>= yes</code>) or false (<code>= no</code>). Ex: if the following set of triggers is repeatedly used to check whether a character is a rich adult independent ruler: <pre>is_independent_ruler = yes is_adult = yes gold > 1000</pre> instead of repeating the same set of triggers in different places, they can be defined as a scripted_trigger: <pre>is_rich_adult_independent_ruler = { is_adult = yes is_independent_ruler = yes gold > 1000 }</pre> and anywhere that set of triggers needs to be checked, it can be replaced by the following statement: <code>is_rich_adult_independent_ruler = yes</code> Using the negative version <pre>is_rich_adult_independent_ruler = no</pre> is the same as using a <code>NOT</code> logic block <pre>NOT = { is_rich_adult_independent_ruler = yes }</pre> Because scripted_triggers can be used in a variety of different contexts, it is advised not to use in their definition ambiguous event targets such as <code>root</code> or <code>prev</code>. ==== Complex scripted_triggers ==== Scripted_triggers can also have a complex form that handles literal text replacement, allowing to pass arguments. For example, if the following set of triggers are used to check that the current character scope is a vassal of the King of France and related to them: <pre>is_vassal_of = title:k_france.holder is_close_family_of = title:k_france.holder</pre> that set of triggers can be defined as a scripted_trigger, but instead of referencing <code>title:k_france.holder</code> specifically, the scripted_trigger uses an argument defined in uppercase letters wrapped in two <code>$</code> signs: <pre>is_related_vassal_of = { is_vassal_of = $TARGET$ is_close_family_of = $TARGET$ }</pre> When used, the complex form of the scripted_trigger specifies what the expected argument is, by using the same name but without the <code>$</code> signs: <pre>is_related_vassal_of = { TARGET = title:k_france.holder }</pre> With that form, every occurrence of <code>$TARGET$</code> in the scripted_trigger will be ''literally'' replaced with the argument provided: the text replacement happens ''before'' the scripted_trigger is evaluated.
摘要:
请注意您对十字军之王3百科的所有贡献都被认为是在知识共享署名-非商业性使用-相同方式共享下发布,请查看在
十字军之王3百科:版权
的细节。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源。
未经许可,请勿提交受版权保护的作品!
为防止机器编辑,请完成下方验证
取消
编辑帮助
(在新窗口中打开)
×
登录
密码
记住登录
加入十字军之王3百科
忘记密码?
其他方式登录