#mod_development

1 messages ยท Page 88 of 1

sour island
#

when in doubt you could print stuff

#

#{} = 0

finite radish
#

true, yeah. I might just give that a shot, get the sprite manager funcs out of the way to make sure it's not getting the tiles incorrectly for some reason

sour island
#

#{a=1,b=2} = 0 tho

#

this part of Lua sucks lol

finite radish
#

what about {}[1]

sour island
#

that'd probably return a index 1 of 0

astral dune
#

#{a=1, 1 = "foo", b =2} == 1

sour island
#

really?

#

is it just parsing for numeric keys?

astral dune
#

yep, until one is missing

sour island
#

I feel like that can be abused for some fun shenanigans

astral dune
#

if you have keys 1 and 3 it also thinks its length 1

finite radish
#

...am I misunderstanding #? I thought it was effectively Table.Count()/Table.Length (if this were java/C#/whatever)

sour island
#

it only handles numeric keys

#

as Lua doesn't have lists or arrays - but tables for both

finite radish
#

man fuck lua i hate this shit. idk how I tolerated this back in early gmod days, probably because I didn't know anything about programming

#

but damn this shit is backwards sometimes

sour island
#

I've taken to using multiple tables with shared keys/values

#

if I need to sort/count the values

finite radish
#

kinda like a hash table/dictionary, right?

sour island
#

yeah, which Lua doesn't really have so I imagine everyone will eventually write their own

#

same way most people write out a for loop to check for a value

#

this is what the community patch/framework would address - if I ever set aside time for that and stop trying to polish my other mods lol

finite radish
#

lmfao fair

#

i relate to that, too many projects and with a lot of perfectionism PepeHand

sour island
#

especially boilerplate utility functions that are too small to be their own mod

#

I only stop updating when I stop getting comments

pulsar heath
#

youll never stop updating then...

sour island
#

preemptively took off steam comments for EHE's update - took it to GitHub exclusively

sour island
#

Idk why players accept error messages and not report the issue -- or why people think having mods means errors are to be expected

pulsar heath
#

mostly if like... if it works... they dont care about the errors

#

is*

#

i had one saying that to me when i said that my mod was broken and shouldnt use it

sour island
#

if there's an error it's probably not working as intended to some degree

pulsar heath
#

he just said... i get errors... but it work so i dont care

sour island
#

lol

astral dune
#

my minecraft logs are more red than anything else, yet it runs fine,lol

finite radish
#

welp... it's not the sprite manager function. so now I'm even more confused

sour island
#

what if you add the floor

#

instead of square

#

v:setSprite(

finite radish
#

wouldn't that mean that the square variabled passed from the LoadGridsquare event is getting changed to... a floor object? thing?

sour island
sour island
#

you are calling for them anyway

pulsar heath
#

dont remember which mod was it... but i had a mod running that everytime it rained...

#

it also rained errors

sour island
#

probably won't fix the issue but may shed some light to whats happening in bar()

pulsar heath
#

the rain stoped... the errors stopped

#

i stopped using the mod... but 90% of the streamer i knew were still using it

#

and all of them said : its fine... its only when it rains and i never get to winter

finite radish
#

I think I found something actually:

    run = function(self)
        local square,x,y,z = getSquareDelta(2, 2, 0)
        local square2,x2,y2,z2 = getSquareDelta(1, 2, 0)
        removeAllButFloor(square)
        removeAllButFloor(square2)
        square:getFloor():setSprite(getSprite("blends_natural_01_21"))
        square2:getFloor():setSprite(getSprite("blends_natural_01_21"))
...```
this is the code I was referencing, I wonder if `removeAllButFloor` is the key piece that's making this code not shit the bed
astral dune
#

either the errors aren't game breaking or the modder isn't responsive or whatever, you just have to live with issues. I hate it tbh

sour island
#

If that's the case it's fine / nothing you can do

finite radish
sour island
#
testTheseTiles = {}

local function foo(square)
    if not square then return nil end
    local sqFloor = square:getFloor()
    if sqFloor and sqFloor:getSprite() and sqFloor:getSprite() == getSprite("blends_natural_01_64") then
        testTheseTiles[#testTheseTiles+1] = sqFloor
    end
end

local function bar()
    for _, v in pairs(testTheseTiles) do
        v:setSprite(getSprite("blends_natural_01_0"))
    end
end

Events.LoadGridsquare.Add(foo);
Events.EveryOneMinute.Add(bar);
#

This is what I meant

#

if somehow floor is nothing - then it'd do nothing tho

finite radish
#

yeah I get you. it crossed my mind earlier, but I avoided trying that method because I wanted to eventually modify non-floor sprites, but I'm just testing anyways so it doesn't really matter I guess

sour island
#

ah

astral dune
#

it really shouldn't be possible for floor to be null if you checked for it before inserting the square in the table, something else is going on

#

well, actually if you're moving around I'm sure plenty of those squares in that list will get unloaded in some way. I would make it a weak key table maybe

finite radish
astral dune
#

you're storing a reference to a piece of the map that may no longer exist when everyoneminute gets around to checking, I'd expect issues now that I think about it

finite radish
#

oh shit wait, what you just said made me realize - maybe it's - YEAH

#

i may be using references to unloaded squares

#

fuck me. that's probably it.

#

although I tend to get the breakpoint as soon as I start up the world, so that's weird

sour island
#

ah

pulsar heath
#

i need break... lost 40m because a char case in a var name...

sour island
#

I forget squares might be unloaded lol

pulsar heath
#

god dang it

finite radish
#

I could probably get the position though, store THAT instead, and then fetch the specific chunk in the second function (if it's loaded)

#

(or maybe just check if it's loaded in the second function, that'd probably be easier)

astral dune
#

you could make it a weak table, so object in it that have been unloaded will be garbage collected, but I'd be worried you could sneak in before the GC does. Just have to check validity in both functions

sour island
#

for loadSquare stuff I'd store x/ys

finite radish
#

what's a weak table? my Lua is extremely rusty

astral dune
#

essentially the tables are by default "strong", which means objects you've put in there are anchored in memory and can't be garbage collected, but they may become altered in some way to make them invalid, which I think is what is happening here

#

you can make either the keys or the values or both of a table "weak" so that if they are the only thing still referring to that object, it can be garbage collected and removed from the table

worldly stone
#

Is there a way to store global mod data between restarts ?

sour island
#

globalModdata is already saved

worldly stone
#

hmm ok, I'm struggling to sync it between clients and have it work after a restart

sour island
#

syncing with clients is a different ballgame

#

assuming you have the modData on the server side of things

#

you have to call ModData.request("x")

worldly stone
#

I have it on both and i'm transmitting and requesting all the time

sour island
#

but after updates are made

#

you have to ensure the client's are pulling from server

#

I do a modData.Remove() on Init

#

to force clear it

slate sable
#

I tried copying the base lua file for a mod to alter the cost of traits and it threw errors anything im doing wrong?

#

its based off the vanilla code

worldly stone
sour island
#

alternatively, the errors would help too

finite radish
#
local function foo(square)
    if not square then return end
    if square:GetObjects() then```
how is this POSSIBLY causing `Object tried to call nil in foo`
#

i'm so baffled, this API is so counterintuitive and busted lmfao

sour island
#

getObjects

finite radish
#

kill me

sour island
#

generally everything is in camelCase except for when it's not

finite radish
#

absolutely disgusting

#

has anyone tried to set up actual linting/debugging/etc. for this, aside from the failed CocoLabs thing? having to launch the game only to be frustrated by vague, unhelpful debug info isn't a lot of fun

sour island
finite radish
sour island
#

actually the coco-labs thing bared some nice fruit

#

needed Konijima to decipher Yook's convoluted readMe

#

and I guess the relaunched pzDocs/pzMod as CAPSID was just decoupling gradle shit from every mod folder

finite radish
#

does that allow for actual Lua linting/checking? because I already have everything decompiled

sour island
#

this lets you use the produced files as a global library for every project

#

it adds autocomplete when typing

#

as well as some parameter tooltips

finite radish
#

does it do the interop between Lua and Java pretty seamlessly? i might look into that, as much as I despise intelliJ

sour island
#

afaik on-top of decompiling the code - it parses the exposed file and creates it's library -- if it doesn't auto complete it isn't exposed to use

finite radish
#

interesting. thanks

sour island
#

even Java classes (although that can be hit or miss)

#

if you're familiar with gradle the libraries only issue would be the fact it doesn't understand classes inherit from eachother

#

so you may have to get familiar with class trees when using emmyLua

finite radish
#

that still sounds like a clusterfuck tbh

sour island
rain pumice
#
ISReadABook = ISBaseTimedAction:derive("ISReadABook");
#

i've been trying to figure out with derive does but I feel like i'm just getting into nothing

sour island
#

It's by far better than having to keep checking classes

rain pumice
#

Am I overthinking this

sour island
#

Creates a new pseudo-class based on an existing one

rain pumice
#

he just named it derive

#

I just never see it being used in the code so I was wondering why that was there

sour island
#

it's used all over the vanilla Lua

finite radish
#

yeah, it's everywhere

#

especially UI elements

rain pumice
#

I just couldn't find it on the wiki

#

I guess I should've looked at the vanilla lua lol

#

lol

#

thank you guys

sour island
#

it's used for UI/timed actions for the most part

#

basically copies the original table with some extra backend stuff going on

rain pumice
#

I see

#

I was working on a mod that could modify player's mov speed but it seems like its not possible

#

other than using the clothing speed modifier

neon snow
#

Hey uh, I've got a problem. So when I place a custom attachment (I'm making a silencer) on the ground, it seems fine. Attaching the custom silencer to the gun works as well. However, placing the gun and the silencer down while it's still attached makes it utterly huge. Any advice?

