#mod_development

1 messages · Page 74 of 1

faint jewel
#

did you try it on a trailer that is being towed?

ancient grail
#

but i triedd on a car

faint jewel
#

i am thinking that might be the issue.

ancient grail
#

and what you told me they are all the same right

#

maybe

#

but im not sure really ..

faint jewel
#

they are. but i am wondering if a vheicle being towed breaks time and space.

ancient grail
#

itheres no other whole world of lua just for trailers excpt maybe the towable parts

#

wtf

#

skizot break time and space not trailers

dim hill
#

Is there a mod that allows players to be in more then one safehouse

molten cobalt
#

Hi again, should I be putting this in the same file as the trait itself, or a new file that requires the trait file? I'm a bit confused by that

ancient grail
#

if its a global you choose not to put it on the same file and just use require

faint jewel
#

AHAHAHAHAHAHAHAHA it IS because it's being towed.

#

what the shit man.

molten cobalt
#
local function Loader()
    --TraitFactory.addTrait("","",0,"",false,false)

    local SunlightSensitive = TraitFactory.addTrait("sunlightsensitive","Sunlight Sensitive",-10,"Take periodic damage whilst outside in the day time. \n (Does not activate when indoors)",false,false)
end
Events.OnGameBoot.Add(Loader);

local function TraitSunlightSensitive()
    local player = getPlayer();
    local timeOfDay = getGameTime():getTimeOfDay();
    if timeOfDay > 9 and timeOfDay < 20 and player:isOutside() then
        public void AddDamage((player.getPlayerNum),5)

    end
end
Events.EveryOneMinute.Add(TraitSunlightSensitive)
faint jewel
#

trailers break reality

finite owl
molten cobalt
#

Well I'm having issues just getting it working in general tbh

#
local function TraitSunlightSensitive()
    local player = getPlayer();
    local timeOfDay = getGameTime():getTimeOfDay();
    if timeOfDay > 9 and timeOfDay < 20 and player:isOutside() then
        AddDamage((player.getPlayerNum),5)

    end
end
Events.EveryOneMinute.Add(TraitSunlightSensitive)
#

I think the add damage isn't right

winter thunder
#

you might have to do player:AddDamage()

#

Oh

#

No

finite owl
#

So something like player:getBodyDamage():AddDamage(bodyPart, amount)?

winter thunder
#

yee

#

that should work

#

you should be able to just ZombRand the bodypart from the table if you dont wanna pick it

#

but- I would consider making it have some sort of other reduction, like maybe just giving the player pain

finite owl
#

Also @molten cobalt have you added the decompiled java and vanilla lua files to your IDE, so you get intellisense etc?

humble oriole
#

Is it possible to limit what can be put into a container and prevent people from taking anything out of it?

sour island
#

Yes

humble oriole
#

Would I set that in the tile definitions?

sour island
#

I have a lockout function set, you'd be the second person other than me to use it - so I'ma make it an API

humble oriole
molten cobalt
#

@finite owl I haven't done that yet no, what would that give me, sorry I've very new to all this
@winter thunder

Thank you both I'll try doing that and see how I get on

#

So in-game it throws an error when I walk outside, maybe this isn't correct for some reason?

player:getBodyDamage():AddDamage(ZombRand, 10)

winter thunder
#

Try something like this

local part = bodyParts[(ZombRand(14)+1)]
player:getBodyDamage():AddDamage(part, 10)
#

@molten cobalt

molten cobalt
#

Still getting an error when In-game :/

#

On the second line in the section you posted above

winter thunder
#

player:getBodyDamage():getBodyPart(part):AddDamage(10)

#

Try that instead?

molten cobalt
#

Still nope, I appreciate the help by the way

faint jewel
#

is it possible to unhook a car being towed via lua?

finite owl
# molten cobalt Still nope, I appreciate the help by the way

What's the specific error being thrown? You'll normally see a Java stacktrace, followed by some log lines saying the Lua files that were active at the time the error occurred (effectively the "lua stacktrace"). The important info is usually the specific error before the Java stacktrace.

molten cobalt
finite owl
#

So that says that you have an expression which evaluates to null, but you're trying to index it (using a value of 3.0).

#

Is the error on this line? local part = bodyParts[(ZombRand(14)+1)]?

molten cobalt
#

The one below, If the highlighted line in green is the one causing the error yeah

finite owl
#

Yeah, that UI isn't very accurate. You'll see it's saying the error is on line 12, but it's highlighted line 13

molten cobalt
#

Oh right

#

Ok that makes more sense

finite owl
#

So bodyParts isn't defined.

winter thunder
#

... it is because it should be a capital b

finite owl
#

Is there a global BodyParts object then?

winter thunder
#

believe so

finite owl
#

Another option might be to use player:getBodyDamage():getBodyParts() to get the body parts for the player. That might future-proof against TIS adding other body parts for things like animals...

#

So you'd have something like

local allBodyParts = player:getBodyDamage():getBodyParts()
local bodyPart = allBodyParts:get(ZombRand(allBodyParts:size()))
player:getBodyDamage():AddDamage(bodyPart, 10)
winter thunder
#

Yeah, that looks solid to me

#

This is for a vampire mod?

finite owl
#

(allBodyParts is a Java ArrayList, so it's indexed from 0 rather than a Lua table indexed from 1)

molten cobalt
#

Really appreciate this help btw, giving me an insight on how all this works 🙂

winter thunder
#

No worries! What we are here for :)

molten cobalt
#

Ok yeah that works now 🙂

Just it only seems to be damaging the left hand and nothing else lol

finite owl
#

I don't know about others, but I mostly come to this channel when I have questions myself, and it seems like good karma to help anyone I can while I'm here 😁

#

It should pick a random body part each time.

#

It triggers every 10 minutes? So how long did that character stand in the sunlight?

molten cobalt
#

Every minute it triggers

#

I'm just stood outside now watching it and its just doing the left hand all the time

finite owl
#

Hmm, I haven't used ZombRand before, let me have a look

winter thunder
#

But- If youd like, there is climate variables as well. Things like ->

isRaining()
isSnowing()
getDayLightStrength()
getFogIntensity()
getGlobalLightIntensity()
#

So you can also check for the specific conditions, since if it is raining and stormy- you should be able to go outside

molten cobalt
#

Yeah I 100% want to implement those things into, even some sort of tiered vamparism that could be reduced with items etc

finite owl
#

One thing that is pretty common is to stick some debugging print statements in your Lua code when working on it, so you can see what's going on in your code in the log. print("Vampire debug: picked random body part ", bodyPart) or similar

winter thunder
#

dont you usually do .. for combining?

#

or can you just ,

finite owl
#

.. does string concatenation

#

So that works too

winter thunder
#

Ah, word

#

makes sense

finite owl
#

But print actually takes any number of args and prints them all

fluid current
#

hey all, need a small tidbit of help regarding what file this is refering to in regards to the teachedrecipies

winter thunder
#

@molten cobalt Actually, a good one to consider. There is code for the following - getDawn & getDusk. Which I think gives back an int for the time that dusk and dawn are for the current day

drifting ore
winter thunder
molten cobalt
#

Yeah I saw those when I was thinking of it, so yeah now I've got more of an idea how things work I could use that, I think 9am is technically day, and 8pm is night time but not sure if that changes with the seasons etc

finite owl
#

So @molten cobalt you could break it up so you can see what's going on

local allBodyParts = player:getBodyDamage():getBodyParts()
print("Vampire debug: got " .. allBodyParts:size() .. " body parts")
local bodyPartIndex = ZombRand(allBodyParts:size())
print("Vampire debug: picked body part index ", bodyPartIndex)
local bodyPart = allBodyParts:get(bodyPartIndex)
print("Vampire debug: damaging body part ", bodyPart)
player:getBodyDamage():AddDamage(bodyPart, 10)
winter thunder
fluid current
#

oh yeah no

finite owl
#

And then if the bodyPartIndex values look like they're nicely spread out, but it's always damaging the same part, then you'd know that the problem was with the AddDamage call, or something

fluid current
#

TeachedRecipes = Herbalist,

#

isnt in recipes

winter thunder
#

sorry

#

lol

#

I thought you meant the highlighted line

#

i really need to read through things lol

fluid current
#

just wondering where it actually is

#

ik it has something to do with how its not just a single recipe

#

i wouldnt know where to find it though....

finite owl
#

A quick search suggested that Herbalist is hard coded.

winter thunder
#

Yeah, thats what I was thinking too

#

Are you looking to emulate that?

fluid current
#

oh im stupid

#

ive got it nvm lol

finite owl
#
public boolean isKnownPoison(InventoryItem var1) {
(stuff)
         } else if (var2.getHerbalistType() != null && !var2.getHerbalistType().isEmpty()) {
            return this.isRecipeKnown("Herbalist");
         }
fluid current
#

used a bad example

molten cobalt
winter thunder
#

Where you just looking for a way to add recipes from books?

fluid current
#

probably bc herbalist doesnt really have recipe, if i look at metalworkingmag3 it shows the recipes

winter thunder
#

oh word, yeah- You just list them

winter thunder
# fluid current yeah
#

This is usually a good source for things related to scripts and recipes

finite owl
fluid current
#

ty

#

id also have to add this custom magazine into the spawn pool i assume

#

which i dont know how to do either lmao

finite owl
#

