#mod_development

1 messages ยท Page 162 of 1

tawdry solar
#

at the smae time

frank elbow
#

I'm not too familiar with modeling, but I believe you can

tawdry solar
#

hm

frank elbow
#

Can you share the item script?

tawdry solar
#

sure

#
module Base
  {

    item Kurki
    {
        MaxRange    =    1.23,
        WeaponSprite    =    Kurki,
        MinAngle    =    0.7,
        Type    =    Weapon,
        SwingSound = MacheteSwing,
        HitFloorSound    =    MacheteHit,
        ImpactSound    =    MacheteHit,
        DoorHitSound = MacheteHit,
        HitSound    =    MacheteHit,
        MinimumSwingTime    =    4,
        KnockBackOnNoDeath    =    FALSE,
        SwingAmountBeforeImpact    =    0.02,
        Categories    =    LongBlade,
        ConditionLowerChanceOneIn    =    25,
        Weight    =    2,    
        SplatNumber    =    2,
        PushBackMod    =    0.3,
        SubCategory    =    Swinging,
        ConditionMax    =    13,
        MaxHitCount    =    2,
        DoorDamage    =    10,
        SwingAnim    =    Bat,
        DisplayName    =    Kurki,
        MinRange    =    0.61,
        SwingTime    =    4,
        KnockdownMod    =    2,
        SplatBloodOnNoDeath    =    TRUE,
        Icon    =    Dudclub,
        TreeDamage  =   10,
        CriticalChance    =    20,
        CritDmgMultiplier = 5,
        MinDamage    =    2,
        MaxDamage    =    3,
        BaseSpeed = 1,
        WeaponLength = 0.3,
        DamageCategory = Slash,
        DamageMakeHole = TRUE,
        AttachmentType = BigBlade,
        Tags = CutPlant,
        DoorHitSound = MacheteHit,
        HitSound = MacheteHit,
        HitFloorSound = MacheteHit,
        BreakSound  =   MacheteBreak,
        SwingSound = MacheteSwing,
     }


        model Kurki
                {
                mesh = weapons/1handed/Kurki,
    
                attachment world
                {
                offset = 0.0000 -0.1660 0.0070,
                        rotate = -180.0000 0.0000 0.0000,
                }
            }
}
frank elbow
#

Where is this file located within your mod?

tawdry solar
#

so that cnat be the issue

#

but

#

/media/scripts

frank elbow
#

Is it in a file with other items, or is that the entire file?

tawdry solar
#

the entire fiel

frank elbow
#

Have you checked console.txt to see whether it says anything about it?

tawdry solar
#

i have#

#

nothing

frank elbow
#

I'm not too sure what could be the issue. Can you send console.txt so I can double check?

tawdry solar
#

alr

#

thats all of ti

frank elbow
#

I'm not seeing anything too weird aside from maybe 8x_scope_ru is not a valid parameter in item: 4x_scope_ru. I doubt it'd be stopping this script from loading

#

Hopefully someone with more experience with items can help you out. My only recommendation is to try excluding some of the values (that is, x = y, value pairs) specified in the item to see whether one of them is preventing it from showing up somehow

tawdry solar
#

ok

thin hornet
#

did you find a solution?

playSoundImpl() -- will only play locally

other playSound methods automatically transmit to other players, look for those with Impl if you want control on who hears it

crimson sequoia
#

What kind of coding knowledge is required to make and edit pz mods?

frank elbow
#

Lua, primarily. You also need knowledge of the game's API, the functions it provides for modders

#

For items, PZ has its own language, sometimes referred to as "ZedScript" (name not official yet)

#

Worth noting: PZ uses Kahlua, which is close to Lua 5.1 but not always exactly the same. Nonetheless, if you want to learn Lua independently of PZ before delving into modding it'd be best to consume information about Lua 5.1

gaunt meteor
#

WorldFlares.launchFlare will other players on MP see worldflares on their client if this is triggered by an item?

undone elbow
thin hornet
# undone elbow I didn't find a real solution yet. It should be 3D sound for all players with th...

Make a networked command to send back a sound event to all players. Then when intercepted on the client you apply a check with the 'mod option'.

