Page 1 of 5

Spells to fix for Rose, so they target both wielded weapons.

Posted: Sat Dec 05, 2015 11:47 pm
by tarashon
Here come the infernal list of spells you need to walk over Rose. Enjoy :)

Druids - Healing sting - 2d12 electrical damage.

---

//::///////////////////////////////////////////////
//:: Healing Sting
//:: X2_S0_HealStng
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////

// complete redesign now imbuing target held weapon with the power of lightning giving it 2d12 electrical Damage bonus.



#include "x2_inc_spellhook"

/* This function has been replaced for optimization reasons
void AddFlamingEffectToWeapon(object oTarget, float fDuration, int nCasterLvl)
{
// If the spell is cast again, any previous itemproperties matching are removed.
IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(127,nCasterLvl), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_FIRE), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
return;
}
*/

void AddFlamingEffectToWeapon( object oTarget, float fDuration, int nCasterLvl)
{
IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ELECTRICAL, IP_CONST_DAMAGEBONUS_2d12), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_ELECTRICAL), 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
effect eVis = EffectVisualEffect(VFX_IMP_PULSE_FIRE);
eVis = EffectLinkEffects(EffectVisualEffect(VFX_IMP_FLAME_M),eVis);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
int nMetaMagic = GetMetaMagicFeat();
int nCasterLvl = GetCasterLevel(OBJECT_SELF);

//Limit nCasterLvl to 10, so it max out at +10 to the damage.
//Bugfix: Limiting nCasterLvl to *20* - the damage calculation
// divides it by 2.
if(nCasterLvl > 20)
{
nCasterLvl = 20;
}

if (nMetaMagic == METAMAGIC_EXTEND)
{
nDuration = nDuration * 2; //Duration is +100%
}

object oMyWeapon = IPGetTargetedOrEquippedMeleeWeapon();

if(GetIsObjectValid(oMyWeapon) )
{
SignalEvent(GetItemPossessor(oMyWeapon), EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

if (nDuration>0)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oMyWeapon));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oMyWeapon), TurnsToSeconds(nDuration));
AddFlamingEffectToWeapon(oMyWeapon, TurnsToSeconds(nDuration),nCasterLvl);


}
return;
}
else
{
FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
return;
}
}
---

wizards and sorcerors - flameweapon - 2d12 firedamage

---
//::///////////////////////////////////////////////
//:: 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 "nw_i0_spells"
#include "x2_i0_spells"

#include "x2_inc_spellhook"

/* This function has been replaced for optimization reasons
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);
return;
}
*/

// Tarashon messed with it giving max +20 - makes sense casters give stronger than clerics.

void AddFlamingEffectToWeapon( object oTarget, float fDuration, int nCasterLvl)
{
IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_2d12), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
}

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
effect eVis = EffectVisualEffect(VFX_IMP_PULSE_FIRE);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
int nMetaMagic = GetMetaMagicFeat();
int nCasterLvl = GetCasterLevel(OBJECT_SELF);

//Limit nCasterLvl to 20, so it max out at +10 to the damage.
if(nCasterLvl > 20)
{
nCasterLvl = 20;
}

if (nMetaMagic == METAMAGIC_EXTEND)
{
nDuration = nDuration * 2; //Duration is +100%
}

object oMyWeapon = IPGetTargetedOrEquippedMeleeWeapon();

if(GetIsObjectValid(oMyWeapon) )
{
SignalEvent(GetItemPossessor(oMyWeapon), EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

if (nDuration>0)
{
// haaaack: store caster level on item for the on hit spell to work properly
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oMyWeapon));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oMyWeapon), TurnsToSeconds(nDuration));
AddFlamingEffectToWeapon(oMyWeapon, TurnsToSeconds(nDuration),nCasterLvl);

}
return;
}
else
{
FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
return;
}
}
---

Priest - darkfire - 2d12 cold damage

---
//::///////////////////////////////////////////////
//:: Darkfire
//:: X2_S0_Darkfire
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Gives a melee weapon 1d6 fire damage +1 per two caster
levels to a maximum of +10.
*/
//:://////////////////////////////////////////////
//:: Created By: Andrew Nobbs
//:: Created On: Dec 04, 2002
//:://////////////////////////////////////////////
//:: Updated by Andrew Nobbs May 08, 2003
//:: 2003-07-29: Rewritten, Georg Zoeller


#include "nw_i0_spells"
#include "x2_i0_spells"

#include "x2_inc_spellhook"

/* This function has been replaced for optimization reasons
void AddFlamingEffectToWeapon(object oTarget, float fDuration, int nCasterLvl)
{
// If the spell is cast again, any previous itemproperties matching are removed.
IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(127,nCasterLvl), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_FIRE), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
return;
}
*/

void AddFlamingEffectToWeapon( object oTarget, float fDuration, int nCasterLvl)
{
IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD, IP_CONST_DAMAGEBONUS_2d12), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_COLD), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
return;
}

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
effect eVis = EffectVisualEffect(VFX_IMP_PULSE_COLD);
eVis = EffectLinkEffects(EffectVisualEffect(VFX_IMP_FLAME_M),eVis);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
int nMetaMagic = GetMetaMagicFeat();
int nCasterLvl = GetCasterLevel(OBJECT_SELF);

