#mod_development

1 messages ยท Page 53 of 1

sour island
#

Yeah it's a bit of a nest - at least for me

low yarrow
#

Is there a "OnEquipPrimary" But for clothes?
Havent found anything yet in the wiki and vanilla lua files.

sour island
#

There's two equip actions, from context and from double click

low yarrow
#

Okay, just looked into the mod i subbed today "ExQueaseMe" and it seems like he is using a event i might can use. Which is called "OnClothingUpdated"

bronze yoke
#

keep in mind onclothingupdated isn't only called by equipping, it's also called when dirt/blood levels change

#

depending on what your code does this isn't a big deal

low yarrow
#

Good to know, thanks

#

But i have to check if the player wears a specific item anyway, so it shouldnt conflict.

sour island
#

You could tie into the timed action for equipping

low yarrow
#

That would probably be the more efficient way to do

#

Which event i would use for that tho

sour island
#

It's not an event persay

#
media/lua/client/TimedActions/ISWearClothing.lua
#

You can overload the timed action

bronze yoke
#

ISWearClothing:perform() is likely what you're looking for

sour island
#
function ISWearClothing:perform()
    self.item:setJobDelta(0.0);

    if self:isAlreadyEquipped(self.item) then
        ISBaseTimedAction.perform(self);
        return
    end

    self.item:getContainer():setDrawDirty(true);
    if instanceof(self.item, "InventoryContainer") and self.item:canBeEquipped() ~= "" then
        self.character:removeFromHands(self.item);
        self.character:setWornItem(self.item:canBeEquipped(), self.item);
        getPlayerInventory(self.character:getPlayerNum()):refreshBackpacks();
    elseif self.item:getCategory() == "Clothing" then
        if self.item:getBodyLocation() ~= "" then
            self.character:setWornItem(self.item:getBodyLocation(), self.item);

            -- here we handle flating the mohawk!
            if self.character:getHumanVisual():getHairModel():contains("Mohawk") and (self.item:getBodyLocation() == "Hat" or self.item:getBodyLocation() == "FullHat") then
                self.character:getHumanVisual():setHairModel("MohawkFlat");
                self.character:resetModel();
            end
        end
    end
    triggerEvent("OnClothingUpdated", self.character)
--~     self.character:SetClothing(self.item:getBodyLocation(), self.item:getSpriteName(), self.item:getPalette());
    -- needed to remove from queue / start next.
    ISBaseTimedAction.perform(self);
end
#
local original_ISWearClothing_perform = ISWearClothing.perform
function ISWearClothing:perform()
    --do stuff before
    original_ISWearClothing_perform(self)
    --do stuff after
end
#

The problem with some stuff is that it may not return an object or results that you can safely change and pass on

low yarrow
#

Thanks man!
I try that out

sour island
#
function ISWearClothing:new(character, item, time)
    local o = ISBaseTimedAction.new(self, character);
    o.item = item;
    o.stopOnWalk = true;
    o.stopOnRun = true;
    o.maxTime = time;
    o.fromHotbar = true; -- just to disable hotbar:update() during the wearing
    if o.character:isTimedActionInstant() then o.maxTime = 1; end
    return o;
end
#

You could try to apply a variable here to check in perform

#

Depends what exactly you're trying to do

low yarrow
#

Basically i just want to check if the equipped item is the dress i made, if the character is a male and strength is above 2 the dress will be removed and instead you will get some ripped sheets ๐Ÿ˜„

So far my plan, but one step at a time.

sour island
#

you're fine then

#

good luck

low yarrow
#

Alright, thanks!

fast galleon
sour island
#

Nice, you got it working

stiff furnace
#

Hello everyone ๐Ÿ™‚ Quick question, does the following code look correct for getting the items in a players inventory? I am getting an error when I try to run it
local playerInv = getPlayer():getInventory():getAllItems()

stiff furnace
#

Oh, silly mistake

#

I am trying to use this resource

#

Just learning my way around.

#

Thank you so much

ruby galleon
#

Hey does this Error matter or no? ERROR: "media/maps/Basements/spawnpoints.lua" doesn't exist, spawn points may be broken.
[3:29 PM]
I have Basements mod but wasnt sure if this was a big deal

bronze yoke
stiff furnace
ruby urchin
bronze yoke
#

i didn't hear if it was updated

#

well the person who changed that on the wiki is a tis employee, so i'd say it's probably accurate ๐Ÿ˜…

#

disregard then

ruby urchin
#

anyway, I don't think it matters, I mean, not much has changed

bronze yoke
#

actually i noticed the other day that the official one has variable names

#

i accidentally ended up on there and assumed it was always like that, but i guess it's new actually

#

that makes it a lot easier to discern what a lot of functions are supposed to do/what the arguments are actually supposed to be, so it's quite a bit better

bronze yoke
weak sierra
#

so the other docs are updated finally?

bronze yoke
#

looks like it

weak sierra
#

huh

#

that's nice

stiff furnace
#

Lol!! No problem man

#

Things are always changing.

#

I appreciate the guidance

bronze yoke
#

did anybody even know this? i never heard about it and evelyn seems surprised too

ruby urchin
#

having a decompile is much better in any case, there are several functions that are hidden in the documentation

bronze yoke
#

if the wiki was updated at the same time then this update was already a month ago

bronze yoke
ruby urchin
#

I check the wiki from time to time to get something quick, it's at least 2 weeks old I think

ripe warren
#

When I look into the templates for vehicle parts that vehicles use they always refer to another template inside them. What and where is this file?
For example The Template_engine is refering to template vehicle Engine.

bronze yoke
#

it's defining the template

ripe warren
#

OOH

#

that makes so much more sense lmao

#

I cant believe how braindead I feel sometimes from this

sour island
#

slapping together some artwork for the print origin mod thing

ripe warren
#

looks awesome

sour island
#

ty

#

streaming it if anyone has suggestions

fast galleon
#

fingerprint is fitting like a glove

sour island
ripe warren
#

what does a template with a "!" mean?

bronze yoke
#

template copies parts, template! loads the entire script

#

specifically it copies areas, parts, passengers and wheels

sour island
#

so you can use another vehicle using template! ?

bronze yoke
#

from what i'm reading yeah

weak sierra
# sour island

i look forward to finding out what spams my logs with stupid shit without having to search

#

i presume that's what it does by the name

sour island
#

Yeah

#

Join us for the live development

dull moss
#

when adding events, what options are there?
Events.EveryHours.Add(functionHere);
is there one for every day?

astral dune
dull moss
#

Thanks

bronze yoke
dull moss
dull moss
#

from description if I undrestand correctly it's once per server/save, right?

bronze yoke
#

it sounds like once per save

dull moss
#

yea thought so too

ancient grail
#

Whats the lua event for thing im writing
A tile will have a certain moddata
And it increases overtime

If a player isnt present im sure it will stop
So i have to be able to capture the time and compare it to the time someone sees it again

Should it be ontick playermove or something else

#

Probably not onloadgrid?

sour island
#

Load grid is fine but a better event would be when they actually interact with it

#

Then you don't even need the loop

ancient grail
sour island
#

What are you trying to do again?

ancient grail
#

Oil Derick that produces unrefined oil
Then convert it from the refinery into petrol which will then refil gas stations

#

Theres an event i recall

Something like
Oncontainerload
Or
Inventoryload
Idk
Something like that

Maybe that will work

#

So once the player access it it then calculates time
And then adds stuff on the container
Making it easier

light geyser
#

I have a mod commission for any dev in here, zombie camouflage. There's already a mod for it but it's outdated and doesn't work in MP, went to see the mod's dev and they told me that they couldn't update it because of college and stuff but I'd like to add it to play with friends

stiff furnace
#

Is it possible to use DoParam to edit a specific item in the players inventory?

bronze yoke
bronze yoke
#

i.e. instead of Item:DoParam('DisplayName = foo') you can do InventoryItem:setName('foo')

ancient grail
#

Ah this is the permanent edit to the item right?

#

Can you modify the fulltype with doparam?

#

Cuz if you could then you can write entire items using lua as you have dummy items to edit

bronze yoke
#

yes

#

doparam edits an item script

stiff furnace
#

Makes sense

astral dune
#

I thought that even if a java object wasn't exposed, as long as you could get one from the code somehow you could still manipulate it, but that doesn't seem to be the case. Trying to call isSet(IsoObjectType.lightswitch) on a ZomboidBitFlag is giving me Exception thrown java.lang.RuntimeException: attempted index: isSet of non-table: zombie.ZomboidBitFlag@4b85edeb at KahluaThread.tableget line:1689

#

if I'm reading this code right, calling this should tell me if there is a streetlamp on a tile, I'm not sure if there is any other reliable way to do it

ancient grail
#

i couldnt see it earlier i was on mobile

quick moth
#

are there any good up to date tutorials on making mods?

fast galleon
quick moth
# fast galleon not sure what you want to mod https://pzwiki.net/wiki/Modding the guide by Fenri...

I'll check it out, thank you.

I started getting into modding around December 2021 or so, but never got it quite right. I added a new recipe book. Functionally the item worked as intended when I spawned it into my inventory, but I couldn't get the darn thing to actually spawn in naturally in the world. I had a mod that tweaked stats of some items, but it broke sometime after 41.53. I'm interested in doing a variety of stuff, but nothing too crazy. Mostly vanilla-friendly tweaks.

weary matrix
#

Hi there, just to let you know https://zomboid-javadoc.com/ is going to expire on the 23rd of december. If you're using the website please consider making a donation on my ko-fi (see my discord profile) so that I can pay for the renewal. If no one cares, I'll let the domain expire and the website won't be available anymore.

hearty dew
#

You can only really read fields in non-debug mode

quasi geode
#

cant help notice the irony of a site offering free domains that doesn't support https on their site (which they can get for free from letsencrypt)

weary matrix
#

Hi @quasi geode, good to see you ๐Ÿ˜›

quasi geode
weary matrix
quasi geode
#

