#mod_development

1 messages ยท Page 86 of 1

pulsar heath
#

in the game

#

that i can do

#

and spawn vehicles

#

and parts

dark wedge
#

Doesn't look like it. However, what you could do is use:
self.character:setForceRun(true)
If that trigger is pressed. can set this in the update function of your TimedAction, set it to false when its not

pulsar heath
#

but making a tire blow? nop

#

i can even change the damn car color...

#

blow a tire? nop

#

๐Ÿ˜„

dark wedge
#

You are correct, it seems that the main joypad stuff is in the Java. But, I think just checking if the trigger is pressed, and setting that setForceRun on the player to true/false should work. If i just set it now to always true in ISWalkToTimedAction:update() my character definitely always runs when doing the walk action.

#

Sprinting may not be a thing, as that requires the "B" button which will cancel the TimedAction. lol

thick karma
#

I just tried to add it explicitly to the update function, which I had not tried.

#

I had already tried it manually 1000 times

#

But just to be sure, I threw it in update, and THEN threw it OnTick (I tried both ways separately)

#

Nada

#

when I am in Joypad mode, setForceRun is ignored.

thick karma
#

But none of that matters because I can't trigger jog or sprint during MoveTo on gamepad ๐Ÿ˜ญ

ancient grail
#

Ok thnx

thick karma
#

@dark wedge Just tried this:

function AutomoveAction:update()

    print("trying so hard")
        
    self.player:setAllowRun(true)
    self.player:setAllowSprint(true)
    self.player:setPathfindRunning(true)
    self.player:setForceRun(true)
    self.player:setForceSprint(true)
    . . . . .
end

Universe still hates me. No dice.

dark wedge
thick karma
small topaz
#

Does anyone knows how the "PoisonDetectionLevel" exactly works? This is an attribute of poisonous food items and can be accessed or manipulated via getPoisonDetectionLevel() resp. setPoisonDetectionLevel(). It has smth to do with your character being able to see whether a food item is poisonous but I am curious about how exactly it works.

thick karma
#

Indie Stone whyyyyyyyy

dark wedge
thick karma
#

I just want to give the people autorun

#

Please just let me give the people autorun!

#

sigh

#

It just feels literally right there. Code has 99% of the major problems solved and yet this one limitation is huge and super lame.

#

I mean not being able to move faster when trying to automove across big distances is a major downside for gamepad players using this. ๐Ÿ˜ฆ

#

I am inclined to find a way to disconnect and reconnect gamepad silently and see if THAT works.

#

And oof if I figure it out and it doesn't

devout flint
#

Any good tutorial/ressource for modding PZ for placable/craftable stuff?

drifting ore
#

i should be able to set room defs via tile selection using this right?

        if square:getRoom() then
            local roomDef = square:getRoom():getRoomDef()
            self:addLine("buildingID = %d", square:getBuilding():getID())
            self:addLine("roomID = %d", square:getRoomID())
            self:addLine("roomDef.name = %s", roomDef:getName())
            self:addLine("bExplored = %s", roomDef:isExplored())
            self:addLine("alarm = %s", square:getBuilding():getDef():isAlarmed())
            local switches = square:getRoom():getLightSwitches()
            local switchCount = switches:size()
            self:addLine("#switches = %d", switchCount)
        else
            local roomDef = getWorld():getMetaGrid():getRoomAt(square:getX(), square:getY(), square:getZ())
            if roomDef then
                self:addLine("roomDef.ID = %d", roomDef:getID())
                self:addLine("roomDef.name = %s", roomDef:getName())
            else
                self:addLine("roomID = %d  room = nil", square:getRoomID())
            end
        end
small topaz
drifting ore
#

the bottom half really

ancient grail
#

Will this return error if the table doesnt have what you are removing?

devout flint
#

I'm planning to make some kind of garden lamp ๐Ÿ‘€

drifting ore
#

you will see very quickly it's pretty straightforward if you setup how vanilla is and then make your specific edits based on your preferences from there

#

commander has a cheat sheet for how to use the tile properties editor

#

in mapping pins

devout flint
#

I mean, deeper than that, the plan is to make the lamp continuously light the place even after power shutdown with an autonomous "solar battery"

devout flint
drifting ore
#

properties

#

yes

devout flint
#

I thought tilezed was only the visual part

thick karma
#

Oof

devout flint
#

okay thanks

drifting ore
#

nope

sour island
#

I wrote a player activity heatmap

devout flint
drifting ore
#

tilzed has a properties editor that changes the entire functionality of a tile

thick karma
#

@dark wedge And that's the story of how Auto Move became Auto Stroll.

thick karma
sour island
#

Going to be working it into EHE - rather than using map zones for targetting

cosmic condor
sour island
#

I wonder if I can do a map of activity ala google

sour island
#

Currently trying to get the data to a point that's useful

#

also the cellsIDs should be sorting by hottest

#

seems to be working

#

you can just pop in tracking points with your own decided value of intensity

#

the centerX/Y of the cells is based on averaging the incoming noise factored to the intensity

#

a tiny new noise will pull the center of the cell over a bit

cosmic condor
#

new technology acquired

#

hope it's working well in mp

sour island
#

that'll be the tricky part

#

right now the trackers are tied to events -- I imagine I'd need to make them fire commands for MP

#

sending the data to the server to keep track

drifting ore
#

if heat >= 0.1 sendAllTheZombiesThere

#

make it rain

#

if that mod does that I think it does

#

๐Ÿ˜„

sour island
#

it's just tracking where events are occuring

#

can be used for a horde mod tho

#

eventually the plan - so I'm trying to keep the design open ended

drifting ore
#

yeee that's what 7 days to die does I think with zombies, whenever someone does something in a chunk ig the heat map updates, and sends like screamers (they attract hordes by screaming) and more and more

#

that's super cool btw

#

what you did

#

the people here get up to such cool shit it's really inspiring

small topaz
ancient grail
#

Events.OnGameStart.Add(function() 
    if not isClient() then
        function clearDistrib(module, type)
            RemoveItemFromDistribution(Distributions[1], tostring(module..'.'..type) , nil, true);
            RemoveItemFromDistribution(SuburbsDistributions, tostring(module..'.'..type), nil, true);
            RemoveItemFromDistribution(VehicleDistributions, tostring(module..'.'..type), nil, true);
            RemoveItemFromDistribution(ProceduralDistributions.list, tostring(module..'.'..type), nil, true)
        end
        clearDistrib('Base', 'Apple')
        clearDistrib('Base', 'Orange')
        clearDistrib('MOD1', 'GreatestSwordEver')
    end
end)
#

@vast nacelle

#

will work?

pulsar heath
#

mod

#

i think there is a wandering mod already dunno

sour island
#

there were, from what I understand they're broken

pulsar heath
#

well thanks to @drifting ore , got the tire event sorted... if setting the condition to 0 and the pressure to 0 doesnt blow the tire... just remove the damn wheel ๐Ÿ˜„

drifting ore
#

modern problems require modern solutions

#

btw is it normal that I start making 1 mod then think of a better one and loop until I reach the pinnacle, which is what I'm doing rn lmfao

#

until probably tomorrow when ill think of something even better to do ๐Ÿคฃ

sour island
pulsar heath
sour island
#

The helicopters in EHE right now just use player's zones to create a weighted target list

pulsar heath
#

more like making remixes... and i end up with a lot of unfinished projects... tbh every 100 i start i usually finish around 8 or 9

drifting ore
#

shit is exhausting tbf but it's so damn fun every day I think to myself god damn I wish the day had more hours

pulsar heath
#

well... got 2 things done today... so dinner time ๐Ÿ˜„

drifting ore
#

my dinners gonna be 2-3 cigarettes then continuing on this ๐Ÿ˜‚

#

bon apetit btw!

#

Anyone know why I am getting the error "failed to update workshop item, result=9" while uploading my mod ?

#

oh man that happened to me a lot I think, that or 6

#

I think it's because some of the folders / files are not in proper order

#

yea it's file issue one way or another

#

Hmm

#

I mean l did check it again

#

The only thing new is a .lua file l put in lua/server

#

My mistake was I put the mod in the C:/Zomboid/Workshop folder and not in the C:/Users/User/Zomboid/Workshop one

#

if that helps :/

#

Imma check that out but l dont really understand

#

There's 2 zomboid folders afaik

#

One is in the main location like, when you enter your C drive, just at the bottom right there

#

you will figure out where you went wrong

drifting ore
#

and the other one you have to go into users, yourusername, zomboid, workshop

#

that fucked with me for so long

#

Im on linux so no C: , so gotta dig

#

oh yea and error 9 means file not found btw on workshop

#

so expected folder or file name is wrong

#

I wonder why there's 2 of those folders and they look exactly the same inside ๐Ÿ˜ฎ

#

reason for extra folder. files where host runs, client runs, server runs, depending on what you have setup

#

aha

#

uses diff files for host and client

