#mod_development
1 messages ยท Page 212 of 1
Started one before, never finished cleaning it up bc lost interest (it was working, but not in a state that I felt comfortable sharing it bc it was just for my own purposes initially) but I'm happy to share the code when I'm back at my home computer in a few hours
Would be fantastic!
Good afternoon, is there a way to convert the IP field of the server zone, from domain to IP number? I tried to do it with the socket in Lua, but apparently it is not native and does not allow it to be used, and I don't know how to add it. The fact is that if you use the domain instead of the numerical IP, it tells you that the server is not responding, although the connection is made anyway, but for some people, that can be confusing. https://web.tecgraf.puc-rio.br/luasocket/old/luasocket-2.0-beta/dns.html#toip
socket.dns.toip(address)
Converts from host name to IP address.
Address can be an IP address or host name.
Returns a string with the first IP address found for address, followed by a table with all information returned by the resolver. In case of error, the function returns nil followed by an error message.
Is it possible this could cause some issues when adding a mod midgame ?
if not player:hasModData() then
player:setModData({})
end
isnt setmoddata for thumpable objects?
That isn't something you need to do to set modData.
How so ?
This is the entire line of code and yeah I think that line is useless but is it possible it can cause some issues ?
local function initialise()
if not initialised then
player = getPlayer();
if not player:hasModData() then
player:setModData({})
end
pillowmod = player:getModData();
calculateChanceModifier();
initialised = true;
end
end
when you do getModData, you are getting all the data associated with that object. this include moddata added by other mods.
you also do not have to initialize moddata in that object
setModData is also not used for that kind of object
https://projectzomboid.com/modding/index.html
package index
if you want to get your own data
getModData().<whatevername>
I suspect calling player:setModData({}) would erase all other mod data from other mods... but since you are checking if it hasModData() it will do... nothing useful?
Alright
I took this line from another mod I think, when I was testing it but I was pretty sure the line was useless anyway and didn't fix shit
However it caused issues when creating a world or a server it seems like
So I removed it and no errors anymore
and erase moddata from vanilla (yes vanilla uses mod data)
That's a good point - moddata is not just "mod" data ๐
alright
Hey I've been having trouble actually finding what functions do. I found what type of variable they output but I didn't find any documentation with all the functions uses. For example I have getAge() and there's that mod I modify that checks if the age of zombies is -1 and sets it to -2 but I have no idea what those two values correspond to
if zombie:getAge() == -1 then
zombie:setAge(-2)
Is there any documentation for that ?
Hey @fiery pecan , recursive require(): .../StandardizedVehicleUpgradesV/media/lua/server/IceCreamTruckRefrigerator.lua, just a heads up you have an unneccessary require 'IceCreamTruckRefrigerator' in that file. Was doing some debugging on my server and noticed this in the server log. Dunno if it's actually causing issues, but thought I'd let you know.
what line?
Nope, just that top line, but it's in IceCreamTruckRefrigerator.lua, so it's just trying to load itself.
I mean
I added the require line to ensure the file loads after the original one, in Skizot's mod
because his file's broken
oh, that's weird
yeah
I guess if you don't have that mod installed, the game just thinks you're trying to load the same file as itself.
How would lua even work that out? If there are two files called "IceCreamTruckRefrigerator.lua" which would it know you want to require first? To avoid this sort of question and cover over my ignorance of the subtleties of lua I prefix all source with my unique name "RicksMLC_"
good idea
Perhaps naming it something like SVUV_IceCreamTruckRefrigerator.lua as it is unlikely anyone else is called SVUV?
will do
The file manager in PZ will overwrite files sharing the same name
If you don't want to have obscenely long and unique filenames you could house everything in a folder named something unique
The one loaded last is the one that's kept
Same principle as using local modules rather than dumping everything into global
funky
if im trying to set something in the multiplayer sandbox settings would i use setMultiplayerSandboxVars() ?
is there an event that runs when the player carries a corpse?
something like OnCarryCorpse
I'm desperate, anyone knows how to spawn any vehicle from server-side into specific square?
This ?
With a function you want to do that ?
I'm also curious, how do you spawn things?
Hello, besides these two things, is there any function I can call through mod to kick a player with reason?
getCore():quitToDesktop()
getCore():quit()
noice
is there an event that runs when the player carries a corpse?
something like OnCarryCorpse
Something you could probably do is check if player has corpse in his inventory
Event
OnFillInventoryObjectContextMenu
Description
Triggered when inventory object context menus are being filled.
Hmm what does it mean by "filled"?
When an item is added in the player's inventory?
such as corpse
No idea
Hm ima test it out, but do I gotta reload my game every time I update the code?
You could try https://steamcommunity.com/sharedfiles/filedetails/?id=2909488957 - you can reload lua mid-game using these debug tools-- but you'd need to understand how Lua works for this to function/be useful.
You can also use the onequip related events to check if it's a corpse
I think the hotbar files do that
I recall seeing corpse/generator stuff when I made swapit
hmm, well that's fun, with StandardizedVehicleUpgrades enabled, my server immediately hits 100% CPU usage (primary game thread only) and stops responding to any net code.
(preliminary results, still have more work to do to confirm / identify what's going on)
Lua, I need a method that at least spawns vehicle, I know how to use menus
I really don't know where else to go with this radio and TV mod I want to make.
I think I can scrap this bit of code to loop TV channels
But I'm not sure.
I'll just have to try to keep getting in touch with mod authors on steam
If it's being called from the client & the player is at least an overseer, you can use SendCommandToServer(string.format('/kickuser "%s" -r "%s"', username, reason))
Got a coding problem, wondering if anyone can help. I'm currently trying to gather data on how long a player has been in a server and be able to use it for rewards; I.e play ten hours get something.
I tried using modData assigned to the player character, but ran into the issue of it wiping every time the player dies, is there a way to store modData to something more permanent, or is the wiping of the data a fault of mine.
Idk. If you use getPlayer() to recognize the person, maybe it only corresponds to one character ?
getPlayer probably refers to the player itself, which yes, will be the specific character which goes away upon death. I'd look for the Steam account or something.
getSteamID is an idea, thanks
You could use days survived as well - but that's per player object too
where do I reload? saw a ui with a lua explorer, but I can't find my mod file there
It's my first time modding btw
That is where you find the loaded lua files. If you don't see yours listed there it's not loaded in.
What's the difference between the BoredomLevel in BodyDamage and the Boredom in Stats? Trying to let the player gain boredom while in a vehicle.
I think one of them isn't actually used anymore
Thanks! I was searching for the mod folder all this time lmao. Searching the exact file solved it.
most stats are held in bodyDamage
Lua Events/OnEquipPrimary
Lua Events/OnEquipSecondary
These ones? I don't think the corpse go to the primary or secondary
Check media\lua\client\TimedActions\ISGrabCorpseAction.lua
where is this located? I'm in Zomboid folder right now
For the tiledef unique ID, is the pzwiki the only source of those IDs? (and thus the only location needed to be updated to "reserve" your ID)
Are you in the install folder or the cache folder?
cache
oh it's in the install folder
The sprites may be absolute rubbish, (I'm a developer, not a designer), but it works how I want it to ๐ finally
I don't know how much this might help, but I have implemented a radio station (Radio C.H.A.T.) in my Rick's MLC AdHocCmds Twitch chat integration mod. Any radio tuned to 106.8MHz will show the chat lines when chat... erm chats. Some of that code may be useful to you?
I think you did a very good job there. I love it
the one in stats is no longer used
You got an xml file?
Heh nope I did not use the .xml file system to make content for the radio scripts - I feed text strings directly into the broadcast.
thats so cool.
Hi. Do you know if it's possible to get the coordinates of the cell you're aiming at?
5124 bv14
is there a way to tell if the player is standing in sunlight? My current idea is to reuse the code for Agoraphobia's detection, but I'm just starting out so I'm hoping there's a better way
Check if he is outside and check if it's daytime ?
Weather and time of year are also relevant considerations
Ooo yeah, this is something I also am interested in knowing how to do
I'd peek into GameTime & relevant code (like ClimateManager) maybe, might be something related to light level there
A way to determine sunlight intensity (would be based off of time of day and weather) and the amount of time between dawn and dusk
I feel like those are the major components needed to (generally) measure sunlight exposure
ClimateManager has getGlobalLightIntensity, which may be of use. It's used in the sunlight calculation (alongside other things, such as time of day & season)
Tho I think it doesn't check light intensity, just if it's day time or night time
Huh, another question;
How would I check if the player is in light of a specific color?
from a colored light bulb?
my mod consists of the following code only
if scriptItem then
scriptItem:DoParam("BloodLocation = Jacket")
end```
and its directory is Zomboid\Workshop\PoloNeckSweaterNeckProtectionFix\Contents\mods\Polo Neck Sweater Neck Protection Fix\media\lua\shared\Main.lua
Just tried to add the neck coverage Diamond-pattern Sweater has to the Polo Neck sweater. But it does not work. Can someone show me my mistake?
Okay so solution to my crucial question was rather simple, server still can use addVehicleDebug() without client
-- Server
local test = addVehicleDebug("Base.Taxi", IsoDirections.E, nil, player:getSquare());
print(test);
Anwer was
LOG : General , 1704570633113> 85ะฐ384ะฐ875> zombie.vehicles.BaseVehicle@654b899f
Has anyone worked on making Tetris mod compatibility with backpacks/containers/trunks? I want to try to make a mod like this, but in my tests for trunks I only fail. I would appreciate if someone could give me a little help.
Not with certain vehicles as I have been testing, reading comments I have also noticed that it does not work for certain people
This mod gives you a width of 10 cells for several below, but there are vehicles in which it does not happen (it happened to me with '78 AM General M35A2 from KI5, for example)
ah idk
Does anyone know what could cause anticheat 21 to get set off? I know some mods by their very existance set off some of the anticheat checks but I have no idea why my mod is creating a malformed packet and how to stop it. Logs reveal nothing useful on either client or server.
Kill it its experimental anyways.
yep, after talking with a couple people it seems like those anti-cheats are all so random, just tell server admins to remove the ones that fail. shrug
they're not random... unfortunately, is created using a less-than-ideal method by relying on the registered recipes, see private long calculateChecksum(UdpConnection var1, int var2) { ... }
your code isn't passing the checksum at ValidatePacket, that's the reason 
plus if you don't respond the checksum in time Type 22 is raised and the player's kicked
but if I have no recipes in the mod?
what does your mod do?
do a research on each type and you'll see why your mod is malforming packets ;p
type 21 refers to that checksum i told you, type 22 refers to a timed-out check for the player
Maybe it's not my mod then, maybe its one of the prerequisites... unfortunately, I have zero control over them and the error code does not explain what recipe is causing it
I just disabled every one of those checks; they weren't very descriptive as to what they did, (seeing as they're just numbered 1-22), and we have a small community anyway.
It's the True Music Radio mod, it pulls the current True Music global list and plays it on radios, not recipes in my mod but it uses everything that True Music needs plus music mods.
still looks like disable is the only way to go
it's not a good recommendation to disable the ac types, but it's true that mods (not written in line with the code base) can lead to false positives, and "developers" are not interested in fixing those, most* of the mods are copy pasta so... finally the decision to toggle off certain types is up to each individual; those who understand, probably wouldn't do it, excepting some types that are unused, i.e Type 11
And when the game operator (not the network/server admin), installs every shiny mod they run across, many times the server op doesn't have the freedom to audit every mod and only select those which meet a certain quality standard.
how hard is it to make a map within project zomboid?
This is where I started to learn... https://www.youtube.com/watch?v=zKMrQsxyXTQ&list=PLc7_sQ-Tb6e3siC4Cwu4JfxuqJZkGO6sy
In this short video I will quickly show where you can find the project zomboid mapping tools, both on steam and on the indiestone forums.
For a link to the forums please click here:
https://theindiestone.com/forums/index.php?/forum/64-mapping/
And if you want to support me here is a link to my patreon:
https://www.patreon.com/DaddyDirkieDirk
I depends on what you are trying to do, but there are a lot of steps to it.
So ultimately it sounds like a recipe that is missing some basic parts to it.
is it possible to override fixing recipes?
Oh hi mark
function: createMenu -- file: MutiesContextMenuIconsUnequip.lua line # 3 | MOD: Mutie's Context Menu icons
function: onRightMouseUp -- file: ISInventoryPane.lua line # 1444 | Vanilla.
[07-01-24 07:32:14.385] ERROR: General , 1704605534385> 10ย 630ย 223ย 602> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getOptionFromName of non-table: null at KahluaThread.tableget line:1689..
@agile vigil happens when you click nothing in inventory. Check if table exists there before getOptionFromName
hmmm, my setOverlaySprite is buggy when in server mode; it'll flash the correct sprite on the client for a second, then revert back to the default sprite. I'm clearly missing something silly.
item transfer refreshes the overlay sprites
Happen to know a trick to make it persistent?
maybe send command to server?
I don't remember if this functional, but there are also attached sprites you might be able to use.
you need to transmit sprite changes.
technically the setOverlaySprite function already sends the update by default.
Now that's a bug report I can do something about 
Coincidentally this made me also find the bug other people were reporting.
All fixed. Enjoy!
it was a clunky source code snap
anyone spotting something off?
you may be mixing BloodLocation and BodyLocation
This looks like it should work since the jacket bloodClothingType contains the neck location according to the java, so I'm not sure why it wouldn't, but did you try just scriptItem:DoParam("BloodLocation = Jumper;Neck") instead? Maybe it'd work better adding to the item's existing list rather than trying to replace it.
just realized there's a NeckProtectionModifier that can be added as the original code of the Diamond pattern sweater has. But i bet this works too thanks for the help guys
NeckProtectionModifier is a different property that is a bonus to how likely it is to provide neck protection, but the Java suggests it doesn't do anything without the Neck BloodLocation being set on the item (or a blood location that is supposed to provide the neck location, like Jacket). So you need both for it to work.
I'm testing this right now and it does not work without BloodLocation=Jacket as you said
So NeckProtectionModifier = 0.5 gave half of the protection of the coverage areas of Jacket but writing BloodLocation = Jacket itself does not cover neck. That is strange
You would need to do BloodLocation = Jacket;Neck
You need the neck part in BloodLocation for it to function, I believe
Yes I bet this works as well
I was trying to find where exactly is the default bloodlocations were defined like Jacket = torso,stomach,upper arms etc. but I could not find it
The wiki has info on that
They are defined in the Java code, in zombie/characterTextures/BloodClothingType.class (needs decompiled to read it). These are all the values according to that file:
Jacket, LongJacket, Trousers, ShortsShort, Shirt, ShirtLongSleeves, ShirtNoSleeves, Jumper, JumperNoSleeves, Shoes, FullHelmet, Apron, Bag, Hands, Head, Neck, UpperBody, LowerBody, LowerLegs, UpperLegs, LowerArms, UpperArms, Groin
thanks thats very helpful. Do you know if Bloodlocations can overlap?
like if I were to BloodLocation = Jacket, UpperArms, Shirt would they get some extra coverage from that
and I believe there's no way to add more BloodLocations since this file is already compiled?
In that case, I don't think so, it would add all the blood locations from each of them and so be redundant. But you can use different ones to get unique combinations, for example one I've used before is ShirtNoSleeves;Neck for a poncho and ShirtNoSleeves;FullHelmet;Neck for a poncho with the hood up.
I see thats useful
Not easily no, but I believe it'd probably be possible to decompile it, add a new blood location, and recompile to make a Java mod. I say "probably" since adding new things is sometimes difficult with Java modding since there's no adding new class files for security reasons (they won't be loaded by the game), so if any changes you make would add a new file (even if not a new class necessarily, just using an anonymous method can add a new file that appends to the one you recompiled for example), sometimes it can be tricky or impossible.
But I'd recommend against doing that, just since I'd think you could get almost any combination you want by using different combinations of the existing blood locations.
Np, good luck with what you're doing ๐
a small part of decompiled BloodLocation code for anyone else that is curious about body part coverage
Is there any documentation about ISPanel please ?
I haven't found anything on the subject
I'm trying to understand exactly how the game acts on ISPanel, I have these
SusceptibleUi = ISPanel:derive("SusceptibleUi");
function SusceptibleUi:render()
--does stuff
end
The game runs SusceptibleUi:render automatically when it needs to render any UI ?
where are the scripts governing how infection works?
if I were to make a mod affecting infection, would it be easier to mod the existing infection mechanics or remove vanilla infection and introduce something new with the Moodle framework or something?
Is there even a small bit of documentation out there ?
Many mods do such things, select one that you like and reverse engineer it. (or do the same with vanilla if you prefer)
does print('x') in a lua script just output to the console?
That's what I do but I'm stuck on the UI rendering of Susceptible :/
The thing I sent above
Like I'm actually completely stuck here
Yes
I think
I donโt see why not
it does
What would that function even do ? what does self:isMouseOver() for example ?
function UiUtil.drawOutlinedBar(uiElement, x,y, outlineThickness, w, h, f, col)
local outlineX = x - outlineThickness;
local outlineY = y - outlineThickness;
local outlineW = w + (outlineThickness * 2)
local outlineH = h + (outlineThickness * 2);
uiElement:drawProgressBar(outlineX, outlineY, outlineW, outlineH, 1, {r=0,g=0,b=0,a=1})
uiElement:drawProgressBar(x, y, w, h, f, col)
end
Like I'm stuck here, I reverse engineered everything do understand how things act and work
But I'm completely stuck understanding what this does, how it triggers
There's nothing calling SusceptibleUi:render()
I'm in the "make sure your mod can be enabled and do the simplest part" stage of development and this function doesn't seem to be working, I get infected and I don't get a message in the debug console
I can see the mod in "mods" and it's set to enabled
What console are you looking at ?
Debug one or files ?
the debug console in game
Yeah that's something I'm not too sure either, why some prints don't print while others do
So can someone who does know tell me why the file isn't working?
How did you create the mod?
This version is also not working, and is copied from a mod trying to accomplish something similar verbatim
I copied the file structure of another mod, Immunity, and made a .lua file where I typed the lua code
Where is the file located ?
You have 2 times the average folder
what do you mean by that?
*oh crap doubled media folder oops
Here you have an example of how it should go.
You can have sub folders in client that's fine
Contents/
`-- mods
`-- ItemsAwards
|-- media
| `-- lua
| |-- client
| | `-- awards.lua
| `-- shared
| `-- Translate
| `-- ES
| `-- IG_UI_ES.txt
`-- mod.info
8 directories, 3 files
You have twice the average folder.
uh ?
Modify the mod, so that it has a structure similar to the one I gave you, although the shared folder is not necessary if you are not going to do translations.
fixed media>media, working as expected now
shared folder can have your .lua script too
Depends what you need and impact
And subfolders in client, server and shared is ok
I didn't say it couldn't be done.
Only in this case, it would not be necessary, it only has a script
There is no point in subdividing it so much, unless it grows itself.
Yeah
hey guys, in terms of the zombie infection are there such things as "stages" of infection? or does the infection just work in terms of hours?
I think it's just a matter of time. The time is set in the server/game configuration parameters.
I wrote this because I wanted to make a change to the Infection Cancellation mod but I just don't understand how the game defines these things
local function DetermineInfectionStage(bodyDamage)
local infectionTime = bodyDamage:getInfectionTime()
if infectionTime < 12 then
return 1 -- early stage
elseif infectionTime < 24 then
return 2 -- middle stage
else
return 3 -- final stage
end
end```
-- Controls how quickly the infection takes effect. Default=2-3 days
-- 1 = Instant
-- 2 = 0-30 seconds
-- 3 = 0-1 minute
-- 4 = 0-12 hours
-- 5 = 2-3 days
-- 6 = 1-2 weeks
Mortality = 5,
Maybe it has to do with that, but I'm not sure.
I see, thank you
there are no stages or anything like that
stuff like sickness and stress just scales based on how infected you are, which just goes up linearly until it hits 1 and starts killing you
I would like to learn a little more about the topic of mods in general, but when I look for the documentation, I get stuck and can't move forward. I don't know why it's so hard for me to move forward on this topic. Since I have worked before with other open source projects, for example, where although at first it was also difficult for me a little, at the end of the day, I was able to adapt, but here I can't do it.
it's handled by time javascript private float getCurrentTimeForInfection() { return this.getParentChar() instanceof IsoPlayer ? (float)((IsoPlayer)this.getParentChar()).getHoursSurvived() : (float)GameTime.getInstance().getWorldAgeHours(); }
thank you!
How do you see global variables in debug menu ?
hey guys, im having trouble generating items naturally w my mod. can anyone help me this?
this is item i want to add in game
So not sure how well suggestions are taken here but I'd like to offer one:
I'd absolutely love a new character creator. One that lets you customize not just jobs and traits and such, but one that let's you give yourself points in skills as well.
It doesn't have to be balanced but the creator could include adding and subtracting points based on the amount of points in skills you'd start with alongside the option to ignore point requirements which I'm fairly certain that's an option already.
Likewise, I know there's outfit editors or extended outfit editors, but inventory editors would be a great addition as well. Where you can choose any items in the game to drop into your inventory at the start of the game.
Something I can compare it to would be EbD Prepare Carefull mod from RimWorld. (though I think it's defunct now)
how to get bag/fannypack in fannypack body location?
does anyone know if there's a way to get where the player spawned or do I need to get the player's location manually?
hi guys I have a problem with the inventory tetris mod. I can't barricade windows or door
is anybody experiencing the same issue or is it only me? ๐
What stat actually determines the rate of fire on a weapon like the m16?
I believe itโs the recoil delay
Don't believe there is one, but I could add something to the debug tools mod.
ty
how can I speed up a character for a certain time using a certain item (medical)
you mean movespeed ?
Yes
I'm making a mod with adrenaline syringes, I need to increase the character's speed when sliding it
I do not understand how
Add a function to EveryOneMinute or EveryTenMinute
A counter that does a = a+1 so you can count minutes and remove the speed boost after a=time syringe boosts you
?????
Alright man, do you have any basics in Lua and modding ?
You need to create a .lua script
Go check some basic mods how they write stuff and do stuff
Reverse engineer a mod and understand how it works
IMWSEnergy = {}
IMWSEnergy.LowHeal = function(good)
SpeedFramework.SetPlayerSpeed(2)
end
Events.OnPlayerUpdate.Add(good);
I'm a newbie, most likely I copied it wrong
You need to count the elapsed minutes, use Events.EveryOneMinute.Add(counting) or Events.EveryTenMinute.Add(counting)
So?
You're not doing any check that the player is using your item
...
How can I do it?
idk, search for the function that checks when a player is using an item
I told you
Go find a mod that does a check if a player is using an item
Go reverse engineer that mod to understand how he checks if a player is using the item
And use that
Or at least it will allow you to understand better how to do stuff
ok, cps
cps ?
thank you
np
alright I am at my wits end trying to figure this out on my own. I'm trying to replace the wheel textures on a mod I downloaded from the workshop. I succeeded in changing the texture, and now I want to package it into it's own mod so others who didn't like the texture the mod shipped with can use it. I cannot figure out how to make a mod that retextures another mod. Anyone able to lend some assistance?
I think your texture needs to be the same name as the one you're replacing.
Yeah
Just go in the files of that mod, copy the texture files and their folders, modify those textures
Now create a mod that has the same path to the files with the same names
Load that mod after the other one and it should replace the older texture files
Though I sympathize with you about being at wit's end; I feel the same way about this damned setOverlaySprite I'm fighting with. Works in single player, but I just cannot get it to work with a dedicated server.
Huh. I tried that but I suppose I'll try again. Maybe I goofed up somewhere.
Is it supposed to only run client side ?
If no, did you put it in shared ?
I've tried in server/ and in client/, but I haven't tried shared/ yet.
Make sure you load your mod last
Try shared
Hey, i just want to say, huge, immense thanks to everyone for their contributions to PZ, it wouldn't be half the game without you all
ok, I'll give that a shot.
lol np
Tho I haven't done much yet
Only 2 mods
And those are fairly simple
The item restriction (only accept tires), and tile setup being in server seems to work well.
lol ya all my mods are really simple, i'm just an amateur coder myself
Yeah
My two mods are addons that improve 2 or 3 mods and god fucking damn it you see the difference in level of coding
Like I touched on Braven's code of spore zones and Susceptible code and those are so clean (besides the lack of annotation which makes reading the code tedious) and then I modifed the code of The Last of Us Infected that used the code of CDDA zombies and ngl reading chinese code made me want to die
oh ya, i use a few of braven's mods, great stuff
Some codes are such a mess to read, please add annotations to what your functions do and how they act and what triggers them
How can I get runSpeedModifier from a clothing script without having to specify each clothing separately?
wdym ?
that's a good point, i barely have any comments in my mods, tho i do try to make all names of stuff explanitory
The names of the variables and functions is the most important part, like Braven's code and Susceptible code can be read through without any anotations fairly easily
Like one example in TLOU Infected code, is that you have a function named updateZombie and then another one named zombieUpdate and one of those call the other one
And there's this kind of shit everywhere
Like god damn it bro
And the annotations are in freaking chinese

ok, shared/ works for single player, (no surprise there)
I need to get the clothing runSpeedModifier parameter via lua
lol that's an odd one, i guess zombie update is an event and update zombie pushes something to the zombies?
I have never touched on that so I have no idea how that works
No lol
It's just
Like fucking kill me already
Still nothing for dedicated server though sadly.
I think if the mod ever stops working, I will definitely rewrite all that shit myself
Hmmmmmm, client code lists ItemPickerJava, but server code lists ItemPicker
@crisp dew
If you use overlay then you just need to delay the change until after the server updates it.
I suggested to you to send a command before as that is what is used in ISA. From what I remember that was enough to keep the overlay change.
The other option is to use attached sprites instead.
in ISA you're not dynamically changing the overlay though, right?
It is based on number of batteries and power level.
ok, I see you're doing setSprite and sendObjectChange('sprite')
oh right, we ended up to using 2 objects for convenience.
other places in the Trap code uses setSprite which is the same that you're doing; I'm trying to use the overlaySprite, which could be the root of my issues
I am familiar with the issue, had same problem.
@crisp dew
#mod_development message
ok, so that block instead of isoObject:setOverlaySprite ya'think?
It's an alternative option, you can add more sprites but you also need to remove those you don't need.
I'm not sure how much delay you need to add in order to change the overlay after it updates on server, it could be up to 3 seconds plus transmission. (b41)
I think I have bigger issues in my code; ItemPickerJava.updateOverlaySprite isn't firing when in multiplayer, (thus my updateSprite is never even being attempted)
it should be called by GameServer after receiving change in items.
should be is the notable phrase there.
java calls like that are not able to be patched though
It can be patched in single player though
it is being called from lua in single player
oh, it's a lua call only in single player.
well crap
(even though it's listed in the shared lua directory)
ok, riddle me this; in server mode it loads shared and server, and yet in client there is code such as if not isClient()... why would there be "if not client" in code where only the client loads?
it means it's for SP
I have no idea
oh, both isServer() and isClient() is FALSE when in single player
well that's interesting
Somehow reminds me of a recent post on Mastodon mentioning how bad of an idea it is to use Discord as a knowledgebase. But that does clear up some of my confusion at least.
I have a table with bloodlocations, and also a function that causes errors if the player does not have clothes in this slot, how do I check if there are clothes in this slot before using bloodlocation from the table?
local bloodLocations = {
"Jacket",
"LongJacket",
"Trousers",
"ShortsShort",
"Shirt",
"ShirtLongSleeves",
"ShirtNoSleeves",
"Jumper",
"JumperNoSleeves",
"Shoes",
"Bag",
"FullHelmet",
"Apron",
"Hands",
"Head",
"Neck",
"UpperBody",
"LowerBody",
"LowerLegs",
"UpperLegs",
"LowerArms",
"UpperArms",
"Groin",
}
for _, bloodLocation in ipairs(bloodLocations) do
-- Here need to check for the presence of an item of clothing in the slot
local item = player:getWornItems():getItem(bloodLocation)
end
check if item is nil
Alright Poltergeist, I got it "working" thanks to looking through your code. Ended up adding a cron via EveryTenMinutes and manually check the server registery of containers. Certainly not ideal, but it seems to work at least.
Figured I post this here since it's about a mod idea:
I said this last night, but a SCP-3008 overhaul mod for PZ would be pretty fun if done right, such as:
-
Randomly generated map that looks entirely like an IKEA store. Displays of furniture, kitchens, bathrooms, bedrooms, and more.
-
A unique weather system that only occurs when too many fires are set/occurring, emergency sprinkler system. However, this results in powerful rainstorms that can lower visibility to almost zero.
-
Daytime hours are from 7AM to 10PM.
-
Countless zombies spread almost uniformally around the world, all looking like IKEA employees. During the day, they completely ignore you, shambling around aimlessly. At night, they all turn into viscious, strong sprinters that will stop at nothing to get to you. All of their moans and snarls are instead replaced with quotes like, "The store is now closed. Please exit the building."
-
Killing employees are fairly easy, but get harder the longer you survive. Bodies will attract employees, so dump them elsewhere.
-
Food displays will restock every 3-5 days. However, the closer you are to any one food display, the higher the chance it will not restock.
-
There is no exit.
-
Food is plentiful if you know where to look.
-
Carpentry and moving furniture is your friend. Use it to build shoddy structures out of furniture and create a base with everyday appliances.
-
Guns are incredibly, incredibly rare.
-
The game world is randomly generated every time (assuming something like this is possible down the line), but it always looks like an IKEA store.
-
TVs and radios play no broadcasts, but you can still find VHSs and such.
-
When 10PM hits, the game world immediately goes dark as the lights shut off. The store is now closed. They snap back on at 7AM.
-
(SANDBOX option) Every week or so, a chance occurs of a Blackout event occurring for a few hours. ALL lights shut off except candles and flashlights. Employees are active, but also smart and can open doors, tear down structures quicker. Be ready.
Does anyone have experience with making custom poster or painting tiles etc? I've made some signs, but whenever I edit them in TileEd they appear behind the wall instead of on it ๐ฅฒ Wondering if someone knew a fix or what I'm doing wrong.
@frozen aspen hey, pinging you here - it's me, Dante from steam - dm me
Hey so, in SP, every files from client, server and shared are ran or not ?
Okay, Lua beginner here. I just ran into an issue and it's out of my depth, so any advice is appreciated.
I'd like to reverse these events firing order if a controller is connected because I add them to the top of the context for controller users but at the bottom otherwise, but addOptionOnTop reverses their order, which isn't a big deal but it bothers me... But if I use an operator, it throws a runtime error "__add not defined for operands" is there an easy way around this?
if not JoypadState.players[player + 1] then
Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuWelcome)
Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuWood)
Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuStone)
Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuMetal)
else
Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuMetal)
Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuStone)
Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuWood)
Events.OnFillWorldObjectContextMenu.Add(Compendium.ContextMenuWelcome)
end
Edit for posterity: What was throwing me for a loop was the inclusion of "add" in the error, which (due to my inexperience) led me to assume it was a problem with the event because of the ".Add" lol and completely overlooked the "+" being there. The game didn't know what was going on and throwing an error on launch because, of course, it didn't have a player to reference and returned nil and threw an error.
Thank you albion, for pointing out what the error was actually referring to. Knowing the terminology is def important. I should have googled the error and did some learning.
Instead, as an easy workaround, I just had my first function fire the others in the appropriate order according to the controller status instead of having the event do it for all of them separately.
Yup, looks that way.
server/blah.lua
-- Only run this code in SERVER mode
if not isServer() then return end
client/blah.lua
-- Only run this file in single player.
if isClient() then return end
The code I ended up running with, so ensure the expected behaviour. Then shared is available to both.
So did it run files in every folders or not ?
Was my question
Or does it completely skip the server folder in SP
oh, sorry, single player runs shared + client + server
Alright thx
Don't believe me though ๐ hit F11 when in debug mode and scroll through the list of included LUA files. It provides a list in order of loaded.
You can also double-click on one of them to view the contents, then double-click on a line in that LUA to insert a break point.
aye; when the game runs that function/code, it'll stop at the breakpoint and let you see the variables in real time.
Then you can step through one line at a time to see what it's doing.
Interesting
Didn't knew that
Alright now I understand a bit better what the buttons are in the debug menu hmm
yup, step into (descend into nested function), step over (skip called functions and just "stay here" until it returns), and resume execution.
hmm
I feel I should publish a video on code debugging or something, I don't know what's going on in this codebase half the time, but I know my way around a debugger
The buttons don't have descriptions, and it's ugly asf so I couldn't understand how to move around it
Alright I completely redid it and it works now. That was the first thing I tried but I guess somewhere somehow I messed something up so it wasn't working. Thanks!
There's literally only 3 buttons, you can open the code, you can't access global variables
Yeah, it's not the greatest, but it does the job. I don't believe they show global variables, just scoped variables.
Is there a way to have sandbox options appear only if another mod is active ?
I think it is possible right ?
Still talking about single player?
If you're debug on a server, you have sandbox options just in the admin left-hand icon.
Is it possible to have specific custom sandbox options appear only if another mod is available
No I'm not talking about modifying sandbox options midgame
Oh, I assume custom LUA code has access to that, but it would be up to you to implement the UI / functionality, sorry I don't know that.
what ?
No I'm not talking about custom sandbox options visually
I'm talking about the sandbox panel when you create a world, you can add modded sandbox options
And I want to add one that only appears if another mod is present
an actual option
A single one
Or two
OH, absolutely, mods can declare their own options
Yeees
let me try to remember one which does it, I'm not on production right now
I think I've seen a mod do that yeah, but I don't remember which
Tho I don't want the player to activate a secondary mod just to add the sandbox options if that's possible
I would prefer having it available automatically
Well that's just the sandbox option
Yeah, that adds options to that sandbox section thing, or I take it that's not what you were referring to...
Ok bro sry but are you on drugs or something lol ?
I'm not asking HOW to add sandbox options, I'm asking IF it's possible to add A SANDBOX OPTION that only appears if the player activated ANOTHER MOD like:
mod1 - does something, not by me
mod2 - by me
mod3 - not by me, but present so mod2 adds an option in sandbox menu
To my knowledge that's not really possible; that runs prior to any logic running.
** prior to any LUA logic.
How so ?
what? No, I said that's not possible to my knowledge.
Yes, I was saying how so to the "any LUA logic"
The Java code handles that.
Ok ok
I just mention in the tooltip on my sandbox setting that it's disabled if the other mod is running.
Yeah guess I'll just do that
I'd def love dynamic sandbox settings, but such is life lol
yup
The best you could do is add a secondary mod that people activate to add the options
But eh
If I am adding an OnCreate funciton, do I need to require any of the base lua files in order to get it to load? I swear it has worked, but I am not sure why it is breaking now ๐ญ
Depends what you are using in the function
If you require some functions from the base game or another mod, then you need to add require 'folder/.lua'
Or something similar
For example one file I'm looking at rn has
require 'Items/SuburbsDistributions'
require 'Items/ProceduralDistributions'```
Nah, its just a self contained OnCreate function that is being plugged into a recipe script. I likely broke the code somewhere in my most recent changes ๐ข It is currently telling me that there is "no such function"
misspell maybe
Nah, both references to it are named the same. It is just telling me that there is no such function ๐
recipe Make An Alloy
{
keep Crucible,
Result:GenericAlloy;1,
Time:120,
OnCreate:Recipe.OnCreate.MeltMetal,
AllowOnlyOne:true,
RemoveResultItem:true,
StopOnWalk:true,
StopOnRun:true,
}
(Currently still ironing out the testing, so there will be more added to this later lol)
Did you create the recipe function ?
Yeah! ๐ I was just showing how I called the function through the recipe
What does the recipe function look like ?
Because I think you can't use . in the names of function like that
You def can haha, I have in the past as well. It is how the game handles certain specific functions. I used the same format in my RPDescriptors mod for stabbing/reclaiming notes
And it is like 57 lines ๐ฐ So I cant exactly just drop it
Not including the connected reference tables...
The file itself is ~370 lines
Result:GenericAlloy;1, shouldn't be using ; because it's not using food units as I'm just guessing, but GenericAlloy doesn't have a HungerChange or ThristChange value. ๐
Oop, the good thing is that it also has the RemoveResultItem:true,, which makes the recipe not actually give the item that is shown haha
you don't 'need' to require vanilla files for anything
requires do not change the loading behaviour for vanilla files
I did it this way so that I can use a default image for the recipe and then have the output modulated by the function instead. The recipe looks like this ->
Yeah, didn't comment on that though since I assumed the OnCreate function created the item and set the UsedDelta.
'__add not defined for operands' means you're trying to add two types that can't be added together, which in your example would mean player is not a number (probably nil)
Just so I am not going crazy... I have the function in the server section, since that is where the game has basically all of that code. But- Is that the correct spot? ๐
it shouldn't matter where it is
Dope
as long as the function is loaded on the client, and all folders are
What do you mean?
OnCreate functions are called on the client, so it needs to exist in that environment
but all folders are loaded on the client so the folder the oncreate is in doesn't matter
Like, client as in the broad term? Like, so long as I have them in actually existing in the mod- Not client as in the media\lua\client folder? Right?
yeah
Ok cool, just wanted to be sure haha! Normally if my function breaks it would kick back errors instead of just not working... But I cant think of any other reason why this would be breaking like this :(
though if you're putting it in the Recipe table, as it looks like you are, you need to put it in the server folder because that's when the game creates that table
Yeah, currently all of my lua is in the server section. It is running my other file, which has an AcceptItem function, and that is working fully as intended
Ohhhhh, thanks a bunch
what do you get if you try print(Recipe.OnCreate.MeltMetal) in the in-game console?
nil

yeah, the failure isn't anything to do with your recipe, your function really doesn't exist
actually probable do print(Recipe.OnCreate.MeltMetal())
i wasn't trying to check the return value, i was trying to check if the function existed
right
you'd expect to get closure 0xmemoryaddress when you print a function
If the function is local doing that won't do anything if you do it in the console ?
yeah, the console isn't in the scope of those locals
Is your function local or not ?
OHHHH oh
No
I thought you meant was it workshop or local lmfao
But no, the function is not bound to local
I can throw it into a rentry or something if that works? Not sure if I can paste links here, but if I can I can just send the current code if yall wanna have a look haha
Well your function has something wrong then
yes you can, you could even maybe paste in a code block
Its like 370 lines... So there is no way that is fitting in any meaningful way hahaha
the whole file would be helpful
at least before the function
it wouldn't be unusual for some error further up to stop execution of the file
Depends
Before a function doesn't mean anything if your whole file is just functions
Those could be called in any order
However the syntax could be wrong before, with an end forgotten at the end of a function
Check every functions have an end, same for every if, for etc
You could also add your function in an Events.EveryOneMinute
If it blocks on the line of Events.Add
Then syntax of the function could be wrong
If it blocks inside the function, well at least the function is recognized
That is all 370 lines in ALL it's glory ๐ซก
Still containing half the comments, and all the testing prints I forgot to remove lol
I suggest you put AlloyRules in a side file, makes it easier to read
I know, I plan on it
๐
I just wanted to make sure it worked before changing anything haha
syntax error on line 42 else if alloyTally[key] and not == 'total' then
why do that ?
local AlloyRules = {}
AlloyRules = {```
And not
```Lua
local AlloyRules = {```
But do that, to at least make sure your function is recognized
But uh, what did I do wrong there? I have been writting too much code and now my brain is mashed potatoes ๐ฐ
not what equals total?
forgotten variable
also, you use else if, you might have wanted elseif
else if literally is just an else with an if in it so it creates weird scopes
No yeah, you are right. I did mean elseif
when the game won't give you a proper error you can throw it into an online lua interpreter, they don't have pz's builtins so you won't be able to actually execute the code most of the time but it'll usually catch syntax errors
That also explained why my function was yelling at me about missing an end last time I was working on this... lmao
I honestly did too, I threw it into a syntax check online and i must have just missed it. I think that since the else if was technically correctly done, just not intended it didnt catch it. And I must have just missed the not == thing
i threw it into this one https://www.tutorialspoint.com/execute_lua_online.php and it spat out lua: main.lua:42: unexpected symbol near '=='
reloading and seeing if it will run the function now
i haven't even actually looked at your code yet ๐
Good news! It reads that it exists now!
Bad news... it is breaking again ๐ญ
You might get a lot of useful information about tiles in mapping section.
It seems like you might have an issue with the tile properties.
not working, error in getItem(bloodLocation) cuz unknown location: "Groin or something else", this error like as if I didnโt write then after it, the debugging window does not appear
im looking to make a small mod to remove the back slot cause it annoys me, unfortunately i have no idea how to do this. not made a mod before etc
Is it possible to retrieve the name of a player through his corpse (infected or not)? I couldn't find a very direct method through the docs
check out Item Owner by Noir
you could probably back out the item owner off the zombie corpse
It looks like the info you want is saved on IsoDeadBody objects but I don't see any methods for accessing that data in lua, so unless someone else has a better idea I'm missing, you may have to use an indirect method.
The simplest way I can think of would be to find the key chain item on the corpse and get the player name from that, but that doesn't work if you need the name with 100% reliability for what you're doing, since it'll fail for the 1% of players who get rid of or change their key chain names. Other than that could maybe try saving the player's descriptor data onto the corpse using events.
I will give it a check, thanks :)
I thought about the keyring approach but like you said, not really reliable 100% of the time. I thought about events as well, percesily OnPlayerDeath, but there doesn't seem to be a a way to access the body after player dies. It also won't work in all scenarios, where if the player dies (from infection), turns into a zombie, then is killed again by a player, that may be too troublesome
ye i want to get it off dead bodies only
not sure if you can access the corpse container after playerondeath, but you could always drop a sheet of paper in there and change the name of it to equal to the player name
On a zombie there's the getReanimatedPlayer method which returns an IsoPlayer object. I would think you could do something tricky to get the body after player death though, like save the grid square they die on and add/remove an OnTicks event to check the square's objects for a matching IsoDeadBody instance right after, and/or a matching zombie if need be.
getReanimatedPlayer could be useful. The body is accessed through the context menu so shouldn't be a problem, i'll give it a go
oh its a IsoZombie method not a IsoDeadBody method
ye i just got what you meant, its indeed tricky
I could try this approach, but again, OnPlayerDeath doesn't let me access both the player and the body after death
hey guys, quick question
how would one get info of a dropped item on a gridsquare ?
i expected getPlayer():getGridSquare()
and in isoGridSquare class
i expected it to have some kind of method to list of items that are dropped in the grid
or have a way to get the floor container
, never mind! i just found that I need to use getWorldObjects()
How can I place text when interacting with an object? just like the green fire mod does when opening a mysterious object, for example when it says is this... a bong?
what do u mean?
when u right click on it?
or when u press something
does it have somekind of context menu?
if so, u just use the getPlayer():Say("your text here")
ok
I don't have a context menu, I want to make an npc that counts as an object, when you interact text appears, as if it were an object
hey where is the weight system code stored? or i might not even be able to do what I was thinking, but what I want to do is widen the healthy weight range to be easier to stay in.
i think you should read the modding wiki about making items again
then use OnCreate event or something to execute the Say() function
Does anyone know how I can prevent a player from being forced awake without rewriting the entire calculateStats method and subsequent methods using the calculateStats hook?
But do I only apply that command in a script?
or xml
onCreate function can be done from .lua
Guys I know you can get inventory of a character by doing lua getPlayer():getInventory()
but how can one get inventory of a world? like the floor???
i can't find getInventory() method in IsoGridSquare()
yea i was able to find my worldobject using this
but i wanted to edit it's weight
by using setWeight()
but it wouldn't work because it doesn't count as inventoryitem
World object is a different kind of object yes, but you can run getItem off it
hmm?
You'll also need to transmit the world object to keep it in sync
yea i noticed that problem as well
World objects have a inventoryitem field
You need to do a few things to properly remove it
Handling items on the ground is kind of a mess
i see
You need to remove it from it's container as well as the world and a few things
It was the hardest part of game night
Half the time developing the mod was spent trying to get things to sync and be able to be moved around the world quickly
hmmm
so.. i did lua item = getPlayer():getSquare():getObjects():get(2)
to get the item on the ground
which is an worldinventoryobject
ah
You'll have to parse through the get objects array
gotcha
What exactly is your goal though? Like the point of the modification?
oh i was trying to find a debug console method
to be able to find an item on the ground
and change it's weight
Oh
because there were some items that was too heavy to life
lift**
even for admin
but yea, getItem() worked like a charm
Couldn't you right click the item to edit its weight? Or is weight not one of the fields?
Even from the inventory window?
it needs to be in your inventory to do so using debug
Looting window rather
this is looting window
and this is same item in player inventory
as u can see only one of the button on the left side is active
are you trying to make it heavier/lighter on pickup or something?
lighter mostly
This is a temporary fix or something you want done across the board?
Wouldn't it be better to edit the items script?
it was temporary fix
So it seems like lua item = getPlayer():getSquare():getObjects():get(2):getItem():setWeight()
worked good enough
might not work if multiples or if theres a bunch of random items on the ground?
If it's for a quick fix picking it up should set it
Moving items to the player internally sets things
It's being on the floor that causes issues
Ex: A changes the weight, and then B picks it up
why not just use script manager and doparam to set the weight across the board?
u can do that in realtime? in multiplayer while the server is running?
i havent tried setting it to execute when the server is running, but it would only update items that generate not items that exist
when you say the item that exist
do you mean the item that is already written in media/script/item.txt file?
or an item object generated using something with :new()
if the item exists in-game DoParam won't change those properties, only for properties of items moving forward
like if you had the item in your inventory already, it will retain those properties even if you changed the parameters using DoParam
hmm
so how would i use it? the doParam() method
do you know if there's any code snip that i can take a loook to learn?
local item = ScriptManager.instance:getItem("WoodAxe")
if item then
item:DoParam("CriticalChance = 25")
end```
cool, thanks.
will this permanently change the crit. chance of the WoodAxe
every time i spawn it?
or does it need to be ran every time the server restarts?
It needs to be run everytime the server starts yea
It changes the item parameters when loaded. Any items that spawn will have the modified parameters. But for instance if you have a wood axe already spawned it will retain the original parameters
I have a table with bloodlocations, and also a function that causes errors if the player does not have clothes in this slot, how do I check if there are clothes in this slot before using bloodlocation from the table?
local bloodLocations = {
"Jacket",
"LongJacket",
"Trousers",
"ShortsShort",
"Shirt",
"ShirtLongSleeves",
"ShirtNoSleeves",
"Jumper",
"JumperNoSleeves",
"Shoes",
"Bag",
"FullHelmet",
"Apron",
"Hands",
"Head",
"Neck",
"UpperBody",
"LowerBody",
"LowerLegs",
"UpperLegs",
"LowerArms",
"UpperArms",
"Groin",
}
for _, bloodLocation in ipairs(bloodLocations) do
-- Here need to check for the presence of an item of clothing in the slot
local item = player:getWornItems():getItem(bloodLocation)
end
error in getItem(bloodLocation) cuz unknown location: "Groin or something else", this error like as if I didnโt write then after if, the debugging window does not appear
Blood locations are based on body parts aren't they?
Problem is getItem expects a string corresponding to a body location group, not a blood location. I'm not sure there's any way to directly get items of certain blood location types, youยดd have to iterate through the items and check what they are:
local wornItems = getPlayer():getWornItems();
for i=1, wornItems:size() do
local item = wornItems:get(i-1):getItem();
if instanceof(item, "Clothing") then
local bloodLocation = item:getBloodClothingType();
if bloodLocation then
-- do stuff
end
end
end
What are you also trying to accomplish?
There might be a different way to go about it
I recently used this to count the parts
local visual = player:getHumanVisual()
for i=1,BloodBodyPartType.MAX:index() do
local part = BloodBodyPartType.FromIndex(i-1)
local blood = visual:getBlood(part)
local dirt = visual:getDirt(part)
It's cut off cause the rest of it is unrleated
thanks guys, all works!
but can you explain pls what is the difference between bodylocation and bloodlocation?
in the context of clothing
body location is where it's worn, bloodlocation is where it can protect (i think)
technically you can have a headpiece that protects your groin, for instance
Hello there, anyone knows and can share the semantic for a comment inside sandbox-options.txt file ?
How do you even turn off the fog in debug ????
i think / ?
It did not work for me
Hello, what are the differences between those?
IsoZombie createZombie(float x, float y, float z, SurvivorDesc desc, int palette, IsoDirections dir)
spawnHorde(float x, float y, float x2, float y2, float z, int count)
createHordeInAreaTo(int spawnX, int spawnY, int spawnW, int spawnH, int targetX, int targetY, int count)
createHordeFromTo(float spawnX, float spawnY, float targetX, float targetY, int count)
which one is more suitable to spawn zombies inside at the same height than the player, if I check player:isOutside ?
How would one go about tweaking values for items without overwriting the items entirely? I wanted to change the capacities of vehicle trunks but I would like to not have to completely overwrite the vehicleitems file if possible. Would I just have to write a file that imports the Base module and specify new values for given items?
Hey there's a mod doing that, you could check how they code it ;)
Give me a sec to find it again
thanks, I'll definitely check it out and see how Eggon did it
I looked at the files for this mod: https://steamcommunity.com/sharedfiles/filedetails/?id=1532464654&searchtext=more+space+in+the+car+trunks
But they simply copied the entire vehicleitems file and modified it which feels really messy to me. If it can't be done otherwise, then that's just how it is, I suppose
hmm
yeah I understand why you wouldn't want to do that
Overall it's not great to modify base files
Looks like Eggon's done it through actual script and function calls which is a little more in-depth than I wanted to get tbh
๐
I tried doing what I thought would work and unfortunately it does not. The items I specified in my file became new trunk items and vehicles were not spawning with them. I think I'll have to do some more learning to make it happen the way I want it to
You added items to trunks ?
If you want to do that, you add them to the loot table, did you do that ?
is there anyway to add a colored overlay via hotkey or action? im just trying to get the overlay to work right now
DarkRedFilter.filterColor = { r = 80, g = 0, b = 0, a = 200 } -- Dark red color with 200 alpha
function DarkRedFilter.applyFilter()
local player = getPlayer()
local originalColor = player:getScreenOverlayColor()
player:setScreenOverlayColor(DarkRedFilter.filterColor)
addEvent(DarkRedFilter.restoreFilter, 10 * getGameTime():getMultiplier(), player, originalColor)
end
function DarkRedFilter.restoreFilter(player, originalColor)
player:setScreenOverlayColor(originalColor)
end
Well, the goal wasn't to add new items but to make the base game trunks have higher capacities but because the file I wrote imported the Base module instead of modifying it, it added the items as new ones.
I don't currently know how to add items to the loot table and this is something I was going to look into today or tomorrow
You can check susceptible and how they do it
They put the file in media/lua/server/items
Hey everyone, I'm working on a little weapon mod at the moment. I've got a staff, and I want it to use the attack animation of the sledgehammer, but I want to speed it up and make it attack faster than a sledge normally would...is this possible?
Usually you use /* comment */ for script blocks.
Try to change stuff ... ?
i'm sort of reverse engineering this
Well, my point is even better, try things
"what if I change this value, or this value ?"
Okay do you have anything useful or concrete such as the values vanilla weapons use for offsets or where i can find them or a method for live checking changes that don't involve restarting the game every txt file change instead of doing this modder snark routine where you act like some questions are just too stupid for you
thanks
I'm pretty sure there is a tool for this in the pzmodding tools that will let you accurately place attachments and such
Ty
No I don't know but I'm telling you my way of doing it. And no you don't need to restart your game, you can just use debug menu and reload lua files on the main menu
I've never used those values and if I had to test it, I would just modify the values and try
Modifying 2 could be enough to understand what value corresponds to what, where the x y z axis are and if it's in degrees, meters, pixels or idk what
Uhm, anyone knows how I could open .x animation files for zombies since Blender can't ?
I tried used open3mod but vanilla files can't be opened
I tried opening modded .x files of zombie animations and those do work
But I would want to use the vanilla ones to modify the animations
Is there a line of code that allows to modify the animation of a zombie to a specific type ?
Are zombies animations called for zombies in the lua files or not ?
Or is it outside of the lua
Hello! Can someone answer me? How I can add MoveWithWind = true or CanBeCut = true to farm objects?
I think Blender should be able to but you might have to use an import function
Here's what I found: https://blenderfaqs.com/blog/how-to-open-.x-files-in-blender
You can't, the .x files of PZ are internaly modified and are not recognized but addons that allow the import of .x
I found in the pinned messages a way to do it
Tho I'll have to look how to go the other way around
Sorry m8 I'm not familiar with Blender but it's good you found a way to do it
However I'm not currently doing the animations, I'm trying to see if you can set up different animations for differents zombies
np
I'll make a forum post to ask if it's possible to have different animations for different zombies since it's barely possible to get an answer half the time here
Animation is beyond me, man. Good luck, though
Yeah well the issue isn't really animating it anymore lol
Just if it's possible in lua to call for animations for zombies
Because I already have the code to know a type of zombie etc, just finding documentation for the modding in this game is literally impossible
This mod replaces zombie animations, might be a good reference to help you: https://steamcommunity.com/sharedfiles/filedetails/?id=2867602810&searchtext=zombie+animations
Although I think zombies with player animations would be terrifying since PC sprinting is fast as hell lol
That doesn't help but thx ;)
These set animations for ALL the zombies, which I think is fairly easy to do
My issue is that I have different type of zombies, the infected from The Last of Us, and I want clickers to have clicker animations, runners to have runners animations etc
And that means I can't use that to modify the animations of zombies since I need multiple different animations
gotcha
I already found a bunch of mods that modify the zombies animations but they always just modify all the zombies
Haven't found one yet that modifies only one zombie
The closest I have found is CDDA that seems to force an attack animation I think ? But I haven't tested in game what it does
zombie:setBumpType("trippingFromSprint") -- Check if player is in Idle Stance
player:setBumpType("stagger") -- Check if player is in Idle Stance
player:setVariable("BumpDone", false) -- Check if player is in Idle Stance
player:setVariable("BumpFall", true) -- Check if player is in Idle Stance
player:setVariable("BumpFallType", "pushedFront");
idk if it has custom animations
Does it?
you can usually mess with animations using setvariable
checking
the way animations are applied is somewhat unintuitive but quite flexible
the animation variables setVariable sets are basically conditions for the animations, if all conditions are met then that animation will play
It doesn't outright say. Seems like Albion knows more about it
Do you think it's possible to have different setVariable for different zombies, and that apply different sets of animations for each ?
so in theory you could add an additional variable to play your animation instead of the default ones
Do you have any examples or documentation to understand how setVariable works ?
but in practice i don't really know how it'd tiebreak between multiple valid animations unless you had a way of specifically forbidding the default animation
Bcs I'm kind of confused about it rn
i don't really have anything, i don't make animations myself so i don't have an implementation to show you
i just know a little since i helped somebody debug a custom animation for players a while back
Guys maybe u know about setup MoveWithWind = true or CanBeCut = true to farm objects? ))))) Ill try do that with Tile properties but it not working on farm objects
In theory, you would just need a condition statement that checks for whether a given zombie has a specified ID before checking for other parameters to play an animation
Hmm so it allows you to play an animation but naturally I want them to have that animation
Having code forcing them to play an animation all the time would probably lag the fuck out of the game
it's actually kind of the other way around
there isn't a way to directly tell a zombie to play a specific animation, you just set variables and the animations check those conditions
That's already a thing in my code, I already have ways to detect a zombie type
Try asking in mapping maybe ;)
Do you know if this is used in the base media/lua codes so I can check it out ?
in theory, you'd have an IsClicker bool or something in your clicker animation xmls, and otherwise they'd be a copy of the vanilla ones - then it'd play those animations after you set IsClicker to true for that zombie
Yeah I have that bool already set up for every zombies
i think the vanilla usages are mostly/entirely java? it's worth searching vanilla lua for usages of setVariable
Checking every single file is kind of impossible ngl
your ide doesn't have a search function?
I tried looking for files that set the zombies actions but haven't found anything
the program you use to write code
But I need to open the file
most would let you search a whole folder, if you're using notepad++ or something that probably wouldn't
And there's hundreds of them and I have no clue which file could set the zombies animations
Yeah I use notepad++
i'd recommend switching to something a bit more powerful, but for now i'll just run a search for you
What do you use ?
I know people usually use visual studio
But visual studio is a pain to install I find like, there's so many shit you don't know about and don't know if you'll need
i use intellij idea usually, but i'd recommend visual studio code (or even better, vscodium)
Everytime I try I just abandon
visual studio code should be a pretty straight forward install, proper Visual Studio is overkill for lua
it seems like a lot of timed actions use setVariable, ISFishingAction has a lot
k thx, and one more thing, sometimes when my mod run on the server sprites don't line up correctly, I mean that let's assume plant growth stage 7 however the sprite shows stage 4. I checked the rest of the mods, there seem to be no conflicts, it works fine for local. Should we look for the problem in the server-player being out of sync?
I have no idea sry
K thx
the zombie walking animations use a shared zombieWalkType string condition to determine which one to play, you could probably just add one with a new value
assuming the game won't try to fight you reassigning that value
Where's that ?
In the XML files for animations, where does the game find the conditions actually ?
Also what are the two events footstep ?
those conditions are the setVariable calls
Ah okay
i'm not really sure how events work but i assume something in java catches these and plays the footstep sounds
Ok so I understand a bit better what you said I think
So if I make XML files like those each different animations I want and add the condition isClicker to the xml walk for clickers and set the AnimName to the animation I made for the clicker
Then in lua code somewhere idk yet I have setVariable("isClicker") for the walk it should play the clicker animation ? If I add a check it's a clicker ?
Is that it ?
probably, yeah
i'm unsure on how the game will tiebreak multiple valid animations - since the vanilla walk doesn't check that the zombie ISN'T a clicker, both animations are valid
Ok so I basically need to modify the file that tells a zombie to use the walk animation with the setVariable
I replace it ?
I replace it and add a condition isClicker false
I already have conditions to check each types of infected in my code
that's why messing with the zombieWalkType would be ideal, the vanilla ones check that so if you just set it to e.g. clicker none of those checks will pass and you don't need to replace the vanilla files
where is zombieWalkType ?
It's a lua file or anim xml file ?
it's an anim condition
sprint1.xml, walktoward1.xml, etc all check this zombieWalkType
Yeah I found it thx
string value 1 ?
Don't they write the walkType as "sprinter" "shambler" ?
They use values ?
they have 5 of each type, fast shamblers are 1-5, sprinters are sprint1-5, never looked at the others
i don't really know why they have 5, not something i've looked at
I mean yes but what does <m_StringValue>1</m_StringValue> act
That was my question
why use string if it's not a string variable
sprint1 is a string
Right yes
I think we get to the issue where the devs just don't call their variables correctly to easily understand what they are refering to
I mean I just need to find the code with setVariable for walkTypes now I guess
I'll do that later tho
Hi, I'm new to modding. I found an unsupported but working mod. I decided to make changes from it and add a translation for my language. I copied the mod (I haven't made any changes yet) and published it in the Workshop, trying to start my server with it, but the server won't start. At the same time, the server with the original one starts without problems. What could be the problem?
I changed the ID in my mod. I restarted the game, re-subscribed to the mod, nothing helps
usually this is caused by the mod being private/friends only
the server needs to be able to download the mod anonymously so it needs to be public/unlisted
Thank you very much! You're the best!
I've been trying to figure out this problem for two days ๐
does anyone here happen to know the color codes for the vanilla hair dyes (green/blue/red etc.)?
or where I could find them, that would be good too
hair dyes are defined in newitems.txt in the path ProjectZomboid\media\scripts
and it looks like the code for the color is
ColorRed = x,
ColorGreen = y,
ColorBlue = z,
example:
item HairDyeBlonde
{
DisplayCategory = Appearance,
Weight = 1,
Type = Drainable,
UseWhileEquipped = FALSE,
UseDelta = 0.5,
DisplayName = Blonde Hair Dye,
Icon = HairDye,
HairDye = TRUE,
ColorRed = 212,
ColorGreen = 171,
ColorBlue = 69,
WorldStaticModel = HairDyeBlond,
}
No idea if you can change the saturation or how bright the color will come out though
Oh, tysm! I'm just adding the vanilla colors to the character creation screen, there was a mod I used to use that did this but it was removed a long time ago for whatever reason
@bronze yoke Sadly I haven't found any line of code that involves zombies and setVariable, so it doesn't seem like the animations of zombies are triggered with lua code :/
I finally got this off the ground:
https://steamcommunity.com/sharedfiles/filedetails/?id=3136555411
Noice
Hey since you do a lot of things around animations, do you know if it is possible to have different animations for different zombies ? Like a walking animation for one type of zombie and another one for another ? I already have the code that allows to have different zombie types and those spawn with different clothing but I'm trying to know if it's possible to set different animations for them
you need a lot of special code, that I do know, not as simple as you think
Do you have a file that demonstrates that ? Or would it be possible to explain it to me maybe ?
no
but check out the helicopter mod as it had done special-typed zombies like that in the past
In the silly-helicopters branch yes
Could anyone explain me why my code doesn't work???
So this would be it ?
zombie:setWalkType("sprint1")
print(getOnlinePlayers():get(0):setZombieKills(1000))```
So i did that on my server debug console
Is your player online ?
I don't think you do a getPlayer() in console like that
I think so, it should mention the AnimSets in the code
it shows up fine on my screen
which is why i used getonlinePlayers()
since getPlayer() is only client player
You mean in media ?
i selected an online target player
sprint1 is a vanilla walk type if I understood it correctly
I don't know much in animations, I'm learning all of that and in code I don't know that much either
I'm learning on the spot a lot of stuff
thats how they work, the code may mention a term or tag that exists in the AnimSet xmls
sprint1 yeah
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="sprintToward.xml">
<m_Name>sprint1</m_Name>
<m_AnimName>Zombie_Sprint</m_AnimName>
<m_Conditions>
<m_Name>shouldSprint</m_Name>
</m_Conditions>
<m_Conditions />
<m_Conditions>
<m_Name>zombieWalkType</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>sprint1</m_StringValue>
</m_Conditions>
<m_Events>
<m_EventName>Footstep</m_EventName>
<m_TimePc>0.15</m_TimePc>
<m_ParameterValue>sprint</m_ParameterValue>
</m_Events>
<m_Events>
<m_EventName>Footstep</m_EventName>
<m_TimePc>0.6</m_TimePc>
<m_ParameterValue>sprint</m_ParameterValue>
</m_Events>
</animNode>
So if I want a custom animation for a specific zombie, in my case a clicker from The Last of Us, I create a clicker.xml
Reuse partially that xml code but modify m_Name and m_Conditions and the walk type to be clicker
Then the zombie I do zombie:setWalkType("clicker")
So I guess there are commands like zombie:setWalkType for other type of conditions ? Where could I find all the commands to set conditions ?
My god does it feel good to find something, thank you man
Tho I still need to try it lol, but at least I have something that's most likely going to work
And that's amazing
print(getOnlinePlayers():get(3 --this is me):setZombieKills(1000)) works fine
but doing any other players doesn't work
Maybe bcs you are not the right player for it ?
tbf idk how these types of command would react so I sadly won't be able to help you much I think
no problem
I meant since you are not that player, you can't access that info that way
true
but considering an admin can change a players level and stats.. i thought i would b possible..

haha
where can i find the code that dictates zombie clothing spawns? i'm trying to get a new clothing item in the game and i want it to spawn on zombies
Hello, is there documentation which players a client is aware of and the area for which this applies? Would they know the online ids, would they have the player objects?
I think I found the answer but if anybody has this written in detail then you can ping me.
Is there a way to get a list of all the containers in a radius?
You could check the mod that adds that centralised bank for storage
let me find it wait
Wait what, did someone already do that ๐
Oh wait, I think it's a litle different ๐ค
My mod is doing something like sending the item to a container you mark as receiver, rather than having everything in one single container
Well, thank you anyway ๐
np
What does sendClientCommand do ?
https://steamcommunity.com/sharedfiles/filedetails/?id=2650547917 << configure a container to receive certain items, then you can transfer items from your inventory into any nearby container automatically.
I know that mod, but it does not have the auto walk to a container
it sends a command from client to server
Ok, just wanted to make sure you were aware of it; far too many times I start working on something only to realize someone already created that functionality.
Thx, I looked it up. Tho the mod I'm looking at I'm not too sure what it does with it
sendClientCommand('LeaperZed', 'isLeaper', {isLeaper = true, zed = zed:getOnlineID()})
Oh wait I think I got it
So he defined a command with in server
Commands.LeaperZed = {};
Commands.LeaperZed.isLeaper = function(player, args)
local playerId = player:getOnlineID();
sendServerCommand('LeaperZed', 'isLeaper', {id = playerId, isLeaper = args.isLeaper, zed = args.zed})
end
However smthg I don't really understand is that in client, he runs
sendClientCommand('LeaperZed', 'isLeaper', {isLeaper = false, zed = zed:getOnlineID()})
But he's already in client ?
Ok nvm I think I got it, gosh this code does things all over the place lol
sendclientcommand(player, module, command, arg)
the name refers to the sender
Yeah I found that
client commands are sent by the client and received by the server
you dont need to pass the player var down though, so it's usually just sendclientcommand(module,command,arg)
I kind of guessed I guess yeah, at least I get it
In client he has
Commands.LeaperZed.isLeaper = function(args)
local source = getPlayer();
local player = getPlayerByOnlineID(args.id)
local zed = args.zed
if source ~= player then
if zed and args.isLeaper then
zed:setVariable('isLeaper', 'true');
else
zed:setVariable('isLeaper', 'false');
end
end
end
So overall he'll just run this command ?
Something I don't understand however is that, in this function before he sets the variable of the zombie isLeaper to true if it's a leaper but he does that before calling the command with:```Lua
zed:setVariable('isLeaper', 'true');
if isClient() then
sendClientCommand('LeaperZed', 'isLeaper', {isLeaper = true, zed = zed:getOnlineID()})
end
So what's the use of those command ? I don't really understand
i'm guessing what this mod does is
sets leaper to true, sends a client command, server sends a client command to all clients to also set leaper to true for that zombie
so that all clients will see the leaper animations and not just the one running that code
He had to do that because he's put his code in client ?
If the code is in shared, would it be even necessary ?
it would be
shared doesn't mean the same code executes for everyone, it just means it gets loaded by both the client and the server
i'm not sure what the condition for setting this animation variable is but
if the trigger might not fire on all clients it is necessary to synchronise it like this
This is gonna be a pain to test in multiplayer lol
This animation thing is going to be a pain to take care of
Because there's like 20 xml file I need to modify for my own animation
Why do they even make so many files, you can put them together no ?
Like two animNode <animNode x_extends="ZedLeaperAttackMiss.xml"> can just be put in the same file ?
Isn't that what x_extends do ?
Fuse them together ?
Also there's two AnimSets: attack and attack-network, the files are identical, what is network for ?
probably remote zombies or something