#mod_development

1 messages Β· Page 148 of 1

hazy ferry
#

ive searched pretty thoroughly and I don't think there is, but just in case - is anyone aware of a lua event that triggers when a zombie attacks the player?

little kraken
#

thank you

neon bronze
#

I think it was ISInventoryPaneContextMenu that had this part

fading horizon
#

it is

neon bronze
#

I think it was a bool you had to set but no idea which one it was

fading horizon
#

i'm just not sure how to actually use it because i'm not using the default tooltip at all

#

its hidden and replaced with a custom one

#
function UI.ISInventoryPane_drawItemDetails_patch(drawItemDetails)
    local NewColorInfo = ColorInfo:new()

    return function(self,item, y, xoff, yoff, red,...)
        if not item then return end
        --if not (item:getModData().ISA_maxCapacity or isa.maxBatteryCapacity[item:getType()]) then
        if not (item:getModData().ISA_maxCapacity) then
            return drawItemDetails(self,item, y, xoff, yoff, red,...)
        else
            local hdrHgt = self.headerHgt
            local top = hdrHgt + y * self.itemHgt + yoff
            rgbBad.ColorInfo:interp(rgbGood.ColorInfo, item:getCondition()/100, NewColorInfo)
            local fgBar = {r=NewColorInfo:getR(),g=NewColorInfo:getG(),b=NewColorInfo:getB(),a=1}
            local fgText = red and {r=0.0, g=0.0, b=0.5, a=0.7} or {r=0.6, g=0.8, b=0.5, a=0.6}
            self:drawTextAndProgressBar(getText("Tooltip_weapon_Condition") .. ":", item:getCondition()/100, xoff, top, fgText, fgBar)
        end
    end
end```
#

i found this relevant code (towards the bottom)

#

i'm just not sure how it really works lol

upper mason
#

ChatGPT-4 is magnificent to make up mod's name:

#

You're free to guess part of what name I'm using for my mod πŸ˜„

#

For reference: IDF is Independent Defense Force, an organization that also Type V Kardashev scale civilization from "Fight For Universe" series of my mods.

fast galleon
#

nice, you can change it and call it getClosestVehicle as well.

upper mason
#

And this is mod's cover (Midjorney did good job making zombie infested city background):

fast galleon
#

for context you change the option properties. 'option.notAvailbable' to disable and option.tooltip for tooltip text. You can see examples in vanilla.

twilit rune
#

Hello there!
What's the best possible solution to implement setting option that will allow players to change sound volume of the certain vehicle. Changing Volume just for players, not that one responsible for attracting zombies.

fading horizon
#

i think v2 of my mod is finally ready

#

can't think of anything else to do really

upper mason
#

I'm thinking of adding something like zombie evolution over time in my mod. I.e. zombies get stronger, faster & etc over time.

fast galleon
#

game updated a year ago too

upper mason
#

I want to verify something: basically, in order for my mod to properly load profession icon, I need to put it into media/textures/?

fast galleon
#

The version bump that required changes was in 2021?

fast galleon
#

honestly both mods that were working on this quit, maybe you can figure out what they couldn't.

dusty wigeon
#

Im trying to build my first mod and im trying to make a vape mod where you need to use both batteries and vape juice to use it. I am having trouble trying to figure out how to make this.

#

any help or guidance would be greatly appreciated

maiden flower
#

Are there any mods that add vehicle animations?

upper mason
fast galleon
#
  • Is there a way to get and check the models of a vehicle part?

I may have an alternate solution.

ancient grail
#

Those are vanilla models

#

Only did the animations

dusty wigeon
#

I know but I'm trying to make my own to kind of get the idea of making mods. I'll check his out see if I like it

#

ok i just checked his out i like how it has the remaining but i want mine to be able to be refillable and use batteries

#

so mine is different

fading horizon
#

i'm updating mine today lol

#

with that exact function

#

update is ready to go i'm just waiting until morning

#

now it uses both battery and juice level

#

new vapes added

#

stress functions changed

#

new ui

fast galleon
#

suddenly everybody is making vape mods πŸ˜…

opal rivet
#

I know right

fading horizon
#

i'm a trendsetter

opal rivet
#

I don't even know what a GnomeBar is

fading horizon
opal rivet
#

I don't vape nor smoke

fading horizon
#

theres a very ppopular brand of vapes called elfbar

#

to get around trademarks i named mine gnomebars

opal rivet
#

Don't worry you won't get Trademarked

fading horizon
#

i like making it mine in a way

opal rivet
#

It's a mod

fading horizon
#

more fun to come up with stuff than just copy

opal rivet
#

You're not profiting it for money

#

So you will be fine

#

Mods do it everytime

#

I mean It's your mod

fading horizon
#

i really wasn't that worried about it

#

i like the gnomebars name

opal rivet
#

Well If It's for David

#

It's for David

fading horizon
#

huh

dusty wigeon
#

sorry i was just trying to learn

fading horizon
#

you're welcome to look at my code

#

it is commented very well

dusty wigeon
#

thanks ill take a look to see what im doing wrong. I can get the dang thing to use the battery but i cant get it to actually insert the battery like it does for a flashlight. same with the flavor

fading horizon
#

so i pretty much copied the vanilla flashlight battery removal / insertion functions

#
   {
     destroy GnomeBarRB/GnomeBarRB/GnomeBarBlueRazz/GnomeBarWatermelonIce/GnomeBarPinkLemonade/GnomeBarBlackIce/GnomeBarCoolMint/GnomeBarBananaIce/GnomeBarLemonMint/GnomeBarStrawNana/GnomeBarCherryIce/GnomeBarAppleIce/GnomeBarGlitch/GBEmpty/GnomeBarGolden,

     Result:Battery,
     Time:30,
     OnTest:Recipe.OnTest.VapeBatteryRemoval,
     OnCreate:Recipe.OnCreate.VapeBatteryRemoval,
     StopOnWalk:false,
     AllowOnlyOne:true,
     Prop2:Source=1,
   }```
#

then there's an insert recipe for each flavor

#
   {
     destroy GnomeBarRB,
     destroy Battery,

     Result:GnomeBarRB,
     Time:30,
     OnTest:Recipe.OnTest.VapeBatteryInsert,
     OnCreate:Recipe.OnCreate.VapeBatteryInsert,
     StopOnWalk:false,
     Prop2:Source=1,
   }```
#
-- !! When creating item in result box of crafting panel.
function Recipe.OnCreate.VapeBatteryRemoval(items, result, player)
    for i=0, items:size()-1 do
        local item = items:get(i)
        if item:getModule() == "GnomeBars" then
            result:setUsedDelta(item:getUsedDelta());                 -- !! Set the battery used delta to the used delta of the GnomeBar
            -- xx item:setUsedDelta(0);                               -- xx !! Set GnomeBar used delta (Charge) to 0% because the battery has been removed

            local gnomeType = item:getFullType();               -- get the full type of the item (Required by item factory below)
            local modDataOld = item:getModData();               -- Get the old vapes modDate
            modDataOld.Flavor = modDataOld.Flavor or 60;        -- Get the old vapes flavor level remaining  

            local newGnomeBar = InventoryItemFactory.CreateItem(gnomeType); -- Create a new GnomeBar of the same type of the old one

            if(newGnomeBar ~= nil)then                          -- If the new GnomeBar actually exists
              newGnomeBar:setUsedDelta(0);                      -- Set the charge level to 0% since the battery was removed
              local modDataNew = newGnomeBar:getModData();      -- Get the new vapes modData
              modDataNew.Flavor = modDataOld.Flavor;            -- Copy the old flavor level onto the new vape
              player:getInventory():AddItem(newGnomeBar);       -- Add the new vape item to the players inventory
            end
        end
    end
end```
#

then in your recipecode.lua you have something like this

dusty wigeon
#

i tried doing something like that but i couldnt get it to work right

#

except for thatr last one

fading horizon
#
-- !! Return true if recipe is valid, false otherwise
function Recipe.OnTest.VapeBatteryInsert(sourceItem, result)
    if sourceItem:getModule() == "GnomeBars" then
        return sourceItem:getUsedDelta() == 0;                      -- !! Only allow the battery inserting if the vape has no battery left in it.
    end
    return true -- the battery
end```
#
-- !! When creating item in result box of crafting panel.
function Recipe.OnCreate.VapeBatteryInsert(items, result, player)
    for i=0, items:size()-1 do
      if items:get(i):getType() == "Battery" then  
        result:setUsedDelta(items:get(i):getUsedDelta());       -- !! Set the vape to the charge level that the battery had     
      end

      if items:get(i):getModule() == "GnomeBars" then
        local modDataOld = items:get(i):getModData()            -- !! Get the mod data
        modDataOld.Flavor = modDataOld.Flavor or 60             -- !! Get the old flavor level 
        local modDataNew = result:getModData()                  -- !! Get the mod data for the new replacement item
        modDataNew.Flavor = modDataOld.Flavor                   -- !! Set the new item's flavor level to the old item's level
        -- // print("Kept flavor value on transfer")
      end
    end
  end```
#
-- !! Return true if recipe is valid, false otherwise
function Recipe.OnTest.VapeBatteryRemoval (sourceItem, result)
    return sourceItem:getUsedDelta() > 0;                         -- !! Checks if there's actually a battery with charge in the vape
end```
#

those are the functions I use in my recipe code

dusty wigeon
#

so where would i create a recipe code i didnt even know about that

fading horizon
#

media\lua\server\items\yournamehere_recipeCode.lua

#

then in your recipe definitions you have these lines

#
OnCreate:Recipe.OnCreate.VapeBatteryRemoval,```
#

