Aller au contenu

Photo

Item Property On Hit Cast Spell Unique Power


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
EzRemake

EzRemake
  • Members
  • 118 messages

I'm looking to use On Hit Cast Spell Unique Power because the default on hit cast spell system can be disastrous, but I'm having a hard time getting the appropriate tag based script to reference to PC properly.

 

I've tried using GetItemActivator as well as just referencing the last item activated and it's owner, but nothing seems to work.

 

If I drop a spell script in the tag based script, the spell effects run fine but the damage can't calculate because it can't make reference to anything.

 

Does anyone know how to make reference to the PC in this type of tag based scripting?



#2
meaglyn

meaglyn
  • Members
  • 813 messages

On Hit Cast Spell is not item activation. This runs more like a spell script so OBJECT_SELF is the caster. With Onhit that means the one wielding the weapon or wearing the armor (if the armor is what has the on hit cast property).  The target is retrieved with GetSpellTargetObject(). Take a look at x2_s3_onhitcast.nss.


  • Lightfoot8 aime ceci

#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Save the following template  as a "text File"  in the  "scripttemplates"  folder in your  nwn install.   That way any time you need to reference how to get data for any of the events, all you have to do is click on the templates tab in the scripting window.  

 

It is a nice place to stash   crib sheets. 

 

#include "x2_inc_switches"




void main()
{
    object oPC;
    object oItem;
    int nEvent = GetUserDefinedItemEventNumber();
    switch (nEvent)
    {
        case X2_ITEM_EVENT_ACTIVATE:
            //oPC   = GetItemActivator();
            //oItem = GetItemActivated();
        break;


        case X2_ITEM_EVENT_EQUIP:
            //oPC = GetPCItemLastEquippedBy();
            //oItem = GetPCItemLastEquipped();
        break;


        case X2_ITEM_EVENT_UNEQUIP:
            //oPC    = GetPCItemLastUnequippedBy();
            //oItem  = GetPCItemLastUnequipped();
        break;


        case X2_ITEM_EVENT_ONHITCAST:
            //oItem  =  GetSpellCastItem();                  // The item casting triggering this spellscript
            //object oSpellOrigin = OBJECT_SELF ;
            //object oSpellTarget = GetSpellTargetObject();
            //oPC = OBJECT_SELF;
        break;


        case X2_ITEM_EVENT_ACQUIRE:
            //oPC = GetModuleItemAcquiredBy();
            //oItem  = GetModuleItemAcquired();
        break;


        case X2_ITEM_EVENT_UNACQUIRE:
            //oPC = GetModuleItemLostBy();
            //oItem  = GetModuleItemLost();
        break;


        case X2_ITEM_EVENT_SPELLCAST_AT:
            //oPC = GetLastSpellCaster();
            //oItem  = GetSpellTargetObject();
        break;


        default:
        break;
    }




}


#4
EzRemake

EzRemake
  • Members
  • 118 messages

Thanks guys, I understand what I did wrong to get so confused, had some conflicts which prevented any tag based from activating >.>