Dynamic Combat System (adding Anim trails to weapons)

This is for the Dynamic Combat System on the marketplace, i am not the creater of this project and this is how i got anim trails working on the weapons, probably best you make a new Dynamic combat system project so you can test it out without breaking your main project - and always make backups of your main projects, :smiley:

Ok so i got it working (probably the best its going to be), it wasnt very easy to get it working so i guess i’ll share with you how i did it haha.

UE4 4.18.3

  1. Edit the “F_Weapon” Structure and add a new variable “SkeletalMesh” of the type “Skeletal Mesh object reference” - note after editing the structure and saving you then have to rename it - i just added a 1 to the end - and let it update the references otherwise you will get a complie error in the ABP_combat anim BP, this is the only way ive found to fix it.

  2. In the Meshes - Items folder (or for any custom weapon model) you right click the weapon static mesh (ie sm_sword) go to “Asset actions” then “Export” and this exports the model as a “.FBX” file (choose a location folder and rename the exported file to “SM_sword1” (or anything as long as it isnt the same as the original static mesh file)

  3. In the Meshes - Items folder in the content browser(or whichever folder you want your new imported weapon mesh) click on “Import” choose your “SM_sword1.fbx” file (or whatever you named your exported weapon mesh as) and on the “FBX Import options” window , under “Mesh” up the top make sure you Tick the “Skeletal Mesh” option, this will show a “Skeleton” option, make sure there is no file selected for the Skeleton (if there is , click the drop down arrow where you choose the skeleton and then click “Clear” - this is very important - if you dont clear it UE4 wont create a skeletal mesh for the imported weapon mesh) - then click Import at the bottom. (this will create a skeletal mesh, a physics asset and a skeleton , there will also be a UCX skeletal mesh, physics asset and skeleton created - for my purposes i deleted the 3 “UCX” files)

  4. Open the newly imported “SM_sword1…” skeletal mesh (not skeleton) and set the Material to the old Static mesh Material (this retains the original skin) save , then click on the “Skeleton” Option (next to mesh and Physics etc up the top right) and make sure youre in the “Skeleton Tree” tab on the left so you can add some sockets to the Skeleton for the Anim Trail. Add 2 sockets - i named mine “start” and “end” and move them to where you want the anim trail to show, i moved the “end” socket to the tip of the blade and the “start” socket to just above the handle on the blade then save.(you can name them whatever as long as you remember what they are then save. Note for each subsequent Weapon model you reimport as a skeletal mesh you should name the 2 sockets on the skeleton different ie. start1 end1, start2 end2 etc.

  5. Open your “BP_CombatCharacter” Blueprint , then on the components list make sure you select “Righthandmesh” and click “Add Component” and type in “Skeletal Mesh” and add it. Note it is very important the skeletal mesh component is a child of the RightHandMesh component - now you are ready to add your Particle effects(for anim trail). Select the newly added skeletal mesh component then click add component and then choose the “Particle System” component and add it, you can add particles for each weapon you have here, i added 2 for testing and named them the default weapon classes ie Steelsword and Halberd. Make sure once you’ve added each particle system you select it and on the “Details” tab browse for your particle “Template” (Anim trail particle effect). - compile and save.

  6. Open the datatable “DT_Weapons” and select your weapon (for this case steel_sword) and browse down to the Skeletal Mesh variable and search for the “SM_Sword1…” skeletal mesh (or whatever you named the imported skeletal mesh) from the drop down list, then save.

7a) In the “BP_CombatCharacter” Blueprint open the “OnWeaponUpdate” Function (if you expand the “Items” in the functions list you will find the function here) , drag off the exec pin on the “onweaponupdate” function and add a “Set Skeletal Mesh(skeletal mesh)” node - Note this is assuming you named the added Skeletal Mesh component in step 5 Skeletal mesh, ie in step 5 you named the added skeletal mesh component as sword, the you would add a “set skeletal mesh(sword)” node.
Now drag off the “Skeletal mesh” pin on the “Break f_weapon” node and connect it to the “new mesh” pin on the “set skeletal mesh” node.
Now on the end exec pin of the “set skeletal mesh” node drag off a add a “sequence” (this is where we will be adding our “begin trails” nodes) so make sure the last pin on the sequence node goes to the “Set static mesh” node (you can hold control and left click drag the pin connection on the sequence node so that the last pin goes to “set static mesh”. Drag off the first pin on the Sequence node and add a “begin trails (steelsword)” node - (based on what you named your particle system in step 5 is what the name will be ie. i named my particles as “steelsword” and “halberd” so i will be adding a “begin trails (steelsword)” and a “begin trails (halberd)” node to the sequence, you can add as many pins to the “sequence” node as you need for the different “anim trail” particles you created in step 5, i have 2 different particles -
1 for the steelsword and 1 for the halberd weapon for this example so i added 1 pin to the sequence node.- make sure once youve added the pins to sequence, the pin that goes to “set static mesh” node is the last pin on the sequence node - i will add a screenshot attached to show you for this)

7b) Now once you have your “begin trails (steelsword)” node added the last step is to add the socket names you want the Anim trail to show on, (in step 4 i named my sockets “start” and “end”) So for the “In first socket name” i typed in “start” and for the “In second socket name” i typed in “end” (the reason in step 4 i mentioned if you create particle effects for other weapons to name the sockets on the weapon skeleton different names ie start1 end1 - otherwise it will play all anim trail particles for the sockets if you name them the same for each weapon)- compile and save.

  1. You need to add a skeletal mesh component to the parent “Item” blueprint as well, so open up “BP_BaseItem” , click on “WorldMesh” in the components, and then add component “skeletal Mesh” , this should add a skeletal mesh component as a child of the Wolrdmesh component. Compile and save. Done!!!

There you go, woop woop Anim trails on weapons now.

Why not just add two sockets to player skeleton then on the animation add the weapon trail notify?

1 Like

Im a novice, been using Ue4 for about 5months (not going hardout) so i dont know heaps and heaps - but i have been learning alot , 2nd i googled and googled and there were no tutorials that really helped or showed anything like you said and i would have to add a ton of sockets to the player skeleton for different weapons.

Im not sure how that would work in real world, all i know is that this works really well for what i need - you dont have to use it or try it but this is just what i came up with. Implementing this should take 5mins , all the time spent was me figuring out how to set it up.

No worries. I added trail a few hours ago coincidentally, so was just wondering if your way achieved something different. Take care:)

Thanks to both of you, both comments were very helpful

If you have many weapon but using in one animation u will know why sir.

1 Like

Hi, did you find any solution for multiple weapon?