#mod_development

1 messages ยท Page 77 of 1

fast galleon
#

no, thanks. I still wander what the control value should be. If you scroll up I used something like
max - current > 1E-7

finite owl
#

That works too, if you know that max is definitely always greater than current. The math.abs is just to ensure that it works when comparing it with a target value that it might be greater than or less than.

sour island
#

Poltergeist actually came up with the fix - seems as though it was triggering events with "no player" or the wrong "player".

fast galleon
#

I'll have that in mind, might need it at some point, now I just needed the greater than cases.

agile vigil
sour island
#

I also wasn't able to solve the TV issue - so I just locked it out behind a sandbox option

#

I wanted a way to prevent stacking of XP earned from the same shows - but it would require hard overwrites of a few files

plucky oxide
#

Hi everyone, does anyone know why when I change the description of my mod via steam, it changes the info on mouseover of the mod but not the description on the workshop page? Do I have to do it manually from my mod file?

ancient grail
#

U can change via steam page

sour island
#

There's two files - one for the workshop and one for the in-game mod. "Mods" can have as many "mods" as they want inside.

calm depot
#

a better way to express it is, you have a workshop item, which can contain one or more game mods

sour island
#

The outermost folder structure should be "workshop package" and you have all your mods in the WP's contents folder

#

Ye

#

Great minds and all that

hot patrol
sour island
#

Perhaps, but you'd still gain something from watching TV, dying, and watching it again

#

People were abusing the journal and dying on purpose

hot patrol
#

Yea but you won't gain on top of levels the journal gives you for free. It will just help build you back up

sour island
#

Yeah, it would be a nicer solution than having to force them to rewatch the TV shows

calm depot
#

at that point, couldn't you have the journal record the TV shows they watched

sour island
#

I tried that

#

Can't account for people watching them before reading the journals

calm depot
#

well, if they read it afterwards you can examine what shows they snuck in and apply a penalty for the ones that match

sour island
#

And the radio interaction stuff is all localized to the point where I'd need to rewrite it all

plucky oxide
#

Oh..my bad, I had modified the page for English readers and my workshop is set up for my native language. Thanks for the answers.

sour island
#

I was able to decorate addXP which let me at least identify what function was calling it

#

I don't think having it ignore TV XP is too bad for now

#

Kind of don't wanna touch the mod for a bit lol

#

My 5 comments a day has returned to 0 - which means the mod works

calm depot
#

YoUR mOd cRasHeD mY GaMe

sour island
#

I also made the mistake of making sandbox options apply retroactively

#

Fun fact: don't do that

#

Thought I was smart - as new sandbox options appear as nil - so I made it account for that and apply what I made default. When I should have made it so what ongoing players expected.

pulsar heath
#

at least you struggle with the complicated stuff... i struggle with everything in lua ๐Ÿ˜„

#

it was a victory when i managed to make a function that made the player char curse taking text from a randomline in a text a file

#

almost popped the bottle just to celebrate my victory

tough heron
#

Hi guys, new here. Does anyone know exactly how the item 'weight' calculation works in ProceduralDistributions.lua? I'm making a map based on Akihabara and I am wondering why my electronics stores basically never spawn video games from the Video Games Consoles mod. I had a look at his distributions.lua, and he has given everything weights of 0.04. This seems to spawn Video Games ok in houses, where for instance they are competing in LivingRoomShelf with loads of items, many of which have low weights. However, ElectronicStoreMisc or ElectronicStoreMusic never spawn them (in my rough 10-20 test runs) even though the mod adds them to these tables. These loot tables only have a few items and they have high weights, like 10 or 20. Does the number of items on a loot table affect how the 'weight' calculation works? Because it still seems odd that they spawn so frequently in houses in comparison, despite the weight being the same at 0.04.

fast galleon
faint jewel
#

so hey, anyone want co creator credits on my trucking mod for going over it with a fresh pair of eyes?

#

i know that the turn in screen is wrong, and i still gotta sort out how i give you money, but the rest SHOULD work, and if not i could use the new eyes to look at my brokeness.

tough heron
drifting stump
#

With the 0.04 item having a 0.1% chance per roll

faint jewel
#

browser!

drifting stump
#

skizot!

drifting stump
faint jewel
#

you are SUPPOSED to complain.

#

i'm not a coder lol.

#

i'm an artist who uses code to make shit work. not necessarily work RIGHT but work.

drifting stump
#

Hit me up in 2.5h ill be off work

faint jewel
#

i'll be... uhhh...

#

working or something lol.

sullen bobcat
#

Hi. Is there anyway to check if a item has been added as a possible find when Foraging?

#

I cant find the item im looking for that ive added, but i cant tell if i am just being unlucky or its actually not spawning as a possible find as foraging

drifting stump
sullen bobcat
drifting stump
#

as for seeing it ingame check lootzed not sure if you can see foraging

naive plume
#

Do items need to be created on both the server and the client? I tried using sendItemsInContainer after only creating the item on the server, but no luck

astral dune
sour island
#

Yep

#

And then some

#

addXP calls from Java don't get caught with the decoration

#

So I have a fallback in Events.AddXP

#

If it goes through the call stack catch it sets a boolean to ignore the next event trigger

astral dune
#

I'll have to scroll back and find that stuff, there are a bunch of places where I could REALLY use that information

sour island
#

If not it does some stuff there unrelated to what the call stack is looking for

astral dune
#

the getCoroutineCallframeStack then parsing it with rawTostring2 is the crux of it, right?

polar prairie
#

does anybody has a link to a blender-addon which can export files as .x?

astral dune
#

I don't suppose the callstack exposes the instances of the calling members, but just the file?

astral dune
sour island
#

There's alot of stuff there but I kept hitting snags trying to get something more elegant

small topaz
#

hi! is it possible to put an item into the player's inventory but make it so that it is not displayed in the inventory? one option is to not give the item a "display name" in its script.txt file but this trick cannot be applied in my case. Probably also possible to somehow manipulate the lua code which generates the inventory entries while in-game but I am hoping for a simpler solution...

sour island
#

The display name trick is probably the easiest - why can't it be done in your case?

small topaz
fast galleon
#

wait I saw just yesterday something like isHidden = true that you put in the script

fast galleon
#

probably doesn't work ๐Ÿ˜ฆ
it adds that if there is no displayname

sour island
#

Hmm interesting problem to have

#

You could make the result the hidden item

#

OR a bit more involved - edit the on recipe function

#

Both of those options are easier than manipulating the inventory display

small topaz
sour island
#

Yes - recipes have 3 different parameters that can be direct _G. function names

#

As in they can't be local

#

One of them is onCreate -- it can be used to add more items as recipes can (for some reason) only have 1 result.

small topaz
#

do not yet understand how this might help me

solid dawn
#

Okey thanks this was really helpful.

My game doesn't throw any errors now and by adding an additional else statement yesterday I actually managed to double the amount of used propane. So it does work in some way at least.

But for some reason my function won't do what it's supposed to and half the propane usage when the right trait is active and an propane torch is used. I suppose it is because the If statement isn't triggering. What could I change to finally get this working?

local DrainableCalc = buildUtil.useDrainable

function buildUtil.useDrainable(count)
    
    local propaneUsed = buildUtil.DrainableCalc(count)
    local itemUsed = getPlayer():getPrimaryHandItem();
    local playerCheck = getSpecificPlayer(self.playerid)
    
    if itemUsed = "Base.BlowTorch" and playerCheck:HasTrait("Blacksmithmetal") then
        propaneUsed = propaneUsed / 2
    end
    
    return propaneUsed

end
sour island
bronze yoke
sour island
#

May help to know what your end goal is though - perhaps you don't need a hidden item at all?

bronze yoke
#

oh, is it supposed to here? local propaneUsed = buildUtil.DrainableCalc(count)

jaunty marten
#

reload the file will come to bug

bronze yoke
#

a couple issues with this: your copy is just called DrainableCalc, it's not in the buildUtil table - not really sure why you wouldn't just get a straight up error for that

#

also, iirc, the original function edited the item's condition itself, so it would make more sense to change the count that goes into the function than change the return value

#

i'll need to check what the return value is actually used for though

#

oh, it's used for removing the correct amount when you need to source the condition from multiple items

astral dune
bronze yoke
#

yeah, personally i just reload lua so i've never worried about it

jaunty marten
astral dune
#

cachedfunction = oldfunction or cachedfunction would probably solve it I imagine

#

but really I would just say don't reload files, haha

fast galleon
#

or add reload call of original file

jaunty marten
#

better just do like this way, it's safe + same optimise

jaunty marten
small topaz
# sour island May help to know what your end goal is though - perhaps you don't need a hidden ...

Yep, I try to be more specific.

I want to allow the player making a fruit jam out of foraged berries. Problem is that the vanilla game comes with around 8 different types of berries (they are called Base.BerryGeneric1, Base.BerryGeneric2 and some more). Instead of making different recipes for each kind of berries, I want make things so that the player just needs 5 berries of any kind to make the fruit jam. For example, 5xBase.BerryGeneric1 should work, 5xBase.BerryGeneric2 should work and (3xBase.BerryGeneric1)+(2xBase.BerryGeneric2) should also work. So all possible combinations.

We also talked about this problem earlier but all ideas for an easy solution didn't work. Here is an example which didn't work (although the ideas were quite logical): #mod_development message

Using those "hidden items" was one idea of mine to solve the problem but maybe there are different, better and easier approaches...

fast galleon
#

make a recipe that needs one of these, count them OnTest, remove them OnCreate

drifting stump
#

there is actually a way to solve this without scuffed approaches

small topaz
drifting stump
#

instead of specifying specific items you can call a functions to return the valid items

#
recipe Make Mortar and Pestle
    {
       Plank,
       keep [Recipe.GetItemTypes.Saw],

       Result:MortarPestle,
       SkillRequired:Woodwork=2,
       Sound:Hammering,
       Time:50.0,
       Category:Carpentry,
    }
#

vanilla example

sour island
#

Yeah, that's the way to do it

#

I wonder if that supports more than 1? Or I guess you can list it 5 times

drifting stump
#
function Recipe.GetItemTypes.Saw(scriptItems)    scriptItems:addAll(getScriptManager():getItemsTag("Saw"))
end
#

and heres that function

astral dune
#

using Tags and listing it 5x is what I suggested, I'm told it didn't work

drifting stump
#

scriptItems is an array list

#

so you just need to add the items you want to the list

#

no

small topaz
sour island
#

What happens if you try what Blair wrote?

drifting stump
#
function Recipe.GetItemTypes.Berries(scriptItems)
--add the berries to scriptItems
end
sour island
#