nope, retired. handed the mod back to the original author so he could find a new maintainer

weary matrix
quasi geode
#

ah extended break. still here apparently but not actively modding atm

weary matrix
#

I see ๐Ÿ˜…

weary matrix
sharp fulcrum
weary matrix
#

I can transfer the domain to you

sharp fulcrum
#

i'd prefer the full package so it does not rely on github. i'll throw it on a webserver i already have so it's no issue at all to host it too.

#

are you in a position to dump the full site into a package?

weary matrix
sharp fulcrum
#

you did not (visibly) update the site since the 65 javadoc and you also said above you were done with the whole modding topic. i did not expect you to want to continue updating the doc. if you do, that's fine, and i'll just take over the domain.

weary matrix
sharp fulcrum
#

alright, then let's transfer the domain over to me and i'll pick up the tab this year. with 78 getting its "final" hotfix very soon, could you update the doc for that version, too?

weary matrix
#

sure

#

@sharp fulcrum please let me know what credits I should add to the index so people know it's you who's paying for the domain

sharp fulcrum
#

let's get the domain transfer taken care of first, so it does not expire. dm me about the rest of the process!

hearty dew
#

As far as updating the javadoc, could send PRs to the github repo or could also give him push access if he would update the java docs. Could delegate the work that way

weary matrix
hearty dew
#

I mean, if you wanted to do that, go ahead. Guess you can give yourself feedback ๐Ÿ˜…

#

I was suggesting bknht could send you a PR

#

Or could give him push access

#

both as options to offload the work of updating the javadoc (with different amounts of involvement on your part)

weary matrix
sharp fulcrum
#

i am more interested in preserving an essential community resource than i am interested in maintaining it

weary matrix
#

what's up @sour island ?

sour island
#

Just saluting an old friend

#

You have some great mods - also I assumed the javadoc was integrated into the mainsite

#

Or was that doc just updated for that time?

weary matrix
weary matrix
sour island
#

I guess I assumed from this, that they were hosting it

sour island
weary matrix
sour island
#

Oh so it is, wow - I mistook it for the official lmao

weary matrix
#

hehe ๐Ÿ˜‚

sour island
#

Could maintaining it just be a matter of dumping in the games files and running a GitHub Action?

#

I wouldn't mind doing that once and a while

weary matrix
#

also with latest pz releases the trick I was using to generate the javadoc is not working anymore

sour island
#

Oh?

#

They did update the java to 18

weary matrix
#

like:

error: package exists in another module: jdk.unsupported
package sun.misc;
sour island
#

Could that be causing it?

weary matrix
#

yes

sour island
#

I'm doing my part

weary matrix
#

hum except they switch to 17 not 18 if I'm correct

sour island
#

I think you are, but I use 18 for my stuff and it doesn't seem to be an issue

weary matrix
#

yeah probably not an issue

sour island
#

Are you using pzDoc to decompile?

#

Or did you write your own?

weary matrix
#

I use the decompiler from intelliJ, they have a jar file that you can call from the command line

sour island
#

IntelliJ or PZ?

weary matrix
#

intelliJ

sour island
#

Hm I wasn't aware - I'm still using pzDoc for the Lua stuff

#

Fortunately still works

weary matrix
#

what is pzDoc used for?

#

I mean the Lua code is already available as is?

sour island
#

It translates what's exposed from decompiled Java into a Lua file that allows you to auto-complete while writing Lua

weary matrix
#

oh I see

sour island
#

It's the thing Yooks wrote - idk if you remember/were in that group?

weary matrix
#

nope, I guess it was before my time ๐Ÿ˜…

#

I only started modding in 2021 ๐Ÿ˜›

sour island
#

Possibly, Konijima wrote an updated/clearer guide on how to use it

weary matrix
#

@sour island so you're writing your mods using IntelliJ?

sour island
sour island
#

Couldn't do it otherwise

#

My old method pre-EHE was rooting around the files one by one guessing based on file name

weary matrix
#

of course you could ๐Ÿ˜›

sour island
#

I know people use vscode and stuff but I meant keeping all the functions and things sorted out in my mind

#

Having to at least remember a couple classes or part of the functions name makes modding much less of a headache

#

Hopefully pzDoc doesn't break anytime soon as I think Yooks dipped at the same time as you came in or during 2020

weary matrix
#

I've never been able to use an IDE, always been using vim ๐Ÿ˜‚

sour island
#

I've been told intelliJ and such have too many bells and whistles

#

I haven't used anything else tho

#

I gotta get ready for work, I'll catch up in abit

weary matrix
#

@sour island regarding the problem to generate the javadoc, it's because TIS is using the class sun.misc.Unsafe, but the package sun.misc should not be used, and javadoc is choking on it. Wondering how they even compile their game ๐Ÿ˜‚

sour island
#

Hmm

weary matrix
#

aaaah sweet! Finally found the culprit to generate the javadoc

sour island
#

๐Ÿ‘

#

Out of curiosity, have you just become too busy or just not interested in modding PZ?

weary matrix
thick karma
#

(Not intelligently, but still, does help and save time)

#

(at least tells you what to search for)

sour island
#

Oh I wasn't aware - like entire functions?

thick karma
#

It stores strings from other loaded files automatically somehow

#

So if I have e.g. the PlayerData file that has getSpecificPlayer in it and I type "ge", getSpecificPlayer shows up fast as one of the likely targets of typing "ge"

#

But it only does this for files that are currently open

#

Still that's v useful because I generally know where the files are that have the vanilla functions I'm working on

#

And often have them open

sour island
#

Yeah, if you can follow the PZ libraries tutorial you'd get the auto-complete for everything anytime

thick karma
#

I.e., I don't just remember it all either using VS Code

sour island
#

Good to know tho ๐Ÿ‘

thick karma
#

Might explore that myself, seems convenient

#

But yeah the VSCode thing is especially helpful if you're unaware of any libraries for autocompleting your code.

#

Sort of a generic approach that always works to some useful degree

thick karma
# weary matrix been tired of TIS attitude towards modders

โค๏ธ I don't know you but I have relied often on your JavaDoc. Sorry so many companies lack the wisdom to show proper appreciation for the modders who make their half-finished games playable, but people like me appreciate you. ๐Ÿ™‚

sour island
# weary matrix been tired of TIS attitude towards modders

I get what you mean, as it sometimes feels like we're deep in the back alleys trading secrets- but at the same time it is their project so I can see why they'd be more inclined to actually work on it and not spend time making sure modders have a better time.

Which I think is a shame, because modders are also end-users at the end of the day. And their role also has a net positive on the game retaining players (I'd assume).

But this is all me filling in the gaps, as truth be told - it's not a negative attitude being felt -- just non-interaction tbh.

#

Although Nasko is often open to ideas, as he's the community guy (idk if that's in his job desc)

#

And there's red names in here /mapping

weary matrix
weary matrix
silver widget
#

i tried it once and ended up falling asleep - you guys have inspired me to dip my feed in head first this weekend and its quite intimidating with how different things are from whats referenced - the vs code autocompletion helps but understanding is very hard. just wanted to say thankyou for the work you guys do - you guys literally complete the game for me

weary matrix
bronze yoke
#

the pzdoc stuff also sort of works with vsc, but not amazingly - i still end up relying on the javadoc most of the time, it's basically just a spellcheck at this point

weary matrix
#

any clue how to remove the sick moodle with debug mode (sick aka queasy)?

#

I tried this but it's not changing the sickness level:

getPlayer():getStats():setSickness(0)```
bronze yoke
#

like the sickness you get from being infected? that's set every frame so you can't really do anything about it

#

food sickness is separate and can be messed with iirc

weary matrix
#

it has to be doable cause you can also get sick from spending too much time around corpses, but if you go far from the corpses the sickness goes away

bronze yoke
#

that actually gives you food sickness

#

as far as i know everything except zombie infection goes through 'food sickness'

weary matrix
bronze yoke
#

doesn't that remove the infection too?

#

it's recalculated completely every frame, so if the infection is removed so is the sickness

weary matrix
#

hum so I tried this:

getPlayer():getBodyDamage():setInfected(false)``` but character is still sick
bronze yoke
#

you need to make the bodypart uninfected too

ancient grail
#

Is it possible to convert string to number

bronze yoke
#

tonumber(foo)

ancient grail
#

๐Ÿ™

ripe warren
#

okay I am seriously at a loss here. I cant figure out why this isnt working. I created a template for a new vehicle part. If I include this template in a custom vehicle it shows up in the vehicle mechanics. But if I try to use the template in a vanilla vehicle it refuses to show up in vehicle mechanics. Furthermore the custom part has an item and a model associated with it but neither show up when the part is installed on a vehicle

#

vanilla car with template

#

custom vehicle. As you can see the part shows up in bodyworks. but even than it still doesnt show its item or doesnt display the model on the vehicle

bronze yoke
#

is the custom part in a different module?

ripe warren
#

this is the template and the custom part

#

everything is in Base module

astral dune
frosty light
#

Does anyone know if it is possible to make new attack animations for the player character and add/replace them in the game?

drifting ore
#

What languages does pz use for modding?

frosty light
#

I want to try learning how to make said animations in blender, but I have 0 Lua knowledge. Good to know it's possible at least.

ripe warren
ripe warren
quasi kernel
#

I'm going insane. Does anybody have any ideas?

#

Currently trying to make Lantern compatible with the new Better Batteries system, but for some unknown reason it just refuses the OnTest??

#

What's strange is that the console is printing that the battery can be removed, yet the context menu for the recipe just... doesn't show up.

#

I know for a fact it's not referring to the vanilla method because it's printing this in the first place.

#

Not to mention that the Better Flashlights patch works fine??

#

Literally the only problem is the fact that you can't take dead batteries out of the lantern despite passing the OnTest method.

#

Lantern uses the vanilla TorchBatteryRemoval OnTest method, but this is overwritten and fixed for Better Batteries.

#

My code is simply

