summaryrefslogtreecommitdiff
path: root/example/serverdata
diff options
context:
space:
mode:
Diffstat (limited to 'example/serverdata')
-rw-r--r--example/serverdata/scripts/crafting.lua10
-rw-r--r--example/serverdata/scripts/global_events.lua6
-rw-r--r--example/serverdata/scripts/maps/desert.lua9
3 files changed, 17 insertions, 8 deletions
diff --git a/example/serverdata/scripts/crafting.lua b/example/serverdata/scripts/crafting.lua
index ea306289..eae26a41 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 5655dc8c..548351a8 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
diff --git a/example/serverdata/scripts/maps/desert.lua b/example/serverdata/scripts/maps/desert.lua
index 7449192d..23b95350 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