#mod_development
1 messages · Page 81 of 1
ZombiesZoneDefinition = ZombiesZoneDefinition or {};
--ZombiesZoneDefinition.Default = {};
table.insert(ZombiesZoneDefinition.Default,{name = "sUnknownTrenchcoatDown", chance=70.5});
table.insert(ZombiesZoneDefinition.Default,{name = "sUnknownTrenchcoat", chance=70.5});
table.insert(ZombiesZoneDefinition.Default,{name = "sUnknownBandana", chance=70.5});
i have it set to this but it isnt spawning
you are a literal fucking god
I love you so fucking much
I don't even know what Recurse means in english
I would have NEVER found that
to many coding languages in my head... starting to mix everything up...
need a break... or ill keep doin' stupid crap like that.
I don't know what language you use where the . operator is for function calls, and I don't think I want to 😛
class classname
sub tonumber()
end sub
end class
classname.tonumber...
mixing non existing ways with existing ways to work with objects
to much crap in my head already
the . still isn't being used for a function call
yeah i know...
need to work on 1 thing at a time or ill be doing stupid shit like that again
also need to use intellij more... the addiction to notepad++ is obvious...
THIS MAKES NO DAMNED SENSE.
trying to make my mower work with 10yl on a server and it's just not saving that the grass was removed.
Bro thank you all in this chat for helping so much, I'm so glad I got at least a working prototype of my mod. I'm gonna expand so much on it now that I know how these commands work 😁😁
@faint jewel does it save when you remove the grass the vanilla way?
no, I mean does it save the grass removal when you do it the usual, unmodded way with a tool
but i am using the EXACT SAME REMOVAL METHOD and his hand removal and they come back.
I would first verify that there are no bugs in 10yl itself with removing grass
his remove grass command works. i automate it b attaching it to a mower. it works until you relog and they are back.
Here's the mod in action btw. really barebone right now but will be expanded a lot 😁
low fps anim
That's pretty neat. Will you be doing all of the animations in that style, or just playing around?
I hear if you install enough mods, you can make the animations look like that anyway
cries in 5 FPS
made a new wrench animation for doing repairs on cars. i hate item-hand placements.
What is your ZZD file called?
Also, before worrying about whether it spawns on zombies or not, just make sure the outfit was correctly added by checking in the outfits list on the character clothing menu in sandbox. (Not insulting your competence, it's just good to eliminate obvious points of error first.)
just playing around, I really like that style of animations
lol It should be a vanilla thing
Agreed! it would give this game that extra "sims 1" vibe too. ha
wait it has to be an outfit? i thought i could just add clothes and add them to zombie spawn lists
PUBG_ZombiesZoneDefinition.lua
?
i feel the torso is too stationary for how expressive the arm motion is, good work though.
Thanks for the feedback! Still tweaking it for sure (wrench clips in your hand a little too much) so i'll see if I can't loosen it up a bit. 🙂
items clipping didn’t bother the animators of the Indie stone I wouldn’t let it bother you, just the bulkiness of the hands, nothing you can really fix.
you know an idea just came to mind dead rising melee weapons no one has made them for this game yet
like traffics cones benches and shit? lmao
so one simple question...
i know i used addZombiesInOutfit(wx,wy,wz,value, nil, nil) in the past and also sencommandtoserver with /createhorde2 etc etc for the mp version of the trigger
the thing is... i vaguely recal someons talking about a function to add zombies that made them roam to a coordinate in the map. Anyone recalls what it is? Been digging and trying to find it but no luck so far
If you're using ZombieZoneDefinition you need to be using outfits, yeah. The table you're trying to insert into is expecting an outfit name.
@pulsar heath is that really a thing? like what they did in fallout 3 sandbox setting were something can follow you from one end of the map to another?
i had an old version of the mod before the mp that i used a function and im almost sure it was part of the game code to create a horde with X zombies and make them roam to a point in the map
or is it just go to point A
dont recall which
oh ok
i need to find my backups...
also trying to make it so that i can create a zombie with the viewer name using
createZombie(float x, float y, float z, SurvivorDesc desc, int palette, IsoDirections dir)
i had that idea today as well a mod that made all zombies from all over the map work there way over to louisville kind of like there being drawn to were ther food is
i mean think about it any zombie moive that has a wall with a gate there always huge hordes just sitting out side it trying to get out
Ah gotcha
made my outfits and assigned them in the table, should be good now
found it
static void
createHordeFromTo(float spawnX, float spawnY, float targetX, float targetY, int count)
hmmm
If i spawn my clothes in ingame its fine, but when i load the outfit with the items GUIDS only the underneath clothes spawns (like a tshirt and stuff that i set) but the jacket and bandana dont
bad joke: maybe it has a nudist trait?
I assume you checked to make sure the item GUIDs are correct in the outfit?
@sour island just one thing... is the -debug still available on EHE ?
yeah they are
The GUID should be the one you define in fileGuidTable.xml, not the one you define in the yourClothingItemHere.xml
yes? What do you mean by this?
my brain is melted
Ahhhh, that would be it
can i still trigger events mannualy is what i meant
Yes it's in the debug panel - just a bit hard to find -- I put them under general debuggers
The page is test
With my redux of AUD I'm hoping to make the debug menu clearer to use
Haven't had a chance to merge the two yet
it aint broken dont fix it 🙂 still amazed how your mod is not part of the base game already
one of the few that since i got it, cant play without it
they're spawning with the trenchcoat now but not my bandana, uh...
The plans for helicopters will involve NPCs (from what I heard)
Probably a totally different experience to what EHE provides
im trying to add survivor npc spawning to my mod as well... but its ... laggy as hell no matter how i try it
If you can spawn it properly ingame then I'd say now is time for the joyous tradition of going painstakingly through all your guids, lines of code, etc. until you find the inevitable typo messing everything up
does the probability line in clothing.xml mean, if you set it to 100, 100% of zombies will spawn with it? or its the chance that all of those items will be in the outfit if a zombie spawns with it?
The latter
phew
By default everything is assumed to have a prob of 100
So, every time that outfit is loaded, that item will be present
btw should my bandana.xml have the same guid as it does in fileguidtable?
You can use probability to add dynamism without needing to make a billion outfits, e.g. have a 30% chance for zombies wearing that outfit to be wearing a wristwatch, or glasses, or randomly choose from a bunch of different styles of socks/stockings/etc. for them to wear
I don't know if this has any negative effect as I've never tried it, but I use a different guid and it works
So:
clothing.xml - GUID1
fileGuidTable - GUID1
bandana.xml - GUID2
okay, makes sense ^.^
<!--Hoodie-->
<m_items>
<probability>0.3</probability>
<itemGUID>30503c5d-b833-4b4d-af33-d46bf67e9186</itemGUID>
<!--Hoodie Up-->
<subItems>
<itemGUID>b8610c9f-d53c-4217-901b-1d26fae6c9d1</itemGUID>
</subItems>
</m_items>
<!--T-Shirt-->
<m_items>
<itemGUID>d16201b6-43e4-405c-b990-1d36ce901b94</itemGUID>
</m_items>
<!--Bandana-->
<m_items>
<itemGUID>081d4e0f-d4ee-4fd6-bc84-74b87c27b3cf</itemGUID>
</m_items>
clothing.xml
Hi guys, is there a way to rotate an UIElement like drawRect or scale the DrawTextureAngle one?
I'm trying to replicate the arrow that show up when you forage and there something around, the addPlayerHomingPoint one.
I tried using the same system. But the issue is that it doesn't accept a Z axis and only work right on the first floor. Once you climb some stair it always point to the bottom of the stair.
I tried drawRect which I can scale, so I can make it smaller when you zoom out. But I can't find a way to rotate it.
I can rotate the DrawTextureAngle one, but I can't scale it down when you zoom out so it look giant when zoomed out. Can probably use this anyway but wondering if there's a way to fix either problem lol
<fileGuidTable>
<files>
<path>media/clothing/clothingItems/sUnknownTrenchcoat.xml</path>
<guid>b8610c9f-d53c-4217-901b-1d26fae6c9d1</guid>
</files>
<files>
<path>media/clothing/clothingItems/sUnknownTrenchcoatDown.xml</path>
<guid>30503c5d-b833-4b4d-af33-d46bf67e9186</guid>
</files>
<files>
<path>media/clothing/clothingItems/sUnknownBandana.xml</path>
<guid>081d4e0f-d4ee-4fd6-bc84-74b87c27b3cf</guid>
</files>
in those two files they share the same GUID but the bandana wont spawn in outfits, i wonder if its due to rng
And you can spawn the bandana in fine with debug/cheats right?
Yeah
It shouldn't be RNG because the bandana has no probability set, which means it has a 100% chance of appearing
hmm
oh well
at least the trenchcoat spawns in
how would i make a crafting recipe for the bandana, so someone could craft it?
lets say the recipe calls for one bandana (mask), and tailoring level 1
I haven't done recipes myself but the zomboid modding guide has a good overview IIRC
Pls someone help me with tables bullshit
local function ThinOutCellList(lastCheckedKey)
local player = getPlayer();
player:getModData().ExplorerTrait = player:getModData().ExplorerTrait or {};
local ExplorerTraitData = player:getModData().ExplorerTrait;
local lowestExplored = lastCheckedKey;
for key in pairs(ExplorerTraitData.Cell) do
if #ExplorerTraitData.Cell[key].ExploredTiles < #ExplorerTraitData.Cell[lowestExplored].ExploredTiles then
lowestExplored = key;
end
end
print("DET: Lowest explored cells are in cell with key "..lowestExplored..", cells in it: "..#ExplorerTraitData.Cell[lowestExplored].ExploredTiles);
table.remove(ExplorerTraitData.Cell, table.indexOf(ExplorerTraitData.Cell, lowestExplored));
end
im trying to remove an entry in table
ExplorerTraitData.Cell[lowestExplored] = nil didnt work
player:getModData().ExplorerTrait = player:getModData().ExplorerTrait or {};
local ExplorerTraitData = player:getModData().ExplorerTrait;
ExplorerTraitData.Cell[cellKey] = {};
ExplorerTraitData.Cell[cellKey].ExploredTiles = {};
ExplorerTraitData.Cell[cellKey].IsExplored = false;```
not sequential
then t[k] = nil is the only way
you'll need to elaborate as to what "didn't work" means
1sec
if you set a key to nil in a table, you absolutely will not see it when iterating the table with pairs()
this is a behaviour that's fundamental to lua
local function ThinOutCellList(lastCheckedKey)
local player = getPlayer();
player:getModData().ExplorerTrait = player:getModData().ExplorerTrait or {};
local ExplorerTraitData = player:getModData().ExplorerTrait;
local lowestExplored = lastCheckedKey;
for key in pairs(ExplorerTraitData.Cell) do
if #ExplorerTraitData.Cell[key].ExploredTiles < #ExplorerTraitData.Cell[lowestExplored].ExploredTiles then
lowestExplored = key;
end
end
print("DET: Lowest explored cells are in cell with key "..lowestExplored..", cells in it: "..#ExplorerTraitData.Cell[lowestExplored].ExploredTiles);
ExplorerTraitData.Cell[lowestExplored] = nil
end
local function ETDataDump()
local player = getPlayer();
player:getModData().ExplorerTrait = player:getModData().ExplorerTrait or {};
local ExplorerTraitData = player:getModData().ExplorerTrait;
local totalCells = 0;
local totalTiles = 0;
local lastCheckedKey = 0;
for key in pairs(ExplorerTraitData.Cell) do
totalCells = totalCells + 1;
totalTiles = totalTiles + #ExplorerTraitData.Cell[key].ExploredTiles;
lastCheckedKey = key;
--print("Cell #"..key.." has "..#ExplorerTraitData.Cell[key].ExploredTiles.." explored tiles");
end
print("DET: Data has total of "..totalCells.." cells that contain in total "..totalTiles.." explored tiles");
if totalCells > 10 then ThinOutCellList(lastCheckedKey) end
end
bot func is run every 10 min, even after i got printout that "DET: Lowest explored cells are in cell with key ...",
print("DET: Data has total of "..totalCells.." cells that contain in total "..totalTiles.." explored tiles"); kept returning that I still have 12 cells
for key in pairs(ExplorerTraitData.Cell) do
Does this work if you don't define an actual set of pairs?
I've only ever seen "key, _" used when you only care about one of the items in a pair.
yes, it works
with code provided higher up
as you see it runs print before ExplorerTraitData.Cell[lowestExplored] = nil
but on next print it still says it got 12 cells
@dull moss print() both the ExplorerTraitData and ExplorerTraitData.Cell
you will get a string that looks something like table-0x12345678
across multiple calls, that number should remain the same
if it doesn't you are receiving a copy of the table
(and consequently, things don't work because you're modifying a copy)
the only other thing that springs to mind is that the table has a metamethod that handles indexing
LOG : General , 1673493578434> ExplorerTraitData.Cell in ETDataDump: table 0x1818656612
LOG : General , 1673493578434> DET: Data has total of 12 cells that contain in total 23506 explored tiles
LOG : General , 1673493578435> ExplorerTraitData in ThinOutCellList: table 0x710572715
LOG : General , 1673493578435> ExplorerTraitData.Cell in ThinOutCellList: table 0x1818656612
LOG : General , 1673493578435> DET: Lowest explored cells are in cell with key 2961, cells in it: 504```
same numbers
god i fucking hate tables
with every fiber of my soul
OH
WAIT
I might be r-word
are you sure that lowestExplored is actually being set to something inside that for loop and it's not just failing to match anything at all so it always sets exactly the same thing to nil every time?
yea i was r-word
I was sitting on the edge of the cell
and i was adding it back to the list
so it kept showing that its 12
heh
solved in 10 minutes, worth.

old timers will remember Crimefest
TrollTheStreamer = { "Base.Generator", "Base.LogStacks4", "Base.CorpseMale", "Base.CorpseFemale" }
anyone has any suggestion to what other item i can add to troll the streamer?
maybe filling the inventory with toilet paper would be a good way to troll someone
Seems I fixed it
a generator and logs have uses, spawn useless stuff
of course, if you really want to troll them, intercept door interactions and make them randomly do nothing
and occasionally, instantly interact with the door twice
that would make killing the streamer to easy
im picking stuff that just makes the char heavy so a well placed generator in the invetnory or log stack = death
with the right timming, but due to the delay in the streaem plus the app and game... its not 100% sure the streamer will die
plus i dont have the know how
to use those kind of things
Base.Dirtbag and Base.Sandbag
i do want to add events to stall the car etc
so ill keep that in mind olipro... its a good idea to make the door of the car not open or something like that
dhert thats pretty good
Can't wait to try it out, if it works you're a legend mate
its working already
just cleaning up the code
and then to read the EHE code and figure out a way to use those events without breaking the game
Of it was jamming options together it wasn't fully working, wasn't it
gonna "leech" from the EHE twitch events mod 😛
amazing... spawned 9999 zombies and the game didnt crashed...
turned into a slideshow but still working 😄
all actions should be running for X period of time and have a cooldown
I assume you're already making users spend their channel points to use the abilities
yup
not saying its not a good idea.,.. ive thought about... but thats way way above what i can do in zomboid
it will take me a lot of time to figure those things out
flat tires, events like that would be nice but i have no idea how to implement them
I did a Twitch trolls PAYDAY2 many years ago, lessons were learned 🙂
inverting controls is also a very mean, but not too bad one
doing anything that messes with the camera is evil
the 1st version of the mod, when i tried it for the first time live on stream... i died over 80 times in a 6h stream
so
tested on insane population
i found a zombie, roughly going past 500 zombies
with the trenchcoat and bandana ^.^
given that the stats are military jacket+ pretty much (with leather jacket material stuff) im hapyp with that, its supposed to be rare!
sounds like we need a ZombZed (ZedZed?) to complement LootZed
temporary hearing loss would be a good one
play an explosion noise, then apply Deaf trait for X minutes
the explosion noise is just for the viewers, of course
make the char scream
😄
there i was all stealthy... when someone spends 10k points to make me yell
dead in 10s 😄
you can actually get quite a good amount of trolling mileage out of applying the negative traits temporarily
hmmm thats something i would like to have
silently gaining clumsy can easily cause you an injury
can you give help me with that?
just point me in the right direction if you can with some example code and i can take it from there
sure, but it'll have to be tomorrow because it's 4am here and I'm turning in 🙂
4am here as well
I'd also recommend the More Traits mod
no hurry with that... take your time
im using the more traits mod 🙂
cant play without it... it adds a lot more diversity to the game
ah, lots of opportunity then
also, having some "nice" modifiers are fun; not all of your viewers will want to hinder
yeah thats why i have both the good gift ( food, items, etc, all random )
and the trojan one ( heavy crap )
also with ehe i have the really bad heli or a less bad with the airdrops
less bad since it still calls a shit ton of zombies due to the noise
cinderella pumpkin: a humvee spawns, but you can only use it for 20 minutes before it despawns again
Is there anything I need to do to get
"FireMode = Auto,
FireModePossibilities = Auto/Single,"
to work on a new type of gun? Does it only work on Rifle-type guns?
I added the FIreMode properties to a pistol I intend to be capable of full-auto but both modes fire at the same rate.
Edit: Bleh. Guess I need my own anim xmls to support fire select on handguns
youre full of good ideas, still taking notes 😄
that i already have an idea of how to do
simple code... the interactions with doors and stuff no clue what so ever
Ping me tomorrow, I need to sleep before the cogs in my brain start spinning too fast thinking about this 😄
ok, cya tomorrow then. Ill give you a "shout out"
The spiffos are giving lots of good ideas nice 🤣
Getting close

it works time to bed... will add some more stuff tomorrow
https://youtu.be/haDaU1TD_nI
The base core of the mod is done. Now need to add the Air Events and the alpha will be ready for public release and testing. Hopefully i will be able to add more events ( car events: flat tire, stall engine, etc ) before the release. And after that keep adding more diversity to the events, both positive and negative. Thanks for watching.
This is awesome lol, nice job 
Also goodnight
After stealing some code from mo' crops (https://steamcommunity.com/sharedfiles/filedetails/?id=2762018937), i got the functionality down for a mod to grow the medicinal herbs. By the weekend I should be done with it.
Someone make naked zombie mod pls
Already exist. check the workshop
how can i remove inventory context menu of stome items for players with certain traits... like for example totally remove the drink function for all alcohol
do i need to use scriptmanager or do i overwrite something on the onfillinventory?
You'll probably want to add a function to "Events.OnFillInventoryObjectContextMenu" that does a check for your items and then call "context:removeOptionByName"
Or maybe, better yet, context:getOptionFromName, then set the option as unavailable so it can't be clicked and a tooltip explaining why it is unavailable (i.e. your trait)
question, are these radio entries written by hand..? it's this same sequence of messages pasted again one after another for different times, and that seems so tedious i'm suspicious maybe there's some tool used for editing these files? idk, i'm only just taking an interest in modding so idk if this is major noob question or not lol
trying to use getPlayerFaction("username") to return what the faction is but every time I type a command either that one or similar in the lua console in game, I get the error:
Object tried to call nil in console
file: objects.lua line 1#
Looked online to see what causes this, even in discord, only someone saying they love this kind of error since it's easy 🤣
That's a static method of Faction
Faction.getPlayerFaction("username")
when you get something as nil you can try printing
print(Faction.getPlayerFaction)
should print a function var
From what I understand (not sure on all the whole topic as I have not tried this myself) but the ID's and all that there are generated from WorldZed and not by hand.
Got it to work, thank you very much. Just a question, whenever I leave the game - the faction gets deleted or reset, whatever it is. Is that intended? Or just a setting in the server.ini?
Hey question, is there a function out there that could output to the chat box text from an object like a CD from a CD player? So whatever script was playing on the CD would also out put to the chat box? I assume it would utilize processSayMessage
@ "whatever that is"
seems like a fault in design
it should be in this order
a. what is X
b. how to use X
not in reverse
I have no idea what the purpose of self. is and I gotta admit am a bit ashmed of that
Is it to avoid putting large amount of code inside a lua file?
So you just use self. to make it simpler?
When referencing I mean
"self" is the lua object you are currently working with. This is a term used in Object-Oriented Programming (OOP!)
When a table is created with Lua, you can define methods on that table that interact with the data it specifically contains. This lets you easily have multiple instances that can perform independently.
I recommend: https://www.lua.org/pil/16.html
idk if you're familiar with other programming languages, but in others it is the same as: this
question
would it be possible to make a mod where your screen blacks out when you die? like after a certain amount of seconds
it occurred to me with the tlou death sound mod i made i could also figure out how to black out the screen after a certain interval (after the sound ends, ig, black out instantly)
but keep the ui and stuff obv
hmm
seems the require condition didn't work to add the traits to the modded profession
function showMoney:prerender()
ISPanel.prerender(self);
self:drawText("Player has
In this case, is self: used basically like you could use showMoney:drawText? Or am I missing something? Was reading on the OOP but got confused lol
Project zomboid is lua?
Ah idk java.
self would be whatever you return in showMoney:new() most times
I'm trying to work out how to get an element from the UI and I think learning this self thing is key
it's an instance of showMoney
So would be used like this if I'm understanding it right?
showMoney:ISTextEntryBox:getText()
I might have confused myself as to what an "instance" actually is, I figured it was whatever command is put after the :
do you have a create children where you make that box?
there must something like self.box = ... ?
hang on lemme check this tutorial I was following, might've missed something
self.name = ISTextEntryBox:new("", 25, 60, 150, btnHgt);
self.name:initialise();
self.name:instantiate();
self:addChild(self.name);
This is how it looks like in the tutorial
Gotcha
should have figured that out, myself
So whenever I want to reference this textbox, I use self.name:getText() if I'm getting it right?
Nice! Thank you 🙂
So these objects if I can call them that, they transfer all around the entire code in that lua file? I can reference self.name from wherever?
In the UI.lua that is
As long as the main function is for example the one it was created in
or an extension of that function
If I can word it better...
Can I use it in this function
function showMoney:onOptionMouseDown(button, x, y)
As well as in the function it was created in which is
function showMoney:create()
UI elements are globals that are also template objects. UI.instance is a variable to the original template object - an infinite number of UI elements can be created from the template using new()-- if you don't want that to happen you set the instance to one and clear it before creating/setting a new one.
Java is the hardcoded stuff
Kahlua is the exposed thing
So we use lua for modding
Idk if my terminologies are correct but its something like that
Children are other UI elements that can be attached visually
They also change how they behave too - as you can't interact with something being rendered beyond the parent
So buttons and alike are children
They don't have to be, but generally yes
It's just more convenient to attach buttons and backgrounds to 1 IS-Panel (window) and the hide/close that one window
Looks like the code I added crashed the entire thing, which is disappointing. Must've missed something yall said. I think my issue is that I still don't understand how exactly to call it from within other instances of the UI that are being currently enabled
Instances are not tracked inherently
Sorry, bad wording
function showMoney:onOptionMouseDown(button, x, y)
if button.internal == "CANCEL" then
self:setVisible(false);
self:removeFromUIManager();
end
if button.internal == "FINE" then
if not self.infoRichText then
-- when clicked
local uponClickedAmountIs = self.name:ISTextEntryBox:getText()
print("The text we've put in is " .. uponClickedAmountIs)
Here's what I mean. There's other selfs in here so I assume I cannot use self.name as well
When you add children you can define variables to the parent
namely self.infoRichText
Everything in Lua is a table - even these
Oh so infoRichText and "name" are the keys that hold the information?
ParentUI.myButton = button:new()
ParentUI.addChild(ParentUI.myButton)
Now you can get the button whenever you want
And use button's functions
Self in this case is the parent UI element
I'm not sure what inforichtext is
function showMoney:create()
self:addChild(self.cancel);
Copied the relevant information to what you're saying. So in this case, the only difference I see is that in this code they're using : instead of . to addChild
You have to use : in most cases
self.cancel translates to ParentUI.cancel I think
You use ParentUI.button in the create portion
And anytime referring to an instanced' children as those are variables tied to the instance
Talking about "." Specifically
so let me see if I got it right this time, how I would go about making a button for example
I create the ParentUI
create the button via ParentUI.button = ISButton:new aka self.button = ISButton:new
add that button as a child element using self:addChild(self.button)
You use : for functions as you don't want the original UI element but it's copy you've created instead
That is how you create a button
So you're copying the base of the original UI element that created everything, modify it and define what it now is
So it's originally the panel, then you get it copy it and turn it into a button?
Anytime new() is used it's copying the type of object and creating a new instance
You can change stuff using the functions provided -- you can also define new types with special behaviors using old types
UI can be a bit tedious to get used to -- but it's all copying tables/templates at the end of the day
something else to keep in mind, all those functions don't call themselves. Here it will be UIManager calling them, for the object you give it.
You don't have to call UI manager, unless I'm misunderstanding
which is where the self comes from
addToUi... what it's called
Oh those
I think, after reading all this I might have discovered what my problem is.
I'm using
local uponClickedAmountIs = self.name:ISTextEntryBox:getText()
This gives me in translation "istextentryboxnew:isTextentrybox:getText()
So that is the error. I should use uponClickedAmountIs = self.name:getText()
I apologize if I cost ya'll some brain cells reading that 😂
function storeWindow:initialise()
ISPanelJoypad.initialise(self)
local btnWid = 100
local btnHgt = 25
local padBottom = 10
local listWidh = (self.width / 2)-15
local listHeight = (self.height*0.6)
local storeName = "new store"
if self.storeObj then storeName = self.storeObj.name end
self.manageStoreName = ISTextEntryBox:new(storeName, 10, 10, self.width-20, btnHgt)
self.manageStoreName:initialise()
self.manageStoreName:instantiate()
self.manageStoreName.font = UIFont.Medium
self.manageStoreName.borderColor = { r = 1, g = 0, b = 0, a = 0.7 }
self:addChild(self.manageStoreName)
This is a snippet from my shops code - the shop window is a customized ISpanel object
You have to call initialize and instantiate for each child too
At least that's what everyone seems to be doing
Let me try rephrase
self is the table you use the command on
obj:addToUIManager()
local manageStockButtonsX = (self.storeStockData.x+self.storeStockData.width)
local manageStockButtonsY = self.storeStockData.y+self.storeStockData.height
self.addStockBtn = ISButton:new(manageStockButtonsX-22, manageStockButtonsY+5, btnHgt-3, btnHgt-3, "+", self, storeWindow.onClick)
self.addStockBtn.internal = "ADDSTOCK"
self.addStockBtn:initialise()
self.addStockBtn:instantiate()
self:addChild(self.addStockBtn```
Ooo I got it now, on the tutorial they added a section on how to use the command to get the text. So it is, like I painfully discovered with yalls help, self.name.getInternalText() and not self.name:ISTextEntryBox:getText()
I'm gonna spend some quality time studying this now and re-reading what yall posted, thank you very much ❤️
self.name:getInternalText()*
edited
function storeWindow:onBrowse(storeObj, mapObj)
if storeWindow.instance and storeWindow.instance:isVisible() then
storeWindow.instance:setVisible(false)
storeWindow.instance:removeFromUIManager()
end
local ui = storeWindow:new(50,50,555,555, getPlayer(), storeObj, mapObj)
ui:initialise()
ui:addToUIManager()
end
This is for opening the window
And what polt was mentioning
The only time I've used the main windows' instance is when I needed to catch the old one and close it first or close it when they get too far away etc
It should be : on functions
Self.childKey:function()
Inside the function self refers to the child
You have to set the childKey to self in create -- self in create would be a copy of the template
function storeWindow:new(x, y, width, height, player, storeObj, mapObj)
local o = {}
x = getCore():getScreenWidth() / 2 - (width / 2)
y = getCore():getScreenHeight() / 2 - (height / 2)
o = ISPanelJoypad:new(x, y, width, height)
setmetatable(o, self)
self.__index = self
player:StopAllActionQueue()
o.borderColor = {r=0.4, g=0.4, b=0.4, a=1}
o.backgroundColor = {r=0, g=0, b=0, a=0.8}
o.listHeaderColor = {r=0.4, g=0.4, b=0.4, a=0.3}
o.width = width
o.height = height
o.player = player
o.mapObject = mapObj
o.storeObj = storeObj
o.moveWithMouse = true
o.selectedItem = nil
o.pendingRequest = false
storeWindow.instance = o
return o
end
One last snippet of the windows' new
Where I set instance
UI is something I think could use an ingame editor
Luckily using AUD (a mod) you can reload Lua in game - not really functional in most cases - but works great for UI if you write it with that in mind
Rebooting the game everytime sucks
I recommend trying AUD out and using the Lua reloader
You can even close the error screen and reload
To keep trying stuff
Will keep it in mind, still struggling to get this text out of the box 😅
I mean for this purpose - reloading Lua would usually be a nightmare depending on the situation -- creating new instances of UI would be ideal
If you're trying to test stuff out get it so you don't have to keep rebooting the game
Just click the button with the little [ >_ ] - select your file and click reload
The problem was I was using 2 self. inside of a button action onMouseDown or w/e it's called
one for the self.name and there was another self.richtextbox or something
just got here and my brain already hurts just by reading the chat in the last 10m...
was thinking of having no configs for my mod ingame... but i guess i should at least add a way to change the items it can send to the streamer...
😮
now the question is... and i want an opinion
should just allow them to write the item name in a text box in the config or think everyone is lazy and just thrown in a combo box for each option that auto populates with the objects it can use?
as a "programmer" I would use an item text bot and type in the name
as a "person" I would use a combo box
😂
but I'm more of the former
yeah... but if i use a combobox the dm's will keep coming asking to add this or that... if i use a textbox to input the item name "base.something" format nobody will ask me to add this item or that item bla bla bla
so its kinda... like... wtf should i do...
I'd go with the latter in that case 😄
for now at least
maybe add it down the line if you feel generous 😄
or just both ... a combobox with the existing items by default and a text input to add the ones you want to the dictionary?!
hmmm
i hate working with UI ...
lol yeah tell me about it this is worse than the sendclient thing I was doing 🤣
I can do it faster but it's more frustrating for some reason
also speaking of typos m3ss, I just looked for so long why my code wasn't working then realized I used => instead of >=
🤣
..........
thats almost at my level of typos almost...
my brain was so melted yesterday that i tried to convert a string to number by doing tonumber.VARNAME
and was raging wtf why doesnt this work...
no its a function
you are stalking me fr
so it has to be tonumber(var)
what's the diff between var and varname
none...
just a placeholder for the var itself
i tend to called them something that indicates what they hold or what they are for
god damn I love this shit it's so hilarious 🤣
to call*
local player = getSpecificPlayer(0)
local inv = player:getInventory()
if whatkind == 1 then
Helpmeitem = ZombRand(1,13)
inv:AddItem(HelpTheStreamer[Helpmeitem])
elseif whatkind == 2 then
-----trojan
Helpmeitem = ZombRand(1,4)
inv:AddItem(TrollTheStreamer[Helpmeitem])
elseif whatkind == 3 then
Helpmeitem = ZombRand(1,4)
inv:AddItem(TrollTheStreamer[Helpmeitem])
Helpmeitem = ZombRand(1,13)
inv:AddItem(HelpTheStreamer[Helpmeitem])
end
end
easier to read that way and to follow the code logic
also i always spam a lot of prints when developing the mod
if EventsTable then
if EventsTable["zombies"] and EventsTable["zombies"] == "true" then
print("print("------------=Twitch Events: alpha v0.0.1=------------"")
print("------------=zombies from twitch=------------")
getPlayer():Say(EventsTable["viewer"] .. " sent " ..EventsTable["zedquant"] .. " zombies")
local wx, wy, wz = SpawnLoc();
createHordeFromTo(wx, wy, getPlayer():getX(), getPlayer():getY(), tonumber(EventsTable["zedquant"]))
end
if EventsTable["gifts"] and tonumber(EventsTable["gifts"]) > 0 then
print("print("------------=Twitch Events: alpha v0.0.1=------------"")
print("------------=gift from twitch=------------")
getPlayer():Say(EventsTable["viewer"] .. " sent me a gift")
GiftItems(tonumber(EventsTable["gifts"]))
end
if EventsTable["helicopter"] and tonumber(EventsTable["helicopter"]) > 0 then
print("print("------------=Twitch Events: alpha v0.0.1=------------"")
print("------------=heli from twitch=------------")
getPlayer():Say(EventsTable["viewer"] .. " sent heli code " ..EventsTable["helicopter"])
end
else
print("print("------------=Twitch Events: alpha v0.0.1=------------"")
print("------------=Event Table not defined=------------")
end
end
so if I do local textReceived = ---value how we obtained it
I need to put tonumber(textReceived) and not directly how we got the value in the first place?
its up to you how you call it, anything that makes it easier to read is a win on my book
or what you call it i meant
yup
was working on vbnet at the same time and got mixed with adding classes and call to those classes in the app
and kinda called the sub in the class i have in the app in lua...
like... hello... wrong place...
a filter box that grab the item from scriptmanager?
autoloot uses UI with all items btw.
@pulsar heath
hmmm
thats a pretty good way of doing things tbh
ill just get the item list and allow the user to pick what they want to in both "rewards"
ISStatsAndBody.lua
is this where all the dmg gets handled or is this just the menu for that of the debug
Hello, is there a way to share modData between clients?
Hey all, is there anyway I can do an if to check if the player is in a vehicle or not, and then do X if true?
Oh yeah, I found that thing in a timedaction lua file online
if self.character:isSeatedInVehicle() then
Hi guys, any articles that can help me with Distribution for new items?
Just replace this self.character with what you need, the main thing you need probably is isSeatedInVehicle()
there was a tutorial in the forums, never worked with item dist table myself
Could I just use a server side player:getModData() and then send it via sendServerCommand?
I've checked article on the forum, but some of the articles there are quite confusing..
ill have to agree with you on that one 🙂
moddata is only local
unless you use global moddata
so yeah, it would be feasible going through a SendServerCommand sending that data, correct?
Where would you send it? To whom and how?
Client 1 asks Client 2 for some stuff in getModData().MyMod
Client 1 will get an UI with some data from Client2
You could in theory send the whole table, yes. That would work
is there any decent documentation about server commands?
I haven't been able to find anything useful other than other mods
sure
I got that, but I'm not sure how I would actually receive that data
I can try and help you with server commands
Clients send client commands and listen for server commands. Servers do the opposite.
I spent 3-4 days learning them and a good amount of hours
Blood sweat and tears just to get one working 😂
What did u use it for
Obtain another players inventory item count (money) and send it to the original player
if you could share some of your code you'd be a livesaver
Yo if i got an existing table i can add new values to them, right? What I mean is i got this table
local player = getPlayer();
player:getModData().ExplorerTrait = player:getModData().ExplorerTrait or {};
local ExplorerTraitData = player:getModData().ExplorerTrait;
ExplorerTraitData.Cell[cellKey] = {};
ExplorerTraitData.Cell[cellKey].ExploredTiles = {};
ExplorerTraitData.Cell[cellKey].IsExplored = false;
and I want to add new entry
ExplorerTraitData.Cell[cellKey].VisitedOrder = ExplorerTraitData.VisitedOrder;
I can do it with something like this, right?
ExplorerTraitData.VisitedOrder = ExplorerTraitData.VisitedOrder or 1;
if ExplorerTraitData.VisitedOrder = 1 then -- applying visited order through out existing moddata
for key in pairs(ExplorerTraitData.Cell) do
if ExplorerTraitData.Cell[key].VisitedOrder == nil then
ExplorerTraitData.Cell[key].VisitedOrder = ExplorerTraitData.VisitedOrder
ExplorerTraitData.VisitedOrder = ExplorerTraitData.VisitedOrder + 1;
print("Cell #"..key.." didnt have visited order field, now has "..ExplorerTraitData.Cell[key].VisitedOrder);
end
end
end
just to know if I'm on the right track
Damn
Pingpong
ClientA asks server
Server asks clientB
Server answers clientA
https://github.com/RangerSimple/ProjZomb-Guides
I added the folder with the mod recently here for reference later on
thanks man
You need this function in server file
It's mostly for personal use so I can go back and look what I missed
I added a SHIT TON of comments inside to explain everything I did so apologies in advance if it looks crowded
don't worry, it's a big help
This is server side
im gonna yonk that link 😄
after what you've been through making that stuff work... i rather read than suffer what went through
lol
what you*
https://pzwiki.net/wiki/Modding:Lua_Events/OnServerCommand this is client side
@zinc pilot
correct me if I'm wrong (kinda new to lua), but isn't a bit risky having OnClientCommand as a function name?
If it's local no
If u turn this into a guide ill include it on the links i send to people when they want to start learning how to mod
Oh yeah I forgot to edit that
I thought that wouldn't count to functions
So other mods don't overwrite it
even if other mods have that same name
I would personally never name any function with PascalCase like that... But to each their own haha
It does work
Will do my best, currently trying to fix this thing in the mod as I was updating it more but I'll defo at you when I do that
based
gonna add you as a friend so I don't forget
Nice
I had no intention of keeping it that way, since I was using it as the only mod I was just like, yknow, just gonna fkin test it and see what happens 🤣
oh shit, pascal case is something else
nvm
🤣
Haha not judging your code at all, just talking about wiki style. Zomboid does it sometimes too... I feel like someone whose language does not have capital letters coded a lot of PZ
I am only speculating but it really makes no sense why the capitalization conventions for functions vs classes / objects seem to be non-existent.
Unless maybe some of the devs are bilingual or something
oh and Pao, just to explain that mod in a nutshell. Player right clicks other player (context file), that file sends the ID to server (only server file), server sends the player with that ID a request for his items (policeToolsClient file receives this command), that file sends it back to server (the item count), server sends it back to the client file (the result so the original player can have the values)
There's a lot of stuff mixed in between that code and I've been meaning to clean it up but I've been up till 2AM making it yesterday and had no time 🤣
don't worry man, I think I've already got what I needed
Nice! 🙂
I just suck at server\client stuff and needed a boost
Good luck!
Broke. Shift keys
Riiight lol they just only work when you want to capitalize a word unnecessarily?
And "unhappyness" (real game variable spelling to the new people) was because of a broken "i", I guess? 😂
I use camelCase even if the ide warns me that global should start Capitalized
But udderevelyn adviced me to not crowd the global space
code formatting and linting should be part of your build pipeline
someone violates it? refuse to build.
Exactly how I feel... But I think sometimes you take the people you have when you're indy and trying to make things happen on a budget.
I understood some words 😂
But yeah I personally wouldn't want to push code with inconsistent function naming into a game I made from scratch
Just a recipe for disaster.
"build pipeline" is just a fancy phrase for "some script that validates, builds and packages your project"
Yeh so use Unhappyness like you are ment to
a programming language linter is something that runs basic style checks or tells you if you're using something deprecated
depending on the language, a linter might be relatively simple, or integrate a large amount of checking functionality
oh, that's cool, is it mostly uhh how do I say it
visual things it checks
or things that actually break functionality?
that's more like code formatting, a linter will do stuff like tell you about vars you declared but never used
OH I LOVE THAT
I love that so much in other languages
I can clean up the code so easily when it greys out things
that I don't need 😂
there is a linter for Lua: https://github.com/mpeterv/luacheck
it also has an accompanying VSCode extension, if you happen to use that as your editor
I do in fact!
Gonna save that link, yoink
Hey while ya'll are here
If I do player:addItems(--item---, -50)
oh, if you're already using vscode-lua then you have it
will it subtract those items or?
I can't figure out how to remove items by type (for example Money or Base.Money)
Unlikely
isn't there something like removeAllTypeRecurse
Was trying to find an extension of player: online to do it with but only found one I think
Yeah
I mean I guess I could give it a variable and loop the remove command as many times as I need and just use removeItem
but I was wondering if there's a specific thing like there already is AddItems(item, int)
Just the wording I cannot figure out to actually find it, like what would they put as the opposite of Add
Even what you said before, recurse, I still have to google what that actually means 😂
so, there is RemoveOneOf which takes a string
calling it in a loop 50 times will of course do the job 🙂
oh removeOneOf will recurse by default?
Need that as well, since I'm checking the entire inventory so snakes can't hide their money from me >:)
It takes only one argument tho 😮
String, I can still pass in false?
there are 2 overloads
you are looking at the single argument overload
which is just a wrapper for the other
would getting all items of a type and then doing something like inventory:remove(item) be faster or not?
it would be faster, yes, but that is going to nuke everything, which he doesn't want to do
well, for some value of faster - the true answer is "it depends"
obviously you'd do a loop with a set number, not all the items
letting java do the heavy lifting is generally faster, but of course, there is a point where, if the user had many items, removing a few of them in lua is going to be faster than removing all of them in java
oh, sorry, I misread it as removeall
he's talking about money, that can become a lot of items I imagine.
he needs to recurse so removeoneof is optimal
👍
in actuality though, the code for both is the same in Java
TIS should really clean it up so RemoveOneOf just calls Remove and recurses 🙂
hmm I really can't seem to get my traits mod to work and apply to the profession
Im starting to feel like I have to make an edit which is not at all what I want to do
here's the code
some people have sight problems and use a screen reader. don't post text as a screenshot, use something like pastebin.com
also, even if you don't have sight problems, it literally makes everything harder when you have posted text as a screenshot
good shout, I'll start doing that as well in case I have to send big chunks of code
thanks 👍
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Don't know if anyone has answered you yet, but that's just the Debug menu for controlling stats.
Body damage and health is all calculated Java side.
I am so close to finishing my mod, just have to make the player receive the money he fines the other player and am done. Also gotta bug in the for loop, it's supposed to go to a min value of 40 say but it goes 1 more down
Just gonna put +1 in the minValue and be done with that 🤣
You'd probably have to tackle commands then - if you haven't already
Your mod touches on some difficult/tedious aspects 😅
if I declare a variable at the very top of my lua file, then a local function in that lua file edits that variable, will the global variable at the top be updated?
Yes unless you've declared a local with the same name ofcourse
If you use an IDE or anything with syntax coloring it should appear differently
using visual studio code rn
doesn't seem to change the color but I am colorblind so
You could probably rig it to Lua
I would've assumed it could identify the .Lua and do what it needed to - but you might have to download a plugin
I got my first bug report on GitHub post wile-e-coyote'ing EHE's workshop page's comments
Guess it works 👍
For context:
This is a hyperlinked image
hahahaha, I love it
I don't expect steam to add more features for workshop stuff and it was getting pretty awful.
I wonder if I can rig an image generation for updates
lol, now I see. Comments off, github on.
Like a visual changelog I can include above the comments or as an additional fake comment 🤔
GitHub has templates and issue tracking - by far better than endless comments and duplicate discussion pages
- idk what they did but I get alerts for week old comments I've already seen
me open modding channel me like what me see
github for anything mod related is so much better than the workshop
Hello, real and smart user
been think thonking real hard in a way to make creating simpler without having to overwrite the new function and still integrate with documentation
what i want is to be able to document the parameters but at the same time not overwrite the function for every single ui
may have arrived at the solution
make ui specs
have a "class" defining the spec containing all the parameters and simply have the super class as the parameter for new
@drifting ore thanks again, you saved me a lot of time. It works 😄
no worries chief, glad to help, lots of cigs smoked until I finally learnt it 😂
been fixing The Only Cure since I started playing again and server side stuff was pretty much broken
I finally managed to edit the original mod to add a fine button, removing a set amount of items (money in this case) based on the input of the original client
All I have left to do now is give that money to the primary player and this mod is working as I intended.
well was about to rage about creating a simple ui panel in the game, so i thought... i should go and chill and play a game or something for a bit... chose the wrong game now im ragin' about rng in hs 😄 and still no panel hahahahaha
playerInv:addItem("Money")
The one above is an error.
The one below is correct apparently.
playerInv:AddItem("Money")
I love this so much 😂
ladies and gentlemen, it is with great pleasure I can inform you that the mod is now working 😎
myPanel = ISPanel:derive("myPanel")
local myPanel = ISPanel:new(10, 10, 300, 300)
myPanel:noBackground()
-- Create an image object
local myImage = ISButton:new(0, 0, 32, 32)
myImage:initialise()
myImage:setImage("path/to/image.png")
myPanel:addChild(myImage)
-- Create a text object
local myText = ISLabel:new(0, 40, 300, 20)
myText:initialise()
myText:setText("Some text")
myPanel:addChild(myText)
this should work right?
the path would be media\ui right?
nope... doesnt work
gonna read the docs again...
Try this:
-- Create an image object
local myImage = ISButton:new(0, 0, 32, 32)
myImage:initialise()
myImage:setImage(getTexture("media/ui/IMAGE.png"))
myPanel:addChild(myImage)
also you can see all usable functions here:
../media/lua/client/ISUI/ISButton.lua (for button)
and
../media/lua/client/ISUI/ISLabel.lua (for label text)
thanks
if you define player = getPlayer() as local, does everything you use player for next also become local only? Like... player:getForname() --- will it also be local?
or is it its own thing
I once got the firstname_lastname of the player but have forgotten in the meantime, forname surname doesn't seem to cut it unfortunately
and there's so much to choose from, display name, username for example
thought those 2 would be the same thing lol
yep, unless you assign it to a variable not local, also depend in what block of code are you using it
locality is not transfered
local player = getPlayer() -- player is local
name = player:getForname() -- name is global
I think I found it, getFullName instead of getForname/Surname
UI is not my thing... trully... im dumb as nail when it comes to this kind of thing...
require "ISUI/ISLabel"
local myPanel = ISPanel:new(10, 10, 300, 300)
myPanel:noBackground()
-- Create an image object
local myImage = ISButton:new(0, 0, 32, 32)
myImage:initialise()
myImage:setImage(getTexture("media/ui/cal80.png"))
myPanel:addChild(myImage)
-- Create a text object
local myText = ISLabel:new(0, 40, 300, 20)
myText:initialise()
myText:setName("Some text")
myPanel:addChild(myText)
myPanel:addToUIManager()```
I'd love to help you with the UI but I only know one guide I was using to make mine
maybe it could help you?
sure, link please 🙂
https://github.com/MrBounty/PZ-Mod---Doc
This guy has a lot of good guides I followed
thank you
no prob : )
damn, this range on right clicking is huge I didn't even notice
I can click 2 players away and it'll find this man
lmfao
magic, fixed itself
gucci
@undone elbow you're absolute GigaChad, thanks

can someone explain to me why this only works in game after i reload this lua file from debug?
local original_oneat_cigarettes = OnEat_Cigarettes;
function OnEat_Cigarettes(food, character, percent)
print("ETW Logger: detected smoking");
local modData = character:getModData().EvolvingTraitsWorld.SmokeSystem; -- SmokingAddiction MinutesSinceLastSmoke
local timeSinceLastSmoke = character:getTimeSinceLastSmoke() * 60;
--print("ETW Logger: timeSinceLastSmoke: "..timeSinceLastSmoke);
--print("ETW Logger: modData.MinutesSinceLastSmoke: "..modData.MinutesSinceLastSmoke);
local stress = character:getStats():getStress(); -- stress is 0-1
local panic = character:getStats():getPanic(); -- 0-100
local addictionGain = SBvars.SmokingAddictionMultiplier * 1 * (1 + stress) * (1 + panic / 100) * 1000 / (math.max(timeSinceLastSmoke, modData.MinutesSinceLastSmoke) + 100);
modData.SmokingAddiction = math.min(SBvars.SmokerCounter * 2, modData.SmokingAddiction + addictionGain);
--print("ETW Logger: addictionGain: "..addictionGain);
--print("ETW Logger: modData.SmokingAddiction: "..modData.SmokingAddiction);
modData.MinutesSinceLastSmoke = 0;
original_oneat_cigarettes(food, character, percent);
end
is this in a client file?
that function loads with server files
oh that'd explain it
um do I need to adjust anything besides moving this to server folder?
like what does getPlayer() retrun for example if its called in server lua
i dont have it in here but in general
cuz havent done a single server lua yet

works like a charm, thanks
@pulsar heath

it stays as is the damn mod... if anyone wants something changed just code it
i only use the txt file anyway not my problem
it works as intended for myself
huuhuhhu im gonna be rich using your mod!
gonna steal all the money from everyone on the server ahahahaha
well gonna work on the integration mod and ***k the stats mod, it will be updated when its broken
Typical rogue player
It's intended for a server I'm playing on that has police
and stuff like that
They have literally no power over criminals and I wanted to change that
that's why I pulled all my hair out learning serversendclientwhatever
if they have a gun and bullets they have power over them 😄
you'd be surprised
steal bottle caps, -reputation
fallout 😄
dude... if feels so good when i actually am able to do what i want in the damn mod without going crazy... added air events, it works... at least the random bit
2 m typing... trying to do a damn customizable stats window the whole day... it works... i add something... it breaks... i correct it... it works... than i add something or change something it breaks... damn loop of errors and cursing... one step forward 2 steps back. aaaaaaaaaaaaah
That's programming for you lol
no, thats coding in lua
Fulfilling but frustrating are the terms I use.
it was faster to code a lib with full support to the twitch api in vbnet and c#
thant it was to make the original stats mod
the only coding language that really annoys me is lua...
and believe me... i even coded in pascal and delphi and those two... are really bad and limited
lol, I can't imagine what is possibly so bad about Lua, the syntax is straightforward, first class functions are really handy, and it largely does anything anyone could need. Missing switches and a continue keyword is a bit frustrating at times, I guess
It's less Lua and more Zomboid
But if you only use a language for one thing, then you associate them together into one
so make me a websocket connection in lua without using libraries created with c#
without a library
It's built-in
no its not
socket library is not in kahlua
Not in Zomboid, yeah
Half of c# runs off of c++
yes it does
i've surrendered to vbnet...
And I need to make a web-api and Xamarin app combo to handle file transfer
Which isn't for Zomboid, for Zomboid I need to extend my anxiety-inducing mod
dont work much with xamarin... only when the client needs something that works in mobile
in the end, PZ/Kahlua not exposing certain functionality isn't really a Lua problem, so "it's less Lua and more Zomboid" is probably the best way to put it
but im not saying that, im sayng that lua itself is limited as hell
lol
it makes sense that its even more limited in pz with kahlua for security reasons
js / java is an alternative (DeltaMango)
which you can cirvumvent woth java mods
i have no opinion on java, personally i dont like to code in it
but cant say its bad...
What about Lua in its own right is limited? Not to say you're wrong, but I feel like if anything it's too open ended - and I wish more utility functions were built-in.
well to start off is a lot error prone than other languages
i dont find the code as easy to read as other languages, but nobody is obligated to agree with me, its my opinion and as such anyone is free to say otherwise
doin' simple logic stuff like a switch or a case ends up being a pain in the behind
to embed in other apps like in games... yeah... prolly the best choice
but that doesnt mean my opinion is gonna change
error prone?
a undefined variable or class member (table entry) is not an error (it returns nil)
for example
lacks proper tooling
Variables can be assigned without being declared
thats kind of a mixed feelings for me
no validation on the fucntion parameters
im forgeting something
pretty typical of untyped languages tbh. I used to prefer strongly typed languages like Java but I've learned to appreciate this style
is not that i dont apreciate the "freedom"
but there are somethings that are needed to make the coding process more fluid
if i code something in lua today, a year from now i prolly wont remember wtf i did on that code... so i have to spend time figuring out what i did previously...
time that could be used expanding and improving the code, either to add new funcionality or to update the code itself
another point, but that happens in python and java as well i think is no data hiding
im gonna stop my rant there b4 i annoy everyone even more
Lua is freeform by default, however, you can setup metamethods that throw errors to prevent most of what you're complaining about
for example: setmetatable(_G, { __newindex = function() error("NO IMPLICIT GLOBALS, DUMMY") end)
Will prevent you from setting globals
yes i can, but once again... spending time on something that i shoudnt
consider it boilerplate. Every language has it
Put inside an event
usually i enjoy coding... but not with lua, thats the main point for me. The only language i have less fun coding and thak god i dont have to use it anymore is tcl
but im just a idiot ranting about something he shouldnt
my only real complaint about Lua is that a language that was made specifically to limit scope should give everything a local scope by default, not global
but lua is such a simple language
nah, it was wrong folder
my only real complaint about lua is indices start from 1
@astral dune again, you can achieve the same effect by setting metamethods on _G
thats 2 complains and I agree with both
lua doesn't dictate to you whether to allow implicit globals or not. you decide that for yourself
lol, I'm absolutely not messing with _G, thats the worst idea I've ever heard
I'm obviously not suggesting you do that in the context of a PZ mod
I suggest adding a sandbox for ehat the faction name is
yes actually this too. MATLAB is like that too and I hate it
index starting at 1 or 0... doesnt bug me that much
since kahlua is 5.1 I actually use setfenv to make my modules local by default. Or at least I did until I realized EmmyLua didn't understand that at all and I wanted to use its autocomplete and code searching capabilities
indexes in Lua only start at 1
any code you see in PZ that is starting from 0 is a marshalled java array
not saying that lua starts at 0 or 1, im saying that doesnt bug me at all... that lua start indexing at 1
it that was the only bad thing about lua i would be a lua fan boy
for what it is - a simple and very accessible language, I like it, it provides a broad reach that even a newbie can get their head around. Would I choose it if everyone on my team was an experienced dev with knowledge of languages like C++? No. but most of the time you can't afford to only hire high-experience staff
like i said, for what its being used in pz is more that enough
and i doubt theres a better choice than lua for that purpose... does that mean i have to like it? Nop
liking Lua is in the ToS, sorry
well, I would argue that Mruby would be a decent choice these days
have no experience with mruby so i cant say i agree or disagree on that one, from the ones i know and have worked it, even if i hate working with it, its still the best choice
it's an embedded implementation of Ruby
my experience with ruby is almost 0... never had the need to work with it, or the curiosity
it's like Python, but better 😛
not a high bar
i do know that many of my friends are fanboys of ruby
but they work with more web related stuff
any language that i dont have fun coding should go in the bin 😄
but i do have to say that lua makes me use my brain more
ill give it at least that good point
uh, what other language(s) do you use?
mainly c++, c# and vbnet... and php for crap websites
been working with c++ since i was a teenager
so lua makes me think more
dont use it that much
having written multi-threaded apps in C++, there is absolutely no comparison
started with pascal, then c, then c++
and in the present i use vbnet more than anything else
oh, VB... shudder
i used to think that vbnet was for lame dumb lazy ppl
till i started using it because i had to
I first used VB back in the days of VB6
and after a while... it became my main coding language
C# is a far better .net language
i do agree on that
but most of the work i do its faster with vbnet
as in faster to develop
since most of the ppl i work with only know vbnet and c# for them is the devil
i kinda get why since is more "user friendly"
i first used vbnet in 2008 or 2009... it was vb7 o 8 ?!
VB6 predates the existence of .NET 🙂
i know
the net bit started at 2001
or something like that
with vb7 i think?!
dunno to old to remember that
Mod Learning Materials
``
PzWiki:
https://pzwiki.net/wiki/Modding
Lua events:
https://pzwiki.net/wiki/Modding:Lua_Events
Mod permissions:
https://theindiestone.com/forums/index.php?/topic/2530-mod-permissions/
Fenris guide:
https://github.com/FWolfe/Zomboid-Modding-Guide
Dislaiks guide:
https://steamcommunity.com/id/Dislaik/myworkshopfiles/?section=guides
https://projectzomboid.com/modding/index-files/index-1.html
Konijimas guide:
https://gist.github.com/Konijima/7e6bd1adb6f69444e7b620965a611b74
Konijima library guide:
https://github.com/Konijima/PZ-Libraries
Mr bounty guide:
https://github.com/MrBounty/PZ-Mod---Doc
Recipe and item variables:
https://theindiestone.com/forums/index.php?/topic/15188-item-and-recipe-script-variables-brief-description/
Lua:
https://www.lua.org/pil/contents.html
Server client commands:
https://github.com/RangerSimple/ProjZomb-Guides
Mapping and tiles:
https://youtube.com/@daddydirkiedirk119
Loot distrib:
#mapping message
Clothing masks:
#modeling message
DoParam:
#mod_development message
Item full type:
#mod_development message
Mod Testing:
#mod_development message
Startup Param:
https://pzwiki.net/wiki/Startup_parameters
Vehicle modding:
https://theindiestone.com/forums/index.php?/topic/24408-how-to-create-new-vehicle-mods/
Clothing mod:
https://steamlists.com/project-zomboid-how-create-a-clothing-mod-41-60/
Authentic peach guide:
https://theindiestone.com/forums/index.php?/topic/49385-do-not-delete-luascript-files-from-your-mod-some-modding-guidelines/#comment-342943
tag system:
https://theindiestone.com/forums/index.php?/topic/53019-details-on-the-improved-modding-tag-system-in-4169/
``
This is a list of guides to share to people who is asking abt modding
Im gonna keep the msg link and update it whenever needed
it came after vb6 so, vb7 ( vb net framework 1.0 )
it actually is 🙂
but Windows 10 is Windows 10
but yeah youre right since it was incompatible with the previous vb
so it cant be called vb7
my bad
@dark wedge quick question: Does your SpiffUI Inventory mod make any changes to the code of Loot All/Transfer All, or are you changing the code at a higher level so that they just receive a table of all items collected together?
maybe
https://pzwiki.net/wiki/Modding
otherwise
https://github.com/MrBounty/PZ-Mod---Doc
has useful info too, thought this link was on wiki already
MrBounty has the UI guides right? quite good imo
Am I reinventing the wheel? I didn't find anything that says I did:
https://steamcommunity.com/sharedfiles/filedetails/?id=2916982824
O dont have the forum links tho. Ill look for useful stuff posted here on the channel
Im also looking for the item tag link
New Tag Info! - Several new Tags were added to the item scripts, and their functionality added to the lua code. - This allows for modders to add new items that seamlessly work with the game in several places, such as adding new fully-functional Sledgehammer items, or adding new Gasoline container...
For the "Loot All" I simply hide when one of my containers is open, and block other transfer attempts to go into that inventory elsewhere (dragging, double click, etc., just mark it not-valid). For "Transfer All", or transferring to my loot container, I hooked into the ISTransferAction:waitToStart (unused) and check if the transfer is going to one of my loot containers and redirect the transfer to the first actually available container.
I initiate the transfer through ISInventoryPaneContextMenu.transferItems
will that still go through your hook? the Grab [one/half/all] options use that
Any guides for sandbox?
Moddata?
Buffy thought me how to use moddata but it was via dm
oh, I use ISInventoryPane.transferItemsByWeight for doing All
so, as long as your UI is still going to see it, everything should Just Work(TM)
Oh you should be good. Both of those should take into consideration my changes. 🙂
based
@sour island to properly use your EHE mod from another mod, i should use the eHeliEvent_new(startDay, startTime, preset) right?
Ow shit i need to nitro for me to do a longer list
I might need to do this externally 😮💨
counts his blessings
Cool. Tried out your mod rq just to be sure I didn't put my foot in my mouth. ha. The only thing that doesn't seem to work is the "Dedupe All" button from the player to my merged containers. Took a peek, looks like your dedupeAll function doesn't like my "virtual" container so just does nothing for that one. Otherwise, the context menu definitely works
hm, I see, I'll have a poke tomorrow, I think I'm done with coding for the day 😄
honest question: Why is it that when a mod that inserts into the "Default" zombie zone, is present alongside my mod, it causes the "Default" zombie zone to go oof and spawn ALL outfits? Including my mod's outfits?
question, im struggling trying to understand how i'd start with the myers zombie mod. so far i have this understood: I'd need to do what i did for my trenchcoat and make outfits and stuff for the actual outfit, which would then spawn on a zombie. But how would i say "only one zombie gets this outfit per world, and he will spawn with different stats than the other zombie"? i'd want him to just be a shambler, but with much higher health than just "superhuman", very high damage, the ability to open doors, insanely keen hearing, and obv the music.
so like, i have the outfit part down, but idk how i'd make a unique zombie with unique stats ._.
and i'd need to figure out how to silence the zombie moans for that particular zombie too >.<
take a look at They Knew or AuthenticZ
authenticz does unique zombies?
ah, actually, those might just be RNG limited outfits
speaking of your mod, i assume your talking here about Small Town Responders
something i noticed that even when i turn off vehicles from that mod, they tend to still somehow spawn in on the map
idk is it a bug
or something
dunno
that was because of a game limitation
had to remove the sandbox option
it'll probably return in the future
anyone knows why moved weight and items transferred added twice?
local original_transfer_perform = ISInventoryTransferAction.perform;
function ISInventoryTransferAction:perform() -- confirmed working
if self.character == getPlayer() and self.character:getModData().EvolvingTraitsWorld ~= nil then
local player = self.character;
local item = self.item;
local itemWeight = item:getWeight();
local modData = player:getModData().EvolvingTraitsWorld.TransferSystem;
modData.ItemsTransferred = modData.ItemsTransferred + 1;
modData.WeightTransferred = modData.WeightTransferred + itemWeight;
--print("ETW Logger: Moving an item with weight of "..itemWeight);
print("ETW Logger: Moved weight: "..modData.WeightTransferred..", Moved Items: "..modData.ItemsTransferred);
original_transfer_perform(self);
else
original_transfer_perform(self);
end
end```
```LOG : General , 1673554394799> ETW Logger: Moved weight: 42.43999991565943, Moved Items: 1611
<here i move 1 can of some food>
LOG : General , 1673554446782> ETW Logger: Moved weight: 44.039999939501286, Moved Items: 1613```
I don't think there's really any easy way to go about doing this. you're going to have to write a lot of code that doesn't currently exist, or try to find something you can boilerplate from another mod (which I don't know of any that do stuff like that, in the way that you want to do it at least)
you may actually have a better time using something like Superb Survivors to create a unique NPC of sorts, and manipulate it as a player object
aha i see
frankly
finding it mildly annoying cuz it sometimes fucks with other car mods i use
maybe
have you considered packing vehicles as seperate addon within the addon
or just straight up as standalone mod ?
idk
if so, and they have bandits, i could use that, then change the outfit/spawn items to just be a knife, have them only walk, mute sounds, play music?
just a sanity check - did you reload your script from F11 or fully restart from main menu?
I shall not spoil the secret plans. 🙂
if you reloaded it while in game, it's going to override your override
this is a frustrating thing...
yea that was the issue, thanks
I hate that they call it "reload", they should call it "re-execute"
not even sure what's causing my issue, other than the fact it only happens when I enable a mod like AuthZ or something else that uses table.insert on the default zombie zone
people, such as yourself, get the idea that it's resetting the lua state in some way, which it isn't
Ooooh
i see
I will however, say I already had a talk in a public channel in the STFR discord about that 😉
anyway to get instance of InventoryItem without actual one?
I need it to localize method calls but single way I found is InventoryItem.new("", "", "", "")
it's working well but will good to know better way
local item = InventoryItemFactory.CreateItem("Base.Item")
what do you mean by "localize method calls"
wait
you guys have discord for that mod
thats cool
could you sent me the link in dms
if you don't mind ofc
it's public too, found on the steam page.
Oh i see
thanks
must have missed it
for example instead item:getFullType() I'm using this
local item_base = InventoryItem.new("", "", "", "")
local item_base_getFullType = item_base.getFullType
item_base_getFullType(item)
I have a recipe that makes a drainable that isn't full. It is often done in bulk. How can I make the recipe try to combine the created thing with other items of its type in the player's inventory? Is there some pre-existing method?
yeah, looks better, will try, thx
@jaunty marten is getFullType not accessible directly from InventoryItem ?
Can't help you with the boosted stats, but look at Spongie's Clothing. He has a setup where only one Leon Kennedy zombie will spawn in the world.
InventoryItem is just a marshalled java object
accessible but it's faster
no, that's not my point
no meta calls > better performance
huh?
local getFullType = InventoryItem.getFullType
nope
doesn't work
only instance have methods like this
at least on lua side
in common things almost no reason to use it but in render the localization is a good thing
what version of lua does pz use
getFullType is an instanced variable and takes no inputs, so I'm either missing something or this isn't doing what you think it is
5.1
@high cloak it's Kahlua which is 5.1
the dark ages
@jaunty marten seems odd, the class is exposed by exposeLikeJavaByClass in LuaJavaClassExposer.java and it doesn't seem to do anything special for instance methods
even no bit module :(
basically getFullType is a method so it's have a single arg item:getFullType() = item_base_getFullType(item)
u can't call localizated method as method
don't get u
wdym?
@jaunty marten
print(__classmetatables[InventoryItem.class].__index.getFullType)
hmm, thats a peculiarity of kahlua I hadn't considered. Must be some reflection going on in the background to allow you to switch objects the method is called on
kahlua is dead af
i think the last commit to their repo was like actually 10 years ago
hopefully devs upgrade to something more modern at some point
it is, LuaJ is the cutting edge
lord
is this any different from obj.method(obj) instead of obj:method()
I feel like there is a simpler way to get this. I haven't done it in a bit but I think you can just do something like zombie.inventory.InventoryItem.getFullType to get it
wow, Fenris on the team
are you guys trying to actually get the members, or are you using this in a conditional? because typeOf(<type>) is way easier if it's the latter
he wants to get the instance method to avoid metamethod calls
you are a god, thx 
at the surface level no, but if you think about what kahlua has to do in the background to make that work with java, especially since we can't call Method objects outside debug mode, its quite different
there is no difference because Kahlua interprets lua bytecode
ohh okay i see
and the lua bytecode of those two versions of syntax is the same
but if to cache method function u will get happiness 
okay, cool! thanks much 🙂
you know what else is funny, Kahlua uses LuaJ's source compiler
yeah that's how Tyrir introduced this but now I realise InventoryItem is same as zombie.inventory.InventoryItem
_G._G._G._G._G._G._G.zombie.inventory.InventoryItem 😏
🤷 does what its meant to do and has afaik no serious bugs. Not every project needs to be supported in perpetuity
yeah that's true
it does, but there is the small matter of LuaJ generating code that the Java VM can JIT
while true do end 
but i see people localizing methods for speed and it makes me think there must be faster implementations 10 years later
I'm sure there are better options now than when PZ started development
oh @quasi geode of the woodz, what is your wisdom?
I'd have to check to be honest - the twitch integration is busted in MP and I need to fix EHE itself in MP

i tried using it and it works, still need to see how you send the heli to a specific player its all im missing since it checks if its only twitchintegration and i want the mod to work in both modes
so i can just use eHeliEvent_new(10, 8, "military") for example
then i tried to see if the events were added
local scheduledEvents = globalModData.EventsOnSchedule
for i, event in ipairs(scheduledEvents) do
print("Event " .. i .. ":")
print("Start Day: " .. event.startDay)
print("Start Time: " .. event.startTime)
print("Preset: " .. event.preset)
print("Triggered: " .. tostring(event.triggered))
end
and it shows up there, and triggered on the set day and time... wasnt working because i thought it was hour and minutes ( was using 800 and not 8 ) so i just checked the table you use to see if it was there and saw my mistake
Twitch integration overrides the vanilla events to add more parameters
I might be refactoring all of it though - so I'll give you a heads up
so the normal scheduller works ( randomly adding events ) even with twitchintegration set to true, but it gives more options? Is that what you mean?
will give it a try later on, and thanks
@sour island when you do touch EHE, do you think you could make a small refactor to the AEBS script so that adding the heli lines lives in a globally callable function?
(it'd be nice to leverage that to be able to call it from Save Our Station)
Sure - I can package the function to be returnable if that'd also work
even better
oh neat, they went and hired Fenris_Wolf
If my buddy changed lua of specific mod then what else does he need to change if he wants to make coop work? Every time he tried to launch game with that he was getting error with "path" of lua file he has edited
you need to be a bit more specific
servers do a file checksum you cant just edit like that





