#mod_development

1 messages ยท Page 49 of 1

weak sierra
#

it ain't long

astral dune
#

hmmm, I haven't used sandboxvars very much, just experimented a little bit. At what point are they loaded? Is this file loaded before then?

bronze yoke
#

this file is before, but the default value should still be loaded

astral dune
#

I assume it must be or you'd get an error just calling the values. Just spitballing

weak sierra
#

yeah the table would be wrong

#

gonna go with "you need a max value" and see whre i get with that

bronze yoke
#

yeah, that's another thing that i can't say with confidence you need, but not something i've seen one without

weak sierra
#

i feel like ive seen it but shrugEyeRollGirl

bronze yoke
#

actually i feel like i might have tried it before and had problems...? not sure on that

weak sierra
#

yup literally just "u need a max value or it silently goes nil"

#

this is the kind of thing that would be nice to see a warning in the log for.

#

thanks for the assistance to everyone who did just assist, esp albion and anonymous who got me over the finish line there.

#

always some dumb little problem with me and this game lol

astral dune
#

troubleshooting is fun when it's not your own code

sour island
#

I've been trying to fix a problem I can't replicate

#

more trait's quick worker when set to high in sandbox supposedly breaks with skill recovery journal when the speed modifiers are also high

#

have yet to replicate it myself

#

the changes quick worker does to timed actions is also pretty odd

#
if delta < 0.99 - (modifier * 0.01) then
  --Don't overshoot it.
  action:setCurrentTime((action:getCurrentTime() + modifier * multiplier));
end
#

my guess would be the current time is hitting 0 and ending the action

#

the reports are that they stop writing/reading immediately

#

hmm I wonder if it's a load order issue in MP

weak sierra
#

@bronze yoke ppl are reporting tainted plumbed sinks since 41.78 dropped

#

reports are up to two so it ain't isolated

bronze yoke
#

oh, i may have forgotten to tell you that filters went out around the same time

astral dune
#

them not being tainted always seemed like an oversight...

weak sierra
#

:O

#

oh my god yes thank u

bronze yoke
#

as far as i know, this update fixes all those weirdly major bugs with rain barrels too

#

also those weird metal barrels turned out to be an unused vanilla thing, maybe a mod or map spawning them

#

i made sure they were supported too anyway

weak sierra
#

so does the water from them come out clean or tainted?

#

lol

#

since they are for some reason clean directly

#

tbh i wish they just acted normal

#

steel doesn't clean water either ๐Ÿ˜‚

bronze yoke
#

the tainted status will be whatever is in the barrel unless you have a filter

#

...maybe i forgot to extend some of the features to the metal ones...

#

even though they use mostly the same code, they're entirely separate, and they weren't really my priority... oops

ancient grail
sand harbor
#

I'm trying to edit the loot rarity of a mod so it has wayy reduced chances. Would I go into server/items and reduce the ProceduralDistributions chances, or go to scripts and lower the weight per item? neither seems to do anything when I try it.

weak sierra
#

i believe

#

to be tainted

bronze yoke
#

i'm not sure what you mean by that

#

oh i remember now, i didn't experience that problem on my end

#

i really don't see why a mod would interfere with that either though...

#

it may have been a part of the general bugginess of global objects in multiplayer that i had to sort out though, so they may work properly now

ancient grail
#

Is this a tattoo? Ow shit

#

Yep this is one way. Second method involves sqlitr

coarse nacelle
#

sqlite?

willow estuary
ancient grail
# coarse nacelle sqlite?

Ye. I hate my mobile device's keybrd
Hehe too lazy to correct my typos and grammar at times . Esp if i just woke up.
Good day yall ๐Ÿซก

coarse nacelle
#

same lol

#

I always typo on mobile

ancient grail
#

Dislaik posted the exact method
You may want to use the search button

brittle laurel
#

how do you replace a base game item with your own?

calm estuary
#

how does doorPart:getDoor() work

astral dune
#

anyone have any idea why blood intensity on a car seems to be capped at 0.04? The clamp in this code must be doing it but it doesn't make sense to me

    public void setBloodIntensity(String var1, float var2) {
        byte var3 = (byte)((int)(PZMath.clamp(var2, 0.0F, 1.0F) * 100.0F));
        if (!this.bloodIntensity.containsKey(var1) || var3 != (Byte)this.bloodIntensity.get(var1)) {
            this.bloodIntensity.put(var1, var3);
            this.doBloodOverlay();
            this.transmitBlood();
        }
    }
#
    public float getBloodIntensity(String var1) {
        return (float)((Byte)this.bloodIntensity.getOrDefault(var1, BYTE_ZERO) & 255) / 100.0F;
    }
bronze yoke
#

what makes you say that it is?

astral dune
#

this is called when you hit a zombie at speed in a vehicle

float var3 = this.getBloodIntensity("Front");
this.setBloodIntensity("Front", var3 + 0.01F);

so it should increase by 0.01 every time (although there is RNG involved in whether the damage happens at all)

#

however in testing I can run over countless zombies and it never goes over 0.0399999999

#

it must be getting capped elsewhere, cuz as you say those two functions alone aren't doing it

bronze yoke
#

yeah i'm seeing the same thing happen

astral dune
#

I thought maybe it was the byte to float conversion, but if that was the case, manually setting and getting the intensity shouldn't work either, but they seem to

bronze yoke
#

when i do this manually, i reach a different cap

#

so i'm guessing it's some weird conversion or rounding thing

astral dune
#

strange that blood intensity works at all when it seems to only hit 4%

#

setting it to 100 definitely make a bigger mess

#

hmmm maybe this is actually a bug

#

hitting a zombie with 100% blood on my hood had it revert back to 4%

#

interesting

bronze yoke
#

if i increase the increment to 0.02 it goes all the way to 1

#

i think it's probably to do with the division in getBloodIntensity()

#

they're being stored as a byte, so the precision is pretty low

#

the different cap reached when i do it through lua is probably just some conversion nonsense

astral dune
#

trying to run it through an online java compiler to see if I can recreate it

bronze yoke
#

as i thought - if you push it past this value, hitting zombies contributes to it again

#

it just gets stuck on that value because of some rounding limitation i guess

astral dune
#

ya, maybe. Can't recreate it outside of PZ, so its weird. Although I had to write my own clamp function... I'll have a look at that

#

nah, their clamp function is super basic

bronze yoke
#

i don't think the setter is likely to be at fault here

sacred burrow
#

hey guys

#

i want to make a moodle mod

#

but

#

i suck at coding and stuff like that

astral dune
# bronze yoke i don't think the setter is likely to be at fault here

its one or the other. My decompiled PZ just has bloodIntensity as a HashMap, which in modern versions of Java is invalid, afaik. My test code I had to use HashMap<String,Byte>, which makes some of those casts redundant. But of course I'm not looking at real source code so who knows what the actual implementation is

#

I'll just throw it on the bug forum and manipulate it myself for my purposes to get past this roadblock, haha

bronze yoke
#

i wonder why they chose to do it this way

#

i would've thought it'd be simpler to just use 0-100 int values than store a 0-100 int but have everything pretend it's a 0-1 float

astral dune
#

ya, casting between floating numbers, then casting to a byte for storage... just use the byte. the & 255 is expecially weird, that doesn't do anything

bronze yoke
#

yeah i don't write java so i was a little puzzled what that was meant to mean, i guessed it was literally a bitwise and which is... great lol

#

i don't know what it is so i'm just going to pretend it's not there

astral dune
#

ya, its a bitwise and. Taking a byte and doing a bitwise and with 255 does literally nothing, lmao

bronze yoke
#

i'm aware! which is why i assumed i must be wrong and decided to ignore it lol

#

there must be a reason it's written the way it is but i sure don't get it

astral dune
#

you said you were able to go over the 0.0399 cap? manually with adding 0.01 or did you actually hit zombies?

bronze yoke
#

if i manually added 0.01 it reached a different cap, i'm guessing because of lua number to java float (or vice versa) conversion

#

and if i manually added it just to push it over the cap, hitting zombies would continue increasing it

astral dune
#

hmm, are you on the unstable branch? I'm using the released build and it doesn't do that

bronze yoke
#

there isn't an unstable branch right now is there?

astral dune
#

any value over the cap reverts to the cap the first time I hit a zombie

bronze yoke
#

are you testing in singleplayer?

astral dune
#

nope

#

hosted

bronze yoke
#

that's it then isn't it

#

you're modifying it on your client, when you hit zombies the server synchronises the real value back to you

astral dune
#

hmm yes, and transmitBlood() looks like it only goes one way

bronze yoke
#

yeah you need to use a client command

#

i would generally always expect modifying things on the client not to work

shadow vault
#

Anyone got a modlist of their own they're willing to share?

astral dune
#

most vehicle stuff is client only, damage seems to be the exception

astral dune
#

yep, checking if the blood value is 0.04 and bumping it up on the server fixes the issue. Definitely a bug

#

gets stuck at 0.2599999 lol

ancient grail
ancient grail
bronze yoke
#

i wouldn't recommend using item tweaker, it's not really much simpler than using doparam and it spams prints, causing a lot of startup lag

willow estuary
#

Nobody needs to use ItemTweaker, DoParam works, is simpler, and isn't subject to multiple modID issues.

Back when I was a modder, it took all of 5 minutes after MP dropped for Soul Filcher and I to realize that using Item Tweaker as a dependency wasn't viable, and we modified both of our bodies of work accordingly.

#

Just use DoParam, please stressed

item tweaker used to be a good thing, but people uploaded their modified versions with the same modID and now it's just a white hole of bug reports on account of that. (FYI using requires/dependencies for mods is absolutely a gongshow and isn't practically sustainable on account of the re-upload issue, among other issues, IMO)

local scriptItem = ScriptManager.instance:getItem("Base.EngineerMagazine2")    
if scriptItem then 
    scriptItem:DoParam("TeachedRecipes  =   Make Smoke Bomb;Make Improvised Gas Mask")
end
local item = ScriptManager.instance:getItem("Base.Vest_BulletArmy")    
if item then 
    item:DoParam("Weight    =    8")
end
local item = ScriptManager.instance:getItem("Base.Vest_BulletCivilian")    
if item then 
    item:DoParam("Weight    =    8")
end
local item = ScriptManager.instance:getItem("Base.Vest_BulletPolice")    
if item then 
    item:DoParam("Weight    =    8")
