#mod_development

1 messages ยท Page 518 of 1

undone crag
#

Someone just deleted a message above.

cold burrow
mint sphinx
bitter frigate
#

OKAY i have notepad++ open and an LUA plugin but it isn't all pretty and color coded like i've seen other's be

cold burrow
#

No idea how to create a new PR with folder. Can i just drop translated words here? :D

undone crag
#

Maybe click the language bar -> L -> Lua?

bitter frigate
undone crag
#

|:

weary matrix
#

@cold burrow of course, just DM or on the workshop

mint sphinx
#

@undone crag and @bitter frigate are you guys working together?

bitter frigate
#

he's helping me quite a lot so in a way yes! he's on the list of people i'm going to thank whenever i get the mod in a presentable state

undone crag
#

I was just sending messages here to help him...

#

D:

#

You don't know my steam account SO HA

#

It will just be a mysterious internet anon.

bitter frigate
#

it's true u will!

undone crag
#

(plz mention me not ._.)

bitter frigate
mint sphinx
#

anger do credits like
"credit by me and only me "

just kidding ^^

#

how does it go along with the mod ?

bitter frigate
bitter frigate
mint sphinx
#

^^ yea i had like 3 lines of code of Fenris_Wolf maybe 4 which was like the lines of code i tried to find for like 1ยฝ day with no breaks out of my +100 lines of code to make my mod to work. and i had to ask few times here before he saw it and said he found it in few versions ago and i dont think he ever really used it completely

mint sphinx
uncut ocean
#

can someone please tell me if it'd be possible to create a QoL mod that autofills your last character build into the dropdown slot upon getting to the character select menu

#

so all you have to do is click start if you want to use the same character as last run?

#

pleeaaasee. i just need to know its possible then i can start on my journey of learning to mod

tribal marsh
#

VSCode is great

uncut ocean
#

or does this mod already exist?

#

@tribal marsh do you know the answer

drifting ore
#

Isnt that a feature already in the game lol

drowsy seal
#

Isn't that the "Save template" button you're describing

drifting ore
#

^

tribal marsh
#

That doesnt "Autofill"

mint sphinx
tribal marsh
#

just allows you to select a build you saved

uncut ocean
#

yea but everytime you goto the character selet screen you have to click the menu to select your preferred character again...

drifting ore
#

You legit just click the dropdown and select the build

mint sphinx
#

dont know if he ever finished it

uncut ocean
#

i want it to be autofilled

drifting ore
#

It takes like 1 second

uncut ocean
#

kaiser don't be dumb...thats the definition of QoL. to save seconds over many instances

tribal marsh
#

"One second is all you need for improvement"

drowsy seal
#

damn he came in hot

mint sphinx
#

i will say most of the time i just want to respawn with the same layout ^^

drifting ore
#

If you're too lazy to click 1 button then how do you have the patience to play PZ

cold burrow
uncut ocean
#

kaiser don't even try to debate this stupid point...

drifting ore
#

Idk I just don't even see the purpose of a mod like that

uncut ocean
#

so pointless

#

then you don't program i guess

mint sphinx
#

kaiser it one time with the perks 1 time with map 1 time with the charector ๐Ÿ˜› so atleast 3 sec ^^

uncut ocean
#

programmers optimize seconds ALL the time

#

do you code @drifting ore

drowsy seal
#

he's trying to help and you call him dumb

#

how dare you try to help!!!

drifting ore
#

I wrote a transaction handler in COBOL

uncut ocean
#

how is he helping @drowsy seal

#

wheres the help

#

?

#

and where did i call him dumb

drowsy seal
#

he offered you a potential solution that is like 3 clicks. it's not exactly what you're looking for but he still offered help

#

and you come in hot

drifting ore
#

Its not even 3 clicks

uncut ocean
#

what

#

LOL

drowsy seal
#

I'm outie, not playing this game with you lmao

uncut ocean
#

thats not a potential solution

drifting ore
#

You click twice

#

Thats it

tribal marsh
#

Alright everyone chill

drifting ore
#

You click the dropdown, select the one you want and hit "play"

uncut ocean
fleet adder
#

anyone know where lighting parts like lamps are found in the scripts or if they are somewhere else

uncut ocean
#

kaiser are you a programmer?

drifting ore
#

I just told you I wrote a transaction handler in COBOL

#

but you probably don't even know what COBOL is lmfao

uncut ocean
#

and you don't optimize your code apparently because seconds don't matter

#

'lol you don't know what cobol is lmfao'

#

wow you just proving your terrible character

drifting ore
#

This isnt coding chief this is a video game that requires patience to begin with, that extra 1 second isn't detrimental to your play experience

uncut ocean
#

low life over here

tribal marsh
#

Look, Kaiser gave a "wave the wrist" answer - thats fine, but not what you're looking for. Move on.

#

Don't name call here

drifting ore
#

A QoL mod is one that helps you do something quicker

uncut ocean
#

LOL

grizzled grove
#

just a reminder to be nice in here.

drifting ore
#

Selecting a chatacter using the BUILT IN QoL feature

#

Is there a mod that helps me click "start new game"

uncut ocean
#

just because its too granular for you

#

doesn't make it pointless

drifting ore
#

I need help cus that extra click really makes my wrist hurt

willow estuary
uncut ocean
#

whether it saves half a second or 10 is irrelevant lol

#

its saving time

#

get over it

drifting ore
#

Once again this game is all about patience

uncut ocean
#

as you said a QoL mod is one that helps you save time

#

now you are saying it only matters if it saves more than 1 second? is two seconds enough?

uncut ocean
#

where is the spectrum of time saving that it becomes worth it for your pedantic nature

drifting ore
#

I came here with a pretty straight forward answer and you called me a dumbass and kept pestering me about my programming knowledge

uncut ocean
#

no you didn't come with an answer

willow estuary
#

Enough. This is getting both heated, and off topic.
People chill.

drifting ore
#

Its built into the game chief

uncut ocean
#

you said this qol is pointless because it only saves ONE second lol

#

because apparently one second isn't enough for your standard of optimization

#

get over it

bitter frigate
#

oh jesus y'all are still going. i went to go get a snack

grizzled grove
#

people make mods we don't like, it happens. no point debating or deriding over it

uncut ocean
#

exactly

#

jesus christ

grizzled grove
uncut ocean
#

gladly

#

so back to my original question. despite how little time it would save - is this QoL possible to implement

#

?

#

thats all i wanted to know

#

not whether its worth attempting or not

weary matrix
uncut ocean
#

@weary matrix do you think its possible to implement

#

regardless

#

?

#

kind of amazed that no one will give me answer to this question

bitter frigate
#

be patient dude sometimes it takes a couple hours for somebody who knows and cares to share to meander through

uncut ocean
#

i've posted this question a few times within the past 48 hours..

#

i've been pretty patient

#

but fair point

fleet adder
#

speaking of questions anyone well versed with the lighting system in general

willow estuary
#

If I think something isn't feasible I don't like to say anything in case I'm wrong + it discourages someone? ๐Ÿ˜„

bitter frigate
#

my advice is start looking into lua in the meanwhile. people are GENERALLY more willing to help when you come with an honest effort at coding it yourself

uncut ocean
willow estuary
#

As a mod, that feature would have issues in MP, in that the client and server have to have identical sets of mods running, so, if you wanted this to make logging into servers etc easier, it would depend on the server using it? That's the main issue I see.

tired lodge
#

you dont need to ask if its possible or not programming is all about trying things out and learning from your mistakes and experience along the way

#

unless you are concerned about wasting your time

uncut ocean
uncut ocean
#

guess i couldn't just make it sp only

#

i haven't tried mp at all yet so

weary matrix
uncut ocean
#

yea as i thought about it more i realized its probably pretty complicated to implement for what i get out of it

weary matrix
#

not exactly sure I understand fully what you mean

uncut ocean
#

it'd just autofill your last selected character build into the character template dropdown

#

so you dont have to bother with that if you want to use the same character as last time

#

it only saves like half a second

#

but i thought itd be a fun way to introduce myself to modding

#

and i like saving small actions

#

i mean thats programming right... ?

#

anything we do a handful of times repetitively could be worth optimizing usually

weary matrix
#

yes it's programming ๐Ÿ˜…

uncut ocean
#

right...which is why i was dumbfounded by the previous responses...

cold burrow
# fleet adder speaking of questions anyone well versed with the lighting system in general
GitHub

Community API is a team effort to centralize & give mod creators optimized tools for creating quality mods. - PZ-Community-API/LightAPIClient.lua at master ยท Konijima/PZ-Community-API

uncut ocean
#

what programmer in their right mind is going to berate someone for trying to optimize something...

#

mind blowing

weary matrix
uncut ocean
#

don't even worry about it...mods asked me to drop it

#

just blows my mind

willow estuary
#

Oh people act confrontational on the internet as a recreation; it's silly and unfortunate, and people who do that are better ignored.

uncut ocean
#

totally

fleet adder
#

life saver

uncut ocean
#

i just don't expect fellow programmers to say "omg you're trying to optimize just ONE second, how dare you"

formal stone
#

congrats

willow estuary
drowsy seal
willow estuary
#

Can we not? ๐Ÿ˜„

uncut ocean
#

yea lets not

bitter frigate
#

don't make me get the popcorn emoji

drowsy seal
#

Just clearing my name of being "confrontational" or anything like that. Always down to help people

cold burrow
#

How to add new context button for specific item SubCategory? Any simple examples?

willow estuary
#

The popcorn gif means that the hallowed purpose of the workshop channels has been disrupted.
That makes Pat Bren sad. We don't want the hero of VHS tapes being sad ๐Ÿ˜ข

cold burrow
mint sphinx
mint sphinx
willow estuary
#

Oh, I have pings disabled/headphones off/afk etc all the time too ahahaha.

#

I'm like a grandparent with their smartphone notifications with discord.

mint sphinx
#

xD

willow estuary
#

"Why did my microwave beep? I don't even own one?!?!"

drifting ore
#

is there a way in lua to detect a zombie hit or kill?

#

whenever the character hits them with any weapon or firearm

drifting ore
weary matrix
drifting ore
#

great, thanksss

#

:)

#

Thanks @weary matrix finally a way to bring up this corpse that I had thrown out the window ! Great job

weary matrix
#

I'm still laughing about it ๐Ÿ˜‚

hidden estuary
#

can anyone help out with this?

#
do
    local CharacterCreationHeader_create = CharacterCreationHeader.create
    function CharacterCreationHeader:create()
        getPlayer():HasTrait
        if player:HasTrait("valkyrieWoman") then
            CharacterCreationHeader_create(self);
            self.genderCombo:setVisible(false);
            MainScreen.instance.avatar:setFemale(true);
            MainScreen.instance.desc:setFemale(true);
        end
    end
