1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Need Help Adding New Nations

Discussion in 'Build Beta and Brainstorming' started by KovadJupiterus, Jun 2, 2017.

  1. ANSEL

    ANSEL Corsair Storm Modder Hearts of Oak Donator

    Joined:
    Aug 18, 2013
    Messages:
    1,769
    Gender:
    Male
    Occupation:
    Artist,Painter
    Location:
    Viborg.Denmark
    No, but Denmark truly is. Three Islands and a period from 1671 to 1917 :rolleyes:
     
    Pieter Boelen likes this.
  2. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    288
    Gender:
    Female
    Boom!

    EDIT: Actually I got a bit ahead of myself because I was so excited and proud that I figured it out; I've uploaded a new rar where the option also has a description :oops:

    EDIT2: Also I realised I used my InternalSettings.c file with some non-default settings enabled like a goddamn moron :modding third times the charm..?
     

    Attached Files:

    Last edited: Oct 6, 2017
    Pieter Boelen likes this.
  3. Homo eructus

    Homo eructus Freebooter Storm Modder

    Joined:
    Sep 4, 2014
    Messages:
    343
    Gender:
    Male
    Sure, I wasn't thinking of dynamic changes, just more starting scenarios like the ones already set. I guess it would be the same to change ruler's names?

    If you keep the same date from the film, I think the beginning is set in 1807, and the first uprising against the French in Spain started in may 1808, so it's just a few months difference, which in the great scheme of things, I think is close enough to reality. If you start in late 1807 and add a few time skips between mission stages so the relation change happens in say june 1808 (allowing a month for the news to travel to the colonies), it could be quite accurate, really.
     
  4. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,408
    Yes. In fact, that's how I changed the king of Spain in early "Napoleonic", and if you've got the latest version (after I re-uploaded it again earlier today), the War of 1812 changes him again as well as making Spain allied to Britain and hostile to France.

    The storyline ends with Hornblower at rank Commander. The film starts with him at rank Captain. So you need to do some free-playing before you are eligible. Or you can play Hornblower from the start as a FreePlay character. Either way, the mission will become available when you reach the rank of Captain, whenever that happens to be. Both the storyline and the FreePlay characters start you off in 1798, and I'm not going to force players to wait years of game time before they get to do the mission!
     
  5. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    288
    Gender:
    Female
    For starting as a texture I didn't intend to use for anything, I've sure put a lot of effort into Miss Sparre. To figure out more about how the code in this game works, I have smashed my face against the keyboard continuously for days to try and make it so Sweden is always allowed when picking Hilda for freeplay. :modding And I think I've actually done it, and I literally can't believe it(it was too good to be true, see the edit). Tho I swear won't be mad, disappointed or even surprised if you tell me my code is pure madness and "oh my god, what have you done Daisy." :shock

    This requires the BuildSettings version of SWEDEN_ALLOWED I posted further up!
    I changed her model.nation to SWEDEN in model_init (which could cause problems when using it elsewhere if sweden isn't enabled?) and I added this in INTERFACE\select_storyline.c under a function that said // PB: Model-based options --> which sounded promising, and then below "if(slno == FindStoryline("FreePlay"))"
    Code:
    // DeathDaisy: Always enable Sweden when picking Hilda Sparre -->
                        string WasSwedenAllowed = sti(GlobalSettings.BuildSettings.SWEDEN_ALLOWED); // Store profile settings before changed by the if (doesn't seem to work very well :/ how to make static.. maybe just straight up use GlobalSettings)
                        switch(SWEDEN_ALLOWED){
                            case "0":
                                bool HildaChecked = false;
                                trace("Running HildaChecked test for !Sweden_allowed");
                                if(!HildaChecked){
                                    trace("HildaChecked = " + HildaChecked);
                                    trace("Character name = " + rName.(id));
                                    if(CheckAttribute(rName,id) == true && rName.(id) == "Hilda Sparre"){
                                        trace("Detected Hilda Sparre");
                                        trace("Activating Sweden");
                                        SWEDEN_ALLOWED = 1;
                                        ProfileSettings.BuildSettings.SWEDEN_ALLOWED = SWEDEN_ALLOWED;
                                        InitPeriods();
                                        trace("Gauging: periods again");
                                        NationsInit();
                                        trace("Gauging: nations again");
                                        HildaChecked = true; // To not get caught in a loop when changing away from Hilda
                                        trace("HildaChecked = " + HildaChecked);
                                        trace("SWEDEN_ALLOWED = " + SWEDEN_ALLOWED);
                                        trace("GlobalSettings = " + sti(GlobalSettings.BuildSettings.SWEDEN_ALLOWED));
                                        trace("ProfileSettings = " + sti(ProfileSettings.BuildSettings.SWEDEN_ALLOWED));
                                        trace("WasSwedenAllowed = " + WasSwedenAllowed);
                                    }
                                    else{
                                        trace("HildaChecked = " + HildaChecked);
                                        trace("No Hilda");
                                    }
                                }
                            break;
                            case "1":
                                trace("Running HildaChecked test for Sweden_allowed");
                                trace("HildaChecked = " + HildaChecked);
                                trace("WasSwedenAllowed = " + WasSwedenAllowed);
                                // Return to profile build settings when picking other characters, but check only once
                                if(WasSwedenAllowed == "0"){
                                    trace("Sweden is not activated for all");
                                    trace("Character name = " + rName.(id));
                                    if(CheckAttribute(rName,id) == true && rName.(id) != "Hilda Sparre"){
                                        trace("Not Hilda Sparre");
                                        if(HildaChecked == true){
                                            trace("Deactivating Sweden")
                                            SWEDEN_ALLOWED = WasSwedenAllowed;
                                            ProfileSettings.BuildSettings.SWEDEN_ALLOWED = WasSwedenAllowed;
                                            InitPeriods();
                                            trace("Gauging: periods again");
                                            NationsInit();
                                            trace("Gauging: nations again");
                                            HildaChecked = false;
                                            trace("HildaChecked = " + HildaChecked);
                                            trace("SWEDEN_ALLOWED = " + SWEDEN_ALLOWED);
                                            trace("GlobalSettings = " + sti(GlobalSettings.BuildSettings.SWEDEN_ALLOWED));
                                            trace("ProfileSettings = " + sti(ProfileSettings.BuildSettings.SWEDEN_ALLOWED));
                                            trace("WasSwedenAllowed = " + WasSwedenAllowed);
                                        }
                                    }
                                }
                                else{
                                    trace("Sweden allowed for all!");
                                }
                            break;
              } // DeathDaisy: Always enable Sweden when picking Hilda Sparre <--
    sorry about the million traces, I left them for now because I figured they could help with showing what my thoughts were. That seems to work to make Sweden appear as a pickable nation and make it default for Hilda and then remove it again if it isnt enabled globally as long as you are in the storyline select menu.

    Sweden continued existing as a nation when getting into the game, but turns out it set SWEDEN_ALLOWED to 0 anyway when creating the game, so it didn't have any relations and I guess there would be no ships or so either.

    With more trace() I tracked down where it went from 1 to 0. :treasure: So, since I saved the setting in ProfileSettings.BuildSettings.SWEDEN_ALLOWED I added in seadogs.c
    Code:
    SWEDEN_ALLOWED = ProfileSettings.BuildSettings.SWEDEN_ALLOWED;
    after the Reinit towards the end of NewGame_continue() where I guess it loaded the globalsettings again

    Another problem was that if you pick Hilda, then return to the main menu and back into the storyline select menu, SWEDEN_ALLOWED stayed as 1 and no checks were made until you picked Hilda again, wherafter if you switched to another character it would turn off again. So I added checks to storyline_select near the top under InitInterface() and when clicking the X to get back to the main menu under ProcessCancelExit()
    Code:
    trace("Going to main menu, checking SWEDEN_ALLOWED");
        trace("SWEDEN_ALLOWED = " + SWEDEN_ALLOWED);
        if(SWEDEN_ALLOWED){
            trace("Sweden allowed. What about GlobalSettings? = ");
            trace("GlobalSettings = " + GlobalSettings.BuildSettings.SWEDEN_ALLOWED);
            if(GlobalSettings.BuildSettings.SWEDEN_ALLOWED == "0"){
                trace("Turned off globally, reinit to get rid of sweden");
                GetBuildSettings();
                InitPeriods();
                NationsInit();
            }
        }
    which might be doubledipping? I can't remember why, but I think I had a purpose when doing that

    And now it seems to work(SEE EDIT)! :bounce It turns itself on and off correctly during the abuse I throw at it when jumping around menus and changing settings and doesn't seem to do many unnecessary checks and doesn't seem ruin things if it's enabled globally. If nothing else it might help a coder who knows what they're doing know more what kind of problems might crop up and save some time. Attaching the files too, traces and all, if anyone wants to have a look. :type1

    this post turned into a storytime

    EDIT: Actually, when testing right now, it turns SWEDEN_ALLOWED off again when loading the game:boom: so, unsurprisingly, there are problems to iron out.. thoughts?

    EDIT 2: It seems the swedes turn up anyway in that save, I could call for names with the console and I encountered some ships with lousy aim, so maybe it doesn't matter if it goes back to 0 as long as it was enabled when starting the game? I added
    Code:
    if(GetMySimpleName(PChar) == "Hilda Sparre" || PChar.model == "Hilda Sparre"){
            SWEDEN_ALLOWED = 1;
        }
    to StartStoryline too, but I don't know if that did anything or if it worked before that
     

    Attached Files:

    Last edited: Oct 8, 2017
    Pieter Boelen and pedrwyth like this.
  6. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Wow, that's seriously cool and impressive, @DeathDaisy! :bow

    Is that toggle used only in Periods.c and nations_init.c? If so, indeed it shouldn't matter if it is switched off again after a new game was started.
     
  7. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,408
    Thinking about this a bit more:

    I don't like the idea of a setting which should be optional being forced on a player just because the player chooses a certain character model. What happens if someone likes the "HildaPiratess" model but doesn't want Sweden in the Caribbean?

    The code to make "SWEDEN_ALLOWED" appear in the "Options" interface is very useful because, now I have an example to follow, I can put my "RELATION_IGNORE_FRIENDLY" toggle in there as well. :D But it occurs to me that "SWEDEN_ALLOWED" might not work properly if it's changed within the game. It is indeed used in "Periods.c"; that's where Guest Nation 1 is assigned to Sweden. If it's controlled from "InternalSettings.h" then players are more likely to change it before starting a game. But if it's in the "Options" menu then you have to start PoTC before you get to it, and the only reliable way to enable it is if you start PoTC, then go to "Options" and change it, and then start a new game.
     
  8. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Have Sweden only enabled if you select her WITH Sweden as nationality?

    Alternatively, always have Sweden enabled within the Select Storyline menu for the correct time periods, so that players can select the nation regardless of anything.
    But then disable it if players didn't select Sweden for their player character nationality.
    That way, you can always choose it, but only get it if you did choose it.
    Hilda can have it set by default, but if you then change the nation yourself, you could disable it again.

    True. But the same applies to many, many of the other options already in there.
     
  9. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,408
    Yes, that works. Sweden is enabled if you select Hilda, or for that matter anyone else, with Sweden as nationality, the reason being you can't choose Sweden as a nationality unless you've enabled it first. :D

    Fair enough, it can stay in the "Options" menu. It can always be taken back out and put back into "InternalSettings.h" if anyone reports it causing problems.
     
  10. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    I meant: selecting Sweden as starting nationality could serve as the toggle to make Sweden exist.
    Otherwise most players will not know that it is possible at all, because I think there are many who don't bother going through the options.
     
  11. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    288
    Gender:
    Female
    I think that should be pretty straightforward to do if using the code I did by adding another check for nation. Then people see that the option exists, and if they choose to play sweden they obviously want it, otherwise they pick another nation and sweden is disabled, and they can look for it if they want it enabled for other scenarios.

    Otherwise I guess a simple solution until we come up with something better, and still want to make it enabled by default when choosing that story, is a non-specific version of the model with another ID that doesn't change any such settings? I'm kinda in love with her by now:love guess I'll have to consider working on a proper storyline if we don't come up with a solution :p

    A maybe-but-not-necessarily-connected question, it possible to change the size and frequency of encounters with a nation?
     
    Pieter Boelen likes this.
  12. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,408
    Another storyline? That sounds like a good incentive to go for the simple solution to the general Swedish problem. :p Stick with simply putting the toggle into the "Options" interface, disabled by default, and leave the Hilda character model as a rebel against France. Then have a storyline based on Hilda which can ignore the toggle and set up Sweden in its own "StartStoryline.c".
    Not that I know of, but then I don't know the code which sets up encounters.

    Another thought: how would you like "HildaPiratess" to be able to appear as a random pirate captain, the way "33_Piratess10" can at the moment?
     
  13. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    288
    Gender:
    Female
    Me and my stupid fat mouth :p Alright, tell you what, I'll write the nation check cuz it should be pretty simple I think, and then you can use it or discard it, I understand the reasons and I swear I won't be mad xD but it exists at least, and I'll see if I can get this quest writing on track :checklist
    maybe I'll dive in and see if I can decipher it enough to hack something together with luck and tenaciousness, as is my way :p I'd like it if I could make encounters with Sweden rarer than the nations with actual colonies
    I'd be exalted :woot
     
  14. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    There should be a way.
    There are certain types of encounters that are limited to only certain nations. :yes
     
  15. Ambrois LeGaillard

    Ambrois LeGaillard Sailor Apprentice

    Joined:
    May 14, 2016
    Messages:
    99
    Gender:
    Male
    Occupation:
    Sea Captain and Troubleseeker
    Location:
    Somewhere in the Caribbean
    NO. HET. LA.
    (take his shoe and stump on the table like Krushev) HET! HET! (read: Niet)

    PotC has all the nations that made the history of piracy.

    But I want give a suggestion, do like I did.

    Lets explain: I'm Italian, then we had part only in the discovery of the New World, with Columbus, Vespucci and Cabote, but not to the following colonization, then, what's have to do an Italian in the Main Spanish, or in the Pirates era?

    Simple, he may be:
    -an explorer in the name of one of the Kings and Emperors of this time!
    - a merchant, attracted from all the news coming from the New World, and trying to became rich with a merchant chart signed from one of the powers:
    - an adventurer, fleed from the dangers of the European wars.

    These are only some chances, you can create much others, and have your Swedish brave boy in the New World.
     

Share This Page