IME "no implementation found" means that the arguments to a function call are not of the expected type. Java supports polymorphism where you can have multiple implementations for the same function with differently-typed parameters, and it invokes the one whose params match. When called from Lua, it searches for the right implementation based on the types of the converted Lua values, and throws that error if it can't find a matching parameter type signature

dull moss
fluid current
#

actually scratch that im watching a yt video

#

thanks all

dull moss
finite owl
#

I mean, he already has player:getBodyDamage():getBodyParts() stored in the local var allBodyParts

dull moss
#

i missed where was original code

#

so didn't see it sadge

finite owl
#

All good 😁

#

@molten cobalt What actual line is the error coming from? And what did the print statements say leading up to the error?

dull moss
#

he's using get()

#

try getType()

molten cobalt
#

12 according to this

attempted index:3.0 of non-table: null

then the same line for the next error

expected a method call but got a function call

dull moss
#

can u send code?

finite owl
#

Yeah, I've lost track of what the code looks like at this point 🙂

#

method call vs. function call is generally because something is blah.function() (with a dot) instead of blah:function() (with a colon)

dull moss
finite owl
#

Lua uses the colon as a shorthand to pass the object as an implicit first parameter (when invoking a function), or to expect an implicit first "self" parameter (when defining a function).

dull moss
#

@molten cobalt gib code

finite owl
#

So invoking blah:function(1, 2, 3) is the same as blah.function(blah, 1, 2, 3).

molten cobalt
#
local function Loader()
    --TraitFactory.addTrait("","",0,"",false,false)

    local SunlightSensitive = TraitFactory.addTrait("sunlightsensitive","Sunlight Sensitive",-10,"Take periodic damage whilst outside in the day time. \n (Does not activate when indoors)",false,false)
end
Events.OnGameBoot.Add(Loader);

local function TraitSunlightSensitive()
    local player = getPlayer();
    local timeOfDay = getGameTime():getTimeOfDay();
    if timeOfDay > 9 and timeOfDay < 20 and player:isOutside() then
        local allBodyParts = player:getBodyDamage():getBodyParts()
        local bodyPart = allBodyParts:get(ZombRand(allBodyParts:size()))
        player:getBodyDamage():AddDamage(bodyPart, 10)

    end
end
Events.EveryOneMinute.Add(TraitSunlightSensitive)
#

That is what we had that worked, which now doesn't work lol

finite owl
#

And which line gave the "no implementation found" error?

#

(Or what error are we looking at now?)

molten cobalt
#

Give me 2 secs

finite owl
#

Ah, I think I see the problem.

#

The params of the two AddDamage methods on BodyDamage expect either (BodyPartType type, float damage), or (int bodyPartIndex, float damage). There is no implementation which expects (BodyPart part, float damage)

#

So passing in bodyPart as the 1st param to AddDamage isn't going to work.

#

In fact, all the version which takes an index does is this:

   public void AddDamage(int var1, float var2) {
      ((BodyPart)this.getBodyParts().get(var1)).AddDamage(var2);
   }
#

So you can call AddDamage on bodyPart directly.

#

So you could either do

#
        local allBodyParts = player:getBodyDamage():getBodyParts()
        local bodyPart = allBodyParts:get(ZombRand(allBodyParts:size()))
        bodyPart:AddDamage(10)

or

        local allBodyParts = player:getBodyDamage():getBodyParts()
        local bodyPartIndex = ZombRand(allBodyParts:size())
        player:getBodyDamage():AddDamage(bodyPartIndex, 10)
#

Whichever you prefer

faint jewel
molten cobalt
#

@finite owl that has worked and is randomising the damage as I wanted it to, thanks so much for the help, its slowly making more and more sense as I go on

dull moss
#
local function Loader()
    --TraitFactory.addTrait("","",0,"",false,false)

    local SunlightSensitive = TraitFactory.addTrait("sunlightsensitive","Sunlight Sensitive",-10,"Take periodic damage whilst outside in the day time. \n (Does not activate when indoors)",false,false)
end
Events.OnGameBoot.Add(Loader);

local function TraitSunlightSensitive()
    local player = getPlayer();
    local timeOfDay = getGameTime():getTimeOfDay();
    if timeOfDay > 9 and timeOfDay < 20 and player:isOutside() then
        local n = ZombRand(player:getBodyDamage():getBodyParts():size())
        local selectedBodyPart = player:getBodyDamage():getBodyParts():get(n);
        print("selectedBodyPart:"..tostring(selectedBodyPart))
        selectedBodyPart:AddDamage(5)
    end
end
Events.EveryOneMinute.Add(TraitSunlightSensitive)

there, fixed it @molten cobalt

#

not sure if zombrand should be player:getBodyDamage():getBodyParts():size() or player:getBodyDamage():getBodyParts():size() - 1

#

think - 1 but you gonna have to test urself

drifting ore
#

lol where can I hire a modder

dull moss
#

here probably xd

finite owl
#

ZombRand seems to return from 0 to N-1, and the body parts are a java ArrayList, so it's 0 index.

drifting ore
#

who wants 10$ to mod my server correctly

#

lmao

molten cobalt
#

@dull moss that code works too

#

thank you both

finite owl
#

Or you could just set the vampire character on fire when they go outside, and bypass all this "pick a random body part" business 😆

molten cobalt
#

Maybe it could be a alternative mode aha

dull moss
#

anyone remembers if getStats():getStress() has values between 0 and 1 or 0 and 100

#

fucking annoying to test

dull moss
winter thunder
#

I am curious ab a lot of the effects, tbh

#

or stats

#

i mean

#

I dont know their bounds, or default values

finite owl
#

FWIW, setStressFromCigarettes clamps the value from 0 to 0.51, so that implies it's from 0.0 to 1.0

#
   public float getMaxStressFromCigarettes() {
      return 0.51F;
   }

   public void setStressFromCigarettes(float var1) {
      this.stressFromCigarettes = PZMath.clamp(var1, 0.0F, this.getMaxStressFromCigarettes());
   }
dull moss
#

yep, from 0 to 1

#

i hate this inconsistency

#

who needs consistency in our game right

#

stress is 0-1, unhappiness is 0-100

#

classic game experience WICKED

sour island
#

The fun part is that destress items get their values divided

dull moss
#

Hi Chuckyboi WorryWave

winter thunder
#

New pfp tho

#

👀

sour island
#

Hey

#

I think I added it last night?

dull moss
#

Ye

#

I know because I stalk you

finite owl
#

Oh, wow, GameServer.receiveClientCommand explicitly handles vehicle client commands specially.

         if (!"vehicle".equals(var4) || !"remove".equals(var5) || Core.bDebug || PlayerType.isPrivileged(var1.accessLevel) || var8.networkAI.isDismantleAllowed()) {
            LuaEventManager.triggerEvent("OnClientCommand", var4, var5, var8, var7);
         }
winter thunder
#

But also- I am messing with the lua event manager, adding/removing events. Is that going to be something that will effect everyone?

Like, I want to have something added when a specific player uses a drug. Code at the end of this is a super general example of what I mean with the code I am messing with. When these are added, will they be in effect for EVERYONE? Or just the specific player? I'm under the assumption that if I put these into client that it will only matter for the specific player, but idk much about this.

Wanna make sure that I dont accidentally mess this up royally lol

function every10mins()
  -- check players mod data, reduce effective duration by 1.
local duration = getPlayer():getModData().DrugDuration

 if duration = 0 then 
    Events.EveryMinute.Remove(DrugEffectPerMinute)
    Events.EveryTenMinute.Remove(every10mins)
    end
 else
  getPlayer():getModData().DrugDuration = (duration - 1)
  end
end
------------------------------------
function DrugEffectPerMinute()
  -- give player stat bonus or trigger effect. Considering multiplying these values based on world speed (?)
  -- example vvv
    local stats = getPlayer():getStats()
    local NewEndurance = (stats:getEndurance() + 2)
    stats:setEndurance(NewEndurance)
end
------------------------------------
function TakeDrug()
  if Cumulative Potency >= x then 
    Events.EveryMinute.Add(DrugEffectPerMinute)
    Events.EveryTenMinute.Add(every10mins)
  end
end
finite owl
dull moss
#

yep

winter thunder
#

honestly just wrote that out now for the example lol

#

I dont know the best way to go about implementing this- Sorta running it blind

dull moss
#

drugs should be on client side, so lua/client folder

winter thunder
#

Right

dull moss
#

all files in that folder are executed client side

#

so its safe to remove events after adding them

#

i do same, lemme send example

winter thunder
#

hell yeah

#

Alright sweet, I just wanted to be 100% sure so i wasnt accidentally breaking anything when it is ran in mp

dull moss
#
local function catEyes() -- confirmed working
    local player = getPlayer();
    local nightStrength = getClimateManager():getNightStrength()
    local playerNum = player:getPlayerNum();
    local checkedSquares = 0;
    local squaresVisible = 0;
    local darknessLevel = 0;
    local square;
    local plX, plY, plZ = player:getX(), player:getY(), player:getZ();
    local radius = 30;
    local modData = player:getModData().DynamicTraitsWorld;
    for x = -radius, radius do
        for y = -radius, radius do
            square = getCell():getGridSquare(plX + x, plY + y, plZ);
            checkedSquares = checkedSquares + 1;
            if square and square:isCanSee(playerNum) then
                local squareDarknessLevel = nightStrength * (1 - square:getLightLevel(playerNum)) * 0.01 * (square:isInARoom() and player:isInARoom() and 2 or 1);
                squaresVisible = squaresVisible + 1;
                darknessLevel = darknessLevel + squareDarknessLevel;
                modData.CatEyesCounter = modData.CatEyesCounter + squareDarknessLevel;
            end
        end
    end
    --print("DTW Logger: Checked squares: "..checkedSquares..", visible squares: "..squaresVisible.." with total darkness level of "..darknessLevel);
    --print("DTW Logger: CatEyesCounter: "..modData.CatEyesCounter);
    if not player:HasTrait("NightVision") and modData.CatEyesCounter >= SBvars.CatEyesCounter then
        player:getTraits():add("NightVision");
        HaloTextHelper.addTextWithArrow(player, getText("UI_trait_NightVision"), true, HaloTextHelper.getColorGreen());
        Events.EveryOneMinute.Remove(catEyes);
    end
