How can a script detect when the actor drinks a potion?

Post » Thu Feb 14, 2013 10:46 am

I want to play a drink animation when the actor or player drinks a potion in combat.

I did this in my Oblivion combat mod and it REALLY changes the way you fight if you also specialize in alchemy.

I have the drink animation script ready to go (tested in combat by pressing a key) but no way to trigger it automatically.
User avatar
Tiffany Holmes
 
Posts: 3351
Joined: Sun Sep 10, 2006 2:28 am

Post » Thu Feb 14, 2013 5:35 pm

Hmm... Without scripting the potions' effects to indicate their consumption, all I can think of would be to count them and periodically check if the count decreases. Something like:
Spoiler
Actor kSomeActorFloat fInterval = 3.0Int iPotionCountFormList Property kYourPotionFormList AutoEvent SomeEvent()	Int iPotionCount = kSomeActor.GetItemCount(kYourPotionFormList)	If iPotionCount		RegisterForSingleUpdate(fInterval)	EndIfEndEventEvent OnUpdate()	If iPotionCount > kSomeActor.GetItemCount(kYourPotionFormList)		Debug.Trace("Actor probably drank a potion")	EndIfEndEvent
User avatar
courtnay
 
Posts: 3412
Joined: Sun Nov 05, 2006 8:49 pm


Return to V - Skyrim