群星
ParaWikis
Notice
: Undefined index: HTTP_ACCEPT_LANGUAGE in
/data/wwwroot/www.parawikis.com/skins/Liberty/LibertyTemplate.php
on line
185
最新百科
都市天际线2百科
英雄无敌3百科
维多利亚3百科
奇妙探险队2百科
罪恶帝国百科
英白拉多:罗马百科
热门百科
群星百科
欧陆风云4百科
十字军之王2百科
十字军之王3百科
钢铁雄心4百科
维多利亚2百科
ParaWikis
申请建站
ParaWikis
ParaCommons
最近更改
随机页面
加入QQ群
工具
链入页面
相关更改
特殊页面
页面信息
页面值
阅读
编辑
编辑源代码
查看历史
讨论
编辑“
AI modding
”(章节)
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
===Modifying ai_weight=== The main way to modify the ai_weight section is through use of a base <code>weight</code> flag and subsequent <code>modifier</code> blocks containing <code>factor</code> and <code>add</code> flags. The simplest way to start is with simply a single base weight, such as in the following example: ai_weight = { weight = 1.5 } In this example the entry that this is attached to would have a weight of 1.5. Depending on where exactly this is this weight can then be processed in a number of different ways, from highest value is chosen to a weighted randomized selection. Now to make this example more complex we can add some <code>modifier</code> blocks to it, for example: ai_weight = { weight = 1.5 modifier = { add = 1.5 has_ethic = ethic_authoritarian } modifier = { factor = 2 OR = { has_policy_flag = slavery_allowed has_ethic = ethic_fanatic_authoritarian } } } In order to determine what a final weight is the game engine starts at the top of the <code>ai_weight</code> entry, retrieves the starting weight, and then checks each of the <code>modifier</code> blocks ''in order''. So for example if an empire is an authoritarian with slavery enabled, then in the above example they begin with the starting weight of 1.5, add 1.5 to that for a weight of 3, and then multiply that value by a factor of 2 for a final value of 6. Be aware that stacking factors can lead to numbers quickly growing in size; a starting value of 5 that has a <code>factor = 2</code> applied a half dozen times can reach all of the way up to a value of 5 x 2 ^ 6 = 320, with each successive doubling increasing by drastically more than the previous! Also be aware that there is no requirement for numbers to remain positive; both <code>factor</code> and <code>add</code> will accept negative numbers and multiply or add them as expected. Like most other cases, multiple factors present in a single <code>modifier</code> block will default to an AND requirement, where all must be true in order to apply the factor. If an OR is desired then it will need to be added as in the example above. This can, however, allow for us to command AI's to not perform a certain decision in certain cases. For example, consider the example below: ai_weight = { weight = 1.5 modifier = { add = 1.5 has_ethic = ethic_authoritarian } modifier = { factor = 2 OR = { has_policy_flag = slavery_allowed has_ethic = ethic_fanatic_authoritarian } } modifier = { factor = 0 has_ethic = ethic_fanatic_egalitarian } } In this example we add a factor of 0 in the event that the AI is a fanatic egalitarian. Because 0 multiplied by any value is still 0, this means that an AI that meets that requirement will never perform the given action, no matter what other factors might apply. NOTE: Because <code>modifier</code> blocks are checked in order, if you multiply the weight by 0 and then later add to it is will result in a non-zero weight! Make sure that if you have any <code>add</code> modifiers in place that any 0 factors come after them in the code entries!
摘要:
请注意您对群星百科的所有贡献都被认为是在知识共享署名-非商业性使用-相同方式共享下发布,请查看在
群星百科:版权
的细节。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源。
未经许可,请勿提交受版权保护的作品!
为防止机器编辑,请完成下方验证
取消
编辑帮助
(在新窗口中打开)
×
登录
密码
记住登录
加入群星百科
忘记密码?
其他方式登录