end
#

this is run client side everyminute

#

until player gets the trait

#

then it's removed

#

and not launched anymore cuz of the way it's added to events

#
local function initializeEvents(playerIndex, player)
    if SBvars.CatEyes == true and not player:HasTrait("NightVision") then Events.EveryOneMinute.Add(catEyes) end
    if SBvars.SleepSystem == true then Events.EveryTenMinutes.Add(sleepSystem) end
end

Events.OnCreatePlayer.Add(initializeEvents);
#

so once player gets it it's straight up removed for the rest of the gaming session

#

and next time they log in

#

it wont even add it cuz they got the trait

winter thunder
#

With the code I sent- What would happen in the player logged off before their duration hit 0?

dull moss
#

since takeDrug wont fire again

#

it wont add event

winter thunder
#

So- Should I consider triggering this function (or a modified version) when the player loads in / joins?

function every10mins()
  -- check players mod data, reduce effective duration by 1.
local duration = getPlayer():getModData().DrugDuration

 if duration = 0 then 
    Events.EveryMinute.Remove(DrugEffectPerMinute)
    Events.EveryTenMinute.Remove(every10mins)
    end
 else
  getPlayer():getModData().DrugDuration = (duration - 1)
  end
end
#

Oops

dull moss
#

I'd recommend adding moddata, something like this (pseudocode)