It should say 'can use: xyz' 5 times

#

You should be able to add that item scan as five different ingredients as well

small topaz
bronze yoke
#

iirc, if you listed it five times, one item satisfied all five conditions

drifting stump
#
recipe Make Mushed Berries
    {
       [Recipe.GetItemTypes.Berries],
       [Recipe.GetItemTypes.Berries],
       [Recipe.GetItemTypes.Berries],
       [Recipe.GetItemTypes.Berries],
       [Recipe.GetItemTypes.Berries],

       Result:Something,
       SkillRequired:Smashing=2,
       Sound:Hammering,
       Time:50.0,
       Category:Bodybuilding,
    }
#

there you go

sour island
#

Ah that's the issue

drifting stump
#

ah yeah

sour island
#

You can use onTest to count them

drifting stump
#

forgor that was a thing

sour island
#

onTest can be used to prevent a context menu to appear if there's less than 5

small topaz
sour island
#

But idk if it will grab all 5

#

That's another issue

drifting stump
#

1 will satisfy all 5 i think

#

try

recipe Make Mushed Berries
    {
       [Recipe.GetItemTypes.Berries]=5,

       Result:Something,
       SkillRequired:Smashing=2,
       Sound:Hammering,
       Time:50.0,
       Category:Bodybuilding,
    }
sour island
#

Need a comma

#

I wonder if that will parse correctly

bronze yoke
#

i don't know if a getitemtypes function was tried, but using stuff like tags still required all 5 items to be the same type, not just 5 different items with the tag

astral dune
#

so 1 item can satisfy 5 requirements for an item, and 5 items with the same tag can't satisfy the requirement for 5 tags, lmao. Great system

sour island
#

The system is as robust as they needed it to be - for better or for worse

#

They can't design with every possibility in mind

#

Although this is a pretty straight forward idea

bronze yoke
#

i'm surprised this isn't supported but it makes sense

astral dune
#

just get a chuckle that they would implement a tag system without allowing you to combine items of the same tag

sour island
#

The fact the same item pool is used everytime is a bigger issue

#

I wonder

astral dune
#

sounds like using the recipe events you can create whatever functionality you want

agile vigil
agile vigil
# agile vigil Did you try: ``` BerryGeneric5/BerryGeneric4/BerryGeneric3/BerryGeneric2/BerryG...

I use this in my vinegar recipe, full example of that:

  recipe Make Vinegar
  {
    Vinegar,
    Water = 5,
    Wine/Wine2/WildBerryWine;3,
    EmptyJar = 1,
    Result:JarOfVinegarBase,
    Time:500,
    Category:Cooking,
    NeedToBeLearn:true,
    SkillRequired:Cooking=5,
    OnGiveXP:Recipe.OnGiveXP.Cooking10,
    OnCreate:Recipe.OnCreate.StartFermentation,

    Override:true,
  }

(More specifically, this is an alteration of the recipe found in Renewable Food Resources)

astral dune
#

So it will let you use any combination of those items as long as it adds up to a certain hunger value? I haven't seen that syntax before

agile vigil
#

As far as I know, yes. This is how vanilla uses Sugar, for example.

#

Doing Sugar;5, will let you use 5 hunger worth of sugar, from any number of items. So if you have 10 bags with -1 left, it'll just use 5 of them.

astral dune
#

Even if one of them is brown sugar?

agile vigil
#

Assuming the syntax was Sugar/BrownSugar;5 then yes.

astral dune
#

Sugar has a tag doesn't it? I wonder if [Sugar];5, or [Recipe.GetItemTypes.Sugar];5 or whatever will work, and its just using the ; instead of a = that will solve all the problems

agile vigil
#

The tag should also work, yep.

#

If not, I've got egg on my face, and work to do for a future mod laugh

small topaz
agile vigil
ancient grail
#

I havent completely understood crafting food tho o have done some food mods
Idk how to use the evolve recipe thing yet

small topaz
agile vigil
small topaz
agile vigil
# small topaz hmm, not sure... looks for me as if the game still only allows berries of one ty...

Ah, and then it just tries to find -25 in that single berry type?

I'd suggest creating an intermediate step, if the above didn't work:

  recipe Crush Berries{
    BerryGeneric5/BerryGeneric4/BerryGeneric3/BerryGeneric2/BerryGeneric1/BerryBlue/BerryBlack,
    keep MortarPestle,
    Result:CrushedBerries,
    Time:100,
    Category:Cooking,
    OnGiveXP:Recipe.OnGiveXP.Cooking3,
    OnCreate:Recipe.OnCreate.CrushBerries,

    Override:true,
  }

Then in the "CrushBerries" function, edit the result to have as much -hunger as the input berry. And change your jam to require CrushedBerries;25

This also adds a tiny bit of immersion ๐Ÿ˜‰

#

I uh.. Went a bit crazy with my CrushBerries function.

function Recipe.OnCreate.CrushBerries (items, result, player)
  local baseHunger = 0;
  local hungChange = 0;
  local thirstChange = 0;
  local boredomChange = 0;
  local unhappychange = 0;
  local carbohydrates = 0;
  local lipids = 0;
  local proteins = 0;
  local calories = 0;
  for i=0,items:size() -1 do
    local item = items:get(i)
    if item:IsFood() then
      baseHunger = baseHunger + item:getBaseHunger();
      hungChange = hungChange + item:getHungChange();
      thirstChange = thirstChange + item:getThirstChangeUnmodified();
      boredomChange = boredomChange + item:getBoredomChangeUnmodified();
      unhappychange = unhappychange + item:getUnhappyChangeUnmodified();
      carbohydrates = carbohydrates + item:getCarbohydrates();
      lipids = lipids + item:getLipids();
      proteins = proteins + item:getProteins();
      calories = calories + item:getCalories();
    end
  end

  result:setBaseHunger(baseHunger);
  result:setHungChange(hungChange);
  result:setThirstChange(thirstChange);
  result:setBoredomChange(boredomChange);
  result:setUnhappyChange(unhappychange);
  result:setCarbohydrates(carbohydrates);
  result:setLipids(lipids);
  result:setProteins(proteins);
  result:setCalories(calories);

  -- Todo: Adjust freshness
  -- Probably disable boredom/unhappiness adjustments
end
small topaz
agile vigil
small topaz
#

thanks!

#

@drifting stump again thanks for the idea with the GetItemTypes but this does also not work for me. I just saw that I tried this earlier (several month ago) with no luck: #mod_development message

small topaz
#
ancient grail
#

Cool awsome ty

drifting stump
#

smh just make a fluid

#

and each berry contributes to filling the container

placid sandal
#

Hi I just created an item in blender I'd like to put into the game. I have no clue how to mod the coding for this. Can anyone point me in a good direction?

small topaz
placid sandal
faint jewel
#

oof. those are fun.

#

you can use my merch mod as a base if you want.

agile vigil
#

Does anyone know how to apply an XP multiplier from lua? ๐Ÿ™‚

agile vigil
#

Ah, excellent.

fast galleon
#

it's (perk, value, minLevel, maxLevel)

agile vigil
#

This overwrites the modifier gained from, for example, a skillbook?

fast galleon
#

yes

#

no way around it

#

which is why everybody complains about it at dynamic traits

agile vigil
#

Oh, looks easy to get around with the handy hashmap also provided.

#

Iirc the Java code just loops through all the multipliers in the hashmap, yeah?

bronze yoke
#

yeah, it took about a year for someone to finally work out it was dynamic traits messing up some of my skillbooks

fast galleon
agile vigil
#

I do not remember correctly.

#

It just takes the one dedicated to a specific trait, sad.

#

Oh well, using the AddXP event and one of the parameters I can simply toss in my extra XP and tell it not to throw an event.

#

Means the tooltip won't update in the skill list, but I can live with that.

sour island
#

You can disable boosts in addXP

#

It's one of the parameters

#

The boosts applied are boostMap (proff/traits) and multipliers (skill books)

agile vigil
#

Aye, but I don't want to disable multipliers.

#

I wanted to add an additional multiplier for a perk. I ended up just doing it as I said: Sending AddXP again, but with the one variable set to True that disables the AddXP event.

#

Now to add some sandboxvars and I've got a team of QA testers ready to go for the weekend to destroy everything I've built laugh

sour island
#

I use the player base for my beta testing - never went wrong

drifting ore
#

Aight here comes the dumbest question yall ready

When I update my mod to debug / test it, do I have to enable / disable it again in "Mods" to apply the changes or does it update by itself?

timber summit
#

just an idea for any modders who're open to it

been brainstorming a bit, thinking about learning Lua and getting into Project Zomboid modding but I can't figure it out for the life of me. I've been wanting to make a prosthetics mod, a mod where you can add prosthetic/bionic limbs as an addon to the Only Cure mod

vast nacelle
# drifting ore Aight here comes the dumbest question yall ready When I update my mod to debug ...

Sort of. If you leave the game running and make changes to your lua code, you'll need to get the game to reload the lua files somehow. Either by changing the enabled mods (any change in the mods you have enabled will do) or pressing the "Reload Lua" button on the main screen while in Debug mode.

However, oddly the game seems to load faster if you just close and reopen the game anyways (at least it does for me) and is less likely to crash when loading. A full restart also ensures all files in the mod are reloaded as with the Reload Lua button, it doesn't seem to get everything like Texture changes for example.

drifting ore
#

I'm spending a few hours daily trying to code a mod for this game and every day I quit and the next day I start again from scratch

#

It's hair tearing but I feel it's gonna be worth it ๐Ÿ™‚

astral dune
#

as long as you learn something, it was worth it

molten cobalt
#

How would I go about adding this into my code? do a local function separate to each traits effect, or add it as part of that?

frozen edge
#

why is the icon not appearing?

#

its 64x64

#

in the textures folder

bronze yoke
#

they're usually 32x32

frozen edge
#

let me try

#

itworked

#

thanks

frank merlin
#

Does anyone have a door peephole mod?

viral notch
#

there is way to make it works on pz 41.78 ?

oldProcessSayMessage = processSayMessage;
processSayMessage = function(spokenMessage)
    if not spokenMessage then return end
    local trimmedMessage = luautils.trim(spokenMessage);
    if not trimmedMessage or #trimmedMessage == 0 then return end
    getPlayer():setLastSpokenLine(trimmedMessage);
    oldProcessSayMessage(trimmedMessage);
end

After update to. 71 it stopped working and idk why can someone try to help me?

tawny night
#

