#mod_development

1 messages · Page 159 of 1

odd notch
#

those are naughty TOS words there young man

#

we can't javamod

red tiger
#

It's what you mod and how you distribute it.

#

Play nice and they will too.

odd notch
#

however YMMV depending on what you're up to

tawdry moss
#

“We can’t javamod”

Simply another phrase for “I haven’t tried hard enough”

red tiger
#

People do stupid stuff. Learn to play by the rules. If you don't know the rules, ask.

odd notch
red tiger
#

Just because the gaming community has more-so accepted modding doesn't mean the companies' views on the legality of modifying their IP has changed.

odd notch
#

best for TIS legally to ask we don't run java based bitcoin mining operations on our user's cpus

drifting ore
#

even this sentence is too complicated

odd notch
red tiger
#

I strongly advocate for what you have rights to do, however I also am more-so an advocate for learning what rights you have.

#

If you couldn't publish core-mods, then the anti-cheat patch I released in early January of 2022 would've been DMCA'd.

#

Most core-mods for PZ that come about deal with piracy and cheating so it makes sense to be warry about it.

tawdry moss
#

I’ve tried core modding twice but both times was attempting to find code for vanilla traits

#

To make different versions of them

red tiger
#

It's sprinkled all over the codebase.

#

They add in trait checks when calculating or executing events.

tawdry moss
#

I was looking specifically for inconspicuous and cat eyes, but couldn’t find anything in the lua

red tiger
#

Passed probably to the JNI.

#

Either that or the shaders.

#

