The Connected Systems BPI is how our quest system can interact with external systems like inventory or experience systems. To use this BPI we add it to our player controller, as the player controller is a good player specific location that we have access to from both our player state, and our UI.
If you do not have a player controller in your project you will need to make one and make sure it is set in your game mode before continuing.
This video guide will walk you through integrating my inventory and experience systems into this quest system.
Follow these steps to install the Connected Systems BPI:
- Open your Player Controller (not your player character)
- Click Class Settings on the menu bar
- Under the Implemented Interfaces section click the Add button and select BPI_Quest_ConnectedSystems.
This will add a number of functions and events to the Interfaces section of your My Blueprint panel. These functions are how we will interact with our other systems.
The quest system will try to call these functions at various points in the progress using your player controller as the reference. For multiplayer these can be called from both the server and the client (for things related to UI and Indicators). Please keep in mind it is your responsibility to make sure whatever data you are depending on is being properly replicated to the client.
Here is a breakdown of the purpose and usage of each function included through this interface:
Get Item For Quest - When showing item information in the quest window either as a reward or for turn in we use the getItemForQuest function to get the needed data. In addition to the item information we also provide the player's current quantity of that item. This is used as a validation step when turning in items. Finally we also have to make sure we return isValidItem? to true when we are returning an item, so the quest system knows it can use it. The ItemRowName is defined by RowName in the reward in the data table. The CustomData variable is also passed through for your data table for this reward. You are also provided with the QuestRowName for the quest making the request. In the return it is expecting the player's current quantity, the item name, the item description (shown on hover), the Icon for the item, and optionally you can provide a Tooltip Widget that is shown instead of the default one using the item description. Keep in mind you should only create widgets if you are on a client. You can use the isLocalController function to verify you are safe to create the widget. If your item is found make sure to return isValidItem? as true.
Get Numeric for Quest - Like our getItemForQuest, the getNumericForQuest works the same way but returns just the name (or title) of our numeric type. Numerics are part of the quest rewards for rewarding things like Experience, Reputation, and Currency.
Give Quest Reward to Player - This function is used to give an item to the player, typically from a quest reward, but is also used to give items to the player using the related give item to player
Quest Event. Make sure to return true if your side gave the requested item or numeric to the player. This function will be called once for each reward given. The
ItemRowName and
Quantity are related to the item and amount to give.
ItemCustomData is the Reward's CustomData map, if for some reason you need to pass additional data about the item you want to give to your system you can use this. The
QuestRowName is the quest calling the event, and if
QuestObjectiveIndex is not -1 this means it is related to an objective, most likely giving an item when an objective is completed. The last variable is the
RewardType enumeration, which will tell you what type of reward it is. You can use this so you know what system to interact with when using multiple systems.
Remove Item for Quest Objective - This function is used to tell your inventory system to remove an item from the player, this is called when the player does a Turn In Item
quest objective. In addition to the item and quantity to remove it will also provide the quest row name and objective index when the quest system calls this function.
Is Quest Prerequisite Complete? - This function is called to check any External and Custom prerequisites. The
PrerequisiteType is the type of prerequisite that we need your side to check (hook a switch up to it). For the ones related to quests these are handled internally and you do not need to account for them from your end. Everything else is handled here using your other systems. You can use a switch on this variable to see what system you need to interact with for your key and value. The
PrerequisiteKey and
PrerequisiteValue come from the value we provided using our
Prerequisite Syntax. This function will be called for each prerequisite when multiple are used.
Get My Party - This function is used to return the player states of this player's party members (excluding the player who is doing the request). If you leave the Handled? boolean set to false the system will default to using the other connected players. If you have a party system this is where you would connect it and return the player states of the other members in the party.
Get My Name - This function is used to return the player's name. Currently this is only used when sharing quests, when reporting the status to the player performing the share. In the
demo world this uses the default player name variable from the player state. Lookup player naming in the unreal documentation if you need help with this.
Get My Unique ID - This function is used to return the player's unique identifier. The quest system will attempt to get the player id through this function if one is not provided during manual setup (if used). This ID is used to associate the player with their saved quests and current progress between sessions. You can learn a little bit more about this in the
multiplayer chapter's Player Identification section. It is your responsibility to provide a way to uniquely identify your players. If you do not the system will fall back to using the session driven method of identifying players based on the order they connected to the current game. Under most circumstances players will use a Steam ID to identify their players, this is the function you will want to integrate that value into.