From f5364f11e8424b9cc9560f20cf6dab0fb31a4933 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 6 Oct 2018 16:06:44 -0300 Subject: Yeah, better to leave this crap at main functions file. --- npc/functions/main.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'npc/functions/main.txt') diff --git a/npc/functions/main.txt b/npc/functions/main.txt index bf6389989..9446d218b 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -3,6 +3,7 @@ // Authors: // 4144 // Travolta +// gumi // Jesusalva // Description: // Built-in essential functions. @@ -231,6 +232,24 @@ function script npctalkonce { return true; } +// Randomizer functions +///////////////////////////////////////////// + +// returns one argument randomly +// any( {, ...} ) +function script any { + return getarg(rand(getargcount())); +} + +// returns any member of the array +// any_of( ) +function script any_of { + return getelementofarray(getarg(0), getarrayindex(getarg(0)) + rand(getarraysize(getarg(0)) - getarrayindex(getarg(0)))); +} + +// TMW2 Custom Functions +///////////////////////////////////////////// + function script isin { if (getmapxy(.@mapName$, .@xpos, .@ypos, 0) != 0) return false; @@ -275,6 +294,8 @@ function script validatepin { return true; } +// Linking functions +///////////////////////////////////////////// function script getquestlink { return "[@@q" + getarg(0) + "|@@]"; } -- cgit v1.2.3-60-g2f50