From 4ab83f1dd036cbfc86ea874654a28fb2a0bec960 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 4 Jun 2019 19:59:40 -0300 Subject: Fix any_of() bugs --- npc/functions/main.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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( ) 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 -- cgit v1.2.3-70-g09d2