end
local item = ScriptManager.instance:getItem("Base.Hat_Army")    
if item then 
    item:DoParam("BulletDefense = 100")
end
local item = ScriptManager.instance:getItem("Base.Hat_GasMask")    
if item then 
    item:DoParam("BiteDefense = 25")
    item:DoParam("ScratchDefense = 30")
end
local item = ScriptManager.instance:getItem("Base.AssaultRifle")    
if item then 
    item:DoParam("MinDamage    =    0.8")
    item:DoParam("MaxDamage    =    1.4")
end```
astral dune
oak dagger
#

When I play with a good amount of mods for like 2 or so hours (irl hours) I start to lag pretty badly. Is there any way to fix this? Can I allocate more ram from steam to pz to make it run better?

brittle laurel
bronze yoke
#

it's basically a way to edit an item's script at runtime, it applies the script line you put into it

#

it's most useful for editing items from vanilla/other mods, as you don't need to overwrite items or files entirely, which will inevitably lead to incompatibility

willow estuary
#

It does everything that ItemTweaker does, but in a more straighforward fashion that isn't vulnerable to the fact that there are 13 listed unauthorized re-uploads of ItemTweaker, not including the private/hidden workshop items.

I hate to piss on anyone's subs, but the re-uploaders ruined ItemTweaker's utility.

#

Also, please do not re-upload your mod pack or modified version of existing mods with the same modID as existing mod because that causes no end of bug report/tech support/lua mismatch headaches.

And also is a jerk move. Just, please, change the modID. PLEASE.

brittle laurel
#

thank you

vast pilot
#

Are there any techniques for 3d modelling clothes that would make them look more in-line with the vanilla clothes?

winter bolt
#

its a complete nightmare otherwise, since you have to match the uvs up to the base model

vast pilot
#

Ah, I didn't know that

#

I'm currently working on this, it's sort of a shoulder cape type thing

#

I've done some 3d modelling in the past, but never clothing

brittle laurel
fast galleon
weak sierra
#

depends on what it is.

#

if your mod adds a context menu option it doesn't matter at all

#

if it adds items it does

#

etc

astral dune
#

also depends on whether the mod you have replaced is a dependency for other mods

vast pilot
bronze yoke
willow estuary
brittle laurel
#

thank you

astral dune
bronze yoke
fast galleon
#

not changing modid keeps the require working too

#

win win

#

@willow estuary require doesn't order mods on server like it does with SP? They need to be set up manually in right order.

willow estuary
weak sierra
#

requires also fail fuckin constantly

willow estuary
#

The fact of the matter is that there are enough 12 year olds setting up PZ servers, that requires/dependencies, or anything that involves reading instructions, is unsustainable IMO.

#

No shade at kids, they're literally the future and are smarter than us old timers if anything, just trying to illustrate a broad issue facing the modding community?

weak sierra
#

lol

bronze yoke
#

one of my mods has to be written to be compatible with both profession framework and a deprecated version of it that's missing several features and has no new features of its own, it's a total joke

#

that one does have its own mod id, but it overwrites every file and would use the same globals anyway...

willow estuary
#

"I literally can not use this mod because there's two different versions of it with the same modID on the workshop"

quasi geode
#

i'd have that 2nd profession framework pulled if there werent so many mods requiring it ๐Ÿ˜

willow estuary
weak sierra
#

i have for the longest time gone "lockpicking looks cool.. why the fuck do i need a framework for professions to use it?"

#

and refused to

bronze yoke
#

and the name is so misleading, i think a lot of people assume it's the newer/better version

ancient grail
#

I havent encountered any problems like this but when i do ill go back to this conversation by searching hydra's head
Lol

quasi geode
astral dune
#

that lockpicking mod is real nice. BetterLockpicking right? I like the minigame

bronze yoke
#

i've definitely become a lot more dependency negative in recent months, but... profession framework can stay, for now at least

#

it's just such a huge convenience

#

luckily, only one of my mods is actually affected by that conflict, and it was simple to resolve

vast pilot
#

should I keep this as a plane, or give it some thickness?

#

I don't know how zomboid handles planes

#

I know of some mods that add capes and stuff and it seems like they just use planes

willow estuary
#

But in doing so you are potentially creating bug reports for the original mod author, and I wouldn't wish that on my worst enemy?

fast galleon
#

I am my own worst enemy then?

astral dune
#

aren't we all

sour island
fast galleon
sour island
#

There's a pz community mod that does this but schedules/interest was hard to maintain

#

I can try to help in like 6 hours

#

But I just googled "GitHub Action steam workshop upload"

#

And modified those commands

#

Again, it requires 2FA to be disabled on the steam acc - so not recommended

#

For the pz community thing we made a dummy acc

#

Also, not an issue for you - but there isn't a way to create new listings via GitHub that I'm aware of so it does still require human touch to set up the initial workshop page - for anyone else curious

#

I wasn't aware one could reuse modIDs - I assumed it had to match the appID from steam

silk hollow
#

Does anyone know if it's possible to extend the discord support from the base game, to allow PZ to support threads?
Right now it seems to only support channels, I assumed it would just work as the urls are the same:

Channel URL: https://discord.com/channels/136501320340209664/986948930740813864
Thread URL: https://discord.com/channels/136501320340209664/1040494980675936256

But apparently it's not. I've made sure to create a bot with access to threads but the server log simply shows
LOG : Network , 1668157324622> 459,395,478> DISCORD: channel with ID "[omitted]" not found

([omitted] added by myself in place of the ID ๐Ÿ˜› )

coarse nacelle
silk hollow
#

The bot is not the problem. It's a new one with simply access to the right features. The problem is how PZ try and interact with it. With threads being kinda "new" in terms of GA feature, it was expected that it wouldn't work but I cannot find anything online in terms of "is this a moddable part of PZ?". I feel like "no" is the answer but it would be good to have someone from Indie Stone confirm it and, if that's the case, consider allowing it maybe? That would lift an "optional" feature out of their shoulders.

coarse nacelle
#

yeah, that's what I mean

silk hollow
#

oh alright sorry, i misunderstood then

coarse nacelle
#

discord bot libraries that PZ would consume don't support newer features

#

most bot library devs just quit developing a couple of years ago

#

and any features since then have minimal support

#

what's the load order for lua files?

#

can my lua files load before base game files if they're named wrong?

#

yeah, it looks like load order is alphabetical which can cause my mod's files to load before vanilla's files

#

is this intentional?

coarse nacelle
#

ah nvm, there's a mod that's not mine that's broken!

ancient grail
#

quick question on the EatType am i limited to the exsiting EatType animations? or can i just use any other animations like for example BuildLow

viral vale
#

Decided to expand upon my mod a bit more and experiment with the idea of making it more creative and abstract in terms of the page for the mod, intentional keeping thing vague and intriguing Decided to experiment with audio-based storytelling based on my mod for Project Zomboid called "Lingering Whispers...", here is my result, would love to know what people think https://youtu.be/LVidUx5lf3I Made a teaser trailer of sorts, let me know what you guys think of it haha

sour island
#

Might give you some inspiration

#

Some of the lines were innocuous and it made it more creepy

#

Wish I could recall the name

ancient grail
#

Is there a lua way to be able to overwrite a tiles property permanently?

sour island
#

Like it's isoflags?

ancient grail
ancient grail
#

But pretty much yeah

sour island
#

That's isoFlags pretty sure

ancient grail
#

Ok ๐Ÿ™‚

sour island
#

Each sprite has their own

#

What are you trying to change

ancient grail
#

So how can i modify it like as the game load all tiles ingame that already exsist changes

sour island
#

I did something for a guy a while back

ancient grail
#

I want to help sir daddy dirk

sour island
#

You can use the load square event

ancient grail
#

He wants to modify one particular sprite not yet sure what

sour island
#

Just don't put a print on the functiob

#

Is it the twig sprites not being able to be picked up?

ancient grail
#

He said the cardboard box

#

Make it so that cars can passthru

sour island
#
--ObjectTypes
-- "normal", "jukebox", "wall", "stairsTW", "stairsTN", "stairsMW", "stairsMN", "stairsBW", "stairsBN", "UNUSED9", "UNUSED10",
-- "doorW", "doorN", "lightswitch", "radio", "curtainN", "curtainS", "curtainW", "curtainE", "doorFrW", "doorFrN", "tree",
-- "windowFN", "windowFW", "UNUSED24", "WestRoofB", "WestRoofM", "WestRoofT", "isMoveAbleObject",

--FlagTypes
--  "collideW", "collideN", "solidfloor", "noStart", "windowW", "windowN", "hidewalls", "exterior", "NoWallLighting",
-- "doorW", "doorN", "transparentW", "transparentN", "WallOverlay", "FloorOverlay", "vegitation", "burning", "burntOut",
-- "unflamable", "cutW", "cutN", "tableN", "tableNW", "tableW", "tableSW", "tableS", "tableSE", "tableE", "tableNE",
--  "halfheight", "HasRainSplashes", "HasRaindrop", "solid", "trans", "pushable", "solidtrans", "invisible", "floorS",
-- "floorE", "shelfS", "shelfE", "alwaysDraw", "ontable", "transparentFloor", "climbSheetW", "climbSheetN", "climbSheetTopN",
-- "climbSheetTopW", "attachtostairs", "sheetCurtains", "waterPiped", "HoppableN", "HoppableW", "bed", "blueprint",
-- "canPathW", "canPathN", "blocksight", "climbSheetE", "climbSheetS", "climbSheetTopE", "climbSheetTopS", "makeWindowInvincible",
-- "water", "canBeCut", "canBeRemoved", "taintedWater", "smoke", "attachedN", "attachedS", "attachedE", "attachedW",
-- "attachedFloor", "attachedSurface", "attachedCeiling", "attachedNW", "ForceAmbient", "WallSE", "WindowN", "WindowW",
-- "FloorHeightOneThird", "FloorHeightTwoThirds", "CantClimb", "diamondFloor", "attachedSE", "TallHoppableW", "WallWTrans",
-- "TallHoppableN", "WallNTrans", "container", "DoorWallW", "DoorWallN", "WallW", "WallN", "WallNW", "SpearOnlyAttackThrough", "forceRender"
#
local specialOverrideExceptions = {"IsoCurtain","IsoDoor","IsoWindow","IsoBarricade","IsoLightSwitch"}
---Vanilla has a getFloor but it causes layering issues if there's objects over the floor - like walls
---@param isoGridSquare IsoGridSquare
local function ifFlagTypeGetObject(isoGridSquare, isoFlagType)
    local isoObjects = isoGridSquare:getObjects()

    local objWithFlagFound
    local lastSpriteObject

    if isoFlagType == IsoFlagType.solidfloor and isoGridSquare:getProperties():Is("BlocksPlacement") then return end

    for i=0, isoObjects:size()-1 do
        ---@type IsoObject
        local isoObj = isoObjects:get(i)
        if isoObj then
            local isoObjSprite = isoObj:getSprite()
            local isoObjSpriteName = isoObjSprite:getName()
            if isoObjSprite and isoObjSpriteName then
                if isoObj:getType()==IsoObjectType.wall and string.find(isoObjSpriteName, "roofs") then
                else
                    if isoObjSprite:getProperties():Is(isoFlagType) then
                        objWithFlagFound = true
                        lastSpriteObject = i
                    end

                    if objWithFlagFound then
                        if (not isoGridSquare:getProperties():Is("IsMoveAble")) then
                            lastSpriteObject = i
                        end
                        for _,type in pairs(specialOverrideExceptions) do
                            if instanceof(isoObj, type) then
                                lastSpriteObject = i
                            end
                        end
                    end
                end
            end
        end
    end
    if objWithFlagFound and lastSpriteObject then
        return isoObjects:get(lastSpriteObject)
    end
end
#

This function scans through objects on a tile and looks for flag types

#

there is a setproperties function

#

you'll have to cannibalize this to make it do what you want

#

I included the flag types I have as a comment to assist

#

I could have sworn I had a thing that set flag types though

#

let me check again

#

lmk if it helps or doesn't, I'll try to strip off the extra bits

#

This was also done specifically for grass/vines/etc

#

So if you already have a way to reference the box you can probably skip a few steps

#

Also, wait

#

you wanted cars to pass through - like mailboxes?

#

as in break them?

ancient grail
#

but thanks alot man

sour island
#

this is old stuff

ancient grail
#

ow ok but still thanks alot

sour island
#

no problemo

#

I never got to use it much

ancient grail
#

i just need top modify it and with your permission

sour island
#

ofcourse

#

but this may not do what you need without modifying it

#

I also seethere's a isoproperty called 'hitbycar' but I dont see where it leaves behind something else

#

"HitByCar"

#

here we go

ancient grail
#

yep yep i got that ๐Ÿ™‚ i will first need to check isoflag cuz i think poltergeist mentioned it was temporary

sour island
#
   public void HitByVehicle(BaseVehicle var1, float var2) {
      short var3 = this.Damage;
      this.Damage = (short)((int)((double)this.Damage - (double)var2 * 0.1D));
      BaseSoundEmitter var4 = IsoWorld.instance.getFreeEmitter((float)this.square.x + 0.5F, (float)this.square.y + 0.5F, (float)this.square.z);
      long var5 = var4.playSound("VehicleHitObject");
      var4.setParameterValue(var5, FMODManager.instance.getParameterDescription("VehicleSpeed"), var1.getCurrentSpeedKmHour());
      WorldSoundManager.instance.addSound((Object)null, this.square.getX(), this.square.getY(), this.square.getZ(), 20, 20, true, 4.0F, 15.0F);
      if (this.getProperties().Is("HitByCar") && this.getSprite().getProperties().Val("DamagedSprite") != null && !this.getSprite().getProperties().Val("DamagedSprite").equals("") && this.Damage <= 90 && var3 > 90) {
         this.setSprite(IsoSpriteManager.instance.getSprite(this.getSprite().getProperties().Val("DamagedSprite")));
         if (this.getSprite().getProperties().Is("StopCar")) {
            this.getSprite().setType(IsoObjectType.isMoveAbleObject);
         } else {
            this.getSprite().setType(IsoObjectType.MAX);
         }

         if (this instanceof IsoThumpable) {
            ((IsoThumpable)this).setBlockAllTheSquare(false);
         }

         if (GameServer.bServer) {
            this.transmitUpdatedSpriteToClients();
         }

         this.getSquare().RecalcProperties();
         this.Damage = 50;
      }

      if (this.Damage <= 40 && this.getProperties().Is("HitByCar") && !BrokenFences.getInstance().isBreakableObject(this)) {
         this.getSquare().transmitRemoveItemFromSquare(this);
      }

   }
#

So my above code isn't needed

#

you guys should be able to apply a damagedsprite property to the boxes

#

and add the hitbycar property too

#

shame there isn't a lua event

#

would be a bit more manageable

ancient grail
#

i kinda dont get.. i know your saying to apply the this.getSprite().getProperties().Is("StopCar")

#

but how do i apply it to all the sprites permanently

#

cuz if i dont figure this out then ill have to use an ontick event

#

that checks tiles around the player

sour island
#

you don't want to use stopcar

#

HitByCar = true

#

DamagedSprite = "spritename"

ancient grail
sour island
#

Question, if the sprite info is changed in the map editor would that apply retroactively?

sour island
#

it's strictly for layering

#

but it parses through a tiles' objects based on isoproperties and sprites

#

Also worth noting idk if flag changes get saved

#

chances are for the sake of savegame bloat it relies on the sprite

#

which is why I asked if it were possible to change the vanilla sprite's properties instead

#

@ancient grail ```lua
---@param isoGridSquare IsoGridSquare
local function alterObject(isoGridSquare, spriteName)
local isoObjects = isoGridSquare:getObjects()

