#mod_development

1 messages Β· Page 299 of 1

umbral raptor
#

doesn't work, gives errors

jaunty marten
umbral raptor
#

it's in line 2

#

this is for B42 btw

#

cool, well how do i make that part into my recipe on.create code? as i said, im basically illiterate in lua

#

like i know there is a bunch of local commands and stuff

#

so im not sure how to put that in

jaunty marten
#

oh, 42.. I'm sure for 99% that it should work for 41 but I'm totally not sure about 42. I'm waiting for stable build xd

winter bolt
#
function Recipe.OnCreate.KeepItemsInContainer(items, newContainer, player)
  local currentContainer = items:get(0)

  newContainer:getItemContainer():setItems(currentContainer:getItemContainer():getItems())
end

this should work i think

#

wrong reply oops

jaunty marten
#

oh, :setItems, yea

umbral raptor
#

it should be placed in lua/server right?

#

thats where recipecode file is

winter bolt
#

yeah

umbral raptor
vast pier
cloud depot
#

Im having a perplexing issue. I made a little voice pack mod, the local version worked fine, but ever since I uploaded to workshop both the local version and the version downloaded from the workshop brick my mod manager. Pulls up the stacktrace screen when I click on mods in the main menu.

cloud depot
umbral raptor
#

can u send the file?

cloud depot
#

like workshop link?

umbral raptor
#

or u can send it as compressed rar to me

#

i'll check it out for you and see what i can find.

cloud depot
umbral raptor
#

they can save u alot of time in finding bugs

cloud depot
#

its just weird cause it was working fine as a local mod, until I uploaded to workshop

umbral raptor
#

like when u uploading the mod

cloud depot
#

huh, deleting the workshop.txt from the local copy fixed it. think i should just reupload??

noble shell
#

Sorry to tag you again, but how do you deal with dependencies error when recompiling? I saw you mentioned in the chat history that you would put everything but the modified java file into a jar, and use the jar as dependency? Did I understand that correctly?

winter bolt
#

if you do something like if not modInfo then return end it should avoid the error but it depends on what the code is doing

cloud depot
#

For some reason reuploading the mod with a new workshopID seemed to fix it. I rly have no idea. stressed

winter bolt
#

steam moment

cloud depot
#

Also thanks for the guide on custom voice packs, spongie!!

bronze yoke
#

you basically just need to make a new folder, copy every .jar file in the game directory into it, make every loose folder containing class files in the game directory into a jar (you can just turn them into .zip and rename), and then do javac -cp "dependencies/folder/*" "file/you/want/to/recompile.java"

#

these folders + zombie should contain classes

noble shell
noble shell
bronze yoke
#

you need those directories too

noble shell
#

Thank you spiffo

dull moss
drifting ore
#

Can I change how long a custom food item takes to be eaten by the player? Time : 50.00 does not work and I can't find any information on it

dull moss
#

casually changing default options KekW

vast pier
# dull moss lmao

Full list of sandbox options that this mod changes without telling you

Starting day from 9th to 23rd
Zombie speed from Random to Fast Shamblers
Zombie Sprinter amount from None to Normal
Zombie Toughness from Random to Normal
Zombie Sight from Random to Normal
Zombie Hearing from Random to Normal
Zombie Population from 0.65 to 0.64999(Repeating)
Generator Spawns from Rare to Normal
Locked House Frequency from Very Often to Sometimes
World Item Removal list from Base.Hat,Base.Glasses,Base.Maggots,Base.Slug,Base.Slug2,Base.Snail,Base.Worm to Base.Hat,Base.Glasses
Time Before Corpse Removal from 216 to -1
Character Nutrition System from True to False
Recent Survivor Vehicles from Low to Normal
Vehicle Spawn Rate from Low to Normal
Chance Has Gas from Low to Normal
Initial Gas from Low to Normal
Locked Vehicle Frequency from Rare to Sometimes
General Condition from Low to Normal
Vehicle Alarm Frequency from Extremely Rare to Sometimes```
dull moss
vast pier
#

The ones that really confuse me are

Starting 14 days later than you normally would???
Sprinters going from non existent to being "normal"
Locked houses seemingly unlocking themselves??```
#

I installed this mod to make it so I can disable house raiders and make them wandering bandits instead.
I did NOT install this mod to add sprinters to my vanilla settings

#

Bad mod etiquette

dull moss
#

wcyd

bronze yoke
#

that's bizarre

#

i see what they did

#

they overwrote the lua files that define the prefixes with a bunch of bandits options for some reason

winter bolt
#

damn i was too late i just checked the mod and was about the point that out

bronze yoke
#

but they removed all the original stuff so all options go to their code default values (which do not actually line up with the in-game defaults which are just the apocalypse preset)

winter bolt
#

they should be able to fix it by doing something like this right?

local apocalypse = require(Sandbox/Apocalypse)
apocalypse.Bandits = {
...
}
icy night
#

I'm making a VHS movie mod. Aiming to have like 100+ movies altogether. Im wondering what yall think of the captions: too long/short/boring?

#

Heres one:` Groundhog Day (1993):
Bill Murray as Phil Connors
Andie MacDowell as Rita
Chris Elliott as Larry
Comedy / Fantasy

"It's February first, Phil. You know what tomorrow is?"
"It's a cute story."
"He comes out, he looks around, he wrinkles up his little nose, he sniffs around a little, he sees his shadow, he doesn't see his shadow -- it's nice."
"Many people like it"
"Many people are morons."
"You know what's wrong with you, Phil? You're selfish."
"You don't have time for anyone but yourself."
"That's what I'm trying to tell you. You don't want to be with me. You can do better."
"Okay, campers, rise and shine, and don't forget your booties because it's COOOLD out there today!"
"It's cold out there everyday. What is this -- Miami Beach?"
"Sorry, ladies and gentlemen, but it looks like it's going to be a long winter."
"Awwwwwww"
"We're closin' the road. Big accident up ahead. Blizzard movin' in."
"Nice going guys. That's yesterday's tape."
"Think it'll be an early Spring?"
"Didn't we do this yesterday?"
"Don't mess with me, pork chop. What day is this?"
"I'm not talking about last year. I'm talking about today. I lived it before."
"I shaved my head last night, today its all grown back."
"Last night I got completely loaded and drove head-on into a police car."
"Rita, if you only had one day to live, what would you do with it?"
"There's only one way out now. Just remember… we had a wonderful day together once."
"Jake! Call the police, and get the word out. Somebody kidnapped Phil."
"Let's go! Phil just snatched the groundhog!"
"I'm A god. Not THE God -- at least I don't think I am."
"I know all about you, Rita."
"I could never tell you this, but from the first minute I looked at you I wanted to just hold you close and be with you forever."
"I've been waiting for you every day for ten thousand years."
"I dream of you every night of my life."
"Are you always this jolly in the morning?"
"No groundhog! Rita! They're all gone!"`

#

so far I've made 14 such captions for movies

jovial valley
#

I have been trying to make a .lua that would allow me to have the effect of putting an item on the floor when it would otherwise insert itself into the players inv but i cant get it to work. (think crafting and foraging)
Things I have tried
-a .lua that ejects items with a specific tag from containers
--this one simply didn't do anything, so it might be doable but IDK how as im new to .lua
-a .lua that utilizes the new item breaking system from build 42, by breaking a debug item OnCreat, that drops the usable item
--it 1 wont drop its 'head' item innless its already in player inv, and OnCreate breaks it before it gets put in inv, and 2 keeps the original item in a broken form, insted of deleting
-making it so heavy that the player wants to drop it
--in foraging you can't pick it up and bring it into existence unless you have room in inv (and its janky)

I am extremely new to .lua so i might need a bit more explanation than most

noble shell
bronze yoke
#

πŸ˜”

noble shell
#

Old lighting can be toggled with the HOME button, it does show IsoPlayer objects again, but it's hella broken with the current translucent layer system

vast pier
#

Not sure how to do the rest of what you're wanting, but this is what the game uses to drop broken glass on the floor instead of putting it in your inventory when your bottle weapon breaks

jovial valley
#

I'm seeing what I can do with that

sly ivy
#

well thats,

#

different

vast pier
ornate sand
#

"Son, how high are you?"
"No Officer! It's 'hi, how are you?'"

sly ivy
ornate sand
sly ivy
#

boned?

#

the FBX was massive tbf i could try scaling it down alot

ornate sand
#

Yeah fyi PZ's own 3D models are scaled down to 0.01 of their actual size

sly ivy
#

yea i think thats what i forgot,

#

but i dont understand why it looks like it exploded XD

ornate sand
#

Because it's trying to start at one point but because it's so yuge, every vertice is spread 100x farther than they should?

sly ivy
#

AHHH

#

I get it!

#

Capslock?

#

Also thanks!

jovial valley
#

i put "HCSM.MineableZone1" as something a OnBreak lua code would use, but in game it is saying "base.MineableZone1" which is not what i put

jovial valley
#
    if item and item:getCondition() > 0 then
        item:setCondition(item:getCondition() - 1)
    end
end

function OnBreak.MineableZone1DB(item, player)
    OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
    inv = player:getInventory()
    inv:Remove(item)
end

btw this is the file im talking about

knotty stone
#

Is ther a way to make it possible on table install {requireInstalled = Enginedoor,} to say only possbile if the enginedoor is of a certain itemtype, like sport for example?

umbral raptor
#

question, how do i make an item spawn with it's drainable empty?

tacit pebble
#

just wondering, can i use Β± for sandbox tooltip? I heard some special characters have a chance not to be shown.

bright fog
fathom dust
#

Anyone know where code for the push part of shoving a zombie is? I'd like to replicate the ability to shove a zombie using an item but I am having trouble finding relevant code.

bright fog
#

Give me a sec

#
-- Staggers the `zombie` based on a given `hitReaction` or determines it thanks to the `handWeapon`.
---@param zombie IsoZombie
---@param attacker IsoGameCharacter
---@param handWeapon HandWeapon
---@param hitReaction string
ZomboidForge.StaggerZombie = function(zombie,attacker,handWeapon,hitReaction)
    hitReaction = hitReaction or ZomboidForge.DetermineHitReaction(attacker, zombie, handWeapon)
    ZomboidForge.ApplyHitReaction(zombie,attacker,hitReaction)
end
bright fog
#

At least for B41

fathom dust
#

thanks a bunch! i'll look it over

bright fog
#

Either way you can find the original in the java

fathom dust
#

yeah i figure this should at least point me in the right direction

bright fog
#

πŸ‘Œ

tacit pebble
#

hmm.. sometimes OnFillContainer(Event) gives something else for container arg??

-- lua
local function randomBackpack_OnFillContainer(roomType, containerType, container)
    print("CheckThis!: " .. tostring(container))
    local backpacks = container:getItemsFromCategory("Bag")
    local containers = container:getItemsFromCategory("Container")
-- console.txt
CheckThis!: ItemContainer:[type:Wallet_Female, parent:null] -- This is normal
CheckThis!: zombie.inventory.ItemPickerJava$ItemPickerContainer@16a72318 -- but sometimes, this is returned.

second on seems not ItemContainer, it's something like ItemPickerContainer?

how can I check for this, anyone have good ideas? i just want to skip checking when it's not ItemContainer.

vocal vector
#

its a bit funny that what i did went quite cosmically wrong, thats life when you are hacking things together that you barely understand πŸ™ƒ

bright fog
#

instanceof(container,"ItemContainer")

#

Returns true if ItemContainer

winter bolt
#

ive seen a few vanilla scripts dont use them so idk if it makes a difference but try it with this instead local apocalypse = require("Sandbox/Apocalypse")