onTest is called before the recipe is actioned to make sure the player has the necessary ingredients

#

onCreate is the function that's called when the recipe is executed (this is the recipeCode.lua file)

#

so if you didn't have those, that's definitely at least one reason why you're having difficulties

dusty wigeon
#

yea i didnt have any of the coding like that

fading horizon
#

you're also going to run into issues with how to actually make the item have a context menu action

#

if you make it a food with a custom eat context menu label, you lose the option for it to be a drainable item

#

to get around this I made completely custom tooltips and hid the vanilla one

dusty wigeon
#

thats the issue i was having

fading horizon
#

with a custom context menu entry

#

and then that entry when clicked, calls my custom timed action (the actual vape action)

#

its quite a bit of code

dusty wigeon
#

yea im starting to feel really dumb at this point

fading horizon
#

nah don't feel that way

#

i started modding from no knowledge like

#

2.5 weeks ago maybe

#

march 20

#

so if I can do it, I'm sure you can too

#

this is a godsend for learning lua

dusty wigeon
#

i see where when you remove the battery from the gnombar it destroys the gnomebar. Is there a way that it can be removed without destroying the gnomebar for lets say i want to create some sort of charger in the future for the batteries

fading horizon
#

I tried that

#

the issue with drainables and crafting recipes is that the optional quantity variable on the drainable is for it's uses

#

so if you type keep GnomeBarRB instead of destroy

#

that means the recipe is only using one charge of the battery of the item for the recipe

#

so in theory you could put something like Keep GnomeBarRB = 50 which would mean it would require 50% of charge in order for the recipe to be valid

#

this becomes an issue because you don't have a way to get the battery charge prior to the recipe definition so you'll never know how much charge the player has, therefore you can't create a recipe that will consistently work

#

oh

dusty wigeon
#

dang

fading horizon
#

i actually documented this exact problem

#

and the troubleshooting

#

just last night

#

if you want to take a look

#

it was showing the "All" option because it was only using 1 charge use from the vape

#

so technically that action could be done 99 times

#

so instead, the recipecode.lua first gets the charge of the battery that you're inserting and makes a new vape with that level of charge

dusty wigeon
#

thats so wierd

#

yea i have very little knowledge but i keep trying i just squirrel so easy

#

ive created the vape mod like the one u smoke, the vape battery, and then the vape juice just been having issues with them working with eachother. Only way i was getting them to work with eachother was really janky cause i had the vape charge off a battery but it would only consume part of the battery then you had to have the juice in hand. so it was really wierd

#

I appreciate the help

grizzled isle
#

Oo yay spiffo

fading horizon
#

of course, happy to help

#

i just pushed the update for my mod

dusty wigeon
#

just noticed this thought id let ya know

#

no option to vape or smoke

upper mason
#

How do I check in my mod, if other mods are used? So I can add if modID in modList then ... end?

frank elbow
sour island
#

Basically runs the ingredients as arguments to bounce checks off of

#

There should be some examples in recipecode.lua

craggy ruin
#

what lua functions do you use in order to check when a player is connecting to your server ?

merry storm
#

Hi, i would like some help about how the funcions and methods work in Pz modding, im trying to just spawn a zombie in a point but i keep getting an error, this is my code rn, i tried to make it simple until i know how this works

#

its becomes this error in debug mode; "java.lang.RunTimeException: Object tried to call nil in spawnZombieEverytenMinutes"

fast galleon
merry storm
#

@autumn garnet @fast galleon Thank you for the response! Sorry i send it with the getVirtualZombieManager, it was a try that i read from an old post in indieStone, the problem it was i wasnt using VirtualZombieManager.instance: . Dont know why that instance is needed but seems to work.
And i read that documentation but didnt saw anything about that, maybe its something from lua that i dont know, still learning.

ancient grail
#

OnWeaponSwingHitPoint
vs
OnWeaponSwing

whats the difference again?

autumn garnet
merry storm
autumn garnet
#

Like dynamic spawning horde with radio annource ? ^^

merry storm
#

Ofc wont be easy, they must be prepared

autumn garnet
#

I talk about this with Spacew00t and yoshiwoof ^^ it's a great addon for the game dynamics quest/random horde with announcement on emergy broadcast to be link with Save Our Station

#

For me the radio part isn't easy ^^ i have already the spawnHorde script like you

merry storm
# autumn garnet I talk about this with Spacew00t and yoshiwoof ^^ it's a great addon for the gam...

Yeah, exactly. I want to spice things a bit on the game, some loot crate loots surrounded by zeds, or having to go to a Hospital to a certain floor to get a cure for infection, horde coming and even some sort of multi event where you need each part, like a map that spawned in some point and a code that spawned somewhere else and with both things you can retrieve the special loot, etc. Still need to see what can you do with the game

#

I suppose the npc part is still no available even for just being more realistic

ancient grail
#

Pao did 2 of those mods
But its for our clients specific needs
Lore of their server and map setup is just for their server

But that one of the things we offer
Is to provide what we called
Server Events Mod

#

@merry storm

autumn garnet
merry storm
merry storm
red tiger
#

Good morning.

#

More modding teams popping up.

#

What if I made a team? lol.

torn igloo
#

I have made an vehicle claiming mod and currently, I am using sandbox settings for server owners in general to append trunk cover parts for mod vehicles with their own different trunk cover parts naming.

I am wondering if there's already an library or some modders made one in their mods to retrieve or generate these part names of mod vehicle?

ancient grail
#

Kwrr right? πŸ™‚

thorn cipher
#

Just as a thought. Those with more knowledge. How easy would it be to create this black text background in game?

nova dome
torn igloo
ancient grail
frank elbow
#

