#mod_development

1 messages Β· Page 357 of 1

drifting wigeon
#

btw

drifting wigeon
#

is my server not printing for any reason specifically?

#

bc when i reload them

#

they print

#

do i need to do like umm

#

wait for loading

bright fog
#

Wdym ?

drifting wigeon
#

or something

#

only server does this

#

scripts dont print

#

or anything

#

but when i reload them

#

they work

#

scripts for me is lua files btw

bright fog
#

You can't just ask me that and not give me a single context on what you're doing

drifting wigeon
#

. check this, a module loader

raven epoch
#

hes using sendclientcommand to send command to server

#

but server script is not running at all

drifting wigeon
#

i made a simple server script

raven epoch
#

client runs

drifting wigeon
#

saying

#

server test

#

only that

#

in a lua file

#

and it didnt run

#

or atleast i couldnt see it in console

bright fog
#

On a server, it appears in the server console

drifting wigeon
#

how can i access it?

bright fog
#

I mean, depends which side

drifting wigeon
#

im using this one

bright fog
#

I'd suggest reading the error

#

It tells you everything you need to know

drifting wigeon
#

line 1 is a dictionary declaration

drifting wigeon
#

the console is a txt file?

bright fog
#

Yea

frank elbow
#

The same stuff in the console is output to a txt file

#

As in, the stuff you see there is mirrored to that file

drifting wigeon
#

should i do

bright fog
drifting wigeon
#

Events.GameBoot on server scripts?

bright fog
#

Show your whole file, show your whole error

drifting wigeon
#

look

bright fog
#

Show the lines

#

SHOW THE NUMBER LINES

drifting wigeon
bright fog
#

How do you expect me to know what fucking line is what ???

drifting wigeon
#

bro chill

frank elbow
#

Seconding the chill, but also it's understandably frustrating when people make it difficult to help lol

bright fog
#

You have to understand we can't help you if you give us so little info and context

drifting wigeon
#

idk

bright fog
#

Show the error

drifting wigeon
bright fog
#

The actual full error

drifting wigeon
#

i can resize the window to show it entirely?

bright fog
#

Just read it from your console.txt file

drifting wigeon
#

where can i find it?

bright fog
#

Cache folder

bright fog
drifting wigeon
#

like the server folder thing

drifting wigeon
#

nothing else is there

#

other than that error

bright fog
#

Did you properly reload your mod after editing it ?

drifting wigeon
#

completely

frank elbow
#

How are you getting this error? Does it appear on load, or are you putting something in the console?

bright fog
#

Do you have a second copy of your mod in mod folders somewhere ?

drifting wigeon
drifting wigeon
bright fog
drifting wigeon
#

and im seeing no clones

frank elbow
bright fog
drifting wigeon
frank elbow
bright fog
#

Don't sub to your own mod

frank elbow
bright fog
drifting wigeon
drifting wigeon
#

reloading PZ

frank elbow
drifting wigeon
#

btw where's the server folder located by default tho?

#

dont seem to find it in the game's folder

bright fog
#

Wdym by the server folder ?

drifting wigeon
#

like the cache folder nd stuff

bright fog
#

It's your local cache

drifting wigeon
#

so i can actually access the console

frank elbow
#

If you're on Windows and running a server with "host" go to %UserProfile%\Zomboid

bright fog
#

If you're using host

drifting wigeon
#

can i clear the coop console?

#

before i reload the server

drifting wigeon
bright fog
#

It clears it when opening the server

frank elbow
drifting wigeon
frank elbow
#

log exists, but it's meant to be called with a debug type and a message

drifting wigeon
#

where you can access files

#

and i can search for my lua files

#

and reload them

#

separately

frank elbow
#

You can just press f11 for that

bright fog
#

F11 menu

drifting wigeon
#

oh

frank elbow
#

You're opening the debug menu by causing an error

bright fog
#

Or Community Debug Tools has a neat tool to more easily do that

drifting wigeon
#

okay im going to rejoin the server and see the console

#

im going to see if it works

#

oh yes it works

#

but just couldnt see it from the normal console

#

is there any modding tool

#

that i can use

#

so i dont have to access the txt

#

each time im trying to see the server output?

bright fog
#

Just use VSCode when programming your Lua mods, you can also open the console in it and the file will reload in front of you

#

I even use an extension to autoscroll to the bottom of the file when it updates

drifting wigeon
#

im using VSCode

bright fog
#

Then what's the problem ? You can open the file and see its content easily then

drifting wigeon
#

like this right?

bright fog
#

Yea

raven epoch
#

whats wrong with this?

drifting wigeon
#

btw in roblox we do like wait(1) how do we express a yield here?

#

in the same way?

bright fog
bright fog
drifting wigeon
raven epoch
bright fog
# drifting wigeon yes

We don't use that, because your code runs in the tick and impacts the speed of the tick. You need to use Lua timers so it triggers after X ticks or X time

drifting wigeon
#

how do i use a lua timer?

bright fog
#

Basically

#

Uuuuuh let me see if I can find an example

#
---@param seconds number
---@param callback fun(...)
---@param ... any
HorseUtils.runAfter = function(seconds, callback, ...)
    local elapsed = 0 --[[@as number]]
    local gameTime = GameTime.getInstance()
    local args = {...}

    local function tick()
        elapsed = elapsed + gameTime:getTimeDelta()
        if elapsed < seconds then
            return
        end

        Events.OnTick.Remove(tick)
        callback(unpack(args))
    end

    Events.OnTick.Add(tick)

    return function()
        Events.OnTick.Remove(tick)
    end
