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.txt19
1 files changed, 17 insertions, 2 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index 21abcd1f2..c32a831e1 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -743,10 +743,9 @@ function script anyloot {
return Exception("Faulty anyloot skill command invoked - error");
// Get Items
- for (.@i=0;.@i < getargcount(); .@i++) {
+ for (.@i=0;.@i < getargcount(); .@i+=3) {
if (rand2(10000) < getarg(.@i+2))
getitem getarg(.@i), rand2(1, getarg(.@i+1));
- .@i++;
}
return true;
}
@@ -826,3 +825,19 @@ function script EnterTown {
return;
}
+// Convert map name to location id
+// MapToLoc( MapName )
+function script MapToLoc {
+ // Fill variable
+ .@v$=getarg(0);
+
+ // Validade variable, see npc/000-1/exit.txt first
+ setarray .@mapx$, "005-1", "003-1", "009-1", "012-1", "017-1", "018-5", "020-1", "024-1";
+ setarray .@locs$, "Candor", "Tulim", "Halin", "Hurns", "LoF", "Lilit", "Nival", "Frostia";
+ .@lx=array_find(.@locs$, .@v$);
+ if (.@lx < 0)
+ return Exception("Invalid map passed to MapToLoc: "+.@v$, RB_DEBUGMES);
+
+ return .@locs$[.@lx];
+}
+