#

workshop is client, common/pz/workshop is host i believe

#

I am finding just one folder though

#

thats not your issue then

#

like i said that erro means you r are missing a folder it expects

#

or file

#

so either missing file or bad name

#

zombvoid workshop

#

thats where you are uploading right

#

yes

#

it's the mod itself with issue not your game fodlers

#

its zomboid/workshop/mymod/content/mod itself

#

like in example mod

#

unless that wrong ?

#

workshop/mod/contents/mods/modname/media/whatever else

#

make sure contents

#

and mods

#

not content

#

and mod

#

also in same folder as content you need workshop.txt and preview.png

#

clothing/clothing.xml and lua/server/mymod.lua and lua/shared/NPCs/zombiezonedefintions.lua

#

thats not the issue

cosmic condor
#

Zomboid\Workshop\MODNAME\Contents\mods\SUBMODNAME\media

drifting ore
#

yes this

#

follow that exactly

#

your mod files and folderss are not the issue

#

oh so modname and submodname should be different ?

#

no

#

whats in between matters

cosmic condor
#

workshop.txt

id=
title=MODNAME
description=
tags=Build 41
visibility=public```
#

leave the ID blank if you're creating a new mod

drifting ore
#

very nice lol so much more clear

cosmic condor
drifting ore
#

can see the whole folder thing up top

#

show first removeitems folder

#

screenshot it

#

yea looks good lol

#

you double check and make sure all your folders inside of media are named correctly?

#

done and done

#

though there was an id number in workshop.txt

#

take that out for sure

#

if you use a currently used one that could give error

#

because no permission to upload

#

should I add something to id in modinfo ?

#

riko showed

#

empty

cosmic condor
#

to be more clear it is
Zomboid\Workshop\WORKSHOPNAME\Contents\mods\MODNAME\media

drifting ore
#

oh in modinfo you name id whatever

cosmic condor
#

can be the same

drifting ore
#

ah okay

cosmic condor
#

it doesn't matter

drifting ore
#

removed the id number, going to try again

cosmic condor
#

Steam with assign new ID

drifting ore
#

failed again

cosmic condor
#

lol

drifting ore
#

error=2 this time

#

id=modname in mod info. id= nothing in workshop.txt

#

if new mod

#

you have some identifier in the mod info file tho

cosmic condor
#
id=MODIDNAME
description=Enjoy my mod
poster=preview.png
icon=icon.png```
drifting ore
#

name=removeitems
id=removeitems
description=toremoveitems
poster=poster.png

#

no icon tho

cosmic condor
#

this is my workshop folder

#

and this is my mod folder

drifting ore
#

lol thats not needed even

#

just the two files only

#

workshop.txt and preview.png

cosmic condor
drifting ore
#

lolol alright fair enough

#

it will def work with em haha

#

well I did it as you said and it hit me with the error=2

#

error 2 is the most generic error and means you just did anything wrong lol

cosmic condor
#

here's the thing

drifting ore
#

i just uploaded this mod brand new last night

cosmic condor
#

I use to encounter this error too

#

you may try creating a new folder with different name

#

and it should work

#

I don't know why lol

drifting ore
#

actually thats a better idea

#

gonna try it

#

couldnt take a screenshot

#

even did the workshop.txt again

#

ill screenshot my mod i uploaded last night lol

#

if it's not those then you are misspelling a folder name

#

all you need for mod.info is
name=
id=
description=

#

fill all out no space in id. you had. in workshop.txt you can use same 3 also. keep id blank. now for folder structure

#

in media

#

nothing else i can think of that would give you error besides any of those being named incorrectly lol

#

if non eof this helps then use that guide i posted earlier and rebuild the entire hierarchy from scratch

#

let me share my screen with you

#

np

#

hello

#

test successful. maybe

fast galleon
#

hm, I thought I could make start threads here ๐Ÿ˜ญ

drifting ore
#

nope

#

error=2 again

fast galleon
#

what's best way to get all local players? SP and Client

    for i=0,3 do
        local player = getSpecificPlayer(i)
        if not player then break end
    end

is it this?

ruby urchin
fast galleon
#

thanks, I'll save this for later

small topaz
#

Does anyone knows what poison level a food item must have so that it kills the player char?

drifting ore
#

Its still not working @cosmic condor

#

probably 100 @small topaz since it's max

#

I did double check it again, even remove a whole file that was not necessary anymore

#

nope, result=2

#

but there is this though

#

its on workshop, with no name ๐Ÿ˜„

#

it's corrupt dont mind that

#

just delete

vast nacelle
drifting ore
#

had to delete id several times after uploading as it assigned one but was corrupt

vast nacelle
#

Try this?

title=removeitemsv2
description=TEST
tags=Build 41
visibility=public```
I typically have something like this in place before I tell PZ to upload
drifting ore
vast nacelle
drifting ore
#

109,9 kB

#

same with poster, the same image actually

vast nacelle
#

That should be fine.
Do you have files with the same name but different capitalizations?

drifting ore
ancient grail
devout flint
#

Ok, I'm shutting down now but I began working on my first mod tonight.
Expect to see in the upcoming days, if I succeed at doing what I was planning, a solar garden lamps mod to keep your yard lit at night without the need of a generator in the sector :)

Tiles are done, in a cheap recycling way, might improve them later, but at least I've got some base to work on.
Next will be the properties, craft and other technical stuff :)
I can't wait to see were it will go :D

vast nacelle
small topaz
viral notch
#

what is different between <Model>x:skinned\clothes... and <Model>skinned\clothes.. ?

ancient grail
#

Use debug
Use doparam
@small topaz

viral notch
#

to reload xml, txt and java files i need to restart game or reload lua button will also reload that too?

drifting ore
#

reload lua works if you aren't using the files in question (from main menu)

viral notch
#

no...

ancient grail
#

I tried it before didnt work

viral notch
#

no for restart
for button
for both ?

ancient grail
#

Ye u should just restart

viral notch
#

dam

ancient grail
#

Ik ow its a drag

viral notch
#

that annoying

bronze yoke
#

txt files reload

viral notch
#

every error or test exit ... run game wait 2min to run start any mode wait next 5 min to start gameplay ... test mod in 2min and repeat

bronze yoke
#

i haven't messed with the xml much but i think that reloads too

#

i'd be shocked if java did though

drifting ore
#

me right now

viral notch
drifting ore
#

when you get that midnight burnout and you start looking at every little function much like you did in college when doing an exam and using the calculator for 1+1

drifting ore
#

i give up man, attempt to index table null value something.. I searched this channel in and out

#

all I could find is probably either folder order borked or file order borked... or maybe function order borked

#

but all of it seems fine

#

the files that have my table are in the server folder, the command that asks for them is in the client, the server command that gives them is in the server folder

#

idk

#

attempted index: functionName of non-table: null

#
local theFunctions = require 'itemListAndFunction'
returnValue = theFunctions.functionName(theKey)
golden sparrow
drifting ore
#

ignore the naming scheme, just changed it for easier understanding

#

might've been counterproductive on second thought

ancient grail
#

anyone knows 1 line of code to transfer a specifc item to player inventory or floor

dull moss
#

Yo @undone elbow since I caught you here last time about your mod, maybe you'll be able to fix another one of yours? ๐Ÿ˜„
Windows Everywhere make sandbox options crammed, just like the other mod was, any chance you could take a look at that, it's very convenient mod

fast galleon
dull moss
#

he said 1 line, this is not 1 line, therefore you are banned

fast galleon
#

i line is at top

#

not sure if it can be used for him

#

I mean, I can fit this into 1 line as well

drifting ore
#

I need coffee

#

non-table index null

#

๐Ÿ˜ 

dull moss
#

usually a typo

drifting ore
#

honestly at this point

#

Yeah but the thing is the table has 1209 entries

dull moss
drifting ore
#

guess I better start looking

#

...

fast galleon
jaunty marten
drifting ore
#

I mean

items = {}
items["Item"] = 1

I might be too tired but isn't this the right way to make a table

#

yeah I'm returning the table

#

and using require in the other file as well

#

oh boy...

#

i'm gonna work with the assumption that the require failed

#

since the table seems fine

jaunty marten
#

check itemListAndFunction file in debug menu files list

#

if there's no file then it's problem with it

fast galleon
#

try require from console

#

then try that function from console

#

print everything

stray yacht
#

does anyone know how to get if the game is running in debug mode?

drifting ore
#

my brain is being fucked with because every time I search online how to correctly import functions or tables from another file I get 5 different answers

#

for each stack thread lol

#

So I've tried about 8-10 methods so far

dull moss
#

ask chatgpt

#

chatgpt good stuff

jaunty marten
stray yacht
small topaz
#

In the vanilla lua file server/Farming/farming_vegetableconf.lua, there are some comments stating how long the growth time for a given vegetable is. For example

-- Carrots
-- Need 12 seeds
-- Need 80 water at phase 1, minimum 70 at 2, then between 35 and 65
-- Grow in 17 days (68h per phase)

Does anyone knows whether those descriptions are still up to date? Or possible that the devs changes smth without changing the comments? Point is that the wiki tells smth different for carrots: It says ca. 12 days til harvesting and 50-55h per growth phase.

jaunty marten
dull moss
#

can confirm this works, I use same stuff

drifting ore
#

hopefully it works because ive been sitting here not having a smoke for 2 hours already so my braing is going fuzzy, thank you for the effort B, don't have those letters on my keyboard so cant type full

dull moss
#

Call him Vishnya

drifting ore
#

isn't that cherry

dull moss
#

yes

drifting ore
#

nice, ty

#

hey uh quick question

#

do you enable your mod in the mods or not ?

drifting ore
#

how come it's module.lua they always say online not tu use .lua

#

other than that no error so far but nothing is working either so gonna have to refollow the steps

#

when requiring i mean

jaunty marten
drifting ore
#

because I enabled my mod in the menu and it crashes the game

jaunty marten
#

oh stop, mb I don't get ur question correctly

#

read it so fast

#

yea, it's absolutely different XD

#

I thought u need to get if some mod enabled

#

yea mods from /Workshop folder have to be enabled as usual mods in mods list menu

drifting ore
jaunty marten
#

if u got crash then seems u have smth fatal error in ur mod

#

idk how to get it cos if there's typo error in file then it's just won't load

livid geode
#

How do I set-up a function that will keep a character at 45% Stress as long as a condition isn't met.
I can use Events.EveryTenMinutes, but it is not enough to keep the character at a stable 45% Stress, since stress naturally decreases.
What can I do?

--example
x = 3
if x == 3 then
  --function to keep character at setStress(0.45);
end

Please help ๐Ÿ˜„

high cloak
#

what's the behavior of require in this version of lua? I'm used to being able to return a value at the end of a file, and this is passed to whatever other files require it, but that doesn't seem to work for me. does require just run the script if it hasn't run already?

drifting ore
#
Object tried to call nil

hop in boys, new error in town ๐Ÿ˜Ž

jaunty marten
sour nova
#

Is there a simple way to find out how many items are in a stack? Or should I iterate and count them

drifting ore
#
local returnValue = module.a(args[1])
#

the argument it takes in is the item name

#

the argument gets sent here

jaunty marten
small topaz
jaunty marten
#

and did u have a function there?

drifting ore
#
module.a = function(itemName)
   local returnThis = itemPrices[itemName]
   return(returnThis)
end
jaunty marten
drifting ore
#
local module = require("itemlist")
#

boy, every day I try modding and every day I get stuck on the most dumbass inane shit

#

next time I'm gonna put one folder in the mod called clieservershared and jam every single file in there

livid geode
jaunty marten
small topaz
# livid geode Could I do this? ```lua functionX ...setStress(0.45): end if x = 3 then Eve...

