diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-10-27 16:53:13 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-10-27 16:53:13 +0000 |
commit | fb2b268a2616617800b92330e09278042e50e7d7 (patch) | |
tree | 326f730314249c159adce0971d26e51a26acb358 /data | |
parent | bbb9a98aeefaa1609dbd2455c102750c5005e05f (diff) | |
download | manaserv-fb2b268a2616617800b92330e09278042e50e7d7.tar.gz manaserv-fb2b268a2616617800b92330e09278042e50e7d7.tar.bz2 manaserv-fb2b268a2616617800b92330e09278042e50e7d7.tar.xz manaserv-fb2b268a2616617800b92330e09278042e50e7d7.zip |
Script binding for spawning effets from scripts.
Diffstat (limited to 'data')
-rw-r--r-- | data/scripts/test.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/data/scripts/test.lua b/data/scripts/test.lua index 344ca105..7f96a61e 100644 --- a/data/scripts/test.lua +++ b/data/scripts/test.lua @@ -24,6 +24,7 @@ atinit(function() create_npc("Guard", 122, 58 * TILESIZE + 16, 15 * TILESIZE + 16, npc6_talk, npc6_update) create_npc("Fire Demon", 202, 58 * TILESIZE + 16, 35 * TILESIZE + 16, firedemon_talk, firedemon_update) create_npc("Post Box", 158, 45 * TILESIZE + 16, 22 * TILESIZE + 16, post_talk) + create_npc("Fireworker", 158, 43 * TILESIZE, 23 * TILESIZE, fireworker_talk, npclib.walkaround_small) tmw.trigger_create(56 * TILESIZE, 32 * TILESIZE, 64, 64, "patrol_waypoint", 1, true) tmw.trigger_create(63 * TILESIZE, 32 * TILESIZE, 64, 64, "patrol_waypoint", 2, true) @@ -198,3 +199,17 @@ function post_talk(npc, ch) end end end + +function fireworker_talk(npc, ch) + do_message(npc, ch, "Do you want some fireworks?") + local answer = do_choice(npc, ch, "Wheee! Fireworks", "Nah, thanks.") + if answer == 1 then + local x = tmw.posX(npc) + local y = tmw.posY(npc) + for c = 0, 25 do + schedule_in (c, function() + tmw.effect_create(c, x + math.random(-200, 200), y + math.random(-200, 200)) + end) + end + end +end |