In terms of drawing it behind text, the text manager (you can get it with getTextManager() has methods to measure a string X and Y that could help position it. May not be strictly necessary to do all that since there are existing components, but either way I think the answer to the question is "not too difficult"

#

It just occurred to me that you may be talking about doing that for player chat textβ€”if so, I amend all of what I just said to instead read "dunno" (not at my home computer to check)

red tiger
#

Made some progress on translating documentation for Food properties this morning..

#

I'd like to get some template commands into my VSCode extension. If I can get some templated item scripts or other types, that'd help.

#

like a command: New Food would spawn a basic food item entry into the script document.

#

This is entirely doable however I'd need help for this.

frigid gyro
fast galleon
frank lintel
#

Should be one for it or something related to the actual program since some shows give XP in specific fields

late flax
#

I would ask
zombie:setOnlyJawStab(true)

#

What does it mean to be jawstab?

bronze yoke
#

that's probably the short blade instakill attack

late flax
#

πŸ€”

#

mean that spear cannot instakill?

#

only short blade?

bronze yoke
#

spear has its own instakill mechanic

#

as well as crits that usually instakill anyway

civic forge
#

Can anyone guide me to a good tutorial to understand how to actually make a mod for this game. i have been trying for a few hours now but getting nowhere the amount of guides for this kind of stuff is very scarce which is odd given how many mods are available for this game, i have been using a lot of mods and would like to make my own to improve my and other people experience's

frosty stirrup
#

Hello dear Zomboid modders, is there a guide or an example mod you could recommend that would help me learn how to PATCH existing item definitions and functions, instead of overwriting them? I.e. add tags to an existing item, instead of redefining it.

frosty stirrup
civic forge
bronze yoke
frosty stirrup
#

No, it loads code from the mod after main game, @civic forge . It doesn't really copy any files.

#

@bronze yoke That is clever, basically you parse the item via LUA and modify it. I didn't even think about it, thank you.

civic forge
#

Mods are basically a part of the main directory thats what i wanted to know thats what i thought when i saw the same folders for the mods and the main directory

frosty stirrup
#

If you don't mind, I would like to understand better how hook works.

  1. I name the existing game function as something new
  2. Then I define in this new function whatever I want + call old function

What exactly does "old_funcName = funcName", could you waste a minute of your time and give me insight on what it does?

calm depot
frosty stirrup
#

@civic forge It's important to understand that mods are NOT a part of main directory. They carefully reflect a similar structure, but not everything in main directory can be modified. Yet, if it makes it easier to understand, go for it

bronze yoke
frosty stirrup
#

@bronze yoke , @calm depot Thank you, for finding time to give me insight and making me learn.

civic forge
calm depot
#

small edit, that was meant to say "local function", not just "function"

civic forge
#

ofcourse they aren't part of the main directory thats why they are a "mod"

frosty stirrup
#

@bronze yoke Aha, so in local old_funcName = funcName

old_funcname - is just a placeholder variable that gets called later
funcname is the actual name from the game

At first I thought that old_funcname is the "original function name", and that made no sense.
Now it is clear, thanks a lot

calm depot
#

actually no, I take it back, since you're redefining, you shouldn't use "local" πŸ™‚

bronze yoke
#

πŸ˜…

fast galleon
#

can I make a recipe that doesn't require anything? Or is there an item that always exists on player?

Recipe exists
There's no source item to check if recipe can be done.

calm depot
#

try it - if it doesn't work, you could always just make it require a single, extremely common thing and make it use the item without consuming it

frosty stirrup
#

Alright, time to go and rewrite the code of my "Shout sound" that basically hacked and overwrote emote wheel function to make sound when you yell. Now I can make it a proper patch. Thanks a lot!

#

@bronze yoke A sanity check before I commit, following your logic, is it what overwriting IsEmoteRadialMenu:emote(emote) should look like?

#

I mean patching to the end of it, not overwriting

red tiger
#
print('Hello, #mod_development!');
frosty stirrup
#

Pardon, there was a type

bronze yoke
#

when a lua function is defined with : there is an implicit self parameter

red tiger
bronze yoke
#

so you should call old_ISEmoteRadialMenuEmote(self, emote)

red tiger
#

Also you can be evil as a modder by using anonymous functions to shell your mod's logic.

frosty stirrup
#

Ah, that's what : is. Thank you

bronze yoke
#

and you should grab the function like
local old_ISEmoteRadialMenuEmote = ISEmoteRadialMenu.emote

frosty stirrup
#

I'll fix it and use proper tags as Jab showed me, thank you

mossy steeple
#

hello! a bit new to zomboid modding and having a spot of trouble. i'm trying to add a new backpack (just a duffel bag with the stats of the military bag) and it shows up just fine when i'm holding it in my hands, but is completely invisible on my back. i'm fairly certain i've isolated the issue to this file here but i've not had much luck finding where exactly the issue is

frosty stirrup
#

@bronze yoke
What about this, should it be
ISEmoteRadialMenu:emote = function(emote)
or
ISEmoteRadialMenu:emote = function(self, emote)
?

bronze yoke
#

it should be the first

frosty stirrup
#

So

local old_ISEmoteRadialMenu = ISEmoteRadialMenu.emote

ISEmoteRadialMenu:emote = function(emote)

    old_ISEmoteRadialMenu(self, emote)

    if emote == "shout" then
        self.character:Callout(false);
        -- Adding sound to shouting via radial menu
        local dist = 2
        local gender = ""
        local loudness = ""
        local pl = getPlayer()
        local VoiceKind = ""

        if pl:isSneaking()
            then
                loudness = "whisper"
                dist = 5
            else
                loudness = "shout"
                dist = 40
        end

        if pl:getDescriptor():isFemale()
            then
                gender = "female"
            else
                gender = "male"
        end

        VoiceKind = tostring(loudness.."_"..gender)
        getSoundManager():PlayWorldSound(VoiceKind, pl:getSquare(), 0, 0, 0, false); 
        addSound(pl, pl:getX(), pl:getY(), pl:getZ(), dist, 0);
    end
end
fast galleon
bronze yoke
#

looks good to me!

frosty stirrup
#

Is it a mod I missed on workshop, @fast galleon ? πŸ™‚

#

I like Callout patch a lot more than patching ways to access callout

bronze yoke
#

when you define a function with : it adds the self parameter automatically, and when you call one with it it passes the object on the left side of the : as self (so ISEmoteRadialMenu:emote("shout") passes ISEmoteRadialMenu as self)

balmy pagoda
frosty stirrup
#

Sorry

#

I feel silly

balmy pagoda
#

It's fine

#

Actually quite funny

mossy steeple
frosty stirrup
#

I was wondering, since I only know C#, what : was about. I was kind of using it blindly so far, 1st day modding πŸ™‚

bronze yoke
#

the interpreter will read function object:method() exactly the same as function object.method(self), it's just different syntax

frosty stirrup
#

@fast galleon I understand what your script does, and it does it well. Much better than me hijacking Shout button or Radial menu action.
Is it one of mods you've posted? I would rather use your approach, but I don't want to blindly steal code especially if it's already used elsewhere.

fast galleon
#

I made this but the sounds are grabbed from the web

frosty stirrup
#

Can you share the workshop link?

fast galleon
#

I only have a local copy now

frosty stirrup
fast galleon
#

sure

frosty stirrup
#

I will add some more code since I check for gender as well

#

Oh, also you seem to use PlaySound, I used PlayWorldSound, with a distance. How does PlaySound work in MP?

fast galleon
#

the initial idea was to add possible sounds to ISPlayerData and then pick one

frosty stirrup
#

I thought playsound plays only for the player itself

mossy steeple
#

i'm getting this error as well, and i've checked and triple checked to make sure i've referencing the right file and i definitely am

#

wait. i am a fool. i forgot the file extension.

frosty stirrup
mossy steeple
#

where are the item icons stored in the files? they don't seem to be with the textures

bronze yoke
#

i think it has to be ISEmoteRadialMenu.emote = function(self, emote) or function ISEmoteRadialMenu:emote(emote)

empty flame
#

anybody working on a bicycle mod

frosty stirrup
#

Woah, cool knockback

scarlet zinc
#

Um, there used to be a function reference list on PZwiki, I can't find it anymore, was that being replaced by something else?

bronze yoke
scarlet zinc
#

Yes, but it was more of them.

frosty stirrup
# bronze yoke ```lua -- hook function local old_funcName = funcName funcName = function(...) ...

Hey @bronze yoke , I am trying to use your approach to modify items via LUA, but it does nothing.

I think it's because my function is not called anywhere? What is the proper method to call function on game start/load?
Example for debug purposes that doesnt work


function TagAllItems()
    self.items = getAllItems();

    for i=0,self.items:size()-1 do
        local item = self.items:get(i);
        if not item:getObsolete() and not item:isHidden() then
            if string.find(item.getDisplayName(), "tire") then
                item.Name = "Changed Tire Item"
            end
        end
    end
end
bronze yoke
#

if you want to do it on game start, you can just not put it in a function, or call your function after defining it

frosty stirrup
#

oh, you mean just use .lua as a function, and the game calls the whole lua file when it loads it?

#

that sounds... logical πŸ˜„

bronze yoke
#

also, you're going to want to use item:setDisplayName(), not item.Name =

frosty stirrup
#

I think two months on overtime work caused me a brain damage πŸ˜„

bronze yoke
#

also in this case self isn't declared anywhere, you can safely just drop all the self references

frosty stirrup
#

I was looking at how ISItemsListViewer works, so I obviously didn't get where self came from there

bronze yoke
#

most likely the functions use :s and self is the ISItemsListViewer table

frosty stirrup
#

it also doesn't want to index "items" done this way

#

Yeah, it was function ISItemsListViewer:initList()

#

Oh, I have a very stupid question that probably messes up everything in my code

#

Why do some lines have ";"?

bronze yoke
#

because TIS are mostly java devs πŸ˜… ; does nothing in lua

#

well it does something

frosty stirrup
#

Oh, I was trying to figure it out for like 5 min πŸ˜„

bronze yoke
#

it breaks the line, so you can do multiple lines in one line with it

#

but putting it at the end of a line doesn't do anything

frosty stirrup
#

Hmm, I made it worse πŸ˜„

#
function tagTires()
    local items = getScriptManager():getAllItems()
    
    for i=0,items:size()-1 do
        local item = items:get(i)
        item.SetDisplayName("Item")
    end

end

tagTires()

This looks fine to me, but causes NIL on the last line

#

when I try to call the function

bronze yoke
#

should be item:setDisplayName, not item.SetDisplayName

frosty stirrup
#
function: tagTires -- file: tagAllTires.lua line # 5 | MOD: YMC - Rip car tires
function: tagAllTires.lua -- file: tagAllTires.lua line # 13 | MOD: YMC - Rip car tires

ERROR: General     , 1681250898175> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getObsolete of non-table: null at KahluaThread.tableget line:1689.
#

I think it dislikes me trying to get (i) from items, no?

bronze yoke
#

attempted index: getObsolete of non-table sounds like it's still running some old code

frosty stirrup
#

like it's a null list

#

oh wait no I am stupid, I rewrote it a bit

#
function tagTires()
    local items = getScriptManager():getAllItems()
    
    for i=0,items:size()-1 do
        if not item:getObsolete() and not item:isHidden() then
            local item = items:get(i)
            item.SetDisplayName("Item")
        end
    end

end

tagTires()
#

oops

#

item is on wrong line

#

I need coffee πŸ˜„

#

But I think I have the most trouble with this

#

should be item:setDisplayName

#

Should I be calling ALL methods of instantiated classes as "self"?

#

Or what is the logic behind it?

bronze yoke
#

yeah, unless it's a static you always use :

#

for java methods anyway

fast galleon
#

item.setDisplayName(item,"Item") should work too, if it helps.

frosty stirrup
#

So I still be breaking the game, with buffer overrun for sprites etc

#
function tagTires()
    local items = getScriptManager():getAllItems()
    
    for i=0,items:size()-1 do
        local item = items:get(i)
        if not item:getObsolete() and not item:isHidden() then
            item:SetDisplayName("Item")
        end
    end

end

tagTires()
#

I cannot see it

#
function: tagTires -- file: tagAllTires.lua line # 7 | MOD: YMC - Rip car tires
function: tagAllTires.lua -- file: tagAllTires.lua line # 13 | MOD: YMC - Rip car tires

LOG  : General     , 1681251199211> Object tried to call nil in tagTires```
bronze yoke
#

setDisplayName

frosty stirrup
#

oh, is it the Linux Filesystem trouble again? πŸ˜„

#

Oh no πŸ˜„

#

I thought the capitalization is optional

frosty stirrup
#

Great, I made it to work, but now I need to figure out why string.find behaves not how I expect it to be

#
function tagTires()
    local items = getScriptManager():getAllItems()
    
    for i=0,items:size()-1 do
        local item = items:get(i)
        if not item:getObsolete() and not item:isHidden() then
            if string.find(item:getDisplayName(), "tire") then
                item:setDisplayName("Generic Tire")
            end
        end
    end

end

tagTires()```
#

does it also check for capitalization, so it doesn't affect Tires?

#

Indeed it does lol

#

Now it all works, so I finally can put tags on items if they have something in the name

#

So much trouble just to learn how to slap tags on items by name.

#

But so much learnt.

#

Thank you very much for the patience.

mossy steeple
#

does anyone have a link to a resource on how the random tint/coloration thing works for clothing? the custom bag i've made generates properly as a random colour and keeps that as long as i only wear it on the back or set it on the floor, but holding it in either the primary or secondary slot wipes the colour and sets it to the default white

frosty stirrup
#

@bronze yoke And I just realized that [Recipe.GetItemTypes.SharpKnife] is actually a call to a LUA function lol πŸ˜„

#

What would be the best way to make a new tag then, should I create a new LUA function like Recipe.GetItemTypes.MyTag?

bronze yoke
#

yeah something like that

frosty stirrup
#

Interesting, simply making a new function like

function Recipe.GetItemTypes.Tire(scriptItems)
  scriptItems:addAll(getScriptManager():getItemTag("Tire"))
end

does not work, it creates an error spam in console about an attempt to index a non-table

fast galleon
#

That's for items that have the tag in their scripts already.

frosty stirrup
#

yeah, and just above I added the tag

fast galleon
#

what folder do you do this in btw?

frosty stirrup
#

function tagTires()
    local items = getScriptManager():getAllItems()
    
    for i=0,items:size()-1 do
        local item = items:get(i)
        if not item:getObsolete() and not item:isHidden() then
            if string.find(item:getDisplayName(), "Tire") or string.find(item:getDisplayName(), "tire") then
                local tags = item:getTags()
                if not tags:contains("Tire") then
                    item:setDisplayName("I am a tire")
                    tags:add("Tire")
                end
            end
        end
    end

end

tagTires()

function Recipe.GetItemTypes.Tire(scriptItems)
    scriptItems:addAll(getScriptManager():getItemsTag("Tire"))
end
#

Like this, in media/lua/client

#

setDisplayName works, but adding tag on its own does nothing since I cannot refer to it in crafting scripts

fast galleon
#

the Recipe table is created in server folder, which loads after client folder.

frosty stirrup
#

oh

#

And where does Shared go?

#

before/after?

fast galleon
frosty stirrup
#

woah, it was the load order problem

#

thanks a lot

#

loading as a server solved it

fading horizon
#

Making a chess mod

frosty stirrup
#

Are you.. using elif to print all combinations of positions on the board? πŸ˜„

fast galleon
ancient grail
fading horizon
ancient grail
#

for what

#

ahhhh]

