Managing Quests

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

We'll see 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 Ruby Host.

Once $quests.start(id) was called you need to tell the System to check started quests:

$quests.check_up_signal

This method checks the quest from start to finish. It also shows the quest name in the screen.

Quest informer
Starting a new quest

2nd step : Validate the Goal

There are various methods to validate goals:

  • $quests.beat_npc(quest_id, npc_name_index)wherequest_idis the quest id andnpc_name_indexis the index of the name of the NPC to beat in the goal order of Ruby Host
  • $quests.speak_to_npc(quest_id, npc_name_index)where the parameters are the same

The other objectives are automatically validated by PSDK.

2nd Step Continued : Showing a Hidden Goal

To show a hidden goal call:

$quests.show_goal(quest_id, goal_index)

The parameters are:

  • quest_idthe quest id.
  • goal_indexthe index of the goal in the goal order.

3rd Step: Check If the Quest Is Finished and Give the Reward

To finish a quest you have two things to do, check if all the goals are done & 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)

Check If the Rewards Were Distributed

To check if the rewards were distributed write this line in a condition:

$quests.earnings_got?(quest_id)

To distribute them use the following command:

$quests.get_earnings(quest_id)