for i=0, isoObjects:size()-1 do
    ---@type IsoObject
    local isoObj = isoObjects:get(i)
    if isoObj then
        if not isoObj:getModData()["checkForAlterObject"] then
            isoObj:getModData()["checkForAlterObject"] = true

            local isoObjSprite = isoObj:getSprite()
            local isoObjSpriteName = isoObjSprite:getName()
            if isoObjSprite and isoObjSpriteName then
                if isoObjSpriteName==spriteName then

                    isoObjSprite:getProperties():Set("HitByCar")
                    isoObjSprite:getProperties():Set("DamagedSprite", "damaged_box_sprite", false)

                end
            end
        end
    end
end

end

#

Not tested

#

also not sure if the changes are permanent either

#

you would need a damaged box sprite for this to work btw

#

you can also stick anything in as well'

ancient grail
#

ow thnx alot sir!
ill test it soon

#

ill just send it to daddy dirk and tell him its from you ๐Ÿ™‚

#

alterObject(isoGridSquare, "trashcontainers_01_24")
alterObject(isoGridSquare, "trashcontainers_01_25")
alterObject(isoGridSquare, "trashcontainers_01_26")
alterObject(isoGridSquare, "trashcontainers_01_27")

#

heres how to use it irght?

#

try getting the spritename to know

sour island
#

no

#

sort of

#

this is designed to be called in loadsquare

ancient grail
#

so i make an event?

#

function doAlterTrashbox()
alterObject(isoGridSquare, "trashcontainers_01_24")
alterObject(isoGridSquare, "trashcontainers_01_25")
alterObject(isoGridSquare, "trashcontainers_01_26")
alterObject(isoGridSquare, "trashcontainers_01_27")
end

Events.LoadGridsquare.Add(doAlterTrashbox);

sour island
#

quick question

ancient grail
#

yeah

sour island
#

is this only for adding more crushable objects?

ancient grail
#

no this is just so that the car can passthru

sour island
#

or would he want to be able to do this for other changes?

ancient grail
#

or atleast to be able to permanently alter a sprite

#

to do anything

sour island
#

this would destroy the object

#

and replace it with a damaged version

#

like mailboxes, fences, traffic things that aren't cones

#

google says they're traffic barrels

ancient grail
#

ahh ok then

sour island
#

I dont think there's a way to make something only passable by car

ancient grail
#

but your function seems to be missing a param

sour island
#

?

ancient grail
#

the sprite for the destroyed

#

stuff

#

right?

sour island
#

yeah

#

ill change it

ancient grail
#

like what it will look like?

#

i think i know how tho

#
---@param isoGridSquare IsoGridSquare
local function alterObject(isoGridSquare, spriteName, damaged_box_sprite)
    local isoObjects = isoGridSquare:getObjects()
    
    for i=0, isoObjects:size()-1 do
        ---@type IsoObject
        local isoObj = isoObjects:get(i)
        if isoObj then
            if not isoObj:getModData()["checkForAlterObject"] then
                isoObj:getModData()["checkForAlterObject"] = true

                local isoObjSprite = isoObj:getSprite()
                local isoObjSpriteName = isoObjSprite:getName()
                if isoObjSprite and isoObjSpriteName then
                    if isoObjSpriteName==spriteName then

                        isoObjSprite:getProperties():Set("HitByCar")
                        isoObjSprite:getProperties():Set("DamagedSprite", "damaged_box_sprite", false)

                    end
                end
            end
        end
    end
end



function doAlterTrashbox()
local damaged_box_sprite="ddd_dmgsprites_01_1"
alterObject(isoGridSquare, "trashcontainers_01_24", damaged_box_sprite)
alterObject(isoGridSquare, "trashcontainers_01_25", damaged_box_sprite)
alterObject(isoGridSquare, "trashcontainers_01_26", damaged_box_sprite)
alterObject(isoGridSquare, "trashcontainers_01_27", damaged_box_sprite) 
end



    
Events.LoadGridsquare.Add(doAlterTrashbox);

#

@viral compass sir heres the thing you need .. credit goes 100% to chuck ๐Ÿ™‚

#

ow this is still missing the dmg sprite

#

since theres no such thing

#

i left it blank

sour island
#
local setHitByCar = {}
setHitByCar.applyTo = { ["trashcontainers_01_24"]="ddd_dmgsprites_01_1",
                        ["trashcontainers_01_25"]="ddd_dmgsprites_01_1",
                        ["trashcontainers_01_26"]="ddd_dmgsprites_01_1",
                        ["trashcontainers_01_27"]="ddd_dmgsprites_01_1", }