astral dune
# finite radish kill me

The coding language I use at work is case insensitive, so I've developed some pretty bad habits. Can relate

sour island
#

I used to work at a place that used uppercase for everything

#

all work notes had to be in uppercase - not really programming related

#

I think someone higher up had bad eyesight

astral dune
#

TIMES NEW ROMAN 35PTS ALL CAPS

sour island
#

unrelated - I updated the debug tool button to include a bluejay

#

seemed like the right thing to do being it is using AUD as a starting point

worldly stone
sour island
#

Glad to hear it ๐Ÿ‘

small topaz
#

Anyone happens to know what the command was to retrieve the script ID of an item but without the "Base." as prefix? For example, if the ID is "Base.MyItem", I just want to get the string "MyItem".

sour island
#

should be :getType() on InventoryItem

rain pumice
#

does this mean i can't see the files of the mod

#

I can't seem to find the folder of it anywhere

sour island
#

Physically, you can still see it - but technically you'd be breaking copyright using it

small topaz
rain pumice
#

yeah i won't use it

#

I literally can't find it lmao

#

searching by workshop id on my files

#

or even the name of it

sour island
#

if you're subbed to it it's in: C:\Program Files (x86)\Steam\steamapps\workshop\content\108600\WORKSHOP_ID

rain pumice
#

odd

pulsar heath
#

@sour island LOG : General , 1674020450702> Warning, root node parent is always null.
LOG : General , 1674020460661> - EHE: WARN: IsoPlayers can't add; IsoPlayer x/y less than 1:None None
LOG : General , 1674020461026> reanimate: loaded 0 zombies
LOG : General , 1674020461153> game loading took 23 seconds

#

is this normal?

sour island
#

yeah

pulsar heath
#

good... i thought i broke something again...

sour island
#

that's probably the isoplayer.instance

#

being the fullname is 'none none'

pulsar heath
#

just neveer noticed it before... and since im messing around updating my mod and the json that it uses was already getting paranoid

humble oriole
#

Why would getPlayer():getInventory():getAllCategory("Material") return nothing?

#

("Food") returns the potato so it's the write call, just not sure why I can't ge tthe tank

ruby urchin
#

afaik, category is related with type of the item, try using getPlayer():getInventory():getAllCategory("Drainable") and probably you will get the propane tank

humble oriole
#

Yea, I tried that too haha

ruby urchin
#

๐Ÿคทโ€โ™‚๏ธ did you try get his category?

#

you can do

local inventory = getPlayer():getInventory();
local items = inventory:getItems();

for i = 0, items:size() - 1 do
    local item = items:get(i)
    
    print(tostring(item:getFullType()) .. " - " .. tostring(item:getCategory()));
end
sour island
#

the mod you're using might be changing categories for clients and not shared/server ?

#

had an issue like this for Shops with betterSorting

humble oriole
#

it didn't work with Tool or Water Container though

sour island
#

there is a displaycategory and category

humble oriole
#

I tried both

#

print(getPlayer():getInventory():getItemFromType("Base.PropaneTank"):getCategory())

#

this returns just Item

#

so does Base.BlowTorch

#

strange

ancient grail
#

Static is the term used for the models that the player carries or uses

And the map are fix afaik excpt for vehicles

ancient grail
#

The animation set folders are hardcoded? Can i create a folder containing my own set?

#

Custom set of idle walk run sit etc

slate sable
#

what is module Base?
for sound ZombieSurprisedPlayer

rancid tendon
#

hey so

#

to anyone's knowledge, is there a full list of vanilla clothing GUIDs anywhere?

#

i'm putting together a bunch of zombie outfits and it's like, insanely annoying to have to dig around for GUIDs

#

.. actually wait i forgot my XML editor has a find function

#

can just use that to find them quickly in the fileguidtable i suppose

slate sable
#

All im trying to do is change a trait cost from 4 to 8 when I uploaded it I had 2 error boxes from doing so

#

or any cost within the vanilla traits

#

Im not sure if I have to rename the file name to a different name if that may cause problems im very new to script writing and references and such

#

it's originally named MainCreationMethod.lua

vast nacelle
# slate sable Im not sure if I have to rename the file name to a different name if that may ca...

If you have a file named the same as one in the base game files and in the same location, the base game file will get overwritten. Something you really shouldn't do unless you have no other choice. You want to limit how much you change the base game code so you don't break other mods.

All you need is a file named something unique and put in media/lua/client that has this and your trait will cost 8

    local trait = TraitFactory.getTrait("TheTraitName");
    trait:setCost(8);
end
Events.OnGameBoot.Add(changeATraitCost);```
humble oriole
#

Is there a way to "create" an item before placing it in an inventory? I'm trying to remove an empty bucket then place a new bucket in the inventory but I want to set the delta to 0 before placing it in the inv.

#

ah, inv:AddItem("Biofuel.BucketFertilizerFull",0)

#

that did it

vast nacelle
slate sable
humble oriole
vast nacelle
slate sable
finite radish
#

@sour island got the ball rolling, finally, just in case you got curious. it'll need lots of limiting code, and I'll probably have to move it from OnRenderTick to OnTick to avoid animations being slowed by the framerate (but I'll have to artificially slow them down, probably via a modulo on the tick delta). but I'm hyped that I got this proof of concept working either way. this takes blends_natural_01_64 and replaces it with the first 16 members of floors_interior_carpet_01, cycling forward a "frame" in the "animation" during every firing of the event. surprisingly not that rough performance-wise yet

(seizure warning)

humble oriole
#

yet
Eyes

finite radish
humble oriole
#

Are you making a disco dance floor? :p

#

what're you making?

finite radish
#

animated map tiles framework, more or less

#

that's just a proof of concept - the 16 carpet tiles I cycled through there could instead be 16 frames of an animation

vast nacelle
finite radish
#

entirely within the realm of possibility

fast galleon
#

yo if you have experience with animations, IS is looking for you.

finite radish
#

this isn't really the kind of "animation" they're looking for, lol

#

I'm also not an animator by any stretch of imagination, the most experience I have with that sort of thing is using Pivot Stickfigure Animator in like 2006 or something

drifting ore
#

couldn't you technically make a tv show or something that is actually watchable using that?

finite radish
drifting ore
#

figured lol...

zinc pilot
#

Hey, new question for some lua expert:
I've got a table described as follows

        Right_Hand = "RightHand",
        Right_LowerArm = "RightForearm",
        Right_UpperArm = "RightArm",

        Left_Hand = "LeftHand",
        Left_LowerArm = "LeftForearm",
        Left_UpperArm = "LeftArm"
    }```

If I try to iterate over it with `pairs` or `ipairs` it won't even loop once, I need to use a numeric for instead. Any ideas why?
drifting ore
#

i had a feeling it would get nasty after a handful of tiles

humble oriole
#

I'm still kinda new at lua myself so I can't say for certain, but it sounds like something that would be #justluathings

finite radish
# drifting ore figured lol...

I'm going to experiment a bit with .pack manip and spritesheet sizing to see what I can cook up, but I'm imagining I won't be able to bend the limits there very much. however, there's a lot you can do even if it's capped at 256 tiles - that's 256 frames for a single object, potentially. could even chain them together even if there is a limit, but it'd make your mod have a fairly large file size I'm sure

slate sable
# vast nacelle Oh, I guess there isn't a `setCost` function for traits. Weird. Professions has ...

so these are all the traits I want to change up, does this look accurate or do I have to write it differently?

    local trait = TraitFactory.addTrait("Graceful", getText("UI_trait_graceful"), 9, getText("UI_trait_gracefuldesc"), false)
    TraitFactory.addTrait("Cowardly", getText("UI_trait_cowardly"), -3, getText("UI_trait_cowardlydesc"), false);
    TraitFactory.addTrait("Clumsy", getText("UI_trait_clumsy"), -5, getText("UI_trait_clumsydesc"), false);
    TraitFactory.addTrait("FastLearner", getText("UI_trait_FastLearner"), 9, getText("UI_trait_FastLearnerDesc"), false);
    TraitFactory.addTrait("Inconspicuous", getText("UI_trait_Inconspicuous"), 7, getText("UI_trait_InconspicuousDesc"), false);
    TraitFactory.addTrait("Smoker", getText("UI_trait_Smoker"), -2, getText("UI_trait_SmokerDesc"), false);
end
Events.OnGameBoot.Add(changeATraitCost);
fast galleon
#

TV shows don't need to be exact copy, just make a few overlays and throw in a few memorable quotes.

drifting ore
#

talking about animating an actual tv show using tiles

#

tile by tile

zinc pilot
drifting ore
#

just a silly idea when i saw that

drifting ore
#

