#mod_development

1 messages ยท Page 203 of 1

bronze yoke
#

keep in mind that as with most things it's heavily tied to animations

#

so it's more accurate to say it influences the rof than it is the rof

keen silo
#

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?

bronze yoke
#

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

mellow frigate
#

@ albion, that's the curse of the good tech-lead. Meanwhile, what color of T-shirt should I wear tomorrow ?

mellow frigate
sand saddle
#

alternatively the second mod could just be the xml edits. "if you want looped enable this too"

undone crag
#

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.

nocturne swift
#

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

bronze yoke
#

if there's no note it fires on both

autumn temple
#

That sounds like it would cause lag

#

But I could probably make it work with fewer than 10 models

small topaz
#

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.

bronze yoke
#

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

autumn temple
#

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

bronze yoke
#

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

autumn temple
#

Ye, when I get home I will look at doing it

small topaz
autumn temple
#

I should still have the blender file. Might have lost it when cleaning my PC, so I would probably have to remake it lol

small topaz
#

@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....

autumn temple
#

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

small topaz
#

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).

autumn temple
#

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

small topaz
#

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

autumn temple
#

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

small topaz
autumn temple
#

Ye I will have to do some research and experimenting when I get home

small topaz
#

good luck!

undone crag
#

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.

small topaz
#

@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.

bronze yoke
#

ontick isn't tied to game speed

undone crag
#

Also there's _ get delta time _ which is what fraction of a second passed between two updates or something like that

small topaz
# bronze yoke ontick isn't tied to game speed

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.

bronze yoke
#

i've never used that function, i would speculate from it returning an int that it returns the in-game speedup setting state

small topaz
#

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
undone crag
#

I think getGameSpeed probably returns things like, pause, normal speed, x2, x4 sort of thing

autumn temple
#

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

small topaz
undone crag
#

Oops someone already answered :d

autumn temple
#

Ah

bronze yoke
#

player update is called for each player each tick

autumn temple
#

Ok so I will just try ontick

undone crag
#

y tho

small topaz
#

@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().

autumn temple
#

Hm yeah I will try to implement that to make the weapon look better at differing game speeds

small topaz
#

ya... but as said above, just a hint to keep in mind for later polishing...

autumn temple
#

Yeah I will

bronze yoke
#

it would be optimal to use a delta since otherwise it'll spin at different speeds at different framerates

keen silo
#

however, I would like to have some help with menus and stuff

undone crag
#

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.

outer crypt
#

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,
}

outer crypt
undone crag
#

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.

outer crypt
autumn temple
#

i cant seem to figure out how to use deltatime in the context of project zomboid LappDumb

bronze yoke
#

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

autumn temple
#

i can barely understand normal language, let alone confusing language

bronze yoke
#

there was a time i knew what they each were, and i was hoping to document them, but that time has passed unhappy

autumn temple
#

though its probably the game itself preventing it, like how it requires a game restart to see some model changes

bronze yoke
#

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

autumn temple
#

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.

sand saddle
autumn temple
#

deadge curse these hardcoded limitations

sand saddle
#

tough said problem is stats and name not sprites. its still a simple crowbar after all.

autumn temple
#

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

sand saddle
#

since its limited to being equiped i suggest you change ontick to OnEquipPrimary / OnEquipSecondary

autumn temple
#

but even then the updating seems to not happen consistently

#

since im testing with a 2h weapon i will try as primary

autumn temple
#

never reverts back to Hecaton or the TestAxe sprite

sand saddle
#

a index starts with 0

#

the first entry in a list is entry 0

#

so: current sprite index = 0;

bronze yoke
#

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

sand saddle
#

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

autumn temple
sand saddle
#

its for in the "if weapon then" part also.. do not copy paste wasnt writing it down correctly.

autumn temple
#

o

sand saddle
#

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"

autumn temple
#

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

sand saddle
#

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.

autumn temple
#

alright. thanks for the help in all this. its super confusing

#

im gonna go to bed and look at the trait when i can

sand saddle
#

thats how i learned coding and how to make my own mods : look how other people done it. implement my own version.

autumn temple
#

