#mod_development

1 messages · Page 186 of 1

gusty wharf
#

TraitFactory.addTrait("Emaciated", getText("UI_trait_emaciated"), -10, getText("UI_trait_emaciateddesc"), true);
it's true there and I'm not so sure about what it means, I think it could mean if the trait is a profession exclusive one or something like that?

manic relic
#

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

chrome tinsel
#

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?

trim mist
#

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

umbral abyss
#

Its for profession traits, if its true it means it comes with a profession and you can't pick it alone

crystal terrace
#

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.

bronze yoke
#

but what sends it to the clients?

crystal terrace
#

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

bronze yoke
#

so when you update the client's mod data, you transmit it to the server? but what then transmits it to the other clients?

mellow frigate
#

It looks like you forgot to request on client side

crystal terrace
bronze yoke
#

you could probably just transmit it after you receive it

crystal terrace
#

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.

bronze yoke
#

it should be the same syntax

#

ModData.transmit(key) but on the server code instead of the client

crystal terrace
#

oh so just write stuff inside server folder

#

ill give it a try

#

exciting stuff haha, first mod 😄

bronze yoke
#

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

crystal terrace
#

those isclient and isserver makes sense now, i was just calling it from server side earlier no wonder it was just returning false.

patent knoll
#

What do you guys use for item modeling?

crystal terrace
#

3d stuff?

#

or just textures

patent knoll
#

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 :/

crystal terrace
#

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.

patent knoll
patent knoll
#

I made custom textures for my flares and someone might call them beautiful but I'm definitely not one of those people

crystal terrace
#

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

patent knoll
#

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

crystal terrace
#

it's only natural to be like that

neon bronze
#

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

low solstice
#
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.

bronze yoke
#

the areas are defined in AttachedLocations.lua

low solstice
# bronze yoke 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.

patent knoll
#

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)

bronze yoke
#

you've crossed the streams here

patent knoll
#

I believe it

bronze yoke
#

player:getTraits():add("Axeman")

patent knoll
#

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

bronze yoke
#

that's from traitfactory, that's for actually defining what a trait is

patent knoll
#

that makes perfect sense

#

thank you!

bronze yoke
#

players don't actually store traits at all, they just store a list of trait names

warped condor
# chrome tinsel Hello. I am currently working on a mod and have run into some issues with VHS ta...
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

patent knoll
#

is the code i want

bronze yoke
#

getPlayer()

#

local player = getPlayer() even

patent knoll
#

you are correct, i'd be the worst actual programmer

warped condor
mellow frigate
#

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.

warped condor
#

@mellow frigate What about storing the square where zombie is and checking it every reload

bronze yoke
#

zombies aren't really persistent

mellow frigate
warped condor
#

Yeah, that was my first think of it, didn't really try anything with zombies yet.

bronze yoke
#

if you flag it as a reanimated player you can track it with moddata

mellow frigate
sour island
#

At least if done excessively.

#

I still think giving a boolean to enable modData would be nice

mellow frigate
bronze yoke
#

it would, but i don't think there's another way to reliably track a zombie

sour island
#

That sounds like something is severely wrong

mellow frigate
sour island
#

When the player dies the left over zombie doesn't cause performance issues

bronze yoke
#

reanimated zombies have to keep their exact inventory, clothing, etc saved

#

most zombie stuff isn't saved because nobody would know anyway

willow estuary
#

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.

sour island
#

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?

willow estuary
#

Worlds can have hundreds of reanimated player entries so that should be fine.

sour island
#

This also means some player's performance issues are a skill issue 💀

warped condor
#

xd

sour island
#

It depends what you are trying to do. SWHelis use outfit IDs to apply changes

mellow frigate
#

I'll retry with 'reanimated player'. Maybe I misremember or just messed up last time.

fast galleon
chrome tinsel
patent knoll
#

Does anybody know why magazine's automatically disappear on use? and have an automatic read time. Is that designated in the literature type?

bronze yoke
#

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

patent knoll
#

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

patent knoll
neon bronze
#

you wont find a lot of documentation for pz through google atleast for specific things

patent knoll
#

maybe its JustReadSomething
public void JustReadSomething(Literature lit)

bronze yoke
#

yeah that

patent knoll
#

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,

bronze yoke
#

yeah

patent knoll
#

okay so as long as I give my book Type = Literature,

