• 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

for example Denmark or Sweden And I noticed that there are already Swedish models in Resource/Models folder
I merged your thread with another one where the same question was asked, so you can have a look at the posts above. :doff

If @KovadJupiterus and/or @Jack Rackham would be willing to provide some support, I believe adding Sweden should be the easiest of all.
A lot of the work was already done by Jack; the main thing to do is to make the game see it as a real nation.

If you haven't seen it yet, this is a good place to start modding: Tutorial - Modding Tips & Tricks
Then you can search the game folder for "AMERICA" and see everywhere it is used.
Those are the same places where a "SWEDEN" would need to be added.
 
I found all files where is word "AMERICA" and it is a lot of files...and I dont know how to start exactly... has anyone a advice??
 
I found all files where is word "AMERICA" and it is a lot of files...and I dont know how to start exactly... has anyone a advice??
globals.c (or was it globals.h?) will need an entry for SWEDEN to start out with.
Then:
1. PROGRAM\NATIONS
2. PROGRAM\Models\initModels.c

I think if you cover those files first, you'll have made a big step forward. :onya
 
"globals.c" contains the entry for AMERICA. It's 6, the same as GUEST1_NATION.

In "PROGRAM\Periods.c", both "Revolutions" and "Napoleonic" have this:
Code:
period.Nations.Guest1 = "America";
That's checked by function 'CheckNationsQuantity(int iPeriod)' in "PROGRAM\NATIONS\nations.c" - it returns 6 by default, plus 1 for each of the two "guest nations" which exists in that period. So, you might get away with defining SWEDEN as 7 and adding 'period.Nations.Guest2 = "Sweden";' to each period in which you want Sweden to exist. Or you might define SWEDEN as 6 and put 'period.Nations.Guest1 = "Sweden";' in all periods except "Revolutions" and "Napoleonic" . We already know guest nation 1 works because it's America in those two periods, so I'd imagine that setting it to be Sweden in other periods ought to work.

And then there's the matter of flags. The only Swedish flag currently in the game is one of the Personal ones, which is fine if you want to pretend to be Swedish but which won't work if you want Swedish ships sailing around the high seas. For "Early Explorers", "merflg1.tga.tx" and "merpnt1.tga.tx" contain all merchant ship flags and pennants; "shpflg1.tga.tx" and "shppnt1.tga.tx" contain all naval ship flags; and "frtflg1.tga.tx" contains all fort flags. For other periods, change the number in all those names. Use TX Convertor to change ".tga.tx" files to ".tga", which can be read by Photoshop and other picture editing software. You'll see that there are a couple of black areas at the end of each merchant and naval flag texture file - three black areas in those periods which don't have America. The end area has to be black. If you're going to have Sweden as guest nation 1 in those periods without America, you can put the Swedish flag into the same place as where the American flags appear in the later period files. Presumably the next blank slot is for guest nation 2. Fort flags are a bit different - looking at some of the files, I can see the usual nation flags, including America in late periods and a black patch in earlier periods; then the pirate flag; and then a white flag. So I don't know what guest nation 2 will do - but then, if Sweden isn't going to get any colonies, and provided you don't capture any colonies on behalf of Sweden, it might not matter. Or, if you're going to use guest nation 1 for Sweden in earlier periods, just put the Swedish flag into the black area.
 
I tried it but i have this error @Grey Roger I haven´t seen your message I will try it now
 

Attachments

  • compile.log
    1.6 KB · Views: 120
  • error.log
    6.1 KB · Views: 160
  • system.log
    883 bytes · Views: 130
"globals.c" contains the entry for AMERICA. It's 6, the same as GUEST1_NATION.
Yep; that's intentional.

Important question: Will Sweden and America exist at the same time?
If so, Sweden should be "GUEST2_NATION" or AMERICA and SWEDEN should have their numbers reversed.

In "PROGRAM\Periods.c", both "Revolutions" and "Napoleonic" have this:
Ah, good point! I had forgotten about that, but that's indeed pretty crucial.
 
For I want only Sweden in Spanish Main , Golden Age of the Piracy and Colonial Powers so no the America and Sweden won´t exist at the same time ... for now
 