//Limit nCasterLvl to 10, so it max out at +10 to the damage.
//Bugfix: Limiting nCasterLvl to *20* - the damage calculation
// divides it by 2.
if(nCasterLvl > 20)
{
nCasterLvl = 20;
}

if (nMetaMagic == METAMAGIC_EXTEND)
{
nDuration = nDuration * 2; //Duration is +100%
}

object oMyWeapon = IPGetTargetedOrEquippedMeleeWeapon();

if(GetIsObjectValid(oMyWeapon) )
{
SignalEvent(GetItemPossessor(oMyWeapon), EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

if (nDuration>0)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oMyWeapon));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oMyWeapon), TurnsToSeconds(nDuration));
AddFlamingEffectToWeapon(oMyWeapon, TurnsToSeconds(nDuration),nCasterLvl);

}
return;
}
else
{
FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
return;
}
}
---

Rangers - Bladethirst - 2d12 acid

---
// complete redesign og bladethirst now giving it 2d12 damage from flames of acidic fires - life force.



#include "x2_inc_spellhook"

/* This function has been replaced for optimization reasons
void AddFlamingEffectToWeapon(object oTarget, float fDuration, int nCasterLvl)
{
// If the spell is cast again, any previous itemproperties matching are removed.
IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(127,nCasterLvl), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_FIRE), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
return;
}
*/

void AddFlamingEffectToWeapon( object oTarget, float fDuration, int nCasterLvl)
{
IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ACID, IP_CONST_DAMAGEBONUS_2d12), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_ACID), 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
effect eVis = EffectVisualEffect(VFX_IMP_PULSE_FIRE);
eVis = EffectLinkEffects(EffectVisualEffect(VFX_IMP_FLAME_M),eVis);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
int nMetaMagic = GetMetaMagicFeat();
int nCasterLvl = GetCasterLevel(OBJECT_SELF);

//Limit nCasterLvl to 10, so it max out at +10 to the damage.
//Bugfix: Limiting nCasterLvl to *20* - the damage calculation
// divides it by 2.
if(nCasterLvl > 20)
{
nCasterLvl = 20;
}

if (nMetaMagic == METAMAGIC_EXTEND)
{
nDuration = nDuration * 2; //Duration is +100%
}

object oMyWeapon = IPGetTargetedOrEquippedMeleeWeapon();

if(GetIsObjectValid(oMyWeapon) )
{
SignalEvent(GetItemPossessor(oMyWeapon), EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

if (nDuration>0)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oMyWeapon));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oMyWeapon), TurnsToSeconds(nDuration));
AddFlamingEffectToWeapon(oMyWeapon, TurnsToSeconds(nDuration),nCasterLvl);

}
return;
}
else
{
FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
return;
}
}

---

Paladins - Bless Weapon - 2d12 divine and +3

---
//::///////////////////////////////////////////////
//:: Bless Weapon
//:: X2_S0_BlssWeap
//:: Copyright (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*

If cast on a crossbow bolt, it adds the ability to
slay rakshasa's on hit

If cast on a melee weapon, it will add the
grants a +1 enhancement bonus.
grants a +2d6 damage divine to undead

will add a holy vfx when command becomes available

If cast on a creature it will pick the first
melee weapon without these effects

*/
//:://////////////////////////////////////////////
//:: Created By: Andrew Nobbs
//:: Created On: Nov 28, 2002
//:://////////////////////////////////////////////
//:: Updated by Andrew Nobbs May 09, 2003
//:: 2003-07-07: Stacking Spell Pass, Georg Zoeller
//:: 2003-07-15: Complete Rewrite to make use of Item Property System

#include "nw_i0_spells"
#include "x2_i0_spells"

#include "x2_inc_spellhook"

void AddFlamingEffectToWeapon( object oTarget, float fDuration, int nCasterLvl)
{
IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_DIVINE, IP_CONST_DAMAGEBONUS_2d12), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
}




void AddBlessEffectToWeapon(object oTarget, float fDuration)
{
// If the spell is cast again, any previous enhancement boni are kept
IPSafeAddItemProperty(oTarget, ItemPropertyEnhancementBonus(3), fDuration, X2_IP_ADDPROP_POLICY_KEEP_EXISTING,TRUE);
// Replace existing temporary anti undead boni
//IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonusVsRace(IP_CONST_RACIALTYPE_UNDEAD, IP_CONST_DAMAGETYPE_DIVINE, IP_CONST_DAMAGEBONUS_1d4), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING );
IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_DIVINE, IP_CONST_DAMAGEBONUS_2d12), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_HOLY), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE );
return;
}


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
effect eVis = EffectVisualEffect(VFX_IMP_SUPER_HEROISM);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
object oTarget = GetSpellTargetObject();
int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
int nMetaMagic = GetMetaMagicFeat();
if (nMetaMagic == METAMAGIC_EXTEND)
{
nDuration = nDuration * 2; //Duration is +100%
}

// ---------------- TARGETED ON BOLT -------------------
if(GetIsObjectValid(oTarget) && GetObjectType(oTarget) == OBJECT_TYPE_ITEM)
{
// special handling for blessing crossbow bolts that can slay rakshasa's
if (GetBaseItemType(oTarget) == BASE_ITEM_BOLT)
{
SignalEvent(GetItemPossessor(oTarget), EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(123,1), RoundsToSeconds(nDuration), X2_IP_ADDPROP_POLICY_KEEP_EXISTING );
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oTarget));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oTarget), RoundsToSeconds(nDuration));
return;
}
}