tacit pebble
bright fog
vocal vector
#

ive literally just put in that though, does it need to be run from an event to work?

winter bolt
#

it should just work i think?

drifting ore
#

Can I change how long a custom food item takes to be eaten by the player? Time : 50.00 does not work and I can't find any information on it

vocal vector
echo lark
#

Hey, wondering if anyone can help me out here, Some containers only accept specific items, not sure if its only some mod containers but the container im asking about is modded and only accept logs/logstacks/planks and stuff, but i cannot find the code that determines what is allowed in that container. Does anyone know where/how i could find that? Ive scoured the mod and it seems to be something to do with the containers property but i cannot find any other information on it.

#

ah nevermind i think i found it XD

#

spent the last hour trying to figure it out before asking for help then i magically find it

distant inlet
#

does anyone know how to get the user-input text from ISTextBox when initializing it with ISTextBox:new(..., callbackFunc) from a function "callbackFunc"?

jovial valley
#

this .lua is in the shared folder, and is not getting recognized by the game
i have tried
replacing local function with function (in fact this was its normal state)
having it in other .lua locations
this is a example of an item that uses it

    {
        DisplayCategory = Material,
        Weight    =    1,
        ConditionMax = 1,
        Type    =    Normal,
        DisplayName    =    Investigate Further,
        Icon    =    important,
        OnCreate = LowerItemCondition,
        OnBreak = OnBreakMineableZone1DB,
    }```
bronze yoke
#

it cannot find local functions

jovial valley
#

"replacing local function with function (in fact this was its normal state)
"

bronze yoke
#

do not name your function things like 'LowerItemCondition', this is insanely generic and the chance of another mod conflicting is very high

jovial valley
#

ok but no other mods were enabled, so fixing that wont fix the issue

#

so i fixed it being generic but i still need to fix that none of the functions are being seen by the game

bronze yoke
#

make sure your file is loading, you should see its name in the console.txt

distant inlet
jovial valley
#

ok i found the solution to the first prob but now
inv = player:getInventory() is being flagged in game (DB mode) as an error, there is no error in console

jovial valley
#
    OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
    player:getInventory();Remove(item)
end```
this gives an ingame DB error
```function OnBreakMineableZone1DB(item, player)
    OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
    inv = player:getInventory()
    inv:Remove(item)
end```
does the same thing, 
the console points at `inv = player:getInventory() ` or `player:getInventory();Remove(item)`, but does not say its an error it says `function: OnBreakMineableZone1DB -- file: debug_luaHHB.lua line # 16 | MOD: Hothead's random crapola mining-part` idk what that means though
can someone can help explain what's wrong?
vast pier
#

https://steamcommunity.com/sharedfiles/filedetails/?id=3419268636

Inspired by "A stomp nerf mod" by nigel
(link to their mod)

This mod expands on the concept in build 42.

Trench Foot - Stomp Properties
Makes stomping zombies degrade shoes/socks based on the footwear stats, and your Maintenance/Tailoring Skill.
Also adds a chance to get foot pain from stomping without socks, and/or with broken shoes.
Socks are less likely to be damaged when wearing good condition shoes.

Trench Foot - Discomfort
Adds 0.1 discomfort to boots, nothing else.
icy night
#

Does category = "Retail-VHS ", determine if vhs' spawn in stores and not in houses? And if spawning = 0, will it prevent it's spawn?

#

Anyone know?

vast pier
jovial valley
#

and i don't know how to get ether

undone elbow
umbral raptor
#

Does anyone know why this is causing the game to break?

craftRecipe ElectricLanternRemoveBattery
{
        timedAction = DismantleElectrical,
    Time = 30,
    AllowBatchCraft = False,
    Tags = InHandCraft;CanBeDoneInDark,
    OnCreate = Recipe.OnCreate.TorchBatteryRemoval,
        category = Electrical,
    inputs
    {
        item 1 tags[SupportCorps.Lantern_Electric;UsesBattery] mode:keep flags[NotEmpty;ItemCount],
    }
    outputs
    {
        item 1 Base.Battery,
    }
}

craftRecipe ElectricLanternInsertBattery
{
        timedAction = MakingElectrical,
    Time = 30,
    OnCreate = Recipe.OnCreate.TorchBatteryInsert,
    Tags = InHandCraft;CanBeDoneInDark,
        category = Electrical,
    inputs
    {
        item 1 tags[SupportCorps.Lantern_Electric;UsesBattery] flags[IsEmpty;AllowFavorite;ItemCount] mode:keep,
        item 1 [Base.Battery;] flags[ItemCount] mode:destroy,
    }
    outputs
    {
    }
}
#

its the exact same as the vanilla electrical recipes

#

even without the oncreate it doesn't work.

undone elbow
#

I guess ;]

umbral raptor
#

its in other recipes and works completely fine

undone elbow
#

Check the logs then, I guess there should be a hint.

noble shell
vague marsh
umbral raptor
#

i found out whats causing the crashing

#

its this
;UsesBattery

#

i put it in and it breaks the game

bronze yoke
#

you specified SupportCorps.Lantern_Electric as a tag but that looks like an item

#

the game crashes if you specify a tag that doesn't exist

umbral raptor
#

thats the item's name?

#

where do i put the item then?

#

also i changed a bit in the code

#

craftRecipe ELRemoveBattery
{
Time = 30,
timedAction = DismantleElectrical,
AllowBatchCraft = False,
Tags = InHandCraft;CanBeDoneInDark,
OnCreate = Recipe.OnCreate.TorchBatteryRemoval,
Category = Electrical,
inputs
{
item 1 tags[SupportCorps.LanternElectric;UsesBattery] mode:keep flags[NotEmpty;ItemCount],
}
outputs
{
item 1 Base.Battery,
}
}

craftRecipe ELInsertBattery
{
    Time = 30,
        timedAction = MakingElectrical,
    AllowBatchCraft = False,
    Tags = InHandCraft;CanBeDoneInDark,
    OnCreate = Recipe.OnCreate.TorchBatteryRemoval,
        Category = Electrical,
    inputs
    {
        item 1 tags[SupportCorps.LanternElectric;UsesBattery] flags[IsEmpty;ItemCount] mode:keep,
        item 1 [Base.Battery;] flags[ItemCount] mode:destroy,
    }
    outputs
    {

    }
}
#

currently this works without usesbattery and itemcount

#

but it doesn't drain the lantern

#

so i can't access the insertbattery one

thorn abyss
#

I hope we get access to the CombatManager at some point cuz I need to access a static method of it grr

prime wing
#

What's the best videos/tutorials to watch before creating a mod?πŸ—Ώ

bright fog
coarse bay
#

how do you like make an item give u happines and stuff? without it being like a food or a book. So just some normal item u can use and when u do u get some stuff/something happens

coarse bay
#

cant figure this simple stuff for the life of me

silent zealot
#

What is the tigger that will cause the happiness gain?

#

You can add lua code there such as: oldHappy = player:getBodyDamage():getUnhappynessLevel() newHappy = oldHappy + 0.05 player:getBodyDamage():setUnhappynessLevel(newHappy)

silent zealot
coarse bay
silent zealot
#

What does "used" mean?

#

Right Click -> select a new context menu entry you will add, or something else?

coarse bay
#

yeah something like that

#

i found some stuff up there but couldnt get stuff working as i didnt know what functions to call to set stuff

silent zealot
#

Adding a context menu entry that calls a function is easy - here's an example:```local doDIYContextMenu = function(playerNum, context, items)
local primaryItem = items[1]
if not instanceof(primaryItem, "InventoryItem") then
primaryItem = primaryItem.items[1]
end

if primaryItem:hasTag("DIYSchematic") then
    print("##### It's a DIY Scematic")
    local playerObj = getSpecificPlayer(playerNum)
    readOption = context:addOption(getText("ContextMenu_ReadDIY"), items, DIYonLiteratureItems, playerObj);
end

end