I hope that frosted glass will eventually find its way into PZ vanilla one day. For now I have to mod it in. =(

#

Would implement it myself in their code if ever permitted. All they'd need to do is toggle shaders in the UI render context and pass the current FBO as a Texture2D to the shader.

#

The shader would do the rest.

odd notch
#

trouble was, i couldnt think of a way to achieve that bukkit-style of area copy/paste without a lot of nested, ugly code and so it became too cumbersome to continue

red tiger
#

I considered modding a Towny plugin for PZ.

#

It was for town establishment and protections.

#

Also building houses, much like the ones already in the game.. not the constructed ones by players.

#

Would be funny to turn PZ into SimCity.

#

Have the zombies be citizens and have a full-blown RCI model.

odd notch
#

i try to avoid entire gameplay loops unless i'm being paid to make it

#

i only have so many braincells to rent out

red tiger
#

I mod as deeply as I want really. Depends on the project.

#

My still-unreleased core-mod for the client has modified code in the deep render code for PZ.

odd notch
#

some of us are helpdesk goblins, mr dev

#

coding is my funtime heehoo hobby

red tiger
#

xD

#

If ya ain't havin fun, why ya doin it?

trim mist
#

Hmm. More issues happening with this file thing

#

If anyone has any immediate ideas of what I'm doing wrong, let me know? Otherwise I'm just gonna trudge through this. My first thought is to see if the lines variable is actually getting filled

pseudo jetty
#

yeah good idea

#

I'm not sure what lines is but if it isn't being filled or is nil or isn't a table

bronze yoke
#

lines() should be a stream, not a table

#

i'm not sure if you can use streams or not, i usually just do while reader:ready() do local line = reader:readLine() end

trim mist
#

hmm. So no lines variable outside the loop, just do reader:readline. Gotcha

#
local function addItemTagsFromFile(path, tag)
    if not fileExists(path)
    then
        print("Cannot find file");
        return {};
    end

    local reader = getModFileReader(AnthroTraitsGlobals.ModID, path, false);
    --local lines = reader:lines();
    local line;
    local foundItem;
    local itemTags;

    while reader:ready()
    do
        line = reader:readLine();
        foundItem = getScriptManager().instance:getItem(line);
        if foundItem ~= nil
        then
            itemTags = foundItem:getTags()
            if not itemTags:contains(tag)
            then
                itemTags:add(tag);
                if getDebug()
                then
                    print("tag "..tag.." added to "..line);
                end
            end
        else
            print("Cannot find item "..line.." to add tag "..tag)
        end
        reader:close();
    end
end
bronze yoke
#

you should move reader:close() after the while loop

trim mist
#

oop reader:close is a bit too high

#

lmao

#

sorry

#

Thank you for that. I promise I'm a mostly competent programmer, I just have ADHD

#

XD

pseudo jetty
#

I'm kind of confused with timed actions, if I create one will the game automatically add it to context menus assuming IsValid is true? If not, how should I trigger them?

bronze yoke
#

you need to add them to the context menus yourself

gilded hawk
#

Does anyone remember which is the event that get's fired once the player spawns?

#

Events.OnGameStart?

bronze yoke
#

depends exactly what you're going for, OnCreatePlayer might be what you want

gilded hawk
bronze yoke
#

every time an IsoPlayer object is created

gilded hawk
#

any IsoPlayer? or just yours?

bronze yoke
#

any local one

gilded hawk
#

Good enough

bronze yoke
#

i don't think it fires for multiplayer characters but it does fire for splitscreen characters

gilded hawk
#

Nice!

#

Thank you hughug

trim mist
#

Is there a way to make testing easier? Every time I test I do the process of
-closing the game
-deleting the mod folder
-copying the mod folder manually to the mods folder
-re opening the game
-deleting the old save
-adding the mods to a new save and waiting
-looking at the error log
-repeat

bronze yoke
#

i just work in the mods directory, and i have my mod disabled on the main menu so that lua reloads whenever i reload the save

trim mist
#

hah! Success!!

#

Thanks for your help @bronze yoke !

bronze yoke
#

nice!

timber river
ocean sphinx
#

is there an easier way to figure out what sound effects are triggered by what action? for example, there are 4 "ui_menu_start" .wav files, and instead of _01 being menu start, it turned out to be when you respawn a new character. I know theres a "ui_menu_start for menu start, "click to start" and respawning a character but idk what the 4th one is for

bronze yoke
#

find the piece of code that triggers them i guess?

pseudo jetty
#

Can I make a wearable item drainable?

ocean sphinx
gilded hawk
#

If I do item:getModData() will the moddata be saved in the player savefile once I edit it?

#

Cause it looks like it's not saving them on my side

bronze yoke
#

it should be saved

gilded hawk
#

Is there any case where it would not be saved, or takes longer to load? Like, i'm truyi

#

I'm accessing the mod data of an item via the event OnCreatePlayer but it's not working

nimble spoke
pseudo jetty
#

I was also wondering what makes an item able to equip

#

can I add custom slots and can any types be equip them in?

nimble spoke
ancient grail
lone nest
gilded hawk
#

Is there any event that gets fired right after OnCreatePlayer ?

#

Cause it looks like I can't use item:getVisual() at that time

#

Nevermind, I dumb

gilded hawk
#

What set of characters does the zomboid font support?

bronze yoke
#

the english font should support utf-8

pseudo jetty
#

what does AttachmentsProvided do?

nimble spoke
#

allows your item to provide hotbar slots like a belt does

hidden jungle
#

i'm working on sandbox settings for my mod, how do you set the variable type in the sandbox-settings.txt file?
like boolean, interger, string. google search is flooded with peoples preferences to actual sandbox mode, not the file for modding.
if someone could list out the valid types it would be appreciated.

trim mist
#
local function ATPlayerUpdate(player)
    if player:HasTrait("AT_NaturalTumbler")
    then
        --Fall damage reduced
        player:setFallTime(player:getFallTime() * .5);
    elseif player:HasTrait("AT_ClippedWings")
    then
        --immune to fall damage
        player:setFallTime(0);
    end
end

Events.OnPlayerUpdate.Add(ATPlayerUpdate);

Hoping to pick people's brains here. My Natural Tumbler trait is meant to make things like jumping out of a second story safe, but in testing it prevents all damage, even jumping from 7 floors up.

How should I fix it? Is there an oncollide event for hitting the ground that exists?

#

As of right now I fear that Natural Tumbler doesn't even allow fall time to get beyond 1

bronze yoke
#

you're halving their fall time every frame, so it's decreasing much much faster than it increases, so it's probably near zero by the time they reach the ground

hidden jungle
#

what you could do is track the current fall value and compare to the previous value every frame, then subtract the difference you want

#
OldValue = getValue()
function ValueTracking()
 NewValue = getValue()
 Diff = OldValue - NewValue
 NewValue = OldValue + Diff*0.5
 SetValue(NewValue)
 OldValue = NewValue
end
#

thats how i've been doing it for other stats and its worked fine

nimble spoke
bronze yoke
hidden jungle
# bronze yoke double, string, enum, boolean, integer

is there a way to make it a list of premade options? like how zombie infection has 3 options and not a text box
i'm trying to simplify a large amount of changable settings by having a preset of behaviors instead of 6 seperate interger variables

bronze yoke
#

that would be enum

hidden jungle
#

how do you set it up though? none of the sandbox settings files i've seen use enum so i dont know how to set up the values

bronze yoke
#

i think i have one in one of my mods, one sec

#
option Literacy.IlliteratePenalty
{
    type = enum,
    numValues = 3,
    default = 2,
    page = Literacy,
    translation = Literacy_IlliteratePenalty,
    valueTranslation = Literacy_IlliteratePenalties,
}
```the value of the enum in lua will be an integer starting from 1
#

for the value translations, they're Sandbox_valueTranslation_option1 / option2 / etc

hidden jungle
bronze yoke
#

not that i've seen

hidden jungle
#

damn, thanks again anyway.

keen silo
#

@red tiger I was wondering since you said you specialize in making mod developing tools. Do you have any experience with Audio Editing software?

Because after releasing my Broadcast voicer mod ( https://steamcommunity.com/sharedfiles/filedetails/?id=2973493897&tscn=1683754850 ) I thought it would be nice to add a custom/modified audio editor that:
. Allows Audio Editing
. Can read a Broadcast Script (what the .xml says, the lines spoken)
. Can assign the times to the script based on how you split the audio

And finally configures everything for you.

red tiger
#

I'm not sure that's possible within the current versions of PZ.

keen silo
#

I was thinking more of an external tool

#

not inside PZ

#

(also a programm to make custom radios would be nice too, I guess that there must be one out there)

celest shard
#

Hello! I was wondering about getting into modeling, mainly to make a mod like the one posted below, I got no clue how to do or what to do, can I get some pointers?

vale vapor
#

Hello, i don't know if i'm in the good channel. I'm trying de create my first java mod for project zomboid. My domain is C/C++ but i wan to learn and perfect my java language.

I'm using IntelliJ IDEA. and i try to follow this tutorial : https://github.com/Konijima/PZ-Libraries

But i get this error.

'org.gradle.api.tasks.JavaExec io.pzstorm.capsid.zomboid.task.ZomboidVersionTask.setMain(java.lang.String)'```

Thx in advance for your help.
GitHub

Complete tutorial to decompile and use Intellisense for Project Zomboid modder. - GitHub - Konijima/PZ-Libraries: Complete tutorial to decompile and use Intellisense for Project Zomboid modder.

vale vapor
#

Thx for you quick response, i'm going to try it.

fading horizon
#

how do you make zombies spawn with object impaled in them?

#

is it as simple as adding a weapon to their outfit?

thin hornet
# fading horizon how do you make zombies spawn with object impaled in them?

look into media\lua\shared\Definitions\AttachedWeaponDefinitions.lua

In your mod media directory:
myMod/media\lua\shared\Definitions\MyModId_AttachedWeaponDefinitions.lua

AttachedWeaponDefinitions = AttachedWeaponDefinitions or {};

-- katana in stomach
AttachedWeaponDefinitions.myModId_katanaStomach = {
    chance = 1,
    weaponLocation = {"Stomach"},
    bloodLocations = {"Torso_Lower","Back"},
    addHoles = true,
    daySurvived = 60,
    weapons = {
        "Base.Katana",
    },
}
fading horizon
#

ty

trim mist
# hidden jungle ```lua OldValue = getValue() function ValueTracking() NewValue = getValue() Di...
local function ATPlayerUpdate(player)
    local beforeFallTime = player:getModData().ATPlayerData.oldFallTime
    if player:HasTrait("AT_NaturalTumbler")
    then
        --Fall damage reduced
        if(beforeFallTime < player:getFallTime())
        then
            player:setFallTime(beforeFallTime + ((player:getFallTime() - beforeFallTime) * .5));
        end
        if getDebug() and player:getFallTime() > 0
        then
            print("FallTime (natural tumbler): "..player:getFallTime())
        end
        player:getModData().ATPlayerData.oldFallTime = player:getFallTime();
    elseif player:HasTrait("AT_VestigialWings")
    then
        --immune to fall damage
        player:setFallTime(0);
    else
        if getDebug() and player:getFallTime() > 0
        then
            print("FallTime: "..player:getFallTime())
        end
    end
end

About to test this out and see if it works

trim mist
#

Well. Uh, Definitely works lmao

#

Did you know that jumping from four stories high kills you without the trait on? I didn't. I guess this test is a success hahaha

dawn pagoda
#

@main lion The chainsaws you added ironically dont seem very good at cutting down trees, ha ha

#

And also has an absurd attraction range.

trim mist
trim mist
#

Working on another trait. Anyone know how to get whether or not you're behind a zombie?

local function ATOnCharacterCollide(collider, collidee)
    local knockdownEndCost = SandboxVars.AnthroTraits.BullRushKnockdownEndCost
    local colliderBehindCollidee = ;
    if instanceof(collider, "IsoPlayer" )
    then
        if collider:hasTrait("AT_BullRush") and collider.isSprinting()
        then
            if instanceof(collidee, "IsoZombie")
            then
                collidee:knockDown(colliderBehindCollidee);
                collider:setEndurance(collider:getEndurance() - knockdownEndCost)
            elseif instanceof(collidee, "IsoPlayer") and ((collider.Pvp == true and collidee.Pvp == true) or collidee.isZombie())
            then
                collidee:setKnockedDown(true);

            end
        end
    end
end
#

also if anyone sees anything wrong with this before I test this, pointing it out would be appreciated haha

bronze yoke
#

instanceof's syntax is instanceof(object, "ClassName")

#

not instanceof(ClassName, object)

frank elbow
trim mist
keen silo
#

@frank elbow Is there a tutorial on how to do this? Because I would also like it to show like which line gets asociated with which segment of audio

frank elbow
#

I would assume so. There's an audacity wiki which probably has info on how to create one

bronze yoke
#

you might be able to work out if the player is behind a zombie through however the game determines if short blade weapons should do a backstab

trim mist
#

I'll look into that

bronze yoke
#

there's an IsoGameCharacter isFacingObject, but i'm not really sure what it's expecting for its parameters

#

isFacingObject(IsoObject object, float dot)

#

it seems to be a tolerance of some kind? it's probably some maths thing i'm unfamiliar with, vanilla always uses 0.8 so i'd start with that

#

i think lower is more tolerant, so you might actually want a very low one to determine if the player is behind

vale vapor
#

Hello, java mod can be posted on steam workshop or not? I want to write a simple mod doing the same thing as "Zombie Reanimator" but in java for reduced ressource consumption.

trim mist
#

as far as I know, steam workshop is lua only

vale vapor
#

ok thx.

bronze yoke
#

the game doesn't have any way of loading java mods so while you might put them on the workshop to get it out there, it will require manual installation

vale vapor
#

ok

manic schooner
#

any place to commission a mod?

ancient grail
#

Ye

manic schooner
#

please direct me, is it a channel or discord?

ancient grail
#

Links on my profile

manic schooner
#

thanks

red tiger
#

@tame mulch Is there any way that Kahlua can expose implemented classes for handling primitive data types? E.G: int[], short[], byte[], or List<Byte>, etc? Thanks.

#

This would substantially decrease the memory footprint that Kahlua has when handling large amounts of primitive data.

wet sandal
#

Drumsticks are 3u in vanilla?

#

thats wild

red tiger
#

Wish that PZ used kg

#

Would allow for more accurate weights.

bronze yoke
#

it's not really supposed to represent weight

red tiger
#

Still, a weight system would be far simpler.

#

I imagine for Encumbrance the player would always hold the drumsticks like they're ready to drum 24/7.

novel swallow
#

Hey all, I'm going mad trying to remove a recipe from a mod within my own mod. I've tried all sorts of combos of module, imports, Override, Obsolete, etc... The best thing I can do is just remove all the recipes (by using the same file/module name and having a blank recipe list). Is there a way to selectively remove ONE recipe? I've got my load order set up correctly to load mine last, so it's not that.

Edit: I see above that someone has posted a way to do this with lua, I will give this a go.

Edit: Yup, that works, you the best @weak sierra

red tiger
#

Thinking about logo design again..

#

I never asked anyone about what they thought of my organization's logo design.

#

WDYT of it?

#

This was the original back in 2015/2016 when I worked on ModelLoader:

#

Don't know if anyone here is into logo / media design for their workshop mods etc.

#

I know @ancient grail does his stuff with his team and that's what made me think about it.

#

Found this one too. xD

drifting ore
hidden jungle
red tiger
#

Okay. Back into the void.

bronze yoke
#

isn't that what the moddata is doing?

wet sandal
#

I just overwrote the sizes manually to fix it

red tiger
#

I had a take on how to implement grid inventory systems in PZ.

trim mist
#

it seems to work just fine in mod data

#

i'd be loath to put that in a global var since I want this to be compatible with MP anyway

red tiger
#

If I make my own game similar to PZ in the future I'll go with my take.

#

=)

