#mod_development

1 messages · Page 219 of 1

thick karma
#

directClients in your DMs exists explicitly to simplify the process of forwarding the command, and make other code look almost the same outside of directClients on MP and SP

#

It will automatically know just on the basis of whether it was passed a player object or you are on SP how to forward the command

#

To make the normal client response fire

rancid panther
#

do you want to dm me to explain in more depth? i generally just dont add anything i dont understand so i can read it later and know why i did it

thick karma
#

We can keep discussing it here or DMs; I don't mind either way. The code is available for anyone to use.

rancid panther
#

ok

#

i just need it in simple terms because i dont know anything about coding language so some things get past me very easily

#

but i can try to repeat what you said, in my own words, and you can tell me what i am understanding or not understanding

thick karma
#

Go ahead.

#

Context for others in the convo already:

BlackoutsServer.directClients = function(module, command, packet, player)
    if not isClient() and not isServer() then
        triggerEvent("OnServerCommand", module, command, packet)        -- Singleplayer
    else
        if player then
            sendServerCommand(player, module, command, packet)        -- Multiplayer
        else
            sendServerCommand(module, command, packet)                -- Multiplayer
        end
    end
end
rancid panther
#

so using directClients, this lets me write the same commands for both single player and multiplayer, but also add any additional actions that might be necessary for only multiplayer or single player?

thick karma
#

Yes, basically. Let me try to say this simply...

#

As albion told you (and as the code in your DMs suggests), server needs to use sendServerCommand to tell players that a blackout has occurred.

#

But it doesn't work in SP

rancid panther
#

so will directClients also assume that if someone is logged off they will still have the server command sent to them when they log in?

thick karma
#

So instead of calling sendServerCommand in your serverside functions, you call directClients, and it decides whether it needs to call triggerEvent or a variation of sendServerCommand to make the clients receive the command

thick karma
rancid panther
#

ok

shy hearth
#

im learning so much

#

sincerely

thick karma
#

In YOUR case, I think it would make sense to determine whether blackouts occur in your server code and then call directClients to trigger the blackout.

#