#

ok i get it

echo fiber
#

this might be a silly question but where can i find the base games tooltips file? im trying to get a reference of what they look like or how to even wright them so that way i can finish this mod lol

Example:

I keep seeing
Tooltip = Tooltip_item_Campfire,

But idk where that is coming from

frosty stirrup
bronze yoke
#

πŸ˜‡

primal remnant
#

General Plea: Is there anyone who could show me an example of their workflow for actually using lua instead of plain text files? Or maybe a mod that I can skim through to learn with?

#

Conceptually I understand what decompiling is and how to do it, but I'm having a hard time understanding WHAT to do with the stuff I see. I can offer coffee in exchange for the assist πŸ™‚

frosty stirrup
#

hey Captain

#

I am new, but maybe I could also help if you could tell us more what is the actual problem

#

People here are VERY helpful

#

Are you struggling with syntax, API, editor or something else?

#

There's no decompiling involved

primal remnant
#

I can edit the text files to create new items, and even 3d models with textures. But editing the "deep" code eludes me. I need to change some values around and I don't know how to even begin approaching the issue.

frosty stirrup
#

Aha, do you know LUA syntax?

primal remnant
#

The functions() methods() and such are the thing I struggle with

#

A bit. I've read a few tutorials and Im versed in C, C++

#

The blending of java makes it.... sussy

frosty stirrup
#

I am also versed with C++ and C#

#

Lua is... different

#

Just today I was told that indexes in arrays start with 1 πŸ˜„

primal remnant
#

Yupo

frosty stirrup
#

As for actual game code, you would want to simply do two things

primal remnant
#

Ok Ill give it a look see.

frosty stirrup
#
  1. Most of game code in LUA is here: C:\SteamLibrary\steamapps\common\ProjectZomboid\media\lua
#

You can find most of objects, methods and functions there

#

After that, I guess it's just practice

#

I am in the same boat, trying small stuff first

#

What I usually do is

  1. Find a mod that does something I want to learn how to do
  2. Check what it does and how
  3. Note original game functions it touches
  4. CtrlF "all in files" in \steamapps\common\ProjectZomboid\media\lua using Notepad++ and see what those functions actually do
  5. Rewrite or patch them adding my own code
#

Albion helped me a lot to learn how to modify existing items, and Poltergeist - functions

bronze yoke
#

when i need lua i search the lua folder with my ide, and when i need java i use the api reference to find stuff that seems relevant and then check the decomp to see if they actually do what i want them to do

frosty stirrup
#

Ah, I havent got to decomp yet πŸ˜„

#

Fixed the links

primal remnant
#

Thats the part I want to break into but I'll check out these resources first and try some kitbashing. If I need some more assistance after that I'll reach out to You or Albion. Thank you both for your input

frosty stirrup
#

I wouldnt have learnt and finished these two small mods without huge help here

#

So dont be shy πŸ™‚

echo fiber
#

so having an issue with the mod im working on with a friend, we finally got it to have a use delta and have it give the play a small boost but it seams we cant use it not sure why any suggestions?

frosty stirrup
#

Could you post the item code?

#

How is it setup?

echo fiber
#

item RedVape
{
FatigueChange = -12,
Weight = 0.2,
UseDelta = 0.1,
Type = Drainable,
UseWhileEquipped = FALSE,
DisplayName = Red Vape,
Icon = RedVape,
Tooltip = Tooltip_Vape_RedVape,
StaticModel = RedVape,
Medical = TRUE,
}
}

#

thats what it looks like right now

#

the old one we did use was

item RedVapeOLD
{
DisplayName = Red Vape,
DisplayCategory = Vapes,
Type = Food,
Weight = 0.5,
Icon = RedVape,
Packaged = TRUE,
UnhappyChange = -25,
StressChange = -15,
EatType = Cigarettes,
RequireInHandOrInventory = VapeJuice,
ReplaceOnUse = EmptyVape,
CustomContextMenu = Vape,
CustomEatSound = vapeinhale,
StaticModel = RedVape,
WorldStaticModel = RedVape,
}

bronze yoke
#

it's not a food anymore so you can't 'eat' it anymore

frosty stirrup
#

Have you tried Type=Drainable?

#

wut UseDelta=0.1 for example?

echo fiber
#

im using the Vitamins as a base for this vape lol