I got an idea for any one concerned with mods on UI improvements. I think a number next to each item on the list that counts up from one, increasing as you go down the list will make moving specific amounts of items easier. For instance, if I wanted to move 10 9mm rounds, then I would shift click the 9mm round with "1" next to it, then scroll down and click the 9mm round with "10" next to it, selecting exactly 10 rounds instead of having to individually count each round.

drifting ore
sour island
#

Borked how?

drifting ore
#

cant add money to wallet somehow or use money from wallet

#

i think you can use money in some cases actually

sour island
#

Strange as I can

#

Do you have wallets disabled?

drifting ore
#

no. but i also havent barely noticed anything until just now

#

ill test around a bit more and see what shappening

#

not too worried as i would prefer to use wallet-less also

#

i guess it's just adding to wallet is the issue i'm seeing

#

lets say i have a shop setup to buy Base.Money 1-0-100 with no resale. under previous circumstances it would be able to accept the money at a rate of 1 dollar wallet value per base.money

#

now it just doesn't take them or will take them but doesn't apply to balance of wallet

#

i used 20 dollars for testing so it could see it consumed the wallet money just fine. just not sell to shop for wallet value

sour island
#

Oh I stopped allowing shops to deposit cash items

#

Outside of transactions

#

You can deposit cash by hovering it over the wallet button

#

Same as you got it, I imagine?

drifting ore
sour island
#

Also you can drag cash to other cash items to combine them

#

Drag the cash to the button

drifting ore
#

omg what a sneaky update

#

thanks dude

#

finishing up the auto server restarter today methinks

sour island
#

The drag to button has been in - I'm just bad at advertising it

#

Same with combining them

small topaz
#

me playtesting my mods for the first time:

small topaz
#

Is it possible to access and modify local vanilla function from a .lua file within my mod?

In vanilla, the respective code I want to touch is in /lua/client/ISUI/ISInventoryPaneContextMenu.lua and starts like this:

local CraftTooltip = ISToolTip:derive("CraftTooltip")
function CraftTooltip:addText(x, y, text, r, g, b)
-- some vanilla code here
end

What I would like to do is to modify the function CraftTooltip:addText in my mod with a typical construction like

local vanilla_code = CraftTooltip.addText
function CraftTooltip:addText(...)
vanilla_code(...) -- execute vanilla code
-- append my new modded code here
end

I don't how to do this since CraftTooltip is a local in the vanilla code. Any ideas?

steel hill
#

love not being able to get any mods to load on my ded server

vast nacelle
small topaz
molten cobalt
drifting ore
#

For some reason the image that I used for my blacksmith trait is not working can someone help

vast nacelle
#

It should be placed in /media/ui/Traits/ and have the name format of "trait_[TRAIT_NAME].png"

drifting ore
#

for is it because is not transparent

drifting ore
steel hill
#

Anyone here have fort redstone on a dedicated server?

vast nacelle
# drifting ore for is it because is not transparent

It shouldn't be because of the transparency and the size looks okay.
What does your trait factory line look like?
TraitFactory.addTrait("Deprived", getText("UI_trait_Deprived"), -6, getText("UI_trait_Depriveddesc"), false);

#

And I assume the trait appears just fine in the character creation menus aside from the icon not showing?

drifting ore
#

the code i used is

#

local function initBlacksmithTrait()
local Blacksmith = TraitFactory.addTrait(
"Blacksmith",
getText("UI_trait_blacksmith"),
5,
getText("UI_trait_blacksmithdesc"),
false,
false
);
Blacksmith:addXPBoost(Perks.Foraging, 3);
Blacksmith:addXPBoost(Perks.LongBlade, 1);
Blacksmith:addXPBoost(Perks.ShortBlade, 1);
Blacksmith:addXPBoost(Perks.Spear, 1);

end

Events.OnGameBoot.Add(initBlacksmithTrait);

vast nacelle
#

This might be silly, but can you try renaming the file to "trait_Blacksmith.png"?
Maybe the capitalization is throwing it off.

drifting ore
#

Ok

#

And also some traits donโ€™t work

#

I put four skills on a trait and I load in a game foraging is not there as I mean the +3 foraging is not on

vast nacelle
#

It should be this for foragingBlacksmith:addXPBoost(Perks.PlantScavenging, 3);

bronze yoke
#

you can find the internal names of skills on this page

humble oriole
#

does a client have to load an object before the server can do work on it?

#

that code just returns the info in the second screenshot

#

if I add in local isohb = hbg:getIsoObject()

#

it returns nil

bronze yoke
#

yeah, the server can't access unloaded objects either

#

that's what those 'found isoobject with luaobject' messages are about, it only links them when they load

humble oriole
#

ok, so how can I do work on it?

bronze yoke
#

you can't: the point of the lua object is you can modify that and its properties will be applied to the java object when it loads

jaunty marten
#

coming to release drunk

humble oriole
bronze yoke
#

no, the lua object checks for rain and fills up

#

then when the java object loads, the lua object applies the water value it has to the java object

ancient grail
#

โ“stressed

humble oriole
ancient grail
#

Java and lua obj are diffrent things obviously but i just learned that from u now

bronze yoke
#

you rarely need to worry about them, they're just for global objects

ancient grail
#

Like traps and campfires

#

I wonder if it would be better or possoble to turn my beartrap mod i to java obj

#

Cuz its not

bronze yoke
#

the lua object is basically an abstraction of the java object so that we can modify* it while it's unloaded

humble oriole
ancient grail
#

But in using vanilla tile

humble oriole
ancient grail
#

So i cant add anyother other properties

humble oriole
#

Like, looking at the rain barrel code:

    if not RainManager.isRaining() then return end
    for i=1,self:getLuaObjectCount() do
        local luaObject = self:getLuaObjectByIndex(i)
        if luaObject.waterAmount < luaObject.waterMax then```
ancient grail
#

I just made an ontick check if your standing on the tile

bronze yoke
#

isn't your bear trap mod just for hurting other players? you wouldn't need this for that

ancient grail
#

Ye ow ok cool

humble oriole
#

oooh, I thought it actually trapped a bear xD

humble oriole
ancient grail
#

Maybe u placed the function checkRain below whats calling it.. that happned to me before and wasted a whole day figuring out why my code isnt working

humble oriole
#

LOG : General , 1672984032167> 15,072,331> nil

bronze yoke
#

are you still having the issue where you can't grab the objects at all? or just nil keys?

humble oriole
#

nil keys

#

hbg returns that stuff up there if I loop through it

#

so I can return hbg.x, hbg.y etc

bronze yoke
#

where are the values saved/loaded?

ancient grail
#

Was about to ask the same thing

humble oriole
#

stateto, statefrom?

#

Here's the object def

#

and the system def

bronze yoke
#

hmmm yeah, that does look right...

humble oriole
bronze yoke
#

i really need to mess around with this system more

ancient grail
#

Maybe isValidModData()
Should return true?

humble oriole
#

I'm not sure that's even being called, let me try without it

ancient grail
#

Wait youre checking the arg modData on isvalid
You arent sure if its moddata but ur able to pass it as arg

#

Might not need that isvalid im guessing but i could be wrong

bronze yoke
#

we know it's moddata, we just want to know if it's moddata from this mod

ancient grail
#

Ahhh ok

#

Makes sense

humble oriole
#

yea, the object calls that when doing stateto

ancient grail
#

But it nils it

humble oriole
#

The issue seems to be that the keys aren't getting passed to the luaobject correctly

bronze yoke
#

i need to write a global object system soon so i'm sure i'll be able to help then

humble oriole
ancient grail
#

Ahh

#

Sorry hehe

bronze yoke
#

now that i'm thinking about it, that is REALLY strange

#

it should at least have the default values from initNew

ancient grail
#

Didnt know that works
I mean i would have written an if statement and returned boolean

#

I should try this way looks more fancy

bronze yoke
#

can you confirm stateFromIsoObject is actually running?

humble oriole
#

I'm just trying to get the lua object

#

which should still have the keys available even without the iso, right?

bronze yoke
#

yeah it should

ancient grail
#

Cuz thats where you initNew

humble oriole
#

So, all I need to make a lua object is


function SBioGas:initNew()
    self.methane = 0
    self.biowaste = 0
    self.fertilizer = 0
    self.lastHour = 0
end

function SBioGas:new(luaSystem, globalObject)
    local o = SGlobalObject.new(self, luaSystem, globalObject)
    return o
end```
bronze yoke
#

i'm just curious what loads it in that case

humble oriole
#

the object system inits it, yea?

#

function SBioGasSystem:new()
    return SGlobalObjectSystem.new(self, "HomeBioGas")
end

function SBioGasSystem:initSystem()
    SGlobalObjectSystem.initSystem(self)

    -- Specify GlobalObjectSystem fields that should be saved.
    self.system:setModDataKeys({})
    
    -- Specify GlobalObject fields that should be saved.
    self.system:setObjectModDataKeys({'methane', 'biowaste', 'fertilizer', 'lastHour'})
end

function SBioGasSystem:newLuaObject(globalObject)
    return SBioGas:new(self, globalObject)
end

function SBioGasSystem:isValidIsoObject(isoObject)
    return instanceof(isoObject, "IsoThumpable") and isoObject:getTextureName() == "DylansRandomFurniture01_13"
end```
#

Specifically:

    return SBioGas:new(self, globalObject)
end```
ancient grail
#

Statefromisoobject called self:fromModData()

Which is a function below it

Idk maybe its just stuff like this wuich is messing up the code

fast galleon
#

I don't see where you call toModData or stateToIsoObject? But not sure why it would be nil on the testme.

#

I've had to put prints on stateFromIsoObject before to see when it triggers as that can be an issue too. If you were testing on SP, you'd have access to these values directly from the console and you could do print regularly or use Aiteron's debug to show it in an UI. Print evewhere from the point it gets set, to any place it can be unset.

agile vigil
#

Full example:

---@param item Literature | InventoryItem
---@return MutiesDiary.Diary
function MutiesDiary.Diary:new(item)
    if item:getFullType() ~= "Mutie.Diary" then return nil end

    local object = {};
    setmetatable(object, self);
    self.__index = self;

    object.item = item;

    return object;
end
fast galleon
#

no, no, no

agile vigil
#

No?

fast galleon
#

it is already done on the other new

agile vigil
#

Oooh

#

In SGlobalObject:new

#

Yeah my bad.

#

I missed that part laugh

fast galleon
#

well, just a heads up this system warns not to mess with new as it is synced with java.

agile vigil
#

Fair.

#

I'm perfectly happy with my normal lua objects laugh

#

