// Add EB or AB to weapons via lever
#include “x2_inc_itemprop”
void main()
{
// Get the creature who used the lever.
object oPC = GetLastUsedBy();
// Object to add enhancement to.
object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
// Set duration to permnent
float fDuration = 0.0;
// Items Current Bonus
int nBcount;
// Items Next Bonus
int nEB = 1+nBcount;
itemproperty ipB = ItemPropertyAttackBonus(nEB);
// Check for ranged Weapon
int nRanged = IPGetIsRangedWeapon(oItem); if(nRanged == TRUE){ActionSpeakString(“I have a melee weapon”);} else{ActionSpeakString(“I am Ranged”);}
// Set Bonus types
int nTypeAB = ITEM_PROPERTY_ATTACK_BONUS;
int nTypeEB = ITEM_PROPERTY_ENHANCEMENT_BONUS;
if(nRanged == TRUE){int nBcount = IPGetWeaponEnhancementBonus(oItem,nTypeAB);ActionSpeakString(“Setting AB”);}
else if(nRanged != TRUE){int nBcount = IPGetWeaponEnhancementBonus(oItem,nTypeEB);ActionSpeakString(“Setting EB”);}
// Create the item property
if(nRanged == TRUE){itemproperty ipB = ItemPropertyAttackBonus(nEB);ActionSpeakString(“Getting AB”);} else if(nRanged != TRUE){itemproperty ipB = ItemPropertyEnhancementBonus(nEB);ActionSpeakString(“Getting EB”);}
IPSafeAddItemProperty(oItem,ipB,fDuration);
}
This is what i have so far. i added some speak strings to make sure the code was running and up to where.
as of right now it will run right to the end but it won’t add EB if it’s a melee weapon and it won’t add more then 1 AB regardless of ranged or melee weapon.
can someone give me some tips to make sure if its a melee weap it adds EB, and how i can make it add EB or AB +1 each time the lever is pulled?
Thanks! I’m still trying to figure it out myself also.
// Add EB or AB to weapons via lever
#include “x2_inc_itemprop”
void main()
{
// Get the creature who used the lever.
object oPC = GetLastUsedBy();
// Object to add enhancement to.
object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
// Set duration to permnent
float fDuration = 0.0;
// Items Current Bonus
int nBcount;
// Items Next Bonus
int nEB = 1+nBcount;
// Check for ranged Weapon
int nRanged = IPGetIsRangedWeapon(oItem); if(nRanged == TRUE){ActionSpeakString("I have a melee weapon");} else{ActionSpeakString("I am Ranged");}
// Set Bonus types
int nTypeAB = ITEM_PROPERTY_ATTACK_BONUS;
int nTypeEB = ITEM_PROPERTY_ENHANCEMENT_BONUS;
if(nRanged == TRUE){int nBcount = IPGetWeaponEnhancementBonus(oItem,nTypeAB);ActionSpeakString("Setting AB");}
else if(nRanged != TRUE){int nBcount = IPGetWeaponEnhancementBonus(oItem,nTypeEB);ActionSpeakString("Setting EB");}
// Create the item property
itemproperty ipA = ItemPropertyAttackBonus(nEB);
itemproperty ipE = ItemPropertyEnhancementBonus(nEB);
if(nRanged == TRUE){IPSafeAddItemProperty(oItem,ipA,fDuration);}else if(nRanged != TRUE){IPSafeAddItemProperty(oItem,ipE,fDuration);}
}
ok so this way here will change between AB/EB based on melee or Ranged weapon.
Now i’m looking for a way to make it add by +1 hopefully without adding another 25 + lines to it haha. any secrets?
// Add EB or AB to weapons via lever
#include “x2_inc_itemprop”
void main()
{
// Get the creature who used the lever.
object oPC = GetLastUsedBy();
// Object to add enhancement to.
object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
// Set duration to permnent
float fDuration = 0.0;
// Items Current Bonus
// Check for ranged Weapon
int nRanged = IPGetIsRangedWeapon(oItem);
if(nRanged != TRUE){ActionSpeakString(“I have a melee weapon”);}
else if(nRanged == TRUE){ActionSpeakString(“I am Ranged”);}
int nAcount = IPGetWeaponEnhancementBonus(oItem,ITEM_PROPERTY_ATTACK_BONUS);
int nEcount = IPGetWeaponEnhancementBonus(oItem,ITEM_PROPERTY_ENHANCEMENT_BONUS);
// Create the item property.
itemproperty ipA = ItemPropertyAttackBonus(nAcount+1);
itemproperty ipE = ItemPropertyEnhancementBonus(nEcount+1);
if(nRanged == TRUE && nAcount<12){IPSafeAddItemProperty(oItem,ipA,fDuration);}
else if(nRanged != TRUE && nEcount<12){IPSafeAddItemProperty(oItem,ipE,fDuration);}
}
Got it working!
1 Like