#mod_development

1 messages · Page 183 of 1

granite ginkgo
#

@mellow frigate Thanks! I have one more question if it's not a problem, I want to check everytime the player tries to get in vehicle for the propane torch,and if he has it then he is able to get in the vehicle,is this a good approach?

mellow frigate
hollow current
#

Small question - Suppose mod 1 has a dependancy on mod 2. In PZ, when you enable mod 1, mod 2 is automatically enabled with it. Is that a result of having mod 2 as a depenendancy of mod 1 on the steam workshop mod settings, or do I have to do something in the code for that to happen?

mellow frigate
#

in mod.info of mod1, you need to set require=mod2id replace mod2id by the id of mod2

hollow current
#

much appreciated, thanks!

sinful scaffold
eternal charm
#

Hello, is there any way to give my game a darker/eerie color filter, just like KI5 does in their screenshots

#

I've tried nvidia's color filters but it doesn't work

#

couldn't find a way to contact ki5 either

sage magnet
#

Hello, I was exploring the "clothing.xml" file and I have questions concerning how it works.

fast summit
#

That’s smart

sage magnet
#

To my understanding "Probability" makes the main item spawns with a probability modifier and if it doesn't spawn it instead uses one of the SubItems(when it exists) and always uses one of them ?
Edit : It's wrong. If someones understand how this works, please ping me.
Edit2 : Solved

fast summit
sage magnet
#

Is there no tool to somewhat automate "items spawning in the world" type files ?

silent night
#

Hi, for a few days now I've been thinking about an idea for a mod that would make me stick with Project Zomboid for longer. I like to keep items in specific clothing, belts, bags, etc. (the ones I wear). During exploration, I would like my character to automatically move items to a container that I have previously defined. For example, collected cigarettes would go to the belt bag, just like matches or a lighter.

For now, I'm browsing the wiki and trying to find suitable events or any hints in the files that would allow me to determine if it is even feasible to do.
Anyone know about changing/prioritizing item transfer?

crystal terrace
#

i'd suggest looking for how game manages to transfer items in the first place, then dig deeper into items if they have certain tags, types or what makes them go into inventory/bag. It's just an idea to go further into.

quiet glacier
eternal charm
#

I swear if that’s what I’m looking for I’ll get on my knees and praise you

#

don't think thats it

eternal charm
#

this is what im talking about

#

u can see how his game has a darker and a yellow filter to it

#

piss filter basically lol (kinda)

quiet glacier
#

Not sure about that, it’s possible he edits the screenshots? I have no idea.

eternal charm
#

damn

#

wish i could contact him somehow

crystal terrace
#

I don't have much experience either, hopefully someone with experience gives you some insights😄

sage magnet
#

Is there a way to spawn zombie using the debug menu ?

crystal terrace
#

right click should give you an option called horde manager submenu of main

sage magnet
#

right click on what ?

crystal terrace
#

anywhere should be fine

sage magnet
#

oh ok I was right clicking on the debug menu

#

thanks

fast summit
#

This might be a stupid question: How tf do I use the wiki XD How tf do I use zomboid-javadoc XD

crystal terrace
#

In simpler worlds java docs gives you name of the functions that you can play with, A lot em are intutive naming wise. Like search for inventory if you wanna do something related to inventory, or say like im currently doing stuff with doors so i search for door related stuff. Ofca lot of experimentation goes to grab the right ones or you can also look at some of the mods and look at their code to see how tehy interact with a particular mechanic.

bronze yoke
worthy sparrow
crystal terrace
#

while interacting with player made double door, it's very inconsistent. Sometimes it would open the door and sometimes there's just thump noise i hear(the one you hear while opening doors). Is this a common problem or just some bug in my code?

crystal terrace
#

seems to be happening with other doors as well

sleek magnet
#

Seems like these do not work when added directly to translation keys for tooltips. Weirdly, it did seem to work when I did it for trait descriptions.

sleek magnet
#

Late response but Oracle has free servers. I use one for my minecraft related testing.

#

They offer full VMs too, and the specs are pretty good.

worthy sparrow
#

Thats why i love modding in typescript, i can almost skip the part of searching through docs.

crystal terrace
#

Interesting, im learning js these days. Might pick up TS i have heard great things about it.

#

getting hold of current player before the game loads throwing a lot fo errors i assume its because it's a null value, is there a way to make sure your files run after the player spawns?

bronze yoke
#

we have this available for lua modding too

worthy sparrow
crystal terrace
#

looking for ideas, i'd like to install something in doors. Is it possible if yes then where should i dig deeper? or just a limitation at game level ? How about adding doors of my own and modify recipe (not sure if that can be done)?

covert carbon
#

I should make a bomb vest that throws 10 pipe bombs around you and insta kills you. Good for multiplayer if you got bit and you want to still be useful.

#

Don't you stressed me

mellow frigate
covert carbon
#

How do playerIndex parameters work? What do I fill that section with?

bronze yoke
#

player:getPlayerNum()

#

the terms 'player index' and 'player num' are mostly interchangeable

covert carbon
#

How would my mod be able to know which specific player it wants to pick? Im still trying to do my russian roulette mod and I want the game to know that I am talking about the person interacting with the gun

bronze yoke
#

is that from the context menu? the context menu events should pass the player index

covert carbon
#

oh alright

#

thank you

vital wave
#

Can someone give me a guide on how to make a mod for turning screws into nails?

vital wave
#

so all it would be would be like

#

recipe Open Box of Nails
{
ScrewsBox,

Result:Nails=20,
Sound:PutItemInBag,
Time:5.0,

}

sleek magnet
#

I think so

vital wave
#

I'm reading through this recipe script guide and I really dont understand it

#

as in the entire thing, like how on earth would I piece it together

sleek magnet
#

I believe the extended stuff is more or less other ways to achieve the same thing.

#

But for a recipe that is just converting an item to another item, that should be enough.

#

Take what I say with a grain of salt tho, I'm big newb

crystal terrace
sleek magnet
#

what are recipe magazines called internally? For context: I'm trying to make the text "unread" the color red to make it pop some when looking at a ton of magazines.

#

I've tried looking up magazine and recipe using the program Search Everything from the Zomboid root folder and magazines only hits gun mags, and recipes is hitting logic for the actual recipes themselves.

vital wave
#

so this would give the option in crafting and when you right click to turn a box of screws into a box of nails?

crystal terrace
#

i believe it should, havent dont anything like this myself. Try it out, put the file in correct folder and avoid using same file names as vanilla.

vital wave
#

so how do I make it so I can do 1 to 1 for screws to nails individually as well

#

I am still quite confused on how this wou ld work

crystal terrace
#

you can just tweak the no of nails for how many you want

#

yo'

#

you're telling game here's a script and here's what it gives as long as its valid, itll work.

crystal terrace
#

you would also need to import Base module because you're using items that are already present in game

vital wave
# crystal terrace here's my recipe for an item that i added to game while i was learning stuff a c...

so it would be this instead

import {Base}

recipe Turn Screws Box Into Nails Box
{
ScrewsBox,

Result:NailsBox=1,
Sound:PutItemInBag,
Time:2.0,

}

recipe Turn Screw Into Nail
{
Screws,

Result:Nails=1,
Sound:PutItemInBag,
Time:2.0,

}

recipe Turn Nails Box Into Screws Box
{
NailsBox,

Result:ScrewsBox=1,
Sound:PutItemInBag,
Time:2.0,

}

recipe Turn Nail Into Screw
{
Nails,

Result:Screws=1,
Sound:PutItemInBag,
Time:2.0,

}

#

The crafting would allow
"Turn 1 Nail Box into 1 Screw Box"
"Turn 1 Nail into 1 Screw"
"Turn 1 Screw Box into 1 Nail Box"
"Turn 1 Screw into 1 Nail"

#

is that right?

crystal terrace
#

make recipe names more descriptive, also it should be import {Base} instead of import Base

vital wave
crystal terrace
#

TNIS->Turn nail into screw

bronze yoke
#

if you go with abbreviations and super short names you have a chance of conflicting with a mod that wouldn't naturally conflict

vital wave
#

like that

#

?

bronze yoke
#

it's also just kind of bad for maintenance, you won't know what TNIS means at a glance in a year

crystal terrace
bronze yoke
#

btw, is that your full file? there isn't a module declared in what you posted

crystal terrace
#

also im not sure but i think you may need to wrap it around in your module name

vital wave
#

I have no idea how to do that

#

also what would I call the file name

crystal terrace
#

whatever is your modID, name your module that

bronze yoke
#

just add to the start
module MyModule { (call the module whatever you want)
and then an extra } at the end of the file

crystal terrace
#

Keep it short and unique, so it doesnt match with other modIDs

bronze yoke
#

yeah, it should preferably be something unique to your mod

#

