#mod_development

1 messages · Page 169 of 1

ancient grail
#

Did you have a custom animation done? What are you trying to do?
Does your animation showup on animation viewer

#

Your x file should also have an animation nme which should be the same with the file name

#

Meaning you can rename x files

#

Im pretty sure its the same for fbx

#

I replied to the wrong msg

#

I ment to reply to this one

pliant yarrow
#

What I was trying to do was test adding an emote, but as a placeholder I was trying to use Bob_EmoteClap. I tried renaming it so it wouldn't conflict with the existing emote, but I I don't really know what I'm doing but somehow in my trial and error something broke and now Clap doesn't work even with a fresh install and no mods enabled or anything.

#

My girlfriend's the animator so I'd have to ask her about any animation stuff. I was going to have her try to do a custom animation, but I was just trying to get things to work with a default animation for the time being

#

I fixed it. It was a problem with the animation name inside the X file. Clap was labeled as Clap02 for some reason, which I never changed it to. No clue why it was like that, no clue why validating or reinstalling didn't get the correct file mikahmm

#

But thank you for your help

gilded hawk
#

What is the best way to sort an ArrayList in Khalua?

ancient grail
#

Goodjob

tame mulch
#

Hello there! How is the development of mods going?

ancient grail
tame mulch
fast galleon
# tame mulch Hello there! How is the development of mods going?

I'm trying to describe how I play an animation effect on players and zombies. Please correct me if there's a better way or I am wrong 🙂

function IsoObject:AttachAnim(ObjectName, AnimName, NumFrames, frameIncrease, OffsetX, OffsetY, Looping, FinishHoldFrameIndex, DeleteWhenFinished, zBias, TintMod) end

In PZ 41.78 you can easily add an animation effect to an IsoGameCharacter which will play by itself.
Drawbacks: this seems like legacy code and next parts don't work

  • DeleteWhenFinished, doesn't remove the attached anim
  • zBias and FinishHoldFrameIndex seem to be unused
  • transmitUpdatedSpriteToServer will not transmit this attached anim

There might be a way to make transmitUpdatedSpriteToServer work, but the frameIncrease will not be synced.

ancient grail
#

Owell

#

Never used attach anim before and isnt that for tiles

fast galleon
ancient grail
#

Ah weird

fast galleon
pearl sundial
#

what java does project zomboid use

#

java 14 or 7

tame mulch
fast galleon
mellow frigate
#

@tame mulch Is there a way to make a camera follow another player in MP ? (a camera from a client following a player from another client, in lua). Spectator function would be a must for Battle Royale mod.

tame mulch
mellow frigate
red tiger
#

I might be looking for comms. Not sure yet.

odd notch
#

the reason you can't just whip a camera over there is because those chunks aren't loaded to the observer client until the observer client ... loads them lol

mellow frigate
odd notch
#

a quick and dirty solution would be having the observer sit on ground every time that event fires

mellow frigate
odd notch
#

but ultimately, it would require one of the javadevs like aiteron to implement dynamic chunk loading for players who aren't near them... which would be fundamentally changing how chunks are loaded from my understanding

#

the REAL solution is bribing aiteron with ten bitcoin to implement the features you want

mellow frigate
odd notch
mellow frigate
mellow frigate
odd notch
mellow frigate
odd notch
mellow frigate
#

I'll go with the invisible inhibited sitting duck

bronze yoke
#

have you tried out IsoDummyCameraCharacter?

#

it doesn't really look likely that it would work to me but it did seem to be for that rough purpose

mellow frigate
bronze yoke
#

it changes camCharacter or something

mellow frigate
#

the cam thingy is overriden everywhere 😦

bronze yoke
#

don't know what that does but some (unused, very old, and clearly not finished) tis code tries to use it to control the camera

mellow frigate
#

You're right I should give it a try then

bronze yoke
#

it's in the turn based thingy if you've come across it before

zinc pilot
#

is there a way to debug zombie pathfinding?

#

other than just seeing their state

bronze sand
#

Excuse me

#

I have some questions

#

See that mod

#

It has a recipe to Carve Baseball Bats, that doesn't really convince me

#

