#mod_development

1 messages · Page 305 of 1

silent zealot
#

I finally figured out something I have wanted for years!

thick hound
#

Sounds good

gilded crescent
silent zealot
#

High beam headlights that actually increase the distance of your headlights!

gilded crescent
#

oh headlights

#

that's really cool

thick hound
#

I'm still find out for battery consumption as an ammo

silent zealot
#

The secret is you put the left headlight in the centre of the front bumper and the right headlight floating 10 squares out in front

silent zealot
thick hound
#

Still at outside

silent zealot
#

I've not looked at it either, but it seems to do a lot of the things you talked about so it would be good to see how they did it.

urban timber
#

How i can modify exist item in game? For example, add uses to a bucket of cement by changing only UseDelta?

bright fog
#

I plan on documenting this in the wiki

slim swan
#

How to detect whether a beverage needs to have its lid opened first, and then execute the command to open the lid.

silent zealot
#

Probably Tag:SealedBeverageCan

#

Opening is done via a recipe, OpenCanOfBeverage (or approriate recipe for other containers)

#

Look at the OnCreate in the recipe to find out code runs for teh recipe.

thick hound
#

@silent zealot do you know mod that guns using gun durability instead ammo? I've been seen that before but i forgot the name

silent zealot
#

No, I don't know of any mods like that

distant inlet
#

I need to find the strength to finish my mod. Someone pls send good vibes

frank elbow
brave bone
# silent zealot

Is this highbeams? 😮 we were actually thinking of making that but it look so complicated we abandon the idea lol.. 😄

long cloud
#

is there are mod that makes gas mask filters last longer?

vague marsh
distant inlet
silent zealot
robust locust
#

hiya, what encoding do I need for RU translations for b41 and b42? Are they different?

robust locust
#

Thanks!

frank elbow
silent zealot
#

Is it all UTF8 now?

frank elbow
#

Last I checked there were some stragglers that aren't UTF-8. Dunno whether that's still the case

#

I believe it was Argentinian Spanish, Czech, and Korean

#

+Catalan

brave bone
silent zealot
#

You need an extremely good reson to make a java mod for Zomboid.

#

You're commiting to updating it with every single update. and dealing with all the peopel who don't follow installation instructions.

robust locust
#

@frank elbow I can't see Cp1251... is it the same as Windows -1251? It looks all weird like that

frank elbow
robust locust
#