#

i should be good

bronze yoke
#

it's called by the reading action to apply the effects

patent knoll
#

is there a simple way to start a function from reading a book?

neon bronze
#

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?

patent knoll
#

or can I use LearnedTrait = JustReadSomething.function?

bronze yoke
#

nothing is parallel

low solstice
neon bronze
mellow frigate
#

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

bronze yoke
#

it's all in one thread

neon bronze
#

why

#

ok i can see why parallel threading is hard to do

#

so i take it back

bronze yoke
#

there's some java stuff that's multithreaded but the game is mostly singlethreaded and all lua is singlethreaded

neon bronze
#

multi thread mod when????

low solstice
#

Nvm I forgot they're using an outdated and I presume even deprecated lua Library at this point

fast galleon
#

there should be a function that adds all of the worn items 🤔

mellow frigate
mellow frigate
sweet nebula
#

wheres the mod creator

ripe vapor
#

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

sweet nebula
#

how do you create a mod that adds a poncho to the starting gear

bronze yoke
ripe vapor
#

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?

bronze yoke
#

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

covert carbon
#

Is there a way to set a tile on fire or spawn fire?

ripe vapor
mellow frigate
patent knoll
# sweet nebula Pls help

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.

gilded hawk
#

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?

mellow frigate
gilded hawk
#

nevermind, apparently it has no params

bronze yoke
#

i think it sometimes passes something, sometimes doesn't

gilded hawk
#

Interesting 🤔

bronze yoke
#

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

gilded hawk
#

Yep, you are right, I'll use OnLoadGridsquare

gilded hawk
#

I assume getContainer() should do the trick

bronze yoke
#

you'd need to loop through all the objects on the square

gilded hawk
#

Ah, okay

mellow frigate
fading horizon
#

finally finished my steam workshop theme

gilded hawk
#

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?

mellow frigate
#

is there a function to get an IsoZombie by its OnlineID in multiplayer ?

bronze yoke
#

no

final current
#

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

dark wedge
#

oh hey! just came here to post about that. ;D

dark wedge
bronze yoke
#

the mod doesn't run in singleplayer? isn't that a nuisance?

dark wedge
bronze yoke
#

i understand that it's not needed, but i don't want different code paths between singleplayer and multiplayer if i can avoid it

dark wedge
#

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

bronze yoke
#

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

dark wedge
#

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.

bronze yoke
#

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

azure shuttle
#

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

bronze yoke
dark wedge
#

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.

dark wedge
azure shuttle
#

Thank you much for the help!

normal scroll
#

Anyone knows if there's a way to prevent character from shooting while in animation transition?

elder stream
#

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?

fading horizon
#

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

elder stream
#

Fair enough

fading horizon
#

also how hard is creating a vehicle mod? I want to make the barbie bus

ancient grail
sleek forum
#

anyone know if it's possible to profile a group of mods to find performance issues?

fading horizon
#

made a cool preview button for the steam theme

warm vector
#

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?

sour island
#

I wonder if there could be a way to wrap all functions? 🤔

#

You can parse through _G I guess

#

check for function types

sleek forum
#

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

sour island
#

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

sleek forum
#

no rush really, but if I find anything I'll share

stiff fiber
#

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.

mellow frigate
bronze yoke
#

oh if online ids don't even work in singleplayer then it doesn't matter

sinful scaffold
#

How is this possible?

#

Is there a hidden setting on DEV mode that makes rare items spawn more often or something?

mellow frigate
#

Is there any mod that used successfully IsoZombie setReanimatedPlayer and ModData in Multiplayer ?

thorn tartan
#

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

sleek forum
#

@sinful scaffold what are we looking at here?

sinful scaffold
# sleek forum <@247611582975049728> 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.

sleek forum
#

do you have any other mods that are modifying loot variables?

sinful scaffold
#

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.

sleek forum
#

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

gilded hawk
#

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

sleek forum
#

i don't know but a square can contain tiles which can be of type container, a fridge could be a tile for example

gilded hawk
#

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)

fast galleon
#

||isoObject:getSprite():getProperties():Val("ContainerCapacity") ||

gilded hawk
#

Apparently not by looking at the java code 🤔

sleek forum
#

@sinful scaffold how is your LootZed displaying guns and magazines in GigamartToys?

#

is that your mod?

#