Client send command to server about playing a sound (at the same time it plays on it's client)
Server receive the command and send it back to all players.
All client receive the command from the server
Check if it's muted on the client option.
Play it with Impl so that it play on the client only.

undone elbow
#

I'll try. Thanks.

thin hornet
#

and you play the sound with Impl

#

on each client that pass the check

shut stratus
#

Hello guys I wanna ask a couple of modders smth

#

I wanna ask how can you add pictures in the game and you can open them as if you're reading a map for example like the mod "Undead Survivor" where you can look at a picture of a bounty hunter as if you're reading a map

#

like this here

mellow frigate
#

Hi, I tried to use an apng for my workshop preview.png and only the first image is visible. Do you have any idea how I should achieve it ?

mellow frigate
# shut stratus like this here

you add your picture in your MODNAME/whatever folder (e.g. MODNAME/media/ui/MyPic.png) and then from lua you call local mytexture = getTexture('media/ui/MyPic.png'); this will give you a java Texture object

shut stratus
#

can i message you privately tchernobill?

ancient grail
#

Oops didnt nean to reply

#

Suspected ilegal modpacks

bronze yoke
#

i don't think apng is supported on workshop

gilded hawk
#

Did the devs change the BodyLocations recently? So that setHideModel doesn't work on group:getOrCreateLocation("Back")? Cause apparenty, it does not work anymore ๐Ÿ˜ฆ

red tiger
#

I'll be working on applying this to other tools now.

mellow frigate
bronze yoke
gilded hawk
#

Mhhhh odd

#

My old version of the tmog mod, had the ability to had backpacks, and now a year later same code, and the backpack is there

sour island
#

alot of mods change those

#

and it's probably the least mod compatible thing in the lua

#

messed up bodylocations is what breaks tooltips often

mellow frigate
#

e.g. I thought we could add any new body location. Am I wrong ?

sour island
#

the mod UndoMaskExclusion would be a good example

#

the issue is you have to overwrite the file to make it work

#

but if you include old locations or invalid ones

#

if 2 mods touch the file - you could have items pointing to locations that don't exsist

#

I kind of go down a rabbit hole tracking down the tooltip breaking

#

cause it won't say 'hey you have a scuffed up bodylocation' and instead reports anything that touches tooltips are the root of the error

#

which 3-4 of my mods do

mellow frigate
#

So is it the BodyLocation exclusivity system modding that is fragile?

sour island
#

afaik you have to list them in order for layering to work properly

#

and you can add to the list but not remove or insert before/after

#

so people just replace the entire thing

bronze yoke
#

did the idea of reading bodylocations to lua, resetting them and then recreating them with your stuff in the middle go anywhere?

sour island
#

no, I think there's other stuff going on that makes it not really possible

#

it would require an API that people all use

#

it's the setexclusives

#

I think I added this a while back to community projects as an issue to work on

heady crystal
#

Anybody know if it's possible to check if an object is attached to the Player's belt or other similar slots? (Like modded ones)

bronze yoke
heady crystal
#

Thank you! I actually just found it, was about to test

#

Do you know what gets returned if the item is not attached to anything?

bronze yoke
#

seems like slot = -1 slotType = nil

heady crystal
#

Thanks a lot! spiffo โค๏ธ

autumn temple
#

alright time to try to figure out why my ground models arent working... again

primal remnant
#

Does anyone know of a good resource that specifically lists the Java functions that lua has access to?
I'm getting the impression that they don't all work, but that could also be my own inexperience.

bronze yoke
#

private methods can't be called and some classes that are on the reference site aren't actually exposed

#

and in some very specific cases classes are only partially exposed

primal remnant
bronze yoke
#

yup!

primal remnant
#

Damn, haha. I'm afraid my code doesn't work for two reasons now ๐Ÿ™‚

#

More precisely, I get anxiety trying new stuff. Gonna just have to grit my teeth and reset lua ad nauseum.

lone nest
#

its software

#

the only thing that breaks is your sanity

bronze yoke
primal remnant
#

Every time, Albion. You come through

autumn temple
#

so does this look right?

primal remnant
#

@autumn temple File paths look weird to me.

mellow frigate
bronze yoke
#

npcs have been in much older versions of the game

primal remnant
#

@mellow frigate That I can already do, but the issue remains that some are declared as public but... aren't actually.

autumn temple
primal remnant
#

@autumn temple Nearly every mod I've seen with custom models uses WorldItems for textures and meshes in different folders. It may not matter, but that could be the issue.

mellow frigate
#

the exposed classes are described in LuaManager.java

primal remnant
#

@mellow frigate ...by jove... I didn't even realize.

autumn temple
mellow frigate
#

has someone already tried to call setExposed from lua ? ๐Ÿ˜„

autumn temple
#

my mesh is in static/axe

#

like making the actual weapon works perfectly fine having it in weapons/axe

primal remnant
#

You may find better help in the modeling channel.

autumn temple
#

I dont feel like that is appropriate since this is the code end not modeling

bronze yoke
mellow frigate
autumn temple
#

like the ground model doesnt work period, it just applies the weapon model without the scale.

bronze yoke
#

the capitalisation in the script doesn't match the actual filepath

autumn temple
#

that didnt matter for the weapon model though thinkEgg

#

I will change it to see just incase

#

like this is the weapon model, with the caps

bronze yoke
#

i can't remember if they resolved it but that used to cause nonstop issues for linux users so it's probably best to try and keep things consistent anyway

#

i have a feeling they did something to mitigate that but i don't really remember

autumn temple
#

ya that didnt do anything

#

made all the paths lowercase

bronze yoke
#

no closing bracket in the screenshot you sent, is it out of frame or missing?

autumn temple
#

ya cuz its in the middle of a big line of models

autumn temple
bronze yoke
#

i mean the closing bracket for that specific model block

autumn temple
#

It's still the same stuff as the picture I quoted

bronze yoke
#

oh i didn't see that, looks fine

autumn temple
#

things arent fine onmodead

floral dagger
#

Hello, Im trying to do a True Music extension and when I went to upload it to the workshop I got this error

#

I tried finding solutions myself but there is little to no info about this error

#

I tried everything I could and had no luck

fading horizon
#
list_Gasmasks = {
    "HazmatSuit" ,
    "Hat_GasMask",
    "Hat_NBCmask",
    "Hat_GasMask_Improvised",
    "HCImprovisedgasmask",
    "HCImprovisedhazmat",
    "RogueMask",
    "Mask_HECU",
    "Hat_Rebreather",
    "Hat_SwatGasMask",
    "Hat_MCU_GasMask",
    "Hat_M45_GasMask",
    "Hat_FM53",
    "Hat_M50",
    "Hhunk",
    "Mhunk2",
    -- "Mhunk3",
    "Hat_PoliceM17",
    "Hat_M17",
    "Hat_M40",
    "Hat_M17Doff",
    "Hat_M40Doff",
    "StalkerMask",
    "MysteriousHazmat",
    "m45gasmask",
    "PrepperMask",
    "Hat_MSA_Gas_Mask",
    "GP5GasMask",
    "Russian_Mask_GP5",
}```
#
function isGasMask(player)
    local inventory = player:getInventory()    
    local it = inventory:getItems()        
    if player and inventory then
        for i = 0, it:size()-1 do
            local item = it:get(i)
            if player:isEquippedClothing(item) then
                if item:hasTag("GasMask") or item:hasTag("HazmatSuit")  then return true end
                local iType = item:getType()
                local gas = iType:contains("Gas") or iType:contains("gas") or iType:contains("GAS") or nil
                local mask = iType:contains("Mask") or iType:contains("mask") or iType:contains("MASK") or nil
                local gasmask = (gas and mask) or nil
                if iType:contains("HazmatSuit") then gasmask = true end
                if gasmask then
                    if debug_Fog then
                        -- print("Protected From Fog")
                    end
                    return true
                end            
                for i = 1, #list_Gasmasks do
                    if list_Gasmasks[i] == iType then
                        if debug_Fog then
                            -- print("Protected From Fog")
                        end
                        return true
                    end
                end    
            end
        end
    end
    return false
end
#

if i'm reading this correctly, then all I would need to do is add the tag "gasMask to an item in order for it to protect the player from this mod's toxic fog, right?

#

if item:hasTag("GasMask") or item:hasTag("HazmatSuit") then return true end

#

due to this line

woeful relic
novel swallow
#

What's the best event for when the player loads in? Like both from a fresh spawn, a loaded save, joining multiplayer, etc?

fading horizon
#

I think my osrs weapons mod is ready finally

#

should be dropping later today

novel swallow
#
playerObj:getModData().mGuvCustomLootTable[item:getFullType()] = mGuvLootHighlighter.Rarity.Common.Name; -- this is just a string
print("length: ".. #playerObj:getModData().mGuvCustomLootTable);

Why does this print 0 D:

#

I guess arrays and tables are different?

fast galleon
#

Kahlua has table.isempty(t) if you just want to know if it's empty or not. If you want to loop, use for k,v in pairs(t) do --[[ ... ]] end

autumn temple
ancient grail
#

I made a new tile animation they are supposed to be light source how do i turn them on so that they glow

#

Imean as they spawn
And hopefuly mp compat

white pivot
#

Hello everyone, i'm implementing a lot of things in the mod Advanced_trajectory. I made it much more difficult to aim Zs. It's already handling every player mood that could influence precision, recoil is also implemented. And right now, i'm trying to make the mouse cursor handling the Z axis that i could get rid of any auto aim system. However, on top of that, i would like to make it fully compatible with ARSENAL 26's mighty work. Si if any of you see him around, let him know i'm trying to contact him, to discuss about all that. Many thanks

thin hornet
ancient grail
#

Ye thats local

#

Need im looking for send command thats vanilla
Like when you switch on a light bulb or something

thin hornet
#

You probably need to get the players on the client and apply the same light localy based on some conditions.

#

instead of networking light on/off everytime the effect apply

white pivot
#

can i re-use this code for muzzle flash plz ?

ancient grail
#

Theres a muzzle flash

#

Code wait ill give you

#

Also you can use that konijima posted
Thats vanilla

#
getPlayer():startMuzzleFlash()
#

here you go

white pivot
#

cheers m8

#

โค๏ธ

ancient grail
ancient grail
#

figured out a work around

woeful relic
autumn temple
#

I didnt delete the mod files from the workshop folder, and they were overwriting any changes I tried to do with the files in my mod folder

#

so nothing was wrong to begin with it just refused to apply any of my changes because of my own stupidity

fast galleon
#

Is there a way to get a value of a field inherited from a superclass for debug purposes? example: bStarted of an LuaTimedActionNew

sour island
#

I made a field viewer for debug tools

#

but I think it doesn't have that capability yet

#
    local numClassFields = getNumClassFields(obj)
    for i = 0, numClassFields - 1 do
        ---@type Field
        local javaField = getClassField(obj, i)
        if javaField then
            local value = javaField:get(obj)
            local valueAsText = tostring(value)
#

I also need to work on making that sort the values

#

it's a nightmare to look for something

fast galleon
#

a filter would be nice

sour island
#

yeah meant to say filter, just woke up lol

#

that and the option to modify values are planned

sour island
#

Does anyone know if there's a way to check if a particular child of an ui element is a specific type?

#

nvm my test with .Type did actually work

thin hornet
#

For anyone who uses pzstudio i released an update with a more optimized watch process.
You can update using npm i -g pzstudio

quasi kernel
#

How possible do y'all think it would be to get two-way radios to pick up stuff from True Music like the boom boxes and the like.

#

I'm admittedly a bit worried since if memory serves correctly a lot of the radio stuff is on Java, and I wouldn't be surprised if a lot of the audio stuff was too.

thin hornet
primal remnant
#

True Music is a mod, right? Have you taken a look at that?

bronze yoke
#

probably annoying

quasi kernel
#

True Music doesn't cooperate with radios to my knowledge, I want to see if I can get the radios to "pick up" nearby boom boxes so players can set up little music stations.

bronze yoke
#

the biggest limitation is that a sound can't start halfway through

#

so it will be desynchronised in most cases

quasi kernel
#

Is it possible to adjust the volume of a sound halfway through?

#

If so I know a workaround, otherwise pleh

primal remnant
#

And "two ways" are only chat based right? There's no ingame voip that Im aware of.

bronze yoke
#

yeah, but do you really want to play every track on every station muted at all times?

#

it still wouldn't work for late joiners but that's not as huge

quasi kernel
#

Hm..

#

I mean, it's something that could be interesting to tamper with either way I think.

primal remnant
#

You have to consider the resource cost. Are you willing to sacrifice performance for a desynced audio when you can literally just carry around a CD player?

#

Who would use a two way radio for playing music?

quasi kernel
bronze yoke
#

i've already got something similar about ready to release, the only part that differs that i wouldn't know about is actually getting the transmitter to understand that there is music playing

thin hornet
#

Project Zomboid Studio [Dev Thread]

quasi kernel
#

That way you can turn the music on/off easily, don't have to worry about distance calc for volume or some stuff like that, and it wouldn't be as expensive.

bronze yoke
#

yeah, i guess that wouldn't differ too much from what i've been working on

quasi kernel
#

I see

bronze yoke
#

so i imagine that's possible

quasi kernel
#

Cuz if someone can just hook a cassette system into a HAM or something and just get it to play directly, that solves a lot of problems.

bronze yoke
#

i wonder how the client/server relationship would look for that

quasi kernel
#

Then when you change frequencies or something it can just.. cut the music.

bronze yoke
#

not sure if much of that can run from the server or not

#

and if it runs from the clients that brings complexity too

quasi kernel
#

Blehh

#

Would be something interesting to tamper with, but perhaps for another time.

flat bluff
#

Nevermind ๐Ÿ˜„

fast galleon
mellow frigate
#

It seems I have no access to java getSuperclass method from lua. where can I find the PZ kahlua limitations ?

fast galleon
#

Class is not exposed, getSuperClass doesn't seem to be either.

#

I thought maybe being able to use the field from a different object of the expected class, but I couldn't make a new BaseAction and stopped.

lone nest
#

well, this is fun - finding out the number of lines in a mod.

#

maybe i'm in over my head on this one.

upper wave
#

i went above 1k lines in code this semester, for the first time lmao

#

for a project

#

also, what mod is that?

#

i can definitely imagine going to the 10k-20k lines for a full on mod in PZ

lone nest
upper wave
#

oh. yeah

#

that looks complex asf

#

there are much simpler mods you can make

#

esp if starting out

lone nest
#

But I want npcs today.

#

and I'm gonna make it happen.

ancient grail
#

You can do this!

upper wave
#

you can eventually make it happen for sure

#

no matter where you're starting

zinc pilot
#

how do you handle a require for a .lua inside another folder?

ancient grail
#

Folder/lua

bronze yoke
#

require paths aren't relative or anything

zinc pilot
zinc pilot
#

ty\

sour island
#

For example:
test.lua

require "OptionScreens/MainScreen.lua" --.lua is optional
```Can exist sitting in the client folder.
Or it can exist in the `OptionScreens/extrastuff/` directory.
zinc pilot
#

I was referring to something like this:
client/someOtherFolder/someFile.lua

sour island
#

you don't include the client bit afaik

bronze yoke
#

with the client/shared/server folders there's some limitations on what you can require from where, not sure if it's based on load order or something

zinc pilot
sour island
#

Yeah sorry, just sat down and didn't read enough context. ๐Ÿ‘ my bad

#

afaik it goes back to the connections and host thing

fast galleon
sour island
#

hosts only run server/shared lua

#

clients run all 3

#

but certain events only run on the server

#

and some systems are on both but only used by clients

#

they need to just collapse the whole thing

#

it's from the old MP

#

A good example is my shops - I have it so the type for items is saved as a string, but you can also sell by category - which is also saved as the untranslated version.

#

BetterSorting's ItemTweaker is client/ so it breaks my shops code lol

#

Cause it tries to compare client scripts that have been changed to server's which have not.

pseudo jetty
#

how do I make the player walk to a location before my timed action

thin hornet
#

you would add an action to walk there

#
if luautils.walkAdj(player, metalDrum:getSquare()) then
     ISTimedActionQueue.add(ISPutOutFireDrum:new(player, metalDrum))
end
#

luautils.walkAdj does that for you if i recall

#
function luautils.walkAdj(playerObj, square, keepActions)
    if not keepActions then
        ISTimedActionQueue.clear(playerObj);
    end
--    if not AdjacentFreeTileFinder.isTileOrAdjacent(playerObj:getCurrentSquare(), square) then
        -- Avoid walking to already near spot
        square = luautils.getCorrectSquareForWall(playerObj, square);
        local diffX = math.abs(square:getX() + 0.5 - playerObj:getX());
        local diffY = math.abs(square:getY() + 0.5 - playerObj:getY());
        if diffX <= 1.6 and diffY <= 1.6 then
            return true;
        end
        local adjacent = AdjacentFreeTileFinder.Find(square, playerObj);
        if adjacent ~= nil then
            ISTimedActionQueue.add(ISWalkToTimedAction:new(playerObj, adjacent));
            return true;
        else
            return  false;
        end
--    else
--        return true;
--    end
end
pseudo jetty
#

thank you

#

exactly what I needed

#

follow up for anyone who searches this: there is a door specific function too: luautils.walkAdjWindowOrDoor

mellow frigate
#

Hi, where should I look to disconnect a player or refuse a player's connection ?

ancient grail
#
getCore():quitToDesktop()
#

thers also one for main menu

#

i think you can find it on the main menu lua

#

@mellow frigate

mellow frigate
#

Yeah sorry, I am looking for the server side handling of the connection request.

#

@ancient grail and thanx ๐Ÿ™‚

barren kraken
#

beginner modder here, how difficult would it be to have a roll/tuck-in feature similar to shark and peaches mod?

pseudo jetty
#

how do I force the player to stay in a timed action?

ancient grail
#

Prevent them from stopping it by preventing them to move maybe

#

This is just a guess tho
There might be some other ways

mellow frigate
ancient grail
#

You might jave a bugged action if you prevent it from being cancelled?

pseudo jetty
#

I don't think you can exit climbing through windows action

#

maybe there is something else other than a timed action idk

mellow frigate
#

Enforced Animation are handles by java states objects.

#

That said, I did exactly that (enforce a timed action) in Prisonner mod, despite the fact timed actions are not made for this, because I found nothing better.

#

I have to warn you it was a nightmare.

#

Maybe an animation woudl be more suitable in your case

#

but I do not know much about those

pseudo jetty
#

ok, thank you

#

I might take a look at your mod then
or try out animations, only way I know how to play them right now is through timed actions

bronze yoke
#

you can just hook isdoingactionthatcanbecancelled(? something like that)

red tiger
#

We now have typings for EmmyLua that forwards the parameter names of the official JavaDocs.

stone garden
#

im looking for an comission that is affordable that i can afford and is cheap for an brazillian like 30 reais i think , or 20 reais

split orchid
#

Hey guys? What mod that make character talk like when they see zombies and characters talks?

pseudo jetty
red tiger
#

He's also building an environment that installs it.

#

My apologies.

crystal oar
#

I'm sorry, this is my first time making a mod that mods another mod, if I require a mod to be installed, that goes in the mod.info right? is that all i have to do to make it a prereq?

thin hornet
mellow frigate
#

also think of adding the required item in steam workshop

crystal oar
#

ah okay so there's a second step if i want the nice link to the required item on the mod's page?

thin hornet
#

that one is on steam

crystal oar
#

okay i think i'm good to go (ahead and fail making this mod lol)

thin hornet
crystal oar
#

thanks a bunch

split orchid
#

Hmmm. So far, all my mods are on and no red errors

fading horizon
fading horizon
#

tyty

red tiger
#

Honestly AI stuff should have a separate channel.

#

Spent 10 hours coding today on Candle and my PZ JavaDocs scraper projects.

#

Felt like bliss. Was a genuine high and the best to have.

#

Coding mods for PZ is getting easier for everyone each day. =]