end

For example

#

The idea is to add a function to an OnTick event, check how much time elapsed then remove that callback

raven epoch
#

turns out there is no string library in zomboid lua

bright fog
#

There is

raven epoch
#

would it be fine if i just did an isoobject instead of isothumpable?

bright fog
#

string should be a lib

#

Also PZ uses Lua 5.1 but a lot of stuff are reimplement Java side and are not classic Lua libs

drifting wigeon
#

btw these command props are good?

raven epoch
#

ok its not that

bright fog
#

The JavaDocs should tell you all you need regarding that

#

Also check out the Networking wiki page

#

Tho that page was B41 networking but commands are the same in B42

drifting wigeon
#

okay thanks

raven epoch
frank elbow
#

More detail is necessary

bright fog
#

Read the error, read the line where it triggers

raven epoch
#

according to debugger

#

so the line in screenshot

#

here are the variable values too

#

aa ok okay

#

figured it out

#

sq is nil

#

thats why its not showing up

#

might have overdone the fences

drifting wigeon
raven epoch
#

supposed to be a military checkpoint

#

too much fences

#

tho

drifting wigeon
#

btw is there a way to get players in a radius?

#

also getPlayer() returns isoplayer right?

bright fog
drifting wigeon
#

class

bright fog
#

Yes of course

drifting wigeon
#

oh ok

#

also

bright fog
#

Are you using Umbrella ?

drifting wigeon
#

on vscode?

#

idk how to toggle it

bright fog
#

Yes

drifting wigeon
#

i got the lua language server

bright fog
#

Typings for PZ

drifting wigeon
bright fog
#

If properly used, it allows to detect the majority of problems

drifting wigeon
#

got it but idk how to toggle

bright fog
#

Read the wiki page, that isn't Umbrella

#

It's extremely annoying but that extension is not Umbrella

drifting wigeon
#

do i need to install git?

#

like its a must?

bright fog
#

Read the wiki page

#

You need git only if you use LuaLs

#

If you use EmmyLua, you don't

drifting wigeon
#

oh

#

so i disable luals by sumneko?

bright fog
#

Your choice

#

We suggest moving to EmmyLua now

drifting wigeon
#

just did it

bright fog
#

But LuaLs is technically still usable but won't be supported for long

#

Read the EmmyLua wiki page for the details

raven epoch
#

this legit might be the worst code i've written for this mod

drifting wigeon
#

how do i generate the emmyconfig.json

#

?

bright fog
bright fog
#

You need to create the file

#

You need to read man, like the info is right there πŸ˜…

raven epoch
#

yea we are cooked

bright fog
#

Make a mapping of your structure

#

And generate based on relative coordinates

drifting wigeon
#

i did this

raven epoch
#

im trying to make it dynamic

bright fog
raven epoch
#

so it changes based on the rectangle u give ti

bright fog
#

The file needs to be .emmyrc.json

drifting wigeon
#

done

#

should i restart vscode?

frank elbow
#

Ctrl + Shift + P > Reload window

drifting wigeon
frank elbow
#

Or 'Restart Lua server', but idk off the top of my head whether that catches the .emmyrc change

bright fog
bright fog
#

It does yes

#

You can also do that at the bottom left where it's written "EmmyLua", select it and restart language server pack

drifting wigeon
#

still erroring when reloaded

bright fog
#

Did you add Umbrella to the libs ?

drifting wigeon
#

uhh

#

which libs tho

bright fog
#

Umbrella

#

Read the wiki page

drifting wigeon
#

ok

bright fog
#

Like I can't say it enough, read. the. page

frank elbow
#
{
    "workspace.library": [
        "<path-to-umbrella>"
    ]
}
bright fog
#

Download Umbrella's last source code from the GitHub release page or clone the repository.

#

In the library field, add a new entry to the array ([]) with the path to Umbrella's library folder on your computer.

#

If it were a long ass page, like I could understand you not reading it

#

But it's literally a few lines of explanation on how to even setup Umbrella

drifting wigeon
bright fog
#

Mid long ???

#

That's long for you ???

drifting wigeon
#

Yeah ig

#

But its explanatory

bright fog
#

It fits on my screen !

drifting wigeon
#

So you did a good job doing it

#

Im not hating

bright fog
#

The explanations for EmmyLua literally fit in a single screen height

#

Like if this is long for you, like man you won't survive the documentation long πŸ˜…

frank elbow
#

