#mod_development

1 messages ยท Page 69 of 1

robust jetty
sour island
#

If that's what you're asking

robust jetty
#

i leave it empty, and it stores only one, i dont have index so cant access to next index

sour island
#

if you use table.insert(table,value) you don't need to count or index stuff

robust jetty
#

mm i will try, ty

sour island
#

your original issue is that you're starting the count on 0 and indexing 0 in Lua btw

jagged ingot
#

Thanks!

sour island
#

but again, you dont need to do all that anyway

jagged ingot
#

I ended up spending my entire day yesterday coding a CSS color library for PipeWrench. ๐Ÿ™‚

sour island
#

Oh nice, this is for the UI editor/API?

#

I used to mess around on this engine called BYOND - they have a pretty nifty UI editor - drag/drop stretch etc

#

Would be pretty wild to have something similar in PZ

jagged ingot
#

The prototype for the UI is working.

sour island
#

Also, finally managed to get the banking system to how I like it - I was overthinking it as always lol

jagged ingot
#

I'm actually writing a small HTML engine that runs through the UI engine of PZ.

sour island
#

Right click 'assign bank' automatically assigns it to 'none' faction which lets all people with a faction use it - defaulting to their own faction. Originally I had it do a limbo state thing like the shops have - waiting to receive which faction they're linked to. Then also allow to toggle on faction-locked.

sour island
robust jetty
#

All the big ones have Mango in his name?

#

ilMango

#

DeltaMango

#

who is next

jagged ingot
#

I'm going to upload my progress soon.

#

The HTML will use only elements made specifically for PZ.

#

Someone gave me this idea about half a year ago. Glad I remembered it.. it might end up helping out a lot of people who have trouble working with the current in-game ISUI library.

robust jetty
#

True, there is almost nothing documented on how to create uis

#

im trying to create a new folder in inventory, didn't found anything, only persons posting quiestions

#

plus is my first mod, it goes very slow

jagged ingot
#

I've spent a couple hundred hours with UI over the years.

#

I might also provide a client-side patch that adds "experimental tools" for things like adding GLSL shader support.

#

I'd kill for a UI that can render as frosted-glass.

#

The thought of seeing that in-game drives me crazy.

robust jetty
#

it would be historic

sour island
#

So I think I figured out why money keeps reappearing in containers for people

#

If the item is removed it reverts back to the stack - itself

#

but those items shouldn't exist either... how/why the does the game know they exist(ed)

#

๐Ÿค”

jagged ingot
#

I wrote a UI to rewrite the multiplayer chat a while ago, but essentially I have the same thoughts about what I could do right now.

sour island
#

Discord integration for deaths are pretty great to see - I've only seen it in 1 server

#

reminds me of an old roguelike named ELONA

#

it was single player but for some reason the dev added death messages over the net

#

so once and a while you got 'Chuck was killed by a slime.'

jagged ingot
#

Yeah.. Discord integration was something useful for moderation.

#

Pushed all local chat to a hidden chat channel too..

#

All commands for another channel.

#

There was even a thing I built into that chat that hooked up to the Google Translate API. We literally had people who could never talk to eachother playing in groups.

robust jetty
#

I'm learning how to make mods because there are few UI mods, now I'm making one that separates equipped items into a new category, no new windows or anything. It's my first mod so I'm aiming for something reasonable, but my goal is to do something like this, maybe you'll be interested

#

grid inventory, i see it too hard but the rest i think is possible

jagged ingot
#

I think that making a HTML element for handling radial menus will be so helpful.

jagged ingot
#

Reminds me of STALKER.

#

STALKER & Resident Evil.

robust jetty
#

Yes, i want to make something like that, but i still learning

sour island
#

I like the idea of a grid system but I think I'd aim for something like NEO scav

#

If I were to redo the inventory system I'd strip away the player inventory to be hands only - anything else would come from pockets/clothing

jagged ingot
#

I like the current inventory system overall, although there'd be things to fix for sure.

robust jetty
#

The person who created the image got the idea from Neo scav

sour island
#

Yeah, just realized the left side isn't the player inventory lol

jagged ingot
sour island
#

I like the image more

neon bronze
#

Is there a way to find out if the clothing is worn by player currently?

steep flume
#

Does Aiming Time really affect anything?

jagged ingot
#

Make me Grim World in PZ.

sour island
#

I think the current system could work if they had each row show the bag as a header row and the items inside for contents

#

but the stacking code would cause conflicts I imagine

jagged ingot
#

I like the idea of a "quick look" UI for inventory.. but a detailed look would be nice too.

robust jetty
jagged ingot
#

A capacity weight feels too arbitrary for my tastes..

#

I'd use that along with items taking up a grid space.

#

What would be cool is if backpacks and luggage had multiple grids for pockets and compartments.

jagged ingot
#

It would make rushing in a situation while trying to gather stuff more immersive.

#

This could be done right now as a mod.

robust jetty
#

grid inventory is possible?

sour island
#

some factoring of item size would be nice

sour island
robust jetty
#

Nice

jagged ingot
#

Item mod-data would be useful in this case.

sour island
#

You could approximate sizes based on their weight and category

jagged ingot
#

I can see this being a fairly simple mod.

sour island
#

and have exceptions

robust jetty
#

No more shelves on inventory xd

sour island
#

Like weapons have a range stat you can use to determine width size

jagged ingot
#

What a exciting and creative morning.

sour island
#

Would cover most other mods

jagged ingot
#

Of course I'd make it in my silly HTML engine.

#

This is my test code right now for it:

/** @jsx PipeWrenchUI.createElement */

import * as Events from '@asledgehammer/pipewrench-events';
import { PipeWrenchUI, createUI } from '../../shared/pipewrench-ui/React';

Events.onMainMenuEnter.addListener(() => {
  createUI(
    <element
      class="my-element"
      style="top: 64px; left: 64px; width: 50%; height: 512px; background-color: #80ced6;"
    ></element>
  );
});
dapper geode
#

Hello, I have a question regarding the distribution of items and vehicles. I found that mods use lua scripts to distribute items and vehicles, and I want to make a patch to remove spawn items and vehicles, is it possible to override the lua script with the same file name in a different mod folder?

jagged ingot
#

I think something like this would be good for radial menus:

<menu type="radial">
  <menuitem title="Menu Item" tooltip=".."><img />Description</menuitem>
  ..
</menu>
sour island
#

pretty neat stuff

jagged ingot
#

Only just found out that underground is already being developed officially. woot.

#

No need to play around with making fake underground layers using the void space of a map.

sour island
#

that's what RV and basements do afaik

jagged ingot
#

Thought I'd post this here.
Random idea for a mod: Advanced Electrician. Actually having UI where the player needs to diagnose realistic scenarios of broken electronics up to and including circuits.

#

Was thinking about how one could make an actual circuit with such a feature.

waxen bay
#

is there anything extra u have to do with a clothing mesh to set it up as tintable? like vertex colors or smth

#

or even with the png it uses, mine is a little sus and parts of it are dark though the texturechoices ones are all fine

drifting stump
bronze yoke
#

this was bugging me, and i finally got the chance to check it: minAngle is just your attack cone, it has nothing to do with hitting or missing, only target selection

agile vigil
bronze yoke
#

it's mostly relevant for melee weapons, since they're expected to hit within a cone, and for shotguns, since they can target multiple zombies at different angles

waxen bay
#

im p sure rifles also have a tiny minangle

#

for those times you can shoot a bunch of zombies that are roughly aligned in a row

#

unless that's a piercing property and not related to the hit cones

bronze yoke
#

all weapons have a minangle

#

aiming would be kind of annoying if you had to be perfect with it anyway

agile vigil
#

Anyone got some ideas for some fun stuff I can do with a diary mod?

I'm recording XP similar to Skill Recovery Journal, but I am limiting you to one day's worth of XP per entry, and similarly you cannot record XP that's, say, a week old.

I'd like some other fun ideas that don't result in "powergaming the system" too hard. For example, I was considering giving a buff to the most earned XP when re-reading the section (studying your learnings), but I don't want to do something like Oblivion's levelling system where you have to very specifically level stuff.

ancient grail
waxen bay
#

you have to use <m_BaseTextures> for a tintable item right? not <textureChoices>

ancient grail
waxen bay
#

texture is white but when i go ingame i think its just not loading the texture at all

#

it also has a 3d mesh if that matters

ancient grail
#

Could also entertain people

agile vigil
pulsar apex
#

i'm havin good issue with tile and worldzed as i said last night, when i launch worldzed from tilezed it brings up prefrences and no matter what i click it closes it

ancient grail
agile vigil
#

Entertain could be nice, too, yeah. Maybe if you hit certain thresholds you get a separate story in the diary, which you could copy to a notebook, or just tell orally.

ancient grail
#

U become proficient on one aspect u lost interest on the other ro atleast 1-2 levels max

#

Orally was the idea

#

Like a time based act for the teacher
And other players treat u like a radio

bronze yoke
#

might use that for literacy...

#

i already set up xp boost media codes for that mod so it's not much work

ancient grail
#

I have tons of doable ideas just dont have means to em stressed
I actually keep a list

To give an example
Electric fence trap
Tripwire alams
Panic Heart attack

agile vigil
#

Panic heart attack (or at least passing out for a while) would make a ton of sense.

