void SetMultipleCraftingResults(string sUseItem, string sTargetItem,object oBox); // This refers to standard crafting, not enchanting // Returns the tag of the crafting machine needed, or "" if none is needed string GetCraftMachineNeeded(int nMachine); // Checks whether the PC is within 5 feet of an object with the string sMachine // Returns the machine if so, or OBJECT_INVALID if not object GetCraftMachine(object oPC, string sMachine); // Has the PC face the machine and possibly run some graphics and sounds void DoCraftingGraphics(object oPC, object oMachine); // Adds a bullet property to the bullets or ranged weapons, based on sUseItem object AddBulletProperty(object oTarget, string sUseItem); string GetCraftMachineNeeded(int nMachine) { // The res ref of the machine that is needed string sMachine=""; switch (nMachine) { case 1: sMachine = "jw_forge"; break; case 2: sMachine = "jw_anvil"; break; } return sMachine; } object GetCraftMachine(object oPC, string sMachine) { // We need to check whether the PC is close to the relevant device object oDevice; oDevice=GetNearestObjectByTag(sMachine,oPC); if (!GetIsObjectValid(oDevice)) return OBJECT_INVALID; float fDistance=GetDistanceBetween(oPC,oDevice); if (fDistance<0.0) return OBJECT_INVALID; if (fDistance>5.0) return OBJECT_INVALID; return oDevice; } void DoCraftingGraphics(object oPC, object oMachine) { // We need to check whether the PC is close to the relevant device string sSound; int nVFX; if (GetTag(oMachine)=="jw_forge") { sSound="al_cv_smithfrnc1"; nVFX=VFX_DUR_GHOST_SMOKE; } else if (GetTag(oMachine)=="jw_anvil") { sSound="as_cv_smithhamr3"; nVFX=VFX_COM_SPARKS_PARRY; } else if (GetTag(oMachine)=="jw_kiln") { sSound="al_cv_furnace1"; nVFX=VFX_DUR_SMOKE; } AssignCommand(oPC,SetFacingPoint(GetPosition(oMachine))); if (nVFX!=0) ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(nVFX),oMachine,6.0); AssignCommand(oMachine,PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE)); AssignCommand(oMachine,PlaySound(sSound)); DelayCommand(5.0,AssignCommand(oMachine,PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE))); } void SetMultipleCraftingResults(string sUseItem, string sTargetItem,object oBox) { } // Adds a bullet property to the bullets or ranged weapons, based on sUseItem object AddBulletProperty(object oTarget, string sUseItem) { itemproperty iProp; string sTemplate = GetResRef(oTarget); string sItemType; switch (GetBaseItemType(oTarget)) { case BASE_ITEM_BULLET: sItemType="ik_blt_"; break; case BASE_ITEM_DART: sItemType="ik_drt_"; break; case BASE_ITEM_SHURIKEN: sItemType="ik_shk_"; break; case BASE_ITEM_THROWINGAXE: sItemType="ik_axe_"; break; } object oPossessor = GetItemPossessor(oTarget); location lLocation = GetLocation(oPossessor); string sNewTag = sItemType+sUseItem; object oTempObject = CreateObject(OBJECT_TYPE_ITEM, sTemplate , lLocation, FALSE, sNewTag); object oOldObject = oTarget; oTarget=CopyItem(oTempObject, oPossessor); DestroyObject(oTempObject); if (sUseItem=="etr_fire") { iProp=ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_FIRE,IP_CONST_DAMAGEBONUS_1d4); } else if (sUseItem=="etr_quartz") { iProp=ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ELECTRICAL,IP_CONST_DAMAGEBONUS_1d4); } else if (sUseItem=="etr_nature") { iProp=ItemPropertyOnHitProps(IP_CONST_ONHIT_DOOM,IP_CONST_ONHIT_SAVEDC_18,IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS); } else if (sUseItem=="etr_spike") { iProp=ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_PIERCING,IP_CONST_DAMAGEBONUS_1d4); } else if (sUseItem=="etr_holy") { iProp=ItemPropertyOnHitProps(IP_CONST_ONHIT_SLOW,IP_CONST_ONHIT_SAVEDC_16,IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS); } else if (sUseItem=="etr_gas") { iProp=ItemPropertyOnHitProps(IP_CONST_ONHIT_WOUNDING,IP_CONST_ONHIT_SAVEDC_20,IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS); } else if (sUseItem=="etr_ice") { iProp=ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD,IP_CONST_DAMAGEBONUS_1d4); } else if (sUseItem=="etr_skel") { iProp=ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SLASHING,IP_CONST_DAMAGEBONUS_1d4); } else if (sUseItem=="etr_sonic") { iProp=ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SONIC,IP_CONST_DAMAGEBONUS_1d4); } else if (sUseItem=="etr_acid") { iProp=ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ACID,IP_CONST_DAMAGEBONUS_1d4); } AddItemProperty(DURATION_TYPE_PERMANENT,iProp,oTarget); DestroyObject(oOldObject); return oTarget; }