for me, what i can do is far greater than how i can do it easier using something i'm not familiar with ๐Ÿ™‚

#

getting there though

#

having a sick little 5 mins animated short

fast galleon
zinc pilot
fast galleon
#

another question, why does it work with numbers? must be a different table?

zinc pilot
#

I expected to get something out of

...
end```
but I can't print even a random print inside of it
zinc pilot
#

I work-arounded by using two different tables and a numeric for

#

so yeah, it didn't really work using a numeric for either (didn't really try)

#

ok, new question then, I tried running it on an online compiler and it works with pairs but not ipairs, why?

finite radish
#

or, uh, maybe index

#

but still

#

you have non-numerical keys, so it's not able to be used with ipairs

zinc pilot
#

Oh, didn't know about that

fast galleon
zinc pilot
#

makes sense

fast galleon
#

and ipairs only check ordered list

zinc pilot
#

alright, getting back to zomboid, is there a way to set a breakpoint from the menu without having it deleted when I get in game?

slate sable
ancient grail
neon bronze
#

Do the tiles use .pngs? Im not into tiles and such so ive no idea how it works

ancient grail
#

Watch daddy dirks vid

drifting ore
#

How could l overwrite them ?

worldly stone
#

Do i have to restart my dedicated server everytime I change a mod file on the ftp ?

finite radish
tardy wren
#

Can I have a sandbox option that's an integer?

vast nacelle
tardy wren
#

yay

#

does the order of items in the sandbox options matter?

vast nacelle
#

It determines the order they appear on the sandbox option menu

drifting ore
#

is there a way to disable zombie body part damage ?

#

So that they dont spawn with any damage to their bodies nor do any hits (visually) damage the bodies

#

I've got the damagemodeldefinitions but dont really see how it could be disabled

tardy wren
vast nacelle
tardy wren
#

okay

small topaz
#

I am still trying to figure out what this "server-client-communication" as explained here https://steamcommunity.com/sharedfiles/filedetails/?l=koreana&id=2735092774 is good for. Is there a simple (even oversimplified) example where this is needed?

Hey there! In this guide, I'll explain the client-server concepts and how they work in Project Zomboid. This guide is mainly aimed to modders who want to update their creations so that they work corre

rain iron
#

Hi, this might be a bit of an open ended question but how do I make a code which detects if a specific clothing has a flag which tells the game to replace idle animation to whatever the clothing flag says from the txt file?
Here's an outline of what the code will work like

Check current clothing
    If current clothing has flag on
        new_idle_anim = clothing.idle_anim
        Replace vanilla idle_anim with new_idle_anim
    Else
        Revert back to vanilla idle_anim
vast nacelle
# small topaz I am still trying to figure out what this "server-client-communication" as expla...

Any sort of interaction between players that is outside of what the game code already provides or when the client/server triggers something that needs to be completed on the server/client respectively.

Example: A barber mod that lets one player cut/style the hair of another

  • The client of one player can't directly change the player of another client
  • So Client A sends a message to the Server saying "I cut Client B's Player's Hair"
  • The Server then sends a message to Client B saying "Your player's hair has been cut" and Client B applies the change to their player
  • The other players will then see the change when Client B sends the next player update
small topaz
#

that's a nice example! thanks for explaining!

finite radish
#

yeah but what about sending events from server to server ๐Ÿค”

vast nacelle
# finite radish yeah but what about sending events from server to server ๐Ÿค”

That could actually be interesting, if a bit niche, feature to have added for creating a wider community server network.
Imagine having multiple servers running with each being loaded with entirely different maps and players can travel between each map by using interaction points that transfer the player's data to the other server and then cause the player to reconnect to that server.
World of Project Zomboid.

thick karma
#

You said it now you have to make it @vast nacelle

#

That's how this works.

finite radish
vast nacelle
finite radish
#

I wonder if there'd be a way to do raw TCP/UDP connections for stuff like that, and also for like SQL servers and shit

#

I haven't looked into much in that regard, not sure how much of that (if any) is exposed

#

I don't have any particular need for that sorta thing, but it's a neat idea

fast galleon
#

make an external add-on ๐Ÿ‘

finite radish
drifting stump
#

currently most player related stuff is client side making it impossible for servers to do that sync

#

would also need a custom server

thick karma
#

I won't bug y'all again about this (promise), but does anyone know whether the pathfinding behavior that is usually wrapped in a TimedAction can be executed successfully outside of a timed action?

#

Haha just hoping literally 1 person has already solved this but no worries if not.

drifting stump
#

i dont see why it wouldnt be possible

thick karma
#

Well I have been trying it and failing (for several hours tbh lol), so I was curious whether anyone ever had any success doing it. It seems to rely on two functions, but when I call them outside of the TimedAction, they do not behave as expected.

drifting stump
#

i havent tried it but there should be no reason for it to not work

thick karma
#

From within the timed action (btw I've already made an alt version of the vanilla WalkToTimedAction), you go self.player:getPathFindBehavior2():pathToLocation(self.goal:getX(), self.goal:getY(), self.goal:getZ()), and then in the update you go self.result = self.player:getPathFindBehavior2():update()

#

But if I try pathToLocation and then add update to OnTick, nada.

#

So there seems to be something unusual that update needs other than firing quickly.

#

But I don't know what it needs.

thick karma
finite radish
#

also, did you use the constructor?

#

if you want to totally divorce it from ISBaseTimedAction you'll also need to re-implement some functionality from it (if not all of it, if you're just copy/pasting)

I didn't check but I imagine there's some underlying functionality there

#

also might be worth looking at ISWorldObjectContextMenu.onWalkTo if you truly don't need it to be timed

ancient grail
ancient grail
finite radish
#

flag is just another term for a bool, in almost all cases

rain iron
#

to be clear I mean anything that is in the txt file of a costume that lua code can read as true/false

#

maybe as an additional tag or a new property

ancient grail
#

Moddata

#

?

rain iron
#

and then if true, then read a property that indicates which animation will replace the idle

faint jewel
#

fck moddata.

#

can't be on vehicles crap ๐Ÿ˜›

rain iron
#

and then, replaces the vanilla idle animation with the one from the the corresponding property

jovial harness
#

anyone knows what mod "SOTO" refers to ?

ancient grail
#

If item:getModData().flag == true then setVariables()

faint jewel
#

"Show Off The Octopus" ?

rain iron
#

The way variables work for animations is kinda confusing for me

ancient grail
jovial harness
#

Nevermind, it's Simple Ovehaul Traits and Occupations apparently

rain iron
#

That's really nice of you but I don't think I am free to collab right now

ancient grail
#

I actually read traits and octopus

rain iron
#

I appreciate your invitation tho

thick karma
# finite radish did you call `:start()`?

Wait isn't start a timed action function? I will revisit base timed action later but I couldn't figure out what it needs from there earlier. I did check.

And what constructor? I use a constructor for my timed action version but I am aware of no required Luaside constructor activity for the pathfinder functionality inside IsoPlayer objects.

thick karma
finite radish
thick karma
#

Sure yeah I'm just not sure exactly what from start I can call that isn't fundamentally a timed action....

finite radish
#

why wouldn't you want it to be a timed action?

thick karma
#

Context: I have made an autowalking mod. You can toggle autowalking on and off. However, because it's currently a timed action, you cannot do stuff that can normally be done while walking, e.g., eating, smoking, reading (if modded).

#

I would like the best of all worlds here if possible.

finite radish
#

why would you need pathfinding for that? PepoThink

#

you can't really pathfind without a target

thick karma
#

I target the squares shortly ahead of the player and continuously update it to keep you walking

finite radish
#

but why not just feign forward input instead?

thick karma
#

Mainly the joypad question, though I suppose I could reimplement keyboard input that way and work something out.

What I don't know is how to feign forward input on a joypad. I could not figure it out. Using the pathfinder seemed viable and the JoypadManager seemed inadequately exposed.

#

I could be wrong.

finite radish
#

there's a good bit in JoyPadSetup.lua that could be used to your advantage

fast galleon
#

A) Pathfind,
B) Update,
C) Teleport,

#

PUT

fast galleon
#

This game needs more trees, or remove animals if there are no trees.

finite radish
#

wym? there's a ton of different trees, and most of the playable map is forested woodland

fast galleon
#

I haven't loaded my save in a while because there are no trees around anymore.

finite radish
#

wat

fast galleon
#

Mr Axeman has nothing to chop ๐Ÿ˜ฆ

so unplayable, but it does send a message: stop chopping trees to not ruin the environment

finite radish
#

but the map is full of trees wtf

#

how many trees did you chop monkaw

fast galleon
#

sure, but now I need to trek to the next batch. What I haven't chopped, the horde on fire burned.

thick karma
#

I mean yeah I'm flexible about the solution. If there is an easy way to send a forward-movement signal on joypad that does not involve pathfinding, I'm all ears, but I can't find one.

worldly stone
#

If I update a lua file on my server, do I have to restart the server to test it ?

ancient grail
#

will this work ??

Events.OnPostDistributionMerge.Add(function()

    local vehiclesToDelete = {
        "Base.CarNormal",
        "Base.Ambulance",
        "Base.Sport"
    }

    local function removeVehicles(vehiclesToDelete)
        for key, value in pairs(VehicleZoneDistribution) do
            for vehicle, data in pairs(value.vehicles) do
                if vehiclesToDelete[vehicle] then
                    value.vehicles[vehicle] = nil
                end
            end
        end
    end
    
    removeVehicles(vehiclesToDelete)
    
end)
#

if i want to remove the example vehicles from the distrib

thick karma
#

Unsure, but I strongly suspect there's no need for making a global function called removeVehicles to do what you're doing

#

You could just loop through the vehiclesToDelete array above without creating a function just to call it with data that already exists locally @ancient grail

ancient grail
#

wait is this for optimization purpose? cuz i only need it to work

thick karma
#

Also it looks at a glance like you want to check whether a vehicle name (or category?) is a key in vehiclesToDelete?

ancient grail
#

i checked

#

debug

#

but idont know if im using the right event

thick karma
#

Oh yeah Idk sorry, I'm just not sure the connection between vehicle and vehiclesToDelete works how you think... If vehicle above is not an index (1, 2, or 3), vehiclesToDelete[vehicle] will be nil.

#

That doesn't seem to be your goal but idk

ancient grail
#

VehicleZoneDistribution.parkingstall.vehicles["Base.somecar"] = {index = -1, spawnChance = 2};
VehicleZoneDistribution.good.vehicles["Base.somecar"] = {index = -1, spawnChance = 2};
VehicleZoneDistribution.spiffo.vehicles["Base.somecar"] = {index = -1, spawnChance = 2};
VehicleZoneDistribution.ambulance.vehicles["Base.somecar"] = {index = -1, spawnChance = 2};
VehicleZoneDistribution.radio.vehicles["Base.somecar"] = {index = -1, spawnChance = 2};
VehicleZoneDistribution.massgenfac.vehicles["Base.somecar"] = {index = -1, spawnChance = 2};
VehicleZoneDistribution.parkingstall.vehicles["Base.somecar"] = {index = -1, spawnChance = 2};

#

cuz this is what it looks like

#

parkingstall, good, spiffo, ambulance etc

#
parkingstall
trailerpark
bad
medium
good
sport
junkyard
trafficjamw
trafficjame
trafficjamn
trafficjams
police
fire
ranger
mccoy
postal
spiffo
ambulance
radio
fossoil
scarlet
massgenfac
transit
network3
kyheralds
lectromax
knoxdisti
normalburnt
specialburnt

thick karma
finite radish
thick karma
#

This part of your code:

    local vehiclesToDelete = {
        "Base.CarNormal",
        "Base.Ambulance",
        "Base.Sport"
    }

needs to become:

    local vehiclesToDelete = {
        ["Base.CarNormal"] = true,
        ["Base.Ambulance"] = true,
        ["Base.Sport"] = true
    }
thick karma
#

WASD are locked during gamepad play

#

Also, I suspect if I spammed W OnTick, it might just make me stutter around... would have to test that theory, but I'm not sure if the game has other between-tick logic for stuff like movement on the Java side or not.

drifting ore
#

it would make you stutter

#

already tested that before

thick karma
#

โค๏ธ

drifting ore
#

i been silently checking out the controller stuff also lol

thick karma
#

So yeah, hence pathfinding, failing a better solution, to which I am entirely 100% open.

drifting ore
#

you got me interested

finite radish
#

e.g. if key.W == isPressedOrWhatever then moveForward()
you'd want the moveForward() bit, wherever that exists

thick karma
# ancient grail ok

Also, fwiw, I'm pretty sure this part of your code

    local function removeVehicles(vehiclesToDelete)
        for key, value in pairs(VehicleZoneDistribution) do
            for vehicle, data in pairs(value.vehicles) do
                if vehiclesToDelete[vehicle] then
                    value.vehicles[vehicle] = nil
                end
            end
        end
    end
    
    removeVehicles(vehiclesToDelete)

could be this:

    for key, value in pairs(VehicleZoneDistribution) do
        for vehicle, data in pairs(value.vehicles) do
            if vehiclesToDelete[vehicle] then
                value.vehicles[vehicle] = nil
            end
        end
    end

But you do you.

thick karma
#

Hold on that's weird code that might not be the right reference to Forward

#

Yeah might be the only reference though...

#
function MainOptions.loadKeys()
    getCore():reinitKeyMaps()
    MainOptions.keys = {}
    MainOptions.keyBindingLength = 0
    local knownKeys = {}
    -- keyBinding comes from keyBinding.lua
    for i=1, #keyBinding do
        bind = {}
        bind.key = keyBinding[i].key
        bind.value = keyBinding[i].value
        if not luautils.stringStarts(keyBinding[i].value, "[") then
            -- we add the key binding to the core (java side), so the game will know the key
            local bindNbr = tonumber(bind.key);
            if getCore():isAzerty() then -- doing azerty special keyboard, a=q, etc...
                if  bind.value == "Left" then
                    bindNbr = 16;
                elseif bind.value == "Forward" then
                    bindNbr = 44;
                elseif bind.value == "Shout" then
                    bindNbr = 30;
                elseif bind.value == "VehicleHorn" then
                    bindNbr = 30;
                end
            end
            getCore():addKeyBinding(bind.value, bindNbr)
            bind.key = bindNbr;
            table.insert(MainOptions.keys, bind)
            if getTextManager():MeasureStringX(UIFont.Small, bind.value) > MainOptions.keyBindingLength then
                MainOptions.keyBindingLength = getTextManager():MeasureStringX(UIFont.Small, bind.value)
            end
            knownKeys[bind.value] = bind
        else
            table.insert(MainOptions.keys, bind)
        end
    end

This is the only reference to "Forward" I can find in Lua files that include the word "binding" and aren't about "Fast Forward".

#

And it doesn't seem useful...

finite radish
drifting ore
#

i see options for moving to a vector, is that not how you are trying to accomplish, or have you tried?

thick karma
drifting ore
#

yep[

thick karma
#

But this command did not work for me

drifting ore
#

thats it

#

publicย voidย setMoveForwardVec(Vector2ย vector2)

thick karma
#

I tried getPlayer():MoveForward(getPlayer():getMoveForwardVec()) iirc

drifting ore
#

IsoGameCharacter:setMoveForwardVec(arg0)

thick karma
#

So I need to set one first?

drifting ore
#

probably its what the game does

#

there is other things like setting the direction as well

thick karma
finite radish
#

check what the game does, but if nothing else you should be able to get the facing vector and then add a number to one of the axes to extend the vector to your target

drifting ore
#

what crater is saying is kinda how i anticipated the controller working out

finite radish
#

not sure if there's a Lua pseudoclass constructor for Vector2, but even if there isn't you should be able to modify the individual members (X, Y, maybe getX() etc)

#

from one of the return values I mentioned above, if they return Vector2s

ancient grail
# thick karma Also, fwiw, I'm pretty sure this part of your code ```lua local function re...