Not sure if this will work (not sure what "x" is and when it is 3) but smth like that will work. You need to make sure that your code starting with "if x == 3 then..." is executed at an appropriate place while game is running. Moreover, this code will execute functionX on every tick during the whole game which might not be the best idea since it may cause performance problems.

jaunty marten
#

print this function at the end of file but before return

small topaz
#

@livid geode do you need to keep the stress level during the whole game or only during certain situations?

jaunty marten
#

and print each function after u did require

#

like for k,v in pairs(module) do print(k) end

livid geode
#

So yeah.. only during some situation

drifting ore
#

been at this one problem since 10-11PM and its now 1:30AM

jaunty marten
small topaz
# livid geode Only during drug overdose regulated by some float..

Ok. Then I would rather use smth like this (note this is only pseudo-code!!!):

function functionX()
-- code for keeping stress level over 45
if Drug_Overdose_Is_Over then
Events.OnTick.Remove(functionX)
end
end

if Durg_Overdose then
Events.OnTick.Add(functionX)
end

drifting ore
#

Just before I go I need to know one thing tho. Why if I put in the server lua file where onclientcommand is, a function, it stops working?

pulsar heath
#

as usual... everytime i clean up my code... something goes wrong... anyway wanna play the game what's the stupid thing that m3ss did?

    local mycar = playerChar:getVehicle()
    local TireSet = { "TireRearRight", "TireRearLeft"," TireFrontRight", "TireFrontLeft"}
    if mycar ~= nil then
        for i = mycar:getPartCount()-1,0,-1 do
            local part = mycar:getPartByIndex(i)
            local cat = part:getCategory()
            local item = part:getId()
            if item ~=  nil then
                if Mypart == "Engine" and item == Mypart then
                    part:setCondition(ZombRand(1,11))
                    break
                end
                if Mypart == "FlatTire" then
                    WhichTire = ZombRand(1,5)
                    VehicleUtils.RemoveTire(TireSet[WhichTire], true)
                    break
                end
                if Mypart == "GasTank" and item == Mypart then
                part:setContainerContentAmount(0)
                --part:setCondition(0)
                end
                if Mypart == "Muffler" and item == Mypart then
                part:setCondition(0)
                end
                if Mypart == "Battery" and item == Mypart then
                part:setCondition(0)
                end
            end
        end
    end
end```
pulsar heath
#

missing a few breaks i know...

drifting ore
#

Like, I have the onclientcommand thing in there and if you even put a small ass function in that file it stops working completely

pulsar heath
#

or to many breaks i dont know anymore... i added the breaks for some reason but i forgot already ๐Ÿ˜„

drifting ore
#

This has legit replaced my cig addiction more or less and idk if thats good or bad

#

In a few years I'll see the outside world matrix style

#

Someone said I think if even one part of the lua file doesn't work it wont load the entire files functions no matter what I wonder if thats it

#

Maybe the table doesnt even get created because of one shit

pulsar heath
#

yeah the code stops bein' read when it hits an error

drifting ore
#

I'll put the entire lua table into another file and test that might help

pulsar heath
#
function TWECars(Mypart)
    local mycar = playerChar:getVehicle()
    local TireSet = { "TireRearRight", "TireRearLeft"," TireFrontRight", "TireFrontLeft"}
    if mycar ~= nil then
        for i = mycar:getPartCount()-1,0,-1 do
            local part = mycar:getPartByIndex(i)
            local cat = part:getCategory()
            local item = part:getId()
            if item ~=  nil then
                if Mypart == "Engine" and item == Mypart then
                    part:setCondition(0)
                end
                if Mypart == "FlatTire" then
                    WhichTire = ZombRand(1,5)
                    VehicleUtils.RemoveTire(TireSet[WhichTire], true)
                end
                if Mypart == "GasTank" and item == Mypart then
                part:setContainerContentAmount(0)
                end
                if Mypart == "Muffler" and item == Mypart then
                part:setCondition(0)
                end
                if Mypart == "Battery" and item == Mypart then
                part:setCondition(0)
                end
            end
        end
    end
end```
jaunty marten
drifting ore
#

Will that show the error

jaunty marten
#

mb

drifting ore
#

Aight

jaunty marten
#

btw u have no any args about ur vehicle

#

from where script have to remove tire

pulsar heath
#

?

jaunty marten
#

there's just a tire class and true

#

have to be like
VehicleUtils.RemoveTire(vehicle, tire, ...)
but u have just
VehicleUtils.RemoveTire(tire, ...)

pulsar heath
#

i know where the mistake is

drifting ore
#