floral dagger
#

Hello, Im trying to do a True Music extension and when I went to upload it to the workshop I got this error
I tried finding solutions myself but there is little to no info about this error

#

I tried it multiple times, also updating said mod is the same error: "result=2"

#

(The item IDs may wary because I took screenshot at different retries)

#

also this is how it looks on my workshop page after like third retry (always trying to change something):

mellow frigate
floral dagger
#

Thats weird.

#

Its a pity there is absolutely nothing about this error anywhere.

#

I found like two threads about it

mellow frigate
#
floral dagger
#

Yeah I saw this one

floral dagger
mellow frigate
#

It happened twice. Once for the initial upload and I do not remember. the other time for an existing, in that case I did not change the ID.

floral dagger
#

thats weird.

#

Well I have no idea how to fix it, Ill keep trying hopefully it works magically :D

mellow frigate
#

wait 12 h

lone nest
#

Please, can someone explain how to use ModData? and GlobalModData?
Assuming ModData saves to disk, where can it be found?
Lastly, is there a limit to what data can be saved/loaded from ModData?

floral dagger
fast galleon
viscid drum
#

is there a list of loot distributions somewhere?

lone nest
#

thanks

fast galleon
viscid drum
#

ty

#

thats what I was looking for ๐Ÿ™‚

floral dagger
#

I realised that I have multiple steam accounts with family share on. So i just hopped on my alt and made the mod there

#

Its done!

pseudo jetty
#

can I cause a player to trip through lua?

fast galleon
#

fall: yes
pathfind: yes
visions: yes with drug mod

mellow frigate
pseudo jetty
#

thanks lol

#

weird question: I saved a door in my timed action at the start, is there a way I can check if it still exists by the time perform is run?

mellow frigate
pseudo jetty
#

good point, I didn't think about that thank you

glass basalt
#

it is a late night, I can't sleep, yet I don't want to complete my mod ๐Ÿ˜”

glass basalt
#

I've taken too long of a break, stuff needs to get done

#

I've decided to make a few more changes and I'll chill out until next time

fast galleon
pseudo jetty
#

thank you mr

fast galleon
#

Maybe the best way to do this is by adding the object only for the time the player is climbing.

bronze yoke
# lone nest Please, can someone explain how to use ``ModData``? ~~and ``GlobalModData``~~? A...
  1. to use object mod data, call object:getModData(), this returns a normal lua table. to use global mod data use the ModData static, ModData.getOrCreate("key") is most commonly used - that returns a lua table too
    there's a reference sheet made by mrbounty(?) to the ModData methods, i think it's linked on the wiki
  2. object mod data saves along with the object, global mod data saves with the world, neither are human readable
  3. only standard types, no functions or objects
oak cipher
#

Anyone here who can modder that can handle tiles - i have a mod commission inquiry

fading horizon
#

@ancient grail

bronze yoke
#

typo on the third line

#

mew instead of new

#

also local vehicle = destContainer:getVehiclePart():getVehicle() isn't going to play nice when the container isn't a vehicle because getVehiclePart will return nil

marsh sparrow
#

so i added a drink (pretty much a beer reskin) but im having an issue with the spawning. i tried adding it to the procedural tables of proceduraldistributions.lua but now nothing spawns ingame (i would like to send the code but dunno how u guys do it)

neon bronze
#

3 of those -> ` followed by lua then paste your code inside

marsh sparrow
#
ProceduralDistributions = {};

ProceduralDistributions.list = {

    BakeryKitchenFridge = {
        rolls = 1,
        items = {
            "BibliSCC.ScreamerCreamer", 10,
        },
    },

}
--
--    all = clothingStores;
--
--    clothesstore = clothingStores;


--table.insert(ProceduralDistributions.list, distributionTable);

--for mod compat:
--ProceduralDistributions = distributionTable;```
#

dang it

bronze yoke
#

close it with three more after the code

marsh sparrow
#

yep got it now i think

bronze yoke
#

you're redefining the entire ProceduralDistributions table

marsh sparrow
#

ahhhh

#

do i have to change ProceduralDistributions.list to BibliSCC.ProceduralDistributions.list ?

bronze yoke
#

you can either table.insert your items into the vanilla one or do it like this but with a different name and then table.insert it into whatever the table for distribution merge is (not at my pc right now)

marsh sparrow
#

hm okay i will probably do it the first way thx for da help

sour island
#

Assuming you know enough about distros to point to intended adresses:

function addItemToDistro(distroAddress, itemType, spawnChance)
   table.insert(distroAddress, itemType)
   table.insert(distroAddress, spawnChance)
end
#

In this case address is ProceduralDistributions.list.BakeryKitchenFridge.items

#

people usually spam table inserts for this purpose

marsh sparrow
#

i infact do not know enough bout distros but imma look it up now that u brought it up

#
table.insert(ProceduralDistributions.list, distributionTable);