The repo (https://github.com/PZ-Umbrella/Umbrella) also has an explanation but the wiki page really is quite clear πŸ˜… so unsure how that was missed, but either way hopefully you can figure out the setup

drifting wigeon
#

Yeah im just used to another display of uhh documentation

#

srry

#

i'm learning how things work here

drifting wigeon
#

ok so in roblox

#

are you used with roblox things a lil bit?

#

that might ease things

bright fog
#

The Wiki always can appreciate improvements, so if you think another format would fit better I'm open for it

bright fog
drifting wigeon
#

i rlly like mkdocs styling

#

and very visual

frank elbow
raven epoch
#

ok im done

#

its a bit unoptimized (people might think the mod is a bitcoin miner) but i cant deal with it anymore

bright fog
#

But from experience, users want examples available

frank elbow
#

Yeah, the template page mentioned thatβ€”but in this case it seems like it'd benefit from visibility

bright fog
#

The template however is unclear that it can be opened I think

frank elbow
#

It's clear to me, but unsure how much of that is familiarity

#

i.e., whether it'd be clear to everyone

drifting wigeon
#

btw does umbrella needs to be as a descendant of the root?

frank elbow
#

No, it can be anywhere

#

You just have to tell EmmyLua where to find it

bright fog
frank elbow
drifting wigeon
bright fog
#

The JavaDocs does most of the job, as well as the LuaDocs which is going to see some improvements in the future as @bronze yoke is looking into moving to Sphinx

drifting wigeon
#

yeah javadocs are clear

bright fog
#

Overall the main problem is the lack of description of things

buoyant patrol
bright fog
#

Like what functions do what

drifting wigeon
#

do i put the path to umbrella in library?

#

bc when i look at the repo for umbrella

#

its telling me something very different

frank elbow
#

Eventually I'm gonna add some manual notes to the Lua stubs & try to convince others to do the same

drifting wigeon
#

from the luadocs

frank elbow
#

Likely a task for around b42 stable though

drifting wigeon
#

i feel like

#

uhh

bright fog
drifting wigeon
#

there should be a harmony between pz and vscode

#

to the point

#

you can do like

#

uhh

frank elbow
drifting wigeon
#

getting props of an object

#

and typos

bright fog
frank elbow
#

You'll get Intellisense once it's set up

drifting wigeon
frank elbow
#

Yeah

drifting wigeon
#

that would make it so much easier

#

thank you

buoyant patrol
raven epoch
#

400 lines of code for this goofy ahh fence

#

i rage

bright fog
drifting wigeon
#

(env variable set)

bright fog
#

Needs to be the library folder

drifting wigeon
#

oh k

bright fog
#

Idk if that parent folder works

drifting wigeon
#

done

frank elbow
#

I think it'll find them either way, but I always set it to the library folder anyway

drifting wigeon
#

uhh still no intellisense and errors

frank elbow
#

Ctrl + Shift + P > reload window

drifting wigeon
#

did that

frank elbow
#

Try no dollar sign in the environment variable name

buoyant patrol
drifting wigeon
#

do i put them on system or user env?

#

because its on user

frank elbow
#

Close and reopen all vsc instances, maybe? Windows creates copies of env vars for diff processes so it could be outdated

drifting wigeon
#

oh ok

#

let me try

frank elbow
#

By "close and reopen all" I meant make sure there are no open instances and then reopen, to be clear

buoyant patrol
drifting wigeon
#

thank you

#

btw

#

i should call all funcs

#

with :

#

right?

#

everything is OOP

frank elbow
#

No, depends on the function (from java, static methods are called with . on the class & instance methods with :. from Lua, depends entirely on what the function expects)

drifting wigeon
#

also is it possible?

#

getting players in x radius

#

btw is there Y coords?

#

or nah?

#

vector2d or 3d

frank elbow
#

Yeah, although mind that depending on the radius clients may not have all the players loaded

frank elbow
#

If by Y you mean vertical, Z is vertical

drifting wigeon
#

so y is horizontal?

#

or depth

frank elbow
#

X and Y are the position with reference to North/South/East/West on the map

#

Z is the vertical level

drifting wigeon
#

okay

#

thank you

#

btw is there a table i can access from client

#

for players loaded?

frank elbow
#

getOnlinePlayers returns ArrayList<IsoPlayer>

drifting wigeon
#

okay thanks

frank elbow
#

Note that this is not a Lua table, so you have to iterate through it accordingly

peak furnace
#

apologies for the interruption, bit confused about mod translations and where to put my strings
would it be correct to put the strings in common/media/translate/EN? and how exactly do i format the string file, the wiki entry isn't very good

drifting wigeon
#

btw how can i get character gender?

drifting wigeon
frank elbow
#

e.g., UI_Reload = "Reload", (grabbed a random one from UI_EN)

drifting wigeon
#

for index, isoPlayer in next, onlinePlayers do
    -- code here
end

frank elbow
peak furnace
#

right, but the folder organisation is correct?

frank elbow
drifting wigeon
#

oh

#

so i just do pairs()?

frank elbow
peak furnace
#

right, thank you

frank elbow
# drifting wigeon so i just do pairs()?

No (that one does exist, of course, but can't be used for ArrayLists), you have to loop through it using size and get. e.g.,

local players = getOnlinePlayers()

for i = 0, players:size() - 1 do
  local player = players:get(i)
end
raven epoch
#

ok i cooked

#

as in burnt down the kitchen

#

the whole mod needs rewrite

drifting wigeon
#

or what?

raven epoch
#

because ur going from 0 to n

frank elbow
#

ArrayLists are 0-indexed, unlike Lua tables

drifting wigeon
frank elbow
#

An ArrayList with 2 items has indices 0 and 1, thus size - 1

drifting wigeon
raven epoch
#

yea

drifting wigeon
#

does it provide delta?

raven epoch
#

no

#

and people told me not to use it as delta

#

cus tick speed can change

drifting wigeon
#

oh

drifting wigeon
#

thanks

#

btw

#

how do i add player proprs

#

like adding variables

#

to the isoplayer

frank elbow
#

You can't add properties, but you can add mod data to the mod data table

drifting wigeon
#

if i want to save a state for something

frank elbow
#

local modData = player:getModData(), then set properties on the returned table

drifting wigeon
drifting wigeon
#

so moddata is an arraylist or dictionary?

frank elbow
#

Regular Lua table

drifting wigeon
frank elbow
#

If you use it on the server it's on the server, if you use it on the client it's on the client. I believe it's not synchronized, but I'd have to double-check to be sure

#

If you're trying to save data about other players on the client this wouldn't be the way to do it, given that (assuming my memory serves correctly)

drifting wigeon
#

to register a value to indicate the stage

#

should i save it instead

#

on

#

server mod data?

#

using player as a key to index the value

frank elbow
#

If it's something only relevant to the player that you won't ever have to let other players know about I'd just save it on the player mod data on the server

#

If it's something you do need to let other players know about, but only while the player is online, I'd use commands

drifting wigeon
#

and add

#

moddata[player:getUID()] = this

drifting wigeon
#

like

#

saved

#

like a datastore

frank elbow
#

What I described is what I'd do, not necessarily standard or best practice, to be clear

drifting wigeon
#

so

#

moddata is a dictionary lua

#

or arraylist?

frank elbow
#

These are questions that can be answered by Umbrella & the LuaDocs/JavaDocs

#

It's a Lua table

drifting wigeon
#

im checking umbrella

#

and its telling me functions for the table

#

such as

#

:get()

#

which you told me to use for

#

arrays

frank elbow
#

What are you looking at?

#

GlobalModData?

drifting wigeon
#

no no

#

getservermoddata()

#

btw also look at this

#

-> charactertraits<?>

#

what is charactertraits

#

table, arraylist?

frank elbow
#

It's an instance of a class

drifting wigeon
#

so dictionary?

frank elbow
#

No, it's from Java. userdata

drifting wigeon
#

oh

frank elbow
#

If you type it fully and ctrl + click then you can go to where Umbrella defines it in a stub

frank elbow
# drifting wigeon getservermoddata()

This doesn't return anything, it just requests that the server sends its mod data down (which you'd then have to handle with an event listener). I'd avoid this, personally, since you can use commands to have more control over what's sent instead of sending the entire server mod data table every time you want something from it

drifting wigeon
#

like a value for example as level

#

as important as

frank elbow
#

Depends on what you need, but for your use case you could store it in global mod data on the server & write commands to get that data when you need it

drifting wigeon
#

or get it

frank elbow
drifting wigeon
#

oh

#

i could just write a wrapper for it

#

btw global mod data is server only right?

frank elbow
#

No

drifting wigeon
#

so your allowing client to read it or write too?

frank elbow
drifting wigeon
#

ohh

#

so when you get the mod data on clientside

#

it creates a different data table

#

but when you get it on server you get the serverside one

#

basically mutations

#

like a module

#

btw how do i do character flaws? in registries

frank elbow
drifting wigeon
#

its literally a trait

#

but negative cost

frank elbow
#

Yeah

drifting wigeon
#

also

#

its referencing

#

UI_trait_x

#

on desc and name

#

on traits

#

where i can add those vars?

frank elbow
drifting wigeon
#

oh

#

so its ui translation

knotty stone
#

so now the 100million dollar question, how do i get ma semi trailers back to 1000 capacity? πŸ€ͺ

drifting wigeon
#

cant get to register a trait

#

simply doesnt appear

#

this is my registries.lua

#

character_traits on scripts

#

got it to work

#

but for some reason

#

uhh

#

it doesnt display the translation i added

sour wave
#

Show your translation txt

#

I've had zero issue with custom traits and professions this far

#

@drifting wigeon is your translations in media/lua/shared/Translate/EN/FILENAME.txt?

sour wave
#

can you show it please?

sour wave
drifting wigeon
#
SCREAM_EN = {
    SCREAM_trait_paranoid = "Paranoid",
    SCREAM_trait_paranoidDesc = "You have mental problems, you need to take medication to battle this otherwise you will go crazy."
}
drifting wigeon
frank elbow
#

i.e., you can't have SCREAM_trait_paranoid, assuming that's UI_EN.txtβ€”you need to have the UI_ prefix

frank elbow
#

The first line in the file does not actually matter

drifting wigeon
#

and the file name?

frank elbow
#

It has to be one of the ones the game expects

#

Like UI_EN.txt

drifting wigeon
#

im gonna try that

knotty stone
#

well if the trainee has deleted the 0 for max capacity, i will just add 9 other trunks with 100 each so we will be back at 1000 capacity for semi trailers tinfoilhat

peak furnace
#

employing my evil spritework skills to edit the cheesecloth sprite into something resembling chainmail

#

i intend to make chainmail forging the pain in the ass that it is

#

putting together chainlinks by hand is agonising

drifting wigeon
#

how can i add status/moodle?s

bronze yoke
drifting wigeon
bronze yoke
#

not without rewriting the entire moodle ui

#

moodles are not moddable and you have to go to extreme lengths to fake them

#

that framework does it for you

outer crypt
#

question, will all client side code need to be moved to shared or can non-item moving code etc stay in the client folders?

bronze yoke
#

if it's client code it should be in client

outer crypt
#

ok ty, I heard the work around for client code on dedicated servers right now was to remove the DoLuaChecksum... I heard that was because of client code checks... it works though.

bronze yoke
#

i don't think it's to do with client code, there's just some issues with the checksum in general

#

disabling the checksum doesn't change how the code actually runs

outer crypt
#

ah okay, thank you so much, Albion! πŸ™‚

drifting wigeon
#

btw how can i

#

uhh

#

make like the argument

#

for the .new

#

typechecked

#

like add a type to it

bronze yoke
#

---@param player IsoPlayer

drifting wigeon
#

thanks

#

btw

#

how i can require moodle framework?

#

requiring it like this

#

but i want it to intellisense

bronze yoke
#

you'll need to add the path to that mod to your libraries in .emmyrc.json

drifting wigeon
#

i got it like this

#

what do i need to change

#

i add it on workspace roots?

bronze yoke
#

add it to library

drifting wigeon
#

i do

"library": ["$PZ_UMBRELLA", "MOODLEFRAMEWORKDIRHERE"]
#

?

bronze yoke
#

yeah

drifting wigeon
#

okay thanks

#

btw does it support b42?

bronze yoke
#

yes

drifting wigeon
#

btw what folder inside moodle framework

#

do i need to ref for library?

bronze yoke
#

the lua folder

drifting wigeon
#

btw does it always have to be 4 goods and 4 bads?

raven epoch
#

is there an easy way to map building or other tile objects into script?

drifting wigeon
#

.lua files load once the player joins the game or on menu?

bronze yoke
#

if they enable the mod on the main menu, it will load on the menu

#

if they start singleplayer and the modlist doesn't match their main menu mod list all lua will be reloaded

#

all lua is always reloaded when joining multiplayer even if the mod list matches

drifting wigeon
#

since it wont make much sense

#

joining a server/game

#

and having like

#

character variables from past servers

bronze yoke
#

that can't happen

drifting wigeon
#

they reload each time you join then?

bronze yoke
#

lua always reloads when joining multiplayer or leaving a singleplayer save

drifting wigeon
#

oh k

#

one question

raven epoch
#

worst case u tie it into events

drifting wigeon
#

if i write server code on /server

#

does it work on singleplayer?

bronze yoke
#

yes

drifting wigeon
#

okay

bright fog
#

See the Lua (API) wiki page for that

#

There's a load order and load conditions

drifting wigeon
#

you would just be adding callbacks

#

each time you join a server

#

right?

#

if you reload

drifting wigeon
frank elbow
#

Lua reloads when joining a server

bright fog
raven epoch
#

oh

frank elbow
raven epoch
#

how about something like

#

road stories

raven epoch
#

or whatever they are called

drifting wigeon
#

thanks

raven epoch
#

surely the devs didnt manually code in rotation and all

bright fog
#

Story events

raven epoch
#

yes those

bright fog
#

But I told you can place buildings manually

#

tbx files I believe they are

bronze yoke
#

stories don't add tiles

bright fog
#

They do actually ?

raven epoch
#

can i load these tbx files from script?

bright fog
#

Some stories do have tiles in them

bronze yoke
#

they just spawn items and cars don't they

bright fog
#

You probably can't load their data tho

bright fog
raven epoch
#

thats fine

bright fog
#

Some do spawn tiles

raven epoch
#

fence generator is getting an upgrade

bright fog
#

Like that one road story with a manhole, there's orange cones

#

There's also the camp story

raven epoch
#

quick question

#

what happens to stuff that are far away

#

and unloaded

bright fog
raven epoch
#

variables default to nil?

bright fog
raven epoch
#

say i got an npc in a variable

#

player roams away

#

and unloads the npc

bright fog
#

Unsure

#

I'd assume they keep their ref

raven epoch
#

i do like my mem leaks

#

ok something else to add :evaporate:

bronze yoke
#

you're using isoplayers right

raven epoch
#

ye

bright fog
#

He is

bronze yoke
#

yeah that's a memory leak then

bright fog
#

Wdym a memory leak ?

raven epoch
#

npc doesnt exist but references to them exist

bronze yoke
#

if you don't drop the reference after it unloads the isoplayer will never be collected

raven epoch
#

and never get cleaned up

bright fog
bronze yoke
#

i don't think isoplayer is pooled, it wouldn't make much sense to

#

other object types are pooled so holding references doesn't usually cause a memory leak but it causes other bugs that are usually actually more annoying

raven epoch
#

even if it did thats a npc logic running even when the npc isnt there

raven epoch
bronze yoke
#

starlit has a module that makes this a bit less annoying but i don't know if it works with isoplayers

raven epoch
#

i can handle it prob dw

bright fog
drifting wigeon
#

btw isoplayer object means the character physical, not the connection to server right?

#

so if a character is in creation

bright fog
#

Forgot you're doing your shit on B41 --'

drifting wigeon
#

theres no isoplayer

drifting wigeon
#

okay

raven epoch
#

i should prob get the soldier ai solid before working on these

#

bro just left me to die

bronze yoke
#

wait why are you in b41

bright fog
#

Bcs he's probably learning from superb survivor which doesn't exist in B42

raven epoch
#

i want the game to be stable while i figure out modding

#

and also that yes

bright fog
#

But it's technically the same shit

drifting wigeon
#

how can i listen from server

#

to check when a player object spawned in? (player client only)

#

is there a event for that?

bronze yoke
#

a lot of the things you're learning are already out of date though πŸ˜… they're making a lot of changes to how mods work

bright fog
raven epoch
#

first time modding any game tho

drifting wigeon
raven epoch
#

except gmod maybe

drifting wigeon
#

theres no event to check from server when a player joined the game

bright fog
drifting wigeon
#

but serverside?

#

server should be able to detect when a player joined its instance

bronze yoke
#

yeah that would make sense wouldn't it

bright fog
#

I guess you checked if there were new events already ? @bronze yoke

drifting wigeon
#

so i just do a oncreateplayer and send a client command to server to just let the server know he's there?

#

what if connection fails?

bronze yoke
bright fog
bronze yoke
#

types are still accurate but client/server annotations could be incorrect

drifting wigeon
#

do i parse the player UID to server

#

and it iterates through all server players to check if its existant?

bronze yoke
bright fog
#

No, just use the online ID of that player, which you receive from them when you make them send it to you, try to access the player and if it doesn't exist, it might be because they left

#

Also maybe you can get a list of clients on the server, and check whenever someone left

#

And associate them to their player

bronze yoke
#

you can get a list of active isoplayers

drifting wigeon
bright fog
#

getOnlineID

drifting wigeon
#

thats for client-side right?

bright fog
#

On any IsoPlayer ref

#

So if you have that ref server side it works too

#

An online ID is associated to an IsoPlayer instance

drifting wigeon
#

and onlineid changes?

#

each time you enter the same server?

bright fog
#

Yea

drifting wigeon
#

hmm

#

thats fine

#

do i have to register sounds?

bright fog
#

No

drifting wigeon
#

how can i play a sound?

#

hold on im gonna see how

#

do i call addsound

#

and the isoobject can be isoplayer right?

dull moss
#

I highly recommend looking at a mod that can play a sound

bronze yoke
#

isoplayers are isoobjects

drifting wigeon
#

im not using moodles

#

i made a manager

#

that creates a oop for a player

#

and registers the state

dull moss
#

What I mean is looking how any other mod plays sounds

drifting wigeon
#

of a trait

dull moss
#

Not using a framework for sounds

drifting wigeon
#

i thought you meant about a api

drifting wigeon
limber solar
#

hi there, has anybody found a way to use addxp in mp? it looks like it gets rolled back and not validated

bronze yoke
#

xp must be added from the server

limber solar
#

im sending a clientCommand that triggers the server to add xp, but it doesnt look like it works

drifting wigeon
#

you shouldnt trust client with this

limber solar
#

agreed

#

but necessary to get some load off the server

drifting wigeon
#

what are you rewarding xp for? maybe you can make a way for it to run on server in an optimized way

limber solar
#

nimble

drifting wigeon
#

what's that

limber solar
#

for being in aiming stance and moving

drifting wigeon
#

oh

limber solar
#

i should keep a list of all players with x z and stance

#

serverside

drifting wigeon
#

just make a server oop combatmanager for the mod or any kind

#

and make if it starts aiming

#

or moving

#

send a signal to the server

#

to set the state to moving or aiming

limber solar
#

i already got it to trigger on the correct moments, but the xp add isnt working

#

i have a halo that pops correctly

bronze yoke
#

that is trusting the client with more steps

limber solar
#

but no xp, even if i try /addxp me Nimble=1000 it gives me the xp and rolls back

drifting wigeon
limber solar
#

check it out

#

if i do it with stat manager it works

dull moss
#

I have a bunch of traits that are loaded conditionally, to allow people disable traits they do not like, is it completely fcked with the scripts system?
As example

    if not activatedMods:contains("\\2934686936/EvolvingTraitsWorldDisableAxeThrower") then
        local AxeThrower = createTrait("AxeThrower", 4);
        AxeThrower:addXPBoost(Perks.Axe, 1);
        table.insert(newTraits, AxeThrower);
    end

    if not activatedMods:contains("\\2934686936/EvolvingTraitsWorldDisableBloodlust") then
        local Bloodlust = createTrait("Bloodlust", 4);
        table.insert(newTraits, Bloodlust);
    end
...
--- add traits later down the code
raven epoch
#

doesnt the server know whether the client is aiming and crouching?

dull moss
#

or can we put code in registries.lua?

#

fuck

bronze yoke
#

you were using mod ids to disable traits?

dull moss
#

ye i had a separate mod to let ppl disable traits 1 by 1

limber solar
#

been trying for 2 days to do that and to get stamina regen for sitting but stats seems to be private/protected in java class and not exposed for lua

bronze yoke
#

that's cursed as hell πŸ˜… you can do it with sandbox options, starlit has a module for it

dull moss
#

I was not aware of that

#

its not that bad

bronze yoke
#

basically it just hides the trait from selection

#

it's not optional to pre-register traits anymore but doing it that way wasn't compatible with sandbox options anyway

drifting wigeon
#

how can i play a sound originated from a player?

bronze yoke
#

player:playSound("name")

drifting wigeon
#

okay thanks

dull moss
drifting wigeon
#

can i add sounds like this?

bronze yoke
#

i don't think i wrote docs for that one

dull moss
#

ah k

bronze yoke
#

it's older and ported from some other shit i made, let me check how it works

dull moss
bright fog
drifting wigeon
bright fog
#

No = in the sound script line

dull moss
#

brother look at any mod that adds sounds

drifting wigeon
#

should be good then?

bright fog
drifting wigeon
#

and on playsound i do scream:x right?

bright fog
#

You shouldn't have that scream: thing

drifting wigeon
#

do i do scream_

#

then

#

?

bright fog
#

You just don't do that

#

You put it in a module of yours

drifting wigeon
bright fog
#

Unless the game is inconsistent here and doesn't use the module off sound scripts, which it might not use actually

#

Then you'd need a suffix

drifting wigeon
#

and this?

bright fog
#

Try calling it with the module, just so we can see if that thing is script bullshit or not

bright fog
#

Else you'll need a suffix in your sound script ID to not clash with other definitions

bronze yoke
#

wait what the hell is this shit hold on

bright fog
drifting wigeon
#

i will add a suffix anyways just in case

drifting wigeon
bronze yoke
#

there is a typo that is going to make this not work LOL

drifting wigeon
#

safer now

bronze yoke
#

that code will work, i just need to push a hotfix really quick πŸ˜…

dull moss
#

Collection on workshop doesnt look like it has any trait mods

bronze yoke
#

the only mod that uses it used a copy pasted version because it was before the module was released

#

it'll be outdated now since the whole trait revamp a couple days ago

dull moss
#

its pain coming back to pz modding after almost year break

drifting wigeon
#

getuid will return the same thing for a player in client and server right?

bright fog
#

No idea what that is

#

It's online ID that should return the same ID

drifting wigeon
#

why dont we work off of steamid?

#

easier

#

since that doesnt change

bright fog
#

Different application

drifting wigeon
#

uhh

#

hmm

bright fog
#

Basically the game supports servers outside of Steam

drifting wigeon
#

oncreateplayer only fires when the character is customized and created? or when it loads in?

bright fog
#

So depending on a Steam ID limits things for that, and so I guess they went with another system to identify IsoPlayers client and server side, and there's already a method to retrieve the IsoPlayer instance via an onlineID

bright fog
drifting wigeon
#

or isoplayer change?

bright fog
#

Yes

drifting wigeon
#

so online id changes when they die?

bright fog
#

I said an online ID is associated to an IsoPlayer

bronze yoke
bright fog
#

So if that IsoPlayer disappears, its ID too

dull moss
drifting wigeon
#

btw if i do player:getmoddata() that data will save on server when player leaves?

bronze yoke
#

yeah you're gonna be hit hard by these changes huh πŸ˜…

dull moss
#

yep

drifting wigeon
#

and when they join the isoplayer has a different one

#

isnt there any bound id to the living character?

bright fog
#

The ID still exists, but the IsoPlayer ref disappears

bright fog
drifting wigeon
bright fog
#

Use object mod data if you need to keep track of player informations

drifting wigeon
#

i got an idea

bronze yoke
#

i think if they rejoin they get the same online id back

bright fog
#

I'd be surprised tbh

bronze yoke
#

they only reset when the server resets

drifting wigeon
bronze yoke
#

maybe?

drifting wigeon
#

could be

bronze yoke
#

i really don't know how minecraft servers behave

drifting wigeon
#

they store data based on the character uuid

#

i think

verbal yew
#

if i use my module for new items like:

module BetLock
    imports
    {
        Base
    }

    item BobbyPin
    {
        DisplayCategory = Tool,
        ItemType = base:normal,
        Weight = 0.01,
        Icon = BobbyPin,
        Tooltip = Tooltip_BetLock_BobbyPin,
        WorldStaticModel = Paperclip,
    }
}

