#mod_development

1 messages · Page 163 of 1

bronze yoke
#

what you have now permanently removes your code from the function after it has run once

marsh sparrow
#

ahh yeah understood

mellow frigate
#

local orgISEatFoodAction = ISEatFoodAction:stop(); should be corrected, see fwolf guide

#

orgISEatFoodAction(self) should be called without condition.

#

player:setVariable("CombatSpeed",value) should be called after each pressedAttack call from IsoPlayer or it will be overriden after each attack. I suggest to call it OnPlayerUpdate.

#

To correct your event management, look for exemples of Events.OnPlayerUpdate.Add and Events.OnPlayerUpdate.Remove in existing code

marsh sparrow
#

damn yeah makes sense thx

lone nest
#

Alright, I finally got permission to distribute my version of superb survivors... I am opening it up as a public repo; my plan is to upload it to the workshop this Friday (05/26).

There are still issues with the mod (specifically with the "AI") and sandbox options apparently not saving... but it is "playable" in that it shouldn't destroy your game performance after 30 minutes IRL and survivors won't RKO you when they see more than 3 enemies/zombies.

My hope is to have the sandbox options issues resolved before Friday.
https://github.com/shadowhunter100/SuperbSurvivorsContinued

If you're technical enough to do PZ Lua scripting, I hope you'll join the discussion on github:
https://github.com/shadowhunter100/SuperbSurvivorsContinued/discussions

#

otherwise, feel free to ask questions I suppose; the sooner I figure out the tasks/ai the sooner i can get back to actually playing the game

drifting ore
#

Does anyone know how to upload a mod to the workshop?

sour island
lone nest
sour island
#

Yes

#

Any prints in general given enough runs will slow the game down

lone nest
#

yeah, I already removed the problematic stuff; but from what I can tell the squares needs to be loaded to load the npcs.

sour island
#

That's fine

lone nest
#

so much to my annoyance, i still need to leave it in there

sour island
#

Just remove the prints

lone nest
#

there are no prints in my version of the code, that I can assure you.

sour island
#

Also don't know why you're using Nolan's work tbh, you might be better off working off Aiteron's work

lone nest
#

Yeah, I didn't know before

#

and i was about 2 weeks in

sour island
#

Not too late lol

lone nest
#

frankly, I'll probably look at Aiteron's work for the AI/Task management stuff

#

theres like, 5000 lines of ... things i don't want to deal with

sour island
#

From what I saw there was fundamentally wrong stuff in SS

lone nest
#

and rewriting from scratch may be better

sour island
#

Like forcing tables to use address 0 in numerically listed tables

#

Turning into a weird hybrid

#

Between keyed and unkeyed

lone nest
#

yes... i can agree

#

i probably should and could have done better

#

but yeah, i wanted something in a semi-working state that could be fixed up (to the extent that i did).

#

i'm also waiting on build 42 to see how or if game resources management will be changed

#

(i also suspect aiteron's code was used in SS, given some of the function naming and the timeline, but I can't confirm it).

sour island
#

When Nolan returned he absorbed all the forks

#

So maybe he mistook Aiteron's idk

#

Last I saw Nolan he flipped his discord server over and left so

lone nest
#

took it too hard did he? well, shi* happens when you merge without testing.

sour island
#

Nah that was weeks ago

#

Everything was as buggy as usual

#

There was no context I could see, he asked who wanted admin and transferred ownership

#

Gave it to the first to respond

#

Who then spammed racist stuff and a hour later it was gone

lone nest
#

well, i wasn't too vested to begin with so, uh, no loss to me.

sour island
#

Me either, but I don't miss the days of several SS forks on the workshop

#

Especially the guy that made a new mod for every update

lone nest
#

no idea who that is

#

i'm probably gonna be hands off for the most part after this is uploaded to the workshop

#

if things work out, i'll write something from scratch using what I've learned to do (and not do).

sour island
#

Probably the best course tbh

#

Wish you luck

lone nest
#

haha, thanks, maybe once build 42 goes live.

weary knoll
lone nest
red tiger
#

It's clean.

lone nest
#

i've only done enough to make sure my game won't implode from nested loops and unending grid squares

red tiger
#

You clean as you cook.

frank elbow
#

Accepting minor code review?

lone nest
#

its public repo, go ahead.

#

dont wanna destroy the mod devlopement channel

red tiger
red tiger
#

Trust me.

#

You're fine.

frank elbow
# lone nest its public repo, go ahead.

I meant here informally 😄 Just one thing:

local function x(y)
  if not y then
    return
  end

  -- do stuff
end

rather than

local function x(y)
  if y then
    -- do stuff
  end
end

is a bit cleaner imo

bronze yoke
#

in this case i'd point out that square will literally never be nil anyway

#

if you're critiquing the function that was posted

frank elbow
#

Even better lol, I didn't even see the event bit

red tiger
lone nest
#

actually the original function was fed some questionable inputs from other functions... but I, uh, won't go into it.

#

@sour island warned me about the SS development and I'm aware of some of the issues

bronze yoke
red tiger
frank elbow
#

I'm guessing cows meant from other Lua functions

lone nest
#

hence I started looking for an exit strategy and yes, looking at a need to write a completely new system.

#

problem is i'm not 100% familiar with the Java APIs PZ has and what can be extended... so... yeah

#

that and build 42 promises to bring more performance optimizations and stuff

bronze yoke
#

onloadchunk my beloved

red tiger
#

So we just made this issue have a solution.

lone nest
#

i'm quite curious about how they'll handle the animals data

red tiger
#

@lone nest Do you use EmmyLua?

lone nest
#

no, uh, I think I was in your pipewrench discord using PZPW.

frank elbow
#

I'm (mostly) confident they'll do it with modders in mind, however it's done

lone nest
#

¯_(ツ)_/¯

red tiger
lone nest
#

the way i look at the modding is staying on the surface level, don't mess with the backend stuff by decompiling and recompiling it with weird flavors.

bronze yoke
#

you should definitely be decompiling

frank elbow
#

I think decompiling can provide a lot of great insights

#

Function names and javadoc can only get you so far

red tiger
#

=)

#

I should do a tut.

bronze yoke
#

guessing at what a java method does is needless

lone nest
#

let me highlight the 2nd part... decompiling is OK

bronze yoke
red tiger
#

I'm somewhat lost on what the issue is.

bronze yoke
#

i couldn't search for all usages of a method for example

lone nest
#

looks like i triggered something unexpectedly... now excuse me as I hide.

frank elbow
lone nest
red tiger
#

I guess that I can find my way around compiled bytecode after over a decade of working in it.

#

lol

#

I sometimes do a full fernflower CLI decompile.

frank elbow
#

I did that after a while too because of the same frustrations

red tiger
#

I have copies of jars I've built of PZ since build 30.

frank elbow
#

Changelog's got nothing on you

red tiger
#

=)

#

But yeah @lone nest if you don't want to use PipeWrench you can use Candle.

lone nest
#

i need a break first, maybe in a few days or weeks

drifting ore
#

Hey does anyone knows how to upload a mod to the workshop? im trying to upload a silly retexture a did for baseball bat but i just dont know how to even upload it

fading horizon
#

is there a way to block someone from leaving comments on your workshop item

#

i have a particular individual who likes to leave several paragraph long irrelevant comments on every single release I make and its getting annoying

fading horizon
#

oh its that easy? nice ty

lone nest
#

you should be able to click into their profile

#

on steam, and from the dropdown --> block user.

fading horizon
#

feels bad having to do it because they use my mods but dang its annoying

lone nest
#

if you were, well, hope that fella wasn't paying.

fading horizon
#

develop mod for commission

#

client leaves comment

#

block them

#

this is the way

#

💀

frank elbow
lone nest
#

agghh, this is causing insanity for me; I have question about sandbox options (again)

#

So I've managed to get the load and read the sandbox-options.txt values from the media folder

#

in-game at the sandbox options menu, I would modify the value of 1 of the options like so

#

then I would call a debug logger function in-game to verify the sandbox values to match the value set earlier in the sandbox options menu

#

the game still returns the default 50% chance

#

So I need help to understand why the sandbox values set at the in-game sandbox menu aren't being used.

ancient grail
#

to give honor, respect, recognition or whatever.. here are some flag textures i did that will be added to @fading horizon 's flag mod
in case you your flag to be removed let me know

thin hornet
#

you added pipewrench haha

quasi kernel
#

Woaaa funny flags!

ancient grail
young pewter
#

Are there any mods that let you actually take a bath and sit in the bath or take a shower and actually stand in it

bronze yoke
#

not really possible with pz's rendering

turbid gale
#

I'm having an odd issue with intercepting vanilla lua.

#
local ISRackFirearm_animEvent_old = ISRackFirearm.animEvent
function ISRackFirearm:animEvent(event, parameter)
    if event == 'changeWeaponSprite' then
        if parameter and parameter ~= '' then
            if parameter ~= 'original' then
                self.gun:setWeaponSprite(parameter)
            else
                self.gun:setWeaponSprite(self.gun:getOriginalWeaponSprite())
            end
        end
    else
        return ISRackFirearm_animEvent_old(event, parameter)
    end
