jRPG Template

Documentation

Features

  • Characters Manager - create any amount of playable characters with custom stat set, equipment, and skills.
  • Party - define party formation and how many characters participate in a battle.
  • Level and XP - characters gain experience points after a battle and level up when they reach required XP amount.
  • List-based inventory - fully functional: add, discard and use items, also supports stacking and splitting.
  • Unlimited items creation - add as many items (including equipment) to your game.
  • Equipment system - determine what type of equipment each character can equip (eg. Sword, Axe, Staff, Heavy Armor, Robe, Ring) and what bonuses they provide (eg. health, mana, damage, initiative).
  • Save Manager - save, load and delete game saves (with an unlimited amount of games saves).
  • Save Point - special actor which will determine where a game can be saved.
  • Spawn and Teleport - special actor to easily connect playable levels and maintain player data after changing levels.
  • Battle Manager - handles initiative-based turn battles with implemented basic actions (Attack, Defend, Use Item, Flee).
  • Custom actions - extend the system by your custom actions (eg. Magic, Ability, Skill).
  • Targeting system - determine what targets each action requires (eg. single ally, all allies, single enemy).
  • Encounters system - create an unlimited amount of encountered enemies including their formation.
  • Full gamepad support - play using mouse, keyboard or gamepad.

Demo description

All demo levels can be found in the Demo/Maps folder, in total there is 6 of them:
  • main menu
  • 3 world/exploration maps
  • 2 battle maps.

Levels are really simple but the idea was to present the functionality. To start the game correctly you need to open Map_MainMenu and play from there. Only New Game option will be available, but once you save game, you will be able to load it later.

On World Maps enemies will encounter you (it will only happen when you move around). Each next World Map has stronger enemies. Each time the encounter will happen you will be moved to Battle Map and when the battle ends you will be moved back to the World Map.

World1 and World2 have Save Points placed in their levels. When you access Save Point you will be able to save your game, characters HP and MP will be restored as well. You can fight several times (or more) on the first WorldMap to level up your characters a few times and acquire some equipment then move to the next World Map.
Remember: if all your characters die during the battle you will need to start the new game or load previously saved game.

Each type of levels has its own game mode and player controller. In total there are 3 sets:
  • main menu (BP_jRPG_Controller_MainMenu and BP_jRPG_GM_MainMenu) 
  • world maps (BP_jRPG_Controller_World and BP_jRPG_GM_World)
  • battle maps (BP_jRPG_Controller_Battle and  BP_jRPG_GM_Battle).
Player controller blueprints are responsible for proper level initialization and actions handling.

Additionally, there is one game instance (BP_jRPG_GI_Custom) to maintain data consistency between all levels.

Gamepad controls can be turned on in AC_jRPG_GamepadControls - variable GamepadControlsEnabled.

Creating new characters

All characters inherit from the single base blueprint, it is BP_jRPG_Character_Base and it can be found it Blueprints/Basics folder. Most of the changes you implement to this blueprint will affect all created characters. Desired functions or events can be overridden in each created character blueprint (child) separately.

In addition to default character components, there are:
  • one billboard (TargetPointer) responsible for showing targets during the battle,
  • one actor component (AC_jRPG_CharacterStats) responsible for maintaining character stats during the battle.

To create a new character head to Blueprints/Basics folder, right-click BP_jRPG_Character_Base and select Create Child Blueprint Class option. Name newly created blueprint and open it.

Assign desired skeletal mesh, animation blueprint and add other stuff you want. Click on AC_jRPG_CharacterStats component and on Details tab under Setup category you will find two variables:
  • CharacterHardcodedName - this name is used for game logic purposes, it must be unique, otherwise, the character won't be identified by game systems.
  • CharacterDisplayName -  this name will be displayed to a player in different interface widgets, doesn't have any impact on game logic.

Now head to Datatables folder and open DT_jRPG_Characters add new and edit your character data:
  • CharacterHardcodedName - used for game logic.
  • CharacterDisplayName - will be displayed to the player.
  • CurrentLevel -  character default/starting level.
  • CurrentExperience - character default/starting XP.
  • AvailableActionPoints - character default/starting number of Action Points, used to level up certain actions (skills).
  • CharacterActorClass - corresponding character blueprint.
  • CharacterIcon - image used as a portrait in widgets.
  • CurrentHP - character default/starting current HP amount.
  • CurrentMP - character default/starting current MP amount.
  • CharacterStats - character default/starting stats.
  • StatsPerLevel - stats bonus character will gain upon leveling up.
  • CharacterEquipment - character default/starting equipment, if you want the character to start with desired equipment just enter its ItemHardcodedName and the system will automatically read its whole data from the data table. More about equipment in Items section.
  • AllowedEquipmentSubtypes - defines what type of equipment character can equip (ie. sword, axe, robe).
  • CharacterAction - default set of actions (and their levels) that character starts with.
  • ActionsPerLevel - determines what actions will be learned upon reaching a certain level.

