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

Brainstorming Personal Modifications for Feedback and Testing

Mere_Mortal

Free Like a Radical
Storm Modder
As I’ve been making so many random changes, it was deemed a good idea to make a thread for them.

Listed here will be changes such as...
  • Those which are likely to be included in the next build release
  • Those which could, but require further discussion and/or testing
  • Those which are for amusement only and not intended for the mod
I will most likely be updating this thread on a regular basis as and when I make changes or include new stuff. The two main purposes to this thread are to receive feedback and to debug any bugs. What I don’t want to spend my time doing is telling people how to put these changes into place; yes, some features will include brief instructions but it is endeavoured that anybody making use of what I put here will know how to work with the scripts and be able to do it alone.

Each upload will be applied to the original files for the most recent build, so they will need to be merged if necessary. This is with the single exception of the companion and officer max settings, these will always be applied in all files (because it’s too much hassle to change them).

I have also attached a full compilation which includes most of the changes. If you use this and increase the companion limit then you must extract the CompanionMax files first and apply the compilation on top of them (if you don’t then expect problems). [Link] (00:00, 12th May)

Follows the list of current stuff...

Increasing the Fleet Limit
  • Priority: High
  • Status: Work-in-Progress
  • Intention: Build
  • Filename: CompanionMax.7z
  • Last Edit: 04:00, 12th May
  • Forum Discussion: [link]
  • Screenshot: [link]
  • This will allow for increasing the maximum permitted non-berthed ships the player may control. Feedback is required in respect of; if this should be done at all and if so then how many ships. I am personally leaning towards a maximum of eight - more could slow things down.

  • I have substantially played with 6+ ships and it works just fine, although daily updates can be slower. It also goes without saying that if you have umpteen ships and then waltz into the middle of two scratch fleets having it large, you’d better be expecting a fair drop in performance!

  • The files may need some validating, but currently this should not need testing. The only testing would be in checking how the game reacts to more than four ships, but this only applies if the limit is actually raised. If the limit is kept at 4 then nothing should be affected in any way whatsoever, at least if there are any effects just by including these files alone then it would probably need to be rectified.

    Having said all that...
    Once you have some "final" versions for this, I think it would be good if players would test it with COMPANION_MAX still set to 4 to see if everything still behaves "as normal". If it does, then hopefully we can set it to 8 instead and have that as the new Build Default.
    That'll be cool! :dance
  • Thus, the attached download includes only the changes to functions which loop through the ships. It does not increase the limit by itself, only allows for it; this is done by changing COMPANION_MAX, which is in Program\Characters\characters.h - set this to your heart’s content. There are other files I have modified which will facilitate more than 4 ships, but they will be listed separately.

  • Note that this also applies the same change to function loops relating to officers, in that OFFICER_MAX has also been applied. This will most likely go unused but it is there in case anybody cares to use it, and it also makes things simpler for people like me because I can tell at a glance that it is for officers, not companions. As with COMPANION_MAX, it requires this setting to be applied in characters.h (failing to do this will result in a lot of problems) - default is 4, best to leave it that way for now.

  • Please bear in mind that there are many story modes and quests which require attention. Some of them are not configured to look past the first four ships so there could be areas which won’t work unless a ship is moved. For example, if there is a check for contraband then there is a possibility that such would not be found on ships in the fifth slot or higher. It is also possible for some to believe the player has the maximum number of ships if the first four slots are occupied.

Interfaces for Increasing Fleet Limit
  • Ship interface - Adds two buttons to switch the companion offset so that the next four ships can be displayed. This is rudimentary at the moment and requires work. I also intend to do the same for the shipyard interface.

  • Ship transfer interface - Empty slots are now being displayed. It has also been configured so that two companions may be selected and even the player to be selected on the right, thus allowing companions’ passenger lists to be accessible. Again, this is in a fairly immature state at the moment and I have been having issues with berthed ships being randomly sunk. Selecting active ships doesn’t seem to be much of an issue but I do advise caution if selecting a berthed ship.