end
#

when it tries to run the original, the parameters just don't make it correctly

thin hornet
#

because

ISRackFirearm:animEvent(event, parameter)

uses the : which mean that self is automatically passed.
but ISRackFirearm_animEvent_old is only a reference to the function so when calling it you have to manually pass the self as first param

turbid gale
#

oh that makes sense

#

thanks muchly

hardy wave
#

Trying to upload a modpack, but the "Mod Template" file is the only one that appears.

turbid gale
#

did you copy the mod template in mods or workshop?

hardy wave
#

Workshop

turbid gale
#

did you change the mod info inside the folder?

#

ModTemplate/Contents/ModTemplate

#

wait that shouldn't be necessary nvm

thin hornet
hardy wave
thin hornet
#

its not the correct path thats why

hardy wave
#

Where should it be

thin hornet
#

has to be the one in your user directory

#
C:\Users\Konijima\Zomboid\Workshop
hardy wave
#

Ohhh

#

Okay I got it, thank you so much!

turbid gale
#

yeah annoyingly zomboid has like 5 folders, where it'll load things from 3 of them (I think?)

thin hornet
turbid gale
#

pretty much

thin hornet
#

so technically there is two place, the user dir and the steam workshop one

turbid gale
#

it's confusing for people who are starting

thin hornet
#

mods vs workshop is just an optional thing, workshop dir has priority over the mods

#

i prefer making my mods directly inside the workshop dir. Instead of later copying over from mods to workshop

turbid gale
#

depends on the mod I'm making

#

if it's intended to go anywhere or if it's a meme/testing tool

dusty wigeon
#

how do i preform a health check? trying to create a mod that gives health until the player is at full health

ancient grail
#

Think itd getOverallHealth or. Something

turbid gale
#

yup

dusty wigeon
#

i dont see where anything says max health

thin hornet
#

Overall Health is from 0 to 100 if im not mistaking, otherwise it may be 0.0 to 1.0

getPlayer():getBodyDamage():getOverallBodyHealth()
ancient grail
#

Its 100

thin hornet
#

add or remove general health

getPlayer():getBodyDamage():AddGeneralHealth(1) -- add overall health
getPlayer():getBodyDamage():ReduceGeneralHealth(1) -- remove overall health
dusty wigeon
#

ill link what i have hold on. Im trying to make it give health everyTenMinutes until max health is hit

#
function InjectPropital(items, result, player)
    local char = player
    local bodyDamage = player:getBodyDamage()
    local AddHealth = 50.0f

    -- Flag variable to track if the player is at full health
    local isFullHealth = false

    -- Adds 50 health every ten minutes
    local function everyTenMinutes()
        if bodyDamage and not isFullHealth then
            bodyDamage:AddGeneralHealth(AddHealth)

         -- Check if player reached full health
            if bodyDamage:getCurrentValue() >= bodyDamage:getOverallBodyHealth() then
                isFullHealth = true
                print("You are at full health")
            end
        end
    end

    -- Subscribe to the everyTenMinutes event
    Events.EveryTenMinutes.Add(everyTenMinutes)
end
#

i been just messing around trying to figure things out

#

i know its crappy how i wrote it

thin hornet
#

@dusty wigeon ```lua
function InjectPropital(items, result, player)
local bodyDamage = player:getBodyDamage()

-- Adds 50 health every ten minutes
local function everyTenMinutes()
    if player and bodyDamage and bodyDamage:getOverallBodyHealth() < 100 then
        bodyDamage:AddGeneralHealth(50)

     -- Check if player reached full health
        if bodyDamage:getOverallBodyHealth() >= 100 then
            Events.EveryTenMinutes.Remove(everyTenMinutes) -- Unsubscribe from the everyTenMinutes event
            print("You are at full health, stopping effect of Propital")
        end
    end
end

-- Subscribe to the everyTenMinutes event
Events.EveryTenMinutes.Add(everyTenMinutes)

end

I guess you could try to unsub the event when it's completed, otherwise it will run for ever
primal remnant
#

Hey all, what's the require "" for using Events?

ancient grail
#

You use require for lua files
Not for events

#

Im pretty sure im not clear...

Hmmmm....

primal remnant
#

I see.

#

No you are

#

Do you know where I can find Events in the decompiled code files? I see Event, and an add/remove addition, but not Events (plural).

neon bronze
#

LuaEventManager has the list of all events used (and not used?) in the game

primal remnant
#

Thanks much

drifting ore
#

hello, can someone help me figure out why i get an error when trying to craft an item i managed to mod in (i don't really know how to mod, i just copy pasted stuff from some other mod and edited it xd)
here's the code, on left the item script, on right recipe

#

the item is working in game, i can spawn it in and wear it / put it on ground, it has the icon and everything, but in recipe window it doesn't have the icon, nor is the recipe showing any result, the revert recipe doesn't have any ingredients, and when i craft the bag it gives an error in right bottom corner, and it gives some wall of text error in debug console

winter bolt
primal remnant
#

Hey guys, we got some code working with Events.EverytTenMinutes(HealPlayerAlittlebit).
We wanted to add it to something that happens more regularly like EveryFiveMinutes, but that did not work.
I feel like I've seen, in passing, someone implement something like that.
I'm curious to know if they made their own event timer, or if there are other Every(Int)Minutes that I don't know about and where might I find them?

fast galleon
mystic ledge
#

Hey I have a really good mod a idea but idk how to make mods and o don’t know if it’s possible or already made but someone should make it so you can open garage doors without having to get out of the car

primal remnant
#

@mystic ledge A garage door opener mod? That's actually a pretty good idea.

mystic ledge
#

Yea I always hate having to get in and out of the car every time

eternal garnet
dusty wigeon
#

do u know if theres a way to create a single recipe that could result in several different items depending on the item it used
or would that be an oncreate thing

fading horizon
#

oncreate

dusty wigeon
#

ok

silk hollow
#

Hey everyone, I'm planning to go back to my mod (https://steamcommunity.com/sharedfiles/filedetails/?id=2888099799) and add some new features.
I've detailed what I'm looking for here: https://theindiestone.com/forums/index.php?/topic/66643-changing-zombies-sighthearing-dynamically/ but the forum seems a bit dead to be honest, at least for what I've used it in the past. Do anyone have any hint/help on what I'm looking for? Even a mod that does something similar would suffice so I can extrapolate "how to do it" from it. I learn faster with example rather than autogenerated documentation 😛

drifting ore
low solstice
#

Hey I'd like to know whether there is a possibility to have a mod be Serverside only.
I know that you can use "media/lua/server" but I was wondering whether it was possible to have that mod only on the server without distributing it to the client.

I assume when one doesn't check for mod integrity this might work but that's something I'd like to avoid.

winter bolt
#

remove the underscore from the recipe name

#

for some reason you cant use them for recipe names you can only use spaces

drifting ore
#

ok nvm i had a big B in SchoolBagRed there, now it's working xd

#

one more question then, i added 2nd texture to that same item, so now it randomly gives the red one or the new one, is it possible to make the recipe not random, lets say give red one with a strawberry and new one with a cherry?

neon bronze
#

Just declare a second recipe that makes the second bag

drifting ore
#

but i mean, it's the same bag, i only added 2nd texture, so now it randomly gives me one of 2 with that recipe i have

#

that's how it looks now

neon bronze
#

You could just make a second bag that has the second texture

drifting ore
#

yea, was just wondering if that's possible since the basic in game bag has few textures in 1 item

neon bronze
#

I think they are randomised but not for recipes

#

It would be better practice to make a second item that has the texture

drifting ore
#

ok guess i'll do just that, thank you! 🙂

#

@winter bolt Thank you very much for helping me fix the mod! 😄

neon bronze
#

You could additionally look into the xml of the base schoolbag ti see how they do it

drifting ore
#

basic bags aren't craftable tho, i'll just make a new one, it's all way too complicated for me as it is already lmao 😄

neon bronze
#

I mean for the texture swapping

drifting ore
#

i mean it randomly gives me one or the other bag so it's working

winter bolt
#

on the recipe you can add a function and in the function you can change the texture the item will use

#

lemme get mine one sec

#

inside the recipe add the line
OnCreate:Recipe.OnCreate.FUNCTIONNAME,but replace FUNCTIONNAME with whatever you want and then inside your mod create the folder path "media\lua\server" and make a .lua file that looks like this ```
function Recipe.OnCreate.FUNCTIONNAME(items, result, player)
local newVisual = result:getVisual()
newVisual:setTextureChoice(1)
end

#

i cant really test it but it should hopefully work

#

@drifting ore

#

you can replace the number in setTextureChoice() to be whichever number texture you need

#

actually if the item in the recipe is a bag then it might be better to just use my full function so it keeps all of the clothing and container stuff

quasi ermine
#

hey, using autotsar motorclub mod but for some reason cant ride any of the motorbikes, this is the error that shows up

drifting ore
#

i did this but it still randomly gives me one or the other textured bag

#