ProceduralDistributions.list = {

    BakeryKitchenFridge = {
        rolls = 1,
        items = {
            "BibliSCC.ScreamerCreamer", 10,
        },
    },
#

this how i have it atm have not tried it out yet

flat bluff
#

Can we define more than one value for an item parameter? For example the ammo type a magazine can accept?
AmmoType = Base.Bullets9mm is the standard, is it possible to add another ammo type to this ?

bronze yoke
#

probably not

#

some parameters do accept multiple (usually separated by semicolons) but the vast majority don't

#

as a rule i'd say if vanilla doesn't use it it doesn't exist

flat bluff
#

Roger that. Thanks a lot Albion ^^

novel swallow
#

Is there a way to tell what Occupation a character took from the IsoPlayer object?

bronze yoke
#

player:getDescriptor():getProfession()

neon bronze
flat bluff
neon bronze
#

it accepts them but you have to mess around with the inserting/ejection timed actions to make it so that it will give back the correct ammo

neon bronze
flat bluff
#

Really? And how would you do that? I've tried defining multiples, separated with blank spaces, semicolons and colons but nothing worked. Then tried a table and the game literally freaked out

neon bronze
#

use "/"

#

thats it

#
AmmoType = Base.Baseball/Base.ElectronicsScrap/Base.UnusableMetal/Base.Basketball/Base.Bell/Base.CatToy/Base.ChessBlack/Base.ChessWhite/Base.Crayons/Base.DogChew/Base.GolfBall/Base.KnittingNeedles/Base.ScrapMetal/Base.SoccerBall/Base.ToyCar/Base.Stone/Base.SharpedStone/Base.Bricktoys/Base.Wire/```
flat bluff
#

wow. Thanks! I'll start messing around tonight.

#

holy moly!

neon bronze
#

thats for one of my shelved mods

flat bluff
#

Thanks a log Haram Gaming. Later tonight ill try and let you know. Gotta go now though IRL stuff. Thanks again!

neon bronze
#

good luck

crystal oar
#

so i am having trouble getting this recipe right, i put Destroy farming.BroccoliBagSeed/farming.CabbageBagSeed/farming.CarrotBagSeed/farming.PotatoBagSeed/farming.RedRadishBagSeed/farming.StrewberrieBagSeed/farming.TomatoBagSeed, but the broccoli seed packet doesn't work. i have like triple checked the spelling but i must be doing something wrong since no matter what i do the broccoli seed packet won't show up in the recipe

neon bronze
#

i think its destroy not Destroy

#

might be wrong

crystal oar
#

you are right, i wonder if that's the issue

#

might have thought Destroy was part of the item identifier

#

that sure did fix it, thanks!

bronze yoke
#

it was looking for the Destroy farming module panic

crystal oar
#

must... destroy... farming!

novel swallow
#

What's the event for a new player spawned, i.e. the first time they connect/make a new character? Is that the OnGameStart one? Or was it OnNewGame?

bronze yoke
#

onnewgame

pseudo jetty
#

is there a way to detect if a door opens towards or away from a player?

fast galleon
#

Good question, do they all open in one direction? So you can compare player x/y vs that of the door?

pseudo jetty
mellow frigate
#

yes getVehiclePart() comparison with nil is the way

nimble spoke
bronze yoke
pseudo jetty
#

I'm trying to unequip an item for my action and then re reequip it after, I found ISUnequipAction, but I'm wondering if it is safe to save the item before it is unequip, and then use that to re-equip. I know that some items (like the candle) switch themselves for a new item when unequip, how can I make sure I have the right one?

icy dome
thin hornet
#

if its not exposed then you cant

icy dome
bronze yoke
#

same restrictions apply

thin hornet
#

so far only isValidUserName is exposed

icy dome
#

so there's no way I could access it?

thin hornet
#

from what i see, no

#

what are you trying to do tho?

icy dome
thin hornet
#

i dont think username should be changed

#

you could change the player display name tho setDisplayName

#

but not sure if that do anything

icy dome
#

hm ok thank you

crystal oar
#

If i want a recipe to output multiple things, do i make multiple Result: lines or if it all goes on the one line, what is the syntax for multiple outputs? like if i want a recipe to give an empty container back in addition to the main result

thin hornet
#

look into: ProjectZomboid\media\lua\server\recipecode.lua

ancient grail
#

desynced! anyone knows how i can fix it. my bayonet mod project replaces the shove animation with spear stab but on the other character its not showing it. but for the other its visible.. iahave no idea why

#

but its not 100% at the time that its desynced

crystal oar
thin hornet
#
    recipe Open Sack of Apples
    {
        SackProduce_Apple,

        Result:Apple=12,
        OnCreate:Recipe.OnCreate.OpenSackProduce,
        OnGiveXP:Recipe.OnGiveXP.None,
        Sound:PutItemInBag,
        Time:15.0,
        AllowRottenItem:true,
    }
crystal oar
#

thanks, that makes more sense now that i'm looking at it all together

pseudo jetty
#

I'm trying to play my animation in game but it's all fucked up, wrongs bones are moving (maybe in wrong way). I used the IK template, don't know if that made it difference. Any ideas?

#

might have just found my issue

#

I added some lines from t he stop drop and roll mod and it works now

wind jetty
#

Is there a way to show a PNG file in-game? I tried the "Map" attribute of the item but it doesn't seem to work

nimble spoke
#

If you mean opening a window to display it

thin hornet
#

anyone got experience with adding custom vehicle parts (especially template)

barren kraken
#

coming soon-ish probably maybe

nimble spoke
thin hornet
#

Im trying to add new parts to existing (if every) vehicles, so far i can create the template for the part, but not quite sure if there is a way to extend existing vehicle without "rewritting" the txt file

nimble spoke
#

I tried that at some point with my vehicle tweaker api and it didn't go very well, but it could be more that I didn't understand it 100% back then

#

I'd say more people tried it by now but I never checked

#

by logic alone there must be a way to do it correctly though

bronze yoke
#

the simplest way is to create your parts as a vehicle template and then use Load on the script object for the vehicle to add that template

nimble spoke
bronze yoke
#

i worked with it at length and everything seemed to work properly

nimble spoke
#

Good to know it can and has been done

thin hornet
#

@bronze yoke @nimble spoke you have a public repo with example ?

#

Edit based on @bronze yoke response:

--- file: shared/my-mod/vehicle-part-loader.lua
local scriptManager = getScriptManager()
local vehicleScripts = scriptManager:getAllVehicleScripts()

local partTemplates = {
    "SomeNewPart",
}

for i=0, vehicleScripts:size()-1 do
    ---@type VehicleScript
    local vehicleScript = vehicleScripts:get(i)
    local name = vehicleScript:getName()

    for _, template in ipairs(partTemplates) do
        print("Adding '" .. template .. "' to '" .. name .. "'")
        vehicleScript:Load(name, "{template=" .. template .. ",}")
    end
end

This works, just need to figure a bug when right clicking the item in the UI

bronze yoke
#

ScriptManager.instance:getVehicle("CarNormal"):Load("CarNormal", "{template=CarNormal_Upgrades,}")

thin hornet
#

oh damn

delicate widget
#

what is the difference between the Mods and WorkshopItems field in the server.ini? Why do I need to fill out both when adding a workshop item?

bronze yoke
#

workshopitems tells the server what steam workshop items to download, mods tells the game which mods that it has downloaded to activate

delicate widget
#

interesting... why would you want the server to download workshop items but not have them active as mods

sour island
#

multiple sub-mods can be present in the workshop content folder

bronze yoke
#

one workshop item often has multiple mods in it, usually for optional content

#

sometimes the options are even mutually exclusive

delicate widget
#

gotcha that make sense

languid kestrel
spice saddle
ancient grail
#

Spotted

frank elbow
drifting ore
barren kraken
#

aswell as turkish aegean

barren kraken
#

2nd showcase image

drifting ore
#

keep up the great work

trim mist
#

Finally got the chance to look at this! Thank you for looking for this! Lots of this stuff I didn't see in the documentation. Last thing i'd want to ask you-- why not make it global? how would other modders be able to use this in that case?

fast galleon
#
local zedList = getCell():getZombieList()

Can I cache this and will it have all the Zombies on the server? Any cases where it would not work?

fast galleon
#

Host Client GameTime instance has default start dates stressed

warm pawn
#

Helpful, thanks

frank elbow
#

TraitTags.lua:


local module = {}

function module.add(x, y)
  -- ...
end

-- ...

return module

elsewhere: local TraitTags = require 'TraitTags'

marsh sparrow
#
<animNode>
    <m_Name>1HDefault</m_Name>
    <m_AnimName>Bob_Attack1Hand01_Hit</m_AnimName>
    <m_Priority>4</m_Priority>
    <m_deferredBoneAxis>Y</m_deferredBoneAxis>
    <m_Looped>false</m_Looped>
    <m_EarlyTransitionOut>true</m_EarlyTransitionOut>
    <m_SpeedScale>CombatSpeed</m_SpeedScale>
    <m_BlendTime>0.15</m_BlendTime>
    <m_BlendOutTime>0.25</m_BlendOutTime>
    <m_Scalar>AttackVariationX</m_Scalar>
    <m_Scalar2>AttackVariationY</m_Scalar2>
...
#

what does speed scale do in this context ? i tried changing it to high numbers and so on but seemingly no change ingame

mellow frigate
#

Anyone knows how is supposed to be created CGlobalObjectSystem.instance ? Alternatively Is there any mod that implements successfuly a new GlobalObjectSystem ?

frank elbow
#

client/Farming/CFarmingSystem.lua implements it I believe

fast galleon
#

true, search for derives

CGlobalObjectSystem:derive("...")
#

The instance is made by the main system btw on the global object init event. Sorry typing on mobile.

marsh sparrow
#

would i have the same effect if i just replaced combatspeed with a number or do i have to change the combatspeed variable?

nimble spoke
marsh sparrow
#

im not sure but is it impossible to edit xml files through modding ? (i want to edit 2HDefault.xml in media/AnimSets/player/melee/2handed)

#

nvm im dumb forgot to activate it

drifting ore
#

Guys i need a little favour

#

I need to know the letter font for this

#

Im making a goofy mod for some friends and i dont know what font does the bat uses

novel swallow
#

all I can tell you is it's a sans-serif font

#

which is basically all modern fonts outside of book print, so uh... good luck!

sly seal
#

Has anyone made a mod, or found the data for lowering the hunger times?
I believe that peckish and the likes start appearing at 80 or so?
I'd like to be able to have 50 be your nutruel state, below that is peckish, hungry etc, and above 50 up to stuffed.

turbid gale
#

in debug mode does the generate loot UI just... not work?

bronze yoke
#

wdym? it works fine for me

turbid gale
#

whenever I run it I get a break as if it errored and nothing appears in the UI

#

no actual error beyond that

bronze yoke
#

oh, i was thinking of lootzed - never looked too much at this menu before

#

it must be old or something, it calls the itempicker with the wrong arguments

turbid gale
#

probably tool that TIS didn't update to B41 then

#

you mentioned lootzed: is this a tool that'll help testing of spawns ingame?

bronze yoke
#

yeah, it's in the cheats menu

#

it lets you reroll spawns in a container

#

and it shows the spawn chances for that container too

hot patrol
#

Could someone help me figure out what is causing my mod to spam the server console with this. as far as I can tell nothing is breaking in game. ```LOG : General , 1684718687635> 321,434,541> -----------------------------------------
STACK TRACE

function: dakiBuffEffect -- file: dakiActions.lua line # 39 | MOD: Big Degen's Dakimakura Emporium

ERROR: General , 1684718687635> 321,434,542> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getDescriptor of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1684718687635> 321,434,542> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: getDescriptor of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:641)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1812)
at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66)
at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139)
at zombie.Lua.Event.trigger(Event.java:64)
at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:65)
at zombie.GameTime.update(GameTime.java:671)
at zombie.gameStates.IngameState.UpdateStuff(IngameState.java:566)
at zombie.gameStates.IngameState.updateInternal(IngameState.java:1623)
at zombie.gameStates.IngameState.update(IngameState.java:1333)
at zombie.network.GameServer.main(GameServer.java:903)
LOG : General , 1684718687636> 321,434,542> -----------------------------------------
STACK TRACE

function: dakiBuffEffect -- file: dakiActions.lua line # 39 | MOD: Big Degen's Dakimakura Emporium

#

line 39 is just this if not player:getDescriptor():getProfession() == "Weeb" then return end

bronze yoke
#

player is null

hot patrol
#
    
    local item = nil
    local player = getPlayer()

    --just type the Profession on the "" and remove the -- on the left side of the line below
    if not player:getDescriptor():getProfession() == "Weeb" then return end


    -- just type the trait on the "" and remove the -- on the left side of the line below
    --if not player:HasTrait("") then return end

    --check if servers  SleepAllowed is on
    --[[if getServerOptions():getBoolean("SleepAllowed") then
        -- somewhat counters sleepless traits effect by adding more fatigue but only uptil 0.8
        if player and (player:HasTrait("NightOwl") or player:HasTrait("NeedsLessSleep") or player:HasTrait("Insomniac")) and player:getStats():getFatigue() <= 0.8 then
            player:getStats():setFatigue(player:getStats():getFatigue() + 0.01)
        end
        --  same as above but without the limit
        if player:HasTrait("NeedsMoreSleep") then
            player:getStats():setFatigue(player:getStats():getFatigue() + 0.01)
        end
    end]]
    
    --player:getModData()['BuffEffect'] = "daki not found" -- for testing
    if player:getInventory():getFirstEvalRecurse(function(item)            
            return item:hasTag("DakiWeapon") or item:hasTag("DakiArmorFront") or item:hasTag("DakiArmorBack")
        end) then
        --player:getModData()['BuffEffect'] = "daki found" -- for testing
        local bodyDamage = player:getBodyDamage()
        local stats = player:getStats()

        bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() - (bodyDamage:getUnhappynessLevel() / 4))
        if bodyDamage:getUnhappynessLevel() < 0 then
            bodyDamage:setUnhappynessLevel(0);
        end
        if player:isAsleep() then
            stats:setStress(stats:getStress() - (stats:getStress() / 4))
            if stats:getStress() < 0 then
                stats:setStress(0);
            end
        end
        -- else  player:getModData()['BuffEffect'] = "something might be wrong" -- for testing
    end
    --player:Say(player:getModData()['BuffEffect']) -- for testing
end