Is it meant to look like this? ItemName_RU = { ItemName_GWH.HanksiesGuitarWallHanger = "Настенный держатель для гитары Хэнкси",

frank elbow
#

I would check how it looks ingame, but if you try to display text from one encoding in another, non-shared characters (like many in the Cyrillic script) do get garbled yeah

vague marsh
#

RU needs UTF8

frank elbow
#

They're asking about b41

vague marsh
#

also you can use chucks auto translator, tho you need to straight out some rough translation cause it use google translate

vague marsh
robust locust
#

yea that's for b41 😄
it looks normal using utf8, but funky in the other. I'm using notepad++.
I'll give it a try and hope it looks okay 😄

vast pier
silent zealot
silent zealot
# vast pier

Now I want you to make a mod that lets you attack the keyring can opener to you nose ring.

vague marsh
#

is there a possibility that a car is flipped and they cant get out on it?

slim swan
#

Finally work it out with many peoples' help

#

it's hard as rebuilt a inventorypane

vague marsh
#

im trying to add a check but idk if its a good idea to check if a player is inside the vehicle. If the car is flipped and they cant get out for some reason then it wont work theyre stuck. Tho im trying to make it a bit realistic by making them go out before they can do it.

bright fog
vague marsh
mortal escarp
#

@slim swan Nice work. I don't even want to know how annoying the UI code was for that mod lol.

gilded crescent
#

I can't imagine that was easy to do, especially with as much compatibility it seems to have

hollow ore
#

how can I make a vehicle more resistant as if it were armored?

gleaming wedge
#

Hey guys, there's a method to get the quantity of an item in inventory or we have to cycle it all?

#

with the cycle if there are a lot of it the game freeze a second and i want to avoid

sonic flame
#

you mean like getItemsFromType()?

#

@teal finch that's for end user help, this is mod dev help

teal finch
#

oh, thank you for the heads up 🫡

sonic flame
#

scroll down to the "Mod folder" section on that page and it outlines the structure

#

if you're really stuck I can take a look though

#

my random guess is /common is missing

bright fog
#

Yea that's a common problem

#

pun non intended lol

sonic flame
#

too late, own it

gleaming wedge
sonic flame
#

you're good

#

definitely recommend keeping the lua API docs on hand

gleaming wedge
#

i searched but the name is not intuitive, i was looking for quantity or size, something like that lol

sonic flame
#

there's also getItemCountFromTypeRecurse() that returns the actual count

#

unsure about what the recurse is doing, but my guess is it looks inside of containers inside the original container

gleaming wedge
#

damn i'd need it without recursive search

sonic flame
#

then just do getItemsFromType().size()

gleaming wedge
#

yes def thank you

sonic flame
#

oh there's regular getItemCount() functions

#

idk why they're not grouped in the docs

gleaming wedge
mortal escarp
#

@gleaming wedge @sonic flame You guys might already know about this tool but I'd highly recommend using the ZomboidDecompiler when searching source. I find f*ck all when looking at the raw docs like this but when combing through real decompiled source? It's a totally different story. Context is key when dealing with methods like the ones shown in your screenshot. The decompile tool is probably my favorite Zomboid modding tool.

https://github.com/demiurgeQuantified/ZomboidDecompiler

GitHub

Simplified decompilation tool for Project Zomboid powered by Vineflower. - demiurgeQuantified/ZomboidDecompiler

merry patio
#

Hello! I'm trying to make some walking animations run when a specific condition is met. In this case, when the game temperature reaches 0°C, I want the modified animations in AnimsSets/zombie/walktoward and AnimSets/zombie/lunge in my mod folder to run. Yesterday, Spongie shared a great resource with me, but I still can't get the animations to run only under that condition. Any help? B42

gleaming wedge
sonic flame
#

do you have a link or a zip I could check out? didn't see it on your workshop page and I'm really not following the readme for hooking into Target Square

teal nacelle
#

Wonder if there'd be a way to make custom reload animations for The Only Cure, since with the advanced trajectory overhaul mod you can use rifles and shotguns with one arm but it uses the default animations which look wonky

#

I could base it on real videos I've seen of people doing one-handed reloads

vast pier
teal nacelle
#

I'd also have to figure out how reloading works in Advanced Trajectory Realistic Overhaul

thin walrus
#

Why is it that when I change the mod information in the mod.info file, the changes are not shown in the game?

bright fog
thin walrus
#

now I can't upload my mod to the workshop and I get this error "start update of existing item ID=3430342677
success requesting Steam to update the item there is no way to stop the update once it has started failed to update workshop item, result=9 finished"

bright fog
sonic flame
#

is fluid output janky as hell? couldn't find a usable example anywhere

thin walrus
bright fog
#

Also

#

Make sure to not have two copies of your mod locally

#

Every copies of the mod will interfere with each others

sonic flame
#

nvm I got it

#

just can't show the liquid output in the window without crafting disabling for whatever reason

bronze yoke
#

i don't think fluid outputs are a finished feature

sonic flame
#

if it wasn't for this display issue it seems like they're doable

#

you just have to put the fluid amount in the input for whatever reason

#

then again the coffee maker interface doesn't show an output either, so it's whatever

#

works well enough to test for the time being

bronze yoke
#

i can't remember who exactly i've talked to about this (definitely more than a couple different people), so i'm just going to post it around - i've said in the past that it's not possible to remove vanilla tooltip elements, but during some bug fixes i actually found a way to do it: starlit library has just updated with api for this, let me know if you still need any help with it

sonic flame
#

I appreciate it but I'm not gonna push too hard on this one. just testing out alternate ways to deal with thirst in the middle of nowhere

#

and considering you can draw blood from larger animals, I wouldn't be surprised if this sort of thing ended up in unstable

bronze yoke
#

fluids will definitely become much more relevant to crafting in the future, considering they plan for brewing

#

the current fluid system in general is definitely not quite done

sonic flame
#

as long as I can chupacabra a dead rat I'm good for now

#

time to google a bunch of info about blood that's definitely putting me on a list

dusty flint
sonic flame
#

missing a bracket at the end

silent zealot
silent zealot
#

They already have art for drying racks with animal skins on them:

#

And drying would make so much more sense if you attached the wet item and waited a few days.

bright fog
ancient grail
#

@bronze yoke
i saw this and was wondering what you if incase you reach another cell

#

you will need to get zombie list again right?

bronze yoke
#

no

#

there is only one cell ever

#

isocell has nothing to do with map cells

silent zealot
#

isocell is the currently loaded area?

bronze yoke
#

yeah

ancient grail
#

wtf
so thats all the zed? hmmm except for new spawns right

bronze yoke
#

no, it's the same list the cell uses so it will always be up to date

silent zealot
#

If it's doing the whole "pass by reference" thing then it's getting updated after it's given to you.

bronze yoke
#

objects are never passed by value

#

there's a couple situations where the game explicitly copies objects to stop you from doing sneaky things but it's rare

silent zealot
#

I know they are not in LUA, I wasn't sure about the LUA/java interface

bronze yoke
#

java also doesn't pass by value

#

in rare cases a 'getter' will actually be a 'copy and return the copy' method

#

that can probably be defeated with field access in most cases though

sand parcel
#

how do i give a new item the ability to do lighter stuff, like smoking burning corpses campfires etc

silent zealot
#

Check the tags on vaniila lighters, there should be a tag that makes them a source of fire.

#

And likely a UseDelta that will control the item being used up as it is used.

sonic flame
#
        Tags = HasMetal;Lighter;StartFire;LessFull;RefillableLighter,

some of these depending on what you need

#

/scripts/items/items_fire.txt is the file

#

highly recommend something like grepwin to scan the game's text files

silent zealot
#

100% agree - I use powershell commands, but whatever solution you use it's extremely helpful to be able to quickly look for text in all lua and/or txt files under media

sonic flame
#

does powershell have grep or are you using something else?

silent zealot
#

Select-String

#

I made a little zfind.ps1 with this:

Get-ChildItem -Recurse | where {$_.extension -in ".txt",".lua"} | Select-String $args[0]

drifting ore
#

Is that faster than using Find in Files in Notepad ++

silent zealot
#

I want to figure out how to exclude translation files, but -excludes on Get-ChildItem doesn't work for recurive directory names and not variation of $_.fullpath -notcontains "translate" did either... and it's easier the just scroll past translation entries when they show up than it is to figure out why.

silent zealot
#

I wonder if vscode & open media folder would be better or worse for this.

bronze yoke
#

i usually just use vscode's search, you can set exclude patterens there if needed

silent zealot
#

Is there any way to collapse the results list? So I can see all the files and expand the one I want, instead of a huge list of partial lines and it's hard to tell what is from which file?

#

liek this withot having to do it all one by one.

tacit pebble
#

btw if someone know hot-key for this feature(Auto-collapse) please let me know too 😄

silent zealot
#

you can set your own.

tacit pebble
#

both are what i exactly needed!

silent zealot
#

Was just about to post that setting - I was hopeful it existed and it does!

#

I'll see how vscode works as a Zomboid search tool - it has teh nice advantage of directly opening the files in the editor

#

Thanks for teh suggestion/config help

sand parcel
silent zealot
#

Are you adding tags with lua?

#

If so, recipes will ignore them; they build a list of items when the recipe is parsed and don't update if the tags change.

sand parcel
silent zealot
#

Which specific fire starting methods are not working? check the lua code to confirm exactly what is being searched for.

sand parcel
#

When I right click on cigarettes to smoke them, the button appears red and unclickable

silent zealot
sand parcel
#

its the item type that watches use

silent zealot
#

Does it have a UseDelta?

#

This gets used for filtering fire source (if I am reading the code right) so you need to have charges on the fire source.

#
ISInventoryPaneContextMenu.doEatOption = function(context, cmd, items, player, playerObj, foodItems)
    local eatOption = context:addOption(cmd, items, ISInventoryPaneContextMenu.onEatItems, 1, player)
    if foodItems[1] and foodItems[1]:getRequireInHandOrInventory() then
        local list = foodItems[1]:getRequireInHandOrInventory();
        local found = false;
        local required = "";
        if foodItems[1]:hasTag("Smokable") and playerObj:getVehicle() and playerObj:getVehicle():canLightSmoke(playerObj) then found = true end
        if foodItems[1]:hasTag("Smokable") and not found then
           found = ISInventoryPaneContextMenu.hasOpenFlame(playerObj)
        end
        if not found then
            for i=0,list:size()-1 do
                local fullType = moduleDotType(foodItems[1]:getModule(), list:get(i))
                if playerObj:getInventory():getFirstTypeEvalRecurse(fullType, predicateNotEmpty) then
                    found = true;
                    break;
                end
                required = required .. getItemNameFromFullType(fullType);
                if i < list:size()-1 then
                    required = required .. "/";
                end
            end
        end
        if not found then
            eatOption.notAvailable = true
            local tooltip = ISInventoryPaneContextMenu.addToolTip();
            tooltip.description = getText("ContextMenu_Require", required);
            eatOption.toolTip = tooltip;
        end
    end
end```
sand parcel
#

I'm gonna try changing the type to normal, leaving everything else as is

#

Big reach but I'll try anything

#

To be worn the item has to be a clothing type :P

#

just threw up an error

tacit pebble
#
    item Cigar
    {
        DisplayName = Cigar,
        DisplayCategory = Junk,
        Type = Food,
        Weight = 0.2,
        Icon = Cigar,
        CantBeFrozen = TRUE,
        CustomContextMenu = Smoke,
        EatType = Cigarettes,
        OnEat = OnEat_Cigar,
        RequireInHandOrInventory    =    CandleLit/Matches/Matchbox/LighterDisposable/Lighter/LighterBBQ,
        HungerChange = 0,
        StressChange = -20,
        UnhappyChange =    -40,
        BoredomChange = -20,
        StaticModel = Cigar_Lit,
        WorldStaticModel = Cigar,
        CustomEatSound = ,
        Tags = IgnoreZombieDensity;UseAll;Smokable,
        EatTime = 920,
    }
silent zealot
#

Well that's just silly

#

Or rather, that's not updated for B42 yet.

sand parcel
#

I see

#

how is RequireInHandOrInventory handled by the game? Could I use Lua to add to it like a table?

vast pier
#

I just wanna know why it's using item names instead of a tag

tacit pebble
#

you can just use DoParam but I think it's not good for mods compatibility? idk I don't like editing script usually so..
Actually if it was me, I will just hook and overwrite all ISInventoryPaneContextMenu.doEatOption lol (still too much but no idea)

tacit pebble
vast pier
#

uh idk if you can use tags, I was more so meaning why does vanilla smoking not use tags

#

sorry for the misunderstanding

tacit pebble
vast pier
#

wait whats the question then I'm confused

tacit pebble
#
  1. I agree, why they don't use tags?
  2. however, is your solution will work for RequireInHandOrInventory like Tags
    Maybe I'm not good at explaining my thoughts in English
vast pier
#

are you asking if it can be edited the same way? Yeah, but you might need to copy the entire param if it doesn't work the same as tags

#
    {
        RequireInHandOrInventory    =    CandleLit/Matches/Matchbox/LighterDisposable/Lighter/LighterBBQ/NewItem/NewItem2/NewItem3,
    }```
should work
#

that's what you were meaning, right?

plush wraith
#

Just to add in some places the game checks tags for lighters and sometimes the required field in items. B42 Introduced lighting by stove/fire as well so it checks those in various spots

umbral raptor
#

how can i learn LUA for zomboid? most resources out there don't cover stuff related to zomboid but rather the logic of the language itself

merry patio
#

Hello! I need help with a mod. I'm using the instance "objZombie:changeState(ZombieWalktowardState.instance())"
I modified some animations in my mod folder and added a condition that if a certain temperature chosen by the user is not met, this will not be executed.
My question is, if I force the game with this instance to trigger when the zombie's temperature is lower than the one chosen by the user, will the code use the modified XML or will it always use the original XML from the game? Thank you.

silent zealot
#

If you are familiar with the concepts of variables, functions, flow control, loops, contionals, arrays and such then it's it's a lot easier to pick up a new language since you just have to learn the lua way

#

In that case if you have a mod idea let us know and we can give some pointers to get you started, or better yet if you find a similar mod you can look how they did things.

umbral raptor
#

and i do understand what a code is trying to do when i look at any of it

silent zealot
#

Just muddle your way through the lua.

umbral raptor
#

but i don't know how to write

silent zealot
#

That's why starting by looking at a similar mod is helpful

#

plus you can look at all the vanilla lua in the games media/lua folder

#

And if you have a specific mod idea, the channel is great place to get an idea how to get strated

silent zealot
#

Hopefully someone with better animating expeience can help you

umbral raptor
#

can someone help me with some LUA?

#

an on.test that im not sure how to make

silent zealot
#

What do you need?

tacit pebble
#

what are you going to make?

vast pier
#

@silent zealot What happens if you're playing split screen and try to dismantle a car the other person is inside of, or they go in the car while you're dismantling it?

silent zealot
#

They are sent to the farm to help look after the animals.

vast pier
#

sure but does it cause a crash or anything? xP

silent zealot
#

I'll tell you when B42 multiplayer is out.

vast pier
#

how dare you not have a controller at the ready to test split screen on your mod

silent zealot
#

Does B42 support split screen?

vast pier
#

yes

tacit pebble
#

yep

vast pier
#

It's the only form of multiplayer currently

silent zealot
#

I'll try that then

#

I've got a cheap generic controller somewhere

#

... How do you use a controller to get into a car?

tacit pebble
#

There should be a button for opening radial menu

silent zealot
#

Playing Zomboid with a controller is a crazy idea to me

#

I'll try it later

plush wraith
#

There is button prompts that appear under the right conditions too for certain actions

#

Along with the radial menu and stuff

tacit pebble
#

I tried when first controller support released and I gave up immediately after 10 min gameplay tho

plush wraith
#

Someone asked me to add controller support and I was like "people play pz with a controller??"

silent zealot
#

I just need to teleport the real player close, spawn a car, put the controller player in the car and send them to T̴̆͠h̵̾͂e̵̓́ ̵̀͝V̶̊̉o̵̅̕i̴͐d

open drum
#

guys!! this is driving me crazy!!! maybe I am already crazy

#

but this error keeps popping up when i don't know why

#

look

tacit pebble
#

🤣

plush wraith
open drum
#

on line 720

#

it keeps producing error saying that "n" is not a table

silent zealot
#

...and then add a check that does player:getOutIfCar();player:setOnFire() if anyone is inside

open drum
#

but when i debugged it using print("this is the N")

#

it shows that it's table

#

but still showing error

tacit pebble
#

b41?

open drum
#

saying n is non-table

#

b42

#

print says it's a table, but the code says it's non-table...

tacit pebble
#

instanceItem("Base ~~")

#

for B42

#

insteand of inventoryItemFactory ~~

plush wraith
#

if its a key value table i think you need pairs and not ipairs

open drum
#

or InventoryItemFactory.instanceItem("Base." .. n[j]);

tacit pebble
#

InventoryItemFactory:CreateItem("") -> instanceItem("")

open drum
#

ill try

tacit pebble
#

InventoryItemFactory is no longer exposed

open drum
#

well more errors.. 😦

#

could you take a look at line 718

#

and why this won't open even after InventoryItemFactory fix

onyx valve
#

Hi, is there a way to make "keep" work with a custom item?
I have a Workbench and I don't know if it work with

item 1 [Base.Workbench] mode: keep,

or is there another mode?

ancient grail
#

depending on what property you plan to use
theres also itemscript or scriptitem forgot the exact syntax

open drum
#

ugh... so hard to get used to this UI

vague marsh
teal nacelle
tacit pebble
tacit pebble
# open drum

_concat not defined -> seems your n[j] is not string

open drum
#

yea

#

so i used :Type() after

#

and still causing problem

ancient grail
#

can you show code?

#

not file just part of it pasted here

open drum
#

oh oki

#

hold on

tacit pebble
#

tostring(n[j]) is simplest (if it fits for your code)

plush wraith
# teal nacelle Does anybody know about this?

Reloading is a TimedAction, search for it and you will see it sets the anim like so self:setAnimVariable("WeaponReloadType", self.gun:getWeaponReloadType()) self:setActionAnim(CharacterActionAnims.Reload) You could create your logic here to set custom ones

open drum
#
function zSpawnPanel:fill()
    for k, v in ipairs(self.listBox) do
        v:clear();
        v:setYScroll(0);
        for j, n in ipairs(v.listItems) do
        print("WHAT IS N??"..j,n)
        
            local i = instanceItem("Base."..n[j]:getType());
            print("DEBUG THE I " ,i)
            if i then
                v:addItem(j .. n[1], {item = i, count = n[2]});
            end
        end
    end
    -- print('debug');
end```
teal nacelle
plush wraith
#

You can still overwrite mod logic like you would vanilla game logic

teal nacelle
#

Wonder how TOC detects if someone's missing an arm

#

The idea behind my mod is to add custom reloads for characters missing arms

plush wraith
#

If they had their own TimedAction you could overwrite the start method that sets those anim variables, just need to look at their code and see what its doing

teal nacelle
ancient grail
#


print("WHAT IS N??"..j,n)
print("WHAT IS N??", j, n)
plush wraith
open drum
#

oh

ancient grail
#

if n is an item

instanceItem("Base." .. n:getType())
teal nacelle
#

Maybe changing it slightly for shotguns for variety

ancient grail
teal nacelle
#

I don't know if I'm gonna publish this mod for the public, probably mainly just gonna keep it for personal use or servers since I don't know if it's okay to just edit someone's mod like this

#

And publish it

frank elbow
teal nacelle
#

I wonder if this kinda thing would work with Guns of 93? Would I have to make animations for every single gun or just "rifle or shotgun"

vague marsh
#

does prolonged wearing of a necktie cause muscle strain on the neck?

plush wraith
vague marsh
teal nacelle
#

Maybe I could make a character drop their magazine when reloading with one arm so you have to go mag hunting after a shootout

#

Since your other hand (obviously) isn't there for grabbing it and putting it back in your bag or whatever

#

In multiplayer, you could have a "mag boy" who just follows you around and picks up your magazines lmaoo

vague marsh
rough herald
#

can anyone help me?.
how to get Max Encumbrance player value?

teal nacelle
#

Also I'm thinking of having characters gain arm pain and unhappiness from using a rifle/shotgun one handed, those things are heavy with 2 hands (experience)

#

I'm sure one handed use would be miserable

#

A gunfight involving a guy with one arm would just be "OW OW OW MY FUCKING ARM" after a couple minutes

drifting ore
#

I'm trying to find an example of a mod with a recipe that requires electricity as an input

vast pier
#

well it does in b42 at least

vast pier
drifting ore
vague marsh
vast pier
open drum
#

it's cuz the table is made this way zSpawnItemList = { item1 = { x = 0, y = 1, width = 170, height = 290, items = { {"Headphones",1}, {"Hammer",1}, {"Screwdriver",1}, {"Saw",1}, {"Log",1}, {"DuctTape",1}, {"Woodglue",1}, {"Charcoal",1}, {"PetrolCan",1}, {"Generator",1}, {"ScrewsBox",1}, {"Coldpack",1}, {"Lighter",1}, {"Matches",1}, {"Firebrand",1}, {"LitFirebrand",1}, } },

#

so i need the key while looping

tacit pebble
#

then it should be n[1], not n[j]:getType()

  • print(n[1]) will returns: "Headphones" ... "LitFirebrand"
  • print(n[j]) will returns something like: table: 0x5648b5c0
  • print(table.unpack(n)) will returns: Headphones 1 ... LitFireBrand 1
    (I haven't used table.unpack ever, i just heard about it before)
#

idk i could be wrong i'm middle of my work with many things around in my head

ancient grail
#

then maybe make it like

items = { 
     ["ItemType"] = { 
        ["ItemType"] = ItemType,
        ["qty"] = qty
    },
}



#

im using mobile atm

tacit pebble
#

btw can someone confirm if i was right or wrong? once i started getting worried i could be wrong, it comes into curiosity rolf

vast pier
#

Bug testing and the house I spawned in has 3 can openers, where are these when I'm playing and can't find a can opener anywehere in town???

merry patio
# silent zealot All I know about animations is they were (maybe still are?) somewhat broken and ...

Hello! Thanks for responding. I modified some animations in XML, put them in a mod, and it works, but I'd like these animations to be functional only through a condition, which is the weather. I've already done the entire LUA base, but I don't know how to make these animations play under those circumstances and not all the time. Currently, they're playing all the time. The idea is to reduce the speed in the speedscale of type ZombieWalkSlow1 to use it as a feature of a mod. What I don't understand is how to make everything remain as in the original game until my LUA decides to call this modified animation. Could I share the LUA with you? It's quite short.

vast pier
open drum
open drum
tacit pebble
vast pier
#

https://steamcommunity.com/sharedfiles/filedetails/?id=3430771934

DESCRIPTION
Adds in the ability to:
Put various items in wallets and on key rings.
Spawns you with a wallet that your ID and such go inside of on character creation.

New misc items that can go on key rings:
Magnesium Firestarter
Locket
PenLight
Cosmetic Monocle
Military Medal
Prescription Monocle
Paper Clip
Jig Lure
Minnow Lure
Bobber
Padlock
Combination Padlock
Scissors
Medical Shears
Safety Scissors
Necklaces
Chokers
Bracelets
Rings

New misc items that can go in wallets:
Magnesium Firestarter
Locket
Tweezers
Alcohol Wipes
Buttons
Pills
Comb
Scalpel
Eyeshadow
Foundation
3D Glasses
Cosmetic Monocle
Military Medal
Pocket Watch
Prescription Monocle
Dog Tags
Handiknife
Keychain Bottle Opener
Chewing Tobacco
Cigarette
Rolled
Cigarette
Cheroot
Tobacco Pouches
Disposable Lighter
Lighter
Matchbox
Dried Tobacco

The "Snax" version adds various snack sized foods to the wallet and keychain list.
If you have any suggestions for things you feel should fit in/on wallets/keychains then let me know and I'll probably add them!

Feel free to recommend items to add to these lists!

No tips needed, but are appreciated!
https://ko-fi.com/verysaltyoreos```
vast pier
#

No brass, I don't wanna add zinc into the game 🔥

#

There may end up being multiple types of bronze if I care enough tho

#

as you can make aluminum bronze, not just tin

#

biggest dependency is how many items I wanna create

vague marsh
#

self:setActionAnim("Loot") -- i only know loot cause i saw it on other mod lol

what other action anims i can use? where can i see the list?

silent zealot
tacit pebble
vague marsh
# tacit pebble

thx ill try that! its my first time tinkering with anim lol

silent zealot
#

I think it's far too much detail for Zomboid, but I'd rather lump all brass and bronze together and have several grades of steel since steel matters a lot more to a typical playthough.

plush wraith
#

CharacterActionAnims.Eat ex

vague marsh
plush wraith
#

but they esentially point to those XML's and if you created your own you would pass a string in

vast pier
vast pier
#

If i remember correctly it’s a primarily copper alloy with a low percent zinc content

#

Which is basically what bronze is. A primarily copper alloy with tin/gold/silver/aluminum

#

Yeah just looked into it a bit, tin bronze is also referred to as red brass

bright fog
#

Welp someone shared already lol

thin walrus
solid cove
#

Hello, programmers!

I have an issue with displaying text in the game. As you know, the game renders text from left to right, but since I am translating it into Arabic, I need to display it from right to left because Arabic is written in the opposite direction of Latin languages.

Do you have any solutions for this problem?

silent zealot
#

I don't think there is going to be an easy way to do that; the UI code is scattered all through the lua and java, and assumes a left-to-right language.

#

I assume you'd need to change the direction in every place that renders text

silent zealot
#

Also, playing with a controller is horrible and all I did was make a character and walk outside.

thin walrus
#

Could someone help me with the problem that when I change the information in the mod.info file, the description in the game may not change?

#

I have two copies of the mod, one is in zomboid/workshop and the other is steam/steamapps/workshop/content/108600

#

Where else can I look for copies of the mod if this is the problem? There are none in the local files

bronze yoke
#

does it not change even after a game restart?

silent zealot
bronze yoke
#

it is best to unsubscribe from your mod when making changes so that the live version doesn't interfere with anything

silent zealot
#

Unsubscribe from the mod you're working on in steam.

#

And then there are two places: c:\users\username\zomboid\mods\ and c:\users\username\zomboid\workshop\

thin walrus
silent zealot
#

Since you've already put it on steam it should be in workshop, make sure you don't have another local copy in mods.

silent zealot
thin walrus
silent zealot
#

So there's no second copy in the second copy under the 108600 foldeR?

thin walrus
thin walrus
#

the only copy of the mod left (that I know of) is in the zomboid/workshop folder

silent zealot
#

Try this as a diagnostic step: change the Mod ID and name in mod.info. See if that results in the new AND old id/description showing up.

bronze yoke
#

doesn't the mod menu show somewhere where the mod is installed to

silent zealot
#

All you get is this.

bronze yoke
#

maybe that was the old one...?

silent zealot
#

could have been added bya mod manager mod?

winter bolt
#

yeah the old one used to show that

thin walrus
bright fog
#

Like I told you 10 times I think lol

thin walrus
bright fog
#

Verify you don't have a copy in /mods or /workshop

thin walrus
bright fog
#

What's your modID

silent zealot
#

Remove the mod completely outside the zomboid folder

#

So you have zero copies of the mod (that you know of)

#

Does it still show up?

#

If so, go into every mod in the local mods and workshop folder and check the mod.info

silent zealot
#

And hope you don't need to do the smae for every workshop mod

silent zealot
#

So, you need to find which one.

thin walrus
silent zealot
#

Were you editing workshop.txt instead of mod.info?

#

How many mods in C:\Users\username\Zomboid\Workshop\Some Folder\Contents\mods

#

Is there only one mod.info in the mod? (eg: do you have one in /42 and one in /common)

thin walrus
thin walrus
silent zealot
#

Are you on B41 or B42?

thin walrus
silent zealot
#

it shouldn't matter (especially if the content is identical) but remove the one in the top level, so only the one in 42 remains.

#

Then we know 1) you have only one mod,info (do a file search just to make sure) and 2) when this local workshop folder is removed the mod does not show up at all.

