top of page

- Character State Module Tutorial -
- Dash -

    Welcome! In this section we will be making our first State Module that contains Movement Addons. It will be a very simple State Module that consists of only minimum requirements to make one and a great start to learn how things work especially on, well, movement! Later on we will get to more advanced type of Dashes and such!

    Before we start, I assume that you have checked all the previous documentation and tutorials, got an "MyOmen" Fighter going on already as almost all Tutorials will be related to him.

  • Video to the right is a demonstration on the State Module we will be creating. Basically Omen will be able to dash with both X and Z Movements included in both directions! He will also be able to do Basic Aerial Attacks! 

  • We will also be using Ken Masters as the other Fighter to mainly focus on one "MyOmen".

 1- Preparation

  • Let's start with getting our Blueprint read. We will put a copy of "SM Template" and put it into our "Self_SMs" Folder and rename it "MyOmen_Movements_SM". Let's clear all the Template State code in there as well.
     

  • We will doing more than one movement state eventually so it is better to do name it like this!

 2- Forward Dash / State Definition

  • It's okay to just edit nodes that are already there, but for the sake of tutorial, we will do everything from the beginning.

  • Here we will be adding a Custom Event for beginning and name it "State 1700". It is strongly suggested to NOT use State IDs between 0-1000 and 5000-7000 as they are mostly used by the Main State Module that contains the base States for Characters.

  • Now let's add a New State Definition. While we will eventually do a Z Movement as stated in the beginning, the first frames of the animation we will be on Ground. So it is okay to have a "Standing" Character Stance value.
     

  • Let's have State Type is "Non-Attack" and we will be changing the New State ID from "0" to "1700".

  • At the start of the dash we need to make sure that Omen loses complete control. So neither Movement or Action Input will be allowed to be entered. For this, we will use "Control Adjustment" Component.
     

  • Next we will be using "Update Animation" Component to trigger a Unique Animation that is named "Omen_DashF0_FB".

  • Last Component we want to add is called Addon Entry Gate. (1) states that there is one gate which is the default entry point for adding Addons to our State.

 3- Addon - Add X Movement 

  • This Addon allows you to let Character change its location in X Axis for certain amount of value and time. So let's talk about its inputs and outputs!

    -------- INPUTS --------
    --- X Movement Parameters ---
     

  • "X Movement Behavior" is optional to alter the already active Movement Components and Addons such as this one.
     

  • "Move Direction" is needed for X Axis Movement to move the Character relative to its own rotation.

i1.PNG
  • "Friction Enabled" toggles friction against other Characters. Movement value is reduced to half when this Character pushes against another one.
     

  • "Timeline Reference", "Movement Links" and "Movement Value" are connections for Timeline Component (We will talk about Timeline Reference and Component soon!). "Movement Value" can not be negative value. If you want Character to go backwards, use "Move Direction" above.
     

   --- Optional Z Movement Parameters ---
 

  • "Z Movement Behavior" is optional to alter the already active Movement Addons and Components such as this one. This is used so you don't need another Node just to adjust Z Movement.
     

   -------- OUTPUTS --------
 

  • "Extension Entry" is used by Movement Extensions that are mostly used to change State Module values that trigger when there is a collision against a Wall and such.
     

  • "Movement Started" can be used if an execution is needed to occur right after this Node starts functioning.

  • "Movement Update" triggers every tick as long as Timeline is still on.

  • "Movement Finished" triggers when Timeline is finished playing.

  • However, Addons and Components like the one above require a Timeline Component to operate. [RMB] click on empty space and type "Add Timeline" to create one. Make sure to link both "Update" and "Finished" links to each other.
     

  • However making a Timeline is not enough to trigger itself. We also need a reference of it to let the Addon operate it.
     

  • After giving the Timeline a name, [RMB] in empty space to type its name with "Get in front (ex: Get Stage Pal TL) to get a reference we need to plug it into "Timeline Reference".
     

  • "Update", "Finished" and "Movement Value" Links are meant for Timeline Outputs.

