Schoeny Quest Engine
Schoeny Quest Engine is an engine which makes it easy for you to implement any sort of quest for your game in GameMaker:Studio 2. Quests can also include rewards.
– Easy to implement
– Completely script-based
4 types of quests you can implement:
– Item: Check whether a certain number of items have been collected
– Boolean: Checks whether a variable has been set to true
– Tracker: Check whether a certain number has been reached
– Parent: Add other quests to a parent quest
Each quest is given a unique ID number. Store this in a variable if you want to keep track of a certain quest.
Scripts to know
quest_setup() Initializes the quest engine.
quests_save([filename]) Saves all quests to a file. A custom filename is optional.
quests_load([filename]) Loads all quests from a file. A custom filename is optional.
quest_exists(questID) Checks whether a quest currently exists (and is not yet completed).
quest_is_completed(questID) Checks whether a quest has been completed.
quest_setup();You will also want an object that will run the following every step, or whenever most convenient.
Creating a quest
var quest_item = quest_add_item("Find Coconuts", items.COCONUT, 25, "Find 25 coconuts for the old lady.", -1); var quest_tracker = quest_add_item("Kill Some Skellies", 5, "Kill 5 skeletons.", -1); quest_add_boolean("Help Joey", "Help little Joey find his lost mouse.", -1, mainQuests.HELP_JOEY, -1, true);If you don’t want to give a reward for completing a quest, simply put -1 for that argument, as seen above.
Creating a parent quest
var parent = quest_add_parent(); var subquest1 = quest_add_boolean("Help Joey", "Help little Joey find his lost mouse.", -1, -1, parent); var subquest2 = quest_add_boolean("Guide Joey", "Help little Joey get back home before dark.", -1, -1, parent); quest_add_parent_add(subquest1, parent); quest_add_parent_add(subquest2, parent);
In order to implement rewards, a few steps must be taken:
- In quest_setup(), add any desired rewards types to the rewardTypes enum.
- In quest_reward_give(), add your code for how each reward type will be given.
Your custom rewards can now be used in quests!
Creating a reward
A reward is made up of 2 different variables: its type and its data.
The data variable could potentially hold anything, from an integer to an array, so long as quest_reward_give() is able to handle that data properly according to the reward type.
Below is an example of how to create a reward which increases the game score by 200 points.
var reward = quest_reward_create(rewardTypes.SCORE, 200);
Multiple rewards can be packed into one reward, so long as they follow the pattern of type, data, type, data as shown below:
var reward = quest_reward_create(rewardTypes.SCORE, 200, rewardTypes.ITEM, [item.POTION, 3], rewardTypes.ITEM, [item.TORCH, 1]);
And below is how you would add a created reward to a quest:
quest_add_boolean("Help Joey", "Help little Joey find his lost mouse.", reward, mainQuests.HELP_JOEY, -1, true);