Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
I've tried a lot of variations on this, so the specifics might be further from working than when I started.
I think it doesn't trigger for auto-drinking if that's the case you are testing, only manual usage from inventory. I will run your code tomorrow to see.
I was testing it with drinking pop and orange soda, couldn't get it to trigger. Did it work on your end?
EventsPlus:Add("OnEat", function(character, item, percentage)
carbs = item:getCarbohydrates()
character:Say(carbs)
end, "My callback context")
This for some reason makes the character say the variable carbs 4 times back to back.
So I actually fixed this, and it must have something to do with the ctor because I added "False" for the bool at the end and it works fine now.
Note that Events have stack, meaning it will fire the event as much times as much you have added them. There are documentation on how to remove particular events or whole stack in the mod description.