bronze yoke
#

i'd recommend keeping it in a local variable or a table if you want splitscreen support

#

moddata doesn't really make sense here

hidden jungle
# trim mist It works for sure!

are you sure its working? because with what i read it should be comparing the current fall time to the current fall time, which will always result in 0 as the difference.

trim mist
# bronze yoke moddata doesn't really make sense here
local function ATInitPlayerData(player)

    local modData = player:getModData();

    if modData.ATPlayerData == nil then
        modData.ATPlayerData = {};
        local atData = modData.ATPlayerData;

        atData.trulyInfected = false;
        atData.oldFallTime = 0.0;

    end
end
Events.OnNewGame.Add(ATInitPlayerData);

I thought this was attached to each player. For split screen or other player, is it different?

red tiger
#

It'd be cool too if wearable containers could take damage and depending on the amount they'd randomly drop stuff when walking or running.

wet sandal
#

Evil

trim mist
red tiger
hidden jungle
#

OH it does work, i didnt see you had an OldFallTime value being saved in playerdata

#

nevermind then i'm the stpuid

red tiger
#

I'd also make it so that containers which need to be opened would take time. A grid system could make it so you'd need to remove top items to get to a bottom item.

bronze yoke
#

it is attached to each player, but moddata is mostly for persistence

red tiger
#

Would be insanely more immersive.

wet sandal
drifting ore
#

If I understand correctly, the grid system scales in size with the weight, so something that weighs a lot will fit in the inventory, such as refrigerators, boxes, etc.

red tiger
#

My UI would also be isometric and slide in with alpha transparency say on the right side of the screen.

#

Like an isometric render of the backpack with each pocket as slightly opaque grids of items.

#

Maybe you could have backpacks with locks on them too.

#

TimeAction heaven.

#

Looking forward to see what you come up with @wet sandal

#

I may draft my UI visual. I think it's a cool design.

hidden jungle
# trim mist ```lua local function ATInitPlayerData(player) local modData = player:getMo...

what albion is saying is you can have a table for global data that needs to be saved without being fully SAVED as a character variable.
one gets dumped when the game ends, the other is saved to the player file.
for online multiplayer you don't need to worry about it at all since the scripts dont interact with eachother.
in split screen you can use a table like

local PlayerOldFallTimes = {}
function SetPlayerFallTime(Player)
  PlayerOldFallTimes[getPlayerNum(Player)] = 234
end
wet sandal
red tiger
#

Like the mouse wheel would give so much convenience to scroll through each pocket then middle-mouse click could be to select it. Maybe all of this while holding TAB.

drifting ore
bronze yoke
#

yeah, moddata is usually used for things you need to be persistent, and sometimes things that don't need to be persistent but are instance specific (though in the case of players this usually isn't needed since a table keyed by player index is probably better)

pseudo jetty
#

does anyone know where the movable data for beds are?

#

I've searched the files and got them in bed but I can't find anything

upper wave
#

Does anyone mind giving me a little direct guidance with how PZ functions work with what I want to do. I have 2ish yrs of coding experience (c++ and assembly lang) so I don't need anything crazy. Just some pointers based on your experience. Also, yes, I have been looking at resources. It just helps a lot to be able to ask someone specific questions.

#

I am new to modding

upper wave
#

what is helping me rn is making a "tier chart" of the function layers

shy hearth
#

what is it you're having trouble with?

upper wave
#

just coordinating what i need to do i guess

#

this is going to sound dumb, but im trying to make an item that's basically a sourdough starter

#

i think itd be a great learning process to do more with PZ

shy hearth
#

that sounds rad, it's maybe a bit more involved than what i'd recommend for a first mod but since you have experience already

#

should be manageable

heady crystal
#

Anybody know if it's possible to check if a TV is playing something through code?

upper wave
#

so the steps here are:
-make an item
-make a recipe
-have it generate more "dough" after a set amount of time. after the set amount of time is reached, require a "refill" with flour and water

#

im referencing how crops function in the game because, that just makes the most sense once the item is crafted?

#

is that logical for PZ? @shy hearth

#

sorry for the ping

shy hearth
#

no worries, feel free to ping

#

i don't have any experience with running lua from objects but it seems doable

#

the first two steps are trivially easy and the last one much harder lmao

upper wave
#

YEP

#

its like, okay, i have the item... now how the fuck do i proceed

#

i found a mod with code for a potted berry bush. great aspects of this are:
object is craftable
object is movable
object regenerates berries via water input and time

mellow frigate
bronze yoke
#

i wasn't sure if you only wanted it to be if it was specifically playing a tape, if so then you can just drop the isReceivingSignal

pseudo jetty
heady crystal
#

Can you fetch the specific tape?

#

Even if it's just a name

upper wave
#

hence trying to piece it all together lmao

#

reading code only really helps if you know how it works overall

bronze yoke
heady crystal
#

No way!

#

This means I can make an awesome mod

#

Why has nobody done it before drunk

shy hearth
#

we love an awesome mod

heady crystal
#

Thanks a lot @bronze yoke spiffo

upper wave
#

is this the place to share updates with my mod

heady crystal
shy hearth
#

i hate talking about any project before it's finished lmao

heady crystal
#

If this works, it's gonna change things.

#

Now do I include it in common sense or make it standalone

#

🤔

shy hearth
upper wave
#

ahhh i see

shy hearth
#

Anyone know how to move/teleport players from a serverside lua? setX etc of the player object in question doesn't seem to work

upper wave
#

is it ok to occasionally come for advice

shy hearth
#

100%

#

encouraged, even

#

i'm not an authority here but

#

i'm confident

upper wave
#

i get worried cause some coding communities can be really toxic 😨

shy hearth
#

nah this place is real sweet

upper wave
#

im really glad to hear that

#

the PZ community seems great overall

shy hearth
#

mostly i come back to search in:mod_development with whatever it is i'm looking to do

#

and someone has asked it already and usually been given a solution

heady crystal
bronze yoke
heady crystal
#

As an Android developer I am used to people complaining about the smallest and silliest things and being super toxic overall. Here people are absolutely fantastic. Lots of people willing to help with the craziest ideas and you get a lot of support from the community with any mod as simple as it may be

shy hearth
#

yet another reason to want GameServer exposed

#

i'm sure there's a hacky workaround

bronze yoke
#

