首页所有页面

决议模组制作


Decisions 这些是玩家或AI可选的行动,会出现在外交或阴谋界面(取决于类型)。

Decisions are different from events,触发时玩家无法控制。复杂的决策通常会引发一连串事件。

Decisions need to be in the /decisions/ folder.

Intrigue decisions

Decisions in the intrigue screen

Intrigue decisions are declared inside a block decisions = { } or plot_decisions = { }, and are shown in the Intrigue view.

它们按决策文件夹中按字母顺序加载的顺序出现。

请注意,决策非常微妙:任何语法错误或未识别的关键词都会破坏决策,导致章节标题在阴谋界面中显示不佳。

Special scopes:

  • ROOT is the decision taker

Structure

<decision_name> = {

  is_high_prio = yes # Will show an alert once decision is enabled

  ai_check_interval = 12 # Determines how seldom the AI checks whether they can and should do the decision, in months. By default 1 (every month).

  potential = {

    #Conditions for the decision to appear

  }

  allow = {

    #Conditions for the decision to be enabled

  }

  effect = {

    #Commands executed when taking the decision

  }

  ai_will_do = {

    #Factors for an AI character to take the decision (1 = 100% chance)

  }

}

Localization

  • decision_name: label displayed in intrigue tab
  • decision_name_desc: tooltip when hovering the decision
  • decision_name_desc_extra:可选参数,文本显示于决策提示中的需求部分后

Icon

要定义决策图标,你需要一个带有名称的精灵类型GFX_decision_name in a .gfx file inside interface/ folder.

Vanilla decision icons are 28px x 28px DDS 带有透明背景的文件,图标本身为24px x 20px,边框为2px黑色边框。

spriteTypes = {

  ...

  spriteType = {

    name = "GFX_decision_name"

    texturefile = "gfx\\interface\\decision_icon.dds"

  }

  ...

}

Dynasty and Vassal decisions


这些决策在阴谋菜单中每个王朝或附庸都会出现一次,虽然被针对性决策半多余,但如果愿意,仍然可以使用。请记住,附庸不一定意味着直接附庸,可以是任何人,就像普通的决定,但每个人出现一次。

They are declared inside a block vassal_decisions = { } or dynasty_decisions = { }, and are shown in the Intrigue view.

Special scopes:

  • FROM is the decision taker
  • ROOT is the decision target

Structure

