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

Can mushket be turn on

That too bad i was hoping to find the mushket code in the modd.
So that my mushketer should carry the mushket and not wear it on the belt.

In the Rus. ver. of coas the mushket was on and working right.
So why is it trun off for the release ver. outside Russia. :shrug
 
ok... i wanted to use the mushket too, and i figured out a way to do it...

first of all, you want to create some character models with proper mushket locators. it's easier to do this by using inez diaz's tool. open it and load the .gm file you want to change, let's say it's called "mymodel.gm". then copy the folling lines to an empty .txt file:

Head_joint,CAMERA,1,6.938894E-18,-7.806256E-18,-1.040834E-17,1,0,1.387779E-17,3.252607E-19,1,0.009400933,1.703205,0.1448717,1,2.242078E-44,0,0,0,0,0,0,0,
Zapyastie_right_joint,Gun_Belt,0.6662672,0.4217459,-0.6149946,0.2632577,0.6385801,0.7231258,0.6976986,-0.6436971,0.3144371,-0.2034235,0.8781975,0.08633857,1,9.10844E-44,0,0,0,0,0,0,0,
Zapyastie_right_joint,Gun_Hand,0.6662672,0.4217459,-0.6149946,0.2632577,0.6385801,0.7231258,0.6976986,-0.6436971,0.3144371,-0.2034235,0.8781975,0.08633857,1,9.10844E-44,0,0,0,0,0,0,0,

then save it "mylocators.txt". from the tool, select "locators", "read from file", and select "mylocators.txt". then save the .gm adding the suffix "_mush" to the original name (for example, if the model name is "mymodel.gm" the new file will be "mymodel_mush.gm"). check out that the tool doesnt add the suffix "_x" to the name. IMPORTANT: do NOT overwrite the original "mymodel.gm", otherwise you won't be able to use the regular weapons properly anymore.
you need to do this for all the models you want to use a mushket. for istance, if you're playing as capitan blood you must create the models blood5_mush.gm, blood5_cirass_mush.gm, blood5_cirass1_mush.gm, blood5_cirass2_mush.gm, blood5_cirass3_mush.gm. besides, if you want your officers too, you need to edit the models officer_1 to officer_20.

after you do this, you want to edit the following files:
in program\characters\characterutilite.c, find the function
void equipcharacterbyitem, and change it so that is appears as follows:

void EquipCharacterByItem(ref chref, string itemID)
{
aref arItm;
if( !CheckCharacterItem(chref, itemID) ) return;
if( Items_FindItem(itemID, &arItm)<0 ) return;
if( !CheckAttribute(arItm, "groupID") ) return;

string groupName = arItm.groupID;
string oldItemID = GetCharacterEquipByGroup(chref, groupName);
if(oldItemID==itemID) return;
// Back84 -->
if(oldItemID == "unarmed")
{
removecharacterequip(chref,BLADE_ITEM_TYPE);
takeitemfromcharacter(chref,"unarmed");
chref.items.unarmed = 0;
}

if (isequipcharacterbyitem(chref,"mushket") && groupname != SPYGLASS_ITEM_TYPE && groupname != PATENT_ITEM_TYPE && groupname != CIRASS_ITEM_TYPE)
{
removecharacterequip(chref,GUN_ITEM_TYPE);
chref.model = chref.model.oldmodel;
chref.model.animation = chref.model.oldani;
SetNewModelToChar(chref);
}
if (isequipcharacterbyitem(chref,"mushket2x2") && groupname != SPYGLASS_ITEM_TYPE && groupname != PATENT_ITEM_TYPE && groupname != CIRASS_ITEM_TYPE)
{
removecharacterequip(chref,GUN_ITEM_TYPE);
chref.model = chref.model.oldmodel;
chref.model.animation = chref.model.oldani;
SetNewModelToChar(chref);
}
// <-- Back84
if (chref.model.animation == "mushketer")
{
if (groupName == BLADE_ITEM_TYPE && itemID != "unarmed") return;
if (chref.id == "OffMushketer")
{
if (groupName == GUN_ITEM_TYPE && itemID != "mushket2x2") return;
}
else
{
if (groupName == GUN_ITEM_TYPE && itemID != "mushket") return;
}
}
else
{
// Back84 -->
if (groupName == GUN_ITEM_TYPE && itemID == "mushket")
{
if (chref.index == getmaincharacterindex() || IsOfficer(chref) == true)
{
chref.model.oldmodel = chref.model;
chref.model.oldani = chref.model.animation;
chref.model = chref.model + "_mush";
chref.model.animation = "mushketer";
SetNewModelToChar(chref);
if(!isequipcharacterbyitem(chref,"unarmed"))
{
GiveItem2Character(chref, "unarmed");
EquipCharacterByItem(chref,"unarmed");
}
}
else
{
return;;
}

}
if (groupName == GUN_ITEM_TYPE && itemID == "mushket2x2")
{
if (chref.index == getmaincharacterindex() || IsOfficer(chref) == true)
{
chref.model.oldmodel = chref.model;
chref.model.oldani = chref.model.animation;
chref.model = chref.model + "_mush";
chref.model.animation = "mushketer";
SetNewModelToChar(chref);
if(!isequipcharacterbyitem(chref,"unarmed"))
{
GiveItem2Character(chref, "unarmed");
EquipCharacterByItem(chref,"unarmed");
}
}
else
{
return;;
}

}
// <-- back84
}

chref.equip.(groupName) = itemID;

if(IsEntity(chref))
{ SetEquipedItemToCharacter(chref, groupName, itemID);
}
if(groupName==GUN_ITEM_TYPE && sti(chref.index)==GetMainCharacterIndex())
{ LAi_GunSetUnload(chref);
}
// boal -->
/*if (groupName == SPYGLASS_ITEM_TYPE && sti(chref.index)==GetMainCharacterIndex())// && bSeaActive)
{
FillISpyGlassParameters();
}*/
// boal <--
}