also how would i add the other ingredient to this recipe, so i could craft the 2nd one with a cherry? or i'd need a 2nd recipe for that?

drifting ore
#

i did this but it didn't work

#

it randomly picks the texture with each game restart for both recipes

bronze yoke
#

you wouldn't be able to change the texture of the recipe icon that way

#

that should change the item you actually get though

drifting ore
#

but it doesn't, i keep crafting one or the other textured bag randomly, i think the script needs to reference somehow to that .lua file doesn't it, like if i call that .lua file "blabla" shouldn't i put "blabla" somewhere in the script? does the .lua file need to be named exactly as the FUNCTIONNAME? is that the reference? can i put both functions in one file? idk how it works

bronze yoke
#

oh i see

#

Recipe.On**.**Create.PICKBAGTEXTURE2

#

in your script

#

you can put both in the same file, the filename doesn't matter

drifting ore
#

so how does the script know to read from that file?

bronze yoke
#

the game loads all lua files, it finds the functions by name

drifting ore
#

i see, well it doesn't work, any idea why

bronze yoke
#

the first one seems like it should work

#

the setTextureChoice calls might need to be zero indexed

drifting ore
#

meaning starting from 0? i fixed the typo and changed 1 to 0 and 2 to 1 but it's still random

bronze yoke
#

it might just be better to use two different items, seems like you have to do a lot of work to get around it this way

drifting ore
#

i mostly want to make it work to add way more textures without having to make a new mod for each of them

bronze yoke
#

now that i think of it i think i heard there were issues with trying to mess with an item's world model live - not sure if that applies to the clothing model too

neon bronze
#

You might need to call resetModel on the item or the player

drifting ore
#

where?

neon bronze
#

In the OnCreate

fast galleon
#

If the function isn't found there should be a log about it.

drifting ore
#

i haven't, i don't really know what i'm doing

#

oh lol i just checked and all the crafted bags are actually the red bags when i craft from red bag recipe, but they have random icons in inventory

#

same with the meru recipe, in inventory there are random icons but on back/ground it's always the meru bag

#

can i somehow add idk, setIconTexture to that .lua file or smh?

bronze yoke
#

setTexture i think

drifting ore
#

that's for the item texture tho isn't it, i already have that set up

bronze yoke
#

that should be the icon

red tiger
#

Good morning.

bronze yoke
#

items didn't have models until recently so the method names might not be structured around that

red tiger
#

PZ is way overdue for an internal cleanup and API-breaking upgrade.

#

I'm thinking about adding Python 3 support for modding PZ.

bronze yoke
#

my attitude is basically that mods are going to break with major revisions anyway

drifting ore
#

i mean look, that's the .lua file and it sets the backpack texture on characters back/on ground to red or meru textures, but the icons in inventory are random, so for example red bag has meru icon

red tiger
#
print('Hello, World!');
red tiger
# drifting ore

I've seen a lot of code here but I haven't seen camelCase mixed with all-caps function names before.

#

Little 3D code is straightforward.

bronze yoke
#

something like```lua
-- outside of the functions, probably at the start of the file:
local redTex = getTexture("path/to/your/texture.png")

-- add this part inside your function:
result:setTexture(redTex)

drifting ore
red tiger
#

I'm a professional programmer. This is my career.

#

Stick to camelCase or PascalCase. E.G:

function Recipe.OnCreate.PickBagTexture2(items, result, player)
-- ..
end

(Uses PascalCase)

#

Keeping things consistent does wonders for not only yourself but others who help you.

#

=)

bronze yoke
#

i'd recommend naming them something a bit clearer in general, e.g. Recipe.OnCreate.PickBagTextureRed Recipe.OnCreate.PickBagTextureMeru

red tiger
#

Noun-Verb pattern

#

or verbNounAdjective

#

getPlayerFirst or getFirstTexture

drifting ore
#

right, thanks

drifting ore
bronze yoke
#

yeah, grab all the textures outside of the functions and then set the texture in each respective function

drifting ore
#

haha no way, it's working 😄

#

now is it possible to set the correct texture for crafting window icon? xD

#

i guess not cause it's showing a random "New School Bag" item, or is it? 😄

bronze yoke
#

you'd probably have to hack the crafting ui for that one

drifting ore
#

allright i can live with that haha, thanks for help 😄

neon bronze
#

Thats why it would be easier to make 2 items and swap between them

drifting ore
#

yeah but i wanna add like lets say 10 different textures, and that way i can have it all in 1 file, idk if that makes any sense haha

rotund perch
#

where i can find the textures for weapons?

neon bronze
#

textures/weapons

rotund perch
neon bronze
#

they are arranged for what kinda weapons you need 1handed 2handed firearms etc

#

they are all pngs

rotund perch
#

i don't find it

neon bronze
#

its in the 1handed folder

rotund perch
#

thanks

pseudo jetty
#

anyone know a good way to save a table of inventoryitems?

neon bronze
#

where do you get those inventoryitems from?

#

alternatively you can save the names of the items as a string in a table and then put them in the playermoddata

marsh sparrow
#

does Events.OnPlayerUpdate.Add(ApplyStimEff) mean that on every instance where the player gets updated, the function ApplyStimEff runs ?

#

or that it runs once onplayerupdate and then never again ?

subtle sapphire
#

Hello developers! I was looking for a way to let the player to be visible on screen, but not visible by zombies. I found that the IsoMovingObject exposes a method setZombiesDontAttack(boolean), but the only effect is to not being attacked. Zombies will continue to follow the player. 🤔

pseudo jetty
#

I would save the item's ids or something, but I need references to the exact item instance when the game starts

#

I'm thinking about just saving the positions of all the items and checking that way

pseudo jetty
#

maybe that is in the lua source

bronze yoke
#

unfortunate that there's no getitembyid

bronze yoke
lone nest
#

the spiffo is aggressive in reactions.

pseudo jetty
subtle sapphire
bronze yoke
#

burryaga's meditation mod achieves this, maybe check how that works

pseudo jetty
frank elbow
bronze yoke
lone nest
#

the values are assigned before the debugger

bronze yoke
#

what event is this attached to?

lone nest
#

i assigned the debugger call to a key press

#

numpad 5 specifically, but it shouldn't matter, I think.

bronze yoke
#

to be sure, the values are read on the key press?

frank elbow
#

What about the definitions?

lone nest
frank elbow
#

That is, are the variable definitions tied to an event

bronze yoke
lone nest
frank elbow
#

Does that run only the function in the first image or does it also run the code in the second image

pseudo jetty
lone nest
#

the first image only

bronze yoke
lone nest
#

Oh! I think I get it

bronze yoke
#

you're reading the sandbox options before they're assigned, so it's just giving you the defaults

lone nest
#

order of execution matters.

#

ffffuuu

#

almost forgot Lua's problem

bronze yoke
#

OnInitGlobalModData is the earliest event after sandbox option load

#

though in many cases i would just avoid caching sandbox options

frank elbow
#

Poor Lua is always catching strays 😢 it is not at fault for this

#

Fortunately they're going to make sandbox options available sooner in the next build if I remember correctly

lone nest
#

Yeah there's a lot of build improvements from what I can understand... hence I became less keen on devoting more time to the current SS.

#

better to wait for the base game resource management improvements and build on top of that then continue beating a semi-dead frankenhorse.

bronze yoke
#

i mean, the next build will literally have (lobotomised) ai

#

i imagine that's when we'll see a multiplayer compatible npc mod

#

and it'll probably be much easier to develop something like that

lone nest
#

except npcs will have no mercy and no hesitancy if no safeguards are in place.

#

sorry, real life lessons are creeping in. <_<

lone nest
#

and you're right, I'm looking at some other mods that use sandbox-options; caching seems to be... never used*

bronze yoke
#

admins can change sandbox options live so caching them can be awkward

lone nest
#

Yeah that makes a lot of sense

#

i'm looking at binki tools for examples.

#

looks like I should go back and remove the cache references...

#

and reference the SandboxVars directly.

bronze yoke
#

you can cache the SuperbSurvivorsContinued table for shorthand

drifting ore
#

if anyone's interested i uploaded the mod i managed to make with help from people from this channel to steam workshop, Workshop ID is 2980535389. Once again, thanks to everyone that helped! 😄

bronze yoke
#

since tables are by reference

lone nest
frank elbow
#

That will still cache them unless you call it repeatedly (i.e., every time you need an option), but calling it repeatedly just to get one sandbox option would be unnecessary

bronze yoke
#

local SS_SandboxOptions = SandboxVars.SuperbSurvivorsContinued

#

no function needed

#

it just makes things a bit shorter when you're referencing sandbox options constantly

spark vector
#

Is there a way to mark your mod as being incompatible with other specific mods? Sort of like the opposite of a pre-req, so that if you try to enable both the game will actually prevent it?

mellow frigate
lone nest
#

OK, so I reworked the order of the code files for the sandbox options as such

#

... now to see if the values hold up after being set in the sandbox menu.

#

I see, I think I understand what is going on now

#

the Lua code is compiled running as soon as the game app finishes launching...
so the ss_options is already reading and setting the values for the mod.
I need to actually include events to handle initialization of all the functions and options.

bronze yoke
#

lua is never compiled, but yeah it first runs when starting the game (or any lua reload)

lone nest
#

Yeah, now I think I got an idea why the sandbox values isn't updating even after being set at the sandbox menu.

SS never bothered with the Events.<action> stuff so all the Lua is loaded at start.

Better designed mods have an initailizer() kind of function to ensure everything is loaded in a managed order.

dusty wigeon
#

I am trying to make a single recipe that takes multiple things and inserts them into an item but it gives a result item based on what items were used. How would i go about that

#


recipe Remove Vial from Auto Injector
    {
        AutoInjectorHemoA/AutoInjectorHemoB/AutoInjectorMorph/AutoInjectorProp/AutoInjectorZombX,

        Result: ,
        Time: 30.0,
        Category: Stims,
    }
#

this would be an insert and remove thing

bronze yoke
#

have an OnCreate function that checks the type of the ingredients and adds a result based on that

dusty wigeon
#

so would i remove the result section and change it to onCreate

#

or would i be able to make the recipe a little different

hoary widget
#

Clothing can be containers correct? Like cargo pants (I know bags are containors)

bronze yoke
#

you have to have a result or the recipe menu breaks

#

but you can set RemoveResultItem:true so that it doesn't actually spawn

dusty wigeon
#

ok so i would just put something as the result and then have it removed but how would i still get the item from on create wouldnt that break it

#

or is the oncreate result a different thing than the recipe one

#

?

#

Or am i just understanding completely wrong

bronze yoke
#

the oncreate result is the recipe result, but you can just add an item to the player's inventory in the oncreate

dusty wigeon
#

I completely forgot about that but i thought that what that created had to be in the Result slot. idk what im thinking

#

sorry im very bad with explaining my thought process

#

me and MrBuskett had fun with getting this one going last night ```lua
PropitalTicks = 0
function InjectPropital(items, result, player)
local char = player
local obh = player:getHealth()
local AddHealth = 25.0
-- creating the function to add health
local function everyOneMinuteah()
player:getBodyDamage():AddGeneralHealth(AddHealth)
-- starts the tick for propital
PropitalTicks = PropitalTicks + 1
-- checks if 5 ticks has passed, removes the event, and resets tick count to 0
if PropitalTicks >= 10 then
Events.EveryOneMinute.Remove(everyOneMinuteah)
PropitalTicks = 0
end
end
-- Adds the event to add 25 health every 10 minutes in game
Events.EveryOneMinute.Add(everyOneMinuteah)
PropitalTicks = 0
end