Could I remove it if I deleted

    {
        Log,
        keep FlintKnife/ButterKnife/HuntingKnife/KitchenKnife,
        SkillRequired         : Woodwork=4,
        Result         : BaseballBat,
        Time         : 1000,
        CanBeDoneFromFloor         : True,
        Category         : Survivalist,
    }```
#

from \workshop\content\108600\1969674962\mods\PrimitiveSurvival\media\scripts\module_PrimitiveSurvival.txt ?

neon bronze
#

Yea, but you would temper with files which if you play on a server that uses that mod will not let you in, alternatively you can just not use the recipe and ignore it

drifting ore
#

Where are the files to see the internal IDs of the objects?

trim mist
#

gimme a script and I'll narrate it for you with my crisp blue yeti

red tiger
#

Umbrella is a game-changer for all modders.

trim mist
#

I will be the first to sing your praises if I can follow your tutorial

red tiger
#

Konijima also has his PZ-Studio.

#

It implements Umbrella.

trim mist
#

But yeah seriously, I love helping out the community and giving back, so if you really want me to do some narration for you (or maybe I can record and edit the video for you?) I will. Feel free to DM me if you're interested in pursuing that further

red tiger
#

I don't have any team.

#

Yet my org github account has amased like 40 repositories haha.

trim mist
#

do you think I could ask you a couple questions that haven't been able to be answered here? qwq

trim mist
red tiger
#

Funnily I don't open PZ.

bronze yoke
#

and 800% more hours of writing tools than testing

red tiger
#

My stuiff is entirely outside the need to open PZ to develop.

red tiger
trim mist
#

probably ~100-150 hours of that is me having the game open, sleeping, testing, moving around, keeping the console up while I code

red tiger
#

It's not an exaggeration either.

#

If you could see my non-steam hours it'd be around 10K.

#

With dev time? ~15-16k

trim mist
#

drunk y'all

#

you're giving me big shoes to try and fill lmao

red tiger
#

I don't think that anyone expects you to put as much time.

#

My tools are for reducing that.

trim mist
#

....i really should look into umbrella, huh?

#

I thought it wasn't fully released yet or something

red tiger
#

Yes. You should. Albion, Omar, and my typings will solve so much work for you.

bronze yoke
#

we really do need better exposure don't we 😅

trim mist
#

albion, you worked on umbrella too?

red tiger
#

I'm focusing on Rosetta ATM so people can contribute their own documentation to it.

bronze yoke
#

i wrote one of its modules

trim mist
#

pog

trim mist
red tiger
#

It's documentation for the API, not in-game translations.

trim mist
#

oh nevermind haha, i misunderstood you the other day when you were talking about it

bronze yoke
#

the game already has great translation support, it's just users choosing not to use it

red tiger
#

This was my original attempt at the same solution for custom documentation, but for PipeWrench.

#

I'm doing the same thing for Rosetta. It'll be much easier.

trim mist
#

that ui is attractive

red tiger
#

I made it from scratch. I'm ditching this design.

#

Going with a bootstrap flavor.

trim mist
#

I still have nightmares about bootstrap from college

red tiger
#

Bootstrap is perfect for utility UI.

#

I also work with a corporate bootstrap package for my job.

#

We're almost at the point where we could make up for the lack of documentation for modding the game which will be great.

#

I might also contribute my own documentation at a certain pace once things are implemented.

fathom dust
#

anyone know if there's a way to mod the intro text when a game is loading? I absolutely must change one of the lines because it gets a song i hate stuck in my head every time. I found the file, but it's not lua just a text file and adding my own copy in my mod at the same path doesn't seem to work. shared\Translate\EN\UI_EN.txt

red tiger
#

I've seen it done that way.

#

@faint jewel Didn't you do something like this in the past?

faint jewel
#

Yeah that's the file.

fathom dust
#

it's not images, it's text. i found the file and i can edit the text in my local install but i'm not sure how to override it in a mod

faint jewel
#

samef older in the mod?

loud python
#

I’m looking to change the infection values of bites, lowering it from 100% to 50%. Does anyone know where this file would be located?

tame mulch
fathom dust
#

ah thanks, i was doing it wrong

fathom dust
crude magnet
#

Hello im working on my mod and i got the recipe to properly create the protein shake the issue is when I drink it it stays in the players inventory and dose not get replaced on use with an empty waterbottle any ideas on what could be causing this error?

tame mulch
mellow frigate
#

Hello there, when a character is dead, it stops refreshing the field of view. Thats perfectly normal but I would like to refresh the field of view (whole screen) anyway when dead. Any idea where I should look for ?

trim mist
# loud python I’m looking to change the infection values of bites, lowering it from 100% to 50...

I've done that--there's no real way to mod that value since it's in java (IIRC), what I had to do was remove the infection based on a chance variable, like so:

local rolledInfectionChance = ZombRand(1, 100);
                if getDebug()
                then
                    print("Rolled " .. rolledInfectionChance)
                end
                if bodypart:bitten() 
                then
                    if biteInfectionChance <= rolledInfectionChance 
                    then
                        bodypart:SetInfected(false);
                        player:getBodyDamage():setInfected(false);
                       
player:getBodyDamage():setInfectionMortalityDuration(-1);
                        player:getBodyDamage():setInfectionTime(-1);
                        player:getBodyDamage():setInfectionLevel(0);
                        player:getBodyDamage():setInfectionGrowthRate(0);
                        if getDebug()
                        then
                            print("Infection defense successful.");
                        end
                        return false;
                    else
                        if getDebug()
                        then
                            print("Infection defense UNSUCCESSFUL. DIE WELL!");
                        end
                        return true;
                    end
trim mist
mellow frigate
tame mulch
trim mist
mellow frigate
tame mulch
mellow frigate
tame mulch
crude magnet
mellow frigate
tame mulch
mellow frigate
# tame mulch open doors? How?

that's very strange, but on MP, when I teleport a player to another player that is moving, somthing opens closed door in between

#

I do not understand it, but it is clearly not me

#

this does not happens when teleporting a dead player

#

but the dead player is teleported (can be seen on map)

tame mulch
tame mulch
mellow frigate
#

here is the run run in both cases (dead and not dead) local x = struct.targetObj:getX() local y = struct.targetObj:getY() local z = struct.targetObj:getZ() BattleRoyale.teleport(struct.playerObj,x,y,z) struct.playerObj:setCanSeeAll(true); struct.playerObj:setNoClip(true); struct.playerObj:setInvisible(true); struct.playerObj:setBlockMovement(true); struct.playerObj:setSitOnGround(true);

#

OnTick

tame mulch
mellow frigate
#

well if I die, my screen does not darken, it darkens after the teleport. so I doubt but I do not know.

tame mulch
tame mulch
mellow frigate
tame mulch
tame mulch
mellow frigate
#

I'm mourning the teleported death player 😄

mellow frigate
sleek hull
#

What determines the time for a DeepWound to stay on a character?

setScratchTime(), setCutTime(), and setFractureTime() all specify a time for the respective wound to stay, but deep wounds are just created via p:getBodyDamage():getBodyPart(BodyPartType.Foot_R).generateDeepWound()?

ancient grail
ancient grail
ancient grail
#

Z=Z-1

#

Bellow 0

#

Its buggy but it removes the shadow

royal lava
#

anyone know if there's a way to set the mods folder to a custom directory?
By default they're loaded from root/workshop or root/mods
but I want to be able to load them from C:../steamapps/common/Project Zomboid Modding Tools/ just for the sake of convenience.

bronze yoke
#

you can move the entire user directory but i don't think you can just move the mods folders

#

you could symlink instead

#

if you're on windows, delete the mods folder (back up anything in there first of course), open command prompt in the zomboid folder, and type mklink /J mods "C:../steamapps/common/Project Zomboid Modding Tools/" (replacing that with the full directory of course)

pliant yarrow
#

I'm working on making a certain emote reduce stress, and I'm wondering if there's a way to trigger a function on playing a certain emote. I'm struggling to find one.

pliant yarrow
#

I think I figured it out but now I need to find a way to reduce stress for the duration of the emote. This should be the very last thing before my mod is done.

trim mist
#

uh, I think in the run/movement animations file, there's a DamageFromTrees thing--idk where that gets triggered, but that might be close to what you need

trim mist
#

or slap all the happiness gain on after it's completed

pliant yarrow
#

I wasn't sure if I could use TimedAction stuff on emotes but I can give it a try. As always I don't really know what I'm doing and it's a lot of trial and error and spaghetti code SilverSweat

bronze yoke
#

you might need to hook the function that plays the emote

ancient grail
#

Whats the question

drifting ore
#

I have a suggestion for a mod: "Walking With The Dead", this would mimic the idea of putting "Walker/Zombie" guts on your character to mask your body scent and make you look like a "Walker/Zombie" so you can walk with or through hordes of the dead safely

#

If anyone has any tips on how to make that let me know 🙂

bronze yoke
#

there's already a couple mods that do exactly that

drifting ore
#

Wait fr?

#

What are the names?

#

I think like "zombie camouflage" or something like that

#

I just searched that and I cannot find it

drifting ore
#

Thank you

lapis lava
#

how do I open an .x file in blender?

bronze sand
#

I didn't knew swimming could already be a thing

ancient grail
#

Just a work around

#

Its basically a teleport mod
It teleports you everymovement

bronze sand
#

That might not be good for performance...

novel barn
#

Four days ago Albion wrote some code that** allows the creation of Trait Cost as a sandbox variable**. I'm not kidding when I say I've spent over 10 hours trying to figure out how it works. I've spent a lot of that time making sure I understand metatables, metamethods, etc. However I just can't seem to wrap my head around what's being done here.

Albion linked to the two files that handle this functionality here: #mod_development message

I've spent four days trying to wrap my head around just 8 lines of it. I've commented what I think is going on in those 8 lines. **If anyone is willing can you tell me how wrong my comments are and possibly explain what these lines ARE doing? **

-----------------------------------------------------
--traits.lua
-----------------------------------------------------
--allow Trait.class to inherit from metatable?
--or is it the other way around and metatable inherits from Trait.class?
local metatable = __classmetatables[Trait.class].__index

--old_getCost is never called anywhere else (other than to recursively 
--call metatable.getCost again) so what is it holding on to here?
--once "Carrier" is found it'll just be an integer but we never use it
--is this just a keep-alive until the script eventually gets to the right trait?
--and once we find the right trait, traitcode.lua can do its thing?
local old_getCost = metatable.getCost

--dot syntax means self is not implicit,
--however when I change to colon syntax
--self doesn't seem to be passed implicitly
--meaning I can't do "metatable:getCost = function()" instead
--why doesn't colon syntax work here? 
metatable.getCost = function(self)
    if self:getType() == "Carrier" then
        return -SandboxVars.ZContagion.CarrierCost
    end
    --keep recursively calling this function
    --until we find "Carrier"?
    return old_getCost(self)
end
fast galleon
# novel barn Four days ago Albion wrote some code that** allows the creation of Trait Cost as...
TraitFactory.overwriteDef = TraitFactory.overwriteDef or {}
--TraitFactory.overwriteDef["Underweight"] = TraitFactory.overwriteDef["Underweight"] or {}
--TraitFactory.overwriteDef["Underweight"].cost = 8
    
    
TraitFactory.addTrait = function(...)
    local args = {...}
    local def = TraitFactory.overwriteDef[args[1]]
    if def ~= nil then
        if def.obsolete then
            return Trait.new("","",0,"",false,false)
        end
        for i,v in ipairs({"id","name","cost","description","prof","removeInMP"}) do
            if def[v] ~= nil then args[i] = def[v] end
        end
    end
    return addTrait(unpack(args))
end

This might need a better knowledge of PZ to insert sandbox values. So you can skip it.

novel barn
#

Poltergeist I'm trying to make sure I understand what I'm reading. This doesn't appear to have anything to do with Albion's code, but is instead another way to overwrite traits.

--extend overwriteDef so that it can also pass back an empty table?
--I haven't been able to find overwriteDef in any zomboid, lua, or java docs
TraitFactory.overwriteDef = TraitFactory.overwriteDef or {}
    
TraitFactory.addTrait = function(...)
    --load all trait parameters into args
    local args = {...}
    --def equals the id of the trait to overwrite
    local def = TraitFactory.overwriteDef[args[1]]
    --if def isn't empty
    if def ~= nil then
        --I can't find obsolete in any docs either
        if def.obsolete then
            --create a new blank trait? Or delete the existing trait?
            return Trait.new("","",0,"",false,false)
        end
        for i,v in ipairs({"id","name","cost","description","prof","removeInMP"}) do
            --if dev[v] has a new value, overwrite that arg
            if def[v] ~= nil then args[i] = def[v] end
        end
    end
    --create a new trait with the new (or old and persisting) args
    return addTrait(unpack(args))
end
#

This might need a better knowledge of PZ

I think that's what I'm most interested in digging into. I'm crawling the java docs but I'm not familiar enough with java to really understand what I'm looking at. I'll be the first to admit I'm punching WAY over my weight class with this code. The wiki has a very detailed table of contents, but so many of the linked pages are blank. I spent most of my 10 hours just trying to figure out the data structure of TraitFactory so I have a better understanding of what I'm trying to manipulate.

I'm going to stop barking up this tree until a later date when I have a better understanding of what I'm looking at. I appreciate the help though!

ancient grail
#

the admin cheat

#

its vanilla function basically

late hound
#

Just released a nicely sized content/fix update to Authentic Z. If you have any questions or bug reports, feel free to reach out to me.

fast galleon
#

return old_getCost(self)
this makes a tail call to the old function, meaning it will return the cost of the trait as set in the java object

fathom dust
#

what is the passive skill group called? it doesn't seem to be called "Passive". Trying to add a new skill to it.

fast galleon
fathom dust
fast galleon
fathom dust
#

ah np

#

I'm trying to start a new skill at level 5 like Strength and Fitness, but I'm having trouble finding where to hook that in. I went looking for a player created event but the closest I found, OnCreatePlayer, is called on each save game load not just when the character is first created.

fast galleon
#

Add default levels

local ProfessionLevels = { base = 5, engineer = 6, professor = 6}
local function doProfLevels()
    local professions = ProfessionFactory.getProfessions()
    for i = 1, professions:size() do
        local profession = professions:get(i - 1)
        local type = profession:getType()
        local level = ProfessionLevels[type]
        if not level then level = ProfessionLevels.base end
        profession:addXPBoost(Perks.Reading,level)
    end
end

Profession Hook

local original_doprofessions = BaseGameCharacterDetails.DoProfessions -- copy the original
BaseGameCharacterDetails.DoProfessions = function()
    original_doprofessions() -- call the original

    -- now do the stuff

end
Events.OnGameBoot.Remove(original_doprofessions)
Events.OnGameBoot.Add(BaseGameCharacterDetails.DoProfessions)
#

There might need to be something to change text descriptions.

fathom dust
#

So that adds an xp boost to all professions to effectively make it a common boost for all characters, right?

fast galleon
#

Yes

fathom dust
#

What about when choosing "no profession"?

fast galleon
fathom dust
#

Ah ok that makes sense, just an empty one by default i guess

fast galleon
#

If you have issues, you can check Albion's literacy mod.

fathom dust
#

Thanks, i'll give it a go

fast galleon
#

There was another literacy mod on steam that did that.

fathom dust
#

nice, it worked

pliant yarrow
#

There's a little exploit in my mod, and if I can't fix it it's not a huge deal, it's just a little immersion breaking so I thought I would ask in case there's a solution. I have a timed action set to reduce stress, and if you climb through/over something while the action is going the action continues but the animation stops. I was wondering if there's a way to make it stop the action if the animation stops or after climbing. I have it set to stop when running and aiming and that works but you can still climb and not cancel. 02shy

fast galleon
pliant yarrow
#

Like I said it's not the end of the world, but just figured it would make the mod seem better if I could patch it out nyannLul

fast galleon
#

Does the animation trigger some event when finished? Timed Actions have an OnAnimEvent function that is called where you should check the event name and parameter.

#

Action:animEvent(event,param)

#

This is called with a number of different Events, there should be one when you change animations. When that happens, do self:forceStop()

pliant yarrow
#

I'm not entirely sure. I kinda fudged things so upon doing an emote it starts a timed action, and both the emote and action loop until interrupted. It's not that it's broken like it won't stop after a certain amount of time, I just want it to interrupt when the animation is interrupted so I don't know about needing to do self:forceStop. I think your idea with the Action:animEvent(event,param) might help

pliant yarrow
#

I can't find any sort of animation event on finishing or anything. I'm not sure what to do SilverSweat

tame mulch
pliant yarrow
#

I'm trying to make a timed action that's looping, and make it interrupted when starting another timed action, or when the animation is interrupted.

#

I'm pretty new to modding and this is my first mod so my knowledge is very basic koBlush

#

Like the timed action thing has a thing for stoponWalk,OnRun and OnAim, but I don't know about any other conditions. I'm trying to make it stop when interrupted other ways.

tame mulch
#

action:stop() not work?

pliant yarrow
#

Not to my knowledge, so I'm probably doing something wrong or not understanding something

tawdry solar
mellow frigate
#

setPlayerMouse(nil) seems to do the job for creating a default main IsoPlayer.

fast galleon
#

Seems Player is Mouse works.

mellow frigate
#

Final goal is the spectate mode

#

Current goal is the creation of a new IsoPlayer to replace the dead one.

neon bronze
#

Isnt there a constructore for IsoPlayer?

mellow frigate
ancient grail
#

Scratch, swipe , hook

bronze yoke
# novel barn Four days ago Albion wrote some code that** allows the creation of Trait Cost as...
-----------------------------------------------------
--traits.lua
-----------------------------------------------------
--save the Trait class's metatable into a variable, so that i don't have to write all of this every time i access it
local metatable = __classmetatables[Trait.class].__index

--save the original getCost function into a variable - the cached value does not get overwritten when i overwrite getCost, so this is a permanent pointer to the vanilla function
local old_getCost = metatable.getCost

--you can use colon annotation here with implicit self, but i prefer to define my functions backwards ( name = function() instead of function name() ) which doesn't allow for that
metatable.getCost = function(self)
    if self:getType() == "Carrier" then
        -- if it's the trait we want, return the custom value
        return -SandboxVars.ZContagion.CarrierCost
    end
    -- if we didn't want to alter the return value because it wasn't the trait we were interested in, just run the vanilla function instead
    return old_getCost(self)
end
fast galleon
#

Hello, I'm not familiar with weapon mods. Do you know if burst mode has been done already?

bronze yoke
#

brita has it

tawdry solar
mellow frigate
#

Hello, question for the lua experts: how can I manipulate the non declared variable clickedPlayer from ISWorldObjectContextMenu.lua ? is it a local by default ?

fast galleon
mellow frigate
#

thanx, I must be doing bad stuff on the rest of my code then.

glass stump
ancient grail
#

having fun with xml

hollow lodge
#

Quick question, how do yo do translations? I know about the files and folders, but everytime I type in another language with different characters(chinese, russian) it all appears as "?????" ingame

#

is there any program I should use to write in the text files that has special characters or what

tame mulch
hollow lodge
#

yeah, that it's a good start

tawdry solar
#

is there a way to make custom emotes

regal plinth
#

Hello! I have a question, I am new to modding and have basic lua knowledge and i'm trying to make a new beverage recipe. I want to pour my beverage into a mug, but I don't seem to understand how I will do it since there are multiple verations of a mug (red, cyan, spiffo), do I just make multiple recipes? Is there any other way to make it more efficient?

cobalt dawn
#

ayo lads , small question, how hard is it to make a simple retexture mod, just making a specific car have a texture i want

mellow frigate
#

@tame mulch @fast galleon I made spectating function for Battle Royale mod that satisfies me on a local MP server. Now I'll see if it goes smooth on a real server. Anyway, thanx a lot for your advices.

tawdry solar
#

its not

#

the textureing is that hard bit

tawdry solar
#

anyone know what causes this?

ancient grail
prisma gale
#

When naming client script files does the file name matter ? ie; modname_OnEat.lua / sdfsdfsdf_OnEat.lua

steel locust
#

When it comes to weapon item categories (i.e. ShortBlunt, Improvised, etc.) is there an extra step to creating new ones? Or is it as simple as me deciding to name a new category and attach it to an item?

#

So for example, if I wanted to add the category "Random" to a butter knife, I just change "Categories = ShortBlade," to "Categories = Random;ShortBlade,", and that category now exists? Or do I have to add "Random" somewhere in the Lua code so that the game recognizes it?

bronze yoke
#

i can't even find a single reference to the word 'improvised' in code, so i think so

silver widget
#

Hay guys so ive been on a really weird side quest recently and ended up building an Xml parser because I'm too lazy to look at xml code - it basically extracts your xml file extractrapolates it to a data table and let's you alter the values while remembering the default states and allows you to export a new xml with the same format as the original. It also allows you to extract the schema of the imported xml with comments replacing the default values If you want. I was wondering if this would be useful for anyone else and if so is there any features you'd like? The last thing I was planning was a GUID generator

sage eagle
#

anyone taking requests

#

for mods

sage eagle
#

i thought they said they are full rn?

hazy knoll
#

Anyone have insight as to what might cause light to be cast upon the opposite side of the vehicle like this? I thought it might be normals but they're correct.

mellow frigate
#

Hi, if I call isoPlayer:transmitModData() isoPlayer:transmitUpdatedSprite() from the client where isoPlayer matches getPlayer(). Will the server spread those info to all other clients ?

bronze yoke
#

player mod data is transmitted automatically, transmitmoddata doesn't do anything

sleek hull
#

If I call setScratchTime(1) on a BodyPart object, what time frame does 1 actually imply? I thought it was hours or something, but the wound remained from 6:50pm to 11:00 pm, or about 4 hours 10 minutes..?

red tiger
#

Hello.

#

Drink.exe

#

Has stopped responding..

silver widget
mellow frigate
bronze yoke
#

it might have some delay or something, i don't know exactly how it is synchronised but iirc transmit does not work because the co-ordinate system it uses is not compatible with players

#

try transmit and if i'm not mistaken there should be a warning in the server console

#

i see that this is not how one of my mods seems to work so i might have been mistaken

thin hornet
#

As far as i remember player modData is never transmitted

#

Its local to the player object but also seems to be saved on the server when the player is saved. Tho not accessible on the server.

bronze yoke
#

i see for one of my mods i sent data to the server and then added it to player moddata from there, so that seems correct

thin hornet
#

and that data was then readable on the client?

bronze yoke
#

idk, i just needed it on the server

#

i would assume no if player moddata isn't usually synchronised anyway

trim mist
#

If anyone wants to try and play and break my anthro traits mod, send me a DM!

#

My friend set up a server for me, and getting other modder's eyes on it would be really nice

drifting ore
#

can someone help me with this silly problem, so i made my 1st 3d model in blender, a simple mask, i added it into the game, and it works, but it's not exactly where i want it to be, i tried moving it a bit higher in blender but it stays in the same spot in game so idk what's the problem xd

bronze yoke
#

not something i know anything about but you'll probably get a faster response there

drifting ore
#

oh ok thx

drifting ore
#

i figured it out heh

open drum
#

my lovely good fellows
Could anyone direct me to a right path
in trying to figure out a way to
alter the required item to "pick up" certain movable items
for example, to pick up a sink one might need a wrench
but I want to change the requirement to maybe "item.X"
instead of Base.Wrench
is there any easy way to do so using TileZed or LUA?
preferably TileZed since.. lua seem too complicated....
unless there's a simple mod that i can take a look at its code

fast galleon
jaunty marten
# open drum my lovely good fellows Could anyone direct me to a right path in trying to figur...
Events.OnFillWorldObjectContextMenu.Add(funciton(player, context, worldobjects, test)

        if not canBeWaterPiped then return end

                if test == true then return true; end
        local name = getMoveableDisplayName(canBeWaterPiped) or "";
        local option = context:addOptionOnTop(getText("ContextMenu_PlumbItem", name), worldobjects, ISWorldObjectContextMenu.onPlumbItem2, player, canBeWaterPiped);
        if not playerInv:containsTypeEvalRecurse("ItemX", predicateNotBroken) then
            option.notAvailable = true;
            local tooltip = ISWorldObjectContextMenu.addToolTip()
            tooltip:setName(getText("ContextMenu_PlumbItem", name));
            local usedItem = InventoryItemFactory.CreateItem("Base.ItemX");
            tooltip.description = getText("Tooltip_NeedWrench", usedItem:getName());
            option.toolTip = tooltip;
        end

end)

ISWorldObjectContextMenu.onPlumbItem2= function(worldobjects, player, itemToPipe)
    local playerObj = getSpecificPlayer(player)
    local wrench = playerObj:getInventory():getFirstTypeEvalRecurse("ItemX", predicateNotBroken);
    ISWorldObjectContextMenu.equip(playerObj, playerObj:getPrimaryHandItem(), wrench, true)
    ISTimedActionQueue.add(ISPlumbItem:new(playerObj, itemToPipe, wrench, 100));
end
#

discord code formattion is awesomecheblya

ancient grail
nimble pond
#

Was wondering if, somehow, it'd be possible to remove a job from the selection menu. Like, if I wanted to remove burger flipper as an option.

open drum
#

thank you for the reponse by the way

jaunty marten
nimble pond
scenic beacon
#

Sorry, I'm new in modding. How can I set the text of a SheetPaper?

open drum
void cargo
#

How would I create a sound event in the future with a variable amount of time? OnEvent every ten minutes check whether the duration has been reached or some other way?

coarse sinew
#

Why I can access modData only for some players ? I ran this in debug on a server with 35 active players:

local players = getOnlinePlayers();
for i = 0, players:size() - 1 do
    local player = players:get(i);
    local favouriteWeapon = nil;
    local swing = 0;
    local m = player:getModData()
    for iPData,vPData in pairs(m) do
        for index in string.gmatch(iPData, "^Fav:(.+)") do
            if vPData > swing then
                favouriteWeapon = index;
                swing = vPData;
                print(player:getUsername() .." - "..favouriteWeapon)
            end
        end
    end
end

And I get this because I'm close to them, but when I'm near other players it doesn't print.
LOG : General , 1686580180167> 4,123,747,162> Elyon - Red Toy Lightsaber
LOG : General , 1686580180168> 4,123,747,162> Ahriman - C.R.T.K Kukri Machete
LOG : General , 1686580180168> 4,123,747,163> LennyTheLight - Fiskar Curved Machete

void cargo
#

getOnlinePlayers def appears to be client side

tawdry solar
bronze yoke
#

no, getOnlinePlayers is correct

#

getSpecificPlayer will never return anything on the server

jaunty marten
tawdry solar
#

its clipping

#

so its being held the wrong way

jaunty marten
#

what u did/how u did/where u did

#

u just sent image with a thing that cannot be defined by itself

#

absolutely no info

red tiger
void cargo
#

Is there anyway to get a list of item components? For example the components that went into a stir fry

mellow frigate
void cargo
karmic fog
#

I'd like to change these two weight numbers from 20 to 5, to practically reduce the weight of zombie corpses to 5. I'm not really good at modding, but this seems like a simple fix. Is there a rattail to this? Will changing these values summon the enderdragon on me? bunny_peek

manic schooner
#

hopefully easy question.
can I alter a .lua file by just opening it in notepad ++, making the change, and saving it.

or do .lua have a specific way to make changes?

bronze yoke
#

yes

mellow frigate
regal plinth
#

How do I make a certain amount of water or any type of liquid for crafting. I don't know how to word it, but like I want to pour a certain amount of my beverage, but I don't know how to add the amount it has.

void cargo
bronze yoke
#

your client only knows about characters you've been near that session because of that hacking issue

tawdry solar
scenic beacon
#

Sorry, I'm new in modding. How can I set the text of a SheetPaper?

heady crystal
#

Anybody know of a function or event for when a vehicle is damaged by a zombie

tawdry solar
thin hornet
heady crystal
#

Thank you both for your assistance 💖

#

Just wanted to make sure

tawdry solar
thin hornet
#

We need to make a list of all the events and stuff we want to be added to the game.

OnVehicleCollision (vehicle, collided object, force)
OnVehiclePartDamaged (part, damage)
#

There are some existing events that should have parameters that don't. Which would make the event more relevant.

red tiger
#

I'm more interested in fixing misnomers in the Event callback parameters than adding needed ones.

thin hornet
#

I mean, there need to be a list of (to add, to edit, to remove)

red tiger
#

That's a good way to go about it, yeah..

#

Do that.

#

The codebase is only as good as the maintenance.

thin hornet
#

We build mods, we are in touch with the game code everyday and we face many walls that stop us from going forward in our creation. Those moments, need to be documented and eventually looked at by TIS when they have a chance.

#

Sometime the fix would be as easy as just triggering an event here and there

#

For example the OnSafehouseChanged event doesn't have a param, so we don't know which safehouse changed, nor what changed into it.

#

That one would be easy to fix like 200%. And triggering events where there has none would open alot of new possibilities.

regal roost
#

Hi! This is a part of a code that I'm doing that adds a menu and subcontext menus to the police bulletproof vest and for other vests in the future:

  a = nil
  for _, item in ipairs(items) do
    if (item:getFullType() == "Base.Vest_BulletPolice") then
      a = item
    break
    end
   end

When throwing my global variable a into this function:

local function changeLocation()
  local item = ScriptManager.instance:getItem(a)
  if item then
    item:DoParam("BodyLocation = TorsoExtraVest")
    ISTimedActionQueue.add(ISWearClothing:new(player, a, 30))
  end
end

The game breaks. My global variable a seems to work in the timed action function but doesn't seem to be accepted in ScriptManager.instance:getItem(a)
Using ScriptManager.instance:getItem("Base.Vest_BulletPolice") works fine.
Anyone know how to deal with this? Can I extract just this "Base.Vest_BulletPolice" from my variable with a function?

bronze yoke
#

a:getFullType()

#

i think you could also do a:getScriptItem() instead of using the script manager

regal roost
#

thanks, a:getScriptItem() worked fine!

gilded hawk
#

I see that WornItem is exposed, in java\Lua\LuaManager.java => this.setExposed(WornItem.class);
Is this the correct way to initalize it from lua?

local item = WornItem:new(bodyLocation, invIem)
bronze yoke
#

should be **.**new

gilded hawk
#

Ah 🤦‍♂️

gilded hawk
red tiger
novel barn
# regal plinth Hello! I have a question, I am new to modding and have basic lua knowledge and i...

I'm trying to create a drink mod as a POC for a question that someone else asked a few days ago, however I'm having some issues. I'm following this guide: https://pzwiki.net/wiki/Scripts_guide/Evolved_Recipe_Script_Guide however actually getting the recipe up and running has been troublesome. Currently the recipe works, but the context menu item looks like the attached picture. Anyone have any ideas why the item name is borked?

My recipe is as follows https://gist.github.com/danielewartwelch/1a327f87ad5b21f73489106de729614b

thin hornet
#

Did you create a translation file for ContextMenu?

novel barn
#

That'll do it. Thank you!

thin hornet
#

😄

novel barn
#

I knew it was something dumb

thin hornet
#

Using getText("ContextMenu_EvolvedRecipe_BepisSyrup") will return that string ContextMenu_EvolvedRecipe_BepisSyrup if it's not found.
So you create a lua/shared/Translate/EN/ContextMenu_EN.txt to translate it, and on next game reload it will be visibly correct.

novel barn
#

Follow up question. The whole mod falls apart if I don't include

module Base
{
    imports
    {
        Base
    }
...recipes and items here...
}

however I see other mods using

module NameOfMod{...}

I can't determine where I need to use Base and where I need to use the name of my own mod/filename. I also can't find anything in the wiki about modules. Is there a rule of thumb when you should use one verses the other? and why do I need to name the module Base and then also import Base?!

thin hornet
#

For Items and Recipes you can use your own module name but stuff like sounds and models I usually use Base, the rule is if it doesn't work use Base. lol
For Items you can actually see them sorted in the admin item menu.

novel barn
#

lol pretty solid rule I suppose

thin hornet
#

Sometimes there is no rules

novel barn
#

Yeah using debug was the only way I could confirm my item files were actually loading in for several hours yesterday B[

#

Dammit. I just figured out why the mod I was following doesn't need the translation files. They're using (nonevolved?) recipes. I guess static recipes don't need to be translated.

#

Thank you @thin hornet! You rock!

heady crystal
#

Can confirm, Konijima is the greatest there is!

#

Albion too love

lusty karma
#

Hey modders, just throwing that idea here because im not sure it exist already and i think it would be a cool (ofc not essential) feature. In DayZ we can wear military boots that have a slot for a knife, do you think it would be possible to do that aswell in PZ ? Add a knife (short blade) slot to Military Boots ?

nimble spoke
olive gorge
#

Guys, is there a mod that makes you forget the discovered map once your character dies? So the next character does not inherit the knowledge of the world map. Thanks!

lusty karma
#

also i was thinking to that : to add a new recipe (or even better a totaly new item) to build some rain collectors. The goal is to give an alternative to garbage bags to build them

#

i dont know what material could be used tho

ancient grail
#

Also @nimble spoke takes commission projects too

#

Since he answered first you should consider hiring him

lusty karma
#

Oh i was just throwing the idea like that, i wont go as far as paying someone to make it real

ancient grail
trim mist
#

Hey y'all, i have a kahlua inheritance question.

#

I have a function that knocks down players as well as zombies, because they both have isoGameCharacter as a base. Knocking down zombies is fine since they have ":setBumpStaggered", but a player does not.

#

Do functions from parent classes have to be specifically exposed in child classes?

bronze yoke
#

no, players should have it from what i can see

trim mist
#

stressed then I have no idea why this part of the function is erroring out in multiplayer

#
elseif instanceof(collidee, "IsoPlayer") and ((collider:getCoopPVP() == true and collidee:getCoopPVP() == true) or collidee.isZombie())
            then
                collidee:setBumpStaggered(true);
                collidee:setKnockedDown(true);
                collider:getStats():setEndurance(collider:getStats():getEndurance() - knockdownEndCost)
                collider:setBumpType("");
                collider:setBumpStaggered(false);
                collider:setBumpFall(false);
            end
#

it's a good ol' line 642: tried to call nil. It happened when a player who was not me tried to knock me over

#

oh. 642 is the second line

#

worse comes to worst, is there a way to cast a child as its parent in lua explicitly?

bronze yoke
#

no, there is no casting

jaunty marten
red tiger
jaunty marten
ancient grail
#

If you like

trim mist
pulsar rock
#

So, has anyone developed a tool or otherwise figured out how to decrypt / deserialise the data column of the player database?

#

Specifically through external means, rather than a mod.

ancient grail
#

They use Sqlite i believe

void cargo
trim mist
#

Hey guys, does reverting a mod in the workshop to a previous version make the version of the mod match a previous version?

#

I updated my mod on the workshop and now I have no access to a server I could have rebooted if I did

bronze yoke
lusty karma
#

Question for the map modders/people using Raven Creek. It's recommended by Raven Creek author to turn off random house events becaues it can cause bugs on the map. But i seriously miss that feature. What do you guys do? keep that setting off? you set it on ?

trim mist
#

oh well

bronze yoke
#

if the later version had new files they would not have been deleted, which would change the checksum and stop you from connecting

woven brook
#

can I write data to an INI file in the PZ directory?

#

(I know its unlikely but I can pray)

#

not the workshop folder but the game directory

bronze yoke
#

you can write to either your mod's directory or Zomboid/Lua/

#

i don't recommend ever writing to your mod directory though

woven brook
#

zomboid/textfile.bla bla

bronze yoke
#

no, has to be in the Lua folder

woven brook
#

fuck

#

brb

void cape
#

Hey, I'm making a true music mod using the provided tutorial, but when I attempt to actually publish it, it tells me that Its missing a mod.info file, but i have it.

#

if anyone could help that would be great

bronze yoke
void cape
#

i renamed the file and restarted my game but it's still giving me the prompt

bronze yoke
#

you have file extensions hidden, it might be calling itself mod.info.txt

#

on windows 10 you can unhide them by going to the view tab and then ticking file name extensions

void cape
#

thank you so fucking much

lone nest
#

is it possible to write to the saves/sandbox folder? and read it from a mod function?

bronze yoke
#

no

lone nest
#

Hmm... alright

#

Dang, I hope there's a better way

bronze yoke
#

generally, if you need save-specific data, just use moddata, if you don't, use the Lua filewriter

lone nest
#

Yeah, I tried, but apparently IsoPlayer data isn't saved in the moddata for some reason.

bronze yoke
#

it can't save objects, if you need to do that you need to save whatever data you need to reconstruct that object

lone nest
#

Hmmm... what a pain, OK thanks

#

IsoPlayer is a pain with all the inherited properties. Then I need to account for bodyparts, moodles, and location. stressed

red tiger
#

Sometimes you have to code while drinking to get the job done.

#

That's how I coded PipeWrench. :D

pulsar heath
lone nest
#

I mean, if you can count the number of inherited properties on IsoPlayer you'll understand.

#

I may need to rethink my life and plans.

lone nest
#

working out a modding plan for npcs.

jade chasm
#

hey does anyone have any advice on a model having attachments that are tiny?? I have one gun in a 3 gun mod im working on and I can't finish it because the one rifle has this issue with the attachments. it's also affecting the muzzle flash. scale modifier does not change it. gun is properly sized.

woven brook
#

so I've been working on a bit of a concept

#

really interesting

#

it uses a mix of reshade and a mod which adjusts climate settings

#

essentially

#

still getting a proof of concept but

#

based on whats happening in game it adjusts some things (wind intensity, precipitation etc) to be more cinematic and then it writes different reshade settings to a preset file stored in the zomboid/lua directory

#

I'm really hoping I can get this working

#

hard part is the ui masking

#

anyway wish me luck

ancient grail
#

The power turbingnon and off has an effect delay

I understand what youre trying to do
You want the player to get the broadcast feed

#

No matter where the player is

#

Its not going to work without power unless maybe theres a paramater you can change on the tv object
Or maybe create a version of that which consunes battery maybe

ancient grail
#

I dont know much abt this as i havent modded anything tv related
But theoretically this is all doable

ancient grail
#

U doubt you can fo this without overwritting texture

#

Idk i might be wrong

woven brook
#

I just started actually scripting it

woven brook
#

idk if zomboid allows for that even

#

but yea I'll report back in a few hours

bronze yoke
#

zomboid does not allow for that

ancient grail
#

But if u can transfer a tvs properties to a different sprite and able to play with its params (like requires power)
Then the feasibility is looking good

So i would suggest figuring out these stuff using debug
And if you fail then feasibility isnt looking good

woven brook
#

Why wouldnt that be allowed?

bronze yoke
#

if you need to load a mod at all zomboid won't let you do that

#

client mods must match the server

woven brook
#

Oh that

#

yeah

#

alright

#

makes sense

rustic garnet
#

I have a mod which let players like choose to hide some stuff, how could I go about saving that information so that they don't to hide it everytime they play?

#

I mean I could just use some JSON file, but does PZ have something built it?

bronze yoke
#

depends what you're trying to hide

#

if it's save file specific, use moddata, if it isn't, write a file

unborn valley
#

Some recent mods I worked on if you all care to check them out...

Dumb Ways to Die Death Music: https://steamcommunity.com/sharedfiles/filedetails/?id=2988459014

Fix Melee Context Menu popping up at the worst times: https://steamcommunity.com/sharedfiles/filedetails/?id=2986816238

Updated Two Weapons On Back + Modded Bags: https://steamcommunity.com/sharedfiles/filedetails/?id=2984969258

I haven't programmed in years, but I love Project Zomboid soooo much that I couldn't help but to break back into it! ♥

Currently working on a Custom Professions + Traits mod (TBD) as well as a Custom Zombie Behavior mod.

And more to come! breakdance

#

Project Zomboid #1

unborn valley
#

If you wanted to keep it Lore Friendly, there used to be handheld TVs back in the 80s and 90s. Wealthy businessmen in suits would travel with them so they wouldn't miss a sports game or the news. Those ran on batteries.

You might even want to check out the GPS mod for texture and UI presentation ideas.

https://youtu.be/VhSdhen3FrM

Teens react to the Sony Watchman -- a portable TV from the 80s. Watch to see their reactions to this old tech from decades before they were born.
Watch more reactions to old technology here: https://reactmedia.co/3Fk2CjN

Content Featured:
Commercial
https://www.youtube.com/watch?v=s_CMlHbB5Y4&ab_channel=tvdays
80s commercials
https://www.youtu...

▶ Play video
thin hornet
#

[Modder] Request for Modification
I am creating this thread to provide modders with an opportunity to share their ideas for modifications that can benefit the modding community and unlock new possibilities. This is not about requesting TIS to add new features to the game, but rather to request TIS to add or modify specific elements in the Java code that are necessary or missing for mods to operate more efficiently.

In this thread we can discuss together about posted suggestions.

Once a suggestion is supported by the community, we can create a forum post and tag @tame mulch to request a review.
While this does not guarantee that TIS will adopt the modification, it certainly helps to organize our ideas in a clear and understandable manner, increasing the likelihood of being taken seriously and demonstrating the needs for such modification.

Here is a model request that can be used to accurately describe your idea for the desired modification.

**Title:** [Your Idea/Suggestion]

**Introduction:**
*Introduce yourself briefly and state your motivation for sharing your idea or suggestion.*

**Problem Statement:**
*Identify the problem and explain why the current system is inadequate.*

**Solution Overview:**
*Provide an overview of your modification idea and its benefits.*

**Step-by-Step Implementation:**
*Outline the sequential steps to implement your modification.*

**Step 1:** [Description and instructions]
**Step 2:** [Description and instructions]
**Step 3:** [Description and instructions]

**Supporting Evidence:**
*Present relevant evidence or data supporting the feasibility and effectiveness of your modification.*

**Conclusion:**
*Summarize your idea, emphasize its potential benefits, and encourage feedback.*

You may also post your suggestions on the forum:
https://theindiestone.com/forums/index.php?/topic/23315-the-modders-wishlist/

thin hornet
#

[Modder] Request for Modification

fast galleon
#

@thin hornet
Would you mind to include this forum link I'm not sure what their preferred media is.

https://theindiestone.com/forums/index.php?/topic/23315-the-modders-wishlist/

thin hornet
fast galleon
#

Btw, @ _colonelpanic (anonymous) has a lot of work done for collision events, I'm not sure if he ever posted it though.

gilded hawk
regal plinth
#

For some reason my food items texture and icon is missing?

Model script

{
    model StrawberryKompot_Ground
    {
        mesh     = WorldItems/JarFood,
        texture = JarStrawberryKompot,
        scale     = 0.5,
    }
}```

