KhaineGB Posted December 28, 2018 Share Posted December 28, 2018 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! Hopefully it'll be of use to folks. Link to comment Share on other sites More sharing options...
Quasimiyao Posted December 30, 2018 Share Posted December 30, 2018 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? Link to comment Share on other sites More sharing options...
KhaineGB Posted December 30, 2018 Author Share Posted December 30, 2018 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. Link to comment Share on other sites More sharing options...
Quasimiyao Posted December 30, 2018 Share Posted December 30, 2018 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 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 Link to comment Share on other sites More sharing options...
KhaineGB Posted December 30, 2018 Author Share Posted December 30, 2018 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. Link to comment Share on other sites More sharing options...
Quasimiyao Posted December 30, 2018 Share Posted December 30, 2018 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. Link to comment Share on other sites More sharing options...
xyth Posted December 31, 2018 Share Posted December 31, 2018 @KhaineGB Glad you finally got this posted. Well done! This will be a popular Tutorial. Link to comment Share on other sites More sharing options...
Quasimiyao Posted December 31, 2018 Share Posted December 31, 2018 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 Link to comment Share on other sites More sharing options...
KhaineGB Posted January 3, 2019 Author Share Posted January 3, 2019 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. Link to comment Share on other sites More sharing options...
Sorrowthief Posted January 18, 2019 Share Posted January 18, 2019 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? Link to comment Share on other sites More sharing options...
zombo Posted January 20, 2019 Share Posted January 20, 2019 Very useful video. Could you make a guide on how to add armor? Link to comment Share on other sites More sharing options...
KhaineGB Posted February 2, 2019 Author Share Posted February 2, 2019 Very useful video. Could you make a guide on how to add armor? We can't add new UMA models yet. It sucks. -_- - - - Updated - - - 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. Link to comment Share on other sites More sharing options...
YuriBengala Posted February 11, 2019 Share Posted February 11, 2019 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? Link to comment Share on other sites More sharing options...
KhaineGB Posted February 16, 2019 Author Share Posted February 16, 2019 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. Link to comment Share on other sites More sharing options...
Sykriss Posted February 11, 2020 Share Posted February 11, 2020 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. Link to comment Share on other sites More sharing options...
xyth Posted February 15, 2020 Share Posted February 15, 2020 I think the guns are in the Items bundle now. Link to comment Share on other sites More sharing options...
KhaineGB Posted February 16, 2020 Author Share Posted February 16, 2020 ^ that. All weapons seem to be in that file now. Link to comment Share on other sites More sharing options...
Dorbson Posted February 18, 2020 Share Posted February 18, 2020 ^ that. All weapons seem to be in that file now. Khaine, any idea how the animation controller would look for bows? I know it needs a hold, draw, draw idle, fire, fire cancel, and reload animations. I'm pretty sure I know the transitions, but I'm not certain how to trigger each animation within the items.xml file. Link to comment Share on other sites More sharing options...
KhaineGB Posted February 20, 2020 Author Share Posted February 20, 2020 Not really. I did a crossbow once. Took me 3 days. I need to revisit bows/crossbows and see if I can refine the controller a bit, then I can just share it. Link to comment Share on other sites More sharing options...
Z06Frank Posted March 22, 2020 Share Posted March 22, 2020 First of all great video, I have a few questions I am modding A18 does the version of unity I use matter ? I currently have 2019.2.10f1, also does the A17 export script work for A18 ? Thanks ! Link to comment Share on other sites More sharing options...
KhaineGB Posted March 22, 2020 Author Share Posted March 22, 2020 Export script still works. I think I'm using 2018.something for unity. If you open your log file, it tells you what version of unity the game is using. That's the one I currently use. I think Xyth is using 2019.2 for his entities though. Link to comment Share on other sites More sharing options...
xyth Posted March 22, 2020 Share Posted March 22, 2020 For A18 use 2019.1.14 https://unity3d.com/get-unity/download/archive Link to comment Share on other sites More sharing options...
Z06Frank Posted March 22, 2020 Share Posted March 22, 2020 As suggested i'm using unity 2019.1.14, but I am getting the following error (Null Reference Exception: Object reference not set to an instance of an object) when loading up. Here's my hierarchy in Unity, followed the same pattern as the 7d2d A18 pistol And the XML file, used pistol as a base Help would be appreciated. Thanks ! Link to comment Share on other sites More sharing options...
Z06Frank Posted March 23, 2020 Share Posted March 23, 2020 Never mind my previous post got it working as a modlet. Link to comment Share on other sites More sharing options...
Zoopaa Posted April 24, 2020 Share Posted April 24, 2020 This was a fantastic tut! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.