object oMyWeapon = IPGetTargetedOrEquippedMeleeWeapon();
if(GetIsObjectValid(oMyWeapon) )
{
SignalEvent(GetItemPossessor(oMyWeapon), EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

if (nDuration>0)
{
AddBlessEffectToWeapon(oMyWeapon, TurnsToSeconds(nDuration));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oMyWeapon));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oMyWeapon), TurnsToSeconds(nDuration));
}
return;
}
else
{
FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
return;
}
}

---

Kindly observe this is what happens when I, tarashon, messes around with the spells and scripts in generel. It does not like this when Seeker is working :)

Happy working Rose, and thx for doing this :)

/tara

Re: Spells to fix for Rose, so they target both wielded weapons.

Posted: Sun Dec 06, 2015 2:21 am
by Li'l Rose
Ok, I have noticed that all the spells include this line:

object oMyWeapon = IPGetTargetedOrEquippedMeleeWeapon();

I will need to modify this function, which can be found in an include script. I could not find it in the default spellhook script, so I imagine your script has been modified.

Could you please post this script: x2_inc_spellhook

If it is not there, then it will be in x0_i0_spells or x2_i0_spells. Your first script only includes the spellhook script, so I am sure it is there.

Re: Spells to fix for Rose, so they target both wielded weapons.

Posted: Sun Dec 06, 2015 3:08 am
by tarashon
Here it is.

It is not in module scripts, which should men, its the standard unmodified version.

---

//::///////////////////////////////////////////////
//:: Spell Hook Include File
//:: x2_inc_spellhook
//:: Copyright (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*

This file acts as a hub for all code that
is hooked into the nwn spellscripts'

If you want to implement material components
into spells or add restrictions to certain
spells, this is the place to do it.

*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-06-04
//:: Updated On: 2003-10-25
//:://////////////////////////////////////////////
//:: Modified By: Deva Winblood
//:: Modified Date: January 15th-16th, 2008
//:://////////////////////////////////////////////
/*
Modified to insure no shapeshifting spells are castable upon
mounted targets. This prevents problems that can occur due
to dismounting after shape shifting, or other issues that can
occur due to preserved appearances getting out of synch.

This can additional check can be disabled by setting the variable
X3_NO_SHAPESHIFT_SPELL_CHECK to 1 on the module object. If this
variable is set then this script will function as it did prior to
this modification.

*/

//#include "x2_inc_itemprop" - Inherited from x2_inc_craft
#include "x2_inc_craft"
#include "x3_inc_horse"


const int X2_EVENT_CONCENTRATION_BROKEN = 12400;


// Use Magic Device Check.
// Returns TRUE if the Spell is allowed to be cast, either because the
// character is allowed to cast it or he has won the required UMD check
// Only active on spell scroll
int X2UseMagicDeviceCheck();


// This function holds all functions that are supposed to run before the actual
// spellscript gets run. If this functions returns FALSE, the spell is aborted
// and the spellscript will not run
int X2PreSpellCastCode();


// check if the spell is prohibited from being cast on items
// returns FALSE if the spell was cast on an item but is prevented
// from being cast there by its corresponding entry in des_crft_spells
// oItem - pass GetSpellTargetObject in here
int X2CastOnItemWasAllowed(object oItem);

// Sequencer Item Property Handling
// Returns TRUE (and charges the sequencer item) if the spell
// ... was cast on an item AND
// ... the item has the sequencer property
// ... the spell was non hostile
// ... the spell was not cast from an item
// in any other case, FALSE is returned an the normal spellscript will be run
// oItem - pass GetSpellTargetObject in here
int X2GetSpellCastOnSequencerItem(object oItem);

int X2RunUserDefinedSpellScript();



int X2UseMagicDeviceCheck()
{
int nRet = ExecuteScriptAndReturnInt("x2_pc_umdcheck",OBJECT_SELF);
return nRet;
}

//------------------------------------------------------------------------------
// GZ: This is a filter I added to prevent spells from firing their original spell
// script when they were cast on items and do not have special coding for that
// case. If you add spells that can be cast on items you need to put them into
// des_crft_spells.2da
//------------------------------------------------------------------------------
int X2CastOnItemWasAllowed(object oItem)
{
int bAllow = (Get2DAString(X2_CI_CRAFTING_SP_2DA,"CastOnItems",GetSpellId()) == "1");
if (!bAllow)
{
FloatingTextStrRefOnCreature(83453, OBJECT_SELF); // not cast spell on item
}
return bAllow;

}

//------------------------------------------------------------------------------
// Execute a user overridden spell script.
//------------------------------------------------------------------------------
int X2RunUserDefinedSpellScript()
{
// See x2_inc_switches for details on this code
string sScript = GetModuleOverrideSpellscript();
if (sScript != "")
{
ExecuteScript(sScript,OBJECT_SELF);
if (GetModuleOverrideSpellScriptFinished() == TRUE)
{
return FALSE;
}
}
return TRUE;
}