#

although forgot to update the comments lol

#

would i need to create a table of possible results as well as the table for what items are used?

bronze yoke
#

a lookup table that matches ingredients to results would be the best

lone nest
#

Is there a sequence list of what Events.<context> are fired before Events.OnGameStart fires?

bronze yoke
#

no, i've been meaning to write one - pretty much everything following the OnInitX or OnXInitialised pattern fires before that though

lone nest
#

aghh, yeah, I can confirm Events.OnCreatePlayer fires off before OnGameStart

hoary widget
#

Is there a mod that has pants that can hold items? Im trying to code some cargo pants

ancient grail
#

Im not sure if you can turn pants into inventory container

hoary widget
#

damn.

dusty wigeon
#

ok

#

ty

#

can probably remove obh too right

ancient grail
bronze yoke
#

in the middle?

dusty wigeon
#

everyOneMinute is a base game function

ancient grail
dusty wigeon
#

the base game has an everyTenMinutes and a everyOneMinute

ancient grail
#

Will that work? It added everyOneMinuiteah
Outside of the InjectPropital

So its not really adding anything

ancient grail
bronze yoke
#

that's inside

dusty wigeon
#

the everyoneminuteah is what i named the local function

bronze yoke
#

the indentation is a bit off but the scope is correct

dusty wigeon
#

@bronze yoke what indents are off im still learning

bronze yoke
#

the last two lines are indented one too many

lone nest
#

@bronze yoke , thanks again, turns out I still need a function so I can specifically tell SS mod to load the sandbox-options values during OnInitGlobalModData

bronze yoke
#

😇

lone nest
#

otherwise it'll continue to load as soon as app launches and never uses the user specified sandbox-options

ancient grail
#

right i had to view it on pc for me to understand cuz in mobile the tabbing is shit

dusty wigeon
#

this is how i should create the table right?

#
local KIStimCraftedItems = {
    ["CraftedMorphineVial"] = 1,
    ["CraftedHemostaticAVial"] = 2,
    ["CraftedHemostaticBVial"] = 3,
    ["CraftedPropitalVial"] = 4,
    ["CraftedZombXVial"] = 5,
}
bronze yoke
#

i would do it like ["CraftedMorphineVial"] = "ResultItem",

hoary widget
#

How do I determine what item spawns where? Id like to make ceartin items spawn only at military bases

fast galleon
dusty wigeon
#

albion im still not understanding how that would work

bronze yoke
#

so for example (probably not working code)

local KIStimCraftedItems = {
    ["CraftedMorphineVial"] = "TypeOfAnItem",
}

local resultItem = KIStimCraftedItems[item:getType()]
if resultItem then
    player:getInventory():AddItem(resultItem)
end
dusty wigeon
#

would this give me an option of which one to craft if i have multiple items in my pockets?

#

this is what i have

