Managing Quests

In PSDK you manage quests through $quests. All the methods are explained in the documentation : PFM::Quests.

Now let's show you how to use this variable!

1st Step : Start Quests

To start a quest, call $quests.start(id) where id is the id of the quest in Studio.

Once $quests.start(id) is called you need to tell the System to check for your started quests with:

$quests.check_up_signal

This method is used to check the quest from start to finish. It also shows the quest's name in a banner at the top of the screen.

Quest informer

2nd step : Validate the Goal

There are various methods used to validate goals:

The other objectives are automatically validated by PSDK.

To prevent any confusion, let's show a specific example of how to validate these goals. Each goal type has their own list, so in our example we have 2 goals for beating a trainer, 1 for beating a Pokémon and 1 to speak to a NPC. To validate these goals, it would look like this:

2nd Step Continued : Showing a Hidden Goal (Hidden until we add it back)

To show a hidden goal call:

$quests.show_goal(quest_id, goal_index)

The parameters are:

3rd Step: Check If the Quest Is Finished, Decide to Fail or Give the Reward

To finish a quest you have two things to do, check if all the goals are completed & distribute the reward.

Check If All the Goals Are Done

To check if all the goals are done, write the following line in a condition:

$quests.finished?(quest_id)

How to fail a quest

You can use $quests.finished?(quest_id) to decide whether a player should fail a quest, but realistically you can make a player fail a quest whenever you want by using the following line:

$quests.fail_quest(quest_id)

Check If the Rewards Were Distributed

To check if the rewards have already been distributed write this line in a condition:

$quests.earnings_got?(quest_id)

To distribute rewards use the following command:

$quests.get_earnings(quest_id)