Apollo's Guide to the EO+ Quest System



Greetings and welcome to my quest making tutorial for use with the EO+ system. This Page is designed to provide a step by step tutorial in Quest Design for beginners, as well as a reference for people who wish to make even more complex quests. Best of Luck to all of you. ~Apollo

Getting Started
Making a New EO+ File
Quest Name and Version
Intoduction to Quest States
Describing the State Goal
How to Create a Quest Action
Making Quest Goals
Finishing a Quest
Apollo's Step by Step Quest for Beginners
EO+ Syntax Dictionary
Creating Your Own Custom Commands
Plugin for NotePad++





Getting Started



The very first thing you will want to do is write out some notes on how your quest should work. After this, you will need to make some id entries with your pub editor for the Quest ID. Quest ID's are important for organizing your quests into a logical order. You may already have Quest NPC's on your server with NPC ID's all over the place, but with the Quest ID system you may use a numbering order to help you organize quest steps. For instance, your NPC ID's may be 166, 135, and 241, but you can simply add a Quest ID to each of these for order (example 1,2, and 3). Once you have given your Quest NPC's a Quest ID you are ready to move on.



Making a New EO+ File



Once you have your NPC's tagged with Quest ID's, the next logical step is to make your EO+ quest file. What you'll want to do first is determine the NPC that begins the quest. For this example I will reference the SkyWonder Rescue from EO Main. The Quest's first character is Jessica(NPC 192), and her Quest ID is 13. Using any text editor (i don't recommend notepad, but it will work fine) you need to start a new file and save it as 00013.eqf. This will tell EO+ that the Quest ID is 13 and begins with the NPC that has the Quest ID 13.


Quest Name and Version



At the very beginning of your new EO+ file, you will need to declare the Quest Name and Version number. This is where the actual EO+ code begins. There are two declarations that can be used outside of {brackets} in EO+. The First one is "Main". You will use this heading to declare only your Quest name and Version number.
To begin the heading, on the first line type: Main
On the second line make an opening bracket: {
On the third line, the Quest should be named by typing: questname "Skywonder Rescue"
On the fourth line, the Version # must be entered: version 1.0
Finally on the fifth line enter the closing bracket: }
Make sure to Surround your Quest name With Quotes and use the Decimal form for the Version number (Major.minor). Version number will be used to update Quest scripts in EOSERV.
Example: "Pjedro's Son".
Your finished Header Should look like this:
Main
{
	questname	"Skywonder Rescue"
	version		1.0
}



Introduction to Quest States



A quest state is the way the server determines at what point in the quest your character is in. Each state will be given a name starting with the first state always being named Begin. After the first state, you may name the states whatever you would like. You should have an idea of the number of quest states you will need to make your quest work when you start, but it isn't hard to develop a quest with EO+ from scratch either. Lets start making states. Here is an example of how the first two states will begin:

State Begin
{

}
State TalkToWolfLeader
{

}


Describing the State Goal



Each state should have a described goal to be displayed in the Quest Book. This goal will be what tells the player the next step of action to take. To create this tag simply type desc followed by the description in " ". Lets add some descriptive tags to our Skywonder quest:
State Begin
{
	desc	"Talk to Jessica"

}
State TalkToWolfLeader
{
	desc	"Talk to the Wolf Leader"

}


How to Create a Quest Action



Quest actions are where the magic happens. You will use actions to put into motion everything a quest can do. This can range from simply talking to an NPC all the way to Getting an Item and Exp reward. All actions are triggered by the action tag followed by the actual action call. The most frequently used actions in a quest are "AddNpcText" and "AddNpcInput". You will use these to create your quest dialogs. In some quest states you will find that you may talk to more than 1 NPC character at a time. This is where your skills as a writer will come in handy!
To create your first dialog, use the "action" tag, followed by "AddNpcText(npc quest id, "message");
It is very important to pay attention to the punctuation here. If you leave out a " or the ; at the end things could go terribly wrong. Your dialog may not even be displayed. Here is how an added dialog would look:
State Begin
{
	desc	"Talk to Jessica"
	action	AddNpcText(13, "Hello, as you can see I live peacefully with the blobsies in the wonderful sky, then one day the wolfman and the foxes got into a fight and all the foxes moved to here");

}
State TalkToWolfLeader
{
	desc	"Talk to the Wolf Leader"
	action	AddNpcText(13, "Go talk to the wolfman first im sure he's willing to compromise so we can all live in peace again.");
	action	AddNpcText( 14, "Hello there, i see Jessica sent you, what do you want?");

}


As you can see, the TalkToWolfLeader state actually has Jessica's second dialog, as well as the first dialog from the Wolfman. Once the quest state has moved to the TalkToWolfLeader state, Jessica will always instruct players to talk to the Wolf Leader.
Now for adding some interaction via the dialog window. AddNpcInput works just like AddNpcText except it needs a link value to direct what happens when a link is clicked. The action call works like this: AddNpcInput(NPC Quest ID, Input ID, "message");
The Input ID is up to you, but you should keep it ordered beginning with 1. (0 is not used as a link as the quest engine reserves 0 for cancel). Lets add some input links:
State Begin
{
	desc	"Talk to Jessica"
	action	AddNpcText(13, "Hello, as you can see I live peacefully with the blobsies in the wonderful sky, then one day the wolfman and the foxes got into a fight and all the foxes moved to here");

}
State TalkToWolfLeader
{
	desc	"Talk to the Wolf Leader"
	action	AddNpcText(13, "Go talk to the wolfman first im sure he's willing to compromise so we can all live in peace again.");
	action	AddNpcText( 14, "Hello there, i see Jessica sent you, what do you want?");
	action	AddNpcInput( 14, 1, "I come in peace");
	action	AddNpcInput( 14, 2, "Nothing, bye");

}


There are many more actions that can be added into a quest state similar to these. I will cover those later in this guide.

Making Quest Goals



Every quest state must have a method of being satisfied so that it can move on to the next state. The tag used to define these goals is called "rule". A rule has a basic structure: rule tag, rule type, and goto state. The most basic rule is TalkedToNpc(Npc Quest ID). Lets add this to our begin state:
State Begin
{
	desc	"Talk to Jessica"
	action	AddNpcText(13, "Hello, as you can see I live peacefully with the blobsies in the wonderful sky, then one day the wolfman and the foxes got into a fight and all the foxes moved to here");

	rule	TalkedToNpc(13) goto TalkToWolfLeader
}
State TalkToWolfLeader
{
	desc	"Talk to the Wolf Leader"
	action	AddNpcText(13, "Go talk to the wolfman first im sure he's willing to compromise so we can all live in peace again.");
	action	AddNpcText( 14, "Hello there, i see Jessica sent you, what do you want?");
	action	AddNpcInput( 14, 1, "I come in peace");
	action	AddNpcInput( 14, 2, "Nothing, bye");

}


As you can see, all that is required to move from the "Begin" state to the "TalkToWolfLeader" state is that a player must have simply opened the dialog window with Jessica.
Rules can also be used to determine what the Input Link will do next. The rule "InputNpc(Input ID)" will help us handle links. Now lets add a rule for clicking a link and a new state to go to:
State Begin
{
	desc	"Talk to Jessica"
	action	AddNpcText(13, "Hello, as you can see I live peacefully with the blobsies in the wonderful sky, then one day the wolfman and the foxes got into a fight and all the foxes moved to here");

	rule	TalkedToNpc(13) goto TalkToWolfLeader
}
State TalkToWolfLeader
{
	desc	"Talk to the Wolf Leader"
	action	AddNpcText(13, "Go talk to the wolfman first im sure he's willing to compromise so we can all live in peace again.");
	action	AddNpcText( 14, "Hello there, i see Jessica sent you, what do you want?");
	action	AddNpcInput( 14, 1, "I come in peace");
	action	AddNpcInput( 14, 2, "Nothing, bye");

	rule	InputNpc(1) goto GetBirdFeathers

}
State GetBirdFeathers
{
	desc	"Find 10 bird feathers"
	action	AddNpcText( 14, "We are currently at war with the birdmans on the other mountain. I am currently too busy to talk about peace with the foxes.");
	action	AddNpcText( 14, "You know i hate those annoying birdmans, if you help us fight the birdmans and bring me 10 bird feathers I will think about your offer." );

}
State GiveFeathers
{
	desc	"Give 10 bird feathers"
	action	AddNpcText(14, "Hi again, i can see you have been fighting with the birdmans, your help is greatly appreciated!");
	action	AddNpcText(14, "Will you give me those bird feathers?");
	
	action	AddNpcInput(14, 2, "Ok, here you are");
	action	AddNpcInput(14, 1, "No, these are mine");

	rule	InputNpc(2) goto TalkToJessica

}


Some Quests will have requirements such as gathering items in this one. Two rules are used here. GotItems is used to check your items for your Quest progress, and LostItems checks your items to see if you lost any of your required items before moving on to a new state. GotItems should be used to forward to the next state, while LostItems will be used to backtrack to the old state should you lose any items along the way. Both contain two values (Item ID, Amount). This is how they should look when added:
State Begin
{
	desc	"Talk to Jessica"
	action	AddNpcText(13, "Hello, as you can see I live peacefully with the blobsies in the wonderful sky, then one day the wolfman and the foxes got into a fight and all the foxes moved to here");

	rule	TalkedToNpc(13) goto TalkToWolfLeader
}
State TalkToWolfLeader
{
	desc	"Talk to the Wolf Leader"
	action	AddNpcText(13, "Go talk to the wolfman first im sure he's willing to compromise so we can all live in peace again.");
	action	AddNpcText( 14, "Hello there, i see Jessica sent you, what do you want?");
	action	AddNpcInput( 14, 1, "I come in peace");
	action	AddNpcInput( 14, 2, "Nothing, bye");

	rule	InputNpc(1) goto GetBirdFeathers

}
State GetBirdFeathers
{
	desc	"Find 10 bird feathers"
	action	AddNpcText( 14, "We are currently at war with the birdmans on the other mountain. I am currently too busy to talk about peace with the foxes.");
	action	AddNpcText( 14, "You know i hate those annoying birdmans, if you help us fight the birdmans and bring me 10 bird feathers I will think about your offer." );

	rule 	GotItems(299,10) goto GiveFeathers

}
State GiveFeathers
{
	desc	"Give 10 bird feathers"
	action	AddNpcText(14, "Hi again, i can see you have been fighting with the birdmans, your help is greatly appreciated!");
	action	AddNpcText(14, "Will you give me those bird feathers?");
	
	action	AddNpcInput(14, 2, "Ok, here you are");
	action	AddNpcInput(14, 1, "No, these are mine");

	rule	InputNpc(2) goto TalkToJessica
	rule	LostItems(299,10) goto GetBirdFeathers

}


Finishing a Quest



Well here's where it all comes to an end. There are basically two types of Quest endings. One is when the quest can be repeated, the other is when the quest cannot be repeated. To finish our short version of the SkyWonder Rescue we will need a couple more states added. One I have already labeled in the previous "rule" as "TalkToJessica" and a new state we shall call "Reward". Having already covered examples of the first state, "TalkToJessica" is easy to make. All that is needed is a "TalkedToNpc" rule to send us on to the Reward state. Here's how the last two states should look:
State TalkToJessica
{
	desc	"Go see Jessica for your reward"
	action	RemoveItem(299,10);
	action	AddNpcText(14, "Go tell Jessica we shall make peace with the Foxes");
	action	AddNpcText(13, "Thank you so much for your help, please accept this reward");

	rule	TalkedToNpc(13) goto Reward
}
State Reward
{

}


As you can see, I have added the RemoveItem(Item ID, Amount) action to the TalkToJessica state so that the feathers from the previous input are actually removed since the link had been clicked. The state is ready to move on to the "Reward" state.
A few basic things should be handled in the "Reward" state, namely giving rewards and either resetting or ending the quest. Using GiveExp(amount) and GiveItem(Item ID, amount) we can throw in some nice rewards here.
State Reward
{
	action	GiveExp(500);
	action	GiveItem(1, 500);
}


And now for the finale. All that is left is to either use Reset() or End() to Repeat or End this Quest. If the Quest is ended, it will display in the character's Quest history book. For this Quest I will add Reset() to be able to repeat the quest again.
State Reward
{
	action	GiveExp(500);
	action	GiveItem(1, 500);
	action	Reset();
}


And That's it. Congrats on making your first mini-quest using EO+!


Apollo's Step by Step Quest for Beginners



Ok, now with a little bit of understanding of the EO+ layout I will make a quest from scratch. I will use 2 Npc's for this as well: Wise Man and Pig Farmer. Next, I will make a flow chart for this quest.
Talk to Wiseman
Kill 5 rats
Return to Wiseman
Step on a tile
Return to Wiseman
Collect 5 Penguin Meat
Return to Wiseman
Talk to Pig Farmer
Return to Wiseman
Kill another player in pk
Return to Wiseman/Open Class Menu
Change Class

Wow, that's a lot to do. Shouldn't take very long to make though. First, I will add the header and make an empty state for each:

Main
{
	questname "Wiseman Quest"
	version		1.0
}
State Begin
{

}
State KillRats
{

}
State Wiseman1
{

}
State TileStep
{

}
State Wiseman2
{

}
State GetPenguinMeat
{

}
State Wiseman3
{

}
State TalkToPigFarmer
{

}
State Wiseman4
{

}
State KillPlayer
{

}
State ClassMenu
{

}
State Priest
{

}
State Magician
{

}
State Rogue
{

}
State Archer
{

}
State Warrior
{

}

Next, I will add description tags where needed:
Main
{
	questname "Wiseman Quest"
	version		1.0
}
State Begin
{

}
State KillRats
{
	desc	"Kill 5 Rats"
}
State Wiseman1
{
	desc	"Talk to Wiseman"
}
State TileStep
{
	desc	"Check the Boat Door"
}
State Wiseman2
{
	desc	"Talk to Wiseman"
}
State GetPenguinMeat
{
	desc	"Find 5 Penguin Meat"
}
State Wiseman3
{
	desc 	"Talk to Wiseman"
}
State TalkToPigFarmer
{
	desc	"Talk to Pig Farmer"
}
State Wiseman4
{
	desc	"Talk to Wiseman"
}
State KillPlayer
{
	desc	"Kill 1 Player in PK"
}
State ClassMenu
{
	desc	"Talk to Wiseman"
}
State Priest
{

}
State Magician
{

}
State Rogue
{

}
State Archer
{

}
State Warrior
{

}

That was easy, now for some dialog:
Main
{
	questname "Wiseman Quest"
	version		1.0
}
State Begin
{
	action AddNpcText(4, "Hellow there, I am tired of changing classes for just anyone");

}
State KillRats
{
	desc	"Kill 5 Rats"
	action	AddNpcText(4, "Prove you aren't lazy, Kill 5 Rats.");
}
State Wiseman1
{
	desc	"Talk to Wiseman"
	action 	AddNpcText(4, "Ok, but I have a request of you");
}
State TileStep
{
	desc	"Check the Boat Door"
	action	AddNpcText(4, "Check that boat that sails to Newb Land to ensure the door to the captain's chamber is locked");
}
State Wiseman2
{
	desc	"Talk to Wiseman"
	action	AddNpcText(4, "Good, now I am hungry. Go fetch about 5 Penguin meat for my dinner");
}
State GetPenguinMeat
{
	desc	"Find 5 Penguin Meat"
}
State Wiseman3
{
	desc 	"Talk to Wiseman"
	action	AddNpcText(4, "Did you get 5 penguin meat?");
}
State TalkToPigFarmer
{
	desc	"Talk to Pig Farmer"
	action	AddNpcText(4, "Invite the Pig Farmer to Town Square to share this meal with me");
	action	AddNpcText(24, "Wiseman, eh? Tell that old fart I am fat enough. I will pass"); 
}
State Wiseman4
{
	desc	"Talk to Wiseman"
	action	AddNpcText(4, "He refused? How rude! Go take out my anger on another player");
}
State KillPlayer
{
	desc	"Kill 1 Player in PK"
}
State ClassMenu
{
	desc	"Talk to Wiseman"
	action  AddNpcText(4, "You look like you could use a class change. What class would you like?");
}
State Priest
{

}
State Magician
{

}
State Rogue
{

}
State Archer
{

}
State Warrior
{

}

Looking good, now for some rules:
Main
{
	questname "Wiseman Quest"
	version		1.0
}
State Begin
{
	action	AddNpcText(4, "Hellow there, I am tired of changing classes for just anyone");

	rule	TalkedToNpc(4) goto KillRats
}
State KillRats
{
	desc	"Kill 5 Rats"
	action	AddNpcText(4, "Prove you aren't lazy, Kill 5 Rats.");

	rule	KilledNpcs(2, 5) goto Wiseman1
}
State Wiseman1
{
	desc	"Talk to Wiseman"
	action 	AddNpcText(4, "Ok, but I have a request of you");
	
	rule	TalkedToNpc(4) goto TileStep
}
State TileStep
{
	desc	"Check the Boat Door"
	action	AddNpcText(4, "Check that boat that sails to Newb Land to ensure the door to the captain's chamber is locked");

	rule	EnterCoord(1,6,21) goto Wiseman2
}
State Wiseman2
{
	desc	"Talk to Wiseman"
	action	AddNpcText(4, "Good, now I am hungry. Go fetch about 5 Penguin meat for my dinner");

	rule	TalkedToNpc(4) goto GetPenguinMeat
}
State GetPenguinMeat
{
	desc	"Find 5 Penguin Meat"
	
	rule	GotItems(259,5) goto Wiseman 3
}
State Wiseman3
{
	desc 	"Talk to Wiseman"
	action	AddNpcText(4, "Did you get 5 penquin meat?");

	rule	LostItems(259,5) goto Wiseman2
	rule	TalkedToNpc(4) goto TalkToPigFarmer
}
State TalkToPigFarmer
{
	desc	"Talk to Pig Farmer"
	action	AddNpcText(4, "Invite the Pig Farmer to Town Square to share this meal with me");
	action	AddNpcText(24, "Wiseman, eh? Tell that old fart I am fat enough. I will pass"); 
	
	rule	TalkedToNpc(24) goto Wiseman4
}
State Wiseman4
{
	desc	"Talk to Wiseman"
	action	AddNpcText(4, "He refused? How rude! Go take out my anger on another player");

	rule 	TalkedToNpc(4) goto KillPlayer
}
State KillPlayer
{
	desc	"Kill 1 Player in PK"

	rule	KilledPlayers(1) goto ClassMenu
}
State ClassMenu
{
	desc	"Talk to Wiseman"
	action	AddNpcText(4, "You look like you could use a class change. What class would you like?");
	action	AddNpcInput(2, "Priest");
	action	AddNpcInput(3, "Magician");
	action	AddNpcInput(4, "Rogue");
	action	AddNpcInput(5, "Archer");
	action	AddNpcInput(6, "Warrior");

	rule	InputNpc(2) goto Priest
	rule	InputNpc(3) goto Magician
	rule	InputNpc(4) goto Rogue
	rule	InputNpc(5) goto Archer
	rule	InputNpc(6) goto Warrior
}
State Priest
{

}
State Magician
{

}
State Rogue
{

}
State Archer
{

}
State Warrior
{

}

And now to add classes and loop back to the wiseman class menu ftw!
Main
{
	questname "Wiseman Quest"
	version		1.0
}
State Begin
{
	action	AddNpcText(4, "Hellow there, I am tired of changing classes for just anyone");

	rule	TalkedToNpc(4) goto KillRats
}
State KillRats
{
	desc	"Kill 5 Rats"
	action	AddNpcText(4, "Prove you aren't lazy, Kill 5 Rats.");

	rule	KilledNpcs(2, 5) goto Wiseman1
}
State Wiseman1
{
	desc	"Talk to Wiseman"
	action 	AddNpcText(4, "Ok, but I have a request of you");
	
	rule	TalkedToNpc(4) goto TileStep
}
State TileStep
{
	desc	"Check the Boat Door"
	action	AddNpcText(4, "Check that boat that sails to Newb Land to ensure the door to the captain's chamber is locked");

	rule	EnterCoord(1,6,21) goto Wiseman2
}
State Wiseman2
{
	desc	"Talk to Wiseman"
	action	ShowHint("Door is locked! Check back with Wiseman");
	action	AddNpcText(4, "Good, now I am hungry. Go fetch about 5 Penguin meat for my dinner");

	rule	TalkedToNpc(4) goto GetPenguinMeat
}
State GetPenguinMeat
{
	desc	"Find 5 Penguin Meat"
	
	rule	GotItems(259,5) goto Wiseman 3
}
State Wiseman3
{
	desc 	"Talk to Wiseman"
	action	AddNpcText(4, "Did you get 5 penquin meat?");

	rule	LostItems(259,5) goto Wiseman2
	rule	TalkedToNpc(4) goto TalkToPigFarmer
}
State TalkToPigFarmer
{
	desc	"Talk to Pig Farmer"
	action	AddNpcText(4, "Invite the Pig Farmer to Town Square to share this meal with me");
	action	AddNpcText(24, "Wiseman, eh? Tell that old fart I am fat enough. I will pass"); 
	
	rule	TalkedToNpc(24) goto Wiseman4
}
State Wiseman4
{
	desc	"Talk to Wiseman"
	action	AddNpcText(4, "He refused? How rude! Go take out my anger on another player");

	rule 	TalkedToNpc(4) goto KillPlayer
}
State KillPlayer
{
	desc	"Kill 1 Player in PK"

	rule	KilledPlayers(1) goto ClassMenu
}
State ClassMenu
{
	desc	"Talk to Wiseman"
	action	AddNpcText(4, "You look like you could use a class change. What class would you like?");
	action	AddNpcInput(4, 2, "Priest");
	action	AddNpcInput(4, 3, "Magician");
	action	AddNpcInput(4, 4, "Rogue");
	action	AddNpcInput(4, 5, "Archer");
	action	AddNpcInput(4, 6, "Warrior");

	rule	InputNpc(2) goto Priest
	rule	InputNpc(3) goto Magician
	rule	InputNpc(4) goto Rogue
	rule	InputNpc(5) goto Archer
	rule	InputNpc(6) goto Warrior
}
State Priest
{
	action 	SetClass(2);
	action 	SetState("ClassMenu");
}
State Magician
{
	action 	SetClass(3);
	action 	SetState("ClassMenu");
}
State Rogue
{
	action 	SetClass(4);
	action 	SetState("ClassMenu");
}
State Archer
{
	action 	SetClass(5);
	action 	SetState("ClassMenu");
}
State Warrior
{
	action 	SetClass(6);
	action 	SetState("ClassMenu");
}

And that is basically a step by step for how to make quests. Please refer to the EO+ Syntax Dictionary for a complete list of actions and rules that can be used in the EO+ Quest System.

EO+ Syntax Dictionary



Declarations

action - Used to denote a quest action. Action lines MUST end with a ";". Usage: action ActionName(variables);

desc - Used to describe the goal of the current state. Usage: desc "Current Goal"

goto - Used only within a rule declaration to denote the target state of the satisfied rule. See "rule" for usage.

Main - Used to begin the header of the EO+ quest. Usage:
Main
{

}

questname - Used to declare the name of the quest that will be displayed in the Progress and History book for the player. "questname" must be declared only within the brackets of the "Main" header. Usage: questname "Quest Name"

rule - Used to declare what conditions cause a state change. Rules MUST always end with a goto State tag. Usage: rule RuleType(variable) goto StateName

State - Used to name the state. Every state MUST have a name. The first state is ALWAYs Begin. Usage:
State StateName
{

}

version - Used to denote the quest version number. Version must be entered in a Major.minor decimal format within the brackets of the "Main" header. Usage: version 1.0

Actions

AddNpcChat - Used to add an Npc chat balloon during a given state (random chance). Usage: AddNpcChat(Npc Quest ID, "message string");

AddNpcInput - Used to add a link option in the dialog window. Usage: AddNpcInput(Npc Quest ID, Input ID, "message string");

AddNpcPM - Used to add a simple message to the dialog window. Usage: AddNpcPM("name string", "message string");

AddNpcText - Used to add a simple message to the dialog window. Usage: AddNpcText(Npc Quest ID, "message string");

End - Used to end a quest for good. Displays Quest on History as Completed. Usage: End();

GiveExp - Used to reward a player with experience points. Usage: GiveExp(amount);

GiveItem - Used to reward a player with an item. Usage: GiveItem(Item ID, amount);

GiveKarma - Used to reward karma to a player. Usage: GiveKarma(amount);

PlayEffect - Used to play a Special Effect on a player. Usage: PlaySound(Effect ID);

PlaySound - Used to play a Sound Effect. Usage: PlaySound(Sound ID);

Quake - Used to create a earthquake. Usage: Quake(size, map); or Quake(size, world);

RemoveItem - Used to give an item to a quest Npc. Usage: RemoveItem(Item ID, amount);

RemoveKarma - Used to remove karma from a player. Usage: RemoveKarma(amount);

Reset - Sets the quest state back to "Begin" (restarts the quest). Usage: Reset();

SetClass - Used to change the class of a player. Usage: SetClass(Class ID);

SetCoord - Used to move a player to a given coordinate. Usage: SetCoord(Map ID, X position, Y position);

SetRace - Used to change the race of a player. Usage: SetRace(Race ID);

SetState - Used to force a state change in the event of no realistic rules. Usage: SetState("StateName");

ShowHint - Used to show a hint message in the client's information bar. Usage: ShowHint("message string");


Rules
ArenaWins - Requires a player to have won a given amount of rounds in the Arena mini-game. Usage: Arena(amount) goto NextStateName

EnterCoord - Requires a player to stand at a given coordinate to progress to the next state. Usage: EnterCoord(Map ID, X coordinate, Y coordinate) goto NextStateName

EnterMap - Requires a player to enter a specific map to progress to the next state. Usage: EnterMap(Map ID) goto NextStateName

GotItems - Requires an amount of items to progress to the next state. Usage: GotItems(Item ID, amount) goto NextStateName

GotSpell - Requires a player to have learned a spell to progress to the next state. Usage: GotSpell(Spell ID) goto NextStateName

InputNpc - Uses a link value to progress to the next state. Usage: InputNpc(Input ID) goto NextStateName

KilledNpcs - Requires an amount of Npcs to be killed before progressing to the next state. Usage: KilledNpcs(Npc ID, amount) goto NextStateName

KilledPlayers - Requires an amount of Players to be killed (via player kill zones) before progressing to the next state. Usage: KilledPlayers(amount) goto NextStateName

LeaveCoord - Requires a player to leave a given coordinate to progress to the next state. Usage: LeaveCoord(Map ID, X coordinate, Y coordinate) goto NextStateName

LeaveMap - Requires a player to leave a map to progress to the next state. Usage: LeaveMap(Map ID) goto NextStateName

LostItems - Checks a players items to make sure the GotItems rule from the previous state is still true. Will return players to a previous state if the required items becomes less than needed. Usage: LostItems(Item ID, amount) goto PreviousStateName

LostItems - Checks a players spells to make sure the GotSpell rule from the previous state is still true. Will return players to a previous state if the required spell was forgotten. Usage: LostItems(Spell ID) goto PreviousStateName

UsedItem - Requires an amount of items to be used to progress to the next state. Usage: UsedItem(Item ID, amount) goto NextStateName

TalkedToNpc - Requires only that a dialog window with a specific quest npc be opened to continue to the next state. Usage: TalkedToNpc(Npc Quest ID) goto NextStateName

Creating your own Actions/Rules



Actions

Creating actions is actually the easiest of them all. You only have to edit two files. First file to edit is the Character::PerformQuestActions function in character.cpp. Where you see all the "else if (...)"'s is where you need to add your new code.

else if (action->name.compare("actionname") == 0)  
{  
    //Code what that action should do when called  
}

The next thing you have to do is tell the server that the action name is valid when it loads the quest. Which is in quest.cpp. It is around line 241 to 271; you have a bunch of "else if" statements that include the action names.

else if (action->name.compare("actionname") == 0 && action->args.size() != RequiredParameters)  
    SyntaxError("actionname requires RequiredParameters parameters");  


Rules

Rules are a bit more difficult to add, since I haven't came up with a function that can do it all :(. So to add a function, first you must think of where it should check it it's true. GotItems/LostItems is checked in AddItem/DelItem. KilledNpcs is checked in Damage. KilledPlayers in checked in AttackPK. You get the point. Once you have figured out where, you can add this code and edit where necessary.

Quest *temp_quest = 0;  
    State *state = 0;  
    UTIL_PTR_LIST_FOREACH(this->quests, Character_Quest, quest)  
    {  
        temp_quest = this->world->GetQuest(quest->id);  
        if (!temp_quest) continue;  
   
        state = temp_quest->GetState(quest->state);  
        if (!state) continue;  
   
        UTIL_PTR_VECTOR_FOREACH(state->rules, Rule, rule)  
        {  
            if (rule->name.compare("rulename") == 0 && ((int)(*rule->args[parameter_id])) == whatever_it_should_be &&  
                ((int)(*rule->args[parameter_id])) == whatever_it_should_be)  
            {  
                quest->state = rule->goto_state;  
                this->PerformQuestActions(quest->id);  
                break;  
            }  
        }  
    }


If you want to add more than one check in the same place, place parantheses around the first rule to the last argument check and add a || and 1 more set of parantheses. Inside the parantheses add the same thing in first one but with different parameters and rulename. If you don't understand what I mean, check EnterMap & LeaveMap for an example



The next thing you have to do is tell the server that the rule name is valid when it loads the quest. Which is in quest.cpp. It is around line 317 to 336; you have a bunch of "else if" statements that include the rule names.

else if (rule->name.compare("rulename") == 0 && rule->args.size() != RequiredParameters)  
    SyntaxError("rulename requires RequiredParameters parameter");