//:://///////////////////////////////////////////// //:: Flame Weapon //:: X2_S0_FlmeWeap //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Gives a melee weapon 1d4 fire damage +1 per caster level to a maximum of +10. */ //::////////////////////////////////////////////// //:: Created By: Andrew Nobbs //:: Created On: Nov 29, 2002 //::////////////////////////////////////////////// //:: Updated by Andrew Nobbs May 08, 2003 //:: 2003-07-07: Stacking Spell Pass, Georg Zoeller //:: 2003-07-15: Complete Rewrite to make use of Item Property System /* Patch 1.70 - VFX added if cast on weapon on ground */ #include "70_inc_spells" #include "x2_i0_spells" #include "x2_inc_spellhook" void AddFlamingEffectToWeapon(object oTarget, float fDuration, int nCasterLevel) { // If the spell is cast again, any previous itemproperties matching are removed. IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(124,nCasterLevel), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING); IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_FIRE), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, TRUE); } void main() { /* Spellcast Hook Code Added 2003-07-07 by Georg Zoeller If you want to make changes to all spells, check x2_inc_spellhook.nss to find out more */ if (!X2PreSpellCastCode()) { // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell return; } // End of Spell Cast Hook //Declare major variables spellsDeclareMajorVariables(); effect eVis = EffectVisualEffect(VFX_IMP_PULSE_FIRE); effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE); int nCasterLvl = spell.Level; int nDuration = 2 * spell.Level; //Limit nCasterLvl to 10, so it max out at +10 to the damage. if(nCasterLvl > 10) { nCasterLvl = 10; } if (spell.Meta == METAMAGIC_EXTEND) { nDuration = nDuration * 2; //Duration is +100% } object oMyWeapon = IPGetTargetedOrEquippedMeleeWeapon(); object oPossessor = GetItemPossessor(oMyWeapon); if(GetIsObjectValid(oMyWeapon)) { //if the possessor isn't valid, nothing should happen SignalEvent(oPossessor, EventSpellCastAt(spell.Caster, spell.Id, FALSE)); if(GetIsObjectValid(oPossessor)) { ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPossessor); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, oPossessor, TurnsToSeconds(nDuration)); } else { ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, spell.Loc); } // haaaack: store caster level on item for the on hit spell to work properly AddFlamingEffectToWeapon(oMyWeapon, TurnsToSeconds(nDuration), nCasterLvl); } else { FloatingTextStrRefOnCreature(83615, spell.Caster); } }