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

Included in Build Locking cargo of some quest characters

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
Also, if you have a savegame just PRIOR to selling the goods, that could be a nice testing case to check what is happening here.

This is the related code from PROGRAM\DIALOGS\Smuggler_OnShore_dialog.c:
Code:
        case "Leave_goods":
            int total_smuggle = 0;
            int goods_index = FindFirstContrabandGoods(Pchar);
            if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip1")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
                RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
            }
            goods_index = FindNextContrabandGoods(Pchar);
            if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip2")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
                RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
            }
            goods_index = FindNextContrabandGoods(Pchar);
            if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip3")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
                RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
            }
            goods_index = FindNextContrabandGoods(Pchar);
            if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip4")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
                RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
            }

GetSquadronGoods automatically checks all ships in your fleet:
Code:
int GetSquadronGoods(ref _refCharacter,int _Goods)
{
    int i,cn;
    ref chref;
    int retVal = GetCargoGoods(&_refCharacter,_Goods);
    for(i=1; i<4; i++)
    {
        cn = GetCompanionIndex(&_refCharacter,i);
        if(cn!=-1)
        {
            chref = GetCharacter(cn);
            if (IsTrader(chref)) continue; // KK
            if( GetRemovable(chref) || _Goods == GOOD_WHEAT || _Goods == GOOD_RUM) // LDH 13Oct06 fix for quest ships
            {
                retVal = retVal + GetCargoGoods(chref,_Goods);
            }
        }
    }
    return retVal;
}
And RemoveCharacterGoods affects all ships in the fleet too:
Code:
int RemoveCharacterGoods(ref _refCharacter,int _Goods,int _Quantity)
{
    int i,cn,curQuantity;
    string goodsName = Goods[_Goods].name;

    for (i=0; i < 4; i++)
    {
        cn = GetCompanionIndex(_refCharacter,i);
        if(cn!=-1)
        {
            if (IsTrader(GetCharacter(cn))) continue; // KK
            curQuantity = sti( Characters[cn].Ship.Cargo.Goods.(goodsName) );
            if(curQuantity>=_Quantity)
            {
                Characters[cn].Ship.Cargo.Goods.(goodsName) = curQuantity - _Quantity;
                RecalculateCargoLoad(&Characters[cn]);
                return true;
            }
            Characters[cn].Ship.Cargo.Goods.(goodsName) = 0;
            _Quantity = _Quantity - curQuantity;
            RecalculateCargoLoad(&Characters[cn]);
        }
    }
    Trace("Overup cargo space on "+_Quantity);
    return false;
}

So if I understand correctly from that code, if the cargo got removed from your player ship, that same function should have affected your companions too.
Unless those companions are "locked" or are traders, of course.

But if they're "locked", you shouldn't even have been able to put the contraband ON their ships.
And characters are only considered "traders" based on one very specific officer type:
Code:
bool IsTrader(ref _refCharacter)
{
    int findIdx = -1; // KK
    if (CheckAttribute(_refCharacter, "index"))
        findIdx = sti(_refCharacter.index); // changed by MAXIMUS
    else
        return false;

    // PB: Just check single character officer type -->
    if (GetAttribute(_refCharacter, "quest.officertype") == OFFIC_TYPE_TRADER)    return true;
    else                                                                        return false;
    // PB: Just check single character officer type <--
/*
    // PB: What was this supposed to be doing?
    ref mc = GetMainCharacter();
    for (int i = 1; i < 4; i++)
    {
        if (GetCompanionIndex(mc, i) == findIdx && CheckAttribute(&Characters[findIdx], "quest.officertype") == true && Characters[findIdx].quest.officertype == OFFIC_TYPE_TRADER) return true;
    }
    return false;
*/
}
But that should only ever get applied to one single character ID in the game, the "Quest trader" who joins you for the Escort Quests.

In other words: I don't get it. :confused:
 
While ideally Thomas the Terror SHOULD be locked like other quest ships that aren't yours, I remember that indeed he isn't.
So he should behave like any companion that IS actually yours to command.

What exactly needs changing with the dialog here?
 
I believe giving him the TRADER officertype should lock his cargo and stuff but I don't think we want that.
So I think we should then add a extra check in IsTrader for a specific character attribute, and give this to everyone who's cargo should be locked out too
Already exists:
Code:
SetCharacterRemovable(characterFromID("Virgile Boon"), false);
That just isn't set for Thomas the Terror. Should be easy enough to add.
 
This seems to have been moved out of a different thread, probably one which I haven't been following, so I don't know what went on before. Which characters' cargo are you already locking?
 
This seems to have been moved out of a different thread, probably one which I haven't been following, so I don't know what went on before. Which characters' cargo are you already locking?
We're talking about side quest companions like Thomas the terror who have a ship. Their cargo should be locked, so question is if you know any more of these kind of characters
 
As I said, I don't know what has been said before in whatever thread spawned this one. Looking at the Wiki section on Side Quests, the ones which have companion ships that may need to be locked if they are not already locked are:
Escort Vigila Mendes' Ship - Vigila Mendes, Juno
Strange Things Going On in the Archipelago - Mergildo Hurtado, Montanez
The French Pirate in the Tavern - Claire Larrouse, Cheri
The Silver Train - Will Turner, The Adventurer

But Thomas the Terror isn't in one of those side quests, he's part of a main storyline, "Jack Sparrow". There are quite a lot of such companions throughout various storylines. Pick one, go through its "quests_reaction.c", and search for "SetCompanionIndex", which is where someone is joining your fleet. I could make such a list, but it would help if I knew which ones you already know. ;)

Hornblower has a couple, for a start:
Captain Keene, Justinian
Lt. Uriah Quelp, Resource
 
Looks like SetCharacterRemovable DOES include locking the ship and cargo.
I've tested it on Thomas the Terror and that works:
Code:
    case "Sailing for Oxbay with Thomas":
       Pchar.Quest.Now_in_Oxbay_from_Cayman.over = "yes";

       SetCompanionIndex(Pchar, -1, GetCharacterIndex("Thomas the Terror"));
       SetCharacterRemovable(characterFromID("Thomas the Terror"), false); // PB
       setCharacterShipLocation(characterFromID("Thomas the Terror"), "Cayman_Port");

Mergildo Hurtado, Vigila Mendes, Claire Larrouse and Will Turner were already set up with that line, so no action needed there.
I did add it to a whole bunch of other characters though, mainly in the Hornblower and Jack Sparrow storylines.

This may have some unexpected side-effects here and there, but we'll deal with those if and when those come to light.
It does make sense to not allow the player to do whatever he wants with certain companion ships, doesn't it? :cheeky
 
haven't heard any weird side effects yet so going to set this as done for now else we will see a bug Report popping up again :).
 
Indeed this one can only be commented on from thoroughly testing the various storylines.
That'll take a while. We'll see once Beta 4 is actually in a steady state. :yes
 
Back
Top