ye ive been slowly learning the same way but i never have a lot of free time to just sit down and read.

sand saddle
#

well im off as well ๐Ÿ™‚ have a good nights sleep!

autumn temple
#

likewise

quartz holly
#

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

gilded hawk
#

Thank you!

small topaz
#

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

autumn temple
undone crag
autumn temple
#

Maybe

small topaz
# autumn temple I did try every minute. The video I posted was actually using everyminute

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)

undone crag
#

duckling wants the item to remain the same one but just change model though? ?_?

autumn temple
#

the weaponsprite is essentially changing the model anyways isnt it

undone crag
#

Originally the game used 2d pictures, before the change to 3d models, but it still calls it a sprite.

small topaz
# undone crag duckling wants the item to remain the same one but just change model though? ?_?

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

autumn temple
#

changing the actual item if your hands might fuck up the combat. since its a melee weapon youre actively swinging

autumn temple
undone crag
#

Yes.

autumn temple
#

swapping out clothing models isnt an issue with your method, but weapons most likely wont work

small topaz
autumn temple
#

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

undone crag
#

Maybe you need to do resetEquippedHandsModels on the player.

fast galleon
#

Sorry to bug in, the game has animation overrides for hand items.

small topaz
autumn temple
#

Even if the swapping pauses during the animations that's fine. They're not that long

autumn temple
fast galleon
#

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.

undone crag
#

Yeah maybe you need to do resetEquippedHandsModels on the player.

gritty acorn
#

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

autumn temple
#

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

formal rain
#

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?

brave ruin
#

Can I comment something beside a value so that I know what the original was?

#

Like
ScratchDefense = 50, #70

gritty acorn
#

plz help

verbal yew
autumn temple
brave ruin
gilded hawk
#

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

gilded hawk
autumn temple
#

oh then i have no idea

gilded hawk
#

I would be okay with the customs one too, cause why not

verbal yew
gilded hawk
#

@verbal yew If I recall correctly you made some nice tooltips for the armor absorbion, do you mind sharing the code for it?

gilded hawk
# verbal yew

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]

verbal yew
#

you mean icon with desc in tooltip?

gilded hawk
gilded hawk
verbal yew
gilded hawk
# verbal yew ouch

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!

undone crag
small topaz
gilded hawk
# verbal yew

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.

gilded hawk
undone crag
gilded hawk
# small topaz yep

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!

undone crag
#

'resetweaponsprite' probably would remove any change you've made to the model sprite by switching it back to the default.

autumn temple
undone crag
#

You could add a print to it to see if it actually does run

autumn temple
#

cuz without the reset i made the model only changed once per animation, but with it. it changed twice

undone crag
#

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.

small topaz
autumn temple
bronze yoke
#

btw please localise your function, onUpdate is a very likely name clash

autumn temple
#

anon that actually fixed it

verbal yew
#

Garden sawblade

#

MOTSHTSHOHOHOHOHOH

#

DAMN

autumn temple
#

you guys have been a huge help thanks

small topaz
#

awesome btw

undone crag
#

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.

autumn temple
#

ya i was using ontick for trying to get it to work. but i might switch it to deltatime since it should perform better

bronze yoke
#

if you're going to write a module make it local too

#

no reason to go only half way

undone crag
#

Nuu I demand access to your mod's code by means of a global table in case it clashes with mine!1111

bronze yoke
#

by using modules properly you can ensure the only possible clash is file path clashes

gilded hawk
autumn temple
undone crag
#

Is a module a Lua file that you import into local namespace with 'require'?

bronze yoke
#

yeah

undone crag
#

o:

bronze yoke
#

you avoid the global namespace entirely while still leaving it open for other mods

undone crag
#

plz teach me this

autumn temple
#

but ive just used random weapons models, i will later make a bunch of models of the same weapon to make it seem animated

autumn temple
#

before optimizing the code, im going to do a performance test

undone crag
#

Unless I misunderstood you and you just meant the timing and you're switching timing from one to another

autumn temple
#

but i dont seem to have any frame loss with just this mod

undone crag
#

Not wanting frame loss may be a good reason not to use deltatime. so it looks nice. yes.

