Magic Weapon Change for Gloves

Forum for scripters of NWN material and third party applications.
Post Reply
Fredegar
Noobie
Posts: 4
Joined: Tue Nov 01, 2005 4:34 pm

Magic Weapon Change for Gloves

Post by Fredegar » Fri Dec 30, 2005 1:39 am

For Hades, I modified the Greater Magic Weapon and Magic Weapon spell script to allow BASE_ITEM_GLOVES to be enchanted by the spell. Gloves will not take an enhancement type Enhancement so my work around was to have it apply a seperate Attack bonus and Damage bonus to the enchanted glove. If any other worlds want to use it, I'm sure your monks will appreciate it.

A huge thanks for those who have worked and continue to work on the spellhooking code.

This is the version for Greater Magic Weapon. Magic Weapon would be the same but with the enhancement set to 1.



case SPELL_GREATER_MAGIC_WEAPON :
//::///////////////////////////////////////////////
//:: Greater Magic Weapon
//:: V1.5
//:: Bioware: X2_S0_GrMagWeap
//:://////////////////////////////////////////////
{
effect eVis = EffectVisualEffect( VFX_IMP_SUPER_HEROISM );
effect eLink = EffectVisualEffect( VFX_DUR_CESSATE_POSITIVE );
int iDuration = iLevel;
int iBonus = iLevel / 4;

//Limit iLevel to 5, so it max out at +5 enhancement to the weapon.
if(iBonus > 5) iBonus = 5;

object oWeapon = SHS_GetTargetedOrEquippedMeleeWeapon(oTarget);
object oOwner = GetItemPossessor(oWeapon);

int iMilitantLevels;
if (MILITANT_LEVEL_BONUSES_ON)
{
iMilitantLevels = SHS_GetMilitantLevels(oOwner);
if (DEBUG) SendMessageToPC(oCaster, "avlis_spellhook:main():SPELL_GREATER_MAGIC_WEAPON: Militant Level: " + IntToString(iMilitantLevels));
}

if (GetWasMetamagicFeatUsed(iMeta, METAMAGIC_EXTEND)) iDuration = iDuration * 2; //Duration is +100%

// Militant Level Bonuses provide better buffs based on the number of
// militant levels a fighter style character has.
if (MILITANT_LEVEL_BONUSES_ON)
{
if (iMilitantLevels >= 6) iBonus++; //Enhancement bonus bump +1
if (iMilitantLevels >= 16) iDuration = iDuration + iDuration / 2; //Duration increased 50% - this stacks with Extend Spell
if (iMilitantLevels >= 26) iBonus++; //Enhancement bonus bump +1, total bump +2
if (iMilitantLevels >= 36) iBonus++; //Enhancement bonus bump +1, total bump +3
}
//Check to see if target is wearing gloves.
if((GetIsObjectValid(oWeapon)) && (GetBaseItemType(oWeapon)==BASE_ITEM_GLOVES))
{
SignalEvent(oOwner, EventSpellCastAt(oCaster, iSpell, FALSE));
if (iDuration>0)
{
//Code to keep people from enchanting weapons held by fighters then switching them.
if (MILITANT_LEVEL_BONUSES_ON && iMilitantLevels >= 6)
{
if (iMilitantLevels >= 6) SetLocalInt(oWeapon, "SPELL_GREATER_MAGIC_WEAPON", 1);
if (iMilitantLevels >= 16) SetLocalInt(oWeapon, "SPELL_GREATER_MAGIC_WEAPON", 2);
if (iMilitantLevels >= 26) SetLocalInt(oWeapon, "SPELL_GREATER_MAGIC_WEAPON", 3);
if (iMilitantLevels >= 36) SetLocalInt(oWeapon, "SPELL_GREATER_MAGIC_WEAPON", 4);
DelayCommand(TurnsToSeconds(iDuration), DeleteLocalInt(oWeapon, "SPELL_GREATER_MAGIC_WEAPON"));
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, GetItemPossessor(oWeapon), TurnsToSeconds(iDuration));
IPSafeAddItemProperty(oWeapon,ItemPropertyAttackBonus(iBonus), (TurnsToSeconds(iDuration)), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
IPSafeAddItemProperty(oWeapon,ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_BLUDGEONING, iBonus), (TurnsToSeconds(iDuration)), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
}
}
else if(GetIsObjectValid(oWeapon) )
{
SignalEvent(oOwner, EventSpellCastAt(oCaster, iSpell, FALSE));
if (iDuration>0)
{
//Code to keep people from enchanting weapons held by fighters then switching them.
if (MILITANT_LEVEL_BONUSES_ON && iMilitantLevels >= 6)
{
if (iMilitantLevels >= 6) SetLocalInt(oWeapon, "SPELL_GREATER_MAGIC_WEAPON", 1);
if (iMilitantLevels >= 16) SetLocalInt(oWeapon, "SPELL_GREATER_MAGIC_WEAPON", 2);
if (iMilitantLevels >= 26) SetLocalInt(oWeapon, "SPELL_GREATER_MAGIC_WEAPON", 3);
if (iMilitantLevels >= 36) SetLocalInt(oWeapon, "SPELL_GREATER_MAGIC_WEAPON", 4);
DelayCommand(TurnsToSeconds(iDuration), DeleteLocalInt(oWeapon, "SPELL_GREATER_MAGIC_WEAPON"));
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, GetItemPossessor(oWeapon), TurnsToSeconds(iDuration));
IPSafeAddItemProperty(oWeapon,ItemPropertyEnhancementBonus(iBonus), (TurnsToSeconds(iDuration)), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
}

}
else
FloatingTextStrRefOnCreature(83615, oCaster);
}
break;

jaythespacehound
Groundling
Posts: 93
Joined: Wed Feb 16, 2005 6:50 pm
Location: Hobart Australia

Post by jaythespacehound » Fri Dec 30, 2005 8:33 am

Nice to see, thank you.
Jay
________________
Outlands Head Coder

Loki70
Planewalker
Posts: 27
Joined: Mon Sep 26, 2005 12:25 am
Location: Seattle, WA

Post by Loki70 » Fri Dec 30, 2005 9:26 pm

*pokes the Avlis coders*

PlasmaJohn
Planewalker
Posts: 27
Joined: Sat Apr 10, 2004 12:28 pm

Post by PlasmaJohn » Thu Jan 05, 2006 12:01 pm

A similar change was made in Spellhooking 1.7.3.1 which was released to the MC's recently. That or 1.7.3.2 (not yet out) will start showing up during the next few release cycles.

Loki70
Planewalker
Posts: 27
Joined: Mon Sep 26, 2005 12:25 am
Location: Seattle, WA

Post by Loki70 » Thu Jan 05, 2006 7:16 pm

Tested it with my main, no effect. Tested with three types of gloves (custom plot, custom, and bioware). I will test it again (could be that the server was not updated)

Post Reply