I am trying once again to construct my Sharpshooter class but I need help with a custom feat. This feat should first detect when the character has a bow equiped and then detect which score is stronger the character's strength modifier or the bow's mighty score. Lastly the script should apply whichever score is higher as the bow's new mighty score. I was getting some help but the person was talking way above my skill level. Here is the script I have so far but I do not know how to get it to apply the greater score to the bow.
#include "x2_inc_itemprop"
const int FEAT_SSHOOT_BOW_MOD = 2839;
object oPC = GetFirstPC(FALSE);
int IsBowEquipped(object oPC)
{
// get the type of item wielded in the left hand
object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, OBJECT_SELF);
int nType = GetBaseItemType(oItem);
// check if (holding a bow and (having the right feat)
if (((nType == BASE_ITEM_LONGBOW) || (nType == BASE_ITEM_SHORTBOW) && (GetHasFeat(FEAT_SSHOOT_BOW_MOD, oPC))))
{
return TRUE;
}
else
{
return FALSE;
}
}
int AddMightToWeapon(object oMyWeapon)
{
object oMyWeapon = IsBowEquipped();
int iStr = GetAbilityModifier(ABILITY_STRENGTH, OBJECT_SELF);
int iMight = GetItemParam1(ITEM_PROPERTY_MIGHTY, oMyWeapon);
if (iMight < iStr)
{
return iStr;
}
else
{
return iMight;
}
}
void main()
{
if (IsBowEquipped(OBJECT_SELF) && (GetLocalInt(oPC,"FEAT_SSHOOT_BOW_MOD") <1))
{
SetLocalInt(oPC,"FEAT_SSHOOT_BOW_MOD",1);
itemproperty ipMight = ItemPropertyMaxRangeStrengthMod(AddMightToWeapon);
IPSafeAddItemProperty(oMyWeapon, ipMight, DURATION_TYPE_TEMPORARY(HoursToSeconds(72)), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, FALSE);
FloatingTextStringOnCreature("Sharpshooter's bow adjusted", OBJECT_SELF);
}
else
{
SetLocalInt(oPC,"FEAT_SSHOOT_BOW_MOD",0);
}
}
Thank you in advance.