summaryrefslogtreecommitdiff
path: root/example/scripts/items/candy.lua
diff options
context:
space:
mode:
Diffstat (limited to 'example/scripts/items/candy.lua')
-rw-r--r--example/scripts/items/candy.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/example/scripts/items/candy.lua b/example/scripts/items/candy.lua
index a9c59fe4..f60e687d 100644
--- a/example/scripts/items/candy.lua
+++ b/example/scripts/items/candy.lua
@@ -2,12 +2,14 @@
Example item script.
- Makes the player character say "*munch*munch*munch*" when using this item.
+ Makes the player character say "*munch*munch*munch*" when using a candy.
The HP regeneration effect is handled separately based on the heal value in
items.xml.
--]]
-function use_candy(user)
+local candy = mana.get_item_class("candy")
+
+candy:on("use", function(user)
mana.being_say(user, "*munch*munch*munch*")
-end
+end)