• 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 Blocking worst weapons from everyone

Tingyun

Corsair
Storm Modder
It seems from conversation here: Unconfirmed Bug - Navy Soldiers not blocked from inappropriate weapons | PiratesAhoy!

That it might be true that people don't want any enemies ever using the worst weapons (knives, tools, etc).

If that is the case, the attached files will remove any chance of them being used.

If that isn't the case, and people want them just not on nationality ships other than pirates, then we can pursue simply fixing the function in the linked thread.

Either way, that one will need to be fixed to block the wrong types of nationality weapons, but it seems like people might also want this too, as they don't seem to like knives and tools as weapons on enemies.

program/items and program/loc_ai

EDIT: note, incorperates changes to Tizona from other thread.

Will need playtesting and possible tweaking to make sure it is working right. It is just a matter of setting the min level for proper swords at 2, keeping the tools and knives at 1, and then clamping the min level for npcs at 2 (but not for guns, just for swords).

EDIT2: didn't work sadly, as Ansel confirms, now thinking instead we should just add a itm.skipequip to each item we don't want, see bottom post.
 
Last edited:
I personally do think the "tools" should be used somewhere somehow, otherwise they might as well not exist. :facepalm
 
Tools is use by treasure hunting. Maybe the carpenter should have specific tools, to do
his job well. And the doctor need tools and so on.
 
Technically they can still be used in combat when the player fights someone during digging, happens often in the maltese crypt when something pops out and attacks.

BTW, this "needs testing" most certainly. It might need tweaking to work right anyway, and I no longer have the luxury of being able to playtest.

And maybe we don't want to do this after all. I don't know, the choices seem to be:

1) Just fix the function in the other thread, meaning pirates can end up with the terrible weapons, but only them

2) Fix the function in the other thread, AND make some seperate code to block everyone but bandits from these worst weapons

3) Fix the function in the other thread and use this sort of min level thing here (probably with the files fixed up after testing), and just make them basically player only.

I have no strong opinions, but @ANSEL makes a good point about Pirates liking good weapons, just since I'm going to disappear again and not be able to provide support, I wanted to offer this alternate stronger solution if it ends up being desired.
 
Two tools are used for Treasure Hunting as @ANSEL points out.
If the other ones won't show up in random use, I reckon they should be given an alternate purpose at least.
 
Barfights could be given the possibility of giving only bread knives or daggers at a random chance instead of fists. That is a possibility for some of them.

The axes and hatchets could be moved to min level 2, if we think they are appropriate weapons for general use.

That might take care of almost all of them.

Sorry really have to run now, I look forward to seeing everyone soon!:)
 
@Grey Roger @Tingyun : Tinguyn your fix dont work on the tools problem, it's still
there. But it brings the officers back to join the boarding , and the dialog , if the should
join you or not, is working well now. This is odd, but I think it's the way it works.
 
@ANSEL It shouldn't have done anything to boarding! Literally all I did was switch the min weapon term and a couple of designations.

Perhaps some very specific conditions determine whether they join you on boardings or not, ie whether the bug happens.

Thanks for the report, I have a quick moment and there is something else I can try. Holdon and let me see if I can fix it another way.
 
Ok, since @ANSEL confirms this did not fix it, the best option seems to be to add a

itm.skipequip

designation to each weapon we don't want to be equiped normally--tools and knives basically.

There doesn't seem to be an option for that in the weapon array for normal weapons, but many special weapons have it defined, so it seems like it should be easy to do.

Going to have to run, sorry I can't do a completed version of that myself right now. If someone else can't do it, but can give me some guidance as to how, I can get it it for sure in about 2 weeks when the project wraps up.
 
@Tingyun no problem you don't have to rush it. this is a low priority bug :).
 
I think the main issue is my own incompetence, in that I don't know how to make an itm.skipequip entry for weapons that appear in the main array in items_init, rather than being listed seperately. The array doesn't haven't a column for that.

If I knew how to do that, it would be an easy thing to just include that entry for all the tools and knives. Someone must know?
 
If I knew how to do that, it would be an easy thing to just include that entry for all the tools and knives. Someone must know?
It isn't exactly obvious if you don't already know, so no "incompetence" on your part there. :no