frosty stirrup
#

    item PillsVitamins
    {
        DisplayCategory = FirstAid,
        FatigueChange    =    -2,
        Weight    =    0.2,
        UseDelta    =    0.1,
        Type    =    Drainable,
        UseWhileEquipped    =    FALSE,
        DisplayName    =    Vitamins,
        Icon    =    Vitamins,
        Tooltip = Tooltip_Vitamins,
        StaticModel = PillBottle,
        WorldStaticModel = Vitamins_Ground,
        Medical = TRUE,
    }```
echo fiber
frosty stirrup
#

You don't πŸ™‚

#

Vitamins type = drainable

#

with usedelta 0.1

#

Ah I am stupid

#

I looked on 2nd

#

let me think, sorry

echo fiber
#

lol yea my bad the second one is the old script i was using the first one is the new one

frosty stirrup
#

It's been a long day

echo fiber
#

haha your fine

#

unless i need CustomContextMenu

#

so that didnt work but when i look at the item code for vitamins it says nothing about take pills in it, so where does the script call for that?

frosty stirrup
#

Only antibiotics seem to have CustomContextMenu

echo fiber
#

are they drainable?

frosty stirrup
#

nope

echo fiber
#

ahh yes that is a food

frosty stirrup
#

have you tried keeping DisplayCategory, maybe it's tied to that via some script?

echo fiber
#

i can try one seconded

echo fiber
#

im going to fully copy the vitamins script and not touch it at all to see if its useable in game first or if im just missing something when im doing this

#

so even just taking that item script right from vitamins its not giving me the ability to consume it so there is another file touching it giving it the Take Pills option but idk where that could be

bronze yoke
#

it might just be implemented in lua

echo fiber
#

how would i go about making an lua for making it smokable?

#

as i left everything the same it kinda just did this XD and its still not useable

frosty stirrup
#

I do not see anything about PillsVitamins in lua besides distribution and translations

echo fiber
#

so how does the game know its to Take Pills 😦 (or can i write a lua to make it smokeable)

frosty stirrup
#

This is a very good question, I am confused now πŸ™‚

echo fiber
#

xD i am too!

frosty stirrup
#

For example, WoodGlue is also Drainable type with UseDelta, but you cannot "take" it πŸ˜„

echo fiber
#

just like welding pipes XD

frank elbow
#

The terror that filled my soul

echo fiber
#

like a water bottle or a soup

frank elbow
#

Looks like the context menu code just checks if its type starts with "Pills"

#

Not the first example I've seen of something like that; hopefully will be replaced with tags eventually

echo fiber
#

so try putting pills in the code name?

frank elbow
#

In the name of the type, not including the module name

#

So Vitamins are "PillsVitamins" in their item script

echo fiber
#

so like that?

frosty stirrup
#

Yep

#

Omar is right

bronze yoke
#
        if not ISInventoryPaneContextMenu.startWith(testItem:getType(), "Pills") then
            isAllPills = false;
        end

...

    if isAllPills then
        context:addOption(getText("ContextMenu_Take_pills"), items, ISInventoryPaneContextMenu.onPillsItems, player);
    end
frank elbow
#

Yes, although I wonder if it'd be better to just add your own

bronze yoke
#

it's implemented in lua

frosty stirrup
#
module Base
{
    item PillsVitamins2
    {
        DisplayCategory = FirstAid,
        FatigueChange    =    -2,
        Weight    =    0.2,
        UseDelta    =    0.1,
        Type    =    Drainable,
        UseWhileEquipped    =    FALSE,
        DisplayName    =    MyVitamins,
        Icon    =    Vitamins,
        Tooltip = Tooltip_Vitamins,
        StaticModel = PillBottle,
        WorldStaticModel = Vitamins_Ground,
        Medical = TRUE,
    }
}
echo fiber
#

okay so is there a way i can make a lua that makes it say Use Vape?

frosty stirrup
#

you could just use context:addOption(getText("ContextMenu_Take_pills"), items, ISInventoryPaneContextMenu.onPillsItems, player);

echo fiber
#

lol would this be the time to tell you idk how to write an lua XD

frank elbow
#

It's never too late to learn

#

The answer to your question is yes there is a way & I'd probably do it using that

echo fiber
#

is making it do what take pills does and turn it to use vape do-able?

#

so the thing you sent?

frank elbow
#

Can you rephrase that question? I'm not sure what you're asking

echo fiber
#

so with my vape could i have the name base where it would say

"item VapeRed"

and where it has "Vape" have it act like how the Pills works for vitamins?

frank elbow
#

That would be doable yes, but I think you'd be better off utilizing tags

#

Scripts can specify tags that you can check for in Lua. The vanilla code uses a few of these, like HasMetal

bronze yoke
#

yeah this whole startwith thing sounds like a nightmare for mod compatibility

echo fiber
#

so make a tag that says "KVape" and if it has this tag it would call to the lua then use the context menu?

frank elbow
#

Yeah, you'd check for the tag in your code to add the behavior you want

echo fiber
#

that link you sent me is that for making a lua with a tag context menu?

#

if not could i get a base line to work with if someone does not mind helping me

frank elbow
#

I'd take a peek at some of the vanilla code or other mods that add context menus to see how to use it

echo fiber
frank elbow
#

Plenty do, but I don't know off the top of my head, no

#

I know @fading horizon made a vape mod recently, so she may be of help

echo fiber
#

she was helping my friend earlier XD >.< but we didnt want to rip off her code so we went down the pill idea rout haha

echo fiber
balmy burrow
#

How do i learn to make mods for this game?

frank elbow
frank elbow
balmy burrow
#

Ballin

#

Thanks

echo fiber
bronze yoke
#

vanilla actually does it weirdly

#

i think the event is fired by vanilla lua, so it doesn't do it the way mods should

frank elbow
#

Yeah, trueβ€”I should've specified that

echo fiber
#

so i found this mod that uses this

frank elbow
#

Vanilla code can be useful to show you how to add context menu items, but not really how to use the event (unless you look at the two files that use it, but they use it differently)

echo fiber
#

but im not sure how to link this to a tag >.<

frank elbow
#

Search for the part on the left in the mod's code

#

That'll show you where they use it

echo fiber
#

how do i search for it in the other codes in VS

frank elbow
#

Ctrl + Shift + F

echo fiber
#

what part of this would i be searching the contextMenu?

rancid panther
echo fiber
#

0.o

frank elbow
#

The part on the left of the equals sign

echo fiber
#

thats not very good food XD

rancid panther
#

i dont remember clearly but when i was reading the code a while back the lua uses "Context_OnEat_Ampule" or something like that

echo fiber
#

and so far am confused lol

ancient grail
#

MOD IDEA:
put a zed to the ground
attach a bag to it
have it follow you

ZedMuleMod

frosty stirrup
#

Lol, dont take modding advice from me ValZaren

#

I've managed to make it work by breaking every other context menu πŸ˜„

echo fiber
#

XD

#

So proud of you!

rancid panther
#

a game where you muzzle and mind control zombies to do work for you

echo fiber
#

One second!

frosty stirrup
#

I need to learn to work with context menus at least once

echo fiber
frosty stirrup
#

It's 4:04 AM here. Brain.exe not found.

echo fiber
#

it gets the menu but i fully broke it XD

#

it wont drain lol this is what i did

#

it no liked that haha

frosty stirrup
#

Ah, you are trying to work with customcontextmenu directly in scripts, I was trying LUA

echo fiber
#

lol im afraid of LUA wanted to see if i can avoid it and nope

#

i have to make the lua for it >.<

frosty stirrup
#

Did you make Vape menu?

#

What does it look like?

echo fiber
#

lol i dont have one

#

was looking at someone elses mod to try to make one but i have no clue how to even start it

#

i just wanna make the item usable like pills but with a tag so i can have

Tags = KVape

then have the context menu say something like Use Vape

calm depot
#

general advice for finding code:

  1. find the translation string for whatever the game already has (e.g. "Take Pills")
  2. search for that translation string in the code
echo fiber
calm depot
#

if you are searching manually, you are doing it wrong

frosty stirrup
#

Ctrl-F -> Find in Files in most of editors

#

I use Notepad++

echo fiber
#

visual studios is what im using

calm depot
#

you're using a machine with orders of magnitude more power than the rocket that landed on the moon.

download a search tool, Visual Studio/VSCode can also search through folders

echo fiber
frosty stirrup
#

So I've learnt how to add a context menu

#
Vape = {};

Vape.doMenu = function(player, context, items)
    local vape = nil;
    
    for i,v in ipairs(items) do
        local tempitem = v;
        if not instanceof(v, "InventoryItem") then
            tempitem = v.items[1];
        end
        if tempitem:getDisplayName() == "MyVape" then
            vape = tempitem;
        end
    end
    if vape ~= nil then
        context:addOption(getText("ContextMenu_Take_pills"), items, nil, player);
    end
end

Events.OnFillInventoryObjectContextMenu.Add(Vape.doMenu);```
#

Sadly that menu does nothing

#

Where are context menus defined again? πŸ˜„

#

or is it "nil" in addOption that makes it do nothing?

calm depot
#

you need to provide a callback function

frosty stirrup
#

aha

calm depot
#

if the player clicks your menu item, the callback runs

echo fiber
#

all i can find for context menu was this but i dont think this was the part i needed was it

calm depot
#

that is what you need. You can now search the lua code for ContextMenu_Take_pills

frosty stirrup
#

Can I make a callback on default function that is called for standard pills?

calm depot
#

your function gets passed a list of items you can implement whatever logic you like to determine whether or not you want to add context menu item(s)

echo fiber
calm depot
#

also, I don't recommend using DisplayName since that will differ depending on the player's language. you should in the ideal case, use tags. If you can't use tags because it's not an item you're creating, use its internal name instead

frosty stirrup
#

"name" is the internal name, right?

calm depot
#

Google "Visual Studio (code?) search for text in folder"

#

I believe that is the one, yes, you can always print it to the console to verify

#

also, even if it's not an item you're creating, you should check if it has tags

bronze yoke
#

i'm not sure what name returns in contrast to display name, but for the internal name you use getType() or getFullType()

#

full type including the module

calm depot
#

true, getFullType() will be the most accurate, but will also make your code more inflexible. If you utilise tags, it makes it easy to add new items with the same tag, and your code will just work with them

bronze yoke
#

definitely use tags if you can

#

don't hardcode anything you don't have to

echo fiber
#

was this what im looking for?

calm depot
#

yep

#

that's where it adds the menu item

echo fiber
#

okay so what do i do from here XD

calm depot
#

the third argument is the callback function

echo fiber
#

thats the getText right?

calm depot
#

um, if you don't know how to code then you're trying to walk before you can crawl

#

no, that's the first argument

frosty stirrup
#

@calm depot Is DisplayCategory also affected by languages?

calm depot
#

I don't think so, but are you really sure you want to match on that?

frosty stirrup
#

yep

#

I want to tag all items that have VehicleMaintenance display category and Tire in the name as "tires"

#

including other mods

calm depot
#

wouldn't it make more sense to see if it has the WheelFriction attribute instead?

#

you shouldn't need to check anything other than that

frosty stirrup
#

Good news, displayCategory is not affected by language πŸ˜„

#

There was only one way to find out for sure

echo fiber
#

is there a youtube video for making a context menu >.< im struggling over here with making a tag connect and recall to a context menu to make the item smokable

frosty stirrup
#

I assume it's 0.0 if it's not defined?

calm depot
#

I imagine it'll just be nil

#

fetch the value for something like a Pen and see

echo fiber
#

so i got the two context menu parts for the take pills but im not sure where to go from here, i know im a noob at this but do i need anything else than this to create what im doing?

frosty stirrup
#

@calm depot Nope, not nil

#

0

calm depot
#

well, that should be good enough

#

no actual wheel should ever have 0 friction

frosty stirrup
#

As long as some crazy modder doesn't make a pen with wheelfriction πŸ˜„

#

I think I will combine DisplayCategory and this

calm depot
#

honestly, if they do, that's on them

frosty stirrup
#

Uh, I was wrong

calm depot
#

no point writing code to defend against someone else being hypothetically stupid

frosty stirrup
#

I get LOG : General , 1681264277374> Object tried to call nil in tagTires

#

With this

function tagTires()
    local items = getScriptManager():getAllItems()
    
    for i=0,items:size()-1 do
        local item = items:get(i)
        if not item:getObsolete() and not item:isHidden() then
            if item:getWheelFriction() then
                local tags = item:getTags()
                if not tags:contains("Tire") then
                    tags:add("Tire")
                end
            end
        end
    end

end

tagTires()

function Recipe.GetItemTypes.Tire(scriptItems)
    scriptItems:addAll(getScriptManager():getItemsTag("Tire"))