---@param isoGridSquare IsoGridSquare
function setHitByCar.apply(isoGridSquare)
    local isoObjects = isoGridSquare:getObjects()

    for i=0, isoObjects:size()-1 do
        ---@type IsoObject
        local isoObj = isoObjects:get(i)
        if isoObj then
            if not isoObj:getModData()["checkForSetHitByCar"] then
                isoObj:getModData()["checkForSetHitByCar"] = true

                local isoObjSprite = isoObj:getSprite()
                local isoObjSpriteName = isoObjSprite:getName()
                if isoObjSprite and isoObjSpriteName then
                    local damagedSprite = setHitByCar.applyTo[isoObjSpriteName]
                    if damagedSprite then
                        isoObjSprite:getProperties():Set("HitByCar")
                        isoObjSprite:getProperties():Set("DamagedSprite", damagedSprite, false)
                    end
                end
            end
        end
    end
end
Events.LoadGridsquare.Add(setHitByCar.apply)
#

This will let you set the sprites and damaged in the list

#

if this works - testing other stuff atm

sour island
#

Your snippet wouldnt work atm

#

added the sprites you mentioned to mine

#

using the list should avoid calling the scan multiple times per square

#

also, just an fyi setting local inside the function would make it inaccessible inside of another function

#
  • the variable is a string in the other function
#

So changing tile properties in the map maker should be a better approach for custom tiles

#

Im not sure if changing the tiles for vanilla would work when loading an old save but it should also apply to a new one

silk hollow
#

Quick question: Lua is not a language I develop with, I need to pass parameters to a variable hooked into an Event.

Something like:

local function something(yada)
  -- stuff here
end

Event.Every10Minutes.Add(something('something_here'))

However, I understood that that format is not working / not correct
Is there a way to do that? maybe something like Event.Every10Minutes.Add(function[, params])?

viral sierra
#

Does anyone know if there is a chance to completely remove Brita's weapons loot from zombies? Very important unhappy

sour island
#

Event.Every10Minutes.Add(something)

#

Where something is the function

#

What format/order yada takes depends on the java side of the hook

#

Some hooks don't have any arguments

#

In other words - when you use Events.thing.Add(funtionName), anytime the hook is called on in java, it supplies the arguments that passes onto your function.

#

Also it's EveryTenMinutes

#

Only used once in GameTime.java with no arguments - ```java
LuaEventManager.triggerEvent("EveryTenMinutes");

fast galleon
lyric bolt
silk hollow
#

Can someone tells me why am I stoopid and cannot see the file content loaded inside the debugger?

#

also, how can I print out something in the command console from my mod? Can't seem to find a documentation for that ๐Ÿ˜ฉ

bronze yoke
#

print(variable)

oak dagger
#

Anyone know how to get a lot of mods and not start getting laggy after a couple hours of playing?

#

Do I need to put more ram into the game?

undone elbow
#

@lyric bolt There is Simple Vehicle Recycling that uses vanilla action.

deft olive
#

what is the difference between writing the code in "lua folder" vs "script folder"

ruby urchin
deft olive
#

mm so a code to modify the damage in a weapon should be in "scripts" and a code to spawn a weapon on-key-press on "lua" ?

#

@ruby urchin or could you give me an example ?

ruby urchin
#

No need create code to spawn the weapon, you can spawn via debug mode

deft olive
#

ty

silk hollow
ruby urchin
silk hollow
#

dang it, go figure now what it is ๐Ÿ˜„

ancient grail
ancient grail
# deft olive <@390594866511609856> or could you give me an example ?
local shotgun = InventoryItemFactory.CreateItem("Base.DoubleBarrelShotgun");
shotgun:setTooltip("initially has 6 chambered  shells");
shotgun:setClipSize(6);
shotgun:setCurrentAmmoCount(60);
shotgun:setRoundChambered(true);
shotgun:setAimingTime(90);
shotgun:setMinDamage(5)
shotgun:setMaxDamage(12);
shotgun:setName("SOS ToxSicK Event Shotgun"); 
getPlayer():getInventory():AddItem(shotgun);
#

do this using lua console

ancient grail
#

Is it possible to replace an items sprite with tile sprite and vice versa
Using debug

Just curious

#

Altho i think its possible to change item sprite using any png

silk hollow
#

For a mod that need to alter the zombies behaviour I'm creating the "init" file on the lua/server directory. As I want it to work also for single player, should I create an initialization script in the lua/client as well and maybe move the common parts into lua/shared?
Specifically, the kickstart of the mod is bound to Events.OnServerStarted but I think that if you play single player that event doesn't trigger (unless you host locally of course). Is there an Event that is better for when it's meant to detect a single player session starting?

bronze yoke
#

files in the server folder are loaded on the client, so you don't need to worry about singleplayer

silk hollow
#

Generally speaking, a good diagram of the lifecycle of the Events would be greatly appreciated. The wiki have only some of them and the order with which they are invoked (or even in which use case) is not indicated

bronze yoke
#

OnGameStart is usually used for stuff like this, but i'm not sure when you need it exactly

silk hollow
#

perfect OnGameStart it is then

#

Just as soon as the game has loaded everything, ideally either just before or after the player click to "enter"

bronze yoke
#

that fires after the click, i think

silk hollow
#

it will need to change zombies behaviour so it needs them to be loaded in the cell at least ๐Ÿ™‚

#

it's more than enough then ๐Ÿ™‚

#

thanks โค๏ธ

ancient grail
#

alot of them

#

to check how they tiggered it

sour island
#

There's an OnZombieUpdate event

#

that's what I used

#

although getting reliable AI to work is a bit of a mess

ancient grail
sour island
#

yeah, but it's not something I'd recommend for a first outing into PZ modding

ancient grail
#

just curious.. this is not important...
i noticed
ProfessionFactory.addProfession("mechanics", getText("UI_prof_Mechanics"), "profession_mechanic", -4);
doesnt have a removeProfession() counterpart

bronze yoke
#

a lot of things can't be undone once they're put into the profession factory

#

wouldn't be surprised if removing a profession isn't possible

ancient grail
#

yeah i guess your right

bronze yoke
#

you'd have to get the ui to hide it or something

ancient grail
#

RBBasic:getSurvivorProfession():get(i)

#

ithink udderlyevelyn may have done this as i recall she mentioned that she replaced every

#

oooo its trait

#

not profession so nevermind

sour island
#

Pretty sure you can probably use an inherited remove(

#

Also probably better off hiding it in the UI

ancient grail
#

you guys think the vision is handled on the java side? i wanted to make a mod that allows dbg and admin see everything
behindwalls and behind you

#

or maybe make like a camera offset to character mod

#

like the plaeyr isnt moving but the camera is

#

would be a better observer mode i think

#

cant seem to find it anywhere excpt isbaseicon

#

but thats related to foraging

neon bronze
#

So far i looked there is a calculatevisioncone but its not accesible through lua or atleast no luamethod to get it

ancient grail
#

Thanks
I knew it but I really had to ask

I was thinking of the fact that when you player turns onto zed the camera still follows it around despite it being a zed
And thats a diffrent iso i think

#

Also i noticed
When someone kills ur zed and pickup your corpse
The cam will now follow the player

#

And the vision cone is then transfered
To the zed then to the player

#

If im not mistaken

silk hollow
# sour island yeah, but it's not something I'd recommend for a first outing into PZ modding

Do you mind sharing which mod have you made? I'm trying to make a mix-up between Random Zombies and Night Sprinters. basically, having the logic of Random Zombies but with two alternating schedules. One for night and one for the day. The alternating schedule is there. To apply the distribution I'm getting the zombie in a cell that is activated by a player presence and applying it one-by-one but the actual logic of the distribution is kinda overly complicated in my opinion (for Random Zombies) but I can't be sure because Lua is not really my bread and butter (I'm a software engineer but never really worked with Lua, more like js/node/typescript). On top of that, I need to find the better (aka less heavy) way to update the zombies because Random Zombies uses OnTick which is definitely CPU intensive, especially with big hordes.

silk hollow
#

ah man, I love that mod. Big props to you ๐Ÿ™‚

sour island
#

You probably dont have to worry about the actual tricky bits with outfits and items

sour island
silk hollow
#

I'll check out the logic for the zombies yeah ๐Ÿ™‚

sour island
#

Random Zombies as in some shamble, some walk, some sprint?

#

But then at night they all sprint?

silk hollow
#

yes

#

well

#

random zombies have some shambles, crawl, sprint, etc

#

night sprinters everyone simply sprint at night

sour island
#

does the randomness have to be consistent from play throughs?

silk hollow
#

I wanted to make it as:
day: choose your distribution
night: choose your other distribution (can be the same)

sour island
#

like does it matter if from day to day the same zombie could be doing different things?

#

ah

silk hollow
#

I'd say that a zombie should stay "crawler" as long as it's in your view and at least a bit after that or it would be really anger inducing if you turn around and that crawler start to sprint ๐Ÿ˜„ (altough, also cool)

sour island
#

The issue I've seen with zombies, and others have had similar problems, is that when they're saved/loaded alot of data is not kept - including modData

#

Also altering the zombie doesn't change for the most part

#

If you look in SWH, I had to assign an embedded weapon to act as the AI token, and also assign which outfits get 100% to embed the token

silk hollow
#

I need to double check how Random Zombies does it because, sprinters usually just die as they reach you quite fast. The rest, you either tend to kill them or you loose them. And if you cut them loose, you don't really care if you meet them again after a couple of in game hours and now they are shambler for example

silk hollow
sour island
#

My solution wouldn't really work for random speed zombies

#

Also, speed might be one of the variables that saves

#

so the worry from me might be moot

silk hollow
#

It's fine, right now I'm in a phase in which I just need to see some mods doing some "serious" coding so I can understand how to properly work with Lua in PZ

sour island
#

Lua is very simple, I'm sure you'll catch on fast

#

For practicing syntax and logic stuff

silk hollow
#

alright, I'll take a break and look into it a little more tomorrow, thanks for the chat and suggestion/hints/etc ๐Ÿ™‚

sour island
#

np

deft olive
#

hey is there an easy way to "rework" one weapon to create a modd? (I don't want to go to the actual game scripts folder an tweak the stats, but I don't know wich every single thing should I copy and paste on another folder to create "the modd" that modifies that weapon)

ancient grail
#

But if you want a more permanent solution
Check out sir blairs post earlier about overwritting

astral dune
#

oh bummer, kahlua probably doesn't have the __len metamethod. dangit

ancient grail
ancient grail
bronze yoke
#

instead of overwriting the script, you should write a lua script like this:

local item = getScriptManager():getItem('Base.ItemName')
if item then
  item:DoParam('MinDamage = 0.2')
  item:DoParam('MaxDamage = 0.7')
  -- etc
end
#

DoParam is just like adding a line to that item's script, but won't cause compatibility issues

ancient grail
deft olive
#

@ancient grail srr i do it, but not sure how i would go doing all the changes that i want on that way.
1.- needs to get the %weight on my character, and the lowest it is then dmg of the weapon "heavy weapons" should increase
2.-needs to get the %stamina on my character, and the lowest it is then the critical chance, attkspeed of the "heavy weapons" should decrease
3.-character cannot use it if he is "really" hungry

#

so it*

ancient grail
#

I think it should have a require line or something

bronze yoke
#

oh that's a lot more complicated... are you familiar with lua/programming?

ancient grail
#

Sounds like lua

#

Esp the hunger part

bronze yoke
deft olive
#

not lua but i'm familiar with c++

ancient grail
#

Ah forgive me. It was hi117

#

Lol too sleepy iguess. Going to bed now for reals. Have a good one guys

deft olive
#

Have a good one

coarse nacelle
#

Hey, does Distributions only examine Distributions[1] or does it examine all elements in the table?

#

like if someone does this, does it just break loot in PZ? table.insert(Distributions, 1, distributionTable);

#

-- the games distribition table should always be the first in table. yeah this seems like it might break stuff

fast galleon
coarse nacelle
#

not necessarily, best practice would be to append to the table not jam yourself into the #1 slot

fast galleon
#

is that the only part that messes the distributions?

coarse nacelle
#

uhh I don't understand the question

#

I'm working on an incompatibility with my mod patching the distribution table and brita's

#

brita's uses table.insert which causes the table to just not be there anymore basically

fast galleon
#

ah

#

try using SuburbsDistributions instead of Distributions[1]?

coarse nacelle
#

nah, its brita's being bugged, issue resolved tyvm

fast galleon
#

I mean as long as I've been playing that mod has always been bugged.

coarse nacelle
#

(and my mod tbf, I could probably also append to the end but they should too. we're both wrong lol)

fast galleon
#

are you looking for inventoryfemale?

coarse nacelle
#

yep

#

among other stuff, there's a few things that break

#

the entire table gets messed up until mergeDistributions is called

fast galleon
#

local target = {"inventorymale","inventoryfemale"}
for _,v in ipairs(target) do
for _,i in ipairs(items) do
table.insert(SuburbsDistributions["all"][v]["items"],i)
end
end

#

this is in my old files

winter thunder
#

Hey- Anyone know of any tool / framework to make recipes faster than typing them all out every single time?

coarse nacelle
#

including adding your own

fast galleon
#

SuburbsDistributions is the table I use because people bump Distributions[1]

#

it's the same table

coarse nacelle
#

the better way would be to append to the table btw

#

since zomboid merges the tables after load anyway

fast galleon
#

sure, but there some things that didn't work like that so better do it yourself

coarse nacelle
#

?

fast galleon
#

don't remember now

coarse nacelle
#

it seems like MergeDistributionRecursive would handle all use cases

#

including partial patching

tame veldt
#

does anyone know how to get this type of sandbox option? (That hides other options)

coarse nacelle
tardy wren
#

Boolean?

tame veldt
#

yes, but it's a checkmark that disables other options

fast galleon
coarse nacelle
#

?

#

just look at SuburbsDistributions.lua's mergeDistributions and MergeDistributionRecursive functions

fast galleon
#

I don't see ProceduralDistributions in that file

coarse nacelle
#

well, MergeDistributionRecursive can be called by your code and should work with any table

bronze yoke
#

i don't think you can do that

#

i'd have a look at the ui lua, that page is probably somewhat hardcoded

tame veldt
#

I already looked, couldn't find anything related to it. Fairly certain it's a recently added thing, as I don't remember seeing it before.

bronze yoke
#

no that's been there since at least b40

tame veldt
#

then I'm just blind ๐Ÿ˜„

#

Guess I gotta take a peek at the java code then

coarse nacelle
#

no idea, im figuring this out myself for some stuff ngl

winter thunder
#

lmfao fair enough. I wish that ItemZed was working, because that would be so incredibly helpful

coarse nacelle
#

tbh eventually im planning on ditching scripts entirely and using lua to define everything

winter thunder
#

Trying to work on a bunch of recipes for a big server I am a part of, goal is to 'Craft everything' so I really dont want to have to do all of that by hand lmao

winter thunder
coarse nacelle
#

there's just better support for automatic formatting, I can do loops, etc

bronze yoke
#

i've been tempted to do that myself, i always end up doing weird conditional stuff no matter what so i might as well just make lua the entire process

coarse nacelle
#

its also less confusing since you don't need to deal with the import system

deft olive
#

hey, can i make weapos hit faster? or animations dosen't allow it to happend?

alpine scroll
#

Did something change on the require for 41.78?

#

I am having this error

#
-----------------------------------------
function: ExpandedHelicopter01c_MainCore.lua -- file: ExpandedHelicopter01c_MainCore.lua line # 10 | MOD: Expanded Helicopter Events
Callframe at: require
function: cmd_helicoptero.lua -- file: cmd_helicoptero.lua line # 4 | MOD: ExtrasDescoladosCMDHELI.```
#