New Passenger Transfer Interface
  • A brand new interface for use when transferring passengers between the player’s ships.

  • Specific features...
    • Supports transfers where a companion is selected first
    • Officers and captives in the passenger list are labelled
    • Officers have icons denoting their role
    • Their role can also be changed here
    • Skills summary has been activated

  • This currently requires substantial testing and debugging. It is currently buggy in respect of transferring the captain; due to this, it is not possible to transfer the captain while the sea can be seen. However, it works flawlessly with officers.

  • By default the main interface leads to the original one which does not actually support companion-to-companion transfers. As such, the attached transfer_main.c file is instead pointing to the new ones, although ransack_main.c will still use the originals (because it is currently not compatible while capturing ships, for the above reason). I’m not entirely sure, but it might be the case that a new game is required in order for the new interface to be loaded in this manner (either that or the save file or the game memory will need hacking).

Ship Speed & Turn on Transfer Screens
  • Priority: N/A
  • Status: Final
  • Intention: Build
  • Filename: SpeedTurn.7z
  • Last Edit: 15:30, 6th May
  • Screenshot: [link]
  • This simply adds the icons and stats for the ships’ speed and turn on the transfer or ransack screen.

Boarding Loot Crash Fix
  • Priority: N/A
  • Status: Final
  • Intention: Build
  • Last Edit: 18:20, 8th May
  • Forum Discussion: [link]
  • This is to fix the notorious and previously elusive boarding loot crash.

  • No point discussing this here, it’s all over there --> [link]

Reinforced Hull Upgrade - Calibre Fix
  • Priority: Low
  • Status: Stable
  • Intention: Build
  • Last Edit: 04:00, 14th May
  • Forum Discussion: [link] [link]
  • The reinforced hull upgrade is supposed to increase the ship’s cannon calibre by one, but due to an error this does not occur.

  • Note that if an existing ship already has the upgrade then it will not be possible to increase the calibre because the upgrade cannot be removed. However, if you buy or capture a new ship and it has the upgrade applied then it will be able to use the higher calibre. In other words, if the ship exists with the upgrade before making the change, it’s too late (unless you force it at the console).

  • The fix is as simple as adding stats to _char.ship.maxcaliber in KB_routines.c as below...
    Code:
    void applytunupcaliber(ref _char, string _improvement, int inc) {
       ...
       if (cal != -1) { cal=cal + inc; _char.ship.stats.maxcaliber = Cannon_Calibers[cal]; }
    }

  • The shipwright also requires a fix so that those randomly receiving the upgrade correctly apply it.

    In ships.c, add this just before the loop on line #300...
    Code:
       arShip.MaxCaliber = refShip.MaxCaliber

Rebalanced Upgrade Costs
  • Priority: Low
  • Status: Work-in-Progress
  • Intention: Build
  • Filename: RebalancedUpgrades.7z
  • Last Edit: 18:45, 15th May
  • The prices for ship upgrades have been rebalanced. I felt they were costing way too much in some cases, and too little in others. Quite frankly, they were very erratic. I believe these new values are much more appropriate. This also applies the calibre fix.

  • Currently the changes are made to KB_routines.c alone and this should not be the case, they need to be properly applied to InternalSettings.h as well and will be done in due course.

  • I would also like to hear feedback on merging the two gun upgrades together while moving the calibre upgrade off the hull upgrade onto one of them.

Skip Equip
  • Priority: Low
  • Status: Work-in-Progress
  • Intention: Personal
  • Filename: SkipEquip.7z
  • Last Edit: 17:00, 11th May
  • This adds a button to the main inventory screen which allows the player to toggle a weapon for auto-equipping. At present it will work on anything which is in the inventory, but will only really affect weapons and armour.

  • If for example a blade is set to “OFF” then upon pressing either “1” or the auto-equip button that item will be skipped. I find this useful because I love to use a boarding axe, but if I accidentally hit the equip button then it will change if I have a “better” blade.

  • Note that, for example, a “fine” weapon is essentially a different weapon to the same one if it is “average”, so the setting would therefore need to be applied individually.

  • This works as intended, but caution is advised because it has been suggested that this could prevent NPCs being properly equipped. I have actually seen enemy crew members repeatedly punching my boarders in the face, so this could indeed be an issue (not that I care, they can punch by bosuns all day long if they like since my officers have muskets). I intend to apply a separate attribute to check the setting, which would avoid any such problems altogether.

  • I would like to have this in a good enough condition to be useful for the mod, but at the moment that is not the case.