decision_name = {

  is_high_prio = yes # Will show an alert once decision is enabled

  ai_check_interval = 12 # Determines how seldom the AI checks whether they can and should do the decision, in months. By default 1 (every month).

  from_potential = {

    #Conditions on the decision taker for the decision to appear

  potential = {

    #Conditions on the vassal or dynasty member for the decision to appear

  }

  allow = {

    #Conditions for the decision to be enabled

  }

  effect = {

    #Commands executed when taking the decision

  }

  revoke_allowed = {

    always = no #Not used in vanilla

  }

  ai_will_do = {

    #Factors for an AI character to take the decision (1 = 100% chance)

  }

}

Localization

  • decision_name: label displayed in intrigue tab
  • decision_name_desc: tooltip when hovering the decision

Icon

要定义决策图标,你需要一个带有名称的精灵类型GFX_decision_name in a .gfx file inside the interface/ folder.

Vanilla decision icons are 28px x 28px DDS 带有透明背景的文件,图标本身为24px x 20px,边框为2px黑色边框。

spriteTypes = {

  ...

  spriteType = {

    name = "GFX_decision_name"

    texturefile = "gfx\\interface\\decision_icon.dds"

  }

  ...

}

Targeted decisions

Targeted decisions will appear in a character diplomacy menu

Targeted decisions are declared inside a block targeted_decisions = { } or targetted_decisions = { } (任一都可以),并且会显示在外交视图中。注意,在technology.txt中加入带有add_decision的定向决策似乎会让无落地角色无法使用该决策。

Special scopes:

  • FROM is the decision taker
  • ROOT is the targeted character

In order to limit CPU load, filter and ai_target_filter 指定目标角色类型(分别针对玩家/人工智能),其中 potential and allow blocks will be evaluated:

  • self: self 必须仅针对做者决策设置
  • spouse: decision taker spouses
  • court:所有决策者主持法庭的角色,包括囚犯,以及目前离开的角色(监护人、囚犯等),不包括决策者本人
  • home_court:所有决策者主场中的角色,包括囚犯,以及目前外出的角色(监护人、囚犯等),不包括决策者本人
  • liege: direct liege of the decision taker
  • vassals: direct vassal rulers of the decision taker employer
  • sub_realm:所有在决策者雇主以下的角色,不包括决策者本人
  • realm:所有角色都与决策者处于同一顶级领域,不包括决策者本人
  • dynasty:所有成员均属同一王朝,不包括决策者本人
  • close_relatives: Includes children, grandchildren, parents, siblings, and nieces/nephews
  • rivals: 决策者对手以及任何带有“犯罪=是”的观点修正符的角色(即“is_foe”触发时评估的角色集合)
  • friends: decision taker's friends
  • liege: the decision taker's liege, unless independent
  • religious_head:决策者的宗教领袖,除非他们是自己宗教的领袖
  • society:与决策者处于同一社会中的角色,不包括决策者本人。
  • vassal_wars: All vassals' wars
  • independent_rulers: All independent rulers
  • all: all living characters (to be avoided, very CPU heavy !)
  • none:没人。主要用来禁止AI使用决策

Additionally, all, court, home_court, sub_realm, realm, dynasty, independent_rulers and society have "_including_me" versions (e.g. court_including_me) which also include the decision taker.

Structure

decision_name = {

  is_high_prio = yes # Will show an alert if special action is available

  ai_check_interval = 12 # Determines how seldom the AI checks whether they can and should do the decision, in months. By default 1 (every month).

  filter = sub_realm #Filter characters targeted by the player

  from_potential = {

    #Conditions on the decision taker for the decision to appear. Not taken into account when filter = self, use potential instead.

  }

  potential = {

    #Conditions on the targeted character for the decision to appear

  }

  allow = {

    #Conditions for the decision to be enabled

  }

  effect = {

    #Commands executed when taking the decision

  }

  revoke_allowed = {

    always = no #Not used in vanilla

  }

  ai_will_do = {

    #Factors for an AI character to take the decision (1 = 100% chance every month - for each allowed target!)

  }

  ai_acceptance = {

    # See below  

  }

}

AI acceptance

AI接受是一个可选部分,用于指定决策,用以表示AI是否接受该决定。注意,AI的反应不受该系统影响;它旨在向玩家传达结果。脚本作者必须让AI按照显示的“是”或“也许”来行动。只有“不”才是机械效果,完全阻止了决策。

If ai_acceptance 定义后,AI接受度会反映在决策中,类似于许多互动的表现。如果得分低于或等于零,“做吧!”按钮将变灰。精确值会被保存到本地变量中 local_ai_acceptance_score,类似于第三方分数的保存方式。即使有 show_maybe_for_human is used.

An example AI acceptance section:

ai_acceptance = {

	factor = 10 # The base score

	yes_threshold = 50 # At what point to switch from "maybe" to "yes". Defaults to 0, meaning it will never be "maybe"

	show_maybe_for_human = no # Whether to always show "maybe" for human targets (defined as ROOT being controlled by a player). Defaults to "yes"

	additive_modifier = { # Any type of modifier can be used, but "additive" is recommended as it is the most intuitive to the end user. Works same way as MTTHs, ai_will_do, and so on

		value = 10

		always = yes

	}

	additive_modifier = {

		value = -10

		always = yes

	}

	additive_modifier = {

		value = -10

		always = no

	}

	additive_modifier = {

		value = -100

		localisation_key = "REASON_WEALTH"

		wealth = 1000

	}

}

Localization

  • decision_name: label in diplomacy menu
  • decision_name_desc:选择动作时显示标签。[Root.GetTitledFirstName] 可用于显示目标名称。

Settlement decisions

定居点决策对所有定居点都可行,且显示在定居点外交视图中,而非阴谋视图。它们被宣布在一个区块内 settlement_decisions = { } 并采用与有针对性决策相同的结构和本地化。

Special scopes:

  • FROM is the decision taker
  • ROOT is the targeted settlement

In order to limit CPU load, filter / ai_target_filter 指定目标定居点类型(分别针对玩家/AI),其中 potential and allow blocks will be evaluated:

  • capital: decision taker's capital
  • owned: all settlements owned by the character
  • vassal_owned:所有由角色雇主直接附庸拥有的定居点
  • sub_realm_owned: all settlements below the character's employer
  • realm_owned:所有与该角色同一顶级服务器的定居点
  • dynasty_owned:所有定居点均由同一王朝的角色拥有
  • all: all settlements (to be avoided, very CPU heavy!)

Similarly there are also trade_post_decisions = { }, fort_decisions = { }, and hospital_decisions = { }.

Title decisions

头衔决策对所有头衔都可行,且显示在头衔外交视图中,而非阴谋视图。它们被宣布在一个区块内 title_decisions = { }

Special scopes:

  • FROM is the decision taker
  • ROOT is the targeted title

In order to limit CPU load, filter / ai_target_filter 指定目标定居点类型(分别针对玩家/AI),其中 potential and allow blocks will be evaluated:

  • capital: decision taker's capital
  • primary_title
  • owned: all titles owned by the character
  • vassal_owned:所有头衔均归角色雇主的直接附庸统治者所有
  • sub_realm_owned: all titles below the character's employer
  • realm_owned:所有头衔都与该角色处于同一顶级领域
  • dynasty_owned:所有头衔均由同一王朝成员拥有
  • all: all titles (to be avoided, very CPU heavy!)

Society Decisions

2.7补丁中加入。社团决策在区块内宣布 society_decisions = { }.他们只会被评估在任何社会中的角色。它们可以用来让不同社会的成员也能获得相同的决策。除此之外,它们与普通车完全相同 Decision.

Offmap Decisions

In Patch 2.8, offmap powers 通过独特的地图外能力界面激活的决策。

与社会决策类似,这些决策被自身的决定包围 offmap_decisions = { } 阻挡,几乎与标准决策相同。 然而,offmap_decisions也有一个唯一的参数, button_name,对应于定义在 buttons section of an offmap power:

offmap_decisions = {



<decision_name> = {

	button_name = offmap_gifts

	

	ai_check_interval = 12

	is_high_prio = yes



	potential = {

		#Conditions for the decision to appear

	}

	allow = {

		#Conditions for the decision to be enabled

	}

	effect = {

		#Commands executed when taking the decision

	}

	ai_will_do = {

		#Factors for an AI character to take the decision (1 = 100% chance)

	}

}



}

按钮名称已本地化,但本地化键必须在三个文件中保持一致:在地图外电源、offmap_decision和对应的图形界面文件中。

地图外的决策也可以由第三方决定,详见下文。

Third Parties

Since Patch 2.8,需要目标的决策也可以选择第二个目标,而第二个目标将成为第三方。这适用于目标、地图外、定居点和头衔决策,但通常只用于前两个。

Additional special scope:

  • FROMFROM is the third party

third_party_filter and ai_third_party_filter use the same syntax filter and ai_target_filter in targeted decisions do, as well as an additional artifacts filter.

They can take one more parameter, third_party_score = { }.内窥镜会根据该分数排序,结果会是 variable, stored as local_third_party_score. The base value can be defined with factor = #Base value, then it is possible to modify it with modifier = { } and additive_modifier = { }.

Structure

decision_name = {

  # other parameters

  third_party_filter = court #Filter for applicable third parties

  ai_third_party_filter = court #Filter for third party characters selected by the AI

  third_party = ROOT # Determine which scope the third party should be filtered from.  Defaults to FROM

  show_third_party_potential = yes #Set to show third party requirements in the tooltip. Defaults to no.

  third_party_potential = {

    #Conditions for a third party character to be included in the list

  }

  third_party_allow = {

    #Conditions on the selected third party for the "Send" button to be enabled

  }

  third_party_score = {

    #Factors to determine how "good" a third party character is for the decision.  Determines sorting.

    #This score is stored in the variable "local_third_party_score", so it can be used in triggers and effect

    factor = #Base value

    additive_modifier = {

      value = #Value to add to current

      #Conditions

    }

    #More additive_modifier

    modifier = {

      factor = #Factor to multiply the value

      #Conditions

    }

    #More modifier

  }

  effect = {

    #Commands executed when taking the decision

  }

}

Pre-triggers

Pre-triggers or fast triggers are special conditions 决策的根源是,如果决策未达成前触发条件,AI可以快速退出评估,而无需评估触发块。[1][2] 建议尽可能使用这些信息,以减少AI评估决策的时间。注意,预触发目前只适用于AI,不适用于玩家。

预触发次数没有限制,除了每种只有一个。

Warning: 有些预触发症状的名称与正常状态不同!

The following decision pre-triggers currently exist for decisions:

Pre-trigger Type Scope Description Equivalent trigger
only_playable bool character 在脚本中,“可操作”并不意味着玩家真的能操作该角色。意思是:伯爵等级或以上,或者贵族阶层,不是无地的叛乱者。使用这个预触发完全消除了对不符合条件的事件评估,意味着事件会针对游戏中约1000名可玩角色进行检查,而非全部约2万名 is_playable
only_rulers bool character Excludes untitled characters. This is a lesser version of only_playable,因为它包括男爵、叛乱者等(即任何拥有头衔的人)。 is_ruler
only_independent bool character Excludes vassals and tributaries. Implies only_playable. independent
is_in_society bool character 排除不属于某个社会(= 是)或不属于某个社会的角色(= 不属于)。 is_in_society
ai = no bool character 排除所有非玩家角色的决策。在2.8补丁中加入。 ai = no

See also

相关页面 (65)

ConditionsDDSDecisionEU4转档器模组制作Event moddingLaw moddingLocalizationModifiersOffmap power moddingPatch 2.8ScopeScopesSteam创意工坊Variable事件模组制作作用域修正内阁成员模组制作剧本模组制作单位模组制作历史模组制作另类开局模组制作图形模组制作地图外政权模组制作地图模组制作头衔模组制作奇观模组制作宗教模组制作定义宝物模组制作宣战理由模组制作家族模组制作小地图模组制作建筑模组制作指令控制台指令政体模组制作故障排除文化模组制作朝贡国类型模组制作本地化条件模组制作死亡模组制作法律模组制作游戏规则模组制作特质模组制作界面模组制作疾病模组制作目标模组制作盾徽模组制作省份模组制作社团模组制作科技模组制作称号模组制作继承模组制作编辑游戏存档肖像模组制作脚本荣誉头衔模组制作