Luckily, I do know. You need to add to this section of code in initItems.c:
Code:
  switch(id)
  {
     case "bladelead":     blade.stun = 0.10;               // Stun enemies
                 blade.skipequip = NO_SPECIALWEAPONED_NPC;   // Random characters don't use them
                 blade.skiptrade = true;             // Not sold from regular traders
                 blade.sneaky = true;     break;       // PB: Sneaky Trader
     case "bladeclub":     blade.stun = 0.75;               // Stun enemies
                 blade.skipequip = NO_SPECIALWEAPONED_NPC;   // Random characters don't use them
                 blade.skiptrade = true;             // Not sold from regular traders
                 blade.sneaky = true;             // PB: Sneaky Trader
                 blade.sound = "OBJECTS\DUEL\club2.wav";   break;   //JRH
     case "blade1" :       blade.param.time  = 0.05;   break;       // special case
     case "blade24":       blade.param.time  = 0.05;   break;       // special case
     // PB: Who would want to buy this? -->
     case "Barmansknife":   blade.skipsell = true;     break;
     case "Guestsknife":     blade.skipsell = true;     break;
     case "MerchantsBlade":   blade.skipsell = true;     break;
     case "Merchantsdagger":   blade.skipsell = true;     break;
     case "Minersaxe":     blade.skipsell = true;     break;
     case "Minerscrow":     blade.skipsell = true;     break;
     case "Piratesdagger":   blade.skipsell = true;     break;
     case "Machete":       blade.skipsell = true;     break;   //JRH
     case "MinersSpade":     blade.sound = "PEOPLE\spade.wav";break; //JRH
     // PB: Who would want to buy this? <--
  }
 
@Pieter Boelen

Maybe this can be a last bit of work for the community before my forced sabbatical. :)

Code:
    case "Barmansknife":   blade.skipsell = true;
                 blade.skipequip = true;     break;  //TY begin excluded weapons
     case "Guestsknife":     blade.skipsell = true;
                 blade.skipequip = true;     break;
     case "MerchantsBlade":   blade.skipsell = true;     break;
     case "Merchantsdagger":   blade.skipsell = true;
                 blade.skipequip = true;     break;
     case "Minersaxe":     blade.skipsell = true;
                 blade.skipequip = true;     break;
     case "Minerscrow":     blade.skipsell = true;
                 blade.skipequip = true;     break;
     case "Piratesdagger":   blade.skipsell = true;
                 blade.skipequip = true;     break;
     case "Machete":       blade.skipsell = true;     break;   //JRH
     case "MinersSpade":     blade.sound = "PEOPLE\spade.wav";
                 blade.skipequip = true;     break; //JRH
     case "Minerspick"     blade.skipequip = true;     break;
     //case ""bladeaxe3"     blade.skipequip = true;    break;    //TY Begin questionable blocks- hatchet?
     //case "blade5"       blade.skipequip = true;     break;      // dagger?

I've added blocks for the hatchet and the dagger too, but not sure if we want that, so those are commented out. Other than that, I've blocked all knives and tools.

Does that look right?

If it does and we want to try this for now, someone please post to New Content when the decision is made, since I may not be around to post it there.

@ANSEL You might enjoy this, it hopefully will block all the knives and tools from everyone. :) If you also want to block the dagger and the hatched, you can uncoment those two lines in the attached file.

File attached.

EDIT: quick correction
 

Attachments

  • initItems.c
    318.2 KB · Views: 185
Last edited:
Ah and here I go again, looking like an addict to the board by not staying away. ;)

Though with good reason sadly--before starting work today I finally was able to boot up my game to test the above file, which I hadn't been able to do previously. A syntax error appeared for that block of code in the error log.

So something must be wrong with the code I posted above. I can't see a mistake though.

Just didn't want this going anywhere before someone can look at it to fix it, so had to stop by to let you know. Sorry to leave it to someone else to complete the fix here.
 
I took another look at it, and in addition to @Jack Rackham 's fix above (and the same fix for the commented out lines), the block of code probably needs to be repeated above where it is currently placed, so for the case of both enable weaponsmod and the else line (I only added it to the else so far it seems)). Easy to find, the blocks look the same.

Sorry I can't upload a file, silly mobile devices and view only, I feel bad leaving it to someone else, sorry about that.

By the way, I noticed both the normal sabre and the english officer's sabre have blade.param.time or something like that specially set to 0.05 in the top part of this same block of code. No other sword has that, everything else is set to 0.1 as far as I can tell, including all the other sabres and higher end stuff. I take it this makes them somewhat faster?

Just wanted to draw that weirdness to your attention, in case it is leftover from something and should be removed.

Thanks everyone, best wishes to all of you!
 
I think that blade parameters thing is something graphical.
Might be wrong though.
 
Back
Top