OnDistributionMerge or OnPostDistributionMerge ???

Events.OnPostDistributionMerge.Add(function()
    local vehiclesToDelete = {
        ["Base.SmallCar"] = true,
        ["Base.SmallCar02"] = true,
        ["Base.CarTaxi"] = true
    }
        for key, value in pairs(VehicleZoneDistribution) do
            for vehicle, data in pairs(value.vehicles) do
                if vehiclesToDelete[vehicle] then
                    value.vehicles[vehicle] = nil
                end
            end
        end
    end
end)


--[[     to test
    local result = ""
    for key, value in pairs(VehicleZoneDistribution) do
        for vehicle, data in pairs(value.vehicles) do
        print(vehicle)
        result = result .. tostring(vehicle) .. "\n"; 
        end
    end
    Clipboard.setClipboard(result); 
    ]]
    ```
thick karma
#
Events.OnPostDistributionMerge.Add(function()
    local vehiclesToDelete = {
        ["Base.SmallCar"] = true,
        ["Base.SmallCar02"] = true,
        ["Base.CarTaxi"] = true
    }
    for key, value in pairs(VehicleZoneDistribution) do
        for vehicle, data in pairs(value.vehicles) do
            if vehiclesToDelete[vehicle] then
                value.vehicles[vehicle] = nil
            end
        end
    end
end)
#

Okay given p = getPlayer(),
print(p:getForwardDirection()) gives me a V2 with my forward direction... I then try
p:setMoveForwardVec(p:getForwardDirection())
and
print(p:getMoveForwardVec()) gives me a V2 with (X = 0, Y = 0), (L = 0, D = 0), so clearly it's getting immediately reset if it's set...

#

Not sure how to manually trigger a move from there... Tried MoveForward with the various values available in a V2 and nothing.

#

@finite radish @drifting ore Lemme know if y'all have any more good idea... I am gonna be busy awhile but I will be back at it later. If there is any possibility at all that I can just fire a forward walking signal, I would obviously prefer to do that than use pathfinding for the autowalk function for many reasons.

#

Alternatively, pathfinding workarounds that do not require timed actions are welcome.

drifting ore
tardy wren
#

Can I have my sandbox options come with a description on mousing over?

bronze yoke
#

yes, just add another translation string with _tooltip added to the end of the translation string name

tardy wren
#

Neat

#

Will be great once I figure out why one mod loaded the translation while the other one didn't

drifting ore
#

most issue with translation show in console if it's not correct

tardy wren
#

thanks for the tip

#

How do I see the console in debug mode?

drifting ore
#

i actually run the game from .bat file so it's always on my screen

#

you can see most from the box in bottom left tho

finite radish
#

even when you don't run it from the batch, it should be open by default

drifting ore
#

the logs

finite radish
#

yeah that's the console, more or less

drifting ore
#

can also enter lua stuff there also

finite radish
#

there's also the lua console with tilde, and F11 opens the breakpoint debugger

drifting ore
#

oh i didn't know that tilde thing lol

tardy wren
#

Oh, as in in-game>

drifting ore
#

yes in in

#

otherwise you just use the console file

tardy wren
#

I haven't gotten past the sandbox options screen

drifting ore
#

oh lol...

tardy wren
#

Well I am trying to fix an error with my translations not loading

drifting ore
#

did you define the translation name in the sandbox file?

tardy wren
#

yes

drifting ore
#

you said you got one working and one isn't?

tardy wren
#

yes

drifting ore
#

share them both lol

tardy wren
#

One mod works, one doesn't

drifting ore
#

file should be small for translation

#

not both really just the bad one

#

it's pretty striaghtforward so the problem should be obvious between the sandbox-options.txt and the sanbox_en.txt or whatever language you are using

tardy wren
drifting ore
#

yep

#

missing

tardy wren
#

Missing what?

drifting ore
#

oh wait im dumb

#

share your sandbox options

tardy wren
small topaz
#

In vanilla folder lua/server/recipecode.lua, there is a function called CannedFood_OnCooked and the beginning lines including comments are this:

-- you cook your can, now set the correct food age/max age
function CannedFood_OnCooked(cannedFood)```

