top of page

- Character State Modules -

2.PNG
4.PNG
5.PNG
3.PNG

  Welcome! In this section we will be talking shortly about Character State Modules themselves and the actual big dive will be in tutorials themselves.

    Character State Modules are what defines the current State a Character is in. Whether it is in air, in control, attacking and so many other properties are defined in these Blueprints and are reflected in the game as they change the Character's properties and behavior.

 1- Basics

  • Firstly, let's see how we can check if a BP is a Character State Module or not. It is easy as checking if the Parent Class is "C State Module Base" or not. "C" here is standing for Character.

i1.PNG
  • There are a few ways of creating a State Module, but the easiest and safest one is finding the Template Blueprint Asset named "Char_Temp_SM".

  • Feel free to duplicate this actor and move the newly created one somewhere else. It is strongly suggested to have a "_SM" tag for State Modules to find them easier when the amount of your files increase!

  • Character State Modules can contain more than one State Definition. You can actually contain your entire State System in one file, but that would be kind of unwise. When Unreal compiles a Blueprint, it checks the entire visual code itself which increases the time it takes to compile.

i2.PNG

 2- State Definition / Components

    As the title implies, State Definitions are the beginning and main visual codes for a State we want our Character to be in. A State Definition consists of a "Custom Event", a "New State Definition" and optional "State Components". So let's check what they are about!

  • Custom Events are the starters and the Events that are called for to trigger a State Definition and set Character's state to a new one.

  • Each Custom Event MUST have a name as "State [Integer]", such as "State 100" as the picture to the right shows or else UF2D can't trigger it via various ways which will be talking about later.

i3.PNG
  • If there is more than one Custom Event, same IDs are not allowed. However you can have Custom Events with no limitations name-wise if they are in different State Modules. For example, you can have one "State 100" in a SM Blueprint "A" while having the same name in SM Blueprint "B". However, it is STRONGLY suggested to have different State IDs for every unique State Definition you want to have.

 

  • UF2D Framework has internal fail-safes to avoid problems that might occur, but you will get false positives if you are wanting to trigger something depending on a State ID if more than one same ID is present for a Character.

  • Creating a Custom Event is very easy. Just [RMB] click in Event Graph of a State Module BP and select "Add Custom Event..."

  • Make sure the name Starts with "State" and ends with an Integer that will define the ID of the State the Fighter will be in!

  • PS: You can edit the name after creating the node, by selecting it and pressing [F2] and with a double click on the name with a small delay in-between!

  • New State Definition nodes are for kickstarting the first values for a State we want our Characters to get in.

  • To Create a State Definition, [RMB] click in Event Graph of a State Module BP and type "New State Definition - Standard" to search for the Node and then select it.

----------------------- Inputs -----------------------

  • "State Entry" is the execution input. You will mostly see a Custom Event linked to here so the State starts.

  • "State Name" is an optional variable and has no functionality. Can be left empty.

       ----- Parameters -----

  • "New State ID" defines the ID of the State Definition it belongs to. It MUST be unique for a Fighter and have the same ID number that the Custom Event mentioned above to avoid confusion.

i4.PNG
  • "Character Stance" dropdown got options for "Standing - Crouching - In Air / Flying - Laying Down". It is important to chose the proper Stance which is crucial for Gravity to work properly and/or let Attack Definition put the Fighter into correct State after causing said Fighter receive a hit.

  • "State Type" dropdown got options for "Non-Attack - Attack - Hit Receive - Custom Hit Receive". If a State is passive and not harmful (such as Taunt, Intros) its Type should be "Non-Attack" and "Attack" if vice versa. If the State is something that is meant to be triggered after an attack impact (such as receiving hit to head/stomach) the Type should be "Hit Receive". If it is a Unique Attack Impact situation (such as grabs), Type should be "Custom Hit Receive" as this option disables some UF2D related checks for attack system.

  • "Face to Closest Enemy" makes the Character instantly turn towards the closest Enemy. Who could have guessed?

  • "Move Contact Persist" allows an internal boolean to stay in value "True" after an Attack contacts which normally resets after the State changes. This value can be used to trigger events or used in Input System to be able to trigger moves that are dependent on a previous Attack that needs to connect to a Target first. (Will be implemented properly with examples later.)

----------------------- Outputs -----------------------

  • "Component Entry" is the execution link for adding more State Components if desired which we will be talking about below!

  • State Component nodes are for kickstarting the first values for a State we want our Characters to get in.

  • State Components are optional (with one exception) and can be used at will. Also a State Definition should NOT have more than one of the same Component type.

  • To Create a State Component, [RMB] click in Event Graph of a State Module BP and type "State Component - [Name]" to search for the Node and then select it.

  • We will not be talking about all Components in this section but will do so shortly about them in Tutorials and eventually make a huge Library containing data about them.

  • "State Component Entry Gate" node is  the one MUST be there before State Addons are started to be used.

  • This little guy is an exception for State Components, as the rest of them are optional, while this one isn't.

i5.PNG
i6.PNG

 3- State Addons

  • State Addons are extra nodes that have their own set of rules to trigger. They are in blue colors and optional tasks that you want to trigger with a certain condition while a State is active.

  • We will not be talking about all Addons in this section but will do so shortly about them in Tutorials and eventually make a huge Library containing data about them.

i7.PNG
  • To Create a State Addon, [RMB] click in Event Graph of a State Module BP and type "Addon - [Name]" to search for the Node and then select it.

  • Unlike State Components, Addons don't need to be unique and we can have more than one with different condition requirements.

i8.PNG

       One different thing to note is that Addons have tags at the end of their titles; "CD - CT - IT".

  • CD stands for "Condition Dependent". Once the State this Addon belongs to gets activated, it will start making a check per condition to see if the "Condition" is met. Addon will become offline after the condition is met once.

  • CT stands for "Constant Trigger". Similar to a CD tagged Addon, this one also checks for a condition. However it continues to check per trigger even after the condition is met once.

  • IT stands for "Instant Trigger". This Addon does NOT check for a Condition and it will get called instantly. Mostly used in conjunction with other Addons to trigger simultaneously.

 4- State Extensions

  • Extensions are helpers and nodes that are needed to be there for some Components and Addons that need additional data to be inputted in.

AnimEx_Stan.PNG
  • To Create a State Extension, [RMB] click in Event Graph of a State Module BP and type "Extension" to search for the Node and then select it.

  • Unreal Engine's search tab may come up with too many options sometimes. So it is better to drag with [LMB] from an input/output to get the node we need!

  • Just like State Components and Addons, we will not be talking about all extensions in this section but will do so shortly about them in Tutorials and eventually make a huge Library containing data about them.

 4- State Informations

  • Informations are extra helpers that provides data from other places possible. They are mostly used for setting Conditions on and can be used in conjunction with each other.

i10.PNG
  • To Create a State Information, [RMB] click in Event Graph of a State Module BP and type the name of data to search for the Node and then select it.

  • Unreal Engine's search tab may come up with too many options sometimes. So it is better to drag with [LMB] from an input/output to get the node we need!

  • To check the complete list of what you can use in Character State Modules, search for "C_StateModule_ML". This is the Macro Library that contains all the nodes that you can use! (All the nodes you have seen so far are macros.)

    Our short entry of Character State Modules end here. However the best way to understand them is seeing them function runtime. Feel free to check about how we make a State Module for our Fighter!

bottom of page