#mod_development

1 messages · Page 251 of 1

frank elbow
#

Yeah, though I wonder why not just set the field references to the functions themselves if you already have a reference to the item

sour island
#

you mean just store the functions for future reference?

frank elbow
#

Yes, like fields.worldSprite = item.setWorldSprite

sour island
#

Not a bad idea, I noticed some movables aren't lights so I wrote it to be on the fly for now

frank elbow
#

If you're gonna be caching the fields then maybe your approach would be better—I don't actually know how Kahlua handles calling methods from another instance 🤔 I'd assume it uses what's passed in but never tried

sour island
#

I also assumed having recursive references to entire functions is probably not great 😅

frank elbow
#

Wym by recursive references?

sour island
#

Having a table of references to functions

frank elbow
#

Ah, gotcha. It's only storing references so idt that'd be a cause for concern

#

Not all that different than defining "methods" with the : sugar on a table

sour island
#

I'll keep that in mind, going to be sending the fields list over network so I was probably being overly cautious

frank elbow
sour island
#

Going to take a crack at it later anyway

#

Main goal is to get movables, and items with unique values like names/conditions at least

brisk carbon
#

can some1 complie .java file to .class file for me? i borrow a mod and edit it a bit to suit my usage but i don't know how to compile

frank elbow
#

If you need to reference one of the .jar files it's slightly different—lmk and I'll see what that was

brisk carbon
#

thank you i will try the command!

silk hollow
#

Alright so, I am working with @thick karma to optimize my mod that I haven't touched in quite some time.
Specifically the idea is to update zombie population stats (speed, sight, etc) at every tick but in small chunks instead of all of it (in active cells) every few seconds as that might cause stuttering with high enough population of zombies.

Questions 1: The documentation says Triggered every tick, try to not use this one, use EveryTenMinutes instead because it can create a lot of frame loss/garbage collection. I see this being update recently, but testing on my own pc (R7 5800H) doesn't seem to cause much issue in terms of frame loss. Anyone can give more insight?

Question 2: Would it work on server side? I remember zombies being updated in a complex way, something like if a zombies is inactive the server update it, if it's active (engaged with players) is the client updating and relaying updates to the server that then relay to other players in the vicinity. Is this correct? Or am I misremembering or had read some bs that just sounded correct?

Question 3: Would it work on server side as in... what is the server fps? Is this info somewhere?

Thanks in advance, I now remember why I hated modding for PZ 😛

bronze yoke
#

it seems like you're already concerned about optimising your mod in the exact way you should when using ontick so i don't think you should worry about it

#

a lot of people here will act like the game will drop to 2 fps if you add an ontick handler but there's nothing about it that makes it inherently heavier than other events

drifting ore
#

a completely benign and sometimes extremely useful tool

#

but unwary users make utter monstrocities with them so in general it's better to blanket discourage the use. People who know better - know better. Which is why despite actively pushing against them in public as universally bad, they still exist.

#

there's three levels of optimization, from best to worst:

  1. don't run it
  2. run it less often
  3. run less of it
    Level 3 is for when you can't do level 2, but this simple community message already skips to level 2.
shadow willow
#

@sour island Is there a way to change the display size on your mod Error magnifier ?

shadow willow
sour island
shadow willow
sour island
#

I can look into something when I have some time

shadow willow
fervent path
#

Does anyone know how to prevent the game from compressing the UI icons for modded traits? I've tried replacing the file icons from the wiki, and they have the same problem: the icons in the base game look like the file, while my icon, which should look the same, is compressed into smeared color blocks.

bronze yoke
#

put it into a pack file

#

the game scales loose files and images from pack files differently

fervent path
#

Thanks!

drifting ore
bronze yoke
#

they are loaded the same way, they're aren't actually being compressed

drifting ore
#

which also means someone had to implement an entirely separate loading routine for loose files instead of reusing the one for packs

bronze yoke
#

they just end up with a different flag for how they should be scaled

#

loose files get bilinear scaled, pack files get nearest neighboured

drifting ore
#

yeah exactly. This means they're loaded through a different function.

#

Well I'm making a charitable assumption here actually. In that someone implemented a different function, and nobody went ahead and manually injected the code that changes loaded data depending on source of the data.

bronze yoke
#

from my understanding it's more like the texture pack configures these things so not being in a texture pack means it uses the default

drifting ore
#

as far as I gather, texturepacks are loaded using a dedicated function, and everything else is loaded through async asset system

#

you can pass texture flags when you load a texture pack. Seems like they apply to the entire pack.

#

the game isn't even that old and already it's neck deep in legacy code issues

bronze yoke
#

are you sure it's not that old

drifting ore
#

openttd is quite a bit older

bronze yoke
#

and ancient egypt was quite a bit before that

drifting ore
#

yeah I love the ancient egypt videogames. They were simple but they were pure soul.

bronze yoke
#

i'm just saying that 'something else is older' doesn't make 'this is old' untrue

drifting ore
#

it's a matter of perspective. Is it untrue to say that 14 year olds are perfectly old enough for anything when there are older people around?

wet sandal
# fervent path Does anyone know how to prevent the game from compressing the UI icons for modde...

You can adjust texture settings temporarily in-game, kind of annoying to use since its a race to render before they reset

local function SetTextureParameters(texture)
    local TEXTURE_2D = 3553

    -- Fixes blurry textures from other mods
    local MAG_FILTER = 10240
    --local MIN_FILTER = 10241
    local NEAREST = 9728
    SpriteRenderer.instance:glBind(texture:getID());
    SpriteRenderer.instance:glTexParameteri(TEXTURE_2D, MAG_FILTER, NEAREST);
    --SpriteRenderer.instance:glTexParameteri(TEXTURE_2D, MIN_FILTER, NEAREST); Is a bit hit or miss on improving the quality of textures, so I'm leaving it out for now

    -- Fixes pixel bleeding on the edge of textures from other mods
    local TEXTURE_WRAP_S = 10242
    local TEXTURE_WRAP_T = 10243
    local CLAMP_TO_EDGE = 33071
    SpriteRenderer.instance:glTexParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE);
    SpriteRenderer.instance:glTexParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
end
sour island
#

Under Display > textures - there's a checkbox for Compression

#

Also, for good measure turn up Max Texture Size

bronze yoke
#

are trait icons being compressed? aren't they 16x16 😭

drifting ore
#

anything can be compressed

sour island
#

My dev icon was being compressed so yes

drifting ore
#

usually the game engine specifically disables compression for pixel art textures

#

but not in PZ

sour island
#

the texture rendering is kind of fucked up regardless

#

Whatever math they're using is misreading when it's needed

#

scuffs textures willy nilly

drifting ore
#

it enforces Po2 textures

#

but doesn't resize them

sour island
#

Wouldn't surprise me that everything is compressed

fervent path
#

Turning off texture compression fixed my problem

drifting ore
fervent path
#

It's weird though, even after loading as a pack file it still had compression

bronze yoke
#

hmmm

fervent path
#

it might be the settings

sour island
#

I'm pretty sure any modded texture gets compressed

#

pack or not

#

Stuff in the inventory UI doesn't though

#

So the only people to notice this are people adding actual UI textures

#

The problem is with drawTexture()

drifting ore
bronze yoke
#

does the debug item list show packed textures

#

if it's not compression i don't remember what it was that packs do so differently

#

except being configurable

sour island
#

What about your lifestyle UI? if the option is off

#

Are you segmenting it?

drifting ore
#

What no?

sour island
#

That's not what the bug is about

#

and I just force the texture to scale

drifting ore
#

Well of course not. It should clip the texture if it upsizes it. And if texture atlas is involved, there's no reason to have any limitations on texture dimensions except maximum GPU texture size.

#

But that's more of a practical side of dealing with bugs. Particularly those outside of your control.

sour island
#

The bug is that it will take a 512 texture, see the max should be 256, and shrink it down to 133.

#

Not really following what you're saying.

drifting ore
#

Now I'm confused. The thread said 266 gets shrunk to 133.

#

And it seemed like it's a visual effect, not that the texture is actually sized 133.

sour island
#

Correct, in that example it was 266, it was halving the texture because it was larger than the cap

drifting ore
#

so just to be clear, operations like texture.getXsize() returned 133?

bronze yoke
#

so if it's 512 does it get reduced to 256?

sour island
#

I'd have to test

bronze yoke
#

it seems like a lazy implementation but ideally we'd be sticking to powers of 2 anyway

drifting ore
# bronze yoke so if it's 512 does it get reduced to 256?

depending of whether it's a visual or data effect.

If it's purely visual, texture gets upsized to 512 but the data remains 266, and then rendered as 256 (half as big) the data appears like 133 (half of original).
If it's data-wise, then it had to downscale the contents of the texture to 128 and... shove 133 pixels into... uh... yeah. It's why my first idea was that it's a visual effect.

bronze yoke
#

yeah, good point actually

paper meadow
#

Holaaa

drifting ore
#

also fun fact the reason why GPU texture compression is usually completely OK but almost always looks bad on pixel art is because each 4x4 chunk of pixels only gets 2 colors + another 2 directly between them. Natural textures up-close are usually just shades of the same color so it's fine. But in pixel art there's usually a lot more than 2 colors per 4x4 patch and they're usually completely different colors.

