Army modding

本頁面部分全部內容上次核對於3.0版本


This page is about modding Armies.

Data Structure[編輯 | 編輯原始碼]

Armies are defined at "common/armies/xxx.txt".

  • icon_frame = <int> - The icon index this army uses in the shared icon file of all armies (gfx\interface\planetview\army_icon.dds).
  • damage = <float> - Multiplies the damage. Final damage is: 1.5-3.0 * damage
  • health = <float> - Multiplies the health. Final health is: 200 * health
  • morale = <float> - Multiplies the morale. Final morale is: 200 * morale
  • morale_damage = <float> - Multiplies the morale damage. Final morale damage is: 1.5-3.0 * damage * morale_damage.
  • has_morale = <yes/no> - If no, this army has no morale as well as they are not affected by morale damage. They can still deal morale damage.
  • collateral_damage = <float> - During a ground combat, the higher the collateral damage is, the more planetary devastation and the higher the chance of pop kills the army will inflict.
  • war_exhaustion = <float> - Multiplies the war exhaustion gained due to having this army killed. Vanilla defense armies always have 0.
  • time = <int> - Days it takes to build this army.
  • resources - An Economy Unit that determines the cost and upkeep of this army.
  • has_species = <yes/no> - Determines do this army have a species. If yes, this army is counted towards the assault army clause: an empire can't build more assault armies than the number of pops of that species that empire has. If no, this army is never counted towards any clauses, but it will also not benefit from army enhancing species traits like 強壯 Strong 強壯Strong.
  • pop_limited = <yes/no> - If yes, this army is not counted towards any clauses even if it has has_species = yes. Used for 複製人部隊 Clone Army 複製人部隊Clone Army.
  • defensive = <yes/no> - If yes, this army can't be transported.
  • is_pop_spawned = <yes/no> - If yes, this army can't be built, instead it's used for defense army spawning jobs such as 士兵 Soldier 士兵Soldier.
  • occupation = <yes/no> - If yes, this army can't be built, instead it's spawned on each captured planet.
  • potential & allow - Blocks of Conditions to determine if this army is listed / can be built on a planet. If is_pop_spawned = yes or occupation = yes, instead these blocks are determined should a pop spawn this kind of army. (Planet scope; FROM = species if army has species)
  • on_queued & on_unqueued - Blocks of Effects to be executed under the planet scope when this army is added to / removed from the planetary construction queue. (Planet scope)
  • rebel = <yes/no> - Marks this army a rebel army.
  • prerequisites = { tech_xxx } - A list of technology keys to determine the technological prerequisites of this army.
  • show_tech_unlock_if - A block of Conditions. If evaluated false, this army is hidden from the tooltips of the prerequisite techs. (Country scope)

Examples[編輯 | 編輯原始碼]

Example: Assault Army[編輯 | 編輯原始碼]

# Assault Armies
assault_army = {
	damage = 1.00
	health = 1.00
	morale = 1.00
	morale_damage = 1.00
	collateral_damage = 1.00
	war_exhaustion = 1.00
	time = 90
	icon_frame = 2
	prerequisites = { "tech_assault_armies" }
	resources = {
		category = armies
		cost = {
			minerals = 100
		}

		upkeep = {
			energy = 1
		}
	}

	show_tech_unlock_if = { 
		OR = {
			NOT = { has_authority = auth_machine_intelligence }
			has_valid_civic = civic_machine_assimilator
		}
	}
	potential = {
		from = {
			NOR = {
				has_trait = "trait_mechanical"
				has_trait = "trait_machine_unit"
				is_sapient = no
			}
		}
		owner = {
			OR = {
				NOT = { has_authority = auth_machine_intelligence }
				has_valid_civic = civic_machine_assimilator
			}
		}
	}
}

Example: Job Spawned Defense Army[編輯 | 編輯原始碼]

# Defense Armies
defense_army = {
	defensive = yes
	is_pop_spawned = yes
	health = 1.25
	damage = 1.50
	morale = 1.25
	collateral_damage = 0.0
	war_exhaustion = 0.0 # No WE from defense armies
	icon_frame = 1
		
	potential = {
		from = {
			NOR = {
				has_trait = "trait_mechanical"
				has_trait = "trait_machine_unit"
				is_sapient = no
			}
		}
		owner = {
			is_primitive = no
			OR = {
				NOT = { has_authority = auth_machine_intelligence }
				has_valid_civic = civic_machine_assimilator
			}
		}
	}
}

Example: Count-Limited Event Army[編輯 | 編輯原始碼]

# Titanic life troops
# Can build on planets with titanic life if you get event + special project there
# Should be very strong and quite expensive, but cannot get attachments and can be built only in limited numbers
# Currently limited to 3. Ideally it would be X * Num of planets you have done the project one, but that is too complex for scripts
titanic_assault_army = {
	damage = 3.0
	health = 5.0
	morale = 3.0
	morale_damage = 2.0
	collateral_damage = 3.0
	war_exhaustion = 2.0
	time = 90
	icon_frame = 8
	has_species = no

	resources = {
		category = armies
		cost = {
			minerals = 300
		}

		upkeep = {
			energy = 1
		}
	}

	potential = {
		custom_tooltip = {
			text = titanic_troop_limit_tooltip
			planet = { has_planet_flag = titanic_life_can_build }
			owner = {
				has_country_flag = titanic_life_soldiers
			}
		}
	}
	
	allow = {
		custom_tooltip = {
			text = titanic_troop_limit_tooltip
			planet = { has_planet_flag = titanic_life_can_build }
			owner = {
				has_country_flag = titanic_life_soldiers
				NOT = { 
					 check_variable = {
						which = "titanic_life_soldier_count" 
						value = 3
					}
				}
			}
		}
	}
	
	on_queued = {
		owner = {
			change_variable = {
				which = "titanic_life_soldier_count" 
				value = 1
			}
		}
	}
	
	on_unqueued = {
		owner = {
			change_variable = {
				which = "titanic_life_soldier_count" 
				value = -1
			}
		}
	}
}

Example: NPC Only Army[編輯 | 編輯原始碼]

# Rampaging Tree Armies
tree_army = {
	defensive = yes
	damage = 1.0
	morale_damage = 1.0
	health = 1.0
	has_morale = no
	icon_frame = 8
	has_species = no
	
	potential = {
		always = no
	}
}
帝國 帝國思潮政府 • 國民理念 • 起源承諾議程傳統 • 飛升天賦法令政策遺珍科技自定義帝國
人口 崗位派系
領袖 領袖領袖特質
物種 物種物種特質
行星 行星行星特徵 • 軌道礦藏建築 • 區劃行星決議
星系 星系恆星基地巨型結構蟲洞 • 星門地圖
艦隊 艦隊艦船 • 部件
地面戰 陸軍轟炸姿態
外交 外交 • 聯邦 • 星海共同體評價修正宣戰理由 • 戰爭目標
事件 事件異常現象特殊項目考古遺址
遊玩 遊玩定義研究 • 經濟遊戲開局
動態修改 動態指令效果觸發條件作用域修正變量AI
媒體/本地化 Maya 導出器圖形肖像旗幟事件圖片界面圖標音樂本地化
Other 控制台命令存檔編輯Steam 創意工坊模組製作教程