end
#

It looks that I am not correctly checking NIL here?
if item:getWheelFriction() then

calm depot
#

you mean getWheelFriction entirely fails for something that isn't a wheel?

frosty stirrup
#

yeah, it throws an error "tried to call nil"

calm depot
#

perfect

#

if item.getWheelFriction then

bronze yoke
#

getWheelFriction is a method of InventoryItem, not Item

calm depot
#

all you care about doing is checking if the function exists

#

don't need to actually invoke it

frosty stirrup
#

duh, it is a method of inventoryitem

#

getDisplayName is too though

calm depot
#

ah, then it would also fail for an actual wheel

frosty stirrup
#

And it works

bronze yoke
#

getdisplay is both

frosty stirrup
#

Ah, it belongs to both

#

so, back to checking names and displaycategory huh? πŸ˜„

#

oh, it has VehicleType

calm depot
#

@bronze yoke do you remember offhand the function name for getting a key defined in an item's script

#

because WheelFriction should also be fetchable that way

bronze yoke
#

like a reverse doparam? i didn't know there was something like that

fading horizon
#

That's where I learned how to do a custom context menu

#

In the isui.lua file

echo fiber
fading horizon
#

On the workshop

echo fiber
#

is that in the base game files?

fading horizon
#

I'm afk rn or I'd link it

echo fiber
#

o lol

fading horizon
#

No it's a mod

echo fiber
#

thank you will go look now

frosty stirrup
#

Could i make something like

local wheelFriction = inventoryitem.getWheelFriction()

?

#

to fetch the value from the item?

bronze yoke
#

yeah i've seen that work before

frosty stirrup
#

then I definitely want to implement a displayCategory check to avoid checking each item in the game via creating items, right? πŸ˜„

#

Or will it garbage collect itself?

calm depot
#

AFAIR, it should, yes

#

though in the interests of efficiency, you should have a table that caches the getFullType

bronze yoke
#

still best not instance every item in the game or you might extend load times a bit too much

calm depot
#

so you can first just consult the cache rather than instantiating a class instance every time

#

doing it just once for each item consulted during the game shouldn't be noticeable

bronze yoke
#

i think it's just a run once thing

calm depot
#

isn't his code running when the player right clicks their inventory

bronze yoke
#

you've got two different people confused

#

he's adding tags to all the tires at game boot

calm depot
#

oh it's just a one-off, I wouldn't be too concerned

#

try it and benchmark it πŸ™‚

frosty stirrup
#

well simply checking if it's null makes it fit ANY game item πŸ˜„

#

so it's not null

calm depot
#

yeah, it's a java class method that's exposed to lua, that will actually always be present

frosty stirrup
#

Oh man, spent like 15 minutes now just because I used item.getDisplayCategory instead of :getDisplayCategory

#

I need to get used to those SELF methods πŸ˜„

calm depot
#

item.getDisplayCategory(item) 😏

frosty stirrup
#

Fixed

#
function tagTires()
    local items = getScriptManager():getAllItems()
    
    for i=0,items:size()-1 do
        local item = items:get(i)
        if not item:getObsolete() and not item:isHidden() then
            if item:getDisplayCategory() == "VehicleMaintenance" then
            
                local inventoryItem = InventoryItemFactory.CreateItem(item:getFullName())                
                if inventoryItem:getWheelFriction() > 0.0 then

                    local tags = item:getTags()
                    if not tags:contains("Tire") then
                        tags:add("Tire")
                    end
                end
            end
        end
    end

end

tagTires()

function Recipe.GetItemTypes.Tire(scriptItems)
    scriptItems:addAll(getScriptManager():getItemsTag("Tire"))
end
#

Thanks a lot

#

Now it will tag all VehicleMaintenance items that have wheelFriction

#

Awesome

calm depot
#

0.0 and 0 are the same you know

frosty stirrup
#

yeah, I was experimenting with int vs float when it wasnt working

#

until I noticed :

#

Hehe

#

Lack of : rather

calm depot
#

lua doesn't distinguish between ints and floats, except internally, but that's invisible to you

frosty stirrup
#

I got burnt by ZScript for DOOM modding where it is a huge difference

#

My bad

calm depot
#

scripting languages written by the criminally deranged

#

I'm being a little hyperbolous, but really, strict type matching like that should make the comparison ill-formed rather than doing something evil like always evaluating to false

frosty stirrup
#

It's mostly because it's not a real programming language, and it's also quite limited by source ports it applies to

#

So they use int/float difference in division for different types of operations (bitwise/float division etc)

#

It's not that hard but it kind of made me use float when the float is due πŸ˜„

unborn radish
calm depot
#

something's interpreting the script, it could throw up an error when you try to compare a float with an int

echo fiber
#

so this was everything i could find for the take pills function, now i have to find out how to make it into a vape UI and or just figure out what any of this means πŸ˜„

#

but idk how this would apply to a tag

primal remnant
#

I made some noted for this code. Just want someone who knows lua to take a peek and tell me if I messed up anywhere. (Just testing my perception here)

#

Also does ISFurnaceInfoWindow = ISCollapsableWindow:derive("ISFurnaceInfoWindow") mean the ISFurnaceInfoWindow derives its attributes from ISCollapsableWindow?

abstract pine
#

What does the field on ranged weapon items AimingMod do?

echo fiber
#

on this line is there a way to get it where they have to have those items and another to use it? instead of one or the other?

#

tried to do VampeJuice/Ex/Ex,VapeBattery, but then it breaks

fast galleon
glass basalt
#

what's the zedscript for adding a text tooltip to a recipe?

#

would it just be Tooltip:?

glass basalt
#

woah, did Aiteron finish the PZwiki modding guide?

#

looks like there are a lot of separate pages for items, meanwhile recipe, sound, and vehicle have only one lol

#

no text tooltip πŸ˜”

#

oh well

glass basalt
#

yeah, only items have text tooltips it seems

#

😟

ancient grail
#

Basicslly item tweaker
Just adds another dependency you dont need
Because its feature is vanilla

You should use doParam instead

#

Theres an example there

#

For more about doparam
Search the thread i posted albions guide iirc

ancient grail
glass basalt
#

eh, I already did what I wanted to do

#

Time to disappear once more and come back in a month or so to help code something lol ✌️

ancient grail
dusty wigeon
#

is there a way to in a recipe for the recipe to consume only a poortion of an object like a useDelta variable

dusty wigeon
#

this would be for a food item

primal remnant
#

Had my mod working for a bit, now I'm getting:
attempted index: getFullType of non-table: null
Any ideas?

#

Comes up when I try to open the item viewer in debug

#

@dusty wigeon I've had some success changing the item type to drainable. Use delta is a fraction of 1, as I understand it. So useDelta = 0.1 will be ten uses.

dusty wigeon
#

not sure i can use a non food item to mix with a food item but i may be wrong

primal remnant
#

You can. If it's part of a recipe that's all that matters.
I created a large salt shaker that is drainable but totally works in recipes as a spice.

#

item LargeSaltContainer
{
DisplayName = Large Salt Container,
DisplayCategory = Food,
Type = Drainable,
Weight = 0.75,
Icon = LargeSaltContainer,
UseDelta = 0.02,
CantBeFrozen = TRUE,
EvolvedRecipe = Pizza:1;Soup:1;Stew:1;Pie:1;Stir fry Griddle Pan:1;Stir fry:1;Burger:1;Salad:1;Roasted Vegetables:1;RicePot:1;RicePan:1;PastaPot:1;PastaPan:1;Sandwich:1;Sandwich Baguette:1;Taco:1;Burrito:1;Beverage:1;Beverage2:1;Beer:1;Beer2:1,
Spice = true,
HungerChange = -10,
ThirstChange = 20,
UnhappyChange = 20,
WorldStaticModel = LargeSaltContainer,
FoodType = NoExplicit,
Tags = MinorIngredient;Salt,
scale = 0.1,
}

dusty wigeon
#

ok so i have the liquid as a drainable how do i set the level it has in it

primal remnant
#

Divide 1 by however many uses you want. Then use that number as useDelta value.

#

1/50 = 0.02 for example

#

We dont tell it how many uses; we tell it how much of 1 does it use per use.

dusty wigeon
#

problem im having is in the recipe when i go to craft it it decides it wants to use the entire ingredient

primal remnant
#

What is your use delta set to?

dusty wigeon
#

0.05 for the item

primal remnant
#

And it's type is set to "Drainable"?

dusty wigeon
#

yea

primal remnant
#

Hmm, mind DM'ing me the items code?

craggy ruin
#

is there an specific class that handles player connections server-side ?

ancient grail
#

@primal remnant did you completely ignored my msg and just went ahead with something else? In any case goodluck

upper mason
#

I'll just leave it here:

#

=_=

tawny elk
#

What IDEs do you folks use, to develop Project Zomboid mods?

upper mason
neon bronze
#

Doesnt really matter imo i edit the recipes in the standard text editor from windows

frosty stirrup
#

Hello, I have a small question about vehicle modding. Does anyone have experience with window textures? How do people achieve that "reflects sky" effect in some car mods?

#

I know it has something to do with the setting of Dynamic Skybox and Environment Reflection, but I couldn't find how it's implemented

#

The only relevant info I can find in scripts is "vehicle_noreflect" shader, and it seems to be set on windows on both mods where the reflections are working and aren't

visual steeple
#

I have a question about clothing modding. What files control zombie outfits?? to put the clothes of my mod

hot patrol
#