#

texture compression should always be enabled if you can help it. It reduces effective pixel fill rate requirements, AND graphics memory footprint so you can put more higher resolution textures on the GPU.

#

Well this is more relevant if you develop your own game.

sour island
#

I guess they changed something

#

the cap doesn't seem to have any impact now

bronze yoke
#

you posted that thread after the game's last update

sour island
#

This is with the cap set to 256 and compression on

#

left 2 are using sprite render

#
    local tests = {"1024","266","512x1024"}

    self.testTexture = self.testTexture or getTexture("media/textures/"..tests[ZombRand(#tests)+1]..".png")

    local w = self.testTexture:getWidth()
    local h = self.testTexture:getWidth()

    getRenderer():render(self.testTexture, 50, 50, w+50, h+50, 1, 1, 1, 1, nil)
    getRenderer():render(self.testTexture, 50+w+60, 50, 256, 256, 1, 1, 1, 1, nil)
    self:drawTexture(self.testTexture, 0,0,1,1,1,1)
#

Yeah idk then

#

Let me try starting a new game - maybe the option is baked into the save

#

Nope, guess it's fixed 🤷‍♂️

drifting ore
# sour island

me wondering why I can't see any compression artifacts when each pixel in that picture is like 20x20 🤦‍♂️

sour island
#

Figured out the issue.

#

Although the stuff drawn on the UI isn't impacted

#

also the cap doesn't seem to impact it at all anymore

#

nor does compression

#

Not sure why it was causing so many problems before

#

Oh wait there we go

drifting ore
#

what am I looking at

sour island
#

The cap is 256 here 🤔

#

513 x 513 - using the snippet tool to measure quickly, I'll assume its off by a pixel

#

seems like it's halving the largest side and calling it a day

bronze yoke
#

it seemed from your earlier description that it just places the texture into the smallest power of two that fully contains it, and then downscales that, which in most cases where the image isn't a power of 2 leaves a great amount of empty space in the final texture

sour island
#

the compression issue seems to be gone though which is weird

sour island
#

My assumption was it was not shrinking it to match the cap

bronze yoke
#

266 placed into 512x512 and then halfed to 256x256

sour island
#

That wasn't my assumption, sorry if I made it seem that way

#

What would be the case here then?

bronze yoke
#

what i just described is what i think it's doing

#

it matches your issue as i understand it

sour island
#

1024 -> 512? when the cap is 256?

#

that image is supposed to be a rectangle

bronze yoke
#

isn't it just rendering 256x256 at double scale?

sour island
#

I am under the impression the max texture size is supposed to be what that entails though lol

#

would having 2x textures allowed impact that?

bronze yoke
#

i don't think that relates to anything but tiles

#

you're right, idk why it's becoming a square then, feels like it's done both behaviours specifically when you wanted the opposite ones

sour island
#

🤔

#

what the hell is it doing now

#

that's not even shrank

#

but it's still squaring it

bronze yoke
#

it might just scale non-square textures into the next power of 2 or something

#

there's kind of no benefit to non-power of 2 textures so it's not unusual to have bad support for them

drifting ore
#

local w = self.testTexture:getWidth()
local h = self.testTexture:getWidth()

sour island
#

The behavior seems to happen even for squared textures though

drifting ore
#

bruh

sour island
#

the original issue was 266 -> 113

#

eitherway, the issue seems to not be impacting textures anymore or like it used to

#

so idk, I guess I'll leave gamenight as is eitherway

drifting ore
sour island
#

Specifically interesting the UI drawTexture isn't compressed at all

#

but sprite renderer is

sour island
drifting ore
#

everything works fine if you don't have bugs in your test routine

#

This is frustrating. The guy has buggy test code, completely ignores it when I point it out, and blames it on the game.

Unless I'm shadowbanned and literally nobody can see me pointing this out.

silk hollow
#

Thank you @bronze yoke and @drifting ore for your insight on ontick.
Remains to determine if it works server side but that would depends on how zombies are updated. I'll do some experimenting with a local server just to see if it works as expected 🙂

drifting ore
silk hollow
drifting ore
#

I put if not istype(zombie, "IsoZombie") then return end on the first line in the event handler. On the off-chance that the AI isn't zombie.

bronze yoke
#

the name is misleading, the event is fired when any character changes state

drifting ore
bronze yoke
#

a lot of actions are implemented with a state machine, pretty much any of these without 'zombie' in it should be a player state

drifting ore
#

huh, cool

silk hollow
#

of course the name had to be misleading 😄

drifting ore
#

Good thing in Lua this is no obstacle.

OnCharacterStateChange = OnAIStateChange

#

Then again this kinda vaguely implies that this doesn't apply to zombies.

#

@bronze yoke do you know if in kahlua garbage collection works faster than object pooling?

bronze yoke
#

i don't

drifting ore
#

it's just I'm being reminded that manual memory management takes more IQ than I have and I'm thinking if I even need to do this

drifting ore
#

at least i figured out why zombies eating corpses resulted in double-counting removed bodies, so the pile count goes negative

shadow willow
#

Did i do something wrong here ? My context menu option don't show

    player:Say("Test")
end

local function addContextOption(player, context)
    context:addOption("Show Player Info", player, showTest)
end

Events.OnFillWorldObjectContextMenu.Add(addContextOption)```
red tiger
#

One thing I like about JavaScript is the ability to invoke properties of an object with string-key accessors to avoid situations where reserved words are used. In a normal dev situation this should be avoided however when in a situation where data comes from other languages / language environments this becomes a life-saver.

#

Python doesn't have this AFAIK so I have to mute methods and variables with reserved names.

#

Thread.yield() is one of those examples.

#

In JavaScript, I'd do:

const thread = ..;
thread['yield']();
#

(If this were the case in JS)

#

I'll probably need to build a proxy invocation utility to call it but with a string name and arguments to provide.

#

Something like:

Jython.invokeInstanceMethod(myThread,  "yield")
bronze yoke
#

if i'm remembering right python is pretty much just dictionaries internally but i've never known a way to actually leverage that

#

and if jython compiles straight to jvm it probably isn't going to be that way

red tiger
#

A similar accessor issue exists for when fields are named the same as methods. I'll need to add these API to help get that from the JVM-side when people need direct access to otherwise shadowed class-properties.

#

It's easy to add however I'll need to document this so people will know what to do in this situation.

tacit carbon
#

Does anyone know how can I alter the weight limit of 50? I tried to add more inventory space but it wont let me pick up more than 50 anyways

#

It says that the wait limit has been reached and stops the action of picking up

shadow willow
#

I don't think there is a way to overide "hard" limit of 50

#

Maybe try with a bag that more weight reduction ?

tacit carbon
drifting ore
#

is there an item script callback that fires when that item is added to inventory?

#

i want to make an item such that simply picking it up has an effect

bronze yoke
#

there isn't unfortunately, you could hook the inventory transfer action to catch that

drifting ore
#

yeah that was my first idea. Thanks.

drifting ore
#

actually nevermind it's a super gimmick secret feature, i'm not gonna bother

crisp dew
#

Hey, anyone happen to know if Indie Stone folks grant access to mod developers to their testing branches so we can get a start on supporting next versions?

bronze yoke
#

they don't

crisp dew
#

awe poo. I'm anxious to get my hands on a42 so I can port my code over to the new version.

red tiger
#

Gonna need to rewrite my generics type-parser to support nested-classses with generic types too. Noticed that pattern is messing up syntax in my python typings generator.

#

Easy to fix just need to rewrite it to support more than one sequence of nested types.

#

So like (Not a real example) java.util.Map<String, Integer>$Set<String> could happen.

#

My code checks lastIndexOf(">") assuming that there'll only be one set of type definitions, not multiple. I didn't know at the time of writing that utility that this sort of type-resolution is possible with generics.

#

Other than that and some investigation on missing definitions not being populated my Java API typings for the Python mod framework are about ready to test. =D

drifting ore
#

so apparently singleplayer and multiplayer use different code too

#

zombie:getInventory works in singleplayer but it's nil in multiplayer

drifting ore
#

if i set zombie as skeleton then in multiplayer it disappears out of existence almost immediately (and its death animation loops forever if you kill it), but in singleplayer it works fine

drifting ore
#

what's causing the skeleton zombies disappearing issue? It happens specifically in multiplayer

grizzled fulcrum
#

I have no idea about anything you're asking, but I thought I'd ask this question anyway

drifting ore
#

i've tried tracing the decompiled source code but it's just so massive, complicated, interconnected and, well, decompiled, that i couldn't figure out any concrete details

#

the behavior is different between singleplayer and multiplayer specifically, not sure if it has anything to do with client vs server

#

in singleplayer, skeleton zombie works exactly the same as normal zombie

#

but in multiplayer, skeleton zombies tend to vanis out of existence promptly

#

and when you kill them, they're stuck in half-dead state where you can't attack them anymore because they're not alive, but you can't pick up the corpse and access inventory because they're not dead either (the downed animation also never stops)

#

to be frank having at all separate routines for singleplayer and multiplayer is just a bad software design

#

singleplayer should work as multiplayer server running on the same machine as the multiplayer client

drifting ore
#

well maybe it's just another case of a menu screen setting up a bunch of stuff that doesn't exist if you use a different menu to enter a game

grizzled fulcrum
#

I noticed other mods have that same issue and I think just check if it's in fake dead then just kill it or something

red tiger
#

The server-side was already cursed(TM). It's now even moreso.

long pier
#

what script controls the animation for whispering/yelling

frank elbow
topaz tangle
#

i am a big dumb idiot and have decided to attempt to make a vehicle mod with almost zero prior experience!.... i feel i may be in a bit over my head tbh!!!

tacit carbon
#

how do I create a context:addOption to when I right click the ground?

topaz tangle
thick karma
#

Examples available in True Music Jukebox if you want to refactor. Much simpler example available in Meditation if you're only adding a single option

abstract raptor
#

Anyone know how I might be able to move a car with code

#

I tried getting the controller but hmm

#

CarController that is

drifting ore
#

isodeadbody:reanimateNow() doesn't work in multiplayer and I have no idea why

red tiger
#

Build 41 neutered a lot of the server's functionality / ability to control things.

drifting ore
#

anyway how would I proceed about it?

red tiger
#

You could try calling it on a random client.

drifting ore
#

what do you mean?

red tiger
#

Server <-> Client Lua Command Event API

drifting ore
#

you mean sendServerCommand that kind of stuff?

red tiger
#

Assume anything MP / server-related will be more complicated than it should be.

#

PZ was never supposed to be a multiplayer game.

drifting ore
#

what happens if i send isodeadbody objectid and coordinates so i can find the specific java object, but that client doesn't have that square loaded?

red tiger
#

¯_(ツ)_/¯

#

I don't know the edge cases

drifting ore
#

well I can simply default to broadcasting this signal, but would that work?

red tiger
#

Again not sure. I use that method when I'm out of options server-side.

drifting ore
#

as in not cause sync issues

red tiger
#

Anything to do with zombie spawning or animating has been usually met with intense pain and long debugging sessions.

#

I've watched people s u f f e r

thick karma
drifting ore
#

how do cells work in multiplayer? i'm so confused

bronze yoke
#

define cell

#

because a lot of people use that word to mean things the game doesn't

drifting ore
#

IsoCell getCell()

bronze yoke
#

the cell is the entire currently loaded area for that client

drifting ore
#

what's the equivalent for server?

bronze yoke
#

the same, but the rules there are a little foggier to me

#

it should have the area needed by every client loaded but some lists will be empty iirc

topaz tangle
drifting ore
#

and this needs to be universal between all clients i.e. it must run on the server

#

and i'm having this issue where eaten bodies would get correctly removed when this code runs on the client, but on the server there's not a single 'body removed' log line

bronze yoke
#

and what needs to happen for this to be reached? you didn't mention an error so is getDeadBodys empty or something? maybe an event you're relying on doesn't fire on the server?

drifting ore
#

it does fire because that's the only way the status update messages could show up, and i'm assuming the bodys array is not empty because then it would've caused removal of all bodies in that square

#

when i grab corpses manually it does trigger body removed message

#

but when i drop them they create their own piles even though they should've joined with nearby ones, which i think is another piece of the puzzle

#

if zombie AI runs entirely on client, then it's possible that server side never acknowledges bodies being eaten because it's all processed in zombie AI callbacks.

bronze yoke
#

almost entirely yeah

drifting ore
#

well the callbacks happen on server too so IDK

#

i think the issue might be in that I'm using getEatBodyTarget which seem to control the animation so this might be purely client side

#

yeah well in any case it seems like if i want this at all to work in multiplayer i'll have to bisect the code into server-only and client-only

sour island
#

Putting the robots to good uses

azure rivet
#

spiffo One question, One item can be changed with the sandbox?
As if you had a 80 protection vest as a base, with the sandbox change it to 100 with an int?

bright fog
azure rivet
bright fog
#

But it doesn't automatically applies to an item

#

You need some lua code for it

#

Like, OnGameStart, change the item stats in the script

azure rivet
#

Great, that's I was looking for, you have a guide?

sour island
#

I'll have to dropkick chatgpt for messing up the tiles though lol

bright fog
drifting ore
# sour island

what ai does this thing where it draws form reference?

sour island
#

It's how I was able to generate 300+ cards from a handful of templates

bright fog
#

Nice

sour island
#

This is supposed to be 8/9 blue/red, 7 civ, 1 assassin tile

#

But I guess my instructions weren't clear enough lol

#

Just finished sorting them out by hand

#

still faster than if I started it from scratch

hollow lodge
hybrid inlet
#

Hello everyone, so awhile ago I decided to try making my own music playlist, it worked for one, but the rest didn't. Among the mist of my confusement, I may have accidently deleted the mod in workshop and this shows up when I try to update it.

abstract raptor
#

can we not access CarController or CarController.ClientControls?

bronze yoke
#

we cannot

abstract raptor
#

Hmm... hecc

#

: (

#

I so want to mess around with it. What should I do?

drifting ore
# sour island

i just noticed that there are no file extensions

All of this is gonna live rent free in my head for a very long time.

azure rivet
drifting ore
#

so you'd need scripts either way. Sandbox is just a simple way of taking user input.

azure rivet
#

Ok, there is a specific function to edit the protection parameters of an item, using lua, with the sandbox options so that it is only modified at the beginning of the world.

#

It is difficult to find examples of what each one does.

drifting ore
#

i'll explain it piece by piece since i need to look up individual steps

#

first, to only execute it once, you put the function into Events.OnGameStart.Add(your_function)

#

Second, you retreive the sandbox option in Lua like this: local protection = SandboxVars.MyModID.protection

#

(this assumes that in your sandbox-options.txt you have an entry called option MyModID.protection { ... } ellipsis stands for the option boilerplate code)

#

you get the item java object using local item = getScriptManager():FindItem("Base.desiredItem") (the module is not always "Base" but all vanilla items are in that module, the "desiredItem" is the internal name of whatever you're looking for, same as in item recipe/script)

#

and then you modify that item directly, mainly through item:DoParam("property = value")

#

by the way that reference page above is not complete

#

doparam can also set private variables among which bite, scratch and bullet proteciton

#

biteDefense bulletDefense scratchDefense from the decompiled source code.

azure rivet
#

Thanks, I'll check it.

tacit carbon
#

is there a way to spawn a item on a specific coordinate once on map generation?

grizzled fulcrum
#

if by item you mean world item, I am not sure but I did look up some stuff in the Java code and the function

class IsoGridSquare {
    InventoryItem addWorldInventoryItem(InventoryItem item, float x, float y, float z, boolean transmit_data)
}
``` exists I guess
#

there's probably an easier way but im just not sure

bright fog
red tiger
#

I'm getting close to getting usable Python typings for PZ.

#

Here's what it currently renders. Some issues with types and missing imports.

#

Other than that it's getting solid.

topaz tangle
#

i heart zip bombs :3 (joke)

red tiger
#

AFK for 7 hours.

topaz tangle
#

i have a question about vehicle mod making, what is a "mod folder structure"?

grizzled fulcrum
topaz tangle
#

thank you i didnt even think to look at the wiki, first time modder :3

might post more questions because i am a little stupid
!!!!1

bronze yoke
#

honestly the wiki won't get you too far anyway 😓

topaz tangle
#

it seams to give me enought info, gotta finish texturing the model first

safe silo
#

does anyone know of a mod where you can setup a zone and spawn loot from a set loot table? So for instance, I'll make a zone over Rosewood and have any container in this zone on loot respawn have a chance to add X from this new loot table.

If not, what would be my approach to developing it myself? I'd assume I wouldn't want to use the distribution lua(txt?) files themselves but rather inject the items through the mod or similiar

lilac idol
#

someone should totally give me some mods to fuck me and my entire game over

lilac idol
#

and of course i am immediently downloading it despite knowing nothing about it

bright fog
#

lmao

#

Oh boy

lilac idol
#

this better fuck me and/or my game over in more then one way

#

or im going to be pissed

bright fog
#

If you don't read the modpage, it will

lilac idol
#

i dont have eyes

bright fog
lilac idol
#

so i cant read

bright fog
#

Perfect

lilac idol
#

👍

bright fog
#

gl

lilac idol
#

i cant wait to brutally die

bright fog
#

:)))))))