#
function Recipe.OnTest.TorchBatteryRemoval(sourceItem, result)
    print("Battery can be removed:")
    print(not sourceItem:getModData().batteryRemoved)
    return not sourceItem:getModData().batteryRemoved
end
#

Unless I need to wrap it in parenthesis, which I highly doubt seeing as it works with Better Flashlights.

#

The recipe for the battery removal is just..

#
    recipe Remove Battery
    {
        keep LTN_SL.Lantern,

        Result:Battery,
        Time:30,
        OnTest:Recipe.OnTest.TorchBatteryRemoval,
        OnCreate:Recipe.OnCreate.LanternBatteryRemoval,
    }
#

wh, it doesnt work with vanilla flashlights either

#

Is it a load order thing?

#

Better Flashlights still works fine though..

quasi kernel
#

Okay so for some reason it works with one vanilla flashlight but not the other??

#

im going nuts

silk hollow
quasi kernel
#

Naw it's quite alright hehe

#

I know this is usually pain but c'mon

#

Its like the game is literally picking and choosing what works and what doesn't.

ripe warren
#

I am in the exact same boat. I cant figure out what I am doing wrong at all.

quasi kernel
#

I found out that only some of the Better Flashlights flashlights work, the rest just, don't??

#

Seemingly at random.

#

They all index the same exact test methods.

silk hollow
#

could be related to a recent patch? I remember reading something about batteries?

ruby urchin
#

Remember that pz is in active development, things always could change

quasi kernel
#

A g o n y

#

I'll look through the patches but I don't recall seeing anything recently at least.

ruby urchin
#

A few weeks ago something similar also happened to me, but here told me that some things changed in TimedAction

quasi kernel
#

Hm.

#

I'm not entirely sure what a TimedAction change would cause in terms of recipes though..

#

Like I know it's used but, what would that change in terms of OnTest and OnCreate methods?

ruby urchin
#

Oh no, that was a particular thing to happen to me, not related with your current issue

quasi kernel
#

Ah.

#

Even then, I know my recipe code for the Lua side is up-to-date because my Zomboid is also up-to-date so it's like

#

???

#

I swear I'm not crazy yet

#

yet

#

I don't even know where to start looking to fix this, inserting batteries works fine.

#

It's removing them.

#

If anyone has any ideas please let me know, I have no clue.

sour island
#

Can you remove batteries normally?

#

I thought you had to let them drain

#

Also haven't read any context

quasi kernel
#

This is for a mod

#

Batteries can ordinarily be removed as long as charge is present

#

This mod adds modData to electrical devices like Flashlights to detect if a battery is in them independant of current charge, allowing one to remove dead batteries and potentially recharge them.

#

Problem is it just doesn't work for battery removal if the charge is 0???????

#

And since a battery is already in it, it won't let you insert a new battery either.

#

I've already checked if it's using the legacy method by throwing a print statement in zomboid's lua files, but nothing came of it.

thick karma
bronze yoke
#

nice!

thick karma
#

lol now I just hope it works for everyone like it has been locally so I can stop thinkin about it for awhile

#

Now I'm humoring combat animations.

#

That seems like it'll take more work but damn it I need more than swing left swing right

#

Still this mod was a big hurdle for me

#

Making this animation and triggering it properly is a step toward weapon animations for me.

quasi kernel
#

gaming!

#

welp back to insanity

ripe warren
#

Anyone experienced in vehicles with custom armor parts willing to help me out a little bit?

bronze yoke
#

what do you need help with?

ripe warren
#

still the same issue from earlier today

ripe warren
#

custom templates dont appear on vanilla vehicles for some reason
And my custom vehicle parts arent being linked with the item I assigned them

#

I tried reaching out to ki5 and some of the autotsar devs with no luck. I know no one else that does custom parts for vehicles

bronze yoke
#

i've done what you're trying to do before, i just don't know why it isn't working, it looks fine to me

ripe warren
#

could it be the file structure?

#

all my script files are in the scripts/vehicles folder

#

including the items and the model definition the template is pointing to

bronze yoke
#

i don't think subdirectories have any special meaning

ripe warren
#

file names dont matter either right? every script file gets loaded no matter its name

ripe warren
#

Well I dont feel like its justifiable to bang my head against the wall because of this anymore

#

guess I am giving up unless someone has any other ideas

ancient grail
#

Is it possible to create a recipe purely from lua

bronze yoke
#

getScriptManager():getModule('Name'):ParseScript('script string') probably does that

weak sierra
#

grats

#

great idea

#

you might consider putting a submod that just adds the animation as an emote to catch an even wider net (we'd use that)

#

i look forward to seeing what you might do with animations going forward MD_SkadiNod

thick karma
#

I could in theory even just extend the mod with a sandbox setting to prevent the other mechanics.

#

There is already 1 sandbox setting for allowing everyone to meditate, vs only allowing yogis to do it

sour island
#

I might make it so the red little error box is a button that you click and it shows you each unique error neatly with the mod ID and call stack

#

Would this be something useful / already done?

#

Half the battle of bug reports is educating people how to access the console log - and then they clip the error is half anyway

#

Kind of a pain in the ass

thick karma
ripe warren
#

I instinctively click the thing even though it does nothing

#

because it really should

thick karma
#

Resizing the debug windows every time is so tedious

sour island
#

It's more for end users

#

F11 is super valuable but is gibberish to most

weak sierra
#

as a server operator and modder

#

both

#

would let me check errors on-the-fly and help users send me errors better..

bronze yoke
#

that sounds great

weak sierra
#

not having to open the log during gameplay would be great even as a dev/server op

sour island
#

Alrighty, just wanted to check in - I assume it's not been down before?

weak sierra
#

not that i've seen but i haven't gone looking

#

what is ur thought, make it pull up the f11 error list thing?

#

if so that's sometimes incomplete errors too

#

(for some reason, i have no idea why)

#

still useful tho

sour island
#

Well with the print() thing I messed with the call stack info

#

I think I can just hijack what it sends to the console and have it in an array instead

#

List unique errors + the copy count

weak sierra
#

nice

sour island
#

Ideally make a copy to clipboard button

weak sierra
#

users can screenshot if that's not doable

#

u can 100% make it selectable tho if u can't do the clipboard from the game

sour island
#

From UI?

weak sierra
#

(there's a chance they sandboxed that or there's just no function)

sour island
#

I could make a text input window

weak sierra
#

ye

#

that's what i mean by making it selectable

sour island
#

To have it selectable

weak sierra
#

yup

sour island
#

Yeah

#

๐Ÿ‘

weak sierra
#

that way if u cant write to clipboard

#

good workaround

#

can even put instructions for totally noob users

#

how to copy

#

<_<

sour island
#

Id probably make a chart if the call stack runs through different mods

#

I've gotten reports cause of another mod handling the same function as me

#

And they named their file something generic

#

Where as mine had the mod name on it

#

Punished for being a good boy ๐Ÿ˜ญ

fast galleon
#

Is there a way to reverse / cancel climb sheet rope, do you edit animation or timed action?

weak sierra
sour island
astral dune
#

that reminds me, has anyone made a mod that changes the default order of actions when you spam "use"? For example, when I'm trying to quickly escape out a window I'm not a fan of my character closing the window instead and getting eaten

#

on the flip side, maybe jumping out the window shouldn't be a hotkey at all if your on the third floor

fierce cipher
#

Anyone know why there arent any new meshes for zombies? Is it hard coded/difficult to include?

astral dune
#

I think people have made zombies with different bodies by making special clothes for them, but the base model seems to be untouchable

fierce cipher
#

Good work around. So I guess copy the coverall item and replace the mesh and textures with something else?

#

I imagined thatd be a clipping nightmare

#

Idk I havent touched pz modding yet but Ive been eyeing it for a while

astral dune
#

I haven't done any of this, just read about it in patch notes and stuff, so take it with a grain of salt, but I believe the base mesh is divided into portions that can be hidden to prevent clipping issues

bronze yoke
#

yeah you can just mask the whole model

gaunt meteor
#

how does PZ create fog effects? I know there is climatemain.lua, but ... how does it produce fog visually? it is a texture?

#

or is it a particle

fierce cipher
#

Modding for pz weirdly looks pretty difficult

#

I read skimmed through the tutorials

#

Tbf I dont even know where to begin, I only know how to create meshes

coarse apex
#

Is the ability to change the main menu music a thing? Also for the death music?

#

I remember there were mods back then allowing both menu background changes and music too, but i heard its like not possible (?) now

#

Asking because I kinda wanted to make a few mods replacing those things

bronze yoke
#

there are mods that replace the menu music, but they require users to manually replace files

#

i think death music can be done normally though?

coarse apex
#

if you can replace it and it works for everyone obv

#

i also remember there were a few mods on steam that actually full on replaced the music ingame and didnt require someone to do it manually etc..

#

again tho i think that ability is all gone now

winter thunder
#

So- With the tag system that was added back in like april, does anyone know if there is a way to add custom tags in the game right now?

bronze yoke
#

just add them to the item's script

#

Tags = foo;bar,

winter thunder
#

Like, literally Tags = my_custom_tag

#

?

bronze yoke
#

yeah, you can just put whatever you want

winter thunder
#

Hell yeah.

#

That is super helpful lol, thank you kindly! When using the check for the items, if I am using them in a recipe and they have a depletion value, how would that be taken into consideration?

#

Like, if I added a tag for cooking oils, and spliced that into different mods. Because they have their delta values, would I still be able to check for an item with the oil type, and use 1 delta's worth? Independent of the type of Oil used

bronze yoke
#

i'm unsure, but probably yes

winter thunder
#

sweet. I appreciate the help <3 thank you!

astral dune
#

have they broken the tile picker in recent versions? Trying to put some tests together but even with the brush tool enabled selecting stuff from the tile picker doesn't give me the option to place it

winter thunder
astral dune
#

just placing vanilla tiles

winter thunder
#

Oh-

#

Lmfao...

#

Sorry haha, just ran into an issue with that recently and brain defaulted

astral dune
#

there may be something wrong with my tilepicker, I have a bunch of categories for stuff like "TileThuztorRugs" that are completely empty

sour island
#

Anyone know what that tiny red error box is referred to as?

rancid tendon
#

hey @bronze yoke ! do you think you could show me a version of that item dummy replacement code that works on normal containers?

#

it turns out that if you develop a mod exclusively using extremely low sandbox loot settings you don't notice that having too many items makes a bajillion things drop on higher loot settings even when you try to mitigate that

bronze yoke
#

oh of course!

#

i was actually going to post some snippets like that to github but i totally forgot about it... luckily i already finished that one in particular

#
-- list of items to replace the dummy with
local itemList = {'Base.Orange', 'Base.Pear'}

local function replaceDummies(container)
    local dummies = container:getAllType('Base.Apple') -- dummy item type
    for i = 0, dummies:size()-1 do
        container:Remove(dummies:get(i))
        local itemChoice = ZombRand(#itemList)+1
        local item = container:AddItem(itemList[itemChoice])
        container:addItemOnServer(item)
    end
end

-- for items in containers
local function onFillContainer(_roomName, _containerType, container)
    replaceDummies(container)
end

Events.OnFillContainer.Add(onFillContainer)
rancid tendon
#

thank you very much! :) time to entirely replace the loot distributions with this instead because there simply is no way to balance adding 1000 items to the same container

#

question: does anyone know if there's a way to disallow decimals in sandbox values?

bronze yoke
#

like for a number entry? use type = int

rancid tendon
#

yup! awesome, thank you

bronze yoke
#

oops sorry that's type = integer

hearty dew
#

Isn't there a way to organize data in the loot tables so only one item drops? I vaguely recall it working that way when I skimmed through the java code that rolls for item drops (Maybe I'm thinking about a different random loot mechanism, like attached weapons drops)