BB mod doesnt say anything to me

sinful scaffold
#

Yes, that's my mod.

sleek forum
#

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) {
mellow frigate
sinful scaffold
#

What do you mean?

sleek forum
#

never knew zombieIntensity had an effect on loot..

sinful scaffold
sleek forum
#

What's interesting is that you have 8 items

sinful scaffold
#

I got 5 dolls, each of them with a fraction of a percent of chance to spawn, in the same toy store.

sleek forum
#

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,
        },
sinful scaffold
#

Teleported to the Toy Store inside the Mall and found 5 Beavers

#

TIS Pls

sleek forum
#

what are your loot modifier settings

sinful scaffold
#

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?

sleek forum
#

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

sinful scaffold
#

So I have to fight through all the zombies the old fashioned way to check actual spawn rates? drunk

sleek forum
#

only if you want to find out

sinful scaffold
#

Damn, that's a powerfu line.

#

Now I have to find out.

sleek forum
sinful scaffold
#

Well, Riverside here I go.

sleek forum
#

do the bb guns keeel?

mellow frigate
balmy swan
#

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.

gilded hawk
# fast galleon ||`isoObject:getSprite():getProperties():Val("ContainerCapacity")` ||

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
sleek forum
#

@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"));
               }
            }

         }
      }
   }
gilded hawk
sleek forum
#

maybe you can print of what properties th sprite actually has

fast galleon
#

nevermind

sleek forum
#

you might just be accessing the wrong object

gilded hawk
fast galleon
#

what kind of tile is it, do you have a sprite name I can check?

gilded hawk
#

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

sinful scaffold
#

Doing this with zombies on your ass is much harder, but.

#

New World, no Mod.

#

I found A Spiffo too

mellow frigate
#

Yeah, I see what no mod means to you.

gilded hawk
gilded hawk
fast galleon
#

in the code above, it makes a new ItemContainer object which would have 50 capacity and then sets a different one based on ContainerCapacity

gilded hawk
#

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

sinful scaffold
#

I'm not making this stuff up.

sleek forum
#

where is this?

#

do you have coords?

sinful scaffold
#

Riverside

#

6448 x 5298

mellow frigate
# sinful scaffold

nice, you can use -debug and F9 to activate vanilla debug god mode and therefore not be attacked by Zs

fast galleon
sinful scaffold
#

And not just the items in my mod, but completely vanilla as well.

#

Which is just weird

fast galleon
#

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

sinful scaffold
#

And it seems to be specifically the items with the 0.00x items as well, regularly spawning items seem to be spawning regularly.

sleek forum
#

i found 1 spiffo and 1 otis the pug or whatever

sinful scaffold
sleek forum
#

well i dont know about that

#

but theyre probably not as rare as you think they should be

willow estuary
#

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.

low solstice
sinful scaffold
neon bronze
#

does every IsoObject have an Emitter from which it can play a sound?

sleek forum
#

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

neon bronze
#

i think its the BaseCharacterSoundEmitter that im looking for

#

well the object that i wanted to has it

sleek forum
#

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

patent knoll
#

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

low solstice
sinful scaffold
#

So with less zombies spawning there should be less chances of there being a plushie in those containers?

sleek forum
#

i dont think it's the amount of zombies that are there, but the amount of zombies that has been configured there

low solstice
sinful scaffold
#

Hmmmmmmmmmmmmmmmmm

low solstice
#

but well Container rolls seem to be able to be affected by zombie loot intensity as well

sleek forum
#

it is

#

but i dont see any magic numbers

low solstice
#

a lot of branching happening

sleek forum
#

i mean i literally copied the code

#

