These functions can be used to determine whether or not an Actor has their weapon out or whether or not they have a spell readied for casting.
Sample Script: This global script gives notification messages based on the player’s weapon and spell states.
Begin player_notifications
short weapstate
short spelstate
if ( player->GetWeaponDrawn )
if ( weapstate != 1 )
set weapstate to 1
MessageBox "The player's weapon is drawn."
Endif
else
if ( weapstate != 0 )
set weapstate to 0
MessageBox "The player's weapon is sheathed."
Endif
endif
if ( player->GetSpellReadied )
if ( spelstate != 1 )
set spelstate to 1
MessageBox "The player's spell is readied."
Endif
else
if ( spelstate != 0 )
set spelstate to 0
MessageBox "The player's spell is put away."
Endif
endif
end
Note: GetWeaponDrawn will return 0 at some unusual times; when a lock pick or probe is removed through scripting or when it is broken, GetWeaponDrawn will return 0 for a few frames before you switch to Hand-to-Hand. When fighting Hand to Hand, when you equip or remove a piece of armor or clothing, GetWeaponDrawn will return 0 briefly.
Thanks to Björn and DinkumThinkum respectively for pointing this out.