Skip to content

questdata.js

Peter Gill edited this page Aug 10, 2019 · 8 revisions

Questdata consists of a global variable (Quests), an object containing an array for each questing location in the game.

A questing location in Antorax is generally an umbella term for a group of areas that have quests in them for a particular level group.

For example, eaglecrestLoggingCamp contains quests in Fishers' Valley, Eaglecrest Logging Camp and The Nilbog.

This page will outline the properties can (and sometimes must) be assigned to each quest.

General quest information

id contains the index of the array that this quest is. This is used as a unique identifier to identify any quest.

quest contains the name of the quest, displayed in the NPC start, progress and finish DOMs as well as the quest log. This should also be unique to the quest - no two quests should have the same name.

Generally different parts of the same quest arc have roman numerals to show which part it is. E.g: "Learning to Fish I" and "Learning to Fish II".

These properties are mandatory.

id: 0,
quest: "To the Logging Camp",

NPC information

startName contains the name of the NPC that starts the quest, displayed in the quest start DOM.

startChat contains the text that is said by the starting NPC when the player begins the quest, displayed in the quest start DOM.

finishName contains the name of the NPC that finishes the quest, displayed in the quest finish DOM.

finishChat contains the text that is said by the end NPC when the player finishes the quest, displayed in the quest finish DOM.

These properties are mandatory.

startName: "Cart Driver",
startChat: "Hi this is the Cart Driver",

finishName: "Marshall Teper",
finishChat: "Hello this is Marshall Teper.",	

objectives

objectives is an array of strings, where each string is a condition that is required to complete the quest. This is displayed in the quest start DOM and the active quests section of the quest log.

This property is mandatory.

objectives: [
	"Buy a weapon from a nearby weaponsmith.",
	"Speak to <strong>Marshall Teper</strong> at the Eaglecrest Logging Camp.",
],

Note that these are just cosmetic - the actual code checking if the player has done this is in the isCompleted property (see below).

Make sure to include the turn-in objective (the last one).

isCompleted

isCompleted is a function that checks which objectives the player has completed. It is used to display which have been completed in the quest log, and to check if the player can complete the quest when they speak to the quest finish NPC. This property is mandatory.

The array that is returned contains true or false for each of the objectives. To use the above example (buy a weapon and speak to Marshall Teper), the 0th item of the array will contain true or false based on if the player has bought a weapon or not.

The turn-in objective does not have a boolean value in this array. Instead, the last value in this array contains true or false depending on if all of the quest objectives have been completed or not. This is calculated by the isCompleted() global function that is in questdata.js.

Note that this is called by main.js, so any parts of Antorax code may be interacted with in this function.

isCompleted: function() {
	let completed = [];

	// true or falses for each objective (apart from the turn-in objective)
	completed.push(Dom.inventory.check(2, "sword") || Dom.inventory.check(2, "staff") || Dom.inventory.check(2, "bow")); // can be edited
	// more completed.push(boolean)s can be added below this if necessary - make sure there is one per objective (apart from turn-in)!
				
	completed = checkFinished(completed);
				
	return completed;
},

All of these lines of code must be included as they are here, except the completed.push(boolean) lines of code.

Please try to keep the completed.push(boolean) lines of code as one line by using ternary operators instead of multi-line conditional statements.

Example objective complete booleans

TBD

Quest start requirements

howToStart is a string that is shown on the possible quests section of the quest log, outlining to the player the requirements of starting the quest and how to do so (who to speak to). This is just cosmetic - the properties described below this are used to code the requirements themselves. This is mandatory.

levelRequirement is a mandatory integer property that contains the level the player has to be to start the quest.

questRequirements is a mandatory array of strings, where each element is the name of a quest that is required to have been completed to start this quest. If there aren't any quests required, just set it to an empty array.

howToStart: "Speak to <strong>Fisherman name</strong> at the Fisher's Valley.",
levelRequirement: 2,
questRequirement: "Learning to Fish I",

startRewards and rewards

startRewards and rewards are objects that contain information about rewards given to the player for doing the quest. They both follow the same structure of how they contain the information about the rewards given.

startRewards is an optional property that contains the rewards given to the player as soon as they accept the quest. It is shown in the quest start DOM.

rewards is a mandatory property that contains the rewards given to the player when they finish the quest. It is shown in the quest start and quest finish DOMs.

startRewards: {
	items: [
		{item: Items.bag[2],}, // 1 logging sack
	],
},
			
rewards: {
	xp: 30,
	items: [
		{item: Items.currency[2], quantity: 2,}, // 2 gold
	],
	reputation: {
		eaglecrestLoggingCamp: 50,
	},
},

None of the properties of the objects are mandatory, though it is strongly recommended that you include at least a small XP reward for all quests in rewards.

  • xp is the amount of XP to be given.
  • items is an array of objects containing each reward to be given, the first property, "item", is a reference to their itemdata.js item and the second property, "quantity", is the number of that item to given.
  • reputation is an object where each of the keys contains a reputation name, with the property being the amount of reputation to be gained (or negative for lost). This is not shown in quest start or quest finish DOMs, but is announced in chat when you finish the quest instead.

onQuestStart and onQuestFinish

onQuestStart is an optional function that is called when the quest is started. onQuestFinish is the same, but just called when the quest is finished.

This might contain code to begin a cutscene, area change, enemy spawn, etc.

Note that these are called by dom.js, so most (but not all) parts of Antorax code may be interacted with in this function.

onQuestStart: function() {
	Dom.chat.insert("Some additional chat.", 0);
	Game.enemies.push({
		// enemy to be spawned
	};
},
Clone this wiki locally