should i do ItemType = BetLock:normal?

bright fog
#

No

bronze yoke
#

i mean if they're using uuids it sounds like they're meant to be used for persistent storage

#

online ids are not persistent

drifting wigeon
#

btw when i recieve the ondisconnect event on client i can still communicate with the server to alert him a player is leaving?

worldly folio
#

I want to translate the game into Hebrew but I can't. I don't see the font. It's gone. I'm looking for someone with experience to help me in exchange for money.

drifting wigeon
bright fog
#

What's the need you have for it ?

bronze yoke
#

does it need to be a player id or a character id

drifting wigeon
bright fog
#

Because if object mod data is enough, I don't see why bother with an ID

dull moss
#

If I used to append few symbols to trait names to mark them for players, that is also gone, right?

---@param name string
---@param cost number
---@param isProfExclusive boolean
---@param isDisabled boolean
---@return Trait
local function createTrait(name, cost, isProfExclusive, isDisabled)
    isProfExclusive = isProfExclusive or false;
    isDisabled = isDisabled or false;
    if getActivatedMods():contains("EvolvingTraitsWorldMarkDynamicTraits") then
        return TraitFactory.addTrait(name, getText("UI_trait_" .. name) .. " (D)", cost, getText("UI_trait_" .. name .. "Desc"), isProfExclusive, isDisabled);
    else
        return TraitFactory.addTrait(name, getText("UI_trait_" .. name), cost, getText("UI_trait_" .. name .. "Desc"), isProfExclusive, isDisabled);
    end