modData.YourModName = modData.YourModName or {}
modData.YourModName.DrugXYZduration = modData.YourModName.DrugXYZdurationLeft or 0;
``` and then writing leftover duration in it adding event onCharacterCreate() to run it
#

why you run every ten minutes and then run every minute from it?

winter thunder
#

its not, one function runs every minute. The other runs every 10 to see if it should still run lol

dull moss
#

that's unneeded

winter thunder
#

You know...

#

I uh

#

I really hadnt thought about that

dull moss
#

No worries

winter thunder
#

...

#

LMFAO

ancient grail
dull moss
#

gime 3 min

#

@winter thunder I'd do something like this

function DrugXYZEffectPerMinute()
    local player = getPlayer();
    player:getModData().YourModName = player:getModData().YourModName or {};
    local modData = getPlayer():getModData().YourModName;
    modData.DrugXYZPotencyLeft = modData.DrugXYZPotencyLeft or 0;
    if modData.DrugXYZPotencyLeft ~= 0 then
        local stats = getPlayer():getStats()
        local NewEndurance = (stats:getEndurance() + 2)
        stats:setEndurance(NewEndurance)
        modData.DrugXYZPotencyLeft = modData.DrugXYZPotencyLeft - 1
    else
        Events.EveryMinute.Remove(DrugXYZEffectPerMinute)
    end     
end
------------------------------------
function DrugsInPlayerSystem()
    local player = getPlayer();
    player:getModData().YourModName = player:getModData().YourModName or {};
    local modData = getPlayer():getModData().YourModName;
    modData.DrugXYZPotencyLeft = modData.DrugXYZPotencyLeft or 0;
    if modData.DrugXYZPotencyLeft >= x then
        Events.EveryMinute.Add(DrugXYZEffectPerMinute)
    end
end

Events.OnCreatePlayer.Add(DrugsInPlayerSystem);
#

you will also have to find a way to check if player taked drugs

#

and from there set your player:getModData().YourModName.DrugXYZPotencyLeft to something

#

and then add make it add Event back in

winter thunder
#

I already have it, you can set custom functions in the OnEat variable in food items

#

The way to check if they have taken drugs i mean

dull moss
#

ye then there increase ur modData for that drug

#

and add event there

#

that starts checking stuff every minute until it wears off

winter thunder
#

So when does the OnCreatePlayer trigger?

dull moss
#

when character loads in

winter thunder
#

hell yeah

dull moss
#

every time, not only 1st one

winter thunder
#

sweet

winter thunder
#

huh?

ancient grail
#

Hmmm but ok if on rat works

#

Eat*

winter thunder
#

Yeah, OnEat takes any function. And naturally pushes the player, and the item consumed into the function

ancient grail
#

What did u use for the expiry

#

Like when the high is over

winter thunder
#

What do you mean?

ancient grail
#

Like when ur high youre bound to get sobered up at some point

dull moss
#

i think he does medical pills not other ones

winter thunder
#

nope ded

#

This is the recreational kind

#

lmfao

ancient grail
#

Nah his makong drug mod

dull moss
#

oh

#

nice

#

when weed

winter thunder
#

hahaha

dull moss
winter thunder
#

But yeah, I am going to basically tie into the event discussion above. If the remaining is > 0, and then is set = to 0, it will basically add some negative effects to simulate the comedown

dull moss
#

you dont even need separate event for that

#

since ur function is ONLY ran when drug is in the system, you can add effects when it hits 0

#

well if u want them over period of time you need separate function

winter thunder
#
    if modData.DrugXYZPotencyLeft ~= 0 then
        local stats = getPlayer():getStats()
        local NewEndurance = (stats:getEndurance() + 2)
        stats:setEndurance(NewEndurance)
        modData.DrugXYZPotencyLeft = modData.DrugXYZPotencyLeft - 1
        if modData.DrugXYZPotencyLeft = 0 then
          Events.EveryMinute.Add(DrugComedown)
         end
    else
        Events.EveryMinute.Remove(DrugXYZEffectPerMinute)
    end  
#

Like this

dull moss
#

ye

winter thunder
#

Wait

dull moss
#

ye it'll never do it

winter thunder
#

but that would mean they have 1 min of the high and the comedown

dull moss
#

no, look

winter thunder
#

It is reducing that variable on the line above tho, right?

#

nested if ugly, but I think it would work?

#

oh... It is hitting the end and never the else... I see

dull moss
#
function DrugXYZAfterEffects()
    local player = getPlayer();
    player:getModData().YourModName = player:getModData().YourModName or {};
    local modData = getPlayer():getModData().YourModName;
    modData.DrugXYZAfterEffectsDurationLeft = modData.DrugXYZAfterEffectsDurationLeft or 0;
    if modData.DrugXYZAfterEffectsDurationLeft ~= 0 then
        -- do some stuff
        modData.DrugXYZAfterEffectsDurationLeft = modData.DrugXYZAfterEffectsDurationLeft - 1
    else
        Events.EveryMinute.Remove(DrugXYZAfterEffects)
    end
end

function DrugXYZEffectPerMinute()
    local player = getPlayer();
    player:getModData().YourModName = player:getModData().YourModName or {};
    local modData = getPlayer():getModData().YourModName;
    modData.DrugXYZPotencyLeft = modData.DrugXYZPotencyLeft or 0;
    if modData.DrugXYZPotencyLeft ~= 0 then
        local stats = getPlayer():getStats()
        local NewEndurance = (stats:getEndurance() + 2)
        stats:setEndurance(NewEndurance)
        modData.DrugXYZPotencyLeft = modData.DrugXYZPotencyLeft - 1
    else
        Events.EveryMinute.Remove(DrugXYZEffectPerMinute)
        modData.DrugXYZAfterEffectsDurationLeft = 10; -- 10 min
        Events.EveryMinute.Add(DrugXYZAfterEffects)
    end
end
------------------------------------
function DrugsInPlayerSystem()
    local player = getPlayer();
    player:getModData().YourModName = player:getModData().YourModName or {};
    local modData = getPlayer():getModData().YourModName;
    modData.DrugXYZPotencyLeft = modData.DrugXYZPotencyLeft or 0;
    modData.DrugXYZAfterEffectsDurationLeft = modData.DrugXYZAfterEffectsDurationLeft or 0
    if modData.DrugXYZPotencyLeft >= x or modData.DrugXYZAfterEffectsDurationLeft >= 0 then
        Events.EveryMinute.Add(DrugXYZEffectPerMinute)
    end
end

Events.OnCreatePlayer.Add(DrugsInPlayerSystem);
winter thunder
#

Basically just have a seperate function to check if the player has drugs on load in, but dont include the add event on 0 clause. If it runs while they are already in game, then keep track of comedown effect

dull moss
#

you dont need separate func, check code i sent
lets say player has no drugs and only aftereffects are left and he logs out

#

he loads in

#

it fires drugs in player system

#

or wait need another clause in if

#

there

#

so drugsinplayersystem sees that there's either drugs in system or aftereffects in system

#

so it adds Events.EveryMinute.Add(DrugXYZEffectPerMinute)

tawdry solar
#

could this work theoretically

dull moss
#

DrugXYZEffectPerMinute sees that Drug duration is 0 so it removes itself from events and adds aftereffects to events

#

@winter thunder got the idea?

winter thunder
#

Yeah! I really appreciate the help

dull moss
#

np

#

now i go slep

winter thunder
#

Sounds good 💤

#

Sweet dreams friend!

dull moss
#

make sure to check all your moddata so its not nil

#

common problem

winter thunder
#

I will try my best 🫡 No promises though

fluid current
#

anyway to debug sound?

#

want to see how many tiles this is projecting sound

winter thunder
#

what is the thing you are testing?

#

@fluid current

#

Like- What item, i mean

fluid current
#

noisemaker

#

or atleast be able to visualize tile distance

#

idk

#

actually

#

i think its working

winter thunder
#

Seems like it is 17 tiles

fluid current
#

i think its working

#

lmfao

winter thunder
#

lmfao yeah- Sure seems like it haha

fluid current
#

just made a noisemaker that generates sound to 150 tiles

#

legit all i wanted lmao

winter thunder
#

oh- Yeah... That uh. That is a lot lmao

fluid current
#

i play with insane zombies

#

so i need a way to wrangle the hordes

#

im also playing an engineer

#

so

#

trying to use innovative ways to beat the undead

#

unfortunately the default traps are lackluster

#

i might make a mod for that too tbh

lavish otter
#

thats when i say fk it, grab a molotov and shotgun with a single shell, and go at it

#

hopefully the one zombie I kill has a lighter or matches on it

fluid current
#

hah

winter thunder
#

Anyone know what the endurance is set at? 0-1 or 0-100?

#

0 - 1, incase anyone was wondering

tawdry solar
#

is there a tutorial on how to make helmet

faint jewel
lavish otter
#

time to make a giant mod that just combines all firearms to be able to work together

dapper geode
#

how to hide vanilla "trade" context menu, instead of disable it using notAvailable = true?

thick karma
#

Does anyone know how to add a light source and show it at x, y, z? I tried making a custom IsoLightSource and I can confirm that it instantiated, but I am not clear how to make it visible.

tender trellis
#

Could anyone help me get started modding? I'm not necessarily wanting to make anything big, and I don't really have any experience coding, I'd just like to make a couple simple mods to mess with with my friends
I completely understand if you don't want to waste your time lmao

coral lava
#

Hello! Is there a link to the variables surrounding items, i am struggling to find it, scrap this, found the list

tender trellis
#

thanks!

sour island
tranquil reef
#

Is it possible to heavily mod the main menu, like changing the actual layout?

#

All I've seen for main menu mods are replacements of the background

winter thunder
winter thunder
# coral lava Hello! Is there a link to the variables surrounding items, i am struggling to fi...
#

This is a great place to start imo

winter thunder
#

Actually

#

@tranquil reef Main menu is located here

media\lua\client\OptionScreens\MainScreen.lua

faint jewel
#

yeah i was working on redoing the main menu too.

#

lol

tranquil reef
#

Weird there's not really any public mods that already do it lol

faint jewel
#

to try and make it look like that remake that was posted.

winter thunder
#

I think its bc UI is already such a pain to mess with lol

#

I would say out of all the people who mod this game, a tiny fraction of them actually do any serious UI work

faint jewel
#

local theTruck = vehicle:getVehicleTowing():getId(); would that work?

#

brandon i LIVE in the ui at the moment

tranquil reef
#

I was slightly tempted to recreate the Left 4 Dead main menu layout but I'm not too sure if I will lol

#

I usually improvise with this stuff

#

Wake up one day, "Zombie kidnapping mod" and then in 8 hours with no breaks it exists

winter thunder
#

while here, can I have nested tables in mod data?

like

getPlayer():getModData().MyMod = getPlayer():getModData().MyMod or {};
local modData = getPlayer():getModData().MyMod
local x = 1

modData
modData.Example = modData.Example or {};
modData.Example.Poptart = modData.Example.Poptart or 0;

getPlayer():getModData().MyMod.Example.Poptart = x
faint jewel
#

uhhhh

winter thunder
#

You know- I need to stop coding late at night...

faint jewel
winter thunder
#

I can just... Make a new table in modata...

#

*sigh*

tranquil reef
#

My idea

#

Mine

faint jewel
thick karma
#

I don't see anything on Workshop unfortunately

#

But I can extract the essential functions for my situation

tranquil reef
#

I would like to quickly commemorate this man for including a bug & giving steps to fix it, doing God's work

winter thunder
#

Think that might be the Diakon here

thick karma
#

It almost definitely is

winter thunder
#

@tardy wren

#

do this be you?

tranquil reef
#

Whoa

winter thunder
#

also-
If I have a variable that will = the name of a variable in the mod data, would the notation to get that be something like this? ->

function (ModDataVariableName)
local player = getPlayer()

player:getModData().MyMod[ModDataVariableName]
thick karma
#

Yes

winter thunder
#

dope

#

ty

thick karma
#

Well with ""

#

Oh

#

Nm

winter thunder
#

?

thick karma
#

I see the param

winter thunder
#

oh

#

yee

thick karma
#

You have it right

winter thunder
#

sweet

thick karma
#

MyMod should be declared as {} first

#

Somewhere

winter thunder
#

yeah! Just wanted to make sure lol

thick karma
#

Just making sure

#

You can also do player:getModData().MyMod.MyModVariable but passing as string doesn't work so smoothly that way

#

Depends on the situation which notation feels better

winter thunder
#

Adding an event OnPlayerCreate to initialize my tables :)

#

So I will be sure to do that lol

winter thunder
#

So- For the sake of just making sure my tables exist, is this a good way to go about it?

function InitializePlayerDrugData()
    local playerMD = getPlayer():getModData()

  -- Core data related to mod
    playerMD.StreetPharma = player:getModData().StreetPharma or {};
    local modData = playerMD.StreetPharma;

  -- Effect durations currently effecting the player.
    playerMD.StreetPharmaDurations = playerMD.StreetPharmaDurations or {};
    local durationData = playerMD.StreetPharmaDurations;
      --just examples below, but should I also initialize the variables of those tables?
    durationData.Stimulants = durationData.Stimulants or 0
    durationData.Narcotics= durationData.Narcotics or 0
    
-- Records of drug use.
    playerMD.StreetPharmaRecords = playerMD.StreetPharmaRecords or {};
    local recordsData = playerMD.StreetPharmaRecords;
      

  if modData and durationData and recordsData then
  print("Street Pharma Initialized Successfully!")
  end
end

Events.OnCreatePlayer.Add(InitializePlayerDrugData);
tranquil reef
#

How can I check a corpse's gender

fluid current
#

back again, wondering how you add custom sandbox options for your mod

winter thunder
#

I think it might be here

faint jewel
#

holy crap... their ui is rediculous.

tranquil reef
#

Change one thing and everything else screws up

faint jewel
#

it';s both

#

they HAVE to have either a WSYWYG program for editing it, or someone with SERIOUS mental proclivity towards self hate.

drifting ore
#

I mean, CSS like 10 years ago for sure

drifting ore
#

The biggest mental challenge of web design is centering a div.

#

😔

bronze yoke
tranquil reef
winter thunder
faint jewel
#

well this is fun,

#
        local TsignDistance = {}
        for k,v in ipairs(TrailerSignPlacement) do
            if v.loc == CurrLoc or v.loc == random_loc then
                table.insert(TsignDistance, v)
            end
        end

how do i make it so currloc i ALWAYS the first in TsignDistance ?

bronze yoke
#

are you trying to insert it to the start of the table? table.insert(TsignDistance, v, 1)

faint jewel
#

nvmi did it a little different

#

it was weird they way i had it becasue it basically made all the cities in the array BEFORE the current location, be the leaving location and it's like THAT'S WRONG!

#

the fricking shipping mod is gonna drive me to drink i swur

#

OKAY

#

so i am to a fun point.

#

it's PLAYABLE.

#

wait... it's "Playable"

#

them quotes are needed. lol

azure dock
#

aye guys ! I'm a professional at making music and fell in love with this game a year ago, I'll do any voice acting (voices range from insane scientist - rugged survivor - your grandchilds grandchild) Hit me up if you need some clips! Also have a ZOOM field recorder so if there's any specific sound you want sampled in the game I'll go get them for free! ❤️ love you guya

#

Implying any sound I can record from ANYTHING outside, if you need the sound for it I'll hop out on an adventure and get it for you at 48hz (movie quality)

#

Also wondering if anyone has any info on the survivor radio mod and the functioning of the audio file broadcast

#

would very much to revive it or toss a channel of my own but can't find a way for it to openly play sound files in MP not even with the aeldri patch

#

might just have to recode the reverend to preach world peace and everyone becomes super happy while I'm singing a singular Cm note

faint jewel
#

so i'm getting somewhere. just need to figure out how to center those.

#

and then increase the font etc ya know.

brave pier
#

In case anyone is actually interested I finally figured out the issue here:
The left side part is overlapping to next cell by 2px and the game then draws the wall on the next cell on top of the picture and that's why there's a sliver missing

faint jewel
#

told ya to move it 😛

sour island
#

I think it should work

ancient grail
ancient grail
sour island
#

lmk if the "how to use" needs clearing up

ancient grail
#

But i wont be able to use my custom icon tho or is there a parameter

faint jewel
#

i'm pretty much done. i just gotta touch up the turn in and then make it pay people.

ancient grail
#

Im not at home atm. I will probably tom evening

sour island
faint jewel
#

i just need to figure out how to center a label.

sour island
#

you shift it's x by half its width

faint jewel
#

....

#

i know that part.

#

but to make the game DO that. there's the fun part.

#

and ONLY to the text!

sour island
#

Are you using DrawText() ?

faint jewel
#

as you can see it moved the whoie ass thing lol.

sour island
#

there's a drawTextCenter

faint jewel
#

no i'm using country add override on teir menu lol.

sour island
#

idk what that is

faint jewel
#
        for _,child in pairs(self.bottomPanel:getChildren()) do
            if child.Type == "ISLabel" then
                child:setWidth(maxWidth)
                child:drawTextCenter()
            end
        end
#

yeah that aint do it lol

sour island
#

drawtext requires paramters for the text

faint jewel
#

DrawTextCentre

sour island
#

if you aren't using drawText() then it's not viable

faint jewel
#

danged brits

sour island
#

@ancient grail I added a function for texture setting just call it anywhere

#
---How To Use:
--Define local copy of `containerLockout` using require
local containerLockout = require "containerLockout-shared"

local function func(mapObject, player)
    --add conditions here, for example:
    if player:getModData().blockView == true then return false end
end

containerLockout.addFunction(func)

---default texture: "media/ui/lock.png"
--function containerLockout.setTexture(texturePath)
#

probably should factor in what is locking it but meh

faint jewel
#

local label = ISLabel:new(10, self.bottomPanel.y - 30, FONT_HGT_SMALL, "", 1, 1, 1, 1, UIFont.Small, true)

#

that appears to be how they are drawn.

sour island
#

ah, I forgot labels were a thing

#

the main menu buttons are labels?

#

🤔

faint jewel
#

that's how i am setting the width

sour island
#

eh?

ancient grail
#

Do have that on github? Cuz ill defntly study it now

sour island
#

Yeah, but what I posted is all you need

ancient grail
#

@sour island
<@&986122150958202931> the latest update of the Journal Mod Broke the Transcribing. Old Skill Cannot be Transcribe. and even if Admin give you EXP you still cannot Save it on the Journal. Unfortunately you have to Grind it again from the Start. and for that i will Slightly increase the EXP Multiplier.

sour island
#

doubt

ancient grail
#

This was from @smoky meadow

sour island
#

oh, old xp, yeah

#

whatever they hadn't transcribed before the update can't be transcribed

ancient grail
#

Ow i thought it was a bug he just told me u are aware

sour island
#

nah, just a growing pain

ancient grail
#

@weak sierra sorry to tag u mam. one of your mods is spamming prints. Was that intentional?

I think it was the car respawn

#

Theres also another mod that spams on loop as you hover any inventory item. No idea what mod it is nor who made it .

sour island
#

grab fingerPrint

faint jewel
#

son of a.

#

there does not seem to be a way to center the text on a label.

signal jolt
#

does somebody have the list of approved mods? just downloaded and skipped by the link by accident

faint jewel
#
            self.tutorialOption = ISLabel:new(labelX, labelY, labelHgt, getText("UI_mainscreen_tutorial"), 1, 1, 1, 1, UIFont.Large, true);
            self.tutorialOption.internal = "TUTORIAL";
            self.tutorialOption:initialise();
            self.tutorialOption.onMouseDown = MainScreen.onMenuItemMouseDownMainMenu;
            self.bottomPanel:addChild(self.tutorialOption);
            labelY = labelY + labelHgt
``` this is where they set them. have not found a single one that is centered.
ancient grail
#

