Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

How do I tell if sleep is cast from the Harper Scout feat?

I want to script different behavior for the Harper Scout's sleep feat. But I'm drawing a blank about how to tell if it is being cast from the Harper feat or an actual caster is casting it as a spell. Since the feat and spell both fire nw_s0_sleep for the spell.

I tried:
if( GetLastSpellCastClass() == CLASS_TYPE_HARPER )

but it doesn't work.

Comments

  • ShadooowShadooow Member Posts: 391
    that should work afaik...

  • TerrorbleTerrorble Member Posts: 103
    GetLastSpellCastClass() returns 255 in that script whether I cast it from a wand or from the feat.
    Wizard and sorcerer return the appropriate class values.

    This seems to work:

    if( GetLastSpellCastClass() == 255 && GetSpellCastItem() == OBJECT_INVALID )

  • PstemariePstemarie Member Posts: 191
    edited February 2018
    Use the spell ID for it (line 480 in spells.2da) in the following if statement instead of what you are trying to use:

    if ( GetSpellId() == 480 )
    {
    // do stuff
    }

    This will always return the Harper Scout Sleep as spells.2da line 480 is called from the SPELLID column for line 441 of feat.2da (which is HARPER_SLEEP).

    That block of code should be added directly to nw_s0_sleep.nss with your custom modifications included inside. You could also use spellhooking - my recommendation - if you don't want to alter the default script. Just place the if statement along with your custom code inside a custom spellhook script.

    The 1.69 Lexicon has more info on spellhooking.

    squattingmonk
Sign In or Register to comment.