#
local KIStimCraftedItems = {
    ["CraftedMorphineVial"] = "AutoInjectorHemoA",
    ["CraftedHemostaticAVial"] = "AutoInjectorHemoB",
    ["CraftedHemostaticBVial"] = "AutoInjectorMorph",
    ["CraftedPropitalVial"] = "AutoInjectorProp",
    ["CraftedZombXVial"] = "AutoInjectorZombX",
}
local KIStimsFoundItems = {
    ["MorphineVial"] = "AutoInjectorHemoA",
    ["HemostaticAVial"] = "AutoInjectorHemoB",
    ["HemostaticBVial"] = "AutoInjectorMorph",
    ["PropitalVial"] = "AutoInjectorProp",
    ["ZombXVial"] = "AutoInjectorZombX",
}```
bronze yoke
#

i think you'd pick using the normal recipe ways (either selecting it in the recipe menu or by right clicking that specific item in your inventory)

dusty wigeon
#

am i at least on the right track

lone nest
#

Can someone please tell me what are all the integer/numbers in BodyPartIndex?

bronze yoke
#

yeah, though i don't think they're in order

#

i would just use the enum instead of integers

lone nest
#

got it, thanks

hoary widget
#

What are "subitems" in clothing.xml ?

mellow frigate
#

I'm new to clothing though..

lone nest
#

I have a suspicion that RestoreToFullHealth prevents zombification when called, but I'm unsure

hoary widget
mellow frigate
hoary widget
#
        <m_items> <!-- Jacket_samurai_black_01 --> 
            <probability>0.5</probability>
            <itemGUID>f533e4d7-05d0-4746-948e-bd0d518009b9</itemGUID>
            <subItems> <!-- Jacket_samurai_classic --> 
                <itemGUID>392e2cb5-42cf-4ad4-8a5e-c7f6bb5eafbd</itemGUID>
            <probability>0.1</probability>
            </subItems>
            <subItems><!-- Jacket_samurai_black_02 --> 
                <itemGUID>b146dde0-7b50-4134-8fdf-e84af320abf2</itemGUID>
            <probability>0.5</probability>
            </subItems>
            <subItems><!-- Jacket_samurai_black_03 --> 
                <itemGUID>d7441aed-fa06-438e-b471-4d9d52c58548</itemGUID>
            <probability>0.5</probability>
            </subItems>
            <subItems><!-- Jacket_samurai_brown_01 --> 
                <itemGUID>acce3420-52fc-4087-86f1-b621743773ee</itemGUID>
            <probability>0.5</probability>
            </subItems>
            <subItems><!-- Jacket_samurai_brown_02 --> 
                <itemGUID>dd3fa03a-d87c-413a-b090-1ea393cba9e3</itemGUID>
            <probability>0.5</probability>
            </subItems>
            <subItems><!-- Jacket_samurai_brown_03 --> 
                <itemGUID>0ec29db6-c261-4904-84e7-8cd863b270f5</itemGUID>
            <probability>0.5</probability>
            </subItems>
            <subItems><!-- Jacket_samurai_white_01 --> 
                <itemGUID>af9cced2-5b27-4e1b-abd7-e7a77320f24d</itemGUID>
            <probability>0.5</probability>
            </subItems>
            <subItems><!-- Jacket_samurai_white_02 --> 
                <itemGUID>985e6f77-bdae-4ae6-b3e6-e2de71aae0af</itemGUID>
            <probability>0.5</probability>
            </subItems>
            <subItems><!-- Jacket_samurai_white_03 --> 
                <itemGUID>bca25394-1b78-4c1a-8201-9563ade251ab</itemGUID>
            <probability>0.5</probability>
            </subItems>
        </m_items>
#

Is this right?

clever storm
#

is there a way that i could "delete" or skip this occupation and trait selection screen? so players on my server dont have any occupation and traits when creating a new character

#

like when they choose the region they want to spawn then it goes to selection of trait and occupation and then character appearence, name etc... can i skip this screen?

bronze yoke
ocean sphinx
#

u would need to make a mod that removes the professions i guess for 1

olive kindle
#

Having an issue with doors being able to open from anyone without a key. Wondering if anyone has seen this issue before.

quartz badge
#

is there a way to make a gun change the entire model of the weapon when an attachment is attached

shrewd violet
#

Hello guys)

#

What characters are allowed in the categories and their translation strings?

#

Item categories ofc

barren kraken
#

anyone know how to fix this?

#

cap is clipping into the center of my head

#

messing with the model in blender w scale/position doesn't help

dusty wigeon
#

theres a way to change position through the code idk how though

modest bison
#

Hello everyone, I want to start modding project zomboid, does anyone know where I should start?

shrewd violet
#

Should the pack export work at all?

#

last version of steam tilezed

#

Just silently exporting nothing

fast galleon
shrewd violet
#

All i found on forum is 2022 version

#

Without prefix and with right slashes its works))

#

Ah java coders...

visual island
#

Here is a kind of silly question: can i overwrite vanilla lua method defined in the ClassName.MethodName form?🤔

#

in a lua file with a name ≠ vanilla lua file name?

#

i just don't want to overwrite the whole file😢

neon bronze
#

Yes

visual island
# neon bronze Yes

so how? just writeClassName.MethodName = function(...? do i need to require anything?

neon bronze
#

Well normally you would save the old function somewhere like old_method = ClassName.Methodname,
But then yes you can just say ClassName.Methodname = function(….)

#

Also maybe require the file you want to overwrite the function from

visual island
neon bronze
#

Whats your code?

visual island
fiery hollow
fast galleon
long jewel
#

Gotcha, ty

sonic needle
#

Alrighty Someone smarter than me want to tell me why holding a gun, and running around randomly boots us out of the world

#

large pack of z's is the trigger

ancient grail
#

is it possible to
print this from lua

jolly ivy
fast galleon
ancient grail
#
clothingItem:getTextureChoices()

i will try this now thnkx

jolly ivy
#

Also first you need to get corresponding object clothingItem from somewhere

grizzled fable
#

can anyone help me? i'm using ItemZed but he seems not to find my mods folder, am i missing something?
only examplemod show ups
my mods are located here "C:\Users\saro8\Zomboid\Workshop"

ancient grail
#
local wornItem = getPlayer():getWornItems():get(0)
print(wornItem)
------------------------               ---------------------------

local wornItems = getPlayer():getWornItems()
for i=1,wornItems:size() do
    local item = wornItems:get(i-1):getItem()
    print(item:getClothingItemName())
end

this is how i got the clothing item

#

but when i added the
:getTextureChoices()

#

it errors

frank elbow
#

What's the error

frank elbow
ancient grail
frank elbow
#

Where did you add :getTextureChoices?

#

item should be an InventoryItem; you want a ClothingItem, so you'll likely need to use getClothingItem first

sour island
#

Is getTextureChoices attached to the item script and not the inventoryItem?

fast galleon
ancient grail
#
local wornItems = getPlayer():getWornItems()
for i=1,wornItems:size() do
    local item = wornItems:get(i-1):getItem()
    print(item:getClothingItemName())
    print(item:getVisual():getBaseTexture())
    print(item:getVisual():getTextureChoice())
end
#

found it

#

the 3rd print worked

#

ah shit nvm

#

just realized it returned interger instead of string

#

i needed the string name

sonic needle
fast galleon
sonic needle
#

no server, ill go hunt for them.

fast galleon
#

so it's co-op?

sonic needle
#

happens either on a server used p2p or alone, mainly single testing currently

ivory gyro
#
function TakeAdrenalin(items, player, item)
    local body = self.character:getBodyDamage();
    local health = body:getOverallBodyHealth();
    if health < 99 then
        body:AddGeneralHealth(math.min(health+14, 100)-health);
    end--if
end

can someone help me ? my code doesnt work...

jolly ivy
red tiger
#

Good morning.

wind jetty
#

Is there a way to retrieve the item ID of the weapon that is used to kill a zombie?

I found the event "Events.OnZombieDead" but it is only aware of the zombie killed, not by who the zombie is killed (right?)

twilit rune
#

Hello there!
While exploring local conversations, came to conclusion that creating extra body locations

'getOrCreateLocation'

Is a bit unstable and prone to bugs thing. So the questions is... how to create couple extra body locations and not to destroy humanity?

bronze yoke
dusty wigeon
#

so im trying to fix my mod but when im testing its doing something that no longer should be happening as i removed that part. Ive tried resetting the lua but that didnt work?

#

any idea how to get the changes to go through

bronze yoke
#

unsubscribe from the mod on the workshop

#

and then restart your game

dusty wigeon
#

im not subscribed to it on the workshop

#

doing some validating

#

that didnt work

#

i am so confused right now

#

think imma go to bed and try again later

mellow frigate
novel swallow
#

That has tripped me up so many times, I nuke every instance of my mod when devving, and output it with a debug/test workshop/modinfo id 😅

dusty wigeon
#

wheres the sub directory i only know of the first 2

mellow frigate
dusty wigeon
#

nvm i found the problem thanks guys

#

not having sleep is not good for modding

bronze yoke
#

what was the issue?

dusty wigeon
#

it was within my workshop file that i forgot about

#

from when i uploaded it. I had a saved copy i that i edited then put into the mods folder so it was trying to read from the workshop version

knotty zealot
#

Hello ! I'm developing a small mod, and I noticed the BodyDamage class has a FakeInfection variable. I can use it in singleplayer and seems to be working perfectly (so far), however when I host a server, the fake infection always defaults to a 14 hours duration, instead of the time i specify with InfectionGrowthRate.
So my questions are :

  • does anyone have extensive knowledge about FakeInfection, and how it works in mp ?
  • anybody knows of a Java class that updates infection other than BodyDamage (which i already dissected heavily) ?
  • or if none of the above, could someone direct me to a Java server class that manages player variables such as debuffs and wounds or, you guessed it, infection
    Thanks in advance, I'm sorry if this is a lot to ask
long jewel
#

Does anyone have a mod for door padlocks that works w Multiplayer? I know there is one on the workshop however it seems buggy and allows players to open doors at times when they don't have the key(s). Sorry if this is the wrong channel.

bright atlas
#

Does anyone know how the superb survivors quest system works?

#

Im thinking of making some rudimentary quests for a tiny endgame mod

lunar obsidian
#

Trying to write my first mod, I've encountered an issue and changed the code, but the game refuses to reload the file at all. I have tried disabling and reenabling the mod. I have also tried reopening the game, but the same lua error appears even though the code it is referencing is not even there anymore. Even if I change the file name, it still says that the error exists in the old filename that no longer exists.

lunar obsidian
#

I see, thanks

barren kraken
#

frenchie cap

red tiger
#

Good afternoon.

thin hornet
gilded hawk
#

is there a lighter version of the "OnTick" event? Like, something that is fired often, but not too often?

bronze yoke
#

everyoneminute i think is the closest

gilded hawk
#

What about on playerupdate?

bronze yoke
#

that's heavier than ontick

gilded hawk
#

Ah, wow, okay, thank you.

#

I have noticed that calling player:getWornItems():size() inside OnClothingUpdated can be very inconsistent and the :size() can be wrong compared to what's actually on the screen

#

So, I was thinking about using an alternative way to check for the real value using a different event

clever storm
bronze yoke
#

you should find the ui code responsible for moving onto that page and just make it move on past that instead

manic schooner
#

what determines how much "Wet" a towel can remove per use?
no idea where to look for that >.<

quartz badge
#

how would I remove a default item from the loot pool with an insert distributions .lua file

thin hornet
quartz badge
#

What do the variables stand for

thin hornet
manic schooner
#

think i figured the dryness thingy.
seem sit removes a set amount of wet per use.

the lower the use delta, the more times you can dry before having to wait for the towel to dry.
trying a 1.0 use delta would make the towel wet instantly and not dry me.

instead, changing it from .1 to .01 allowed me to dry off more of my character at max wetness.

manic schooner
thin hornet
#

That might be into a TimedAction if there is one for this otherwise it may be hardcoded in java.

manic schooner
#

gotcha, its ok. use delta will do jsut fine. thanks 🙂

#

its tricky, if you set it too low, you wont use the towel and it wont convert, leaving a half used towel in this case
set it too high, you need 3+ towels just to dry yourself

thin hornet
manic schooner
#

ooh ty, will look into that

thin hornet
#

they decrease character wetness this way:

self.character:getBodyDamage():decreaseBodyWetness( self.character:getBodyDamage():getWetness() / 20 );
#

so it never really dry fully, it seem to remove 20% of wetness everytime.

#

and they call that action this way:

local useLeft = math.ceil(item:getUsedDelta() * 10);
ISTimedActionQueue.add(ISDryMyself:new(playerObj, item, (useLeft * 20) + 20));

in ProjectZomboid\media\lua\client\ISUI\ISInventoryPaneContextMenu.lua line 2166

quartz badge
#

i went into the file you told me to look in and it looks completely alien

thin hornet
quartz badge
#

where

#

add it where in the file

thin hornet
#

yes

#

in your mod file

quartz badge
#

no like where and how do i add it

#

just as like table.insert?

thin hornet
#

no

quartz badge
#

So just add it onto a line

thin hornet
#

yes its a function

#

you just call it

quartz badge
#

well it didnt work

#

this is what i did

#

idk

thin hornet
#

you might have to do it into an event like the example in ProjectZomboid\media\lua\server\Items\SuburbsDistributions.lua

thorn bane
#

Hey all! Is there a way to alter the default commands on a server? Trying to do this but it comes up with a Attempted index: Add of non-table: null

-- Function to override the /all command
local function onServerCommand(module, command, player, args)
    if command == "all" then
        -- Check if the player has the access item
        if not hasAccessItem(player) then
            -- Player doesn't have access item, so block the command
            player:Say("You don't have permission to use this command.")
            return false -- Return false to prevent the command from executing
        end
    end

    -- Return true to allow the original command to execute
    return true
end

-- Hook into the OnServerCommand event to override commands
Events.OnServerCommand.Add(onServerCommand)
thin hornet
#

@quartz badge

local function postDistributionMerge()
    RemoveItemFromDistribution(SuburbsDistributions, "MyMod.Item1", nil, true)
end
Events.OnPostDistributionMerge.Add(postDistributionMerge)
#

this event will make sure that you remove it from the distribution after it is merged.

quartz badge
#

still does not work

#

Should i put base. before 308clip

#

Thats probably my bad

#

Welp, it wasnt, still doesnt work

thin hornet
#

only if it was added into the distribution with the base.

#

base stuff is never added with base.

quartz badge
#

Either way it didnt work

thin hornet
#

What do you mean it didn't work?

quartz badge
#

The item is still in the loot pool

#

I am trying to remove it

thin hornet
#

what is it spawning into?

quartz badge
#

The default places it spawns

#

Its a vanilla item I am trying to remove

thin hornet
#

you may have to remove it from the procedural distribution too.

quartz badge
#

how would I do that

thin hornet
#

call the same function with ProceduralDistributions

RemoveItemFromDistribution(ProceduralDistributions, "MyMod.Item1", nil, true)
quartz badge
#

so do i make a procedural distributions file too?

thin hornet
#

no need

quartz badge
#

oh i see

thin hornet
#
local function postDistributionMerge()
    RemoveItemFromDistribution(SuburbsDistributions, "MyMod.Item1", nil, true)
    RemoveItemFromDistribution(ProceduralDistributions, "MyMod.Item1", nil, true)
end
Events.OnPostDistributionMerge.Add(postDistributionMerge)
quartz badge
#

thanks, it worked

thin hornet
manic schooner
ancient grail
fiery hollow
heady crystal
#

Does anyone know how to make the Player nauseous?

#

I was messing around in debug mode and you cannot modify the sickness status nor did I find anything in code from a quick glance. Modifying fakeSickness works but also can't find it in code and it doesn't seem to reduce on its own, like it does when you are near dead bodies.

fast galleon
heady crystal
#

Yes but you cannot interact with it

#

And there's no reference in code it seems

#

It's ok though, I found what I wanted

thorn bane
#

Just finished one of my mods, but I noticed that for it to work well, I'd need to disable players from seeing /all. Is there any way to do that?

mellow frigate
heady crystal
#

Just set the player's foodSickness value. Not what I wanted, but it works.

mellow frigate
#

Any idea where I can find the PZ format of .pack files ?

fast galleon
mellow frigate
fading horizon
#

is there a console command to set the time of day

#

i'm trying to take a screenshot and having to FF through the night

#

lol

thorn bane
#
    if player:isAdmin() then 
        print("Player is an Admin. Skip radio check.")
        accessStatus = 0
    end

Is this not how you detect if a user is an admin?

fast galleon
drifting ore
#

Is this a bug or something in the workshop ?
I genuinely cant believe that of 44 visitors 39 of those suscribed,seems weird to me

fast galleon
mellow frigate
sour island
mellow frigate
#

At least I should beat you with the worst like/unlike ratio 😄

sour island
#

Oh?

#

I never got review bombed yet

mellow frigate
#

got 31% dislike. I'm not even sure it is a review-bomb.

sour island
#

Damn, that's the highest I've heard of

#

What mod is it?

mellow frigate
#

Now that I think of it the gay-friendly mods are probably worse.

#

Engine Keeper

sour island
#

Oh I forgot people are unhinged enough to be homophobic

#

Why did you remind me

mellow frigate
#

sorry

sour island
#

Was a joke lol

fading horizon
#

new update coming for my backpack flags mod

#

now you can wear two flags

#

added 30+ new flag textures

#

no more clogging up the crafting menu, now you change your flag texture on the fly with a context menu

#

huge thanks to @ancient grail for his hard work and help coding this.

thorn bane
#

Already fixed the issue with admins not being to use global chat

ancient grail
#

How long did it take to make radio related mods

thorn bane
#

The idea's been in my head for literally months

#

But it took me 4 hours of debugging to make it work well

#

Super proud of the radio-by-radio basis

#

Next I have to work on making desk radios work

#

And a real dream would be having the /all chat not display at all without a radio

ancient grail
fiery hollow
#

does anyone know how to create new challagnes?

#

I took CDDA, changed starting items and spawn location and its giving me an error

#
ERROR: General     , 1685191655026> ExceptionLogger.logException> Exception thrown java.lang.IllegalStateException: Failed to find any .lotheader files at IsoMetaGrid.CreateStep1 line:1459.
ERROR: General     , 1685191655027> DebugLogStream.printException> Stack trace:
java.lang.IllegalStateException: Failed to find any .lotheader files
    at zombie.iso.IsoMetaGrid.CreateStep1(IsoMetaGrid.java:1459)
    at zombie.iso.IsoWorld.init(IsoWorld.java:2305)
    at zombie.gameStates.GameLoadingState$1.runInner(GameLoadingState.java:268)
    at zombie.gameStates.GameLoadingState$1.run(GameLoadingState.java:225)
    at java.base/java.lang.Thread.run(Unknown Source)
ancient grail
fiery hollow
#

huh

thorn bane
fiery hollow
#

yeah

ancient grail
#

Ayt
Was just informing . Cuz some people dont know about the modding policy

fast galleon
ancient grail
#

Like side to side both the original and the modified one so we see whats the problem

fiery hollow
ancient grail
fiery hollow
fast galleon
#

The error is map related so I guess it's problem with location.

fiery hollow
#

Yeah I took the tiles and x, y from the map website

fast galleon
#

You should not do that?

fiery hollow
#

why not

fast galleon
#

Sorry I'm on mobile.

fiery hollow
#

{xcell = 42, ycell = 13, x = 117, y = 67, z = 0}

#

this should point nearby Louisville

fast galleon
fiery hollow
#

yeah its all from CDDA except I changed the numbers

fast galleon
#

I think Louisville is accessible, but can you try from CDDA to see if it really is?

#

Because Muldraugh Map might not include it.

fiery hollow
#

there's one confusign thing tho, in CDDA there's this code:
which looks like location is specified once, then there's a list of location to choose randomly from

#

I'll try to put some location from here and see if it works

sour island
#

There was probably only 1 spawn originally, or they just needed a default

sour island
#

My guess is some big server(s) got their hands on it

ancient grail
fast galleon
fading horizon
#

I previously had a separate item for each backpack flag in my mod. Now theres a dummy item that changes based on a context menu.

Is it safe to delete the code for all the old flags or will that mess up peoples game saves that have previous flags?

#

such as the item definitions and stuff

fiery hollow
#

Well, the game launched, so the coordinates were really the problem

#

but also

#

none of the items from the code were added lol

#

or traits

#

amazin

sour island
fading horizon
#

ill leave it in then

sour island
#

You can write a soft remove patch

fading horizon
#

theres no way to get them besides spawning in anyway

sour island
#

oh

#

You can make their display names blank if they're not used at all

#

and flag them as obsolete

fading horizon
#

we got zombie outfits now though

#

and oo

#

that's a great idea

#

ill do that

sour island
#

and additionally run through player's inventories onplayercreate

#

replace it with the new dummy item

ancient grail
#
    CDDA.x = CDDA.spawns[rand].x;
    CDDA.y = CDDA.spawns[rand].y;
    CDDA.z = CDDA.spawns[rand].z;
    print ("Set to :" .. CDDA```