silent zealot
#

so if zomboid is still getting the old name (after being restarted) there is something immensely weird going on.

silent zealot
#

did you do the file search for mod.info and confirm no extra copies?

thin walrus
grand raven
#

Is there way to use rotten food in craft?
Can't find any flag for it ; (

thin walrus
#

their type is not a file, but a shortcut

silent zealot
silent zealot
#

Where are the shortcuts, and what do the shortcuts point to?

grand raven
#

@bright fog flags[AllowRottenItem] ?

#

This flag isn't working : (

bright fog
#

But ik I've seen a tag to allow rotten food already

thin walrus
# silent zealot Where are the shortcuts, and what do the shortcuts point to?

Now I'll try to tell you. These two shortcuts lead to a folder with the name of my mod workshop ID (I removed it from the 108600 folder to the desktop), and when this park is on the desktop, the old description and name of the mod.info opens, which annoys me so much, but when I return it to the 108600 folder, when I open the mod.info it shows me a new description and the suggestion "Save unsaved changes?" pops up.

#

when I deleted this folder to the trash, the description and name of the mod in the game remained the same

silent zealot
#

Did you delete the links? I'm suprised teh game follows them, but better to get rid of them

grand raven
#

@bright fog where i can find those flags?

silent zealot
#

A list of every possible flag?

