Detecting the poisoning "event"

Post » Sat May 03, 2014 1:46 pm

Who knows a proper scripted approach to detect occurrences of the player poisoning a weapon?

I tried:
- using OnItemRemoved event to detect a poison potion leaving the player's inventory. This almost works, but doesn't deal with the player clicking no in the poisoning dialogue. The event is not fired twice, as the wiki suggests...

- using OnTrackedStatsChangedEvent to detect if the stat "Poisons Used" has increased. Unfortunately, this event doesn't seem to fire for poisoning at all.

Any other ideas?

Snotgurg
User avatar
Anthony Diaz
 
Posts: 3474
Joined: Thu Aug 09, 2007 11:24 pm

Post » Sat May 03, 2014 8:52 am

Well, how much info do you need to know? The weapon it is put on too? Or just if the player used it?

You could probably RegisterForMenu("ContainerMenu") to start. Then use an OnObjectEquipped event to detect when the player selects a poison (OnItemRemoved might work too). When that event fires, get the current item count of the poison equipped, and save that in a variable. Then start polling every second or so while the menu remains opened, to see if the item count goes down, and if it does, check what weapon the player currently has equipped. A little messy but I imagine you could get it working reliably with a little tweaking.

User avatar
Gracie Dugdale
 
Posts: 3397
Joined: Wed Jun 14, 2006 11:02 pm

Post » Sat May 03, 2014 9:19 am

How about this?

Event OnInit()RegisterForMenu("ContainerMenu")EndEvent int PoisonsUsedEvent OnMenuOpen(String MenuName)if MenuName == "ContainerMenu"   PoisonsUsed = Game.QuerStat("Poisons Used")endifendEvent Event OnMenuClose(String MenuName)if MenuName == "ContainerMenu"   if PoisonsUsed < Game.QuerStat("Poisons Used")      Debug.Messagebox("Player used " + (Game.QuerStat("Poisons Used") - PoisonsUsed) + " Poisons")   endifendifendEvent
User avatar
Nany Smith
 
Posts: 3419
Joined: Sat Mar 17, 2007 5:36 pm


Return to V - Skyrim