Basic Overview
The new quest system is very similar to MIRC scirpting. It introduces if() statements, $vars and %variables, and EVENTS.With the new quest system you can set dynamic variables example: "%DynamicVariable = "Something";"."Something" can also be a $var or %variable.
Saving Quests
You have to save quests using the .qst file type. Which can be done by using note pad and using Save As. Then go to File type and select All Files . Quests should be saved in /quests/Zonename/NPCID.qst . You can use /quests/world.qst . to have that quest work for every npc.
%Variables
You can set custom %variables and use them in scripts.
Syntax: %variable_name = "Something here";
Example: %level = "$calc($mlevel + 3)";
Commands
- Events -
EVENT_SAY - Triggered when a mob is targeted and the PC types something.
EVENT_ITEM - Triggered when (an) item(s) is turned into a PC via trade.
EVENT_DEATH - Triggered when the NPC dies.
EVENT_ATTACK - Triggered when the NPC is attacked. (Note: It will not trigger again until the mob has been disengaged in combat for 13 seconds.
EVENT_SPAWN - Triggered when the NPC spawns.
- Variables -
$1 - $9 = Used to identify words said directed torward an NPC. Say you said "Hello Tunare, my name is chauncie."
$1 would be "Hello "
$2 would be "Tunare,".
$2- would be "Tunare, my name is chauncie"
$3 would be "my"
$3- would be "my name is chauncie"
$1- would be "Hello Tunare, my name is chauncie."
- Identifiers -
$name - Returns the name of the user that triggered the Event.
$race - Returns the race of the user that triggered the Event.
$class - Returns the class of the user that triggered the event.
$userid - Returns the ID of the user that triggered the Event.
$ulevel - Returns the level of the user that triggered the Event.
$uguildid - Returns the ID of the guild of the user that triggered the Event.
$ugildrank - Returns the guild rank of the user that triggered the Event.
$mobid - Returns the NPCTypeID of the mob that the user triggered the Event on.
$mlevel - Returns the level of the mob that the user triggered the Event on.
$item 1-4 - If user turned in an item, $item1 would be the first item they turned in, $item2 the second, $item3 the third etc etc.
$faction - Returns the faction level of the user with the mob.
$zonesn - Returns the zone short name that the Event occured in.
$zoneln - Returns the zone long name that the Event occured in.
$status - Returns the account status of the user that triggered the Event.
$+ - Say that $name is billy : Great_Lord_ $+ $name would be: Great Lord billy.
$item0-3 - If user turned in an item, $item0 would be the first item
Also when an item is turned in it is given an identifier:
$item0 - The item in the first slot.
$item1 - The item in the second slot.
$item2 - The item in the third slot.
$item3 - The item in the fourth slot.
$mid(string,index,end) - $mid("Hello",1,3) would return "ell".
$calc(Mathematical operation) - $calc((2*90) / 4) would return 45.
$hasitem(itemid) $hasitem(1001) would return $true if user has item# 1001 $false if not.
$strlen(string) - $strlen("Hello") would return 5.
$asc(character) - $asc(A) would return 65.
$chr(number) - $chr(65) would return A.
$gettok(string,character,index) - gettok(heh1.heh2.heh3,46,0) would return "heh2".
$replace(string,Find,Replace) - Replaces letters/numbers in text.
Ex $replace(hi there,u,l) would return "hi there".
Ex $replace(hi there,e,l) would return "hi thlrl".
- Commands -
say("Text") - Mob will say "Text".
emote("Text") - Mob will emote "Text".
shout("Text") - Mob will shout "Text".
spawn(npc_type,grid,guildwarset,x,y,z) - Spawn "npc_type" on "grid" with "guildwarset" at "x","y","z".
echo("Text") - Echoes specified text to console.
summonitem(itemid) - Summons "itemid" to user that triggered Event.
castspell(id,spellid) - Casts "spell" on entity with "id".
depop() - Mob will de-spawn.
cumflag() - Flag 50 for mob will increase by 1.
flagnpc(flag,flag_value) - Sets "flag" to "flag_value" for mob.
flagclient(flag,flag_value) - Sets "flag" to "flag_value" for client.
exp(amount) - Adds "amount" of exp to user's exp amount.
level(newlevel) - Sets user level.
safemove() - Moves user to zone's safe x,y,z.
rain(1/0)/snow(1/0) - Makes it rain or snow in zone.
givecash (cop.,silv.,gold,plat) - Gives client coin.
pvp("on/off") - Sets pvp on/off for user.
doanim(anim_num) - Mob will do animation for "anim_num".
addskill(skill,value) - Increases "skill" by "value" for user.
me(text) - Does a name-less emote, me("The ground below you begins to shake")
- If Statements -
An if statement is used to check to see if a condition is true, if it is true then it continues on. If statements can use operators: ==,!=,<,>,<=,>=,=~.
Syntax: if (something operator something_else (&&,||) etc.
if ($calc("$mlevel - $ulevel") <= 3) { say("Your low, so i'll kill you $name") }
if ($1 == "Hail,") { say("Hail there $name $+ ! How is your day?") }
if ($1- =~ "Hi" || $1- =~ "hey" || $1- =~ "yo") { shout("Hello!") }
if ($1 != "password" && $1 != "12321") { say("That's the incorrect password, I won't talk to you!") }
You may use if statements inside of if statements example:
if ($1 == "heh") { if ($2 == "4") { say("Bahh") } }
Examples
A simple hail script.
Code:
EVENT_SAY {
if ($1- =~ "Hail") { say(" Why hello there mister!") }
}
More then one responce.
Code:
EVENT_SAY {
if ($1- =~ "Hail") { say("Hey, have you seen a [rock] around here?") }
if ($1- =~ "rock") { say("Ya it was big and shiny") }
}
Item turn-in
Code:
EVENT_ITEM {
if ($item0 == "1001") { say("Wow thanks for this.. cloth?!"}
}
NPC shouting and emoting
Code:
EVENT_SAY {
if ($1- =~ "Hail") { me(" Theres a sound of wind blowing as you come close to bob-the-npc") }
if ($1- =~ "wind") { shout("This guy is bugging me") }
}
NPC death
Code:
EVENT_DIE {
say("I'll get you back $name !")
shout(" I've just died!")
}
Bone chips quest
Code:
EVENT_SAY {
if ($1- =~ "Hail") { say("Hail $name . We of Tunare are charged with protecting the Great Mother from the forces of Innoruk. Even now the evil minions of this foul deity are despoiling our great forest. Will you help us [protect the mother]?") }
if ($1- =~ "perform a task") { say("Just outside the gates of Felwithe the forces of Innoruk gather in the guise of decaying skeletons. Bring me four sets of bone chips as proof of your vigilance. I assure you that your faith shall not go unrewarded.") }
}
EVENT_ITEM {
if ($item1 == "13331" && $item2 == "13331" && $item3 == "13331" && $item4 == "13331") { say("Praise Tunare - I knew that you would be victorious. I reward you with this spell, and pray that it will help you in your fight against the unholy forces of Innoruk.") spawnitem(15374) }
}
Updated by Monrezz 29th Feb - fixed a few errors in the examples.