Events.EveryTenMinutes.Add(dakiBuffEffect)```
bronze yoke
#

when is this function being called? seems to be being called before the player is created

hot patrol
#

that sounds about right. I'm not the one who made the code. It's supposed to look for players with the preffesion set and give them a buff when they have an item.

bronze yoke
#

is the function attached to an event or something?

hot patrol
#

yes

#

my b that was wrong

#

the last bit was som,ething else

#

the one above was everything

drifting ore
hot patrol
bronze yoke
#

hmm that seems odd, i wouldn't think everytenminutes fires before character creation

white pivot
#

i would do "if not player then return end" after getPlayer but idk

mellow frigate
hot patrol
#

the if not player is already after getplayer

neon bronze
#

You are just checking if the player doesnt have a description and not if the player exists

hot patrol
hot patrol
neon bronze
hot patrol
flat bluff
neon bronze
hot patrol
#

alright. I will try that. thanks for the help. ๐Ÿ™‚

pulsar stag
#

Rookie question: Is there a "spawn on the ground" equivalent of the function player:getInventory():AddItem ?
Thinking about making some tweaks to hydrocraft on our MP server and one of the things is getting items that are created from mining to spawn on the ground instead of inventory, but idk if that's even a function in PZ

neon bronze
#

Get the square and then addWorldInventoryItem there

pulsar stag
neon bronze
#

Depends on the square

#

For player it would be player:getSquare()

#

But itโ€™ll give you the exact square the player stands on

pulsar stag
#

Well that makes the most sense to me since the player will always be standing in a square adjacent to the crafting station and it makes sense to drop at your feet there

#

Tyty

ancient grail
#

Nice goodjob mx

#

Post it here bud

gilded hawk
#

๐Ÿ‘

turbid gale
mellow frigate
mellow frigate
#

thx

marsh sparrow
#

can i edit bodydamage.java (ProjectZomboid/zombie/characters/BodyDamage/BodyDamage.java), for example add something like JustDrankBooze (JustTookBlaBla), with a mod ?

neon bronze
#

You can do that with lua

marsh sparrow
#

so in the mod folder instead or rather addtitionally to the media folder i would just add the zombie/.../BodyDamage.java folder and it would override the original ?

#

or do i need a specific file and function to change the .java file ?

kind hornet
#

I am trying to import a mod, and change the weight of an item. However, it appears to keep the weight of the import from Base.

Any idea how I am able to override this?

mellow frigate
#

Change java code will require a lot of stuff and manual operations that are not supposed to be part of mods.

marsh sparrow
#

to give context i wanna make a stimulant that increases combatspeed, and right now adding a new moodle specifically for the effect seems the best way. and to add a moodle i would have to edit zombie.characters.Moodles...

#

other than that im stumped on how to change combatspeed

crimson sequoia
#

How many hours it take from no knowledge of lua to proficient PZ modding ability?

marsh sparrow
#

editing java through lua i dont know how, if thats possible enlighten me pls

crimson sequoia
#

I am thinking of learning as a new hobby

marsh sparrow
#

depends if u have prior coding knowledge

crimson sequoia
mellow frigate
marsh sparrow
#

@mellow frigate ohh good stuff

#

@crimson sequoia im just starting out and as you can see, lookin at other mods is a big help

ancient grail
#

You can output multiple file types

marsh sparrow
#

@mellow frigate goddamn dude im lookin at fightmechanism and jeez thats allota code and its extremely underrated imo, it makes combat much more fun incredible work ngl

mellow frigate
marsh sparrow
#

still awesome G

heady crystal
gilded hawk
#

Thank you โค๏ธ

fading horizon
kind hornet
#

Sorry if this question has been beaten to death.

I was wondering if generator range was hard-coded?

I'm attempting to develop a mod that "overclocks" generators at a cost of more fuel. However I cannot seem to find the code that deals with that part.

Please @ me if you have any information.

Thank you.

kind hornet
#

Thank you Albion. I appreciate the quick response.

ancient grail
#

uhhh does

Events.LoadGridsquare

only load the square once
and we have to use

Events.ReuseGridsquare

if we want it to read the square again?

#

im thinking of doing animated tiles

#

any thoughts if it would work?

faint jewel
#

animated tiles was already done.

lone nest
#

since it will attempt to load things on ALL squares within a chunked space

ancient grail
lone nest
#

I have no idea how big the chunk is, but in a quick test, a function was called over 6,000 times with Events.LoadGridsquare

ancient grail
lone nest
#

๐Ÿค”

#

theoretically, you can try Events.OnRenderTick because it's calling on every frame rendered.

#

but i'm unsure how often you're trying to render something

#

for a rough idea, my own experience with onRenderTick was anywhere between 40 - 100+ calls per second.

ancient grail
#

Ontick and onplayerupdate is fine
Id rather use player update if im going to result to using that instead of gridload

Or maybe the event that gets triggered when you switch rooms?

sour island
#

@lone nest are you still working on Superb survivors?

#

In case you were considering

#

Not sure where the latest branch is

#

Also, @ancient grail Load grid square happens every time the square is loaded

#

So walking in and out of loading range

lone nest
#

also figured the issue with EHE, one of the context menu windows was messing with it

#

removing that context menu stopped breaking EHE.

drifting ore
#

Does anyone know where the code for adding new recipes when you reach a certain skill threshold is located?

fast galleon
drifting ore
#

It is an event- as it is included in the fancy pants event def thing made by Albion

#

I don't think that is what I'm looking for, since it's the more general gain or loss of a skill. I'm looking for one which only fires if a specific skill pops off-

fast galleon
fading horizon
#

Has anyone made a helicopter mod here before?

hoary widget
fading horizon
#

i know it's been made

#

i should have worded it better

#

i'm trying to speak with someone who has made a helicopter mod

fading horizon
bronze yoke
#

loadgridsquare fires every time the square loads

ancient grail
marsh sparrow
#
player:setVariable("CombatSpeed",player:calculateCombatspeed()*5)
``` @mellow frigate how did you find out that you can modifie combatspeed like this, like with player:..., were you able to deduce that from the source code of the game or did you just try out and see if it worked ?+
trim mist
#

Can anyone tell me exactly how I'm being silly here?

#

My best guess is that I'm not accessing the value of the table i'm making correctly?

bronze yoke
#

can you show sanitizeTags?

#

oh sorry

#

i was looking at the wrong line ๐Ÿ˜…

#

TraitTags[traitName] will be null unless you've defined it somewhere

#

table.insert(TraitTags, traitName) is adding a string "traitName" to the table, whereas i think what you're trying to do with it is add a new table with the key "traitName"

#

TraitTags[traitName] = TraitTags[traitName] or {} will ensure the existence of a table with that key

stiff wraith
#

Hi guys, new to PZ modding here. Quick question: How to use the .class files in Lua scripts . I am using the following reference site: https://projectzomboid.com/modding/zombie/ui/UITextBox2

Currently doing this, but the events are not documented for ISTextEntryBox (at least I cannot find it)

require "ISUI/ISTextEntryBox"
local SKOTextField = ISTextEntryBox:derive("SKOTextField")
#

Is it possible to use the UITextBox2 class?

ancient grail
#

I belive those are the java files which are protected

#

Im not reslly fsmilsr with all the termibilogy But this example is more like sn object i think rather than a class

Idk someone else should answer

stiff wraith
#

I am trying to implement the onChange or onTextChange event, but this does not seem to work. Also, I want to limit the text field to only accept numbers (digits) and limit it to 1 char. The methods as described in the reference page for PZ modding cannot be used with ISTextEntryBox. If someone can provide me some examples or maybe a documentation link that would be great!

neon bronze
#

Textentrybox can be set to only accept numbers but you need to initialise it first

stiff wraith
#

Is there a doc-reference for ISTextEntryBox?

neon bronze
#

I dont think there is any youd have to looo through vanilla code

barren kraken
#

sleeve rolling/pant tucking for mod

stiff wraith
#

@neon bronze Doing this after init, but does not seem to work: Don't see what the issue is. Any way to see the exception message within the game. I only see messages in the Command Console for now.

    local instance = ISTextEntryBox:new("", x, y, 10, 20)
    instance.font = UIFont.Large
    instance:initialise()
    instance:setOnlyNumbers(true)
    return instance
end```
#

Might be the setOnlyNumbers does not exist like that.

neon bronze
#

instance:addToUIManager()

#

But i would first make a panel for the entrybox

stiff wraith
#

I have that outside the function already.

neon bronze
#

Ah ok

stiff wraith
#

Let me double check

neon bronze
#

You can add the entrybox as a child to the panel and then add the panel to the ui manager

stiff wraith
#

Doing that already, but the issue with the function it cannot find I guess. I will try to find some docs and examples for this ๐Ÿ™‚

neon bronze
#

Ill ping you later with what i did i made a custom ui some months ago aswell

mellow frigate
bronze yoke
#

that website only documents java classes

stiff wraith
#

Found the issue. You need to use the methods after adding it to a parent UI element. It does not work before that.

bronze yoke
#

you can just read the source from your media/lua/ folder

mellow frigate
#

Hi everyone, is there a way to get a floor ItemContainer from a gridsquare that maybe does not already have items on it ?

stiff wraith
#

Yes, thx albion, will try ๐Ÿ˜„

mellow frigate
#

I wanna drop items and my blind use of the drop function seems to be buggy in AutoMechanics

neon bronze
#

Why not just add items to the square?

mellow frigate
bronze yoke
#

is calling square:AddWorldInventoryItem no good?

neon bronze
#

You could get the player and its square and then add the items

mellow frigate
neon bronze
#

How do you add the items?

mellow frigate
#
    if invItem and player and player:getInventory():contains(invItem) then
        local square = player:getCurrentSquare()
        local playerInv = player:getInventory();
        invItem:getContainer():setDrawDirty(true);
        invItem:setJobDelta(0.0);
        local dropX,dropY,dropZ = ISInventoryTransferAction.GetDropItemOffset(player, square, invItem)--some random position around the player
        square:AddWorldInventoryItem(invItem, dropX,dropY,dropZ);
        playerInv:Remove(invItem);
        ISInventoryPage.renderDirty = true
        ISInventoryPage.dirtyUI();--set inventory dirty to force loot window recomputation: FAILED
    end
end```
neon bronze
#

Oh yea you both add and transfer the item to the floor

#

Either add and remove the item or just transfer it

#

But i doubt transferijg it would work so just add/remove

mellow frigate
#

square:AddWorldInventoryItem adds but where is the transfer ?

neon bronze
#

Ok nvm i misread i just saw the ISInventoryTransferAction and thought you would call it

bronze yoke
#

i think you might need to remove the item from the inventory before adding it to the ground

neon bronze
#

Or call DoRemoveItem on the player inventory

#

I heard there is some discrepancies between different calls

bronze yoke
#

it probably nulls the item's parent when you remove it

#

yeah it does

#

so if you move it to the ground before removing it it's going to glitch the item

#

hmm actually doesn't seem like addworldinventoryitem actually changes the item's container reference actually it does

#

so it might not be related

neon bronze
bronze yoke
#

items usually stay the same object

#

in this case the item on the floor is actually a separate object with references to the actual InventoryItem

neon bronze
#

So its just a pointer that lies on the floor?

bronze yoke
#

kinda, yeah

neon bronze
#

That is kinda smart, instead of making a whole new object just point to the existing one

#

But you can also add items with ItemFactory so eh

stiff wraith
#

I see in the ISTextEntryBox.lua the following. It seems that self.javaObject is the class that has all the function I need. Is this something I can use in my derived instances? I am trying to get some response for onPressUp but it does not do anything in this code.