//------------------------------------------------------------------------------
// Created Brent Knowles, Georg Zoeller 2003-07-31
// Returns TRUE (and charges the sequencer item) if the spell
// ... was cast on an item AND
// ... the item has the sequencer property
// ... the spell was non hostile
// ... the spell was not cast from an item
// in any other case, FALSE is returned an the normal spellscript will be run
//------------------------------------------------------------------------------
int X2GetSpellCastOnSequencerItem(object oItem)
{

if (!GetIsObjectValid(oItem))
{
return FALSE;
}

int nMaxSeqSpells = IPGetItemSequencerProperty(oItem); // get number of maximum spells that can be stored
if (nMaxSeqSpells <1)
{
return FALSE;
}

if (GetIsObjectValid(GetSpellCastItem())) // spell cast from item?
{
// we allow scrolls
int nBt = GetBaseItemType(GetSpellCastItem());
if ( nBt !=BASE_ITEM_SPELLSCROLL && nBt != 105)
{
FloatingTextStrRefOnCreature(83373, OBJECT_SELF);
return TRUE; // wasted!
}
}

// Check if the spell is marked as hostile in spells.2da
int nHostile = StringToInt(Get2DAString("spells","HostileSetting",GetSpellId()));
if(nHostile ==1)
{
FloatingTextStrRefOnCreature(83885,OBJECT_SELF);
return TRUE; // no hostile spells on sequencers, sorry ya munchkins :)
}

int nNumberOfTriggers = GetLocalInt(oItem, "X2_L_NUMTRIGGERS");
// is there still space left on the sequencer?
if (nNumberOfTriggers < nMaxSeqSpells)
{
// success visual and store spell-id on item.
effect eVisual = EffectVisualEffect(VFX_IMP_BREACH);
nNumberOfTriggers++;
//NOTE: I add +1 to the SpellId to spell 0 can be used to trap failure
int nSID = GetSpellId()+1;
SetLocalInt(oItem, "X2_L_SPELLTRIGGER" + IntToString(nNumberOfTriggers), nSID);
SetLocalInt(oItem, "X2_L_NUMTRIGGERS", nNumberOfTriggers);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, OBJECT_SELF);
FloatingTextStrRefOnCreature(83884, OBJECT_SELF);
}
else
{
FloatingTextStrRefOnCreature(83859,OBJECT_SELF);
}

return TRUE; // in any case, spell is used up from here, so do not fire regular spellscript
}

//------------------------------------------------------------------------------
// * This is our little concentration system for black blade of disaster
// * if the mage tries to cast any kind of spell, the blade is signaled an event to die
//------------------------------------------------------------------------------
void X2BreakConcentrationSpells()
{
// * At the moment we got only one concentration spell, black blade of disaster

object oAssoc = GetAssociate(ASSOCIATE_TYPE_SUMMONED);
if (GetIsObjectValid(oAssoc) && GetIsPC(OBJECT_SELF)) // only applies to PCS
{
if(GetTag(oAssoc) == "x2_s_bblade") // black blade of disaster
{
if (GetLocalInt(OBJECT_SELF,"X2_L_CREATURE_NEEDS_CONCENTRATION"))
{
SignalEvent(oAssoc,EventUserDefined(X2_EVENT_CONCENTRATION_BROKEN));
}
}
}
}

//------------------------------------------------------------------------------
// being hit by any kind of negative effect affecting the caster's ability to concentrate
// will cause a break condition for concentration spells
//------------------------------------------------------------------------------
int X2GetBreakConcentrationCondition(object oPlayer)
{
effect e1 = GetFirstEffect(oPlayer);
int nType;
int bRet = FALSE;
while (GetIsEffectValid(e1) && !bRet)
{
nType = GetEffectType(e1);

if (nType == EFFECT_TYPE_STUNNED || nType == EFFECT_TYPE_PARALYZE ||
nType == EFFECT_TYPE_SLEEP || nType == EFFECT_TYPE_FRIGHTENED ||
nType == EFFECT_TYPE_PETRIFY || nType == EFFECT_TYPE_CONFUSED ||
nType == EFFECT_TYPE_DOMINATED || nType == EFFECT_TYPE_POLYMORPH)
{
bRet = TRUE;
}
e1 = GetNextEffect(oPlayer);
}
return bRet;
}

void X2DoBreakConcentrationCheck()
{
object oMaster = GetMaster();
if (GetLocalInt(OBJECT_SELF,"X2_L_CREATURE_NEEDS_CONCENTRATION"))
{
if (GetIsObjectValid(oMaster))
{
int nAction = GetCurrentAction(oMaster);
// master doing anything that requires attention and breaks concentration
if (nAction == ACTION_DISABLETRAP || nAction == ACTION_TAUNT ||
nAction == ACTION_PICKPOCKET || nAction ==ACTION_ATTACKOBJECT ||
nAction == ACTION_COUNTERSPELL || nAction == ACTION_FLAGTRAP ||
nAction == ACTION_CASTSPELL || nAction == ACTION_ITEMCASTSPELL)
{
SignalEvent(OBJECT_SELF,EventUserDefined(X2_EVENT_CONCENTRATION_BROKEN));
}
else if (X2GetBreakConcentrationCondition(oMaster))
{
SignalEvent(OBJECT_SELF,EventUserDefined(X2_EVENT_CONCENTRATION_BROKEN));
}
}
}
}