#

Two options: 1) look at existing recipes; do some grep/awk/sort/uniq type magic to get a list of every flag in a vanilla recipe

#
  1. look look at decompiled java to see what is supported by the recipe parser
#

If there is a list on the modding wiki make that option zero 😛

grand raven
#

Ohh

jaunty marten
# grand raven <@293815892805025793> where i can find those flags?
public enum InputFlag {
   HandcraftOnly,
   AutomationOnly,
   IsFull,
   NotFull,
   ItemIsUses,
   ItemIsFluid,
   ItemIsEnergy,
   IsEmpty,
   NotEmpty,
   Prop1,
   Prop2,
   ToolLeft,
   ToolRight,
   IsDamaged,
   IsUndamaged,
   IsWholeFoodItem,
   IsEmptyContainer,
   IsUncookedFoodItem,
   IsCookedFoodItem,
   IsNotDull,
   IsHeadPart,
   IsSharpenable,
   DontPutBack,
   InheritColor,
   InheritCondition,
   InheritSharpness,
   InheritHeadCondition,
   MayDegrade,
   MayDegradeLight,
   MayDegradeHeavy,
   SharpnessCheck,
   InheritUses,
   FullOfWater,
   MostlyFullOfWater,
   AllowFrozenItem,
   AllowRottenItem,
   NoBrokenItems,
   AllowDestroyedItem,
   IsWorn,
   IsNotWorn,
   InheritAmmunition,
   CopyClothing,
   AllowFavorite,
   InheritFavorite,
   FakeOutput,
   DontReplace,
   CanBeDoneFromFloor,
   ItemCount,
   IsExclusive,
   InheritFood,
   InheritFoodAge,
   InheritCooked;
}
silent zealot
#

It apparently takes a lot of training to stop building a wall halfway.

thin walrus
# silent zealot Yes. But first, where are they? If the mod system is reading mod.info from wei...

Friend, thank you for all your help, thank you very much, I figured out how to change the information about my mod, I have to create a new mod.info file and add the information I need there, that is, if I edit the information in an existing mod.info file, then the new information will not be displayed in the game. Is this how it should work, or do I have an alternative way and I had to invent a wheel?

tacit pebble
# grand raven Ohh

is your script still same when you sent me a dm before? then try this
craftRecipe Make RedWine --> craftRecipe MakeRedWine

thin walrus
#

Now I need to figure out why I get errors when I run the mod, but it doesn't affect the mod itself and I'm hungry as a wolf, so I'll put this off until later😆

silent zealot
#

But if that works, it works.

#

Not the weirdest kludge I've seen in programming.

thin walrus
grand raven
#

@tacit pebble nah
Didn't work

tacit pebble
grand raven
#

Yes
Only takes fresh

bright fog
#

There's a lot of stuff

grand raven
#

craftRecipe Make RedWine
{
time = 360,
timedAction = Making,
tags = AnySurfaceCraft,
SkillRequired = Cooking:1,
xpAward = Cooking:15,
category = Essential,
inputs
{
item 1 [Base.MortarPestle] mode:keep,
item 1 [Base.Sugar;Base.SugarBrown],
item 4 [Base.Grapes] flags[AllowRottenItem],
item 1 [Base.WaterBottle;Base.Pot;Base.Saucepan;Base.SaucepanCopper] mode:keep,
-fluid 1 [Water;TaintedWater],
}
outputs
{
item 1 Wine2,
}
}

bright fog
#

