EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Guide to the .qst Quest System (https://www.eqemulator.org/forums/showthread.php?t=5262)

just_add_water 02-16-2003 11:47 AM

Guide to the .qst Quest System
 
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.

Piska 02-28-2003 07:01 AM

Ok I am not sure if this matters, but can you space out the script to make it easier to follow. IE putting it on multiple lines. I have done a little programming in C and you can put in on multiple lines. And is there any way to spawn other NPC's, and pass some kind of variable to that other NPC? For example:

Say I had an NPC and I hailed it, then have that NPC spawn 4 other NPC's and have them cast 4 different fireworks spells.

Oh one more thing is there any kind of timer that can be used?
Also is there any command to move the character to a loc in the zone. Kind of like the #goto command in EQEmu?

Drawde 03-01-2003 12:01 AM

Does this work with EQEmu 4.2?

fnemo 03-01-2003 07:59 AM

This is for 4.3-DR*

Piska 03-01-2003 01:06 PM

Does any one have answers to my questions :?:

Drawde 03-03-2003 08:11 AM

Is there anywhere to download the binaries for 4.3dr2? I'd definitely like to try out this new scripting system - looks much more flexible than the old one, with IF, AND, OR etc, particularly for things like multiple item turn-ins.

killspree 03-03-2003 08:30 AM

Telmet has some binaries that work fairly well.

TwoSock 03-05-2003 09:05 AM

OMG

Mirc scripting in EQ... that's my job!

that's soo cool... i was actually trying to find a good purpose for mirc in all this hehe


is this quest system actually working right now?

killspree 03-05-2003 09:15 AM

Yeah it's working in 4.3 dr2.

Drawde 03-09-2003 07:33 AM

Another thing to note is that the .qst files don't just go in the \quests folder, they need to go in a sub-folder named after the zone the quest NPC is in - e.g quests\qeynos2\01.qst.
This is a really handy feature, as it makes organising .qst files and finding ones to modify/fix much easier.

killspree 03-09-2003 09:31 AM

Agreed Drawde. It also should allow you to make multiple quest scripts for the same npc type if you choose to spawn them in different zones.

Haven't tried that yet but it should probably work. All in all I'm really excited about the new quest system, looks like lots of flexability that wasn't available in the old system.

morpheus014 03-13-2003 09:58 AM

Very nice work, its nice having one place to look for info on quests, the new system will help bring more to the emu, since quests are a major part of EQ. just my 2cents =P

wraithmajere 03-15-2003 10:17 AM

An Idea Maybe?
 
Hrm anyone have a way to test these new scripts outside of game maybe? Would definatly save time from having to log into the game, find out it doesn't work, just to edit it, and re-log in, over-n-over ;) Sorry if I sound too n00b ;) -- but just wish there was a 3rd party tool to do quest scripting tests ;) any ideas?

Lurker_005 03-15-2003 10:51 AM

Try running EQ using EQW quest were (are?) read each time they are activated. So a change made to the .qst file will show up the next time it is triggered. so no need to log out ect, just switch windows, edit the quest and switch back to test.

I havn't tried this with the new quest system yet, but hoping it still works.

killspree 03-15-2003 11:05 AM

The files are loaded when the zone is booted up, so you have to camp out and reboot the zone for the changes to take affect.


All times are GMT -4. The time now is 10:53 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.