when two mods name something the same way it causes a conflict

vital wave
#

is this ok?

crystal terrace
#

btw albion, something i wanted to ask. Is it recommended to always use your module name before item name, to get hold of item that exists in your module or when exactly do you need to do that?

vital wave
#

(vice versa)

#

recipe Turn Nail Into Screw
{
Nails,

Result:Screws=1,
Sound:PutItemInBag,
Time:2.0,

also with this, how do I make it 1 nail only and not a stack of it?

crystal terrace
vital wave
vital wave
#

plus idk what modID is

bronze yoke
crystal terrace
#

modID is an ID for your mod, a way for to identify your mod from all the other mods. It shouldnt have space in between and should be unique.

bronze yoke
#

so it's not necessary for your own module unless you have a possible name conflict with a module you've imported

#

if you're using the item name in lua then you should always use the module

crystal terrace
#

ah oki thanks

vital wave
crystal terrace
vital wave
#

is this correct?

#

I used spiderman as base template, just ignore it for now

crystal terrace
#

is there any other way you could show us your structure? bit skeptical of downloading files like that 🙂

vital wave
#

yeah 1 sec

#

@crystal terrace

crystal terrace
# vital wave

module name shouldnt have any spaces in between, it's not description. Make it TSIN and change your id to TSIN as well for now, i dont exaclty know if its a must to name em both same. But it works and seems logical.

bronze yoke
#

they don't have to be named the same, but it can be a good idea since mod ids literally have to be unique

crystal terrace
# vital wave

mod.info shoudlnt have .txt as file format just keep it mod.info

crystal terrace
# vital wave

in my example i used modName as placeholder name, you can name it whatever you want to call your mod maybe Nails to Screws or something would be fine.

vital wave
#

where did I add modName, sorry

crystal terrace
#

one more thing, remember about folder structure. media should have folder scripts which will contain your script file.

vital wave
#

(i updated it)

crystal terrace
#

ye

#

looks alright now

slow graniteBOT
#
Lifecheese#5539 has been warned

Reason: Bad word usage

#
rezayne has been warned

Reason: Bad word usage

pseudo estuary
#

How easy is it to do a animation/dance mod for PZ? Haven’t modded pz much I have made other mods before so I have a decent idea how it works but just wanna ask

cobalt fiber
crystal terrace
#

id like to add an item of my own so i could work on a functionality with doors

cobalt fiber
#

I'm working on the last few days in a mod related to player made double doors, and I can say you can do a lot with doors

cobalt fiber
#

I even made a wooden gate be a container drunk

bronze yoke
#

so you want to make doors do something special when an item is attached?

crystal terrace
#

basically the idea is to add scanner to door

cobalt fiber
crystal terrace
#

an item that would allow so that it opens when a vehicle is about to enter

cobalt fiber
bronze yoke
#

i can't imagine an especially elegant way to do it but it should be possible

cobalt fiber
#

take a look on how the scanner explosives are done

#

and how you can get the door with it

#

maybe is a good way

crystal terrace
#

i can place the module on the ground but i feel like it would look much better if i could add stuff to it so it feels more realistic

bronze yoke
#

the way i'd do it is have the vehicle the player is currently driving look for the doors, instead of having the doors look for the vehicle

#

otherwise your doors will be scanning the world constantly

#

not the most elegant but i can't think of anything better

cobalt fiber
bronze yoke
#

is the scanner visible? you could just make it a moddata boolean on the doors

cobalt fiber
#

then you can put items in it

crystal terrace
#

Here's what i have so far i can open doors atm in all four directions, but i'd like to add three items to game. Scanner would basically stay connected to door, door tags would be in player inventory and im hoping later down teh line to add tiles that can be set nearby doors to act as pressure tiles to toggle doors. Im not sure what you mean by visible, what would moddate boolean on doors do?

crystal terrace
cobalt fiber
#

yes.

crystal terrace
#

that's an interesting idea

cobalt fiber
#

I did it to place a car battery inside

bronze yoke
#

when you attach a scanner it sets a boolean in that door's moddata, that's how you recognise which doors have scanners

#

i'm guessing the door only opens if the player is holding tags? so then if the player has one, scan nearby tiles for a door and if it has the moddata open it

#

by visible i just mean if it should have a sprite or not, i don't know how you would do that part

crystal terrace
#

yes

#

ah visibility is not a priority atm

#

i can always improve on mod down the road for now i wanan set it up as soon as i can.

cobalt fiber
crystal terrace
#

I should prolly work with moddata then

cobalt fiber
#

should work yes, I use modData to store a "code" to a door, and save that to a controller, if the controller have the same code, it can be used to open the gate

crystal terrace
#

also is there a way i can attach say my tag to scanner or even door, like maybe door ID or something a way for game to recognise teh tag belongs to this gate.

cobalt fiber
#

if the gate have no code, it is considered that my automatic motor is not even installed on the door

bronze yoke
#

what peter's talking about would be the best solution to that

cobalt fiber
crystal terrace
#

oki i might be able to do that

#

thanks

bronze yoke
#

ooh, if you do it by position it actually saves a lot of performance

#

you don't have to scan for nearby doors, just check if the square is loaded, and if it is if it's in range

cobalt fiber
#

my mod is "almost" ready for release, I just want everything to be working beautifully before

crystal terrace
#

yes for now iim searching every tile, i was hoping id just search for my scanner module and it would prevent all these unnecessary searches

cobalt fiber
#

If until there you still didn't manage to do it, could be a useful source 😉

crystal terrace
#

peter, have you had any trouble with doors?

#

for instance doors don't always open it's very inconsistent and i just hear the "thumping" sound if that happens.

cobalt fiber
#

well, that didn't happened to me yet

#

the only problem I had was about when opening and closing a gate, the objects change position

#

so something my code got nil because there was no object in the middle

#

I got around it by ALWAYS saving the "corner" piece of the gate (left-most)

crystal terrace
#

i think i experienced that as well

cobalt fiber
#

and if I needed to apply some change to it, I used a specific function to get all the 4 gate objects in a table, and change each one individually

#

Locking for eg. If you lock only one object of a full gate, if a player interacts with another position of the gate, it would open regardless of the lock on the other piece

crystal terrace
#

ah

cobalt fiber
#

gates are complicated 😅

bronze yoke
#

sounds like a nightmare

cobalt fiber
#

yeah, that's why I need a lot of utils functions to get around that many things boris_badger

#

but until now, it's working flawlessly. Just didn't test it on MP yet

#

I'm hoping that there aren't many things that needs to be changed for it to work

crystal terrace
#

im slowly making my way there, once im done with the logic part then ill prolly optimize code and move to visuals and stuff.

cobalt fiber
crystal terrace
#

ty

lilac flower
#

I stored some variables in a dictionary and can access the value with a print statement

print(zombie_random_modifier[stat_name]["Seed4"]["seed_effect"])
>>> -99

However, when I assign the dictionary value to a variable and print it, I get "nil"

local seed_effect = zombie_random_modifier[stat_name]["Seed4"]["seed_effect"]
print(seed_effect)
>>> nil

Am I missing some lua gotcha?

cobalt fiber
#

how are you storing those variables?

#

Lua doesn't have dictionaries, but tables

#

as long as I know at least

bronze yoke
#

tables are the only data structure

#

they are kind of dictionaries

crystal terrace
#

i don't think this calls my function, am i using this correctly? i looked at dhert's previous texts on context menu to make this one

#

i do see the option on door menu tho

cobalt fiber
#

there is no setIsContainer() on IsoDoor, only on IsoThumpable

#

I think that's why

crystal terrace
#

oh right mbstressed

#

as for context menu, the syntax is right tho?

cobalt fiber
#

if the option is show yes it is

#

you just don't need to pass in the door two times

#

you already passed it as the target

crystal terrace
#

oh oki i earlier passed as param but saw dhert mention target so i wasnt too sure, ty

drifting ore
#

where is the best place to commision a mod/ mod patch

crystal terrace
#

not sure what's happening here, it does trigger the function tho. Seems to be throwing this particular error each time i would try to configure door.

cobalt fiber
#

It's not showing any error is in your code?

#

is there any other errors?

crystal terrace
#

in my code? there's only this file active atm and a script to add items which is working fine for now. This error triggers each time i click on cofigure door in context menu.

#

i think i might need to comment out the whole file just incase if it's still messing up with this one.

cobalt fiber
#

hmm, strange, usually the game files only output errors if the file that called it have something wrong

#

can you paste the whole function again?

crystal terrace
#
    door:setIsContainer()
end


local addOptionToDoor = function(player, context, worldobjects, test)
    local door = nil
    for key, value in pairs(worldobjects) do
        if instanceof(value,"IsoThumpable") and value:isDoor() then
            door = value
            break
        end
    end
    -- Add a context cption
    local option = context:addOption(getText("Configure Door"),turnDoorsToContainers,door)
end




Events.OnFillWorldObjectContextMenu.Add(addOptionToDoor)```
cobalt fiber
#

local option = context:addOption(getText("Configure Door"),turnDoorsToContainers,door) here is the problem

#

target which in your case is door, is passed BEFORE the function, not after

#

what is passed after is the param1

crystal terrace
#

oh so i must pass door before the function call

cobalt fiber
#

yes, that is considered the target

#

which is always the first param to be sent in the function you are referencing

crystal terrace
#

wait so can i assume the target will be passed as arg to my function call?

#

ah

cobalt fiber
#

yes, always

crystal terrace
#

also forgot to pass in arg as true for setIsContainer 👀

cobalt fiber
#

uhh yes jaques_beaver

#

that is also a problem drunk

wispy bluff
#

ptsd trait

crystal terrace
#

How can I work with modData on custom items?

neon bronze
#

ModData is essentially just a table that can hold almost anything

#

You can get moddata with item:getModData()

#

And then you can just add a value there

#

So smth like item:getModData().myValue = Value

crystal terrace
#

Do items have this method? Can't find it in docs

bronze yoke
#

inventoryitems should

neon bronze
#

Almost anything has it i think

#

But items surely do

bronze yoke
#

any isoobject inheritor and some other things too

#

generally most things you could ever want moddata on have it

#

a cool shortcut for custom items is any property you add to an item script that isn't recognised by the game will be added as default moddata for that item

crystal terrace
#

Interesting, then I can access that table and add more stuff to it ig.

#

I'll get on started on this one

neon bronze
#

@bronze yoke do you know the limitations for what can be saved in moddata?

bronze yoke
#

any basic type

#

so no objects or functions basically

neon bronze
#

Damn

#

I really wished we could pass functions through

bronze yoke
#

well you can always store the information you need to recreate them if you have to

#

e.g. you can keep all the data of an object's state in the moddata and recreate the object from that state data

#

and for a function you can put its code as a string and loadstring it afterwards

lilac flower
#

is there a limitation to modData()?
I tried using it on zombies but it does not seem to save the data between game sessions (quit/restart)

bronze yoke
#

zombies aren't usually persistent so neither is their moddata (usually)

#

the game tries to save as little information about zombies as possible

#

it does save on zombies flagged as dead players though, they're pretty much fully persistent

lilac flower
#

thanks for the info

bronze yoke
#

it's the same as loadfile but for a string

lilac flower
#

sorry, another question, would keeping a global table of zombie IDs and their stats(speed, strength, etc.) slow the game down?

bronze yoke
#

probably, there are a LOT of zombies

#

dostring/dofile are the same thing but they immediately execute it instead of storing it as a function

crystal terrace
#

if there's no existing modData, will it get nil or just an empty table, im assuming empty table?

bronze yoke
#

empty table

crystal terrace
#

sweet, ty

bronze yoke
#

internally, the moddata table doesn't exist until the first request for it is made, which is when it creates an empty table

crystal terrace
#

ah oki, i just needed to know what case to handle. Altho just leared table[#table+1] is a neat way to append stuff

bronze yoke
#

i wouldn't recommend using mod data as an ordered list, you have no idea what another mod is going to put in there

#

if the ordered list functionality is useful you can make it a table within the main moddata table

worthy sparrow
#

Figured out how to add 3D object into UI 👀

green loom
#

This pretty much explains my question when it comes to coding/fixing a mod, I don't exactly know how to have the items spawn in the bag that's in the inventory, like the starter kit that the game allows you to have

neon bronze
#

Almost the same way as the players inventory

#

So you would get the bag and then call :getInventory() on it

#

And then you can add items to it

green loom
#

Ah, alright, thank you

neon bronze
#

You have to store it in a local var though for easiness

#

Also works only on inventorycontainers so make sure you have one

worthy sparrow
#

how about preventing adding the items indefinitely?

neon bronze
#

What do you mean?

green loom
#

They mean to have it where the items aren't given forever I think

worthy sparrow
#

Like when you load the game again

#

oh wait yeah it can be the same as the starter kit

neon bronze
#

Well you can always set a boolean in players moddata to check for that

worthy sparrow
#

true.

neon bronze
#

Just remember to remove it once the player dies

crystal terrace
balmy swan
#

Is there a specific way to get the damaged bodypart on a weapon hit?
I'm trying to figure out a way to negate damage (bleeding, bullet hit) under specific circumstances, and I imagined the best way would be to find the hurt part and remove said wounds?

crystal terrace
#

Checkout bodyDamage and bodyPart in java docs

fast summit
#

Anyone have any clue why the playerIndex for every player on my server is 0? I assumed it would be different for everyone, so I’ve been using getSpecificPlayer(playerIndex)

frank elbow
ancient grail
#

(The fbx file is made by Sapph)

green loom
slow graniteBOT
#
theamazingmonkee has been warned

Reason: Bad word usage

crystal terrace
#

this works fine as of now but teh problem is it shows the option just if i right click, i was hoping it would only show context menu for door object or IsoThumpable in my case to be exact

neon bronze
#

you could add lua if door then

#

before the option adding

crystal terrace
#

ah that makes sense, ty

#

also is there an efficient way to grab say a vehicle that player is currently in? or do i just search for objects and grab base vehicle type from there?

#

i think this might be it

fast summit
cobalt fiber
#

I thought it created a completly new Player object

crystal terrace
#

trying to interact with vehicle, can't seem to trigger the event.

#

wait

#

its local

worthy sparrow
#

Where can I find the list of events?

worthy sparrow
worthy sparrow
#

couldnt find it for some reason

crystal terrace
neon bronze
#

Yes

worthy sparrow
crystal terrace
#

that will make life much smoother👀

worthy sparrow
#

reloading the lua on F11 sometimes works too

#

except like when you have OnGameStart event, bec well its fired on the game start

crystal terrace
#

i knew about the reloading lua stuff but always did something like add blood to player or anything in-game to tell if an event is fired or a condition is met, but printing in console is much better. I think i saw somewhere that you don't print variables in lua console ?

worthy sparrow
#

No idea, I always store a variable in some local and print that

crystal terrace
#

hmm now it works, its either that i quit and started a new save or changed player var to global

neon bronze
#

You can kinda print variables to console with tostring()

crystal terrace
#

debugger has been a great help tbh, to be able to capture objects and see their properties it all comes together

cobalt fiber
crystal terrace
#

ye youre right i think ill do

worthy sparrow
#

Something like that works too

crystal terrace
#

does .. on both sides have any syntactical significance like instead of treating as plain string i assume?

worthy sparrow
#

It's basically a concatenation

crystal terrace
#

ah

worthy sparrow
#

handy stuff and works with numbers

crystal terrace
#

got it

cobalt fiber
#

But if you use it with a non-string variable, will probably return an error

#

try to use tostring() on things you are not 100% sure that are strings

crystal terrace
#

ye toString() might be better equipped for this

upper junco
#

Does anyone know where the inventory icons are located in the game files? I'm adding a couple different colored vanilla backpacks for more variety but can't find the icons anywhere to change them so I dont get the Blue question mark thing in the inventory.

worthy sparrow
#

Like:?

upper junco
#

yes

worthy sparrow
#

you would need to get tileZed

#

and open .pack UI file

fast summit
#

Anyone know why debug console isn't showing ANY print commands?

worthy sparrow
#

wait actually

neon bronze
#

All the item icons are in the texture folder

#

Or similar to that

#

You dont need tilezed

crystal terrace
#

btw just saw this, didnt know it existed. It's vanilla but in debug mode.

neon bronze
#

They all have Item_ prefix

cobalt fiber
upper junco
#

are they hidden maybe or in a another folder in there that i might be missing?

cobalt fiber
#

only modded ones are in the texture folder

elfin stump
#

When creating an item, what is the function of the "Count" variable?

worthy sparrow
#

I got them all for one of my side projects 😄

cobalt fiber
worthy sparrow
#

the door being open?

crystal terrace
#

yes, new models for cars are being added i think

#

more stuff

worthy sparrow
bronze yoke
#

the moddata does pass to the corpse and then to the zombie, but the player's new character has fresh moddata

bronze yoke
#

they are the future

worthy sparrow
#

Oh yeah, that was it.

crystal terrace
upper junco
#

@worthy sparrow @cobalt fiber @neon bronze Thank you very much for the help. Would have never found that

worthy sparrow
#

No problem 🙂

bronze yoke
#

aiteron mentioned a b42 vehicle rework in here a few months ago

cobalt fiber
bronze yoke
#

never heard anything else about it, but that's likely when we'd see this

#

it's best to think of the moddata as belonging to the character rather than the player

worthy sparrow
#

i see b42 as another game rework like b41 was, but maybe a bit smaller one

bronze yoke
#

to me it's bigger

#

at least, the things they're changing feel more foundational and important to me

#

imagine... skills and traits that make any sense whatsoever

#

a reason to survive more than fifteen minutes

worthy sparrow
#

I mean the crafting tree, NPC, animals, thats just a whole new dimension added to the game, but the game quality jumped when b41 was released

neon bronze
#

I cant hardly wait for the crafting overhaul

crystal terrace
#

It will also set the direction of where the game is being headed in future. Like all the stuff they talked about modern world stuff being irrelevent 5-10 years down teh line. So definitely a turning point.

neon bronze
#

The crafting system could be huge

crystal terrace
#

Same mostly looking for animals and that crafting stuff, makes crafting much more interactive as a process. Plus it looks so cool.

bronze yoke
#

oh don't get me wrong, i played b40, b41 was a huge step up

crystal terrace
#

from what i heard game got more popularity and brought a new wave of crowd after B41

neon bronze
#

I think the 3d models came with b41 right?

worthy sparrow
#

Iwant to see how the game will look when npc are there, I had that thought since like we start the game and immediately there are zombies everywhere, what IF the game starts like a normal sims world and as the time passes you experience people changing, different military ops, the whole TV/Radio knoxevent, riots, crimes etc.

worthy sparrow
bronze yoke
#

b41 multiplayer is when the game became relevant

#

that was a huge boom

crystal terrace
#

about the updates that mess up mods, how do you guys manage it? Is there a way to avoid it while you work on the fix? or do you just try to get the mod up as soon as possible?

worthy sparrow
#

I bet the second option.

crystal terrace
#

What happens if you were to make a kill switch for your mod incase of say a version change? Would it affect the player saves?

bronze yoke
#

that's a per-mod question

crystal terrace
#

the kill switch or the former question?

bronze yoke
#

the kill switch, it might break saves in some cases but usually probably not

#

there isn't really an ideal solution, just... fix the mod as fast as you can

crystal terrace
#

ah you mean other mods being incompatible with yours

trim mist
#

When the new machines come out I think I wanna make a kitchen mod. Like, making a stove a machine, having slots for pans, etc.

#

like pam's harvest craft for MC, kind of

worthy sparrow
trim mist
#

that's exactly my inspiration hahaha

#

I'm a sucker for cooking in games

#

very interested in seeing what the new thursdoid says!

fast summit
#

Is player already a default global variable? Because I keep getting an error saying I'm calling a null variable in kahlua (or something along those lines)

trim mist
#

nooo def not

bronze yoke
#

grab your player with local player = getPlayer()

trim mist
#

you need to get the player either from the functions you're already working with, or there's two options the grab your player

trim mist
bronze yoke
#

every time i explain the whole thing i get 'yeah i don't care about splitscreen' so i'm done doing that drunk

trim mist
#

I was also thinking of getting the playernum since that's global, and using that to get the player

fast summit
#

lmao that's what I was doing when I got the error, that's why I'm so confused XD

faint jewel
trim mist
#

wait--the other way gets messed up with splitscreen?

bronze yoke
bronze yoke
crystal terrace
fast summit
bronze yoke
#

most people just use getPlayer() so i imagine most mods don't work in splitscreen

trim mist
#

oh wow! I had no idea haha

bronze yoke
#

but nobody plays splitscreen so this isn't an issue for them

trim mist
#

because one client is supporting two players, i imagine getplayer() only returns the first one

bronze yoke
#

yeah exactly

#

i write all my mods for splitscreen, but i don't test them in splitscreen drunk

trim mist
#

albion, why not write a compatibility patch? Is that possible?

#

you could hook into that method and return both players. with a comma so if they don't use the second value it won't break things. and other patches

bronze yoke
#

sure but that wouldn't make their mods iterate through it

fast summit
#

basically I was trying to add a custom context menu option when I right-click on another player on a server, so I WAS using player = getPlayer(playerIndex) but found out that wasn't working for a whole other reason. I had also done just player = getPlayer() and that's when I stated getting the new error lmaoo

worthy sparrow
winter coral
#

Anyone know a good guide for making animations ? I know dislaik had one but he deleted it

bronze yoke
#

you can get it on the wayback machine

trim mist
#

hammertime

bronze yoke
#

this is the proper way to get players for splitscreen```lua
for i = 0, getNumActivePlayers()-1 do
local player = getSpecificPlayer(i)
if player then -- there can be gaps so we have to nil check

end

end

faint jewel
fast summit
bronze yoke
#

it works in singleplayer

fast summit
#

well, def not that far indented

worthy sparrow
fast summit
bronze yoke
#

it works in multiplayer too

#

as long as it's not running on the server, since the server has no 'local players'

fast summit
#

ah okay, it just won't work for what I was trying to do ig lmao

#

I'm also still struggling with trying to figure out what arguments to put in my functions XD. Idk why but it's confusing as hell to me.

fast summit
#

OH, I was looking in IsoPlayer, thank you

worthy sparrow
#

Since we are in this topic, IsoGameCharacter to IsoPlayer?

fast summit
#

Is IsoPlayer only for local? and everyone else is considered a GlobalObject?

bronze yoke
#

the global object is just a bunch of functions for lua to call

cobalt fiber
#

I was trying to get a player from a item inside his inventory, maybe this works for SP/MP/SplitScreen?

local player = getSpecificPlayer(playerID)```
worthy sparrow
#

Event OnEquipPrimary has parameters of IsoGameCharacter and Item and how can I get the IsoGameCharacter to be IsoPlayer since I want to use some methods from IsoPlayer

bronze yoke
#

an IsoPlayer is an IsoGameCharacter

#

IsoPlayer inherits from it

#

IsoGameCharacter is an abstract class, you'll never have an instance of it specifically, only something that inherits from it

cobalt fiber
bronze yoke
#

yeah, that's enough

worthy sparrow
#

Well that was my thought, but it just throws an error when i try to do simple getFullName, maybe It's nil when the event fires

#

i have to double check it

bronze yoke
#

getSpecificPlayer doesn't use OnlineIDs, it uses the id from getPlayerNum()

#

which is essentially OnlineID % 4

cobalt fiber
#

cool! I tought that maybe IsoGameCharacter was not going to be a IsoPlayer

cobalt fiber
#

maybe thats why, because the onlineID was 0

bronze yoke
worthy sparrow
#

I know, I had a typo.

#

god dammit

worthy sparrow
fast summit
#
    local currentHealth = player:getHealth()
    local healthToAdd = maxHealth * (healthPercentageToAdd / 100)
    local newHealth = currentHealth + healthToAdd
    if newHealth > maxHealth then
        newHealth = maxHealth
    end```

This looks correct, yes?
#

aside from the incorrect indent because discord hates me

worthy sparrow
#

isnt the max health a static value? so instead of doing that calculation you could find out whats the value of max health and just add the remaining

#

by static I mean everyone has that x max health

fast summit
#

I thought you could change max health in sandbox settings

#

Now I have to go look XD

worthy sparrow
#

ah then nvm

bronze yoke
#

generally health methods from the player object don't tend to work

#

usually you need to getBodyDamage and work from there

#

i think the ones from the character object are either deprecated or just used for zombies or something

fast summit
#

ugh okay lmao

#

tbf, I've not even gotten far enough to test that because my custom context menu options weren't coming up XD

worthy sparrow
#

Is there a list of string params a javaObject:fromLua0/fromLua1/fromLua2 (...) method accepts?

crystal terrace
#

if an item is inside a crate, can i call it to create context menu for that item?

worthy sparrow
#

I think you have to do OnFillInventoryObjectContextMenu, then look for that item and add the context menu option

#

but I guess best option is to find out yourself :p

crystal terrace
#

alr ill give that one a try as well

fast summit
worthy sparrow
#

It's in client side, and I think if you click on a player the playerindex parameters is set to that player

#

actually i can test this quickly

fast summit
#

Essentially, I'm trying to make it so I can right-click on another player and have the option to either "Perform blood draw" or "Perform transfusion" based on what's in my inv

#

Or is this something that needs to be a timed action?

worthy sparrow
#

okay so, i tested this and I THINK you have to use the table worldobjects to find a player

novel ingot
#

Is removing the limit on the amount of smoke particles possible? Video contains example of slightly modified smoke with the SmokeRange = 10 instead of 5, but it seems there is a limit on the amount of smoke particles, wondering if that can be removed in some way? Been told in pz-techsupport it's java classes, was wondering if that's true

worthy sparrow
#

when im click on the ground its 0, on myself its 0

fast summit
worthy sparrow
#

Well thats how it is :p

fast summit
#

Any clue where to find the tables just for me to reference

#

Unless I can hook it into newHealthPanel or whatever lmao. Idk, we will see

worthy sparrow
#

Never worked with table, I have no idea

fast summit
#

I've got big aspirations for being brand new to modding XD

worthy sparrow
#

I guess its just a table with IsoObject

#

your best way to testing is to iterate over that table and do like getName() or getObjectName() or whatever and just look for the stuff you need 😄

worthy sparrow
#

damn didn't noticed lol

fast summit
worthy sparrow
#

everything is off in the docs

fast galleon
#

just making sure you don't have a weird bookmark

worthy sparrow
#

atleast they are the same thing lmao

fast summit
#

lol, thank you! I'm actually looking in the actual game files now XD

worthy sparrow
#

wait

#

omg

#

Why don't you look at other mod how to do that stuff?

#

Thats just time saving af

fast summit
#

LMAO I WAS GONNA DO THAT BUT I HAVE ADHD

worthy sparrow
#

The simplest answer that i haven't thought of

fast summit
#

XD

#

I was actually going to look into integrating it with a radial menu mod XD

worthy sparrow
#

smart

#

i might do the same.

bronze yoke
worthy sparrow
bronze yoke
#

ohh you're right

fast galleon
bronze yoke
#

you can find it in the kahlua source code probably

fast summit
worthy sparrow
fast galleon
bronze yoke
fast galleon
#

you may want to use Intellij version from 2022

fast summit
#

Don't bother with jd-gui, it wouldn't open any files for me

worthy sparrow
#

Ugh installing whole IDE and everything just for that

upper junco
#

Another question. So I'm able to get the texture in game spawning randomly with the others. I've added the new item icon texture to the texture folder and using item tweaker to try and add it to the list, but its not working for me. So how does the game know what icon to use with what texture if there are multiple options for the same item?

eternal charm
#

where would i find a decent guide about modding? mainly weapons and cars, i used to mod gmod and other source games so im not a complete noob in modding

fast galleon
# eternal charm where would i find a decent guide about modding? mainly weapons and cars, i used...
The Indie Stone Forums
  1. The first thing you want to do, as with most mods is to create your mods folder structure, use the image below as a reference, replacing MOD_NAME with the name of your mod: Spoiler mods MOD_NAME mod.info MOD_NAME.png media lua client MOD_NAME.lua models Vehicles_MOD_NAME.txt scripts vehicles M...
eternal charm
#

thank you

fast summit
fast galleon
uneven mauve
#

Hello, looking into the game files in maps, I can see the .lotheader files only for Muldraugh, where could I find the files for the other locations?

bronze yoke
#

muldraugh contains the entire map, the others just add spawn points

fast summit
#

So, I'm looking at other mods that do similar stuff to what I'm trying to do, but I see this ```require 'TimedActions/ISBaseTimedAction'

DonateBloodAction = {}
DonateBloodAction = ISBaseTimedAction:derive('DonateBloodAction');```

But I don't understand what the "{}" is all about. This calls a table, correct?

bronze yoke
#

it creates a table, yeah

#

in this case it's redundant

#

derive creates a table anyway

fast summit
#

okay.

#

I'm assuming they probably copy/pasted one of the default timed actions and then customized it

bronze yoke
#

probably

fast summit
#

that may be what I end up doing because I am STRUGGLING to the point where I almost wanna give up XD

It would be different if there were tons of resources that give decent descriptions about what each func/var/param does XD

fast summit
#

Thank you, I will look into it!

crystal terrace
#

Here scanner is just a custom item, i converted the Double Door into a container. I wanted to grab GridSquare of scanner item, so that i can somehow iterate over its objects to get hold of IsoThumpable object is what double door fits into. But after so many edits and squeezing ifs in there door is still nil. Any ideas what could be wrong here? Im able to get the gridSquare where the door is btw.

fast galleon
crystal terrace
#

thanks

fast galleon
#

Also sometimes doors will be IsoObject, you can use f2, select square and check all objects on that square in debug.

crystal terrace
#

ah got it, thanks i was able to grab the Gate object, it clearly says it's gonna return an ArrayList and idk for some reasons i thought lua is somehow acting as some sort of mediator but now i think i understand if i see a java object in there im free to call Java methods but keeping the lua syntax in mind

bronze yoke
#

good lua implementations do that, but unfortunately we're using kahlua drunk

fast summit
crystal terrace
sleek magnet
crystal terrace
bronze yoke
#

it's a table, you use getModData to get the table and then change the values in the table

crystal terrace
#

wow, ty. Without this channel i doubt my interest for making mods would survive past couple of daysded

pulsar rock
#

Hey y'all, anyone got a guide or example repo for custom menus?

#

Additionally, can you add right click menus on any object / entity / etc..? If so, anyone got a reference for that?

bronze yoke
#

you use the OnFillWorldObjectContextMenu event

#

it passes the list of objects on the square the player right clicked on, you loop through that list and if it has objects your mod is interested in you add your options to the context menu it passes

pulsar rock
bronze yoke
#

not sure, honestly the object list it gives is really unreliable and you should probably just use it to get the square and then loop through its objects list

#

one of my mods had a bug because an object only appeared in the object list in debug mode, for no apparent reason

#

if you work from the square it can include anything you want

sleek magnet
#

thank you again tho

pulsar rock
#

Just out of curiosity, is there an event specifically for right clicking on players or zombies, rather than the square?

bronze yoke
#

no

pulsar rock
#

Hm

crystal terrace
#

im a bit confused with regards to Tables, say my item has a field in script which is not definied in-game so it would result into converting it into modData so when i do something like item:getModData().fieldNameInScript=value am i replacing the table with this data? what if i wanted to append values should i use next or maybe #table?

bronze yoke
#

when you do t.key = value you replace the value in the table t stored under that key with the new value

crystal terrace
#

oki that makes sense, but here my table is supposed to be called doorTagconfig in script and if im doiing .doorTagconfig that would be something like doorTagconfig.doorTagconfig right?

bronze yoke
#

you can't create tables from the script, only numbers and strings i think

crystal terrace
#

oh so its essentially just creating a new table for my data and appending this info to a field called doorTagconfig

bronze yoke
#

but to explain the script thing, if you added MyCustomValue = 5, to your script, you'd get 5 from print(item:getModData().MyCustomValue)

crystal terrace
#

that would mean that it creates a table automatically then? jsut appends the value as a key to it

#

or i should rather say insert

bronze yoke
#

yeah, getModData always returns a table

#

it doesn't have to be initialised

radiant flame
#

QQ - Why won't my sandbox tooltips & renames show up? I see my options in there. They seem to be working properly FUNCTIONALLY but my Sandbox_EN.txt file does not seem to be taking. I've tried about 30 billions different ways to rename it. Plz help 🙂

Sandbox_EN = {
    Sandbox_pointblankhf = "Point Blank",

    Sandbox_pointblankhf_PointBlankEffectiveRange = "Point Blank Effective Range",
    Sandbox_pointblankhf_PointBlankEffectiveRange_toolip = "Zombies shot upon below this range will be affected by point blank damage",
    
    Sandbox_pointblankhf_PointBlankInstantKill = "Point Blank - Instant Kill",
    Sandbox_pointblankhf_PointBlankInstantKill_toolip = "If true, when shooting a zombie within point blank range, they die instantly. \n If this is FALSE, the values below help determine bonus damage",
    
    Sandbox_pointblankhf_PointBlankMinimumBonusDamage = "Point Blank Minimum Bonus Damage",
    Sandbox_pointblankhf_PointBlankMinimumBonusDamage_toolip = "ONLY USED WHEN InstantKill is DISABLED. \n This is the minimum amount bonus damage that is applied. IE, if your damage is .0001, it would up the bonus damage to .2\n Bonus Damage Multiplier \n This does not affect base damage value, ONLY bonus damage. See equation below: \n\n TotalDamage = BaseDamage + PointBlankDamage\n PointBlankDamage = (Max(BaseDamage,PointBlankMinimumBonusDamage) * PointBlankBonusDamageMultiplier ) \n",
    
    Sandbox_pointblankhf_PointBlankBonusDamageMultiplier = "Point Blank Bonus Damage Multiplier",
    Sandbox_pointblankhf_PointBlankBonusDamageMultiplier_toolip = "ONLY USED WHEN InstantKill is DISABLED. \n Bonus Damage Multiplier \n This does not affect base damage value, ONLY bonus damage. See equation below: \n\n TotalDamage = BaseDamage + PointBlankDamage\n PointBlankDamage = (Max(BaseDamage,PointBlankMinimumBonusDamage) * PointBlankBonusDamageMultiplier ) \n"
}
crystal terrace
#

also is there an efficient way to tell if its empty? i had to put in a key isEmpty specially to verify if its empty or not. nil doesnt really work i think since its not initialised

radiant flame
#

not == nil should work? ie:

        if not variableNameHere == nil then
crystal terrace
#

works with tables?

bronze yoke
#

kahlua adds table.isempty(t)

#

no idea of the performance, table lib is usually pretty slow

crystal terrace
#

that looks better, i thinkk ill use that instead.

bronze yoke
#

the non-kahlua way you'd do it is if next(t) == nil but next isn't available in kahlua

crystal terrace
#

i think i tried this one for whatever reason it didnt work for me, it does work in an online lua interpreter i tried but not in the code. Or maybe i had a bug somewhere but replacing it with just a key isEmpty made progress. Ill try out the one you mentioned.

dark wedge
bronze yoke
#

btw, you've also typo'd 'tooltip' as 'toolip' each time

bronze yoke
#

not really sure what the reasoning for that is

#

that's probably why it also adds isempty

radiant flame
upper junco
#

Anyone know how this line works? IconsForTexture =
I'm trying add in some icons to go with the new textures I have added but it doesn't recognize the new one in game. I just get the blue ? in the inv.
IconsForTexture = BigHiking_Blue;BigHiking_Green;BigHiking_Red;Item_BigHikingBlack,

crystal terrace
#

i think all icons file should have a prefix item_ no? and to be called without one

upper junco
#

so remove the Item_ from Item_BigHikingBlack?

crystal terrace
#

it's just what ik from when i added custom items to game, not really sure where this field IconsForTexture comes from, have you tried looking at vanilla files?

upper junco
#

Thats from the vanilla files I added a texturechoice to the items .xml files that is working and showing up in game. But I cannot figure out how to get the icon to show up from the new texture

crystal terrace
#

okay so you're using icons from vanilla files?

upper junco
#

The first 3 are vanilla, the last is one I recolored to match the new bag color

#

item Bag_BigHikingBag
{
DisplayCategory = Bag,
WeightReduction = 80,
Weight = 1.5,
Type = Container,
Capacity = 22,
DisplayName = Big Hiking Bag,
IconsForTexture = BigHiking_Blue;BigHiking_Green;BigHiking_Red;Item_BigHikingBlack,
CanBeEquipped = Back,
OpenSound = OpenBag,
CloseSound = CloseBag,
PutInSound = PutItemInBag,
ClothingItem = Bag_BigHikingBag,
BloodLocation = Bag,
RunSpeedModifier = 0.95,
AttachmentReplacement = Bag,
ReplaceInSecondHand = Bag_BigHikingBag_LHand holdingbagleft,
ReplaceInPrimaryHand = Bag_BigHikingBag_RHand holdingbagright,
WorldStaticModel = BigHikingBag_Ground,
SoundParameter = EquippedBaggageContainer HikingBag,
}
}

