Project Zomboid

Project Zomboid

Magazine API
 This topic has been pinned, so it's probably important
N0wh3re  [developer] 3 Mar @ 9:54pm
How to use // For anybody want to simply make a own mod
  1. Create your own magazine script file at \media\scripts\myScript.txt
    Example Script
    (Detail Description from wiki)[pzwiki.net]
    module MyMagMod { item 556ExtClip { DisplayName = 5.56NATO 35-Round Extended Magazine, DisplayCategory = Ammo, Type = Normal, Weight = 0.55, Icon = 556Clip_60, AmmoType = Base.556Bullets, CanStack = FALSE, GunType = Base.AssaultRifle, MaxAmmo = 35, StaticModel = GunMagazine, WorldStaticModel = gun_magazine_new, Tags = HasMetal;RifleMagazine, } item 308ClipDrumMag { DisplayName =.308 50-Round Drum Magazine, DisplayCategory = Ammo, Type = Normal, Weight = 0.55, Icon = 556Clip_60, AmmoType = Base.556Bullets, CanStack = FALSE, GunType = Base.AssaultRifle2, MaxAmmo = 50, StaticModel = GunMagazine, WorldStaticModel = gun_magazine_new, Tags = HasMetal;RifleMagazine, } }

  2. Create a .lua file at \media\lua\client\myMagMod.lua

  3. Set require = "MagAPI" at #1 line of your .lua file

    #1 require "MagazineAPI"

  4. Call API function to define your weapon and magazines.
    #1 require "MagazineAPI" #2 MagAPI.defineParam(Base.AssualtRifle, Base.556Clip, MyMagMod.556ExtClip) #3 MagAPI.defineParam(Base.AssualtRifle2, Base.308Clip, MyMagMod.308DrumMag)


Now it's all done. Although you have to set loot table if you want to loot new items from the fields, however you still can spawn your magazines via debug mode.

+ If you want to see actual example mod, Check this mod (Vanilla Firearm Expansion)
+ If you want to see how to set the loot table, check this wiki page.[pzwiki.net]
Last edited by N0wh3re; 8 Mar @ 5:08am