//------------------------------------------------------------------------------
// This function will return TRUE if the spell that is cast is a shape shifting
// spell.
//------------------------------------------------------------------------------
int X3ShapeShiftSpell(object oTarget)
{ // PURPOSE: Return TRUE if a shape shifting spell was cast at oTarget
int nSpellID=GetSpellId();
string sUp=GetStringUpperCase(Get2DAString("x3restrict","SHAPESHIFT", nSpellID));
if (sUp=="YES") return TRUE;
return FALSE;
} // X3ShapeShiftSpell()


//------------------------------------------------------------------------------
// if FALSE is returned by this function, the spell will not be cast
// the order in which the functions are called here DOES MATTER, changing it
// WILL break the crafting subsystems
//------------------------------------------------------------------------------
int X2PreSpellCastCode()
{
object oTarget = GetSpellTargetObject();
int nContinue;

//---------------------------------------------------------------------------
// This small addition will check to see if the target is mounted and the
// spell is therefor one that should not be permitted.
//---------------------------------------------------------------------------
if (!GetLocalInt(GetModule(),"X3_NO_SHAPESHIFT_SPELL_CHECK"))
{ // do check for abort due to being mounted check
if (HorseGetIsMounted(oTarget)&&X3ShapeShiftSpell(oTarget))
{ // shape shifting not allowed while mounted
if(GetIsPC(oTarget))
{
FloatingTextStrRefOnCreature(111982,oTarget,FALSE);
}
return FALSE;
} // shape shifting not allowed while mounted
} // do check for abort due to being mounted check


//---------------------------------------------------------------------------
// This stuff is only interesting for player characters we assume that use
// magic device always works and NPCs don't use the crafting feats or
// sequencers anyway. Thus, any NON PC spellcaster always exits this script
// with TRUE (unless they are DM possessed or in the Wild Magic Area in
// Chapter 2 of Hordes of the Underdark.
//---------------------------------------------------------------------------
if (!GetIsPC(OBJECT_SELF))
{
if( !GetIsDMPossessed(OBJECT_SELF) && !GetLocalInt(GetArea(OBJECT_SELF), "X2_L_WILD_MAGIC"))
{
return TRUE;
}
}

//---------------------------------------------------------------------------
// Break any spell require maintaining concentration (only black blade of
// disaster)
// /*REM*/ X2BreakConcentrationSpells();
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// Run use magic device skill check
//---------------------------------------------------------------------------
nContinue = X2UseMagicDeviceCheck();

if (nContinue)
{
//-----------------------------------------------------------------------
// run any user defined spellscript here
//-----------------------------------------------------------------------
nContinue = X2RunUserDefinedSpellScript();
}

//---------------------------------------------------------------------------
// The following code is only of interest if an item was targeted
//---------------------------------------------------------------------------
if (GetIsObjectValid(oTarget) && GetObjectType(oTarget) == OBJECT_TYPE_ITEM)
{

//-----------------------------------------------------------------------
// Check if spell was used to trigger item creation feat
//-----------------------------------------------------------------------
if (nContinue) {
nContinue = !ExecuteScriptAndReturnInt("x2_pc_craft",OBJECT_SELF);
}

//-----------------------------------------------------------------------
// Check if spell was used for on a sequencer item
//-----------------------------------------------------------------------
if (nContinue)
{
nContinue = (!X2GetSpellCastOnSequencerItem(oTarget));
}

//-----------------------------------------------------------------------
// * Execute item OnSpellCast At routing script if activated
//-----------------------------------------------------------------------
if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
SetUserDefinedItemEventNumber(X2_ITEM_EVENT_SPELLCAST_AT);
int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oTarget),OBJECT_SELF);
if (nRet == X2_EXECUTE_SCRIPT_END)
{
return FALSE;
}
}

//-----------------------------------------------------------------------
// Prevent any spell that has no special coding to handle targetting of items
// from being cast on items. We do this because we can not predict how
// all the hundreds spells in NWN will react when cast on items
//-----------------------------------------------------------------------
if (nContinue) {
nContinue = X2CastOnItemWasAllowed(oTarget);
}
}

return nContinue;
}

----

Another thing is the "healing sting" wont let me target myself i.e. the druid cant target himself or his own weapon. This makes sense I suppose being the spell it was, but can that be changed so he can target himself also ?

/tara

Re: Spells to fix for Rose, so they target both wielded weapons.

Posted: Sun Dec 06, 2015 4:43 pm
by Li'l Rose
Well, I found what I needed in the item properties script, so the spellhook script not needed.

Re: Spells to fix for Rose, so they target both wielded weapons.

Posted: Sun Dec 06, 2015 4:58 pm
by tarashon
oki ) , so how is it coming ? )

/tara

Re: Spells to fix for Rose, so they target both wielded weapons.

Posted: Sun Dec 06, 2015 6:00 pm
by Li'l Rose
It is going well. Here is flame weapon, compiled and tested. It will buff equipped melee weapons in both hands, both creature claws, and creature bite. The spell will now only cast on creatures, and no longer on equipped weapons.

Code: Select all

//::///////////////////////////////////////////////
//:: Flame Weapon
//:: X2_S0_FlmeWeap
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////

