diff options
| author | Philipp Sehmisch <tmw@crushnet.org> | 2008-11-01 01:41:12 +0000 |
|---|---|---|
| committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-11-01 01:41:12 +0000 |
| commit | ad5efe104cd7639009622393f16bfd93075fcb34 (patch) | |
| tree | f9618bffd5e38c9f50722d36d4d77e8bfea06168 /data/scripts | |
| parent | 3ec0d0f152be4381dc843bc1ca99f8731c8fb366 (diff) | |
Added script bindings for manipulating the characters experience.
Diffstat (limited to 'data/scripts')
| -rw-r--r-- | data/scripts/libs/libtmw.lua | 11 | ||||
| -rw-r--r-- | data/scripts/test.lua | 19 |
2 files changed, 30 insertions, 0 deletions
diff --git a/data/scripts/libs/libtmw.lua b/data/scripts/libs/libtmw.lua index 251e20a..d1e397e 100644 --- a/data/scripts/libs/libtmw.lua +++ b/data/scripts/libs/libtmw.lua @@ -52,6 +52,17 @@ ATTR_DEXTERITY = 18 ATTR_VITALITY = 19 ATTR_INTELLIGENCE = 20 ATTR_WILLPOWER = 21 +SKILL_WEAPON_NONE = 22 +SKILL_WEAPON_KNIFE = 23 +SKILL_WEAPON_SWORD = 24 +SKILL_WEAPON_POLEARM = 25 +SKILL_WEAPON_STAFF = 26 +SKILL_WEAPON_WHIP = 27 +SKILL_WEAPON_BOW = 28 +SKILL_WEAPON_SHOOTING = 29 +SKILL_WEAPON_MACE = 30 +SKILL_WEAPON_AXE = 31 +SKILL_WEAPON_THROWN = 32 TILESIZE = 32 HOURS = 3600 diff --git a/data/scripts/test.lua b/data/scripts/test.lua index 7f96a61..9889295 100644 --- a/data/scripts/test.lua +++ b/data/scripts/test.lua @@ -25,6 +25,7 @@ atinit(function() create_npc("Fire Demon", 202, 58 * TILESIZE + 16, 35 * TILESIZE + 16, firedemon_talk, firedemon_update) create_npc("Post Box", 158, 45 * TILESIZE + 16, 22 * TILESIZE + 16, post_talk) create_npc("Fireworker", 158, 43 * TILESIZE, 23 * TILESIZE, fireworker_talk, npclib.walkaround_small) + create_npc("Axe Trainer", 126, 65 * TILESIZE, 18 * TILESIZE, axetrainer_talk, nil) tmw.trigger_create(56 * TILESIZE, 32 * TILESIZE, 64, 64, "patrol_waypoint", 1, true) tmw.trigger_create(63 * TILESIZE, 32 * TILESIZE, 64, 64, "patrol_waypoint", 2, true) @@ -213,3 +214,21 @@ function fireworker_talk(npc, ch) end end end + +function axetrainer_talk(npc, ch) + do_message(npc, ch, "I am the axe trainer. Do you want to get better at using axes?") + local answer = do_choice(npc, ch, "Please train me, master.", "I am good enough with axes.") + if answer == 1 then + local newexp = tmw.chr_get_exp(ch, SKILL_WEAPON_AXE) + 100 + local nextlevel = tmw.exp_for_level(tmw.being_get_attribute(ch, SKILL_WEAPON_AXE) + 1) + tmw.chr_give_exp(ch, SKILL_WEAPON_AXE, 100) + local message = "I gave you 100 axe exp." + if newexp > nextlevel then + message = message.." This should be enough to reach the next level." + else + message = message.." You will still need "..tostring(nextlevel - newexp).." exp to reach the next level." + end + message = message.." I should really stop doing this when the server goes live." + do_message(npc, ch, message); + end +end |