bronze yoke
#

wanting it to look nice is a reason to use delta time ๐Ÿ˜…

undone crag
#

Though its speed may seem to change when you have laggy frames

bronze yoke
#

if you use ontick but don't use delta time its speed will be different on different hardware and when the game lags

bronze yoke
# undone crag plz teach me this
-- shared/myModule.lua
local myModule = {}

myModule.foo = function()
    print("bar")
end

return myModule

-- some other file
local myModule = require "myModule"
myModule.foo() -- prints "bar"
autumn temple
#

the games not hard to run but with heavily modded playthroughs it could probably get laggy

#

so its just insurance

bronze yoke
#

think of weaker computers that can't run the game at 60 to begin with

undone crag
#

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.

bronze yoke
#

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

undone crag
small topaz
#

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?

bronze yoke
#

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

undone crag
#

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

bronze yoke
#

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

bronze yoke
gilded hawk
#

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'?

bronze yoke
#

yeah, it's always the absolute path

gilded hawk
#

Okay, interestig, cause my vscode is not happy about it ๐Ÿค”

#

it only shows me require('Transmog.Utils')

bronze yoke
#

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

gilded hawk
#

Okay, so, if I'm doing all of this, just in the client folder, I should be fine, right?

bronze yoke
#

yeah, don't have to worry about it if you stay in one folder

gilded hawk
#

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 ๐Ÿ˜ฆ

bronze yoke
#

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

gilded hawk
#

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

bronze yoke
#

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

gilded hawk
#

Yeah, that would not work. Well, thank you anyway!

bronze yoke
#

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

gilded hawk
#

Oh dear, circular dependecies also in pz ๐Ÿ˜ฆ

gilded hawk
bronze yoke
#

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

gilded hawk
#

How do you delay a require?

bronze yoke
#

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

fast galleon
sand saddle
# autumn temple

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.

bronze yoke
#

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

gilded hawk
gilded hawk
autumn temple
gilded hawk
#

@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

sand saddle
#

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?

gilded hawk
#

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)
sand saddle
#

seems fish are not included into getScriptManager():getAllItems();

fast galleon
#

Food weight - hunger change would also be used for recipes.

bronze yoke
#

yeah, your mod edits the item scripts but most kinds of caught/farmed food don't use their script weight

sand saddle
rose turret
#

Wrong discord modding channel - my bad ๐Ÿ˜„

sand saddle
#

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..

bronze yoke
#

fish should have an OnCreate function in their item script

#

look for that function, that's what assigns their weight

bronze yoke
sand saddle
#

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.

bronze yoke
#

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

sand saddle
#

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...

drifting ore
#

how do i stop steam from removing links from my mod workshop page

#

๐Ÿ˜”

bronze yoke
sand saddle
#

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() )

drifting ore
#

doesnt even let me edit it out

sand saddle
drifting ore
#

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

verbal yew
#

i have this problem 2 weeks when im try put link on boosty
And only after ticket in support it's been complete verify

drifting ore
#

is it literally just a ticket

#

or is there like a specific support ticket area for workshop shit

verbal yew
drifting ore
#

alr

#

i'll give it a bit of time then if nothing happens i'll submit a ticket

sand saddle
#

and with the fish fix my little lua weight adjuster blew up from 32 to 110 lines of lua ;P

sand saddle
#

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.

verbal yew
#

Phah... what a funny fishing script...

sand saddle
#

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.

verbal yew
sand saddle
#

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.

mellow frigate
sand saddle
#

prolly need to repeat that setup later for farmed eggs and ham because farm animals ;P

hollow current
#

any idea how I can get all nearby squares (or squares in radius x), in proportion to a square object?

feral crane
#

how do I grab the player characters name?

small topaz
mellow frigate
sand saddle
#

im getting stacktrace bashed for trying to use "item:getFullName()" and i dont know why.

hollow current
sand saddle
#

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

hollow current
sand saddle
#

trying that right now.

feral crane
#

how do I add IsoPlayer to OnGameStart?

sand saddle
#

ok i give up. i cant find what im doing wrong.

verbal yew
#