Events.OnFillInventoryObjectContextMenu.Add(doDIYContextMenu)```

#

So every time the game populates the right click context meny for an inventory item it will trigger doDIYContextMenu() because it has been added to the OnFillInventoryObjectContextMenu event

#

then that function says "If the item has the tag DIYSchematic then <do stuff>

coarse bay
#

is tag just the name or

silent zealot
#

for your case it would be a check like "if primaryItem:getType()=="Base.SomeItem"

#

Tags are the tags that items can have in their defintions. So you can use hasTag("hammer") instead of (is a "clawhammer" or is a "clubhammer" or is a "ballpeenhammer" or is a "smithinghammer"...

coarse bay
#
local addContextOption = function(playerNum, context, items)
    local primaryItem = items[1]
    if not instanceof(primaryItem, "InventoryItem") then
        primaryItem = primaryItem.items[1]
    end

    if primaryItem:getFullType() == "Base.Cube" then
        local playerObj = getSpecificPlayer(playerNum)
        context:addOption("Use", items, handleOptionClicked, playerObj, primaryItem)
    end
end

so would this pass the item to the other function correctly?

#

or should i do it other way?

#

and then from the other one i can interact with the used object right

silent zealot
#

is handleOptionClicked the function that you want to trigger?

coarse bay
#

yes

coarse bay
silent zealot
#

yes, that will add a context entry "Use" and I can't remember exactly how the other fields all get turned into function parameters in the correct order... might need to adjust it slightly to get the correct prarameters into the function call.

silent zealot
#

The game tracks unhappyness rather than happyness.

coarse bay
silent zealot
#

honestly, I'm not certain - I'd have to find an example and figure it out

#

I think you're correct

coarse bay
#

hmm alright, and this goes to local folder right

silent zealot
#

context:addOption("label for option", parameter1, function, paramerter2, parameter3......)

tacit pebble
#

context name for first
target(what thing you want to use) for second (opt)
onSelect(What will you do when you click) for third (opt)
as far as i'm aware

silent zealot
#

trial and error lol

#

make yoru function print out the arguments for troubleshoting if it's not clear.

silent zealot
coarse bay
#

yeah that i meant

silent zealot
#

the client/shared/server distinction doesn't actually do much, it's mostly more helpful to organize code, but this is definitely "client" stuff.

coarse bay
silent zealot
#

One of the modders in this channel maintains it, but I forget who.

coarse bay
#

is there for b41?

tacit pebble
silent zealot
#

Yes, but I don't have a handy bookmark for B41 javadocs.

tidal agate
#

can someone helo me

silent zealot
#

helo!

tidal agate
#

im getting this error when i want to load my saves

silent zealot
silent zealot
#

(also, open up console.txt and search for "exception" - sometimes it will be really obvious what is breaking when you do that)

coarse bay
#
local handleOptionClicked = function(items, playerObj, primaryItem)
    if not playerObj then return end

    -- Increase happiness (reduce unhappiness)
    oldHappy = playerObj:getBodyDamage():getUnhappynessLevel()
    newHappy = oldHappy - 5    
    playerObj:getBodyDamage():setUnhappynessLevel(newHappy)

    -- Remove the cube from the player's inventory
    if primaryItem then
        playerObj:getInventory():Remove(primaryItem)
    end
end

So I guess this would be it?

tidal agate
coarse bay
coarse bay
#

yeah if its that, you know how food has like ho mow much hunger gives

noble shell
bright fog
#

almost all

noble shell
#

So far I only saw people reporting RU, UA and PTBR on my mod that they switched to UTF-8. Maybe I should check others too

noble shell
#

Thanks for letting me know tho πŸ‘

tacit pebble
#

UTF-16 for Korean

sharp plinth
dull moss
frank elbow
#

I hope they give the same treatment to the 4 languages that were left out

dull moss
#

which ones? KekW

frank elbow
#

Argentinian Spanish, Catalan, Czech, & Korean

jovial valley
#

is there a way to have a .lua function have a short delay from when its called on to when it triggers?

dull moss
#

yes

#

from the top of my head make an event that setsup another event

#

for example, 1st event adds coounter increase every OneMinute and when it hits 10 you fire what you wanted to be delayed

winter bolt
# jovial valley is there a way to have a .lua function have a short delay from when its called o...
local tickDelay = 10

local tickTimer = tickDelay
local function DelayedFunction()
    tickTimer = tickTimer - 1
    if tickTimer > 0 then return end
    tickTimer = tickDelay
    Events.OnTick.Remove(DelayedFunction)

    --do stuff here
    
end


local function SetUpDelayedFunction()
    Events.OnTick.Add(DelayedFunction)
end

you can replace OnTick with another event like EveryOneMinute, just replace tickDelay with whatever you want but ticks depend on the fps i think

dull moss
#

yep, that

bright fog
#

From what @bronze yoke reported to me due to an issue of removing an entry in the function events, making it skip the next function in the list which could be another mods function

#

For OnTick it's not that much of a problem as that could simply skip to the next tick call for the other mod, but you're probably better off using a table of entries of functions to call later, and iterate at OnTick

#

That's personally what I do

stoic sail
#

hey does anyone have a good start on where to get into modding? more specifically making vehicles, what programs are used for designing them etc

bright fog
#

However there's no guide for vehicles in the wiki rn

#

But there's a steam guide I believe

stoic sail
#

much appreciated, ill see what i find

jovial valley
#

im trying to find the EveryOneMinute lua file location, but i can't find it. if any one knows what lua file its defined in please tell me

bronze yoke
#

it isn't defined in a lua file

#

nearly every event is java

dull moss
jovial valley
#

So it wont be possible for me to make a EveryOneSecond thing?

dull moss
#

you can do every tick and jsut skip X ticks

bronze yoke
#

it's possible

dull moss
#

im an onTick hater though so I encourage you to contemplate if very second is that important

#

and if you cantr do every minute instead

jovial valley
#

i just need it where a OnBreak function runs while the item is in inv, as i am using a OnCreat function to damage a one condition item by 1 but it cant run a OnBreak function when not in inv. and when its created there is just barley enough of a delay to not be in inv when it breaks

bright fog
#

Bcs even the time variables, only update every minutes

#

getGametimeTimestamp()

#

Only updates every minutes at least

#

So I don't even think seconds are a thing in the game

bright fog
bronze yoke
#

every in-game second would be literally insane

jovial valley
#

yeah i mean IRL

bright fog
#

At least I don't see a use for it hahalol

vague marsh
#

hello, im trying to make a hat mod spawn with zombies. I need help to confirm if everythings correct or not. I tested it and theres no error or anything but I've not seen a single zombie wearing it (this part im not sure cuz i only roam around like 3 blocks of the neighborhood) im too lazy to run around and find em. what am i missing?

clothing/clothing.xml

<?xml version="1.0" encoding="utf-8"?>
<outfitManager>

    <m_MaleOutfits>
        <m_Name>MetroBeanieZombie</m_Name> 
        <m_Guid>17b63df0-9a8d-4c2d-b83c-123456789abc</m_Guid> 
        <m_items>
            <itemGUID>e7a5c2d4-1b89-4f2e-8d35-3f6a91b0d712</itemGUID>  <!-- BurntSunset Beanie -->
            <itemGUID>9c3d67f2-8b41-4e2c-bf68-7a2d5e01c5f4</itemGUID>  <!-- GlitchGrid Beanie -->
            <itemGUID>4f8e2c3a-6d97-495d-a8b1-9e0cfa3b2d65</itemGUID>  <!-- InfernoLuxe Beanie -->
            <itemGUID>ae9b1d76-5c43-41e0-9f23-bc07e81f54a3</itemGUID>  <!-- MidnightInferno Beanie -->
            <itemGUID>37d2c6a9-81f7-46b3-bc25-6e3d9a4f1e90</itemGUID>  <!-- PhantomGrid Beanie -->
            <itemGUID>c4a1b5d8-ef2a-4d63-98d4-74b9a8e5f01b</itemGUID>  <!-- ShadowBlaze Beanie -->
            <itemGUID>5f8c9d21-7a62-4b8e-80f1-3a4c7e59d6e2</itemGUID>  <!-- ToxicHaze Beanie -->
            <itemGUID>b6d49c83-2e75-4978-a1f3-94c8e2d7f0b5</itemGUID>  <!-- VoltageSurge Beanie -->
            <itemGUID>d13f8a76-4b22-4a7e-98c6-5fbc1e92d0a4</itemGUID>  <!-- GVBlack Beanie -->
            <itemGUID>a72c5d18-ef43-4c89-bd21-6e8f9b37c2f0</itemGUID>  <!-- GVBlue Beanie -->
            <itemGUID>f9b4d6e5-3a72-485c-b8f1-2e6c7a8d5c34</itemGUID>  <!-- GVCyan Beanie -->
            <itemGUID>c58e9d24-6b3f-498e-97a2-4e7c1b62d8f5</itemGUID>  <!-- GVGreen Beanie -->
            <itemGUID>e6a47d92-8c3b-4b1e-92f8-3d75c6e2a4b9</itemGUID>  <!-- GVRed Beanie -->
            <itemGUID>b84c3f72-5e91-49d7-8c32-7f2d6e8a4c51</itemGUID>  <!-- GVWhite Beanie -->
        </m_items>
    </m_MaleOutfits>

    <m_FemaleOutfits>
        <m_Name>MetroBeanieZombie</m_Name>  
        <m_Guid>c3b94f20-2b7d-4c2d-94d6-987654321def</m_Guid>  
        <m_items>
            <itemGUID>e7a5c2d4-1b89-4f2e-8d35-3f6a91b0d712</itemGUID>  <!-- BurntSunset Beanie -->
            <itemGUID>9c3d67f2-8b41-4e2c-bf68-7a2d5e01c5f4</itemGUID>  <!-- GlitchGrid Beanie -->
            <itemGUID>4f8e2c3a-6d97-495d-a8b1-9e0cfa3b2d65</itemGUID>  <!-- InfernoLuxe Beanie -->
            <itemGUID>ae9b1d76-5c43-41e0-9f23-bc07e81f54a3</itemGUID>  <!-- MidnightInferno Beanie -->
            <itemGUID>37d2c6a9-81f7-46b3-bc25-6e3d9a4f1e90</itemGUID>  <!-- PhantomGrid Beanie -->
            <itemGUID>c4a1b5d8-ef2a-4d63-98d4-74b9a8e5f01b</itemGUID>  <!-- ShadowBlaze Beanie -->
            <itemGUID>5f8c9d21-7a62-4b8e-80f1-3a4c7e59d6e2</itemGUID>  <!-- ToxicHaze Beanie -->
            <itemGUID>b6d49c83-2e75-4978-a1f3-94c8e2d7f0b5</itemGUID>  <!-- VoltageSurge Beanie -->
            <itemGUID>d13f8a76-4b22-4a7e-98c6-5fbc1e92d0a4</itemGUID>  <!-- GVBlack Beanie -->
            <itemGUID>a72c5d18-ef43-4c89-bd21-6e8f9b37c2f0</itemGUID>  <!-- GVBlue Beanie -->
            <itemGUID>f9b4d6e5-3a72-485c-b8f1-2e6c7a8d5c34</itemGUID>  <!-- GVCyan Beanie -->
            <itemGUID>c58e9d24-6b3f-498e-97a2-4e7c1b62d8f5</itemGUID>  <!-- GVGreen Beanie -->
            <itemGUID>e6a47d92-8c3b-4b1e-92f8-3d75c6e2a4b9</itemGUID>  <!-- GVRed Beanie -->
            <itemGUID>b84c3f72-5e91-49d7-8c32-7f2d6e8a4c51</itemGUID>  <!-- GVWhite Beanie -->
        </m_items>
    </m_FemaleOutfits>

</outfitManager>

lua/shared/NPCs/BodyLocation.lua //is this needed?

require 'NPCs/BodyLocations'

local group = BodyLocations.getGroup("Human")

group:getOrCreateLocation("Hat")

lua/shared/NPCs/ZombieZoneDefinitionBeanies.lua

require 'NPCs/ZombiesZoneDefinition'

table.insert(ZombiesZoneDefinition.Default, {name = "MetroBeanieZombie", chance=0.5})

#

i can spawn them with it but they only have one variant of the hat which is whiteπŸ˜†

the white variant is: <itemGUID>b84c3f72-5e91-49d7-8c32-7f2d6e8a4c51</itemGUID>

winter bolt
#

instead you need to do something like this where the possible choices are subItems

<m_items>
    <probability>0.15</probability>
        <itemGUID>48cb6484-ae95-4135-b308-30d97eff2819</itemGUID>
        <subItems>
            <itemGUID>dcdc9576-6d8e-4dd5-bb0a-ea10dbae66b0</itemGUID>
        </subItems>
        <subItems>
            <itemGUID>81b4d638-fb13-4153-9960-e50705cb335f</itemGUID>
        </subItems>
        <subItems>
            <itemGUID>87917281-f5e5-4fa7-aaeb-4530d3111c09</itemGUID>
        </subItems>
        <subItems>
            <itemGUID>e5eb1bae-a679-4cd1-ae7a-8666d3990ae8</itemGUID>
        </subItems>
</m_items>
#

i havent messed with the format much so i'm not entirely sure if you need the first item to be outside of subItems but it does work

jovial valley
#

i have a lua function called HBRCLowerItemCondition it does exactly that it says, i want to use it to to break an item in hopes to be able to run a OnBreak command as soon as foraging/crafting/whatever puts it in inv. however HBRCLowerItemCondition is run OnCreate which seems to not work, is there a way to get OnBreak to run properly/in player inv?

vague marsh
#

it works!! thankss

quaint tulip
#

πŸ‘‹

jovial valley
next jay
#

is sound played from player's emitter always heard by zombies and other players?

#

done from server side

pearl crest
#

probably a bad place to ask but how do i get started with mod development? what applications should i use, is there a guide i could look over?

hybrid tiger
#

It has a lot of useful info and should be updated for b42 (i think)

#

and also looking at other peoples mods to see how they do things

umbral belfry
jovial valley
#

Please guys i just need to know how to eject specific items from inv, I don't care how just if its beginner friendly.

plush wraith
#

I need some advice on how to call a crafting recipe from lua.

I've looked into ISInventoryPaneContextMenu.OnNewCraft(), specifically the HandcraftLogic object but I'm not sure how to create the CraftRecipe object I need for it

bronze yoke
jovial valley
#

is there is a lua event that items can use for when they are put in player inv?

outer crypt
#

there are these

#

OnItemEquipped - Fires when item is equipped by a player, including one-handed or two-handed.
OnItemMoved - Fires when inventory item is put or taken by a player.
OnItemPlaced - Fires when inventory item is put down via place action.
OnItemUnequipped - Fires when item is unequipped by a player, including one-handed or two-handed.

#

Is there a way to add a sprite to a known x,y,z on game creation?

#

without remaking and entire map grid anyways....

bronze yoke
#

no

#

you can't modify a square until it has loaded

outer crypt
#

what I expected and I know of no processor cheap way to find that square...

#

thank you

#

onloadgridsquare is just ripe for stealing process time...

#

and I don't think the tools for b42 mapping are out yet...

south karma
#

has anyone had an issue where swapping to the other firemode for a firearm bugs out like this?

jovial valley
jovial valley
#

i have been trying for hours to get this to work can someone help
here is the code

    if item and item:getCondition() > 0 then
        item:setCondition(item:getCondition() - 1)
    end
end

function HBRCRaiseItemCondition(item)
    if item item:getCondition() = 0 then
        item:setCondition(item:getCondition() + 1)
    end
end


function OnBreakMineableZone1DB(item, player)
    OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
    player:getInventory():Remove(item)
end

function OnBreakMiningzone1DB(item, player)
    OnBreak.HeadHandler(item, player, "HCSM.Miningzone1", false)
    player:getInventory():Remove(item)
end

-- experimental

function HHBRCTick(item)
    Events.OnTick.Add(HBRCLowerItemCondition)
    Events.OnTick.Add(HBRCRaiseItemCondition)
end

function HBRCLowerItemConditionDB(item)
    HBRCLowerItemCondition(TestItem)
end

function HBRCLowerItemConditionDB(item)
    HBRCRaiseItemCondition(TestItem)
end

function OnBreakTest(item, player)
    OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
    player:getInventory():Remove(item)
    Events.OnTick.Remove(HBRCLowerItemCondition)
    Events.OnTick.Remove(HBRCRaiseItemCondition)
end```
and here is the console error i get
```SEVERE: Error found in LUA file: C:/Users/brian/Zomboid/mods/HotheadsRandomCrapolaM/42/media/lua/shared/debug_luaHHB.lua
ERROR: General      f:0, t:1738533660201> ExceptionLogger.logException> Exception thrown```
#

