#mod_development
1 messages ยท Page 203 of 1
eeeemmmm....
Hey everyone, I need help with another mod I worked on
@bronze yoke @sour island @fast galleon I have a mod that adds voice over to the radio. I've gotten some requests, to make it loop (for people who use it on servers).
I want to add an option on the menus, where if enabled, it loops the radios.
Checking other mods that do things similar to this, I realized all they do is change the minloop maxloop variables from the .xml, but it's hardcoded. If you have the mod enabled it will loop, otherwise it won't.
I'd like for this solution to be in a single mod, not split. Do you know if there is a way to do this?
please stop pinging me for everything ๐ญ
to my knowledge you cannot modify radio scripts from lua
i'm sure there is some way to manually replay them but you'd have to work that out yourself
@ albion, that's the curse of the good tech-lead. Meanwhile, what color of T-shirt should I wear tomorrow ?
duplicate all scripts with a variable to call one set or the other ? I know nothing about radio scripts but this is possible for animSets so maybe it is for audio stuff as well.
you can deliver multiple mods with one subscription. just make 2 versions. one which loops one dosnt and instruct your customers to "enable only one of these"
alternatively the second mod could just be the xml edits. "if you want looped enable this too"
You could make like 10 models, each with the spinning thing at a different rotation, and cycle between the models in the player character's update.
I was thinking of making a castlevania whip that worked like that but didn't make it.
Hi, do Lua_Events only fire on the client side or are there server side ones too? I need to catch the event when the player connects/disconnects on the server side, so as not to send commands from the client to the server
i have documentation here that notes which events fire on which side https://github.com/demiurgeQuantified/PZEventDoc/blob/develop/docs/Events.md
if there's no note it fires on both
Hmmm
That sounds like it would cause lag
But I could probably make it work with fewer than 10 models
as anon already suggested, you could try to constantly replace the 3d model. instead of using player update, you could also use the OnTick event. at least in theory, it will work. in practice however there could be performance issues depending on the complexity of the code which you run during the OnTick event.
to see whether this may work on your machine, you simply have to try.
yeah, i really wanted a whip but it didn't seem viable
the multiple models solution felt like it would look too clunky
i considered core modding it but it doesn't seem worth it
Depending on how complex the animation is you'd need a dozen of models
I think
But I feel like rapidly changing 3D models like that will cause mad game lag
it depends on how the game handles it, in theory it shouldn't cause much
it shouldn't really be loading/unloading the models live
Ye, when I get home I will look at doing it
yep. but you can create them essentially by copy pasting your 3d models and just rotate them a little.
for all the other stuff like script entries, you could try to generate them automatically since they all have the same syntax and structure (just in case there are too many to do this by hand)
I should still have the blender file. Might have lost it when cleaning my PC, so I would probably have to remake it lol
@autumn temple it's definitely an interesting problem you have and I am curious to see whether the trick with replacing 3d models will really work....
Ye, it's a mod that is just porting weapons from one game into project zomboid. And I want to make the weapons function identical to the game they're ripped from
Which is the blades spinning with a particle effect spinning around it. Which I have as a PNG on another face than the blades, but the textures broken atm
I have also a mod where I use the onTick event to change a 3d clothing model during game and it worked fine although the coding behind it was quite some work. Didn't use it to make any kind of "fake animation" though. In my case I just used this trick to change a 3d model a little so that it doesn't look weird when player goes into the sitting animation. So there was in fact only a single change of 3d model and not constant changes over a period of time. Anyway, it worked really smooth for me (and apparently also for the subscribers of my mod since I haven't received any bug reports related to this).
ontick might be too fast, but I can probably do it every minute on the games clock
I'd have to test around and see which ones just right
That's smth you could simply try. But I am afraid that every minute might be to slow to get a smooth animation. For OnTick... in case it is too fast, you could arrange things so that it is in fact only done on evry 10th tick or more generally, on every n-th tick. So there is quite some flexibility
Hmm yeah
Like have it stick to the same model for like 5 ticks then switch to the 2nd model for 5 ticks
Unless I can tell it specifically how many ticks I want it to update
exactly
that's also smth you just have to find out. but if you have some working code which does it for the 5th tick for example, it should be easy to change it to the 10th, the 20th etc. and see what looks best
Ye I will have to do some research and experimenting when I get home
good luck!
There was a mod that had something like a hundred (not sure how many) models listed in a .txt file to show projectiles at different rotations, but it used the same model file for each of the rotations.
@autumn temple Just some hint if you really wanna try this via the OnTick event (but I think it will apply to other events as well): It may be necessary to take into account at which game speed the player plays (1 hour a day, 2 hours a day etc.). Depending on their settings you might have to balance your usage of the events and the delay in between them. I just checked my own code and saw that it was necessary for my mod so that it looks somewhat ok-ish. But probably just a thing to keep in mind for polishing your mod later after you already have some basic working code.
ontick isn't tied to game speed
Also there's _ get delta time _ which is what fraction of a second passed between two updates or something like that
Do you know by heart what the command getGameSpeed() returns? Because it was this value which I had to use to align the delays in my mod correctly (which acutally uses OnTick). Quite some time ago I wrote this mod but I am 100% that without that alignment, the change of 3d model doesn't occur at the intended time.
i've never used that function, i would speculate from it returning an int that it returns the in-game speedup setting state
fyi, here is a relevant code fragment for this:
local delay = 75
local speed = getGameSpeed()
if speed == 2 then
delay = delay/4
elseif speed == 3 then
delay = delay / 9
elseif speed == 4 then
delay = delay / 16
end
if currentTick >= startTick + delay then
do smth....
end
I think getGameSpeed probably returns things like, pause, normal speed, x2, x4 sort of thing
There is the on player update method and ontick method that we discussed so far. But the ontick seems like the most optimal, though I do not know how fast the player update is
YEP! YOU ARE RIGHT! Now I remember. It is exactly this! Just confused it with 1 hour per day setting. My bad!
Oops someone already answered :d
they are the same timing
Ah
player update is called for each player each tick
Ok so I will just try ontick
y tho
@autumn temple , so my comment from above still applies but not with the "real-life-hours-per-day-setting". Instead with the ingame speed setting which can be checked via getGameSpeed().
Hm yeah I will try to implement that to make the weapon look better at differing game speeds
ya... but as said above, just a hint to keep in mind for later polishing...
it would be optimal to use a delta since otherwise it'll spin at different speeds at different framerates
Im sorry,you are the most knowledgeable , I'll refrain myself
however, I would like to have some help with menus and stuff
My apology, good drinking fellow, but I can not answer your question about whether or not I know a Baggins. But, there's one right over there. Frodo Baggins.
Does anyone know if its possible to return multiple items from a recipe? I have tried a few things but nothing so far... recipe Potato Skins and Potato Wedges
{
Potato,
keep [Recipe.GetItemTypes.SharpKnife]/MeatCleaver,
Result : FAPotatoSkins,
Result : FAPotatoWedges,
OnGiveXP : Recipe.OnGiveXP.Cooking3,
Category : Cooking,
SkillRequired : Cooking=1,
Time : 70,
CanBeDoneFromFloor : true,
noBrokenItems : true,
}
I know this only returns the 2nd line as it overwrites the first.
You might need to give it a lua function to run when the recipe finishes and add the second item with lua. Or make a third item with an icon that looks like it has both items, make it delete that item when the recipe finishes, and give both both skins and wedges with lua.
Thanks for the quick reply, I think I'll just break it up. Easier for now.
i cant seem to figure out how to use deltatime in the context of project zomboid 
the game uses extremely confusing language for it
gametime gives like ten different deltas with slightly different uses and i've never heard of any documentation for it
i can barely understand normal language, let alone confusing language
there was a time i knew what they each were, and i was hoping to document them, but that time has passed 
so from my testing, i dont think its the code problem but the game changing models, since even doing an ontick setup the game wouldnt swap the models
though its probably the game itself preventing it, like how it requires a game restart to see some model changes
how are you changing the model?
iirc the staticmodel thing doesn't work for weapons, they only read from weaponSprite or something instead
odd thing about this is it seems like it was intended for staticmodel to override the weaponsprite, there's just a mistake that stops it from working
well, i had a spare moment to work it all out again https://github.com/demiurgeQuantified/PZModdingGuides/blob/main/guides/GameTime.md
sorry i fell asleep for a bit lol
its a mess but this is how i have it. and i discovered something weird
the code does work, but the sprite only changes when i am equipping and unequipping the weapon.
More Traits also has that problem with its Gordanite trait. it will only update the stats when a player with said trait "equips" it. i think thats some hardcoded thingy.
curse these hardcoded limitations
tough said problem is stats and name not sprites. its still a simple crowbar after all.
ya its probably just how the weapons update themselves. which would affect the trait
id also want to point out the strange behavior where i tell it to update onTick but the weapon seems to only update EveryMinute. which could just be the hardcoded behavior
since its limited to being equiped i suggest you change ontick to OnEquipPrimary / OnEquipSecondary
but even then the updating seems to not happen consistently
since im testing with a 2h weapon i will try as primary
that makes it even more strange. i spawn it in with its default sprite, and every time i equip it, it cycles through the list until it hits ThunderFang. then every follow up equip only cycles through ThunderFang and Catastrophe
never reverts back to Hecaton or the TestAxe sprite
a index starts with 0
the first entry in a list is entry 0
so: current sprite index = 0;
not in lua
lua counts from 1
unfortunately we work heavily with java objects so the truth is more like 'you usually count from zero, but sometimes you don't' but in this case 1 is correct
oh hant done much with lists that needed me to adress that. so .. yes i am wrong.
for debugging reasons you could plop down a 'print("Current index: ".. currentspriteindex.. " of ".. #newsprites);
when you do the stuff.
just to see what happens
i put it at the end of the function and it just floods me with stack trace errors
its for in the "if weapon then" part also.. do not copy paste wasnt writing it down correctly.
o
print("Current Sprite index: "..currentSpriteIndex.." of "..#NewSprites.." = "..NewSprites[currentSpriteIndex]);
plop that in between line 9 and 10.
that should write into your console : "Current Sprite index: 1 of 3 = HecatonAxe"
it does seem to be updating properly every tick
let me rephrase that
the sprite change occures at the start of the animation for pulling it out and at the start of the animation when putting it away
maybe have a look how more traits handles its gordanite trait. dont know where their function is hiding but i think it can give you good pointers.
alright. thanks for the help in all this. its super confusing
im gonna go to bed and look at the trait when i can
thats how i learned coding and how to make my own mods : look how other people done it. implement my own version.
ye ive been slowly learning the same way but i never have a lot of free time to just sit down and read.
well im off as well ๐ have a good nights sleep!
likewise
I don't know if I will have the GUID or the scale of my complete suit configured more
the GUID must be the same as C:\Users\USER1\Zomboid\mods\FNAFBLENDER\media\clothing\clothingItems
Thank you!
I would suggest to not use "weaponsprite" but to change the actual items the player holds in hand.
another suggestion: if you'd like to try with weaponsprite, it is also possible that OnTick is to fast to see anything changing. you could try EveryMinute just to see whether it works in principle
I did try every minute. The video I posted was actually using everyminute
Maybe you need to do resetEquippedHandsModels on the player.
Maybe
kk. Then it wasn't the second thing I had in mind and mentioned in my comment. Anyway, trying to change the actual weapon item the player holds in hand will probably work I guess. At least, the same trick worked for me with clothing items: player wears clothing item A, then manually change it to clothing item B after a several number of ticks (or using every minute will also work ofc).
What anon wrote might also be worth a try though. However, for changing the item the player holds in hand, I think you could try the command
player:setPrimaryHandItem(item)
duckling wants the item to remain the same one but just change model though? ?_?
the weaponsprite is essentially changing the model anyways isnt it
Originally the game used 2d pictures, before the change to 3d models, but it still calls it a sprite.
Yes. But this is not an obstacle. With some tricky coding, you can exchange the item the player holds in hand without exchanging the item the player actually has in inventory. I think just putting smth in players hand will not put it in player's inventory automatically (that's at least true for equipping clothing items but I think it is also true for equipping stuff in hands). But even if it does, there are probably some coding tricks to work around
changing the actual item if your hands might fuck up the combat. since its a melee weapon youre actively swinging
ok... that could be an issue
ye i know im a build 36 bro. but in build 42's case the weaponsprite is the model
Yes.
swapping out clothing models isnt an issue with your method, but weapons most likely wont work
although I am not sure whether it really won't work. thing is that you still constantly have a weapon equipped. so it might be worth a try if no other way work
hm yeah though it probably will still not solve the main issue with my current setup
which is the weapons dont actually update until the start of an animation
Maybe you need to do resetEquippedHandsModels on the player.
Sorry to bug in, the game has animation overrides for hand items.
does this also allows to make an animation for a hand item?
Even if the swapping pauses during the animations that's fine. They're not that long
Nah the game doesn't support that sadly
I'll try to give some information that might be helpful since you are stuck.
Items have replace models, e.g. dirtbag has models for left and right hands.
In case you have trouble changing the weapon model during "animation" you can try:
player:resetEquippedHandModels.
Yeah maybe you need to do resetEquippedHandsModels on the player.
Hello, i tried making the Radio Mod with the guide by Azakaela, and i came across some problems, for one, the radio itself doesnt show up when i am in the car, i really dont know what to do, i did the gateway thing i think properly, i did both of the lua files also i think properly i really dont know why its not working :/
and for some reason the frequency in the wordzed app cant be changed bellow 200
if needed i can share some screenshots of the files etc
actually i will poste the screenshots right away
i think thats all the files
i am not really into coding that much so i cant really find the issue i have, but i tried everything that came to my mind to no results
im home now, but it doesnt change at all. it only changes with the animation
but i can now try to use player:resetEquippedHandModels
ok so implementing player:resetEquippedHandModels now makes the model change twice when an the equip animation plays
if i add a mod that inserts an item into certain medical spots' loot tables in the world (mid-season of a dedicated server), the item i added will be included in loot respawns right?
Can I comment something beside a value so that I know what the original was?
Like
ScratchDefense = 50, #70
plz help
gib code plz
ScratchDefense = 50, /* 70 */
this is it currently
Ty โค๏ธ
Does anyone have some reliable snippets of code for custom tooltips? Apparently the code I have written causes some conflicts with other mods that add custom tooltips
for vanilla items or custom?
Vanilla items
oh then i have no idea
I would be okay with the customs one too, cause why not
txt
/*
commented
*/ ```
xml
```lua
<!--
commented
--> ```
lua
```lua
-- commented line
--[[
commented
]] ```
@verbal yew If I recall correctly you made some nice tooltips for the armor absorbion, do you mind sharing the code for it?
Oh wow, that's a lot, thank you. I'll look into it
I think you sent the code for restoring the clothes appearance, I don't see where you manipulate the tooltip/description]
ouch
you mean icon with desc in tooltip?
Yep!
this one
I really like this code, a bit verbose, but I really really liked how you implemented the absobtion system, it reminds me of my transmog v3 code. Very nice!
y u make your own resetEquippedHandModels function? This should work:
weapon:setWeaponSprite(someSprite)
player:resetEquippedHandsModels()
Here is my implementation of a custom tooltip. This is not for a vanilla item but should be possible to adjust it for vanilla items without any problems. But it is necessary that the item already has a tooltip by the vanilla game. It works roughly as follows: Take the (preexisting) tooltip of the item and append new line with additional custom info.
Ah thank you! I see what you are doing here, very nice.
It's like the weapon tooltips injection code, but with nice formatting for the icons, that's lovely.
Thank you, I'll have a look!
Is this appending a tooltip box, under the default pz tooltip?
What your code's doing is creating a function called 'resetEquippedHandsModels '. Presumably nothing it calls it though.
Ah, I see, that's nice, but sadly it can cause issue with other mods who also append a box under the vanilla one.
As the additional boxes are not aware of each other position, eg: noir's backpack attachments
Thank you anyway!
'resetweaponsprite' probably would remove any change you've made to the model sprite by switching it back to the default.
it did do something tho, even if that something was basically meaningless :(
You could add a print to it to see if it actually does run
cuz without the reset i made the model only changed once per animation, but with it. it changed twice
Oh, is resetEquippedHandModels a stand-alone function that already exists in zomboid? If it is calling, then it seems what it does is reset the model back to default. So this will be your second model change, setting it to default.
ah ... ok. ya, that could be a problem if the other mods do not adjust the tooltip height after they added new info
it didnt even reset it to default it just continued to go down the list of models
btw please localise your function, onUpdate is a very likely name clash
weapon with rotor system... hmmmm....
Garden sawblade
MOTSHTSHOHOHOHOHOH
DAMN
you guys have been a huge help thanks
still using the OnTick event for this?
awesome btw
Also instead of making it a local function you could do
MyUniqueModNameClientside = {}
function MyUniqueModNameClientside.onUpdate()
--code
end
--add to events
So that someone else's mod can access your mod's code, for example for compatibility.
ya i was using ontick for trying to get it to work. but i might switch it to deltatime since it should perform better
Nuu I demand access to your mod's code by means of a global table in case it clashes with mine!1111
by using modules properly you can ensure the only possible clash is file path clashes
It can be kinda nice to give access to global table, so that other modders can make their own compatibly patches without bothering you.
ya its a weapon from a SMT game where its like a large handle with a dozen rotating sickle like blades on it.
Is a module a Lua file that you import into local namespace with 'require'?
yeah
o:
you avoid the global namespace entirely while still leaving it open for other mods
plz teach me this
but ive just used random weapons models, i will later make a bunch of models of the same weapon to make it seem animated
nice stuff :D
before optimizing the code, im going to do a performance test
ummmm ontick and deltatime aren't the same sort of thing. If you're running at 20 fps then the time of each frame will be 0.05 second on average. So if you run time:getdeltatime() or whatever it is, you'll get 0.05 on average. deltatime isn't an event to hook functions to like ontick or onplayerupdate
Unless I misunderstood you and you just meant the timing and you're switching timing from one to another
but i dont seem to have any frame loss with just this mod
Not wanting frame loss may be a good reason not to use deltatime. so it looks nice. yes.
wanting it to look nice is a reason to use delta time ๐
Though its speed may seem to change when you have laggy frames
if you use ontick but don't use delta time its speed will be different on different hardware and when the game lags
-- shared/myModule.lua
local myModule = {}
myModule.foo = function()
print("bar")
end
return myModule
-- some other file
local myModule = require "myModule"
myModule.foo() -- prints "bar"
the games not hard to run but with heavily modded playthroughs it could probably get laggy
so its just insurance
think of weaker computers that can't run the game at 60 to begin with
I wonder if there's a blender thing to make it automatically export multiple models for different frames.
So you can edit the model and then export all rotations at once.
Maybe GPT 3.5 knows.
someone who plays at 30fps will have an animation half the speed intended (assuming you target 60)
delta time must be used by anything that is intended to take an amount of real life time instead of processing time
What does local myModule = require "myModule" do if it doesn't find myModule? Oh, maybe it's okay because there could be a line of code checking if the mod's loaded first.
but if a user has lags or say only 30fps, isn't it somehow to be expected that the animation is also lagging or has lower fps for them? so that the animation is just synchro'ed to their overall game experience?
the game itself doesn't slow down because it uses delta time
otherwise uncapping your framerate on a good pc would make it go super fast ๐
it doesn't change the fps of the animation because the animation can't animate faster than the computer renders frames, it just makes sure it's always on the correct part of the animation that should be showing at the time of the frame
If we say the game's had a pretty slow update one frame and delta time is 0.2 second, then for this frame the game might say 'okay let's jump ahead by 0.2 seconds to the right part of the animation' maybe or at least that might be how it works
yeah, if the game lagged by 0.2 seconds, you expect the game to have jumped 0.2 seconds into the future, not just 1/60th of a second like it would when it's not lagging at 60fps, otherwise the game would feel extremely choppy and lag would make it nearly unplayable (and running too fast would make it actually unplayable)
but if your function runs ontick and doesn't use delta time, it won't adjust for that variance in the duration of each tick, and your thing will speed up or slow down
also thxm8
you can also nil check it if convenient, if not myModule then return end
Albion, what do I need to write in my require If I want to import the utils.lua file from the file MyFile.lua?
require "Transmog/Utils'?
yeah, it's always the absolute path
Okay, interestig, cause my vscode is not happy about it ๐ค
it only shows me require('Transmog.Utils')
yeah pz has a custom require function to support its client/ shared/ server/ file structure
also if you're doing things between different folders, that folder needs to have loaded first (you can delay the require to get around this)
so you can only require things at the same stage or earlier in the shared -> client -> server order
Okay, so, if I'm doing all of this, just in the client folder, I should be fine, right?
yeah, don't have to worry about it if you stay in one folder
Alright, thank you.
So, this should make me safely inport my utlis function without crashing the game
Too bad I don't get any intellisense for it ๐ฆ

intellij doesn't like the syntax either, but it does seem to ultimately understand it
you could annotate your module as a class and ---@type MyModule on the import
Does lua have an "index" thing like, typescript?
Like if I have a folder with a file inside called index.ts, I can write an import to just the path of the folder, and it will import everything that I'm exporting from the index.ts file
i don't think so
you could technically have a file that requires other files and returns them in a table but that'd probably be tedious enough that it wouldn't really make things cleaner
Yeah, that would not work. Well, thank you anyway!
oh, and be careful of circular imports
if file a requires file b, and file b requires file a, they can't both load before each other
Oh dear, circular dependecies also in pz ๐ฆ
Ah, wait, that's more manageable
in desperate moments i've cheesed it by delaying the require but generally you should structure things so you don't need a circular require anyway
How do you delay a require?
as long as it doesn't run as part of the file's initial execution, e.g.```lua
--myFile.lua
-- require happens at file load
local myModule = require "MyModule"
local myModule
local function loadMyModule()
myModule = require "MyModule"
end
-- require happens when the event fires (or any other way of calling the function, as long as it isn't part of the initial execution)
Events.OnGameStart.Add(loadMyModule)
of course myModule will be nil until the require function gets called so it won't work if you need it immediately
try changing the require separator maybe?
if i remember correctly someone asked for a weapon with rotating blades... needs lots of sprites.. but.. with that piece of code... that could work.
if two files need to require each other i'd recommend separating some of the code into a third module that both files can require instead, but this can be handy in a pinch
Oh you are right! I can change the require separator!
Ah that's very smart! Thank you
yeah it would be cool if the game supports having the weapons animated straight from blender
@fast galleon you are a genius! I didn't even know this was possible in lua ๐ฎ
Thank you both albion and poltergeist, I think I have enough stuff to start working on re-re-re-re-rewrite my transmog mod
hmm i just found out the weight modifier mod i made dosnt works on fish you well.. fish. anyone knows where to access the weight of fish?
So, silly question but what is better code 1 or code 2?
local function _refreshPlayerTransmog(index, character) refreshPlayerTransmog(character) end
Events.OnClothingUpdated.Add(refreshPlayerTransmog)
Events.OnCreatePlayer.Add(_refreshPlayerTransmog)
Events.OnClothingUpdated.Add(refreshPlayerTransmog)
Events.OnCreatePlayer.Add(function(index, character) refreshPlayerTransmog(character) end)
for readability i would say 1
seems fish are not included into getScriptManager():getAllItems();
I consider you may have issue with food. This would also include dead animals from trapping and vegetables from farming.
Food weight - hunger change would also be used for recipes.
yeah, your mod edits the item scripts but most kinds of caught/farmed food don't use their script weight
have not tried trapping yet. but the mice and rats i found foraging where altered. same as cooking stir fry. the filet has weight. but as soon as i put them into eveolved recepies the result is altered.
Wrong discord modding channel - my bad ๐
oh ok. not only has fish weight. i just found out calories, fat and carbs are either "nan" or "inf" i think the issue here is that for testing i used a 0 multiplier (everything weighless)
but strangely only on fish and anything cooked with fish. trapped meat is still ok.
i need to fix fish..
https://zomboid-javadoc.com was no help finding fish
fish should have an OnCreate function in their item script
look for that function, that's what assigns their weight
btw i heavily recommend using the official api site, it's not as outdated as it used to be and it has variable names which make it significantly easier to decipher what a function is https://projectzomboid.com/modding/
found it. apparently nutrition hunger and all stats are mathed based on weight. setting fish to weight 0 messed it up completely. as they do division and addition. reason my fish is not weigthless is they add weight for the sizes
local nutritionFactor = 2.2 * weightKg / baseWeightLb; -- baseWeightLb is 0 due my mod.
and you cant divide by 0
rip
ok i need help here. im not knowledgabe in lua enough. if someone can give me a link to a guide how i can "replace" the "Fishing.OnCreateFish = function(_item)" function that would be awesome. if i cant figure that out i need to exclude fish from my mod.
literally speaking, to replace it all you have to do is create a new function under that name
Fishing.OnCreateFish = function(_item)
-- do whatever
end
however it is best practice to hook it instead
-- save the original function
local old_onCreateFish = Fishing.OnCreateFish
-- overwrite it with a new one
Fishing.OnCreateFish = function(_item)
-- call the original function
old_onCreateFish(_item)
-- now do your own stuff
end
in your case it would be fairly straight forward to just hook it and then multiply the resulting weight
yep and i need to prevent people from multiplying by 0 in my mod. as i cant revert that.
so to make that clear if is use the hook method.. do i copy the entire thing or just do whatever i need to do at the end of the function? im confuzzled and need more coffee for this...
it copies the vanilla function and runs it first (or after if you put your code before it) so that if another mod hooked it or the vanilla function changes, your mod will always be up to date
ok then i run my code before "and" after. first to restore old weight. then reduce it after it mathed the nutrition.
this will work until indiestone adds more type of fish. then i need to update.
to include the new fishes (if they dont add a function like IsFish() )
because they want to check that link. once they are done they will unlock it again.
alr i'll give it time
it's a safe link, it's just my partner link for a server provider for pz
figured it'd be a good way to let people support me if they wanted to AND get good servers at the same time
already overshared YIPPEE
sometimes not
i have this problem 2 weeks when im try put link on boosty
And only after ticket in support it's been complete verify
where do i do that
is it literally just a ticket
or is there like a specific support ticket area for workshop shit
not know how it's named on eng, something like:
Home > Steam Community > I still need help with the Steam Community feature
and with the fish fix my little lua weight adjuster blew up from 32 to 110 lines of lua ;P
what does it consist of?
fish nutrition is mathed on creation when the fish is caught. my script set the weight of them down. meaning every fish had less nutritional value. even worse if you used my mod to set the weight to 0 calories carbs etc where "nan"
so i have to store the default weight of fish. let it math it and then apply my weight reduction again.
the change isnt on the workshop yet. need to test it first.
Phah... what a funny fishing script...
to be honest. makes sense to give bigger fish more nutritional value. but they went with randomness so they had to math that stuff on catching instead of game creation.
Perhaps I didn't understand correctly...
But when fishing, only the weight is randomized.
All other values are based only on it and they are fixed...
yes but it uses the "predefined" weight as base. and does a division by it.
so if that isnt what indiestone said it should be, all the math is off.
my script altered that predefined "base weight" of the fish.
local nutritionFactor = 2.2 * weightKg / baseWeightLb; "baseWeightLb is what my script altered"
item:setCalories(item:getCalories() * nutritionFactor);
so. lesson learned : dont mess with fishes. they bite.
if you wanna change nutrition, change nutrition, not weight. It looks like you used a "smart workaround" that revealed to be a trap in the end (as it always is)
nah my main goal was to provide a mod that reduces the weight of all items by a multiplier. like 0.5. everything half as heavy. the fishes threw a wrench in that gear needing the correct weight to be nutritious and not cause errors.
prolly need to repeat that setup later for farmed eggs and ham because farm animals ;P
any idea how I can get all nearby squares (or squares in radius x), in proportion to a square object?
ahhh, understood what u want
how do I grab the player characters name?
local desc = player:getDescriptor()
local ForenameName = desc:getForename()
local Surname = desc:getSurname()
see in AutoLoot mod the calls to Autoloot.plunderSquare
cheers ๐
thanks!
im getting stacktrace bashed for trying to use "item:getFullName()" and i dont know why.
can you show how/where you're getting item?
from the fishing function.
local old_onCreateFish = Fishing.OnCreateFish
Fishing.OnCreateFish = function(_item)
if not _item then return; end;
restorefish(_item);
old_onCreateFish(_item);
adjustWeightmult(_item);
end
local function restorefish(ITEM)
local ItemName = ITEM:getFullName();
i gewt bashed on the restorefish function
can you try to print item before trying to retrieve its name in the restorefish function?
trying that right now.
how do I add IsoPlayer to OnGameStart?
ok i give up. i cant find what im doing wrong.
how i can get type weapon on event Events.OnWeaponHitCharacter.Add?
and damage in script
This website has information about the events https://pzwiki.net/wiki/Lua_Events/OnWeaponHitCharacter
example:
local function OnWeaponHitCharacter(wielder, character, handWeapon, damage)
-- Your code here
end
Events.OnWeaponHitCharacter.Add(OnWeaponHitCharacter)
ok now i get why i get stacktraces left and right the _item is "zombie.inventory.types.Food@6a985e70" now how to figure out how to convert that...
yep, i know
but i cant understand how to exclude handWeapon on melee weapon or firearm
or category or twohands onehands
that event always passes a HandWeapon, you can't attack with anything else
Hi!
I've been using the Recondition Car Batteries mod together with the Immersive Solar Array mod for a long while but found, upon returning to PZ after a long break, that Recondition's compatibility patch doesn't work. After taking a look at the code it seems as if all the functions should work properly.
If that's the case, would the only thing in need of change be to update the require=ISA line in the mod.info-file to instead read require=ISA_41?
DDDD:
There's item.isRequiresEquippedBothHands() in the list of functions for an inventory item
local AbsorbDamage = 0
if handWeapon:isRanged() then -- if ranged
AbsorbDamage = 1 -- need improve for weapon category/type/caliber etc
end
if not handWeapon:isRanged() then -- if melee
AbsorbDamage = 3 -- need improve for weapon category/type/one-twohands
end
okay, isRanged - bad for firearm weapon...
it's should be getSubCategory() == Firearm
Here's an idea, to check how many hands hold the weapon you could check whether or not it's in both the primary and secondary hands of the holder.
yeah, it should be the version of ISA that you use. Otherwise the mod will not be activated.
what error do you get?
---local function should be declared earlier
local function restorefish(ITEM)
---should use getFullType() or getType() instead
local ItemName = ITEM:getFullName()
end
local function adjustWeightmult(item)
end
local old_onCreateFish = Fishing.OnCreateFish
Fishing.OnCreateFish = function(_item)
if not _item then return; end;
restorefish(_item);
old_onCreateFish(_item);
adjustWeightmult(_item);
end
i got it to work somehow. tough fish are not really affected anymore.
local old_onCreateFish = Fishing.OnCreateFish Fishing.OnCreateFish = function(_item) if not _item then return; end; --restore indiestore orginal weight old_onCreateFish(_item); --adjust weight of finalized fish end
was the base idea but lua and the game resisted my foolish attempts to do so.
ok i dont get it. why it is refusing to change weight... log says they should be weightless reading out getActualWeight. yet ingame they are STILL weight about 3kg o.O
item:setCustomWeight(true); ?!
the orginal function does that at the end
LOG : General , 1699096135469> [CustomizableWeightMultiplier] fish has been created
LOG : General , 1699096135469> [CustomizableWeightMultiplier] Name = Base.Pike
LOG : General , 1699096135469> [CustomizableWeightMultiplier] weight now = 0
LOG : General , 1699096135469> [CustomizableWeightMultiplier] restoring weight
LOG : General , 1699096135470> [CustomizableWeightMultiplier] weight now = 0.40000006556510925
LOG : General , 1699096135470> [CustomizableWeightMultiplier] running orginal function
LOG : General , 1699096135470> [CustomizableWeightMultiplier] weight now = 14.10588264465332
LOG : General , 1699096135470> [CustomizableWeightMultiplier] adjusting weight again
LOG : General , 1699096135470> [CustomizableWeightMultiplier] getFullType = Base.Pike
LOG : General , 1699096135470> [CustomizableWeightMultiplier] weight now = 0
LOG : General , 1699096135471> [CustomizableWeightMultiplier] done
yet ingame said pike has a encumbrance of 4.4 kg
i think im slowly giving up and just skip fish alltogether
rough overwrite?
main problem at first was that my mod messed with the nutritional value of fish. since they are calculated at spawning/catching. so to alleviate the issue i tried to apply the weight change to the item after they where created by the orginal function. but that seems to not work at all.
the original function uses the weight to add calories fats hunger etc values. so a 0.25 multiplier would make any fish 75% less nutritious.
and worst case if someone actually used my mod to use a 0 multiplier the calories where "inf" or "nan" ....
I mean that func work with conventional kilograms
all nutritional calculations are based on kilograms
At the end func simply converts the weight to pounds (game standard weight)
Why don't we just rewrite the hell out of the function?
I mean, like
Fishing.OnCreateFish = function(_item)
******
-- main code stuff
******
-- hunger reduction is weight of the fish div by 6, and set it to negative
item:setBaseHunger(- weightKg / 6);
item:setHungChange(item:getBaseHunger());
-- weight is kg * 2.2 (in pound)
item:setActualWeight(weightKg * 2.2 * YourWeightAdjustHere); --- <-- HERE
item:setCustomWeight(true);
end```
yes i kinda dont want to overwrite the entire thing. i tried this : #mod_development message (link to a post above)
you know to make sure its still compatible when the devs or another mod rewrites fishing.
all i want to touch is the weight
@sand saddle Did you also modify ISFishingAction:createFish function?
no does that also adjust weight?
also where is that function
If you want to modify the weight of fish that is caught by fishing, you should modify that function.
client\Fishing\TimedActions\ISFishingAction.lua
good afternoon, can you suggest a good reference for adding a new branch in crafting. In several mods that add a new branch in crafting, I could not understand how exactly it is added, by what method the created category is added to the general list of branches.
thanks i note it down. for now i updated the mod to completely exclude fish. i will look into it once my head is clear again. i think i lost a year of my lifespan over trying to figure out why it wasnt working.
Category
Specifies the category in which the recipe will be displayed. Example:
Category:Carpentry,
Category:MyCategory,
in recipe
script
recipe Make An Alcohol Crying Dragon
{
/* res needed */
Result : get this item,
Time : 80.0,
Category : MyCategory,
}
like this?
yep
i tryed kile that but it dont show on game, maybe need delete old save and create new world?))
thx for answer!
NG not req
i think problem in other
look like u use specific Module without import base
and for translates i need create file like ContextMenu_EN.txt?
Damn it!!! ure right. I'm stupid) I forgot to initialize my database, sorry)))
IG_UI_EN.txt
IGUI_EN = {
IGUI_CraftCategory_MyCategory = "My Name",
}
you are my hero today
https://pzwiki.net/wiki/Scripts_guide/Recipe_Script_Guide#SkillRequired
can be useful too on the furure
I know that feel bro
when i'm tried fix all issue in original Better Lockpicking
We have a bow and crossbow mod.
I would also love to see a slingshot mod!
a professional crafted slingshot using metal balls is quite deadly.....
I discussed that with a friend in fact.
We bought slingshots from an event. He got an upgraded one with a wrist support.
Crafting a slingshot could be easier than a bow and you could have different materials as ammunition (small stones/chip stones at least).
Im having a bit of an issue. Ive made some gun mods and I've got it set up so I can attach the vanilla upgrades but I cant see them. Ive gone into the attachment editor and moved the attachement points and parented the upgrades so they should be in the right areas but they just don't show on the weapon. At this point Id be happy if I could get them hanging off the end of the characters nose as long as I could see em. Is there something Ive missed?
do i need permission to write and publish a patch of another mod??
Hi guys, looking for a solution to a problem if anyone has any ideas, I'm working on a patch for Kyne's new artifact containers to give them functional combatibility with filches artifacts, so far I've gotten as far as making it so that Artifact containers will only accept Artifacts into the container, however this doesn't prevent artifacts from being stored in other types of containers. And I know you may be thinking why is that a problem
I'm already doing iterations over inventory items to trigger certain effects based on which artifact is contained in the inventory itself, but I'm worried that going a level deeper and checking all containers except artifact containers could lead to a pretty un-optimised mess *Already experiencing some frame drops if I FILL my inventory with artifacts but no player in their right mind would do this if they didn't want to become goo. *
If there isn't a simple solution anyone can think of I'm open to any creative workarounds ๐
What "scale" your guns have in blender?
I reset the scale before exporting. the guns are fine and show up in game no problem
Hey guys, how do i get acces to the admin account on a server that i host for debbuging my mod
You finna haveta add your weapons to the list of weapons the attachments can attach to.
go into your servers Console in the control panel and use the command SetAccessLevel <username> <level> Or just debug in an SP game. Doenst risk messing with anything on your hosted server
already done. I can attach it no problem. the issue is that once its attached you cant see it
:o oh ok
Thanks
Are the models themselves not visible or is it just a problem with when they are attachments?
you just cant see them. So Ive linked everything up in the code, I get the option to upgrade with the vanilla 4x scope, and Ive set everything up in the attachment editor to be in the right location
Its got it on there but you still cant see it
guys, someone has come across a mod that temporarily speeds up a character when using some kind of medicine (adrenaline, etc.) I search some mod 4 reference))
I have a question that seems simple, but I can't find the solution. How can I create a sound event.
I know how to create a sound produced by the user or object. But this doesn't attract the Zs to the character. I want to use some noise that will attract the Z's.
Can you just not see them because of a problem specific to using the models for attachments?
no idea. Im referencing the vanilla attachments and not ones Ive created myself so I dont have models for them in my mod
Oh maybe I skimmed and/forgot what you wrote.
So do you mean that in-game, you can successfully attach a weaponpart to your handweapon, a weaponpart that when attached to an expensive spice weapon shows a model?
I.... what?
Or beaver butt derivative, whichever.
...butt when it's attached to your mod handweapon, it instead doesn't show a model?
no idea what youre on about. aaanyway. doent seem to be just a problem with the vanilla attachments. Ive just made a quick dummy scope and its in the game, I can drop it on the ground and see the model, but when I attach it to a gun its not visible
I was just spelling vanilla differently, or something. https://en.wikipedia.org/wiki/Vanilla#Nonplant_vanilla_flavoring
ah. Yeah that went way over my head. beaver butt vanilla. gotcha
Gib .txt specifics for models and weapons and attachments plz ;-;
By the way, hereโs something else Iโm interested in)) Is it possible to give a player experience if the player drinks a certain liquid? ))๐
It not possibln't
help "./ProjectZomboid64: error while loading shared libraries: libsteam_api.so: cannot open shared object file: No such file or directory
"
Does the .a property of the Color do anything when you change the color of a piece of clothing? I'm setting it to 1 or 0 but the color is still rendered the same way ๐ฆ
why not)) and what if i can change OnEat = MyLuaFunction ?))))) ๐คฏ
Not impossible.
Not not impossibln't.
Loweffortpost commences: You could use code like (copying some code here that looks related)
local Xp = player:getXp()
local perk = Perks.Fitness
local perkLevel = player:getPerkLevel(perk)
and the java documentation would list functions for player's Xp and things
Have you ever seen a mod that gives a character temporary characteristics? (for example, temporarily increases running speed, gives temporary + to the carried weight, etc.)
I was making one that incorporated that but maybe that's all.
Some code dumped here.
I remember I had also coded to use a hidden item to increase or decrease running speed but deleted that code for some reason. Maybe it could only swing a maximum of 10% each way or something.
For changing carried weight you can change the weight of a hidden item.
Items have an isHidden() function or something like that, and how it decides if an item is hidden is it checks if it has a display name. So to hide the item you delete the line that gives it a name and it won't be seen in default inventory view that misses hidden items.
yooo guys is anybody available in developing a mod for a server? It's a paid job รจ_รฉ โค๏ธ
Would you like for me to help you in DM's, when i started doing my guns i've been trying for a few days before i found out what causes it, aswell as fixed to some further issues?
That would be great, thank you
I've send DM
I made a chonky recipe mod for our server and wanted to insert some new items into the foraging list, this was working before but now it seems to not add any of these to the foraging loot table. (Items, their models and related recipes work with no problems.) What am i doing wrong?
Has anyone made a mod using a temporary player boost? It seems to me that this can be implemented through event listeners, but this option will be resource-intensive. Are there any default methods for this?
wdym by boost
I think you have to call the lua that runs in game time until the time reaches game time+ whatever length, then get whatever stats you want to boost, increase them, then get them again to return the original values after game+current time
did anyone tried adding a trait MIDGAME to a character while keeping XP Boosts.
It looks like adding a trait after OnGameBoot doesnt give any xp boost even if you add a vanilla trait from debug menu???
I cant find the function
check out the "become desensitized mod" on steam
desensitization doesnt increase or decrease xp boost
adding traits midgame is easy I done that part
issue is adding a trait with xp boost
you cant edit the xp boost midgame
for a player character
it should still call the perk list though
yeah I thought the same
but while testing it does not
even vanilla ones doesnt work I tried adding them to my char with debug menu after I created my char
you get the trait but not xp boost
my buddy is working on adding loading bars that update with time i'll check with him when he gets on and get back
eh sure thanks
this is intended behaviour, you can edit the player's xp boost map directly
how can I reach it?
the couple methods of gaining traits mid-game in vanilla wouldn't make sense to have skill boosts associated with them (and i'd speculate that most modded cases wouldn't want that either)
I see yet I expected a way to reach or edit it like we can edit in debug menu.
Couldnt find anything except addXPBoost from PerkFactory
declaration: package: zombie.network, class: GameServer
assuming player is an IsoPlayer object, player:getXP():setPerkBoost(Perks.PerkName, level)
0 would mean no boost, 1 would be 75%, 2 100%, >= 3 125%, just like in character creation
eh couldnt make it work unfortunately
errors sighs
there is already a mod for that ig
Need help, blood and dirt removes texture from my clothes. where should I fix?
in your clothing's script.txt entry, did you set the BloodLocation parameter? see here for an example: https://pzwiki.net/wiki/Pantshttps://pzwiki.net/wiki/Pants
it's probably fine to make mods for you and your friends for private use only and add any content you like. but I am not sure whether this discord is the correct place to find help for this specific mod... I personally ignore this but it could be the case that some ppl consider this controversial
https://en.wikipedia.org/wiki/Falangism isn't this going to be the content of your mod? the clothing? at least when you publish this on steam, it may contradict modding guidelines of steam as well as Tis. but not an expert here. just something to think about. may also be different for different countries
Falangism (Spanish: Falangismo) was the political ideology of two political parties in Spain that were known as the Falange, namely first the Falange Espaรฑola de las Juntas de Ofensiva Nacional Sindicalista (FE de las JONS) and afterwards the Falange Espaรฑola Tradicionalista y de las Juntas de Ofensiva Nacional Sindicalista (FET y de las JONS). ...
Fascist groups that fought with Germany are a little different than most other political parties
as I said, it's probably fine if you make such a mod for your private use with friends. it's absolutely your business. but I am not sure whether this discord is a good place to discuss it.
I don't know where else I can get help with the code
Then make a less political mod to test it with
Is an underdog getting some flak well then just let me help with the mod ):D
in case you have technical questions about modding, it's fine to ask them here. but I recommend to ask questions without posting explicit examples of your mod (due to its controversial nature).
Idk that I'd call a fascist an underdog but that's just me
?
I don't know where the error is, so I just uploaded everything
I don't know if it's fascism, but however ironic the situation may be there's some unpopular idea that goes against a dominant culture so that's good enough for me or something
My brother in christ it's literally the dudes who supported Franco in World War 2
Que pesado el notas
Spain did not participate in the Second World War
Does the OnGameStart function succeed in adding the clothing item and the only problem is it doesn't appear in the list in the menu?
First I tried playing and the T-shirt was nowhere to be found, the only trace of the mod is that it appears in the menu as I showed
I don't want to get too into it, but they were literal fascists. Not appropriate all the same.
They cannot be erased from history and they left traces in my country that are still alive and are part of today's politics, with less presence
Oh, so it's the opposite of what I thought? So it appears in the menu which means the item exists. But your client code doesn't add the item, so the client code may be wrong? Also in the menu, you don't see any artwork from the clothing item so that's likely broken too?
(I don't participate in culture the way normal people do, and disagreeing with a school of thought is pretty normal for me, disagreeing with people is normal for me, it feels not special to me when I find something I disagree with.)
It's really a joke, nobody cares about Falange today and they're not going to get anywhere, it's not that big of a deal
You could say the same about my country's ku klux Klan. Still not appropriate even as a joke
Client code:
-- client/CamisetaFalangeClient.lua
-- Este cรณdigo se ejecutarรก en el lado del cliente.
Events.OnGameStart.Add(function()
local player = getSpecificPlayer(0) -- Obtener al jugador local
if player then
local clothingItem = player:getInventory():FindAndReturn("Camiseta Falange") -- Buscar la camiseta en el inventario del jugador
if clothingItem then
-- Personalizar la apariencia de la camiseta
clothingItem:getVisual():setTexture("media/textures/clothes/camiseta_falange_textures/camiseta_falange.png")
end
end
end)
I don't think it is comparable, Falange campaigned to help the most disadvantaged families (Auxilio Social) and even had a women's branch that made achievements in feminism in terms of laws. I know what you mean anyway
You could print something, with code like print("clothingItem Camiseta Falange", clothingItem ) and it may print nil.
I can do without the client, can't I? I saw some mods that just had the server folder
Maybe you should instead get the item with
"camiseta_falange"
or
"FALANGE.camiseta_falange"
I don't know much about how to make the code work on multiplayer. Maybe it has to be server or shared idk. Anti-cheat might stop if it's on client but I don't know of it does.
Ohhhhhh
hmmm
nvm the above crossed out messages
LMAO
Hmmm
I will try it later then, I'm not in PC rn
I mean
In 5 min
I'm not sure I remember what the .xml files are for. I'll check something.
ya... also read that those guys where friendly social welfare feminists ๐
Some did and some did not, out of their ideals they reformed laws so
Regarding the social struggles of that period, the only figure I find admirable is Buenaventura Durruti, anarchist, but I don't think we should keep talking about this
I'm gonna modify the files
camiseta_falange.txt is in scripts\. maybe you could try putting it in scripts\clothing\ or maybe that's not needed.
I don't know what clothing.xml does. I noticed you used a 44-character GUID while the game uses 36. idk if that matters.
media/textures/clothes/camiseta_falange_textures/camiseta_falange
you could change this to
clothes/camiseta_falange_textures/camiseta_falange
FALANGE-0f92c7a0-c103-4abc-9f3c-0dfb8154c79a is 44 characters long.
it doesn't matter, the game doesn't actually do anything with them
them being uuids is technically just a suggestion
I really thought that was going to be the biggest problem lol
i don't recommend breaking conventions but that technically shouldn't cause issues
Yeah I guess
Nop, still not showing in the menu
It is also a bit strange that in the outfit section the name of the module appears instead of the name of the T-shirt
:o a clue?
Have you posted your item script code anywhere?
Yeah wait
Maybe it's because of the name field here
<m_MaleOutfits>
<m_Name>FALANGE</m_Name>
Oh you got the guid's ther wrong way around
You called the item FALANGE-0f92c7a0-c103-4abc-9f3c-0dfb8154c79a and you also called the outfit FALANGE-0f92c7a0-c103-4abc-9f3c-0dfb8154c79a and when you list the item in the outfit, FALANGE-4880c0a4-5b8b-438d-8bf5-c9320a234a05, it's a guid that only exists there and doesn't refer to anything.
I think.
Without knowing what clothing.xml does.
You could copy a mod that works and change things a bit at a time until something breaks?
hey i was wondering if i could make a gun mod that is brita compatible tryna make a 3d printed weapons mod that goes along with brita (favorite mod) and ive not really attempted gun mods that much apart from stuff thats vanilla compatible only
Hey, kinda in a pickle figuring out something with a recipe script & connected functions. If anyone has any ideas/insights that would be very appreciated! Basically, I am trying to use a specific inventory container for a recipe. That container needs to be completely full of specific item(s). -> I.E. Container has a capacity of 1, needs to be filled to exactly 1 for the recipe to work.
Current ideas:
- On creating the container, mess with the
setOnlyAcceptCategoryfunction. Assumes that theInventoryContainerandItemContainerclasses are interfaceable. (which I am pretty sure they are) - Use an
OnTestfunction to check the contents of the container. Worried that would then run every time that is checked... Which would get cumbersome :(
Goal is to have the players put in a set amount of any item with the specified tag/identifier. That specific set of items will be passed into an OnCreate function to pull information about what was used to give the resulting item. I have to guarantee that both variables are satisfied, meaning both the container being full AND containing the correct items.
yeah, should work
Any idea on how I should check the container being full? I think that would probably make sense as the OnTest function
i can't find the exact method right now but i can tell you something to watch out for
there are various java methods which allow you to check how many items of a certain type a container contains. see here: https://projectzomboid.com/modding/zombie/inventory/ItemContainer.html maybe this helps
declaration: package: zombie.inventory, class: ItemContainer
with traits different players have different capacities
btw... not all methods are relevant but maybe getCountType(...) looks already good...?
Yeah, I considered that too... But an issue is that I need it to be exact. So I don't now if that is something that that can be turned off?
isn't it possible to just hardcode it? for example, if containter contains 10 items, then allow the recipe to be executed?
what if they can't put 10 items into the container?
Yeah, though I would like to account for the the possibility of the different items being allowed to have different weights
ISInventoryPage uses getEffectiveCapacity to get the inventory capacity for a player & getCapacityWeight for the current weight (technically ISInventoryPage.loadWeight for the latter, but it uses that ultimately)
Both methods on ItemContainer
but if you use the effective capacity the recipe cost changes based on traits... and inversely to how you would want a positive trait and negative trait to behave
I answered based on the assumption that the "completely full" was necessary; getMaxWeight seems like the equivalent that doesn't scale, but that's more of a design question anyhow
Ah, sorry- I'd ideally like the container to have a fixed size no matter the traits AND for it to be filled.
then you could simply try to hardcode: if your container has (default) max-capacity 10 for example, then use commands to check whether it actually has items in it which have overall weight 10. you could probably use the commands which Omar mentioned to do this.
assuming that you know a priori what the defaul max-capacity of your container is...
getMaxWeight will be the max capacity without considering player traits
There's still the question of Disorganized, though, as albion mentionedโplayers with that trait wouldn't be able to fill the container to that capacity
brandon, is it a special container your mod introduced or a vanilla container in your case?
Yes, it will be a mod introduced container
i think it's enforced entirely by lua
so you could just e.g. hook getEffectiveCapacity and make it ignore your container
but it might mess with some java sided handling i don't know about
Any idea what the difference is between capacity and max capacity? I see a multiple methods for them, but I am not sure the difference. You can setItemCapacity and setMaxCapacity
offhandedly i'd say the most likely thing is nothing and one is just an older name for backwards compatibility
Any idea why this would not work assuming attacker is valid?
Java
this.combatSpeed *= 1.1F;
Lua
attacker:setVariable("combatSpeed", attacker:calculateCombatSpeed() * 1.1)
I dont think calculateCombatSpeed() is a method, at least I cant find it
it's in the java IsoGameCharacter
Is there a mod patch in development for making better masks compatible with the stalker armor pack?
Also, its in the docs:
https://zomboid-javadoc.com/41.78/zombie/characters/IsoGameCharacter.html#calculateCombatSpeed()
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, class: IsoGameCharacter
Can also see another modder making use of it here:
#mod_development message
Example of someone talking about calculateCombatSpeed:
#mod_development message
So uh- I was using https://projectzomboid.com/modding/, which doesnt have it.
But https://zomboid-javadoc.com/ does...
Sorry for that lmao
Im ngl, I dont think I know the difference between the two
I dont either lol. I found the link to the one I use on the IndieStone website
They are both the indiestone website ๐ญ
shit
I was seeing that setVariable() is tied to animation. It is contained in the Package: zombie.core.skinnedmodel.advancedanimation...
And then I found this
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, interface: ILuaVariableSource
Lmk when you see it...
I see it being tied to a lot of things.
Aside from just animations
I dont see it though
It is a capital S.
They have two functions. setVariable() is for animations. SetVariable() is for this sorta interface...
so just need to use uppercase S
I presume
crazy man, you are right
That does annoy me
Ima let it rip, make sure thats the case
the TIS one has parameter names and a small amount of documentation, the other one is *slightly* more up to date but lacks all of that
calculateCombatSpeed is a protected method, you can't call it from lua
it seems like another difference i was unaware of is that the other doc won't hide inaccessible methods
Well shit, it did error on attacker:calculateCombatSpeed
local theCombatSpeed = attacker:calculateCombatSpeed() * 1.1
attacker:SetVariable("combatSpeed", theCombatSpeed)
Why the hell would it be protected:
encapsulation
Not sure what you mean by that but ill look it up
Couldn't you also use the same set of functions you used for the Set section? Like, attacker:GetVariable("combatSpeed")
If you are just trying to increase the speed that the player is attacking, you can also hook the equiping/unequiping of a weapon, and just modify the item they are holding
local theCombatSpeed = attacker:GetVariable("combatSpeed")
attacker:SetVariable("combatSpeed", theCombatSpeed * 1.1)
Probably erroring bc theCombatSpeed and 1.1 are not strings
Yeah, that makes sense
What is it you are trying to accomplish with this? Probably another way around it
setVariable(String key, float value) should be happy with it
No no no no no... We went over this ๐ญ
lololol
@random finch ๐
just read over that, you are wrong i'm afraid
this is all for animations, player speed is entirely dictated by animations
infact, SetVariable capitalised is just a backwards compatibility feature and it doesn't even have code of its own```java
public void SetVariable(String string, String string2) {
this.setVariable(string, string2);
}
bruh
That is somehow arguably worse
Sorry for confusion, guess that the calc combat speed was the issue lmao
All good, at least I know about the setvariable variants now. Been messing with animations as well.
I appreciate the help for sure
This is an an extremely temporary combat speed boost on crital hit. Not sure when i should reset it. Maybe after the next attack or after a burst of attacks like a gun in auto mode.
If you are looking to speed up the combat speed, I think that the best way is going to do it through the weapon itself.
I dug into the java to see how calculateCombatSpeed() was calc'd, and since you are applying a flat +10% ( x1.1 ), if you do it directly to the weapons speed, it will do the exact same thing
You may be right. I was following how they did it in vanilla. In IsoPlayer function pressedAttack. I need to test or find out if it resets on its own. If it doent Ill consider via weapon.
it might reset instantly, stuff like that is usually calculated every tick
Anyone got a neat and simple code for lowering a player's boredom by 10 in lua?
I kinda suck at the syntax, just getting started
assuming you have an IsoPlayer object player,```lua
local bodyDamage = player:getBodyDamage()
bodyDamage:setBoredomLevel(bodyDamage:getBoredomLevel() - 10)
Thank you, I'll give it a shot ๐
local playerStats = getPlayer():getStats()
playerStats:setBoredom(playerStats:getBoredom() - 10)```
Wait...
๐
lmao
the one on stats is legacy
funnily enough it still counts up, but it isn't the underlying number that shows the moodle or applies any effects
That is really funny though, we had the exact same code typed up, I just used old method lmao
finding that out post-release was a real embarrassment with statsapi ๐
Just to add to that, is there a simple lua for playing a sound? I got the sound added and all, I just need the syntax to play it
@random finch With some Lua Events, you could effectively set your own event 'timer' on the player. Something like -> player gets a critical hit, for the next x weapon swings, that player gets a boost to their attack speed.
You would have to find a way to hook the critical hit. Maybe use the OnWeaponHitCharacter -> https://pzwiki.net/wiki/Lua_Events/OnWeaponHitCharacter.
Then you'd presumably have to check the isCriticalHit() boolean, if that is true set a player mod data value to something. For example, player:getModData().CriticalSwingSpeed = player:getModData().CriticalSwingSpeed + 10 , and in the same function add a new lua event on the OnPlayerAttackFinished hook. https://pzwiki.net/wiki/Lua_Events/OnPlayerAttackFinished
Basically your OnPlayerAttackFinished function can then reference that mod data counter. So every swing, after each swing if player:getModData().CriticalSwingSpeed < 0, then reduce player:getModData().CriticalSwingSpeed by 1. If player:getModData().CriticalSwingSpeed = 0, have your OnPlayerAttackFinished function remove itself from the event manager.
So 1 function always checks for crits on hit, the other is a self deleting event that only triggers when it has to.
Probably worth putting a OnEquip and OnUnequip set in there too...
Under what context?
There is an event that triggers when a recipe is created. As it triggers, I'd like a little sound to be played.
you could also have an ontick listener that counts until a certain time if you want the effect to be time based
Yeah, that too haha
BaseSoundManager():PlaySound(String name, boolean loop, float maxGain)
I havent used this myself, but this is what I would assume is used
Alright, I'll give a little more context ๐
I'm basically just starting out, so bear with me.
So I have a Tamagotchi item. You play it by triggering a recipe. When the recipe finishes, you basically get a "new" Tamagotchi, and a lua triggers to lower your boredom a bit. I'd like to play little tamagotchi beeps somewhere along that process.
Oh, cute! You could also have it play that for the actual recipe too
How could I do that?
Cool! How do I do that?
Have you defined your sound in its own script?
Still working on that part, trying to figure out where to place the files and such.
The folders are making me crazy sometimes
I got an ogg and wav-file plopped down in the middle of the sound folder as-is.
You would have a your mod folder, and inside would be media. Then in there you'll need a folder called scripts, and a folder called sounds :)
Oh, cool yeah
Yeah, I got that far. I have a sound folder with the files, and a script txt. I just don't know what to put as the clip/event thingy
Hey! probably a super simple issue but I'm trying to do some reskins of Filibuster's cars to match the camden theme. This seems to make the car appear untextured entirely, what am I doing wrong?
Where did you put the texture?
in the same place as the others, media/textures/vehicles
it's right next to the other ones that do load
Is this a modification of the base filibusters mod? Like, tweaking on your end for rn
yep!
Cool. Did you modify the code while the game was still open?
nope, i've done a few reloads now to just make sure that wasn't the issue.
even when I kept the original name of the file - same issue.
In your sound script, you just have to set the name, and the clip(s). So
module TW
{
sound CordlessDrillSwing
{
category = TW: Main,
is3D = false,
clip
{
file = media/sound/CordlessDrillSwing.ogg,
distanceMax = 10,
volume = 0.6,
}
}
}```
Borrowed this from 'the workshop' mod
Thank you, that's a great template!
you missed a closing bracket there
Good eye! :) Thanks! They had multiple clips in the same script, but I didnt wanna bomb the chat so I cut it haha
Did you give it its whole own vehicle script?
I didn't do that no - i just edited the already-existing 85vic file.
would it be smarter to perhaps base this attempt off of (this) file, because it edits filibuster's (?) https://steamcommunity.com/sharedfiles/filedetails/?id=2604581073
it seems as if this mod makes them all into brand new cars, instead of replacements - as was the goal, but.
probably not the best solution given I don't think I'm in any place to start editing vehicle spawns ๐ญ
This is going to sound really dumb. But- I would try naming the png vehicle_85crownvicpd2camdenshell.png
i'll give that a shot!
dont forget to change the script file too :)
no dice, unfortunately
are you in debug mode? some bit depths can't be loaded, but you'd see an error about that
Thanks for the help with my Tamagotchi. I think the exercise was a success!
Very interesting. I have yet to use ModData. Need to figure out its purpose and how it works.
Itโs literally just anything โextraโ. On items, anything that doesnโt have its own definition is considering mod data. Like, if you made an item with a custom variable / line that said Mustard = True, you later in lua you could do local X = getItem():getModData().Mustard where X would = true.
Itโs effectively anything that you write to a table that doesnโt have a predefined thing, afaik. But you can mess with it for all sorts of stuff. You can mess with mod data on items, world objects, players, etc. Itโs great for keeping track of stuff for later use
Of all the problem I encountered, this one is the most confusing.
Seems like if you were to add Mustard to each item, say all weapons, you would have to loop through each item on some initial Event to add the attribute?
If you wanted to add it to pre-existing items, then you could have it do something along those lines yeah. Otherwise, if the item was a custom one, you could literally just put the mustard variable in the script for that item and that works the same
an annoying thing about that is it isn't savegame safe
that is it won't be added to items spawned before that script property was added
(before the mod was added, if it changes in an update, etc)
Gotcha, that is annoying. Iโm sure there is probably some way to update old things? Maybe?
Just run an OnTick function that scans the all connected inventories near the player for any item that could be missing those changes, and constantly make sure they are up to date ๐ฅธ ||please no one do this, I beg you||
this is why i'd say for things other than default values that should change per-instance it's better to just use a lookup table
Hey sorry this probably isnโt the place but people do commissioned mods on here right
In such case I'd choose to explicit the limitation: "should not be added mid game"
Hi, how to make this text a variable that i can translate in shared/Translate files?? ty
this is part of a function
player:setHaloNote("CUSTOM TEXT")
look for "getText" calls in vanilla lua code
which method is responsible for the degree of intoxication of a character and how i can get it
Ty
Could someone tell me if its possible to make a piece of clothing have equip location of for example necklace, but protect otherpart of body?
Or is it tied to BodyLocation only?
Is there a performance friendly way to get a list of items the players has discovered or found in game?
I'm trying to improve performance of my Immarsive mode settings for my transmog mod
This is what I'm doing right now, but it's very expensive.
function ImmersiveMode.onRefreshContainer(invPane)
for _, container in pairs(invPane.itemindex) do
local item = container.items[1]
if container ~= nil and isTransmoggable(item) then
ImmersiveMode.getModData()[item:getScriptItem():getFullName()] = true
end
end
end
local old_ISInventoryPane_refreshContainer = ISInventoryPane.refreshContainer
function ISInventoryPane:refreshContainer()
local result = old_ISInventoryPane_refreshContainer(self)
if not SandboxVars.TransmogDE.ImmersiveModeToggle then
return result
end
ImmersiveMode.onRefreshContainer(self)
return result
end
return ImmersiveMode
I wonder if this would be more performance friendly ๐ค
function ImmersiveMode.onRefreshContainer(invPane)
local ImmersiveModeData = ImmersiveMode.getModData()
local lenght = #invPane.itemslist
for i = 1, lenght, 1 do
local item = invPane.itemslist[i].items[1]
if item ~= nil and isTransmoggable(item) then
ImmersiveModeData[item:getScriptItem():getFullName()] = true
end
end
end
I made a trait that lets you set every starting skill from -10 to 10
https://steamcommunity.com/sharedfiles/filedetails/?id=3061017102
Is there a way to randomize the sound between several different files for the same item/event? Like if you open a drink, how can you choose between a few different files to play randomly? I've made this work by duplicating the same item and assigning its sound to one of several different sound blocks, each tied to a different file. But then it always plays item1 before item2, even if the display name is the same and they stack as one
Im completely losing my mind, stopped playing PZ a few months ago, came back and forgot how to show back player & vehicles models in debug, anyone willing to help? lol
Do you have 3d models enabled?
Yes
I kinda remember it was the F1-F3 but it just changes the game speed
If you know exaactly which vehicle that is, try spawning it and seeing if you get errors to reference
found it! was a bunch of toggled stuff under F11 -> Options -> Model
Thanks anyway!
`
item AlcoholDragonBlood {
Type = Food,
DisplayName = Dragon Blood,
Icon = DragonBloodFull,
Weight = 0.4,
RainFactor = 0.1,
FatigueChange = 5,
HungerChange = 15,
ThirstChange = -5,
UnhappyChange = -5,
Calories = 1020,
Carbohydrates = 16,
Lipids = 0,
Proteins = 0.5,
StressChange = -15,
Alcoholic = true,
AlcoholPower = 1,
EatType = Mug,
StaticModel = AlcoholDragonBlood_Hand,
WorldStaticModel = AlcoholDragonBlood_Ground,
CustomEatSound = DrinkingFromBottleGlass,
CustomContextMenu = Drink,
UseWhileEquipped = FALSE,
ReplaceOnUse = SapphCooking.LowballGlass,
OnEat = OnEat_AlcoholDragonBlood
}
`
friends, I create drinks in a similar way, but some of them can still be drunk 1/2 and 1/4. I need the character to drink everything at once and in this particular example it works.
However, I canโt understand why it doesnโt work on others.
/* this mod required the SapphCooking mod but that's definitely not the reason
maybe it's because some drinks use fruit in their preparation?
Hi, I was developing a mod that makes Double Wired Fence gates virtually indestructible -by giving them a very high hp-. yet still thumpable. The mod works great, but when a double door is opened the hp values of the two central parts reset to the default 500 hp, whilst the ones on the sides remain the same without issue. I really have 0 clue about how to progress, it is my first mod and my first time programing with lua, so I came here to ask for some help ;). (I tried with setting a function that detects if gate:IsOpen(), but I didn't manage to get it working)
The issue seems to be somewhat related to the two central parts of the doors changing tiles.
@livid badger jsyk, for the future if you use three of the ` symbols, you have have a single large block of multi line code, which makes it easier to read/help.
Also I think I might know why it isnโt working as intended lol
Your last line doesnโt have a comma, which could be the reason
But also, if you make the item type drainable, and give it a use delta of 1, that should mean that after 1 use it is destroyed/replaced
Game can handle combo items, like drainable food, perfectly fine in the code
whoops
lol
i never thought about that when updating my mod lmfao
and this is especially more of an issue for them since the mod is about 6GB's
yep 6.2GB's
for those wondering why its so large, it's a collection of 882 songs that are within lore friendly release dates (1993 and older) and people can request songs so long as it fits the timeline. There were people requesting a singular song back to back so i ended up updating my mod every day or 2 and caused people to update their multiplayer server every time
steam would only download the new files, so it's only part your fault.
yea, just gotta update less regularily is all, simple fix
tell em to quit cryin and have their servers restart more often
its your mod you do what you want with it when you want with it
but it's not unreasonable to give a bit of feedback rather than dropping the mod entirely
Feedback is okay. Problem is when people assume the mod was made specifically for them and should only suit their needs.
For free ofc, god forbid you commission your own mod
Also. TIL item:getItemCapacity() will return as -1 instead of 0 for regular items.
Yes but also, it's nice if you can think about others as a modder, this change is so easy for them to do and changes nothing other then when the songs are added and update size
Up to whoever made it
I'm not gonna go around telling people "You should do X because of Y"
If they want to add a single song each time 24 hours per day, it's their mod
I do agree though, people need to stop TELLING people what to do and simply ask nicely, a little "you don't have to but it would be helpful" at the end is all you need
As I said, feedback is fine
But nobody has the right to outright demand things out of nowhere
Exactly yeah, just a simple "hey, would this be possible, if not all good" not a "do this"
This is unpaid, mostly unrecognized work. It's time effort and money we're putting on a project for free
Yep, if it's commissioned and you're paying for whatever it is, then say what you want but otherwise don't expect it, anyways we should prolly stop filling this chat up with this, have a good day man
Yes we must fill it with Braven's NPCs
Coming eventually โข๏ธ
Probably before B42. Maybe tomorrow.
Ayo? This real? I come home from visiting my girlfriend and her family tomorrow morning
lol
tbf again it was a 6.2GB mod so restarting the server would probably take much longer because of that so I understand their sentiment
especially if they'd have to do it every 2 days lol
again not a big deal tbh haha
just thought it was funny to see a string of messages out of nowhere haha
btw if yall have any songs you want aswell in the mod lmk
Why does zomboid do this, is there a work around for crappy lighting? or at the least does anyone know when it renders lighting for the models before placement?
If you donโt mind some ideas & stuffs- ๐ค
Do you allow mod packing? I know not everyone is a fan of it. ๐ฅธ But Iโm always a big advocate for making mods accessible for packs, that way servers can use them without worrying about any of your updates & it takes any of that responsibility off of you.
But also- if you like being able to add on regularly, but do care about packing/accidentally update spamming ๐ (it happens)- have you considered making a โnewโ branch mod, just a reupload of the current one but with the rider that you can/will update it as often/regularly as youโd like, and every so often just merge the branch into the main mod?
โโโ
Just a few ideas ๐๐ป you are, of course, free to do with your mod as you wish! haha
im not familiar with mod packing but i'm fine keeping it this way unless I stop updating it then i'd open source the mod for everyone to download at that point
Does anyone know a way to pull the name of the item itself. In the example below I want to test an item and return the "MyItem" name and not the display name. Example: item MyItem
{
DisplayName = Generic Name
}
getType()/getFullType()
You are a genius! Thank you!
firstly, if there are no other methods in the object after the petod, do not put a comma, this will not cause an error, secondly, drinable use only those items that can be filled with water and the character will automatically drink from the inventory, and thirdly, the problem was in hangrychange, if it the value is negative, then the item is used 1, 1/2, 1/4. but thanks for the help.
I've had issues when not adding last comma. You might want to reconsider this.
and why not put one? even if it does work there's no benefit
ok thx
listen, what parameter is responsible for the level of alcohol in the player? maybe you know?
MoodleType.Drunk, checks stats Drunkenness.
Adjusted by DrunkIncreaseValue, DrunkReductionValue from BodyDamage.
i guess something like this)
local charDrunkennes = character:getStats():getDrunkenness()
Any cluess? Maybe it is related to my mod altering health but not MaxHealth?
how to increase fire rate for firearm weapon?
As far as I know, when player opens double door (4 tile door), game internally removes two central door objects and makes new objects but does not copy the hp in this process.
Shit, that's what I thought was happening. I really don't know how to procede from here really
I thought about running a check when the door is opened/closed, but I really don't know how to program that
But I really don't get it: what the mod does is use the code from the Indestructible Door HP mod, it gives tiles a very high hp value. So whilst I understand that the central tiles disappear and appear, shouldn't the new tiles that generate have the new hp value too? I have already accounted for the 16 variables that double door tiles have, and if I unload and load a save the values go back to my mod settings. Any clues?
Yep
I just simply added the 16 variables of fenced doors to the list and added support for player built fences and double doors
The mod just modify the hp of doors when door added or its gridSquare loaded or player attacking door.
I know. To that I added that player built metal fences and Double doors also benefit from this -since by default, it was overridden by the metalworking skill-. What I am trying to find now is for a way to avoid the hp of the central parts resetting to the default values when opening/closing. That wasn't an issue on the original mod since by default it only has 1 tiled doors
And this works both ways, so if you damage the central part and open the gate that part goes back to 100 hp (deffault vanilla). Is a bit weird NGL
It's not weird. It's normal.
I know it is intended behavior, but it's weird in a non programming sense. And it is weird that detects newly placed and generated tiles but not the ones spawned by a door opening/closing.
Yeah, vanilla zomboid is quite weird in some parts.. lol
I wonder why they do not copy the hp when open/close double door while they even copy the modDatas.
I just tried to change the setMaxHealth direclty on directly on the game files and this is more puzzling even: the closed door has this new max value, but when you open it the central tiles go back to the default 500 hp. From where is the game getting that 500 value?
The default max hp value of IsoThumpable/IsoDoor object is 500.
whre is that value stored?
It's coded in java. Just default value of those object.
Check zombie\iso\objects\IsoThumpable or IsoDoor
Thnks
Do you think that a proper solution could be checking if the door is being hit and if yes then apply the max value to it?
But now that I think about that, player placed double fence gates store the hp that is given to them when placed, since their hp varies depending on your MW skills. So the game actually has some way to stroe that info no?
Nope. Object added w/ hp 500 and then it modified by lua code.
Can you explain pls ๐
Check vanilla codes in server\BuildingObjects\
For example, when player is creating a wooden wall, game makes new IsoThumpable object (max health 500) and then modify its max hp depending on players carpentry lvl.
The point is, you can't change that value '500'. You should find the way to change max hp after it is created.
I know that, the thing is, after doing this the game will give, lets say 800 hp to all parts of a door. Then, when you open that door all tiles still have 800 hp. What is the game doing here that allows it to store that info?
That's what I need for my mod
I don't get what you're talking about. If you open/close the double door, the max hp of central parts will be 500.
If you build it no, since your metalworking skill affects hp, so if you create a door with 800 hp it will remain at that hp level even if you open and close it
Or if it has less than 500 it will also stay at that lower threshold
Nope, in vanilla zomboid, max hp of central parts of double fence gate set to 500 after opening it once.
Then what's the point of metalworking affecting it xD. This game is weird some times hahahah. Thnks anyway ๐
1 2 3 4 -> 1 4
2 3
Image the double door like this.
Set max hp of all 4 parts to 800 depends on player's mw lvl.
If you open it once, only 1, 4 parts remain 800 hp.
max hp of 2, 3 parts will be 500 after opening it once.
Yeah, you are right, then again this seems like an oversight by the devs.
Will SetMaxHealth help?
The thing you have to do is find the way to apply that setMaxHealth func to part 2, 3 of door when it opening/closing.
Idk why, but when I use SetHealth there are no issues, the game sets the health value to, for example: 50000/100, but the SetMaxHealth command prompts an error in the console.
@fast galleon are you the same Poltergeist I spoke to in the comments on my Jack of all Traits mod? Am still confused what you thought the mod trait would do based on the description
It seems to say it would set the skills to a specific level after character creation. Which sounded very weird, since it had negative levels.
Jack Of All Traits is a customizable RP trait allowing full control over starting skill levels.
Full control over starting skill level.
To be fair it does let you do that. It's a trait so you still have to weigh it against other traits but by getting -10 to 10 you can ensure every skill is exactly the level you want at spawn.
I get what you're saying though but they are only starting skills
assuming you know math and pick matching traits
It just sounded weird to me. I understand what you mean.
Does anyone know a variable that detects when a Thumpable is hit by a ZOMBIE?
I used OnWeaponHitThumpable, but it only detects player attacks
This is the code (mostly taken from the Automatic Gate mod with his authorization: (It works when I hit the object, but not with zombies)
local function OnWeaponHitThumpable(Character, Weapon, Object)
local gate
local gateName
for i = 1, #objects do
local name = tostring(objects[i]:getName())
if (instanceof(objects[i], "IsoThumpable")) and
((name == "Double Door") or (name == "Double Metal Pole Gate") or (name == "Double Metal Wire Gate")) and IndestructableDoorList[spr:getName()]
then
gate = objects[i]
gateName = name
break
end
end
if gate then
doDoorHp(sq)
end
end
If you can think of a better way to get the idea across I'm all open. I am not good at dumbing stuff down for the average user lol
detecting zombie attacks is frustratingly impossible
there isn't even an event for *players* getting hit by zombies, let alone objects
Shit
there is an event for when a thumpable breaks if that works for your uses
Is there an event for where a thumpable is damaged? Regardless of how?
nope
Maybe I will now need to program an event to "secure" the door instead
But that is way too complex compared to what I wanted to do hahaha
i think if you make it a global object you can catch whenever it updates which should include when it takes damage, but it's not really worth it
i could be wrong though, i haven't looked at global objects in a while
I don't know... how about
Jack Of All Traits is a fully customizable RP trait that let's you set any skill boost level from X to Y.
ask chatgpg to make it nicer, more concise?
I think you could also increase the min, max values.
Not bad. I think setting to more than +10 might confuse people more in the same direction it confused you? You can't start with more than 10 in anything and if people are using this trait I assume they can get where they need. You can start with 10 in everything with only this trait, or 5 in one skill. If you still need extra points from taking like underweight then using the mod to cancel out the negatives, then you may as well commit to cheating and let the trait give you points
Guys, is it possible at the last stage of plant growth (avocado tree, apple, etc.) when the plant is already dying, convert it into a tree object so that the character can chop it with an axe?
and it often happens that plants in the game rot. Who can tell me how to realize the possibility of collecting humus from rotten plants. I think that we need to somehow reduce the functionality of a composter with a 7+ plant phase.
If I wanted to add more shouts instead of the typical 3 for both loud and quiet, do I need to make a mod or can I just simply edit to add in additional numbers?
It seems to me that it would be safer to do everything using a mod, because if you change the game files, you will have problems when trying to play online)
If it's just through the translation text doc and you host, would this be an issue if it wasn't a mod?
yes, the entire media folder gets checksummed so any mismatch will stop people from joining you
Strange. I edited my files and people can join just fine.
i think you'd need to change the lua to count the extra shouts anyway
if you have the checksum off it doesn't matter
though you won't be able to join servers with the checksum on
Is the checksum a value under the same file?
the checksum is a method the game uses to make sure everyone playing on the server has the same files
it can be turned off in the server settings
translation files really shouldn't be checksummed but i was under the impression they are, if it's worked for you in the past maybe they aren't
Where can this be located inside the settings? Do you know?
Nevermind. Found it.
Is the checksum value like a form of anti-cheat?
yeah
Okay fair.
if you turn it off anyone can run whatever code they want
Then yeah, mine is set to true, but I can use my shouts just fine.
I've had custom shouts for a long while and people could read them
i think you will need to edit the lua to add more which is definitely checksummed
yeah
thanks for letting me know translation isn't checksummed ^^
Pulling info out of items in an inventory- wondering if anyone has some advice on how to do it efficiently.
The items in the inventory have multiple mod data variables that I want to to find the cumulative amount of each.
So like- each item will have variables like:
mustard = 10,
ketchup = 1,
relish = 5,
My initial idea was to just iterate my way through the inventory, and then add each itemโs value to a local variable respective to each thing Iโm tracking.
Ideally- I wouldnโt need to have every single one of the variables defined on any given item. As in, if I wanted something to have a mustard = 0, I just wouldnโt have to include it into that items script at all.
This is also going on an โOnCreateโ function, so I know it doesnโt need to be 100% perfectly optimized, but I would still like to handle it in a decent way
local mustard = item:getModData().Mustard or 0
though i'm personally of the opinion that storing values that don't change as item moddata is prone to issues
Yeah, you did mention that before. The idea for this mod is that the player is going to be using a set of items to craft something, with the output modulated based on those variables on the items used for crafting.
What would be better, in your opinion?
Like, how should I go about tracking that info for those items*
just something like
-- i recommend making this part of your module if you're writing modularly, but here it'll just be local
local itemMustard = {
["Module.Item1"] = 10,
["Module.Item2"] = 15,
}
-- then when you actually want to find an item's mustard
local mustard = itemMustard[item:getFullType()] or 0
is there a way to view current foraging loot table in game without having to forage for hours?
something broke my foraging table loot inserts and i dont know what
Hi guys, i made some modifications to STALKER Armor Pack so i know how to edit a mod but i want to create one (because i love this game) i don't know how to create one so i need your help.
I tried to see if ChatGPT helps me in this task but as it says "it's an ambicious project": I'm trying to do Automatic Building, it's ambicious for me because this mod detects the container with the resources and later builds the structure (log walls for example) i don't know if this is possible but it's a QOL for a lot of people, if you can help me to understand if i can make it or i give you the inspiration to create this mod, let me know
Is there a simple place I can find all the ranges of bordeom, unhappyness, stress, panic, fatigue, pain, ect?
(Also why is Unhappyness with a y in the code
)
something like this?
result:setBaseHunger(item:getBaseHunger()); result:setHungChange(item:getHungChange()); result:setThirstChange(item:getThirstChangeUnmodified()); result:setBoredomChange(item:getBoredomChangeUnmodified()); result:setUnhappyChange(item:getUnhappyChangeUnmodified()); result:setCarbohydrates(item:getCarbohydrates()); result:setLipids(item:getLipids()); result:setProteins(item:getProteins()); result:setCalories(item:getCalories());
search on main lua code something like player:getStats() or character:getStats()
Maybe?
Trying to modifying an old abandoned mod for true music mood adjustment. Figuring out how to balance it so I'm wondering what the actual min-max ranges of the values are.
Which one?
Oh hi
Yeah, yours lol. Assumed it's abandoned
Adding in modifiers for Panic/Fatigue/Pain
It's 0-1 or 0-100 mostly.
Painful it's not properly documented anywhere 
I think somebody posted a table with this but I can't find it.
Try dragging the sliders in the debug menu.
Oh! Ended up on the wiki and there's a handy table right there
https://pzwiki.net/wiki/Debug_mode
yippie
Pain Slider that affects the pain moodle, decreases to 0 naturally. Cannot be adjusted manually
Darn
Is there any way to only target loot for farms or rural areas? For example, I want to make a cattle prod that only spawns outside of cities
I suppose I could manually spawn it
Why does the ISWorldObjectContextMenu.doSleepOption function only work in single player? How to change the context menu in multiplayer?
Anybody know how to fetch the ammo clip / magazine of a weapon item?
item:getClip() is returning nil for me on an M9 pistol (vanilla)
I know there is getBestMagazine but that is a very odd name and I've no idea what it's supposed to do
How are you calling it?
Calling the original function from the client
local originalSleepOption = ISWorldObjectContextMenu.doSleepOption
function ISWorldObjectContextMenu.doSleepOption(context, bed, player, playerObj)
-- Avoid player sleeping inside a car from the context menu, new radial menu does that now
if(playerObj:getVehicle() ~= nil) then return end
if(bed and bed:getSquare():getRoom() ~= playerObj:getSquare():getRoom()) then return end
local text = getText(bed and "ContextMenu_Sleep" or "ContextMenu_SleepOnGround")
local sleepOption = context:addOption(text, bed, ISWorldObjectContextMenu.onSleep, player);
local tooltipText = nil
local sleepNeeded = not isClient() or getServerOptions():getBoolean("SleepNeeded")
print(sleepNeeded)
if sleepNeeded and playerObj:getStats():getFatigue() <= 0.3 then
sleepOption.notAvailable = true;
tooltipText = getText("IGUI_Sleep_NotTiredEnough");
end
local player = getPlayer()
if player:HasTrait("Agonosomnia") then
sleepOption.notAvailable = false;
tooltipText = getText("ContextMenu_AgonosomniaSleep");
else
end
if bed then
local bedType = bed:getProperties():Val("BedType") or "averageBed";
local bedTypeXln = getTextOrNull("Tooltip_BedType_" .. bedType)
if bedTypeXln then
if tooltipText then
tooltipText = tooltipText .. " <BR> " .. getText("Tooltip_BedType", bedTypeXln)
else
tooltipText = getText("Tooltip_BedType", bedTypeXln)
end
end
end
if tooltipText then
local sleepTooltip = ISWorldObjectContextMenu.addToolTip();
sleepTooltip:setName(getText("ContextMenu_Sleeping"));
sleepTooltip.description = tooltipText;
sleepOption.toolTip = sleepTooltip;
end
end
Hmm.. and player is not nil and executed code is in the client folder?
is sleep enabled on the server?
Yes enabled
Oh!
Is print(sleepNeeded) being called? cause I'm curious about the load order for menu creation
In multiplayer it is not displayed in the console but in single player it is written - true
I found what the mistake was. When checking for a player's trait, I have player instead of playerObj
local player = getPlayer()
if player:HasTrait("Agonosomnia") then
sleepOption.notAvailable = false;
tooltipText = getText("ContextMenu_AgonosomniaSleep");
else
end
replaced it with playerObj and now it work
if playerObj:HasTrait("Agonosomnia") then
sleepOption.notAvailable = false;
tooltipText = getText("ContextMenu_AgonosomniaSleep");
else
end
weird, i noticed that but it shouldn't've stopped it from working (getPlayer() should still get you the player object), didn't want to be pedantic
Thanks for the help everyone
I would like to start messing with modding again, but it's been a while..
if you want to find and alter the code of an existing item or function, do you have to unpack the code from the game files?
For me mod code is in C:\Program Files (x86)\Steam\steamapps\workshop\content\108600 and then I usually search for the first word of the mod name after I subscribe. Object/item code is in Scripts code code is in lua iirc
Oh, I'd rather go from scratch.. I can't find anything on the workshop that would help me make the mod I've got my mind set on
Oh zomboid lua code is in C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media unpacked, items are in scripts
Aah! Thank you!
Guys, is it possible at the last stage of plant growth (avocado tree, apple, etc.) when the plant is already dying, convert it into a tree object so that the character can chop it with an axe?
and it often happens that plants in the game rot. Who can tell me how to realize the possibility of collecting humus from rotten plants. I think that we need to somehow reduce the functionality of a composter with a 7+ plant phase.
@livid badger SFarming has its own discord, can't post the direct link but it's in the description: https://steamcommunity.com/sharedfiles/filedetails/?id=1915420850
https://zomboid-javadoc.com/41.78/zombie/characters/IsoGameCharacter.html#HasTrait(java.lang.String)
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, class: IsoGameCharacter
random page but most are in the site ig
Oh, thank you!
in that mode plants converted to tree object? rly?))) i guess not
Is this where I would find the wear function?
I'd like to be able to phantom-wear all the containers, don't care if they render on the player, I just want access to the containers without having to equip them in my hands
aa I dont know you gotta search :p
someone might
quickest way is to find a mod that does or includes the stuff you want to
thats how I find the functions I need most of the time
sometimes cant and ask it here which someone responds time to time
maybe you can add the containers to array here https://zomboid-javadoc.com/41.78/zombie/characters/IsoGameCharacter.html#bagsWorn
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, class: IsoGameCharacter
idk