how i can get type weapon on event Events.OnWeaponHitCharacter.Add?

#

and damage in script

undone crag
sand saddle
#

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...

verbal yew
#

but i cant understand how to exclude handWeapon on melee weapon or firearm

#

or category or twohands onehands

undone crag
#

:d

#
instanceof(item, "HandWeapon")
#

That's one at least

bronze yoke
#

that event always passes a HandWeapon, you can't attack with anything else

potent flicker
#

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?

undone crag
#

There's item.isRequiresEquippedBothHands() in the list of functions for an inventory item

verbal yew
#
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
verbal yew
#

okay, isRanged - bad for firearm weapon...
it's should be getSubCategory() == Firearm

undone crag
#

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.

fast galleon
fast galleon
#
---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
sand saddle
#

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.

sand saddle
#

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

verbal yew
#

item:setCustomWeight(true); ?!

sand saddle
#

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

verbal yew
#

it's possible to get clothes from living zombies?

#

like bulletproof vest?

verbal yew
sand saddle
#

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" ....

verbal yew
#

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```
sand saddle
#

you know to make sure its still compatible when the devs or another mod rewrites fishing.

#

all i want to touch is the weight

median mantle
#

@sand saddle Did you also modify ISFishingAction:createFish function?

sand saddle
#

also where is that function

median mantle
#

If you want to modify the weight of fish that is caught by fishing, you should modify that function.

#

client\Fishing\TimedActions\ISFishingAction.lua

livid badger
#

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.

sand saddle
verbal yew
#

Category:MyCategory,

#

in recipe

#

script

livid badger
#

recipe Make An Alcohol Crying Dragon
{
/* res needed */

    Result : get this item,
    Time : 80.0,
    Category : MyCategory,
}
#

like this?

verbal yew
#

yep

livid badger
#

i tryed kile that but it dont show on game, maybe need delete old save and create new world?))

#

thx for answer!

verbal yew
#

i think problem in other

#

look like u use specific Module without import base

livid badger
#

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)))

verbal yew
#
IGUI_EN = {
    IGUI_CraftCategory_MyCategory = "My Name",
}
livid badger
#

you are my hero today

verbal yew
#

when i'm tried fix all issue in original Better Lockpicking

pulsar niche
#

We have a bow and crossbow mod.

I would also love to see a slingshot mod!

sand saddle
pulsar niche
#

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).

pliant mortar
#

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?

grizzled fable
#

do i need permission to write and publish a patch of another mod??

rich void
#

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 ๐Ÿ‘

tranquil kindle
pliant mortar
foggy finch
#

Hey guys, how do i get acces to the admin account on a server that i host for debbuging my mod

undone crag
pliant mortar
pliant mortar
undone crag
#

:o oh ok

undone crag
#

Are the models themselves not visible or is it just a problem with when they are attachments?

pliant mortar
#

Its got it on there but you still cant see it

livid badger
#

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))

jolly goblet
#

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.

undone crag
#

Can you just not see them because of a problem specific to using the models for attachments?

pliant mortar
undone crag
#

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?

undone crag
#

Or beaver butt derivative, whichever.

undone crag
pliant mortar
#

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

undone crag
pliant mortar
#

ah. Yeah that went way over my head. beaver butt vanilla. gotcha

undone crag
#

Gib .txt specifics for models and weapons and attachments plz ;-;

livid badger
#

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? ))๐Ÿ˜‚

undone crag
#

It not possibln't

foggy finch
#

help "./ProjectZomboid64: error while loading shared libraries: libsteam_api.so: cannot open shared object file: No such file or directory
"

gilded hawk
#

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 ๐Ÿ˜ฆ

livid badger
undone crag
#

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

livid badger
undone crag
#

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.

pastel raptor
#

yooo guys is anybody available in developing a mod for a server? It's a paid job รจ_รฉ โค๏ธ

tranquil kindle
tranquil kindle
formal rain
#

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?

livid badger
#

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?

wise spire
zenith igloo
#

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

wise spire
zenith igloo
#

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

wise spire
#

it should still call the perk list though

zenith igloo
#

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

wise spire
#

my buddy is working on adding loading bars that update with time i'll check with him when he gets on and get back

zenith igloo
#

eh sure thanks

bronze yoke
#

this is intended behaviour, you can edit the player's xp boost map directly

zenith igloo
#

how can I reach it?

bronze yoke
#

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)

zenith igloo
#

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

bronze yoke
#

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

zenith igloo
#

thank you a lot.

#

โค๏ธ

zenith igloo
#

errors sighs

zenith igloo
#

there is already a mod for that ig

wise tide
#

Need help, blood and dirt removes texture from my clothes. where should I fix?

small topaz
#

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). ...

median plover
#

Fascist groups that fought with Germany are a little different than most other political parties

small topaz
#

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.

sonic osprey
#

I don't know where else I can get help with the code

median plover
#

Then make a less political mod to test it with

undone crag
#

Is an underdog getting some flak well then just let me help with the mod ):D

small topaz
median plover
#

Idk that I'd call a fascist an underdog but that's just me

sonic osprey
undone crag
#

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

median plover
#

My brother in christ it's literally the dudes who supported Franco in World War 2

sonic osprey
#

Que pesado el notas

sonic osprey
undone crag
#

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?

sonic osprey
#

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

median plover
#

I don't want to get too into it, but they were literal fascists. Not appropriate all the same.

sonic osprey
#

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

undone crag
#

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.)

sonic osprey
median plover
#

You could say the same about my country's ku klux Klan. Still not appropriate even as a joke

undone crag
#

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)
sonic osprey
undone crag
#

You could print something, with code like print("clothingItem Camiseta Falange", clothingItem ) and it may print nil.

sonic osprey
undone crag
#

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

sonic osprey
#

LMAO

sonic osprey
#

I will try it later then, I'm not in PC rn

#

I mean

#

In 5 min

undone crag
#

I'm not sure I remember what the .xml files are for. I'll check something.

small topaz
sonic osprey
#

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

undone crag
#

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.

sonic osprey
#

Oh yeah

#

Okay gonna try it now

bronze yoke
#

it doesn't matter, the game doesn't actually do anything with them

#

them being uuids is technically just a suggestion

sonic osprey
#

I really thought that was going to be the biggest problem lol

bronze yoke
#

i don't recommend breaking conventions but that technically shouldn't cause issues

sonic osprey
#

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

undone crag
#

:o a clue?

winter thunder
sonic osprey
sonic osprey
undone crag
#

Maybe it's because of the name field here
<m_MaleOutfits>
<m_Name>FALANGE</m_Name>

sonic osprey
#

maybe

#

I mean yea

undone crag
#

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?

drifting ore
#

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

winter thunder
#

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:

  1. On creating the container, mess with the setOnlyAcceptCategory function. Assumes that the InventoryContainer and ItemContainer classes are interfaceable. (which I am pretty sure they are)
  2. Use an OnTest function 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.

bronze yoke
#

yeah, should work

winter thunder
bronze yoke
#

i can't find the exact method right now but i can tell you something to watch out for

small topaz
bronze yoke
#

with traits different players have different capacities

small topaz
#

btw... not all methods are relevant but maybe getCountType(...) looks already good...?

winter thunder
small topaz
bronze yoke
#

what if they can't put 10 items into the container?

winter thunder
frank elbow
#

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

bronze yoke
#

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

frank elbow
#

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

winter thunder
#

Ah, sorry- I'd ideally like the container to have a fixed size no matter the traits AND for it to be filled.

small topaz
#

assuming that you know a priori what the defaul max-capacity of your container is...

frank elbow
#

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

small topaz
#

brandon, is it a special container your mod introduced or a vanilla container in your case?

winter thunder
bronze yoke
#

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

winter thunder
#

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

bronze yoke
#

offhandedly i'd say the most likely thing is nothing and one is just an older name for backwards compatibility

random finch
#

Any idea why this would not work assuming attacker is valid?
Java

this.combatSpeed *= 1.1F;

Lua

attacker:setVariable("combatSpeed", attacker:calculateCombatSpeed() * 1.1)
winter thunder
random finch
#

it's in the java IsoGameCharacter

paper aurora
#

Is there a mod patch in development for making better masks compatible with the stalker armor pack?

random finch
winter thunder
#

Im ngl, I dont think I know the difference between the two

random finch
#

I dont either lol. I found the link to the one I use on the IndieStone website

winter thunder
random finch
#

You are right lol

#

This one at tells tells you the versioning

winter thunder
#

So uh

#

I think I figured it out

#

You wont be happy

random finch
#

shit

winter thunder
#

I was seeing that setVariable() is tied to animation. It is contained in the Package: zombie.core.skinnedmodel.advancedanimation...

#

And then I found this

#

Lmk when you see it...

random finch
#

Aside from just animations

#

I dont see it though

winter thunder
#

Look really close...

#

setVariable() vs SetVariable()...

random finch
#

(string, string)

#

What!? let me look again

#

Dammnit

winter thunder
#

It is a capital S.
They have two functions. setVariable() is for animations. SetVariable() is for this sorta interface...

random finch
#

so just need to use uppercase S

winter thunder
#

I presume

random finch
#

crazy man, you are right

#

That does annoy me

#

Ima let it rip, make sure thats the case

winter thunder
#

Alrighty, lemme know how that works out

#

This is painful

bronze yoke
bronze yoke
#

it seems like another difference i was unaware of is that the other doc won't hide inaccessible methods

random finch
#

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:

bronze yoke
#

encapsulation

random finch
#

Not sure what you mean by that but ill look it up

winter thunder
random finch
#

exactly what I did

#

Now Im trying to set and it errors

winter thunder
#

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

random finch
#
    local theCombatSpeed = attacker:GetVariable("combatSpeed")
    attacker:SetVariable("combatSpeed", theCombatSpeed * 1.1)
#

Probably erroring bc theCombatSpeed and 1.1 are not strings

winter thunder
#

Yeah, that makes sense

#

What is it you are trying to accomplish with this? Probably another way around it

bronze yoke
#

setVariable(String key, float value) should be happy with it

winter thunder
random finch
bronze yoke
#

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);
}

winter thunder
#

Alright, that is valid. I just wasnt sure

#

lmao

#

Alright

random finch
#

bruh

winter thunder
#

That is somehow arguably worse

#

Sorry for confusion, guess that the calc combat speed was the issue lmao

random finch
#

All good, at least I know about the setvariable variants now. Been messing with animations as well.

winter thunder
#

@random finch

random finch
#

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.

winter thunder
#

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

random finch
#

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.

bronze yoke
#

it might reset instantly, stuff like that is usually calculated every tick

north junco
#

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

bronze yoke
#

assuming you have an IsoPlayer object player,```lua
local bodyDamage = player:getBodyDamage()
bodyDamage:setBoredomLevel(bodyDamage:getBoredomLevel() - 10)