it starts at HHBRCTick with a OnCreate

bright fog
silent zealot
#

I highly recommend VS Code & Umbrella plugin for mod development - that setup will pick up lua sytax errors as you go and also gives help with API calls/variable types where it can.

#

I still think this is the wrong approach and you should just modify the way finding the item via foraging works to trigger putting an item on the ground directly instead of giving the player a temporary item and breaking it to trigger putting an item on the ground.

solar rover
#

Vehicle mod issue. The last vehicle I made (very large) wont connect to front or back trailer attachments. It has the same settings as any of the other vehicles I've made or edited but for some reason this one just wont tow. Any suggestions?

silent zealot
#

Did you do something to set the tow attachment point? I've seen mods do horrible things when the "towbar" is located in a position that can connect but results in the trailer and vehicle collision box overlapping.

#

So if you have a very hig vehicel I's assume the "towbar" can be so far from the back of the vehicle it can't connect.

solar rover
#

Nothing custom, even removed the attachment in debug mode and added it again and moved it into the correct position

silent zealot
#

...but I don't actually know how that gets configured.

#

Well that was my one hepful idea, hopefully a vehicle modder can offer better insight.

solar rover
#

I checked location stuff as well and Im closer/more aligned with this vehicle than the 379 petyarbuilt and trailer

onyx valve
#

Hi, does anyone know what the mailboxes are called in the distributions? Are they PostOfficeBoxes or is it another name?

jovial valley
# silent zealot Looks like a syntax error - and I bet it's from `if item item:getCondition() = 0...

i changed the code to this but it still has no effect, (although console no longer recognizes that it exists not)

    if item and item:getCondition() > 0 then
        item:setCondition(item:getCondition() - 1)
    end
end

function HBRCRaiseItemCondition(item)
    if item and item:getCondition() == 0 then
        item:setCondition(item:getCondition() + 1)
    end
end


function OnBreakMineableZone1DB(item, player)
    OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
    player:getInventory():Remove(item)
end

function OnBreakMiningzone1DB(item, player)
    OnBreak.HeadHandler(item, player, "HCSM.Miningzone1", false)
    player:getInventory():Remove(item)
end

-- experimental

function HHBRCTick(item)
    Events.OnTick.Add(HBRCLowerItemCondition)
    Events.OnTick.Add(HBRCRaiseItemCondition)
end

function HBRCLowerItemConditionDB(item)
    HBRCLowerItemCondition(HCSM.MineableZone1DB)
end

function HBRCRaiseItemConditionDB(item)
    HBRCRaiseItemCondition(HCSM.MineableZone1DB)
end

function OnBreakMineableZone1DB(item, player)
    OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
    player:getInventory():Remove(item)
    Events.OnTick.Remove(HBRCLowerItemCondition)
    Events.OnTick.Remove(HBRCRaiseItemCondition)
end
silent zealot
#

Break it down into steps.

#

You have one of those functions called by OnCreate in the item properties, is that correcet?

jovial valley
#
    Events.OnTick.Add(HBRCLowerItemCondition)
    Events.OnTick.Add(HBRCRaiseItemCondition)
end

this one

silent zealot
#

Add a debugging print statement so you can confirm it is being called.

#

Then if it is, do the same for HBRCLowerItemCondition and HBRCLowerItemCondition to confirm they are being called (and prepare for log spam)

#

etc etc

#

side note - how is HBRCLowerItemCondition getting passed the item as a praemter?

#

AFAIK there's no OnTick for a an item, it's just called every tick and then you need to work out how to get the player object/item object/etc

bronze yoke
#

i don't really know why ontick or any event is used here at all

silent zealot
#

Because spawning an item on the ground was not an accepted solution.

#

I'm unclear why, but shrugs

jovial valley
#

because the methods(plural) of getting these items put them in player inv, and rewriting that is far beyond my skills,
anyways

    Events.OnTick.Add(HBRCLowerItemCondition)
    Events.OnTick.Add(HBRCRaiseItemCondition)
    print("HI")
end```
the print does nothing to the logs
#

gota keep in mind im a beginner type beginner

undone elbow
silent zealot
silent zealot
undone elbow
jovial valley
#
    {
        DisplayCategory = Material,
        Weight    =    1,
        ConditionMax = 1,
        Type    =    Normal,
        DisplayName    =    Investigate Further,
        Icon    =    important,
        OnCreate = HHBRCTick,
        OnBreak = OnBreakMineableZone1DB,
    }```
jovial valley
undone elbow
#

Because you don't use it. πŸ˜„
Check the place where it should be using.

jovial valley
#

?

silent zealot
#

And then you create a MineableZone1DB using debug mode's item tool?

jovial valley
#

thats the fast way

silent zealot
#

Does the MineableZone1DB get created properly?

undone elbow
#

For example, immediately:

function HHBRCTick()
  Events.OnTick.Add(HBRCLowerItemCondition)
  Events.OnTick.Add(HBRCRaiseItemCondition)
  print("HI")
end
HHBRCTick(); ----> just used
silent zealot
#

It should be getting called via the item's OnCreate value

#

I think it's going to throw a huge pile of erroes once HBRCLowerItemCondition/HBRCRaiseItemCondition are being called because they are not being passed the item parameter they expect, but that will come later.

#

And then we'll mention that in an effort to do things an easier way you're making everything harder.

#

But, for now - Can you create a MineableZone1DB item?

#

And does that throw an errors when you do so?

jovial valley
#

i can create the item, and no errors pop up

undone elbow
#

It should be getting called via the item's OnCreate value
So it's better to put print in OnCreate directly to check if it works in general.
Also print after definition:

function HHBRCTick()
  .....
end
print('HI! Definition is ok, lua file was laoded')
silent zealot
#

Also, from the lua console when in game what happens if you run HHBRCTick() ?

undone elbow
#

red error if file is not loaded

jovial valley
#

1)if i run it manually it gives a debug error onHBRCLowerItemCondition/HBRCRaiseItemCondition
2)well if it is truly easier then can you point me to where i would start on learning the necessary things for the other method

#

cuz I legit don't even know where i would start on the other method

drifting ore
bronze yoke
#

it sets whether the spawn chance is affected by that sandbox option

drifting ore
#

Duh, thank you

jovial valley
silent zealot
#

Crafting will probably do it automatically if it's too heavy for the player inventory.

undone elbow
silent zealot
#

Or maybe it never gets used anywhere, because isSurvivalGearLoot isn't in any vanilla lua file.

bronze yoke
#

well loot isn't lua

silent zealot
#

one use I can find in decompiled B42.2

#

And a few more that don't use the method and just look at the string:

jovial valley
silent zealot
#

vanilla foraging wasn't designed with a 9999 weight item in mind. Somewhere previously we found the function that checked weight vs inventory/bags and it looked like if you can't pick it up or put it any bag the option is just unusable, with the assumption being you would free up space and try again.

bronze yoke
#

very noticeable with Big Rock or whatever being an item you can only forage and weighs like 40

silent zealot
#

ISBaseIcon:doContextMenu in lua\client\foraging\ISBaseIcon.lua

#

You could extend that function with a check for self.itemObj being a MineableZone1DB, and if so add a next context menu option that calls code to create an item on the ground.

#

You might not even need that, did you actuyally test fidning a 9999 weight object through foraging?

silent zealot
#

OK, so that was teh correct interpretation of the code

#

Have a read through ISBaseIcon:doContextMenu and think about what you could add as a prefix or postfix patch to do what you want.

jovial valley
#

i will try to do the same, but i might not get what's going on though

#

would i do smth with local plInventoryHasSpace = (plInventory:getCapacityWeight() <= plInventory:getEffectiveCapacity(self.character));

#

and near by lines of crs

silent zealot
#

Where possible don't change the existing code. Sometimes there is no practical way to avoid doing that by copying the function, but your mod will be a lot more robust to future updates if you instead run code before and/or after the existing function.

jovial valley
#

ok

coarse bay
#

Hey stalker i gotta question bout before

umbral raptor
#

im having a problem where a tile is floating mid-air

#

even tho i have the tiles as "IsLow" and "BlocksPlacement"

#

which did the job in the past

silent zealot
#

To simplify a lot, what you will do is somthing like:

  <my code>
  ISBaseIcon:doContextMenu(_context)
end ```

or 

```function MyNewCode(_context)
  ISBaseIcon:doContextMenu(_context)
  <my code>
end```
silent zealot
coarse bay
#

all good, u helped me add the right click context to an item, but i want the item tooltip to show how much happines it gives

#

when it is used

silent zealot
#

If you want to extend a tooltip there are two options:

  1. Starlit library
  2. Go insane
coarse bay
#

well im just trying to add the text of how much it gives

silent zealot
#

I know, but tooltips are not simple to modify... starlit makes adding something very easy.

#

Don't ask about removing something from a tooltip, I ended up using a horrible hack to do that in Authentic Battery Charge Detection.

coarse bay
#

yea dont need to remove

jovial valley
# silent zealot To simplify a lot, what you will do is somthing like: ```function MyNewCode(_c...

i tried but its not working


function HHBRCForagingChange(_context, _worldItem)
    local player = getPlayer()
    local square = player:getCurrentSquare()

    -- do the square exist
    if _worldItem and square then
        local itemType = _worldItem:getType()
        local itemName = _worldItem:getDisplayName()

        -- List to drop
        local heavyItems = {
            ["MineableZone1"] = true,
        }

        -- If the item on list, drop it instead of adding to inventory
        if heavyItems[itemType] then
            -- Remove from inventory if added
            if _worldItem:getContainer() then
                _worldItem:getContainer():Remove(_worldItem)
            end

            -- Drop item on the ground
            square:AddWorldInventoryItem(_worldItem, 0.5, 0.5, 0.0)

            -- Stop further processing to prevent inventory addition
            return
        end
    end

    ISBaseIcon:doContextMenu(_context)
end

do you know what's wrong

#

keep in mind idk what is going on

undone elbow
#

never say just "not working"

jovial valley
#

ok

#

i select the item and the option to pick up is red and it is still trapped as a pick up to make real thing

undone elbow
#

Appearing the context menu doesn't add the item to inventory. It just shows the menu for a while.

jovial valley
#

well idk how to stop it from just doing the base menu

undone elbow
#

I'd suggest a quick workaround, but I even have not tested it. Just as an example

do
  local old_fn = ISWorldObjectContextMenu.onPickupGroundCoverItem
  ISWorldObjectContextMenu.onPickupGroundCoverItem = function(worldobjects, player, object)
    if object:getType() == 'MineableZone1' then
      return -- do nothing, skip action
    end
    return old_fn(worldobjects, player, object)
  end
end
ornate sand
#

Holy crap I just broke 100 000 subs :3

undone elbow
#

Deleted a mod?

ornate sand
#

Lol no, my gun mod just went 100,103

undone elbow
#

Ah ) Gratz