radiant flame
#

@upper junco you update both places?

crystal terrace
#

remove the Item_ from call

#

and if you saved the icon somewhere in your folders, rename it to item_NameGoesHere

bronze yoke
#

if you include Item_ in the script, it's going to look for Item_Item_YourNameHere, since it adds that part automatically

upper junco
#

ok will try that, thanks. Will let you know in afew min if it works

haughty bridge
#
local zombie = zomtom.create('zombie', '1', '1', '1', 'NameBehaviortypehere'); zombie.manual = false; zombie:setHealth(100); zombie:setSpeed(0.8)
-- add zombie:set traits as needed :)

almost done with my library mod for making custom zombies

#

I am trying to make a way to easily add new zombies

#

this is a shortened variant of the code for people who just want to easily add a zombie

upper junco
#

@crystal terrace @radiant flame Thank you very much, finally works. Now can add more colors for some variety

trim mist
#

this is kind of frustrating

#

I'm using this function to determine if a player can knockdown another player and it's saying my inputs are invalid

#
  elseif instanceof(collidee, "IsoPlayer")
  then
      if SwipeStatePlayer:checkPVP(collider, collidee) or collidee:isZombie()<-----------------------------------
      then
          collidee:setBumpType("stagger");
          collidee:setVariable("BumpDone", true);
          collidee:setVariable("BumpFall", true);
          collidee:setVariable("BumpFallType", "pushedbehind");
          --collidee:setBumpStaggered(true);
          --collidee:setKnockedDown(true);
          collider:getStats():setEndurance(collider:getStats():getEndurance() - knockdownEndCost);
          collider:setBumpType("");
          collider:setBumpStaggered(false);
          collider:setBumpFall(false);
      end
  end