then find the function void SetEquipedItemToCharacter, and change it like this:



void SetEquipedItemToCharacter(ref chref, string groupID, string itemID)
{
object emptyItm;
aref arItm;
string modelName = "";
makearef(arItm,emptyItm);
int itemNum; // boal 23.01.2004

if(itemID!="")
{
if( !CheckCharacterItem(chref,itemID) ) return;
itemNum = Items_FindItem(itemID,&arItm);// boal 23.01.2004
}
else
{
if(checkattribute(chref, "model.oldmodel") && groupID == GUN_ITEM_TYPE)
{
chref.model = chref.model.oldmodel;
chref.model.animation = chref.model.oldani;
SetNewModelToChar(chref);
}
}
switch(groupID)
{
case SPYGLASS_ITEM_TYPE:
if(CheckAttribute(arItm,"id"))
{
setTelescopeInitParameters(arItm);
}
break;
// boal -->
case CIRASS_ITEM_TYPE:
if (CheckAttribute(chref, "HeroModel")) // âñå, ó êîãî åñòü ÷òî îäåòü
{

if (CheckAttribute(arItm, "model"))
{
// ---> Back84
if(CheckAttribute(chref,"IsSkel"))
{
chref.quest.tempmodel = GetSubStringByNum(chref.HeroModel, sti(arItm.model));
}
else if(isequipcharacterbyitem(chref,"mushket") || isequipcharacterbyitem(chref,"mushket2x2"))
{
chref.model.oldmodel = GetSubStringByNum(chref.HeroModel, sti(arItm.model));
chref.model = GetSubStringByNum(chref.HeroModel, sti(arItm.model)) + "_mush";
}
else
{
chref.model = GetSubStringByNum(chref.HeroModel, sti(arItm.model));
}
// <--- Back84
chref.cirassId = itemNum;
}
else
{
// ---> Back84
if(CheckAttribute(chref,"IsSkel"))
{
chref.quest.tempmodel = GetSubStringByNum(chref.HeroModel, 0);
}
else if(isequipcharacterbyitem(chref,"mushket") || isequipcharacterbyitem(chref,"mushket2x2"))
{
chref.model.oldmodel = GetSubStringByNum(chref.HeroModel, 0);
chref.model = GetSubStringByNum(chref.HeroModel, 0) + "_mush";
}
else
{
chref.model = GetSubStringByNum(chref.HeroModel, 0);
}
// <--- Back84
DeleteAttribute(chref, "cirassId");
}
}
else
{
// òóò àíàëèç ìîäåëè îôèöåðà èëè ïèðàòà
if(CheckAttribute(arItm, "model"))
{
chref.cirassId = itemNum;
}
else
{
DeleteAttribute(chref, "cirassId");
}
}
SetNewModelToChar(chref);//boal
break;

case PATENT_ITEM_TYPE:
if(CheckAttribute(arItm,"quest"))
{
DoQuestCheckDelay(arItm.quest, 1.0);
chref.EquipedPatentId = itemNum; // boal òåêóùèé ïàòåíò
}
else
{
DeleteAttribute(chref, "EquipedPatentId");
}
break;
// boal <--
case GUN_ITEM_TYPE:
if(CheckAttribute(arItm,"model")) {modelName = arItm.model;}
SendMessage(chref,"ls",MSG_CHARACTER_SETGUN,modelName);
if(CheckAttribute(arItm,"chargeQ"))
{ LAi_GunSetChargeQuant(chref,sti(arItm.chargeQ));
} else
{ LAi_GunSetChargeQuant(chref,0);
}
if(CheckAttribute(arItm,"chargespeed") && stf(arItm.chargespeed)>0.0)
{ LAi_GunSetChargeSpeed(chref,1.0/stf(arItm.chargespeed));
} else
{ LAi_GunSetChargeSpeed(chref,0.0);
}
if(CheckAttribute(arItm,"dmg_min"))
{ LAi_GunSetDamageMin(chref,stf(arItm.dmg_min));
} else
{ LAi_GunSetDamageMin(chref,0.0);
}
if(CheckAttribute(arItm,"dmg_max"))
{ LAi_GunSetDamageMax(chref,stf(arItm.dmg_max));
} else
{ LAi_GunSetDamageMax(chref,0.0);
}
if(CheckAttribute(arItm,"accuracy"))
{ LAi_GunSetAccuracy(chref,stf(arItm.accuracy)*0.01);
} else
{ LAi_GunSetAccuracy(chref,0.0);
}
break;

case BLADE_ITEM_TYPE:
float liveTime = 0.1;
int colors = argb(64, 64, 64, 64);
int colore = argb(0, 32, 32, 32);
if(CheckAttribute(arItm,"model")) {modelName = arItm.model;}
if(CheckAttribute(arItm, "blade.time")) {liveTime = stf(arItm.blade.time);}
if(CheckAttribute(arItm, "blade.colorstart")) {colors = sti(arItm.blade.colorstart);}
if(CheckAttribute(arItm, "blade.colorend")) {colore = sti(arItm.blade.colorend);}
//SendMessage(chref, "lsfll", MSG_CHARACTER_SETBLADE, modelName, liveTime, colors, colore);
SendMessage(chref, "llsfll", MSG_CHARACTER_SETBLADE, 0, modelName, liveTime, colors, colore);

if(CheckAttribute(arItm,"dmg_min"))
{ LAi_BladeSetDamageMin(chref,stf(arItm.dmg_min));
} else
{ LAi_BladeSetDamageMin(chref,0.0);
}
if(CheckAttribute(arItm,"dmg_max"))
{ LAi_BladeSetDamageMax(chref,stf(arItm.dmg_max));
} else
{ LAi_BladeSetDamageMax(chref,0.0);
}
if(CheckAttribute(arItm,"piercing"))
{ LAi_BladeSetPiercing(chref,stf(arItm.piercing)*0.01);
} else
{ LAi_BladeSetPiercing(chref,0.0);
}
if(CheckAttribute(arItm,"block"))
{ LAi_BladeSetBlock(chref,stf(arItm.block)*0.01);
} else
{ LAi_BladeSetBlock(chref,0.0);
}
// boal -->
if(CheckAttribute(arItm,"FencingType"))
{ LAi_BladeFencingType(chref, arItm.FencingType);
} else
{ LAi_BladeFencingType(chref, "Fencing");
}
if(CheckAttribute(arItm,"Weight")) //eddy.ïðè çàãðóçêè ëîêàöèè åñëè ó ÃÃ íåò îðóæèÿ - îøèáêà
{
LAi_BladeEnergyType(chref, GetEnergyBladeDrain(stf(arItm.Weight)) ); // ýíåðãîåìêîñòü îò âåñà
}
// boal <--
break;
}
}