newitem script

```module Base
{
    imports
    {
        Base
    }

    item KompotStrawberry
        {
            DisplayCategory     =       Food,
            Type                =        Food,
            DisplayName            =        Strawberry Kompot,
            Icon                =        SKompot,
            Weight                =        0.5,
            DaysFresh             =        60,
            DaysTotallyRotten     =         365,
            StaticModel           =         CanClosed,
            WorldStaticModel     =         StrawberryKompot_Ground,
        
        }
}     ```

I'm sure the textures are in place too.
thin hornet
regal plinth
#

and the icon is 32*32

thin hornet
#

and also make sure to restart the game to see the icon if you didnt already

regal plinth
#

The icons name is SKompot like in the script

red tiger
#

The only features I did that were eventually brought into the game were not ones I asked to be and the ones I did that were very important were ignored.

thin hornet
#

I'm hoping that we can do this as a community so that the impact is greater.

#

Also in the form, there is a field to demonstrate how to do the said modification. So I'm expecting that we do our research in the source to determine the feasibility of said modification.

red tiger
#

You're better off writing a flavor of PZ with adjustments.

thin hornet
red tiger
#

That's what modding is.

#

Well that's what old-school modding is.

thin hornet
# red tiger That's what modding is.

Well in the case of pz, modding is really limited to lua. I'm not hot to the idea of java mods just cause of the maintenance required and way of distributing it.