jovial valley
#

like in place of what

undone elbow
#

wherever

#

See what it does because you can apply the same technique to your other ideas

#

I'm not sure if I chose the right function etc

dull moss
ornate sand
undone elbow
jovial valley
# undone elbow ```lua function MyNewCode(_context) pcall(function() <my code> end) --...

ok i got no idea what im doing now

    pcall(function()
        do
            local old_fn = ISWorldObjectContextMenu.onPickupGroundCoverItem
            ISWorldObjectContextMenu.onPickupGroundCoverItem = function(worldobjects, player, object)
              if object:getType() == 'MineableZone1' then
                return -- do nothing, skip action
              end
              return old_fn(worldobjects, player, object)
            end
          end
    end)
    -- will work for sure:
    ISBaseIcon:doContextMenu(_context)
  end ``` 
this is what i just put into the file, can you point out what needs to be added
dull moss
#

"can you write a mod for me pls"

bronze yoke
#

(function() ... end)() is equivalent if you need to do it to separate a scope but here it should not be used because it will compile the function every single time the function is called (you should just define the function normally in the root of the file)

jovial valley
#

so we gonna ignore MusicManiac's toxicity?

dull moss
jovial valley
#

hey im just saying rules exsist on severs this big

#

and moderators don't like @'s this late

ornate sand
#

Just call 'em a goof or better yet, a goofball and move on.
Also what do you mean late? It's morning

dull moss
#

feel free to report me for that comment ICANT

jovial valley
#

ima just start from

    function HHBRCforagingstuff1 ()
    ISBaseIcon:doContextMenu(_context)
  end

and try. cuz apparently asking for help is = to "can you write a mod for me pls" lamo

dull moss
#

we have different approaches to what's considered "asking for help"

coarse bay
#

@silent zealot I want the tooltip to be when i hover over item and then show how much boredom it reduces, right now its when i hover over the context menu option

dull moss
#

"i dont understand anything please tell me what do i add to this code"
!=
"I'm trying to figure out X and I've so far looked into Z and understand that Y does thing A and thing B, so I tried doing thing C, but for some reason thing D doesnt happen"

#

1st doesn't show any effort

jovial valley
#

oof can u read

#

"point out what needs to be added" not= to that

ornate sand
jovial valley
#

anyways i prob shouldn't feed the trolls more

undone elbow
dull moss
coarse bay
dull moss
jovial valley
#

"point out what needs to be added"

#

that not clear? and dont @ to troll

undone elbow
ornate sand
# coarse bay can you show an example if possible?
    item 9mmSuppressor
    {
        Type = WeaponPart,
        DisplayName = Suppressor,
        DisplayCategory = WeaponPart,
        Icon = 9mmSuppressor,
        Weight = 0.25,
        WeightModifier = 0.25,
        MountOn =    Pistol;Glock17;MP5;UZI,
        PartType = Canon,
        Tooltip = Tooltip_Suppressor,
        MetalValue = 22,
    WorldStaticModel = Suppresssyy,
    }

Then I have the shared translate lua for Tooltip_Suppressor saying what I want it to

bronze yoke
#

it will, kahlua's compiler is really passive and will not optimise things even when it's very easy to

coarse bay
bronze yoke
#

function() ... end means 'compile this function and put it in this variable' so it will always do that when it gets to that line, even if the result will never change

ornate sand
bronze yoke
#

if you don't mind adding a dependency my starlit library has support for custom tooltips with colours and other stuff

dull moss
coarse bay
#

yeah i did that but i only figured out for the context menu how to add a tooltip

bronze yoke
dull moss
#

oh

undone elbow
dull moss
#

Hmm

#

yea that's not good

undone elbow
#

That's crazy

vast pier
ornate sand
jovial valley
#

so i when back to


function HHBRCForagingChange(_context, _worldItem)
    local player = getPlayer()
    local square = player:getCurrentSquare()

    -- do the square exist
    if _worldItem and square then
        local itemType = _worldItem:getType()
        local itemName = _worldItem:getDisplayName()

        -- List to drop
        local heavyItems = {
            ["MineableZone1"] = true,
        }

        -- If the item on list, drop it instead of adding to inventory
        if heavyItems[itemType] then
            -- Remove from inventory if added
            if _worldItem:getContainer() then
                _worldItem:getContainer():Remove(_worldItem)
            end

            -- Drop item on the ground
            square:AddWorldInventoryItem(_worldItem, 0.5, 0.5, 0.0)

            -- Stop further processing to prevent inventory addition
            return
        end
    end

    ISBaseIcon:doContextMenu(_context)
end

because expandability/i can make sense of it
and is if heavyItems[itemType] then and all that the prob?

coarse bay
#

yeah but i want it to be like food you know, have the colored text and show what stats it boosts

ornate sand
# vast pier

I want to see one of those catastrophically fail

coarse bay
#

yeah like that

#

il check it, thanks

undone elbow
jovial valley
#

Are you going to help me or am I going to have to try this again tomorrow?

dull moss
#

holy entitlement KekW

vast pier
jovial valley
#

@dull moss I'm going to tell you this once, unless you have something actually useful to put into the conversation, don't speak to me. I'm hoping you can respect this. I don't want to get someone who's in charge involved.

#

I'm just tired at this point

dull moss
undone elbow
vast pier
jovial valley
vast pier
#

I'm basing this off of real explosive mixtures

ornate sand
vast pier
#

It's a 1:1 ratio of ammonium nitrate and fuel oil.
If you're using gasoline instead of fuel oil then it would be 2:1:1 of ammonium nitrate, gasoline, and motor oil

#

for legal reasons, don't mix these substances in your home without the proper licensing. It is illegal in the United States to manufacture explosives :)

ornate sand
#

ATF guy: "Hey is that thing legal?"
Me: "Hey are those level 4 plates?"
ATF guy: "What?"
Me: "What?"

dull moss
#

learning hommade explosives in pz KekW

vast pier
#

Mixing plain fertilizer and gasoline probably wouldn't get you anywhere irl.

#

As you would specifically need fertilizer grade ammonium nitrate (32% or higher nitrogen content) and not just generic fertilizer

vast pier
#

probably shouldn't make bullets with liquid propellent

#

doesn't sound right

undone elbow
#

But there should be specific muldet because of smell

coarse bay
#
        toolTip.description = string.format(
            [[%s: <RGB:%f,%f,%f> <SPACE> -5
            %s: <RGB:%f,%f,%f> <SPACE> -25]],
            "Unhappiness", r, g, b,
            "Boredom", r, g, b
        )
``` Can someone tell me what did i do wrong with formating? boredom is fully green, while unhappines is fine
vast pier
undone elbow
#

Ah, no, may by format issue (multi-line argument)

coarse bay
#

wouldnt be suprised, idk how formatting works im just going of what i learned

undone elbow
#

Just check it in console

print(
string.format(
            [[%s: <RGB:%f,%f,%f> <SPACE> -5
            %s: <RGB:%f,%f,%f> <SPACE> -25]],
            "Unhappiness", 1, 2, 3,
            "Boredom", 4, 5, 6
        )
);
frank elbow
#

To only affect text within a certain range of the string you can use <PUSHRGB:r,g,b> text <POPRGB> (So, <PUSHRGB:%f,%f,%f> <SPACE> -5 <POPRGB>)

vast pier
#

Damn, if the game took place before 1960 then I could make it so you use a fire extinguisher to get carbon tetrachloride

#