Can someone help me with changing the position of weapons on the players back? I had watched Peach's video on how to use the attachment editor and when I tried on my end it seemed to work only for me to find out I just changed the positioning of the shovel attachment point and not for the specific item I was aiming for

#

this is how it looks unedited

#

I don't like how it clips the player model

frosty stirrup
primal remnant
ancient grail
nimble spoke
civic forge
#

stupid question maybe to some, does gpt actually understand pz code/modding. or does it not have that knowledge

twilit rune
#

Could anyone suggest how to or where to look for info about creating of custom vehicle spawns?

civic forge
twilit rune
#

Ty

visual steeple
twilit rune
visual steeple
twilit rune
#

Thank you!

visual steeple
#

yw !

vast jasper
#

just a curios question but can i just open the ingame clothes in blender and edit them

#

my team lead has no idea about clothes in this game so i dont have nobody to teach me how it works

neon bronze
#

If im not wrong they are .fbx so i think it’s possible to open them in blender

visual steeple
upper mason
upper mason
civic forge
upper mason
# civic forge was wondering because i was asking it a step by step guide on a small tutorial o...
clever spruce
#

Question. How difficult is it to make a "Pack of X, Y, and Z, mod"?

civic forge
clever spruce
#

as in, maybe, perhaps... packing "Unuseable Metal"?

upper mason
clever spruce
#

Not a mod pack.

upper mason
clever spruce
#

I mean like, "Pack of 10 Unuseable metal"

#

"Pack of 5 Unuseable metal"

civic forge
echo fiber
vast jasper
#

wait

#

i think in the files its called boiler suit

#

is this the only FBX?

#

its the only one i can find

frosty stirrup
frosty stirrup
# frank elbow It definitely does not

GPT in general doesn't "understand" the code. It learns on models and provides answers based on something that someone has done before. It can be used for learning, but it will definitely not write the most optimal code, at least most of the time.

frank elbow
#

Mhm, it doesn't "understand" anything, because it's a large language model

frosty stirrup
#

Yeah, basically an advanced google translate

#

it is exciting as an indexing/search tool with metadata

frank elbow
#

I would argue against using it for learning even, tbh

frosty stirrup
#

but dont trust it πŸ™‚

frank elbow
#

Google Translate is an apt comparisonβ€”I wouldn't use that to learn a language, for example

frosty stirrup
#

indeed, I used it when I needed to buy something from peddlers in another country, but instead I would rather use a teacher or video lessons if I had to learn the language πŸ™‚

frank elbow
#

Yup

frosty stirrup
#

I am actually learning a language right now, and Google Translate screws it up more than 50% of the time.

#

So yeah, don't trust these tools πŸ™‚

#

The tech behind it is pretty exciting though, if you know how to code

frank elbow
#

Oh yeah, Google translate certainly isn't to be trusted. Better than it used to be certainly, but nonetheless

#

I find GPT somewhat interesting but not as exciting as people are making it out to be

frosty stirrup
#

I also know at least one event in my corp where machine learning predicted one thing, but experts trusted their "gut" and did their own planning, and somehow experts were right and tool was wrong :

#

It's quite hard to replace real experts πŸ™‚

frank elbow
#

Especially when the tool is great at being confidently incorrect

frosty stirrup
#

The algorithms are helpful though.

#

For example, once we introduced machine learning in our KB offer mechanism to customers, the number of silly cases closed by KB decreased a lot.

#

So it has some applications

frank elbow
#

It certainly does, not denying that

frosty stirrup
#

Basically as long as "it's not critical to screw it up and you have a plan what to do if it breaks", it can be used

frank elbow
#

I'm talking specifically about LLMs

#

I was thinking abt this somewhat recently & just found what I was saying:

I don't think large language models are the future for practical use of NLP in communicative functions. They're neat for generating text, but they lack deeper understanding & I think that's limiting. What I'd like to see is application with deeper knowledge of a language's grammar (and the ability to understand implicit constituents or things commonly left out in speech) that can apply a likelihood to multiple interpretations

frosty stirrup
#

I like cool stuff like identifying cats on camera for scripting or making photos of people only when movement is detected

red tiger
#

Why is this an AI posting channel now?

frank elbow
#

That stuff is neat. I just wish tech communication were better so people didn't blindly trust it

frosty stirrup
#

Sorry, it was a long answer to 1 question "can GPT code PZ" πŸ˜„

#

Offtopic for sure

frank elbow
red tiger
#

I get that.

frosty stirrup
red tiger
#

It's a touchy topic. (At least I recognize this in others)

frank elbow
#

How so?

red tiger
#

I don't mind it myself.

frosty stirrup
#

I am just too excited about practical application of AI as a tool, sorry about that. I got carried away.

red tiger
#

AI topics typically branch into politics.

frank elbow
#

Ah

frosty stirrup
#

Oh, I didn't even think about it wow.

#

You make a good point.

#

When I think AI, I think "how can I script my day to day IT job to be faster" πŸ˜„

#

I'll not continue it then.

red tiger
#

AI is fun and all, until it replaces people and that's where the convo usually goes and gets ugly.

#

All good. Just giving a tip of advise for honestly any Discord community.

frosty stirrup
#

Same can be said about Photoshop, at least about 10 years ago, I get what you mean πŸ˜„

#

It was scary back then.

red tiger
#

Aside from all that, Good morning soldiers.

frosty stirrup
#

Good morning!

red tiger
#

I'm making slow progress filling in documentation for the ZedScript VSCode extension.

frosty stirrup
#

I'm going back to making my perfect vehicle collection, where all cars are up to scale and have animated parts. It will take me longer to build than to play it, we are back to Skyrim modding.

#

Once I figure out how to properly make all windows reflective, it's another night to make that patch :D.

red tiger
#

I'm considering writing a Discord bot that has commands to look up script data.

#

It's going to be for my community. I think that a friend still plans on finishing his bot for this feature however he's been very busy.

civic forge
# frank elbow It definitely does not

i figured haha, it was acting like it understood and saying stuff like "after doing these steps u should have a working mod" blah blah but it really spewed out the funniest shit ever

merry storm
#

Hi, im having a problem when creating an horde with the createHorde2 command. All zombies are spawned on the floor and after a few seconds they dissapear. Why is this happening? its because there is a limit of zombies that can be on or something else? And there is any difference between createhorde2 and createhorde?

fast galleon
#
sendObjectChange(String change, Object... args)

Is this accessible from Kahlua, I keep getting implementation not found.

red tiger
#

@fast galleon I'm seeing it in PipeWrench so it should be accessible..

      /**
       * Method Parameters: 
       *  - (String arg0): void
       *  - (String arg0, Object... arg1): void
       *  - (String arg0, KahluaTable arg1): void
       */
      sendObjectChange(arg0: string, arg1?: any | se.krka.kahlua.vm.KahluaTable): void;
red tiger
fast galleon
fast galleon
red tiger
#
-- Using a table.
isoObject:sendObjectChange('something', { foo = 'bar' });
fast galleon
#

foo = IsoObject ?

red tiger
#
isoObject.sendObjectChange("something", new Object[] { "array-item" });
// Also works:
isoObject.sendObjectChange("something", "array-item", "also_something_else", 3);
red tiger
#

Just showing examples of how this method is invoked.

#

I'm no expert here. I think I had to use this method in my Twitch RCON patch.

fast galleon
#

I see you use . and not :, it was on my mind but that shouldn't work as expected?

red tiger
#

Using tables from a Kahlua context sounds like the most natural method signature to use.

fast galleon
#

Yeah, but would the game understand it?

#

It just loads the change with a bunch of ifs.

red tiger
#

Oh. I used syncIsoObject()

#

nvm

red tiger
fast galleon
#

no problem

red tiger
#

I'm better at answering questions about modding the Java code in the game than Lua.

fast galleon
#

I am curious still if it was me or if it's Kahlua failing.

red tiger
#

Maybe varargs is throwing it?

vast jasper
#

almost done

frosty stirrup
#

Is that a body for a bulky zombie?

vast jasper
#

no its a jumpsuit

frosty stirrup
#

Can someone point me in a direction of a proper method to remove some recipe that was vanilla or added by a mod please?

frank elbow
#

Not at my computer to point you in a more accurate direction, so instead I'll say "probably something in ScriptManager"

frosty stirrup
#

great, I will look into it

#

thank you

fast galleon
red tiger
#

Massive W for JetBrains.

calm depot
#

it took them this long to do

#

I feel like I've been basically stockholm syndrome'd into manually going and changing the gradle file every time I create a project

calm depot
vast jasper
#

idk it was like that when i imported the FBX

calm depot
#

well, what happens when you rotate/translate them, do parts move as you would expect?

red tiger
#

I really see a strong need to improve the scripting package of the Java codebase for PZ.

#

Hopefully certain errors and oddly-specific / case-sensitive property names / values are fixed for 42.

merry storm
#

Any idea about how to spawn a crate from a mod?I cant find the command neither the crateId, the wiki only shows the itemsId but crates i think are some type of building. Im a bit lost, if someone can help me a bit with this πŸ™‚

frosty stirrup
# fast galleon yeeeeter https://discord.com/channels/136501320340209664/232196827577974784/1082...

I've already done it in a similar way, seems to work

function clearWorkshopScripts()
    local recipes = getScriptManager():getAllRecipes()
    
    for i=0,recipes:size()-1 do
        local recipe = recipes:get(i)
        if recipe:getName() == "Disassamble Metal Armor" or
        recipe:getName() == "Disassamble Gun" or
        recipe:getName() == "Disassemble Gun Magazine" or
        recipe:getName() == "Disassemble Motor" then
            recipe:setIsHidden(true)
        end
    end
