#mod_development

1 messages · Page 366 of 1

willow tulip
#

Instead of ingredient amount based happiness.. Make it based on cook skill and number of ingredients, let you add however much of an ingredient to a meal as you want... And have food poisoning as a chance based on cook skill and gasp cleanlyness so you actually have a reason to wash yourself for a change.

#

Oh... Maybe actually have happyness have a chance to drop massively (even into unhappyness) the more ingredients you add if your cooking skill sucks

#

And ideally some kinda UI so you don't need to rightclick a million things and use the context menu 1000 times in 5 minutes

willow tulip
#

But yea.. like an actual reason to level cooking would be nice. and to clean yourself before cooking

silent zealot
#

That sounds possible, but also like a massive amount of work once you think about the separate components needed

late gulch
#

If you register a new character trait via CharacterTrait.register(), you then need to define it via a character_trait_definition{}.

Do you need to do the same for registering a new ItemType? Can't find any examples of that, but I'm quite new to this.

I'm having trouble registering a new type, and then using it in a item definition via ItemType = foo (getType() returns null). Are those two things even referring to the same kind of "Item Type", or is that overloaded and I'm just not aware of the different kinds?

EDIT: I think these are different kinds of types

willow tulip
#

neat, vanilla added the getting wet if you drive in the rain with no windshield

#
        if (vehicle != null && ClimateManager.getInstance().isRaining()) {
            VehiclePart windshield = vehicle.getPartById("Windshield");
            if (windshield != null) {
                VehicleWindow window = windshield.getWindow();
                if (window != null && window.isDestroyed()) {
                    float val = ClimateManager.getInstance().getRainIntensity();
                    val *= val;
                    val *= vehicle.getCurrentSpeedKmHour() / 50.0F;
fast oyster
willow tulip
bronze yoke
#

you actually explicitly don't want to add new ItemTypes, they just error if an item uses a custom one 😅 i'm not really sure why they made them registries at all

#

they're not really a useful idea for mods even if they did work so it's not a big deal either way

bronze yoke
#

it's been there since b41 😅

willow tulip
late gulch
muted garnet
#

Where is the zombie folder in 42 build? How do I decompile Zomboid in the new build?

quiet fulcrum
#

does beautifuljava not work with 42.13.1? keeps saying my zomboid path is invalid but it had no problem on earlier builds

night bone
#

i dont understand the mods with different cars, i mean dosnt it just change the model of it

#

kinda usless

#

but maybe im just stupid

silent zealot
#

There are other ways, but that tool is by far the easiest way to do it.

muted garnet
molten kernel
#

Hello. Is it possible to change the property of a single object? As I understand it, the set and unset methods of the propertycontainer class change all objects.

molten kernel
bright fog
#

Overall I don't think removing tile properties is a good idea

#

Might cause problems for mods that use those

molten kernel
hot void
#

HEY IAM BACK!

bright fog
mellow frigate
#

is there a simple way to inhibit or reduce a lot the hysteresis between the [player to cursor] direction and the animation angle ?

bright fog
mellow frigate
#

yes

bright fog
#

Are you not using a custom animation already ?

#

Making your own animations and XML should allow you to handle that with fine control

mellow frigate
#

Yeah usually. But for now I am controlling the player, not animations.

bright fog
#

Your solution will be the animation here tho, I'm fairly convinced of it

#

For the horse mod we have custom turning animations and we don't have a single problem with that hysteresis

mellow frigate
#

You're still on animations, I am not interested in that for now. I'll use IsoPlayer.getLookAngleRadians

bright fog
hot void
#

time to test on b42 again

mellow frigate
hot void
#

so body locations changed again ?

bright fog
#

They use registries now I believe ?

hot void
#

i better turn off all mods and fix 1 mod at a time this is gonna be pain in tha arse

hot void
#

sigh all clothing broke cuz proporties changed again

#

🫠

#

and same goes for tattoos

hot void
#

well clothing is fixed ok

#

so next issue is when i open the item spwaner it errors

#

and no base or mods show

bright fog
#

If it errors, read the error too, it can help understand what the problem is

#

Make sure your items are well defined

hot void
bright fog
#

fast teleport move ?

hot void
#

ill try to recreate the error

bright fog
#

Also sometimes to show the full log you need to click play in the debug menu or it won't show the full detail

hot void
#

this is what i mean next to "all" it should show "base" then "exmple-mods"

bright fog
#

example mods ?

#

Maybe the game only shows all if there's only the module Base that exists

hot void
#

i unloaded the mod and tried again it showes "all" and "base"

bright fog
#

Your scripts must be wrong then

main pasture
bright fog
#

I suggest using my VSCode extension to see if you made a mistake in the syntax possibly

hot void
bright fog
#

Do note the extension is still being actively worked on and not every single parameters and script blocks might be documented yet

#

But the majority of it should be fine

#

It'll tell you when it doesn't recognize a parameter or when one is deprecated

hot void
bright fog
#

If you hover it should tell you the problem too

#

Those are the ones I documented as Deprecated

bronze yoke
#

any plan for deprecation messages?

bright fog
bronze yoke
#

usually deprecated objects should have a message associated saying what to use instead

bright fog
#

Rn I use the description

bronze yoke
#

'Type' parameter in 'item' block is deprecated: use ItemType instead.

bright fog
#

But I just thought a replacement link yea

#

I think I need to expand the deprecated message

#
  - name: Type
    deprecated: true
    description: This parameter was replaced by `ItemType` in Build 42.13.
  - name: DisplayName
    deprecated: true
    description: This parameter was removed in Build 42.13, naming an item should be
      done with a translation entry. See the
      [wiki](https://pzwiki.net/wiki/DisplayName) page for more information.
#

Currently that's what it looks like

#

It's done in the description for the most part, but yea it's a good idea to directly have it in the deprecation message

bronze yoke
#

the usual implementation of this is just to let deprecated also take a string instead of a boolean

hot void
#

another complain is using item instead of itemtype

bronze yoke
#

so deprecated: Use ItemType instead.

bright fog
#

And the description does the job of the detailed explanations

#

Like here if I do a text describing for DisplayName saying "Use translations instead.", then people will think that's a parameter

bronze yoke
#

the convention is deprecation messages just say what to do instead, and that's not always a link so it's best to just keep it as a simple string

hot void
#

^

#

its a great tool none the less

bright fog
bright fog
# bronze yoke the convention is deprecation messages just say what to do instead, and that's n...

The problem is that this main deprecation feature when saying what to use instead is not for experienced modders because they will most likely already know about these or know what the text saying what to use instead is about, like if Elictra here is told to use translations, they already know what we're talking about right ? But if users that are new to modding or not confortable with it get that message,, it'll be like I said and they won't know what this is about or what 'translations' are or how it works, or to find info about it

#

That's why I've put it in the parameter description, because when you hover that parameter to get info, it gives you the error message AND right under you have the description of that parameter

hot void
#

fixed it

bright fog
#

So while I agree with having a message to what to use instead, in the case of DisplayName, I really am not sure that's a good idea

bronze yoke
#

you can put exactly the same information you would've put in the description in the deprecation message, i don't see the issue

bright fog
#

I believe one issue I had with such error mesages is that you can't format them as markdown, so links would be thrown in there kind of in a ugly way

hot void
#

tbh its great that it tells you where is the issue to begin with

#

iam already half way done

mellow frigate
#

are there scalable versions of DrawTextureAngle available for UI Elements ? (I found none)

verbal yew
quiet fulcrum
#

does b42.13 mp change the way players health is monitored? Before only the client's player health mattered and the client decided when death occurs, but now it seems it's somewhere else too?

bright fog
#

Consider that anything that could be modified by clients to cheat is not server sided so clients don't handle anything regarding these

quiet fulcrum
bright fog
#

Of course, with MP release for B42

#

In SP it's the same thing

#

I mean than before

#

Since there's no concept of client server

quiet fulcrum
#

so I should adjust player health on both client and server folders?

bright fog
#

No

#

You should adjust it server side only

#

And the folders don't specifically mean server / client side

quiet fulcrum
#

my lua files were in the client folder before

bright fog
quiet fulcrum
# bright fog You should adjust it server side only

still not working. For example, onPlayerUpdate I'm doing player:getBodyDamage():RestoreToFullHealth() and it works fine in singleplayer but no mater which folder I put this lua in, it doesn't work on a server

bright fog
#

That's not how this works

#

You did not read what I sent 😅

#

Only the client folder is not loaded server side, else every folders are loaded by both sides

quiet fulcrum
bright fog
#

So that means your OnPlayerUpdate will run both sides anyway. And when you modify the player stats you need to sync them

#

Not with commands

#

But with specific functions used to sync

quiet fulcrum
bright fog
#

No shit your mod worked fine before B42.13 since MP wasn't a thing 💀

quiet fulcrum
#

mp was a thing in 41

bright fog
#

MP B41 IS NOT B42 MP

#

There's a reason MP wasn't added on release of B42, they were reworking it, and that's part of what they reworked

#

When such things are handled client side, players can make hacks to modify those freely

#

So those were moved server side

#

That means you need to change how you handle all of this

#

When you run player health modifications server side you also need to trigger a sync

quiet fulcrum
#

so I've tried adding a basic code server side player:getBodyDamage():RestoreToFullHealth() during onPlayerUpdate, how do I trigger a sync?

bright fog
#

I'm looking for the function I haven't made a list of them yet

#
        @LuaMethod(name = "syncBodyPart", global = true)
        public void syncBodyPart(BodyPart bodyPart, long syncParams) {
            if (GameServer.server && bodyPart.getParentChar() instanceof IsoPlayer parentChar) {
                INetworkPacket.send(parentChar, PacketTypes.PacketType.BodyPartSync, bodyPart, syncParams);
            }
        }

        @LuaMethod(name = "syncPlayerStats", global = true)
        public void syncPlayerStats(IsoPlayer player, int syncParams) {
            if (GameServer.server && player.isExistInTheWorld()) {
                INetworkPacket.send(player, PacketTypes.PacketType.SyncPlayerStats, player, syncParams);
            }
        }

Possibly one of these

quiet fulcrum
#

still, death occurs on the client even with my server code, so thats the client thinking it should die I guess

bright fog
#

Tbh your mod does something very obscur for the game, so roadblocks could happen

quiet fulcrum
#

I'm very aware, but it was the only method I could get the concept to work

bright fog
#

What I'm surprised is that the player object disappears when you die no ?

quiet fulcrum
#

no, I catch death before it happens

bright fog
#

Hmm

#

Try proper sync yea

#

To start off

quiet fulcrum
#

I actually simulate death at a threshold like 10% of actual health, then fake UI to show 10% health as being 1%

bright fog
#

You probably need to use the second one

quiet fulcrum
#

ok I'll check it out, need to figure out the syncParams

bright fog
#

sync params ?

quiet fulcrum
#

I don't need to pass them in the call? syncPlayerStats(IsoPlayer player, int syncParams)

#

or just player

bright fog
#

@bronze yoke wtf ? Why does it passes bits ?

#

Wait that looks insanely cursed, ok that might not be what needs to be used for health

bronze yoke
#

bit flags

#

you don't need to do that anymore, that's older api seemingly

#

you can just pass the CharacterStat instead

bright fog
#

Probably not that you need to use

#

At least I don't see any enums for CharacterStat related to health, only infection

bronze yoke
#

yeah those aren't characterstats

#

to send health stuff there's statics for the bit flags on PlayerHealthPacket that i'm not sure why they don't just use instead

#

that's what i use

bright fog
#

What do you use exactly to update the player health ?

#

I need to make a list of every syncing functions here

quiet fulcrum
bright fog
#

No I'm asking albion

bright fog
#

@quiet fulcrum

bronze yoke
#

what does full heal cheat do?

quiet fulcrum
bright fog
small topaz
#

I am trying to call a function from a lua class from another lua file of my mod. Specifically, the function ISCharacterScreen.updateAvatar(self, ...). How can I call an instance in my mod's lua so that I am able to call the function?

I know from another situaion that smth like MainScreen.instance.charCreationProfession:resetTraits() can work but I am not able to see how this carries over to my current situation.

bright fog
small topaz
#

Good question...

bright fog
wet sandal
#

Does anyone know how the new buttons at the bottom of the inventories work?

#

I'm running zero mods but I can't seem to make them do anything

#

Nevermind, figured it out. Pretty confusing definition of "type" here from the player perspective

sacred matrix
jagged fulcrum
bright fog
#

But yea there's plenty of projects

#

Most recent one is Leaf

#

Has a lot of potential

jagged fulcrum
# bright fog Never seen Storm anywhere before

Unofficial MP was one
And there is a lot of private fork
Every 6 months someone came with a new one, at the end, nobody use it as SP players don't care with java mod unless it's for better perfs
And on MP, no host let you install it ^^

bright fog
bright fog
#

The Furry mod is one, the body shape mod is one, My Summer Car is a very recent one

jagged fulcrum
#

and a lot don't really requier a java loader, or toolchain
you just need to add a path in your PZ_CLASSPATH and that's it

bright fog
#

That's the point of those Java loaders, to not need manual installation besides a single tool. That's also why I consider Leaf good because it has an easy installer and directly loads Workshop mods

jagged fulcrum
bright fog
#

Oh yea it's definitely fine for sure

small topaz
# bright fog What are you trying to do here ?

I just want to call ISCharacterScreen.updateAvatar(self, ...) manually in my code. This is the function which updates the character's in-game avatar from the character info screen. So I want to update it manually.

The whole system how they update the avatar in multiplayer seems to be different from how they do it in singleplayer now. I do not really understand what's is going on exactly in MP so I am just trying around. Updating it manually might be the easiest fix for me (but possible that it still don't work...)

bright fog
#

Or directly hook to the function that calls this avatar update

frank elbow
jagged fulcrum
small topaz
#

or taking the self from the create function?

small topaz
#

Ok thanks! But I think I just found smth else by trial and error:

        print("TEST_OUTPUT charScreen exists")
        ISCharacterInfoWindow.instance.charScreen:updateAvatar()
end```
The lua ISCharacterInfoWindow.lua seems to be the only one which creates the char info screen via the `new()` constructor. So that's pbbly also a way of doing it.
sacred matrix
jagged fulcrum
delicate solar
#

is that funny ? 🧟‍♂️
https://www.youtube.com/watch?v=OG_Rjx1Kwdw

L'arcade ZomboShooter fut le plus gros carton de Fun Xtreme en 1993.
Les livraisons sillonnaient déjà le Kentucky quand tout a basculé. Hélas, l’apocalypse ne faisait pas partie de notre plan de gestion des risques, le service client est définitivement hors ligne.
Si vous mettez la main sur l’un de ces camions, considérez son contenu c...

▶ Play video
bronze yoke
#

i doubt storm even works without modification in b42, there's no standard of any kind for java modding

#

a couple mod loaders get made a year but nobody makes any mods with them, and if they do they're very niche mods that don't get any attention

mellow frigate
willow tulip
#

getCapacity/setCapacity -_-

silent zealot
willow tulip
willow tulip
#

deletes several comments on his mod because of above

willow tulip
#

and infact, people playing without realistic car physics can play on the same server as people without.

#

Plus it basically rewrites car physics from scratch to actually be.... car-based.

willow tulip
#

But given the number of people who can't copy a folder, I don't dare tell people to edit a carefully formated configuration file.

small topaz
#

In multiplayer, does anyone know how to make the in-game avatar sync'ed with the player's clothing when I equip clothing on server via the command player:setWornItem(bodyLocation, clothingitem)? I tried all the following commands:

sendEquip(player)   
sendHumanVisual(player)  
syncItemFields(player, item)
syncVisuals(player)```
also all of them together in that particular order. Nothing worked for me. The avatar is completely out of place when it comes to sync for me.
silent zealot
# willow tulip

What's the emoji for "I'm laughing because the alternative is crying"?

#

Also, great work on realistic Car physics and when I never put aside time to actually Play a proper game of Zomboid I'm keen to try out Project Summer Car.

bright fog
bright fog
#

It's a json file you need to edit

willow tulip
bronze yoke
willow tulip
#

-_- scary.

bronze yoke
#

as far as valve is concerned if you upload a virus it's the game's fault for running it, not theirs

willow tulip
#

lol

silent zealot
#

If you can upload arbitary java files that the game executes then security is a not a concern.

#

Could be worse though; at a previous job we had a web application so badly designed that the penetration testers described it as "SQL injection as a service"

smoky ingot
#

I know this isn't a popular question, but is there any chance we could develop some sort of mod that allows characters to fight bare-handed? (in b.42) I'm talking about something balanced, nothing overly OP. A series of punches or kicks that can slow down, stun, and knock down zombies (without killing them!), an alternative to pushing (which I've been sick of for 10 years), with the appropriate penalties.

#

is it that impossible to achieve?

#

Is there anyone willing to make something similar to the "Brutal Handwork" mod, but without bugs and slightly more accurate?

smoky ingot
#

My English sucks, so I apologize. I'm not a native English speaker. I wanted to ask if anyone was capable of achieving such a feat. Apparently, it seems very difficult.

bright fog
smoky ingot
#

Not in B.42

#

The idea I wanted to propose was to use a hand-to-hand combat system, obviously by those capable of it with the appropriate skills, that could only slow down and temporarily knock out the zombies, but not directly disable them.

thin swan
bright fog
#

But updating mods isn't that hard

smoky ingot
# thin swan I'm gonna do a mod like that at some point soon, just gotta get through the othe...

Really? 😮 Can you satisfy my curiosity? Actually, two. I've seen online that punch animations (at least 6 or 8, counting the left and right punches) are theoretically already available, like those used in the Brutal Handwork mod. Why can't they be used as easily as the other weapon animations? Second question: would it be possible to make kick animations as well? Or is it too difficult?

smoky ingot
thin swan
# smoky ingot Really? 😮 Can you satisfy my curiosity? Actually, two. I've seen online that pu...

The problem is that when unarmed you can't actually attack, you can only push. So to make a punch while unarmed you have to essentially replace the push with your own punching animations. Weapon animations run on a completely different logic and you have access to stuff like crits and alternative attacks.

Theoretically you can make any sort of punch or kick, or even combos.

The video is as far as I got when I worked on it last, basically just a proof of concept.
I stopped because the player rig I used (paddlefruit's) had a bug, but that has been fixed now so when I have time I will revisit this mod

#

I plan for it to be a full hand-to-hand combat mod, with different techniques and fighting styles, that has skills and unlockable moves, including combos and stuff

smoky ingot
bright fog
bright fog
bright fog
thin swan
polar prairie
#

if i wanted to decrease all melee damage what would it be? local function modifyMeleeDamage(baseDamage) doesn't seem to work.

bright fog
polar prairie
tranquil kindle
#

Pinned comments would be lovely... but then again, not like anyone reads those

bright fog
#

And people will still not read those yea

tranquil kindle
#

Yeah, but if you could just pin comments though

bright fog
#

Ah yea

#

For sure

#

💀

tranquil kindle
#

I HAVE so many "bug" discussions, but noone even uses them and all reports (around 95%) goes into comments

thin swan
bronze yoke
thin swan
bright fog
#

👀

hot void
#

i have a big issue

#

my tattoo parlor mod relies on creating custom body locations and moves it to the top of the render under bandages

#

now the way b42 handles it is very unpleasent

bright fog
#

@winter bolt probably knows how

winter bolt
#
group:getOrCreateLocation(name)
group:moveLocationToIndex(name, 0)
mellow frigate
#

is it me or fbx animations are not reloaded anymore ingame with the new PZ version ?

bright fog
#

@thin swan can probably confirm that's still a thing

thin swan
mellow frigate
thin swan
mellow frigate
willow tulip
#

@thin swan are sounds even synced in MP when issued by the client?

bronze yoke
willow tulip
#

Im doing it in java, but iv been able to create BaseSoundEmitter's and load them up with sounds

#

and adjust volume/pitch

bronze yoke
#

playSound should be networked

#

because in my experience you basically always don't want it to be and have to use playSoundImpl instead to get around it 😅

#

actually, i suppose it would make sense if b42 doesn't let clients network sounds anymore

thin swan
mellow frigate
# thin swan yeah definitely

sorry. I also got it ok when I call the animations from true dancing, but not when I was doing it from the animation viewer

#

Probably I just messed up again

willow tulip
#

(no, I have no clue what the Impl means)

#

and I pass it a null object too soooo shrugs

bronze yoke
#

implementation

willow tulip
#

eli5?

bronze yoke
#

it's typically considered an antipattern to do this, but it's the actual implementation of playing sound, playSound just calls it and then does networking stuff

willow tulip
#

Yea pretty sure when I looked into the game code they used Impl more then playsound so I went with Impl lol

#

or maybe thats just how all the car sounds are done

outer crypt
#

recipe works in sp but not mp, any idea why? It creates the base.Mov_Jukebox

bronze yoke
#

yeah a better name would just be playSoundLocal

#

you wouldn't necessarily not have internal functions for the implementation of things like that but when you do it would always be private

willow tulip
#

Yea

#

and not called from all over the codebase :p

outer crypt
#

even in admin

willow tulip
#

@bright fog yep I think im just going to disable comments

#

people are too stupid and demanding, 90%+ of the bug reports are due to other mods and im sick and tired of trying to reproduce shit.

bright fog
willow tulip
#

and all the comments are 'derp how do I do thing thats in bolt 42point font in the mod description?'

bronze yoke
#

it took you this long? 😅

willow tulip
willow tulip
# bronze yoke it took you this long? 😅

I had hoped some peple would at least be like "cool mod! I love it!" or give useful feedback on fuel consumption and shit but my god its like pulling teeth just to get a user to admit to how much fuel they actually used between two points, and if they are using realistic car physics or not.

#

Literally faster just to test shit myself.

bronze yoke
#

yeah you can't let yourself get stuck in the whirlpool of that bullshit

#

as soon as the comments stop being useful to you just turn them off

willow tulip
#

Bro literally complains about me locking his thread and no investigation after I try to reproduce his stupid bugs clearly caused by another mod that extends PSC and was much higher in the callstack.

late gulch
#

I have an insubstantial resource that's collected on zombie deaths - I don't want players to be able to interact with it, so the amount is stored in mod data on a special item they have to have in their inventory.

I want to be able to use this resource in crafting items, so I think the best approach would be to use onTest and onCreate in the recipe to first check that the special item has enough of the resource, and then update the special item to remove the used resource after the craft, respectively.

Does that make sense, or am I missing a simpler approach?

willow tulip
#

(usages like how lighters/matches have them)

#

plus might show how much of the resource you need in the crafting UI better.

late gulch
#

Ah, I was wondering about a way to indicate "fullness". That might be ideal, I'll look into it. Thanks!

gilded pier
#

I'll pay someone to finish developing a mod I've already started, I just don't know how to wrap everything up. It's a clothing mod. If you are intrested plz dm me

thin swan
silent zealot
jaunty dune
willow tulip
#

I said the C word once in 20 diggity 9, and they are still sending me scam dms.

#

they get upset for some reason when I tell them people pay me.

willow tulip
#

I forget exactly I just remember becoming violently ill upon reading the sourcecode.

small topaz
#

When in multiplayer, it may happen that the server finishes a TimedAction's complete() function before the client finiishes perform()?

winter sun
#

Hello!, im new to project zomboid modding, i would like some basic code snippets including some basic commands that i can use (for example, a script that makes the player constantly nauseous) so i can reverse-engineer something

if this is too much to ask, could anyone point me in the right direction?

winter sun
#

at least spiffo is interested

thorn bane
#

Hoping Omar's infinite wisdom will make a grand appearence again, but I'm overriding a game function where the player creates a faction. I need to figure out how to pass the ISOPlayer that initiated the command, but I'm at a bit of a loss on how or where I would get the ISOPlayer.

Lua Code:

LuaEventManager.AddEvent("OnCreateFaction")

local _createFaction = Faction.createFaction 

function Faction.createFaction(name, owner)
    local faction = _createFaction(name, owner)

    if not faction then
        return
    end
    
    triggerEvent("OnCreateFaction")
    print(owner)

    return faction
end
thorn bane
# winter sun Hello!, im new to project zomboid modding, i would like some basic code snippets...

for the code snippet you're after, it'd just be the following line;

local player = getPlayer()
player:getBodyDamage():setInfectionLevel(100.0) -- 0.00 to 100.00

honestly, the best way to start is by reading the wiki page on modding, which gives you a few pointers and tutorials. at the bottom of most of the modding pages is the Navigation section, which details all the articles related to modding

thorn bane
#

PZ modding is thankfully pretty easy, esp when it comes to player stats. you could randomise every player stat every second if you wanted to

#

as well, you should write down what your mod does, itll help you out with the programming later as well :)

ivory gyro
#

Hey, someone know where i can find this function :
OnCreate = ItemCodeOnCreate.onCreateFlier, ?

bright fog
thorn bane
bright fog
#

Yea but I need to improve navigation on the modding wiki

#

Overall I suggest checking the main Modding page first

mellow frigate
main pasture
#

Any suggestions why my custom vehicle part install/uninstall TimedAction is instantly rejected ("state" : "Reject") in mp, but works fine in sp and with vanilla parts (B42.13)?

main pasture
#

I assume for the TimedAction. I haven't really used them yet, but do you need to configure custom TimedActions for non standard vehicle parts in mp?

thin swan
#

You can just have it return true, or set some conditions that makes it true which will make it proceed with the action

thin swan
main pasture
thin swan
thin swan
main pasture
#

It runs fine in sp, just "add action" and "remove action" printed once. In mp it does multiple cycles of start and remove action with the remove state being "Reject". I have the install and uninstall test set to constantly return true. (Also I can't change the part condition in mp using the mechanics cheat, unlike other parts)

main pasture
tulip valve
#

For some reason, having setGodMod(true) only works when debug is enabled, is there anyway around it?

bright fog
#

It's locked behind anti cheat measures now

tulip valve
#

Fair enough

#

Maybe I can fake it instead

bright fog
tulip valve
#

Im making a mod that lets you use one of the ingame dices and roll the dice to get a positive or negative effect, getting god mode would be one of the positive effects for a short time (1 ingame hour)

fast oyster
#

Anyone knows a better way for me to make a "constant pain code"? I keep getting errors, my plan was to make a pain which forces you to constantly be on painkillers. (lua/client)

hasty oxide
bronze yoke
#

you are getting errors because some of these functions don't exist, are you using ai?

hasty oxide
#

Not really sure where to ask this, but this seems to be where anyone would know. Can anyone help me with how to move a vehicle by cheat? (Or whether it's even possible?) I have a really nice truck that phased into my basement from a bug and I'm trying to get it back out, as it will be a pretty long walk to get a new car.

I've tried to use the command console in debug. I got the vehicle by using getPlayer():getNearVehicle(), but :setPosition(x,y,z) doesn't work as the vehicle phases out (presumably to where I want it) in one frame but comes right back the next frame.

ivory gyro
#

Hey, someone know where item icon is in the media folder ? Didnt find it in the texture folder

mighty ether
#

is there any getPlayerFromUsername() equivalent on the server side? getPlayerFromUsername() doesn't return anything when used on the server, and using getPlayerByUserName() just results in an "attempt to call nil value" error

placid bobcat
#

Hmm, someone knows if there is allready some API for all the atmospheric stuff in B42 (Oxygen, Gasmask, fumes etc..)

thorn bane
#

Hoping Omar's infinite wisdom will make a grand appearence again, but I'm overriding a game function where the player creates a faction. I need to figure out how to pass the ISOPlayer that initiated the command, but I'm at a bit of a loss on how or where I would get the ISOPlayer.

Lua Code:

LuaEventManager.AddEvent("OnCreateFaction")

local _createFaction = Faction.createFaction 

function Faction.createFaction(name, owner)
    local faction = _createFaction(name, owner)

    if not faction then
        return
    end
    
    triggerEvent("OnCreateFaction")
    print(owner)

    return faction
end
fast oyster
#

plus, i dont think my logic is working. i want the pain to fade in as the time goes by but im pretty sure my code is trying to make it constant

thorn bane
bright fog
#

Is that a client sided function ?

thorn bane
#

Although thinking about it, I could probably make a function that uses a username as an arg and find it that way

bright fog
#

getPlayer() if it's client sided

#

That'll get the client player

thorn bane
#

Oh wait, it's in my server folder

bright fog
bright fog
thorn bane
thorn bane
bright fog
#

If that's the receiving end of the player creating a function, then it's server sided, if it's the function that sends the info to the server then it's client sided

#

You need to go read what that function does to understand which side it triggers on

thorn bane
#

that makes sense, ill dig a little deeper then. Thanks Sim!

bronze yoke
willow tulip
#

@bright fog Man its nice waking up to NOT another list of bugs due to other mods and people who can't read the FAQ nevermind the mod description

bright fog
outer crypt
#

We used to be able to change tile definitions when the game loads. Of course 42.13 doesn't like this command, has this changed or been removed? properties:Set(IsoFlagType.container)

outer crypt
willow tulip
#

95%+ of porting realistic car physics was just me renaming variables

outer crypt
#

I understood Val to get and Is to has... I had no idea they changed Set to set and UnSet to unset. crazy, thakfully find and replace is my friend.

#

Thank you guys for bludgeoning into my head. Took a minute to sink in.

bronze yoke
willow tulip
#

I was like ".... but why?"

outer crypt
#

I know items are server controlled now, will they or have they implemented a command to add an item to a player from the client as before? Perhaps a command that the client initiates and the server responds to it? So far I have been doing it with client server send commands but it seems redundant for every mod to do that.

bronze yoke
#

no

placid bobcat
#

Well after decompiling and check that gas mask system myself a bit to understand what it´s actually protects me from, I am a bit dissapointed. Had hope they had somehow...allready a bit more in it , or well.. maybe I expected simply some atmospheric system but thinking of it, I think, they never really talked much about it in their blogs...eh well..time for my bed.

willow tulip
willow tulip
#

but prob just annoying

willow tulip
#

because.. that is exactly the kinda thing cheaters exploit to create any item they want.

#

by having item creation be based on timed actions that are run (moreso) server side, the server can verify you have the items/materials/conditions/etc required to do <X> and only reward you with <Y>

#

also makes it harder to cheat on things like skill passes/fails, etc.

outer crypt
#

I get it, until I learn that system I will figure out a way to make it work for now. 🙂

willow tulip
#

yea, the nice thing about timed actions though is they do the 'networking' for you

#

the constructor gets 'replicated' from client onto the server, and then your complete() function gets executed on the server for you.

#

It changed timed actions from 'Why do I have to create another one of these stupid things for everything I do' to 'oh, yea, a simple timed action will take care of all the networking and half the syncing stuff for me'

#

plus timed actions just feel better

#

the ability to have a sound, animation, item held in your hand, etc and the actual action to take at least SOME time, even if its like a token 2 second delay, just makes it feel like your character is really doing a thing vs you just clicking a UI

bronze yoke
#

i still think they're awful to work with and 99% boilerplate

#

it's just nice that you don't also need the commands boilerplate on top of that anymore

willow tulip
#

at least they have some 'magic' to them now

#

and give people a more standardized way to impliment secure actions

bronze yoke
#

it's not really 'standardised' it as much as it's made it possible at all

#

genuinely trying to make anything remotely secure in b41 was a complete waste of time, the client could do anything and any new exploit your mod exposed was not as bad as the exploits already available

small topaz
#

When it comes to anti cheat, have the TIS devs said anything about whether they want to expand their anti-cheat system further?

bright fog
stuck tapir
#

Is adding an item to the backpacks of zombies possible through a distribution file similar to the (procedural or suburbs distribution file) or does it require a more bespoke lua function?

bright fog
#

I never remember where tho

small topaz
#

When writing stuff to the player's modData only on client-side when in MP, they won't be stored permanently and will be lost when the client player logs out from the game?

verbal yew
tight elm
clever crow
#

Hi everyone!
I'm trying to build a mod for the first time. I'm a bit confused how I suppose to add a trait.
I followed the pzwiki modding guide and also took a look how mods, like MoreTraits, do it, but I missing something when I try to build it from scratch
Any suggestion?

Never mind, it was just a typo 🤦‍♂️

bronze yoke
small topaz
#

So I am trying to manually send my modData to server. The modData is a nested lua table where the data are all strings and integers. Strange thing is that when receiving the command from client, the server says the args are nil.

Here is my code from client:

sendClientCommand(player, "rasBodyMod", "createPlayerOnServer", {modData = data})```

My code on server:
```local function onClientCommand(mod, command, player, args)

    if mod == "rasBodyMod" then 
       if command == "createPlayerOnServer" then

            print("TEST_OUTPUT ", args) -- outputs "nil" !!!!

            local data = player:getModData().RasBodyMod
            if (not data) or (not data.ModVersion) then 
                data = args.modData     -- error because index modData of non-table: null!!!   
            end                                            
            sendServerCommand(player, "rasBodyMod", "createPlayerOnClient", {modData = data})
        end         
    end
end

Events.OnClientCommand.Add(onClientCommand)```

Is there anything obvious I am doing wrong here? I think sending nested tables with only primitive data works in other situations for me.
bronze yoke
#

i can't see anything right away

#

the issue probably isn't to do with the contents of the table, invalid pairs just aren't sent so at worst you should be getting an empty table

small topaz
#

Its strange since I can reproduce the error whenever I run the code. And it is not "args = {}" but literally "args = nil"....

bronze yoke
#

ah, i see

#

if args is empty, nil will be sent

#

if player:getModData().RasBodyMod returns nil then your table would be empty

#

so that's likely it

small topaz
#

Ahhh! That makes sense! So it is pbbly only a pure lua issue since a table with {key = nil} will simply not be created?

#

and yes... in that situation, it is indeed possible that data is nil, so...

bronze yoke
#

it does creates an empty table, but sendClientCommand just ignores empty tables

#

i didn't actually know about that behaviour, will have to write it down somewhere or it'll get me too 😅

small topaz
#

Good to know. So I should add some general if args == nil checks to my server code to prevent bad client-cheaters from generating server errors. XD

small topaz
#

Also, when trying to store the modData on server, is it necessary to do it "field-by-field"? In my above code on server, I just do

data = tableComingFromClient```
This does not seem to work currently. Maybe I have do it field-by-field instead? Smth like
```data["key1"] = tableComingFromClient["key1"]
data["key2"] = tableComingFromClient["key2"]
-- and so on ...```
?
bronze yoke
#

local data = player:getModData().MyMod = create a new local variable called data, and set its value to player:getModData().MyMod
data = tableComingFromClient = change the value of the local variable called data to tableComingFromClient

#

you're not changing the table when you do that, only which table the variable has

small topaz
#

so, then

data.MyMod = tableFromClient```
should do the trick?
bronze yoke
#

yes

small topaz
#

Stupid mistake by me. lol. Should have known and have used it 1000s of times correctly. But MP modding is so complicated for my mod. So I am a bit mentally exhausted at times...

trim yacht
#

Any guidance on reporting bugs found from modding? I reported a CTD bug that occurs whenever aiming a gun at a zed who has has zed:setSkeleton(true) and it was moved to a "mod help" forum. I have another I need to report and just need some steer

trim yacht
bright fog
#

Really ?

trim yacht
#

lol. Ye. It will be.

bright fog
#

That's recent

#

Also I'm surprised they moved your report to "mod help" forum

#

Because modding bug reports don't get moved like that, I've made a few without any problems

#

What did your post look like ?

trim yacht
trim yacht
# bright fog What did your post look like ?
bright fog
#

That's your bug report ????

trim yacht
#

Maybe was just the wrong format or someone assumed I was complaining about a bug

bright fog
#

You didn't even follow their template mate 😅

trim yacht
#

with a mod

bright fog
#
The Indie Stone Forums

Version: [42.12.3] Mode: [main menu] Server settings: [N/A] Mods: [Controlled example mod to reproduce bug] Save: [doesn't matter] Current system: Linux Mint 22.2 (was present in 22.1 from my knowledge) Reproduction steps: 1- Create a simple example mod 2- Define a mod.info file for your mod, pla...

#

This is how you report a modding bug 😅

trim yacht
#

True, but it also states mods have to be disabled... so... meh.

bright fog
#

Often in my bug reports here I mark it as a controlled example mod used

#

And I provide the full mod in the report

#

Usually it's a few lines of Lua and it's enough

#

In your case it's extremely easy to make such an example code

trim yacht
#

Sure. Makes sense. Ill go make sample mods to demonstrate the issues

bright fog
#

Problems with your report:

  • you don't follow their template
  • you don't provide a simple controlled code to trigger the bug
  • you provide a log file that doesn't give any info on the problem (you're supposed to give your console.txt)
trim yacht
#

All right dood. Ill be way more vigilant in reporting bugs

bright fog
#

I just saw too but you don't even provide steps to reproduce, and you provided a fucking chatgpt chat log ???? 😭

trim yacht
#

Geezus man, I was just trying to help

#

My bad

#

Don't sweat it, Ill not report any other issues without a full example installation and detailed walkthrough to repro.

trim yacht
bright fog
#

@trim yacht why do you use saveGame in the first place ?

trim yacht
#

To save the game before shutdown. Is there a better method to save the game that I am unaware of?

trim yacht
#

Its part of a mod that triggers a controlled shut down the server in the event a mod updates. Many hosts will auto restart or others use cron or other services to restart the server which in turn updates the servers modlist so your players can connect

bright fog
#

Yea so that's udderly up to date or whatever it's called that you're readding ?

dull chasm
#

where should i start with making a mod that just rotates rifles attached to the back to have their bore up

dull chasm
late gulch
#

I have an item that, onCreate, gets some mod data generated for it to hold a custom property. This is fine when the player crafts it, but what about when it's spawned as loot in the world? Does onCreate get called then, too? edit, it does, according to the wiki: "...when the item spawns."

Aside: is there a better way to track some custom property for an item - a read-only value that just needs to be looked up by certain custom lua actions? Or is mod data The Way?

bronze yoke
#

mod data is the way

mellow frigate
#

I just went into a barricaded house when trying a pseudo playthrough for mod testing. I think I've heard about those.. good times.

silent zealot
#

Since pre-defined custom building adjustments are done via "Random Buildings" but restricted to only being possibel in one location.

#

And they are hardcoded in Java because why should it be easy to add more content via lua scripts when you can hard-code it all into custom java classes instead?

worn geode
#

Is there a good place/resource to learn PZ Mod Making? I know the JavaDocs and LuaDocs exist just... idk reading documentation never has worked for me, i need to more follow a guide to be able to understand it, like its all well so say:

isoObject
IsoObject ISBuildPanel::isoObject

but this doesn't really tell me much

pearl fox
#

Hello,
I have questions.
This line work in B41 : player:getStats():getAnger()
But it don't work on B42.

why ?
what is the same line in B42 ?

dry oar
#

Has the mod structure been changed in build 42.13?

thin swan
robust locust
#

Am i right in thinking that adding the registry.lua file in media will automatically convert identifiers?

#

or am i dumb?

silent zealot
#

Not guarantees that the mod you look at is the best way to do things, but it's a way to do things.

silent zealot
#

So when the file is loaded if calls NepOnFireTrait = CharacterTrait.register("nep:onfire") and stores the return value in NEPONFIRETRAIT

robust locust
#

ok kool... i wish i could fully grasp what that all means, lol

#

so... i don't need to change anything in the script files?

#

looking through all the pdf's, theres a lot of changes to do

silent zealot
#

The scripts are all changed too lol

#

You need to use registries.lua if you need to make any new "registries" but not for using existing ones.

#

The syntax for (almost) everything is a bit different, since you're now refering to "registries" instead of arbitary text:

ItemType = base:weapon,
Categories = base:smallblunt,
Tags = base:hammer;base:ballpeenhammer;base:smithinghammer;base:hastoolhead;

In theory DisplayName is no longer used and is instead read from the tranlation files, in practice you can still use it and it will be the name for en_US.

The best reference is the vanilla definitions.

bright fog
silent zealot
#

it's still functional:

#

I was suprised when I tested a mod and it was fine without adding the translation files.

#

Obviously I should add the translation stuff so it doesn't break in the future when they actually remove it, butt I have so many other things I need to fix up I'll probably forget and not do that until everything breaks.

bright fog
#

People had issues with DisplayName not working anymore so i'm surprised about what your saying

#

Bcs before it was getting obsolete and in B42.13 I'm fairly certain it was removed ?

silent zealot
#

My Lewis gun mod still shows item names without it. ¯_(ツ)_/¯

#

If you search decompiled B42.13.1 for "DisplayName" it's in Item.java

#

Maybe they added it back in 42.13.1 after realizing it was going to break too many mods without a good reason?

bright fog
#

Soooo I must be missremembering that's weird

silent zealot
#

"break" as in "WHY DOES UR MOD SAY item_base.NepLewisGun PLZ FIX???!?!!"

willow tulip
#

No really, we're also in the universe where thinking about it too hard gives you a stroke.

bronze yoke
#

displayname never stopped working afaik

#

what's funny about this is i've looked over the code for it a couple times and i can't work out why it works 😅 it seems like it should always be overridden by the translator, but obviously it isn't

willow tulip
#

What is the thing with some recipe mods not working in MP anyway?

#

I don't even get how thats possible.

bronze yoke
#

one of the causes is for some reason only module base works in multiplayer

willow tulip
#

... of course it does.

#

man am I ever glad I don't follow best pratice but lazy pratice instead.

#

for all the modders TIS hires, it sure would be nice if one of them made a test mod that had to be validated as working by Q/A whenever they change stuff.

#

or just.. impliment stuff like namespaces

#

Isn't there like, 5 different bugs with namespaces now?

mellow frigate
#

if you press escape and select quit while in the Animation Viewer, the Animation Viewer is hidden by a "black quit screen" but quit is not yet engaged letting you (at least me) think the game is stuck. In fact it is not, the quit sequence is just waiting for the Animation Viewer to be exited: press escape to get rid of the black screen, click exit and then the quit sequence continues.

full flame
#

Hi, can anyone tell me how to fix this problem? When I attach the trailer to the car, the trailer starts moving at a distance, not with the car.

mellow frigate
#

Don't be like me, and rage Alt+F4 pz_triumph

mellow frigate
full flame
willow tulip
# full flame

You must have 'trailer' in the base.trailerthingy name of the trailer for it to act like a trailer

#

else it tows like a car.

#

(not the translated name, but the ingame script name)

willow tulip
#

post your cars .txt file

#
module Base
{
    vehicle ModernCarLightsCityLouisvillePD
    {
        zombieType = Police,
        specialKeyRing = Base.KeyRing_EagleFlag,
        model
#

its the part after vehicle

#

it has to say vehicle McTrailerFace or something. has to have 'Trailer' in it (case sensative?)

#

(yes, that is literally how the game detects trailers... and there are checks for it all over the codebase)

full flame
#
{
    vehicle vehicle_trailer_LastPresident
    {
        neverSpawnKey = true,
        mechanicType = 1,
        offRoadEfficiency = 0.8,
        engineRepairLevel = 4,
        playerDamageProtection = 0.8,
        model
        {
            file = Vehicles_TrailerAdvert,
            scale = 1.82,
            offset = 0.0 0.6813 0.1813,
        }
#

The trailer is specified

willow tulip
#

Case sensative.

#

"Trailer"

full flame
willow tulip
#

if (!this.getScriptName().contains("Trailer") && !vehicleB.getScriptName().contains("Trailer")) {

willow tulip
willow tulip
full flame
willow tulip
#

np

#

its dumb they don't just have trailer = true,

worn geode
unreal pewter
#

has anyone yet found a way to reliably set the infection level echaracter stat to a specific number? the set function for it gets overridden for some reason due to the infection timer, and the only way i can change the infection level is to set the infection timer to -1, wherein the infection level resets to 0. if you set the timer to 0, the player instantly dies. i cant figure out any other numbers that actually do anything. has anyone figured out how this works because its kinda a black box for me

bronze yoke
#

infection time is literally the timestamp that the player became infected

#

instead of accumulating infection level the game just calculates how long it's been since the player got infected and sets their infection level based on that

#

-1 means they were never infected, 0 means they were infected at the very start of the game -- this kills you because it's likely several days ago and you would have died of infection by now

unreal pewter
#

ohhh my god that makes so much sense

#

how is the timestamp saved? hours, minutes, etc?

bronze yoke
#

i think it's hours

#

most timestamps are

unreal pewter
#

i can test that much on my own but ill assume hours

#

thank you

willow tulip
tall sapphire
#

Hi all, working on a little mod right now, and I need some help figuring out if I can create a new fragment shader, replacing the car fragment shader, and then pass it arbitrary parameters from lua. I've been looking for a bit into how other mods might do it, but so far I have not seen any that do specifically what I want. I decided to come to this discord server to see if anyone else has tried this, or if it is not possible at all with the functionality that we are given

#

I do know I can replace the car shader

#

However, I would like to do that, and then also pass it new float/vector parameters (no new textures or anything)

bronze yoke
#

you cannot add uniforms

tall sapphire
#

well crap.

willow tulip
#

Yea you'd need to poke at the java

tall sapphire
#

that's kind of what I was assuming... Unfortunate...

willow tulip
#

what effect where you trying to add?

tall sapphire
#

Essentially the idea was to be able to have car parts maintain their own colour vector and then when being attached to a car, they would be a different colour from the base car.

main pasture
#

You can always biggy bag on the already existing variables. Very limited and a little jank, but I do it with my license plate mod

tall sapphire
willow tulip
tall sapphire
#

yeah, I am sure it would be

willow tulip
#

Not too many people swap car doors and stuff around either

bronze yoke
#

yeah i actually looked into exactly that but couldn't see a way to do it

tall sapphire
#

Yeah, that is true in most cases, unless you're using another mod that spawns vehicles without doors/hoods/etc (project summer car)

main pasture
#

I was able to pass the shader 48 bits without negatively affecting anything

main pasture
#

Could be more if you try harder, but that was enough for me

willow tulip
#

Mental note, never shrink a window past oblivian size.

main pasture
#

Nope. Haven't finished it

tall sapphire
#

oh okay

main pasture
#

That one uses UI

bronze yoke
#

48 bits would be enough for a colour

tall sapphire
#

gotcha. I just searched up license plate and hoped to find your thing hahah

willow tulip
#

yea in 8bit int

tall sapphire
#

could manage to do a colour in 24, so you would get two colours with 48

willow tulip
#

TBF if you don't mind 256 color pallette you could fit... 6 colors in 48bits?

willow tulip
tall sapphire
bronze yoke
main pasture
willow tulip
#

ah

#

IIRC the opengl space is something like 2048 uniforms (or was it 2048 bytes of uniforms? something like that)

#

so if it handles bigger types it might handle MUCH bigger types.

main pasture
bronze yoke
tall sapphire
#

actually, I wonder, are you allowed to make more visible components than the vanilla vehicles have? Eg. 6 doors, 8 doors, etc etc

main pasture
#

You can make custom parts with models

tall sapphire
#

I assume not, as the shader only has 4 doors

#

could you pass the part health in?

main pasture
#

They disappear when you remove them, but they can't have separate overlays. You have to use one of the existing mask segments

tall sapphire
#

bleh, alright

#

wait, is that assuming no modification of vehicle.frag?

main pasture
#

Yes. But if I remember correctly the removed part array was handled in java. If you pass the part condition other way, then you could make it work. Just add new mask colors to the shader and handle them the same way

silent zealot
bronze yoke
#

power is probably the most egregiously hardcoded system in the game

worn geode
# silent zealot Power is weird. (And also changed since I last dealt with it). What is your mod ...

Community server I play on wants to to have AC Radios, like radios powered via the Grid or Generators, so like being able to take a ham radio and idk adding 1 electrical scrap to turn it into an ACRadio [Ham name] would be nice then then it just has the placeable tag and not moveable or whatever it is. Like i can find in the javadocs hasElectricy() so I should be able to do square:hasElectricty() for a power check but its the converting. A lot of the powered radio mods just do UseBattery = FALSE as I assume they look at the TVs code and see that, but they dont actually do a power check or anything else so a hidden battery is there and just drains away so once the "Powered Radio" stops working you have to change the batteries out lol

#

idk like i'd like to look at some more usecases for coding, sure i could look at mods themselves, but idk reading the few mods ive looked at none of it makes sense to be lol

mellow frigate
#

is it normal that a call to myIsoGridSquare:getS() returns nil ? is this interface obsolete ?

small topaz
#

According to TIS' new API doc from their website, we can use item:syncItemFields() to sync the item's weight we manipulated on server-side with the client. Can anyone confirm that this works as intended? Because for me, it seems to not work.

bronze yoke
#

in that case it would be expected to return nil

mellow frigate
#

I must have messed something up but I do not know why.

#

Anyway I use getCell:getGridSquare and all is good.

bronze yoke
#

it's possible that it just doesn't work properly anymore, i have used it in the past but not any time in the last year at least

silent zealot
#

Recent changes to the way power works broke the mod (it's now a "hide the battery from the UI" mod) and I need to figure out a fix for that

worn geode
willow tulip
#

I feel like the fix is making it recharge the battery (and not allow you to remove it if its been recharged? at least not till dead) when plugged in?

#

though that might make a lot of batteries harder to get...

silent zealot
#

So the fix needs to find where the radio charge is getting updated and do something there

#

Since setIsBatteryPowered() no longer works properly

willow tulip
#

ie, if it discharges at 0.4 units per minute when on, you just charge it at 0.4 units per min when on.

silent zealot
#

And how exactly do you charge it? That still required finding a way to edit the radio's charge AND fidning where that gets changed normally

willow tulip
#

Or record its current charge in some backup mod data, and once that charge is stored, ignore the vanilla charge

silent zealot
#

Again, how do you ignore it?

willow tulip
silent zealot
#

That is handled in java.

willow tulip
#

do you know the class name?

silent zealot
#

DeviceData

#

update() is where chareg gets used.

willow tulip
#

dumb name lol.

silent zealot
#

isBatteryPowered is how I managed this previously, but that no longer works.

silent zealot
#

It does radios/CD players/TVs.

willow tulip
#

Hmmm

#

float pdmod = this.powerDelta - this.powerDelta % 0.01F;
this.setPower(this.powerDelta - this.useDelta * (float)diff);

#
        if (p > 1.0F) {
            p = 1.0F;
        }

        if (p < 0.0F) {
            p = 0.0F;
        }

        this.powerDelta = p;
    }```
#

is DeviceData exposed to LUA?

silent zealot
#

Yes.

willow tulip
#

yea, so id try setPower

#
public void setInitialPower() {
        this.lastMinuteStamp = this.gameTime.getMinutesStamp();
        this.setPower(this.powerDelta - this.useDelta * (float)this.lastMinuteStamp);
    }
#

looks vaugely useful too?

#

setPower(1) should presumably fully charge the battery?

worn geode
#

also i assume CarBatteryCharger code is hard coded? considering it doesn't specify what batterys can be used?

silent zealot
#

That still needs a trigger to call it

willow tulip
#

Or just hook any of the LUA that radios call?

worn geode
#

on every tick 😉

silent zealot
#

...which then requires me to track every radio in the world

willow tulip
#

track the radios someone entered the UI of?

worn geode
#

are you able to track radios that are On?

#

cause then you could target that

silent zealot
#

It does some tests and then calls setIsBatteryPowered()

#

Except for some reason teh power drains evern when isBatteryPowered is false.

willow tulip
#

yea its not listening to it.

silent zealot
#

I don't wantto keep track of all radios (which would likely be a performance issue to, checking hundreds of radios to see which are loaded and going through teh power checks for each of them)

willow tulip
#

looks like it should still be listening to setIsBatteryPowered though

silent zealot
#

I know! And the save/load for the variable is in the object

willow tulip
#

Doesn't look like its syncing it though

#

is your mod working in SP?

silent zealot
#

Nope.

willow tulip
#

Hmm.

silent zealot
#

So whatever the issue is, it's not obvious.

#

If it was MP only having issues then it woudl be some sort of syncing the DeviceData object issue

willow tulip
#

yea

#

I can't see any reason isBatteryPowered isn't working. (java code seems OK)

#

can you randomly log that its still set properly after you set it?

silent zealot
#

I'm adding more logging right now. 😛

willow tulip
#

Good plan

silent zealot
#

At least I can see how to sync the client w/ server for MP: devicedata:setVolume(devicedata:getVolume())

#

since the sync function is private butting setting volume will force a sync

#

No, wait, that does not send isBatteryPowered so MP will need it's own event handler AAARGH

#

...but I'll fix SP first

bronze yoke
#

you just have to loop over the list every so often

silent zealot
willow tulip
#

(not nessecarly in that order)

silent zealot
#

That sounds easier than actually syncing them lol

willow tulip
#

If they didn't want me to sync fluid containers this way, they should have A: given me working fluid container sync for objects in a car trunk, and B: not given me a handy dandy function to copy the entire fluid container

silent zealot
#

That would be a hassle for radios, because you would need to copy all the data on stored channels/current channel/volume/battery life/etc

#

I'm not sure how much that will happen automagically, and it's worse because radios can be inventory items or ISO world items

full flame
#

Hi! Why don't my game files have all the car textures, but only a few?

wraith flame
#

who got lua soup

full flame
wraith flame
#

who be doing ontick

willow tulip
#

also check the .pack file viewers/extractors

silent zealot
# wraith flame who be doing ontick

Mostly people who shouldn't, but there are legitimate reasons to use ontick. But you need to be careful careful and add appropriate limits and/or "only run every X ticks" type stuff to avoid performance issues.

willow tulip
#

im kinda annoyed there is no realtimesecond callback

#

minute is.. kinda iffy based on timescale

wraith flame
#

i learned from five m days

#

its better to do event based

robust locust
#

Hiya peeps.
For modData, does that sync for all MP players?
My mod does a check on buildings and then marks them off as complete and saves to modData. Would that persist for other players, so that those buildings would be already marked as complete?

mellow frigate
#

if the object is changed server side, the transmit function should be enough.

#

if the object is changed client side, I do not know.

robust locust
mellow frigate
robust locust
#

my mod's debug logs has building numbers, so "building 1 checked...", not sure if that numbering is used "globally" tho. but i think PZ creates the building numbering..
It basically finds a valid building, checks for valid walls, runs a chance for spawning there, then when all rooms are checked it marks the building as complete and stores to modData.
This is so the same building is only processed once, and lots of items arent spawning.

#

another quick question:
is this correct:

mellow frigate
robust locust
#

but how do i make it compatible with another mod?

#

it used to work just looking for the tag, which was the same for both mods

silent zealot
#

for a custom registry, that means the only (sane) way to get the registry object is to assign it to a global variable when it gets created.

#

registries.lua:

NEPONFIRETRAIT = CharacterTrait.register("nep:onfire")

Then in a script:

    if player:hasTrait(NEPONFIRETRAIT) then    
#

Also I meant to reply to @robust locust since I was agreeing with Tchernobill and giving more info. Oops.

robust locust
#

oh...

silent zealot
#

Same thing for hasTag, vanilla stuff is already in exported java thingies so you can do item:hasTag(ItemTag.CUT_PLANT) but there is no equivilent to get a registry entry thatt you added. You'd think there would be a getRegistyEntry(string namespace, string name) but... nope.

robust locust
#

I was somehow using this, and it was working in it's own mod

GWH = GWH or {}
GWH.Tags = {}

-- Helper to register and store
local function registerTag(tagName, key)
    GWH.Tags[key] = ItemTag.register(tagName)
end

-- Register custom tags for GWH mod
registerTag("GWH:VanillaAcoustic", "VanillaAcoustic")
...
knotty saffron
#

anyone knows if exist a b42.13 mod to allow sleep fast forward in multiplayer games?

main pasture
#

It already does that in vanilla when everyone is sleeping

mellow frigate
#

in B42.13.1, I started sleeping with one character while the other was awake. when I disconected the awake one, the sleept one continued to sleep and the server stayed as gamespeed 1.

#

Is there something to do to synchronize the variables of my player in MP ? (those set by setVariable & clearVariable client side)

small topaz
#

Tbh, my current impression is that around 90% of the new sync commands do not work for me (for example when changing, item stats on server, sync it with the client afterwards via the new sync commands).

Is it possible to sync manullay? Just sending a sendServerCommand to client and then manually adjust the properties on client?

robust locust
#

If i have 1 mod adding custom tags, and another mod that references those, I dont need to register the tags for both, right?

bronze yoke
bronze yoke
robust locust
#

so in the items script, the tag property would then just be "Acoustic", rather than "mod:acoustic".... and in the "parent" mod it has the full "mod:Acoustic"....?

bronze yoke
#

both need the full thing

mellow frigate
robust locust
bronze yoke
#

whatever you registered the tag with

robust locust
#

my modnames are GWH and HMW.
GWH is registering the tag.
In HMW, I put
item.....
Tag: GWH:...
?

bronze yoke
#

the name of the mod doesn't matter, it's just the string you gave it when you registered the tag

verbal yew
#

i think u can do this for tag

#

work for me

robust locust
#

the only problem im seeing in only registering the tag for 1 mod and not the other is if they only use the mod that isn't registering it... as it isnt dependant on the other that is registering it

quiet fulcrum
#

can anyone point me to any code example of making a server command like "/foo 123"?

robust locust
#

i need them to work independantly

silent zealot
#

If you can't make one mod require the other, can you put a separate tag in each and just check for either tag in your code?

#

With check to see if the global is nil, which means the other mod is not active

small topaz
# mellow frigate all those I tried worked. indicate here one that failed to get help.

I tried this on server (and in the middle of a game, not on first tick):

item:setActualWeight(0) 
item:syncItemFields()```
On the client, the player inventory still shows the item's original weight, so it is not synced for me. Instead of `syncItemFields()`, I also tried `sendItemStats(item)` and I also tried to combine each of them with `item:setCustomWeight(true)` and `sendClothing(player, item:getBodyLocation(), item)`. Nothing worked for me.
#

Maybe it is the case that those sync commands can only be used in a TimedAction? Because I use them elsewhere.

mellow frigate
small topaz
#

I already tried setCustomWeight(true), but only before I used the commands. Is it necessary to put it after????

mellow frigate
#

are those items in player inventory ?

#

if so: sendEquip(self.character)

small topaz
small topaz
mellow frigate
#

as a reference, you will find good exemples in ISUnequipAction. for the wieght, I did it for MakshiftRaft but I think I was lucky first time

small topaz
#

I think I alreay looked at this action but I probably didn't notice that the ordering is important. I'll give it a try now.

mellow frigate
#

I am not sure for the ordering, but I'm sure it works in the end 😉

small topaz
#

Order seems to be a thing, cause

item:setActualWeight(weight);
item:setWeight(weight);```
with the `setCustomWeight` doesn't work for me.
mellow frigate
#

sendServerCommand could be tempting as it is a one solution for all problems. but there will be bad surprises / side effects over time in addition to more code in your mod

small topaz
#

My code uses the manual send commands quite a lot already. Except for those special predefined sync-commands, it seems to run quite well. (But was a hell to implement and test everything.)

normal moth
#

Does anyone know how I can spawn modded items into my character in debug mode or something??

I want to make sure this looks right, but it's a rare item.

small topaz
small topaz
mellow frigate
small topaz
mellow frigate
robust locust
#
Acoustic = ItemTag.register("GWH:Acoustic")

is this even correct?

#

i've managed to break it even more lol

bronze yoke
#

you can 'safely' init a tag like this```lua
if not ItemTag.get(ResourceLocation.of("GWH:Acoustic")) then
Acoustic = ItemTag.register("GWH:Acoustic")
end

robust locust
#

🙃 for each tag?

bronze yoke
#

it does kind of sound like you should maybe just have two separate tags if the mods aren't dependent on each other, but i don't know what they do

small topaz
# mellow frigate yes, when dropped on ground.

Hmm... so the vanilla system is somewhat weird, maybe buggy by itself.

There are also similar constructions in the vanilla TimedAction ISClothingExtraAction. For me, this action is already bugged in the vanilla game. So maybe their API function are just not working properly at the moment.

robust locust
#

mod 1 adds wall hanger for guitar, with logic to attach/detach vanilla or custom guitar
mod 2 adds custom guitars

mod 1 is doing

 if item:hasTag("GWH:Acoustic") then

mod 2 was using Acoustic tag (pre update), which allowed it to be used in mod 1

#

mod 2 also used that tag in a recipe that doesn't require mod 1.
I think checking if mod 1 is active, if so don't register tag, if it isnt then register tag
... is that a thing

#

i tried:

but that didn't seem to work

bronze yoke
#

to check for the tag you need the ItemTag object that you registered

#

not the string name

mellow frigate
normal moth
#

Thanks for the tip about the debug menu! It's very helpful.

robust locust
#

Is it possible to have both GWH:Acoustic and HMW:Acoustic tags? would that count as the same tag?

bronze yoke
#

yes and no

robust locust
#

i just realised that i should be using this:

if item:hasTag(GWH.Tags.Acoustic) then
#

i cant stick an "or" in there and check for HMW.Tags.Acoustic too?

bronze yoke
#

you can

robust locust
#

can you show me how please?

#

i couldn't get it to work

bronze yoke
#

if item:hasTag(GWH.Tags.Acoustic) or item:hasTag(HMW.Tags.Acoustic) then

robust locust
#

thanks! im sure i tried that, maybe i missed something

#

its not erroring now, yay. but something is not working properly, but that's another issue

robust locust
#

sweet it's all working now, thanks for your help!!!

small topaz
dense yoke
#

Hey guys. I'm wondering how to get PZ to detect a mod I'm working on. Currently I'm running the game through Proton on my linux installation, but I can certainly go with the linux build. That said, /home/<username>/.local/share/Steam/steamapps/compatdata/108600/pfx/drive_c/users/steamuser/Zomboid/mods/<TestMod>/ but it doesn't show up when I click on "Mods" in game.

small topaz
dense yoke
small topaz
dense yoke
#

No actually I was just using it rn because I couldn't get native linux version to view the file

#

but Im having issue with both seeing it

#

I'm looking at a workshop mods folder structure and it does seem a little different than what i had

#

I'mma immatate that and also check the wiki and see what's up as well.

dense yoke
#

I do find the linux version to be running slightly better, perhaps its just placebo tho

mellow frigate
dense yoke
#

Okay. According to the Wiki, they suggest you develop mods with the "Workshop" thing, but I don't want to upload mine yet. I'm not even close to that stage

#

I may have missread that

small topaz
# dense yoke Okay. According to the Wiki, they suggest you develop mods with the "Workshop" t...

No, you can just put your mod to your Zomboids/mod folder. Just make sure you have the correct folder structure. When in your Zomboid/mods folder, you mod's folder structure should look like this:
-myModName
----- B42
----- common
The mod.info file goes to the B42 folder. The common folder must always be present, even when empty.

In case you just mod for a newer version like 42.13, you can replace the B42 folder with a B42.13 folder (or you can make mods for several versions, then game the automatically chooses the version most closely to it's actual version). But default way is to just use a B42 folder.

#

that's modding for b42 btw. modding for b41 is a bit different.

dense yoke
#

Put the files in the "cache" folder the wiki mentions, rather

small topaz
small topaz
dense yoke
#

They specifically mention that using the "Zomboid/mods/" folder is not recommended for mod development

#

regardless, if I have the folder structure correctly implemented, I will see the mod listed along with the steam workshop stuff right

small topaz
#

There is nothing wrong with working in the Zomboid/mods folder.

dense yoke
#

right on ;p

bronze yoke
#

the reason we recommend working in the workshop folder is just because you're gonna have to move there eventually anyway

#

a lot of people mess up at that stage (in particular, if you don't delete the version in mods, you are going to have big problems) so we just try to skip the whole hassle

#

but as long as you're aware of that, there is no actual issue with developing in mods

dense yoke
#

right yeah, I suppose just make it hidden then start working from there

#

I saw that option and was like ahhhh there we go

ancient grail
#

not sure if this is something you guys know by now
im just dropping this info
i was trying to remove a contextmenu option and it used to be easy

it was

context:removeOptionByName(getText('theOptionYouNeedToRemove'))

but for b42
this worked after trying some other (stuff didnt work)

context:removeOptionByName(Translator.getRecipeName("RollOneDice"))

note the recipe entry in this example
Recipe_RollOneDice = "Roll One Dice"

bronze yoke
dense yoke
dense yoke
#

I suppose if I start the game and there are no mods to choose from, I'm putting them in the right location, I've just got something wrong with the folder structure and whatnot

dense yoke
#

Okay cool.. atleast I know that I'm in the right place. Just finding WHICH folder I needed to be messing with was the hard part 😛

#

erm... 😛 doesn't seem right but whatevers gotta live with my mistakes

bronze yoke
#

if you don't see the mod at all, that means mod.info is in the wrong place

#

you may be in the right folder with the wrong structure or in the wrong place entirely

dense yoke
#

no, I see no mods at all! like, nothing is there to choose from.

#

but when I remove my test mod and run the game again, all the workshop mods I'm subbed to are back

bronze yoke
#

😰

#

i don't think i've ever seen that, good luck

dense yoke
frank elbow
frank elbow
#

Since there are only a few exceptions like this, I went ahead & made a list of global/Translator functions for them. Unless I've missed something, all strings other than these categories just use the regular getText functions:

DynamicRadio → getRadioText
EvolvedRecipeName → getItemEvolvedRecipeName
ItemName → getItemNameFromFullType
Items (outdated, unused) → getItemText
Moveables → Translator.getMoveableDisplayName, Translator.getMoveableDisplayNameOrNull
MultiStageBuild → Translator.getMultiStageBuild
Recipe → getRecipeDisplayName
RecipeGroup → Translator.getRecipeGroupName

dense yoke
#

Just to make sure I'm putting stuff in the right folder I've done a "git clone" of https://github.com/Project-Zomboid-Community-Modding/pzmc-template into /home/<name>/Zomboid/mods/ but I'm not seeing it within my mod list. Is it because this template hasn't been updated to the newest patch? Or are you simply not going to see it for some reason or the other

GitHub

Contribute to Project-Zomboid-Community-Modding/pzmc-template development by creating an account on GitHub.

normal moth
#

Does anyone know why I might have 1 hand and 2 hand weapons that when I pick them up they have no model and cannot be used as a weapon?

bronze yoke
dense yoke
#

OOOOOOOOOH kay. I figured it out now. This template just showed up within my mod list after I registered it as "unlisted" and that's where I'll be messing with it from now on. thank you all for the help. I guess I should have watched a few guides on this first but ALAS we're good

frank elbow
#

Unfortunately didn't get around to making a documentation site yet, but loosely explained what's in it on the repo (linked on the mod page as "contribute"). As mentioned, pretty much intended for use in my other mods, but if you do take a look please do lmk thoughts

bronze yoke
#

nice! excited to look through this when i get a chance

willow tulip
#

How do we addXP in multiplayer? there seems to be no remaining LUA that adds XP in multiplayer

#

and GameServer.addXp(player, Perks.Strength, 10) doesn't seem to work...

#

(addXp of non-table: null)

#

nm its just addXp

willow tulip
#

Neat, I figured out how to override all containers capacity in SP/MP

#

including player, fridges, stoves, backpacks, etc.

#

now I just need to figure out all the typical container types...

willow tulip
#

this is a totally sane number of sandbox options right?

#

opps 2nd one should be floor capacity.

silent zealot
#

...not that users will have any idea what the internal names of things are...

hot void
silent zealot
#

You probably want to iterate through the bodylocations to find the thing you want to be before/after and use that to get the number.

#

Unless you want to be at the very top of the body location list for some reason.

winter bolt
#

0 is beneath everything

silent zealot
#

Also, you need to register the body location in media/registries.lua before you can use it.

registries:

NEPBODYLOC_CLBFYS_REAR  = ItemBodyLocation.register("nep:stockingbow_rear")

lua files:

local newBodyLocation = group:getOrCreateLocation(NEPBODYLOC_CLBFYS_REAR)
<optional: call moveLocationToIndex here>
hot void
hot void
winter bolt
hot void
#

how do i read errors?

#

becuse iam going in a loop for a while now

bright fog
#

That's a tag right ? You need to use a custom module for these

hot void
bright fog
#

Just don't use base for tags

hot void
bright fog
#

Fix your tag, or I guess it's a body location, registries

#

And properly reference the same IDs then in the scripts

hot void
#

sry iam a potato

bright fog
# hot void

You need add module in front of these IDs in the registers

bright fog
hot void
#

its still complains

verbal yew
hot void
verbal yew
hot void
#

that's why its complaining

#

ok new issue

verbal yew
# hot void ok new issue

luautils.stringEnds = function(String, End)
return String:sub(-End:len()) == End;
end

something nil

#

where you call luautils.stringEnds?

hot void
#

its becuse of the _Tattoo i think

verbal yew
#

try put print before check
print(tostring(item))
print(tostring(item:getBodyLocation()))

#

whats that have

verbal yew
# hot void

i think better to use something like that:

local allowedLocations = {  -- your slots list
    ["base:belt"] = true,
    ["base:back"] = true, 
    ["base:butt"] = true,
    ["base:holster"] = true
}

function myfunc()
  local bodyLocation = item:getBodyLocation()
  if bodyLocation and allowedLocations[bodyLocation] then
  --
  end
end
verbal yew
# hot void

if im not worng - inventoryitemfactory not work on 42b

#

now it's instanceItem

hot void
hot void
#

so i guess the bodylocations are now working?

#

nope

#

wouldnt they show here if they worked?

#

maybe this is why its nill

robust locust
#

Hiya, does anyone know if buildings have any individual id's or numbers that identify it? I need to store modData that is used by all players so that the same buildings dont get processed more than once.
So its marked as complete by 1 player, the building is then ignored by anyone afterwards that loads the building?

#

Currently my mod stores it as building 1, 2, 3... so on, but im not sure if the numbering is decided by which buildings are loaded first near the player.
If it has some global serial numbering or something, then i can be certain that building is listed as the same for everyone

hot void
#

i think its trying to get the body location as a string and not an object ?

winter bolt
dusk saddle
#

Gonna cross post from the PZ modding server as well just in case:
Heya folks! I've been havin' some issues here in regards to getting some custom VHS tapes to actually spawn in the world. I've got a custom item that functions as a VHS tape, but has its own skin and has a tape it plays - you can choose the tape via debug menu. The issue I'm facing is that the item just does not spawn in the game whatsoever. Is it due to it using a custom MediaCategory? Would anybody know of a way to resolve the issue of it not wanting to spawn? Loot Zed shows it as having a 90% chance of spawning and I have rerolled the tables several times to no avail.