i2.PNG
  • Now let's prepare a X Movement Addon so you understand it all better!
     

  • Adding one is no different than other Addons. [RMB] in empty space and type "Addon - Add X Movement - CD". We will be needing a CD Variant so we get to have a condition to trigger it!

  • We would like to trigger the actual Movement after 4 ticks pass in this State. So we will be using a "State Tick" Information node and check if it its value is ">=4".
     

  • State Tick refers to the frames that a Fighter spends its time within a certain State. State Tick Value increases by 1 per frame. For example if a Fighter spends 1 second in a State, the Tick Value would be 60.
     

  • And let's change "Movement Direction" to Forward.

  • Now it is time to make this Addon properly functional and for this we need a Timeline Component.
     

  • Like mentioned above [RMB] in empty space and type "Add Timeline". It will automatically ask you to rename it so we change it to "Forward Dash X TL".
     

  • And for now let's link both Finished and Update Links to each other. Note that Input and Output names are there to guide you!

  • We now have a Timeline Component but it is not fully functional yet. We still need a Float Track in it to derive Movement Data from inside.
     

  • Double [LMB] click on Timeline to open its own Graph and you see "+ Track" at Top Left Corner. Click on it and it will ask for which type of Track and for now we will be using only "Float Track".

  • We now have a Float Track but it is not finished yet. We will need at least one "Key" to set a float value.
     

  • We can do this by either [Shift] + [LMB] on the Track, or [RMB] and select "Add Key". We can also set its Value to "800".
     

  • For this Track we want a constant X Movement Value so only one Key is enough. So let's make sure its "Time" is at "0".
     

  • PS: You can delete a key by selecting it and press [Del].

  • We have a functional Float Value so lets link it to the Addon's "Movement Value"!
     

  • Now you might have noticed that the Timeline have Inputs such as "Play, Play From Start". They do seem like the way to make the Timeline work but we never touched them.
     

  • So how will the Addon play the Timeline?Let's go over it quickly now!

  • Previously in the X Movement Addon section we spoke about an Input named "Timeline Reference". This is the actual value the Addon needs to start the Timeline.
     

  • Drag out from that input via dragging with holding [LMB] and type the name of the Timeline that we just made. Addon will handle the rest!

  • Now we will be working on adding a Z Movement Addon this time as we want this Dash to have a slight upwards movement as well, like a small hop.
     

  • Here we get "Addon - Add Z Movement - CD" just like we did for X version and set the same Condition value.
     

  • We won't be going through what the inputs and outputs are as they are literally same as X Movement Addon albeit without the "Friction" and "Direction" values.

  • Z Movement does not contain any "Friction against Characters" and "Direction" is determined by the value declared in Timeline itself so we don't need it either.

  • Now let's add another Timeline and name it "Forward Dash Z TL", basically Z equivalent of X.
     

  • Then connect its "Update and Finished" outputs to the Addon's own inputs and make a reference call to its own and link it to "Timeline Reference".

  • Now lets get inside the Timeline and set its own Length to "0.15 Seconds". This will be useful to trigger certain Output Links later on.
     

  • Finally let's add a Float Track as well and name it "Z Movement".

  • Next we will be adding 2 Keys by clicking [Shift] + [LMB] twice on the Graph. Here is the data for the Keys:
     

  • Key 1:  Time = 0      / Value = 300

  • Key 2:  Time = 0.15 / Value = 0
     

  • Now there will be a sudden increase on Z Movement but it will quickly drop to 0 in 0.15 seconds, letting this move to be a quick  hop.

  • Not all curves made in Timeline Graphs need to be straight lines. By [RMB] clicking on a Key, we can change the Curve's type that it starts.
     

  • In this case the "Default" is good enough for smooth decreasing value.

  • Finally let's not forget to link "Z Movement" Output of Timeline to "Movement Value" Input of Addon so the data flows without any problem!

  • At this Point we got a Movement going but there are 3 things we need to handle next!

    1- Declare what will be the State to Change when the Fighter lands on the ground.
    2- Change Character Stance to "in Air" after the Z Movement starts otherwise UF2D will think the Stance is still "Standing", making Attack Impacts especially troublesome.
    3- Give Ability Input Control back and update Act Bool List so we can do basic attacks. 
    4- Trigger Gravity after Z Movement is finished.

  • Let's start! If you remember from the Basic Attack Tutorials, we did NOT have a State Change Addon for Aerial States. What we did was using a "Movement Extension - Z Contact SM Triggers".
     

  • Here we will be stating that we want to enter "State 52" in "Main State Module", which is a "Landing State" from a regular jump. However we will change it later on. For now let's keep it that way!

  • Next we will be updating "Character Stance" value with "Change Character Stance - IT" Addon. We will be linking it to "Movement Started" output of Z Movement Addon so the moment Fighter hops, Stance will be changed.
     

  • We are also using "IT" version of the Addon. It means "Instant Trigger" as we don't need to check for any Condition. What we needed was an Addon that just triggers.

  • Moving on, we need "Set Controls - IT" Addon to set "Ability Input" to "Enabled" so that we can do Basic Attacks. If you check the Input Definitions we have done so far, the condition for "Ability Input" is that it needs to be "Enabled".

  • Now it is time to handle "Act Bool List" and update its Array value to set all Basic Attacks to TRUE.
     

  • For that first we need to get "Character Owner". As the name suggests, it returns the value for the Character that is currently using the State. In Empty Space type "Get Character Owner" to get it.
     

  • Next drag out from the return value of Character Owner node via [LMB] it type "Set Act System Bool List" and click the selection that came up.

  • Now we got a "Set Act System Bool List" node. Link it to "Act System Update" output of "Set Controls" Addon we previously put on the Graph. Then copy the "Make Array" from "MyOmen_Char" and paste it to change the item values of 5-10 to TRUE.

  • Finally we will be setting gravity on. Note that our Z Movement Addon makes Omen hop but doesn't actually make him go down.
     

  • That's why we need an Addon called "Set Gravity - IT" to trigger it and link it to both "Movement Finish" outputs of our Z Movement Addon.

 4- Input State Definition

  • Now lets copy the Input State Definition of Standing Heavy Kick and convert it to a Forward Dash instead!
     

  • We are using value "2" for "Act System Bool List" and keep the Character Stance Condition same as we want to be on ground when trying to Dash.
     

  • Let's delete the Input Combination too as we will make a brand new one later!

  • After updating the Comment Title, lets change Target State Module to "MyOmen_Movements_SM" and set State to Triggers Value to 1700, which is our Forward Dash State ID!
     

  • Next we will be setting Ability Input Check to "Irrelevant" and Movement Input Check to "Enabled" as want to be able to dash when it is allowed to enter movement inputs.

  • As all the Forward Dashes go, the input shall be "Forward + Forward". For this we need an array of 2 "Movement Input - Single Choice" with Forward as value. Rest can stay default.
     

  • However we immediately face a problem. Our Input Definition will never trigger as there is no Action Input, unless we use another Custom Event that checks for only movement inputs. Lets get into it!

  • The Custom Event we are looking for is called "Check Player Movement Input - Instant".
     

  • As the name suggests, this Event triggers every time the Player enters a Movement Input via a Keyboard or Gamepad so this is exactly what we need!
     

  • Let's not forget to link our new Dash Input Definition to it!

  • Let's see if our State is now in the game! If you followed up till now, it should all work!
     

  • Now Omen is indeed dashing but ending rather abruptly. This is because we set the State to land as "State 52" in Main State Module which is just an instant stop after a jump.
     

  • Now let's make a Sliding State!

 5- Preparing a Slide State

  • Before we make the actual State, let's go back to the "Z Contact" Extension that is linked to our "Add Z Movement" Addon.
     

  • We will change "Main State Module" to "Get Self as Class" and link it to "Touch State Module" nodes. So now we can trigger a State in this State Module!
     

  • We will also change "State ID" values to 1705 as well as this number will be our State ID for sliding on the ground.

  • Now let's copy the State 1700 Definition and Components. Most of the values can stay same as it will be a simple Standing Stance State.
     

  • Of course we will rename the Custom Event to "State 1705" and change the State ID value to the same value as well.
     

  • Lastly let's change the Animation to "Omen_DashF1_FB" in Update Animation Component too!

  • Now it is time to use "State Component - Set X Movement". This is a Component that exactly works like its Addon variant and easy to use if you want an instant movement to trigger the moment a State becomes active.
     

  • Let's add a Timeline to the scene and name it "Dash F End Slide". "Timeline Reference" should be handled as well!

  • Now that we have a Timeline Component, let's get a float track in it! We will once again want to have a "Slowing Down" X value in 0.25 seconds so let's set the Length of Timeline to that amount.
     

  • Then we will need 2 Keys. First Key Value will be 800 in the beginning and other one at 0 right in the end.

  • After connecting Movement Values to each other, we will be bringing an Addon Gate which shall be connected to the "State Present" Output of the Set X Movement Component.
     

  • We are NOT linking it to "State Changed" because if Fighter changes State for a reason, we don't want to trigger this Addon Gate.

  • Next we will be linking a State Change Addon to the newly created Gate. This will be where we will be returning to our regular Idle Standing State that resides in Main State Module.

  • We are almost done! Let's add a Sliding Sound into our State.
     

  • Let's do it so the sound plays the moment we enter this State. For this we will use the Addon Entry Gate that was already there which is linked to Component Entries!
     

  • After adding "Play Sound - IT" Addon, set the value of Sound to Play to "Omen_Slide_Snd"

  • Let's see if our Sliding State is properly triggering or not! If you followed up till now, it should all work and hear a Sliding Sound as well as Omen truly slowing down on the ground before going back to Idle Stance.
     

  • Now let's do a final touch and add some Sliding VFX, aka dusts!

 6- Adding Dust - Effect 2D

  • Now let's see if we can add some easy Effect 2D dust that continuously trigger as Omen slides on the ground before stopping completely!
     

  • Go to our "Dash F End Slide" Timeline and inside its Graph add a "Event Track". Put 4 Keys on them with time distance of 0.07 from each other.
     

  • Value does not matter for Event Trigger Track so we can keep it at 0. All that matters is Keys and their Times.

  • Now let's test our "Trigger Dust" output of Timeline with a Print String. If you see it is getting spammed 4 times at top left, then we have it all working properly!

  • Here we will be making a Simple Dust VFX. Note that we want this Effect to be affected by lighting and be additive.
     

  • Let it be rendered in front of Characters, not cast shadows and scale up to double.

  • We also want to trigger dusts exactly where the Character Collision Box's ground location is. So we get its location and set its Z value -92.
     

  • We can get the Collision Box by dragging out of Character Owner reference.

  • If you followed up everything correctly, you will be seeing dust appearing on the ground when Omen slides!

  • Before we continue further, let's put all the State Code into Comment Sections. This is optional of course.
     

  • Now it is time to make the Backward Dash!

 7- Backward Dash

  • For starters, let's make a copy of the whole Forward Dash and change comment titles to "Backward".

  • Before we move on, there is a VERY important thing we need to speak about.
     

  • When you copy a Timeline Component, Timeline References do NOT get updated. Unreal Engine doesn't know that we want to use new references so it copies the old ones.
     

  • That's why we need to remove all Timeline References.

  • Now let's change the State 1700 and 1705 Definition values.  We will be renaming them to  1750 and 1755 and update State ID values as well. 
     

  • Lastly we will be changing the "1705" value to 1755 in the Contact SM Trigger as well so that we can trigger end slide for Backward Dash!

  • Now it is time to change the Animations. Let's change the Main Dashing State's (1750) animation to "Omen_DashB0_FB" and Sliding State's (1755) one to "Omen_DashB1_FB"

  • Next let's fix our Timelines. We will rename them to "Backward" and update Timeline References according to their names.
     

  • And for all X Movement Direction Values, we will set them to "Backward".

  • Now lets copy the Input State Definition of Forward Dash and convert it to a Backward Dash instead!
     

  • We will change "State to Trigger" value to 1750 (Main Backward Dash State) and change Movement Inputs to "Backward" so we need to double tap to dash backward!

  • If you followed up everything correctly, Omen will be doing a backward dash after tapping Backward Input Twice!

    This is all for a Dash States. I hope it was a good start up for moving our Fighter! Feel free to continue to next tutorial to make a Hurricane Kick here. Thank you for your time!

bottom of page