summaryrefslogtreecommitdiffstats
path: root/example
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-31 02:04:29 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-31 02:04:29 +0100
commit6a3e510e4b40fcb1554cdd57e7ddc49edd89fa3f (patch)
treea23bd9d9ecefa539022143588690fb65567c4b74 /example
parentb2209cbe93aa12dcd4e4e3b9a7cd8b13ed5713e9 (diff)
downloadmanaserv-6a3e510e4b40fcb1554cdd57e7ddc49edd89fa3f.tar.gz
manaserv-6a3e510e4b40fcb1554cdd57e7ddc49edd89fa3f.tar.xz
manaserv-6a3e510e4b40fcb1554cdd57e7ddc49edd89fa3f.zip
Added first visible npcs and play with them a bit.
Diffstat (limited to 'example')
-rw-r--r--example/clientdata/graphics/sprites/npcs/static-npcs.pngbin0 -> 29932 bytes
-rw-r--r--example/clientdata/graphics/sprites/npcs/static-npcs.xml10
-rw-r--r--example/clientdata/monsters.xml4
-rw-r--r--example/clientdata/npcs.xml5
-rw-r--r--example/serverdata/scripts/maps/desert.lua42
5 files changed, 55 insertions, 6 deletions
diff --git a/example/clientdata/graphics/sprites/npcs/static-npcs.png b/example/clientdata/graphics/sprites/npcs/static-npcs.png
new file mode 100644
index 0000000..812c88d
--- /dev/null
+++ b/example/clientdata/graphics/sprites/npcs/static-npcs.png
Binary files differ
diff --git a/example/clientdata/graphics/sprites/npcs/static-npcs.xml b/example/clientdata/graphics/sprites/npcs/static-npcs.xml
new file mode 100644
index 0000000..2cb4d08
--- /dev/null
+++ b/example/clientdata/graphics/sprites/npcs/static-npcs.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<sprite variants="100" variant_offset="1">
+ <imageset name="base" src="graphics/sprites/npcs/static-npcs.png" width="50" height="80" />
+
+ <action name="stand" imageset="base">
+ <animation direction="default">
+ <frame index="0" />
+ </animation>
+ </action>
+</sprite> \ No newline at end of file
diff --git a/example/clientdata/monsters.xml b/example/clientdata/monsters.xml
index c820178..65fda21 100644
--- a/example/clientdata/monsters.xml
+++ b/example/clientdata/monsters.xml
@@ -56,6 +56,7 @@ exp<TAG>: Tells how much experience point a monster is giving up
attack-magic="0"
hit="10"
evade="5"
+ magical-evade="5"
physical-defence="5"
magical-defence="0"
mutation="50"
@@ -105,6 +106,7 @@ exp<TAG>: Tells how much experience point a monster is giving up
attack-magic="0"
hit="10"
evade="10"
+ magical-evade="10"
physical-defence="5"
magical-defence="0"
/>
@@ -162,6 +164,7 @@ exp<TAG>: Tells how much experience point a monster is giving up
attack-magic="0"
hit="30"
evade="30"
+ magical-evade="30"
physical-defence="5"
magical-defence="0"
/>
@@ -206,6 +209,7 @@ exp<TAG>: Tells how much experience point a monster is giving up
attack-magic="0"
hit="100"
evade="10"
+ magical-evade="10"
physical-defence="0"
magical-defence="0"
/>
diff --git a/example/clientdata/npcs.xml b/example/clientdata/npcs.xml
index 0128b0e..0af855f 100644
--- a/example/clientdata/npcs.xml
+++ b/example/clientdata/npcs.xml
@@ -7,4 +7,9 @@
sprites are drawn in order of declaration.
-->
<npcs>
+ <npc id="1"><sprite variant="0">npcs/static-npcs.xml</sprite></npc><!-- Barber 1&2 -->
+ <!-- ... -->
+ <npc id="8"><sprite variant="7">npcs/static-npcs.xml</sprite></npc><!-- Banker -->
+ <!-- ... -->
+ <npc id="11"><sprite variant="10">npcs/static-npcs.xml</sprite></npc><!-- Welcoming girl -->
</npcs>
diff --git a/example/serverdata/scripts/maps/desert.lua b/example/serverdata/scripts/maps/desert.lua
index 4838d0c..7ce46f7 100644
--- a/example/serverdata/scripts/maps/desert.lua
+++ b/example/serverdata/scripts/maps/desert.lua
@@ -17,16 +17,46 @@ require "scripts/npcs/banker"
require "scripts/npcs/barber"
atinit(function()
- create_npc("Barber", 100, 14 * TILESIZE + TILESIZE / 2, 9 * TILESIZE + TILESIZE / 2, Barber, nil)
- create_npc("Barber 2", 100, 20 * TILESIZE + TILESIZE / 2, 11 * TILESIZE + TILESIZE / 2, npclib.talk(Barber, {14, 15, 16}, {}), nil)
- create_npc("Banker", 149, 35 * TILESIZE + TILESIZE / 2, 24 * TILESIZE + TILESIZE / 2, Banker, nil)
-
- create_npc("Test", 102, 4 * TILESIZE + TILESIZE / 2, 25 * TILESIZE + TILESIZE / 2, npclib.talk(Test, "String1", "String2", "String3", "Etc"), nil)
+ -- Barber examples
+ create_npc("Barber Twin", 1, 14 * TILESIZE + TILESIZE / 2, 9 * TILESIZE + TILESIZE / 2, Barber, nil)
+ create_npc("Barber Twin", 1, 20 * TILESIZE + TILESIZE / 2, 11 * TILESIZE + TILESIZE / 2, npclib.talk(Barber, {14, 15, 16}, {}), nil)
+ -- A simple banker
+ create_npc("Banker", 8, 35 * TILESIZE + TILESIZE / 2, 24 * TILESIZE + TILESIZE / 2, Banker, 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)
end)
-function Test(npc, ch, list)
+-- Global variable used to know whether Harmony talked to someone.
+harmony_have_talked_to_someone = false
+function Harmony(npc, ch, list)
+ -- Say all the messages in the messages list.
for i = 1, #list do
do_message(npc, ch, list[i])
end
+ --- Give the player 100 units of money the first time.
+ if harmony_have_talked_to_someone == false then
+ if mana.chr_money_change(ch, 100) then
+ do_message(npc, ch, "Here is some money for you to find some toys to play with.\nEh Eh!")
+ do_message(npc, ch, string.format("You now have %d shiny coins!", mana.chr_money(ch)))
+ harmony_have_talked_to_someone = true
+ else
+ do_message(npc, ch, "Ah, it seems something went wrong...")
+ end
+ end
+ do_message(npc, ch, "Have fun!")
+ mana.effect_create(EMOTE_HAPPY, npc)
do_npc_close(npc, ch)
end
+
+-- Global variable used to control Harmony's updates.
+-- One tick equals to 100ms, so 100 below equals to 10000ms or 10 seconds
+harmony_tick_count = 0
+function Harmony_update(npc)
+ if harmony_have_talked_to_someone == false then
+ harmony_tick_count = harmony_tick_count + 1
+ if harmony_tick_count > 100 then
+ harmony_tick_count = 0
+ mana.being_say(npc, "Hey! You're new! Come here...")
+ end
+ end
+end \ No newline at end of file