summaryrefslogtreecommitdiff
path: root/npc/functions/util.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions/util.txt')
-rw-r--r--npc/functions/util.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index 7a47a8cae..21abcd1f2 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -736,6 +736,21 @@ function script abizit {
return min(MAGIC_EXP/.@base, 5);
}
+// anyloot( {item 1, amount 1, chance 1}, {item 2, amount 2, chance 2}... )
+// Give chance (standard 1~10000 roll) to obtain item, capped at amount.
+function script anyloot {
+ if (getargcount() < 3 || getargcount() % 3 != 0)
+ return Exception("Faulty anyloot skill command invoked - error");
+
+ // Get Items
+ for (.@i=0;.@i < getargcount(); .@i++) {
+ if (rand2(10000) < getarg(.@i+2))
+ getitem getarg(.@i), rand2(1, getarg(.@i+1));
+ .@i++;
+ }
+ return true;
+}
+
// Returns, based on a 1-5 range, the title for both thief and merc ranks
// thiefrank() / mercrank()