diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-05-22 19:25:20 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-05-22 19:25:20 +0000 |
commit | 41472ab7f6cdbfc55c44c6487956a36f7fb16508 (patch) | |
tree | 5594d2ac8647498bfd2ffcb5c1df05a35f826633 /data | |
parent | d1939f5475ffc6b8dd13a3da85dd6e85bc387e43 (diff) | |
download | manaserv-41472ab7f6cdbfc55c44c6487956a36f7fb16508.tar.gz manaserv-41472ab7f6cdbfc55c44c6487956a36f7fb16508.tar.bz2 manaserv-41472ab7f6cdbfc55c44c6487956a36f7fb16508.tar.xz manaserv-41472ab7f6cdbfc55c44c6487956a36f7fb16508.zip |
Diffstat (limited to 'data')
-rw-r--r-- | data/scripts/libtmw.lua | 16 | ||||
-rw-r--r-- | data/test.lua | 23 |
2 files changed, 39 insertions, 0 deletions
diff --git a/data/scripts/libtmw.lua b/data/scripts/libtmw.lua index 681b4340..7125162c 100644 --- a/data/scripts/libtmw.lua +++ b/data/scripts/libtmw.lua @@ -14,6 +14,22 @@ -- Software Foundation; either version 2 of the License, or any later version. -- ---------------------------------------------------------------------------------- +-- constant identifiers (is there some LUA way to make them real constants?) + +DAMAGE_PHYSICAL = 0 +DAMAGE_MAGICAL = 1 +DAMAGE_OTHER = 2 + +ELEMENT_NEUTRAL = 0 +ELEMENT_FIRE = 1 +ELEMENT_WATER = 2 +ELEMENT_EARTH = 3 +ELEMENT_AIR = 4 +ELEMENT_LIGHTNING = 5 +ELEMENT_METAL = 6 +ELEMENT_WOOD = 7 +ELEMENT_ICE = 8 + -- Table that associates to each NPC pointer the handler function that is -- called when a player starts talking to an NPC. diff --git a/data/test.lua b/data/test.lua index 944413a7..e33f2de1 100644 --- a/data/test.lua +++ b/data/test.lua @@ -22,6 +22,7 @@ atinit(function() create_npc("Teleporter", 201, 51 * 32 + 16, 25 * 32 + 16, npc4_talk, npclib.walkaround_wide) create_npc("Spider Tamer", 126, 45 * 32 + 16, 25 * 32 + 16, npc5_talk, npclib.walkaround_map) create_npc("Guard", 122, 58 * 32 + 16, 15 * 32 + 16, npc6_talk, npc6_update) + create_npc("Fire Demon", 202, 58 * 32 + 16, 35 * 32 + 16, firedemon_talk, firedemon_update) tmw.trigger_create(56 * 32, 32 * 32, 64, 64, "patrol_waypoint", 1, true) tmw.trigger_create(63 * 32, 32 * 32, 64, 64, "patrol_waypoint", 2, true) @@ -135,3 +136,25 @@ function npc6_update(npc) tmw.being_say(npc, "can't someone order me to walk to the other side of the gate?") end end + + +function firedemon_talk(npc, ch) + do_message(npc, ch, "Burn, puny mortals! BURN! BUUUURN!!!") +end + +local firedemon_timer = 0; + +function firedemon_update(npc) + firedemon_timer = firedemon_timer + 1 + if (firedemon_timer == 5) then + firedemon_timer = 0 + local victims = tmw.get_beings_in_circle(tmw.posX(npc), tmw.posY(npc), 64) + local i = 1; + while (victims[i]) do + tmw.being_damage(victims[i], 20, 10, 32000, DAMAGE_MAGICAL, ELEMENT_FIRE) + i = i + 1 + end + end + + npclib.walkaround_map(npc) +end |