//:://////////////////////////////////////////////
//:: Created By: Andrew Nobbs
//:: Created On: Nov 29, 2002
//:://////////////////////////////////////////////
//:: Updated by Rose Dec 6, 2015


#include "nw_i0_spells"
#include "x2_i0_spells"

#include "x2_inc_spellhook"


// Tarashon messed with it giving max +20 - makes sense casters give stronger than clerics.

void AddFlamingEffectToWeapon( object oTarget, float fDuration, int nCasterLvl)
{
    IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_2d12), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
}

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
 effect eVis = EffectVisualEffect(VFX_IMP_PULSE_FIRE);
 effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
 int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
 int nMetaMagic = GetMetaMagicFeat();
 int nCasterLvl = GetCasterLevel(OBJECT_SELF);

 //Limit nCasterLvl to 20, so it max out at +10 to the damage.
 if(nCasterLvl > 20)
 {
     nCasterLvl = 20;
 }

 if (nMetaMagic == METAMAGIC_EXTEND)
 {
     nDuration = nDuration * 2; //Duration is +100%
 }

 object oTarget = GetSpellTargetObject();
 if(GetIsObjectValid(oTarget) && GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
 {
    // Alter the right hand weapon equipped by the creature.
    object oWeapon1 = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oTarget);
    if(GetIsObjectValid(oWeapon1))
    {
        // If the PC has a melee weapon equipped.
        if ( IPGetIsMeleeWeapon(oWeapon1))
        {
            SignalEvent(oWeapon1, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

            if (nDuration>0)
            {
                // haaaack: store caster level on item for the on hit spell to work properly
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon1));
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon1), TurnsToSeconds(nDuration));
                AddFlamingEffectToWeapon(oWeapon1, TurnsToSeconds(nDuration),nCasterLvl);
            }
        }
        else
        {
            FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
        }
    }
    // Alter the left hand weapon equipped by the creature.
    object oWeapon2 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oTarget);
    if(GetIsObjectValid(oWeapon2))
    {
        // If the PC has a melee weapon equipped.
        if ( IPGetIsMeleeWeapon(oWeapon2))
        {
            SignalEvent(oWeapon2, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

            if (nDuration>0)
            {
                // haaaack: store caster level on item for the on hit spell to work properly
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon2));
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon2), TurnsToSeconds(nDuration));
                AddFlamingEffectToWeapon(oWeapon2, TurnsToSeconds(nDuration),nCasterLvl);
            }
        }
        else
        {
            FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
        }
    }
    // Alter the right claw equipped by the creature.
    object oWeapon3 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oTarget);
    if(GetIsObjectValid(oWeapon3))
    {
        SignalEvent(oWeapon3, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon3));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon3), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon3, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    // Alter the left claw equipped by the creature.
    object oWeapon4 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oTarget);
    if(GetIsObjectValid(oWeapon4))
    {
        SignalEvent(oWeapon4, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon4));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon4), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon4, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    // Alter the bite equipped by the creature.
    object oWeapon5 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oTarget);
    if(GetIsObjectValid(oWeapon5))
    {
        SignalEvent(oWeapon5, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon5));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon5), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon5, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    }
    else
    {
        SendMessageToPC(OBJECT_SELF, "You must target a creature!");
        return;
    }
}

Re: Spells to fix for Rose, so they target both wielded weapons.

Posted: Sun Dec 06, 2015 6:14 pm
by Li'l Rose
Healing Sting:

Code: Select all

//::///////////////////////////////////////////////
//:: Healing Sting
//:: X2_S0_HealStng
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
//:: Updated by Rose, Dec. 6, 2015

// complete redesign now imbuing target held weapon with the power of lightning giving it 2d12 electrical Damage bonus.



 #include "x2_inc_spellhook"

/* This function has been replaced for optimization reasons
void AddFlamingEffectToWeapon(object oTarget, float fDuration, int nCasterLvl)
{
 // If the spell is cast again, any previous itemproperties matching are removed.
 IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(127,nCasterLvl), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

 IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_FIRE), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
 return;
}
*/

