Weapon enhancements update

Forum for scripters of NWN material and third party applications.
Post Reply
Drakuul
Groundling
Posts: 120
Joined: Tue Feb 03, 2004 8:18 am

Weapon enhancements update

Post by Drakuul »

This will allow flame weapon to be used on any item with an OnHit property (Flaming umbrellas anyone?)

The single line code change should work on all weapon enhancements

It's a one line change to Code:

object oMyWeapon = GetSpellTargetObject();


Here's the full code for Flame weapon

Code: Select all

//:://///////////////////////////////////////////// 
//:: Flame Weapon 
//:: x2_s0_flameweap.nss 
//:: Last modded by Brent Hartmann (Hala/NT/COPAP) 24/6/04 
//::////////////////////////////////////////////// 

//    Applies 1d4+ 1/level (to a maximum of +10) fire damage to melee weapons, 
//    arrows, or gloves/bracers. 
//    1 hour per level 

#include "x2_inc_spellhook" 

void main() 
{ 

   // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run 
    // this spell. 
    if (!X2PreSpellCastCode()) 
    { 
        return; 
    } 

    //Declare major variables 
    effect eVis = EffectVisualEffect(VFX_IMP_PULSE_FIRE); 
    effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE); 
    effect eLink = EffectLinkEffects(eVis, eDur); 
    object oTarget = GetSpellTargetObject(); 

    int nDuration = 2 * GetCasterLevel(OBJECT_SELF); 
    int nMetaMagic = GetMetaMagicFeat(); 
    int nCasterLvl = GetCasterLevel(OBJECT_SELF); 

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


    // Handle spell cast on item.... 
    if (GetObjectType(oTarget) == OBJECT_TYPE_ITEM && ! CIGetIsCraftFeatBaseItem(oTarget)) 
    { 
        // Do not allow casting on not equippable items 
        if (!IPGetIsItemEquipable(oTarget)) 
        { 
         // Item must be equipable... 
             FloatingTextStrRefOnCreature(83326,OBJECT_SELF); 
            return; 
        } 
        //Adds the base 1d4 damage 
        itemproperty ip = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_1d4); 

        //Adds the glow 
        itemproperty ip1 = ItemPropertyVisualEffect(ITEM_VISUAL_FIRE); 

        //Adds the extra damage 
        itemproperty ip2 = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_1); 
        // 
    //sets the damage for the different caster levels 
    if (nCasterLvl == 3) 
    { 
        ip2 = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_3); 
    } 

    if (nCasterLvl == 4) 
    { 
        ip2 = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_4); 
    } 

    if (nCasterLvl == 5) 
    { 
        ip2 = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_5); 
    } 

    if (nCasterLvl == 6) 
    { 
        ip2 = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_6); 
    } 

    if (nCasterLvl == 7) 
    { 
        ip2 = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_7); 
    } 

    if (nCasterLvl == 8) 
    { 
        ip2 = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_8); 
    } 

    if (nCasterLvl == 9) 
    { 
        ip2 = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_9); 
    } 

    if (nCasterLvl == 10) 
    { 
        ip2 = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_10); 
    } 

     if (nCasterLvl > 10) 
    { 
        ip2 = ItemPropertyDamageBonus (IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_10); 
    } 


        if (GetItemHasItemProperty(oTarget, ITEM_PROPERTY_DAMAGE_BONUS)) 
        { 
            IPRemoveMatchingItemProperties(oTarget,ITEM_PROPERTY_DAMAGE_BONUS,DURATION_TYPE_TEMPORARY); 
        } 

        nDuration = GetCasterLevel(OBJECT_SELF); 
        nMetaMagic = GetMetaMagicFeat(); 
        //Enter Metamagic conditions 
        if (nMetaMagic == METAMAGIC_EXTEND) 
        { 
            nDuration = nDuration *2; //Duration is +100% 
        } 

        AddItemProperty(DURATION_TYPE_TEMPORARY,ip,oTarget,HoursToSeconds(nDuration)); 
        AddItemProperty(DURATION_TYPE_TEMPORARY,ip1,oTarget,HoursToSeconds(nDuration)); 
        AddItemProperty(DURATION_TYPE_TEMPORARY,ip2,oTarget,HoursToSeconds(nDuration)); 

    } 
    else 
    { 
       ///Put what you want to happen when an object isn't targeted directly down here. 
} 
*Your superior intelligence can not defeat my puny weapons*
Drakuul
Groundling
Posts: 120
Joined: Tue Feb 03, 2004 8:18 am

Post by Drakuul »

If needed, as the spells are modded for local testing, we can put them up for download
*Your superior intelligence can not defeat my puny weapons*
Mistcaller
Groundling
Posts: 137
Joined: Tue Nov 25, 2003 7:29 am
Location: Avlis Team - Tairis'nadur Team

Post by Mistcaller »

I would recommend against changing standard bioware scripts, unless absolutely necessary.
Drakuul
Groundling
Posts: 120
Joined: Tue Feb 03, 2004 8:18 am

Post by Drakuul »

If the thread on the duration of the weapon enhancements continues from where it left off, those scripts may have to be changed to get it to Turn/level anyhow.
*Your superior intelligence can not defeat my puny weapons*
Mistcaller
Groundling
Posts: 137
Joined: Tue Nov 25, 2003 7:29 am
Location: Avlis Team - Tairis'nadur Team

Post by Mistcaller »

What I'm saying is that x2_inc_spellhook script allows you to have a User defined spell hook script in order to override existing spells, instead of modifying the spells directly. That will help a lot in case bioware decides to change their spells in the near future.

You can find more about spellhook scripts in http://www.nwnlexicon.com/
Coloures
Planewalker
Posts: 25
Joined: Fri Mar 26, 2004 12:24 pm
Location: Hala

Post by Coloures »

Integrating these scripts into spellhook codes will require hours more of time than simply re-importing them into the module after an update. Since this change will be more CoPaP wide I can't possibly script it so it works with everyones spellhook scripts. If you want the scripts they are erf'ed and avalible for download here. Take them or leave them, I don't have the hours upon hours of time to remake 9 scripts to work in everyone's spellhook codes.

There's also a good chance avlis will be fixing these scripts in 1.63 anyway, so when they get overwritten it probably won't matter much. Put them in your worlds and atleast get use out of them. These will fix the problems with enchanting monk hands(gloves/gauntlets) and CEP weapons.
Please feel free to check the durations on each one to suit your world.

Please note that as of now EVERY enchantment spell is set at 1 hour/level in the script, and that some shouldn't be by bioware default (like holy sword).

http://eventides.net/aiqwpencfix.erf
Drakuul
Groundling
Posts: 120
Joined: Tue Feb 03, 2004 8:18 am

Post by Drakuul »

I'll test them out on Hala for the moment once we get the durations reset and see how they work.
*Your superior intelligence can not defeat my puny weapons*
Drakuul
Groundling
Posts: 120
Joined: Tue Feb 03, 2004 8:18 am

Post by Drakuul »

We're also testing a version of the Bigbys spells which are more PnP compliant -

Grapple check first (ie d20 + bab vs AC of target) if successful then;

Run normal bigbys str check

If Grapple fails, then nothing happens.
*Your superior intelligence can not defeat my puny weapons*
Post Reply