(carbon tetrachloride was phased out of use in fire extinguishers in the mid 1960s because it's toxic)

coarse bay
#

thanks omar

bronze yoke
#

wait so these codes *do* work in tooltips? didn't somebody find just the other day that they don't?

frank elbow
#

They work in certain tooltips

#

I think item tooltips are the weird ones

coarse bay
#

Yeah someone said that they dont in item ones

#

ok and last thing i swear, why does it go out of the box. the code that only used <rgb> had it all aligned properly

frank elbow
#

Make sure you have spaces before & after every <> command

#

Failing that I'd just throw a newline on the end, but it's usually that. The rich text parsing is a bit finicky

coarse bay
#

yeah i do have spaces

frank elbow
#

Including after the <POPRGB> where your cursor is? (unsure whether the newline + tab would be stripped off the top of my head)

coarse bay
#

looks like there wasnt 1, but its still not fixed

frank elbow
#

Maybe try putting the space command before the push/pop?

coarse bay
#

nothing

frank elbow
#

Yeah this is about where I'd throw my hands up and put a <LINE> at the end

coarse bay
#

well that works

#

if it works its good enough

vast pier
#

Real ingredient listed in one of the explosive materials in the handbook

sour island
dull moss
vast pier
#

I think the (including humans) is there because this handbook was written before 1969 and a lot of people didn't and still don't consider humans to be animals

dull moss
undone elbow
#

I will add it to my mod so I have to know everything about it.

vast pier
#

the propellent that uses urine isn't being included in my mod as the rest of the ingredients wouldn't be reasonably accessible in game.

#

Trying to not add in a lot of items, and rather use existing materials

ornate sand
silent zealot
vast pier
#

/hj

silent zealot
#

That's fair.

#

Also, no thank you.

#

πŸ˜‚

#

Adding a bladder need would just mean a lot of peeing on the ground wherever you sere, I can't see how it would add to the gameplay.

#

I want immersion not realism!

ornate sand
#

I remember someone popping up in mod_support because their character pissed themselves in a car and now the car had a forever smell lmaooo

silent zealot
#

lol

#

Credit to the modder for implementing that level of detail, but... I shall admire his dedication without trying it myself.

#

(Also I hope it was the seats that had the smell, not the vehicle object itself.)

ornate sand
#

Either way it's hilarious.
Even funnier is imagining the character uninstalling the seat and then washing it at their rainbarrel sink

silent zealot
#

Of course that is a thing.

undone elbow
silent zealot
#

Speaking as someone who likes Dubs Bad Hygiene in Rimworld, I don't want it in Zomboid. πŸ˜‚

ornate sand
#

Yeah I know PZ is basically the Sims 2 with zombies but I don't need all that

silent zealot
#

Unlike Oxygen Not Included, where the early game revolves around manging pee and "contaminated soil"

undone elbow
#

I don't need all that
I guess that's why it has only 137k subs))

silent zealot
#

And getting any pee into you natural water sources is a huge problem to fix.

ornate sand
sour island
#

I need to add a way to pick which languages to apply πŸ€”

vast pier
ornate sand
#

Or like in My Summer Car, if you walk forward while emptying your bladder upward, your thirst goes down for some reason

silent zealot
#

Can you enable Autodrink and Autopee on the same container for the true extreme survival experience?

undone elbow
#

Wait, wait, I'm writing this down.

vast pier
#

watersports trait

#

I don't think I need to say more than that

silent zealot
#

Shy Bladder

#

Can't pee if thinks there is a zombie around.

#

And impliment crawlers doing this.

undone elbow
#

I can add autopee but as an additional mechanic, in addition to manual pee

#

Not sure yet how it fits to the mod idea. Have to think about

vast pier
#

I feel like it might be better to just have the option to get urine from animals the same way you get milk. Adding a new mechanic for players to maintain as intrusive as pissing sounds annoying

#

I mean really think about it, you would be peeing so much in zomboid given the in game time vs real world time and how much water your character is drinking all the time

undone elbow
#

The character can hold it. Let's say if it's 1 hour=24 hours, they should do it about every 30 minutes.

coral root
#

Hello, I would like to ask about Mod Shops and Traders. Can I configure this mod to change currency exchange into exchanging rings or jewelry instead? And how do I set it up? Please let me know.

tacit pebble
#

Is there any function to get world brightness?
IsoPlayer:TooDarkToRead() is mostly working but it returns false when player is using flashlight or is in vehicle(when vehicle has battery; from 42.1.0) .

What I want to is: ignore flashlight, just check lights from world/objects only. (Moonlight, Sunlight, Floor light, etc..)

vast pier
vast pier
fathom dust
solid tundra
#

Quick question: Where are Tags defined in PZ, and can a tag universally double a weapon's damage output using a global function or replacing one?

I'm attempting to make all weapons with the 'ChopTrees' Tag, double their damage against Zombies/NPCs, but without touching any recipes.

silent zealot
#

@jovial valley

#

local function DebugSay(message)
    print("NepForage2GroundDemo: "..message )
end

-- add postfix to ISBaseIcon.doContextMenu
ISBaseIcon.NepOGdoContextMenu = ISBaseIcon.doContextMenu
function ISBaseIcon.doContextMenu(self, _context)
    -- This is where I put code to run before the original function
    -- Maybe if self.itemObj is a particular item I want to do something here return without calling the original function

    -- then I call the original function
    ISBaseIcon.NepOGdoContextMenu(self, _context)

    -- This is where I put code to run after the original function
    -- Add a "yeet onto ground" function - would be a lot nicer  to add it to the Foraging submenu 
    if _context then -- there might not be a context menu at this point, depends exactly what was clicked on
        _context:addOptionOnTop("Yeet Onto Ground", self, ISBaseIcon.NepYeetOntoGround, self.itemObj, self.square)
    end
end

-- My custom context menu action
function ISBaseIcon:NepYeetOntoGround(item,square)
    DebugSay("Yeet!")
    print(self)
    if not item then DebugSay("NepYeetOntoGround: ERROR: item is nil"); return end -- somehow we got here before self.item was configured
    if not square then DebugSay("NepYeetOntoGround: ERROR: square is nil"); return end -- somehow we got here before self.square was configured
    -- put the world item in the square
    square:AddWorldInventoryItem(item,0.5,0.5,0)
    -- Now removes the foraging marker and call reset to clean up
    self:remove()
    self:reset()
end

#

It would be a lot prettier if the context menu option was put under the "foraging" submenu, and instead of just putting the item on the ground it should make the player walk over and do it via timed action, "Yeet Onto Ground" should use translation instead of a hardcoded string... but that's an example of extending the foraging context menu to put found items directly on the ground.

tacit pebble
silent zealot
#

There's a getLightLevel2(), but it does noy work for me (throws an error about calling nil, and getLightLevel(-1) also fails.

tacit pebble
#

anyway thank you for tried to help me πŸ™‚

simple raven
#

Hey lads, this is a bit of a weird one but I can't actually seem to find a definitive answer just browsing the web.
Just for context, I've no map-making experience in Zomboid what-so-ever so this is a shot in the dark but, is it possible to spawn buildings mid-game, or would such things need to be ahead of launching a world?

By buildings I mean literal buildings, houses, tents and the like.

surreal silo
#

how does one make/do sandbox-options.txt? is there a guide somewhere?

#

do u have to make a translation version?

simple raven
rapid flume
#

guys real quick: I want to have clear visual for graphics adjustement for my tiles or ingame screenshots, how do I remove weather effect with debug
NEVER MIND it's under CLIMATE then you read Weather.
XD it's alway like this... you wait for asking, you keep failing, and when you ask, you answer yourself and success before someone answers you...

#

Rely on "yourself seeking help", admits it, while keeping working but with an alternate idea that comes right after "yourself seeking help" aaaaarg.

silent zealot
#

I hate debugging AI generated code.

#

Have you tried it to see if it works?

#

And if it does not, how is it failing?

hoary knoll
#

I have a question about permission for a mod to @violet fractal . If you read this I would be happy if you contact me πŸ™‚ Contacting you seems impossible πŸ˜„

surreal silo
silent zealot
#

What is the error? Check console.log if you want an easier way of viewing it.

surreal silo
silent zealot
#

That's normal. Well, it's expected.

#

search for "exception" first as that will show any java exceptions

#

And doesn't get caught up on all the usual "error" occurance.

surreal silo
#

ah found it LOG : General f:0, t:1738579580704> ----- LOG : General f:0, t:1738579590828> ----- LOG : Mod f:0, t:1738579598736> loading \FenceDamageMod ERROR: General f:0, t:1738579598789> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: invalid or missing VERSION at CustomSandboxOptions.parse(CustomSandboxOptions.java:104).

silent zealot
#

parse errors have all sorts of knock on effects, so that is definitely the starting point to look at

#

post your sandbox-options file

#

option NepOverdrive.RequireTrait
{
    type = boolean, default = true,
    page = NepOverdrive, translation = NEPODRequireTrait,
}


option NepOverdrive.DebugMode
{
    type = boolean, default = false,
    page = NepOverdrive, translation = NEPODDebugMode,
}```
#

that's one of mine

#

I'm guessing you have a sandbox options file either the VERSION line

surreal silo
#

option FenceDamageMod.Chance
{
    type = integer,
    min = 0,
    max = 100,
    default = 50,
    page = FenceDamageMod,
    translation = FenceDamageMod_Chance,
}

option FenceDamageMod.Damage
{
    type = integer,
    min = 1,
    max = 1000,
    default = 10,
    page = FenceDamageMod,
    translation = FenceDamageMod_Damage,
}```
#

ok i fixed it, my 42 version didnt have the comma. very confusing having 2 media folders

#

doesnt appear to work in game tho lol

#

as in nothing happens

silent zealot
#

Add some debug print() statements that will trigger when the zombie-going-over-a-fence code is triggered.

#

Aslso so crtl-f <name of lua file> in console.log to make sure it didn;t skip the file due to a syntax error

#

espcailly if you used AI, because large larngauge models don't actually know LUA and just give you Looks Like Luaβ„’

surreal silo
#

"LOG : General f:0, t:1738581120008> ERROR IntegerConfigOption.parse() "FenceDamageMod.Chance" string=" - spammed this. Does it mean anything?

#

i assume its just fussing over me changing the sandbox settings

coarse bay
#

is there somewhere a list of anims and sounds?

#

the names

#

nvm

#

ok i just cant find the sounds

bright fog
coarse bay
#

i mean the names (strings) all there are for the playsound function

bright fog
coarse bay
#

self.character:getEmitter():playSound("ClothesRipping")

#

all sounds that can be played

bright fog
#

It links to the script of the sound

#

Some sounds are not as .ogg files or whatever but in a .bank file

coarse bay
bright fog
#

Scripts

#

Sound scripts

#

Unless you want the sounds themselves, I told you some are in the files and some are in .bank files

umbral raptor
#

hey i need help with distribution lua

#

for some reason, my added items wont spawn anywhere outside military surplus stores

#

like it spawns normally there

#

but i tried adding spawns to gigamart and it doesn't show up

slim swan
#

I want to make a vehicle teleport mod,but don’t know why when the car teleport,it will go back and spawn a same one on the raw one,make it to be two cars

#

Like use debug ,when u sit at a vehicle,teleport to somewhere would get the same result

vast pier
true nimbus
#

Hey, i'm struggling to add something in a mod :
some contextMenus are banned, but i still can disassemble things, i tried ContextMenu_Disassemble and ContextMenu_Dismantle without any success. any idea?
thx in advance

native swift
#

how would i go about adding a custom sound when using an item? ive got a minecraft chest that I want to add a sound to when i open it or put things in etc. i know how to access the different vanilla sounds but how would i go about accessing a custom sound

silent zealot
#

Unless there's a vanilla functionality I'm not aware of all that screenshot does is declare a few variables.

inner coral
#

did the folder layout change from b41 to b42? i can’t figure out why my mod shows up in b41 but not b42

vast pier
#

I'm being serious

#

You NEED to have the common folder there as well

#

it can be empty, but it needs to exist

#

if it doesn't exist, your mod won't load

icy night
#

Some ppl do 42 others do 42.0

#

Dunno why

vast pier
#

I just said 42.0 because I know it works

#

πŸ€·β€β™€οΈ

icy night
#

Lol

#

It confused me when I had to shift everything to B42. Didn't know why ppl were doing it differently

uneven ore
#

Is there a way to force a player to have their PVP enabled/disabled?

inner coral
# vast pier

bruh moment. so just 42 and then a common folder and that’s it? i was seeing something about a lua folder? maybe i was just missing the common lol

vivid imp
#

The lua folder is in the mod file directory

#

I reccomend looking at someone elses mod if you eant to study the filestructurr

vast pier
bright fog
#

If you don't have the common folder, stuff won't work

magic halo
#

Is there any way to disable the highlight of safehouses in debug mode? I'm trying to create a mod that applies a highlight to the safehouse area, but the debug mode is preventing me from seeing clearly where the highlights are being drawn

native swift
#

How do I add a custom sound to my mod? For example if I wanted to have a custom sound for when craft something or for when I loot something from a container

bright fog
#

Looting from a container this will most likely require some lua coding

#

I got a request to make

#

Actually keep the console.txt formating

#

It actually made my life easier

#

It actually made reading the console file easier

#

And was actually a huge bonus point to the extension

#

So if possible, please keep the console files with the formating

#

Now it's just blend, before you could actually see the different sections better even if it was not meant to do that

loud gazelle
#

Thanks in advance for anyone able to help!

storm pecan
#

how PZ decides what item icons should have color tint? I'm trying to change icons on some books. Removed IconMask and ColorRed, ColorBlue, ColorGreen lines. And book icons still have tint

chilly bronze
#

Is there a way to load the game without opening steam?

dull moss
bright fog
#

Actually this formatting is not detected either

module XXXX
{
#

πŸ’€

bronze yoke
#

do you prefer that syntax?

bright fog
#

I just always used it this way

#

I find it harder to read like that I guess

#

Some personal preferences

#

But the extension should take into account any possible available typings imo

true plinth
bright fog
#

Perhaps you could also simply automatically detect the console.txt file no ?

magic halo
#

How can I get the coordinates of the spawn locations with lua script?

umbral raptor
vast pier
#

Reasonable pipe bomb recipe?

true plinth
austere roost
#

Hi guys!
[21:08]
i need to write a items.txt file with Gun info, about Displayname, AmmoType, Icon and something. BUT i have problem with time.
RecoilDelay = 1, <------ Is this 1 a second or a tick?

true plinth
# bright fog Thanks !

finally i have a better idea : a setting which you can specify the filename you want to be treated like a "pz-scripting" file

true plinth
#

ok done
in the next version (0.2.7) you can specify a list of filename which will be treated like a "pz-scripting" file, regex can be used too

#

ok the version 0.2.7 is under verification by Microsoft, it will be available in a couple of minutes

vast pier
vocal vector
#

in the API, if a method has a string as a value, is there a way to see what strings are acceptable?

#

example: public void setBumpFallType(String val)

true plinth
vast pier
scarlet shore
#

Is there a way to programmatically know how many squares an IsoObject furniture occupies? I'm trying to count the number of each piece of furniture in a room by checking which one is sitting on each IsoGridSquare, but it's naturally returning one IsoObject per square for each. If I knew the size of the furniture, I could divide the hits by their size in squares.
I've also tried to see if a single piece of furniture shares one same characteristic across squares (like an ID) to know that it's the same object as the one returned by another square, but have been unsuccessful.

#

Knowing if the piece is number 1 of X of the furniture would also work (I'd only count piece 1).

distant inlet
#

how does "require" in Lua work? Specifically when is it necessary to "require" files from my own mod in other mod files? edit: all my Lua files are already loaded and usable in other files. Maybe because my files look like MyFile={} ... return MyFile

#

ah, is it because I'm making the MyFile object globally accessible by omitting "local" before "MyFile={}"?

bronze yoke
#

yeah

#

you may still need to require to ensure load order when using globals

plush wraith
bronze yoke
#

it is recommended not to use globals though

distant inlet
#

makes sense. I'll "local" all my classes

distant inlet
#

does the "require" argument need additional qualifiers if the class calling the command and its target are under media/lua/client? this is for a b42 mod

lament zodiac
#

has anyone ever made a mod that changes zombie behaviour at certain times? i cannot seem to find where to begin with this. i just need to make it so zombies sprint only when its raining. would that be a LUA file?

bronze yoke
jovial valley
#

is it absolutely necessary for me to use blender/a 3d model for me to get the items i put on the ground to look bigger than the base icon size

silent zealot
silent zealot
#

Find out what it is called in sandbox settings, check if any vanilla lua scripts use it at all. If not, it's probably handled entirely within java.

#

There are ways to override zombie behavior - mods like Bandits turn zombies in NPCs with very different behavior.

lament zodiac
lament zodiac
silent zealot
#

lua\shared\Translate\EN\Sandbox_EN.txt hs the translatiosn for sandbox setting names, so we can see what we want is called "ActiveOnly"

#

Then a quick look through every .txt and .lua file under media shows other than translation that string is only used for sandbox presets.

#

Someone uploaded a decompiled version of Zomboid B41 to github which makes it easy to search, and looking there wer ecan see it gets used internally in IsoZombie:

#

What's interesting is while we can't make us of that diectly we can use isoZombie:makeInactive(bool)

#

I'm not sure what the best way to make use of that would be though - I don;t know if there is a reasonabel way to get all loaded zombies (for when rain starts/stops) and then grab each new one as it spawn or loads in (so it can be set to active/inactive)

silent zealot
jovial valley
silent zealot
#

Probably, but I don't know what other tools will do the job AND be easier to use.

coarse bay
#

How do I stop a sound?

self.character:getEmitter():playSound("Dismantle")
jovial valley
#

ok

silent zealot
#

Blender's Learning curve is rough, but there are a lot of tutorials... which is good because you need a basic "How the Heck to I use the most basic UI features?" tutorial since it is full of hidden features.

jovial valley
#

yeah, it doesn't help that google is seemingly getting dumber

#

would it be possibel for me to look at hte models of existing items though

coarse bay
#

Does play sound play for everyone or just for the player? Cus I saw somewhere that stopbyname stops only for the player

silent zealot
winter bolt
silent zealot
#

There's a Zomboid taco in blender. I have no idea how texturing working though, since all my blender skills were learned for 3D printing.

frank elbow
jovial valley
#

there's prob a way to paint directly on the model

silent zealot
coarse bay
winter bolt
coarse bay
#

you cant save it to a var and then pass the var?

lament zodiac
silent zealot
#

Yes, it suggests the idea may be feasible within certian limits... some ideas once you track things down they just won't hjappen at all without javachanges

#

There are other isozomvbie properties you can look at, like speedmult, in case those are more useful

winter bolt
coarse bay
#

just trying to stop the one i play when the action finishes

#

but that did nothing so thats why i asked of other ways

winter bolt
#

the vanilla timedactions do this

slim swan
#

is that any way to make a weapon can lighting?like the vehicle light

#

i have add lamp to cell,but dont konw how to attach a light texture

silent zealot
#

You mean like a gunlight?

#

You might be able to make melee weapons take attachments the way ranged weapons do, and if not you can look at the gunlight code.

#

Or do you want a light source that is not attached to a player?

slim swan
#

I want to make melee weapon take the gunlight

#

But can’t find the gunlight code

#

Like add a spark

vast pier
drifting ore
#

Has anyone else had trouble getting mods to load locally... I have been hardstuck rebuilding my mod for B42, and I can't even get other b42 mods to load locally rn

vast pier
drifting ore
#

Omfg

#

I've been putting it in the mods folder in the game directory instead of in users for an entire day

vast pier
#

rip

coarse bay
#

so im using starlit libary

        local option = context:addOptionOnTop("Play With", character, onCubePlay, cube)

--I call the function when the button is clicked

onCubePlay = function(character, cube)
    CubePlay:queueNew(character, cube)
end

--Which then calls this other one in the other script

function CubePlay:queueNew(character, cube)
TimedActionUtils.transfer(character, cube)
ISTimedActionQueue.add(CubePlay:new(character, cube))
end

-- I get an error that a param passed to TimedActionUtils is nil, i tried printing out which is nil but it does not print anything
bronze yoke
#

could you post the error?

coarse bay
#

how do i copy it?

bronze yoke
#

it should be in your Zomboid/console.txt

coarse bay
#
function: queueNew -- file: ActuallyUsefulItems_Cube.lua line # 60 | MOD: Actually Useful Items
function: onCubePlay -- file: ActuallyUsefulItems_Context.lua line # 7 | MOD: Actually Useful Items
function: onMouseUp -- file: ISContextMenu.lua line # 90 | Vanilla

ERROR: General     , 1738648949022> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: transfer of non-table: null at KahluaThread.tableget line:1689.
ERROR: General     , 1738648949022> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: transfer of non-table: null
    at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
    at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492)
    at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
    at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1924)
    at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:104)
    at zombie.ui.UIElement.onMouseUp(UIElement.java:1228)
    at zombie.ui.UIManager.update(UIManager.java:816)
    at zombie.GameWindow.logic(GameWindow.java:262)
    at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    at zombie.GameWindow.frameStep(GameWindow.java:765)
    at zombie.GameWindow.run_ez(GameWindow.java:681)
    at zombie.GameWindow.mainThread(GameWindow.java:495)
    at java.base/java.lang.Thread.run(Unknown Source)