I'd love to get more help on the wiki to have people actually write pages on the wiki but I'm sadly kind of alone making pages for modding rn :(

#

My current plan is to write pages about timed actions and custom UI

#

Also context menu

silent zealot
#

Good idea, since those are very common things to deal with

bright fog
#

Yea

#

Recipes even more tho

#

So probably better to get these done first idk

silent zealot
#

They really should finish the chainsaw. it's a weapon type in java, there are animations for running with it...

#

combat animations that just need sound effects and to not break between animations...

#

...then the chainsaw got stuck in a zombie's head.

green gust
#

Do we know if anyone is making horses? I want horses and have never modded in my life but if it's not happening I will learn

umbral raptor
green gust
#

I know

#

but i wanna give it a try

umbral raptor
#

do u have any experience with modding or LUA?

green gust
#

it'll be terrible 100%

green gust
umbral raptor
#

lots of scripts, LUA, and more

#

textures too.

green gust
#

I've made a model so far

#

well, mosts of a mode. The legs aren't attached

umbral raptor
#

but to answer ur question, i doubt anyone is modding a horse rn

green gust
#

Hmmm

umbral raptor
#

theres no new animal mods so far

green gust
#

at all?

umbral raptor
#

you might also wanna look at how zomboid implements animals

umbral raptor
#

i wish there were a hostile animals mod

#

black bears, wolves, etc.

green gust
#

I've been digging through the game files. Lots to go over

green gust
#

feral dogs that could attack you for your food but you could also tame

#

I think I can figure out the animations. I've got a brother in animation I can ask for help there.

green gust
bright fog
# green gust at all?

The only "new" animals are simple retextures or remodels that are different races of an existing animal

#

No new animal with new behavior etc

#

Someone is currently trying to make a dog, but I haven't seen much news from them since last week

#

Also riding the horse is another challenge in itself

green gust
#

Bike with new animations that can disagree with you

green gust
#

Horses are just bikes. That can disagree with you./j

bright fog
#

They aren't

#

You can't have an animal act like a vehicle

#

It would involve linking both the IsoAnimal and IsoPlayer with the zedgrab system or whatever they called it, and I haven't seen a single person do anything custom with that system

#

I don't even know if it's possible to do anything with that currently

umbral raptor
#

haha reminds me of a horse mod that used to exist of PZ

green gust
#

There are motorbike mods right?

#

horsing around

bright fog
#

If you want your horse legs to spin, yeah

#

That was an existing joke mod

umbral raptor
#

In this episode of Project Zomboid Mods Done Quick, we check out Horsin' Around! This mod adds horses to Project Zomboid... But not like you might think.

Enjoy!

------------------------------------- Important Links -----------------------------------------

The Mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2787602743&searchtext=h...

▶ Play video
umbral raptor
green gust
#

that one is just a horse-shaped vehicle

bright fog
#

But trust me you would have already seen a fuck ton of horse mods if it was that simple

bright fog
#

So it's the same thing, it's a vehicle

#

But here in B42 you're not going to make a horse a freaking vehicle, you'd want to use the IsoAnimal system

brave bone
#

question: Is there a way to detect a placed object? like if I placed a tent, its name is camping_04_100, then if i place another one it changed to camping_04_20 is there a better way to do it?

bright fog
#

Have the horse actually be an animal, use animal systems

bright fog
#

To not take into account the variations

#

Or make a key table

#

A lookup table

#

To verify the entry is in the valid tents sprites

brave bone
#

this is how we look it up ,

#

oh crap lol

#

is it too small?

#

i mean the image

umbral raptor
#

tbh i'd love the ability to make pack animals

#

like attach saddle bags to cows and rope them with ur loot

#

would make caravans possible

#

and also something to carry ur loot around for u that is like a medieval car

brave bone
umbral raptor
#

i've never seen or heard of anyone riding a cow. i dont think they listen to humans or are reliable like horses

brave bone
#

but I would go for rideable pigs 😄

green gust
#

I don't think they're very comfortable. Boney and very jolting movement

bright fog
brave bone
bright fog
bright fog
#

Also yeah don't use table.contain, just directly use a lookup table

#

I should probably explain these better in the wiki page

brave bone
#

we just use what we see from the internet and try to apply what works loool..

#

so.. we kinda used a string.match thats why we used ^camping to get the start for the string haha..

#

I'm gonna look into the lookup table, and probably ask our friend that really codes if he can explain it to us better. ty for suggesting it.:D

ancient grail
ancient grail
brave bone
#

` local sprite = obj:getSprite() -- Get the object's sprite

                    if sprite and sprite:getName() then

                        local spriteName = sprite:getName()

                        -- Check if the sprite is in the include list or starts with camping_04_ or camping_03_

                        if (table.contains(tentsToInclude, spriteName) or string.match(spriteName, "^camping_04_") or string.match(spriteName, "^camping_03_")) then

                            return true  -- Found a valid tent, return true

                        end

                    end

`

frank elbow
#

Without it, the pattern "camping_04_" could match on the string "prefix_camping_04_"

ancient grail
frank elbow
#

This allows you to just check tentsToInclude[spriteName], which runs in constant time (O(1)) instead of having to check the whole table (O(n))

brave bone
ancient grail
#

ahh its like regular expression

frank elbow
#

Similar, but less powerful

atomic hare
#

Is there anyone working on making vanilla shoes 3d besides the clothes and boots expanded modder?

errant plaza
#

Hello everyone, i have completed a mod and would need testing for 2k/4k screens, which i do not have. It is a mod to show the remaining zombie count on the world map along with coloured zones representing density. Could anyone help me check if the textures still align correctly for higher resolution screens?

#

This is an example of what the mod looks like:

bright fog
tacit pebble
#

Actually I changed outputs to base.Wine2 from Wine2 and
recipe name to makeRedWine from Make RedWine
before testing, idk this was the problem but worked well. it took rotten grapes.

grand raven
#

omg
gonna test

slim swan
#

I’m not sure if this kind of animation will cause performance issues.

sonic flame
#

what a surprise. 4 year old code and it still works perfectly

sonic flame
#

readable highway signs

bright fog
sonic flame
#

started working on these before we had a world map and way before the big map adjustments

bright fog
#

Editable signs ?

sonic flame
#

I picked the major roads, assigned them highway numbers, and then spawned signs

#

no, just for navigation

bright fog
#

But it's full black, how is that readable ?

sonic flame
#

you right click on them to read

#

getting proper number details on that small of a space didn't work out so well

sharp ibex
sonic flame
bright fog
#

👌

#

I actually have a system in mind to make posters on the map right clickable and appear in full size with the new fliers system

sonic flame
#

love it

#

anything that adds world flavor is good imo

bright fog
#

yea

buoyant violet
#

hello lads, I am running into an issue while adapting a gasmask into the new system, but when I remove the filter from the gasmask I get this error

#

has anyone run into something similar?

plush wraith
#

you are passing in the same item twice

#

newItem should be the type of the nofilter or vice versa

bronze yoke
#

newItem seems already be an itemvisual?

#

shouldn't it be Clothing?

plush wraith
#

I was working with that function the other day to manage the shemagh when smoking

essentially item will be the item type of state 1 and newItem with be the item type of state 2 like this

['Base.ShemaghScarfFace_Green'] = 'Base.ShemaghScarf_Green'

#

So i believe something is wrong in the item def if calling it that way

vast pier
#

Was kinda hoping for a character deletion bug

sly monolith
#

how can i make my clothes hide under jackets etc? i tried to do stuff with masks but it's only causing more issues rather than help with anything

buoyant violet
winter bolt
#

what does the clothing xml look like

sly monolith
# winter bolt what does the clothing xml look like
<clothingItem>
    <m_MaleModel>media\models_X\Skinned\Clothes\unholy_top.fbx</m_MaleModel>
    <m_FemaleModel>media\models_X\Skinned\Clothes\unholy_top.fbx</m_FemaleModel>
    <m_GUID>17acc51e-88e8-4681-a884-431ec82d6b1a</m_GUID>
    <m_Static>false</m_Static>
    <m_AllowRandomHue>false</m_AllowRandomHue>
    <m_AllowRandomTint>false</m_AllowRandomTint>
    <m_AttachBone></m_AttachBone>
    <m_Masks>11</m_Masks>
    <m_MasksFolder></m_MasksFolder>
    <textureChoices>clothes\Unholy</textureChoices>
</clothingItem>```
#

that's for the top

winter bolt
#

remove <m_MasksFolder></m_MasksFolder>

sly monolith
winter bolt
#

no

#

clothing needs the same uvs so that masks and blood work

tranquil kindle
#

Maybe make new body location for your thing, then create custom rule like in BodyLocation.lua

group:setHideModel("Jacket", "YourNewBodyLocation")
plush wraith
brave bone
#

is there a difference when using spriteName:sub vs spriteName:match? we are researching look up lol

bronze yoke
#

string.sub returns a substring between two different indices into the string (so if you did string.sub("myString", 1, 5) it would return the string between the 1st character and the 5th character, "myStr"), string.match searches the string for a match for a pattern and returns that match

brave bone
#

so sub is more specific than match in terms of finding stuff

teal nacelle
#

Anybody know how to check if a character cut off their arm?

#

I'm trying to read TOC's code but it's difficult

#

Then there's also the issue of detecting when the player tries to reload n stuff

bronze yoke
brave bone
#

got it, i think we will stick to match since we are a bit more familiar with regular expressions. thank you for clarifying stuff :3 , but will try out sub for tests 😄

sly monolith
honest peak
#

@vast pier i have found a issue with the pot mod

#

we can't put the stew into bowls

vast pier
#

Yeah someone commented on that, I think that's more so a recipe issue

#

I could probably just make a duplicate of the recipe that uses the forged pot instead as an easy fix

distant inlet
#

are there unique IDs for objects that can be placed in the world (books, generators, pots, ..) and also ways to load objects into a script by ID?

plush wraith
#

When people complain about the default settings but don't change the default settings on your mod to their liking and instead come and complain

teal nacelle
#

is this how i'd get the animations to change? I grabbed the reloading timedactions and did this for magazine inserting (obviously gonna change this once the animation is actually in there, this is just a test to see if I have the right idea)

function ISInsertMagazine:start()
self:setAnimVariable("WeaponReloadType", self.gun:getWeaponReloadType())
self:setAnimVariable("isLoading", true)
self:setOverrideHandModels(self.gun, nil)
if GetAmputatedLimbs("none") then
self:setActionAnim(CharacterActionAnims.Reload)
else
self:setActionAnim(CharacterActionAnims.Reloadonearm)
self.character:reportEvent("EventReloading");
self:initVars()
end

#

i also don't know how to add the animation as a CharacterActionAnim

#

just trying to get used to this syntax 💀

bronze yoke
#

you don't need to, CharacterActionAnims is just an enum of strings, you can pass a string instead

teal nacelle
#

pass a string?

plush wraith
#

self:setActionAnim("My_Reload_Anim") ex

bronze yoke
#

if i remember, the animset must be in player/actions/ and the string you pass corresponds to its m_AnimName

teal nacelle
#

I'm still not entirely sure how exporting the animation works, I saw someone exporting it as an FBX in another mod?

plush wraith
teal nacelle
#

would this go into the remove/insert magazine script, or?

plush wraith
#

Just in general if you want to overwrite or change vanilla functions doing it that way allows the vanilla code to run unaffected or lets other mods use the native code as expected

This would be in a lua file you define in your mod structure somewhere

tacit pebble
#

if it passed your conditional then
do your code
else
do original code
end

teal nacelle
#

still need to know how to export the actual animation into a usable thing-

bronze yoke
#

you can just export as fbx, you need an animset as well though

teal nacelle
#

animset?

bronze yoke
#

which are very annoying to write and for some reason still nobody has bothered to document them at all

teal nacelle
#

where should i put the fbx?

#

so, I'm guessing the animsets go into AnimSets/player/actions at least

#

i tried looking at a mod that changes gun animations and that's all i really got

bronze yoke
#

so my mod has anims_x/SprayPaint.fbx and animsets/player/actions/SprayPaint.xml with the contents```xml
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>SprayPaint</m_Name>
<m_AnimName>SprayPaint</m_AnimName>
<m_SpeedScale>1.00</m_SpeedScale>
<m_BlendTime>0.20</m_BlendTime>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>SprayPaint</m_StringValue>
</m_Conditions>
</animNode>

#

come to think of it, i'm pretty sure the action corresponds to the PerformingAction value here

#

i don't know what m_SyncTrackingEnabled does, and nobody i've asked in the community knows either, but my animation was crazy buggy until i set that to false

teal nacelle
#

i looked at the mod again and it puts the fbx files in anims_X/Bob

#

guess I'll do that?

bronze yoke
#

i don't think the location of the fbx file matters as long as it's in anims_x

teal nacelle
#

got it

#

like this?
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>reload_onearm</m_Name>
<m_AnimName>reload_longgun</m_AnimName>
<m_SpeedScale>1.00</m_SpeedScale>
<m_BlendTime>0.20</m_BlendTime>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>reload_onearm</m_StringValue>
</m_Conditions>
</animNode>

bronze yoke
#

looks good to me

teal nacelle
#

crashed when i tried to load in and test it

brave bone
#

question: how does the rain rendering works, when under a roof tile. i can't find anything related to that.

silent zealot
# vast pier lol, nothing happens?

The player in the car just appears on the ground. Probably a safety "if player:getVehicle()=nil go back to walking around" somewhere in the code.

silent zealot
brave bone
plush wraith
#

what are you trying to do?

brave bone
#

trying to have the outdoor only rain effect and sound while near a tent. if it is in java then i won't poke on that for now. lol

plush wraith
#

Different sounds play when under a roof or not? Maybe u can try spoofing roof tiles around the tent to acomplish that

silent zealot
#

IsoGridSquare, renderRainSplash

brave bone
silent zealot
#

those are the conditionals.

brave bone
# silent zealot

ooooooh... we gonna take a look at that. hopefully my brain doesn't explode lol

silent zealot
#

I'm not sure you'll be able to trace it back to anything usable.

#

Maybe create an invisible roof tiles one square up above tents?

#

That would probably end up looking like rain splashing on an inviisbel force field.

brave bone
teal nacelle
#

Was able to load in with my mod this time, gonna see if it works

#

Oh, it just removed all functionality from the only cure

#

Shit

#

Gonna try just putting the reloading into its own script entirely

#

Doesn't do the animation but it functions now

#

does this look like it'd work?

local originalFunc = ISReloadWeaponAction.start

function IsReloadWeaponAction:start()
if GetAmputatedLimbs("forearm_" "hand_") then
self.setActionAnim("reload_onearm")
else
originalFunc(self)
end

tacit pebble
#
function IsReloadWeaponAction:start()
  if GetAmputatedLimbs("forearm" "hand") then
    self.setActionAnim("reload_onearm")
  else
    originalFunc(self)
  end

this code will only run self.setActionAnim("reload_onearm") when GetAmputatedLimbs("forearm" "hand") is true
originalFunc(self) will not run if it passes GetAmputatedLimbs("forearm" "hand")

bronze yoke
#

"forearm" "hand" is not valid lua syntax

#

not sure exactly what you're trying to do here but you may be missing a comma

teal nacelle
#

I had the comma before, weird

#

I was trying to detect if a hand or forearm was amputated

tacit pebble
#

I guess it's because of markdown text of discord
something like.. bold Itellic

merry patio
#

What code would be suitable to reduce the speed of zombies in the game? Is there someone who can give me guidance or some guidance on this?

merry patio
# vast pier Does your lua already check the weather? If so then it can apply a variable to t...

if I already have weather detection solved, I just need the function to reduce the speed of the zombies. I tried with:

local moveDeltaModifiers = MoveDeltaModifiers()
moveDeltaModifiers:setMoveDelta(0.5);
objZombie:setMoveDeltaModifiers(moveDeltaModifiers)

Hoping to reduce the speed by half, but it didn't work. So, I'm not quite sure how to do it. I've been trying to modify XML files to bring them under this instance, but that didn't work either

merry patio
plush wraith
#

there is a field in the xml that specifies SpeedScale if that is what you are after

#

When I wanted to have a slower smoking anim, I had to create another xml that pointed to the smoking anim but had the SpeedScale set lower, not sure how movement works with the anims but maybe its the same

merry patio
plush wraith
#

conditionally checks and sets the anim to the default or my 'Smoke_Quiet'

#

heres part of that xml

merry patio
# plush wraith heres part of that xml

Right, in the case of your mod, the animation varies depending on whether the mod is activated or not, correct? In my case, it should only activate under an IF condition in Lua. Do you think I could apply it in the same way?

#

It's the zombies that I want to reduce the speed for. Specifically, in the animations that are in the Walktoward folder. But I want to reduce their speed when the zombie's temperature is better than one chosen by the user

karmic elk
#

Hi. Not sure if this is the right place or discord. I’m very experienced with Lua and modding of DCS, but have never touched PZ modding yet, I’ve looked at some pages on the wiki but I’m having trouble finding what I’m looking for and was wondering if someone here could point me in the right direction please?

What I’m trying to do is add commands (and manually sort) the context menu. I am frustrated that ‘disassemble’ is always at the bottom and want it where the right click happens and I want to add my own context menu commands for the place, pick up, disassemble and rotate because trying to use the hid buttons a) on an ultrawide monitor is just a PITA and b) I guess it’s a core game bug but the white highlight keeps vanishing and I have to pick the command again and again. Putting these in the context menu would be a much better solution, short of having dedicated key binds for them.

