Decision modding

本页面部分全部内容上次核对于3.0版本
自由之民讨论 | 贡献2022年3月8日 (二) 20:27的版本 (文本替换 - 替换“Category:Modding]]”为“Category:模组制作]]”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)


This page is about how to modify existing and how to create new Decisions.

Decisions are defined at common/decisions/xxx.txt.

Data Structure[编辑 | 编辑源代码]

  • owned_planets_only = <yes/no> - If yes, this decision can only be enacted on colonized planets. If no, this decision can be enacted on uncolonized planets within the empire's border.
  • sound - A reference to a sound effect entry that plays when this decision is enacted.
  • icon - A reference to a GFX entry or filename (without path and file extension if under gfx/interface/icons/decisions) that determines the icon of this decision.
  • enactment_time = <int> - Days until this decision is enacted. Default 0. If greater than 0, this decision will go through the planetary construction queue and can be canceled by removing from the queue. Otherwise, this decision will be immediately applied, bypassing the construction queue.
  • resources - An Economy Unit that determines the cost of this decision. Only the "cost" field is wanted.
  • prerequisites = { tech_xxx } - A list of Technology keys that determines the technology prerequisites of this decision.
  • potential - A block of Conditions that determines should this planet have this decision displayed. (Planet scope)
  • allow - A block of Conditions that determines can this decision be enacted on this planet. (Planet scope)
  • effect - A block of Effects to be executed on this planet when this decision is enacted. (Planet scope)
  • ai_weight - The higher it is, the more likely the AI will try to enact this decision.

Decisions do not have modifier fields containing Modifiers. Vanilla decisions implement this by adding Static Modifiers to and removing them from the planet.

Example[编辑 | 编辑源代码]

This is the decision "prospect".

decision_prospect = {
	owned_planets_only = yes

	enactment_time = 180
	resources = {
		category = decisions
		cost = {
			influence = 25
			energy = 500
		}
	}

	potential = {
		habitable_structure = no
		NOT = { is_planet_class = pc_machine }
		NOT = { is_planet_class = pc_hive }
		NOT = { is_planet_class = pc_city }
		owner = {
			has_swapped_tradition = tr_adaptability_finish
		}
		NOT = { has_planet_flag = planet_prospected }
	}

	effect = {
		custom_tooltip = decision_prospect_effects_short
		hidden_effect = {
			set_planet_flag = planet_prospected
			add_random_non_blocker_deposit = yes
			create_message = {
				type = MESSAGE_TYPE_PLANET_PROSPECTED
				localization = MESSAGE_PLANET_PROSPECTED
				days = 30
				target = this
				variable = {
					type = name
					localization = PLANET
					scope = this
				}
				variable = {
					type = name
					localization = DEPOSIT
					scope = last_added_deposit
				}
			}
		}
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0
			num_pops < 20
		}
	}
}

habitable_structure = no is a Scripted Trigger. See Dynamic modding for details.

Decisions On Uncolonized Planets[编辑 | 编辑源代码]

A decision with owned_planets_only = no can be enacted on any planet within the empire's border, not just those colonized.

Note that they would better have enactment_time = 0, or it could be a trouble: uncolonized planets do NOT have construction queues displayed in the UI and the player can't get informed of the enactment progress as well as they can't cancel the decision.

# this decision turns a barren planet into a terraforming candidate
decisions_on_uncolonized_planets_example = {
	owned_planets_only = no
	enactment_time = 0

	resources = {
		category = decisions
		cost = {
			energy = 10000
		}
	}

	potential = {
		# you would better make this strict enough or this can literally appear on every planet
		OR = {
			is_planet_class = pc_barren
			is_planet_class = pc_barren_cold
		}
		NOT = { has_modifier = terraforming_candidate }
	}

	effect = {
		add_modifier = {
			modifier = terraforming_candidate
			days = -1
		}
	}
}


帝国 帝国思潮政府 • 国民理念 • 起源承诺议程传统 • 飞升天赋法令政策遗珍科技自定义帝国
人口 岗位派系
领袖 领袖领袖特质
物种 物种物种特质
行星 行星行星特征 • 轨道矿藏建筑 • 区划行星决议
星系 星系恒星基地巨型结构虫洞 • 星门地图
舰队 舰队舰船 • 部件
地面战 陆军轰炸姿态
外交 外交 • 联邦 • 星海共同体评价修正宣战理由 • 战争目标
事件 事件异常现象特殊项目考古遗址
游玩 游玩定义研究 • 经济游戏开局
动态修改 动态指令效果触发条件作用域修正变量AI
媒体/本地化 Maya 导出器图形肖像旗帜事件图片界面图标音乐本地化
Other 控制台命令存档编辑Steam 创意工坊模组制作教程