Because (correct me if I'm wrong) nothing about a blackout trigger is affected by the actions of individual players, right?

#

It's just a random event?

#

Based on timing and chance?

rancid panther
#

yes, and some people have asked for ways for that chance to increase under certain conditions (but they are still based on chance)

thick karma
#

Serverwide conditions or individual client conditions?

#

I.e., a thunderstorm, or a player tripping on a powerline?

rancid panther
#

weather

#

and also affected by the game being closer to the shutoff date

thick karma
#

Right so it's still sounding like this doesn't need to be triggered from clientside at all

#

So if that is the case, you could likely avoid any use of sendClientCommand altogether. I might use EveryOneMinute to check and decide in your case.

rancid panther
#

yeah, i thought so too, but the command getWorld():setHydroPowerOn(false) appeared to only occur on the client side

#

unless it was just that i needed to have the prefix and everything else i did wasnt necessary

thick karma
#

When something in your code will not automatically update everyone, that is when you need to call directClients to send the command to everyone.

rancid panther
#

ok. so how do i call it?

#

or what is calling in the context of coding

#

(this also reveals how illiterate i am in terms of programming)

cosmic ermine
#

Is blacksmithing functional?

#

I mean is there blacksmith mechanics in the game currently?

rancid panther
#

the feature? no there is not blacksmithing in the game

thick karma
#

Instead of calling getWorld():setHydroPowerOn(false) on server, you call directClients("Blackouts", "triggerBlackout", {duration = 1200}, player)...

and then if player is nil it will be sent to everyone, OR if player IS a player, you can use this command as the response command for players who connect to request the current state of the blackout.

rancid panther
#

some mods enable it i think

thick karma
#

Obviously instead of 1200 you would use your default duration

#

And on request you could use the remaining time.

cosmic ermine
#

Oh, this Blacksmith/TimedActions is a work-in-progress then?

rancid panther
#

no i think it was scrapped but they will probably rework it in build 42 since they are adding new ways of crafting

cosmic ermine
#

I see, I'll remove it.

#

These all have functions right? They're all functional? The TimedActions.

thick karma
#

After calling directClients, the clients who receive the command can each call getWorld():setHydroPowerOn(false) to match server state. (I would imagine that calling setHydroPowerOn on server would automatically ensure that a newly connected client would see hydro power as off, but, if not, they use sendClientCommand to request the data when they join the game.)

cosmic ermine
#

Alright, these should be the supported ones.

#

Vehicles is finished. Now I have to work on the others.

thick karma
#

@rancid panther I would test getWorld():setHydroPowerOn on server AND forwarding it to clients first, and have someone connect

cosmic ermine
#

Camping is the stuff you can do with the campfire right?

thick karma
#

You may find that hydro power is off for new clients as long as you set that variable serverside

cosmic ermine
thick karma
#

But if that in fact is not how it works (I haven't read the Java closely enough to know), then you can do something like this as soon as server-client commands are available after a player connects:

    -- Requests missing locations; updateSound will handle them eventually.
    sendClientCommand(getPlayer(), "Blackouts", "request", {}) -- Any player on this client is fine.
#

This is the player-based version of sendClientCommand and if you forward player as I suggested in your server commands, then directClients will automatically use the version of sendServerCommand that just sends a message to that one player.

rancid panther
#

ok, that is currently how i have it, except not through direct clients.
will i basically just replace if isServer() then with directClients("TomaroBlackouts", "BlackoutsPowerShutoff", {duration = XXXXX}, player)
and instead of writing sendServerCommand here i create a BlackoutsServerFunctions.directClients function and send the command there?

thick karma
#

(Unless you're in SP, which is what it checks first, and in that case it just calls triggerEvent to imitate a server-to-client message.)

rancid panther
#

since im using a test file i can basically just write what i think you're suggesting and test it

#

but i just need to be sure if i understand where it is supposed to go

thick karma
#

I guess you could just track duration serverside and players don't need to know how much time is left in a blackout

#

On second thought maybe sending duration is not necessary

#

But yes

#

The entire if-then-else can become "directClients("TomaroBlackouts", "BlackoutsPowerShutoff", {})"

rancid panther
#

the duration is a minimum and then there is a random chance for it to come back (the same way that it triggers the blackout)

thick karma
#

(Although I had that in a module originally, so more specifically it would've been BlackoutsServer.directClients("TomaroBlackouts", "BlackoutsPowerShutoff", {}) in the code I sent to your DMs.)

thick karma
#

So only the server would need to know the remaining duration if you did it that way

#

(of course in SP you would still know because that file would still run in SP.)

#

I use if isClient() then return end at the beginning of my server file to ensure that it doesn't run in MP on clients, but if you're not in MP, isClient() will be false.

#

So it'll run in that case.

rancid panther
#

so if i call directClients("TomaroBlackouts", "BlackoutsPowerShutoff", {}) will i add a new function in the same BlackoutsServerFunctions.lua file? to then add the commands i want directClients to do? which is essentially either sendServerCommand or triggerEvent?

thick karma
#

(FYI, I have to work soon... I will try to clarify what I can before I go, I just wanted both you and @bronze yoke to be aware that a problem was being addressed that was already solved by code in your DMs.)

#

(I only work 8-11 this morning, so I'll be back in about 4 hours after I leave. Not sure whether you'll be up.)

rancid panther
#

ok, thank you. i just didn't understand it and was going to ask you if i saw you online

#

thanks for your help

thick karma
#

@rancid panther Never wait for me to be online

#

I am a ghost

#

I'm "not online" now

#

🤪

rancid panther
#

me too

#

i will play around with the stuff you sent me and then figure it out from there

thick karma
#

Just try me and if I'm free I'll reply immediately, and if I'm not I'll reply ASAP.

#

But also feel free to ping me here about code I send you in DM's

#

I sent you that code in DM's NOT to be private but to ensure you could easily find it

rancid panther
#

ok thanks. that makes sense

thick karma
#

Since public chats get flooded and pushed up by new conversations daily.

#

You are 100% welcome to repost it here and ask for help from the collective and ping me

rancid panther
#

ok! that will help a lot in the future

thick karma
#

❤️

rancid panther
#

because i wanted to ask for clarification, but it helps knowing that i can ask for clarification from anyone about something you were advising me about

#

good luck at work!

sage mantle
#

how would I edit this line to do damage to glass? I want to break all glass as well as kill all zombies in a zone:

if zombie then
zombie:Kill(playerObj)
isbreak = isbreak - 1

thick karma
#

I've never written a line of code albion wouldn't understand....

#

😭

thick karma
rancid panther
#

ty!

sage mantle
#

sorry this Would be the full loop

local zombie = square:getZombie()
if zombie then
zombie:Kill(playerObj)
isbreak = isbreak - 1

#

I just dont know what to substitute playerObj with

#

or if "Kill" would be correct

#

I tried this local glass = square:getObjects():find(IsoObjectType.glass)
if glass then
glass:applyProjectileDamage(100)
isbreak = isbreak - 1
end

#

with no luck

shy hearth
#

by 'break all glass' do you mean like, destroy all the windows?

sage mantle
#

yes

#

I want to add to this to break all windows in the area

for i = 3, 8 do
xxx = math.ceil(xxx + i * deltt[1])
yyy = math.ceil(yyy + i * deltt[2])
for xx = -1.5, 1.5 do
if isbreak <= 0 then
break
end
for yy = -1.5, 1.5 do
if isbreak <= 0 then
break
end
local square = getCell():getGridSquare(xxx + xx, yyy + yy, 0)
if ZombRand(10) <= 9 then
local zombie = square:getZombie()
if zombie then
zombie:Kill(playerObj)
isbreak = isbreak - 1

shy hearth
#

well you can probably get an IsoWindow from a square directly and use its Damage() function

#

rather than apply projectile damage

#

there's an IsoWindow class

sage mantle
#

okay so isowindow is the correct class?

shy hearth
#

i assume so, i've never used it

#

but it looks appropriate

sage mantle
#

then just use "damage()" as the function

shy hearth
#

also IsoCell has a getWindowList function, but i don't know if a cell is too large/small an area for your case

shy hearth
sage mantle
#

alright thanks I'll give that a shot after work

shy hearth
#

actually no, i'd probably use smashWindow() instead of damage

sage mantle
#

See I tried that with no luck though

#

I didn't know about this site though which is great because I was just kind of guessing on the class names lol

#

Oh I think I used "isoglass" as the name though okay

#

So;
Local window = square:getObjects():find(isotype.window)
If window:smashwindow()
Isbreak = isbreak-1

?

#

Also do you know of a function to call for delaying a loop? I'm currently using "zombrand" but that obviously being a random counter causes a not uniform delay. I'm looking for a function that I can call to add a set delay to a loop

thick karma
#

Depends on context but if you want that loop to fire periodically I would use modulo arithmetic to loop a delay variable, and when the delay variable gets back to 0/1 (the beginning of the loop), you fire the rest of the function you wanted to delay

chrome egret
#

On a personal note, propane and dual-fuel generator functionality seems to be working in my new mod ^_^

shy hearth
#

you must be the most patient person alive

shy hearth
#

As in, pretend you're commissioning the mod, describe exactly what it is you want this part of the mod to do

sage mantle
#

And I'm using the the zombrand in this case to give a 90% hit rate in that area to give it a lil unpredictability

#

But in the turret spin section I want to add delay to the loop so I can adjust the turret spin rate

#

The area right now is 3 -1.5,1.5 from center

#

By 50 units long

shy hearth
#

I see, so when you fire the MG the script should get a cone going out from the gun and shatter windows within that cone?

sage mantle
#

Yup and kill zombies

#

The kill zombies part works

shy hearth
#

So you're able to select the cone alright then?

#

It's just the windows that are an issue

sage mantle
#

Yeah the cone and damage area and turret spin all works properly

#

I just have to add the other damage type and class below the zombie damage section

shy hearth
#

i would go through your selected grid squares and do something like

#

local window = square:getWindow()
if(window ~= null) then
window:smashWindow()
end

#

i'm sure that has issues

#

but that's the hacky version i'd begin with

sage mantle
shy hearth
sage mantle
#

Will do thanks

shy hearth
#

actually extremely cool lmao

#

good god man you did this without any documentation

#

kudos

sage mantle
#

Yeah nada just referencing other lines of code I found in mods

shy hearth
#

actually the most patient person alive lmao

#

browse that javadoc at work i'm begging you

sage mantle
#

Oh I plan to lol

rancid panther
sage mantle
#

I just got the game a few weeks ago so Idk much about it tbh

shy hearth
#

you're killing me davo

sage mantle
#

I gotta find a or make a function for fuel consumption as well. In order to balance the tank I want to
1: make it non towable
2: very high fuel consumption
3: high ammo consumption

#

4: extremely loud (attract allot of zombies)

#

Towing, ammo, and noisy is done just need to make fuel consumption higher

thick karma
shy hearth
cosmic ermine
shy hearth
#

i have tears in my eyes

#

i'm not sure if it's pride or despair

cosmic ermine
#

This much experience has to come from somewhere.

sage mantle
#

Yes I've done most of it just in the base vehicle script

#

I just am not sure how the fuel consumption function works in PZ if there's like a multiplier or something I can use

#

I make some mods for a few other games

shy hearth
#

zomboid attracts some fairly unique characters i gotta say

#

one of the people that asked for a feature on my mod drew my eye so i checked his profile

#

look at this absolute chad

#

plays exclusively zomboid and unreal 2004

#

who is this guy

thick karma
#

Basically you need this on "Blackouts/Client.lua" or some equivalent:

local BlackoutsMainModule = require("The-Source-File-That-Returns-The-Main-Module") or {}

BlackoutsMainModule.triggerBlackout = function(packet)
    -- the actual stuff that triggers the blackout
end

local BlackoutsClient = {}

BlackoutsClient.triggerBlackout = function(packet)
    BlackoutsMainModule.triggerBlackout(packet)
end

BlackoutsClient.processServerCommand = function(module, command, packet)
    if not (module == "Blackouts" and BlackoutsClient[command]) then return end
    BlackoutsClient[command](packet)
end

Events.OnServerCommand.Add(BlackoutsClient.processServerCommand)

return BlackoutsClient
#

The line that says BlackoutsClient[command] literally points to a function... If command is "triggerBlackouts" it would call "BlackoutsClient.triggerBlackouts"

sage mantle
#

I used to do edits for dead island way back lol

thick karma
#

Will explain more later

rancid panther
#

ok, thanks.
so that function just processes the command, but the actual function is done under the triggerBlackout function

thick karma
rancid panther
#

and it also means i can process multiple commands without manually rewriting them because [command] is like an autofill of whatever was sent from the server?

#

at least under the processServerCommand function

thick karma
rancid panther
#

nice! thanks

thick karma
#

Assuming they are of the form BlackoutsClient.commandName(packet, player) as in my example

#

Or a corresponding refactor

rancid panther
#

so at the top you have a separate local BlackoutsMainModule = require("The-Source-File-That-Returns-The-Main-Module") or {} from local BlackoutsClient = {}

this is within the same file?

thick karma
#

That's meant to refer to a theoretical main module you would have already

#

I imagine your program has a module for containing other functions it needs

#

i only imported it and wrote example function to show you what calling it could look like

rancid panther
#

oh okay so that would be what i originally called BlackoutEventHandler?

thick karma
#

That part could be anything

#

I do not know exactly what your BlackoutEventHandler does, but a client command could call whatever function in whatever module you want

#

After you get to the step of calling BlackoutsClient.commandYouReceived(packet, player), then inside of commandYouReceived you could call "BlackoutEventHandler.whatever()"

#

Just gotta make sure you import it if it's not global

rancid panther
#

because i originally had BlackoutMainFunctions (which handled the conditions to trigger the blackout), and BlackoutEventHandler (which did the actual blackout stuff)

so BlackoutClientFunctions would be a third file that processes the commands? and then calls the blackout event(s)

thick karma
#

Yes

#

I use my mod name as a folder name ever since liking how co` does that

#

So in TMJ we have Jukebox/Utility.lua, Jukebox/Client.lua, and Jukebox/Server.lua

#

Each of which has its own part of the job here.

rancid panther
#

i always kept the folder names to what they are by default because i thought they had to be an exact way

thick karma
#

But yes you could have BlackoutMainFunctions.lua, BlackoutClientFunctions.lua, BlackoutServerFunctions.lua

thick karma
#

They need to be in lua/client (or shared or server) to run, but not at the root level

rancid panther
#

okay, i see

thick karma
#

(Further mod-specific) organization is allowed

#

But not required

west veldt
#

Sorry, can someone publish the melee weapons categories types for Script?
I know that exists "Axe"(for axes) "Blunt" (for long blunt weapons) "Spear" ...
BUT what category i have to use for Short blunt weapon?

cosmic ermine
#

What is MultiStageBuild? Is that the building the structure first before actually building the wall?

sage mantle
#

What's cool too is since I already have all the vectors calculations down I think I'm gonna add a sprite and the tank muzzle and mg muzzle as well in order to get muzzle flashes

#

And people can use it as a template for other vehicles because I prefixed all my class names and functions

coarse sinew
cosmic ermine
#

So the frame is ISBuildAction and then the others are ISMultiStageBuild, I see.

sage mantle
#

But want to replace the zombrand with a more predictable delay

thick karma
sage mantle
#

Yeah I'm almost back I'll send what I mean

thick karma
sage mantle
#

okay its a long one so bare with me

rancid panther
sage mantle
#

---------------------------------坦克头转速 --rotations

if tankround[2] == tankround[1] and ZombRand(2)<=1 and ZombRand(2)<=1 then -- also turret speed helper
tankround[2] = tankround[1] + 1 -- this effects the turret speed 1 = faster

if vehicle:getModData().tankround == nil then
    vehicle:getModData().tankround = 1
    M60A1Turret.Create.M60A1Turret(vehicle, 0)
end

if isKeyDown(Keyboard.KEY_RIGHT) or isKeyDown(Keyboard.KEY_LEFT) then
    if not vehicle:getEmitter():isPlaying("M60A1spin") then
        vehicle:getEmitter():playSound("M60A1spin")
    end
else
    vehicle:getEmitter():stopSoundByName("M60A1spin")
end
#

if isKeyDown(Keyboard.KEY_RIGHT) then
part = vehicle:getPartById("M60A1Turret")

    if vehicle:getModData().tankround == 360 then
        part:setModelVisible("M60A1Turret360", false)
        part:setModelVisible("M60A1Turret1", true)

        vehicle:getModData().tankround = 1
    else
        local number = vehicle:getModData().tankround + 1
        part:setModelVisible("M60A1Turret"..tostring(vehicle:getModData().tankround), false)
        part:setModelVisible("M60A1Turret"..tostring(number), true)

        vehicle:getModData().tankround = number
    end
    vehicle:update()
end
#

if isKeyDown(Keyboard.KEY_LEFT) then
part = vehicle:getPartById("M60A1Turret")
if vehicle:getModData().tankround == 1 then
part:setModelVisible("M60A1Turret1", false)
part:setModelVisible("M60A1Turret360", true)

        vehicle:getModData().tankround = 360
    else
        local number = vehicle:getModData().tankround - 1
        part:setModelVisible("M60A1Turret"..tostring(vehicle:getModData().tankround), false)
        part:setModelVisible("M60A1Turret"..tostring(number), true)

        vehicle:getModData().tankround = number
    end
    vehicle:update()
end

else
tankround[2] = tankround[2] - 1
if tankround[2] == 0 then
tankround[2] = tankround[1]
end
end

thick karma
sage mantle
#

I'm not original author FYI I'm just editing it

thick karma
#

In my example it would've had to be BlackoutsServer.directClients

rancid panther
#

ok actually i got it working in single player now, but it was just cuz i skipped that line for now

sage mantle
#

yeah

#

I've tried adjusting the loops but can get it tweaked quite right

#

so I added that zombrand delay but if I change it to try to get more delay its not a uniform delay

rancid panther
sage mantle
#

so wanna replace that with a more uniform delay function, I think Ill look into that lua delay api

thick karma
#

So this is not modulo looping... I'm saying you use a counting variable and modulo arithmetic to make it loop, and only fire when the variable hits a certain number. How often do you want the rest of your tick code to go off? Evwry 3rd tick? Every 5th tick? Every 10th tick?

rancid panther
#

for now, i just added back the if isServer() and added an else for single player to trigger, but from what you told me, i assume it is supposed to work for single player already, right?

sage mantle
#

see tankround is also used to determine the angle in follow on code

thick karma
#

If you change its declaration you need to change how you call it

#

Show me your declaration of directClients @rancid panther

rancid panther
#

i dont have one, that was what i was confused about

#

is that its own function that is called by that line there?

thick karma
#

@sage mantle ```lua
DavoModule = {}

DavoModule.tickCounter = 0

DavoModule.onTickFunction = function()

 DavoModule.tickCounter = (DavoModule.tickCounter + 1) % 10

 if DavoModule.tickCounter != 0 then return end

 doEverythingElse()

end

#

This is modulo looping

#

It would let you call doEverythingElse every 10th tick

#

Consistently

#

Not randomly on 10% of ticks

#

Above code assumed you add the onTickFunction to the OnTick event

sage mantle
#

Ill add that in

thick karma
#

% is modulo operator; it gives the remainder of a division problem

#

Division remainders loop around in circles based on size of the divisor

#

If you mod an endless series of consecutive integers by the same divisor, it eventually goes back to 0 when the dividend is evenly divisible by the divisor again.

cosmic ermine
#

I like this icon. What do you guys think?

rancid panther
#

the visual fits into that of the base game. is that an hourglass?

cosmic ermine
#

Yes.

thick karma
rancid panther
#

i just did that for now because i didnt do it properly and thus it didnt work

#

i just made it manually trigger the event again, but im still trying to understand everything else you gave me

#

what is this for? in the example you dmed me

BlackoutsServer.triggerBlackout = function(packet, player)
    BlackoutsServer.directClients("Blackouts", "triggerBlackout", packet, player)
end
thick karma
#

The idea of the triggerBlackout function is to receive command to trigger blackout clientside

#

And then call your clientside blackout function

#

@rancid panther Will you be around in 1.5 hours? Should be home, can walk you through this part on a call

#

Quicker than typing about it anyway

rancid panther
#

no, it's actually 7 am and i have not slept

sage mantle
#

hey hey

thick karma
#

I gotta work another hour and will be distracted until done but will reply asap @sage mantle @rancid panther

sage mantle
#

thanks guys you rock

rancid panther
#

ok thanks. i'll let you know if i have any more questions but i'll be working with what i have until then

#

if i can't figure it out i'll just have to pause it until next time i can get a chance to work on it

sage mantle
cosmic ermine
#

@sage mantle You from Mainland China?

sage mantle
#

no no the original author is

#

The code is from "The Tiger Tank" mod. He lets others use and edit his code

#

I am just modifying it to add in some features

cosmic ermine
#

Also, next time use code blocks

-- This one

```lang

  • your code
    ```
#

Should I allow? I feel like it's gonna be really annoying.

sage mantle
cosmic ermine
sage mantle
#

fore sure

gloomy lance
#

Hello, anyone knows who can make custom furry surivor model?

cosmic ermine
#

I'm gonna take a rest from coding now, I can finally start working on the other traits tomorrow 😄

cosmic ermine
gloomy lance
#

oh! and how many traits are you making

cosmic ermine
#

I have 16 planned with 1 finished.

gloomy lance
#

I see hope it goes well!

cosmic ermine
#

Me too. That single trait took 2 and a half days to complete ded

#

Not really, that's just because I have work and only a few hours to work on it when I get home.

gloomy lance
#

I know how to help you

#

take some code from other places and thats it

cosmic ermine
#

You can't even read some people's code lmao

gloomy lance
#

yandere sim kind of stuff?

rancid panther
#

@thick karma from this example, if my trigger blackout and end blackout function are now combined under OnServerCommand, how should the content of this function be written?

BlackoutsClient.triggerBlackout = function(packet)
    BlackoutsMainModule.triggerBlackout(packet)
end

[whole example for context for readers]

local BlackoutsClient = {}

BlackoutsClient.triggerBlackout = function(packet)
    BlackoutsMainModule.triggerBlackout(packet)
end

BlackoutsClient.processServerCommand = function(module, command, packet)
    if not (module == "Blackouts" and BlackoutsClient[command]) then return end
    BlackoutsClient[command](packet)
end

Events.OnServerCommand.Add(BlackoutsClient.processServerCommand)

return BlackoutsClient
#

i got it so using BlackoutServerFunctions.directClients works, but now it goes to the client file in single player. it should go straight to trigger the event right?

#

right now, my blackout function looks like this

local OnServerCommand = function(module, command, args)
    local playersquare = getPlayer():getSquare()

    if module ~= "TomaroBlackouts" then return end
    if command == "BlackoutsPowerShutoff" then

        if not playersquare:isOutside() then
            getSoundManager():PlayWorldSound("PowerShutoff", getPlayer():getSquare(), 1, 0, 0, false)
        elseif playersquare:isOutside() then
            local square = getNearestBuilding()
            getSoundManager():PlayWorldSound("PowerShutoff", square, 1, 0, 0, false)
        end

        print("blackout starting...") --!! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        timer:Simple(0.9, function()
            getWorld():setHydroPowerOn(false) --?? turns off the power
        end)

    elseif command == "BlackoutsPowerStartup" then

        if not playersquare:isOutside() then
            getSoundManager():PlayWorldSound("PowerStartup", getPlayer():getSquare(), 1, 0, 0, false)
        elseif playersquare:isOutside() then
            local square = getNearestBuilding()
            getSoundManager():PlayWorldSound("PowerStartup", square, 1, 0, 0, false)
        end
        
        print("blackout ending...") --!! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        timer:Simple(0.8, function()
            getWorld():setHydroPowerOn(true) --?? turns on the power
        end)

    end
end

Events.OnServerCommand.Add(OnServerCommand)
#

im gonna call it a day here and figure it out later

#

goodnight

digital osprey
#

hello hello, could anyone tell me which IS action do i need to use to equip stuff to the player?

#

oh hey spiffo lol

bright fog
#

Check out the list of methods you can apply to a player probably

chrome egret
#

Yo @digital osprey I would recommend pulling up the vanilla code in an editor so you can easily search it

digital osprey
#

yeah i did ISequippeditem doesnt look like it does what i need

digital osprey
bright fog
#

yeah

digital osprey
#

setequippedparent is not it either right? ah no wrong page altogether

bright fog
#

I have no idea

thick karma
rancid panther
#

thanks! i dont know the next time i'll really be able to work on it, but i'll just ask questions as they come from now on

digital osprey
#

ah its in IsoGameCharacter not in isoplayer

bright fog
digital osprey
#

yeah was looking for something with equip but it turns out to be called gethanditem

queen oasis
digital osprey
#

and those are instant right?

#

or do they trigger a timed action

queen oasis
#

I've never used it, my gut tells me it's timed

digital osprey
#

that would be ideal, let me test

chrome egret
#

You would be well-served to look at ISInventoryPaneContextMenu and see how many different types of equip actions there are

#
local option = context:addOption(getText("ContextMenu_Equip_on_your_Back"), items, ISInventoryPaneContextMenu.onWearItems, player);
-- ...
elseif twoHandsItem and not playerObj:isItemInBothHands(twoHandsItem) then
    context:addOption(getText("ContextMenu_Equip_Two_Hands"), items, ISInventoryPaneContextMenu.OnTwoHandsEquip, player);
elseif force2Hands and not playerObj:isItemInBothHands(force2Hands) then
    context:addOption(getText("ContextMenu_Equip_Two_Hands"), items, ISInventoryPaneContextMenu.OnTwoHandsEquip, player);
end
-- ...
context:addOption(getText("ContextMenu_Equip_Primary"), items, ISInventoryPaneContextMenu.OnPrimaryWeapon, player);
-- ...
context:addOption(getText("ContextMenu_Equip_Secondary"), items, ISInventoryPaneContextMenu.OnSecondWeapon, player);
digital osprey
chrome egret
#

You're welcome!

digital osprey
#

nice one! gonna jump back in, not far from the finish line 🙂

bright fog
#

Is it possible to make hairs that can't be used by players ?

past coyote
#

I think only the last piece of my model is rendering what would cause this?

thick karma
#

The event triggered is the OnServerCommand event.

#

So it calls processServerCommand exactly as though you wrote sendServerCommand in MP.

sage mantle
thick karma
#

Uhhhh "javascript"?

#

No idea where that came from

sage mantle
#

lol my bad

thick karma
#

Yeah that's right. You could also consider using a local module and returning it, separately. You could put this in its own file and return M60A1Timer at end of file. Also would need to say local M60A1Timer = {} instead.

#

You would need to add M60A1Timer to OnTick as well

#

Events.OnTick.Add(etc)

#

Don't try to do "too much" on tick though

#

OnTick happens 30-120 times a second for most players afaik, which is quite often, so you don't want to do anything processor-intensive or memory-intensive routinely on tick.

thick karma
#

E.g. I wouldn't recommend a loop that checks 50-100 things on a single tick. Not ideal.

#

If you want to capture key events, use OnKeyPressed

sage mantle
#

okay I'll it as a local I think I was missing the events.ontick

thick karma
#

Events.OnKeyPressed.Add(yourFunction) is usually more appropriate for key-triggered events.

sage mantle
#

should M60A1Timer.onTickFunction = function() be a local function then?

thick karma
#

Everything in a local module is local

#

You don't need local throughout your code if every function / field is in a local module

#

If M60A1Timer is local, so is that onTickFunction

sage mantle
#

ok just making sure

thick karma
#

Also, fwiw... I give my functions descriptive names because I was taught to do that in school and it seemed like a good idea when I heard it.

#

So onTickFunction is purely what I wrote as an example

#

If I were writing a real OnTick function, I would name it something relevant to what I'm actually doing on that tick.

#

The fact that I'm adding it to Events.OnTick should be sufficient for any experienced programmer to know it's an OnTick function.

sage mantle
#

yeah I'm just leaving it as is to mess with it

thick karma
#

Fair, just throwing that out there.

#

I see a lot of new modders make their event function names simply "OnEventName" or something else similarly void of additional meaning

#

If you're going to name a function "OnEventName" and immediately add it to said event, you might just as well have called your function "z"

#

Because Events.OnTick.Add(z) and Events.OnTick.Add(onTickFunction) provide you with precisely the same amount of information.

sage mantle
#

Yeah Im just seeing if it works first

thick karma
#

(But I also wouldn't name a function z 🤪; I believe words help)

sage mantle
#

lol things are happening but not as expected lol gonna keep messing with it

thick karma
#

lol word

#

Good luck!

sage mantle
#

I mean the fact its completing anything is good lol

past coyote
#

anyone know why this is showing up and my weapon isnt showing up?

mellow frigate
#

if it is not too late, you can try playing with setAlphaMax(float float1) setAlpha(float float1) setAlphaMin(float float1) ..

west veldt
past coyote
west veldt
#

i always use .x

past coyote
hollow current
nova socket
#

I was today years old when I got to know that controller players have some different method of context.
Can anyone elaborate, because I need to know how what to use to fill controller world context menu.

west veldt
past coyote
past coyote
#

I need help apparently the only way to fix models doing this is to redo the models someone please tell me there is a better way?

thick karma
past coyote
thick karma
#

Ahh.... Yeah probably no better way. That does not seem to have the right shape at all

past coyote
#

the model is still fine just ingame it looks like that

thick karma
#

I.e. I can't imagine fixing it from code or in scripts

#

Yes but when models are exported wrong they can be incompatible with the game

past coyote
#

apparently this is common but I cant find anything on it

thick karma
#

When I first exported my Meditation animation it made my character look like he turned inside out and immediately died in a gruesome fashion

past coyote
thick karma
#

He was healthy, of course, that's just how the animation looked

thick karma
past coyote
#

im about to test it out with one of my other models

thick karma
#

And figuring out how it got exported wrong is going to be the solution to the puzzle.

#

If something has the wrong size, change its item def in scripts to be smaller

past coyote
#

could it be that I made the model smaller instead of coding it smaller?

thick karma
#

But if something is entirely misshapen, it's exported wrong.

past coyote
#

update with the new model IDK

thick karma
#

I only know a small number of facts here from the one animation I exported...but if you don't have exactly the right values in exactly the right places and exactly the right boxes checked, your stuff will look super borked in game

past coyote
thick karma
#

I would refer to a known-to-work guide. In my case I ended up pinging the poor author of the guide and showing him my settings screen only for him to immediately spot the flag I had missed

#

I had looked at it many times for hours but had looked at it wrong because I was too sure that I had followed every step

#

I would go back and apply more self-doubt and reread the steps and screenshots of a working guide much slower

past coyote
thick karma
#

Those are the model people

#

Most people here are Lua people

#

And scripting people

#

Programming people

past coyote
#

yea fair enough

#

might have found what is wrong though

thick karma
#

Oh nice good luck

#

Hope you did

past coyote
#

thanks

#

ill be back when I somehow make it worse

past coyote
#

might check that out yea

placid plinth
#

a building that is in world ed

#

is not there when i right click and open in tileZed

#

am i missing something?

slow graniteBOT
#
surethingwhateveryousay has been warned

Reason: Bad word usage

tardy stone
#

Does anyone have any idea how I could add more skin-tone options? I managed to get an extra option in the UI, however, that's as far as I've managed to get with this as it won't change the skin tone, despite having made the new textures, and them being in the correct folders and all. https://i.gyazo.com/dffad45aef321f8f557ab0f7877abe4f.gif

Nothing comes up when searched online, and I've spent the past 3 hours looking through text files, but I cannot find anything that could even be related to existing skin texture files.

past coyote
#

Anyone know if its possible to make repairs for a specific weapon not get worse everytime you do the repair?

#

Like being repaired for less than it was previously

full crane
#

hay yall im making my own custom skin for pz and i dont know how to add the skin into the game. Are there any tutorials i can follow to learn this ?

past coyote
#

alright I got the repairs to not degrade the amount they repair but the chance still goes down is there a way to stop that or make it so hight that it doesn't matter if it goes down

past coyote
#

I found a way all good

grizzled needle
#

Hi!

#

Ok

#

so

#

I just fixed up Buffy's RP chat

#

I fixed shortCommand so it actually reads as a table now, so you can use multiple aliases

#

In the OG code, you'd have a line like
ISChat.allChatStreams[11] = {name = "melow", command = "/melow ", shortCommand = {"/ml ", "/emotelow "}, tabID = 1};
However, /emotelow would not work in game

#

Now, it does

#

So, I had fun with this, and added more aliases for various commands, like local out-of-character chat now has the follow aliases

#

ISChat.allChatStreams[14] = {name = "looc", command = "/looc ", shortCommand = {"/l ", "/ooc", "/b "}, tabID = 1};

#

/b is a popular OOC channel in various other RP games, and I added /ooc just to cut out the L, which many people don't know intuitively

#

(the original /ooc was actually listed in /all alias, but since it was listed as a 2nd it straight up did not work)

#

BUT!

#

I did more

#

I also made them case-insensitive

#

So now, you can /YELL ALL CAPS RAGE

#

and it wont throw a /YELL is an unknown command error

#

SO! Here is my question

#

I have uploaded the mod here

#

Its just an edit of Buffy's, which PZRP has done as well

#

Is this.... legal? Ok?

#

Would I get in trouble for doing this?

bronze yoke
#

does the mod come with a license/does the description give any permissions?

#

if not, yeah, this is copyright infringement, and you could get in trouble for it, basically based on how much the original author cares

grizzled needle
#

I'm an idiot

#

I should have checked the steam page for the OG mod!

#

Ok, so all I need to do is fork it on git

#

To be extra, I'm also going to suggest my changes, since they're basically fixes

#

and done

#

B)

open drum
#

making outfits or hairs function well with your new char model, however, a whole diff. story

trail lotus
#

I was thinking about making pool tables usable, basically two players would be able to play each other it would essentially work by timing a “shot meter” properly and the closer you are to timing it correctly improves your chances of making the shot. I’d like to commission it so if anyone thinks something like that is possible or they wanna work on something like that let me know I’ll definitely pay for it to be made either @ me or dm me either one.

cosmic ermine
#

I'll try and add documentation to everything by myself from now on whenever I get a chance.

#

If we get time, can we start a project where we try to document each function?

#

It'll take a ton of time for sure, but it'll help future and current modders a lot.

#

I mean, just a single line of comment can already explain what a function does pretty clearly.

nocturne swift
#

Hi, I need to get the coordinates of a vehicle knowing its sqlid (server), the vehicle can be in an unloaded chunk, is this possible? I couldn't find any suitable methods
getVehicleById() <- return only vehicle with local id, if I get you right

sage mantle
#

Anyone know how to set a radio to spawn to a specific broadcast? I have a vehicle set to spawn the ham and would like it to also be set to use the emergency broadcast channel

bright fog
#

There's no comments on what functions do

#

But there is every variables used and what it returns (type)

#

So you would probably want to add your documentation to that since it has a great base to it

cosmic ermine
#

Exactly, function names are just not enough.

cosmic ermine
bright fog
#

Add your documentation to it ?

cosmic ermine
bright fog
#

Then propose a fork of Umbrela or an official add to it

#

👌

cosmic ermine
#

Yes, but that'll be for a later project 😄

bright fog
#

I mean if you already end up having comments for all of these, posting it would take 2 clicks

cosmic ermine
#

I'm not an artist but I do hope they look like the vanilla ones.

bright fog
#

They look good

slow graniteBOT
#
cannasah has been warned

Reason: Bad word usage

digital osprey
#

good afternoon! how would i get the floor container around the player? tried this but it reports 0

        local square = player:getSquare();
    print("square :", square);
    local ground = square:getFloor();
    print("ground: ", ground);
    local ground_cont = ground:getContainerCount();
    print("container count: ", ground_cont);
bright fog
#

Probably get the list of items on the tile then go through them and get containers

#

Unless you are talking about a tile

digital osprey
#

oh sounds like a plan

#

no no just accessible for the player to pick up

bright fog
digital osprey
#

nice one!

prime kindle
#

Hey all! I'm working on a mod for the radio, voice acting, etc. all that fun stuff to make a lil bit of a story. But I'm brand new to this stuff, at least to modding in this; would someone be so kind as to point me in the relevent direction to making a specific radio mod? Or at least one with various stations etc.?

I've seen a few things about maps, models, etc. but not much about radios

mellow frigate
#

Autoloot.lua

digital osprey
#

ohh its called from the player object itself.. thanks was overthinking it 😄

cosmic ermine
#

How many tiles can you check the adjacent of on the player?

#

Is there a way to check if a tile is a water source?

digital osprey
#

there is an isshore method

full crane
# bright fog oh god

Please take your unfunny comments back to forchan. I do not appreciate it im a new modder and didnt think this was a troll chat to bully new creators.

full crane
bright fog
#

The fact it's detailed but blury gives it this cursed aspect like those old games. I can show you examples of faces with more details that don't look blury. If you want to improve it I would say that's the part that needs improving on the model

#

Take that for example

#

If you want to improve it at least

gloomy lance
#

anyone knows who can make special furry models for people?

open drum
lunar goblet
bright fog
#

You could check those out

prime kindle
#

Thanks very much ❤️ I'll do some digging through them!

prime kindle
#

(it's also moreso me just trying to learn how to as well haha)

#

As my eyes glaze over looking at numbers and code, tryna self teach haha

reef apex
#

how do i make a mod that puts ambient light to zero?

rancid panther
#

u might wanna ask someone like Azakaela or Jango (the owners of the 2 major perma night mods)

there r probably a lot of others who know something about it here but those two come to mind

bronze yoke
reef apex
mellow frigate
wraith siren
#

Any spreadsheets updated for arsenal or britas

#

Pls @ me

rancid panther
cosmic ermine
bronze yoke
#

yeah, my module is the least important one but it got the project started

idle idol
#

Is there a .lua file that can move the watch widget to the middle? I tried to modify the Clock.class file, but I realized it was not possible.

mellow frigate
idle idol
mellow frigate
idle idol
nimble yarrow
#

in lua, can I return a function that returns a value?

or alternatively, should I first call that function, saved as a local, then return that local, which now has the varaible inside?

#

or perhaps they both work, and its just down to a style guide, readability, preference, etc. ?

bronze yoke
#

they both work

#

returning functions can be really handy, a lot of my recent code has relied on that pattern, but for most cases it's probably overcomplicating things

nimble yarrow
#

Do you see anything wrong here? My table is nil, I'm copying the work I did 4 days ago, but not working
from LowQualityZombieClothing.lua

local ClothingCruncher = require ("ClothingCruncher")
print("ClothingCruncher should be a table... " .. type(ClothingCruncher)) --prints nil

From ClothingCruncher.lua

local ClothingCruncher = {}

function ClothingCruncher.MyFunction()
end

return ClothingCruncher
bronze yoke
#

where is ClothingCruncher and where is the file requiring it?

nimble yarrow
#

LowQualityZombieClothing.lua requires it. they are in the same directory

bronze yoke
#

what is that directory? requires start from the client/shared/server folder

#

e.g. if your file is shared/MyMod/ClothingCruncher.lua you need to require MyMod/ClothingCruncher even if you're in the same directory

nimble yarrow
#

Can I move files around and rename files? Or will that cause problems for subscribers?
I see a lot of empty lua files in popular mods

bronze yoke
#

it causes problems yeah

nimble yarrow
#

ok, ill just fix my requires path

bronze yoke
#

steam only updates changed files and adds new files, it doesn't remove old ones, so if you remove a file that has been on the workshop steam just leaves it and there's a checksum inconsistency between people who subscribed before/after that file was removed, and probably a bunch of old code running that you don't want

nimble yarrow
#

and last question, 4 days ago, you helped me as I finally swapped over to using modules.

but they were written as...
JournalReminder = {}
PlayerTimer = {}

and I think you replied, there is no point, they are still global.

So, they need to have local written, as I just posted above, correct?

bronze yoke
#

yeah

#

if you're using vscode, if you change the setting Lua.runtime.path to```
"shared/?.lua",
"client/?.lua",
"server/?.lua"

nimble yarrow
#

I'm still in notepad++
...but if i ever saw a demiurgeQuantified tutorial on...

intelliJ
EmmyLua
candle
asledgehammer
Umbrella
PipeWrench
PZStudio
ZedScript

Just don't know here to start, and I'd rather not spend 2 hours asking for help step by step.

bronze yoke
#

i've PRed the lua plugin for an addon that will change a bunch of settings automatically to suit pz (and it'll even install umbrella automatically) but it hasn't been picked up yet

#

at that point setting up vscode for pz will be very easy

#

maybe i'll write up a tutorial for setting up vscode soon! i just remembered i wrote 90% of a modules tutorial and forgot about it 😅

#

i used to be a bit of an intellij loyalist but tragically vscode just supports lua much better

cosmic ermine
#

Good to know.

rancid panther
bronze yoke
#

yeah, it's generally good practice to leave a comment saying why but it doesn't really matter

rancid panther
#

so for mine i renamed them from BlackoutEventHandler to BlackoutsEventHandler and BlackoutMainFunctions to BlackoutsServerFunctions to make the naming conventions all consistent everywhere in my mod. would i just put a comment saying something like
--this file is intentionally left blank. see BlackoutsEventHandler.lua?

bronze yoke
#

yeah, as long as it mentions it's on purpose i think it's fine

#

i have a habit of rewriting my mods as i get unhappy with my old structure as i get better, so a lot of my mods have a *lot* of empty files 😅

rancid panther
#

lol

#

if only i knew all this BEFORE moving to a new workshop mod

#

then i could have uploaded the new version with better features, more optimized, AND without empty files

#

but oh well. it's ok. i dont have ocd stressed

bronze yoke
#

it bothers me quite a bit admittedly but removing them causes untold problems

rancid panther
#

3 of these files are imposters

#

anything to prevent crashing for my people

#

and i also gotta make a list of known bugs now that i changed so much

fair dust
#

@bronze yoke you were right about the method call, it amounted to me making a typo elsewhere while troubleshooting. this played my VHS. thank you so much
object:getDeviceData():StartPlayMedia()

bronze yoke
#

glad i could help!

rancid panther
#

does anyone remember that guide for workshop formatting posted a while back?

#

i think i found it actually

rancid panther
bronze yoke
#

congrats!!!

rancid panther
#

ty!

#

oh right i need to update github

#

i finally made a repository on the last update

#

now... how do i do that... aphid

#

do i just upload the same folder with all the changes and it will automatically update as if this is the newest version?

#

ok i uploaded it!

open drum
#

guys

#

i need help on translation

#

so i want to make that "contextMenu_Wuro_Bear" to translate into = Bear

#
self:drawText(getText("ContextMenu_Wuro_Bear"), self:getWidth()/10 ,10, 1,1,1,1, UIFont.Medium);```
#

i have the code like so..

#

but i don't understand why it doesn't do work

#

i am guessing it's cuz it's not contextmenu...

#

what can i use to get it from translated.txt file?

open drum
#

I used print(getText("ContextMenu_Wuro_Bear"))

#

and it's returning ContextMenu_Wuro_Bear

#

although in .txt file it says ContextMenu_Wuro_Bear = "불곰"

bronze yoke
#

that sounds like your file isn't being read

open drum
#

and why would it be?

#

any idea?

tardy wren
#

can you show the file structure?

open drum
#

sure hold on

#

and yes, i changed the code

#
self:drawText(getText("Tooltip_WuroBear"), self:getWidth()/10 ,10, 1,1,1,1, UIFont.Medium);```
#

ok it now works after butting the EN translate file

#

but it won't translate to Korean

#

even though my settings are in Korean

#

and looking at the console.. i think the file is correctly being loaded

tardy wren
#

It is... how does the english translation look like again

open drum
tardy wren
#

Yeah, zomboid being zomboid again...

open drum
#

haha.. so.. nothing seems wrong?

reef vine
#

Hello, I am creating a mod for a two handed weapon, everything is going well except when I want to place the weapon somewhere, there is nothing displayed. Once placed, the weapon is displayed well on the ground for example. However, in the inventory I do have an icon. An idea ?

rancid panther
# open drum

can you share a screenshot of the KO folder just like the screenshot of EN one?

#

oh wait i missed it

#

u did already

#

did you modify this while in game or while it was closed/main menu?

rancid panther
#

all of those translations only work on the type of menu or text they were made for

mellow frigate
open drum
#

hmm..

#

ill try the IG_UI

#

and yea, i always turn the whole game off and turn back on when i make a new file. unless i'm changing something on .lua

mellow frigate
open drum
#

yea

#

so now i have that

#

this for english

#
self:drawText(getText("IGUI_WuroBear"), self:getWidth()/10 ,10, 1,1,1,1, UIFont.Medium);```
#

this for code

#

this for result...

open drum
#

??

rancid panther
open drum
rancid panther
#

no just make a change to see if the text will change

#

dont translate the file

open drum
#

ah

#

yea i just did it

#

here ill show you

#

looks like it's just recieving the EN translation

#

dunno why

rancid panther
#

i see. im heading to bed so i think someone else will have to help you

#

good luck!

open drum
#

haha ty

#

good night

neon bronze
#

Perhaps it could be encoding?

open drum
#

what do you mean by encoding?

mellow frigate
# open drum what do you mean by encoding?

Notepad++ tells me Vanilla IG_UI_KO.txt is encoded UTF-16LE https://en.wikipedia.org/wiki/Character_encoding

Character encoding is the process of assigning numbers to graphical characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using digital computers. The numerical values that make up a character encoding are known as "code points" and collectively comprise a "code space", a "code ...

open drum
mellow frigate
#

select the same encoding for your version of IG_UI_KO.txt as vanilla version of it

open drum
#

im using notepad++

open drum
#

what version is vanilla using?

#

it's not using UTF-8?

mellow frigate
open drum
#

oki ill try it

#

and see

#

ty for advice

#

that's interesting

#

mine shows 16BE for vanilla finle

#

i guess i can try both

mellow frigate
open drum
open drum
#

ty for your advice. it worked

#

so it was language Encoding problem

mellow frigate
open drum
#

who would've known

open drum
#

hahah dind't understand what he meant first

#

i appreciate both of u guys ty

mellow frigate
#

have fun

neon bronze
cosmic ermine
#

I'm making Prepared traits, should I allow the player to pick all of them or only allow them to pick one?

mellow frigate
cosmic ermine
#

Workaholic is like Smoker but you have to manage it by doing tasks like uninstalling/installing vehicle parts, etc.

mellow frigate
#

same, mutual exclusive is used for incompatible traits by vanilla

cosmic ermine
#

Never mind, ToadTraits already has more prepared traits lol, I'd like my mod to be more original.

open drum
#

Guys this might b stupid question

#

but im still getting confused with oop system in Lua

#

Here, when ISButton is clicked with onMouseDown

#

it calls the function onOptionMouseDown

#

but why is it MyUI.onOptionMouseDown ???

#

not MyUI:onOptionMouseDown()

#

it would b alright if the function was written

#

MyUI.onOptionMouseDown = function(self,button,x,y)

#

but when i changed into that. It brought up an error

#

dunno if i am explaining it well..

mellow frigate
#

I am not sure what is working or not but here is the '.' vs ':' difference: lua MyUI.onOptionMouseDown = function(self,button,x,y) is used the same way as ```lua
function MyUI:onOptionMouseDown(button,x,y)

both carry the instance as self. but the following does not. ```lua
MyUI.onOptionMouseDown = function(button,x,y)
open drum
#

so i trid the lua MyUI.onOptionMouseDown = function(self,button,x,y)

#

so see if it would work without any problem

#

but it was showing error

#

or ..maybe i forgot to include self... let me try one more time

#

Nvm, it works fine

#

I believe i forgot to include, "Self"

#

haha

indigo dawn
#

Limited lua experience and brand new to modding the game here. I guess I'll ask this here just to find out if it's theoretically possible: has anyone cracked how to completely disable building spawns on zombies, while still preserving the base spawns? Is there a way to stop the events that trigger it from firing in the first place, or otherwise a way to remove the zombies spawned only by it?

mellow frigate
indigo dawn
#

I suppose I'll most likely have to a do a lot of my own digging and learn a lot of PZ's functions, but am curious if this has ever been done before

mellow frigate
indigo dawn
mellow frigate
indigo dawn
#

Fair enough. I'll probably upload this to the workshop and credit you for everything. This will be incredibly useful for people wanting to run with few zeds

hollow iris
#

Anyone know where the bleach model is in the game files? my friend is trying to make a mod and needs it

outer crypt
#

\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\models_X\BleachBottle.X

#

your install may vary... shrug

slow graniteBOT
#
radex0840 has been warned

Reason: Bad word usage

bronze yoke
#

umbrella has been added to vscode's lua addon manager! now to install umbrella all you need to do is open your project, press ctrl-shift-p, find/search for Lua: Open Addon Manager, search Umbrella, and click enable!
on top of installing the type definitions, this will change some of the lua plugin's settings to match pz's environment

digital osprey
bronze yoke
#

it's an enum, e.g. IsoDirections.N for north

digital osprey
#

if i put it in an array i should use quotations right?

bronze yoke
#

no, just as it is

digital osprey
#

cool let me try cheers

#

nice! 10 bugs later it finally works 😄 appreciate it

bronze yoke
#

glad to help!

chilly relic
#

Hi, i have no idea why in vanila tomatos have 2 "ThirstChange", is this some kind of idea with changing thirst as an ingredient or a mistake?

indigo dawn
# mellow frigate if it does not work you'll can use the same trick as WakeThemUp with OnTick stuf...

Welp evidently I have no idea what I am doing with the Zomboid stuff. As predicted, it seems that this alone doesn't seem to be working, and setting it up to just be called with OnTick is giving me an Object tried to call nil error on line 3. On the topic of me not knowing what I am doing, are there any good in-depth resources that I can read to help me better understand PZ lua? I know this probably has a simple solution that I'm not grasping because I don't know what anything is or does unhappy

bright fog
#

Maybe it picks randomly ?

chilly relic
bright fog
#

Never -15 ?

#

Could be a mistake indeed

chilly relic
#

I think it overwrites the last value, I just thought at first that the first value made some sense for the ingredient.

mellow frigate
# indigo dawn Welp evidently I have no idea what I am doing with the Zomboid stuff. As predict...

It is not working because the signature of OnTick is different from OnSeeNewRoom. To understand basic Lua modding, use Fenris Wolf's guide and for further questions, PZ Wiki is the place. https://github.com/FWolfe/Zomboid-Modding-Guide https://pzwiki.net/wiki/Modding

GitHub

Guide to modding various aspects of Project Zomboid - FWolfe/Zomboid-Modding-Guide

bright fog
#

Probably not

bronze yoke
queen oasis
#

I'm trying to manipulate a local variable in a function. Right now, I'm just replacing the whole function but that feels heavy handed. Is there a better way to do this?

jovial jewel
#

Heya! so.. I'm not making or using a mod that this is related too.. but i figured out of the two, this channel was best equipped for the questions... Does anyone know of a mod that may potentially add a "throw away" option or maybe even a "delete" slot in an inventory? (example, you can click and drag an item in terarria to a little box, and delete the item.)
does anyone know of a mod that may do this, OR does anyone plan to make one? I'd be very grateful for this knowledge, and if you do decide to make one compatible with multiplayer, I would LOVE to use it on my RP server!

(I am also open to comissioning someone to make this mod, but I do not know of anyone who does commissions ETC)

bright fog
#

What are you trying to do exactly ?

bright fog
#

And for commissions I can point you to the right place

queen oasis
#

it's a base file. I think I got it figured out tho. I can just run the function, hook into the return, do my math and return that

#

oop in Lua feels icky

jovial jewel
# bright fog I don't think I know one, why do you not use bins ?

We do, however when people have been going around looting dropping things on the floor, dismantling things n leaving all of it on the ground instead of going n throwing it away despite rules ETC, and its a hard thing to enforce and/or track who is doing it. we have things set to despawn ETC but it would be better to have a button for them to just delete the items. If you could point me the right way greatly appreciated!

bright fog
#

Can you not redo the way they get it in your own function ?

#

Unless there's already a return of the value then ok

#

But if you don't have to change the lua file, probably don't do it

queen oasis
#

just trying to math on actionTime returned from ISMovableSpriteProps.getScrapActionTime

#

I'd rather not if I don't have to

bright fog
#

Well I have no idea how this function works tbf

rancid panther
#

it was made for the same reason you described in your message, so hopefully this helps enough

fast galleon
sour island
#

I thought putting stuff in a trash can deleted it eventually?

#

Or am I tripping

rancid panther
#

it does with a button with a server setting enabled. they appear to be looking for a solution for lazy players who don't use trash cans

frank glen
#

Hi guys i have a thought about creating a city or map on pz. I just downloaded pz modding tools but don't know how to create a map actually. Can someone help me out about it? Am I wrong on this?

#

Or is there a recent tutorial about it?

rancid panther
#

map related advice can go in #mapping and i think the pins there will also be helpful

frank glen
#

Oh how i didn't see that. Okay thanks

rancid panther
#

no prob!

cosmic ermine
#

Now go add comments to each function.

bronze yoke
#

when the tool is done 😔

sour island
austere zephyr
#

Question, are there any modders that take donations to create mods?

austere zephyr
bright fog
#

Click on it

#

You do

austere zephyr
#

Sorry yeah I did

#

Thganks

austere zephyr
bright fog
#

saw it 👌

urban ravine
#

hey, ive noticed there is a map mod template, does anyone know if their is a armor mod template? im wanting to get into modding but alot of guides seem extremely complicated.

bright fog
#

No that's not a thing

urban ravine
#

aw man

cosmic ermine
#

@bronze yoke The extension doesn't take the Globals into account.

bronze yoke
#

the globals?

cosmic ermine
bronze yoke
#

have you restarted your ide since installation? someone else's ide was complaining about undefined globals until they did

cosmic ermine
#

I'll use my own Umbrella for now.

#

Is there a way to increase the loots the player can find when they have a trait?

narrow urchin
#

Is it possible to getMovingObjects() in server script?
The problem is - I want to scan building for zombies.

        local roomList = buildingDef:getRooms()
    for room_i = 1, roomList:size() do
        local room = roomList:get(room_i - 1)
        local iso_room = room:getIsoRoom()
        local iso_squares = iso_room:getSquares()
        for square_i = 1, iso_squares:size() do

The problem is iso_squares is empty array in server script (it is populated in client script).

hollow iris
#

Sorry to ask again, does anyone know where item/weapon sprites are in the game files?

digital osprey
#

Im removing WorldItemObjects after a timed action, the models on the ground disappear normally, but they show up in the floor container until i move with the character, can i update the inventory pane somehow after the removal?

neon bronze
#

inventoryPage:setDirty(true)

#

Or smth like that

#

I don’t remember exactly the command but you can set the inventory window dirty that will redraw the inventory page

digital osprey
#

nice one thank u, work got me distracted

digital osprey
#

and is there an easy way to get the floor container? sometimes i can get it like this and then looping through:

ISInventoryPaneContextMenu.getContainers(self.player)

items themselves dont seem to have a container reference when theyre on the ground

bronze yoke
#

<@&671452400221159444>

left plank
#

thanks

leaden aspen
#

Hello! I'm wondering if an experienced modder can answer my quick question so I don't waste much effort if what I'm trying is impossible...
Do mods have access to the game's save system? Does anything prevent the creation of multiple saves?

leaden aspen
#

I'm wondering if I'm better off just making a python script to back up saves for me...

bright fog
#

Probably yes

#

I don't think you can access the saving system

#

I highly doubt it

leaden aspen
#

I did decompile the game and found the save functions, so it seems possible with a java mod at least, would need to do more work analyzing the decompile

old ginkgo
#

Finally done with my pose mod.

leaden aspen
#

Does anyone know what the three values after the date in save folder naming represents?

atomic bone
#

WE NEED THE HOBO SACK!!!

#

STICK + SHEET

#

Improvised bag

#

THERES NO MOD FOR THIS WHY!?!?

bright fog
bright fog
bright fog
old ginkgo
bright fog
#

Nice

#

I see those TWD refs there 👀

old ginkgo
bright fog
#

It looks great

#

I'll use it

#

Suggested it for a RP server I hang around too

old ginkgo
#

Awesome! Once you use it and get a look, feel free to post any feedback or more pose suggestions/requests.

bright fog
#

I will tho I'm modding a lot these days and barely even play haha

old ginkgo
bright fog
#

This for now

#

I'm currently rewriting The Last of Us Infected and creating a framework for modders to create their own zombie types

#

Is called Zomboid Forge

old ginkgo
#

Oh fuck yeah

#

That'd be awesome, I always was shocked how few zombie variants I saw.

bright fog
#

Allows you to add simple zombies up to complexe behaviors if you want to go further (tho that will still depend on your coding skills to make custom behavior functions)

old ginkgo
#

I've considered (now with my animation knowledge) looking into redoing/remaking some custom animations for certain things as my next big major project after working on the pose mod for a bit.

bright fog
#

And addons that depend on the framework will be compatible with each others, unless the modder did some funky stuff, which my main mod will do so it wouldn't work great with other zombie addons (because custom zombie sounds, textures and shit)

bright fog
#

I already did some concept animations but wanted to rewrite the whole mod before going further with it

old ginkgo
#

That honestly sounds awesome, definetly feel free to hit me up once you've finished working on that because that's something I might be interested in looking into or showing a few of my friends that are getting interested in modding.

bright fog
#

Sure man

#

My goal is to make a bunch of addons that use the framework so people learn what they can do with the framework

#

I'm going to retake some zombie variant mods and basically link them to my mod, so you can use multiple zombie variants together

#

Some wouldn't work great with others because they would change things that would apply to every zombies (bcs game limitations) but some would just be like Boomer zombies, random zombies

#

I want to remake the Darkseeker with my framework

old ginkgo
#

That sounds sick. I've always wanted to try my hand at something more coding dependent (my first attempt was at reworking the chat, to try to incorporate the ability to add tabs/etc, but I quickly realized that was in over my head), but I've mostly stuck to lighter changes/adjustments.

#

Hopefully, if the pose mod gets popular/successful I might be inspired for something grander.

bright fog
#

I learned two months ago how to mod tbf

#

Went deep in places not a lot of people explored in the modding scene lol

#

Like custom animations for different zombies was something almost unheard off besides the LeaperZed from Glitcher (only example I found)

#

Like only having a few zombies have different animations than other zombies, today now that I know how to do it it feels so simple

#

But fucking hell no one knew shit about it lol

old ginkgo
#

That’s the hardest barrier to entry for some things I feel, nobody wants to be the first to do it.

#

And that’s how it felt with me and the chat functionality, no documentation and having to be the first person to do it makes it awfully hard.

bright fog
#

Yeah

old ginkgo
#

I know there’s one server that’s made custom chat functionality but they fully rewrote the chat from the ground up rather than working off of zomboids from what I saw.

#

but I’m glad someone is finally working on zombies. For a zombie game it’s shocking there’s so few different ones!

bright fog
#

If you ever get into modding in lua, I heavily suggest decompiling the java, it sounds terrifying but tbf it's very easy in fact and doesn't take much
Especially with chat stuff you'll want to check out how things are handled deeper in the code, and it's not that hard to understand tbf

bright fog
#

Wasn't my goal at first but since I wanted a clear base for my TLOU Infected mod, I thought why not make it a tool for other modders to add their own zombies

old ginkgo
#

I might revisit it like I said since I feel like I was one breakthrough away from managing it.

bright fog
#

Right

#

I hang out there mostly to discuss stuff about mods

old ginkgo
#

Definitely will join. And if I ever pick the project back up I’ll certainly poke my head in.

bright fog
#

👌

#

You can ask about other stuff too, not just coding

#

There's tabs for anything

old ginkgo
#

Bless

broken remnant
#

Hi everyone, is there a mod that increasing physical strength increases the carry weight?

mental urchin
#

Hi all!
I do quests based on this mod https://steamcommunity.com/sharedfiles/filedetails/?id=2941736178
and there's a point there "Tag# accepts any item that has the tag. Example: "tag#Egg;12"."
I asked the author and he said that it is all in the game.
Does anyone know where to find these item tags?

upd: find it in ProjectZomboid\media\scripts

west veldt
#

Hello guys! I have a question: How can I make an item change mesh when activating it?

#

I want to make a torch that turns on and off and changes mesh

digital osprey
west veldt
digital osprey
#

also you can find a mod that already does something similar open it and see how it works

west veldt
#

This was what I needed

#

Thanks for the info @digital osprey

digital osprey
mystic vessel
#

Good afternoon everyone, So I'm making a mod that adds items. based on energy, I wanted them to only be usable if they were on a tile with energy.

Does anyone know how I do this?

bright fog
#

Probably check within the methods for an IsoSquare

#

Could be a method to check if there's electricity or not on that tile

bright fog
#

fuck

#

<@&671452400221159444>

distant slate
#

lol I was like why am I getting pinged for that

lost slate
#

ty

bright fog
distant slate
#

All good 🤣

lost slate
bright fog
#

Yeah Discord's bullshit and quick switching when you look for a ping

mystic vessel
#

I have no idea how to use the lua on Zomboid, I don't know the language and the fact that I don't know and English isn't my primary language makes things very difficult

bright fog
#

When you have an item on the floor, you can get the square it's on with other methods

mystic vessel
bright fog
#

I don't think you can put that in a script file

#

You can check out how True Music does it with Vinyl players

#

I know they check for electricity

mystic vessel
bright fog
#

👌

warped valve
#

I'm trying to make it so that when a client receives mod data they only receive mod data at a specific index (just to lower the amount of data exposed to the client and so that less data is being sent back and forth):

local function OnReceiveGlobalModData(module, packet)
    if module ~= "poolMiniGameData" then return end
    
    if (packet and localPoolTableGameID) then
        local poolMiniGameData = packet[localPoolTableGameID]
        
        if poolMiniGameData then
            ModData.add(module, poolMiniGameData)
        end
    end
end
Events.OnReceiveGlobalModData.Add(OnReceiveGlobalModData)

localPoolTableGameID is set to the host's player ID when the UI has initialized for my mini game. As seen in the code above, it should only add the data at that specific index. Mod data is updated every second on the client while the UI is open. When I added some print() functions to see what was contained in the data it seems to be sending the whole module's data instead of at that particular index. Does anyone know what I'm doing wrong?

For example if I press the button to leave the game I get an error on the client and server saying that the data is nil but the table still has data (which I'm assuming is the whole mod data set including everyone else's games):

local poolMiniGameData = ModData.get("poolMiniGameData")
local playerID = self.playerObj == getSpecificPlayer(poolMiniGameData.host) and poolMiniGameData.host or poolMiniGameData.competitor
sendClientCommand("PoolMiniGame", "leave", {poolMiniGameData.hostPlayerID, playerID})
self:close()
#

My guess is that maybe the mod data is wrapped in another table so I'd just have to use something like ModData.get("poolMiniGameData")[1]? Idk

warped valve
outer crypt
#

does anyone know if it's possible to get the x,y,z of a bag from an item in the bag? item:getContainer():getParent() does not work on bags and the like... :/

cosmic ermine
#

@bronze yoke I see you guys only defined types of fields to be any, I'm gonna fork the repository and add comments and types.

#

Like this.

cosmic ermine
#

@bronze yoke Since most of the folders in Umbrella are links to other repositories, how do I contribute?

bright fog
#

Did you check out the github perhaps ?

cosmic ermine
#

Yeah.

bright fog
#

Maybe you can post there ?

cosmic ermine
#

I even tried forking/cloning the repository but the folders are empty.

bright fog
#

I'm not too familiar with all this stuff so uh

cosmic ermine
#

..

#

How can you pull if you can't edit the stuff lol

bright fog
#

I was able to clone it

#

So uh

#

Just tried

cosmic ermine
#

You cloned the repository itself not a fork.

#

Can you contribute that way?

bright fog
#

Yeah

cosmic ermine
#

Go ahead and request a pull for that xd

#

I wanna see.

bronze yoke
cosmic ermine
bronze yoke
#

the lua module is imo not that helpful because of the heavy usage of any, since lua isn't typed we can't generate these automatically

#

huh? i wrote the events module, it don't use any at all

cosmic ermine
bronze yoke
#

i'm not really sure what solution we settled on for future typing of the lua module but right now there isn't really any way to do that without changing how it works

#

rosetta might support it, only looked at the events portion of it

bright fog
#

You try it man

#

You're the one that wants to do that

#

If you've tested it and already know it doesn't work just say it lmao

#

I already tried stuff to show you, no point in fooling me around if you already know you can't do that

cosmic ermine
bright fog
#

How do you expect me to know that ?

cosmic ermine
#

Why are you mad lol

bright fog
#

Anyway just do your thing, do a fork or idk, gave you my pov on that and tested things to see if it would work

cosmic ermine
#

Albion already said those can't be changed.

#

Since they use scripts, which makes sense. I can't imagine writing all of these manually.

bright fog
#

Isn't a fork a replacement of that file ? A completely different file ?

#

Well you're the one wanting to make anotations on those and now you don't want to do it ? I don't get it lol

cosmic ermine
bright fog
#

Yes, so what's the problem exactly there ?

cosmic ermine
bright fog
#

What ?

cosmic ermine
# bright fog What ?

If you wanna contribute to Lua, you have to make a fork on Lua which is listed in Umbrella.

bright fog
#

Hmm I see okay

cosmic ermine
#

Not Umbrella.

bright fog
#

Why not make forks for those then ?

#

I mean yeah nvm bcs umbrella won't use those then

#

Tho Albion or other contributors could link to your fork instead ?

cosmic ermine
#

Doesn't work that way.

bright fog
#

Can't they link to forks from those other repository ?

bronze yoke
#

we merge the changes from the fork into the main repository

#

but the repositories containing the typings files shouldn't really be forked, we generate them with scripts so any manual changes will just get overwritten next time we generate them

cosmic ermine
#

Just realized that my Workaholic lacks quite a lot of actions. Would you consider this work?

#

These are the newly added ones.

frank elbow
#

I am still around despite the inactivity in the repo, so if you made a fork & PR I'd happily review it

cosmic ermine
frank elbow
#

I think there are plans to create a tool for adding documentation. I have an in-progress rewrite to improve the Lua stubs with guesses of types but (due to a sudden loss of momentum/interest + working on other stuff) I haven't worked on it in a while

fast galleon
#

I wish it was possible to see what elements an Arraylist has, so that get immediately knew the type.

bronze yoke
#

i need to check if vscode supports this, emmylua didn't but vscode's annotations work a lot better

cosmic ermine
bronze yoke
#

you can create them but methods that return generics don't work at all

#

i think i'll look into still annotating them as generic classes, just not actually using generics in the method annotations yet, so you'd at least be able to see in-ide what type the list contains

#

e.g. you'd be able to see IsoCell:getZombieList() returns an ArrayList<IsoZombie>, but local zombie = zombieList:get(0) would still end up typed as any

cosmic ermine
#

What the heck is ComfreyCataplasm?

bronze yoke
#

it's one of the poultices, it makes fractures heal faster

cosmic ermine
#

Should I count these as work?