When in a campaign you unlock a faction that was originally not playable, it is very possibly that you will find yourself on the first turn with a black screen like this.
In this case i unlocked the mamelukes and had that black screen greeting me on the first turn. Sometimes the game freezes, while other times you can just click the minimap and the camera will go normally to that location. Still i found this quite annoying and preventing on having a good campaign game, so i tried to fix this while conserving the fog of war.
This tutorial is aimed to avoid this bug, and also follow the style of the other playable nations by CA and put the camera over your capital.
You need the ESF editor, as well as a faction which you have unlocked and you are having this black screen bug.
Open your startpos.esf and locate the region on which your capital city is, then open the tabs until you find the city itself. You will see two tabs which are the coordinates X and Y. Note down those numbers (no need to copy all decimals, just the first 2-3 numbers). Something important to keep in mind is that the coordinate might be only the first two (like -10) or three (like -102), they way to know which one of these is correct is unfortunately only testing. But you can also use logic and by looking at the other coordinates you already have, you can figure more or less which number it is (for example, a europe map will have a lot more of X than Y, as it is very wide, so it makes sense that the X coordinate will be a high number, bigger than the Y).
Then open your scripting.lua file of that campaign, and add the following command like in this example:
Code:
-------------------------------------------------------------------------------------------------------------------------
--
-- POSITIONS THE STARTING CAMERA APPROPRIATELY DEPENDING ON THE CURRENT FACTION AND GAMETYPE, SETS UP THE INITIAL MISSION
--
local function OnFactionTurnStart(context)
if conditions.TurnNumber(context) == 1 then
out.ting("Give Napoleon's army some hella XP on startup")
scripting.game_interface:award_experience_level("faction:egy_french_republic,surname:619", 3)
-- Limit diplomacy
diplomacy_starting_restrictions()
if conditions.FactionIsLocal(context) then
-- If it's France's turn then position the camera over Alexandria
if conditions.FactionName("egy_french_republic", context) and conditions.FactionIsHuman("egy_french_republic", context) then
scripting.game_interface:set_zoom_limit(1.00, 0.61)
CampaignUI.SetCameraZoom(0.9)
CampaignUI.SetCameraTargetInstant(-133.0, -29.0)
-- If it's the Ottoman's turn then position the camera over Damascus
elseif conditions.FactionName("egy_ottomans", context) and conditions.FactionIsHuman("egy_ottomans", context) then
scripting.game_interface:set_zoom_limit(1.00, 0.61)
CampaignUI.SetCameraZoom(0.9)
CampaignUI.SetCameraTargetInstant(121.0, 89.0)
-- If it's the Mameluke's turn then position the camera over Cairo
elseif conditions.FactionName("egy_mamelukes", context) and conditions.FactionIsHuman("egy_mamelukes", context) then
scripting.game_interface:set_zoom_limit(1.00, 0.61)
CampaignUI.SetCameraZoom(0.9)
CampaignUI.SetCameraTargetInstant(-99.0, -90.0)
end
end
end
end
The command is this one:
Code:
local function OnFactionTurnStart(context)
if conditions.FactionIsLocal(context) then
-- If it's France's turn then position the camera over Alexandria
if conditions.FactionName("egy_french_republic", context) and conditions.FactionIsHuman("egy_french_republic", context) then
scripting.game_interface:set_zoom_limit(1.00, 0.61)
CampaignUI.SetCameraZoom(0.9)
CampaignUI.SetCameraTargetInstant(-133.0, -29.0)
end
end
You have to introduce instead of "egy_french_republic" the internal name of your faction, for the mamelukes i introduced "egy_mamelukes" which is their internal name. Then you have to replace the numbers (-133, -29 in the example) of the coordinates, by the ones you noted down in the startpos. Those numbers are not going to be 100% accurate, if you want your camera to be perfectly set with the city exactly in the middle of the screen, you will have to change them a bit more by increasing/decreasing the values. See how i did it for the mamelukes, the coordinates for cairo in the startpos are not the same that the ones i wrote in the script, i changed them slightly.
After that just save your scripting.lua and start your campaign, the result should be something like this: