#mod_development

1 messages Β· Page 60 of 1

humble oriole
#

well, you're right, the rain collector works if a player is there or not and it's a world object so I think it would meet my needs

fast galleon
#

Yeah, farming / trapping systems use global objects too.

humble oriole
#

cool, I think this will give me a bit more reference material

sour island
#

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?

thick karma
#

@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

sour island
#

That's true, I actually do have something to force exceptions I just never noticed if the counting stopped on errorMag

thick karma
#

I think there is probably a limit though

#

Just guessing

sour island
#

I would assume so - I was just curious if it was a hard set thing so I can account for it

thick karma
#

Not sure where 😦

#

I bet such a thing exists though

sour island
#

I know the java file, I'll have to take a look later

#

KahluaThread if I recall

#

m_errors field

vast veldt
#

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?

sour island
#

What does connectedPlayers give you?

vast veldt
#

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());

sour island
#

Is the code running from /client or /server in the Lua directory?

vast veldt
#

/server and event is definitely running on server (using EveryHours now just as a backstop) - i get the trace into my server's output.

sour island
#

Connected might be co-op then, is there a getOnlinePlayers?

vast veldt
#

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!)

sour island
#

Check that message

fast galleon
#

I'm not making models either. Max I will do are some icons and textures.

vast veldt
#

Definitely looks like getOnlinePlayers is the way, rewritten and rebooting my server now

sour island
#

What is the goal of your mod exactly? @fast galleon

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

vast veldt
#

Yep, getOnlinePlayers() did the trick, thank you

sour island
winter thunder
#

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

sonic mountain
#

Does the True music mod have California Girls?

fast galleon
sour island
#

That's what I started vanilla wep expanded to try and do

#

Unfortunately weapons are very rigid

fast galleon
#

true

sour island
#

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

neon bronze
sour island
#

Is locking a gun case or briefcase possible?

winter thunder
neon bronze
sour island
winter thunder
#

No like, as an item type

sour island
#

What is it

winter thunder
#

Instead of the limitations of other item types, it inherits all other item definitions

#

so you can give it anything that is defined for items, afaik

sour island
#

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

fast galleon
winter thunder
sour island
#

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

jagged ingot
#

Good afternoon.

winter thunder
#

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

jagged ingot
#

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?

#

I wonder what made TIS decide to update it. Last I heard this was not going to happen until PZ officially releases fully.

winter thunder
thick karma
#

Is it possible to gain a trait when a book is read? I know books can grant skills...

jagged ingot
#

zomboid-javadoc.com is a third-party generated docs which does not contain comments and documentation written by the devs themselves.

winter thunder
#

Ohhhh ok, gotcha

jagged ingot
#

Dev comments on code are valuable when modding with an API so yeah.

winter thunder
#

Here it is on the main one then

sour island
thick karma
#

😭

#

No worries, thanks for responding if you're right

winter thunder
#

@thick karma It 100% is, soul filchers reading time does it

thick karma
#

I'll grab it

winter thunder
#

Wait

#

Before you do that

#

There is magazines in game that do it too, iirc. The how to use generators mag and the herbalists

thick karma
#

Mmmmm

bronze yoke
#

yeah, the official doc is now up to date and includes things like parameter names, much more useful imo

thick karma
#

@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...

jagged ingot
vast nacelle
jagged ingot
#

I was writing a third-party documentation tool for getting around this issue prior to this release.

winter thunder
#

what is pipewrench btw? Have seen that mentioned before

jagged ingot
#

Apparently it's having some issues for people atm so I'm looking at it atm.

winter thunder
#

ah, gotcha. Do you know if it still works? Bc that looks really interesting

jagged ingot
#

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.

thick karma
jagged ingot
#

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.

finite owl
#

Cool. Yes, I'm already using his sound effects πŸ™‚

tardy wren
#

Is there an event for when a player enters the world, as in loads into a multiplayer server or a singleplayer game?

hot patrol
#

He said he had made some new ones. I just figured I would let you know just in case you wanted to contact them.

jagged ingot
#

These are from 41.65

#

Hope that helps.

tardy wren
#

I see...

#

I think I'm overcomplicating this

tardy wren
#

So, let me get some things straight

weak sierra
#

look at my safe login mod

tardy wren
#

scripts in the "client" folder are run client or player-side, whereas scripts in the "server" folder are run server or world-side?

jagged ingot
jagged ingot
tardy wren
#

Ah, so OnGameStart?

jagged ingot
#

OnGameStart for client-side IIRC.

tardy wren
#

Yea, do want ti client side, and don't want variables to interfere between players...

#

I may have overthought my approach

jagged ingot
#

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.

tardy wren
#

My mod is mostly client side, yes

thick karma
#

Anyone happen to have the command for adding a trait to an existing player handy?

tardy wren
#

But I am preparing it with Multiplayer compatibility in mind

jagged ingot
#

Looking at the code that way is convenient.

thick karma
#

someone would have to pay me to take that extra time on my mods

#

Otherwise pull em and read em lol

jagged ingot
tardy wren
#

nobody seemed impressed by me making mods for a game

neon bronze
#

One could dream of making money of modding pz

jagged ingot
#

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.

weak sierra
#

i have github and old copies of my older mods on there

jagged ingot
#

I'd like to see an official TIS market for modders here but I get why they wouldn't.

tardy wren
weak sierra
#

i can barely handle what im doing

#

:p

thick karma
#

Could it be so simple?

weak sierra
#

hard times atm. will try to get the rest on github when i can

jagged ingot
ancient grail
#

getPlayer():getTraits():remove("SpeedDemon");Β  getPlayer():getTraits():add("SpeedDemon");

bronze yoke
#

yeah something like that

#

might be capitalised differently or something

thick karma
#

Ty @bronze yoke @ancient grail

hollow current
#

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

jagged ingot
whole yoke
#

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?

ancient grail
#

Works with mods time actions too?

bronze yoke
#

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

hollow current
# ancient grail And the player will do the action automatically once they connect?

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

thick karma
#

Now to create my own item... Oof.

#

❀️ @vast nacelle

winter thunder
jagged ingot
#

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.

winter thunder
#

How complicated of mods? Since as someone considering doing something similar, that sounds like crazy pricing imho πŸ˜‚

#

β€œDeath” πŸ˜₯

drifting stump
#

mango back πŸ€”

#

i never charged any mount for my commissions and always let people pay what they thought was fair

jagged ingot
winter thunder
#

πŸ‘‹ to you too

bronze yoke
#

yeah, everyone i've worked with has given me a fair price so i've never really thought about it

winter thunder
#

That makes sense! Appreciate the perspectives

jagged ingot
#

I mean.. it's ultimately up to the negotiation of the price, even if you give one first.

drifting stump
winter thunder
#

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

jagged ingot
jagged ingot
#

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.

frank rivet
winter thunder
#

What do you need help with? Lol

#

@frank rivet

quasi kernel
#

Would it be viable to turn wallets into miniature containers

ancient grail
bronze yoke
ancient grail
winter thunder
quasi kernel
#

Sweet, thinking about setting up an economy on my server.

bronze yoke
#

my expansion for projectrp makes wallets containers for documents

#

that sort of thing is super simple to set up in lua

quasi kernel
#

Might also remove 'money' as an item and replace with with coins and cash.

frank rivet
quasi kernel
#

More variety!

#

Then all I gotta do is figure out how to set up an ATM system and we're set.

bronze yoke
#

you might want to use better money system then

#

it's pretty much everything you're looking for

quasi kernel
#

Huh, that works then.

winter thunder
ancient grail
#

Ye problem with money being items is that when u spawned alot of em at the same time. It will lagg preeeetty baaaad

quasi kernel
#

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.

bronze yoke
#

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

ancient grail
quasi kernel
#

Sweet. Less work for me.

ancient grail
#

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

bronze yoke
#

it is

#

it's all global mod data

jagged ingot
#

Just found an old pz archive of mine for modding πŸ˜„

#

Some build 30-31 stuff in there too.

hollow current
#

how do you make two traits mutually exclusive?

bronze yoke
#

setExclusive or something on the Trait object

hollow current
#

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)

quasi kernel
#

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

hollow current
#

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

quasi kernel
#

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

sour island
#

There's a money system? For my shop I just used money items and prescribed values + allowed players to split stacks into new ones

fast galleon
quasi kernel
#

Ah

fast galleon
#

I have added compost and dirt support. I kinda skipped gravel though.

sour island
quasi kernel
#

I'm talking more about stuff like mechanics which hard-requires the wrench to my knowledge.

sour island
#

You could even make a system that adds the tag only if the item doesn't have it already

quasi kernel
#

I can doParam to give the wrench a tag, but the system doesn't support tags iirc

#

(Mechanics I mean)

sour island
fast galleon
bronze yoke
#

just set it to false

#

i forget exactly if that's in :new() or :start() or something

quasi kernel
bronze yoke
#

then we'd have to worry about load order and stuff

sour island
#

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

bronze yoke
#

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

quasi kernel
#

The overwrite is what I'm mostly worried about

robust briar
#

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

ancient grail
quasi kernel
#

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.

bronze yoke
#

if we leave guidance to always put it at the very start of your load order, it might be okay?

quasi kernel
#

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.

hollow current
#

didn't know these existed

hollow current
#

thanks though!

sour island
#

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

ancient grail
#

Konijima is no longer active. Last time we spoke he mentioned something about gtaV

sour island
#

Oh yeah seems like he did based on his discord sever

round stump
hollow current
#

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?
sour island
bronze yoke
#

i recall it being the other way around

sour island
#

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

hollow current
#

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``
hollow current
bronze yoke
#

player isn't a player object

#

where are you getting it from?

hollow current
#

.. nowhere? Its weird considering it worked before like that. Like literally yd, only with another piece of code

bronze yoke
#

nowhere?

hollow current
#

I assume I need to use getSpecificPlayer on the player?

bronze yoke
#

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

hollow current
#

oo i see

bronze yoke
#

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 πŸ˜…

lusty marsh
#

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

hollow current
bronze yoke
#

i'm planning to write an event guide, as the wiki can be a bit too vague in places, and it's becoming outdated

dark arch
#

is it possible to modify a specific instance of an item's tags without changing the tags for the rest of them?

bronze yoke
#

i suppose b41 is over, so it won't become any more outdated, but it's already outdated

bronze yoke
#

(getTags() just grabs them from the script)

hollow current
#

Didn't even know this existed. That'd be a huge help -- assuming it gets updated

dark arch
#

darn

bronze yoke
#

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

vast nacelle
#

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.

bronze yoke
#

i wrote everything i know here

vast nacelle
#

Thank you very much

thick karma
#

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?

bronze yoke
#

yeah you can just do that

thick karma
#

Should I do this server-side?

bronze yoke
#

yeah

thick karma
#

Got it, thanks... and afayk this is all I would need to make it appear on living room bookshelfs? Item definition for context:

hollow current
#

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

sour island
#

attacking is it's own timed action afaik

#

or a player state that supercedes timed actions

lusty marsh
bronze yoke
hollow current
#

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

bronze yoke
#

that's true, that's appealing

hollow current
#

but not letting him cancel it

bronze yoke
#

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

hollow current
#

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

hollow current
# hollow current hmm don't think it should

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

bronze yoke
#

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

hollow current
#

what does the _ do?

bronze yoke
#

nothing, but it's often used to mark an unused parameter

hollow current
#

gotcha, just changed it, thanks!

bronze yoke
#

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

sour island
#

Is there a tried and true method of removing an item?

hollow current
sour island
#

Making these changes, apparently removed items reappear later in containers

thick karma
#

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.

lusty marsh
finite owl
#

@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...

glass swallow
#

any idea how to fix/what causes this?

hollow current
hollow current
glass swallow
hollow current
#

Are you a contributor or owner of the mod?

glass swallow
#

owner

#

its a true music addon mod

hollow current
#

Is it a new mod or are you updating it?

glass swallow
#

new mod

hollow current
#

can you try changing id to sth like

#

idk anything that is a string

glass swallow
#

like....?

astral dune
#

where did you get the ID from?

glass swallow
#

i just slammed my fingers against the numpad

#

randomly

astral dune
#

leave it blank

glass swallow
#

was that a bad idea

hollow current
#

sth like id=TrueMusicAddonSafehouse

astral dune
#

workshop ID is assigned by the workshop

glass swallow
#

if its blank is invalid

hollow current
#

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

thick karma
hollow current
#

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

glass swallow
#

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

finite owl
# hot patrol He said he had made some new ones. I just figured I would let you know just in c...

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.

hot patrol
#

That all sounds really good. I like it

glass swallow
#

so for multiplayer, i uploaded the mod but it's only giving me the option to upload to mods section and not steam workshop

finite owl
#

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.

hollow current
#

where is your mod currently? its directory

glass swallow
#

in /workshop and /mods in the pz folder

hollow current
#

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```
vast nacelle
#

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?

hollow current
#

which returns the number of zombies currently attacking you (i.e. attempting to bite/scratch/etc)

astral dune
#

πŸ€” I wonder if that works while the player is in a vehicle

bronze yoke
#

the only thing i can think of is it's in a bad directory or something...

vast nacelle
faint jewel
#

what items can be locked with a combination lock?

hollow current
#

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?

thick karma
bronze yoke
#

that seems correct

thick karma
#

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

lavish umbra
#

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%

thick karma
vast nacelle
#

@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...

ancient grail
thick karma
ancient grail
lavish umbra
#

I've looked at some others, but it seems that traits are just limited to 75% gains and cant get any lower anymore..

bronze yoke
#

you'd have to alter xp manually to do that

#

not sure how viable that is, if even possible

ancient grail
# sour island

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

ancient grail
faint plinth
#

is there a way to make a recipe have a result of nothing?

ancient grail
#

But i could be wrong and it can be used by other types too

ancient grail
faint plinth
#

thanks!

ancient grail
bronze yoke
#

if i'm being honest writing this guide made me realise how useless they are... but here it is anyway!

blazing vine
#

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?

astral dune
# bronze yoke if i'm being honest writing this guide made me realise how useless they are... b...

I guess hooks have two uses

  1. allow you to completely replace the behaviour of a few things. Difficult because you would have to reimplement it from scratch
  2. 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
bronze yoke
#

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

astral dune
#

are all of these server side? I would have thought the stats and drinking ones would have been client

bronze yoke
#

they're all clientside as far as i know, but splitscreen players are all the same client

astral dune
#

of course, splitscreen players are screwed eitherway, ya

bronze yoke
#

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...

astral dune
#

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

bronze yoke
#

yeah, when i was under that impression i was also very curious about tiebreakers

astral dune
#

you mean like if there were multiple hooks returning different values?

bronze yoke
#

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

astral dune
#

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

bronze yoke
#

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

sullen bobcat
#

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

finite owl
#

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.

hot patrol
# sullen bobcat Hi. I am just starting out with modding, and i wanted to clarify something. I cu...

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.

sullen bobcat
finite owl
#

Can you be more specific about what your mod is, and how you want to use items from other mods?

sullen bobcat
#

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.

hot patrol
#

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.

sullen bobcat
finite owl
#

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.

hot patrol
#

Yea that sounds like it wouldn't be an issue. I see other big mods do stuff like that all the time.

finite owl
#

Doesn't hurt to ask/let the author know about your mod, but you're not redistributing their work or anything.

hot patrol
#

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

sullen bobcat
#

Cool! Will do. Now i only gotta find the mod devs, which is the hard part lol

hot patrol
finite owl
#

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.

sullen bobcat
#

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

hot patrol
#

Good luck! πŸ™‚

sour island
#

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 πŸ€”

ancient grail
ancient grail
#

Need to look for the proper syntax tho

sour island
#

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

ancient grail
#

Yeah its a wonderful mysterious thing that make things happen

bronze yoke
#

doesn't that just redraw the ui?

sullen bobcat
#

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

ancient grail
#

Ah just require the mod thats all

ancient grail
#

Without that . The tile will disappear when u leave the area

swift kelp
#

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?

tulip bison
#

Firearms B41 is a fun gun mod

quasi kernel
#

^

#

Firearms B41 is refreshing. Bushcraft melees are always nice too and are balanced.

sullen bobcat
swift kelp
tulip bison
#

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

swift kelp
ancient grail
#

Also #mod_support would be more appropriate venue for your concern
This channel is about coding mods

swift kelp
bronze yoke
bronze yoke
bronze yoke
#

it could also be simpler to make a submod that adds the compatibility content

sullen bobcat
ancient grail
ancient grail
deft falcon
#

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

balmy pike
#

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

sour island
#

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

hollow current
#

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"

hollow current
#

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

sour island
#

if it's just 'if player asleep' it's not that costly

hollow current
#

hmm alrightt tyy

trail lotus
#

Let’s say there’s 102848833 items on the ground. In a chunk

deft falcon
#

how would that even happen

trail lotus
#

How do I go about clearing them? πŸ˜‚ because

bronze yoke
#

trolls

trail lotus
#

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

bronze yoke
#

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

trail lotus
#

I think Carlos has learned his lesson, but that world be nice Albion

bronze yoke
#

yeah sounds good

trail lotus
#

Until that’s finished I’m going to grab breakfast and we are gonna condemn that area

bronze yoke
#

LOL

trail lotus
#

If you cross this yellow line, you’re computer will launch into the stratosphere

deft falcon
#

as in, it moving to that container won't even check the limit

trail lotus
#

Inside. It’ll give the box unlimited storage

bronze yoke
#

negative weights will be patched out in b42, so i don't want to write anything relying on them

deft falcon
#

yea except players can pick it up

trail lotus
#

Ohh I see I think skizots trucking stuff will take away our need for ware houses anyways

trail lotus
# deft falcon yea except players can pick it up

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.

undone crag
#

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.

jagged ingot
#

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.

bronze yoke
#

vsc seems like the most popular ide for zomboid from what i've seen

#

idea isn't too far behind though

jagged ingot
#

I can pick up the API for VSC extensions and do that then.

bronze yoke
#

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

jagged ingot
#

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.

deft falcon
#

A way to tell food item the player ate?
Want to see how much hunger it reduced and whether it was stale or not

ancient grail
#

What about stagger from bullets

slow graniteBOT
#
Glytch3r#2892 has been warned

Reason: Bad word usage

deft falcon
#

lol i saw ping

ancient grail
#

Huh?

deft falcon
#

did you say r word

ancient grail
#

Stgr

#

What

#

Idk what i said lol but it wasnt inappropriate

deft falcon
#

ret-----

ancient grail
#

I dodnt must be a typo?
I just said

What about bullet hits will this work

deft falcon
#

oh lol

drifting ore
#

anyone know how to fix cars not spawning in modded areas

deft falcon
#

you have to add special zones where cars can spawn; similar to foraging

ancient grail
bronze yoke
#

they're not a mapper, the problem is the maps they've downloaded don't have car spawns when they should

deft falcon
bronze yoke
#

i did see errors in your log, but i couldn't make any sense of them, sorry

drifting ore
#

RRRRRRRRRRRRAHHHHHHHHHHHHHHHHHHHHHHHH

deft falcon
drifting ore
#

maaaan ive been spending days getting it working adn idk what i did this time 😦

ancient grail
#

Dont let em get stunned

bronze yoke
#

IsoPlayer:clearVariable('HitReaction') might do it

ancient grail
#

Was that easy? Lol this was on demand mod for pvp server before

#

No one did it cuz everyone thinks pvp sucks

deft falcon
bronze yoke
#

it's just a guess - that should stop the animation, and stuff like that is often tied completely to the animation

deft falcon
#

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

ancient grail
#

Ooo i need to complie all this snippets. Im currently afk

deft falcon
#
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

bronze yoke
#

why the if player ~= getPlayer() then return end check?

deft falcon
#

its misleading and dumb

bronze yoke
#

it would be better to use instanceof(player, 'IsoPlayer')

#

otherwise you're breaking it in splitscreen for no gain

deft falcon
#

so if instanceof(player, 'IsoPlayer') == false then return end?

bronze yoke
#

yeah, or just if not instanceof...

deft falcon
#

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

bronze yoke
#
function cancelStagger(player)
    if not instanceof(player, 'IsoPlayer') then return end
    player:clearVariable('HitReaction')
end
Events.OnPlayerGetDamage.Add(cancelStagger)
```this worked perfectly
deft falcon
bronze yoke
#

yes

bronze yoke
#

your code says if (not player:getCurrentState()) == PlayerHitReactionState.instance()
when you mean if not (player:getCurrentState() == PlayerHitReactionState.instance())

trail lotus
#

anyone looking into making an immersive building mod? where everything is able to be built.

trail lotus
#

i'd love to commision one

jagged ingot
#

Also isn't this a mod already?

trail lotus
#

more builds

#

but its like everything has the same crafting recipe.

jagged ingot
# trail lotus i'd love to commision one

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.

trail lotus
#

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

jagged ingot
#

The Discord forums feature is a godsend.

trail lotus
#

oh my pz server is like terrible rn. there's so much stuff compiled in one area.

jagged ingot
trail lotus
#

yeah the discord forums in the official server?

jagged ingot
#

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.

trail lotus
#

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.

jagged ingot
#

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.

trail lotus
#

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.

jagged ingot
trail lotus
hollow current
jagged ingot
#

Well I mean it's the end of the world.

bronze yoke
#

i left with the impression that it was probably a tiebreaker but i was never absolutely certain about it

trail lotus
#

In fact it’s set in just 1992 Kentucky.

#

β€œProject humanoid”

hollow current
spiral sparrow
hollow current
#

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

trail lotus
bronze yoke
#

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

hollow current
#

Volume in this case is the Intensity, i.e. the second number?

bronze yoke
#

yes, volume is the name used in the code, sorry

hollow current
#

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

bronze yoke
#

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

hollow current
#

--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);

bronze yoke
#

yeah that's what i see most commonly

trail lotus
#

jonny's new police record system for the police on my server

warped valve
hollow current
spiral sparrow
trail lotus
#

LMAO

#

major based

faint jewel
trail lotus
#

i love it skizot

ancient grail
#

Is it possible to define a minimum and maximum to an int variable ?

bronze yoke
#

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

warped valve
#

But that would require an object which might be excessive

worldly olive
#

Does somebody knows where the entire tags list is?

sour island
#

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

bronze yoke
#

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

sour island
#

looking at the code it seems like a cap not a minimum - but I could have read it wrong

fast galleon
worldly olive
bronze yoke
deft falcon
#

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

fast galleon
sour island
#

oh I didn't catch the return 0

ancient grail
ancient grail
winter thunder
#

With items, what function/event do things like taking pills hook onto?

tardy wren
#

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

calm depot
#

you mean a link to the workshop item?

tardy wren
#

Yes

calm depot
#

I have no objections

tardy wren
#

That's what I meant... I guess, advertise

calm depot
#

oh that, I wouldn't call that a bug

#

more like "sub-par feature implementation"

tardy wren
#

Well, it didn't account for multiplayer or... Something. Probably very old code

#

Well, with this, you can now mess with your players

bronze yoke
deft falcon
tardy wren
#

So joining fresh in multiplayer that's ran half a year in game? You have maxed panic reduction from the start

deft falcon
#

ummmm

#

you do realize

#

in multiplayer

bronze yoke
#

didn't they change that at some point?

deft falcon
#

that func is disabled

tardy wren
#

It isn't to my knowledge

deft falcon
#

well it is

#

someone tested

ancient grail
tardy wren
#

I dunno, whenever I play MP, my panic vanishes almost instantly

tardy wren
#

And looking through the code, I haven't found anything supporting that it's disabled

ancient grail
#

Maybe java side?

tardy wren
#

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

weak sierra
#

i might have pointed u at some stuff but i didn't even know about that πŸ€·β€β™€οΈ

ancient grail
#

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

weak sierra
#

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

ancient grail
#

ahh ok sorry bout that my bad

vast veldt
#

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 πŸ™‚

ancient grail
tardy wren
vast veldt
#

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*

weak sierra
#

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

weak sierra
#

you can concat the number directly to a string

tardy wren
#

They said it returns a scientific notation

weak sierra
#

or u can do tostring(number) if u like

vast veldt
#

Trying to display it shows scientific format (e.g. 1.23453E-16)

weak sierra
#

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

tardy wren
#

My guess steam IDs are 64 bit integers

weak sierra
#

long == 64-bit integer

#

same meaning

tardy wren
#

But they could be handled as... Ints in Java?

#

Scientific notation suggests a float tho

#

Or a double

vast veldt
#

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...

tardy wren
#

Okay, SteamID is a long

vast veldt
#

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...)

tardy wren
#

Assuming you can call SteamUtils globally

vast veldt
#

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.

vast veldt
#

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 😬

trail lotus
#

Anyone looking to make a immersive building mod for some moneyyyy

solar tiger
#

any advice for metal working mods?

ancient grail
# solar tiger 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

frank rivet
#

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.

astral dune
#

Finally understand why many of the programming languages I know don't allow multiple inheritance. The diamond problem is annoying af

weak sierra
#

doesn't seem that crazy or difficult to make the language force the programmer to avoid

#

:P

ancient grail
#

Is there a way to know what iso it is vis print? And whats the diff with objects and specialobjects?

astral dune
ancient grail
weak sierra
#

:p

#

it's a very scrappy language

astral dune
#

ya, which I don't mind

weak sierra
#

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

frank rivet
ancient grail
#

That just make it attach to the player?

weak sierra
#

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

frank rivet
frank rivet
weak sierra
#

i did

frank rivet
#

huh

weak sierra
#

lots of potential exploits and oddities like storing items in the "seat" of the skateboard

ancient grail
#

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

weak sierra
#

yes that is what they want.

#

it's a trivial thing to do tbh

ancient grail
#

Sounds easy enough i think

weak sierra
#

just call the existing code

#

and hook it to a context menu item

#

in series

#

pick up -> find item -> attach

frank rivet
ancient grail
#

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

weak sierra
#

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

ancient grail
#

Ow it doesnt store data?
Also the vehicle runs with no gas? Thats still wizardry

weak sierra
#

i have doubts it stores data but i haven't tested it

frank rivet
weak sierra
#

braven's bike mod has even more bugs tho, duplicates itself all over πŸ˜”

#

in mp anyway

frank rivet
# weak sierra 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.

weak sierra
#

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

frank rivet
frank rivet
weak sierra
#

maybe braven fixed it since then idk

#

i guess they did i don't see the note about it anymore

ancient grail
#

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?

frank rivet
weak sierra
#

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

frank rivet
frank rivet
#

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.

bronze yoke
#

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

weak sierra
#

it's fine hardware just old

#

mobile mind

#

my desktop is even older, desktop version of same card, i7 4770k

bronze yoke
#

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

ruby urchin
#

lol I just found out that someone made a bike mod based on my skateboard mod

#

He didn't even give credits

#

*getting mad*

cosmic condor
#

😬

ruby urchin
# frank rivet Would it be too difficult to make a context menu option for Dislaik's Skateboard...

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

cosmic condor
cosmic condor
#

uh oh

weak sierra
#

high zeds + clothing mods -> fps drop

weak sierra
#

that's dirty

bronze yoke
#

new performance save: simply be worse at the game so you need less zombies

ancient grail
#
    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

bronze yoke
#

weight is part of nutrition, not stats

ancient grail
#

is there a way to iterate a table but only produce a 1 line print?

#

i think i saw this before

astral dune
#

a 1 line print that says what?

bronze yoke
#

like the entire table in one line? just add everything you want to print to a variable and print the variable at the end

finite owl
#