Does anyone knows where this "Food.update()" can be found? I searched all files in lua with a search program and didn't find anything so far...
tardy wren
pulsar heath
small topaz
pulsar heath
#

if you follow that guide, it will make your life easier

#

i wasnt using it as well

#

but since i went throught the trouble of setting it up... a lot easier to find what you want

#

and its not that hard to do, and the guide is very easy to follow

drifting ore
#

mentioned 1 time in a comment

pulsar heath
#

food.update() is to be called on a food object i guess

tardy wren
#

Wasn't there some guide to translations

small topaz
# drifting ore mentioned 1 time in a comment

Yeah. That's exactly what I found out via automated searching. Point is that the update might still be called somewhere in the lua code but then with smth like "item:update()", "x:update()" or anything like that. Problem is that it is impossible to quickly search and find it because just searching for "update()" gives hundreds of results (and item:update() does not give the "update" command I am looking for btw - already checked ofc)

pulsar heath
#

thats why following that guide is usefull

#

easier do look for whats available and have an idea of how it works

small topaz
pulsar heath
#

all i know is since a lot of ppl in here told me to do it, and i dit

#

my life got a lot easier

#

i still ask a lot questions but not as many and not as dumb ๐Ÿ˜„

bronze yoke
#

isn't update just every tick?

pulsar heath
#

i think so but im not sure

#

since it handles the freezing and age of the food

#

its probably every tick

#

or to be correct on every minute

small topaz
#

Problem is that my food.update() may or may not be called in lua. It has probably smth to do with "food" ;). Now there are dozens of chunks of lua code which are related to food and they are scattered through different parts of the code. Question is whether reading the java code will tell me anything more precise where to look. I am afraid that the java code may not tell me more than what I already now (namely that it is related to food and possibly called somewhere where food is relevant... )

#

but as a last resort, might be worth a try...

pulsar heath
#

99% of my errors are typos... dang it... it could be worse...
ExceptionLogger.logException> Exception thrown se.krka.kahlua.vm.KahluaException: TWEEVENTS_Events.lua:89: ')' expected near `then

bronze yoke
#

i doubt it is ever called from lua

#

it doesn't really make sense to

pulsar heath
#

dunno, but its exposed which means you can run it i guess

#

and try it out

bronze yoke
#

if you really need to know, hook the metatable to print or something and play for a bit

#

no prints means it's never called from lua

small topaz
drifting ore
#

yea i wonder what you are trying to accomplish

small topaz
#

The function CannedFood_OnCooked is in server. In this function, I need the player who actually cooked the food. Problem is that the function does not have the player as argument and just using getPlayer() will probably not work in multiplayer since it may mess up stuff related to server-client things (or am I wrong...??)

#

But have already some ideas to work around...

finite radish
finite radish
tardy wren
# tardy wren

Hmm... So, any clue as to why my translation doesn't get loaded?

finite radish
# small topaz wdym?

I mean that you should probably listen to the comment there, because it's spelling out for you in all caps that it isn't to be used a recipe callback

tardy wren
small topaz
#

my mod needs to modify this particular function but needs some player data for it. there is no way around for what I want to do...

bronze yoke
#

i don't really see a way to grab the player from it

finite radish
#

you shouldn't be accessing the player from that code, otherwise it'd have the player as an argument

#

(see again: the comment I posted)

small topaz
tardy wren
#

Why exactly?

small topaz
#

totally aware that it is not related to recipes

finite radish
#

yes, but you're using it like it's a recipe callback, and that's clearly not what it's for

small topaz
#

not sure... maybe we misunderstand each other

#

but no problem ๐Ÿ™‚

finite radish
#

I think you just misunderstand the code in question, and you're ignoring the warning put there in all caps by the devs lmfao

bronze yoke
#

when it comes to modding you use whatever you can find

fast galleon
#

can you explain what you want to do?

small topaz
#

in fact, what I want to do already works completely fine in singleplayer but I just have the ambition to get it working for mp too. so I just play around with code a bit more

small topaz
# fast galleon can you explain what you want to do?

yes: This function sets the durability of a jar when it has been cooked. I want to change the durability and making it last longer when player has a high cooking skill. So I somehow need the cooking skill of the player who actually cooked it.

#

My current idea is now to figure out where the "cooking" can be catched on the client side and there put the players cooking skill as modData to the jar. The jar is then accessed in server (that's part of the vanilla code). So I hope that I can simply grab the mod data there and have my cooking skill where I need it....

bronze yoke
#

is there even a concrete 'player who cooked this' though?

#

i think the best i could do is to keep a reference to the player on the item when they put it into the oven

small topaz
tardy wren
#

But you can get the food, right?

#

Can;'t you hop from the food to the player?

small topaz
fast galleon
bronze yoke
#

so keep the cooking skill as moddata on the item

finite radish
bronze yoke
#

how is that determined?

#

is it who turned on the oven?

pulsar heath
#

hmmm i thinkg that only applies when you make food

#

like a salad

#

or something in a frying pan

bronze yoke
#

since cooking isn't interactive i can't think of a flawless way to keep track of who cooked it

small topaz
small topaz
finite radish
finite radish
bronze yoke
#

had a look, vanilla just loops through the player list until it finds someone with the same name as the chef field

#

i would copy that for consistency

finite radish
#

oh, to actually get the player from the chef field? that makes sense, yeah.

bronze yoke
#

yeah, that's how it decides who to give xp to

small topaz
#

that's also a philosophical question: who is the cook? the one who puts in the oven? the one who turns the oven on? or the one who takes it out of the oven?? XD

#

I hate multiplayer!!! XD

finite radish
#

i am the one who cooks

bronze yoke
#

if i wanted to be real ๐Ÿค“ about this i could point out that if two online players have the same character name one of them will be unable to gain xp from cooking in the oven, and the other will gain their xp instead

finite radish
tardy wren
#

I have figured out why my translations weren't working

finite radish
#

the cooking code doesn't actually fire until food:update() is called, upon which it actually iterates over the player list using the chef to give the XP

tardy wren
#

I didn't add a comma after the translation option

small topaz
finite radish
# small topaz where is this code from? from lua?

yes, although setChef() and getChef() are Java methods belonging to the Food class. they're never used in Java though, only in that one spot (and it runs a lot, hence the comment saying it's hacky)

#

every time you move a food item from one place to another (bag into inventory, inventory into microwave, inventory to floor, etc.) it assigns the Chef field via those methods

#

it only actually uses the field if the food is successfully cooked though, in order to grant XP

#

and that occurs inside Food:update()

fast galleon
#

interesting, make it a bit more realistic. get the chef player and check if he's close / doing other things

tardy wren
#

Okay, uh... I updated my mod on the workshop but the description was overwritten...

small topaz
#

getChef() is definitely also interesting for my purposes... but still have to mess around with interface interactions on the client side to apply this in the right moment...

tardy wren
#

I uploaded it with a placeholder description, then made it proper on Steam...

#

Can I somehow roll back to the previous description?

finite radish
# small topaz getChef() is definitely also interesting for my purposes... but still have to me...

it's not going to be easy, most of the real code that handles the cooking itself (before, during, and after) occurs within the update loop of the Food class itself. you can modify some of the variables it uses within that function, but there's no exposed way to insert your code into that process that I'm aware of. look into :setOnCooked() and :getOnCooked() though - there's a string that may actually be a callback. not sure how that interacts with the _OnCooked function you've been trying to use.

bronze yoke
#

seems like hooking the _OnCooked function is the easiest way to do this, seems basically perfect for your uses and we've worked out how to get the cook anyway

finite radish
#

true, maybe? depends on what you're trying to do. I can't even find any references to that function anywhere, so idk

#

like, you might wanna make sure CannedFood_OnCooked is called at all in the first place

bronze yoke
#

it is

small topaz
#

I have a much simpler idea now: I simply declare the guy who crafted the jar as chef! then I add the relevant data to the jar's modData in the "recipe.onCreate.Jar(...)" function (which happens to have the player as argument!

finite radish
#

oh, it's a script thing, RIP

#

I don't have scripts in my workplace, need to fix that PepeHand

fast galleon
finite radish
#

this is what I meant by XY problem

bronze yoke
#

make the jar last longer based on the cook's level

fast galleon
#

can't he do than when he jars it?

small topaz
finite radish
#

yeah, jarring isn't even cooking. it's a crafting recipe, isn't it?

#

why not just use the crafting callback?

bronze yoke
small topaz
small topaz
bronze yoke
#

yeah that sounds like the best way to do it

finite radish
#

why not use the crafting callback to set the values, then use the values to assign the duration in the OnCooked callback? or is that what you're saying?

#

(how you'd actually pass the values isn't immediately obvious to me, but there'd be plenty of ways to do it I imagine)

finite radish
#

okay yeah, we're on the same page now then. that should work in theory

small topaz
fast galleon
finite radish
small topaz
# fast galleon I don't know... you typed function with player

in case you are interested, here is what I am going to do now:

step 1: craft jar; add the player's cooking skill to the jar's mod data (should be possible since the recipe.onCreate seems to have the actual player as argument)

step 2: when the jar is cooked, retrieve the mod data and adjust the jar's durability (should hopefully also work; the CannedFood_OnCooked has the jar as argument)

finite radish
#

probably won't make a big difference either way though

small topaz
#

anyway, thanks for all the suggestions and discussion. has definitely helped to clarify the problem for me!

fast galleon
#

ok this is nice

#

Hopefully in future jars have different fresh days based on what's inside

small topaz
# fast galleon Hopefully in future jars have different fresh days based on what's inside

I think this is already the case in vanilla. The pz wiki states that days fresh are always 60 days but this is not true. The time it is fresh is scaled according to the fresh time of the original food item. For example, cabbage is 2 days fresh and rotten after 4. The resulting jar is 45 days fresh and rotten after 90. (So in any case 50% of the overall durability, it is fresh.)

fast galleon
#

ah, you have a point. They might have same fresh days but the starting age % is lower because the ingredients lose freshness faster.

sour island
#

Modular jarring would be neat

#

Seeing multiple items for different jarred foods or fluids feels like a bad approach with scaling content

fast galleon
#

do we have marmelade? I don't see it

bronze yoke
#

at least fluids are getting redone

sour island
#

Jam, jelly, marealade, and pickled stuff would be fun

fast galleon
#

item JamFruit ๐Ÿ‘

sour island
#
  • soaking stuff in liquor
#

Are jams and marmalade the same?

small topaz
small topaz
fast galleon
#

just learned there are both Marmalade vs Marmelade

sour island
small topaz
fast galleon
#

or wait no, just wrong spelling

#

they put that part at end of wall text

sour island
small topaz
sour island
#

The onRecipe for unjarring stuff also doesn't return the lid

#

I think that one is a bug/oversight

small topaz
small topaz
sour island
#

Just a heads up- easy bonus feature ๐Ÿ˜…

jagged ingot
#

Oh hi. @sour island A workshop mechanic?

#

Neato.

sour island
#

Yep, since I'm in here often enough ๐Ÿ˜…

finite radish
#

is a tick length defined, or is it variable based on performance? i know it's not tied to framerate, but I'm curious if CPU cycles etc. affect the delta

drifting stump
drifting stump
red tiger
#

Hello. Decided to join here again. o/

drifting ore
thick karma
drifting ore
#

i dont think it does

#

let me double check quick. doing 3 things at once but i will forget if i dont let it out now lol

pine tree
#

so uh, chatgpt is incredibly useful for debugging wtf

pulsar heath
#

ahhahah some things never change....

#

trying to catch an error

#

and apparently nothing was wrong

#

then i found it... fater like 50m...

#

had Print

#

instead of print

#

.........................

finite radish
#

imagine using a language that throws useful exceptions

pulsar heath
#

i dont like lua tbh... flexible, "easy to use" but...

#

debuggin' is a pain

finite radish
#

lua and java are both dogshit

pulsar heath
#

so is python ๐Ÿ˜„

finite radish
#

fax

#

actually if I'm doing scripting and batch shit, or static regex, python is great

#

but the syntax is trash

pulsar heath
#

hmm this is driving me nuts

#
        local playerChar = getPlayer()
        --local currentTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)
        print("-----Checking timer trait-----")
        print("Current time: " .. pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE))
        print("Finish time: " .. tostring(TraitEndTime))
        if TraitEndTime <= (pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)) then
            player:getTraits():remove(tempTrait);
            HaloTextHelper.addTextWithArrow(player, getText("UI_trait_"..TWEtrait), false, HaloTextHelper.getColorRed())     
            Events.EveryOneMinute.Remove(TWE_TraitCheck)
        end
end```
#