end```
#

getting a nasty syntax error cause the trait "doesnt exist"

#
ProfessionFramework.addTrait('valkyrieWoman', {
    name = "UI_trait_valkyrieWoman",
    description = "UI_trait_valkyrieWomanDesc",
    profession = true,
})```
#

I used profession framework, and it very well should exist

#

idk why the game is refusing to read the trait, probably cause its linked to a profession?

#

they're all in the same lua file

#

obviously I'm setting the trait first and the function later

weary matrix
hidden estuary
#

lemme go make it again

#

oh wait sorry

#
do
    local CharacterCreationHeader_create = CharacterCreationHeader.create
    function CharacterCreationHeader:create()
        if getPlayer():HasTrait("valkyrieWoman") then
            CharacterCreationHeader_create(self);
            self.genderCombo:setVisible(false);
            MainScreen.instance.avatar:setFemale(true);
            MainScreen.instance.desc:setFemale(true);
        end
    end
end```
#

using this one

weary matrix
#

looks better, but still need the error

hidden estuary
weary matrix
#

hum looks like your code is called before the player is created

hidden estuary
#

how can I call this code after the player is created

#

or well, ugh

hidden estuary
#

that wouldn't work

#

what does the game mean by creating player?

#

does it mean going to the character creation menu

#

or actually spawning in the player after everything is customized and selected

weary matrix
#

no it's when the IsoPlayer object is actually instantiated

hidden estuary
#

yeah that wouldn't work

#

I'm trying to remove the gender option if the player picks a profession

#

so when they go through with the profession into the character creation menu

#

there's no option

weary matrix
#

you'd probably have to hook a function from the character creation panel, just to hide the field, and in OnCreatePlayer() just set the value you want

hidden estuary
#
do
    local CharacterCreationHeader_create = CharacterCreationHeader.create
    function CharacterCreationHeader:create()
    CharacterCreationHeader_create(self);
    self.genderCombo:setVisible(false);
    MainScreen.instance.avatar:setFemale(true);
    MainScreen.instance.desc:setFemale(true);
    end
end```
#

if I remove the trait thing, it works

#

but it obviously disables the gender option to EVERYONE involved

#

not just people who picked the profession

weary matrix
#

ah right

hidden estuary
#

what a pickle

weary matrix
# hidden estuary what a pickle

hum in client/OptionScreens/CharacterCreationHeader.lua there's a self.genderCombo.selected field, guess you try to check that value?

#

ah no wait

#

sorry that's not working either I guess

hidden estuary
#

is there a way to check for a player's occupation instead of trait?

#

maybe that would work

#

I made the trait just to hook up with the code

#

the trait coming from a profession

weary matrix
hidden estuary
#

I'm assuming the game is trying to find a trait that only comes into action on character spawn, and hoping that maybe professions dont function in the same way

#

xD

#

unlike traits, professions impact the character creation menu

#

like starting as a firefighter gives you firefighter pants

#

u know?

#

so I'm hoping the game checks for the profession

#

as it transitions into the character creation menu

weary matrix
#

hum I guess you could hook some function in CharacterCreationProfession.lua and check the value in self.listboxProf.selected?

hidden estuary
#

I could try

undone crag
# willow estuary Well, my wife is a university professor who teaches critical thinking, and she w...

Ooh teaching critical thinking. I have myself been thinking about and discussing the human mind and its failures and improvement and I think it would be good to talk about a facet of intelligence that is not spoken about much.
It's all right knowing how to structure a logical argument, but that is not going to guarantee putting it into practice consistently.
It's all right having a concept of objective truth, but that may not itself confer immunity to delusion.
It's all right reading a list of top twenty logical fallacies, but that may not be enough to not need lists of logical fallacies. There's even the "logical fallacy fallacy".

There is the trouble with people having compelled thought, with their motivated thinking, with them at one moment not being aware of their reasoning at another moment though they be in contradiction. There is the lack of introspection. The lack of thinking about thinking. People often do not know themselves. They do not scritinise their thoughts. They do not just decide their opinions with thoughts, their thoughts are sometimes controlled by their opinions.

This is made possible by a particular mode of thought protecting itself from the sort of awareness you would have of ordinary things. People lack the awareness of their own thoughts to notice when their thoughts is being compelled and their awareness is suppressed. They have the thought, but not the metathought. Some of the best reading I have done on it has been writings of an occultist.

undone crag
# hidden estuary ```lua do local CharacterCreationHeader_create = CharacterCreationHeader.cre...

Also that will glitch like that for a character without the Valkyrie trait. It's only running CharacterCreationHeader_create(self); after the check, so it will not create the menu if the character does not have the trait. If you change the code to have a check that works, you are going to need to run the original creation function in all cases. Like this in the replied to example.

do
    local CharacterCreationHeader_create = CharacterCreationHeader.create
    function CharacterCreationHeader:create()
        CharacterCreationHeader_create(self);

        if player:HasTrait("valkyrieWoman") then
            self.genderCombo:setVisible(false);
            MainScreen.instance.avatar:setFemale(true);
            MainScreen.instance.desc:setFemale(true);
        end
    end
end
```(Farewell)
weary matrix
#

good point

formal stone
weary matrix
abstract raptor
drifting ore
#

so im completely new to modding with lua..i was wondering how would you add a new trait, do you need to add a lua file under the \shared\NPCs

#

for the traits

#

since im basically going only off of another traits mod since i can't find any guides

drifting ore
#

this will make my life much easier

bitter frigate
mossy herald
#

The police variants of the cars don't let you switch from front to back seats or access its inventory, does anyone know what attribute set this behavior?

wheat tendon
#

welp. . im hearing other npc getting jumpscared, eating and drinking . .

drifting ore
#

idk i might just be dumb dumb

bitter frigate
#

like how would you construct your mod folder?

drifting ore
#

yes, but do i need to add a text file there or an image?

bitter frigate
bitter frigate
drifting ore
#

okay sounds good

#

ill experiment with that

bitter frigate
#

good luck!

cold burrow
mossy herald
cold burrow
bitter frigate
#

i continue to feel AMAZING every time something works the way i'm reasonably sure it's supposed to. does this wear off?

wheat tendon
#

i love having random jumpscare while im in my base cooking

#

also raids from npc spawning targets your current character, right? so hoping to another one would not target

cold burrow
drifting ore
#

im still having trouble with this title and description of traits man

#

ive looked at the code of a few traits mods and looking in the UI folder and seeing no text file related to the title or desc of the trait

#

concerning me a bit

mossy herald
#

Only 2 seats

#

But thanks to that I found what I was looking for

#

in vehicle_car_lights_police.txt the passenger RearLeft has:

            }

switchSeat FrontRight{
            }```
#

Its empty thats why it won't work

#

Thanks @cold burrow

cold burrow
cold burrow
lapis scroll
#

Hey all, when modifying drop tables in this manner:

    table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Base.TinnedBeans")
    table.insert(SuburbsDistributions["all"]["inventorymale"].items, 0.01)

What does the table value (0.01 in this case) represent? Is it a percentage, or a weight? If it's a weight, is there an existing table for weights that I can reference? I'm looking for zombie drops here specifically, FWIW

cold burrow
drifting ore
#

thank you so much

mossy herald
#

Was also searching the More Traits mod trying to help ๐Ÿ˜…

#

But makes sense being a translate variable

drifting ore
#

thx so muchhh

cold burrow
# weary matrix is this what you need maybe? <https://github.com/quarantin/zomboid-spear-traps/b...

Well, i surrender. I don't even know how to make getAllEvalRecurse works.

local function thisIsATestFunction(player)
    local playerObj = getSpecificPlayer(player)
    local inventory = playerObj:getInventory()
    local items = ArrayList.new()

    inventory:getAllEvalRecurse(function(item, player)
        if item:isBroken() then return false end
        if item:getScriptItem():getType():contains('Weapon') and
           item:getScriptItem():getSubCategory():contains('Firearm')
        then return true end
        return false
    end, items)

    -- for _, item in pairs(items)
    --     print("[TEST]: "..item)
    -- end
end

Events.OnFillWorldObjectContextMenu.Add(thisIsATestFunction)

