#mod_development

1 messages ยท Page 212 of 1

fleet bridge
#

does OnGameStart trigger the second someone presses Click to Start?

frank elbow
#

Started one before, never finished cleaning it up bc lost interest (it was working, but not in a state that I felt comfortable sharing it bc it was just for my own purposes initially) but I'm happy to share the code when I'm back at my home computer in a few hours

sturdy salmon
#

Good afternoon, is there a way to convert the IP field of the server zone, from domain to IP number? I tried to do it with the socket in Lua, but apparently it is not native and does not allow it to be used, and I don't know how to add it. The fact is that if you use the domain instead of the numerical IP, it tells you that the server is not responding, although the connection is made anyway, but for some people, that can be confusing. https://web.tecgraf.puc-rio.br/luasocket/old/luasocket-2.0-beta/dns.html#toip

#
socket.dns.toip(address)
  Converts from host name to IP address.
  Address can be an IP address or host name.
  Returns a string with the first IP address found for address, followed by a table with all information returned by the resolver. In case of error, the function returns nil followed by an error message.
bright fog
#

Is it possible this could cause some issues when adding a mod midgame ?

if not player:hasModData() then
  player:setModData({})
end
fleet bridge
#

isnt setmoddata for thumpable objects?

sour island
#

That isn't something you need to do to set modData.

bright fog
#

How so ?

#

This is the entire line of code and yeah I think that line is useless but is it possible it can cause some issues ?

local function initialise()
    if not initialised then
        player = getPlayer();
    if not player:hasModData() then
      player:setModData({})
    end
        pillowmod = player:getModData();
        calculateChanceModifier();
        initialised = true;
    end
end
torn igloo
#

when you do getModData, you are getting all the data associated with that object. this include moddata added by other mods.
you also do not have to initialize moddata in that object
setModData is also not used for that kind of object
https://projectzomboid.com/modding/index.html

#

if you want to get your own data
getModData().<whatevername>

iron siren
bright fog
#

Alright

#

I took this line from another mod I think, when I was testing it but I was pretty sure the line was useless anyway and didn't fix shit

#

However it caused issues when creating a world or a server it seems like

#

So I removed it and no errors anymore

mellow frigate
iron siren
bright fog
#

alright

#

Hey I've been having trouble actually finding what functions do. I found what type of variable they output but I didn't find any documentation with all the functions uses. For example I have getAge() and there's that mod I modify that checks if the age of zombies is -1 and sets it to -2 but I have no idea what those two values correspond to

#
if zombie:getAge() == -1 then
  zombie:setAge(-2)
#

Is there any documentation for that ?

crisp dew
#

Hey @fiery pecan , recursive require(): .../StandardizedVehicleUpgradesV/media/lua/server/IceCreamTruckRefrigerator.lua, just a heads up you have an unneccessary require 'IceCreamTruckRefrigerator' in that file. Was doing some debugging on my server and noticed this in the server log. Dunno if it's actually causing issues, but thought I'd let you know.

crisp dew
#

line 1

#

very top of the file.

fiery pecan
#

hmmm

#

is it present anywhere else in the file?

crisp dew
#

Nope, just that top line, but it's in IceCreamTruckRefrigerator.lua, so it's just trying to load itself.

fiery pecan
#

I mean

#

I added the require line to ensure the file loads after the original one, in Skizot's mod

#

because his file's broken

crisp dew
#

oh, that's weird

fiery pecan
#

yeah

crisp dew
#

I guess if you don't have that mod installed, the game just thinks you're trying to load the same file as itself.

iron siren
#

How would lua even work that out? If there are two files called "IceCreamTruckRefrigerator.lua" which would it know you want to require first? To avoid this sort of question and cover over my ignorance of the subtleties of lua I prefix all source with my unique name "RicksMLC_"

fiery pecan
#

good idea

iron siren
#

Perhaps naming it something like SVUV_IceCreamTruckRefrigerator.lua as it is unlikely anyone else is called SVUV?

fiery pecan
#

will do

sour island
#

The file manager in PZ will overwrite files sharing the same name

#

If you don't want to have obscenely long and unique filenames you could house everything in a folder named something unique

bright fog
sour island
#

Same principle as using local modules rather than dumping everything into global

fiery pecan
#

funky

void ember
#

if im trying to set something in the multiplayer sandbox settings would i use setMultiplayerSandboxVars() ?

dawn palm
#

is there an event that runs when the player carries a corpse?

#

something like OnCarryCorpse

nova socket
#

I'm desperate, anyone knows how to spawn any vehicle from server-side into specific square?

bright fog
#

With a function you want to do that ?

dawn palm
bright fog
#

things ?

#

what things ?

dawn palm
#

anything like vehicles

#

or a model

#

or a person or zombie

frosty perch
#

Hello, besides these two things, is there any function I can call through mod to kick a player with reason?

getCore():quitToDesktop()
getCore():quit()
bright fog
#

Wait what

#

How are those functions even allowed for modding lol

bright fog
#

noice

dawn palm
#

is there an event that runs when the player carries a corpse?
something like OnCarryCorpse

dawn palm
#

When an item is added in the player's inventory?

#

such as corpse

bright fog
#

No idea

dawn palm
#

Hm ima test it out, but do I gotta reload my game every time I update the code?

sour island
#

You can also use the onequip related events to check if it's a corpse

#

I think the hotbar files do that

#

I recall seeing corpse/generator stuff when I made swapit

crisp dew
#

hmm, well that's fun, with StandardizedVehicleUpgrades enabled, my server immediately hits 100% CPU usage (primary game thread only) and stops responding to any net code.

#

(preliminary results, still have more work to do to confirm / identify what's going on)

nova socket
potent mulch
#

I really don't know where else to go with this radio and TV mod I want to make.

#

I think I can scrap this bit of code to loop TV channels

#

But I'm not sure.

#

I'll just have to try to keep getting in touch with mod authors on steam

frank elbow
formal oasis
#

Got a coding problem, wondering if anyone can help. I'm currently trying to gather data on how long a player has been in a server and be able to use it for rewards; I.e play ten hours get something.

I tried using modData assigned to the player character, but ran into the issue of it wiping every time the player dies, is there a way to store modData to something more permanent, or is the wiping of the data a fault of mine.

bright fog
#

Idk. If you use getPlayer() to recognize the person, maybe it only corresponds to one character ?

crisp dew
#

getPlayer probably refers to the player itself, which yes, will be the specific character which goes away upon death. I'd look for the Steam account or something.

formal oasis
#

getSteamID is an idea, thanks

sour island
#

You could use days survived as well - but that's per player object too

dawn palm
#

It's my first time modding btw

sour island
#

That is where you find the loaded lua files. If you don't see yours listed there it's not loaded in.

junior mason
#

What's the difference between the BoredomLevel in BodyDamage and the Boredom in Stats? Trying to let the player gain boredom while in a vehicle.

sour island
#

I think one of them isn't actually used anymore

dawn palm
sour island
#

most stats are held in bodyDamage

dawn palm
sour island
dawn palm
crisp dew
#

For the tiledef unique ID, is the pzwiki the only source of those IDs? (and thus the only location needed to be updated to "reserve" your ID)

sour island
dawn palm
#

oh it's in the install folder

crisp dew
#

The sprites may be absolute rubbish, (I'm a developer, not a designer), but it works how I want it to ๐Ÿ™‚ finally

iron siren
hollow current
bronze yoke
iron siren
fringe heart
#

Hi. Do you know if it's possible to get the coordinates of the cell you're aiming at?

lucid sphinx
#

5124 bv14

hardy rose
#

is there a way to tell if the player is standing in sunlight? My current idea is to reuse the code for Agoraphobia's detection, but I'm just starting out so I'm hoping there's a better way

bright fog
frank elbow
#

Weather and time of year are also relevant considerations

cedar kraken
frank elbow
#

I'd peek into GameTime & relevant code (like ClimateManager) maybe, might be something related to light level there

cedar kraken
#

A way to determine sunlight intensity (would be based off of time of day and weather) and the amount of time between dawn and dusk

#

I feel like those are the major components needed to (generally) measure sunlight exposure

frank elbow
#

ClimateManager has getGlobalLightIntensity, which may be of use. It's used in the sunlight calculation (alongside other things, such as time of day & season)

bright fog
#

Tho I think it doesn't check light intensity, just if it's day time or night time

hardy rose
#

Huh, another question;
How would I check if the player is in light of a specific color?

#

from a colored light bulb?

gleaming sequoia
#

my mod consists of the following code only

if scriptItem then 
    scriptItem:DoParam("BloodLocation = Jacket")
end```
and its directory is Zomboid\Workshop\PoloNeckSweaterNeckProtectionFix\Contents\mods\Polo Neck Sweater Neck Protection Fix\media\lua\shared\Main.lua

Just tried to add the neck coverage Diamond-pattern Sweater has to the Polo Neck sweater. But it does not work. Can someone show me my mistake?
nova socket
#

Okay so solution to my crucial question was rather simple, server still can use addVehicleDebug() without client

-- Server
        local test = addVehicleDebug("Base.Taxi", IsoDirections.E, nil, player:getSquare());
        print(test);

Anwer was
LOG : General , 1704570633113> 85ะฐ384ะฐ875> zombie.vehicles.BaseVehicle@654b899f

near hull
#

Has anyone worked on making Tetris mod compatibility with backpacks/containers/trunks? I want to try to make a mod like this, but in my tests for trunks I only fail. I would appreciate if someone could give me a little help.

bright fog
#

wdym compatibilities ?

#

It's already compatible with mods

near hull
#

Not with certain vehicles as I have been testing, reading comments I have also noticed that it does not work for certain people

#

This mod gives you a width of 10 cells for several below, but there are vehicles in which it does not happen (it happened to me with '78 AM General M35A2 from KI5, for example)

bright fog
#

ah idk

outer crypt
#

Does anyone know what could cause anticheat 21 to get set off? I know some mods by their very existance set off some of the anticheat checks but I have no idea why my mod is creating a malformed packet and how to stop it. Logs reveal nothing useful on either client or server.

fleet bridge
#

it can be due to desync

#

it does a checksum of recipes iirc

nova socket
outer crypt
#

yep, after talking with a couple people it seems like those anti-cheats are all so random, just tell server admins to remove the ones that fail. shrug

drifting ore
#

your code isn't passing the checksum at ValidatePacket, that's the reason zombie

#

plus if you don't respond the checksum in time Type 22 is raised and the player's kicked

outer crypt
#

but if I have no recipes in the mod?

drifting ore
#

what does your mod do?

#

do a research on each type and you'll see why your mod is malforming packets ;p

#

type 21 refers to that checksum i told you, type 22 refers to a timed-out check for the player

outer crypt
#

Maybe it's not my mod then, maybe its one of the prerequisites... unfortunately, I have zero control over them and the error code does not explain what recipe is causing it

crisp dew
#

I just disabled every one of those checks; they weren't very descriptive as to what they did, (seeing as they're just numbered 1-22), and we have a small community anyway.

outer crypt
#

It's the True Music Radio mod, it pulls the current True Music global list and plays it on radios, not recipes in my mod but it uses everything that True Music needs plus music mods.

#

still looks like disable is the only way to go

drifting ore
#

it's not a good recommendation to disable the ac types, but it's true that mods (not written in line with the code base) can lead to false positives, and "developers" are not interested in fixing those, most* of the mods are copy pasta so... finally the decision to toggle off certain types is up to each individual; those who understand, probably wouldn't do it, excepting some types that are unused, i.e Type 11

crisp dew
#

And when the game operator (not the network/server admin), installs every shiny mod they run across, many times the server op doesn't have the freedom to audit every mod and only select those which meet a certain quality standard.

dreamy zenith
#

how hard is it to make a map within project zomboid?

outer crypt
# dreamy zenith how hard is it to make a map within project zomboid?

In this short video I will quickly show where you can find the project zomboid mapping tools, both on steam and on the indiestone forums.

For a link to the forums please click here:
https://theindiestone.com/forums/index.php?/forum/64-mapping/

And if you want to support me here is a link to my patreon:
https://www.patreon.com/DaddyDirkieDirk

โ–ถ Play video
outer crypt
outer crypt
fleet bridge
#

is it possible to override fixing recipes?

bright fog
#

Oh hi mark

nova socket
#
function: createMenu -- file: MutiesContextMenuIconsUnequip.lua line # 3 | MOD: Mutie's Context Menu icons
function: onRightMouseUp -- file: ISInventoryPane.lua line # 1444 | Vanilla.
[07-01-24 07:32:14.385] ERROR: General     , 1704605534385> 10ย 630ย 223ย 602> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getOptionFromName of non-table: null at KahluaThread.tableget line:1689.. 

@agile vigil happens when you click nothing in inventory. Check if table exists there before getOptionFromName

crisp dew
#

hmmm, my setOverlaySprite is buggy when in server mode; it'll flash the correct sprite on the client for a second, then revert back to the default sprite. I'm clearly missing something silly.

fast galleon
crisp dew
#

Happen to know a trick to make it persistent?

fast galleon
#

maybe send command to server?

#

I don't remember if this functional, but there are also attached sprites you might be able to use.

nova socket
fast galleon
agile vigil
#

Coincidentally this made me also find the bug other people were reporting.

kind root
#

i have no idea what i'm looking at

#

sorry

drifting ore
#

it was a clunky source code snap

gleaming sequoia
mellow frigate
abstract pine
gleaming sequoia
abstract pine
#

NeckProtectionModifier is a different property that is a bonus to how likely it is to provide neck protection, but the Java suggests it doesn't do anything without the Neck BloodLocation being set on the item (or a blood location that is supposed to provide the neck location, like Jacket). So you need both for it to work.

gleaming sequoia
#

So NeckProtectionModifier = 0.5 gave half of the protection of the coverage areas of Jacket but writing BloodLocation = Jacket itself does not cover neck. That is strange

cedar kraken
#

You need the neck part in BloodLocation for it to function, I believe

gleaming sequoia
#

I was trying to find where exactly is the default bloodlocations were defined like Jacket = torso,stomach,upper arms etc. but I could not find it

cedar kraken
#

The wiki has info on that

abstract pine
# gleaming sequoia I was trying to find where exactly is the default bloodlocations were defined li...

They are defined in the Java code, in zombie/characterTextures/BloodClothingType.class (needs decompiled to read it). These are all the values according to that file:
Jacket, LongJacket, Trousers, ShortsShort, Shirt, ShirtLongSleeves, ShirtNoSleeves, Jumper, JumperNoSleeves, Shoes, FullHelmet, Apron, Bag, Hands, Head, Neck, UpperBody, LowerBody, LowerLegs, UpperLegs, LowerArms, UpperArms, Groin

gleaming sequoia
#

like if I were to BloodLocation = Jacket, UpperArms, Shirt would they get some extra coverage from that

gleaming sequoia
abstract pine
gleaming sequoia
#

I see thats useful

abstract pine
# gleaming sequoia and I believe there's no way to add more BloodLocations since this file is alrea...

Not easily no, but I believe it'd probably be possible to decompile it, add a new blood location, and recompile to make a Java mod. I say "probably" since adding new things is sometimes difficult with Java modding since there's no adding new class files for security reasons (they won't be loaded by the game), so if any changes you make would add a new file (even if not a new class necessarily, just using an anonymous method can add a new file that appends to the one you recompiled for example), sometimes it can be tricky or impossible.

#

But I'd recommend against doing that, just since I'd think you could get almost any combination you want by using different combinations of the existing blood locations.

gleaming sequoia
#

yes the latter seems the easier option

#

thanks for all the help

abstract pine
#

Np, good luck with what you're doing ๐Ÿ‘

gleaming sequoia
bright fog
#

Is there any documentation about ISPanel please ?

#

I haven't found anything on the subject

#

I'm trying to understand exactly how the game acts on ISPanel, I have these

SusceptibleUi = ISPanel:derive("SusceptibleUi");
function SusceptibleUi:render()
  --does stuff
end

The game runs SusceptibleUi:render automatically when it needs to render any UI ?

hardy rose
#

where are the scripts governing how infection works?

#

if I were to make a mod affecting infection, would it be easier to mod the existing infection mechanics or remove vanilla infection and introduce something new with the Moodle framework or something?

bright fog
#

Is there even a small bit of documentation out there ?

mellow frigate
hardy rose
#

does print('x') in a lua script just output to the console?

bright fog
#

The thing I sent above

#

Like I'm actually completely stuck here

cedar kraken
#

I think

#

I donโ€™t see why not

bronze yoke
#

it does

bright fog
#
function UiUtil.drawOutlinedBar(uiElement, x,y, outlineThickness, w, h, f, col)
    local outlineX = x - outlineThickness;
    local outlineY = y - outlineThickness;

    local outlineW = w + (outlineThickness * 2)
    local outlineH = h + (outlineThickness * 2);

    uiElement:drawProgressBar(outlineX, outlineY, outlineW, outlineH, 1, {r=0,g=0,b=0,a=1})
    uiElement:drawProgressBar(x, y, w, h, f, col)
end
#

Like I'm stuck here, I reverse engineered everything do understand how things act and work

#

But I'm completely stuck understanding what this does, how it triggers

#

There's nothing calling SusceptibleUi:render()

hardy rose
#

I'm in the "make sure your mod can be enabled and do the simplest part" stage of development and this function doesn't seem to be working, I get infected and I don't get a message in the debug console

#

I can see the mod in "mods" and it's set to enabled

bright fog
#

Debug one or files ?

hardy rose
#

the debug console in game

bright fog
#

Yeah that's something I'm not too sure either, why some prints don't print while others do

hardy rose
#

So can someone who does know tell me why the file isn't working?

sturdy salmon
#

How did you create the mod?

hardy rose
#

This version is also not working, and is copied from a mod trying to accomplish something similar verbatim

#

I copied the file structure of another mod, Immunity, and made a .lua file where I typed the lua code

hardy rose
sturdy salmon
#

You have 2 times the average folder

hardy rose
#

what do you mean by that?

bright fog
#

Well here's the issue

#

media>media

hardy rose
#

*oh crap doubled media folder oops

sturdy salmon
#

Here you have an example of how it should go.

bright fog
#

You can have sub folders in client that's fine

sturdy salmon
#
Contents/
`-- mods
    `-- ItemsAwards
        |-- media
        |   `-- lua
        |       |-- client
        |       |   `-- awards.lua
        |       `-- shared
        |           `-- Translate
        |               `-- ES
        |                   `-- IG_UI_ES.txt
        `-- mod.info

8 directories, 3 files
#

You have twice the average folder.

bright fog
#

uh ?

sturdy salmon
#

Modify the mod, so that it has a structure similar to the one I gave you, although the shared folder is not necessary if you are not going to do translations.

hardy rose
#

fixed media>media, working as expected now

bright fog
#

shared folder can have your .lua script too

#

Depends what you need and impact

#

And subfolders in client, server and shared is ok

sturdy salmon
#

I didn't say it couldn't be done.

#

Only in this case, it would not be necessary, it only has a script

#

There is no point in subdividing it so much, unless it grows itself.

bright fog
#

Yeah

rugged plover
#

hey guys, in terms of the zombie infection are there such things as "stages" of infection? or does the infection just work in terms of hours?

sturdy salmon
rugged plover
#

I wrote this because I wanted to make a change to the Infection Cancellation mod but I just don't understand how the game defines these things

local function DetermineInfectionStage(bodyDamage)
    local infectionTime = bodyDamage:getInfectionTime()
    if infectionTime < 12 then
        return 1  -- early stage
    elseif infectionTime < 24 then
        return 2  -- middle stage
    else
        return 3  -- final stage
    end
end```
sturdy salmon
#
-- Controls how quickly the infection takes effect. Default=2-3 days
-- 1 = Instant
-- 2 = 0-30 seconds
-- 3 = 0-1 minute
-- 4 = 0-12 hours
-- 5 = 2-3 days
-- 6 = 1-2 weeks
Mortality = 5,
#

Maybe it has to do with that, but I'm not sure.

rugged plover
#

I see, thank you

bronze yoke
#

there are no stages or anything like that

#

stuff like sickness and stress just scales based on how infected you are, which just goes up linearly until it hits 1 and starts killing you

sturdy salmon
#

I would like to learn a little more about the topic of mods in general, but when I look for the documentation, I get stuck and can't move forward. I don't know why it's so hard for me to move forward on this topic. Since I have worked before with other open source projects, for example, where although at first it was also difficult for me a little, at the end of the day, I was able to adapt, but here I can't do it.

drifting ore
rugged plover
#

thank you!

bright fog
#

How do you see global variables in debug menu ?

zinc hound
#

hey guys, im having trouble generating items naturally w my mod. can anyone help me this?

#

this is item i want to add in game

zealous bloom
#

So not sure how well suggestions are taken here but I'd like to offer one:

I'd absolutely love a new character creator. One that lets you customize not just jobs and traits and such, but one that let's you give yourself points in skills as well.

It doesn't have to be balanced but the creator could include adding and subtracting points based on the amount of points in skills you'd start with alongside the option to ignore point requirements which I'm fairly certain that's an option already.

Likewise, I know there's outfit editors or extended outfit editors, but inventory editors would be a great addition as well. Where you can choose any items in the game to drop into your inventory at the start of the game.

Something I can compare it to would be EbD Prepare Carefull mod from RimWorld. (though I think it's defunct now)

eager grotto
#

how to get bag/fannypack in fannypack body location?

merry fjord
#

does anyone know if there's a way to get where the player spawned or do I need to get the player's location manually?

pastel raptor
#

hi guys I have a problem with the inventory tetris mod. I can't barricade windows or door

#

is anybody experiencing the same issue or is it only me? ๐Ÿ˜

uneven vessel
#

What stat actually determines the rate of fire on a weapon like the m16?

cedar kraken
sour island
uneven vessel
brittle vapor
#

how can I speed up a character for a certain time using a certain item (medical)

brittle vapor
brittle vapor
bright fog
#

Use that framework

#

You can modify the speed of a character

brittle vapor
#

I do not understand how

bright fog
#

Add a function to EveryOneMinute or EveryTenMinute
A counter that does a = a+1 so you can count minutes and remove the speed boost after a=time syringe boosts you

bright fog
#

Alright man, do you have any basics in Lua and modding ?

brittle vapor
bright fog
#

You need to create a .lua script

#

Go check some basic mods how they write stuff and do stuff

#

Reverse engineer a mod and understand how it works

brittle vapor
#

IMWSEnergy = {}

IMWSEnergy.LowHeal = function(good)
SpeedFramework.SetPlayerSpeed(2)
end

Events.OnPlayerUpdate.Add(good);

#

I'm a newbie, most likely I copied it wrong

bright fog
#

You need to count the elapsed minutes, use Events.EveryOneMinute.Add(counting) or Events.EveryTenMinute.Add(counting)

bright fog
#

You're not doing any check that the player is using your item

brittle vapor
#

...

brittle vapor
bright fog
#

idk, search for the function that checks when a player is using an item

#

I told you

#

Go find a mod that does a check if a player is using an item

#

Go reverse engineer that mod to understand how he checks if a player is using the item

#

And use that

#

Or at least it will allow you to understand better how to do stuff

brittle vapor
#

ok, cps

bright fog
#

cps ?

brittle vapor
#

thank you

bright fog
#

np

shrewd hatch
#

alright I am at my wits end trying to figure this out on my own. I'm trying to replace the wheel textures on a mod I downloaded from the workshop. I succeeded in changing the texture, and now I want to package it into it's own mod so others who didn't like the texture the mod shipped with can use it. I cannot figure out how to make a mod that retextures another mod. Anyone able to lend some assistance?

crisp dew
bright fog
#

Yeah

#

Just go in the files of that mod, copy the texture files and their folders, modify those textures

#

Now create a mod that has the same path to the files with the same names

#

Load that mod after the other one and it should replace the older texture files

crisp dew
#

Though I sympathize with you about being at wit's end; I feel the same way about this damned setOverlaySprite I'm fighting with. Works in single player, but I just cannot get it to work with a dedicated server.

shrewd hatch
#

Huh. I tried that but I suppose I'll try again. Maybe I goofed up somewhere.

bright fog
#

If no, did you put it in shared ?

crisp dew
#

I've tried in server/ and in client/, but I haven't tried shared/ yet.

bright fog
crystal oar
#

Hey, i just want to say, huge, immense thanks to everyone for their contributions to PZ, it wouldn't be half the game without you all

crisp dew
#

ok, I'll give that a shot.

bright fog
#

Tho I haven't done much yet

#

Only 2 mods

#

And those are fairly simple

crisp dew
#

The item restriction (only accept tires), and tile setup being in server seems to work well.

crystal oar
#

lol ya all my mods are really simple, i'm just an amateur coder myself

bright fog
#

Yeah

#

My two mods are addons that improve 2 or 3 mods and god fucking damn it you see the difference in level of coding

#

Like I touched on Braven's code of spore zones and Susceptible code and those are so clean (besides the lack of annotation which makes reading the code tedious) and then I modifed the code of The Last of Us Infected that used the code of CDDA zombies and ngl reading chinese code made me want to die

crystal oar
#

oh ya, i use a few of braven's mods, great stuff

bright fog
#

Some codes are such a mess to read, please add annotations to what your functions do and how they act and what triggers them

muted garnet
#

How can I get runSpeedModifier from a clothing script without having to specify each clothing separately?

crystal oar
bright fog
#

The names of the variables and functions is the most important part, like Braven's code and Susceptible code can be read through without any anotations fairly easily

#

Like one example in TLOU Infected code, is that you have a function named updateZombie and then another one named zombieUpdate and one of those call the other one

#

And there's this kind of shit everywhere

#

Like god damn it bro

#

And the annotations are in freaking chinese

crisp dew
#

ok, shared/ works for single player, (no surprise there)

muted garnet
crystal oar
#

lol that's an odd one, i guess zombie update is an event and update zombie pushes something to the zombies?

bright fog
bright fog
#

It's just

#

Like fucking kill me already

crisp dew
#

Still nothing for dedicated server though sadly.

bright fog
#

I think if the mod ever stops working, I will definitely rewrite all that shit myself

crisp dew
#

Hmmmmmm, client code lists ItemPickerJava, but server code lists ItemPicker

fast galleon
#

@crisp dew
If you use overlay then you just need to delay the change until after the server updates it.

I suggested to you to send a command before as that is what is used in ISA. From what I remember that was enough to keep the overlay change.

#

The other option is to use attached sprites instead.

crisp dew
#

in ISA you're not dynamically changing the overlay though, right?

fast galleon
#

It is based on number of batteries and power level.

crisp dew
#

ok, I see you're doing setSprite and sendObjectChange('sprite')

fast galleon
#

oh right, we ended up to using 2 objects for convenience.

crisp dew
#

other places in the Trap code uses setSprite which is the same that you're doing; I'm trying to use the overlaySprite, which could be the root of my issues

fast galleon
#

I am familiar with the issue, had same problem.

crisp dew
#

ok, so that block instead of isoObject:setOverlaySprite ya'think?

fast galleon
#

It's an alternative option, you can add more sprites but you also need to remove those you don't need.

fast galleon
#

I'm not sure how much delay you need to add in order to change the overlay after it updates on server, it could be up to 3 seconds plus transmission. (b41)

crisp dew
#

I think I have bigger issues in my code; ItemPickerJava.updateOverlaySprite isn't firing when in multiplayer, (thus my updateSprite is never even being attempted)

fast galleon
crisp dew
#

should be is the notable phrase there.

fast galleon
#

java calls like that are not able to be patched though

crisp dew
#

It can be patched in single player though

fast galleon
#

it is being called from lua in single player

crisp dew
#

oh, it's a lua call only in single player.

#

well crap

#

(even though it's listed in the shared lua directory)

crisp dew
#

ok, riddle me this; in server mode it loads shared and server, and yet in client there is code such as if not isClient()... why would there be "if not client" in code where only the client loads?

fast galleon
#

it means it's for SP

crisp dew
#

oh, both isServer() and isClient() is FALSE when in single player

#

well that's interesting

crisp dew
#

Somehow reminds me of a recent post on Mastodon mentioning how bad of an idea it is to use Discord as a knowledgebase. But that does clear up some of my confusion at least.

muted garnet
#

I have a table with bloodlocations, and also a function that causes errors if the player does not have clothes in this slot, how do I check if there are clothes in this slot before using bloodlocation from the table?

    local bloodLocations = {
        "Jacket",
        "LongJacket",
        "Trousers",
        "ShortsShort",
        "Shirt",
        "ShirtLongSleeves",
        "ShirtNoSleeves",
        "Jumper",
        "JumperNoSleeves",
        "Shoes",
        "Bag",
        "FullHelmet",
        "Apron",
        "Hands",
        "Head",
        "Neck",
        "UpperBody",
        "LowerBody",
        "LowerLegs",
        "UpperLegs",
        "LowerArms",
        "UpperArms",
        "Groin",
    }    

    for _, bloodLocation in ipairs(bloodLocations) do
-- Here need to check for the presence of an item of clothing in the slot
        local item = player:getWornItems():getItem(bloodLocation)
    end
bronze yoke
#

check if item is nil

crisp dew
#

Alright Poltergeist, I got it "working" thanks to looking through your code. Ended up adding a cron via EveryTenMinutes and manually check the server registery of containers. Certainly not ideal, but it seems to work at least.

viral spire
#

Figured I post this here since it's about a mod idea:

#

I said this last night, but a SCP-3008 overhaul mod for PZ would be pretty fun if done right, such as:

  • Randomly generated map that looks entirely like an IKEA store. Displays of furniture, kitchens, bathrooms, bedrooms, and more.

  • A unique weather system that only occurs when too many fires are set/occurring, emergency sprinkler system. However, this results in powerful rainstorms that can lower visibility to almost zero.

  • Daytime hours are from 7AM to 10PM.

  • Countless zombies spread almost uniformally around the world, all looking like IKEA employees. During the day, they completely ignore you, shambling around aimlessly. At night, they all turn into viscious, strong sprinters that will stop at nothing to get to you. All of their moans and snarls are instead replaced with quotes like, "The store is now closed. Please exit the building."

  • Killing employees are fairly easy, but get harder the longer you survive. Bodies will attract employees, so dump them elsewhere.

  • Food displays will restock every 3-5 days. However, the closer you are to any one food display, the higher the chance it will not restock.

  • There is no exit.

  • Food is plentiful if you know where to look.

  • Carpentry and moving furniture is your friend. Use it to build shoddy structures out of furniture and create a base with everyday appliances.

  • Guns are incredibly, incredibly rare.

  • The game world is randomly generated every time (assuming something like this is possible down the line), but it always looks like an IKEA store.

  • TVs and radios play no broadcasts, but you can still find VHSs and such.

  • When 10PM hits, the game world immediately goes dark as the lights shut off. The store is now closed. They snap back on at 7AM.

  • (SANDBOX option) Every week or so, a chance occurs of a Blackout event occurring for a few hours. ALL lights shut off except candles and flashlights. Employees are active, but also smart and can open doors, tear down structures quicker. Be ready.

sly quarry
#

Does anyone have experience with making custom poster or painting tiles etc? I've made some signs, but whenever I edit them in TileEd they appear behind the wall instead of on it ๐Ÿฅฒ Wondering if someone knew a fix or what I'm doing wrong.

edgy isle
#

@frozen aspen hey, pinging you here - it's me, Dante from steam - dm me

frozen aspen
#

hey

#

fr sent

bright fog
patent holly
#

Okay, Lua beginner here. I just ran into an issue and it's out of my depth, so any advice is appreciated.

I'd like to reverse these events firing order if a controller is connected because I add them to the top of the context for controller users but at the bottom otherwise, but addOptionOnTop reverses their order, which isn't a big deal but it bothers me... But if I use an operator, it throws a runtime error "__add not defined for operands" is there an easy way around this?

if not JoypadState.players[player + 1] then
    Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuWelcome)
    Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuWood)
    Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuStone)
    Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuMetal)
else
    Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuMetal)
    Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuStone)
    Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuWood)
    Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuWelcome)
end

Edit for posterity: What was throwing me for a loop was the inclusion of "add" in the error, which (due to my inexperience) led me to assume it was a problem with the event because of the ".Add" lol and completely overlooked the "+" being there. The game didn't know what was going on and throwing an error on launch because, of course, it didn't have a player to reference and returned nil and threw an error.

Thank you albion, for pointing out what the error was actually referring to. Knowing the terminology is def important. I should have googled the error and did some learning.

Instead, as an easy workaround, I just had my first function fire the others in the appropriate order according to the controller status instead of having the event do it for all of them separately.

crisp dew
#

server/blah.lua

-- Only run this code in SERVER mode
if not isServer() then return end

client/blah.lua

-- Only run this file in single player.
if isClient() then return end
#

The code I ended up running with, so ensure the expected behaviour. Then shared is available to both.

bright fog
#

So did it run files in every folders or not ?

#

Was my question

#

Or does it completely skip the server folder in SP

crisp dew
#

oh, sorry, single player runs shared + client + server

bright fog
#

Alright thx

crisp dew
#

Don't believe me though ๐Ÿ˜‰ hit F11 when in debug mode and scroll through the list of included LUA files. It provides a list in order of loaded.

#

You can also double-click on one of them to view the contents, then double-click on a line in that LUA to insert a break point.

bright fog
#

Right

#

A break point ?

crisp dew
#

aye; when the game runs that function/code, it'll stop at the breakpoint and let you see the variables in real time.

#

Then you can step through one line at a time to see what it's doing.

bright fog
#

Interesting

#

Didn't knew that

#

Alright now I understand a bit better what the buttons are in the debug menu hmm

crisp dew
#

yup, step into (descend into nested function), step over (skip called functions and just "stay here" until it returns), and resume execution.

bright fog
#

hmm

crisp dew
#

I feel I should publish a video on code debugging or something, I don't know what's going on in this codebase half the time, but I know my way around a debugger

bright fog
#

The buttons don't have descriptions, and it's ugly asf so I couldn't understand how to move around it

shrewd hatch
bright fog
#

There's literally only 3 buttons, you can open the code, you can't access global variables

crisp dew
#

Yeah, it's not the greatest, but it does the job. I don't believe they show global variables, just scoped variables.

bright fog
#

Is there a way to have sandbox options appear only if another mod is active ?

#

I think it is possible right ?

crisp dew
#

Still talking about single player?

bright fog
#

No no it has nothing to do with it

#

Just overall

crisp dew
#

If you're debug on a server, you have sandbox options just in the admin left-hand icon.

bright fog
#

Is it possible to have specific custom sandbox options appear only if another mod is available

#

No I'm not talking about modifying sandbox options midgame

crisp dew
#

Oh, I assume custom LUA code has access to that, but it would be up to you to implement the UI / functionality, sorry I don't know that.

bright fog
#

what ?

#

No I'm not talking about custom sandbox options visually

#

I'm talking about the sandbox panel when you create a world, you can add modded sandbox options

#

And I want to add one that only appears if another mod is present

#

an actual option

#

A single one

#

Or two

crisp dew
#

OH, absolutely, mods can declare their own options

bright fog
#

Yeees

crisp dew
#

let me try to remember one which does it, I'm not on production right now

bright fog
#

I think I've seen a mod do that yeah, but I don't remember which

#

Tho I don't want the player to activate a secondary mod just to add the sandbox options if that's possible

crisp dew
bright fog
#

I would prefer having it available automatically

bright fog
crisp dew
#

Yeah, that adds options to that sandbox section thing, or I take it that's not what you were referring to...

bright fog
#

Ok bro sry but are you on drugs or something lol ?

#

I'm not asking HOW to add sandbox options, I'm asking IF it's possible to add A SANDBOX OPTION that only appears if the player activated ANOTHER MOD like:

mod1 - does something, not by me
mod2 - by me
mod3 - not by me, but present so mod2 adds an option in sandbox menu

crisp dew
#

To my knowledge that's not really possible; that runs prior to any logic running.

#

** prior to any LUA logic.

bright fog
#

How so ?

crisp dew
#

what? No, I said that's not possible to my knowledge.

bright fog
#

Yes, I was saying how so to the "any LUA logic"

crisp dew
#

The Java code handles that.

bright fog
#

Ok ok

patent holly
#

I just mention in the tooltip on my sandbox setting that it's disabled if the other mod is running.

bright fog
#

Yeah guess I'll just do that

patent holly
#

I'd def love dynamic sandbox settings, but such is life lol

bright fog
#

yup

#

The best you could do is add a secondary mod that people activate to add the options

#

But eh

winter thunder
#

If I am adding an OnCreate funciton, do I need to require any of the base lua files in order to get it to load? I swear it has worked, but I am not sure why it is breaking now ๐Ÿ˜ญ

bright fog
#

If you require some functions from the base game or another mod, then you need to add require 'folder/.lua'

#

Or something similar

#

For example one file I'm looking at rn has

require 'Items/SuburbsDistributions'
require 'Items/ProceduralDistributions'```
winter thunder
# bright fog Depends what you are using in the function

Nah, its just a self contained OnCreate function that is being plugged into a recipe script. I likely broke the code somewhere in my most recent changes ๐Ÿ˜ข It is currently telling me that there is "no such function"

bright fog
#

misspell maybe

winter thunder
#

Nah, both references to it are named the same. It is just telling me that there is no such function ๐Ÿ˜“

bright fog
#

I've never had this error

#

How are you calling the functin ?

winter thunder
# bright fog How are you calling the functin ?
recipe Make An Alloy
{
keep Crucible,

Result:GenericAlloy;1,
Time:120,
OnCreate:Recipe.OnCreate.MeltMetal,
AllowOnlyOne:true,
RemoveResultItem:true,
StopOnWalk:true,
StopOnRun:true,
}

(Currently still ironing out the testing, so there will be more added to this later lol)

bright fog
winter thunder
#

Yeah! ๐Ÿ˜‚ I was just showing how I called the function through the recipe

bright fog
#

What does the recipe function look like ?

#

Because I think you can't use . in the names of function like that

winter thunder
#

You def can haha, I have in the past as well. It is how the game handles certain specific functions. I used the same format in my RPDescriptors mod for stabbing/reclaiming notes

#

And it is like 57 lines ๐Ÿ˜ฐ So I cant exactly just drop it

#

Not including the connected reference tables...

#

The file itself is ~370 lines

bright fog
#

well idk man

#

I haven't used recipes yet

vague raven
winter thunder
bronze yoke
#

requires do not change the loading behaviour for vanilla files

winter thunder
vague raven
bronze yoke
winter thunder
#

Just so I am not going crazy... I have the function in the server section, since that is where the game has basically all of that code. But- Is that the correct spot? ๐Ÿ˜…

bronze yoke
#

it shouldn't matter where it is

winter thunder
#

Dope

bronze yoke
#

as long as the function is loaded on the client, and all folders are

winter thunder
#

What do you mean?

bronze yoke
#

OnCreate functions are called on the client, so it needs to exist in that environment

#

but all folders are loaded on the client so the folder the oncreate is in doesn't matter

winter thunder
#

Like, client as in the broad term? Like, so long as I have them in actually existing in the mod- Not client as in the media\lua\client folder? Right?

bronze yoke
#

yeah

winter thunder
#

Ok cool, just wanted to be sure haha! Normally if my function breaks it would kick back errors instead of just not working... But I cant think of any other reason why this would be breaking like this :(

bronze yoke
#

though if you're putting it in the Recipe table, as it looks like you are, you need to put it in the server folder because that's when the game creates that table

winter thunder
#

Yeah, currently all of my lua is in the server section. It is running my other file, which has an AcceptItem function, and that is working fully as intended

bronze yoke
#

what do you get if you try print(Recipe.OnCreate.MeltMetal) in the in-game console?

winter thunder
#

nil

bronze yoke
#

yeah, the failure isn't anything to do with your recipe, your function really doesn't exist

bright fog
bronze yoke
#

i wasn't trying to check the return value, i was trying to check if the function existed

bright fog
#

right

bronze yoke
#

you'd expect to get closure 0xmemoryaddress when you print a function

bright fog
#

If the function is local doing that won't do anything if you do it in the console ?

bronze yoke
#

yeah, the console isn't in the scope of those locals

winter thunder
bright fog
winter thunder
#

Like, in my PZ 'mods' file?

#

Bc yes

bright fog
#

?

#

No in your .lua function where it's written

winter thunder
#

OHHHH oh

#

No

#

I thought you meant was it workshop or local lmfao

#

But no, the function is not bound to local

#

I can throw it into a rentry or something if that works? Not sure if I can paste links here, but if I can I can just send the current code if yall wanna have a look haha

bright fog
#

Well your function has something wrong then

bright fog
winter thunder
#

Its like 370 lines... So there is no way that is fitting in any meaningful way hahaha

bright fog
#

Just send your function

#

Your function can't be 370 lines

bronze yoke
#

the whole file would be helpful

#

at least before the function

#

it wouldn't be unusual for some error further up to stop execution of the file

bright fog
#

Depends

#

Before a function doesn't mean anything if your whole file is just functions

#

Those could be called in any order

#

However the syntax could be wrong before, with an end forgotten at the end of a function

#

Check every functions have an end, same for every if, for etc

#

You could also add your function in an Events.EveryOneMinute

#

If it blocks on the line of Events.Add

#

Then syntax of the function could be wrong

#

If it blocks inside the function, well at least the function is recognized

winter thunder
#

That is all 370 lines in ALL it's glory ๐Ÿซก

#

Still containing half the comments, and all the testing prints I forgot to remove lol

bright fog
#

I suggest you put AlloyRules in a side file, makes it easier to read

winter thunder
#

I know, I plan on it

bright fog
#

๐Ÿ‘Œ

winter thunder
#

I just wanted to make sure it worked before changing anything haha

bronze yoke
#

syntax error on line 42 else if alloyTally[key] and not == 'total' then

bright fog
#

why do that ?

local AlloyRules = {}
AlloyRules = {```
And not
```Lua
local AlloyRules = {```
winter thunder
#

๐Ÿคทโ€โ™‚๏ธ

#

I uh... I dont know

bright fog
#

I mean it's not the source of your problem lol

#

I doubt it

bright fog
winter thunder
bronze yoke
#

not what equals total?

bright fog
#

forgotten variable

winter thunder
#

...

#

Thank you

#

๐Ÿคฆ

bronze yoke
#

also, you use else if, you might have wanted elseif

#

else if literally is just an else with an if in it so it creates weird scopes

winter thunder
#

No yeah, you are right. I did mean elseif

bright fog
#

yeah

#

I was wondering if it would do the same

#

But there would be a missing end then

bronze yoke
#

when the game won't give you a proper error you can throw it into an online lua interpreter, they don't have pz's builtins so you won't be able to actually execute the code most of the time but it'll usually catch syntax errors

winter thunder
#

That also explained why my function was yelling at me about missing an end last time I was working on this... lmao

bright fog
#

:)

#

Like I told you, check the syntax

winter thunder
#

I honestly did too, I threw it into a syntax check online and i must have just missed it. I think that since the else if was technically correctly done, just not intended it didnt catch it. And I must have just missed the not == thing

bronze yoke
winter thunder
#

reloading and seeing if it will run the function now

bronze yoke
#

i haven't even actually looked at your code yet ๐Ÿ˜…

winter thunder
fast galleon
#

It seems like you might have an issue with the tile properties.

muted garnet
# bronze yoke check if item is nil

not working, error in getItem(bloodLocation) cuz unknown location: "Groin or something else", this error like as if I didnโ€™t write then after it, the debugging window does not appear

ornate wave
#

im looking to make a small mod to remove the back slot cause it annoys me, unfortunately i have no idea how to do this. not made a mod before etc

hollow current
#

Is it possible to retrieve the name of a player through his corpse (infected or not)? I couldn't find a very direct method through the docs

fleet bridge
#

you could probably back out the item owner off the zombie corpse

abstract pine
# hollow current Is it possible to retrieve the name of a player through his corpse (infected or ...

It looks like the info you want is saved on IsoDeadBody objects but I don't see any methods for accessing that data in lua, so unless someone else has a better idea I'm missing, you may have to use an indirect method.

The simplest way I can think of would be to find the key chain item on the corpse and get the player name from that, but that doesn't work if you need the name with 100% reliability for what you're doing, since it'll fail for the 1% of players who get rid of or change their key chain names. Other than that could maybe try saving the player's descriptor data onto the corpse using events.

hollow current
fleet bridge
#

if you're talking about a zombified corpse tho, that wont work

#

(until you kill it)

hollow current
hollow current
fleet bridge
#

not sure if you can access the corpse container after playerondeath, but you could always drop a sheet of paper in there and change the name of it to equal to the player name

abstract pine
hollow current
#

getReanimatedPlayer could be useful. The body is accessed through the context menu so shouldn't be a problem, i'll give it a go

#

oh its a IsoZombie method not a IsoDeadBody method

#

ye i just got what you meant, its indeed tricky

hollow current
open drum
#

hey guys, quick question

#

how would one get info of a dropped item on a gridsquare ?

#

i expected getPlayer():getGridSquare()

#

and in isoGridSquare class

#

i expected it to have some kind of method to list of items that are dropped in the grid

#

or have a way to get the floor container
, never mind! i just found that I need to use getWorldObjects()

quartz holly
#

How can I place text when interacting with an object? just like the green fire mod does when opening a mysterious object, for example when it says is this... a bong?

open drum
#

what do u mean?

#

when u right click on it?

#

or when u press something

#

does it have somekind of context menu?

#

if so, u just use the getPlayer():Say("your text here")

quartz holly
#

ok

quartz holly
crystal oar
#

hey where is the weight system code stored? or i might not even be able to do what I was thinking, but what I want to do is widen the healthy weight range to be easier to stay in.

open drum
#

then use OnCreate event or something to execute the Say() function

unkempt dove
#

Does anyone know how I can prevent a player from being forced awake without rewriting the entire calculateStats method and subsequent methods using the calculateStats hook?

quartz holly
#

or xml

open drum
#

Guys I know you can get inventory of a character by doing lua getPlayer():getInventory()

#

but how can one get inventory of a world? like the floor???

#

i can't find getInventory() method in IsoGridSquare()

fleet bridge
#

getSquare():getWorldObjects()

#

isEmpty() to check if its empty

open drum
#

but i wanted to edit it's weight

#

by using setWeight()

#

but it wouldn't work because it doesn't count as inventoryitem

sour island
#

World object is a different kind of object yes, but you can run getItem off it

sour island
#

You'll also need to transmit the world object to keep it in sync

open drum
#

yea i noticed that problem as well

sour island
#

World objects have a inventoryitem field

open drum
#

when i do removefromworld()

#

it removes from world

sour island
#

You need to do a few things to properly remove it

open drum
#

but the residue stays in the worldinventory

#

unless i move the chraacter

sour island
#

Handling items on the ground is kind of a mess

open drum
#

to update it

#

yea...

#

can you give me an example if it's ok for you chuck?

sour island
#

Check the pickup/drop code

#

And the remove item tool

open drum
#

i see

sour island
#

You need to remove it from it's container as well as the world and a few things

#

It was the hardest part of game night

#

Half the time developing the mod was spent trying to get things to sync and be able to be moved around the world quickly

open drum
#

hmmm

#

so.. i did lua item = getPlayer():getSquare():getObjects():get(2)

#

to get the item on the ground

#

which is an worldinventoryobject

sour island
#

Add getItem to the end

#

Also get(2) won't work in most cases

open drum
#

ah

sour island
#

You'll have to parse through the get objects array

open drum
#

gotcha

sour island
#

What exactly is your goal though? Like the point of the modification?

open drum
#

oh i was trying to find a debug console method

#

to be able to find an item on the ground

#

and change it's weight

sour island
#

Oh

open drum
#

because there were some items that was too heavy to life

#

lift**

#

even for admin

#

but yea, getItem() worked like a charm

sour island
#

Couldn't you right click the item to edit its weight? Or is weight not one of the fields?

open drum
#

it looks like

#

if the item is on world

#

it's not editable

sour island
#

Even from the inventory window?

open drum
#

it needs to be in your inventory to do so using debug

sour island
#

Looting window rather

open drum
#

this is looting window

#

and this is same item in player inventory

#

as u can see only one of the button on the left side is active

fleet bridge
#

are you trying to make it heavier/lighter on pickup or something?

open drum
#

lighter mostly

sour island
#

This is a temporary fix or something you want done across the board?

#

Wouldn't it be better to edit the items script?

open drum
#

it was temporary fix

#

So it seems like lua item = getPlayer():getSquare():getObjects():get(2):getItem():setWeight()

#

worked good enough

fleet bridge
#

might not work if multiples or if theres a bunch of random items on the ground?

sour island
#

If it's for a quick fix picking it up should set it

#

Moving items to the player internally sets things

#

It's being on the floor that causes issues

#

Ex: A changes the weight, and then B picks it up

open drum
#

yea

#

that's what i wanted to do

#

just make it light enough to pick it up

fleet bridge
#

why not just use script manager and doparam to set the weight across the board?

open drum
fleet bridge
#

i havent tried setting it to execute when the server is running, but it would only update items that generate not items that exist

open drum
#

do you mean the item that is already written in media/script/item.txt file?

#

or an item object generated using something with :new()

fleet bridge
#

if the item exists in-game DoParam won't change those properties, only for properties of items moving forward

#

like if you had the item in your inventory already, it will retain those properties even if you changed the parameters using DoParam

open drum
#

so how would i use it? the doParam() method

#

do you know if there's any code snip that i can take a loook to learn?

fleet bridge
#
    local item = ScriptManager.instance:getItem("WoodAxe")
    if item then
        item:DoParam("CriticalChance    =    25")
    end```
open drum
#

will this permanently change the crit. chance of the WoodAxe

#

every time i spawn it?

#

or does it need to be ran every time the server restarts?

fleet bridge
#

It needs to be run everytime the server starts yea

#

It changes the item parameters when loaded. Any items that spawn will have the modified parameters. But for instance if you have a wood axe already spawned it will retain the original parameters

muted garnet
#

I have a table with bloodlocations, and also a function that causes errors if the player does not have clothes in this slot, how do I check if there are clothes in this slot before using bloodlocation from the table?

    local bloodLocations = {
        "Jacket",
        "LongJacket",
        "Trousers",
        "ShortsShort",
        "Shirt",
        "ShirtLongSleeves",
        "ShirtNoSleeves",
        "Jumper",
        "JumperNoSleeves",
        "Shoes",
        "Bag",
        "FullHelmet",
        "Apron",
        "Hands",
        "Head",
        "Neck",
        "UpperBody",
        "LowerBody",
        "LowerLegs",
        "UpperLegs",
        "LowerArms",
        "UpperArms",
        "Groin",
    }    

    for _, bloodLocation in ipairs(bloodLocations) do
-- Here need to check for the presence of an item of clothing in the slot
        local item = player:getWornItems():getItem(bloodLocation)
    end

error in getItem(bloodLocation) cuz unknown location: "Groin or something else", this error like as if I didnโ€™t write then after if, the debugging window does not appear

sour island
#

Blood locations are based on body parts aren't they?

abstract pine
# muted garnet I have a table with bloodlocations, and also a function that causes errors if th...

Problem is getItem expects a string corresponding to a body location group, not a blood location. I'm not sure there's any way to directly get items of certain blood location types, youยดd have to iterate through the items and check what they are:

local wornItems = getPlayer():getWornItems();
for i=1, wornItems:size() do
    local item = wornItems:get(i-1):getItem();
    if instanceof(item, "Clothing") then
        local bloodLocation = item:getBloodClothingType();
        if bloodLocation then
            -- do stuff
        end
    end
end
sour island
#

What are you also trying to accomplish?

#

There might be a different way to go about it

#

I recently used this to count the parts

    local visual = player:getHumanVisual()
    for i=1,BloodBodyPartType.MAX:index() do
        local part = BloodBodyPartType.FromIndex(i-1)

        local blood = visual:getBlood(part)
        local dirt = visual:getDirt(part)
#

It's cut off cause the rest of it is unrleated

muted garnet
#

thanks guys, all works!

#

but can you explain pls what is the difference between bodylocation and bloodlocation?

#

in the context of clothing

fleet bridge
#

body location is where it's worn, bloodlocation is where it can protect (i think)

#

technically you can have a headpiece that protects your groin, for instance

mellow frigate
#

Hello there, anyone knows and can share the semantic for a comment inside sandbox-options.txt file ?

bright fog
#

How do you even turn off the fog in debug ????

mellow frigate
cinder flicker
#

Hello, what are the differences between those?
IsoZombie createZombie(float x, float y, float z, SurvivorDesc desc, int palette, IsoDirections dir)
spawnHorde(float x, float y, float x2, float y2, float z, int count)
createHordeInAreaTo(int spawnX, int spawnY, int spawnW, int spawnH, int targetX, int targetY, int count)
createHordeFromTo(float spawnX, float spawnY, float targetX, float targetY, int count)

which one is more suitable to spawn zombies inside at the same height than the player, if I check player:isOutside ?

mystic lava
#

How would one go about tweaking values for items without overwriting the items entirely? I wanted to change the capacities of vehicle trunks but I would like to not have to completely overwrite the vehicleitems file if possible. Would I just have to write a file that imports the Base module and specify new values for given items?

mystic lava
#

thanks, I'll definitely check it out and see how Eggon did it

bright fog
#

hmm

#

yeah I understand why you wouldn't want to do that

#

Overall it's not great to modify base files

mystic lava
#

Looks like Eggon's done it through actual script and function calls which is a little more in-depth than I wanted to get tbh

bright fog
#

๐Ÿ‘Œ

mystic lava
#

I tried doing what I thought would work and unfortunately it does not. The items I specified in my file became new trunk items and vehicles were not spawning with them. I think I'll have to do some more learning to make it happen the way I want it to

bright fog
#

You added items to trunks ?

#

If you want to do that, you add them to the loot table, did you do that ?

storm saffron
#

is there anyway to add a colored overlay via hotkey or action? im just trying to get the overlay to work right now

#
DarkRedFilter.filterColor = { r = 80, g = 0, b = 0, a = 200 }  -- Dark red color with 200 alpha

function DarkRedFilter.applyFilter()
    local player = getPlayer()
    local originalColor = player:getScreenOverlayColor()

    player:setScreenOverlayColor(DarkRedFilter.filterColor)

    addEvent(DarkRedFilter.restoreFilter, 10 * getGameTime():getMultiplier(), player, originalColor)
end

function DarkRedFilter.restoreFilter(player, originalColor)
    player:setScreenOverlayColor(originalColor)
end
mystic lava
# bright fog You added items to trunks ?

Well, the goal wasn't to add new items but to make the base game trunks have higher capacities but because the file I wrote imported the Base module instead of modifying it, it added the items as new ones.

mystic lava
bright fog
#

They put the file in media/lua/server/items

proven bough
#

Hey everyone, I'm working on a little weapon mod at the moment. I've got a staff, and I want it to use the attack animation of the sledgehammer, but I want to speed it up and make it attack faster than a sledge normally would...is this possible?

fast galleon
uneven vessel
#

Does anyone know what I need to change here?

bright fog
uneven vessel
#

i'm sort of reverse engineering this

bright fog
#

Well, my point is even better, try things

#

"what if I change this value, or this value ?"

uneven vessel
#

Okay do you have anything useful or concrete such as the values vanilla weapons use for offsets or where i can find them or a method for live checking changes that don't involve restarting the game every txt file change instead of doing this modder snark routine where you act like some questions are just too stupid for you

timber river
# uneven vessel

I'm pretty sure there is a tool for this in the pzmodding tools that will let you accurately place attachments and such

uneven vessel
#

Ty

bright fog
#

I've never used those values and if I had to test it, I would just modify the values and try

#

Modifying 2 could be enough to understand what value corresponds to what, where the x y z axis are and if it's in degrees, meters, pixels or idk what

bright fog
#

Uhm, anyone knows how I could open .x animation files for zombies since Blender can't ?

#

I tried used open3mod but vanilla files can't be opened

#

I tried opening modded .x files of zombie animations and those do work

#

But I would want to use the vanilla ones to modify the animations

bright fog
#

Is there a line of code that allows to modify the animation of a zombie to a specific type ?

#

Are zombies animations called for zombies in the lua files or not ?

#

Or is it outside of the lua

livid badger
#

Hello! Can someone answer me? How I can add MoveWithWind = true or CanBeCut = true to farm objects?

mystic lava
mystic lava
bright fog
#

I found in the pinned messages a way to do it

bright fog
#

Tho I'll have to look how to go the other way around

mystic lava
#

Sorry m8 I'm not familiar with Blender but it's good you found a way to do it

bright fog
#

However I'm not currently doing the animations, I'm trying to see if you can set up different animations for differents zombies

bright fog
#

I'll make a forum post to ask if it's possible to have different animations for different zombies since it's barely possible to get an answer half the time here

mystic lava
#

Animation is beyond me, man. Good luck, though

bright fog
#

Yeah well the issue isn't really animating it anymore lol

#

Just if it's possible in lua to call for animations for zombies

#

Because I already have the code to know a type of zombie etc, just finding documentation for the modding in this game is literally impossible

mystic lava
#

Although I think zombies with player animations would be terrifying since PC sprinting is fast as hell lol

bright fog
#

These set animations for ALL the zombies, which I think is fairly easy to do

#

My issue is that I have different type of zombies, the infected from The Last of Us, and I want clickers to have clicker animations, runners to have runners animations etc

#

And that means I can't use that to modify the animations of zombies since I need multiple different animations

mystic lava
#

gotcha

bright fog
#

I already found a bunch of mods that modify the zombies animations but they always just modify all the zombies

#

Haven't found one yet that modifies only one zombie

#

The closest I have found is CDDA that seems to force an attack animation I think ? But I haven't tested in game what it does

bright fog
#
zombie:setBumpType("trippingFromSprint") -- Check if player is in Idle Stance
player:setBumpType("stagger") -- Check if player is in Idle Stance
player:setVariable("BumpDone", false) -- Check if player is in Idle Stance
player:setVariable("BumpFall", true) -- Check if player is in Idle Stance
player:setVariable("BumpFallType", "pushedFront");
bright fog
#

Does it?

bronze yoke
#

you can usually mess with animations using setvariable

mystic lava
#

checking

bronze yoke
#

the way animations are applied is somewhat unintuitive but quite flexible

bright fog
#

Alright you got my attention

#

So it is indeed setvariable

bronze yoke
#

the animation variables setVariable sets are basically conditions for the animations, if all conditions are met then that animation will play

mystic lava
#

It doesn't outright say. Seems like Albion knows more about it

bright fog
bronze yoke
#

so in theory you could add an additional variable to play your animation instead of the default ones

bright fog
#

Do you have any examples or documentation to understand how setVariable works ?

bronze yoke
#

but in practice i don't really know how it'd tiebreak between multiple valid animations unless you had a way of specifically forbidding the default animation

bright fog
#

Bcs I'm kind of confused about it rn

bronze yoke
#

i don't really have anything, i don't make animations myself so i don't have an implementation to show you

#

i just know a little since i helped somebody debug a custom animation for players a while back

livid badger
#

Guys maybe u know about setup MoveWithWind = true or CanBeCut = true to farm objects? ))))) Ill try do that with Tile properties but it not working on farm objects

mystic lava
#

In theory, you would just need a condition statement that checks for whether a given zombie has a specified ID before checking for other parameters to play an animation

bright fog
#

Hmm so it allows you to play an animation but naturally I want them to have that animation

#

Having code forcing them to play an animation all the time would probably lag the fuck out of the game

bronze yoke
#

it's actually kind of the other way around

#

there isn't a way to directly tell a zombie to play a specific animation, you just set variables and the animations check those conditions

bright fog
bright fog
bronze yoke
#

in theory, you'd have an IsClicker bool or something in your clicker animation xmls, and otherwise they'd be a copy of the vanilla ones - then it'd play those animations after you set IsClicker to true for that zombie

bright fog
bronze yoke
#

i think the vanilla usages are mostly/entirely java? it's worth searching vanilla lua for usages of setVariable

bright fog
bronze yoke
#

your ide doesn't have a search function?

bright fog
#

I tried looking for files that set the zombies actions but haven't found anything

bright fog
#

I have a search function

bronze yoke
#

the program you use to write code

bright fog
#

But I need to open the file

bronze yoke
#

most would let you search a whole folder, if you're using notepad++ or something that probably wouldn't

bright fog
#

And there's hundreds of them and I have no clue which file could set the zombies animations

bronze yoke
#

i'd recommend switching to something a bit more powerful, but for now i'll just run a search for you

bright fog
#

What do you use ?

#

I know people usually use visual studio

#

But visual studio is a pain to install I find like, there's so many shit you don't know about and don't know if you'll need

bronze yoke
#

i use intellij idea usually, but i'd recommend visual studio code (or even better, vscodium)

bright fog
#

Everytime I try I just abandon

bronze yoke
#

visual studio code should be a pretty straight forward install, proper Visual Studio is overkill for lua

bright fog
#

Ah I didn't knew those were two different things

#

Alright I'll try that out thx

bronze yoke
#

it seems like a lot of timed actions use setVariable, ISFishingAction has a lot

livid badger
# bright fog Try asking in mapping maybe ;)

k thx, and one more thing, sometimes when my mod run on the server sprites don't line up correctly, I mean that let's assume plant growth stage 7 however the sprite shows stage 4. I checked the rest of the mods, there seem to be no conflicts, it works fine for local. Should we look for the problem in the server-player being out of sync?

livid badger
#

K thx

bronze yoke
#

the zombie walking animations use a shared zombieWalkType string condition to determine which one to play, you could probably just add one with a new value

#

assuming the game won't try to fight you reassigning that value

bright fog
#

In the XML files for animations, where does the game find the conditions actually ?

#

Also what are the two events footstep ?

bronze yoke
#