The arrowed line is the problem line

lunar hawk
#

im making a mod for pz but i need textures anyone know how to make them?

trim mist
#

both collider and collidee are players, and aren't null

#

which... should be able to be taken in as the respective IsoGameCharacter and IsoMovingObject, yeah? Cause the inheritance tree goes object -> movingObject -> GameCharacter -> Player

#

even if it didn't work that way, i have no idea how i'd access the parent versions of these

crystal terrace
lunar hawk
crystal terrace
#

what sorta item ?

bronze yoke
lunar hawk
slender oar
#

must the folder under /mods/ always match the Mod ID?

lunar hawk
bronze yoke
#

by calling SwipeStatePlayer:checkPVP(collider, collidee), self is the lua table that holds the static SwipeStatePlayer functions, not a SwipeStatePlayer object

crystal terrace
#

is there any in-game reference to look at like a category of item yours fit with? checkout their textures and try to keep the same size.You can use GIMP for making textures, there's also a pinned text in #modeling about sizes and stuff for textures refer to that as well

lunar hawk
trim mist
crystal terrace
#

that's what tools are for in GIMP

bronze yoke
#

are you using umbrella? looks like an error in the method annotations

crystal terrace
crystal terrace
lunar hawk
bronze yoke
#

but yeah, just call with . instead of : and it should work

trim mist
trim mist
bronze yoke
#

where'd you get the method annotations then?

trim mist
#

lmao

bronze yoke
#

the one you screenshotted

#

if it's capsid, yeah that's just one of the many things it gets wrong

crystal terrace
# crystal terrace let me pull up an example of what i did

i didnt understand too much about UV mapping but iknew i had to keep the sections as vanilla textures have so i just used the vanilla texture aas base and tweaked the color and logo. Plus once its in-game it's so small you could barely tell if its poorly designed.

trim mist
bronze yoke
#

yeah, capsid's being so crappy are the main reason umbrella got made

#

although tbh i think capsid's lua annotations work better

#

the java ones are much better in umbrella but the lua ones always send me to the stubs when i try to jump to the source of a function

#

capsid annotating the game's actual lua instead of creating stubs worked better because of that

crystal terrace
#

this is valid right? like im trying to make context menu options for two diff items

trim mist
#

Thank you albion!!!

#

new problem. I have zero experience with sending events / packets, and I'm assuming that's the issue here

bronze yoke
trim mist
trim mist
bronze yoke
#

hmm, sounds like you do need some communication then

crystal terrace
#

i was thinking if i could that, also for some reasons if i were to right click on scanner item it triggers a function inside of doortag context stuff. Weird stuff.