on the client, you have to use this monster afaik```lua
player:setX(x)
player:setY(y)
player:setZ(z)

player:setLx(x)
player:setLy(y)
player:setLz(z)

shy hearth
#

does that still trigger anti-cheat 12 dya know?

bronze yoke
#

try it from the serverside but most likely you'll need to send a server command with the desired coordinates

#

no idea

upper wave
shy hearth
#

aye it's what i'm doing from the server rn, no errors but no results

#

i'll see if it bothers the anti-cheat then

#

thanks albion

bronze yoke
#

when i tested my mod locally i didn't run into any anti-cheat issues

shy hearth
#

okay excellent, i'll report back for future reference

upper wave
#

i first should make the item and have it placeable and then move on to the complicated stuff

wet sandal
#

I'm finally ready to sync my moddata for multiplayer.
It can only be stored in 2 types, either an InventoryContainerItem or an IsoObject.

#

Anyone know the api calls or a mod that syncs data properly I can quickly check out?

bronze yoke
#

sync moddata? you just call object:transmitModData()

shy hearth
wet sandal
#

Excellent

shy hearth
#

a hacky way to go about it is to have a recipe to 'reload' flour and water into the starter

#

when the recipe is created change a boolean to start a timer

bronze yoke
#

note that items and players don't need to transmit mod data at all, it's synced by default

shy hearth
#

after the timer replace the crafted recipe with two units of the initial starter, or something

#

idk how bread works

#

outside my wheelhouse

upper wave
bronze yoke
#

and you should *always* transmit mod data, even if you don't need to, because moddata transmission overwrites the existing moddata so if you don't transmit yours another mod transmitting from another client could erase the local data

upper wave
#

but its not really what i ultimately want

#

it might be a good start just for learning

shy hearth
#

honestly i'd go with the hacky solution for now since crafting is changing next update

#

but yea if it's a learning exercise

#

better to do it right

upper wave
#

the sourdough starter is prob the most complicated part of my overall plan

#

my main goal is a bakery mod pretty much

#

idk how many people would be interested in it, but my friend and i would have fun with it lmao

shy hearth
#

have you checked to see if anyone has made anything similar? i think there's a bakery-like mod out there

#

it might not still be supported

upper wave
#

it could be a good point of reference

shy hearth
#

i would 100% play with the bakery mod so if you can make it then do

#

please add potato flour

upper wave
#

i have an artist background before becoming a programmer, so ill be able to edit models n shit

shy hearth
#

i want to forage for my bread lmao

upper wave
#

ooo i didnt even know about potato flour

#

thank you for informing me

#

ill definitely add that

shy hearth
#

you can make a form of flour from basically anything starchy i believe

#

okay maybe i do know a lil about bread

upper wave
#

you know more than me 😭 and im supposed to be making the mod

#

im researching recipes n stuff

shy hearth
#

nah i learned it all from cataclysmDDA

upper wave
#

im hoping itll be a nice, lightweight, QOL addition to the game

shy hearth
#

can take no credit

upper wave
#

who's that??

#

igoogle rq

#

ooo another game

#

ZOmbie game even

shy hearth
#

yea zomboid is sort of a spiritual sequel to CDDA, although that's not official i believe

#

anyway best of luck with your cookin jesse

red tiger
#

Remember kids: Always document your code.

#

Or the Lua goblins will eat you.

shy hearth
#

lua goblins aren't real they can't hurt you

red tiger
#

Correction: They hurt with you.

shy hearth
#

you only need to comment the name of your function above the function

red tiger
#

They are emotional creatures.

shy hearth
#

that's all

#

lmao

#

i shouldn't even joke about it, since modder comments are basically 95% of the entire documentation for zomboid

upper wave
red tiger
#

"My code is self-documenting."
(Calls 911)

shy hearth
upper wave
red tiger
#

I literally wrote a tool and a JSON library for applying documentation to PipeWrench's generated typings.

#

xD

#

Funny how you say that.

shy hearth
upper wave
#

man, i really need to start figuring out what lua is exactly

shy hearth
#

sighed to myself and went back to comment my code

shy hearth
#

that's all it is

red tiger
upper wave
#

of data?

shy hearth
#

tables all the way down

red tiger
#

Keep that in mind.

shy hearth
#

you better believe they're tables

#

i'm not even joking

upper wave
#

sry if i sound dumb, im not experienced at all with game coding

#

is it where the game saves data?

#

like objects

shy hearth
#

nah it's like a data structure

upper wave
shy hearth
#

it's crazy to me how advanced the modding community here is

#

and there are like

red tiger
shy hearth
#

no tutorials out there

upper wave
#

i was thinking of a system like this to really lay out the connections between functions

upper wave
shy hearth
#

yea the learning curve really starts at doing an autopsy of someone else's mod

#

which you need prior experience and much patience to do

red tiger
#

Also my vscode extension for ZedScript

#

Which I haven't touched in a few weeks.

shy hearth
#

i've learned to fear anyone who writes extensions for ides

upper wave
#

i only feel capable bc ive felt like "idek know where to start or how to get to B from A" many times in the past with coding

#

and eventually i work my way to B

shy hearth
#

yea it's what makes it fun tbh

upper wave
#

one step at a time rule

red tiger
#

I mean.. We could make tutorials.

shy hearth
#

i would go off and learn the basic concept of what lua is if i were you

upper wave
#

i have a problem where i think too far ahead and get thrown off on the early steps

shy hearth
#

it'll save you unlearning a lot of stuff

red tiger
#

I need a good microphone to do it.

shy hearth
#

that's exactly where i am

red tiger
#

I'd be down with it.

shy hearth
#

needing a mic

red tiger
#

Just donate to me 4head

#

lol

shy hearth
#

considering just buying the tokens to get an AI to voice it

upper wave
red tiger
#

I am no longer asking.

shy hearth
#

the bernie sanders meme

#

but for a blue yeti

red tiger
#

USB microphones are terrible.

#

They pick up all the high frequency noise in the background.

shy hearth
#

great, gonna have to learn audio mixing now too

upper wave
#

i am happy about where im at rn with coding. the learning curve for c++ was INTENSE

red tiger
#

I used to be a proud owner of a Shure SM7B.

upper wave
#

it's my first prog lang

shy hearth
#

c++ is a rough starter tbf

upper wave
#

i did start with C first actually

#

but quickly moved to c++

red tiger
#

I started with ASM technically which failed and then JavaScript.. Then Java.

shy hearth
#

C is almost better because it lets you blow everything up

#

sink or swim

upper wave
#

i s2g the people that say it's easy, have never done anything actually complicated with it

shy hearth
#

but it worked out for ya

upper wave
#

misspells 1 int:
IDE: 03188x800 dhajabxbaksieyq8worjhaka 000234

red tiger
#

Have you seen my work?

shy hearth
#

i just went to university like a loser

upper wave
red tiger
#

I modded minecraft back in 2010 without any mod tools.

#

I fixed broken decompiled code.

#

I do it on PZ.

shy hearth
upper wave
red tiger
#

I'm a mod goblin.

upper wave
#

comp sci student

upper wave
#

you know what's helped me tremendously with pointers

#

learning assembly

red tiger
#

Pointer to left-stage exit.

shy hearth
#

ahaha

#

you guys are nuts

#

i'm doing back to my mod

upper wave
upper wave
#

helps my understanding of programming a lot

#

im going to be building my own IDE next semester (same prof, he has told us this)

red tiger
#

I don't know MIPS.

#

Been poking at x86 lately.

#

Was thinking about building a PZ mod where you can access computers and write code in ASM.

upper wave
#

🫡

red tiger
#

Or you could make it

#

And show your prof

upper wave
#

now that is beyond me rn my friend

red tiger
#

Do the craziest project you can think of.

#

Insanity makes the best programmers.

spice saddle
#

Just in case PZ wasn’t masochistic enough you want players to write assembly? Haha

#

You could create books to help them learn programming skills

red tiger
spice saddle
#

O’Reilly’s GOTO Instruction Manual “some bird on front page”

#

Dummy’s Guide to How to Access MainFrame 101

red tiger
#

You're late-game in 1994.. Why not write AOL?

lone nest
#

Not sure who can live like its 1993, when Radio Shack was king and internet was capped at like 14 kb/s.

spice saddle
#

You know I did think it’d be cool if i could make mods that’d allow players to play some silly games

#

Idk like Number Muncher

#

Oregon Trail

#

But I never thought about learning assembly lol

upper wave
red tiger
#

If TIS can spend a few minutes and expose implemented array-like classes for packaging primitive numeric values I'd make an ASM emulator.

spice saddle
lone nest
# spice saddle You know I did think it’d be cool if i could make mods that’d allow players to p...

In the history of video games, the third generation of video game consoles, commonly referred to as the 8-bit era, began on July 15, 1983, with the Japanese release of two systems: Nintendo's Family Computer (commonly abbreviated to Famicom) and Sega's SG-1000. When the Famicom was not released outside of Japan it was remodelled and marketed as ...

red tiger
#

My proof of insanity was writing two transpilers so you can write PZ mods in TypeScript.

#

=)

lone nest
#

I still need to try that out, but I'm not writing mods from scratch yet.

spice saddle
#

:O

#

nifty

shy hearth
red tiger
shy hearth
#

oh dear god

upper wave
#

this ASM class has been my easiest comp sci class by far tbh. the key for me is to just not think too hard. just let my fingers type 🫡

red tiger
upper wave
#

best part about ASM is that nothing is hidden

spice saddle
#

The more zombie blood it drinks, more powerful the sword gets?

shy hearth
#

surely someone has made that already

bronze yoke
#

somebody's gotta work out a way to grab the parameter names from the reference site

shy hearth
#

to link automatically?

bronze yoke
#

yeah, there's only so much use you can get out of arg0, arg1, arg2

upper wave
#

yeah i bet. i dont even want to begin to think making something super conplicated with asm

#

oops meant to reply

red tiger
shy hearth
#

by the time i reach n18

bronze yoke
#

maybe... i haven't really any experience with that sort of thing

red tiger
#

I actually scraped the whole javadocs for offline use. Want it?

shy hearth
#

in a sea of unnamed variables

red tiger
#

crawled it using grep

bronze yoke
#

i think i already got it off of you actually

spice saddle
#

👀

shy hearth
#

give give

spice saddle
#

I’d be .. interested…

shy hearth
#

i think i bookmarked it actually

#

but just in case

spice saddle
#

Oh it’s online somewhere?

shy hearth
upper wave
#

NICE

shy hearth
#

aiteron finished it fairly recently

upper wave
#

thank youuu

shy hearth
red tiger
#

I can't find it.

shy hearth
#

so yes jab give us the goods

red tiger
#

Looking for it.

spice saddle
#

I haven’t really started looking into modding yet but that sounds helpful

shy hearth
#

give aiteron props, they worked real hard on it

#

the lua events decompiled is here

spice saddle
#

Thank you Sir

shy hearth
#

my pleasure, just passing on someone else's work

upper wave
#

the type of shit i aspire to be capable of

#

amazing

shy hearth
#

some real auteurs in here

spice saddle
#

Is this listed in one of the mod resources/tools thread?

#

I hope it is

shy hearth
#

i haven't checked actually

#

i just bookmark as i go

#

you'll find a lot of hidden gems using the discord search filters in this chat

spice saddle
#

I lose track of links all t he time.. ugh need to do something’s bout it

red tiger
shy hearth
#

sitting down with a glass of cool lemonade

red tiger
#

@shy hearth @spice saddle

shy hearth
#

reading cover to cover

red tiger
#

It's more of a local clone of the website

shy hearth
#

yea handy to have

red tiger
#

I can take this website and scrape it with code to extract param names.

shy hearth
#

does anyone have a zip of all the zomboid classes decompiled?

#

that's the true holy grail for me rn

red tiger
#

Also

shy hearth
#

i see i see

#

question retracted

red tiger
#

You can use IntelliJ IDEA and double click or open a .class file.

upper wave
shy hearth
#

does intelliJ still have a community version?

red tiger
#

Of course.

shy hearth
#

or dya have to pay

#

i remember struggling to find it before

red tiger
#

I use IDEA.

shy hearth
#

VSC for life

red tiger
#

I use VSC for all scripting langs.

upper wave
#

i couldn't get vsc to work

#

i should try again

shy hearth
#

so lightweight

#

i love it

red tiger
#

How? It's so simple.

#

It's an electron app iirc

upper wave
#

i last tried a year ago wheni was even more of a baby programmer

#

i was getting a weird error

#

i tried googling and could find 0 solutions

shy hearth
#

it's so simple that if you don't know what you want from it it won't give you anything at all

red tiger
#

I love the terminal but I wish I could undock it.

upper wave
#

it was something to do with a java function

#

i forgot what specifically

#

i tried 3 solutions via my professor and kept getting the same issue

red tiger
#

Well if you get accustomed to vscode there's an extension I work on for you to use for script files.

spice saddle
upper wave
#

i'll work on it again after finals week

#

that's great to know

#

it'll prob be fine this time

red tiger
#

Got to get a working linter one of these days..

#

Then the fun can begin on formatting.

fading horizon
#

Which bip bone do hats attach do? Head or head nub?

Currently my model looks like this in game which i'm pretty sure is due to the bone thing

#

what it's supposed to look like

#

normals are all good as well, no issue there

novel swallow
#

Is there anyway to see what mod added a recipe object from getScriptManager():getAllRecipes()? I poked around in the debugger and couldn't see any fields/functions that did this.

fading horizon
#

increasing size does not help either

bronze yoke
#

well... very recently in relative terms

novel swallow
#

darn, was worried of that. Hmm.

bronze yoke
#

if the mod is written properly the module name might help

#

but if they're dumping everything in base that's no good

novel swallow
#

Huh, it is in its own module. Will that be in the recipe somewhere?

bronze yoke
#

yeah, recipe:getModule():getName()

novel swallow
#

Hmm, that doesn't seem to work for me.

#

Oh, I did . instead of :, still getting used to lua

#

Absolutely perfect. You just saved me a ton of horrible code and effort.

gilded hawk
#

Is there a limit to how many files I can put inside fileGuidTable.xml ?

gilded hawk
#

Odd, my clothings are not loading 🤔
And the tooltip is empty and it's firing errors when visible

late hound
fading horizon
#

I see, thank you

#

I think it's actually an issue with vertex weights, because changing that in weight paint modifies how it looks

#

idk, i'll have to look into how other mods did it more

#

on an unrelated note, look how cool my character looks now lol with all my mods

gilded hawk
# late hound no

Is there any specific name convention to follow for the Script item name?

late hound
#

not really, just be consistent

gilded hawk
#

Damn

gilded hawk
late hound
#

looks like a GUID mismatch or clothing item xml name mismatch

gilded hawk
#

The script item name, can be the same name as the ClothingItem ?

late hound
#

yes

gilded hawk
#

😐

#

On my end it looks like it's fine

trim mist
#

Made a short video detailing an issue I'm having that i need some insight on! Here's a side of relevant code!

local function ATOnCharacterCollide(collider, collidee)
    local knockdownEndCost = SandboxVars.AnthroTraits.BullRushKnockdownEndCost
    local colliderBehindCollidee = collidee:isFacingObject(collider, 0.5);
    if instanceof(collider, "IsoPlayer" )
    then
        collider:setIgnoreStaggerBack(false);
        if getDebug()
        then
            print("colliderBehindCollidee: "..tostring(colliderBehindCollidee));
            print("Is Sprinting: "..tostring(collider:isSprinting()));
            print("Tripping: "..tostring(collider:getStats():isTripping()))
        end
        if collider:HasTrait("AT_BullRush") and collider:isSprinting()
        then
            if instanceof(collidee, "IsoZombie")
            then
                collidee:setStaggerBack(true);
                collidee:knockDown(colliderBehindCollidee);
                collider:getStats():setEndurance(collider:getStats():getEndurance() - knockdownEndCost);
                --collider:getStats():setTripping(false);
                collider:setBumpDone(false);
                collider:setBumpStaggered(false);
                collider:setBumpFall(false);
                --collider:setIgnoreStaggerBack(true);
            elseif instanceof(collidee, "IsoPlayer") and ((collider:getCoopPVP() == true and collidee:getCoopPVP() == true) or collidee.isZombie())
            then
                collidee:setBumpStaggered(true)
                collidee:setKnockedDown(true);
                collider:getStats():setEndurance(collider:getStats():getEndurance() - knockdownEndCost)
                --collider:getStats():setTripping(false);
                collider:setBumpDone(false);
                collider:setBumpStaggered(false);
                collider:setBumpFall(false);
                --collider:setIgnoreStaggerBack(true);
            end
        end
    end
end

Events.OnCharacterCollide.Add(ATOnCharacterCollide)
#

Sorry to interrupt! I'll brb, eating some dinner and I'll take a look at the chat after

gilded hawk
#

This makes no sense, the GUIDs are correct, the names are correct wtf is wrong

#

Like, does anyone see anything wrong here?

#

Even the names are matching wtffffffffffff

ancient grail
#

Thats pretty useful

#

Does it work

gilded hawk
# trim mist

IIRC more traits has a bull rush trait, maybe you can take a look at it

ancient grail
ancient grail
#

The image in the middle

#

Is that how its written? Im on mobile
But iirc its missing some stuff

gilded hawk
#

if you are referring m_MaleModel and m_FemaleModel I did not fill them in intentionally, it's an empty model, like the Belt

ancient grail
#

Right

#

Myy bad

pseudo jetty
#

could anyone explain to me how to associate a lua table with a certain item? I'm trying to store the number of times and object has been used. Thank you

gilded hawk
#

Maybe one of the known clothing modders can take a look at this, because this problem has put a massive roadblock in my testing

ancient grail
#

Try modelling?

gilded hawk
#

yeah

ancient grail
#

Im pretty sure he ment you @ AuthenticPeach

gilded hawk
#

...

#

I think I figured the issue

ancient grail
#

What was it

#

I was also looking at that
Thinking i think theres something missing but not quite sure
I knew it should be a path to xml

#

But i thought maybe it was the model

gilded hawk
#

It's the missing </files>

#

Yeah

ancient grail
#

Was looking st the 2nd img
All this time it was the guid xml lol

#

Ajhh i see

#

Lol so it wasnt shown after all

gilded hawk
#

Yeah this wasted me so much time 😦

fading horizon
#

How would I override a vanilla items script parameter? Like if I wanted to add an evolved recipe to a food item that doesn't have one

#

I tried just having it as the same name and parameters + my custom parameter ; however, that did not work

novel swallow
#

Can I add recipes via lua?

fading horizon
#

can you elaborate?

#

like what kind of recipe are you trying to do

novel swallow
#

I'm trying to dynamically create a fairly simple recipe, just a straight one item for another.

#

I could write it as definitions but I'm doing weird stuff with detecting mods so can't rely on the .txt files, as I'd need loads of sub mods and one would have to manually enable them

pseudo jetty
#

do you have a 4:3 monitor lol

fading horizon
#

no i just have pz in windowed mode

ocean sphinx
fading horizon
#

thhats exactly what it is

#

lol

#

i'm making an entire osrs mod

#

weapons so far

ocean sphinx
#

oh sick!

#

are u going to have all the colors

fading horizon
#

of course

#

fixed it

pseudo jetty
#

quick question is there a way to get a unique id for every inventory item?

sand citrus
#

I want to display a string of text to the console to help with my lua debugging. How do reference the console? I am assuming it is basically "something.print(STRING)" at the most basic just going by some lua references.

pseudo jetty
#

print()

trim mist
trim mist
gilded hawk
#

interesting

trim mist
#

So I didn't know if it was like. A legacy thing or...

#

The programmer did some hacky stuff like using ghost mode here and there

#

and they do the whole thing in the OnPlayerMove event

fading horizon
gilded hawk
sand citrus
wicked zealot
#

hi guys i'm trying to do a mod that adds passenger seats for the truck bed and that lets you shoot, i discovered how to add the passenger seats and make the model appear in the back but i dont know how to add the turning animation to the model, does anyone know?

pure abyss
#

True music: Check
Colorful life: Check
Remote Light controller: Check
a fog machine mod: ???

How can I provide myself entertainment without a fog machine to make my own basement rave?

ancient grail
ancient grail
trim mist
#

Long story short, knock over zombies when sprinting, stop the bumping action on the player, and figure out why the player gets trapped in an animation when hitting 3+ zombies clustered together

ancient grail
#

Maybe cuz of dragged down

#

It triggers players to get eaten
While you are forcing it to not react maybe

trim mist
#

Took off god mode. The animation freezing thing that happened above happened when I hit 2 zombies at the same time

pseudo jetty
bronze yoke
#

ids are the same across server/client and i think persistent too

pseudo jetty
#

and I also have kind of a general question about mod data
If you do item:getModdata() is that exlusive to the item? Can I use that to store data about the specific item?

bronze yoke
#

yeah

pseudo jetty
#

great

#

thank you

#

I thought it was global or something and I was going to put the id as an index

sour island
#

bonus art

#

I'd appreciate any feedback that can be given

fast galleon
#

I want this tank to be used from two squares and now it works by having two pumps. If I leave only one pump so it's the same level of fuel which actions would I need to patch? I know worldobject context and radial for vehicle, any other menus?

fast galleon
#

hm, maybe I can do patch for the function that finds the fuel pumps and sync the levels there.

tawny pendant
#

Question: does anyone know if it’s possible to mod the game so that the player can carry more than 50 pounds of stuff at a time in the main inventory (the one displayed by that cardboard box)

novel swallow
#

This might be a really easy question as it's basic .lua which I'm still new to but: Can I define functions in one file and call them in another? So I can have like helper functions I reuse. Not sure how lua works/executes, or if I have to write a line to import it.

fast galleon
#

You can use any global function directly.

#

You can also make modules by making a file return a table, and using

local module = require "file"

you should search for how require works in pz if you use this

novel swallow
#

So does that file basically return a {} with the functions you want as properties?

novel swallow
#

Cool, so basically how js modules work under the hood 😅

#

Thanks all, as always. I popped my head in last night and have already posted like three questions but everyone's been helpful and massively improved my understanding of lua/pz modding.

I'd been Googling/reading the forums all week with no progress - turns out the discord is where it's at.

thin hornet
#

a lua file can return something and be imported later.

thin hornet
novel swallow
#

Oh nice. I've literally been using TypeScript to process data and write recipe blocks for me and just copy pasting them 😅

#

Thank you very much

thin hornet
novel swallow
#

Does that have types for the pz built ins? Because that would be amazing

thin hornet
#

yes, pzpw uses pipewrench, so basically you have intelisense for all of pz java side and lua side

novel swallow
#

😱

#

You have probably just increased my efficiency by several orders of magnitude.

#

I will check that out for sure - thank you!

thin hornet
#

if you have question don't hesitate to ask! 😄
also check out some example (maybe outdated) in the wiki
https://github.com/asledgehammer/PipeWrench/wiki

GitHub

TypeScript typings for ProjectZomboid Java API. Contribute to asledgehammer/PipeWrench development by creating an account on GitHub.

novel swallow
#

I'm sure you'll hear from me, haha. I have an extensive programming background - but never lua (apart from some light stuff in gmod) or PZ. Been really struggling to even discover what types/functions/etc I have available to me. So using TS (my current language of choice) with intellisense will be huge.

#

Also, I was ranting to my friends yesterday how backwards lua is - so many things about it make me 😬

red tiger
#

PipeWrench started as a joke and critique of Lua.

novel swallow
#

Well I'm glad it exists, my thanks to all involved who made it real haha

#

Am I able to go TS mad in this? Like is there anything it doesn't support?

#

Can I just be creating my own types, lambda expressions, etc, all over the shop?

red tiger
#

For some missing or any types for the Lua codebase of PZ you can write Lua interfaces and mix TS code with Lua

red tiger
novel swallow
#

Hmm is there any reason ArrayList<E> get method returns any and not E?

red tiger
#

I was the only developer for PipeWrench. I had a lot of help getting it to auto run for updates on PZ versions.

red tiger
novel swallow
#

Hmm, okay, fair.

red tiger
#

I wrote the code that inspects and traces what is exposed and the generics as well.

novel swallow
#

nice

#

That's a good idea

#

Basically just pull out everything and make ts typedefs for it, so we can have intellisense

red tiger
#

Not only that but type safety

novel swallow
#

Yeah, that's what I was hoping but the first thing I went to use returned any despite it being generic haha

red tiger
#

PipeWrench is powerful.

novel swallow
#

var recipe = recipes.get(i) as zombie.scripting.objects.Recipe; is what I ended up doing for now, as I know that's the underlying type

red tiger
#

Or use import deconstruct

#

I should get back to my rewrite of the Lua to Typescript transpiler.

#

I shelved that to work on a vscode extension for ZedScript for a few months.

#

I shelved that right when I had a breakthrough on emulating PZ pseudo classes in their Lua codebase.

novel swallow
#

I am getting a little confused with the type hinting

#

I see types in the typedef file, but just any in my actual scripts?

red tiger
#

I was thinking about rewriting the transpiler in Typescript and to have it use source files instead of reflection in runtime.

#

Reflection is a terrible way to extract generics since that's all but erased at runtime.

novel swallow
#

Yeah, in Java, they'll all exist and you'll be able to probe to no end the generic types of any params and returns.

TS on the other hand, types aren't real once it's transpiled to JS, so I assume the same is true for transpiling to lua.

However, these are just typedefs in the TS world so should be fine/doable.

It'll depend on the java code and what's visible (which I haven't seen so can't really comment). This stuff is still massively helpful, I just have to be a bit creative/cast things.

red tiger
#

I go hard on it.

#

My work refuses to adapt to TypeScript.

novel swallow
#

oh no :x I work in an entire TS stack for both backend and frontend.

red tiger
#

This is a really oldschool website.

#

Oldschool boss.

#

He doesn't do JS though.

novel swallow
#

Yeah, I used to work on a 15 year old PHP application - old stuff gets stuck haha

red tiger
#

I've worked in Java for over 15 years. JS for around 10 on and off.

#

TS for about 5

#

I can't use modern C# syntax sugar. 99% of the code is in VB.

#

I'm changing that.

#

lol

novel swallow
#

D: C# is actually one of my personal faves
Couple jobs ago I was the sole maintainer of a c# solution that we had to remote desktop in to some laptop that had a vs2008 (or something) license as it was the only way to build it (and they only wanted to buy one license).

I ported it to .net core 2.0 when that was new, built it a new pipeline and auto deploy jobs.

novel swallow
#

I use Rider for C#, but VSCode for everything else.

red tiger
#

Visual Studio is too freaking big and also it's cumbersome to code in.

novel swallow
#

Aye, it's a mess.

red tiger
#

Always newlines my ENTER taps.

#

It's Plato's Cave's take on IDEs.

#

Thanks, MacroHard.

novel swallow
#

Well, sat down and actually wrote a replacement TS version of what I'd done so far in lua and it's all working 👍

#

Good stuff, thanks for that

red tiger
#

Good stuff.

novel swallow
#

I'm still a little confused on arrays, as I've seen people say Lua is 1 based. But under the hood, Zomboid is Java...

I've seen some mods start at 1, and do < size + 1

To loop all recipes, I've done for (let i = 0; i < recipes.size(); i++) and it didn't blow up

red tiger
#

Unless whatever you're invoking is Lua-specific with a index param.

#

Also PZ Lua is not real Lua. It's Kahlua2 which emulates incomplete Lua 5.1.

novel swallow
#

Oooh, okay, noted.

red tiger
#

It was developed over 10 years ago with Java 1.6 technology.

bronze yoke
#

it depends on what you're interacting with

red tiger
#

It's utter trash.

bronze yoke
#

lua tables are 1 based (unless the developer is weird, which happens more than you'd expect), java objects are still 0 based

red tiger
#

TS is transpiled to 1 instead of 0.

#

(IIRC)

#

I could be absolutely lying since it's been a year since I made this.

#

This is all I could find ATM.

#

Either way you could write a quick test-case to test this out @novel swallow

#

Refer to the documentation on this website when you need to clarify any differences from a conventional JavaScript environment.

novel swallow
#

Yeah, I have a feeling this is going to be "do it 0 based till it errors" lol

red tiger
#

IMO The less time spent rewriting code for assumptions the better.

novel swallow
#

if I find something odd, I'll just end up wrapping it and using my wrapper anyway

red tiger
#

PipeWrench is a giant type-safe condom on PZ anyway.

#

lol

novel swallow
#

lol nice

#

that's what I needed really

red tiger
#

I can't imagine having to go through pure Lua and figure out what API change(s) broke my mods.

#

TS compile will tell you right away.

novel swallow
#

debugging lua and just... knowing what props/funcs are available was killing me after just an hour

#

no IDE/intellisense help either

#

it was like going back in time

red tiger
#

More people script than code in PZ so I shifted focus to writing the first full scripting support environment inside of VSCode for people to use.

#

I'm not really seeing much traction with that even though I have mentioned it a lot so I might shift back to PipeWrench. Who knows..

novel swallow
#

Is there a way to add recipes via code using PipeWrench?

#

I'm not a huge fan of them being .txt files 😅

red tiger
#

Since it's a node environment that can be possible.

novel swallow
#

basically turn code in to the .txt files you mean?

red tiger
#

I'm also a freak, btw.

#

lol

novel swallow
#

I mean it looks like you've written what I was planning to write, haha

#

Does JSON.stringify work in TypeScriptToLua? That'll help me with dumping out stuff for analysis

red tiger
#

.

#

@novel swallow

novel swallow
#

oh wow, you really have done everything I need 😂 thanks

red tiger
#

You can make things so much easier and yet no one takes the bait to do good or even better with it.

ancient grail
#

I was thinking about the zed corpse
In some ways they are similar to manequins ..could the be a chance to add to their poses like what i did for the tha manequins
I wonder...?

bronze yoke
#

i don't think so, i think their pose is decided by a boolean

novel swallow
#

Hmm, is there a way to get fire rate of a gun? I don't see it on the base Item class

#

and now I'm doubting if the min/max damage of a gun is the melee damage or the projectile damage 🤔

bronze yoke
#

it should be on handweapon

novel swallow
#

How do I get that from Item?

mellow frigate
bronze yoke
#

oh, sorry, actually if you're on Item it should be there

#

i was thinking of InventoryItem

novel swallow
#

I'm filtering the result of getAllitems and I'm brand new to this so no idea 😅

bronze yoke
#

if there isn't a getter for it then you might actually need to make an instance to get it

#

i think it'd be called swingtime or something

novel swallow
#

Hmm I checked that but it doesn't seem to be representative

bronze yoke
#

it isn't, attack speed is heavily tied to animations

#

i don't know of any way to compensate for that

ancient grail
#

You could create another xml and the animation itself speed it up and do a boolean check for when the speed should be faster

vale vapor
#

Hello,

I need a little help if you can.

Events.OnZombieDead.Add(FunctionName)

This event work or not? I don't see anything.

bronze yoke
#

it works

mellow frigate
vale vapor
novel swallow
#

Hmm I guess the real question with guns I want is how long it takes to get an accurate shot, not fire rate 🤔

bronze yoke
#

i think that's referred to as aimingtime

mellow frigate
red tiger
#

I still need to know if I can get TIS to quickly add primitive numeric wrappers for Lua API.

#

I really shouldn't store bits / bytes as floats / doubles because Lua doesn't support primitives.

#

=/

#

We'd use so much less ram in PZ if mods could access these sorts of tools.

#

Also I would literally throw my example code on how to pass arbitrary uniforms to shaders in PZ if they'd implement either it or their take on it.

#

Controlling shader values from Java or Lua code is something that I'm sure a lot of people asked about over the years.

reef rose
#

hey. Does anybody know where the streetlight properties are hidden in the scripts? Where is it triggered on/off? thanks 🙂 Couldn't find anything related yet

vale vapor
#

if i write a print, where the print will come? in game on command console output log? Do you have other tips for see if my code is executed or not?

red tiger
vale vapor
#

Yes i have this console, but i don't see my print on it. I'm spammed with many log.

red tiger
#

Then it's not firing.

#

Your code isn't executing.

vale vapor
#

ok thx

fast galleon
drifting ore
#

Uhhh

red tiger
#

It's neat that there's a debug mode for Lua in PZ.. however why is there a SQLite editor in PZ? Mega security-flaw.

drifting ore
#

@indigo grove

vale vapor
#

thx Poltergeist.
Actually i only have this.

    print("WakeUp is hook!")
    if zombie == nil then
        return
    end
end)```
indigo grove
#