bronze yoke
#

it's possible, i never actually looked into anything like that since i adapted this system from a vhs spawn thing i have for my literacy mod, which absolutely necessitates this since vhses aren't separate items

sour island
#

Hmmm can't seem to hijack exception throwing

rancid tendon
#

if such a thing exists, i'd love to know!

sour island
#

hmmm DebugLogStream hmmm

sour island
#
--formatStringVarArgs(DebugType0, LogSeverity1, Str2, Obj3, Str4, Obj5, Obj6, Obj7, Obj8, Obj9, Obj10, Obj11, Obj12, Obj13)
local DebugLog_formatStringVarArgs = DebugLog.formatStringVarArgs
function DebugLog.formatStringVarArgs(var0, var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13)

    print("TESTING: ",tostring(var0), tostring(var1), tostring(var2), tostring(var3), tostring(var4), tostring(var5), tostring(var6),
            tostring(var7), tostring(var8), tostring(var9), tostring(var10), tostring(var11), tostring(var12), tostring(var13))

    DebugLog_formatStringVarArgs(var0, var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13)
end
#

wish me luck

astral dune
#

its obvious what they all do ๐Ÿ™ƒ

bronze yoke
#
 LogSeverity logSeverity,
 String prefix,
 Object affix,
 String format,
 Object... params)```
#

the updated javadoc is pretty handy

sour island
#

tried:

local DebugLogStream_printException = DebugLogStream.printException--(Throwable1, String2, String3, LogSeverity4)
function DebugLogStream.printException(Throwable1, String2, String3, LogSeverity4)
    DebugLogStream_printException(Throwable1, String2, String3, LogSeverity4)
end
#

both aren't actually exposed it seems

#
LOG  : General     , 1669085886252> -------------------------------------------------------------
attempted index: printException of non-table: null
#

DebugLog_formatStringVarArgs doesnt seem to print anything tho

fierce cipher
#

Can you make a new saw, but also have it be a weapon?

bronze yoke
#

yeah, an item's use in crafting is mostly independent of its type

fierce cipher
#

Would it be too OP to have a weapon also function as a saw and axe?

sour island
#

Can't seem to find a way into error tracking

quasi kernel
#

Has anybody managed to get leads of OnTests failing or nada

#

It feels like I've been banging my head against drywall for hours

sour island
#

OnTest like recipes?

quasi kernel
#

Yesyes

#

Sorry Im late Ive been working on other things

#

for some unknown reasons my OnTest for the BatteryRemoval just.. fails to register to the system or something..?

#

I had a print statement set up in the function, as it was supposed to overwrite vanilla, and the print statement does its thing just fine.

#

So I know for a fact it's firing.

#

It just doesn't.. do anything?

#

For some reason?

#

And it just likes to pick and choose what items work and which ones dont, seemingly at random.

#

One vanilla flashlight works, other one doesn't. Some Better Flashlights lights work, some don't. Lantern doesn't work period.

#

And yet they all use the vanilla method that I'm currently trying to replace.

#

So it makes 0 sense that some work and some dont.

ruby urchin
#

SNIPPET: create java Array(?

local arr = array.new();
print(arr) -- []
array.push(arr, "Test")
print(arr) --[TEST]
////////////////// array functions //////////////////
metatable.rawset("__metatable", "restricted");
metatable.rawset("__len", new UserdataArray(LENGTH));
metatable.rawset("__index", new UserdataArray(INDEX));
metatable.rawset("__newindex", new UserdataArray(NEWINDEX));
metatable.rawset("new", new UserdataArray(NEW));
metatable.rawset("push", new UserdataArray(PUSH));
quasi kernel
#

I don't even know if it's an OnTest problem anymore.

#

I just decided to try an experiment that, guess what, failed.

#

Forcefully set all recipe onTests to a separate, custom onTest, and nada.

#

I'm going insane.

#

It's printing and returning the correct data, so why isn't it working

quasi kernel
#

wait

#

no

#

it's the drainable limitation coming back to devour my soul

silver widget
#

Drain* ๐Ÿคญ - im rooting for you

quasi kernel
#

I RAN INTO THIS EXACT SAME PROBLEM LAST TIME

silver widget
#
  • small question do folder names matter when structing the mod or is all based on convention ? as im looking around it seems everyone has a semi diffent way of doing it
quasi kernel
#

I HAVENT LEARNED DIDDLY SQUAT

#

I think for some it matters

#

Stuff like media, lua, server, shared, client, etc

#

Generally speaking it's the folders that matter mostest

silver widget
#

^ yeah i think i understand that much but inside that do the folders have to specifically reference the function its accessing or is that just for legibility?

quasi kernel
#

that much im unsure about

silver widget
#

alright thanks for the guidance lol ill keep smashing my face into the keyboard until something pops up in game lol woo!

quasi kernel
#

Felt that

fast galleon
polar gyro
#

Anyone know which events triggers on weapon swing, but right before swing and after hit?

undone elbow
ancient grail
#

But if u want ideas that are op
Try a pencil that can destroy wall like any sledgehammer.

silver widget
#

i think the eraser would be more fitting lol wax on wax off

dapper geode
#

Hi, is there any events for "Player A kill another player"?

ripe warren
#

can someone please explain to me these?
I am guessing complete is defining what lua function the game should execute when the uninstallation of a part is complete right?
For all the other things I have no idea what they do and when they are triggered

#

okay so from my understanding from looking at the lua functions.

ruby urchin
ripe warren
#

create is triggered when a vehicle is spawned.
init I am still not sure
update is just done regularly on a cycle every however many ticks.
Use is for whenever I interact with that part. So lets say when I use a trunk it makes the trunk container accessible

#

do I understand this correctly?

astral dune
polar gyro
sour island
#

Anyone know if the debugLog that's exposed is related to the actual red box errors?

#

I would have assumed so, but nothing seems to happen when I overload it

rapid sparrow
#

Is there a mod that has this ^

hearty dew
sour island
#

Yeah after looking over it again and comparing it to debugLogStream - it seems there are actually exceptions than something called "Lua exceptions"

hearty dew
#

And annoyingly, part of the java classes to write to different log levels isn't exposed :/

sour island
#

There's a Lua manager function actually counting and listing errors but it doesn't seem related to the red box

#

So it might be the "Lua exceptions" which I think come from the parser validating the Lua

#

I might have to grab the console.txt and reverse engineer this to work

#

Not ideal ๐Ÿ˜ฆ

hearty dew
#

I would imagine the main game loop has a try-catch block to catch any exceptions and does something to make the red box show up when it catches an exception

sour island
#

There is a Java side UI element that retracts - I haven't tried grabbing the UI element cause I really want the text being outputed

hearty dew
#

Ideally, exception info is sent to lua to render the red box, but it could be done java-side too. I haven't looked at how the red box is implemented

sour island
#

But the stuff that looks like it would be it isn't exposed

#

I could put in a request, but it's such a niche ask, I don't think it would be worth changing the feature locked version

#

I'll have to try again when able - might be something I missed

ruby urchin
sour island
#

I'll take another gander

bronze yoke
ripe warren
#

ah I see, thank you

#

well I still cant figure out any of this

#

so I am giving up. Its hopeless lols. no one has any info on it and I cant figure it out by myself

unique harbor
#

Is it somehow possible to block player damage?
Like using the OnWeaponHitCharacter event and returning false?

astral dune
#

they recently added a OnPlayerGetDamage event that handles most if not all sources of damage

unique harbor
#

But are you able to return / alter the damage there?
Cause I wasn't able to find a resource that modifies a event or rather the output of it

astral dune
#

you may have to just revert the damage. I haven't used the event myself, just saw some talk about it when it got added

unique harbor
#

Hmm I see... thx

ruby urchin
#

SWAT mod has a shield that blocks damage from zombies, You should take a look

quasi geode
#
         LuaEventManager.triggerEvent("OnWeaponHitCharacter", var2, this, var1, var3);
         if (LuaHookManager.TriggerHook("WeaponHitCharacter", var2, this, var1, var3)) {
            return 0.0F;

from IsoGameCharacter.Hit()

#

should also beable to call player:setAvoidDamage(true)

#

theres a few ways to do it really

astral dune
#

oh that's handy. Been looking for a way to isolate the damage a player takes from the the damage the vehicle takes during a crash, that'll be easier to use than what I was planning

quasi geode
#

not sure if it takes effect with crashes, but havent really looked at the crash mechanics at all

astral dune
#

I imagine it would, I'll check it out after work

unique harbor
#

I'm used to return false in events to block it

quasi geode
#

ya thats the code that triggers the event. i displayed it to show the hook trigger below
you can add a function to the hook (similar to adding events) that blocks when returning true

#

or call :setAvoidDamage during the event

bronze yoke
#

i had no idea we had hooks like that ๐Ÿ˜…

astral dune
#

I am also unclear on how that's supposed to work

fierce cipher
quasi geode
#
Events.OnWeaponHitCharacter.Add(function(attacker, target, weapon, damage)
    if some_condition then
        target:setAvoidDamage(true)
    end
end)

--- or

Hook.WeaponHitCharacter.Add(function(attacker, target, weapon, damage)
    if some_condition then
        return true
    end
end)
-- alternately
Hook.WeaponHitCharacter.Add(function(attacker, target, weapon, damage)
    return some_condition
end)

astral dune
#

do all events have a corresponding hook?

quasi geode
#

sadly no

bronze yoke
#

a quick search of the java shows me there's only 5 usages of hooks in the entire source lol

quasi geode
#

but ya.. hooks are the little known underappreciated event system. i wish there was more

astral dune
#

with my events I've been experimenting with returning the results of all the handlers and its been working so far

#

because I believe all the event handlers attached to an event that is triggered in the lua run before the trigger function returns

#

essentially like this

local args = {totalDamage = 100, isCanceled = false}
TriggerEvent("ExampleEvent",args)
if not args.isCanceled then
  object.applyDamage(args.totalDamage)
end

like I said it seems to work great as long as the event is only triggered and handled in lua

quasi geode
#

ya works good in that instance, not so good when the event is coming from the java side and the args is a numeric or something passed by value and not by reference

astral dune
#

ya, I only use this specifically for events I made myself

quasi geode
#

as a afterthought, should probably actually manually check though that the hooks still work as intended. NGL my info maybe out of date since i'm not entirely active anymore ๐Ÿ˜…

hearty dew
#

Using the Hook table instead of Events

#

There were only 5ish iirc

#

Like this, but using Hook

quasi geode
#
      AddEvent("AutoDrink");
      AddEvent("UseItem");
      AddEvent("Attack");
      AddEvent("CalculateStats");
      AddEvent("WeaponHitCharacter");
      AddEvent("WeaponSwing");
      AddEvent("WeaponSwingHitPoint");

the hooks listed, there maybe more but i havent dug around through everything (cant really fire up pz atm to check)
also, taking a quick look i might be remembering how they function wrong

looks like when they're triggered the return value will always be true if a hook exists, regardless of what the callback returns

rancid tendon
#

hey @bronze yoke ! could i convince you to look over my implementation of your d- wait i just realized something

#

do you think the code that you made for the zombie inventory replacement and the one you sent me last night would like... conflict

#

if they're both implemented within the same file

bronze yoke
#

oh they might

#

here's the full snippet that definitely works together

-- list of items to replace the dummy with
local itemList = {'Base.Orange', 'Base.Pear'}

local function replaceDummies(container)
    local dummies = container:getAllType('Base.Apple') -- dummy item type
    for i = 0, dummies:size()-1 do
        container:Remove(dummies:get(i))
        local itemChoice = ZombRand(#itemList)+1
        local item = container:AddItem(itemList[itemChoice])
        container:addItemOnServer(item)
    end
end

-- for items in containers
local function onFillContainer(_roomName, _containerType, container)
    replaceDummies(container)
end

Events.OnFillContainer.Add(onFillContainer)

-- for items found on zombies
local function onRefreshInventoryWindowContainers(inventoryPage)
    if not inventoryPage.inventory or not instanceof(inventoryPage.inventory:getParent(), "IsoDeadBody") then return end
    replaceDummies(inventoryPage.inventory)
end

table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Base.Apple");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 100);
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Base.Apple");
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 100);

Events.OnRefreshInventoryWindowContainers.Add(onRefreshInventoryWindowContainers)```
#

