#mod_development

1 messages Β· Page 174 of 1

novel barn
#

I did notice the name was borked but I can't for the life of me figure out how to expand those windows. I don't think I can.

bronze yoke
#

oh, did you reload the file (as opposed to a full lua reload) before this happened?

novel barn
#

@bronze yoke that could have been it! The problem DID go away when I closed the game. πŸ€”

bronze yoke
#

if you a hook a function and then reload the file, it hooks it again, stacking upon itself

novel barn
#

Yup. That's it!

bronze yoke
#

that's one of the main reasons i stick to full lua reloads

novel barn
#

Is there an easier way to do a full reload without going back to the main menu?

bronze yoke
#

no

bronze yoke
#

it only takes my pc about five or so seconds to load back in so it's never really bothered me

#

even if you could reload midgame it'd still be prone to some of the same issues

#

and vanilla lua is not equipped to deal with those issues so it'd be catastrophic

novel barn
#

I'm willing to bet you also have to reload a lot less than I do. Most of what I'm doing is banging sticks together and hoping magic will come out. I'm still doing a lot of guesswork.

trim mist
#

I think i'll be logging off shortly. But before I head off I'd like to ask, does anyone know why my game doesn't know what variable ATM is?

#
local ATM = AnthroTraitsMain;
...
local OriginalEatPerform = ISEatFoodAction.perform;
ISEatFoodAction.perform = function(self)
    -- code to run before the original
    OriginalEatPerform(self);
    -- code to run after the original
    ATM.DoVoreModifier(self.character, self.item, self.percentage)
end
bronze yoke
#

where does AnthroTraitsMain come from? is it global?

trim mist
#

This is a new bug after making it a module

#
AnthroTraitsMain = {};
...
AnthroTraitsMain.DoVoreModifier = function(character, foodEaten, foodPercentEaten)
...
return AnthroTraitsMain
bronze yoke
#

but does this file require that file?

trim mist
#

mmm. no.

#

that's required huh.

novel barn
#

Just confirmed my inventory IS in the title of the window instead of the content. :/

bronze yoke
#

actually if it's not local it shouldn't be (but if it's not local there's not much purpose to using the module pattern)

trim mist
#

I'd like to code in lua more properly, so I def don't want it to be local and actually understand this module pattern

bronze yoke
#

the module pattern is basically turning every file into its own environment, which you can then choose to pull into another file by requiring it into a variable

#

so you keep all (or most of) your functions and variables in a local table, and return that table at the end of the file

#

then if you need that file in another, you require that file and put it into a variable so you can use that table

trim mist
#

Should I be doing that for my function hooks? I thought the purpose of them was to be sort of global

bronze yoke
#

function hooks should be global, or you're not actually hooking anything

trim mist
#

also. for the require this is what was messing me up before I chose to make everything modules. Is this enough?

local ATM = require(AnthroTraitsMain);

or do i have to guess the folder path I should be looking for the file in?

trim mist
bronze yoke
#