#

and it doesnt happen the other way around, anyway ill try with one function maybe that's whats up

trim mist
bronze yoke
#

unfortunately i think the most well known guide on it was written by dislaik 💀

trim mist
#

fuck

bronze yoke
#

as a basic rundown, sendClientCommand(optional IsoPlayer player, string module, string command, table args) fires the OnClientCommand(player, module, command, args) event on the server (commands are named after the sender)

#

if the player isn't specified it assumes the local player 0, in most cases it doesn't need to be specified

#

then sendServerCommand(optional IsoPlayer player, string module, string command, table args) fires the OnServerCommand(module, command, args) event on the client (notice one less argument is provided to this one)

#

if the player isn't specified it sends it to all clients

#

the module and command strings are technically arbitrary and can be anything, it's up to your code to use them to identify commands, but typically module is the name of your mod and command is the actual identifier for which command is being sent

#

in your OnXCommand handlers you'd check the module and return if it isn't yours, then execute code based on what the command is

trim mist
#

gotcha. So I could get away with doing a sendServerCommand(collidee, "AnthroTraits", "knockdown", {args here}) for both zombies and players that are knocked down. And I could look for an event in your documentation that does said command and check inside the event to make sure the module is "AnthroTraits" and the command is "knockdown".

bronze yoke
#

here's an example```lua
-- on the client
sendClientCommand("MyMod", "Print", {text = foo})

-- on the server
local OnClientCommand = function(module, command, player, args)
if module ~= "MyMod" then return end
if command == "Print" then
print(args.text)
end
end

Events.OnClientCommand.Add(OnServerCommand)

#

