Skip to content

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: 402
    that should work afaik...
  • TerrorbleTerrorble Member Posts: 169
    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 )
  • [Deleted User][Deleted User] Posts: 0
    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.
Sign In or Register to comment.