LOG  : General     , 1738648949023> -----------------------------------------
STACK TRACE
bronze yoke
#

TimedActionUtils is nil, have you included```lua
local TimedActionUtils = require("Starlit/timedActions/TimedActionUtils")

coarse bay
#

i just did requires = path

#

oops

#

well still didnt fix it

#

it also says "warning require("Starlit/timedActions/TimedActionUtils") failed"

bronze yoke
#

are you in build 41 or 42?

coarse bay
#

41

bronze yoke
#

ah, should be Starlit/client/timedActions/TimedActionUtils then

#

it was moved in b42 since timed actions themselves moved to shared

coarse bay
#

now all works

#

thank you albion

surreal silo
#

where can i edit the loudness of sounds? (outside of the ingame shitty menu)

drifting ore
#

Is there any documentation for recipes?

`craftRecipe FillPipe
{
timedAction = Making,
Time = 60,
Tags = InHandCraft;CanBeDoneInDark,
category = Miscellaneous,
inputs
{
item 3 tags[Tobacco],
item 1 [Base.SmokingPipe;Base.CanPipe] mappers[PipeMapper],
}
outputs
{
item 1 mapper:PipeMapper,
item 1 Base.SmokingPipe_Tobacco,
}
itemMapper PipeMapper
{
Base.CanPipe_Tobacco = Base.CanPipe,
Base.SmokingPipe_Tobacco = Base.Base.SmokingPipe,

        default = Base.SmokingPipe_Tobacco,
    }
}`

Among other things, I am trying to figure out why tags[Tobacco], gets item 3 in front of it but the others get item 1

tacit pebble
coarse bay
#

how can u play sounds for like recepies when making them?

drifting ore
drifting ore
#

As a recipe parameter

#

I guess it probably uses the item by the delta 3 times

tacit pebble
drifting ore
#

Very interesting, thank you

#

I will have to try it

tacit pebble
#
    craftRecipe RefillBlowTorch
    {
        timedAction = Welding,
        Time = 50,
        OnCreate = Recipe.OnCreate.RefillBlowTorch,
        Tags = InHandCraft;Welding,
        category = Metalworking,
        inputs
        {
            item 1 [Base.BlowTorch] mode:destroy flags[NotFull;ItemCount],
            /*item 1 [Base.RubberHose] mode:keep,*/
            item 1 [Base.PropaneTank] flags[NotEmpty],
            /*item 1 tags[OxygenTank] flags[NotEmpty],*/
        }
        outputs
        {
            item 1 Base.BlowTorch,
        }
    }

btw if you have flags[ItemCount] for item which have useDelta then
item 3 mean Three Whole Items nomatter it's remained delta.
refilling blow torch is an example.
It destroys BlowTorch and create a new BlowTorch.

lament zodiac
tacit pebble
#
local function myFunction(perioud)
    if period == "something" then
     --here
    else
    --and here
    end
end

Events.WeatherPerioudStart.Add(MyFunction)
silent zealot
#

And only the zombies in the area immediately around the player are loaded and able to be modified, and even then I don't know how to iterate through them all without killing the PC.

#

Then the player moves, a new bit of the world loads, and all the zombies in it need to be set to sprint/not sprint since we have no idea what status they were in when their chunk was last active

#

If you're lucky there's a way to handle all this that doesn't rely on editing each zombie, otherwise I guess you just give it a go and see how much it hits performance.

bright fog
#

Tho I'm very familiar with setting zombies

tacit pebble
bright fog
#
  • OnZombieCreate: set zombie to right speed based on current weather state

Then overall

  • detect when it starts raining, or stops raining
  • iterate through every zombies in the chunk
  • set their speed accordingly to the weather change
bright fog
bright fog
#

Both my messages

tacit pebble
bright fog
#

The principle of load balancibg applies to everything. The simple question to ask yourself to know if uou should do it are:

  • do you need to run the code during the event instantly ? If no you can load balance
  • do you have anything that could be load balanced ?
#

For example my mod detects whenever a chunk loads in, and I iterate through every squares (not all in reality) but instead of running my very costly code right on load chunk, instead I run a square per tick right after by iterating through a table and removing entries and adding new squares to it to check on chunk load

silent zealot
#

Great idea, sharing the load over more than one tick

bronze yoke
#

ime a square per tick is way too slow

#

unless you're checking less than every square or something of course

silent zealot
#

Easy to adjust the rate though

bright fog
#

So in my case, it's good

#

But I agree it might be too slow, tho it really depends what you are doing too

#

But a chunk is 64 squares per level so yeah I agree it can be quite fucking slow

bronze yoke
#

and keep in mind you never load just one chunk at a time, it's usually several

bright fog
#

@autumn garnet actually this applies to your new code, do you iterate through 1 square per tick ?

#

If you do you probably want to bump that up

bright fog
bronze yoke
#

so it can be thousands of squares that you're iterating through very slowly, the player can easily add squares faster than you process them and if you're making a change the player can observe they can easily outrun it

autumn garnet
#

Random stories / vehicles stories and vehicles / random add barricade (not like Barricaded based on gridsquare) /actually i'm on the roof generator

bright fog
#

Let's not ask how the barricaded these and why lmao

bright fog
#

Idk about the barricades, I feel like some might prefer barricaded worlds as it adds more ?

#

Also breaking windows

frank anvil
#

I'm wondering if I should try to import the b42 vehicle skins into b41

#

Would that be worth it

autumn garnet
#

I also need to automatically add the sheets that cover the windows

frank anvil
frank anvil
sly monolith
#

can i get some pointers on how to make a whole outfit appear on a female zombie in a certain area

sly monolith
bright fog
bright fog
#

I need to write a wiki page about itemvisuals and zombie visuals in general

sly monolith
sly monolith
#

ah ok

bright fog
#

The problem is that spawning a specific zombie at x coordinates poses some challenges

#

I believe there's an easy solution, to make the zombie player reanimated so it's data gets saved or some shit

#

But if you don't do that your zombie won't be persistent

sly monolith
#

i just want to spawn a zombie near a church or smh

sly monolith
thorn abyss
#

this is odd, I can get a players AnimationPlayer, but can't call any methods of it

rapid flume
#

Good day to ya all modders funkers !

I have a issue, my mod with custom new items/moveables (Traps), is coming close to being done but, I had problem with sounds not playing (I though it was because I was trying to call sounds that were missing/not existing)
but once I used all existing vanilla sounds, I noticed a continuous sound, still looping after sparkler-trap explode. (script-item type weapon:CountDownSound = BlowTorch, I used this to simulate sparklers).

Any dΓ©jΓ -vu ? or insight ?

bright fog
rapid flume
#

I notice that, cuz I used FixWithTape and that one is one shot sound, best for quick recipe.

bright fog
#

You need to define your sounds with sound scripts

rapid flume
#

and its glitching footsteps.

#

I used vanilla sounds but I could create .ogg or any I know music prog.

bright fog
#

Just your sounds need a sound script to be played, which is why your sounds didn't play is my guess

rapid flume
#

ok I see thanks you, i need to program the use of that sound for my recipe/ item

coarse bay
#

I added a tooltip, but i cant get it to show it says it cant find translation but i added the files

Translate\EN\Tooltip_ENG.txt and added it

coarse bay
#

i mean it is, en i miswrote it

ornate sand
#

How is your tooltip set up in A) the script itself and B) in the Tooltip_EN file?

coarse bay
#

Tooltip_EN = {
Tooltip_Cube = "Test.",
}
Tooltip = Tooltip_Cube

#

item bellow

ornate sand
#

Do you have it as Tooltip = Tooltip_Cube
or as
Tooltip = Tooltip_Cube,
?

coarse bay
#

with ,

ornate sand
#

Weeeeeird

coarse bay
#

yeah i did everything as base game

#

same for the context menus

#

soo idk

ornate sand
#

That's exactly how mine are set up and they work just fine.

#

The translate files are in media/lua/shared/Translate/EN?

coarse bay
#

yea

#

why are there questions marks flying on some tiles?

quaint tulip
#

I know someone who does such

sly monolith
#

and also while we're at it, those shoes have 3 texture choices, is it possible to limit spawning to only 1?

bright fog
sly monolith
#

i mean with the mod enabled the shoes aren't spawning on the zombie with the outift

vast pier
#

can you put "onbreak =" on clothing or is it only for weapons?

vast pier
#

Guess I'll find out real quick

sly monolith
# bright fog No idea

could you please tell me what does this file do, it's in the lua/server/items folder, i found that in some other mod and just filled it with my stuff, but not sure what it actually does πŸ˜‚ cuz there's another lua in shared/NPCs that specifes where the outfit should spawn

ornate sand
sly monolith
#

can i somehow force zombies to spawn in their locations in game?

#

like i went to a church to see if there were any zombies wearing my outfit there, but there weren't any zombies there at all heh

vast pier
#

I have a hunch your mod is a skimpy nun outfit

umbral raptor
sly monolith
native swift
#

any idea how i would go about tiling an object? ive made a flatscreen tv and got it to function and work with vhs tapes, but currently only option to place is like freehand. it doesnt snap to a tile like a regular tv or other furniture does.

native swift
#

i also want to know how i can make disassembling a furniteure item i made split up into 2 parts like the couches and stuff do

#

idk if thats possible tho

bronze yoke
sly monolith
lament zodiac
lament zodiac
drifting ore
native swift
# sly monolith i'd suggest looking in the game files, i have no idea how any of that works but ...

i tried changing the item type to "movable" because thats what the items did in the media/scripts/newMovables. but when i go to craft the item it breaks the game in debug mode completely. and when looking further it looks like furniture calls for "worldobjectsprites" or sdomething that is in a VERY long lua file lol. so idk how i would create a new object sprite or somehow make it so that I could make the items moveable (tiled). i think the main issue is that this is a crafted item, and maybe crafted items arent supposed to moveable on tiles like that idk

sly monolith
#

you could look into building files maybe that would help somehow πŸ˜†

bright fog
chilly bronze
#

where could i find the file for skills?

bright fog
chilly bronze
#

i forget the name of this skill when creating a character. it's the one where you are harder to be detected by zombies

bright fog
#

Trait you mean

#

Inconspicuous

chilly bronze
#

yeah

#

thank you

sinful parrot
#

Is there a lower limit to setting the procedural distribution chance?

When I check LootZed, this:

table.insert(ProceduralDistributions.list["ArmyStorageOutfit"].items, "Base.Test_Item_01);
table.insert(ProceduralDistributions.list["ArmyStorageOutfit"].items, 0.005);

Has a much lower chance of spawning than

table.insert(ProceduralDistributions.list["ArmySurplusOutfit"].items, "Base.Test_Item_02");
table.insert(ProceduralDistributions.list["ArmySurplusOutfit"].items, 0.000000001);

In this example, Test_Item_01 comes back with a 0.0039999% chance of spawning while Test_Item_02 comes back with a 7.999% chance.

Is it possible to set the value so low that it wraps back around and actually increases? If so, what's the lowest?

bright fog
bright fog
#

This might interest you

sinful parrot
#

Thank you, I read through that before posting here but didn't see anything that actually gave a limit.

bright fog
#

The main thing to remember is that calculation for chances is kind of weird

#

And if you just need such rare items, you're actually probably better off doing it OnFillContainer

#

Better control on what's going on at least

sinful parrot
#

I would definitely use that option, but we're actually overwriting the distribution of another mod's items

bright fog
#

Aaah

#

Welp, I guess just set very low values

#

And try

sinful parrot
#

I'll keep lowering them until it wraps back around like it has haha

#

Thanks for your help

rapid flume
#

Siiiiiick, i got my fuse sound (non-commercial use license and my editing with my license) working for my sparkler armed trap.

Vanilla Timer trigger traps have that special sound combo of beeping (TrapTimerLoop) until it's expired (TrapTimerExpired) before the explosion.

The weapon:traps have that param: CountDownSound you can use to change the traptimerloop sound, but it doesn't allow changing the TrapTimerExpired it seems.
and it can't be changed with either other vanilla sound (events sourced) or loops because nothing is going to stop the event or loop playing.

So my guess is use only single shot sounds / not looped for this.
and make it short if you don't want the sound to continue playing (after item destroy) until it's reaches it's length. My loop not looped is 15 sec, so it's fine for 45/30/15sec timers I might not even change it.. yup the flame blast last long enough with noise so that it's barely noticeable if the sound is not finished playing after the blast.

small topaz
#

Hi! In B42, is the command "item:getRemainingUses()" for drainable items not usable anymore? If so, is there an equivalent?

bronze yoke
#

use getCurrentUses()

#

@small topaz

small topaz
#

Many thanks!

drifting ore
#

craftRecipe emptyOutCigarillo { timedAction = Making, Time = 120, Tags = InHandCraft, category = Miscellaneous, inputs { item 1 [Base.Cigarillo] mode:destroy, } outputs { item 1 ReeferMadness.emptyCigarillo, }

This simple recipe is causing my game to freeze so bad I don't even get any errors, it just stops while loading my recipes file, and I know it's this one because all the others work with it removed but I cannot for the life of me figure out what's wrong with it

jovial valley
#

it there any way to make the icon of a item with no world model bigger when on the floor? Blender with its lack of documentation and notorious leaning curve is fighting me on every step i try to take.

distant inlet
#

I'm using reloadLuaFile to update my UI classes in my mod, but after reloading, the UI still behaves as if it's using the old code - event handlers and other updates don't seem to take effect. How can I ensure that UI elements are fully reinitialized when reloading UI classes?

bronze yoke
#

event handlers are external to the file, so they won't be removed just by reloading the file, the new ones just get added on top

jovial valley
#

Based on what I'm finding, I can't do what I asked before. However, I'm still going to take the easiest route is the best route strategy, so if I were to make a flat plane with a 2d texture on it, what angle would I have to put it on either in blender, or if rotation is a value I can put into the script for its model, then that, if I wanted it to face directly at the camera.

silent zealot
#

You see this with items like broken glass, which has an inventory icon and place-as-world image but no 3d model for "sitting on the floor"

tacit pebble
#

if you want to change icon's size then
inventoryItem:getTex():setWidth() and setHeight()

#

you can do this

jovial valley
tacit pebble
#

they are also big when you dropped into floor.
I actually did inventoryItem:getTex():setWidth(32) for 256x256 icons to make smaller

#

because when you dropped on floor, as DrStalker said it's just an its icon

jovial valley
#

i assuming i need to put inventoryItem:getTex():setWidth() in a lua file

tacit pebble
jovial valley
#

when sizing up the icon do i use a client, sever, or shared lua

tacit pebble
#

I did it from client side

#

I've never made mods for mp so idk :3

jovial valley
#

can you point me to some documentation on how to set up the lua file to use inventoryItem:getTex():setWidth():setHeight()

tacit pebble
distant inlet
tacit pebble
#

for me, I initialized all 256x256 icons to 32x32px when game is booting.

agile hornet
#

I'm kind of spitballing here, since I have no direct experience with making mods, but I kind of wanted to create a mod thats in the form of a tarkov-style flea market, driven by players in SP. You think that's possible?

tacit pebble
winter bolt
#

doing this wouldnt be ideal tbh since the texture would have filtering applied to it

jovial valley
winter bolt
#
function HHBRCAdjustItemIconSize(item)
    item:getTex():setWidth(10)
    item:getTex():setHeight(10)
end

like this

jovial valley
#

oh ok thx

#

i did some organizing of my mod and now PZ wont recognize that its there

tacit pebble
#

you need common folder.

#

42 and common both are needed

jovial valley
#

that would be it

umbral raptor
#

Is anyone interested in making a collabaration to make a medieval-focused mod?

#

I have a plan for a mod called After The End that adds new things related to medieval such as alcohol brewing, melee weapons, leather and cotton clothing, new furniture, etc.

vast pier
#

Hey, how do I list a mod as incompatible with a specific mod in the mod.info file?

vast pier
tacit pebble
vast pier
tacit pebble
#
require=\Bandits
incompatible=\BanditsDayOne

from bandit week one

fathom dust
#

I can't seem to get the "bare hands" weapon type. I'm trying to simulate a shove. Static methods should be accessible with. right?
InventoryItemFactory.CreateItem("Base.BareHands")
causes a null exception

vast pier
#

what are you needing to simulate a shove for?

fathom dust
#

b42

fathom dust
tacit pebble
#

instanceItem("Base.BareHands")

#

InventoryItemFactory.CreateItem does not work anymore in B42

umbral raptor
#

pretty much we divide the work and try to finish faster. but if u know LUA then I'll need u to focus on that while I focus on the other things like items and clothing