#

Maybe its this @fiery hollow
I could find the obvious problem
But maybe its this cuz i dont see rand being declared anywhere

fiery hollow
#

well, setting the default CDDA coordinates launches the game but

#

when I launch it, right as I start it I see the ERROR 1 messages at the bottom right for a second

#

I have nothing in my inventory

#

so the adding items to inventory code isn't working for some reason

ancient grail
#

Damn. Im too sleepy for this
If you havent solve this by tomorrow ill try and look at it again. Cuz im currenly usingmobile

fiery hollow
#

you want me to try CDDA locations?

fast galleon
#

Start challenge, try to go to LV.

fiery hollow
#

yeah, thats gonna take some time to do lol

fast galleon
#

wait wrong coords

fiery hollow
#

I wanted to do this basically

#

I thought cell was for xcell and rel was for other x and y

fast galleon
#

you can teleport there after you start the challenge 🤔 maybe it's something else.

thorn bane
#

Is there a way to add a dropdown as a sandbox variable?

frank elbow
thorn bane
frank elbow
thorn bane
#

Ah, i saw that but thought nothing of it

#

Whoopsie

frank elbow
#

Under the assumption that if it has the metatable it is likely a real object

#

I only mention this because you'll need some methods that the vanilla Lua doesn't use to check the chat type. Since the vanilla Lua doesn't use them, modders often don't bother including those methods in their fake objects

