This page is broken into two sections. The first, Overview , will explain the systems that make up the tavern and the general concept of how they function. The second, How-To , will give examples of how to make specific modifications to the systems.
Important Note:
Some parts of the Tavern and Patron implementation are planned to change in upcoming releases. This page will be updated as those changes come down the line, but be warned that some modifications to the system may require adjustment when these changes are released.
For what its worth, these future changes should make the system easier to alter and extend!
Taverns are meant to bring a sense of life to you settlement, serve as a place for introducing new story and gameplay, and provide feedback for actions the player has taken in the world. To this end, we want to have individual control what sort of Patrons frequent the Taverns of each particular Player or Clan separately. To provide this ability, each Clan (or clan-less player) has their own pool of potential Patrons in the form of a Patron Inventory . These inventories are filled with special game items called Patron Items which store the information required to spawn a single Patron: their Spawn Table entry, how long they stay, what Tavern they are currently visiting, and so on.
Tavern Bar actors query the Patron Inventory assigned to their owner when they want to spawn a new Patron NPC.
Patron Items are containers for storing Patron Data as well as managing the current State and location of the Patron.
There are 4 possible states for Patron Items. During 2 of these states ( Unavailable and Visiting ), the Decay Timer of the item is used to count down until they are automatically transitioned into the next state:
Unavailable : The Patron Item was either just added to the inventory or has just returned from visiting a Tavern. The decay timer will transition them to Available when it reaches 0.
Available : The Patron is ready to be spawned into a Tavern.
Visiting : The Patron is currently visiting a Tavern. The decay timer will automatically transition them to Leaving when it reaches 0.
Leaving : The Patron is still in a Tavern but it is time for them to leave. The Tavern will be notified when this state is reached so that it can de-spawn the NPC and call “Remove” on the Patron Item, returning it to Unavailable .
It is unadvised that you set the State of a Patron Item directly as it will not update other values that are automatically set when they change naturally.
Patrons can be set to one of 3 types which decide how and when they will be spawned, as well as how they behave while spawned:
Paid
Patrons of this type will never spawn automatically and must be Enlisted from the Barkeeper, such as the Mercenary Captain (Isscar).
Paid Patrons receive special treatment, kicking out other patrons if there isn’t room for them and allowing them to remain for their full duration if there is nowhere to sit.
Rescued
Rescued Patrons are patrons that can be Hired as Thralls by the player. They receive priority over incidental patrons when spawning.
The NpcTemplate for any Rescued Patron MUST be set up to Thrallable! If there is no thrall data for the NPC you use, it will spawn in a very broken state (if it spawns at all).
These patrons spawn a special NPC Class that makes itself look like the NPC Template you selected, so please note that anything special you add directly into their Class will not be present until they are converted into thralls.
Incidental
Basic patrons with the lowest priority.
Have no functionality outside of anything you might add directly into their NPC Class.
Patron Template Table Location: /Game/Items/PatronTable
The individual properties of Patron Items are typically established using a Patron Template entry in the PatronTable and get initialized when the Patron Item is created from that template. However, you are able to change the values at will after creation, allowing you to create new patrons dynamically without requiring additional Patron Templates .
Property |
Usage |
Notes |
---|---|---|
NpcTemplate |
The SpawnDataTable (or WeightedSpawnTable) entry to use when spawning into Taverns. |
To use the Weighted table you must set “UseWightedTable” to True. |
PatronType |
The Type of patron (see section above). |
|
PatronSpawnDelay |
The time before an Unavailable patron becomes Available . |
Entered as Min/Max. If the values are different, the actual time will be a random value between the two. |
PatronStayTime |
The time before a Visiting patron is set to Leaving . |
|
NPC |
When an NPC is spawned by the tavern while visiting , this keeps a reference to that pawn. |
The “RegisterNpc” and “ReleaseNpc” functions should be used to edit this value safely. |
ThrallItem |
When Rescued (thrallable) Patrons are spawned, a ThrallItem is made and stored here for use if they are converted. |
|
SmartObjectSlot |
The seat (or other Smart Object) assigned to the NPC when they are spawned. |
Patrons will attempt to find a new slot if this assignment is taken or destroyed. |
RecipeTableID |
Used to populate the transaction information in the barkeeper’s “Enlist Contacts” menu for Paid patrons. |
This is only relevant for the “Paid” Patron Type, you can leave this blank for Incidental/Rescued Patrons. |
ReturnToInventory |
True : The patron remains permanently in the inventory and will be reset to “Unavailable” after visiting. False : The patron visits one time only, the PatronItem is destroyed after visiting. |
|
SpawnWeight |
Currently unused. |
|
UseWeightedTable |
Whether the NpcTemplate provided should be found in the WeightedSpawnTable. By default the regular SpawnDataTable will be used. |
|
NpcUID |
This stores the UniqueID of the Npc Pawn when NPC is set. |
This value is ReadOnly . |
These functions are used by the Tavern Bar actor when managing its Patron population, but could be useful in other situations.
Function |
Usage |
Notes |
---|---|---|
AddToTavern |
Adds an Available patron to the specified Tavern and set the state to Visiting . |
|
DismissPatron |
Instantly completes the StayTimer of a Visiting patron and returns them to Unavailable . |
|
RegisterNPC |
Sets the Npc Pawn associated with a Visiting PatronItem and updates the NpcUID. |
|
ReleaseNPC |
Clears the Npc Pawn associated with a Visiting PatronItem. |
|
ReleaseAndDestroyNPC |
Currently unused. |
|
Remove |
Removes the Patron Item from the inventory. |
|
ConvertToThrall |
Currently unused. |
|
IsInTavern |
Returns True if the PatronItem is Visiting/Leaving the Tavern indicated. |
|
IsInAnyTavern |
Returns True if the PatronItem is Visiting/Leaving any Tavern. |
|
Patron Inventories are server-wide inventories which keep track of what Patrons are available to any given Player or Clan, using Patron Items . These Inventories and Items are extensions of the existing game inventories and game items, so any familiarity with those systems should carry over here.
Patron Inventories are managed by the ConanGameState and can therefore be accessed from any Blueprint in the game, allowing you to add new Patrons to a player’s Tavern in any creative way you desire.
The ConanGameState has two functions for spawning new Patron Items of a desired Patron Template directly into a Patron Inventory by providing a Player (as a ConanCharacter) or a GuildUID to find the proper inventory:
AddPatronToPatronInventoryFromTemplate
AddPatronToPatronInventoryFromTemplateUID
Warning!
Be careful when adding Patron Items to inventories in ways that repeat frequently, such as in a “BeginPlay” event. Patron Items and Inventories persist like any other inventory, it is easy to accidentally load up the inventory with a problematic number of the same Patron.
If you plan to use an event like this (perhaps for the sake of adding new Generic Patrons to the general population), it is wise to first loop through the Patron Items already in the Inventory and count to make sure you don't already have enough. For an example of this, look at the “Temp_AddThrallables” function in the BP_PL_TavernBar, which runs on BeginPlay.
If you have already made this mistake, you can use the ClearPatronInventory or ClearAllPatronInventories console commands to reset, or add a function to remove any Patrons found to be in excess.
To get a reference to a specific inventory, use the GetPatronInventory function on the ConanGameState object and provide the UniqueID of the Player or Clan:
You can get references to the contained Patron Items the same way you would with any other game inventory, by getting the inventory’s ItemList array. Items in the list will be GameItem references, so you’ll need to cast them to PatronItem to access their Patron-specific functionality:
While Patron Inventories do function like normal inventories, for now it is recommended that you call the provided “AddPatron” functions to add new Patron Items and call “Remove” on the item itself if you would like to remove them.
Adding them in other ways (such as constructing objects at runtime or adding children of the PatronItem class to the ItemTable and using “ AddItemByTemplate ”) should work in theory but are not officially supported yet so results may vary!
Base Actor : BP_PL_TavernBar (/Game/Systems/Tavern/BP_PL_TavernBar)
When first placed, and every several minutes thereafter, the Tavern Bar placeable will search within the distance set by the TavernRadius variable (Default 1500) for any Smart Objects with the “Placeable.Sit” gameplay tag and take note of the Total Capacity (number of seats) and Current Capacity (number of seats already in use).
The Total Capacity is used to manage a contribution of “Generic” Incidental Patrons that each Tavern Bar gives to the shared Patron Inventory. If the number of total seats changes, some of these generic Patron Items will be added or removed accordingly in the UpdateGenerics function.
If an NPC is active in the SOS_Barkeeper Smart Object Slot, the Tavern Bar will begin periodically performing an Update. If the Current Capacity is found to be significantly less than the Total Capacity, the Tavern Bar searches through it’s owner’s Patron Inventory for any Patron Items currently in the “Available” state. If one is found a dice is rolled against the Current Capacity; if it succeeds, the Patron is spawned and the update is completed.
The Tavern Bar listens to any reports from the Patron Inventory that a Patron Item has changed states. When it receives this Event, it checks for two things:
Is it a Paid Patron (Enlisted Barkeeper Contact) that has just been assigned to this Tavern?
If so, spawn the Paid Patron.
Is it a Patron currently visiting this Tavern that has reached its Leaving State?
If so, dismiss and despawn the NPC.
Barkeepers must be slotted into the Barkeeper Smart Object Slot on the BP_PL_TavernBar for Patrons to arrive. The Barkeepers in the current official release are special voiced characters that have dialogue, shops, and the ability to enlist contacts.
The Barkeeper slot is restricted to Thralls that have the actor tag “Barkeeper” (note: actor tag, not gameplay tag). Adding this tag to any other thrall’s NPC (or removing this Slot Condition from the slot) will allow you to slot in any Thrall, which is enough for Patrons to arrive.
You can even alter the “Restrict Follower Type” condition to allow Players as Barkeeper!
Please note however, any characters that aren’t set up for dialogue will not have Conversation options, Shops, or a Contact List.
NpcDialogues Table Location: /Game/Systems/Dialogue/NpcDialogues
RecipesTable Location: /Game/Items/Recipes/RecipesTable
Interacting with any Barkeeper, including your custom NPCs, works just like any Existing Dialogue NPCs in that any incoming player interaction is picked up by the NPC’s DialogueComponent and launches their assigned entry from the NpcDialogues table.
The Barkeeper dialogue, “Talk” responses, and Shop Inventory can be modified by altering their entries in the NpcDialogues table; “Barkeeper_M” for male and “Barkeeper_F” for female.
Items for sale are determined by the ShopItems array for each entry in the NpcDialogues table, here you can list any recipe from the RecipesTable and it will add a “Trade” option to the NPC’s dialogue tree and list all of the provided recipes as transactions.
Shopping transactions are simply crafting recipes that use gold as the ingredients!
The “Enlist Contacts” dialogue option appears for any Dialogue in which the NPC implements the “BPI_BarkeeperInterface” interface and returns true from the “GetIsAtBar” function of that interface.
The Contacts panel will automatically populate its list with any Patron Items of the “Paid” Patron Type found in the owner’s Patron Inventory.
Adding new Contacts to the list requires that you set up a new Patron Template in the PatronTable , set the type to Paid , and provide a Recipe from the RecipeTable to be referenced for the transaction details. The required ingredients of the Recipe will be used as the cost to Enlist the contact, and the recipe’s Name and Description will be used for the Contact’s name and description.
Command |
Usage |
---|---|
AddPatron [PatronTemplate] [ArriveDelay] |
Adds a Patron Item to your Patron Inventory, using the template provided but overriding the delay it would normally take for them to become Available . Example: “AddPatron Patron_Generic 5” |
ClearPatronInventory |
Clears all of the Patron Items out of your Patron Inventory (note that any existing Taverns will quickly restore any of their baseline supplies of patrons). Useful after you’ve accidentally added 200 of your new patron while testing and now the bar is full of clones. |
ClearAllPatronInventories |
Clears every Patron Inventory on the server. |
This section is for you if you want to:
Add/Remove NPCs from the list of patrons that the game randomly pulls from without requiring the player to meet/acquire the patron in some way.
Change the odds of rare/high-tier Patrons arriving
This section is not for you if you want to:
Add a new Patron (or group of patrons) that has a higher than 1/400 chance of appearing (without drastically altering the generic patron list)
Change the likelihood that any given Patron will be available to hire as a thrall
In the current release, all basic Patrons (thrall-able or not) are pulled from the same section in the WeightedSpawnTable, called “TavernPatrons”.
Weighted Spawn Table: WeightedSpawnTableRow (/Game/Systems/SpawnTable/WeightedSpawnTableRow)
Modifying the “weight” assigned to the Tiers will change their likelihood of spawning.
Adding new entries and setting their “WeightedTableID” to be the “NextWeightedTableID” of any of the Tiers will add them to the pool of possible spawns.
Removing any existing entries will (obviously) prevent them from ever showing up in your bar.
Adding a new Tier/Category with its own weight is also possible if you want to keep them separate or already have your own weighted group set up.
WARNING!
Any NPCs you add to this list which are not set up to be Thralls will fail to spawn (or maybe spawn broken) if they are selected to be spawned as Hireable patrons.
Failed spawns are cleaned-up and skipped by the tavern, so its not the end of the world.
Any non-follower Thralls you add to the list (cook, carpenter, etc.) should spawn if selected to be a Hireable patron, but they will unfortunately disappear completely if you hire them!
If you want to add new, special Patrons that are guaranteed to frequent your Tavern (rather than share a spawn chance with the 400+ “generic” patrons) you’ll want to give them a Patron Template and add them to the player’s Patron Inventory yourself, either by default (in the Tavern Bar actor) or by connecting it to some action in the world that the player can perform.
Creating a new NPC to use as a Patron is outside of the scope of this document, but relevant information can be found on these pages:
Open the PatronTable (/Game/Items/PatronTable) and add a new entry with a Row Name of your choice. The “NPC Template Name” should match your NPC’s row name in the SpawnDataTable. From there, fill out the remaining fields according to the settings you want your patron to have (descriptions of each setting can be found in the “Patron Items” subsection of Section 1: Overview).
Chances are high that you’ll want your Patron to be of the “Incidental” type. You can select “Rescued” if you want them to be hireable as thralls, but you’ll need to make sure they are set up to be thralls first or they will fail to spawn. “Paid” Patrons are the “Barkeeper’s Contacts” that only visit when you pay the Barkeeper; information on setting them up can be found in Section 1.
To have Taverns spawn your custom NPCs without requiring some sort of interaction, the simplest solution is to add them in the BP_PL_TavernBar actor using a function that checks if the Patron Inventory already contains the desired Patrons and adds them if it doesn’t. The TavernBar’s existing function called “ Temp_AddThrallables ” does exactly this if you would like to copy it directly.
Here is an example of what your function should look like:
Once you have the function created, you’ll just need to call it somewhere that will happen on the server and after the patron inventory has been loaded (any time except for within a few seconds after the server starts up). I recommend putting it right here, in the Event Graph of BP_PL_TavernBar, in the “InitializePatronInventory” event:
If you want the player to be able to meet an NPC in the world and then have them show up later as a Patron (or any other interaction-based reason for giving the player a Patron), you can call “ AddPatronToInventoryFromTemplate” at any time and from any Blueprint that is running on the server :
If you would like to add custom chairs to your Tavern, or have other things for your Patrons to do besides sit (perhaps spots for dancing, playing an instrument, or playing darts?), You’ll need to set them up as Smart Objects and then make sure they have the proper Gameplay Tags.
Creating new Smart Objects is outside of the scope of this guide but relevant information can be found in the Smart Object Documentation and by studying the examples (particularly the stools) in BP_PL_Tavern_Bar. Each Smart Object Slot Component in the Tavern Bar has the “SOS_” prefix, try selecting one and browsing the Details panel.
The Tavern and Patrons will currently search for the “Placeable.Sit” gameplay tag, adding this gameplay tag to anything you want Patrons to use is the easiest solution, though not strictly proper if its not actually a chair (any future non-patron NPC’s just looking for a place to sit might end up on your custom Smart Object).
If you take this approach, you can easily add the Tag by selecting the Smart Object Slot Component and adding the “Placeable.Sit” tag in the dropdown labeled “Slot Type.”
NOTE: If you cannot find the tag, don’t panic. There are actually 2 tag-groups for “Placeable”, Sit can be found in the second of those 2 groups.
If your new Smart Objects are not chairs and you would like to do things the proper way, you’ll need to make some modifications to the Tavern actor (BP_PL_TavernBar) and the Patron behavior tree (BT_TavernPatron) to add your tags to the searches they perform. Unfortunately, I wasn’t considering modders (sorry!) during the Tavern’s creation, so you’ll have to add your new tags in a handful of locations (I’m taking a note to reduce this to a single variable for next release!).
You’ll need to add Gameplay Tags matching your custom Smart Objects to the following search nodes:
File |
Location |
Reference Image |
---|---|---|
BP_PL_Tavern_Bar |
In the “ GetAvailableSmartObject ” function, attached to the “GetSmartObjectSlotsInRange” node. |
|
In the “ UpdateTavernCapacity ” function, attached to the “GetSmartObjectSlotsInRange” node. |
||
BT_TavernPatron |
Select the “ BTT_PatronFindSlot ” node and add your tags in the Details panel. |
In order for Patrons to begin arriving at your Tavern, the Barkeeper Smart Object Slot simply needs to be filled by anyone. The slot has 2 restrictions which can be removed completely by modifying the “Slot Conditions” on the component:
Character must be a Human Thrall
Character must have the actor tag “Barkeeper”
Modifying these conditions (or removing it entirely in the case of the Actor Tag condition) will allow your Tavern to use any Character, even Players! However, this will only allow Patrons to spawn, they will have no Dialogue, Shop, or Contacts List unless otherwise set up to do so .
Any custom NPC that you have set up as a Thrall will be able to take the Barkeeper slot (and begin Patron spawning) simply by adding “Barkeeper” to their Actor Tags, as shown in the image to the right.
Any NPC filling the slot will perform the barkeeper animations, and patrons will come, but interacting with them (or the bar-top) will result in whatever their default interaction is normally. They will not have dialogue/shops/contacts unless otherwise set up to do so.
If you would like your NPC to have the exact dialogue, shops, and contacts list as the official Zamorian Barkeepers, you just need to make sure the NPC Class has a Dialogue Component and that the component's “Dialogue Table Entry” field is set to either “Barkeeper_M” for male or “Barkeeper_F” for female.
If you want to have this functionality but with your own Dialogue and Shop items, you’ll need to open the “ NpcDialogues” table (/Game/Systems/Dialogue/NpcDialogues) and make a new entry for your barkeeper.
Assigning dialogue in this way will cause your NPC to offer these options at all times , not just when behind the bar. The Zamorian Barkeeper’s from Funcom implement an interface (BPI_BarkeeperInterface) to receive messages from the Smart Object which tell them when it is time to switch between Dialogue Table entries. If you want your NPC to switch dialogues while at the bar, you will need to either implement this interface in your NPC, or more easily, make your NPC a child or duplicate of BP_BaseNPC_Barkeeper_Thrall (/Game/Systems/Tavern/NPCs/BP_BaseNPC_Barkeeper_Thrall).
If you choose to make a child or duplicate of BP_BaseNPC_Barkeeper_Thrall , you can set the custom NpcDialogues Table entry that you want them to use in the Event Graph, under the UpdateDialogue event:
If you want to add or remove items from the existing Barkeeper shops, edit the ShopItems list for the “Barkeeper_M” and “Barkeeper_F” entries (or your custom entry) in the NpcDialogues table.
Add or remove RecipeIDs to the list that you have taken from the RecipesTable (/Game/Items/Recipes/RecipesTable). The required ingredients of the recipe will be the “Cost” of the transaction, and the recipe result will be the item for sale. Gold coins can be used for the cost, but so can any other item.
Seeing as the current Dialogue system in Exiles is very limited and not built for easy extension, this will be a difficult task that frankly goes outside of the scope of this document. I can, however, point you in the right direction.
Interacting with an NPC that has a DialogueComponent will open a conversation widget, W_NPCDialogue (/Game/UI/Dialogue/W_NPCDialogue). You will need to edit (or replace) this widget to add your custom options.
The most basic way of doing this is to add a new button (using the “Designer” panel) in the same container as the other buttons (I recommend copy-pasting one of the existing buttons and their children). You will want the button to be “collapsed” by default.
Next, in the Graph, you will want to set your button up in several places:
In the “ Initialize ” function, add a logical check that can be used to decide if your button should be un-hidden when the dialogue panel opens. This is the same conversation panel used by all NPC’s, so if you don’t do this, every NPC with dialogue will have your new button present.
In the “ SetupKeybindings ” function, you will need to add your button to the “Key Nav Link Widget Array”, in the same order your button appears in the list. This will allow proper navigation to the button using controllers.
Finally, in the Event Graph , you can add a “ SignalClicked (YourButton) ” event. This is where you will want to add whatever logic you desire to happen when the new option is clicked.