ancient grail
#

Ye and if assited would get back up faster
But the person assisting will also endure a certain timebased lock
So theres heroism in mp

bronze yoke
#

thought that said heroin ded

agile vigil
# bronze yoke might use that for literacy...

This is probably a silly question, but you're so knowledgeable and you seem a good place to start.

I'm trying to change the number of pages in my diary whenever I add an entry, like so:

    diary:setCustomPages(diaryData.entryCount);
    diary:setAlreadyReadPages(diaryData.entryCount);

But I just get a nil error.

The diaryData is taken from diary, and they are both non-nil at this point in the code.

bronze yoke
#

custom pages isn't a number

#

it's a hash map of page number:text

agile vigil
#

Pft, well that explains it. I'll do setNumberOfPages instead.

I think I'm getting a nil error on line two as well, but that's probably because my diary starts off not having number of pages set at all.

bronze yoke
#

yeah, that one should be fine

#

setCustomPages is used for the diary/notebook/etc items you can write in

agile vigil
#

Yeah, that makes sense.

#

That somehow didn't work. Hm hm.

pulsar apex
#

alright now ive got it working however

#

i cannot now transfer bmp files into worldzed

#

trying to drag and drop as it says in the guide

#

but it no work

waxen bay
#

thx guys for answering all my questions i think i can publish my mod soon :3

pulsar apex
#

can anyone help me with worldzed for a bit?

#

just this one issue because there's not really any information available online for how to fix it

agile vigil
#

I would if I knew enough, MF.

I did find my nil issue, though, I was accidentally storing data on my pen instead of my diary.

bronze yoke
pulsar apex
#

thank you

vast nacelle
agile vigil
jagged ingot
#

Damn.. Just realized I can't set the TPS for the UI higher without modding the client.

bronze yoke
#

recipes are learned in the function ReadLiterature, which is always called from lua

#

you can decorate that method's metatable to grab recipes

vast nacelle
bronze yoke
#

i think recipes from tv go through IsoGameCharacter.learnRecipe actually

#

but those are the only two sources of recipes afaik

agile vigil
#

Fair point, both of you.

I think I'd prefer not to note down recipes learned from magazines (as others have made options to copy those magazines). It would be lovely to jot down recipes learned from other sources, however.

jagged ingot
#

aaaaaaaAAAAH

#

I can't set UI FPS to 60 through options.ini.

bronze yoke
#

i don't think there's any vanilla recipes that don't come from magazines, aside from a couple survivalist things that can come from tv in addition to a magazine - if a mod were to do it they'd probably use IsoGameCharacter.learnRecipe too

agile vigil
#

I think there's a few recipes that come from your Profession / traits.

#

Like trap recipes?

bronze yoke
#

those can be learned from magazines

agile vigil
#

They can, but I'd want to know for this player where they came from ๐Ÿ™‚

bronze yoke
#

well you can check their recipes on character creation

jagged ingot
#

Welp. Time to hijack the client code for limiting UI FPS...

bronze yoke
#

i suppose the engineer recipes can't be learned anywhere except the profession

vast nacelle
agile vigil
#

Wa-hey! I have been promoted to Builder rather than recruit. Lovely.

Maybe I'm fussing too much over the magazine thing anyway, it'd make sense that once you know (by heart) how to make something, you can.. Y'know, make it.

#

And thus write it down.

#

I also have to actually make reading the diary do things laugh

#

And figure out how to prevent (or allow?) other characters from reading it.

One of my goals, in addition to writing down details of just a single day at a time, is to ensure that you will not be able to cheese the XP recovery system by making one character, using the XP multipliers on that char, then intentionally dying, getting other XP multipliers, and immediately regaining all your XP.

jagged ingot
#

Ok cool. I found out that the update function in ISUIElement is called slower than if I can push updates through OnFETick. The one through ISUIElement isn't affected by the UI FPS.

#

Running some tests...

#

Hmm yeah I think it's best to use a tick event to update my UI.

#

I assumed that the option in settings would affect or improve UI tick stuff but it's just slow by default and doesn't change.

dim hill
#

Anyone knows of a mod that will respawn cars across the world?

dim hill
#

Thank you very much

#

Anyone knows of a mod that lets you come back to life with (some of) your skills levels?

Not journal, that mod is bugged

sour island
ruby urchin
#

almost ready an early release

agile vigil
opal rivet
opal rivet
#

I hope not

ruby urchin
#

I don't think for now, I need create a lot of animations, dog hit, zombie attack, etc.

jagged ingot
#

If you want to see my HTML prototype in action, here's a render of it. It's a mod you chuck in the mods folder. It simply renders an animating square on the main menu and fades with animations set by adjusting CSS style values like in JS.

drifting ore
#

tried putting everywhere

agile vigil
drifting ore
#

i did

#

im waiting now

faint jewel
agile vigil
#

I dunno, that's kind of cute.

jagged ingot
#

Going for the day. Hopefully someone finds my HTML tech demo mod interesting.

eternal garnet
#

Oh dear

#

I gave you two awards just now to cheer you up ๐Ÿ˜„

opal rivet
sour island
dim hill
#

Like there's an exploit

#

I don't quite remember the details

sour island
#

I would suggest using the mod, you can customize features as you see fit.

#

If you're worried about MP exploits there isn't a way to determine watched TV shows yet but you can set the return % to 75

#

Other than that there aren't any known bugs or exploits

dim hill
#

I've used the mod before, but players would unfortunately level via tv shows, journal write, etc then respawn and re read

sour island
#

If you set the return % to lower than what they'd get you should be fine

#

I worked on a fix but it didn't pan out at the time due to not being able to identify how much you get from TV

#

I might just overwrite the TV functions and call it a day

dim hill
#

With book reading that is

sour island
#

There's sandbox options to cap the return %

#

If you lower it to about 70% rewatching the TV shows wouldn't net more XP than lost

#

Although this isn't a perfect solution as it would still reward using the TVs

#

Afaik the amount of XP from VHS is the same regardless of what level you're on.

solid tundra
#

Within the PZ Server browser, I've noticed the PublicDescription= doesn't allow <LINE> or <BR>, but yet I've seen descriptions with neatly formatted information. Anyone know what the bbcode or short markup is for a line break in that .ini ? (Not quite sure if this goes here) - and for further clarification, I'm referring to the info/description you get to see of a server before you join it in the game's server browser.

dull moss
#

so back to inteliji kinks, any way to make .txt files fold {} regions?

obsidian widget
#

Quick question where can I locate the icons of the inventory items in my project zomboid folder?

drifting ore
#

is there a mod that allows you to have guns in hotbar without a holster

vast nacelle
neon bronze
#

Hey just a quick question: playerId is unique on mp servers right? If i use getSpecifPlayer on different players it will return different value each time right?

lyric turtle
#

Can someone make tutorials for stuff? I know there is a tutorial explicitly for making clothing, but its only written, and my small brain cannot follow simple steps, it would be pretty cool if it was shown to me as a video instead!

drifting stump
#

aka split screen characters

neon bronze
dull moss
#

can i do something like this

--lua1.lua
--stuff here

--lua2.lua
require lua1

--lua3.lua
require lua1
require lua2

if im not mistaken, its enough to simply require lua2 in lua3, right? since lua2 already requires lua1, right?

drifting stump
drifting stump
#

guessing you doing load order?

dull moss
#

yes + want to use local function that is in lua2 in lua3

drifting stump
#

for that you need to export them

dull moss
#

yes i know

drifting stump
#

and yes should be fine requiring lua2 only

dull moss
#

cool ty

neon bronze
#

Also there is probably a way to know if you are on a server or in sp right?

drifting stump
drifting stump
neon bronze
#

Ah so it returns true for isServer if the server executes the piece of code?

dull moss
#

can I remove events same way I add them?

#

Events.EveryOneMinute.Add(abc);
Events.EveryOneMinute.Remove(abc);

#

something like this

#

nevermind, found it in javadoc

#

wait are events supposed to have unique names?

#

cuz I've been linking them to local functions assuming that's enough

#

but I'm looking at Remove constructor and it takes event as argument

#

so like how does it work, can I remove events added by other mods if i accidentally have event with same name as they do?

drifting stump
#

?

#

you simply pass a reference to a function

#

you can then remove that reference

sour island
dull moss
#

KekW true

#

ye all my shit is local so should be fine

#

Chuck and Albion in chat at same time

bronze yoke
#

if it's global, both will still be added (assuming the function is added to the event immediately/at least before the other file reassigns it anyway)

dull moss
#

can I do something like this ?

--lua 1
lua1 = {};
local func1() end
return lua1;
--lua 2
local lua1 = require "lua1"
Events.EveryOneMinute.Add(lua1.func1)
sour island
#

Yes, but I'd be curious when you'd have/want to do that

dull moss
#

I'm glad you asked

#

<writes 3 paragraphs>