Error in objects.lua line 1 where it says objects { and nothing else

pulsar heath
#

but you are wrong in one thing, but you spotted the error

drifting ore
#

I have no fkin idea

jaunty marten
#

last right button on left upper corner

bronze yoke
#

it will never return 5 in this case

drifting ore
jaunty marten
#

objects.lua is ur file?

drifting ore
#

No

jaunty marten
#

lua of non-table

#

show ur entire code

bronze yoke
#

it just means the error handler doesn't even know what the error is

drifting ore
#

Lmfao

pulsar heath
#
function TWECars(Mypart)
    local mycar = playerChar:getVehicle()
    local TireSet = { "TireRearRight", "TireRearLeft"," TireFrontRight", "TireFrontLeft"}
    local WhichTire = ZombRand(1,5)
    if mycar ~= nil then
        for i = mycar:getPartCount()-1,0,-1 do
            local part = mycar:getPartByIndex(i)
            local cat = part:getCategory()
            local item = part:getId()
            if item ~=  nil then
                if Mypart == "Engine" and item == Mypart then
                    part:setCondition(0)
                end
                if Mypart == "FlatTire" then
                    if item == "TireRearRight" and TireSet[WhichTire] == item then
                        VehicleUtils.RemoveTire(part, true)
                    end
                    end
                end
                if Mypart == "GasTank" and item == Mypart then
                part:setContainerContentAmount(0)
                end
                if Mypart == "Muffler" and item == Mypart then
                part:setCondition(0)
                end
                if Mypart == "Battery" and item == Mypart then
                part:setCondition(0)
                end
            end
        end
    end
end```
drifting ore
#

My entire code of the lua table has 1200 lines

pulsar heath
#

like i said, you were right about where the error was, but not what was causing the error, but thanks

jaunty marten
pulsar heath
#

you help me see what was the stupid thing i was doing...

#

helped*

jaunty marten
#

yep, good for u

drifting ore
jaunty marten
drifting ore
#

Is it line 14?

pulsar heath
#

it appears so

jaunty marten
#

yea

pulsar heath
#

you have a typo

#

something that shouldnt be there

drifting ore
#

Nothing there except for a comment

jaunty marten
#

O_O

drifting ore
#

RIGHT????

jaunty marten
#

it's not a comment

pulsar heath
#

๐Ÿ˜

drifting ore
#

What

jaunty marten
#

--[[ is a comment

pulsar heath
#

comment --[[

jaunty marten
#

[[ is a part of code

pulsar heath
#

or --

bronze yoke
#

[[ means string

drifting ore
#

WHY IS IT the same color then

jaunty marten
#

XD

#

it's color of string

#

comment color is a green

drifting ore
#

I am colorblind....

#

Literally

jaunty marten
drifting ore
#

Fuck me man

#

Cant even code

pulsar heath
#

anything you want the code to ignore --

drifting ore
#

Whats the point in living

pulsar heath
#

the interpreter i mean

jaunty marten
#

it's fine it's fine

#

don't kill him

#

I can hold back

#

I can..

drifting ore
#

Bro... 3 hours on this

jaunty marten
astral dune
#
-- I wonder
--[[ If
Discord
Can tell
]]
the = [[difference]]
pulsar heath
#

i've done a lot of typos worse than that one

drifting ore
#

Is it a diff color or the same????

pulsar heath
#

diff collow

#

collor

#

color...

#

comentend ou is green

drifting ore
#

Bro what

pulsar heath
#

comented out is green

drifting ore
#

And which one is this

pulsar heath
#

string is orange

drifting ore
#

LMFAO alright code

#

Couldve put it fucking blue or something

#

No love for colorblindness

pulsar heath
#

in my case... string is lightGrey

drifting ore
#

You know when ure so mad at urself ure not mad ure just disappointed

pulsar heath
#

yup

#

been there done that... several times today

#

tbh several times in the last 4h ๐Ÿ˜„

drifting ore
#

I must have checked this code 500 times in the last 3 hours and instead I did what I did as a child when I told people I liked coloring my code using /*

pulsar heath
#

like you lost time because of that... i lost time because i was using the part name ( item ) and no the part

drifting ore
#

:/

pulsar heath
# jaunty marten XD

but he spotted that i was doing something wrong with the VehicleUtils.RemoveTire

#

so,... he saw my mistake in 30s

#

i didnt in like 4 hours, welcome to the club ๐Ÿ˜„

drifting ore
#

Yeah, what a club ๐Ÿ˜๐Ÿคฃ

jaunty marten
#

he-he

pulsar heath
#

im even scared of cleaning the traits code... ill prolly mess it up somewhere... so im just gonna chill for a bit

#

and trade raging at myself and my code for raging at rng in hs or something

drifting ore
#

Yeah burnt myself once cleaning the code next time gonna be extra careful

#

Also gonna double check colors fr now on

#

Or at least see if VSC has a colorblind option

pulsar heath
#

you can personalize the colors so that you can see the difference

drifting ore
#

Oof yeah that's gonna help

#

Thanks man

drifting ore
pulsar heath
#

youre using visual studio code right?

drifting ore
#

Ye

pulsar heath
#

i think the themes are compatible between vsc and vs

#

but im not sure

#

you can also download vs community edition, its free

#

but tbh i also use vsc for java, lua, python, etc

jaunty marten
drifting ore
#

how to make sure no underwear spawns on zombies ?

pulsar heath
#

bad joke: give them the nudist trait ๐Ÿ˜„

drifting ore
#

a mod I am using has this -- used to spawn underwear automatically on zeds
UnderwearDefinition = UnderwearDefinition or {};

-- base chance of having a special underwear spawning, don't want this too high as it adds new items on dead zeds everytime!
UnderwearDefinition.baseChance = 0;

-- outfit name

#

but its not working

pulsar heath
#

even if no special underwear appears on zombies

#

even naked, the model has underwear

drifting ore
#

well the mod that has this code is a mod called shadow zombies

#

so they are just pitch black

#

but the underwear messes it up

pulsar heath
#

well this isnt the place to ask for mod support ๐Ÿ™‚

viral notch
pulsar heath
#

you should contact the modder

drifting ore
#

no but I am asking how to make sure it works myself

pulsar heath
drifting ore
#

basically add it to my own mod

viral notch
#

but if someone have same problem with that problem then is correct place right ?

pulsar heath
#

oops

#

if he is making his own mod yup

drifting ore
#

yeah, the mods own underweardefinitions isnt working properly, so I am asking what I should do to make my own

pulsar heath
#

i can't help you with that... its a vague question

#

but if anyone else can, go for it

drifting ore
#

UnderwearDefinition.baseChance = 0;

#

I mean this should do it in theory

#

buuut it doesnt

pulsar heath
#

without more code to see, its still a vague question at least for me

jaunty marten
#

check the code where it uses, mb it's broken by a part and create new mod for urself

livid geode
# small topaz Ok. Then I would rather use smth like this (note this is only pseudo-code!!!): ...
  function PrintOverdoseValue()
      getPlayer():Say("Hello" .. OverdoseValue()); --OverdoseValue() is the same as overdosevalue

      if overdosevalue > 0 then
          Events.EveryTenMinutes.Add(PrintOverdoseValue); --if I run this at the end of the file without condition it works.. but within a condition.. nope
      end--if
  end--function

This did not work.. it just doesn't run the function at all..

Even if someone else but the pinged person knows a solution let me know. I'm trying to activate everytenminutes.add(function) only if a condition is met to avoid lag caused by constant running of 5 functions every 10min emotishrug

drifting ore
#

I posted it thats literally the all of it regarding the underwear definitions

#

-- used to spawn underwear automatically on zeds
UnderwearDefinition = UnderwearDefinition or {};

-- base chance of having a special underwear spawning, don't want this too high as it adds new items on dead zeds everytime!
UnderwearDefinition.baseChance = 0;

-- outfit name

#

the rest are shadow zombiex textures and blood and a zone definition which also did not work but thats fixed on my mod

jaunty marten
#

try to find just baseChance

pulsar heath
#

@drifting ore you are asking for us to guess what UnderwearDefinition is

drifting ore
#

ZombiesZoneDefinition = ZombiesZoneDefinition or {};

-- total chance can be over 100% we don't care as we'll roll on the totalChance and not a 100 (unlike the specific outfits on top of this)
ZombiesZoneDefinition.Default = {};

table.insert(ZombiesZoneDefinition.Default,{name = "Naked", chance=100, maleHairStyles="Bald:100", femaleHairStyles="Bald:100"});

small topaz
viral notch
#

small question how to add icon for ItemList menu ?

pulsar heath
#

@drifting ore i still think you should contact the dev of that mod

viral notch
#

icons for players works in EQ but in menu are missed

high cloak
#

can someone tell me more about how localization works? where do i put text files with localized text? how do I reference localized text from code?

high cloak
#

i am

viral notch
#

X:\STEAM\steamapps\common\ProjectZomboid\media\lua\shared\Translate

pulsar heath
#

example: of a language file

    UI_optionscreen_binding_STATSPZ = "Twitch Game Stats",
    UI_TwitchInGameWindow_status = "Ingame Stats Window",
    UI_Zkills = "Zombie Kills",
    UI_AliveFor ="Time Alive",
    UI_optionscreen_binding_STATSPZToggle = "Game Window Key",
    UI_TwitchStatsTitle = "Game Stats"

}```
viral notch
#

chose you lang and look how it should look

pulsar heath
#

basicly you create a dir for the language you want to make the translation

jaunty marten
#

to get translated text in ur code use getText function

high cloak
#

so if i put text files there, the game automatically picks them up?

jaunty marten
#

yep

pulsar heath
#

no

viral notch
#

you need to put in mod folder not there

small topaz
jaunty marten
#

why no

high cloak
#

oh yea i gathered that

pulsar heath
#

its not the game who picks it up

viral notch
pulsar heath
#

if he is translating a mod the mod only picks up if gettext if being used

high cloak
#

so in the shared/Translate directory of my mod folder

jaunty marten
#

getText returns translated text from Translate folder depends on ur language from game settings

livid geode
# small topaz Has the variable overdosevalue the correct value in your code. It is not defined...
local overdosevalue = 0;

function ConsumeCocaine()
  overdosevalue = overdosevalue + 10
end--function

--so the character consumes cocaine.. and as tested before while making the mod, value does indeed change by 10
--then I do the following function which would usually make a character say hello00 or hello10 if the overdosevalue becomes 10, it works only if I put EveryTenMinutes event at the end of the file and not when I put it under the condition as in the following function
function PrintOverdoseValue()
      getPlayer():Say("Hello" .. OverdoseValue()); --OverdoseValue() is the same as overdosevalue

      if overdosevalue > 0 then
          Events.EveryTenMinutes.Add(PrintOverdoseValue); --if I run this at the end of the file without condition it works.. but within a condition.. nope
      end--if
  end--function
high cloak
#

no i'm not translating a mod, i just want to be translator friendly for a mod i'm making and i don't want to hardcode english everywhere

viral notch
jaunty marten
livid geode
#

I got it

small topaz
high cloak
#

so if my translation file looks like

shared/Translate/Mod_EN.txt
Etc = {
  ThisText = "Hello"
}

i can just use getText("ThisText"), am I understanding correctly?

pulsar heath
#

yup

viral notch
high cloak
#

got it, thanks everyone

pulsar heath
#

but the names of the files

#

must match the language code

livid geode
pulsar heath
#

used by the game

livid geode
drifting ore
#

needless to say this is much better thanks @pulsar heath

small topaz
jaunty marten
pulsar heath
viral notch
# high cloak got it, thanks everyone

and remember about definition for translation due different functions/items/scripts has different file name ... UI_ ,Items_ ,Farming_ ,Tooltip_ etc etc

small topaz
#

Does anyone happen to know how to store some "global modData" which is not attached to a player or an item? Was it just

   local data = ModData:getModData()
   data.myNewData = "something"

and the to retrieve

   local retrievedData = ModData:getModData().myNewData

??

livid geode
# small topaz then it might work (but no guarantee here ofc...)
function OverdoseCheck()
    if overdosevalue > 0 then
        Events.EveryTenMinutes.Add(PrintOverdoseValue);
    else
        Events.EveryTenMinutes.Remove(PrintOverdoseValue);
    end--if
end--function

In this scenario.. must an OverdoseCheck be called within some other action in order to work or will it run automatically?
Would just simply placing it at the end of the code work or do I have to run it in some other function too? for example

function functionExample()
  OverdoseCheck();
end--function
viral notch
jaunty marten
#

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

viral notch
#

xD

#

someone can tell me what is supported bit depth ???

sour island
# small topaz Does anyone happen to know how to store some "global modData" which is not attac...
local heatMap = {}

heatMap.events = {}
heatMap.cells = {}
heatMap.cellsIDs = {}

function heatMap.initModData(isNewGame)

    local cellData = ModData.getOrCreate("heatMap_cellData")
    if not cellData.cellsIDs then cellData.cellsIDs = {} end
    if not cellData.cells then cellData.cells = {} end

    heatMap.cellsIDs = cellData.cellsIDs
    heatMap.cells = cellData.cells

    heatMap.events = ModData.getOrCreate("heatMap_events")
end
Events.OnInitGlobalModData.Add(heatMap.initModData)
#

This is loading the modData into a module

small topaz
sour island
#

a bit more complicated is that I'm loading parts of the modData into different tables

#

You also want this running in /server/ if you want it to be consistent

#

If you want client side copies you can also do that

pulsar heath
#

that heatmap thing youre working on, has so many uses

#

im already thinking of ways to use it in twitch integration ๐Ÿ˜„

#

that would allow to make some cool stuff happen

sour island
#

the heatmap alone would only be tracking what cells certain events occur - what did you have in mind?

pulsar heath
#

triggering a wandering horde if a player enters a high heat zone

#

that will follow him and increase the heat map from where it goes through

#

kinda like a snowball

#

draggin more zombies into the horde, and generating even more heat and so on

drifting ore
#

is there a way to set a roomID for a room? or roomdef? either or. i can only seem to find how to get

small topaz
pulsar heath
#

or using it to generate sepcial zombies according to the heat level

#

if its a high heat zone, tougher zombies, random sprinters, etc

sour island
#

I did the same actually for EHE

pulsar heath
#

or even with EHE, if its a high heat zone, its would trigger only military air events

livid geode
pulsar heath
#

but i digress

small topaz
sour island
#

'getOrCreate' is a special function for globalModData

#

adds a subtable with that name as a key

#

it's = {}

#
local cellData = ModData.getOrCreate("heatMap_cellData")
``````lua
local cellData = ModData["heatMap_cellData"] = ModData["heatMap_cellData"] or {}
#

basically

#

where ModData also = {}

#

I don't think you can just use modData as a table though - hence why you have functions to add/remove/change

high cloak
#

when you use ModData.get/getOrCreate, are you getting a copy of that data or is it the same table every time

sour island
#

it's the same table by reference

#
local heatMap = {}

heatMap.events = {}
heatMap.cells = {}
heatMap.cellsIDs = {}

function heatMap.initModData(isNewGame)

    local cellData = ModData.getOrCreate("heatMap_cellData")
    if not cellData.cellsIDs then cellData.cellsIDs = {} end
    if not cellData.cells then cellData.cells = {} end

    heatMap.cellsIDs = cellData.cellsIDs
    heatMap.cells = cellData.cells

    heatMap.events = ModData.getOrCreate("heatMap_events")
end
Events.OnInitGlobalModData.Add(heatMap.initModData)

This effectively creates a table you can save/load from automatically

high cloak
#

oh okay

sour island
#

any changes to

heatMap.cells = {}
heatMap.cellsIDs = {}```Should also impact the modData table
small topaz
pulsar heath
#

that kinda reminds of a public property name as dictionary

high cloak
#

then is it not necessary to use ModData.add to save some data if it exists already or if the table was modified? i figured it was necessary and that's what i was doing bored

ancient grail
#

Force closing local host is shitty compare to escaping on a remote server
Its cuz you terminate both client and server at the same time
Messed up my tiles and its harder to debug

Just sharing my frustration to you guys so that you dont do the same
/Save first if you think u need what you are testing to be preserved

drifting ore
#

you gonna have it force close client side then client command to server from there?

#

or you just trying something diff completely

#

question to anyone . is anyone familiar with any way to change the IsoFlagType.exterior to false on tiles?

#

i can only seem to get

#

i'm working on finding a way to set a roomdef or just start by changing exterior flag for now

small topaz
#

If I store some modData in the GameTime instance and do this in the server folder, can I safely access those data in the client folder??

ancient grail
sour island
#

uhh

#

Not sure if the gameTime object is sync'd between client and server

#

Chances are you don't need the client to know the information anyway

#

you can have commands coming from the server to tell the client what it needs to know

#

and updates from the client to change the server's

#

globalModdata has this a bit integrated in the form of recieveModdata events

#

you'd have to write your own if you're using gametime

small topaz
#

Or can I just store those GameTime modData in shared or client and it will still be the same for every player?

viral notch
#

how to easy way add something to existing items in game but without overriding it (txt files)

sour island
#

No, shared doesn't work like that I believe

#

You'd have to call the information using a client/server command

small topaz
sour island
#

I don't personally do it - I use the modData method

#

If the information one way?

#

client's get updates- never the other way?

#
---This goes in /client/ somewhere
local function onServerCommand(_module, _command, _data)
    if _module == "module" and _command == "command" then
        --_data is a table provided in the command
                -- do gametime modData editing here using the _data
    end
end
Events.OnServerCommand.Add(onServerCommand)--/server/ to client
``````lua
---This is called in server
--do gametime modData editing here
sendClientCommand("module", "command", {key1=value1, key2=value2})
#

you could also send the entire modData as the argument to do a table copy

#

but this is unideal and why global modData is preferred as you can keep it to your own stuff

small topaz
sour island
#

no

#

you'd still have to call on update events

#

using 'ModData.request()'

#

this should collect the information to match client's lists

#

I personally grab the data from the lua event to parse it to the client's list

#
local ExpandedHeliEventsModData --.EventsOnSchedule = {} --.DayOfLastCrash = 0 --.DaysBeforeApoc = 0
local function receiveGlobalModData(name, data)
    if name == "ExpandedHelicopterEvents" then copyAgainst(ExpandedHeliEventsModData,data)
    end
end
Events.OnReceiveGlobalModData.Add(receiveGlobalModData)
small topaz
#

many thanks!!

#

btw, if I store stuff in modData of an inventory item (not GameTime), do I have the same problem that if it is stored in server, I cannot access it in client?

sour island
#

inventoryItems are client side in nature (until on the floor/in a container)

#

you can use transmitModdata to update it across clients - in the case of an item being on the ground

#

infact it's suppose to work regardless of serer/client - if you called transmit from either side

#

so be careful using it

ancient grail
#
    container = containers:get(2)

    print('-----------------')
        for j=1,container:getItems():size() do
            local toSell = container:getItems():get(j-1);
            if  toSell and FunctionalATMs2.isSellable(toSell) == true
            and not (toSell:isCustomName() and toSell:isCustomName() ~= toSell:getName()) then
                --getPlayerLoot(0).inventoryPane.highlightItem = toSell
                --toSell:getContainer():DoRemoveItem(toSell);
                local piecePrice = FunctionalATMs2.checkQty(toSell)
                print('sold '..toSell:getName()..' for ' .. piecePrice)
                totalSellAmt = totalSellAmt +   piecePrice
                toSell:getContainer():DoRemoveItem(toSell);
                getPlayerLoot(0):refreshBackpacks()
            else 
               -- print('cannot sell '..toSell:getName())
                getPlayerLoot(0):refreshBackpacks()  
            end
        end
#

can some one pls help im almost done ๐Ÿ˜ฆ

#

i mean my problem here is im deleting the item as i convert it to cash

#

i think its messing up the table's index?

#

idk

drifting ore
#

does (2) need to be (2)

#

it seems like thats something to do with it

ancient grail
#

idk i just figured 1 was always floor i think

drifting ore
#

i thought it was 0 or 1

ancient grail
#

i really am not good at getting the container

drifting ore
#

try containers:get(1) ?

#

the error is essentially saying that it seems

#

2 out of bounds for length 1

ancient grail
#

Ye i tried to change that but u see that dorenove item

#

Doremoveitem

#

If i dont do that it doesnt give error

drifting ore
#

so the -1?

ancient grail
#

Idk i got that from vanilla

drifting ore
#

i actually saw that

ancient grail
#

I think what i should do it prevent the container from.acxepting anything else aside from the sellables

drifting ore
#

it's got to be how you are trying to use it vs how it's supposed to. enter smart experienced person

#

any time now lol

#

๐Ÿ˜„

ancient grail
#

Ye o understand but the problem is this the only one that worked

#

Lol

#

And idk why or how

bronze yoke
thick karma
#

Can anyone clarify the bare minimum required in an animation's XML file?

bronze yoke
#

if you're removing items while you loop forwards it's going to mess things up

ancient grail
#

Why do you know everything?! Thnx albion!

#
   for i = container:getItems():size(), 1,   -1 do 
rancid tendon
#

making custom zombie outfits is kind of exhausting but

#

it's very satisfying to see them show up in game

dark wedge
# thick karma Can anyone clarify the bare minimum required in an animation's XML file?

Oh hey, I know this one:

<animNode>
    <m_Name>NAME</m_Name>
    <m_AnimName>Animation_Name</m_AnimName>
    <m_deferredBoneAxis>Y</m_deferredBoneAxis>
    <m_SpeedScale>0.40</m_SpeedScale>
    <m_BlendTime>1.25</m_BlendTime>
    <m_Conditions>
        <m_Name>PerformingAction</m_Name>
        <m_Type>STRING</m_Type>
        <m_StringValue>CONDITION</m_StringValue>
    </m_Conditions>
</animNode>```
This would be the minimum required for a TimedAction.  The "PerformingAction" condition value should be updated to whatever you want the anim name to be called from your code via `self:setActionAnim("CONDITION")`
open drum
#

Hi im trying to spawn a zombie near myself when i press caplock key so I coded a LUA like so in the below

#

but it keeps giving me an error

#

could anyone help me with this?

#

not sure what i am doing wrong

#

this is the error i get when i try.. i guess the getVirtualZombie manager no longer exist in new build??

thick karma
#

I mean, what is the bare minimum to avoid throwing exceptions from a file being "too short"

#

I have 2 extra XML files in my set, I need them to basically do nothing, compiler is complaining even though stuff works.

#

I would like to eliminate those exceptions

#

I suspect deleting the files would cause worse problems for servers running my mod.

dark wedge
thick karma
#

Thanks. I tried:

<?xml version="1.0" encoding="utf-8"?>

I had to check console.log to see the error because it happens during server load and the game will not pause for it... If you're off doing things while your server loads, you'll miss it.

#

I will try what you tried

#

If all else fails, I'll try:

-- Old Sit Actions File

<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>MeditatingActions</m_Name>
    <m_AnimName>Meditating</m_AnimName>
    <m_deferredBoneAxis>Y</m_deferredBoneAxis>
    <m_SpeedScale>0.40</m_SpeedScale>
    <m_BlendTime>1.25</m_BlendTime>
    <m_Conditions>
        <m_Name>NeverGonnaGiveYouUp</m_Name>
        <m_Type>BOOL</m_Type>
        <m_BoolValue>true</m_BoolValue>
    </m_Conditions>
</animNode>

-- Old Sit Ext File

<!-- This file never should have been born. -->

<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>MeditatingExtensions</m_Name>
    <m_AnimName>Meditating</m_AnimName>
    <m_deferredBoneAxis>Y</m_deferredBoneAxis>
    <m_SpeedScale>0.40</m_SpeedScale>
    <m_BlendTime>1.25</m_BlendTime>
    <m_Conditions>
        <m_Name>NeverGonnaLetYouDown</m_Name>
        <m_Type>BOOL</m_Type>
        <m_BoolValue>true</m_BoolValue>
    </m_Conditions>
</animNode>

<!-- This file never should have been born. -->
dark wedge
#

haha. if the action file isn't used anymore, should be safe to remove it though.

thick karma
#

Here's the error btw:

[Fatal Error] :3:48: Premature end of file.
ERROR: General     , 1673932647828> 0> ExceptionLogger.logException> Exception thrown zombie.util.PZXmlParserException: Exception thrown while parsing XML file "C:\Users\Zen\Zomboid\Workshop\Meditation\Contents\mods\Meditation\media\AnimSets\player\sitonground\MeditatingAction.xml"
  Caused by:
    org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 48; Premature end of file. at PZXmlUtil.parseXml line:51.
ERROR: General     , 1673932647828> 0> DebugLogStream.printException> Stack trace:
zombie.util.PZXmlParserException: Exception thrown while parsing XML file "C:\Users\Zen\Zomboid\Workshop\Meditation\Contents\mods\Meditation\media\AnimSets\player\sitonground\MeditatingAction.xml"
  Caused by:
    org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 48; Premature end of file.
    at zombie.util.PZXmlUtil.parseXml(PZXmlUtil.java:51)
thick karma
#

Seems to imply maybe it expects something on line 3 of a file that I had reduced to a single line

#

Maybe that was an issue?

#

idk I am trying your version

dark wedge
thick karma
#

So I am not trying to make anyone go through that headache

#

Bingo

thick karma
thick karma
#

Just for anyone who finds it

dark wedge
dark wedge
thick karma
#

๐Ÿ˜ญ

bronze yoke
#

i've realised that trying to spread joy with my comments is futile

#

so now i deliberately use insane syntax in the hopes that it'll upset someone instead

high cloak
#

use semicolons queasy

bronze yoke
open drum
#

still waiting for a help here .. anyone would like to help a noob please?

bronze yoke
# open drum

i don't think getVirtualZombieManager() exists

#

use VirtualZombieManager.instance instead

open drum
#

although i looked up the class

#

it seems to exist

bronze yoke
#

the class exists, but there isn't a getter function for it

open drum
#

i see isee

bronze yoke
#

use VirtualZombieManager.instance instead, it does the same thing

open drum
bronze yoke
#

could i see the code?

open drum
#

i guess it's not simple plug in and go type of function...

bronze yoke
#

oh, instance is a field, not a method, just use VirtualZombieManager.instance:createRealZombieNow(X, Y, Z)

open drum
#

Oh wow that worked

#

thanks albion

#

but if you dont' mind and if it doesn't bug u too much

#

cuold you explain one more time why

#

including .instance (field)

#

worked

#

while VirtualZombieManager() fucntion didn;t?

bronze yoke
#

virtual zombie manager is a singleton class, so you need to grab the instance of the class to use its methods - when they do this they usually have a static field 'instance' pointing to it

open drum
#

hmm

#

are u saying the other methods are under the instance then??

#

sorry i am still learning the python

rancid tendon
#

shocked by how easy it is to make hair dye

#

modding this game is often much more complicated than it should be so

#

it's nice to find something that takes basically no effort and produces great results

humble oriole
#

If I wanted to change a specific item setting would I use script manager or the itemPicker?

#

specifically I want to change the KeepOnDeplete to true on propane tanks without overwriting the item definition.

ancient grail
ancient grail
rancid tendon
#

the game doesn't let you make zombies spawn with items in certain condition, and it doesn't let you define a tint for a tintable object when it spawns on a zombies, but it gives you a fully automated system with simple RGB codes to make any hair dye you want in the space of a single item script lol

bronze yoke
#

do you mean you want to change a parameter on the item script without overwriting the entire script?

dark wedge
bronze yoke
#

ScriptManager.instance:getItem("Module.Item"):DoParam("KeepOnDeplete = Value")

humble oriole
#

do I have to do what Clytch3r mentioned and set that to ongamestart to make sure it doesn't revert?

bronze yoke
#

no

#

you just do it

#

if you want to be safe (especially if you're linking into another mod that might remove things with no notice), you can do

local item = ScriptManager.instance:getItem("Module.Item")
if item then
    item:DoParam("KeepOnDeplete = Value")
end
humble oriole
#

I should do this in server not shared, right?

sour island
#

should be shared actually

bronze yoke
#

it executes the same anyway, but you shouldn't hide it behind any checks or anything

#

you need to change the script on both

sour island
#

server and client's need matching scripts otherwise they flag the anticheat

humble oriole
#

ah, yea, good point

sour island
#

I had to write around something related to this - let me look up the reasoning

#

Seems like I had to include a 'already ran' check on the function for EHE - it is under ongameboot in shared

#

seemed to cause problems in MP (perhaps running once for client and once for server

#

But in my shops mod I do something similar in ongameboot and in shared and haven't gotten reports of issues so ๐Ÿคท

#

ah the EHE stuff was item scripts, shops is recipe related

humble oriole
#

I'll go look at it to see if it's something I'll need to worry about

#

I don't think any mods other than the workshop mess with propane tanks

bronze yoke
#

i don't think this will be an issue if you just don't tie it to an event

humble oriole
#

and we're trying to phase that out of our server

#

hmm, I wonder how it changes the tanks to have a x/capacity

ancient grail
#

Wait so doparan is permanent? Cuz i thought if i use it on an instant then it wont change everything else that will spawn esp since i used debug console

humble oriole
#

it's probably cause you're doing it in console. Files load before the server starts

ancient grail
#

Ok ididnt want a permanent change anyways

#

But if i do how do i do that?

thick karma
#

Okay, new puzzle. MoveTo appears to work by two mechanisms from the limited perspective of its own file content:

Step 1: player:getPathFindBehavior2():pathToLocation(x, y, z)
Step 2: On update(): player:getPathFindBehavior2():update()

I am aware of no other functions that are called to make the movement happen, and yet, for whatever reason, if I move this code outside of a timed action and try to call player:getPathFindBehavior2():update() on every tick (for experimental purposes), character does not proceed down path, but instead walks in place. Anyone know the secret here? Could I trigger this loop outside of a TimedAction if I do it right, or is there something subtle that stops me from calling the functions this way?

#

I've got autowalk working p well, but it would be cooler if I could use other TimedActions freely while I'm doing it...

ancient grail
#

Ok

bronze yoke
#

it only exists on the item script

high cloak
#

does anyone know where the list of channels for tvs and radios is created?

#

the little dropdown

#

adding a channel after a game has already started will cause that channel to not show up in tvs you already looked at, so i'm trying to figure out if i can trigger the list to refresh

cosmic condor
#

media\radio\RadioData.xml

high cloak
#

sorry, I should have been more specific. I mean like the ui dropdown, when you click device options and you can pick different channels

cosmic condor
#

search in the file for cat="Television"

high cloak
#

I'm sure that I'm looking for lua code. I think I found it, but I have to find what triggers the channel list to update

thick karma
#

Defeated by modding again. ๐Ÿ’€๐Ÿ˜ด

humble oriole
#

What's the best way to get the max capacity of a drainable? There's no maxCap function

#

currently I'm cross multiplying and it's not great

#

(((1 - tankDelta) * tankAvailableUses) / tankDelta) + tankAvailableUses

bronze yoke
#

wouldn't it be 1/delta?

humble oriole
#

well, 1/.25 is still 4

#

strangly 1/.0625 is 16

bronze yoke
#

i mean the other delta

#

i'm not at a computer right now so i can't check the exact names (and i recall them being annoyingly similar)

#

but the max capacity is defined using a delta

#

1/delta = max capacity

humble oriole
#

there's getDelta(), getUseDelta(), and getUsedDelta() xD I'll play around with em in console and figure it out

#

I could do 1/(1-delta)

fast galleon
#

if you're bad with math, you can create a new instance item, use it until it's drained and return how many times you used it drunk

humble oriole
#

problem is I do this at 1-2am when I have the most time

fast galleon
humble oriole
#

and brain has significantly diminished capacity for story problems.

fast galleon
#

I get derp moments like that too, no worries

humble oriole
#

oh, getUseDelta() is how much is used on each "use" of the item

#

I misunderstood that

bronze yoke
#

i think we can all agree... there is no way this was simpler than using integers

humble oriole
#

yea, cause delta returns about 16 decimal places hahah

high cloak
#

how's server/client communication work, is there a global function for passing data back and forth?

bronze yoke
#

sendClientCommand(optional player, module, command, args) triggers OnClientCommand(player, module, command, args) on the server

fast galleon
bronze yoke
#

and vice versa with sendServerCommand

high cloak
#

ah okay, thank you both

calm depot
humble oriole
calm depot
#

That wouldn't be a float

#

They should have used integer values, though

#

There is no need for drainables to be floats

ancient grail
#

so i tried playing with doparam for fun

#

i wanted to make my weapon do all the swing types

#

but then it was permanently applied to the game items

#

i noticed the icon turned into apple ont the item picker

#

thres an error but this is the code


Events.OnPlayerAttackFinished.Remove(weaponStance);
function weaponStance(character, handWeapon)
    local item = character:getPrimaryHandItem()
    item:getContainer():DoRemoveItem(item);
    character:setPrimaryHandItem(item)
    local Script = ScriptManager.instance:getItem("Base.Katana")
    Script:DoParam("AttachmentType = Knife")        
    Script:DoParam("DisplayName    =    GlytchBlade")
    Script:DoParam("Tooltip    =    GlytchBlade")
    Script:DoParam("Icon    =    Apple")    
  local item = InventoryItemFactory.CreateItem("Base.Katana")
    local stance = ZombRand(1,6)
    if stance == 1 then Script:DoParam("SwingAnim    =    Bat")        ; character:setSecondaryHandItem(handWeapon) end
    if stance == 2 then Script:DoParam("SwingAnim    =    Heavy")        ; character:setSecondaryHandItem(handWeapon) end
    if stance == 3 then Script:DoParam("SwingAnim    =    Stab")        ; character:setSecondaryHandItem(nil) end
    if stance == 4 then Script:DoParam("SwingAnim    =    Spear")        ; character:setSecondaryHandItem(handWeapon) end
    if stance == 5 then Script:DoParam("SwingAnim    =    Shove")        ; character:setSecondaryHandItem(nil) end
  
    character:getInventory():AddItem(item)
    character:getInventory():setDrawDirty(true);
end

Events.OnPlayerAttackFinished.Add(weaponStance);
cosmic condor
#

looks like fun

ancient grail
#

But its permanently changing everything

#

I tried setswinganim didnt work idk why

fast galleon
#

split screen question, if a player left, would there be an event? Would obj:isAlive() return false, or rather should I check if obj:isDead()?

*isAlive() just returns not isDead(), now that I look closer

ancient grail
#

Ondisconnect maybe

#

Or something o
Like that

sour nova
#

`item AdvancedTradingPost
{
Weight = 1000,
Type = Container,
Capacity = 9999,
DisplayName = Trading Post,
icon = ATP,
ResizeWorldIcon = 2.0,
}

recipe Create Trading Post
{
    keep BlowTorch,
    SheetMetal=10/SmallSheetMetal=40,
    MetalPipe=10/MetalBar=10,
    Generator,

    Result:AdvancedTradingPost,
    Time:5.0,
}

`
Can someone help me with my recipe? its throwing errors and im not sure why

#

Seems like all inputs need to be on one line?

#

I changed it to this and it works -
`recipe Create Trading Post
{
keep BlowTorch,
SheetMetal=10,MetalBar=10,Generator,

    Result:AdvancedTradingPost,
    Time:5.0,
}

`

#

But I wanted options between large/small sheets and pipes/bars

vast nacelle
sour nova
#

Cheers @vast nacelle

sour nova
#

`recipe Create Trading Post - Large Sheets
{
keep BlowTorch,
SmallSheetMetal=40,
MetalBar/MetalPipe=10,
Generator,

    Result:AdvancedTradingPost,
    Time:5.0,
}

`

fast galleon
#

hm, any suggestions for free courses for amateurs like me?

drifting ore
drifting ore
sour nova
ancient grail
#

Ow your name is back haha

fast galleon
viscid drum
#

I'm trying to modify "Modified Backpacks" to create the different coloured duffelbags instead of just the default one. I managed to get it to do so by replacing all instances of bag_dufflebag with bag_dufflebagTINT but replacing the icon with DuffelbagWhite as is done in zomboids clothing_bags.txt has resulted in the icons being varicoloured questionmarks instead of duffelbags. Any way to fix this?

drifting ore
#

hey quick question

#

what would happen if I put the chance over 100 here ?

#
        {
            name="Naked",
            chance=100,
        }, ```
rancid tendon
#

anyone know if it's possible to make a weapon associated with a zombie outfit always come with a specific set of upgrades?

#

for instance, if i have a zombie spawn that always has an M16 on its back, is it possible to add upgrades such as a stock to that M16 in any way, or does it just have to be a random version of it

pulsar heath
#

uff finally manage to get real world time inside the game

#
local pzCalendar = PZCalendar.getInstance()
local hour = pzCalendar:get(Calendar.HOUR_OF_DAY)
local minute = pzCalendar:get(Calendar.MINUTE)
playerChar:Say("Hour: " .. hour  .. ":" .. minute)```
dunno if anyone will have use for it, but i  do so im sharing what i've learned ๐Ÿ˜„
jovial harness
#

Hi, this is my first time here. I'm looking for a way to identify different kinds of buildings. For instance let's say I've got an IsoBuilding instance from calling a getBuilding() method. Is there a way to check if that building is a school, a house, a firestation, etc ?

vast nacelle
fast galleon
jovial harness
#

All right I'll just loop on the rooms until I find the ones unique to specific kinds of buildings then

vast nacelle
# rancid tendon anyone know if it's possible to make a weapon associated with a zombie outfit al...

There is this in media\lua\server\Items\SuburbsDistributions.lua:

    VarmintRifle = {"x2Scope", "x4Scope", "x8Scope", "AmmoStraps", "Sling", "FiberglassStock", "RecoilPad", "IronSight"},
    HuntingRifle = {"x2Scope", "x4Scope", "x8Scope", "AmmoStraps", "Sling", "FiberglassStock", "RecoilPad"},
    Shotgun = {"AmmoStraps", "Sling", "ChokeTubeFull", "ChokeTubeImproved"},
    Pistol = {"Laser", "RedDot", "IronSight"}
}```
I *think* if you add weapons and an attachment to this array, there's a chance that the weapon can spawn with an associated weapon upgraded. However, I'm not sure if this applies to Weapons attached to Zombies. It's probably used in the Java-side of the code. So I'm not really sure how it's used.
thick karma
#

If I wanted to write a config file that only existed serverside so I could load admin options before basically anything else happens (ideally before traits get added so that I can make traits and their costs optional), where would I need to write from, and where would I expect that file to be saved? (@ anyone)

rancid tendon
#

and even then, presumably it's just a chance, which wouldn't really be as functional for me as simply forcing the modifications to spawn in the zombie's inventory to make sure the player gets em

#

shame though, would've been cooler if they appeared modified on the zombie :p

fast galleon
thick karma
#

I am guessing that if it were on the server I could just read the file right before creating the trait; but I'm not clear on how to read/write a server-only config in the first place.

fast galleon
#

me too moment

fast galleon
thick karma
#

I am assuming that I may need to send the client a command. Hoefully that would be possible but I'm really not sure

#

I wish the gd sandbox options loaded before my files run

jovial harness
#

I was doing a "Forced and Forbidden Traits" mod a while ago, never finished it. But basically it removed or forced traits in character creation based on sandbox settings

#

It'd be hard to modify their cost on the fly tho

pulsar heath
#

math kills my brain... but this should be a 5 m timer ...

#

kind off

drifting ore
#

Possible to put another tooltip string below the existing one?

#

How long does it last

pulsar heath
#

the code is wrong

#

tried to clean it up and this shit happens as usual

#

๐Ÿ˜„

drifting ore
#

๐Ÿ˜ฎ

pulsar heath
#

gimme a second... ill get the frankenstein code and clean it up again ...

vast nacelle
#

Don't know which tooltip you are wanting to extend, but you can do something like that.

drifting ore
#

Na just a regular item was wondering if you can just underneath for example leather scraps put "Yeah this b letter scraps"

ancient grail
#

๐Ÿซก burry agas names soo cool

drifting ore
#

So you get the item, get the tooltip option and modify it by making it option.ToolTip .. " New string"

#

Or do I have to go into scripts for it

vast nacelle
#

Well, if its an item, I'd probably just create a new tooltip that takes the old one and adds your new text.

neon bronze
#

Do you wanna add a new box for a tooltip under the existing tooltip for the item?

drifting ore
#

Nah in the same box

#

Just another category

#

Like theres weight add smth else

cosmic condor
#

Do you know what is more fun than DoParam?

#

DoHaram

drifting ore
#

Zing

vast nacelle
#

Like

{
   ...
   Tooltip = Tooltip_Original,
   ...
}```
Go find Tooltip_Original in the translations file in `media/lua/shared/translate/EN/Tooltip_EN.txt`
Then make your own Tooltip_EN.txt in the same file structure but in your mod and have something like
```Tooltip_EN =
{
    Tooltip_New = "Stuff in Tooltip_Original + <br>your new text",
}```
and then make the item have `Tooltip = Tooltip_New,`
pulsar heath
#
local pzCalendar = PZCalendar.getInstance()

local MyTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)


mytimer(5,MyTime)

function mytimer(timervalue, startTime)
    local currentTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE) + timervalue
        if currentTime - startTime >= 0 then
        playerChar:Say("Timer ended!!!!")
    end