those conditions are the setVariable calls

bright fog
#

Ah okay

bronze yoke
#

i'm not really sure how events work but i assume something in java catches these and plays the footstep sounds

bright fog
#

Ok so I understand a bit better what you said I think

#

So if I make XML files like those each different animations I want and add the condition isClicker to the xml walk for clickers and set the AnimName to the animation I made for the clicker

#

Then in lua code somewhere idk yet I have setVariable("isClicker") for the walk it should play the clicker animation ? If I add a check it's a clicker ?

#

Is that it ?

bronze yoke
#

probably, yeah

#

i'm unsure on how the game will tiebreak multiple valid animations - since the vanilla walk doesn't check that the zombie ISN'T a clicker, both animations are valid

bright fog
#

Ok so I basically need to modify the file that tells a zombie to use the walk animation with the setVariable

bright fog
#

I replace it and add a condition isClicker false

#

I already have conditions to check each types of infected in my code

bronze yoke
#

that's why messing with the zombieWalkType would be ideal, the vanilla ones check that so if you just set it to e.g. clicker none of those checks will pass and you don't need to replace the vanilla files

bright fog
#

It's a lua file or anim xml file ?

bronze yoke
#

it's an anim condition

#

sprint1.xml, walktoward1.xml, etc all check this zombieWalkType

