Announcement

Collapse
No announcement yet.

Lets Make: Weapon in Blueprint from Blank Project

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Lets Make: Weapon in Blueprint from Blank Project

    GOAL : A Crowbar and a Shotgun that can break Apex destructibles and move normal physics actors and damage pawns too.

    EDIT:
    Right I was going to post this but then the f*cking electricity shut down and it was back to drawing on the walls with charcoal. Anyway now I'm back in the 21 century and here is the beginning:

    Step 1: make your BP of your gun. Add a collision component and set it to overlap all. Now make a Custom Event and put a placeholder print string so we know when or event is called. You are DONE!



    Step 2: Go to your Pawn do this:



    this will attach the weapon to a socket (that you have to make in your SkelMesh(mine is called weapon))
    and it will call the event Fire when you leftclick
    Last edited by Midnight640; 03-28-2014, 07:55 AM.
    TA on :
    Assassins Creed Origins
    Assassins Creed Origins: Curse of the Pharaohs
    The Division 2

    #2
    Step 3: Collide/Destroy Apex destructibles.
    If you want your weapon( or its bullets) to destroy the apex actors, you need to make sure they are both have the same USE ASYNC SCENE value.
    TA on :
    Assassins Creed Origins
    Assassins Creed Origins: Curse of the Pharaohs
    The Division 2

    Comment


      #3
      Thanks for sharing I'm gonna give this a shot when I get home for my melee weapon.

      Please keep the information coming!

      Comment


        #4
        Midnight do you mind showing your content browser and a bit more of the Blueprint window? I'm trying to set this up and my weapon doesn't get attach on play, what else am I missing in the setup?

        Comment


          #5
          I don't mind but that is all I have (the other things are WIP and i don't want to confuse because they don't work)

          Check your "attach to actor" do you have a custom socket in your skeletal mesh , if not ,you can attach "Camera"-"In parent" to test will it work,

          Also make sure your weapon has a mesh so it casts shadows , sometimes it gets attached out of your FOV and seeing the shadow move with you, can tell you if are you going in the right direction.
          TA on :
          Assassins Creed Origins
          Assassins Creed Origins: Curse of the Pharaohs
          The Division 2

          Comment


            #6
            thanks alot dude, i really needed this
            Game Artist

            Comment


              #7
              EDIT:

              OK I removed my other complaints. This works wonderfully! The only issue I have is that for some reason the thing attaches in weird directions... Any idea how I could correct this? Does it have something to do with the way the skeletal mesh is set up? or is that something I could do in the Weapon blueprint, so that it changes its rotation?
              Last edited by ParadodxCTRL; 03-30-2014, 12:33 PM.
              /r/unrealengine/ Check out the Unreal Engine Reddit Community!

              Comment


                #8
                Originally posted by ParadodxCTRL View Post
                EDIT:

                OK I removed my other complaints. This works wonderfully! The only issue I have is that for some reason the thing attaches in weird directions... Any idea how I could correct this? Does it have something to do with the way the skeletal mesh is set up? or is that something I could do in the Weapon blueprint, so that it changes its rotation?
                Go to the Blueprint of the weapon and rotate the mesh in the components tab. Just keep guessing which direction you need to rotate until you get the right one :P

                Comment


                  #9
                  Originally posted by TOAST BOMB View Post
                  Go to the Blueprint of the weapon and rotate the mesh in the components tab. Just keep guessing which direction you need to rotate until you get the right one :P
                  DUH! That was deceptively simple. Other things I will note is this -

                  If your gun has Physics, it will not attach to your character!
                  If your gun is set to collide with the player, it will block any traces you may be drawing out of your character. It'll also push your character around because well... its colliding.

                  My fix was simple -
                  before the trigger that attaches the gun to your character, make sure to change the guns physical properties. You can do that with Set Collision Enabled and Set Simulate Physics targeting the Collision box you have under components.
                  /r/unrealengine/ Check out the Unreal Engine Reddit Community!

                  Comment


                    #10
                    Using this general idea, could you in theory set multiple weapon sockets on a pawn that a weapon can connect to, and just change which socket is attached in the Attach Actor to Component function?

                    Comment


                      #11
                      Guys I've been playing around more with my weapon setup and I wanted to share; I've deviated from Midnight's initial setup by creating an attachWeapon function that's called at BeginPlay so they are always attached to the player.

                      Just to explain what's happening in my blueprint, I'm crafting a weapon system similar to Zelda. Players can Attack, Block and Holster their weapons which should be pretty self explanatory on the blueprint.

                      [Edit] Just realized I didn't compile before I took a screenshot, the blueprint works fine.

                      Comment


                        #12
                        Is the "Attach Actor to Component" aspect something you can put into a Blueprint's constructor, so that if a pawn is spawned, a weapon(s) is automatically equipped to the appropriate socket(s)?

                        Comment


                          #13
                          Originally posted by Sanadras Riahn View Post
                          Using this general idea, could you in theory set multiple weapon sockets on a pawn that a weapon can connect to, and just change which socket is attached in the Attach Actor to Component function?
                          Yes you could do that. Take a look at my Blueprint, I switch between the 'weapon' node and the 'weaponSheath' node.

                          Originally posted by Sanadras Riahn View Post
                          Is the "Attach Actor to Component" aspect something you can put into a Blueprint's constructor, so that if a pawn is spawned, a weapon(s) is automatically equipped to the appropriate socket(s)?
                          I'm not sure why don't you try it out and share?

                          Comment


                            #14
                            Doing so now; I wasn't in a position to do so initially, as I was at work. I'll report my findings when I try it out!

                            Comment


                              #15
                              So I've got a couple weapons working thanks to this thread. I have 99% of the blueprinting done for equipping the weapon, checking to see if a weapon is already equipped and dropping the current weapon if so, and so on. Right now however, even with only two weapons, I can see an issue coming down the pipe - Consistency. Lets say I have 10 weapons, all based off the first weapon I made, the only thing that changes really is the fire rate and the type of projectile. Then lets say I have a realization that I could do the nuts and bolts part (say, dropping a weapon when a new one is equipped). Now I'm stuck changing 10 weapons to make sure its consistent.

                              Let me show you what I have so far, tell me if I'm doing this in a crazy way. I'm trying to make the Pickup and Drop logic as generic as possible.



                              some of these comments are dated actually, so try and pay no attention to them.
                              /r/unrealengine/ Check out the Unreal Engine Reddit Community!

                              Comment

                              Working...
                              X