void AddFlamingEffectToWeapon( object oTarget, float fDuration, int nCasterLvl)
{
    IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ELECTRICAL, IP_CONST_DAMAGEBONUS_2d12), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

    IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_ELECTRICAL), 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
 effect eVis = EffectVisualEffect(VFX_IMP_PULSE_FIRE);
 eVis = EffectLinkEffects(EffectVisualEffect(VFX_IMP_FLAME_M),eVis);
 effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
 int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
 int nMetaMagic = GetMetaMagicFeat();
 int nCasterLvl = GetCasterLevel(OBJECT_SELF);

 //Limit nCasterLvl to 10, so it max out at +10 to the damage.
 //Bugfix: Limiting nCasterLvl to *20* - the damage calculation
 // divides it by 2.
 if(nCasterLvl > 20)
 {
     nCasterLvl = 20;
 }

 if (nMetaMagic == METAMAGIC_EXTEND)
 {
     nDuration = nDuration * 2; //Duration is +100%
 }

 object oTarget = GetSpellTargetObject();
 if(GetIsObjectValid(oTarget) && GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
 {
    // Alter the right hand weapon equipped by the creature.
    object oWeapon1 = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oTarget);
    if(GetIsObjectValid(oWeapon1))
    {
        // If the PC has a melee weapon equipped.
        if ( IPGetIsMeleeWeapon(oWeapon1))
        {
            SignalEvent(oWeapon1, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

            if (nDuration>0)
            {
                // haaaack: store caster level on item for the on hit spell to work properly
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon1));
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon1), TurnsToSeconds(nDuration));
                AddFlamingEffectToWeapon(oWeapon1, TurnsToSeconds(nDuration),nCasterLvl);
            }
        }
        else
        {
            FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
        }
    }
    // Alter the left hand weapon equipped by the creature.
    object oWeapon2 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oTarget);
    if(GetIsObjectValid(oWeapon2))
    {
        // If the PC has a melee weapon equipped.
        if ( IPGetIsMeleeWeapon(oWeapon2))
        {
            SignalEvent(oWeapon2, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

            if (nDuration>0)
            {
                // haaaack: store caster level on item for the on hit spell to work properly
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon2));
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon2), TurnsToSeconds(nDuration));
                AddFlamingEffectToWeapon(oWeapon2, TurnsToSeconds(nDuration),nCasterLvl);
            }
        }
        else
        {
            FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
        }
    }
    // Alter the right claw equipped by the creature.
    object oWeapon3 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oTarget);
    if(GetIsObjectValid(oWeapon3))
    {
        SignalEvent(oWeapon3, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon3));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon3), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon3, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    // Alter the left claw equipped by the creature.
    object oWeapon4 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oTarget);
    if(GetIsObjectValid(oWeapon4))
    {
        SignalEvent(oWeapon4, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon4));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon4), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon4, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    // Alter the bite equipped by the creature.
    object oWeapon5 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oTarget);
    if(GetIsObjectValid(oWeapon5))
    {
        SignalEvent(oWeapon5, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon5));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon5), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon5, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    }
    else
    {
        SendMessageToPC(OBJECT_SELF, "You must target a creature!");
        return;
    }
}

Re: Spells to fix for Rose, so they target both wielded weapons.

Posted: Sun Dec 06, 2015 6:20 pm
by Li'l Rose
Darkfire:

Code: Select all

//::///////////////////////////////////////////////
//:: Darkfire
//:: X2_S0_Darkfire
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
 Gives a melee weapon 1d6 fire damage +1 per two caster
 levels to a maximum of +10.
*/
//:://////////////////////////////////////////////
//:: Created By: Andrew Nobbs
//:: Created On: Dec 04, 2002
//:://////////////////////////////////////////////
//:: Updated by Rose Dec. 6, 2015


#include "nw_i0_spells"
#include "x2_i0_spells"

#include "x2_inc_spellhook"

/* This function has been replaced for optimization reasons
void AddFlamingEffectToWeapon(object oTarget, float fDuration, int nCasterLvl)
{
 // If the spell is cast again, any previous itemproperties matching are removed.
 IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(127,nCasterLvl), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

 IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_FIRE), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
 return;
}
*/

void AddFlamingEffectToWeapon( object oTarget, float fDuration, int nCasterLvl)
{
    IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD, IP_CONST_DAMAGEBONUS_2d12), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

    IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_COLD), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
 return;
}

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
 effect eVis = EffectVisualEffect(VFX_IMP_PULSE_COLD);
 eVis = EffectLinkEffects(EffectVisualEffect(VFX_IMP_FLAME_M),eVis);
 effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
 int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
 int nMetaMagic = GetMetaMagicFeat();
 int nCasterLvl = GetCasterLevel(OBJECT_SELF);

 //Limit nCasterLvl to 10, so it max out at +10 to the damage.
 //Bugfix: Limiting nCasterLvl to *20* - the damage calculation
 // divides it by 2.
 if(nCasterLvl > 20)
 {
     nCasterLvl = 20;
 }

 if (nMetaMagic == METAMAGIC_EXTEND)
 {
     nDuration = nDuration * 2; //Duration is +100%
 }

 object oTarget = GetSpellTargetObject();
 if(GetIsObjectValid(oTarget) && GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
 {
    // Alter the right hand weapon equipped by the creature.
    object oWeapon1 = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oTarget);
    if(GetIsObjectValid(oWeapon1))
    {
        // If the PC has a melee weapon equipped.
        if ( IPGetIsMeleeWeapon(oWeapon1))
        {
            SignalEvent(oWeapon1, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

            if (nDuration>0)
            {
                // haaaack: store caster level on item for the on hit spell to work properly
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon1));
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon1), TurnsToSeconds(nDuration));
                AddFlamingEffectToWeapon(oWeapon1, TurnsToSeconds(nDuration),nCasterLvl);
            }
        }
        else
        {
            FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
        }
    }
    // Alter the left hand weapon equipped by the creature.
    object oWeapon2 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oTarget);
    if(GetIsObjectValid(oWeapon2))
    {
        // If the PC has a melee weapon equipped.
        if ( IPGetIsMeleeWeapon(oWeapon2))
        {
            SignalEvent(oWeapon2, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

            if (nDuration>0)
            {
                // haaaack: store caster level on item for the on hit spell to work properly
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon2));
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon2), TurnsToSeconds(nDuration));
                AddFlamingEffectToWeapon(oWeapon2, TurnsToSeconds(nDuration),nCasterLvl);
            }
        }
        else
        {
            FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
        }
    }
    // Alter the right claw equipped by the creature.
    object oWeapon3 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oTarget);
    if(GetIsObjectValid(oWeapon3))
    {
        SignalEvent(oWeapon3, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon3));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon3), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon3, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    // Alter the left claw equipped by the creature.
    object oWeapon4 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oTarget);
    if(GetIsObjectValid(oWeapon4))
    {
        SignalEvent(oWeapon4, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon4));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon4), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon4, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    // Alter the bite equipped by the creature.
    object oWeapon5 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oTarget);
    if(GetIsObjectValid(oWeapon5))
    {
        SignalEvent(oWeapon5, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon5));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon5), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon5, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    }
    else
    {
        SendMessageToPC(OBJECT_SELF, "You must target a creature!");
        return;
    }
}