Unrelated: Any event I should hook unto if I want to load my sandbox vars at a good time?

fast galleon
#

I like the OnInitGlobalModData

agile vigil
#

That sounds good.

#

Just realised I haven't done strings or floats for sandbox vars before. Anywhere I can just look up how their default values should look? (and their type)

fast galleon
#

strings like drop down (enum)

agile vigil
#

No, freeform

#

I want the server owners to be able to define a list of traits that shouldn't matter when determining if reading an XP Diary should penalise the XP you get back. Needs to be freeform because mods add traits ๐Ÿ™‚

#

I think Extra Loot Settings does what I need, so I'll just download that.

fast galleon
#

I don't know about examples you can copy but you can search java for extends CustomSandboxOption

ancient grail
#

2nd day i dont have a mod commission proj ๐Ÿ˜ฆ sooo bored

#

Anyone needs help on their mod

solar basin
#

any darkwood ost yet?

finite owl
#

Just continuing a conversation with @polar prairie in #modeling about how to go about adding a new bow to the Bow and Arrow mod: the way the Bow and Arrow mod was written, it's actually going to be fairly easy to extend.

#

Most of their functions are nicely set in a global "MandelaBowAndArrow" Lua object, so you can make changes to them pretty easily.

#

For instance, whenever the mod needs to check if a weapon is a bow, it calls MandelaBowAndArrow.Client.isMandelaBow(itemType), and that just checks if the item is in the Lua table MandelaBowAndArrow.Client.Bows

#

So you don't even need to override their function - if you stick the appropriate data into that table, it will start to recognise your item as a bow.

polar prairie
#

ah nice.

finite owl
#

For example, the base crafted bow is stored like this:

Client.Bows["Base.MandelaBow"] = {
    speed = 0.25,
    aimingAngle = 30,
    aimingDistance = 17,
    weaponOffset = 0.9,
    deviationMultiplier = 1.5,
    --gravity = 0.003, --does nothing apparently
    model = "MandelaBowAndArrow.MandelaBow"
};
#

(They previously set local Client = MandelaBowAndArrow.Client)

#

So you just make your custom item with its item name, and then set it on that table with whatever stats you want, and it Should Just Work ๐Ÿ˜…

polar prairie
#

thank you so far! i still have to figure some things out as i'm new to this.

finite owl
#

No worries! Most likely you'll come across things as you work, so feel free to @ me with more questions.

polar prairie
#

thank you! very kind of you! :) i appreciate it!

finite owl
#

The good news is, the mod was written in a really nice way which will make extending it much easier that normal... easier than many of the vanilla PZ Lua files, even.

polar prairie
#

good for me! :D

ancient grail
#

can OnCharacterDeath retrieve player inventory

finite owl
#

Well, there are some things which aren't so easily modded... I commented on the original that they should add a "isHoppable" test to the arrow wall collision code, to allow shooting arrows over low walls. I'd add that fix myself, but those tests are embedded deep in a large function, so I'd have to duplicate that whole function to change that.

#

Which is a shame, because the same test is done three times (on the tile the arrow is over and two neighbouring tiles). If they'd just pulled out the common code into a function, and stored it in their object like the rest of the code, it would be dead simple to override that one small chunk of code.

#

(So instead I've just hacked my local copy of the mod so I can shoot over low walls ๐Ÿ˜ )

polar prairie
#

it seems you have good experience with it. sounds so complicated.

finite owl
#

I'm a software engineer in my 50s, so I have lots of experience with code. I only started looking at Zomboid modding recently though ๐Ÿ™‚

polar prairie
#

wow i see. but yea zomboid is such a good game.

#

and a lot of people trying to improvie it with sharing their mods, it's a good community.

agile vigil
agile vigil
polar prairie
#

i still have problems with my texture that doesn't show ingame. something must be wrong with my model (material or something) i'm still new to blender. can i send someone with some experience in blender my .fbx model so that anybody can tell me where the mistake is? i cannot figure it out after hours. :/

vast nacelle
polar prairie
#

@vast nacelleyea it should work fine. for now i'm just in the testing phase and using another mods scripts and just replace the model as .x and the texture as .png.

vast nacelle
#

Send me the fbx, the texture file, and the txt with your model script entry and I'll take a look.

ancient grail
#

I wish theres a modelling guide with autodesk maya

small topaz
#

Hi! How do print the names of all items in the player's inventory?

#

I tried this but gives an error:

    local playerObj = getSpecificPlayer(player)
    local playerInv = playerObj:getInventory()

    local myList = playerInv:getItems()
    for i=1,myList:size() do
         print("Item: ", myList:get(i-0):getFullType())
    end
shadow geyser
#

what is the error you are getting?

small topaz
#

one mom...

small topaz
shadow geyser
small topaz
#

whoops!!! haha! XD

#

that's probably it!!! very stupid mistake! haha! thanks!!

#

haha! works now! many thanks again.

shadow geyser
#

np

small topaz
#

another question: How do I remove all items of a given type from inventory? I tried smth like this

local playerInv = playerObj:getInventory()
playerInv:RemoveAll("Base.Item")

but this doesn't have any effect (items are still present in inventory).

vast nacelle
#

Just playerInv:RemoveAll("Item")
@small topaz

small topaz
#

thx! is "Item" then the display name of the item?

vast nacelle
#

No. It's the Type ("Shotgun"), but not the FullType ("Base.Shotgun") or the DisplayName ("JS-2000 Shotgun")

small topaz
#

ah... ok thanks! I'll play around with that!

#

btw, didn't know that there is a java doc including better documentation about all the commands. I just used a probably outdated version (here: https://zomboid-javadoc.com/41.65/). Good to know...

faint jewel
#

and follow that with Player.Kill() that will make sure they dont have it XD

agile vigil
#

Can I put commas in item names like this?

    item ChineseTakeawayBoxUnfolded
    {
        DisplayName = "Chinese Takeaway Box, Unfolded",
        DisplayCategory = PackingMaterial,
    }
small topaz
agile vigil
#

I haven't yet ๐Ÿ˜„

#

Making the icons for my new items ๐Ÿ™‚

hot patrol
#

when making your mod.info how do you make it require more than 1 mod?

#

like how should it be written

fast galleon
hot patrol
#

thanks

hot patrol
fast galleon
#

happy new year, mod_development

sour island
#

We did it

#

I concede Mrogamming was a bad name, but I'm glad we got a more defined name in the end.

bronze yoke
#

let's gooo

vast nacelle
#

They did it after I put in a request yesterday to change it.
The straw that broke the camel's back or had we just been grumbling without actually asking it to be changed? ๐Ÿคฃ

sour island
#

It was brought up a few times

#

Modding / Modding Support kept getting redirects

astral dune
#

Put in a request? If thats a thing its not like its advertised, haha

vast nacelle
hot patrol
fast galleon
#

wrong arguments?

hot patrol
#

not sure. this is what is on line # 118 of my mod if inventory:getItemFromType(result) then

#

and line 58 of the vanilla game local resultItemCreated = RecipeManager.PerformMakeItem(self.recipe, self.item, self.character, self.containers);

fast galleon
#

I assume result is in same fashion as vanilla

hot patrol
#

I have no idea. I didn't put this together. I am just trying to see if I can fix it myself While I wait for a response from who did.

#

This is the whole action ```function Recipe.OnCreate.VinylPack(items, result, player) --> This function is executed when opening the packages.
local inventory = player:getInventory();

if inventory:getItemFromType(result) then
    inventory:Remove(result);
end

--> Adds 3 random cassettes to player inventory
player:getInventory():AddItem(ItemsResearch.Vinyl[ZombRand(#ItemsResearch.Vinyl) + 1]);
player:getInventory():AddItem(ItemsResearch.Vinyl[ZombRand(#ItemsResearch.Vinyl) + 1]);
player:getInventory():AddItem(ItemsResearch.Vinyl[ZombRand(#ItemsResearch.Vinyl) + 1]);

end```

old ginkgo
#

Hate to just butt in while another troubleshoot is going on. Have a quick question.

Anyone have any experience on working with the ISChat.lua? Trying to generate a second chat tab for non-admin clients that can only use specific chat streams, potentially up to 3 chat tabs. Anyone have any documentation on some of the functions?

fast galleon
sour island
#

What is not working about it?

hot patrol
#

in their attempt to get rid of the empty package this bug arrived

hot patrol
#

I got a response from the modder I am working with so I should be abl to sort it out now

#

thanks for the responses

fast galleon
#

interesting, how the empty item gets added, is it the result item?

sour island
#

I'm curious if he has removeResult set to true in the recipe

fast galleon
#

anyhow chuck is right, result is usually removed like that

sour island
#

Getting an item like that could mess up getting the same item I think (?)

wraith moat
#

Hello, not sure if this counts as a mod, but I made a companion application to track read books and magazines. I used the icons for the books and magazines for the labels.
What kind of permissions do I need to distribute this for free?

hot patrol
#

@fast galleon @sour island Not to leave you both hanging but I had to change the error line to if inventory:contains(result) then

sour island
#

Sorry if I pinged anyone or everyone - my phone was active in my pocket

#

Had a message ready to go with 50 pings to the same person

#

And downloaded at least 12 messages ๐Ÿ˜…

sour island
humble oriole
#

if I put say 400 small items into a container and run a sendCommand on postInventoryTransferAction

#

how hard would that hit the server?

drifting stump
#

refrain from having large quantities of items

#

the game does not handle that well

finite owl
#

I think it's probably more sustainable to make add-on mods

humble oriole
sour island
#

Even the floor has a limit of 50 weight though

#

3D item models on the floor are a huge issue

#

I think that's why ripping clothes was changed

humble oriole
#

so, I'm just wondering if I should have all the loaded containers update on the hour, or do it postinventorytransfer

sour island
#

If your tank doesn't change how it looks over time you can do a bulk of the work when interactions occur.

#

Not sure what the food does for the tank in this case, but what if the food gets destroyed and converted into an integer?

humble oriole
#

this is my "on every hour" function

sour island
#

I don't really see an issue then I guess

#

As long as you're not displaying the items

#

Is this like a giant composter?

humble oriole
#

something like that

sour island
#

I mean the player can't access the contents can they?

humble oriole
#

probably all black, it'll just be a container that will convert food into propane and fertilizer

drifting stump
#

its still pretty harmful to have 400 individual items

humble oriole
sour island
#

It could matter if you make it able to hold 400

humble oriole
#

no, the container will be probably 25-50

#

likely just 25

sour island
#

Ah

#

That's fine then

humble oriole
#

I'm just wondering if it's light enough on the server, I could iterate the biowaste variable on each inventory transfer, which is every single item.

#

or, if I should make users fill it, and then on the hour ticket update all loaded containers at the same time

sour island
#

I send a command a tick on EHE

#

Has x y z and a few strings

humble oriole
#

CBioGasSystem.instance:sendCommand("addBioWaste", { { x = isohbg:getX(), y = isohbg:getY(), z = isohbg:getZ()} ,"put", additionalBioWaste})

sour island
#

No one has complained about lag - unless a horde is invovled

#

But why not send 1 command with the whole list

#

Unless I misunderstood -- you're not sending a command per item?

humble oriole
#

I'm currently not, I felt like it would be a lot with how fast you could transfer small items

#

I guess I could make a button to initiate the add process immediately on that specific object, that way if they're doing a mass load to top it off it would be 25-50 units at a time then on transfer.

golden sparrow
#

Hello, does someone knows the difference between these two methods ?

#

It's in NetworkZombieManager class i wonder i can use the second one safely in a multiplayer mod

quasi kernel
#

Only reasonable difference I can see is one accepting a param while the other doesnt

#

I haven't dabbled much in the networking side of things so I'm not sure what it changes beyond that.

humble oriole
#

is it possible to see how many items have been added to an evolved recipe?

#

Also, is there a place to see all the available fields on an evolved recipe?

#

Wait, can we not make our own evolved recipes?

bronze yoke
#

we can

humble oriole
#

how to we specify what items can be added?

#

I see the lua method getItemsCanBeUse

#

is it itemsList

bronze yoke
#

not sure, you'd usually just define it in a script

#

i think the items you can add are defined by the items themselves, not the recipe

#

like sugar knows it can be put in coffee

humble oriole
#

right, so do you have to overwrite every food item that you want to use in the evolved recipe?

bronze yoke
#

it'd be better to do it through lua

#

but yeah basically

#

hmm... i don't see a getter ๐Ÿ˜Ÿ

#

they wouldn't...

humble oriole
#

"We're going to do things like the modding community." Proceeds not to make a way for the modding community to hook into the system.

bronze yoke
#

hmm

#

it looks like even though it's defined in the item script, it might still belong to the evolved recipe object...?

#

this part of the code is kind of complicated, i just had a quick look through, but i think that's what it's doing

#

yeah, it just finds the evolved recipe and adds itself to its itemsList

humble oriole
#

in the field details it shows itemsList

#

so I'm trying that with, [Recipe.GetItemTypes.Food]

bronze yoke
#

an awesome detail is it looks like evolved recipes only work in module base

#

because this part of the item script handler only searches base

humble oriole
#

I can import base, right?

bronze yoke
#

yeah, it's just annoying - modded recipes will have to be in base, even though it's generally encouraged to keep things to your own module

humble oriole
#

it's just one item

bronze yoke
#

anyway you just need to mess with the map you get from getItemsList()

#

might write a little util for that for my library, it kind of annoys me how roundabout that is

#

i guess you could DoParam it actually? i can't see how it'd overwrite previous values

#

i wasn't going to recommend it for that reason but it seems fine actually

humble oriole
#

I'm not sure how to do that

#

this may just be a rabbit hole I don't want to go down. I was thinking I could make an evolved recipe to make like a mash or something, and then when they add that to my sprite I could count the items in the recipe and iterate with that, but I might just have to make a button that kicks off the script

bronze yoke
#
local item = ScriptManager.instance:getItem('Base.Sugar')
if item then
    item:DoParam('EvolvedRecipe=Sandwich:1')
end
humble oriole
#

does that add to the existing list?

bronze yoke
#

there is no existing list as far as i can tell

#

that information, despite being on the item script, doesn't seem to be stored on the item whatsoever

#

it just adds it to the relevant recipe when it gets parsed

#

i was specifically not telling you to do it this way because i had the same concern, but it seems fine

humble oriole
#

there isn't even a method for food items to getEvolvedRecipies (sorry if that's the getter you were talking about earlier.)

