Heya folks,
Looking for one of two things (or both if they’re available). Let us assume for a moment that I cannot install CPP (but am glad to plagiarize their scripts, as I have).
I want to get weapon buff spells to work on missile weapons (bows, xbows, slings, etc). I’ve gotten flame weapon (and family) to buff a stack of directly targeted arrows (using the same method Bless Weapon uses), but none of the other spells are working. I would think that the functions could be called, but I don’t know what I’m doing wrong mechanically.
My “2 things”, would be to help me make these function, or explain to me why they won’t.
Flame Weapon/Arrow
//:: 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
#include "70_inc_spells"
//#include "nw_i0_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
struct spell spell = spellsDeclareMajorVariables();
effect eVis = EffectVisualEffect(VFX_IMP_PULSE_FIRE);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
int nDuration = spell.Level;
int nCasterLvl = spell.Level;
object oPossessor;
//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%
}
// ---------------- TARGETED ON Missles -------------------
object oMyMissle = GetItemInSlot(INVENTORY_SLOT_ARROWS,oPossessor); //INVENTORY_SLOT_BOLTS INVENTORY_SLOT_BULLETS
oPossessor = GetItemPossessor(oMyMissle);
if(GetIsObjectValid(spell.Target) && IPGetIsProjectile(spell.Target))
{
SignalEvent(oPossessor, EventSpellCastAt(spell.Caster, spell.Id, FALSE));
if (nDuration>0)
AddFlamingEffectToWeapon(oMyMissle, HoursToSeconds(nDuration),nCasterLvl);
if(GetIsObjectValid(oPossessor))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oMyMissle);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, oMyMissle, HoursToSeconds(nDuration));
}
else
{
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, spell.Loc);
}
return;
}
object oMyWeapon = IPGetTargetedOrEquippedMeleeWeapon();
oPossessor = GetItemPossessor(oMyWeapon);
if(GetIsObjectValid(oMyWeapon) )
{
SignalEvent(oPossessor, EventSpellCastAt(spell.Caster, spell.Id, FALSE));
if (nDuration>0)
AddFlamingEffectToWeapon(oMyWeapon, HoursToSeconds(nDuration),nCasterLvl);
if(GetIsObjectValid(oPossessor))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPossessor);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, oPossessor, HoursToSeconds(nDuration));
}
else
{
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, spell.Loc);
}
return;
}
else
{
FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
return;
}
}```