Project Zomboid

Project Zomboid

[VFE] VANILLA FIREARMS EXPANSION (B41)
Nik 2024 年 7 月 6 日 下午 12:01
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.
< >
正在显示第 1 - 10 条,共 10 条留言
Nik 2024 年 7 月 6 日 下午 12:07 
So far i have this: (Not sure if link will work) https://imgur.com/a/CEzD9Df
Vilespring  [开发者] 2024 年 7 月 6 日 下午 12:20 
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.
最后由 Vilespring 编辑于; 2024 年 7 月 6 日 下午 12:21
Nik 2024 年 7 月 6 日 下午 12:45 
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  [开发者] 2024 年 7 月 6 日 下午 12:57 
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 2024 年 7 月 6 日 下午 1:12 
Thank you very much!
Nik 2024 年 7 月 7 日 上午 3:51 
引用自 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  [开发者] 2024 年 7 月 8 日 上午 7:38 
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 2024 年 7 月 8 日 上午 9:39 
引用自 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  [开发者] 2024 年 7 月 8 日 上午 10:56 
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 2024 年 9 月 20 日 下午 3:56 
sorry to jump in how do to add attachments to guns?
< >
正在显示第 1 - 10 条,共 10 条留言
每页显示数: 1530 50