Important: RowName and CharacterHardcodedName must be exactly the same as the one you entered in AC_jRPG_CharacterStats component.

If you want to add custom data to the character row, you can do it by adding a variable to S_jRPG_Character structure.


If you want to create new stat (or edit existing) for characters, you can do it by adding a new enum row to E_jRPG_StatType. Then open FL_jRPG_CustomFunctions blueprint and in StatTypeToText function enter the display name for newly created stat.
Lastly, you will need to update widgets where do you want the stat to be displayed (like Character Overview Slot, Character Selection Screen). Of course, not all stats have to be visible to the player.


Of course, you can also make character available by default so a player won't need to unlock it. To see how to make character available from the start check Save System>New Game section.

Adding character to player collection


To add (unlock) character to collection (pool of characters that player has and they are playable) access AC_jRPG_CharactersManager and call AddNewCharacterToCollection function. This function requires CharacterStruct as input, you can make it manually or get it from DT_jRPG_Characters data table.

Amount of characters that a player can have in his collection is limited. It can be adjusted in AC_jRPG_CharactersManager blueprint. Open it and under Setup category find a variable named MaxCharactersAmountInCollection. Player won't "receive" new characters if his collection is full.

Party system

Party system determines which characters will participate in battles. It also defines characters formation (frontline and backline). Amount of party members is limited and can be adjusted in AC_jRPG_CharactersManager blueprint (Setup category - variable MaxCharactersAmountInParty).

Characters can be added to or removed from the party using two functions AddCharacterToParty and RemoveCharacterFromParty. Both require CharacterHardcodedName as input. If there is only one character in the party it won't be removed.

To change character position in the formation use ChangeCharacterFormation function. It will automatically change desired character position from Frontline to Backline or vice versa.
Important: Use this function to change formation outside the battle only.

Leveling and XP

After battle characters will receive Experience Points (XP). When they have enough XP they will level up. Each level up will increase character stats (respectively to the bonuses set in DT_jRPG_Characters).

How much XP characters need to level up can be adjusted in DT_jRPG_Levels data table. Also characters max level is limited. Similar to others limits it can be adjusted in AC_jRPG_CharactersManager blueprint (Setup category - variable CharacterMaxLevel).

Experience points mainly gained by defeating enemies, but it can be also received outside the battle (ie. quest or item). Responsible for that is AddExperienceToCharacter function. You can select a character (by entering Character Hardcoded Name) and the amount of granted XP.


New item types, subtypes, and rarities can be added to their corresponding enums located in Enumerations folder: E_jRPG_ItemType, E_jRPG_ItemSubtype, E_jRPG_ItemRarity. Additionally, you will need to their conversion functions in FL_jRPG_CustomFunctions blueprint.

If you want you can also add new variables to items, it can be done in S_jRPG_ItemStaticData structure.

Creating new items


