Beginning to make sense, yes.No!
If a character got "blademketK" equipped he probably hasn't got any gun equipped too.
So that explains why the "blademketK" section wasn't read.
Makes sense?
What about this section then?
Code:
if(IsEquipCharacterByItem(tmpChr, "blademketK"))
{
RemoveCharacterEquip(tmpChr, BLADE_ITEM_TYPE );
TakeItemFromCharacter(tmpChr, "blademketK");
GiveItem2Character(tmpChr, "blade_mKnife");
EquipCharacterByItem(tmpChr, "blade_mKnife");
GiveItem2Character(tmpChr, "pistolmket");
EquipCharacterByItem(tmpChr, "pistolmket");
if(weapon.model == "musket")
{
weapon.model = "musket_back";
EquipCharacterByItem(tmpChr, "pistolmket");
}
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
That means that weaponID == "" and aref weapon will end up being some sort of "nothing".
Then in this section, you check if(weapon.model == "musket") which would not be the case because 'weapon' was set as nothing before.
Do I understand correctly that in the part, 'weapon' should actually be the newly equipped "pistolmket" rather than the "" you had equipped as a gun before?
In that case, I might suggest something like this instead:
Code:
if(IsEquipCharacterByItem(tmpChr, "blademketK"))
{
RemoveCharacterEquip(tmpChr, BLADE_ITEM_TYPE );
TakeItemFromCharacter(tmpChr, "blademketK");
GiveItem2Character(tmpChr, "blade_mKnife");
EquipCharacterByItem(tmpChr, "blade_mKnife");
GiveItem2Character(tmpChr, "pistolmket");
EquipCharacterByItem(tmpChr, "pistolmket");
Items_FindItem("pistolmket", &weapon); // PB: Add this line here instead <----------------------------------
if(weapon.model == "musket")
{
weapon.model = "musket_back";
EquipCharacterByItem(tmpChr, "pistolmket");
}
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
Code:
#event_handler("mguns_reset_check", "reset_check_mguns");
void reset_check_mguns()
{
ref PChar = GetMainCharacter();
aref attack = GetEventData();
ref tmpChr;
float GunCurCharge;
for (int i = 0; i < LAi_numloginedcharacters; i++)
{
int index = LAi_loginedcharacters[i];
if (index >= 0)
{
makeref(tmpChr, Characters[index]);
string weaponID = GetCharacterEquipByGroup(tmpChr,GUN_ITEM_TYPE);
aref weapon;
if (!LAi_IsDead(tmpChr) && !LAi_IsFightMode(tmpChr))
{
GunCurCharge = LAi_GetCharacterRelCharge(tmpChr); // Levis
if(IsEquipCharacterByItem(tmpChr, "pistolmket"))
{
if(CheckCharacterItem(tmpChr, "blade_mKnife"))
{
if(!IsEquipCharacterByItem(tmpChr, "blade_mKnife")) EquipCharacterByItem(tmpChr, "blade_mKnife");
}
Items_FindItem("pistolmket", &weapon);
weapon.model = "musket_back";
EquipCharacterByItem(tmpChr, "pistolmket");
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
if(IsEquipCharacterByItem(tmpChr, "blademketK"))
{
RemoveCharacterEquip(tmpChr, BLADE_ITEM_TYPE );
TakeItemFromCharacter(tmpChr, "blademketK");
GiveItem2Character(tmpChr, "blade_mKnife");
EquipCharacterByItem(tmpChr, "blade_mKnife");
GiveItem2Character(tmpChr, "pistolmket");
EquipCharacterByItem(tmpChr, "pistolmket");
Items_FindItem("pistolmket", &weapon);
if(weapon.model == "musket")
{
weapon.model = "musket_back";
EquipCharacterByItem(tmpChr, "pistolmket");
}
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
if(IsEquipCharacterByItem(tmpChr, "pistolmtoon"))
{
Items_FindItem("pistolmtoon", &weapon);
weapon.model = "musketoon_back";
EquipCharacterByItem(tmpChr, "pistolmtoon");
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
if(IsEquipCharacterByItem(tmpChr, "pistolmketB"))
{
Items_FindItem("pistolmketB", &weapon);
weapon.model = "musketB_back";
EquipCharacterByItem(tmpChr, "pistolmketB");
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
if(IsEquipCharacterByItem(tmpChr, "blademketB"))
{
TakeItemFromCharacter(tmpChr, "blademketB");
if(!CheckCharacterItem(tmpChr, "bladeX4")) GiveItem2Character(tmpChr, "bladeX4");
EquipCharacterByItem(tmpChr, "bladeX4");
GiveItem2Character(tmpChr, "pistolmketB");
EquipCharacterByItem(tmpChr, "pistolmketB");
Items_FindItem("pistolmketB", &weapon);
if(weapon.model == "musketB")
{
weapon.model = "musketB_back";
EquipCharacterByItem(tmpChr, "pistolmketB");
}
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
if(IsEquipCharacterByItem(tmpChr, "Arguebuse"))
{
Items_FindItem("Arguebuse", &weapon);
weapon.model = "Arguebuse_back";
EquipCharacterByItem(tmpChr, "Arguebuse");
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
if(IsEquipCharacterByItem(tmpChr, "pistolbbuss"))
{
Items_FindItem("pistolbbuss", &weapon);
weapon.model = "blunder1_10_back";
EquipCharacterByItem(tmpChr, "pistolbbuss");
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
if(IsEquipCharacterByItem(tmpChr, "pistol13"))
{
Items_FindItem("pistol13", &weapon);
weapon.model = "pistol13_back";
EquipCharacterByItem(tmpChr, "pistol13");
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
if(IsEquipCharacterByItem(tmpChr, "LongRifle_C"))
{
Items_FindItem("LongRifle_C", &weapon);
weapon.model = "LongRifle_C_back";
EquipCharacterByItem(tmpChr, "LongRifle_C");
tmpChr.chr_ai.charge = GunCurCharge; // Levis
}
}
}
}
}