bronze yoke
#

you should be able to, but in this case definitely don't

#

the java onPressUp method calls the lua onPressUp, so this is recursive and will crash your game

stiff wraith
#

How would you define the onPressUp to print a text for example? I just want to register that even but seems not to fire at all.

bronze yoke
#

it should be enough to just have the print

neon bronze
#

do you have anything that can be pressed?

stiff wraith
#

This an event for KeyPressUp right?

neon bronze
#

im pretty sure its for when you leftclick on the text field and when you release it it will trigger OnPressUp

stiff wraith
#

Ah ๐Ÿ˜† Might be. I need to detect a specifik key pressed up.

#

lile Enter

bronze yoke
#

yeah it's for mouse

neon bronze
#
local panel = ISPanel:new(self:getX() + width/4, self:getY() + height/2 - height/8, width/2, height/4);
local sell = ISUIVMTextBox:new(desc, 10, 50, 
                            panel.width - 20, 20, item, false, self.data.player:getInventory(), self.data.vmInventory, panel)
                        sell:initialise()
                        sell:instantiate()
                        sell.data.listbox = listbox2
                        sell.data.listbox2 = listbox
                        sell.data.player = self.data.player
                        sell:setOnlyNumbers(true)
                        panel:addChild(sell)
                        panel:addToUIManager()
                        panel:bringToTop()

thats for my custom textentrybox which is just the vanilla one but i renamed it internally

#

ignore the selfs

bronze yoke
#

i think when i was documenting the events i came across a bunch for keyboard input but i would hope that ui already has some handling for it

neon bronze
#

i dont know if the OnPressUp in the textEntryBox is the same as the lua event

bronze yoke
#

it's not strictly an event but i don't want to complicate things for someone who's new

neon bronze
#

yea i know that i just dont know if they both have the same trigger

bronze yoke
#

they do and don't, the ui stuff takes priority over the events, so if you click on a ui element the events for clicking won't be fired and it calls the lua functions for that ui element instead

neon bronze
#

ah that explains the typing without walking

fast galleon
neon bronze
#

Everytime i learn more and more about pz it feels like its more and more ducttaped together

bronze yoke
#

i think the keyboard events always fire, you don't walk because walking isn't using lua events anyway

#

unless the game is told to eat specific key presses but it almost never does that

stiff wraith
#

haha, lot of games are ducttaped drunk

#

thx guys, will try some stuff later

trim mist
#

Struggling with lua tables again

#

I'm trying to get the count of a tag used, and giving it back in a sorted way is giving me an aneurysm.

function TraitTags:getTagsStatistics()
    local tempTable = {};
    local sortTable = {};
    local returnTable = {};

    --get
    for trait, tagTable in pairs(TraitTags)
    do
        if type(tagTable) == "table"
        then
            for _, tag in ipairs(tagTable)
            do
                if tempTable[tag] ~= nil
                then
                    tempTable[tag] = tempTable[tag] + 1;
                else
                    tempTable[tag] = 1
                end
            end
        end
    end

    --sort
    for key, value in pairs(tempTable) do
        table.insert(sortTable, {tag = key, count = value})
    end
    table.sort(sortTable, function(a, b) return a.count > b.count end);
    table.sort(sortTable);

    --condense
    for _, entry in ipairs(sortTable) do
        returnTable[entry.tag] = entry.count;
    end

    return returnTable;
end

The sortTable looks... sort of correct:

#

but when condensed into simple key-value pairs in returnTable, I get this

#

(struggling to get a picture right now but it looks exactly the same as tempTable)

#

So how can I get returnTable to look like
"Anthro", 104
"Human", 84
"Carnivore", 2
"KeenVision",2
etc?

bronze yoke
#

you can't because string keys are not ordered in any consistent way

#

the {count = , value = } thing you're doing is the best way to emulate that behaviour

trim mist
#

wait, really? Not even by order of insertion?

bronze yoke
#

the way tables are implemented probably ends up effectively sorting them in some manner but they aren't guaranteed or intended to stay in a certain order

trim mist
#

๐Ÿ˜

#

Fair enough I guess. It makes more sense why I was struggling now

#
    for i = 1, getn(sortTable)
    do
        returnString = returnString..sortTable[i].tag..": "..sortTable[i].count.."; "
    end

    return returnString;

I'll just return a string instead I guess. It's just for looking at and debugging, not for any real code use

lone nest
#

do sandbox options for a mod need to be "refreshed" if it the mod in question is updated?

#

For reference, this is what it looks like in-game

#

I've added "NPCGroupsSpawnsSize" but it does not appear in-game

#

The associated EN text file

mellow frigate
#

also remember what you see in your "client" game includes the default mods sandbox options, not the server mods sandbox options

lone nest
#

Ughh... then I need to know how to clear the server mods... Hmm..

mellow frigate
#

it really depends on your setup

lone nest
#

I've been running the mod locally and exclusively

#

which is why i'm a bit confused on how the sandbox options is stuck on the older version

mellow frigate
#

then go to Host and change the settings > mods of your server

#

remember your server must be stopped during that operation

lone nest
#

funny part is i never launched a server, so there are no settings?

#

Hm...

mellow frigate
#

click manage settings

#

then click edit selected settings

lone nest
#

never had any settings to begin with though?

mellow frigate
#

when you start the server with no settings, it creates a setting (all default)

lone nest
#

funny when i tried to create new settings, it is still missing the group size spawn option

mellow frigate
#

show your settings mod list

#

you may expect that your settings sandbox options are related to the server settings mod list. but it is related to your default mod list instead.

lone nest
#

Yeahi 'm gonna try a hard reset

mellow frigate
#

won't change

#

show your settings mod list

lone nest
# mellow frigate show your settings mod list

i'm a tad confused since this is my first time working with sandbox options;
do you mean the sandbox options file and the associated translation?
-OR-
the in-game menu for sandbox?

mellow frigate
lone nest
#

I had no local server; I created one just now with the servertest setting

mellow frigate
#

how did you show a list of mods sandbox options from the game if you've never selected the mods ?

lone nest
#

as i said, i was running locally exclusively, straight from the solo sandbox

#

i didn't use the host server settigns

mellow frigate
#

sorry, I went very far in a wrong direction.

#

so you want to control sandbox options for a solo game

lone nest
#

yes

mellow frigate
#

how do you select the mods in the solo game ?

lone nest
#

Scrolled down to my mod

#

Solo --> Custom Sandbox

mellow frigate
mellow frigate
#

That's strange, it looks like what Dislaik did.

stiff wraith
#

Another question from my side ๐Ÿ˜„ Starting to get there, thx to your help so far!

I have 2 mods on my local device. Not yet on Steam. One is a library I would like to use in other mods. See it as a shared library of common stuff I would like to use. When I want them locally to be both loaded, I've selected them in the Mods menu and both are loading. How do I reference the library mod and use the stuff from there?

My Core-Library mod has the following in the file SKOCoreLib.lua

require "ISUI/ISTextEntryBox"

local SKOCoreLib = {}

SKOCoreLib.TextField = ISTextEntryBox:derive("SKOCoreLibTextField")

function SKOCoreLib.TextField:new(x, y)
    local instance = ISTextEntryBox:new("", x, y, 23, 23)
    instance.font = UIFont.Massive

    instance:initialise()

    return instance
end

return SKOCoreLib

The other mod tries to load it in like this:

local SKOCoreLib = require("SKOCoreLib")

if (SKOCoreLib == nil) then
    error("SKOCoreLib is nil")
end

Do I need to provide another path for the require call? The mod id is SKOCoreLib which I have on my local device only.

mellow frigate
#

in your mod.info of the client mod, add the line require=SKOCoreLib

#

once you have uploaded both on steam, add the lib as required item to the client mod (there is a button for that)

stiff wraith
#

local SKOCoreLib = require("SKOCoreLib") is correct in this case?

mellow frigate
#

require statement means that the symbols of the current file require some symbol from the required FILE

#

SKOCoreLib.lua must be a valid file for the statement to be valid

stiff wraith
#

Works! Thx. I had this (based on another documentation):

require = {
    mods = {
        "SKOCoreLib"
    }
}
#

require=SKOCoreLib works!

mellow frigate
#

to clarify, require statement in mod.info declares a mod dependency while require statement in a lua file declares a lua file dependency

stiff wraith
#

I know, but the last require in the mod.info was not correct. requie in lua is sort of import like in typescript etc.

#

Thx for your help!

hot patrol
#

I asked for help yesterday with an error I have been getting reports on with one of my mods and the help I recieved seems to have worked but now people are reporting a new one. anybody know 2what this means or how I might be able to fix it? ````SEVERE: Error found in LUA file: D:/Steam/steamapps/workshop/content/108600/2756636139/mods/Big Degen's Dakimakura Emporium/media/lua/server/dakiActions.lua
ERROR: General , 1684826052384> ExceptionLogger.logException> Exception thrown se.krka.kahlua.vm.KahluaException: dakiActions.lua:39: function arguments expected near == at LexState.lexerror line:278.
ERROR: General , 1684826052384> DebugLogStream.printException> Stack trace:
se.krka.kahlua.vm.KahluaException: dakiActions.lua:39: function arguments expected near ==
at org.luaj.kahluafork.compiler.LexState.lexerror(LexState.java:278)
at org.luaj.kahluafork.compiler.LexState.syntaxerror(LexState.java:289)
at org.luaj.kahluafork.compiler.LexState.funcargs(LexState.java:1075)
at org.luaj.kahluafork.compiler.LexState.primaryexp(LexState.java:1149)
at org.luaj.kahluafork.compiler.LexState.simpleexp(LexState.java:1211)
at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1303)
at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1312)
at org.luaj.kahluafork.compiler.LexState.expr(LexState.java:1321)
at org.luaj.kahluafork.compiler.LexState.prefixexp(LexState.java:1107)
at org.luaj.kahluafork.compiler.LexState.primaryexp(LexState.java:1130)
at org.luaj.kahluafork.compiler.LexState.simpleexp(LexState.java:1211)
at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1303)
at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1300)
at org.luaj.kahluafork.compiler.LexState.expr(LexState.java:1321)
at org.luaj.kahluafork.compiler.LexState.cond(LexState.java:1424)
at org.luaj.kahluafork.compiler.LexState.test_then_block(LexState.java:1597)
at org.luaj.kahluafork.compiler.LexState.ifstat(LexState.java:1610)
at org.luaj.kahluafork.compiler.LexState.statement(LexState.java:1736)
at org.luaj.kahluafork.compiler.LexState.chunk(LexState.java:1790)
at org.luaj.kahluafork.compiler.LexState.body(LexState.java:1026)
at org.luaj.kahluafork.compiler.LexState.localfunc(LexState.java:1635)
at org.luaj.kahluafork.compiler.LexState.statement(LexState.java:1764)
at org.luaj.kahluafork.compiler.LexState.chunk(LexState.java:1790)
at org.luaj.kahluafork.compiler.LexState.compile(LexState.java:198)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:132)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:124)
at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:546)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:510)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:496)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:342)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:264)
at zombie.gameStates.GameLoadingState.enter(GameLoadingState.java:97)
at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:145)
at zombie.GameWindow.logic(GameWindow.java:298)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:765)
at zombie.GameWindow.run_ez(GameWindow.java:667)
at zombie.GameWindow.mainThread(GameWindow.java:495)
at java.base/java.lang.Thread.run(Unknown Source)