Increasing the Maximum Skill
  • Priority: Low
  • Status: Unstable
  • Intention: Build
  • Filename: SkillMax.7z
  • Last Edit: 17:00, 11th May
  • This will properly display the skill values on the character and officer screens should the SKILL_MAX setting in characters.h be set to 20.

  • This does not in itself increase the limit. The SKILL_MAX setting has been applied in both files where it should have been done in the first place, with the duplicate #DEFINE being removed. This has not been tested in respect of increasing the limit, but so long as it remains at 10 then the changes will not actually do anything so there shouldn’t be any testing to do unless it is indeed changed. There may be other files which require attention, I will deal with those should there be a necessity.

  • I’ve marked this as “build” but I am not suggesting to increase it, at least not right now... this is just for putting the changes in place in case anybody does want to alter it (like with companion/officer max).

  • Marked as “unstable” due to potential stack errors if increasing the actual limit. Simply applying the variables is fine but raising the limit will likely be problematic in some places. I’m not sure, but in hindsight I think that whatever the problem is it might actually be more to do with increasing the officer limit - see below.
    It’s working fine for me now, so I dunno. :shrug

Increasing the Officer Limit
  • Priority: Low
  • Status: Unstable
  • Intention: Personal
  • Last Edit: 04:00, 12th May
  • The companion max files have applied the same method to officer limits. Therefore, if you were to change the OFFICER_MAX setting (assuming you have set this, which you should have if you have downloaded the companion files else the game won’t work), then you might find that by recruiting an officer while you already have 3 active will cause them to be added to the list. Generally speaking the interface doesn’t support this, but you will be able to swap them around the first few slots using the passenger list.

  • While the officer icons will be displayed, those in the fifth slot or higher do not have a texture for some reason so they appear blank. I don’t know why that is, hopefully I’ll sort this out.

  • It would be immensely useful if people could test this. While there are no intentions to increase the limit, any feedback would at least be able to be looked at and other modders might also consider doing so.

  • Marked as “unstable” due to potential stack errors if increasing the actual limit. Simply applying the variables is fine but raising the limit will likely be problematic in some places.

    KickingOff.jpg

Save/Load Interface
  • Priority: N/A
  • Status: Final
  • Intention: Build
  • Filename: SaveLoad.7z
  • Last Edit: 19:30, 15th May
  • This alters the behaviour of the movement keys. I changed this because I was getting annoyed with not being able to navigate the saves with ease, and I feel that it is now better than it was before.

Miscellaneous Functions
  • Priority: Low
  • Status: Stable
  • Intention: Personal
  • Last Edit: 17:00, 11th May
  • Random functions which could be included in the build (some may already be in my files)...

    Code:
    int GetNotCaptivePassengerNumber(ref _refCharacter, int findCharacterIdx)
    {
      int psgQuant = GetNotCaptivePassengersQuantity(_refCharacter);
      int cn;
      ref cr;
      for(int i=0; i<psgQuant; i++)
      {
        cn = GetNotCaptivePassenger(_refCharacter,i);
        if(cn==-1) break;
        cr = GetCharacter(cn);
        if(findCharacterIdx==sti(cr.index)) return i;
      }
      return -1;
    }
    
    int ChangeNotCaptivePassenger(ref _refCharacter, int idx, int psngIdx)
    {
      int retVal = GetNotCaptivePassenger(&_refCharacter,idx);
      if(idx>=0)
      {
        string PsgAttrName = "id"+(idx+1);
        _refCharacter.Fellows.Passengers.(PsgAttrName) = psngIdx;
        Characters[idx].passenger = true;
        if (CheckAttribute(&Characters[psngIdx], "passenger")) DeleteAttribute(&Characters[psngIdx], "passenger");
      }
      return retVal;
    }
    
    int RemoveNotCaptivePassenger(ref _refCharacter, ref _refPassenger)
    {
      int i;
      RemoveOfficersIndex(_refCharacter,sti(_refPassenger.index));
      int PsgQuantity = GetNotCaptivePassengersQuantity(_refCharacter);
      int psgNum = GetNotCaptivePassengerNumber(_refCharacter,sti(_refPassenger.index));
      if(psgNum==-1) return PsgQuantity;
    
      aref tmpRef;
      makearef(tmpRef,_refCharacter.Fellows.Passengers);
      string inPsgAttrName,outPsgAttrName;
      for(i=(psgNum+1); i<PsgQuantity; i++)
      {
        inPsgAttrName = "id"+i;
        outPsgAttrName = "id"+(i+1);
        tmpRef.(inPsgAttrName) = tmpRef.(outPsgAttrName);
      }
    
      outPsgAttrName = "id"+PsgQuantity;
      DeleteAttribute(tmpRef,outPsgAttrName);
      PsgQuantity--;
      tmpRef.Quantity = PsgQuantity;
      if (CheckAttribute(_refPassenger, "passenger")) DeleteAttribute(_refPassenger, "passenger"); // KK
      for(i = 0; i < 10; i++)
      {
        string skillName = GetSkillName(i);
        ResetPartySkill(_refCharacter, skillName);
      }
      return PsgQuantity;
    }
    Code:
    bool IsAnOfficer(ref refShip, ref refChar)
    {
       if(CheckAttribute(refChar,"index")) {
         int indChar = sti(refChar.index)
         if (indChar > 0) {
           for (i=1; i<OFFICER_MAX; i++) {
             if (GetOfficersIndex(refShip,i) == indChar) {
               return i
             }
           }
         }
       }
       return false
    }
    
    void MakeOfficersCaptive()
    {
       for (i=0; i<GetNotCaptivePassengersQuantity(refShip1); i++) {
         ref refChar = GetCharacter(GetPassenger(refShip1,i))
         if (IsOfficer(refChar)) {
           if (CheckAttribute(refChar,"prisoned")) {
             if (refChar.prisoned == "1") {
               refChar.chr_ai.group = refChar.prisoned
             }
           }
           refChar.prisoned = true
         }
       }
    }
    
    void MakeOfficersFreed()
    {
       for (i=0; i<GetPassengersQuantity(refShip1); i++) {
         ref refChar = GetCharacter(GetPassenger(refShip1,i))
         if (IsOfficer(refChar) && refChar.chr_ai.group == "0") {
           refChar.chr_ai.group = "player"
           refChar.prisoned = false
         }
         if (IsOfficer(refChar) && refChar.chr_ai.group == "1") {
           refChar.chr_ai.group = "player"
         }
       }
    }