bronze yoke
#
--lua 1
local lua1 = {};
function lua1.func1() end
return lua1;
--lua 2
local lua1 = require "lua1"
Events.EveryOneMinute.Add(lua1.func1)
```the syntax is a little off, but yeah
dull moss
#

shouldn't lua1.func1() be local?

bronze yoke
#

lua1 is already a local table, anything in it is local

dull moss
#

ah

#

but it's fine if i still write it as local for consistency sake, right?

bronze yoke
#

my ide complains, not sure if it still runs okay or not

dull moss
sour island
#

I don't think you can do that without breaking whatever compiler you use

bronze yoke
#

yeah i'm seeing the same thing, i don't think it likes trying to use local in combination with a table index

sour island
#
local n = {foo = function() end}
#

I hate it

#
local function fun() end
local n = {foo=fun}
#

We should have a competition to make the ugliest Lua

dull moss
bronze yoke
dull moss
bronze yoke
#

it's an easter egg for anyone who looks at the code

dull moss
sour island
#

I too dabble in easter eggs

bronze yoke
#

LOL

dull moss
#

lmaoo

sour island
#

The guy maintaining SS made the player scream about 'incompatible' mods - one was swapit, but I couldn't find any issues with it.

#

Nolan mentioned he meant to delete that system entirely - not sure if he has had time to do so

dull moss
#

SS?

sour island
#

superb/super survivors

dull moss
#

havent tried it

#

is it good?

sour island
#

A while back a modder took on maintaining it - released a new mod for every patch (no idea why)

dull moss
#

seen the page ofc so i know whtat mod does but idk

sour island
dull moss
#

should try it PepeThink

sour island
#

Making NPCs is not an easy task by any means, and I think Nolan works on it when he can - however there's some stuff I saw that could be cleaned up

#

There's also alot of stuff he can't control that limit it's effectiveness

dull moss
#
    if not player:HasTrait("Outdoorsman") then
        Events.EveryOneMinute.Add(outdoorsman);
    end
end

can I somehow pass player into my outdoorsman func?

sour island
#

NPCs can't seem to operate on their own/maintain a open cell

dull moss
#

so i dont have to call local player = getPlayer(); inside of it

sour island
#

I'm very curious why the devs have in mind for this - if they offload it to a simulation I feel like there'd be alot more work - but making every single player game basically a server would be taxing on PCs

sour island
dull moss
#

I see

sour island
#

Yeah but programming conventions would probably suggest/expect you to simulate what you can

dull moss
#

tru

bronze yoke
#

they were doing a simplified offscreen simulation from what the blogposts sounded like

sour island
#

the really old blogpost?

bronze yoke
#

the more recent ones, from a couple months ago

sour island
#

I don't think I caught that one

#

The really old one was a good read

#

Oh yeah I missed this blog

#

Neat

bronze yoke
#

yeah this is what i remember

sour island
#

Figured out my issue with assigning banks

#

I was accidentally reseting the ID

wet sandal
#

Lua

#

Unless you want to get fancy

#

I'm sure others here can tell you more about whatever they've got going on in that regard.
I saw someone had a typescript setup.

dull moss
#

lua is fine though

#

at least for modding

wet sandal
#

Lua is great, you just gotta know the 'gotchas'

#

Which are numerous

sour island
#

Hey, love your hotbar mods

wet sandal
#

Ayy, thanks

dull moss
#

Chuck knows every modder out there

sour island
#

Just recognized his name lol

dull moss
bronze yoke
#

i honestly really like lua, except from when indexes start at one

dull moss
quasi geode
bronze yoke
#

oh gosh yeah

wet sandal
#

The length operator # is a bit surprising if you don't know how it counts "length"

sour island
#

I don't mind indexes starting at one but I'm also not well versed in other languages so 1 being first makes sense to me drunk

#

I do wish the arrays and lists had a mutual handler as people mentioned yesterday - like arrays working with pairs/ipairs

gloomy trail
#

hey can someone help me with mods ? ๐Ÿ™‚

robust jetty
#

I still cant copy a table on a variable, getItems() is type userdata when i try to copy it dosnt work

gloomy trail
#

i know how o put the mods in the game and stuff but i feel as if i need to change some settings

#

in police stations i barely get weapons

#

and ammo

bronze yoke
robust jetty
#

and if i want to copy 1 item of the arrayList ? i use getItems():get(i) in a for loop, so i get a java array of one item of the inventory, i want to put the filtered item with isClothing() on another arrayList.. how ?, sry if is a dumb question

sour island
#

Do you need it to be in another arrayList? It can be added to a Lua table

#

But you can also construct an empty ArrayList and use add I think

bronze yoke
#
local items = -- put however you're getting the arraylist here
local clothingItems = {}
for i=0,items:size()-1 do
    local item = items:get(i)
    if item:isClothing() then
        table.insert(clothingItems, item)
    end
end
```is this the kind of thing you're looking for?
#

this will loop through the arraylist items and put all the clothing items into the table clothingItems

#

that's a normal lua table so you can use that one normally afterwards

robust jetty
#

i used that one and dosn't work

bronze yoke
#

you need to initialise equippedClothes as a table first

#

on the first line, instead of local equippedClothes, use local equippedClothes = {}

sour island
#

Without '= {}' it's equal to nil/null/nothing

robust jetty
sour island
#

So it doesn't have an "insert" function or anything to insert it into

robust jetty
#

With {} it prints table0x14....

#

instead of an java arrayList

sour island
#

Yes you have to parse through the table to print entries

robust jetty
#

with a for?

sour island
#

for key,value in pairs(table) do

#

key in this case is the order since your not providing keys yourself

#

value would be the clothes

sour island
#

Not to be nitpicky but since you're also dealing with an array (Java) it can get confusing

robust jetty
#

Yes, now I understand the difference between a lua table and a java arrayList, that was the problem

dark wedge
#

Anyone know a way to set an Animation Mask on an item and have it stick? During a TimedAction I can set:
player.setVariable("LeftHandMask", "holdingitemleft")
But after the TimedAction is up or sometimes when another action is performed that variable is just unset. I've currently just been brute-forcing this via a Tick function to get it to stay, but this causes the item to bounce when its unset and is just a dirty solution. Everything I can find has this be defined on the item itself in a script file with no way to set it in Lua, but hoping I missed something.

#

Looking at bags and stuff which apply a mask on equip these are definitions in the ".txt" files. But that's not feasible when I'm trying to hot-patch everything, including mods.

bronze yoke
#

you can change scripts with lua

winter thunder
#

Anyone know where the traits are defined in the code? I want to see how they work :)

#

Not the trait factory to make new ones, but the already existing traits *

bronze yoke
#

shared/NPCs/MainCreationMethods.lua

winter thunder
#

Thank you!

wet sandal
#

A lot of trait effects are also just reactionary if statements peppered throughout the entire code base

bronze yoke
#

though if you want to see trait behaviour- yeah

winter thunder
#

Worst part, Iโ€™ve dug through that exact file so many timesโ€ฆ ๐Ÿ˜‚

bronze yoke
#

you'll be going all over the place for anything beyond an xp boost

winter thunder
#

Ohโ€ฆ shit

#

Ripโ€ฆ

dark wedge
# bronze yoke you can change scripts with lua

Are you referring to the DoParams() function? If so, I have tried that with no luck. The variable I need to set for it to work with that method is a JavaObject apparently so I can't add it with that. Also type "ItemReplacement" has no new function in Lua.

bronze yoke
#

yeah, looks like DoParam() doesn't have checks for that specific field - you can use Load() instead

dark wedge
bronze yoke
#

actually, i assumed the wrong name for that field, it does check for it

#

you're trying to change the animmask on an item, right?

dark wedge
bronze yoke
#

yeah, looks like the code for actually handling that is in Load โ€” a rare situation where DoParam isn't enough

#

it changes the value on the item, but doesn't actually do any of the stuff it needs to apply that

dark wedge
#

Yea, I could get a string to be set, but needed the object

bronze yoke
#