red tiger
#

That's it, really.

thin hornet
regal plinth
#

fixed the icon but the texture is still missing

regal plinth
#

Great, changed the name of a texture file and in the script, then this happens

bronze yoke
#

item is not found

regal plinth
#

how am I suppose to fix this?

bronze yoke
#

probably an error in your item script is stopping it from being read

#

or your recipe points to the wrong name or something

mellow frigate
#

How can I redirect the logs to another file than console.txt on a client ?

red tiger
mellow frigate
red tiger
#

Yeah I've mentioned possibly doing this several times in the past.

scenic beacon
#

Does anybody know how to set the text on a item of type SheetPaper2.

bronze yoke
#

item:addPage(index, text)

tawdry solar
#

how would i go about making a trait

shy folio
#

Does anyone know, how does the Lua engine handle coroutines? I'm not familiar with Kahlua but I know both Lua and Java. Like if I do IO stuff I'm worried about freezing the game. If I put like a sleep(100) in a coroutine does that freeze the whole world?

red tiger
#

coroutine is more like sequencing tasks, not executing them asynchronously IIRC.

#

Basically breaking down a task into segments and executing them then yielding for the remainder of the tick.

scenic beacon
bronze yoke
#

yeah, there is no multithreading available to us

tawdry solar
#

anyone got a template for traits