i'm thinking of writing a tool that'll either convert tapes to this system or a replacement for the generator that'll do it in this system, but i'll have to check if their license allows that (and i should check if what tyrir said about there being another way to do this was right too)

rancid tendon
#

thank you!! i'll give this one a shot later today

sour island
#

Hooks are amazing in that they can completely replace the vanilla content

#

If there were more you'd see a lot more overhaul mods I imagine

astral dune
sour island
#

There's a hook for stat calculation on players too

astral dune
#

the hook for Attack seems ominous

sour island
#

That's kind of the nature of it

quasi geode
#

ya idk it doesnt seem right from memory, i may have just read it wrong but i just took a quick glance

sour island
#

Hooks bypass entirely

astral dune
#

Which hook takes priority if multiple try? haha

sour island
#

The first I think?

astral dune
#

or does it fire every hook like the events

sour island
#

It checks if a hook is present

#

So probably they all pile on

#

It does Add to the hook

quasi geode
#

all of them, it used the Event.class, essentially the functionality is the same

sour island
#

There's some cases where you don't want vanilla to play out - the alternative is what I had to do with calorie balancing -- I had to rewrite the entire method anyway just to figure out the difference between vanilla and my own rates - and apply just the difference

#

So if you'll be rewriting stuff anyway, might as well make it straight forward

#

I wonder how busted it would be if Events were given a boolean to make them behave like hooks

quasi geode
#

the Attack hook was used in the old ReloadManager for firearms (might still be used in the new timed actions for firearms too).. so i should remember this all clearly from ORGM days. but meh i'm getting old my memory isnt what used to be lol

astral dune
#

I like the idea of intercepting things and changing them entirely instead of trying to figure out what happened and reverting it, especially for damage calculations where the reversion may come too late. But it is intimidating

sour island
#

It's more or less the same logic tbh

#

I can help, I rewrote the item picker

#

I couldn't figure out how to spawn filled first aid kits ...

#

So I just rewrote the loot spawn for containers

little iron
#

Any modders accepting commissions for a weapon?

sour island
#

Kind of hope there isn't some method I missed

#

I've written stuff that already existed in utility files too

#

Feels bad

silver widget
#

hay Chuck - im sure youve been all over the code by now but did you you notice the refereces to stack traces in events-schemes.jason and in deboglogstream.java?

#

in reference to trying to find what it is that calls for the red box thing -

sour island
#

I looked at debugLogStream but it doesn't seem to be exposed

#

I followed the flow from catch to print, hoping to gobble up that info

#

No luck so far

#

Might also be getting names mixed up

#

I have a few attempts commented out

#

debugLog class seems to be the only one not throwing exceptions suggesting exposure issues - but I can't seem to figure out where it's doing it's thing

#
  • there's two Lua manager methods referring to errors and error count - but it isn't the same as the red box errors it seems
quasi kernel
#

Is there a known way to like

#

check if a flashlight was on a belt

#

and then put it back-

bronze yoke
#

getAttachedSlot() setAttachedSlot()

quasi kernel
#

I thank thee

undone elbow
#

CriticalChance doesn't work for knifes?

#

in txt

whole yoke
#

Is there a tutorial for making melee?

quasi kernel
#
function Recipe.OnCreate.TorchBatteryInsert(items, result, player)
    local oldItem = nil
    local battery = nil
    for i=0,items:size()-1 do
        local item = items:get(i)
        if item:hasTag("Battery") then
            battery = item
        elseif item:hasTag("BatteryItem") then
            oldItem = item
        end
    end

    if oldItem and battery then
        local currSlot = oldItem:getAttachedSlot()
        result:setUsedDelta(battery:getUsedDelta())
        result:setFavorite(oldItem:isFavorite())
        result:getModData().batteryRemoved = nil

        --[[if result:getAttachedSlot() ~= currSlot then
            result:setAttachedSlot(currSlot)
        end]]
    end
end
#

Anyone know what's wrong with this?

#

Problem is in the commented out code.

#

It seems to trigger an error but otherwise function, though I'd like if it just like, didn't

bronze yoke
#

which line errors?

quasi kernel
#
 if result:getAttachedSlot() ~= currSlot then
      result:setAttachedSlot(currSlot)
 end
#

setting the attachment slot of the result seems to cause problems.

#

the if statement is a little redundant but I wanted to check anyways

bronze yoke
#

maybe print currslot?

#

must be getting a weird value or something

quasi kernel
#

correct slot

#

what's weird is the error triggers but the item is in the slot like you would expect

#

might just wrap it in a pcall

#

ehh i dunno

#

that feels weird

bronze yoke
#

player:removeAttachedItem(oldItem) might be needed

quasi kernel
#

will try it

#

Still seems to trigger the error.

flint beacon
#

How would i be able to trigger a sprite change for a custom tile that ive added? something similiar to how the rain barrel sprite changes after water has gone into it.

#

im trying to work on a upgradeable workbench so it can have different recipes for every tile

rancid tendon
#

i thiiink something's busted with the loot distributons but i can't figure out what

#

i don't think your code is busted, cuz i can't even get to the part where i'd test that because the blank cassettes aren't showing up in the loot tables ๐Ÿ˜…

#

those if-then statements could have been done MUCH more gracefully but i ended up having to do it that way for time's sake

#

i could have just packed them all into 4 if-then statements but it would have taken me a lot more time

bronze yoke
#

i'm not sure if it's the cause of the issue, but your if statements should be using == not =

rancid tendon
#

that's certainly probably breaking something

#

but is not the main culprit.. hmmm

fiery pecan
#

