diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-05-07 23:14:54 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-05-07 23:14:54 +0000 |
commit | 4c54e5c20379bbff60a25924790d19a2eb912267 (patch) | |
tree | b7831416313259343bd5463574fd36b697d82982 /data | |
parent | 7d559cbae9c713e15ae0c943a4d571122bf29bc6 (diff) | |
download | manaserv-4c54e5c20379bbff60a25924790d19a2eb912267.tar.gz manaserv-4c54e5c20379bbff60a25924790d19a2eb912267.tar.bz2 manaserv-4c54e5c20379bbff60a25924790d19a2eb912267.tar.xz manaserv-4c54e5c20379bbff60a25924790d19a2eb912267.zip |
Implemented script bindings for making beings talk and sending private chat messages from scripts to clients. Implemented trigger areas which are only triggered once when a being steps into them instead of every tick.
Diffstat (limited to 'data')
-rw-r--r-- | data/test.lua | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/data/test.lua b/data/test.lua index 0edc15e3..06d6136d 100644 --- a/data/test.lua +++ b/data/test.lua @@ -21,21 +21,22 @@ atinit(function() create_npc(200, 50 * 32 + 16, 19 * 32 + 16, npc1_talk, npclib.walkaround_small) create_npc(201, 51 * 32 + 16, 25 * 32 + 16, npc4_talk, npclib.walkaround_wide) create_npc(126, 45 * 32 + 16, 25 * 32 + 16, npc5_talk, npclib.walkaround_map) - create_npc(122, 58 * 32 + 16, 15 * 32 + 16, npc6_talk, nil) + create_npc(122, 58 * 32 + 16, 15 * 32 + 16, npc6_talk, npc6_update) - create_npc(200, 63 * 32 + 16, 31 * 32 + 16, nil, nil) - tmw.trigger_create(56 * 32, 30 * 32, 64, 64, "patrol_waypoint", 1) - tmw.trigger_create(63 * 32, 30 * 32, 64, 64, "patrol_waypoint", 2) + 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) end) function patrol_waypoint(obj, id) if (id == 1) then - tmw.being_walk(obj, 64 * 32, 31 * 32, 400) + tmw.chatmessage(obj, "you've reached patrol point 1") + tmw.being_say(obj, "I have reached patrol point 1") end if (id == 2) then - tmw.being_walk(obj, 57 * 32, 31 * 32, 400) + tmw.chatmessage(obj, "you've reached patrol point 2") + tmw.being_say(obj, "I have reached patrol point 2") end end @@ -121,3 +122,16 @@ function npc6_talk(npc, ch) guard_position = 1 end end + +function npc6_update(npc) + local r = math.random(0, 100) + if (r == 0) then + tmw.being_say(npc, "*humhumhum*") + end + if (r == 1) then + tmw.being_say(npc, "guarding the city gate is so much fun *sigh*") + end + if (r == 2) then + tmw.being_say(npc, "can't someone order me to walk to the other side of the gate?") + end +end |