Project Zomboid

Project Zomboid

Jaw Stab Buff
Add Slider option for crit chance.
Currently the chance value is hardcoded (which is 80).

This will add slider to esc menu Mods tab for crit chance. It still only works for a single zombie, so I'm not sure, maybe author can pitch in.

-- Storage array for mod options local config = { criticalChanceSlider = nil } -- Function to create mod options local function ConfigureKnivesMod() -- Create the options object local options = PZAPI.ModOptions:create("KnivesMod", "Knives Configuration") -- Add a title options:addTitle("Knife Critical Chance Settings") -- Add a slider for critical chance (1 to 100) config.criticalChanceSlider = options:addSlider( "criticalChance", "Critical Hit Chance", 1, 100, 1, 80, "Adjust the critical hit chance for stabbing weapons." ) -- Define the apply function to set the critical chance options.apply = function(self) local criticalChance = self:getOption("criticalChance"):getValue() local aitem = getAllItems() if aitem then for i = 0, aitem:size() - 1 do local item = aitem:get(i) print("Got item") if string.find(item:getSwingAnim(), "Stab") then print("Setting to:") print(criticalChance) item:DoParam("CriticalChance = " .. tostring(criticalChance)) end end end end -- Call the apply function during the OnMainMenuEnter event to apply settings on initial load Events.OnMainMenuEnter.Add(function() options:apply() end) end -- Initialize mod configuration ConfigureKnivesMod()
< >
Showing 1-1 of 1 comments
yes  [developer] 16 Feb @ 9:36am 
Added! take a look and thanks for the suggestion c:
< >
Showing 1-1 of 1 comments
Per page: 1530 50