Can't you use print(serialize(table))?

astral dune
#

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?

finite owl
#

Someone mentioned it a few days back

astral dune
#

ah ya, dislaik found them somewhere

bronze yoke
#

aren't they just from lua?

astral dune
#

I don't think lua has a native serialize, no, although the pack functions do something similar

finite owl
#

Anyway, serialize(myTable) does work to render the table as a string and has been very handy for debugging.

bronze yoke
#

ah, the reference i was looking at just gives you the code lol

finite owl
#

I haven't tried it on nested tables yet.

#

Hopefully it doesn't die on circular references, they're always fun when serializing things

astral dune
#

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

finite owl
#

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.

astral dune
#

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)}})

finite owl
#

Better than a stack overflow from infinite recursion 😁

ancient grail
#

Found it getNutrition():getWeight()

astral dune
#

had a fun one earlier where I was adding to an array I was iterating through, which lua allows

ancient grail
bronze yoke
#

just do :Say(serialize(table))?

ancient grail
#

getPlayer():Say(serialize(table))

sour island
#

I have a table to string function in my shops mod

#

Includes indents

finite owl
#

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.

bronze yoke
#

yeah my only thought on that is that it probably isn't very useful on say

finite owl
#

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?

ancient grail
#

its really hard to code when carrying an infant 🀣

#

my son is very determined to smashh the keyboard

finite owl
#

Aye, they do that 😁

finite owl
#

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.

trail lotus
#

i hope tis leans heavy on allowing us to instance servers.

finite owl
#

Well, yes, there are many things they could improve, honestly 🀣

modest ermine
#

How models_X differ from models folder?

#

.x extension?

bronze yoke
#

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

rancid cargo
#

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.

latent shore
#

can someone make a quiet place monster that can hear you from 1500m. thankyou if not no big deal. peace gn

faint jewel
#

anyone got a lua that will spawn a tile at a specific coordinate?

ancient grail
#

is it posible to have a moddata contain a table?

#

nvm figured it out

finite owl
#

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?)

winter thunder
#

Anyone here have experience adding UI elements to the game that could help me out rq? Trying to figure out if something is possible

hot patrol
finite owl
#

Hopefully it won't be too buggy 😁 I've already updated with one fix.

hot patrol
#

I'll be sure to test it after work. I plan on adding it to my private server.

finite owl
#

I'm using it in my singleplayer game. Always helps to, as they say, eat your own dog food 😁

fast galleon
#

@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.
astral dune
#

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.

fast galleon
#

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.

astral dune
#

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.

fast galleon
#

print v before / after set?

astral dune
#
(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

fast galleon
#

I'm not sure about KahLua specifics but that right there seems to be your problem.

astral dune
#

what where

ruby urchin
#

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
astral dune
#

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

ruby urchin
#

afaik lua can't access to kernel

astral dune
#

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

fast galleon
#

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.

agile lily
#

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

ancient grail
#

Yr thays most likely part of coords

agile lily
#

That is where I am

#

Oh

#

Hahahah

astral dune
#

its to keep a pool of Vectors with a O(1) removal time

agile lily
#

Just woke up, thanks :^Β£

fast galleon
#

sorry thought it was moddeling

agile lily
#

You got me all confused

agile lily
#

No, generally over the entire screen

ancient grail
#

Ye i know

#

I can use it for heroin blindness effect of my mod

Cuz right now im using a png

agile lily
#

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?

ancient grail
#

And it sucks . Something like that will be bery useful if its like the fade in and out or something

agile lily
#

Yeah, I’d rather not use a simple overlay

#

Exactly

#

This man gets it

ancient grail
#

When i figure it out ill send u a msg and pls do the same if in case u figured it out πŸ™‚

fast galleon
agile lily
#

Sure thing

#

I’ll do some file digging

fast galleon
#

model { model,texture,shader= ...}

ancient grail
#

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

agile lily
#

Do you remember where it was?

fast galleon
astral dune
#

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

ancient grail
#
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

fast galleon
#

You can pop them off whenever they meet your condition.
If o.time == time then pop end