summaryrefslogtreecommitdiffstats
path: root/example/scripts/monster/testmonster.lua
diff options
context:
space:
mode:
Diffstat (limited to 'example/scripts/monster/testmonster.lua')
-rw-r--r--example/scripts/monster/testmonster.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/example/scripts/monster/testmonster.lua b/example/scripts/monster/testmonster.lua
index 2701d24..63b2917 100644
--- a/example/scripts/monster/testmonster.lua
+++ b/example/scripts/monster/testmonster.lua
@@ -7,14 +7,14 @@
--]]
-function update_monster(mob)
+local function update(mob)
local r = math.random(0, 200);
if r == 0 then
mana.being_say(mob, "Roar! I am a boss")
end
end
-function on_maggot_strike(mob, victim, hit)
+local function strike(mob, victim, hit)
if hit > 0 then
mana.being_say(mob, "Take this! "..hit.." damage!")
mana.being_say(victim, "Oh Noez!")
@@ -23,3 +23,7 @@ function on_maggot_strike(mob, victim, hit)
mana.being_say(victim, "Whew...")
end
end
+
+local maggot = mana.get_monster_class("maggot")
+maggot:on_update(update)
+maggot:on("strike", strike)