this is a function that check if the timer ran out

#

but the current time never changes...

#

if i run it manualy it does...

#

inside the function that is added as an event

#

doesnt change the value..

#

wth am i missing here?!!?!?

pine tree
#

i asked the magical all-knowing website and this is what it gave me, its probably crap, but maybe youll have some use of it:

pulsar heath
#

he just added a check for null?!

vast nacelle
pulsar heath
#

if i run a function that just prints the current time it works fine

#

thats why im confused

bronze yoke
#

the explanation it gave is also nonsense

pulsar heath
#

the null check is not needed... since im the one sending the values so...

#

i only need to do local pzCalendar = PZCalendar.getInstance() once

#

everytime i call pzCalendar:get(Calendar.HOUR_OF_DAY) or pzCalendar:get(Calendar.MINUTE)

#

it will get the correct time

#

but for some reason it doenst work on that function

#

guess im gonna make a time printing funciont and add it to oneveryminute and see if it does the same... for the 300th time ๐Ÿ˜„

pine tree
#

more nonsense

pulsar heath
#

you have to give it context

#

like tell it to ignore only being called once since the game has a tool that does it

#

and if youre lucky in a few hours youll get somewhat of a decent reply

#

๐Ÿ˜„

astral dune
#

I love how authoritatively chatGPT talks about stuff while being completely wrong.

pulsar heath
#

well if nothing else he would be a good politician

#

even if wrong, it acts like he is absolutely right

pine tree
#

it works pretty well if it has access to a set of libraries but i tried feeding it libraries and it wouldnt accept it

quiet lodge
#

Would anyone here happen to have or know of any resources on modding for splitscreen?

drifting ore
#

by the time you get to the end of the tokens that are saved. it will start going back tp spitting nonsense

#

like incoherent nonsense, not nonsense that seems like it makes sense lol

#

best bet is if you use the api and train it using a parsed version of the api

#

both java and lua

#

then you will technically just be able to tell it to make a script and it would be able to do at least 60% without error

#

maybe more

#

im gonna waste some money training it and see how it goes

pine tree
#

^ yeah thats it. it can understand context but only for so long, then it starts forgetting

drifting ore
#

if anyone has ever fully parsed the newest PZ api and has it even remotely cleaned up, i would be willing to share it after i train it

#

i will probably share anyways via some discord at some point if it's not a complete fail

pulsar heath
#

welll at least i learned something out of this... pz log splits every 10 mb ๐Ÿ˜„

limber oar
#

Is there a community consensus yet on how to effectively handle BodyLocations.lua? I know that overwrites are generally a bad idea, and you run into trouble with other mods trying the same thing. But I can't find an agreed-upon method for adding items to the render list without causing this issue.

I know Soul Filcher wrote a system to mitigate this, but that only works with other mods using that same system, right?

pulsar heath
#

for some reason if its added to events.everytenminutes or whatever i wanna use

#

doesnt update the value of the current time...

