Results 1 to 13 of 13

Thread: How to avoid the black screen bug and put the starting camera on your faction´s capital.

  1. #1

    Default How to avoid the black screen bug and put the starting camera on your faction´s capital.

    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:

    Last edited by Hellenikon; March 09, 2010 at 07:16 AM.

  2. #2

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    nice +rep


  3. #3

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    Very nice Bucefaloˇ

    +rep

  4. #4
    MCM's Avatar Saint of lost causes
    Join Date
    Jun 2006
    Location
    Tokyo, Japan
    Posts
    2,906

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    Yes- well done. Informative and easy to understand.

  5. #5

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    Excellent resource.
    Every day takes figuring out all over again how to live.

  6. #6

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    Thanks guys, i fixed some typos and reworded some things to explain them better. Now it should be more clear how to assign the X and Y coordinates. Cheers.

  7. #7

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    Good resource but I think the numbers for camera are always from regions.esf and not startpos.




  8. #8

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    Just a simple question
    how do you enable the choice menu for the Mameluk faction in Napoleon's Campaign ?

  9. #9

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    You just unlock the campaign and then make them playable as I did in RTI and Warpath.




  10. #10

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    Quote Originally Posted by husserlTW View Post
    You just unlock the campaign and then make them playable as I did in RTI and Warpath.
    How do you unlock the campaign ? I don't have any Mameluk faction in the startpos data\campaigns\mp_eur_napoleon ; I have it in mp_egy_napoleon , but there no choice between faction

  11. #11

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    TXKS

    Working ; just make sure to pick up 3 digital for x and 2 digitals for Y
    in this exemple
    CampaignUI.SetCameraTargetInstant(-102.0, -85.0)

  12. #12

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    How can be added the Bedoin's ?

    adding this script ; makes the game freeze

    local function OnFactionTurnStart(context)

    if conditions.FactionIsLocal(context) then
    -- If it's Bedouin's turn then position the camera over Muzziena
    if conditions.FactionName("egy_bedouin", context) and conditions.FactionIsHuman("egy_bedouin", context) then
    scripting.game_interface:set_zoom_limit(1.00, 0.61)
    CampaignUI.SetCameraZoom(0.9)
    CampaignUI.SetCameraTargetInstant(17.00, -143.00)
    end
    end
    Last edited by kungfuserge; April 26, 2010 at 09:16 AM.

  13. #13
    ♔Icebear77♔'s Avatar Biarchus
    Join Date
    Jan 2009
    Location
    Switzerland and Germany
    Posts
    673

    Default Re: How to avoid the black screen bug and put the starting camera on your faction´s capital.

    Hope you can help me, because your tut does not work for me (but your tut is great!!). At the start of a camp with a unlocked faction, i dont have a black screen. My camera is always in the center of the map and does not move to the capital-city (tried out with spain).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •