Fleet modding

本页面部分全部内容上次核对于2.8版本
Pokewiz讨论 | 贡献2022年3月6日 (日) 23:28的版本 (merge from offical wiki)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)


This is a quick reference for the different aspects of scripting some fleet events, triggers etc.

Fleet Orders

The list of known fleet orders, used to define the current fleet action (i.e. has_fleet_order, used in Conditions).[1]

Order Description
aggressive_stance_fleet_order Fleet stance is aggressive
analyze_ftl_trail_order
assist_research_order Ship/fleet is going to assist research on planet
auto_explore_order Ship/fleet is going to automatically explore space
build_orbital_station_order Ship/fleet is going to construct any orbital, mining or research station
build_space_station_order Ship/fleet is going to construct a military station
collect_data_fleet_order Fleet is going to collect data from debris or ambient object
colonize_planet_order Ship is going to colonize a planet
combat_order
evade_hostiles_order
follow_order Ship/fleet is following the ship/fleet
merge_fleet_order Fleet is going to be merged
move_to_system_point_order Ship/fleet is moving to a point
land_armies_order Ship/fleet is going to land troops on planet
orbit_planet_order Ship/fleet is going to enter orbit of planet
rally_point_fleet_order Fleet is rallying to a point
research_anomaly_order Ship is going to research anomaly
return_fleet_order Fleet is returning
survey_planet_order Ship is going to survey planet
upgrade_design_fleet_order Ship/fleet is going to be upgraded
research_discovery_order
upgrade_design_at_starbase_fleet_order
upgrade_design_at_orbitable_fleet_order
repair_fleet_order Ship/fleet is going to be repaired
repair_ship_fleet_order Ship/fleet is going to be repaired
build_megastructure_fleet_order Fleet is going to construct a megastructure
destroy_planet_order Ship/fleet is going to destroy a planet
planet_killer_weapon_windup_order
planet_killer_weapon_fire_order
explore_bypass_order
use_bypass_order
jumpdrive_order
jumpdrive_windup
experimental_subspace_navigation_fleet_order
excavate_archaeological_site_fleet_order
  • italics orders - orders which are not studied or probably not working

Fleet Locking

Fleet could be locked by set_event_locked = yes effect.
This will prevent any orders to this fleet. Don't forget to unlock it later.

Code examples

Merge fleets
solar_system = {
	random_fleet_in_system = {
		limit = {
			is_ship_class = shipclass_military
			NOT = { is_same_value = root }
			owner = { is_same_empire = root.owner }
			fleet_power > 0
		}
		save_event_target_as = EXAMPLE_merge_fleet
	}
}
queue_actions = {
	find_random_fleet = {
		found_fleet = {
			merge_fleet = {
				target = event_target:EXAMPLE_merge_fleet
				allow_ftl = no
			}
		}
	}
}
  • Note: Vanilla doesn't use this (plain) command at all. Mods using this are e.q. "Aggressive Crisis Engine" and "A Deadly Tempest".
Change fleet leader on army/transport fleets.

As simple leader assign to transport fleets is not working (as to military fleets) and furthermore the documented scope from ships to army unexpectedly is not working (possible bug), there is a workaround to solve this supposed scope problem.[2]

# Just find the right army to the fleet to assign a leader to the appropriate army.
random_fleet_in_system = {
	limit = {
		exists = owner
		owner = { is_same_empire = event_target:EXAMPLE_empire }
		is_ship_class = shipclass_transport
		# NOT = { exists = leader }
	}
	owner = {
		random_owned_army = {
			limit = {
				exists = fleet
				fleet = { is_same_value = PREVPREVPREV }
				# NOT = { exists = leader }
			}
			assign_leader = event_target:EXAMPLE_leader
		}
	}
}
  • Note: Vanilla doesn't use this (plain) at all, e.q. mod using this is "Decentralized Empires (Regentmaker)".
"Jump" fleet to the scope

Transfers fleet to the selected scope.[3]

# Jumps to the capital scope.
fleet_event = {
    id = acemod_fleet.600
    hide_window = yes
    is_triggered_only = yes
    immediate = {
        set_location = {
            target = owner.capital_scope
            distance = 5
            angle = random
            direction = in_system
        }
        clear_orders = yes
        clear_fleet_actions = this
    }
}
Order colossus to fire on a planet in the same system[4]
solar_system = {
	random_system_planet = {
		limit = {
			has_planet_flag = shroud_target
		}
		save_event_target_as = killtarget
	}
}
queue_actions = {
	if = {
		limit = {
			exists = event_target:killtarget
			}
		clear_orders = yes
		clear_fleet_actions = THIS # Colossus fleet scope	
		find_closest_planet = {
			trigger = {
				id = schroud_target_1
				is_same_value = event_target:killtarget
			}
			found_planet = {
				move_to = this
				orbit_planet = this
				destroy_planet = this
			}
		}
	}
}

References

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