end

man this update NotLikeDis

drifting wigeon
#

i need to create a class and garbage collect it each time a player join and leaves

bright fog
drifting wigeon
verbal yew
# bright fog No

Are mods from the workshop category loaded too when selected?
because I have a mod in two places...

drifting wigeon
#

and ondisconnect i can still comm with server?

bright fog
#

No idea

bronze yoke
verbal yew
#

thanks

raven epoch
#

video has jumpscare

drifting wigeon
#

would i be able to do this?

bright fog
#

Maybe

drifting wigeon
#

do you have to like guess what each thing does on the code?

#

pz devs dont release official guides?

bright fog
#

Yea

#

That was the first time they released anything

drifting wigeon
bright fog
#

This

drifting wigeon
#

oh

bright fog
#

Basically the whole modding wiki you have at your disposal is completely community built, and I probably wrote like 90% of it ? πŸ˜…

#

I got the help of others, notably albion, on the technical details

#

Albion who is also the one managing the JavaDocs for B42, and the LuaDocs, and Umbrella

#

So yea we have to guess everything, like we have to find out everything that changed the majority of the time

#

Us getting notices from TIS about changes is kind of a first, best we usually get is a mention of things in the patch notes, and the majority of the time it omits a lot of things

bronze yoke
#

aiteron is working on some basic api docs

