summaryrefslogtreecommitdiff
path: root/npc/functions/questgen.txt
diff options
context:
space:
mode:
authorSaulc <lucashelaine14@gmail.com>2018-01-13 20:50:42 +0100
committerSaulc <lucashelaine14@gmail.com>2018-01-13 20:50:42 +0100
commit20df2abc1aca00d6aa5dc78347133890f36b32f3 (patch)
tree4ad4a8bb8b0605473a702e314799a4626347721a /npc/functions/questgen.txt
downloadserverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.gz
serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.bz2
serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.xz
serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.zip
Initial commit
Diffstat (limited to 'npc/functions/questgen.txt')
-rw-r--r--npc/functions/questgen.txt38
1 files changed, 38 insertions, 0 deletions
diff --git a/npc/functions/questgen.txt b/npc/functions/questgen.txt
new file mode 100644
index 000000000..285924cbd
--- /dev/null
+++ b/npc/functions/questgen.txt
@@ -0,0 +1,38 @@
+// Evol functions.
+// Authors:
+// monwarez
+// Reid
+// Description:
+// Generate a random quest type and location.
+// Variables:
+// @quests : 2D array containing quest type and location availability
+// with @nb_type rows and @nb_location columns.
+// boolean value determine if the connection is possible between
+// the quest type and location selected.
+// @nb_difficulty : difficulty value from 0 to N-1.
+// Argument:
+// 0 : quest type
+// 1 : quest location
+// 2 : quest difficulty
+// Return : Tridimentional array value;
+
+function script questgen {
+
+ .@argc = getargcount();
+ @q_type = getarg(0, rand(@nb_type * 10) / 10);
+
+ do
+ {
+ @q_location = getarg(1, rand(@nb_location * 10) / 10);
+ .@cell = @q_type * @nb_location + @q_location;
+
+ if (!@quests[.@cell] && .@argc >= 2)
+ {
+ return false;
+ }
+ } while (!@quests[.@cell]);
+
+ @q_difficulty = getarg(2, rand(@nb_difficulty * 10) / 10);
+
+ return true;
+}