then in loc_ai\types, in the files: lai_actor, lai_guardian, lai_officer, lai_patrol, lai_stay and lai_warrior replace the line:


if (chr.model.animation == "mushketer" && !CheckAttribute(chr, "isMusketer.weapon"))

with:

if (chr.model.animation == "mushketer" && !CheckAttribute(chr, "isMusketer.weapon") && chr.index != getmaincharacterindex() && !isOfficer(chr))


finally, in program\interface\items.c find the function


bool ThisItemCanBeEquip( aref arItem )

and delete the following lines (or set them as comment):


if (arItem.id == "mushket")
{
return false;

}
if (arItem.id == "mushket2x2")
{
return false;
}


and voila! now you are ready to became a real sniper! you don't need to start a new game for these changes to take effect
 
I created a musket that can be used by anyone (including officers) without any mods, just add this one to the game. Since I used the double-barreled musket for this, I changed the name so it wouldn't be confused with the quest musket. It fires like pistol and it's a bit overpowered, but a musket's a musket.

Just copy/paste this code into the initItems file with the rest of the items.
Code:
makeref(itm,Items[n]);
itm.id = "pistol9";  //øîòãàí
itm.groupID = GUN_ITEM_TYPE;
itm.name = "itmname_pistol7";
itm.describe = "itmdescr_questMushket";
itm.folder = "items";
itm.model = "mushket2x2";
itm.picIndex = 16;
itm.picTexture = "ITEMS_13";
itm.shown = 1;
itm.price = 250000;
// boal 19.01.2004 -->
itm.Weight = 9;
// boal 19.01.2004 <--
itm.chargeQ = 2;
itm.chargespeed = 12;
itm.dmg_min = 135.0;
itm.dmg_max = 385.0;
itm.accuracy = 95;
itm.minlevel = 1;
itm.rare = 0.1;
itm.ItemType = "WEAPON";
n++;
 
Back
Top