For I want only Sweden in Spanish Main , Golden Age of the Piracy and Colonial Powers so no the America and Sweden won´t exist at the same time ... for now
In that case, you can give SWEDEN the same number as AMERICA and it'll be Guest Nation 1.
 
I don´t know what I am doing bad....still gives me an error I am posting files involved... and sorry for inaccurate names for Swedish ranks I could not find anything else... and as for the adding flag I don´t know how to exactly do that with ... i am using GNU Image manipulation program....is photoshop better for it???
 

Attachments

  • error.log
    6.1 KB · Views: 133
  • nations_init.c
    44.6 KB · Views: 114
  • nations.c
    61.9 KB · Views: 124
GNU Image Manipulation Program - or GIMP - should be perfectly able to do the job, provided it can recognise and save alpha channels. These aren't important for basic flags but are crucial for pennants.

The error is in "nations_init.c". There is a block which starts:
Code:
    if (NATIONS_QUANTITY > 6)
   {
You have added a new block which starts:
Code:
   if (NATIONS_QUANTITY > 7)
   {
But you put your block before the '}' which closes off the first block.

Also, you have added a block which starts:
Code:
        if  (period == PERIOD_COLONIAL_POWERS) || period == PERIOD_REVOLUTIONS) || period == PERIOD_NAPOLEONIC)
       {
That one has no closing '}' at all. So the net effect is that there are two blocks which aren't closed off, which confuses the compiler, and that's where the message "Missing '}' in segment" in "error.log" comes from. Try the attached version.

However:
For I want only Sweden in Spanish Main , Golden Age of the Piracy and Colonial Powers so no the America and Sweden won´t exist at the same time ... for now
That's not what you have programmed. The code is looking for NATIONS_QUANTITY > 7 and for the period to be Colonial Powers, Revolutions or Napoleonic. America doesn't exist in Colonial Powers, so even if you have set Sweden to be guest nation 2, NATIONS_QUANTITY won't be over 7 and your code won't trigger. The only time it will set up Sweden's soldiers and ranks is in Revolutions or Napoleonic, i.e. when America and Sweden do exist at the same time.

Could you upload your version of "PROGRAM\globals.c" so I can see how you are trying to set up Sweden?
 

Attachments

  • nations_init.c
    44.6 KB · Views: 139
That has also set Sweden up as nation 7, which is the same as GUEST2_NATION. I don't think that is going to work if you want Sweden to be in earlier periods when America doesn't exist. Also, if you have changed "PROGRAM\Periods.c" to include Sweden, could you upload that, please?
 
Yes, that is consistent with trying to make Sweden as GUEST2_NATION. Try it anyway, with the fixed version of "nations_init.c", and see how far that gets. If I'm right - and this is only a guess, I've never tried modding the nation mechanism before - GUEST2_NATION can only work if there is also a GUEST1_NATION, which means Sweden can only use GUEST2_NATION in those periods in which America exists. So if it doesn't work, we can try changing Sweden to GUEST1_NATION, as your "Periods.c" shows that Sweden should only exist in periods when America does not exist.

And I suspect that having Sweden as GUEST1_NATION will work better with flags, too.
 
Now I am getting this error and it has something with nations.c
 

Attachments

  • error.log
    834 bytes · Views: 123
  • nations.c
    61.9 KB · Views: 133
I suspect this is to do with the fact that in periods other than "Revolutions" or "Napoleonic", America doesn't exist, so there aren't enough nations for your code in "nations_init.c" to trigger, so Sweden isn't being set up.

Try these. I've set Sweden as GUEST1_NATION in the periods you want, which won't conflict with America as it doesn't exist in those periods. "nations_init.c" is therefore set to look for NATIONS_QUANTITY > 6, and then set up either America or Sweden depending on period.
 

Attachments

  • globals.c
    13.5 KB · Views: 124
  • Periods.c
    44.3 KB · Views: 137
There were too many brackets in a condition statement, now fixed. Try this.
 

Attachments

  • nations_init.c
    44.6 KB · Views: 141
Back
Top