#
print("End time: " .. TraitEndTime)
print("Current Time: " .. PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE))
Events.EveryTenMinutes.Remove(clocktick)
Events.EveryTenMinutes.Add(clocktick)
end```
#

the value doesnt change

sour island
pulsar heath
#

i run a similar function without adding it to the events

#

and everytime i call it, it update properly

sour island
#

There's a few mods on the workshop that break body locations which causes a bug in tooltips too.

limber oar
#

That'd generally be my position as well; SF's Dressing Time has been out for a few years now without the method seeming to have been widely adopted, though, so I was curious if that was still a method worth pursuing or if people have moved on to a better solution. Sounds like there isn't.

devout flint
#

Getting some progress on my mod, next step is to manage to craft and place the item I created.

I feel like I'm so slow on stupid stuff, it's been a while since I have learned modding this way x)

sour island
#

The values are a part of a table and need to be in order right? You can't modify parts of it?

#

I vaguely recall trying to resolve the tooltips issue and identify the mods breaking them but they hard overwrite the files so the system registers it as vanilla

limber oar
#

Right, you can't inject things where you want them. You can reorder the categories but that requires a full overwrite.

sour island
#

If it's a table you should be able to shift it around but I haven't looked at it in a bit

limber oar
#

I don't even think it's a traditional table because if it was you should be able to insert things with usual table manipulation.

sour island
#

There's cross referencing functions right?

#

You can add to the list but there's no remove or replace?

#

I faintly recall it now

limber oar
#

Correct (I think). All you get is getOrCreateLocation()

#

Which appends new locations

#

There's no way to insert something, e.g. between UnderwearBottom and UnderwearTop

#

Soul Fincher mitigates this by turning it into a table

#

So that other people using his system can now use standard table index insertions, etc. to mess with it

sour island
#

Clever

#

I think there's a reset too but it doesn't cover all the basis

limber oar
#

Yeah, it looks great, but if there's another mod that does the standard "just overwrite BL.lua" then you're screwed

sour island
#

Unfortunately that's true for most mods though

limber oar
#

What this really needs is dev implementation, honestly, but until then it's rock vs. hard place

sour island
#

It's still better to use friendlier APIs even if it does break

limber oar
#

Agree

astral dune
limber oar
#

In lieu of any other option I'd rather be "the friendly mod that got overwritten by the nasty overwrite mod" than "the bully mod that overwrote everyone else's file"

sour island
#

Undo Mask Exclusion for sure

#

I think there's an anime outfits mod too

astral dune
#

I do always run that mask one

sour island
#

There's an updated one

drifting ore
#

are you just trying to create new bodylocations?

limber oar
sour island
#

The old one should really be removed from the workshop or unlisted -- that tooltips bug is so innocuous and hard to track down without decompiling the java

astral dune
#

the fact that you can ask "which anime outfit mod for this gritty zombie survival game" is funny af

sour island
#

The newer attachment mod I think also had it -- I couldn't even get that one to work so I gave up

astral dune
sour island
#

Yes

#

I made a mod that patches missing body locations to fix the tooltip

#

It's not ideal at all tho

#

I assume it causes issues with rendering as I was told the order is important?

limber oar
# drifting ore are you just trying to create new bodylocations?

I'm currently rearranging existing locations, but a better solution would be to create a location in the right area so that it doesn't mess w/ vanilla functionality; the issue I'm trying to solve is that swimsuits render beneath underwear, and afaik there's no way to turn off underwear spawns per-outfit, so you get zombies walking around in one-piece swimsuits with bras and panties over top

#

Of course the hacky solution is just to move my swimsuits to a different, higher-rendering location, but this is actually an issue that affects vanilla clothing as well as mine

drifting ore
#

cant you just make your own file and add to it and declare render order where you want?

#

and just add to original without overwrite?

limber oar
#

Nope

#

That's the whole issue with BL.lua

#

It doesn't play nice like the other tables

#

You can't insert into it without a full overwrite; you can only add a location to the end of the list, but since rendering is order-dependent, that's no good unless you want your new location to appear above every other clothing item in the game

sour island
#

Yeah that needs a couple new setters/inserters

thick karma
#

Clothing needs a layer priority system.

pulsar heath
#

well, tired of messing around and things not making sense... guess ill just time the durantion of the trigger from outside the game

#
LOG  : General     , 1674083679654> Starting clocktick
LOG  : General     , 1674083679654> End time: 1394
LOG  : General     , 1674083679655> Instance Current Time: 1393
LOG  : General     , 1674083679655> Tempvar Current time: 1393
LOG  : General     , 1674083694607> End time: 1394
LOG  : General     , 1674083694608> Instance Current Time: 1393
LOG  : General     , 1674083694608> Tempvar Current time: 1393
LOG  : General     , 1674083719511> End time: 1394
LOG  : General     , 1674083719512> Instance Current Time: 1393
LOG  : General     , 1674083719512> Tempvar Current time: 1393
LOG  : General     , 1674083734444> Traits Triggered
LOG  : General     , 1674083734444> Starting clocktick
LOG  : General     , 1674083734445> End time: 1394
LOG  : General     , 1674083734445> Instance Current Time: 1393
LOG  : General     , 1674083734445> Tempvar Current time: 1393
LOG  : General     , 1674083744413> End time: 1394
LOG  : General     , 1674083744413> Instance Current Time: 1393
LOG  : General     , 1674083744414> Tempvar Current time: 1393```
#

i could leave it running for hours and still no change

drifting ore
#

im trying to think on it without having to have you explain too much of the basics of it. is render-order predefined and not editable whatsoever outside of vanilla bodylocations?

#

or if you do it's always on top

limber oar
#

I'm pretty confident it's not just something I'm missing because every other mod that needs to do something similar, including some written by people much better at this than me, has resorted to the same blunt-force overwrite method. (SF's aforementioned API notwithstanding.)

But yeah, the render order is defined by the order in which locations are declared, and once the location is declared there's no way to insert something before it without redoing the whole process (i.e., overwriting the file).

pulsar heath
#

so, from my understanding, when you add a function to a event ex Events.EveryOneMinute.Add(function), the vars inside that fucntion cant be updated ?!?!?! Like it runs a "snapshot" of the values inside and they cant be changed?!?

astral dune
#

depends on how you implement it

pulsar heath
#

?

#
print("End time: " .. TraitEndTime)
print("Instance Current Time: " .. PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE))
print("Tempvar Current time: " .. tempVar)
Events.EveryTenMinutes.Remove(clocktick)
Events.EveryTenMinutes.Add(clocktick)
end```
astral dune
#

if the function you pass to the event is a closure you can definitely have access to the data

pulsar heath
#

even i change the value of the tempVar

#

it retains the previous value

#

no matter what i try

#

plus PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE) outside the event always returns the correct value when time changes

#

but when inside the function in the event... the value never changes no matter how long has passed

#

in my stupidity i've tried using an tempvar that another function updates

#

doesnt work when called from inside the function in the event

#

it works when i just call it myself

#

so im at a loss

#

so the function goes static?!

#

when added to a timed game event?!

#

well screw the events in the game, using an external timer... one whole day trying to figure this out, something that should be simple anywhere else... in pz lua is a pain in the bottom

astral dune
#

I'm sure it is simple, you're just overlooking something

thick karma
#

What are you trying to trigger EveryTenMinutes? Where is tempVar declared?

pulsar heath
#

dude theres like 5 lines of code...

#

ignore the tempvar

#

that was a try to solve it

thick karma
#

What is your goal?

pulsar heath
#
print("End time: " .. TraitEndTime)
print("Instance Current Time: " .. PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE))
Events.EveryTenMinutes.Remove(clocktick)
Events.EveryTenMinutes.Add(clocktick)
end```
this should work
#

timervalue in minutes is set to 5

TraitEndTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE) + timervalue

#

then i get the time the event is triggered from twitch

#

all goes well so far

#

then

#

that function i only made for testing since it wasnt working on the real function i want to use, so i made something simple to track the changes in the values which is the clocktick above

#

the full code should be

        local playerChar = getPlayer()
        --local currentTime = pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)
        print("-----Checking timer trait-----")
        print("Current time: " .. pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE))
        print("Finish time: " .. tostring(TraitEndTime))
        if TraitEndTime <= (pzCalendar:get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE)) then
            player:getTraits():remove(tempTrait);
            HaloTextHelper.addTextWithArrow(player, getText("UI_trait_"..TWEtrait), false, HaloTextHelper.getColorRed())     
            Events.EveryOneMinute.Remove(TWE_TraitCheck)
        end
end```
#

but it it doesnt update the values in the clocktick i made just to print the time

vast nacelle
#
function clocktick()
print("Instance Current Time (stale): " .. PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE))
print("Instance Current Time (fresh): " .. PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY) *60 + PZCalendar.getInstance():get(Calendar.MINUTE))
end
Events.EveryTenMinutes.Add(clocktick)```
```[18-01-23 17:33:59.246] LOG  : General     , 1674084839246> Instance Current Time (stale): 1052.
[18-01-23 17:33:59.246] LOG  : General     , 1674084839246> Instance Current Time (fresh): 1053.
[18-01-23 17:33:59.863] LOG  : General     , 1674084839863> Instance Current Time (stale): 1052.
[18-01-23 17:33:59.863] LOG  : General     , 1674084839863> Instance Current Time (fresh): 1053.
[18-01-23 17:34:00.495] LOG  : General     , 1674084840495> Instance Current Time (stale): 1052.
[18-01-23 17:34:00.495] LOG  : General     , 1674084840495> Instance Current Time (fresh): 1054.```
#

Like I told you. pzCalendar is only ever instantiated and never updated.

#

get(property) just gets the value that was set when it was last updated either through getInstance or getCalendar

pulsar heath
#

print("Instance Current Time: " .. PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE))

print("Instance Current Time (stale): " .. PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE))

#

i have the sime

#

same

#

and changed it after you told me that

vast nacelle
#

You're comparing it to the stale print

#

The fresh is the one that is updating correctly

#

Because it's using PZCalendar.getInstance instead of pzCalendar to get the minute

pulsar heath
#

dang it...

#

didnt update the minute bit...

#

...............

astral dune
#

it only updates when getInstance is called? haha thats definitely not intuitive

