diff options
author | Reid <reidyaro@gmail.com> | 2016-09-26 23:16:06 +0200 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2016-09-26 23:16:36 +0200 |
commit | 80836440efc330b37bf75da3f65a9ab26415cf65 (patch) | |
tree | 1334509af0b5acb37dde02935df51f9fa1287c09 | |
parent | 8114310d0e5d0da10169968d98fe31742b0ba63d (diff) | |
download | serverdata-80836440efc330b37bf75da3f65a9ab26415cf65.tar.gz serverdata-80836440efc330b37bf75da3f65a9ab26415cf65.tar.bz2 serverdata-80836440efc330b37bf75da3f65a9ab26415cf65.tar.xz serverdata-80836440efc330b37bf75da3f65a9ab26415cf65.zip |
Add questgen function.
-rw-r--r-- | npc/functions/questgen.txt | 38 | ||||
-rw-r--r-- | npc/scripts.conf | 1 |
2 files changed, 39 insertions, 0 deletions
diff --git a/npc/functions/questgen.txt b/npc/functions/questgen.txt new file mode 100644 index 00000000..285924cb --- /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; +} diff --git a/npc/scripts.conf b/npc/scripts.conf index cc5933fe..af42f9d3 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -21,6 +21,7 @@ "npc/functions/npcmove.txt", "npc/functions/masks.txt", "npc/functions/openbook.txt", +"npc/functions/questgen.txt", "npc/functions/sailordialogue.txt", "npc/functions/sailortalk.txt", "npc/functions/savepoint.txt", |