But I changed nothing on my code yet

#

To be fair, I am requiring a file from another mod

#

That is loaded before my mod

bronze yoke
#

weird, nothing changed that i heard about, and require has seemed fine for me recently - can we see the relevant code?

alpine scroll
#
require 'lua_server_commands'
require 'cmd_utils'
require "ExpandedHelicopter00a_Util"
require 'ExpandedHelicopter01c_MainCore'
require "ExpandedHelicopter06_EventScheduler"




local EHETI_eHeliEvent_ScheduleNew = eHeliEvent_ScheduleNew <<< Line 10 is this
function eHeliEvent_ScheduleNew(startDay, startTime, preset)

end
#

AFAIK nothing changed neither on my mod or EHE mod

bronze yoke
#

i can't see any reason that would cause an error...

#

the 'callframe at: require' is weird, require is allowed to fail

alpine scroll
#

Maybe because its now single quote instead of double?

bronze yoke
#

i use single quotes exclusively and i've never had any trouble

alpine scroll
#

Honestly dont understand what changed

bronze yoke
#

which folder is this file in?

golden sage
#

one question, whats this error?
Cannot invoke "se.krka.kahlua.vm.KahluaTable.len()" because "<local2>" is null
bc i get it everywhere

fast galleon
fast galleon
hearty dew
fast galleon
#

it's line 10 of a file in server folder, which has eHelicopter:new()
doesn't seem like that is defined yet at that point

topaz lark
#

hi and buenas noches, i want to start modding from this game, where can i start?, i mean, what programs to use, what languaje and frameworks the game use and so on, i already have experience programing in c, c#, java, typescript and others

astral dune
#

its pretty much entirely lua for code, and you can use whatever program you like. I use intellij IDEA, but I've seen everything from notepad to VsCode on here

golden sage
astral dune
#

I guess, if you're trying to do some Gradle stuff or whatever. As just a basic IDE with code highlighting it does the job with no hassle

topaz lark
#

ok i understand, but I meant if there is any software like the Project Zomboid Modding tools from steam or another one, i already use the jetbrains collection

astral dune
#

I believe the modding tools are mostly for models and textures, haven't looked at them yet myself

bronze yoke
#

intellij uses an entire extra gigabyte of ram than vsc on my machine, so i don't really have much choice

vast pilot
#

You should probably learn to use Blender or some other equivalent modelling software

hearty dew
topaz lark
#

ok thanks!, im gonna start with lua and see what can i do later

green berry
#

And one of the best tip is : check other mods to see how they do what they do. A bunch of them are well commented

topaz lark
humble oriole
#

Is the creator of Skill Recovery Journal active in here?

astral dune
#

isn't that Chuck?

humble oriole
#

idk haha, I'm just looking for some assistance in fixing better literacy to work with SRJ for our server.

#

and considering they just pulled better literacy, I may take it over since i've been patching it for our server anywho

bronze yoke
#

i'd better make sure my mod works with skill journals ๐Ÿ˜…

ancient grail
astral dune
#

does anyone know if rawget works in PZ's lua?

humble oriole
#

Iโ€™ll ask here too, and see if someone might be able to point me in the right direction.

#

The literacy mod is over writing the ISReadABook.lua and it adds pages to every piece of literature and then based on a characaters literacy skill it adjusts the read time.

The Skill Journal is using their own :update() and :new() but they're doing it in their own file reading/Skill Recovery Journal Read.lua

Is there a way that I can do something like

