Announcement

Collapse
No announcement yet.

Adding new guns to 7 Days to Die (A17)

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

    Adding new guns to 7 Days to Die (A17)

    I figured the tutorial for adding guns to the game needed updating, especially since things have changed in A17. If you don't have your prefab setup correctly, you'll be presented with NRE's upon trying to equip your new gun.

    So I did a tutorial thing!

    https://www.youtube.com/watch?v=jffCqEC9Deo&t=12s

    Hopefully it'll be of use to folks.

    #2
    Thx alot for this tutorial Been wanting to add a custom model to the rifle I made before releasing it. Tried making the exact same thing as you did first tho ,just to see ifI got it working, but keep getting NRE's when trying to equip it. I did the attachments same way as you did in the video, and did exactly the same edits in the xml aswell. Only thing different was I couldnt find the prefan gun with the flashlight attached, so use the PistolPrefab extracted with Asset Studio instead. But that shouldnt have any effect on the result? Except possibly scale/orientation?

    Comment


      #3
      If you're getting an NRE when trying to equip it, then I absolutely guarantee you're missing the Attachments/Scope transform (and yes, the capitilization MATTERS).

      Try disabling action1 for the gun in your XML. If it stops giving NRE's, that's your problem. You didn't set up the scope object correctly.

      Comment


        #4
        I checked that first thing actually, since you were pretty clear on that in the video, which is a good thing or I might just aswell have missed it

        Still, commenting out action1 did work. it shoots and all, but what I'm actually holding in my hand looks like a piece of cloth or leather
        (Your assumptions that people watching your video were familiar with Unity editor is not applicable in all cases lol). I know I should be before using it, but looked so easy based on your tutorial

        Annotation 2018-12-30 224524.jpg

        Edit: Also, when looking at the huntingrifle prefab extracted from the games assets folder, I dont see all the attachment points I would assume based on the attachments the gun supports. But as long as I add a scope attachment(which it has) it should be ok to use if I dont add any other attachment tags in the xml? Working on a weapons modlet, and currently just using ingame models with different tints. Would be nice if I could add custom models and sounds to them aswell
        Last edited by Quasimiyao; 12-30-2018, 09:56 PM.

        Comment


          #5
          I assumed people had gone through Xyth's basic unity tutorials because he's done WAY more than me.

          Piece of leather like that means the XML is somehow wrong. That's what 7DTD does when it can't find the model for whatever reason (For the record, I've literally had that happen, changed the name of the .prefab file in unity, re-exported and then it's worked for no reason).

          I believe other tags are not REQUIRED, but may throw NRE's if you try to attach a mod that doesn't have the appropriate "slot" defined on the prefab for the transform.

          Comment


            #6
            Hehe, I would assume most people watching it, at least those with the intent of doing anything with it, have watched his videos. And I will do so later or tomorrow. Its just that you made it look quite easy using a free asset and just importing it so I thought I'd have a go at it
            I did make it twice, after first failed, to make sure I hadn't missed anything. And used a slightly different name, incase the underscore in the first could be one reason. I'll try and export the same one with different name later when I get home.

            As long as other guns work without the other tags it shouldn't be an issue. Can just remove the attachment tags from the xml. And try adding the ones that's appropriate for the different weapons when I get the basic models working.

            Comment


              #7
              @KhaineGB Glad you finally got this posted. Well done! This will be a popular Tutorial.

              Comment


                #8
                You were indeed right, renaming the prefab an re-exported it and it worked like a charm I did have to add -270 degrees for the attachments for side and scope to point the right direction (and I realised now that I could just used 90 without the minus...). Side also needed to move ca 0.6 further back. Plus the barrel same rotation adjust but position x2.5 y0.2 ca to not be same place as the scope ( I did add the gun to the item_modifiers list first to see if that corrected enough, which it didnt). But I got a working gun thx to your tutorial after never used Unity editor before, so thx again for a very nice and easy to follow tutorial There might be a few new guns in the mod section soon

                Comment


                  #9
                  Glad it helped.

                  And yeah, it makes no sense to me that you sometimes need to change the prefab name to get 7DTD to load it. It's one of those random strange things I've just learned to deal with.

                  Comment


                    #10
                    I've been following the tutorials and have managed to do the flag and the gun like you have in the video and make it work in the game. I used to play with Unity a lot when my son was in college for game design and we spent a good part of a year trying to make our own game. Meaning I still have a lot of bought assets laying around that I can use. I was trying to make a new trap but cannot get it to work. I was trying to use the spinning blade trap as a template but I am unsure of what tag I should use for one and animation on my prefab is the other. My hammer trap has a spinning animation attached. How could I get that in the game to work with electricity like the spinning blade trap? So far I keep getting NRE on every attempt so I figure it has to be something with the tags and perhaps the electrical stuff is more complicated? I also notice that the traps all use LOD, does that make a difference? If I am using the xml blade traps as a template for my hammer trap is it looking for all those LOD models?
                    Last edited by Sorrowthief; 01-18-2019, 12:31 AM.

                    Comment


                      #11
                      Very useful video.

                      Could you make a guide on how to add armor?

                      Comment


                        #12
                        Originally posted by zombo View Post
                        Very useful video.

                        Could you make a guide on how to add armor?
                        We can't add new UMA models yet.

                        It sucks. -_-

                        - - - Updated - - -

                        Originally posted by Sorrowthief View Post
                        I've been following the tutorials and have managed to do the flag and the gun like you have in the video and make it work in the game. I used to play with Unity a lot when my son was in college for game design and we spent a good part of a year trying to make our own game. Meaning I still have a lot of bought assets laying around that I can use. I was trying to make a new trap but cannot get it to work. I was trying to use the spinning blade trap as a template but I am unsure of what tag I should use for one and animation on my prefab is the other. My hammer trap has a spinning animation attached. How could I get that in the game to work with electricity like the spinning blade trap? So far I keep getting NRE on every attempt so I figure it has to be something with the tags and perhaps the electrical stuff is more complicated? I also notice that the traps all use LOD, does that make a difference? If I am using the xml blade traps as a template for my hammer trap is it looking for all those LOD models?
                        I -think- blocks that use electricity need very specific tags in order to work, but I have not messed with that to be totally honest with you.

                        Comment


                          #13
                          Hello KhaineGB, awesome video you did, i wanted to thank you for it, thanks to it i created the Soviet Pack, really thanks!
                          And one question, im trying to implement a Animation to a gun, in Unity everything is working fine, im using the Animator to do it, but when i put the gun in game the animations don't work,do you have any idea why this is happening?

                          Comment


                            #14
                            I'm still working out animations myself. Took me 3 days to do 1 crossbow.

                            The main ones you need are an empty idle anim, a fire and a reload. I find that using triggers work's better than bools and you MUST have your animator on the empty parent object within unity, NOT on the model.

                            Comment


                              #15
                              I cannot seem to locate pistolPrefab (or any of the other gun prefabs) inside of resources.assets. First I tried filtering by the term 'pistol' inside of asset studio and I saw a bunch of animation clips and sound files, but no prefab or mesh. I exported all of resources.assets and still couldn't find a pistolPrefab inside. Is there something I am missing? I'd really like to get working on getting some new guns imported and this is quite baffling, it's as if that file just doesn't exist.

                              Comment

                              Working...
                              X