#mod_development

1 messages · Page 30 of 1

glacial flicker
#

yeah I don't like that

#

I like the way Aquatsar lets you swim for a short period of time

#

that mechanic in of itself added to zombies would be great

#

also having zombies destroy ropes

mystic meteor
#

by the way @weak sierra I think this log spam is from your mod, is there any chance of that getting suppressed?

weak sierra
#

nope i have no control over that once the java takes over

#

all i can do is invoke the function

mystic meteor
#

sucks but it's what I expected

weak sierra
#

for that bit

#

yeah

mystic meteor
weak sierra
#

how i wish i could though

#

lol

mystic meteor
#

heh

low sky
#

has anyone done any work with the storm api?

#

i want to make a mod with it, but there seems to be only one other person who has made a mod with it

mystic meteor
#

nope

low sky
#

L. I don't wanna learn Lua :(

mystic meteor
#

ain't that a mood. I hate Lua's structure but admit it does what it does well

low sky
#

no it doesn't

#

it is bad looking

mystic meteor
low sky
#

java is a superior looking + functioning lang

mystic meteor
#

concern I gotta say I also don't like how java looks, but it's better than lua at least

low sky
#

:(

#

but java is so hawt

mystic meteor
#

c# all the way eh_aSuiRun

low sky
#

no

#

c# is so ugly

#

and i hate the way it functions

mystic meteor
low sky
#

i don't like having to deal with memory stuff

bronze yoke
#

lua is nice but why does it count from 1

weak sierra
low sky
#

ON G

mystic meteor
low sky
#

i need my index to start from 0

bronze yoke
#

lua counting from 1 costs me hours of debugging per mod

mystic meteor
#

I think it's something to do with the zero index in C arrays being the size of the array

low sky
mystic meteor
#

and lua having that same 1-index

#

anyway wtf are you doing in C# that requires dealing with memory stuff

mystic meteor
#

C# is (not really) just Java but having learned from java's mistakes

#

C and C++ I can see you having to deal with memory

low sky
#

Java is perfect

#

📿

mystic meteor
low sky
#

🙏

#

god be thy Java

hollow current
#

Python:

mystic meteor
#

java does its job but I don't have to like it

mystic meteor
hollow current
low sky
#

i really want to make a java project zomboid mod with the storm api

#

but i have 0 clue how to set it up

#

someone should make a example mod for it ;)

#

also the discord for it is dead af

#

no support

bronze yoke
#

i think there's just not a lot of interest in making mods that won't work on steam workshop

#

plus, no mods = no examples = no mods

mystic meteor
#

meanwhile c# is like: drop Harmony in place, override things with ease

#

tbf java mods could likely work on the workshop easily enough if we had a good injection library see me shilling Harmony again

#

but Java's reflection/injection is horrendous, I've yet to find a single simple library for it

astral dune
#

I noticed someone has a fork of storm that they've been keeping updated, I've also considered using it

low sky
astral dune
low sky
#

what a fucking goat

#

ty

#

🙏

sullen maple
#

does anyone have any good resources for learning how to mod? i have no prior experience and am just now getting into coding but im interested in learning

gilded hawk
#

Is there a way to detect if a player did a critical hit?

hearty dew
#

There is an event for when a zombie is hit, OnZombieHit maybe. I don't know if it has the outcome info for the hit though

mystic meteor
#

there's an event for OnWeaponHitCharacter

#

It passes the damage done but not the critical state, though you might be able to get the critical based on the weapons crit mult

mystic meteor
random finch
#

Can anyone else confirm that sounds can only be heard by players upto 3 cells away?

weak sierra
#

so either the updated steam api calls did it or they did somethin about taht

mystic meteor
#

very interesting, good to know

#

it's good to know that it'll go away

astral dune
#

Before I follow this rabbit hole any further, I better try and check if I'm treading old ground. Has anyone here made a mod or know of one that creates a vehicle script procedurally? I want to be able to generate a script at runtime, and either tuck it into the media/scripts/vehicles/ folder, or just feed it directly to the Scriptmanager or something like that

#

as far as I can tell, the Luafilewriter that PZ provides is sandboxed away from the scripts folder, so I'm really not sure what else to pursue

bronze yoke
#

Transmog 2.0 Multiplayer Edition procedurally writes item scripts

#

so it's possible

astral dune
#

if vehicle scripts are handled the same, ya

bronze yoke
#

they're in the same folder!

long hill
#

i rlly wish i can aford this game modding seems so cool i have so many darn ideas is there maybe a "free" version if you understand

bronze yoke
#

and i've seen some people doing weird stuff with a ScriptManager class or something, no idea if that's helpful

long hill
#

i just want a "free" version if you understand or anything to mod does anyone know a source?

astral dune
#

ya, the ScriptManager is definitely the place to start, the code is just really challenging to read. I'll bug Mx about his transmog mod next time I see him

bronze yoke
#