bright fog
#

Yeah I found it thx

#

string value 1 ?

#

Don't they write the walkType as "sprinter" "shambler" ?

#

They use values ?

bronze yoke
#

they have 5 of each type, fast shamblers are 1-5, sprinters are sprint1-5, never looked at the others

#

i don't really know why they have 5, not something i've looked at

bright fog
#

I mean yes but what does <m_StringValue>1</m_StringValue> act

#

That was my question

#

why use string if it's not a string variable

bronze yoke
#

sprint1 is a string

bright fog
#

Right yes

#

I think we get to the issue where the devs just don't call their variables correctly to easily understand what they are refering to

#

I mean I just need to find the code with setVariable for walkTypes now I guess

#

I'll do that later tho

errant stirrup
#

Hi, I'm new to modding. I found an unsupported but working mod. I decided to make changes from it and add a translation for my language. I copied the mod (I haven't made any changes yet) and published it in the Workshop, trying to start my server with it, but the server won't start. At the same time, the server with the original one starts without problems. What could be the problem?
I changed the ID in my mod. I restarted the game, re-subscribed to the mod, nothing helps

bronze yoke
#

usually this is caused by the mod being private/friends only

#

the server needs to be able to download the mod anonymously so it needs to be public/unlisted

errant stirrup
lethal dawn
#

