#mod_development
1 messages ยท Page 113 of 1
Alright, welp, let's see how terrible this ends up lolz
probably not very - though i've been cautioned about it so much i haven't really experienced it myself, and i have mods relying on it
Im fucking crazy because I've been lost in the sauce for too long. I don't expect you to be efficient on your first try.
Premature optimization is the leading cause of orphan projects.
For real.
Enjoy yourself and never forget to have fun when modding.
Honestly, at this point I'm not even trying for optimization, just figuring out how to make this work in the first place lolz
Dynamic generation is, after all, supposedly a very hard thing in this game I've been told.. >.>
Hey guys
Kay, so I got a png I want to add to a pack file
How do I add a png to a pack file?
what are you trying to spawn in anyways?
there is another way to do this as im sure you might be familiar after being in the mapping discord also. just would depend on your goal really
anyone who knows how attached weapon definitions and hair outfit definitions work around?
tryin to figure out why a specific outfit spawns but won't spawn with the items it's supposed to anymore
in a mod i did not make
AttachedWeaponDefinitions.ScreecherKatana= {
chance = 100,
outfit = {"Screecher"},
weaponLocation = {"Stomach"},
bloodLocations = nil,
addHoles = false,
daySurvived = 0,
weapons = {
"Base.BlackKatana",
},
}
AttachedWeaponDefinitions.ScreecherMark= {
chance = 100,
outfit = {"Screecher","ScreecherNoKatana"},
weaponLocation = {"JawStab"},
bloodLocations = nil,
addHoles = false,
daySurvived = 0,
weapons = {
"Base.ScreecherMark",
},
}
AttachedWeaponDefinitions.attachedWeaponCustomOutfit.Screecher = {
chance = 100;
maxitem = 2;
weapons = {
AttachedWeaponDefinitions.ScreecherKatana,
AttachedWeaponDefinitions.ScreecherMark,
},
}
AttachedWeaponDefinitions.attachedWeaponCustomOutfit.ScreecherNoKatana = {
chance = 100;
maxitem = 1;
weapons = {
AttachedWeaponDefinitions.ScreecherMark,
},
}```
cat = {}
cat.outfit = "Screecher";
cat.beard = "None:100";
table.insert(HairOutfitDefinitions.haircutOutfitDefinition, cat);
cat = {}
cat.outfit = "ScreecherNoKatana";
cat.beard = "None:100";
table.insert(HairOutfitDefinitions.haircutOutfitDefinition, cat);```
they are spawning with the correct clothing, but no ScreecherMark or ScreecherKatana
table.insert(ZombiesZoneDefinition.Default,{name = "Screecher", chance=0.01});
table.insert(ZombiesZoneDefinition.Default,{name = "ScreecherNoKatana", chance=0.03});
so they spawn, so the last bit works
as far as i can tell the HairOutfitDefinitions thing just prevents beards on them
therefore something's wrong with the AttachedWeaponDefinitions somehow?
anyone see anything?
compared authenticz's stuff to this, i see no issues..
How will u do this if it was you albion
With a vampire mod out (amongst other things), are there any plans to create a superhero themed one? Something to add a little more variety, that is! I'm thinking flight, laser eyes, and other neat stuff.
yea, I give up, you can't remove items from zombies on death and I can't get this to work.
function removeLoot()
for x,y in pairs(Distributions[1]["all"]) do
if x:contains("Outfit_") or x:contains("inventoryfemale") or x:contains("inventorymale") then
RemoveItemFromDistribution(Distributions[1]["all"][x], "Bullets380Box", nil, true)
RemoveItemFromDistribution(Distributions[1]["all"][x], "Bullets38Box", nil, true)
RemoveItemFromDistribution(Distributions[1]["all"][x], "Bullets9mmBox", nil, true)
RemoveItemFromDistribution(Distributions[1]["all"][x], "Bullets45Box", nil, true)
RemoveItemFromDistribution(Distributions[1]["all"][x], "Bullets44Box", nil, true)
RemoveItemFromDistribution(Distributions[1]["all"][x], "ShotgunShellsBox", nil, true)
RemoveItemFromDistribution(Distributions[1]["all"][x], "223Box", nil, true)
RemoveItemFromDistribution(Distributions[1]["all"][x], "556Box", nil, true)
RemoveItemFromDistribution(Distributions[1]["all"][x], "308Box", nil, true)
end
end
end
Events.OnPostDistributionMerge.Add(removeLoot)```
this person was able to do it apparently using this code.
#mod_development message
i'm don't remember why you are targeting any outfit when you dont want it to spawn on anything right?
just zeds, there's stuff in all that aren't zombies
but it's still way more simplified than what you're doing here. also does those two zombie types cover all zombies? i didn't think it would
all the Outfit_, inventorymale/female are all under all
LOG : General , 1676269390989> 0> Distro all: PaperTray
LOG : General , 1676269390989> 0> Distro all: EmergencyAxe
LOG : General , 1676269390989> 0> Distro all: RSLocker
LOG : General , 1676269390989> 0> Distro all: WZLocker
LOG : General , 1676269390990> 0> Distro all: ESLocker
LOG : General , 1676269390990> 0> Distro all: PVLocker
LOG : General , 1676269390990> 0> Distro all: FloorSafeSpike
LOG : General , 1676269390990> 0> Distro all: bin
LOG : General , 1676269390990> 0> Distro all: campfire
LOG : General , 1676269390990> 0> Distro all: cashregister
LOG : General , 1676269390990> 0> Distro all: clothingdryer
LOG : General , 1676269390990> 0> Distro all: clothingdryerbasic
LOG : General , 1676269390990> 0> Distro all: clothingrack
LOG : General , 1676269390990> 0> Distro all: clothingwasher
LOG : General , 1676269390991> 0> Distro all: counter
LOG : General , 1676269390991> 0> Distro all: crate
LOG : General , 1676269390991> 0> Distro all: desk
LOG : General , 1676269390991> 0> Distro all: dishescabinet
LOG : General , 1676269390991> 0> Distro all: displaycasebakery
LOG : General , 1676269390991> 0> Distro all: dresser
LOG : General , 1676269390991> 0> Distro all: filingcabinet
LOG : General , 1676269390991> 0> Distro all: freezer
LOG : General , 1676269390991> 0> Distro all: fridge
LOG : General , 1676269390991> 0> Distro all: grocerstand
LOG : General , 1676269390992> 0> Distro all: inventoryfemale
LOG : General , 1676269390992> 0> Distro all: inventorymale
LOG : General , 1676269390993> 0> Distro all: locker
LOG : General , 1676269390993> 0> Distro all: logs
LOG : General , 1676269390993> 0> Distro all: medicine
LOG : General , 1676269390993> 0> Distro all: metal_shelves
LOG : General , 1676269390993> 0> Distro all: microwave
LOG : General , 1676269390993> 0> Distro all: militarycrate
LOG : General , 1676269390993> 0> Distro all: militarylocker
LOG : General , 1676269390993> 0> Distro all: officedrawers
LOG : General , 1676269390993> 0> Distro all: other
LOG : General , 1676269390993> 0> Distro all: plankstash
LOG : General , 1676269390994> 0> Distro all: postbox
LOG : General , 1676269390994> 0> Distro all: restaurantdisplay
LOG : General , 1676269390994> 0> Distro all: shelves
LOG : General , 1676269390994> 0> Distro all: shelvesmag
LOG : General , 1676269390994> 0> Distro all: sidetable
LOG : General , 1676269390994> 0> Distro all: stove
LOG : General , 1676269390994> 0> Distro all: toolcabinet
LOG : General , 1676269390994> 0> Distro all: vendingpop
LOG : General , 1676269390994> 0> Distro all: vendingsnack
LOG : General , 1676269390994> 0> Distro all: wardrobe
those are also in all
welp. also looks like you can't set the PickUpLevel of a sprite above 5 that i can see
not even in the tile def?
yes only there
i am trying to control via sandbox ๐ฆ
getSprite(light):getProperties():Set("PickUpLevel","6")
soon as i go above 5 it goes potato
reverts to 3 always
o.O
i noticed in the vanilla tile properties file in Tilezed it's default is 5
i had to manually edit the file itself to change what value it allows
it works when i set it up to 10 in the tile properties file itself but not here
i have another method for this anyways i may go with. just thought this would be fun to do this way
i wonder if you could use UnSet("PickUpLevel") first then?
i haven't looked exactly what that method does but if the original value matters maybe this will give it a blank slate of sorts
it doesn't cause an issue but it still wont let me set above 5
it goes back to 3 haha
nice thought though D: god i hate that it's always the last step of each function that i get caught up on
soo weird how i can do it with editing the .tiles itself though
is the setting reverting? cuz.. https://discord.com/channels/136501320340209664/1067210244159193108
delete ur map_sand.bin file before updating sandbox settings, also sandbox settings are rather borky
the problem isn't the sandbox setting itself is resetting, it's just the application of it is being refused for mysterious reasons
yea
i can use every minute event and change it all daty
1-5
second i use5+ it goes to 3
Me and 9 other Project Zomboid YouTubers are looking for moders on our server. We need just a few simple mods
If you are interested - DM me. And I also will send you the full list of YouTubers participating, if you want.
gonna try to figure out the other method i think where i use a context menu that makes you "disconnect wires". so if you hit perklevel and use context menu it should let you access the option, which essentially is just me just changing the level to below the sandbox option
then ill just hardcode it to 10 from .tiles
i had a quick look at the code involved and this stuff is WEIRD
my brain can't think beyond that atm lol
LOL
at least this way is being gated by the context menu always needing to be used before removing any lightswitch
doesn't seem the worst. unless i'm not thinking about something haha
really bugs me though that 5 limit lol
there is also no possible way to force player to use more than 1 tool to pickup or place lol
unless im also a dummy there. but i tried hardcoded and lua and neither
said not implemented lol
i mean there probably is outside of the box way but not with that direct setting that i can find
it keeps every possible value for every property in a lookup table
it's a bit too complicated for me to understand exactly why but that's why it refuses it, those values aren't in the lookup table
can you direct me to it?
is it on the java side?
is it something i can rewrite? LOL
it's all java
๐ฆ
i assume it's done this way for a reason so rewriting it might have a lot of consequences
where can I advertise my mod on this server? I see people usually post links in this channel, but what about others?
i have
i posted in pz chat lol
i dont endorse spamming but it's hard AF to get your mod out there with all the poo people decide needs to be posted publicly. spotlight is good but shortlived
I don't intend to spam, just want to send it out once to any potential onlookers and that's it
ah you are good. i just said it more as a disclaimer ๐
i love seeing posted mods anyways
gotcha. Time to upload this thing. I got ISUnequipAction working btw, the bug was incredibly stupid.
lol what was it? a missing parameter?
I was calling the player to unequip an item after it had been removed from the inventory, and the action didn't know what to look for
ohhhh
this is why i'm not great at coding. my brain doesn think that far through always ๐
the solution was putting "equip", "UnequipAction", then my timed action. I was very disappointed
gratz on any solution though
can always come back later if you want. mods done for now ๐
whatever gets the job done, right? the main thing now is having someone else solve the greater issue I have with it lolol
i was gonna messs with it later in tiles
try assigning an item to the sprite and set Isotype on the item. no idea tbh
it's all very magic-like when it works
if i had a better idea how it worked then np. lightswitches were already interesting to figure out
i looked at adding a sprite just for the new items, but "texturepacks" and pack files all looked very intricate and difficult to maintain, so I'm going for 3d models
perhaps a pipeline could be made with an "invisible" model that combines the InventoryItem and IsoObject but I'm not gonna waste more time on that for now
literally png file with precoded properties lol
I did not feel like reverse-engineering the xml files lol
i'll check it out and ping you if i get anywhere
sure thing
Thank you to everyone who put up with my dumb questions and struggles. This was a rollercoaster to make, but now I can have it available for the public to fix its issues lol
https://steamcommunity.com/sharedfiles/filedetails/?id=2932823902
Me and Pao doing a colab on the reanimation mod
Basically turns the player into controllable zed once they die
Ive written a pseudo tech paper base concept of it
The animation ad the server client codes are already written
But still have alot of functions to cover
Anyone willing to colab with us?
The mod is posted on github but currently as private
This is a passion project
Its huge mod
Most of the listed items can be scratched as it might require lots of work for minimal impact
But i just wrote everything in mind so yeah the whole scope should be less than that
seems like you'd have to implement a bunch of properties from IsoZombie into IsoPlayer, if it's even possible
Or making a Lua class that is assigned globally to everyone to function like a Java class
could also do something like based off of udderly knocked out where when you die you have the ability to respawn and choose a specific psuedo profession or whatever that you can assign that to.
just an alternate thought
then you essentially respawn there as a new entity. not even sure if it would matter or not but it may save some headaches, especially if the char despawns and drops everything on death
back to lightswitches ๐
@drifting ore - Add new values property values and set them on sprite
--before OnLoadedTileDefinitions, in this example you can generate a new array with all levels and put it to PropertyValueMap without any checks
local vals = IsoWorld.PropertyValueMap:get("PickUpLevel") or ArrayList.new()
for i = 1, 10 do
local val = tostring(i)
if not vals:contains(val) then vals:add(val) end
end
IsoWorld.PropertyValueMap:put("PickUpLevel",vals)
--OnLoadedTileDefinitions *and later, tested with this event
--#Properties Set(string property, string value, boolean isIsoFlagType)
Events.OnLoadedTileDefinitions.Add(function(manager)
manager:getSprite("..."):getProperties():Set("PickUpLevel",tostring(sandbox),false)
end)
#selfpins change tile properties
lol this is a thing? hell yes
if this works this is huge haha
every time i think i'm done i realize something else.... like when you hit level 5 electrical you can add battery connectors to them. ended up having to make something for that also
i'm addicted to the icons
yo guys and ladies(if any present) , how to take timestamp when lua function called? ive got my hands on PZcalendar but syntax kinda weird and im not sure i get it
i need to write time when effect was applied so i can check how many of same effect is active at the time
and how to make item behave like Poultice
os.time()
ty
u r welcome 
hm, probably best to check if the array already contains the value before adding it.
os.time isnt a good choice for tracking buffs/debuffs
imagine you log out then come back 2h later
os.time gets irl time not ingame so it wouldve advanced the state when it shouldnt have
i'm about to crash but i will be spending a good amount of time looking into this. thank you @fast galleon
yup thought about it so looked more and found LuaManager.GlobalObject:getGametimeTimestamp()
i guess it must work the way i need
I wonder if there is any way to control that behavior from server?
[13-02-23 13:33:41.353] LOG : General , 1676288021353> 82ย 403ย 098> Disconnected player in CurrentCell.getObjectList() removed.
@heady crystal FYI, I just reported a pretty significant bug on your page and told you exactly what needs to be done to fix it. Sorry to ping, but I suspected you may want to address it quickly, since it's a very easy problem to fix but a game-breaking error for gamepad users.
Out of curiosity, regarding common lingo around here, is there a technical difference between a Steam collection and a "modpack"? Does this community use modpack for an individual workshop item that contains a ton of mods, or does this community use modpack and collection interchangeably?
I know a lot of people don't like being included in "modpacks" from seeing people say this often, but I am wondering if the feeling about collections is the same.
I'm guessing inclusion in a collection would be okay with most modders?
(Since users do ultimately add to their subscription count?)
Personally I'm ok with modpacks as long as they're private
That's fair. I think people want to get some traffic to their page that reflects the effort they invested, which is understandable.
I am interested in making a collection for my favorite set of mods, but I want to respect the wishes of the modders who make the collection possible.
How does one properly spawn a vehicle from server? I see client sending /addvehicle string commands to server but not a single example for server execution.
I can't imagine peoe have issues with steam collections. But yea some people don't like being included in actual mod packs even if they are unlisted.
Thanks. I think I understand but I want to explicitly make sure I'm not misunderstanding.
Hopefully this is how most modders feel. If no one responds with an intense hatred of being included in collections, I'll probably go for it.
People have asked me for modpacks, but never collections even though there's a lot of them out there. I can't picture someone getting upset with steam collections either
Collections still link to the workshop page and even include the modders name in the tags. It basically just adds that mod to a list as it says. So there is really no reason for them to be upset. But then again I don't see much harm in unlisted mod packs but I have been told other feel otherwise

When in doubt ask I suppose
If you have to ask you should create a discussion for it on the workshop page. That way people know the stance of the author and don't need to ask in the comments ; because apparently people dislike that.
Steam collections are basically the same as the normal sub so theres nothing wrong with that
It actually advertise the mod so its a good thing
With a vampire mod out (amongst other things), are there any plans to create a superhero themed one? Something to add a little more variety, that is! I'm thinking flight, laser eyes, and other neat stuff.
Yeah that's why people never ask to make collections, and should ask to make modpacks
@ancient grail @jovial harness @hot patrol Thanks for the feedback.
Ill provide you the code i have in a bit.. im currently afk
But basically i just use sendcommand that does the admin chat power
If you wantnto use the other code that need server client pingpong
Lol @jovial harness accidentally removed your reaction checking who reacted
My fingers are unfit for this role
I am undeserving of blue
I apologize for my existence
The thing is I wanna create vehicle at specific square without client being a part of it, if square is currently loaded in this cell.
lol no worries
I seen there is a BaseVehicle class but it does require a descriptor to be built for it from what I got.
Just was wondering if there is a proper server-side function pre-existing to create vehicles without clients.
@nova socket
just modify the code
- addvehicle : Spawn a vehicle. Use: /addvehicle "script" "user or x,y,z", ex /addvehicle "Base.VanAmbulance" "rj"
function spawnv()
local scripts = getScriptManager():getAllVehicleScripts()
local allV = scripts:size()+1
local randV = ZombRand(1, allV)
local randM = scripts:get(randV):getModule():getName()
local randN = scripts:get(randV):getName()
local spawnV = randM..'.'..randN
local command = "/addvehicle ".. spawnV .. ' '.. getPlayer():getUsername()
SendCommandToServer(command)
end
this is a random vehicle spawner code
Hmmmmmmm
Good morning.
I'm probably going to need to regroup and start on pseudo-class implementation for my transpiler. =/
Nah you dont need the get all vehicle
You just need the sendcommand to server bit
Replace the username with xyz
Nah I mean I want to know if there is a proper way rather than sending command with xyz
Idk what you meab
I mean there should be a way to construct vehicle from class or have some related function to do it.
Unless there is none.
let me know how you decide to implement classes in lua might follow the same structure for ui
? Oh this is for JS / TS.
I'm trying to map class-logic from PZ to proper JS / TS.
It's a way bigger headache.
werent you also writing the portion from ts to lua?
No. This is handled by TSTL, a third-party transpiler.
@ancient grail But thanks ill use command way for now.
ah youre still using that
I plan to keep using that.
I'm working on a projact called LTTS.
(Other way)
Lua is not as straight-forward about pseudo-class solutions as ES5 JavaScript prototypes.
I could implement ES6 however this would possibly erase function-overrides.
im about halfway documenting the base ui
dealing with those 8713467127881 overloaded functions is pain
This is a critical point in the development of the transpiler.
10% of them being deprecated / unused.
especially figuring out the quirks of each
addVehicleDebug() in LuaManager.GlobalObject might be what you're looking for?
never used it myself
Hey.. you might actually learn enough about the UI codebase on the Lua side to rival me. xD
yeah the overloads might not be used but there are still a crap ton of render functions
I know both Java and Lua UI engine.
i mean i already know the lua side really well
Make sure that you make it out alive.
Yeah.. I do need to release the shaders API for UI...
its the drawTexture and drawTextureUniformScaledColorWithFlowersUpsideDown that gets me while documenting
If we can get the color byte order of params for Lua handles to be consistent with the Java API, that'd be great.
I straight-up call self.javaObject haha.
im doing r g b a in every function
argb is a common order for DirectX devs.
Makes me think that uhh some of the older devs worked with DirectX.
Hence "old devs"
Doesn't work on server-side apparently.
So far from what I discovered sending command to server from.. server is the way to do it.
example of the docs ive done
I would like to have you use my documentation format / app. The problem: It's not ready yet.
Having it stored in the JSON format I made would allow me to inject docs at some point in the Lua code lol.
It's literally for your situation.
๐ข
I wish I had time to finish it up.
well but that wouldnt have integration with the lua addon in vscode
or emmylua in intellij
I'd like to extract your docs at some point so hold on tight to them.
eventually will be in the community framework
What I want to do is inject the JavaDocs for PZ to var names and docs in decompiled Java code.
Basically, it's to get around Lua function signatures not behaving like Java's method signatures.
It makes sense. The solution is meh.
You can mix params.
It'd confuse modders if not documented.
This is why you see PipeWrench's typings have interesting mixed types for params.
/**
* @noSelf
*
* Method Parameters:
* - (String arg0, String arg1, KahluaTable arg2): void
* - (IsoPlayer arg0, String arg1, String arg2, KahluaTable arg3): void
*/
static sendClientCommand(arg0: string | zombie.characters.IsoPlayer, arg1: string, arg2: se.krka.kahlua.vm.KahluaTable | string, arg3?: se.krka.kahlua.vm.KahluaTable): void;
(Example)
Same param thing, but with types showing what's happening from how Lua interprets a CallExpression.
Finaly posted my volvo
does anyone know what this error means? im having a real hard time with it and it's affecting both the visibility of my clothing item as well as its tootip (which doesnt show up at all + does not register bite protection)
its difficult to resolve since i do not know where to look. for example i went to line 215 in the clothing.class file and nothing seems really out of place
not sure what my mod is breaking or why. although it maybe could be a compatibility issue? i'd like to still resolve the issue somehow since some mods are integral to my gameplay
what line sets up part 14 in your clothng?
in my files?
yes
squints i dont think i have a line that sets up clothing in my folder. which file should i be looking at? the item's .xml or .txt?
did you... fix capitalisation?
Hi guys, quick question. If one is interested in getting into modding, where could they find the existing library/code to read & learn the structure & internal conventions etc?
Also, is the modding done purely done in Java, Lua or C++, and/or which ones can a modder utilize for the mods they create?
Mods are mostly written in Lua for the sake of the end users. I recently posted this to offer a basic template of recommended decent practice, including tips / tricks and a GitHub repo link that you can clone into %userprofile%/Zomboid/Workshop, here: https://steamcommunity.com/sharedfiles/filedetails/?id=2929985581
That said, the type of mod you are making will affect what you need and the structure of your code.
E.g., you will need special folders for animations or sounds if you add them.
Oooh, thank you ๐ I'll read this. I've been putting off my modding career in zomboid for too long.
You can view the code of any mod to which you have subscribed on the Workshop in Steam/steamapps/workshop/content/108600
(obviously Idk where your Steam is installed)
And which softwares are primarily used? Something like Visual Studio for coding?
Super subjective imo
But there are objectively useful tools associated with specific editors
I personally prefer VS Code but I do not rely heavily on code completion when I program, so I'm not necessarily as picky as some about my editor.
A lot of people strongly recommend IntelliJ for a couple reasons
One, you can easily follow Konijima's guide to decompile the game's Java and use its files in your code completion
And two I believe there are add-ons for Lua code completion based on the media folder as well
Although I don't use them so Idk what they are
I'm a game programmer by career (haven't graduated yet) focused on C++, so I expect the mods I make to be heavily code-oriented
But thank you, I'll take a look into those now ^^
Good luck!
Is there a way that I can get a zombie by its OnlineID, or something similar? I'm currently trying to send a command from the client to the server, and need a way to tell the server which zombie to actually do something on. The only thing I could find is GameClient's getZombie() static method, but that's not exposed (or at least not from getGameClient()).
for playerIndex=0,getNumActivePlayers()-1 do
local playerObj = getSpecificPlayer(playerIndex)
if playerObj and playerObj:getInventory() then
-- do stuff in the player's inventory
end
end
This is in a function called on the EveryOneMinute event on the server. Anyone knows if this is fine to get all online players on a server?
Yes, I pass the zombieId over and use getcell():getZombies() to parse through
It seems accurate for the most part
I'd have to retest but I recall there being instances of not finding the zombie
This was also server to client
I use that for my mod and it works both SP and MP
It also works for split screen
Nice, thanks
I've thought about that technique, but it could be expensive to do that all of the time and this event will be triggered a lot. My other thought was to transmit the square coords, and iterate over the square's zombies just so there is a smaller sample size.
with the script manager is it possible to remove a recipe requirement and add in another?
Tried that too and that also had some issues - but more so - the returns for getZombie kept coming back as nil
If they moved around that is
Yea, i could see that being inaccurate if the connection between client and server isn't the best or there is just any sort of delay/desync
Perhaps using tile first then falling back to cell could be the way to go
But whatever information you need to send could probably be cut down
No place to really discuss mods. Im curious are there any big mods like hydrocraft was back in the day?
I know its quantity over quality but it had some cool parts to it.
This is for a weapon attack, so it needs to be fast. Iterating over the zombies like this would not be good for performance, and it needs to be consistent. If I can't get by the zombie id, then i'm not sure this is possible without either building my own cache, or letting the server calculate the weapon arc and stuff too. Problem with that is then I don't have a way to ensure that the same zeds are hit on client/server as i can't get by any zombie id.... 
hm, chuck knows better than me, but I thought it was said that zeds should be hit client side? Not sure how that conversation ended.
They do get hit client side, and i can see the events be fired when doing damage. My problem currently are the hit reactions/staggers...
can you use something as a tag or you need to edit the recipe itself?
Trying to edit a vanilla recipe
I think so, don't have an example atm.
Is it more worth to do PZ mods in lua or java?
java is worth more, lua is simpler. For peace of mind, none.
Hello, i think its a quick question but it may not be too
Do you recommend something like PZ storm to start with java?
i have a mod, and when i wear only my pants, its model is properly set
however when i also wear my jacket, then some faces disappear from my pants
never used that, I keep it simple
does anybody know a fix for this, its making me mad.
Your best bet would be to ask in #modeling
oh that makes sense, sorry didn't see that channel lol
check your masks
Oh yes, but i dont really know what masks are for
.... those are what cause that to happen.
and what numbers mean, couldnt find documentation online too
so i should remove all of them ?
masks of my jacket and pants interact with eachother, i dont know if this is on purpose but when i remove all of them, i can see the the skin from the elbows of my character...
Me and 9 other Project Zomboid YouTubers are looking for mod makers on our server. We need just a few simple mods
If you are interested - DM me. And I also will send you the full list of YouTubers participating, if you want.
@faint jewel do you know any documentation about how masks work ?
its driving me crazy
thank you so much, i think i will solve the problem !
๐
Something seems to be simple might require hundreds of lines of code. Could you elaborate on the concept of the mod so that those who are interested may offer their assistance?

every time I almost finish up. I find one more thing that would be awesome and then spend the entire next day figuring out. adding battery connector to lightswitches by sandbox level requirement, or completely disabled.
as i do more things i start to understand why modders mod ๐
You are doing great
Keeep it uuuuupp
Yeah, potentially. If I were to detect the worldage, that might be a hacky way of detecting when the map is newly generated, maybe. Like, there's gotta be some combination of other functions that would allow me to detect the world being "created", first player joins, etc, etc.
Then if I can somehow force tiles getting placed on squares that haven't been loaded..
Very noice, btw <.<
that's actually a pretty decent approach I think . I do wonder if it's possible to generate additions to veg layer on the fly
without killing pc
if there was then it could just appear like a tree would but only dynamically
i do wonder what event it's tied to or what kind of custom event would be ideal for that
Well, I realized something important that'll help with this lolz... what I'm working on is for a very specific map, with an already-known size, so, I can manually loop through the cells, randomly select a set of coords within that cell, grab the square based on those coords, and place the item, then wash rinse and repeat through all cells.
So, that part at least is covered.
It's just the part where I need to limit this to only happening once, pretty much as soon as the world exists, that's the tricky part
my original idea is teh way IMO
it's not dynamic but the performance cost is not even compareable
In theory, if I can later figure out how to detect total number of cells in a world, such a script could be adapted to any size map too.
Yeah, I want the spread of them to be dynamic, so that players can't simply memorize where they are, and plan where to build communities based around those known locations.
your way would work for any map though if you get it to work, while my way would require you setting up a rules.txt and custom defining a color to the tile and where map makers place that color on map will spawn them
Like that way players can't be like "Hey, I know item X will spawn to the far right of the cell if I spawn at the Camp Rosewood point, so we should all spawn there, move that way, and start the first village there" type of thing.
my way is the boring way and more work for everyone
yea i'm really interested
you gotta keep me update on your progress ๐ i'm not at a level where i'd even know where to begin implementing something like that
Heck, if I can even get it to work off of a manual trigger, that would be a start, and then figure out automatically triggering it later lolz
actually, that said, I already did get that partly working. I already have a function that spawns it where you're standing when you run the function in the in-game console. I can probably expand upon that to generate it randomly with the same function... hmm...
could have it attach to certain other tiles/sprites and spawn within a random distance from them
Huh did someone else besides me call Lua classes pseudo-classes?
not sure if there is any sprites that would fit the criteria for you
I mean, psuedo-classes are def common enough of a term that I've heard the term used before >.>
table inheritance 
I mean, that's pretty vague though, since after all, basically everything is some form of a table in Lua...

And that's why it'll be fun adapting Lua pseudo-classes as ES5 & ES6 JavaScript classes.
TIL you can use prototype API on ES6 classes.
My goal is to spit out something like:
// ES6 Class syntax
export class ISUIElement extends ISBaseObject {
// ...
update() {
// ...
}
}
// ES5 Prototype syntax
// Example Override method in another Lua file.
UIElement.prototype.update = function() {
// ...
}
anyone know if the "ZombieMap" in the lotheaders for maps is exposed to lua in any fashion whatsoever?
Whats this
You and your mods.. i never understood anything that you do
Not once
It's using JSDoc to define types for IntelliSense.

Ahh cool man
I just made my first mod with an outfit. It's a military outfit, how can I say that I only want the outfit to spawn in areas that other military outfits spawn in?
Put it only in the military zones distribution tables
Good reference to learn to do so would be AuthZ
(I would pull up and post the relevant code for ya directly, if I weren't on mobile at the moment, sowwy ;-;)
I believe there's even a list somewhere in this channel of the entire list of room zones/types/definitions, and the containers they support.
You can also specify it as viable options for military zeds themselves, using the outfit defs for the military zeds
I've added the new clothing piece to container distributions, but I mean as an outfit on a zed
Aye, that'll be the last point above then; you would want to add the clothing pieces as an outfit, and add that new outfit to the male and female zed outfits, for the military zed type.
I've already made the male and female outfits, and can spawn them manually the way I want them to look using the debugger
(plus any variations as well, as new outfits, like if you want some to spawn with the vanilla army tshirt, your pants, no jacket, that would be a variation that needs to be a new outfit)
I copied a vanilla military zed outfit as a base, but didn't see anything in that to say where they spawn
Yes, you specify that using the zed inventory dist tables
This right here: #mod_development message
Basically, you would need to add it to three things;
military zed outfits - male
military zed outfits - female
world containers appropriate for military equipment spawns
Sound like you're saying you already have the last one covered, so only the first two left.
HOWEVER, and maybe this is just me not explaining it thoroughly enough.. to add them as outfits to the zeds, you bave to create the actual outfit definitions. Then add those definitions, to the tables that control what the zeds spawn with as what they're wearing, specifically for the military zed types.
Can't just spawn the items in their inventory and expect the game to make them wear the items, if that's what you were expecting.
I've got the outfits defined. Just need to do the zed spawns
So yeah, you just need to add it to the military zeds outfits tables
I think I found the file in vanilla for this
ZombiesZoneDefinition.lua
Anyone know if one can use Visual Studio Enterprise to mod zomboid, or does it have to be visual studio code?
Doesn't "have to be" anything; I use Sublime Text lolz
But yes, you can use any editor that'll allow you to open, edit, and save .lua and .txt files
Heck, you can even use Notepad for it (like regular notepad, not notepad++ even haha)
Well, I use visual studio enterprise for my coding, and I'm used to VS, but would prefer not to install Code when I have enterprise :/
Just don't know which modules I'd need for zomboid.
vim
If you want to go conventional Lua modding, there're guides for setting up your environment.
I also manage a TypeScript environment as an alternative.
Hmm, I see. Thank you~
As far as Lua goes, there's not really any 'environment' to set up.. they're just basic text files with a non-standard file extension haha
So simply opening the folder will do (in VS)
I also use VS (not enterprise, but the difference between community edition and enterprise, in this case, in nothing), and tried using it as my IDE for PZ mods, but TBH, I find a basic text editor to be alot less cumbersome to edit these things in, comparatively.
(plus Sublime happens to have Lua highlighting built right in anyways, so, win-win lolz)
VSCode is what I use for everything except what I need to code in VSCommunity.
Java -> IntelliJ IDEA because I mainly reverse engineer.
I've never understood the appeal of VS Code.. Less features, and no native port for Linux/Ubuntu..
It otherwise looks decent enough, and is still more than a basic editor like sublime or notepad++, but still, I just never understood it lolz
I think I got it figured out
local ArmyCamoUrban = {
name="ArmyCamoUrban",
chance=5
};
ZombiesZoneDefinition.Army[ArmyCamoUrban] = ArmyCamoUrban;```
table.insert(ZombiesZoneDefinition.Army["ArmyCamoUrban"], ArmyUrbanCamo) I think
I put that in lua/shared/NPCs folder
I copied the code I have from AuthenticZ... there are some inserts at the bottom, but I thought that was just for rooms
Or general population? I also looked at the vanilla file, and just copied based on the desert camo entries I found
Copying from other mods isnt exactly a good practice. But on your case i think we can agree its cool cuz its just definitions
Right, but I think what you did above, if I'm thinking of it correctly, is assigning only your definition to the ArmyCamoUrban table, rather than adding it.
You're assigning instead of appending, basically
Essentially overwriting all other outfits in that table
I think it's appending, adding a new item to an array. I'm no lua expert but that is the syntax in many other languages
I mean, I actually program in many other languages, and that's false... single = is assignment, not append.
I mean is this nuance that important? =P
Well then AuthenticZ has a lot wrong in there code
hey everyone, i have a dumb question... is there a way to make an item in the players inventory invisible?
i think there was a way but cant quite recall how
I mean in this case it is slightly important yeah haha... if you don't want to completely overwrite something, you need to append not assign shrug
Unlikely; AuthZ adds alot of new types, not only adding to existing ones, so assigning to a table makes sense in that case, to populate an otherwise non-existant table.
Not sure the purpose, but you might be able to accomplish the same thing by simply setting a modData value on the player?
Nit sure how to make invisible inventory unfortunately lolz
I was being sarcastic. Here's a snippet of the AZ code
local Ghillie = {
name="Ghillie",
gender="male",
chance=0.5,
};
ZombiesZoneDefinition.SecretBase[Ghillie] = Ghillie;
SecretBase is defined in vanilla. No SQL inserts for SecretBase in AZ
Yeah, that's adding a new outfit called Ghillie
was trying something out that ill do some other way
but i do recall someone saying something about making an item not listed in the players inventory
or i might be mistaken and it was on another game
ArmyCamoUrban is a vanilla outfit though isn't it? Your code overwrites it. That's all I'm sayin..
ArmyCamoUrban isn't a vanilla outfit, that's the point of my mod. Vanilla lacks Urban Camo Jacket, so I made that and an outfit with it
Oh, well fair enough then, I thought that was a vanilla outfit, because I've seen it ingame before lolz... guess it was another mod we had installed.
What you wrote should be fine then. Carry on lolz
Is there an "OnCreateZombie" event just like there's one for player & survivor? o.O
Can't seem to find it in the wiki
hmmm, well I must still be missing something. I went to the military road block by LV. Spawning zeds with the debug horde manager and my outfit does not appear...
regular military spawns, but not my addition, so I didn't overwrite the vanilla...
she's right btw
you are adding to a non defined table or something
authz uses custom defs
so you can add to their def but your stuff has to be defined within the other parts of your code that determine which zombies wear it or something along those lines
there is a post earlier showing a semi reasonable example but for weapons spawning attached to zombies based from clothing, which is same concept minus adding the extra weapon attachment stuff based on clothing
you wont need it all but check this to see generally how it's done.
#mod_development message
pretty sure the reason for this not working is the usage of weapon attachment so you should be fine seeing what's used prior to it
i read over this so many times, did you ever figure this out?
is it possible to get the world Coords of the camera?
Why you need camera coords?
nope
no damn clue
D'oh! So my code worked. But I had made a version that I uploaded to the workshop, and then I was still working on my original dev version. But PZ was running the unmodified workshop code.
any chance you think it could be another mod causing it?
it adds its own code and things for everything
a mod i run does override some of the animations
but that's the only thing that should collide
maybe something runs that breaks it before or something
i mean i got nothign but im throwing stuff out there
im working on a shader related to fog that but there is a world offset based on the player i think
i put it pretty long in the load order to avoid stuff too.
Welcome to PZ Modding! lolz.. I feel like that happening is basically a rite of passage haha
I think you can get player coords, zoom and camera offset
ah i see cameraInfo that may be it
trying to add a feature to control light strength through a couple of context options for the lightswitch mod and finish this pickup level thing and i should good to go lol... i swear im not going to think of another thing to add
"i swear im not going to think of another thing to add"
-cough- BS -cough-
said that 3 features ago lol

It's okay, if I had stopped when I originally planned with what has turned into my current mod, I woulda been done weeeeks ago lolz

Does anybody know where is the code that renders the health tab in the character?
Anyone know if it's possible to specify a texture for an item in an outfit? This particular item has 3 texture options.
Gonna need to make it 3 seperate items with a model def for each, I think.
I know that can work, but this is for an item that I didn't create. No big deal
Thanks Aiteron, i found the camera offset
What's the best way to send a command from the server to the client without using the object system? I'm trying to have the chracter "say" something after doing an onCreate which is server side.
do I still do the ServerCommand?
woo @fast galleon lol I will credit you for sure... but seriously link your workshop or ANYTHING you want. so good
you made something i didn't even think was possible, possible, and also open the door for many other possibilities i havent even figured out yet ๐
@jagged fulcrum Yo alree FYI I just posted a bugfix on your workshop page for IGM
Is there anything specific I need to do so I can reload lua scripts in the debugger? It seems when I hit reload it doesn't often reload the script I need to quit and start again the game
not sure where chucks version went but you can use AUD
https://steamcommunity.com/sharedfiles/filedetails/?id=2340608427
here is the one chuck was updating from that to improve upon
https://github.com/Project-Zomboid-Community-Modding/pz-community-modding
box on the left side to open lua file explorer, can click + to favorite and then click to reload
there are a lot of quirks with reloading files in most cases backing out to the main menu is recommended
whats the syntax for offset
Back to the drawing board.
Working on UML class diagrams again for my transpiler class stuff.
Hi. Is there a tutorial on how to get started in modding?
Yes, there are two pretty good video tutorials on youtube and a good enough clothing mod tutorial on Steam guides
they're easy to find with a google search really
Yeah. ofc I googled. I ended up here though. https://theindiestone.com/forums/index.php?/topic/61-robomats-modding-tutorials-updated-12112013/
RoboMat's Modding Tutorials - An introduction to modding for Project Zomboid - I - Introduction I1 - Where to start I2 - What is neededI3 - Lua TutorialsI4 - Other Resources II - The first steps II1 - Getting the connectionII2 - The entry point: Events III - The first mod III1 - Preparations III1...
You need to quit and restart most likely because you stayed in the debug menu reading too long.
Staying in for too long before reloading a file would cause a server timeout and boots you.
Is there a set number of chunks per cell?
Or more accurately, is there any possible way at all to fetch a specific square and interact with it?
i swear a chunk was 175 tiles in and x and y from the player at all times
It's not
Yes
Um
One sec
i always wondered also but never had a reason to ask i guess that makes sense also. thanks!
@true vault
ZGal88 = {}
ZGal88.onClick = function(object, x, y)
if not badSitch() then return end
if not object.getSquare then return end
local square = object:getSquare()
-- Boom
end
Events.OnObjectLeftMouseButtonUp.Add(ZGal88.onClick)
(either way)
Oh for some reason I thought you meant click on one
There's also getGridSquare(x, y, z) iirc.
Or maybe just getSquare
i made some random remakes of some of the t shirt decals in better quality on canva, all of them are replacements except the circular mccoy one, what do yall think so far
never messed with modding before so im giving it a go
i figure simple retextures are gonna be easy enough, maybe even adding some new decals that can spawn
how do i bend the players knee via xml? like the animation i did
and how do make this animation be able to move
its just stuck on 1 square
I just discovered that the PNG preview image of a mod can cause this error. I'm sharing this information for anyone who may encounter the same issue.
at zombie.core.textures.TexturePackPage.getTexture(TexturePackPage.java:179)
at zombie.core.textures.Texture.getSharedTextureInternal(Texture.java:630)
at zombie.core.textures.Texture.getSharedTexture(Texture.java:528)
at zombie.core.textures.Texture.getSharedTexture(Texture.java:515)
at zombie.core.textures.TexturePackPage.getTexture(TexturePackPage.java:179)
at zombie.core.textures.Texture.getSharedTextureInternal(Texture.java:630)
at zombie.core.textures.Texture.getSharedTexture(Texture.java:528)
at zombie.core.textures.Texture.getSharedTexture(Texture.java:515)
PNG encoding probably.
Right, so I was looking at that and messing with it, but it didn't seem to work right.
For example, if I feed it getSquare(0,0,0) it should in theory fetch the top-left square of the map, right, and I should then be able to getObjectsList() based on that?
No no no, not these ones. Just look it on youtube, video tutorials are always better and this shit is from 2013 ?!
there is a comprehensive video tutorial that covers many aspects which is 1.5 hour long
and a simpler one belonging to a channel named Blackbeard i think
i'm trying to get an icon from the base game to work on
but cannot find the icons
i looked at the xml files of clothings, Hat_ArmyHelmet has Icon = GreenArmyHelmet
but when i search for GreenArmyHelmet in PZ directory, it returns nothing
Just pull it from the wiki, that's what I do lolz
Wouldn't happen to be this one perchance @tepid dawn?
aha, yerp. They're in the files too, but as a pack of icons, for lack of a better word.
And one more small question if you dont mind
mmm, sure
Do I have to relaunch the game everytime i edit an icon or a texture ?
I dont need to for models but
Usually works fine for me just exiting to main menu then reloading save
Your mileage may vary on that though; I wouldn't take that as written in stone lolz
Oh yeah If i dont see any changes in a long while ill probably just relaunch the game
Still thanks for the help though
Looking for a moder to hire. Me and 9 other PZ YouTubers are currently making a server, and we need to remove this stupid knockback when you get shot. If it will affect zombies as well, that's totally fine for us. DM me
Can you really call it hiring though, when you're not actually offering payment? aha
now we are
some guy donated me to help with the server
cool cool, best of luck then :3
was going to ask if this was some kind of a favor or a real job, but i didnt feel like for some reason
its actually interesting there are so many ways to make some money, like i'd never imagine somebody would ever get paid for modding on zomboid but here we are
best of luck bro
i'd like to if i had enough knowledge but im just a newbie
yeah, I only knew because they posted the same message roughly, last night too, but when I asked at that time, they weren't offering compensation.
I also would take a look at it, but I feel like it'll be taking up more time than I have, while I'm in the middle of something else rather huge currently.
four more shirt decals before i'm done for tonight lol i think the woodcraft one is very fitting
Mod I am working on for a server: https://www.youtube.com/watch?v=nzSkk5nglwM
that sure is interesting
does this wipe the current as well? does it ignore safehouses? or is that the goal?
sorry for questions, just pretty awesome
It wipes if there are less than the number of items configured in the container (in the gui). Yes, it ignores safehouses, and only refills original containers. It uses the same lootspawn table as well, so it follows the sandbox settings.
Was not too hard really, I just hi-jacked the "right-click -> refill" admin thing
then I remove items based on the settings
yea it's still a straightforward way and you make it easy haha. that's really the part
the worst part is delays to wait for network shit, like chunk loading, and container item sync
nice job though
I need to a way to export the log to a file (so it can be reviewed by QA team and such)
pretty sure you can write to a file"?
Yeah, just need to think about it.. like CSV maybe?
a list of X,Y,Z and items spawned
maybe container name
sure, i think it's really based on how you'd utilize the data i suppose
csv is easy to whip into a spreadsheet quick lol
just depends on how the data ends up being formatted i suppose
and its plaintext searchable too
I โค๏ธ CSV's
You can pipe a CSV into grep like ๐
lol
Future respawn ideas is car cleanups and burned out cars
like, delete any car that has been stripped and randomly spawn in another one in somewhere else
oh nice thats very doable. pretty sweet also. lol essentially a live chunk cleaner instead of wiper ๐
Yeah, at least on our server we have random lore all over the map
Nice
Ill add this to the tool list when its done
Is it possible to refil container that has been grief
very fancy
already did most of the legwork for that..
His respawning container loot
would just need to change the parameters from "unseen for X time" to "condition < X"
read what i replied to lol
Ahh sorry lol
Just woke up
That vehicle respawn is useful but the print tho ๐ญ
anyway @robust briar if you need that feature it would not be too hard to add it as an option
i swear it's on my list
:p
look
literally on the list
lol
Thnk you
that's the short list too
i had big depression times through most of december/early jan
so i wasn't super productive in that time
fell behind on a lot of stuff, and then found out sandbox options are bork and other nonsense
I understand. Please take care of yourself and try to avoid getting stressed out cuz of pz
sorry for your troubles lately and i also apologize for changing topic as well but i must ask. if there a way to just generally speaking add a timed action with no parameters except the time itself? i don't fully understand when i am reading it
i want to control craft speed by sandbox option but i can just use OnCreate maybe to add a timed action before completing craft
?
i tried using getTimeToMake() for recipe but it seems it only returns a value and can't be set or i dont know how to use it properly
then i saw ISCraftAction:new(self.character, items:get(0), recipe:getTimeToMake(), recipe, container, containers)
No setter ? Thats a shame
see that second one though
actually i mean this one
ISCraftAction:new(playerObj, selectedItem, recipe:getTimeToMake() + additionalTime, recipe, container, containers)
Your workaround sounds spot on . Well atleast for me it is
Yes whereas additional time = sandbox var
i'm trying to see if i can alter it without having to call player or selectedItem though
exactly is my thought. but setting player and selectedItem to nil doesn't work and i don't know how to skip them without calling them nil
lol i dont want to write moreee
at this rate though i have literally almost everything thought of
Bet you didn't think about being able to craft different coloured light switches, to control the light colour ๐
haha already in
unless you mean it working a different way
you can use battery connectors by sandbox option level, also a setting to disable players from installing them.
this is my potential workaround for not being able to control craft speed by sandbox option. using OnCreate lua
local switchSpeed = SandboxVars.Nipswitch.Craftspeed
function Recipe.OnCreate.Switch(items, result, player)
ISCraftAction:new(player, items, switchSpeed-1)
player:getAnimNode("Disassemble")
player:setProp1("Screwdriver")
player:setProp2("lighting_indoor_01_0")
player:getInventory():AddItem(result)
player:getEmitter():playSound("VehicleHotwireStart")
end
``` here's hoping it works lol
hoping the sound doesn't play forever ๐
fail, well tweak this a little. someday i won't be incredibly slow at this
you're welcome
@red tiger i had this idea that we should start a thread about other programming related stuff . Idk
?
that would actually be pretty cool to see all the updates and stuff in one place to reference. i like seeing them here or anywhere, but having them all together would be pretty sweet
also good way for people to know the extra tools available for modders that aren't the standard tools you'd use
jeez... goodluck with that
Ooof Just contact authorithies and let them do the tracing thing i'd say
This is an odd question- I remember an ammunition foraging focus, but cannot seem to find any reference to one. I am playing on a server with alot of mods, is there a mods that adds this?
Philippine governmebt is way too corrupt
I ment to keep this private but i guess i hope someone here reads this msg and decide to help.
Hey deleting the file will not delete it on servers that already run your file. You may instead want to leave the file in your mod but empty it of code for compatibility.
I know right haha
Just wanted to warn you
Unfortunately deleting a file can cause probs
Any good mod tutorials and resources out there?
Check the threads @rustic garnet
Its literally almost every resource out there
Also for the client scripts if you want it to work multiplayer can you still use getPlayer or do I need to loop still through the connected players and getSpecificPlayer?
Thank you! Didn't notice the thread ๐ฎ
If you want local then getPlayer()
If 0, 0, 0 is a defined square
0, 0 may have no definition
Idk for sure
No one does
anyone know of a way to set a timed action with only using time, player, and item as my arguments? or another way to add a timed action to OnCreate D:
Will that work on servers still though? I assume so since it's client side
Perhaps have a messaged pinned? So that you know to go there?
Also thanks the Resources Thread is fucking nice!
Yes
I suggest looking at vanilla and other mods(use as reference ONLY dont copy unless prrmitted to)
I'm pretty sure you can create a custom timed action with any arguments
Why wouldn't you be able to?
Hes just asking if its a good idea i think
lol no idea i can't figure it out inside the recipe function yet
any square that is not loaded, will return nil
not saying much ๐
Start with ISReadABook and edit replace ISReadABook with NippinAround
You have to call it NippinAround or it won't work though he lied, laughing
was trying to use ISCraftAction:new(player, nil, switchSpeed-1)
I mean is crafting your goal?
I see then you could dulicate ISCraftAction and edit that instead
but i can't figure how to change that with sandbox only by manually setting in script
To make your own similar action with new requirements
Uhh TimedAction must be written in Lua
My suggestion didnt work?
yes i'm using OnCreate
function Recipe.OnCreate.Switch(items, result, player)
local switchSpeed = SandboxVars.Nipswitch.Craftspeed
ISCraftAction:new(player, nil, switchSpeed-1)
player:getAnimNode("Disassemble")
player:setProp1("Screwdriver")
player:setProp2("lighting_indoor_01_0")
player:getEmitter():playSound("VehicleHotwireStart")
end
That is triggered by the onceeate
getting error atm
o.time=defaultTime+sandboxvar
Have you tried this?
I believe ive done something like this before but not sandbox
Someother variable based on the trait and its tested by the oncreate or context menu cant remember
no idea. ill try it
๐
it doesn't need to be ISCraftAction though
๐ฎโ๐จ back to work
i just thought it lined up and would have easily worked but i'll try something more straightforward maybe
you can intercept craft action new and edit the returned obj maxTime
just an idea if you have trouble with other options
@drifting ore What exactly is your modding goal here?
Just a craft action with a modded duration?
with a duration set by server owner via sandbox. totally not needed whatsoever but also realized it's the last piece to making it pretty much fully compatible with anyone's setup also
someone mentioned issues with me using a book, so i made page length an option. and it kinda spiraled from there
this is literally the most unimportant option of them all but if i can figure it out, that would be cool also ๐
i still have to figure out how to change the light strength on the fly as well so i can create a sub context menu that lets you change the strength of the lights radius as well... 0 idea if that's even possible but i'm sure half of my day tomorrow will be messing around with it
I've gotten 90% done thanks to many great minds and a ton of my time researching and learning ๐ . still extremely noob when it comes to all this
Light radius on what light?
lightswitch
Ah. Depends on where lightswitch code declares its light in vanilla
i think i can use spritemanager
and properties
ignore the above*
not 100% but i'm going to mess around with it here next if i figure out the craft speed thing or give up on it ๐
thanks to poltergeist writing that overwrite to PickUpLevel array thing. i was able to actually use it also
somehow it only has 1-5 in vanilla...
setLightPower() is what i actually meant
not sure where i thought i saw it before lol... but yea that's what i figured i'd be using to do it
And you want it to affect duration for all crafting?
in this case it's going to be limted to 2 recipes
OnCreate:Recipe.OnCreate.Switch, inside each recipe
will contain my timed action and all the other fun stuff
Mmm. I see. So you're already firing that event successfully? What does that function look like?
And is Recipe.OnCreate.Switch a vanilla override or what?
it's not firing correctly but will when i get the timed action setup correctly haha. this is what i'm going to try next. using global function and just calling it inside the other function in the oncreate
it's not technically an override
it's just a new function instead of using a limited one inside or recipe script
this is my new function im going to try
But does the function get called? Are you that far?
function SwitchCraftAction:new(character, item, time, recipe, container, containers)
local craftSpeed = SandboxVars.Nipswitch.Craftspeed
local originalTime = time
local modifiedTime = originalTime -- add 30 seconds to the original time
local o = {}
setmetatable(o, self)
self.__index = self
o.character = character
o.item = item
o.recipe = recipe
o.container = container
o.containers = recipe:isCanBeDoneFromFloor() and containers or nil
o.stopOnWalk = recipe:isStopOnWalk()
o.stopOnRun = recipe:isStopOnRun()
o.maxTime = modifiedTime
if character:isTimedActionInstant() then
o.maxTime = craftSpeed
end
o.jobType = recipe:getName()
o.forceProgressBar = true
return o
end
yes
getting error atm
because im not using the vanilla one the way it wants
so im just making a new one
Your action should really be PascalCase not camelCase
It's an object class
It's pseudo OOP
so cap first letter?
appreciate that
You'll see every single object class in the game works that way
prefer to learn it right way from start
Every TimedAction
(Including TimedAction which is itself also an object class)
(hence not timedAction)
i'm assuming if i use my sandbox option for max time. all this convolution ends up turning it into time
local originalTime = time
local modifiedTime = originalTime -- add 30 seconds to the original time
local o = {}
setmetatable(o, self)
self.__index = self
o.character = character
o.item = item
o.recipe = recipe
o.container = container
o.containers = recipe:isCanBeDoneFromFloor() and containers or nil
o.stopOnWalk = recipe:isStopOnWalk()
o.stopOnRun = recipe:isStopOnRun()
o.maxTime = modifiedTime
This snippet sets maxTime to the original time.
Ohhh I see you redo it
yes. vanilla added 3 secs
Weird
o.forceProgressBar is likely pointless, all Timed Actions show progress bars unless someone makes them stop doing that with code that will likely ignore your flag.
as long as it ignores lol.. about to test it now here
What error do you get?
function Recipe.OnCreate.Switch(items, result, player)
local switchSpeed = SandboxVars.Nipswitch.Craftspeed
ISCraftAction:new(player, nil, switchSpeed-1)
player:getAnimNode("Disassemble")
player:setProp1("Screwdriver")
player:setProp2("lighting_indoor_01_0")
player:getEmitter():playSound("VehicleHotwireStart")
end
``` error was with this in vanilla and it was getting caught up somewhere int he vanill function
testing for craftfromground = true
so i'll try this for now and see if it works lol. going to cut all this stuff out except item and time
Can you screenshot the error?
Also that is not how you use a timed action
but setting that aside
hahaha
I need to see your TimedAction code in its entirety
yeah ๐คฃ
To see if it's even constructed correctly
lol
And seeing the error would help
-- or Module.action =
local action = DualWieldAttackAction:new(player, WDW.lefthandWeapon[player])
ISTimedActionQueue.add(action)
@drifting ore
The Queue fires your timed actions
I think what you try to do would be smoother if you remove the recipe part and use context and your time action?
ahhh. alright. and yea it would but i'd like to kee3p it in line with how vanilla works for the most part
adding a perk level requirement to reading the book and other things ended up working out and was a great learning experience but i'm hoping to really try to figure this out all using the recipe and OnCreate if i can.
or OnCanPerform, but this seemed to fit better under OnCreate
If your code is calling Recipe.OnCreate.Switch(items, result, player) and providing you with that input, you can do virtually anything with it
This
do i need all 5?
derive from craft action maybe
thank the gods lol
So what is the OG craft action called again?
not 100% sure what you mean
SwitchCraftAction = ISCraftAction:derive("SwitchCraftAction")
It's called ISCraftAction, looked it up
That would give you all of ISCraftAction's functions
And THEN you redefine :new and you're golden
However
Your action requests a recipe, a container, and containers, and presumably needs them
can player be the container? lol
what is also the diff between each? i dont get that
that part confused me
Probably not. I am not sure of the precise nature of the recipe object or where to get it... you may be able to get your container from the items object. I would look up an example of vanilla calling ISCraftAction:new and see where vanilla grabs its data / what kind of data it grabs.
hm, derive from craft could cause issues, maybe you need base action instead.
e.g., in ISInventoryPaneContextMenu.lua:
local action = ISCraftAction:new(playerObj, selectedItem, recipe:getTimeToMake() + additionalTime, recipe, container, containers)
Where
local containers = ISInventoryPaneContextMenu.getContainers(playerObj)
local container = selectedItem:getContainer()
recipe:getTimeToMake is time Arg
and selectedItem very well may be your items variable at a glance.
its not bad tabbing its intentional the player isnt on the Z1. his just on the Z0.. i nead to make it move on the Z1 any ideas??? pls help
or something related
And recipe may be result in your code, but idk for sure
You would need to do some printing
I have no idea what kind of object recipe and result are without printing them
i might check if thers a floor on the z1 if there is then move like that animation on the ground
yea i'll run prints
Vanilla naming standards are problematic at best and not well-enforced.
before i go too deep into this also, anything that is bad enough to where i shouldnt even use it?
Is it player or playerObj? playerIndex or player? Which kind of player is it? Questions like these . . . should not exist. ๐
Why?
it prints 0
lol... the player
I already could have told you that
In this case player means playerIndex
(and I would rename it accordingly in anything I do)
sorry i am getting tired also so i'm not as quick to the draw ๐
(because calling player objects "player" in some contexts and calling the player index "player" in other contexts is whatever the opposite of smart is.)
I asked for result and recipe... I'm not sure on those.
I knew player was 0 because of this:
local playerObj = getSpecificPlayer(player)
This is how the game received a 0 for player and turns it into an object sometimes
When they don't use
local player = getSpecificPlayer(playerIndex)
(the latter of which I greatly prefer)
Using "player" as a name for an index just looks bad to me and seems counterintuitive.
Come to think of it
Your CraftAction probably requires a player object.
yes it does
ISCraftAction uses character which more consistently expects an object in vanilla
Not an index
Therefore you need getSpecificPlayer(player) as part of your call, or you need to rename player as playerIndex and use local player = getSpecificPlayer(playerIndex) and use player from then on.
okay restarting again now and trying to see if it prints other stuff
Please help
๐
RecipeManager calls and possible duplication of already done functions
So I'm thinking this:
function Recipe.OnCreate.Switch(items, result, playerIndex)
local switchSpeed = SandboxVars.Nipswitch.Craftspeed
local player = getSpecificPlayer(playerIndex)
local action = SwitchCraftAction:new(player, items [[???]], switchSpeed - 1, result [[???]], container, containers)
ISTimedActionQueue.add(action)
player:getAnimNode("Disassemble")
player:setProp1("Screwdriver")
player:setProp2("lighting_indoor_01_0")
player:getEmitter():playSound("VehicleHotwireStart")
end
Something like that
but you need to figure out some deets there
Obv
What is container, what is containers, if they are even necessary
Is result the recipe
etc.
So it's not finding that function by that name
The function never gets called
Idk how to properly link a recipe to an onCreate function
Someone else may know that step
Never done that.
hmmm
I would imagine you would just type the proper name of the function if it's global
Huh? Just copy the vanila oncreate code
Yes and how is Recipe declared in your Lua?
You created this function, right?
function Recipe.OnCreate.Switch(items, result, playerIndex)
This function is inside a module named Recipe
How is that module defined?
Are you using a vanilla module?
here
function Recipe.OnCreate.Switch(items, result, player_num)
local switchSpeed = SandboxVars.Nipswitch.Craftspeed
local player = getSpecificPlayer(player_num)
SwitchCraftAction = ISCraftAction:derive("SwitchCraftAction")
--SwitchCraftAction:new(player, result, switchSpeed, Recipe.Switch, nil, nil)
local switchCraftAction = SwitchCraftAction:new(player, result, switchSpeed, items, nil, nil)
player:getAnimNode("Disassemble")
player:setProp1("Screwdriver")
player:setProp2("lighting_indoor_01_0")
player:getEmitter():playSound("VehicleHotwireStart")
local player = ...
local result = ...
local switchSpeed = ...
local Recipe = ...
print("Player:", player)
print("Result:", result)
print("Switch Speed:", switchSpeed)
print("Recipe:", Recipe.Switch)
print("Switch Craft Action:", switchCraftAction)
end
i can also just delete the nil completely in theory? iu understand if it comes before i may need it to call nil, but after?
this is called here btw
module Base
{
recipe Right Light Switch {
keep Screwdriver,
keep Wrench,
keep Scissors,
Wire=10,
ElectronicsScrap=25,
DuctTape=4,
Screws=10,
Prop1:Screwdriver,
Prop2:lighting_indoor_01_0,
NoBrokenItems:true,
AllowOnlyOne:true,
OnGiveXP:Recipe.OnGiveXP.DismantleElectronics,
AnimNode:Disassemble,
Sound:VehicleHotwireStart,
OnCreate:Recipe.OnCreate.Switch,
Result:lighting_indoor_01_0,
CanBeDoneFromFloor:TRUE,
NeedToBeLearn:true,
Time:1.0,
Category:Electrical,
}
recipe Left Light Switch {
keep Screwdriver,
keep Wrench,
keep Scissors,
Wire=10,
ElectronicsScrap=25,
DuctTape=4,
Screws=10,
Prop1:Screwdriver,
Prop2:lighting_indoor_01_0,
NoBrokenItems:true,
AllowOnlyOne:true,
OnGiveXP:Recipe.OnGiveXP.DismantleElectronics,
AnimNode:Disassemble,
Sound:VehicleHotwireStart,
OnCreate:Recipe.OnCreate.Switch,
Result:lighting_indoor_01_4,
CanBeDoneFromFloor:TRUE,
NeedToBeLearn:true,
Time:1.0,
Category:Electrical,
}
}
If the nils aren't needed by the action, yes
ahh gotcha
But if they are assumed to exist, they may call functions on themselves
And if they are assumed to exist in the action code and do call functions on themselves
But you didn't provide them
Your computer will actually burst into flames
That's what really happens, it's science.
okay going to try this then
function Recipe.OnCreate.Switch(items, result, player_num)
local switchSpeed = SandboxVars.Nipswitch.Craftspeed
local player = getSpecificPlayer(player_num)
SwitchCraftAction = ISCraftAction:derive("SwitchCraftAction")
--SwitchCraftAction:new(player, result, switchSpeed, Recipe.Switch, nil, nil)
local SwitchCraftAction = SwitchCraftAction:new(player, result, switchSpeed)
player:getAnimNode("Disassemble")
player:setProp1("Screwdriver")
player:setProp2("lighting_indoor_01_0")
player:getEmitter():playSound("VehicleHotwireStart")
local playerr = ...
local resultt = ...
local switchSpeedd = ...
print("Player:", playerr)
print("Result:", resultt)
print("Switch Speed:", switchSpeedd)
end
i had capital letter issue
think that might be why it didnt call the function...
i fixed those prints also since i fixed them on my end also
so not keep calling same loca
THIS line is used to create an object class, which is a class that gets used to create instances of objects.
When you have an object class, you use it to create instances of objects that inherit the features of that defined class.
i thought i was deriving so it would use it's own
So if you have Dog = Animal:derive("Dog"), then Dog acquires the characteristics of an animal, but neither Dog nor Animal refers to a SPECIFIC dog or animal
They refer to the TYPE of thing and the characteristics that such a thing would need to define
So SwitchCraftAction = ISCraftAction:derive("SwitchCraftAction") creates a TYPE of a thing called a SwitchCraftAction
It does NOT create the thing itself.
It does NOT create the action you need in the Queue.
is there a particular reason why mods have trouble with audio falloff range? it seems like the audio is at full volume no matter how far you are from the action
When you WANT such a thing (an action for the Queue), you need to do something like:
local switchCraftActionThatINeedToQueue = SwitchCraftAction:new(player, result, switchSpeed)
i dont think audio falloff is implemented in all or many things
omg
i see what you mean
but how about custom weapons? wouldnt it be basically done for you already
This creates the action of the appropriate type.
.
so i have to use it how it's designed no matter how it's being used/called
argh lol okay well i guess there are a couple concepts i'm sturggling on picking up
and these are the things i've spent the most time researching