end

clearWorkshopScripts()

The only challenge now is that I cannot use the same recipe names, because I run this LUA in "server" folder, so it clears OLD and my NEW recipes as well :D.

Is it possible to mark old scripts with that name as hidden, but not hide mine scripts that I made with the same name? I assume there's a clever trick, but I am being stupid

red tiger
#

Keeps the looped logic nice and squeaky clean.

#

Although if it's less than 5 and not expected to grow your approach is clean.

#

=)

frosty stirrup
#

Could I somehow load my recipes AFTER this LUA code has run? Or is it pretty much impossible?

#

The idea is that I basically just want to fully replace the recipe and/or item, but keep the rest of references to it as is

#

..
..
One more weird thing I wanted to ask about: whenever you enable some mod with dependencies in Mod Manager, it loads the "dependent" mod first and "dependency" second.

I always thought that at first we load main mod, and then the one that depends on it.

Is it a problem with mod manager, or with my understanding how loading mods works?

#

Also I am curious...

local item = ScriptManager.instance:getItem("Base.Whatever")
if item then
    item:DoParam("Weight = 5")
end

Could I use this instead to fully overwrite something in recipe, or in a similar way? If I want to change ingredients for example

nova dome
#

I thought mods were loaded alphabetically. Is different for dependencies?

frosty stirrup
#

It's also curious that in the console log I see this order

#

Even though I put my mod scrapCEC_overrideWorkshop.lua below, somehow it loads in the middle of The Workshop mod's lua

drifting stump
#

load order doesnt matter except for file overwrites

#

all it does is collect all files into a list which are then executed alphabetically

frosty stirrup
#

huh , and here I was, spending hours juggling mods in a "perfect" order lol

#

if I wanted to make sure that my LUA runs after another mod's LUA, is the only way to put Z in front of file or something?

drifting stump
#

require "filename"

frosty stirrup
drifting stump
tiny forum
#

I would like to translate the Options of a mod, but the creator has inserted them in a LUA file. In the IG_UI file there are only tooltips, how can I export the options to the file?
Example of file options:
names = {
box0 = "[RESERVED]",
dropdown17 = "Debugging Message Level - DEBUGGING",
},

frosty stirrup
#

thank you, Browser8

drifting stump
#

while im here i must preach

#

do not use globals ty πŸ™

frosty stirrup
#

Found something on forums

#

Does it still work?

drifting stump
drifting stump
#

use lua for it

fast galleon
frosty stirrup
#

@drifting stump I am having trouble with replacing recipe only.
If I mark a recipe with a name as Hidden, it marks my recipes with the same name as hidden
If I made a different name for a recipe, old magazines do not work

Am I being stupid and missing a very simple solution?

drifting stump
#

working with multiple recipes with the same name?

frosty stirrup
#

The premise:

I want to take an existing recipe from a mod and fully change its ingredients

If I use ScriptManager and get all recipes with the old recipe name and mark them as Hidden, it grabs my recipes too
That's the issue

drifting stump
#

its not a good practice to have recipes with the same for exactly this reason

#

makes it a pain to work with

frosty stirrup
#

If I make recipes with a new name, suddenly magazines and other references to the recipes break.

#

So I have to overwrite all mags, their distributions, and mods that patch them as well

#

Do I see an issue where there's a simple solution?

drifting stump
#

not sure i understand the problem youre having

frosty stirrup
#

I want to override ingredients of recipes in a mod.

If I make new recipes with the same name, game doubles them (shows old and new)
If I use LUA to mark all recipes with the same name as hidden, it marks new recipes as well

#

Did I explain it better? πŸ™‚

drifting stump
#

yeah again you shouldnt make recipes with the same name for this reason

frosty stirrup
#

But if I make recipes with a different name, it also breaks magazines

drifting stump
#

what does it break exactly

frosty stirrup
#

should I remake everything else if I want to modify recipe only?

#

the magazines reference old recipe names

#

not mine

#

the ones that I made hidden

#

so reading a magazine, I cannot learn my new recipes

#

does it make sense?

#

all I want to do is overwrite one property in existing recipe, its ingredients

tiny forum
#

Someone of you have the contacts of Arsenal or Brita? Or even if someone could ask them if I can use the GunFighter_01Option file by changing the words for a translation? THANKS!

drifting stump
#

hmmm i see

#

can filter the recipes by looking for ones with something you dont want them to have

#

for example all the ones with an ingredient you dont want it to have

frank elbow
#

Worth considering whether it's possible to update the recipes using the script manager rather than overwriting them in your scripts. Once again not at home so I can't check on that

frosty stirrup
#

The main issue with scriptmanager and changing recipe is that I do not understand what method can be used to do that πŸ™‚

frank elbow
#

Reading through decompiled code & the javadoc helps with that

frosty stirrup
#

There doesn't seem to be a SET method for that

drifting stump
frosty stirrup
#

I mean I could iterate through ALL recipes and change all with the same name

#

if only there was a set method for ingredients

drifting stump
#

what are you trying to change?

frank elbow
#

Seeing the decompiled code is handy because you could look at where the recipes are actually parsedβ€”that would show you how stuff is set and whether there's a setter somewhere

frosty stirrup
#

ingredients

drifting stump
#

got you then

frosty stirrup
#

they are not params

frank elbow
#

Presumably there's getRecipe or something similar on script manager which will return something you can manipulate

drifting stump
#

^

frosty stirrup
#

That's a simple function that returns a list of items when called from ingredients field

#

I made many like these

#

The problem is how to get ingredients array from recipe object

drifting stump
#

? doSource takes the string you normally use in the script and parses it

frosty stirrup
# frank elbow Presumably there's `getRecipe` or something similar on script manager which will...

That's what I did here

function clearWorkshopScripts()
    local recipes = getScriptManager():getAllRecipes()
    
    for i=0,recipes:size()-1 do
        local recipe = recipes:get(i)
        if recipe:getName() == "Disassamble Metal Armor" or
        recipe:getName() == "Disassamble Gun" or
        recipe:getName() == "Disassemble Gun Magazine" or
        recipe:getName() == "Disassemble Motor" then
            recipe:setIsHidden(true)
        end
    end
end

clearWorkshopScripts()

But I don't know how to get the ingredients array from "recipe" without reflection

drifting stump
#

doesnt have to be a function

#

and if you want to look at the ingredients look at sources

frosty stirrup
#

well I can already get ingredients with some other methods, but I am not sure how to set them back πŸ˜„

#

Would it work with a similar approach? Can you change sources?

#

I am just unfamiliar with the concept yet

drifting stump
#

i literally just said

drifting stump
frosty stirrup
#

Ah, when you said "look" I thought it's the same as "get"

#

I am not getting how it matches to a possibility to set

#

Probably I am thinking wrong, my logic is flawed

drifting stump
#
doSource("BaseballBat,
          Nails=5,
          keep [Recipe.GetItemTypes.Hammer]")
red tiger
#

Spent some of the morning extracting and pulling out all values for properties like BodyLocation and BloodClothing.

drifting stump
#

still working on the script parser?

red tiger
red tiger
#

Currently on the Type = Clothing, category.

#

Cleaning up the Wiki at the same time as transcribing the documentation for the VSCode extension.

#

I haven't updated this in a couple weeks however there's a lot of updates in the GitHub repository.

#

Autofill and enum options dropdowns will make writing ZedScript incredibly simple.

frosty stirrup
#

It looks like Evelyn was having a similar issue in the past, so I am not the only one πŸ˜„

drifting stump
#

that icon is pretty nice

red tiger
red tiger
merry storm
#

Any idea about how to spawn a crate?I cant find the command neither the crateId, the wiki only shows the itemsId but crates i think are some type of building. Im a bit lost, ill appreciate if someone can help me a bit with this πŸ™‚

drifting stump
#

place an object and give it an inventory container

craggy ruin
#

Hello people good afternnon.
Question here..
Is there a function server-side based in order to check when a player is connecting?

I'm trying to do a listener for the event.Onconnect but is not working.
I have a function that has to run when a player is joining the server

drifting stump
#

thumpable if you want it to take damage from zombies

merry storm
#

Like some kind of loot drop event and a crate spawned in some coords

drifting stump
#
local newObject = IsoThumpable.new(cell, square, spriteName, IsNorth?, nil)
newObject:transmitCompleteItemToServer()
#

probably also want something like

newObject:createContainersFromSpriteProperties()
#

could also add the containers manually

merry storm
#

Okey, thank you very much. The thing is that they will spawn randomly on certain coords, but only after a trigger. With that info i can work, i really appreciate it

frosty stirrup
#

Eureka.

I didn't realise I could simply put something I "get" into a local variable, and do whatever I want with it. I thought I needed a set method, and parameters are protected, lol

#
function clearWorkshopMagazines()
    local items = getScriptManager():getAllItems()
    
    for i=0,items:size()-1 do
        local item = items:get(i)
        if not item:getObsolete() and not item:isHidden() then
            if item:getName() == "WorkshopMag5" then
                local recipes = item:getTeachedRecipes()
                recipes:clear()
                recipes:add("Dismantle Armor")
            end
        end
    end
end

Does the job of simply changing recipes of existing magazines to my new ones, getting rid of old ones

#

@drifting stump Thanks for all your attempts to help, my brain was finally set straight.

red tiger
#

@drifting stump I'll need to think of templates that I can make available through my extension.

#

I'd like to have templates for certain kinds of items, vehicles, etc.

#

So people can take those templates and modify them, skipping the whole "From scratch" approach.

drifting stump
#

one thing to consider is whether to put all possible parameters or only relevant ones

red tiger