And now i have tons of questions. :(
I would really appreciate if i get some answers by a chance.

  1. What is player arg passing to main function? Where do we get value for it?
  2. Why PlayerObj is getSpecificPlayer(player) instead of getPlayer()?
  3. What is the item arg passing to anonymous function in getAllEvalRecurse?
  4. Idk how to add context to each item, instead of world object. :(
merry osprey
#

Anyone know of a mod that allows players to claim vehicles? I'm told there is one but idk what it's called to find it.

Also if there a mod to make things non-destructible in player safehouses by anyone other than safehouse members? We have trespassing turned off because people can still sledge and steal (not that theft has been an issue) but I'd like to be able let people visit others safehouse.

Is there away to allow players to claim 1 safehouse but be a member of others?

drifting ore
#

finally got it working

#

i just wanted to see if the trait itself shows, time to figure out how to make the stats work now

#

wanted to ask, if i wanted to apply stats that are within the game (unhappiness over time), i would need to do that in the server folder?

#

or within shared?

weary matrix
#

getAllEvalRecurse is calling the anonymous function on each item it can find, so that you can decide whether it should be added to the result

bitter frigate
#

i've tried rewriting the bugged portion of my code from scratch but just wound up with a more convoluted version of the exact same thing. i feel like there's something incredibly simple here that i'm just not grasping

cold burrow
#

i feel like there's something incredibly simple here that i'm just not grasping
Me too, me too. :D
I'm pretty sure there should be pretty simple way to query specific items By param. But i don't know how to make it works.

bitter frigate
sweet drum
#

Hi guys one questions where can i learn how to make scripts ?

cold burrow
bitter frigate
#

i know i literally just told somebody to be patient but i am LOSING MY MIND trying to get this to work. debug and create work independently and with each other. it's when raise is added that the whole thing breaks.

Diabetes = {}
local SugarValue = 0

-------------------------------------------------------------------------------------------------
-- debug ----------------------------------------------------------------------------------------
function Diabetes.PRESSED(key)
   print("Key Pressed " .. tostring(key))
    if key == Keyboard.KEY_COMMA then
        print("Comma Pressed")
        print(SugarValue)
    end
end

Events.OnKeyPressed.Add(Diabetes.PRESSED)
-- debug ----------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------



-------------------------------------------------------------------------------------------------
-- creates blood sugar --------------------------------------------------------------------------

function Diabetes.EXIST(playerOrSurvivor)
    print("Yee the fuck haw.", PlayerOrsurvivor)
    SugarValue = 120
end

Events.OnCreateLivingCharacter.Add(Diabetes.EXIST)



-------------------------------------------------------------------------------------------------
-- raises blood sugar --------------------------------------------------------------------------

function Diabetes.CalculateSugarValue(getPlayer())
     SugarValue = SugarValue + 0.5

    if SugarValue >= 400 then
        setBodyDamage(getPlayer():getBodyDamage() + 0.05)
    elseif SugarValue < 40 then
        setBodyDamage(getPlayer():getBodyDamage() + 0.08)
    end
end

Events.EveryTenMinutes.Add(Diabetes.CalculateSugarValue)```
rain pumice
#

try this?

#

you can't have multiple if statements in one function

bitter frigate
cold burrow
rain pumice
#

or you can try elseif

#

yes

#

elseif avoiding the need for multiple ends

wind bear
rain pumice
#

^^ true

#

im dumb

rain pumice
cold burrow
#

I'm curious too. :D

bitter frigate
rain pumice
#

whats the debug saying

bitter frigate
#

when i press the key to trigger the debug it's saying NOTHING. it's as though i didn't press a goddamn thing

#

i'm getting a little red 1 on the bottom right of my screen during *load. that isn't there before i try adding in raise

rain pumice
#

actually

#

it is correct...

#

scratch that lol

bitter frigate
#

ok ok i was worried lol

rain pumice
#

are you trying to reduce the hp?

rain pumice
bitter frigate
rain pumice
#

then I think you should create a loop

bitter frigate
rain pumice
#

if sugar value is lower than 40

#

you'd damage too?

#

right

bitter frigate
#

yes

rain pumice
#

I'm also a beginner but I'm trying my best to help you XD

bitter frigate
#

I REALLY APPRECIATE IT DUDE like so much

rain pumice
#

cuz I feel like we can both learn from this x)

bitter frigate
rain pumice
#

did you copy it from another mod

bitter frigate
#

which could easily explain why it isn't working

bitter frigate
rain pumice
#

ohh

#

I just saw that line

drifting ore
#

nvm found it

rain pumice
#

setUnhappynessLevel

#

oh

drifting ore
#

thanks tho lol

#

im just dumb

rain pumice
#
function Diabetes.CalculateSugarValue(getPlayer())
    local sugarvalue = SugarValue + 0.5

   if sugarvalue >= 400 then
       setBodyDamage(getPlayer():getBodyDamage() + 0.05)
   elseif sugarvalue < 40 then
       setBodyDamage(getPlayer():getBodyDamage() + 0.08)
   end
end
#

I think it might be because you called SugarValue = SugarValue + 0.5 same name as the global variable you already set lines above, so I switched it for lowercase

#

so your local sugarvalue inside your Calculate is lowercase

#

meaning that you can't use that sugarvalue outside of that function

#

let's hope it works lol

bitter frigate
#

no dice un_yee

rain pumice
#

same error?

bitter frigate
#

same error in that there is no error or recognition of the mod at all

#

also my concern here is that sugarvalue = Sugarvalue + 0.5 would only ever = 120.5, since SugarValue = 120

quasi geode
#

function Diabetes.CalculateSugarValue(getPlayer()) << you cant do this

rain pumice
#

I was looking at that just now

#

please elaborate Oh great fenris

#
function Diabetes.CalculateSugarValue(SpecificPlayer)
    local sugarvalue = SugarValue + 0.5
    local SpecificPlayer = getPlayer()
   if sugarvalue >= 400 then
    SpecificPlayer():getBodyDamage():setBodyDamage: + 0.05)
   elseif sugarvalue < 40 then
       SpecificPlayer():getBodyDamage():setBodyDamage + 0.08)
   end
end```
#

would this work?

quasi geode
#

thats attempting to call getPlayer() when you define the function (on lua loading). there is no player at that point, thus causing a huge error when parsing the file
you need to have a proper variable name there, not the return value of another function
but since that is getting added to the EveryTenMinutes event, it shouldnt have any arguments defined at all

#

function Diabetes.CalculateSugarValue()

rain pumice
#

ohh

#

wouldn't it be better to use OOP in that case?

quasi geode
#

OOP has absolutely nothing to do with this issue

rain pumice
#

i see

bitter frigate
#

it WORKS NOW BY GEORGE

rain pumice
#

which one did you use?

bitter frigate
rain pumice
#

sweet

bitter frigate
#
-------------------------------------------------------------------------------------------------
-- raises blood sugar --------------------------------------------------------------------------

function Diabetes.CalculateSugarValue()
     SugarValue = SugarValue + 0.5

    if SugarValue < 40 then
        setBodyDamage(getPlayer():getBodyDamage() + 0.08)
    elseif SugarValue >= 400 then
        setBodyDamage(getPlayer():getBodyDamage() + 0.05)
    end
end

Events.EveryTenMinutes.Add(Diabetes.CalculateSugarValue)``` 

this is what wound up working
cold burrow
#

Oh, Fenris_Wolf, while you are here, could i ask you something about optimization?
I often see that peps using this construction or something like that:

TweakItem("AAS.MountainDew","DisplayCategory","FoodB");
TweakItem("AAS.Pepsi","DisplayCategory","FoodB");
TweakItem("AAS.RCCola","DisplayCategory","FoodB");
TweakItem("AAS.RootBeer","DisplayCategory","FoodB");
TweakItem("AAS.FantaGrape","DisplayCategory","FoodB");
TweakItem("AAS.GingerAle","DisplayCategory","FoodB");

But isn't be faster just to place all the items in array and pass this array as argument to function, and inside function just sort it out with for and pairs/ipairs?
We kinda just call a function only once instead of tons of times.

quasi geode
#

possibly faster, it varies, depending on the loop structure and function. definitely cleaner, easier to read and maintainable

#

i'd throw it in a table and use the loop myself

#

but i dislike redundancy (like typing TweakItem over and over lol)

cold burrow
quasi geode
# cold burrow Aha, that's what i was thinking. Thank you so much for answer . :)

a more through answer though on the actual optimization of it, it can have a lot to do with the namespace of the functions involved (global vs local), i'm kinda a stickler for using local space and even pulling globals into local space before using them. the smaller the scope you put things in, the less resources its going to waste. so if you had a table you wanted to pass to ipairs to call the TweakItem function a potential optimization would be

local ipairs = ipairs -- pull it into local space
local tweaker = function(items)
    local TweakItem = TweakItem -- pull this global function into local
    for item, tweaks in ipairs(items) do
        for key, value in ipairs(tweaks) do
            TweakItem(item, key, value)
        end
    end
end

theres a trade off though pulling the TweakItem into local space inside the tweaker function, depending on how often its called. this would be more effective for large tables instead of small ones (the cost of calling the function vs the cost of pushing the variable onto the stack)
it maybe more appropriate to put the TweakItem function into local outside the function (as done with ipairs). and ofc at this point its probably best to just replace the TweakItem function entirely with a more optimized version

a more critical thing for this specific code though is that its probably only going to run once, at startup and most of these optimizations for performance are entirely unnecessary. If it was going to be running in a time critical spot (like OnPlayerUpdate or OnTick) then it be worth considering.

merry osprey
#

does anyone know if there is a way to prevent players from destroying peoples safehouses with sledges without turning on no tresspassing?

cold burrow
# quasi geode a more through answer though on the actual optimization of it, it can have a lot...

I'm just using method that Blair Algol post not long time ago instead of TweakItem API, but i just rewrite it a bit.
like:

local function changeItemProperty(items, property, value, module)
  local module = module or "Base"

  for _, item in ipairs(items) do
    local _item = ScriptManager.instance:getItem(module.."."..item)
      if _item then
        _item:DoParam(property.." = "..value)
      end
  end
end

local items = 
{
  "item1",
  "item2",
  "item3"
}

changeItemProperty(items, "Property", "Value")

^ something like that

quasi geode
#

sure that format will work well if you're changing the same property/value for multiple items. TweakItem is basically just calling :DoParam anyways. as i said though since its just running once on startup performance optimization is kinda a non-issue, if you really wanted to optimize it though, getting the script manager instance could be done outside the ipairs loop

#
  local manager = ScriptManager.instance
  for _, item in ipairs(items) do
    local _item = manager:getItem(module.."."..item)
#

but again its lookup cost vs pushing the variable onto the stack, so depends on how many times its going through the loop (ie: how many items), but in effect when its looking for ScriptManager.instance first its going to check the local stack...then hunt through the global...then look for the .instance field

willow estuary
#

I like my method in that I think it's the "simplest" method, and I'm dumb as shit, but I also like how it serves as a straightforward ledger of the changes I've made?

local item = ScriptManager.instance:getItem("Base.AssaultRifle")    
if item then 
    item:DoParam("MinDamage    =    0.8")
    item:DoParam("MaxDamage    =    1.4")
end
local item = ScriptManager.instance:getItem("Base.PistolCase1")    
if item then 
    item:DoParam("Capacity = 3")
end
cold burrow
#

I already tried to use table structure like that:

items =
{
  item = "Item1",
  properites = 
  {
    "prop1",
    "prop2",
  },
  item = "Item2",
  properties = 
  {
    "prop1",
    "prop2",
  }
}

But no luck to get right values, i still really newb in lua.
Will try to do that again later.

quasi geode
# willow estuary I like my method in that I think it's the "simplest" method, and I'm dumb as shi...
local ipairs = ipairs
local manager = getScriptManager() -- i prefer this get method to ScriptManager.instance
local tweaker = function(module, items)
    for name, tweaks in ipairs(items) do repeat
        local item = manager:getItem(module .. '.'.. name)
        if not item then break end
        for key, value in ipairs(tweaks) do
            item:DoParam(key .. ' = '.. value) -- string concentration not so good performance wise, but meh
        end
    until true end
end


tweaker("Base", {
  AssaultRifle = {
     MinDamage = 0.8,
     MaxDamage = 1.4, 
   },
  PistolCase1 = {
     Capacity = 3,
   },
})

thats how i'd end up doing it. overkill for a few items but the end table is nice and clean and saves overall redundancy when dealing with large amounts of items ๐Ÿ™‚

willow estuary
cold burrow
quasi geode
#

you can, but you have to change it a bit from

{
  42Key = 'blah', -- invalid
  ["42Key"] = "blah" -- valid
}
willow estuary
#

Ultimately it's just two different ways of writing out the same net equation, however?

quasi geode
#

but its my way XD

cold burrow
willow estuary
#

Well, then I'm contractually obligated to say it's the right way and I'm a giant dum dum ๐Ÿ˜

quasi geode
#

remind me to review your contract at a later date.

willow estuary
#

But, I think one of the merits of my method is that it's so simple, so it's a straightforward matter for newbies to get a handle on?
As they get more adroit with coding, then they can enjoy the fancier solutions.

quasi geode
#

yes. my way has a few headscratchers in there if your not used to lua. even if you are, the whole

 for name, tweaks in ipairs(items) do repeat
    -- snip
until true end

is unusual and not commonly done

willow estuary
#

Granted, there's also value in learning how to implement the other method for the educational matter.

quasi geode
#

(blame lua for not having a simple way of skipping over the rest of the loop. by using "break" i can skip out of the inner "repeat ... until true" part and continue the next iteration of the ipairs outer loop)

#

simple solutions are good. you know me though i tend to overengineer everything (cough orgm)

willow estuary
#

Yeah, ultimately everyone is going to have their own approach, and there's a million ways you can factor out an equation? I just try to keep the focus on "this is the simplest way I'm aware of", and I like to pretend it's for the benefit of other's and not that I'm simple.

Anyways, modding. "Rogue Trader" trading shack. It's a vehicle, except it's immobile.

cold burrow
#

I like to pretend it's for the benefit of other's and not that I'm simple
And it's really benefit of others. Imho.

bitter frigate
willow estuary
#

Maybe, if it makes it easier to implement, but the bulk of the interface would have to be a regular rectangular interface?
Shopping with a radial menu would probably be a bit much.

bitter frigate
#

woof yeah i can see how that'd be out there. very very cool!!!

grizzled grove
willow estuary
# grizzled grove never even thought about immobile vehicles. are windows optional too?

Everything is optional if you're creative with Lua? But yeah, I made motorbikes that work like motorbikes so optional windows are feasible.

But yeah, immobile, nonfunctional vehicles are my solution for scenery etc objects where I want a 3D object, not tiles, that also ha collision?

I mean, really, you could make a tree house that was a vehicle, for example?

grizzled grove
#

yeah, that really got me thinking

willow estuary
#

But the whole train of thought strayed with that I've had a longstanding desire to see nonfunctional scenery vehicles in PZ, just for set decor and vibes? Basically the same function the wrecked vehicles serve.

It's a very safe bet that there will eventually be tanks in vanilla fort Knox, and they will also be nonfunctional scenery vehicles?

But you could also do a lot with construction equipment, roadwork machinery, aircraft and cargo containers as people have done (I have an unreleased WIP cargo container thing with models by Filibuster going back a year now), wreckage, scissor lifts, etc.

My motorbike mod has working golf carts, electric wheelchairs, and electric mobility scooters in it, not because they serve any useful purpose, but they're good scenery?

grizzled grove
#

Anything that adds more flavor is good, in my opinion

#

i guess i'm too used to the mapping mindset, where we're a bit more boxed in

willow estuary
#

Nonfunctional trains spawned on train track tiles by fancy Lua. Surface to air missile vehicles. Wrecked busses. Crashed airliners. Etc. Etc.

#

Yeah, I kinda take the meta approach with stuff like trash and corpses, or the mod spawning shipping containers scattered on the roads, where I apply my aesthetic to existing maps with my mods?

grizzled grove
#

i'd still like to know if there's a way that map zones can be used in lua. I've seen a few people try it for things like street sign info, but i don't think anything ever actually stuck

#

seems possible, that's all handy info stuffed into a lua file and seems ripe for map modding, yeah?

willow estuary
#

I mean, if you're gonna work with Lua you can have information stored however you want with tables, global mod data, etc. Getting stuck on using map zones, if it's an issue, is shortsighted IMO, albeit that's part of the problem with being a newbie?

#

But until you get a handle on the basics, and develop good troubleshooting practices, etc, anything Lua is gonna be a fucking headache really, and it's gonna be anything from a speedbump to a roadblock for individuals?

grizzled grove
#

naturally! I'll dive into lua eventually, i have too many projects going already.

#

actually, probably very soon, i've been prepping to write a tool for tilezed, but that's blowing my tiny mind right now

willow estuary
#

Yeah, I'm in the opposite position really, where there's a lot I want to do mapping wise, but too many Lua projects.

#

Oh awesome! I've actually had to edit the tie files manually to do some stuff, so I'm interested.

grizzled grove
#

it has a lua console, some scripts to pull examples from, and the help docs list out the tilezed specific api- or most of it i think? I ended up fairly confused reading through the scripts, so I need to back up and read up on how lua actually works

opal wind
#

guys what this entry here leads to?

#

item PipeBomb
{
DisplayCategory = Devices,
MaxRange = 10,
Type = Weapon,
MinimumSwingTime = 1.5,
SwingAnim = Throw,
WeaponSprite = Molotov,
UseSelf = TRUE,
DisplayName = Pipe Bomb,
SwingTime = 1.5,
SwingAmountBeforeImpact = 0.1,
PhysicsObject = PipeBomb, <----------------- is this a sprite or lua code or what ? where can i find it ?
MinDamage = 0,
Weight = 1.5,
MaxDamage = 0,
MaxHitCount = 0,
Icon = PipeBomb,
ExplosionPower = 90,
ExplosionRange = 7,
ExplosionSound = PipeBombExplode,
SwingSound = PipeBombThrow,
PlacedSprite = constructedobjects_01_32,
Tooltip = Tooltip_Trap,
WorldStaticModel = PipeBomb,
}

crimson spindle
#

Is it possible to make an object with two different visual states that are toggleable? I have an item that I want to operate like a washing machine, but is visually distinct depending on if it is on or off.

opal wind
#

hehe i did that on a minecraft machine

#

not a clue how to make it here thou, i wanted to make that but with a weapon, to make a lightsaber

crimson spindle
#

oh that does sound like a cool idea... hopefully there's a way ๐Ÿ˜›

opal wind
#

its possible with clothing so i guess yeah

#

maybe with some lua coding

crimson spindle
#

youre right i didnt think about that mmm

opal wind
#

the fanny bag

crimson spindle
#

yeah ill have to check out the code of one of the clothing mods i use.. i know they have toggled states

#

thanks for the idea

opal wind
#

if you manage to do with other than clothing let me know ๐Ÿ™‚

cold burrow
#

and me please, would love to know it. :)

opal wind
#

i use one of those on real life on my masters lol

drifting ore
#

0:03 Says F*** u** tony

vivid flare
#

bit too much clutter. in heat of the moment, impossible to use

fair frost
mint sphinx
#

hmm id you need to add something to the normal distributionTable its insert.table(distributionTable["foo"].items , "bar") right ?

mossy depot
#

Hello, quick noob question. I'm trying to reskin a model (Can of Oats). I located the model and texture in the files and made a new texture for my mod item, but not sure how to get it in game. Do I need to install blender to update a texture reference in the fbx file?

#

Ooh I just found models_items.txt defining mesh & textures

frosty falcon
#

so we have two mods (possibly more out there) that override each others vehicle menu entries, they both override this function:
ISVehicleMenu.showRadialMenu
is it possible to have multiple mods to add entries to the vehicle menu, and prevent them overwriting each others entries somehow?

mint sphinx
#

i guess if they modder have coded it correctly hit. when mods overwrites functions it usually break other mods why it better if modders do hooks which it dont sound like they do

drifting stump
mint sphinx
#

so i would say no sry had something exploding on me when i fired up my zomboid

frosty falcon
#

oh you did? that may help bring compatibility between mods, I'm just looking because the server I play on uses harder hotwiring and trueMusic, which means you lose the option to play casettes in cars as it appears the new hotwiring entries from that mod override them

#

just writing to the harder hotwiring dev trying to see if we can get a solution

drifting stump
#

Well i solved that too XD

frosty falcon
#

:o

drifting stump
#

I have my own hotwire mod

mint sphinx
#

@drifting stump do you know by anychance how to add to the default Distributions.lua table ? i failing to add items to that table hmm

drifting stump
#

Ill link in a sec let me get on pc

drifting stump
winged lotus
#

@mint sphinx I add things this way usually in media/lua/server/YourLuaFile.lua

table.insert(ProceduralDistributions.list.ShelfGeneric.items, "Base.ItemType");
table.insert(ProceduralDistributions.list.ShelfGeneric.items, 0.1); -- with 0.1 the odds of finding the item on an looting roll
drifting stump
#

documentation in the pinned discussion

#

still need to add the emote menu documentation

frosty falcon
#

oh I see, nice API!

mint sphinx
#

also it only with one table i have the problem with ^^

drifting stump
#

as an added bonus of this hotwire mod everything is fully customizable too ๐Ÿ˜‰

frosty falcon
#

what happens if you use expanded hotwire with a mod that overrides ISVehicleMenu.showRadialMenu?

#

I'm assuming they'd have to code support for the framework right?

drifting stump
#

expanded hotwire doesnt do anything it uses the API

#

and the API is compatible with other mods using the old way of hooking

frosty falcon
#

oh wow

#

so if you used 2 mods that override ISVehicleMenu.showRadialMenu plus the expanded hotwire+framework, would they all work or would only one of the overriding mods + expanded hotwire work?

drifting stump
#

harder hotwire is not tho because it doesnt hook it fully replaces with something from an old version of the game

frosty falcon
#

o

drifting stump
rain pumice
#

setMovementTypeโ€‹(ParameterCharacterMovementSpeed.MovementType movementType) Will this work to change my players movement speed?

#

I'm trying to make a cheat to increase players mov speed

#

but I can't find anything similar

#

or is it based on animations?

drifting stump
#

@frosty falcon
editing the vehicle radial without the API should look like

local oldMenu = ISVehicleMenu.showRadialMenu
function ISVehicleMenu.showRadialMenu(player)
    oldMenu(player) --hook

    --do your stuff
    --ask to render
    --do controller support
}
#

so if they do that hook several can be used

frosty falcon
#

its erm

mint sphinx
#

stupid question where do you normal find eggplants in this game o.o xD

frosty falcon
drifting stump
#

like i said harder hotwire is not that mod should be avoided because:

  • makes other mods adding to the menu not work if they were loaded before
  • its code is from an old version of the game
frosty falcon
#

yeah I'm talking to the guy developing it trying to make it compatible

drifting stump
#

no point tho

frosty falcon
#

says he replaces the entire menu simply because he wants the slices in a particular position for nicer UX

hardy pollen
#

hey, dont know if you figure this out, but i found out that you need to export the animations frames/sec to the same as in your keyframe, for example the bob_walk is like 4800, then it works

drifting stump
#

true music does

frosty falcon
#

yep

#
function ISVehicleMenu.showRadialMenu(playerObj)
    ISMusicVehicleMenu.oldShowRadialMenu(playerObj)
    ISMusicVehicleMenu.showRadialMenu(playerObj)
end
#

so this simply means its appending entries?

#

yeah I can't make sense of the first 2 code blocks

drifting stump
#

yeah basically what it does is run the previous showRadialMenu then run the new one

#

so appending

#

and since it runs the previous its compatible with other mods

frosty falcon
#

I seeee, so it's replacing the function but still appending any previously attached slices?

#

hm

drifting stump
#

yes

frosty falcon
#

this helps thank you

drifting stump
#

no point using harder hotwire tho its incompatible with even vanilla and mine has more features

frosty falcon
#

I think it's a lost cause with the wanting to keep slice positions etc, doubt you can append and still retain the order

drifting stump
#

mine keeps slice positions

#

ยฏ_(ใƒ„)_/ยฏ

frosty falcon
#

so I will deffo have a look at yours

#

ye exactly

drifting stump
#

you can very much append and retain order

#

the order it was appended

#

and my API lets you edit specific slices that were inserted before so the order of those is retained too

frosty falcon
#

interesting, wonder what's his problem then ๐Ÿค”
either way, going to try yours with truemusic and see how it goes!

bitter frigate
#

oooh exciting - i just had my first break on error!!

abstract raptor
drifting ore
#

It's not much, but it's honest work.

#

I appreciate if you help me test, and give me possible feedback to improve the code.

#

looking for someone to set up mods and settings on my serever for me will pay 25$ (edited)

Message #lfg_americas

winged lotus
#

Evening all, Quick lua item distribution question, the number of chances for an item to appear that is set there is a percentage right?

mint sphinx
#

just the only problem is wen i try to add to a hiking_backpack its like it cant find the also havent open the field so the name might be wrong right now

drifting ore
rain pumice
#

Don't panic, your clothing mod is fine ๐Ÿ˜‚

drifting ore
#

fewwwww

#

i went to debug the thing XD

drifting ore
#

This isn't the first time this has happened to me but I have this problem that I can't seem to solve. It's with combo boxes in UIs. Has anyone ever had the same?

bitter frigate
azure prism
#

Please let me know if this is the wrong place, but does anyone know of a mod or setting that deals with the issue of looking directly at a fence, but not being able to see what's between it and your character?

#

There used to be a blind spot mod, but I can't find it any more

bitter frigate
#

alright so the way i'm calculating damage over time is breaking the game. anyone have any alternatives or suggestions on other ways to calculate damage over time? apparently the game does NOT like setBodyDamage(getPlayer():getBodyDamage() + 0.05)

#

it would ALSO be super helpful if someone could explain WHY this error is getting thrown

winged lotus
#

Is there a way to change loot distribution of existing item (adjust looting chances?)

quasi geode
bitter frigate
winged lotus
# drifting ore yes

Thanks! Good to know it's possible, I tried something like ProceduralDistributions["list"]["LivingRoomShelf"]["BookCarpentry5"] = 100 but it did not worked ๐Ÿ™

drifting ore
#

Steam\steamapps\common\ProjectZomboid\media\lua\server\Items

#

ProceduralDistributions.lua

drifting ore
undone crag
# bitter frigate i know i literally just told somebody to be patient but i am LOSING MY MIND tryi...
setBodyDamage(getPlayer():getBodyDamage() + 0.05)

You are not calling setBodyDamage on any Java object, so the code is trying to call a function that does not exist. You would need something like player:setBodyDamage(number) or player:getSomeJavaObject():setBodyDamage(number).
I typed getSomeJavaObject instead of checking what the actual function name was. I think you have to get the player object's damage object, and then set the damage on that.

quasi geode
quasi geode
dim pawn
#

is there a mod that converts the radio's temps from F to C?

#

real stinky when you set the temps to celsius and the radio still displays F.

undone crag
#

:o I edited my message whilst thou wert typing that.

bitter frigate
undone crag
#

You can save time trying to guess function names by using the internet to find out about the functions that there are.

quasi geode
#

^^^^

bitter frigate
undone crag
#

:o

bitter frigate
#

i know OverallBodyHealth is a thing but i don't know if getOverallBodyHealth is how i would reference it. i'm working under the assumption that getPlayer(): prefacing OverallBodyHealth will call the specific bodyhealth of the client

#

that could be very wrong

undone crag
#

This may be relevant, the getBodyDamage you saw before.

#

It returns something called BodyDamage, which you can click on.

#

It has things like this.

#

It could be done like this:

getPlayer():getBodyDamage():AddGeneralHealth(number)

or

local player = getPlayer()
player:getBodyDamage():AddGeneralHealth(number)

or

local body_damage = getPlayer():getBodyDamage()
body_damage:AddGeneralHealth(number)

or

local player = getPlayer()
local body_damage = player:getBodyDamage()
body_damage:AddGeneralHealth(number)
bitter frigate
undone crag
#

:o

winged lotus
drifting stump
#

@bitter frigate feel like i should explain a bit of coding to you so you dont run into the same mistakes

in java there are primitive types which are int, byte, short, long, float, double, boolean, and char. they are like atoms irl(lets ignore they are made of tinier stuff for this example), what things are made of.
so if in that documentation you see something return this kind of stuff you know they are just raw values

then there are classes. objects made of stuff like a chair is made of wood which is made of atoms.
if you see something return anything that is not a primitive then its made of other things. classes can have attributes and methods so youll have to use those to interact with it. basically they are not raw values you can use right away, must use those attributes or methods.

#

hope its clear enough

#

assume strings as primitive too its easier that way XD

quasi geode
# winged lotus Wow, but this is going to be very inefficient if I want to replace loot distribu...

depending. could be more efficient (in theory). performace efficiency is a non-issue since its only fired once

local editDist = function(dist_table, replace_table)
    -- check for a junk table, and edit it by recursively calling this function
    if dist_table.junk then
        editDist(replace_table, dist_table.junk)
    end

    local items = dist_table.items
    if not items then return end
    -- only need to check every second position, since thats the item name
    for i=1, #items, 2 do
        if replace_table[items[i]] then -- the item name exists in our new table
            items[i+1] = replace_table[items[i]] -- replace the spawn rate with the new value
        end
    end
end

-- call the function editting the bookstore with new values
editDist(ProceduralDistributions.list.BookstoreBooks, {
    BookCarpentry1 = 5,
    BookCarpentry2 = 4,
    BookCarpentry3 = 3,
    BookCarpentry4 = 2,
    BookCarpentry5 = 1,
})

this would replace values directly with another value, but may not be ideal since something like BookCarpentry1 can exist in the same table multiple times with different spawn chances. in which case it maybe better to change the line that does the replacers to use a multiplier instead of directly coping a value (ie:)

items[i+1] = items[i+1] * replace_table[items[i]] -- multiply the spawn rate by the new value

and then change the replace_table so its more like

 {
    BookCarpentry1 = 0.5, -- half the spawn rates
    BookCarpentry2 = 0.5,
    -- snip
}
#

(thats all enitrely untested code btw)

glass timber
#

Hey guys, Im currently running a server with a friend of mine, and we currently have alot of mods installed, meaning the server is listed as ??? and its becoming difficult to gain new players as the server is hard to find.

Ive heard some people suggest making a custom modpack to reduce the installed mods on the server to allow it to be seen by more people.

If you know more about how to make a custom modpack, Please contact me!

Thank you

bitter frigate
drifting stump
#

if you try to do chair + chair you have no clue what to do

#

but if you get the number of atoms each is made of it makes sense to do a sum

#

stuff like that

bitter frigate
#

that makes sense!!!!!!! it's so exciting to actually learn things i'm over the moon

#

is there somewhere i can see how hunger effects health regeneration? i know it slows it, but i want to see the mechanism

#

i've dug through the lua files in my steam directory but can't find anything promising

shadow geyser
#

sorry if this been asked before, but I couldnt find it pinned or through the search bar. I was wondering if anyone knows about a tool for deleting map chunks from a save. I recently found a couple more mods that I found really interesting and wanted to add to my save. One is a map mod and another is just a mod that adds items. Ive already previously explored most cities on the map, so I know new Items and the map cant be loaded in. I know I could manually go file by file to delete chunks, but was hoping there might already be a tool for it.

winged lotus
#

Thanks again, and as they said there are no wolf on Fenris ๐Ÿ˜‰

bitter frigate
drifting stump
#

Steam\steamapps\common\ProjectZomboid\zombie

quasi geode
# winged lotus Wow men this basically solves the whole issue with a single function ๐Ÿคฉ thanks a...

ah i'd consider it more of a prototype example then a final version though. by "only fired one" i just ment its done on loading not called over and over during the game...ofc you'll have to call it for each table you want to edit. and theres other factors to consider like you'll probably want to do your edits during one of the events to ensure all other mods have loaded and done w/e edits they'll be doing on the tables first

drifting stump
#

why does the lua files panel not have a search bar

spring shoal
#

Hey, I've been trying to do some work on vehicle collisions with different objects, but nothing seems to have worked so far. I've tried almost every IsoMovingObject method that has "collision" in it, but I always get nil or 0.
Anyone has an idea why that would get me nil instead of some actual value?

local function OnPlayerUpdate(player)
    local vehicle = player:getVehicle()
    if vehicle then
        print(vehicle:getCollidedObject())
    end
end
merry osprey
#

Does anyone know if there is a mod or a way to prevent players from using sledgehammers in safehouses they aren't a part of? I know you can turn off trespassing but I want players to be able to go into each other's safehouses.

sharp cairn
#

somebody have a car modding tutorial ? v:

bitter frigate
#

is there a way to add events that aren't predefined by the game or am i stuck with what i've got?

fringe swift
#

can you add mods to already existing worlds/ servers?

vapid lotus
#

yea depends on the mod tho

fringe swift
#

how would loot from a mod be handled? would we have to turn on loot respawning in order to see some of the stuff it offers?

drifting ore
#

question is there a way to get kitsune's crossbow mod to work with arsenal 26?

drifting stump
bitter frigate
drifting stump
#

what are you trying to accomplish

drifting ore
bitter frigate
# drifting stump what are you trying to accomplish

i'm trying to do a lot right now that i don't know how to do, but SPECIFICALLY right now the crux of the diabetes mod comes down to lowering SugarValue when insulin is "injected". i've made an insulin syringe as a prototype & i was hoping i could create an OnUse event for it to lower SugarValue by ISF*InsulinInjected (Insulin Sensitivity Factor - essentially how much one unit of insulin brings down your blood sugar). i've created a function where i define ISF for the time being, but i'm at a loss for what to do with it

drifting stump
#

ah its stuff within your code

#

all you have to do is call a function

#

look at how items are used

#

and in the code for using your item do your custom stuff

drifting ore
#

smooth brain very smooth

bitter frigate
drifting stump
#

items is an area i havent messed around in much yet but from what i know about the context menu is you just have to add in an option
that option calls a function you specify on click so in that faction you would check if the player has the item and if so perform whatever you want

#

would recommend looking at a mod doing something similar

bitter frigate
tiny junco
#

is there any mod that increases the field of view to 360 or that takes away the fog of war? would it be easy to create it? (I know about the game proposal and etc that people talk about)

grizzled grove
#

what do you mean about the FOV? like a wider zoom?

tiny junco
unique roost
#

Fog of war is a D&D term used to describe what your character cannot see from a top down perspective

#

Or has not seen

#

@tiny junco The term you are looking for is visibility fade

#

Maybe if you do a custom sandbox there might be a setting for visibility fade to be adjusted

grizzled grove
# tiny junco to see in 360

oh, for a moment i thought you meant in 3d terms, now i gotcha.

  • late edit, sorry i don't know of such a mod.
tiny junco
#

lol sorry for my english ๐Ÿ˜…

unique roost
#

yall good

somber mirage
#

Really quick, in a TD;LR fashion, is a custom animation (for a weapon specifically) difficult to rig?

grizzled grove
somber mirage
unique roost
#

Check pins?

grizzled grove
somber mirage
#

Cheers for that info, might surf around more for some sort of guide, or might see if I can contact iBrRus and their devs for true actions if nothing exists

valid totem
#

Is there a decent "All in one" belt mod?

Specifically, I'd like to attach sensible items to belts. Radio, Medkit, etc

EDIT: Didn't realize this was a channel for making mods, my bad. I'll leave this here though, main chat gets clogged too fast

tiny junco
weary matrix
glass rampart
#

can backpacks have condition property? i mean can they be dmged and destroyed as usual clothes?

opal wind
glass rampart
#

yeah i also tried that my self and i was unable to do so, hoped maybe some one managed to

bitter frigate
#

what am i doing wrong during item creation to cause THIS to display instead of the appropriate category?

arctic vector
bitter frigate
#

right right. this is the txt file.

    DisplayCategory              = FirstAid
    Weight                = 0.05,
    Type                = Normal,
    DisplayName            = Used Syringe,
    Icon                = UsedSyringe,
    }```
#

ah fuck is it because of the comma. let me see

#

that is embarrassing for ME goddamn it was in fact the comma causing this particular issue

rain pumice
#

Any method to modify player's speed

#

getPlayer():setMoveSpeed( 999 )
I found this but it only seems to affect the "walk to" speed

pearl prism
#

U need to config a file in

#

media\lua\Client\Vehicles\ISUI

#

...MechanicsOverlay.lua

#

@arctic vector

arctic vector
pearl prism
#

Good luck, this file is a nightmare

#

xD

undone crag
pearl prism
#

cool

#

Now just release

rain pumice
#

Nothing exists to modify speed rn

abstract raptor
opal wind
# rain pumice Nothing exists to modify speed rn

item Wiz_SupermanBoot
{
DisplayCategory = Clothing,
Type = Clothing,
DisplayName = Superman Boots,
ClothingItem = Wiz_SupermanBoot,
BodyLocation = Shoes,
BloodLocation = Shoes;LowerLegs,
Icon = Wiz_SupermanBoot,
StompPower = 2,
ConditionLowerChanceOneIn = 10,
ConditionMax = 200,
RunSpeedModifier = 1, <----------------- there is, i set this to 1.5 on another item and made the char move fast
RemoveOnBroken = false,
ScratchDefense = 70,
BiteDefense = 50,
Insulation = 0.5,
WindResistance = 1.0,
WaterResistance = 1.0,
WorldStaticModel = Boots_Ground,
}

rain pumice
#

Thank you so much

opal wind
#

lol

#

np

rain pumice
#

I was struggling so hard

opal wind
#

i found that by acident the other day lol

cedar salmon
abstract gust
#

ok idk if this is the place to ask but how do i change the cursor

drifting ore
#

For the ISA mod

#

how do I connect my house to the solar panel ?

opal wind
snow path
#

So have been doing trial and error as to which folder the preview.png should be under, only to result in errors in items when I try to load them ingame. Anyone know which folder it should be under?

cold burrow
#

There is a ModTemplate in C:\Users\Username\Zomboid\Workshop that could help with structure.

drifting ore
#

Yo for someone who got cheat menu

#

Could you delete trees with the Terraform tool

#

to build a pathway from your secluded safe zone

#

to the main road ?

cold burrow
#

I'm doing something wrong and idk what. Already check everything a few times but still no luck.
I add my custom weapon (i just copypaste M16 stats/flags/etc) in scrips and spawn it. Display name is different, so, it's totally mine weapon.
My main problem is game still decide to show me M16 model, instead of mine, even i add my own.
.../media/scripts/Test_models.txt

module Base
{
  model VSStest /* Item name is the same, Base item VSStest
  {
    mesh = weapons/firearm/VSStest,
    texture = weapons/firearm/VSStest,
  }
}

VSStest.x file in ...\media\models_x\weapons\firearm
VSStest.png file in ...\media\textures\weapons\firearm

Missing 3D items don't have anything related to my model.
Console is empty too.

What i'm doing wrong?

verbal ivy
#

Dying light 2 is gonna come out, looking forward to get some mod idea from that game

drifting ore
#

what about female voices

fair frost
faint jewel
#

YELLO

paper tartan
#

clothing modders, can we get some boots remodeled pls lmao

drifting stump
#

If you know someone willing to contribute message azakaela

drifting ore
#

oh boi

#

this is gonna be noice

hardy pollen
#

did you found it out?

drifting stump
#

@drifting ore also itll possibly support addons ๐Ÿ˜‰

drifting ore
#

soon TM

#

this game is heading to the darkside now

hardy pollen
drifting ore
#

this is bad

craggy furnace
hardy pollen
#

yup author of third person mod

craggy furnace
#

ah, nice work

#

ive been modding it on and off

hardy pollen
#

me to

rain pumice
crisp plover
#

Hey, I'm currently working on the IS300 for the game and I need some opinions about size of the model. Is it too small or I can leave it as it is?

lavish pine
#

hey, how can I perform a delayed function? For example, after 1-2 game days after the player used the item, then nausea was superimposed on it, for example?

drifting ore
#

im trying to remove tables

#

is this correct?

#
table.remove(AttachedWeaponDefinitions["PoliceHandGun"].weapons,1); ```
#

trying to remove these ```AttachedWeaponDefinitions.LongGunOnBack = {
id = "LongGunOnBack",
chance = 30,
outfit = {"SharkBlueSWAT","SharkBlueSWATBelt","SharkGreenSWAT","SharkGreenSWATBelt","SharkGreenSWATRiot","SharkGreenSWATGasMask,","SharkGreenSWATBelt","SharkBlueSWATWebbing","SharkBlueSWATRiot","SharkBlueSWATGasMask"},
weaponLocation = {"Rifle On Back"},
bloodLocations = nil,
addHoles = false,
daySurvived = 0,
weapons = {
"Base.AssaultRifle",
"Base.AssaultRifle2",
"Base.Shotgun",
},
}

AttachedWeaponDefinitions.PoliceHandGun = {
id = "PoliceHandGun",
chance = 30,
outfit = {"SharkBlueSWAT","SharkBlueSWATBelt","SharkGreenSWAT","SharkGreenSWATBelt","SharkGreenSWATRiot","SharkGreenSWATGasMask,","SharkGreenSWATBelt","SharkBlueSWATWebbing","SharkBlueSWATRiot","SharkBlueSWATGasMask"},
weaponLocation = {"Holster Left", "Holster Right"},
bloodLocations = nil,
addHoles = false,
daySurvived = 0,
ensureItem = "Base.HolsterSimple",
weapons = {
"Base.Pistol",
"Base.Pistol2",
},
} ```

#

seems to be throwing errors

#

ERROR: General     , 1643895146061> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index of non-table at KahluaUtil.fail line:82.
ERROR: General     , 1643895146061> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index of non-table
    at se.krka.kahlua.vm.KahluaUtil.fail(KahluaUtil.java:82)
    at se.krka.kahlua.vm.KahluaUtil.luaAssert(KahluaUtil.java:70)
    at se.krka.kahlua.vm.KahluaThread.tableSet(KahluaThread.java:1726)
    at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:594)
    at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1782)
    at se.krka.kahlua.integration.LuaCaller.pcall(LuaCaller.java:76)
    at se.krka.kahlua.integration.LuaCaller.protectedCall(LuaCaller.java:117)
    at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:550)
    at zombie.Lua.LuaManager.RunLua(LuaManager.java:496)
    at zombie.Lua.LuaManager.RunLua(LuaManager.java:482)
    at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:329)
    at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:256)
    at zombie.gameStates.GameLoadingState.enter(GameLoadingState.java:89)
    at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:145)
    at zombie.GameWindow.logic(GameWindow.java:289)
    at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    at zombie.GameWindow.frameStep(GameWindow.java:745)
    at zombie.GameWindow.run_ez(GameWindow.java:661)
    at zombie.GameWindow.mainThread(GameWindow.java:475)
    at java.base/java.lang.Thread.run(Unknown Source)
LOG  : General     , 1643895146062> -----------------------------------------
STACK TRACE
-----------------------------------------
function: Duck_SharkRemovals_LE.lua -- file: Duck_SharkRemovals_LE.lua line # 4

Feb 03, 2022 9:32:26 PM zombie.Lua.LuaManager RunLuaInternal
SEVERE:  java.lang.RuntimeException
Feb 03, 2022 9:32:26 PM zombie.Lua.LuaManager RunLuaInternal
SEVERE: java.lang.RuntimeException: 
Feb 03, 2022 9:32:26 PM zombie.Lua.LuaManager RunLuaInternal
SEVERE: at Duck_SharkRemovals_LE.lua:4

LOG  : Lua         , 1643895146068> Loading: C:/Users/Ray/Zomboid/mods/Duck's Shark and Brita Compatibility LE patch/media/lua/server/Definitions/Duck_Shark_AddingWeapons_LE.lua
LOG  : General     , 1643895146068> -------------------------------------------------------------
attempted index: weapons of non-table: null``` Error im getting
#

200 hours of work put into this room, all lootable and wearable

lavish pine
#

how can I add a custom variable to the player, for example, a counter of something

faint jewel
#

post-its, a sharpie, and a nailgun.

drifting ore
#

soooo

#

can anyone help meh?

sour island
drifting ore
#

hey chuck!

#

can i get some aid

torpid briar
drifting ore
#

did i type the lua wrong?

pallid elm
#

Yes

drifting ore
#

what should it be then

pallid elm
#

I'm joking lmao just replied yes for no reason

drifting ore
#

very funny

pallid elm
#

Thanks๐Ÿป

sour island
#

I can't really read through code on my phone.

drifting ore
#

ah

sour island
#

But the error means what ever xyz.weapons is the xyz is not there

drifting ore
#

it is though

#

the source code is there

torpid briar
#

is someone making a BMW mod currently, doesn't matter if it's E30 or E36 or E46 they're pretty cool especially 90s bmws

drifting ore
#
AttachedWeaponDefinitions.PoliceHandGun.weapons = {};

#

changed code to this

#

since theres 2 entries

#

still didnt work

sour island
#

Are you confirming the load order in someway?

crisp plover
#

tbh if i finish this one i can try to make E30, E46 or E60

sour island
#

My guess would be you're trying to remove it before it's there

drifting ore
#

yep

sour island
#

Is that a yep as agreeing or yep as in you are confirming load order

torpid briar
#

probably would be too modern

#

E46 is more close to 90ish style but it's 97'

crisp plover
#

Yeah it won't fit the game theme but there are a lot of mods with newer cars. E46 is from the same era as IS300

torpid briar
#

E36 perfectly fits BTW its 90s

crisp plover
#

But I would probably prefer older models, E30/E34/E36/E38

drifting ore
torpid briar
#

It's a 7 series

#

too luxury

drifting ore
#

doesnt work for some reason

#

ugh

torpid briar
#

E36 is 3 series and E34 is 5 series

#

3 series is the most cheapest BMW so I'd say go w E36

drifting ore
#

if anyone figures it out

#

send me a ping

#

its giving me a headache

crisp plover
#

compact is out of the question because I'm not the fan of the look ๐Ÿ˜„

torpid briar
crisp plover
torpid briar
#

maybe u can do an M version of the BMW too

#

more powerful engine and torque

#

ofc w diff bumper and such

crisp plover
#

I'm not really figured out yet how to properly set physics

#

Because when i'm using realistic parameters car is too slow and doesn't shift properly

#

All of the cars in the game seem to have too low weight and way to much power compared to real life

#

And I want it's performance to fit the vanilla game

sour island
#

Would be something like

print("--x:"..tostring(x))
#

If it's coming out as --x:nil it's not there

gaunt meteor
#

can anyone help me with a custom spawn point. when i spawn there are no zombies in the hospital. how do i make it so that i start with heaps of hospital zombies? ๐Ÿ˜…

sour island
#

And by confirming load order I mean adding in requires or placing the file in a deeper directory.

sour island
gaunt meteor
#

i see some youtube videos though of custom maps where theres lots of themed zombies for e.g. in prison or hospital. i could try to make a hospital mod but not really sure how zombie spawns are handled o.o

sour island
#

That's a different topic if I understood your first question

#

Vanilla spawning is meant to clear out the building you're spawning in if it's being loaded into for the first time.

gaunt meteor
#

ah....

sour island
#

It's a sort of issue if you spawn in a multi story building that would take some defines by the devs to fix.

#

So adding in outfits and zones for those outfits wouldn't solve spawning in an empty hospital unless you just force spawn them in after the fact

#

I wonder what that does to distribution though -- like are all those zombies (atleast count wise) shifted outside?

drifting ore
#

because my previous mod didnt require it

#


AttachedWeaponDefinitions.LongGunOnBack.weapons = {};
AttachedWeaponDefinitions.PoliceHandGun.weapons = {};```
#

it does have a require function

#

but not particularly for the mod

sour island
#

You would just type require "file path" Where file path is after the client/shared/server

#

Wait are those lines in your mod or the original?

drifting ore
#

my mod is in server so it should be fine right?

#

in my mod

#

the original is this

#

-- For Specific Outfits --

-- assault rifle on back
AttachedWeaponDefinitions.LongGunOnBack = {
    id = "LongGunOnBack",
    chance = 30,
    outfit = {"SharkBlueSWAT","SharkBlueSWATBelt","SharkGreenSWAT","SharkGreenSWATBelt","SharkGreenSWATRiot","SharkGreenSWATGasMask,","SharkGreenSWATBelt","SharkBlueSWATWebbing","SharkBlueSWATRiot","SharkBlueSWATGasMask"},
    weaponLocation =  {"Rifle On Back"},
    bloodLocations = nil,
    addHoles = false,
    daySurvived = 0,
    weapons = {
        "Base.AssaultRifle",
        "Base.AssaultRifle2",
        "Base.Shotgun",
    },
}

AttachedWeaponDefinitions.PoliceHandGun = {
    id = "PoliceHandGun",
    chance = 30,
    outfit = {"SharkBlueSWAT","SharkBlueSWATBelt","SharkGreenSWAT","SharkGreenSWATBelt","SharkGreenSWATRiot","SharkGreenSWATGasMask,","SharkGreenSWATBelt","SharkBlueSWATWebbing","SharkBlueSWATRiot","SharkBlueSWATGasMask"},
    weaponLocation = {"Holster Left", "Holster Right"},
    bloodLocations = nil,
    addHoles = false,
    daySurvived = 0,
    ensureItem = "Base.HolsterSimple",
    weapons = {
    "Base.Pistol",
    "Base.Pistol2",
    },```
sour island
#

Why are you looking for the tables contents if you're wiping them?

#

X = {} defines the table as empty

drifting ore
#

i just want to remove the weapons

#

yes

#

i want to add new weapons into them

#

-- Brita's weapons on shark's zombs -- 
table.insert(AttachedWeaponDefinitions["LongGunOnBack"].weapons,"Base.M870_Police"); 
table.insert(AttachedWeaponDefinitions["LongGunOnBack"].weapons,"Base.Shotgun"); 
table.insert(AttachedWeaponDefinitions["LongGunOnBack"].weapons,"Base.M870_CQB"); 
table.insert(AttachedWeaponDefinitions["LongGunOnBack"].weapons,"Base.M1Carbine"); 
table.insert(AttachedWeaponDefinitions["LongGunOnBack"].weapons,"Base.M2Carbine"); 
table.insert(AttachedWeaponDefinitions["LongGunOnBack"].weapons,"Base.MINI14"); 
table.insert(AttachedWeaponDefinitions["LongGunOnBack"].weapons,"Base.M16Tape"); 
table.insert(AttachedWeaponDefinitions["LongGunOnBack"].weapons,"Base.ColtM16" ); 

-- Brita's Pistols on Shark's Zombs --

table.insert(AttachedWeaponDefinitions["PoliceHandGun"].weapons,"Base.M9"); 
table.insert(AttachedWeaponDefinitions["PoliceHandGun"].weapons,"Base.M9A3"); 
table.insert(AttachedWeaponDefinitions["PoliceHandGun"].weapons,"Base.B93R"); 
table.insert(AttachedWeaponDefinitions["PoliceHandGun"].weapons,"Base.P226"); 
table.insert(AttachedWeaponDefinitions["PoliceHandGun"].weapons,"Base.AMT1911"); 
table.insert(AttachedWeaponDefinitions["PoliceHandGun"].weapons,"Base.Colt1911"); 
table.insert(AttachedWeaponDefinitions["PoliceHandGun"].weapons,"Base.Colt_Commander"); ```
#

so icant just delete the weapons table

sour island
#

Misread the inclusion of .weapons

drifting ore
#

no im only wiping weapons

tribal marsh
#

Is there something in the game already that stores the player name? I'd like to have something on create attach the player's name automatically - not a necessity but seems like a nice touch.

sour island
#

You have to require the mod's file still

drifting ore
#

how do i do that

#

teach me sensei

sour island
#

And require only works in the same client/server or also shared

lavish pine
sour island
#

If the original file is in server also

#

You just need require "filename"

drifting ore
#

yea original file is server also

#

just checked

sour island
#

Including any folders AFTER server

#

I assume it's inside of a definitions folder

drifting ore
#

yes

sour island
#

So something like require "definitions/filename" no .lua

#

This will ensure your file is loaded after the original mod's

drifting ore
#

wait so like this?

sour island
#

My assumption is your mod is getting loaded before

drifting ore
#

require "Shark's Law Enforcement Overhaul\media\lua\server\Definitions"

sour island
#

No

drifting ore
#

no wait

#

im derping

sour island
#

After server/

#

Use /

drifting ore
#

aahhh

#

so like this

#

require "server/Definitions/SLEO_AttachedWeaponDefinitions"

sour island
#

After server/

drifting ore
#

i dont need to insert a .lue right?

sour island
#

Start at "Definitions

torn cypress
#

would there be anyone willing to help making mods and such for a Project?

drifting ore
#

require "Definitions/SLEO_AttachedWeaponDefinitions"

#

oh

#

lets see if this works

sour island
#

Stop making me type special symbols on my phone ๐Ÿ˜ฉ

drifting ore
#

ooof

sour island
#

But yes that's correct

#

It's always good practice to put your file in the same location on your side of things but technically as long as it's in server or shared this will work

#

If it does not then there's a section missing from your table's path

drifting ore
#

nope

#

same error

#
ERROR: General     , 1643900395950> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: weapons of non-table: null
    at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
    at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492)
    at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1782)
    at se.krka.kahlua.integration.LuaCaller.pcall(LuaCaller.java:76)
    at se.krka.kahlua.integration.LuaCaller.protectedCall(LuaCaller.java:117)
    at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:550)
    at zombie.Lua.LuaManager.RunLua(LuaManager.java:496)
    at zombie.Lua.LuaManager.RunLua(LuaManager.java:482)
    at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:329)
    at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:256)
    at zombie.gameStates.GameLoadingState.enter(GameLoadingState.java:89)
    at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:145)
    at zombie.GameWindow.logic(GameWindow.java:289)
    at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    at zombie.GameWindow.frameStep(GameWindow.java:745)
    at zombie.GameWindow.run_ez(GameWindow.java:661)
    at zombie.GameWindow.mainThread(GameWindow.java:475)
    at java.base/java.lang.Thread.run(Unknown Source)
LOG  : General     , 1643900395951> -----------------------------------------
STACK TRACE
-----------------------------------------
function: Duck_Shark_AddingWeapons_LE.lua -- file: Duck_Shark_AddingWeapons_LE.lua line # 4

Feb 03, 2022 10:59:55 PM zombie.Lua.LuaManager RunLuaInternal
SEVERE:  java.lang.RuntimeException
Feb 03, 2022 10:59:55 PM zombie.Lua.LuaManager RunLuaInternal
SEVERE: java.lang.RuntimeException: 
Feb 03, 2022 10:59:55 PM zombie.Lua.LuaManager RunLuaInternal
SEVERE: at Duck_Shark_AddingWeapons_LE.lua:4
#

this is line 4

#
AttachedWeaponDefinitions.PoliceHandGun.weapons = {};```
sour island
#

Then there's something wrong with how it's being called

drifting ore
#

is my command wrong?

#

it was working like

#

a few weeks before

sour island
#

Maybe the outfit ID was changed?

drifting ore
#

nope

#

same

sour island
#

When is this being called?

drifting ore
#

during startup

#

when im loading into a game

sour island
#

Can you add some ifs and prints

drifting ore
#

this? print("--x:"..tostring(x))

#

trying to figure out

#

how to word it

#

if [my mod] true

#

then print?

sour island
#

print ("AttachedWeaponDefinitions:"..tostring(AttachedWeaponDefinitions))

print("AttachedWeaponDefinitions.LongGunOnBack:"..tostring(LongGunOnBack))

If AttachedWeaponDefinitions.LongGunOnBack then AttachedWeaponDefinitions.LongGunOnBack.weapons = {} end

if AttachedWeaponDefinitions.PoliceHandGun then AttachedWeaponDefinitions.PoliceHandGun.weapons = {} end
languid nimbus
# hardy pollen did you found it out?

I ended up creating a function that sets a variable when my weapon is equipped, so in the xml file this variable is my condition for the animations

drifting ore
#

did they change how lua loads?

sour island
#

It doesn't load alphabetically for MP

#

Why?

drifting ore
#

nvm

mortal sedge
#

Is it possible to modify the generator to run on a different fuel? Asking because even during the timeline of PZ farmers would run engines on woodgas from pyrolysis.

sour island
#

Generators are pretty javasided

drifting ore
#
ERROR: General     , 1643901158445> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: weapons of non-table: null at KahluaThread.tableget line:1689.
ERROR: General     , 1643901158445> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: weapons of non-table: null
    at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
    at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492)
    at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1782)
    at se.krka.kahlua.integration.LuaCaller.pcall(LuaCaller.java:76)
    at se.krka.kahlua.integration.LuaCaller.protectedCall(LuaCaller.java:117)
    at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:550)
    at zombie.Lua.LuaManager.RunLua(LuaManager.java:496)
    at zombie.Lua.LuaManager.RunLua(LuaManager.java:482)
    at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:329)
    at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:256)
    at zombie.gameStates.GameLoadingState.enter(GameLoadingState.java:89)
    at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:145)
    at zombie.GameWindow.logic(GameWindow.java:289)
    at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    at zombie.GameWindow.frameStep(GameWindow.java:745)
    at zombie.GameWindow.run_ez(GameWindow.java:661)
    at zombie.GameWindow.mainThread(GameWindow.java:475)
    at java.base/java.lang.Thread.run(Unknown Source)
LOG  : General     , 1643901158446> -----------------------------------------
STACK TRACE
-----------------------------------------
function: Duck_Shark_AddingWeapons_LE.lua -- file: Duck_Shark_AddingWeapons_LE.lua line # 4```
sour island
#

Means, you ll have an easier time writing your own power system

drifting ore
#

attempted index: weapons of non-table: null

#

why is the table not there

#

this is driving me nuts

sour island
#

Did you add the prints?

drifting ore
#

yes

#

where do i find the prints

mortal sedge
#

Damn. Thanks @sour island

sour island
#

Cause that error shouldn't be appearing if you added the ifs

#

It gets printed to console.txt

drifting ore
#

wut

sour island
#

Along with the error

drifting ore
#

nope same error

sour island
drifting ore
#

the print did nothing

hardy pollen
sour island
#

It's checking for those tables first

#

The print can't do nothing...

drifting ore
#

im just as confused

sour island
#

Are you subbed to your own mod?

drifting ore
#

nope

#

i double checked that

sour island
#

And your whole mod is just those 4-6 lines

drifting ore
#

yeppp

languid nimbus
# hardy pollen Can you give me a example? Or is your mod online so i can have a look

I was creating a slingshot, this was the .xml

<animNode x_extends="aim_default.xml">
    <m_Name>aim_slingshot</m_Name>
    <m_AnimName>Bob_IdleAim_Slingshot</m_AnimName>
    <m_Conditions>
        <m_Name>Weapon</m_Name>
        <m_Type>STRING</m_Type>
        <m_StringValue>Slingshot</m_StringValue>
    </m_Conditions>
    <m_Transitions>
        <m_Target>IdleSlingshot</m_Target>
        <m_AnimName>Bob_AimToIdle_Slingshot</m_AnimName>
    </m_Transitions>
    <m_Transitions>
        <m_Target>sneakidleHandgun</m_Target>
        <m_AnimName>Bob_AimToIdle_Slingshot</m_AnimName>
    </m_Transitions>
    <m_Transitions>
        <m_Target>sneakIdleLowHandgun</m_Target>
        <m_AnimName>Bob_AimToIdle_Slingshot</m_AnimName>
    </m_Transitions>
</animNode>```

And the lua function that changes the weapon variable
```local function OnEquipPrimary(character, inventoryItem)
    if inventoryItem ~= nil then 
        if inventoryItem:getFullType() == "Base.Slingshot" then
            character:SetVariable("Weapon", "Slingshot");
        end
    end
end

Events.OnEquipPrimary.Add(OnEquipPrimary)
hardy pollen
languid nimbus
#

No problem.
If the player already start with the weapon, it won't trigger the setVariable, so you need the same logic on a OnGameStart event

local function OnGameStart()
    local player = getSpecificPlayer(0);

    if player:getPrimaryHandItem() ~= nil then 
        if player:getPrimaryHandItem():getFullType() == "Base.Slingshot" then
            player:SetVariable("Weapon", "Slingshot");
        end

    end
end
Events.OnGameStart.Add(OnGameStart)
merry osprey
#

Anyone know of a way to disable the use of sledges in peoples safehouses? Or if there is a way to let people join multiple safehouses but only claim one? I want to turn trespassing safehouses on but the players on my server don't want to deal with potential tolls.

bitter frigate
drifting ore
#

lots more rooms to do like this trying to make a dlc-esq dead rising-esq map

bitter frigate
#

oh WOW you're going for it

#

that's really awesome i'm excited to see it as you continue working on it!!!

cold burrow
tribal marsh
#

How would I go by creating a "Stat" such as anger or boredom? If there's an example (mod someone else created or documentation) can anyone link me to that?

bitter frigate
#

lemme grab recs

bitter frigate
# tribal marsh How would I go by creating a "Stat" such as anger or boredom? If there's an exa...

"waste management" mods that create the need to defecate and urinate - this is where i started, because they both create new "needs" to manage.
https://steamcommunity.com/sharedfiles/filedetails/?id=2708312917
https://steamcommunity.com/sharedfiles/filedetails/?id=1436878551

danger moodles - creates a new stat to manage called "sanity" if i'm not mistaken???
~~https://steamcommunity.com/sharedfiles/filedetails/?id=2676526057~~

tribal marsh
#

Oooh thanks for the info!

drifting stump
#

i recall seeing references to that when decompiling

#

didnt look into that tho was doig other stuff

bitter frigate
drifting stump
#

thirst is further down

#

those are basically all the stats in the game atm

drifting ore
#

Oh my god

#

Repeat stats

drifting stump
#

let me make a decent post might be nice for the wiki

drifting ore
#

And improper camelcasing

drifting stump
#

you havent seen everything

bitter frigate
#

if anybody was curious i missed another comma and borked my whole code again orz

drifting ore
#

Bruh what

#

Why

#

Its not even like

#

A weird quirk where you HAVE to do that

drifting stump
#

ima just say the options screen is something else

drifting ore
#

Thats disgusting

#

Like

#

I dont even get why it would ever be like that to begin with

drifting stump
#

copy and paste is not always friendly

drifting ore
#

Clearly

drifting stump
#
Character Stats

float Anger
float boredom
float endurance
boolean enduranceRecharging
float endurancelast
float endurancedanger
float endurancewarn
float fatigue
float fitness
float hunger
float idleboredom
float morale
float stress
float Fear
float Panic
float Sanity
float Sickness
float Boredom
float Pain
float Drunkenness
int NumVisibleZombies
int LastNumVisibleZombies
boolean Tripping
float TrippingRotAngle
float thirst
int NumChasingZombies
int LastVeryCloseZombies
int NumCloseZombies
int LastNumChasingZombies
float stressFromCigarettes
float ChasingZombiesDanger
int MusicZombiesVisible
int MusicZombiesTargeting
tribal marsh
#

I'm having a hell of a time deciphering where to define a stat using "Defecate" as an example

bitter frigate
tribal marsh
#

All I really need is to attach a new variable to the player and store a double lol

#

potentially in zombie.characters.Stats

drifting stump
#

but you dont

tribal marsh
#

then I'll have to figure out how to get it to show in the Info tab of the character panel

drifting stump
#

you cant edit the java classes

#

you can however make use of them

#

modData is likely what youre looking for

tribal marsh
#

Okay, if modData can help me here, does it persist through logout? Is it stored clientside or server side?

#

Sorry, i'm a bit unfamiliar with how PZ does things

drifting stump
#

you will have to add a way of storing the value for when a player reconnects

bitter frigate
drifting stump
#

can also use global mod data

bitter frigate
#

does anyone know where I can find OnEat_Cigarettes in the game's lua? i'm trying to use OnEat but it's not working and i think it probably has a lot to do with the fact that i have no idea how the function actually works

bitter frigate
drifting stump
#

i would finish the other parts of the mod first and then worry about syncing with the server

bitter frigate
drifting stump
#

i dont see anything like OnEat_Cigarettes

#

what are you trying to do

bitter frigate
#
    {
        DisplayCategory = Junk,
        Count    =    20,
        HungerChange    =    0,
        Weight    =    0.005,
        RequireInHandOrInventory    =    Lighter/Matches,
        Type    =    Food,
        DisplayName    =    Cigarettes,
        StressChange    =    -5,
        Icon    =    IckySticks,
        CustomContextMenu = Smoke,
        CantBeFrozen = TRUE,
        OnEat = OnEat_Cigarettes,
        StaticModel = Cigarette,
        EatType = Cigarettes,
        WorldStaticModel = CigarettePack_Ground,
        CustomEatSound = ,
    }
``` this is in items.txt
drifting stump
#

ah that explains

bitter frigate
#

i'm trying to use OnEat to lower SugarValue

drifting stump
#

that is server side code

#

located in lua\server\recipecode.lua

bitter frigate
#

thank you so much. i was looking for it in client, haha

drifting stump
#

what editor are you using?

bitter frigate
tribal marsh
#

I just thought of this... I cant use the players name to create the modData since multiple players can have the same name, I cant use the account name since I want this value to follow the character. do players have a GUID or something similar I can tap into?

#

or should I say "Actors" since this i guess would include zombies

bitter frigate
tribal marsh
#

Hmm, I think I can ignore zombies and generate a random value dynamically

drifting stump
#

eh imo notepad++ is outdated