diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-06-04 19:59:40 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-06-04 19:59:40 -0300 |
commit | 4ab83f1dd036cbfc86ea874654a28fb2a0bec960 (patch) | |
tree | bb9ca6890fc2ec5add9af15ec6af5b28347e1698 | |
parent | 4d6801a3b1fa27379efa44de4b19ebf6762d914c (diff) | |
download | serverdata-4ab83f1dd036cbfc86ea874654a28fb2a0bec960.tar.gz serverdata-4ab83f1dd036cbfc86ea874654a28fb2a0bec960.tar.bz2 serverdata-4ab83f1dd036cbfc86ea874654a28fb2a0bec960.tar.xz serverdata-4ab83f1dd036cbfc86ea874654a28fb2a0bec960.zip |
Fix any_of() bugs
-rw-r--r-- | npc/functions/main.txt | 5 |
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 |