#

You will

#

I am pretty sure of it

#

Make sure to put x16 population

lilac idol
#

so x160 yes?

#

why is my game screaming at me

#

i am the master of this videogame i will install these mods game you cant stop me

topaz tangle
#

hello, would anyone be able to help me with how i have to do wheels?

unreal pewter
#

so i was attempting to remove lootable maps from loot tables, and was told this code would work, but idrk what it does or anything about it, and i got an error while running it. heres the code:

    if ProceduralDistributions.list[MapDistributions].items[i] == MapsToRemove then
        table.remove(ProceduralDistributions.list[MapDistributions].items, i+1)
        table.remove(ProceduralDistributions.list[MapDistributions].items, i)
    end
end```
lilac idol
#

why did i download your mod

unreal pewter
lilac idol
#

use gemini to decode it

unreal pewter
#

?

lilac idol
#

"there is a problem with the script on line 148 of a file called "Project Gurashi Distribution.lua". The specific error is a "null reference error" which means that the script tried to use a variable that was never initialized or assigned a value."

bronze yoke
#

ProceduralDistributions.list[MapDistributions] did not return a value

unreal pewter
#

interesting?

#
    "CrateMaps",
    "CrateMechanics",
    "GasStorageMechanics",
    "Hiker",
    "MagazineRackMaps",
    "StoreShelfMechanics"
}```
fleet bridge
#

