diff options
-rw-r--r-- | npc/functions/main.txt | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt index 9d8c331d6..c0fa64282 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -249,7 +249,7 @@ function script rand2 { .@max=getarg(1)*10+9; } else { .@min=0; - .@max=getarg(0)*10+9; + .@max=getarg(0)*10-1; } return rand(.@min, .@max)/10; } @@ -257,16 +257,13 @@ function script rand2 { // returns one argument randomly // any( <arg>{, ...<arg>} ) function script any { - return getarg(rand2(getargcount()-1)); + return getarg(rand2(getargcount())); } // returns any member of the array // any_of( <array> ) function script any_of { - .@rand=rand2(getarraysize(getarg(0)) - getarrayindex(getarg(0)) + 1); - return getelementofarray(getarg(0), - getarrayindex(getarg(0)) + - max(0, .@rand-1)); + return getelementofarray(getarg(0), getarrayindex(getarg(0)) + rand(getarraysize(getarg(0)) - getarrayindex(getarg(0)))); } // TMW2 Custom Functions |