does anyone here happen to know the color codes for the vanilla hair dyes (green/blue/red etc.)?

#

or where I could find them, that would be good too

mystic lava
#

and it looks like the code for the color is

ColorRed = x,
ColorGreen = y,
ColorBlue = z,

#

example:

item HairDyeBlonde
{
DisplayCategory = Appearance,
Weight = 1,
Type = Drainable,
UseWhileEquipped = FALSE,
UseDelta = 0.5,
DisplayName = Blonde Hair Dye,
Icon = HairDye,
HairDye = TRUE,
ColorRed = 212,
ColorGreen = 171,
ColorBlue = 69,
WorldStaticModel = HairDyeBlond,
}

#

No idea if you can change the saturation or how bright the color will come out though

lethal dawn
#

Oh, tysm! I'm just adding the vanilla colors to the character creation screen, there was a mod I used to use that did this but it was removed a long time ago for whatever reason

bright fog
#

@bronze yoke Sadly I haven't found any line of code that involves zombies and setVariable, so it doesn't seem like the animations of zombies are triggered with lua code :/

late hound
bright fog
#

Noice

bright fog
# late hound I finally got this off the ground: https://steamcommunity.com/sharedfiles/filede...

Hey since you do a lot of things around animations, do you know if it is possible to have different animations for different zombies ? Like a walking animation for one type of zombie and another one for another ? I already have the code that allows to have different zombie types and those spawn with different clothing but I'm trying to know if it's possible to set different animations for them

