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.

TheOne 03-15-2003 11:27 AM

QST command
 
or if You are serverOP you can use the #reloadqst command to flush are reload the quest cache.

killspree 03-15-2003 11:41 AM

Oh wow, didn't know that command exsisted. That'll help a lot. :)

Monrezz 04-02-2003 05:01 AM

Feature Request:

Could:
$sex (Returns sex of the person that triggered event or whatever ;))
be added to next release? Would just make some of the says a little more personal :D

rob348 04-12-2003 09:39 AM

hi everyone. I am not familiar with mirc scripting. Are there any guides i can follow that will teach me how to do it? You know, something llike a for dummies book?

Thanks in advance

Lurker_005 04-12-2003 08:53 PM

The first post in this thread is your guide.

loudent2 04-23-2003 07:59 AM

I 'm new to EQEmu
 
My question is how do you bind a quest to an npc? Does one simply name the .qst file after the NPC?

a_Guest03 04-23-2003 08:18 AM

It's named after the NPCID (The unique ID associated with the NPC)

loudent2 04-25-2003 07:32 PM

What root directory
 
is the root directory where you have the emulator installed(world.exe etc) or mysql\bin or what? I'm assuming the emulator right now.

killspree 04-25-2003 08:11 PM

emufolder\quests\zoneshortname\

OR emufolder\quests\all\

You can put the quest files in either of those folders, of course if they're put in the zonename folder, they only work in that zone, if they're in all they work for any zone that has that npc in it.

hogosha 04-27-2003 07:37 AM

Would this work?
 
Would this work in world.qst ? This is a little quest that I think every server should have for it's staff. For 1, it can help your staff members to get the job done easier. Like if they are starting a quest, they can write the quest in there. Of coarse the code would have to be updated for the staff members unless there is a flag variable that I didn't see. But for admins, if your just starting a char over this would be a good code, especially if you program it further to give you items for that class. It's a good idea. Feel free to modify it if it works.

Code:

EVENT_SAY {
        if($name="Hogosha") {
                if($1="Hail")
                        level(100)
                        flag_client(300)
                }
                if($1="Rain") {
                        snow(0)
                        rain(1)
                }
                if($1="Snow") {
                        rain(0)
                        snow(1)
                }
                if($1="Weather Stop") {
                        rain(0)
                        snow(0)
                }
                if($1="Start Quest") {
                        say("No Quests")
                }
                if($1="Despawn") {
                        depop($mobid)
                }
        }
}


Lurker_005 04-28-2003 12:33 PM

world.qst? have I been sleeping and missed that or is that something you were suggesting wes add?

Actually it sounds interesting, as long as it will not be a performance problem. A thought along those lines, since it is global make it a command to access the global quest file. This might be a way to give some limited scripting capabilities to server operators.

hogosha 04-28-2003 12:44 PM

ive seen some people talk about world.qst, wether it really exists or not I have no idea, but I have heard of it. Test it out.

just_add_water 04-30-2003 11:30 AM

I'm pretty sure it goes in /quests/default.qst


Heres a debug quest


Code:

