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

For in-game support requests, and bug reports.
User avatar
Li'l Rose
Posts: 142
Joined: Thu Apr 09, 2015 8:19 pm

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

Post by Li'l Rose » Sun Dec 06, 2015 6:46 pm

Bless Weapon. This one can also target bolts for the slay rakshasa.

Code: Select all

//::///////////////////////////////////////////////
//:: 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 Rose Dec. 6, 2015


#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 nCasterLvl = 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;
     }
 }

 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;
    }
}

User avatar
Li'l Rose
Posts: 142
Joined: Thu Apr 09, 2015 8:19 pm

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

Post by Li'l Rose » Sun Dec 06, 2015 6:52 pm

That is all five of them. Although you mentioned six to me, only five were posted.

If you find any bugs, please let me know.

If I could make a suggestion, change bladethirst to positive, add an assassin acid spell, and a blackguard negative spell. Not sure if it is possible, but just a suggestion. Perhaps could be done like the rogue magic damage.

User avatar
tarashon
Posts: 857
Joined: Sun Jan 11, 2015 6:27 pm

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

Post by tarashon » Sun Dec 06, 2015 7:05 pm

Cool, and a thousand thanks rose. I'll put it in the module RIGHT NOW and reload it !

As for your suggestion I dont see why not making ranger positive. Assasins and blackguards though are prestige classes meaning one characters can then get these for EXTRA. My main intention was to make it for the "normal true classes". Does that make sense ?

Atleast I believe there should be some extra prequisite like level 10+ in the given class. WHat do you think yourself ?

Oh, and btw the 6th is bardsong at level 20+ or something so it doesnt need fixing :)

/Tara

User avatar
tarashon
Posts: 857
Joined: Sun Jan 11, 2015 6:27 pm

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

Post by tarashon » Sun Dec 06, 2015 7:12 pm

Not sure If i explained it right. My point was to have these damage types being a part of the different "Archetypes" of characters, and not powers one could "shop for" in builds. Not sure if the latter will be a problem with ballance isues especially one character having 2 r perhaps even 3 of these by themselves, which together with a forge weapon..... *OUCH*

* EDIT *

LOL , considering things now...

Perhaps what we should do was to lower all of them to 2d8, and then add the two last, actually making it possible to stackbuild but at the same time actually lowering the max amount possible for a weapon in a huge group...

If you can please make the 2 scripts Rose - acid and negative, so they function on a unique power item, and ill make it so that characters of level 6+ in those classes get an item that can be used 5times per day.

/tara

User avatar
tarashon
Posts: 857
Joined: Sun Jan 11, 2015 6:27 pm

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

Post by tarashon » Sun Dec 06, 2015 7:43 pm

Just tested healingsting with halande, and it works fine with the both weapons on his wolf companion :)

However it still wont let him target himself. I have a feelings its hardcoded. Perhaps what one could do is merely let it also fire on himself when he uses it on others ? Atleast that will work and getting one "free spell" on himself ( whether he wants it or not ) really isn't that big of an issue.

Would that be possible Rose ?

/tara

User avatar
Li'l Rose
Posts: 142
Joined: Thu Apr 09, 2015 8:19 pm

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

Post by Li'l Rose » Sun Dec 06, 2015 8:13 pm

Even with just main classes, one can easily obtain three of the weapon damages, plus the forge damages, as well as more damages cast by your other party members. So yeah, it would make more sense to lower the damages.

Consider a fighter mage cleric build. With at least ten levels in each class, and wielding a two-handed weapon, one can obtain bludgeoning, piercing, slashing, fire, cold, and one other elemental damage from the forge. So yeah, weapons can become pretty powerful. Also if you consider your party mates of a bard, druid, and ranger.

And yes, I can make the item scripts, and have them require six or ten levels of the required class.

User avatar
Li'l Rose
Posts: 142
Joined: Thu Apr 09, 2015 8:19 pm

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

Post by Li'l Rose » Sun Dec 06, 2015 8:16 pm

tarashon wrote:Just tested healingsting with halande, and it works fine with the both weapons on his wolf companion :)

However it still wont let him target himself. I have a feelings its hardcoded. Perhaps what one could do is merely let it also fire on himself when he uses it on others ? Atleast that will work and getting one "free spell" on himself ( whether he wants it or not ) really isn't that big of an issue.

Would that be possible Rose ?

/tara
I will take another look at that one. Could also just overwrite another spell that is not really used by anyone.

User avatar
Li'l Rose
Posts: 142
Joined: Thu Apr 09, 2015 8:19 pm

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

Post by Li'l Rose » Sun Dec 06, 2015 8:38 pm

I looked on the wiki, and healing sting is meant as a touch spell to be cast on hostile creatures, so perhaps would be better to try another buff type spell.

User avatar
Li'l Rose
Posts: 142
Joined: Thu Apr 09, 2015 8:19 pm

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

Post by Li'l Rose » Sun Dec 06, 2015 8:48 pm

Do you wish the item scripts to cast a fixed amount of damage, or have it based on class level?

User avatar
tarashon
Posts: 857
Joined: Sun Jan 11, 2015 6:27 pm

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

Post by tarashon » Sun Dec 06, 2015 9:23 pm

hmm... My first thought was the same 2d8 as others.

But now you mention it...

Level 1 1d8
level 2 1d8
level 3 1d10
level 4 1d10
level 5 1d12
level 6 2d8

Will be perfect instead of having them first work when one have the minimum 6 levels required. Possible ?

/tara

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests