• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Need Help Adding New Nations

Should be BuildSettings.h, one of the interface options files and something in resource\ini
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..?
 

Attachments

  • SWEDEN_ALLOWED.rar
    33.9 KB · Views: 149
Last edited:
Adding relation changes based on more wars and treaties: go for it! Take a look at "PROGRAM\Storyline\FreePlay\StartStoryline.c", in which I've already added quite a few. Adding more should not be too hard. Note, however, that this only sets the relations at the beginning of the game. I've no idea how to change them dynamically as years go by, and anyway random relation changes are going to play merry havoc with history.
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?

For Hornblower, Spain is going to switch sides, declare war on France and ally with Britain, though the date on which that happens almost certainly won't be realistic. If you've ever watched the Gregory Peck film "Captain Horation Hornblower RN", you'll know how Hornblower finds out about it. If you play Hornblower, whether through the storyline or from FreePlay, you're going to find out about it the same way, first hand...
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.
 
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?
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.

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.
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!
 
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
 

Attachments

  • seadogs.c
    86.6 KB · Views: 169
  • select_storyline.c
    131.7 KB · Views: 164
Last edited:
Wow, that's seriously cool and impressive, @DeathDaisy! :bow

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?
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.
 
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.
 
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?
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.

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.
True. But the same applies to many, many of the other options already in there.
 
Have Sweden only enabled if you select her WITH Sweden as nationality?
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

True. But the same applies to many, many of the other options already in there.
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.
 
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
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.
 
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.
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?
 
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
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".
A maybe-but-not-necessarily-connected question, it possible to change the size and frequency of encounters with a nation?
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?
 
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".
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
Not that I know of, but then I don't know the code which sets up encounters.
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
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?
I'd be exalted :woot
 
A maybe-but-not-necessarily-connected question, it possible to change the size and frequency of encounters with a nation?
There should be a way.
There are certain types of encounters that are limited to only certain nations. :yes
 
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.
 
Back
Top