so if the Luafilewriter can get into scripts, can it get into lua too? could i delete old files from before a restructuring (these don't get automatically deleted on servers) with lua so that there won't be consistency errors?

long hill
#

is there a free version of the earlier builds fo the game i could mod?

astral dune
#

I've found if I just write a file directly with the filewriter it ended up in a weird place, lemme just have another look. As far as I know it can't get into the scripts folder, because its root is somewhere else. Unless you can tell the filewriter to go elsewhere, of that I'm not sure

#

ya, the root folder is %UserProfile%/Zomboid/Lua, so you could mess with your config files, but its miles away from [steamfolder]/common/zomboid/media/scripts

bronze yoke
#

i guess we'll have to ask mx sometime

astral dune
#

dms are closed 😭

hearty dew
astral dune
#

oh ok, I was using the Filewriter from the global getFileWriter() function, I didn't know if there was another

#

I assume the mod one would be able to access the scripts folder in my own mod, which would be fine, as long as its possible to reload scripts from it on the fly

#

will probably have to write my own parser/serializer, but I guess thats not too bad

hearty dew
#

getModFileWriter() iirc

weak sierra
#

having trouble with clientcommands

#
Events.OnClientCommand.Add(function(moduleName, command, player, args)
    if moduleName == "UdderlyVehicleRespawn" then
        if UdderlyVehicleRespawn.Commands[command] then
            UdderlyVehicleRespawn.Commands[command](player, args)
        else
            print("[UdderlyVehicleRespawn] Unknown command \""..command.."\" from player \""..player:getUsername().."\"!")
        end
    end
end)```
hearty dew
weak sierra
#

this is my receiving end

#

and..

#

it doesn't arrive there from what i can tell

#

the sending end..

#
function UdderlyVehicleRespawn.SpawnVehicle(vehicleType, direction, X, Y)
    sendClientCommand(player, "UdderlyVehicleRespawn", "SpawnVehicle", 
    {
        vehicleToSpawn = vehicleType,
        spawnFacing = direction, --UdderlyVehicleRespawn.GetViaReflection(zoneToSpawnIn, "public IsoDirections dir"),
        x = X,
        y = Y,
    })
end

function UdderlyVehicleRespawn.RemoveVehicle(vehicle)
    sendClientCommand(player, "UdderlyVehicleRespawn", "RemoveVehicle",
    {
        id = vehicle:getId()
    })
end```
#

both commands are defined, and have messages that would show if they run

#

i see neither those nor the "Unknown command" message

#

am planning to add a debug line to the OnClientCommand handler but i am suspicious something else is wrong

astral dune
#

I assume you're not making the same mistake I did the other day and are looking in the right console files for your prints

weak sierra
#

im looking in server-console.txt

#

it's a dedicated local server

#

i see other things of relevance for the session

#

i see the mod initialize at the top

astral dune
#

I'm fairly new to lua, is the way you've formatted the args table correct? No square braces for the keys or anything like that required?

weak sierra
#

it's being sent as a table

#

and on the other end "args" is a table

#

the keying is key = value,

#

for shits and giggles here's the commands code

#
UdderlyVehicleRespawn.Commands["SpawnVehicle"] = function(player, args)
    local vehicleToSpawn = args["vehicleToSpawn"]
    local spawnFacing = args["spawnFacing"]
    local x = args["x"]
    local y = args["y"]
    local cell = player:getCell()
    local squareToSpawnAt = cell:getOrCreateGridSquare(x, y, 0)
    print("[UdderlyVehicleRespawn] Spawning \""..vehicleToSpawn.."\" at "..x..", "..y.." for player \""..player:getUsername().."\".")
    addVehicleDebug(vehicleToSpawn, spawnFacing, nil, squareToSpawnAt)
end

UdderlyVehicleRespawn.Commands["RemoveVehicle"] = function(player, args)
    local id = args["id"]
    local vehicle = getVehicleById(id)
    print("[UdderlyVehicleRespawn] Removing vehicle \""..id.."\" for player \""..player:getUsername().."\".")
    vehicle:permanentlyRemove()
end```
#

but again if it were having trouble pulling data out it'd have an error

#

and/or show a message

#

it's acting like it never received anythin

astral dune
#

what if we look upstream, are you sure you're actually calling your spawnvehicle function?

weak sierra
#

on the client end i see the "Spawning 1 vehicle" message

#

which indicates we are getting to this bit of code..

#

looks

#

ok no that indicates it's put into a table

#

looks more

#

ah yeah

#

there t s

#
        if (vehicleCountToSpawn > 0) then
            print("[UdderlyVehicleRespawn] Spawning "..vehicleCountToSpawn.." vehicles in cell "..cellx.."x"..celly.."..")
            --UdderlyVehicleRespawn.SpawnRandomVehiclesAtRandomZonesInCell(cellx, celly, vehicleCountToSpawn)
            UdderlyVehicleRespawn.SpawnRandomVehiclesAtRandomZonesInRandomCells(vehicleCountToSpawn)```
#

see that message pop fne

#

and that functon wth the extensvely long name calls a series of functions

astral dune
#

is a bit of a mouthful, ye

weak sierra
#

eventually down the line it calls the SpawnVehicle function

#

anyway

#

i can put an output line there just to be super certain

astral dune
#

my client commands are currently just simple proof of concept sort of things, so my args is instantiated like this:

args = args or {};
    if vehicle then
        args["_ID"] = vehicle:getId();
    end```
a bit too verbose I imagine, but its why I asked if your args table was instantiated properly. I assume it is but when debugging its always a good idea to throw out assumptions
weak sierra
#

that is equivalent to args = { _ID = vehicle:getId() }

#

(without the null check ofc)

#

i based my call format over a known working mod's calls for this purpose

astral dune
#

onClientCommand handler is in the shared or server folder?

weak sierra
#

server, though my understanding is that it is irrelevant

#

most of the code is in shared

#

but that is in server

#

as are the commands

#

i keep being told the folders mean literally nothing except load order

astral dune
#

sometimes is, sometimes isn't. I've had code be non functional because it was in the wrong folder, and also had code run when it shouldn't from the wrong folder.

weak sierra
#

can try moving the bulk of the code to the client folder next test i suppose

#

i added debug lines for this test on both ends of the client command send/receive more directly

astral dune
#

I wrote a little debug print function that funnels strings I give it to the client so my player can Say it, thats been my most useful code to date, lmao

#

got tired of having to have two console files open all the time when looking for debug lines

bronze yoke
#

that's a good idea actually, i should write something like that

long hill
#

well i guess therss no free early builds of the gamei can mod huh

weak sierra
#

there are builds of the game, they aren't "free" so much as "technically available in a grey legality" and while you could mod them to some extent they are likely lacking most hooks and will not match the current documentation or existing mods

#

modding was expanded greatly later in development

#
LOG  : General     , 1664766657850> 4,743,215,613> [UdderlyVehicleRespawn] Spawning 1 vehicles in cell 35x32..
LOG  : General     , 1664766657851> 4,743,215,613> [UdderlyVehicleRespawn] Sending SpawnVehicle client command.```
#

on the client

#

and on the server i see alerts to other commands but none of mine during that time

#
LOG  : General     , 1664766567459> 4,743,125,232> [UdderlyVehicleRespawn] OnClientCommand "RespawnINcar_OnStartGame", "true"..
LOG  : General     , 1664766568096> 4,743,125,869> [UdderlyVehicleRespawn] OnClientCommand "ZA", "createZombieStats"..
LOG  : General     , 1664766589671> 4,743,147,444> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG  : General     , 1664766589672> 4,743,147,445> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
LOG  : General     , 1664766614721> 4,743,172,494> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG  : General     , 1664766614722> 4,743,172,494> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
LOG  : General     , 1664766639715> 4,743,197,488> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG  : General     , 1664766639715> 4,743,197,488> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
LOG  : General     , 1664766659243> 4,743,217,016> [UdderlyVehicleRespawn] OnClientCommand "ConfigFile", "Load"..
LOG  : General     , 1664766665080> 4,743,222,853> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG  : General     , 1664766665081> 4,743,222,854> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
LOG  : General     , 1664766690075> 4,743,247,848> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG  : General     , 1664766690076> 4,743,247,849> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
LOG  : General     , 1664766715108> 4,743,272,881> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "getOnlinePlayerVehicleLists"..
LOG  : General     , 1664766715109> 4,743,272,881> [UdderlyVehicleRespawn] OnClientCommand "valhallaaux", "writeToLog"..
#

i can only imagine some magic requires it to run from the client folder regardless of what i have been told

astral dune
#

well, I assume sendClientCommand would throw some error if it was being called from the wrong side

weak sierra
#

assuming + PZ = lots of weird failures

#

lots of things don't work how u'd assume

#

so.. i'll try it

weak sierra
#

simple ones

#

see how they do what they do

#

mimic the general patterns/ideas but do not copy directly

sullen maple
long hill
#

but thank you again

weak sierra
#

to virtually nobody's surprise it didn't matter that i moved the code to client folder.

astral dune
#

dang

weak sierra
#

realizes player is nil cuz im not defining it

#

i guess that might be a problem but it'd be one i'd expect an error about

#

switches the calls to getPlayer()

astral dune
#

that probably matters, ya

weak sierra
#

did not matter

#

ill log in in debug mode and poke around at it instead of this slow re-upload and test

#

but im not real sure what's going wrong here

astral dune
#

now that I think about it, doesn't make much sense that the client command has a player input, you'd think that would just get appended by the command system

#

but ya, F11 that stuff. Although I don't know how to get the breakpoints to work server side, only on client code

weak sierra
#

i dont even use the f11 menu much i just type the code in debug console

#

:P

#

test code

#

ill try sending commands by hand referencing my global tables

#

ill try calling the methods

#

etc

#

i mostly use f11 menu to view local variables when something breaks

#

to get a breakpoint i just intentionally make an error happen

#

what do you do? xD

#

lmao i never learned to use most of the debugging tools i just do stuff

#

logs + code changes are all i strictly need

bronze yoke
weak sierra
#

yeah there's another variant that doesn't have player

#

do u still get that info on the other end if you use that?

bronze yoke
#

i think being able to set it directly is probably for splitscreen support

weak sierra
#

huh

bronze yoke
#

i'm guessing if there's multiple players on one machine it just sends player 1 or something

weak sierra
#

in the debug console i did sendClientCommand("UdderlyVehicleRespawn", "test", {}) and that transmitted and showed fine

#

i know other mods use the overload with player just fine

#

bikinitools for instance

#

manually called SpawnVehicle command and that worked (errored cuz i left args blank)

#

very weird

#

ill try changing the code to use that

bronze yoke
#

i wonder actually, what are you supposed to send in the player field? it can't be the player object right?

weak sierra
#

that was what i sent, lmao

#

but yeah

#

i had the same thought

#

i can understand that breaking it but not why it's silent about it

#

the java is usually not shy about spitting errors

quasi geode
# weak sierra i can understand that breaking it but not why it's silent about it
      public static void sendClientCommand(IsoPlayer var0, String var1, String var2, KahluaTable var3) {
         if (var0 != null && var0.isLocalPlayer()) {
            if (GameClient.bClient && GameClient.bIngame) {
               GameClient.instance.sendClientCommand(var0, var1, var2, var3);
            } else {
               if (GameServer.bServer) {
                  throw new IllegalStateException("can't call this function on the server");
               }
               SinglePlayerClient.sendClientCommand(var0, var1, var2, var3);
            }
         }
      }

var0 was null, the if statement didnt execute true, thus silently fails

#

though doesnt explain switching to getPlayer() failing

weak sierra
#

silent errors are not my friend

#

yeah i shudda thought to look at that tbh

#

it still doesn't work lol

#
function UdderlyVehicleRespawn.RemoveVehicle(vehicle)
    print("[UdderlyVehicleRespawn] Sending RemoveVehicle client command.")
    sendClientCommand("UdderlyVehicleRespawn", "RemoveVehicle",
    {
        id = vehicle:getId()
    })
end```
#

tries running the function from the debug console

#

ah can't really i dont know the vehicle id

#

easier to spawn a vehicle i guess

#

[UdderlyVehicleRespawn] Spawning "Base.Taxi" at 10646, 9882 for player "UdderlyEvelyn".

#

spawned a vehicle by hand using the command in the debug console fine

#

wth

#

what is this

#

[UdderlyVehicleRespawn] Sending SpawnVehicle client command.

#

so i see this in the client log

#

for the last time it tried to run on its own

#
function UdderlyVehicleRespawn.SpawnVehicle(vehicleType, direction, X, Y)
    print("[UdderlyVehicleRespawn] Sending SpawnVehicle client command.")
    sendClientCommand("UdderlyVehicleRespawn", "SpawnVehicle", 
    {
        vehicleToSpawn = vehicleType,
        spawnFacing = direction, --UdderlyVehicleRespawn.GetViaReflection(zoneToSpawnIn, "public IsoDirections dir"),
        x = X,
        y = Y,
    })
end```
#

that is the code for that

#
sendClientCommand("UdderlyVehicleRespawn", "SpawnVehicle", { vehicleToSpawn = "Base.Taxi", x = 10646, y=9882, spawnFacing = IsoDirections.N, })```
#

i sent that manually and that worked

#

i guess it's time to print out the args and see if they are sane

#

but im not sure how that'd cause a silent failure

#

it should still register receiving the command

#

what is this

#

so something is stopping it from sending the command, somehow

#

will print all args along the way and print for each call and figure this out

#

bleh

#

ohhhh

#

when i moved it to client

#

that one took precedence over the one in shared

#

and my file was still open to that one

#

so the new edits were not applyin

#

after applying changes to the other file it works.

mystic meteor
mystic meteor
#

love when that happens

#

question, how do I go from an InventoryItem to something like Base.AssaultRifle

weak sierra
#

getType() probably

#

there's other ways but that's the most direct

#

assuming it returns what i think it does

mystic meteor
#

No, getType() is going to call the Java base function.

#

It pops out whatever the class is (which is probably going to be zombie.inventory.InventoryItem@?????)

#

I think I'm gonna have to dig down into the InventoryItem's ScriptModule but I have no idea what part of that stores the name

#

and I haven't yet found the lua that controls the ItemManager for admins

#

me: opens up ISItemsListTable.lua
also me: does a search for item

mystic meteor
#

alternatively:
zombie.scripting.objects.BaseScriptObject.module.name + zombie.inventory.Item.name
BaseScriptObject.module is a zombie.scripting.objects.ScriptModule and Item derives from it.

#

so technically you can item.module.name.."."..item.name in the lua if you really needed to for some reason

weak sierra
#

for containers for example it returns things like "freezer"

#

keep in mind they call the "id" of an item the "type"

#

in pz

mystic meteor
#

...good point, I just realized something else popped out userdata or something like that

#

still, I needed the module as well, and getFullName does that

hearty dew
#

Is there an existing function that finds any/all players near to a given zombie or cell?

#

or within a map region perhaps

night badger
#

hey, i was wondering if theres a way to prevent spears from doing stabbing animation, i'd like it to swing only

#

is that possible?

summer rune
#

if i want to replace a function of a vanilla lua file Fishing/BuildingObjects/FishingNet.lua do i have to recreate the same folder structure or can i simply put it in lua/server/patches/FishingNetPatch.lua and import the function and replace it?

eg. does my FishingNetPatch.lua needs to be in the folder server/Fishing/BuildingObjects like the OG or can i place it wherever i like server/patches

shadow geyser
shadow geyser
mystic meteor
shadow geyser
# mystic meteor interesting. Any reason to use this over getFullName() that you know of?

just that its the proper function for inventory items. getFullName is a bit weird. I do see it being used alot for movables, and for vehicles which seems weird. from the java, getFullName seems like a generic for the Item class. but the getfulltype belongs to InventoryItem. You are more likely to get hard to debug errors in the case that you accidentally call getfullname on something that isn't a inventoryItem. basically just cleanliness would prefer using the getfulltype()

#

I don't expect any errors happening, but it could happen

mystic meteor
#

Noted. It does seem like the better choice since it's defined in the inventoryitem class

#

and it seems like Inventoryitem overwrites module anyway

#

...wait InventoryItem doesn't derive from anything
so that negates the entire chain I found

shadow geyser
#

no, but it just has item as a attribute

mystic meteor
#

Right, right

#

okay... I think I see what's going on here

#

Items are (probably?) part of the prototype process, and when spawned in, get created as an InventoryItem

#

somehow I missed that when doing my initial dive.

shadow geyser
#

if I had to guess, it also probably has a role in storing info for when the item is converted back and forth between a worldinventoryItem and a InventoryItem

mystic meteor
#

interesting, I didn't even know about that

#

oh I see why I got confused - the Item List Viewer works with items, which interacts with the item registry

#

which is where I first found the function

#

damn shame though. On the other hand, I could probably make an Item that I wanted and copy stats from that......

shadow geyser
#

huh, actually inventoryItem also has a worlditem field which contains a isoWorldInventoryObject. I wonder if that always holds the javaobject for that item. If it does, then we can potentially store modData for inventoryItems without it getting wiped by using the InventoryItem.getWorldItem():getModData()

#

because it was always annoying that using the moddata of inventoryItems wouldn't save

mystic meteor
#

ooh. That'd be good for my use case, since I really only need the conversion once. Let me know if it pans out.

drifting ore
#

Looking for a mod that adds the ability to write newspapers/comic books, is this possible?

mystic meteor
#

reasons I hate Lua: ~= is the "not equal" operator

mystic meteor
drifting ore
#

Saw a post once on facebook that was about someone being a base rat and just writing comic books all day

mystic meteor
#

yeah, that sounds like you'd just need to add a recipe for it, no fancy lua needed

drifting ore
#

Just wondering what the mod is that does this

mystic meteor
#

not enough of a clue to track it down, sorry

mystic meteor
#

...I'm dumb. Those are protected values. No WONDER the Lua can't get at them

gilded hawk
#

What do this script items properties do?
AimingPerkCritModifier
AimingPerkRangeModifier
AimingPerkHitChanceModifier
AimingPerkMinAngleModifier

shadow geyser
#

they all affect how much your aiming skill improves your shooting with that gun

hearty dew
#

From lua, is there a way to use java reflection to get a handle to a class object that isn't directly exposed? LuaManager.GlobalObject has enough to get field values and invoke methods (and it works fine for java types already exposed in lua), but I see no way to directly lookup a java.lang.Class from a string e.g. if I wanted to create instances of a java enum

hearty dew
#

Actually, that wouldn't work because the methods to lookup fields and methods in LuaManager.GlobalObject take an Object as a parameter, not a Class. Hrm.. I guess I have to find some round about way to get a hold of an instance

gilded hawk
#

getClassField sets the property of an item to exposed, according to the java code I read

hearty dew
#

Right. That works fine when you have an Object. I don't. That's my issue atm

gilded hawk
#

Oh, 🤔

hearty dew
#

For example, I'm trying to get an instance of an enum value (the type checker between lua and java doesn't automatically convert an int to an enum, unfortunately)

low sky
#

i am gonna keep talking storm api until it starts to become a widely used modding api in zomboid

#

there is literally 1 other person on github who has uploaded a mod 💀

ancient grail
#

where does the game store the moddata?

shadow geyser
hollow current
#

Couple of questions:
1- How do I check whether the players's character is male or female?
2- How do I add a sound source that can be heard by zombies in x distance?

gilded hawk
#

Is it possible to get the getDisplayName always in a set language? 🤔 Like, always english, or alway italian, etc etc?

shadow geyser
gilded hawk
#

Or atleast always in english

shadow geyser
#

getText will give the text, in the current language

#

if you want a different language, you will probably need to check the java decompile for that

#

there is a Translator.java which probably will have a function for it

gilded hawk
#

Because my code

local displayName = item:getDisplayName()

Is generating the DisplayName also in the game selected version, and this is f-ing up my mod if a server has a different language than the client

shadow geyser
#

hmm, I thought getDisplayName() gave the original name but I guess not if that is what is happening

gilded hawk
gilded hawk
shadow geyser
#

I do not envy you to have to solve this

gilded hawk
#

yeah, I went with ha different approach

shadow geyser
#

although, you could maybe just give them all a simpler recipe name. just Give cosmetic version

#

people can still use them by right clicking the item

gilded hawk
#

local displayName = 'Clothing' --item:getDisplayName() in my generator

In my items fix

function ApplyItemsFix()
    local sm = getScriptManager();
    local allItems = sm:getAllItems()
    local size = allItems:size() - 1;
    print('-------START ApplyItemsFix--------')
    for i = 0, size do
        local item = allItems:get(i);
        -- I need to use tostring, getType returns a Java Enum
        local isTransmogged = item:getModuleName() == "TransmogV2"
        local nameToFind = string.gsub(item:getName(), "_", ".", 1) .. ''
        local originalItem = sm:FindItem(nameToFind)
        if isTransmogged and originalItem then
            -- print('nameToFind'..nameToFind)
            item:setClothingItemAsset(originalItem:getClothingItemAsset())
            -- Needd to avoid problems :-/ with different language from server to client :-/
            item:setDisplayName(originalItem:getDisplayName())
        end
    end

    -- Good old trick to force the refresh
    local player = getPlayer();
    player:resetModelNextFrame();
end

Events.OnLoad.Add(ApplyItemsFix);
shadow geyser
#

I doubt people would be searching for the item in the craftingUI

hollow current
shadow geyser
west hawk
#

this seems better placed here rather than #modeling, I've realised

hollow current
shadow geyser
#

no it is a different addsound in the luamanager

#

it is used alot in the vanilla lua code

hollow current
#

oo i see

#

what is var1, var2 ... var6?

shadow geyser
#

I suggest you check addSound decompile, or check the uses of it in vanilla lua code

hollow current
ancient grail
#

😦

#

my script was working onlocal hosted server but as soon as i tried it on mp server it gets very messy the script only writes the ini file on the local ... tried using sendclient and this happened 😦

shadow geyser
ancient grail
#

ow misunderstood it

#

sorry

hollow current
#

nvm

shadow geyser
#

you can tell notepad+++ or an ide to search in your project folder

hollow current
#

found "Find in File' option in notepad++

#

Got it, thanks so much!

ancient grail
#

😵‍💫 guess its time to give and try again tommorow

clever totem
#

hey guys! I tried to take a look at caps

#

and it all seems good but whenever I try to wear it this happens

mystic meteor
gilded hawk
#

New tooltip 😄

low sky
#

Is anyone doing anything with storm api?

astral dune
# gilded hawk New tooltip 😄

nice, I can't remember which weapon tooltip mod I'm using, but being able to see brita's weapon's actual stats has made me make very different choices as to which guns to carry around

gilded hawk
#

Atleast now I know how little damage I'm doing lol

low sky
#

Can you just make a mod that shows all gun stats ?

#

Not for certain mods

#

But for all of em

gilded hawk
#

Yeah, that's what I'm doing rn

low sky
#

Swag

astral dune
#

Excited to see that. I like the way you formatted it. I assume the left column is the default stats, and the right column is its current condition?

gilded hawk
astral dune
#

oh, you're comparing them? That's neat. Current stats of what's in your hand?

gilded hawk
#

Stats of the selected weapon in the inventory

silent bramble
#

guys is there any mod in which u can craft your own fire weapons?

astral dune
#

that's even easier. Now, the stats in your picture are the same, but the guns are different. What is that laser doing?

gilded hawk
#

what the F are these stats dude!

gilded hawk
#

Does anyone know the effect of

AimingTime
ReloadTime
RecoilDelay

and if they are in seconds or a different time unit?

astral dune
#

if you hit the max on a stat you should color it differently

balmy glacier
#

hey! i'm trying to get all Drainable items when a zombie dies but never receive any items. i'm checking the bodies but there are definitely Drainable items in there (Lighters, Matches,...). when i get all items from the container and check for :IsDrainable() there are some items of that type but i can't check which because each and every method returns null as a result. The lua code is located under server. I'm doing the same with Clothing and Weapons but this works as expected. Is anything different when handling a Drainable?

#
Events.onZombidDead:addListener(function(zombie)
    if zombie == nil then
        return
    end
    local itemContainer = zombie:getInventory()
    local items = itemContainer:getItemsFromCategory(ItemType.Drainable:name())
quasi geode
# gilded hawk Does anyone know the effect of ``` AimingTime ReloadTime RecoilDelay ``` and if...

different units. I havent messed with the b41 stuff & how RecoilDelay plays with the anim, but b40 Recoil + swingtime define the RoF... ReloadTime is for timed actions (modified by skill lvl)

AimingTime is poorly named..its not actually a 'time' at all. As the player moves around, a aiming penalty builds up (and decreases as the player stands still), reducing the hit chance. AimingTime is a reduction on that penalty (higher = better, easier to shoot moving)

astral dune
#

so aiming time is a cap on the penalty, or a multiplier of some kind?

quasi geode
#

its basically works like a cap

#

theres already a cap, but it reduces it to a lower value

astral dune
#

what is the default cap based on?

bronze yoke
quasi geode
#

idr the exact value, i'd have to dig through my notes but the default is just a hardcoded value

astral dune
#

for all weapons? I guess thats my real question

quasi geode
#

just firearms unless somethings changed...if you play with target highlighting on you can see the movement penalty change

#

least vaguely see it as it goes red > green etc

astral dune
#

but like, does a shotgun and a pistol have the same default unmodified cap?

quasi geode
#

ya

balmy glacier
astral dune
#

huh, that seems kinda weird

quasi geode
#

should be the same across all firearms, which is fine. the individual firearm's aimingtime stat handles reduction on that cap

astral dune
#

so the firearm has an aiming time, and I'm assuming your aiming skill modifies that as well?

#

or does it just do accuracy?

quasi geode
#

ORGM used to do it mostly by barrel length and weight...lighter shorter guns (pistols, smgs etc) would get higher aimingtime for easier movement, building clearing etc

#

i honestly cant remember if skill modifies it, i'd have to recheck

glacial flicker
#

Is there a guide to make traits?

terse flame
#

Hey, is there any better way to find out what mods are conflicting other than disabling bit by bit?

quasi geode
#

looks like it does. (aiming skill modifies). going through my old code to display it:

    -- hit chance
    local beenMoving = player:getBeenMovingFor()
    local aimingPerk = player:getPerkLevel(Perks.Aiming)
    local hitChanceMod = item:getHitChance()
    hitChanceMod = hitChanceMod + item:getAimingPerkHitChanceModifier() * aimingPerk
    local hitChancePenalty = 0
    if player:IsAiming() and beenMoving > item:getAimingTime() + aimingPerk * 2 then
        hitChancePenalty = (beenMoving - (item:getAimingTime() + aimingPerk * 2)) * -1
    end

basically:

player:getBeenMovingFor() - (item:getAimingTime() + player:getPerkLevel(Perks.Aiming) * 2)

though this maybe outdated now. would have to dig through the decompiled stuff

gilded hawk
#
if (var2.isRanged() && var1.getBeenMovingFor() > (float)(var2.getAimingTime() + var1.getPerkLevel(PerkFactory.Perks.Aiming))) {
            var13 = (int)((float)var13 - (var1.getBeenMovingFor() - (float)(var2.getAimingTime() + var1.getPerkLevel(PerkFactory.Perks.Aiming))));
         }
glacial flicker
astral dune
#

so a theoretical terrible weapon with a 0 aiming time would need you to be moving for 20 units of time before you get a penalty at aiming skill 10, equal to whatever is over that cap

#

but the time unit isn't seconds? Is it ticks?

quasi geode
#

looking at the code Mx posted (its more relevant then my old b40), then no...you'd have .getBeenMovingFor() > 10 for the penalty to kick in with 0 aimingtime and skill 10 (the *2 multiplier seems no longer there)
if you wanted to find the exact units you'd have to check the code where its getting incremented, personally i find it more helpful not to think of it as a time unit at all
with my old testing it would hit its cap (might have been 95? idr now) after about 5 seconds of movement, and take about the same time to decrease

gilded hawk
#

There are a couple of extra debuff if you are walking tho

if (var2.isRanged() && var1.getBeenMovingFor() > (float)(var2.getAimingTime() + var1.getPerkLevel(PerkFactory.Perks.Aiming))) {
            var13 = (int)((float)var13 - (var1.getBeenMovingFor() - (float)(var2.getAimingTime() + var1.getPerkLevel(PerkFactory.Perks.Aiming))));
         }

         if (var3.getObject() instanceof IsoPlayer) {
            IsoPlayer var16 = (IsoPlayer)var3.getObject();
            if (var16.isPlayerMoving()) {
               var13 -= 5;
            }

            if (var16.isRunning()) {
               var13 -= 10;
            }

            if (var16.isSprinting()) {
               var13 -= 15;
            }
         }```
#

Yo wtf

quasi geode
#

ya thats new (well, new for 41 vs 40)

#

yep, extra 20 hitchance for marksman. disabled trait lol

gilded hawk
#

Oh, I see, the marksman trait is disabled, but was for the police officer

quasi geode
#

ya profession trait thats not given to anything anymore. been disabled for ages. used to use it for sniper professions on our server though

gilded hawk
#

Interesting, I'm surprised is still there

quasi geode
#

wouldnt be surprised if it makes it back in there when npcs arrive

quasi geode
#

ya

gilded hawk
#

That will be truly interesting

pure pine
#

Can anyone teach me how can I use just some things from a mod?

gilded hawk
hearty dew
#

Or check their license

#

Is there an existing way to find any/all nearby players to a zombie? Perhaps a way to enumerate players in active regions near the zombie? Or just need to iterate over players and try to estimate based on distance?

gilded hawk
#

Or you can try the hard painfull way of trying to learn how to do 3d and then realize it's too much of a hassle and go back to write only code and ruin your dreams of modding

pure pine
#

but thanks

gilded hawk
#

Then you should be fine by making a copy of the mod and editing it

shadow kernel
#

I'm able to add mods mid-save right?
(of course heavily dependent on the type of mod and what it changes I assume

astral dune
#

dislaik was in here giving tutorials like 3-4 days ago

gilded hawk
#

Me he dislaikes being online at this time

#

🥁

astral dune
#

lel

tame sorrel
#

someone should make a mod in PZ where you can hug people to be less sad

astral dune
#

people are trying to hug you ingame all the time already

tame sorrel
hollow current
#

what's the function for controlling player's vision cone and accuracy?

steel jasper
#

Anyone have a quintessential CDDA mod list? Still enjoying PZ, but unfortunately CDDA has spoiled me. I've yet to fiddle with Hydrocraft, but that paired with CDDA Zombies + Brita's + Armory + NPCs + Quests looks like it'll fix a lot of those desires and make the game feel a lot more lively/dangerous/challenging.

I'm already at the point where I've secured an enormous warehouse base and subsist off of foraging/trapping/water barrels.

astral dune
#

This channel is unfortunately named

steel jasper
astral dune
#

haha, they should really just call this one mod_dev, but ya I think the support channel is for talking about mods. I'd help you but I don't even know what CDDA is

hybrid crest
#

Hey guys. I want to try making a mod that makes seasons last 1 month instead of 3. But I wasn't able to find seasons logic anywhere in lua code. Is it hardcoded in java code, or did I miss something?

astral dune
#

I think I've seen a mod like that, or maybe it was just a config option ? Don't remember

hybrid crest
#

@astral dune there are several mods that make seasons shorter by skipping days. But they all have issues, like lag at the end of each month or messing up zombie loot tables with daysSurvived.

pallid chasm
#

Is there a way to give weapons a condition where its only usable if you have a certain level of weapon skill?

weak sierra
#

observe, i have done the undoable

hollow current
#

oo this looks nice

astral dune
#

grats

astral dune
#

oh, this doesn't do what I assumed it would, these are neat features

#

how do you tell if a vehicle hasn't been seen in a while?

weak sierra
#

it tracks it

astral dune
#

attaching a timestamp?

weak sierra
#

yeah

#

configurable distance at configurable client-side polling interval

#

(the polling is clientside not the configuration lol)

astral dune
#

thats pretty handy. I've been looking for a way to figure out when a vehicle has been loaded, but this is the "scan all vehicles loaded" code you were talking about the other day isn't it?

weak sierra
#

yes

#

everything u may have wanted to ask about this subject is within

#

:p

weak sierra
#

oh i am not doing that

#

im just doing distance to target

#

and presuming it is "seen"

#

cheap check

#

after all ur viewing it from the sky

#

im more concerned with the PLAYER seeing it than the character

astral dune
#

haha, I was mulling over what it would take to alter a vehicles model when it gets loaded to the client, before the player can see it, still don't think its possible

bronze yoke
#

what are you trying to do with that?

astral dune
#

stick a turbo out of the hood or attach plating to vanilla vehicles

weak sierra
#

lol son of a bitch last minute changes produce error, ah well ill fix.

astral dune
#

essentially any visual change you'd want to make to a vehicle based on tags

weak sierra
#

forgot "pairs" on a for loop

#

hehe

bronze yoke
#

if you just want to change a vehicle's model in lua, just hook into engine oncreate

weak sierra
alpine scroll
#

I have a little problem that I dont understand why is not working

#

I did a mod with other things, but including a translate files for the VHS

#

However, the game is showing the original, untranslated name

#

Any ideas why?

bronze yoke
#

is it on line 1?

alpine scroll
#

What you mean on line 1?

bronze yoke
#

like the first line of the translation file?

alpine scroll
#

My file goes like this

bronze yoke
#

oh then i don't know

astral dune
alpine scroll
#

Its actually on line 70

#

If it matters

astral dune
bronze yoke
#

just when it's created

astral dune
#

ah ya, so those changes would apply to every vehicle instead of one particular one

bronze yoke
#

i may have misinterpreted what you meant

#

it's fired the first time each particular instance of that vehicle loads

astral dune
#

like, the first time you come across a sportscar, but not every sportscar?

bronze yoke
#

it's just every time a vehicle spawns

#

i used it to change certain vehicles' skins based on their spawn location, for example

astral dune
#

right, so I think we were talking about the same thing after all, assuming by "spawn" you mean the original creation of a new vehicle on the map

bronze yoke
#

although now that i'm looking back at it

#

i set mod data and checked it (so that the code wouldn't re-run), so maybe it is every time it loads

#

i don't remember testing if that was necessary or not

hearty dew
#

Does pz recycle zombies in an object pool or something tricky? It seems like mod data I put on zombies sometimes shifts around to another zombie when I walk some distance away

astral dune
#

interesting, when I get home I'll hook into that event and see when it fires. If an engine is "created" every time that vehicle comes into view, then I could certainly use it for what I want. If its just new vehicles then I can't

astral dune
bronze yoke
#

you were trying to add armour to vanilla vehicles right?

astral dune
#

essentially I want to add all kinds of visible attachments, by the player, with a mechanics like action, and have them be visible when the vehicle comes into sight, and not pop in once you touch the car

bronze yoke
#

yeah you can just give the part a model

astral dune
#

can you give a vehicle a part it isn't scripted to have?

hearty dew
#

Well, the clothes definitely swapped if nothing else 😂
I had a name tag on two zombies (set via mod data), one in a bathrobe outfit and other in an armycamogreen outfit. I walked a screen or two away, and when I came back, the bathrobe wearing zombie was named soldier and the armycamogreen outfit wearer had the bathrobe Z's old name

bronze yoke
#

yeah, my mod does this

#

i create a template vehicle with all the parts

    template vehicle CarNormal_Upgrades
    {
        part Cowcatcher
        {
            model
            {
                file =  Vehicles_CarNormal_Cowcatcher,
            }
etc etc

and just use vehicletweaker to add the template to the vehicle script

TweakVehicle('Base.CarNormal', 'template', 'CarNormal_Upgrades')
astral dune
#

interesting. On that note, how do you handle something like a cowcatcher? Are you comparing every part's condition with a stored value every tick and rolling back changes? thats the only thing I've seen so far and seems like that would be a bad performance hit

bronze yoke
#

yeah

astral dune
bronze yoke
#

there's also a case where you can deal enough much damage to a window in one hit that it breaks and that sort of messes up that entire process (since windows just get removed when they run out of durability)

astral dune
#

I should probably have a closer look at tweakvehicle, I wonder if it already does when I'm intending to do

#

ya, I noticed that with some vehicles

bronze yoke
#

i think that's why the autotsar vehicles just set your parts to 100% with protection

astral dune
#

There is an event that fires when you hit an obstacle rather than a zombie, which I think is the only way you could do so much damage as to blow up a window, probably could leverage that

bronze yoke
#

oh there is?

astral dune
#

actually its not an event, but yes the damage when you hit a tree or another car is calculated lua-side, so you can hook into it

bronze yoke
#

i don't think zombies damage windows so that's a much better idea for those parts

astral dune
#

don't they smash side windows?

bronze yoke
#

oh that's true...

hollow current
#

as far as I know, they do. You even have a chance of dying while inside your vehicle if your side window is smashed (and there are a lot of zombies around, obv)

bronze yoke
#

i was only thinking of collisions

astral dune
#

ya, they can get you if there aren't windows in the way, and I could have sworn the windshield will get damaged with the hood when you hit one, but I don't know for sure

#

but ya, by hooking the function, I think its called Crash, I've been able to reliably block all damage from collisions with everything except players/zombs

bronze yoke
#

actually yeah they might damage windscreens u_u

#

i wonder how often the part update functions are actually called

astral dune
#

ya, I dunno. Tried hooking them but it didn't seem to work, I imagine the java doesn't call the lua side for that

hollow current
#

Would be nice if anyone knows which functions to use to be able to control the player's vision cone and his accuracy when firing/using melee weapons (chance to miss the swing). I can't find any reference to them in the APIs or vanilla files so far

astral dune
#

Its typically altered by aiming a gun, right? If so I'd look there. I've never looked into it. Oh, there is also a mod that messes with your screen if your glasses fall off, but I think they're custom shaders

hollow current
#

aah i seee

#

thanks for the help!

bronze yoke
#

yeah that just uses the vision blur from foraging

astral dune
#

I haven't tried making a far-sighted character with that mod, can it still use the foraging shader for that

#

?

#

glasses fall off way too easily, and they break all the time. After carrying half a dozen glasses around all the time I got tired of that mod pretty quick, lol

bronze yoke
#

i think the way far sighted works is your screen gets blurrier the more you zoom in

hollow current
#

@astral dune can you reference me to that mod

hollow current
#

Thanks!

gilded hawk
astral dune
#

that was quick

gilded hawk
#

Speedy modder

weak sierra
#

nice, how does it play with other mods that add extra tooltips below the items?

#

i don't think i have another that would affect weapons but im sure they're out there

#

think ill add that to my serv

hearty dew
#

How difficult would it be to have the character models of certain zombies scaled in size in some dimension. For example, if you wanted certain zombies to be short. I imagine that'd be a significant amount of work because you'd need to manually create a short model as well as 'short' versions of the clothing/weapons? Or is there a simpler way to do said scaling via lua I'm overlooking?

fervent escarp
#

hello i have two questions:
is the commanders hobbies mod working ?
second any suggestion on more mods that add things to collect ?

weak sierra
#

you could probably distort them to some extent without doing that but for it to look good..

#

AuthenticPeach did just that for fat/thin zombies

#

the former

#

so i assume they considered just distorting the size without new rigging/models

#

and thought it was inadequate (or it was impossible shrugGirl )

#

i know nothing more about that though

#

if you find something lmk

astral dune
#

hey @bronze yoke I forgot to ask you earlier, what is your mod that does the vehicle template stuff? I'd like to have a look at it

bronze yoke
#

it's not finished yet

astral dune
#

oh, bummer

bronze yoke
#

the full extent of it it is just to add armour to vanilla vehicles

#

but since modelling isn't my favourite it's going slow

astral dune
#

oh interesting. But your concept has been working? I will likely try to do my thing the same way, hopefully we can find a way to keep it intercompatiible

bronze yoke
#

yeah the lua is really straightforward

#

i'm just behind on the actual assets

astral dune
#

you said you were using VehicleTweaker as a requirement, right? I was just about to look at it now

hollow current
bronze yoke
#

nice!

hearty dew
# weak sierra AuthenticPeach did just that for fat/thin zombies

Thanks. Do you happen to know the name of the mod of theirs has fat/thin zombies? Isn't obvious looking at the list of mods showing up in steam workshop search (and steam is displaying some error when trying to view their profile's full workshop list for some reason)

random finch
#

Does anyone know the max value for the script sound clip property distanceMax?

Not sure if there is a way to easily debug the distance a sound can be heard from but there is a max that I cannot seem to find in the java source.

winter bolt
ancient grail
random finch
astral dune
#

can't seem to get ahold of a string containing the contents of a vanilla vehicle script from the scriptmanager or the vehiclescript itself. Anyone know if its possible?

random finch
#

add all the properties to a table using tostring?

gilded hawk
#

Is it possible, as a server to send info to a client before it can log in? 🤔

random finch
astral dune
gilded hawk
#

Cause I'm considering to make my mod receive the TransmogItems.txt from the server if the mod is used in MP, this should fix sync issues

quasi geode
astral dune
#

thats a bummer, but not totally unexpected. If I can get a hold of all of the fields I guess I can serialize it

bronze yoke
#

is there a reason you can't use vehicle tweaker?

astral dune
#

vehicle tweaker tweaks all vehicles of a particular type. I want to change the properties of one specific instance of a vehicle

#

I'd like to then export this custom script to a file name tagged with the vehicles sqlID so that the game will automatically load it later

#

otherwise, if I can figure out how to get the script manager to make a copy of a script that I can then tweak, I suppose I could do it at boot from data stored in the global moddata

#

I'm open to suggestions on other ways to achieve this, of course

bronze yoke
#

so you sort of want unique variants of vehicles that have altered scripts?

astral dune
#

yes. So for example I take a particular Chevalier Cossette with ID 252, and alter its Engine Power to 800hp, then write out a script called vehicle_car_sports_252.txt with that change made

#

and of course change the script of that one sports car to be the new, revised one, leaving all the other sportscars alone

quasi geode
astral dune
#

nope, hence why I have to dive down this rabbit hole

#

Indie Stone has confirmed that it doesn't work, intentionally as they put some test variable in there to try out the new engine sounds

#

said they "may" revert it in build 42, so until then I gotta hack my way around it

#

you can see for yourself in CarController.control_ForwardNew() these two lines"

      var13 = (float)this.vehicleObject.getEnginePower();
      var13 = this.vehicleObject.getScript().getEngineForce();

so the engine power set by the engine feature function just gets immediately overwritten by the default engineforce from the script

#

this is also why reductions in engine power based on engine quality don't actually work, and I suspect why the enginepower shown in the mechanics ui reverts to max after you've driven the vehicle once

#

funnily enough, this isn't done in the code for reversing, just driving forward.

quasi geode
#

personally i'd wait til it gets fixed & theres a proper method of setting the power instead of using some extreme hack method.
this ruins a WIP mod i started ages ago... but i cant complain not like i've been active with it lately

astral dune
#

I would like to have this functionality now or soon, and since I don't know when 42 is coming out or if they'll remember to fix it by then, I don't have much choice but to move forward with a hack

#

I've considered even using Storm and trying to fix it at the java level myself

#

I would likely wait until the fix is in before releasing the mod publicly though

gilded hawk
#

Are there any events that I can send/receive from the server before this happens?

Force disconnect [checksum-File doesn't match the one on the server:

I need it for my mod to get the server to send me correct script items

astral dune
#

seems like this is relevant to me too

#

I assume its your transmogItems.txt that isn't matching?

astral dune
#

Recompiled the car controller class to fix to the EnginePower issue 😏
Now I can build my mod and test it against what I assume the code will look like in build 42, rather than try to mess with scripts any further
Thats a weight off 😂

#

5000hp cossette is a little hard to control, lel

dark finch
#

anyone know of a mod that where players can rank up and every milestone be rewarded.

mystic meteor
astral dune
#

haha I don't have any video capture software

#

did just find this tree though, I guess its wondering how I hit it at 150mph and took no damage

mystic meteor
#

good times, huh?

astral dune
#

its a little weird going through other people's mods to see what sort of things they do

mystic meteor
#

I hear that. I was personally shocked when I saw how simple ItemTweaker was, for example

astral dune
#

yep, pretty basic

#

MoreTraits' Expert Driving trait does a few nonsense things

mystic meteor
#

Now I'm working on basically re-implementing it except working on existing items too FaunaTired

#

actually that brings up a good point, how do I use the Lua debugger?

astral dune
#

what are you trying to do?

mystic meteor
#

with the debugger? I just want to get more info on tables without having to resort to this sort of thing:

#

actually... I wonder...

astral dune
#

right, well as long as the code is running client-side, and you have the -debug tag set, then hitting F11 will bring up a window that you can search for your lua files in and set breakpoints

#

lol, setting a car to weight 1lb also makes it undrivable. This is pretty fun to mess around with ngl

mystic meteor
astral dune
#

it does reset its weight after a few seconds, I don't know if its a sync with the server or what that's causing it

#

thats if you set its current mass directly. Set the weight of the frame to 1lb and it stays that way, you just get a couple hundred lbs of parts added to it on the next sync

mystic meteor
#

Does anyone know of a good way to hash a lua table?

hearty dew
#

The contents? Or the object itself? If the object, the address may be sufficient, depending on your requirements

#

if the contents, pick your favorite hash, and recursively hashing the contents ought to work

mystic meteor
#

The contents, mostly. I need some way to identify if the changes in the current table are the same as before, since there's a chance I can save the "has been modified" state between saves.

#

does Lua have any hashes? Or can I use a java hash inside of Lua?

hearty dew
#

For java objects, you might can use the hash method on exposed objects

#

For lua objects, you'll probably have to roll your own (bc you have to roll everything on your on in lua 😅 )

mystic meteor
#

I'll have to figure out some other option then.

green spear
#

Good afternoon everyone, let me introduce myself my name is Henry. I am looking for people who can help me with a server project that I have, I wanted to know if there is anyone interested in doing scripting work, of course I am not looking for something free, but I am willing to pay for these services.

I'm doing a crazy project with a friend and we need a programmer to make a command mod for the role play and create some respawn systems, shops and other things inspired by FIVEM and SAMP.

The knowledge required to make these systems seems to require advanced knowledge (I don't know how PZ scripting works)

If this project succeeds, we plan to make it the foundation for these types of servers in the Workshop. It's a very ambitious project haha, but we can make PZ the perfect roleplaying game.

Greetings. 🙂

ruby urchin
summer rune
#

We are using several modded maps and Britas armor mod for our dedicated server. We are also using a mod that reduces the rarity of the overall server to extremely rare. Now, Some members have reached out to me that the loot amount of the modded maps is way too much and completely different than vanilla map location, as well as the military zombies drop too much gear.
I suspect the manual loot distribution of these mods are the cause of the problem. What do you guys think? And also what can I do to reduce the the amount then?

gilded hawk
#

I'm trying to use this events but I'm getting no logs no anything 😦


Events.OnLoginState.Add(function ()
    print('Events.OnLoginState')
end);

Events.OnLoginStateSuccess.Add(function ()
    print('Events.OnLoginStateSuccess')
end);
gilded hawk
#

Also for some damn reason my NoSteam Test server is not loading the mod I'm trying to use 😦

wooden lodge
#

Okay friends

#

I don't get making a custom profession. I've got it to show up but for some reason the traits I assign can be removed again and then double themselves in the list

#

All the vanilla professions come with "locked" traits, so how does one achieve that?

#

For example, here you can see that I'm able to change the traits around

#

While in this one it's not able to be removed

#

Am I like, missing something?

#
local soldier = ProfessionFactory.addProfession("soldier", "New Hope Army Soldier", "profession_veteran2", 2);
    soldier:addXPBoost(Perks.Aiming, 5)
    soldier:addXPBoost(Perks.Reloading, 5)
    soldier:addXPBoost(Perks.SmallBlade, 5)
    soldier:addFreeTrait("Brave");
    soldier:addFreeTrait("Smoker");
    soldier:addFreeTrait("Dextrous");
    soldier:addFreeTrait("SlowHealer");
#
local chef = ProfessionFactory.addProfession("chef", getText("UI_prof_Chef"), "profession_chef2", -4);
    chef:addXPBoost(Perks.Cooking, 3)
    chef:addXPBoost(Perks.Maintenance, 1)
    chef:addXPBoost(Perks.SmallBlade, 1)
    chef:getFreeRecipes():add("Make Cake Batter");
    chef:getFreeRecipes():add("Make Pie Dough");
    chef:getFreeRecipes():add("Make Bread Dough");
    chef:getFreeRecipes():add("Make Biscuits");
    chef:getFreeRecipes():add("Make Chocolate Cookie Dough");
    chef:getFreeRecipes():add("Make Chocolate Chip Cookie Dough");
    chef:getFreeRecipes():add("Make Oatmeal Cookie Dough");
    chef:getFreeRecipes():add("Make Shortbread Cookie Dough");
    chef:getFreeRecipes():add("Make Sugar Cookie Dough");
    chef:getFreeRecipes():add("Make Pizza");
    chef:addFreeTrait("Cook2");
#

Like, I don't get it? it's basically the same thing, how does it define to be locked

#

If you have an idea or solution for this, please DM me ♥️

oak cipher
#

Anyone here open to make me Vehicle or Weapon mods - This is for commission
I'm one who commissioned

Autotsar Tuning Atelier - Bus
True Actions - Lying and Sitting
Autotsar Tuning Atelier - Jaap Wrungel
ZuperCart - Carts & Trolleys

Just to name a few for the PZ community to enjoy 😄
If you are open to work on a project with me please do DM me of your mod samples

shadow geyser
# wooden lodge ```lua local chef = ProfessionFactory.addProfession("chef", getText("UI_prof_Che...

I dont think they are marked as locked. there are 2 traits, and they are mutually exclusive. the cook trait to select is "Cook", while the free one you get from the profession is "Cook2". so "Cook2" is a trait, that you cannot select, while "cook" is one you can select. if you have "cook2" from a profesion, because it is mutually exclusive with "cook", "cook" is removed from the selections as you cannot select it any more.

wooden lodge
#

So I assume I can make it Brave2?

#

and Smoker2?

#

The funny thing actually

#

You can select Cook on other professions

#

This is all a bit confusing

shadow geyser
#

so the addTrait call which is creating the trait I think, is what defines if it is selectable or not

unique goblet
#

I know how to make multiple tiles wide moveables, but is there a way to make moveable that is two tiles high? I tried making single square moveable and then adding "second storey" using OnObjectAdded but that doesn't work because gridSquare above initial moveable base doesn't exist until after execution of OnObjectAdded.

shadow geyser
#
TraitFactory.addTrait("Cook2", getText("UI_trait_Cook"), 0, getText("UI_trait_Cook2Desc"), true);
local cook = TraitFactory.addTrait("Cook", getText("UI_trait_Cook"), 6, getText("UI_trait_CookDesc"), false);
#

the final boolean at the end tells the constructor if that is a profession or not

#

so I think you just need to make the new traits, which true at the end to stop it being selectable

gilded hawk
#

Events.OnLoginState.Add(function()
    print('MxEvents.OnLoginState')
end);

Events.OnLoginStateSuccess.Add(function()
    print('MxEvents.OnLoginStateSuccess')
end);

Events.OnConnectionStateChanged.Add(function(state, message)
    print('MxEvents.OnConnectionStateChanged')
    print("state" .. tostring(state))
    print("message" .. tostring(message))
end)

Events.OnConnected.Add(function()
    print('Events.OnConnected')
end)

FYI: Events.OnConnectionStateChanged Is triggered before the game checks for the checksum 👀

#
LOG  : General     , 1664883343932> 0> MxEvents.OnConnectionStateChanged
LOG  : General     , 1664883343932> 0> stateConnected
LOG  : General     , 1664883343932> 0> messagenil
gilded hawk
#

I think I found a way to do it, does anyone know how to create a new option inside
getServerOptions() ?

#

I think I can read the server settings before the server boots you for having the wrong file

LOG  : General     , 1664885668781> 170,072,310> LOGGED INTO : 362 millisecond
LOG  : General     , 1664885668782> 170,072,310> ConnectToServerState: Start
LOG  : General     , 1664885668798> 170,072,327> ConnectToServerState: TestTCP
LOG  : General     , 1664885668832> 170,072,360> MxEvents.OnConnectionStateChanged
LOG  : General     , 1664885668832> 170,072,360> stateConnected
LOG  : General     , 1664885668832> 170,072,360> messagenil
LOG  : General     , 1664885668832> 170,072,361> getServerOptions()zombie.network.ServerOptions@1eb7fdf0
LOG  : General     , 1664885668832> 170,072,361> getServerOptions():getOption("SpawnItems")Base.Belt
LOG  : General     , 1664885668832> 170,072,361> Connected,nil

👆 It did log in, and then it got booted Connected,nil for having wrong check sum

#

I'm planning to do something like this

Events.OnConnectionStateChanged.Add(function(state, message)
    print('MxEvents.OnConnectionStateChanged')
    print("state" .. tostring(state))
    print("message" .. tostring(message))

    sendClientCommand("Test", "SimplePrint", {
        playerId = 'Penis OnConnectionStateChanged'
    });

    print('getServerOptions()'..tostring(getServerOptions()))
    print('getServerOptions():getOption("CustomOptionNameHere")'..tostring(getServerOptions():getOption("CustomOptionNameHere")))
end)
neon bronze
#

Anyone knows how to get clients x,y coords?

weak sierra
#

I think I found a way to do it, does anyone know how to create a new option inside
getServerOptions() ?

#

that is the ini file settings isn't it?

#

you'd wanna read the code in the decompile, but i would assume it's hardcoded - if not then perhaps try just adding settings to the ini file and see if it parses them shrugGirl

#

i dont think ur gonna be able to programmatically do that from within a mod tho

gilded hawk
astral dune
gilded hawk
#

But it's quite reliable

#

I'm looking if I can put the entire txt into a server option

astral dune
#

hmm, ya that makes sense. Zomboid events aren't like Minecraft events, you have no control over them or their flow

gilded hawk
#

Yeah

astral dune
#

I assume sandbox options have to be synced, and we know they can be changed while the server is running, I wonder how big a string you can cram in one

gilded hawk
calm light
#

Is it possible to edit jog/sprint speed on items for mods? i.e making certain sneakers run faster, and if so is there a cap on what works and what doesn't? Thirdly, are there any mods presently available which already enhance these things? Thanks. just curious about it 🙂

weak sierra
#

you can yes

#

there's a run speed modifier stat

#

unaware of any cap and unaware of mods that mess with that as a goal but many mods have items or modifications to existing items as part of what they do

#

not sure if they modify that specificallyu

bronze yoke
#

wasn't the run speed modifier on clothing disabled?

calm light
#

hmmm i dont know personally, it seems interesting to figure it out and mess with it some thats why i am curious if something like that exists or is an option to work with

livid geode
#

Hello, I need a little help here..
How do I :AddItem("..") with two different getModDatas in it?
For example I'd like to spawn a paper that has getModData().isInfected = player:getBodyDamage():isInfected(); and getModData().isInfectionRate = FIL_InfectionRate(player);

#

this is the current code but I assume it'll spawn in two syringes with two separate ModData()s

bronze yoke
#

that looks fine to me

livid geode
#

But won't it give me two syringes? I need one with both modDatas on it..

bronze yoke
#

why would it? you're only calling additem once

livid geode
#

Hmm-- that confuses me now. Does it call it from local FIL_bloodsample = player:getInventory():AddItem("LabItems.CmpSyringeWithBlood"); and spawn in one
or from two separate FIL_bloodsample below?

bronze yoke
#

the line ```lua
local FIL_bloodsample = player:getInventory():AddItem("LabItems.CmpSyringWithBlood");

livid geode
#

That makes sense-- THANKS A LOT! ❤️

gilded hawk
#

Does anyone know why I can't access this sandbox option? I keep getting nil

print('TransmogV2.TransmoggedItemsList'..tostring(getServerOptions():getOption("TransmogV2.TransmoggedItemsList")))
VERSION = 1,

option TransmogV2.TransmoggedItemsList
{
    type = string, min = 1, max = 10000, default = NoValue,
    page = TransmogV2, translation = TransmoggedItemsList,
}

It does appear in the sandbox options tho 🤔

bronze yoke
#

when are you printing it? and why are you setting a min/max for a string?

#

no idea if the latter could actually cause problems it just seems weird

gilded hawk
bronze yoke
#

if i remember what you were talking about earlier, you're trying to use this when the client first connects right? sandbox options probably aren't initialised yet

astral dune
#

are you printing it from the client?

astral dune
gilded hawk
# bronze yoke if i remember what you were talking about earlier, you're trying to use this whe...
LOG  : General     , 1664899992109> 184,397,648> LOGGED INTO : 961 millisecond
LOG  : General     , 1664899992110> 184,397,649> ConnectToServerState: Start
LOG  : General     , 1664899992126> 184,397,665> ConnectToServerState: TestTCP
LOG  : General     , 1664899992160> 184,397,699> MxEvents.OnConnectionStateChanged
LOG  : General     , 1664899992160> 184,397,699> stateConnected
LOG  : General     , 1664899992161> 184,397,699> messagenil
LOG  : General     , 1664899992161> 184,397,700> getServerOptions():getOption("SpawnItems")
LOG  : General     , 1664899992161> 184,397,700> MxSandboxVarstable 0x1575629001
LOG  : General     , 1664899992162> 184,397,701> MxSandboxVarsNoValue

Maybe maybe it works 👀

#
    print('-------END TransmogV2 Done--------')


    print('MxSandboxVars'..tostring(SandboxVars))
    -- tostring(getServerOptions():getOption("DoLuaChecksum")) == "true"
    print('TransmogV2.TransmoggedItemsList'..tostring(getServerOptions():getOption("TransmogV2.TransmoggedItemsList")))
    -- getServerOptions():getOptionByName("TransmogV2.TransmoggedItemsList"):setValue(workshopIDsString)
end

Events.OnGameBoot.Add(generateTransmog);

Events.OnConnectionStateChanged.Add(function(state, message)
    print('MxEvents.OnConnectionStateChanged')
    print("state" .. tostring(state))
    print("message" .. tostring(message))

    print('getServerOptions():getOption("SpawnItems")'..tostring(getServerOptions():getOption("SpawnItems")))

    print('MxSandboxVars'..tostring(SandboxVars))
    print('MxSandboxVars'..tostring(SandboxVars.TransmogV2.TransmoggedItemsList))
    -- tostring(getServerOptions():getOption("DoLuaChecksum")) == "true"
    print('TransmogV2.TransmoggedItemsList'..tostring(getServerOptions():getOption("TransmogV2.TransmoggedItemsList")))
    
bronze yoke
#

hell yeah

gilded hawk
#

Too bad that I have to leave right now

#

FUUUUUUUUUUUUUUUUCK

#

crowbar_broken 💔

#

I'll try to get this shit up when im back

livid geode
#

or smt else?

astral dune
#

the data isn't saved, so server reboot or save game load or whatever

livid geode
#

Thanks for sharing that with me

astral dune
#

I believe the current workaround most people use is to save the moddata in the globalmoddata, but I haven't tried it myself yet so I don't know the particulars.

gilded hawk
calm light
#

maybe a silly question but is there someone/some place to look for custom mods to be made ?

gilded hawk
#

You can ask here maybe you will find someone

ruby urchin
calm light
#

well would anyone be interesting in seeing if you can give clothes certain boosts like a bonus runspeed?

gilded hawk
#

It's already possible

calm light
#

how ?

gilded hawk
#

Check the script item or the. Sneakers

#

The sneakers give a speed buff

calm light
#

and can you increase that speed buff ? (sorry in case i am asking silly questions, very new to it )

astral dune
bronze yoke
#

it was my understanding that the clothing speed modifiers (or at least the ones for shoes) had been disabled at some point in build 41's development

astral dune
#

I think the Sneaker speed buff is disabled.

gilded hawk
#

Bruh 😦 I have been using sneakers in my char for no reason 😦

bronze yoke
#

yeah i got placebo'd so hard by it

astral dune
#

same, lol

gilded hawk
#

Uncle dane life is pain

#

So, the game just updated, and changed the body location and the Alice pack

#

Goddammit the timing engineer_agony engineer_agony engineer_agony

ancient grail
sour island
#

You can't save object references though - which may have been what you tried(?)

#

Only numbers, strings, booleans, and tables

astral dune
#

Like I said, haven't tried it myself, just been told as much by several other modders

#

the only thing I've tried is attaching mod data to a vehicle, which doesn't save either.

sour island
#

Just trying to give a heads up

bronze yoke
#

mod data on a vehicle certainly does save

sour island
#

All objects have a mod data list - and they should all work/save

bronze yoke
#

as chuck says, object references can't be saved, it's just not possible

sour island
#

It's probably one of the strongest tools modders have to use

astral dune
#

I can save moddata on a vehicle by adding it to a part, but to the vehicle itself didn't appear to work 🤷‍♂️

sour island
#

I'd be curious to check that out

astral dune
#

I was told it wasn't possible so I didn't look any deeper, but its possible I attempted it before getting into client commands

sour island
#

Ah

bronze yoke
#

i have a mod that partially relies on a boolean moddata being set on vehicles and it passed all my testing

sour island
#

Transmitting mod data requires a function

#

Players can't transmit their modData

#

Everything else works in transmit

random finch
#

Hey Chuck, do you know the max value for maxdistance is for sounds?

sour island
#

There isn't one

random finch
#

I have been testing and there seems to be one

sour island
#

Sounds can be scripted like items can

random finch
#

can only get sounds upto 3 cells away

astral dune
#

I'm unclear on what the transmit functions actually do. The ones on vehicle parts are only for server->client, but are also seemingly unreliable

random finch
#

right

sour island
#

You can set the max distance and other features there

random finch
shadow geyser
#

I believe the issue with the vehicles is that they dont have a moddata, since moddata belongs to isoObjects, gametime, and isoplayers, whereas vehicles are have their own object that doesn't inherit from those

random finch
#

I was looking at your code to see how you did it but I cant hear them beyond 3 cells

sour island
astral dune
#

transmitting in which direction?

sour island
#

I think I set the max to also taper

random finch
#

yup with is3d

weak sierra
random finch
#

I turned it off for testing

sour island
bronze yoke
velvet girder
#

how do you change the item type...i have a shop mod that doesnt yet support literature items and i have another mod thats literature.....i need it to be an item

sour island
#

Sneaker speed I think still makes players faster but does nothing for Zombies

#

I tried making faster zombies

bronze yoke
#

my information could be out of date, but i mostly follow the patch notes and i never saw them change it

random finch
#

Ive been testing like so...
2 clients across the map moving them in closer to eachother

astral dune
sour island
#

The function is for all objects, but isoPlayers' seems broken

#

There isn't a defined "not allow"

#

Just seems to not work

#

I would assume it has to do with player references in MP

#

🤷‍♂️

astral dune
#

so if you want to transmit back from the client, you have to set up a client command to do it?

sour island
#

You would have to call it on the server code

astral dune
#

the only way I'm aware to do that based on something happening on the client is a client command

sour island
#

/server/ files run serverside

#

client on client

#

Shared is well... Confusing

astral dune
#

I'm also told the folders are fake and don't actually work as you'd expect. I've found weird things, like code that can only be put in the server folder or it won't run, but if you check where its running at runtime it only runs on the client

sour island
#

Those folders are not fake

#

Who are these modders lol

#

It's confusing but they certainly do function

bronze yoke
#

i don't know anything about code only working in certain folders, but server definitely runs on the client too

sour island
#

It runs on client if in SP

#

In MP it's not supposed to be callable but the raw Lua still runs

#

I think

bronze yoke
#

when i've put a print before an isClient() on a dedicated server it shows up in my console

ancient grail
astral dune
#

I'll have to go back and look, but there was a function or event I could not access from the client, so I had to put it in the server folder. When I actually ran the code, I used isClient() and isServer() to try and check where its running, and only came back as the client

sour island
#

Is client isn't singleplayer

#

The server also gets it's own "client"

sour island
#

But clients shouldn't get their own "server"

random finch
#

Ive been trying to find a better way to debug sound

bronze yoke
#

hmm... i haven't observed that at all

sour island
#

The host is a client and the server

#

At least from what I saw when hosting from main menu

bronze yoke
#

my testing was on a dedicated server

#

i made a chart for this the other day, hold on

#

these were my findings

sour island
#

I would assume the dedicated machine would take the place of a host connection too

astral dune
#

I definitely never get isClient() and isServer() as true at the same time

#

and I host from the main menu from most of my testing

bronze yoke
#

hmm... i'll give it another test

sour island
#

You could get it as true if the file is in shared I think

ancient grail
# random finch Ive been trying to find a better way to debug sound

then about the 3d im also interested to find out about this..i tried to do this on a mp server asking them if the sound moved from left to right (didnt work for me but theres a chance that the player i asked isnt weaking stereo headset or room speakers isnt set to actualy have left and right sound) or the distance made a difference on the volume(nope didnt work too)

astral dune
#

I assume shared code should still only be one or the other depending on where it was called from

sour island
#

By default I think shared code gets called as the hosts client

#

You'd have to use commands to flip it to server

#

I used to use shared exclusively cause I didn't know better

random finch
sour island
#

To be honest, shared should only be used lightly

astral dune
#

I use it when its code I need on both sides

ancient grail
bronze yoke
#

yeah i try to use server and client as much as i can

random finch
#

I could send a sound to everyone but i want it directional

sour island
#

I could test stuff when I get home

#

I think my air raid sirens have a range of 5000

random finch
sour island
#

But I draw a box around all players and use +/- 200 tiles for events

random finch
#

ahhh

sour island
#

The air raid also doesn't move or shouldnt

astral dune
#

@weak sierra when you tested saving ModData to InventoryItems, was it server-side?

random finch
#

There seems to be a set range threshold where the sound wont travel anymore. Whats weird is when i move in that threshold I can heard the sound 15 seconds later as if it was just fired.

astral dune
#

doppler effect

random finch
#

but that threshold is the same no matter the value

#

beyond 3 cells it seems

sour island
#

Try turning off reverb and 3D?

random finch
#

Yup, done that.

sour island
#

There's also a minimum distance

random finch
#

true, I havent set that at all

#

Ill have a whack at it

sour island
#

FMOD is kind of a nest

#

Could be a defined max in the java

#

If you can figure out a max range you could make the audio specific to each person

random finch
#

What im currently trying to track down now - looking through the java

sour island
#

Lowering the volume and setting a similar angled position

random finch
#

interesting

bronze yoke
astral dune
#

said /server/ code is still isClient==true and isServer==false when it runs, right?

bronze yoke
#

yeah

sour island
bronze yoke
#

(isClient() and isServer()) never returns true, unlike what my chart showed

astral dune
#

something definitely isn't adding up

sour island
#

is server returns false in /server/ and while hosting?

#

Doesn't isServer/isClient refer to the connection?

ancient grail
# random finch I could send a sound to everyone but i want it directional

ahhh take at look at the script from "here they come" by SpoutNick
u might want to use it as reference as to how he was able to spawn the horde from a certain direction

https://github.com/spoutnickgp/zomboid-mod-here-they-come

but i dont think the sound from is 3d tho
but atleast you might get something ideas

GitHub

Contribute to spoutnickgp/zomboid-mod-here-they-come development by creating an account on GitHub.

#

hope that helps

bronze yoke
#

so yes, probably

sour island
#

Interesting

#

So it is running two things

bronze yoke
#

yeah definitely

sour island
#

What isn't what you expected?

#

Dedicated returns similar outcomes right?

#

Or is dedicated only isServer true

bronze yoke
#

i expected that a hosted server would return (isClient() and isServer()) == true on the server side

#

i thought i had tested that, but i must've misremembered

sour island
#

Yeah, it's weird to think about but it's definitely two instances or objects

bronze yoke
#

perhaps my test was actually isClient() and isServer() separately, which would seem the same but it isn't

sour island
#

Shared should also be isClient true by default if I recall

bronze yoke
#

i'll move the test into all three folders

astral dune
sour island
#

modData will persist

#

Modified data will not

#

I.e.: changing certain values

#

The save code only looks for things that would normally change from vanilla

#

But modData should always save

#

Perhaps the conversation was about changing variables?

#

I get around the variable changes issue using modData

#

Reapplying variables based on matching modData values

#

So modData definitely works

#

If you can link the convo I can read through it

ancient grail
#

sendClientCommand(player, "mydata", "mydata", someData)
can i put this on the shared folder?
cuz if icant then id have to send to client then send back to server i thjink

sour island
#

Uh

#

You can but

astral dune
#

this may be the crux of it, given what you said about transmit earlier

bronze yoke
sour island
#

Odd

sour island
#

That might be the issue

#

Attachments are their own objects, that are created on load

#

Perhaps they're saving the modData on the attachment object and not the actual item

#

I'd have to look

astral dune
#

their example was based on that backpack attachment mod ya, but I don't think that was the only place

bronze yoke
#

i have heard about vehicle moddata not working from a lot of places, so while it hasn't been my personal experience there must be a source of that confusion

astral dune
#

this is the code that proved to me that saving modData() to vehicles doesn't work, again may be related to Chuck saying that transmit is borked from the client side

local data = vehicle:getModData();
    if data.touched == nil then
        character:Say("New Vehicle", 0.0, 1.0, 1.0, UIFont.Small, 60.0, "radio")
        data.touched = 1;
        vehicle:transmitModData();
    else
        character:Say("Old Vehicle", 0.0, 1.0, 1.0, UIFont.Small, 60.0, "radio")
    end
bronze yoke
#

i'd imagine it wouldn't save on the client side actually, aren't vehicles received from the server completely? the client probably doesn't even save them

astral dune
#

which is why I used transmitModData() with the impression that it would get to the server to be saved

bronze yoke
#

yeah, maybe that function doesn't work properly with vehicles or something

astral dune
#

I'm told vehicles don't actually inherit from isoObject, so the modData acts differently, but given this conversation I don't have any idea what's true anymore, and I can't check from here, haha

bronze yoke
#

LOL i feel the same way

#

i went from a brief moment of confidence to once again having no idea how the client-server separation works in this game

astral dune
#

From rooting around in the Java I've found that a lot of times things you think you can set get blasted out and replaced by magic numbers somewhere in a method you didn't even expect to get called

#

for example, did you know there is a hard and fast limit on how much friction a tire can have?

#

Its not in the poorly placed InventoryItem.setWheelFriction method, but in a updatePartStats function called seemingly randomly

#

also, every single InventoryItem having wheel friction and suspension compression etc, is just hilarious.

bronze yoke
#

vehicles in particular have some insane properties

#

there's a static called YURI_FORCE_FIELD, what on earth does that do

astral dune
#

lol ya I get a chuckle every time I come across it

#

Actually thinking about wheel friction, the game calculates an overall wheelfriction rating for the vehicle based on the stats of all your tires, it doesn't actually use different wheel frictions in the physics afaik

#

it determines what is a tire or not by whether or not the part has a wheelfriction >0 which means two things

  1. You could give your windshield a wheel friction rating and it would effect how your vehicle runs
  2. Modded vehicles that have spots for spare tires also effect the vehicle if you put a tire in there of a different quality than the ones actually on the ground. If its a bad tire you're better off putting it in the trunk
bronze yoke
#

oh my god lol

green spear
ruby urchin
# green spear Thats great, Can i see your work?

Honestly, there is not much to show, most of the stuff is recycle of ESX adapted to PZ, how HTML doesn't exist here, a lot of things are more tedious to do, also I will use the default db (SQLite) to save things

#

Although most of the things are already implemented by the game itself, just have to make a couple of adjustments.

astral dune
#

🤔 is it possible to set up a dedicated server and client on the same computer, and be certain they're not looking in the same scripts folders?

bronze yoke
#

it is

#

have the server use a different -cachedir (or whatever the argument is)

hearty dew
#

So in testing the isClient() and isServer() confusion from the earlier conversation, I'm seeing the following:

In SP, pz is running as a single process. Both isClient() and isServer() are false. No surprises there.

When coop hosting MP,

  • pz runs two separate lua environments -- Actually, it forks a separate process running java.exe to run zombie.network.GameServer, so in fact a separate process space.
    -In the client process, isClient() is true and isServer() is false.
    -In the server process, isClient() is false and isServer() is true.
    -The lua environment on the client loads shared/ then client/ then server/.
    -The lua env on the server loads shared/ then server/ (it skips lua files in client/).
    -Each environment has its own _G as you might expect.
    -The list of events that are registered are equivalent on server-side and client-side. However, the Events table and its values are separate.
    --Interestingly, Events.OnTick is raised roughly every frame on the client, and it is raised 10 times per second on the server.

  • Dedicated server MP seems to function nearly identically to coop hosted MP, except of course the java process that runs zombie.network.GameServer is started manually, instead of forked from ProjectZomboid.exe.

shouldRunServerCode = function()
    --                             | isClient() | isServer() |
    -- Singleplayer                | false      | false      |
    -- Multiplayer Client          | true       | false      |
    -- Co-op Host (client process) | true       | false      |
    -- Co-op Host (server process) | false      | true       |
    -- Dedicated Server            | false      | true       |
    --
    -- This is a single player game or is a coop host server process or is a dedicated server
    return not isClient()
end

shouldRunClientCode = function()
    -- This is a single player game or is a coop host client process or is a client connected to a remote server
    return not isServer()
end
sour island
#

good work 😮

bronze yoke
#

thanks a lot for that!

astral dune
#

if the list of the events is the same, why is the content of the Events table different?

astral dune
hearty dew
# astral dune if the list of the events is the same, why is the content of the Events table di...

Events is a global table (it is in _G). In each process, it is simply initialized with the same events (both have onKeyPress, etc, even though it is only useful on the client-side). In other words, the event names are the same in each Events, even though the events are raised separately (the server raises its events in its process space and the client raises its events in its process space)

#

@astral dune it is a link to this. Sometimes discord is wonky with url links

astral dune
#

hmm, I'm certain that I've tried to add to an event and gotten errors that it doesn't exist in that context

sour island
#

I was trying to link the pinned comment

#

sorry lol

astral dune
#

that reply also doesn't take me to the comment, its several pages up from where discord goes when I click it, lol, but yes I can see the pin

hearty dew
sour island
#

could be an anticheat measure

astral dune
#

thanks for that post Chuck 🙂 I'm gonna go chaotic evil and see what level of desync the server/client will tolerate or allow

grim rose
#

I have quick idea for mod

#

I will propably share today here

hearty dew
astral dune
#

From what I understand, if you have scripts on your client that aren't on the server, it kicks you when you try to connect. But what about after that? Can you load a script clientside without the server getting upset? Could you turn a van on the client into a sports car while the server still thinks its a van? that sort of stuff

#

I'm just worried I'll get fake results because both the client and server are actually looking in the same folder. Looks like what was posted is the fix for that though

bronze yoke
#

i mean that would be the most simple way of hacking right? surely you can't

#

*maybe* scripts wouldn't be vetted as much as lua... but i'm still sceptical

astral dune
#

You can't get it to load a script after launch just by putting files in the folder, it would have to be loaded by a mod of some kind, which are verified at launch

#

its potentially possible

ruby urchin
bronze yoke
#

it's worth a try i guess but i'm sure anti-cheat would pick it up

#

of course, at the moment a lot of people play with anti-cheat off anyway...

astral dune
#

yes, anticheat would likely be a problem, which is why I completely disable it

green spear
ruby urchin
crimson girder
#

Does anyone know how can I fetch a list of the magazines/VHS my character has learned from?

mystic meteor
hearty dew
#

I don't have it open atm, but when I was looking into calling Methods via reflection yesterday, I noticed that Method is only exposed when -debug is set

mystic meteor
#

hm...

hearty dew
#

Implying even if it is invokable when -debug is set, it may not be in a normal game (I didn't verify this, just a hunch)

mystic meteor
#

all I really need to be able to do is convert a lua string to a Java string, and then hashcode is exposed

hearty dew
#

I'll try real quick

mystic meteor
#

but I don't have the slightest idea how I'd do that

#

MoriThumbsUpHat appreciate it

hearty dew
#

Looks like kahlua converts java.lang.String into native lua strings

#

hrm, maybe it converts native strings back to java.lang.String in a way that the reflection functions work well though

mystic meteor
#

can you maybe invoke java.lang.String.hashcode(str)?

#

actually, it doesn't look like the native function would work with that

#

would need to be java.lang.String(str):hashcode()

#

but I have no idea how you call java like that from the lua

hearty dew
#

yea, it works

#

Sorry, got busy with other things distracting me

#
x = 'hi'
print(getClassFunction(x,4):invoke(x))```