#mod_development
1 messages ยท Page 253 of 1
Ok, thank you!
๐ ๐ ๐ ๐ ๐ ๐
Im trying to put a test mod into my game and I have it in the right address users/my name/ zomboid/ mods and its not showing up at all
I am new into modding on PZ and have been watching yt guides but all of them are from a few years ago so I assume my code is just either outdated or not the right format anymore
If anyone could help me fix the last few issues with my mod it would be greatly appreciated!!!!!!!!
inters and exits from the car via the frame rails,
headlight texture doesnt work,
the glass doesnt change,
Damage texture doesnโt work
hellooo, is there a guide on how to get started with making mods for zomboid?
I know quiet a bit of lua and java, but dont know where to begin
check yt chatgpt and check other mods to see formats etc its what im doing
depends on what type of mod you wanna do tbh
i want to do a shopping cart of deeath and trolley of doom
upgradable trolley and shopping cart
so probably a vehicle mod then?
i mean does trolley count as a vehicle?
a shoping cart is a vehicle in my opinion
but like..... you have to be less specific for mod making
Would anyone here happen to have the model of the duffelbag that the player equips on hand in .fbx?
I'm trying to make a duffelbag in a larger size, but I can't use the .X
I tried going to Blender with a plugin, and importing .X but the file in the game breaks completely
I wanted the player to be able to equip the item at this same size, but I'm not able to
If you import it as X in Blender, you have to make sure certain settings are set when exporting to FBX
one sec
ther eare multiple duffel bag models 
Honestly instead of messing with x and fbx stuff I'd just change the scale property in the model definition
just match them up as close as possible or something
Im trying to put a test mod into my game and I have it in the right address users/my name/ zomboid/ mods and its not showing up at all
I am new into modding on PZ and have been watching yt guides but all of them are from a few years ago so I assume my code is just either outdated or not the right format anymore
does anyone know what I might be doing wrong
i tried that too, but it's dont change anything
I tried using the default duffelbag directory and just increasing the size, it didn't work. I tried to increase it directly using Transport_bag.x it also didn't give any results
Does your mod follow the proper mod structure? Example:
MyMod/
media/
*Your stuff here*
mod.info
poster.png
As long as you have a mod.info it should load tho
Make sure you are enabling it in the game!
In red, it was a copy of the file
Duffelbag_Ground.fbx
What I did, I made a copy, renamed it and put it in the folder and the new size settings worked perfectly. I'm trying to do this now with the duffelbag in hand or in this case
Transportbag
Why make a copy? Is there no entry there for the ground item?
If I use the vanilla way it doesn't change the size
Basically I want this item, which uses the vanilla models, to be bigger. But I've been racking my brain all afternoon about this
Do you have your transport bag item?
Like do you have a definition in item script somewhere
hmm
I have tried most of the alternatives
The conclusion I reached (and I'm probably wrong) is that X files cannot have their ownership changed
I am assuming your DuffelBagTransport texture is under media/textures/ right??
I am not sure, it's a bit weird because you should be able to like even the vanilla game does it to .X files
yea its users/my name/zomboid/mods
So it doesn't even show in the mods list?
no its not in there at all
mod info has this in it
name=DannyCola
id=DannyColaMod
description=Adds a new drink called DannyCola to the game.
version=1.0
author=Doodle
it needs to be mod.info not mod.info.txt
and I am not sure if this is necessary but media folder shouldn't have capital letters in it
yes
i dont know how to do it
how to enlarge the duffelbag model in characters hand
:/
does this happen in vanilla game btw?
like with the duffel bag
oh you want to make duffel in hand bigger
I thought it was other way
the vanilla duffelbag dont have the "scale" line it's a only size
Yes
so it shouldnt be a text document?
you can see here you have LHand and RHand
which each have separate scale and offset and other stuff
This bag is for transporting short-distance items in large quantities. And I want the size (model) to be consistent with the size of space it has, so I want to increase the size in the character's hand
You can change scale of individual one by adding them to your model script definitions like:
model DuffelBag_R
{
mesh = myMesh,
texture = myTexture,
scale = 1.234,
}
model DuffelBag_L
{
mesh = myMesh,
texture = myTexture,
scale = 0.1234,
}
model DuffelBag
{
mesh = myMesh,
texture = myTexture,
scale = 1.0,
}
so changing scale of model for ground will not change model in hand etc
There are separate model for LHand, RHand, Ground, and equipped
I could be wrong one sec
I am not (hopefully
), this is how u do it
I dont need to put the path of the model?
yes, thos eare placeholder
ex: media/worlditems/allalalal
you need to fill
lol
Here is supposedly the correct left hand model? In these two files everything is set correctly, right?
@grizzled fulcrum can i send you the code its a very small bit of coding its just a test mod for a drink but i might have something wrong or whatever and its not showing in my mods for that reason
or just ss of it all
If the mod is not showing up in the mod list, the code does not affect that
It has to be the mod.info as that is what defines the mod basically
Does it not work with the .txt removed?
well is it supposed to be a text document
.
the .txt only shows because i have my file directories on in file explorer
so i can see if a file is txt mp3 etc
Yes, it needs the file extension .info
how do i change it to that lol
still looks small :/
Is Transportbag_LHand a FBX or .X?
You need to add .X file extension in model xml like
<m_MaleModel>WorldItems\Transportbag_LHand.X</m_MaleModel>
and same for female
is it .nfo or .info

nothing for now
how do i convert it or just make a .info file lol i cant find it
i need to put .X here too?
no
just rename the file, mod.info only stores plain text like .txt anyway, just can only have .info file extension
okk i got it now thanks
@mystic vessel you fix it?
Unfortunately no, probably files in X are not editable by size, for now I won't use this feature :/
When I copied the duffelbag_ground which is FBX, I renamed it and pasted it into my mod, nothing happened, but doing the same with the X file didn't work so it's possible that X files can't be edited
In the original game folder, the ones that change "scale" are all in fbx
And I have no idea how to import a .X file into Blender and have it in the correct proportion and not break within the game
I think there's a guide somewhere
Is there something special I need to do to use getText on the server side in MP?
For somereason, my translations do not work when I call getText on the server.
why are you calling it on the server?
i didn't know it doesn't work there but it kind of makes sense
๐ข
I am renaming items at time of spawn to randomize them
the name is dynamic, like "built" of multiple parts
Your server can't know the user's language...
Oh yeah, I know. I was just going to let it default to english on MP
seems I wll have to rethink this
i would've expected it to default to english since the game falls back on english when translations are missing but i guess it doesn't load translations whatsoever
which is wise really!
Dang :-(
I wonder.. if I can let the client rename it once it "sees" it
well, thanks for the answer
off to the think tank we go
local scriptManager = getScriptManager()
scriptManager:getItemForClothingItem("Japanese_Jacket_Overshirt-Black"):setDisplayName(prefix .. getText("UI_TraditionalJapanese_Kimono") .. suffix)
scriptManager:getItemForClothingItem("Japanese_Jacket_Overshirt-Black_Tuck"):setDisplayName(prefix .. getText("UI_TraditionalJapanese_KimonoTucked") .. suffix)
scriptManager:getItemForClothingItem("Japanese_Jacket_Overshirt-Dyed"):setDisplayName(prefix .. getText("UI_TraditionalJapanese_KimonoDyed") .. suffix)
scriptManager:getItemForClothingItem("Japanese_Jacket_Overshirt-Dyed_Tuck"):setDisplayName(prefix .. getText("UI_TraditionalJapanese_KimonoTuckedDyed") .. suffix)
@robust briar
That works on server?
Wait oh individual items?
i think for one of my mods i hooked whatever method returns their name to return the custom one instead
Or types?
it should be language safe that way
-- this complicated shit is needed because PZ called OnCreate everytime an item
-- is initialized, instead of just the first time the item is created, but worst
-- of all, it calls it before the moddata is applied, so we can not know if at
-- time of OnCreate if this is actually a new item or not.
local toInitializeItems = {}
local isChecking = false
local function MOTW_CheckMusic()
for i = #toInitializeItems, 1, -1 do
local item = toInitializeItems[i]
local md = item:getModData()
if not md["MOTW_Song"] then
MOTW_RandomizeSheetMusic(item)
table.remove(toInitializeItems, i)
end
end
if #toInitializeItems == 0 then
isChecking = false
Events.OnTick.Remove(MOTW_CheckMusic)
end
end
function MOTW_OnCreate_SheetMusic(item)
table.insert(toInitializeItems, item)
if not isChecking then
isChecking = true
Events.OnTick.Add(MOTW_CheckMusic)
end
end
function MOTW_RandomizeSheetMusic(item)
local randomSong = MOTW_Core:getRandomSong()
item:setCustomName(true)
item:setName(getText("IGUI_InstrumentType_" .. randomSong.instrumentType) .. " - " .. getText(randomSong.name))
item:getModData()["MOTW_Song"] = randomSong.name
end
that gives me this on server side
Ohhhh you want individual items to have special names when you find them
(Sorry for ping)
local metatable = __classmetatables[Literature.class]
local old_getName = metatable.getName
function metatable.getName(self)
if Literacy.PlayerHasReadBook(getPlayer(), self) then
return getText('IGUI_ReadIndicator', old_getName(self))
end
return old_getName(self)
end
the game fakes some item names (mushrooms showing as poisonous if you know but normal if you don't) but it's not something that's mod friendly to hook into
so this was my workaround
also the benefit is that the name never gets changed so it's translation friendly
that seems like a lot scary thing if a lot of people did that
like, one or two mods
i wanted to rewrite that section for an upcoming library mod but it seemed annoying so it's on the backburner
but you chain like 10-20 mods all overriding that over and over you get call stacks 20 deep called 1000's times everytime an inventory is open
I wonder if I can add translations at runtime...
like "build" translations
for what purpose?
well, my item is a combination of two translations
name1 - name2
if I could just generate all possible name1 - name2 combinations
on client
you can just do that in lua and store them somewhere, it could be wasteful of memory though
Yeah... I suppose
back to the drawing board
I say we ditch all world languages, and every learns esperanto? Sound good?
no more i18n
internationalization is unavoidable
iiiiiii knooooowwwwww but i can dream of a day that I don't have to worry bout it
different groups of people use different words and the diffusion is slow, so eventually they separate so far that they can no longer even understand each other
nowdays diffusion is wider, but not faster. It takes an entire generation of people to adopt a change.
in this case it'd be optimal to do something likegetText("IGUI_Template", getText("IGUI_Prefix"), getText("IGUI_Suffix")) although i don't love the triple java call
still would have to do that client side
yeah
imma just do this for now..
So, for a "normal" item I would in theory change it to ComboItem.class?
yeah, most likely
try printing the item, it might not be a comboitem
it is a comboitem, checked it in debugger, but...
Combo item is empty
it has like nothing in it
so maybe I need to override InventoryItem.class
yeah i don't really know what the game even has these subclasses for, potentially a legacy feature
i don't think that works, lua metatables are created for each class individually even if they technically point to the same inherited methods
๐ญ
so like InventoryItemMetatable.getName ~= ComboItemMetatable.getName even though they call the same method
(potentially at runtime the jvm would duplicate the methods anyway? no idea how it works internally)
do you do the metatable override just in root, or in an event?
just in root
[31-07-24 22:28:01.327] LOG : General , 1722479281327> 714,268,793> WastelandMusicians: Patching ComboItem.getName.
[31-07-24 22:28:01.328] LOG : General , 1722479281328> 714,268,794> WastelandMusicians: ComboItem.getName not found.
so.. it the original getName doesn't exist
local metatable = __classmetatables[ComboItem.class]
local old_getName = metatable.getName
print("WastelandMusicians: Patching ComboItem.getName")
if not old_getName then
print("WastelandMusicians: ComboItem.getName not found")
end
function metatable.getName(self)
if self:getFullType() == "MOTW.SheetMusic" and self:getModData()["MOTW_Song"] then
local song = MOTW_Core:getSong(self:getModData()["MOTW_Song"])
if song then
return getText("IGUI_InstrumentType_" .. song.instrumentType) .. "-" .. getText(song.name)
end
end
return old_getName(self)
end
huuh...
Oh lord haha
i rewrote this section since last i tested it
today is truly a day, ive managed to get down to one issue with my mod!!!!!!!
i got a bit of an issue theres an annoyingly persistent ISOregion on a particular map addon how do i make the purple (the one where the player is) go away it causes horrendous lighting issues and building detection issues
also is it possible to load existing workshop maps in world edit to fix them
YOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
the fleet
YEA!
working on the new rust textures
i no no wana :(
in the morning i will i thnk
<@&671452400221159444>
โค๏ธ
Has anyone ever seen a warning in logs that says "ZNet: workshop item 3198206479 is not installed"
Or whatever number
I am wondering what caues that state and how to reset it... No such id is referenced in any the normal directories afaik (ProjectZomboid/steamapps, Steam/steamapps/workshop, etc.)
<@&671452400221159444>
grrrr ty albion
sooooo close to being done with my mod!
i will hopefully be pushing it out today!!!!! just re-texturing left to do!
Jeez I just asked for some help... ๐ญ ๐
all the colors are done!!!
i want to do more vehicles !!!
im going to release the c series on its own, then maybe add it to a bigger pack if i decide i want to do that!
now i have do to the difficuly textures, damaged and bloody
(the standalone release is mostly because i want a server im in to add it tbh)
Just released my newest mod :-) https://steamcommunity.com/sharedfiles/filedetails/?id=3301008514
As always, so many new things learned along the way
ai :(
Hey, I am a programmer. I have zero art skills
Me too ๐
fair.... just makes it look weird imo!
I saw, super awesome and totally needed feature
Yeah.. I literally.. like.. I can't even tell when art is good or bad I am so art-blind
It was technically already made by Braven but it just didn't work
fair
hey wanted to ask if there's a guide on changing animations and the like?
i tried before but it's alot of trial and error
was able to change an animation just want it to be far less painful
and so far any animation guides are dead
atleast the links are
Doesn't go too much into the detail, but it teaches some bits
yeah i've seen this tutorial but i'm guessing there's no real way to avoid the painful part of actually testing animation ingame
have to reload the entire game each time for it to work it seems
I maded a mod, thats add a VHS filter
Ouu, nice for recording
For sure
Also for playing as well
It's pretty fun to play with this
You don't have to reload the entire game
The animation actually updates in real time
Nice !
Night gameplay
There will be 2 versions, one that is this one, and another with a subtler filter that is not as strong.
I need a name suggestion for the mod
I dont have any idea about it
VHS Graphics type shit
vhs screen overlay
hii, I have the text files of the folder ("mod\media\shared\Translate") of a mod translated into my language. I would like to create a mod in the workshop as a translation of that mod but I have never done anything like this or uploaded anything to the worshop, how or where can I start?
really?
i did not know that
seemed to not work like that but i guess i was just doing it based on how other games are loading
https://steamcommunity.com/sharedfiles/filedetails/?id=3301125174
Here is the mod, a mod that adds a VHS filter on player screen
Just make sure the animation doesn't run when you update it I believe
that helps alot though and should hopefully help in actually adding animations
AnimSets too can be updated in real time
gonna ask just incase all animations can be separated by gender right?
all movement
although idk if even sleeping and sitting anims can too
oh wait sleeping anim is a mod but still sitting
idk ngl
so apparently my UI is causing memory leakage
for simplicity's sake i update the window contents by clearing all children and filling it again
is this an issue, if these children contain their own children?
it shouldn't be
well I have what's basically a "show all" button and each time I press it, it deletes the old containers and creates new ones which populate themselves with relevant categories. And each time I do that memory usage goes up by 50-100 megabytes. Until eventually the game just crashes.
"deletes" as in calls "removeChild" on the parent object and sets the reference table to {}
i'm using UI3Dmodel objects if that matters
hey gonna ask here just incase you know if there's anyway to import x files besides 3dsmax
hi, how are you?
question, how usually you do mods? I mean with external programs, methodology, I'm new in modding and wanted to learn more about how to make 3D model interactive with code, like animations and more
To import .X files from PZ into Blender, you can use this addon which works in the latest versions of Blender (4.1, need confirmation for 4.2).
https://github.com/poikilos/io_import_x
Note that importing animations doesn't work this way and you have to use weird technics which involves FragMotion and will give you barely usable animations in Blender. (a guide is in #908614746071248916 in pinned)
DON'T EXPORT IN .X !!! EXPORT YOUR MODELS AND ANIMATIONS IN .FBX !
There is no point in using .X format, .FBX is way easier to use and widely used by everyone (but PZ dev :| ).
thanks chief
where do i find documentation on native java methods for PZ?
i'm sad to say you don't
there's an api reference here https://projectzomboid.com/modding/ but detailed documentation does not exist
you might be able to find resources for specific things, the modding page on the wiki should link to most
ripperoni
Are you trying to make your own custom model or do you just want to make custom player animations?
If I'm making an item and I want to create a new tag, is it as simple as typing a tag name in it's "tags" field and then referencing it in lua, or do I need to declare/initialize the tag somewhere else as well?
Actually making progress on my bulk storage mod. The plan is to make all kinds of vanilla (and mod) objects capable of storing stuff in a compact way so they take up less space on shelves or world tiles, and you can really cram your kitchen / wardrobes full ๐
Vehicles I would add to a vehicle pack if I decide to do one
noob question: how do i get a characters name? I have the isoplayer object for the respective character.
.Surname? or?
hmm or GetUsername()
first custom model, then try with npc animations, I want to do some personalized zombies without body parts (don't know if this mod already exists but wanted to do it by my own)
Oh cool well I'm not familiar with making custom models but I can give you some ideas on how vanilla zombie models are animated and how to make animations like them when you get there if you wanna ping or DM
How does it work for items with custom mod data?
Or drainables?
Currently I don't save custom weight, moddata, or names. Drainables are saved with as much as they had when they went in. So you can put in a 3/10 disinfectant bottle in the first aid kit, and then later withdraw that much disinfectant.
you don't need to initialise them
tags are literally just a list of strings attached to the item, they don't have any inherent functionality
hehe check it out
An edit button in the sandbox options ?
yes
How do you set it so that your mod says it requires another mod when you're downloading it?
Thank you
does zomboid ui has a concept of containers? like ui elements that sort their children in a dynamic way? I come from a background of using ui libraries that support containers that for example allow you to dynamically sort children vertically or in a grid or at center etc.. or is it more like html where the sorting functionality is done by the ui elements themselves? I'm lost ๐ฅฒ
I have a mod im working on that boosts all traits except fitness/strenght, by +1 for 15points, +2 for 25 points, and +3 for 45points, just curious about peoples opinions for point balance, and if i should make all the traits so that you can only use 1 of the 3, or if i should keep it at able to grab all 3 for +6.
( I made the mod initially cause i tried making all my characters previoulsy with that intent of a xp boost on all skills, but it took crazy amount of points, so i just made this to make it eaier and simple)
does any1 know a good mod that can be used only by admins?
pretty sure you have to do it manually or code your own handlers
zomboid windows don't even resize their contents automatically
web browsers's one and only job is displaying UI so they're good at it. Everything else basically just sucks. It's why even frickin OSes use web browser engines to display UI.
Hey, I've been working on a dynamic body shape mod, And wanted to try making the changes be continuous (instead of discreet jumps). for that I used Shape Keys.
My question is if there is any posible way to import this into the game (either via animation adding bones, or anything)
didnt know there was a zombie anthro survivors mod, neat
why would any one play as a furry without also using furry zombies ๐คท
true....
unfortinate it will probably be used to be mean
i may have to use it in a challenge mode though
Hey, let people have their fun.
I made that mod because playing with any amount of human zombies at all feels like reenacting Jack backstory.
(imagine looney tunes but revolving around people graphically committing sins for which they eventually went to hell to become the deadly sins, starting off with humans making anime catgirls real)
it's from the same guy who made The Screaming Barrel
Hello, comrades, maybe someone did a custom *Animation Event, please tell me how to implement it
*This is the event that is triggered when the animation is playing
Example :
<m_Events>
<m_EventName>CustomEvent</m_EventName>
<m_TimePc>0.1</m_TimePc>
<m_ParameterValue/>
</m_Events>
Variable weather โ๏ธ
My only issue is.. it takes until the next 10 minute tick for it to reset when leaving the zone
that's nice, do you achieve that from lua ?
100% lua
awesome
there is an "override" which you can set
Good evening, could anyone answer a question for me?
Ask away
Well, this is a somewhat complicated topic, but I wanted to use crafting to remove the clothing penalties
I suppose this is not the way
In the original game there is a recipe, which identifies whether you have cotton clothing in your inventory and if so, you can tear it up.
Basically I wanted the game to do the same identification but not tear the clothes, and just remove the movement and combat debuffs
So much so that I put "keep" on it so it doesn't tear the clothes. But it also doesn't have the function of removing the debuff, which could be missing (I don't know anything about LUA, I'm learning now)
hmm
I mean
at quick glance that could work
idk if runspeed and stuff stays with the item. I have found some things reset at restart and have to applied to the scriptitem and not the inventoryitem
I suppose, if you are running into that, you could do something with OnClothingUpdated and OnCreatePlayer
Separeted functions?
Like "function on clothingupdate"
Like I said I still don't understand lua so it's a bit confusing
Would I put this together in the lua file?
Honestly, the best thing you can do is look at other mods and the base game to see how events work
and the wiki
thanks anyway
are you using a mod that fixes the speed penalties?
because they don't actually do anything in vanilla anyway
Please tell me if I understood correctly, the getNumActivePlayers method gets players who play from one screen (splitscreen), and getMaxActivePlayers gets all players on the server at the moment?
So in fact in vanilla they don't have that much impact, but if I figure out how to solve this
I can move on to something better
in this case, crafting that can reduce or increase the insulation of the clothing
In my mod there are "workbenches"
If you are near such a tile, a crafting appears in the menu.
I want to do this above because I have a tile that is a sewing table, and I wanted players on it to be able to add/remove insulation from any clothing
getOnlinePlayers():size() returns # on the server.
Doesn't work in solo
getNumActivePlayers to my knowledge gets the amount of IsoPlayer on the individual client (splitscreen)
getMaxActivePlayers literally just returns 4 because you can only have up to 4 people on the same individual client (again splitscreen)
thanks guys!
one note is that getNumActivePlayers doesn't always actually reflect the number of active players
it never goes down, except resetting to 1 when exiting the game
the only real consequence of this is that using it to loop through all players can cause errors since those players aren't guaranteed to exist
that is kinda misleading oof
I saw the game doing this alot, oopsie I guess??
does it check for nil?
usually you want to do something like this to avoid errors:```lua
for i = 0, getNumActivePlayers() - 1 do
local player = getSpecificPlayer(i)
if player then
...
end
end
it can output 1, 2, 3, or 4, it's just that if a player leaves the count doesn't go down
also if they die i think there's a period where their object won't exist
usually doesn't matter because your code isn't going to be running when the only player on the client is dead but if there are also alive players it is an issue
oh wait are you talking lua only? or is it not decremented in Java too
I was talking about the java side
no null checks?
ะกan any problems arise if the code is run only with the onCreatePlayer event?
if you're looping through other players then yeah it can be an issue
ok most places it does do null check
I just happened to view the code that didn't do null checks which is just coincidence I guess
there is a lot of places in IsoCell that dont do null check for IsoPlayer.numPlayers
does your code example that you sent fit these problems? If so, what would be the best thing to do with it?
the example code is good because it checks if player before trying to use the object
i notice every instance that actually tries to access the players does null check, it's only the ones that don't actually need the object that don't
come to think of it i don't even know for a fact that you can actually drop out in splitscreen
the null checks might only be necessary because players might be dead
then maybe it's worth adding an additional isAlive check to make sure the character is alive?
if you have a player to call isAlive on you don't need to worry in the first place
oh true
the isocell methods that don't null check are dealing with keeping chunks loaded and rendering, dead players can still see the area around them until their new character is finished
yes im dumb
got it, thanks
any ideas what calling :setNPC(true) does on a character?
It creates a new GameCharacterAIBrain for the IsoGameCharacter if it doesnt have one already, then sets IsoGameCharacter.isNPC to true
I see
isNPC controls soem things like whether to use NPC defined stuff like IsoGameCharacter.NPCSetAiming() function
*in java
but it's weird, because the AI stuff isn't used (or like doesn't seem to beu sed)
yeah like its placeholder or smth for now
ya, literally most if not all of the AI functions are not used anywhere
I have my ai spawning (as far as I know), but Im not sure they are actually defending themselves because I just find bodies lmao
lol
also no threats found >:U
i didn't look at every reference but it seemed like it pretty much just disables input stuff
prevents a couple events that i guess are meant to be actual player only from being fired too
basically
like it checks if npc when the game character does WeaponHit/swing but
it's like pretty nothing burger
I don't see why we can't make NPCs in Lua, sure it would be difficult and I think the hardest part would be networking them
as long as you can spawn in an IsoGameCharacter then ya
the problem is non-players Just Don't Render in multiplayer
most existing npc mods actually do work fine in multiplayer, you just... can't see them
i've never really worked that out
I wonder if you could make an NPC a IsoPlayer somehow instead
to my knowledge all existing npc mods use isoplayers
oof
isogamecharacter is abstract anyway
I'd expect maybe it's because can't change how the npc sends packets or something
and in general the structure is just kind of insane
like we can't do anything network related much on the lua side
there is no meaningful separation between what should be in isogamecharacter and what should be in isoplayer
there's actually a class specifically meant for lua to be able to render skeletally animated character models! it crashes the game instantly if you use it :D
well that is anticlimactic..
it inherits from IsoGameCharacter, IsoGameCharacter expects this.Moodles to be initialised by subclasses but this one doesn't, so it null pointers, panics and exits to main menu
what is tye class?
IsoLuaMover
I couldn't find IsoLuaMover in the java, I found a reference to it in the Lua code but there is no actual definition of it I could find
Possible, also I found ISBaseMover in lua but not IsoLuaMover
it's meant to be a wrapper around IsoLuaMover
like they use for ui and timed actions
ISBaseMover does IsoLuaMover:new() but there seems no new function defined anywhere
i'm looking at it now, and i've called these methods before
do you see the line exposing it?
I found it now
idk why idea just hid it lol
I reopen it and I can search it fine, sorry
it intelligently detects when a class is useless and hides it to save your time
sarcasm or no sarcasm
oh I see, so IsoLuaMover doesn't create Moodles for itself (IsoGameCharacter) and it doesn't like that
so theoretically if you could initialise that would it work?
yeah, i recall not being able to find a way though
it only panics when you try to call a certain method, i don't remember which one
ok time to neglect my studies and find out if my idea is good or if I am schizophrenia
good luck ๐
OnGameStart will be ok to create the luamover object right?
should be!
because world is created and stuff
Can someone please explain to me why if I creating a context option name now takes an argument this way?
local option = context:addOption(getText("ContextMenu_Action" .. " " .. name), context, option, arg)
and it doesn't work that way, although in the game files this method works:
local option = context:addOption(getText("ContextMenu_Action", name), context, option, arg)
they seem like they're doing two different things
the first one finds the translation string with the identifier resulting from "ContextMenu_Action" .. " " .. name, the second one finds the translation string with the identifier "ContextMenu_Action" and inserts name into it
even with the translation, only ContextMenu_Action showed up for me
in the top one, the translation key you are passing is effectively "ContextMenu_Action test" assuming name = "test"
in the bottom one, the translation key you are passing is "ContextMenu_Action" and name is a formatting arg that you are passing to getText
so if ContextMenu_Action = "This is a test and name is %1" and name = "test" then getText will return This is a test and name is test
I basically just regurgitated what albion said but tried to explain it more (if that even helped idfk)
so im calling IsoLuaMover:setX(player:getX()) and all that and I try call IsoLuaMover:playBloodSplatterSound(). No errors but I don't hear the sound and don't see the mover at my location
I'd only assume I need to call the render func myself or something
maybe try that, i remember not calling it because it expected a Shader argument but it doesn't even use it so nil should be fine
however since it expects a Shader it's somewhat likely that it's meant to be called by the renderer and calling it manually won't actually render anything
i think the crash occurs when you addToWorld(), that causes the update function to start running which i think was the one that crashes
but that was my bet on how to get it to start rendering properly
Is there a debug option to display player coordinates
I really hate printing them to the console every single time
i can swear i've seen coordinates drawing to one of the corners of the screen but i have no idea
ikr I have seen it up the top left near the fps counter but it was on a modded server
It might jsut be a mod?
it must be... ๐
anyone here make a TrueMusic addon?
or... does anyone know what image(name) i need, to change the preview image for a mod?
the "your preview here"
That's "poster.png" and or "preview.png" in your mod
look at how example mod does it or anotehr mod
Unless truemusic has a specific file you need to override or something, then idk
albion I am calling render perfectly fine no errors, but one problem is I cannot see the mover 
function events.on_render_tick()
if events.mover ~= nil then
logger:debug("Rendering IsoLuaMover!")
local player = getPlayer()
events.mover:render(player:getX(), player:getY(), player:getZ(), events.mover_col_info, false, false, nil)
end
end
[...]
Events.OnRenderTick.Add(events.on_render_tick)
yeah, i didn't think it would do anything, it's probably meant to be called by the renderer only
it's literally just not there lol
So now I've got a IsoLuaMover and I cannot see if it's actually working, but calling mover:getX() is correct location
adding to world would probably add it to whatever list the renderer draws from, but then the game crashes
or at least that's what i think caused the crash
was looking at the modtemplate in the folder directory, and figured it out, thank you though
I add it to world too, nothing shows up ๐ฆ
but no moodle crash...?
nop 0_0
I do just these:
-- Call some stufffff
mover:setX(player_x)
mover:setY(player_y)
mover:setZ(player_z)
logger:debug("Set mover to:\nX=%s\nY=%s\nZ=%s",
tostring(mover:getX()),
tostring(mover:getY()),
tostring(mover:getZ()))
mover:addToWorld()
mover:playBloodSplatterSound()
ok, i'm gonna get in debug and see if i can get it to crash again
it was quite a long time ago, all i remember is that moodles was the reason
I do not see it at the location and I do not hear the splatter
maybe its because its onGamestart
I will use a keybind callback to see if it works triggering it later
i think i was just using the debug console the whole time
yeah, okay it's getCell():addMovingObject(mover) that crashes
i was trying that because that's what ISBaseMover does
it just adds it to the global moving object list, but it crashes the game
something in IsoGameCharacter.updateInternal is not prepared for Moodles to be null
oh you're kidding
it crashes because of unused crap
it's because Moodles is null
there's no null check before it does this
but the only reason this code exists is to update sanity, which doesn't do anything
o
lol
ok I called addMovingObject and instead of crashing to menu the process died
๐จ
If there was a setMoodles() func for the mover this would easily be fixed
but noo
have a getMoodles() but no setMoodles
i tried to do some stuff with reflection to see if i could set it but i just noticed Moodles is final anyway
sad...
this would be a really cool thing to let us do, it looks like it was intended for animals so it'll probably be either fixed or replaced in b42
I mean if we could somehow prevent IsoGameCharacter.update from running then it is ok right
nvm even if the pcall errors it still does update
im just abandoning this
yeah, i don't think it's possible sadly
frustrating that it's really just one step away
yeah im thinking "if only I was employed by TIS I could fix all these issues" but then that's saying they haven't already fixed these issues for the new update
hey what is the survivor and isNPC stuff in the game code ?
not sure about survivor but isNPC is a whole nothingburger, most of it is placeholder and is seemingly unfinished (note GameCharacterAIBrain or whatever the class is)
there is even a survivor creation thing so survivor dont seem like it's a player
survivors are used for the main menu character preview
a lot of older code refers to human characters in general as survivors
sorry I was stuck loading the game but thanks !!
also I dont understand how the map works like, is it possible to know Im on a road, on a vehicle scene, can you path to distant roads, can you know what distant map looks like (I heard the map has cells and chunks and the code can only see nearby cells/current chunk??)
Im just so confused why there seems to be 4 types of characters when Ive only seen two:
IsoGameCharacter is an abstract base class for characters, it isn't its own thing
IsoSurvivor is used for the character preview in character creation (though from discussion with other modders it seems like it's redundant even there), IsoLivingCharacter is a base class for living humans which is also largely redundant
99% of human functionality is packed into IsoPlayer
at runtime the cells don't exist, confusingly there is an object called IsoCell which is actually the entire current loaded area, chunks are tiny 10x10 areas
I see. Can I outline what I would need to know what could help my goal ? Im trying to do a mod but I dont know to start. 1- Im not sure where to look for a vehicle radial menu, V option to select a vehicle as an AI follower 2- Im not sure how to detect that Im on a road and the road comings up in the current cell so I could prioritize following the road rather than the guide vehicle the player drive. 3- Id need some sort of very dump human-looking driver for those ai vehicles that I can dress up and who can optionally shoot 4- I dont know how to detect if the vehicle is towing something, the guide vehicle could be an AI (to be able to form convoys of 10-20 cars)
ie: the guide vehicle would provide the waypoints for pathing, the only goal is for the AI to follow them if the lead vehicle is above X where X is the lead distance. SO if you say 10m and there is 3 nodes every 5m it would follow you 2 node vehind
So far I have these thing in my notes: getTowedVehicleID / sendTowing / getVehicleTowedBy / BaseVehicle / CarController . It seems like just simulating it by towing is a bad idea, and Id need to keep a list of all the ids of the vehicle in the convoy in a list
I also tried to find what manage the cruise speed but I couldn't. This could help to saves fps by using cruise when the player keep going straight in nodes/to follow the nodes at says 30mph to save fps/avoid crashing
as far as being able to do that --- farming simulator has no AI at all just like zomboid, yet this was able to be done with less than 1000 lines of codes and no external A* dll in a mod and this include seeing the driver/being unable to get in driver position
i don't really know if it's reliable enough for this but there's a special foraging zone for roads
the biggest problem though is i don't think you can even control cars from lua
not really a problem there are java mods on the workshop like betterfps
also lua is interpreted like 1980 gwbasic so I doubt it would be fast enough for anything AI (that's the mistake pzns and superb makes imho rather than using c++ native from java)
I expected that lua might only be useful for the frontend to set up the follow thing / convoy from a UI
like telling the following cars to be offset 10m back, 1m to the left to not get stuck into 4-width garage doors like when towing
also it's not fully self-driving it's just following very close nodes from the player driving and removing them as it pass over so it just imitates the player driving in a way
oh, well, you can do whatever you want with java, yeah, it's just not really the common route
this seems to me like it means that I can only read the current roads from a current position from the loaded cell even though the in-game map seems to identify distant roads
the in-game map uses some information baked during the map compiling process
that data may be more helpful
Random question but I'm just laying in bed and thought about properly reversing LightingJNI code and thought 'what does the JNI in LightingJNI mean?'. If anyone knows please lmk. I thought it might have something to do with like java interface but I've got no solid idea.
JNI means it uses native code, like when above I mention using C++ to make the AI faster that is what I meant
where as java normally compile precompiled bytecode to a final platform specific .exe in memory / native code
yeah I kinda think my AI mod is dead in the water if npcs don't show up in MP
I wonder if PZNS works in mp, hm
do u like use Superb Survivors?
nah, Im working on my own ai mod
what mod is it?
UtilityZ which is a utility ai mod that uses scores to determine behaviour
aight
say ur hunger score is low, but ur fear score is high, youll probably decide to run away until your fear score lowers
its simple but robust
the real trick is figuring out the actual native methods needed to bring about the desired behaviour
I have the npc spawning down, now to figure out idling and pathing about
hmm for some reason the npc will attack the zombie but will just clip thru it?
i wonder what I have to set to enable collision
Is there a specific modding discord? Im looking for help with making a mod edit for personal use and generally better understanding code.
Yes
Give me a sec
appreciated
How can I stop a zombie from being able to be shoved over
You could perhaps put it in a custom animation state and alter knockback result by editing variables on it
Idk beyond that
Is there any way to prevent vehicles from fading out when the line of sight is blocked?
No that's not needed
I don't remember but ik it's easily doable
I can't get UI to register key events. I've added ui:onKeyPress(key) and called self:setWantKeyEvents(true) but the event handler is never triggered.
well specifically i'm trying to add keyboard shortcuts for UI buttons
@drifting ore I haven't personally worked with keyboard shortcuts all that much, but, if you're trying to trigger certain UI functions while the UI instance is active, why not use OnKeyPressed event?
function OnKeyPressed(key)
if myUI.instance then
print(key)
end
end
Events.OnKeyPressed.Add(OnKeyPressed)```
idk if the event is intended to be used with UIs though
global event would work but i'd need to manually keep track of which elements are consuming the events or not and it'll become a huge mess in no time flat. You can just imagine how it would go when you have multiple windows with multiple text entry boxes.
UI code has this all handled already, I just can't configure it properly.
does anybody know how to change textures on objects? like tvs, paintings
i think the event only fires for 'root level' ui elements added to the ui manager directly
if that's any help
not really ๐
yeah it sounds like you're right. Global event it is then.
All the textures are in the textures folder so why not just look for the specific one
it's probably in the pack
how do i open it?
i can't even make a pack file
either i don't know how to use tilezed or it is broken
because when i try to place something it doesn't show on the grid, however it shows on the minimap
In the menu bar there's a dropdown that lets you open pack
or view pack or something
New to PZ mod development and coming across some confusion with variables and scopes. Is there a way to store the current player into a global variable I can access from different functions throughout a file? I need the player data stored to work in both Solo and Multiplayer.
local variables will be available to all scopes below them, so you can declare a local outside of any functions, loops etc if you want to access it throughout the entire file
variables that aren't explicitly declared as local are global by default (accessible to all files) but it's recommended to literally never use globals if possible
in your case it's easier to just call getPlayer() whenever you need to access the player, but you can cache it doing something like this:```lua
local player
Events.OnCreatePlayer.Add(function(_, playerObject)
player = playerObject
end)
function myFunc()
-- do stuff with player
end
besides polluting global namespace, you run the risk of overriding someone else's globals and destroying their mod or in some cases core PZ functionality
globals are necessary to use if you specifically want to expose your data to everyone. But same caveats apply.
they're not necessary to use
Right when I said global I should have mentioned I'd still be using it as local just be outside the functions.
the only situation you should be using globals is for certain java systems that look for globals, otherwise globals are 100% avoidable
technically yeah but i'm not gonna split hairs over require globally_available_moddata vs globally_available_moddata = {}
it's effectively the same
the global method is slower, still pollutes the namespace (even if only by a little bit), still risks name conflicts, etc
modules are preferred for a reason
If I use the getPlayer() will that be an issue in a server game at all? I've seen there's another way by using the index of the player that's online but wasn't sure if that was a required method for a server to get the correct player
if your code is running on the server then you're asking a much more complicated question
but if you need to store a variable that's accessible to multiple functions this is the sort of technique you'd use
Not clientside. It's only an issue for splitscreen
hey guys, what are the parameters of context:addOptions()?
getSpecificPlayer(index) is for respecting splitscreen @stray owl
most code concerning players can run client side fine so i'd stick to that if possible, depends on what your mod is actually doing
So not necessary if I'm just writing code that I'll be using in a dedicated server?
Not if you are unconcerned about splitscreen, and not if the code is running on a client connected to the server
Serverside it would not work afaik
I imagine it would be meaningless or misleading even if it did
both return nil on the server, it has no concept of local players
Figured
if your code has to run on the server you'd most likely either wait for an event or command that passes a player to trigger it or you'd loop through getOnlinePlayers()
Currently I've configured it to loop through getNumActivePlayer() which gives me the index of the player and then sets variables based on that player but I can't figure out getting that data to be useful outside the function that i'm running to loop threw the players.
getNumActivePlayers() returns the current number of splitscreen players
the getPlayer() getSpecificPlayer(index) getNumActivePlayers() etc methods only care about people playing on that client
what are the params for? and target can be the item itself?
Name is the translation string of the option, the target is the target to add it to (like if you are adding it to WorldObjectContextMenu, then the target would be an IsoObject), onSelect is the callback for when the user selects the entry and param1, param2 etc are params sent to the callback
its using OnFillInventoryObjectContextMenu for an action on a item iteself
so the target would be an InventoryItem I think
ah, so param are the parameters for the select?
yes
okay thanks
they are optional
oh, target is a bit of a misleading name
it's just the first parameter sent to the callback you gave it
I thought it had some alternate meaning apart from also being the first param ;-;
plus why would target be before the callback lol its so weird
you'd think the special name and weird placement would mean it does something special and important ๐ญ
what is happening is that I want to have an option to add an enchantment to a weapon, but if I have multiple weapons in my inventory, it shows one for each weapon I have on me, how do I make it appear only one for the respective item?
my guess is they made addOption(name, target, onSelect) first, realised they needed more arguments and didn't want to make a breaking change
the issue im having is how do I add this to a specific item, because it is adding the options to every item in my inventory for some reason
could you show your code?
how do i send code in discord again?
surround it like this: ```lua
your code
```
local function addEnchantment(weapon, player)
weapon:setDisplayName(player:getDisplayName().."'s "..weapon:getDisplayName())
player:getModData().LevelUp_enchantedWeapon = weapon:getDisplayName()
player:getModData().LevelUp_currentXP = 0
end
local function addContext(player, context, items)
local playerObj = getSpecificPlayer(player)
local inventory = playerObj:getInventory():getItems()
for i=1, inventory:size() do
local item = inventory:get(i-1)
if item:getCategory() == "Weapon" then
context:addOption(getText("UI_Enchant"), item , addEnchantment, playerObj)
end
end
end
Events.OnFillInventoryObjectContextMenu.Add(addContext)
ignore the lua lmao
yeah, you're looping through the player's inventory looking for valid weapons instead of checking which item they actually selected - you can get which item they clicked with this snippet:
local primaryItem
if instanceof(items[1], "InventoryItem") then
primaryItem = items[1]
else
primaryItem = items[1].items[1]
end
something like this might work:```lua
local function addContext(player, context, items)
local primaryItem
if instanceof(items[1], "InventoryItem") then
primaryItem = items[1]
else
primaryItem = items[1].items[1]
end
if primaryItem:getCategory() == "Weapon" then
context:addOption(getText("UI_Enchant"), primaryItem, addEnchantment, playerObj)
end
end
ohhh nice, Ill try, thank you very much
Hi everyone, I have a quick question, i've my global mod data stored in GameTime():getInstance():getModData and works pretty well in SP, but when I start debugging it for hosted MP I use it in server-side. First it works well but when I reload the world all that modData is not saved. Is that normal or I missed something?
that's not normal
you shouldn't use GameTime's mod data anymore though, it's a legacy feature
look at the ModData class instead, it's intended for this kind of thing
me bashing my head against the wall thinking why won't my translation file work
when PZ only looks for translations in the hardcoded set of file names
๐คฆ
ohh got it, thnks
Sup, is there any kind of documentation about modding?
I pinged him into them
So I did some more testing last night and still no luck. I just need my mod to get the data from the individual players of the server for example a player joins my server and is running around playing with others. I need the mod to only trigger events on that player based on there personal stats etc. I know it's probably got to be the most simplest things and most mods probably do this but I'm just having no luck with getting it to work.
Dumping a thought here:
The zombie.ui.* API should take into consideration passing an AngelCodeFont argument alongside UIFont so custom fonts can be more readily used in mods, instead of overriding the UIFont enum values when loading mods.
Reasoning: Access to the current ISUI font-rendering API. With custom fonts, AngelCodeFont API has to be used manually inside of the render thread-executed code.
It's fairly easy to create AngelCodeFonts.
mod = LuaManager.GlobalObject.getModInfoByID('pymod')
modDir = mod.getDir()
self.font = AngelCodeFont(
modDir + '/media/fonts/daggersquare.fnt',
modDir + '/media/fonts/daggersquare_0.png')
# ..
font.drawString(x, y, text, red, green, blue, alpha)
There's the files for anyone who wants to test / use this font.
This is the tool that TIS used to generate their fonts: https://www.angelcode.com/products/bmfont/
I'll be making a tutorial for all of this since it seems like this part of the game's exposed API isn't known or fully understood.
Surprised to see no reply or messages since my post right before heading to work. =/
I might be the only one with an opinion on this lol
I wanna try and look at a map's loot table setup, is there a way to do that?
Because I got all of about piss all in a police station, 3 boxes of ammo and a gun a zombie had. I'm not on apocalypse, and I want to figure out why the map maker had it so the police armory had clothes in it.
Haha I've been away from this channel but it does seem intriguing to me. I have a friend who wanted to add custom fonts to the game and I told them I knew of no way to do so due to the way the game handles fonts.
I think people interested in font stuff are probably just few and far between
Personally I was annoyed by the lack of a largish font with even-height numbers when I was writing Position Breakdown
All the numbers in most PZ fonts go up and down in a way that looks dumb to me lol and doesn't make text look properly balanced vertically
You're not entirely alone but I will admit it's sometimes hard to see you from here. ๐
its done
ended up naming it C-series Ford cabover on steam
I've got a timed action that I transfer the item that is used from a backpack (I search inventory recursively) to the main character inventory, should I do this transferring to and from the backpack inside the action itself in perform() and stop() or in the place where I add the timed action to the queue?
Also, is there any way to get the lua extension to recognise what the type is after an if statement checking the type like in the image attached, or is it purely static??
you should queue an action for moving the item into the inventory before queueing the action
usually you could do ---@cast var IsoObject but since it's in a table no luck
wth that exists
unfortunately widening casts from functions like instanceof doesn't seem to really be something on luacats' roadmap
I've literally been doing like
--- @type myType
self = self
``` for the LONGEST time
Is it because instanceof is from java(?) or is it just not implemented feature
it's just not an implemented feature
I am unsure if lua natively has instanceof
yeah it's a pz thing
most environments do have something similar but apparently it's very difficult to implement in the language server
I just do this and it work fine ty
I see that this works too, but I guess it's not checking for parent class like instanceof does right
oh, that works?
yes but its not the same right
if it doesn't check parent class that's a pretty handy option
Unless it just returns a table because lua doesn't actually know what IsoObject is but only the primitives
I will test
in regular lua you'd expect to see userdata from this but i know pz mostly obscures that
it is just userdata ๐ฆ
a shame...
I have idea
ok its kinda messy but this technically works
--- @param obj IsoObject
--- @return string type
local function getType(obj)
return obj:toString():trim():match("%a+%.%a+%.(%a+)@%x+")
end
--- @type IsoPlayer|IsoObject as long as it inherits IsoObject in some way
local obj = getPlayer()
if getType(obj) == "IsoPlayer" then
print("It's a player!")
end
though I don't think I can recommend it lol
I mean I guess it doesn't technically check for parent class like instanceof and it actually gets the Java class type unlike Lua's type(v) but it should probably only be used for that specific purpose because why wouldn't you just use instanceof in literally all the other cases
I edited to a func so its more elegant but thats the best I could think of to achive it lol
in an unreleased update for accessible fields i build a map of metatables to typenames at load time and use getmetatable to determine what class an object is
sounds interesting
i didn't really consider this much simpler solution but it already has to traverse the metatables for its main functions so it made sense to do it that way
can someone tell me what is "WeaponSprite"?
Model name for the weapon I believe
Like the 3d blender item?
it's the model block in your scripts file.
e.g. Saucepan has WeaponSprite = SaucePan
Which I think points to the below
model SaucePan
{
mesh = Weapons/1Handed/SaucePan,
attachment world
{
offset = -0.0490 0.1370 -0.0490,
rotate = 0.0000 -45.0000 0.0000,
}
}
hi, someone knows the lua file that manage the wrecked car salvage/dismantle in vanilla? ty
try ISRemoveBurntVehicle.lua which is called in ISVehicleMenu.lua
ISVehicleMenu.onRemoveBurntVehicle(player, vehicle) looks like it should initiate walk to remove a burnt vehicle.
tyvm
Is there literally any reason why multiple mods have to use multiple of their own custom UIs for moodles when the game's one already exists
Like it infuriates me genuinely even though it shouldn't
because player playerObj isoPlayer character, that's why
(what?)
I don't remember the reason
But there's some limitations to adding your own I believe
๐ญ
As in the base game has limitations for it's moodle UI, or the mods that are creating their own moodle UIs are limited?
The base game's traits, skills, professions, and moodle systems are some of the oldest systems, and I feel like have those that have modding APIs were implemented after the fact and one at a time for each
I threw a mod together quickly for my server, just to add a number of currency options for us, but when I loaded it onto the dedi after checking it worked in local host (no issues) it proceeded to essentially nuke the server, to the point where people no longer showed up on admin map / deleted key rings etc.
I followed a guide, so I have no idea how such a tiny mod managed to screw everything up so bad? Could anyone with free time have a look over my work to see where I've gone wrong so badly?
Hey check out #mod_support
Isn't this for making mods? and the other one is for end user support?
"mod development" is for making mods
mod support is for help regarding mod issues that users have
yeah its my mod, I made the mod
Do you have a link to the mod / github for the code?
Ah nvm alright
I haven't got around to bothering with a github as it's just me
Any errors?
When looking through the server debug log, it shows errors for a couple other mods but nothing that would/should indicate it deleting keys, stopping admin map from working etc.
And if you remove the mod the problems go away?
Yeah
Everything is peachy now
second I add my mod, all goes to shit
Just fetching the dumpfile from local host quickly
[05-08-24 18:59:29.112] LOG : Mod , 1722880769112> 170,261,005> mod "BluegrasssCW1" overrides media/scripts/newitems.txt.
Have I biffed up inheritance somewhere and this is causing the issue? Because there's a base file called newitems.txt in media/scripts for PZ?
I don't think in any of the logs I've seen that message for other mods.
if you use the same filename as a vanilla file, you override that file
which in this case deletes nearly every item in the game
fml I had no idea there was a newitems file until I looked a second ago
name your file something unique to your mod e.g. MyMod_items.txt or MyMod/items.txt
lesson learned.
Sorry stepped away, glad you figured it out.
If I hadn't gone through the steps to get a log, I wouldn't of figured it out, so thank you for offering insight ๐
is it bad to save a .txt file to the server to use as a "backup" for something? kind of like how the vahallla vehicle claim saves the car claims?
Im making a welcome package mod and using a folder to keep track of who got a welcome package. Each username gets their own .txt file in the folder. but i realised that folder could quickly creep up to like 600-1k+ files. would that be bad for the server in general?
Hey so I'm currently making an True Music mod and I have already added the music but I was wondering if you had to delete the mp3 files after the OGG files are created?
Not really
Yes, probably
You only need one music file
Figures
I'm not familiar with True Music tho
Iโm pretty sure the mp3 is redundant
Gotcha
If you DM me when you're done I'll look over your setup before you Workshop it
Or you can post unlisted and I'll review it
Alright let me do that now
hey! how can I know who killed a zombie and with which weapon? do I use OnZombieDead()?
you can use OnZombieDead but that will call for every zombie, so if you don't want that you'll have to check against that
I guess IsoZombie.lastPlayerHit might help you get the person who killed the zombie I guess?? (its player index)
Though there is this too, idk if it useful
maybe you could somehow pair that with OnZombieDead
Please tell me the method for forcibly lifting the character from the ground during TimedAction and is it possible in the faceThisObject(object) method to calculate the object by coordinates or is there a more precise method of determination?
I would use OnZombieDeath event and call zombie:getLastTargettedBy() to get the player.
I know player:getLastTargettedBy() works in the opposite direction
Will that always get the person that killed the zombie? I saw that but I thought maybe there could be possible error if its targeting switched before it died
Not sure tbh would need to test thoroughly
does lastPlayerHit even work? I think it would be more reliable if it does because the last person that hits a zombie is usually the one to kill it whereas targeting may switch between players before it dies?
Like if you sneak attack a zombie and it's targeting doesn't switch to the player that attacked it, does it become nil or does it refer to the last player that hit the zombie (possibly far away)?
i don't htink that's a thing
lastplayerhit is set in the same function that triggers the onhitzombie event
that said this only appears to trigger in online game, otherwise it's -1
that sucks
I tried it to check if the player was the last person to hit it to get the kill but it isnt working
i couldn't find zombies using setLastTargetted to player but i didn't look very hard
Ive only found the zombie version too
all of them returns IsoZombie
Ive made a bad work around that doesnt work all the time to count kills, if anyone has any idea how I can do that please let me know
setTargettedBy only accepts IsoZombie and it stores the value as IsoZombie. Which I don't think is compatible with IsoPlayer since it's in a different inheritance branch
then again my OOP is super rusty so maybe you can cast it so it accepts this anyway
but that would require downcasting IsoPlayer to IsoLivingCharacter or lower, and then upcasting to IsoZombie
and I have an inkling that it's not a thing in Java
getAttackedBy might work. It works in IsoGameCharacter level.
particularly, this is set when the character dies
you think this might work for zombies attacked by players?
also im wrong, lastPlayerHit isn't even exposed to lua at all
because from what I see here it is on players
hopefully
IsoZombie is a subclass of IsoGameCharacter
yes
ill try
thanks
it worked thank you so much
its being a bit inconsistent tho, for some reason sometimes it doesnt count
Do you notice any patterns to when it counts and when it does not?
actually it was spawned zombies from the admin tools that werent counting
some of them werent counting
but random zombies from map were
can I use math.floor() in lua?
Im getting mixed answers in the internet
Glad you got it sorted, just noticed that ret value, thought the targetted by function returned a game character from memory, my bad.
no worries
yes
Has anyone actually tested the speeds of all the math functions in PZ?
I know someone tested math.pow which is slow but if not I will test those myself in due time
Please tell me the method for forcibly lifting the character from the ground during TimedAction and is it possible in the faceThisObject(object) method to calculate the object by coordinates or is there a more precise method of determination?
insanely slow
@ the math functions question
most of them are equivalent to one line of code anyway so just write them out when your code is performance sensitive
wdym calculate the object by coordinates
like get an object based on it's xyz?
yes, I need to get the exact location of the object, within 1 tile, and as I understand the usual method faceThisObject(object) finds the object as the tile on which the object is located, and not the object inside the tile
I got no idea how to mod but I need to make a mod that lets me change the percentage of being bitten, scratched, and lacerated
or atleast know what file to change
well im not sure because I've never needed to do this but this is what faceThisObject does when you call it (assuming object isnt a vehicle or barricade)
vector2 being the IsoGameCharacter.getTempo()
so this method already receives x and y of the object?
vector2.x is not the object x, and this.getX() is the player's X
so not really
I am unsure myself on how this code works
It seems object.getFacingPosition(vec2) uses the object's X and Y
but this is the X and Y of the grid square I just realised
most objects don't have a sub-tile position
I was just about to ask if an object can even be misaligned from a grid square
only like, moving objects, world inventory items, etc do
thanks, can you pls also tell me how to force the sitting player to stand during animation, without stopping this animation?
Any issues with this at all so far? Just asking as I thought of a way to kinda solve this IF the solution already was broken somehow. If not then ignore myself.
what did you think about? because I think its working but just not always with spawned zombies with tools
I was thinking combining events OnZombieHit and OnZombieDeath and that would work all the time (or should in theory)
hey, I have the following:
local function OnPlayerUpdate(player)
print("OnPlayerUpdate START")
player:setHealth(100)
player:getBodyDamage():setInfectionLevel(0)
player:getBodyDamage():setOverallBodyHealth(100)
local bodyParts = player:getBodyDamage():getBodyParts()
for i = 0, BodyPartType.ToIndex(BodyPartType.MAX) - 1 do
local bodyPart = bodyParts:get(i)
bodyPart:RestoreToFullHealth()
end
print("OnPlayerUpdate END")
end
Events.OnPlayerUpdate.Add(OnPlayerUpdate)
In the health menu, all my bodyparts are full health. My characters health constantly stays at 100 but eventually, with enough zombie attacks, they die (despite still having 100 health). Purely for the sake of understanding the health/death system, I'm just trying to make my character unkillable through code. What stat or mechanic am I overlooking that is causing their death?
isDead can return true if either character health is at 0 or the bodydamage health (which is separate from that) is at 0
to start with I would change the iteration definition to for i = 0, bodyParts:size() - 1 do
it seems unlikely that your version would cause an off by one error, but this is a more direct way to do this
or it could be that the way you do this, it doesn't triggers bodyDamage health recalculation so it's allowed to deplete despite you resetting limb health
you can try overriding it with setOverallBodyHealth
I thought I covered the character, overallbodydamage and individual bodypart healths in that code, something else is "killing" my character but actually it's a sort of death state but not actually dead. The UI changes to having the New Character button (no Quit button though unlike normal) and the normal moodlets are still showing on the side. Interestingly, when exit the game and come back, my character is fine
Did you turn zed after death?
Oh wait what
no, so I'm guessing it's more of a UI/state issue
You appear to die, rejoin, and are not dead?
not even the death moodle
๐ค
the character "dies" as in drops to the floor, UI changes so only "New Character" button is shown but no other UI buttons. Quitting and rejoining has a seemingly fine live same character again
during that "death" state, sometimes the character gets up but I cannot move or anything
I gotta pop out for 10-15, will revist this in a bit
try using restoreToFullHealth on bodyDamage as well as limbs
well actually calling getBodyDamage():RestoreToFullHealth() would internally reset all bodyparts to full health too
also pardon me for suggesting using setOverallBodyHealth even though you literally already do exactly that. I'm very tired.
no worries, definitely seems like there is another mechanic at work that is causing the UI to think the character is dead when the engine doesn't
Did you try using player:getBodyDamage():RestoreToFullHealth() out of curiosity? I haven't checked the Java but perhaps there is something it checks that you're missing.
They did
player:setHealthCheat(true) might work if the object is to simply become invincible
My approach would be, getSpecificPlayer(0), getStats(), getBodyDamage(), set all individual stats appriopriately (example: setHunger(0), but setSanity(1) etc). Then end with RestoreToFullHealth()
Yeah I guess it's possibly a stat-related death. I'm unsure of all the game's death conditions.
Maybe this will help you?
anyone ever have their imports in a script file cuase the server to not boot up?
{
imports
{
Base,
GalacTac,
VCEW,
}```
that crashes the server but removing GalacTac and VCEW and the server boots up just fine
im realy confused cuz ive added imports like that several times and they worked just fine
That in theory should work, only thing I can think of is those modules dont work (or are nonexistent)?
or maybe the last element cant have a comma (VCEW and not VCEW,) but I doubt thats issue
well the VCEW is within the same mod just a diferent file. and Galac tac should be working my character in game is wearing the outfit
i have no idea ;-;
ill try that
yeah thats literally where im at lol
im about to just do it the other way without importing just to see if it works or not
anything script related is a pain in the ass, I might write a vscode plugin for it when I get the chance because its just straight agony
im just literally trying every combination or comma no comma just VCEW/GalacTac
hopefully something works
nope nothing works. as soon as i add 1 of the imports it wont boot up. i give up. im just gonna write the module name before the item ids and not import it
i realy dont know. i followed the exact same way ive done it in the past. and i even tried adding just 1 at a time. comma/no comma. nothign worked. i give up ๐
module base imports base is a bit weird now that I look back on it
since you are in the base module already, you shouldn't need to import it
I would like to introduce you to my first mod https://steamcommunity.com/sharedfiles/filedetails/?id=3303056007 I receive criticism and feedback
no hablo espanol
traslate man xD
I would put the description in English if you want more exposure
so here's my updated code a little more condensed:
local function KeepAlive(character)
character:setHealth(1)
character:getBodyDamage():RestoreToFullHealth()
for _, bodyPart in ipairs(character:getBodyDamage():getBodyParts()) do bodyPart:RestoreToFullHealth() end
end
Events.OnPlayerUpdate.Add(KeepAlive)
and still, it just cannot keep the player alive. My player's body parts health and character health stays full when under attack by zombies but he still will drop to the ground screaming and die. The "You have survived for x time" text comes up and I cannot move but quitting and coming back in my character will be fully alive, mobile and in perfect health again. Any other ideas what mechanic is "killing" me?
Have you opened up the debug menu and looked at moodles
no, I'll check now. Could there be a hidden one? Still I'm unsure how it kills me because I'm looking at the source code for anything that kills the char and couldn't see anything other than health
I would also chuck an if statement in
that if you health <= 0
print something
In theory it should never hit 0 right?
at the end? setHealth and RestoreToFullHealth is already pumping it back to full
I'd try at the start first
it never gets close to 0, it does drop a little from each hit, but never drips below 90 before going back up
you can't loop through bodyparts with ipairs, it's not a table
you should be seeing an error
oh ok, will fix it but wasn't getting an error. I was doing it like this before and still was dying:
local bodyParts = player:getBodyDamage():getBodyParts()
for i = 0, BodyPartType.ToIndex(BodyPartType.MAX) - 1 do
local bodyPart = bodyParts:get(i)
bodyPart:RestoreToFullHealth()
end
are you getting dragged down by a horde of zombies?
that's just a special instant kill thing, and i guess the bug is coming from healing after dying
yes.. what's that mechanic called?
i think it's just called drag down
actually I tried setDeathDragDown(false) and that didn't help but maybe it's too late already
I wasn't sure what that was when I tried it. I think you've pinpointed the issue, thanks, I'll dig into this more
so by the time OnPlayerUpdate is trigged, the check for updateDeathDragDown() has already fired. I wonder why OnPlayerUpdate fires so late in the update chain
should probably use setVariable
since its animation related
Hello @pulsar rock
I'd like to know if I can DM you to ask some questions about the Skill Limiter Mod? I'm having an issue with it and the Occupations-Mod I made
you could add another xml file same as the one with dragdown but remove the players hit react
and add a bool condition for it to checks
if that condition applies to your player then it will use that xml instead of the vanilla one. so you get to avoid the dragdown that way..
Sure thing! Happy to help!
not sure how that works but thanks I'll look into that
yeah so the animation files can also check and set variables to players and zeds
so the zed is the one setting the hitreact to the player via xml
check the animset folder
just duplicate the zombie xmls that contains dragdown related stuff and modify em
goodluck
thanks. I'm a RimWorld modder trying my hand at some PZ but I feel like a modding noob again trying to figure all this out
alternatively you can do the same thing but with the players hitreact xmls
i think this is s better solution
oh another thing
if you applied the setDragdown to the player and it didnt work
try it to apply it on the zed maybe?
im on mobile rn so i cant check
for now I'm just going to disable drag down globally but I'll definitely check out the xmls
Is there a mod out there or in development that lets you shovel snow? I'd really like to keep my parking lot cleanish with Canadian winters and it could be another good way to train fitness
Hey, does anyone know where the magazine "The Herbalist" defines its TeachedRecipes as "Herbalist"? I was going to try use it to make a Nutritionist Magazine that would appear on the Training Materials and count as read if read.
like where is the item defined? it's in scripts/items_literature.txt
No, as in what it's "recipe" is like how recipe.txt defines some of the recipes.
oh, so known recipes is just a list of strings attached to the character, it doesn't technically have to correspond to an actual recipe
the foraging system itself checks if the player has that recipe and allows them to find the items as if they had the trait - there isn't an actual recipe going on here
there isn't really an equivalent for nutritionist, you'd have to actually give them the trait when they read the book
If I set the TeachedRecipes as something random that is not attached to anything else, will it still be able to be marked as read and unread?
that's basically what the herbalist magazine is doing so yeah
Thank you!
Having a small rigging problem with the female model on blender, if someone wouldnt mind me dming them can you @ me Here ๐ฎ
how do I delete file previously created by getFileWriter?
you can't
If only ZomboidFileSystem was exposed to lua you could to tryDeleteFile but its not ๐ฆ
chocolate coated oreo 
If this was a reply to my message, do you know a way to raise a player without stopping the action? I know there is a setSitOnGround method but the problem is that during this time the player is applying the animation and can't stand up until the animation is finished, is there a way to get the player up during the animation without interrupting the animation or not letting him sit down?
does setSitOnGround only work while the action is not playing?
@muted garnet
sorry I forget to ping
I don't think I know of a way to do that
You might be able to do some thing in the action's update if there is such a method to like pause the animation or something then stand up and resume though im out of idea
does anyone know where i can go to find the game's temperature system? im looking to make a mod for copper state that makes the temperatures more akin to a real desert and i've dug around eveywhere - can't seem to find anything that will allow me to do this aside from just changing the ambient lighting and such
like biome/weather temps?
yeah, like the game's general outside temperature systems
what about getWorld():getGlobalTemperature()
wait no thats the whole entire temp
The temperature system is ClimateManager I think
like yo ucan do
local cm = getClimateManager()
cm:getAirTemperatureForSquare(square)
setSitOnGround(false) doesn't work during other animation, then I think it's possible to decorate the original sit action cuz I think if I interrupt the animation during the action, otherwise it will look very hacky
I honestly dont know
I've only done a tiny amount of animation stuff and its a very basic one
thank you for this, but i was wondering if there's a way to find a text file somewhere that has the monthly highs and lows and stuff like that that i could easily change?
To my knowledge, the weather system is based on randomness and doesn't have set values for per-month climate stats
interesting, thank you!

