summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
Diffstat (limited to 'npc')
-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