Thread Tools Display Modes
06/15/14, 10:12 AM   #1
ZunaSW
Join Date: Mar 2014
Posts: 37
Know when the player drinks a potion?

Hello, sorry my english.
I have been days searching how to do this, I need something that tells me when the player drinks a potion, and then, something happens. I have trying with lots of things in the wiki, but I can't make it work.
Is there any events or that things for that? Is it even possible?

Thank you ^^
  Reply With Quote
06/15/14, 05:30 PM   #2
SektaNZ
Join Date: Apr 2014
Posts: 10
Not sure but there is [CURRENCY_CHANGE_REASON_CONSUME_POTION]

I know that [ACTION_RESULT_POWER_ENERGIZE] works for getting the amount recovered when drinking a potion, the initial restore and the over time restore.
  Reply With Quote
06/18/14, 04:12 AM   #3
ZunaSW
Join Date: Mar 2014
Posts: 37
Thanks Sekta. Hmm... I don't know how to use them in an event, I'm now investigating a bit more, and I found this:

Code:
EVENT_EFFECT_CHANGED (integer changeType, integer effectSlot, string effectName, string unitTag, number beginTime, number endTime, integer stackCount, string iconName, string buffType, integer effectType, integer abilityType, integer statusEffectType)
The thing is, that event can happen too not only when you drink a potion, also when you activate an ability and things like that :/
Any ideas? I think I have to put something that says that only happen when you drink a potion, but I have no idea of how to do this ._.

EDIT:

I also tried this one:
Code:
EVENT_INVENTORY_ITEM_USED (integer itemSoundCategory)
But I can't make it work:
Code:
local function UsePotion( itemSoundCategory )
	if itemSoundCategory == ITEM_SOUND_CATEGORY_POTION then
		d("Potions!")
	end
end

Last edited by ZunaSW : 06/18/14 at 04:15 AM.
  Reply With Quote
06/18/14, 08:36 AM   #4
Harven
 
Harven's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 135
Hey,
remember that first parameter to all events functions is the event code:

Lua Code:
  1. local function UsePotion( eventCode, itemSoundCategory )
  2.     if itemSoundCategory == ITEM_SOUND_CATEGORY_POTION then
  3.         d("Potions!")
  4.     end
  5. end
  Reply With Quote
06/18/14, 09:28 AM   #5
ZunaSW
Join Date: Mar 2014
Posts: 37
OMG! It worked!
Thank you Harven!

PD: Harven, I must congratulate you about your Harven's Journal Addon, I use it and I see it awesome
  Reply With Quote
06/18/14, 01:07 PM   #6
Harven
 
Harven's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 135
That's great! I'm glad I could help.
I'm happy you like it
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Know when the player drinks a potion?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off