lilac ember
trim mist
tawdry solar
#

so like a trait that gi

#

ves

#

+4 blade

trim mist
#

That's easy. Do you know how to create a mod?

tawdry solar
#

yeah

#

took a break from making mine rn

#

so i wanna do this

trim mist
#

Here's the line of code you want then:

    local AT_Hooves = TraitFactory.addTrait("AT_Hooves", getText("UI_trait_AT_Hooves"), 4, getText("UI_trait_AT_Hooves_desc"), false);
    AT_Hooves:addXPBoost(Perks.Sprinting, 1);
    AT_Hooves:addXPBoost(Perks.Nimble, 1);
    TTF.Add("AT_Hooves", "Anthro,Hooves");
tawdry solar
#

oh sick

#

thanks

#

i dont know what this means tho

#

i get some of it

trim mist
#
    local traitName = TraitFactory.addTrait("traitName", getText("UI_trait_traitName "), 4, getText("UI_trait_traitName_desc"), false);
    traitName:addXPBoost(Perks.Sprinting, 1);
    traitName:addXPBoost(Perks.Nimble, 1);

formatting of the traitfactory line is (traitName, string of player-readable name, cost, string of description, bound to a profession only true/false) the last one would be like night owl or nutritionist

tawdry solar
#

oh makes sense

trim mist
#

ignore the TTF thing that's part of a framework i made

tawdry solar
#

ah alright

trim mist
#

you'll also want to ideally use getText for the name and description like I did. If you do that, you'll need a ModName/media/lua/shared/Translate/EN/UI_EN.txt

#

stick require("NPCs/MainCreationMethods"); at the beginning of the script you're using to declare new trait(s), and make sure you have a symbol for it in the UI in modName/media/ui/traits

#

other than that I think that's it. If you wanna do something more complicated that add skill levels though, that'll be... def harder haha

tawdry solar
#

ah

#

ty

bronze yoke
#

they always load first no matter what, and none of them return anything

trim mist
#

huh. good to know!

bronze yoke
#

when you see mods doing this it's either because they're copying from vanilla, which does need to ensure its own load order, they copied from other mods that do it, or just as a way of indicating 'see this other file'

sick hamlet
#