try ```lua
local item = ScriptManager.instance:getItem('Module.Item')
if item then
item:Load('Item', '{replaceInSecondHand=YourDesiredValue},')
end

#

the 'Item' in Load should be the name of the item without the module

winter thunder
#

Man this hurtsโ€ฆ trying to figure out what sort of variables I can mess with for the player, but they are all buried all over the placeโ€ฆ ๐Ÿฅฒ

robust jetty
#

any idea how to add button/tab/container to inventory ?

#

I can't find any related method

dark wedge
dark wedge
drifting stump
bronze yoke
#
      if (!StringUtils.isNullOrWhitespace(this.replaceInSecondHand)) {
         var4 = this.replaceInSecondHand.trim().split("\\s+");
         if (var4.length == 2) {
            this.replaceSecondHand = new ItemReplacement();
            this.replaceSecondHand.clothingItemName = var4[0].trim();
            this.replaceSecondHand.maskVariableValue = var4[1].trim();
            this.replaceSecondHand.maskVariableName = "LeftHandMask";
         }
      }
#

load concerns me a little as some of the other methods it calls don't sound like things you would want to run more than once (having not checked their code), but as far as i can see this is literally the only way to get this object created: there's no getter or setter, and even if there was the ItemReplacement object isn't exposed so you wouldn't be able to create one from lua

dull moss
#

is there any way to not have this thing printed twice

sour island
#

Printing twice is a known issue - started happening around when MP was released

drifting stump
dark wedge
# bronze yoke load generates this object based on the value of replaceInSecondHand

I have been trying to get this to work for a bit, but have not gotten the "Load()" function to cooperate. Keep getting an error about bad args. Regardless, I don't think that setting the replaceInSecondHand option is what I need here. If I understand correctly, I don't actually want the clothingItemName to be defined, just the maskVariableValue and the maskVariableName. This is how torches and umbrellas work by setting the secondaryAnimMask value in scripts so only the mask is applied. By chance, does the secondaryAnimMask also set the replaceSecondHand value when used with Load? If so, I'll keep trying to get this set this way.

bronze yoke
#

looks like it's expecting an array of strings, not one string, my bad

#

not really sure what format it's expecting - i copied the one vehicle scripts used

#

looks like it's just an array of strings in DoParam format, i've never had to construct one from lua before so i'm not exactly sure how to go about that

bronze yoke
winter thunder
#

Anyone know if there is a way to mess with the endurance regain rate?

#

Currently struggling looking for that one in the code lol

dark wedge
faint jewel
#

isn't there a vehicle shader that has alpha support?

bronze yoke
#

no

faint jewel
#

i mean on off.

#

i know ther eis one but i forget the name.

wet sandal
#

Damn, no rust buckets?

dull moss
bronze yoke
#

i think you just manually increase their endurance constantly? i don't think you can access anything better

dull moss
#

might be, never looked at that trait code

dull moss
#

write code as row of elseifs
don't wanna use brain
AI, help
send 50 lines of code that's 3k chars in length
AI gives back 1.3k symbols loop

#

what a nice time to live in

#
local thresholds = {
  {trait = "Cowardly", total = 0.1, melee = 0.05},
  {trait = "Cowardly", total = 0.2},
  {trait = "Hemophobic", total = 0.2, melee = 0.1},
  {trait = "Hemophobic", total = 0.4},
  {trait = "Pacifist", total = 0.3, melee = 0.15},
  {trait = "Pacifist", total = 0.6},
  {trait = "AdrenalineJunkie", total = 0.4, melee = 0.2, add = true},
  {trait = "AdrenalineJunkie", total = 0.8, add = true},
  {trait = "Brave", total = 0.6, melee = 0.3, add = true},
  {trait = "Brave", total = 1.2, add = true},
  {trait = "Desensitized", total = 1, melee = 0.5, add = true},
  {trait = "Desensitized", total = 2, add = true},
}

for _, threshold in ipairs(thresholds) do
  if (threshold.add and not player:HasTrait(threshold.trait)) or (not threshold.add and player:HasTrait(threshold.trait)) then
    if (threshold.total and totalKills >= braveryKills * threshold.total) and (not threshold.melee or meleeKills >= braveryKills * threshold.melee) then
      if threshold.add then
        player:getTraits():add(threshold.trait)
        HaloTextHelper.addTextWithArrow(player, getText("UI_trait_" .. threshold.trait), true, HaloTextHelper.getColorGreen())
      else
        player:getTraits():remove(threshold.trait)
        HaloTextHelper.addTextWithArrow(player, getText("UI_trait_" .. threshold.trait), false, HaloTextHelper.getColorGreen())
      end
    end
  end
end```
#

0 brain coding letsgo

bronze yoke
#

desperately looking for a flaw in this code so that i'll still have a job in a year

dull moss
#

this was initial approach

#

yes i know its trash

bronze yoke
#

๐Ÿ˜Ÿ

dull moss
#

oh actually i didnt need to do elseif inside again could have jsut combined into single if

#

lemme see if i do that and give it to ai if it will generate different code

#

6 am coding == quality coding

drifting stump
dull moss
wet sandal
#

I'm for it

#

Just move to the role of directing the AI

bronze yoke
#

i'm not @_@

drifting stump
#

more jobs for me XD fix performance and better integrate ai generated systems

dull moss
#

ok if I shorten my initial code it gives prettier code back

#
local thresholds = {
  {trait = "Cowardly", total = {0.1, 0.2}, melee = 0.05},
  {trait = "Hemophobic", total = {0.2, 0.4}, melee = 0.1},
  {trait = "Pacifist", total = {0.3, 0.6}, melee = 0.15},
  {trait = "AdrenalineJunkie", total = {0.4, 0.8}, melee = 0.2, add = true},
  {trait = "Brave", total = {0.6, 1.2}, melee = 0.3, add = true},
  {trait = "Desensitized", total = {1, 2}, melee = 0.5, add = true},
}

for _, threshold in ipairs(thresholds) do
  if (threshold.add and not player:HasTrait(threshold.trait)) or (not threshold.add and player:HasTrait(threshold.trait)) then
    for _, t in ipairs(threshold.total) do
      if totalKills >= braveryKills * t and (not threshold.melee or meleeKills >= braveryKills * threshold.melee) then
        if threshold.add then
          player:getTraits():add(threshold.trait)
          HaloTextHelper.addTextWithArrow(player, getText("UI_trait_" .. threshold.trait), true, HaloTextHelper.getColorGreen())
        else
          player:getTraits():remove(threshold.trait)
          HaloTextHelper.addTextWithArrow(player, getText("UI_trait_" .. threshold.trait), false, HaloTextHelper.getColorGreen())
        end
        break
      end
    end
  end