Re: Spells to fix for Rose, so they target both wielded weapons.

Posted: Sun Dec 06, 2015 6:27 pm
by Li'l Rose
Bladethirst:

Code: Select all

// complete redesign og bladethirst now giving it 2d12 damage from flames of acidic fires - life force.

// Updated by Rose, Dec. 6, 2015


 #include "x2_inc_spellhook"

/* This function has been replaced for optimization reasons
void AddFlamingEffectToWeapon(object oTarget, float fDuration, int nCasterLvl)
{
 // If the spell is cast again, any previous itemproperties matching are removed.
 IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(127,nCasterLvl), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

 IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_FIRE), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
 return;
}
*/

void AddFlamingEffectToWeapon( object oTarget, float fDuration, int nCasterLvl)
{
    IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ACID, IP_CONST_DAMAGEBONUS_2d12), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);

    IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_ACID), 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
 effect eVis = EffectVisualEffect(VFX_IMP_PULSE_FIRE);
 eVis = EffectLinkEffects(EffectVisualEffect(VFX_IMP_FLAME_M),eVis);
 effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
 int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
 int nMetaMagic = GetMetaMagicFeat();
 int nCasterLvl = GetCasterLevel(OBJECT_SELF);

 //Limit nCasterLvl to 10, so it max out at +10 to the damage.
 //Bugfix: Limiting nCasterLvl to *20* - the damage calculation
 // divides it by 2.
 if(nCasterLvl > 20)
 {
     nCasterLvl = 20;
 }

 if (nMetaMagic == METAMAGIC_EXTEND)
 {
     nDuration = nDuration * 2; //Duration is +100%
 }

 object oTarget = GetSpellTargetObject();
 if(GetIsObjectValid(oTarget) && GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
 {
    // Alter the right hand weapon equipped by the creature.
    object oWeapon1 = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oTarget);
    if(GetIsObjectValid(oWeapon1))
    {
        // If the PC has a melee weapon equipped.
        if ( IPGetIsMeleeWeapon(oWeapon1))
        {
            SignalEvent(oWeapon1, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

            if (nDuration>0)
            {
                // haaaack: store caster level on item for the on hit spell to work properly
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon1));
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon1), TurnsToSeconds(nDuration));
                AddFlamingEffectToWeapon(oWeapon1, TurnsToSeconds(nDuration),nCasterLvl);
            }
        }
        else
        {
            FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
        }
    }
    // Alter the left hand weapon equipped by the creature.
    object oWeapon2 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oTarget);
    if(GetIsObjectValid(oWeapon2))
    {
        // If the PC has a melee weapon equipped.
        if ( IPGetIsMeleeWeapon(oWeapon2))
        {
            SignalEvent(oWeapon2, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

            if (nDuration>0)
            {
                // haaaack: store caster level on item for the on hit spell to work properly
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon2));
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon2), TurnsToSeconds(nDuration));
                AddFlamingEffectToWeapon(oWeapon2, TurnsToSeconds(nDuration),nCasterLvl);
            }
        }
        else
        {
            FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
        }
    }
    // Alter the right claw equipped by the creature.
    object oWeapon3 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oTarget);
    if(GetIsObjectValid(oWeapon3))
    {
        SignalEvent(oWeapon3, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon3));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon3), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon3, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    // Alter the left claw equipped by the creature.
    object oWeapon4 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oTarget);
    if(GetIsObjectValid(oWeapon4))
    {
        SignalEvent(oWeapon4, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon4));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon4), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon4, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    // Alter the bite equipped by the creature.
    object oWeapon5 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oTarget);
    if(GetIsObjectValid(oWeapon5))
    {
        SignalEvent(oWeapon5, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

        if (nDuration>0)
        {
            // haaaack: store caster level on item for the on hit spell to work properly
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon5));
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon5), TurnsToSeconds(nDuration));
            AddFlamingEffectToWeapon(oWeapon5, TurnsToSeconds(nDuration),nCasterLvl);
        }
    }
    }
    else
    {
        SendMessageToPC(OBJECT_SELF, "You must target a creature!");
        return;
    }
}

Re: Spells to fix for Rose, so they target both wielded weapons.

Posted: Sun Dec 06, 2015 6:38 pm
by tarashon
OMG. Awesome :)

Then Just bless weapon to go and I can implement it in the module :)

Tried the new ( updated ) druid shifter form btw, and its really awesome; making druids so much cooler :)

Thx a lot Rose !

/tara