ProceduralDistributions.list["MapDistributions"]

drifting ore
#

yeah that's a thing. Your MapDistributions is a table, and it's not the same as string "MapDistributions"

#

you can reduce confusion in Lua because technically ProceduralDistributions.list.MapDistributions is the same as ProceduralDistributions["list"]["MapDistributions"]
the only limitation is that the right method accepts any sequence of characters, whereas the left method can only use valid Lua variable names

bronze yoke
#

you probably wanted to loop through MapDistributions and use each value in there as a key into ProceduralDistributions.list

fleet bridge
#
for i = #ProceduralDistributions.list["MapDistributions"].items, 1, -1 do
   table.remove(ProceduralDistributions.list["MapDistributions"].items, i)
end```

this would work i think and remove all entries in MapDistributions
topaz tangle
#

could someone please assist me with..... how wheels work? im trying to do a custom wheel because the base game ones are too small please help

#

this is all i got 😭

drifting ore
#

IDK anything about it but you can try dissecting any of Ki5 car mods.

topaz tangle
#

going for a diferent style, also no clue how to do anything!!!!!!!

drifting ore
#

are you looking for 3d modeling tutorials or PZ scripting?

topaz tangle
#

i know how to model im just... unsure of how to put it all together and... make it real

#

im a tad stuck

drifting ore
#

well it's why i suggested dissecting a ki5 car. It has custom wheels in it, so you can see and learn how to do the same thing.

topaz tangle
#

yes but i dont know how any of it works.... so none of the info would be useful

drifting ore
#

to start you can literally copy and paste the entire thing and cut off extraneious pieces bit by bit

#

once you figure out the important parts, you can apply that to create your own car mod

topaz tangle
#

no no ive already modeled the wheel, and the main truck

just not sure what the proces from those files to the game is, thats what i need help on

drifting ore
#

well i entered PZ modding knowing absolutely nothing either, but I figure things out little by little, by looking how other mods did certain things

#

asking around for advice is not always useful because the only real experts on PZ are the PZ devs and they're not around, everyone else has disjointed scraps of knowledge

#

if you want to ask, your best bet would be to contact one of developers of car mods

topaz tangle
#

yeah, its just a thing of
i cant look at something like this and just.. know it?
i need things explained

yeah ive been asking for help in the flillibusters mod server, gotten some big pieces of help there!

drifting ore
#

i'm saying this because you seem to been asking for a while and nobody's answering, so probably there's no one here who really knows

topaz tangle
drifting ore
#

i cant look at something like this and just.. know it?
you don't necessarily need to know how things work. You can fall back to customizing someone else's code.

#

which means taking it as-is and making a small change like replacing models and textures

#

doing things like this is not ideal from intellectual property standpoint, but here we're more concerned with "as long as it works" right?

topaz tangle
#

okay okay i think i get what you mean?
ive got a zip file from a vehicle mod,

im a big dumb idiot.... the vehicle mod help tool on the indie stone forums

#

thank you, i apologize if i was rude

serene zenith
#

What are your thoughts about a logging truck?

topaz tangle
drifting ore
#

bonus points if the logging cradle actually visibly fills up with logs when you put them there

#

but it probably shouldn't be able to carry anything other than logs, planks, 2x4s, and long metal pipes

serene zenith
#

Depends on how many it can hold.
Would be a pretty cool find when you're trying to build a base.

drifting ore
#

speaking of cool ideas with trucks

#

is dump truck for PZ a thing?

topaz tangle
#

there is a dump truck mod

drifting ore
#

with it spilling its contents all over the road when you activate the dump

topaz tangle
#

when (or if) i make a larger vehicle pack i will be doing that though

#

just gotta figure out this one first

digital kettle
#

hi all, has anyone been able to use queue skip on their server?

#

its like half implemented in the game

brisk remnant
# topaz tangle this is all i got 😭

Yo my guy, if you want to make a rim out of that add 2 loop cuts to it using Ctrl r and then just delete the outer edges that are a face and it will be rim shaped with just the top faces

hazy dirge
topaz tangle
#

yeah huh!!

hazy dirge
#

these liars around here lately 🙏🏻😭😔

topaz tangle
#

you cant prove i dont

hazy dirge
#

i know damn well that house ain’t go no wifi

topaz tangle
#

internet...

serene zenith
#

Is there a mod to add ice trays?
I was just thinking about those ice treats you'd find in magazine or various TV shhow.
But the more I think about it could give and buff happiness to any beverage.

drifting ore
#

wrong channel; there doesn't seem to be an ice cube mod of any kind

#

but with a bit of know-how you can create an item & recipe to create ice cubes and have them as spice ingredient in beverages

drifting ore
#

in practical terms you can have a crafting recipe for a tray filled with water, which runs lua code that just checks if the tray is frozen. I'm not sure if should be in OnTest or OnCanPerform recipe fields.

limber urchin
#

Hi! I am trying to make a simple mod to reduce scrap wood weight by half and also add the option to select the weight in mod options. The first is done but I am having troubles adding a dropdown or slider for mod options

#

so the mod title is showing in mod options but there is no settings for my mod

drifting ore
#

does anyone know the filename of the game over music in the music bank?

grizzled fulcrum
safe silo
#

Is there anyway I can get the IsoPlayer from IsoCharacter?

fair jolt
#

hey is there way to check who created an item? or put that info when item is created and display it later?

limber urchin
grizzled fulcrum
#

Unless you mean IsoLivingCharacter

#

or IsoGameCharacter or the billion IsoXCharacter classes

#

The thing is, IsoLivingCharacter which is basically a IsoGameCharacter is basically an IsoPlayer

#

like an IsoLivingCharacter can be an instance of an IsoPlayer
This is all as far as I know and not set in stone, I am not superhuman

limber urchin
#

Hi! So now that I managed to have the dropdown shown in modoption but the options do nothing in game:

grizzled fulcrum
#

what code is at ReducedScrapOptions.lua line # 10

limber urchin
#

-- Update the weight of scrap wood items
local items = getScriptManager():getItems()
for i = 0, items:size() - 1 do
local item = items:get(i)
if item:getName() == "UnusableWood" then
item:setActualWeight(weight)
item:setWeight(weight)
print("Updated Unusable Wood weight to", weight)
end
end
end

grizzled fulcrum
#

also I am actually curious on what chatgpt helped you achieve

#

I've personally never used AI for coding and only gave github copilot a quick thought but I don't like the idea of it, so I am just curious and not trying to be like berating

limber urchin
#

with chapgpt I managed to get a dropdown menu in mod options to change the weight of scrap wood from 0.1 to 0.9

#

the option is there but it does nothing ingame

grizzled fulcrum
#

nice, I am surprised chatgpt could help lol

limber urchin
#

that is why I am trying to get help from chatgpt and community and maybe learn something in the process

limber urchin
grizzled fulcrum
#

I've never touched modoptions and I am not sure what they do differently to sandbox options so imma read the docs really quick if there is any

grizzled fulcrum
limber urchin
#

oh so maybe that is a start hahah

grizzled fulcrum
#

you want getScriptManager():getAllItems()

#

I think

grizzled fulcrum
#

only item:setActualWeight

limber urchin
#

nice!

#

local OPTIONS = {
ScrapWeight = 5 -- Default index of choice (0.5)
}

local function updateScrapWoodWeight(weight)
local items = getScriptManager():getItems() -- Ensure this line is correct if getItems() is valid
for i = 0, items:size() - 1 do
local item = items:get(i)
if item:getName() == "Unusable Wood" then
item:setActualWeight(weight)
print("Updated Unusable Wood weight to", weight)
end
end
end

if ModOptions and ModOptions.getInstance then
local settings = ModOptions:getInstance(OPTIONS, "ReducedScrap", "Reduced Scrap Wood Weight")

settings.names = {
    ScrapWeight = "Scrap Weight"
}

local weightOption = settings:getData("ScrapWeight")
weightOption[1] = getText("IGUI_ScrapWeight_01") -- 0.1
weightOption[2] = getText("IGUI_ScrapWeight_02") -- 0.2
weightOption[3] = getText("IGUI_ScrapWeight_03") -- 0.3
weightOption[4] = getText("IGUI_ScrapWeight_04") -- 0.4
weightOption[5] = getText("IGUI_ScrapWeight_05") -- 0.5
weightOption[6] = getText("IGUI_ScrapWeight_06") -- 0.6
weightOption[7] = getText("IGUI_ScrapWeight_07") -- 0.7
weightOption[8] = getText("IGUI_ScrapWeight_08") -- 0.8
weightOption[9] = getText("IGUI_ScrapWeight_09") -- 0.9
weightOption.tooltip = "IGUI_ScrapWeight_Tooltip"

function weightOption:OnApplyInGame(val)
    local weights = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}
    local newWeight = weights[val]
    updateScrapWoodWeight(newWeight)
end

ModOptions:loadFile()

Events.OnGameStart.Add(function()
    local weights = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}
    local selectedWeight = weights[OPTIONS.ScrapWeight]
    updateScrapWoodWeight(selectedWeight)
end)

end

grizzled fulcrum
#

these are just for Item which I assume is what the class is, but I could be wrong in that it isn't something like a ComboItem class

grizzled fulcrum
#
-- These are the settings.
local SETTINGS = {
  options = { 
    box1 = true,
    box2 = false,
  },
  names = {
    box1 = "First Box",
    box2 = "Second Box",
  },
  mod_id = "MyModID",
  mod_shortname = "My Mod",
}
#

I think this looks better than having two tables

#

and you cna just call ```lua
local settings = ModOptions:getInstance(OPTIONS)