EVENT_SAY {
if( $1 =~ "debug" && $status >= "100" ) { say(" Hello $name ( USERID $userid ) with stats $status  . You are $ulevel ,class $class ,race $race . You are in guild ID $uguildid , rank $ugildrank . We are in $zoneln ( $zonesn ) . ")
}


fnemo 05-09-2003 09:41 AM

How are coded the race to check the race of the player ? jsut as the define in the source code ?

Solx 05-20-2003 04:47 PM

Are these new Quests working in 4.4-DR1?
 
Are these new Quests working in 4.4-DR1?
I tried to create my own quest, and then I downloaded a bunch of quests from a thread here. And in neither case did they do anything. I even shut everything down and restarted world.exe and the zones. My equemu directory is: D:\EQEmu\EQEMu-0.4.3-Win32\quests\rivervale (Yes it is really 0.4.4-DR1). I placed the quests in D:\EQEmu\EQEMu-0.4.3-Win32\quests. Here is one quest I was testing the file is at: D:\EQEmu\EQEMu-0.4.3-Win32\quests\rivervale\11.qst, and the contents of the file are:
Code:

/*  Zone:rivervale  ID:11 -- Ace_Slighthand */
EVENT_SAY {
if($1- =~ "Hail"){
SAY("Hey. hey. hey!  Welcome to the Fool's Gold.  Don't bet more than you can afford to lose. pal!  You don't want to end up like ol' [Kevlin].")
}
}

/*END of FILE*/

I also verified npc 11 is Ace Slighthand in the npc_types database. I tried using the built in hail command (just the letter h when the npc is targeted), and I tried typing in Hail and hail, but no response at all.

I could show the text in the shell of world.exe and the zone server that loaded rivervale, but neither says anything about quests.

Could there be a different version of 4.4-DR1 that I should download that has the quests enabled?

Thanks for any help you can supply.

Edgar1898 05-22-2003 08:20 AM

Quote:

Could there be a different version of 4.4-DR1 that I should download that has the quests enabled?
Yes you can download the official version via CVS. BTW, never download Telmets source or binaries unless you know exactly what your getting. He makes changes to them after he gets them from us, so who knows what he does with them...

DeletedUser 05-31-2003 02:59 PM

So...
 
The binaries for 0.4.4-dr1 don't support .qst files?

Krathis 06-08-2003 05:20 AM

I just wanted to say i love the way you did the quest system wes. its easy and fast.

tsaphemu 06-08-2003 12:01 PM

My .qst files are working with 4.4 dr1, my only problem is that when I say the second part of the quest trigger it says the first along with the second.

07-08-2003 06:04 PM

kk
 
OK, I wanna know WHERE you write the quests... do you implement them during game? Or do you write them up in a certain program like database or something?

IANumtin 07-08-2003 11:25 PM

You can write the quests using "notepad" but when you save them, change the file type to ALL and then save the file with .qst extention. It goes in your emu directory under the folder "quests" (be sure to put it in the correct subfolder for the zone).

07-10-2003 11:02 AM

K cool
 
Yeah to practice the new Quest system I wrote a quest in Notepad cause it seemed compatible, which Databases include the Quest package? And can anyone include a quick Start to Finish guide on getting the system up and running? n00b at all this but have plenty of time to learn...

cannonalldex 07-11-2003 05:17 PM

try placing the quest folder in C:\eqemu\binary\Quests

then inside the quest folder you will need the name of the zone you want the quest in C:\eqemu\binary\Quests\Qeynos

then name the .qst file after the npcid number of the npc you want to use the quest. for instance, captain tillan, i do a #npcstats or #showstats while targeting captain tillan and see that his npcid number is 1000. i would name the file 1000.qst. and place it into the Qeynos folder.

C:\eqemu\binary\Quests\Qeynos

the zone has to reboot for the quest to work, if not rebooted, and someone is in zone you can do #reloadqst and this will clear the .qst memory cache. good luck.

zanny_1 07-12-2003 03:55 PM

NPC's not casting
 
I can get all the other commands i have tried to work in the scripts, except i can't get an npc to cast in a quest situation. I have put text before and after the cast command(s) and the npc will say the text but seems to just disregard the cast commands.. could someone give me an example of an npc casting a translocate spell on the hailer?

Thanks in advance

tcsmyworld 07-12-2003 06:16 PM

here is example of working soulbinder -

EVENT_SAY{
if ($1-=~ "Hail"){ say("Greetings $name . When a hero of our world is slain. their soul returns to the place it was last bound and the body is reincarnated. As a member of the Order of Eternity. it is my duty to [bind your soul] to this location if that is your wish.") }
if ($1-=~ "bind my soul"){ say("Very well. You will return to this spot when you die.") castspell("$userid","2049")) }
/*END of FILE Zone:freporte ID:5552 -- Soulbinder_Grunson */


All times are GMT -4. The time now is 07:49 PM.

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