首页所有页面

游戏规则模组制作


Game rules are enumerated global values, that can only be modified at game start.

In their simplest form (on/off), they are similar to boolean global flags, but can get more complex (fewer/default/more).

The benefit of game rules is that they have a nice dedicated UI to manage the options at the start of a game, so there's less modding needed than using decisions.

Definition

Rules are defined in folder common/game_rules/. The format is:

<rule_name> = {
	name = LOCALIZATION_KEY_FOR_RULE_NAME
	group = LOCALIZATION_KEY_FOR_RULE_GROUP
	option = {
		name = <option1_name>
		text = LOCALIZATION_KEY_FOR_OPTION1_NAME
		desc = LOCALIZATION_KEY_FOR_OPTION1_DESC
	}
	option = {
		name = <option2_name>
		achievements = no #Optional
		text = LOCALIZATION_KEY_FOR_OPTION2_NAME
		desc = LOCALIZATION_KEY_FOR_OPTION2_DESC
	}
}

Notes:

  • The first option is the default one at game start.
  • If certain rule only makes sense to appear with a DLC, it can use dlc = "The Reaper's Due".
  • Each option can have achievements = yes/no. This doesn't make sense to be used for mods, as they already disable achievements by changing the checksum.
  • The same is true for alt_start_achievements = yes/no, which determines whether the option disables achievements when using alternate starts (shattered/randomised world). Defaults to yes even if achievements = no.
  • You can create custom rule group, for example group = "RULE_GROUP_MY_MOD".
  • Parameter "achievements = no" adds to LOCALIZATION_KEY_FOR_OPTION_DESC a red text " This option turns off achievements." (localisation key "RULE_ACHIEVEMENTS_WARNINGS" in ReapersDue.csv).
  • If you want a rule to have a different default value when using alternate starts, use alt_start_default = <option_name>.

Usage

Selected option of a rule can be compared from scripting via the condition has_game_rule = { name = <rule_name> value = <option_name> }.

Some vanilla rules are not used from scripting and modify hardcoded behavior, similar to defines, which is not possible for mods.

相关页面 (57)

ChecksumDefinesEU4转档器模组制作FlagGame rulesSteam创意工坊事件模组制作作用域修正内阁成员模组制作决议模组制作剧本模组制作单位模组制作历史模组制作另类开局模组制作图形模组制作地图外政权模组制作地图模组制作头衔模组制作奇观模组制作宗教模组制作定义宝物模组制作宣战理由模组制作家族模组制作小地图模组制作建筑模组制作指令控制台指令政体模组制作故障排除文化模组制作朝贡国类型模组制作本地化条件模组制作死亡模组制作法律模组制作特质模组制作界面模组制作疾病模组制作目标模组制作盾徽模组制作省份模组制作社团模组制作科技模组制作称号模组制作继承模组制作编辑游戏存档肖像模组制作脚本荣誉头衔模组制作血脉模组制作角色模组制作贸易路线模组制作音乐模组制作验证器