north junco
#

Thank you, I'll give it a shot ๐Ÿ™‚

winter thunder
#
local playerStats = getPlayer():getStats()
playerStats:setBoredom(playerStats:getBoredom() - 10)```
#

Wait...

#

๐Ÿ‘€

#

lmao

bronze yoke
#

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

winter thunder
#

That is really funny though, we had the exact same code typed up, I just used old method lmao

bronze yoke
#

finding that out post-release was a real embarrassment with statsapi ๐Ÿ˜…

north junco
#

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

winter thunder
#

@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...

north junco
#

There is an event that triggers when a recipe is created. As it triggers, I'd like a little sound to be played.

bronze yoke
#

you could also have an ontick listener that counts until a certain time if you want the effect to be time based

winter thunder
#

Yeah, that too haha

winter thunder
north junco
#

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.

winter thunder
#

Oh, cute! You could also have it play that for the actual recipe too

north junco
#

How could I do that?

winter thunder
#

In the script file for that recipe

#

You can set the sound a recipe makes

north junco
#

Cool! How do I do that?

winter thunder
#

Have you defined your sound in its own script?

north junco
#

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.

winter thunder
#

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

north junco
#

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

edgy cosmos
#

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?

winter thunder
edgy cosmos
#

it's right next to the other ones that do load

winter thunder
#

Is this a modification of the base filibusters mod? Like, tweaking on your end for rn

edgy cosmos
#

yep!

winter thunder
#

Cool. Did you modify the code while the game was still open?

edgy cosmos
#

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.

winter thunder
north junco
#

Thank you, that's a great template!

bronze yoke
#

you missed a closing bracket there

winter thunder
winter thunder
edgy cosmos
#

I didn't do that no - i just edited the already-existing 85vic file.

#

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 ๐Ÿ˜ญ

winter thunder
#

This is going to sound really dumb. But- I would try naming the png vehicle_85crownvicpd2camdenshell.png

edgy cosmos
#

i'll give that a shot!

winter thunder
#

dont forget to change the script file too :)

edgy cosmos
#

no dice, unfortunately

bronze yoke
#

are you in debug mode? some bit depths can't be loaded, but you'd see an error about that

north junco
random finch
winter thunder
# random finch Very interesting. I have yet to use ModData. Need to figure out its purpose and ...

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

wise tide
random finch
winter thunder
bronze yoke
#

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)

winter thunder
#

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||

bronze yoke
#

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

supple dirge
#

Hey sorry this probably isnโ€™t the place but people do commissioned mods on here right

mellow frigate
grizzled fable
#

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")

mellow frigate
livid badger
#

which method is responsible for the degree of intoxication of a character and how i can get it

tranquil kindle
#

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?

gilded hawk
#

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
gilded hawk
#

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
hallow hearth
hollow haven
# winter thunder In your sound script, you just have to set the name, and the clip(s). So ```lu...

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