late hound
bright fog
#

Do you have a file that demonstrates that ? Or would it be possible to explain it to me maybe ?

late hound
#

no

#

but check out the helicopter mod as it had done special-typed zombies like that in the past

bright fog
#

Wait did it ?

#

I don't remember special zombies in it

#

This one ?

late hound
#

In the silly-helicopters branch yes

bright fog
#

The silly helicopters hmm

#

Oh this one ?

#

Alright I'll check it out thx

open drum
#

Could anyone explain me why my code doesn't work???

bright fog
open drum
#
print(getOnlinePlayers():get(0):setZombieKills(1000))```
#

So i did that on my server debug console

bright fog
open drum
#

yea

#

as admin

#

it just doesn't sync

#

when i do getZombieKills() to check

bright fog
#

I don't think you do a getPlayer() in console like that

late hound
open drum
#

it shows up fine on my screen

open drum
#

since getPlayer() is only client player

bright fog
open drum
#

i selected an online target player

bright fog
#

sprint1 is a vanilla walk type if I understood it correctly

#

I don't know much in animations, I'm learning all of that and in code I don't know that much either

#

I'm learning on the spot a lot of stuff

late hound
#

thats how they work, the code may mention a term or tag that exists in the AnimSet xmls

bright fog
#
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="sprintToward.xml">
    <m_Name>sprint1</m_Name>
    <m_AnimName>Zombie_Sprint</m_AnimName>
    <m_Conditions>
        <m_Name>shouldSprint</m_Name>
    </m_Conditions>
    <m_Conditions />
    <m_Conditions>
        <m_Name>zombieWalkType</m_Name>
        <m_Type>STRING</m_Type>
        <m_StringValue>sprint1</m_StringValue>
    </m_Conditions>
    <m_Events>
        <m_EventName>Footstep</m_EventName>
        <m_TimePc>0.15</m_TimePc>
        <m_ParameterValue>sprint</m_ParameterValue>
    </m_Events>
    <m_Events>
        <m_EventName>Footstep</m_EventName>
        <m_TimePc>0.6</m_TimePc>
        <m_ParameterValue>sprint</m_ParameterValue>
    </m_Events>
</animNode>
#

So if I want a custom animation for a specific zombie, in my case a clicker from The Last of Us, I create a clicker.xml
Reuse partially that xml code but modify m_Name and m_Conditions and the walk type to be clicker
Then the zombie I do zombie:setWalkType("clicker")

#

So I guess there are commands like zombie:setWalkType for other type of conditions ? Where could I find all the commands to set conditions ?

#

My god does it feel good to find something, thank you man

#

Tho I still need to try it lol, but at least I have something that's most likely going to work

#

And that's amazing

open drum
#

print(getOnlinePlayers():get(3 --this is me):setZombieKills(1000)) works fine

#

but doing any other players doesn't work

bright fog
#

Maybe bcs you are not the right player for it ?

open drum
#

no no i checked their ID by using

#

getUsername()

bright fog
#

tbf idk how these types of command would react so I sadly won't be able to help you much I think

open drum
#

no problem

bright fog
open drum
#

true

bright fog
#

Maybe idk

#

Could explain why it works on you and no one else

open drum
#

but considering an admin can change a players level and stats.. i thought i would b possible..

bright fog
open drum
#

haha

autumn sierra
#

where can i find the code that dictates zombie clothing spawns? i'm trying to get a new clothing item in the game and i want it to spawn on zombies

fast galleon
#

Hello, is there documentation which players a client is aware of and the area for which this applies? Would they know the online ids, would they have the player objects?

I think I found the answer but if anybody has this written in detail then you can ping me.

gilded hawk
#

Is there a way to get a list of all the containers in a radius?

bright fog
#

let me find it wait

gilded hawk
gilded hawk
#

No freaking way

#

I'm litteraly working on this lol

bright fog
#

rip xd

#

You could do it your own way tbf

#

With different visuals maybe

gilded hawk
#

Oh wait, I think it's a litle different ๐Ÿค”

#

My mod is doing something like sending the item to a container you mark as receiver, rather than having everything in one single container

bright fog
#

Ah yeah right

#

I thought he looked at all the storage around

#

nvm

gilded hawk
#

Well, thank you anyway ๐Ÿ˜„

bright fog
#

np

bright fog
#

What does sendClientCommand do ?

crisp dew
gilded hawk
fleet bridge
crisp dew
#

Ok, just wanted to make sure you were aware of it; far too many times I start working on something only to realize someone already created that functionality.

bright fog
#

sendClientCommand('LeaperZed', 'isLeaper', {isLeaper = true, zed = zed:getOnlineID()})

#

Oh wait I think I got it

#

So he defined a command with in server

Commands.LeaperZed = {};

Commands.LeaperZed.isLeaper = function(player, args)
    local playerId = player:getOnlineID();
    sendServerCommand('LeaperZed', 'isLeaper', {id = playerId, isLeaper =  args.isLeaper, zed =  args.zed})    
end
#

However smthg I don't really understand is that in client, he runs

sendClientCommand('LeaperZed', 'isLeaper', {isLeaper = false, zed = zed:getOnlineID()})

But he's already in client ?

#

Ok nvm I think I got it, gosh this code does things all over the place lol

fleet bridge
#

sendclientcommand(player, module, command, arg)

bronze yoke
#

the name refers to the sender

bright fog
#

Yeah I found that

bronze yoke
#

client commands are sent by the client and received by the server

fleet bridge
#

you dont need to pass the player var down though, so it's usually just sendclientcommand(module,command,arg)

bright fog
#

I kind of guessed I guess yeah, at least I get it

#

In client he has

Commands.LeaperZed.isLeaper = function(args)
    local source = getPlayer();
    local player = getPlayerByOnlineID(args.id)
    local zed = args.zed  
    if source ~= player then
        if zed and args.isLeaper then   
            zed:setVariable('isLeaper', 'true');    
        else
            zed:setVariable('isLeaper', 'false');     
        end  
    end
end

So overall he'll just run this command ?

#

Something I don't understand however is that, in this function before he sets the variable of the zombie isLeaper to true if it's a leaper but he does that before calling the command with:```Lua
zed:setVariable('isLeaper', 'true');
if isClient() then
sendClientCommand('LeaperZed', 'isLeaper', {isLeaper = true, zed = zed:getOnlineID()})
end

#

So what's the use of those command ? I don't really understand

bronze yoke
#

i'm guessing what this mod does is

#

sets leaper to true, sends a client command, server sends a client command to all clients to also set leaper to true for that zombie

#

so that all clients will see the leaper animations and not just the one running that code

bright fog
#

He had to do that because he's put his code in client ?

#

If the code is in shared, would it be even necessary ?

bronze yoke
#

it would be

#

shared doesn't mean the same code executes for everyone, it just means it gets loaded by both the client and the server

#

i'm not sure what the condition for setting this animation variable is but

#

if the trigger might not fire on all clients it is necessary to synchronise it like this

bright fog
#

This is gonna be a pain to test in multiplayer lol

#

This animation thing is going to be a pain to take care of

#

Because there's like 20 xml file I need to modify for my own animation

#

Why do they even make so many files, you can put them together no ?

#

Like two animNode <animNode x_extends="ZedLeaperAttackMiss.xml"> can just be put in the same file ?

#

Isn't that what x_extends do ?

#

Fuse them together ?

#

Also there's two AnimSets: attack and attack-network, the files are identical, what is network for ?

bronze yoke
#

probably remote zombies or something