end```

To call the code in the skill recovery journal file so it just does that instead of doing all the code in ISReadABook.lua
hearty dew
astral dune
#

nice

bronze yoke
#

if it's not too much work, you should rewrite it not to overwrite the entire file, it's going to cause endless problems as long as it works that way

rancid tendon
#

i have a question for folks who know things about true music: do you know if it's possible for cassettes/vinyls to 'overwrite' or push other, potentially more valuable loot out of the table? how exactly does loot spawning work in that regard?

humble oriole
bronze yoke
#

i have a mod that's very similar to better literacy

#

it doesn't overwrite anything, and works perfectly

humble oriole
#

Our serverโ€™s difficulty is balanced completely around BL and SRJ so I just want them to play nice haha.

bronze yoke
#

it's just a really bad idea to override things in general

humble oriole
bronze yoke
#

apart from some vanilla functions that have a massive amount of code in them there's rarely a good reason to, and from what i know of what better literacy does it really doesn't need to at all

humble oriole
#

They also overwrite the entire definition for every book, and thatโ€™s how they added more books

bronze yoke
#

๐Ÿ˜จ

#

stressed perhaps

humble oriole
#

So when .73 dropped and the new cooking recipes came outโ€ฆ

green berry
#

hey @bronze yoke the literacy mod i use is actually yours ๐Ÿ™‚ I was checking my modlist to see which one I used ๐Ÿ™‚ great mod btw

humble oriole
#

Link yours Albion, Iโ€™ll take a look

bronze yoke
#

aw thank you ^_^ look forward to a huge update soon

humble oriole
#

And yours works with SRJ?

green berry
#

btw i make the I don't need a lighter mod, and the more recent I Might Need A Lighter, I'm open to any feedback ๐Ÿ™‚

humble oriole
#

Since youโ€™re not overwriting IsReadABook it probably does

rancid tendon
#

so i've noticed that sometime in the past couple of pz updates, something changed or broke in loot distribution--or at least so it seems. i'm having a weird problem where i have a mod that has a sandbox setting that multiplies the loot distribution chance, and if i set that to 0, i can see in loot zed that the items have a 0% chance to spawn but still spawn at the same rate as if the values were totally unmodified

bronze yoke
#

as a long time i don't need a lighter user

rancid tendon
#

is anyone else having issues like this/does anyone else know loot distribution well enough to help me with this concern? i'm not really a modder at all lol

bronze yoke
humble oriole
#

Since you built it out correctly I bet it runs fine

green berry
#

Well it's pretty much a V2 with all the feedback i got, sandbox options, etc. the goal is to balance it a bit more. As it was my first mod I rewrote a good chunk of it too ๐Ÿ™‚

bronze yoke
#

keep up the great work!

humble oriole
bronze yoke
rancid tendon
#

that's interesting and frustrating, because this used to work just fine

bronze yoke
#

unless that mod has a specific solution to this, sandbox options load after distributions are read

#

except sometimes they don't, i'm not sure what the exact rules for it are, but it often leads mod makers to think it always works when it doesn't

rancid tendon
#

hmm. in that case, i guess the best way to do this would be to make a patch that overrides the original distributions

#

not as much flexibility but it could serve the same function

bronze yoke
#

all you actually need to do is make sure the sandbox options are loaded before the distributions are added to the table, and that ItemPickerJava.Parse() is called after that

rancid tendon
#

hmm

#

that's a little above my paygrade ๐Ÿ˜… i'm only barely a modder trying to kludge something together with true music

astral dune
#

if I had a file called foo_bar.lua that contained something like

local bar = {}
bar.test = "test"
return bar

and then wanted to use it in another file, what is the proper syntax for require?
require("foo_bar.lua")
require("foo_bar")
require("bar")
something else?

bronze yoke
#

require("foo_bar")

#

although i think you need to assign it to a variable

#

like bar = require 'foo_bar'

astral dune
#

oh ok, should probably make that local too

bronze yoke
#

of course

sour island
#

It is I, the author of skill recovery journal

astral dune
#

you sometimes have to put a folder name in the require as well, right

bronze yoke
#

yeah, it's the path after lua/client/ (or shared or server)

rancid tendon
#

if anyone could explain to me like i'm five how to force the sandbox settings to be loaded before the loot distribution tables for this mod are, that would be very helpful :)

astral dune
#

oh ok, so only if I've added a subfolder

bronze yoke
sand harbor
#

lmao lea i'm trying to figure out the same thing

bronze yoke
#

oh they're just out there... that's difficult

rancid tendon
#

yeahhh that's how true music does it

sour island
#

I don't think there's an event - isn't on Lua load?

bronze yoke
#

distributions aren't merged immediately

#

there's even a pre and post distribution load event

sand harbor
#

modifying the chance in the distribution code doesn't do anything either for me (maybe that's already established)

bronze yoke
#

i would override the file, put them on an event that happens after sandbox options set (i use OnInitGlobalModData), and then call ItemPickerJava.Parse() at the end

humble oriole
# sour island I already do this

Odd itโ€™s not working on our server, I blame literacy. I think weโ€™re going to just rip off the bandaid and move to Albionโ€™s mod, weโ€™re testing it now

rancid tendon
bronze yoke
#

you can also force the sandbox options to load early, but it's not as good of an idea as it reads from the file (much laggier) and probably won't work in singleplayer

sour island
#

I did push an update that forces a time as other mods also cause issues

#

Honestly getting tired of the bug reports - might drop isRead

hearty dew
bronze yoke
#
Events.OnInintGlobalModData.Add(function()

  -- loot table stuff

  ItemPickerJava.Parse()
end)
rancid tendon
#

i was going to pastebin it to confirm that it looked right but just one of these distribution files exceeds their max limit LMAO

#

lookin right?

bronze yoke
#

think so!

rancid tendon
#

thanks a ton for the help you guys! this is a super big deal for this mod and the folks who use it will be happy that this feature is functional :)

#

i'll give it a test run

sand harbor
#

I was gonna put this on the steam page, and you might already know this, but it might make updating the mod with new songs less annoying if you made a function to add it to the loot table and then just called it for each song
something like function registerLoot(item, chance, allocation) table.insert(ProceduralDistributions.list[allocation].items, item); table.insert(ProceduralDistributions.list[allocation].items, chance); end

#

would be a pain to move everything over to that though

rancid tendon
#

honestly adding new songs isn't really all that hard anyway

#

just a few copy+paste and find+replace operations

hearty dew
bronze yoke
#

yeah, the problem is item picker java parses before sandbox options are loaded

sand harbor
rancid tendon
#

when i add new songs i literally just whack them onto the end of the existing files lol

#

super ez

bronze yoke
#

or sometimes anyway, sometimes it worked but it wasn't 100% of the time

hearty dew
#

Yea, that whole order of loading sandbox vars is a pain

rancid tendon
#

albion you're super helpful, so thank you again! and tyrir this is like the third time you've been a huge help to me

#

big ups to both of you <3

bronze yoke
#

^_^

rancid tendon
#

i do have a second lil question that kinda goes along with this: should i worry about over-crowding loot tables with music? with the distribution the way it is, are cassettes/vinyls able to crowd out other, more valuable loot?

#

if that's the case i'll probably set the default loot values much lower

bronze yoke
#

yeah, they do

#

i wrote a whole fancy script for my literacy mod that makes sure that skill books have the same chance of spawning no matter how many you have enabled, and then i realised everyone uses true music anyway and that it will just make them way rarer than if you have it turned off U_U

rancid tendon
#

ahh darn, in that case i'll probably set the default sandbox values much lower

#

i wish i could make it spawn a ton without crowding other stuff out, but oh well

bronze yoke
#

you can probably increase the total rolls to compensate or something, but i've never played with it

#

maybe i'll add to that script to make it multiply the book spawn weight based on the total weight of the container compared to what it should be in vanilla...

astral dune
#

you ever write a piece of code that seems really good and just feel smug about it?

bronze yoke
#

that's like 70% of why i program

astral dune
#

lol

rancid tendon
#

:( hm

#

that did not seem to work

bronze yoke
#

oh no

#

i'm having the same problem - maybe a spawn chance of 0 isn't allowed?

rancid tendon
#

very possible! lemme give it another go

bronze yoke
#

you could check if the spawn chance is 0 and just not add the item to the table

rancid tendon
#

AH HA, ok that's totally what it is

#

i was just putting it at 0 to test, so 0 not being allowed isn't really relevant to my use case

#

loot seems much rarer with a low number as it should be

#

thank you again for the help albion!!

bronze yoke
#

haha glad that worked, i was scared for a moment that my mods weren't actually working as i thought either ๐Ÿ˜…

#

with spawn chance stuff you can only ever be about 70% sure it's working

rancid tendon
#

my pride and joy.. restored to full functionality... yipee

sand harbor
#

nice!

azure rivet
#

Hello, how do I make a helmet compatible with the susceptible mod?

astral dune
#

I'm moving some code from client side to server side. it used to run OnPlayerUpdate, what would be roughly equivalent on the server if I want it to run every cycle? OnTick?

hearty dew
#

yea

#

OnTick is raised 10 times a second on the server-side, so less frequent than client-side where it is tied to fps

astral dune
#

well that's good. As long as nothing happens in between ticks

humble oriole
sour island
#

Ah

#

What mod is it

#

I can add it to my list

#

I have an on going mod list that I call require on

#

To load first

#

So I can override them

bronze yoke
#

better literacy, but it sounds like the developer of that mod wants to fix it themselves

sour island
#

Is that slime's mod?

ancient grail
#

I wonder why we dont see the other developers around mod chat. Ive only talked to theZ the developer of door remote / turret mod

But he said his not active on discord.

bronze yoke
alpine scroll
bronze yoke
#

the error technically points to the expanded helicopter events file, but i checked and there isn't anything of note on that line that should break anything

#

especially since ehe wasn't updated when the problem appeared

alpine scroll
# hearty dew Can you provide the error?
-----------------------------------------
function: ExpandedHelicopter01c_MainCore.lua -- file: ExpandedHelicopter01c_MainCore.lua line # 10 | MOD: Expanded Helicopter Events
Callframe at: require
function: cmd_helicoptero.lua -- file: cmd_helicoptero.lua line # 4 | MOD: ExtrasDescoladosCMDHELI
ERROR: General     , 1668211925499> 249.385.395> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index of non-table at KahluaUtil.fail line:82.
ERROR: General     , 1668211925500> 249.385.396> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index of non-table
    <kalua errors here>
    at java.base/java.lang.Thread.run(Unknown Source)
LOG  : General     , 1668211925505> 249.385.401> -----------------------------------------
STACK TRACE
-----------------------------------------
function: ExpandedHelicopter01c_MainCore.lua -- file: ExpandedHelicopter01c_MainCore.lua line # 10 | MOD: Expanded Helicopter Events
Callframe at: require
function: cmd_helicoptero.lua -- file: cmd_helicoptero.lua line # 4 | MOD: ExtrasDescoladosCMDHELI

nov. 11, 2022 9:12:05 PM zombie.Lua.LuaManager RunLuaInternal
GRAVE: at ExpandedHelicopter01c_MainCore.lua:10```
#

Oh, I know what happened, now that I ran it

#

Dang it

hearty dew
#

attempted index of non-table

alpine scroll
#

I cannot fix this

#

I need to find Jab

#

There is a mod, called LuaServerCommands

#

That requires patching a file on the server at the Zombie folder

#

It probably changed enough so it doesnt work anymore with the last patch

#

I think Ill need to learn java to fix that

hearty dew
#

Is it not just a table/class that's not yet defined but expected to be defined at line 10 of ExpandedHelicopter01c_MainCore.lua?

alpine scroll
#

I didnt change the mod

#

At all

#

All I did was update the server and reapply the patch

#

It stopped working with the update

#

The ONLY thing I changed was the server version, basically

#

So yea, got a project

hearty dew
#

line 10 is

function eHelicopter:new()

