Difference between revisions of "IsSpellTarget"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>JT
(tested -- is not working for Ingestibles (contrary to article before my edits))
imported>Ez0n3
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Returns 1 if the calling reference is currently being affected by the specified magic item (an [[Actor Effect]] (spell) or an [[Object Effect]] (enchantment)).
{{Function
 
|CSWikiPage = IsSpellTarget
== Syntax ==
|origin = GECK1
  ''[ActorRef.]''IsSpellTarget MagicID
|summary = Returns 1 if the calling reference is currently being affected by the specified magic item (an [[Actor Effect]] (spell), an [[Object Effect]] (enchantment), or an [[Ingestible]] (drug, potion, chem)).
 
|name = IsSpellTarget
== Example ==
|returnVal = 0, 1
  BuddyRef.IsSpellTarget TrainingMedicineHigh
|returnType = int
 
  |referenceType = [ActorRefID]
|arguments =
  {{FunctionArgument
  |Name = MagicID
  }}
  |example = BuddyRef.IsSpellTarget TrainingMedicineHigh
This will return 1 if Buddy has the specified Actor Ability.
This will return 1 if Buddy has the specified Actor Ability.
}}


== Notes ==
==Notes==


=== Detecting addictions ===
=== Detecting addictions ===
Line 20: Line 27:
This will return 1 even if the player has recently consumed alcohol and is not presently undergoing withdrawal.  It will return 0 for a player who is not addicted to alcohol.
This will return 1 even if the player has recently consumed alcohol and is not presently undergoing withdrawal.  It will return 0 for a player who is not addicted to alcohol.


=== Ingestibles ===
=== Detecting satiation of addictions ===


Unfortunately, this function does not detect whether you are under the influence of a particular [[Ingestible]] (potion, chem, food item, etc.).
You can also detect whether the player is under the influence of the chem itself to determine whether the player has sated their addiction or not.  This isn't compatible for chems added by other mods, because you need to check all of the chemical types directly, but is still quite handy.
 
'''Example:'''
if Player.IsSpellTarget WithdrawalAlcohol > 0
    if Player.IsSpellTarget Beer > 0 || Player.IsSpellTarget Scotch > 0 || Player.IsSpellTarget Wine > 0 || Player.IsSpellTarget Whiskey > 0 || Player.IsSpellTarget Vodka > 0
        ;Display a message of satisfaction
        ...
    else
        ;Display a message of anguish
        ...
    endif
else
    ;Display a message of purity and serenity
    ...
endif


== See Also ==  
==See Also==  
[[HasMagicEffect]]
*[[HasMagicEffect]]


[[Category: Functions]]
[[Category:Functions]]
[[Category:Functions (GECK 1.1)]]
[[Category:Game Effect Functions]]
[[Category:Game Effect Functions]]
[[Category: Condition Functions]]
[[Category:Game Effect Functions (GECK 1.1)]]
[[Category:Condition Functions]]
[[Category:Condition Functions (GECK 1.1)]]

Latest revision as of 06:17, 12 January 2011

< [[::Category:Functions|Category:Functions]]

Link to TES4 Construction Set Wiki: IsSpellTarget.

A function included in the GECK version 1.1.0.36.

Description

Returns 1 if the calling reference is currently being affected by the specified magic item (an Actor Effect (spell), an Object Effect (enchantment), or an Ingestible (drug, potion, chem)).

Syntax

[help]
(0, 1:int) [ActorRefID].IsSpellTarget MagicID

Example

BuddyRef.IsSpellTarget TrainingMedicineHigh

This will return 1 if Buddy has the specified Actor Ability.

Notes

Detecting addictions

If an actor is addicted to a chem, this function will return 1 when the addiction Actor Effect is passed to this function, even when the actor is not presently undergoing withdrawal symptoms. You can use this to detect whether the player is addicted to a substance.

Example:

Player.IsSpellTarget WithdrawalAlcohol

This will return 1 even if the player has recently consumed alcohol and is not presently undergoing withdrawal. It will return 0 for a player who is not addicted to alcohol.

Detecting satiation of addictions

You can also detect whether the player is under the influence of the chem itself to determine whether the player has sated their addiction or not. This isn't compatible for chems added by other mods, because you need to check all of the chemical types directly, but is still quite handy.

Example:

if Player.IsSpellTarget WithdrawalAlcohol > 0
    if Player.IsSpellTarget Beer > 0 || Player.IsSpellTarget Scotch > 0 || Player.IsSpellTarget Wine > 0 || Player.IsSpellTarget Whiskey > 0 || Player.IsSpellTarget Vodka > 0
        ;Display a message of satisfaction
        ...
    else
        ;Display a message of anguish
        ...
    endif
else
    ;Display a message of purity and serenity
    ...
endif

See Also