New items can be created in DT_jRPG_Items data table located in Datatables folder, they have some variables to set up.
  • ItemHardcodedName - used for game logic purposes.
  • ItemDisplayName - will be displayed to a player in widgets.
  • ItemType - a group of items this item belongs to.
  • ItemSubtype - more detailed subgroup of items this item belongs to.
  • ItemRarity  - defines item rarity/quality.
  • CanBeUsedInBattle - determines if an item can be used in battle (precisely - only apply it to items like potions, so it can be used to get a certain effect in battle).
  • CanBeUsedInInventory - determines if an item can be used through inventory screen (again, precisely - only apply this to items you want to use in inventory to get a certain effect, potions will heal, some kind of teleport will let you change map etc.).
  • MaxStackAmount - how many items of this kind player can have in a single stack, ie. potions will stack up to 10, but weapons will stack only up to 1 (basically they won't stack).
  • BuyValue - how much item costs at a vendor.
  • SellValue - how much gold we get for an item when it is sold at a vendor (set it to 0 if you want to make item unsaleable).
  • ItemDescription - adds a description of an item, which will be shown to a player.
  • ItemStats - mainly used with equipment, determines what bonuses character will get when equips an item.
  • ItemIcon - image that will be shown to a player in various widgets.

Important: RowName and ItemHardcodedName must be exactly the same.

Inventory


Items in inventory are displayed in a form of a list. When the list is too long it will become scrollable, so it gives us a possibility to store an infinite amount of items (theoretically). Although the amount of space in inventory can be limited to the certain number. It can be adjusted in AC_jRPG_InventoryManager blueprint (Setup category - variable InventorySlotsAmount). If InventorySlotsAmount is set to 0 inventory will be infinite.

Items can be stacked, however, you need to define if they can be stacked across multiple stacks or only in a single stack. It can be adjusted in AC_jRPG_InventoryManager blueprint (Setup category - variable MultipleStacksAllowed).
If multiples stacks are allowed and item reaches the maximum amount of pieces in a single stack it will create a new one. If multiple stacks aren't allowed item won't be added once there is already a full stack of it in inventory.

Items can be added to or removed from inventory using two functions: AddItemToInventory and RemoveItemFromInventory. Just enter item hardcoded name and amount you want to add or remove. If a player has multiple stacks of an item, first, it will remove items from the stack with the lowest amount of pieces.

Using items from inventory

Items can be used from the inventory screen and their effect will be executed. Some of them have to be used on characters, some of them work independently, others will require YesOrNo window to pop up. Each game will contain specific items, so it is impossible to add all effects to blueprints. However, there are functions that will make implementing item effects easier.

First function - SelectItemToUse - will execute initial effect of the item. IE. Select character to use an item on or show YesOrNo window with a question and let the player decide. Inside this function, you set up your own logic for EACH item you create and only if it is usable from inventory. It means you don't need to set up effect logic for equipment because it cannot really "be used".

It doesn't require any input (like a name of the item we are going to use), because it is strictly bound to the index of Selected Inventory Slot. If we clicked on the 5th item and then wanted to use it, the system will read data of the 5th item in the inventory and then request to use it.

There are four examples (potions) to give you an overall idea of how it works. Generally, when you request to use Potion it will bring another window up and let you select a character. You may reuse this window for your items that require character selection.


Second function - UseItemOnCharacter - this will execute the right effect on selected character. Eg. Restore character HP or MP, revive, clear poison or other status etc. This function requires 2 inputs: name of the item we want to use and a name of the character to use the item on. Thanks to this we may use this function outside the inventory screen as well.
Inside this function, you set up your own logic for EACH item that can be used from inventory and requires to select a character.


There are two recovery functions prepared in AC_jRPG_CharactersManager to help with further development: RestoreHP and  RestoreMP. They will respectively recover selected character HP or MP. Recovery amount is adjustable, so these functions can be used for all kind of healing potions.

Equipment

Certain items can be equipped to characters. A character will be able to equip items only if its AllowedItems list contains Subtype of the item. Eg. Character's AllowedItems list contains Sword, Axe, Dagger, HeavyArmor, Ring. So only weapons of Sword, Axe or Dagger type will be equipable (and shown) to the character. Same with armors of HeavyArmor type and accessories of Ring type.

Reminder: AllowedItems can be set in DT_jRPG_Characters data table separately for each character.

If equipment has any stats assigned they will be added to character stats upon equipping or removed from characters stats upon unequipping.

There are two functions responsible for equipping and unequipping items:
  • EquipItem - as input it requires item name, it will automatically search for it in inventory and equip to a character. It doesn't require character name as input, because Equipment System is always executing functions on a currently selected character (and for example character can be selected through Character Selection Screen in World Interface)
  • UnequipItem - this one requires to define what item type we are going to unequip (ie. weapon, armor, gloves, accessory). As above it doesn't require a character name as input.

Currency

The template provides gold as a default currency. You can add or remove gold using two functions: ReceiveGold and SpendGold. All you need to do is enter the desired amount. Generally, if you want to add another currency to the game, you can create a new variable in the game instance and redo these functions using new currency.

New game

Function StartNewGame, responsible for starting a new game, is in AC_jRPG_SaveManager. It will reset all stored player variables to default ones (such as characters collection, inventory, time played, currency etc.).

Inside this function, under LocalVariables, you can set up all starting stuff for your game:
  • DefaultCharacters - all characters hardcoded names you want to give a player at the beginning.
  • DefaultParty - here you set up starting party. Remember: you can use only these characters which are available as DefaultCharacters, also at least one character has to form a party.
  • DefaultGoldAmount - determines starting gold amount.
  • DefaultAreaName - how starting area is named, it is purely cosmetic as it is just displayed to a player in World Interface (ie. if a player starts in some kind of village you may set it to village name).
  • DefaultItems - here you set up player starting items (probably some potions or something).

Save, overwrite, load and delete game saves

There are a couple of functions to help you maintain game progress:
  • SaveGameToFile - this function is used to create a new game save or overwrite existing one. If OverwriteSaveName input will be left empty it will create a new game save otherwise it will overwrite the existing one.
  • LoadGameFromFile - this function will load data from the game save. It will also automatically load the corresponding level.
  • DeleteSaveFile - deletes the game save with given name.

Save point

Saving during the game is not available by default. If a player wants to save a game he needs to find special Save Point object, interacting with it will enable (and open) save interface. It will also restore all characters HP and MP.

Save points can be placed in various areas across the whole world - wherever you want. To do it just place BP_jRPG_SavePoint actor in your level. Visually wise it is really simple and you can definitely change it to suit your game. Once you place it, click on it and navigate to its Details tab, under Default category you will find SaveSpawnName variable. Enter the name of desired MapSpawnPoint - here player will start when he loads a game.


But to respawn player at given MapSpawnPoint you need to add one to the level. Place BP_jRPG_MapSpawnPoint in your level next to the SavePoint. Then access its Details and find SpawnPointName variable, enter the same name which you entered in the SavePoint. This way SavePoint will tell the system to spawn player exactly at this MapSpawnPoint when he loads a game.

Both BP_jRPG_SavePoint and BP_jRPG_MapSpawnPoint blueprints can be found in Blueprints/Other folder.

Time played and area name

Time played is stored in the game instance,  but actual time tracking is performed by AC_jRPG_SaveManager. Time is counted OnTick event, but to save every bit of performance widget responsible for displaying time played is updated only when World Interface widget is opened.

AreaName is the name of the space where the player currently is. It can describe the whole level, ie. Magic Village, but the level can be also divided into smaller pieces, ie. Magic Village - East Gate, Magic Village - Underground etc.
AreaName doesn't really have an impact on a game and is used mainly for orientation purposes as it is only displayed in the World Interface widget and Save Slots.

AreaName can be changed using ChangeAreaName function, it will immediately affect widgets and will be stored in the game instance. This function can be used when a player is changing World Maps, entering specific buildings etc.

Yes/No decision window

In addition to all these minor functions, AC_jRPG_SaveManager is also responsible for displaying so-called Yes/No pop-up window widget. It requires 2 inputs:
  • TextToShow - it is the text that will be displayed to a player.
  • DecisionToMake - an enum that is responsible for handling game logic.

Just call ShowYesNoWindow function and window will pop up waiting for a player decision. The logic for handling answers to the questions contains in WBP_jRPG_YesNoWindow widget. Functionality is in a separate blueprint because there can be dozens of questions and there is no point to pack them all into Save Manager. It also makes maintaining easier when answers logic is in a single separate blueprint.

New question types can be created in E_jRPG_YesNoQuestions enum. There are few questions already added, mainly for handling save/load functionality.

Creating new enemy

Creating an enemy is a similar process to creating a playable character. In Blueprints/Basics folder you will find BP_jRPG_Enemy_Base blueprint. It inherits from BP_jRPG_Character_Base (as playable other characters do). There is specific logic common to all enemies, that's why another child blueprint is created. All future enemies should inherit from BP_jRPG_Enemy_Base blueprint or its children blueprints.

Once you create and name a new enemy blueprint, open it and head to its AC_jRPG_CharacterStats. Enter its CharacterHardcodedName and CharacterDisplayName, they can be found in the Details tab, under Setup category. To create new enemy data open DT_jRPG_Enemies data table and add a new row:
  • EnemyHardcodedName - used for game logic.
  • EnemyDisplayName - will be displayed to the player (ie. during battle).
  • Level -  enemy level.
  • ExperienceReward - how much XP characters will gain for defeating this enemy.
  • GoldReward - how much gold player will receive for defeating this enemy.
  • EnemyActorClass - corresponding enemy blueprint.
  • EnemyStats - enemy default stats.
  • PossibleLoot - all items that a player has a chance to loot when the enemy is defeated.

Important: RowName and EnemyHardcodedName must be exactly the same as previously entered CharacterHardcodedName in enemy blueprint's AC_jRPG_CharacterStats component.

Loot system goes in pairs (loot chance<>item  hardcoded name), while 0 = 0% and 1 = 100%. This system is easy to maintain, but also is a bit hacky, since it uses map container, there should be no items with the same loot chance.
So what to do if you want to have 2 or more items guaranteed? Simple, set first item chance to 1 and next one to 1.001 and so on.

Encounters

Encounters are needed to plan what enemies can be encountered on certain maps/areas. They are also responsible for formation in which enemies start the battle. To create new encounter open DT_jRPG_Encounters data table and add a new row and name it.  I suggest to keep naming fairly consistent, so you will be able to access and change encounters data easily.

New enemies are added to encounters in following format: BattlePositionIndex <> EnemyHardcodedName. More about battle positions in the Battle Maps section.


Whenever you change map or area you will want to change enemies that can be encountered. Encounters data is stored in the game instance, so it can be accessed and changed anytime. Adding more than one encounter name to PossibleEncounters array will result in random selecting one of the encounters. In addition to random encounters, you can also set up a random Battle Map on which battle will happen. You can add several level names as well.

A battle can be started by calling EncounterEnemies function. It requires 2 inputs: EncounterName and BattleMapName. Both can be randomly chosen from the game instance. However, in certain situations, you will want to fight specific enemies on the specific battle map (ie. for boss battle). You can do it by calling this same function and manually entering names for Encounter and BattleMap.


Initial encounter rate for random battles can be adjusted in RollEncounter event in BP_jRPG_Controller_World. Either change delay time or value added to RandomEncounterChance when it fails to roll encounter (default value 0,01).

Battle maps

When you finally create few fancy battle maps you will need to add some additional actors to make them work. Two most important are BP_jRPG_CharacterBattleSpot  and BP_jRPG_EnemyBattleSpot. They indicate where player characters and enemies will spawn when a battle starts.

When CharacterBattleSpot is placed in the level, two green capsules will be spawned, each with text and arrow attached. Frontline or backline capsule will be selected according to character formation in a party. Arrow indicates the direction character will face when spawned. Capsules can be transformed separately, so you can freely adjust them on all Battle Maps.
The number at the end of the texts indicates which character from the party will be spawned at BattleSpot. 0 means the first character from the party will be assigned to this spot, 1 references to second character and so on. BattleSpot index can be changed in its details.

Important: Remember to add as many Character BattleSpots to the map as party members. So you won't run into the situation when there are 4 party members and only 3 battle spots.

EnemyBattleSpots work similar to the character ones. However, frontline and backline indicators are placed separately. It gives you better control over the battle map set up. You can have 8 Enemy Battle Spots placed in a level, but actually use only 3 and they don't need to be selected in ascending order (you may spawn 1 enemy in frontline and 2 enemies in backline).

When you access its details you will be able to set up SlotIndex and Formation. It means that an enemy spawned at BattleSpot 1 will be considered as standing in the backline. How to control spawning enemies at selected spots? In Encounters section you were shown how to create custom encounters. Each enemy has a number assigned - this number is equal to the SlotIndex in Enemy Battle Spot.

Important: Remember to change map default game mode to BP_jRPG_GM_Battle.


EXAMPLE
Two Mutants will be spawned at Spots 2 and 3 and two Horned Mutants will be spawned at Spots 5 and 6. Even if Spots 0, 1 and 4 exist they won't be used. It helps to create various encounters.

Dynamic battle camera

To add a dynamic camera to a battle map you will need to place a few BP_jRPG_DynamicCameraPath blueprints in the level (it is located in Blueprints/Other/World folder).

Camera Paths have variables exposed to the editor, tweak them to get desired results.
GENERAL:
  • PathID - unique name used by the system to distinguish paths.
  • PathType - style of the path.
  • CameraFocusPoint - the location of the point that the camera will face during movement. Can also be set directly in viewport by dragging its 3D widget.
  • PathInitialRotation - used to control spline rotation.
LOOP TYPE (exclusive):
  • LoopRadius - determines the size of the loop path.
  • LoopClosed - determines if the path should be closed so the camera can smoothly repeat its movement.
SPIRAL TYPE (exclusive):
  • SpiralRadius - determines the size of the spiral path.
  • SpiralLength - how many loops spiral should take.
  • SpiralOffset - the distance between each spiral loop.
PREVIEW:
  • PreviewTime - used to preview movement of the camera at along path (0 - start, 1- end of the path).

Using Manual Path Type you can manually set up spline to create custom paths for the camera.

Default dynamic camera set up requires 4 camera path blueprints to be placed in the battle level.
  • A general path that will be used to show battlefield while characters are waiting for their turns or when an enemy is performing its action. PathID: Overview
  • The path used to show a player character that is taking a turn. While there are many characters, one path is enough because the system will update its location depending on the character turn.  PathID: Ally_General
  • The path that will be used during targeting enemies (ie. to select skill target), generally with limited movement or completely static - so a player can clearly see all of them. PathID: Targeting_Enemy
  • The path that will be used during targeting player characters (ie. to select healing potion target), also with limited movement or completely static - so a player can clearly see all his characters. PathID: Targeting_Ally

Of course, you can add more paths if you want to make it even more dynamic, it is up to you (ie. add two more overview paths to show battlefield from different angle and position). To switch between different camera paths on runtime call SetNewDynamicPath function from DynamicCameraManager component. The function itself has several input variables:
  • PathID - ID of the path we want to switch to.
  • RandomStartDistance - if checked it will pick a random point along the camera path and start there.
  • Loop - determines if the camera should start its movement from the beginning of the path when it reaches its end. If Loop is not checked camera will simply stop at the end of the path, until it is changed.
  • UpdatePathLocation - check this if you want to set a new location to a chosen path. Useful if you have a single path shared among several characters. Thanks to this you don't need to create separate camera path for each character, just change its location to match character location.
  • NewLocation - the location that will be set to the path if UpdatePathLocation is checked.

The speed of the camera movement can be set in AC_jRPG_DynamicCameraManager (Speed variable, default = 20). You can also change it on runtime if you need to control camera movement speed during the battle (ie. different camera need different speed).

Initiative and characters turns

Characters turns are based on initiative. It means each character has to reach a certain amount of initiative (1000 by default) to take a turn. How fast character reaches that point depends on its own initiative stat (a character with 20 initiative will take its turn faster than a character with 10 initiative - precisely two times faster). Amount of initiative needed to take a turn can be adjusted inside AC_jRPG_BattleManager (under Setup category - variable InitiativeNeededToTakeTurn).

Enemies will take their turn automatically. Attacks and actions are created for each enemy separately. So they can be unique and use different abilities with a different chance. To set up turn action for enemy open its EnemyBlueprint and override function called PerformActionByAI.

You can see examples of enemy actions inside existing demo enemies blueprints. When a player character reaches the required initiative amount, a player will need to decide what character should do.

The battle ends when all enemies are killed. BattleEnd screen will show up with information about gained XP, gold and received items. When all player characters die it will be game over.


You can manage character actions on runtime using four special function: LearnNewAction, ForgetAction, UpgradeAction and  DegradeAction.

Creating and handling actions

To create new action you will need to do some steps.

Initial setup.
  1. Open E_jRPG_ActionType and create new enum row that will be related to new action group (even if that group will contain only one action like attack, defend, use item etc.).
  2. Open FL_jRPG_CustomFunctionLibrary and find ActionTypeToText. In the field next to your new action enter the name of the action that will be displayed to players.
  3. Open WBP_jRPG_ActionsWidget and add new WBP_jRPGActionSlot to Container_Actions.
  4. Assign new action to it and adjust its position in grid panel (you can rearrange all slots if you want).
  5. Move to the Graph section and find PreConstruct event.  To the array of ActionSlots widgets add the one you have just added to container.

Adding action to the database.
  1. Open DT_jRPG_Actions data table and add a new enum row. Important: Row name and HardcodedName must be exactly the same.
  2. Set up action data:
    • ActionType - group to which new action belongs to.
    • IsSecondaryAction - determines if action is a single type and doesn't contain any subactions and submenus (like attack or defend) or is a secondary type and requires a second choice (like items, skills, magic etc.).
    • HardcodedName - used for game logic purposes.
    • DisplayName - name of the action displayed to players.
    • Description - description displayed to players.
    • MaxLevel - level to which action can be upgraded.
    • BaseCostMP - how much MP it costs to use action.
    • BaseCostHP - how much HP it costs to use the action.
    • PerLevelCostMP - additional MP cost that will be added to base cost per each action level.
    • PerLevelCostHP - additional HP cost that will be added to base cost per each action level.

Attaching action to the system.
  1. Open AC_jRPG_BattleManager and find SelectAction function.
  2. Navigate to SwitchOnEnum(E_jRPG_ActionType) node and connect its pin to IsValid node (as other basic actions). Important: if you created type of actions that require second choice (like items or magic) instead of connecting it to IsValid node you will need to set up your own logic to get available actions of that type. Check existing items and magic functionality to set up your own. They will be probably pretty similar to the one you want to create.
  3. Open BP_jRPG_CharacterBase and navigate to ActionsGraph.
  4. Create a new event that will be responsible for executing the action (this event will be overridden by each character separately later, so they all can act differently using the same action (eg. play different animations).
  5. Find ExecuteAction event (which also is in ActionsGraph) and call newly created event from the pin assigned to your action.

Implementing action functionality.
  1. Open AC_jRPG_ActionsManager and create two new functions.
  2. First one will determine what happens when action is selected (eg. ask to select target, execute effect immediately or pop out warning window). Name is up to you but for consistency reasons you want to keep naming convention I have used (Select_ActionName).
  3. The second function will activate the actual effect of the action (eg. deal damage to a selected target, restore health).
  4. These two new functions need to be connected to corresponding events. Select function should be connected to its proper pin in SelectAction event (SwitchOnEnum node) and Activate function should be connected to its proper pin in ActivateActionEffect event (SwitchOnEnum node).
  5. Now you can implement the functionality of these two functions, you are free to add there whatever you want. However, you can base on already existing functions and copy what you need (eg. displaying the battle tooltip, enable targeting etc.)

Preparing the animation montage.
  1. To execute action effect in certain time of animation and then resume battle you will need two Anim Notifies.
  2. Open your anim montage and create two Notifies: ActionEffect and FinishAction (names are up to you, these are default ones that are included in demo character). They need to be created only once per Animation Blueprint.
  3. ActionEffect will execute action functionality (the one that you implemented in functions described above) so add it to Notifies timeline in the place when it exactly should occur.
  4. FinishAction will resume battle so add it somewhere need the end of the animation. Important: Do not add this notify if animation montage is going to be used in conjuctio
  5. If you have custom Animation Blueprint you will need to implement functionality to these Notifies as well. Luckily, you can copy that functionality from demo character animation blueprint (AB_GenChar) and paste it to yours.

Combat Movement


MoveToCharacter(BuiltIn) and MoveToInitialLocation(BuiltIn) - these two macros will move character using built-in AI, navigation and pathfinding. When moving to target there are several parameters to tweak:
  • SpecificAngle - if this is checked character will attempt to arrive at a specific angle next to the enemy.
  • Angle - works only if the SpecificAngle option is active. 0 means in front and 180(or -180) behind the enemy. 90 is the right side of the target and -90 is the left side of the target.
  • Distance - the additional distance between moving character and its target. By default, a character will move to the distance equal to the radius of its CapsuleComponent + the radius of its target's CapsuleComponent (so they don't bump into each other). Use this parameter to tweak the distance further, so ranged characters can move a little bit and attack from the distance.

MoveToCharacter(Interpolate) and MoveToInitialLocation(Interpolate) - these two macros have the same goal as these above, move to target and go back. Although, instead of using the built-in navigation they play animation montage and interpolate between two locations. In addition, they have one more parameter:
  • AnimMontage - this montage will be played during the movement.

Since this type of movement uses animation it is important to properly define Movement curve in the animation montage (so movement starts and ends in the desired time). To determine movement this curve will need two points, one when a character takes off the ground (at this point it value should equal 0) and second when it lands (and at this point value should be equal 1). Check the video below to see how to set up the Movement curve in an animation montage.

RotateToCharacter and RotateToInitialRotation - these two macros helps you handle character rotation especially when character reach destination and doesn't face the direction it should.

Combat Movement feature can be used to enhance various actions like attacks or skills. There are a few macros that can be used in both enemies and player characters.


There are a few important things worth double-checking, especially if you are migrating it to the existing project (you just need to copy-paste ML_jRPG_CombatMovement and AC_jRPG_CombatMovement to corresponding folders in your project).
  • Make sure BP_jRPG_Character_Battle_Base has AC_jRPG_CombatMovement attached.
  • In BP_jRPG_Character_Battle_Base Defaults  change AutoPossessAI to PlacedInWorldOrSpawned.
  • In BP_jRPG_Character_Battle_Base MovementComponent enable OrientRotationToMovement option.
  • Make sure you have NavMeshBoundsVolume in your battle level.
  • If you use animation montage in conjunction with combat movement then it is important to remove FinishAction notify from that animation montage (the battle should be resumed manually when character returns to its initial location).

Targeting system

Many actions (or secondary actions) will require from player to select target(s). There is a special system that will handle targeting with several specific options.

A player will be able to select targets depending on currently set TargetingType. To start targeting call EnableTargeting function. Select TargetingType and determine if a character can target self or not.
Note: of course if you select SingleEnemy targeting type you won't be able to target self regardless if the option is checked or not. It was created for certain abilities like TransferHP, when player needs to select to sacrifice HP of one character to heal other. There would really be no point in sacrificing character's HP to recover it back.

Available targeting types:
  • OnlySelf - character can use action only on self (CanTargetSelf option is disregarded in this case).
  • SingleEnemy - action will be used on one selected enemy.
  • SingleAlly - action will be used on one selected ally (character using the action can be included or excluded).
  • SingleEnemiesRow - action will be used on all enemies in selected formation (ie. if a player selects enemy which is in the frontline, then all frontline enemies will be targeted).
  • SingleAlliesRow - action will be used on all allies in selected formation (as above and character using the action can be included or excluded).
  • AllEnemies - action will be used on all enemies.
  • AllAllies - action will be used on all allies (character using the action can be included or excluded).

Targeted characters or enemies are indicated by showing TargetPointer, which is a simple billboard (by default its big white arrow).  When a player clicks on the targeted enemy while targeting is enabled it will execute the selected action (ie. player selected Attack action and clicked on target, then it will execute Attack action).
The specific logic for each executed action can be set up in AC_jRPG_BattleManager inside PerformAction function.

When an action is executed or canceled targeting should be stopped as well. To disable targeting option call DisableTargeting function.

Custom world maps

Create level as you would normally do. You will only need to add a few BP_jRPG_MapTeleportPoint and BP_jRPG_MapSpawnPoint. They are responsible for teleporting a player to a proper map and spawning at right spot.

When you place BP_jRPG_MapTeleportPoint in the level, access its Details to set it up:
  • DestinationMap - what map player will be teleported to when he enters into teleport point.
  • DestinationSpawnPoint - a name of the SpawnPoint where a player will be spawned, when the map loads.
  • DestinationAreaName - a name of the area where a player will be when the map loads (as previously mentioned, AreaName is only for orientation purposes and is displayed to a player in World Interface widget).

When you place BP_jRPG_MapSpawnPoint, in the level access its Details to set up its name.
Important: all MapSpawnPoints inside the same level must have unique names.

Many of the world maps will allow traveling back and forth, usually, it will require BP_jRPG_MapTeleportPoint and BP_jRPG_MapSpawnPoint place next to each other. Important thing is to remember that they cannot be placed to close to each other, otherwise, the player could teleport back just after he spawned on the new map. Give them some space so the player won't enter into teleport point accidentally as well.

World interactable objects

All interactable object should inherit from BP_jRPG_InteractableObject_Base blueprint. It is not necessary to use this blueprint but it has basic functionality set up. Optionally, you can use any actor blueprint, add BPI_Interaction interface and implement functionality to its events. Objects interaction states are automatically stored in the game instance and saved to the file when the player saves the game (as other player data is).

You can also change the default behavior of all interactable objects in that blueprint (eg. widget info, exclamation mark).

When you create new child blueprint you will need implement functionality specific to the object. Use two interface events:
  • OnObjectInteractionStateLoaded - it returns objects InteractionState boolean value. On example of a door, if the loaded state is false it means the door is closed and true means open. Using this you can set proper mesh, animation, material and whatever you need when the object is loaded. Default interaction state is always false, keep that in mind planning you gameplay features.
  • OnInteractionRequested - it handles what happens when a player interacts with an object (close/open door, loot chest etc.). Use this to change mesh, play animation or sound or perform complex events. You can check example events in demo objects: Chest and Door.

When you place an interactable object in the world map access its details to edit its basic interaction variables (under the Interaction Config category):
  • InteractionRadius - how far from an object player can interact with it. It is indicated by the teal sphere.
  • GlobalObjectID - name used for identification. All IDs has to be unique across all game maps. So a door on map A cannot has the same ID as a door on map B, otherwise, they will share the same interaction state.
  • ItemInChest - chest exclusive variable. Determines what items player will get when he interacts with the chest.

World enemies

All world enemies should inherit from BP_jRPG_Enemy_World_Base blueprint. For each child blueprint, you can set up mesh and animation blueprint as you would do for a standard character. There is no need to add any specific functionality to enemy blueprint unless you want something special.

When you place world enemy actor in the world map access its details to edit basic interaction variables (under the Interaction Config category):
  • ActivationRadius - determines how far from a player enemy will start chasing him. Indicated by the purple sphere.
  • EncounterRadius - determines how far from a player actual encounter will happen. Indicated by the yellow sphere.
  • EnemyGlobalID - name used for identification. All IDs has to be unique across all game maps.
  • PossibleEncounters - list of encounters that can happen when enemy catch up the player. Encounters must be taken from DT_jRPG_Encounters data table.
  • PossibleBattleMaps - list of battle maps where the battle can take place on.

If you want an enemy to not chase player character and battle to take place only when a player is close enough then set ActivationRadius to 0 and adjust EncounterRadius to your needs.

IMPORTANT: Remember to add NavMesh Volume to your level otherwise enemy won't chase the player.

Once an enemy has been fought it won't appear on the map again because their state is stored in the game instance and saved to file when a game is saved.

World NPCs

NPCs just like world enemies and interactable objects have their own base blueprint - BP_jRPG_NPC_Base. All the logic has been set up there and you will need to add only one event for children blueprints:
  • OnInteractionRequested - it will execute functionality you set up for specific NPC (eg. PopUp text or dialog window, open shop menu, whatever you need).

When you place NPC actor in the world map access its details to edit basic interaction variables (under the Interaction Config category):
  • InteractionRadius - how far from NPC player can interact with it. It is indicated by the green sphere.

Additionally, there is vendor NPC blueprint in demo folder. It has additional functionality  that will let you add vendors to your game maps quickly. Your NPCs can inherit from it if you want them to be vendors. Once you add vendor NPC to the world map you can set up what items he is selling (also under the Interaction Config category). You can also sell you items to the vendor.