#mod_development
1 messages ยท Page 116 of 1
and between similiar endpoints the syntax changes drasticly... so if its for this endpoint X its a b c d for Y its c a d b
when it uses the same values but in diferent order... that just annoys the hell out of me
Yeah.. Bloat isn't a good thing.
It's why I think for example that PZ shouldn't be made using a commercial engine like Unity or UE4.
Making your own engine is fine in my book.
yeah if you have the skills for it
why settle for making something the way someone else wants you to if you can make the way you want?
plus now that i know i've been promoted and only working 4 days a week
i know ill have the time to dedicate to this and several other projects
so i rather do it the way i think is best
I don't like to sit and wait for things. =)
The good attitude to have.
doesnt mean its the right way... but its my way at least ๐
I call it "The C Programmer Attitude".
"F it. I'm making my own lib. Screw yours!"
why vb... since im gonna make it public on github... vbnet is easier to "rookies" to understand
I'm afraid to express my thoughts on VB. It's very slanted and biased on my experience in C Syntax.
So you'll know everything about my perspective.
vbnet is good for "quick" projects
When the project grows though.. That's my concern.
which is not the case for this one
VB scales way better than Lua.
I also like that I can mix CS with VB.NET so I can avoid it.
xD
you can mix pretty much anything with vbnet
i still use libs i made in C++
just add a reference to it
Hahah to me that's the only good thing about VB.
and use it at will
I saw a codeproject post on how to run C# from the JVM in order to use JNI libraries.
my way of thinking about vbnet and C# is the same as my app and the pz mod i made
the heavy lifting is done by the more powerfull language
the rest can be done in lua or whatever
so the gui is in vbnet the libs are in c#
My thinking on flow for designing frameworks has become so abstract.. I've realized lately that I may have stared into the void of design.
Haha
But yeah this is all fun.
coding its only but a hobbie as of late... since my profession lies somewhere else
apart from some freelancing jobs i do, i only code for fun
@tame mulch Is there a point in time when I can get information on the updated schema for ZedScript? I can write a parser for this version as well.
It would also help modders if docs could get a head-start on it.
I also need to see which script properties belong to which categories. I can write a strict-mode to detect problems in existing scripts.
For 41 build info about scripts on pzwiki. For 42 I will do scripts guide when 42 will be released (or in public beta)
Ah. So I'll need to wait until beta.
Thanks.
it works
so now to make the damn gui
and this is where i get bored... gonna stop for a bit... i hate making gui's...
Has anyone made a playlist mod for True Music?
.."A flexible per chunk 32 height that can be different in each chunk, allowing parts of the map to be at 32 level height, where others in theory go from -31 to ground floor."..
I'm really hoping that the chunk setup uses powers of two so all coordinate conversions can be in bitwise operations.
The game will be so much faster if so.
Was thinking of modding the game to experiment with this as a benchmark but I might wait to see what 42 is cooking.
Cheers for the render team. Hopefully we can make maps of New York and Chicago with the optimizations for 42.
The thursdoid is a long description of caching chunk renders. It's good to see this finally come about. I'd like this for the UI though.
=)
The blog is really really chock full of goodies
It explains rendering to the normies. Too bad they didn't go into detail on their SpriteRenderer's TextureDraw issues.
(Nerds out)
I wasn't aware they were working on anything render related so it was a nice surprise
Makes super basements and larger buildings more possible too
Oh. I was given a warning that rendering will change for 42 when I started modding their render engine.
My question is why make z chunk ranges dynamic?
It'd make things faster to do +16 <-> -16
I guess I don't mess with complicated enough stuff to warrant a warning ๐
You're not missing much. Headaches.
I mean I can use shading to turn your vehicles into driving rainbows.
It was 10*10*7 prior - if I'm not making up stuff
I've stated in the past that using powers of two would speed up the map engine drastically.
It is decimal yes.
Can somebody tell me where i am allowed to announce that i am ready to commission someone to take my car and make the code for it work (one month of troubleshooting wasn't enough)
You'll have to shop around for people who take comissions
There isn't really a portal or page for that
i'll see what i can find.. but thanks
To convert from world to chunk coordinates in powers of two I could simply do:
// Chunks being 16x16
var worldX = 17;
var chunkX = worldX >> 4; // 1
Bitwise = superior.
:D
is there an event for when a zombie spawn? I need to give the zombie an item to wear
Events.OnZombieUpdate ?
Yep
Is there no function on the lua side of PZ that is called when a zombie spawn, and gets it's outfit?
I mean you could also just define an outfit for your zombie like TIS does for their say police zombies
Is that example? Because I thought they were 10x10?
Now I wonder
Do you know where it is defined?
No no. I'm showing an example IF the chunks were powers of two.
Ahh
Ahhh unfortunately no though if i had to guess id say in NPCs
UI was fun until I started looking into how to color the slider dynamically as it moves left and right lol
Three hours gone and got nowhere so far lol
Is it possible to make have a map act as a container?
Still being able to read the map
So this is finally going in?
On build 42
If I understand that right I will finally be able toake all my dakimakura just one item with different texture options
Copy paste hell will be over
A LOT of modders have waited a long time for this feature.
Also decrotive placement options 
Was discussing this exact thing yesterday.
Very exciting
Seems like they also tend to use finally tags more often
Does anyone have any suggestion for how to ensure that my function added to Events.OnZombieUpdate only runs once per zombie and not multiple times?
Table with isoZombie:getID()
The event will fire but you can wrap your execution of code with a check from a table.
Sounds like a smart idea, thank you
does the ID of the zombie change between loads? ๐ค
What if I want to ensure that I'm running it twice between sessions?
I assume the zombie:getModData() would also be a good option, no?
I think ID does but there's two IIRC.
I forget what gets serialized.
Maybe I'm thinking MP not SP.
uhhhhhhhh
Try it and get back to me if it doesn't work.
I noticed that CDDA zombie uses both id and online id
function CDDA_GetZombieID(zombie)
if zombie and zombie:isZombie() then
local id
if isClient() or isServer() then
id = zombie:getOnlineID()
else
id = zombie:getID()
end
return id
else
return 0
end
end
Yeah IIRC that would be the right way to go about this.
Alright, thank you
Lunch time.
Hmm.. I'm worried. Will ZedScript have version flags when the format changes?
I'd otherwise need to version control using PZ build ranges. 
Has anyone tested or done tweakitem with variables?
like TweakItem("Base.CanoePadel","MinDamage","LongBluntDmgMult*0.5");
I'm fairly sure that wont work
but try it, who knows 
Are you using ItemTweaker?
(I haven't used it before, all I know is :DoParam() has more or less superseded it)
No shame as long as it works, just one less dependency otherwise

haven't used doparam, using item tweaker atm for adjusting values on weapons for convenience xD
Fair enuff!
ItemTweaker is using doParam - it's just a wrapper
Oh?
Huh, more you know.
I haven't touched it before, I've just heard people tend to just go the DoParam route, not entirely sure why.
Could be because of the dependency thing so the mod is more standalone, but otherwise I don't 100% get it.
doparam is better mainly for two reasons: one, why use a dependency for something so simple, especially when dependencies have been such a nightmare historically; and two, item tweaker has a bunch of prints that massively slow down game load
item tweaker is particularly one of those nightmare dependencies, it's not worth dealing with that crap when all it does is change some syntax and make load times worse
Unrelated but I think it can also cause issues as it's client sided
If the game needs to match script values and changes only occur on players' ends as server doesn't execute client code
You'll end up with some really hard to pin down bugs
whats the furthest radius that i can check sprites on a tile
i need to check if the water pump is within a certain distance then return true if it is...
Sup. Can i get some help here? I need to equip an container item and then put some items inside using timed actions. I figured out how to equip the container, but I don't understand how to put items in it. I found some useful methods like ISInventoryPane:canPutIn() ISInventoryPane:transferItemsByWeight(...) ISInventoryPage:setNewContainer(...) --?, but how can I get the exact container I equipped to transfer items inside?
Here what i got.
-- ISInventoryPane:onMouseUp(x, y)
-- ...
local item = self.items[self.mouseOverOption] -- get container item from player's inventory
if item ~= nil and item.cat == "Container" then
local items = ISInventoryPane.getActualItems({item})
local action = ISEquipWeaponAction:new(player, items[1], 50, false, false) -- then put it in the right hand
local queue = ISTimedActionQueue.add(action)
-- ??? idk what to do here
return
end
if distance < radius then ... end this sounds simple
Try use ISInventoryTransferAction
im starting to think i should never thought about having a gui in the damn ap ๐
man i hate working with gui...
Darn that sucks.
to much to think about...
I'm on the other end of that opinion. I can't wait to write a UI for my script manager app.
the size... what if he moves it this way, what if he wants to have the console on the right side or using the full form width
to many unknown vars to think about
nothing beats the beauty and simplicity of a console app
I have all these visions in my head of the ideal ZedScript editor.
just shows what you need to know...
i havent any visions for the gui apart from the console showing the activity
๐
Heh. I have an advantage though.. This is also my work.
I am working on just that: UI redesign of an ASP.NET solution.
but ill go the dictators way... unresizable gui!
one less thing to worry about ๐
responsive UI. We really are different.
i could make it responsive and customizable
but...
dang it... now you make me feel dirty and lazy
=)
i guess ill go the modular way...
It's whatever you want it to be.
and allow to snap the "widgets" of the gui the way the user wants them to be
All code is unfinished brush-strokes on a painting.
ill just make a default theme the way i want it to be for myself and allow the user to move stuff around hide and show stuff resize it and save it as a theme
winforms for the lazy ones like me are the best way to go
UI design keeps me grounded and reminds me that code is human expression too. =)
i am in emense pain
If you read code from someone long enough, you can see who they are as a person. ;3
yeah but... i dont think its worth writing a gui from scratch for something like this... ill just use the crappy winforms
they have stencils but too strict
i want to do the oposite operation they allow
i want to clear whats inside the stencil
not keep only whats inside
Tell me what you want. Crowbar is a mod specifically targeting limitations to the UI engine.
make that work on the workshop without users having to do anything manual
or better yet... the extreme of lazyness... 1 form and diferent user control objects...
Oh you want to inverse mask
Draw 8 times with stencils spanning the width of the screen to the target box.
You can do this without modding the core.
N E S W NW NE SE SW boxes.
well once again im bored working on the UI... another break ๐
so
We added some new events for mods to use, including: โ OnZombieCreate and โ LoadChunk
will be 8 x 8 when b42 launches
that's big, we also need to know when chunk is first loaded, maybe a boolean parameter passed with event
they do
SpriteRenderer.instance.renderi((Texture)null, (int)var1, (int)var3, (int)var5, (int)var7, 1.0F, 0.0F, 0.0F, 1.0F, (Consumer)null);
when setting a stencil
i simply have to invert the matrix
@drifting stump what are you trying to make?
optimize ui rendering
brave man....
hehe
in particular this pains me
(One of my goals long-term is to get Browser8 on-board with using Crowbar)
from tests simply doing 1 draw and a stencil op yields 2x speed improvement
im just glad i managed to finish my stats ui and the animation mod ui
not touching pz ui ever again
unless i really have to... annoying as hell
Na i mean like syntax
Vishnyas telling me to use ongrid load but the client who commissioned the mod doesnt want me to use it as it lags their server. So im looking for another alternative. I have a code similar but its too laggy i can mt even properly use it to print if it has a huge radius
so you want this to happen when a specific sprite (water pump) is loaded, but it also must be in radius of something?
To plumb a sink
automagicaly or player interaction? only on load or every ten minutes?
adding finding 2nd object makes it more performance consuming unless it's small area or you save it somehow e.g (ModData: linked sink x,y,z)
you need something similar to water pipes and global objects
damn java calls are expensive
ok i have. no clue if this question goes in this channel or not but uh
i saw that zomboid runs on java and lua, it's a stupid question but do i have to learn java and lua or can i just. do c#
10ms from removing 2 calls(x2000 per frame)
lua at the very least
local waterPumpSprites = {"sprite_01_0","sprite_01_1"}
local function myFunc(isoObject)
--...
end
for _,pump in ipairs(waterPumpSprites) do
MapObjects.OnLoadWithSprite(pump,myFunc,5)
end
@ancient grail
Lua is your main concern.
my idea of inverting the draw isnt working and i have no clue why
There is an alternative to Lua if you're interested in coding TypeScript. Lua is the canonical modding language for PZ.
You'll need to know the API you're working with.
IndieGL.glStencilFunc(519, StencilLevel, 255);
IndieGL.glStencilOp(7680, 7680, 7681);
IndieGL.glColorMask(false, false, false, false);
SpriteRenderer.instance.renderi((Texture)null, (int)var1, (int)var3, (int)var5, (int)var7, 1.0F, 0.0F, 0.0F, 1.0F, (Consumer)null);
IndieGL.glColorMask(true, true, true, true);
IndieGL.glStencilOp(7680, 7680, 7680);
IndieGL.glStencilFunc(514, StencilLevel, 255);
here what they do when setting a stencil
i cant access IndieGL
i can however do things with the SpriteRenderer just fine
alrighty, thank you ๐
(time to suffer to learn how to create my mods)
No problem.
Are these all script object types?
{
categories: [
'animation', 'animationsMesh',
'evolvedrecipe', 'fixing',
'item', 'mannequin',
'model', 'multistagebuild',
'recipe', 'sound',
'soundTimeline', 'template',
'uniquerecipe', 'vehicle',
'vehicleEngineRPM'
]
}
Built this string array from all categories for objects defined in modules in all PZ script files.
MapObjects.OnLoadWithSprite??
Wow thats new
Thank you
Going to take a look at zombie.scripting.objects
Man, there is no better feeling than looking at the B42 news and seeing that changes are coming that will make your life 5x easier... ๐ฅน
We added some new events for mods to use, including: โ OnZombieCreate
We have also moved around the order of operations when sandbox options are loaded and the loot tables are parsed, to make it easier for mods that use sandbox options to set loot spawn values.
Which is the syntax to require a file inside the shared folder, from the client folder?
Anyone have any clue what to tell this guy?
Reorder Containers is entirely client side, and I can setup a server no problem with it
It works, thank you!
Nothing. Absolutely nothing.
Yea... I feel bad, but whatever the problem is seems to be out of my jurisdiction
This is why I prefer you guys being my players.
lol
Less confused patrick.
I'm trying to make a voice mod which adds custom voice lines to lots of actions in the game. I'm doing this by creating new wav files which combine the vanilla sounds with my custom voice lines, and then pointing to those new sound files in a scripts .txt file. I have 90% of it done and working well in-game, but one strange issue I've run into is that some voice files can only be heard in one headphone/speaker. An example of this is the sound of opening a hood. The vanilla sound in-game sounds normal (i.e. the sound is centered), but as soon as I replace it with my custom sound file, the sound is fully panned into the right-side headphone in-game. The wav format is the same as the vanilla sound file (mono, 48000Hz, 32-bit float), and it sounds fine outside of the game. Does anyone know why this might be happening?
That's freaking awesome. Glad to hear someone is doing something like this.
It's definitely a issue with the codec you use and how the game reads it.
Does Zomboid prefer .wav?
I need to do some sound work soon.
You can also use Ogg Vorbis. Have you tried this @spring hare ?
Ah, .ogg sounds more inline with my expectations
Ogg is the "We don't want to mess with crazy mp3 licensing" option.. AKA everyone..
Save the file with the same name and .ogg instead of .wav and it should work.
(obviously exporting as Ogg Vorbis format heh)
usually just ignore, since you need a ton of messages to get to the issue
I probably had something similar and they posted logs, issue is "mod pending download" and "files not found"
I've tried both .ogg and .wav but it's the same problem either way. I'm using Audacity to edit/save the sound files. But like I said, the weird thing is that this issue only seems to happen on certain actions. If I edit the sound of eating food, there's no problem, it sounds fine in-game. But if I edit the sound of opening a car hood, it's hard-panned to the right.
I wonder if it's the 3D sound stuff with you sitting exactly at the point in 3D space.
Try offsetting the FmodSoundEmitter
You can sometimes get audio artifacts when using spatial algorithms with sound emitters in the exact same point in space.
Just a thought.
And that's why I ignore haha.
That's what I was thinking. But I don't really understand how to use those settings. In my text file I just write (for example):
sound VehicleHoodOpen
category = Vehicle
clip
{
file = media/sound/Vehicle_HoodOpen_Standard_01.wav,
}
How would I incorporate FmodSoundEmitter settings in that?
Did not knew the slowdown
will have to shift to it then, is there any guide or mod i can use as ref for it?
is that the exact lines? You're missing commas , for start
Thanks for the link, I'll give it a read and see if I can figure it out
TweakItem("Module.Item", "Parameter", "Value")
```becomes```lua
local item = ScriptManager.instance:getItem("Module.Item")
if item then
item:DoParam("Parameter = Value")
end
can be instantiated multiple times for multiple parameters, no?
Not the exact lines. The custom sound is playing in game so I don't think it's an issue with syntax or formatting or anything. The problem is only that some sounds get hard-panned when in-game.
and ty!
You need commas IIRC.
(I'm literally writing parser code for these files lol)
nice guide for blocks, didn't remember that one existed. So many useful stuff there.
When you miss a comma, the values - properties get mixed
yeah, if you want multiple just do```lua
local item = ScriptManager.instance:getItem("Module.Item")
if item then
item:DoParam("Parameter = Value")
item:DoParam("AnotherParameter = Value")
end
My parser needs the commas because property names & values supports whitespace.
ty again, will take a look
The exact format I'm using is:
sound VehicleHoodOpen
{
category = Vehicle,
clip
{
file = media/sound/Vehicle_HoodOpen_Standard_01.wav,
}
def may shift as i want to make the thing as streamlined as possible
sound VehicleHoodOpen
{
category = Vehicle,
clip
{
file = media/sound/Vehicle_HoodOpen_Standard_01.wav,
},
}
Wait..
Oh yeah that's right nvm
Yup, that's it (minus the last comma after the second to last bracket). Sorry, I'm new to discord and don't know how to put code in quotes like that
Do you have to specify the format on the file?
Backticks
Yeah you apparently do..
I'm used to internal API stuffs.
(Ignore my rambling)
Cool, thanks. Not sure about needing to specify the format. I used another sound mod as a foundation for mine and followed the same format etc. That mod didn't specify the format but it seemed to work fine
I'm used to using GameSound.getOrCreateSound() which attempts to find the file with all supported extensions.
Yup. Pointing to that resolver code.
BTW I have a soundtrack for a shelved mod I'm working on.
So it's cool to see people being creative with sounds in their mod.
Sorry, what do you mean by "pointing to that resolver code"? I don't understand
Ignore me. Hahah. I mean code that loads your sounds inside the game's core code.
Ah ok, thanks
Anyone know of a way to disable and enable the map from Lua?
I planned to modify everything about the game's atmosphere.
Listen to Project Silence Tracks by JabDoesThings #np on #SoundCloud
seems like a hard but amazing job there!
Sounds really good, I'd definitely try that out if you decide to finish it and release it
=) I plan to release it someday. It'll have an recommended age restriction because I plan to make it as psychological as possible.
I want a very dark and mind-bending flavor of PZ.
How dark and mind-bending? That soundtrack pretty much covers that.
I think It sounds fitting
i'm gonna take your mod and make it disney LOL.
very fitting
function ISWorldMap.ToggleWorldMap(playerNum) like this?
Going HARD with the content mods. Safer to keep me distracted with writing tools.
I will look into that; thanks!
I have an idea of a mod where the player can go running and bust through doors if they are closed (assuming they are not locked) , also pushing any zombies behind the door. I new to modding in PZ so i would appreciate any help
I took an unused wav file of crazy-talk from PZ and made this to periodically play in segments in walkie talkies and another one on TVs. https://soundcloud.com/jabdoesthings/phantom-in-the-handheld
Listen to [Project Silence] Phantom In The Handheld by JabDoesThings #np on #SoundCloud
Thought I'd share that head-trip.
That link you posted unfortunately didn't seem to say anything about FmodSoundEmitter or offsets or how to use them. Only stuff like distanceMax and SoundRadius. I don't mind doing some trial and error to see what amount would have the desired effect, but do you know what text/syntax I would use to incorporate that setting into my script file?
Oh. It's general scripting tutorials.
What I discussed involves coding in Lua.
looks like that only opens and closes the map; I'm looking to enable and disable it entirely as an option; for example, start of game disable being able to use it. Later craft a "world map" item, that enables use of the map again.
Ah, I see. Yeah, Lua coding would be way over my head unfortunately. I can make nice sounding sound files and point the game to them, but I don't know how to code
Anyway, thanks for your help Jab. I guess I'll just avoid the "problem" sounds/actions for now
No problem. Hope you find your solution.
Depends on the modder. I comm myself but am utterly full of both comms and projects.
I have a market on my server however people have become inactive there over the past half-year unfortunately. =(
Would also be helpful to attract someone interested, if you stated what you were looking for
It won't be inactive for long.
Sounds good, I'll take a look when ya do.
Yeah. I can't guarentee you people responding to your post if you make one. You're more than welcome to try.
any idea why deleting a vehicle via permanentlyRemove() might trigger this nonsense?
i've never had this happen before

it spams it so fast that the log grows by KBs per second
Oh thats bad
it resolves upon server restart but it's gonna make huge log files and slow the server down
cuz we'll be deleting a lot of vehicles
as-encountered
automatically
any idea why that might happen jab?
And that's just using the built-in vehicle deletion Eve?
vehicle:permanentlyRemove
@weak sierra Probably a removal queue that is blocked.
nothing special other than the conditions
it's removed fine tho
as far as i can tell
And logs that should be deleted but never will be.
and it keeps spammin it after client d/cs even
It may be removed from the world but not something it's assigned to be removed from.
I bet it's some list.
Haha
No Lists, Only Tables
/s
ah so you really meant that. you can see in that file the isAllowed function. You can change that or the things it checks.
I wrote an AST parser. Now I get to apply it to my own Json API.
Hoping that B42 will have a major Logger cleanup.
PZ Seriously needs it.
Okay fair, that may prove useful if I can alter checks, and have it actually check if the "world map" item exists in inventory, and then open the map or not, depending on that. Thanks!
Vehicle still call function update() after removing. This log writes in update func
@weak sierra Honestly it's probably a vehicle not being properly disposed. =(
@weak sierra You do this on serverside?
oooo possible desync.
Surprised if stale cars aren't removed if the server says it doesn't exist.
yes server-side
this is done the same way on other mods and it doesn't trigger this afaik
This happen every time?
it happened every time i tested it until this restart, and now it's removed two without triggering it
so maybe not every time but often
will be using this tomorrow upon removing vehicle mod packs on my server to delete mismatched vehicles
to clean up the oddities that causes
You remove vehicles that in loaded chunks?
it's only when they are encountered by the player and init
so it should always be loaded
Strange. Looks like it not removed from chunk because chunk is null. But maybe reason in something else
Maybe try remove a little later?
the weird thing is it's succeeding, though, the vehicle disappears
one of the first things i thought about when i started modding was making a program to generate items
good to see someone is doing it
I'm currently taking my AST parser and compiling this data as object notation.
i can call gl operationss directly
this is actually huge
you might be able to make your shaders work with lua XDD
Nope.
I can't pass uniform values this way.
Been through that code. I had to write my own solution
Unless someone like @tame mulch is willing to pass on my solution as it works async, then yeah no support in vanilla.
I wrote an API for Crowbar called ShaderProfile that wraps a shader program and allows you to set uniforms.
Works in Lua.
Hey everyone, I'm trying to dig a bit in how factions works in the game and was checking this out: https://zomboid-javadoc.com/41.78/zombie/characters/Faction.html#<init>()
I'd like to have an example of how to invoke the function of this class. For example is it safe to assume that the Faction class is a global object available on the client side at all times once a game session start?
Would I simply go for Faction.isAlreadyInFaction() to determine if the player is currently in a faction or not?
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, class: Faction
thoroughly tested over the past year. =)
declaration: package: zombie.characters, class: Faction
You'll see any documentation there.
Thanks Jab, it's the same link I wrote but I seems to fail to understand how to translate that automatically generated documentation in how that would translate in actual use for it. I'm not really used to lua/java coming from different languages although I've a background in programming ๐
it's not the same link, jab's is the official documentation that has more detail than the community one you posted
I can give you my generated docs for TypeScript.
for the static methods yes, for the instance methods you need to get a faction object using some of the static methods
So I could write something like Faction.getPlayerFaction(getPlayer()) for example to get the current player faction on the client side, correct?
yep!
great, thanks for confirming ๐
jab got any clue where i can find the opcodes
docs i find all use stuff like GL_NOTEQUAL
I'll do some testing in the weekend but I just wanted to see if I got it right in the first place before ending in a dead end immediately by misunderstanding the class ๐
got it
Here's my generated typings documentation.
What are you doing again?
Search up those constant numbers in the GL static interface classes.
the only stencil op exposed through ui elements was keeping only whats inside the stencil
i want the oposite
found it already
vanilla is using GL_ALWAYS
ill slap a never and we good
Remind me to add this to Crowbar at some point.
though all this might be for nothing
ive come to realize the real performance issue is doing java calls from lua
aka drawing 4 times isnt the problem its the 4 java calls
Yup. This is why TIS uses a cached instruction library. You know it well.
It's called SpriteRenderer.
My gripe about it in terms of performance is that every call object is recycled for any draw call, filling in for memory that will likely not be accessed.. as opposed to draw-specific objects that are recycled for those calls only.
I have a hunch that's changing in 42.
Seeing powers of two for tiles in cached chunk renders makes me very excited.
best way is to just ask in this channel if anyone can implement your idea :)
cant get it to do anything
mod-ideas
@red tiger got any idea why this isnt working?
self:setStencilRect(x, y, w, h)
local renderer = SpriteRenderer.instance
renderer:renderi(nil, x + self.x, y + self.y, w, h, r, g, b, a, nil)
renderer:glAlphaFunc(512.0, 0.0)
renderer:glStencilFunc(512.0, 255.0, 255.0)
renderer:glStencilOp(0.0, 0.0, 0.0)
renderer:glClear(1280)
renderer:glDisable(2960)
renderer:glDisable(3008)
self:clearStencilRect()
its still keeping the drawn rectangle
could probably rename spriteRendererInstance to renderer to save some typing heh.
meh autocomplete solves that
Uhh hmm
I never tried doing this explicitly.
Sanity-check those numbers on renderi
That'd be my first check.
Reference those LWJGL static constants too.
the numbers?
I know you're doing GL_DEPTH_TEST and what not there.
Yeah check x and self.x
y, w, h, rgba
Make sure they are exactly what you expect.
i know the rect is placed correctly
Then check the LWJGL op numbers.
if i call the methods in uielement it works
Hmmmm
I have to go. =( But I really want to see this hack work.
Make sure that UIElement and UIManager aren't calling anything that might be messing with your instructions too.
thats why i do the disables to make sure it cant run the stuff after
just to make sure, do semi-colons change the kahlua code in any way or are they ignored
syntactic sugar
hmm ok
Unless they are inside of a single line, in which case sometimes they will be necessary* @glass basalt
At the end of a line, sugar.
i did it
@red tiger aaaaaaaaaaaaaaaaa
now to fix that render time
i understood what needs to change
\o/
in comparison the vanilla function takes 50 to render
glorious
2.5x faster
@sour island behold
120FPS UI :0
i made it 2.5x faster
How?
i unlocked the secrets they dont want us to know
i found i could directly do opengl calls
function TestUI:drawRectBorderStaticV2(x, y, w, h, a, r, g, b)
self:setStencilRect(x+1, y+1, w-2, h-2)
local renderer = SpriteRenderer.instance
renderer:glStencilFunc(517, 1, 255)
renderer:renderi(nil, x + self.x, y + self.y, w, h, r, g, b, a, nil)
self:clearStencilRect()
end
also reducing the number of java calls is imperative for better performance
are there any vegtables without recepies
so you get a tangible benchmark
drawing 200 borders each frame with uncapped fps and ui
vanilla function i do 172fps
my version i get 345fps
and 200 borders isnt that unrealistic considering how many are used throughout the uis
quite impressive tbh
Wait.. what
which part is wait what XD
You get it working?
aye aye read above
lol yeah of course a guide about opengl calls
Yeah. It's going to be helpful for people
so many XD
I worked with lwjgl for personal work
whole magic is here
On the road
this line did the trick for removing
renderer:glStencilFunc(517, 1, 255)
I should join a vc lol
rest is just doing the least amount of java calls i can get away with
need to test the vanilla function with removed java calls
Want me to call you? I'm driving
You're doing my kind of crazy code solutions now haha
is this file in the right place
going to sleep soon so not this time
its in my scripts folder but idk if its the right place
should be
No problem
interesting removing a bunch of java calls got it from 50 to 26
thanks man
ooooo removing even more got it down to 18
If I want to include double quotes within a string of a translation file, is it still \" ?
Yes it is, simple web searches do be working doh
vanilla keeps calling self:getXScroll() and self:getYScroll() over and over each time doing a java call
if i cache that in a var i get it to 20
then if i instead save the xscroll and yscroll values in the table when doing a set i dont even need to call the gets in the first place getting it down to 18
tldr forget the scrolling implementation in java and just do it in lua, always the save to avoid calling java
new version gets me to 404 fps
don't break the sound barrier with that kind of power
my distributions are differant to the tutorial im on
the tutorial might be outdated, if you're doing Distributions and not ProceduralDistribution(s)
hm?
could you please explain
there are two different ways the game distributes items
since im working on a ui i decided to test it lol
hey man
the default way, where everything is assigned in one big table of tables, is Distributions. To modify this table you have to copy the entire thing to include your new values (not mod-friendly)
i'm not even horribly versed in it but with drawing a larger border and two smaller borders to create fake buttons it's alright haha
the newer way, where methods add onto another table by "injecting" new values, not overwriting anything, is ProceduralDistributions
they do the same thing but the way they are implemented are different. you want ProceduralDistributions, without a doubt
my tiny little smooth brain is blown
you need a function that does it. luckily everyone does it the exact same way, so you can just copy it. ill post it here, one sec
thanks man
local containerData = ProceduralDistributions.list[containerName]
if not containerData then
print("Container does not exist. Are you sure you typed it in correctly?")
return
end
table.insert(containerData.items, itemName);
table.insert(containerData.items, itemChance);
end
AddLootToType("item name", "container type", numberOfItems)```
that last line on the bottom is what you need to change.
where do i put this
This goes into a LUA file in media/lua/server
anything you want, as long as there are no illegal characters but thats easy lol
btw you made pocket tvs?
people usually follow a convention adding "_Distributions" at the end
yep lol. Im Panopticon on Steam
thank you, its my second time hahah
how do i know what the containers are called btw
there is a list of them in the game files. ill find it
oh thanks man
these files are usually in the same place as where you want your custom code to be (the procedural containers being in lua/server/Items)
im in there
It's called 'ProceduralDistributions.lua', in Steam\steamapps\common\ProjectZomboid\media\lua\server\Items
so like, Antiques, the first one, is the name of a container
have fun with it
if you want an exact amount of items to spawn in an exact place, theres a different way
i believe so
thanks man
put it in as a string with quotes
so ''FreezerIceCream''
yep
thanks man
keep in mind i'm still super new with UI but was able to use that function to draw all 3 of those lol
you can also duplicate that last line into more lines, in case you didn't know. I'm not sure how much experience you have with programming lol
is that the lightswitch mod?
nada
yes
no experiance
deos it work with mp
yes
alr thanks
none of this is in it
wait, did you essentially make a UI window from scratch?
i will be releasing an addon mod with that as the requirement
yes i did
those arent buttons
wowza
they are drawn rectangles
im just using their location reference for the location of the label inside
there is that UI library in the mod resources, but idk how many people really use it
this is my render function atm
nice and simple, cool stuff
function ISLightPowerControl:render()
ISPanel.render(self)
-- Set up the background color and border color of the panel
self.backgroundColor = {r=0, g=0, b=0, a=0.5}
self.borderColor = {r=1, g=1, b=1, a=0.5}
-- Call the function to draw the border
self:drawRectBorderStaticV2(0, 0, self.width, self.height, 0.8, 255, 249, 0)
-- Calculate new dimensions for the child elements
local newWidth = self.width - 40
local newHeight = self.height - 85
local newSliderWidth = newWidth - 20
-- Create a label for the slider
self.sliderLabel = ISLabel:new(self.width / 2, 10, 20, "Light Strength", 252, 244, 0, 1, UIFont.NewMedium, true)
self.sliderLabel.center = true
self:addChild(self.sliderLabel)
-- Create the slider
self.slider = ISSliderPanel:new(30, self.sliderLabel:getBottom() + 10, newSliderWidth, 10, nil, nil)
self.slider:setValues(3, 30, 1, 0)
self:addChild(self.slider)
-- Draw the "Apply" button
local buttonWidth, buttonHeight = 60, 30
local applyButtonX = self.slider:getRight() - 5 - buttonWidth
local applyButtonY = self.slider:getBottom() + 20
self:drawRectBorderStaticV2(applyButtonX, applyButtonY, buttonWidth, buttonHeight, 0.8, 255, 249, 0)
local applyLabel = ISLabel:new(applyButtonX + buttonWidth / 2, applyButtonY + buttonHeight / 2 - 5, 5, "Apply", 252, 244, 0, 1, UIFont.NewSmall, true)
applyLabel.center = true
self:addChild(applyLabel)
-- Draw the "Close" button
local closeButtonX = self.slider:getX() + 5
local closeButtonY = self.slider:getBottom() + 20
self:drawRectBorderStaticV2(closeButtonX, closeButtonY, buttonWidth, buttonHeight, 0.8, 255, 249, 0)
local closeLabel = ISLabel:new(closeButtonX + buttonWidth / 2, closeButtonY + buttonHeight / 2 - 5, 5, "Close", 252, 244, 0, 1, UIFont.NewSmall, true)
closeLabel.center = true
self:addChild(closeLabel)
end
this draws that
๐ง ๐
that function though is what browser wrote not me
just wanted to test it since im trying to learn ๐
i mean, you're essentially just drawing on the screen
function ISLightPowerControl:drawRectBorderStaticV2(x, y, w, h, a, r, g, b)
self:setStencilRect(x+1, y+2, w-3, h-3)
local renderer = SpriteRenderer.instance
renderer:glStencilFunc(516, 1, 255)
renderer:renderi(nil, x + self.x, y + self.y, w, h, r, g, b, a, nil)
self:clearStencilRect()
end
``` is what he wrote earlier
yes
i altered it a little for me
i like the buttons to have the shadow kind of look
i guess in this case more embossed
either way it's pretty neat that he figured that out
can somone help me detirmine if this code is right
maybe we'll get to see a PZ UI overhaul soon? crazy UI fps lol
you need brackets to close module
ah
and an import to Base
how od i do that
like
import
{
???? Base (i forgot lol)
}```
{
your stuff
}```
like that
you need the { } brackets
that is for item
module needs {} and item needs {}
it is called encapsulation not really but you are containing code into blocks
like
module MM_roundmeal
{
item roundMeal
{
your stuff
}
}
eh?
module outside of brackets
completely
item inside first set
im desciribing what you are doing
now im confused
im sorry man its like 4am
lol k
he's just not getting it lol
i cannot understand
just copy this into your file
oih wait im dumb
replace your stuff with the item stuff
i need to look at a txt file now lol
i am
i didn't pick the best example lol
myb ๐ haha lets remove those
dont let me make you look bad
Here is an example from the game files
module Radio
{
imports
{
Base,
}
item WalkieTalkie1
{
DisplayCategory = Communications,
Type = Radio,
Icon = WalkieTalkieBudget,
Weight = 1.0,
DisplayName = Toys-R-Mine Walkie Talkie,
UseDelta = 0.007,
UseWhileEquipped = FALSE,
DisappearOnUse = FALSE,
TwoWay = TRUE,
TransmitRange = 750,
MicRange = 5,
BaseVolumeRange = 8,
IsPortable = TRUE,
IsTelevision = FALSE,
MinChannel = 75000,
MaxChannel = 150000,
UsesBattery = TRUE,
IsHighTier = FALSE,
WorldObjectSprite = appliances_com_01_16,
Tooltip = Tooltip_item_Radio,
StaticModel = WalkieTalkieToy,
AttachmentType = Walkie,
}
}
like this?
look above
yeah
they need to be on different lines, like
{
{
}
}
i get it
like?
i switched it
it hasn't changed I think
its showing the same image
ahhhh i see
and now remove that first line
first line?
the first {
like that
yep
so thats it?
last part, you need to import Base because that is what defines an "item" in the game
what does that mean
module MM_roundMeal
{
imports
{
Base,
}
i dont think thats fully true
you need to chain the different things together
if you dont import you have to use Base.
not quite but it's easy
hmm alright
if you dont want to prefix you import their module
it says it in the script guide ๐
like that
yeah
so i have done the code
i believe so
rubberducking it to victory
that helps alot
np
as ive said to nippy once already i cant look at a wall of text and learn
i dont see it ingame
like in mods tab
where do you have the folder
do it in Workshop instead of mods
oh
mods works too but i imagine you want to upload it, right
so, Zomboid\Workshop\YourModName\Contents\mods\YourModName\the files
in the first "YourModName" folder you want workshop.txt, a preview.png, and the Contents folder
for the game to see it correctly
maybe
what size is the preview.png
tahnks
but in the second folder of YourModName, the preview can be whatever you want, as long as its a PNG
ModTemplate has placeholders if you don't want to make pictures
Try find by id in mod menu
Not correct
Same feel. 9 AM, no sleep night)
@tawdry solar in "Contents", you need a folder called "mods"
i put it there
in the folder "mods", you put [mm]ROUNDMEAL
yeah its the order of the files lol
other way around :)
did you restart the game?
yeah
what in ROUNDMEAL folder?
drag "workshop.txt" and "preview.png" into [mm]ROUNDMEAL in 'Workshop"
you need "media", "roundmealposter.png" and "mod.info" in second pmm]ROUNDMEAL folder
like this?
@tame mulch sorry to bug you, but what happened with Project Humanoid? I heard the file was in the discord server many months ago
YES!
project what??
thanks man
project humanoid, its an npc mod
like the survivors series
yep
I stopped developing the mod.
I see :(
Now go sleep 
na
needa work out model sizes
and bug fixes
Icon file name starts like Item_***.png?
example
Anyway you use item
yes, and make sure the text after "item_" is the exact same as the icon you are calling in the item
no, for models you do them differently
do i change code ?
oh how
i will show you
ty
example
module Base
{
model CASIOTV10_Ground
{
mesh = model_CASIOTV10,
texture = texture_CASIOTV10,
scale = 0.004,
}
}
this is for custom models
if you have a model from PZ then you simply call that
in the same folder as the items.txt
yes
You do original mod or modification for other mod?
do i need new file
yes
from scratch
what will it be called
anything, does not matter
do i put scale as what it is in blender
alr
my scale is very small, but that is because of issues ๐คฃ
why does it say _ground
that is just naming convention, it can be whatever you want
i wanted different names for everything
you need texture and model yeah
do i put _ before the texture and model naems
no, the names are up to you
mesh can be skdbfbsdf
texture can be sjndfgkjlskldjfg
like texture_mode-name
but they have to match the name of the file
ah, yes
alr
is it new folder for texutres
btw what if my model has texture already
is it PNG?
yes
put that file into media\textures
how do i see scale in blender i forgot
idr, under transform?
transform?
you will probably have to edit it later anyways
yeah ik
set scale as 1.0 for now
yep, now just change the name of the model and the module
the module should be the same as your item
like so?
like
module mm_Roundmeal
{
model ROUNDMEAL
{
as long as "module" is there, you're good
so it should work
did you change it?
yes
okay, now go to round_meal.txt and change "WorldStaticModel" to be the name of the model
as in
WorldStaticModel = ModelName
eh
thats not a file
i mean the round-meal file with your item
like so
yep!
ty
yep
ok good
show it
ok, so that means the model is incorrect somewhere
open up round-meal and roundmeal-model
Can you send model script again?
i forgot to save
Different
wait no
you need to change "CASIOTV10_Ground" into "ROUNDMEAL"
ahh
that is the name of my item ๐
already is
And send again screenshot of both files
module names are different, it is case-sensitive
has to be exactly "MM_roundmeal"
for both
still an icon?
yes
items do not update automatically, you usually want to start fresh
fml
still no
i dont think it spawns in world either
yeah doesnt spawn
been to like 5 gas staitons
did you make the spawn rate abundant?
yes
Did you do spawn tables?
yeah
skulker walked me through it
i can send them
