http://nwvault.ign.c...ad.php?id=72586
the code is:
/* Script Created By Rami_Ahmed */
/* Include file for Weapon Breakadge System */
#include "x2_inc_itemprop"
// Weakens oItem.
// if bDecrease is true (default) it will add decreases to the items.
// if bAll is true (false by default) it will weaken all inventory items instead of Helmet, Shield & Weapon
// if bRandomChance is 1, there is 25 percent chance of not getting item decreased
// if bRandomChance is 2, there is 50 percent chance of not getting item decreased
// if bRandomChance is 3, there is 75 percent chance of not getting item decreased
void WeakenItem(object oItem, int bAll = FALSE, int bDecrease = TRUE, int bRandomChance = 0);
// Destroys oItem and removes all ints from it.
void DestroyItem(object oItem);
// Sets nAmount break points on oItem, max nAmount to set is 100.
void SetBreakInt(object oItem, int nAmount);
// Reapairs oItem from any Decreases and resets Break Points to zero.
void RepairItem(object oItem, int bCost = 0);
// Returns TRUE If oItem is a weapon.
int GetIsWeapon(object oItem);
// Returns TRUE if oItem is a shield (TowerShield, LargeShield or SmallShield).
int GetIsShield(object oItem);
// Removes all -AC, -AB and -Damage Item Propertys from oItem.
void RemoveDecrease(object oItem);
// Returns the number of breakage points on oItem
int GetBreakInt(object oItem);
// Do not use! (only used in include file)
void WeaponSpecMakeDecrease(object oItem);
// // // // //
int GetBreakInt(object oItem)
{ return GetLocalInt(oItem, "Break_Amount");
}
void SetBreakInt(object oItem, int nAmount)
{ if (nAmount > 100) nAmount = 100;
SetLocalInt(oItem, "Break_Amount", nAmount);
if (GetBreakInt(oItem) >= 100)
{ DestroyItem(oItem);
}
}
void WeakenItem(object oItem, int bAll, int bDecrease, int bRandomChance)
{int nInt = GetBreakInt(oItem);
object oPossesor = GetItemPossessor(oItem);
if (bRandomChance == 1)
{ if (d100() <= 25)
{ return;
}
}
else if (bRandomChance == 2)
{ if (d100() <= 50)
{ return;
}
}
else if (bRandomChance == 3)
{ if (d100() <= 75)
{ return;
}
}
if (bAll == FALSE)
{ if (nInt <= 50)
{ if (GetIsWeapon(oItem))
{ if (bDecrease)
{ IPSafeAddItemProperty(oItem, ItemPropertyAttackPenalty(1));
}
SetBreakInt(oItem, GetBreakInt(oItem) + 1);
FloatingTextStringOnCreature("<caaa>Your "+GetName(oItem)+" slowly detoriates...</c>", oPossesor, TRUE);
}
else if (GetBaseItemType(oItem) == BASE_ITEM_ARMOR)
{ if (bDecrease)
{ IPSafeAddItemProperty(oItem, ItemPropertyDecreaseAC(IP_CONST_ACMODIFIERTYPE_ARMOR, 1));
}
FloatingTextStringOnCreature("<caaa>Your "+GetName(oItem)+" slowly detoriates...</c>", oPossesor, TRUE);
SetBreakInt(oItem, GetBreakInt(oItem) + 1);
}
else if (GetIsShield(oItem))
{ if (bDecrease)
{ IPSafeAddItemProperty(oItem, ItemPropertyDecreaseAC(IP_CONST_ACMODIFIERTYPE_SHIELD, 1));
}
FloatingTextStringOnCreature("<caaa>Your "+GetName(oItem)+" slowly detoriates...</c>", oPossesor, TRUE);
SetBreakInt(oItem, GetBreakInt(oItem) + 1);
}
}
else if (nInt >= 50)
{ if (GetIsWeapon(oItem))
{ if (bDecrease)
{ IPSafeAddItemProperty(oItem, ItemPropertyAttackPenalty(2));
}
FloatingTextStringOnCreature("<caaa>Your "+GetName(oItem)+" slowly detoriates...</c>", oPossesor, TRUE);
SetBreakInt(oItem, GetBreakInt(oItem) + 2);
}
else if (GetBaseItemType(oItem) == BASE_ITEM_ARMOR)
{ if (bDecrease)
{ IPSafeAddItemProperty(oItem, ItemPropertyDecreaseAC(IP_CONST_ACMODIFIERTYPE_ARMOR, 2));
}
FloatingTextStringOnCreature("<caaa>Your "+GetName(oItem)+" slowly detoriates...</c>", oPossesor, TRUE);
SetBreakInt(oItem, GetBreakInt(oItem) + 2);
}
else if (GetIsShield(oItem))
{ if (bDecrease)
{ IPSafeAddItemProperty(oItem, ItemPropertyDecreaseAC(IP_CONST_ACMODIFIERTYPE_SHIELD, 2));
}
FloatingTextStringOnCreature("<caaa>Your "+GetName(oItem)+" slowly detoriates...</c>", oPossesor, TRUE);
SetBreakInt(oItem, GetBreakInt(oItem) + 2);
}
}
}
else
{ int i; for (i; i <= NUM_INVENTORY_SLOTS; i++)
{ object oWeaken = GetItemInSlot(i, oPossesor);
if (GetIsObjectValid(oWeaken))
{ if (bDecrease)
{ WeaponSpecMakeDecrease(oWeaken);
}
}
}
}
if (!GetIsObjectValid(GetItemPossessedBy(oPossesor, "wbs_breaktool")))
{ CreateItemOnObject("wbs_breaktool", oPossesor);
}
}
void WeaponSpecMakeDecrease(object oItem)
{ object oPossessor = GetItemPossessor(oItem);
if (!GetIsObjectValid(oItem) || !GetIsObjectValid(oPossessor)) return;
int nDecreaseWith;
if (GetBreakInt(oItem) <= 50)
{ nDecreaseWith = 1;
}
else if (GetBreakInt(oItem) > 50)
{ nDecreaseWith = 2;
}
FloatingTextStringOnCreature("<caaa>Your "+GetName(oItem)+" slowly detoriates...</c>", oPossessor, TRUE);
SetBreakInt(oItem, GetBreakInt(oItem) + nDecreaseWith);
if (GetIsWeapon(oItem))
{ IPSafeAddItemProperty(oItem, ItemPropertyAttackPenalty(nDecreaseWith));
}
else if (GetBaseItemType(oItem) == BASE_ITEM_ARMOR || GetBaseItemType(oItem) == BASE_ITEM_BRACER)
{ IPSafeAddItemProperty(oItem, ItemPropertyDecreaseAC(IP_CONST_ACMODIFIERTYPE_ARMOR, nDecreaseWith));
}
else if (GetIsShield(oItem))
{ IPSafeAddItemProperty(oItem, ItemPropertyDecreaseAC(IP_CONST_ACMODIFIERTYPE_SHIELD, nDecreaseWith));
}
else if (GetBaseItemType(oItem) == BASE_ITEM_AMULET)
{ IPSafeAddItemProperty(oItem, ItemPropertyDecreaseAC(IP_CONST_ACMODIFIERTYPE_NATURAL, nDecreaseWith));
}
else if (GetBaseItemType(oItem) == BASE_ITEM_BOOTS)
{ IPSafeAddItemProperty(oItem, ItemPropertyDecreaseAC(IP_CONST_ACMODIFIERTYPE_DODGE, nDecreaseWith));
}
else
{ IPSafeAddItemProperty(oItem, ItemPropertyDecreaseAC(IP_CONST_ACMODIFIERTYPE_DEFLECTION, nDecreaseWith));
}
}
void DestroyItem(object oItem)
{ int nInt = GetBreakInt(oItem);
if (nInt >= 100)
{ DestroyObject(oItem, 0.1);
FloatingTextStringOnCreature("<cæ>Your "+GetName(oItem)+" has broken.</c>", GetItemPossessor(oItem), TRUE);
}
}
void RepairItem(object oItem, int bCost)
{ if (!GetIsObjectValid(oItem)) return;
object oPC = GetItemPossessor(oItem);
if (GetBreakInt(oItem) > 0)
{ if (GetGold(oPC) < bCost && bCost > 0)
{ FloatingTextStringOnCreature("You dont have enough gold!", oPC);
return;
}
TakeGoldFromCreature(bCost, oPC, TRUE);
RemoveDecrease(oItem);
FloatingTextStringOnCreature("<cä>Your "+GetName(oItem)+" has been repaired succesfully.</c>", oPC, TRUE);
SetBreakInt(oItem, 0);
}
}
int GetIsWeapon(object oItem)
{ if (!GetIsObjectValid(oItem)) return FALSE;
int bWeapon = FALSE;
if (GetBaseItemType(oItem) == BASE_ITEM_BASTARDSWORD || // if oItem is a Bastard Sword
GetBaseItemType(oItem) == BASE_ITEM_BATTLEAXE || // if oItem is a Battle Axe
GetBaseItemType(oItem) == BASE_ITEM_CLUB || // Etc...
GetBaseItemType(oItem) == BASE_ITEM_DAGGER ||
GetBaseItemType(oItem) == BASE_ITEM_DIREMACE ||
GetBaseItemType(oItem) == BASE_ITEM_DOUBLEAXE ||
GetBaseItemType(oItem) == BASE_ITEM_DWARVENWARAXE ||
GetBaseItemType(oItem) == BASE_ITEM_GREATAXE ||
GetBaseItemType(oItem) == BASE_ITEM_GREATSWORD ||
GetBaseItemType(oItem) == BASE_ITEM_HALBERD ||
GetBaseItemType(oItem) == BASE_ITEM_HANDAXE ||
GetBaseItemType(oItem) == BASE_ITEM_HEAVYFLAIL ||
GetBaseItemType(oItem) == BASE_ITEM_KAMA ||
GetBaseItemType(oItem) == BASE_ITEM_KATANA ||
GetBaseItemType(oItem) == BASE_ITEM_KUKRI ||
GetBaseItemType(oItem) == BASE_ITEM_LIGHTFLAIL ||
GetBaseItemType(oItem) == BASE_ITEM_LIGHTHAMMER ||
GetBaseItemType(oItem) == BASE_ITEM_LIGHTMACE ||
GetBaseItemType(oItem) == BASE_ITEM_LONGSWORD ||
// GetBaseItemType(oItem) == BASE_ITEM_MAGICSTAFF || // Uncommented Magic Staff, didn't think it was under "Weapons"
GetBaseItemType(oItem) == BASE_ITEM_MORNINGSTAR ||
GetBaseItemType(oItem) == BASE_ITEM_RAPIER ||
GetBaseItemType(oItem) == BASE_ITEM_SCIMITAR ||
GetBaseItemType(oItem) == BASE_ITEM_SCYTHE ||
GetBaseItemType(oItem) == BASE_ITEM_SHORTSPEAR ||
GetBaseItemType(oItem) == BASE_ITEM_SHORTSWORD ||
GetBaseItemType(oItem) == BASE_ITEM_SICKLE ||
GetBaseItemType(oItem) == BASE_ITEM_TWOBLADEDSWORD||
GetBaseItemType(oItem) == BASE_ITEM_WARHAMMER ||
GetBaseItemType(oItem) == BASE_ITEM_WHIP )
{ bWeapon = TRUE;
}
return bWeapon;
}
int GetIsShield(object oItem)
{ int bShield = FALSE;
if (GetBaseItemType(oItem) == BASE_ITEM_TOWERSHIELD ||
GetBaseItemType(oItem) == BASE_ITEM_LARGESHIELD ||
GetBaseItemType(oItem) == BASE_ITEM_SMALLSHIELD )
{ bShield = TRUE;
}
return bShield;
}
//
void RemoveDecrease(object oItem)
{ if (!GetIsObjectValid(oItem)) return;
itemproperty ipLoop = GetFirstItemProperty(oItem);
while (GetIsItemPropertyValid(ipLoop))
{ if ((GetItemPropertyType(ipLoop) == ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER ||
GetItemPropertyType(ipLoop) == ITEM_PROPERTY_DECREASED_DAMAGE ||
GetItemPropertyType(ipLoop) == ITEM_PROPERTY_DECREASED_AC) &&
GetItemPropertyDurationType(ipLoop) == DURATION_TYPE_PERMANENT)
{ RemoveItemProperty(oItem, ipLoop);
}
ipLoop = GetNextItemProperty(oItem);
}
}
/*
void main () {} // Only for error checking
*/
I tried adding the CEP base items underneath getbaseitem whip but it tells me that it is unable to compile because there is no right bracket but i put it in.