Difference between revisions of "IsSpellTarget"

Jump to navigation Jump to search
368 bytes added ,  20:07, 14 January 2009
redacted: my test was faulty -- IsSpellTarget [ingestible] works great!; attempted to compensate for mistake and commensurate loss of e-peen =P
imported>JT
(→‎Ingestibles: clarification of purpose)
imported>JT
(redacted: my test was faulty -- IsSpellTarget [ingestible] works great!; attempted to compensate for mistake and commensurate loss of e-peen =P)
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)).
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 ==
== Syntax ==
Line 20: Line 20:
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.).  Thus, while you may detect whether the player is addicted to something, you cannot detect whether the player has recently sated their addiction using this function(It may still be possible to use [[HasMagicEffect]] on a custom base effect specified in the ingestible.)
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 notThis isn't compatible across mods, unfortunately, 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 ==  
Anonymous user

Navigation menu