#

because your mod id and short name are in that settings table along with the options and names

bronze yoke
grizzled fulcrum
#

oh I see

bronze yoke
#

it's technically valid for subclasses to take the place of their parent classes like that in any situation but whether that actually happens depends on the function

grizzled fulcrum
#

I didn't bother to check what IsoGameCharacter actually was lol, I was just assuming it's some parent class but I didn't know it was abstract

#

Also I couldn't find a method that converts an IsoLivingCharacter into an IsoPlayer which sucks, I think it's like: An IsoLivingCharacter can be an IsoPlayer but an IsoPlayer can't be an IsoLivingCharacter (because it is a subclass that extends IsoLivingCharacter with its own implemented methods)

limber urchin
# grizzled fulcrum also look at way 2 of their guide

STACK TRACE

function: updateScrapWoodWeight -- file: ReducedScrapOptions.lua line # 14 | MOD: ReducedScrap
function: Add -- file: ReducedScrapOptions.lua line # 50 | MOD: ReducedScrap.
[23-07-24 18:03:48.170] LOG : General , 1721768628170> Object tried to call nil in updateScrapWoodWeight.
[23-07-24 18:03:48.170] ERROR: General , 1721768628170> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Object tried to call nil in updateScrapWoodWeight at KahluaUtil.fail line:82..
[23-07-24 18:03:48.171] ERROR: General , 1721768628171> DebugLogStream.printException> Stack trace:.
[23-07-24 18:03:48.172] LOG : General , 1721768628172> -----------------------------------------
STACK TRACE

function: updateScrapWoodWeight -- file: ReducedScrapOptions.lua line # 14 | MOD: ReducedScrap
function: Add -- file: ReducedScrapOptions.lua line # 50 | MOD: ReducedScrap.
[23-07-24 18:03:48.172] LOG : General , 1721768628172> .
[23-07-24 18:03:48.481] LOG : General , 1721768628481> FirstNAME:OneUpHonguito.

grizzled fulcrum
#

you should format it like:
```lua
my code
```

#

it hurts the eyes to not format it lol

limber urchin
#

oh ty

#
local SETTINGS = {
    options = { 
        ScrapWeight = 5 -- Default index of choice (0.5)
    },
    names = {
        ScrapWeight = "Scrap Weight"
    },
    mod_id = "ReducedScrap",
    mod_shortname = "Reduced Scrap Wood Weight",
}

local function updateScrapWoodWeight(weight)
    -- Update the weight of scrap wood items
    local items = getScriptManager():getItems() -- Assuming this function exists or you have another way to get items
    for i=0, items:size()-1 do
        local item = items:get(i)
        if item:getName() == "Unusable Wood" then
            item:setActualWeight(weight)
            print("Updated Unusable Wood weight to", weight)
        end
    end
end

if ModOptions and ModOptions.getInstance then
    local settings = ModOptions:getInstance(SETTINGS)

    local weightOption = settings:getData("ScrapWeight")
    weightOption[1] = getText("IGUI_ScrapWeight_01") -- 0.1
    weightOption[2] = getText("IGUI_ScrapWeight_02") -- 0.2
    weightOption[3] = getText("IGUI_ScrapWeight_03") -- 0.3
    weightOption[4] = getText("IGUI_ScrapWeight_04") -- 0.4
    weightOption[5] = getText("IGUI_ScrapWeight_05") -- 0.5
    weightOption[6] = getText("IGUI_ScrapWeight_06") -- 0.6
    weightOption[7] = getText("IGUI_ScrapWeight_07") -- 0.7
    weightOption[8] = getText("IGUI_ScrapWeight_08") -- 0.8
    weightOption[9] = getText("IGUI_ScrapWeight_09") -- 0.9
    weightOption.tooltip = "IGUI_ScrapWeight_Tooltip"

    function weightOption:OnApplyInGame(val)
        local weights = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}
        local newWeight = weights[val]
        updateScrapWoodWeight(newWeight)
    end

    ModOptions:loadFile()

    Events.OnGameStart.Add(function()
        local weights = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}
        local selectedWeight = weights[SETTINGS.options.ScrapWeight]
        updateScrapWoodWeight(selectedWeight)
    end)
end
grizzled fulcrum
#

ScriptManager does not have getItems function, so even though chatgpt assumes it exists it actually does not

#

First line of updateScrapWoodWeight

bronze yoke
#

isolivingcharacter isn't abstract but i'm not sure anything actually instances it

limber urchin
grizzled fulcrum
grizzled fulcrum
bronze yoke
#

yeah, that's usually shared code with another subclass, there's isosurvivor i think they use for some ui elements

grizzled fulcrum
#

I know it's boring and it sucks and their website is old and stinky but it really really helps

#

It's like not knowing a language, because if you go to Spain and don't know much about the language but at least know enough to ask for directions, you will have a much better time over someone who does not know a single spanish word

#

like this here:

local items = getScriptManager():getAllItems()
-- is the same as
local script_manager = getScriptManager() -- type is ScriptManager
local items = script_manager:getAllItems() -- type is a java ArrayList<Item>
#

but if you call a nil func like this one:

local items = getScriptManager():getItems() -- getItems function is nil

then it will return nil, and nil is like a 0/nothing, it is an object that has no existence, which makes items variable nil/non-existent, so when you try to loop through the items, you are essentially looping through nothing

#

that's why it's erroring basically

limber urchin
#

oh ty for the advice! doing this silly mod is a way for me to start learning something about this

#

the mod works just fine without mod options... It would be easier for me to edit my mod options manually on the script .txt file

#

but I wanted to challenge myself into adding the dropdown menu for modoptions

grizzled fulcrum
#

Also my general copy paste advice for Lua stuff that will save your brain:

#

I should probably save this snippet so I don't have to re-type it every time lol

limber urchin
#

hahaha

#

well now there is no error but changing the weight does nothing

#

I tried doing it before loading a game

#

and after

grizzled fulcrum
#

I figured that would happen, probably because of the event you're using OnGameStart

#

I am not sure where is the point in time where you can't modify script item stuff, I have always done it in OnGameBoot or at latest OnInitGlobalModData

#

OnGameStart event happens basically when you click to enter the game iirc

#

So probably try OnInitGlobalModData event instead of OnGameStart

#

So just ctrl+f and search for words and stuff if you're curious

limber urchin
#