thorn bane
#

Gotcha, like I said, I'll investigate further tomorrow

#

It's 12:10 AM atm 😔

heady crystal
#

If anybody here is an artist or at least is relatively decent at making textures / sprites and would like to do a quick Collab, let me know 💖

thorn bane
#

also, does anyone know how I can change the processGeneralMessage function? it currently does [Account]: Message when I'd rather it be [Character Name]: Message

frank elbow
thorn bane
#

thank you omar

#

truly a blessing

frank elbow
#
local _ChatMessage = __classmetatables[ChatMessage.class].__index

---Override to modify chat format.
---Decorates the original getTextWithPrefix.
---@return string
function _ChatMessage:getTextWithPrefix()
  -- `self` will be the ChatMessage; see the javadoc for available methods
  -- process the message and return the entire string that you want to display in chat
  -- note that lines are separated by <LINE>, not the newline character
end

No problem. Excerpt is an example of how I did so

thorn bane
frank elbow
#

The skeleton of that will be what you need; let me edit it to exclude more irrelevant details

thorn bane
#

I see, this is def a huge help

#

im probably gonna try to get some shuteye, ill read back on this convo tomorrow :)

fading horizon
#

Does anyone know the difference between setWorldTexture() and setTexture()

ancient grail
#

hello bruh yeah i can provide you with the graphics you need. but ive sent you dm before cuz i wanted to show you a link with your mods packed and you didnt return fr so i cant dm you drunk

knotty zealot
#

hello, when using getModData(), do I need to separate mod data and local variable in such fashion :

local function LoadPlayerData()
    player = getPlayer()
    playerModData = player:getModData()
    playerModData.ICdata = playerModData.ICdata or {}
    playerModData.ICdata.shouldHeal = playerModData.ICdata.shouldHeal or false
    dataTable.shouldHeal = playerModData.ICdata.shouldHeal
end

local function SavePlayerData()
    playerModData.ICdata.shouldHeal = dataTable.shouldHeal
end

Events.OnGameStart.Add(LoadPlayerData)
Events.OnPostSave.Add(SavePlayerData)
#

or can i just use mod data directly and it won't change impact on performance ?

frank elbow
frank elbow
knotty zealot
#

they are declared earlier

#

as local (sorry i forgot to include this in the code)

#

thanks for your answer i'll try to do it this way

sour island
#

hello, test

#

what a friendly bot interaction

mellow frigate
knotty zealot
#

ok, i'll try to remember that

#

thanks

fading horizon
#

I just pushed a big update to my backpack flags mod if anyone wants to check it out.

• You can now wear the flags on either side
• Wear two flags at the same time
• 30+ New flags added for servers & tributes
• Flags now spawn on zombies

tight lotus
#

I wanted to ask here since I know it would be a really big challenge but the idea has peaked my interest. How possible would you guys think it'd be to make a VR mod for PZ? I know there's a lot of challenges already like trying to figure out how to render the game from third person to first person or adding functionality to the controllers but it'd be doable right?

bronze yoke
#

it wouldn't be doable, you'd be developing an entire game

#

there's really not much about pz that works as a foundation for vr

mellow frigate
#

Hello there, sorry to bother with that noob question but what is the way you'd advise to check the type of a variable in lua ? equivalent of myVar instanceof IsoDoor I remember there are two ways but I never can remember the writting and I also would like to know what is the right way to do it.

tiny token
#

Hello! I'm trying to make the player smoke from a context menu in the game world. The action is not being executed. Does anyone know why?

function EntradaWorldContextMenu(player, context, worldObjects)
  -- code
  context:addOption(getText("Prender Pucho"), worldobjects, FuncionWoldContextMenu, player);
  -- more code
end

Events.OnFillWorldObjectContextMenu.Add(EntradaWorldContextMenu)





function FuncionWoldContextMenu(worldobjects, player)
    
    local playerObj = getSpecificPlayer(player);
    local playerInv = playerObj:getInventory();
    
    local items = ISInventoryPane.getActualItems(items)
    for _, item in ipairs(items) do

        if item:getFullType() == 'Base.Cigarettes' then
            ISTimedActionQueue.add(ISEatFoodAction:new(playerObj, item, 1))
        end
    end

end

mellow frigate
#

instanceof(myVar,'IsoDoor') is one of the two ways

lone nest
#

i might be wrong, lua is still new to me, but I thought there was a global type() function

bronze yoke
#

type(foo) == "table"

mellow frigate
mellow frigate
lone nest
#

memewhile i'm pondering which modding tool to try.

#

might also help if there's a boiler plate for PZ Lua modding.

thin hornet
bronze yoke
#

umbrella should help with lua modding

thin hornet
#

pzstudio uses umbrella, it is also a boilerplate

#

you create your project anywhere on your pc, and running build & watch it will copy and make the structure automatically into your workshop dir.

#

great for a mod git repo where you can install anywhere

lone nest
#

Reports Mileage in the metric system (KM) with MPH speedometer.

bronze yoke
#

zomboid does actually work in km

#

i think it's so the speeds look less weird

thin hornet
#

the mod uses km codewise, but convert the value to miles visually only

#

it consider 1 tile = 1 meter but it's arguably inacurate

lone nest
#

oh don't get me wrong, if I'm going to measure something in software, I think metric is better.
But my every day is somehow supposed to measure in gallons, ounces, pounds... with mile, yard, feet/foot, and inches before reaching the centimeter.

#

nevermind the units of scoop, tablespoon, teaspoon, and pinch.

#

sigh add until saltiness and/or sweetness can be detected.

gilded hawk
#

Try Moving FuncionWoldContextMenu above EntradaWorldContextMenu

fading horizon
#

<m_HatCategory>nohair</m_HatCategory>

is there a hat category to only hide the top of the head?

#

so for example this item is a helmet

#

i don't want mohawks to show through the top, but i want long hair to come out of the bottom

#

is that possible?

mellow frigate
fading horizon
#

thank you

#

ill look around

bronze sand
#

Check them out

#

It's great content btw

#

And a very cool idea for a mod in general

#

Anyway

#

Where could I request/suggest a Mod idea?

#

I would like to be able to craft different types of Curtain Walls, like the curtains in Hospitals, but more homemade and varied
Actually this could come with a blanket expansion for beds, as well as new towels

#

Like the Classic Tiger Blanket

#

Maybe maemento mori could consider that idea for the future

fading horizon
#

Perhaps

#

But idk how to do tiles so it will be a while before I can do anything like that

#

Thank you for your suggestions, I'll definitely implement some of them

barren kraken
#

anyone got any thoughts on these slides for my mod? tossing around ideas for 'em

fading horizon
#

I would add a box / blur around the text personally. The text kinda gets lost in the background

#

Or alternatively blur the background

#

Other than that they look great, good job

fading horizon
#

eh

#

that looks kinda messy

#

i meant more something like this

#

how it is on the left

#

heres the psd if you like it

barren kraken
#

ah alr

#

i'll implement it onto em tomorrow once i got it down, thanks!

bronze sand
#

I've been wanting more Punk stuff to be in the game, but so far I've only seen Gothic content

#

There are Mohawks but the hair gets covered quickly

#

So, I thought, how about a Punk Helmets mod?

fading horizon
#

I'm actually working on a goth helmets mod rn

#

just need more ideas for it

#

plus ive been busy working on some commissions

bronze sand
#

Starting from different Mohawk Wigs that can be weared over anything, passing through Punk Hats, ending in actual weird Helmets with protection, spikes and all that

bronze sand
#

Ok, maybe not those ones

fading horizon
#

idk i'm mainly going for cute stuff honestly haha

#

i made the whole goth backpacks mod bc i have the backpack and fanny pack irl

#

and i just wanted them in game

#

lol

#

same with the goth hats mod

#

tired of using another mod for their hat so i made my own

#

and i figured i may as well make a mod out of it

bronze sand
#

But consider the wigs idea, and having Nails, Knive tips and Scrap Metal crests

#

This is cute to me

#

I actually dig having this thing in game not gonna lie

#

Wigs could go a long way

bronze sand
#

I have always liked the style they give you

#

Besides some helmets with horns, horns that can be weared with anything would be great

fading horizon
#

I was planning on adding like

#

succubus horns

#

and demon horns