end```
#

although

bronze yoke
#

for small stuff like this ai is definitely going to take over but ai can't write a game yet

dull moss
#

true

#

or a mod for PZ

#

therefore we're all better than AI

wet sandal
#

I use GitHub copilot for anything UI related because I can never remember all the fields for the constructors of the ISUI stuff

bronze yoke
#

i get around this issue by never writing ui ever

#

if it involves ui someone else can do it LOL

wet sandal
#

I just comment in detail what I need then ask the AI to fill

#

It makes small mistakes, but they're easy to fix

drifting stump
#

am i really the only person writing uis

wet sandal
#

I do it with assistance

#

It's just very tedious without a layout manager

drifting stump
#

ive talked about it before how i like the way it is right now because it gives maximum freedom

bronze yoke
#

i'm sure if i did it a bit more and became more familiar with it it'd be okay, but none of my mods have really needed any and the system is scary from the outside

wet sandal
#

Although my current WIP mod is a massive inventory overhaul

#

Doing most of that myself

drifting stump
#

but im also that one dude who enjoyed writing asm so probably not a good example

#

if only i could design uis

wet sandal
#

That's the hard part for sure

#

I just iterate

drifting stump
#

been hitting my head against the table trying to get a design for the crafting menu

wet sandal
#

I don't know what's good, but I know if it's bad

dull moss
#

um

#

anyone knows if we can use code generated by AI in our stuff?

bronze yoke
#

not sure about the site you're using, but those sites love pulling a 'we own everything the ai generates *and* everything you put into the ai'

dull moss
drifting stump
#

im sure rj will bring down the wrath of his chickens upon you

dull moss
#

all good

dull moss
drifting stump
#

they are menacing

wet sandal
#

I pay for GitHub copilot, so I'm good to use the outputs by their license.

astral dune
#

recent ruling by somebody important says that copyright requires human authorship so you can't copyright anything made by an AI anyway

wet sandal
#

I don't know how I'd feel about asking an AI to give me a full implementation though.

Copilot just acts as really smart autocomplete. Usually just the current line. Occasionally a few if it's brain-dead obvious where I'm going.

drifting stump
#

can you prove it was generated by an ai?

wet sandal
#

Or you can comment in detail what you need then ask it for output. Usually gets it 80% of the way.

#

(For like 5-15 line functions)

thick karma
#

Noticing if I call all of these on a tree object and its square...

object:removeFromSquare()
object:removeFromWorld()
square:transmitRemoveItemFromSquare(object)
square:RemoveTileObject(object)

...it removes the tree, and the shadow cast by the tree, and the tree's presence in the square's objects, but crucially does not remove the tree's presence as a potential object of collision. Anyone know what I need for that last step?

wet sandal
#

I know nothing about this area, nor the networking side of this.
But have you tried killing the tree?
tree:Damage(9999)

thick karma
#

I do not want to kill the tree because I want to be able to restore the tree.

wet sandal
#

Ah

thick karma
#

But thank you

#

I should have said that

wet sandal
#

For removal that was my thought. But it would likely leave the stump too.

thick karma
#

I can sledgehammer it and I think that works (using a function, not by playing)

bronze yoke
#

can you save its information, sledgehammer it, and then recreate it?

thick karma
#

Possibly, but I do not know how to save a copy of a tree object and add it back to the game world as I found it.

#

I figured simply removing it and adding it would be easier if I had the right functions, but I'm all about whatever works.

#

How would I copy an IsoObject's data completely into a new IsoObject from Lua and then add it back to its square (code may assume I can get the square just fine)?

#

I assume if I store the IsoObject in another variable I just pass the reference to that Java object as I would in Java.

#

And thus it would be destroyed?

#

So not that way... (?)

bronze yoke
#

well when it comes to a tree, you just needs it sprite, location, and maybe its health, right?

thick karma
#

Idk I just want to add the exact tree I delete back where it came from... I do not know what all fundamental values are tracked by the IsoObject trees in Java

#

I just want to put the thing back the way I found it.

#

I don't know what all the game uses to create these trees.

#

I know one-or-more of these lines are part of it because I use it to redraw the hidden trees:

tree:setSquare(square)
tree:addToWorld()            
square:AddTileObject(tree)
#

But how to initialize the tree object correctly is something I couldn't find in Lua ๐Ÿ˜ฆ

#

Also I'm wrong the shadow cast by tree is not hidden

#

when collision is active so is the shadow

bronze yoke
#

IsoTree.new(IsoGridSquare, IsoSprite)

#

looks like IsoTree.new(IsoGridSquare, string spritename) is acceptable too

thick karma
#

Looks like I can easily get either from the object, cool

#

Hold on I think I was must have added an old copy of the function through debug somehow... I think RemoveTileObject is actually right @bronze yoke

#

I think that's how sledgehammer does it

thick karma
#

Gah maybe not oof

agile vigil
#

I will need to test something. If I have a character, they die, and I make a new one, is my stored ModData on that player still the same?

bronze yoke
#

no

agile vigil
#

You're always around ๐Ÿ˜„

Thank you, that's basically exactly what I hoped for.

ancient grail
agile vigil
#

Now, is the getID method on items a GUID I can rely on? I'll need some kind of GUID for either players (not characters) or items ๐Ÿ™‚

bronze yoke
#

i just generate my own for players

agile vigil
bronze yoke
#

oh just use steam id or username

#

i think there was a sql id if you want it to be splitscreen safe

agile vigil
#

I'll have a look around, this is plenty to go on. Thank you for making things easier ๐Ÿ˜„

bronze yoke
#

i was generating a guid specifically to make it not persist after death, i think the sql id was the solution we found for it to persist

agile vigil
#

I think I'll use the Username for now, and then investigate options for creating a weak-match system on traits / occupations in order to limit how much you can 'change' from the original person who wrote the diary.

Goal is to minimise cheesing in trait-choices when dying and respawning, but also to allow some changes (such as underweight/overweight, and the various fit/strong traits).

I might also use this weak-match in order to determine "similarity" between two different people reading the same journal, in order to let you gain some benefit of reading someone else's thoughts who are much like your own.

Like, if Alice and Bob share almost all traits with each other, I might give Alice a learning speed multiplier from reading Bob's diary, until she's earned as much XP as Bob has.

hot patrol
#

Anyone know if there is a mod that lets you chose the pose for mannequins along with maybe adding new poses? Asking for a friend.

ancient grail
#

is there an event to determine when you have a loot panel selected. like if its not selected it will do something

agile vigil
#

If there is, remember that some mods (like Proximity Inventory) might still display items from your loot panel, despite it not being currently selected.

ancient grail
#

the thing i wanted to do isnt worth the trouble of looking at other mods cuz all i wanted to do was to blink that container of the atm

#

and off when its not activated

#

or i coul dprobably just keep it blinking

sour island
agile vigil
sour island
#

Earning XP is still an issue

#

But you can't earn lvl 8 -- switch to someone with a higher multiplier and read it to get lvl 10

agile vigil
#

Yeah, that wasn't a concern I had ๐Ÿ˜„

#

I'm lucky enough that you already solved that problem ๐Ÿ˜‰

sour island
#

I was going to sit down with the TV stuff again, may offer a way to stop XP multipliers abuse

#

But that's going to create so many bug reports lol

ancient grail
#

Ow about this
Back when i was still an admin for a server. I noticed that if the level is manually added but not the exp it doesnt add to the journal ehich was a good thing cuz we can then reward level ups using other mods we did
But it wont be added to the journal its a way for us to prevent players from maxing their journals

sour island
#

That's weird

#

The journal uses the current XP + calculated methods from level

agile vigil
#

Oh I'm just remaking the whole thing from scratch, so I'm not too worried about any of all this stuff. More thinking about extra new features I can do to make the book more of a balanced feature that seems more "Vanilla"

sour island
#

I have the project on GitHub and don't mind collaborative work

agile vigil
#

I know, it's more of a way to keep my mind open to new solutions. It can be hard to break the mould when it's all around you.

sour island
#

Fair enough, feel free to check the GitHub out for tricks

#

One issue I do have is co-op has no meaningful way to prevent cross use

#

And the TV issue

agile vigil
#

That's exactly what I'm doing when I get stuck / need inspiration.

sour island
#

๐Ÿ‘

agile vigil
#

I can make a fix for the co-op thing using the SQL id of the player, but I'm not concerned about it, honestly.

The TV issue is definitely one I want to consider myself as it was very problematic on our server, since we had a baseline x3 XP rate, and people didn't remember what they had/hadn't seen before.

sour island
#

I'm thinking I can tap into the function for watching TV and store the XP from there

#

Unfortunately last I recall it will require a hard overwrite

agile vigil
#

It was standard faire to die, respawn, go to the VHS-central hub in the bigger base and re-watch every skill VHS while reading skill books.

#

There must be a way to simply mark the character as having already watched the show, somehow, no?

sour island
#

I hate that you can get multipliers with TV watching too

#

The journals mark that you've watched the show

#

The issue is you can watch it before you read

agile vigil
#

Riight, yeah that's possibly what happened.

sour island
#

And there isn't a way to separate the XP

#

So if I have to track the XP anyway might as well track it itself

agile vigil
#

Definitely one of the players had her journal at one base, and we had skill books / vhs at another base.

sour island
#

I might even remove the media tracking all together

#

I feel bad cause I hounded Nasko about making it exposed ๐Ÿ˜…

agile vigil
#

What I'm doing for my diary right now is I'm tracking all XP gains, rather than calculating how much XP you're supposed to have.

This is XP prior to multipliers (even from sandbox settings I think).

sour island
#

Are you overwriting the addXP?

agile vigil
#

No, addXP is in Java, but it calls the AddXP event, so I can hook right in.

sour island
#

Ahyes

agile vigil
#

As best I can tell, I get the exact float that AddXP was called with, prior to any modifiers.

Except when that perk is already at max level, or when AddXP is given a negative number.

sour island
#

There's an argument for add XP that turns off multipliers

#

You can also call add XP directly

agile vigil
#

Well that sounds pretty ideal.

sour island
#

I'll be messing with it to solve the TV issues - and perhaps implement a way to prevent career abuse

agile vigil
#

If you find a way to solve those things I know past me would definitely have been happy ๐Ÿ˜„

sour island
#

Unfortunately I haven't had time ๐Ÿ˜…

#

But I was hoping the return % sandbox option would help mitigate issues

agile vigil
#

Still making my own diary thingie, but more for the spice of doing it, and for making it separate.

Really want to do per-day stuff and see where that takes me. Make players interact with the diary some more, make them write down their recent memories, and make it harder to just write down a whole life's worth of experience.

#

I'm sure it would, we had reasons for keeping it at 100% that were unrelated to the cheesing ๐Ÿ™‚

sour island
#

I can't help but feel like the TVs XP rate was an accident and just left

agile vigil
#

I'm not entirely sure. I would definitely prefer TV XP being a separate setting in the SandboxVars.

#

And if skill books didn't impact TV XP.

sour island
#

Yeah that second one is wild lol

agile vigil
#

Nah, fuck it, make TV XP work the same as a skill book? Just another multiplier.

sour island
#

Could be a flat multiplier too

agile vigil
#

In general, I'm more a fan of getting a multiplier for the next X (pre-multiplied) points, rather than until you reach some threshold total points as it is now ๐Ÿ˜„

sour island
#

So no needed skill range

agile vigil
#

Yeah that'd work well, I think.

sour island
#

That could be it's own mod

#

Might even be one

agile vigil
#

Definitely out-of-scope for the journal mod ๐Ÿ˜„

#

I feel like you've got some pretty nifty tooltip code in here for the journal. Gotta just check it out in-game, because I might want to redo my bait and evolved recipe tooltips to use more of your strategy.

#

And I forgot to enable your mod, do'h.

tulip valve
#

<m_Pants>false</m_Pants>
<m_AllowPantsHue>false</m_AllowPantsHue>
<m_AllowTopTint>false</m_AllowTopTint>
<m_AllowTShirtDecal>false</m_AllowTShirtDecal>

Is there a code like this that makes bags not possible to be equiped on the back?

ancient grail
#

will this work?

#

like if the sandbox is disabled

#

it will return

#

but i hope it wont need a server restart

#

or should i add this to each functions?\

jagged ingot
#

Good morning.

stone garden
jagged ingot
#

@sour island Have you had time to check out that tech demo?

stone garden
#

anyone want hear my mod idea? i got an unique idea that is easy to make

#

and is unique

ancient grail
#

anyone knows what handles the container if its seen or not

stone garden
#

i was looking an modder that doo stuff for 2 dollars

ancient grail
#

i know now

#
object:getContainer():setExplored(true);
jagged ingot
sour island
#

Yeah, long drive tho lol

stone garden
#

why no one tries my mod ideas :/

jagged ingot
#

I'm going to be working on image support this morning because a friend requested it be done soon. ๐Ÿ˜‰

sour island
#

I place it in /mods/ right?

jagged ingot
sour island
#

Clean stuff

jagged ingot
#

I found something useful when testing yesterday, which is that for some reason the update hook in ISUIElement from ISElement in Java is fired very slowly.. and using tick event hooks is way better for my needs.

jagged ingot
sour island
#

I recommend shareX to anyone

jagged ingot
#

Thanks for checking out the tech demo. ๐Ÿ™‚

sour island
#

I'd be curious how easier it would be to make more complicated UI

#

If you've used aiteron's AUD before - I've been using that to reload files on the fly for testing/tweaking

#

doesnt work in MP though as the reload calls happen on clientside

jagged ingot
jagged ingot
#

My old chat engine actually had this feature so I can reload new code for players without booting them to restart the server.

drifting stump
#

issue with reloading files is hooks and events

jagged ingot
#

When I write blocks like this, I tend to do:

export interface Module {
  onLoad?(): void;
  onStart?(): void;
  onUpdate?(): void;
  onStop?(): void;
  onUnload?(): void;
}

(Or something similar)

#

Module-like implementations solves a lot of the problem of organizing that logic.

#

The main thing for me is that this solves the workshop-item-update situation for my work if I'm working on a server-specific mod.

stone garden
#

no one makes my requests

#

mod requests

thorn cipher
ancient grail
#

Ye exactly

#

Instead sending dms to people
Asking for a mod with 2$ steam cred worth as payment ๐Ÿ˜‚

cinder shadow
#

hello, anyone know which .class file contains the modifiers for how many calories sitting, walking and running take? I've seen people quote the numbers but I cant seem to find it. I looked in zombies/characters/bodydamage/nutrition.class but it seems to not be there.

sour island
# stone garden no one makes my requests

Unless you're willing to shell out cash your other options is to hope someone really likes your idea or you make it yourself. ๐Ÿคทโ€โ™‚๏ธ

winter thunder
shut notch
# stone garden no one makes my requests

Consider the following. These people spend dozens of hours, even days to create a mod. Do they want to make your idea? Just because you think it is cool doesn't mean they agree. If you want things made, either go through the trouble of learning how to mod and then make then yourself, or get some money and commission someone to make them. Otherwise, you're SOOL. Modding games isn't easy, it takes time, and can be extremely frustrating.

sour island
#

without tracking the XP itself

#

speaking of which, the class for XP is typed out like this right? zombie.characters.IsoGameCharacter.XP.class

winter thunder
#

Ohhhhhh, word. I figured there was some block- but that makes sense

sour island
#

Yeah, if they read it first it's fine

sour island
#

Hmm I can't seem to access it with the same trick as print()

winter thunder
sour island
#
local patchClassMethod = {}
function patchClassMethod.apply()
    local class, methodName = zombie.characters.IsoGameCharacter.XP.class, "AddXP"

    local createPatch =

    function(original_fn)
        return function(self, perksType, XP, passHook, applyXPBoosts, transmitMP)

            print("XP TRACKING: "..tostring(perksType).." +"..XP.." ("..tostring(passHook)..", "..tostring(applyXPBoosts)..", "..tostring(transmitMP)..")")

            return original_fn(self, perksType, XP, passHook or true, applyXPBoosts or true, transmitMP or false)
        end
    end

    local metatable = __classmetatables[class]
    local metatable__index = metatable.__index
    local originalMethod = metatable__index[methodName]
    metatable__index[methodName] = createPatch(originalMethod)
end
patchClassMethod.apply()
#

I can probably get away with just smashing up the TV function

#

hmm I feel like they changed the radiointeractions code

#

seems different

#
local function doSkill(_player, _amount, _name, _perk)
    if _amount == nil or _amount <= 0 then return; end

    --local curXp = _player:getXp():getXP(_perk);
    local amount = 50*_amount;
    --if curXp>0 then
        --amount = (2 / curXp)*50;
    --end

    local oldXp = _player:getXp():getXP(_perk);
    _player:getXp():AddXP(_perk , amount);
    amount = _player:getXp():getXP(_perk) - oldXp;
    --_player:setHaloNote(_name.." +"..round(amount,2));
    --ISRadioInteractions:getInstance().addHalo(_name.." +"..round(amount,2));
    if oldXp~=_player:getXp():getXP(_perk) then
        ISRadioInteractions:getInstance().addHalo(_name, amount, true);
    end
end
winter thunder
sour island
#

Why is it 50* tho

#

. _ .

sour island
#

Oh I remember now

#

that function is local

#

that's why I gave up on it

jagged ingot
#

At least the game's code isn't using anonymous function executions.

#

xD

sour island
#

the whole thing is localized ๐Ÿ˜ฆ

jagged ingot
#
-- Be evil
(function()
  doCode()
end)()
sour island
#

It does that too

#
local Interactions = {};
--Stats
Interactions.ANG = function(_player, _amount, _opIsSet) doStat("Anger",_player,_amount, _opIsSet); end       -- Anger
Interactions.BOR = function(_player, _amount, _opIsSet) doStat("Boredom",_player,_amount, _opIsSet); end     -- boredom
Interactions.END = function(_player, _amount, _opIsSet) doStat("Endurance",_player,_amount, _opIsSet); end   -- endurance
Interactions.FAT = function(_player, _amount, _opIsSet) doStat("Fatigue",_player,_amount, _opIsSet); end     -- fatigue
Interactions.FIT = function(_player, _amount, _opIsSet) doStat("Fitness",_player,_amount, _opIsSet); end     -- fitness
jagged ingot
#

๐Ÿค”

sour island
#

I was going to try and inject into interactions - but that's local too

jagged ingot
#
-- Be more evil
(function()
  loadstring('from_some_file_that_does_the_same_thing')()
end)()
sour island
#

Would you happen to know why it can't grab the class in this

local patchClassMethod = {}
function patchClassMethod.apply()
    local class, methodName = zombie.characters.IsoGameCharacter.XP.class, "AddXP"

    local createPatch =

    function(original_fn)
        return function(self, perksType, XP, passHook, applyXPBoosts, transmitMP)

            print("XP TRACKING: "..tostring(perksType).." +"..XP.." ("..tostring(passHook)..", "..tostring(applyXPBoosts)..", "..tostring(transmitMP)..")")

            return original_fn(self, perksType, XP, passHook or true, applyXPBoosts or true, transmitMP or false)
        end
    end

    local metatable = __classmetatables[class]
    local metatable__index = metatable.__index
    local originalMethod = metatable__index[methodName]
    metatable__index[methodName] = createPatch(originalMethod)
end
patchClassMethod.apply()
#
local class, methodName = zombie.characters.IsoGameCharacter.class, "Say"
``` Works
winter thunder
# jagged ingot I did 8. ๐Ÿ™‚

