Creating an Enemy
Last updated
Was this helpful?
Last updated
Was this helpful?
Create a new blueprint derived from Soulslike Enemy (B_Soulslike_Enemy).
Assign your character mesh & the relevant Animation Blueprint you'd like to use:
(Optional) If your character will be using weapon(s), add a Child Actor Component to your Mesh. Select the world actor (derived from B_Item_Weapon_AI) for the weapon you'd like your enemy to use:
If your Enemy character will not be using a weapon, ensure that you fill in the Unarmed category correctly under AC_AI_CombatManager.
Soulslike Framework uses a data-asset based, scored ability system for every enemy's abilities. To create new abilities, click on the Soulslike Framework dropdown and select the AI Ability Creator:
After creating the ability, do not forget to assign it to your enemy's AC_AI_CombatManager!
The framework provides two rules - Distance (FAiRuleDistance) & Stat (FAiRuleStat). These rules are structures that contain relevant data. They are located in /SoulslikeFramework/Structures/AI/Rules.
With the use of Instanced Structures, you can create your own rules by creating a new structure with the relevant data and adjusting the EvaluateAbilityRule() function inside AC_AI_CombatManager.
For this example, we'll create a rule which is capable of checking any Stat of the player. Start by duplicating the FAiRuleStat rule and rename it appropriately (or just create a new struct):
Next, adjust the EvaluateAbilityRule() function to take into consideration this new rule we created:
Finally, utilize the rule in any AI Ability you have:
For this example, we'll create a rule that is capable of reading player input. Start by creating a new structure and name it appropriately - lets say FAiRulePlayerInput:
Add the new rule to the AI ability you want to use:
For more information about creating AI Weapons, check out our guide on .
(Optional) Setup your loot table for the enemy under the AC_LootDropManager component. For more information, .
Setup movement speed & stats/attributes for your enemy under the AC_StatManager component. Additionally, you can override any stat/attribute you want and adjust their values from this component. For more information, .
Setup AI behavior for your enemy under the AC_AI_BehaviorManager component. For more information, .
Finally, setup combat related data for your enemy under the AC_AI_CombatManager component. For more information, .
For each ability, you can define the corresponding montage, its score (weight based), its cooldown and custom rules. For more information on creating montages & utilizing notifies, page.
For this rule, we want to keep track of the actions the player is executing. We can retrieve this from the component of the player. We will bind to the OnInputBufferConsumed delegate in the Input Buffer Component to detect when an action has been performed. You can do this anywhere you like, but for this example, we'll do it inside 's SetTarget() method:
Now that we're keeping track of the recently triggered actions of the player, we can utilize this new property we created (MostRecentPlayerActionInput) on the 's EvaluateAbilityRule() method: