#mod_development
1 messages ยท Page 139 of 1
so ill just use player instead
๐
wow, thanks chuck
that was a huge help
learnt new things today
better me today than yesterday xD
I am having some trouble here. I want replace a vanilla tile texture, everything is made. I just cant for the life of me figure out how i need to pack it for it to work. Any help is appreciated โค๏ธ
is anyone able to let me know why this isnt working? Im trying to make a mod which removes sunday driver after a certain amount of time but it isnt removing the trait
`local ttr = 90
function CheckVehicle(player, vehicle, args)
local player = getSpecificPlayer(0)
if player:isDriving() and player:HasTrait("SundayDriver") then
ttr = ttr - 1
if ttr <= 0 then
player:RemoveTrait("SundayDriver")
end
end
end
Events.EveryOneMinute.Add(CheckVehicle)`
I'm having a very weird problem. I am modifying a recipe like so:
if modList:contains("86oshkoshP19A") then
script:getRecipe("Make Side Spare Tire Mount"):setCategory("KI5")
...
which is loaded like so:
recipe Make Side Spare Tire Mount
{
BlowTorch=5,
keep WeldingMask,
SmallSheetMetal=4,
SheetMetal=4,
Screws=1,
Result:P19ASpareMount1_Item,
Time:750.0,
Category:P19A,
SkillRequired:MetalWelding=6,
OnGiveXP:Recipe.OnGiveXP.MetalWelding25,
}
But the game immediately gives me a null error. I'll pull it up in a bit
the previous lines work just fine, up until my lua script performs this line
it is IN the game, why is this happening
-----------------------------------------
STACK TRACE
-----------------------------------------
function: KI5CraftingUnifiedRecipePatcher.lua -- file: KI5CraftingUnifiedRecipePatcher.lua line # 22 | MOD: Unified KI5 Crafting Category.
[24-03-23 22:32:34.744] ERROR: General , 1679722354744> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: setCategory of non-table: null at KahluaThread.tableget line:1689..
it's not null... ๐คฆโโ๏ธ
you might need to include the module
module is Base tho
probably not then

script:getRecipe("RunFlat.Make Side Spare Tire Mount"):setCategory("KI5")
how do I include the module exactly
i think that's good
we'll see !
i'll get the source up just in case
sweet, it works
nice!
feels very weird with the spaces in there, alongside the module dot
thanks alot man ahah i didnt notice
hmmm, new problem: how do I get the first index of a Java Array? Will [0] work in this case?
dupeList = script:getAllRecipesFor("Make M747 4 Tire Axle 1") -- should return 2 recipe objects
dupeList[1]:setCategory("KI5")
dupeList[2]:setCategory("KI5")
you want to use :get(), not [] and yeah, count from zero
gotcha, thank you
a useful snippet for that kind of thing is
for i = 0, array:size()-1 do
local item = array:get(i)
end
I'll have to use a for loop later for some shared recipes, so I'll use that
darn, the loop isn't working with recipes
what kind of syntax highlighting suits the most in VSC for .txt files with items definitions?
@red tiger you have a new client
look up "ZedScript" in the VSCode extensions
if that is what you are using
custom made for PZ's texts, because they are unique syntax
got it working, thanks a lot
It's a work in progress
Glad to be your free Q/A guy then
Building in the docs and auto fill ATM.
but yeah, this isn't working
for i = 0, dupeList:size() - 1 do
local recipe = dupeList:get(i)
recipe:setCategory("KI5")
end
getAllRecipesFor takes the name of an item, it finds all recipes that make that item
why shouldn't getting each Recipe object by its index in the ArrayList not properly update then?
it seems like you're putting in the name of a recipe, not the name of the result item
ohhhhhhh shoot
if you want to get all recipes by a certain name, i think all you can do is loop through the entire recipe list (if it fits your case, please just for that module), and check the name in the loop
Sorry for question but how can i add an item inside a container (backpack) in lua.
yeah i figured
my problem: some recipes are in Base
i think I will instead look for the result item, since most of these duplicate recipes are for one item but use different resources to craft
you're trying to move all the recipes you're changing into the same category right? something like this might make things easier
local wantedRecipes = {
["Make M747 4 Tire Axle 1"] = true,
["Another Recipe Name"] = true,
}
local recipes = ScriptManager.instance:getAllRecipes()
for i = 0, recipes:size()-1 do
local recipe = recipes:get(i)
if wantedRecipes[recipe:getOriginalName()] then
recipe:setCategory("KI5")
end
end
hmmmm pretty elaborate
I'll use this then, thank you again
i think instead of making the whole recipe list, ill append the recipes I want to that list so that the for loop runs faster
how is this?
local recipesToModify = {}
if modList:contains("67commando") then
recipesToModify["Make Commando Viewport"] = true
...
i actually have no idea if it's faster to check mod ids or not, so whichever works
no, checking the mod ids will definitely slow it down, but in the case of a person only using one mod, their game won't have to consistently check for recipes that don't exist
clean code execution rather than speed ig
because the entire code operation is bloat
curse that KI5
my guess is that not checking them and just having the entire table populated regardless would actually be faster
since :contains() is a java method, i would guess that any performance lost from having a bigger table to look the name up in would be made up for by how slow lua-java communication is - but it's pedantry, and it's not during gameplay so who cares
hmm that's true
i also realized that some mods have the same recipes and making exclusions to check for multiple mods if they are enabled for one specific recipe is stupid
big fat masterlist it is
the method is getOriginalname() on the docs. is this right?
https://projectzomboid.com/modding/zombie/scripting/objects/Recipe.html#getOriginalname()
declaration: package: zombie.scripting.objects, class: Recipe
ah, that's right
well, running that code on vanilla recipes only took my computer 1 millisecond (and it's only counting in milliseconds), so performance probably isn't a massive concern either way
awesome, thanks for checking
i finished adding all the recipe names I have so far into the list. time to test it ๐
amazing, took no time at all and everything I intended
nice!
even code-monkeying the recipe list is easy. duplicate template, insert recipe name, continue
Need some insight: I have a lot of mods and I don't like it tbh. Some are very specific that are basically tailored for myself, only public for others that might care. I would like to consolidate those specific mods into one "Miscellaneous Tweaks" mod that just includes everything. I would then document every change I have made in it, and give others permission to upload their own separate versions if they wish to do so.
Are there any flaws to this?
Hi! Need some help. I made this item,
item MightyHammer{ DisplayName = Mighty Hammer, Icon = MightyHammer, WorldStaticModel = MightyHammer, Weight = 0.5, }
and this function.
function OnObjectPickedUp(tileObject, player) if tileObject:getItem():getType() == "MightyHammer" and not player:hasPerk("Carpentry") then player:getXp():AddXP(Perks.Carpentry, 75) end end
how do I attach this function to the item?
function myUniquelyNamedFunction(player, item)
if item:getType() == "MightyHammer" and not player:hasPerk("Carpentry") then
player:getXp():AddXP(Perks.Carpentry, 75)
end
end
Events.OnEquipPrimary.Add(myUniquelyNamedFunction)
I have a kinda similar thing to that
function OnLoad() Events.OnObjectPickedUp.Add(OnObjectPickedUp) end
i used this but it doesnt work
you do not need that in a function
because then you are calling a function to call a function
just put the event function append at the bottom of your lua script
it'll auto load on start
made a few tweaks, and it finally worked thankyou!
last question, is there an event for when an item is picked up by the player? like, if it's grabbed and goes into the inventory
i am looking at the wiki and i dont see something like that
i didn't find one either. The closest things were the events related to filling the context menu, using what is in the player's inventory
You likely need to find what gives the ability to execute lua code when a specific item is picked up, using the item scripts
similar to Food type items using the OnEat field
what will be the best way to play a sound for everyone in a region
in a MP
getSoundManager():PlayWorldSound('pumpaction', getPlayer():getSquare(), 0, 500, 50, false); ```
this doesn't seem to work in MP
because of getPlayer():getSquare()
getPlayer() only works on client & solo
you need a specific player, to play that sound on the server
is the code client-side or server-side?
it was player:getSquare()
i think it needs to be server-side
i sent it through sendclientcommand
gotcha
and put the code inside the server side
test it ๐
local perform = function (module, command, player, args)
print(command)
--local command = {};
if module == "Quest" and command == "generatormission" then
getSoundManager():PlayWorldSound('pumpaction', player():getSquare(), 0, 500, 50, false);
getSoundManager():PlayWorldSound('bigExplosion', player():getSquare(), 0, 500, 50, false);
print("recieved code from client with "..command)
local X = player:getX();
local Y = player:getY();
local Z = player:getZ();
chunk1 = player:getChunk();
VirtualZombieManager.instance:AddBloodToMap(44, chunk1)
VirtualZombieManager.instance:createHordeFromTo(X+50, Y, X, Y, 80)
VirtualZombieManager.instance:createHordeFromTo(X+50, Y+5, X, Y, 80)
VirtualZombieManager.instance:createHordeFromTo(X, Y-80, X, Y, 150)
VirtualZombieManager.instance:createHordeFromTo(X-50, Y, X, Y, 80)
VirtualZombieManager.instance:createHordeFromTo(X-50, Y+5, X, Y, 80)
VirtualZombieManager.instance:createHordeFromTo(X, Y+50, X, Y, 80)
end
end
Events.OnClientCommand.Add(perform)```
so this is the whole thing
and i tested it on dedicated server
zombies spawn fine
just the sound doesn't play
remove the parentheses in player()
you need to reload lua
local perform = function (module, command, player, args)
print(command)
--local command = {};
if module == "Quest" and command == "generatormission" then
getSoundManager():PlayWorldSound('pumpaction', player:getSquare(), 0, 500, 50, false);
getSoundManager():PlayWorldSound('bigExplosion', player:getSquare(), 0, 500, 50, false);
print("recieved code from client with "..command)
local X = player:getX();
local Y = player:getY();
local Z = player:getZ();
chunk1 = player:getChunk();
VirtualZombieManager.instance:AddBloodToMap(44, chunk1)
VirtualZombieManager.instance:createHordeFromTo(X+50, Y, X, Y, 80)
VirtualZombieManager.instance:createHordeFromTo(X+50, Y+5, X, Y, 80)
VirtualZombieManager.instance:createHordeFromTo(X, Y-80, X, Y, 150)
VirtualZombieManager.instance:createHordeFromTo(X-50, Y, X, Y, 80)
VirtualZombieManager.instance:createHordeFromTo(X-50, Y+5, X, Y, 80)
VirtualZombieManager.instance:createHordeFromTo(X, Y+50, X, Y, 80)
end
end
Events.OnClientCommand.Add(perform)```
server restarted
also remove the semi-colons tbh, you don't need them (you are already not using them in some lines)
yea true, u r right
interesting
i had this played in SP and it was playing the sound fine, but in MP it didn't
can getsoundmanager b only working on client side?
good suggesting
to time it right, you can try sending a client command back to the player
so... sendservercommand?
but woulnd't that only be recieved to the 1 player who is performing the action?
but not everyone will be able to hear the sound unless you send commands to everyone
i wanted to b played in everyone on the region
yeah, whichever is the one that is "server sends commands to clients"
yea eactly my though
then what would b the best way to play it for all online player in the region?
hmm...
a loop
if it is by region, then it should be silent for those not close
because world sound
i hoped there to b a simpler function that would do the magic
๐คทโโ๏ธ
use this as an array
https://projectzomboid.com/modding/zombie/Lua/LuaManager.GlobalObject.html#getConnectedPlayers()
declaration: package: zombie.Lua, class: LuaManager, class: GlobalObject
that is heard by everyone in the region
those sounds are the meta events that draw zombies closer to players
I think they are handled very differently
i see
i will also write the for loop for that array, since I learned how to use them today
haha i really suck at them
like, i still can't figure out how to loop through items in the world
local playerList = getConnectedPlayers()
for i = 0, playerList:size() - 1 do
sendServerCommand(playerList:get(i), "modName", "newSoundCommand", { playerSoundOrigin = player, })
end
is getconnectedplayers() under globalobject class?
i just saw void addSound(IsoObject source, int x, int y, int z, int radius, int volume)
in that glass
class**
hmmmmmmmm
maybe i can try playing it on console
is there mod for more safe hauses?
yep
yea
like i have one but my friend wants to invite me to his one but rn can't due limit of one safe hause per player...
search for it in the steam workshop
bikinitools has one too
addSound('pumpaction',5938, 5354, 0, 50, 50)
that produced error when executed on console...
does this mean that the game can't find the method?
one of the parameters was invalid
try running it through a file to be sure
lua console is kinda wonky
and doesn't know everything about what files are loaded
i see
hmm i guess editing and reloading lua from debug won't help for dedicated server right? since it's in server folder?
ugh.. too much to restart the server..
and update the workshop..
u know what's funny?
getSoundManager():PlayWorldSound('pumpaction', player:getSquare(), 0, 500, 50, false);
this works well on console
so i suppose it's client sided function and can't b executed on server folder
yeah... try doing the multi-send server command
yea, then i guess ill have to do what you suggested, iterate through players
and execute it to all
Finished making this into a neater mess
https://steamcommunity.com/sharedfiles/filedetails/?id=2945800750
ohhhh you were the one who made this?
i am using it on my server
and i was sooooo greatful
made my crafting page lot cleaner XD
thank you for your effort
it seems every day more and more people realize that I made plenty of useful mods lol
next QoL mod is removing the stupid recipes that Tsar's Common Library adds, because I don't use muscle cars from the 2010s !
hahah i support that !
today I finish like 7 things out of the 50 i need to do 
i struggled to add 2 timed actions for 3 days, it's nothing new lol
Good morning all!
good morning
i can't even do 1
timed action seemed confusing
i still don't get when to use
intance, new(), and nothing at all
it's morning? 
you just need to copy one simple action and edit it however you need it
like some needs new() some just .intance and some just directly methods so confusing...
I used a template somewhere, one sec
๐
oh wow... thanks
this will help me greatly
need help
im creating a respawn time of a player when they die .. where can I find the on respawn event
what do you mean by respawn time?? like you want to make them unable to create a new chracter for set amount of time?
is there like a drag and drop for UI ๐ฅน
that's right
then you will have to disable player's death UI
after using
Event.OnDeath
i think that's what's called
or onplayerdeath
Events.OnPlayerDeath
You can find how it's currently set up in ISPostDeathUI:
then I'll add a timer for it to run again
you could try bugging @ Notloc about that, he works with UI
yea
Per player? Total?
per player
Perhaps someone else has a better suggestion, but I think you'd need to store that information server-side. If OnPlayerDeath fires on the server you could use that to increment the appropriate counter and associate with the player (by username, presumably)
For SP it'd be more straightforward
where does the clients datas stores.. ??
On the client machine
ok
I guess it's worth asking what the use case is first, actually
If it's only to display a total death count to the player you may design it differently
I'd personally still probably store it on the server
yeah..
Im using it to to count the nunber clients death in my server
or Ill put it on admin panel .. and add number of death in the database
Maybe global moddata
My Idea is .. when a player dies, Ill disable the function of the respawn button(NEW CHARACTER) and modify its Text to "Respawn in mm:ss".
Minus any server-side syncing you might want to do, you could simply override ISPostDeathUI to have the button disabled by default and enabled when the timer is finished.
i would not advise overriding vanilla files since most mods utilize them as a backbone rather you could call a new Instance of PostDeathUI and call createChildren, there it makes the respawn button. Then you just grab the button and override its onClick function with yours
Or you overwrite the create children functiontbh
Yeah, seems like an override would be appropriate. Could just grab a reference to the respawn button & change its text and disable it (after calling the original createChildren)
and obviously renable it later when its needs to
you could do that with some events tbh although Ive no idea how much time they take
Hey people, is this the right place to ask for mod development support? I am extremely new to modding, and I am currently looking to create a mod of my own. It is a tremendously bigger undertaking than I initially expected, but I am trying to push through
yes
I probably have stupid questions, but In this case, does the "SteamGeneratorLEDs" need to be a texture file? Or what would it be in this context
Good morning.
Hello!
that's something you'll see only in olipro's mods
Yes, I'm trying to edit one of his mods to fit my needs. I have genuinely no clue how to start from scratch
Ah, thanks
If only PZ Lua were modules..
We can only dream
found something interesting in log file... timedactions dont seem to follow normal loading order
How so?
LOG : Lua , 1679725486222> Loading: media/lua/client/TimedActions/ISInsertMagazine.lua
LOG : Lua , 1679725486222> Loading: E:/GameFiles/steamapps/workshop/content/108600/2704811006/mods/Snow is water - v1.3 - Full Version/media/lua/client/TimedActions/ISInventoryTransferAction.lua
LOG : Lua , 1679725486223> Loading: media/lua/client/TimedActions/ISLightActions.lua
LOG : Lua , 1679725486224> Loading: media/lua/client/TimedActions/ISLoadBulletsInMagazine.lua```
mod timedctions get thrown right in the middle of main loading not on the end when all the mod for client get loaded up
Sure it isn't because of their filenames? Those are in alphabetical order, after all
well if I didnt scroll down more to see all the rest of the mods loaded I wouldnt have though it was odd
like all after vehicle...
Ah, gotcha. I think it's because that's an override of a vanilla timedaction, so it's loading when the vanilla ones load
yeah interesting oddity never seen that documented
That's true for all overrides of vanilla files afaik. I believe it loads all of the filenames before actually executing any of them
I was testing all that but I never expanded it that much to think there was some exceptions looks like now gotta do ti all for client and server
well thats the thing I cant find anything that it's overriding
ISInventoryTransferAction.lua
yeah for the mod I cant find that in my game folder
It is there
I wanted to see what it was changing and to a compare but never could find it
Look in client/TimedActions
media/lua/client/TimedActions/ISInventoryTransferAction.lua
Cleaned up a wiki page for the Icon property for item scripts.
Felt the wording and formatting was odd.
I'm surprised that the food state suffix doesn't follow a delimiter like _
Spoiled is also a valid way to specify a rotten icon
odd all that time was trying to look for the java version makes sense why didnt find it.
guess Im just copy and pasting all these lua's by hand one of these days
Why copy paste?
because at this point I dont trust nor can use the method generating it atm
Unsure what you mean by the method generating it
"Spoiled" erasure ๐ข
Isn't that "Rotten" too?
Ya
Is it consequential to use?
Okay cool thx.
I'll get in it more but atm gotta head to work laterz.
Does anyone knows whether the vanilla game takes farming speed into account when giving farming xp? So, giving more xp when farming speed is set to slow or very slow? I checked the code and have the impression that it does not but I am wondering whether anyone can confirm.
Doesn't look like it. See: ISHarvestPlantAction.lua, CFarmingSystem.lua
Adding enum support for my extension API.
Type: {
type: 'enum',
values: ITEM_TYPES,
description: `
${DESC}
Possible types:
- AlarmClock
- AlarmClockClothing
- Clothing
- Container
- Drainable
- Food
- Key
- Literature
- Map
- Moveable
- Normal
- Radio
- Weapon
- WeaponPart
${EXAMPLE}
${CODE}zed
Type = Weapon,
${CODE}
`,
},
Looks like it's missing KeyRing
Maybe none of the scripts actually use it, I just remember it from decoding the save info
Also why does VehicleType use numeric values when they represent String values?
Going to absolutely write into my API support to show the enum names before applying the numeric value.
That really bothers me. =/
this one mod I was editing was adding a type of 94741 or something, he only used it for batteries though.
that made them have special features like display tooltip conditions, naming, etc.
I think that I'm going to use block comments for now.
like VehicleType: 1 /* Standard */,
I don't like the look but it works for now.
My API:
VehicleType: {
type: 'enum',
values: {
Standard: 1,
HeavyDuty: 2,
Sport: 3
},
description: `
Types:
- 1 = Standard
- 2 = Heavy Duty
- 3 = Sport
`,
}
At least people can see what the value is. This will probably be useful for other properties. =/
One day I'll figure out how to do diagnostics so when the value 4 or something is placed, the editor will underline it with a warning.
Auto-gen description enum values & cleaner API. :D
VehicleType: {
type: 'enum',
values: {
1: 'Standard',
2: 'HeavyDuty',
3: 'Sport',
},
},
hmm, i make some patch of true music for my server
i upload to steam
and my server dont install it even i add it in .ini file
does anyone know why?
I think #mod_support would be more appropriate for that question (assuming it's an add-onโjust noticed you said "patch", so disregard this suggestion if it's not an add-on). Checking the logs may help you, though
How do you make all zombies naked /spawn naked?
Spawn you cant till next build
But if you manage to get the zed the. You could do same thing as how you would a player i think
Okay, I donโt know a damn thing about modding but Iโm getting so annoyed by this issue that Iโm going to do it myself. How would I go about adding a trait that keeps the playerโs temperature within a fixed range?
Or rather, keeps them from going above a certain point, I keep dying to fever because of random body temperature fluctuations with seemingly no cause.
I keep telling myself that I need to go to eat lunch but I keep coding.
lol.
I'm converting over my sets for properties to an improved API.
this is either a mod problem or diet problem. Do not eat unknown mushrooms.
I hadnโt even eaten anything yet, I spawned in ten minutes ago after my most recent death from the same thing.
And I canโt think of any mods we have that would possibly do anything with player temperature.
Iโve posted about this in #mod_support in the past but Iโve gotten to the point where I just want to do something about it myself.
are you wearing a bunch of layers in summer?
Perhaps a modded item is too insulated
there's a sandbox option to make your world hot, but it sounds like a broken mod to me
i don't think it goes that hot
None of my friends are having this problem is the weirdest part of it
You're on SP?
I would copy your save and slowly turn off mods to figure out what's going on
Multiplayer, and Iโm not even the host so Iโd have to wait for the host to update our collection to have a complete mod list.
My VSCode extension is now updating & validating on the marketplace.
=)
Adding all the changes.
is it possible to completely build recipes from lua?
yeah
like a RecipeProducer API?
What I'm suggesting? Yeah.
I'm not seeing a way to do it under script manager
RecipeManager
but recipes area under scripts 
i think ScriptManager.instance:ParseScript(string totalFile) is what you're looking for
Put a bunch of small mods together so they take up less space in my sanity
https://steamcommunity.com/sharedfiles/filedetails/?id=2952327208
if you use tags you'll also need to call the on lua function or you could obviously just generate that before you try parsing it
#selfpins script parse, recipes, etc
Wouldn't it be cool if you could Ctrl click a item name in a script and go to the definition?
It's going to be fun showing you all this feature when I implement it.
O_O
incl. modded?
Project scopes could be referenced as paths.
i meant from like.. installed mods
I could perform a scan and store info for mods and vanilla scripts.
that'd be super useful
I thought it would be cool but how useful would it be over being cool?
Being useful is sort of how my priority list works. xD
well i regularly patch and tweak existing items from other mods
as a server owner
so being able to in any fashion locate them quicker than going to the folder and doing a string search and then navigating to the path
that'd be lovely
Makes sense.
Adding settings right now for existing features.
Would you consider adding auto-formatting to your ZedScript plugin maybe? Just aligning the parameters would help with readability imo. i.e.
module Base {
item Fisticuffs {
DisplayName = Bare Hands,
DisplayCategory = Weapon,
SwingAmountBeforeImpact = 0.05,
...etc... = value
}
}
I technically already have a prototype, one for inline braces even.
Hahah
It's not in the extension though.
Do you want me to go ahead and take a look at that next?
No need, I'm happy with knowing its a thing being done. haha. I don't have too many scripts going really, and what I do I formatted that way myself. Was just trying out your plugin, pitching an idea.
That prototype formatter alphanumerically sorts properties.
that's handy. although, can that part be disabled? I am trying to keep parameters organized for my scripts. i.e. all things related to damage are in one section, range in another, keep order that way.
Nice! Thanks!
(Resumes slamming head into keyboard to make magic happen)
Omar you awake?
I never ping ppl, nothing ws saying done.. back... as for why extract the lua's because well unless I can see them normally not with special compiling means... kinda explains itself as I said Im starting to not trust the source.
The .lua files are just stored as .lua files in the media subfolder of the game folder, so I'm a bit confused
since I dont have such a thing in my game folder so am I.
Assuming default (or what I think is default?) installation location on Windows: C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\lua
grrr I wsa still in zombie....
ya know that place if ya follow class names ya find stuff silly me..
ty... now I just have to only deal with java
I mean I could see them in game but I didnt think ya meant there.. and Im looking at the folder going wth... sighs
and get this... loading order on game load, isnt the same as game start...
ie when you see lua reloading when you load/start a game load order diffferent then when you just started it up.
Possibly due to a discrepancy between mods you have enabled from the main menu vs mods enabled on a save
they the same its just when and where when loading in... seems they get moved/changed a bit
Im trying to mentally picture if making a mod like superb... overall structure should look like what... global inits loading prefs first, methods etc, then main game/events after so on..
but then like we were talking about before those odd ones since they overwriting/adding to original lua stuff their load order totally different... how to plan on that etc
I'd rewrite it to not overwrite them personally (if possible), but that's probably a significant undertaking
well thats another thing but right now Im just trying to see if this thing's load ordering is just crap. I still have issues with options with it thats what I been working on.
Ive seen discord bots for that
literally google 'discord bot for steam mod updates'
stares at that same person in a typeless language making enum refs :P
I'm basically a linguist at this point.
There is a java command item:isHidden() applied to InventoryItems. Does anyone knows how to define that an item "isHidden"?
I know.. Im not knocking ya you should know that by now
Oh I don't think that you are.
Im seriously looking at finding some way to replace capsid
Why do you use capsid again?
get the jars and sources
It does something that ends up in Lua?
both
In the future, there's opportunity for me to take what I wrote to translate to TypeScript and turn that into data that could be fed into some Lua helper tool of sorts.
=)
The transpiler I paused development for ZedScript intends to fully unzip the Lua code and properly transcribe it.
you know I really f'n hate havint to rename jar's to zip just to flipping explore them... grrr
7zip
thats still somthing running when natively I can do alreadyd
but capsid in the most basic sense builds you a set of libraries you then add to IJ as a global lib.
(Scratches head)
and technically one of them isnt even a jar it should be called zip cuz its all lua code. lol
Why is it that vanilla script files are wildly everywhere with whitespacing..
oh dont ask me... I see it even in some mods
Welp. Time to format it to hell.
that and semicolons...
This is why I'm concerned. Kids are learning that this is acceptable.
lol
well if its ignored then dont matter but dont flipping mix and match either dont use it or use it everywhere
I press one format command and it all goes away..
Im used to ; usage.
dunno if its how its viewed or not but to me it seems right... Cobol was actually the first sandboxed lang. as it had to be run in JCL... ^_^
When you said I was human regex, you were right.
I just typed up a multi-whitespace regex handler line.
Straight up. xD
function removeExcessWhitespace(s: string): string {
return s.replace(/[\s]+/g, ' ');
}
๐ซฐ
btw pls help. regex for start of line to 'match string' to end of line so I can select the whole line using the match
I had it other day used it now lost and and cant remember what I did
regex to match a whole line containing 'a string'
it was simple too I did it on regexr webpage
lemme see
First and third captures are any amount of whitespace.
The 4th capture is a positive lookahead to check for a new line.
yeah this was even simpler then that something with start of line character and eol symbols?
now I cant find it
The 2nd capture is what you want to edit as a literal expression.
Ehh ok.
I'm giving you flexibility there with whitespacing.
dunno why I was asking might knew just offhand
Depends on what you want to capture and how it is formed.
its a log file I removed all the junk by inverting my selection after selecting thu a 10k log file everything I wanted :)
Expected to find missing API page for path zombie/modding/ActiveMods
Expected to find missing API page for path zombie/iso/sprite/IsoSpriteGrid
Expected to find missing API page for path zombie/chat/ChatMessage
...
my search used regex only way could be done for something like that
thats actually outta capsid's logfile
276 of them...
why I was looking at a way to just do it myself big circle if ya following me at all 
I just hate the random 'uknowns' in general its fine.
even got the whole java part with zero issues there just lua stuff
well this is why I was looking at just making my own libs on both sides and then I can only complain to myself
why Im irked it being closed off cuz what is being done isnt nothing secret or unique
too bad you cant use the | for the lists
True.
It's not impossible though
After this vscode extension is done, I'm writing a preprocessor language that'll compile to ZedScript.
It'll give me full control and the ability to fix all the flaws concerning this scripting format. =)
float var3 = var0;
if (var0 > var1 & var0 < var2) { -- this IF is the new part orig was only the two below
return var3;
}
if (var0 < var1) {
var3 = var1;
}
if (var3 > var2) {
var3 = var2;
}
return var3;
}```
oddly that local var3 makes it faster, if you remove it and just use the args straight up its slower
but some reason adding the double logic if helps speed also atleast in how hard I stressed it with a million random()'s
Probably something to do with the stack.
params are treated specially in most langs.
yeah Im thinking it some java bytecode memory stuff here
that was my first try was removing that, then found out was slower put that back in and thought of a way added that IF in and was like okay.. didnt expect that either lol
thats when I found out > and < are faster then <= >= also
Going to try blending back in comments with this new formatter.
Hi, i'm not a modder but i have a question.
In theory, would it be possible to make a mod that resets world props and assets to default outside of safehouses.
Scenario is this:
Me and my friends run a hosted server, they've gone wild and practically dismantled every piece of furniture, beds, lockers, kitchens, everything in the nearby city while i've dismantled hundreds of boxes and built walls and furnished a warehouse outside of town.
What i want is for safehouses to be left as is, with the loot in it, but everything outside of the safehouses to be reset.
***Just world assets like houses and furniture, the loot inside the furniture etc. ***
Also yeah, not affecting the time and date of the server or anything else like that.
I think the ability to do this would be very appreciated and I'm surprised it's not possible in the vanilla game seeing as dismantling furniture and loot containers is frowned upon on more open multiplayer servers.
You know what i mean?
I just tried doing it the old school way of basically adding every single jar and class directory's by hand didnt seem to help.
as for your ? look into how the world gens think there something that let stuff refill automatic same with how many zombies keep respawning
Yeah i know loot containers can have respawn enabled, but that's not what i'm talking about.
I'm talking about restoring the state of the houses in the world, reset the furniture, walls, doors etc, everything that a player might have disassembled or moved outside of the safehouse.
again check inside the world gen stuff see if there something for that. otherwise dunno short of knowing where bases are and not wiping the save data and let it flat out regenerate them (if that even works...)
Yeah, i don't know anything about modding or scripting or stuff, so im just wondering if it's possible in theory or if i should stop having hopes and dreams 
dunno either that was just a quick brainstorm might not even work like that
Well, your input is appreciated ๐ Hopefully someone looks into it because i think it would be a really useful feature
There's no spare empty-line below the comment blocks buuut
It doesn't get rid of comments.
nice
This isn't as flexible with comments but yeah I'm happy with it for now.
The big challenge would be to format selections instead of the entire document.
=/
Done for the day.
Got to think about improving the tokenizer to store empty lines.
More than 1 empty line in a row is discarded in other formatters.
I'll figure it out when I get time to again.
if it was between main sections wouldnt care
Formatters shouldn't be too aggressive.
stomps around the room. "HC Format 4 Life!"
Looks like it's only set when an item doesn't have a display name (upon loading its script). What do you need it for? It seems to not be referenced too much
coughs bethesda...

sorry couldnt help it was just watching SAO abridged..
omfg Im dying inside right now laughing cuz of the whole endgame scene on being a software dev... 500 hours of no sleep... seeing god.. oh boy I so feel like Kiyubah (sp?) right now
Somehow my situation. I have an item without display name but there are certain circumstances where it is still shown in the interface (namely in the tooltip of a container containing the item without name). But I already found another workaround
is setmetatable a java funct or lua?
yeah I need to find where its defined
It's.. a system thing.
I was hesitant to answer since the implementation is Kahlua therefore java
like what stuff in java.lang is to Java.
But Lua is the much more straightforward answer
It's literally Lua's design.
well gotta be defined somewhere for the tooltips saying is where Im going
Kahlua is only reimplementing it.
Guys i have a newbie question...
some functions are executed right away by typing it's methods ex: addAllVehicles()
and some methods requires multiple methods pre-run , for example: getSoundManager():PlayWorldSound('MapOpen', getPlayer():getSquare(), 0, 5, 5, false);
some require classname.instance before it calls a method for example :VirtualZombieManager.instance:createHordeFromTo(X+50, Y, X, Y, 80)
lastly some require classname.new() method called before executing such as MyUI:new()
what's the difference and when do I know when to use what???
tired of it crying Im not putting a T in front of something (which infact breaks it)
Yeah, fair. I think either is a fair answer but Lua is the one that makes more sense
ie trying to find the java/luadoc for it got the same problem with strings
Well on technicality in PZ? Sure. Kahlua is the one implementing it. If I were to be more proper as to what it is for Lua, then it's a language-specific Lua operation.
String != string apparently as a type...
The ones that are "chained" are using the result of a function; getPlayer():getSquare() is equivalent to local player = getPlayer();player:getSquare()
I don't think there's a straight answer as to when to use which. You'll have to see the documentation and code examples to know what's appropriate
so it's just saving a value on indicated variable
Yeah, using the return value directly rather than saving it
The .instance ones generally have a single instance that (probably) remains the same. They're using the singleton pattern. Getting the instance allows you to execute instance methods
As for :new(), that's a similar answer to the "using directly" thing and the "creating an instance" idea. You're creating an instance of something so you can use it
I am slightly intoxicated and I hope all of this is said in a way that makes sense
---@param arg0 String
---@param arg1 boolean
---@param arg2 boolean
---@return LuaManager.GlobalObject.LuaFileWriter
function getFileWriter(arg0, arg1, arg2) end```
I mean.. I had to write a prototype of JS code doing what PZ does in Lua with pseudo-classes.
I fixed the annoying type differences by adding an alias of String to string
so I had to learn what setmetatable was doing.
But I'm using vs code & LuaLS
so .instance is another variable ? or is it a class?
yeah did you do that in the annotation or on your side only?
It's a field on the class
function setmetatable(o, p) {
for (const key of Object.keys(p)) {
o[key] = p[key];
}
}
//----------------------------------------------//
/* (Lua-like Table-Class constructor) */
BaseObject = {};
/** (Lua-Like Pseudo-Class Type) */
BaseObject.Type = 'BaseObject';
/** (Lua-Like Pseudo-Class Declaration) */
BaseObject.derive = function (Type) {
return { ...this, Type };
};
/** (Lua-Like Constructor) */
BaseObject.new = function () {
const _super_ = this;
return new (function () {
for (const k of Object.keys(_super_)) this[k] = _super_[k];
})();
};
//----------------------------------------------//
SubClass = BaseObject.derive('SubClass');
SubClass.bar = true;
//----------------------------------------------//
SubSubClass = SubClass.derive('SubSubClass');
/* (Custom Constructor) */
SubSubClass.new = function (playerName) {
let o = {};
setmetatable(o, this);
o._playerName = playerName;
return o;
};
SubSubClass.getPlayerName = function () {
return this._playerName;
};
console.log({ BaseObject, SubClass, SubSubClass });
//----------------------------------------------//
let inst = SubSubClass.new('Jab');
console.log({ playerName: inst.getPlayerName() });
In the annotations. I exported them all, wrote a quick python script to fix some stuff, then did a few manual aliases (String to string, int to integer, double & float to number, stuff like that)
is string supposed to be cap'd or not?
sorry for keep asking dumb question but it keeps bugging me
In Java it's String, in Lua it's string
okay so just renaming them string shouldnt even care
why VirtualZombieManager.instance:createHordeFromTo(X+50, Y, X, Y, 80) .instance is needed? instead of VirtualZombieManager:createHordeFromTo(X+50, Y, X, Y, 80)
There is no shame in not knowing and there is great pride in having the confidence to seek knowledge ๐ค no worries
the constructor of VirtualZombieManager says VirtualZombieManager()
It has to do with static vs instance methods. Java classes can have methods that belong to the class as a whole & are called on the class and instance methods that can be called on instances. To be able to call those instance methods, we need a reference to an instance
yeah jab hence why you see this alot...
Yes because I'm fucking crazy.
setmetatable(o, self)```
Oh in Lua? Yeah.
But if I'm converting Lua to ES5 JavaScript, I'll need to emulate that.
yeah its crying that o isnt a table and Im like WTF you smoking...
even Im not that dab'd
i see so methods that don't need .instance is static, while the one need .instance is something called "instance method" in Java?
Knowing what you're talking about reassures me that I'll never be a normal person again.
1 sec.
I'd like to get back to my transpiler project at some point.
maybe if i find a youtube video that explains the diff. between static methods and instance methods, it will help me to understand further
its just a table copier from what I gather was gonna post the annotation but it doesnt even explain much
Standard OOP.
Yup, if called directly from a class like that. Stuff like getSquare on IsoPlayer (as in getPlayer():getSquare()) are also instance methods
instance relies on a copy of a constructed object.
static is just like a namespace.
the class becomes a companion to a static reference, much like a namespace.
oh wait... they are instance too? but they didn't need .instance
๐คง
GLOBALS def static :P
instanced data cannot be implicitly referenced from a static reference frame.
instanced objects can invoke static members.
static members requires a reference to an instance to invoke the non-static members of the object.
oops...
This is why the hierarchy model is taught often in OOP. Static is something beginners to intermediates should avoid.
yea,.. confuses me alot
interface...
Interfaces does not exist in Lua. =)
I don't think it's strictly necessary to understand for this use case anyhow. Still worth learning, though
but this game does like them on the dark side
Why do you think I said "Fuck that", and use TypeScript instead? =3
can one give me one example of static method in zomboid??
since getPlayer() is instance method
getPlayer() is static (global in Lua, since it's exposed as a global); getSquare() on IsoPlayer is an instance method
This is referred to as "Singleton" or "Instanced" approach. (Singleton is different. This is more instanced)
_G ftw
ok but again.. is getSquare() dont' need IsoPlayer.instance:getSquare()
Think of an instance method as something you call on an object
ok
Jab now what I was talking about the luaDoc(intellicode) whatever its called being fubar and capsid locked off is why Im irked this perfect example
The object in this case being the player. In the other example, the object was VirtualZombieManager.instance
Once you call a returned object, You are no longer in a static context.
oh.. i think im starting to get the feel of it
VirtualZombieManger itself is not an object yet
Think about a multi-story building. You always want to reach up to get what you need.
until it sets a field . instnace?
static is the ground floor.
ok
When you execute a task or operation, you always reach into or touch at least one thing outside of static context.
Something stored in global? That's not static but stored in static.
It's a bag of goods.
You care about the goods, not the bag.
It's a container. Nothing more.
oki
I can explain this in other ways but it will be strictly technically speaking.
I used to teach students unofficially.
Anywho I need to go unwind and get ready for tomorrow.
I'm behind about two days in my IRL work.
I got absorbed in my vscode adventure.
gn
Ok, so there's this createEatingZombies(IsoDeadBody target, int nb) method in virtualzombiemanager Class
I believe this method creates zombie that's eating a deadbody on ground
to use this method ill need 1 Deadbody object
so i go into IsoDeadBody class and see
all the methods
among them i see static void addDeadBodyID(short id, IsoDeadBody deadBody)
and I see it needs ID and deadbody obj again..
it threw me off >.<
float = {}``` o.O
That's the kind of thing I replaced with ---@alias float number
I haven't used those so I'm not too sure what you'd need
maybe if i do a search on Media folder of Zomboid , i could find an example of it being used?
Yeah, I replaced all of what you sent (that is, both lines) with the alias where appropriate
Only a few places where it's necessary
too bad you dont got that in a jar file
I mean does PZ use any kind of number types or in lua they just numbers...
In Lua they're all just number. Type annotations can have integer, but in the version of Lua we're concerned with (later versions have a separate integer type) there's no distinction
I think I ended up having to tinker with the batch file a bit
I mean I could just flat out refactor the whole dang thing but Im not gonna be sifting thru it so prob could break something
I figured it'd be simpler to just modify the output a bit so I went that route
well thats the problem where Im getting to now all that work is closed off..
gradle gradle...
How do I get a paramter value of a script.txt item in lua? I mean an item which has is not an InventoryItem. For example, if the itemType is "Base.MyItem" and it has weight defined, how do I access the weight (without creating a dummy InventoryItem via InventoryItemFactory.CreateItem("Base.MyItem") )?
hello, does anyone knows how to fix the canbesafehouse error?..
ive trying to fix this error for about 3 days now.
describe?
when you righclicked on a house .. it gives an error..
trying to claim a safe house but when you right clicked on a house .. it gives canbeSafeHouse error
try uploading what the error says in the console
hmmm
looks like its not picking up for the click so its trying to work on nil. this totally vanilla no mods?
nvm there mods already see it
It has an error even without mods
What I did was .. I set a static spawn point and removed all the spawn regions and set playersafehouse = true
Mod commission " Rising bite Nitro rifle" 125$ Must be compatible with britta's
that thread makes me wonder what if there was a mod that added a sniper rifle that made people bitten when shot by it
sure but like zombie piranha
how do controllers use tv vhs o0
it have only a basic supported right, how to remove vhs using controller?
solved
r1 to change focus on windows
and navigate
I could see that being a really interesting multiplayer mod
the cruelest pvp experience
It could work like the syringer from fallout 4
different ammo for different effects
hey guys
when i do
local player = getPlayer()
local X = player:getX();
local Y = player:getY();
local Z = player:getZ();
a = player:getCell():getGridSquare(X,Y,Z)```
is there a function or definition that shows where windows are able to be shot by guns?
and a:getDeadBody()
it returns nil
doesn't that bring deadbody?
suppose to **
nvm found the problem. player suppose to be standing on the zombie
-- Make a table of values then return appropriate value based on num ??
local r_value = {0, 64000, 32000, 26000, 20000, 16000, 12000, 8000, 4000, 2500, 1000, 400}
return r_value[num]
--[[
if (num == 1) then
return 0
elseif (num == 2) then
return 64000
elseif (num == 3) then
return 32000
elseif (num == 4) then
return 26000
elseif (num == 5) then
return 20000
...``` Which would be better the table or if/elseif (in this case a dozen checks...)
Can anyone make a mod that cuts down pipe bomb's fuses down? I would be willing to bump you some cash
thats what I was thinking. wonder if I can put an or on the return incase the [num] is out of range
like return (r_value[num] or -1)
ooh that works nicely as a nil check and a flag if num is out of range
is there any simple mod that spawns custom zombie for me to take a look at the codes?
Authentic Z seems too complicated for my level
I want to learn how isoZombie works
so that maybe in future I can spawn my own zombies with custom attributes
maybe undead survivor or they knew?
Link is on my profile
Cool, thanks
Do you want me to join the team orbit discord? The other link just brings me to your workshop, and your steam profile brings me to the team orbit discord
Cool, thank ye
What is the most simple way to use big movable items in crafting recipes?
i don't think there is a simple way
you make the recipe craft one part and use an oncreate lua function to add the extra parts to the player's inventory
Been using this system in other recipes too but I don't know how to make a simple recipe even read a big movable item correctly hmmm
i worked this out for somebody else before, but i won't be able to go find it until tomorrow
thats great, im counting on you! until then i'll brainstorm on my own ๐
i update my Car Multiplayer Player CMP v3.0 to work with True Music, after 11 hours of development, i complete it
now watch tv, vhs, cd, radio, true music on the road
https://steamcommunity.com/sharedfiles/filedetails/?id=2933189399
Is it possible to mod burnt wrecks to no longer spawn?
probably
Hi everyone! I'm currently working on a mod for Project Zomboid, and I've encountered a problem with the translation process. I was hoping someone here might be able to help me out, thanks!!!
not sure what you mean
guide:
https://github.com/FWolfe/Zomboid-Modding-Guide
bug report: TIS forum
Oh thank you!!!
It doesnt work, is anything wrong with the folder structure or code?
Ok @viscid kelp helped me with the problem, thanks!! it was the single quote in the translations file, it needed to be double quotes ๐ !!

anti sledge function + animated tiles for a mod
Does it also prevent other ways to destroy something? Like fire :0
Fire not destroying stuff would be fire
Are you meaning to use that "&' as an "and", or are you actually trying to do a bitwise shift?
Idont think so
Maybe if you detect fire and extinguish it if its on the same square? Or hook on how tile burn? Im not really sure
no & is correct, its not lua.
What is it, Java?
yep
In Java '&' by itself forces the "and" not to short-circuit or turns it into a bitshift operator. Which use are you intending here?
maybe? I could see if && helps any more.
honestly was surprized adding in the extra logic actually increased speed.
I was running a 33% random of low, inside and high
that actually didnt change anything noticeable.
Sometimes weird changes make things faster because they align with branch prediction or other CPU arch details
Like this famous SO answer https://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-processing-an-unsorted-array
oh I know why I was surprised assigning a local inside the method was faster then just using the args directly
I think one of the guides, or maybe it's in the Lua docs, mentions that.
Even using a local ipairs or pairs is faster apparently
yeah since I wasnt changing anything didnt think it effect it like that.
(I realize that's not directly comparable with the function args)
but that was just something I noticed offhand while roaming about the java classes. this is what Im trying to muddle thru right now. https://github.com/Sycholic/Superb-Survivors/blob/main/client/5_UI/SuperSurvivorOptions.lua
eg, lines 15-27 replaced with this... elseif (option == "SpawnRate") then local r_local = {0, 64000, 32000, 26000, 20000, 16000, 12000, 8000, 4000, 2500, 1000, 400} return (r_local[num] or -1) and in the few other places that had > a few settings/values to get
I originally just change it to check the option only first then do the ifs for num values but then realized didnt even need'm
options = {lock=1, spawn=2} etc
I was thinking of that also but seeing it just returns num if it matches nothing I held off on that till I figure out why it was done that way.
and btw can you write booleans to a text file and read it cuz Im wondering why they didnt use bools for any on/enabled off/disabled options
just need to translate it when read file
I mean they are but a math sense but they then playing with the values cuz the buttons start at 1? I guess...
but then mixing it up on how? like look at "Findwork" and "RoleplayMessage' logic... ?o.O?
oh is this function for reading the file or for in-game use?
file options to load up
mod settings which I also gotta fix/change cuz it dont save it per save but as a global pref...
but yeah why I was ranting last night about filereader in my IDE crying my " " wasnt a string cuz its expecting a String... lol
oh which I fixed I just had to replace all the annotations lulz
random idea for Boolean, write only if it's true.
I think they using a minimal method in the storage I need to like get the full list of options and look at that
I just got irked seeing that mass of IF's like that esp like we talking 12 logic checks of something you know has to be true... after the first one.
I first changed it to just a elseif(option == "SpawnRate") then but then realized well shit why not just iterate thru a list (or in lua case table...)
I dunno just seems cleaner this way and also now incase someone hand modifies their options file to something out of range I can catch that :)
Good morning.
yo.
seems like im not the only one wondering about such a mod lol
I was like "BROOOO i was literally **just **asking the same question"
#mod_development message
I prefer this
@ancient grail 
or Buildings built by npcs. Like the randomised that we have now, but also rebuilt when you revisit areas.
yea sure join my discord man
sharing my animated tile code
--initialize the main table
KWRRSHOP = {}
--initialize the sub table
KWRRSHOP.tiles = {
["Glytch3rTiles_0_0"] = {name = 'Glytch3rTiles_0_0', shop = "melee", nextstate = "Glytch3rTiles_0_1", sound = "WoodGateOpen"},
["Glytch3rTiles_0_1"] = {name = 'Glytch3rTiles_0_1', shop = "melee", nextstate = "Glytch3rTiles_0_0", sound = "WoodGateClose"},
["Glytch3rTiles_0_2"] = {name = 'Glytch3rTiles_0_2', shop = "car", nextstate = "Glytch3rTiles_0_2", sound = "MapOpen"},
["Glytch3rTiles_0_3"] = {name = 'Glytch3rTiles_0_3', shop = "car", nextstate = "Glytch3rTiles_0_3", sound = "MapOpen"},
["Glytch3rTiles_0_4"] = {name = 'Glytch3rTiles_0_4', shop = "clothes", nextstate = "Glytch3rTiles_0_4", sound = "OpenBag"},
["Glytch3rTiles_0_5"] = {name = 'Glytch3rTiles_0_5', shop = "clothes", nextstate = "Glytch3rTiles_0_5", sound = "OpenBag"},
["Glytch3rTiles_0_6"] = {name = 'Glytch3rTiles_0_6', shop = "firearm", nextstate = "Glytch3rTiles_0_7", sound = "AnimalInWoodTrap"},
["Glytch3rTiles_0_7"] = {name = 'Glytch3rTiles_0_7', shop = "firearm", nextstate = "Glytch3rTiles_0_6", sound = "AnimalInWoodTrap"},
}
-- credis to fajdek for providing an optimized way of detecting tiles
function KWRRSHOP.isShop(spr)
return KWRRSHOP.tiles[spr] or false
end
--initialize the anti sledge function by hooking onto ISDestroyCursor
Events.OnGameStart.Add(function()
local oldDestroy = ISDestroyCursor.canDestroy;
function ISDestroyCursor.canDestroy(self, object)
local origReturn = oldDestroy(self, object)
if origReturn then
local spr = object:getSprite():getName()
if spr and KWRRSHOP.isShop(spr) and not getPlayer():isAccessLevel('admin') then
return false
else
return origReturn
end
end
end
end)
-- calls on table KWRRSHOP.tiles to set next sprite and sound effect
local function replaceSprite(obj, square, spr)
local table = KWRRSHOP.tiles[spr]
local getSFX = table.sound
local setState = table.nextstate
getSoundManager():PlayWorldSound(getSFX, square, 0, 5, 5, false);
sledgeDestroy(obj)
obj:getSquare():transmitRemoveItemFromSquare(obj)
square:AddTileObject(obj);
obj:setSprite(setState)
obj:getSprite():setName(setState)
if isClient() then
obj:transmitCompleteItemToServer();
obj:transmitUpdatedSpriteToClients()
end
end
------------------------@pao this is the only part you should change ---------------------------
--TODO @pao should open your shop UI
function KWRRSHOP.melee()
--TODO opens your melee shop UI
if isDebugEnabled() then print('melee'); getPlayer():Say('melee') end
end
function KWRRSHOP.car()
--TODO opens your pinkslip UI
if isDebugEnabled() then print('car'); getPlayer():Say('car') end
end
function KWRRSHOP.clothes()
--TODO opens your clothing shop UI UI
if isDebugEnabled() then print('clothes'); getPlayer():Say('clothes') end
end
function KWRRSHOP.firearm()
--TODO opens your firearm shop UI
if isDebugEnabled() then print('firearm'); getPlayer():Say('firearm') end
end
------------------------ ---------------------------
--TODO this is how you determine which shop you call dont change this
function KWRRSHOP.shop(shopType)
--uses the sub table to find what the sprite represents
if shopType == 'melee' then KWRRSHOP.melee() end
if shopType == 'car' then KWRRSHOP.car() end
if shopType == 'clothes' then KWRRSHOP.clothes() end
if shopType == 'firearm' then KWRRSHOP.firearm() end
end
------------------------ ---------------------------
function KWRRSHOP.ContextMenu(char, context, worldobjects, test)
local player = getSpecificPlayer(char)
if test and ISWorldObjectContextMenu.Test then
return true
end
local menuCreated = false
for _, object in ipairs(worldobjects) do
local square = object:getSquare()
if not menuCreated then
if square then
for i = 0, square:getObjects():size() - 1 do
local obj = square:getObjects():get(i)
local spr = obj:getSprite():getName()
--uses the sub table above
if spr and KWRRSHOP.isShop(spr) then
--walks to the object
local adjacent = AdjacentFreeTileFinder.Find(square, player)
--added this so when the player is near the object but not facing it, it will still face it
player:faceLocationF(square:getX(), square:getY())
if adjacent ~= nil then
ISTimedActionQueue.add(ISWalkToTimedAction:new(player, adjacent))
end
local table = KWRRSHOP.tiles[spr]
local setState = table.nextstate
--replaces the tiles on right click
replaceSprite(obj, square, spr)
context:addOption("Shop for "..table.shop , spr, (function()
KWRRSHOP.shop(table.shop)
--reverts the tile to its original appearance
replaceSprite(obj, square, setState)
--TODO should maybe do this if incase they cancel, i just dont know how yet
end))
end
end
end
end
-- prevents multiple context menu entries
menuCreated = true
end
end
Events.OnFillWorldObjectContextMenu.Add(KWRRSHOP.ContextMenu)
@zinc pilot what do you think?
o his offline
Hey there, fellow survivors! ๐ง
I'm excited to announce that I've just published my very first mod for Project Zomboid - the "Rehydrated Meat" mod! This mod allows you to transform dried meat into tender, delicious meals that will make your survival experience even better.
I want to give a massive shoutout and thank you to @viscid kelp , who helped me with the translation files. Your assistance made this mod possible! ๐
I would really appreciate it if you could give my mod a try and let me know what you think. Your feedback will help me improve and create even more awesome mods in the future.
๐ https://steamcommunity.com/sharedfiles/filedetails/?id=2952771117
Happy surviving, and bon appรฉtit!
Alright!
congrats
Thanks!!
Shops? ๐ฎ
What shop mod is it using?
oh
Did I just imagine this, or does being drunk make you slur words in chat? Or did it ever? Looking for where that happens out of curiosity & I don't see it anywhere
Copied my code from ZedScriptParser to the vscode plugin.
It'll be useful for formatting.
u must fix KWRRSHOP.shop
Code I spent over 100 hours in.
Good morning.
Sure wdym
You see the progress on my vscode extension?
think about it, it's simple
It wont have same name i doubt it will
I saw u tag me when sending some msg but don't remember what was there exactly
so yea