bronze yoke
#

yeah that's why i thought we shouldn't do it this way, i couldn't find a way to not override things, turns out there was nothing to override lol

humble oriole
#

hmm, I'll have to go through this whole list, cause there's some items I'll have to exclude like cans that aren't open, but that should be easy enough

opal linden
#

In a server, how to add one custom spawn point? And remove all the others?

humble oriole
#

What do you guys think would be more intuitive, combining food into a water pot and then dumping the mixture into the device, or adding a world context menu option to empty the container?

opal linden
#

also, how to prevent some traits and professions from being picked?

ruby urchin
ancient grail
#

Yey our prayers have been heard! Mod development channel

#

I just friken noticed loool

#

Im sooo blind

#

No wonder i got lost last time searching for this channel

ancient grail
#

But theres probably a better way

fast galleon
ancient grail
humble oriole
rain shard
#

Hey guys, where would I look to reference character creation? I want to blacklist certain items from appearing when I enable all clothing to appear in char creation

half anvil
#

I think it would be funny if there was a mod that made zombies randomly dance when they aren't pursuing someone

vast nacelle
rain shard
#

thank you

young grotto
#

just wondering, I'm testing a mod right now. Let's say we cook hundreds of items like peanut/almond in the stove. Will it break the game or even worse a server?

agile vigil
humble oriole
#

Do you have to pass character when doing a sendcommand()?

bronze yoke
#

sendclientcommand? no, it's optional

humble oriole
#

does the module refer to SBioGasSystem in my case?

bronze yoke
#

module can be anything you want

#

module and command are both just strings that get passed to the server, there's conventions for how you should use them but no actual limitations

humble oriole
#

I'm getting ERROR: General , 1673077385616> 36,977,847> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: at MethodArguments.assertValid line:123.

bronze yoke
#

can you show your call?

humble oriole
#

CBioGasSystem.instance:sendCommand("empty","addWaste", { { x = isohbg:getX(), y = isohbg:getY(), z = isohbg:getZ()} ,waste})

#
    return SBioGasSystem.instance:getLuaObjectAt(args.x, args.y, args.z)
end

function Commands.addWaste(args)
    local hbg = getHomeBioGas(args[1])

    if hbg then
        print("Adding Waste")

        hbg.biowaste = hbg.biowaste + args[2]

        hbg:transmitModData()
    end
end```
#
    SBioGasSystemCommands[command](playerObj, args)
end
#

the debugger is hitting this for the error.

bronze yoke
#

oh, it's a global object function? i guess you'd need to look at the definition for that- yeah

#

you will need to pass a player object in this case then

humble oriole
#

so it does require a playerobj then... I don't understand why, I don't use it. can I just pull getOnlineByPlayerID(0)?

bronze yoke
#

i wonder if it's just a javaside proxy for sendclientcommand or if it actually works differently in some useful way

humble oriole
#

seems... jank

bronze yoke
#

if it's the same i don't really know why this exists...?

#

that sort of describes my views on about half of the global object system

humble oriole
#
    local playerObj = getSpecificPlayer(0)
    local args = { x = obj:getX(), y = obj:getY(), z = obj:getZ(), fuelAmt = 0 }
    CCampfireSystem.instance:sendCommand(playerObj, 'setFuel', args)
end```
#

from the vanilla code

bronze yoke
#

if you don't want to pass a player, just use sendClientCommand i guess

#

i really don't know what this global object specific sendCommand is for

humble oriole
#

does that still hook into my SBioGasSystemCommands.lua?

bronze yoke
#

i'd like to check if it's any different on the java side but i'm not at my computer

bronze yoke
humble oriole
#

yea, I'm doing that lo

bronze yoke
#

i think maybe it's like sendClientCommand but it matches the system instead of using the module string

#

in any case they're probably basically the same thing and if you don't want to pass a player object just use sendClientCommand like normal

hot patrol
humble oriole
strange sequoia
#

Hi hi, does anyone here know how i can make a furniture/object a requirement for a recipe but make it so my character doesn't pick it up when they craft. I want my character to be able to craft it when they're around the object but they don't need to have it in their inventory to craft

#

I tried this

    {
        [MaterialforCraft]=1,
        keep [WorkBench],
        Result         : [...],
        Sound         : ClothesRipping,
        Time         : 100.0,
        CanBeDoneFromFloor : true
        Category    :  Tailoring,
        AnimNode         : RipSheets,
    }```

But my character picks the workbench up
#

I also tried

    {
        [MaterialforCraft]=1,
        
        NearItem: [WorkBench],
        Result         : [...],
        Sound         : ClothesRipping,
        Time         : 100.0,
        CanBeDoneFromFloor : true
        Category    :  Tailoring,
        AnimNode         : RipSheets,
    }```

But my since the workbench is a 3d WorldItem it doesn't seem to recognize it when it's on the ground
humble oriole
#

Is it a sprite or just an item?

strange sequoia
#

It's a 3d item

humble oriole
#

so it's something you can drop out of your inventory or place and rotate?

strange sequoia
#

Yep

humble oriole
#
    {
        CigaretteMod.CigarettesOne=5,
        Result: Brass57=5,
        Time:60.0,
        keep ATMReceiver,
        NeedToBeLearn:false,
        CanBeDoneFromFloor:TRUE,
        Category:Shop Unique Market,
    }```
#

is the workbench from another mod or is it base?

strange sequoia
#

It's from my own mod, i don't have the workshop implemented yet so i use another object for reference. Here's the full recipe as of now

    {
        Leather=1,
        DuctTape=2,
        SmallSheetMetal=4,
        Thread=1,
        keep Needle,

        NearItem:DestroyedCarTire,
        Result         : Makeshift_Vest_Junker,
        Sound         : ClothesRipping,
        Time         : 100.0,
        CanBeDoneFromFloor : true
        Category    :  Tailoring,
        AnimNode         : RipSheets,
    }```
#

The "DestroyedCarTire" is where the workshop is supposed to be

humble oriole
#

is it workshop's metalworkbench?

strange sequoia
#

So i don't use this mod's workshop

humble oriole
#

if it's not in the same module you'll need to do

#

keep "module.itemtype"

#

you'll not use quotes

