diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-02-26 12:18:58 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-03-09 01:24:34 +0100 |
commit | 1151e39d73793923ecd7a044e7116e6d2077c756 (patch) | |
tree | 01f249984e2e9537695d736d9dc2e09a68bcb938 /example/serverdata | |
parent | 2cfd2275df4639d7a29330726f5420e2432c63b1 (diff) | |
download | manaserv-1151e39d73793923ecd7a044e7116e6d2077c756.tar.gz manaserv-1151e39d73793923ecd7a044e7116e6d2077c756.tar.bz2 manaserv-1151e39d73793923ecd7a044e7116e6d2077c756.tar.xz manaserv-1151e39d73793923ecd7a044e7116e6d2077c756.zip |
Show a way to make monsters speak at spawn time.
Even when events are inserted before game state update time,
the monsters don't speak since they still don't have an id (-1).
As I thought that reworking the mapcomposite engine for that particular
point was ineffective, here is another working way to make monsters
speak at spawn time by using the schedule_in function with
0.3 second (or 3 ticks).
Resolves: Mana-Mantis #205.
Reviewed-by: Thorbjorn.
Diffstat (limited to 'example/serverdata')
-rw-r--r-- | example/serverdata/scripts/maps/desert.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/example/serverdata/scripts/maps/desert.lua b/example/serverdata/scripts/maps/desert.lua index 70db78cb..a838ee14 100644 --- a/example/serverdata/scripts/maps/desert.lua +++ b/example/serverdata/scripts/maps/desert.lua @@ -35,9 +35,11 @@ atinit(function() smith_buy_table = { {5, 10, 50}, {7, 10, 70} } create_npc("Smith", 5, 15 * TILESIZE + TILESIZE / 2, 16 * TILESIZE + TILESIZE / 2, npclib.talk(Merchant, smith_buy_table), nil) - -- The most simple NPC - Welcoming new ones around. create_npc("Harmony", 11, 4 * TILESIZE + TILESIZE / 2, 25 * TILESIZE + TILESIZE / 2, npclib.talk(Harmony, "Welcome in the template world!\nI hope you'll find here whatever you were searching for.", "Do look around to find some interesting things coming along!"), Harmony_update) + + -- Creates a Monster an let it talk for testing purpose. + create_npc("Tamer", 9, 28 * TILESIZE + TILESIZE / 2, 21 * TILESIZE + TILESIZE / 2, Tamer, nil) end) -- Global variable used to know whether Harmony talked to someone. @@ -74,4 +76,11 @@ function Harmony_update(npc) mana.being_say(npc, "Hey! You're new! Come here...") end end -end
\ No newline at end of file +end + +function Tamer(npc, ch, list) + mana.being_say(npc, "I will now spawn a monster for your training session.") + + local m1 = mana.monster_create(1, mana.posX(ch), mana.posY(ch)) + schedule_in(0.3, function() mana.being_say(m1, "Roaaarrrr!!!") end) +end |