How To Set Up A Two Weapon System - Unreal Engine 5 Tutorial

  Рет қаралды 12,257

Pitchfork Academy (MizzoFrizzo & Co.)

Pitchfork Academy (MizzoFrizzo & Co.)

7 ай бұрын

In this tutorial I'll show you how to set up a two weapon system with primary and secondary weapons, add your weapon base class to your character as a child actor component, and use an array to store your carried weapons. It's built using my weapons system with simulated physics pickups...
Patreon: / mizzofrizzo
Subreddit: / mizzofrizzo_tutorials
Facebook: / 884349679908510

Пікірлер: 91
@joxxix7035
@joxxix7035 6 ай бұрын
many thanks, Mr mizzo, I really appreciate how hard you have been working to upload the best way to do this code, as always you are awesome!!!
@ty_teynium
@ty_teynium 2 ай бұрын
I've been looking for this type of system for the longest! Thank you!
@6henny443
@6henny443 Ай бұрын
for me my index 0 is knife, as the player always has a knife, this setup works but the knife stays attached when swapping other weapons. any ideas? I really appreciate the help. I imagine bc knife its it's own class, what if I make the knife a primary. But also the palyer should never be able to drop knife
@aurustarsia5244
@aurustarsia5244 6 ай бұрын
I get tons of error logs: Accessed none trying to read class from: 1. Switch on Enum Weapon Class 2. Set current weapn int 3. attach component to componenr Would appreciate your help Mizzo, I followed your tutorial 1:1 and I also followed the physical weapn pickup tutorial. And additionally the weapons I am picking up are not attached to the sockets anymore. They are just not at the socket. Idk where they are
@PitchforkAcademy
@PitchforkAcademy 6 ай бұрын
It sounds like there's nothing stored in the index of the array you're trying to access. Did you add the two default indeces on the array?
@PitchforkAcademy
@PitchforkAcademy 6 ай бұрын
@7:13
@aurustarsia5244
@aurustarsia5244 6 ай бұрын
@@PitchforkAcademyThanks for the answer! Much appreciated. Yes, I set the indezies and set them both to none. Even tried to put a default selection of the Pistol in there. Thought this might fix something but it did not. So I changed it back to none. Then I thought I might missed something that you eventually explained in another tutorial. But that cannot be the case since I also watched the other "physics weapon pickup/spawn" tutorial. And that worked back then. So what could be wrong else?
@PitchforkAcademy
@PitchforkAcademy 6 ай бұрын
@@aurustarsia5244 I'm really not sure. I follow my own tutorials 1:1 and make sure that everything works as expected, so I don't know what to say other than you must have missed something. Either try some debugging methods or even start over (I did this many, many times when I was starting out).
@aurustarsia5244
@aurustarsia5244 6 ай бұрын
@@PitchforkAcademy Okay. So, if I follow this tutorial and the one with physics weapon spawn/pickup then it should work? Or is there something you add in another tutorial which is important for it to work?
@DylanPlayzz871
@DylanPlayzz871 2 ай бұрын
I’m going to go back through and try this again. But somewhere I went wrong. When we do our first test and it works for you it don’t for me. Something with my socket or something. And the names are all spelled correctly. My gun spawns in my players legs or a random area. It’s different for both guns (I only have the AR and pistol) And I no longer have up and down movement for my guns just sideways. So looking left and right my guns move where ever they are floating but when I look up and down they just stay stationary
@DefaltThunder
@DefaltThunder 27 күн бұрын
Hi , is there a way to attach the weapon "disappearing" to the belt or in the back? I dont understand where the weapon unequipped goes... it just destroy?
@PitchforkAcademy
@PitchforkAcademy 27 күн бұрын
@DefaltThunder I'd recommend my new video instead: kzfaq.info/get/bejne/fsWBaJqK2NWdnYE.html In this one we set them to be invisible, but you could just as easily set them to attach to a holster socket...
@d_Howard
@d_Howard 2 ай бұрын
I saw a nifty tutorial a couple years ago where the new weapon that was picked up was shown slung over the player's shoulder rather than just disappear into an inventory, or whatever. With a push of a button, the equipped weapon could be swapped out for the secondary. (Would be nice to have a pistol in a holster on the players belt, and maybe a knife, too!) Enemies don't stop attacking if you run out of ammo. You need a back-up! Don't want to be reduced to hand-to-hand...
@PitchforkAcademy
@PitchforkAcademy 2 ай бұрын
Actually I set up exactly that in my replicated weapons system tute (just not the animations): kzfaq.info/get/bejne/qZyTfNeT157efGQ.html 🙂
@d_Howard
@d_Howard 2 ай бұрын
@@PitchforkAcademy Nice! I'll have to check that out!
@kimbalboa9398
@kimbalboa9398 5 ай бұрын
Another awesome tutorial, thanks mate! Learning lots ;)
@jamaalsineke2405
@jamaalsineke2405 20 күн бұрын
Thank you for this excellent tutorial. QUESTION:How would you give weapons spell slots that you can drag and drop differnt activatble spells to? I'm prototyping a hack and slash with a two weapon system. Weapons have a basic attack and I want 3 additonal slots for flexible spells like Albion Online.
@PitchforkAcademy
@PitchforkAcademy 20 күн бұрын
I'd probably just store them inside your weapon BP as class references to your spell class.
@jamaalsineke2405
@jamaalsineke2405 20 күн бұрын
@@PitchforkAcademy THank you for your prompt respone I appreciate you taking the time to get back to me
@6henny443
@6henny443 Ай бұрын
7:55 if you did want to say start with a knife, i tried to set array 0 to my knife bp and it equips to the players index but you must use the input to equip it, it does not spawn in hand on play start.
@PitchforkAcademy
@PitchforkAcademy Ай бұрын
Copy the equip logic and slap it on Event Begin Play. 😉
@6henny443
@6henny443 Ай бұрын
@@PitchforkAcademy could you help me from what node to what node i need to bring to event begin play? I would think from spawn actor to attach component to component, but idk where to get transform from and If i use get actor transform it stil does not attach to the socket at the start
@PitchforkAcademy
@PitchforkAcademy Ай бұрын
@6henny443 Sorry mate no, I don't have the time to help everybody in that way. There are countless forums on facebook and reddit for example where anybody can easily find help, or you could join my discord where there are several very generous people who can help. I literally just finished work and it's midnight here, soooo... goodnight! ✌️
@fearingalma1550
@fearingalma1550 Ай бұрын
Did you decouple the Input Action in the character model compared to the previous, one gun version of this code? I set it up this way but I noticed the IA was just not there, and as such, I straight up couldn't pick up anything. Is it in another BP? For context, I came here from How to Create a Weapons System with Simulated Physics, so I haven't been following the FULL tutorial, and I was able to keep up with most of the small changes you made to some of the logic since you went over them (like the new namespaces to reference socket points on the model).
@fearingalma1550
@fearingalma1550 Ай бұрын
No, that's not it. It's in the Pickup Master, the entire reason Spawn Weapon happens is off Event Interact. This is very odd.
@fearingalma1550
@fearingalma1550 Ай бұрын
...well it might be my attach points, I checked my model in decoupled camera and it was sticking out my torso. But it still wasn't firing...
@fearingalma1550
@fearingalma1550 Ай бұрын
...it was because I swapped the body and attach point inputs. WHOOPS.
@korypeters2059
@korypeters2059 4 ай бұрын
nice cant wait to implement TY
@aurustarsia5244
@aurustarsia5244 6 ай бұрын
It worked so fine, really! I brought it to work for 3-4 weeks now. But today when I started unreal engine and just pick up the pistol and shoot, it will rotate to it's right. This is not happening with the other weapons. This bug just comes out of nothing.. any idea what the problem is?
@PitchforkAcademy
@PitchforkAcademy 6 ай бұрын
Have you got military weapons dark AND silver added to your project?
@aurustarsia5244
@aurustarsia5244 6 ай бұрын
@@PitchforkAcademy Yes. All worked fine perfectly. But today, out of literally nothing, the weapon (ONLY THE PISTOL) rotates to the right when I shoot.
@PitchforkAcademy
@PitchforkAcademy 6 ай бұрын
@@aurustarsia5244 It's probably playing the animation for the wrong pistol. Try changing that.
@aurustarsia5244
@aurustarsia5244 6 ай бұрын
@@PitchforkAcademy I cannot imagine this being the error since it always worked fine until now. But I highly appreciate your time and I will have a look on the pistol w animation tomorrow. Thanks
@aurustarsia5244
@aurustarsia5244 6 ай бұрын
@@PitchforkAcademy Quick update. Since all worked fine until yesterday, I deleted the pistol mesh, bp_pistol and bp_pistol_pickup and I did everything from start again. Creating the mesh, collisions etc. Still, this error occurs that the weapon is getting deformed and rotated to the right when I play the shoot animation. But as soon as I play the reload animation the pistol works fine again. Then, if I shoot, the rotation and displacement happens again. I am so confused since it worked at the beginning and the fact, that it is working for all the other weapons. I have no clue what's happening.
@ayititobahtiar2967
@ayititobahtiar2967 2 ай бұрын
Why does the transition from being unarmed to picking up a weapon go straight to aiming? Is there no idle holding weapon animation?
@PitchforkAcademy
@PitchforkAcademy 2 ай бұрын
It's the first state in the state machine. If you want to animate things, you have to animate things... 🙂
@ayititobahtiar2967
@ayititobahtiar2967 2 ай бұрын
@@PitchforkAcademy okay, thanks for all tutorial you've made, its help full
@protophase
@protophase 3 ай бұрын
Why do I have two meshes on my BP_FirstpersonCharacter? One is named FirstPersonMesh and contains the arms the second one is named just mesh(CharacterMesh0) and doesn't contain anything
@PitchforkAcademy
@PitchforkAcademy 3 ай бұрын
Probably because Mesh is inherited from the Character class and because they need to parent the First Person Mesh to the camera they've just added another skeletal mesh component.
@lz4090
@lz4090 6 ай бұрын
Hi. Whats the advantage of using a child actor for the equipped item vs directly attaching it to the mesh and socket.
@luistgarcia
@luistgarcia 4 ай бұрын
i have one questions, why not use data table and strucs for details of weapons and class!?
@PitchforkAcademy
@PitchforkAcademy 4 ай бұрын
I don't know why not. 🙂
@luistgarcia
@luistgarcia 4 ай бұрын
@@PitchforkAcademy I think is better, but i watched your videos of recharge ammo do used 🤷🏻‍♂️. Thanks for responding sorry my English not ver good
@zonerda
@zonerda 6 ай бұрын
I added a drop system to this but it only drops the one specific weapon so what would be wrong in there 😂 i have checked the weapons blueprints multiple times and dont find the answer. The print string what we made there says same weapon when try to drop other weapon. Works good with that one weapon.
@PitchforkAcademy
@PitchforkAcademy 6 ай бұрын
I'll throw together a drop weapon video after work today (in about 12 hours). ✌️
@zonerda
@zonerda 6 ай бұрын
@@PitchforkAcademy awesome 👍 you are the best
@hashimshah7732
@hashimshah7732 5 ай бұрын
can you please make a video on how to make camera ignore character mesh so that it wont clipped through the character when character is getting too close to the camera
@TreySweeney-vq3xe
@TreySweeney-vq3xe Ай бұрын
go to project settings>search for Near Clip Plane and change value low to something like 1 or .1 then restart project
@emilweinbergjensen3565
@emilweinbergjensen3565 6 ай бұрын
I made it and it works fine but my weapons are not scaled properly I don’t know why
@DevilClutches
@DevilClutches 6 ай бұрын
NIce tutorial!
@spikef1114
@spikef1114 4 ай бұрын
Remember to set the value of the "current weapons class ref" array to nothing or else you'll have the items in your inventory
@PitchforkAcademy
@PitchforkAcademy 4 ай бұрын
In what scenario?
@BlonkyWasTaken
@BlonkyWasTaken 5 ай бұрын
What is the spawn weapon thing at 6:09 on the pickup master bp
@BlonkyWasTaken
@BlonkyWasTaken 5 ай бұрын
andh ho do I get the custom event Spawn weapon
@PitchforkAcademy
@PitchforkAcademy 5 ай бұрын
As I said at the start of the video, this is built on top of my weapons system with simulated physics. You need to follow that tutorial first: kzfaq.info/get/bejne/g79-eclinNvOkqM.html
@spiritdragon6224
@spiritdragon6224 6 ай бұрын
when i pickup a weapon the currently held weapon is put on the ground instead of the players back
@PitchforkAcademy
@PitchforkAcademy 6 ай бұрын
Are they both primary or both secondary?
@spiritdragon6224
@spiritdragon6224 6 ай бұрын
It looks like this is caused by both weapons being set as primary, do you know how to make it so if you only have a primary in your hand you can pick up another primary
@PitchforkAcademy
@PitchforkAcademy 6 ай бұрын
@spiritdragon6224 This set up is to carry one primary and one secondary. A set up that allows any weapon in any slot is going to be different.
@spiritdragon6224
@spiritdragon6224 6 ай бұрын
at the beginning of the tutorial you pickup two primary's, in my version which followed the tutorial you cant do that @@PitchforkAcademy
@PitchforkAcademy
@PitchforkAcademy 6 ай бұрын
@spiritdragon6224 No I don't. Look again.
@sisqobmx
@sisqobmx 3 ай бұрын
Is this replicated?
@PitchforkAcademy
@PitchforkAcademy 3 ай бұрын
No, but I do have a replicated weapons system that is more streamlined than this! kzfaq.info/get/bejne/qZyTfNeT157efGQ.html
@TheFuri0uswc
@TheFuri0uswc 6 ай бұрын
It just deletes the weapon i pick up and i don't take it.
@PitchforkAcademy
@PitchforkAcademy 6 ай бұрын
You must have missed a step or two. I suggest having another go. ✌️
@TheFuri0uswc
@TheFuri0uswc 6 ай бұрын
@@PitchforkAcademy i checked id it it's identical to the video
@TheFuri0uswc
@TheFuri0uswc 6 ай бұрын
@@PitchforkAcademy nym im dumb it was invisiable
@aurustarsia5244
@aurustarsia5244 6 ай бұрын
I have the same error. I will try to fix it this evening. If it worked imma post it here as reply then you can try the fix as well. Meanwhile you may re-watch the video as we might really missed out something
@TheFuri0uswc
@TheFuri0uswc 6 ай бұрын
@@PitchforkAcademy Not it;s deleting the second weapon I picked up
@pwnonator
@pwnonator 3 ай бұрын
do u have a discord?
@PitchforkAcademy
@PitchforkAcademy 3 ай бұрын
Nope. I don't have the time to create and manage one.
How To Blend Animations For Different Weapons - Unreal Engine 5 Tutorial
14:00
Pitchfork Academy (MizzoFrizzo & Co.)
Рет қаралды 10 М.
Magic trick 🪄😁
00:13
Andrey Grechka
Рет қаралды 32 МЛН
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 30 МЛН
CHOCKY MILK.. 🤣 #shorts
00:20
Savage Vlogs
Рет қаралды 26 МЛН
Someone Made Pay 2 Win: The Game And Its Hilarious
14:11
MitchManix
Рет қаралды 3,1 МЛН
I solved Unreal Engine's Package Size Problem...
14:35
Cobra Code
Рет қаралды 67 М.
Can You Beat Hitman 3 Without Breaking ANY Laws?
22:37
windowledge
Рет қаралды 1,7 МЛН
3 Devs Make An FPS - Godot vs Unity vs Unreal || GameDev Battles
12:39
When a CIA Hacker Goes Rogue
23:09
TyFrom99
Рет қаралды 1,8 МЛН
I Made a Game in Unreal in 14 Days... (No Experience)
32:59
Jack Sather
Рет қаралды 1,3 МЛН
3D AI Model Generation is Getting GOOD - UE5.4 Unreal Engine
12:25
How to create a character selection - Unreal Engine 5
35:31
LeafBranchGames
Рет қаралды 10 М.
UE5 - Game Animation Sample: How to Add Overlay States
20:29
Native Coder
Рет қаралды 14 М.