welp. Here I am. The modder who hardly talks....
There's been an issue with Linux users running my mod for ages, and I seriously don't know how to fix it. When a linux user hovers over a clothing item in their inventory (from my mod), they get spammed with this error: Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@67767343 function: render -- file: ISToolTipInv.lua line # 108 | Vanilla. [22-11-22 19:23:55.554] ERROR: General , 1669166635554> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at GeneratedMethodAccessor465.invoke.. [22-11-22 19:23:55.555] ERROR: General , 1669166635555> DebugLogStream.printException> Stack trace:. [22-11-22 19:23:55.822] LOG : General , 1669166635822> Helpful logging, right?
Anyways, if anyone has any ideas... I'm all ears. Thanks for your time. ๐Ÿ™‚

bronze yoke
rancid tendon
#

some of them are totally outside of the if statements

#

and even those ones don't show up

#

other than the cassettespawn one but

#

that one was working before i changed anything

bronze yoke
#

oh, have you checked your log for errors then?

rancid tendon
#

i didn't see any pop up while i was in debug but i'll give it a look!

#

doesn't seem like it.. hmm

#

this is just obnoxious, it really seems like everything ought to be working fine and it's just.. not

#

i'll try removing all the if-thens and see if it just works as raw loot distribution tables, and if it doesn't then obviously i've messed something up there

bronze yoke
#

yeah that's what i'd try

rancid tendon
#

tyrir asks this! i may have messed up integrating your code maybe? (though i think that's a later issue rather than what's causing this problem)

bronze yoke
#

he's missed that it's added to the event at the very end

#

oh! wait no

#

this is a different issue but this Events.OnRefreshInventoryWindowContainers.Add(replaceDummies) should be Events.OnRefreshInventoryWindowContainers.Add(onRefreshInventoryWindowContainers) now

bronze yoke
rancid tendon
#

hmm actually i have a question that might obviate all this if-then silliness-- albion, is there a way to have this dummy replacement code replace the blank with more than 1 item at a time, and have it randomly decide how many to add?

bronze yoke
#

yeah, hold on