lone nest
mellow frigate
hot patrol
# mellow frigate the mod Big Degen's Dakimakura Emporium has a semantic error in dakiActions.lua ...

I am the mod owner. The last issue lied with line 39 as well. I had chaned it to what was sugggested and it seemed to fix the spamming error I was getting but it only replaced it with this new one. I'm not really great with this :p Here is what line 39 used to be and what it is now. if not player:getDescriptor():getProfession() == "Weeb" then return end if not (player and player:getDescriptor():getProfession == "Weeb") then return end

mellow frigate
#
        return
end```
#

you have to test your mods after each change before uploading them or you will have infinite complaints.

hot patrol
#

Thanks I will try that. And yea, I know. I need to get better at that.

mellow frigate
#

initial problem was probably that player is not always valid so you have to check for nil before using it. second problem was syntax error.

mellow frigate
hoary widget
#

Is it possible to have clothing make you run faster? I tried messing with the running/combat speed stat but im not really sure

drifting ore
#

Hey,can i ask something that can seem basic af?

hoary widget
hoary widget
knotty zealot
#

Hello,

I'm working on a mod and I would like get the SandboxOptions ZombieLore mortality value.
However, as I can see in the Javadoc, the Lore field has no getter, so how can I get it ?

javadoc link : https://zomboid-javadoc.com/41.78/zombie/SandboxOptions.html#Lore

I'm sorry if this is a dumb question, I'm completely new to Lua and Zomboid modding...

hot patrol
# mellow frigate ```if not (player and player:getDescriptor() and player:getDescriptor():getProfe...

ok so i tested this one and still seem to be getting an error. ````se.krka.kahlua.vm.KahluaException: dakiActions.lua:39: function arguments expected near ==
at org.luaj.kahluafork.compiler.LexState.lexerror(LexState.java:278)
at org.luaj.kahluafork.compiler.LexState.syntaxerror(LexState.java:289)
at org.luaj.kahluafork.compiler.LexState.funcargs(LexState.java:1075)
at org.luaj.kahluafork.compiler.LexState.primaryexp(LexState.java:1149)
at org.luaj.kahluafork.compiler.LexState.simpleexp(LexState.java:1211)
at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1303)
at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1312)
at org.luaj.kahluafork.compiler.LexState.expr(LexState.java:1321)
at org.luaj.kahluafork.compiler.LexState.prefixexp(LexState.java:1107)
at org.luaj.kahluafork.compiler.LexState.primaryexp(LexState.java:1130)
at org.luaj.kahluafork.compiler.LexState.simpleexp(LexState.java:1211)
at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1303)
at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1300)
at org.luaj.kahluafork.compiler.LexState.expr(LexState.java:1321)
at org.luaj.kahluafork.compiler.LexState.cond(LexState.java:1424)
at org.luaj.kahluafork.compiler.LexState.test_then_block(LexState.java:1597)
at org.luaj.kahluafork.compiler.LexState.ifstat(LexState.java:1610)
at org.luaj.kahluafork.compiler.LexState.statement(LexState.java:1736)
at org.luaj.kahluafork.compiler.LexState.chunk(LexState.java:1790)
at org.luaj.kahluafork.compiler.LexState.body(LexState.java:1026)
at org.luaj.kahluafork.compiler.LexState.localfunc(LexState.java:1635)
at org.luaj.kahluafork.compiler.LexState.statement(LexState.java:1764)
at org.luaj.kahluafork.compiler.LexState.chunk(LexState.java:1790)
at org.luaj.kahluafork.compiler.LexState.compile(LexState.java:198)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:132)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:124)
at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:546)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:510)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:496)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:342)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:264)
at zombie.gameStates.GameLoadingState.enter(GameLoadingState.java:97)
at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:145)
at zombie.GameWindow.logic(GameWindow.java:298)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:765)
at zombie.GameWindow.run_ez(GameWindow.java:681)
at zombie.GameWindow.mainThread(GameWindow.java:495)
at java.base/java.lang.Thread.run(Unknown Source)

#

๐Ÿ˜…

drifting ore
mellow frigate
drifting ore
#

The size is 720x527

knotty zealot
#

@drifting ore if you want to, you can display file extensions in your file explorer by clicking "view" then checking "file name extensions", that might help you later
should give you something like this

drifting ore
#

ohhhh,thanks

mellow frigate
knotty zealot
#

oh

mellow frigate
knotty zealot
mellow frigate
knotty zealot
#

ok thanks a lot, i'll take a lot at this

storm flame
#

Hey, anyone know how to tell if the zombie can see the player? Tried this somewhat hacky solution for lack of finding something better, but it didn't end up working.

function Legend.zombie_canSeeTarget(zombie, target)
    local prev_target = zombie:getTarget();
    zombie:setTarget(target);
    if zombie:isTargetVisible() then
        zombie:setTarget(prev_target);
        return true;
    end
    zombie:setTarget(prev_target);
    return false;
end

(Forgive me for my naming convention sins)

mellow frigate
storm flame
#

Beautiful! Thank you!

autumn iris
#

Hi!
I'm trying to make a small mod that allows the player to make Logs and Twigs into wood chips to put in the compost. Something strange is happening though. If I spawn in the Wood Chips using the debug log they work as intended. They start out as Stale and go Rotten soon after. When I create them through the recipe, they never go stale or rot and they don't stack with the debug items. Has anyone experienced this or know what I might be doing wrong?

fading horizon
#

i just uploaded the backpack flags mod for those who were following. Hope y'all enjoy! โค๏ธ

mellow frigate
# hot patrol Like so?

you have to split the logic like print ('Player = '..tostring(player or 'nil')) if player then local descriptor = player:getDescriptor() print ('Player getDescriptor = '..tostring(descriptor or 'nil')) if descriptor then local profession = descriptor:getProfession() print ('Player getProfession = '..tostring(profession or 'nil')) if profession then local professionIsWeeb = profession == "Weeb" print ('Player isWeeb = '..tostring(professionIsWeeb and 'true' or 'false')) if not professionIsWeeb then return end else return end else return end else return end

hot patrol
#

ah, so I was way off, lol

hot patrol
mellow frigate
#

in %username%/Zomboid/console.txt just above the error

hot patrol
# mellow frigate in %username%/Zomboid/console.txt just above the error

I don't think it worked. this is all that I can find pertaining to the error Dakimakura Emporium/media/lua/server/dakiActions.lua May 23, 2023 6:54:53 PM zombie.Lua.LuaManager RunLuaInternal SEVERE: Error found in LUA file: H:/SteamLibrary/steamapps/workshop/content/108600/2756636139/mods/Big Degen's Dakimakura Emporium/media/lua/server/dakiActions.lua ERROR: General , 1684882493357> ExceptionLogger.logException> Exception thrown se.krka.kahlua.vm.KahluaException: dakiActions.lua:39: function arguments expected near `==` at LexState.lexerror line:278. ERROR: General , 1684882493357> DebugLogStream.printException> Stack trace: se.krka.kahlua.vm.KahluaException: dakiActions.lua:39: function arguments expected near `==` at org.luaj.kahluafork.compiler.LexState.lexerror(LexState.java:278) at org.luaj.kahluafork.compiler.LexState.syntaxerror(LexState.java:289) at org.luaj.kahluafork.compiler.LexState.funcargs(LexState.java:1075) at org.luaj.kahluafork.compiler.LexState.primaryexp(LexState.java:1149) at org.luaj.kahluafork.compiler.LexState.simpleexp(LexState.java:1211) at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1303) at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1312) at org.luaj.kahluafork.compiler.LexState.expr(LexState.java:1321) at org.luaj.kahluafork.compiler.LexState.prefixexp(LexState.java:1107) at org.luaj.kahluafork.compiler.LexState.primaryexp(LexState.java:1130) at org.luaj.kahluafork.compiler.LexState.simpleexp(LexState.java:1211) at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1303) at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1300) at org.luaj.kahluafork.compiler.LexState.expr(LexState.java:1321) at org.luaj.kahluafork.compiler.LexState.cond(LexState.java:1424) at org.luaj.kahluafork.compiler.LexState.test_then_block(LexState.java:1597) at org.luaj.kahluafork.compiler.LexState.ifstat(LexState.java:1610) at org.luaj.kahluafork.compiler.LexState.statement(LexState.java:1736) at org.luaj.kahluafork.compiler.LexState.chunk(LexState.java:1790) at org.luaj.kahluafork.compiler.LexState.body(LexState.java:1026) at org.luaj.kahluafork.compiler.LexState.localfunc(LexState.java:1635) at org.luaj.kahluafork.compiler.LexState.statement(LexState.java:1764) at org.luaj.kahluafork.compiler.LexState.chunk(LexState.java:1790) at org.luaj.kahluafork.compiler.LexState.compile(LexState.java:198) at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:132) at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:124) at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:546) at zombie.Lua.LuaManager.RunLua(LuaManager.java:510) at zombie.Lua.LuaManager.RunLua(LuaManager.java:496) at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:342) at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:264) at zombie.gameStates.GameLoadingState.enter(GameLoadingState.java:97) at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:145) at zombie.GameWindow.logic(GameWindow.java:298) at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71) at zombie.GameWindow.frameStep(GameWindow.java:765) at zombie.GameWindow.run_ez(GameWindow.java:681) at zombie.GameWindow.mainThread(GameWindow.java:495) at java.base/java.lang.Thread.run(Unknown Source)

#

wait I think I know why

#

Is this how it should look? When I copy and pasted it from you message it didn't line up correctly.

mellow frigate
#

I do not understand what is the difference ?

hot patrol
#

Well I fixed it there that's why i am asking if it looks right. Before when I had pasted it it was all wrong looking.

mellow frigate
#

what is the difference ?

#

what fix did you do ?

hot patrol
#

this is how it looks when I just copy and paste it

mellow frigate
#

that's because you paste with some blank chars before. anyway lua is not blank sensitive

#

and there is no '==' on line 39. you are running a different file than the one you modify

sour island
red tiger
#

My EmmyLua typings are now fully pulling info from PZ's official JavaDocs.

#
--- @public
--- @static
---
---  Almost Unit Identity This is a near-identiy function that maps the unit
---  into itself. It is the cousin of smoothstep(), in that it maps 0 to 0, 1 to 1,
---  has a 0 derivative at the origin, just like smoothstep. However, instead of
---  a 0 derivative at 1, it has a derivative of 1 at that point. It's equivalent to
---  Almost Identiy above with n=0 and m=1. Since it's a cubic just like
---  it is very fast to evaluate.
---
--- @param x float value in [0..1]
--- @return float value in [0..1]
function PZMath.almostUnitIdentity(x) end

