From 1c7d81931e2e7b160b1ff14129efd553d7d3c710 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 15 Jul 2018 22:41:58 -0300 Subject: More utils for skills. This is to make easier scripting --- npc/functions/util.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'npc') diff --git a/npc/functions/util.txt b/npc/functions/util.txt index f36ff8a4d..37764ed1b 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -274,6 +274,23 @@ function script max_subclass { // Gets subclass current degree // degree_subclass() function script degree_subclass { - return (MAGIC_LVL/2)+(MAGIC_LVL%1); + return (MAGIC_LVL/2)+(MAGIC_LVL%2); } +// Returns true if a skill can be leveled up, based on degree_subclass(). +// sk_canlvup( sk ) +function script sk_canlvup { + if (getskilllv(getarg(0)) <= degree_subclass()) + return 1; + return 0; +} + +// Level up a skill in 1 level +// sk_lvup( sk ) +function script sk_lvup { + .@lvl=getskilllv(getarg(0)); + addtoskill(getarg(0),.@lvl+1,0); + return; +} + + -- cgit v1.2.3-60-g2f50