worthy sparrow
#

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

worthy sparrow
#

I kinda remember it was the F1-F3 but it just changes the game speed

hollow haven
#

If you know exaactly which vehicle that is, try spawning it and seeing if you get errors to reference

worthy sparrow
livid badger
#

`
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?

daring zealot
#

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.

winter thunder
# livid badger ` item AlcoholDragonBlood { Type = Fo...

@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

sleek heath
#

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

fast galleon
#

steam would only download the new files, so it's only part your fault.

sleek heath
#

yea, just gotta update less regularily is all, simple fix

untold radish
#

its your mod you do what you want with it when you want with it

heady crystal
#

โ˜๏ธ

#

This x1000

#

Don't let them boss you around. Your mod your rules.

bronze yoke
#

but it's not unreasonable to give a bit of feedback rather than dropping the mod entirely

heady crystal
#

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.

gilded crescent
heady crystal
#

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

gilded crescent
#

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

heady crystal
#

As I said, feedback is fine

#

But nobody has the right to outright demand things out of nowhere

gilded crescent
#

Exactly yeah, just a simple "hey, would this be possible, if not all good" not a "do this"

heady crystal
#

This is unpaid, mostly unrecognized work. It's time effort and money we're putting on a project for free

gilded crescent
#

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

heady crystal
#

Yes we must fill it with Braven's NPCs

#

Coming eventually โ„ข๏ธ

#

Probably before B42. Maybe tomorrow.

gilded crescent
heady crystal
#

It waves!

#

I am the one in the bottom btw

gilded crescent
#

Oh hell yes

#

How are they compared to superb?

sleek heath
#

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

wise spire
#

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?

winter thunder
# sleek heath

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

sleek heath
#

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

outer crypt
#

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
}