But ossalion must have forgotten

#

Error magnifier and fingerprint is the same mod right

sour island
#

no

ancient grail
#

Ow ok

#

@sour island is it possible to create an api that suppresses print from mods that you list

#

Like for example
stopPrintsFrom('glytch3rsMod')

sour island
#

yes

ancient grail
faint jewel
#

well damn i can't find JACK on the ISLABELs

ancient grail
brave pier
faint jewel
#

🙂

ancient grail
#

function checkVar(var)
   if var == nil or var == '' or var == false    then return false 
   elseif var ~= nil or var == true then   return true 
   end
end


function isNull(var)
   if var == nil or var == "" then
   return true 
   else
   return false 
   end
end
     

#

will something like this be useful on the community mod you are building? @sour island

#

it just checks if theres anything on that var
so we can use "get" as if its "is"

#
checkVar(getPlayer():getVehicle())
-- will return true instead of the actual object
faint jewel
#

sooooooooo

fast galleon
#

I don't know what it is about 'Join' but alignment looks like this: ')'

late hound
faint jewel
#

i did... a thing.

late hound
#

were you off doing stuff in the naughty zone again?

ancient grail
winter thunder
#

But also

#

Have you been working on that this whole time?

#

Because I thought I was the only one coding for like 14 hours today 😂

drifting ore
#

im trying to lock some recipes behind the mechanic profession but the recipes im trying to add show up for everyone else too

winter thunder
#

Lmk if that works for you

drifting ore
#
    {
       KnowOnStart=false
       SkillRequired:MetalWelding=3,
       BlowTorch=4,
       Prop1: BlowTorch,
       Sound: BlowTorch,
       keep WeldingMask,
       CanBeDoneFromFloor:true,
       FrontCarDoor1/FrontCarDoor2/FrontCarDoor3/FrontCarDoor8/RearCarDoor1/RearCarDoor2/RearCarDoor3/RearCarDoor8/RearCarDoorDouble1/RearCarDoorDouble2/RearCarDoorDouble3/RearCarDoorDouble8/ECTO1CarFrontDoor2/ECTO1CarRearDoor2/M998BackCover1_Item/M998BackCover2_Item/IFAVDoor2/SL500Door3/W460CarFrontDoor2/W460CarRearDoor2/R32Door3/McLarenF1Door3/E150CarFrontDoor2/E150CarSlideDoor2/DG70Door3/fhqFusFleaSupDoor/NivaLeftDoor1/NivaRightDoor1/89BroncoCarFrontDoor2/88ChevyS10CarFrontDoor2/82JeepJ10CarFrontDoor2/CadillacFuneralCoachDoorSC1/CadillacFuneralCoachRearDoorSC1/ChevyBlazerDoorSC2/ChevyCamaroDoorSC3/ChevyCapriceFrontDoorSC1/ChevyCapriceRearDoorSC1/ChevyG30FrontDoorSC2/ChevyG30RearDoorsSC2/ChevyG30SideDoorSC2/ChevyG30RearDoorsSC2/ChevyP30DoorSC2/ChevyP30RearDoorsSC2/M1010RearDoors2/FireCoachFrontDoor2/FordBroncoDoorSC2/FordCrownVictoriaDoorSC1/FordCrownVictoriaRearDoorSC1/FordCrownVictoriaRearDoorSC1/FordExplorerFrontDoorSC2/FordExplorerRearDoorSC2/FordF150DoorSC2/FordF150RearDoorSC2/FordF700DoorSC2/FordF700RearDoorSC2/FordF700BoxTruckRollUpDoorSC2/HondaAccordDoorSC1/JeepCherokeeDoorSC2/JeepCJ7DoorSC2/M35Door2/MazdaB2000DoorSC2/Mercedes280DoorSC1/Mercedes280RearDoorSC1/PlymouthVoyagerFrontDoorSC2/PlymouthVoyagerSideDoorSC2/PlymouthVoyagerRearDoorsVanSC2/ToyotaCamryDoorSC1/ToyotaCamryRearDoorSC1/VWRabbitDoorSC1/VWRabbitRearDoorSC1/Shubert38LeftDoor1/Shubert38RightDoor1/49powerWagonFrontDoor2/49powerWagonRearDoor2,
       OnCreate:Recipe.OnCreate.SalvageModuleReturnsLargeMetals,
       Result:SheetMetal,
       Time:1000.0,
       OnGiveXP:Recipe.OnGiveXP.MetalWelding20,
       Category:Salvage,
    }```
#

does this look right

winter thunder
#

Here, sorry

#

NeedToBeLearn:true,

#

That is the code

drifting ore
#

oh ok ty

winter thunder
#

Yee

#

Also… jesus that is a hell of a recipe 😂

drifting ore
#

im covering all the bases lol

winter thunder
#

Lol, you could instead add a lua file that gives all car doors an item tag

#

Using the doParam function

#

You already have them typed, so it wouldn’t be too bad to get them transferred to that sort of thing

fast galleon
#

Just put a tag function, and add make a lua function 🤔

faint jewel
#

i wasted a lot of time trying to make a new font for it but PZ does NOT like fonts.

winter thunder
#

Yeah I remembered haha, it looks awesome!

drifting ore
#

Who wants 5$ to go over my server making sure I got everything correct

#

lmao

fast galleon
#

something like
in script: [Recipe.GetItemTypes.DoorTypes],
in lua: ...

#

hm, I seem to have the trashed the code

#
function Recipe.GetItemTypes.wireCarBattery(scriptItems)
    for type,_ in pairs(def.carBatteries) do
        scriptItems:add(getScriptManager():getItem(type))
    end
end
ancient grail
winter thunder
#

Oh no yeah we meant the exact same thing lmfao

#

Probably a clean way to check all vehicle/item scripts for the car doors too. Especially since they all use the ‘door’ in their name lol

drifting ore
#

so to start like this

fast galleon
#

The DoParam is probably not required for this

drifting ore
#
    {
       SkillRequired:MetalWelding=3,
       BlowTorch=4,
       Prop1: BlowTorch,
       Sound: BlowTorch,
       keep WeldingMask,
       CanBeDoneFromFloor:true,
       Recipe.GetItemTypes.DoorTypes
       OnCreate:Recipe.OnCreate.SalvageModuleReturnsLargeMetals,
       Result:SheetMetal,
       Time:1000.0,
       OnGiveXP:Recipe.OnGiveXP.MetalWelding20,
       Category:Salvage,
    }```