pulsar heath
#

didnt change this bit pzCalendar:get(Calendar.MINUTE)) ....

vast nacelle
#

Also, I think its giving real world time. Because even on max time setting, it still took a minute RL for it to change.

pulsar heath
#

i know that

vast nacelle
#

Ah, okay then.

pulsar heath
#

thats the point ๐Ÿ™‚

#

and done...

#

everything works...

#

uff

#

thanks @vast nacelle

neat totem
#

Can anyone assist me with uploading to steam workshop? Ive followed all the steps properly and have it matching a guide exactly but when I go to upload ingame it throws the error that there is no preview.png which it is present in the mod folder with the Contents folder and Workshop.txt

drifting ore
#

256x256 exactly

neat totem
#

hmm I sent it through a program to make it that exactly

#

size wise

#

obviously it must be wrong

drifting ore
#

yep

neat totem
#

thank you Nippy Ill report back

drifting stump
sour island
#

I'm still debating on separating the patch / framework / debugTools tbh

#

I've been going back and forth in my head lol

drifting stump
#

my idea hasnt changed

sour island
#

I'm probably over thinking it - but chances are the patch may need the framework to some degree

drifting stump
#

patch standalone
framework + debug tools are one workshop mod and 2 ingame

sour island
#

I was thinking the easiest to handle github wise would be 1 workshop 3 in game

drifting stump
#

i guess only difference would be download size

#

still gives the option of enabling or not the patches

sour island
#

yeah for sure

#

Maybe I'm not the right person to ask about download size ๐Ÿ˜…

#

I'm no 30GB brita but...

#

it's only 5MB

drifting stump
#

That alone is probably larger than all my mods XD

humble oriole
#

Do you guys know how to set the container icon for an isoObject? Is it part of the tile definition?

sour island
#

there's a lua file for it

#

let me see if I can find it

craggy furnace
drifting stump
#

roughly remember it getting the container texture from the object name

sour island
#

It's hard defined

drifting ore
#

they are right but also you can change container type in the properties and it will cahnge it

#

as long as you are using what they got ๐Ÿ˜„

sour island
#

You can also define new ones too

drifting ore
#

well that would make you extra cool

drifting stump
#

Ah yeah that was it container type

#

Just a string you can change to anything

sour island
#

speaking of cool

#

pulled my ehe debug tests out of general debuggers addPanel process

#

had to make my own page UI for buttons

#

going to take this into debug tools - I'm thinking of a control board layout that you can drag and drop buttons for a custom layout

snow hound
#

Stupid question but i just wanted to confirm since its been years since i last touched lua
Using itemtweaker, for each property i want to change, i just basically need to tweak them one by one right?
Example: if i wanted M14s to have piercing bullets, it would be like TweakItem("Base.AssaultRifle2","PiercingBullets","TRUE") or am i doing something wrong?

sour island
#

Yes, but you should probably not use ItemTweaker tbh

#

internally it just uses doParam

#

itemTweaker afaik causes problems with MP since it's on client-side

worldly stone
#

what am i doing wrong here ?

jaunty marten
#

@sour island do u know is there any way to create panel with web page content? I mean like web-browser feature

true vault
#

Any way to set a specific generator to be "infinite"? Assuming the exact placement is known.

sour island
jaunty marten
sour island
#

hmm?

jaunty marten
#

I tried to find how to create web content in pz but nothing

#

sad unhappy

drifting stump
#

Any networking besides with the server is disabled

#

You cant read web content

red tiger
#

An API method for opening a URL has been broken due to a JVM flag passed when launching the game.

sour island
sour island
red tiger
sour island
#

OpenUrl works though?

#

It also handles local file directories (sort of)

jaunty marten
red tiger
#

loadstring() + seever-side server commands - separate process + file reader = ghetto http service.

red tiger
drifting stump
#

What he wants is to straight up render a web page ingame

red tiger
#

Yuuuuup

sour island
red tiger
#

Or you could just write UI with custom HTML and CSS for pz

sour island
#

the open URL uses local browser too - not even Steams (for better for for worse)

drifting stump
#

Doesnt openurl just open it in steam overlay

sour island
#

Doesn't for me

sour island
#

default browser for computer

jaunty marten
#

ah

red tiger
#

That's the offending JVM arg

#

I reported this issue and got a silly response

#

Used to use openURL() to make a discord invite button on my server

#

It's a useful API call and it needs to be fixed. This is the fix......

jaunty marten
#

poor in-game console and no web content feature

#

really pain in da ass

#

rn just doing code in real ide and just reload the file in-game

#

very cool

red tiger
#

Real ide?

jaunty marten
#

I mean not in game

#

but on my pc exactly

#

just ide

#

heh

red tiger
#

I use vscode for both vanilla Lua mods and Typescript mods.

jaunty marten
#

me too

red tiger
#

IntelliJ IDEA for Java modding.

#

Used to use eclipse with my CLI fernflower ...

#

I have decompiles of PZ from build 31 lol

jaunty marten
#

I want web in-game ide at least for tab feature..

jaunty marten
red tiger
# jaunty marten meme

Well I'm unironically building CSS and HTML render engine in PZ so I think that you might be interested in that. XD

jaunty marten
jaunty marten
red tiger
#

Heheh

#

Imagine building radial menus with <select>

jaunty marten
#

Imagine textures as web content

red tiger
#

I just worked on a Java mod that implements what's needed for backdrop-filter

jaunty marten
#

Althought I think for pz it's not so useful

red tiger
#

Response UI in PZ would be insane

jaunty marten
#

pz build 77

#

new era

pulsar heath
#
    local player = getPlayer()
    local currentTime = 0
    local hour = PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY)
    local minute = PZCalendar.getInstance():get(Calendar.MINUTE)
    local second = PZCalendar.getInstance():get(Calendar.SECOND)
    if hour == 0 then --check if its 0, if true replaces 0 with 24
        currentTime = (24 * 60 + minute) * 60 + second
    else
        currentTime = (hour * 60 + minute) * 60 + second
    end

    for i, v in ipairs(Traits) do
        local trait = v.trait
        local endtime = v.endtime
        if endtime <= currentTime then
            player:getTraits():remove(trait);
            HaloTextHelper.addTextWithArrow(player, getText("UI_trait_"..trait), false, HaloTextHelper.getColorRed())     
            Events.EveryOneMinute.Remove(TWE_TraitCheck)
        end
    end
end```
is this good enough or can i improve it?
red tiger
pulsar heath
#

the table is example ```local Traits = {
{trait = "Trait1", endtime = 120000},
{trait = "Trait2", endtime = 240000},
{trait = "Trait3", endtime = 360000}
}

pulsar heath
#

what redundant calls?

#

i have to check the time in realtime so that has to run everytime the function is called

#

i fail to see where i could assign anything else to a var

#

but do tell

red tiger
#

PZ calendar calls

jaunty marten
red tiger
#

Assign those redundant chained calls as a local variable.

pulsar heath
#

if i dont do it that way

ancient grail
pulsar heath
#

will not update the value

#

i can remove the vars and do the full code with the call to pzcalendar

jaunty marten
jaunty marten
#

it's same variable

pulsar heath
#

on functions that are added to events

#

the var keeps the initial value

#

since im calling an instance of pzcalendar

#

thats the only way i got it to work

#

i could like i said just call the instance directly and remove the vars

jaunty marten
#

even so

pulsar heath
#

but that changes little

jaunty marten
#

u can local this in event function scope

pulsar heath
#

the vars are local to that function

red tiger
jaunty marten
#

baaad

local hour = PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY)
local minute = PZCalendar.getInstance():get(Calendar.MINUTE)
local second = PZCalendar.getInstance():get(Calendar.SECOND)
#

goood

local calendar = PZCalendar.getInstance()
local hour = calendar:get(Calendar.HOUR_OF_DAY)
local minute = calendar:get(Calendar.MINUTE)
local second = calendar:get(Calendar.SECOND)
red tiger
jaunty marten
#

it's absolutely same

pulsar heath
#

i thought the same but its not

#

everytime you want to get the time ( current time )

#

you need to do PZCalendar.getinstance

#

or in your case

#

calendar.getinstance

bronze yoke
#

you don't need to grab it three times every frame though, it's not changing between each time

pulsar heath
#

the everyoneminute

#

is only for testing purposes

bronze yoke
#

you can grab the instance once and use it for the rest of the function

jaunty marten
pulsar heath
#

albion doesnt work that way

#

lost a whole day trying to figure out why the values were static

#

till cosmic i think

#

showed me the solution

red tiger
pulsar heath
#
function clocktick()
print("Instance Current Time (stale): " .. PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY) *60 + pzCalendar:get(Calendar.MINUTE))
print("Instance Current Time (fresh): " .. PZCalendar.getInstance():get(Calendar.HOUR_OF_DAY) *60 + PZCalendar.getInstance():get(Calendar.MINUTE))
end```
#

it needs the getInstance on every get

#

or will not be the current time

jaunty marten
red tiger
#

Yeah so get it once?

pulsar heath
#

its outside

jaunty marten
#

do inside

red tiger
#

Put it inside the func?

pulsar heath
#

it does the same thing

#

only stale values

#

and i have it outside since i use it in more places