#mod_development
1 messages Β· Page 60 of 1
Yeah, farming / trapping systems use global objects too.
cool, I think this will give me a bit more reference material
Anyone know if the errors in F11 stop being recorded? Either at a certain total or if the same error stops appearing if it repeats multiple times?
@sour island I'm not sure but you could add an OnTick event that just prints "TICK # [ticks]" and then intentionally throws an exception, and check console.txt to see if the number beside TICK # ever stops going up
That's true, I actually do have something to force exceptions I just never noticed if the counting stopped on errorMag
I would assume so - I was just curious if it was a hard set thing so I can account for it
I know the java file, I'll have to take a look later
KahluaThread if I recall
m_errors field
So I wrongfully assumed getConnectedPlayers() would give me an ArrayList of the connected players at the server side. Can anyone shed any light on how I might accurately get a list of the current players at the server end?
What does connectedPlayers give you?
I'm checking :size (and also attempting to iterate), but when I am connected (only player on dedicated server) it gives 0
--Get Players
local players = getConnectedPlayers();
print("player size is " .. players:size());
Is the code running from /client or /server in the Lua directory?
/server and event is definitely running on server (using EveryHours now just as a backstop) - i get the trace into my server's output.
Connected might be co-op then, is there a getOnlinePlayers?
Aha, taking a look
(Also, if anyone has any ideas on which events are like OnConnect / OnDisconnected but for the server side, this would be useful, as I can't seem to find them!)
I'm not making models either. Max I will do are some icons and textures.
Definitely looks like getOnlinePlayers is the way, rewritten and rebooting my server now
Fair enough, I was hoping I could rotate them via script but I think the issue is beyond me.
What is the goal of your mod exactly? @fast galleon
It always felt weird I couldn't put dirt into a bucket for farming on roof. But this seems fun and if possible I would like to expand this for more items and maybe unlock more features for other items.
@sour island
Yep, getOnlinePlayers() did the trick, thank you
Ah that's a good idea. I kind of wish things worked more loosely for containers and such.
Anyone know if there is a way to effectively stop an inventory container from showing the items inside? I am working on a mod that would add sealable envelopes/boxes that you have to open/close
Does the True music mod have California Girls?
Yeah, I imagine an old lady using her bag to smack zombies something that should be possible.
That's what I started vanilla wep expanded to try and do
Unfortunately weapons are very rigid
true
And I personally don't like the convert option
One thing I wish the devs would do is refactor items to be under one object type and just have an array of behavior objects to refer to
Sort of how clothing can be worn and bags at the same time
I'd like to be able to also store liquids or use it as a weapon
If youβd make it as an InventoryItem and then remove the tooltip which shows the items inside it should do the trick, right?
Is locking a gun case or briefcase possible?
You know about ComboItems, right?
Vanilla no, but probably could be done with modData
For recipes?
No like, as an item type
What is it
Instead of the limitations of other item types, it inherits all other item definitions
Javadoc Project Zomboid Modding API declaration: package: zombie.inventory.types, class: ComboItem
so you can give it anything that is defined for items, afaik
Is it used anywhere in vanilla?
Would the type just be = combo item?
Big deal if this would let me do all kinds of hijinks but chances are there's a lot of Lua and Java that are hard typed
nice, do you have a functioning example
I am not quite sure, tbh. I havent messed with it myself yet. Though- It is written as one of the .class java files for types of items
Are you able to advanced find the term "comboItem" in the scripts directory?
I'd be curious if it's used at all - seems like something they should just transition to using across the board - although having connected objects like containers would be a bit better for reading/expandability
Good afternoon.
I'd guess the reason that the items have the current type categorization is for the sake of simplification, so the code doesnt have to check all the different variables unless specified. Otherwise all items would probably have to check all the applicable variabes
Oh nice. I forgot that I saw that the other day.
Was rooting for this to be a thing since the last official documentation was from 2015.
Going to write a docs scrapper and bake that into TypeScript definitions when I get the chance.
Oh wait I thought your URL was to the official one for I think 41.77?
package index
I wonder what made TIS decide to update it. Last I heard this was not going to happen until PZ officially releases fully.
It is? Or at least, itβs the one I regularly use.
Is it possible to gain a trait when a book is read? I know books can grant skills...
zomboid-javadoc.com is a third-party generated docs which does not contain comments and documentation written by the devs themselves.
Ohhhh ok, gotcha
Dev comments on code are valuable when modding with an API so yeah.
declaration: package: zombie.inventory.types, class: ComboItem
Here it is on the main one then
Yeah, I would suggest variables or an array housing objects to control additional behaviors
@thick karma It 100% is, soul filchers reading time does it
Mmmmm interesting
I'll grab it
Wait
Before you do that
There is magazines in game that do it too, iirc. The how to use generators mag and the herbalists
Mmmmm
yeah, the official doc is now up to date and includes things like parameter names, much more useful imo
@winter thunder I see
item ElectronicsMag4
{
DisplayCategory = SkillBook,
Weight = 0.1,
Type = Literature,
DisplayName = How to Use Generators,
Icon = MagazineElectronics02,
TeachedRecipes = Generator,
ReplaceOnUse = ElectronicsMag4,
StaticModel = Magazine,
WorldStaticModel = MagazineElec4Ground,
}
But I don't see how this item def would grant a trait...
This is going to be so insanely useful for PipeWrench. π
I imagine you're going to have to decorate ISReadABook to added traits in the same locations it checks to add recipes.
I was writing a third-party documentation tool for getting around this issue prior to this release.
what is pipewrench btw? Have seen that mentioned before
It's a PZ modding environment using TypeScript.
Apparently it's having some issues for people atm so I'm looking at it atm.
ah, gotcha. Do you know if it still works? Bc that looks really interesting
People are using it yeah. The typings compile automagically however it seems that some versioning for each npm project has fallen out of sync so there's some issues with lua-lib stuff.
I'm the author of it and have been absent for a few months and just got back.
Interesting idea, thanks, will definitely consider this if necessary.
PipeWrench basically reflects on the core of the game (The Java API) and transpiles it deeply to Typescript typings. The Lua API is also transpiled and then combined with the Java API for a clean Typescript environment.
I wrote the transpilers in-house.
Oh and you can use PipeWrench to look at API changes in the game like this: https://github.com/asledgehammer/PipeWrench/commit/b2d5852b62a6b02dce26a3414a913bc3e409243a
Cool. Yes, I'm already using his sound effects π
Is there an event for when a player enters the world, as in loads into a multiplayer server or a singleplayer game?
He said he had made some new ones. I just figured I would let you know just in case you wanted to contact them.
I'm not sure. If you want to execute Lua code for this on the server-side, you could make a mod that sends a client command to the server from the client logging in.
These are from 41.65
Hope that helps.
yes
So, let me get some things straight
look at my safe login mod
scripts in the "client" folder are run client or player-side, whereas scripts in the "server" folder are run server or world-side?
Link to code?
The client loads all three IIRC. The server does not run the client folder.
Ah, so OnGameStart?
OnGameStart for client-side IIRC.
Yea, do want ti client side, and don't want variables to interfere between players...
I may have overthought my approach
The server side for the Lua codebase is different since the re-release of multiplayer for Build 41.
@tardy wren Store those variables on the server side and check it there. You could put what doesn't have to be on the server on the client-side to execute.
My mod is mostly client side, yes
Anyone happen to have the command for adding a trait to an existing player handy?
But I am preparing it with Multiplayer compatibility in mind
No GitHub? π
Looking at the code that way is convenient.
lol for the next modder maybe π
someone would have to pay me to take that extra time on my mods
Otherwise pull em and read em lol
For sure. Hosting your code on GitHub adds to your portfolio. It might make money for you in the future. You never know.
nobody seemed impressed by me making mods for a game
One could dream of making money of modding pz
Literally btdt. π
Was running a market for PZ commissions earlier this year and made a few hundred on the side.
Sometimes people want a few extra things and give a kofi or two for it. Even in PZ.
Personally I'd like to see people who enjoy modding games like this who have experience make something out of it, if even for a few bucks.
my mental health is too poor to keep up with uploading it
i have github and old copies of my older mods on there
I'd like to see an official TIS market for modders here but I get why they wouldn't.
I shouldn't advertise the server I'm on but
Hmmm is it player:getTraits():add(TraitName)?
Could it be so simple?
hard times atm. will try to get the rest on github when i can
That's what DMs are for. π
Something like that yes
getPlayer():getTraits():remove("SpeedDemon");Β getPlayer():getTraits():add("SpeedDemon");
Yep this does it
Ty @bronze yoke @ancient grail
So for future reference in case anybody is wondering, apparently its not as complex as initially thought. One simple way to prevent players from avoiding a forced timed action is by setting a bool in the moddata to true before the action begins, and then to false when the action ends. If the player logs in while the bool is true, it means there was a forced timed action that wasn't completed, so you can use that check to force it again
Same fix for things like making sure there's no infinite or multiple firings of some execution of code in an async environment. π
I remember there was a hair mod tutorial on how to make one, just not sure how to find it again. Can anyone link it to me if it exists?
And the player will do the action automatically once they connect?
Works with mods time actions too?
no, he just meant it was a way of tracking it
you could write it that way yourself pretty easily though
just check their moddata oncreateplayer and make them do the action if it's been set
If you code it, yea. The way I did it was like
if (player:HasTrait("Volatile") and BreakIntoTears.currentlyCrying == false) then
print("RUNNING THE CODE") -- FOR DEBUGGING. MAKE SURE TO DISABLE WHEN PUBLISHING
local currentUnhappyness = player:getBodyDamage():getUnhappynessLevel()
local currentStress = player:getStats():getStress()
if player:getModData().breakIntoTears_storedRoll then --breakIntoYears_storedRoll is what I use as a bool to check if the player started crying but didn't finish crying
ISTimedActionQueue.add(BreakIntoTears_ForcedTimedAction:new(player, currentUnhappyness, currentStress))
else
--Run the rest of the code normally```
You can use that in onCreatePlayer like mentioned by albion, or whatever event fit for your mod
Bingo
Yogi.oldUpdateReadingBook = ISReadABook.update
function ISReadABook:update()
if self.item:getName() == "Carpentry Vol. 1" then
if not self.character:HasTrait("Yogi") then
self.character:getTraits():add("Yogi")
Yogi.loadModData(self.character:getPlayerNum(), self.character)
end
end
Yogi.oldUpdateReadingBook(self)
end
Now to create my own item... Oof.
β€οΈ @vast nacelle
What is typical pricing for something like that? Iβve been curious myself tbh
There's really no typical pricing because there's no active marketplace. It's all up to the person posting the commission work.
I've had a couple others besides myself do comms and they made IIRC 20-40 USD for works.
Someone could ask for a simple fix for a mod for 10-15 USD maybe. Maybe someone seriously making a big mod needs help with 3D models and may ask for more.
How complicated of mods? Since as someone considering doing something similar, that sounds like crazy pricing imho π
βDeathβ π₯
mango back π€
i never charged any mount for my commissions and always let people pay what they thought was fair
π
π to you too
yeah, everyone i've worked with has given me a fair price so i've never really thought about it
That makes sense! Appreciate the perspectives
I mean.. it's ultimately up to the negotiation of the price, even if you give one first.
i now work in performance and the people who hired were impressed by the methodology i used to profile zomboid
From what Iβve seen, the majority of people who want a specific mod either want something really simple (ie some new recipes or a basic tweak) or really really complex/impossible lmfao
I forgot you did that. @round stump did this with RakNet for PZ.
The last one I did was for radial menus for a client. I bought a cheap controller and modded it... then returned the controller lol.
Me thinks that people are looking for tweaks like adding radial menus to popular mods not implementing it yet.
The one I did was for a gun actions mod.
Hey are you versed in blender lol. I know you have helped me before with the my scripting issues . but ya boy dying over here lol.
Would it be viable to turn wallets into miniature containers
Whatcha workin on? .. wait i think i remember.... Was it carry the cardboard box thing?
yeah, there's a few mods that already do this
Then put an ak .inside it
Yes, it wouldnt be hard. You can also set the item to only hold specific items using the AcceptItemFunction
Sweet, thinking about setting up an economy on my server.
my expansion for projectrp makes wallets containers for documents
that sort of thing is super simple to set up in lua
Might also remove 'money' as an item and replace with with coins and cash.
haha how'd ya guess lol. Yeah skizot is helping in modeling atm so i might be okay for now lol
More variety!
Then all I gotta do is figure out how to set up an ATM system and we're set.
you might want to use better money system then
it's pretty much everything you're looking for
Huh, that works then.
There are ATM tiles in the base game now, they would need new properties- but you could likely make them functional
Ye problem with money being items is that when u spawned alot of em at the same time. It will lagg preeeetty baaaad
I'm thinking what people could do is like, as long as the tile is powered, they could deposit / take out money so long as they have some associated with their player.
Then you could also use Credit Cards before the power goes out to get extra cash.
there's no power limitation, you might want to patch that in yourself
but better money system does sound like almost exactly what you're looking for
Ye thats exatly what the mod does
Sweet. Less work for me.
Theres even a transfer money to soomeone else. Like a wire transfer thing.
But im not sure if its available even if the player is offline tho
Just found an old pz archive of mine for modding π
Some build 30-31 stuff in there too.
how do you make two traits mutually exclusive?
setExclusive or something on the Trait object
TraitFactory.setMutualExclusive("SpeedDemon", "SundayDriver");
SetExclusive seems to be a costume related thing
Thanks tho!
Okaaaay another question. Is it possible to have a timed action while the player is still in control of his character (i.e. can still move while there is a timed action, without necessarily cancelling it out when moving)
Y'all reckon I should make a mod that makes some tools less "hard coded" to instead use tags
That'd be all the mod does, just afraid to add it in combo with the mod I actually need it for in fear of incompats and lack of adoption
it's a good idea until the game updates and makes your API not compatible with latest updates, and in turn affecting all dependant mod
I trust an idea like this would be good in case you can regularly maintain it or to just wait until the game is finally out of Early Access
I mean, I can't imagine it'd be horrible to maintain.
Literally just changing item :getType() == to a item:getTags()contains() sort of deal lol
Would allow people to make snazzy wrench multitools, like me!1
Plus aren't they not supposed to be modifying anything major until B42 where a majority of mods will probably break anyways
There's a money system? For my shop I just used money items and prescribed values + allowed players to split stacks into new ones
kinda doing that now, in a month or two it will break with update, lol
Ah
I have added compost and dirt support. I kinda skipped gravel though.
If you use doParam it shouldn't break - but would be redundant
I'm talking more about stuff like mechanics which hard-requires the wrench to my knowledge.
You could even make a system that adds the tag only if the item doesn't have it already
I can doParam to give the wrench a tag, but the system doesn't support tags iirc
(Mechanics I mean)
There's alot of vehicle Lua with lingering non-tag checks
A farming rework would most definitely break my changes
your constructor should have a bunch of o.stoponwalk stuff already
just set it to false
i forget exactly if that's in :new() or :start() or something
You reckon it'd be worth the time converting it over and publishing it as a mod people can require / check for?
then we'd have to worry about load order and stuff
I was apart of a community API project that might still become a community patch instead + releases of separate APIs
I still think a community patch for the Lua would be a nice thing to have given it's maintained with QoL / fixing in mind
Would be similar to how translations are handled
a lot of the vehicle stuff could benefit from it, on top of the non-tag checks a lot of it just isn't really able to be changed without overwriting the function
The overwrite is what I'm mostly worried about
I'm in to help. I have years of Lua experience
I have seen some jank hacks looking at other mods. I think a community library to improve the API would be very welcome by lots of people
Check out smoke cigarettes isnt it like that? Or drinking iguess
The only issue is adoption of such an API.
Sure, some people would accept it in a heartbeat, but others may choose to leave it out to minimize their mods.
It's less a necessity and more a really nice thing for modders.
if we leave guidance to always put it at the very start of your load order, it might be okay?
I'm mostly worried about incompatabilities with the wide number of vehicle mods that may choose not to adopt it because of their own systems.
Like if it's top of load order, it could probably work fine just for tag checks.
But anything more than that and we risk a lot.
its added at the :new
function ISAddCoalInFurnace:new(furnace, coal, character)
o.stopOnWalk = true;
o.stopOnRun = true;
end```
didn't know these existed
hmm can't believe I couldn't think of smoking to check out its way lol
thanks though!
I can set up a workshop page - idk if @thin hornet is very active but im sure they'd not mind if we put something together.
We have a steam acc with a copy of PZ and no 2FA - which allows us to push from GitHub as a group
Where as workshop requires 1 guy to handle uploads
Konijima is no longer active. Last time we spoke he mentioned something about gtaV
Oh yeah seems like he did based on his discord sever
well, its not hard, lets just say that PZ is not very well though out when it comes to RakNet, is poorly used and with a few changes could improve reliability and performance
Couple of questions with addSound
addSound(self.character, self.character:getX(), self.character:getY(), self.character:getZ(), 40, 40)```
1- Do both 40s represent range in terms of cells?
2- So apprently, I am getting X and Y and Z, using only two 40s, does that mean the sound is being added only for both X and Y and not for Z? In that case, Should I remove the Z?
the first is intensity and second is total range
i recall it being the other way around
you're right
this.radius = var5;
this.volume = var6;
volume would matter for indoor cases I imagine
hmm there's a stress mod param
neat
An idea why I am getting an error when I use this code?
function BreakIntoTears.CheckVolatileTrait(player)
if player:HasTrait("Volatile") then
print("PLAYER HAS VOLATILE TRAIT")
Events.EveryDays.Add(BreakIntoTears.EveryDays)
else
print("PLAYER NO HAVE VOLATILE TRAIT")
end
end
Events.OnCreatePlayer.Add(BreakIntoTears.CheckVolatileTrait)```
Error is at ``player:HasTrait("Volatile")``, ``Object tried to call nil in CheckVolatileTrait``
Thanks!
.. nowhere? Its weird considering it worked before like that. Like literally yd, only with another piece of code
nowhere?
I assume I need to use getSpecificPlayer on the player?
i mean the player being passed into the function
oh!
i didn't see the event
oncreateplayer passes a playernum and then a player object
oo i see
something similar to watch out for is the context menu events also pass a playernum, and the wiki incorrectly claims it passes an object
i sent a pull request but it seems to have been overlooked π
Hi, I'm trying to determine if the mouse is over a UI element in-game.
|- Window
|- Panel
|- Child
I want to do something if Child is hovered over but I can't seem to detect the mouse over? the isMouseOver() method always returns false and using containsPoint with getMouse*() also doesn't work? is it some kind of nesting problem?
Thanks
hmm which wiki btw?
i'm planning to write an event guide, as the wiki can be a bit too vague in places, and it's becoming outdated
is it possible to modify a specific instance of an item's tags without changing the tags for the rest of them?
i suppose b41 is over, so it won't become any more outdated, but it's already outdated
it's not, tags don't exist on the instance of the item
(getTags() just grabs them from the script)
Didn't even know this existed. That'd be a huge help -- assuming it gets updated
darn
let's hope they see my pull request some day then
the event pages are built automatically by some script, which means you can't just edit the pages
Speaking of events, do you know what inputs are used with "OnPlayerGetDamage"?
I believe it was added recently and I'd like to use it but like you said, that Events page is out of date.
i wrote everything i know here
Thank you very much
So I'm checking out this tutorial on adding items on YouTube, and dudebro is manually cutting down original distributionTable in Distributions.lua to leave only the sections where he wants his item to spawn... Do I really need to do it this way if I only want an item to spawn in a small handful of places? Can I not I just add things to sections of ProceduralDistributions.list, e.g.
table.insert(ProceduralDistributions.list["LivingRoomShelf"].items, "MasteringYoga.Book");
table.insert(ProceduralDistributions.list["LivingRoomShelf"].items, 50);
and see my item in-game?
yeah you can just do that
Should I do this server-side?
yeah
Got it, thanks... and afayk this is all I would need to make it appear on living room bookshelfs? Item definition for context:
Any way to not stop timed action when attacking? :x
already got
o.stopOnWalk = false;
o.stopOnRun = false;
o.stopOnAim = false;
Wondering if there's sth similar for attacking
attacking is it's own timed action afaik
or a player state that supercedes timed actions
Okay I fixed it.
I was trying this to detect the mouse over in child's onMouseMove
child:containsPoint(panel:getMouseX(),panel:getMouseY())
but idk why I did that bc obviously the coords are misaligned being relative so the solution was to just use Panel so they're in the same coord space
panel:containsPoint(panel:getMouseX(),panel:getMouseY())
at that point, is there a reason to use timed actions?
The fact that I can control easily what happens after, during, before the timed action makes it easier to use it
Simply letting the player cry while moving/doing stuff
that's true, that's appealing
but not letting him cancel it
unfortunately i don't see anything relevant in the doc
you could make :stop() not actually trigger the java function, if that doesn't cause trouble
hmm don't think it should
oki another thing
function BreakIntoTears.EveryDaysCrybaby()
Events.OnPlayerUpdate.Remove(BreakIntoTears.CrybabyCryCheck)
Events.OnPlayerUpdate.Add(BreakIntoTears.CrybabyCryCheck)
end
function BreakIntoTears.CheckCrybabyTrait(player)
local playerObj = getSpecificPlayer(player)
if playerObj:HasTrait("Crybaby") then
Events.EveryDays.Add(BreakIntoTears.EveryDaysCrybaby)
end
end
Events.OnCreatePlayer.Add(BreakIntoTears.CheckCrybabyTrait);```
So what this basically does (obviously), is when player spawns, checks if he has trait. If so, it adds the event to everydays, which adds the OnPlayerUpdate
the current problem is, it only starts from the next day, and not immediately. What'd be the most optimal way to fix that
Also this works apparently, ty!
It cancels out the timed action when you attack, but then it starts the timed action immediately again when you are done with the attacking animation
small nitpick while i think about that:
function BreakIntoTears.CheckCrybabyTrait(_playerNum, playerObj)
is more performant than
function BreakIntoTears.CheckCrybabyTrait(player)
local playerObj = getSpecificPlayer(player)
not that it matters but it's also a little prettier i think
what does the _ do?
nothing, but it's often used to mark an unused parameter
gotcha, just changed it, thanks!
maybe you'd have to use mod data after all... if they haven't cried yet, oncreateplayer add the playerupdate event as well as the everydays event, and reset the moddata every day
I think I'll give it a break for now and try out this solution tomorrow considering my brain is a wreck right now lol. Hopefully I'll be done with it tomorrow. Big thanks for the help today!
Making these changes, apparently removed items reappear later in containers
of course ^_^
Sigh, I do not understand the bare minimum requirements of adding an item. It simply won't appear in the list of items I can spawn. And every damn mod seems to do it a little differently... I don't see any mention of "Distribution" anywhere in Skill Recovery Journal, yet it's clearly being distributed.
I am trying to keep things as simple as humanly possible for testing and failing miserably
MasteringYoga-Items.txt:
module MasteringYoga
{
imports
{
Base
}
item Book
{
DisplayCategory = Literature,
Weight = 0.5,
Type = Literature,
DisplayName = Mastering Yoga,
DisappearOnUse = FALSE,
Icon = Book,
StaticModel = Book,
WorldStaticModel = BookClosedGround,
}
}
MasteringYoga-Distributions.lua:
table.insert(ProceduralDistributions.list["LivingRoomShelf"].items, "MasteringYoga.Book");
table.insert(ProceduralDistributions.list["LivingRoomShelf"].items, 50);
If anyone can help me understand what step of this process I'm missing, β€οΈ
I am officially stuck and taking a break so feel free to chime in whenever.
I'm so dumb, OnMouseMove is only called on an element when the mouse moves over it...π€‘
@hollow current Have you had a look at the "read while walking" mod? It's presumably doing something akin to a time action (reading the book) but allows the player to walk around.
Although since the timed action queue is a, well, queue, it has the problem that you can't start another timed action until you finish the current one. So if you were using a timed action to have the player cry, and even if they could walk around, they wouldn't be able to do anything else that involved a timed action...
any idea how to fix/what causes this?
well that shouldn't be a problem since the crying timed action takes about 15 seconds only
Can you show your mod.info?
Are you a contributor or owner of the mod?
Is it a new mod or are you updating it?
new mod
like....?
where did you get the ID from?
leave it blank
was that a bad idea
sth like id=TrueMusicAddonSafehouse
workshop ID is assigned by the workshop
if its blank is invalid
don't leave it blank
the ID which is an integer is assigned randomly by the workshop
you need to input a string ID when uploading for the first time
That's mod.info
actually you need to keep it the same when you also update, not only the first time
so my mod.info looks like
name=Everything Has a Name
poster=poster.png
id=EverythingHasAName
description=A mod to rename anything```
and I keep it always the same
id can be anything you want, just keep it relevant to the mod
and make sure its not used before
changing the ID in the workshop.txt fixed it
it's now given me the option to upload
i'll report back if anything goes wrong
but in the meantime thanks guys
At this point, I have a mod which requires the base Bow and Arrow mod and makes these changes:
- The player can hold the attack button to draw the bow, release to fire (it uses whatever attack button they have mapped, not hard coded to the mouse button like the original AD mod).
- Plays AD's custom sounds for drawing the bow, firing the bow, dry-firing the bow, hitting a zombie in the body, hitting a zombie in the head.
- Dry-firing the bow damages it.
- (Different from AD) The draw-time decreases as your Archery skill increases. Original AD had a fixed 30 ticks to draw, this version currently takes (40 - 3*archery skill) ticks to draw.
- (Different from AD) The "drawing the bow" sound stops when the draw time is reached, so there's an audio cue that you're ready to fire.
One thing that's missing is the fact that the bowstring doesn't show its condition, so if you damage your bow by dry-firing it and then unstring it, you can't tell which is the damaged bowstring.
That all sounds really good. I like it
so for multiplayer, i uploaded the mod but it's only giving me the option to upload to mods section and not steam workshop
I could try to override the tooltip code, but it turns out that the feature of the bowstring getting all the damage when you unstring the bow is actually implemented in the base mod. The base mod's tooltip code shows the condition on the MandelaBowString, but not the new MandelaBowString2 it's now using. So I've asked Gluten the Sensitive if they can update the base mod's tooltip code, since it seems like not showing it is an oversight.
where is your mod currently? its directory
in /workshop and /mods in the pz folder
I am not sure if its any different, but placing my mods like this works: C:\Users\{YOUR USERNAME}\Zomboid\Workshop\Everything Has a Name
overall directory should look sth like
C:
βββ Users
βββ {YOUR USERNAME}
βββ Zomboid
βββ Workshop
βββ Everything has a Name
βββ Contents
β βββ mods
β βββ Everything Has a Name
β βββ media
β β βββ lua
β β βββ other stuff
β βββ mod.info
β βββ poster.png
βββ preview.png
βββ workshop.txt```
Argh. I had thought the new OnPlayerGetDamage event would finally let me know when a zombie hits a player but yet again for some reason the actual zombie hit is excluded just like on OnWeaponHitCharacter.
I get event procs for the subsequent bleeding damage but not the initial hit.
Like why would you broadcast events for every type of damage except damage from a zombie in a game about fighting zombies?
can't find how to get damage from zombies but there is player:getSurroundingAttackingZombies()
which returns the number of zombies currently attacking you (i.e. attempting to bite/scratch/etc)
π€ I wonder if that works while the player is in a vehicle
are you sure your file is even being read? looks perfect to me
the only thing i can think of is it's in a bad directory or something...
Well, the Skill Recovery Journal isn't being distributed so that's why it doesn't have any calls to insert it into the Distributions. That's for adding natural loot spawns. The only way to obtain the journal is to craft it.
what items can be locked with a combination lock?
Apparently my brain refuses to sleep until I finish the last bit I got to do lool
Is there an event that triggers when player wakes up?
I mean I am not sure... But the items.txt is in media/scripts and the distribution.lua is in media/lua/server/items... Do those locations seem right? Is there more I have to do to make sure the file is read, aside from put it in the right place and add the mod to my server?
that seems correct
Oof. Well thanks for looking.... I'll bang my head against a wall more tomorrow.
I tried to follow the steps right π clearly something small I don't understand is off
Hey guys, currently working with some traits, and I'm wondering if there's a way to set the XP modifier to less than 75%
Oh that would make sense... Fair enough... I'll try to find a very simple mod that adds only a small handful of consumable items tomorrow and see what they did
@thick karma Maybe it's the "DisappearOnUse = False," property? The only items that use that are radios and flashlights. It might be causing the game to not consider it a book or something. The Skill Journal does have that property but it isn't used like a normal book so it might not matter for it. The base game books all use "ReplaceOnUse = Base.[bookname]," instead.
... Though that shouldn't prevent it from being added to the item list and be debugged in...
Non only containers can be locked with combination locks and padlocks
I believe I actually added that after it was already failing so I don't think that's it, but I'll try it tomorrow just in case.
Download other mods that tampers with the exps and do your own version
I've looked at some others, but it seems that traits are just limited to 75% gains and cant get any lower anymore..
you'd have to alter xp manually to do that
not sure how viable that is, if even possible
I think the transmit remove item only works with tiles?
item:getContainer():DoRemoveItem(item);
end
functionΒ ISRemoveItemTool.removeItems(items,Β player)
Β Β Β Β forΒ i,Β itemΒ inΒ ipairs(items)Β do
Β Β Β Β Β Β Β Β ISRemoveItemTool.removeItem(item,Β player)
Β Β Β Β end
end
Heres a snippet that might be useful
Reason for this is cuz disappear on use is actually made for drainables
And radios are drainables but it uses battery
And if u notice theres a destroy too
Its also for drainables
is there a way to make a recipe have a result of nothing?
But i could be wrong and it can be used by other types too
RemoveResultItem:true,
thanks!
Think the number is cuz thats the unique thing thats given by steam. And the named one can be duplicate. As we can observer when u type mod template there are countless mod templates you can subscribe to π€ͺ
hi everyone, i wrote a hook reference, with a basic explanation of what they are, what hooks there are, what they do and what parameters they pass
https://github.com/demiurgeQuantified/PZ-events-guide/blob/main/Hooks.md
if i'm being honest writing this guide made me realise how useless they are... but here it is anyway!
Does getting false reported/downvoted on a steam workshop move the comments just to a tab section or can a game dev/steam employee do that?
I guess hooks have two uses
- allow you to completely replace the behaviour of a few things. Difficult because you would have to reimplement it from scratch
- temporarily block something from happening (then removing the hook when you want it to work normally again)
not completely useless but less versatile than an event. The calculate stats one seems to be the only one you'd likely do option 1 with
yeah that was my thoughts
the annoying thing is that the hook applies to all objects, which means you can't override a feature for one player only, which means anything using the second option doesn't work in splitscreen
all seven splitscreen players must be disheartened to hear this
are all of these server side? I would have thought the stats and drinking ones would have been client
they're all clientside as far as i know, but splitscreen players are all the same client
of course, splitscreen players are screwed eitherway, ya
the Attack hook at least has some practicality, as vanilla already uses that hook
initially we thought the return value of a hook dictated whether it would override the original or not, which would have been far more practical...
that would have been nice, ya. Essentially an "isCanceled" boolean, like in minecraft forge events
I imagine its pretty tricky to make cancellable events work when your code crosses sides between two languages, unless you make everything a callback which would probably lead to some pretty weird behaviour
yeah, when i was under that impression i was also very curious about tiebreakers
you mean like if there were multiple hooks returning different values?
i can't think of a perfect solution - i probably would have made it override as long as at least one hook wanted it
generally if you told your hook not to override it probably would mean you don't want to do anything special, not that you specifically want the vanilla code to run
Really depends on what the hook is doing, there is always still a chance of conflicts if the hooks do anything besides altering the statistics of whatever is happening. And even then order would matter so you'd need a priority system
modding is really messy, lol
it's funny that the only practical hook is only practical because it behaves exactly like an event
although that one would have been the least obnoxious to reimplement anyway, the only code it replaces is a single public function call, so that one was actually a useful hook before it became vanilla
huh?
Hi. I am just starting out with modding, and i wanted to clarify something. I currently have my own mod on the workshop, and I would like to make it compatible with other similar mods. Of cause making it compatible would require me to use items from their mod, and i dont want to use parts of someones mod without asking first. My question, is what is the best way of asking for permission to do this? Is their some proper way of talking to mod devs to get their permission? I dont want to message someone out of the blue on steam or discord, or is that okay? I am sorry for the stupid question, I just wanna be polite
That seems like a reasonable question to me π I don't know the answer though. Asking here seems like it would work if the modder hangs out here. Leaving a message on the mod page's comments section might also work.
Ike rob says if you spot their name here it is your best bet but you could also try contacting them via steam. If that doesn't work or you get no response I would say just do what you gotta do but be sure to credit them and if they ask you to remove it later down the line to respect that. There are tons of reuploads and edits of other people's mods on the workshop so I don't think it's a big deal.
Thanks for the heads up! Ill see if i can find them here them
Can you be more specific about what your mod is, and how you want to use items from other mods?
Oh Sure! Its just a small firearms mod, that I made because I liked them. I want to get it to integrate properly with VFE/B41 Firearms. So for example allowing their repair items to repair the firearms when the submod is included, or to modify my guns to use their ammo when we have the same ammo available, for example my BAR in .30-06, and B41's Garand also in .30-06, so i just want it to use the correct ammo.
If your mod needs something from someone else's mod what you can also do is make that mod a required dependent for yours. It's probably a better option than taking their work.
Its more compatability stuff, then requiring anything
Yeah, if you're just allowing your guns to use their ammo, or using their parts in some of your recipes, I think you're pretty good to just go ahead.
Yea that sounds like it wouldn't be an issue. I see other big mods do stuff like that all the time.
Doesn't hurt to ask/let the author know about your mod, but you're not redistributing their work or anything.
More traits is one that comes to mind. It has options to make it compatible with other trait mods. But yea it wouldn't hurt to try and get in contact with them
Cool! Will do. Now i only gotta find the mod devs, which is the hard part lol
Might just be easiest to add them on steam or dm them if their DMS are open.
You can also use the Discord search to see if anyone here has the name they have on their Steam workshop page, but there's no guarantee they'll be the same person.
thank you both! I have many more questions for in the future, particularly around recipes and Lau (god i wish i this was in C#), but thats for a later date. This has been a massive help to me, i wanted to do this but had no idea about how to go ahead with it
Good luck! π
transmitting from floor works, as does removing it from within the player's inventory -- what's happening is that the money reappears after an in-game hour if the person deposits it from a container.
So I tried looking at how transferring items works in the lua and only found differences in removing from floor
I might just set a container on 0,0 and transfer the money there π€
Wait we. Need to be .kre specific first
Cuz you could be saying a whole diffrent thing and we are o
Interpreting it the wrong way too
So what is your mod and give an example of other peoples mod
And definr what is compatible
Have you tried the render ditry true
Need to look for the proper syntax tho
I noticed that too - but I assumed it dealt with rendering the UI or something
oh wow - setDrawDirty is used is so many places
hmm it just ends to this though:
if self.inventory:isDrawDirty() then
self:refreshContainer()
end
I can add it just in case but I don't know it will solve the issue
Yeah its a wonderful mysterious thing that make things happen
doesn't that just redraw the ui?
Sure!
Oh Sure! Its just a small firearms mod, that I made because I liked them. I want to get it to integrate properly with VFE/B41 Firearms. So for example allowing their repair items to repair the firearms when the submod is included, or to modify my guns to use their ammo when we have the same ammo available, for example my BAR in .30-06, and B41's Garand also in .30-06, so i just want it to use the correct ammo.
I just copied this from my orignial message on the topic
Ah just require the mod thats all
Not entirely. It allows spawning of tiles. I learned that from underrlyevelyn
Without that . The tile will disappear when u leave the area
ive been playing PZ completely vanilla for a while now and getting a TAD bored of the repetition of loot. Anyone recommend any weapon, clothing, map mods?
Firearms B41 is a fun gun mod
^
Firearms B41 is refreshing. Bushcraft melees are always nice too and are balanced.
Cool! Thanks man. I was just trying to make sure I do everything by he tbook
do i download these of the internet and how do i add these new items to my game?
Steam Workshop is where you'll find Firearms B41
Then you just select the save and click "More" to change the mods the save is using
However, if you're not using Loot Respawn (Sandbox setting) and you've explored a bunch already, you probably wont find the guns
When adding or removing mods, it's best to make a new save
just lost my charcter and restarting. The mods i chose to add will be apart of my new world orr?
Also #mod_support would be more appropriate venue for your concern
This channel is about coding mods
Yes
wicked, thanks for the help!
i think you've confused it for something else
you don't need to require the mods, you can use a little bit of lua to check if the mods are loaded and add/remove their items from your recipes and stuff
Thank you!
it could also be simpler to make a submod that adds the compatibility content
Thats my current plan. Im still learning lau (again, i wish it was C#), so im doing it this way for now
His going to use the ammo of the mod
Well it works for me so
alr boys i found a way to cancel drag down
if for some reason yall need it
just do getPlayer():setHitReaction("Bob_HitReact_01") and it'll cancel it lol
I need help making a mod that either removes the pain damage debuff OR adds a effect that only activates when you are in pain to counteract the damage debuff pain has
if anyone can help me out with this that would be nice im gonna upload this mod to the workshop for like minded people to use
Lua is by far one of the easiest languages to pick up - esp if you already know one
I feel like someone asked about this before - and I know you can manipulate recipes to become forced invalid - but is it possible to remove another mod's items?
Would kind of hope I can just include files with the same name and leave them empty to do the trick
Yes, but you can't type a number in the ID if you're publishing the mod for the first time since there is none assigned to the mod yet in the first place
It's like you're telling the workshop "yo, don't assign a random id to my mod, here, take this one I wrote instead"
This actually worked. heh
I'm still trying to find if there's an event that triggers when a player wakes up
I am playing a sound when the player goes to sleep and I am trying to stop it when he wakes up. I could use OnPlayerUpdate but seems less efficient performance-wise to keep checking that every frame
if it's just 'if player asleep' it's not that costly
hmm alrightt tyy
Letβs say thereβs 102848833 items on the ground. In a chunk
how would that even happen
How do I go about clearing them? π because
trolls
Well no
It was a accident
But
Thatβs besides the point
How can I go about clearing it? Cause if I get within 500 feet anyoneβs computer just dies.
Is there a way to wipe all items on the ground in a chunk? A container was deleted that held like over 1000 items.
It was a warehouse storage for a shipping company ππ
Itβs a ocean of stuffβ¦.. we are fucked boys and girls
We have to like Condem that chunk with barbed wire fences
Itβs inside ππ
So we canβt reach it
we could write a script, when a chunk loads if there's too many items on the ground it spawns a container and puts them inside or something
Maybe a box that weighs a ton so only admin could deal with it? Cause I donβt want a box with infinite storage getting loose on the sever.
I think Carlos has learned his lesson, but that world be nice Albion
yeah sounds good
Until thatβs finished Iβm going to grab breakfast and we are gonna condemn that area
LOL
If you cross this yellow line, youβre computer will launch into the stratosphere
cant you bypass storage limit with commands
as in, it moving to that container won't even check the limit
Or you can add a piece of paper with -10000 weight
Inside. Itβll give the box unlimited storage
negative weights will be patched out in b42, so i don't want to write anything relying on them
yea except players can pick it up
Ohh I see I think skizots trucking stuff will take away our need for ware houses anyways
Youβre right haha, we only use it to store the stuff, then take it back out and delete it. Looking to do virtual storage soon anyways. So truckers can just buy a trailer loaded with stuff or buy boxes filled with stuff to load into their trucks instead of buying from inside the warehouse.
If in \scripts you give the item no display name, then the Java sets inInvisible or ishidden (or something liek that) to true so players should not be able to see the item in containers without a mod that makes them see it anyway. But also yes negative weights be fated to doom.
Good morning.
Am curious about making templates in VSCode for common tasks like making UI or timed actions in PZ mods.
It's been on my mind for a bit. Wondering how others would see or even use something like this, if they use VSCode at all.
I'd do it for Typescript however I can see this really helping people who'd rather stay pure Lua.
vsc seems like the most popular ide for zomboid from what i've seen
idea isn't too far behind though
I can pick up the API for VSC extensions and do that then.
and from what i've seen, idea tends to be more popular among more experienced people (probably because it costs money and is more complicated to setup), so vsc probably covers more people who would benefit the most from templates like that
Yeah.. PipeWrench was literally for this exact same optimization of time and productivity.
It'd make sense for me to make it for both the canonical and the alternative modding circles.
Essentially, forms and template variables.
Maybe a JSON format / file for UI templates so that things like child elements can be processed somewhat effectively if such a template solution got far enough. π
A lot of creative opportunities in some fun hobby project like this.
A way to tell food item the player ate?
Want to see how much hunger it reduced and whether it was stale or not
What about stagger from bullets
Reason: Bad word usage
lol i saw ping
Huh?
did you say r word
ret-----
I dodnt must be a typo?
I just said
What about bullet hits will this work
oh lol
anyone know how to fix cars not spawning in modded areas
#mapping its a map issue
you have to add special zones where cars can spawn; similar to foraging
Or #mod_support
they're not a mapper, the problem is the maps they've downloaded don't have car spawns when they should
well then #mod_support
i did see errors in your log, but i couldn't make any sense of them, sorry
RRRRRRRRRRRRAHHHHHHHHHHHHHHHHHHHHHHHH
you mean like, tell when a player got hit by a bullet? or to cancel the animation from it? or something else
maaaan ive been spending days getting it working adn idk what i did this time π¦
Just cancel the stagger effect
Dont let em get stunned
IsoPlayer:clearVariable('HitReaction') might do it
Was that easy? Lol this was on demand mod for pvp server before
No one did it cuz everyone thinks pvp sucks
if player:getCurrentState() == PlayerHitReactionStatePVP.instance() then
player:setHitReaction("")
end
it's just a guess - that should stop the animation, and stuff like that is often tied completely to the animation
also this has to run BEFORE the animation starts
put it into OnPlayerGetDamage event, then in function args do (player, _, __) and then check if player == getPlayer()
because it also works for zombies
i did that but PlayerHitReactionState for zombie attacks instead
and it worked
so i see no reason why the PVP one wouldnt
Ooo i need to complie all this snippets. Im currently afk
imma do that for u, sec
local function CancelPVPStagger(player, _, __)
if player ~= getPlayer() then return end
if player:getCurrentState() == PlayerHitReactionStatePVP.instance() then
player:setHitReaction("")
end
end
Events.OnPlayerGetDamage.Add(CancelPVPStagger)
btw if you want zombie attacks then remove the PVP from that state name
if u make a mod from that then dm me cus i want to be a co author for it hehe
why the if player ~= getPlayer() then return end check?
OnPlayerGetDamage also runs when you hit a zombie
its misleading and dumb
it would be better to use instanceof(player, 'IsoPlayer')
otherwise you're breaking it in splitscreen for no gain
so if instanceof(player, 'IsoPlayer') == false then return end?
yeah, or just if not instanceof...
yea regarding that
i tried "if not player:getCurrentState() == PlayerHitReactionState.instance()" and it never worked
i printed it and it returned false regardless of it was it or not
i had to use ~= instead
what does not mean in lua lol
function cancelStagger(player)
if not instanceof(player, 'IsoPlayer') then return end
player:clearVariable('HitReaction')
end
Events.OnPlayerGetDamage.Add(cancelStagger)
```this worked perfectly
use () after not
that also works for zombie attacks
yes
oh good catch
your code says if (not player:getCurrentState()) == PlayerHitReactionState.instance()
when you mean if not (player:getCurrentState() == PlayerHitReactionState.instance())
anyone looking into making an immersive building mod? where everything is able to be built.
Commission?
i'd love to commision one
Also isn't this a mod already?
I just tidied up my pz modding commissions marketplace on my server. I don't know how many modders are active there ATM since I just came back from 100 days of absence.
just different style of things. wanted to go in depth, allow roads to be constructed, concrete to be put down.
all my modders are pretty tied down, i was looking for a new one to focus on the construction elements and power grids, water piping stuff for cities
The Discord forums feature is a godsend.
oh my pz server is like terrible rn. there's so much stuff compiled in one area.
If you want a link to it, I can DM it.
yeah the discord forums in the official server?
Oh I meant my commissions board / discord server for my PZ work / projects.
It's there for people who want to post / pick up side work.
There's more old-hat / retired modders in there though. =/
The idea was to help people like you and modders who are looking for projects to pick at.
I think Konijima tried making a modding-focused server, minus the market.
There's some coders there too.
Ohhh, aiteron has one too but he never really uses it anymore π¦
but his server was purely based on like rp servers with no zombies like mine.
Oh neat.
Would be nice if there was some kind of mod that allowed for "cookie cutter" houses to be plotted and then resources would be placed in some inventory and the house would build over time using actions.
ahh see i like that idea, but i wanted use for construction companies and different trades. like they build the concrete slab, then people come in build the walls and frames, then you can go in paint the walls, install windows. just stupid immersion stuff that makes a need for players that love building on pz.
truthfully, the trolls i've had on the server instead of banning them i've found roles that they enjoy that keep them occupied and they have not trolled since.
trolls are mainly kids who are bored enough to find ways to make themselves entertained, even at the cost of others. Having unique and fun things to do on servers does help mitigate the issue, mostly...
Yeah I mean some went to doing construction, or hunting. They went to make meth in the woods as well.
back to this, what exactly is the difference? I assume total range is the radius of cells the sound travels to. What does intensity affect?
Oh boy.
Well I mean it's the end of the world.
it's something to do with zombie attraction
i left with the impression that it was probably a tiebreaker but i was never absolutely certain about it
My server has no zombie lore lol.
In fact itβs set in just 1992 Kentucky.
βProject humanoidβ
that's very ambiguous ngl. Like, does it affect number of zombies attracted within the range?
Get groceries
Watch handegg
Make dinner
Talk about that weird smell with your mates
sleep
I could try inputting numbers with proportion of other sounds in game but kind of a turn off not being able to figure out what -exactly- the numbers do
Also line simulator at the city halls to get licensing.
no, we were sure it didn't do that
we didn't work out exactly what it did, we left with the impression that it was a tiebreaker
like maybe a zombie who hears two sounds will go for the one with the higher volume
Volume in this case is the Intensity, i.e. the second number?
yes, volume is the name used in the code, sorry
interesting. So, for all we know, it can have a value of 1 and still have the same effect, provided that no other sounds are playing with a higher intensity
that's what testing indicated
somebody needs to actually test this, or someone who can read the code a bit better than i can needs to look through it
all we tested is that even with a very low volume it always attracted every zombie in range
--getFMODSoundBank():addSound(v2.alias, v2.file, v2.gain, v2.minrange, v2.maxrange, v2.maxreverbrange, v2.reverbfactor, v2.priority, v2.looped);
from game files. Not sure if its useful but looks more descriptive
but apparently some game files use the same value for range and intensity which is even more confusing
addSound(getPlayer(), gridSquare:getX(),gridSquare:getY(),gridSquare:getZ(), noiseRadius, noiseRadius);
yeah that's what i see most commonly
jonny's new police record system for the police on my server
Well anyhow, thanks!
Jonny Abrahms is based as shit
i love it skizot
Is it possible to define a minimum and maximum to an int variable ?
like just a normal lua variable? no
consider using math.max and math.min when you're setting the value or when you're using it, whichever works best
You could maybe have setters/getters for that particular variable
But that would require an object which might be excessive
Does somebody knows where the entire tags list is?
in addsound() there's 6 arguments butthis other method that addsound actually stems from has way more --
getWorldSoundManager():addSound(object, x, y, z, radius, volume, bStressPlayer, distZombieCantHear, StressMod)
in addition to a few more overloads for that addsound
I think it has to do with how the game processes sound given certain situations can muffle sounds
the more volume the less sound is lost through walls etc I would assume
but if outside with no obstructions range is the farthest it can go
I'm not sure why there's a distance cut off for zombies but I presume it is to allow for the stress stuff to still impact
i recall distZombieCantHear actually being for when zombies were too close
my guess was it was to stop zombies very close to the source from crowding onto one square
looking at the code it seems like a cap not a minimum - but I could have read it wrong
You can find vanilla tags in recipecode, check the GetItemTypes functions.
Awesome!! thanks!! found them, was hoping a "Saw" tag existed and it does π₯² thanks!
i'm getting that from this
} else if (var3 < var1.zombieIgnoreDist * var1.zombieIgnoreDist && var2.z == (float)var1.z) {
return 0.0F;
```(where var1 is the sound, var2 is the zombie and var3 is the squared distance between the zombie and the sound)
is there a way to know what food item player ate
i want to know whether it was stale and how much hunger it reduced
I'm sure there's a timed action for that you can hook into.
So it is a cap, unless I'm misunderstanding
oh I didn't catch the return 0
yes its the gas pump
getPipedFuelAmount()
not sure i can modify its setting tho
With items, what function/event do things like taking pills hook onto?
Hey, uh... Would it be rude if I wanted to post my mod here? It's a fix for a bug in the game, haven't made the preview image yet
you mean a link to the workshop item?
Yes
I have no objections
Well, it didn't account for multiplayer or... Something. Probably very old code
Well, with this, you can now mess with your players
hook setPipedFuelAmount to min/max it?
the title is weird what does that do
So, in vanilla, your panic reduction grows as you survive, right? But it's actually tied to world time, not the player's survived hours
So joining fresh in multiplayer that's ran half a year in game? You have maxed panic reduction from the start
didn't they change that at some point?
that func is disabled
It isn't to my knowledge
How exactly? I was thinking of feeding it fuel it i get error. Like the method we talked about yesterday about the bodypart(#
I dunno, whenever I play MP, my panic vanishes almost instantly
Stange
And looking through the code, I haven't found anything supporting that it's disabled
Maybe java side?
Yes, Java side
I needed to get the numbers from somewhere
I did hear that fast-forwarding the time in MP didn't advance it, but running naturally did it
Regardless, my mod fixes it, it's a lil messy since I can't properly hook into the method I'm fixing but it works
nah didnt learn that one from me
i might have pointed u at some stuff but i didn't even know about that π€·ββοΈ
really
wait ill search it
it was when i asked how azakaela was able to spawn the grafiti and it didnt vanish . she gave me the snippet and you said they got it from you
oh
i told her that but it wasn't by the render dirty thing
it was by transmitCompleteItemToServer
that synchronizes it over to the server from the client
otherwise the tile remains client-side only
you have to do that or else have the server create the tile
one or the other, and then sync it
clientsideThingToSynchronize:transmitCompleteItemToServer()
without that it will be gone when u relog or when others enter the area who weren't there when it was placed
cuz the server is unaware of it
speaking of her mod the removal of the graffiti is broken, but u can sledgehammer it, amusingly
ahh ok sorry bout that my bad
Hopefully a really basic one but I'm trying to read the players steam ID... and it's not coming out correctly, it seems it might be rounding it slightly.
string.format("%.f",player:getSteamID());
I get a string with "890" as the last three digits... but the last three digits should be "886".
The string format is there because when trying the normal conversion to string it gives scientific notation which of course isn't useful for an ID. Any suggestions appreciated π
the grafitis are overlay? or objects?
Isn't there a format for like... Integers? Floats could start to round
hmmm... %d perhaps... checking... ty
Same result with %d, number is ever so slightly rounded :/
I need a wait to test what actual number that java function is returning... wonder if it's actually wrong... hmm
way*
they are tiles
i don't know the exact nature of the tile, i didnt make the rest of the mod
i just made the cans have usedelta and gave them the sync code
why are you running it through formatting at all
you can concat the number directly to a string
They said it returns a scientific notation
or u can do tostring(number) if u like
Trying to display it shows scientific format (e.g. 1.23453E-16)
that's.. very odd
anyway it's probably a long
but
the way Lua works there's only "number"
so unless it's returning a java object
My guess steam IDs are 64 bit integers
But they could be handled as... Ints in Java?
Scientific notation suggests a float tho
Or a double
Even the debugger shows it scientific notation - that's a breakpoint straight after the following line:
local steamid = player:getSteamID();
The closest I can get is passing it through string format with %.f
string.format("%.f",player:getSteamID());
But the number is... slightly wrong...
Okay, SteamID is a long
Java's long should definitely be long enough... but is Kahlua reading it right (other parts of the zomboid UI show it correctly so one assumes so... but...)
Maybe SteamUtils:conversSteamIDtoString() ?
Assuming you can call SteamUtils globally
Looks like it is a lua issue... that number is too big to be stored as a number... um....
local steamid = 76561198002799886;
print(string.format("%.f",steamid));
does the same thing - rounds the end 886 off to 890.
Couldn't reach SteamUtils - but checking the Global object led me to the function "getCurrentUserSteamID()" - this returns a string instead of a long... seems those functions that return longs will never work, as they'll break the users steam id π¬
Irl thatβs a terrible idea ππππ
Anyone looking to make a immersive building mod for some moneyyyy
any advice for metal working mods?
What kind of metal working mods? U planning to craft stuff?
The problem with metal working is the grind ... U need to disassemble but if theres a way you can have player level without disasmbly might be a idea
Would it be too difficult to make a context menu option for Dislaik's Skateboard mod that allows to place the board on your back directly from the ground? I'm not very familiar with lua as of yet. So I can imagine anything would be difficult for me haha.
Finally understand why many of the programming languages I know don't allow multiple inheritance. The diamond problem is annoying af
sounds like the thing to do for that is require the user to solve the ambiguity by instructing the compiler/interpreter which one to inherit from per-method if they don't match
doesn't seem that crazy or difficult to make the language force the programmer to avoid
:P
Is there a way to know what iso it is vis print? And whats the diff with objects and specialobjects?
its pretty rough in a language like lua where anyone can come along at any time and insert a function into any Class in your inheritance hierarchy then try to call it from a different class downstream, lol. I can' t find a simple solution so I'm simply not going to worry about it
Im not sure what dislaiks skateboard is but if you want to have it placed on the players back it has to be an item with static model
cuz lua is dumb
:p
it's a very scrappy language
ya, which I don't mind
it lets u do stuff quick/easy but it's very loose and messy
the cost is that there's a lot of weird shit going on
its the skateboard mod on the workshop. And yes it does have a static model.
That just make it attach to the player?
it itemizes
when u pick it up
from a vehicle -> item
and that can attach to back/etc. like a weapon
or be swung
glitchy-ass mod tho
So basically the skateboard can be dropped and used as a vehicle but when you pick it up its a weapon
Use the skateboid mod. its the superior version of it.
i did
huh
lots of potential exploits and oddities like storing items in the "seat" of the skateboard
Idont understand the problem if it already has a static mode then just attach it? Ah ok so you want to have a context menu specific to making it an item and auto attach to the back
Sounds easy enough i think
just call the existing code
and hook it to a context menu item
in series
pick up -> find item -> attach
yeah its pretty trivial. just a QoL for the people who use it tho. Atleast it would be for me haha. Its not a deal breaker tho.
Dont know he converts it into an item but sounds like some wizard level shit. But u yeah what she said. Use the its own code then just add the attachment code thats it
it's more like "deletes the vehicle and gives you an item"
and if it DID store anything they could just store it in the moddata for the item, but i doubt they do
and then the item can spawn a vehicle and disappear
via recipe presumably
Ow it doesnt store data?
Also the vehicle runs with no gas? Thats still wizardry
i have doubts it stores data but i haven't tested it
Bravens bike mod does the same thing.
braven's bike mod has even more bugs tho, duplicates itself all over π
in mp anyway
never had issues in mp. except the weird animation when you see other people riding the bike. And had a bike disappear once lol. Typically for the host "me" I never have issues.
says stuff about it right on the page, unless it got fixed
something about picking up the frame causing a duplicate to be created and not removing the one on the ground or something, i read it months ago tho might misremember
I believe u.
Just hasn't happened to me yet.
maybe braven fixed it since then idk
i guess they did i don't see the note about it anymore
Im currently afk but you can check my code on how i attach stuff to the player
Im bot sure if i have the code that lets you attach it to a diffrent atachment location but i assume the skateboard is already attachable to the back right?
Even if it does have glitches tho. I usually don't care, unless its an abysmal mess or fuqq's up the framerate. Im a frame junkie. with ocd like a mf lol.
i play at like 15-40fps lol
not enough money to upgrade pc
xD
it runs fine on SP
but not heavily modded high pop shit in mp
Yes its already attachable to the back. The game recognizes it as a 2 handed weapon. So it goes in those slots on your back.
i7 rtx 3070. I rarely have issues. But I paid the price for my computer. SO trust me i understand lol.
Is it safe to say that knowing pz's functions are a language in of themselves and lua is second? Just curious on thoughts. I am by no means a programmer btw. So that might be a dumb question lol.
you need to know a codebase to write for it, but without programming and language knowledge you won't be able to make much sense of the codebase + your code just won't be as good in general
gtx 1060 and an i7 8700 lol
it's fine hardware just old
mobile mind
my desktop is even older, desktop version of same card, i7 4770k
i'm literally on the exact same hardware as you and i'm not having performance issues
i'm not really sure what to make of that
lol I just found out that someone made a bike mod based on my skateboard mod
He didn't even give credits
*getting mad*
π¬
anyway, what you mean start here
ISVehicleMenu.FillMenuOutsideVehicle = function(player, context, vehicle, test)
if vehicle:getScriptName() == "Base.Skateboard" then
context:addOption(getText("ContextMenu_Grab_Skateboard"), player, function(player, vehicle)
ISTimedActionQueue.add(ISPathFindAction:pathToVehicleAdjacent(getSpecificPlayer(player), vehicle)); --> player go to skateboard(vechile)
ISTimedActionQueue.add(ISSkateboardTimedAction:grab(getSpecificPlayer(player), vehicle, 50)); --> Custom TimedAction "Pick up the skateboard"
end, vehicle);
else
ISVehicleMenuOriginal_FillMenuOutsideVehicle(player, context, vehicle, test);
end
end
a base function is overwritten, but I will update it soon for a better alternative, you just have to follow the functions calls
which mod do you refer to?
uh oh
u know full well how many more zombies i have lol
high zeds + clothing mods -> fps drop
ho shit they literally just yoinked? :p
that's dirty
new performance save: simply be worse at the game so you need less zombies
local pl = getPlayer()
local pStats = getPlayer():getStats()
local plRep = SandboxVars.Mineable.PhysicalToll
local plDmg = SandboxVars.Mineable.PhysicalPenalty
local plRepData = pl:getModData()['digRepeat']
if plRepData == nil then plRepData = 0 end
plRepData = plRepData + 1
if plRepData >= plRep then
plRepData = 0
local weightLoss = pStats:getWeight() - plDmg
pStats:setWeight(weightLoss)
end
anyone knows if im using correctt syntax
especially with the setweight
weight is part of nutrition, not stats
thats what i thought
is there a way to iterate a table but only produce a 1 line print?
i think i saw this before
a 1 line print that says what?
like the entire table in one line? just add everything you want to print to a variable and print the variable at the end
Can't you use print(serialize(table))?
pretty sure table.concat(tbl, ',') works in PZ if you just want to get a string of everything, although I'll admit I haven't tried. Is there a serialize function?
ah ya, dislaik found them somewhere
aren't they just from lua?
I don't think lua has a native serialize, no, although the pack functions do something similar
Anyway, serialize(myTable) does work to render the table as a string and has been very handy for debugging.
ah, the reference i was looking at just gives you the code lol
how deep does it go?
I haven't tried it on nested tables yet.
Hopefully it doesn't die on circular references, they're always fun when serializing things
its probably what they use to send moddata between the server and client sides, which makes copies of references, not sure how it handles circles
Seems to work fine on deeply nested objects. Functions just come up as "closure 0x(hex string)", but at least they don't kill it.
print(serialize(MandelaBowAndArrow.Client))
gave
{ getArcherySkill=closure 0x1916833684, addArcheryXP=closure 0x943614472, arrowInZombie=closure 0x670287054, ArrowHitZombie=closure 0x1556012665, hitConsequencesCMD=closure 0x720688725, removeShotArrow=closure 0x1632732969, getDeviation=closure 0x1488841337, getMovingTargetAim=closure 0x1926937089, shootArrow=closure 0x2123402353, onPlayerUpdate=closure 0x320152645, OnLoad=closure 0x609024636, OnCreateSurvivor=closure 0x65095238, attackHook=closure 0x2045288783, setUpBow=closure 0x1139119419, OnEquipPrimary=closure 0x3741729, OnEquipSecondary=closure 0x157531414, FirearmsB41Patch=closure 0x901617580, OnGameBoot=closure 0x1520337005, OnZombieDead=closure 0x313422607, OnFillMenu=closure 0x112326465, checkArcherySkill=closure 0x1609044172, onNewGame=closure 0x1901821620, SetBowAndArrowModel=closure 0x269245851, UnloadArrow=closure 0x420395812, CustomRecipesMenu=closure 0x117421753, AddRecipe=closure 0x746309132, OnDoRecipe=closure 0x1583982237, OnRecipeComplete=closure 0x844296687, RichTextPanel={ x=0, y=16, width=375, height=455, anchorLeft=true, anchorRight=false, anchorTop=true, anchorBottom=false, dock="none", minimumWidth=0, minimumHeight=0, scrollwidth=0, removed=false, background=true, backgroundColor={ r=0, g=0, b=0, a=0.5 }, borderColor={ r=0, g=0, b=0, a=0 } plus more
Actually, the closure IDs appear to be base 10 numbers, despite starting with 0x. Random.
seems to handle circular references somehow, although its not nearly as human readable
... I've seen this syntax before. Must be a standard approach
a = {tbl={}}
b = {tbl=a}
a.tbl = b
c = serialize(a)
print(c)
gives you _(1,{tbl={ tbl=_(1)}})
Better than a stack overflow from infinite recursion π
Found it getNutrition():getWeight()
had a fun one earlier where I was adding to an array I was iterating through, which lua allows
is it possible to use this with say?
just do :Say(serialize(table))?
getPlayer():Say(serialize(table))
I'm not sure how well player:Say handles long strings, but for a small table, seems like it would work fine. It's just a string.
yeah my only thought on that is that it probably isn't very useful on say
So, I have an item which has a condition. I've got the tooltip on hovering the item in the inventory rendering the condition, but now I want to be able to expand a stack of them and see the individual conditions. I can see that ISInventoryPane:drawItemDetails does that normally for e.g. weapon conditions.
What's confusing me is that the Bow&Arrow Alternate Draw mod shows the conditions on an expanded stack of bowstrings, but it doesn't touch drawItemDetails. So is there some other way to do that?
its really hard to code when carrying an infant π€£
my son is very determined to smashh the keyboard
Aye, they do that π
Oh, my mistake, it didn't show the conditions in the inventory stack, it was always just done with tooltips. Cool - that makes more sense.
I really hope TIS lean heavily on the item tag system for things like tooltips and expanded stacks in 42. You shouldn't have to override code to show a condition bar on an item the base game doesn't expect to have item damage.
i hope tis leans heavy on allowing us to instance servers.
Well, yes, there are many things they could improve, honestly π€£
i'm not sure if anyone else was curious about this, but i benchmarked some code of mine against a version of it that pulled every used function into the local namespace first, and saw a ~20% speed increase in the latter - it was far from a laboratory test, and not too scientifically conducted, but the performance gain seems worthwhile to me
it's also pretty far from the 5x speed increase someone mentioned here, but still useful
Does the game sees any death as the same? Like if a player dies from gunshot, bleach consumption, or zombification the game sees it as the same one death and triggers the same one death animation.
can someone make a quiet place monster that can hear you from 1500m. thankyou if not no big deal. peace gn
anyone got a lua that will spawn a tile at a specific coordinate?
ill tag you on the mapping discord
is it posible to have a moddata contain a table?
nvm figured it out
@hot patrol You might be interested: https://steamcommunity.com/sharedfiles/filedetails/?id=2900287489
I've released my modification of Cool down's modification of Gluten the sensitive's Bow and Arrow mod π
(Which from stuff in the code might have originally been coded by someone with the handle of Mandela?)
Thank you!
Anyone here have experience adding UI elements to the game that could help me out rq? Trying to figure out if something is possible
Nice! Very fast work. Thanks a lot for creating this.
Hopefully it won't be too buggy π I've already updated with one fix.
I'll be sure to test it after work. I plan on adding it to my private server.
I'm using it in my singleplayer game. Always helps to, as they say, eat your own dog food π
@sour island
If you do the community tags mod, which format would you use to check if item can hold dirt?
a) hasReplaceType("DirtSourse")
b) hasTag("EmptySolidContainer") and (a)
c) hasTag("EmptyDirtContainer")```
I think when checking a lot of items, checking the tag is faster than checking the map with replace types.
Whelp, friendly warning for you guys about something I just found... Don't use userdata as keys in a table. Even if the exact instance of userdata is in the table, lookup will fail if the instance has changed in some way.
Only times it fails is if the game reloads that userdata. So it's valid if you use it at specific moment, but not over long periods of time.
nope
local vectors = {}
local v=Vector3f.new()
vectors[v] = 1
v:set(1,1,1)
local w = vectors[v]
print(w)
for k in pairs(vectors) do
print(k==v)
end
results in
nil
true
afaik, two userdata only evaluate to be == if they are literally the same object, so this would mean that the key is the same object, yet trying to index the table with it results in nil anyway.
print v before / after set?
(0.000e0 0.000e0 0.000e0)
(1.000e0 1.000e0 1.000e0)
I checked the vector code to be absolutely certain that set does not return a copy
I'm not sure about KahLua specifics but that right there seems to be your problem.
what where
I remember using something like that, but I did
local vectors = {}
local v = Vector3f.new()
vectors[tostring(v)] = v
for k in pairs(vectors) do
if k == tostring(v) then
--TODO
end
end
tostring gives those (0 0 0) type strings like you see above, so two vectors pointing to the same coordinates would overwrite each other
I don't know of a way to just get the memory address of something, but that would be more useful
afaik lua can't access to kernel
printing a table without a __tostring metamethod will give you table+ an address, which is what I'd want
don't know how it gets it though
what's the use of this? If you want a vector with 1,1,1 then I imagine you can save it after the set.
Hello! Does anyone know how to load custom shaders in PZ? Iβd like to be able to put blurs and such over the main viewport for some immersive effects if possible
#modeling will know more
Yr thays most likely part of coords
its to keep a pool of Vectors with a O(1) removal time
Just woke up, thanks :^Β£
sorry thought it was moddeling
You got me all confused
Wana learn this too
No, generally over the entire screen
Ye i know
I can use it for heroin blindness effect of my mod
Cuz right now im using a png
I know that /media has a folder for shaders, but Iβm not sure which language theyβre in or how to make the game load them. Would it be possible via LUA?
And it sucks . Something like that will be bery useful if its like the fade in and out or something
When i figure it out ill send u a msg and pls do the same if in case u figured it out π
I think shader are set in scripts, never used it.
model { model,texture,shader= ...}
I think fiddling with the climate or weather may have a chance to manipulate it
Akso the sleep fades in and out
I found the fade out code but i couldnt fade it back in
Do you remember where it was?
If it's a removal list, you probably want to do table.insert to add and then reverse iteration to remove.
its not a stack, I can't just pop them off the top like that. I'm just going to have to settle for putting them in the value set instead and searching for them. Thankfully O(n) will be fine in this instance, it just a bummer when O(1) should have been possible
from the issleepdialog
function ISSleepDialog:onClick(button)
self:destroy()
if button.internal == "YES" then
local SleepHours = self.spinBox.selected
SleepHours = SleepHours + GameTime.getInstance():getTimeOfDay()
if SleepHours >= 24 then
SleepHours = SleepHours - 24
end
self.character:setVariable("ExerciseStarted", false);
self.character:setVariable("ExerciseEnded", true);
self.player:setForceWakeUpTime(tonumber(SleepHours))
self.player:setAsleepTime(0.0)
self.player:setAsleep(true)
getSleepingEvent():setPlayerFallAsleep(self.player, tonumber(self.spinBox.selected));
UIManager.setFadeBeforeUI(self.playerNum, true)
UIManager.FadeOut(self.playerNum, 1)
if IsoPlayer.allPlayersAsleep() then
UIManager.getSpeedControls():SetCurrentGameSpeed(3)
save(true)
end
if JoypadState.players[self.playerNum+1] then
setJoypadFocus(self.playerNum, nil)
end
end
if button.internal == "NO" then
if JoypadState.players[self.playerNum+1] then
setJoypadFocus(self.playerNum, nil)
end
end
end
getPlayer():setAsleepTime(0.0)
getPlayer():setAsleep(false)
UIManager.setFadeBeforeUI(getPlayer(), true)
UIManager.FadeOut(getPlayer(), 0)
function ISZoneDisplay:doFadeStep()
for target, element in pairs(self.fadeElements) do
if self.fadeTarget == target then
element:setAlphaTarget(1);
else
element:setAlphaTarget(0);
end;
end;
end
------------------------ fadeout screen ---------------------------
local pl = getPlayer()
UIManager.setFadeBeforeUI(pl:getPlayerNum(), true)
UIManager.FadeOut(pl:getPlayerNum(), 1)
local pl = getPlayer()
UIManager.setFadeBeforeUI(pl:getPlayerNum(), false)
UIManager.FadeOut(pl:getPlayerNum(), 0)
and here are abunch of snippets idk where i found it and im not sure if i have tried em
oooo i think imight have found it! π
function NewGameScreen:prerenderBottomPanelLabel()
local padLeft = 6
local padRight = 6
local alpha = 0.5
if NewGameScreen.instance.selectedItem == self or NewGameScreen.instance.selectedDifficulty == self then
self:drawRect(0 - padLeft, 0, self:getWidth() + padLeft + padRight, self:getHeight(), alpha, 0.3, 0.3, 0.3)
if self.joypadFocused then
self:drawRectBorder(0 - padLeft, 0, self:getWidth() + padLeft + padRight, self:getHeight(), 0.9, 0.6, 0.6, 0.6)
else
self:drawRectBorder(0 - padLeft, 0, self:getWidth() + padLeft + padRight, self:getHeight(), 0.9, 0.3, 0.3, 0.3)
end
elseif self.fadeOut or self.fadeIn then
if self.fadeIn then
local fadeIn = getPerformance():getUIRenderFPS() / 12
alpha = 0.5 * (self.fadeIn / fadeIn)
self.fadeIn = math.min(self.fadeIn + 1, fadeIn)
else
local fadeOut = getPerformance():getUIRenderFPS() / 4
alpha = 0.5 * (1 - self.fadeOut / fadeOut)
self.fadeOut = math.min(self.fadeOut + 1, fadeOut)
if self.fadeOut == fadeOut then
self.fadeOut = nil
end
end
self:drawRect(0 - padLeft, 0, self:getWidth() + padLeft + padRight, self:getHeight(), alpha, 0.3, 0.3, 0.3)
end
ISLabel.prerender(self)
end
last one is from MainScreen.lua
You can pop them off whenever they meet your condition.
If o.time == time then pop end