Project Zomboid

Project Zomboid

91 평점
Magazine API
   
어워드
즐겨찾기
즐겨찾기됨
즐겨찾기 해제
파일 크기
게시일
업데이트일
163.318 KB
2025년 3월 1일 오전 5시 07분
2025년 6월 26일 오전 4시 39분
업데이트 노트 5개 (보기)

다운로드 위해 구독하기
Magazine API

설명
If you want buy me a coffee? then hit the UP & Favorite button instead giving me some dollars. I can buy coffee myself :D
(or some steam points.. I want to buy new profile wallpapers..)




Description
This mod does not add any weapons or magazines.

This mod allows other modders to use multiple magazine types on the same firearm.
For example, an AK with a 30-round mag AND 95-round RPK drum mag.

>>Example Mod (Vanilla Firearm Magazine Expansion)<<

Main Feature
  • For modder: Single line per a weapon. simple.

  • Tooltip will be automatically generated by API. You can see that in the screenshot. will be fancy in the future tho.

  • Best Magazine will always be "magazine that has highest ammo count" no matter magazine types.

  • Also, when you are inserting bullets in your spare magazine, mod try to insert bullet into where the Best Magazine is.

  • When you are inserting bullets, If you don't have any bullets for Best Magazine, mod will try to find next magazine type.

  • Regarding above, you can use multiple type of ammo for single firearm. (for now, single type per single magazine however will be changed.)

  • When there's no ammo in all of your magazines, magazine which has highest Max Capacity will be the best magazine.

  • If you want to change your magazine manually, not automatically selected magazine, right-click your weapon and find "select magazine" menu



How To Use
  • MagAPI.defineParam(weapon, mag1, mag2, ... mag99, mag100) -- This is all you have to do.
Example
require = "MagAPI" MagAPI.defineParam("Base.AssaultRifle", "Base.9mmClip", "Base.556Clip", "Base.M14Clip", "Base.44Clip")

If you need more detailed description, check the pinned discussion.




Stability & Compatibility & Performance
It's pretty stable as I believe, but I'm not sure about performance when there are many magazine types.
I believe it will be okay too, but anyway, this is why I'm saying this is in testing.

About Compatibility, since weapon mods does not allow to use more than one weapon mod, it will be okay.
Also, you can fix & edit my code freely unless you are gonna set this mod as required of your mod.

About MP
I will try when B42 MP is out, but honestly, I have not played MP in the last 11 years of PZ.
So I'm not sure.



Future?





Known Issue
Tooltip will show correct maxAmmo and currentAmmo, However, name of magazine will not be changed.


This is my first API mod and also my first medium-sized mod, so anything bad can happen.
I wrote this code in 6 hours, but the idea came 1-2 months ago.

If you are a developer, You CAN DO ANYTHING you want to implemented by copy&paste my files. You can include files into your mod directly to overwrite API, any actions, any codes. however, you should set this API as requirement.

Workshop ID: 3436296238
Mod ID: MagazineAPI
인기 토론 모두 보기(2)
0
2025년 3월 6일 오후 4시 09분
고정됨: Planned Next Update/ Planned Future Features
N0wh3re
0
2025년 3월 3일 오후 9시 54분
고정됨: How to use // For anybody want to simply make a own mod
N0wh3re
댓글 4
Tank5168 2025년 6월 9일 오전 12시 52분 
function: isValid -- file: TimedActions_Override.lua line # 15 | MOD: MagazineAPI
Callframe at: StartAction
function: begin -- file: ISBaseTimedAction.lua line # 85 | Vanilla
function: onCompleted -- file: ISTimedActionQueue.lua line # 87 | Vanilla
function: onCompleted -- file: ShortcutItem.lua line # 45 | MOD: TheShortcut
function: perform -- file: ISBaseTimedAction.lua line # 66 | Vanilla
function: perform -- file: ISEquipWeaponAction.lua line # 139 | Vanilla

ERROR: General f:339737, t:1749455306002> ExceptionLogger.logException> Exception thrown
java.lang.RuntimeException: __len not defined for operand at KahluaUtil.fail(KahluaUtil.java:100).
N0wh3re  [작성자] 2025년 3월 24일 오전 6시 56분 
@+_:_KingGodder_:_+
Assumeyou are whom in TIS discord, I left a reply in mod_develop channel.
Don't have hard time alone. you can share your issue in there. :)
+_:_KingGodder_:_+ 2025년 3월 24일 오전 3시 26분 
Hey man, dont know if you'll see this... can you rewrite this in B41? I want to make it work with CJ, I don't know anything about coding and am having some hard times.
Sir Doggy Jvla 2025년 3월 9일 오전 7시 25분 
Hello, I'm the lead of Project Modding for the official wiki and I documented your framework on it for other modders to more easily find. Don't hesitate to modify, adjust or add informations
https://pzwiki.net/wiki/Magazine_API


I would also like to give some tips with your framework which would improve it, notably the use of modules:
https://pzwiki.net/wiki/Lua_(language)#Modules

Overall everything looks clean however ! I noticed you used some deprecated functions (empty functions now) from your API in your example mod but you probably already know about that haha