yes?

manic schooner
#

#FreeGeneralChat

red tiger
fast galleon
red tiger
#

This is for mod development.

bronze yoke
fast galleon
#

also addListener?

red tiger
vale vapor
fast galleon
#

no zombies harmed during testing?

red tiger
#

PipeWrench implements more natural naming conventions for API.

fast galleon
#

I hook to this event to set them on fire so it should work.

vale vapor
#

ok, i'm doing a mistake i think. Don't work for me actually.

    print("WakeUp is hook!")
    if zombie == nil then
        return
    end
end

Events.OnZombieDead.Add(ZombieWakeUp)```
red tiger
#
local function ZombieWakeUp(zombie)
    print("WakeUp is hook!")
    if zombie == nil then return end
end

Events.OnZombieDead.Add(ZombieWakeUp)
#

Looks fine?

bronze yoke
#

is this the entire file? maybe a syntax error earlier on is stopping this part from even being reached?

red tiger
#

^

#

LexerError

bronze yoke
#

otherwise i think the file just isn't being loaded at all

vale vapor
#

it works ! , thx you. What is my error? indentation error?

red tiger
vale vapor
#

ok

#

Thx for your help Jab, albion and Poltergeist.

novel swallow
#

Hmm. I'm still struggling over here to turn an Item from getAllItems() in to a HandWeapon

#

Hand weapon has a constructor and I passed stuff in to it but... Then it doesn't seem to work properly.

bronze yoke
#

InventoryItemFactory.CreateItem(String itemType)

novel swallow
#

is itemType there getTypeString on the item?

bronze yoke
#

getName()

#

that's a little inconsistency, name usually refers to the translated name but on Item it's what's referred to as type everywhere else

novel swallow
#

ah I see

bronze yoke
#

getFullName() might be better

novel swallow
#

ooooh, you seem to be on to something 👀

#

Thanks

#

I've got more correct looking data coming out now (trying to glean stats from items)

novel swallow
#

When things say Time like AimingTime and ReloadTime, what unit is that?

#

Some kind of game tick? If I had to guess, it'd be like 60 ticks a second so a Time of 30 would be 0.5s

bronze yoke
#

it looks like seconds

#

hmm actually

novel swallow
#

Well this say reload time is 30 and it certainly doesn't feel that slow 😛

bronze yoke
#

ohh this works weird

#

the player's 'BeenMovingFor' increases 60 per second while moving and decreases 30 per second while not moving (clamping between 70 and 0)
if the player's BeenMovingFor is greater than aimingTime + their aiming level, it subtracts the difference from their hit chance

#

i think that's how it works anyway - if you sprint around for a really long time and it doesn't seem to take much longer then there might be more factors i'm not seeing

#

oh!!

#

i'm talking about aiming time and you're talking about reloadtime

#

i think reload time probably uses the same ticks as recipes/timed actions, which nobody seems to really know...?

novel swallow
#

Yeah, we're talking about different times BUT thank you for what you just mentioned as that is useful info to me as well 🙂

#

Oh wait, I was taking about both times! I assumed they were the same unit - but appears not.

bronze yoke
#

yeah, reload time should be timed action ticks (on top of a reloading speed modifier based on skill and probably panic and stuff?) but i've never heard how long they are

#

my reading of the code says they should be 1.25 seconds, which is blatantly wrong, but i can't find anything else relevant

trim mist
#

Polling for opinions:
I have an trait that subtracts endurance from the player every time they collide with an enemy. Problem is, the collide event triggers each tick until the enemy can no longer be collided with, subtracting ungodly amounts of endurance. I've already tried to mitigate this by storing the last collided with entity, and it works--for one player or zombie. A crowd is a problem, especially if you collide with two at once. So what should I do?

  1. Store an array of entities the player has collided with and track the time since collided, removing them after ~1 second. Use this to compare instead of last entity collided with.
  2. Create / find a different event that triggers only once in the process.
  3. something else?
trim mist
ancient grail
#

Im already looking at your post

#

Just add a boolean moddata

trim mist
# ancient grail Im already looking at your post

sorry I wasn't trying to @ you for your opinion, just to let you know that I figured out the bumping issue I was having yesterday. I remember you saying that figuring that out could be useful for you

#

but obv your ideas are appreciated

ancient grail
#
 if not zed:getModData().bumped then return end```