tropic hedge
#

Hello everyone,
I want to retrieve the public server-side method getTotalKills(username, value) from this mod:
https://steamcommunity.com/sharedfiles/filedetails/?id=2857273296 located in the file media/server/Server.lua .

-- get/set TotalKills public functions
function getTotalKills(username, value)
    return ladder.zKillsTot[username]
end

In my client-side mod: media/client

require("Server") 
local character = getPlayer()
local userName = character:getUsername()
print(getTotalKills(userName, nil))

But the response is always nil.

Where am i wrong?
Thank you

tame mulch
#

If you want to use it, need call it in server lua file

tropic hedge
# tame mulch I checked this mod. This function not used.

The getTotalKills(username, value) method would be helpful for me to perform calculations in my mod.
I need to retrieve the values form the ladder table,

I don't understand how to invoke/call it from the server file.

client side

Thank you

tame mulch
#

by sendServerCommand

tropic hedge
gilded hawk
gilded hawk
#

Does anyone know how can I make this code work with the Java's array list?

local function forEach(array, callback)
  for index, value in ipairs(array) do
    callback(value, index, array)
  end
end

-- Example usage
local myTable = {1, 2, 3, 4, 5}

forEach(myTable, function(value, index, array)
  print("Index:", index, "Value:", value, "Array:", array)
end)
pearl citrus
#

Working on a UI mod, currently deciding whether to support controllers. I don't use a controller, no one I know uses a controller, and the systems for it don't seem particularly nice to implement. Anyone personally use controllers, or have made a similar mod and had controller support be asked for much?

frank elbow
gilded hawk
# frank elbow Use a numeric for loop from 0 to :size() - 1, then call :get with the loop count...

I like to use forEach because I come from JS and it allows me to tidy up my code, eg:

current code:

TransmogDE.patchAllItemsFromModData = function(modData)
  for originalItemName, tmogItemName in pairs(modData.itemToTransmogMap) do
    local originalScriptItem = ScriptManager.instance:getItem(originalItemName)
    local tmogScriptItem = ScriptManager.instance:getItem(tmogItemName)
    if originalScriptItem ~= nil and tmogScriptItem ~= nil then
      local originalClothingItemAsset = originalScriptItem:getClothingItemAsset()

      if originalClothingItemAsset then
        local tmogClothingItemAsset = tmogScriptItem:getClothingItemAsset()
        tmogScriptItem:setClothingItemAsset(originalClothingItemAsset)

        if originalClothingItemAsset:isHat() or originalClothingItemAsset:isMask() then
          -- Hide hats to avoid having the hair being compressed if wearning an helmet or something similiar
          originalScriptItem:setClothingItemAsset(tmogClothingItemAsset)
        end
      end
    end
  end
  -- Must be triggered after items are patched
  TransmogDE.triggerUpdate()
end

Current code, using foreach

forEach(myTable, function(originalItemName, tmogItemName, table)
  local originalScriptItem = ScriptManager.instance:getItem(originalItemName)
  local tmogScriptItem = ScriptManager.instance:getItem(tmogItemName)
  if originalScriptItem ~= nil and tmogScriptItem ~= nil then
    return
  end

  local originalClothingItemAsset = originalScriptItem:getClothingItemAsset()
  if originalClothingItemAsset then
    return
  end

  local tmogClothingItemAsset = tmogScriptItem:getClothingItemAsset()
  tmogScriptItem:setClothingItemAsset(originalClothingItemAsset)
  if originalClothingItemAsset:isHat() or originalClothingItemAsset:isMask() then
    return
  end
  -- Hide hats to avoid having the hair being compressed if wearning an helmet or something similiar
  originalScriptItem:setClothingItemAsset(tmogClothingItemAsset)
end)
frank elbow
#

I understand its use in general, that just doesn't really look cleaner to me 😄 I find map far more useful—imo if it's gonna be slower, it could at least have a good purpose. To each their own though

gilded hawk
#

Do we have map in zomboid?

frank elbow
#

I'm assuming you want it to work with both tables and ArrayLists from context—you can use instanceof & type to check for that (really one or the other, depending on whether you check for table or ArrayList)

#

Nah, I meant a map function I write

gilded hawk
gilded hawk
frank elbow
#

Disregard that last bit, in that case

hoary palm
#

Hi everyone, someone has a animation tutorial for a mod creating using blender?
How can I start?

fiery hollow
#

does anyone know where are challangemaps are located

#

I thought challanges where just spawnpoints in main maps certain locations but apparently not

muted cliff
#

Hey! I'm working for a little mod for myself - what is the file that plays when radio / TV is on?

#

name of the file, imean.

fiery hollow
#

you mean sound?

#

or text

muted cliff
#

sound

#

the interview one, or is that only for TV's and I'm miss remembering?

#

yeah, sorry, it's only for the TV's

red tiger
#

Good morning.

gilded hawk
#

How can I remove a train from the trait selection? I'm setting up a server for my newbie friends and I want to disable things like sunday driver, asthmatic etc etc

fiery hollow
#

there's a mod balled remove burglar

#

you can probably can just change it

#

to remove other ones

#

oh wait thats a profession

tame mulch
red tiger
#

I also have some goodies that you should know about.

tame mulch
red tiger
tame mulch
red tiger
#

There are two new projects since you've been away. The first one is called "Candle", which is a formal rewrite of the core code that is used to render PipeWrench. Instead of Typescript, it's EmmyLua typings.

The second project is called "Umbrella", which is a collaborative project by @bronze yoke ,@frank elbow , and myself. This is Candle packaged with albion's events typings project, and Omar's special typings for Lua utilities.

#

This is the most comprehensive take on Lua typings to date. There's no need to decompile the game in order to use these typings.

#

I basically wanted to kill off Capsid.

thin hornet
red tiger
#

As for the ZedScript extension for VSCode, I've temporarly shelved it after working on the linter for the format.

#

That's basically it for me while you were gone.

tame mulch
#

Interesting. This projects very cool! I will check them soon

red tiger
thin hornet
#

@red tiger thinking of adding a plugin system to the build of pzstudio, where we can run script to analyze/alter the output of lua script.

little forge
#

do u guys think it's possible as a mod in game?

#

the shadows 😳

red tiger
#

Shadows would be false projections of 3D lighting.

#

It'd need to take into account several things that the tiles don't have data for something like that.

#

You could do basic window & solid walls as projections but then the world would need to define where the light source(s) are.

#

This would be something deep enough for the devs to need to develop this if they wanted it.

little forge
muted cliff
#

What would be a good place to post a mod trailer?

thin hornet
white pivot
#

hey everyone, i'm struggling a bit to call a millis timer starting from zero wich is supposed to feed a sinusoidal. right now it (somehow) do something. But i could use some help to get it right :

#
if drunklevel > 0 then 
                local secz = getGameTime():getCalender():getTimeInMillis()
                local drunknesstime = 3e3*gametimemul
                local oscillationamplitude =  0.8+(drunklevel*0.25)
                local oscillationoffset = 0
                local drunkennessAdjustment = oscillationamplitude * math.sin(2 * math.pi * (drunknesstime * secz)) + oscillationoffset -->> y = A * sin(2πf(x - h)) + k
                Advanced_trajectory.aimnum = math.min(math.max(Advanced_trajectory.aimnum + drunkennessAdjustment, aimin), aimax)
                print ("secz ==== ", secz)
                print ("Drunkess Adjustement ==== ", drunkennessAdjustment)
            else
                local drunknessAdjustment = nil
                local secz = nil
            end --Drunkness ```
pearl citrus
#

If you put ``` at the start and end of your message, it'll enable code formatting.

#

makes it a lil easier to read and stops discord parsing * as italics

#

They're backticks, not " or '. Above tab, for me.

white pivot
#

gametimemul is getTime():getMultiplier()

frank elbow
#

Bonus tip: ```lua at the top set for syntax highlighting

white pivot
#

cheers CrunchyDuck

#

spiffo ❤️

frank elbow
#

Can you clarify what the problem is? It doesn't do what you're expecting, I think—but what's the expected vs. actual behavior?

white pivot
#

the timer is a gametimecount, probably timing from gamestart, can't find a way to make it start from zero. Plus it's quite slow for gametimemilliseconds. Is it rads ?

tawdry solar
#

i dont FUCKING get it its been weeks and noone can figure out why my items dont apear ingame while my others work

#

my code is fine istf

pearl citrus
fast galleon
#

generally the game uses the worldAgeHours to keep track of time since game start. Nights survived + time of day.

pearl citrus
#

lua's a nightmare to debug in because it won't tell you when certain things don't exist

white pivot
#

(noobish question) can you confirm there is no getCore():getTime() class in PZ library ?

frank elbow
frank elbow
# tawdry solar what

I'm fairly certain we talked about this before and that was what the end of it was, unless I'm thinking of someone else

tawdry solar
#

we have

#

twice

#

but i just forgot

#

and it was 2 of my items

frank elbow
tawdry solar
#

i still dont understand

frank elbow
#
item X {
  Key = Value,
  Key2 = Value,
  Key3 = Value,
}