• 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 Rewrite Musket on Shoulder Code

Thanks Pieter. I'll see what it may give.
Right now I'm working on the second best: the reset to shoulder mode function after any other
actions. Plenty of time for this as it's a typical swedish summer: 11 degrees Celsius and raining for days. :cool
 
I found the place! The list of my stringlogs was so long in the left side of the screen that the
bottom lines were hidden by the character icon! Now I start to believe in this again.
 
So which one was it?
 
So which one was it?
In LAi_fight.c
Code:
void LAi_tmpl_fight_CharacterUpdate(
at the end
Code:
}else{
            time = stf(tmpl.nostop) - dltTime;
            if(time <= 0.0) time = -1.0;
            tmpl.nostop = time;
        }
    }else{

    //JRH -->
        if(IsEquipcharacterByItem(chr, "pistolmket"))
        {
            PostEvent("mket_on_back", 1000, "i", chr);
            PostEvent("mguns_extra_check", 1000, "i", chr);
        }

        if(IsEquipCharacterByItem(chr, "blademketK"))
        {
            PostEvent("blademketK_as_gun", 1000, "i", chr);
            PostEvent("mket_on_back", 1500, "i", chr);    //if musket on hip
            PostEvent("mguns_extra_check", 1000, "i", chr);
        }

        if(IsEquipCharacterByItem(chr, "pistolmtoon"))
        {
            PostEvent("mtoon_on_back", 1000, "i", chr);
            PostEvent("mguns_extra_check", 1000, "i", chr);
        }

        if(IsEquipCharacterByItem(chr, "pistolmketB"))
        {
            PostEvent("mketB_on_back", 1000, "i", chr);
            PostEvent("mguns_extra_check", 1000, "i", chr);
        }
               
        if(IsEquipCharacterByItem(chr, "blademketB"))
        {
            PostEvent("blademketB_as_gun", 1000, "i", chr);
            PostEvent("mketB_on_back", 1500, "i", chr);    //if musket on hip
            PostEvent("mguns_extra_check", 1000, "i", chr);
        }

        if(IsEquipCharacterByItem(chr, "Arguebuse"))
        {
            PostEvent("Arguebuse_on_back", 1000, "i", chr);
            PostEvent("mguns_extra_check", 1000, "i", chr);
        }
    // <-- JRH

        //Åñëè öåëè íåò, ïåðåõîäèì â ðåæèì îæèäàíèÿ
        if(tmpl.state != "wait")
        {
            LAi_tmpl_fight_SetWaitState(chr);
        }
    }
}

my code still under work.
 
Please do check if it impacts performance
 
I use it to reset characters with muskets to shoulder mode. So far I have only checked that it works. Nothing strange
has occurred.
 
The continuation of musket code is soon finished but...
Where are officers hired at a tavern given their guns? In Enc_officers_dialog.c there's only a check of what
they already got.
 
The continuation of musket code is soon finished but...
Where are officers hired at a tavern given their guns? In Enc_officers_dialog.c there's only a check of what
they already got.
Probably LAi_CreateOfficer, I think? If you look at PROGRAM\NK.c you'll find near the top the function that creates the "looking for a specific type" officers.
That one contains a line for LAi_equip or something like that. I'm not sure if the same applies for the regular type of officers, but I suspect it does.
At least that will give you a search term to look for.
 
All officers and captains should be generated by that function unless they are quest officers.
 
Muskets & pistols mod 2015-07-15

New guns:
1) Arguebuse matchlock musket per 1 - 2
2) Standard musket can be equipped with a plug-in knife as a bayonet per 3 - 6
3) Musket with a socket bayonet (always attached) per 5 - 6
4) Short wheellock musket per 1 - 2
5) quest pistol204 in WoodesRogers change to a flintlock per 3 (was percussion lock)
6) wheellock pistol per 1 - 2
7) pair of wheellock pistols per 1 - 2

Soldier guards are equipped with:
per 1 - 2: blade + Arguebuse
per 3 - 4: special knife + standard musket
per 5 - 6: new musket with socket bayonet

Pirate guard are equipped with:
per 1 - 2: blade + short wheellock musket
per 3 - 6: blade + pistolbbuss

These guns switch between shoulder and hip mode:
Musket, Musketoon, Blunderbuss, Arguebuse, short wheellock musket