bronze yoke
#

you'd still need to remove it after a second

#

so it seems like keeping a lookup table would be better than going through moddata

ancient grail
#

I use vishnyas lua timer

bronze yoke
#

i'd like to look for a different solution though, could you just check if the zombie is currently falling/on the ground?

trim mist
ancient grail
#

You should follow albions advice instead
And use mine as a last resort

trim mist
#

in isoGameCharacter there's an isBumped. I'm not actually sure if the zombies get bumped or not, but I could set that too

ancient grail
#

That i believe is just for a short while? Does you collider have infinite energy

#

Can collide 100% all the time

#

How will it die

trim mist
#

no lmao. Once they can't sprint they're unable to do the event

#

which is bowling over a zomboid lmao

ancient grail
#

I see

trim mist
#

I'll post the code once I can get it to work flawlessly

ancient grail
#

Then check for endurance level instead

trim mist
#

or mostly flawlessly, at least

trim mist
ancient grail
#

U already made it so that it reduce enduranxe right?

trim mist
# trim mist here's what I'm checking for

check if the collider is a player, if so, is it colliding with the previous entity it collided with? if not, then check if it has the right trait, if it's sprinting, and has been sprinting more than 10 (i'm unsure as to what unit of measurement this is, but it seems fine)

ancient grail
#