fast galleon
fast galleon
winter thunder
#

Yeah, would mean you don’t have to worry about any or all added car mods

#

Would just automatically do it

fast galleon
#

not sure if it's important but usually you list the source items on top.

neon bronze
#

But can it be put somewhere alone in its own file? Or do i have to copy the vanilla one evrytime

drifting ore
#

for the lua file i dont really know where id find the correct input for the car doors but i tried this

#
    for type,_ in pairs(def.carDoors) do
        scriptItems:add(getScriptManager():getItem(type))
    end
end```
manic berry
#

Can I prevent a specific car from spawning on the server? only i spawn

drifting ore
fast galleon
fast galleon
weak sierra
fast galleon
#

if you wanted to check all items you'd do something like

        local items = getScriptManager():getAllItems()
        local function isValid(item)
            return item:getName():contains("Door")
        end
        for i=0,items:size()-1 do
            local item = items:get(i)
            if isValid(item) then
                print("valid",item:getName())
            end
        end
ancient grail
#

Afaik the udderly on the print is yours
The inventory hover i really dont know what mod it is

ancient grail
ancient grail
#

Can anyone recommend an ide i can use while using mobile. Just need it for situations like now since im not at home till tomorrow

weak sierra
#

stuff acts different with different settings and diff mods present

#

nothing i write should spam the log unless there's good reason

#

so if it's doing that i can either tell u the reason or fix what's going on

ancient grail
#

Send it to u as soon as i have em

jagged ingot
#

Good morning.

#

Working on improving an old rain effect UI utility that I wrote several years ago on request.

manic berry
ancient grail
#

Lua folder

#

Most probably somewhere on the server folder

#

@weak sierra hope this helps mam

#

🫡

#

Ill ask for a settings configuration ss

ancient grail
#

Heres the settings

#

Default i think

#

@weak sierra

jagged ingot
#

ahhhhhhhhhhh whyyyy

#

I always create issues when going between Lua and JS. (this vs self)

#

Half of my errors are "what is 'this'" in the PZ console haha

jagged ingot
#

UIElement gradient draw calls when? 😄

sour island
#

the current method would be to draw a texture to aspect - this would only be for backgrounds or overlays

sour island
#

Yeah unfortunately

jagged ingot
winter thunder
#

For those following along- my drug mod is in the home stretch :)

lapis glen
#

Recently wanted to start working on this mod was wondering if there was someone willing to "Coach" me and help me work on this project and learn how to code in general i do want to warn per-say that this project has a bit of a big scope.

hazy rapids
#

Is there a mod that makes the video game item able to be used as a boredom reducer?

winter thunder
winter thunder
winter thunder
lapis glen
#

What if the zombies where more survivor like

#

They still are infected

#

But they will wander around wont attack the player immediately

#

Unless they break a "Rule"

#

I would make a comparison to we happy few

#

But i dont know if you know what that is

#

So like

#

Zombies will wander around the map

#

If they encounter the player they might give a word or 2

#

If they loot a zombie corpse they will become aggresive

#

And act like normal zombies

#

and at night they will seek indoors

#

And all that

fast galleon
#

That sounds like a lot of hardcoded java modding.

fallen storm
#

so npcs that become zombies if you anger them

#

in terms of attitude

lapis glen
#

yeah kinda

winter thunder
#

I mean- you could do it, but it’d probably only work effectively on client side.

You could make the player ‘invisible’, emulating them not attacking. The Lingering Whispers mod already makes zombies talk, so that would probably be a place to look for the words. And I’d imagine you’d just have a number of event hooks that will turn off the invisible with certain conditions

lapis glen
#

yeah that was what i was thinking

#

maybe you could help me with the mod?

winter thunder
#

I can give you some pointers on where to start, but I’ve got a big mod project of my own right now 😂

When I get out of work, I’ll post some stuff I would start with- so you can get a basic understanding

#

For now- I would look at the lua of a few mods, and try to parse the meaning. See if you can understand the basic language structure and stuff

lapis glen
#

Alrighty then cheers!

jagged ingot
#

Ahh man.. The guy I'm rewriting my rain UI class for went to sleep when I finally got it working.

#

I've essentially created a glorified particle emitter for rain with speed, spread, angle, color, alpha, etc.

winter thunder
jagged ingot
#

Nope.

deft surge
jagged ingot
winter thunder
#

Oh

jagged ingot
#

Want a zip of the current mod WIP?

winter thunder
#

Yeah, that would be cool

jagged ingot
#

It's a zipped mod.

#

It's a params test.

winter thunder
#

Trying to compile everything I can for when I get to psychedelic drug effects 😂 but Im not familiar with anything related to UI or screen effects yet

#

So having references helps lol

jagged ingot
#

Just load it and see the main menu.

#

then unload it and do whatever.

winter thunder
#

Will do 🙏🏻 I am at work now, but I’ll peep it when I get home

jagged ingot
#

I could generify this code and create an API for particle emitters.

#

Like for example being able to have images dropping from the top to the bottom of the screen like emojis.

#

Behaviors like gravity could be made so someone could make a "celebration" animation on the screen where a bunch of images arc from the bottom of the screen and go back down.

winter thunder
#

That sounds incredible

sour island
#

nicer sliding pop ups would be a nice have too

dim hill
#

Anyone knows what @sour island's recent changes to the journal mod do exactly/affect multiplayer servers? I'm struggling to understand his changelogs

sour island
#

I heard that guy just slaps code together

winter thunder
dim hill
#

But sometimes when you explain things I'm confuzzled

sour island
#

Fair, but what part?

dim hill
#

The whole thing

#

I think the way you explain things often assumes that the user isn't stupid

#

Unfortunately, the user is stupid

#

"Capped recording XP to max level's cap"

#

????!!

#

I have 600 hours of PZ and I have no idea what that means

#

[Capped recording XP] - ok, I guess we capped how much XP we can transcribe into the journal

#

[to max level's cap] 😬 😬

#

Max level's cap?

#

Same with pretty much the other ones, I think it stems from the fact I don't really understand how it works

#

I don't know what "a rollover of old character's XP" means, or what the new tracking system is

#

Or what "adding into the XP tracking" means

#

Long story short: skill issue on my part

#

Still curious about whether I should worry about using the mod or not since the comment says something about holding onto journals and crafting new ones - which is contradictory when I read it: Am I keeping the journal or should I craft a new one?

#

I want to be dead clear this isn't a critique of your writing skills, but me pleading for help with my poor comprehension skills 😉

#

Very thankful for your mods lol

sour island
#

max levels of skills have a cap to their xp

dim hill
#

I don't quite understand that either

sour island
#

you unlock level 10 but you haven't completed it until the bar is full

dim hill
#

Ahhhhhhhhhhhh

sour island
#

that's how pz does levels

dim hill
#

What is a max level's cap

sour island
#

level 10's max xp

#

basically maxing a skill out

#

I capped recording XP to maxed out XP

dim hill
#

Ohhhh

#

So if you reach level 10 and keep practicing a skill

sour island
#

I didn't account for it, so people were able to keep recording xp on addXp events

dim hill
#

And now your XP is like, level 10 + 5981512XP

sour island
#

yes

dim hill
#

It accounts for that

#

AHHHHHHHHH

#

PZ lets you keep gaining XP even after you reach level 10

#

And now your mod takes that into account

#

And caps it at whatever XP is at level 10

sour island
#

yes

dim hill
#

Understood

#

So this whole update makes no difference whatsoever if no one on the server has ever reached level 10 in anything

#

(for us)

sour island
#

shouldn't be that big of a deal wither way as it's only been a few hours

#

and I don't think it has an impact on read/transcribe times but I rather not find out

#

the more xp you have the longer it takes to read/transcribe

dim hill
#

Gootcha

#

What about the "- implemented a rollover of old character's XP into the new tracking system"

#

What does that mean?

sour island
#

I changed how the journal's work fundamentally, before I used the actual current xp of the character - now I intercept the addXP event (when you gain XP) and determine on a separate list if it should be recoverable

dim hill
#

Why'd you do that

sour island
#

people were confused as old characters had no tracked XP to speak of - and were worried they'd lose something - but the journals had the XP values, they'd get it all when they die

sour island
dim hill
#

Ooh okay

sour island
#

prior to this update starting skill levels gained more XP that converted to a flat value - which isn't ideal or fair

dim hill
#

So now it only transcribes XP you actually earned through grinding, not the ones you start with free from profession

sour island
#

no

#

it never recorded starting skills

dim hill
#

Oh good

sour island
#

the system is a bit weird but the default xp rate is 25%

#

this is vanill btw

dim hill
#

So at the end, should I as a server admin using this mod, tell all my users to delete their existing journal and write a new one? After today's update

sour island
#

not me

#

they should keep their old journal and make a new one - and try to transcribe/read from both until all the kinks transition out

#

after they die once, there should be no lingering issues

#

and they can keep using their new journal

#

also there was a bug with reading from journals not being recorded - this may not fix itself until the character dies - but the same advice as above applies

#

a priority in the update was keeping the old information salvageable - no one should lose anything

#

there was also an old ugly solution for passive skills as they work somewhat differently to the rest

#

I was able to even roll that over into the new system and clear out that info from the player's modData

#

much nicer having every skill work the same way for me

hot patrol
#

@sour island disregard this if it's already a thing but I have started using the skill journal on my server and I was thinking a really good feature would be if the recorded skills were given to your new character via an xp modifier as opposed to just directly getting the xp. I like that you can cut the max levels in half so there is still some punishment but I just think it would be better and make more sense if the journal worked like a skill book that gave you a modifier for every recorded skills so that you still gotta work for it.

sour island
#

this would actually be possible now

#

going to wait for this current update to circulate lol

hot patrol
#

Awesome!

#

I will absolutely use that setting

drifting ore
#

how do you call to run a lua file? i have a function down but its asking me for a file to run it

winter thunder
#

if you put ```lua before you paste code it will format it, just end the code block with ```

polar patio
#

Lie on ground mod? car

fast galleon
#

gonna add a new dynamic trait for those who did 100 pushup , 100 situps, 100 squats and 10km run a day

unique barn
#

anyone able to help with a mod load order

fast galleon
#

maybe

weak sierra
# ancient grail

that's normal it just means people are dismantling lots of vehicles

#

or entering areas where old vehicles were and they are all despawning at once

#

it only logs this when it tries to spawn something and the area isnt loaded

#

so each one of those is a spawn attempt

sour island
#

@dim hill Is this clearer, ignoring all the added info I gave you earlier.

dim hill
sour island
#

👍

fast galleon
#

Is it hard limited at 10 or just checks the highest level?

winter thunder
#

Can you have a skill has less than 10 levels by default?

hot patrol
#

Any modders taking commissions currently? I have a fairly simple idea I would like to execute.

#

something that has been bugging me a bit that I would like to put on my server

tawdry solar
#

what happens if i have no texture for me melee weapon but i made it coloured in blender

fast galleon
#

ah like 9, should be easier

#

and allow 10 for players with right trait / proficiency
*changing it per person is extra layer of challenge though

tawdry solar
#

are there any recourses on melee modding

winter thunder
#

It will be invisible afaik. You set the model definition in the script file, and it expects a texture image to overlay on that

hot patrol
# winter thunder What is the idea?

Just some quality of life addons for the true music and true actions dancing mod. containers for carrying unlimited cassetts, vinyles, and dance cards. changing loot spawns on music so they spawn in boxes you must unpackage much like the cereal boxes in the dance mod to help unlitter loot tables. and lastly a cassette player tho that last one seems undoable.

#

I've already got a taker tho

winter thunder
# hot patrol I've already got a taker tho

Oh no worries! Was just curious is all haha, currently working on a big project of my own as is 😂 kinda always wonder ab these sorta things tho, like - the commission stuff

hot patrol
#

it's been a little thing that has been bugging me a lot lately. I am big into the music stuff. and have way too much to store and way too much spawning in shelves and book cases. I wish I was smart enough for this modding stuff because I have so many ideas. Guess that's where a job and money come in. aPES_LulLaugh

winter thunder
hot patrol
#

it's a private one with friends but yes.

#

and I tried my hand with modding and all I can say is it is way our of my grasp and I don't have the time or patients to learn sadly. I do still try to dabble in blender and such every now and again tho.

winter thunder
hot patrol
#

I do like menacing notes 🙂

bronze yoke
#

i've actually worked on a system similar to that for cassettes

hot patrol
#

oh yea?

#

I looked on the workshop and didn't find anything but it is flooded with addons

winter thunder
#

Adds some stuff for event mods for bigger servers- but that is only admin accessible. The best part imo is that you can pin notes up on the wall :) you can use knives, tape, or a screwdriver. Saves the text when you take it off / pin it up

bronze yoke
#

it's not available as a mod separate from the mod i helped with it for, but i'm sure you could repurpose the code

hot patrol
bronze yoke
#

it doesn't use a box, but it uses the same concept - instead of a box you open, there's a single dummy cassette item that gets replaced with a random cassette when it spawns

tawdry solar
#

is there a guide on melee weapons btw

hot patrol
hot patrol
#

ah

#

if you don't mind can I send that to the person working on my idea?

bronze yoke
#

i used some similar code for the pony mod - i think lea added a bunch of sandbox stuff into it that complicates things that you might not want (and of course i haven't asked if they want their work to be offered like this)

hot patrol
#

I actually like a lot of the sandbox idea in there. they should consider making a lightwieght version without the music and only the spawning and settings

#

does it work with other addons?

bronze yoke
#

no, the cassettes are all written into a big table

#

you could probably grab them with the scriptmanager with some reliability though

#

maybe i should make that think

#

hmm, actually, i'd have to detect and remove the spawns from all other cassette mods... that'd be a pain

hot patrol
tawdry solar
#

does anyone know how to make a melee mod there are no guides on how

bronze yoke
#

yeah, the difficulty in making a standalone 'better cassette spawns' mod is you'd have to find a way to block the normal spawns, but if you're doing it for a specific set of mods that's very easy

hot patrol
#

well it's all beyond me but he says he can do it so I'm happy 🙂

#

but the sandbox settings and cassetts spawning on zeds is all very nice

winter thunder
tawdry solar
#

yes

#

a one handed ice pick

#

axe i mean

winter thunder
#
tawdry solar
#

thanks

winter thunder
#

Go to TIS Forums section, first link

coral lava
#

Where do we find the icons for items? I am struggling to find them

bronze yoke
#

they're in texture packs

winter thunder
#

you can un pack them

#

is there a specific item you need?

#

@coral lava

coral lava
#

Ohhh okay, and no. I just wanted to know how to design the path to add new ones

winter thunder
#

oh- you just put them into the media\textures file as pngs

#

if it is for an item it needs to be named Item_Example.png

#

and it is 32x32

tawdry solar
winter thunder
coral lava
#

Thank you!

tawdry solar
winter thunder
#

Look at the githubs at the bottom for the basic outlines of how

tawdry solar
#

i dont see i guide for blender to zomboid tho

#

i can only find clothing

#

not melee

#

i downloaded a framework for melee

winter thunder
# lapis glen yeah that was what i was thinking

Hey, forgot to message sooner. New Years and all- but some stuff here is probably a good place to start! Threw some extra links in there for you so there is a lil bit of everything

https://rentry.co/BluesModClues

faint jewel
#

anyone have a list of distributionTable["CarNormal"] for vehicles?

faint jewel
#

and now its rainy!

fluid current
#

eyy need some help

#

any reason this doesnt work?

#

i know nothing, just trying to mess with variables

#

originally it was this

ruby urchin
#

probably because data['spears'][spearIndex].condition is nil

fluid current
#

hmm thats shouldnt be the case tho

#

its being set to zero as its broken so it should have an original value

#

idk im extremely new so i really have no clue

faint jewel
#

anyone good at tuning vehicles?

mortal widget
winter thunder
# fluid current originally it was this

This is trying to pull a table too deep, to my understanding. You are pooling for
ModData.spears.spearIndex.condition

Which is multiple nested tables 😂

#

I am messing with a super similar functionality in my drug mod atm, if you wanna send me your code I can mess with it

fluid current
#

ooooh so its like almost a file directory in a sense

winter thunder
#

Yee

fluid current
#

just a weird way to type it lol

#

so @ruby urchin was probably right then

#

ill try to figure it out on my own but if i give up ill msg you

#

lol

ruby urchin
#

idk literally you gave a one line of code

winter thunder
#

Oh no worries haha

#

but yeah @fluid current I can give you some pointers on the table stuff, if you want. I am using something similar to store data on items / player to keep track of durations, effects, and all that

fluid current
#

i was really just trying to adjust a single value

#

see this is part of the Spear Traps mod

winter thunder
#

Oh! Word. So- Is the value listed in the mod data?

#

And- Do you initialize your mod data tables anywhere?

fluid current
#

no clue im fresh to this lol

#

honestly thinking that i really should have done the crash course on lua

#

heh

winter thunder
#

haha, I feel that. I am self taught over the last month

fluid current
#

only other mod ive made for this was based off a tutorial and that was for java not lua

#

so easy compared to this

#

honestly dont even know where to check for that

winter thunder
#

You wanna dm me your lua code? I will explain what I mean

fluid current
#

sure

sour island
#

Anyone familiar with the anticheats and how to avoid triggering them?

#

Not circumvent, just avoid getting people kicked from MP

fast galleon
#

I'd look at java to see what the specific one checks. The xp one was checking a hardcoded number I think.

#

IsoGameCharacter has this in update

               if ((double)this.lastXPGrowthRate > 1000.0D * SandboxOptions.instance.XpMultiplier.getValue() * ServerOptions.instance.AntiCheatProtectionType9ThresholdMultiplier.getValue()) {
#

so if you add less XP than that per update it should be ok

normal rose
#

is it hard to create mods?

fast galleon
#

@sour island
the anticheat14 seems to be about wrong player in packet

sour island
#

it's kind of critical to the new features I added - so that sucks

fast galleon
#

could this be a split screen issue? @sour island

sour island
#

people reporting it are on MP afaik

fast galleon
#
--self is the XP obj that AddXP is used on
        local pXP = player:getXp()
        if pXP ~= self then return end

--not important but 10 is hard set here :(
       --local maxLevelXP = perksType:getTotalXpForLevel(10)

--this seems like a bad idea, changing parameters
        if passHook==nil then passHook = true end
        if applyXPBoosts==nil then applyXPBoosts = true end
        if transmitMP==nil then transmitMP = false end

sour island
#

was that the issue?

fast galleon
#

I haven't tested anything, but the problem seems to be there

faint jewel
#

is @tame veldt here?

tame veldt
#

@faint jewel I'am herefluffyfoot_bunny

faint jewel
#

are you 10 years later dane?

tame veldt
#

sadly no, that's a different "Dane" in an alternate universe...

faint jewel
#

well damn

drifting ore
#

if im trying to add a custom action/recipe too a profession is this the right code for it

#

mechanics:getFreeRecipes():add("Salvage Vehicle Doors");

#

when i load up this mod it just freezes at the loading screen

fast galleon
#

this is base hook to the function

#

then you need something like
local burglar = ProfessionFactory.getProfession("burglar")

drifting ore
#

sweet ok ty!

fast galleon
#

considering more than one mods overwrite the function completely, you want your hook to apply later

drifting ore
#
BaseGameCharacterDetails.DoProfessions = function()

original_doprofessions(unemployed)
    unemployed:setDescription("14 free skill points");
#

would this be correct?

fast galleon
#

no...

drifting ore
#
BaseGameCharacterDetails.DoProfessions = function()
original_doprofessions()

local unemployed = ProfessionFactory.addProfession("unemployed", "unemployed", "", 14);

    unemployed:setDescription("14 free skill points");
``` how about this
ancient grail
fast galleon
#
local original_doprofessions = BaseGameCharacterDetails.DoProfessions
BaseGameCharacterDetails.DoProfessions = function(...)
  original_doprofessions(...)

  local unemployed = ProfessionFactory.getProfession("unemployed")
    unemployed:setDescription("14 free skill points");