you do need to point to the file (the path after lua/client/ or whichever folder it's in)

trim mist
bronze yoke
#

e.g. lua/shared/myMod/myModule.lua would be pulled in with local myModule = require("myMod/myModule")

trim mist
#

is the path relative? or whenever you require does it start from the same place?

bronze yoke
#

it always starts from the same place

trim mist
#

okay, thats really really useful to know

#

...

#

albion, would you (or anyone else who's knowledgeable in lua) be interested in taking a look at my repo at some point? I'd like to make sure that my mod structure isn't strange. Like this perhaps borked setup of the module pattern I have set up

bronze yoke
#

sure, i can take a look tomorrow if you'd like

trim mist
#

also, really weird, this

AnthroTraitsMainCreationMethods = {}
...
AnthroTraitsMainCreationMethods.refundSelectedAffectedTraits = function()
...
AnthroTraitsMainCreationMethods.sortTraits = function()
...
return AnthroTraitsMainCreationMethods;

works with this

--media/client/AnthroTraitsFunctionHooks.lua
local oldSOSMD = SandboxOptionsScreen.onOptionMouseDown
SandboxOptionsScreen.onOptionMouseDown = function(...)
    ATC.refundSelectedAffectedTraits();
    oldSOSMD(...);
    ATC.sortTraits();
end
trim mist
bronze yoke
#

if your modules are currently global then the difference might just be load order or something

novel barn
#

I'm calling it. Good night you two! Thanks to both of you for being so incredibly helpful today!

bronze yoke
#

gn!

trim mist
#

gn to you both too. i sleep

novel barn
#

good night to all the lurkers too. I know you're out there >.>

drifting ore
#

can anyone make a very simple mod for me

#

how do i override a mod items

#

ive set the load order for AFTER and it still doesnt work

verbal yew
tame mulch
wet sandal
#

The sun is coming up and I regret everything

#
local TestFramework = require("TestFramework/TestFramework")
local TestUtils = require("TestFramework/TestUtils")
if not TestFramework then return end

TestFramework.RegisterModule("Mod Name", "Test Group", function ()
    local Tests = {}

    Tests.testName = function ()
        TestUtils.assert(true)
    end

    Tests.anotherTestName = function ()
        TestUtils.fail("This test should fail.")
    end

    Tests.testPlayerDies = function ()
        local player = getSpecificPlayer(0)
        player:Kill(player)
        TestUtils.assert(player:isDead())
    end

    return Tests
end)
zinc pilot
#

that's amazing

hidden jungle
#

so my mod makes the player talk, how do i make the chat appear above their head for other players in multiplayer? not nessesarily in the chat box but at least overhead.
right now i'm using Player:Say() but i'm wondering if i should be using something else

mild venture
hidden jungle
shy folio
#

Does anyone know if it's plausible to apply nametags to zombies like players have?

deft plaza
#

good morning everyone

#

I scaled it in blender so I'm going to see if it works

#

okay it's still invisible

wet sandal
#

Did you center the object?

#

In blender make sure the origin of the 3D model is at the center.

mellow frigate
#

I am surprised by xml animations (AnimSets) being loaded (and reloaded at modification time) by a dedicated server LOG : General , 1687446652160> 265?615?934> DebugFileWatcher Hit. AnimSets: C:\Users\MyLogin\Zomboid\mods\InfectedPlayer\media\AnimSets\player\idle\IdleInfected.xml LOG : General , 1687446653161> 265?616?934> Refreshing AnimSets. ERROR: Animation , 1687446655176> 265?618?950> AdvancedAnimator.SetState> State not found: idle WARN : Animation , 1687446655177> 265?618?950> AnimationSet.GetState> AnimState not found: idle

mellow frigate
coarse sinew
#

Is there any method to get the type of a zombie from IsoZombie ? For example AuthenticCharcoal defined here.```lua
ZombiesZoneDefinition.AnthraxBurned = {
AuthenticCharcoal = {
name="AuthenticCharcoal",
chance=90,
},
}

bronze yoke
coarse sinew
warm forum
#

I have a question. I'm making an M1 Garand mod and i'm making 3006 rounds to add. but on the box of ammo is where i'm having an issue. I've made the model and icon, it shows up in game but i cannot open the box of ammo

mellow frigate
warm forum
mellow frigate
#

What's the way to change boredom ? I am confused with stats.Boredom, stats.boredom, stats.idleboredom. the first seems out of reach and the two laters have no effect on the moodle.

#

I'm even more confused with Game character update modifying idleboredom. I must be messing badly

#

Moodle is overriding stats.Boredom from BodyDamage.boredomLevel and then using stats.Boredom.

mellow frigate
#

I want to remove AnimSet/player/strafe/MyAnim.xml from a mod I already published. Can I just remove it or should I empty it instead but leave the file for users to get a smooth update ?

bronze yoke
#

empty it

#

the issue with steam not deleting removed files is not lua specific or anything

red tiger
#

Good afternoon.

verbal yew
#

Guys, i have a problem with facelock realisation for cars...
I can't figure out how to refer to the car so that the character only looks at it while performing the action.

mellow frigate
#

AnimActions are cool, you can apply them so only the upperbody is impacted while the lower body is not.

#

But with Strafe, the lower body is twisted. How can I remove this twist or compensate it in the AnimAction ? (by AnimAction, I mean the animation started from a lua timed action)

verbal yew
#

like RMB shouldnt work when anim play

mellow frigate
verbal yew
#

vanila work fine

mellow frigate
#

no, vanilla faces the vehicle

#

you can face the vehicle too, by using the same waitToStart funciton

verbal yew
verbal yew
#

What is the difference, in fact? drunk

mellow frigate
#

this will make you turn before the action is started and after that you will remain in that direction until a movement occures. but movements wil likely deactivate the action so it is ok

mellow frigate
#

action time is not counsumed

#

update is not yet called

#

start is not yet called

verbal yew
#

hmm

#

should I somehow predefine this separately for the transport (I'm talking about waitToStart, because another work fine...)

verbal yew
#

i mean situation with door and windows work fine without waitToStart
If i do waitToStart, it's break script? (should i do work-around for vechicles, or just paste all "Update" stuff in "waitToStart"?)

trim mist
#

The new thursdoid seems big for us!

#

Aiteron has been making improvements to our sandbox menu, mod menu general mod settings. Our sandbox settings panels had become so vast and unwieldy that they needed a redesign – now with an added search function, simplification in some areas to make things less impenetrable to noobs, and some β€˜advanced settings’ for the long-term survivors amongst us. We will also be improving the server settings interface, simplifying the addition of mods, unifying settings, making it easier to add modded sandbox settings etc.

#

plus the entirety of the vending machine / all machine UIs

#

I'm very temped to ask Aiteron if they can speak a little more on this

lapis stratus
#

Idea for a mod

two people can lift an object together - halfing the weight if they both agree to lift and stay nearby!

sharp minnow
near chasm
#

local function adjustFoodNotPicky(item)
    -- Cancel out any negative effects
    if ((item:getUnhappyChange() > 0) and (item:getType() == "Base.DogfoodOpen")) then
        item:setUnhappyChange(- 10)
    end
    if ((item:getBoredomChange() > 0) and (item:getType() == "Base.DogfoodOpen")) then
        item:setBoredomChange(- 10)
    end
end```

This code isn't working if I add the `and item:getType() == "Base.DogfoodOpen"` but it seems to work without it. What's going on? This is supposed to make ONLY dog food give happiness.
bronze yoke
#

getType() won't include the module Base

#

use getFullType()

near chasm
#

Thanks, I'll try that! pinkhearts

#

That worked! Thank you so much

fresh lodge
#

Hello lads, what's the way to override multiple vanilla recipes with the SAME name?

bronze yoke
#

you need to use lua to disable them

#

the script method of overriding them doesn't work for multiple

fresh lodge
#

happy days

#

i'm pretty good with LUA

#

yet i'm pretty bad with the API

#

(started modding PZ very recently)

#

what should i look for?

bronze yoke
#

ScriptManager has an arraylist of recipes

fresh lodge
#

so i guess recipe = nil

bronze yoke
#

i think you'd need to set the recipe to hidden or something

#

i don't know if just removing it from the list would work, that'd be pretty convenient if it did but i've never seen people go about it that way

fresh lodge
#

may i ask you if you know where i could find an example script? even a mod or something the API isn't too explanatory at points

bronze yoke
#

(untested)```lua
local recipeToRemove = "Recipe Name"
local recipes = ScriptManager.instance:getAllRecipes()
for i = 0, recipes:size()-1 do
local recipe = recipes:get(i)
if recipe:getName() == recipeToRemove then
recipe:setIsHidden(true)
end
end

fresh lodge
bronze yoke
#

it's pretty rare for a mod to directly reference recipes like this, and when you directly reference content that isn't from your own mod you should write your script to handle if it doesn't exist imo

fresh lodge
#

yh, exactly

#

the script goes into media/lua/server right?

bronze yoke
#

server or shared, doesn't matter

fresh lodge
#

correct me if i'm wrong

#

client folder - client only script

#

shared - both client and server

#

server - server only

bronze yoke
#

that would make sense wouldn't it

fresh lodge
#

does

bronze yoke
#

client - client only script
shared - both client and server
server - both client and server

fresh lodge
#

wasn't sure about shared tho

bronze yoke
fresh lodge
#

if was only a hook for both or the same working environment

#

guess i'll give it a try

bronze yoke
#

all share the same environment, the only difference is whether the client files get ran or not

ivory gyro
#

Is someone know how to set pain in lua ? Cause setPain(30) didnt work

fresh lodge
#

thanks

#

it worked

deft plaza
#

hey can someone tell me if I am doing this wrong

wet sandal
#

Nothing wrong there I can see

deft plaza
#

the model is just not there

wet sandal
#

Is the orange dot in the correct point in blender?

#

The dot shows the origin of the object, it should be positioned at the exact bottom center of your object.

#

If it looks something like this, your models probably offset in-game

#

Had an item in Susceptible 20m east of where it should be because of that

deft plaza
#

I'm trying to make a cookie box and I think its underground

#

unless I have the wrong model directory

#

Food Items are WorldItems

#

right?

wet sandal
#

WorldItem is the type for 3D items you can see on the floor.
They can hold a reference to any InventoryItem type.

deft plaza
#

alright so how would I do it? for the floor model?

wet sandal
#

You've already done it right as far as I can tell from the scripts you've posted.

#

Which is why I suspected an offset issue with the model

deft plaza
#

this is the offset

wet sandal
#

A baked offset in the fbx file itself

deft plaza
#

where do I find the offset in blender

wet sandal
#

Its visualized by the orange dot, like the screenshots I showed

deft plaza
#

got it

wet sandal
#

The dot is the true origin of the model

deft plaza
#

I think

wet sandal
#

Ctrl-A -> apply location

#

See if that helps

deft plaza
#

it didnt do anything

wet sandal
#

set the location to 0,0,0 in blender

#

The model should be resting on the floor, if its not, you need to adjust it and apply the location so that its resting on the floor with the location set as 0,0,0

deft plaza
#

okay progress it worked but its large

drifting ore
#

Notloc I haven't been around much but saw your inventory mod released here. congrats on that man, seriously such an undertaking. kudos!

limpid tundra
#

I put it in mod support but i dont think it was the correct chat for it

#

Yo im incredibly new to modding and trying to make a simple trait mod where the character gains 2 beginner books at the start of the game
My code isnt working tho can someone help

trim mist
#

show us the error

bronze yoke
#

you need to put the code to add the item on an event

#

you just put it out in the open instead of in a function, so it just runs when the lua loads, before there is ever a player

#

it's also not clear where bag comes from? and addItemOnServer isn't necessary for player inventories, you can just use AddItem

red tiger
#

They probably need to take a look at how Lua functions in PZ with events.

#

This potentially seems more like a structural / a fundamentals issue.

deft plaza
#

I forgot how to do something how do I select a certain part of a model and just paint on that

#

because I keep painting something I don't want to

bronze yoke
red tiger
deft plaza
#

no one is there but okay

red tiger
deft plaza
#

still waiting...

deft plaza
#

still wating...

bronze yoke
#

complaining won't get you a faster response

wet sandal
deft plaza
deft plaza
#

⌚ Hold up I got the perfect thing for this

trim mist
# deft plaza ⌚ Hold up I got the perfect thing for this

Nobody is obligated to help you here. You're not building goodwill by being impatient and demanding answers, and you're not even asking in the right channel. Ask specific questions and people may help, but don't just ask questions that have the appearance of being able to be answered in less than a minute.

#

Worst case scenario? Look up a texturing tutorial on youtube.

deft plaza
#

I posted my question in modeling

mellow frigate
#

Right click + Block

deft plaza
#

πŸ‘

#

alright, whatever don't help me I don't care anymore I was even thinking to myself when I first thought about making mods "I don't think anyone wants to help they will just keep to themselves" and I was right so whatever man

#

I goddamn knew this was a stupid idea

deft prism
#

I would try youtube since it would be faster for you

trim mist
#

you phrase questions like "either my model is under the ground or not working, here is the thing", and there's zero context for people to help you. You're putting more burden on your potential helpers by making them try to figure out context and what you even mean, instead of letting them focus on your issue.

#

There is a reason I spend 5+ minutes typing a question in here.

lone nest
deft plaza
trim mist
#

I for one will be happy to try to help where I can if you can put what I said into practice.

soft hornet
#

Been watching for awhile. Your guilt-tripping will not work here.

bronze yoke
#

the guilt trip is not working

trim mist
#

yeah also it's 100% manipulation that you're trying so

soft hornet
#

We don't often interact with the modders here outside of the main chats, but they've been a wholesome and inclusive community here willing to step up and help each other when they can.

#

You make things difficult for everyone, even in main chat, by being vague and curt in your questions and 'why does this not work'. Then getting hostile and dismissive to people who tried to bother and are unsure of what you are asking.

limpid tundra
lone nest
#

To be frank, you need to have a clearly defined goal of what you are trying to do when you go into modding, its like working on your own car.

#

If you ain't got a goal nor even a set out a simple task to do, you ain't gonna get anything done.

#

and the best way to learn is to look at existing mods

lone nest
limpid tundra
#

how can i increase my character's reading speed?

#

like through a trait

bronze yoke
#

you need to hook ISReadABook:new(), check for the trait and multiply the time

novel barn
#

So I know it's probably less than ideal to shill your own mod as a template... but what about shilling someone elses for them? I know a certain someone who has written a full featured literacy mod that might be a great resource for learning more about the mechanics behind reading.

limpid tundra
#

also is there anyway to look at the vanilla trait code? cuz this is just me adding fast reader into a larger trait

bronze yoke
#

that trait is luckily implemented in lua so you can see it in the function i mentioned

bronze yoke
#

i really need to get that out sometime, the version on the workshop is about nine months behind

#

it's barely even the same mod

novel barn
#

Can you still power level the skill through magazines? πŸ‘‰ πŸ‘ˆ

bronze yoke
#

i don't remember if i changed the xp values for those, but the skill gain is rebalanced overall

bronze yoke
#

the biggest change is the addition of vhs tapes that give you a literacy xp multiplier, so i reduced the base xp gain a bunch to compensate

limpid tundra
#

aight ima come back in 5 years when i have a degree in comp sci and understand lua

novel barn
limpid tundra
#

ill keep that in mind

#

lua probably isnt in the curriculum

limpid tundra
novel barn
#

This dang game. I've spent the last 3 days trying to figure out why my character can dig with the default ISShovelGroundCursor.GetEmptyItem function, but when I intercept it to print to the console and return it can't queue the shovel action. It wasn't working 15 minutes ago. The guy has just been idling there. I tab back in and on a whim try to dig again. He digs no problem. I bet if I restart the game it'll be broken again. I tell you man, ghosts.

bronze yoke
#

LOL

novel barn
#

@lone nest I'm not sure what your question is. What's up?

lone nest
#

Well - as far as I can tell, most of the in-game actions work in a queue system, so First-In-First-Out.

#

it's possible your actionsqueue got overloaded to a point where it was busy doing other crap/getting stuck before finally getting to the shovel action.

novel barn
#

That's how I understand it as well. However I'm getting bugged action, cleared queue ISShovelGround and can't figure out why

#

As far as I'm aware, there's just the one dig action happening

lone nest
#

care to share your code?

novel barn
#

I'm not asking the game to do anything differently besides hijacking the getemptyitems function to print a statement and then returning.

#

sure! Lemme get it all set up.

bronze yoke
#

that sounds like you're not passing an argument it wants

#

(since you are returning the original i assume that's not it)

lone nest
#

there are some ... oddities in my observations because the actions can be queued/updated on a tick-basis... so it's pretty easy to miss/pile-on actions into the queue.

novel barn
#

I have this override function where I will need to (in the future) alter a few values

local old_SGC_GetEmptyItem = ISShovelGroundCursor.GetEmptyItem
ISShovelGroundCursor.GetEmptyItem = function(playerObj, groundType)
    print("attempting to intercept SGC.GetEmptyItem")
    local oldValue = old_SGC_GetEmptyItem(playerObj, groundType)
    return oldValue
end

I'm hijacking this completely untouched function from the basegame here

function ISShovelGroundCursor.GetEmptyItem(playerObj, groundType)
    local playerInv = playerObj:getInventory()
    local fullType
    if groundType == "dirt" then
        fullType = "Base.Dirtbag"
    elseif groundType == "gravel" then
        fullType = "Base.Gravelbag"
    elseif groundType == "sand" then
        fullType = "Base.Sandbag"
    end
    local item = playerInv:getBestEvalArgRecurse(predicateTypeNotFull, comparatorMostFull, fullType)
    if not item then
        item = playerInv:getFirstEvalRecurse(predicateEmpty)
    end
    return fullType,item
end
#

all I've been able to determine so far is that item comes back nil

fast galleon
bronze yoke
#

oh, it might be because it has two return values but you only grab one

novel barn
#

but I've been staring at this for 3 days so I'd be happy for someone to tell me I'm dumb and made a silly mistake

bronze yoke
#

try```lua
local fullType, item = old_SGC_GetEmptyItem(playerObj, groundType)
return fullType, item

#

if you don't need to run code after the original you can also just return old_SGC_GetEmptyItem(playerObj, groundType)

lone nest
#

mhm, yeah it also looks like fullType could be nil?

bronze yoke
#

i've actually never run into that since multiple returns are rare, that's a fun one

lone nest
#

oh yeah, I just create a table in those cases...

novel barn
#

as I say daily, I'm digging way above my paygrade

lone nest
#

modding is free, it's never above your paygrade

#

only sanity

novel barn
#

sanity is slipping πŸ™‚ haven't actually been able to play PZ because I wanted to finish this first

#

was supposed to be quick. 20 minutes in and out tops.

#

Ohhh.. I know why I thought oldValue would just... work. I've been following this template and incorrectly assumed Albion's oldValue was getting back the exact parameters the function it was running was sending...

#

This whole time I've been thinking "oldValue can't just hold Fulltype and item, right? But that's basically what her code is doing."

bronze yoke
#

if you wanted a reusable template that's safe with this sort of thing, you could do (pseudo)```lua
local oldReturn = {originalFunction(params)}
return unpack(oldReturn)

novel barn
#

#function_parameters ~= #function_returns

#

Oh I'll recognize multiple returns in the future. I recognized it here... just didn't put the pieces together... This is why I like to really struggle with something before I ask for help. I'll NEVER make this mistake again.

bronze yoke
#

believe me i would have made that mistake too

novel barn
#

I need to play around with .unpack. I've seen it around before and it would have been super useful here.

#

Thank you all for the help!

#

I've been staring at this for so long... what mod was I writing? πŸ€”

hidden jungle
#

is there a way of detecting if a player is inside of a city?

crystal oar
hidden jungle
#

that might work

#

do modded maps have those zones updated properly?

crystal oar
#

i was just playing in a map that had an urban area as deep forest, which means loot will not respawn there naturally

hidden jungle
#

how do you detect the foraging zone?
i can make it work for what i'm trying to do

crystal oar
#

albion, you still up? i have no idea personally, but i am certain it can be done

bronze yoke
#

i actually don't know πŸ˜…

#

the new foraging is lua so it might just be a function call there

hidden jungle
#

aight, i'll go look for it. thanks

crystal oar
#

sorry i couldn't help, good luck!

#

how do i add a button to the admin panel? does anyone have an example bit of code i could look at? I have never edited the ui in pz

hidden jungle
#
local function getZoneType(_x, _y)
    local zones = getWorld():getMetaGrid():getZonesAt(_x, _y, 0);
    if zones then
        for i = zones:size(),1,-1 do
            local zone = zones:get(i-1);
            if zone then
                if forageSystem.zoneDefs[zone:getType()] then
                    return zone:getType();
                end;
            end;
        end;
    end;
    return "Unknown";
end```
this looks promising
crystal oar
#

okay so I want to take this and add a context option to it function ISMiniScoreboardUI:doPlayerListContextMenu(player, x,y) local playerNum = self.admin:getPlayerNum() local context = ISContextMenu.get(playerNum, x + self:getAbsoluteX(), y + self:getAbsoluteY()); context:addOption(getText("UI_Scoreboard_Teleport"), self, ISMiniScoreboardUI.onCommand, player, "TELEPORT"); context:addOption(getText("UI_Scoreboard_TeleportToYou"), self, ISMiniScoreboardUI.onCommand, player, "TELEPORTTOYOU"); context:addOption(getText("UI_Scoreboard_Invisible"), self, ISMiniScoreboardUI.onCommand, player, "INVISIBLE"); context:addOption(getText("UI_Scoreboard_GodMod"), self, ISMiniScoreboardUI.onCommand, player, "GODMOD"); context:addOption("Check Stats", self, ISMiniScoreboardUI.onCommand, player, "STATS"); end

#

i am assuming overwriting ISMiniScoreboardUI.lua is super bad practice?

bronze yoke
#

super bad practice

#

hook the function instead:```lua
local orig_doContextMenu = ISMiniScoreboardUI.doPlayerListContextMenu
function ISMiniScoreboardUI:doPlayerListContextMenu(player, x, y)
-- do your own stuff before
orig_doContextMenu(self, player, x, y)
-- do your own stuff after
end

#

it's annoying because in this case the context menu isn't easily accessible (usually the context menu is passed as an argument you can intercept), but there are functions for getting existing context menus

crystal oar
#

so the line orig_doContextMenu gets the main context menu?

#

sorry if i am misunderstanding

bronze yoke
#

that calls the original version of the function - since that function doesn't return the context menu or have it passed in you need to find your own way of getting the context menu it creates

#

i was helping braven with something like this the other day so i might be able to find it easily

crystal oar
#

oh nice, braven makes some good stuff

bronze yoke
#

it might be as easy as local context = getPlayerContextMenu(player:getPlayerNum())?

crystal oar
#

i'm going to try to add an item to the targeted player's inventory from the mini scoreboard, i might be able to figure it out now that you've helped me out

#

i don't think this isright, but i think it will look like this context:addOption("Add Starter Kit 1", self, ISMiniScoreboardUI.onCommand, player, "additems(SSKits.SKit1, 1)");

#

maybe like context:addOption("Add Starter Kit 1", self, ISMiniScoreboardUI.onCommand, player, player:getInventory():AddItems(SSKits.SKit1, 1));

crystal oar
#

this is going to be harder to test than other stuff i have done since it requires a second player

#

luckily i own a second copy lol

bronze yoke
#

you can actually test on a single copy in non-steam mode

crystal oar
#

okay so definitely writing it wrong so far, the new context option didn't even show

#

maybe context:addOption("Add Starter Kit 1", self, ISMiniScoreboardUI.onCommand, player, "GiveSKit1"); and then where would i define GiveSKit1?

#

i feel like i'm only a little over my head, but i still am not getting why my new context option isn't showing up

novel barn
crystal oar
#

oh i just loaded up pz on my other computer and copied the mod over

novel barn
#

That works too πŸ™‚

crystal oar
#

thank you for the link!

novel barn
#

You're welcome! I wrote it and I'm dying to get feedback from anyone who uses it. πŸ˜‚ I'm sure there might be faster or better ways to do it.

crystal oar
#

well having only read it and not tried it, my sleep deprived brain still made sense of it, so that's a plus

novel barn
#

I'll take it hahah

crystal oar
#

so i am stumped why this context option isn't showing up on the miniscoreboard rightclick

#

i tried adding a second copy of check stats copied verbatim from the context menu context:addOption("Check Stats", self, ISMiniScoreboardUI.onCommand, player, "STATS"); and i only see one copy of check stats. any ideas? local orig_doContextMenu = ISMiniScoreboardUI.doPlayerListContextMenu function ISMiniScoreboardUI:doPlayerListContextMenu(player, x, y) -- do your own stuff before orig_doContextMenu(self, player, x, y) -- do your own stuff after context:addOption("Check Stats", self, ISMiniScoreboardUI.onCommand, player, "STATS"); context:addOption("Check Stats", self, ISMiniScoreboardUI.onCommand, player, "STATS"); context:addOption("Check Stats", self, ISMiniScoreboardUI.onCommand, player, "STATS"); context:addOption("Add Starter Kit 1", self, ISMiniScoreboardUI.onCommand, player, "GiveSKit1"); end

tame mulch
#

try just overwrite func

crystal oar
#

okay

crystal oar
#
function ISMiniScoreboardUI:doPlayerListContextMenu(player, x, y)
    local context = ISContextMenu.get(playerNum, x + self:getAbsoluteX(), y + self:getAbsoluteY());
    -- do your own stuff before
    orig_doContextMenu(self, player, x, y)
    -- do your own stuff after
    context:addOption("Add Starter Kit 1", self, SKitsMiniScoreboardUI.onCommand, player, "GiveSKit1");
end

function SKitsMiniScoreboardUI:onCommand(player, command)
    if command == "GiveSKit1" then
        SendCommandToServer("/additem \"" .. player.displayName .. "\" SSKits.SKit1\"");
    end
end
``` is what i have now, no luck so far, but now it throws an error so progress
#

i'm sleepy but i bet it has to do with the escape characters in the second part

#

ISMiniScoreboardUI is a global right?

crystal oar
#

function SKitsMiniScoreboardUI:onCommand(player, command) is making it sad

#

getting closer i think

#

and there it is

hidden jungle
#

ughhhhhh.
Discarding an item via foraging doesnt set its timed action to Finished.
its a 0 time action so i understand the oversight but still.
trying to detect when the player has completed a foraging action is such a pain in the ass because of it

#

best solution i've found is to check and see if the current time is 0. most of the time regular timed actions skip over 0 by some small amount, occasionally it'll be 0 for one frame though. which causes a double proc of whatever effect is supposed to happen.
i think i'm just gonna leave it like that because i can't find anything else.

crystal oar
#

okay so now i have the problem when i use function ISMiniScoreboardUI:onCommand(player, command) i seem to have overwritten it so the default options don't work, but my new ones do

#

and probably fixed it SKitMiniScoreboardUI = ISPanel:derive("ISMiniScoreboardUI"); local orig_doContextMenu = ISMiniScoreboardUI.doPlayerListContextMenu function ISMiniScoreboardUI:doPlayerListContextMenu(player, x, y) local playerNum = self.admin:getPlayerNum() local context = ISContextMenu.get(playerNum, x + self:getAbsoluteX(), y + self:getAbsoluteY()); -- do your own stuff before orig_doContextMenu(self, player, x, y) -- do your own stuff after context:addOption("Add Starter Kit 1", self, SKitMiniScoreboardUI.onCommand, player, "GiveSKit1"); end function SKitMiniScoreboardUI:onCommand(player, command) if command == "GiveSKit1" then SendCommandToServer("/additem \"" .. player.displayName .. "\" SSKits.SKit1\""); end end

hidden jungle
#

what are you trying to do? i havn't been reading thus far

crystal oar
#

trying to add a context option to the mini scoreboard to add an item to the targeted player's inventory

#

i think it's working and not overwriting the other options now

#

just successfully did old mini scoreboard stuff and new mini scoreboard stuff

hidden jungle
#

cool, i haven't messed around too much with overriding vanilla functions.

crystal oar
#

so you got your foraging thing working but proccing twice?

#

foraging is my favorite system as a player for sure

hidden jungle
#

sorta,
its a chance that it triggers twice when doing the "pick up" option.
most of the time the TimedAction has its CurrentTime at something other than 0 when you call it. unless its the Discard action. which activates instantly and only lets the timed action exist for 1 frame. the current time is always 0 for that

timed actions are supposed to have a :finished() function that you can use to tell if the action was completed or not but the Discard function doesnt set it

#

so i had to get creative

crystal oar
#

could you check to see if the player's inventory changed during the action? or is that like using a hammer to drive screws?

hidden jungle
#

theoretically yes, but it would cause a ton of unnecessary CPU usage tracking the players inventory that often.
i could slow it down, but it doesnt solve the problem of trying to figure out when the player does the discard action.
you can see the ISForageAction but without the :finished() setting being set you'd have to watch the players inventory until the action is stalled. which you can only detect by watching the CurrentTime anyway.
since TimedActions have a whooping 6 variables you can read. with 2 of those being related to the hand model

#

its more an issue with TimedActions being really hard to get info from.
the only things you can pull from it are
Finished
Current Time
Current Delta
Primary and Secondary Hand Items
Primary and Secondary Hand Models

#

and as far as i know you cant detect player actions in any other way

crystal oar
#

ah wow, that does sound tricky

hidden jungle
#

i've had to pull shinanagains all over the place to make some of my stuff work lmao

#

i honestly enjoy it, good problem solving game

#

another issue i'm having is i can't figure out how to make the Player:Say() command appear for other players in multiplayer
does it default to a range of 0 or something?

#

theres a varient of the say() function that lets you input a range, but in order to use it i would have to also input what text color will be used. and i cant find where the players unique color is stored (or if i can even pull it)

#

i might have found it actually
supposedly Player:getInf() returns a ColorInfo value

crystal oar
#

nice

hidden jungle
#

in hindsight i really didnt look at all. theres litteraly a Player:getSpeakColour() function

crystal oar
#

can you make a recipe name be defined in the sandbox vars?

hidden jungle
#

probably not, but i'm not sure.
most additions happen before sandbox settings can be set. so unless theres a way to update the recipe when the world starts i dont think so

crystal oar
#

how do translations for recipe names work? are they also done at the same time?

#

oh i could use the Tooltip: to perhaps have the functionality i need

hidden jungle
#

maybe, i have literally no experience with recipies so i have no clue

#

gl though

crystal oar
#

thanks, i have very little experience in general but most of my mods have been vanilla items to vanilla items through recipes

#

just trying to polish one of my mods up nice

hidden jungle
#

nice, most of my experience has been with traits and things that involve the player info directly

crystal oar
#

i see some tooltips have variables, makes me hopeful Tooltip_RemoveCurtains = "Gives one %1.",

#

is there a way to make loot respawn in areas other than urban, farmland, and trailer park?

crystal oar
hidden jungle
#

we had that same problem on our world. 3 of the 4 of us have organized and the last guy keeps having to throw books on the floor
as i was making it i realised i should probably give it a decent name and image since its probably a common problem

#

:P

crystal oar
#

oh not the books!

#

lol that's rough

hidden jungle
#

it also gives everyone nutritionist as well because that was another trait that they wanted

crystal oar
#

it's nice to have, and unless you are pvping or rping no reason not to have it

hidden jungle
#

ye

deft plaza
#

Sorry about last night guys I was really tired and pissed because I couldn't get the mod working

ivory gyro
#

Is someone know how to set pain in lua ?

deft plaza
#

sorry nevermind I just checked

ivory gyro
#

in lua

deft plaza
#

sorry

verbal yew
#

they have stuff if u not go pee, u take pain in bodypart

ivory gyro
#

okok nice

#

but i need vanilla pain its for why

hidden jungle
#

how to i create a color?
like if i wanted to set the color of a shirt to something, you call :setColor(Color) but how do you create the color that you use in the function?

unkempt dove
# ivory gyro Is someone know how to set pain in lua ?

You can use player:getStats():getPain() and player:getStats():setPain() where player is an IsoPlayer object. For body parts you can use getPain() on a body part to get the pain level specific to that body part, but you can't set its pain level directly. It's determined by the type of wound that it has + whatever its additionalPain variable is set to

uneven spindle
red tiger
#

Oh heck. You did what I was thinking about doing later on this year.

#

Nice.

#

I want to be able to emulate x86 ASM in the computers in PZ.

uneven spindle
#

hahah sorry mate! was not my intention to steal your projects πŸ˜„

red tiger
#

This helps if anything. (Providing an API)

uneven spindle
#

just kidding πŸ˜›

red tiger
#

I'm glad this exists.

uneven spindle
#

i was trying to start a micro "game engine" inside PZ, just to expand the games/apps catalog

red tiger
#

@uneven spindle I want to be able to do things like this in your terminal:

#

xD

uneven spindle
#

I don't know if vanilla font supports some special characters, should investigate it

#

and I don't know if we can add custom fonts either

red tiger
#

(You can)

#

AngelCodeFont

#

If it's a big ask, don't do it.

uneven spindle
#

AngelCodeFont is a mod from the community? or its the name of a font inside the game?

uneven spindle
red tiger
uneven spindle
red tiger
#

Roughly no one does. I know because I did the dive to get there.

#

One of the many hidden gems.

uneven spindle
#

thanks !! I will take a look

tranquil kindle
#

Anyone familiar with what "AngleFalloff = TRUE " is for? Its only on vanila shotguns but im not sure whats the point of this.

tall eagle
#

Hello everyone, I ask for your precious help!
In the sandbox settings I would like to show only some of the option lists if a particular other mod is installed (ie Raven Creek).

For example:
Mod XYZ is installed:
the options dropdown contains : OPT1, OPT2, OPT3,OPT4
Mod XYZ is NOT installed:
the options dropdown contains : OPT3,OPT4

how can i manipulate the sandox gui for this purpose?
Thanks in advance

fast galleon
keen whale
#

Is there a good thread anywhere out there outlining how to start developing mods?

verbal yew
#

may be...

red tiger
#

This is a mapping of typings for Project Zomboid's API.

#

It'll help a ton.

tall eagle
tall eagle
fast galleon
# tall eagle using :prerender() on sandbox gui maybe?

if you want to take a look

The game has a few, slightly different, UI it uses to show and edit the sandbox options, these are:
SandboxOptionsScreen: UI used when starting a new save in SP - SOLO - New Game - Sandbox Options
ServerSettingsScreen: UI with all server settings - Manage Server Settings
ISServerSandboxOptionsUI: opened from admin settings? and the change sandbox mods

The settings for the sandbox UI are generated and stored in a local SettingsTable table in ServerSettingsScreen.lua. Access to this UI is intentionally limited.
The other two UI use the command ServerSettingsScreen.getSandboxSettingsTable() to get a copy of the Sandbox table with settings for the ui.
tall eagle
mellow frigate
verbal yew
bronze yoke
#

you have these == part checks but part is not defined?

verbal yew
#

not sure

#

this is stuff defined lockpick_object like "door" or "window", but some trouble with vehicle part, idk why it not work and face position not lock...

fresh lodge
#

Hello, dumb question, how do i add a custom icon to a new item i made? This is what i've done

Item MyItem
{
...
icon = MyItem
...
}

In my mod folder media/textures/MyItem.png

Yet the icon is not showing

bronze yoke
#

Item_MyItem.png

#

the prefix is always added

fresh lodge
#

tried that too

#

like this

#

Item MyItem
{
...
icon = Item_MyItem
...
}

bronze yoke
#

icon should be without the Item_ prefix

verbal yew
#

Nope

bronze yoke
#

but the filename should have it

verbal yew
#

icon = Myitem

fresh lodge
#

oooh i see

#

thanks

#

saw an old forum post saying that icon = item_MyItem

verbal yew
#

It was the second month of breaking my head over the decision...

mellow frigate
# verbal yew FacePosition not fixable :D don't work(

you need to check what return parameter are. the problem is on the use of return and (maybe) on the way you could retrieve the right vehicle (I'm not sure about that) Maybe a good teacher like Albion can help better than me or check online for "return parameter of function" this will help for lua and for most languages anyway

fresh lodge
#

Oh BTW kERHUS your lockpick mod is sweet AF

verbal yew
fresh lodge
#

yh i know but your version is much better

verbal yew
#

thanks :P

mellow frigate
#

It would be awesome if "ZombiesDontAttack" parameter was working to prevent a character from being attacked by zombies (I use invisible for that purpose but it has downsides). From a larger perspective there could be a "faction" matrix describing factions interactions. With each character being in one "faction". Or (harder to make): With each character having an individual ponderation of each "faction". So that it could be done to alter how a specific zombie /npc instance interacts with other characters.

plain crane
#

Hey not sure if I need to post here or in #modeling but I'm very new to modding, I'm wondering if it's possible to have an item which increase the player model's size?

bronze yoke
#

i don't think so

fast galleon
plain crane
#

ty

sharp minnow
#

I'm trying to change a value on all zombies within a 10 square block of a single point. Can anyone recommend any good shortcuts?

I was going to try:
starting square,
offsetting by -5,-5
then loop with: IsoGridSquare.GetSquare
getZombie(),
do the thing;
then iterating X until it hits 10 then interating Y until the total count is 100

If there isn't a zombie in the square is that likely to throw an error? I figure if so i'd need to check to see if a Zombie is present.

bronze yoke
#

as long as you check that the getZombie() call didn't return nil it should be fine

sharp minnow
#

ok cool - is there a more elegant way?

bronze yoke
#

this is pretty much how i'd do it

#

i'm not sure if getZombie() will account for dense hordes though?

sharp minnow
#

ooo. Good point.

bronze yoke
#

you might need to loop through square:getMovingObjects() and check if each one is a zombie - but at that point that is a lot of loops, might be more performant to just loop through the zombie list and check their location?

sharp minnow
#

Ahh, that - that's it

#

thank you, i think that's better. IE make a list of 100 locations with a focal point, then pull the full list, loop and run an if location match is true then do the thing?

bronze yoke
#

it might be better to just calculate the two corners of the area (x-5, y-5 and x+5, y+5) and then check if the zombie's x and y are >= the first and <= the second

sharp minnow
#

amazing

#

thank you so much

#

I'm pretty sure you've just saved me hours of lua

bronze yoke
#

glad to help πŸ˜‡

mellow frigate
#

Hi, When I play the following animation (started from a timed action with self:setActionAnim('InfectionBack') it is sometimes played very slow, sometime played nearly instantly. Should I reset some time parameter ? <?xml version="1.0" encoding="utf-8"?> <animNode> <m_Name>InfectionBack</m_Name> <m_SpeedScale>0.80</m_SpeedScale> <m_AnimName>Bob_HitDeath_WalkBwdAim</m_AnimName> <m_deferredBoneAxis>Y</m_deferredBoneAxis> <m_BlendTime>0.10</m_BlendTime> <m_Conditions> <m_Name>PerformingAction</m_Name> <m_Type>STRING</m_Type> <m_StringValue>InfectionBack</m_StringValue> </m_Conditions> <m_Events> <m_EventName>DeathAnimEnd</m_EventName> <m_TimePc>0.85</m_TimePc> <m_ParameterValue></m_ParameterValue> </m_Events> <m_SubStateBoneWeights> <boneName>Dummy01</boneName> </m_SubStateBoneWeights> <m_SubStateBoneWeights> <boneName>Translation_Data</boneName> </m_SubStateBoneWeights> </animNode>

fast galleon
#

From what I can see this has a fixed speed value and not a variable.

mellow frigate
#

I switch to another anim when DeathAnimEnd event is received by the TimedAction. Should I reset the time value ?

fast galleon
#

hm, I am not very familiar with animations. I can recommend using the animation monitor debug tool.

#

It monitors player 0 by default.

mellow frigate
#

I do πŸ™‚

fast galleon
#

nice πŸ™‚

mellow frigate
#

It's an awesome tool

median prairie
#

Apologies for interrupting.

Is it currently possible to add a second chat tab, similar to the admin tab?

mellow frigate
#

The animation is changed 13ms after the animation is started. animation change is due to receiving the DeathAnimEnd event.

mellow frigate
bronze yoke
#

i don't know the method myself but i've heard that it is possible but actually insanely annoying for how simple it sounds

mellow frigate
sharp minnow
#

I’ve been playing around with sound files - does anyone know why it’s possible to replace the jump scare sounds but not other sound files? I’ve been trying to replace the music that plays when you start playing the game (when the this is how you died is on screen).

bronze yoke
#

what are you replacing? most sounds are loaded from FMOD soundbanks

#

the loose files in media/sounds/ do... nothing afaik

mellow frigate
#

Anyone knows what code is preventing Timed actions to start when the player is running ?

bronze yoke
#

did you disable stoponrun?

#

o.stopOnRun = false in new

sharp minnow
#

Well, I’m trying to update the files in media/scripts. The jumpscare mods - when I’ve looked into them - they are adding to /media/scripts and replacing the sound event with a path so that it can play a custom sound. I’m trying to work out what is and isn’t covered by doing that. I’ve seen that most music replacement mods ask the user to manually update the bank files - I was just wondering what is covered by that - if anyone knew.

bronze yoke
#

that should work, it might be possible that music doesn't go through scripts since it's all dynamic now? but i think i've seen that it does

#

there's a lot of mods that change the death music that don't need you to swap soundbanks, maybe they could help?

#

but if people are swapping the soundbanks, i don't think they would do something that requires that manual installation if they didn't have to

sharp minnow
#

Ahh. Great. I’ll look there.

#

Yeah. I was hoping the banks would be more for in game dynamic stuff and that the title would be static/event based. Thanks for the death music tip, I’ll check that out.

bronze yoke
#

i've extracted the banks to look through the music before and i saw the 'this is how you died' music was split into like ten different tracks for some reason

mellow frigate
# bronze yoke did you disable stoponrun?

yes I did. and stop on aim and stop on walk. The action can start when walking or aiming, but not when running / sprinting (it is waiting and activated when run is stopped)

#
    local o = {}
    setmetatable(o, self)
    self.__index = self
    o.character = character;
    o.stopOnWalk = false;
    o.stopOnRun = false;
    o.stopOnAim = false;
    o.isInvalid = false;
    o.maxTime = -1;
    return o
end```
ivory gyro
#
    item MandoDB_AdrenalinFlask
    {
        Weight = 0.8,
        DisplayCategory = FirstAid,
        Type                = Drainable,
        UseDelta            = 0.1,
        UseWhileEquipped    = FALSE,
        Icon = mandodb_AdrenalinFlask_01,
        DisplayName = Flacon d'AdrΓ©naline,
        DisplayCategory = FirstAid,
        ReplaceOnDeplete = MandoDB_SterilisedSyringe,
        WorldStaticModel = mandodb_adrenalinbottle_01,
        StaticModel = mandodb_adrenalinbottle_01,
    }

is someone know why my item is not drainable ?

fresh lodge
#

hello, would this code be viable to halve the book spawn rates?

-- Halves the spawn rate of skillbooks in the game
for allocation, _ in pairs(ProceduralDistributions.list) do
    if ProceduralDistributions.list[allocation].items then
        for i, book in pairs(ProceduralDistributions.list[allocation].items) do
            if type(book) == "string" and library[book] then
                ProceduralDistributions.list[allocation].items[i+1]=ProceduralDistributions.list[allocation].items[i+1]/2
            end
        end
    end
end

(library[book] is the array of the books i want reduced ingame)

mellow frigate
#

how do you ensure a sound is played on all nearby client when the source is an IsoGameCharacter ?

thin hornet
#

It would give you a hint how to handle everything properly, tho I am not saying your code is wrong.

#

You will probably want to run this into Events.OnPostDistributionMerge

wide glen
#

hello ‼️
is there a known fix for mods that hook onto Events.OnFillInventoryObjectContextMenu and whose code prevents "Craft Sheet Rope" from concluding, and "Rip Clothing" from existing at all?

thin hornet
wide glen
thin hornet
#

Mhmm, so it is your code that seems to do that right?

wide glen
thin hornet
#

can you show your code or part of it at least, so we can take a look?

wide glen
#
pristineBookMenu.doMenu = function(player, context, items)
    for i,v in ipairs(items) do
        local item = v
        if not instanceof(item, "InventoryItem") then
            item = v.items[1]
        end

        if item:getType() == "PristineBook" then
            context:addOption("Partake in wave.", item, pristineBookMenu.onAccept)
            context:addOption("I'm good...", item, pristineBookMenu.onDecline)
            break
        end
    end
end

pristineBookMenu.onAccept = function(item, player)
    local playerObj = getSpecificPlayer(player)
    playerObj:getInventory():Remove(item);

    sendClientCommand(playerObj, "Funmod", "Accepted", {})
end

pristineBookMenu.onDecline = function(item, player)
    local playerObj = getSpecificPlayer(player)
    playerObj:getInventory():Remove(item);

    sendClientCommand(playerObj, "Funmod", "Denied", {})
end

Events.OnFillInventoryObjectContextMenu.Add(pristineBookMenu.doMenu);
thin hornet
#

So far i don't see any reason this would remove the Rip Clothing and Craft sheet rope options from the inventory context menu

wide glen
thin hornet
wide glen
thin hornet
#

It's hard to wrap my head around what could possibly be wrong here, what did you comment out?

wide glen
#

all of it

thin hornet
#

did you try restarting?

#

Or did you just reload files manually in F11 debugmenu

wide glen
thin hornet
#

Yes thats good

#

as long as Lua Reload it mean it start fresh

wide glen
# thin hornet as long as Lua Reload it mean it start fresh
module AddOnItems
{
    imports {
        Base
    }

    item PristineBook
    {
        Weight        = 0.5,
        Type        = Literature,
        DisplayCategory = Literature,
        DisplayName    = Wave Invite,
        UnhappyChange    = -100,
        StressChange    = -100,
        BoredomChange    = -100,
        Icon        = Book,
        CanBeWrite = true,
        OnCreate = AddOnItems.OnCreatePristineBook,
    }

    sound BookAccept
    {
        category = EHE: Main, 
        loop = false, 
        is3D = true,
        clip { 
            file = media/music/success.ogg,
            distanceMax = 650, 
            reverbFactor = 0.1, 
            volume = 0.7, 
            } 
    }
}

does that look any wrong?

mellow frigate
wide glen
thin hornet
#

The error is vanilla also it is trying to getTexture of an item but that item is nil.
Try creating a new solo game.

#

Try to find what item in the inventory would be causing that or what mod by disabling or commenting out codes.

#

try to only enable your mod and no other while developping/testing it just to make sure the error doesn't come from elsewhere. You can test with other mods later when you fixed your error.

wide glen
wide glen
thin hornet
#

What are the other lua scripts you have created?

#

Anything related to context menu or items/inventory?

wide glen
thin hornet
#

Your mod doesn't seem to be the cause, can you try again without any mod at all?

#

Just to make sure

red tiger
#

Good evening.

thin hornet
#

Do you open the game files to check the source? If so did you modify anything by accident and saved?

wide glen
thin hornet
#

You could try to validate your game files on steam

wide glen
#

does that proceed without nuking any of my data

thin hornet
#

It will just validate each file to make sure nothing has changed, if it changed it will replace that file by the one from official release.

#

Your mods and save are not in the steam directory so you are fine.

red tiger
#

Just woke up from a small nap.

thin hornet
red tiger
#

Is hot in Texas.

thin hornet
#

The heat is killing me

#

And im in canada lol

red tiger
#

I need to hijack my brain so I can continue working on my Rosetta Workbench app.

thin hornet
#

Also i think you can make the game directory read-only in VSCode to make sure you dont save/overwrite any of these files.

#

That exact situation happened to me like 2 week ago lol

wide glen
#

going to try and launch without the mod enabled πŸ₯

thin hornet
#

πŸ˜„

#

Time to see if that fixes it

wide glen
#

aaand vanilla behavior works, but not when the mod is enabled

#

same error too

#

aand again resuming after a break presents me with the context menu where "Rip clothing" is missing

wide glen
ivory gyro
#

Hi ! Immersive Medicine is my favourite mod, and maybe some people's too. So I've decided to bring some new content to this one! My aim is to provide stable gameplay for doctors, whether in roleplay, pvp or pve! For the moment, a few items have been added, and a few nerfs too, but don't hesitate to suggest ideas!

  • Adding Adrenaline (With Craft and more !)
  • Nerfing (Hemostop, Erythro)
  • Adding mooorrreee medicine items soon !!!

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

mellow frigate
#

@fast galleon Any cue on what I'm doing wrong ? The Override.patchClassMetaMethod function is called without error (it is yours). the log return SayShout 1 override and return SayShout 2 override appear. when I shout, vanilla text appears on the head and print ('SayShout '..tostring(isoGameCharacter)..' '..tostring(shoutStr)) never pops in the logs.

deft plaza
#

am I allowed to ask for help or is everyone going to turn on me

trim mist
#

If you're rude about it, yes.

#

If not, no.

deft plaza
#

meh half the modding community blocked me

tawdry solar
deft plaza
#

oh lol

tawdry solar
#

I will still help btw

#

Not rn

#

I'm going to sleep

deft plaza
#

okay you are the only one on the server that does not hate me

bronze yoke
#

just ask your question instead of being all bitter

deft plaza
#

I think everyone will know the question

#

so the item is not giving me the option to place so there is no model I keep looking back and forth to see the directory I made sure stuff was captial I'm probably just missing something I also looked at my old mod that works and nothing is snapping together

fast galleon
#

How do you do the override?

#

Just noticed, can you try with other class, e.g. IsoPlayer?

#
patchClassMetaMethod(IsoPlayer.class,"Callout",function(Callout)
    return function(...)
        local args = {...}
        if args[2] == nil or args[1]:isCanShout() then
            args[1]:playSound(args[1]:isSneaking() and "zxCalloutSneakWhistle" or "zxCalloutGetOverHere")
        end
        return Callout(...)
    end
end)

I think this was the latest one after bug fixing

#

Also, in order for this to work the function needs to be called from Lua. Calls from java to the function aren't intercepted.

novel barn
#

@deft plaza I'm assuming you're able to spawn the cookie into your inventory at least? I can't spot the problem from here but I know what I'd be checking first if it was my item.

  • are commas at the end of every line required? There are a few lines without commas such as BoredomChange and StressChange.
  • are /* */ valid comments?
bronze yoke
#

the comments are valid, but the missing commas are probably the solution

#

i missed those

novel barn
#

I swear if I find one more bug in my code because I mispelled duffel as duffle. angry

#

scratch that. I found several more. /facepalm

bronze yoke
#

in one of my non-zomboid projects last night i had this lovely moment

#

so i definitely feel that

novel barn
#

actually just found it mispelled in vanilla too.

bronze yoke
novel barn
bronze yoke
#

LOOL

drifting ore
#

Does anyone have good guides on getting started worh modding?

#

I wanna make a few simple mods

mellow frigate
restive umbra
#

hey, are there any tutorials on how to mod in armor and melee weapons?

tribal sparrow
#

could someone familiar with lua help me with fixing some codes? would be great if we can just do it via discord (no talking required, mic can stay muted by all mean), i can stream the text editor and we can walk thru it real quick.

red tiger
#

Should be somewhat more helpful

fresh lodge
ember crane
#

What is the Base. ID of the medkit?

zinc lantern
#

DEVELOPING ALL BR RIO DE JANEIRO THEMATIC SERVER MODS

mild venture
#

Hello! How can i set background color of ISUIElement ? By default it has background alpha-chanel < 1. But i want to set solid black color
UPD: solution is parent['backgroundColor'].a = 1

tawdry solar
ember crane
tawdry solar
#

man

#

icl

#

i dont like modding

#

i find it fun

#

but its ruined games for me

#

i dont play them anymore

zinc lantern
zinc lantern
#

so i got some bases to learn how

drifting ore
#

how to find all my installed mods?

zinc lantern
#

go to workshop

#

instead search

#

w8

bronze yoke
#

if you're looking for the files look in steamapps/workshop/content/108600/

zinc lantern
#

subscribed itens

hot girder
#

Hi all, working on a simple mod to change what type of zombie revives from a player that dies while infected based on fitness level. I feel like this should work, but no joy. Any insight would be appreciated. Thanks!

  if player:getBodyDamage():IsInfected() then
    local fitnessLevel = player:getPerkLevel(Perks.Fitness)
    
    if fitnessLevel <= 4 then
      body:getModData().zombieType = "shambler"
    elseif fitnessLevel >= 6 and fitnessLevel <= 7 then
      body:getModData().zombieType = "fastShambler"
    elseif fitnessLevel >= 8 then
      body:getModData().zombieType = "sprinter"
    end
  end
end)```
bronze yoke
#

there is no OnCreateDeadBody event

hot girder
#

hmmm

#

oh i think it should be OnPlayerDeath

#

Thank you

verbal yew
#

guys

#
    local zs = getCell():getZombieList()    -- getWorld():getCell():getZombieList()
    local sz = zs:size()
    local z = zs:get(i):isOnFire()
    
    for i = 0, sz - 1, z = true do
        -- func to change speed to zombie
    end
end

Events.EveryOneMinute.Add(zReDontSetZombiesOnFire)```
#

xD

#

help plz

#

xD

wet sandal
#

A: Whats the question?
B: Use better variable names, thats hard to understand for such a short bit of code.

#

local z = zs:get(i):isOnFire()

#

i is undefined

novel barn
#

for i = 0, sz - 1, z = true do can you increment based on a boolean? That z = true is blowing my mind if so. I mean mathmatically it makes sense. You either increment by 1 or you don't. I've just never considered doing an operation like that.

stone garden
wet sandal
#

Oh I didn't notice that in the loop, I have no clue if that works...

#

Also doesn't really make sense how its written here.

bronze yoke
#

no way

deft plaza
#

@red tiger about your zed script is it possible for you to add something that checks if its right?

deft plaza
# bronze yoke no way

Btw just got on VSC couple of commas missing lol but nothing that wouldnt make it work

wet sandal
#

Yea, doesn't lua pre-generate a list of all the numbers when you start a loop anyways?

#

Or maybe thats only for ipairs()

bronze yoke
deft plaza
#

anyways sorry for the thing that happened a couple of nights ago

verbal yew
deft plaza
#

Albion it worked btw

#

just need to resize it

bronze yoke
#

nice!

tawdry solar
deft plaza
#

just got to resize it and change the texture

mild venture
#

Hi! Someone knows how to get IsoDirections of BaseVehicle ? Maybe need to make some conversions?

tawdry solar
novel barn
#

I'm assuming the answer is either "no." or "whatever you're doing, it's not worth it." but is there a way to build a table that contains the name of all clothing bags available to a specific PZ client? I would prefer not to hardcode the list in case someone is using other bag mods.

bronze yoke
#

loop through the script manager's item list, check each item's type etc to see if it fits your conditions, and then add it to a table

novel barn
#

And while I'm on the topic, I've been scanning this: https://zomboid-javadoc.com/41.78/zombie/inventory/types/Clothing.html which states the only "name" I can get from a piece of clothing is what I assume is the display name. If I have a duffel bag and getName() on it, I'll get "Duffel Bag". Is it possible to get the true item name instead of the display name such that I would get "Base.Bag_DuffelBag"?

novel barn
bronze yoke
#

the internal name of an item is usually referred to as type

#

including the 'Base.' module is fullType usually

novel barn
#

Albion you're a cotdanged magician πŸ™‡β€β™‚οΈ

bronze yoke
#

on the Item objects you get from the script manager (which are basically item templates as opposed to item instances InventoryItem and subclasses), it's just called name iirc

deft plaza
#

it's almost time to release the mod

#

man I thought that was gonna be easy

#

thank you guys

mild venture
#

how to reload server-side lua?

#

f11 cant reload this

bronze yoke
#

i think there's a command like /reloadlua

mild venture
#

/reloadlua {filename}

#

its work. Thanks!

mellow frigate
#

I have a hard time finding where the IsoZombie instance is "choosing" its target. I was expecting a sort of (potential targets) loop with distance comparison. Do you have any cue on this ? Is this in a specific state of their state machine ?

fast galleon
mellow frigate
fast galleon
#

there is a loop for all sounds respondToSounds?, for spotted I don't remember exact function.

#

spotted can be from the player check?

mellow frigate
deft plaza
#

Just finally released the mod

mellow frigate
#

Oh, no it's called from java

verbal yew
#

AWWWWWWW EEEEEEEEEAAAAAAAAAH

#

i do it

#

I DO IT!

#

dancing like dumb

pulsar rock
#

Is there a way to display text above characters, similarly to the halo, but indefinitely / toggleable, and publicly (visible for all players)?

#

Additionally, is there a good example / documentation on how to make custom UI elements (such as message boxes, inventories, etc...)

#

And, third question, how does one save mod data persistently in a save file? For example saving some state information for the world, or players.

bronze yoke
#

i'm not sure if you're using 'mod data' as a general term but the answer is literally 'use moddata'

#

most objects have a moddata table attached to them and there's also global moddata

pulsar rock
#

General term, yeah. Wasn't aware moddata was a thing.

Is there a good example for this somewhere?

bronze yoke
#

for object moddata you just call object:getModData(), which returns a lua table that saves (aside from types that inherently can't be saved, but you shouldn't really run into that)

pulsar rock
#

Thanks!

#

I assume object moddata is a table that's shared by all mods? And applies to any PZ objects? (Tiles/zombies/players/items/etc...)

bronze yoke
#

yeah, it's shared, most objects should have it but you can always check the api reference page for that object if you're unsure

pulsar rock
#

Gotcha, thanks!

pulsar rock
bronze yoke
#

for 1 no, you might be able to hack something together with ui but there isn't anything provided like that

#

for 2, basically all i know about ui in this game is that it's an absolute nightmare

pulsar rock
#

Hm, fair enough

bronze yoke
#

i've messed with it a little and it's *very* manual

pulsar rock
#

Is there a performant way to check if other players are nearby / visible to your character?

bronze yoke
#

some people like to scan the nearby squares for players but just looping through the player list and checking distance is probably a lot faster in most cases

pulsar rock
#

Hm, I need to ensure they're visible though / within line of sight.

bronze yoke
#

i think there's actually a method for that, i think i used that in one of my mods

pulsar rock
#

And preferably not constantly checking the player list. That feels performance-heavy

#

I assume there might be some kind of event for showing an entity / character tbh?

#

Maybe an event for showing a player's name that I can hook into?

bronze yoke
#

you are very optimistic about events πŸ˜…

pulsar rock
#

Hey, I try Fingerguns

bronze yoke
#

it depends on your intended range, but if it was 10x10 that's 100 squares which is already the player limit (and no server actually goes that high from what i hear) so i think checking the playerlist will usually be faster - granted you don't need to calculate distance for them so it's not exactly a 1:1 cpu cost

#

and i imagine it would probably be a lot larger than 10x10

#

oh, also, if it's on the client, other clients don't actually get added to the player list until they've been in your loaded area for the first time that session for security reasons

thin hornet
#

IsoGameCharacter.CanSee

#

You can loop client players and check if the source player CanSee the other and break if needed to stop the loop if you need and it fit your situation.

thin hornet
#

also LosUtil class is exposed in case you would want to test custom coordinates. Tho I'm not sure we can use it because of LosUtil.TestResults not being accessible I think.

cosmic arrow
#

wow. that's the most authentic looking link and website i've ever seen πŸ™„

daring delta
#

Hello, I have a question about item sprite.

When I make item mod, I need to write a script mesh and texutre. Is there a way to replace PNG Image with sprite? I Also attach an image that will help.

hidden jungle
#

how do you change the color of an item?
like a shirt or hoodie

#

i found setColor() but that doesnt change the 3D model, only the color of the icon

tardy wren
hidden jungle
#

even for the clothes that can normally get random colors?

tranquil kindle
daring delta
tranquil kindle
#

I remember that once i put my model name wrong it did something smilar, have you tried simply not putting any item sprite/static model? If game can't find it it uses Icon so you could try with that?

mild venture
#

Hi! How can i temporary remove/hide snow from IsoGridSquare ?

fringe heart
#

Hello, everyone! I made a mode abou spawn items in different cases,
but they spawn not by 1 but by 2. Why?
require "Items/ProceduralDistributions"
require "Items/ItemPicker"

table.insert(ProceduralDistributions["list"]["BathroomCabinet"].items, "Base.Trousers_Fireman");
table.insert(ProceduralDistributions["list"]["BathroomCabinet"].items, 100);

neon bronze
#

Depends on the roll amount for the certain list

#

If you put 100 there is a good chance when the game rolls for items spawning it will spawn your item again after another

neon bronze
#

Put something lower than 100 but no guarantee

fringe heart
neon bronze
#

Probably

fringe heart
forest spade
#

hello guys,does anyone know how to solve it or an idea? is it possible to give a trait of another mod?
I'm creating custom professions using framework profession. i created the musician profession and trying to give the musician trait from Spoon mod, i managed to make him give the trait, using the Entertain Yourself mod as a requirement but he is duplicating the trait in the creation menu and it is not being free.

bronze yoke
#

professions usually give a copy of the original trait that doesn't show up in the list

#

so that it can be free

forest spade
#

so it's probably free... i will check this

#

in the debug it presents an error referring to an expression in the original code aimed at giving a free trait, so I understand that as it is a trait that is not in the base it cannot "read" that this trait is being given.

quasi geode
#

(technically, it creates a second profession version of the trait, then on new game it replaces the second profession version with the original)

forest spade
deft plaza
#

alright guys I need a certain code

#

when I kill a zombie its gonna give me either 2 moodlets or none random chance

#

is there anywhere I can refer too

deft plaza
#

I think if I can do this this will be a big mod

tawdry solar
#

they use the same thing for the npc and player data

#

whats the mod

near hull
#

Hello, does anyone understand how I could replicate the SRU vest from the Expanded Helicopter Events mod? I'm working on a clothing mod and when I want my vest to be able to be worn and used as a "container" for things, it doesn't give me the option and I get an error (and the item is deleted). I don't know if my script is wrong or something, I've tried using other mods, but I haven't been able to get it to work. I would appreciate if someone can clarify the situation for me.

tawdry solar
#

but just have the model be a vest

deft plaza
#

I found it but I can't read it

crystal oar
#

how do i pass variables to a tooltip?

tawdry solar
#

i would ask somone more experianced with this shit

deft plaza
#

alright

mellow frigate
crystal oar
#

so i just need to set the tooltip in lua as opposed to in the item block itself it looks like?

#

this seems complicated

#

so i start by making a new tooltip handler maybe?

#

MyToolTipThing = ISPanel:derive("ISToolTip");

#

also not sure once i get the lua setup how to get the recipes to show the tooltips i made in lua

#

is there something like an OnMouseOver event or something i can use in the recipe block?

#

to go execute my code that sets the tooltip?

neon bronze
crystal oar
neon bronze
#

yes with MyToolTipThing:onMouseOver()

crystal oar
#

nice, i think i can make this happen then

near hull
crystal oar
#

also i just see OnMouseDown OnMouseMove and OnMouseUp in the documentation

#

maybe i should just use OnConnected?

#

ooh OnFillInventoryObjectContextMenu looks promising

sour island
#

There's mouse over events for the inventory lists

#

Check out ISInventoryPane

crystal oar
#

Hey! i love the no damage from trees mod if i haven't already gotten to tell you

sour island
#

Ah thank you πŸ™‚

crystal oar
#

i felt like i was living in Evil Dead or something with violent trees before that

red tiger
#

DayZ mod

crystal oar
#

i don't see an OnMouseOver there

red tiger
#

Trees ate people in DayZ mod

crystal oar
#

ouch

red tiger
#

Physics engine glitch

crystal oar
#

can i just make like function onGameLoaded() setRecipeTooltip("MyRecipe", "This is my custom recipe tooltip.") end or do i need some global to hold it like MyToolTipHandler:onGameLoaded()

#

with some like lua to back it up

#
    local recipe = RecipeManager.getRecipe(recipeName)
    if recipe then
        recipe:setTooltip(tooltip)
    else
        print("Recipe not found: " .. recipeName)
    end
end```
mild venture
#

Does anyone know why this error occurs and how to fix it?

crystal oar
#

i think if you search for appworkshop_108600.acf and delete it you can fix that

#

i am having trouble with the line Events.OnGameLoaded.Add(StarterKitsGameLoaded), any thouughts?

bronze yoke
#

there is no such event

#

maybe you are thinking of OnGameStart or OnGameBoot?

mild venture
crystal oar
crystal oar
bronze yoke
#

ongamestart is when you load in, not really sure how that's relevant to tooltips though

mild venture
crystal oar
#
mild venture
#

I'll try to reboot πŸ™‚

crystal oar
#

the only time i couldn't upload i forget what result code i was getting but deleting all those appworkshop_108600.acf helped me out. you might have more than one if you have pz in more than one spot

bronze yoke
#

i've had mysterious workshop issues until i restart steam before

#

it might also just actually be steam

crystal oar
#

oh

#

you're so darn helpful

mild venture
#

Rebooting didn't help. I'll try it tomorrow. Thank you all πŸ™‚

bronze yoke
#

yeah other people are having the same error

mild venture
#

Yes, steam also says that it cannot synchronize cloud saves. probably something broke

bronze yoke
#

my workshop page looks like this so it's fair to say it's struggling

mild venture
#

Then I will announce my mod with a preview πŸ™‚
It seems all cases are tested. Should work well. I'll upload it tomorrow

bronze yoke
#

congrats!

mild venture
#

Where i can find some docs or description of sandbox-options.txt ?

crystal oar
#

do i need a semicolon at the end of this? Events.OnGameStart.Add(StarterKitsGameLoaded);

bronze yoke
#

no, you don't need semicolons ever

bronze yoke
#

they're a style choice

mild venture
#

But I don 't see the point of using ; in lua

crystal oar
#

ah well something about that line makes my server not start up right now lol, i'm stumped

mild venture
#

see the logs

crystal oar
#

i see like LOG : General , 1687733779367> 0> SERVER: process-status@terminated but no error or stack trace

mild venture
#

is it start if you disable you mod?

crystal oar
#

it was starting right before i fixed that line to use an event that actually exists

#

i worry that i am using an event that triggers before sandbox vars are loaded

bronze yoke
#

gamestart is well after they are

crystal oar
#

okay, hmmm

bronze yoke
#

it seems unusual for you to be able to stop your server from launching

#

usually it should just move on when it reaches an error

crystal oar
#

and i am making all of this client side, maybe it needs to be shared or server?

bronze yoke
#

a file that isn't even running on the server is crashing the server? 🀨

#

if it's tooltip stuff then it should be client only

crystal oar
#

i'll just try again later, maybe steam not working is giving me trouble connecting

mild venture
#

try to launch server without steam. Or coop server

crystal oar
#

i am launching coop server, it say is trying steam connection and authorizing with steam tho

mild venture
crystal oar
#

well that got me in the game, gonna wait until steam is acting less wonky to even try to update this on the workshop tho

red tiger
lone nest
#

on Events.OnPlayerUpdate vs. Events.OnRenderTick...
I am assuming Events.OnPlayerUpdate runs ONLY when the game isn't paused.
Is that assumption correct?

bronze yoke
#

yes, but i'm not sure that's untrue of onrendertick

lone nest
#

Yeah, I'm trying to figure out if its better to run some functions during OnRenderTick or OnPlayerUpdate.

#

OnRenderTick can become ridiculously taxing

red tiger
#

OnTickEvenPaused

bronze yoke
#

i would expect onplayerupdate to be more taxing

lone nest
#

Hm...

bronze yoke
#

it also fires every tick, just potentially multiple times

#

unless your code specifically relates to players there isn't really a reason to use it over ontick

#

and even then, ontick looping through the player list would probably be faster...? haven't thought about it before

lone nest
#

trying to figuring out what's more efficient :x

#

looking at the NPC code and looking for alternatives to OnRenderTick

#

also, trying to avoid nested loops scanning squares for objects.

#

I think, it's possibly quicker to get a list of zombies in a cell and scanning that list if a zombie can be seen
over say
scanning 30x30 squares.

bronze yoke
#

it is much much faster

lone nest
#

then again, I don't know how big a "cell" is and how many zombies in the worst case can be in said cell.

bronze yoke
#

the cell is the entire currently loaded area

#

it is not a specific area

lone nest
#

guess it's time for an experiment

bronze yoke
#

there's actually a cap in multiplayer, not sure what the cap is but in singleplayer i was stress testing some zombie code and only managed to draw a horde of <300

lone nest
bronze yoke
#

absolutely, scanning squares should be a last resort

mellow frigate
#

Hello there, is there a way to get the shape of a vehicle in lua ? Alternatively is there a way to know is a x,y,z position is within a vehicle or not ?

bronze yoke
#

BaseVehicle:isInBounds(x, y)

crystal oar
#
    local recipe = RecipeManager.getRecipe(recipeName) -- Retrieve the recipe by its name
    if recipe then
        recipe:setTooltip(tooltip) -- Set the tooltip for the recipe
    else
        print("Recipe not found: " .. recipeName)
    end
end

-- Function to call after the game has fully loaded
function StarterKitsGameLoaded()
    setRecipeTooltip("Choose Kit 1", SandboxVars.StarterKits.Kit1Name)
end

Events.OnGameStart.Add(StarterKitsGameLoaded)

this is giving me trouble when it tries to execute setRecipeTooltip("Choose Kit 1", SandboxVars.StarterKits.Kit1Name) any ideas what i'm doing wrong?

mellow frigate
mellow frigate
crystal oar
#

Object tried to call nil in setRecipeTooltip at KahluaUtil.fail line:82.

bronze yoke
#

you can try OnObjectCollide and check if one is a player and one is a vehicle but idk if vehicles will even fire that

#

since they use the physics engine

mellow frigate
#

Thanx, I'll try

bronze yoke
crystal oar
#

huh, thanks chatgpt lol. is there a function to get a recipe?

bronze yoke
#

i thought it might be ai generated

#

that's why you were getting made up events too i bet

crystal oar
#

yes indeed

bronze yoke
#

i don't recommend ai for modding, it just makes stuff up

crystal oar
#

it's been super helpful for doing regex since i don't know regex

bronze yoke
#

recipes don't have a setTooltip so i don't know if this helps, but ScriptManager.instance:getRecipe(name)

#

yeah, it should be more helpful for more general programming things, but when it comes to zomboid it only knows the rough structure

eager agate
#

zomboid ai programming stressed

crystal oar
#

for setting tooltips i see stuff like the isvehiclemechanics uses local tooltip = ISToolTip:new(); tooltip:initialise(); tooltip:setVisible(false); tooltip.description = ISVehicleMechanics.bhs .. " " .. getText("Tooltip_craft_Needs") .. ": <LINE> " .. tirePump:getDisplayName() .. " 0/1";

#

which has a lot of semicolons, i thought i didn't need those. those are just for style?

bronze yoke
#

ya, TIS has a lot of java programmers, and java uses semicolons

crystal oar
#

so function setRecipeTooltip(recipeName, tooltip) local recipe = ScriptManager.instance:getRecipe(recipeName) -- Retrieve the recipe by its name if recipe then print("Recipe found!") else print("Recipe not found: " .. recipeName) end end isn't finding the recipes at all, step one is getting this to work. Is ScriptManager a global?

mellow frigate
#

is there a way to add a keybind without using ModOption ?

bronze yoke
#

if you want it to be configurable not really

crystal oar
#

albion can you tell me more about ScriptManager.instance:getRecipe()? or can you tell me if it looks like i am using it right?

mellow frigate
crystal oar
#

oh

#

thank you

bronze yoke
#

they are the same

crystal oar
#

ah it's not finding any of my recipes

crystal oar
#

also does anyone here know if i can specify the -cachedir= from the startserver64.bat?

#

ya i'm getting LOG : General , 1687749143587> 0> [StarterKits] Recipe not found: Choose Kit 1 when running function setRecipeTooltip(recipeName, tooltip) local recipe = getScriptManager():getRecipe(recipeName) -- Retrieve the recipe by its name if recipe then print("Recipe found! " .. recipeName) else print("Recipe not found: " .. recipeName) end end

#

i'll be hard pressed to edit the recipe's tooltip if i can't find the recipe

#

LOG : General , 1687749778355> 0> [StarterKits] Recipe found! Make Stake so it is working, just not on my new recipes

#

any ideas why that might be?

#
setRecipeTooltip("Choose Kit 1", SandboxVars.StarterKits.Kit1Name)```
bronze yoke
#

probably need the module name

crystal oar
#

inside or outside the quote?

bronze yoke
#

inside

crystal oar
#

thanks again

#

LOG : General , 1687750127787> 0> [StarterKits] Recipe found! StarterKits.Choose Kit 1 yep that was it

severe zenith
#

What is a lua?

crystal oar
#

a programming language

severe zenith
#

Oh my dear lord I cannot

crystal oar
#

what do you need help with?

severe zenith
#

That make you less or more likely to be targetted by gendered zomboids

#

it's for charity so I'm very interested in seeing it become reality

crystal oar
#

ah i see, i have no experience with traits and getting info from zombies. i'm sure someone here might, if you have the cash to commission a mod team orbit might do it

bronze yoke
#

orbit fell apart

#

from my experience i'd say that traits affecting who zombies target probably aren't possible

crystal oar
#

WHAT!? i did not know that

severe zenith
crystal oar
#

making traits that do nothing should be fairly easy i should think

bronze yoke
#

adding a trait is one line of code

crystal oar
#

so now that i can find my recipes i am trying to set tooltip using function setRecipeTooltip(recipeName, starterKitTooltip) local recipe = getScriptManager():getRecipe(recipeName) -- Retrieve the recipe by its name if recipe then print("Recipe found! " .. recipeName) local tooltip = ISToolTip:new() tooltip:initialise() tooltip:setVisible(true) tooltip.setName = starterKitTooltip recipe.toolTip = tooltip else print("Recipe not found: " .. recipeName) end end but it doesn't like recipe.toolTip = tooltip as far as i can tell

#

it might not have an attribute toolTip, that might be the problem

#

it was option.toolTip in isvehiclemecanics that i am borrowing the snippet from

bronze yoke
#

that's for context menus

#

i don't think recipe objects store their tooltip

#

it's probably generated live

crystal oar
#

not sure how to proceed if i'm trying to make a tooltip from a sandbox var now

#

maybe make a new thingy like StarterKitToolTip = ISPanel:derive("ISToolTip"); and then make setName parse the tooltip for those recipes differently?

#

function ISToolTip:setName(name)
    if name=="Open Kit 1"
        then
            name=SandboxVars.StarterKits.Kit1Name
        end
    elseif name=="Open Kit 2"
        then
            name=SandboxVars.StarterKits.Kit2Name
        end
    elseif name=="Open Kit 3"
        then
            name=SandboxVars.StarterKits.Kit3Name
        end
    elseif name=="Open Kit 4"
        then
            name=SandboxVars.StarterKits.Kit4Name
        end
    elseif name=="Open Kit 5"
        then
            name=SandboxVars.StarterKits.Kit5Name
        end
    elseif name=="Open Kit 6"
        then
            name=SandboxVars.StarterKits.Kit6Name
        end        
    elseif name=="Open Kit 7"
        then
            name=SandboxVars.StarterKits.Kit7Name
        end        
    elseif name=="Open Kit 8"
        then
            name=SandboxVars.StarterKits.Kit8Name
        end
    elseif name=="Open Kit 9"
        then
            name=SandboxVars.StarterKits.Kit9Name
        end
    elseif name=="Open Kit 10"
        then
            name=SandboxVars.StarterKits.Kit10Name
        end
    else
        self.name = name;
    end
end```
#

maybe?

#

time to find out

severe zenith
#

Sorry to inconvenience everyone but what the heck does this mean

#

require('NPCs/MainCreationMethods');
local function initMagDrillsTrait()
local MagDrills = TraitFactory.addTrait("MagDrills", getText("UI_trait_MagDrills"), 2, getText("UI_traitdesc_MagDrills"), false, false);
MagDrills:addXPBoost(Perks.Reloading, 3)
end

Events.OnGameBoot.Add(initMagDrillsTrait);

#

It's a lua for a different mod

novel barn
#

@severe zenith this might get you started https://github.com/MrBounty/PZ-Mod---Doc/blob/main/How to make a custom trait.md What you're looking at is a function that injects a new trait into the game called MagDrills. By taking the trait the player gets an xp multiplier of 3 for their reloading skill. The trait gets added when the game boots (which happens before you hit the main screen) with the event call Events.OnGameBoot.Add(initMagDrillsTrait);

crystal oar
#

is there a way to run code when an item enters a player's inventory? maybe i'll just put the kit contents to chat instead of changing the tooltip

neon bronze
severe zenith
#

Would a trait that costs nothing be +0 or -0?

crystal oar
severe zenith
#

I suppose kissing boys is a positive trait

crystal oar
#

then +0 right? it's late here i might be wrong

#

speaking of, i am going to try to sleep even tho i didn't get this done tonight

crystal oar
severe zenith
novel barn
severe zenith
#

I'm blanking, how do I publish this mod privately so I can test it? I got it

rancid panther
#

omg my mod is on the front page

#

lot of people wishing for it to work in MP. i'd probably work on that if i were still actively playing the game. but i think i know how to do it if i were to try

#

i could even possibly remove dependence on changing the shutoff date at all through this

rancid panther
#

maybe in build 42 i'll give it a shot along with my other mods

autumn temple
#

is the Time: based off frames? so like 120 is 4 seconds?

bronze yoke
#

48 time is 1 second

autumn temple
#

ok thanks

novel barn
#

Is anyone able to confirm how the following assignment works? I'm assuming oldItem is assigned to the first non-false non-nil result? I'm not really sure what to call this kind of assignment so I don't even know where to start googling for an answer. 😞

local oldItem = ccp.listboxTrait:removeItem(label)
            or ccp.listboxBadTrait:removeItem(label)
            or traitIsPurchased and ccp.listboxTraitSelected:removeItem(label)
novel barn
# fast galleon https://www.lua.org/pil/3.3.html

from PIL: "The operator or returns its first argument if it is not false; otherwise, it returns its second argument" I assume this behavior extends to it's third, fourth, etc argument if necessary? That's how this code works?

#

πŸ™‡β€β™‚οΈ Thank you!

fast galleon
#

I am a bit wary of the and use there, it could be best to add parenthesis.

novel barn
#

Yeah my next question was going to be order of operations when you throw and in the mix

bronze yoke
#

my answer to that question is 'my ide highlights the arguments when i mouse over the operator' x3

#

i think the execution order is just left to right

#

until brackets are involved of course

novel barn
#

I figured as much. It should theoretically never see the and unless the first two arguments fail

bronze yoke
#

i think i checked that the and was good, i was going over that code the other night to add some more features

novel barn
bronze yoke
#

my recommendation is if the usage of or/and like this comes off as difficult to read, then don't use it - doing things in one statement like that is supposed to make the code cleaner, not messier

#

it probably shouldn't have been used there as the logic became more complex (and isn't anymore as the assignment wasn't useful in my latest version)

#

the and doesn't even serve a purpose there, come to think of it

#

it's only true if it's in the last list, and it's only in the last list if it wasn't in the other two, which is already the only condition in which that statement is reached

novel barn
#

I'm normally completely in favor of more lines instead of compressing things down, but I have this function and it just made sense to me to do it this way. (I haven't confirmed if this actually works yet. I don't think it does)

local dod_IsDirtBag = function(item)
    name = item:getType()
    return string.find(name, "dirt") or string.find(name,"gravel") or string.find(name,"sand")
end
bronze yoke
#

oh absolutely, there's no confusion there

#

it looks like it should work to me, though keep in mind the return value isn't a boolean

autumn temple
#

for some reason my one recipe isnt working NotLikeThis

novel barn
fast galleon
bronze yoke
#

you can just add a ~= nil to the end to get a bool (maybe with brackets, i don't have my ide to guide me)