Sounds good

trim mist
#

I can add

and not collidee:isBumped()```
at the end of that second-to-last if and see if it works
ancient grail
#

Try it

bronze yoke
#

again, i wouldn't really use moddata for temporary data like this

local lastCollidedChr

local function ATOnCharacterColide(collider, collidee)
    ...
    if colidee ~= lastCollidedChr then
    ...
    lastCollidedChr = collidee
end
#

if you need splitscreen support you can make it a table indexed by player number instead

ancient grail
#

collidee

#

Hehe

trim mist
#

if you look at the event in the documentation it's really hard to tell who's the collider and not, so I made it easy for myself by fudging english a bit lol

ancient grail
#

If both are sprinting then yes

#

Ah that can be fixed easily
Just need to add

if  instanceof(zombie , "isoPlayer") then return end
bronze yoke
# trim mist here's what I'm checking for

btw, just a style thing, but it can be a lot prettier to do if not condition then return end instead of if condition then if you're wrapping the entire rest of the function in that block

trim mist
ancient grail
#

Weirdly enough i just gave this advice earlier

trim mist
#

but I'll take a look at returning

bronze yoke
#

moddata would support splitscreen by default though

bronze yoke
#

if you wanted my way to support splitscreen you'd instead do```lua
local lastCollidedChars = {}