end```
#

now to make it pz compatible ๐Ÿ˜

#

hmmm still wrong had an extra * 60 which is not needed...

#

only need to multiply the hour value by 60

#

and in theory this should get me the start time in minutes

#

but im still doing something wrong... in the if

#

brain melted with something so simple... i need fresh air ๐Ÿ˜„

#

duh

#
local pzCalendar = PZCalendar.getInstance()

local MyTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)


mytimer(5,MyTime)

function mytimer(timervalue, startTime)
    local currentTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE) + timervalue
        if currentTime - startTime >= timervalue then
        playerChar:Say("Timer ended!!!!")
    end
end```
finite radish
#

anyone know how .pack file loading works for mods? does it just pick up any of them in media/texturepacks/ and load them?

pulsar heath
#

whith mistakes like this i really need to make a break and have some coffee ๐Ÿ˜„

#

still a big duh moment

#
local pzCalendar = PZCalendar.getInstance()

local MyTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)


mytimer(5,MyTime)

function mytimer(timervalue, startTime)
    local currentTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)
        if currentTime - timervalue >= startTime then
        playerChar:Say("Timer ended!!!!")
    end
end```
#

this one is the correct one ...

drifting ore
#

Or is that string in the brackets just what ID from the script file of the item you are pulling the tooltip

#

I have quite a few items to iterate over, hence the focus on trying to do this via a function and loop over items rather than do it manually

finite radish
#

anyone know if the wiki's list of lua-exposed events is up to date?

#

also, slightly related - trying to see what the replacement for OnRenderUpdate is. I can't imagine the render loop and the game loop both run on tick

fast galleon
finite radish
finite radish
pulsar heath
#
local pzCalendar = PZCalendar.getInstance()
local timervalue = 0

function TWE_TraitCheck()
        local currentTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)
        if currentTime - timervalue >= startTime then
            player:getTraits():remove("abc");
            HaloTextHelper.addTextWithArrow(player, getText("UI_trait_abc"), false, HaloTextHelper.getColorRed())     
            Events.EveryTenMinutes.Remove(TraitCheck)
        end
end

function TWE_addTrait()
    if not playerChar:HasTrait("abc") then
        playerChar:getTraits():add("abc");
        HaloTextHelper.addTextWithArrow(playerChar, getText("UI_trait_abc"), true, HaloTextHelper.getColorGreen())
        Events.EveryTenMinutes.Remove(TraitCheck);
        Events.EveryTenMinutes.Add(TraitCheck);
    end
end```
i think this it it ๐Ÿ˜„
#

