In COH1, there were
autoexec.lua scripts going around that were really useful when needing to take screenshots. When I recently needed the same functionality in COH2, I found that the script I used for COH1 didn't work in COH2.
Mainly, the
autoexec.lua file is no longer executed. Instead, it is now
localexec.lua. And it runs at the start of every map.
Most of the script functions still work, however, I will point out two things that I found when putting together my version for COH2. One being that the "Game Paused" message can only be removed using the
UI_SystemMessageShow() function and passing it a localized empty string. If the game is already paused when you call my
toggle_screen_mode() function, you will have to toggle the pause again for the message to go away. The other issue to note is that the
game_hideui() function does not remove player colors from units and buildings as it did in COH1, and I have not yet found a function that will do this in COH2.
So anyways, here's my script. You save it in your game's root folder as
localexec.lua. You must also add -dev to your launch options.
bind("f9", "take_super_screenshot()")
bind("f10", "toggle_fow()")
bind("f11", "toggle_screen_mode()")
screenmode = 0
fowmode = 0
function take_super_screenshot()
Misc_SuperScreenshot()
end
function toggle_fow()
if fowmode == 0 then
FOW_RevealAll()
fowmode = 1
else
FOW_UnRevealAll()
fowmode = 0
end
end
function toggle_screen_mode()
if screenmode == 0 then
UI_SystemMessageShow(Util_CreateLocString(""))
taskbar_hide()
game_hideui()
cursor_hide()
screenmode = 1
else
taskbar_show()
game_showui()
cursor_show()
UI_SystemMessageHide(Util_CreateLocString(""))
screenmode = 0
end
end
function Util_CreateLocString(text)
local tmpstr = LOC(text)
tmpstr[1] = text
return tmpstr
end
print("localexec.lua executed")
You can change the key bindings at the beginning as you see fit. I like them near the F12 key so I can take Steam screenshots. The super screenshot function will take a screenshot that is about 4 times larger than your screen resolution; they're saved at
\My Games\Company of Heroes 2\screenshots. I usually save a replay of the game that I want to take screenshots from, watch it, disable Fog of War, call toggle_screen_mode() as necessary, pause it when I get to a scene that looks epic, pan and move the camera to line up the shot, then do either a super screenshot or a regular screenshot.
Hope you find this helpful.