Events.OnGameStart.Add(function() was taken from the guide of modoptions

bronze yoke
#

generally, OnGameBoot if you're making set changes, OnInitGlobalModData if you want sandbox options

limber urchin
#

that is probably where chatgpt got it

#

the one I linked to you before

grizzled fulcrum
#

what does Updated Unusable Wood weight to print in the log?

bronze yoke
#

OnGameStart is too late to change item scripts, it fires after the area around the player is loaded so items in that area won't be affected

limber urchin
#

oh ok

#

so which one should I use?

grizzled fulcrum
#

I am confused also, I assumed OnGameStart would be too late like you mention but why would they refer to that in the documentation...

#

actually I think it's for changing options mid game in general, not specifically related to item script stuff

limber urchin
#

oh so maybe that is why

bronze yoke
#

yeah, for most purposes ongamestart would be fine, just not for this

limber urchin
#

maybe it is not possible to change items midgame

grizzled fulcrum
#

well cant use on game boot, it has to be some part between the game loading and the game start

grizzled fulcrum
#

I'm just not the best modder to ask so I am kinda learning as I go too

limber urchin
#

so OnInitGlobalModData it is

grizzled fulcrum
#

maybe OnPreMapLoad

#

because then the items would change before the player loads the map

#

I mean it doesn't hurt to just slap it in OnInitGlobalModData anyway, im just over-analysing it

#

hey albion you should add event call order to the docs

#

idk how you would do it since some stuff doesn't have a set order but the ones that do have a set order

bronze yoke
#

i prefer OnInitGlobalModData because it's the first event after sandbox options initialise, but i don't think mod options have the same issue of some things being 'too early'

bronze yoke
grizzled fulcrum
#

I can try add it in a PR if you are fine with it, but I am just not sure on the styling to use

#

initially I thought of just putting it in a list like

  • event 1
  • event 2
  • ...
#

but thats kinda not pretty

bronze yoke
#

the problem is that page is generated by a script so manual changes will get overridden

grizzled fulcrum
#

python ☕

#

wait you have json file, nice

bronze yoke
#

honestly it'd probably be better to have some kind of landing page with manually written information like that available on it, maybe an example of how to use events and stuff too, and then a link to the event list we have now

grizzled fulcrum
#

trueee

limber urchin
#
local SETTINGS = {
    options = { 
        ScrapWeight = 5 -- Default index of choice (0.5)
    },
    names = {
        ScrapWeight = "Scrap Weight"
    },
    mod_id = "ReducedScrap",
    mod_shortname = "Reduced Scrap Wood Weight",
}

local function updateScrapWoodWeight(weight)
    -- Update the weight of scrap wood items
    local script_manager = getScriptManager()
    local items = script_manager:getAllItems()
    for i=0, items:size()-1 do
        local item = items:get(i)
        if item:getName() == "Unusable Wood" then
            item:setActualWeight(weight)
            print("Updated Unusable Wood weight to", weight)
        end
    end
end

if ModOptions and ModOptions.getInstance then
    local settings = ModOptions:getInstance(SETTINGS)

    local weightOption = settings:getData("ScrapWeight")
    weightOption[1] = getText("IGUI_ScrapWeight_01") -- 0.1
    weightOption[2] = getText("IGUI_ScrapWeight_02") -- 0.2
    weightOption[3] = getText("IGUI_ScrapWeight_03") -- 0.3
    weightOption[4] = getText("IGUI_ScrapWeight_04") -- 0.4
    weightOption[5] = getText("IGUI_ScrapWeight_05") -- 0.5
    weightOption[6] = getText("IGUI_ScrapWeight_06") -- 0.6
    weightOption[7] = getText("IGUI_ScrapWeight_07") -- 0.7
    weightOption[8] = getText("IGUI_ScrapWeight_08") -- 0.8
    weightOption[9] = getText("IGUI_ScrapWeight_09") -- 0.9
    weightOption.tooltip = "IGUI_ScrapWeight_Tooltip"

    function weightOption:OnApplyInGame(val)
        local weights = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}
        local newWeight = weights[val]
        updateScrapWoodWeight(newWeight)
    end

    ModOptions:loadFile()

    Events.OnInitGlobalModData.Add(function()
        local weights = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}
        local selectedWeight = weights[SETTINGS.options.ScrapWeight]
        updateScrapWoodWeight(selectedWeight)
    end)
end
#

this is the updated code

#

still no error now

grizzled fulcrum
#

could be interesting for a proper web page for the events, cant you host one from a github repo for free or am I mistaken

limber urchin
#

but it does nothing

grizzled fulcrum
#

like an interactive call tree for events would be nice instead of a list, for beautification, though it wouldn't be minimalistic

bronze yoke
#

yeah, you can host websites off of github, i have a couple resources that could be consolidated into something like that too

#

at the moment they're just in a repo of .md files that link to each other, it's pretty basic

grizzled fulcrum
#

nothing you can't parse though

grizzled fulcrum
#

In SETTINGS.names table, you can change the name to a translation key like ISUI_ScrapWeight and then in the translation files have that name defined there

#

wait @limber urchin do you want your mod to affect weight like from the server too?

limber urchin
#

I am playing singleplayer

grizzled fulcrum
#

ModOptions is only really for client-side stuff™️ so theoretically any client player could change the weight of the item if you don't check for stuff like that

limber urchin
#

but maybe If I want to publish this then we can make it so it affects server and client

grizzled fulcrum
#

I'd recommend a sandbox option, if you know what they are and dont mind using it, it's a much better system than modoptions in my opinion

#

no need for dependancy, can enforce it on the server-side, etc

grizzled fulcrum
limber urchin
#

but then you cannot change the weight later

grizzled fulcrum
#

since you can't change weight in game, this function will do essentially nothing

grizzled fulcrum
#

without individually modifying the weight of a specific item directly (so like loop through container and get the item or something like this)

limber urchin
#

it does not have to be in the middle of the game

grizzled fulcrum
#

I guess, but you can change the sandbox options at any time too

limber urchin
#

but before loading the saved game

limber urchin
#

for singleplayer that is not an option

#

unless you use a mod like sandbox options

grizzled fulcrum
#

I never play singleplayer so I didn't know that, that's weird

#

I wonder why that's not in the game by default but I wont question it

limber urchin
grizzled fulcrum
#

I see, so your goal is to change the item's weight, does it matter if it's in game too?

limber urchin
#

for singleplayer there is a mod called "change sandbox options"

grizzled fulcrum
#

because you can change a script item's weight at any point apart from when you're loaded into the game (a script item is an item defined in a item script like media/scripts/items.txt)
you can change an item's weight only when you're loaded into the game, but it will only affect the item specifically and not all of them which means you will have to do it for every item the user views

#

Right now I'm just trying to define what you want the mod to do specifically

#

just like some insight

#

but I do understand the overall goal

grizzled fulcrum
limber urchin
#

right my initial idea with this mod was to reduce scrapwood weight

#

so I did this:

module Base
{
item UnusableWood
{
DisplayCategory = Material,
Weight = 0.5,
Type = Normal,
DisplayName = Unusable Wood,
Icon = UnsableWood,
WorldStaticModel = UnusableWood,
}
}

#

the script

grizzled fulcrum
#

but?

limber urchin
#

then I wanted to add the option so other users can select the weight they want from 0.1 up to 0.9

#

1 is default for scrapwood

#

so that is why I thought about using modoptions so people can select the weight they want through the options menu

grizzled fulcrum
#

is this singleplayer only focused?

#

by this, I mean that "other users" are single users in each world

#

and not multiple users having unique weights for each player

bronze yoke
#

i think this would suit sandbox options better

#

mod options is for per-user config, editing items that way will probably cause weird things to happen

grizzled fulcrum
bronze yoke
#

(i also think mod options has just a weird api that can be difficult to work with, especially for new modders)

limber urchin
#

then I guess the best way to do it as you guys suggest is through sandbox options

#

with the downside singleplayers cannot edit the weight later on

grizzled fulcrum
#

it's so simple through sandbox options like I could pretty much do it right now in a couple lines

limber urchin
#

(unless they use a mod like sandbox options)

grizzled fulcrum
#

like suggest it in your mod description

#

or even add it as a dependency although I wouldn't fully recommend as it's more of a soft dependency and not a hard one

#

I just realised I've been spelling dependency wrong this whole time lol

limber urchin
#

right, because the mod can work nonetheless with my default 0.5 weight

grizzled fulcrum
#

yes

limber urchin
#

ok if you don't mind would you please write the lines for sandbox options?

grizzled fulcrum
#

Most of it is done in a script file for sandbox-options.txt, ill find an examples in a sec

limber urchin
#

then I can test changing the value using the mod ""change sandbox options""

grizzled fulcrum
#

the lua part is done on the server side, like in media\lua\server\mymod.lua

limber urchin
#

and if that works, then I can suggest using that mod for singleplayers

grizzled fulcrum
#

wait you have more guides?? holy

#

wait nvm I already have it starred im stupid LOL

#

smooth brain syndrome right here

echo lark
#

anyone know why a teleport function would work if the location your teleporting to is within view distance, but it doesnt work if its outside the view distance?

grizzled fulcrum
#

I would say it's probably because the part outside of the view distance isn't loaded, but then why wouldn't the game just load the squares and then teleport

#

when you've been tweaking items on the client side only for the longest time and didn't even notice til now (me rn)

#

probably why there's a couple bugs that are random and unrepeatable that some users reported

limber urchin
#

so if I am going to use a sandox setting then I don't want a dropdown menu. instead people can input the weight and a tooltip saying default 1.0

grizzled fulcrum
#

you can have either or, it's up to you thats the best part

#

dont even need a custom tooltip, default sandbox option tooltips show default min and max

#

just read that guide albion posted for the sandbox-options.txt, ill get the lua in like 2 sec

echo lark
hard tulip
#

is there a reason why adding a recipe to the game flat out deleted some of the categories

#

(i may be stupid)

bronze yoke
#

does your mod have a media/scripts/recipes.txt

grizzled fulcrum
#

anyway, @limber urchin this is the lua for the server like lua\server\MyModID.lua

local getScriptManager = getScriptManager

local MyModID = {}

function MyModID.init()
    local sandbox_options = SandboxOptions["MyModID"]
    local script_manager = getScriptManager()

    -- The table of tweaks, you can put whatever you like in this!
    -- It's key is the full item name including module
    -- It's value is a table of all the script item properties to be tweaked and their soon-to-be values
    local tweaks_table = {
        ["Base.UnusableWood"] = {
            ["Weight"] = sandbox_options.UnusableWoodWeight, -- Change this to the actual sandbox option name
        },
    }

    -- Loops through all of the tweaks in the table above
    for tweak_name, tweak_data in pairs(tweaks_table) do
        -- Loops through each property to be tweaked for that specific item
        for item_property, item_value in pairs(tweak_data) do
            -- Gets the script item and sets the property
            local script_item = script_manager:getItem(tweak_name)
            if script_item ~= nil then
                script_item:DoParam(item_property .. " = " .. item_value)
            end
        end
    end

    print("[MyModID/server]: Applied tweaks to items.")
end

-- Called after SandboxOptions are loaded, so it's valid!
Events.OnInitGlobalModData.Add(MyModID.init)

return MyModID
bronze yoke
#