I would have done more too ๐Ÿ˜ญ I was so hyped. I got my testing code fully functional, so I now have a constructor module to instance my tables, and rigged an OnEat function to reference those tables based on mod data attached to the item. Got it fully operational yesterday, so now my drug mod is going to be flying through on progress haha

jagged ingot
winter thunder
#

๐Ÿ™๐Ÿป๐Ÿธ

jagged ingot
#

It's hard to keep that though.

#

Haven't seen many modders like that over the past 20 years of my modding.

winter thunder
#

For sure- it really helps having others to work with. I have hit so many walls, especially on small dumb things that I wouldnโ€™t have caught for hours- but between this community here and my teams help, itโ€™s been so much fun

#

I accidentally typed item.getModData() instead of item:getModData(), and that alone put me on my ass for like 3 hours ๐Ÿ˜‚ IDE didnโ€™t catch it

jagged ingot
winter thunder
#

Tbh I didnโ€™t understand much about coding, or anything about lua before jumping in. So I have mostly just self taught by digging through the main code base, and referencing others projects, (And plenty of help from others). So idrk the advantages / disadvantages of different systems. I started my coding in Notepad++ ๐Ÿ˜‚

jagged ingot
#

Yeah. I use VSCode now.

#

I used to code in Sublime.

winter thunder
#

I prefer VSCode, but now I mostly use IntelliJ for the decomp

jagged ingot
#

I wonder if I should attempt Base64 decoding textures like is supported on real CSS for images..

sour island
#
function ISRadioInteractions:getInstance()
    if instance ~= nil then
        return instance;
    end

    local channelLog = {};
    local interactLog = {};
    local interactions = {};
    local cooldowns = {};
    local self = {};
    local noHalo = {};
    local currentPlayer;