bright fog
#

Apparently yea

drifting wigeon
#

if a dev actually gets involved

bright fog
#

Which tbh I don't understand why this isn't made on the modding wiki

bright fog
drifting wigeon
dull moss
#

I mean imagine if 42.13 dropped without docs

bronze yoke
#

i would've had to repeat myself even more than i have πŸ˜…

dull moss
#

Go try to figure what the fuck happened and why every single mod out there is bricked

bright fog
#

What scares me is that those notices become unusable, or are badly written / aren't actually proper intructions to doing X Y Z

drifting wigeon
#

they should make a clear structure

jaunty iris
#

is there someone here that can help me with a simple mod im creating? ive no idea why it isnt working

drifting wigeon
#

and that doesnt change behavior of old mods

#

with new updates

#

which is totally possible

dull moss
#

Making new game updates backwards compatible with mods is as far from bright idea as it gets

bronze yoke
#

it's not possible with the level of changes they're making currently

bronze yoke
#

the other is part of the general guide aiteron has been writing

dull moss
#

Like the code overhead on that is honestly beyond imagining

drifting wigeon
jaunty iris
#

im trying to make a mod that gives the zombies their own custom walking sounds. whatever they are wearing. but it is not working

bronze yoke
#

the game's code is genuinely just really poorly designed in a lot of very major areas and they're working on that now and that means big breaking changes