#
local function replaceDummies(container)
    local dummies = container:getAllType('Base.Apple') -- dummy item type
    for i = 0, dummies:size()-1 do
        container:Remove(dummies:get(i))
        for i = 0, ZombRand(5)+1 do
            local itemChoice = ZombRand(#itemList)+1
            local item = container:AddItem(itemList[itemChoice])
            container:addItemOnServer(item)
        end
    end
end
#

the number in that ZombRand is the maximum amount that can spawn

#

it might just be easier to add the dummy item to the spawn table multiple times though

rancid tendon
#

hmm. ok, i'll keep trying to make it work this way and if i can't figure something out i'll give this method a shot instead

#

good to have a back up

#

hm.. vexing

#

it does appear to be something related to my attempt at integrating sandbox settings

#

that's annoying, i wonder why it's breaking..

#

they do just work as raw loot tables

bronze yoke
#

it's really weird that it breaks without an error

rancid tendon
#

yeah i was checking the debug console and the console/co-op console files and none of em had anything that seemed related

#

i think i'm gonna have to try implementing the random version up above--a quick related Q, is there a way for me to separate it from the zombie one so that it only applies to containers? because i think in the merged snippet that controls dummy replacement for both zombies and containers, right?

bronze yoke
#
-- for containers
local function onFillContainer(_roomName, _containerType, container)
    local dummies = container:getAllType('Base.Apple') -- dummy item type
    for i = 0, dummies:size()-1 do
        container:Remove(dummies:get(i))
        for i = 0, ZombRand(5)+1 do
            local itemChoice = ZombRand(#itemList)+1
            local item = container:AddItem(itemList[itemChoice])
            container:addItemOnServer(item)
        end
    end
end

Events.OnFillContainer.Add(onFillContainer)

-- for zombies
local function onRefreshInventoryWindowContainers(inventoryPage)
    if not inventoryPage.inventory or not instanceof(inventoryPage.inventory:getParent(), "IsoDeadBody") then return end
    local container = inventoryPage.inventory
    local dummies = container:getAllType('Base.Apple') -- dummy item type
    for i = 0, dummies:size()-1 do
        container:Remove(dummies:get(i))
        local itemChoice = ZombRand(#itemList)+1
        local item = container:AddItem(itemList[itemChoice])
        container:addItemOnServer(item)
    end
end

Events.OnRefreshInventoryWindowContainers.Add(onRefreshInventoryWindowContainers)
rancid tendon
#

eeeexcellent

#
    for i = 0, dummies:size()-1 do
        container:Remove(dummies:get(i))
        for i = 0, ZombRand(1 * SandboxVars.MFTEOTW.lootrarityfactorA)+1 do
            local itemChoice = ZombRand(#itemList)+1
            local item = container:AddItem(itemList[itemChoice])
            container:addItemOnServer(item)
        end
    end
end```

does this look like it would work or is integrating sandbox settings not something i'd be allowed to do in this segment
bronze yoke
#

that would work

#

this will have issues if SandboxVars.MFTEOTW.lootrarityfactorA isn't an integer

rancid tendon
#

it is!

#

specifically set it as an integer to avoid that, it's why i was asking about how to do that last night :p

#

@_@ it does not appear to have... restrained itself sufficiently

#

hmm

#

or wait.. this might be my drop settings maybe

#

gotta futz with some things, i kinda forgot to consider 'hey it might just spit out multiple of the blank cassettes which would then multiply into way more cassettes' so i've probably gotta turn that initial blank cassette drop chance down

#

actually wait--i'm getting turned around because i've been working on this a bit and staring at white screens for a couple of hours has a way of turning your brain into mush. if a container only has one entry in its drop table for an item, can it still spawn multiple of that item if the chance is high enough?

bronze yoke
#

i don't think so

rancid tendon
#

then i'm not sure what happened here.. hm

#

i only have one entry for each container type

#

and the sandbox setting was set to 2

bronze yoke
#

huh... it should only be able to spawn 2 then

#

(or 1, at an equal chance each)

rancid tendon
#

this is causing me Acute Brain Madness i have no idea what's breaking it now

bronze yoke
rancid tendon
#

here's the full thing

bronze yoke
#

i don't think this is the issue, but you should remove the Events.OnRefreshInventoryWindowContainers.Add(onRefreshInventoryWindowContainers) line near the end of the file and this function

-- for items found on zombies
local function onRefreshInventoryWindowContainers(inventoryPage)
    if not inventoryPage.inventory or not instanceof(inventoryPage.inventory:getParent(), "IsoDeadBody") then return end
    replaceDummies(inventoryPage.inventory)
end```as they're made redundant by some of the code you just added and i'm not sure what will happen if you have both
rancid tendon
#

done!

#

so since it's

#

(1 * SandboxVars.MFTEOTW.cassetteDropNumberA)+1

#

does that actually mean that, by default, the max would be 2?

#

oh yeah it's still totally broken.. hmf, it's wild, i wasn't expecting this to be this tough! seems like there's always somethin

fiery pecan
bronze yoke
rancid tendon
#

oooh i see

#

but yeah, just seems like one of those days where the code refuses to cooperate--absolutely nothing i've tried has worked as it should lol

bronze yoke
#

yeah i really don't get this one

rancid tendon
#

are... some containers considered to be multiple kinds of container? i suppose i should ask

bronze yoke
#

yeah i think so

rancid tendon
#

... that

#

might be why

bronze yoke
#

i'm not sure if it takes from multiple loot tables or chooses one though

#

either way, lootzed should show which tables that container can have

rancid tendon
#

ah yeah, that's not the problem then

#

this one is just BedroomSideTable and it has 9 cassettes in it when it should have 2 :p

#

vexing.. urgh

#

the worst part is both methods of implementing this system have run into inexplicable dead ends where no one can figure out what's causing it @_@ what a frustrating outcome

#

i guess i'll just come back to this one another day and try it again from the top

bronze yoke
#

yeah that seems best

astral dune
#

this is weird, if I do speed = Vector2.new(x,y):normalize() I get a float, but if I do speed = Vector2.new(x,y); speed:normalize() I get a Vector2

bronze yoke
#

the javadoc says it returns a float, but does that even make sense?

#

what does the float represent?

astral dune
#

looks like a length, tbh

#

ya its length

#

I got so used to the vector methods returning this that I didn't notice the normalize doesn't

bronze yoke
#

that doesn't make sense

#

normalising a vector makes its magnitude 1... that's the whole point

astral dune
#

yes, the method normalizes the vector, and returns its original length in case you wanted to do something with it

bronze yoke
#

i see

astral dune
#

the vector I'm getting is wrong anyway, the velocity at the point the crash happens has already been altered. Gonna see if BaseVehicle.lastLinearVelocity is still accurate

#

also gotta figure out how to use IsoSprite.RenderGhostTileRed so I can try and display what I'm doing for debugging, but thats tomorrow me's problem

ruby urchin
#

did you try using Vector2f or Vector2i?

astral dune
#

just used the basic Vector2, although I'll likely just move the math to the lua side instead, since I'm converting the Vector3f to 2D anyway

#

or I may just scrap the vector stuff altogether since the vanilla code doesn't use it. In the vanilla code, if you collide with something while driving, everything around the vehicle takes damage, even if they're not really touching. You can see it the most clearly if you run into some trees, you'll see trees off to the side and behind you shake too

rancid tendon
#

testing something i didn't think to test: whether or not it's the sandbox setting in the field fucking up the ZombRand field

#

that'll at least narrow things down a little bit if it is

#

yeah this is driving me crazy i have NO idea why it's broken

#

i set it to only 1 like the normal default, i removed all the loot entries on the table except for one just to test it on a single container, and just for no reason it seems to vomit cassettes into every loot source it applies to

#

i cannot for the life of me figure out wtf it is doing or why

bronze yoke
#

i'll have a closer look at it tomorrow, maybe i'll be able to work it out

rancid tendon
#

when you do

#

here's the latest minimalist version i used for testing

#

hopefully u spot somethin!! thank u for all the help albion

bronze yoke
#

of course ^_^

whole yoke
#

Trying to make a melee mod and whenever i try using the weapon, weapon appears but the model doesnt.. Works still as a weapon though (Also comes up with this failing to load the model)

#

Also everything is name correctly by EthanCleaver.

#

Texture and .X file

late hound
#

double check, change, restart game to test

whole yoke
late hound
#

yes

#

or what wrote in your script

#

the disconnect is in that area

whole yoke
#

I'll post what i have in the script, pretty sure I have everything right.. Model is in models_X\weapons\2handed

#

And texture is in textures\weapons\2handed

#

Script is in scripts\weapons

#

module Base
{
item EthanCleaver
{
MaxRange = 2,
WeaponSprite = EthanCleaver,
MinAngle = 0.8,
Type = Weapon,
MinimumSwingTime = 3.5,
KnockBackOnNoDeath = TRUE,
SwingAmountBeforeImpact = 0.03,
Categories = Axe,
ConditionLowerChanceOneIn = 15,
Weight = 1.5,
SplatNumber = 4,
PushBackMod = 1,
SubCategory = Swinging,
ConditionMax = 25,
MaxHitCount = 4,
DoorDamage = 55,
IdleAnim = Idle_Weapon2,
SwingAnim = Heavy,
DisplayName = Ethan's Cleaver,
MinRange = 0.8,
SwingTime = 2.6,
KnockdownMod = 2,
SplatBloodOnNoDeath = TRUE,
Icon = BaseballBat,
RunAnim = Run_Weapon2,
TwoHandWeapon = TRUE,
BreakSound = BreakWoodItem,
CriticalChance = 40,
critDmgMultiplier = 2,
MinDamage = 1,
MaxDamage = 2,
BaseSpeed = 0.96,
WeaponLength = 0.75,
AttachmentType = BigBlade,
}
}

ruby urchin
#

did you register the model?

whole yoke
#

I did make the model, just sorta slapped it as a .X file matching it with a other model (baseball bat)

#

Thank you for the help btw ๐Ÿ™

ruby urchin
#

I mean, create a model on scripts something like this

module Base
{
    model EthanCleaver
    {
        mesh = weapons/2handed/YOURMODELFILE, /* Model patch ~models_X/.. */
        texture = weapons/2handed/YOURTEXTUREFILE, /* Texture path ~textures/... */
        scale = 1.0, /* Directly related with size model on blender */

        /*  Where will the weapon be at rest */
        attachment world 
        {
            offset = 0.0000 0.1630 0.0000,
            rotate = 180.0000 0.0000 180.0000,
        }
    }
}
whole yoke
#

Ohhhh i swear i saw that on a wiki somewhere just thought that was for worlditems for something

#

No i did not do that but tyvm!

ruby urchin
#

yeah, just find the script model of the weapon you are basing it on and copy it

whole yoke
#

Alright thank you, time to go through the process of trial n error ๐Ÿ˜‹ ๐Ÿคฃ

#

Which is what i heard from rumors; offset and rotate

little iron
#

Is there a modder who accepts commissions here?

bronze yoke
#

what do you have in mind?

little iron
#

A single firearm

#

With vanilla stats in mind, stat wise it would be the same as an m16

bleak grotto
#

Hello

I want to make a mod that will make the cooler bag run on battery. Is there anyone who can help with this

ancient grail
#

Or you can use moddata

bleak grotto
#

I know this, but when I change the type of the bag, the items are not put in it

#

Us Delta can only be used in Drainable

calm estuary
#

Is there a complete guide on pz modding

flint beacon
#

How would i be able to trigger a sprite change for a custom tile that ive added? something similiar to how the rain barrel sprite changes after water has gone into it.

im trying to work on a upgradeable workbench so it can have different recipes for every tile

fast galleon
#

Depending how different it is, you might use an overlay sprite. That's how containers like shelves change for example based on items inside.

high citrus
#

hi, is there a way from lua to retrieve all the players? There's GameClient::getPlayers() but it looks like GameClient is not exposed ๐Ÿ˜ฆ

#

(I need to check if players have radios)

fierce cipher
#

Is it easy to lock a bag to only holding one type of item? Like a quiver for crossbow bolts/arrows

#

Or a bag to hold a bunch of crafted spears?

ancient grail
#

The code you are looking for should be somewhere there
It lists all the players connected

#

If youre looking to players even if they are not connected check the database panel

fast galleon
ancient grail
#

is there a way to check if a specific coordinate is valid

#

like if its part of the map

#

i mean world

#

like maybe isValidSquare()

#

imade that up tho

fast galleon
#

When you fix a mod and people complain about the name somebody else gave it stressed

high citrus
ancient grail
#

getPlayerNum?

#

getSpecificPlayer()

#

?

high citrus
#

those are for local players

hearty dew
#

@high citrus

#

actually, use this newer version

#
for _, player in ipairs(SoulUtils.getPlayers(true)) do
  print(player:getDisplayName())
end
ancient grail
#

He has to require soul's mod to his mod?

hearty dew
#
tanukiUtils = tanukiUtils or {}

--[[
    Gets all players matching a predicate. The default predicate is all players that aren't dead.
    
    Usage example:
    local all_living_players = tanukiUtils.getPlayers()
    local all_players_named_bob = tanukiUtils.getPlayers(function(p) return p:getDisplayName() == "bob" end)

    Notes:
    getNumActivePlayers:
    - Singleplayer: number of local players in client (including all split screen players)
    - Client: number of local players in client (including all split screen players)
    - Server: 1, but getSpecificPlayer() calls always return nil on server
    
    getOnlinePlayers:
    - Singleplayer: nil
    - Client: lists all players (including split screen players)
    - Server: lists all players (including split screen players)
    
    getConnectedPlayers: trash. only seems useful for working with scoreboard?
    - Singleplayer: 0
    - Client: only updates when a player manually open scoreboard, but lists all players then
    - Server: 0
]]
tanukiUtils.getPlayers = function(predicate)
    local result = {}
    predicate = predicate or function(player)
        return not player:isDead()
            -- and player:getCurrentSquare() -- Will filter out players sufficiently far from client that their square isn't loaded
    end
    if not isClient() and not isServer() then
        -- singleplayer
        for i = 0, getNumActivePlayers() - 1 do
            local player = getSpecificPlayer(i)
            if player and (predicate == true or predicate(player)) then
                table.insert(result, player)
            end
        end
    else -- multiplayer
        local onlinePlayers = getOnlinePlayers()
        for i = 0, onlinePlayers:size() - 1 do
            local player = onlinePlayers:get(i)
            if player and (predicate == true or predicate(player)) then
                table.insert(result, player)
            end
        end
    end
    
    return result
end
#

No, tanuki just needs his mod now :p

#
for _, player in ipairs(tanukiUtils.getPlayers(true)) do
  print(player:getDisplayName())
end
high citrus
#

@hearty dew thanks ๐Ÿ‘

thick karma
#

What is the simplest way to store Lua data on the server side and access it from the client side? Do I need to set player variables and store raw strings or is there a better way for transferring a Lua table from server to client?

hearty dew
#

Mod data is probably the simplest. Could also simply send the table as an argument in a client command if it isn't necessary to persist the table

thick karma
hearty dew
#

Yea arguments can be sent via server/client commands with the caveat that only basic lua types will be sent (tables, strings, numbers, booleans, etc). userdata (java objects) poof when sent

astral dune
#

keep in mind the table has to be fairly simple. No java objects, or multiple copies of the same reference

#

err, missed that Tyrir mentioned the java objects already

#

if you have the same reference to something multiple times in the table they will become independent copies once passed

gaunt meteor
#

so zombie textures can have alpha and it will apply ingame already?

#

like uh missing arm etc

#

i THINK i read something about this here before

#

oh nvm nvm i found the comment

#

also im in the wrong channel coz it was in #modeling lol

thick karma
#

@astral dune Understood, thanks for the input.

#

Can I send a server command directly to a player? Or do I just need to let clients catch the command? I want to tell players to store some data as soon as they join a server...

#

Would be preferable not to update all of them

astral dune
#

SendServerCommand has two versions, I believe, one with a player argument and one without

thick karma
#

@astral dune Sure enough, thanks hero

#

So on serverside can I just catch OnConnected on any player who connects and send them a command?

#

Or does OnConnected only fire clientside?

bronze yoke
#

you can request moddata from the client

#

if you're not using mod data then you can basically do the same thing by sending a client command that gets the server to send a server command

bronze yoke
#

does anyone know why an item's type might be different from the script? i was helping someone with strange behaviour on their mod and the issue ultimately turned out to be that an item, base.testitem, was coming out as base.test despite it being defined correctly as far as i can see

fast galleon
#

could be for compatibility with legacy mods, a lot of Java code that interacts with mods/script has some specific cases where it converts things to more recent type

ruby urchin
bronze yoke
#

ah, that'll be it

ripe warren
#

thanks I hate it

oak dagger
#

How do I put more RAM into Project Zomboid?

quasi kernel
#

Is there a reliable way to type check?

#

I've tried

 local isDrainable = instanceof(trueItem, "Drainable") or instanceof(trueItem, "DrainableComboItem")

to no success

bronze yoke
#

InventoryItem:IsDrainable()

quasi kernel
#

keeps returning false despite the fact that :getTypeString() is returning "Drainable"

#

Ah that works

#

Thank

#

wait I dunno if that'll work here

#

I'll try it but I'm unsure if this is an InventoryItem

#

It's not, it's an Item.

#

My fault there for not providing more context though

#

lemme post more code

#

I would've formatted it in discord but it would've looked off

bronze yoke
#

well that's your problem, Items are always just Items, drainables and other types like that extend InventoryItem so checking their class won't help

#

if getTypeString() returns 'Drainable', can't you just use trueItem:getTypeString() == 'Drainable'

quasi kernel
#

I suppose so, I just was wondering if there was a better way to handle it.

bronze yoke
#

you could use getType() and compare that to the static if that's exposed, but that seems like it would complicate things

quasi kernel
#

Probably, guess I'll just use getTypeString and do a comparison there.

#

Thank you, sorry for any trouble hehe

bronze yoke
#

something like trueItem:getType() == Item.Type.Drainable

quasi kernel
#

I'll try that, it just feels more properly integrated that way.

bronze yoke
#

yep, that's exposed

#

i know what you mean, it just feels more professional when you're not using a string lol

quasi kernel
#

Yeye!

#

I know it makes virtually no difference because of how the code is set up but it matters to me!1

#

Strangely didn't seem to work, Item.Type returned nil.

#

I imagine the :DoParam() route would be the best way to do it, least incompats

astral dune
#

spent the last couple hours writing a tool to output a simplified scan of an area to the debug, using unicode box drawing characters. Turns out lua hates unicode and I had to scrap it, lol

quasi kernel
bronze yoke
#

isn't the firing speed tied to the animation? might be complicated

astral dune
#

well the upside is string comparisons are O(1), so comparing typestrings will be quick

quasi kernel
#

Well that's nice

bronze yoke
#

that's kind of strange... it *is* exposed, but you can't just reference it

astral dune
#

is item.type static?

bronze yoke
#

i doubt there's any getter for it, so the only purpose it can really serve being exposed is that you'll be able to call its functions if you get an instance of one

quasi kernel
#

yeup, static

bronze yoke
#

its functions that... don't really do anything

astral dune
#

hmm, usually static fields are easily accessible, but maybe not the instance fieldof a static field. I imagine you can use reflection to get it if you REALLY want to

bronze yoke
#

i tried a few sneaky ways to get it but i couldn't find anything

#

i'm not too into reflection though so i'm sure i could have missed it

flint beacon
bronze yoke
#
IsoObject:setSprite(spriteName)
IsoObject:transmitUpdatedSpriteToClients() -- if this code runs on the client, use IsoObject:transmitUpdatedSpriteToServer() instead
quasi kernel
#

NOO ITEM CAN'T HAVE MODDATA

#

sobbing

#

I guess I could do a cheaty method but it's like bleh

bronze yoke
#

why do you need item to have moddata?

quasi kernel
#

So I can store it's "getReplaceOnDeplete" data while still having "setReplaceOnDeplete" be nil.

#

I'm wanting to override replacement behaviour to only occur when the battery is removed, rather than when the item runs out.

#

I still need to store the item it turns into, though.

#

Only idea I have is a dictionary.

bronze yoke
#

trueItem:DoParam('oldGetReplaceOnDelete = ' .. oldGetReplaceOnDelete)
will make every InventoryItem of that item start with getModData().oldGetReplaceOnDelete = whatever

quasi kernel
bronze yoke
#

any unrecognised parameters become default mod data

quasi kernel
#

DoParam my beloved

#

I thank thee once again

#

IT WORKS

#

THANK YOU!!

stray basalt
#

Yo hey is there a mod that adds a negative trait where it gives your player dementia? like for instance once in a while your character forgets where he is and all tiles that have been viewed turn unviewed (turned black) and you'd have to view the area again, kinda like reloading a save?

#

if not, theres an idea for anyone. i think it would make the use of maps even more useful?

ripe warren
#

its a cool idea but like you said, this happens anytime you load up a save anyways so technically everyone already has dementia. I think it would be an annoyance more than anything

#

I do like the idea of dementia,

#

maybe having dementia means you sometimes forget about some items in your inventory and you need to "search" trough your bags to make items appear again. Or some skills might decay and go down in XP/level if not used for a while.

#

having to re-read magazines because you forget how to operate a generator and stuff like that

thick karma
#

Is using the OnCreate function of a recipe a pretty standard way for adding functions to items, or is there a more direct way to add a selection to the item's context menu that triggers a function?

ancient grail
#

When doing IStimedbasedAction
How do i force the player to equip a tool

ripe warren
#

Is there an event that triggers every second or every game tick or generally an event that triggers all the time consistently ?

bronze yoke
#

note: this doesn't pass an IsoPlayer like the wiki says, it passes a player num - my pull request to correct this hasn't been noticed yet

#

OnTick

ripe warren
#

thank you

#

The parameter on tick. Does that return the total number of ticks? Or what exactly does that return?

thick karma
bronze yoke
#

all four context menu events are incorrect in this way

bronze yoke
ripe warren
#

I see, thank you

blissful salmon
#

Is there a way to clone a shirt and make it a new item with my own texture? So far I didn't understand how the item from scripts/clothing/ are connected with the model and the texture.

  item Shirt_FormalWhite
  {
      DisplayCategory = Clothing,
    Type = Clothing,
    DisplayName = Formal Shirt,
    ClothingItem = Shirt_FormalWhite,
    BodyLocation = Shirt,
    Icon = ShirtGeneric,
    BloodLocation = ShirtLongSleeves,
        Insulation = 0.25,
        WindResistance = 0.15,
        FabricType = Cotton,
        WorldStaticModel = Shirt_Ground,
  }

I assume I have to use the ClothingItem "Shirt_FormalWhite" and lookup the Shirt_FormalWhite.xml under clothing/clothingItems/

<?xml version="1.0" encoding="utf-8"?>
<clothingItem>
    <m_MaleModel></m_MaleModel>
    <m_FemaleModel></m_FemaleModel>
    <m_GUID>ac7976de-2c73-44ea-9392-5d24ac1fb649</m_GUID>
    <m_Static>false</m_Static>
    <m_AllowRandomHue>false</m_AllowRandomHue>
    <m_AllowRandomTint>false</m_AllowRandomTint>
    <m_AttachBone></m_AttachBone>
    <m_BaseTextures>clothes\shirt_tshirt_textures\shirt_formal</m_BaseTextures>
</clothingItem>

If this is correct... What can I do then?

fast galleon
ripe warren
#

how does one use the OnUseVehicle event? When I enter a vehicle my function doesnt trigger.

#

and does it trigger continuously every tick or does it just trigger once like OnEnterVehicle?

blissful salmon
fast galleon
#

it's the function declaration in vanilla

#

to make clearer what the arguments are

zealous wing
#

I got a question: Is there a (relatively simple) way to include water from a sink/water source into a recipe? For example:

        {    
            Toothbrush,
            Toothpaste;1,
            Water=1,
            
            Result:Toothbrush,
            Time:500.0,
        }```
#

Is there a way to replace the Water=1, with something that will refer to a water source as well, and not just any bottles/etc in your inventory?

ancient grail
#

@fast galleon @balmy prism where do i put this? on the isValid?
or start?

#

cuz i see other actions make the player take the inventory and equip it

thick karma
#

So when I hook into OnFillInventoryObjectContextMenu, I can see the list of options in table.options, but how do I actually add an option to that table? I'm not seeing it ๐Ÿ˜ฆ

#

I tried just setting the next options value to an object and giving it a name, but it gets overwritten next time I right-click...

#

So clearly that's wrong

ancient grail
#

the knife here is it a param on the context menu?

#

cuz im using shovel

balmy prism
#

Did he just ping two random people?

thick karma
#

Hold on I think I see... context:addOption(getText("ContextMenu_CheckMap"), map, ISInventoryPaneContextMenu.onCheckMap, player);

#

Stuff like that

#

Maybe making sense now

ancient grail
ripe warren
#

pinged the wrong soul I think

blissful salmon
# ancient grail iment this soul

i used it like this:

        local knife = player:getInventory():getFirstEvalRecurse(predicateKnife)
      ISWorldObjectContextMenu.equip(player, player:getPrimaryHandItem(), knife, true)
local function predicateKnife(item)
  if item:isBroken() then return false end
    return item:hasTag("SharpKnife") or item:getType() == "SharpKnife"
end
ancient grail
#

heres what i have earlier

ripe warren
#

I am really confused. Are the "OnUseVehicle" and "OnExitVehicle" events just broken? they cause my game to black screen every time I boot it up if my script incudes those events

ancient grail
bronze yoke
#

you should check for and equip the item before the action starts, that's how vanilla usually does it

#

don't add the context option if the player doesn't have the item, and have the context option queue the equip action before the main action

#

if it's already equipped it'll just skip the action

quasi kernel
#

Does DoParam always pass as a string or is there a way to make it pass booleans?

blissful salmon
#

My code is also from the "click" Action on the menu. In the valid function I just check if it's still there.

quasi kernel
#
trueItem:DoParam("batteryRemoved = true")
#

Doing this for an item sets "true" to a string which is.. undesired.

blissful salmon
#

is batteryRemoved a customAttribute? If yes, you could parse the string by yourself.
I never used booleans so far. Maybe someone else knows more.

quasi kernel
#

batteryRemoved is intended to be mod data yes

bronze yoke
#

it'll check if it can be converted to a double, otherwise it'll be a string

blissful salmon
ancient grail
#

Im not sure if my mod has bugs for now i got it work whew.. it doesnt auto equip yet but aslong as it works. Lol

blissful salmon
ripe warren
#
function PlayerSay()
        local player = getSpecificPlayer(0);
        
        player:Say("Exit");
end

Events.OnExitVehicle.Add(PlayerSay)

This script causes my game to hang on a black screen when booting up. Why is that? Is the event that I am using just broken?

thick karma
#

@bronze yoke Thanks again for the crumb, I got it figured out now.

blissful salmon
ripe warren
ancient grail
#

Im not sure what i did lol. Im really not used to doing timed action

I made bunch of tweaks so i cant remember. Plus is almost 6am here .. another long day finished...

Albion might be right about the check before the action thing. I didnt test it without the equipped jtem
Or item in the inventory or floor
But all i know is that if i right click the context menu is always there

I couldnt remove it as easy as OnTest

Its very diffrent coding for me.. need to study this somemore

Thnx alot guys ๐Ÿซก๐Ÿ™

blissful salmon
#

In .."userprofile"\Zomboid\ folder.

blissful salmon
ripe warren
#

I am

blissful salmon
# ripe warren

Nvm you already found it... Wanted to post "%userprofile%\Zomboid"
Which is line 7 of your script?