``` There's no way to get 'interactions' from here right?
jagged ingot
#

Be careful with self.

sour island
#

this is vanilla code ๐Ÿ˜

#

trying to get a way to track TV XP

jagged ingot
sour island
#

it's all locked up behind local or function() dropped in define

jagged ingot
#

You can get it if you assign it by overwriting the method.

sour island
#

the methods are all local too

#

!

#

not this one

#

๐Ÿ˜ฎ

drifting stump
#

hmmmm

#

you could try accessing the stack

sour island
#

Yeah this file needs a bit of a rewrite

drifting stump
#

they should be in the stack in the order they were declared

sour island
#

I could just overwrite the file entirely

#

I'd hate to do it

drifting stump
#

im probably doing it with the crafting menu

sour island
#

Good candidate for that community patch

drifting stump
#

we really gotta get on that

sour island
#

I'm off next week ๐Ÿ˜…

#

I wrapped up that commission

drifting stump
#

and the fast ui libs i need for the menu rewrite are a prime candidate too

sour island
#

If I overwrite the file do I need to worry about the functions it drops into Events?

drifting stump
#

what do you mean

sour island
#

Events.OnGameBoot.Add(function() ISRadioInteractions:getInstance(); end);

#

also the instance itself

    local function Init()
        Events.OnDeviceText.Add( self.OnDeviceText );
        Events.OnTick.Add( self.OnTick );
drifting stump
#

when you override the file the original one doesnt get executed at all if thats your concern

sour island
#

yeah that's what I was worried about

drifting stump
#

the game first puts all files into a list

#

if a file has the same path/name it replaces it in the list

winter thunder
sour island
#

I doubt many other mods mess with this file - I feel a little less apprehensive

sour island
#

Can't reverse calculate it

drifting stump
#

if other mods do mess with it its probably hooks or overwrites

#

and since you replaced the original they would do that on top of yours

#

so no issues

jagged ingot
#

Does the community thing have a tip-jar?

#

I'd put in some work if that were the case. xD

drifting stump
#

you tip with contributions

jagged ingot
#

Haha.

#

Konijima should've made typings for it..

#

That would be useful.

drifting stump
#

ill have to take a look at what was made back then

winter thunder
#

Any of yall know if there is a way to mess with the rates of player variables? Like, instead of directly increasing thirst, emulating something like the high-thirst trait? Endurance recharge/decrease rate, hunger rate, etc?

drifting stump
#

@sour island wasnt it you who did a rework of hunger and stuff

winter thunder
#

he did the calorie rework

sour island
#

Ye

#

I translated the java to lua for calories and calculated the difference

#

I think calcStats has a hook as well as the event

#

so you can overwrite the calculation entirely

#

but you then have to replace everything

#

that's why I went with the calculate approach

#

and why I don't want to calculate XP rates from TVs when you have multiple multipliers lol

#

Although if I can hijack the addXP like I did with say

#

I wouldn't have to overwrite an entire file lol

jagged ingot
#

Hoping I can find a way to do border-radius stuff with CSS using PZ drawing API.

#

I need to draw circles or partial.

sour island
#

I can access the character class but not the XP

#

Anyone familiar with the __classmetatables stuff?

jagged ingot
sour island
#

class zombie.characters.IsoGameCharacter$XP - table 0x758086434

#

๐Ÿค”

sour island
#

it works ๐Ÿคทโ€โ™‚๏ธ

#

$ seems to be the symbol for subclasses or whatever java calls them

#

intelliJ absolutely hates it lmao

jagged ingot
#

Kahlua stuff.

#

Oh yeah if you want to dive into Java internal stuff..

#

$ <- Anonymous stuff for classes. # for method.

#

Check out JavaDocs.

#

You use # to point to methods in docs stuff.

sour island
#

se.krka.kahlua.vm.KahluaException: Skill Recovery Journal XP.lua:6: unexpected symbol near "$"

#

nvm, doesnt work - just manages to load

#

How do I access that then :\

#

that's what it refers to the class as

#

making it a string doesn't work

dull moss
#

is there a way to grab light level around player? either in tiles next to player or general light level? idk how lightning works in the game, any pointers on what to look for in javadoc?

dull moss
#

ok closest thing related to measurable light i found is this
print("Night Strength: "..getClimateManager():getNightStrength());

#

doesnt account of light like lamps and shit

#

but at least tells me how dark it is outside

sour island
#

I think squares have a light level

dull moss
#

oh was looking at wrong place

#

it's getDarkMulti

#

it takes int as argument though

agile vigil
#

Is int perhaps the.. Height layer to grab the dark multiplier from?

#

Uncertain how the z-levels are implemented, honestly.

dull moss
#

that would actually make perfect sense

#

or maybe not PepeThink

#

fuck knows

agile vigil
#

Could also be vertex ID, in case the game has vertex-based light/darkness.

dull moss
#

I just want the light level mom

agile vigil
#

If it is the vertex-based light level, you can average darkMulti from 0-3

dull moss
#

there are methods like getS() and getE() that return squares

#

but like there are 4 of those and they take no arguments?

#

each square has x y z fields

#

and you can get those with methods

#

but i want to get square based on coordinates, not get coordinates based on square

fast galleon
#

getSquare(x,y,z) is global function

#

@dull moss

#

it returns nil if square is not loaded

dull moss
#

cheers, was about to go dig why inteliji doesnt suggest it

#

I assume isCanSee(int int1) returns true if player can see it right now? what's the argument?

#

ID maybe?

dark wedge
dull moss
#

oh that's gonna be helpful, thx

#

is there efficient way on checking cells that player can see?

#

how does that work getGridSquare(plX + x, plY + y, plZ)

#

i mean i get it takes position relative to player

#

but is this whole block ran in a loop that grabs squares around player ? that'd be inefficient

dark wedge
#

Yup, its searching in a radius around the player. Found in: lua/client/Foraging/ISSearchManager.lua
the x and y are the offset up to the radius

dull moss
#

I see, thanks

#

hm

#

I think I have an idea how to write custom function that catches cone of player vision so you dont have to check whole area in radius PepeThink

#

today on "Optimizations that nobody cares about"

young grotto
#

pardon me for butting in

dull moss
#

No

young grotto
#

D:

#

anyway

#

there is this mod, that allows player to do naruto run without consuming stamina

dull moss
#

I expected some input and I got this

young grotto
#

the code is something like this

require "ISUI/ISEmoteRadialMenu"

local ISEmoteRadialMenuinit_old = ISEmoteRadialMenu.init

function ISEmoteRadialMenu:init()
    ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"] = {};
    ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].name = getText("IGUI_Emote_AuthenticAnimationsExtra");
    ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = getText("IGUI_Emote_Naruto");
    
    ISEmoteRadialMenu.icons["Sprint002"] = getTexture("media/ui/emotes/Naruto.png");
end
#

is it possible to create a patch to disable this naruto emotes? if so, how do I start?

#

just disabling it the GUI should be pretty good patch

#

do I need to use ```lua
local activeMods = {}
local activeModIDs = getActivatedMods()
for i=1,activeModIDs:size() do
local modID = activeModIDs:get(i-1)
activeMods[modID] = true
end

dull moss
#

can't you just catch it with if getActivatedMods():contains('NarutoRun') then end or whatever ID is

young grotto
#

oh its from authentic animation and in the mods it has tons other animation packs

dull moss
#

ye but you still can catch it with my option, no?

young grotto
#

oh?

dark wedge
#

Doing it that way would fully disable the AuthenticAnimation mod afaik. You'll have to edit the ISEmoteRadialMenu available options to remove this entry I would think.

dull moss
#

no it wouldnt?

#

he's supposed to put his code between then and end

#

that patches whatever he wants to patch

#

and then make sure his patch loads after whatever he's patching

dark wedge
# dull moss no it wouldnt?

I somehow combined his snippet and yours in my brain into some mess. You are correct in that you are just checking for the mod's existence.

dull moss
jagged ingot
#

I've had way too much caffeine.

young grotto
#

hmm I apologize, I kinda need some help on this

jagged ingot
#

I just learned that the CSS casing used for property names is called kebab-case.

#

That's flipping cool.

young grotto
#

so if I make something like this

local activeMods = {}
local activeModIDs = getActivatedMods()
for i=1,activeModIDs:size() do
    local AuthenticAnimations = activeModIDs:get(i-1)
    activeMods[AuthenticAnimations] = true
        then stuff here

end
jagged ingot
young grotto
#

thanks!

jagged ingot
#
local activeMods = {}
local activeModIDs = getActivatedMods()
for i=0,activeModIDs:size() do
    local AuthenticAnimations = activeModIDs:get(i)
    activeMods[AuthenticAnimations] = true
        then stuff here

end
#

You can set i to 0.

young grotto
#

I need to figure out what to put at "stuff here"

jagged ingot
#

Yeah. What stuff do you want to do?

young grotto
#

basically removing the submenu for naruto running

ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = getText("IGUI_Emote_Naruto");```
#

which function should I use to remove the sub menu?

#

as in patching the previous mod

dull moss
#

you could try simply overwriting it with empty string, see how it goes

young grotto
#

a moment, im looking for overwriting function

agile vigil
#

You should be able to just do = nil in order to remove a table entry.

young grotto
#

oh?

agile vigil
#

ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = nil; ought to just remove that entry, assuming the EmoteRadialMenu doesn't expect a certain number of entries or anything.

#

In Lua, this is equivalent to something like Map::remove(key) in Java.

young grotto
#

oh interesting

jagged ingot
#

or delete table.entry in JS.

agile vigil
#

^Or that, yep ๐Ÿ™‚

young grotto
#

๐Ÿ˜ฎ

agile vigil
#

As best I can tell, Lua doesn't ever store a nil for you. Nil isn't a storeable value. Instead nil is the absence of a value, thus setting something to nil means you are unsetting it.

sour island
young grotto
#
require "ISUI/ISRadialMenu"
require "ISUI/ISEmoteRadialMenu"

local activeMods = {}
local activeModIDs = getActivatedMods()
for i=0,activeModIDs:size() do
    local AuthenticAnimations = activeModIDs:get(i)
    activeMods[AuthenticAnimations] = true
        then ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = nil;
end
#

should this work?

agile vigil
#

I think the then in there might cause an issue, but not sure.

young grotto
#

hmm

agile vigil
#

I think you meant something else, but not sure, your activeMods here is just a lot confusing to me.

dull moss
#
local checkedSquares = 0;
local squaresVisible = 0;
local square;
local plX, plY, plZ = player:getX(), player:getY(), player:getZ();
local radius = 20;
for x = -radius, radius do
    for y = -radius, radius do
        square = getCell():getGridSquare(plX + x, plY + y, plZ);
        checkedSquares = checkedSquares + 1;
        if square and square:isCanSee(???) then
            squaresVisible = squaresVisible + 1;
        end
    end
end
print("Checked squares: "..checkedSquares..", visible squares: "..squaresVisible);
``` yea fuck knows what argument you need to pass to isCanSee, tried player, didn't work
agile vigil
#