Hello, I am trying to find a way where I can somehow transfers a player zombie model (I think it's a clothing) into a dummy NPC, does anyone know something? (Sorry I have to repost, I posted it in the wrong channel)

mellow frigate
mellow frigate
sick hamlet
mellow frigate
# sick hamlet I am basically looking for a command line where if the setting is true, it will ...

NPC dummies are not available directly in Vanilla. Most NPC mods use createSurvivor function. This comes with some troubles and no MP compatibility. Some other mods use Mannequins. This comes with some other troubles. Clothings can be transferred from Zombies (IsoZombie) to Players (IsoPlayer), but most other things cannot. I'm not aware of anyone using IsoZombie for other things that menace.

sick hamlet
mellow frigate
sick hamlet
mellow frigate
sick hamlet
drifting ore
#

How would I export 3d models from in game?

#

I plan on re-texturing some models lol

#

Like applying some gun skins

thin hornet
drifting ore
#

Yeah, I know that, but how the heck do I get the .x's in blender / whatever editing thing?

thin hornet
#

you would have to convert x to fbx with some tools

#

which #modeling will be able to answer more easily

drifting ore
#

alr, whenever i get on my main pc, will do so

thin hornet
jade chasm
#

i’ve never been able to get fbx’s working ingame

sick hamlet
jade chasm
#

@drifting ore if you use blender version 79b it has a native .x exporter. you can use whatever version of blender to make model, export as fxb, import in 79b and then export as .x. it has worked for me with a bunch of models

timber spindle
#

Okay I'm still pretty new at this but, where in the game files is the code the game uses to check if the player is indoors?

#

my plan is to write a mod wherein a player who is outside and not wearing a gas mask will slowly take damage over time.

#

but I don't know where to find the bits of code to steal to put it together

#

(I also dont know where the script would need to be put in order for it to work, or what script to add the call for the mod to)

wet sandal
#

@timber spindle I'd suggest getting the player's location using playerObj:getCurrentSquare(). You can then ask the square if it is located outside using square:isOutside()

timber spindle
#

perfect that's exactly what I need

wet sandal
#

Anyone know why this is blowing up at string.find

TetrisItemData._calculateMoveableStackability = function(item)
    local name = tostring(item:getDisplayName()) or ""

    local a = string.find(name, "(")
    local b = string.find(name, "/")
    local c = string.find(name, ")")

    local isPackaged = a and b and c and a < b and b < c
    if isPackaged then
        return 2
    end

    return 1
end
bronze yoke
#

what is the error?

wet sandal
#

A bit unhelpful

#

At least to me

bronze yoke
#

stressed kahlua didn't like that

#

oh!

#

it's interpreting your brackets as part of a POSIX capture pattern

wet sandal
#

Ah!

#

Ty

bronze yoke
#

try "%("

wet sandal
#

Yep that was it!

wary dust
ancient grail
mild venture
#

Hello everyone I am developing a mod related to the sale of cars on one of the servers. I ran into a problem: "vehicle:getId" issues duplicate IDs. This happens when the old transport that has already been issued an ID is "not loaded", but we will spawn a new one. Is this a normal situation or have I messed up something? I need a clear way to identify the car. Maybe I should use vehicle:getKeyId() or something else? I will be glad of any advice. Thank you in advance.

bronze yoke
#

are you using getID or getId ? unfortunatley they are not the same

mild venture
#

getId

bronze yoke
#

if you need a definite persistent way to identify a vehicle getSqlId() is definitely unique and persistent

#

i had thought (or hoped) Id was persistent but i guess not

mild venture
bronze yoke
#

i think you'd have to resort to looping through the vehicle list until the matching sqlid

mild venture
#

Hmm, how can i get list of all vehicles on the server?

bronze yoke
#

getCell():getVehicles()

mild venture
#

I'm going to try it. Thank you

grim mortar
#

alright, question here because apparently the devs have done this in an incredibly questionable way, is there any way to add (n) ammo via script? that is, (n), not (n*5).

#

idk why the heck they put base counts on what should have been singular ammo like that instead of calling plurality later

bronze yoke
#

container:AddItems("Base.Whatever", 1)

#

it makes sense with how the loot system works, but it is unintuitive basically everywhere else

grim mortar
bronze yoke
#

if that doesn't work you could create it with InventoryItemFactory and then add it to the container

#

i feel like there was a simple way to do it though

mild venture
bronze yoke
#

that seems crazy, the sqlid is the id it uses in the database

#

if that isn't persistent then i'd have to say vehicles do not have a persistent id

#

and you'd have to store your own id in moddata or something

mild venture
mild venture
#

What do you think about using keyId? I don't think they should change

bronze yoke
#

probably not, i don't know whether or not one will be generated if the car spawns without a key though

mild venture
#

I didn't find any description

bronze yoke
#

keyid must always be generated, otherwise the code i'm looking at would crash

#

i think mechanical id is the whole sports/utility/whatever the normal one is thing

mild venture
bronze yoke
#

it's literally a random number, but it is not unique

mild venture
#

uh

bronze yoke
#

and i imagine it would cause pretty big issues if it wasn't unique

mild venture
#

Sounds reasonable. Thanks for the help. I'm going to get some sleep cold

grim mortar
bronze yoke
#
local item = InventoryItemFactory.CreateItem("Base.Whatever")
container:AddItem(item)
grim mortar
#

does that bypass inheriting the stupid base count property, so I end up with 1 bullet and not 5

#

again I really wish I knew why they did this

bronze yoke
#

it should

grim mortar
#

awesome.

bronze yoke
#

it's convenient because the spawn system would have to be set up to spawn item in multiples instead

#

i probably wouldn't do it that way myself but i do get it

#

i don't think the game tends to spawn items outside of the loot system very often

grim mortar
#

yeah

sleek hull
#

Does the health panel have to be updated after an injury is dealt to an IsoPlayer object for it to show on the character part of the UI?
Wounds/injuries can be caused via setScratched(), setCut(), etc, but the characters model in the health tab isn't updating

#

If an injury is caused by the lua console though it updates the health panel??

novel barn
#

@sleek hull by any chance are you in debug mode with godmode on? It took me a few hours to figure that out a few weeks ago.

sleek hull
#

I can give it a try without debug too maybe?

novel barn
#

No I don't think that will make a difference.

thin hornet
#

Body parts should be updated every ticks

novel barn
#

^ my next thought, is the game paused?

thin hornet
#
function ISHealthPanel:update()
  ...
  self:updateBodyPartList()

is called

sleek hull
thin hornet
#

Where do you run the code that set a body part

sleek hull
#

I have it set in a table OnGameStart

#

I have it roll to see if an injury should occur, if it should it determines the injuryType (scratch, cut, deepWound, or deepShardWound)

#

Then the would does actually get applied in it's respective function here

thin hornet
#

OnGameStart is too early to get the player I believe

#

The player is not yet "connected"

novel barn
#

I'm currently working on a total burns mod and I'm using Events.OnNewGame

thin hornet
#

@sleek hull One way I use to init a mod is using OnTick

local function init()
  Events.OnTick.Remove(init)
  -- do init code
  -- will only run once at the first tick ever
  -- now you know the player exist
end
Events.OnTick.Add(init)

Tho caching the player like this local player = getPlayer() will only store the reference of your first local player (not splitscreen friendly), when he/she dies and respawn in a new character that reference will be nil.

alpine quarry
#

im tryying to make a true music mod but when i try to publish it it says "your mod is missing mod.info" even tho its there

novel barn
sleek hull
#

Im trying to see if maybe it's just an issue with how I'm causing the wound in my doScratch()/doCut() etc functions, because causing an injury immediately from the bodyParts table seems to work and update the ui properly

#

Oh wait I might also just be dumb, I'm going on a limb here to say that setScratchTime() and the related functions for other wounds determines the visibilty in the health window?

bronze yoke
#

probably, i'm not sure just setting the wound to true is enough for a 'real' wound

#

actually the wound image fades with the wound time

#

so if it hasn't been set it's zero so the image will be invisible

sleek hull
#

I have it set to an injuryTime of 1 by default and thats what I've been testing with. Im just now realizing that a light wound is like, 7-10

thin hornet
#

well check inside ISHealthPanel.onCheatCurrentPlayer = function(bodyPart, action, player)
it contains all the examples of injuries and how to set/unset it

sleek hull
novel barn
#

Anyone else have a checklist of reasons why mod.info can't be found? I just remembered seeing that conversation yesterday but I'm not sure how else to help.

bronze yoke
#

probably just incorrect file structure

#

if the file is named correctly then it must be in the wrong place

alpine quarry
#

info file

novel barn
#

what folder is it inside?

#

It needs to be outside the media folder

alpine quarry
#

workshop/modname/

sleek hull
#

Is the file in "ModNameHere" \ Contents \ mods \ "ModNameHere"?

alpine quarry
#

its also outside the media

#

ya

#

oh my lord

sleek hull
alpine quarry
#

i forgor to make a modname file in the mods folder

sleek hull
#

It be like that sometimes

bronze yoke
#

glad it's working now!

sleek hull
#

Question, is the woundTime for cuts/scratches/deep wounds/fractures measured as in game hours or a real time unit?

bronze yoke
#

it looks like it's a different time unit for every wound

sleek hull
#

Time unit as in minutes/hours/days, or as in the range of in game hours they can take?
The wiki specifies injury severity/length by in game hours so I figured this would be the case for all of them

bronze yoke
#

as in 10 scratch time and 10 deep wound time are not the same

sleek hull
#

Odd, guess I'll just have to base my default ranges on what vanilla injuries follow

bronze yoke
#

i'm not really sure how the wiki calculates this, personally i have not experienced injuries healing as fast as it claims

#

but i also haven't played in a while so my recollection might be faulty

sleek hull
bronze yoke
#

yeah, and i usually play with slow healer so i've probably just accepted that my wounds take forever to heal and it feels much longer than it really is

sleek hull
#

Same lol

#

More time for me to work on my army of vehicles for me myself and I

slender stream
#

Hi, I’m new to modding and has watch videos and tutorials online about simple item and recipe mod, however, I am having a hard time writing and learning mod that requires a lot of advance lua. I have coding background, but not understanding where to start for advance lua related to pz, anyone know where should I start? (I was reading codes for RV interior and even I have a rough understanding what’s going on, I have no idea where are all the code coming from, any pz code documentation?) thanks🫡

bronze yoke
slender stream
#

OMG this looks very promising. Greatly appreciated

pliant yarrow
#

I keep getting an error and I have no idea why. I have been trying to work around it for a while. I can more provide code if needed. The error is Exception thrown java.lang.RuntimeException: __add not defined for operands in init at KahluaUtil.fail line:82. I'm trying to do local player = getSpecificPlayer(0) player:getTraits():add("Trait") in my .init function and it just does not like it. It has worked in my other files' functions. Any help would be appreciated SilvShy

thorny pollen
#

add : before add

pliant yarrow
#

Sorry, I have that in my code, I just didn't copy paste it directly, I was trying to shorten it and made a mistake.

thorny pollen
#

could you show more

#

is that line 82 you're showing?

jaunty marten
pliant yarrow
#
BipolarCore = {}
BipolarCore.init= function ()
    local player = getSpecificPlayer(0)

    if not player or not player:HasTrait("Bipolar") then
        return
    end

    local positives = {
        "BipolarMania",
        "NeedsLessSleep",
    }

    local negatives = {
        "BipolarDepression",
        "NeedsMoreSleep",
    }
    local isBipolarEffect = player:HasTrait("BipolarDepression") or player:HasTrait("BipolarMania")
    local isInDepression = player:HasTrait("BipolarDepression")
    local isInMania = player:HasTrait("BipolarMania")
  
    local starting_chance = player:HasTrait("BipolarDepression") and 80 or player:HasTrait("BipolarMania") and 80 or 60
    local chance_of_Bipolar = starting_chance + 0
    local roll = ZombRand(100) + 1
    local BipolarEffect = roll <= chance_of_Bipolar
    if BipolarEffect and not player:HasTrait("BipolarDepression") or player:HasTrait ("BipolarMania") then 
    player:getTraits():add("BipolarDepression")
    player:getTraits():add("NeedsMoreSleep")
    else
    player:getTraits():remove("BipolarMania")
    player:getTraits():remove("NeedsLessSleep")
    player:getTraits():remove("BipolarDepression")
    player:getTraits():remove("NeedsMoreSleep")
    end
  
    
    local starting_chance = player:HasTrait("BipolarDepression") and 45 or player:HasTrait("BipolarMania") and 45
    local chance_of_Moodswing = starting_chance + 0
    local roll = ZombRand(100) + 1
    local BipolarMoodswing = roll <= chance_of_Moodswing
    if BipolarMoodswing then
     print('isInDepression: '..tostring(isInDepression))
     print('isInMania: '..tostring(isInMania))
    ApplyPositiveOrNegativeTraitsGivenACondition(isInDepression, positives, negatives)
    
    player:Say(player:HasTrait("BipolarDepression") and "I feel terrible" or player:HasTrait("BipolarMania") and "I feel Unstoppable" or not player:HasTrait("BipolarDepression") or player:HasTrait("BipolarDepression") and "I feel fine")

    end
end

ProfessionFramework.addTrait('Bipolar', {
    name = "UI_trait_Bipolar",
    description = "UI_trait_Bipolardesc",
    icon = "trait_Bipolar",
    cost = -7,
    exclude = {
        "NeedsLessSleep",
        "NeedsMoreSleep",
    },
    OnNewGame = function(player, square, profession)
        BipolarCore.init()
    end,
    OnGameStart = function(trait)
        -- add a new event to trigger every day
        Events.EveryDays.Add(function()
            BipolarCore.init()
        end)
    end
})

ProfessionFramework.addTrait('BipolarMania', {
    name = "UI_trait_BipolarMania",
    description = "UI_trait_BipolarManiadesc",
    icon = "trait_BipolarMania",
    cost = 0,
    profession = true,
    exclude = {
        
    },
})

ProfessionFramework.addTrait('BipolarDepression', {
    name = "UI_trait_BipolarDepression",
    description = "UI_trait_BipolarDepressiondesc",
    icon = "trait_BipolarDepression",
    cost = 0,
    profession = true,
    exclude = {

    },
})```
#

I just didn't want to post a massive wall of spaghetti code SilverSweat

novel barn
#

I'm looking at some existing (functional) code

local trait = TraitFactory.getTrait("Carrier")
local ccp = MainScreen.instance.charCreationProfession
local olditem = ccp.listboxTraitSelected:removeItem(label)

I've determined removeItem() is not lua, but is accessed from java? I'm not really sure how to describe what removeItem() is... ANYWAY, I'm trying to add another line before the trait is removed so I can determine if the trait was in a specific list

 local trait_is_purchased = ccp.listboxTraitSelected:hasItem(label)

But this always spits back the following error: Object tried to call nil in setSandboxVars. **Does PZ not expose hasItem() the same way it exposes removeItem()? Or am I just doing something super wrong?
**

thorny pollen
jaunty marten
#

it's lua, u can no thing about tabulation at all

#

u can even do

ProfessionFramework.addTrait(
'BipolarDepression',

{
    name
= "UI_trait_BipolarDepression",
    description =
"UI_trait_BipolarDepressiondesc"
,
    icon = "trait_BipolarDepression",
    cost = 0
,
    profession = true,
    exclude =
{}
,
})
#

and it will be valid

jaunty marten
thorny pollen
#

yeah I know I'm a bit tired might of misread it

pliant yarrow
#

I actually deleted some lines to condense things to send here. Line 82 is actually ProfessionFramework.addTrait('BipolarDepression', {

#

I just deleted blank space lines

#

I added the spaces back in if it's less confusing

#

I don't know. I know I'm a very inexperienced coder and I don't know what I'm doing, but my other lua files work with the same sorta format and this one doesn't. I don't know where the __add error is coming from

jaunty marten
#

problem not with player:getTraits():add(...)

#

cos error says __add but not just add

#

__add is meta method for sum

#

like x + y

#

so here is x is metatable then this one must have __add meta method

#

smth goes wrong when u adding new traits

pliant yarrow
#

Okay, thank you, I'll try to add the traits without ProfessionFramework like normal. That might fix it. ProfessionFramework has caused a few problems for me but I'm using it for a some other reasons.

novel barn
#

I could be WAY off, but https://github.com/demiurgeQuantified/PZEventStubs/blob/main/Events.lua lists the Event.EveryDays structure as follows:

---Fires at 0:00 every in-game day.
Events.EveryDays = {
    ---@param func function
    Add = function(func) end,
    ---@param func function
    Remove = function(func) end,
}

and you appear to be doing

    BipolarCore.init()
end)```
Can anyone determine if both are valid?
jaunty marten
#

there's two versions on workshop

#

old and new

pliant yarrow
#

I'm not sure, someone else technically did that bit. I'm working on someone else's mod with their permission.

pliant yarrow
#

Yes, I have the new one

jaunty marten
ancient grail
#

Is it possible to save all yhe fence locations in the vanilla world
Then use that data for 10yrs later to revive all the fence

#

Sounds like its painful to code

#

If you can do this we might send you the project(commission)

For more info contact us

jaunty marten
#

sounds like creating of table with all existed fence textures wtf
but not sure, mb there's some function to determinate that some object is actual fence

ancient grail
#

Nah just check the sprite
And you have to note which way its facing too otherwise you will construct it the wrong way

jaunty marten
#

texture/sprite

#

same

jaunty marten
pliant yarrow
# jaunty marten smth goes wrong when u adding new traits

I can't figure out why it isn't recognizing the two traits, whether I add them with TraitFactory or ProfessionFramework. I'll keep trying to solve it. I appreciate your help, but I'm confused why the game isn't recognizing the traits while it recognizes my other ones. nyannNoo

ripe warren
#

is it possible to edit vehicle stats like max speed, acceleration or fuel consumption on runtime?

ripe warren
#

Thank you

ancient grail
#

Like put it back

thin hornet
ancient grail
#

Yes

#

Ive spoken with dane and he gave permission
Pao will do the project eventually

thin hornet
# ancient grail Yes

then instead of reviving maybe patch the part of the mod that removes them so that it doesnt remove them anymore?

ancient grail
#

Its a map mod

red tiger
#

Good morning.

mellow frigate
#

Hello there, When I kill my local character with myPlayer:Kill(nil), I have (half the times) following errors ```attempted index: isAnyVisible of non-table: null

LOG : General , 1686752545194> 77?156?899> -----------------------------------------
STACK TRACE

function: updateTooltip -- file: ISInventoryPane.lua line # 833 | Vanilla
function: update -- file: ISInventoryPane.lua line # 1668 | Vanilla

ERROR: General , 1686752545195> 77?156?900> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: isAnyVisible of non-table: null at KahluaThread.tableget line:1689.

#

Do you have any idea how I should prevent the inventory panel to update while the player is not available ?

fast galleon
wet sandal
#

Half-baked generic handling of all 2 items recipes via drag and drop (reload is custom handler, which is why the mag makes it back to its original spot)

#

Getting the result items back to their original spot is a bit more challanging than I thought it would be without duplicating a bunch of code.

#

The recipe action also only accepts a single item as input, so if you have 2 batteries and 2 flashlights, I can't guarentee what battery is going in what flashlight...

neon bronze
#

Not possible through the items id to somehow track what item goes in what item?

tawdry solar
#

due to no double click to transfer

wet sandal
#

its got ctrl-click to transfer

#

I can make it more remappable I suppose

tawdry solar
#

ah

#

alright

wet sandal
#

There, was on my mind already anyways

novel barn
bronze yoke
#

if it's ui it's lua, so they wouldn't really have any way of stopping you

wet sandal
#

Yea taking a look, the listbox is lua

#

Its derived from an ISScrollingListBox. Created inside of CharacterCreationProfession.lua

#

No has item function in ISScrollingListBox

novel barn
#

😦 In the future how can I determine what functions are available to what objects?

wet sandal
#

I just open my installed game's media folder in VSCode

#

And global search

novel barn
#

🙇‍♂️ thanks!

wet sandal
#

local tableToSearch = ccp.listboxTraitSelected.items

#

Its a regular indexed table

novel barn
#

Thank you! I think I have what I need now.

#

I didn't realize the installed game was THIS exposed...

thin hornet
# novel barn I didn't realize the installed game was THIS exposed...

only lua yeah, for the java side you would need to decompile to have more info on the internal functioning of the game. On the other hand you can also use Umbrella to get full intellisense of what is available in both lua and java. pzstudio offer a structure for making your mods and includes umbrella by default.

novel barn
#

I'm using umbrella! I just don't have much experience with intellisense so I don't naturally think to rely on it. I come from a background of QA and I'm trying to integrate with this community to get my dev chops up to speed. 🙂

#

Lets just say I have several gaps in my development sense that I'm trying to correct

thin hornet
#

Sorry what does QA mean ?

novel barn
#

quality assurance

thin hornet
#

oh

novel barn
#

test planning, bug tracking, documentation, etc

thin hornet
#

So you have Umbrella installed into your project with VSCode right?

#

Then if you have the lua extention for vscode installed it should load the intellisense automatically.

novel barn
#

yes. it's all there. my brain just doesn't see the suggestions 😦

thin hornet
#

Then when you start typing a filtered list will appear

novel barn
thin hornet
#

ah great you are set

#

the thing at the end of the line is the return type, so you know what that method or property returns.

novel barn
#

oh wonderful!

thin hornet
#

When you do getPlayer(): you would get all the method available to the IsoPlayer object.

#

Including all methods available to parent classes of IsoPlayer such as IsoLivingCharacter etc

#

It will also suggest to you what type of parameter can go into the method call. Which is time saver.

#

Anyway if you have any questions about any of this just ask 🙂

novel barn
#

will do! Thank you!

red tiger
#

I'm noticing more people are using Umbrella which is a very good thing.

proud spruce
#

Quick question: I'm seeing three events listed for similar things: OnZombieDead, OnPlayerDeath, and OnCharacterDeath. The first two are pretty obvious, but I'm not sure that I'm reading the API correctly in terms of what a "Character" is in this context. I'm presuming that technically a "Character" is Class IsoGameCharacter and technically is a parent class to both Players and Zombies? Would this event first when either die?

bronze yoke
#

yes, it fires in either case

#

iirc OnCharacterDeath will fire for players who aren't local players, whereas onplayerdeath won't

proud spruce
#

Hm. The references I need for this always feel overwhelmingly exhaustive and incomplete at the same time every time I try to dip back into this.

#

In this context, a local player is the player (or I suppose players, in split-screen co-op?) who is playing in the specific client, not another connected player in a multipler session?

bronze yoke
#

yeah

proud spruce
#

Okay. I shouldn't need to worry about the distinction much, just yet.

#

Yeah I've been trying to peruse things like that. I'm having a hard time finding all the events that I would expect to find so I guess I have to start looking at some of the classes themselves to see what is going on.

#

Some things I was considering for a mod that I'm looking into are when a hit is made on a zombie, determining if the hit was made from a gun and if the hit was a crit, and hooking into when a gun is repaired, which I'm still picking apart how to find the repair functions.

bronze yoke
#

this has every single event listed with parameters and at least basic descriptions, it tries to specify whether things fire in singleplayer/multiplayer, if they're client/server only, but that information i don't guarantee 100% since it's difficult to determine just from code and testing would be an insane undertaking

proud spruce
bronze yoke
#

it's more helpful when you have more of an overview of how the game works

proud spruce
#

Hmm. Is it even possible to hook into when an item is repaired?

bronze yoke
#

i think you can just hook into ISFixAction

proud spruce
#

My understanding was that hooks replace the vanilla code instead of running with them. Is that correct?

bronze yoke
#

that's not quite hooking

#

we save the vanilla code into a variable and call that alongside our replaced code

#

effectively just adding our code to the vanilla function

#

the general structure is like this:```lua
local old_func = vanillaFunction -- reference to the function, don't include the () or you'll just call it instead
function vanillaFunction(...)
-- code to run before the original
old_func(...)
-- code to run after the original
end

proud spruce
#

Lord above that makes so much more sense.

#

I'm still figuring my way around all the game's internal Lua but once I finally find the right file for what I'm hooking into, things start making more sense.

bronze yoke
#

ohh, right, the game's hooks are a different thing

#

if i'm being honest, you can just forget about them entirely

#

the way they're designed really heavily limits their usefulness, and there's so few of them they lose most of the remaining usefulness they would have had

#

while i was writing that guide i went from 'cool thing nobody knows about! i better document it' to 'what are these even FOR'

proud spruce
#

hahaha

gilded hawk
#

Is it possible to access the player's java\core\skinnedmodel\advancedanimation\AnimatedModel.java ?

bronze yoke
#

the class isn't exposed

gilded hawk
#

Ah goddamit 😦

proud spruce
#

In terms of adding code to ISFixAction, since it has different functions such as ISFixAction:new, ISFixAction:perform, etc; would it be saving and replacing :perform?

local OriginalFixAction = ISFixAction:perform
function ISFixAction:perform(...)
    OriginalFixAction(...)
    self.character:Say(self.item.mainCategory)
end
bronze yoke
#

probably! perform is usually the 'successful completion' function

proud spruce
#

Okay then. Hopefully this should all work smoothly. Thank you!

mellow frigate
#

How can I unset IsSeeEveryone flag on an admin ?

bronze yoke
#

from my reading, on their client call getDebugOptions():setBoolean("Cheat.Player.SeeEveryone", false)

lone nest
bronze yoke
#

i don't really know if these functions search from the same filepath but fileExists()

lone nest
nova vortex
#

Hey yall

#

I dont make mods very often but I need a little assistance with a quick and dirty project im working on

#

I moved up from ethanwdp's cheat menu to Cheat Menu PX

#

but PX lacks the Infinite Carryweight item, which I like to use to make the storage capacity of my base containers not a problem

#

so i decided to make a quick item thats essentially the same thing to just spawn in, only it's not showing up in the item spawn menu, and I was wondering if anyone knew how it worked

#

i used zomboids empty tin can as a base item and edited relevant values, as i didnt feel like writing it from scratch.

bronze yoke
#

you need a module

nova vortex
#

eh?

#

whats that mean

bronze yoke
#
{
    item InfiniteCarryweight
    {
        ...
    }
}
nova vortex
#

ahhhhhh

#

let me add that in and test it again

#

the module name can be named anything yeah?

bronze yoke
#

yeah, preferably something that represents your mod

nova vortex
#

gotcha, gotcha

bronze yoke
#

don't forget the } to close the module

nova vortex
#

uh, where should that go

#

sorry, i know fuckall about lua lol

bronze yoke
#

just at the end

nova vortex
#

after the name?

#

before or after which word lol

bronze yoke
#

at the very end of the file, on a new line

nova vortex
#

okay, so after the last bracket for the item

bronze yoke
#

right!

nova vortex
#

ahhh i see

bronze yoke
#

looks good to me!

nova vortex
#

alright! i appreciate it

#

thanks for bein patient too
i would upload it to workshop but, effort. if you want it i dont mind yall taking it

#

maybe you could do a cleaner implementation than i can lol

bronze yoke
#

i'm not sure how i'd do it, but i've been told that negative weights will no longer work in b42

nova vortex
#

;O;

#

and its still not showing up in Cheat Menu PXs item spawner >:/

#

the item spawner does have other modded items, so i know its not that

#

hmmmmmmm

#

i cant access PX's files so i cant see how it does things

lone nest
bronze yoke
#

nice!

#

is there a getter for the cache directory? otherwise seems a little impractical for most other uses

lone nest
#

good question ¯_(ツ)_/¯

#

working blind here without documentation and a ton of trial-error

nova vortex
#

i'll come back to this at some point drunk

#

Til then, as I said, anyone has full permission to mess with it more

#

just let me know if you have any new developments

mild venture
#

Hello! Is there some way to put breakpoints in lua code, for debugging in the built-in debugger (F11) ?

bronze yoke
#

open your file in the debugger and double click the line

mild venture
bronze yoke
#

i think you could use error("") like that

mild venture
#

Thanks! I will try

grim mortar
#

I feel like asking this again in the daylight hours, does anyone know how to, through script, add, say, 7 ammo to an inventory? That is to say, bypassing ammo's usual multiple of 5 to put a literal direct number of bullets into an inventory.

#

I haven't been able to make any given or found examples function .-.

mild venture
grim mortar
#
    local zombieinv = zombiedropitem:getInventory()
    local ran = ZombRand(100)
    local ran2 = ZombRand(43)
    local item = InventoryItemFactory.CreateItem("Base.Bullets9mm")
    

    if ran < 100 then
        if ran2 < 3 then
            item = InventoryItemFactory.CreateItem("Base.Bullets9mm")
        end
        if ran2 >= 3 and ran2 < 6 then
            item = InventoryItemFactory.CreateItem("Base.Bullets45")
        end
        if ran2 >= 6 and ran2 < 9 then
            item = InventoryItemFactory.CreateItem("Base.Bullets44")
        end
        if ran2 >= 9 and ran2 < 12 then
            item = InventoryItemFactory.CreateItem("Base.Bullets38")
        end
        if ran2 >= 12 and ran2 < 15 then
            item = InventoryItemFactory.CreateItem("Base.ShotgunShells")
        end
        if ran2 >= 15 and ran2 < 18 then
            item = InventoryItemFactory.CreateItem("Base.223Bullets")
        end
        if ran2 >= 18 and ran2 < 21 then
            item = InventoryItemFactory.CreateItem("Base.308Bullets")
        end
        if ran2 >= 21 and ran2 < 24 then
            item = InventoryItemFactory.CreateItem("Base.556Bullets")
        end
        if ran2 == 24 then
            item = InventoryItemFactory.CreateItem("Base.Bullets22")
        end
                [ . . .] etc
        local lCount = 0
        local tCount = (ZombRand(5))
        while (lCount <= tCount)
            zombiedropitem:getInventory():AddItem(item)
            lCount++
        end
    end

end

Events.OnZombieDead.Add(dropammo)```
#

it doesn't throw errors on execution, it just doesn't function as expected. I actually wish it did throw errors, the script debugger is the best I've ever seen.

mild venture
#

:AddItem() arg must be string as i know

#

pl:getInventory():AddItems("Base.ShotgunShells", 5)

#

like this

grim mortar
#

according to the doc it also takes InventoryItem

bronze yoke
#

it can be an item yeah

grim mortar
#

as far as I can see InventoryItemFactory.CreateItem("Base.Bullets9mm") should create an InventoryItem instance of Base.Bullets9mm, which should be able to be passed to inv:AddItem

mild venture
#

Yes, it looks like it should work

bronze yoke
#

when you say it doesn't function as expected, can you say what should happen and what is happening?

grim mortar
#

what should happen is that something should be added to the inventory. what is happening, is nothing at all

#

throws no errors, but also does not function

bronze yoke
#

you can see your file in the debugger? it's definitely running?

grim mortar
#

that's what I'm about to sanity check, as I realize. but it was throwing errors at me earlier on execution that I fixed, so I can only assume it still is firing

mild venture
#

you can add print somewhere in function to make sure it's running

grim mortar
#

alright well the script is absolute not running. but why

mild venture
#

I have a theory: ZombRand(100) will never return 100, but only 99. Therefore, the code in condition ran < 100 will not execute. Well, or it's just a very small chance. Random is random

grim mortar
#

ran < 100 covers 0-99 🥲

#

also I added stuff outside conditional scope

mild venture
#

+++

#

Just now I noticed that there is less, not less or equal Spiggo

grim mortar
#

ugggghhhhh AinaFacepalm
I found my error.

#
       >>>>>Do
            zombiedropitem:getInventory():AddItem(item)
            lCount++
        end```
failing to put the 'Do' there causes it to fail silently without throwing an error.  🤡
#

rather it causes the script to just never execute, silently.

mild venture
#

lua...

grim mortar
#

explicit 'do's kill me

#

it's not like there's a competing while-don't loop :o)

#

anyways thank y'all for the rubber duckying, it does function normally now

full mason
#

does anyone know to to stop spawning zombies with bandages, I know it's from erosion but is there a way to disable the bandages while keeping erosion on for everything else?

#

hold up it's not from erosion I read it wrong

#

they just spawn with them, anyone know how to change that?

heady crystal
#

What is it with the empty functions??

#

This is in Vehicles.lua

bronze yoke
#

they are actually referenced in the scripts

heady crystal
#

They are, but do they have some hidden use

bronze yoke
#

no, i think they were just made because they could

bronze yoke
#

it's unnecessary, but it is actually a little convenient for modders since we can hook the empty functions for mod compatibility instead of assigning functions to those things and inevitably being incompatible with every other mod that does that

#

i feel like that probably wasn't their intention with it though

heady crystal
#

I am trying to figure out why can't I make the headlight on my MTB work! It only works when you leave the game and reload at least once, after the bicycle is spawned

#

And I am using the same code TIS has for their headlights

#

Except i'ts not hardcoded

bronze yoke
#

stressed i actually need to do something like that soon, i was hoping it'd be easy

heady crystal
#

The part is there and all it's just the light itself won't work until after a reload

#

I was like "Oh, silly me. I just had to update it like the game does hahah... oh man it doesn't do anything basically. Oh god. OH GOD"

#

So yeah guess uhh. Can't make it work period.

#

I am gonna send prints cause I hate discord's formatting

#

They call this function to create the part, and the light. So far so good.

#

If I do the same, the part is created yes, but light doesn't work

#

So I figure, let's check the init function that's also called immediately after. It's empty.

#

Lastly we got update, was hoping that'd solve it...