• 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 Unarmed Shore Crewmembers

Jason

Buccaneer
Storm Modder
This guy. No weapons, no fight, and you can't talk to him to dismiss him. beta 4.1 May 17.
 

Attachments

  • Unarmed crew.jpg
    Unarmed crew.jpg
    970.4 KB · Views: 161
Try this.

Here it is finally.
 

Attachments

  • -=Player=- Cuba.rar
    458.6 KB · Views: 124
Last edited by a moderator:
@Jason: Is that the correct savegame? Who are all those enemies?

I can indeed confirm that crewmember has no weapons.
Maybe @Jack Rackham could have a quick look at that one? He added that "crewmember auto equipping" feature.

But his dialog works quite fine and I could dismiss him without a problem.
 
I don't get any weapons in compile.log missing. There are a lot of weapons given to crewmembers in LAi_init.c
but impossible for me to say what went wrong here,
 
There are a lot of weapons given to crewmembers in LAi_init.c
Thanks for reminding me what file it was! Fixed now. :doff

I replaced this section:
Code:
            string right_blade;
         //---------------------------------------------------------------------------------------------------    

             if(CheckAttribute(blade2, "price"))
             {
               if(blade2.price >= 8000)
               {
                 right_blade = "blade34";
               }
               else
               {
                 if(blade2.price >= 4000)
                 {  
                   right_blade = "blade24";
                 }
               }
               else
               {
                 if(blade2.price >= 1000)
                 {  
                   right_blade = "blade31";
                 }
               }
               else
               {
                 if(blade2.price >= 500)
                 {  
                   right_blade = "blade12";
                 }
               }
               else
               {
                 if(blade2.price >= 250)
                 {  
                   right_blade = "blade10";
                 }
               }
               else
               {
                 if(blade2.price >= 50)
                 {  
                   right_blade = "blade4";
                 }
               }
               else
               {
                 if(blade2.price >= 2)
                 {
                   //anything better than fists  
                   right_blade = "barmansknife";
                 }
               }
               else
               {
                 //player has fists only
                 right_blade = "bladeX4";
               }
             }
With this:
Code:
            string right_blade = "bladeX4";
         //---------------------------------------------------------------------------------------------------    

             if(CheckAttribute(blade2, "price"))
             {
               if(blade2.price >= 2)     right_blade = "barmansknife";   //anything better than fists
               if(blade2.price >= 50)     right_blade = "blade4";
               if(blade2.price >= 250)     right_blade = "blade10";
               if(blade2.price >= 500)     right_blade = "blade12";
               if(blade2.price >= 1000)   right_blade = "blade31";
               if(blade2.price >= 4000)   right_blade = "blade24";
               if(blade2.price >= 8000)   right_blade = "blade34";
             }
The original code had an "if-else-else" construct, which I would strongly recommend against.
While the game doesn't error out on it, it isn't valid code either and I wouldn't trust it to do what you have in mind.

I also replaced this:
Code:
if(!IsEquipCharacterByItem(crew, right_blade))
With this:
Code:
if(CheckCharacterEquipByGroup(crew, BLADE_ITEM_TYPE) != right_blade)
It is possible for a character to have a certain item equipped, without actually having that item.
I ran into that problem years ago when I did the Quick-Equip key functionality.
That seems to have occurred here as well. :facepalm

I think it now still does what you intended, but should be a bit more reliable.
Save attached file to PROGRAM\Loc_ai to try.
 

Attachments

  • LAi_init.c
    15.9 KB · Views: 157
Annoying, isn't it?

The reason is that the "equip" is saved as ch.equip.blade = "blade1"; and "having an item" is saved as ch.items.blade1 = 1;
The two aren't at all related, so you could have that equip.blade attribute set, without having the item.
That can happen if you used to have that item and had it equipped, but the item was taken away from you.
 
Back
Top