bronze yoke
#

getType()/getFullType()

outer crypt
livid badger
#

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.

fast galleon
bronze yoke
#

and why not put one? even if it does work there's no benefit

livid badger
fast galleon
livid badger
daring zealot
verbal yew
#

how to increase fire rate for firearm weapon?

median mantle
daring zealot
#

I thought about running a check when the door is opened/closed, but I really don't know how to program that

daring zealot
# median mantle As far as I know, when player opens double door (4 tile door), game internally r...

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?

daring zealot
#

I just simply added the 16 variables of fenced doors to the list and added support for player built fences and double doors

median mantle
#

The mod just modify the hp of doors when door added or its gridSquare loaded or player attacking door.

daring zealot
#

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

median mantle
#

It's not weird. It's normal.

daring zealot
# median mantle 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.

median mantle
#

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.

daring zealot
#

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?

median mantle
daring zealot
median mantle
daring zealot
#

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?

daring zealot
median mantle
#

Nope. Object added w/ hp 500 and then it modified by lua code.

daring zealot
median mantle
#

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.

daring zealot
#

That's what I need for my mod

median mantle
#

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.

daring zealot
#

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

median mantle
daring zealot
median mantle
#

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.

daring zealot
#

Yeah, you are right, then again this seems like an oversight by the devs.

