Hello everyone
One of my favored features of the Neverwinter Nights module Infinite Dungeons, was the crafting anvil that allowed a player to use a recipe card to enhance a weapon with a certain feat or bonus
I’ve been working on a module to sort of replicate this feature. However I have been stuck on trying to apply the property to the actual weapon.
I have created a recipe card item that runs the tag based scripting method ‘OnItemActivated’ event which I will post below:
else if (nEvent == X2_ITEM_EVENT_ACTIVATE)
{
oPC = GetItemActivator();
oItem = GetItemActivated();
//SendMessageToPC(oPC, "Ran Recipe Check");
itemproperty ipAddFeat = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD,IP_CONST_DAMAGEBONUS_1d6);//Add the cold damage 1d6
object oAnvil = GetItemActivatedTarget();
object oIn1 = OBJECT_INVALID;
object oIn2 = OBJECT_INVALID;
object oWeapon = OBJECT_INVALID;
if(GetTag(oAnvil) != "Anvil")//if the target object is not the anvil, return
return;
object oSelect = GetFirstItemInInventory(oAnvil);
while (GetIsObjectValid(oSelect))//here we sort through the inventory and look for the gems and weapon
{
if( IPGetIsMeleeWeapon(oSelect) || IPGetIsRangedWeapon(oSelect) )
{
oWeapon = oItem;
//SendMessageToPC(oPC, "Found Weapon");// debug
}
if(GetTag(oSelect) == "NW_IT_GEM008")
oIn1 = oSelect;
//SendMessageToPC(oPC, "found sapphire"); }
if(GetTag(oSelect) == "NW_IT_GEM011")
oIn2 = oSelect;
//SendMessageToPC(oPC, "found garnet");}
oSelect = GetNextItemInInventory(oAnvil);
}
if(GetIsObjectValid(oWeapon) && GetIsObjectValid(oIn1) && GetIsObjectValid(oIn2) )//if all the required items are here, apply the enchantment
{
//SHOULD ADDITEMPROPERTY OR IPSAFEADDITEMPROPERTY BE USED?
//AddItemProperty(DURATION_TYPE_PERMANENT, ipAddFeat, oWeapon);
IPSafeAddItemProperty(oWeapon, ipAddFeat);
DestroyObject(oIn1);
DestroyObject(oIn2);
DestroyObject(oItem);
}
}
To iterate through the code, it checks to see if the ‘recipe’ card was used on the magic anvil
It then checks to see if there are the required ingredients(GEMS) in the anvil as well as a weapon
It properly goes through the inventory, tagging each item and then destroys the ingredients and recipe card
However, the weapon being placed in the anvil is not accepting the bonus enchantment, as you can see in this code is the Cold 1d6 bonus
I have tried using both functions AddItemProperty and IPSafeAddItemProperty
I read about these codes on the Lexicon and I saw the examples that were used, how ever I had no success adding the enchantment, which I may feel that these require much more to work
Has anyone had any success using these functions? Or am I just way off base?
Any help is greatly appreciated