(if you don't notice, edited to correct arguments being in the wrong order - because why would it make sense)

#

a common practice is to store command functions in a table, where the keys are the command string, and then just do commands[command](args) after the module check

cobalt fiber
#

But oh my, this is big

#

I'm definitely going to note this down

#

Will be very useful

#

Even though it wasn't me that asked for help, thanks for explaining it all spiffo

trim mist
#

Same. Thanks Albion

bronze yoke
#

in a bit i'll look around the usual spots and if i can't see a good guide for this i'll write one up

trim mist
#
 elseif instanceof(collidee, "IsoPlayer")
            then
                if SwipeStatePlayer.checkPVP(collider, collidee) or collidee:isZombie()
                then
                    collidee:setBumpType("stagger");
                    collidee:setVariable("BumpDone", true);
                    collidee:setVariable("BumpFall", true);
                    collidee:setVariable("BumpFallType", "pushedbehind");
                    if isServer()
                    then
                        sendServerCommand("AnthroTraits", "knockdown", {collidee})
                    end
                    --collidee:setBumpStaggered(true);
                    --collidee:setKnockedDown(true);
                    collider:setBumpType("");
                    collider:setBumpStaggered(false);
                    collider:setBumpFall(false);
                end
...
AnthroTraitsMain.ATOnServerCommand = function(module, command, args)
    if module == "AnthroTraits"
    then
        if command == "knockdown"
        then
            args.collidee:setBumpType("stagger");
            args.collidee:setVariable("BumpDone", true);
            args.collidee:setVariable("BumpFall", true);
            args.collidee:setVariable("BumpFallType", "pushedbehind");
        end
    end
end

Am i picking up what you put down correctly or is there a grave misunderstanding here? Would I be sending a client command...?

#

@bronze yoke

bronze yoke
#

unfortuantely your situation calls for client to client communication, which is annoying

#

you basically need to ping the command off the server

#

you have an OnClientCommand handler on the server that sends a server command to a client specified in the args

#

you can't pass an IsoPlayer directly so you'll need to send their onlineid as an arg and then retrieve the IsoPlayer from that

trim mist
#

okay, lemme think on this

#

I'm guessing OnServerCommand would be appropriate for Zombies that are knocked over though?

#

or do I have to sync that between clients in the same way?

bronze yoke
#

have you tested if that needs to be manually synchronised? my assumption is that it wouldn't need to be

#

since zombies aren't generally controlled by the server anyway

trim mist
bronze yoke
#

was the zombie chasing them? pz's netcode gives ownership over a zombie to clients, usually the one they're chasing (so that ping is never a factor in you getting hurt)

#

maybe it'll synchronise if the knock down comes from the owner... or maybe not

trim mist
#

oigh. This is more complicated than I thought it was gonna be

crystal terrace
#

im interacting with a diff item to open context menu but the debugger stops at this snippet of code from different context menu altho its not even targeted .

#

code for both the item's context menu are called by one function which is triggered by OnFillInventoryObjectContextMenu event

crystal terrace
#

Pretty much every inv item triggers this error

dark wedge
#

My current thought is to build a cache by the zombie's ID based on your current cell periodically, but it doesn't seem to catch all of the zombies when doing this.

dark wedge
crystal terrace
#

oh, i threw in a check before the arraylist traversal. Now it stops on declaration of containerItem. ill see if there's any other errors or maybe restart or something. Ty

cobalt fiber
crystal terrace
#

just fixed it

cobalt fiber
#

oh if you solved it we're fine

#

😉

crystal terrace
#

Just working with one item behind the scenes takes a lot of time

#

ill prolly need to do a lot of optimization once it becomes functional as a whole concept

trim mist
#

Thoughts on using
"reportEvent("wasHit")" or "wasBumped" instead of trying to sync states?

#

This seems to be what MoreTraits does with their similar trait, BatteringRam

bronze yoke
#

server commands can only be sent by the server, client commands can only be sent by the client

#

if you want a client to send commands to other clients, which is your case, you need to use a client command that makes the server send a server command

trim mist
#

oh, yeah, sorry lol

#

I had updated that already after rereading what you sent and thinking on it more

#

i've gotta say I'm just... so burnt out right now.

bronze yoke
#

this is a frustrating issue

#

i hope the report event thing works, as manually synchronising it like this is ugly

#

and as dhert pointed out you can't even easily communicate which zombie is being affected this way

trim mist
#

yeah it's been like this for a couple weeks now lol

#

at least i'm reaching out much less here cause i know a lot more about research and what I'm doing

#

Come thursday if i'm still not done with this I might pay someone to try to help me out lmao

dark wedge
#

I've been trying target:reportEvent("wasHit") for a bit now, and it hasn't worked. 😦 where "target" is for sure an IsoZombie

trim mist
#

there's also "wasBumped" and "wasHitPvp" and "wasHitPvpAgain" lmao

dark wedge
#

it might work for the "bumps", but its not working for me when i process a hit over MP. been scratching my head on this one for a while.... lol

#

each of those attacks definitely hit and caused the zombie to wince on the attacker's side no problem. but other players don't see that

crystal terrace
#

A question about ItemContainer that we get from getInventory(), it has a bunch of method to verify if the container has a certain item which are expecting item name as string. Should i use item name as module.itemName?

dark wedge
crystal terrace
#

even if its your custom item?

dark wedge
crystal terrace
#

ah oki

#

i should prolly get some sleep, can't even name the items properlystressed

cobalt fiber
#

Can I pass a InventoryItem in the args of a sendClientCommand?

fast galleon
#

If you need the object, it's best to find the ItemContainer and get the object there by using getItemWithID or getItemByID.

bronze yoke
#

sending items should be used when you need the properties of the item but not the item itself

cobalt fiber
#

Okay, thanks for clarifying it! @bronze yoke @fast galleon

sonic needle
#

@turbid gale did you see the comment on the anims of your mod?

crystal terrace
#

Been using this event for a while, a few hours later it won't trigger. Any ideas what might be wrong? I have reloaded saves a couple of times and files in teh correct location as well.

turbid gale
fast galleon
crystal terrace
#

are you suggesting that i write this code in server and trigger an event from client which will trigger another event on server side?

fast galleon
#

Only if you want it to be MP compatible and it's something that needs to be done on server.

If the first print doesn't happen then you do something wrong, like maybe try to do this on server.

crystal terrace
#

i think this is what you mean by that

#

OnXCommand handles, about this one not too sure how work with.

#

i was hoping not to complicate things right away, but you're right i should prolly keep it MP compatible.

fast galleon
#

speaking of print and server, when you host, the prints are found coop-console.txt

crystal terrace
#

#modeling this one might be more helpful wrt to models and stuff

crystal terrace
#

it's a snippet from vanilla client/ServerCommands, say if i were to trigger something on server side do i need this event or i just add my commands to my table Commmands. I have added event on server side OnClientCommand

uneven mauve
#

Hello, is the full map size x,y (19500,15600) or (19800,15900)? I am looking at what's supposed to a be vanilla map with WorldEd and it has the later max sizes, but it would not make sense if a cell is 300x300

sleek forum
#

1 cell is 300x300

#

1 cell has 30x30 blocks

#

each block has 10x10 squares

#

and each square can have multiple tiles (textures)

crystal terrace
#

how many cells teh whole map has?

uneven mauve
#

65,52

sleek forum
#

no

#

muldraugh, KY has 2841 cells

sage eagle
#

Wow

#

Das a lotta cells

uneven mauve
#

Oh ok sorry, I was taking after worldEd

sleek forum
#

it is yes 🙂

#

that is the cell number @uneven mauve

uneven mauve
#

Oh yeah misunderstood lol

sleek forum
#

it's files should be 65_52.lotheader chunkdata_65_52.bin world_65_52.lotpack

#

/projectzomboid/media/maps/Muldraugh, KY

#

you can get a good idea how they are set up by opening projectzomboid/media/maps/challengemaps/Studio

#

that one only has 2 cells

#

these are it's bounds: 300 300 900 600

#

as you can see Studio only has these cell files:
chunkdata_1_1.bin chunkdata_2_1.bin

#

you can also see that it relates to it's bounds as a cell is 300 by 300

#

1_1 = 300,300
2_1 = 900,600 (if im not mixing them up)

hollow current
#

Any idea which part/event of the vanilla code handles the player damage upon vehicle crash?

sleek forum
#

those are it's starting coordinates

uneven mauve
sleek forum
#

@hollow current might wanna check BaseVehicle.java im zombie.vehicles namespace

warped condor
crystal terrace
#

i just wanted to get a top level idea of what's going with these command exchanges b/w server and client

warped condor
#

You can have a single function to handle all your commands

crystal terrace
#

and the handler would grab the command table on either side and start executing those commands?

warped condor
#

So you need two functions each side and then you can send functions in commands in your code.

#

it is better instead of making a lot of checks for x command in a function.

crystal terrace
#

these two functions would be stored inside variables which will be sent along from server to client and vice-versa?

warped condor
#

Nah, they are global functions and then you send your functions in variables to them.

crystal terrace
#

would you call these global funtions handlers then? the one executing these commands on each side?

warped condor
#

Yes

crystal terrace
#

and id need an event to fire these handlers right?

warped condor
#

Yes

crystal terrace
#

so roughly that's all there is, thanks. Ill try out and experiment see what moves what.

warped condor
#

I think there is a good reference in server/ClientCommands.lua

#

but idk, I don't remember

vital wave
# crystal terrace this one

the mod isnt appearing in the game. I have added it to user > Zomboid > mods and it isnt appearing in the mod s area.

Also, it doesnt load in the game either as the screws / nails dont covert to each other (no option to do it)

#

can anyone help please? I dont know how to fix it

cobalt fiber
#

Maybe there's something wrong with the structure inside the folder

vital wave
#

(spiderman is placeholder)

cobalt fiber
#

Yeah that's right, I mean inside your folder

#

I think there's something wrong in the folder order

vital wave
#

wdym

cobalt fiber
#

Mods/TurnScrewsIntoNails Mod/mods/Nails to Screws

#

I think there's a "mods" folder in the middle there

vital wave
#

nope

cobalt fiber
#

Nop, I'm wrong

#

Theres actually more folder than needed

#

All these files need to be in the "TurnsScrewsIntoNails Mod" folder

#

Not in the Nails To Screws

vital wave
#

ok lemme retry again

tacit plover
cobalt fiber
#

The media folder, mod.info and posters needs to be in mods/YourModName

vital wave
#

does the scripts stay as .txt?

cobalt fiber
vital wave
#

ok

warped condor
#

You have mod in amod

cobalt fiber
#

If the mod.info is correct, it should show up

warped condor
#

try taking all of the stuff inside turnscrewsintonails

#

and get rid of the second folder

vital wave
#

i did

#

thats the updated one

warped condor
vital wave
#

thats good signs now

#

its appeared in the game

#

now ima test if the mod conversion works

summer plinth
#

Funnily enough

#

I just came on here with the same problem

#

Will see if I'm doing anything wrong too

warped condor
#

so the mod structure in mods folder should always be
..mods\YourMod/media/stuff
for workshop it is
..Workshop\YourModCollection/Contents/mods/YourMods_CanHaveMultiple/media/stuff

usually if your mod is not loading/appearing in game, you messed something with that or mod.info file.

That's why when you install for example 10 years later MOD, you have 6 version of it, because it is collection of mods.

crystal terrace
#

sometimes it also appears at the bottom of the mod list i think

summer plinth
#

What I and dome wrong, was that I put my mod 1st of all I to my downloads folder (I forgor) and then I to the actual zomboid folder rather than the user q

crystal terrace
#

Should prolly pin these folders, makes life much easier

warped condor
#

also mod.info gonna change in b42, adding some more features prob

warped condor
crystal terrace
#

with modlist text?

warped condor
#

Nah I mean for mod structures to just make new people lifes better

worthy sparrow
#

I think i saw a mod template somewhere on github

crystal terrace
#

ah i also have a guide up on steam

#

but you could add stuff to wiki if it doesnt exist, having everything centralised could be of great help

#

the more resources the better

warped condor
#

There is an example mod in the game files, but yeah better to have one in open.

crystal terrace
#

actually with github itll be much smoother just pull the repo and you're ready

#

You should totally do that

worthy sparrow
crystal terrace
#

wait are we talking about pz wiki?

worthy sparrow
#

something like https://tarkov.dev/

#

pz wiki is good for reference but its off in many topics

warped condor
#

Someone have a good github on event descriptions acutally, but having everything* in one place would be good.

summer plinth
#

guys i got the mod working, but for some reason the gun model aint showing up in my hands

crystal terrace
#

ye true a lot of work needs to be updated

crystal terrace
worthy sparrow
summer plinth
#

one of my own

crystal terrace
#

from what ik ground models and static models are different(static being you use in your hands)

#

vanilla has seperate files for that, im not too sure how they handle that. Might wanna head to #modeling to learn more of that stuff.

worthy sparrow
#

also there is no explaination on fromLua method, no docs about it, nothing afaik.

worthy sparrow
#

I decompiled the java files and well, there is something but needs documentation and testing

vital wave
#

Can someone what has gone wrong in my mod? I have it active but its not working at all.

#

Theres no GUI for turning it into nails

#

@warped condor sorry for ping, u seem to know what ur doing with mods

#

its because the mod keeps auto-disabling itself

warped condor
#

You forgot a bracket

#

after import base

#

import*

vital wave
#

where in, sorry

#

what do I need to update it with

warped condor
#

just add the bracket

#

in the script file

vital wave
#

is that why it wouldnt stay enabled?

warped condor
#

Probably.

vital wave
#

nope

#

still doesnt work

warped condor
#

Follow this file structure

module MyMod {
    imports {
        Base
    }
... your stuff
}

So it would look like this I guess

module MyMod {

    imports {
        Base
    }

    recipe Turn Screw Into Nail
    {
            Screws,

             Result:Nails=1,
             Sound:PutItemInBag,
             Time:2.0,
     }
}
#

I'm not good at script files, cuz they aint lua.

#

you miss s and yeah those brackets were fine I guess, so I misled you.

warped condor
vital wave
#

also

#

how do I resize my images

warped condor
#

wdym

vital wave
#

like

#

normal resizing

#

because they are way too big

#

it aint 32x32 for icon and idk what poster.png size is

warped condor
#

so poster size at max is 256x256

#

preview for workshop is the same

#

icno is 16x16

#

I guess

glacial flicker
#

you can open paint and go to resize image

vital wave
#

thx

glacial flicker
#

it allows you to select pixels or %

warped condor
#

To resize it use paint/photoshop/online sites.

vital wave
#

aight lemme retry again

crystal terrace
warped condor
#

imports

#

seems like imports

#

Like I said I don't sit in scripts.

vital wave
#

When I enable it, then press accept to save the changes, it doesnt do anything at all

#

it disables itself

crystal terrace
#

wym?

warped condor
vital wave
#

what to

warped condor
#

anything else

crystal terrace
vital wave
#

o yeah

#

i didnt know what screws / screwsbox thing is

#

where can i check

warped condor
#

Yup it was just example that he sent

crystal terrace
#

open teh screw box

#

try change screws

crystal terrace
#

for ex here it says screws and screwbox are seperate

bronze yoke
#

when i was playing around with vehicles there really wasn't any way to mess with it

#

i think it was literally just damagePlayers()

vital wave
crystal terrace
vital wave
#

so what would this do then

#

cause I want it to get a screwsbox and turn it into a nailsbox

#

they all use the correct name, i think anyway

crystal terrace
#

It should work on ScrewsBox and turn it into 1 nail box i think(if the item names are right)

vital wave
#

yeah then that should work as intended

#

aight lemme try and see if this mod works

crystal terrace
#

im assuming you're restarting your game each time? to load the scripts with the changes you made

vital wave
#

yes

#

the mod keeps disabling itself again

#

wtf

#

why does it keep doing this

#

do u want me to send whole file in so u can test it or smth

#

cause it aint workin for me

warped condor
#

did you change

#

that id ?

vital wave
#

yea

warped condor
#

send console.log

vital wave
#

wheres thatr

warped condor
#

c users user zomboid console.log

vital wave
#

im not sending it fully because it revails my name and location

#

also it doesnt appear in console.txt

#

i've just checkled

nimble yarrow
#

Need some help with doing a ForLoop in lua...

local function OnZombieDead(zombie)

local zedItems = zombie:getInventory():getItems()    
    
  for i = 0, zedItems:size() -1 do
    print("item getCategory == " .. zedItems:get(i):getCategory())

    -- This does NOT iterate the correct amount of times.
    -- Just tested in game, a zed had 11 items, but this only iterated 9 times.
  end
end

Events.OnZombieDead.Add(OnZombieDead)

Does anything look off, here?

bronze yoke
#

that's because this runs before loot generates

#

if you look at the zombie's inventory i bet you'll see there's 9 clothing items

#

zombie loot isn't generated until the first time a player is in range to access the container

nimble yarrow
#

7 clothing, 1 "ammo", 3 "accessory"

bronze yoke
#

anything that would be visible on the zombie should be there on this event, but nothing else

nimble yarrow
#

anything visible, that would be fine for my purposes. but military boots get skipped. maybe because the pants cover the top half of the model, or something. hmm,

vital wave
elfin stump
#

In the recipe blocks I see use of things like this "[Recipe.GetItemTypes.Spoon]" - I am curious, when creating an item, how do I tell it that it is a spoon for use in this case?

nimble yarrow
#

maybe remove " (and-vice-versa)" from the name? do you have both workshop.txt and mod.info in the correct folders?

vital wave