diff options
-rw-r--r-- | example/clientdata/graphics/sprites/npcs/static-npcs.png | bin | 0 -> 29932 bytes | |||
-rw-r--r-- | example/clientdata/graphics/sprites/npcs/static-npcs.xml | 10 | ||||
-rw-r--r-- | example/clientdata/monsters.xml | 4 | ||||
-rw-r--r-- | example/clientdata/npcs.xml | 5 | ||||
-rw-r--r-- | example/serverdata/scripts/maps/desert.lua | 42 |
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 Binary files differnew file mode 100644 index 00000000..812c88d5 --- /dev/null +++ b/example/clientdata/graphics/sprites/npcs/static-npcs.png 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 00000000..2cb4d08c --- /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 c820178e..65fda21d 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 0128b0ec..0af855f6 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 4838d0cd..7ce46f72 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 |