#mod_development
1 messages · Page 186 of 1
opinions on the better version of the m81 woodland camo used by the game?
this is my version (top one)
game version (bottom one)
I tried to keep as close to the games urban camo version
Hello. I am currently working on a mod and have run into some issues with VHS tapes.
I managed to make couple of custom VHS tapes and figured that in order to boost desired perk I need this perk abbreviation / 3 letters code (just as it's shown on the reference screenshot).
My question is, where can I find these codes for perks that already exist in the game / how can I assign these codes to the newly created perks?
anyone have any experience or ideas trying to get rid of the debug highlight on safehouses in MP?
the highlight is applied in a render function in java, but even trying to forcably un-highlight it post render gives no results
Its for profession traits, if its true it means it comes with a profession and you can't pick it alone
Anyone experienced with syncing globalModData? im still having problem doing that one, right now after each change to global mod data i call transmit(key) which assuming sends data to server. And then i have this script which is triggered using OnGlobalModDataRecieved event and changes it to what's recieved from assuming server side. However, when testing globalModData table both clients hold their own data only.
but what sends it to the clients?
This second script should be triggered when something is recived from server side no? It's triggered by OnGlobalModDataReveived event.
heres the script
was trying stuff so i also added this one but its never triggered so there's that
apart from all this, its just modData.transmit(key)
if none of this works i might have to try those server-client command trigger events.
transmit stuff
so when you update the client's mod data, you transmit it to the server? but what then transmits it to the other clients?
You can have a look at IronmanLeaderboard mod for a minimal use of moddata updates (IMLBClient.lua for the client, IMLBScore.lua for the server) https://steamcommunity.com/sharedfiles/filedetails/?id=3001659768
It looks like you forgot to request on client side
screenshot i shared about ModData.transmit(key) talks about if its called in server it sends it to all clients and if its triggered on client then it sends data to server. Im not sure how to call it from server, i think thats what missing.
you could probably just transmit it after you receive it
thank you, ill see if if i can find something here.
any ideas how should i transmit from server side? i dont think i understand too much about writitng stuff from server side. The best ik atm is what you talked about earlier commands from server/client side.
it should be the same syntax
ModData.transmit(key) but on the server code instead of the client
oh so just write stuff inside server folder
ill give it a try
exciting stuff haha, first mod 😄
the server folder isn't server only, you need to use if isClient() then return end to ensure a file only runs on the server
those isclient and isserver makes sense now, i was just calling it from server side earlier no wonder it was just returning false.
What do you guys use for item modeling?
Currently just textures, or is there a place where you can pay people to create textures cause I'm about as artistic as a rock :/
gimp
i means its not that difficult just creating textures once you know how to use your software you're using, obv making a great one comes with experience.
Thank you!
Oh I'm sure. Although I'm pretty sure I'd rather pay somebody on fiver a few dollars to create nice looking textures than my, sure to be, terrible art lol.
I made custom textures for my flares and someone might call them beautiful but I'm definitely not one of those people
im not great either, this one's like my second or third one so far. It's pretty small in-game so ig doesnt matter that much
Yeah I feel like if a start with a larger map shrinking it down will make it look significantly better
But still not gonna be A+ quality
it's only natural to be like that
item icons dont need high grade detail on them and item models themselves arent that much visible so you can get away with using super simple textures
player:setAttachedItem("Back", woodenLance)
What's the correct name for attaching something to the back?
as Back doesn't seem to be working nor being correct, whereas Knife in Back exists & does work to just display the Weapon piercing the character.
the areas are defined in AttachedLocations.lua
tyvm partially what I need and for reference the solution is somewhat like:
player:setAttachedItem(woodenLance:getAttachmentType(), woodenLance)
woodenLance:setAttachedSlot(1)
woodenLance:setAttachedSlotType("Back")
woodenLance:setAttachedToModel(woodenLance:getAttachmentType())
_G["ISHotbar"]["reloadIcons"]()
source: ISHotbar.lua, take note internally it's handled a little different.
Does this code look like it would add the given trait to a player? If added to a function.
local player = getplayer() player:addtrait("positive", "axeman", 0, "Axe man", False)
you've crossed the streams here
I believe it
player:getTraits():add("Axeman")
thats way way simpler
i was basing mine off of addTrait(String type, String name, int cost, String desc, boolean profession)
but i guess that adds a new trait
that's from traitfactory, that's for actually defining what a trait is
players don't actually store traits at all, they just store a list of trait names
local Interactions = {};
--Stats
Interactions.ANG = -- Anger
Interactions.BOR = -- boredom
Interactions.END = -- endurance
Interactions.FAT = -- fatigue
Interactions.FIT = -- fitness
Interactions.HUN = -- hunger
Interactions.MOR = -- morale
Interactions.STS = -- stress
Interactions.FEA = -- Fear
Interactions.PAN = -- Panic
Interactions.SAN = -- Sanity
Interactions.SIC = -- Sickness
Interactions.PAI = -- Pain
Interactions.DRU = -- Drunkenness
Interactions.THI = -- thirst
Interactions.UHP = -- thirst
--Skills
--agility
Interactions.SPR = --sprinting
Interactions.LFT = --lightfooded
Interactions.NIM = --nimble
Interactions.SNE = --sneaking
--blade
Interactions.BAA = -- Axe
Interactions.BUA = -- Blunt
--crafting
Interactions.CRP = --carpentry
Interactions.COO = --cooking
Interactions.FRM = --farming
Interactions.DOC = --firstaid
Interactions.ELC = --electricty
Interactions.MTL = --metalwelding
--firearm
Interactions.AIM = --aiming
Interactions.REL = --reloading
--survivalist
Interactions.FIS = --fishing
Interactions.TRA = --trapping
Interactions.FOR = --foraging
--new
Interactions.TAI = --tailoring
Interactions.MEC = --mechanics
Interactions.CMB =
Interactions.SPE =
Interactions.SBU =
Interactions.LBA =
Interactions.SBA =
If you want to add learning recipe from that, simply do RCP=Name of your recipe
if you would like to add your own trait to that, you'll need to add new interaction based on code in the file | Line 131
.\media\lua\client\RadioCom\ISRadioInteractions.lua
thanks!
so
local player:getplayer() player:getTraits():add("Axeman")
is the code i want
you are correct, i'd be the worst actual programmer
Also this is the function which checks that. | Line 184 & 213
Anyone knows a way to track a specific zombie across game reload both for single player and multiplayer ? I'm looking for a persistent ID or the closest thing there is.
@mellow frigate What about storing the square where zombie is and checking it every reload
zombies aren't really persistent
Thanx, I wanna avoid that because it moves over time and can be controlled client/ server side
Yeah, that was my first think of it, didn't really try anything with zombies yet.
if you flag it as a reanimated player you can track it with moddata
I do not remember what are the downsides of this, last time I tried there was some.
It was repeated several times that using this would do something bad but I don't think it was established as to what other than potential save bloat? Maybe loading staggering the frames?
At least if done excessively.
I still think giving a boolean to enable modData would be nice
even for one there were functional (not performance) downsides
it would, but i don't think there's another way to reliably track a zombie
That sounds like something is severely wrong
I fear you're (again) correct
When the player dies the left over zombie doesn't cause performance issues
reanimated zombies have to keep their exact inventory, clothing, etc saved
most zombie stuff isn't saved because nobody would know anyway
It is basically the same thing as a boolean to enable ModData.
The warning is that if done excessively, such as applying it to every zombie in the world or such as an extreme example, then it will negatively impact performance with loading zombie ModData and other data.
Spam at your own risk mod-wise.
Ah, it seemed to be implied all the other junk data being saved and loaded was the concern
For one or two zombies it should be ok I imagine?
Worlds can have hundreds of reanimated player entries so that should be fine.
This also means some player's performance issues are a skill issue 💀
that's low !
xd
Also, to mention, if you can rely on outfits for what you need it works
It depends what you are trying to do. SWHelis use outfit IDs to apply changes
Thanx, but I want instance unicity
I'll retry with 'reanimated player'. Maybe I misremember or just messed up last time.
I've had performance issues after multiple deaths that stopped when I deleted the players file. Raven Creek roof spawns mostly, not sure if it's related 
thanks a lot, that's exactly what I was looking for :)
Does anybody know why magazine's automatically disappear on use? and have an automatic read time. Is that designated in the literature type?
yeah
justreaditem eats the item if it's a magazine
i think specifically it checks if the item has taught recipes
actually i think it's if it's not a skill book
So i'm trying to add trait books as a drop rate to a rare zombie type and I want to use a basic book as the template but I want it to be one time use like a magazine
is there an easy way to call a function on read items
google returned no results for justreaditem
you wont find a lot of documentation for pz through google atleast for specific things
maybe its JustReadSomething
public void JustReadSomething(Literature lit)
yeah that
is that automatically ran on magazines because they are literature?
becuase magazine code is pretty simple
item Magazine { DisplayCategory = Literature, Weight = 0.2, Type = Literature, DisplayName = Magazine, StressChange = -15, Icon = Magazine, BoredomChange = -20, StaticModel = Magazine, WorldStaticModel = MagazineGround,
yeah
it's called by the reading action to apply the effects
is there a simple way to start a function from reading a book?
if i call triggerEvent in a function does it stop the said function and resumes after the event is done, or does it do the parallel to the function, assuming the said event is a custom one?
or can I use LearnedTrait = JustReadSomething.function?
nothing is parallel
dangerous to say that.
its all in one thread?
@bronze yoke @sour island @willow estuary All visuals are lost (the zombie is naked) upon: default (random) Zombie spawn + set reanimated player + quit + reload. Any of you has an exemple on how to counter that ? I'd'like to avoid parsing the whole visual to store it all in mod data and reload it afterwards. My mod data is kept as expected.
it's all in one thread
there's some java stuff that's multithreaded but the game is mostly singlethreaded and all lua is singlethreaded
multi thread mod when????
Nvm I forgot they're using an outdated and I presume even deprecated lua Library at this point
WornItems are used when the zombie has been killed, was fake dead (not saved) or is reanimated player.
zed:setReanimatedPlayer(true)
local duffel = InventoryItemFactory.CreateItem("Base.Bag_DuffelBag")
zed:getInventory():AddItem(duffel)
zed:setWornItem(duffel:canBeEquipped(),duffel)
there should be a function that adds all of the worn items 🤔
Thanx, I've been parsing the channel and found your last year's answer that was the closest match to my needs
! I guess I'll have to write the copy function.
Oh my! I spoke too fast: there is one function: lua isoZombie:DoZombieInventory() isoZombie:setReanimatedPlayer(true)
wheres the mod creator
Does anyone have any idea on how to mod the ranges on the base walkie-talkies/ham radios? I'm looking to increase them for a server I play on that has map mods that expanded a little too far, meaning radios such as the US Army walkie and HAM can't reach the entire map anymore.
I found the radio .CLASS files but I'm not sure if that's the right location to look at
how do you create a mod that adds a poncho to the starting gear
just edit the item scripts in media/scripts
omg thank you
Now because I'm super dumb, is there anything I need to do in specific to turn that into a workshop mod for our server, so it doesn't overwrite base-game stuff?
you can use lua to change the values instead of editing the script
if you don't care about compatibility you can copy the item's script into a new script file and upload that as a mod
depends on if your server is using a mod that edits them already/future proofing
Is there a way to set a tile on fire or spawn fire?
as far as i know the only radio-editing mod we have is "keep that radio on", but nothing about radio ranges. i dunno if that'd change anything here
Pls help
IsoFireManager.StartFire(self.targetSquare:getCell(), self.targetSquare, true, fireEnergy, fireLife);
You can probably check the mod more traits. they have prepared traits that let you start with certain items that might give you an idea on how to create what you're looking for. I think the base game also has a starter set with a backpack, hammer and baseball bat.
Hi, what event do I need to hook on to check if a tile container has loaded? Do I need to use LoadGridsquare? Or is there any other suggestion?
OnContainerUpdate is called on each container update event, including initial loot creation and loot respawns.
Thank you very much 🤗
Does the event OnContainerUpdate have any parameters once called, the first argument is nil for me?
nevermind, apparently it has no params
i think it sometimes passes something, sometimes doesn't
Interesting 🤔
iirc it's just used to refresh the inventory window in cases where it wouldn't already know so it's not that helpful
it is not called in every situation where a container changes
Yep, you are right, I'll use OnLoadGridsquare
How can I access the inventory of a square obj?
I assume getContainer() should do the trick
you'd need to loop through all the objects on the square
Ah, okay
I may have mistaken it for OnFillContainer, check the full list here: https://github.com/demiurgeQuantified/PZEventDoc/blob/develop/docs/Events.md
How can I make sure that the weight of an item is being transmitted accordingly to the server?
And, how can I make sure that the capacity of a contaienr is also being transmitted to and from the server?
is there a function to get an IsoZombie by its OnlineID in multiplayer ?
no
how would i get a specific outfit for addZombiesInOutfit(), i'm looking to get a Santa zombie but everything i've tried hasn't returned the outfit.
it says the parameter is a string, but i can't find the string that works,.
oh hey! just came here to post about that. ;D
I have also written some instructions on how to use getZombieByID here: https://steamcommunity.com/workshop/filedetails/discussion/3012642917/3803904556900056563/
Its very simple; just enable and its always running in MP. require the file in your mod, then just use the function to get a zombie by its ID
the mod doesn't run in singleplayer? isn't that a nuisance?
it can be enabled for singleplayer. the cache object is created and all that, but the cache is never populated so will always return nil unless you are in multiplayer. in sp, its not needed
i understand that it's not needed, but i don't want different code paths between singleplayer and multiplayer if i can avoid it
you don't need to. The mod's objects and such are still created, you can still use its get function, you're just ALWAYS going to get nil which you should be checking for anyways as people in different cells will not have the same zombie IDs
otherwise, i'm not sure of a use-case for singleplayer as you're never just given the zombie's ID
yes, but if i'm passing zombies by their online id, then i'm going to get nil and the mod won't work?
the issue i'm getting at is that i have to have different code paths for singleplayer and multiplayer, since one uses an online id cache and the other would pass objects directly
Not really? Not anything more than usual that is. If you are in multiplayer, then the only difference is that your action now has to send a command to all other clients with the zombie's ID, and your clients then use that zombie ID to reference the same zombie you are by pulling it from their caches. The function they run was always going to be different though, as you are receiving this data from a client command. For the main instigator, you then just proceed with the actual reference to the zombie; works in both singleplayer and multiplayer. You're NEVER just given a zombie's online ID in singleplayer, so you would never need to pull a zombie from this cache.
In the example I gave:
local OnWeaponHitCharacter = function(player, target, weapon, damage)
if not player:isLocalPlayer() then return end
if isClient() then
print("OnWeaponHitCharacter CLIENT: " .. player:getOnlineID())
print("SENDING: " .. target:getOnlineID())
print(" Weapon: " .. tostring(weapon))
print(" Damage: " .. tostring(damage))
sendClientCommand("ZedShare", "Test", { zed = target:getOnlineID(), weapon = weapon, damage = damage })
end
-- you do your stuff here, like normal. the only difference was the above relay.
end
You just send this data to the client, and then they process it from there. You already have the zombie's reference and stuff. You're never just given the zombie's online ID, always the object.
Whenever you RECEIVE a zombie's ID, pull the object from your cache in your Client Command, then run your normal function with the object.
you're right that if i'm using the zombie immediately it doesn't matter as i'd likely do whatever i needed to on that client when sending it (which is something i admittedly overlooked), but what if it's not being operated on by the client when sending the id to the server? (e.g. we store a zombie id and then send a message to do something to it a bit later, based on some server logic) that would have to be rewritten surely
it's obviously not a huge issue and doesn't make it useless or anything, but it is a little annoying
Heya, I'm thinking of an item that gives a mood boost when it's in the same building as you. Is there a function that checks against that while you are inside? I was trying to find the generator code where it poisons you when it's indoors but no real luck
(there is a question here if this is even a good idea, i'm not sure if zombie online ids will get repurposed, but if they can that could be an issue even when operating immediately just from ping, though much less likely to come up)
The zombie IDs are stored as a short, and IDs seem to be sequential (i.e. new ID = lastID + 1), so there could be a collision when there are over ~32k zombies processed and it loops back around. But, given how this game kind of already loses track of zombies and that the cache does rebuild periodically, I don't think this will be too much of an issue. ha
And to continue with your example, I would argue that you would still just hold on to the zombie's object until you do your task later. The only time that you would query the cache is as another client to "ready" the zombie to do that timed task when you receive the command to do so.
a square has the getRoom() function you can use. you can periodically check if a player and your object in the world have the same IsoRoom reference, and if so, perform your stuff to adjust mood.
https://projectzomboid.com/modding/zombie/iso/IsoGridSquare.html#getRoom()
declaration: package: zombie.iso, class: IsoGridSquare
Thank you much for the help!
Anyone knows if there's a way to prevent character from shooting while in animation transition?
Does anyone know if there will be any webstore for any mods that server owners and developers that may want to buy mods or put up for sale? Or at least knowledge thereof?
That would be against TOS?
anyone have any ideas for a goth accessories mod i'm working on?
currently have some hats / helmets, wings, wearable cigarette, horns, and some other things
Was thinking in terms of how Garry’s Mod had done it with GMODSTORE
Fair enough
This is a great idea.
This might be a solution i could use for ny zeds to sync
anyone know if it's possible to profile a group of mods to find performance issues?
Is there like a tutorial somewhere to get starter if you want to make a balance patch/remove items/changing stats for gun/armor mods and similar things?
There isn't a catch-all way to go about doing this - but you can write profilers from the ground up. Someone recently made a test suite for their mod.
I did this a while back for testing tableremoves - #mod_development message
I wonder if there could be a way to wrap all functions? 🤔
You can parse through _G I guess
check for function types
yeah would be nice if i could wrap them all
i mean if you can wrap one you should be able to wrap them all i guess
thing is i'm playing on a server that has tons of mods on them and people are having issues connecting, getting lag spikes. the mods might not be the issue though
cells loading real slow etc
Depends on the mods, but yeah most wouldn't cause all that
I can do some tests as I'd be interested in this too
But I've been traveling for 2 weeks and got a lot of stuff to catch up on
no rush really, but if I find anything I'll share
Hey guys! I've been playing Project Zomboid for a while now and I decided that making a car mod would be a good way for me to finally get into modding. So I jumped into it with zero modding experience, and I spent the last 4 days learning how to use Blender to make the 3D model of the car. After multiple hours of pain and frustration the model is now complete. But my problem is that the tutorials I found on the Indie Stone forums about making vehicle mods are all outdated. I tried following one of the dev's post from 2018 on what the file structure looks like and what code the individual files should contain, but when I compared it to the files of a car mod from the steam workshop, I realized that they are completely different. So here I am with no idea what code the files should have. I also realized that none of the tutorials really go in-depth into the making of textures for the 3D models, or how I should do the UV unwrapping of my model. If you have any experience with making vehicle mods for the game, any help or tips would be greatly appreciated as I feel like I've come to a dead end, and I don't want to just give up on this.
It is really just about identifying Zs in MP across network. And OnlineID is -1 for each Z in solo. So I upvote the right design is to keep the fork (Solo / MP) code on the usermod side and not try to put it on the toolmod side. I may be lacking of ambition though.
oh if online ids don't even work in singleplayer then it doesn't matter
How is this possible?
Is there a hidden setting on DEV mode that makes rare items spawn more often or something?
Is there any mod that used successfully IsoZombie setReanimatedPlayer and ModData in Multiplayer ?
Hi I'm an hobbist modder with novel coding/modding skill. I'm looking at creating a mod to make clothes dry faster when put into the laundry machine. Does anyone know where the file related to drying clothes woudl be located? Best I have found so far is the IsWashClothing and ISDryMyself luas
@sinful scaffold what are we looking at here?
I'm trying to make Sandbox Options for my BB mod, right; while testing I realized that very rare items where spawning way too often. In this case there's a spiffo doll and a freddy the fox doll spawning at the same time. According to Lootzed they should have something like a 1 in 58 million chance of spawning.
My mod being disabled didn't chance anything (Not this Screenshot)
These all spawned within the same toystore, apocalypse settings.
It shouldn't be possible.
do you have any other mods that are modifying loot variables?
Nope. When I am testing my mod I test without anything else on, other than tile packs.
I also added Proximity loot to test faster, but even without it, crazy numbers.
hmm strange, I don't really know that much about loot mechanics but you could try checking out the decompiled java code in ItemPickerJava.java (rollItem method) could be what is creating the loot
How can I get a fresh instance of a container? I want to be sure I can get the container original capacity without it being edited by any other mod
Like, I know I can get the script item of a container, but my issue is that this container is a tile, and I have no clue how to get the script item for it
i don't know but a square can contain tiles which can be of type container, a fridge could be a tile for example
Yeah, and I can access the tile and it's container, but once I access it, I want a new instance of the container based off that tile container
Kinda like when you do ScriptManager.instance:getItem(originalItemName):InstanceItem(nil)
||isoObject:getSprite():getProperties():Val("ContainerCapacity") ||
Is this affected by doing setCapacity on the inventory?
Apparently not by looking at the java code 🤔
@sinful scaffold how is your LootZed displaying guns and magazines in GigamartToys?
is that your mod?
BB mod doesnt say anything to me
Yes, that's my mod.
Well as far as i can see this is what decides if an item gets put in there or not:
if ((float)Rand.Next(10000) <= chance * 100.0F * lootModifier + zombieIntensity * 10.0F) {
are you sure you're associating the loot with the active mods "at the time of loot computation" ?
What do you mean?
never knew zombieIntensity had an effect on loot..
Look, my mod is not active and it's still doing it
What's interesting is that you have 8 items
late response but thank you
I got 5 dolls, each of them with a fraction of a percent of chance to spawn, in the same toy store.
although, those spiffos really shouldnt spawn that often
items = {
"BorisBadger", 0.001,
"Bricktoys", 20,
"Bricktoys", 10,
"CardDeck", 8,
"Crayons", 20,
"Crayons", 10,
"Cube", 20,
"Cube", 10,
"Dice", 8,
"Doll", 20,
"Doll", 10,
"FluffyfootBunny", 0.001,
"FreddyFox", 0.001,
"FurbertSquirrel", 0.001,
"JacquesBeaver", 0.001,
"MoleyMole", 0.001,
"PancakeHedgehog", 0.001,
"Spiffo", 0.001,
"ToyBear", 20,
"ToyBear", 10,
"ToyCar", 20,
"ToyCar", 10,
"Yoyo", 20,
"Yoyo", 10,
},
what are your loot modifier settings
Standard Apocalypse.
Everything set to rare.
I'm thinking it could be something with debug mode to spawn 0.0xx items 1000 times more or something?
i'd say try it without teleporting
and no debug mode
as far as i can see it's not like all items are rolled and then one is selected, it looks like it just loops through the available items and if the calculation is positive it just adds it
so that would make me think it's returning positive a lot of the times even for really rare items
So I have to fight through all the zombies the old fashioned way to check actual spawn rates? 
only if you want to find out
The mod has been updated with the Sandbox Multiplier options, which techincally work: https://steamcommunity.com/sharedfiles/filedetails/?id=3007639881
Well, Riverside here I go.
do the bb guns keeel?
no debug specifics afayk. start a NEW world with no mod to see vanilla behavior
Heya. Is the short blade instakill tied to the swing animation, rather than the weapon type?
I've got a custom weapon that makes use of the short blade stab and I've been noticing that, very rarely, it does that jaw stab, despite not listed as a short blade.
I keep getting nil on containerCapacity
Are you sure this value is accessible from lua?
local onRefreshInventoryWindowContainers = function(self, state)
if state ~= "begin" or not self.inventoryPane.inventory then
return
end
local inventory = self.inventoryPane.inventory
local parent = inventory:getParent()
if not parent then
return
end
local containerCapacity = inventory:getParent():getSprite():getProperties():Val("ContainerCapacity")
CasualoidPrint('containerCapacity:', containerCapacity)
end
@Mx does this help?
public void createContainersFromSpriteProperties() {
if (this.sprite != null) {
if (this.container == null) {
if (this.sprite.getProperties().Is(IsoFlagType.container) && this.container == null) {
this.container = new ItemContainer(this.sprite.getProperties().Val("container"), this.square, this);
this.container.parent = this;
this.OutlineOnMouseover = true;
if (this.sprite.getProperties().Is("ContainerCapacity")) {
this.container.Capacity = Integer.parseInt(this.sprite.getProperties().Val("ContainerCapacity"));
}
if (this.sprite.getProperties().Is("ContainerPosition")) {
this.container.setContainerPosition(this.sprite.getProperties().Val("ContainerPosition"));
}
}
if (this.getSprite().getProperties().Is("Freezer")) {
ItemContainer var1 = new ItemContainer("freezer", this.square, this);
if (this.getSprite().getProperties().Is("FreezerCapacity")) {
var1.Capacity = Integer.parseInt(this.sprite.getProperties().Val("FreezerCapacity"));
} else {
var1.Capacity = 15;
}
if (this.container == null) {
this.container = var1;
this.container.parent = this;
} else {
this.addSecondaryContainer(var1);
}
if (this.sprite.getProperties().Is("FreezerPosition")) {
var1.setFreezerPosition(this.sprite.getProperties().Val("FreezerPosition"));
}
}
}
}
}
I have looked at this from the the decopliled Java on my side, and it's very handy, but I'm still confused on why the this.sprite.getProperties().Val("ContainerPosition") is not working on my side 😦
maybe you can print of what properties th sprite actually has
it was ContainerCapacity with capital C
nevermind
you might just be accessing the wrong object
What do you mean? The wrong IsoObject?
what kind of tile is it, do you have a sprite name I can check?
It's this tile
Just printed the
local properties = object:getSprite():getProperties():getPropertyNames()
[BlocksPlacement, CanBreak, CanScrap, CustomName, Facing, GroupName, IsMoveAble, Material, Material2, Material3, MoveType, Noffset, PickUpLevel, PickUpTool, PickUpWeight, PlaceTool, Soffset, Woffset, container]
Maybe I need to access container?
local onRefreshInventoryWindowContainers = function(self, state)
if state ~= "begin" or not self.inventoryPane.inventory then
return
end
local object = self.inventoryPane.inventory:getParent()
if not object then return end
local containerCapacity = object:getSprite():getProperties():Val("ContainerCapacity")
local properties = object:getSprite():getProperties():getPropertyNames()
print(properties)
-- CasualoidPrintTable(object:getSprite():getProperties())
print(object:getSprite():getProperties():Val("ContainerCapacity"))
end
Doing this with zombies on your ass is much harder, but.
New World, no Mod.
I found A Spiffo too
Yeah, I see what no mod means to you.
Maybe I accessing the wrong sprite ? but this seems very odd
I think this is the one you are loooking for?c furniture_storage_02_12
I assume it uses the default 50 when the property is not set 🤔
in the code above, it makes a new ItemContainer object which would have 50 capacity and then sets a different one based on ContainerCapacity
Okay, so, I can assume that the default Capacity is 50, right?
Oh yeah
Damn
Welp, fair enough 😦
Anyway, thank you very much @fast galleon
I thought you had meant without my mod but, in any case
I'm not making this stuff up.
nice, you can use -debug and F9 to activate vanilla debug god mode and therefore not be attacked by Zs
#mod_development message
I know Nippytime has tested low chances, you might want to check his messages.
But that's the thing, if you check the chances on Lootzed it will give you impossibly low chances, yet they are still spawning crazy often.
And not just the items in my mod, but completely vanilla as well.
Which is just weird
LootZed notes (v.41.78)
#mod_development message
LootZed isn't currently accurate in that zombie population inflates item spawn chances but it's not reflected in the LootZed values. Should be fixed in b42.
Any changes done to the lua tables after they are parsed by java are not reflected in Lootzed calculations.
#selfpins LootZed
And it seems to be specifically the items with the 0.00x items as well, regularly spawning items seem to be spawning regularly.
i found 1 spiffo and 1 otis the pug or whatever
Then it's not just me
well i dont know about that
but theyre probably not as rare as you think they should be
LootZed isn't currently accurate in that zombie population inflates item spawn chances but it's not reflected in the LootZed values. Should be fixed in b42.
technically you can go as low as float32 allows you to but at a certain point it'll feel like 0. As it's internally represented as a float as far as I'm aware.
Thank you for the insight. These plushies aren't supposed to be spawning this often, right?
does every IsoObject have an Emitter from which it can play a sound?
potentially?
if ((float)Rand.Next(10000) <= chance * 100.0F * lootModifier + zombieIntensity * 10.0F) {
let's say chance is 0.001
lootModifier = 4
zombieintensity = 8 (which is the maximum cap)
0.001 x 100 x 4 x 8 x 10 = 32
i think its the BaseCharacterSoundEmitter that im looking for
well the object that i wanted to has it
so if Rand.Next(10000) is 32 or lower it should add an item with 0.001 chance, if my calc is correct
im not good with math, but that is rolled for X amount of items in a container, for 24 containers
Does this look like it will remove the fit trait and add the athletic trait?
local player = getplayer(); if player:getTrait(TraitFactory.Fit) == true then print("Your Fit trait has been replaced by the Athletic trait.") then player:getTraits():remove("Fit") player:getTraits():add("Athletic")
it's not just zombie intensity but zombie intensity is used to calculate the chunk intensity, which will then be used with multiple magic values
So with less zombies spawning there should be less chances of there being a plushie in those containers?
i dont think it's the amount of zombies that are there, but the amount of zombies that has been configured there
what I said was in the context of zombie loot in terms of container loot I'm uncertain rn
Hmmmmmmmmmmmmmmmmm
but well Container rolls seem to be able to be affected by zombie loot intensity as well
a lot of branching happening
i mean i literally copied the code
if ((float)Rand.Next(10000) <= chance * 100.0F * lootModifier + zombieIntensity * 10.0F) {
I wonder from where, as I can't seem to find a similar entry.
public static void doRollItem(ItemPickerContainer itemPickerContainer, ItemContainer itemContainer, float zombieIntensity, IsoGameCharacter gameCharacter, boolean var4, boolean var5, ItemPickerRoom itemPickerRoom)
@low solstice it contains the same check
if ((float)Rand.Next(10000) <= chance * 100.0F * lootModifier + zombieIntensity * 10.0F) {
24 containers, lets say 6 rolls, thats a total of 144 rolls
Is there an event for when an item is removed or added to a container the user is looking at?
OnRefreshInventoryWindowContainers does not seem reliable enough
most people hook to ISInventoryTransferAction.transferItem
Is that fired if an another player is moving the item?
it's for local players on client
ooof, okay
Well I attached to both OnRefreshInventoryWindowContainers and OnContainerUpdate and it seems better now
is there an admin command to switch to day in-game?
Guys, help
--[[
function zReRAC_Can_Repair_Armor(sourceItem, result)
if sourceItem:getTags() and sourceItem:getTags() == "zReRepairableVest" then
if sourceItem:getCondition() >= sourceItem:getConditionMax() then
return false
end
local hole = sourceItem:getHolesNumber()
if hole < 1 then
return false
end
end
return true
end
]]
function zReRAC_Can_Repair_Armor(sourceItem, result)
if sourceItem:getBodyLocation() and sourceItem:getBodyLocation() == "TorsoExtraVest" then
if sourceItem:getCondition() >= sourceItem:getConditionMax() then
return false
end
local hole = sourceItem:getHolesNumber()
if hole < 1 then
return false
end
end
return true
end
Reason why first type of code not work? xD
did you mean to use function InventoryItem:hasTag(tag) end?
one sec
scriptItems:addAll(getScriptManager():getItemsTag("zReRepairableVest"))
end ```
-- it's work, bruh... I think I really screwed up with the search for the tag
what i should use on:
sourceItem: ... ()
and item: ... ()
hasTag?
Can anybody tell me if this code looks like it would remove the old trait and then add the new trait and also why remove is a different color ?
U are best
fixed :3
damn yeah
remove is considered (by error) as a keyword by your text editor: no bad consequence.
Thank you.
I get an exception "java.lang.RuntimeException: Object tried to call nil in OnEquipPrimary" when I equip an item on primary :/
local function OnEquipPrimary(character, inventoryItem)
if inventoryItem:GetDisplayName() == "Katana" then
playSound("media/music/btl.ogg")
end
end
Events.OnEquipPrimary.Add(OnEquipPrimary)
maybe check if inventory item exists
Guys, it's possible to hide recipe, but use it from context menu?
not exactly sure, item shouldnt be empty if the event is trigged while you equip stuff
same stuff be in workshop if im remember
it can be nil when emptying your hands
it means GetDisplayName is nil, try getDisplayName
also yes, item can be nil too
yes
I think it happens when it is hidden.
I tried and now I get "attempted index: getDisplayName of non table: null"
How to add context submenu for world object? like Clean bandage or clothes? (for water source, i need clean func for my item)
that means the inventoryItem is nil
is OnEquipPrimary a valid event tho? I am looking for it in Javadoc reference and can't find it
the javadoc doesn't have an event list
thank you kind discord user
https://github.com/asledgehammer/Umbrella might be helpful as well despite I think it was Candle having incorrect overload type information
does it? i've never heard any reports
the overloads are missing the self parameter
which the lua language server requires else it will say incorrect amount of params
& the one with just . is incorrect here
i'll take a look into it, it was never an issue with intellij emmylua but to be honest having used it i'm not even sure if overloads even work properly in emmy and its typechecker is so garbage that it wouldn't really be a big deal if they were to stop working
not to mention that a lot classes just have fields as the type any which isn't helpful
i didn't write candle but i am the maintainer for the time being
that is with the lua_language_server this may be different with emmylua if it's using something different.
candle was originally written for emmylua but it was shifted to focus on lua language server when we realised how much worse emmylua is (and, recently, that the newer versions of emmylua doesn't even index things)
for the most part lua language server's annotations are a superset of emmy's so compatibility shouldn't be a frequent issue
is there a way to launch debug mode on client side?
well it's just a minor issue but if it was fixed that'd be great but I'd say it's more important to add the missing types than this.
the missing types is another issue i've never heard any reports of, i'll take a look into it but it sounds a bit more foundational
when i said i didn't write candle i really meant 'i have never even looked at candle's code' so that one might take a bit longer, the missing self sounds like it should be simple though
well sec
the types should just be grabbed from the source so i'm not sure why they'd end up unspecified
Maybe it was Candle or the other Lua thingy
oh, the lua one, yeah
yea probably the Lua repo
it's difficult to programmatically get types from a non-typed language
it'd benefit them as much as it'd benefit us
but also, most of them are writing lua in intellij from what i can see, and emmylua is so limited maybe it wouldn't help that much 😅
Well as far as I know emmylua is atm completely broken for IJ
e.g. installed => crash
at least that was the last experience I had some weeks ago
i haven't heard of crashes but it is not usable with umbrella right now
in the first 2023 build jetbrains rewrote how indexing works in intellij and emmylua haven't been able to get something working using the new system
so only older builds of intellij can use umbrella
that on top of emmylua just always being a fair bit inferior to lua language server

I'd be happy with Fleet getting Lua well custom LSP support but I'm also just fine with nvim atm
I'm getting a no function exists error for the following:
`item VETBAthletic
{
Type = Normal,
DisplayName = E-Book: Athletic,
Icon = VETB,
Weight = 1.0,
}
recipe Read E-Book: Athletic
{
VETBAthletic,
Result: SVAccessCards.ETBCorrupted,
Time:1000,
OnCreate: Recipe.OnCreate.VETBAthletic,
}
function Recipe.OnCreate.VETBAthletic(player, traits, items)
local player = getplayer();
if player:HasTrait("Fit") == true then
print("Your Fit trait has been replaced by the Athletic trait.") then
player:getTraits():remove("Fit")
player:getTraits():add("Athletic")...`
Any ideas where my issue is?
getPlayer()
would that cause the whole function not to exist?
also thank you for pointing that out
Also remove the then after your print
If your syntax is invalid it will remove the function during runtime
kk ill go remove the extra thens
function Recipe.OnCreate.VETBAthletic(player, traits, items)
local player = getplayer();
if player:HasTrait("Fit") == true then
print("Your Fit trait has been replaced by the Athletic trait.") then <-- HERE
player:getTraits():remove("Fit")
player:getTraits():add("Athletic")...
should be
function Recipe.OnCreate.VETBAthletic(player, traits, items)
local player = getplayer();
if player:HasTrait("Fit") == true then
print("Your Fit trait has been replaced by the Athletic trait.")
player:getTraits():remove("Fit")
player:getTraits():add("Athletic")
bla bla bla
end
end
then double time
I have the ends in ther that was just a snippet of the function
nope, i only about then
`function Recipe.OnCreate.VETBAthletic(player, traits, items)
local player = getPlayer();
if player:HasTrait("Fit") == true then
print("Your Fit trait has been replaced by the Athletic trait.")
player:getTraits():remove("Fit")
player:getTraits():add("Athletic")
elseif player:HasTrait("OutofShape") == true then
print("You cannot learn Athletic while you have the Out of Shape trait.")
player:getInventory():addItem(SVAccessCards.VETBAthletic)
player:getInventory():removeItem(SVAccessCards.ETBCorrupted)
elseif player:HasTrait("Obese") == true then
print("You cannot learn Athletic while you have the Obese trait.")
player:getInventory():addItem(SVAccessCards.VETBAthletic)
player:getInventory():removeItem(SVAccessCards.ETBCorrupted)
elseif player:HasTrait("Overweight") == true then
print("You cannot learn Athletic while you have the Overweight trait.")
player:getInventory():addItem(SVAccessCards.VETBAthletic)
player:getInventory():removeItem(SVAccessCards.ETBCorrupted)
elseif player:HasTrait("Unfit") == true then
print("You cannot learn Athletic while you have the Unfit trait.")
player:getInventory():addItem(SVAccessCards.VETBAthletic)
player:getInventory():removeItem(SVAccessCards.ETBCorrupted)
elseif player:HasTrait("VeryUnderweight") == true then
print("You cannot learn Athletic while you have the Very Underweight trait.")
player:getInventory():addItem(SVAccessCards.VETBAthletic)
player:getInventory():removeItem(SVAccessCards.ETBCorrupted)
else player:getTraits():add("Athletic")
end
end`
here all look fine... hm
i'll run it in one moment and see if that corrected the issue I was having
This seems to have corrected my issue, although I'm not seeing it print, is there a different code to have it say it in game?
player:Say(getText("IGUI_YourTranslateString"))
the IGUI isn't printed in the situation?
or does this reference a translate string you have in another location
it's just text up from character
string in " " for translate stuff, for example
so
player:Say(getText("You cannot learn Athletic while you have the Very Underweight trait."))
Just do player:Say(„…“) for testing purposes in the beginning
The getText is usually ised so that you or other people can make it display the same text depending on the language chosen ingame
does Zomboid's Lua interpreter have a math library? I want to generate a random number, but I get "Object tried to call nil" on this line
i = math.random(0,1)
ZombRand right ?
I know they use ZombRand()
ohhh tysm
ZombRand
ZombRandFloat
ZombRandBetween
but it seems like this Lua interpreter doesn't have math.random function though
dunno why it doesn't work
It has its own rand functions
its kahlua thats why?
I don't code much in Lua, so I don't know much about it, sry 😔
Its a fork of lua
I guessed so
Hi... I need to change a Sandbox value using lua from server side... on client side I know I can do this...
local options = SandboxOptions.new()
options:copyValuesFrom(getSandboxOptions())
options:getOptionByName("XpMultiplier"):setValue(3.0)
options:sendToServer()
but looks like this is not woking running on server side. how can I do it? Anyone can help me ?
for the past two days im stuck with syncing globalmoddata b/w server and client. I have tried a lot of stuff but still there's no success. Looked up pretty much everywhere.
does anybody know which lua file handles "damage to objects" or damage overall ?
like when you shoot a door or a glass it just breaks, what file handles it ?
shooting players also works for me, and btw does anybody know of a file explorer or something that can search through the lines of lua files ?
.
like i use windows explorer to search a keyword and it shows .txt files with that word, anything similar for lua files ?
like search through folders and grab a particular snippet from inside one of those files? or just search through one file
i mean i just want to open "lua" folder
and search "brokenglass"
it should bring all files which have the word brokenglass in it
idk much, maybe checkout powertoys from windows
alright thanks, do you know the first one ?
i mean this one
nope

thanks, do you use one in particular ?
ye i think youd need to open root folder then?
i use intellij but vscodium is nice and light weight
ty so much
this is a random script i found in chats, wrote this one in server folder.
this one
When I was searching for wall stuff before I didn't find any lua referencing to object damaging.
So how did you solve that ?
I didn't need to implement anything related to damaging*, but you just can't do anything with it.
Anyone knows how the jumpscare is being triggered? Is there an event. I wanted to replace its sound ONLY for a specific zed type
Anyone ??
its just crap then, I guess i cannot add a breakable object of my own ?
You would need to use send commands
You can just add new thumpable object, which is breakable.
From the last thing I meant that you can't track zombie damage to object. (And I think any damage that is coming to object.)
I'm already sending commands... but what I need is that the change trigger on server side, like time related... even if no players is in the server...
this code works but on client side, and the sendToServer() aplly the changes... I need to do that in a certain time of the day, trigged on server side, so if no players are connected it still happen, and sendToServer() does not aply if running server side... is there any other functions I can call to do that ?
use servercommands to send the change to the clients manually
Did you try applySettings() instead of sendToServer(), because my guess is that you can't send to server while you're server.
Never try that, it is my think looking on sandboxoption methods.
found out the issue. I should've put the script in media/lua/server instead of media/lua/client 😄
modding this game is so fun
So the function I have checks for a trait and then does x depending on if you have it or not. The following line is throwing an error.
elseif player:HasTrait("Athletic") == true then player:Say(getText("You already have the Athletic trait.")) player:getInventory():addItem("SVAccessCards.VETBAthletic") <-----This line is where the error starts. I've tried this with and without quotes. player:getInventory():removeItem("SVAccessCards.ETBCorrupted")
AddItem
lol i swear
addItem is for passing an existing item
Yes.. I was trying that... didn't work either...
The thing is that the server is not applying it... so even if I send to players to change manualy, their values will be different from the server... And if I send a comand to player apply the changes.. then every palyer will set it at the same time and may bug the all thing... I'm trying something here
Can anyone explain to me the "doMenu" function? I'm learning modding and I've seen it in a bunch of mods. It's usually written like
function ResourceName.doMenu(player, context, worldobjects)
...
for example in the mods 'Trees have loot' or 'Rain Wash' (no promotion) in the client folder. But somehow i can't find where these methods are called or the parameters are passed? I even searched the PZ lua files and only found one instance of this method in 'media/lua/client/DebugUIs/AdminContextMenu.lua' in line 22. I don't find anythin in the docs
So now player:getInventory():removeItem("SVAccessCards.ETBCorrupted") isn't removing the ETBCorruptd but the above code is correctly adding the VetbAthletic back to inventory
there's no removeItem method, it's Remove
I think I was combining two separate things
thanks for your help
@rocky abyss This is their own global function that they made which is added to OnPreFillWorldObjectContextMenu event.
https://pzwiki.net/wiki/Lua_Events/OnPreFillWorldObjectContextMenu
I see, so the event passes the parameters itself?
function SearchInTreeMenu.doMenu(playerNum, ISContextMenu, worldObjects)
... Code
end
Events.OnPreFillWorldObjectContextMenu.Add(SearchInTreeMenu.doMenu)
Yes
Ok ok, now it makes sense. thank you so much
Anybody know anything about one of your uploaded mods not updating to the workshop when you go through the steps in the game to update it?
Yeah... still not working
wdym? After upload the mod isn't uploaded in game or what ?
Workshop is updating every x time so if you upload your mod there is a cd on when its gonna be updated automatically, unless you unsubscribe and subscribe again.
I uploaded a mod to the workshop. I have done work on the mod since then. I try to update the mod and it acts like it works just fine but it in fact doesn't update any code changes
How often does the code update cause I tried it yesterday and it acted like it worked fine, but I checked it to day and it still isn't updated.
Well it should be updated, maybe you didn't put your changed code into the correct folder before uploading.
If you want to upload an update/mod, you need to change it as well in Workshop/Collection/Content/Mod/modname.
You can see the whole structure here
https://github.com/Kamer5555/PZ-Modding/tree/main
oh you need to change it both places
Bc game is taking the files from there only *If you want to upload it on steam workshop.
in mods folder you can test your mod locally or when hosting a server without putting it on steam workshop.
i wouldn't recommend having your mod in both folders to begin with
the loading can be inconsistent and sometime it'll load files from both versions, so updating it can give you weird undiagnosable issues
I would say have your mod in mods folder only and then put it inside workshop folder when you need to upload it, then simply put it away somewhere safe or delete from workshop folder, so you won't mess up.
well what i usually do is i have a folder on my desktop where i keep the current working file. then I create a copy -test to put in my mods folder
personally once i've moved it there to upload, it stays in the workshop folder
the workshop one just exists
Yeah that are just preferences, both work well.
But try to always have one folder with your mod.
yeah thats my desktop folder
a copy-test folder is edited when im making changes and then copied over to the mod folder with the - test name
Can I see the workshop dir where you put your files to upload ?
I hope you didn't put your newly updated files there...
the mods folder is the one with all the extra content folder
There is another Workshop folder in User/Zomboid folder.
oh neato
Check the structure that I sent you in dm.
ill just delete that edit and and itll redownload the old one
Hopefully this time it will work 😄
Little update, he did manage to get it to work.
taking a break from all of these advanced mods
Im making a mod that lets you jar more foods
I'm trying to make a mod with the wifey, and we're trying to copy the Smoker trait as a base.
Where can I find the syntax for what the smoker trait does in the game files?
We're trying to copy the "addiction" and "deprivation" the trait provides for something we're making.
The smoker trait (and every other trait) can be found in
media/lua/shared/NPCs/MainCreationMethods
It also includes jobs in there
I tried to look in there, but there's only the UI localization, and not the actual effects that smoker causes
I tried looking under "Smoker" with CTRL+F and I could only find the localization
One sec
Okay so apparently traits are built into the Java code
You can still make your own traits with lua, but the code relating to how a vanilla trait works is in the Java code
Idk much About decompiling games either
I couldn't find the exact code, but the smoker trait increases your stress (Probably every tick) when you pass the time threshold since you last smoked.
public float getTimeSinceLastSmoke() {
return this.timeSinceLastSmoke;
}
public void setTimeSinceLastSmoke(final float n) {
this.timeSinceLastSmoke = PZMath.clamp(n, 0.0f, 10.0f);
}
Couldn't dig that down to find exact update method for smoker trait.
The time is estimated after you smoke.
it's java
it's updated in bodydamage's updateboredom iirc?
i don't remember for sure which one it was but it definitely wasn't part of the stress update
I think I have it
if (this.getParentChar().Traits.Smoker.isSet()) {
this.getParentChar().setTimeSinceLastSmoke(this.getParentChar().getTimeSinceLastSmoke() + 1.0E-4f *
GameTime.instance.getMultiplier());
if (this.getParentChar().getTimeSinceLastSmoke() > 1.0f) {
double n = Math.floor(this.getParentChar().getTimeSinceLastSmoke() / 10.0f) + 1.0;
if (n > 10.0) {
n = 10.0;
}
this.getParentChar().getStats().setStressFromCigarettes((float)
(this.getParentChar().getStats().getStressFromCigarettes()
+ ZomboidGlobals.StressFromBiteOrScratch / 8.0 * n * GameTime.instance.getMultiplier()));
}
}
It was in BodyDamage.class
Thank you so much! Her and I will dissect this coding and see what we can understand. Thank you all for your help <3
Love y'all and appreciate your help
I really do.
There you have full method
https://pastebin.com/bz8KQVZ1
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
youre welcome :))
maybe you be interested in that too
#mod_development message
Thank you! Right now, we're trying to determine this line of code from the Even More Traits mod:
function AddictPillsTaken()
PlayerData.LTimeSinceLastPills = 0
BodyDamage:setUnhappynessLevel(BodyDamage:getUnhappynessLevel()-15)
Since we both can't figure out how the mod knows when you last took pills/smoked, and how it differentiats sleeping/pain pills from antibiotics
It's a real humdinger
i'd look for any references to GameTime
it looks like a counter, they'd need to use gametime to get a delta to add
something happening ontick would be a good place to look too
So they generate random value (Number) at start if last time doesn't exists with:
if not PlayerData.LTimeSinceLastPills then PlayerData.LTimeSinceLastPills = ZombRand(250,500) end
Then they add one to it every time when function is called.
PlayerData.LTimeSinceLastPills = PlayerData.LTimeSinceLastPills + 1
They also calculating the days (for some reason.)
local DaysSinceLastPills = PlayerData.LTimeSinceLastPills/60/24
If a player take pill, the PlayerData.LTimeSinceLastPills global table is getting reset to 0 at the start of the function (in one that you sent above).
By looking on Events, it updates every minute in game.
They did that prob to get more performance since they update like 10 traits per minute.
Any vids someone reccomend on how mod PZ thats up to date?
Learn to write your own mods for Project Zomboid build 41! Make it multiplayer ready from the start!
Some Resources:
For Items and Recipes
https://theindiestone.com/forums/index.php?/topic/15188-item-and-recipe-script-variables-brief-description/
LUA Event List
https://pzwiki.net/wiki/Modding:Lua_Events
IsoPlayer
https://projectzomboid.com/m...
this is supposed to be triggered after recieving moddata, it's just shows up at the launch of game.
ugh i havea typo
testing stuff for MP is sucha pain
why would I be getting Zombie: removing stale zombie 5000 id=-1 in the debug console if I'm spawning zombies via addZombiesInOutfits()
I can't find anything that makes sense, i'm spawning zeds onWeaponSwing (reasons...) and it was working, but now i feel like it's broken.
i think i may have went a little overboard with this but before i code i feel like i need to have the basics clear. I drew a board of stuff to sync global mod data across server/clients. It's like a flow chart of top view of everything, id like some input if im going right with this. Here's a link to whiteboard i drew https://webwhiteboard.com/board/esuMtSUnDhVe6dENARKhR3UfmeBeMYLI/
Get hands-on right away with the Web whiteboard for instant collaboration, where you can brainstorm, share ideas and manage projects without signing-up. Try it, it’s free!
looks good to me
sweet thanks, this is all very confusing to work with.
one more thing, should i put checks in b/w to verify if client or server? for specific triggers
you should check if it's a server for the server code because that will run on the client by default
there's no need to check client as long as your code is in the client folder though
oh oki ill do that
if its gonna run on client by default then just putting a check wouldnt be enough no? i mean check would make sure it doesnt run on client side but how does it makes it so runs on server side if this makes sense.
everything in lua/ runs on the client, only everything in shared/ and server/ runs on the server
i think you prolly mentioned this one earlier, idk why i had in mind that /server and /shared is just for organisations and stuff like which script runs first.
that is mostly correctly still, since you would expect server not to run on the client
but 
this is prolly gonna be 1485485845898928th trial for MP les go
it didn't work
here are the files just if you wanna look
server side handler
client side handler
Hi, I'm trying to write a recipe for the greenfire mod, but the game didn't start, can someone help me please?
module Greenfire
{
imports
{
Base
}
recipe Force Dry Cannabis Sugar Leaf
{
FreshCannabisSugarLeaf=10,
BlowTorch=2
keep BakingTray/RoastingPan,
Result:DryCannabisSugarLeaf=10,
Time:150.0,
Category:Cooking,
SkillRequired:Cooking=5,
OnGiveXP:Recipe.OnGiveXP.Cooking3,
Sound:PZ_Fire,
NeedToBeLearn:false,
Category:GreenFireFarming,
CanBeDoneFromFloor:true,
}
}
it should be import i believe
Hello, will Events marked as "server" work for client as well ?
and also, does OnWeaponSwing work for firearms as well ?
or OnWeaponHitCharacter
Just reposting this here instead of tech support...
So i've made a small mod to change the default sounds such as gunfire and screaming with the meta events but I've no idea how to test them properly.
Is there a way to trigger/spawn a screaming or gunshot meta event? I know the LUA code to test a helo event is testhelicopter() but I've no idea how to test the others.
I thought I remembered something but no luck sadly :/
OnWeaponSwing is your attack event
Everytime you attack it triggers
no matter the weapon ?
Yea
I think even when you shove it triggers
thank you, it saved me some time
does anybody know why the lua file wouldn't want to update even though i do it externally and press reload in F11 menu ?
If its an event they wont update since it probably has the instance of it saved during runtime and wont make a new one if you update the file
You have to go in and out the game for that
i mean the events.blabla.add() stays the same, i only change the code before it
weird
ill try doing that
I've noticed there's a severe lack of medieval maps mods in PZ (except for the one that doesn't work) is anyone working on anything like that? Or am I gonna have to take matters into my own hands?
Is there any tutorial somewhere on how to make a patch for mods to like buff/nerf items?
what settings do i have to use in blender for the export so it doesnt look like this in pz?
dump question but does pz faction safe as an id and can it be read?
Hello. I am working on the Literacy perk and I would like to set its base value to 5 and remove this +n% XP multiplier when selecting traits (basically make it work the same way as Fitness and Strength works). Where in the code can I find predefined values like these?
<alternate category="Group05" style="M_TestHair" />
<alternate category="Group06" style="Bound" />
Group01 = Hats
Group02 = Bandannas/Bandages
Group03 = Hoods
Group04 = Full Helmets
does anyone know what group 5 and 6 are?
i think 6 is bound hair?
but i don't have a clue what 5 is
is there a way to get which direction the player is currently going? I want to check if player is going backwards
Is there any tutorial somewhere on how to make a patch for mods to like buff/nerf items?
do you just want to change item stats?
Pretty much, maybe make certain items more rare or not even spawn etc.
I tried editing the lua and txt files but clients connecting to the server has to edit that too
Don't take my word for it, but I don't think you can patch mods. You have to change whatever you want and then redistribute the mod, but you probably need mod's creator permission for that..
Was told by Beard the tech support guy that it was allowed to make an addon/balance patch and upload them aslong as you credit the original mod with link etc
then do that
Yeah, thats why im asking for a tutorial if there was one that existed
you don't know how to upload a mod or what?
More specific on how to make a mod that force changes values of items like stats, drop rate etc if the item already exists within another mod
I get it has to be loaded behind the changed mod
then you probably just have to override all the files. Make the exact copy of the mod, don't change any file names or anything, just change the values and I think it should override the files
If its just a txt or lua that puts new values with the name namefields its fine but i figured it won't be so Imple?
Just seems overkill if you only want to change like 5 item spawnrates, suurely theres a way to make a new mod that just contain those 5 without all the other fillers that remains unchanged?
I dunno honestly, I'm new to modding, but that's what I would try to do
You don’t have to overwrite the entire mod, if you want to change the spawn rates you only need to overwrite the distributions file for it. Just edit the original in notepad++ and save it with the same file name(Don’t save it in the original mods folder)put it in your own mod, and load it after the original mod.
Are you clicking "reload file at the bottom of file" Instead of reload icon right next to file?
reloading won't update functions added to events as the event is storing its own copy of the function
Oh yes and I fixed it thank you ppl
Well does anybody have a neat way of making a timer ?
For example lets say I want my character to say something like 5 minutes after I do something
Swing weapon
If pz doesn't have something for it then you'd have to look at time stuff in lua or something. Although I feel like there would def be a method for it.
pz doesn't have anything for it
there's an api for it
otherwise you can either save the time and compare it to the current time, or add up a delta
What if I declare a variable timer and set it to 5 everytime I shoot, then add a function to OneMinute event to decrease the value of the timer
And then trigger the thing I want to do when the timer hits 0 ?
Does it sound possible
yeah that'd work
Thank you, I'll try it.
Any ideas why the remove part of this code isn't working?
elseif player:HasTrait("Athletic") == true then player:Say(getText("You already have the Athletic trait.")) player:getInventory():AddItem("SVAccessCards.VETBAthletic") player:getInventory():Remove("SVAccessCards.ETBCorrupted") <----- This line does not remove the item.
it's probably expecting an item to be passed, not a type
try
local item = player:getInventory():getFirstType("SVAccessCards.ETBCorrupted")
player:getInventory():Remove(item)
Ill give that a try, thank you
can that local be declared at the top of the function so it applies to them all or should i create a new global item with a name like ETBCorrupteditem = player:getInventory():getFirstType("SVAccessCards.ETBCorrupted")
cause this will be called like 900 times probably
in multiple functions
it should be fine as a local in the function
i'd recommend saving the inventory as a local too
So like this `function Recipe.OnCreate.VETBAthletic(player, traits, items)
local player = getPlayer()
local inv = getInventory()
local item = player:inv:getFirstType("SVAccessCards.ETBCorrupted")
if player:HasTrait("Fit") == true then
player:Say(getText("Your Fit trait has been replaced by the Athletic trait."))
player:getTraits():Remove("Fit")
player:getTraits():add("Athletic")
elseif player:HasTrait("OutofShape") == true then
player:Say(getText("You cannot learn Athletic while you have the Out of Shape trait."))
player:inv:AddItem("SVAccessCards.VETBAthletic")
player:inv:Remove(item)
elseif player:HasTrait("Obese") == true then
player:Say(getText("You cannot learn Athletic while you have the Obese trait."))
player:inv:AddItem("SVAccessCards.VETBAthletic")
player:inv:Remove(item)
elseif player:HasTrait("Overweight") == true then
player:Say(getText("You cannot learn Athletic while you have the Overweight trait."))
player:inv:AddItem("SVAccessCards.VETBAthletic")
player:inv:Remove(item)
elseif player:HasTrait("Unfit") == true then
player:Say(getText("You cannot learn Athletic while you have the Unfit trait."))
player:inv:AddItem("SVAccessCards.VETBAthletic")
player:inv:Remove(item)
elseif player:HasTrait("VeryUnderweight") == true then
player:Say(getText("You cannot learn Athletic while you have the Very Underweight trait."))
player:inv:AddItem("SVAccessCards.VETBAthletic")
player:inv:Remove(item)
elseif player:HasTrait("Athletic") == true then
player:Say(getText("You already have the Athletic trait."))
inv:AddItem("SVAccessCards.VETBAthletic")
inv:Remove(item)
else player:getTraits():add("Athletic")
end
end`
it would just be inv:AddItem, not player:inv:AddItem
then yeah, you get it
uh not totally
so you don't need to declare
it just defaults to pulling the player inventory?
oh, right, i missed that part 😅 no it does need to be player:getInventory() when you make the local
so
`function Recipe.OnCreate.VETBAthletic(player, traits, items)
local player = getPlayer()
local inv = player:getInventory()
local item = player:inv:getFirstType("SVAccessCards.ETBCorrupted")
if player:HasTrait("Fit") == true then
player:Say(getText("Your Fit trait has been replaced by the Athletic trait."))
player:getTraits():Remove("Fit")
player:getTraits():add("Athletic")
elseif player:HasTrait("OutofShape") == true then
player:Say(getText("You cannot learn Athletic while you have the Out of Shape trait."))
inv:AddItem("SVAccessCards.VETBAthletic")
inv:Remove(item)
elseif player:HasTrait("Obese") == true then
player:Say(getText("You cannot learn Athletic while you have the Obese trait."))
inv:AddItem("SVAccessCards.VETBAthletic")
inv:Remove(item)
elseif player:HasTrait("Overweight") == true then
player:Say(getText("You cannot learn Athletic while you have the Overweight trait."))
inv:AddItem("SVAccessCards.VETBAthletic")
inv:Remove(item)
elseif player:HasTrait("Unfit") == true then
player:Say(getText("You cannot learn Athletic while you have the Unfit trait."))
inv:AddItem("SVAccessCards.VETBAthletic")
inv:Remove(item)
elseif player:HasTrait("VeryUnderweight") == true then
player:Say(getText("You cannot learn Athletic while you have the Very Underweight trait."))
inv:AddItem("SVAccessCards.VETBAthletic")
inv:Remove(item)
elseif player:HasTrait("Athletic") == true then
player:Say(getText("You already have the Athletic trait."))
inv:AddItem("SVAccessCards.VETBAthletic")
inv:Remove(item)
else player:getTraits():add("Athletic")
end
end`
looks good, you missed a player:inv when you declared item but yeah
where?
local item = player:inv:getFirstType("SVAccessCards.ETBCorrupted")
local item = player:inv:getFirstType("SVAccessCards.ETBCorrupted") is what I have so I'm a bit confused
also can I import SVAccessCards so I just have to put the VETBAthletic part in, does that work in the luas?
im trying to remember all the rules I've learned lol
no, there's no equivalent for that in lua
it should be just local item = inv:getFirstType("SVAccessCards.ETBCorrupted")
Code works perfect, thanks for all your help, time to go add all the traits and their mutually exclusives
anyone have an idea on why theres texture glitching + the missing back wheels?
Is the Cat's Eye trait Nightvision in the files?
i think it's hardcoded into the lighting engine
are you using the same model/texture for all 4 wheels or a different one for each?
same texture for all 4
and model?
yea
Is there a way to trigger a sound file to be played ?
then if one works they shold all work.
about the syncing of globalModData, since it ddint work i switched to another approach. The idea is to just have stuff on server side and request it from client side and update it. Although havent had much success with this one too. Looking for directions or inputs. Ill add this server side script, apart from this i only call transmit(key) in my base script in /client
Or do you know of a mod that plays a custom sound, but not gun mods pls because I think their sound playing mechanisms are hardcoded with only giving you the option to add a custom file
open to any other ways to achieve the same result if possible, i need to have globalModData to be complete at least one side of the wall in order for it to work on MP.
Hey everyone 👋 Trying to create my first mod but running into an issue.. I have created a mod.info file as the following
Is there something wrong or is file structure incorrect?
.
does it have .info as extention?
Yes it does
also are you trying to upload it to steam?
Yes I’m trying to upload it to the workshop
well try to rename and save the .info extention exclusively maybe itll work. I don't see anything wrong apart from that. Plus the error says so.
@neon bronze have you worked with data mod data/global mod data b/w server/client before?
If I add a trait to a character does the game automatically add the positive/negative effects of having that trait or do i need to initialized them in some way
Ive worked with moddata but not with global moddata and syncing it
ah oki oki😄
What exactly do you want to achieve?
any ongoing checks for the trait will recognise it but effects you get from picking the trait e.g. a skill level increase aren't applied
just to have complete global mod data either on server or client, so i can work with that. I already did it with client but it's a problem if other clients dont know about it in MP.
this is generally the intended behaviour though
stale zombie means desync
yeah, the server is still a completely separate process
you don't have any ping but the client-server relationship is basically exactly the same as any other server
Sounds like what I wanted to achieve, thanks!
should i be running the spawn on server file?
that's what i'd try
how would that be different than spawning client-side? or is it just the same.
probably the same
i'll try it, thanks 
when i saw the error before it was because they were doing something on the server that had to be done by a client, so i imagine it can go the other way
the zombie ownership thing can make them strange to work with in that way
gotcha. it makes sense, i just thought zombies had to be spawned client-side
my guess is that the server will refuse messages about zombies it didn't create, which causes them to go stale on the client
zombies are generally client auth but i can imagine the server would still keep a list of actual zombies to check against
ohhh. would that have appeared in coop-console.txt? bc i completely forgot to check it 💀
unfortunately the server folder isn't server only 
valid, so isServer()?
i prefer not isClient() since most server code still needs to run in singleplayer
my guess is that whatever you're triggering the zombie spawns with might only fire on the client
otherwise without the isClient() check it should spawn zombies on both
OnWeaponSwing 
and addZombiesInOutfit
maybe sending a command to the server from the client file ? idk how commands work entirely but almost.
Just to be certain are effects like "Multiplies the chance of not being injured by a zombie attack by 1.3 (base 15% chance, modified by character's weapon skill). Additionally, alters the chance of clothes being damaged by walking through trees to 1 in 13." applied or do I need to add those as well
yeah, you'll need a command since that's a client event
should be, iirc literally all other trait effects are applied either whenever they're relevant or every frame
traits are literally just a list of strings for the game to check against, they're not even objects with properties or anything
module Base
{
recipe Make Jar of Apples
{
EmptyJar,
JarLid,
food.Apple=5,
Water=10,
Vinegar=2,
[Recipe.GetItemTypes.Sugar];1,
Result:CannedApple,
Time:100.0,
OnCreate:Recipe.OnCreate.CannedFood,
Category:Cooking,
OnGiveXP:Recipe.OnGiveXP.Cooking10,
}
}
Recipe all works besides the apples. I have 5 apples in my inventory but it says I cant craft my item
is it OnClientCommand or OnServerCommand 
OnClientCommand, they're named after the sender
thank you
anyone know if there is a good way bodylocation for clothes that allows multiple clothing in one spot using the same bodylocation
there are body locations that allow multiple items but iirc the ui doesn't actually have any support for equipping multiple items, it's only used behind the scenes
Someone with knowledge in animations can help me fix this issue? I've already tried everything i know. What im missing?
@crystal terrace @neon bronze managed to get it working.. mod is uploaded to workshop now thanks for your help
Everything seems normal
, but probably transition is fucked up.
Any thoughts on how to fix it?
you need to mess inside the animation file, personally I didn't touch animations yet.
you mean the weird leg thing?
Yes
create the transition animation like vanilla does for some of their animations.
in your animation, make the though bone roitation NEGATIVE whatever it is.
should rotate it right.
You'll likely need to make an animation that is the proper transition from crouch to prone. From the looks of things the game is attempting to "blend" the animations from one to the other to smoothly make that transition, and that's messing it up
I love how you all three answer that in the same time.
I'll try that, hope it fix it. I really don't want to make an transition animation. But if didn't work. That will be the only way i supposed
hey yall so im just starting to get into modding and i just started watched a couple tutorials here and there but im not sure how i can post this stuff (i dont know modeling that well but can do textures a bit) im wondering if i can use vanilla models and textures first to test it but do i have to insert them into the mod?
or can it take it from the vanilla game files
along with how do i put it on the workshop and how its format should be
im just getting into this stuff so please tell me if something is wrong
you can call the vanillas yeah
if something is in vanilla game (talking about textures/models) you can get them from there.
ah thanks
don't need to put them inside your mods folder.
how can i test the items though?
yeah
i got mod info and media in media theres the script for it
but dunno how to actually insert them
or is it just like that
can I force a player to render a single chunk afar from them?
thanks
if you add simple item, it should be in the game, you can get it from item list in debug mode.
if you want the item to appears in container, you need to add distribution.
ok quick question how can i implement this to the game
so i can test it
also im trying to make a backpacks expansion so does the piece of code i have go as something that would go into a script folder right?
follow the guide above to add new item , if you don't know the mod structure use this:
https://github.com/Kamer5555/PZ-Modding/tree/main/Example Mod
Then simply put the YourModFolder to mods folder located in users/user/Zomboid dir and enable it ingame.
then give yourself an item from debug mode.
uhhh i think i got it
like lets say its a mod it uses the scripts folder right
cuz i didnt really get that part
You need to create new script file which will include your new item.
so wait i got media in media i got "scripts" than in scripts i have a .txt
that has the code
is that right?
File dir should looks like this:
MyMod/media/scripts/myitems.txt
@bronze yoke thanks again, got it sorted out thanks to you 
MyMod and myitems.txt, you can name both as you like.
mods\Jesterim's BackPack Expansion\media\scripts/JBPE_Stats.txt
is that correct
Yes
do i just go to steamapps and slap it in there?
Put the mod inside C:/users/%yourUser%/Zomboid/mods
does it need the mods folder
like in a normal mod
you have to first access id than mods than the main content
or do i just put the normal main part
Before you upload your mod into steam workshop, you just need to put your mod inside mods folder.
got it
let me try this out
prob might not work since first time but whatever ig
alr it shows up so thats a good sign
oh yeah
it works
nice
now gotta add some models than add more stuff to it ig
thanks for the support @warped condor


@warped condor one last thing i dont need a serverside thing right i can just kind of use it in a mp if its clothing and other items such as guns and stuff right?
along with how do i make distrubition
I have a model that's appearing in the attachment editor, but is invisible when I equip it in game. I have a texture in media\textures, and using it in the model script. Anyone have any idea on what's wrong?
apply transforms.exe
make sure sized right. every time you move in obj mode. apply transforms.
@sonic needle could i ask a question
sure
Mod idea: megaphone. Makes pressing Q louder. Good for gathering large hordes for burning.
📣
i cant seem to find the gun cases model i want to retexture it to be fully black and have a + on it for my backpack expansion but i cant sdeem to find it (its gonna be a upg kit)
from the gunpack?
hmm. hard to say, i certainly see them, but check the wiki?
its on the wiki
dev's do funny naming to the models
traits are extra cancerly named yes....
i forgot but like it was pickupgreen idk
its complicated name
even though its foraging
metalworking is metalwelding
pure cancer
bro the devs named the rifle case flight case
oh yeah this gonna be very cancerous
How can I send a server message like chat command /servermsg "msg", but from lua script ?
About things being cancer just wanted to remind about translation 😄
Did this, but it still isn't showing in game. It's scaled properly, and transforms are properly applied, but it is still invisible. It appears in the attachment editor though
Idea: gps route on the map
Got it working, needed to do
{
}
``` instead of having it named something else
is Life and Living XP give functions hard coded into the game java or are they somewhere in the lua files?
it should be in the recorded media lua
Are there any server-side java mods aside from this one? I want more reference to understand it's done.
https://steamcommunity.com/sharedfiles/filedetails/?id=1178772929
What part of the code differentiates whether an item is found in the "hat" or "helmet" drop down? Tryin to get my helmets in the correct spots.
Most apparel mods have it in Hat
I am pretty sure all vanilla items listed in Helmet are fully enclosed
Like a motorcycle helmet but I may be wrong
check all of Online's workshop they made some. also Poltergeist made some server anti-hack and there is this one: https://steamcommunity.com/sharedfiles/filedetails/?id=2895974075 but afayk none of them explains how they do recompile java.
body location
or well
if you're adding it to the item selection manually, it's technically which body location you tell it, it doesn't check if it's actually in that location
How could I add gas to a BaseVehicle? Say I'm spawning a vehicle with addVehicleDebug
Isn't that if the server files are different, then you can't join it since you need to replace server files? or is it bypassed by something?
check between server and clients is only for lua afayk (and I do not know much on that topic).
When can I find console logs for server?
Perfect, thank you!
@bronze yoke @sleek forum and @sleek magnet, thanks for you help concerning my network questions! It's getting somewhere
Don't mind the "bedford falls" mod preview 😅 And also dont' mind the website design, it's a very early version
So much potential to make online leaderboards for most singleplayer zombie kills.
It's kinda part of the plan but there is a lot of work still, the idea is a simpler rocket league / apex / whatever tracker. Thanks for your input 🙂
Yeah whole idea looks great, keep up on work.
But also allowing you to track some stats for your own playthrough (POI on the map, found / read VHS / Books / magazine, known recipes, skills and traits)
Thanks! Appreciate it!
that's cool, i wonder if someone else pulled this off before in pz?
10 Years Later - Project Zomboid
Coop-console it is, now I'm very confident that transmit(key actually works and is not imaginary. Might be able to finally resolve the server/client issue that I have been stuck with for the past 3 days now.
idk anything about dane's work, but it could be done outside pz since his ranking is based on what is in db. Server and website are on the same server probably.
He also have icons for some traits stored in his website only.
hey so
i'm working on part of a mod that will spawn 'survivor' zombies with very specific outfits
and i'm noticing that the compression clothes they're suppposed to spawn with only spawn sometimes--i think it has something to do with them occupying the underwear slot and being replaced by 'naturally' spawned zombie underwear? is there a way to prevent that or does someone know what else might be going on?
Project zombieheimer is coming to a halt because I got school now 😔
progress, finally was able to send data from one client to server and transmit it back to all clients.
there's one thing tho that doesnt make sense to me, this script is supposed to be triggered when globalModData is recieved from the other side. But it's triggering by EveryOneMinute event which actually is responsible for transmit of data to server.
i think somehow this one triggers ClientReceiver every one min, i dont have a problem with it but id like to understand this behaviour. Since ClientReceiver should be triggered only when moddata from other side is recieved.
if it's transmitting every one minute then it's going to receive every one minute right?
by the way, you should check the keys in this function when your mod is more finished
but isnt it for the opposite side, i mean if client sends data then server side fires the event and vice versa
otherwise it'll write whatever data to the moddata for any mod that transmits mod data, even if another mod wants to do something else with it
ye ill do that this is just bare bone version to make it work.
i assumed so, just making sure
this is what i mean by this
doesn't your server transmit it back to the clients? so it's going to ping it back every minute
ah
wait let me double check
xd that makes sense
you're right
At least i know now for sure, otherwise that would have confused me more. Thanks.
Now that getting data across is out of the way, im wondering should i just keep track of data that's relevent to respective client or just all of my mod data should be synced.
to me just the client relevant data seems right, but just incase if im missing something.
is IsoObject moddata synced itself? b/w server clients
there's a function to transmit it
(which should always be called after modifying it)
so i update moddata for obj on client, i call the transmit method for it. Then next time im asking for its moddata, does it fetch from server? or just client
because i dont see any command to update/request from server just for IsoObjects
you use IsoObject:transmitModData(), that synchronises it on the server and every client to be whatever the calling environment has
the reason i say you should always call it after modifying it is because it synchronises it by overwriting it, so if you don't transmit it another client/the server transmitting it will overwrite what you added
i'm guessing that untransmitted moddata wouldn't save unless it was on the server either
ah got it, so whenever a client tweaks the moddata for IsoObject transmit must be used to update across every client and server.
without transmitting earlier, the other client didnt know data existed and thus affected one of my mods main functionality (like checking if a container is already configured or not before configuring it)
is there a way to sync items across clients as well? everything works out, but there's a desync b/w container items across clients. For ex: On client A, items from container A are transferred thus leaving it empty. But on client B, container A is still showing those contents which are already transferred. Hope this makes sense.
maybe this could be it, one of the methods in ItemContainer
addItemOnServer should be used in combination with addItem, same with removeItemOnServer
if a change is more complex than those would allow you then sendContentsToRemoteContainer() can be used
just as long as everything can be done on a client
doing it on the server sucks hard
oki ill give this one a try, what does this one exaclty do sendContentsToRemoteContainer(), i mean its not accepting any container as param so ?
or is it just a client/server thing
oh actually i think i was thinking of sendItemsInContainer
it sounds like that one probably does the same thing from the name but it's not the one i'm familiar with so i can't speak on it
sendItemsInContainer will update all sides to have the items that are currently in that container for the client sending it
(doesn't work on server, in fact none of this stuff does which is why it sucks so bad to do it on the server)
Since items in containers are client sided after veryfing the request you send to server, server can send callback to every player which gonna delete the item for them from that container.
idk about performance in this situation, but should work.
they get cached so the network usage shouldn't be terrible
not exactly sure when the cache gets emptied but it'd have to be at the very least during the next java tick, which means everything you did in the lua tick is batched as one message
alr i think ill try both like one item at a time and then also sendItemsInContainer just to see how it works out. Thanks for the information yall
.
heya peeps, how do you increase the "visible range" of a weapon? can't find any piece of code for it.
Let's say,
hunting rifle has long range, so you can zoom out to see pretty far,
Yet a shotgun should have smaller range so you can't zoom out as far.
that's just not a thing i'm afraid
It is though? In different ways
Some mods if you attach a long range optic, you can zoom out further
Idm if I have to do it through an attachment if that's the way u gotta do it
Just curious as to how
I think you would need to change
MaxRange = 1,
MinAngle = 0.65,
MinRange = 0.61,
of item value.
That sounds correct yeah
But if I change "maxrange" does that only impact the visible range? Or does it how far it can shoot aswell?
Say you attach a sniper scope to a pistol, you'd wanna see further but not be able to shoot further i.e.
gotcha
i think there's a hyperopia mod that forces you to zoom out by forcing your zoom level to the furthest one, but creating custom zoom levels is not possible with a conventional mod
MaxRangeModifier = 7,
MinRangeModifier = 1,
Found this under a scope from another mod
maybe these mods are just forcing you to zoom in if you don't have specific items?
Could be, but I'd see that in the code I'd feel like
can you point me to one of these mods? i feel like i'm gaslighting you at this point so i want to verify that this is real LOL
From looking at the wiki, Max / Min RangeModifier seems to be the correct value to change, but that also impacts the shooting range
Looked at the vanilla weapons + Firearms B41
so the vanilla weapons are supposed to do this?
The vanilla scopes do the same thing yes
They use "Min/MaxRangeModifier" to change how far you can see and therefore how far you can shoot
Like in arsenal when you hold a x scope attachment, you can zoom out more.
or look around more
further
ya
oh, like the distance you can pan the camera?
ya
i'm less sure about that being impossible, i thought you were talking about zoom level, but it's unfamiliar to me
Oh, might've been unclear sorry


i'm still missing something but i'll eventually get it