Any thoughts?

grand raven
#

Hey

Wanna make craft

Like

Input

pot with water
Berries

Output

Pot with wine

But problem is that

I'm getting 2 pots
1 empty
1 with wine

Is there any flag for destroying that pot after craft?

tacit pebble
#

refer the MakeCoffeeMug craft recipe.

silent zealot
#

I’m having trouble finding what I’m looking for and was wondering if someone here could point me in the right direction please?
This is definitely the right place for questions like that.

#

Workaround: I use Eggon's hotkeys and up arrow for pickup, down arrow for putdown, del for take apart.

tacit pebble
#
craftRecipe MakeCoffeeMug
    {
        timedAction = MakeCoffee,
        Time = 20,
        category = Cooking,
        Tags = CoffeeMachine;Cooking,
        inputs
        {
            item 1 [Base.Coffee2],
            item 1 [*],
            -fluid 0.2 [Water;TaintedWater],
            item 1 tags[CoffeeMaker],
            +fluid 0.2 Coffee,
        }
        outputs
        {
        }
    }
#

    item GlassTumbler
    {
        DisplayName = Tumbler,
        DisplayCategory = WaterContainer,
        Type = Normal,
        Weight = 0.2,
        Icon = GlassTumbler,
        IconFluidMask = GlassTumbler_Mask,
        Tooltip = Tooltip_item_RainFromGround,
        StaticModel = GlassTumbler_Ground,
        WorldStaticModel = GlassTumbler_Ground,
        FillFromDispenserSound = GetWaterFromDispenserGlass,
        FillFromLakeSound = GetWaterFromLakeBottle,
        FillFromTapSound = GetWaterFromTapGlass,
        FillFromToiletSound = GetWaterFromToilet,
        Tags = CoffeeMaker,
        

        component FluidContainer
        {
            ContainerName   = Glass,
            RainFactor    = 0.5,
            capacity        = 0.2,
            CustomDrinkSound = DrinkingFromMug,
        }
    }
silent zealot
#

media\lua\client\ISUI\ISContextMenu.lua has all the context menu code; you could add a context menu function that gets the list of exist context menu entries and removes disassemble, then adds it back in at the top.

merry patio
plush wraith
merry patio
merry patio
#

self:setActionAnim work for NPC and player... 😦 i need for zombies

tacit pebble
#

i believe self.character is not nil however, if it's nil then... have to find something else to check

#

oh i realized that is not you asked for

merry patio
# tacit pebble oh i realized that is not you asked for

if instanceof(objZombie, "IsoZombie") then
local iZombieTemp = getClimateManager():getAirTemperatureForCharacter(objZombie)
iZombieTemp = math.floor(iZombieTemp)

        local iFreezingTemp = SandboxVars.SlowerLunging.Freezepoint

        if iZombieTemp < iFreezingTemp then
            print("Temp ")

            objZombie:setVariable("PerformingAction", "lunge1_slow")
         else
           objZombie:setVariable("PerformingAction", "lunge1") --
          
        end

it's still like that, but the lunge1_slow.xml animation keeps overriding lunge1.xml

#

and XML

silent zealot
#

Finally got the finishing touches done and uploaded this.

#

Automated swapping between mains power and battery power.

midnight quail
#

Can anyone help me understand how can i make this recipe work?
Im trying a work around to get leather in the wild in remote areas when theres no deer or captive animals. Ive used the existent structure of the recipe "Butcher small animal" but it doesnt recognize the different breeds of rabbits and i couldnt find a existing tag or even an id for the breeds to add as alternatives in the code. So when i have an Appalachian rabbit it just doesnt see it as a dead rabbit. Ive also tried to find the original recipe that shows in the context menu but my knowledge is too simple for that.

}
    craftRecipe ButcherRabbit
{
    timedAction = SliceMeat_Surface,
    Time = 50,
    OnCreate = Recipe.OnCreate.CutAnimal,
    Tags = AnySurfaceCraft;Cooking,
    category = Cooking,
    xpAward = Butchering:10,
    inputs
    {
        item 1 tags[SharpKnife;MeatCleaver] mode:keep flags[MayDegradeLight;IsNotDull;SharpnessCheck],
        item 1 [Base.DeadRabbit] mappers[animalType] flags[InheritFoodAge],
    }
    outputs
    {
        item 1 Base.Rabbitmeat,
                    item 1 Base.Leather_Crude_Small,
    }
silent zealot
#

Animals are not items, even when dead.

silent zealot
#

That's why picking up a skeleton is so weird.

vague marsh
#

i saw another mod like that, tho i thinks its broken rn

silent zealot
#

which can work if a specific radio type is forced to use mains power, or if you swap back and forth with some sort of coversion system but then it gets weird when doing the world-placed objects if they are not also duplicated.

vast pier
silent zealot
#

ButheringUtil.lua, ButcheringUtil.butcherAnimalFromGround() looks like a likely place.

#

Can you put full sized rabbits on a butcher's hook? If so you should just need to add leather to rabbits in AnimalPartsDefinitions (and build a butcher's hook)

#

I'd try something like this so butchering any animal on the ground will give leather (or add a conditional if you want to restrict what gives leather when butchered on the ground)

OGButcheringUtil_butcherAnimalFromGround=ButcheringUtil.butcherAnimalFromGround

function ButcheringUtil.butcherAnimalFromGround(carcass, player, keepCorpse)
    -- get leather before corpse is processed
    if not carcass:getModData()["babyLeather"] then -- if this is true then the main function will add the leather
        local leather = ButcheringUtil.getLeather(carcass:getCarcassName());
        if leather then
            local leatherItem = player:getInventory():AddItem(leather);
        end
    end
    -- call original function
    local returntext = OGButcheringUtil_butcherAnimalFromGround(carcass, player, keepCorpse)
    return returntext
    
end    
merry patio
# vast pier is lunge1_slow a vanilla animation?

no no! lunge1.xml is vanilla animation. I created lunge1_slow.xml to try to trigger it in LUA under a condition. Then I would have lunge1.xml vanilla run normally until the "if" condition is present. In the case of my mod it is triggered by the zombie's temperature. Basically I want that when it reaches a certain temperature a different animation is executed than lunge1.xml vanilla

vast pier
#

why are there two variables?

umbral raptor
#

i'd like to thank indiestone for making me spend 4 hours debugging because they cant spell

#

the fucking boilersuit files in vanilla is called boliersuit. my file was called boilersuit. i copied the boilersuit guid.

#

please fix, literally unplayable

bright fog
#

And that's only the start of the typos

grand raven
silent zealot
#

The lua function fills the input mug with coffee.

silent zealot
bright fog
drifting ore
#

The clitter? Yeah I've heard of that...

silent zealot
#

It's hard to find.

#

Has to be a special event.

merry patio
# vast pier do you have anything actually clearing the variable?

I thought that way one would replace the other when the condition is met. The mod works until the zombie's temperature is detected.

if iZombieTemp < iFreezingTemp then
print("Temp ")

But I'm not finding the right code to make them stop using vanilla lunge1.xml and be able to use my modified XML when that condition is met.

drifting ore
#

isoPlayer:setWornItem("Torso_Extra", items.Vest)
What is the name of the clothing slot that takes a bullet proof vest? Where can I find documentation about the API that can answer questions such as this?

#

Hi guys, what tags should I use for edible food? I'm trying a mod that adds a food made from hay, also, how to make a crafting script?