trait abc is placeholder... will probably use a table with all the traits or something like that

ancient grail
#

Special Thanks to Fajdek for giving me permission to use some of the functions on this lua file
Special Thanks to dhert for providing me an improved player distance code and Cannibalize Animation
Special Thanks to BurryAga for lending me his Darkvision Code for Primitive Trait
Special Thanks to Cosmic B for helping me with the Believer Context menu contextmenu
Special Thanks to Albion for pointing out the OnPlayerGetDamage event

#

credits for the trait mod im done with it

#

the client will be the one to post it

pulsar heath
#

you finished your mod?

#

gratz ๐Ÿ˜„

#

gimme the worshop link so i can sub it

ancient grail
#

yes sir

#

its not yet done for him i mean i did the traits functions but his going to make the profession..

#

so its currently hidden

pulsar heath
#

ok ok, whenever its available let me know

ancient grail
#

but ill post it here when he outs it i doubt its gonna be soon cuz he plans to replease all his mod when he launches his server but the atm mod 2 is also done

#

hehe

#

new proj im working on

pulsar heath
#

undead char?!

#

cool

ancient grail
#

more like animations make available for roleplay purposes

#

im going to use dislaik's toggle functions for the setup (with permission)

drifting stump
#

damn wheres my workshop mechanic

ancient grail
#

Whats that

drifting stump
#

blue role

#

whole bunch of new ones popped up

drifting ore
#

is there a way to replace the posters in game with my own ?

#

not add new ones mind you, but replace them