(Greater) Magic Fang

Forum for scripters of NWN material and third party applications.
Post Reply
_LuCkY_
Noobie
Posts: 3
Joined: Mon Jun 21, 2004 9:24 am

(Greater) Magic Fang

Post by _LuCkY_ »

Hi all,

I have created a fix to the (Greater) Magic Fang script. It now works according to PnP (3.5) rules, this means:
- ALL creatures can be targetted (also the casters themself, the summons, polymorphed druids, etc)
- Magic Fang works 1 turn/level and Greater Magic Fang 1 hour/level
- The enhancement bonus for Greater Magic Fang is 1 per 4 levels, instead of 1 per 3 levels
- I have removed the damage reduction as it is not in the PnP spell description
- The enhancement is on the creature weapons and not a general enhancement as it was (so a polymorphed PC will have an enhancement bonus fighting unarmed if he has a creature weapon, but wont if he wields a weapon in that form)

There is one difference from PnP. In PnP you can choose to have either 1 creature weapon enhanced with a maximum of 5, or you can have all creature weapons enhanced with 1. In this implementation you can't choose and all creature weapons will always be enhanced with a maximum of 5.

The problem:
It requires a spells.2da fix as it currently doesn't allow targetting anything. So perhaps this could be included in the next CoPaP hak.

Code: Select all

#include "x2_inc_switches"
#include "x2_inc_itemprop"

void DoFixedMagicFang(int bGreater);

void main()
{
    int nSpell=GetSpellId();

    switch (nSpell)
    {
        case SPELL_MAGIC_FANG:
        case SPELL_GREATER_MAGIC_FANG:
            DoFixedMagicFang(nSpell == SPELL_GREATER_MAGIC_FANG);
            SetModuleOverrideSpellScriptFinished();
            break;
    }
}

void DoFixedMagicFang(int bGreater)
{
    int nCasterLevel = GetCasterLevel(OBJECT_SELF);
    int nEnhancement = 1;
    float fDuration;

    object oTarget = GetSpellTargetObject();
    if (!GetIsObjectValid(oTarget))
        return;

    // Greater magic fang gives an enhancement bonus of 1 per 4 levels
    if (bGreater)
    {
        nEnhancement = nCasterLevel / 4;
        if (nEnhancement > 5)
            nEnhancement = 5;
    }

    itemproperty ipEnhancement = ItemPropertyEnhancementBonus(nEnhancement);

    // Duration is 1 turn/level for magic fang and 1 hour/level for greater
    if (bGreater)
        fDuration = TurnsToSeconds(nCasterLevel);
    else
        fDuration = HoursToSeconds(nCasterLevel);
    if (GetMetaMagicFeat() == METAMAGIC_EXTEND)
         fDuration *= 2;

    // Add the enhancement bonus to the creature weapons
    object oWeapon = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oTarget);
    if (GetIsObjectValid(oWeapon))
        IPSafeAddItemProperty(oWeapon, ipEnhancement, fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, TRUE);

    oWeapon = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oTarget);
    if (GetIsObjectValid(oWeapon))
        IPSafeAddItemProperty(oWeapon, ipEnhancement, fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, TRUE);

    oWeapon = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oTarget);
    if (GetIsObjectValid(oWeapon))
        IPSafeAddItemProperty(oWeapon, ipEnhancement, fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, TRUE);

    //Fire spell cast at event for target
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

    // Visual effects
    effect eVis = EffectVisualEffect(VFX_IMP_HOLY_AID);
    effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);

    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, oTarget, fDuration);
}
kombinat
Planar Sage
Posts: 50
Joined: Tue Mar 02, 2004 9:50 am

Post by kombinat »

Any difference between the 3.0 rules of NWN and the 3.5 rules?
Khaelindra
Groundling
Posts: 94
Joined: Wed Jan 21, 2004 5:48 am
Location: Deventer, the Netherlands

Post by Khaelindra »

kombinat wrote:Any difference between the 3.0 rules of NWN and the 3.5 rules?
Many, but most importantly:

3.0 NWN:

* gave +1/3 casterlevels (like NWN-GMW)
* worked only on the animal companion of the caster
* gave a bit of damage reduction

3.5 PnP:

* gives +1/4 casterlevels (like PnP3.5-GMW/GMF)
* works on all natural weapons

But...i think Lucky already says as much in his post. Is it something else you wanted to know?

M.
Titanium Dragon
Clueless Prime
Posts: 18
Joined: Tue Nov 25, 2003 2:39 am

Post by Titanium Dragon »

I know Avlis is on 3e PnP rules. Any thoughts on nerfing this spell the same way GMW is going to be? oO
Khaelindra
Groundling
Posts: 94
Joined: Wed Jan 21, 2004 5:48 am
Location: Deventer, the Netherlands

Post by Khaelindra »

I think the change as proposed above is good.

M.
Khaelindra
Groundling
Posts: 94
Joined: Wed Jan 21, 2004 5:48 am
Location: Deventer, the Netherlands

Post by Khaelindra »

Are we going to see this implemented in the next CoPaP-hak?
Post Reply