群星
ParaWikis
最新百科
都市天际线2百科
英雄无敌3百科
维多利亚3百科
奇妙探险队2百科
罪恶帝国百科
英白拉多:罗马百科
热门百科
群星百科
欧陆风云4百科
十字军之王2百科
十字军之王3百科
钢铁雄心4百科
维多利亚2百科
ParaWikis
申请建站
ParaWikis
ParaCommons
最近更改
随机页面
加入QQ群
工具
链入页面
相关更改
特殊页面
页面信息
页面值
阅读
编辑
编辑源代码
查看历史
讨论
编辑“
动态模组创作
”(章节)
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
== Effects == Effects are statements to be executed and affect game status. Many game objects and [[event modding]] use this for dynamic effects. Head to effects for full list of effect statements. Effects must be executed under a [[scope]]. Head to scopes for details. === Scripted effects === There are more than singular statements of effects to be used for an effect. Scripted effects are moddable blocks of effect statements to be used as an effect. They are defined at "common/scripted_effects/xxx.txt". ==== How to use ==== A scripted effect consists a block of [[Effects|effect statements]] and/or other scripted effects. That's it. example_scripted_effect = { shift_ethic = ethic_materialist … } Defined scripted effects can be used as though they were effects. For instance, "example_scripted_effect" can be called with <code>example_scripted_effect = yes</code>. ==== Parameters ==== Scripted effects can have parameters. All parameters are strings and will be dynamically inserted into the scripted effects. For example, a scripted effect can be like this, so the empire will have their ethic shifted to materialist: # definition example_scripted_effect = { shift_ethic = ethic_$ETHIC$ } # calling example_scripted_effect = { ETHIC = materialist } Or even like this, so the empire will have their ethic shifted to materialist twice: # definition example_scripted_effect = { while = { count = $COUNT$ shift_ethic = ethic_$ETHIC$ } } # calling example_scripted_effect = { ETHIC = materialist COUNT = 2 } ==== Parameter conditions ==== You can also write a condition block for parameters with "double" square brackets, making the stuff within it only called if the parameter (here $homeworld$) is passed through in the effect call. <pre>[[homeworld] <<<STUFF HERE>>>]</pre> Example: <pre> last_created_species = { save_global_event_target_as = vaadwaurSpecies [[homeworld]set_species_homeworld = event_target:tempHomeworld] } </pre> You can also declare a fallback value in the parameter itself using the pipe symbol, e.g.: <pre> has_global_flag = crisis_stage_$STAGE|1$</pre> The vanilla game ([[2.6|2.6]]) does not yet use much of this scripted syntax feature (introduced in [[Patch 2.3 版本|2.3]]). Only few examples can be found in: common/scripted_effects/archaeology_event_effects.txt common/scripted_triggers/00_scripted_triggers.txt Instead, [[Star_Trek_New_Civilisations|Star Trek]] mods like "New Civilisations" use this feature a little more often. ==== Inline math ==== Scripted effects and scripted triggers can also have <code><nowiki>@\[ ... ]</nowiki></code>, a simple inline math statement. <pre> inline_math_example = { add_monthly_resource_mult = { resource = unity value = $COUNT|1$ min = @\[ $COUNT|1$ * 10 ] max = 99999999 } } </pre> This scripted effect will give the scoped empire X times their monthly unity income (up to 99,999,999 and down to X * 10), where X is the parameter given as COUNT. For example, <code>inline_math_example = { COUNT = 10 }</code> gives the scoped empire 10 times their monthly unity income (up to 99,999,999 and down to 100). Inline math has a drawback. Only the '''FIRST''' <code><nowiki>@\[ ... ]</nowiki></code> statement in a scripted effect / trigger is correctly recognized and evaluated. If multiple inline math statements is needed anyway, create multiple scripted effects that call each other. To the authoring of this entry there are 4 known functional operators for inline math statements: ;“+” :Adds the number on the right to the number on the left. ;“-” :Subtracts the number on the right from the number on the left. ;“*” :Multiplies the number on the left by the number on the right. ;“/” :Divides the number on the left by the number on the right. Any other attempted operator such as a <nowiki>=</nowiki> or <nowiki>^</nowiki> will result in the joining of the two sides. For example, if the statement <nowiki>@\[ 4 = 2 ]</nowiki> is ran, the resultant will be 42 to the effect. <pre> # If <condition A> is true, give the scoped empire twice the monthly unity income, otherwise once the monthly unity income. # If <condition B> is true, unity gained this way is reduced by -25%. inline_math_drawback = { if = { limit = { <condition A> } inline_math_drawback_step_2 = { COUNT = 2 } } else = { inline_math_drawback_step_2 = { COUNT = 1 } } } inline_math_drawback_step_2 = { if = { limit = { <condition B> } inline_math_drawback_step_3 = { COUNT = $COUNT$ MULT = 0.75 } } else = { inline_math_drawback_step_3 = { COUNT = $COUNT$ MULT = 1.0 } } } inline_math_drawback_step_3 = { inline_math_drawback_step_4 = { RESOURCE = unity COUNT = @\[ $COUNT$ * $MULT$ ] } } inline_math_drawback_step_4 = { add_monthly_resource_mult = { resource = $RESOURCE$ value = $COUNT$ min = @\[ $COUNT$ * 100 ] max = 100000000 } } </pre> It should be noted however that if multiple inline math statements are required for your code you will have to execute them in a manner of one per scripted effect call. It is however possible to send an inline math statement as a parameter by wrapping it in a pair of quotations <code><nowiki>"@\[ ... ]"</nowiki></code>. Wrapping an inline math statement will allow for a scripted event to use multiple inline statements so long as the statements are a parameter to another effect, although it cannot send more than one statement as a parameter to an effect. <pre> # If <condition A> is true, give the scoped empire twice the unity income, otherwise once a static unity income. # If <condition B> is true, unity gained this way is reduced by -25%. inline_math_effect = { if = { limit = { <condition A> } inline_math_drawback_step_2 = { COUNT = 2 } } else = { inline_math_drawback_step_2 = { COUNT = 1 } } } inline_math_drawback_step_2 = { # These inline statements won't run here allowing us to pick and chose which one we want, but it will autofill the $COUNT$ parameter in this statement. if = { limit = { <condition B> } inline_math_drawback_step_3 = { Resource = unity Value = "@\[ $COUNT$ * 0.75 * 500]" } } else = { inline_math_drawback_step_3 = { Resource = unity Value = "@\[ $COUNT$ * 500]" } } } inline_math_drawback_step_3 = { add_resource = { $Resource$ = $Value$ } } </pre>
摘要:
请注意您对群星百科的所有贡献都被认为是在知识共享署名-非商业性使用-相同方式共享下发布,请查看在
群星百科:版权
的细节。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源。
未经许可,请勿提交受版权保护的作品!
为防止机器编辑,请完成下方验证
取消
编辑帮助
(在新窗口中打开)
×
登录
密码
记住登录
加入群星百科
忘记密码?
其他方式登录