you overwrote the vanilla file, it needs a unique name

hard tulip
#

i winged so many things im surprised the recipe even got added and works

#

i see

#

appreciate u

#

so i change the name of recipes.txt to something else?

bronze yoke
#

yeah, something like MyMod_recipes.txt ideally

hard tulip
#

ty

grizzled fulcrum
#

like is it a function or something

echo lark
# grizzled fulcrum Do you mind I ask how you are teleporting the player?

the last thing i tried was this:

    player:setX(location.X);
    player:setY(location.Y);
    player:setZ(location.Z);
    player:setLx(location.X);
    player:setLy(location.Y);
    player:setLz(location.Z);
end```
cuz i saw a few other mods used setLx/setLy/setLz. but it didnt change anything. and like i said it works fine if its in view distance which is realy weird
grizzled fulcrum
#

I will look up how the base game does it

#

well the game does it by packets

#

so I don't think we can send packets from lua?

bronze yoke
#

when are you calling this?

limber urchin
#

like this

#

oh sorry. I am reading through your notes now xD

limber urchin
#

VERSION = 1,

option ReducedScrap.UnusableWoodWeight
{
type = double, min = -9.5, max = 12.34, default = 1,
page = ReducedScrap, translation = UnusableWoodWeight,
}

#

this is my sandbox-options.txt

#

so

grizzled fulcrum
#

since you use the option name UnusableWoodWeight, you don't need to change line 14 like I commented

limber urchin
#

sandbox_options.UnusableWoodWeight, -- Change this to the actual sandbox option name

#

right!

#

no need to chage that I guess

grizzled fulcrum
#

also you might not want a min value of -9.5 because that would be negative

#

negative weight doesn't exist I believe

limber urchin
#

oh I just used whatever was in the guide lol

#

those were the values haha

grizzled fulcrum
#

oh, those values you can change to what you want like a minimum of 0.0, maximum of say 10.0

#

whatever you realistically want

#

but that should work

bronze yoke
#

negative weight does actually work but it really shouldn't

#

and for some reason is one very specific thing that has been confirmed won't work in b42

grizzled fulcrum
bronze yoke
#

yeah

grizzled fulcrum
#

wth

limber urchin
#

void something

#

a way to make bag larger

#

you add items with negative weight

#

so you get "more space"

grizzled fulcrum
#

like bag addons? interesting way to go about it

limber urchin
#

yes... is janky but it works

grizzled fulcrum
#

I'd probably put a context item like "Attach Pouch" when right clicking a bag, and then make that set the bag's weight to like weight - 5 or something like that

limber urchin
#

but I am going to stay within positive numbers

limber urchin
grizzled fulcrum
#

nice

limber urchin
# grizzled fulcrum nice

editing the weight using the mod "change sandbox options" does not work. Let me see it works for a new game

grizzled fulcrum
#

I didn't know it was a mod item

#

in the tweak table for the lua, change the full item name from "Base.ScrapWood" to "ReducedPlank.ScrapWood"

#

also if you still change the item script definition in your items.txt, remove it

limber urchin
#

no this is what happens.... ReducedPlank mod does not reduce the weight for Scrap wood

#

so what I did when I first started with this mod idea was to add it to ReducedPlank

#

and forgot to undo that

grizzled fulcrum
#

I am not understanding I think

#

It says the item module is by ReducedPlank

#

I am not sure what reduced plank does, but it says the inventory item is RecuedPlank.ScrapWood and not Base.ScrapWood by judging the screenshot you sent

limber urchin
#

one moment!

bronze yoke
#

shouldn't SandboxOptions["ReducedScrap"] be SandboxVars["ReducedScrap"]

grizzled fulcrum
#

oh true, I probably should have wrote it in the vscode and not in discord lol

#

I'm surprised it didn't error lol

#

oneup, change what albion sent above on line 6

#

when you get the chance

limber urchin
#

ok

#

so this is what happens... this is the default mod "ReducedPlank" which as you can see it does not include scrap wood

#

when I first started with my mod to reduce scrap what I did was to add UnusableWood.txt to the scripts folder inside "ReducedPlank" mod

grizzled fulcrum
#

huh

limber urchin
#

so that is why the mod showing in the tooltip was "ReducedPlank"

grizzled fulcrum
#

why the heck does it say the item is from the mod ReducedPlank

#

oh

#

wait so you removed the item definition from the reducedplank mod and it doesnt show now?

grizzled fulcrum
limber urchin
grizzled fulcrum
limber urchin
grizzled fulcrum
#

it will, it's because I typed it all in discord and not in vscode first

limber urchin
#

how do I do so it shows my mod name in the tooltip?

grizzled fulcrum
#

well you can insert it through lua but that's a pain, honestly I'd just override the vanilla scrap wood item in your items.txt

#

then you would change Base.ScrapWood in the lua to MyModID.ScrapWood

#

wait dont do that, just edit the tooltip it's not that much more code lol

#

one sec ill post an example

limber urchin
#

nonetheless that is just cherrypicking

#

the mod works great now!!

#

thank you so much!

#

I ll make sure to credit you for your help if I decide to post it in the workshop

grizzled fulcrum
#

uhh in the item tweak table that has the weight value in lua, just add a new entry (just copy the syntax like for the weight) and put it to like

bright fog
limber urchin
grizzled fulcrum
#

wait what

#

not supposed to happen lol

#

It should apply the item tweak every time you load a save

#

create or load*

#

or by game you mean the save?

limber urchin
#

for my current save. If I change the value it does not take effect until I reload the world

#

yes

#

save

grizzled fulcrum
#

yes that's intended for sandbox options, now you can make it change the value mid-game but like I said before it would only work for the specific item when the player views it

#

now if you do it right technically it would look like nothing changed to the player compared to sandbox options, but ye

limber urchin
#

yes

#

I just don't understand why others mod (such as ReducedPlank) show the name in blue in the tooltip. Is it because that mod happens in client and not in server?

#

so whenever something is modified through sandbox option is does not reflect in the tooltip?

#

do I get that right?

grizzled fulcrum
#

like if you were to create and define your own item right now and put it in the game, it will show as your item

#

but since it's a vanilla item, it doesn't show the text

#

you can override the vanilla item so that it's technically yours, but sometimes this breaks other mods that might want to change stuff like recipes for the vanilla scrapwood

limber urchin
grizzled fulcrum
#

yes

grizzled fulcrum
grizzled fulcrum
#

the way I am doing the item tweaking, is basically modifying the item script definition at runtime which obviously we need to do because the sandbox option is also able to be changed at runtime (runtime meaning like while the game is running at all)

#

if you change it via the definition itself, it will be set to one value, it's like a static and non-changing definition

#

You can tweak the tooltip if you'd like like

local tweaks_table = {
    ["Base.UnusableWood"] = {
        ["Weight"] = sandbox_options.UnusableWoodWeight,
        ["Tooltip"] = "<RGB:1,0,1>WawaMyTooltipEpicVeryCool",
    },
}
#

it wont be a 1:1 replica of how the game handles it but if you want your mod id on the item that's probably how I'd do it just for simplicity

limber urchin
#

hahaaha

grizzled fulcrum
#

but the game uses this colour so yer

limber urchin
#

TooltipEpicVeryCool

#

xD

bronze yoke
#

i wonder if item:setModID("MyModID") is related to the tooltip

#

i'm not really sure what else it would track them for

grizzled fulcrum
#

yes it would (I think)

#
layoutItem.setLabel("Mod: " + this.getModName(), color.r, color.g, color.b, 1.0F);
#

and getModName just gets this.scriptItem.modID or something like that

grizzled fulcrum
#

now I've had some problems of my own but never bothered to ask here but I plan on changing toothbrush item to a DrainableComboItem

#

the problem is that I read somewhere it becomes "invalid" by the game and then it gets removed from the world, how would I handle this specifically?

limber urchin
#

that is why everything we did was not working xD

#

now it shows my mod hahahaha

grizzled fulcrum
#

it's happened to me multiple times too dw

bronze yoke
#

yeah, if an item in the world's Type doesn't match the script when it loads, it gets deleted

#

not really sure there's much you can do about it except tell people to use new saves

#

maybe you can overengineer a system to replace toothbrushes when they enter the inventory or something

limber urchin
#

perhaps?

#

going to try

grizzled fulcrum
#

telling people to use new saves will not suffice as it will affect basically every player in the game

#

wait by "when it loads" you mean when it's loaded by the player when they open the container?

bronze yoke
#

no, when the square loads

limber urchin
grizzled fulcrum
echo lark
bronze yoke
#

yeah you can't teleport during timed actions

echo lark
#

well you can if the location is within your view distance XD

#

well the teleport wasnt happen during the time based action. it would call a function that then did the teleport

#

maybe its a timing thing. i duno. ill just figure it out withou tthe time action

drifting ore
#

Have anyone encountered this problem? For me everything works fine so I've no clue whatsoever.

topaz tangle
#

does anyone know how to make windshields for vehicles?
working on getting all my textures done :3

drifting ore
#

wow, awesome.
sendClientCommand has a working singleplayer version but sendServerCommand silently fails unless it runs on a dedicated server

digital kettle
#

Anyone has experimented with a whitelist skip queue system?
The vanilla one is almost ready to go, but sadly not working.

#

I know most people play this game singleplayer, but the multiplayer has a lot of potential.

bright fog
limber urchin
topaz tangle
#

thought i figured out how do do windshields, i was wrong

#

my error did result in a cool looking model though!
if i ever did interiors id use this

topaz tangle
tranquil kindle
# topaz tangle if ANYONE could help me with them i would REALLY appreciate it, im just not sure...

There are some kind of masks that you can use to apply window effect on vehicle, but youre still better having own window texture before applying it.https://theindiestone.com/forums/index.php?/topic/24408-how-to-create-new-vehicle-mods/

The Indie Stone Forums
  1. The first thing you want to do, as with most mods is to create your mods folder structure, use the image below as a reference, replacing MOD_NAME with the name of your mod: Spoiler mods MOD_NAME mod.info MOD_NAME.png media lua client MOD_NAME.lua models Vehicles_MOD_NAME.txt scripts vehicles M...
topaz tangle
#

is it know weather or not it will effect anything if my texture format isnt very clean ? (photos for example)
im a very messy person....

tranquil kindle
#

Functionally it should not be an issue, the thing is that you might lose alot of potentiall details if you do your unwrapping wrong.

topaz tangle
#

i wanted to keep pretty simple detailing for now, the uv unwraping should be fine (i did it before texturing)

#

assuming something catastrophic doesnt happen

tranquil kindle
#

I'd suggest importing your model to the game to check it out for yourself. I'd also suggest moving to #modelingfor more 3d related questions/things

#

Just to keep things organised

topaz tangle
#

yup getting all of it figured out now, thanks!

topaz tangle
#

hmm ive gone through all of it and set everything up according to the tutorial, but nothing is showing up currently, what could have i done wrong?

topaz tangle
#

okay.. it seams one of my my files need to be a .info file but i cant save my text file as that

topaz tangle
#

not 100%sure that even the issue tbh

fair jolt
#

is there way to prevent fire from creating? rather than using Events.OnNewFire and removing it?

austere sequoia
topaz tangle
#

tbh i have no clue what im looking at, im trying to save a file from notepad++ as a .info file and not a .txt

austere sequoia
topaz tangle
#

yeah i use windows 11

austere sequoia
#

If this is not working, just copy the mod.info from another mod and rewrite it

topaz tangle
#

i didnt even think of that tbh

#

thanks!

austere sequoia
#

you are welcome

topaz tangle
#

i dont have anything that can open a .info file

austere sequoia
topaz tangle
#

?

austere sequoia
#

try type in "Editor" in your windows search bar

jovial flare
topaz tangle
topaz tangle
austere sequoia
topaz tangle
#

i use notepad++

austere sequoia
topaz tangle
#

Huh... mine cant

austere sequoia
#

rightclick on the .info file, edit with notepad++?

topaz tangle
#

nope

austere sequoia
#

and you dont have the normal "Windows Notepad" (without any ++)? It usually is preinstalled on windows. If not, maybe google for the microsoft download

#

and if even that does not work, download Visual Studio Code (if you ever intend of modding lua stuff, you probably want this anyway)

topaz tangle
#

windows notepad only supports .txt

#

notepad++ works with LUA coding

austere sequoia
topaz tangle
#

i cant open .info files though :(

austere sequoia
topaz tangle
#

no that just isnt even like, an option

austere sequoia
#

the open with option should show you like all programs

topaz tangle
#

it only lets me open with word

austere sequoia
topaz tangle
#

not on the .info file i have access to

austere sequoia
topaz tangle
#

i cant

austere sequoia
# topaz tangle

wait, this is all you can see when you rightclick on the file? F this, ima protect my windows 10 with my life now

topaz tangle
#

it is because its tied to word

#

other files are normal

waxen gate
#

Hello. Is it possible to use a map from the workshop as a base for you're own map? Or would I need to make an entire new map? I have the MOD author's permission, I just don't know how or what to do.

austere sequoia
topaz tangle
#

i will tommorrow, event in the pz server i play on is starting now thanks for the help!

jovial flare
#

hf!

topaz tangle
#

thanks!!!!!!!!

sonic summit
#

I am completely new to this and so sorry if this is a silly question; but with the current modding capabilities, would it be theoretically possible to create a sound mod to say, add appropriate reverb to sounds if you're in a building or outside, etc (conceptually the same as the "Sound Physics Remastered" mod for minecraft, for those familiar)

bronze yoke
#

not really

#

at least not through the intended api

#

a java mod could do it, the game already applies reverb to inside sounds, it's just not that noticeable

round rock
#

is there a place i can spout mod ideas?

drifting ore
topaz tangle
#

sobbing, why do .info files even exist i cannot open them why why why why why why why why why why why

drifting ore
#

or vs code

topaz tangle
#

i cant

#

(i dont have word)

drifting ore
#

go to file explorer options and turn off "hide file extensions for known files"

#

then select the .info and change it to .txt

#

do what you need to do

#

and then when you're finished, change it back to .info

topaz tangle
#

i cant make .txt files into info files thouhg

drifting ore
#

why not

topaz tangle
#

i....

#

i cant

#

thats

#

not an option

drifting ore
#

are you not able to rename the file

topaz tangle
#

i can rename files

drifting ore
#

do they have the file extensions

topaz tangle
#

i need it to be that type of file aswell

#

not just the name

topaz tangle
#

how

drifting ore
#

in file explorer options

#

there should be a button somewhere on the top

#

im on windows 11 so i can't show you a screenshot

topaz tangle
#

im also on windows 11

drifting ore
#

3 dots

topaz tangle
#

okay i turned that off

drifting ore
#

now go to rename the info file

#

and highlight the .info extension

#

change it to .txt

#

then press enter

#

and confirm the change when the popup shows

topaz tangle
#

THANK its a .info now

#

the goat

drifting ore
#

🙏

topaz tangle
#

HOPEFULLY it works now

drifting ore
#

if you ever need more support, you're free to join my modding discord in my About Me, we've got a few experienced modders there too, plus you can both give and use ideas in our forums

topaz tangle
#

i will do that tbh!!!

drifting ore
#

:D

#

🙏

crisp rock
#

there is a big modding discord for pz too

#

im honestly not sure where the links are

drifting ore
topaz tangle
#

FUCK YES

crisp rock
#

that one has 1,5k people in it

topaz tangle
#

IT WORKED DAWG

drifting ore
#

i use it as a community server for my mods + community, but also as a smaller dev community

drifting ore
topaz tangle
#

ive been trying ALL DAY to get this shit just in the game

#

hopeing it works!

grizzled fulcrum
#

is it zipped or something

topaz tangle
#

word glitch

#

its all fixed now tho!!!

grizzled fulcrum
#

nice

drifting ore
#

use notepad++ or vs code

#

you need a text editor

#

not a rich text editor

topaz tangle
#

yeah i use notepad++!!!!

#

i would never pay for word

wanton geode
drifting ore
analog breach
#

real

topaz tangle
#

Update: mod loads and everything, was unable to locate my vehicle but at least it loads!!!!!

analog breach
#

Hey is anyone on RN that can help me?

#

I'm developing a mod, and I have everything working, the mod works the recipe works. But one slight problem

#

It breaks the crafting tab and it no longer allows for you to rip clothes when enabled

grizzled fulcrum
#

can you share the recipe script file if possible

analog breach
#

Yeah

#

Give me one second

#

Want it in dm?

#

@grizzled fulcrum

#

it removed every crafting feature except for 32 in total

grizzled fulcrum
#

huh

#

looks normal, is there any errors in debug mode?

#

although I dislike when people use module Base (because you're defining the item in the vanilla module not your own), I am not sure if this breaks vanilla or not as I have never used module base outside of overriding vanilla items

analog breach
#

im like 100 percent new to this lol

grizzled fulcrum
#

but it should be fine to use module base regardless of arguing what someone "should" do

analog breach
#

this is my first legit mod

grizzled fulcrum
#

if not, use -debug launch parameter for the game

analog breach
#

no i dont, last time and only time i did it just didnt work

#

everything went crazy

#

but ill try

grizzled fulcrum
#

you mean like text not loading and stuff?

analog breach
#

yeah

#

weird symbols

#

everything wonky

grizzled fulcrum
#

if so, that usually means an error happened before the game could run the code that gets the font stuff

analog breach
#

Ok

grizzled fulcrum
#

usually it will show a debug menu up with a couple panes and there are 3 buttons at the top-middle of the screen. you should just click the right-most one (which means continue in the debugger) a couple times until it starts loading again

analog breach
#

Ok if it doesn't work I will show u

#

I'm loading it up rn.

#

Ok it worked I think

#

I can read stuff

grizzled fulcrum
#

yes if all else just disable debug mode and send console.txt but if you are making mods anyway I'd suggest getting used to debug mode as it can save a lot of headache

analog breach
#

Now what do I do?

grizzled fulcrum
#

load into the game like you normally would with your mod

#

just do everything like you would

#

but if you see an error (usually noted by the debugger complaining and it will show up the debug menu)

analog breach
#

How do I get to the game lmfao

grizzled fulcrum
#

right-most button next to break on error

analog breach
#

Ohh I see