Author Topic: Thunder Wammer  (Read 414 times)

Legacy_4Pop

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Thunder Wammer
« on: September 03, 2014, 01:08:08 am »


               

I have a warhammer that upon 50 strikes it is supposed to charge up and strike the foe with lightning. At 40 strikes it should start to get the electric visual effect. However, none of this is happening. I've looked over the script multiple times and can't figure it out; help?


 


#include "x2_inc_switches"

 

void main()

{

    int    nEvent = GetUserDefinedItemEventNumber(); // Which event triggered this

    object oPC;                                      // The player character using the item

    object oItem;                                    // The item being used

    object oSpellOrigin;                             // The origin of the spell

    object oSpellTarget;                             // The target of the spell

    int    iSpell;                                   // The Spell ID number

                     effect eEffect;

                      effect eDamage;

                       int nDamage;

                       effect eEffect2;

                       int nCount = GetLocalInt(oItem, "Count");

                       itemproperty ipZap;

 

    // Set the return value for the item event script

    // * X2_EXECUTE_SCRIPT_CONTINUE - continue calling script after executed script is done

    // * X2_EXECUTE_SCRIPT_END - end calling script after executed script is done

    int nResult = X2_EXECUTE_SCRIPT_END;

 

    switch (nEvent)

    {

        case X2_ITEM_EVENT_ONHITCAST:

            // * This code runs when the item has the 'OnHitCastSpell: Unique power' property

            // * and it hits a target (if it's a weapon) or is being hit (if it's a piece of armor)

            // * Note that this event fires for non PC creatures as well.

 

            oItem        =  GetSpellCastItem();     // The item triggering this spellscript

            oPC          = OBJECT_SELF;             // The player triggering it

            oSpellOrigin = OBJECT_SELF ;            // Where the spell came from

            oSpellTarget = GetSpellTargetObject();  // What the spell is aimed at

 

             ipZap = ItemPropertyVisualEffect(ITEM_VISUAL_ELECTRICAL);

                     nDamage = d6(20);

 

                 SetLocalInt(oItem,"Count", nCount + 1);

                 if(nCount == 40)

                 {

                   FloatingTextStringOnCreature("The wammer starts to sizzle and spark..", oPC, FALSE);

                   AddItemProperty(DURATION_TYPE_PERMANENT, ipZap, oItem);

                 }

 

                 if(nCount == 50)

                 {

                      SetLocalInt(oItem,"Count", 0);

 

    effect    eVFX = EffectVisualEffect(VFX_IMP_LIGHTNING_M);

        ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSpellTarget);

 

 

        eDamage = EffectDamage(nDamage, DAMAGE_TYPE_ELECTRICAL);

        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oSpellTarget);

        RemoveItemProperty(oItem, ipZap);

}

 

 

 

 

 

 

           

            break;


               
               

               
            

Legacy_Terrorble

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Thunder Wammer
« Reply #1 on: September 03, 2014, 01:21:09 pm »


               

What item property do you have on the weapon to trigger this script?


 


And, where does this script you have written exist?  Meaning, is it attached to something somewhere, or did you just open the script editor, create it and save it?