if ((float)Rand.Next(10000) <= chance * 100.0F * lootModifier + zombieIntensity * 10.0F) {

low solstice
#

I wonder from where, as I can't seem to find a similar entry.

sleek forum
#

public static void doRollItem(ItemPickerContainer itemPickerContainer, ItemContainer itemContainer, float zombieIntensity, IsoGameCharacter gameCharacter, boolean var4, boolean var5, ItemPickerRoom itemPickerRoom)

low solstice
#

ah nvm

#

but be aware of rollContainerItem;

sleek forum
#

@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

gilded hawk
#

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

fast galleon
#

most people hook to ISInventoryTransferAction.transferItem

gilded hawk
fast galleon
#

it's for local players on client

gilded hawk
#

ooof, okay

#

Well I attached to both OnRefreshInventoryWindowContainers and OnContainerUpdate and it seems better now

crystal terrace
#

is there an admin command to switch to day in-game?

verbal yew
#

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

fast galleon
#

did you mean to use function InventoryItem:hasTag(tag) end?

verbal yew
#

one sec

#
    scriptItems:addAll(getScriptManager():getItemsTag("zReRepairableVest"))
end ```
-- it's work, bruh... I think I really screwed up with the search for the tag
verbal yew
#

hasTag?

patent knoll
#

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 ?

verbal yew
#

fixed :3

#

damn yeah

mellow frigate
eager mirage
#

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)
crystal terrace
#

maybe check if inventory item exists

eager mirage
#

but why?

verbal yew
#

Guys, it's possible to hide recipe, but use it from context menu?

crystal terrace
verbal yew
bronze yoke
#

it can be nil when emptying your hands

fast galleon
#

also yes, item can be nil too

fast galleon
#

I think it happens when it is hidden.

eager mirage
verbal yew
#

How to add context submenu for world object? like Clean bandage or clothes? (for water source, i need clean func for my item)

bronze yoke
#

that means the inventoryItem is nil

eager mirage
#

is OnEquipPrimary a valid event tho? I am looking for it in Javadoc reference and can't find it

bronze yoke
#

the javadoc doesn't have an event list

eager mirage
#

oh

#

that makes sense 😅

eager mirage
#

thank you kind discord user

low solstice
bronze yoke
#

does it? i've never heard any reports

low solstice
#

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

bronze yoke
#

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

low solstice
#

not to mention that a lot classes just have fields as the type any which isn't helpful

bronze yoke
#

i didn't write candle but i am the maintainer for the time being

low solstice
low solstice
bronze yoke
#

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

crystal terrace
#

is there a way to launch debug mode on client side?

low solstice
bronze yoke
#

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

low solstice
#

well sec

bronze yoke
#

the types should just be grabbed from the source so i'm not sure why they'd end up unspecified

low solstice
#

Maybe it was Candle or the other Lua thingy

bronze yoke
#

oh, the lua one, yeah

low solstice
#

yea probably the Lua repo

bronze yoke
#

it's difficult to programmatically get types from a non-typed language

low solstice
#

well yea

#

would help if IS would include lua type information themselves

bronze yoke
#

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 😅

low solstice
#

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

bronze yoke
#

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

low solstice
#

I'd be happy with Fleet getting Lua well custom LSP support but I'm also just fine with nvim atm

patent knoll
#

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?

neon bronze
#

getPlayer()

patent knoll
#

would that cause the whole function not to exist?

#

also thank you for pointing that out

neon bronze
#

Also remove the then after your print

#

If your syntax is invalid it will remove the function during runtime

patent knoll
#

kk ill go remove the extra thens

verbal yew
#

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

patent knoll
#

I have the ends in ther that was just a snippet of the function

verbal yew
#

nope, i only about then

patent knoll
#

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

verbal yew
#

here all look fine... hm

patent knoll
#

i'll run it in one moment and see if that corrected the issue I was having

patent knoll
verbal yew
patent knoll
#

the IGUI isn't printed in the situation?

#

or does this reference a translate string you have in another location

verbal yew
#

string in " " for translate stuff, for example

patent knoll
#

so
player:Say(getText("You cannot learn Athletic while you have the Very Underweight trait."))

neon bronze
#

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

patent knoll
#

well ill go ahead and put the get text part in there

#

thank you for your help

eager mirage
#

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)
warped condor
#

ZombRand right ?

patent knoll
#

I know they use ZombRand()

warped condor
#

Yeah ^

#

But this function is slower than lua one.

eager mirage
#

ohhh tysm

neon bronze
#

ZombRand
ZombRandFloat
ZombRandBetween

eager mirage
#

dunno why it doesn't work

neon bronze
#

It has its own rand functions

crystal terrace
#

its kahlua thats why?

eager mirage
neon bronze
#

Its a fork of lua

eager mirage
frosty estuary
#

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 ?

crystal terrace
#

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.

tepid dawn
#

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 ?

crystal terrace
tepid dawn
#

i mean i just want to open "lua" folder

#

and search "brokenglass"

#

it should bring all files which have the word brokenglass in it

crystal terrace
#

idk much, maybe checkout powertoys from windows

tepid dawn
#

alright thanks, do you know the first one ?

crystal terrace
#

nope

tepid dawn
bronze yoke
#

any ide will let you do this

#

ctrl-shift-f usually

tepid dawn
crystal terrace
#

ye i think youd need to open root folder then?

bronze yoke
#

i use intellij but vscodium is nice and light weight

tepid dawn
#

ty so much

crystal terrace
#

this one

warped condor
warped condor
#

I didn't need to implement anything related to damaging*, but you just can't do anything with it.

ancient grail
#

Anyone knows how the jumpscare is being triggered? Is there an event. I wanted to replace its sound ONLY for a specific zed type

tepid dawn
ancient grail
warped condor
#

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

tepid dawn
#

oh I don't necessarily have to do it

#

thanks

frosty estuary
frosty estuary
bronze yoke
#

use servercommands to send the change to the clients manually

warped condor
#

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.

eager mirage
#

modding this game is so fun

patent knoll
#

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

bronze yoke
#

AddItem

patent knoll
#

lol i swear

bronze yoke
#

addItem is for passing an existing item

patent knoll
#

you told me that before

#

i'm just a dummy, thanks

frosty estuary
frosty estuary
# bronze yoke use servercommands to send the change to the clients manually

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

rocky abyss
#

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

patent knoll
bronze yoke
#

there's no removeItem method, it's Remove

patent knoll
#

thanks for your help

warped condor
rocky abyss
warped condor
#
function SearchInTreeMenu.doMenu(playerNum, ISContextMenu, worldObjects)
  ... Code
end

Events.OnPreFillWorldObjectContextMenu.Add(SearchInTreeMenu.doMenu)
#

Yes

rocky abyss
#

Ok ok, now it makes sense. thank you so much

patent knoll
#

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?

warped condor
#

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.

patent knoll
#

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.

warped condor
#

Well it should be updated, maybe you didn't put your changed code into the correct folder before uploading.

patent knoll
#

user/user/yadayada

#

user/user/zomboid/mods/modname/content...?

warped condor
#

If you want to upload an update/mod, you need to change it as well in Workshop/Collection/Content/Mod/modname.

patent knoll
#

oh you need to change it both places

warped condor
#

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.

patent knoll
#

oh okay neato

#

well that didn't work

bronze yoke
#

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

warped condor
#

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.

patent knoll
#

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

bronze yoke
#

personally once i've moved it there to upload, it stays in the workshop folder

patent knoll
#

the workshop one just exists

warped condor
#

Yeah that are just preferences, both work well.

#

But try to always have one folder with your mod.

patent knoll
#

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

warped condor
#

Can I see the workshop dir where you put your files to upload ?

patent knoll
warped condor
#

I hope you didn't put your newly updated files there...

patent knoll
#

the mods folder is the one with all the extra content folder

warped condor
#

There is another Workshop folder in User/Zomboid folder.

patent knoll
#

oh neato

warped condor
#

Check the structure that I sent you in dm.

patent knoll
#

ill just delete that edit and and itll redownload the old one

warped condor
#

Hopefully this time it will work 😄

#

Little update, he did manage to get it to work.

covert carbon
covert carbon
#

taking a break from all of these advanced mods

#

Im making a mod that lets you jar more foods

severe zenith
#

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.

covert carbon
#

It also includes jobs in there

severe zenith
#

I tried looking under "Smoker" with CTRL+F and I could only find the localization

covert carbon
#

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

warped condor
#
    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.

bronze yoke
#

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

warped condor
#

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

severe zenith
#

Love y'all and appreciate your help

#

I really do.

warped condor
wheat kraken
severe zenith
#

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

bronze yoke
#

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

warped condor
#

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.

marsh egret
#

Any vids someone reccomend on how mod PZ thats up to date?

crystal terrace
#

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

final current
#

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.

crystal terrace
#

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/

bronze yoke
#

looks good to me

crystal terrace
#

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

bronze yoke
#

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

crystal terrace
#

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.

bronze yoke
#

everything in lua/ runs on the client, only everything in shared/ and server/ runs on the server

crystal terrace
#

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.

bronze yoke
#

that is mostly correctly still, since you would expect server not to run on the client

#

but drunk

crystal terrace
#

this is prolly gonna be 1485485845898928th trial for MP les go

crystal terrace
#

it didn't work

#

here are the files just if you wanna look

#

server side handler

#

client side handler

crystal idol
#

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

}

crystal terrace
tepid dawn
#

Hello, will Events marked as "server" work for client as well ?

#

and also, does OnWeaponSwing work for firearms as well ?

#

or OnWeaponHitCharacter

sacred tangle
#

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.

tepid dawn
neon bronze
#

Everytime you attack it triggers

tepid dawn
#

no matter the weapon ?

neon bronze
#

Yea

tepid dawn
#

cuz swing seemed like only melee weapons and maybe bashes

#

thanks

neon bronze
#

I think even when you shove it triggers

tepid dawn
#

thank you, it saved me some time

tepid dawn
#

does anybody know why the lua file wouldn't want to update even though i do it externally and press reload in F11 menu ?

neon bronze
#

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

tepid dawn
#

i mean the events.blabla.add() stays the same, i only change the code before it

#

weird

#

ill try doing that

plush horizon
#

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?

warm vector
#

Is there any tutorial somewhere on how to make a patch for mods to like buff/nerf items?

royal stirrup
#

what settings do i have to use in blender for the export so it doesnt look like this in pz?

next vine
#

dump question but does pz faction safe as an id and can it be read?

chrome tinsel
#

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?

fading horizon
#
<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

eager mirage
#

is there a way to get which direction the player is currently going? I want to check if player is going backwards

warm vector
#

Is there any tutorial somewhere on how to make a patch for mods to like buff/nerf items?

eager mirage
warm vector
eager mirage
#

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

warm vector
#

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

eager mirage
#

then do that

warm vector
#

Yeah, thats why im asking for a tutorial if there was one that existed

eager mirage
#

you don't know how to upload a mod or what?

warm vector
#

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

eager mirage
#

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

warm vector
#

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?

eager mirage
#

I dunno honestly, I'm new to modding, but that's what I would try to do

upper junco
#

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.

crystal terrace
bronze yoke
#

reloading won't update functions added to events as the event is storing its own copy of the function

tepid dawn
#

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

crystal terrace
#

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.

bronze yoke
#

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

tepid dawn
#

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

bronze yoke
#

yeah that'd work

tepid dawn
#

Thank you, I'll try it.

patent knoll
#

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.

bronze yoke
#

it's probably expecting an item to be passed, not a type

#

try

local item = player:getInventory():getFirstType("SVAccessCards.ETBCorrupted")
player:getInventory():Remove(item)
patent knoll
#

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

bronze yoke
#

it should be fine as a local in the function

#

i'd recommend saving the inventory as a local too

patent knoll
#

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`

bronze yoke
#

it would just be inv:AddItem, not player:inv:AddItem

patent knoll
#

oh yes my bad

#

i used a find/replace and forgot to cut that bit

bronze yoke
#

then yeah, you get it

patent knoll
#

uh not totally

#

so you don't need to declare

#

it just defaults to pulling the player inventory?

bronze yoke
#

oh, right, i missed that part 😅 no it does need to be player:getInventory() when you make the local

patent knoll
#

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`

bronze yoke
#

looks good, you missed a player:inv when you declared item but yeah

bronze yoke
#

local item = player:inv:getFirstType("SVAccessCards.ETBCorrupted")

patent knoll
#

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

bronze yoke
#

no, there's no equivalent for that in lua

bronze yoke
patent knoll
#

ohhhhh

#

got it

#

thank you so much

patent knoll
royal stirrup
#

anyone have an idea on why theres texture glitching + the missing back wheels?

patent knoll
#

Is the Cat's Eye trait Nightvision in the files?

bronze yoke
#

i think it's hardcoded into the lighting engine

faint jewel
faint jewel
#

and model?

royal stirrup
tepid dawn
#

Is there a way to trigger a sound file to be played ?

faint jewel
#

then if one works they shold all work.

crystal terrace
#

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

tepid dawn
crystal terrace
tranquil bronze
#

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?

crystal terrace
tranquil bronze
#

Yes it does

crystal terrace
#

also are you trying to upload it to steam?

tranquil bronze
#

Yes I’m trying to upload it to the workshop

crystal terrace
#

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
#

Copy the mod.info from the example mod and try with that

crystal terrace
#

@neon bronze have you worked with data mod data/global mod data b/w server/client before?

patent knoll
#

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

neon bronze
crystal terrace
#

ah oki oki😄

neon bronze
#

What exactly do you want to achieve?

bronze yoke
crystal terrace
#

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.

bronze yoke
#

this is generally the intended behaviour though

final current
#

spiffo can someone eli5: stale zombies

#

spawning from lua, but they despawn

bronze yoke
#

stale zombie means desync

final current
#

self-hosted multiplayer game has desync?

#

interesting but-

bronze yoke
#

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

patent knoll
final current
bronze yoke
#

that's what i'd try

final current
#

how would that be different than spawning client-side? or is it just the same.

bronze yoke
#

probably the same

final current
bronze yoke
#

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

final current
#

gotcha. it makes sense, i just thought zombies had to be spawned client-side

bronze yoke
#

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

final current
#

ohhh. would that have appeared in coop-console.txt? bc i completely forgot to check it 💀

bronze yoke
#

i'm not sure if there'd be an error really

#

it's possible though

final current
#

moved file to server, maybe it's not enough but still getting stale zeds.

bronze yoke
#

unfortunately the server folder isn't server only drunk

final current
#

valid, so isServer()?

bronze yoke
#

i prefer not isClient() since most server code still needs to run in singleplayer

final current
#

good point.

#

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

bronze yoke
#

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

final current
#

OnWeaponSwing ummmm

#

and addZombiesInOutfit

#

maybe sending a command to the server from the client file ? idk how commands work entirely but almost.

patent knoll
bronze yoke
bronze yoke
#

traits are literally just a list of strings for the game to check against, they're not even objects with properties or anything

covert carbon
#
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

bronze yoke
#

aren't apples in Base? not food

#

i don't think there is a food module

final current
bronze yoke
#

OnClientCommand, they're named after the sender

final current
#

thank you

manic relic
#

anyone know if there is a good way bodylocation for clothes that allows multiple clothing in one spot using the same bodylocation

bronze yoke
#

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

normal scroll
#

Someone with knowledge in animations can help me fix this issue? I've already tried everything i know. What im missing?

tranquil bronze
#

@crystal terrace @neon bronze managed to get it working.. mod is uploaded to workshop now thanks for your help

warped condor
normal scroll
warped condor
#

you need to mess inside the animation file, personally I didn't touch animations yet.

faint jewel
#

you mean the weird leg thing?

normal scroll
#

Yes

mellow frigate
faint jewel
#

in your animation, make the though bone roitation NEGATIVE whatever it is.

#

should rotate it right.

dark wedge
warped condor
#

I love how you all three answer that in the same time.

normal scroll
uneven jay
#

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

faint jewel
#

you can call the vanillas yeah

warped condor
#

if something is in vanilla game (talking about textures/models) you can get them from there.

uneven jay
#

ah thanks

warped condor
#

don't need to put them inside your mods folder.

uneven jay
#

how can i test the items though?

faint jewel
#

yeah

uneven jay
#

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

honest vector
#

can I force a player to render a single chunk afar from them?

uneven jay
#

thanks

warped condor
#

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.

uneven jay
#

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?

warped condor
#

then give yourself an item from debug mode.

uneven jay
#

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

warped condor
#

You need to create new script file which will include your new item.

uneven jay
#

so wait i got media in media i got "scripts" than in scripts i have a .txt

#

that has the code

#

is that right?

warped condor
#

File dir should looks like this:
MyMod/media/scripts/myitems.txt

final current
#

@bronze yoke thanks again, got it sorted out thanks to you bpheart

warped condor
#

MyMod and myitems.txt, you can name both as you like.

uneven jay
#

is that correct

warped condor
#

Yes

uneven jay
#

do i just go to steamapps and slap it in there?

warped condor
#

Put the mod inside C:/users/%yourUser%/Zomboid/mods

uneven jay
#

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

warped condor
#

Before you upload your mod into steam workshop, you just need to put your mod inside mods folder.

uneven jay
#

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
uneven jay
uneven jay
#

@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

hoary edge
#

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?

sonic needle
#

make sure sized right. every time you move in obj mode. apply transforms.

uneven jay
#

@sonic needle could i ask a question

sonic needle
#

sure

near sail
#

Mod idea: megaphone. Makes pressing Q louder. Good for gathering large hordes for burning.

#

📣

uneven jay
# sonic needle sure

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)

sonic needle
#

from the gunpack?

uneven jay
#

nope vanilla game

#

isnt there one in vanilla?

sonic needle
#

hmm. hard to say, i certainly see them, but check the wiki?

uneven jay
#

its on the wiki

sonic needle
#

dev's do funny naming to the models

uneven jay
#

oh yeah i forgot

#

ahem ahem foraging

sonic needle
#

traits are extra cancerly named yes....

uneven jay
#

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

frosty estuary
#

How can I send a server message like chat command /servermsg "msg", but from lua script ?

warped condor
#

About things being cancer just wanted to remind about translation 😄

hoary edge
sonic needle
#

means it might be off into neverland

#

blow it up. size.

languid abyss
#

Idea: gps route on the map

hoary edge
gusty wharf
#

is Life and Living XP give functions hard coded into the game java or are they somewhere in the lua files?

bronze yoke
#

it should be in the recorded media lua

random finch
frail violet
#

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.

drifting ore
#

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

mellow frigate
bronze yoke
#

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

void cargo
#

How could I add gas to a BaseVehicle? Say I'm spawning a vehicle with addVehicleDebug

warped condor
mellow frigate
warped condor
#

Okay

#

I was just curious about that when he mentioned about java mods.

crystal terrace
#

When can I find console logs for server?

frail violet
chrome veldt
#

@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

warped condor
#

So much potential to make online leaderboards for most singleplayer zombie kills.

chrome veldt
#

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 🙂

warped condor
#

Yeah whole idea looks great, keep up on work.

chrome veldt
#

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!

crystal terrace
#

that's cool, i wonder if someone else pulled this off before in pz?

crystal terrace
warped condor
#

He also have icons for some traits stored in his website only.

rancid tendon
#

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?

covert carbon
#

Project zombieheimer is coming to a halt because I got school now 😔

crystal terrace
#

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.

bronze yoke
#

if it's transmitting every one minute then it's going to receive every one minute right?

bronze yoke
crystal terrace
#

but isnt it for the opposite side, i mean if client sends data then server side fires the event and vice versa

bronze yoke
#

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

crystal terrace
bronze yoke
#

i assumed so, just making sure

bronze yoke
#

doesn't your server transmit it back to the clients? so it's going to ping it back every minute

crystal terrace
#

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.

crystal terrace
#

is IsoObject moddata synced itself? b/w server clients

bronze yoke
#

there's a function to transmit it

#

(which should always be called after modifying it)

crystal terrace
#

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

bronze yoke
#

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

crystal terrace
#

ah got it, so whenever a client tweaks the moddata for IsoObject transmit must be used to update across every client and server.

crystal terrace
crystal terrace
#

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

bronze yoke
#

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

crystal terrace
#

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

bronze yoke
#

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)

warped condor
#

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.

bronze yoke
#

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

crystal terrace
#

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

warm vessel
#

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.

bronze yoke
#

that's just not a thing i'm afraid

warm vessel
#

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

warped condor
#

I think you would need to change
MaxRange = 1,
MinAngle = 0.65,
MinRange = 0.61,
of item value.

warm vessel
#

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?

bronze yoke
#

that affects the weapon's performance

#

(and afaik nothing else)

warm vessel
#

Say you attach a sniper scope to a pistol, you'd wanna see further but not be able to shoot further i.e.

warm vessel
bronze yoke
#

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

warm vessel
#

MaxRangeModifier = 7,
MinRangeModifier = 1,

Found this under a scope from another mod

bronze yoke
#

maybe these mods are just forcing you to zoom in if you don't have specific items?

warm vessel
bronze yoke
#

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

warm vessel
#

From looking at the wiki, Max / Min RangeModifier seems to be the correct value to change, but that also impacts the shooting range

warm vessel
bronze yoke
#

so the vanilla weapons are supposed to do this?

warm vessel
#

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

warped condor
#

Like in arsenal when you hold a x scope attachment, you can zoom out more.

#

or look around more

#

further

warm vessel
#

ya

bronze yoke
#

oh, like the distance you can pan the camera?

warm vessel
#

ya

bronze yoke
#

i'm less sure about that being impossible, i thought you were talking about zoom level, but it's unfamiliar to me

warm vessel
#

Oh, might've been unclear sorry