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

Solved Musket/Musketoon on back

Jack Rackham

ex train dispatcher
Quest Writer
Storm Modder
I have problem with switching gun models (properly) between a 'hip mode' (default gun models) and a 'back mode' (new models).
Pchar works fine but NPC:s do not always behave ok.

Can someone help me with where to find/how to check WHEN a charachter gets into fightmode and WHEN he gets out of it. :2guns

Can't find the code when/where the sounds sword_sh and sword_out are played. Is this hidden in the engine? Can I get access to it etc etc :huh
 
Maybe this code from PROGRAM\Loc_ai\LAi_groups.c can be of help?
Code:
//Îáíîâëåíèå àëàðìà, âûçûâàåòñÿ íà êàæäîì êàäðå
#event_handler("CharacterGroup_UpdateAlarm", "LAi_group_UpdateAlarm");
void LAi_group_UpdateAlarm()
{
ref mchr = GetMainCharacter(); // KK
LAi_grp_playeralarm = GetEventData();
LAi_grp_alarmactive = GetEventData();
if(!bArcadeMode && !bseaactive) // Screwface
{
if(!CheckAttribute(mchr,"doalarm")) 
{
LAi_grp_alarmactive = false;
}
else
{
if(!LAi_grp_alarmactive) DeleteAttribute(mchr,"doalarm");
}
} //Screwface : end
Sound_OnAlarm(LAi_grp_alarmactive);
That is where Screwface added the code to only start the fight music and alarm when any enemy character would draw his blade.
Of course then you still don't know which character drew his blade... :facepalm

Indeed those sounds are probably hidden in the game engine somewhere,
but we don't have the source code for PotC so cannot do anything with that.
 
Thank you Pieter - see what I can do with this. :onya It isn't too bad - not just perfect so far.
 
Jack, how do we apply this new trick of yours to other characters?
I tried to give the riflemen in the Hornblower storyline muskets, but they ended up looking like they had to firearms at all. :facepalm
 
I tried to give the riflemen in the Hornblower storyline muskets, but they ended up looking like they had to firearms at all.
This is a post I've missed. Is it NOT working? :huh

Officerpuppy, sure they could hold them like that. Guess that would be a third case then and switching models...
well it's a little complicated as it is already. :modding
 
This is a post I've missed. Is it NOT working? :huh
It's been working fine for the Jamaica soldiers. But when I gave the same lines of code to the Hornblower riflemen, they didn't get them. Strange.
What I do intend to do is to put some code in place to automatically give muskets to all soldier characters, but only in the later time periods. I've got some ideas on how to make that work.
 
A stupid question: you didn't forget to give them any blades (first)?
I put your exact code in that you put into Redmond.c, with the Merchant's Knife. I didn't see them having any guns at all, but did see their blade from what I recall. Oh well...
I did do some testing now with the soldiers and muskets on their back, but it seems some of them end up having them on their hips anyway. It's still infinitely better than it was though.

Here's my code to give all soldiers muskets by default. In PROGRAM\Characters\characters_init.c find:
Code:
	if (isSoldier(chr) > -1) {
chr.model.uniform = chr.model;
int iNation = sti(chr.nation);
string model = "m" + sti(chr.model);
if (iNation >= 0 && iNation < NATIONS_QUANTITY) model = Nations[iNation].fantomModel.(model);
if (iNation == PERSONAL_NATION) model = characters[GetMainCharacterIndex()].Soldier.(model);
SetModel(chr, model, chr.sex, chr.sex, 0.0, false);
Add the following lines below:
Code:
		if(GetCurrentPeriod() >= PERIOD_GOLDEN_AGE_OF_PIRACY)
{
TakeItemFromCharacter(chr, GetCharacterEquipByGroup(chr, BLADE_ITEM_TYPE));
TakeItemFromCharacter(chr, GetCharacterEquipByGroup(chr, GUN_ITEM_TYPE));

GiveItem2Character(chr, "MerchantsDagger");
chr.equip.blade = "MerchantsDagger";
GiveItem2Character(chr, "pistolmket");
chr.equip.gun = "pistolmket";
if (ENABLE_AMMOMOD) {
TakenItems(chr, "gunpowder", 1 + rand(2));
TakenItems(chr, "musketbullets", 1 + rand(1));
}
}
 
I can't really say what's different here. Could it be anything with periods?
I have tested mket/mtoon (on back) on Pchar, officers and guards in Port Royal. No one have got them on their hips from start.
Sometimes an officer 'forgets' to reset it on his back but it will be ok on the next
location teleport.
 
I can't really say what's different here. Could it be anything with periods?
That period code is unrelated to my earlier report; that's just my proposition to making your code more widely used.
With this in place, all soldiers will use muskets in the later periods without any edits to the character init files required.

I have tested mket/mtoon (on back) on Pchar, officers and guards in Port Royal. No one have got them on their hips from start.
Sometimes an officer 'forgets' to reset it on his back but it will be ok on the next
location teleport.
I think that's probably what happened. Nothing too bad and it's much better than it was. :yes
 
One thing I did end up seeing was a character firing his musket while still using the "back" model.
That ended up looking like he was firing backwards. Quite funny! :rofl
 
Can you carry a long gun on your back also? I found a long gun last night and found I carried it on my hip. I gave it to my officers and they carried it on their hip.

But a merchant in a store ( I forget which one) carried it on his back.
 
What is a long gun? I've found "long pistol" (pistol2), which doesn't look like it belongs on your back.
The musketoon does though:
Code:
itmname_pistolmtoon {Musketoon}
itmdescr_pistolmtoon
{
A long gun with a shorter barrel than an infantry musket, usually used in boardings.
}
 
Oh, sorry. I meant musket or musketoon. That's kinda sorta the way we talk around here. Hogleg. Long gun. :2guns
 
Well this install has a problem. I gave myself a musketoon and it was on my hip. I then gave it to my officers one after the other and it was on their hip. So I sold it.
 
I gave myself a musketoon and it was on my hip.
Jason had this problems too but I think he hadn't installed Beta2 on a clean POTC.
Could it be something like that? :huh
 
This is a post I've missed. Is it NOT working? :huh
It's been working fine for the Jamaica soldiers. But when I gave the same lines of code to the Hornblower riflemen, they didn't get them. Strange.
What I do intend to do is to put some code in place to automatically give muskets to all soldier characters, but only in the later time periods. I've got some ideas on how to make that work.
This may NOT be anything to do with this BUT for what it's worth: :shrug
When I made the textures the Hornblower riflemen characters, in green, they were not based on the soldier figures.
My main computer with all the records of this has died so I don't remember which one it was, but I think it was a naval outfit.
 
Back
Top