#

Will SetMaxHealth help?

median mantle
#

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.

daring zealot
#

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.

hallow hearth
#

@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

fast galleon
#

Jack Of All Traits is a customizable RP trait allowing full control over starting skill levels.
Full control over starting skill level.

hallow hearth
#

I get what you're saying though but they are only starting skills

fast galleon
#

It just sounded weird to me. I understand what you mean.

daring zealot
#

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

hallow hearth
bronze yoke
#

detecting zombie attacks is frustratingly impossible

#

there isn't even an event for *players* getting hit by zombies, let alone objects

daring zealot
#

Shit

bronze yoke
#

there is an event for when a thumpable breaks if that works for your uses

daring zealot
#

Is there an event for where a thumpable is damaged? Regardless of how?

bronze yoke
#

nope

daring zealot
#

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

bronze yoke
#

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

fast galleon
#

I think you could also increase the min, max values.

hallow hearth
#

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

livid badger
#

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.

low anvil
#

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?

livid badger
low anvil
bronze yoke
#

yes, the entire media folder gets checksummed so any mismatch will stop people from joining you

low anvil
#

Strange. I edited my files and people can join just fine.

bronze yoke
#

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

low anvil
#

Is the checksum a value under the same file?

bronze yoke
#

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

low anvil
#

Is the checksum value like a form of anti-cheat?

bronze yoke
#

yeah

low anvil
#

Okay fair.

bronze yoke
#

if you turn it off anyone can run whatever code they want

low anvil
#

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

bronze yoke
#

i think you will need to edit the lua to add more which is definitely checksummed

low anvil
#

Okay fair.

#

So in other words, if I add more slots to shouts, it becomes checksummed?

bronze yoke
#

yeah

low anvil
#

Damn. Thanks for the reply

#

Help was most useful

bronze yoke
#

thanks for letting me know translation isn't checksummed ^^

winter thunder
#

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

bronze yoke
#

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

winter thunder
#

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*

bronze yoke
#

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
formal rain
#

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

vague dragon
#

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

karmic wedge
#

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 Zeniiiiii)

livid badger
# karmic wedge (Also why is Unhappyness with a y in the code <a:Zeniiiiii:955792511799013406>)

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()

karmic wedge
#

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.

karmic wedge
#

Oh hi

#

Yeah, yours lol. Assumed it's abandoned

#

Adding in modifiers for Panic/Fatigue/Pain

fast galleon
#

It's 0-1 or 0-100 mostly.

karmic wedge
#

Painful it's not properly documented anywhere vrcTupCry

fast galleon
#

I think somebody posted a table with this but I can't find it.

#

Try dragging the sliders in the debug menu.

karmic wedge
#

yippie

#

Pain Slider that affects the pain moodle, decreases to 0 naturally. Cannot be adjusted manually
Darn

void cargo
#

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

lunar shore
#

Why does the ISWorldObjectContextMenu.doSleepOption function only work in single player? How to change the context menu in multiplayer?

heady crystal
#

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

lunar shore
#
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
void cargo
bronze yoke
#

is sleep enabled on the server?

lunar shore
#

Yes enabled

void cargo
void cargo
lunar shore
#

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
bronze yoke
#

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

lunar shore
#

Thanks for the help everyone

grim spindle
#

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?

void cargo
grim spindle
void cargo
livid badger
#

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.

void cargo
zenith igloo
#

random page but most are in the site ig

livid badger
grim spindle
zenith igloo
#

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

#

idk

grim spindle
#

hm, okay, thank you

#

Oh :v I will take a look!
(Sorry, it's been ages since I modded this game last, I've.. forgotten everything