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

Fixed Officer Repeatedly Auto-Equipping

Hylie Pistof

Curmudgeon
QA Tester
Storm Modder
Pirate Legend
It may be that this install has become corrupted but I am running into too many exploits.

The contraband not being taken by the smugglers is known.

There is a reliable source of good swords at Martinique in Oldfhart. I have over a dozen and just stopped taking them.

A Captain surrendered to me and became an officer. He came equipped with a Corsairs Pride, which I took and gave him another sword. But at the next screen change he had a Corsairs Pride again! He also decided to re-equip himself with a three small pistol set instead of a single big pistol. So now I am collecting swords from him as I please at every screen change. Soon I will just have to stop I suppose.
 
There is a reliable source of good swords at Martinique in Oldfhart. I have over a dozen and just stopped taking them.
Should the "Fort Reinforcements" trick perhaps be applied to that guy as well?
That would at least make it harder to steal from him, even if it doesn't become impossible.

A Captain surrendered to me and became an officer. He came equipped with a Corsairs Pride, which I took and gave him another sword. But at the next screen change he had a Corsairs Pride again! He also decided to re-equip himself with a three small pistol set instead of a single big pistol. So now I am collecting swords from him as I please at every screen change. Soon I will just have to stop I suppose.
Wait, what? WHAT!?!? Does he even have those items he equips or do they "magically appear"?
The only characters that should auto-equip are your shore crewmembers, but those are NOT officers.
@Jack Rackham, have you got any clue if there is a way for that code to trigger for different characters?
 
The way to do town guards is to get at extreme range and then nail them. That keeps any fighting from happening and then they can be robbed. Killing them often starts the fighting with reinforcements coming. And the one time I tried it they just kept coming. Oldfhart is stuck on stunned and I can rob him anywhere.

That Captain had those items and I took them and re-equiped him with better stuff, but now he loses the good sword and pistol and equips the stuff he started with. The other things I gave him all are ok.
 
The only characters that should auto-equip are your shore crewmembers, but those are NOT officers.
Yes, and to be sure I just checked, officers weapons are not changed when the player changes his arsenal.
But the crewmembers are.

First, are we sure it's the landcrew code that makes him reequip those weapons? Hylie says he came equipped with those
items. Sounds like when you hire an ordinary officer.

have you got any clue if there is a way for that code to trigger for different characters?
It's in LAi_init.c under if (LANDCREWMEMBERS).
Shouldn't that exclude officers?

To be certain we could always add something like if(!IsOfficer) etc
 
First, are we sure it's the landcrew code that makes him reequip those weapons? Hylie says he came equipped with those
items. Sounds like when you hire an ordinary officer.
No, we're not sure of that at all. Just trying to think of random causes that might be the reason.
But right now we don't know anything for sure. Perhaps we need @Hylie Pistof's savegame for this.
 
@Hylie, if you could get some crewmembers to escort you (and that strange officer),
we can see if he's equipping the cremembers stuff or if he's up to someting completely
different.
 
@Hylie, if you could get some crewmembers to escort you (and that strange officer),
we can see if he's equipping the cremembers stuff or if he's up to someting completely
different.

He is definitely equipping himself with his stuff. The crew has no Corsairs Pride swords or small 3 pistol sets.
 
No. Never.

Here is a save with him in it. Devlin Opera.
 

Attachments

  • -=Player=- Isla do Palo Brasil.7z
    608.8 KB · Views: 58
Last edited:
I have tested the savegame: went to the ship and ordered 2 crewmembers to be added to the escort.
2 standard officer + 1 officer who doesn't behave + 2 crewmembers.
3 different set of weapons. So my guess is it's not the landcrew code.
 
But then what code IS responsible!?!?
Even if you don't take any of that bad officers weapons he get 1 extra set of small pistols for each
reload to a new location. Here's the BUG?
Corsair's Pride: 1 new only if you have taken his.
 
Maybe it is the soldier code? They get auto-equipped on location reloads too.
How did you hire this guy? Did you say he used to be captain of an enemy ship?
 
PROGRAM\Period.c find:
Code:
void GiveSoldierWeapon(ref curchar, int iNation)
{
   if(GetAttribute(curchar, "auto_weapons") == "off") return;     //JRH: skip auto given and equipped weapons
Replace with;
Code:
void GiveSoldierWeapon(ref curchar, int iNation)
{
   return;
If my suspicion is correct, then that will put an end to this behaviour.
This isn't a fix, of course, but at least proves where the problem comes from.
 
I see that "auto_weapons" was something I added for enemies with rockets. That attribute only exists in
TempQuestEnemy.c of the Bartolomeu storyline.
 
Yep, I remember that. I'm not suggesting actually removing your code there for real;
it's just a simple way to disable that function altogether for testing purposes.
In fact, if that does prove to be the problem, we may be needing a similar lines for any characters in the player group.
 
PROGRAM\NATIONS\nations.c find;
Code:
int isSoldier(ref ch)
{
   if (!TestRef(ch)) return -1;
   if (CheckAttribute(ch, "isSoldier") && sti(ch.isSoldier) == true) {
     if (CheckAttribute(ch, "nation")) return sti(ch.nation);
     if (CheckAttribute(ch, "location")) return GetLocationNationFromID(ch.location);
     return GetCurrentLocationNation();
   }
Replace with:
Code:
int isSoldier(ref ch)
{
   if (!TestRef(ch)) return -1;
   if (CheckAttribute(ch, "isSoldier") && sti(ch.isSoldier) == true) {
     if (IsOfficer(ch) || IsCompanion(ch) || IsPassenger(ch)) // PB: No Soldier Behaviour for Player Party
     {
       DeleteAttribute(ch, "isSoldier");
     }
     else
     {
       if (CheckAttribute(ch, "nation"))   return sti(ch.nation);
       if (CheckAttribute(ch, "location"))   return GetLocationNationFromID(ch.location);
       return GetCurrentLocationNation();
     }
   }
That'll teach all characters in your player party that if they were soldiers before, they aren't now!
Problem fixed, exploit is no more.... :whipa
 
That guy was a ship Captain who surrendered and then agreed to work for me as an officer.
 
Back
Top