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

Поділитися
Вставка
  • Опубліковано 31 жов 2024

КОМЕНТАРІ • 96

  • @joxxix7035
    @joxxix7035 9 місяців тому +2

    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 4 місяці тому

    I've been looking for this type of system for the longest! Thank you!

  • @moosehead13
    @moosehead13 Місяць тому

    The fact that you reuploaded a video you had already done because you found an error/better way make you a champ in my heart. So tired of youtube tutorials where they mess something up and then spend 3 videos having to make workarounds/fixes instead of just doing what you did. I have one question for you. Have you given any thought to using Data Assets housed in a Skeletal Mesh Component? I have used your system of a master class housed in an Actor before, and was curious what you think is the most streamlined way to equip & manage a weapon system.

    • @PitchforkAcademy
      @PitchforkAcademy  Місяць тому

      @moosehead13 Hey thanks, that's really kind of you to say. I do try... Ummm I'm not 100% sure what you mean, but I do have this new weapons system video that may be of interest to you:
      ua-cam.com/video/H_Q57Yso9mM/v-deo.html 🙂

    • @moosehead13
      @moosehead13 Місяць тому

      @@PitchforkAcademy Hey thanks for the reply! So rarely do creators actually respond to comments & questions. I checked the video you linked me and I see you are using a skeletal mesh component for your "BP_WeaponMaster" blueprint ,which is reassuring, but I was curious of the value in using Primary Data Assets to store all the properties of a weapon instead of putting them inside the skeletal mesh component blueprint. I am currently deep in AI systems following GameDevRaw's "Making an AI Guard" series (link below) and he went about using a PDA to create essentially a master data asset and then creating basically a child data asset of the PDA for each weapon he uses in the series. Other then having to go into the Project Settings>Asset Manager>"Primary Asset Types to Scan" and adding a new index for the PDA it seems like a much more efficient & streamlined system. I have never been the biggest fan of Data Tables as they seem to have issues when they get too big or when information is changed too often, but Data Assets seem to be a solution that feels a lot more stable.
      My question is centered around these new, to me, blueprint types and if you had any opinions or experiences using PDAs that could help me decide if they are worth using or if its better to just store all the properties of the weapon within the skeletal mesh component? Thanks again for your time & I look forward to checking out your series when I get into weapon systems!
      Link to GameDevRaw's video on "Weapons using Data Assets - Making an AI Guard #2 - Multiplayer AI - Unreal Engine 5 tutorial":
      ua-cam.com/video/xxIY0h670DQ/v-deo.htmlsi=pKKUg3NMT2hznykN
      Clip explaining Primary Data Assets:
      ua-cam.com/users/clipUgkxKt_Dd3MGLEGMY11mbd3MPB92S-z1FBJd?si=p7sb2H-2JvCE9sgh

  • @d_Howard
    @d_Howard 5 місяців тому

    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  5 місяців тому

      Actually I set up exactly that in my replicated weapons system tute (just not the animations):
      ua-cam.com/video/s6cItbr8zL0/v-deo.html 🙂

    • @d_Howard
      @d_Howard 5 місяців тому

      @@PitchforkAcademy Nice! I'll have to check that out!

  • @kimbalboa9398
    @kimbalboa9398 7 місяців тому

    Another awesome tutorial, thanks mate! Learning lots ;)

  • @korypeters2059
    @korypeters2059 7 місяців тому

    nice cant wait to implement TY

  • @aurustarsia5244
    @aurustarsia5244 9 місяців тому +4

    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  9 місяців тому

      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  9 місяців тому

      @7:13

    • @aurustarsia5244
      @aurustarsia5244 9 місяців тому

      @@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  9 місяців тому

      @@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 9 місяців тому

      @@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?

  • @jamaalsineke2405
    @jamaalsineke2405 3 місяці тому

    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  3 місяці тому +1

      I'd probably just store them inside your weapon BP as class references to your spell class.

    • @jamaalsineke2405
      @jamaalsineke2405 3 місяці тому +1

      @@PitchforkAcademy THank you for your prompt respone I appreciate you taking the time to get back to me

  • @fearingalma1550
    @fearingalma1550 4 місяці тому

    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 4 місяці тому

      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 4 місяці тому

      ...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 4 місяці тому

      ...it was because I swapped the body and attach point inputs. WHOOPS.

  • @aurustarsia5244
    @aurustarsia5244 8 місяців тому +1

    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  8 місяців тому

      Have you got military weapons dark AND silver added to your project?

    • @aurustarsia5244
      @aurustarsia5244 8 місяців тому

      @@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  8 місяців тому

      @@aurustarsia5244 It's probably playing the animation for the wrong pistol. Try changing that.

    • @aurustarsia5244
      @aurustarsia5244 8 місяців тому +1

      @@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 8 місяців тому

      @@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.

  • @lz4090
    @lz4090 9 місяців тому

    Hi. Whats the advantage of using a child actor for the equipped item vs directly attaching it to the mesh and socket.

  • @DefaltThunder
    @DefaltThunder 3 місяці тому

    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  3 місяці тому

      @DefaltThunder I'd recommend my new video instead:
      ua-cam.com/video/H_Q57Yso9mM/v-deo.html
      In this one we set them to be invisible, but you could just as easily set them to attach to a holster socket...

  • @Silvieson
    @Silvieson 2 місяці тому

    ! Solved it by changing the Not equals to Equals to.!
    Im not entire sure where i am going wrong, Everything is working but spawning drop. did it exactly like yours but it always hits the false = SAME WEAPON.. am i missing where we populate the weapon to spawn var on the spawn weapon event? followed the previous tut and it was working fine. change it to the new system and it no longer drops. I added it as an input and it is a class reference to the BP_WeaponMaster. This has got me scratching my head.

  • @DevilClutches
    @DevilClutches 9 місяців тому

    NIce tutorial!

  • @spikef1114
    @spikef1114 6 місяців тому

    Remember to set the value of the "current weapons class ref" array to nothing or else you'll have the items in your inventory

  • @6henny443
    @6henny443 4 місяці тому

    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

  • @DylanPlayzz871
    @DylanPlayzz871 5 місяців тому

    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

  • @ayititobahtiar2967
    @ayititobahtiar2967 4 місяці тому

    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  4 місяці тому

      It's the first state in the state machine. If you want to animate things, you have to animate things... 🙂

    • @ayititobahtiar2967
      @ayititobahtiar2967 4 місяці тому

      @@PitchforkAcademy okay, thanks for all tutorial you've made, its help full

  • @hashimshah7732
    @hashimshah7732 8 місяців тому

    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

    • @UInrealZTurtroials-vq3xe
      @UInrealZTurtroials-vq3xe 4 місяці тому

      go to project settings>search for Near Clip Plane and change value low to something like 1 or .1 then restart project

  • @6henny443
    @6henny443 4 місяці тому

    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  4 місяці тому +1

      Copy the equip logic and slap it on Event Begin Play. 😉

    • @6henny443
      @6henny443 4 місяці тому

      @@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  4 місяці тому

      @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! ✌️

  • @emilweinbergjensen3565
    @emilweinbergjensen3565 9 місяців тому

    I made it and it works fine but my weapons are not scaled properly I don’t know why

  • @protophase
    @protophase 6 місяців тому

    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  6 місяців тому

      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.

  • @zonerda
    @zonerda 9 місяців тому

    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  9 місяців тому +1

      I'll throw together a drop weapon video after work today (in about 12 hours). ✌️

    • @zonerda
      @zonerda 9 місяців тому

      @@PitchforkAcademy awesome 👍 you are the best

  • @BlonkyWasTaken
    @BlonkyWasTaken 8 місяців тому

    What is the spawn weapon thing at 6:09 on the pickup master bp

    • @BlonkyWasTaken
      @BlonkyWasTaken 8 місяців тому

      andh ho do I get the custom event Spawn weapon

    • @PitchforkAcademy
      @PitchforkAcademy  8 місяців тому

      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:
      ua-cam.com/video/MYNFf17ujbo/v-deo.html

  • @spiritdragon6224
    @spiritdragon6224 9 місяців тому

    when i pickup a weapon the currently held weapon is put on the ground instead of the players back

    • @PitchforkAcademy
      @PitchforkAcademy  9 місяців тому

      Are they both primary or both secondary?

    • @spiritdragon6224
      @spiritdragon6224 9 місяців тому

      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  9 місяців тому

      @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 9 місяців тому

      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  9 місяців тому

      @spiritdragon6224 No I don't. Look again.

  • @sisqobmx
    @sisqobmx 5 місяців тому

    Is this replicated?

    • @PitchforkAcademy
      @PitchforkAcademy  5 місяців тому +1

      No, but I do have a replicated weapons system that is more streamlined than this!
      ua-cam.com/video/s6cItbr8zL0/v-deo.html

  • @TheFuri0uswc
    @TheFuri0uswc 9 місяців тому

    It just deletes the weapon i pick up and i don't take it.

    • @PitchforkAcademy
      @PitchforkAcademy  9 місяців тому

      You must have missed a step or two. I suggest having another go. ✌️

    • @TheFuri0uswc
      @TheFuri0uswc 9 місяців тому

      @@PitchforkAcademy i checked id it it's identical to the video

    • @TheFuri0uswc
      @TheFuri0uswc 9 місяців тому

      @@PitchforkAcademy nym im dumb it was invisiable

    • @aurustarsia5244
      @aurustarsia5244 9 місяців тому

      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 9 місяців тому

      @@PitchforkAcademy Not it;s deleting the second weapon I picked up

  • @pwnonator
    @pwnonator 6 місяців тому

    do u have a discord?

    • @PitchforkAcademy
      @PitchforkAcademy  6 місяців тому

      Nope. I don't have the time to create and manage one.