It is not trivial. People are given months or a year to digest these fundamentals in school.
But you do need to internalize it to use TimedActions correctly.
As they are heavily OOP
(In fact this game's Lua is heavily object-oriented)
So knowing your classes from your instances is crucial
Generally speaking the game does respect the standard of using camelCase for instances. This is reflected e.g. in ISTradingUI.instance, ISSafehouseUI.instance, ISFactionUI.instance, etc. The classes containing the instance objects above (which are sometimes called object classes because they're used to make objects, as opposed to a static class which is just accessed directly as a library of functions) is PascalCase, but the instance itself is camelCase.
so the object is the instance of class and the class is like what tells it how it's going to work?
Yes
And "object class" really just means "class", but the kind used for making objects.
Hopefully one of these ways I've said it is clear... Haha
yes. i may not grasp every single thing you are stating here. but i assure you while im doing more research and learning, i will reference back to this stuff and lightbulbs will happen
i do get a majority though
Putting the instance of an object class IN an object class is pretty unusual practice in OOP though, just FYI... the game sort of has a hybrid approach here, where the classes used to make objects also provide static references to the last object they made sometimes.
been struggling finding a good source of knowledge that isn't the lua handbook since it still feels like the subtle difference in just standard apis and usage. i just dove right in
Also, I think Zomboid Lua is pretty heavily influenced by Java practices, soooo there's that to consider.
It's a unique context so I wouldn't really expect it to 100% generalize.
yea i noticed i can call java functions and variables straight from lua
still wrapping my mind around how this works exactly also. keep in mind.. (hate to be that guy also) but i hadn't typed a string of code until around a month ago. so even little things that help me understand are appreciated
Yes. You will also notice that the java functions (that are written by people who knew what they were doing) are all camelCase because Java has very clear, publicly declared standards on that.
Unlike Lua, which is a bit of a cluster because it hasn't even told people whether to write simple variables in snake_case or camelCase.
Let alone all the other standards it would be wise to declare.
snake_case 
You will see a lot of Lua floating around the internet that DOES favor snake_case @drifting ore, however, I would strongly discourage it in this context, because you're literally fighting the standards of the game and sowing confusion and inconsistency in new people who follow your code by doing so.
I try my best to be consistent