Normally you'd check and require a mod by using something like this:

if getActivatedMods():contains("ItemTweakerAPI") then
    require("ItemTweaker_Core");
end
#

@young grotto

agile vigil
young grotto
#

I see

dull moss
agile vigil
young grotto
#

however, I am not too sure which function should I use

jagged ingot
#

Just made this code.

#

kebab-case to camelCase conversion. ๐Ÿ˜„

agile vigil
agile vigil
stone garden
#

my mod ideas will never happen

young grotto
#

I see, lemme try

dull moss
#

Ye I did same

#

you looking up in zdoc lua or zomboid?

agile vigil
#

Then I searched in zomboid.jar for "isCanSee" looking for the definition, and looked at usages of the method.

#

First check the Lua, then when it becomes clear it is a Java method, check the Java ๐Ÿ˜›

jagged ingot
#

Are you looking for something very specific in the method or the method parameters?

dull moss
#

params

jagged ingot
#

๐Ÿ™‚

dull moss
#

ok I maybe not using this correctly but

#

where exactly you found its params?

#

am I looking in wrong place?

agile vigil
#

No you're in the right place.

jagged ingot
#
      /**
       * Method Parameters: 
       *  - (int arg0): boolean
       */
      isCanSee(arg0: number): boolean;
agile vigil
#

Ctrl+Click isCanSee in the code and you can see users. I thought the updateLOS method in IsoPlayer.java sounded very promising, so I looked there.

dark wedge
#

The ISSearchManager I gave earlier uses self.player, which it creates from _character:getPlayerNum()
I've also done:

        return pSquare
    end```
Which does work
agile vigil
#

OH THE INTEGER IS FOR SPLITSCREEN laugh

dull moss
agile vigil
#

I just realised. It's to determine which of the local players can see the square.

jagged ingot
#

I really need to get that 3rd-party documentation thing completed.

agile vigil
dull moss
#

I see

#

cheers

dull moss
#

and tutorial was for 2022 and i had slightly different menues

#

so i just reinstalled to have smae menues as in tutorial

#

did all from 1st try, GigaChad

jagged ingot
#

Oh. I mean't a program I made for Typescript docs.

#

Basically my way of saying "Why not just document it myself...".

frank elbow
#

Is this for use with that TypeScript to Lua transpiler?

jagged ingot
#

Yeah.

#

The program also contains the Lua-2-Typings transpiler / generator thingy. xD

agile vigil
#

I do like the idea of stronger typing.

dull moss
#

bro

frank elbow
#

Gotcha, that's neat. The transpiler isn't for me but further documentation will be helpful to a lot of people, I'm sure

dull moss
#

my man just turned to dust

jagged ingot
#

Yeah. It's there to help beginners and people like me. ๐Ÿ™‚ People who are seasoned here don't need it.

dull moss
#

it works Kpog

LOG  : General     , 1672082682440> Checked squares: 1681, visible squares: 7
LOG  : General     , 1672082683074> Checked squares: 1681, visible squares: 7
LOG  : General     , 1672082683690> Checked squares: 1681, visible squares: 7
LOG  : General     , 1672082684323> Checked squares: 1681, visible squares: 7
LOG  : General     , 1672082684940> Checked squares: 1681, visible squares: 9```
agile vigil
#

Perhaps a bit more than we needed to see, but KomodoPog

sour island
#

@fast galleon ty homie

dull moss
#

me looking at 7 squares in PZ:

agile vigil
#

Ding ding ding.

sour island
#
local patchClassMethod = {}

function patchClassMethod.create(original_function)
    return function(self, perksType, XP, passHook, applyXPBoosts, transmitMP)
        print("XP TRACKING: "..tostring(perksType).." +"..XP.." ("..tostring(passHook)..", "..tostring(applyXPBoosts)..", "..tostring(transmitMP)..")")
        return original_function(self, perksType, XP, passHook or true, applyXPBoosts or true, transmitMP or false)
    end
end

function patchClassMethod.apply()
    print("SkillRecoveryJournal: accessing class:`zombie.characters.IsoGameCharacter$XP.class` method:`AddXP`")
    local class, methodName = XP.class, "AddXP"

    local metatable = __classmetatables[class]
    --print("__classmetatables : "..type(__classmetatables)) for k,v in pairs(class) do print(tostring(k).." - "..tostring(v)) end

    local metatable__index = metatable.__index
    --print("metatable__index : "..type(metatable__index)) for k,v in pairs(metatable__index) do print(tostring(k).." - "..tostring(v)) end

    local originalMethod = metatable__index[methodName]
    metatable__index[methodName] = patchClassMethod.create(originalMethod)
end
patchClassMethod.apply()
#

You can do this to overload exposed functions

agile vigil
#

Overlap?

sour island
#

overload - same as with Lua when you store the original function and apply changes before returning the original

#

credit to @hearty dew ๐Ÿ‘ showed me how to do it for Say()

#

Overloaded functions let you call one function and have it dispatch to different implementations based on the argument types. C++ and Java have support for this at the language level; in Lua you can roll your own at runtime:

agile vigil
#

Ooh, you're overloading a Java method?

sour island
#

Yeah, well - decorating it

#

you can grab it - change arguments as needed - and pass it on

jagged ingot
#

What's the purpose for doing that? (Debug mode only)

sour island
#

Wait it only works in debug?

jagged ingot
#

Reflection methods are only exposed if the game is in debug mode.

#

Otherwise it'd be a huuuuge security risk.

agile vigil
#

Truth :c

jagged ingot
#

Trust me. (The anti-cheat guy)

dull moss
agile vigil
#

Is all I can imagine now.

sour island
#

aw man

jagged ingot
#

I'm sorry to bring you down @sour island. This is why I core-mod.

#

I have a core client mod that is a bundle of all my goodies and tools to improve on the game & API.

#

It's like the same idea you guys had for a community library.

#

If you want to contribute to that I wouldn't mind putting that in. I plan to release it sometime soonish so I can get back to modding shaders via Lua.

young grotto
sour island
#

[Skill Recovery Journal] XP TRACKING: Doctor +5 (nil, nil, nil)

#

still works outside of debug mode

#

๐Ÿคทโ€โ™‚๏ธ

fast galleon
#

@jagged ingot
he's only changing calls from lua

agile vigil
jagged ingot
agile vigil
jagged ingot
#

That's good to hear.

young grotto
sour island
#

Makes me happier to do it this way than overwriting the radio interactions

#

I'll have to rewrite most of the mod now tho

jagged ingot
#

(Was referring to this)

        if (Core.bDebug) {
                try {
                    this.exposeMethod(Class.class, Class.class.getMethod("getName"), LuaManager.env);
                    this.exposeMethod(Class.class, Class.class.getMethod("getSimpleName"), LuaManager.env);
                } catch (NoSuchMethodException var3) {
                    var3.printStackTrace();
                }
            }
jagged ingot
#

lol.

#

They used to have Field.class and things in there.

#

Wait nvm above it.

sour island
#

you can read fields out of debug - I think writing is what doesnt work

jagged ingot
#
            if (Core.bDebug) {
                this.setExposed(Field.class);
                this.setExposed(Method.class);
                this.setExposed(Coroutine.class);
            }
sour island
#

ye

jagged ingot
#

Yeah because Class<? extends Class> isn't exposed.

ancient grail
thick karma
#

@bronze yoke I figured out why I was so confused about whether or not that function was working to remove collision of the trees. @ancient grail

young grotto
# agile vigil Yeah the whole line.

so my final code would look like this

local activatedMods = getActivatedMods()

if activatedMods:contains("AuthenticAnimations") then

  require "ISUI/ISEmoteRadialMenu"
  require "ISEmoteRadialMenu.lua"

  ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = nil
else

  print("AuthenticAnimations mod is not activated")
end
thick karma
#

It takes several seconds for the tree to disappear as a collider / shadow-caster, and I may have to step a square or two away from the tree as well.

#

Eventually the collision detection goes away, but for at least 5 seconds of walking around I can continue colliding with it. But it DOES go away; after extensive testing, I can confirm that after a certain amount of time and/or movement, the position of the tree no longer collides with me

thick karma
#

So some kind of refresh event must be periodically occurring that calculates nearby collision possibilities periodically on the basis of what objects exist in what squares...

young grotto
agile vigil
thick karma
#

@ancient grail You'll also want to read my last few messages. Maybe you can think of why this happens or find someone who knows.

cinder shadow
#

@sour island Hello I was studying your mod on calories and had a question. First off thanks for making it, I was wondering do you know where the calorie multipliers are at in the base game? I'm new to modding and wanted to modify them but can't seem to find them in the PZ files and I dont see them in the nutrition.class file. I thought you might know from your experience with the calorie mod. The ones that list out as:

Spritning: 1.3x
Running: 1.0x
Walking/Sneaking: 0.6x

Any help would be appreciated.

ancient grail
#

U mean this one?
I notice you do not use square:RemoveTileObject(obj); like I do... you found obj:getSquare():transmitRemoveItemFromSquare(obj). I wonder how much of a difference in behavior there is here.