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

Needs Testing Navy Soldiers not blocked from inappropriate weapons

Tingyun

Corsair
Storm Modder
@Grey Roger saw a Navy Soldier equipped with a spade.

It appears this check in LAi_equip is not functioning:

Code:
                    isNotPirate = isSoldier(chr);
                    //if(ModelIsType(chr.model, "Land_Officers")) trace("soldier model");
                    if(CheckAttribute(bladeItm, "nation") && isNotPirate > 0)
                    {
                        if(bladeItm.nation!="")  // if weapon has a nation limit and the chr is a soldier
                        {
                            if(sti(bladeItm.nation)==isNotPirate) isValidWeapon = true; // weapon's nation must match chars nation
                        }
                        else
                        {
                            isValidWeapon = true;
                        }
                    }
                    else
                    {
                        isValidWeapon = true;
                    }

All such inappropriate "weapons" are marked in init_items as PIRATE, to block them, but it appears they are allowed anyway.

As far as I can tell, this doesn't assign soldier weapons, it just blocks them from other nations defined soldier weapons, which seems a very good thing.

None of this has changed recently, so I suspect the check was not working previously, but the effects of its failure were hidden by soldier high levels blocking them out from such weapons anyway. Now, there is a (rare, but not zero) chance they will roll misses all the way down to these weapons, so it becomes a rare and inappropriate possibility.

The other negative effect is that if the check is not working, the blades of the other nationalities become open to distribution (ie, dutch soldiers with english officer swords). That one would have come up before, but maybe it was hidden when soldiers were operating under the soldier weapon system.

Can anyone see where the problem arises? I've looked at it and am quite unsure. The full code is in LAi_equip
 
The separate Soldier Weapons system for boarders was only in use very shortly. A few months at most.

I didn't even know there WAS any soldier check in the regular equip code! :shock
 
A restrictive check like this is needed--even if french soldiers can have any normal weapon, they should not get english officer swords.

Everything seems in place for this to work, all the soldier nationality defines in init_items are there properly and such. I don't know why it doesn't work, but I also don't know how old this code is.

Maybe it just needs updating in some way? Reports that we have so far only confirm it doesn't work to block the swords defined as PIRATE, not sure if it is also not working to block other nation swords.
 
Two other thoughts:
- Maybe the boarders getting shovels ARE pirates? Or was it confirmed that these are not pirate ships?
- I'm not sure if even navy ships get their boarders set as soldiers; that is probably not even desired, because then they might get Soldier Weapons again which is not desired.

A restrictive check like this is needed--even if french soldiers can have any normal weapon, they should not get english officer swords.
French characters should not get English swords anyway, regardless of them being soldiers or not.

I don't know why it doesn't work, but I also don't know how old this code is.
Hasn't been touched in several years at least, as far as I know.
 
Not good at forum quoting, so I'll do it manually. ;)

Pieter says "- Maybe the boarders getting shovels ARE pirates? Or was it confirmed that these are not pirate ships?"

Grey Roger reported for the military payroll ship in Ardent, which is a navy ship, so it is definitely not working.

Pieter says "French characters should not get English swords anyway, regardless of them being soldiers or not."

Agreed, then we will need to rewrite this check to be broader and block all characters of a nation from weapons specifically assigned to other nations. This is the sole thing in LAi_equip that uses the nation check, so it isn't currently happening.

BTW if we think Pirates should never get things like shovels and daggers, it is easy to block everyone from them and force proper swords as the minimum. Not sure if we want to do that though, as a rare thing it might enhance variety, and those very low-tier weapons showing up once in a blue moon won't generally hurt their effectiveness. But if want to do that too, let me know, it is easy.

Either way though, we should fix this so Navy characters never get low tier stuff like daggers and axes.
 
The payroll ship in "Ardent" is supposed to be a naval ship. It flies a Spanish naval flag and the boarders wear Spanish uniforms. Additionally, in:
Unbalanced "Boss"enemies
@ANSEL also reported inappropriate weapons including pickaxes, also on naval ships among others.

In past versions, I don't recall anyone using a sword from a different nation. English crews use English swords, French crews use French swords, Pirate crews use Pirate swords, etc.; and everyone uses swords which have no nationality, such as cutlass or kilij. But even though tools such as spade and pickaxe are marked as "PIRATE" (and very useful for treasure-hunting, so it's not unbelievable that a pirate would carry them), I don't recall even Pirates wielding them as weapons in previous versions.
 
@Grey Roger You wouldn't find anyone wielding them previously, because the leveling of enemies and min level would have blocked everyone from them almost instantly. Same with daggers and basic axes, noone was basically ever low enough level to roll them up.

You are seeing them now very rarely if a character misses all their rolls from their high level weapon list all the way down. That is working as intended (a bandit should sometimes wield a pick axe or a dagger, else why have the weapon?). It certainly should not happen on navy ships though.

The check we are discussing with has not been touched, at all. No reason it would have stopped working just now. And nothing else in LAi_equip to block things based on nationality.
 
Maybe something like this? Not sure how to write the check for the character nation, so I just put it into all caps hoping someone can fill it in.

Commented out the soldier part, so it would work for everyone.

isvalidweapon is initially set to false, so this is just the checks that might turn it to true.

