#mod_development
1 messages · Page 251 of 1
you mean just store the functions for future reference?
Yes, like fields.worldSprite = item.setWorldSprite
Not a bad idea, I noticed some movables aren't lights so I wrote it to be on the fly for now
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
I also assumed having recursive references to entire functions is probably not great 😅
Wym by recursive references?
Having a table of references to functions
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
I'll keep that in mind, going to be sending the fields list over network so I was probably being overly cautious
That changes things 😄 wouldn't be able to send the functions over
To clarify, I'd be grabbing a table of values from the item and sending that over - so I can probably still reference the classes' functions directly to make things simpler/easier to read
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
Godspeed
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
If you need to reference one of the .jar files it's slightly different—lmk and I'll see what that was
thank you i will try the command!
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 😛
the performance impact of ontick is heavily exaggerated by the community - you should avoid it when it's not necessary, but as long as your function isn't too heavy it's not going to tank the game's performance just because you used ontick
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
it's kinda like goto
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:
- don't run it
- run it less often
- 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.
@sour island Is there a way to change the display size on your mod Error magnifier ?
To make it bigger?
Larger. When I play PZ on the steam Deck it is kinda hard to see the error correctly
Uh, I don't suppose the clipboard button would do anything on there would it?
Nope that would be too easy off course
I can look into something when I have some time
Thanks 👍
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.
put it into a pack file
the game scales loose files and images from pack files differently
Thanks!
odd that they're not loaded through exactly the same function which would've yielded identical results regardless of loading method
they are loaded the same way, they're aren't actually being compressed
which also means someone had to implement an entirely separate loading routine for loose files instead of reusing the one for packs
they just end up with a different flag for how they should be scaled
loose files get bilinear scaled, pack files get nearest neighboured
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.
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
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
are you sure it's not that old
openttd is quite a bit older
and ancient egypt was quite a bit before that
yeah I love the ancient egypt videogames. They were simple but they were pure soul.
i'm just saying that 'something else is older' doesn't make 'this is old' untrue
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?
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
There's a option in the menu for this.
Under Display > textures - there's a checkbox for Compression
Also, for good measure turn up Max Texture Size
are trait icons being compressed? aren't they 16x16 😭
anything can be compressed
My dev icon was being compressed so yes
usually the game engine specifically disables compression for pixel art textures
but not in PZ
the texture rendering is kind of fucked up regardless
Whatever math they're using is misreading when it's needed
scuffs textures willy nilly
Wouldn't surprise me that everything is compressed
Turning off texture compression fixed my problem
that's only a fix for you. Put your icons in a pack file and it'll render fine.
It's weird though, even after loading as a pack file it still had compression
hmmm
it might be the settings
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()
just keep your textures to power of 2 sizes, like 256. Upscale them a little if you have to, bilinear filtering will take care of it nicely at sub-2 scale factors.
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
No?
What no?
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.
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.
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.
Correct, in that example it was 266, it was halving the texture because it was larger than the cap
so just to be clear, operations like texture.getXsize() returned 133?
so if it's 512 does it get reduced to 256?
I'd have to test
it seems like a lazy implementation but ideally we'd be sticking to powers of 2 anyway
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.
yeah, good point actually
Holaaa
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.
you posted that thread after the game's last update
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 🤷♂️
me wondering why I can't see any compression artifacts when each pixel in that picture is like 20x20 🤦♂️
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
what am I looking at
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
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
the compression issue seems to be gone though which is weird
It was taking 266 and the end result was 113
My assumption was it was not shrinking it to match the cap
266 placed into 512x512 and then halfed to 256x256
That wasn't my assumption, sorry if I made it seem that way
What would be the case here then?
what i just described is what i think it's doing
it matches your issue as i understand it
isn't it just rendering 256x256 at double scale?
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?
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
🤔
what the hell is it doing now
that's not even shrank
but it's still squaring it
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
local w = self.testTexture:getWidth()
local h = self.testTexture:getWidth()
The behavior seems to happen even for squared textures though
bruh
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
dude have you modified the test code since you posted it? Cuz both width and height grab data from texture width
Specifically interesting the UI drawTexture isn't compressed at all
but sprite renderer is
But yeah this doesn't seem to be an issue anymore 🤷♂️
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.
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 🙂
I use OnAIStateChange it's usually enough for pretty much anything. It fires pretty often and importantly it fires when sombies start actually doing something.
mhm, that's one I didn't know about. I'll look into it. Thanks!
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.
the name is misleading, the event is fired when any character changes state
so this also applies to players? What states do players even have?
a lot of actions are implemented with a state machine, pretty much any of these without 'zombie' in it should be a player state
huh, cool
of course the name had to be misleading 😄
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?
i don't
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
at least i figured out why zombies eating corpses resulted in double-counting removed bodies, so the pile count goes negative
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)```
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")
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
True, however the issue of python typings remains.
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.
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
I don't think there is a way to overide "hard" limit of 50
Maybe try with a bag that more weight reduction ?
yeah thats the answer I though about, cause I cant seem to take it off
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
there isn't unfortunately, you could hook the inventory transfer action to catch that
yeah that was my first idea. Thanks.
actually nevermind it's a super gimmick secret feature, i'm not gonna bother
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?
they don't
awe poo. I'm anxious to get my hands on a42 so I can port my code over to the new version.
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
so apparently singleplayer and multiplayer use different code too
zombie:getInventory works in singleplayer but it's nil in multiplayer
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
what's causing the skeleton zombies disappearing issue? It happens specifically in multiplayer
is any of this related to differences in client and server or no?
I have no idea about anything you're asking, but I thought I'd ask this question anyway
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
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
I think that's "Fake dead" animation zombies do
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
Build 41 has stripped a looottt of stuff for the server-side. I ended up needing to use Lua commands API to execute some stuff on a client-side instance to get around some of the issue.
The server-side was already cursed(TM). It's now even moreso.
what script controls the animation for whispering/yelling
It's Java-side, IsoGameCharacter.Callout(bool). Hardcoded to "shout", but since all of the code that calls it is in Lua it can be overridden Lua side
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!!!
how do I create a context:addOption to when I right click the ground?
if anyone here has actually... dine this before could assist me that would be greatly apreciated
figured out the basics but cant quite figure out how to,..... make it look like what im trying to do
OnFillWorldObjectContextMenu event
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
thank you!!
Anyone know how I might be able to move a car with code
I tried getting the controller but hmm
CarController that is
isodeadbody:reanimateNow() doesn't work in multiplayer and I have no idea why
Because zombies are client-side controlled beyond assignment from the server-side.
Build 41 neutered a lot of the server's functionality / ability to control things.
i'm assuming to make it closer to p2p to reduce server costs
anyway how would I proceed about it?
Absolutely a no there. It was more to do with lag bites.
You could try calling it on a random client.
what do you mean?
Server <-> Client Lua Command Event API
you mean sendServerCommand that kind of stuff?
Yeah. That's how I get around MP issues with the API.
Assume anything MP / server-related will be more complicated than it should be.
PZ was never supposed to be a multiplayer game.
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?
I guess try to load it if you can?
¯_(ツ)_/¯
I don't know the edge cases
well I can simply default to broadcasting this signal, but would that work?
Again not sure. I use that method when I'm out of options server-side.
as in not cause sync issues
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
PZ was never supposed to be a singleplayer game. That was the mistake. 😉
how do cells work in multiplayer? i'm so confused
IsoCell getCell()
the cell is the entire currently loaded area for that client
what's the equivalent for server?
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
ive been cooking a bit, figured our how to subdivide
well the thing is i keep track of bodies using getCell:getGridSquare(square_in_registry):getDeadBodys()
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
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?
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.
almost entirely yeah
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
Thanks
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?
A sandbox option doesn't directly apply to an item
A shame.
Thanks.
But you can do it yes
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
Great, that's I was looking for, you have a guide?
What's going on here exactly ?
what ai does this thing where it draws form reference?
Its for the boardgame codenames, this is photoshop datasets, you can feed excel data into it to replace images with other images, text, etc.
It's how I was able to generate 300+ cards from a handful of templates
Nice
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
why would you need to do it from the sandbox? like an active stat change? I've only seen vanilla changes on script/lua mods
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.
can we not access CarController or CarController.ClientControls?
we cannot
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.
To avoid problems and errors mostly.
sandbox does not actively inserts settings, it just holds them for something else to make use
so you'd need scripts either way. Sandbox is just a simple way of taking user input.
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.
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")
declaration: package: zombie.scripting.objects, class: Item
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.
Thanks, I'll check it.
is there a way to spawn a item on a specific coordinate once on map generation?
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
One thing you need to know is that your item will most likely not be placed if the specific coordinates are not loaded
Yeah I thought so
I'm getting close to getting usable Python typings for PZ.
@bronze yoke
Here's what it currently renders. Some issues with types and missing imports.
Other than that it's getting solid.
i heart zip bombs :3 (joke)
AFK for 7 hours.
i have a question about vehicle mod making, what is a "mod folder structure"?
I can only presume it's a structure of folders and files that you must follow to be able to get your mod working
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
honestly the wiki won't get you too far anyway 😓
it seams to give me enought info, gotta finish texturing the model first
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
someone should totally give me some mods to fuck me and my entire game over
Of course I'm going to share my mod
and of course i am immediently downloading it despite knowing nothing about it
this better fuck me and/or my game over in more then one way
or im going to be pissed
i dont have eyes

so i cant read
Perfect
👍
gl
i cant wait to brutally die
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
hello, would anyone be able to help me with how i have to do wheels?
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```
i am in absolute pain
why did i download your mod
anyone have any idea what would be wrong here?
use gemini to decode it
?
"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."
ProceduralDistributions.list[MapDistributions] did not return a value
interesting?
"CrateMaps",
"CrateMechanics",
"GasStorageMechanics",
"Hiker",
"MagazineRackMaps",
"StoreShelfMechanics"
}```
ProceduralDistributions.list["MapDistributions"]
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
you probably wanted to loop through MapDistributions and use each value in there as a key into ProceduralDistributions.list
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
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 😭
IDK anything about it but you can try dissecting any of Ki5 car mods.
going for a diferent style, also no clue how to do anything!!!!!!!
are you looking for 3d modeling tutorials or PZ scripting?
i know how to model im just... unsure of how to put it all together and... make it real
im a tad stuck
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.
yes but i dont know how any of it works.... so none of the info would be useful
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
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
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
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!
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
yeah ive asked a few things, i understand though and other then the wheel thing ive been able to eventually figure it out
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?
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
What are your thoughts about a logging truck?
logging trucks are cool!
it better be able to log logs
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
Depends on how many it can hold.
Would be a pretty cool find when you're trying to build a base.
there is a dump truck mod
with it spilling its contents all over the road when you activate the dump
when (or if) i make a larger vehicle pack i will be doing that though
just gotta figure out this one first
hi all, has anyone been able to use queue skip on their server?
its like half implemented in the game
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
dawg you do NOT live in the owl shack
yeah huh!!
these liars around here lately 🙏🏻😭😔
you cant prove i dont
how you sending messages then
i know damn well that house ain’t go no wifi
internet...
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.
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
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.
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
does anyone know the filename of the game over music in the music bank?
I swear I've seen some before, possibly in one of the food mods.
Is there anyway I can get the IsoPlayer from IsoCharacter?
hey is there way to check who created an item? or put that info when item is created and display it later?
after reviewing the documentation for mod options and with the help of chatgpt I managed to do it
IsoCharacter doesn't exist
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
Hi! So now that I managed to have the dropdown shown in modoption but the options do nothing in game:
what code is at ReducedScrapOptions.lua line # 10
-- 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
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
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
nice, I am surprised chatgpt could help lol
I understand. my coding skills are less than basic
that is why I am trying to get help from chatgpt and community and maybe learn something in the process
I fed chatgpt with all the documentation from modoptions forum page
o that would be why lol
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
also ScriptManager:getItems() doesn't exist, that's why it's erroring about nil table
oh so maybe that is a start hahah
and item:setWeight isn't a func
only item:setActualWeight
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
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
also look at way 2 of their guide
-- 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
IsoGameCharacter is an abstract base class for characters, because it's abstract you can't actually have 'just' an IsoGameCharacter at all - methods that return one just guarantee that the object they return will be a subclass of IsoGameCharacter
oh I see
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
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)
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.
you should format it like:
```lua
my code
```
it hurts the eyes to not format it lol
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
.
ScriptManager does not have getItems function, so even though chatgpt assumes it exists it actually does not
First line of updateScrapWoodWeight
isolivingcharacter isn't abstract but i'm not sure anything actually instances it
so... any idea how to do it then?
I only say it because in the Java, IsoPlayer extends IsoLivingCharacter ...
And in IsoLivingCharacter, it does checks like this instanceof IsoPlayer
literally change the function from getItems() to getAllItems()
yeah, that's usually shared code with another subclass, there's isosurvivor i think they use for some ui elements
ok... let me see
If you're going to do any Lua modding at all in the future even if it's a little more difficult than what you are doing right now, you will want to read the Lua manual https://www.lua.org/pil/1.html
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
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
Also my general copy paste advice for Lua stuff that will save your brain:
- Get Microsoft's Visual Studio Code which is an epic text editor for scripting languages like Lua: https://code.visualstudio.com/
- In VSCode, get the extensions:
- Lua LSP (https://marketplace.visualstudio.com/items?itemName=sumneko.lua)
- Umbrella (read install guide here: https://github.com/asledgehammer/Umbrella?tab=readme-ov-file#addon-manager-vscode-only)
- The rest of extensions are personal preferences like themes are.
- Read pinned messages in #mod_development
- Have fun (boom)
I should probably save this snippet so I don't have to re-type it every time lol
hahaha
well now there is no error but changing the weight does nothing
I tried doing it before loading a game
and after
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
You can find the docs to all the events in the game here: https://github.com/demiurgeQuantified/PZEventDoc/blob/develop/docs/Events.md
So just ctrl+f and search for words and stuff if you're curious
Events.OnGameStart.Add(function() was taken from the guide of modoptions
generally, OnGameBoot if you're making set changes, OnInitGlobalModData if you want sandbox options
ok then that means I am wrong, let me seeee
what does Updated Unusable Wood weight to print in the log?
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
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
oh so maybe that is why
yeah, for most purposes ongamestart would be fine, just not for this
maybe it is not possible to change items midgame
well cant use on game boot, it has to be some part between the game loading and the game start
no but you can do it in the menu or before the player loads like albion said
I'm just not the best modder to ask so I am kinda learning as I go too
so OnInitGlobalModData it is
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
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'
yeah, it's something that's been forever on my todo
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
the problem is that page is generated by a script so manual changes will get overridden
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
trueee
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
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
but it does nothing
like an interactive call tree for events would be nice instead of a list, for beautification, though it wouldn't be minimalistic
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
nothing you can't parse though
I'm going to list some changes that are unrelated but still may be useful as I discover them
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?
I am playing singleplayer
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
but maybe If I want to publish this then we can make it so it affects server and client
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
Also it's probably not working because the OnApplyInGame func for the mod option
but then you cannot change the weight later
since you can't change weight in game, this function will do essentially nothing
that's the thing, you cannot do it in game anyway as far as I know
without individually modifying the weight of a specific item directly (so like loop through container and get the item or something like this)
I meant to say that after you set the options in sandbox settings later on you won't be able to change the weight from the options menu
it does not have to be in the middle of the game
I guess, but you can change the sandbox options at any time too
but before loading the saved game
for multiplayer you can
for singleplayer that is not an option
unless you use a mod like sandbox options
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
that makes sense then
I see, so your goal is to change the item's weight, does it matter if it's in game too?
for singleplayer there is a mod called "change sandbox options"
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
Would you explore using that and Sandbox Options if it works?
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
but?
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
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
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
I only suggest it because it would be less work and less headache, and also one less dependancy
(i also think mod options has just a weird api that can be difficult to work with, especially for new modders)
I see
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
it's so simple through sandbox options like I could pretty much do it right now in a couple lines
(unless they use a mod like sandbox options)
you should test and then suggest that mod for single player like you said before
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
right, because the mod can work nonetheless with my default 0.5 weight
yes
ok if you don't mind would you please write the lines for sandbox options?
Most of it is done in a script file for sandbox-options.txt, ill find an examples in a sec
then I can test changing the value using the mod ""change sandbox options""
the lua part is done on the server side, like in media\lua\server\mymod.lua
and if that works, then I can suggest using that mod for singleplayers
wait you have more guides?? holy
wait nvm I already have it starred im stupid LOL
smooth brain syndrome right here
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?
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
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
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
yea thats what i was thinking but looking at other teleport mods they dont seem to do anythign special. so figured maybe someone here would know
is there a reason why adding a recipe to the game flat out deleted some of the categories
(i may be stupid)
does your mod have a media/scripts/recipes.txt
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
ya
you overwrote the vanilla file, it needs a unique name
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?
yeah, something like MyMod_recipes.txt ideally
ty
Do you mind I ask how you are teleporting the player?
like is it a function or something
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
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?
when are you calling this?
so do I have to change all occurrences of "MyModID" with the name of my mod right? in this case ReducedScrap
like this
oh sorry. I am reading through your notes now xD
yes
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
since you use the option name UnusableWoodWeight, you don't need to change line 14 like I commented
sandbox_options.UnusableWoodWeight, -- Change this to the actual sandbox option name
right!
no need to chage that I guess
also you might not want a min value of -9.5 because that would be negative
negative weight doesn't exist I believe
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
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
does it give you capacity instead of take?
yeah
wth
there is a mod that abuses that
void something
a way to make bag larger
you add items with negative weight
so you get "more space"
like bag addons? interesting way to go about it
yes... is janky but it works
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
but I am going to stay within positive numbers
so the option is there! let's see if it works
nice
editing the weight using the mod "change sandbox options" does not work. Let me see it works for a new game
oh, scrap wood from ReducedPlank mod
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
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
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
one moment!
shouldn't SandboxOptions["ReducedScrap"] be SandboxVars["ReducedScrap"]
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
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
huh
so that is why the mod showing in the tooltip was "ReducedPlank"
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?
also this is the actual reason why it wasn't working lol
I now, deleted ReducedPlank mod and my mod is not working at all
if you did this, revert the change back to Base.ScrapWood
let me see if changing this works
it will, it's because I typed it all in discord and not in vscode first
it works
how do I do so it shows my mod name in the tooltip?
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
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
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
Bunch of sandbox options don't update in real time, that's normal, it depends on how the mod works
indeed! now whenever I update the weight in sandbox options I have to restart the game but it works
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?
for my current save. If I change the value it does not take effect until I reload the world
yes
save
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
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?
It's when the item belongs to the mod
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
so this "Scrap wood" was not the vanilla item?
yes
I thought it was because of this
I see
no it doesn't
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
hahaaha
but the game uses this colour so yer
i wonder if item:setModID("MyModID") is related to the tooltip
i'm not really sure what else it would track them for
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
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?
I found the issue..... my script folder was not in the right directory hahaha
that is why everything we did was not working xD
now it shows my mod hahahaha
oof
it's happened to me multiple times too dw
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
maybe the mod options is going to work now?
perhaps?
going to try
yeah that's my thought
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?
no, when the square loads
now it works great!! no need to add the code to color the name
ok that sucks more but not that bad
nice
was making my own time based action to call it. i removed that part and just jumped straight to calling it and it works fine now. not sure why
yeah you can't teleport during timed actions
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
Have anyone encountered this problem? For me everything works fine so I've no clue whatsoever.
does anyone know how to make windshields for vehicles?
working on getting all my textures done :3
wow, awesome.
sendClientCommand has a working singleplayer version but sendServerCommand silently fails unless it runs on a dedicated server
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.
You can just restart the save, not the game
yes that
I wrote that in the mod description
https://steamcommunity.com/sharedfiles/filedetails/?id=3295582181
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
if ANYONE could help me with them i would REALLY appreciate it, im just not sure how
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 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...
thank you so much!!!!! this is helping alot dont feel like im stuck anymore!!!!!!!!!!!!!!!!!!!!!!!!
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....
Functionally it should not be an issue, the thing is that you might lose alot of potentiall details if you do your unwrapping wrong.
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
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
yup getting all of it figured out now, thanks!
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?
okay.. it seams one of my my files need to be a .info file but i cant save my text file as that
not 100%sure that even the issue tbh
is there way to prevent fire from creating? rather than using Events.OnNewFire and removing it?
you should be able to do this. Make sure you checked the "filename extension" thingy in windows explorer (under the tab where you can change the size of the symbols in the folder. Would love to tell you the proper english words, but my windows is german)
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
Well, it is just windows. Are you on Mac or Linux? If on Windows, make sure you checked the red circled button, then rightclick on your txt (rename) and just replace txt with info
yeah i use windows 11
you are welcome
i dont have anything that can open a .info file
I dont know about 11, but on windows 10 you just use the editor
?
The app is called "Editor"
try type in "Editor" in your windows search bar
try with notepad
i dont have anything just called "editor" unfortinatly
notepad only supports.txt
you sure you use notepad, not wordpad?
i use notepad++
oO my notepad++ can edit the .info just fine
Huh... mine cant
rightclick on the .info file, edit with notepad++?
nope
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)
naaaah, that cant be true. I use this all the time. If you use "save as", it only shows you .txt. But you can just hit "save" after you opened any text based file in it
i cant open .info files though :(
as in you actually tried to open the .info with notepad (rightclick - open with) and the program told you "cant open"?
no that just isnt even like, an option
the open with option should show you like all programs
it only lets me open with word
isnt there a "choose other app" option in windows 11 displayed as well?
not on the .info file i have access to
and rightclick - properties? This should display the standard app to open the file with and allow you to change it
wait, this is all you can see when you rightclick on the file? F this, ima protect my windows 10 with my life now
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.
best as in #mapping , there are the pros for this 🙂
Thank you! will do.
maybe try this: https://www.youtube.com/watch?v=TIPnt3I_bk0
Try PC HelpSoft Driver Updater here: https://store.pchelpsoft.com/clickgate?uid=1020685&crid=12414&wid=1593&dest=https://www.pchelpsoft.com/driver-updater/en/LP19.php&tracking=DU_EN_AFF_WINREP&campaignid=AFF&mkey5=PUB&hm=1&key1=2fWL1sc78IM&key=YT
| ⚙️Try Fortect to fix and optimize your PC like a Pro: https://out.reflectormedia.com/c?o=20566548...
i will tommorrow, event in the pz server i play on is starting now thanks for the help!
have fun!
hf!
thanks!!!!!!!!
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)
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
is there a place i can spout mod ideas?
didnt work :(
i've got a modding discord with a mod ideas forum, just take a look at my bio
sobbing, why do .info files even exist i cannot open them why why why why why why why why why why why
try right clicking and selecting "open with" and then notepad
or vs code
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
i cant make .txt files into info files thouhg
why not
are you not able to rename the file
i can rename files
do they have the file extensions
then do this
how
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
im also on windows 11
okay i turned that off
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
🙏
HOPEFULLY it works now
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
i will do that tbh!!!
yeah but this is my personal one
FUCK YES
that one has 1,5k people in it
IT WORKED DAWG
i use it as a community server for my mods + community, but also as a smaller dev community

how the hell it only show open and copy???
is it zipped or something
nice
oh dont use word for that
use notepad++ or vs code
you need a text editor
not a rich text editor
joplin better
vs code is good too
real
Update: mod loads and everything, was unable to locate my vehicle but at least it loads!!!!!
W
sort of
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
can you share the recipe script file if possible
Yeah
Give me one second
Want it in dm?
@grizzled fulcrum
it removed every crafting feature except for 32 in total
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
im like 100 percent new to this lol
but it should be fine to use module base regardless of arguing what someone "should" do
this is my first legit mod
do you use debug mode (or know what it is)?
if not, use -debug launch parameter for the game
no i dont, last time and only time i did it just didnt work
everything went crazy
but ill try
you mean like text not loading and stuff?
if so, that usually means an error happened before the game could run the code that gets the font stuff
Ok
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
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
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
Now what do I do?
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)
.
right-most button next to break on error
Ohh I see