These between shoulder, hip & bayonet mode:
Musket + knife, musket with permanent bayonet

Musket + knife removes knife in shoulder and hip mode.

pistol1, 2, 7, 8 & blunderbuss available from per 3 as flintlock wasn't invented yet.
2 new wheellock pistols + wheellock musket + matchlock musket available in per 1 - 2 instead.

nr 7) pair of wheellock pistols are very luxuary - maybe something for Francis Drake to start with?

Officers & NPC:s that have their muskets in the wrong position after a fight are all reset
to shoulder mode when pchar sheaths his blade.
 
Wow, that sounds like a large amount of work!
Did you also do anything with powder getting wet on older style guns? I recall you had an idea about that once.

nr 7) pair of wheellock pistols are very luxuary - maybe something for Francis Drake to start with?
This one @Grey Roger?

Officers & NPC:s that have their muskets in the wrong position after a fight are all reset
to shoulder mode when pchar sheaths his blade.
How/when does that happen? Sounds like there may still be something we haven't figured out if that still happens. :modding
 
Did you also do anything with powder getting wet on older style guns?
No I didn't. Maybe in a misfunction mod sometime in the future.

How/when does that happen? Sounds like there may still be something we haven't figured out if that still happens.
When there are many characters with rifles some can still be in hip mode (type muskets) or blade mode (type muskets with bayonets).
Not so much soldiers as officers. Never the player. The reset works very well though. No one has ever fired in shoulder mode when I have tested.
 
When there are many characters with rifles some can still be in hip mode (type muskets) or blade mode (type muskets with bayonets).
Not so much soldiers as officers. Never the player. The reset works very well though. No one has ever fired in shoulder mode when I have tested.
So officers DO put their blade away, but their guns stay in hip mode?
 
Looking at Wikipedia articles on the wheellock, snaphance[/u] and flintlock, the impression I get is that the wheellock should be very rare and very expensive in "Early Explorers" and "Spanish Main", and non-existent in later periods. Even in the late 16th century, Francis Drake's time, it was becoming obsolete. The mechanism was tricky to build, requiring a highly skilled gunsmith, which is why it would be expensive, and this combined with its obsolescence would also make it rare. Loading time should be longer than a flintlock because the wheel would need to be wound. I wouldn't expect Francis Drake to have used one, and a pair of them wouldn't be starting equipment for anyone - perhaps use a pair of wheellocks as a quest reward, or make it Clint Eastwood's weapon in "Early Explorers" and possibly "Spanish Main".

The snaplock and snaphance were earlier mechanisms similar to the flintlock. These would probably be more common than the wheellock in "Early Explorers" and "Spanish Main", and are most likely what Francis Drake would have been carrying. The snaplock and snaphance began to replace the wheellock in the 1540's.

Pirate guards should not have more advanced weapons than other guards. New weapons would have been designed in Europe, brought to the Caribbean by their forces or by people travelling from Europe, and so should be in service with soldiers or sea-going pirates before they get to pirate guards. If anything, I'd expect pirate guards to be using arquebuses while other guards are using snaphances or possibly wheellocks, though wheellocks were not mass-produced for general military use.

Wet powder was of more concern to a matchlock. Later weapons had a pan cover to help keep loaded powder dry. Beyond that, getting the powder into the weapon during rain would probably have been equally difficult for all weapons until cartridges were invented.
 
@Jack Rackham: Can you please check my attached changed files with WinMerge?
Changes made:
- Periods.c: New section completely rewritten to avoid nested if-statements as it is easy to lose track of what does what with those
- LAi_equip.c: Correction for potential undefined variable error
- LAi_fight.c: Remove some unused lines of code
- Commented out a lot of lines that I think should not be required (but I'm not sure of that, so please check and let me know)

Very quick test led to this:
upload_2015-7-15_22-2-52.png


One soldier attached the bayonet to his musket properly, but the other one didn't.

I hope the above can be of some use to you. :doff

EDIT: Uh, this time the guards aren't attaching their bayonets at all. Strange.
Once they do attach their bayonets, does that mean they can no longer fire their musket?
That of course makes sense in Realistic Game Mode but might be a disadvantage to them in Arcade....
 

Attachments

  • PB muskets & pistols edits 15-07-15.zip
    48.6 KB · Views: 133
Back
Top