#mod_development
1 messages · Page 63 of 1
Maybe jab could help
I will quicly check the lua code of talkie but I don't have too much hope
I think he does Java ?
You can also use parts of the radio code to recreate things like the distance distorting the words
I kind of wish that applied to say()
I think it only works on radio/tv
Making your own phone system is not an easy mod - but it's not impossible or that difficult
an aside, but it looks like VoiceManager:getMicVolumeIndicator() returns the volume of the local player's microphone - i know people have been wanting to do voice chat zombie attraction
Ahh. I gotta go back to work I’ll be on tonight to bother some people about it. Mrbounty if you want a inv to the server lmk and I can give you access to the dev stuff
Where skizot and them are.
I might make that a mod - Might also add the distortion thing to say()
i'm not sure if basing it on the volume of the microphone is a good idea, since microphones tend to deliberately not have very much range
but i know that's what people have been wanting
It would be more immersive
and testing that that value is nonzero would probably be the easiest way to tell if a player is speaking (and maybe the only?)
Well the game can check if it's high or low - as the bar does move
You could give them the benefit of the doubt and set the scale based on whisper to shout attraction levs
That's what I do for conditional speech
i think the bar uses that, but generally gamer microphones don't have a lot of range because they're trying to pick up the voice no matter what
if it were optional i couldn't complain, it would certainly be a cool feature for people whose microphones suit it
If you're rocking a mic with no noise gate you're probably better off setting yourself to push to talk cause your blasting everyone's ears too lol
that's not the worry, it's just that if you speak normally or whisper, on an average microphone the volume level is usually not actually very different
Yeah, that's why I mentioned giving the benefit of the doubt and starting the expectation that the lowest levels are a whisper
Could even make it less
there's not too much harm in it, i just don't think that scaling it based on volume makes too much sense when players don't really have the control over volume that you'd expect
As bad as it would be that your background noise gets you killed - it's still immersive game play 👍
having to whisper into my radio to avoid alerting zombies would be sick, but my microphone certainly isn't up to it
asmr metal gear zomboid
but voice is in fact all java sided and theres nothing exposed to lua
If the UI has a meter we can pull off sensitivity that way
Handling the attraction would be a bit of a mess tho
yeah, the meter uses that function (edit: actually i don't see that)
VoiceManager is exposed, which doesn't really do much, but it does do that at least
i can't see where it's exposed but the vanilla lua uses it so ??
oh... it's exposed in a weird way that allowed them to not expose that function U_U
Haha yeah
This may sound like a stupid question, but does PZ allow for custom animations?
There's alot of slightly exposed functions
it does
Took me a day and a half to figure out how to get the error info - ended up having it right the first time just did it wrong
i've never come across that before, although i was assuming anything not in exposeall wasn't exposed
🤷♂️
I feel like that's a missed opportunity for the modding community, that. The stock character animations, while robust, are a bit dry...
so it's possible that things i assumed were not exposed at all are actually partially exposed in a similar way
It depends if the package is exposed I believe
There's defined global calls in Lua manager
I'm not that well versed in Java technical terminology
But if the package is public and exposed it's good
Not package - class
And that doesn't always catch extends (?)
I wonder if animations can be tied to clothing...
yeah, if the class is exposed you're good, but this is a weird case where the class isn't exposed but the functions are, even though they don't go through those global functions
Animations use XMLs that can be given variables
So, I was talking to Albion about this a bit yesterday in DMs.
And we talked a bit about the global objects system. I played with that a bit last night and see why Albion said it was impenetrable and I’m wondering why we don’t have an API for that system. It’s kind of a big deal seeing as so many mods rely on some hacky work around to make them work when they really just want to make one of these items.
The reason I’m looking is I’m trying to make an item that people can drop on the ground (since you can’t build it or place it) that changs it’s own properties over time. I’m not sure how to approach this, Albion mentioned that I could have all the time simulated when the chunk is on loaded, but I’d need an example to really understand that.
Using setVariable() you can apply the conditions for anims to play
it manually creates the VoiceManager lua table with a couple of its functions
maybe in the same way the exposer does it, i've never looked at that, but it specifically only adds a couple functions
I know almost nothing about coding, but guess what, I know just enough to understand that what you're saying is good news.
i'm considering writing some documentation on global objects, but i need to analyse them a bit more myself first
they seem pretty useful for modding, but i haven't heard of anyone ever using them
I'd need to just code the variables like
when wearing clothing (dress), access variables = "animations"
And then have custom animations to override the originals, like coding the difference of walking with a rifle as opposed to walking without.
Again, I have a terrible understanding, but juuuust enough to peer in.
I don’t think you can, it creates a Java object and I get an error when I made my own
it does create a java object, but i wasn't under the impression that the java objects were unique to a specific type of global object
e.g. it creates an SGlobalObject for every server global object, regardless of whether it's a rain barrel, campfire, etc, so i don't think they need any special programming on the java side
when i was looking through the java for them i don't remember those objects actually doing too much
The way it feels that if it’s not defined Java side it just doesn’t work. But, I could be doing something wrong. I just took all the composter code and duplicated it, changing variable and function names.
There were also function names being called that we’re definitely Java functions like setCompost()
Uhhh you'll have to tie the animation into an event -- or load into the wear function / timed action
yeah, i never actually made my own, i was just trying to work out some of the bugs related to them
The anim XML will need a condition tag to play off of
syncCompost() was another
It's not very easy to do and can be overridden alot
some of them might have their own java programming, composters do, but i don't think rainbarrels do, which is what makes me think you can make your own
i don't think anything composters do can't be reimplemented in lua though
I did see a priority tag in one animation - I don't know it that well and just started messing with them for Sharks car stuff with opening doors and stuff
I'm sure there's someone who's been around the block with animation XMLs
this isn't exactly a comprehensive search, but there isn't a single occurence of the term 'rainbarrel' in the java, which is what they're referred to as everywhere in the lua
Right, but those only exist and likely use the rain collection system
what i mean is that as far as i can tell rainbarrels are completely lua-sided
I think there might be an iso object type named to collect water
they do use a java object but it's created from lua, so we can do that too
The composter does “work” and slowly converts one item to another which is honestly the exact behavior I want hahah
and it's not a java object unique to rainbarrels
Rain barrels are pretty old - but not as old as containers or ovens -- unfortunately the approach is different per thing
The problem I’m running into is tracking and saving the work per item
rainbarrels store that information as a property of their lua object, and sync it to the water container
Hate to say it but if you want something slightly different you might have to make your own
All objects have modData
you can keep it as moddata
And all isoObjects spawned in should save
I mean, ideally Albion is right, I want a global object. I just don’t think that system is accessible enough for us to use
until someone documents it 😇
Wait, tree placement is Lua right?
I only just now realized that could be a problem if the funny vegetation map is only on the java end.
There is globalModata
What exactly are you trying to do?
Wanting to make rocks that spawn on world-gen for a basic mining system.
Kinda like Don't Starve in a sense.
Unless you weren't talking to me, then my bad hehe
Sorry talking to fallen lol
Ah I gotcha, mb
No worries you can use onTick for your system
You can check zones and tile sprite
For spawning stuff correctly
I want an item that players build that you fill with food/rotten food that slowly converts the contents to propane
Huh, interesting.
Ok so that's totally doable with just modData on the objext
The issue you'll have is over time and loading unloading
You'll have to do what generators do which is track time and only update when players view it
Well generators do both - if loaded it ticks off time if unloaded it just snaps the value based on time differences
I think if you just stick to the time difference you'll be fine
Less work too
You’d have to leave and come back for it to update, right?
you can simulate it while players are there too
Depends on what it's doing
Is this strictly to harvest when ready?
Then I'd just do the check when players actually interact
If it's a power source then you'll have to actually run it on a tick when loaded
I’d like it to convert real-time just like the composter, but if I’m limited it is what it is
if you can't see the change without interacting with it, you may as well only simulate it when you interact with it
I believe the composter changes sprites over time right?
Yea, this would work
It does, in the map object file. I don’t need this
when a player interacts with it, save the time and simulate it, then when a player next interacts with it, simulate all of the time between that timestamp and now
Ah yeah that's why they simulate it realtime
I’m making that
Yep, this is the least lag inducing way to do it and exactly what I want
Sorry but I have my pz server and I recently updated the workshop and now it doesn't allow users to connect, does anyone know how to fix it?
you might have more luck in #mod_support
Ty
umm dose anyone know how to pick up a backpack that is unpickable? because of the weight(god backpack mod)
nwm am dum ass hell
Anyone know where to find the code for the camera zoom and controls?
Been looking around and I can't find any files on it
That would be in the java
Not something that's guaranteed to be malleable using Lua.
D:\SteamLibrary\steamapps\common\ProjectZomboid\zombie\core\textures MultiTextureFBO2 has the camera zoom stuff, but like he said its in java. I had to decompile it to make my zoom mod, so its not easily modible
Hmmm... I'll find a way around it. Thank you for the help
What are you trying to change?
3D camera system. Sounds stupid but If I can find a way to manipulate the pre-built Java camera then it'll be easy
hmm, im not sure where the camera stuff is, only the zoom stuff.
Camera zoom should still be in the same set. It'd probably be a float zoom = mousewheel or something
Yeah
but the game uses sprites... most of the world isn't even rendered in 3d
Already on that. I've made 3d replacements for a good number of tiles
Things like trees, bushes, and grass will probably just have the don't starve approach added to them. 2D textures always facing the camera
D:\SteamLibrary\steamapps\common\ProjectZomboid\zombie\iso isoCamera is where the camera stuff is
I you know what changes you want to make, i can help you editing the java files
That would be a huge help. Mind if I DM you?
sure
Do people take commissions for modding for this game?
some do
Are there any gear modders that do that you might be able to put me on to
Ay when I uncomment the following code I am getting an odd index out of bounds exception:
local arguments = {}
sendServerCommand("Jumper", "Join Buddy", arguments)
Is this not a valid way to send a server command?
@bronze yoke
oh, whenever i get this it means some non-unicode character has snuck in
is it possible to make a second hotbar type of thing appear when certain clothes are worn?. tons of mods add to the main hotbar but I dont want to use that.
i think it can happen sometimes when copy pasting from the javadoc
Exactly my suspicion, and sure enough rewriting those lines manually fixed it @bronze yoke
you're great
😇
Such constant fuckery modding this game lol
Invisible characters causing exceptions, oof
That'd be pretty extensive of a mod
maybe im overthinking it, but I'm looking to effectively make gun magazine holders to help with weight and show a model when magazines are attatched. but the hotbar is a bad place for that.
Magazine holders like a belt or such?
right
I wouldn't even put that on any hotbar tbh
Shell belts / ammo straps imply faster reload
i would make it a wearable container
well, if it interfaces with something like weapon condition indicator it could show full/empty mags perhaps
Perhaps you can mess around with the reload timed action to reward people who put their magazine in a belt container
containers are out because you have to tap R twice to take the new mag out of the container
thats the problem I'm trying to actually solve 😄
Well the player places the first one in a bag
The second is to grab a new mag
The alternative would be to drop the mag entirely
Which could be a feature if you tap R fast
But I don't think many people would be keen to do that
mhm, but i'm still looking to see about making the ammo belt anyway
So the reload action actually grabs the most suited magazine - this is the most full / closer to player inventory
not to appear rude by any means, but the help i'm looking for isnt "dont make that mod" lol
You could modify the action to treat the strap as better suited - and make the action faster
But I don't see how you'll get around having to hit R twice
spoke to most of the people on the server i play on who would love to have it, both for the usability and the aesthetics
Duct-taped mags would be pretty sick on some rifles 🤔
the mags will be in the main inventory, but "attatched" like a hotbar item to give a weight benefit of it. and it'd be awesome to be able to see whats in them to do reloads
just without spamming the hotbar
can items do the whole "attachment slot" thing without adding to the hotbar? or are the two things explicitly linked
I believe they are
hm
in that case, do you think it would be possible to force the hotbar slots to be like... at the end?
So you want magazines to also display at all times on the screen?
I believe there should be a way to sort them
it'd be awesome if so, but probably not a hard requirement
so sorting the hotbar to always put mine at like, the very end would also work
cause then they'd not interfere with the number keys at least
You may not need the hotbar at all tbh - but this is a pretty significant project 😅
You could create a special hud when you wear your holder item
Then display the ammo that's inside
Updating when items are inserted or not
yeah that was my other thought. we use the QOL equipment tab mod a lot, and that UI is really cool too. maybe a open/closeable panel in that sense that shows the magazines and their capaccities
It would be more stable and less of a headache patching issues + more control
Yeah that's a pretty good idea
You could have a very thin tab on the side that can collapse separate from the main window
Are you new to modding tho?
i still want to "attach" the magazines to show the model on the player and for the weight benefit. but maybe that can be from within that system?
Uh you could rig something with insertion
I'm not familiar with clothing tbh
I've messed with UI and hotbars
i've not done anything like this before, made a few small clothing things
Yeah, unfortunately that's how modding is right now
Adding on more of what is there is pretty straight forward
Deviating at all jumps into the deep end
But honestly it's more daunting than difficult
Say I'm making a custom animation in Blender... is there a tutorial on adding custom visual effects to the animation? E.g., a temporary bright glow effect? (Or can someone explain simply how this would be done, slash whether it is possible?)
does anybody know which .class file contains the logic/implementation of the admin cheat window?
ISAdminPowerUI.lua @hardy flint
thank you very much!
FYI, found in 30 seconds by searching media for "Edit your Admin Powers", finding the translation variable in the EN file, and then searching media for the translation variable... just in case you need something like this in the future and nobody is around. @hardy flint
In this case, variable was IGUI_AdminPanel_AdminPower in IG_UI_EN.txt
But there are a small handful of possible EN translation files.
thank you, will keep that in mind 🙂
(If you index media, you can search them all simultaneously using Windows file explorer).
Is there a way a modder can make only specific items lootable by a non faction member in safehouses
I feel it would make raiding more fair
Could someone help me? Is there any was to make cars drift in zomboid? Maybe some changes in vehicle editor while in debug mode might help?
😄
Use this mod as a template. Skizot implemented drifing with this car mod
I like it. I think it works for what it is!
I will give it a try rn, thank u
np!
I have tried another drift mod, but it was more like driving on ice than drifting
And I am not a moder, so I can't do mod like this myself
If you have a mod that does roughly what you are looking for. Reverse engineer it. You can start by editing the values of the scripts. But do not upload anything that another author has posted without permission if you use another's work as a template.
does anyone have a mod on the workshop that uses the OnCreate Function in their scripts? I don't have pz on this laptop I'm using so I can't use vanilla scripts in this instance to reference. Anybody got anything?
where can I find the mod folder>
?
I tried to go here, as it says in project zomboid, but there is nothing here
from the common folder. go into the workshop folder. then the 18600 one or whatever it is. The folder ID name is going to be in the car's mod page at the bottom.
2781895054 << look for that folder
I'd post my file location. But I don't have pz on this computer. I'm at work on my laptop lol
You're going into the PZ folder. its not in that. go from common to workshop
not common, pz, then workshop. thats a different folder all together
found it
Hello everyone, I want to make a mod, but I don't have any information, where should I start? Do you have any resources you recommend?
one sec ill find itr
is there a way to see an items full properties whilst in game? I'm think I'm adding an attatchment type using itemtweaker but unsure if its actually working
I just realized that is the right folder! Yes the 108600 is what i meant!
my eyes are shit apparently lol
you can change some things while in game. Like scripts, and model orientation
This is the only folder there
if you subscribed to the mod it should be in the folder name this 2781895054
getPlayer():getPanic() would return how panicked player is, right? float from 0 to 1?
that is weird. I don't know then honestly. Cause thats where it should be.
depending on what you want to do, find similar mods and look what they do.
yup thats how I do anything lol.
Does anyone know of a mod that uses the OnCreate function in the scripts?? Imma keep asking till I find one haha.
hello, I want to add vehicles to my server. There are places to add mod id and workshop id to the server, but there is no place to add Vehicle ID to my server. How can I add vehicles to my server?
I don't think you need to?
They just spawn. Gotta be a cell that wasn't visited before though
Does anyone know why when adding extras to a vehicle, for example, armor or roofrack, the mass is affected and makes it wobble? I need a code that allows me to fix tha
possible to make a mod where you don't see the name above someones head until you "greet them" sort of like a trade thing but you right click and choose "greet" and then both names pop up
That's...Actually a really good idea!
oooohh like clockwork
albion lemme give you some money hook a man up with a solid mod
Maybe it could be hidden if you're wearing an effective-enough mask or headwear?
we have that in the server rn
i'm not sure if it's possible unfortunately
burryaga was working with nametags recently and so was rj and both of them made it sound like the system is really inflexible
jonny spent alot of time tryna get that username to change
because we show usernames on the server, so he had to make it where it changes the username i guess?
it doesn't work for admins i know that.
but that greet mod would be soooo nice albion
it'd be easy if we turned off nametags and made our own
ahh we can do that. but the problem is people can't choose there own.
can we make it where the custom name tags are defined by username
we can just grab it from the username like usual anyway
but it'll let us add special rules like this
awesome lets do it.
be a pretty cool global mod for you to do for the pz community normally i ask you for our server specific stuff like bank systems and the prisoner mod lol
i think the handcuffs could be useful for a lot of people, but yeah projectrp doesn't have too much reach
i know thats why i always don't mind paying for stuff haha
can anyone remind me how can you get fear in pz? character-wise, not getPlayer():getStats():getFear()
Idea pitch for your custom user names mod: An option that when enabled changes the username to an alternate one when you have full face coverings.
A "crime persona" of sorts.
we have it in the server rn if you put a mask on now.
but we need to ravamp it most likley to work with albions new mod we will add.
cause rn it works with base game usernames, albion will have to write her own stuff for mask which should be uber easy to do considering she can do anything with her custom names
yeah if this is as simple as it sounds, then the mask thing would be crazy easy to do with a system like this, instead of super annoying
yeah poor jonny 😦 he put alot of time into his mask stuff. but im sure he will like the new system.
i'd have to specify the item ids of the masks that way you can add the ones that remove you're name right?
we could just do it for any full face mask, different types of masks use different slots
ohhh i didn't know that. yes let's do that then.
albion, i am in need of your halp. lol. do you know any mods of hand that use the OnCreate Function in the scripts? I know vanilla does and I could look at the pz scripts but I don't have pz on this laptop lol.
For example in a lua file somewhere:
`function Recipe.OnCreate.GSKTransferCondition(items, result, player)
local condition = 0;
for i=0, items:size()-1 do
local item = items:get(i);
if item:IsWeapon() then
condition = item:getCondition();
break;
end
end
result:setCondition(condition);
end`
Then in the recipe you'd have "OnCreate:Recipe.OnCreate.GSKTransferCondition"
you want OnCreate:Recipe.OnCreate.GSKTransferCondition
Ah, yeah. So I do.
So I am going to have to use lua. See I keep getting mixed info. I was under the impression that what I am trying to do could all be done in the scripts. Not lua. UGH.
I am garbage at programming lol.
yeah, oncreate is a lua thing
I new that. But idk. ig I am gonna have to learn lua. -_- All I am wanting is to finish this damn mod lol.
Anyone here super good with writing code for mods?
Did somebody @ me? I can't find it
i think someone did mention you earlier, but i didn't see them @ you so maybe they deleted it
🤷♂️
perhaps here?
oh, I found the targeting calculations by looking into where the java triggers the OnWeapon... events, IIRC it just checks every targetable thing in the area to see if it's in range and its relative vector has a dot product with your aiming vector of over 0.7?
the outline code is in there somewhere, I don't remember exactly because I was just concerned with how people shoot or hit vehicles, and it turns out you literally have to be standing in one of the interaction zones, ie for doors or trunk or hood, for it to register
that explains why it's so weird
ya, you literally can't shoot a car unless you're standing right beside it essentially, lol
it selects possible vehicle targets the same way as target zombies, by doing the vector math, but then it calls some function on the vehicle like getClosestPart or something like that, which returns nil if you're not close enough to touch it
If I was writing the code for a speed gun I'd get the list of vehicles in the chunk, filter out ones too far away, filter out ones outside a particular cone, then get velocity of the closest one. I don't know of a vanilla function that will do that for you, but the math is pretty simple
yeah, using it as a real gun seems like the hard way of doing it
anyone know of a mod that allows for natural yeast collection (other than foraging for the yeast)
MoreBrews!....maybe
im sure it allows yeast to be collected from rotten fruit in a jar
I'd wonder how context menus track mouse over vehicles -- and if that can be butchered into grabbing mouse over tracking
thats a good question, I've noticed with longer vehicles you definitely have to click close to its center so I assume it uses the getVehicleContainer function on the square you click on
would be pretty hard to do in motion
Sup anonymous. So they say that you might know some stuff about vehicle related events?
haha yes, thats how this convo started it seems
actually, it uses some weird java class that just loops through the vehicle list
Iwanted to make a speed gun that xapture the speed of a player while his driving ..
I couldnt @ cuz theres alot of similar name and your avatar didnt showed i wonder why... Guess anonymous is realy anonymous 🙂
haha sorta. been thinking of changing my nickname here just to be easier to find
anyway, like I was saying here, it shouldn't be too tricky to select a vehicle in the code, then you just need to call getDriver on it to get what player is in it
Ok.. so the police with scanner would be the one with the on tick right? Wait let me find my logic map
hmm, I would assume you use the onWeaponSwing event, constantly scanning could be expensive. Also not sure how you'd detect obstacles in the way of the radar/lidar
anyway...
vehicle = IsoObjectPicker.Instance:PickVehicle(getMouseXScaled(), getMouseYScaled())
I don't see any reason to use moddata, you can just get the velocity directly
yeah, making it use moddata complicates things doesn't it?
Ive got only the ui draw snd the speed but its displaying on the driver for now. Just for testing plan to put it on the person with the radar. And turn on and off via onEquipPrimary event
So what your saying is i dont need to do the vehicle/driver codes just the one with the gun would be fine ?
Yey that makes things shorter ! 🙂
are you worried about line of sight? that's probably going to be the hardest part
Yeh my way of doing it in my mind dint sound efficient at all which is why i waited for advice
Otherwise ill re write it again eventually. And dont want to do stuff twice
Well albions code is if you click
Poltergeist mentioned making it an acutal gun with 0 dmg but i fear it will stun
you can run that code at any time, it doesn't have to be on a click event
ah, that function is handy. It calls LosUtil, which is what I was going to point out, I don't know if LosUtil is exposed though, so having a function on the player is handy
Idk ehat that is but read more when i get to it
you could run on tick while the gun is equipped or something
if not player:isAiming() then return end
vehicle = IsoObjectPicker.Instance:PickVehicle(getMouseXScaled(), getMouseYScaled())
if not vehicle or not player:CanSee(vehicle) then return end
-- now calculate speed and display it
Yep and is aiming thats the plan actually
what is the difference between isAimControlActive() , IsAiming() and isAimKeyDown() ...?
Not necessarily needs to be pointed i guess
this will only work if the mouse is over the vehicle, I think, but that's fine because the police should have to work for it
i could imagine there can be some situations where you're pressing the button but not actually able to aim, but that still leaves two that sound like the same thing
?
I dont understand...
I get that it is active if your aiming i dont think we need to make it point to the vehicle if it can capture it without pointing at it
Tho for realism that would be a preferred thing
.
O wonder where the highlight is handled i mean where on the lua
you have to select your target somehow. Albion gave you a way by hovering your mouse over it, its up to you if thats what you want
When u aim at someone your visual shows red or green
isAimKeyDown() checks if the button is pressed, IsAiming() checks if you're actually aiming, isAimControlActive() returns true if either is true
That might be something i can hook on
the game never highlights vehicles
Ahhh wow nice thnx
i'd be surprised if that was lua, but it is used on a similar kind of class so you might be able to use it if it's exposed?
Like the markers?
I was planning to do some marker mod util . Could be useful for skizots delivery thing
Anyways thank you so much for your time u guys 🙂 ill let u know what works..
Also i wonder what your name would be anonymous
looks like I can't change it anyway, so we'll never know, lol
right click > edit server profile > nickname
Hey, Chuck, I'm home now, so I can actually delve into the discussion of coding a little bit better.
Can specific, unique animations be tied to clothing?
😮
just an axe pleb
Ah, might because of this veteran badge
ye, probably
I thought the badges were entirely visual lol
Don't know how many posts or how long you gotta post to go up a rank, haha
esp. if you use vanilla weapons expanded 😉
makes floor strikes stabbing - and makes a pop sound
You seem smart.
Smart advice, that's the important part.
plenty of other people here if I don't respond right away
I just need to map out how to word this future request whenever someone can help,
Can specific animations be tied to clothing? Like..
Were you asking about this earlier?
...if I created a unique walking animation, could I code it to override the normal walking animation when a specific walking cane is equipped?
Yes, I was asking earlier (but I was also at work, and a little vague)
Or a silly hat.
Maybe a cast for the leg,
So, this isn't a topic I'm well versed - but I can tell you using the animation XMLs you can set conditions/events
I've also seen a priority tag (as XMLs are all <>)
Idk if that would supersede something like walking - which is not really an animation so much as a whole special player state
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>Bob_Idle_Driver</m_Name>
<m_SpeedScale>0.80</m_SpeedScale>
<m_AnimName>Bob_IdleDriving</m_AnimName>
<m_BlendTime>0.20</m_BlendTime>
<m_Conditions>
<m_Name>SCUCK_Anim</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>Bob_Idle_Driver</m_StringValue>
</m_Conditions>
</animNode>
local enter_start = ISEnterVehicle.start
function ISEnterVehicle:start()
enter_start(self)
self.character:SetVariable("SCUCK_Anim", "True")
end
local function exitVehicle(player)
player:SetVariable("SCUCK_Anim", "False")
end
Events.OnExitVehicle.Add(exitVehicle)
first is XML, second is Lua
It's a string check - but in this case I use it like a boolean
when the player enters the car you can apply this kind of pseudo animation state
the game will seek out animations of specific names
and swap between them - given the same condition is set for all of them
I assume vanilla has the lowest priority - as there isn't one for this anim
there's also Lua functions for playing anims
but they aren't really 'states' - and get interupted
You can find the vanilla ones in Media/
it's a pretty in-depth system
Does launching in -nosteam always clear mod sandbox settings and enabled mods?
Hmmm no it seems to only be doing it for Meditation... I wonder why that is happening. Seems to be ever since I added a second mod folder to that mod?
personally -nosteam doesn't use the local workshop cache - if you keep your wip mods there
if you are subbed to your own mod it'd be grabbing off the workshop
I'm not subbed to it
It is in Zomboid\Workshop
I mean I have other mods in the same place not doing this
that's the local cache - in my experience -nosteam doesn't grab mods from there
only /Mods/
It seems only Meditation, which has two mods in Contents\mods, is resetting
And yeah Meditation is not visible when I'm in -nosteam
do you have an old copy in /mods/?
that's weird but if you load up the game with out the mod installed/retrievable the sandbox vars might get lost and reset once you load it
if that's wheat you mean about it not being visible / going to steam (normal)
MP testing is a hassle
I wish debug let you connect multiple clients regardless of steamID 😦
You know what sure enough
My other mod's reset to defaults too
The one that was enabled entering -nosteam mode
oof
At least it's just a process error and not a mod issue
That was my main concern
"Did I bork this for everyone?"
"Or only me?"
I just didn't notice my other mod set to defaults because I basically use my other mod's defaults
lol true
@faint jewel
probably could clean up the truck a bit lol
needed to burn off some energy and think
ugh tfw you fix one mod only to discover an issue in another lmao
both yours?
Yeah
I have Jumper fully working... can drag players with me and have same-name locations in different categories.
But now I am trying to figure out how I inverted minimap-hiding in DOTZ
Accidentally got disconnected from the rest of the loop such that minimap was showing on hide and hiding on show
heh
I think it's related to a death-loop bug I just tried to address. When I died with world map open, stuff got wonky.
I hate this gd minimap
lol it's adorable.
anyone know how to spawn a vehicle at a certain location
local vehicle = addVehicleDebug(vehicleType, IsoDirections.getRandom(), nil, currentSquare)
the nil is an integer for the skin index
won't work if the squares aren't loaded tho
Phew, figured it out, back to my almost-completed new mod. Whee.
Can anyone think of any mods that added custom special effects to an animation state?
is there any way to do reflection on a Lua-exposed object? i.e. access/call private members directly
If i wanted to introduce a new plant, how would I go about it? I am struggling with finding the code for it
Anyone know a good Java editor/compiler?
currentsquare... hmmm
depends heavily on the type of plant, they have wildly different behavior depending on a few factors
(also depends on how you want to use it - if you're placing it manually that's one thing, if you want it integrated into the foliage that's much harder)
@finite radish Oh! I should've specified, just one for a farming plot
oh, like a growable plant? there's a few mods on the workshop, you can take a look at how they handle it. I think I remember an API that someone made to help with that sort of thing, but it's been a long while since I remember seeing it
i think the main mod that comes to mind is SoulFilcher's Farming Time though, that should have more than enough examples to get you started
Alright, thank you for the advice!
oh ffs how do i select a square at a certain set of coords?
Ugh tfw while playtesting your mod you immediately know there are going to be people requesting feature X and you know damn well you're going to add it.
does this work in mp?
i need to know how to set and get mod data on a TILE. not world mod data
so what I do is call on clients to spawn the car - from the server, using a command
how do you make it so a trait shows which skills it gives +1 to when you hover over it?
do i need to add something here, or is there something outside the thread that makes it do it for every trait i add?
that should be automatic
ugh... this is a pain.
I'm trying to access the Java field IsoPlayer.closestZombie from my Lua script... it's declared public in Java, and the decompiled IsoPlayer.lua mentions it (in a comment). But it doesn't seem to be available on the actual player object, and there's no getClosestZombie() getter defined in Lua. Am I out of luck?
There's a method player:getClosestZombieDist() which I presume returns the closest visible/nearby zombie to the player, but it's flagged as deprecated in the Java, and looks pretty heavyweight (whereas the closestZombie float seems to be maintained continuously)
Where is the zombie loot and the clothing they wear defined?
Ah, and also player:getClosestZombieDist() returns nil even if there's a zombie literally gnawing on my character's arm, so it doesn't seem very useful. Deprecated, indeed.
i thought so too. from looking at other modded traits they show, but mine does not show. maybe it is because i also add items or something? idk
anyone have reliable code to get a radius around a set of coords for a vehicle?
local isFull = getCell():getGridSquare(sX, sY, sZ):isVehicleIntersecting(); is CLOSE but misses a lot.
Hmm, client-side calling getCell():getNearestVisibleZombie(player:getPlayerNum()) seems to do something similar, but the fact that it uses the player's index (and IsoCell stores them in an IsoZombie[4]) means it presumably doesn't work server-side.
what are you trying to achieve?
Me? I want to add a check when a player is entering an RV Interior that there aren't any zombies "too close" (configurable via a sandbox setting).
nah, skizot
he wants to avoid spawning vehicles inside other vehicles
Ah 🙂
oooh katana
BaseVehicle.testCollisionWithVehicle() is used for that, I believe
Congrats! Also, well deserved 😁
lol, grats
i want to spawn a vehicle but I want to check the spawn area to make sure there's not already a car there
Looking at the implementation of isVehicleIntersecting, it calls BaseVehicle:isIntersectingSquare, which seems to do an intersection test using PolyPolyIntersects.intersects.
So in Java it seems you could do PolyPolyIntersects.intersects(vehicle1.getPoly(), vehicle2.getPoly())
But I don't know how much of that is exposed on the Lua side
Alas, no PolyPolyIntersect.lua that I can see 😦
BaseVehicle:getPoly() is defined though
So you could implement your own intersection test for two VehiclePolys...
as I mentioned before BaseVehicle.testCollisionWithVehicle() is what the vanilla code uses to keep vehicles from spawning inside each other, uses a whole different collision algorithm. I imagine one of these approaches should work
I used a similar implementation for my collision algorithm. works well on stationary vehicles, but moving vehicles don't report their coordinates well enough. shouldn't be a problem for spawning though
got an example usage?
most IsoCell stuff won't really work on the server
some of it does, but it's mostly an object for the client
If you went with the polygon route, it seems that VehiclePoly has a method getAABB, and doing intersection tests on Axial-Aligned Bounding Boxes is dead simple, if you don't mind that they're larger than the actual rect, so positions that would be valid would still be rejected
Ah, cool. Good to know, thanks!
i don't think it loads any chunks on the server, so most of its functions will just return null/empty
IsoChunk.doSpawnedVehiclesInInvalidPosition and IsoChunk.isGoodVehiclePos both use testCollisionWithVehicle, unfortunately the latter is private or it would probably be all you need, its used for making traffic jams.
the AddVehicleCommand may be what you really want, which uses the doSpawnedblablabla method
so we know what he strings are?
If you want to do a check for player interaction, why not do it client side?
Is that re: testing for nearby zombies preventing you from entering the RV Interior? I'll definitely do it client side, but in a client/server setup I'd normally always test the validity of a client's action on the server as well.
I see, getCell works on server from what I know. But some of the arrays might be empty.
getCell works, it's just that many of its functions do nothing
how about IsoPlayer:GetStats():getNumVeryCloseZombies()?
The array of nearest zombies is maintained by the render code, and is indexed by player:getPlayerNum(), so it's going to be empty server-side.
you won't be able to customise the range or anything, but it'd be sufficient for a toggle
IsoPlayer:GetStats():getNumVeryCloseZombies() returns the number of zombies within 3 tiles - it's used for the jumpscare music, I think
So they're very close 😁
I'm definitely using player:getStats():getNumChasingZombies() as well... if you're being chased by zombies, I don't care how far away they are, you won't be allowed inside the interior.
Although this will all be configurable by sandbox settings - I'm not going to tell players how to play their game.
i thought that sounded extreme at first, but then i remembered that you're literally invincible inside an interior... i like that actually
But the RV Interior is absolutely safe, being a map far far away from the real world and with invulnerable walls, so we want to make it a bit more restricted
Yes, indeed 🙂
(teleporting zombies into your interior if they arrive soon enough after you enter would also work, but I don't think it would be feasible given that the chunks will be unloaded pretty immediately if the player is removed from them)
that's something i've always wanted to play with
never got around to testing if it was even feasible, but a feature like that would definitely get me using that mod
lol AddVehicleCommand is not found ANYWHERE
To be fair, the zombies should have to break through the windows of the RV first before they could follow you inside.
they certainly don't have time for that!
Not before they're unloaded from memory, no.
? If you haven't you really should get an IDE set up with the source code.
zombie.commands.serverCommands.AddVehicleCommand.java
I doubt it would be feasible, but it would be great when the new basement support is added in v42 to put the interior far underground below the vehicle location, rather than way off to the side of the map. Then meta and helicopter events while inside would actually affect zombies that are near your vehicle, and presumably the chunk would still be loaded so zombies outside the vehicle would continue to get CPU cycles, and we could conceivably have a way for them to break inside.
that was my thinking actually
But it would require moving the interior map from wherever you last entered inside to a new location each time you entered, including all items in containers, and I doubt the engine could be cajoled into doing that.
oh yeah...
i don't think it's actually that impossible, but it would suck to write
i mean you have to think of everything you could possibly need to move
might have to hold it all in memory since we can't load chunks at will, which is just lovely too
Also, I don't know what the Z limit for the basement stuff is. You'd want to be sure that you're not overwriting bits of the map that are actually being used by a basement or sewer system.
local radio = nil;
for i=0,sq:getObjects():size() - 1 do
local item = sq:getObjects():get(i);
if instanceof(item, "WHATISTHISFORAVEHICLE") then
Car= item;
break;
end
end
particularly if players can dig, which if they can't will certainly immediately become a popular mod
yeah, I'd be mad if it's not possible
all vehicles are BaseVehicle, afaik
Are vehicles actually added as objects in squares?
yeah, they're IsoMovingObjects at heart
i've never looked specifically at if they appear in those lists, but i imagine they do
there is a square.getVehicleContainer which returns one of the vehicles in a square. I think it has to be the actual xyz of the vehicle though, not just one it overlaps
Because I was being bitten by this test in some hackery I was doing: if not self.vehicle or not self.vehicle:getSquare() or self.vehicle:getSquare():getMovingObjects():indexOf(self.vehicle) < 0 then
So it expects to find the vehicle in the getMovingObjects list returned from the square returned by vehicle:getSquare()
That's in ISVehicleMechanics... the comment is -- handle vehicle being removed by admin/cheat command
The hackery in question was me playing around with wrapping a vehicle Java object with a Lua object using metatables to delegate all function calls to the vehicle, so I could override function calls on a Java object. It was working well, but that test was failing because self.vehicle was my Lua object, but getMovingObjects contained the original vehicle 😩
oh you wanted to mess with the metatables on a specific object? that's fun
Not exactly, I wasn't touching the metatables on the Java object. That might actually be a better way to do it, actually, if they're available.
i'm unsure if that method would work - i'm pretty sure it's a single metatable
I was creating a Lua object with metatables whose __newIndex and __index functions would pass on the read/write to the java object, but give me an opportunity to do stuff on the way through.
And I could register before and after functions for any given function on the Java object which ran to mess with the arguments going in or the return value coming out, or a replace method which was called instead.
Anyway, I've shelved that, I don't think it's very practical.
I just wish the Java code was, well...
ECS rewrite of the Java side of PZ when.
sounds slow too, but you're probably right in that it's likely the only way to accomplish it
the real issue there is just how much stuff is private, and without any form of real reflection a lot of stuff is just outright impossible
Indeed. It was fun, but I don't think it would scale very far.
In order to work around that issue above with the ISVehicleMechanics testing if the vehicle is still in its square, I had nested after wrappers like this:
local wrappedVehicle
wrappedVehicle = wrapJavaObject(self.vehicle, {
--getPartCount = {
-- after = function(count)
-- return count + 1 -- Water tank
-- end
--},
-- Unfortunately the mechanics UI checks the vehicle's square's getMovingObjects Java array for the vehicle
-- object, but we're trying to pretend that wrappedVehicle is the same thing, so we have to wrap each of them
-- in turn so that vehicle:getSquare():getMovingObjects():indexOf(wrappedVehicle) returns the index of the real
-- vehicle. This check is made every tick, so this wrapping is probably very expensive.
getSquare = {
after = function(square, vehicle)
return wrapJavaObject(square, {
getMovingObjects = {
after = function(vehicleArray)
return wrapJavaObject(vehicleArray, {
indexOf = {
after = function(result, self, searchFor)
if result == -1 and searchFor == wrappedVehicle then
result = self:indexOf(vehicle)
end
return result
end
}
})
end
}
})
end
}
})```
So I overrode the vehicle's getSquare function so I could override the square's getMovingObjects function so I could override the java array's indexOf function so it returned the index of the original vehicle java object when it searched for the wrapped object 🤣
And that all ran every tick.
😟
It was raining in-game when I was testing this. The raindrops were falling noticeably slower. I didn't measure the FPS 😁
I mean, if I thought it was worth it I could add some caching mechanism so the wrapped objects were re-used, but I don't think it's sustainable.
what was the actual end goal?
One of the plans for RV Interior is to have a water tank you install and have to fill by hand, and possibly gutters as an upgrade you eventually get to catch the rain, instead of getting free rain catcher barrels on the roof of the interior buildings.
Ideally I want the water tank/gutters/anything else we add installed and uninstalled through the mechanics UI
But I don't want to duplicate and hand-modify every vehicle script.
So I was looking into ways to modify vehicle mechanics dynamically.
but why at runtime? figure out the script changes needed, then regex it in
ez clap
We don't have our own vehicles - you need to have other vehicle mods (like Fillibuster Rhymes', or AutoTsar) to get the vehicles whose interiors you can enter.
So we can't really have modified vehicle scripts distributed as part of our mod
Whether they're edited by hand or modified by something we automate
why not? if they're already a dependency, not sure I see the big deal there. permissions and all that, yeah, but still
idk much about either party and how stingy they'd be about that sort of thing
None of them are actually hard dependencies, because players might not want to play with all of the 5 the vehicle mods we support.
what did you need to modify about the vehicle scripts?
couldn't you just use the script manager?
So, I'm now thinking that VehicleScript.copyPartsFrom looks promising.
We have a script which just has the water tank/gutters/whatever vehicle parts, and then copy them into the relevant vehicle scripts each time the game starts up.
local vehicle = scriptManager.instance:getVehicle('Module.ModdedVehicle')
if vehicle then
-- etc etc
end
the way i used this was creating a vehicle script that included only the modifications and adding that script as a template to the original script using the script manager
that was what I was thinking, just didnt know the syntax. basically instanceOf
Yup, that's what I'm thinking too.
What mod did you do that in?
it's unreleased
Ah well 😁
can i send a chat message to just the local player?
Ooh, I've upgraded from a 🪠 to a
!
local scriptManager = ScriptManager.instance
local getVehicle = scriptManager.getVehicle
getVehicle(scriptManager,'CarNormal'):Load('CarNormal', '{template=CarNormal_Upgrades,}')
```this is the concept
like a "no room to spawn vehicle" message
haha congrats!
ignore the bringing getvehicle into local space, that's a micro-optimisation i couldn't be bothered to rewrite
Anyone happen to know whether one of these DrawTexture functions (for UIElements) can cut a picture off at an arbitrary height (rather than scaling it)?
You could get the player to Say() the message, perhaps?
say is only visible to that client, so it's pretty ideal for this
Thanks once again, @bronze yoke ! I've yoinked those snippets into the GitHub ticket for the water tank feature, and we'll see how we go 😁
😇
i know this is a long shot, but is there a way to tell what city you are in?
no
figures.
you could just define a big box around each one
Is it possible to set vehicle to no colide and not visible in any way?
you probably don't want it as a dependency, but kyrp uses stfr and there's a function i wrote for that in there
stfr?
check x,y
small town first responders
yeah, it just uses some predefined rectangles to determine which zone you're in
actually that function might not be perfect for this usecase... it's pretty specifically optimised for stfr
then yeah my signs are going to have to have mod data for the city that gets pulled when you open the menu.
fuck this is getting convoluted
lol
that's probably the best way to do it, there aren't going to be that many signs right? having a whole zone system would be overkill
1 per city
How are zombie clothing defined?
@faint jewel If there's only a handful, and you only need it occasionally, you could potentially define one "city centre" square for each city, and then iterate them and pick the closest one when spawning your sign (or when you open the menu)
I'm guessing one of the procedural loot tables?
for vanilla see zombieszonesdefinition
and the loot table is "Outfit_..."
Yeah I was lurking in there for a while. I see their names in 'zombieszonesdefinition' , but what actually gives them the clothes I wonder? I see the outfits in 'distributions' too but...
Like.. there is "Cook_Generic" - where does he gets the specific clothes he has on?
there's something like outfits guid, not sure about the name
if you can't find it, check one of the clothing mods to see what it's called
Authentic adds extra outfits
sigh. these all have the SAME spawning direction "IsoDirection.N" stupid game.
only the bottom one is right
Damn I knew it CANT be too complicated to change up their outfits a little 😄
Thanks!
it's like toddlers are spawning them in 😦
addVehicleDebug(SjobModel, sA, nil, spawnsquare)
x = 12140, y = 7141, z = 0, sA = IsoDirections.N
they should all spawn the same direction right?
none of this wobbly shiz it's doing.
they are too big and probably bump against each other while spawning
the top one is the first one spawned.
and they are not too big, they match the trucks perfectly.
too big for the spawn zones i meant
they are being spawned in.
ohh
I wish there was a totally zombie free trucking RP server in PZ
no?
AZTS.
count me in
trying to get the job boards working.
it probably needs a lot of custom systems to work?
oh god does it.
Is it possible to set vehicle to not colide and not visible in any way?
What about changing wheels animation?
Try a stencil rect:
-- In the prerender:
self:setStencilRect(10, 10, 100, 50); -- (x, y, width, height)
self:drawTextureScaledAspect(self.item:getTexture(), 20, 20, 120, 120, 1, self.item:getR(), self.item:getG(), self.item:getB());
self:clearStencilRect()
You can use any drawTexture method with this, I was just working with this call already.
HAH fixed it.
wanted to ask what the best attachbone is when making a half mask like in undead survivor mod
heres an image to what I mean
is there a way to make a weapon spawn on the player with an upgrade attached to it?
and what about the hatcategory
huh?
cause it shouldnt remove any of the hair
look at the face masks that exist?
ok
Yes. After you create the gun, you would also create the WeaponParts you want to attach and call yourGun:attachWeaponPart(yourAttachment); for each one.
thanks!
do i need to name the gun like i would with a bag?
Yes. Something like
local newGun = getPlayer():getInventory():AddItem("Base.Pistol"); local newPart = InventoryItemFactory.CreateItem("Base.RedDot"); newGun:attachWeaponPart(newPart);
thanks again!
Is there an official way to request changes to the Java code base? Would love to add an "isAttached" check here so music could still play through the Walkman (also would love to add this for radios and radio communication)
Context attached...
Edit: I'm happy to contribute a patch
Edit2: (also thinking about those who leave radios on and put them in their bag... would be a lovely zombie attraction - or distraction)
hm, there's no way to see the ZombiesZoneDefinition around you in-game, is there?
Thanks, will try to this today!
i did that its long and complex im afraid i dont know how to hook on it
How are you capturing the player via right click? Like right-click on any player?
yes
i like to use this
local sq = objects[1]:getSquare()
local squares = {sq, sq:getS(), sq:getE(), sq:getS() and sq:getS():getE() or nil}
local players = {}
for _,square in pairs(squares) do
local movingObjects = square:getMovingObjects()
for i=0,movingObjects:size()-1 do
local movingObject = movingObjects:get(i)
if instanceof(movingObject, 'IsoPlayer') then
table.insert(players, movingObject)
end
end
end
```depending on your use case you might need to add a check that you don't capture the player opening the context menu
ahhh so i need that squares
not really, i just use that to make the selection area more intuitive
what event or function do i put thi
can it be on post UI
if you only use the objects on the square the player clicked on, about half of the player won't actually be on that square
Events.OnPostUIDraw.Add(speedTest)
ISWorldObjectContextMenu.lua has the following roughly:
ISWorldObjectContextMenu.fetch = function(v, player, doSquare)
...
if instanceof(v, "IsoPlayer") and (v ~= playerObj) then
clickedPlayer = v;
end
...
end
ISWorldObjectContextMenu.createMenu = function(player, worldobjects, x, y, test)
...
for i,v in ipairs(worldobjects) do
ISWorldObjectContextMenu.fetch(v, player, true);
end
...
end
i thought this was for a context menu event, i'm not really sure why you'd want players on right click outside of that
im really not sure if theres a diffrence with how you get the player wether its for the context menu or not
I think this is for the speed radar gun
cuz i do need it for both
i also need the right click anyways for other parts of the mod
well you just need to grab the square under the cursor and omit the first line since that's context menu specific
local sq = -- some method of grabbing the square under the cursor
local squares = {sq, sq:getS(), sq:getE(), sq:getS() and sq:getS():getE() or nil}
local players = {}
for _,square in pairs(squares) do
local movingObjects = square:getMovingObjects()
for i=0,movingObjects:size()-1 do
local movingObject = movingObjects:get(i)
if instanceof(movingObject, 'IsoPlayer') then
table.insert(players, movingObject)
end
end
end
Events.OnFillWorldObjectContextMenu.Add(ISWorldObjectContextMenu.createMenu);
do i need this?
Was just looking into it, I think I got something for you. Lemme type it out
Not tested, but this should get you mostly there
-- Reference: projectzomboid/media/lua/server/BuildingObjects/ISPlace3DItemCursor.lua
-- Reference: projectzomboid/media/lua/client/ISUI/ISInventoryPaneContextMenu.lua
if isServer() then return end
RadarCursor = ISBuildingObject:derive("RadarCursor");
function RadarCursor:getSquareAtCursor()
local worldX = screenToIsoX(self.player:getPlayerNum(), getMouseX(), getMouseY(), math.floor(self.player:getZ()))
local worldY = screenToIsoY(self.player:getPlayerNum(), getMouseX(), getMouseY(), math.floor(self.player:getZ()))
return getSquare(worldX, worldY, self.player:getZ());
end
function RadarCursor:render(x, y, z, square)
local square = self:getSquareAtCursor()
if square ~= nil then
-- do whatever with the square at the cursor
-- Albion's snippet might work well here
end
end
-- Called by Java in IsoCell.setDrag()
function RadarCursor:deactivate()
ISBuildingObject.deactivate(self)
end
function RadarCursor:onObjectLeftMouseButtonDown(object, x, y)
-- Disable clicks on objects, to prevent the loot window being displayed
-- however... you _can_ use the same logic instead of putting it in the "render" function
-- here if you only want mouse click to get the speed
return true
end
function RadarCursor:new (player)
local o = {}
setmetatable(o, self)
self.__index = self
o:init()
o.player = player
return o
end
-- somewhere else in your code, when you're calling to find/render the speed
local radarCursor = RadarCursor:new(player)
getCell():setDrag(radarCursor, player:getPlayerNum())
oooh yeah
local function OnObjectLeftMouseButtonUp(object, x, y)
-- Your code here
end
Events.OnObjectLeftMouseButtonUp.Add(OnObjectLeftMouseButtonUp)
will this work
ill try now
Added 2 calls that might be useful (:deactivate and :onObjectLeftMouseButtonDown)
the even i found works!
but its not properly capturing everyiting jus tby printing the arg
also the coord of the other event returns the scree x y
the other im just about to try
cuz i didnt print it yet
i'd heard that event doesn't grab isoplayers
you could grab the square of the object and search for players like my snippet
thats what i was planning to do
How are you're doing your "isAiming" check on your weapon?
You can probably trigger the getCell():setDrag(radarCursor, player:getPlayerNum()) call if you are aiming, and maybe call the radarCursor:deactivate call if you're not aiming.
wait, why do you need to find a player with the radar gun anyway?
to get his speed
Events.OnPostUIDraw.Remove(speedGunResult)
local function speedGunResult()
if not getPlayer() then return end
if getPlayer():isAiming() then
local chr = FUNCTIONTIGETPLAYERUNDERTHEMOUSE()
local car = chr:getVehicle()
if not (car and car:isEngineRunning() and chr:isDriving()) then return; end
local MPH = car:getCurrentSpeedKmHour() / 0.621371
local speedValue = tostring(math.abs(math.floor(MPH)))
chr:getModData()['MPH'] = speedValue
--local speedValue = tostring(math.abs(math.floor(MPH * 100)/100)) --adds 2 decimal places
local xOrigin = getCore():getScreenWidth() / 2
local yOrigin = getCore():getScreenHeight() / 2 - 20
getTextManager():DrawStringCentre(UIFont.Medium, xOrigin, yOrigin, speedValue , 1, 1, 1, 1)
end
end
Events.OnPostUIDraw.Add(speedGunResult)
we already had code to get the vehicle you're aiming at right? just use getCurrentSpeedKmHour() on that
which code?
this one?
let me check i i slept after that discussion with anoymouse i must have not stored it cuz i looked at the notes i had
ahh this one!
local function speedGunResult()
if not getPlayer() then return end
if not getPlayer():isAiming() then return end
local car = IsoObjectPicker.Instance:PickVehicle(getMouseXScaled(), getMouseYScaled())
if not car or not getPlayer():CanSee(car) then return end
local MPH = car:getCurrentSpeedKmHour() / 0.621371
local speedValue = tostring(math.abs(math.floor(MPH)))
--local speedValue = tostring(math.abs(math.floor(MPH * 100)/100)) --adds 2 decimal places
local xOrigin = getCore():getScreenWidth() / 2
local yOrigin = getCore():getScreenHeight() / 2 - 20
getTextManager():DrawStringCentre(UIFont.Medium, xOrigin, yOrigin, speedValue , 1, 1, 1, 1)
end
Events.OnPostUIDraw.Add(speedGunResult)
no need to call getPlayer() every time, but yeah
ok ill shorten it out
since this code is running a lot you don't want too many unnecessary calls
local function speedGunResult()
if not getPlayer() then return end
local car = IsoObjectPicker.Instance:PickVehicle(getMouseXScaled(), getMouseYScaled())
if not car or not (getPlayer():CanSee(car) and getPlayer():isAiming()) then
local MPH = car:getCurrentSpeedKmHour() / 0.621371
local speedValue = tostring(math.abs(math.floor(MPH)))
--local speedValue = tostring(math.abs(math.floor(MPH * 100)/100)) --adds 2 decimal places
local xOrigin = getCore():getScreenWidth() / 2
local yOrigin = getCore():getScreenHeight() / 2 - 20
getTextManager():DrawStringCentre(UIFont.Medium, xOrigin, yOrigin, speedValue, 1, 1, 1, 1)
end
end
Events.OnPostUIDraw.Add(speedGunResult)
i just meant it'd be better to use
local player = getPlayer()
if not player then return end
--etc etc
if not car or not (getPlayer():CanSee(car) and getPlayer():isAiming()) then
you might have wanted this line to be if not car or not (getPlayer():CanSee(car) and getPlayer():isAiming()) then return end
^ right now it's checking if there is not a car, or not if the player can see the car and is aiming. If you remove the nots it'll do the same as an early return
if you choose to remove the nots, you need to replace the or with an and too
When is too much not enough? 🤣
I've been slowly working on some much needed inspector tools. Inspecting items will show the icon, any 3d model, and any world sprite along with item attributes. If -debug, will also show item details in a debug window, along with the edit item menu.
Planning to expand this to a right click > inspect feature, as well as an "inspector" tool that you can select squares/objects and ui elements to get data on them - super helpful when you want to see (and edit!) data on an existing object.
oooh looks very useful!
I'll hopefully have something for beta testing early next week and probably release on the workshop next weekend.
It includes a rough UI framework to help make code a bit cleaner and easier to follow.
Nice stuff!
I know it's a little weird, but I made some mods earlier this year and just left them with the default "The Indie Stone" picture from the example mod, and I wanted to spice them up as I'm working on a few new mods over Christmas.
I was thinking a simple style, like a static background with a sign that has the name of the mod, and a short description.
Below is an example of my thoughts.
https://cdn.discordapp.com/attachments/1001205761545875537/1053664197591957554/image.png
I'd like to ask if anyone has some inputs or ideas on what you actually look for in those little screenshots on the mod-page and previews in the mod lists?
keep in mind that the workshop preview needs to be 1:1
for me, it just needs to look nice
as long as it's not the default pie or looks like it was just grabbed off google images, my click is based on the title
Yeah, I suspect the pie is a big reason why my mods don't seem to get many new visitors. And then people don't do evolved recipes or know what they are much 😄
Does anyone know how to make a sprite read all sides and furniture positions?
I just put the first .pack image in the script and thought it would read the others, but it didn't work
Are you trying to make a pack or is this about in-game?
Trying to make furniture, a pack
I already made the pack actually, I just don't know how to make it work
I just put the first item from the pack in WorldObjectSprite and thought it would work, but apparently it wasn't that simple
you'll probably find more help in #mapping
did you specify the pack in in the mod.info?
No, sorry, I'm very new to these things 
I'll try there, thanks
this is SICKASFFUUUUU great tools for modders too
maybe you'll find some videos helpful then
https://pzwiki.net/wiki/New_Tiles
I'm having a really wierd issue. I've got a belt attachment point, hotbar slot, and it all works except the world model that i want to be visible on the player is on the floor not matter what I do. The first image is the location definition. the second is where it actually shows up. it should be approximately on the left hip. but nothing i change in the offset seems to make any difference, am I missing something?
to clarify, if i change the offset numbers it moves around, but its certainly not attatched to the hip like the bone says it should be
I'll watch, thank you so much
Maybe try attachment holster_left or attachment holster_right?
... for what purpose? to see how their attachment system works?
like what do you mean by "try" here?
Oh derp, I see what you're getting at.
This is in the item definition scripts for regular Holsters
Hi, does the "or" method work like this?
Hello. Anyone know of any events that I can use for when LuaNet is fully initialized?
Can't seem to find any, although the server's logs shows something that resembles events for LuaEvents.onInitAdd..
is there a way to explicitly set that a hotbar slot has a specific number?
it's not possible to allow people to create accounts on project zomboid that aren't whitelisted them go and just approve them onto the server is it?
each account has to manually be created?
BungeeCord for Project Zomboid when?
Does this look right to you?
JumperRift = ISPanel:derive("JumperRift")
function JumperRift:prerender()
self:setStencilRect(0, 0, 1920, 540); -- (x, y, width, height)
self:drawTextureScaledAspect(self.rift, 0, 0, 1920, 540,
1, 0, 0, 0);
self:clearStencilRect()
end
function JumperRift:new(x, y, width, height, rift)
local o = {}
o = ISPanel:new(x, y, width, height)
o.background = false;
o.backgroundColor = {r=0, g=0, b=0, a=0};
o.borderColor = {r=0, g=0, b=0, a=0};
o.rift = rift
return o
end
Jumper.prepareRifts = function()
local lightning = Texture.getSharedTexture("media/ui/lightning.png")
Jumper.rift = JumperRift:new(
0, 0, -- position
1920, 540, -- size
lightning -- texture
)
Jumper.rift:initialise()
Jumper.rift:addToUIManager()
end
Events.OnGameStart.Add(Jumper.prepareRifts)
(I call setVisible elsewhere)
Jumper.rift:setVisible(true) is not showing my image
It does show a background on the panel though if I don't set that false
Also Jumper.rift is existent from terminal and properly reports its intended visibility after calls to setVisible
So the object to some degree exists
But no texture
Original texture size 4k if that's relevant... I had it showing as an ISImage but that seems to have less flexibility.
What are you trying to clip to? You should set the width/height of your StencilRect to the clip area of your texture
Also if you're going for resolution width, you can do getScreenWidth() instead of 1920.
Edit: If you don't want your texture to stretch, you can render it at like 1920x1080, then use the stencil to clip it to 540
Your issue seems to be that you set the alpha of the texture to 0. Try the following:
self:drawTextureScaledAspect(self.rift, 0, 0, 1920, 540, 1); - removing the last 3 0's will treat the 1 as the alpha.
I am just attempting proof of concept. My plan is to have a function that adjusts the way the image is displayed OnTick. All I want right now is to show a cut-off / scaled version of my original image.
Ohhhhhhh I have it backwards crap thanks I bet that's it
Should I be using drawTextureScaled or drawTextureScaledAspect? @viral karma
Up to you, drawTextureScaled will stretch the image, where drawTextureScaledAspect will shrink the image to fit the given width/height - not stretch it.
Scaled can also shrink the image though?
I believe so, I'm not 100% sure on what each drawTexture variant does.
Okay... still haven't gotten anything to show but relaunching now
Tried reloading some functions in debug and that was not working so just doing a sanity test
Anyone know of any events that I can hook into regarding the initialization of LuaNet?
Currently rewrote prerender as
function JumperRift:prerender()
self:setStencilRect(0, 0, 1920, 540); -- (x, y, width, height)
self:drawTextureScaled(self.rift, 0, 0, 1920, 540, 1);
self:clearStencilRect()
end
So hoping this works since alpha clearly not 0.
Still borked...
JumperRift = ISPanel:derive("JumperRift")
function JumperRift:prerender()
self:setStencilRect(0, 0, 1920, 540); -- (x, y, width, height)
self:drawTextureScaled(self.rift, 0, 0, 1920, 540, 1);
self:clearStencilRect()
end
function JumperRift:new(x, y, width, height, rift)
local o = {}
o = ISPanel:new(x, y, width, height)
o.background = false;
o.backgroundColor = {r=0, g=0, b=0, a=0};
o.borderColor = {r=0, g=0, b=0, a=0};
o.rift = rift
return o
end
Jumper.prepareRifts = function()
local lightning = Texture.getSharedTexture("media/ui/lightning.png")
Jumper.rift = JumperRift:new(
0, 0, -- position
1920, 540, -- size
lightning -- texture
)
Jumper.rift:initialise()
Jumper.rift:addToUIManager()
end
Events.OnGameStart.Add(Jumper.prepareRifts)
😦
Seems like you need to use LuaNet.onInitAdd(...)
I can definitely set it visible and confirm panel is there... but no texture 😭
getSharedTexture doesn't seem to be a lua function. Try just getTexture?e
edit: or at least from a very quick search
Thanks. I found what I was looking for: OnGameTimeLoaded
Sure... I DID use getSharedTexture earlier and it did work, but I am open to getting texture any way that works in this context... How do I access getTexture exactly? Texture.getTexture("location")?
I'm sending my own sendClientCommand and needed to know when the game's ready.
(When I used getSharedTexture with ISImage (instead of trying to embed texture in an ISPanel), that worked.)
Still nada... also, confirmation that texture is loaded:
Correctly identifying my image size in bottom left
-- ***********************************************************************************************
-- OnGameTimeLoaded
-- called when the client udp engine is running and player properly initialised
-- ***********************************************************************************************
I did not give it that info (directly) @viral karma
Not very straightforward but a solution nonetheless.
Oh, I think I see.
Try:
function JumperRift:new(x, y, width, height, rift)
local o = {}
o = ISPanel:new(x, y, width, height)
setmetadata(o, self)
o.__index = self
o.background = false;
o.backgroundColor = {r=0, g=0, b=0, a=0};
o.borderColor = {r=0, g=0, b=0, a=0};
o.rift = rift
return o
end
Oh tryt that okay
Ohhhh I forgot the metadata and index lines you're saying
@viral karma Thanks SO much for spotting that... the actual lines I needed are:
setmetatable(o, self)
self.__index = self
But seeing the problem was 99% of the battle there, so thanks nonetheless.
Nice! I typed it up by memory, apologies for the misdirection. Glad it works now, happy modding!
Thanks again!
Looks like LuaNet is dated.
Lmao, yes, I've done it. I have created the cheapest animation in history.
I just sort of make my png shake and change opacities a lot lol
Yeah.. It would be convenient to have an event for when you are able to send client commands and they'll actually send. Writing a OnTickEvenPaused solution is very dirty.
What do you mean? Is there a context in which client commands get ignored during gameplay?
Sending sendClientCommand() when the client logs in does nothing for a period of time.
Delaying by 5 ticks per query with a self-removing tick-event function fixes this problem for me and that's fine... however.. there will be people in the future running into the same issue and probably will be very lost about why their client commands aren't firing.
local a = 5
local b = function()
if a >= 5 then
sendClientCommand('..','..',{})
a = 0
else
a = a + 1
end
end
local c = nil
c = function(d, e, f)
if d ~= '..' or e ~= '..' then return end
-- ..
Events.OnServerCommand.Remove(a)
Events.OnTickEvenPaused.Remove(c)
end
Events.OnServerCommand.Add(a)
Events.OnTickEvenPaused.Add(c)
This is what I do right now to avoid this problem.
Out of curiosity I searched for all TriggerEvents and came up with a list, might be useful in the future.
I'll probably put together a wiki page or something to document events, lua objects, etc
https://paste.sr.ht/~ckyb/912536a21571f9c16f741fa28ac0821afcd7b603
Very useful.
searched? you can just print them
grep -Rn "triggerEvent"
your list needs arguments
Updated with lua classes too
https://paste.sr.ht/~ckyb/912536a21571f9c16f741fa28ac0821afcd7b603
If you update the existing list, it will surely help some people.
If I had the time / task to do this, I'd go through and fully document all events.
I translated the wiki documentation for 41.65 events into PipeWrench's typings by hand.
Hopefully a solid list of events and documentation for them will bounce onto the PZWiki for the recent versions again.
done - https://paste.sr.ht/~ckyb/99d2d134360d355f33ceecf255b971f6b1d03624
They're not super descriptive, and could use more work, but I included the (linux) commands to generate the list
I see... odd, never tried sending a client command that soon.
is there an event that fires when you right click on a tile?
You can look at the media/lua/client/Context code for hints probably, fast way would probably be ISMenuElement.new (like in media/lua/client/Context/World/ISContextDisassemble.lua) to treat "createMenu" like a right click event. 🤷
There's already an event for tick even paused isn't there?
Sorry coming in late
Yes. I'm using that event as a means to get around the issue of no event firing that says that using sendClientCommand(..) is ready.
sendCientCommand doesn't fire if paused?
For a period of time when the game is fully loaded in, sendClientCommand(..) will not work.
I believe it might be a few ticks, however this is a problem in my situation.
Ah, I had a similar issue with OnPlauerUpdate or CreatePlayer
For a few ticks it refers to the object before loading
Caused a big headache
shared/utils/LuaNet.lua states that an event on the client fires right after the client -> server command is ready, but this is sadly not the case for the current version of the game.
This is my current solution.
Fires way before the game fully loads in, as well the command being useable.
OnGameStart fires slightly before.
Why should a player have to move for me to load something that has to load when the game starts?
It's something that needs to happen right as the command API is in a loaded state. 🙂
I agree, ofcourse
I might start up the community patch next weekish
Should have enough time
"API" reminded me lol
I left commissions open on Kofi and caught one unexpectedly, and work has been crazy with the holidays encroaching 😅
I kind of wish Kofi had an approval system -- they just gave me the cash instantly.
Oh wait.. so people use Kofi for commissions hunting?
I use a Discord Forums solution for a market place on my Discord server. Haven't shared that in around 4 months now which explains why it's been silent again.
What I'm having this issue with is actually something like a commission. 😛
Well lmao shrinking did not work bahahaha
I link it on my mods - they wanted an expansion of sorts for my shops mod - which itself was a commission.
Tried to shrink player model using Blender animation, legs rose into torso and that's about it.
It was supposed to be pretty straight forward, but I had to do a bunch of stuff for work
Like with that one mediation pose?
Makes sense. I can't do that for this workshop item because it won't work for anyone except the guy that asked for it.
What makes that the case? Just specific things?
I purposefully made a solution so that mods using it will break unless certain conditions are met.
Hmmm
Spent the past week creating a creative solution that violates no rules while providing a simple solution to a decades' long issue in the PZ community.
Of keeping mods as a server exclusive?
Yup.
Interesting idea
I'd ask for details, but it would probably be over my head and only help people circumvent it
Lmao not quite. In Blender I made an animation where character shrinks down to 10% of original size, tried to play it on the idle animation but the overall character did not shrink, although legs rose up as if perhaps the skeleton of the character was shrinking toward its center.
for my superb survivor mod the npcs wont show or even spawn? what do i do ping me with a response
they are invisible
but because clothes and skin and beard and such stayed the same size, it looked pretty borked.
The latter half would be true however if you did circumvent it, it puts you in a clear violation and DCMA opportunity so that's a win in my book.
I was considering disappear-and-reappear animation. Perhaps simply moving my character into the ground would work. Idk. Exploring options.
Also, you'd have to mod your client to do this which is also violating the EULA for PZ. 😄
A lot of fun things being violated there. Anyways.. People stealing commissioned works is disgusting.
I agree with that, they have no ethics
And now I have a solution that forces the book on people who try to get over it. 😄
I'd unfortunately never DCMA somebody, the process opens you up to be messed with by people who already could care less
obfuscate? that is a good way to force people to work their brains or at least give up doin
Puzzles and problems are fun to solve. That's why I like to play with improving security on code.
Have a good evening guys. Peace.
Anyone know what encoding I need for Polish translations?
Someone provided me the translation, but no matter how I save it, it always looks messed up in game (or missing the accents on characters)
windows 1250
paint. exe
notepad++ lets you mess with the encoding, it's a bit annoying though
it tends to not open files in the correct encoding, you have to go and change it manually...
uzyj utf8 meh
Thanks, I got it!
Yo I remember I saw somewhere something about how to fix this issue in sandbox setting you gotta delete some file so PZ re-creates it, anyone can remind me what was it?
Found it, it's options.ini in Zomboid folder
so question
if i wanted to change the ID for my mod, is there any way to do so and guarantee that it doesn't break things for existing servers and such that aren't prepared for the change? any way to force an update to the new mod ID?
not really... you can make the old mod id deactivate itself and activate the new one, but i don't know how that behaves on a server, probably not great
yeahhh, i feel like that wouldn't work for a server ...
i wish my brain wasn't so fixated on how badly i mangled the ID naming convention because honestly it's so ugly it's driving me insane but this is also something no one else really cares about and it would be stupid to risk damaging anyone's server to change it :(
i'll simply have to have more foresight next time
what's the situation, anyway?
so my mod is split into five packs contained under one workshop id, and they are named as such:
Mod ID: MusicfortheEndOP
Mod ID: MusicfortheEnd
Mod ID: MusicfortheEndExtended
Mod ID: MusicfortheEndHl
Mod ID: MusicfortheEndSH
you can see that Extended and Hl are the odd ducks, with HL not being properly capitalized and Extended being an entire word instead of what i would make it now, which is EX
yeah that's a pain...
i have a somewhat similar situation where a couple of my mods were made back when people were having issues with a character limit on the modlist for dedicated servers, so i made my modids as short as possible, and i'd now rather have them more readable
i'd much rather OccupationalClothing than OCCL, for example

i really wish PZ had some way of like
stop-gapping stuff like that
like, instead of deleting unknown items, it could just create placeholder items that retain the ID of the items it's trying to load
so that way, if you remove a mod that adds items, the items will remain in the game and if you add the mod back it'll load the appropriate item because the ID is still stored
it'd make updating mods a whole lot less risky :V
Anyone knows what causes PZ sandbox mod options to get royally fucked like this? From testing it appears to happen when you add quite a few mods. If it's a couple of mods, those sandbox pages work just fine.
it jamms all non-boolean fields together
are multiple mods adding to the same page?
no
it's singular sandbox-options.txt
I mean, maybe on some other pages
But this one is 1 file
Same as others that get jammed
And they are all big sandbox options files that you can scroll through
Aka a lot of options
But then again they work just fine when modlist is not like 100 mods
Mom I just want a game that works as it's supposed to 