#
    {
        keep MetalCutter,
        LargePropaneTank,
        keep MetalWorkbench,```
strange sequoia
#

Hmm, yeah i tried to use "Keep (...]" but my character still picks the item up

humble oriole
#

huh, not sure then, the only time I use it in that specific scenario the item on the ground is either protected by valhalla (the earlier example of ATMs) or way to heavy to pick up (workbench).

strange sequoia
#

Well i can try to make it too heavy to pick up, but that would mean the workbench would be unmovable, right ?

strange sequoia
#

I tried making the object too heavy to pick up and it doesn't work :/

strange sequoia
#

Oop nevermind ! Seems like i possibly made a mistake in writing the recipe! It works now ๐Ÿ™‚ Thanks for the help @humble oriole

humble oriole
#

sorry got wrapped up in my own code haha. Glad you got it working!

ancient grail
strange sequoia
#

It's was not a tile but an item ^^ In the end CanBeDoneOnFloor was enough, i just didn't know you had to write "TRUE" in all capital unless it would not register

humble oriole
#

Is there a way to immediately initialize the luaObject after the isoObject is created?
HomeBioGas: found isoObject without a luaObject 10902,9773,0

ancient grail
#

Did you now? I thought it would work even if dont write it on all caps. Good to know

ancient grail
#

Or you can make an ontick that removes itself

humble oriole
#

I wonder...

#

I doubt this will work, but I'm going to call my load function with MapObjects.OnNewWithSprite()

#

As if it were so easy haha. Oh well. I'll mess with that tomorrow.

ancient grail
#

Ow yeah its the comma

strange sequoia
#

Now that would probably be why ๐Ÿฅน I was wondering ahahahah

#

I just figured it was the capital letters since it worked after i rewrote it, but i didn't think of the comma

ancient grail
#

The whole script file didnt run i bet

fast galleon
drifting ore
#

Hello, I am trying to write a mod for multiplayer and I want to know what the best way to debug it in game is. I want to get someone's steam ID

I'm using

local player = getPlayer();
local playerID = tostring(player:getSteamID());

But I don't know how to go about testing this in singleplayer ๐Ÿค” ?

#

It's vital for further development that I can test out this mod in game, should I just host a world as multiplayer, would that work?

drifting ore
#

Thank you very much, I appreciate it. ๐Ÿ™‚ โค๏ธ

thick karma
#

Launch game with -debug

drifting ore
#

I am sorry if my questions come across as dumb or annoying, really trying my hardest to learn the language.

thick karma
#

You can use the debug console (opened with backtick, `), in order to enter and test commands in game

ancient grail
#
for i = 0, getOnlinePlayers() -1 do
local chr = getOnlinePlayers():get(i):getSteamId()
print(tonumber(chr))
end
#

I typed this using mobile so if it doesnt work then u just fix that the error is saying

#

@drifting ore

drifting ore
#

I'm reading it now, will save it if for future reference. Thank you a lot! ๐Ÿ™‚

ancient grail
#

Just paste that on the lua console

U might want to

print(tonumber(chr))

#

Do that if it doesnt show the right id

#

Also its i=0 sorry bout that

thick karma
ancient grail
#

There fixed it

drifting ore
#

