From 14bce66d32c572f69718f3bfe25eb16213705e50 Mon Sep 17 00:00:00 2001 From: Fate Date: Tue, 16 Jun 2009 19:07:28 +0000 Subject: Added SkillUp function and used it whenever we magic-skill-up --- npc/functions/magic.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'npc/functions') diff --git a/npc/functions/magic.txt b/npc/functions/magic.txt index 0094e94a..2bf8ef64 100644 --- a/npc/functions/magic.txt +++ b/npc/functions/magic.txt @@ -136,3 +136,28 @@ L_Q_post_imp: set @c, @choice_idx[@menu]; return @c; } + + +// ------------------------------------------------------------ +// Level up a skill +// @SUP_id skill ID to level up +// @SUP_lvl skill level to attain +// @SUP_name$ name of the skill to level up +// @SUP_xp # of experience points to award if the level up succeeds +// ------------------------------------------------------------ +function script SkillUp { + if (getskilllv(@SUP_id) >= @SUP_lvl) + goto L_shortcut; + + misceffect sfx_skillup, strcharinfo(0); + setskill @SUP_id, @SUP_lvl; + getexp @SUP_xp, 0; + if (@SUP_xp) + mes "[" + @SUP_xp + " experience points]"; + mes "[Level " + @SUP_lvl + " in " + @SUP_name$ + "]"; + return; + +L_shortcut: + mes "[You already have level " + getskilllv(@SUP_id) + " in " + @SUP_name$ + "]"; + return; +} -- cgit v1.2.3-60-g2f50