An example snippet from the codebase.

#

@tame mulch

#

Letting ya know there's a replacement for Capsid now.

hot patrol
red tiger
hot patrol
sour island
#

around (player:getDescriptor():getProfession() == "Weeb")

hot patrol
sour island
hot patrol
#

ah. aPES_LulLaugh

sour island
#

my guess was that the code was being read as (not player:getDescriptor():getProfession()) == "weeb"

#

which doesn't really make sense

#

you can use () to make your code more legible too

hot patrol
#

Shrug idk I didn't write it I'm just trying to get it to work.

mellow frigate
hot patrol
#

I have. I even relaunched the game just now and same error

#

let me unsub from the mod

#

that might be it

#

the game says it isn't using that version but idk

mellow frigate
#

the error tells you exactly where the file is and that there is "==" line 39. you should check that file.

hot patrol
#

ok so it was because I was still subbed on the workshop it seems. I'm not getting any error when I use this. print ('Player = '..tostring(player or 'nil')) if player then local descriptor = player:getDescriptor() print ('Player getDescriptor = '..tostring(descriptor or 'nil')) if descriptor then local profession = descriptor:getProfession() print ('Player getProfession = '..tostring(profession or 'nil')) if profession then local professionIsWeeb = profession == "Weeb" print ('Player isWeeb = '..tostring(professionIsWeeb and 'true' or 'false')) if not professionIsWeeb then return end else return end else return end else return end

#

so I guess i should just upload it as is then?

mellow frigate
#

you should test the mod, not just verify there is no error.

#

and remove the print they kill performances

hot patrol
thorn bane
#

Just a quick question; is there a way to render a straight line?

hot patrol
#

as far as I can tell it all works. but that's odd considering isn't this just what I was already using just broken up?

heady crystal
#

Does anyone know if it's possible to create recipes through LUA code instead of using a txt file?

#

Items too

mellow frigate
thorn bane
#

Maybe a better question to ask is if I can raycast in the game world, dunno if that's possible

mellow frigate
#

there are functions to convert from screen-relative to world relative.

#

but you need to have your UI refreshed at the rate of the world (it's an option that reduces performances) or it will be ugly

#

and the UI is always superimposed on the world (no masking)

trim mist
#

anyone have any idea why this loop doesn't even run?

#
function TraitTags:getPlayerTraitTags(player)
    local playerTraits = player:getTraits();
    local concatenatedTags = "";
    local returnString = "";
    if playerTraits ~= nil
    then
        for _, trait in ipairs(playerTraits)
        do
            print(_..", "..trait);
            if TraitTags[trait] ~= nil
            then
                concatenatedTags = table.concat(TraitTags[trait], ',');
                returnString = returnString..concatenatedTags..concatenatedTags;
            end
        end
    end
    return returnString;
end
mellow frigate
quasi kernel
#

How possible do y'all figure it'd be to recreate the hunger games in PZ?

quasi kernel
#

Oo!

pseudo jetty
#

any ideas how to get the frame number?

mellow frigate
#

press 'k'

#

for the frame speed

pseudo jetty
#

I meant in code

#

but I used getTimestampMs()

#

actually doesn't work so well

trim mist
pseudo jetty
#

BTW anyone know how to get an update event for all floor items

#

or can I get a list of the floor items nearby somehow

trim mist
mellow frigate
mellow frigate
# trim mist Seems like getTraits() doesn't return a table? I'm confused--how are you suppose...

getTraits returns a TraitCollection, you need to read decompiled PZ. Current version is available somewhere on the wiki. I prefer to get a local version. latter here https://steamcommunity.com/sharedfiles/filedetails/?id=2748451514

This step by step guide should make it easy to access java code and therefore increase your modding capability and speed....

pseudo jetty
#

thank you

#

is there a event called when an item is loaded?

mellow frigate
pseudo jetty
#

do I have to decompile for that?

mellow frigate
#

yes, or check the online version

#

e.g. OnFillContainer is called when items are spawned in a container. I do not know if that includes all items spawns or not.

pseudo jetty
#

thank you, I think it is only for when items are created from a loot distribution or something, I'm trying to get all items when you load the world. I'm trying OnMngInvItems

robust briar
#

So I see on TraitFactory.Trait there is an isFree check. Any idea how I can make a trait free?

#

I am using ProfessionFramework and added a trait with zero cost... but I do not see it in the list.

#

Ohhh I think thats only for traits applied from professions.. looks like there is no way to allow the player to choose a trait for free

neon bronze
#

anyone knows what the palettes parameter does for items?

marsh sparrow
#

quick question does resetting lua suffice or do i have to restart zomboid completely to update mod changes ?

novel swallow
#

though note depending on what you were doing and if/when any errors happen - that method isn't always the best as some stuff gets left in a partial state

marsh sparrow
#

okay good to know thx

frosty estuary
#

Where I can find the Bump Types that I can set to a damage, and the effects it cause ?

autumn temple
#

so I am trying to add this vhs tape to the loot table for the livingroomshelf. the game tells me that it is in the loot table at like 98% spawn chance. but after 5 minutes of rerolling the shelfs loot it hasnt spawned. so I dont think its working thinkEgg

novel swallow
#

Are you definitely on the right sub type of container? LootZed can be confusing for that.

autumn temple
novel swallow
#

and I assume you've spawned the item manually to make sure it's in the game at all?

autumn temple
#

ya i can spawn it manually

novel swallow
#

Oh LivingRoomShelf only has one D:

#

I thought they were like KitchenCupboards

autumn temple
#

the item works fine, I can attach the recorded_media to it and play it on a TV

novel swallow
#

Hmm, your Type is different to the rest and includes the Base prefix

#

but I don't think that's causing problems as it got the Name right

autumn temple
novel swallow
#

Yeah, my bad - I thought that shelf had multiple for some reason

autumn temple
#

the base prefix shouldnt really effect anything

#

because the other items I have spawn just fine even with the prefix

neon bronze
#

How is your tape defined?

autumn temple
#

this is the rest of the item

neon bronze
#

Whats the module the item is defined in?

autumn temple
#

Base

neon bronze
#

How many rolls does the container has?

autumn temple
#

the container im using to test just has the 1 loot table, the LivingRoomShelf

neon bronze
#

Well yes but it also has defined how often the game will roll for items to spawn in ProceduralDistrobutions

autumn temple
#

oh I set it to 100 so it has a high chance to appear

neon bronze
#

So it rolls 100 times for items?

autumn temple
#

maybe im thinking of the wrong thing

neon bronze
#

I think you are how does proceduraldistrobutions look?

autumn temple
#

this is all I have in ProceduralDistributions

#

for that item atleast

neon bronze
#

Can you find the entries for LivingRoomShelf in ProceduralDistributions.lua?

autumn temple
#

4 rolls

neon bronze
#

Maybe instead of Base.Vhs_Avp just VHS_Avp

ancient grail
autumn temple
neon bronze
#

Did you reload and everything?

autumn temple
#

Yes I did

ancient grail
#

Spam it till it does
If its on the list it should spawn

autumn temple
#

Mhm I've been spam force rolling an item with 97% on the lootzed like 50 times and not a single spawn

neon bronze
#

You could atleast for now make a new table with just your item in it and insert it there

#

See if its just awful rng or something else is wrong

bronze yoke
#

when is the item being added to the tables? is it attached to an event?

#

iirc if you change the loot tables after item picker has parsed them lootzed will show the values from the lua tables even though they aren't actually being used by the item picker

knotty zealot
#

Hello, does anyone know of an Event that fires whenever a zombie hits the player, and if possible has parameters for the type of damage (scratch, laceration, bite) the zombie just did ?
I looked at PZEventsStubs but couldn't seem to find one.

neon bronze
#

In my experience you dont need to put it in event in my mod the items would just spawn

autumn temple
#

Ya, this VHS tape isn't the only item in this mod. And the other items spawn perfectly fine using the same ProceduralDistributions

neon bronze
#

Look maybe in the list structure? Thats the only thing that comes to my mind why it wouldnโ€™t work

marsh sparrow
#

is there an event that takes place when consuming food ?

#

context: i want to check if a food item has a certain tag

bronze yoke
#

you can hook the ISEatFoodAction

#

no event

mellow frigate
red tiger
#

Good morning.

marsh sparrow
#

oh damn hooking is a complete new concept have to look it up thx

red tiger
#

So do EmmyLua users typically write their mods in Intellij IDEA?

bronze yoke
#

i think vscode and its respective lua plugin is more commonly used

red tiger
#

I'll need to write down simple instructions on setting up a environment for Candle & Umbrella.

#

Going to do it on my lunch.

mellow frigate
quartz badge
#

where is repair chance stuff stored?

marsh sparrow
#

questions in comments ```lua
local orgISEatFoodAction = ISEatFoodAction:stop();

function ISEatFoodAction:stop() --does this check after consuming food ?
if not item.hasTag("Stimulant")do
ISEatFoodAction:stop() = orgISEatFoodAction --compatibility with other mods/game update
elseif item.hasTag("Stimulant") do --Initiates "stimulant" effect
JustConsumedStimulant = 100 --or ISEatFoodAction:item.getTag(Stimulant) ???
end
end
--ISEatFoodAction:perform() gonna do the same as in function ISEatFoodAction:stop()

Event:EveryOneMinute --Is the syntax right? does this mean the function runs every ingame minute?
function StimulantReaction()
if JustConsumedStimulant > 0 do
moodleValue(Stimulated) = moodleValue(Stimulated) + 0.1;--moodleValue inc aslong as stimulant is active
if moodleValue(Stimulated) > ... do --if the value goes ((above))/below a certain value
player:setVariable("CombatSpeed",player:calculateCombatSpeed()(moodleValue(Stimulated)+1)); --Increase of CombatS according to stimulant amount
elseif moodleValue(Stimulated) < ... do --if the value goes above/((below)) a certain value
player:setVariable("CombatSpeed",player:calculateCombatSpeed()
(moodleValue(Stimulated))); --Decrease of CS according to stimulant OD,...
end --unremarkable amount of stimulant
JustConsumedStimulant = JustConsumedStimulant-1; --stimulant wears off, should depend on consumed stimulant
end
end

bronze yoke
#

stop is when the timed action is cancelled by the player, perform is when the action completes successfully

marsh sparrow
#

ah so change it out instead of ISEatFoodAction:stop() ISEatFoodAction:perform()

bronze yoke
#

in this case you want both because food action still eats a portion of the food when you cancel it

marsh sparrow
#

yeah ok

#

true

#

ok then i somehow need to set JustConsumedStimulant so that it fits the amount consumed. But more importantly is there anything wrong with the syntax? new to lua and not so sure in some places, especially the item tag. Would the check work as i try in line 4-7?

bronze yoke
#

it'd have to be called with a semicolon and most likely you'd need to reference it as self.item

#

also, instead of this part ISEatFoodAction:stop() = orgISEatFoodAction you should just call orgISEatFoodAction(self)