end
#

hm, maybe this

drifting ore
#

oh ok. get not add

fast galleon
#

add would replace it

drifting ore
#

oh yea thats what i want

fast galleon
#

yeah, then just make a new one like vanilla does

merry quail
#

i am working on a medicine mod but my medicine dissapear when i used it (and it don't have remaining bar like others medicine) does anyone know how to fix it

drifting ore
#

thank you @fast galleon

merry quail
#

i need your help

fast galleon
merry quail
#

@fast galleon here

fast galleon
#

item PillsVitamins, uses type Drainable

#

not food

merry quail
#

can i use supervitamins?

fast galleon
#

what is that?

#

well if you did use same name , you would probably overwrite the base item

merry quail
#

i am not going to overwrite the base item, man

fast galleon
#

I never said to do that either

merry quail
#

can i edit the number of times this thing is applied? how

fast galleon
#

UseDelta = 0.1,
means it has 1 / 0.1 uses

merry quail
#

so if i want to use it 50 times it will be 0.02 right

fast galleon
#

yeah, you should test that

#

floats are weird

merry quail
#

thank you @fast galleon

merry quail
#

@fast galleon now i can't use it anymore

robust jetty
#

Lua programming in Roblox is the same as PZ ?, there is a lot of tutorials of Roblox

merry quail
#

my potion consumes itself when it needs it, it no longer affects my stats and its stats are completely gone

jagged ingot
#

Good morning.

#

If anyone wants me to take that particle emitter UI code and package it as an ISUIElement, let me know.

#

Has anyone made a solution with ISUI regarding texture masks?

#

I'd like to mask using a texture, not just a stencil.

#

Pretty much feels like UIElement needs to support blend modes at some point.

#

Actually, it looks like Texture might have what I need..

ancient grail
#

is it the same ?

#

i doubt .. nvm

fast galleon
#

@merry quail
yeah you seem to use some custom logic

merry quail
#

what do you meant

#

and how to fix it

pseudo ermine
#

any mods that add gear shifting and fuel consumption based on revvs?

jagged ingot
#

Saw some post on Reddit about a core mod for gear shifting.

frank elbow
pseudo ermine
#

core mod?

jagged ingot
#

You're more bare-bones with Lua here as the Lua environment for PZ is not genuine Lua, but an emulation as a JIT / JRE Lua Engine called Kahlua.

jagged ingot
pseudo ermine
#

uhhhh...

frank elbow
#

See what DeltaMango just said as well, significant detail (it won't usually matter, but sometimes when calling Java methods it leads to some weirdness)

jagged ingot
#

When you write something like a Typescript layer to PZ modding, you'll have so much fun with the advanced weirdness of Kahlua.

frank elbow
#

I can only imagine 😄

jagged ingot
#

I did manage to solve the load-order problem with the global dictionary module for it.

#

TypescriptToLua's compiled Lua created constants for imports so I wrote a footer code block to reassign them after PZ fully loaded the Lua code. 🙂

#

So yeah if you're not dealing with that stuff, PZ Lua should be 95% normal.

steady hedge
#

How do I make a custom spawn in project zomboid

slate sable
#

How do I make a mod that alters distribution tables/loot chance of specific items or removal of items spawning in containers from vanilla or modded items within the world of project zomboid, with clean code written for optimization.

gaunt cargo
#

In B41 Firearms mod, there’s a graphical error that happens when you try to place the M77 Hunting Rifle with an 4x or 4x-12x scope. When this weapon is placed on the ground, it appears as the Inventory icon instead of the world model that appears on the player.

How can I mod this to fix this issue?

drifting ore
#

where do i call an outside function in this code ```local original_doprofessions = BaseGameCharacterDetails.DoProfessions
BaseGameCharacterDetails.DoProfessions = function()
original_doprofessions()
end
Events.OnGameBoot.Remove(original_doprofessions)
Events.OnGameBoot.Add(BaseGameCharacterDetails.DoProfessions)

#
ProfessionFramework.addProfession = function()
    original_doprofessions()
end
Events.OnGameBoot.Remove(original_doprofessions)
Events.OnGameBoot.Add(ProfessionFramework.addProfession)
``` like this?
thick karma
#

Anyone know exactly what causes server to stop launching?

#

And how to fix it?

#

Simple hosting button just says Initializing and then a few seconds later falls back to the server selection screen, no errors, no explanation.

#

I just restarted PC and it's still doing it

#

This has happened occasionally but usually restarting game or PC resolves it...

#

The reason it occurs is not at all obvious to me but somewhere in the course of relaunching a server for testing, the game stops letting me relaunch servers. I tried commenting out new code in the only file I was editing but I don't think it's relevant. File is loading when I launch PZ with no errors...

fast galleon
#

@thick karma
Check logs when this happens

fast galleon
thick karma
drifting ore
winter thunder
# gaunt cargo In B41 Firearms mod, there’s a graphical error that happens when you try to plac...

This means it doesn’t have a world model assignment, which could be because of the attachment giving the gun something incorrectly. That should be fixable- but I’m not super familiar with the way gun attachments effect world models, if they do at all.

Do me a solid, check the code for the gun? It could be that the attachment is instancing a new item, which doesn’t have a world model description

dim hill
winter thunder
#

100%

#

It lets you scrap items and tools you loot, which respawn if you have that turned on. It makes a world of a difference. And the other sub mods connected to ‘the workshop’ add some cool uses for metalworkers as well

#

You just craft the workbench in game, and there are common magazines that will teach you the recipes to break down everything you need

dim hill
#

Thanks @winter thunder - does it give you metalwork XP?

winter thunder
#

Yes

dim hill
#

Thanks - appreciate you.

winter thunder
#

No worries! Those mods are hands down one of my favorite additions to PZ, I basically treat them like as mandatory when I play 😂

ruby urchin
#

.-.

LuaEventManager.triggerEvent("OnPreDistributionMerge");
LuaEventManager.triggerEvent("OnDistributionMerge");
LuaEventManager.triggerEvent("OnPostDistributionMerge");
gaunt cargo
#

How can I get an exact 1 month Water Shutoff? Is there a mod or is there a way I can code it so in exactly one month, water and power shut off?

gaunt cargo
terse locust
#

Could anyone explain what these two do? They both seem interesting but I'm confused their actual usages

viral notch
#

there is way to make it works on pz 41.78 ?

oldProcessSayMessage = processSayMessage;
processSayMessage = function(spokenMessage)
    if not spokenMessage then return end
    local trimmedMessage = luautils.trim(spokenMessage);
    if not trimmedMessage or #trimmedMessage == 0 then return end
    getPlayer():setLastSpokenLine(trimmedMessage);
    oldProcessSayMessage(trimmedMessage);
end
#

due after lattes update it stop works

lusty marsh
#

Does anyone know why my custom ui element isn't getting its render function called? it's a child of a visible panel and it's children do get rendered

viscid vapor
#

hey Guys, I am looking for some guidance. I want to get into modding PZ its such a fun game with crazy possibilities. I want to create a map of an old Hospital here in my hometown, for starters I'd just enjoying building the Hospital itself and maybe some outerlying buildings, but eventually I'd like to get into unique scripted events and items to turn the whole thing into a Custom Scenario. Where do I start with just creating the building itself and maybe some textures

#

I also have zero programming knowledge but this could be fun way to learn, and I plan on learn the LUA basics

thick karma
#

I really wish I knew what causes it to get in that state so I could reset it faster.

#

Will check logs next time.

terse locust
#

Anyone know of a mod to let you craft fireaxes

gaunt cargo
#

Anyone know a mod that shuts off water and electricity in one months time, or a way for me to create that setting?

thick karma
#

@gaunt cargo I don't know but they are settings in sandbox options... I am not sure about the units but I imagine the units are days.