Project Zomboid

Project Zomboid

[VFE] VANILLA FIREARMS EXPANSION (B41)
Nik 6 Jul, 2024 @ 12:01pm
Attachments on guns that "open" during reload
Discussion about said attachments on these guns.
I've been looking for a way to make scopes/slings appear on said guns and remain there during reload. I did add attachment points with ingame editor, but it appears it requires some additonal work around it and since you've managed such feat, i'd love to learn how its done, if that would not be an issue.
< >
Showing 1-10 of 10 comments
Nik 6 Jul, 2024 @ 12:07pm 
So far i have this: (Not sure if link will work) https://imgur.com/a/CEzD9Df
Vilespring  [developer] 6 Jul, 2024 @ 12:20pm 
The reason the attachments disappear is because of the animation system in vanilla zomboid.

It doesn't actually change the weapon model, it rather forces the model in the player's hands. As a result, the thing it shows has no attachments.

I overwrote this behavior for VFE. In "VFE_WeaponScriptOverwrite.lua" in lua/client you will find all the various animation event related functions I hooked into.

Because of how I made it, if you install and load VFE and try your weapon, the attachments will show during reload.
Last edited by Vilespring; 6 Jul, 2024 @ 12:21pm
Nik 6 Jul, 2024 @ 12:45pm 
You're right it works perfectly. If i understand it correctly the thing that makes it work is from line 40 to 104? I'd like to make my mod work with as many mods as possible and i know it might sound rude and once again, if you refuse i wont hold it against you and will respect the decision and not use it, but would it be possible with your permission for me to use part that makes it work in my mod. I would of course credit you.
Vilespring  [developer] 6 Jul, 2024 @ 12:57pm 
Yeah, use what you need. I have written that segment of code to work with other mods and overwrites. You can probably remove parts pertaining to my own custom model setting functions, so feel free to strip it down to just the functionality you need.
Nik 6 Jul, 2024 @ 1:12pm 
Thank you very much!
Nik 7 Jul, 2024 @ 3:51am 
Originally posted by Vilespring:
Yeah, use what you need. I have written that segment of code to work with other mods and overwrites. You can probably remove parts pertaining to my own custom model setting functions, so feel free to strip it down to just the functionality you need.
Is it actually only VFE_WeaponScriptOverwrite.lua file that is needed? I tried putting it without any changes inside my mod, but it bugs out, so i just want to make sure about it.
Vilespring  [developer] 8 Jul, 2024 @ 7:38am 
What is the specific error? You probably have to strip down some functionality as I added support for my own custom code for said thing.
Nik 8 Jul, 2024 @ 9:39am 
Originally posted by Vilespring:
What is the specific error? You probably have to strip down some functionality as I added support for my own custom code for said thing.
I found the issue. The file you mentioned (VFE_WeaponScriptOverwrite) requires global which is in diffrent file(VFE_WeaponAltModels). Since it does work right now, i'll continue to strip it down so i can run this mod both as standalone and with your mod. I hope that at some point i'll be able to write code like that.
Vilespring  [developer] 8 Jul, 2024 @ 10:56am 
Yeah, that's because I have a lot of stuff relating to using my own model setting system.

You need to strip out everything that uses the VFESetWeaponModel function. You only need part of the case of "changeWeaponSprite" with original and not original.
the devil's idiot 20 Sep, 2024 @ 3:56pm 
sorry to jump in how do to add attachments to guns?
< >
Showing 1-10 of 10 comments
Per page: 1530 50