From 23f2c4c4ac4f81f0410f26bfcb7fde8c640be684 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Thu, 28 Jul 2011 20:27:13 +0200 Subject: Added monster_remove lua function. mana.monster_remove(monster) can now be used to remove a monster from a map. Resolves: Mana-Mantis #352. Reviewed-by: Bertram. --- example/serverdata/scripts/maps/desert.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'example/serverdata/scripts') diff --git a/example/serverdata/scripts/maps/desert.lua b/example/serverdata/scripts/maps/desert.lua index 7449192..23b9535 100644 --- a/example/serverdata/scripts/maps/desert.lua +++ b/example/serverdata/scripts/maps/desert.lua @@ -89,6 +89,15 @@ function Tamer(npc, ch, list) mana.get_distance(npc, ch))) mana.being_say(npc, "I will now spawn a monster for your training session.") + -- Remove monsters in the area + for i, b in ipairs(mana.get_beings_in_rectangle( + mana.posX(npc) - 3 * TILESIZE, mana.posY(npc) - 3 * TILESIZE, + 6 * TILESIZE, 6 * TILESIZE)) do + if mana.being_type(b) == TYPE_MONSTER then + mana.monster_remove(b) + end + end + local m1 = mana.monster_create(1, mana.posX(ch), mana.posY(ch)) schedule_in(0.5, function() mana.being_say(m1, "Roaaarrrr!!!") end) end -- cgit From d11e7d49edb8374767d69859fe9ed542722013fe Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Wed, 3 Aug 2011 23:20:29 +0200 Subject: Unified the lua.cpp documentation. I also changed the chatmessage function to chat_message to follow the coding standard. --- example/serverdata/scripts/crafting.lua | 10 +++++----- example/serverdata/scripts/global_events.lua | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'example/serverdata/scripts') diff --git a/example/serverdata/scripts/crafting.lua b/example/serverdata/scripts/crafting.lua index ea30628..eae26a4 100644 --- a/example/serverdata/scripts/crafting.lua +++ b/example/serverdata/scripts/crafting.lua @@ -27,7 +27,7 @@ function on_craft(ch, recipe) -- uncomment one (but not both!) of the following three lines to enable the -- example crafting systems - mana.chatmessage(ch, "There is no crafting in this game world.") + mana.chat_message(ch, "There is no crafting in this game world.") --craft_strict(ch, recipe) --craft_lax(ch, recipe) end @@ -42,10 +42,10 @@ function craft_strict(ch, recipe) 8, -2, --take away the iron 9, -1, --take away the wood 5, 1 ) -- give a sword - mana.chatmessage(ch, "You've crafted a sword") + mana.chat_message(ch, "You've crafted a sword") return end - mana.chatmessage(ch, "This wouldn't create anything useful") + mana.chat_message(ch, "This wouldn't create anything useful") end -- a primitive example crafting system which doesn't care about item order @@ -60,10 +60,10 @@ function craft_lax(ch, recipe) 8, -2, --take away the iron 9, -1, --take away the wood 5, 1 ) -- give a sword - mana.chatmessage(ch, "You've crafted a sword") + mana.chat_message(ch, "You've crafted a sword") return end - mana.chatmessage(ch, "This wouldn't create anything useful") + mana.chat_message(ch, "This wouldn't create anything useful") end -- this turns multiple occurences of the same item into one by adding up diff --git a/example/serverdata/scripts/global_events.lua b/example/serverdata/scripts/global_events.lua index 5655dc8..548351a 100644 --- a/example/serverdata/scripts/global_events.lua +++ b/example/serverdata/scripts/global_events.lua @@ -50,14 +50,14 @@ end -- to the character and/or initialize a tutorial quest. function on_chr_birth(ch) -- this message is shown on first login. - mana.chatmessage(0, ch, "And so your adventure begins...") + mana.chat_message(0, ch, "And so your adventure begins...") end -- This function is called when a character logs into the game. This can, -- for example, be utilized for a message-of-the-day or for various -- handlings of offline processing mechanics. function on_chr_login(ch) - mana.chatmessage(0, ch, "Welcome to Manasource") + mana.chat_message(0, ch, "Welcome to Manasource") end @@ -72,7 +72,7 @@ function on_chr_logout(ch) local msg = mana.being_get_name(ch).." left the game." for b in pairs(around) do if mana.being_type(b) == TYPE_CHARACTER then - mana.chatmessage(0, b, msg) + mana.chat_message(0, b, msg) end end end -- cgit