When you say execute commands in the debug console, do you mean commands I make myself in LUA (if it's possible) or just general debug commands?

ancient grail
#

I typed using mobile as said

#

Forgive the indention lol

drifting ore
#

Because it would make my life a lot easier if I could just do /test and execute my function lol

#

Right now I'm juggling these events what they are called, to see if the code works

#

Half the time I'm not even sure if I've chosen the right event tbh

ancient grail
#

Show the code

thick karma
drifting ore
#

Lemme just quickly find the markup for posting code

thick karma
#

However, local variables will cease to exist after hitting enter to submit the commands you've typed in debug console

ancient grail
#

```lua --codes here ```

#

@drifting ore

drifting ore
#
function zedkills()    
        local player = getPlayer(); 
        local playerID = tostring(player:getSteamID());
        local moneyAmount = "500$";
        local fileName = playerID;
        local information = playerID .. "\n" .. moneyAmount;
        local writer = getFileWriter(fileName .. ".txt", true, false);
        writer:write(tostring(information));
        writer:close();
end
Events.OnPostMapLoad.Add(zedkills)

Forgive me I was cleaning it up a bit might've messed some parts up

#

Basically, it's designed to write a .txt file to store just the value of "money", a local variable I'd introduce for a small economy mod for a RP server

#

I know I could've used JSON or ModData but for the life of me I couldn't figure out how

ancient grail
#

You intentionally wanted the cash to become a string

drifting ore
#

I would have loved to use Json

ancient grail
#

Right well its all gona be string anyways nvm what i said

drifting ore
#

One Json file to rule all those txt files that would appear...

#

I was following some famous tutorial on github how to use Json in LUA but it never worked out :/

ancient grail
#

U might have overwritten an existing thing with that i believe

#

When do u want the function to trigger

drifting ore
#

Well for testing purposes whenever I want right now, so I can test it out how it looks when I execute it

ancient grail
#

You can do the Every10mins i guess

drifting ore
#

Keypress event might be best used in that case I figure

ancient grail
#

Not sure how its written

#

Then use the onKeypress

#

return key

#

If key == whatver keycode

drifting ore
#

Will do and report back ๐Ÿ™‚

ancient grail
#

i could write it for u but im not near my pc . Look for other mods that has key commands i guess if you cant find it on the vanilla lua

drifting ore
#

No worries man, I don't expect from any of you to write anything like that for me !

#

I need to learn

ancient grail
drifting ore
#

I see so much potential here for mod making, really want to learn it

ancient grail
#

You could also put a function on the thing and just call it on debug to test if its working first

drifting ore
#

How do you call a function from within debug?

ancient grail
#

If its not local u just

functionName()

drifting ore
#

Damn that sounds way better to try

#

Gonna try that now

ancient grail
#
function myFunc()
print('hello world')
end
myFunc()

--alternatively you can just do
print('hello world')


thick karma
thick karma
#

That'll store a variable inside of player's save data

#

No need to write your own file if you don't want the money to persist between characters

drifting ore
#

Interesting

ancient grail
#

Anyone experienced with zed modding

Like their behavior and shit

drifting ore
#

The only thing I don't understand is the ".Simple" shouldn't that be something specific?

#

Like, in the sense of code not string

#

Or is that just like a value figure, like getting a persons name

thick karma
#

where player is obtained via getPlayer() or a loop through getOnlinePlayers() or something like that.

ancient grail
#

Yeh thats the moddata u created

thick karma
drifting ore
#

Aaah yeah, makes sense

#

Thank you very much! ๐Ÿ™‚

thick karma
#

So that you don't conflict with other people using mod data

#

As easily

thick karma
ancient grail
#

@drifting ore what r u building anyways

ancient grail
#

Cdc i think

#

Im hoping the author is active here on mod dev channel

thick karma
#

@drifting ore Glytch3r asks a fair question... If you are working on a shop mod, you may want to reconsider and just join forces with someone else to make their shop mod better

ancient grail
#

Yeah but for a first mod shop mod isnt advice able

drifting ore
#

I thought we weren't allowed to edit other peoples mods

#

Or do you mean asking for permission and helping them with their own?

ancient grail
#

Often the driving force of any passion/craft is success (my opinion)
So to get that its best to do something simple now that u see it working ubcan aim higher

For me

ancient grail
#

Collaboration

drifting ore
#

But yeah, I've got lots of ideas but they are all RP server related.

ancient grail
#

Should be agreed upon initially
And we are allowed to touch those free for all mods

#

But its only ethical to credit the author even so

drifting ore
#

For example, creating a mini-economy type thing with just being able to give, take as an admin money. Pay money as a citizen. Get paid on time spent playing etc

ancient grail
#

You need to learn gui too for that too work out

#

And someone already did that

drifting ore
#

Oh really? We couldn't find anything similar ๐Ÿ˜ฎ

ancient grail
#

Chuck

drifting ore
#

Is it on the workshop?

ancient grail
#

Ye

drifting ore
#

I'll try and find it later, thank you for letting me know! ๐Ÿ™‚

thick karma
#

Rather than reconstructing an entire monetary system, expanding on existing systems could be easier and result in more value to the community

#

E.g. I want a shop mod that has gamepad support, but I'm not gonna go making yet another shop mod for that... I'll just write a patch for someone else's.

#

There are two highly rated shop mods on the workshop, one of which is Chuck's, one of which I think was written by Noir. I do not know Noir at all but Chuck seems like he would be easy to work with on this @drifting ore

drifting ore
#

I'm new to all this sorry ๐Ÿ˜”

thick karma
#

Well in some cases maybe but in this case no.

#

In this case, because Chuck is a responsive human being and an active modder, you could work with him on adding things via a secondary mod, added as its own workshop item (if say you want some private recognition for your efforts)

#

If a mod uses global variables to do stuff that you want to change, you can generally change those global variables (even functon or table definitions) from another mod; you can also import variables from other mods using require IF those mods return access to the functions, fields, or structures that you hope to influence.

#

In this case, if you're just trying to give people money under a variety of conditions, the money added by Chuck's mod can be utilized by your mod. It's not exactly a global variable per se but the items (e.g., coins or money bills) added by a shop mod will be available to your mod as well. You can reference the item scripts defining the forms of money just as if you were writin code in one of Chuck's files without even being in the same directory.

#

Thus you can e.g. add items to a player's inventory from any other mod you have running

#

And if you open mod.info and add "require=someOtherModID" where you replace someOtherModID with the real mod id (not to be confused with workshop id) of the shop mod, you can guarantee your mod will not run without the shop mod on which it depends

#

(However, passing your code along to other modders is also allowed. My personal plan was to simply edit Chuck's code locally to add gamepad support and send it back to him, but I literally mod as flarkin "Burryaga" so clearly idgaf that much about my name on stuff haha. I just want to make mods that improve the games I play. And it's nice when people use them because that makes me feel less alone in wanting what I want for the games I mod.)

#

(But I'm pretty sure Chuck would list you as a contributor if you wanted him to do that and you gave him an expansion worthy of being added to his mod.)

small topaz
#

hi! when defining the script.txt entry for an item, is it possible to add new data to it not predefined by the game? for example:

item MyNewItem
Weight = 0.5,
DisplayName = MyItem
NewData = add new data here
hot patrol
hot patrol
#

Thanks but all the work was done by Dislaik so cheers to him for the quality stuff

thick karma
#

So I'm working on making a light that follows the player, but I am curious about what happens to the light object when I reassign my lua variable to a new light object. Am I filling memory with unused light objects? (Seems likely.) If so, is there a way to delete these light objects I create as they become removed from cells?

Alternatively, is there a way to make a light track a player (preferably without any item in inventory or equipped) that is more naturally mobile than adding and removing an invisible lamp post all over the map as I move? (Doesn't seem to be lagging me in the first few minutes of testing, but I'm still concerned.)

Events.OnTick.Remove(doItToIt)

doItToIt = function()
    local player = getPlayer()

    if light then 
        player:getCell():removeLamppost(light)
    end

    light = IsoLightSource.new(player:getX(), player:getY(), player:getZ(), 0.3, 0.3, 0.3, 12)

    player:getCell():addLamppost(light)
end

Events.OnTick.Add(doItToIt)
#

I tried...

Events.OnTick.Remove(moveWithMe)

moveWithMe = function()

    local player = getPlayer()

    if darkvision then
        darkvision:setX(player:getX())
        darkvision:setY(player:getY())
        darkvision:setZ(player:getZ())
    else
        darkvision = IsoLightSource.new(player:getX(), player:getY(), player:getZ(), 0.3, 0.3, 0.3, 12)
        player:getCell():addLamppost(darkvision)
    end

end

Events.OnTick.Add(moveWithMe)

But the light doesn't move, unfortunately. Once it's added to the cell, its position is determined by something other than setting the light's position.

small topaz
# ancient grail Its allowed. And congrats

would be nice to have some mod announcement channel. modders could just post a link to their newest work and a specific channel for this could also make it easy for the non-modders here to stay updated about new stuff

ancient grail
#

yea thats been requested

thick karma
# ancient grail yea thats been requested

I would recategorize WORKSHOP as WORKSHOP MODDING and the channels would be support, mods, requests, releases, mapping, development, modeling, and mods would be purely for links to mods and updates about them.

#

And underscores can just go away, ew.

ancient grail
#

that would make it so that modders are given more credit which i believe we deserve

thick karma
#

Also we need a clear place not just for new releases but for mod requests

#

Requests get lost in our discussion channels all day

ancient grail
#

mapping can even have a sub category of tiles hehe

opal linden
#

is there a mod that adds npcs you can buy/sell stuff to?

thick karma
#

Sort of

opal linden
#

what do you mean

ancient grail
#

its not really an npc

#

but a tile

opal linden
#

that's fine too then

ancient grail
#

then that

thick karma
#

They look like NPCs

opal linden
#

does it support vehicles aswell

thick karma
#

That's as close as it gets afaik

#

No idea

ancient grail
#

i can build you a vehicle shop mod for the right price ๐Ÿ™‚

thick karma
#

From the link

#

So you can not only buy cars it seems but rotate them and such

#

Kinda fancy

opal linden
#

oooh

#

so like I don't need to write patches for modded items and vehicles right?

sage bluff
#

hi

#

is there a tutorial for making clothes

#

?

#

nevermind, found one

thick karma
#

@sage bluff not sure what you found but Dislaik's guides are good.

sage bluff
#

yeah i found this guide, thanks

thick karma
sage bluff
#

ok thanks

sour island
jagged ingot
#

Good morning.

#

I see that the name of this channel changed.

faint jewel
#

do not make us change it again.

jagged ingot
#

Upgrading some of my PZ projects by 10 sub-versions.

#

Some stuff as old as 41.68..

drifting ore
thick karma
#

@drifting ore No worries. Do you know how to read the code for any of your subscribed mods?

#

Also, @ anyone who knows, is there a simple way to get a float representing the overall lighting around the player (e.g., in their room), or would I need to try to write an algorithm for it (e.g. looping through nearby squares or squares in a room)?

bronze yoke
#

do you really need to check the entire room? lighting shouldn't be that crazy anyway

#

i've used self.character:getSquare():getLightLevel(self.character:getPlayerNum()) for literacy

thick karma
#

@bronze yoke Maybe not, I guess I could use a focusing system

#

I'm trying to tie the strength of a "darkvision" mechanic to the brightness of the room player is in

#

I tied it to square light level once actually, but it flickers rapidly as you run around and enter squares with wildly different lighting

#

I may try to add a timed adjustment mechanic where brightness fades in the direction implied by the square you're on after some minor delay, and see if that works better

#

another issue is I obviously impact the brightness of my square as the adjustment creates light on my location

#

Trying to see what options exist for working around those issues.

#

(Ultimately my darkvision is just a local light source with no sprite because I know of no other clean and simple ways of brightening the area around the player.)

naive inlet
#

Is it possible to mod the jawstab mechanic?

drifting ore
#

So purely making your own code to extend that code to show other things

#

Like you said I could use require to use the variables from the code, but is this sort of thing possible? Guess it's the thing in reverse

#

Perhaps, just throwing out an idea here from my limited programming language.. Intercepting when a server executes a command to do the same thing + additional?

#

Ideally it would be a function that could use a "if" statement to check if another function is being executed so... if friskCommandExecuted... getUI - items were already added --- code to add more items to the existing UI

fast galleon
drifting ore
#

Is there any documentation regarding that I can check out to learn from? Or a mod you know as an example?

fast galleon
#

base concept is, save local reference to the old function and assign a new function in place of the old function

drifting ore
#

Therefor breaking the rules?

#

Sorry if I misunderstood

fast galleon
#

this comes to mind right now

sour island
#

Thinking of adding a 'edit' option to modData for debug tools- not sure how practical it would be

drifting ore
#

This is very interesting what you linked, I'll spend some time examining it so apologies if I don't respond

#

it looks like what I need

fast galleon
#

depends, minimum is like copy paste the example mod

#

an example from a patch file for multiple mods

jagged ingot
#

Working on my Java API mod stuff today for modding tools. ๐Ÿ™‚

fast galleon
#
if getActivatedMods():contains("ReduceLagofCraftingMenu") then
    require "ISUI/ISCraftingCategoryUI"
    local function onCommandEntered(self)
        return self.parent.parent:refresh()
    end
    local ISCraftingCategoryUI_create = ISCraftingCategoryUI.create
    function ISCraftingCategoryUI:create(...)
        local r = ISCraftingCategoryUI_create(self,...)
        self.filterEntry.onCommandEntered = onCommandEntered
        return r
    end
end
jagged ingot
#

I like when people write overwrite code for Lua that involves calling the original function inside of an intercept function they write.

#

I did this with the MainScreen.update() and MainScreen.render() methods.

pseudo pewter
#

is this where i put things the devs should add?

#

or fix

jagged ingot
pseudo pewter
#

no its something they should add

sour island
#

Ovens don't use gasoline though

pseudo pewter
#

but it shouldve exploded

#

right?

sour island
#

Sure?

tulip tartan
#

Yeah it's not exploding

sour island
#

There's alot of stuff that doesn't interact with ovens

tulip tartan
#

He means like it should be added that if you cook a gas can in an oven it explodes

fast galleon
#

if you want it fast, add HasMetal tag to it?

pseudo pewter
#

?

fast galleon
#

You suggest something: devs think and maybe do something about it in time.
Until that happens you can do something yourself. e.g things with HasMetal tag, start fire in oven already.

#

btw, @pseudo pewter #frequentlyasked has the answer to your question, this channel is for making mods

rain shard
#

Hi guys! You've been very helpful so far.

Question: Is function CharacterCreationMain:initClothingDebug() specifically for when you enable all clothing options to be revealed? If so, I see that you can preface categories ala

    --        self:createClothingComboDebug("Eyes", "Eyes")
    --        self:createClothingComboDebug("Mask", "Mask")```

But is it strictly limited to categories? Is there a way to specify items to, say, not show up entirely in the char creation?
drifting ore
#

Sorry to interrupt if you guys are helping others, this one could be a quick answer. Is there a way to test multiplayer mods that work with other players while solo in game? Like, is there an object you can spawn that acts as another player?

#

AFAIK you can't run 2 instances of the game to test it out on yourself

thick karma
# drifting ore I know. By the way, is there a way to inject your own code into the mods code? F...

Poltergeist is giving you good advice here imo. Often you can "decorate" or "hook" other modders' functions. At its simplest:

-- theOriginalClass.theOriginalFunction may be declared with : instead of .
-- However, it will still be referenced below using ., because : notation
-- is only used to define functions and pass variables (afaik).
local yourBackupOfTheOriginalFunction = theOriginalClass.theOriginalFunction

-- You could also replace : with . if you do not plan to use
-- this function with references to self. This example pretends
-- that theOriginalFunction is accessed using :, implying
-- that it WILL make use of a self object that gets passed implicitly.
function theOriginalClass:theOriginalFunction(theOriginalParameters)

  -- Stuff you wanna do before that function happens.

  -- You only need self below if you use a colon when calling this function.
  -- If you had said theOriginalClass.theOriginalFunction (i.e., if that's how
  -- the original function were defined), then you would not need "self, " below
  yourBackupOfTheOriginalFunction(self, theOriginalParameters)

  -- Stuff you wanna do after that function happens.

end```
fast galleon
#

oh, I thought chuck's message was about setting what you want, I think there are better instructions somewhere

thick karma
#

-nosteam on all instances of the game launched that way

drifting ore
#

This is all very good material to study from, thank you guys so much

thick karma
#

You can also launch one -nosteam from Steam (ironically) using Launch Options. I do this for gamepad support.

bronze yoke
thick karma
#

Many vanilla objects and functions are global, allowing you to decorate them this way, but not all mods offer equal access to their functions / objects. Some you can access without concern, but others will need to be required using require, and others will be exclusively local, in which case you won't be able to decorate them. And some functions are defined anonymously, making their interception / modification beyond my knowledge (anyone else know whether anonymous functions can be found and modded by some super advanced hackery?)

#

Like say I add an anonymous function to OnTick, can you find that somehow and remove it? Could / how could it be identified?

drifting ore
#

I'm trying to connect into the game like how I read on the pins but it just won't allow it :/

#

I have 2 versions of the game but it either won't connect at all (it sees the server) or it wll say that the player is already connected to the game.

#

I'm dumb nvm

drifting ore
drifting stump
#
function table:doSomething() end
-- shorthand for
function table.doSomething(self) end
bronze yoke
#

i chose not to mention that since it's just uglier

thick karma
#

haha I chose not to confuse them (more than I already have)

drifting stump
#

and calling a function with : passes the thing before as the self parameter

thick karma
#

Seems like it came out years ago, curious why it still has no gamepad support, wondering if it has just gone unused or what.

frozen edge
#

is there an event that fires when rotten food becomes compost?

#

actually to be specific im wondering if there's a way to change the input for a composter and the output. Like the 10% worms thing, maybe making a chance for rotten food to create seeds

agile vigil
split geyser
#

Hello and good evening everyone.
I am completely new here and ended up here on the discord through my search in the indie forum.
I've been trying to figure out how to create a mod pack for a while.
Unfortunately, I couldn't find exact instructions anywhere.
I've been rummaging around here for a while, but haven't found anything yet.
I would be very happy if someone could give me hints in which posts or where I can find something like that. ty and greetings to all

kind forge
#

where is the tailoring skill coded? like the processes of adding patches/repairs etc

wheat kraken
kind forge
hot patrol
#

I want something to pair up with the fixed one true cure mod

#

also this one lets you use 2 handed weapons in offhand which makes them OP due to the attack speed. Ideally I would only want it usable for 1 handed weapons. If anyone think they can do it I would be willing to pay to have it done

split geyser
wheat kraken
#

oh i got it, i missunderstood what you mean by modpack

split geyser
pulsar heath
#

im using filewriter and filereader to detect when a file has been modified but it feels a bit... arcaic and stupid... is there any way to do that? Since that i know off, theres no way to use lfs

#

apart from using the method im using... which makes me compare the values of a stored file with the actual existing file every x time

bronze yoke
#

i doubt it, filesystem stuff is pretty restricted

pulsar heath
#

yeah... the only way i managed to do so was to read the file into memory, and every X minutes passed read the file again compare it to the stored one and use logic to get a result...

ancient grail
#

question.. if need reduce consumption of propane when a certain modded trait is active
i need to hook/overwrite the vanilla codes right?

#

tbh ihavent checked how the vanilla does it . im just assuming its on a lua code or is probably a recipe code which i doubt
but could be possible

bronze yoke
pulsar heath
#

thats the way im gonna do it when everything works in a basic way... baby steps ๐Ÿ™‚

#

but was hopping there was another way to do so... for now if the file has text in it, copy it to memory and delete de file contents

#

then every x minutes check if the file content is not nill and copy it again to memory

#

basic but functional... feels "dirty" though...

#

and since im using json from the app that creates the file, eventually ill check only for change in some data fields or just one... and pull whatever i want from that file and leave it alone apart from changing one field from 0 to 1 or true to false or whatever flag i feel like using for the value... but it feel over complicated to do something so simple as to check if a file has been modified...

eternal garnet
#

When looking at things such as

BiteDefense = 100,
BulletDefense = 100,
WindResistance = 100,
WaterResistance = 100,

Is there a list of all the types of Defence and Resistances, or is what I just put all that there is in the game?

ancient grail
#
#

Sorry just checked its not there

vague rose
#

Hello.
Anyone have some nice bot to display on discord info about killed zombi, deaths etc...

ancient grail
#

But i guess u got all of em

eternal garnet
#

I appreciate it anyway, but thank you for posting that, that may come in handy for other things

dull moss
#

what'd be best way to track how much time has passed since player did XYZ? Add timestamp in moddata and check against it every now and then?

bronze yoke
#

you can find all valid parameters in Item.DoParam

#

i don't see any omissions jumping out at me but this list is a little old

pulsar heath
vague rose
#

@pulsar heath eggdrop ?

craggy hearth
#

guys ive never really modded anything ever, but does anyone know how i would go about changing the item spawn locations, rates, etc? there are no videos on youtube about this and i think id be fun to mess around with

craggy hearth
#

i guess what i really should be asking is where to start with modding pz. i dont know any lua, but i know some (and thats a stretch) python and ive heard theyre pretty similar. any resources/videos i could watch to get started?

amber fiber
#

Is there a way to change how players are perceived by zombies? like making them not look like a thread?

pulsar heath
dull moss
#

Any way to catch any prints in lua files that are loaded on game boot? got some issue with traits system, wanna check if my stuff catches somethin correctly

#

creation methods and stuff

bronze yoke
#

read the log file?

dull moss
#

tried to buy maybe missed it, lemme try again

#

this game sometimes KekW

#

I was subbed to my mod while working on it in my dev workshop folder

#

and it was loading luas from workshop

dusk saddle
#

Howdy folks! I've had an issue with my mod for, well, it's entire existence which has plagued me for a while. I can't really seem to figure it out, and some other folks who have helped me haven't been able to either.

I'm trying to get packages of food to give you the fresh/stale/rotten equivalent of the container, though no matter what they will always yield fresh items. I'm using OnCreate recipes for the results, here's an example from a Lunchable item:

    --Medium Snackable Ham and Cheddar
function Recipe.OnCreate.OpenMedSnackableHamCheddar(items, result, player)
    player:getInventory():AddItems("PompsItems.PIRitz", 5);
    player:getInventory():AddItems("PompsItems.PIHam", 5);
    player:getInventory():AddItems("PompsItems.PICheddar", 5);
    player:getInventory():AddItems("PompsItems.POreoVanilla", 2);
end

The base recipe item is an empty container, while the OnCreate stuff is all the food. Would anybody be willing to help me out with getting this longstanding issue resolved?

thick karma
vast nacelle
amber fiber
vast nacelle
#

AddItems returns an arraylist of the items you added, so you can just loop through each group with something like:

for i=0, items:size()-1 do
if items:get(i):getType() == "[YOURFOODBOXTYPE]" then
sourceContainer = items:get(i);
break;
end
end
local foodList = player:getInventory():AddItems("PompsItems.PIRitz", 5);
if sourceContainer then
for i=0, foodList:size()-1 do 
    local item = foodList:get(i);
    item:setAge(sourceContainer:getAge());
    item:setOffAgeMax(sourceContainer:getOffAgeMax());
    item:setOffAge(sourceContainer:getOffAge());
end
end```
and I think that should get you your food items with the same age as your source
dusk saddle
#

Ah, sweet. Thank you very much!

ancient grail
#

ZombRandFloat thats a thing ? Niceee

#

Hi @dusk saddle

dusk saddle
#

Howdy!

ancient grail
#

Question
If the function or variable is local on the vanilla lua

You can just use it even if you require am i correct?

bronze yoke
#

no

#

you can't access a local from another file

#

unless it's returned by something, but afaik vanilla literally never does this

fast galleon
#

Anybody know a guide for erosion?
*found and old link from 2013, gonna check that later.

v.41.78
#1. erosion is not modable with code, mostly set with map tools.
#2. erosion objects spawn only once. Objects like trees can give false impression of that because of the speed they appear with.

agile vigil
# frozen edge is there an event that fires when rotten food becomes compost?

Edit: As Albion pointed out, this solution probably won't work, as the IsoCompost.update function is called from Java, and not from Lua.

There's no direct event for when rotten food becomes compost, but you may have some luck using Chuck's Java decoration strategy to look at the IsoCompost's container when it updates.

As pseudocode:

local oldIsoCompostUpdate = getJavaMethod(IsoCompost.update)
function myIsoCompostUpdate(self)
  local previousItems = makeListOfContainerContents(self:getContainerByType("composter"))
  self.update()
  local newItems = makeListOfContainerContents(self.container)
  -- do what you will with previous and new items here
end

It won't be pretty (there's a bit of boilerplate to decorate Java functions), but it might be workable enough for your use case.

Note that items have IDs, so you can safely just make a third list of "itemsComposted" by removing all duplicate ids in currentItems based on the items in newItems, and vice-versa for "itemsGenerated"

The way to decorate Java methods can be found here < in Chuck's code, the functions called
patchClassMethod.create and patchClassMethod.apply()
https://github.com/ChuckTheSheep/Skill-Recovery-Journal/blob/main/Contents/mods/Skill Recovery Journal/media/lua/client/Skill Recovery Journal XP.lua

Hopefully this helps!

bronze yoke
#

will this really work? messing with metatables should only affect methods when called directly from lua

agile vigil
#

I forgot the link to Chuck's code, but you may be right ๐Ÿ˜ฆ

#

Yeah, you're probably right. Damn it, I actually thought this was a solvable problem for a tick.

#

So alternative solutions would be.. Using an event that fires every second and storing the IsoCompost tiles in moddata to check 'em out?

fast galleon
#

Would you find notes on StashSystem useful?

ancient grail
#

anyone knows where i can find the zombie knockdown.. the debug

function DebugContextMenu.OnSelectedZombieKnockDown(hitFromBehind)
    local zombie = DebugContextMenu.selectedZombie
    zombie:knockDown(hitFromBehind)
end

this didnt work for me

#
local function zedSnared(zombie)
if not zombie then return end
local sq = zombie:getSquare()
    for i=0, sq:getObjects():size()-1 do
    local obj = sq:getObjects():get(i)
        local spr = obj:getSprite():getName()
       -- print(spr)
            if spr == snareOpen then 
                zombie:knockDown(hitFromBehind)
                getSoundManager():PlayWorldSound('BearTrapSound', zombie:getSquare(), 0, 5, 5, false);  
                addSound(zombie, zombie:getX(), zombie:getY(), zombie:getZ(), 5, 1)
                obj:setSprite(snareClose)
                obj:getSprite():setName(snareClose)
                obj:transmitUpdatedSpriteToServer();
                obj:transmitUpdatedSpriteToClients();
                if isClient() then obj:transmitCompleteItemToServer(); end
                getPlayerLoot(0):refreshBackpacks()   
            end
    end
end
Events.OnZombieUpdate.Add(zedSnared) 
#

or maybe cuz the lua is on the client folder

bronze yoke
#

what is hitFromBehind?

ancient grail
#

thats from vanilla

bronze yoke
#

it's an argument to the function

ancient grail
#

debugcontextmenu

bronze yoke
#

you need to find out what the value actually needs to be

ancient grail
#

but theres no knockDown function

#

thats exactly what the vanilla wrote

vast nacelle
#

In the base game usage, true or false.
In zedSnared, since its undefined, it'd be "defined" as nil here and evaluate as False, right?

ancient grail
bronze yoke
#

you copied it but you didn't define hitFromBehind in your code

#

so you're just passing nil

ancient grail
#

hmmm

drifting ore
#

Morning all

bronze yoke
#

in vanilla it was passed as an argument

ancient grail
#

so the regular stagger effect works on zed cuz i dont see where the knockdown function goes

drifting ore
#

Wondering how one would go about selecting a player you right clicked in code. I looked through other examples and it seems like you use something similiar or exactly to self.other but I cannot figure it out

drifting ore
#

I'll look into that

ancient grail
#

Its not in the lua

vast nacelle
# ancient grail Its not in the lua

In DebugContexMenu.lua:
option = subMenu:addOption("Selected: Knock Backward", false, DebugContextMenu.OnSelectedZombieKnockDown)
option = subMenu:addOption("Selected: Knock Forward", true, DebugContextMenu.OnSelectedZombieKnockDown)

#

But knockdown is indeed a java func

bronze yoke
#

replace it with a boolean value

ancient grail
#

Maybe theres a setKnockDown

Ill look at the wiki for zed stuff

ancient grail
ancient grail
#

Yeah found that ah missed it

#

๐Ÿ˜… apologies and thank you