IsSpellTarget

Post » Wed May 09, 2012 3:21 am

This is a CS function. Does anyone know if it can track an ability that is affecting the target?

From the wiki:
Returns 1 if the calling reference is currently being affected by the specified magic item (spell, enchantment or potion).

Technically, an ability is a spell and is under spells. So the above description is a bit broad.
User avatar
Emma Parkinson
 
Posts: 3401
Joined: Wed Jul 26, 2006 5:53 pm

Post » Tue May 08, 2012 7:42 pm

IsSpellTarget checks active effects. Abilities (and diseases) go in the actor's regular spell list, you'll find them with HasSpell.
User avatar
sam
 
Posts: 3386
Joined: Sat Jan 27, 2007 2:44 pm

Post » Tue May 08, 2012 5:48 pm

Thank you. I was hoping not to have to use HasSpell because it is OBSE. I feel like I am twisting the user's arm.
User avatar
Big Homie
 
Posts: 3479
Joined: Sun Sep 16, 2007 3:31 pm

Post » Tue May 08, 2012 1:46 pm

Go ahead and try IsSpellTarget. I think it would work for Abilities, because by definition, an Ability is something that is always active on the Actor who has it.

I've used Player.IsSpellTarget in a script more than once to check if the Player has an Ability. And other Actors as well.
User avatar
James Hate
 
Posts: 3531
Joined: Sun Jun 24, 2007 5:55 am

Post » Tue May 08, 2012 10:35 pm

Alright. Two different messages here from different posters, but you have added testimony. In fact, I will quest script AbGhostNPC onto my player, or some other way, and use IsSpellTarget to see for myself.

Edit:
It's confirmed.

Spoiler
SCN 1AbGhostNPCQuestScriptshort DoOnceBegin GameMode    If ( DoOnce == 0 )        Player.AddSpell AbGhostNPC        Set DoOnce to 1        Return    ElseIf ( DoOnce == 1 )        Set DoOnce to 2        Return    ElseIf ( DoOnce == 2 )        If ( Player.IsSpellTarget AbGhostNPC == 0 )            Message "Doesn't Have Ability"            Set DoOnce to 3        ElseIf ( Player.IsSpellTarget AbGhostNPC == 1 )            PlaySound AMBAyleidWellLP            Message "Has Ability"            Set DoOnce to 3        EndIf    EndIfEnd

First I saw my hands turn ghostly. Then a message from Sneaking Detection Recalibrated. On second later came the message and sound effect. Confirmed, and now I know that other scripts can butt in. Return was supposed to delay for one frame, not 4 seconds later.
User avatar
LittleMiss
 
Posts: 3412
Joined: Wed Nov 29, 2006 6:22 am

Post » Wed May 09, 2012 1:23 am

... Return was supposed to delay for one frame, not 4 seconds later.

By default, a quest script runs once every five seconds. Looking at your script, it looks like it would take 10 seconds to play the ayleid well sound after the quest initiates. But you can change the delay for each script execution by setting fQuestDelayTime.

Declare "Float fQuestDelayTime" before the GameMode block. Then within the GameMode block, set it like so: "Set fQuestDelayTime to 0.01"

This will make the quest script execute every hundredth of a second. And if your frame rate isn't 100 frames/second, then it should execute once per frame.
User avatar
Ludivine Poussineau
 
Posts: 3353
Joined: Fri Mar 30, 2007 2:49 pm


Return to IV - Oblivion