Spawning a Random Officer
  • Status: Final
  • Intention: Personal - Cheat
  • Last Edit: 18:00, 11th May
  • Suffice to say, this spawns a random officer in front of the player.

  • Simply add this to the bottom of the final function in console.c and then hit F12...
    Code:
       CreateOfficerType(GetRandomOfficerType(),rand(SKILL_MAX))

For clarity, the following have been recently changed or added...
Rebalanced Upgrades - I uploaded the original file by mistake, updated. (15th May)

Companion Max - A few unoriginal and irrelevant files crept in there, updated. (15th May)

Calibre upgrade fixed (14th May)

Transfer/Ransack screens displaying the speed and turn for the ships - added. (13th May)

CompanionMax files updated. My “original files” are not always so - seems that I replaced Screwface with Pieter’s dodgy version. xD
I have also found a fair number of files which did not have OFFICER_MAX applied (again, the stories/quests have been skipped for now). (12th May)

Maximum officer limit may now be increased, but this is entirely untested and should be used with extreme caution. (12th May)

Mostly edited over the course of tonight. Check again if you looked earlier. (00:30, 12th May)

WalkingOnWater2.jpg
 

Attachments

  • SkillMax.7z
    14.7 KB · Views: 228
  • SkipEquip.7z
    42.1 KB · Views: 199
  • CompanionMax - Interfaces.7z
    13.9 KB · Views: 233
  • TransferInterfaces.7z
    17.6 KB · Views: 232
  • Compilation.7z
    101.3 KB · Views: 224
  • SpeedTurn.7z
    14.3 KB · Views: 224
  • RebalancedUpgrades.7z
    4.2 KB · Views: 211
  • CompanionMax.7z
    302.4 KB · Views: 207
  • SaveLoad.7z
    12.8 KB · Views: 202
Last edited:
Increasing the Fleet Size
Once you have some "final" versions for this, I think it would be good if players would test it with COMPANION_MAX still set to 4 to see if everything still behaves "as normal".
If it does, then hopefully we can set it to 8 instead and have that as the new Build Default. That'll be cool! :dance

What other changes have you been working on lately? I remember the "Boarding CTD Fix", but I think you were working on some other things too, right?
 
I’ve just put the loot bug in there. ;)

Well, I kinda lose track of what I do change so hopefully this will help me!

I’ve increased the maximum skills to 20, it seems to be working quite well. I will be posting this soon, the only changes will be applying SKILL_MAX where it should have been done anyway and putting in a few checks. As with the companions, it will not do anything unless the #DEFINE is changed (I’ll do it so it only supports either 10 or 20), so nothing will change if it stays at 10.
 
