diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-08-18 00:36:33 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-08-18 00:36:33 -0300 |
commit | ee1eb5bd900192e735162132dd2b0b085427efd1 (patch) | |
tree | b74a1ec38e867506e136ea16b141840f1b2c9bb6 /npc/functions/util.txt | |
parent | 92d052ffbfafcd53c1d232396f0c483fd7ff3e3b (diff) | |
download | serverdata-ee1eb5bd900192e735162132dd2b0b085427efd1.tar.gz serverdata-ee1eb5bd900192e735162132dd2b0b085427efd1.tar.bz2 serverdata-ee1eb5bd900192e735162132dd2b0b085427efd1.tar.xz serverdata-ee1eb5bd900192e735162132dd2b0b085427efd1.zip |
Basic version of Erik the Homunculus Dispatcher
Diffstat (limited to 'npc/functions/util.txt')
-rw-r--r-- | npc/functions/util.txt | 15 |
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() |