From cca4454a7b301cabc4ade06cc3db375df4737847 Mon Sep 17 00:00:00 2001 From: David Athay Date: Thu, 23 Oct 2008 16:18:29 +0000 Subject: Added example of using tmw.being_get_name and tmw.being_get_attribute to test.lua --- data/scripts/test.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'data/scripts/test.lua') diff --git a/data/scripts/test.lua b/data/scripts/test.lua index 4dcb9eb6..7be03653 100644 --- a/data/scripts/test.lua +++ b/data/scripts/test.lua @@ -23,6 +23,8 @@ atinit(function() create_npc("Scorpion Tamer", 126, 45 * TILESIZE + 16, 25 * TILESIZE + 16, npc5_talk, nil) 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) 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) @@ -181,3 +183,9 @@ function firedemon_update(npc) npclib.walkaround_map(npc) end + +function post_talk(npc, ch) + do_message(npc, ch, "Hello " .. tmw.being_get_name(ch)) + local strength = tmw.being_get_attribute(ch, 2) + do_message(npc, ch, "You have " .. tostring(strength) .. " strength") +end -- cgit v1.2.3-70-g09d2