jaunty iris
#

this is my first mod and im doing it with help from internet and chatgpt

#

they still use the same bank as the player

dull moss
#

I'd recommend replacing chatgpt with other_mod_that_works_and_does_similar_thing

drifting wigeon
#

if yk what i mean

dull moss
#

I'm a big advocate for chatgpt in coding but it's really bad when it comes to PZ API

bronze yoke
#

the most major design change is making the game more extendable and working on the core frameworks of the game

jaunty iris
#

i mean ive already tried multiple ways and rn i have a custom bank and a LUA script. but it doenst wanna work

bronze yoke
#

this breaks every mod because it wasn't designed this way in the first place, it's not something that is possible to maintain compatibility with

drifting wigeon
jaunty iris
#

so if anyone that knows more aboutr this can help me figure it out that would be nice

bronze yoke
#

it's not just old functions, it's the core design of these systems

bronze yoke
#

they *could* have allowed trait identifiers that are just strings to continue working, but then that basically just throws out every benefit of changing the system, and most mods would simply never update to the newer API

drifting wigeon
#

registries seem good tho

bright fog
#

I'm of the pov that such changes is fine, yea it'll break mods but if it's for the better it's worth it

bronze yoke
#

basically maintaining compatibility with changes this fundamental is an insane code burden and genuinely just goes against the point of making these changes in the first place