local function ATOnCharacterColide(collider, collidee)
...
local playerIndex = collider:getPlayerNum()
if colidee ~= lastCollidedChars[playerIndex] then
...
lastCollidedChars[playerIndex] = collidee
end

trim mist
#

Gotcha! I can understand that a lot better

#

Is there a way to make that table two-dimensional in lua? That's what I'd need to solve the current problem

#

...speaking of which, give me a moment to test the isBumped() idea

#

I've been looking at this chat nonstop lol

bronze yoke
#

yeah, you just put tables in the table

novel swallow
#

can I make an item than when you use it, grants a recipe and then is consumed?

#

Oh, that looks quite easy actually, nvm.

trim mist
#

still confirming if this works in tests but

#

just had to record this moment

red tiger
#

Gonna release mods under the banner "Team sledgehammer"

red tiger
#

Just gave two old laptops a new life, one by replacing a bad HDD and both by doubling LRAM. One now has Ubuntu.

glass basalt
#

does anyone know how many vehicle scenes there are in PZ? just wanna make sure I didn't miss any

trim mist
#

Here's what I got: This will knock down zombies if you're sprinting at them with the appropriate trait, and only trigger the endurance reduction once!

local function ATOnCharacterCollide(collider, collidee)
    if instanceof(collider, "IsoPlayer")
    then
        -- take the sandbox cost, modify it by the difference between the player's current strength/fitness and the average strength/fitness of 5. Then turn that into a decimal since endurance is a decimal. Pick .01 if the cost is lower.
        -- if you ever figure out math, make it do a percentage taken away instead of a flat number
        local knockdownEndCost = Math.Max(SandboxVars.AnthroTraits.BullRushKnockdownEndCost - (((collider:getPerkLevel(Perks.Fitness) + collider:getPerkLevel(Perks.Strength)) - 10) / 100), .01)
        local colliderBehindCollidee = collidee:isFacingObject(collider, 0.5);
        if getDebug()
        then
            print("ATOnCharacterCollide Triggered");
        end
        if not collidee:isKnockedDown() and collider:HasTrait("AT_BullRush") and collider:isSprinting() and collider:getBeenSprintingFor() >= 10
        then
            if getDebug()
            then
                print("collidee: "..tostring(collidee));
                print("colliderBehindCollidee: "..tostring(colliderBehindCollidee));
                print("Is Sprinting: "..tostring(collider:isSprinting()));
                print("getBeenSprintingFor(): "..tostring(collider:getBeenSprintingFor()));
                print("Tripping: "..tostring(collider:getStats():isTripping()))
            end
            if instanceof(collidee, "IsoZombie")
            then
                collidee:setStaggerBack(true);
                collidee:knockDown(colliderBehindCollidee);
                collider:getStats():setEndurance(collider:getStats():getEndurance() - knockdownEndCost);
                collider:setBumpType("");
                collider:setBumpStaggered(false);
                collider:setBumpFall(false);
            elseif instanceof(collidee, "IsoPlayer") and ((collider:getCoopPVP() == true and collidee:getCoopPVP() == true) or collidee.isZombie())
            then
                collidee:setBumpStaggered(true)
                collidee:setKnockedDown(true);
                collider:getStats():setEndurance(collider:getStats():getEndurance() - knockdownEndCost)
                collider:setBumpType("");
                collider:setBumpStaggered(false);
                collider:setBumpFall(false);
            end
        elseif collidee:isKnockedDown() and collider:HasTrait("AT_BullRush") and collider:isSprinting() and collider:getBeenSprintingFor() >= 10
        then
            if instanceof(collidee, "IsoZombie")
            then
                collidee:setStaggerBack(true);
                collidee:knockDown(colliderBehindCollidee);
                collider:setBumpType("");
                collider:setBumpStaggered(false);
                collider:setBumpFall(false);
            elseif instanceof(collidee, "IsoPlayer") and ((collider:getCoopPVP() == true and collidee:getCoopPVP() == true) or collidee.isZombie())
            then
                collidee:setBumpStaggered(true)
                collidee:setKnockedDown(true);
                collider:setBumpType("");
                collider:setBumpStaggered(false);
                collider:setBumpFall(false);
            end
        end
    end
end

Events.OnCharacterCollide.Add(ATOnCharacterCollide)
#

If you don't separate the player and zombie classes, you can crash the game