but eHolicopter is defined here:```
./mods/Expanded Helicopter Events/media/lua/server/ExpandedHelicopter01a_MainVariables.lua:eHelicopter = {}


Looks like you are requiring `ExpandedHelicopter01c_MainCore` in such a way that its prerequisite lua files aren't loaded
alpine scroll
#

But it should obey the order on the Mods in the .ini file, right?

#

So technically, as long EHE is before CMDHELI, it SHOULD work, right?

alpine scroll
#

Wait

#

What changed?

#

Because I swear it works on 41.77

humble oriole
#

@bronze yoke are you considering adding options for different skill multipliers that the books give?

bronze yoke
#

what do you mean by that?

humble oriole
#

hmm, how to explain it

#

the literacy skill itself would affect the multiplier that the skill gives you. So at Literacy 5 and below you get vanilla multipliers, but at literacy 10 you get a huge multiplier.

bronze yoke
#

oh like better literacy? i excluded that because i didn't really like it from a balance stand point (and i need some excuse to call it not a total ripoff) but if that would be useful to you i could add it

#

i have a massive update that's just missing a little bit of content before i push it, and at this point i'm having fun just seeing how long i can make the changelog, so feature requests are good

humble oriole
#

yea, we use that at the core of ours

#

We wanted higher multipliers because of no disassembling, so those first few levels are really tough, unless you have the books.

bronze yoke
#

oh that makes sense, it'd be almost mandatory then

humble oriole
#

which is why we're pulling our hair out!

#

hahaha

#

we only return 35% xp back with the skill journal and only crafting skills for the same reason

strange sequoia
#

question, if i wanted to make it to where a sound alert triggered on the first snow... how how i do that via a mod?

humble oriole
#

are you adding walking with lit 9-10 while reading with your update?

bronze yoke
#

yeah, another feature i don't personally like but have added as an option

humble oriole
#

it doesn't add much but flavor imo haha

bronze yoke
#

this update is getting pretty huge, the changelog is over half a page long now and it's just short notes ๐Ÿ˜จ

humble oriole
#

That's awesome! Also, I don't think the creator of Better Literacy probably won't care since he pulled the mod, so it's your call haha.

bronze yoke
#

they don't seem too active anyway, i doubt they'd get mad at me for it

humble oriole
#

well, if you think the multiplier changes are something you'll add, we'll start moving to rip the band aid off and swap to your mod.

bronze yoke
#

yeah i'm dropping it in now, it's hopefully pretty simple to add

#

it won't come out until the big update is done though

humble oriole
#

How long are you thinking? About a week?

bronze yoke
#

i'm not sure, it was supposed to come out like three months ago LOL

humble oriole
bronze yoke
#

basically, my mod doesn't have literacy skill books like better literacy does, it was originally balanced without them

#

i decided it'd be a bit better balanced to have them, but the reason i didn't have them is it didn't make much sense to me, so i made them vhs tapes instead

#

but when you have vhs tapes... you have to write dialogue for the vhs tapes

#

i've been putting that off for about three months and that's why this update is so huge LOL

humble oriole
#

aaaaah, ok

#

I wish I knew enough to know how to limp Better Literacy until yours is ready.

#

Also, your concept is really neat, and now I'm super excited to replace better lit with it.

bronze yoke
#

if you're using a dedicated server, i think moving better literacy before the skill journal mod in the load order might fix your issues

humble oriole
#

it is xD

bronze yoke
#

ah... i thought it probably wasn't that because the issue appeared suddenly

humble oriole
#

no, better lit overwrites the isRead and per chuck anything that changes reading speed breaks the SJ

bronze yoke
#

the hope is that if it overwrites isread before chuck's mod hooks it it doesn't really matter

#

oh but if reading speed breaks it that's a problem...

#

i'll make sure they're compatible before i release

#

i got one of six tapes done today, which technically puts me on pace to finish sometime in 2025 but i'd bet it'll be a little bit earlier than that

humble oriole
#

your mod works with SJ right now

bronze yoke
#

oh good! i don't see why this update would break that

humble oriole
#

yea, we tested it cause you mentioned you hadn't earlier

#

Episode 1 better be teaching how to read the ABCs hahaha

bronze yoke
#

haha yeah i've moved the literacy magazine to the vhs system as well (that's why there's six tapes total) and that's the one i wrote today

bronze yoke
#

i wouldn't expect them to be too spectacular, i really wanted to make sure they fit the vanilla style but at this point i just want to get them out

sour island
#

The update to SRJ today should prevent speed related issues

#

At least it fixed more traits, soto, and another mod I wasn't aware of

#

The solution for more traits was to reset the current time on the action every tick

#

Having SRJ loaded after should fix the rest I imagine

humble oriole
#

It's not even really worth spending time on better literacy since it's gone. So, we're absolutely swapping to albions mod, but will probably wait till the update if we can get better lit to limp along until then. I just really don't want to deal with the players crying even harder about no disassembling.

#

yea, better lit is still broken with the SJ. I don't really want to spend time on making this work, so we may just deal with the fallout

ancient grail
# sour island The update to SRJ today should prevent speed related issues

On our previous i made an unlisted version of your mod
Basically what i did was a replica called event recovery journal
Basically to create another journal
So that we dont need to change the default percent of the journal

The srj is configured to give only 50% and the replica was configured to 100% and is consumable and non craftable

Just so we can use it during pvp events

Hehe it was an unlisted mod but. Sorry if wasnt able to ask for permission

We dont have a server anymore so theres nothing to worry abt that

#

So perhaps you might consider doing this for pvp servers out there idk

#

If i knew how to modify moddata back then imight havejust spawned a journal with that setting lol

lyric bolt
#

Hey where are mod configuration options actually stored? Like I am trying to find where autoloot stores it because it keeps overwriting it... I have this issue with a few mods at times

astral dune
#

having a hell of a time trying to fix a rounding error on the lua side, or more specifically detecting when its about to happen. Is there any way to tell the Java to do some math and return the answer, rather than doing the math in lua?

bronze yoke
#

is this about the blood intensity thing?

astral dune
#

ya, I can't find a way to know when its going to get stuck. Only thing I can think of just doubling the rate of increase to hopefully bypass it getting stuck altogether

bronze yoke
#

all i think you can do is watch the blood intensity and bump it over when it's going to get stuck

astral dune
#

that would require me knowing when its going to happen, which is the problem. I know when it happens on my computer, but I have a feeling it may depend on what version of java people are running

#

for example, if I run it in rextester, which has openjdk 11.0.5 in it, the math gets stuck at 0.0499999 instead of the 0.039999 that it does on my machine locally running oracle java 18

hearty dew
#

Pretty sure pz bundles its own version of java so the system's java shouldn't have that effect

bronze yoke
#

yeah i've seen something like that in the files

astral dune
#

they bundle the java runtime? thats kinda weird but it would be helpful in this case

hearty dew
#

Yea, I presume it is in jre/ and jre64/

#

What's the rounding error you are encountering on the lua side?

astral dune
#

the rounding error is actually on the java side, I can't recreate in on the lua side so I can't detect when its about to happen

#

the blood intensity on a vehicle is increased by 0.01F, then cast to an int, then a byte, and then stored, lol

bronze yoke
#

it always happens at the same time so i don't think you need to

astral dune
#

it happens at 0.04, then 0.08, then 0.25, 0.28, 0.31 etc etc all the way up to about 0.60, after that it works all the way up to 1.0

#

as long as I can be pretty certain all those break points are the same for everyone, I can hardcode bypasses for each, ya

bronze yoke
#

hmm i'm not sure i experienced most of those actually

#

i don't think i pushed it all the way to 1.0 but i remember it being pretty unobstructed after i pushed it over 0.04

astral dune
#

I think I'm making up the 0.08, it doesn't happen again until 0.25ish

#

this is of course letting the java increase it with an actual collision, increasing it manually on the lua side by 0.01d doesn't do the same thing

bronze yoke
#

mine gets stuck at 0.04, 0.26, 0.29, 0.39, 0.42, 0.45, 0.48, and then i hit a street post

astral dune
#

lol

astral dune
#

0.04, 0.26, 0.29, 0.39, 0.42, 0.45, 0.48, 0.52-0.53, 0.58-0.59

#

so I think it matches

astral dune
#

Ladies and Gentlemen, we gottem

livid locust
#

I made the basic object now I just need to colour it

#

uv mapping seems so difficult I just want to colour faces

ancient grail
#

anyone knows how i can simulate the zed corpse quezy effect

#

without adding actualy number of corpse on the scene

ancient grail
#

Would it be possible drop corpse and make their sprite invi

#

Ahh if i can set it to nil just turn their skin into a blank png

#

Hmmm that might work

ancient grail
#

Everyone seems to be asleep ... spiffozombie

astral dune
#

I'm still plugging away, but its probably best to stop, lol

fast galleon
livid locust
#

now I have to figure out how to program the .fbx file into project zomboid ๐Ÿ˜ญ

ancient grail
#

and just add the corpse so that it detects it?

#

i think its code uses the vanila sickness

ancient grail
#

afik you should have the transfor applied

#

like make it 0,0,0

#

but im not realyy 100% certain

ancient grail
hazy ivy
#

Hey, I was just curious if anyone know a mod that allows you to bed rest? My character is sick and I'd like for him to just lay in bed all day to rest

ancient grail
#

but all i see is
function functioname(clothing, parts)

#

so how do i get the clothing without having to add it withing the function parenthesis

#

๐Ÿ˜ตโ€๐Ÿ’ซ

#

for i=1, #parts do

    local part = parts[i];
    local hole = clothing:getVisual():getHole(part) > 0;
    local patch = clothing:getPatchType(part);
#

this is al sort of confusion

#

i just wanted to check if the hazmat has hole

#

------------------------ check holes ---------------------------

function isHazmat(clothing, parts)
  local items = getPlayer():getWornItems()
  for i = 0, items:size() - 1 do
    local item = items:getItemByIndex(i)
    if hazmatList[item:getFullType()] then
      if isDebugEnabled() then
        print(hazmatList[item:getFullType()])
        print(item)
      end
          for i=1, #parts do
        local part = parts[i];
      if item:getVisual():getHole(part) > 0 then
      return true
    end
  end
end
ancient grail
hazy ivy
#

ope yeah wrong chat, im sorry

ancient grail
#

No worries friend

fast galleon
#

also there's a getHolesNumber but I haven't modded clothes

native thorn
#

Can anyone make a 25% zoom mod I just wanna see the little details better mainly jewelry and make up.

young orchid
#

and nude textures

calm estuary
#

does anyone know how I can make this better since if 0 == 0 just seems stupid

#

it works tho

fast galleon
#

if true then

lunar robin
#

Oh, so math.random() doesn't work? Should i use ZombRand()?

calm estuary
fast galleon
calm estuary
fast galleon
calm estuary
lunar robin
#

How do I get a ZombRand() out of an array?

local testArr = {"ABOBA", "BOOBA", "POOP"}
local randVal = ZombRand(#testArr)
print(randVal)

Currently it prints only the index... But I need the string itself

fast galleon
lunar robin
#
local testArr = {"ABOBA", "BOOBA", "POOP"}
local randVal = ZombRand(1, #testArr+1)
print(testArr[randVal])

Oh, right.

#

So it gets nil in case I don't start the indexing from 1st element

neon bronze
#

Yea lua starts with 1 instead of 0 like any other languagea for indexing arrays

odd notch
#

say i want to store a string on a player, and have another player view said player's associated string. could i accomplish this without using global moddata?

#

the implementation that comes to mind (bad) is a sendclientcommand that checks the player's username to a list, then grabs the associated entry. i'm looking to implement player portraits for an rp server

dull moss
#

If i have 2 mods (mod a and mod b) that both set player inventory weight limit, is there any way to interrupt specific function that is in mod b from mod a?

sour island
#

yes

#

If the functions are global, you can call on them to overwrite them entirely or overload them by storing the first

#

if they're not global you can name the file the same name and I believe it should overwrite the entire other file.

dull moss
#

hmm

dull moss
#

wouldn't overwriting it break the mod b

#

cuz unfortunately its local function

jaunty marten
sour island
#

What exactly are you trying to do? Perhaps you are going down a more difficult route

dull moss
#

if mod b would be active it'd be a simple issue of adding and not getActivatedMods():contains(mod a) then to the function that sets weight

calm estuary
dull moss
#

and then i'd be able to make everything work in mod a

jaunty marten
#

if remove if statement then will change literally nothing

calm estuary
jaunty marten
#

cos ur statement always equals true so nothing change

calm estuary
green berry
sour island
ancient grail
sour island
#

Alternatively you can offset the other mod within your mod

#

Not sure what mods your talking about but if one mod is adding such and such to weight's function you can just undo it

ancient grail
#

Can u show the code you did that resulted the error when u remove the if statement? You might have forgotten to remove the end too

sour island
#

I the case of my mod Rebalanced Calories - the vanilla calorie method isnt exposed or hookable

green berry
#

you could write if(true) that would be the same ๐Ÿ™‚

calm estuary
dull moss
sour island
#

So I recreated the calculations of vanilla and only apply the differnce

sour island
dull moss
#

how

sour island
#

Can't do it other way around tho

ancient grail
#

Might not be broken but also not optimized . Alot of codes arent but what you are doing with the if statement isnt necessary. Its pointless tbh

If statement

end

#

Remove both

#

It wont cause error

sour island
#

You can check for active mod IDs and run require on the file(s) name

dull moss
#

but won't it make mod a require mod b?

sour island
#

No

ancient grail
#

Pls show how you removed it and how it returned an error im sure we will figure out why from there

sour island
#

That's why you're checking for active mod IDs

calm estuary
sour island
#

It's a soft integration

ancient grail
sour island
#

I do this for mods that cause load order issues or are just overwriting shit with no concern

ancient grail
#

Sample

sour island
#

Turns my bug reports into their big reports

dull moss
#

i tried it

sour island
#
local crossRefMods = {
    ["CatsWalkWhileReadMod"]="ReadFasterWhenSitting",
    ["CatsReadMod"]="ReadFasterWhenSitting",
    ["CatsReadMod(slower)"]="ReadFasterWhenSitting",
    ["SnakeUtilsPack"]="tooltip",
    ["nicocokoSpeedReading"]="TimedActions/NSRReadABook",
}
local loadedModIDs = {}
local activeModIDs = getActivatedMods()
for i=1, activeModIDs:size() do
    local modID = activeModIDs:get(i-1)
    if crossRefMods[modID] and not loadedModIDs[modID] then
        require (crossRefMods[modID])
        loadedModIDs[modID] = true
    end
end
#

This system only handles 1 file per mod

dull moss
sour island
#

You can probably trim it down if you don't plan to add more mods to it

#

This would go above your code

dull moss
#

could I pm you for you to help dumb it down for my smoll brain? Barely have experience in lua so would need a bit of help

#

so we dont spam here

sour island
#

The way require "filename" works is that the folder structure needs to be listed - except for the server/client/shared part

#

also no file type

ancient grail
sour island
#

require forces a pause on anything after it

#

it looks for the file being called on

#

so it would load the other mod first

dull moss
#

I honestly still don't get it sadge

sour island
#

unfortunately there is no reverse function

ancient grail
#

You would have to check the mods itself to get the actual lua files name and dir

sour island
#

["nicocokoSpeedReading"]="TimedActions/NSRReadABook",

ancient grail
sour island
#

nicocokoSpeedReading = ModID as per mod.info

ancient grail
#

What mods are you working on and whats reference?

sour island
#

/client/ TimedActions/NSRReadABook .lua

#

you ignore the client/server/shared part of the file path, and ditch the file type

#

You have to open up the other mod

dull moss
#

gimme a sec, I'll write it up and will send in a sec

#

so i get this, right?

local crossRefMods = {
    ["DracoExpandedTraits"]="EventHandlers",
    ["ToadTraits"]="MoreTraits",
}
local loadedModIDs = {}
local activeModIDs = getActivatedMods()
for i=1, activeModIDs:size() do
    local modID = activeModIDs:get(i-1)
    if crossRefMods[modID] and not loadedModIDs[modID] then
        require (crossRefMods[modID])
        loadedModIDs[modID] = true
    end
end
#

both of those luas are in client folders

#

so i drop path beforehand and drop extension as you said

#

does that make MoreTraits.lua run after EventHandlers.lua?

sour island
#

no

#

whatever ids and file names you put in will be ran before the rest of the file that code is in

#

normally requires don't have all the extra bits

#

Notice the require at the top for a vanilla file

#

All the extra stuff is doing is making it conditional that the other mod is there

#

you can technically drop the loadedID stuff - that's more for me to use on separate checks

#

like in other functions I do if loadedModIDs[modID] then specific stuff

dull moss
#

so if I put this @ start of my lua EventHandlers.lua will be ran before the rest of the file, right?

local crossRefMods = {
    ["DracoExpandedTraits"]="EventHandlers",
}
local activeModIDs = getActivatedMods()
for i=1, activeModIDs:size() do
    local modID = activeModIDs:get(i-1)
    if crossRefMods[modID] then
        require (crossRefMods[modID])
        loadedModIDs[modID] = true
    end
end
sour island
#

yes

#

assuming you want "DracoExpandedTraits" to be ran first

dull moss
#

yes

sour island
#

If you need more than 1 file per mod I can adjust the code

dull moss
#

cuz then i can just overwrite whatever it does to base weight

sour island
#

I haven't yet so I never bothered

dull moss
#

nah, literally only that one

sour island
#

Yep, if it adds 1 you can just do -1

#

in your function you might need to do something like

if loadedModIDs["DracoExpandedTraits"] then

to add specific changes / offsets

dull moss
#

yea

#

if getActivatedMods():contains("DracoExpandedTraits") and player:HasTrait("Hoarder") then

sour island
#

I assume he has a trait that causes more weightloss than you'd like?

dull moss
#

nah, both mods have perks that increase max carry weight

sour island
#

and people are abusing it?

dull moss
#

so i want to make them work together

#

no

#

i should make sandbox setting that enables their stacking so ppl can opt in to use it KekW

sour island
#

When the trait is applied can't you just do something like maxcapacity = maxcapacity * 1.5 or whatever rather than a fixed number?

dull moss
#

that's what i'mma do

sour island
#

ah, and his mod uses a fixed number

dull moss
#
function checkWeight()
    local player = getPlayer();
    local strength = player:getPerkLevel(Perks.Strength);
    local mule = 10;
    local mouse = 6;
    local default = 8;
    local globalmod = 0;
    if SandboxVars.MoreTraits.WeightPackMule then
        mule = SandboxVars.MoreTraits.WeightPackMule;
    end
    if SandboxVars.MoreTraits.WeightPackMouse then
        mouse = SandboxVars.MoreTraits.WeightPackMouse;
    end
    if SandboxVars.MoreTraits.WeightDefault then
        default = SandboxVars.MoreTraits.WeightDefault;
    end
    if SandboxVars.MoreTraits.WeightGlobalMod then
        globalmod = SandboxVars.MoreTraits.WeightGlobalMod;
    end
    local muleMaxWeightbonus = math.floor(mule + strength / 5 + globalmod);
    local mouseMaxWeightbonus = math.floor(mouse + globalmod);
    local defaultMaxWeightbonus = math.floor(default + globalmod);
    if player:HasTrait("packmule") then
        player:setMaxWeightBase(muleMaxWeightbonus);
    elseif player:HasTrait("packmouse") then
        player:setMaxWeightBase(mouseMaxWeightbonus);
    else
        player:setMaxWeightBase(defaultMaxWeightbonus);
    end
    if getActivatedMods():contains("DracoExpandedTraits") and player:HasTrait("Hoarder") then
        player:setMaxWeightBase(math.floor(player:getMaxWeightBase() * 1.25))
    end
end
#

๐Ÿ™ƒ

#

will check if it works and stuff and then add sandbox option for it to stack

sour island
#

Oh this is an ongoing check

dull moss
#

every 10 min

sour island
#

why not on player update?

dull moss
#

on player update = ?

#

aka when it triggers

sour island
#

you're using Events.EveryTenMinutes.Add( ?

dull moss
#

y

#

i mean this code using it, i didnt make thistrait

sour island
#

On player update is every tick I believe

dull moss
#

why would i do it on every tick

sour island
#

It related to player's stats

dull moss
#

well ye but 10 in-game minutes is fairly short time

sour island
#

true

dull moss
#

so whey make code run hundreds times more

#

if u can make it run once every 0.5-2 min

#

depending on day length ofc

sour island
#

If you're worried about optimizing you can store the strength and compare it

dull moss
#

nah, every 10 works just fine

sour island
#

but I doubt people would notice any issues

dull moss
#

^

sour island
#

I just like sticking everything in OnTick and Updates

dull moss
#

optimizations don't go brrrrr sadge

sour island
#

EveryTenMinutes is housed in the game's update()

#

it's all OnTick all the way down

dull moss