控制台指令

本页面讲述的内容长期有效
傻狗本狗~讨论 | 贡献2020年11月28日 (六) 15:45的版本

本页面列出了游戏中可以在控制台输入的指令,你可以在非铁人模式的单人游戏中使用键盘上的 ~ (按键因键盘布局不同而存在变化)。键盘上的上下箭头可以遍历之前输入执行的指令。绝大部分指令的开关是通过再次输入实现的,但关闭某些指令是需要保存退出或重新开始游戏的。请注意,这些指令中有许多会随着 DLC 的开启和关闭导致其中一些不能正常发挥作用。

请注意,铁人模式中无法使用控制台!

指令列表

使用 ⇧Shift + 2~`^⇧Shift + 2 + 1⇧Shift + 3 来开启控制台 (按键因键盘布局不同而存在变化)。

国家代码

参见:Countries

国家的 tags[1] 不区分大小写,但通常是大写的。例如:USA, CHI, ENG, SOV。在内战中产生的国家将依据可用性被赋予D01、D02、D03及以后的范围的 tag (注意, D50 是最大的可用tag)。

您可以通过输入“tdebug”并将鼠标悬停在您想知道的国家的省份上,来查看该国家的 tag 。

常用指令

Command Effect Example/Comment
gain_xp [<amount>] 向选定的领导人/陆军将领/海军上将增加经验值 gain_xp 100000(等级最高为 9 级)。也可用来添加将领特性,例如:gain_xp desert_fox(相应列表可以在你 ../localisation/traits_l_english.yml 的文件中找到。这里有一些对相应解释。)
gain_xp [<trait>] 向选定的领导人/陆军将领/海军上将添加可获取的特性。 例如:gain_xp seawolf (相应列表可以在你 ../localisation/traits_l_english.yml 的文件中找到。这里有一些对相应解释。)

注意 要让这在新征募的通用海军上将上生效:
1. 使用文本编辑器打开 'Documents\Paradox Interactive\Hearts of Iron IV\settings.txt' ,并将 'save_as_binary=yes' 修改为 'save_as_binary=no'。
2. 打开游戏,载入存档并另存为一个新文件,然后退出游戏。
3. 打开 'Documents\Paradox Interactive\Hearts of Iron IV\Save Games' ,打开新创建的存档文件,搜索(CTRL-F)你征募的通用海军上将的名字
4. 在 max_traits=0.000 下面几行添加下列代码块
in_progress={
seawolf=0.000
superior_tactician=0.000
spotter=0.000
fly_swatter=0.000
ironside=0.000
air_controller=0.000
}

5. 确保存储文件时使用了 ANSI 编码格式。
6. 开始游戏,载入存档,使用 gain_xp 指令,享受吧。
(可以选择在 settings.txt 里重新开启二进制化)

cp [<amount>] 增加指挥点数 cp 100 (上限为 100)
st [<amount>] 增加稳定度 st 100 (上限为 100)
ws [<amount>] 增加战争支持度 ws 100 (上限为 100)
allowtraits 允许自由添加将领特性
add_equipment(ae) [<equipment amount>] [<equipment name>] 增加装备 装备要用最基础的名字,所以用 'ae 1000 infantry_equipment_1'。你只能添加已研究了的装备。不支持添加海军装备。(运输船除外: 'ae 1000 convoy_1')。要添加舰船,考虑使用 instantconstruction(ic 对 AI 也会起作用)。

要添加衍生型装备,你必须要指定它的名字。例子:你创建了 'Matilda LP' 型坦克的衍生型,拥有更好的装甲和主炮,并把它命名为 'Matilda LP Mk. IV'。 现在就要使用 'add_equipment 1000 Matilda LP Mk. IV'了。

add_latest_equipment(ale) [<equipment amount>] 给予玩家一定量的最新装备 要添加你最新装备中指定的一种,你需要指定它的名字。例子:你创建了 'Matilda LP' 型坦克的衍生型,拥有更好的装甲和主炮,并把它命名为 'Matilda LP Mk. IV'。

现在就要使用 'add_equipment 1000 Matilda LP Mk. IV'了。

whitepeace(wp) [<country tags>] 指定的国家之间白和。
teleport(tp) 瞬间移动 可以传送军队到你选择的任何地方
allowdiplo adiplo,nocb 无论规则如何,可以使用所有的外交行动。(无需正当化就可以宣战) 这应该是想开战而需等待正当化最有效率的方式。如果你只想立刻正当化而不是想做正当化后才能做的事,那就用(instant_wargoal)。
debug_nuking 无需任何条件向所有的世界上所有的省份投放核弹
instantconstruction 开关立刻建造的作弊码。 对 AI 有效。舰船也会立刻建造完成。
event [event id] [<Target Country Tag>] 触发一个事件 event political.3 触发共产主义政变 6 触发民主主义 9 触发法西斯主义
trigger [scripted_trigger_name] 检查一个脚本触发器的值是否为真或假
effect [scripted_effect_name] 执行一个脚本的效果
research [<slot id> or "all"] 研究完成指定科研槽的科技(slot id)或所有科技(all) 使用"Research all"将立即研发所有科技。
research_on_icon_click 在点击科技树上的图标时立刻研究完相应科技 允许你研究完一项科技而无需其前置科技
annex [<Target Country Tag>] 吞并输入的国家 annex USA 或者 annex d01 亦或 annex all
manpower [<Amount>] 向玩家增加人力 如果只输入 "manpower",后面不跟数字则会给你一千万人力
add_opinion [<Country tag>] 增加指定国家好感度 向指定国家增加 100 (硬编码)点好感度(例如 add_opinion ENG)。成功执行后会输出 "<country> have 100 more opinion about you" 并会在外交界面中显示为 "cheat_opinion_modified_good"。
tag [<Country tag>] 切换到输入的国家
observe(spectator) 切换到无国家状态,并且不再弹出信息或是暂停游戏。但是,开启观察模式也能干扰 AI 的操作,并且使用观察模式能很好地预测出 AI 接下来会做什么。
tdebug 开关调试信息 对查看国家 tag 和 ID 很有帮助
spawn [<子单位类型>] [<省份 ID>] [<数量>] 增加单位到指定的省份 仅在调试模式下工作。
occupationpaint(op) 开关占领地区绘色。如果和国家 tag 配合使用则只绘色该国家拥有而不是控制的地区,比如,op JAP。
setowner [country tag] [state id] 设置地区拥有者 通过点击选择一个地区也会生效。当一个地区已被选中则其他地区不能再被改变。
setcontroller [country tag] [province id] 设置省份控制者
xp [XP amount] 玩家获得海陆空三军指定数量的经验 一天能用一次
pp(fuhrer_mana,political_power) [PP amount] 向玩家增加政治点数
fuel [<amount>] 增加燃油 fuel 100000 (上限取决于你的储备容量,超出将会导致燃油减少)
civilwar [<意识形态>] [<目标国家 TAG>] 引发内战 civilwar fascism ENG :

其他可输入意识形态 "communism"(共产主义) "democratic"(民主主义) "neutrality"(中立)

add_party_popularity <ideology group> <value> 增加政党支持度 ideology group 在钢铁雄心原版理念组里有对应快捷键 d f n c。
set_ruling_party <ideology group> 设置执政党 ideology group 在钢铁雄心原版理念组里有对应快捷键 d f n c。
help [command name] 输出所有的控制台指令或者指定指令的介绍。
Focus.AutoComplete 允许国策立刻完成 对 AI 有效
Focus.NoChecks 无视国策的条件 对 AI 有效
Focus.IgnorePrerequisites 无视国策前提要求 允许从国策树中间开始点国策
Decision.NoChecks 无视决策的条件 同样不会消耗政治点数
instant_prepare 立刻准备好海军入侵 只在调试模式下生效。
it 陆军和海军立刻演练完成 对 AI 有效
nu [number] 增加国家凝聚力 仅在 1.5 以前的版本有效
nuke [number] 增加核弹数量 添加 100 或者 1000
ai_accept AI 会同意所有外交请求
add_core <province_id> 增加核心
agency.instantslotunlock 移除在间谍招募时中间的等待时间
agency.autocomplete 立刻完成间谍机构的升级
prevent_operative_detection 你的特工/间谍不会再被发现
force_operative_detection 你的特工/间谍会被发现
agency.keepexcessoperatives
resistance 增加选中省份的抵抗度到设定数值 例如:(选择柏林的一个省份)resistance 100
compliance 增加选中省份的顺从度到设定数值 例如:(选择但泽的一个省份)compliance 100

全部指令

指令 效果 例子/解释
rendertype 输出所使用的渲染后端
tweakergui 生成一个调整器 GUI
add_equipment(ae) [<equipment amount>] [<equipment name>] 添加装备 add_equipment 200 Sonderkraftfahrzeug 251/20:在 "equipment_l_english.yml" 中能查阅到所有装备的名字
add_ideas [<idea name>] 带着 <id> 添加民族精神会添加到对应国家 在 .\common\ideas 下的文件查看各国的民族精神
add_latest_equipment(ale) [<equipment amount>] 给予玩家一定量的最新装备
reload [file name] 重载游戏资源
  • reload loc (重载本地化文件)
  • reload focus (重载国策)
  • reload landcombat.gui (重载陆战界面)
time 当前时间
reloadfx [参数:map/mapname/postfx 或者 *.fx 文件] 重载着色器
particle_editor 生成一个粒子编辑器
whitepeace(wp) [<country tags>] 指定的国家之间白和。
testtool(test) 测试工具。
analyzetheatres(anth) Analyze theatres for errors.
massconquer(massc) Mass conquer tool.
deleteallunits(delall) 删除指定国家的全部陆军和海军。 deleteallunits SPR
aircombat(airc) [<scenario name>] [<result name>] [<province id>] [<state id with airbase>] [<state id with airbase>] [<equipment type>] [<equipment type>] [<equipment creator country>] [<equipment creator country>] 在指定位置生成一场空战
teleport(tp) [<province_id>] 传送选中陆军或海军到指定省份
theatersrebuild(trebuild) Rebuilds all theatres in the world. All orders will be cleaned.
fronts Toggle visibility of the foreign fronts
aidump Dump AI front data to log file, needs to have a unit selected
traderoutes Toggle visibility of trade routes
debug_tactics Toggle visibility of debug tooltip for tactics
allowdiplo(adiplo,nocb) Allows to use all diplomatic actions for no matter the rules.
debug_nuking Allows to nuke every province without checking any conditions.
reloadsupply(relsup) Reinitializes the supply systems.
deltat [<speed factor>] control animation speeds
building_health(bhealth) [<building type>] [<state or prov id>] [<building level>] [<health to add>] Changes specified building health
instantconstruction(ic) Toggles instant construction cheat.
nomapicons Toggles map icons.
nopausetext Toggles the pausebanner for nicer screenshots.
nextsong Changes the currently playing soundtrack.
combatsound How often does the combat view give a random sound? 0-50
morehumans(humans) [num] Adds more humans
window(wnd) [Arguments: open/close] [window gui name] Opens or closes the specified window
reloadinterface Reloads the entire interface
reloadtechnologies Reloads the technology database
updateequipments Updates the equipment database
updatesubunits Updates the subunit database
reloadoob [<Target Country Tag>] Reloads OOBs
update_loc [localization tag] Updates the localization tag file
poll Polls valid Events
pause_in_hours Pauses the game after X hours have passed after command is called
event [event id] [<Target Country Tag>] Executes an event event political.3 for communist coup
research [<slot id> or "all"] Researches a technology from research slot or all.
research_on_icon_click Research a technology when clicking on technology tree icon
add_autonomy [<Target Country Tag>] [num] Changes a country's autonomy level add_autonomy PHI -200
annex [<Target Country Tag>] Begin annex/annexes the specified tag annex USA or annex d01
winwars Gives max war score in all wars for the country Command no longer exists as of patch 1.9.1
testevent [<Event ID>] [<Character ID>] Tests an event without triggering it
manpower [<Amount>] Adds manpower to player
add_opinion [<Country tag>] Add opinion to/from tag Adds 100 opinion (hardcoded number) to and from target country (add_opinion ENG for instance). A successfull call prints "<country> have 100 more opinion about you" and it appears as "cheat_opinion_modified_good" in the diplomacy screen
tag [<Country tag>] 更换当前控制的国家
resign Resign from the game
add_interest [<Country tag>] Add specified country tag to your interest
remove_interest [<Country tag>] Removes specified country tag from your interest
add_diplo Adds diplomatic entroute
PrintSynchStuff Prints random count and seed
SetRandomCount Sets the randomcount to 0 or arg
observe(spectator) Switches to play no country at all, and no longer shows messages or pauses the game. However, it also interferes with AI performance and is not a good indication of what the AI will do if observe mode is not used.
ai 打开或关闭 AI
human_ai 打开或关闭玩家 AI
ai_invasion Toggles AI AI naval invasions
ai_accept(yesman) Toggles AI always accept diplomacy
fow(debug_fow) [<Province ID> OPTIONAL] Turns off fog of war in a province or in general
collision(debug_collision) Toggles debug display of normals/bounding boxes/collision
savegame Creates a savefile.
savecheck Makes a save file (Test_01), loads the save file, makes a new savegame (Test_02). Those save files should look the same.
IP 显示你的 IP
requestgamestate Requests the gamestate from host
nudge Go to the nudge tool
mapmode [Mapmode type (int)] Change mapmode.
fullscreen Toggles fullscreen
prices Price Info
add_core [<State ID>] [<Country Tag>] 添加核心
remove_core [<State ID>] [<Country Tag>] 移除核心. Note:Does not Work
debug_zoom Zooms in the game
debug_types Will print the data type for all dynamic reference objects. Can only be used if using RTTI.
debug_show_event_ID Shows event ID
debug_commands Printing commandcount to message.log
debug_events Start Counting events
debug_dumpevents Dump Event data to game log
debug_diploactions Start Counting diplomatic actions
debug_dumpdiploactions Dump diplomatic action data to game log
debug_assert Toggles asserts on/off
debug_smooth Toggle framesmoothing
debug_nomouse Toggles mouse scrollwheel on/off
debug_terrain Toggles Terrain on/off
debug_cities Toggles Cities painting mode on/off
debug_water Toggles Water on/off
debug_fronts Toggles interpolated fronts debug
debug_off_front_snap(dbg_fsnap) Toggles offensive fronts snapping debug
debug_borders Toggles Borders on/off
debug_trees Toggles Trees on/off
debug_rivers Toggles Rivers on/off
debug_postfx Toggles PostFX on/off
debug_sky Toggles Sky on/off
debug_bloom Toggles Bloom on/off
debug_tooltip Toggles Tooltips on/off
flagsoutput [<path>] Creates texture atlas files from memory.
cityreload Reloads the cities
error Show errors in log
version Show current game version
debug_nogui Toggles GUI on/off
debug_volume [<Volume Delta>] Modifies music volume
debug_lockcamera Toggles Camera locked on/off
debug_lines Toggles Debuglines
debug_entities Toggles Debug entities
debug_info Toggles Debug info
debug_particle Toggles Particles Debug info
debug_ai_budget [CountryTag] Show ai budget data
debug_textures Writes Texture info to application debug log
debug_texture draws textures like bloom
debug_wireframe Toggles forced wireframe on/off
debug_achievements_clear Clear all achievements and user stats
moveunit [<Unit ID>] [<Province ID>] Moves a unit to a province
spawnactor [<Actorname>] [<Province ID>] [<Animation> OPTIONAL] Spawns an actor with an optional animation
spawn [<子单位类型>] [<省份 ID>] [<数量>] 增加单位到指定的省份 仅供开发者使用
guibounds(gui) Toggles GUI bounds debug
cameraclamp Toggles the camera clamping
provtooltipdebug(tdebug) Toggles the debug info in province tooltip
reloadweather [<randomseed>] Reload and regenerate weather
weather Toggle weather simulation
debug_air_vs_land(dbg_cas) Toggle debug mode for air vs land combat.
mapnames Toggle map names
gbreload Reloads gradient borders only for developers
gbpaint [layer] [channel] Toggles gradient border painting
occupationpaint(op) Toggles occupation painting
setowner [country tag] [state id] Sets state owner
setcontroller [country tag] [province id] Sets province controller
profilelog Prints out the profiling informations into time.log
run Runs the specified file with list of commands
oos Out of Synch
debug_crash(crash) Crash!
sleep(wait) [time in sec] Sleep
goto_province [province id] Centers to province
goto_state [state id] Centers to state
trigger_docs(effect_docs) Print docs for triggers and effects
xp [XP amount] Gives Army, navy and air experience to player
threat [Threat amount] Adds or show threat level of player If one does "threat 999999999" it will reset the world tension to 0
pp(fuhrer_mana,political_power) [PP amount] Gives political power to player
3dstats Toggles 3D Stats
hdr Toggles hdr
hdr_debug Toggles hdr debugging
srgb Toggles sRGB
bloom Toggles bloom
PostEffectVolumes.Default [posteffect_values name] Toggles default posteffect values
night Toggles night *as of 1.01 this does not seem to work (filed under developer-only command) This command can be emulated via the day/night loop option at the bottom right toolbar (shortcut key 'N')
filewatcher Toggles filewatcher
civilwar [<ideology>] [<target country tag>] Spawns a civil war civilwar fascism ENG :

Other Valid ideologies "communism" "democratic" "neutrality"

add_party_popularity <ideology group> <value> Adds party popularity ideology group has shortcuts d f n c for vanilla HOI groups.
set_ruling_party <ideology group> Sets ruling party ideology group has shortcuts d f n c for vanilla HOI groups.
createlean Create LEAN textures
helplog Print out all console commands to game.log file.
help [command name] Print out all console commands or a specific command description.
helphelp Double Rainbow help.
hsv Converts RGB to HSV
tag_color Test setting a country's color
browser [url] Show browser window
browser_base_url [url] Set browser base url
aiview Enable AI debug info
Focus.AutoComplete Allows national focuses to be instantly finished Affects AI
Focus.NoChecks Ignores focus requirements Affects AI
instant_prepare Instantly prepares naval invasions Developer Only
nu [number] Adds the specified amount of National Unity
pp [number] Adds the specified amount of Political Power Not specifying the amount of political power will give the player 1000 political power.
nuke [number] Adds nuke
airealism 开启真实 AI 一个能让 AI 在聊天中能像玩家一样说话的彩蛋。因为在多人游戏中无法使用,在单人游戏中无法开始聊天所以没用。[2]
instant_wargoal Will allow instant justificatiion of war goals on countries
set_country_flag [<Country Flag>] Adds a country flag to currently played nation. Does not work if you put another nations tag in the command such as "set_country_flag flag AUS". The console will give a message confirming the command, but in my testing no flag is set.
set_cosmetic_tag [<country tag>] [<cosmetic tag>] changes the name and flag of the country set_cosmetic_tag USA SOV

另见

参考

  1. tag 列表文件可以在 /Hearts of Iron IV/common/country_tags/ 文件夹中找到。
  2. 播客上关于这条指令的评论可以在这里看到 https://www.reddit.com/r/hoi4/comments/6cb8vh/the_secrets_of_hoi4/dhtdr4x/

hoi4de:Console commands hoi4es:Console commands hoi4fr:Console commands hoi4pl:Console commands hoi4pt:Console commands hoi4ru:Console commands