Working on the formatter and documentation components.
noir with a bunch of custom things
if u sure that ur code is good and won't have bugs with that then u can do
function KWRRSHOP.shop(shopType)
return KWRRSHOP[shopType]()
end
What no we are not using noir. I thought pao was going to make the shop
ah, yea, I remember u do autocomplete for everyting
It's pretty good now.
it's so cool 
I rewrote the design so that people can easily add to it.
Hmm
Ok then
well maybe I misunderstand
Ye they are already using noir so comming to us for the shop mod wouldnt maake sense
But ill double check

Going to bet that no one will add to those files. =P The burden rests on me for now.
@red tiger
Does Noir have multiple shops? I was under the impression there's 1 store for the entire server
is it normal that using kick out of safehouse sends me out of my own safehouse? Not the safehouse I was next to?
Thanks for spotting that.
I think it has a bunch of tiles
That has like a dude standing tile thing
Not really sure about anything else
I think having them in .json would make people more likely to contribute but still probably not too many, I presume, since tooling tends to be that way
Worried about having to reload this data when ran.
(Going to look into persistent data with extensions soonish)
Everything I'm doing rn is new to me.
(Extensions are)
I've never messed with vs code extensions either, so looking forward to reading through the code when I get the chance
maybe it's the money / banking by noir but that name came up.
Forgot to put my donation stuff on the extension's page.
That and my Discord org server.
Need to get that thing shaped up.
Planned to have a bot that takes the JSON from my parser to provide info to modders.
I've got a bit to do to get there. =P
Jab is doing the txt stuff
For items, recipe, sounds, models, fixing, evolve recipe
I'm going to share my lives templates^^
it's just for lua event
I use Capsid too
I fixed most my issues with that now just would have to look for any others that pop up for type mismatching.
I think that people would be okay with a very aggressive formatter for now.
They don't need to use it.
@jaunty marten
Heat: {
type: 'float',
description: `
The parameter indicates the temperature of the resource required for crafting. -1.0 (Very hot) to 1.0
(Very cold).
`,
example: 'Heat: -0.22,',
values: {
'-1.0': 'Very hot',
'1.0': 'Very cold'
},
// range: [-1.0, 1.0]
},

Also looks like recipe comments are breaking down in the syntax highlighter.
Fixed. Also, this psytrance album is absolutely slapping right now.
Recipe is so freaking crazy with syntax that I had to isolate the regex patterns for it.
When I get a chance to write the lang that I want to compile down to ZedScript, that's going away. xD
is there an event that only triggers if the player's inventory gets updated? like if an item is added to it
Starred.
Heh. Thanks for starring my events repo.
So much to do..
I just got my deep-parser hooked up to the extension code. Will need to improve the tokenizer to tokenize empty lines.
It's a very aggressive formatter since the code I hook into actually generates ZedScript.
Here's what it currently does to camping.txt..
I also need to figure out which scopes allow for duplicate names.
It's monstrous
I find that to be a verrrrrrry concerning design choice.
Recipe names aren't unique but I coded it this way. Heh.
Unique identifiers FTW.
I hope that's changed tbh
I've a few hundred errors to fix now that I'm upgrading my tokenizer. xD
When you are making an item or such like food. Can you put in a chance of HungerChange and UnHappy change etc?
Could you for example put
UnhappyChange = -10; -50,
?
we got a pi or e constant in PZ?
math.PI not work?
You can always copy a somewhat accurate value as a const if not.
Silly if not already present.
I keep getting nil in console so I dunno
I need to add a new item I created to the foraging loot table when in an Urban Area, does anyone know how to do this?
like just to be not blind say(tostr(math.pi)) should work right?
Assuming say and tostr are defined and working, yes
tostring() afaik
lemme double check I was just quick typing I mighta actually used that
I assumed tostr was some custom function of yours lol
well its still nill regardless
Have you tried printing just math.pi? It should be present, looking at the source
hmm odd
well that worked I was using say so I can actually read it cuz console goes its own size... but anyhoot seems it uses what java does as well so that answered my Q
This got me poking around at Kahlua's stdlib implementations & apparently there's some extra table functions
table.newarray for a table that behaves like an array. neat (+ table.isempty, table.wipe, and table.pairs which is the same function as pairs)
well I need to update EmmyLua's constants apparently
cuz Emmy thinks PI is 3.1415 and thats it lol
math.pi = 3.1415```
taken from EmmLua 5.1 plugin math.lua
Tweaking the skill progress UI to add more clarity for my own sanity with dealing with skill recovery journal users
Fortunately I was able to just use gsub in a function decoration
Worried that people will think the formatter will be broken if / when they use it with broken scripts.
Diagnostics are a must. =/
Howdy, I've been looking online and around this discord, but I couldn't find anything regarding this,
Would it be possible to disable certain tiles from being destroyable with a sledgehammer, potentially replacing the tool required for those tiles?
I think it was @ancient grail that posted an example of just that earlier today (so he'd know)
Yeah, see #mod_development message

Do anyone know why katana has two weapon WeaponLength ?
BaseSpeed = 1,
WeaponLength = 0.3,
DamageCategory = Slash,
DamageMakeHole = TRUE,
TwoHandWeapon = TRUE,
WeaponLength = 0.4,
AttachmentType = BigBlade,
because its an oversight
An what?
about a month ago tried to do compatibility with ur recovery journal for my exp recovery mod and still can't complete it xp. mb it's just me, but I don't get logic of this one

Haha lawl ok ๐
Logic of the UI or logic of the skill recovery?
When you "unlock" a level it stops showing the XP earned - so you just have the current level's progress
same for 'locked' levels
Just trying to make the amount of XP easier to count/check
What was your xp recovery mod?
logic of saving and giving saved exp
thought do same for my mod but not sure if it's actually useful 