mortal escarp
#

Hey guys, I have another networking question. Anyone ever worked with custom animation events and tried to get them synced across the network? Usually, this "just works" because the game internally sends network packets for you during a timed action's animation.

The issue I'm running into is Latency. In single player, the timing of my animation event is perfect. When the event occurs, the animation is at the perfect time to execute the code I need.

In multiplayer, the animation event seems to be occurring slightly earlier than it should and so my code executes slightly earlier than it should.

This isn't a deal breaker as this is a detail only I will probably notice. But I just wanted to ask if you guys have any tips when dealing with packet Latency?

#

@drifting ore I haven't work with custom items yet but I'll do a little digging into source for you. The purpose of tags in general are not yet clear to me.

midnight quail
# silent zealot I'd try something like this so butchering any animal on the ground will give lea...

Thank you for that. Also sorry...
I saw the message of your nicely done mod right before i post my question and took me a second to decide about the timing because i felt like i would take attention from your hard work and a great mod with my silly question. But was 3am for me so i made a hush decision before going to bed 😅
Congratulations on finishing it.

For the change:

Using your directions ive thought just adding the rabbit to the hook would be easier. Then ive just used the code for the deer and change the following lines.

AnimalAvatarDefinition["rabdoe"].hook = true;
AnimalAvatarDefinition["rabdoe"].animalPositionSize = 0.3;

Next was the parts, which ive only added the code bellow respectively for each breed.

AnimalPartsDefinitions.animals["rabbuckswamp"].leather = "Base.RabbitLeather_Grey_Full";

On fail ive tried the base other base item for Rabbit leather "Base.RabbitLeather_Full" which also failed.

It does accept the animal to be attached to the hook and gives the option to get meat and the head, but no leather.

mortal escarp
#

@drifting ore Go to your Zomboid installation folder. Navigate to media/lua/server/recipecode.lua. I think this might be helpful. From what I am inferring (I have NOT tested this theory), tags appear to be used in these functions. Each of these functions are then used within the game's base "recipes.txt".

Use "PizzaSauce" as an example. Do a search in the game files for "PizzaSauce". You'll find three results.

  • media/lua/server/recipecode.lua
  • media/scripts/items_food.txt
  • media/scripts/recipes.txt

All three of these use either the term "PizzaSauce" or they use the function "Recipe.GetItemTypes.PizzaSauce", which is defined within recipecode.lua.

If you dig into this a little deeper, hopefully it will start to make a little more sense? Sorry I can't give more, I would if I could.

teal nacelle
#

most of this is just TOC, but there's an animsets/anim_x folder with the animation and some changes to a few lua files

finite vessel
#

could anyone lend me a hand who has B42 coding knowledge help me fix my recipe script for my mod? i got everything else to work. i just can't get the crafting recipe to show up in game and i fear i'm doing something wrong.

vague marsh
teal nacelle
finite vessel
#

this craft script wont show up in game if anyone knows why feel free to let me know. thanks in advance🙏

vague marsh
#

oh wait is this b42?

finite vessel
finite vessel
# vague marsh then do this instead

im at a loss i have tried this and a couple other things. i have tried studying other mods that are on B42 and i swear everything looks good unless im missing something.

#

this is what it looks like now for a updated look

vague marsh
vague marsh
#

i suggest you look in this folder for reference: C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\scripts\recipes

finite vessel
#

i added the imports base as well as well as fixing the commas

vague marsh
#

anyways gtg

finite vessel
vague marsh
#

you should send your updated code here so others can see

finite vessel
vague marsh
#

its the tag

#

why it has base

finite vessel
vague marsh
#

also commas on the items should be after destroy not on items...

#
module TLGDRC
{
    imports
    {
        Base
    }

    craftRecipe MakeDefiler
    {
        time = 200,
        category = Weaponry,
        xpAward = Maintenance:10,
        SkillRequired = Maintenance:2,
        needToBeLearn = false,
        Tags = AnySurfaceCraft,

        inputs
        {
            item 1 tags[] mode:keep flags[MayDegradeLight;Prop1],
            item 1 [Base.Sledgehammer] mode:destroy,
            item 3 [Base.DuctTape] mode:destroy,
            item 2 [Base.FireAxeHead] mode:destroy,
        }

        outputs
        {
            item 1 TLGDRC.Defiler,
        }
    }
}

#

just insert proper tags

vast pier
#

I made this mod a bit ago and it sets the variable and then clears the variable.
You would just need to determine when the weather is clear, and then use that to clear the variable

#

So cold weather sets the variable, and warm weather clears the variable

vast pier
#

How much health does a normal zombie have?

merry patio
vast pier
merry patio
vast pier
#

You would need to add this to your animation xml

<m_Conditions>
<m_Name>ZFTVariable</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>```
#

This is what checks for the variable and overrides the animation

#

You can change ZFTVariable to whatever you want. I just put a placeholder. (Stands for "Zombie Freezing Temperature Variable")

bronze yoke
#

avoid using acronyms in variable names, they aren't readable and are prone to unnecessary clashes

merry patio
# vast pier You would need to add this to your animation xml ``` <m_Conditions> <m_Name>ZFTV...

"It ended up something like this.
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="defaultLunge.xml">
<m_Name>lunge1</m_Name>
<m_AnimName>Zombie_Walk2</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SpeedScale>0.20</m_SpeedScale>
<m_Conditions>
<m_Name>ZFTVariable</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Events>
<m_EventName>Footstep</m_EventName>
<m_TimePc>0.15</m_TimePc>
<m_ParameterValue>walk</m_ParameterValue>
</m_Events>
<m_Events>
<m_EventName>Footstep</m_EventName>
<m_TimePc>0.6</m_TimePc>
<m_ParameterValue>walk</m_ParameterValue>
</m_Events>
</animNode>

mint oracle
#

Actually you should write everything in acronyms including Consts and Variables to make everything harder to read /s

bronze yoke
nova dome
#

b42 I'm tryna continue my mod project I left nearly two years ago, should I see the mod in modlists when I have the mod folder in user/zomboid/mods? if yes why would it not show up?

#

steam version

merry patio
# vast pier See if it works 👍

It worked partially! When the temperature is below, they performed the animation I intended, but when the temperature is above, they seem to be in the ZombieIdleState and freeze when trying to find me. Just to clarify, I modified the XML file I have inside my mod with the condition you told me, keeping the original vanilla file name. Is this correct? Before, when I tried to create a different animation, I had written the name lunge1_slow.xml in the mod folder, because every time I used lunge1.xml, it replaced the original animation all the time. At least now it's reacting to the IF command, haha. Any ideas? I really appreciate the help

umbral raptor
#

now there is a file called 42, common, etc. Check out any B42 mod

#

the other reason could be a lack of a mod.txt/.info file

#

or whatever it is that contains ur mod's descriptions and such

nova dome
#

Ty, I actually found the b42 version of the mod I forked originally I think, but it's so broken it's only visible in the modlist and that's about it. Oh well it's not like this wouldn't have been just another way to procrastinate 😅

vast pier
merry patio
vast pier
#

Unless Zombie_Walk5_Slow is a vanilla AnimName?

#

The only things you need to change is the file name, and variable. And whatever speed stuff you were doing ofc

merry patio
# vast pier No it needs to have the same AnimName internally because that’s the animation it...

"It was my mistake! I wanted to try if creating a replica of the animation in my mod would work, but it didn't.
I just changed the name back to the original animation and kept the LUA code. I also gave a unique name to the XML file in my mod, but it doesn't seem to be doing anything now.
Before, when the temperature was low, they used the XML file from the mod, which actually only replaced the vanilla one, and when it was above the temperature, they seemed to be in the ZombieIdleState, like they were frozen

vast pier
merry patio
vast pier
#

I do not know why, you just do

bronze yoke
#

they didn't update the code that checks for files to the new structure

merry patio
bronze yoke
#

the one in the b42 structure is the one that's actually loaded but you need some kind of file in the b41 structure to be detected

vast pier
merry patio
#

I should only put AnimSets inside it, right?

vast pier
#

Yeah, unless you plan on making the mod compatible with build 41

merry patio
candid egret
vast pier
turbid ruin
#

If i want to start modding, what would be the best little mods to start with?

finite vessel
vast pier
brave bone
turbid ruin
mortal escarp
#

Anyone have experience using getPlayer():die() and/or getPlayer():becomeCorpse() in a multiplayer setting?
NOTE: doesn't have to be "getPlayer()" specifically, just an instance of IsoPlayer/IsoLivingCharacter/IsoGameCharacter where these functions are being invoked.

#

My brain is dying trying to resolve a visual glitch that I just can't get properly synced across the network.

gaunt meteor
#

is there any way to troubleshoot bugs that happen at character creation screen? it seems the bugs i get are not in the log, unless im reading the wrong one (im in mp)

mortal escarp
# bright fog What's the visual glitch ?

The character dies and they become corpse as normal. However, for a split second, the model stands up and then instantly snaps back down. This is happening within a time action that plays an animation. That character:die() function is called and then self:forceComplete() on the action is called. I suspect the end of the timed action might have something to do with it but I'm not certain.

umbral raptor
#

does anyone know a mod that allows random chance through recipe creation (B42) or know how to do it? i want to create a recipe with a random chance to generate different things

vast pier
#

use newrandom instead ofzombrand