Alright, I think that is pretty much everything I’ve changed which is worth posting.
I’ve certainly got the format of the opening post in order for future use, so it’s all good. :keith

Oh, and then there is this riot! :pirates

sevenofficers-jpg.26941
 
Last edited:
Going through your various files now and am writing down whatever comments I run into along the way:

CompanionMax
The following files seem to contain stuff not related to "companion max":
items.c
itemsbox.c
kam_shiptransfer.c
passengers.c
transfer_characters.c

I'm not sure what of that is stable enough to include in the mod right now.

Compilation
This can probably be made generic:
Code:
int GetAlphaFromSkill(int nskill)
{
   if (SKILL_MAX == 10) {
     switch(nskill) {
       case 0:     return 55;   break;
       case 1:     return 75;   break;
       case 2:     return 95;   break;
       case 3:     return 115;   break;
       case 4:     return 135;   break;
       case 5:     return 155;   break;
       case 6:     return 175;   break;
       case 7:     return 195;   break;
       case 8:     return 215;   break;
       case 9:     return 235;   break;
       case 10:   return 255;   break;
     }
     return 0;
   }
   if (SKILL_MAX == 20) {
     switch(nskill)
     {
       case 0:     return 60;   break;
       case 1:     return 70;   break;
       case 2:     return 80;   break;
       case 3:     return 90;   break;
       case 4:     return 100;   break;
       case 5:     return 110;   break;
       case 6:     return 120;   break;
       case 7:     return 130;   break;
       case 8:     return 140;   break;
       case 9:     return 150;   break;
       case 10:   return 160;   break;
       case 11:   return 170;   break;
       case 12:   return 180;   break;
       case 13:   return 190;   break;
       case 14:   return 200;   break;
       case 15:   return 210;   break;
       case 16:   return 220;   break;
       case 17:   return 230;   break;
       case 18:   return 240;   break;
       case 19:   return 250;   break;
       case 20:   return 255;   break;
     }
     return 255;
   }
}