Code:
//isNotPirate = isSoldier(chr);
                    //if(ModelIsType(chr.model, "Land_Officers")) trace("soldier model");
                    if(CheckAttribute(bladeItm, "nation") //&& isNotPirate > 0)
                    {
                        if(bladeItm.nation!="")  // if weapon has a nation limit and the chr is a soldier
                        {
                            if(sti(bladeItm.nation)==INSERT SOMETHING TO CHECK CHARACTERS NATION) isValidWeapon = true; // weapon's nation must match chars nation
                        }
                        else
                        {
                            isValidWeapon = true;
                        }
                    }
                    else
                    {
                        isValidWeapon = true;
                    }
 
The payroll ship in "Ardent" is supposed to be a naval ship. It flies a Spanish naval flag and the boarders wear Spanish uniforms. Additionally, in:
Unbalanced "Boss"enemies
@ANSEL also reported inappropriate weapons including pickaxes, also on naval ships among others.

In past versions, I don't recall anyone using a sword from a different nation. English crews use English swords, French crews use French swords, Pirate crews use Pirate swords, etc.; and everyone uses swords which have no nationality, such as cutlass or kilij. But even though tools such as spade and pickaxe are marked as "PIRATE" (and very useful for treasure-hunting, so it's not unbelievable that a pirate would carry them), I don't recall even Pirates wielding them as weapons in previous versions.
I agree with Grey Roger. My memory says exactly the same, as Grey Rogers say about Swords and tools.
 
@Grey Roger You wouldn't find anyone wielding them previously, because the leveling of enemies and min level would have blocked everyone from them almost instantly. Same with daggers and basic axes, noone was basically ever low enough level to roll them up.
Except that cutlasses, like daggers and spades, are minlevel 1. And I'm sure I've seen enemies with cutlasses. And, for that matter, sabres, also minlevel 1 but only available from "Colonial Powers" onwards, so I'd only see those when playing a storyline set in those later periods.
 
@Grey Roger I think it might be from lining those up first when the equip function forms the list of possible weapons. Spades and such are very rare now and would have been before, but before you would have passed the level at which they could appear very quickly, so now there is a larger window for that rare chance to be rolled.

There was nothing done that could have broken this function that I can see, certainly not from any change I made.

One possibility is something was done in how captain crews are generated under the new captain generation system, that is possible. Maybe their nationality is dropping out in some way.

But there was never anything to block other nation people generally (non soldiers I mean) from equipping the wrong weapons.
 
@Pieter Boelen

This is going to "Need Testing". The expected behavior is no character, soldier or not, should have a weapon marked as another nation (meaning, weapons that have no nationality, which is most of them, are generally available, but only British people can get the British officer sword and so on).

Only Pirates should be desperate enough to have axes, daggers, and tools, and the other low quality weapons.

I'm not sure what nationality bandits are marked as, or how that works, but we would want them to have access to these weapons. If they have no nationality, then maybe we can expand the check to allow no nationality people to be ok with Pirate weapons. I haven't looked at any of those systems at all so I have no idea.

If it still doesn't work, probably the problem lies somewhere in the way crews are generated, or how this conected to the item file.
 
Last edited:
Ok here it is for testing, description above. ValidWeapon is initially set false, so all the checks here are whether to set it true.

Code:
                if (bladeItm.skipequip==false && stf(bladeItm.rare)>0.0 && currentPeriod>=sti(GetAttribute(bladeItm, "firstperiod")) && currentPeriod<=sti(GetAttribute(bladeItm, "lastperiod")))
                {
                        if(bladeItm.nation!="")  // if weapon has a nation limit and the chr is a soldier //TY actually let's try to make all people obey national limitations, and fix the check too
                        {
                            if(sti(bladeItm.nation)==sti(chr.nation)) isValidWeapon = true; // weapon's nation must match chars nation
                        }
                        else
                        {
                            isValidWeapon = true;
                        }
                    else
                    {
                        isValidWeapon = true;
                    }
                }

If that doesn't work, someone better at coding will have to try. Unless something broke in the captain crew generation new unified system that isn't now assigning nationalities or something, this has been broken for awhile, so it may need some investigating.
 

Attachments

  • LAi_equip.c
    20.6 KB · Views: 185
Last edited:
Back to work now. At any rate, if this doesn't fix it I won't be able to help further, as the problem would be beyond my expertise, and looks to have been lurking awhile. I might see you guys in a couple of days, or it might be much longer, hard to predict when I can pull away given current schedule. Well, it was a fun break of modding fun, but back to it now. :)
 
I just boarded a dutch navy ship, The crew was armed with BREAD KNIFES :shock
 
@ANSEL Using the file I posted or the original? If the original file, that would be expected--a bread knife a level 1 weapon marked PIRATE to keep them from being equipped normally, so since we know the check was failing that would be expected.

As I said, knives, hatchets, tools, all marked as PIRATE to keep them from normally equiped, but otherwise available as weapons for non-navy. We could make them generally unavailable to anyone pretty easily, as I mentioned, but that would be a change. An easy change though.

If you were using the file I posted and it still happened, then that means the fix didn't work and we indeed need to try something else. :)
 
I dont think you ever will meet Pirates armed with bread knifes, carpenters tools, pix axes etc.
I think they was reasonable good armed, they need to be well armed. They were hunted people,
always have the chance to run into privateers and coastguards. A proud Pirate will have good
weapons, the best he could find, he have to. And think of his reputation, that mean a lot those
days.
 
I agree @ANSEL . I've made the change you suggest here, which will block the worst weapons from everyone. Unconfirmed Bug - Blocking worst weapons from everyone | PiratesAhoy!

We will still need to fix the function in this thread, to block wrong nationality special swords, but that linked fix should prevent any enemies from ever being armed with knives or tools (I moved all proper swords up to min level 2, and clamped everyone at min level 2, leaving the tools and knives as min level 1). Min level 1 guns still allowed of course, this is just about blades.
 
Back
Top