#
local random = newrandom()
if random:random(3) == 0 then```
#

Partially just because I think ZombRand(3) would actually be 0-2 instead of 0-3

bronze yoke
#

keep in mind that random has different limits than zombrand

#

ZombRand(3) can roll 0, 1, 2, Random:random(3) can roll 1, 2, 3

vast pier
#

ah, then
random:random(4) == 1 then

#

assuming they're wanting a 1 in 4 chance and not a 1 in 3

#

I could be wrong

#

I'm tired

bronze yoke
#

i guess the intention of their code is ambiguous here

vast pier
#

either way, isn't zombrand less random than it should be?

bronze yoke
#

it's actually a lot more random than it should be

#

that's why random is so much faster

#

zombrand calls on some weird high quality rng library apparently used for security and casinos and shit

vast pier
#

all I know is the wiki says to use newrandom instead of zombrand whenever possible

bronze yoke
#

random is preferred just because it performs better

vast pier
#

Also since character:getInventory() is used multiple times, you could (and should) probably cache it

#

Tell me if I'm wrong tho

bronze yoke
#

you should for style reasons

vast pier
#

I mean you probably also should if the recipe gets called a bunch in a short timeframe, no?

bronze yoke
#

for performance it doesn't matter since only one will be called in a single execution of the function anyway (it might even be slightly slower to cache it)

vast pier
#

ah, alrighty then

#

I am nothing more than a dog

#

bow wow

silent zealot
#

I have defeated the 50 units of weight per tile limitation!

brave bone
silent zealot
#

It's why you can't put too many fuel can/water dispensor bottles/etc in one square.

#

I started with "I want to remove the hard limit of 50 on player inventory" and turned into "I want configureable removal or all container weight limits everywhere without relying on setting weigth to zero, negative mass items or backpacks that only work when worn"

brave bone
#

are there any write ups for modding animals?

silent zealot
#

I can tell you know to make them give a fluid of your choice when milked.

bronze yoke
#

nobody really knows how to do much with animals yet

silent zealot
#

Did the issue with animations get sorted out yet?

bronze yoke
#

there's a big bottleneck with nobody knowing how to do custom animal models/animations that's kinda holding back most interest in it

brave bone
silent zealot
#

I was very suprised with how popular it was - based on comment count it's my best mod ever.

brave bone
#

so my buddy are thinking introducing bear into the wild , roaming the town, and probably attacking zombies and players . but we will wait for any documentations for now lol

silent zealot
#

Or give it a go and then you can write the documentation!

sly monolith
#
table.insert(ZombiesZoneDefinition.Default,{name = "Unholy", chance=100, room="church", gender="female"}); 

table.insert(ZombiesZoneDefinition.Stripclub,{name = "Unholy",  chance=100, gender="female"});
#

is this a proper way of adding a zombie to a location?

#

i can spawn a zombie wearing that outfit, but there's no way i can find it in world, i tried jumping around map to see multiple churches and clubs and couldn't find a single zombie wearing this thing

#

also is there a way to just foce world spawns, like not the horde spawn thing but just spawning zombies where they would normally spawn

sonic needle
#

besides respawn settings no, not really,

you can try a 100 scale Z spawn with 0 outfit set, and see if it does

most just use the outfit spawn or find it to test

#

table.insert(ZombiesZoneDefinition.Default,{name = "DressNormal", chance=3, gender="female"});

ref for a vanilla location

im testing this for a dress ingame soon, as we have a similar issue

sly monolith
#

oh ok nvm i cranked the chance up to like 100000 and now it works heh

scarlet shore
#

Does anyone know how to make the player play animations other than emotes? playEmote works just fine for animations in media\AnimSets\player\emote , but I'd like to play others like "Yawn" and "Shiver" in player\ext and I can't get PlayAnim,
PlayAnimUnlooped or PlayAnimWithSpeed to do anything.

sly monolith
#

can i somehow stop zombies wearing my outfit from spawning with the vanilla underwear, i looked into naked outfit to see how it works but there's nothing in there

sonic needle
#

not really.. its a default thing i beleive

sly monolith
#

but how are the naked zombies spawning naked

sonic needle
#

Erniffo truly a question to Ponder on...indeed

sly monolith
#

oh ok nvm the "naked" ones also wear underwear, tho it's random sometimes they don't

cinder nebula
#

Hey, all. I am trying to make a mod where if Real-time is selected in the Day Length (in real time) via Sandbox settings, that the in-game sleeping would be equivalent to as if the player chose 15 minutes as the Day Length (Real-time sleeping time in-game takes a few minutes and is just not very practical). This is what code I have, but it doesn't work. Not sure what I am doing wrong.

turbid gale
#

Has anyone actually noticed aim speed as a firearm parameter actually doing anything? Two guns, one with 1 and the other with 100 and aiming circles don't seem to act any different.

brave bone
#

how do you guys open .x files?

bright fog
brave bone
# bright fog This

thank you. i was blind there for a whole 15mins , it was right at my face all along lol.

silent zealot
#

I'd really like a dev blog sharing their thoughts on where they're going with aiming, because they were pretty clear pre-B42 then have made huge changes since it started and it's very unclear how they want it to work.

umbral raptor
#

can someone explain to me when we use function and local function?

#

im not getting it at all

ancient grail
# umbral raptor can someone explain to me when we use function and local function?

its basically like this
when we think of our code we want it in such a way that its optimize and accessible for other modders (patch or addon purposes, and not over populate the global

so 2 ways to do this
1st way (best way)
is to put everything on a local table then return it at the end of the code

local CustomMod ={}
function CustomMod.test()
end

return CustomMod

modders can then access your stuff by

local sample = require(yourLuaFile) 

so they have access using

sample.test()

well i think thats how to do it

i dont use this tbh

what i do use is method 2

mymod = mymod or{}

function mymod.myfunc()
end

so that makes it so that mymod is a table added to the globals
but its just 1 table instead of having all functions be global

bright fog
ancient grail
ancient grail
umbral raptor
bright fog
#

Lua functions that are called from scripts need to be global

brave bone
#

does this mean "local sample = require(yourLuaFile) " , like it helps compatibility?

bright fog
#

It makes your code available for patches and not locked behind local functions which can't be modified by other mods but more importantly it makes your stuff available for patches without requiring the use of global functions which tend to be more performance heavy but even worst possibly clash with other mods that define functions with the same names

cinder nebula
brave bone
ancient grail
#

is this your first mod?

cinder nebula
ancient grail
#

have you done anything with timed action?
maybe figure out a way to check for the time and then force wake up the player
and just give the stats that youre suppose to have

knotty stone
#

Hi, i have a chanceoutput that needs to be set with "setCurrentUses" i have this so far function Recipe.OnCreate.RipClothingBra(craftRecipeData, character) local result = craftRecipeData:getAllCreatedItems() if result:get(1) == nil then else result:setCurrentUses(1) end end but when the extra output doesnt get triggered its throwing an error Callframe at: performRecipe. how do i make this right? if i do just function Recipe.OnCreate.RipClothingBra(craftRecipeData, character) local result = craftRecipeData:getAllCreatedItems():get(1) result:setCurrentUses(1) end its erroring every time there is no extra output, so i wanted to catch that error :/

slim swan
#

How to get the correct icon when an item has multiple icons?

#

like this

buoyant violet
#

Does anyone got a list of all DisplayCategories?

bright fog
slim swan
#

but they all use the same icon name

#

and idont know where to find the icon map

bright fog
trim quartz
#

EDIT: Took the hit and did the decompile, isRecipeActuallyKnown is just a shortcut it isRecipeKnown with true passed into the bool parameter. I Honestly think the PZ devs hate us or themselves sometimes 😂

Hey all, can anyone tell me, in IsoGameCharacter, what is the difference between isRecipeKnown() and isRecipeActuallyKnown() ?

Also, in isRecipeKnown, this is an optional boolean parameter, any idea what that does?

Trying to avoid decompiling the java 🙂

Appreciate any input

trim quartz
#

so might be the same with items? Cant rememeber if inventoryItem or Item has a color property?

slim swan
#

maybe specific item need to use different way to get the icon

#

i use the common way to get the icon ,the pop icon will display like this

#

but the shirt would not be like that ,but cant use the right icon

trim quartz
#

So InventoryItem has a color property, so I'd think that if you're rendering items the player has, then use that when drawing the icon, if you're trying to render all possible options of the item, the item object also has a colour, so I'd guess each color has its own item object

tranquil mountain
#

i just had an idea for a mod that adds zombified animals, i don't know how to make mods, but it would be pretty cool if someone made a mod for that

#

i would imagine that you can still harvest them for their meat, but it would always be rotten and infect you.

vast pier
#

I mean those are also different outcomes.
Zombrand(3) will do 0, 1, 2
newrandom():random(3) will do 1, 2, 3
so if you specifically need 0 or 3 then the one you use changes

small topaz
#

Just in case you are interested: The different 3d models are there since the default model does not look good in all animations a character can perform during game. So depending on the animation the character is in, a different model may be equipped.

bright fog
#

I'd rather teach the most efficient way of doing things than the least efficient one as long as it's not hella annoying to do (which is why I don't teach how to use only arrays to have key table behavior sort of and loop through like Albion explained in her performance guide)

#

In the case of newrandom, it's really easy to do

#

Also if you ever need seeded random, you can just directly use it the same way you always generate random

#

And the advantage of having it generate between a and b with random(a,b) and not a and b-1 like ZombRand(a,b)

#

Less confusion for new modders

#

Less hair falling from their head to try and understand why the random method they use doesn't generate the number b

#

newrandom():random(3) will generate the number 3 which you never check tho

#

You have here

#

That's what Oreo is talking about I believe

vast pier
#

I wasn't trying to say anything was wrong, I was just trying to say it's important to know that zombrand calls 0 but not the highest number listed, while random does the opposite

bright fog
#

See I didn't even realize it doesn't generate 0 for random

#

Tbf I would suggest just always using random(a,b) anyway

#

Makes things soooooo easy

#

newrandom():random(1,3)

#

At least you KNOW and are sure what is generated

#

1, 2, 3

#

While ZombRand you need to take into account it's b-1

#

And every single new modders get fucked by that

finite scroll
#

does anyone know of a way to run a raycast collision check in zomboid?

#

would be super useful

bright fog
#

If you find out I'm curious

ancient grail
#

let us know pls ty

dreamy flume
#

Is there a way to trigger specific radio transmissions? Like the hidden ones on the emergency broadcast?

snow heart
#

any idea how to alter engine sounds to custom ones i have tried but the sounds never play its just a blank sound

small topaz
#

Hi! I have currently the problem that my B41 version of a mod does not load items defined in the script.txt file when I put the script.txt into the new mod's "common" folder which has been introduced in B42. The whole procedure works perfectly fine for my B42 version of my mod though.

bright fog
#

So with a lack of info that'll be hard to know why

small topaz
bright fog