#include "x2_inc_switches"
#include "nw_i0_spells"
#include "x2_inc_spellhook"
#include "nwn2_inc_spells"
void main()
{
object oPC = OBJECT_SELF;
int FEAT_TWIN_WEAPON_FIGHTING = GetSpellFeatId();
int SPELL_TWIN_WEAPON_FIGHTING = GetSpellId();
//if (!GetHasFeat(FEAT_TWO_WEAPON_FIGHTING, oPC)) return; //The feat shouldn't be selectable without first having Two Weapon Fighting, but just in case...
if (!GetHasFeat(FEAT_TWIN_WEAPON_FIGHTING, oPC)) return; //If the PC doesn't have the Twin Weapon Feat, do not run
object oRHand = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
if (!GetIsObjectValid(oRHand))
{
RemoveEffectsFromSpell(oPC, SPELL_TWIN_WEAPON_FIGHTING);
return;
}
object oLHand = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
if (!GetIsObjectValid(oLHand))
{
RemoveEffectsFromSpell(oPC, SPELL_TWIN_WEAPON_FIGHTING);
return;
}
int iRHand = GetBaseItemType(oRHand);
if (iRHand == BASE_ITEM_INVALID)
{
RemoveEffectsFromSpell(oPC, SPELL_TWIN_WEAPON_FIGHTING);
return;
}
int iLHand = GetBaseItemType(oLHand);
if (iLHand == BASE_ITEM_INVALID)
{
RemoveEffectsFromSpell(oPC, SPELL_TWIN_WEAPON_FIGHTING);
return;
}
if (iRHand != iLHand) //Make sure both items of the same type; if not, remove effect.
{
RemoveEffectsFromSpell(oPC, SPELL_TWIN_WEAPON_FIGHTING);
return;
}
//The above ought to filter out all ranged weapons since it is not possible to
//have anything equipped in the left hand when using one. This should also filter
//any non-weapons since it isn't possible to equip non-weapons in both hands.
int nBonus = 0;
string sWeapon = "";
if (iRHand == BASE_ITEM_DAGGER && iLHand == BASE_ITEM_DAGGER)
{
sWeapon = "Dagger";
nBonus = 2;
}
if (iRHand == BASE_ITEM_HANDAXE && iLHand == BASE_ITEM_HANDAXE)
{
sWeapon = "Handaxe";
nBonus = 2;
}
if (iRHand == BASE_ITEM_KAMA && iLHand == BASE_ITEM_KAMA)
{
sWeapon = "Kama";
nBonus = 2;
}
if (iRHand == BASE_ITEM_KUKRI && iLHand == BASE_ITEM_KUKRI)
{
sWeapon = "Kukri";
nBonus = 2;
}
if (iRHand == BASE_ITEM_LIGHTHAMMER && iLHand == BASE_ITEM_LIGHTHAMMER)
{
sWeapon = "Light Hammer";
nBonus = 2;
}
if (iRHand == BASE_ITEM_MACE && iLHand == BASE_ITEM_MACE)
{
sWeapon = "Mace";
nBonus = 2;
}
if (iRHand == BASE_ITEM_SHORTSWORD && iLHand == BASE_ITEM_SHORTSWORD)
{
sWeapon = "Short Sword";
nBonus = 2;
}
if (iRHand == BASE_ITEM_SICKLE && iLHand == BASE_ITEM_SICKLE)
{
sWeapon = "Sickle";
nBonus = 2;
}
if (iRHand == BASE_ITEM_BASTARDSWORD && iLHand == BASE_ITEM_BASTARDSWORD)
{
sWeapon = "Bastard Sword";
nBonus = 4;
}
if (iRHand == BASE_ITEM_BATTLEAXE && iLHand == BASE_ITEM_BATTLEAXE)
{
sWeapon = "Battleaxe";
nBonus = 4;
}
if (iRHand == BASE_ITEM_DWARVENWARAXE && iLHand == BASE_ITEM_DWARVENWARAXE)
{
sWeapon = "Dwarven Waraxe";
nBonus = 4;
}
if (iRHand == BASE_ITEM_FALCHION && iLHand == BASE_ITEM_FALCHION)
{
sWeapon = "Falchion";
nBonus = 4;
}
if (iRHand == BASE_ITEM_FLAIL && iLHand == BASE_ITEM_FLAIL)
{
sWeapon = "Flail";
nBonus = 4;
}
if (iRHand == BASE_ITEM_GREATAXE && iLHand == BASE_ITEM_GREATAXE)
{
sWeapon = "Greataxe";
nBonus = 4;
}
if (iRHand == BASE_ITEM_GREATCLUB && iLHand == BASE_ITEM_GREATCLUB)
{
sWeapon = "Great Club";
nBonus = 4;
}
if (iRHand == BASE_ITEM_GREATSWORD && iLHand == BASE_ITEM_GREATSWORD)
{
sWeapon = "Greatsword";
nBonus = 4;
}
if (iRHand == BASE_ITEM_HEAVYFLAIL && iLHand == BASE_ITEM_HEAVYFLAIL)
{
sWeapon = "Heavy Flail";
nBonus = 4;
}
if (iRHand == BASE_ITEM_KATANA && iLHand == BASE_ITEM_KATANA)
{
sWeapon = "Katana";
nBonus = 4;
}
if (iRHand == BASE_ITEM_LONGSWORD && iLHand == BASE_ITEM_LONGSWORD)
{
sWeapon = "Longsword";
nBonus = 4;
}
if (iRHand == BASE_ITEM_MORNINGSTAR && iLHand == BASE_ITEM_MORNINGSTAR)
{
sWeapon = "Morningstar";
nBonus = 4;
}
if (iRHand == BASE_ITEM_RAPIER && iLHand == BASE_ITEM_RAPIER)
{
sWeapon = "Rapier";
nBonus = 4;
}
if (iRHand == BASE_ITEM_SCIMITAR && iLHand == BASE_ITEM_SCIMITAR)
{
sWeapon = "Scimitar";
nBonus = 4;
}
if (iRHand == BASE_ITEM_WARHAMMER && iLHand == BASE_ITEM_WARHAMMER)
{
sWeapon = "Warhammer";
nBonus = 4;
}
if (iRHand == BASE_ITEM_WARMACE && iLHand == BASE_ITEM_WARMACE)
{
sWeapon = "Warmace";
nBonus = 4;
}
if (iRHand == BASE_ITEM_TWOBLADEDSWORD && iLHand == BASE_ITEM_TWOBLADEDSWORD)
{
sWeapon = "Two-Bladed Sword";
nBonus = 4;
}
if (nBonus == 0)
{
RemoveEffectsFromSpell(oPC, SPELL_TWIN_WEAPON_FIGHTING);
return;
}
effect eRHand = EffectAttackIncrease(nBonus, ATTACK_BONUS_ONHAND);
effect eLHand = EffectAttackIncrease(nBonus, ATTACK_BONUS_OFFHAND);
effect eLink = EffectLinkEffects(eLHand, eRHand);
RemoveEffect(oPC, eLink);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eLink, oPC);
}
--This is the most recent version of the script. I once tried using my own CancelEffect function that used RemoveEffect and a while loop that searched the pc's effects for the one in question.... despite having the effect in question, the script returned -1 on the first check... I am at a loss as to how I was able to make this irreversible...
Modifié par ghowriter, 30 septembre 2011 - 07:07 .





Retour en haut