drifting wigeon
#

just think abt what will happen when they release next build

#

i dont want my code broken

bronze yoke
#

changes like this do not happen every build

bright fog
#

B42 released and barely broke anything

bronze yoke
#

when b42 first released i only had to make changes to one of my mods

small topaz
#

Hi! Is there still a Java Doc for the 42.12 or older versions available somewhere?

bright fog
#

Nop

drifting wigeon
bronze yoke
#

the trait system was awful and needed a total revamp, i don't think they've even gone far enough yet

drifting wigeon
#

is there a guide for ui?

bright fog
#

I have one planned for the wiki, but not done yet

#

not even started yet

sour wave
#

What language are the translation text files? I am ahving a brain fart

bronze yoke
#

they do not conform to any language

drifting wigeon
sour wave
#

Alright didn't think so.

bright fog
drifting wigeon
#

uhh

#

scale and offset

bright fog
drifting wigeon
sour wave
bright fog
#

Yes actually

sour wave
#

How?

drifting wigeon
#

can i actually do this? (storing mod data on a class)

frank elbow
#

Mod data is just a regular Lua table

drifting wigeon
#

btw moddata is isoplayer bound right? if player dies it erases right?

frank elbow
frank elbow
frank elbow
#

If you mean well after they've died (i.e., different session), though, then yeah

drifting wigeon
bright fog
frank elbow
#

You're good lol

drifting wigeon
#

client creates a new player

#

player joins the world

#

oncreatedplayer fires

#

server receives it

#

and gets player

#

different moddata right?

frank elbow
#

Yeah, different mod data on the new player object

drifting wigeon
#

and if player rejoins?

#

but no dead character?

bright fog
#

Should be the same

frank elbow
#

Same mod data, but remember it's not sync'd (I believe)

drifting wigeon
#

as a "data-store"

#

but i want it per character

#

so this should do

bronze yoke
frank elbow
# sour wave How?

Simple answer is "like a Lua comment, with --". Full answer goes into the weird parser quirks that make it so that technically it's any line that contains --, and does not contain = and ". The detail only really matters when extending translation lines with .. (which is also something you can do), since starting a translation with -- would render it unusable otherwise

#

So, basic answer is just -- comment for comments in translation files, except for some weird edge cases

#

Actually, checking again, idt the detail matters since the comment check prevents extending with ... So, simple answer probably suffices The comment condition does not run for lines ending with .. 🀦

drifting wigeon
#

btw is there a way that the server i test the mod on i host as an outdated version of my mod?