summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-06-04 19:59:40 -0300
committerJesusaves <cpntb1@ymail.com>2019-06-04 19:59:40 -0300
commit4ab83f1dd036cbfc86ea874654a28fb2a0bec960 (patch)
treebb9ca6890fc2ec5add9af15ec6af5b28347e1698
parent4d6801a3b1fa27379efa44de4b19ebf6762d914c (diff)
downloadserverdata-4ab83f1dd036cbfc86ea874654a28fb2a0bec960.tar.gz
serverdata-4ab83f1dd036cbfc86ea874654a28fb2a0bec960.tar.bz2
serverdata-4ab83f1dd036cbfc86ea874654a28fb2a0bec960.tar.xz
serverdata-4ab83f1dd036cbfc86ea874654a28fb2a0bec960.zip
Fix any_of() bugs
-rw-r--r--npc/functions/main.txt5
1 files changed, 4 insertions, 1 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index c184a9ea5..9d8c331d6 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -263,7 +263,10 @@ function script any {
// returns any member of the array
// any_of( <array> )
function script any_of {
- return getelementofarray(getarg(0), getarrayindex(getarg(0)) + rand2(getarraysize(getarg(0)) - getarrayindex(getarg(0))));
+ .@rand=rand2(getarraysize(getarg(0)) - getarrayindex(getarg(0)) + 1);
+ return getelementofarray(getarg(0),
+ getarrayindex(getarg(0)) +
+ max(0, .@rand-1));
}
// TMW2 Custom Functions