ransack_main.c do you know what is the general idea of this section?
Code:
void SetVariable()
{
   bool bShown = true;
   if(GetCompanionQuantity(GetMainCharacter())==2)
   {
     if(GetCompanionIndex(GetMainCharacter(),1)==nCompanionIndex || GetCompanionIndex(GetMainCharacter(),1)==GetCharacterIndex("Quest trader")) bShown = false;
   }
   if(GetCompanionQuantity(GetMainCharacter())==COMPANION_MAX-1)
   {
     if(GetCompanionIndex(GetMainCharacter(),1)==nCompanionIndex || GetCompanionIndex(GetMainCharacter(),2)==nCompanionIndex)
     {
       if(GetCompanionIndex(GetMainCharacter(),1)==GetCharacterIndex("Quest trader") || GetCompanionIndex(GetMainCharacter(),2)==GetCharacterIndex("Quest trader")) bShown = false;
     }
   }

RebalancedUpgrades
This file seems to be the unmodded Beta 4 version?
Please upload your changed versions, including "Ships.c".


SkillMax
I think there may be some confusion between "SKILL_MAX" and "MAX_CHARACTER_SKILL".
There are two independent variables::
MAX_CHARACTER_SKILL indicates the maximum number of skill points per skill
SKILL_MAX is the number of different skills that exist in the game (e.g. Leadership/Sailing/Commerce/Etc.)
 
Last edited:
For your reference, please find attached all files in my own game version that are different compared to Beta 4.
This includes some of your stuff, but not all. Please compare this to your own game version and check if I missed out on anything important.
There are also some slight changes included to your own stuff.
 
Save/Load Interface
What exactly did you change here?

I also found the reason for this:
Code:
//SetFirstButton(); // PB: Why do I need to do this? // MM: Good question - nuked
With that line enabled, you can press "Load" from the Main Menu, then [Enter] and immediately load the save.
Annoying part is that it does so after EVERY scroll.

I think attached alternative works better.
 

Attachments

  • save_load.c
    56.3 KB · Views: 198
For your reference, please find attached all files in my own game version that are different compared to Beta 4.
This includes some of your stuff, but not all. Please compare this to your own game version and check if I missed out on anything important.
There are also some slight changes included to your own stuff.
See attached for a much more complete version including all files different from Beta 4 + all files different from your own uploads.
Also includes some extra fixes I did today.
 

Attachments

  • PB_Code_15May2016_v2.zip
    1.6 MB · Views: 175
CompanionMax
The following files seem to contain stuff not related to "companion max":
items.c <----- This has a single entry for GetCompanionIndex() - what it does I don’t know
itemsbox.c <----- That shouldn’t be in there, removed from archive
kam_shiptransfer.c <----- Wrong file uploaded, that is not the original
passengers.c <----- Only things different here are removal of a duplicate line and addition of captives in the scroll (not sure if or when I did this)
transfer_characters.c <----- No companion entries, all relate to the officer max
All of the files in that archive should be based on the originals. There should be no other edits going on, if there are any then I need to remove them. If in doubt with that particular archive, just look at the companion/officer max variables since they are the only changes relevant. [new link]

Compilation
This can probably be made generic:
Code:
int GetAlphaFromSkill(int nskill)
{
   if (SKILL_MAX == 10) {
     switch(nskill) {
       case 0:     return 55;   break;
       case 1:     return 75;   break;
       case 2:     return 95;   break;
       case 3:     return 115;   break;
       case 4:     return 135;   break;
       case 5:     return 155;   break;
       case 6:     return 175;   break;
       case 7:     return 195;   break;
       case 8:     return 215;   break;
       case 9:     return 235;   break;
       case 10:   return 255;   break;
     }
     return 0;
   }
   if (SKILL_MAX == 20) {
     switch(nskill)
     {
       case 0:     return 60;   break;
       case 1:     return 70;   break;
       case 2:     return 80;   break;
       case 3:     return 90;   break;
       case 4:     return 100;   break;
       case 5:     return 110;   break;
       case 6:     return 120;   break;
       case 7:     return 130;   break;
       case 8:     return 140;   break;
       case 9:     return 150;   break;
       case 10:   return 160;   break;
       case 11:   return 170;   break;
       case 12:   return 180;   break;
       case 13:   return 190;   break;
       case 14:   return 200;   break;
       case 15:   return 210;   break;
       case 16:   return 220;   break;
       case 17:   return 230;   break;
       case 18:   return 240;   break;
       case 19:   return 250;   break;
       case 20:   return 255;   break;
     }
     return 255;
   }
}
When you say “generic”, do you mean a single global function?

ransack_main.c do you know what is the general idea of this section?
Code:
void SetVariable()
{
   bool bShown = true;
   if(GetCompanionQuantity(GetMainCharacter())==2)
   {
     if(GetCompanionIndex(GetMainCharacter(),1)==nCompanionIndex || GetCompanionIndex(GetMainCharacter(),1)==GetCharacterIndex("Quest trader")) bShown = false;
   }
   if(GetCompanionQuantity(GetMainCharacter())==COMPANION_MAX-1)
   {
     if(GetCompanionIndex(GetMainCharacter(),1)==nCompanionIndex || GetCompanionIndex(GetMainCharacter(),2)==nCompanionIndex)
     {
       if(GetCompanionIndex(GetMainCharacter(),1)==GetCharacterIndex("Quest trader") || GetCompanionIndex(GetMainCharacter(),2)==GetCharacterIndex("Quest trader")) bShown = false;
     }
   }
I honestly don’t know. There are two buttons (left and right) to change character in the INI file, I guess somebody had an idea which was never actually implemented, or was removed.

RebalancedUpgrades
This file seems to be the unmodded Beta 4 version?
Please upload your changed versions, including "Ships.c".
Whoops! [link]

SkillMax
I think there may be some confusion between "SKILL_MAX" and "MAX_CHARACTER_SKILL".
There are two independent variables::
MAX_CHARACTER_SKILL indicates the maximum number of skill points per skill
SKILL_MAX is the number of different skills that exist in the game (e.g. Leadership/Sailing/Commerce/Etc.)
Ooooh, well what I’ll probably do then is add another global define for MAX_CHARACTER_SKILL.

Save/Load Interface
What exactly did you change here?

I also found the reason for this:
Code:
//SetFirstButton(); // PB: Why do I need to do this? // MM: Good question - nuked
With that line enabled, you can press "Load" from the Main Menu, then [Enter] and immediately load the save.
Annoying part is that it does so after EVERY scroll.
Basically, the navigational buttons seemed a bit erratic. Now they will move around in a much better fashion. No functionality changes have been made, it’s only about the movement of the keys. As for SetFirstButton(), yes that is precisely why I removed it and it no longer does that.

See attached for a much more complete version including all files different from Beta 4 + all files different from your own uploads.
Also includes some extra fixes I did today.
I will take a look at all of this. :onya

Oh, and ships.c (few random things in there, but the single line is obvious)...
 

Attachments

  • Ships.c
    34.3 KB · Views: 263
Last edited:
Currently the changes are made to KB_routines.c alone and this should not be the case, they need to be properly applied to InternalSettings.h as well and will be done in due course.
I have done part of that already now. See attached. :doff
Probably the only thing that needs doing is an update to the comments in InternalSettings.h .
 

Attachments

  • RebalancedUpgrades_PB.zip
    26.9 KB · Views: 160
Alright, I’ll crack on with all this over the next few hours.

Oh, while you’re looking through stuff you might as well have a quick glance at this...
 

Attachments

  • UniqueShips.c
    20.2 KB · Views: 228
When you say “generic”, do you mean a single global function?
I mean to remove the switch like this:
Code:
int GetAlphaFromSkill(int nskill)
{
   return makeint(255-(MAX_CHARACTER_SKILL-nskill)*20*(10/MAX_CHARACTER_SKILL));
}
Probably that could be simplified a bit, but I think that should work for any MAX_CHARACTER_SKILL value.

I honestly don’t know. There are two buttons (left and right) to change character in the INI file, I guess somebody had an idea which was never actually implemented, or was removed.
Fair enough. :doff

Thanks! :cheers

Ooooh, well what I’ll probably do then is add another global define for MAX_CHARACTER_SKILL.
I've already done it in my files. Check my ZIP above. ;)

Basically, the navigational buttons seemed a bit erratic. Now they will move around in a much better fashion. No functionality changes have been made, it’s only about the movement of the keys. As for SetFirstButton(), yes that is precisely why I removed it and it no longer does that.
Indeed I noticed that now if I press [Up], it goes immediately to the save scroll instead of to the Profiles button.
That'll take some getting used to for me, but does actually make sense.
I also notice you can't use the [Down] button anymore when you're already at the bottom of the interface.
It used to then jump back up to the top.

Oh, and ships.c (few random things in there, but the single line is obvious)...
Thanks! Looks like I had it in the wrong spot, because your line numbers are different from mine.

Two notes:
- Could you please add a ";" at the end of all lines? I'm not sure how crucial that is, but the game code can be surprisingly touchy about silly things like that. :facepalm
- You're missing out on this fix of mine:
Code:
  aref natstats; atrstr = "n" + nat;
   if(!CheckAttribute(shipstatsmult,"n"+nat)) atrstr = "n"; // PB: Use default values if none defined
   makearef(natstats, shipstatsmult.(atrstr)); //these are our multipliers
 
Oh, while you’re looking through stuff you might as well have a quick glance at this...
I wonder if your names lists should look like this:
Code:
"Sir Thomas Pasley, Sir William Hope
Or like this:
Code:
"Sir Thomas Pasley,Sir William Hope
With one space less. That second one might be required if you get an opening space returned from the Random String function.

"HMS_Bounty" and "EdinburghTrader" are treated as generic ships and I don't think those need to be limited.

You should leave the "HMS" out of the names, because that should be automatically be appended for navy ships later.
 
I mean to remove the switch like this:
Code:
int GetAlphaFromSkill(int nskill)
{
   return makeint(255-(MAX_CHARACTER_SKILL-nskill)*20*(10/MAX_CHARACTER_SKILL));
}
Probably that could be simplified a bit, but I think that should work for any MAX_CHARACTER_SKILL value.
I was thinking that something like this would work, which would be immensely useful for any maximum skill value. That certainly seems like it’s what we need!

Indeed I noticed that now if I press [Up], it goes immediately to the save scroll instead of to the Profiles button.
That'll take some getting used to for me, but does actually make sense.
Yeah, I tweaked the other buttons as well so that they do go to the profiles button, otherwise it could have been inaccessible by using the keyboard alone.
I also notice you can't use the [Down] button anymore when you're already at the bottom of the interface.
It used to then jump back up to the top.
Should I put that back?
Thanks! Looks like I had it in the wrong spot, because your line numbers are different from mine.
This is partly why I use the original files, so that it’s easier to find/replace stuff.

- Could you please add a ";" at the end of all lines? I'm not sure how crucial that is, but the game code can be surprisingly touchy about silly
things like that. :facepalm
Are you being serious? Do you have any idea how much I hate them? It’s actually not crucial at all unless the function is all on one line. It can be a bit fiddly if returns are used, mind you. Personally, I find it to be much tidier and easier to read without them. I also think it’s an old habit from when the code was first being used but has probably been updated to not actually require them if the lines are broken up. I dunno, PHP still requires it so I’ll probably go breaking my website now by forgetting to use them.

- You're missing out on this fix of mine:
Code:
  aref natstats; atrstr = "n" + nat;
   if(!CheckAttribute(shipstatsmult,"n"+nat)) atrstr = "n"; // PB: Use default values if none defined
   makearef(natstats, shipstatsmult.(atrstr)); //these are our multipliers
Where is this supposed to go?

I wonder if your names lists should look like this:
Code:
"Sir Thomas Pasley, Sir William Hope
Or like this:
Code:
"Sir Thomas Pasley,Sir William Hope
With one space less. That second one might be required if you get an opening space returned from the Random String function.
I was wondering about this, so I will remove those spaces.

"HMS_Bounty" and "EdinburghTrader" are treated as generic ships and I don't think those need to be limited.
The idea here is to have a unique ship with a unique captain. I mean, aren’t they duplicate ships anyway? Either way, whether or not they’re actually unique at the moment isn’t a concern, I will look at that later on... probably they won’t be, but it’s easily changed.

You should leave the "HMS" out of the names, because that should be automatically be appended for navy ships later.
I actually keep changing that, so I just stuck it in there for the time being and will remove them if necessary. The thing is, if we override the names then will the HMS actually be appended?
 
Last edited:
Should I put that back?
I wouldn't mind if you did, but it isn't exactly high priority.

Where is this supposed to go?
See my copy of Ships.c . It is the fix for this bug:
Fixed - Ships with no HP or speed in Shipyard | Page 2 | PiratesAhoy!

The idea here is to have a unique ship with a unique captain. I mean, aren’t they duplicate ships anyway?
Bounty is blue while Edinburg Trader is green.

The thing is, if we override the names then will the HMS actually be appended?
It will. Look up "ShipNamePrefix" in Ships.c . :yes
 
I wouldn't mind if you did, but it isn't exactly high priority.
No worries, I will do that. I just thought it was pointless but there’s no harm in it being there.

Bounty is blue while Edinburg Trader is green.
Ah, okay. Anyway, the stuff I’m putting in there which already exists is mostly for reference so that I can keep it all in one place. Later on I’ll add the unique names to the existing ships where relevant and remove the duplicates I’ve made. My file doesn’t even get called, it’s just there for me to make the edits.

It will. Look up "ShipNamePrefix" in Ships.c . :yes
I have noticed the code for appending it, I just thought that if we bypass creating a random name altogether or just apply a new name afterwards, then it either wouldn’t be looked at at all or not a second time around. I haven’t even got around to looking at encounter generation anyway so I dunno really.
 
No worries, I will do that. I just thought it was pointless but there’s no harm in it being there.
That's why I said it is low priority. Doesn't matter much either way. ;)

I have noticed the code for appending it, I just thought that if we bypass creating a random name altogether or just apply a new name afterwards, then it either wouldn’t be looked at at all or not a second time around. I haven’t even got around to looking at encounter generation anyway so I dunno really.
GetMyShipName and GetMyShipNameShow are called from all sorts of places.
Almost whenever you see a ship name, it is supposed to be run through one of those two functions.

Your changes just set the refCharacter.Ship.Name attribute, right?
That attribute is then later read by those two other functions that will append "HMS"/"USS".
 
Actually, is refCharacter.Ship.Name even used? Since ships get a random name, what purpose does this serve? A new ship doesn’t have a name, does it? I mean, if I buy a ship from the shipwright then it gets the name which is set on the captain, not the ship (because it doesn’t have one). I was actually considering removing all of those entries in ship init just to see if anything changed - I was thinking that nothing would.

Bear in mind that the text on the icons looks at refCharacter.Ship.SName... I think.

What I mean is this, for example (not the character’s own attributes, which I think is what you meant)...

refShip.Name = "RN_SuperiorWarship"

The actual text for that is “Arrogant class 3rd Rate”, but no ship will ever end up with this as its name.
 
Last edited:
Back
Top