#mod_development

1 messages · Page 39 of 1

astral dune
thick karma
#

Is there any means by which to call setCursorVisible(bool)?

#

In zombie.input.Mouse?

chrome mesa
#

is there a way to load a separate texture for the male/female model of a given outfit?

wanton dirge
#

Could you not check the characters gender when equiping the item and replace the item before running the equip script? (Not the same thing but it might be a usable workaround.)

chrome mesa
#

I was hoping to keep this a simple texture replacement.

weak sierra
#

i would not think so, but who knows

#

i would expect it stops cold after the radius

#

but i do not know that for a fact

autumn stump
weak sierra
#

can always set up a vm

#

linux is free after all

#

also there's WSL/WSL2

#

if u use win10/11

autumn stump
#

I'll see what I can do. Thanks!

ancient grail
#

ow wow thank you!! 🙂

gilded hawk
#

Does anyone know why ModData.transmit if used in the server folder, starts spamming transmits like hell?

Is it because I was hosting using the "host" button instead of an actual server?

weak sierra
#

maybe, if ur doing something like that ur both client and server

#

but i think host button is still separate..

#

only coop is unified totally

#

mm

#

idk MD_Shrug

hearty dew
gilded hawk
hearty dew
#

Still need to code lua files in server/ such that only the server (or client, or singleplayer, whichever you want) will run it

gilded hawk
#

Oh, so I still need to check for 'isClient' and 'isServer'?

hearty dew
#
if isServer() then
  ModData.transmit(...)
end
#

Yes

gilded hawk
#

Fair enough

hearty dew
#

This gives an overview of which lua files are loaded when by client/server

astral dune
#

ya, the folder the code is in has little to do with which side of the client/server divide it runs on, aside from the client folder not being loaded on the server

gilded hawk
#

So, I updated my code, and it seeems to work

local function onServerReceiveGlobalModData(module, packet)
    if not string.find(module, "FactionMap_") or module == "FactionMap_None" then
        return
    end

    if not packet then
        return
    end

    ModData.add(module, packet)

    print('onServerReceiveGlobalModData')
    print('isServer()'..tostring(isServer()))

    if not isServer() then
        return
    end

    ModData.transmit(module)
end

Events.OnReceiveGlobalModData.Add(onServerReceiveGlobalModData);
hearty dew
#
ISChat.instance.servermsgTimer = 5000; ISChat.instance.servermsg = "Hello there"

Random little 2 liner to get a message to appear on the screen

gilded hawk
#

I'll kiss you

astral dune
#

oh thats interesting, I've been struggling with getting servermsg working without using the server command, which only works for admins

hearty dew
#

Mm, should be able to send a command to all clients and run those 2 lines to make a message appear temporarily

weak sierra
#

lmao

#
function UdderlyUpToDate.message(msg, isAlert)
    local chatMsg = 
    {
        getTextWithPrefix = function(self)
            return msg
        end,

        getText = function(self)
            return msg
        end,
        
        setText = function(self, newMsg)
            msg = newMsg
        end,
        
        isOverHeadSpeech = function() return not isAlert end,
        isServerAlert = function() return isAlert end,
        isShowAuthor = function() return false end,
        isServerAuthor = function() return true end,
        getAuthor = function() return "SERVER" end
    }        
    chatMsg.__index = chatMsg
    if not isAlert then
        msg = "[Server] "..msg
    end
    ISChat.addLineInChat(setmetatable({ msg = msg.."\t" }, chatMsg), 0)
end```
#

granted this can technically do more

#

but

#

yeah

astral dune
#

I assume so, don't understand a line of it

weak sierra
#

it basically inserts an actual message into the chat box record

hearty dew
weak sierra
#

which is how the normal servermsg works

#

mine will let u send normal messages and/or both at once like a normal servermsg

gilded hawk
#

Holy shit I just DID IT

weak sierra
#

that one is way easier if all u need is the servermsg on screen

gilded hawk
#

A Sync'd map between all faction MEMBERS! :WOOOOOOOOOOO

weak sierra
#

:o

#

that's pretty interesting

astral dune
#

is transmitting a message over a certain radio frequency easy? 🤔

gilded hawk
#

Tyrir i'll kiss you man

weak sierra
#

surprised u didnt run into the isClient isServer shit sooner

#

lol

#

i know i have

gilded hawk
#

I had issues only now lol, I'm encoding the gif to show it working ,I need a minute tho

weak sierra
#

this sounds like a mod i'd install on my server quite possibly

#

excite

gilded hawk
#

Now, if only I knew someone who knows how to use tilezed I could make an "immersive" version of it

weak sierra
#

try the mapping server

#

i havent dipped into that but i will be in the near future

#

i got everything ready

humble oriole
#

Hey, I'm starting with my first mod and I'm having trouble getting the listener to pick up the command. Can anyone take a quick look and let me know what I'm missing? The code runs and sends off the send client command but the litsener never picks it up.

First File:

...
sendClientCommand(player, "LB", "addItemtoInv",  requestedItems )
...```

APB_ClientCommands.lua (Second File)

function Commands.addItemtoInv(player, args)
for k,v in pairs(args) do
player:getInventory():AddItem(k, v)
end
end

APBCommands.onClientCommand = function(module, command, player, args)
if module == 'LB' and Commands[command] then
Commands[command](player, args)
end
end

Events.OnClientCommand.Add(APBCommands.onClientCommand)

gilded hawk
humble oriole
weak sierra
#

OMG it's SEPARATE

gilded hawk
weak sierra
#

that's even BETTER

#

holy fuck yes

#

you make some of the best things

#

this and proximity inventory

gilded hawk
#

Aww thank you dear

weak sierra
#

both game changers

#

i like a lot more of your mods too but those two

#

hoo boy

gilded hawk
#

Now I only need to spend the next 20 hours figuring out the name for this mod 😅

weak sierra
#

nae?

#

name

gilded hawk
#

*name yes

weak sierra
#

hm

#

Separate Shared Faction Map

#

Additional Shared Faction Map

#

Faction-Synchronized Second Map

#

Faction Map

gilded hawk
#

Faction Map sounds very straight forward

weak sierra
#

i think, honestly, faction map gets it across

#

yeah

#

it makes u go "that could be X" without being too wordy

gilded hawk
#

There is an issue tho 😕
I need to make it compatible with the sliders mod pain

weak sierra
#

sliders mod

#

what sliders mod

#

the symbol size?

gilded hawk
#

ye

weak sierra
#

shit ima have to get zero in on this too aren't i

#

the radar mod

#

that person is making a POI system soon

#

with their own symbol stuff

gilded hawk
weak sierra
#

look it up it's good stuff

#

just called "radar"

weak sierra
#

is name on map but more complex

weak sierra
gilded hawk
weak sierra
#

i just don't adjust the symbol size?

#

lol

gilded hawk
humble oriole
#

we do as well

gilded hawk
#

My mod should be compatible with that one 🤔

weak sierra
#

draw on map one made UI janky too

#

so i also dont run that one

gilded hawk
weak sierra
#

i think zero is making their own symbol rendering cuz they tend ot overcomplicate things

#

so compat with POI system + ur mod will probably be a thing

gilded hawk
#

Maybe I can get in touch with this guy and we can merge mods 🤔

#

Having multiple layers on the map is quite POG imho (in my case the vanilla and faction layer)

humble oriole
#

do either of you guys have a second to peak at my question above? I'm sure it's something rather simple that I'm missing D:

hearty dew
gilded hawk
humble oriole
astral dune
#

what folder is it in?

humble oriole
#

they're both in server

#

it's being called by a recipe and everything works up to the sendclientcommand and then it just ends

astral dune
#

if you put a breakpoint there and look, do player and requestedItems both contain something?

humble oriole
#

yes, they both do, I've confirmed

#
function Recipe.OnCreate.LB_OpenBox(items, result, player)
    local lootBox = items:get(0)
    local modData = lootBox:getModData()
    local requestedItems = {}

    if (modData.LootBoxID == "knight_box") then
        requestedItems = knightBox();
    end
    
    sendClientCommand(player, "LB", "addItemtoInv",  requestedItems ) 
end```
astral dune
#

The table APBCommands also exists right, you aren't getting any errors in your logs?

humble oriole
#

let me double check

#

LOG : Lua , 1666250748799> 0> Loading: C:/Users/fallen/Zomboid/mods/APB_LootBoxes/media/lua/server/APB_ClientCommands.lua

#

yea, no errors

ancient grail
#

guys know which file spawns the zeds and will it be possible to create a mod that affects their behavior
like they smoke cigarette when idle
or dance

humble oriole
#

I'll have to double check for the table, I don't remember seeing it. but so far as I can tell the listener doesn't even pick up the command

weak sierra
#

they have a framework mod called simplify

#

idk if u wanna mess with that or not

#

ill use both mods so when the POIs come out i just wanna make sure they dont break each other

#

lol

astral dune
gilded hawk
#

@sour island If I recall correctly you were interested in the code that writes map markers right?

astral dune
#

I would do something like

APBCommands.onClientCommand = function(module, command, player, args)
    print(string.format("Command %s called in module %s", command, module))
    if module == 'LB' and Commands[command] then
        print(string.format("Command %s exists in module LB, calling", command))
        Commands[command](player, args)
    end
end

just to see if the event is being called at all

#

Long story short, the syntax looks right

ruby urchin
#

you can also try this and add some prints to check if it's called

local onClientCommand = function(module, command, player, args)
    if Commands[module] and Commands[module][command] then
        Commands[module][command](player, args)
    end
end

Events.OnClientCommand.Add(onClientCommand )
humble oriole
#

Ok, I’ll try this when I’m back at my testing machine. I put break points in the onClientCommand and it wasn’t hitting them, but it may not work the way I think it does.

astral dune
#

breakpoints on server-side code don't work, unfortunately

humble oriole
#

Aaahhh, ok

hearty dew
#

Also inventory is client-side, I think, no?

gilded hawk
astral dune
#

you can't add something to someone's inventory on the server? lmao

humble oriole
#

I’m pretty sure you can

hearty dew
#

I presumed he was doing some action client-side and was trying to make stuff appear in the inventory when it occurred

#

Mm, I've never tried that. I don't know :)

humble oriole
#

I’m trying to have them interact with an item and then spawn multiple items in their inventory

hearty dew
#

let me try it real quick. Now I'm curious :p

humble oriole
#

The way I’m doing it should work

hearty dew
#

What are the two parameters you pass to AddItem?

humble oriole
#

String int

#

Name, number

hearty dew
#

Doesn't work when I run it server-side```lua
r'print(getPlayerByOnlineID(0):getInventory():AddItem("Base.Pen",1))'

#

r is my remote console

#

works locally though

#

prints out true though peeposhrug

sour island
thick karma
#

Any way to hide or relocate the mouse cursor using Lua?

#

Tried setMouseXY​(0, 0) and seem to be getting ignored.

humble oriole
#

Is debug console considered client or server side? I did a getPlayer().getInventory().addItem(“223Clip”, 1) via that and it worked.

hearty dew
#

client-side

#

Also keep in mind on which side you are doing print

#

client side will end up in console.txt and the console

#

server side will end up in server-console.txt (or coop-console.txt if coop hosting)

weak sierra
#

i loved EHE but im so afraid to put it on my server again

#

the last time i ran it i got hordes of 1000 zombies at chokepoints

#

more even

#

nuff to drop FPS to 1-2

#

heh

#

i did have redistribute time high at the time tho

#

maybe my own fault

humble oriole
humble oriole
gilded hawk
hearty dew
#

Given that the player that opens the box is the one that should have the items added to their inv, I don't see a good reason why not to just run that client-side. If for some reason you wanted to spawn an item in a player's inventory in another client, you could send a message to the server that sends another message to the client with the target player, and then call that AddItem function in a client-side command. That seems to not be your use-case however, as I understand it

humble oriole
#

Correct, I was just pondering that, is there any security concerns in doing that? Would I then just move the file to the client folder?

thorn bane
#

God send, thank you so much <3

gilded hawk
#

My mod just broke, goddamit

pine fiber
gilded hawk
#

nvm I Just panicked

#

my server did not reboot with the mod on

hearty dew
humble oriole
#

Hackers gonna hack haha

hearty dew
#

lua checksum in theory would guarantee integrity of your code, but it only does so much

humble oriole
#

True, thanks for all your help!

hearty dew
humble oriole
#

@astral dune and @ruby urchin thank you as well.

thorn bane
astral dune
humble oriole
#

No worries, this is all new to me, and there’s only so much you can learn through reverse engineering

weak sierra
#

:p

#

it'll be rolled out live in a few mins to my server if nothing breaks

gilded hawk
#

😨

#

Good luck!

weak sierra
#

lil awkward

#

button seems to do nothing?

gilded hawk
#

Oh goddamit

#

Some mod is interfeering with the button placement

weak sierra
#

maybe the one i linked earlier :P

gilded hawk
#

Send me the link again pls, I'll look into it

weak sierra
#

also i really need a way to change either the default or by-item material of UniversalRepairAnything

#

adding magazine-based padded gloves to my server

#

creates a pipeline to turn magazines into leather

#

cloth masks? they're leather

#

etc..

#

ill need to look into patching this cuz this is worse with craftables that are cheap

#

heh

#

christ that mod is so small

#

i had no idea

gilded hawk
weak sierra
#

yeah

gilded hawk
#

yep my tiniest mod lol

#

But that girl works perfectly

drifting ore
#

hey so when i put mods in my game they dont show up like at all

#

like im not sure if its the mods glitching together but i wouldnt think so

weak sierra
#

i thought there was more to something being repairable

#

lol

#

i.. if i patch this, @gilded hawk

#

it'll basically be the whole mod

#
function RepairAnythingCore()
    local items = getAllItems();
    for i = 0, items:size() - 1 do
        local item = items:get(i);
        local fabricType = item:getFabricType();
        -- NbrOfCoveredParts from java\inventory\types\Clothing.java
        local NbrOfCoveredParts = BloodClothingType.getCoveredPartCount(item:getBloodClothingType())
        if fabricType == nil and NbrOfCoveredParts > 0 then
            item:DoParam("FabricType = Leather");
        end
    end
end

Events.OnGameBoot.Add(RepairAnythingCore)
#

it's so tiny

gilded hawk
#

Tiny mod

#

But, what did you change?

weak sierra
#

i wanna try with cloth as default

#

i didnt post changed

#

the alternative is to patch every item i dont want to be leather by default

#

lol

#

not sure which way makes more sense atm

#

guessing this patches more things that make sense than not

#

since my experience has been "this is fine"

#

cept a few

gilded hawk
#

I have another mod wip about this stuff, but im a bit busy rn trying to compress a damn gif under 2MB

#

I could make a mod that makes cloth the default, but then fixing a lot of stuff becomes stupid easy

hearty dew
thorn bane
#

cheers mandam

hearty dew
#

Some of the text size and color is still not quite right, but it the text mostly functions

#
    local processMessage = function(line, printer)
        printer(line)
    end

    local myTabID = harrisonUtils.addChatTab("my new tab title", "my custom chat", "/radio", "/r", processMessage, true)
#

If you set the 6th param to true, it will make the chat window / tabs work in single player. Can ignore passing that parameter otherwise

jade chasm
#

I'm trying to create a new procedural generation tag and a distribution callup for a mod. Do I include the scripts in the ModDistribution.lua?

#

I have

#

ProceduralDistributions = {};
ProceduralDistributions.list = {
SwordCrate = {
rolls = 3,
items = {
"Sword", 1000,
},
},
}

table.insert(ProceduralDistributions.list, distributionTable);

#

and

#

Distributions = Distributions or {};
local distributionTable = {

all = {
    displaycase = {
        procedural = true,
        procList = {
            {name="SwordCrate", min=0, max=99, forceForRooms="gallery"},
    }
},

}

table.insert(Distributions, 1, distributionTable);

#

and i'm not sure how I go about adding these to the game

hollow current
#

Can you somehow get the real life date a world was created? My problem is that I added a sandbox option which if enabled, a ContextMenu option would only appear for admins, like so:

if canBeRenamed then
        if SandboxVars.EverythingHasAName.OnlyAdminCanRename then
            if isAdmin() or isDebugEnabled() then
                context:addOption(getText("ContextMenu_renameButton"), canBeRenamed, ISRenameEverything.onRenameItem, player);```

The option is defaulted to false. However, currently, the problem is that worlds which were created before the update somehow got the option defaulted to true. Can I fetch a world real life creation date and make the option appear anyways if the world was created prior to that date?
safe silo
#

When making recipes that require more than one level in a given skill - how do I do that?

SkillRequired:Electricity=4;Metalworking=2,

This only shows Electricity

gilded hawk
drifting ore
#

What are some good rebalancing mods? I'm looking for a mod that nerfs catching a cold specifically

hearty dew
hollow current
#

Will look into that, thanks

ruby urchin
hearty dew
hollow current
#

ah apparently there's no need. I realised I made my code to add the context option only if the option was set to True and if the player was admin, and never really added anything if the option was False lol

#

Thanks for the help though!

astral dune
#

has anyone done a believable smoke animation? Or a smoke animation at all?

jade chasm
thick karma
#

So final answer is no way to hide mouse pointer (programmatically) of all the things? And no way to send it a move signal?

pine fiber
#

@gilded hawk How do you launch the game twice (probably local co-op) without steam getting offended?

gilded hawk
#

Inspired by client-server guide by Dislaik

pine fiber
#

I know how to enable it on dedicated server but not at all on local 😅 Is it a steam launch parameter? that sounds weird

safe silo
#

How would I create looping sound that kept playing until something is turned off? Like the refrigerators currently.

I've gotten as far as gotten cell:playSound() but unsure how I'll make it loop.

gilded hawk
pine fiber
thick karma
thick karma
astral dune
#

assuming we can add billboard sprites with transparency... and that's a big assumption... it shouldn't be too bad to make. I just didn't want to reinvent the wheel if someone had already done it.

jade chasm
#

local function preDistributionMerge()
ProceduralDistributions.list.SwordCrate = {
rolls = 4,
items = {
"Sword", 1000,
},
}
end
Events.OnPreDistributionMerge.Add(preDistributionMerge);

local distributionTable = {
Gallery = {
displaycase = {
procedural = true,
procList = SwordCrate", min=0, max=99, weightChance=100},
}
},
}
table.insert(Distributions, 1, distributionTable);

#

I added this to my distribution file but I am not getting spawns in. Does anyone have any ideas why?

weak sierra
#

what bloodlocation do i do to assign a piece of clothing to just forearms

#

or does that not exist

#

and that's why this person made it be "jacket" and invented the idea that "you're blocking with them"

#

can i just.. LeftForearm

#

and RightForearm

#

tries

bronze yoke
#

maybe UpperArms?

#

or LowerArms rather

thick karma
#

tfw when rereading your options 40 times doesn't change anything

weak sierra
#

another thing made by djvirus that i don't wanna use because it's split into left and right models for asymmetry which the game is not designed for, lovely then

#

😔

#

cant stand having each hand armor give both hands armor

#

and LowerArms is not side-based

#

ah well

empty cove
#

@weak sierra @gilded hawk
Yeap can merge, it's basically a matter of switching the rendering layer between personal symbols layer / faction symbols layer.
The new rendering system will be done soon. Will inform you two once it's done.
Reason why there's a need for your own symbol rendering system is because vanilla map rendering system itself is a mess. There's a potential compatibility issue with map related mods that needs to be considered. Symbols addon is a good example where you might interfere with each other's override for symbols definition / rendering so it's better to avoid this mess by using separate rendering system.
I don't recommend you to use the 'simplify' framework available at the workshop atm. It is outdated. New version works differently so that I can easily access my own string library through any string methods instead of interfering with vanilla string plus supporting pseudo overloaded functions.

winter basalt
#

who is gerald0mc?

#

i am trying to make storm mods and i saw his github guide thing

#

but i can't find his discord

#

look up mods about it on steam workshop\

#

and then look at the code

#

you can get an idea

weak sierra
#

if either of u need anything codewise lmk

#

a cause i would very much spend some time on

#

look at existing mods, yes, like player999 says

#

whatever the closest thing is to what you want to do

#

poke around at it

#

then ask questions, and use these docs

#

i know it says 41.65 but they are the most up-to-date docs around and hardly anything has changed

#

the ones with no version number are in fact older

bronze yoke
#

some notes on the new OnPlayerGetDamage event in 41.78:
the arguments passed are the player being damaged, the type of damage as a string, and the amount of damage
the event is triggered OnPlayerUpdate for every body part that is being damaged, as well as the BodyDamage itself, each possible trigger raising its own event (for example, if you are both sick and bleeding, the event will be called twice on that update)
the damage types that i've seen are:
POISON, HUNGRY, SICK, BLEEDING, THIRST, HEAVYLOAD, INFECTION, CARHITDAMAGE, FALLDOWN, FIRE, WEAPONHIT, LOWWEIGHT, CARCRASHDAMAGE
weapon damage (WEAPONHIT) events are triggered by zombies as well as players
the event is only called on the client, except for these weapon damage events, which are called on both

tight blade
#

I do wanna ask here before I actually attempt it, but has anyone made like a weapon "killcount" mod?
NOT the mod that shows kill count with things like cars, weapons on the info tab, since that's for ANY weapon

I guess more specifically, in TF2 there are Strange quality weapons that track kills, I want to know if anyone has SPECIFICALLY made it so a weapon can track it's own kills.

So I could say give someone my 1k kills Katana and a friend can possibly level it and get it to 2k.

astral dune
bronze yoke
#

unfortunately this is the damage taken from being hit by a car, not being hit in a car

#

i'll have a quick look if there's anything like that though

#

CARCRASHDAMAGE

astral dune
#

I don't suppose the OnPlayerGetDamage event has a reference to the vehicle? I guess not, you said it was the character, a string and an amount

#

still, could probably use it

bronze yoke
#

well you can just :getVehicle() at that point

astral dune
#

ya, its client side so assumptions could be made

#

what if its split screen and all 4 players are driving 🤔

#

lol

bronze yoke
#

huh? getVehicle() returns the vehicle of a specific player

#

CARCRASHDAMAGE will only be triggered by a player in a vehicle, so... easy

astral dune
#

yes, but CARHITDAMAGE I'd be looking for is on a zombie. you said zombies taking damage triggers these events too right?

#

or is it just the weapon one?

bronze yoke
#

you'd have to test that yourself, i don't really know how the java works

#

someone with a proper decompiler should search the whole codebase for this event too, for some reason every java decompiler i can find mysteriously doesn't work at all on my computer so i'm using an online decompiler and searching individual files that seem like they would have it

astral dune
#

I've had good luck with the capsid tool but I haven't used it since 41.71-3, I'll have to give it a go again tomorrow

astral dune
bronze yoke
#

that, and anything else that calls damagePlayers() (if there are others)

astral dune
#

is 41.78 the unstable build?

bronze yoke
#

yeah

#

the code for CARHITDAMAGE was in IsoPlayer(), so that would be a dead end

tame mulch
#

If will be questions about new event OnPlayerGetDamage - you can ask me. Also if will be suggestions, bugs - write me 🙂

bronze yoke
#

we've both just been looking for a way to hook into the moment vehicles get damaged, we hoped this might give us a workaround (as the driver usually gets damaged when the vehicle does) but i'm not sure it does

astral dune
#

yes! Right now if mod developers want to reduce or alter damage caused to a vehicle, they have to scan every tick for changes to the parts and do something about it. Obviously this isn't very performant. Was hoping this event would give us a way to know when damage has happened, and maybe even how much, without having to scan the car parts constantly

tame mulch
#

For vehicle in future we will add better way for add armor and check damage

astral dune
#

looking forward to it!

#

while you're here, may I please beg that you guys fix the vehicle engine power getting overwritten from the script so that we can change it again 🙏

#

these two lines in CarController.control_ForwardNew() break our ability to change an engine's power

        var13 = (float)this.vehicleObject.getEnginePower();
        var13 = this.vehicleObject.getScript().getEngineForce();
tame mulch
astral dune
# tame mulch Do suggestion about this on forum. I will check it when will do vehicle rework i...

There is actually a bug report about it here https://theindiestone.com/forums/index.php?/topic/60431-4173-engine-power-isnt-used/ do you want me to create a different post elsewhere?

astral dune
bronze yoke
#

i'm just reverting damage on part update

astral dune
#

ah ok

bronze yoke
#

it seemed like doing anything fancy wouldn't actually pay off

astral dune
#

ya, I may be worrying about performance for nothing, I don't know

bronze yoke
#

the part update is pretty infrequent on the scale of game logic so i'm not worried in the least

astral dune
#

true, part updates are better than ontick

bronze yoke
#

i think doing it ontick would probably be fine too but i'm staying away from that

astral dune
#

I have one function that fires onTick, only when a player is in the car. It checks the blood intensity on the vehicle, which I think is about as fast an operation as I can do

small topaz
#

I just went through the Indie Stone's modding policy which can be accessed since the new update to unstable 41.78. Do you think this is more a formality or that it may change smth about how mods can be uploaded to the workshop (i.e. more rules, more control, more restrictions and stuff...)?

astral dune
#

I don't know, I haven't seen it

small topaz
#

In 41.78, you'll have to accept some user agreement when you start the game. You can also read the policies and there is some section about modding. It sounds reasonable and not in any way restrictive or negative. I am just wondering what other modders think about since it now feels somehow "official" XD

bronze yoke
#

wasn't there already a policy?

small topaz
#

uuuhhh.... maybe. but not one you have to accept when starting the game afaik

bronze yoke
#

i'll be the first of many to admit i just clicked agree and moved on without reading anything but i recall reading one in the game directory

#

this one


The Indie Stone reserve the right to implement any features in the game irrespective of whether mods exist that accomplish the same goal.

[The Indie Stone are free to use any ideas found in user mods, and while we will give credit if we genuinely use ideas directly from mods – we are not required to give credit or remuneration of any kind. This is purely because people may create mods that are already part of the PZ roadmap, and we don’t want to be dragged into ‘this was my idea’ arguments. The Indie Stone will of course fall over themselves to credit any mod author we genuinely use ideas from.]

PZ modders are solely responsible for their mod, including (but not limited to compliance with any hosting platforms (such as Steam Workshop). They are also responsible for obtaining third party consents for any third party materials in the mod. Legally, we have to ask that modders to ‘represent and warrant’ (i.e. promise legally) that their mod is their own original work and any third party contents are fully and properly licensed by the modder.
PZ users are responsible for their usage of PZ mods – we don’t check them and we can’t be responsible for them.
Creation of mods is subject to our modding guidelines, which may be updated from time to time with any technical requirements regarding how PZ mods must work.```
small topaz
#

ah ok... the new policy is definitely more detailed than this. is this the full text or just a section?

astral dune
#

interesting that the license allows us to distribute the base files, provided that we don't make it open source or put malware in it

ruby urchin
bronze yoke
#

this is the full mod section, there's other sections though

#

and i'm guessing the one in-game is newer

#

so maybe just ignore this one...?

#

or like, consider the in-game one more authoritative anyway

astral dune
#

this is the current modding policy afaict, and it hasn't been updated since april? or was it updated two weeks ago? Bloody numerical timestamps

small topaz
bronze yoke
#

i'll give that a read then

astral dune
#

its very permissive and fair, I've no problems with it

small topaz
astral dune
#

given that the devs aren't american, I assume its october 4th

small topaz
astral dune
#

2.2.2. create nor publish content that is objectionable and inappropriate. This includes but is not limited to content that is intentionally offensive, abusive, obscene, discriminatory, racist, pornographic, aimed to harass someone or a group of people, threatening, hateful, xenophobic, invasive to the privacy of another person or group of people, sexist, and/or defamatory.

small topaz
#

yes. this

#

I don't think the mods I mentioned would be subject to this rule but may also be a question of interpretation...

bronze yoke
#

there's nothing new in here that isn't basic responsibility honestly

#

i'm very happy with this

astral dune
#

It does leave it up to the devs' discretion as to what is inappropriate. Nudity seems to be allowed, but I imagine Sex would not be. I think thats fair. If someone really really wants to mod something edgy into the game there is nothing stopping them from just keeping it for personal use or distributing it to small insular communities that want it

bronze yoke
#

and while i didn't expect any less from TIS, seeing an outright statement of 'You own mods that you create.' is very relieving, particularly as some games like to say the opposite

astral dune
#

As far as I can tell they're going about things the right way, and we can all be thankful they actually support the modding community instead of claiming to while still leaving their code obfuscated like some companies

small topaz
#

just asking people here since I have a nude texture mod by myself and it was quite some work creating it. XD

astral dune
#

It had crossed my mind earlier tbh. Someone here is making/has made a mod that gives zombies lines occasionally like help.. me.. to try and punch up the atmosphere and pathos a little bit. I thought "you know what would really give people conflicted feelings in this game? Make some of the zombies children"
I don't know if they'd allow a mod that adds children to kill

bronze yoke
#

that mod is released actually

#

i'm assisting with updates

astral dune
#

yes, but like all mods is still a little bit in development, haha

bronze yoke
#

hehe yeah

astral dune
#

I love the idea, and almost pitched the kid concept when they were here the other day. But it would likely be a tonne of work, if even possible, just to make people sad. lmao

bronze yoke
#

from what i've read, it's just totally impossible right now

astral dune
#

I hope you guys figure out a way to add more stories. I really liked the idea that zombies would be able to open the door to their former homes

bronze yoke
small topaz
#

yeah. problem is that you cannot add additional 3d character models. so, smaller models are not really possible. you could try adding them but then, all the zombies and all the players will have those models

bronze yoke
#

yeah that's what i'd heard

astral dune
#

Dislaik's dog probably will only work in single player right now as far as I understand, I don't know if he's made progress with that. From what I understand that dog is actually animated clothing

small topaz
bronze yoke
#

oh i see, make a clothing item mask the whole body and then animate the item (or at least that's how i imagine it works)

astral dune
#

yes I think so

bronze yoke
#

i'll wait for b42 lol that sounds like too much

astral dune
#

I would be very surprised if the npc update that adds lifestock doesn't give those tools to modders tbh

small topaz
small topaz
thick karma
#

Alright, free time, one of these mods is getting published tonight dag nabbit...

#

That's right, I said dag nabbit!

late hound
#

well anyway, I have disproven that when I implemented my lady dimitrescu zombie, and fat and skinny zombies in AuthenticZ

#

When it comes to height, though, you will run into issues. All the hat models are set at certain location offset -so if you make a taller or shorter character, by default, the hat model will stay in the same location as a normal player model. Therefore for taller models, the hat will clip through the head, for shorter the hat will be floating above the head. There are ways around this though, requires a bit of scripting work and some code to automatically change. The vanilla hairstyle system also doesn't work with my method.

small topaz
late hound
#

yes

small topaz
# late hound yes

ok. we discussed this workaround later in chat. I just meant that the game comes by default with 2 character models (1 male 1 female) and that it is currently not possible to add an additional model without replacing the vanilla ones.

#

but ya... I am well aware that you can do a lot of stuff with tricky clothing models. I used this trick in one of my mods too.

drifting ore
#

how do i apply/remove effects/statuses? like pain, illness, that kind of thing?

#

and what does the game refer to them to?

thick karma
#

@weak sierra @bronze yoke @gilded hawk @hearty dew

drifting ore
#

is there any events for eating/consuming items?

thick karma
#

I might try decorating function ISEatFoodAction:start() in ISEatFoodAction.lua

drifting ore
#

gotcha

#

if CalculateStats is obsolete, what do i use instead?

thick karma
#

What did that used to do for you?

drifting ore
#

i'm trying to modify/add to stats and things

thick karma
#

Like add XP to Strength? Not sure I follow

azure dock
#

Hey guys looking for help with a project I'l trying to set up ASAP, time is of the essence. Need lore writers, mappers, (not necessarily but would be helpful) modders, experienced roleplayers, experienced admins and moderators.

#

pm if interested, complete rendition of vanilla done easy as 123

azure dock
#

sry man wont be another message all love ❤️

pearl lance
azure dock
#

seriously, though, this is really huge n with the new update and where 42 is headed, this will be the shit.

#

fuck 10 years later

#

keep it 1 hunnid

blissful salmon
#

Is there a tutorial how to setup visual studio code so I have full access to code completition at least for the whole lua stuff? I assume for the java "objects" it isn't posible...
Till now I only worked with notepad++. Now I've setup VS Code with my modfolder in the workspace (I didn't understande their concept fully). The code completition now works for my code... but (of course) not for the base lua files from zomboid.

thick karma
#

Whyyyyyy are these UI lines so convoluted....????
ISFishingUI.instance[playerIndex + 1]:onClick({internal = "CLOSE"})
Jesus.

thick karma
#

Haha I am working through my 5th and final mod

#

For now lol

#

So close yet so far

#

Trying to work out the right command for closing context menu right now

#

Ay nailed it.

#

This one not so hideous

            local contextMenu = getPlayerContextMenu(playerIndex)

            if contextMenu:isVisible() then

                contextMenu:closeAll()

            end
#

Wish they all looked so reasonable

vast nacelle
#

Would pz_techsupport be the place to report a bug? Several jacket's clothing xmls have m_MasksFolder and m_UnderlayMasksFolder defined to "C:\zomboid\Game\media\textures\[...]" rather than "media\textures\[...]" which makes those mask folder defines invalid.

#

Doesn't cause any noticeable problems... until you try to apply masking to something that isn't commonly masked. Like shoes with custom models.

#

Then wearing those jackets will break the masking on the shoes.

thick karma
#

Okay! Currently my sort-of-untitled Aiming Hides Everything mod literally hides the following when I aim:

    the context menu,
    the fishing menu,
    the crafting menu,
    the mechanics menu,
    the inventory menu,
    the loot menu,
    the info panel (health, etc.), 
    the debug menu
    the debug console (a bit finicky, but mostly works),
    the chat box,
    the server info box,
    the user panel,
    the safehouse menus,
    the faction menus,
    the safe zone menu,

Can anyone think of any in-game pop-ups that could in theory be in the way when you are about to be attacked and could be canceled by aiming? (Manu Menu wouldn't "count" because you cannot aim without modding while in Main Menu.)

gilded hawk
blissful salmon
sinful dove
#

Is there a complete pack mod that has every good basic thing? Then maybe we can just add more on top of that pack.

gilded hawk
#

I'm using sumneko lua

gilded hawk
mellow obsidian
#

make a deathmatch server

#

on a small map

#

like that one game cod or something

sinful dove
blissful salmon
thick karma
#

@bronze yoke @ancient grail @weak sierra @gilded hawk One more update just pushed to my UI-hider: default hud visibility!. Load up with your HUD hidden from the start. (I try.)

fast galleon
#

Anybody know how to use the new good / bad color system? I haven't checked yet.

thin dirge
#

so in the terms, your not allowed to sell mods?

fast galleon
#

I think I found it

ISBlacksmithMenu.ghs = " <RGB:" .. getCore():getGoodHighlitedColor():getR() .. "," .. getCore():getGoodHighlitedColor():getG() .. "," .. getCore():getGoodHighlitedColor():getB() .. "> "
ISBlacksmithMenu.bhs = " <RGB:" .. getCore():getBadHighlitedColor():getR() .. "," .. getCore():getBadHighlitedColor():getG() .. "," .. getCore():getBadHighlitedColor():getB() .. "> "
#

and I have no idea how to put battery in battery charger

#

let's disable all mods

#

no still no option

pine fiber
hearty dew
#

can embed images too

#

It has some preset colors too e.g. <RED>, if you prefer to use over RGB:1.0,0.0,0.0

fast galleon
fast galleon
undone elbow
#

I wonder how to reduce lag in the craft list (starting from IGUI_CraftUI_OneOf) if there are 500+ clothes items.

#

I disabled sorting and hid unavailable items but it still lags.

weak sierra
#

i use this one

#

yeah

#

the second one i was just about to link

#

that is deployed on multiple servers and u don't have to press 0

#

so

#

yeh

undone elbow
#

Thanks! It's interesting despite it's overriding entire files.

weak sierra
#

yeah not ideal but it fixes it

#

by all means write a version that is less clunk, i'll switch my server to it lol

#

speaking of which i still need to check into your car dismantling mod, i was firmly entrenched with the old one and its patch

#

im so busy cowLay

drifting stump
#

Back when i had time was working on a crafting menu rewrite

#

Do want to eventually get back to it

fast galleon
young edge
blissful salmon
gilded hawk
blissful salmon
#

I thought you probably have an idea because you asked specificly which plugin and had the same 🙂 do you have access to the shared function from java?

#

but my english isn't that great. So it's possible I missinterpet things sometimes...

gilded hawk
#

Oh sorry I did not notice you replied that we have the same lua extension 😅

gilded hawk
blissful salmon
gilded hawk
blissful salmon
safe silo
#

Is it possible to take a section from a UI Panel and use it? I want this part

#

(It's the power source from a Radio - Tænd = Turn on)

weak sierra
#

theoretically yes

#

have to isolate it from the main panel tho

#

those are usually big monolithic walls of code

blissful salmon
#

I have a question beside the normal modding. Is there a way to send strings over tcp to a local ip? I have a raspberry pi with a service listening on a port and I want to send strings to it to trigger some hardware. Is this possible? It don't have to be a general solution to upload on steam or anything. But I also don't want it to break on every update. I also can disable all anticheat function on my private server and read from memory but I like clean solutions 🙂

Long story short: I want to read health of a player and send some commands to my local server onChange...

blissful salmon
#

Again a normal modding question. I'm still looking on my zombie update stuff.
Can I get the framerate from the options or even better the actual framerate to make a counter in the "onZombieUpdate" function? For example I want to calculate the current frames per second and make a counter which only do stuff ever X'th frame to save performance...I want to do stuff only every 100ms or so. Maybe there are better ways to do that. I'm open to suggestions...

bronze yoke
#

at that point it may be more efficient to put your counter on OnTick() and use getCell():getZombieList()

signal ibex
signal ibex
#

You could get a list of zombies and then process them 1 by 1.
Doing 1 every OnTick event

#

If the list runs empty, get a new list of zombies

#

This way you are not trying to do I dunno, 100 zombies at once, depending on how hard your code is

signal ibex
#

You can use that and wahtever you want to write code in even powershell and use that to do fun stuff

#

getFileWriter

drifting stump
drifting stump
blissful salmon
# bronze yoke at that point it may be more efficient to put your counter on OnTick() and use g...

Thx, I already thought at this option. How often does OnTick trigger? Acording to the wiki (https://pzwiki.net/wiki/Modding:Lua_Events/OnTick) it says to avoid that. But I can imagine that onZombiUpdate is way worse. Primary goal is to let a zombie scream if its a reanimated player. This doesn't depend on ms but also shouldn't be a second. In a "far away future" it would be neat if I can slow down the reanimation of a player to make it an "Event" and also speed up this zombie etc.

bronze yoke
#

60 times a second, i think

blissful salmon
#

Also thanks at the other suggestions. I'm thinking about it...

bronze yoke
#

i'm pretty sure OnZombieUpdate is just OnTick per zombie

blissful salmon
#

ok.. then I can stay on the OnZombieUpdate... It's just a performance thing. I saw some mods that just use onZombieUpdate and do their stuff. But this feels not good. At least for me...

blissful salmon
bronze yoke
#

well from what i can tell, where ontick always tries to be 60 times a second, onzombieupdate will be 60 times a second, per zombie, so potentially thousands of times a second

blissful salmon
blissful salmon
drifting stump
#

Lua network related stuff is removed on purpose from the game

#

The only networking you can do is between the client and server with java methods

#

No custom connections are possible

blissful salmon
drifting stump
#

What do you mean

#

The lua interpreter has all the network stuff removed

signal ibex
#

I think it's easier to go with the route of using the game to save data into a text file

#

And your program reads it

blissful salmon
#

Ahm, am I able to add some stuff with which I can achieve this... I fully understand that a steam mod should not be able to stuff like this (because of security). But it's only for personal use.

signal ibex
#

just use like pytho or powershell or sth

blissful salmon
drifting stump
#

You could rewrite the java code and send the patched files to the people you want

blissful salmon
gilded hawk
#

Does anyone know why some clothing can have clipping?

Like, I added some body locations for my clothes but, if I'm wearing a jacket, half the model is missing

As you can see here the yellow duffle bag, is half rendered

blissful salmon
gilded hawk
weak sierra
#

there's an issue with waterproof overalls in ClothesBox Redux (which is handled by Peach now) that does the same

#

it also spews errors nonstop for some players

#

this was an inherited problem the mod already had, though, not Peach's doing afaik

#

but not sure if they know how to fix it since they have not fixed it in their own mod

#

i hope they do, though

#

sick of that happening with some clothing

gilded hawk
#

That's interesting, so It might be a model problem more then a code problem rigth?

blissful salmon
#

@gilded hawk I tried to DM you but Discord tells me that I can.'t. So I just post the message here... Maybe other user can offer me some help.... I'm that "far" that I have a simple cylinder ready to export as fbx.
"Can I ask you in near future about some simple modeling stuff? I already asked in the modeling channel but the tutorial etc. I received to me is to "complicated" for me. I realy have no clue about 3d modeling stuff. So I just wanted to integrate a simple stick (alias stretched cylinder) as a weapon. All the stuff I saw so far is above my simple knowledge of Blender 3.x etc"

gilded hawk
bronze yoke
#

if i check an object's flags on LoadGridsquare it seems they just default to true at that time, does anyone know a workaround?
EDIT: if anyone comes across this in a search, this is not the case, my error was elsewhere

#

i tried putting all loaded squares into a list and operating on them a bit later, but it didn't work for some reason; i'm sure that would've worked if i kept at it a bit but it was really gross so i'm wondering if there's a better way

blissful salmon
weak sierra
gilded hawk
weak sierra
#

i dont think it can animate

#

but u can model and texture fine

#

making a cylinder into a model for in game

#

is basically just

#

export as .x or use a converter to

#

or fbx

#

then put it in the folder

#

create a model declaration in a script

#

then assign it to the "sprite" (game was written in all 2d originally)

#

of a thing

bronze yoke
#

then spend 15 minutes tweaking the scale property

weak sierra
#

i have amazing luck at that

#

lol

#

usually get it right in one or two tries

blissful salmon
weak sierra
#

one more step in there

#

need the model declaration

#

in a script

#

look at an existing mod with models

#

it's pretty self-explanatory

#

but yes, that's all correct besides the omission

blissful salmon
weak sierra
#

in a mod? there's a mod that adds like three melee weapons

#

bushcraft rare weapons

#

smallest one i can think of of the top of my head

blissful salmon
#

Have to go afk. I come back later to this. But thanks so far...

weak sierra
#

mhm

frank gyro
#

is anyone familiar with the "time decreases loot" mod? i need some help getting it working it seems.

#

for MP

frank gyro
#

is brittas weapons mod better than firearms B41?

weak sierra
#

i use VFE and various expanding mods, myself

astral dune
#

I personally like brittas but I haven't tried the others

weak sierra
#

brita's is too bloaty, loot heavy, and full of redundant guns/attachments with no or little practical difference

#

imo

#

but that's a matter of taste

#

never used firearms

#

if ur a gun nut tho brita's has the most and most technically accurate content

astral dune
#

there is a lot of redundancy, ya, but I think that gives variety without forcing you to choose the "best" gun. But I'm also unclear on how much of a difference the stats actually make. I should really try the other gun mods though

bronze yoke
#

i stay away from gun mods as a whole, none of the popular ones seem to really follow the vanilla weapon balance

thick karma
#

Okay... trying to hide the notification for Maintenance level-up... It is not called the same way as Sprinting and Sneaking levels are called. Presumably combat XP works this way, because I get the Maintenance XP from fighting.

I've tried a few things that unfortunately didn't work:

local sendAddXpOriginal = sendAddXp

function sendAddXp(player, perk, number, booleanA, booleanB)

    -- Before
    if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
        zeroSurvivedTime()
    end

    sendAddXpOriginal(player, perk, number, booleanA, booleanB)

    -- After
    if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
        restoreSurvivedTime()
    end

end

local function hidePerkLevelNotifications()

    patchJavaMethodB(zombie.characters["IsoGameCharacter$XP"].class, "AddXP", 

        function(metatableMethod)

            return function(...)

                -- Before
                if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
                    zeroSurvivedTime()
                end

                -- Proceed
                metatableMethod(...)
                
                -- After
                if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
                    restoreSurvivedTime()
                end

            end

        end

    )

    patchJavaMethodB(zombie.characters["IsoGameCharacter$XP"].class, "AddXPNoMultiplier", 

        function(metatableMethod)

            return function(...)

                -- Before
                if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
                    zeroSurvivedTime()
                end

                -- Proceed
                metatableMethod(...)
                
                -- After
                
                if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
                    restoreSurvivedTime()
                end

            end

        end

    )

    patchJavaMethodB(zombie.characters["IsoGameCharacter"].class, "LevelPerk", 

        function(metatableMethod)

            return function(...)

                -- Before
                if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
                    zeroSurvivedTime()
                end

                -- Proceed
                metatableMethod(...)
                
                -- After
                
                if dawnOfTheZed["Hide Perk Level-Up Notifications"] then
                    restoreSurvivedTime()
                end

            end

        end

    )

end

hidePerkLevelNotifications()

This code hides some notifications and produces no errors, but I am not sure if it's 100% well-formed because I'm not 100% what the class fields should look like when they enter the patch function. Also not sure how many other points of entry XP could have.

Any ideas?

#

@hearty dew Your 2 cents would probably be priceless if you find the time to look this over later today. No rush. I'm about to get busy (hence giving up for now on solving it myself after a few hours).

bronze yoke
#

i'm not sure i understand what you're asking, are you asking if this is good code or is it not working for maintenance xp?

astral dune
#

the double spacing is killing me 😫

#

is addXPNoMultiplier the function that's called by maintenance? Its never called from the lua side so patching it won't do anything

thick karma
#

I think the code is good, just not achieving my specific goal.

#

For all I know, I blocked a different XP event of which I'm not yet aware.

thick karma
#

Let me check the decompiles

astral dune
#

The only spot on the lua side that I can see that is increasing Maintenance XP is in ISChopTreeAction, I can't seem to find where it happens in combat

bronze yoke
#

and let me guess, sendAddXP is being used for maintenance xp?

weak sierra
#

i dont think it does

#

i think it's just trees and repair actions

#

but MD_Shrug

astral dune
#

you definitely get maintenance XP from fighting, but that may be only from the java side

bronze yoke
#

maintenance increases on weapon hit

weak sierra
#

hm

#

well even if it's from the java side

#

the UI is through lua normally

#

no?

thick karma
weak sierra
#

there's an addXPNoMultiplier eh

thick karma
weak sierra
#

that's useful information for what i am literally about to work on

#

lol

#

how convenient

thick karma
#

I am not sure what XP it successfully hides, if any

bronze yoke
#

that's why i was telling you these java hooks wouldn't work if it wasn't called from the lua side

thick karma
#

Hiding the Sprinting / Sneaking / Lightfooted XP was a headache lol

astral dune
#

Aside from chopping trees, the only places I see maintenance XP being awarded is in SwipeStatePlayer.connectSwing and SwipeStatePlayer.animevent which aren't called from lua, which means you can't intercept the addition itself. What code actually renders the popup on screen?

weak sierra
#

since ur hiding literally everything why not just intercept that

#

and forget hooking these things

thick karma
#

I also saw connectSwing and animEvent and couldn't figure out how to use them, if it's even sneaky possible

weak sierra
#

just hook all the ui rendering

#

and turn it off

#

and forget about intercepting what calls them

thick karma
weak sierra
#

ah

thick karma
#

I have to maneuver around the AddXP call from Lua to Java to hide it for the events I've successfully hidden so far

weak sierra
#

for my purposes i dont care about hiding such things since they are intermittent and my interest is screenshots

thick karma
#

Not the addTextWithArrow call, that's inaccessible directly.

weak sierra
#

i haven't ever given much thought to where thye are

#

and how much is done in java

astral dune
#

you may be out of luck for maintenance, it doesn't look like the callstack leaves the java side for that one

weak sierra
#

time to java mod the client just to avoid a popup

astral dune
#

which is odd, you'd think the actual render to screen would be lua

weak sierra
#

yeah most if not all UI flows thru lua in my experience

#

that is odd

#

thats why i initially said that

thick karma
weak sierra
#

to just hook the ui

#

well

#

im sure there's some raw functions somewhere down the stack

#

but they may be in java

#

just find all the lowest level rendering calls

#

and tap into the relevant ones

#

that u can from lua

astral dune
#

ISRadioInteractions uses addTextWithArrow, not currently clear on what its doing

thick karma
#

Yeah if I knew any way to hide the UI entirely, including XP notices and crap, without all this detail thinking about hiding specific kinds of UI elements, I would love to do so.

#

Unfortunately that is not how the UI seems to be written on Zomboid's end.

weak sierra
#

but

#

if it calls it from java

#

ur still SOL

thick karma
#

Some AddXP calls appear to be Java-to-Java. I was trying to work backwards from them to a function that triggers them and happens to be exposed, but no success yet.

astral dune
#

ISradioInteraction.doSkill appears to be what actually handles the popup on screen. At least in 41.78

#

its a local function though, may be tricky to patch

thick karma
#

Really?! What file?

astral dune
#

ISRadioInteraction

thick karma
#

Oh duh

#

java....

astral dune
#

ISRadioInteraction.lua

thick karma
#

Okay

astral dune
#

hmmm, it may only be related to when you get skill points from radio/tv broadcasts

thick karma
#

Oh hell you might be on to something here in this file

astral dune
#

doSkill is called by the Interactions, which are a radio thing, I don't even see a maintenance interaction. I think this is a dead end for your current problem, but I think if you want to block ALL popups you're going to have to deal with this too

bronze yoke
#

this is just for the radio/tv -stress +cooking stuff

astral dune
#

ya

#

kinda weird that they excluded maintenance and only maintenance from the radio interactions

thick karma
#

Yo if I change a Lua and run it in SP just to see what would happen, is game gonna be mad?

bronze yoke
#

nope

thick karma
#

Right on... Gonna try something

astral dune
#

Can't tell if 41.78 has changed how the vehicle mechanics menu is rendered or if I've broken something

safe silo
#

Trying to get started with creating a very simple UI:

require "ISUI/ISPanel"

MyUI = ISPanel:derive("MyUI");

function MyUI:initialise()
    ISPanel.initialise(self);
    self:create();
end

function MyUI:prerender() -- Call before render, it's for harder stuff that need init, ect
    ISPanel.prerender(self);
end

function MyUI:render() -- Use to render text and other
    self:drawText("Hello world",0,0,1,1,1,1, UIFont.Small);
end

function MyUI:create() -- Use to make the elements
end

function MyUI:new() -- x, y, width, height
    local o = {};
    x = getMouseX() + 10;
    y = getMouseY() + 10;
    o = ISPanel:new(x, y, 200, 120); -- width & height here
    setmetatable(o, self);
    self.__index = self;
    o.variableColor={r=0.9, g=0.55, b=0.1, a=1};
    o.borderColor = {r=0.4, g=0.4, b=0.4, a=1};
    o.backgroundColor = {r=0, g=0, b=0, a=1};
    o.buttonBorderColor = {r=0.7, g=0.7, b=0.7, a=0.5};
    o.zOffsetSmallFont = 25;
    o.moveWithMouse = false;

    return o;
end

function openUI()
    print("Opens UI")
    local modal = MyUI:new()
    modal:initialise();
    modal:addToUIManager();
end

Events.OnGameStart.Add(openUI)

It doesn't open up. I've followed this guide and even tried copying his example into instead and use OnGameStart to open it also. https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Make an custom UI.md

astral dune
#

MyUI:setVisible(true) and maybe MyUI:setEnabled(true) may also be necessary

safe silo
#

In openUI function?

astral dune
#

yes

safe silo
#

Hmm still didn't work..

#
function openUI()
    print("Opens UI")
    local modal = MyUI:new()
    modal:initialise();
    modal:addToUIManager();
    modal:setVisible(true);
    modal:setEnabled(true);
end
astral dune
#

does that print statement show up in your logs?

fast galleon
#

can you do openUI from console?

astral dune
#

that too

gilded hawk
#

Does "ArrayList:remove" work at all in lua?

#

I can't remove a damn element from this damned ArrayList

astral dune
#

it just takes an index, right? are you passing the right index?

gilded hawk
#

Yes I am passing an idex

#

but the size does not change

safe silo
safe silo
astral dune
#

with arraylist:size?

gilded hawk
# astral dune with arraylist:size?
LOG  : General     , 1666388662600> self.containerList:size()4
LOG  : General     , 1666388662600> self.containerList[zombie.inventory.ItemContainer@1a735c4e, zombie.inventory.ItemContainer@557282d5, zombie.inventory.ItemContainer@5326c1f, zombie.inventory.ItemContainer@285fc3b]
LOG  : General     , 1666388662600> proxInvIDX: 2
LOG  : General     , 1666388662600> -----------AFTER-----------
LOG  : General     , 1666388662601> self.containerList:size()4
LOG  : General     , 1666388662601> self.containerList[zombie.inventory.ItemContainer@1a735c4e, zombie.inventory.ItemContainer@557282d5, zombie.inventory.ItemContainer@5326c1f, zombie.inventory.ItemContainer@285fc3b]
#

Yeah

#
local old_ISCraftingUI_getContainers = ISCraftingUI.getContainers
function ISCraftingUI:getContainers()
    local result = old_ISCraftingUI_getContainers(self)
    if not self.character or not ProxInv.isToggled then
        return result
    end

    -- If ProxInv is enabled:
    -- then remove the first container of getPlayerLoot(self.playerNum).inventoryPane.inventoryPage.backpacks
    local countOfLootContainers = #getPlayerLoot(self.playerNum).inventoryPane.inventoryPage.backpacks
    print('self.containerList:size()'..tostring(self.containerList:size()))
    print('self.containerList'..tostring(self.containerList))
    local proxInvIDX = (self.containerList:size() - 1) - (countOfLootContainers - 1)
    print('proxInvIDX: '..tostring(proxInvIDX))
    self.containerList:remove(proxInvIDX);
    print('-----------AFTER-----------')
    print('self.containerList:size()'..tostring(self.containerList:size()))
    print('self.containerList'..tostring(self.containerList))
    return result
end
fast galleon
safe silo
#

I am! 😄

#

but not sure how to run functions from the lua command line

fast galleon
#

just type openUI() then

astral dune
gilded hawk
#

This is fucking insane why the hell :remove does not work

small topaz
#

Hi! I already asked this question a few days ago but no luck so far in trying the suggestions here from chat. Here it is: When making a new recipe via scripts and requiring that the player needs 5 items to realize the recipe, does anyone knows whether it is possible to allow the player to use 5 items from different categories?

What I want to do is this: The player should be able to craft a new item using 5 berries as ingredient. The game comes with different types of berries: Base.BerryBlue, Base.BerryGeneric1, Base.BerryGeneric2, ... and so on. Now I want to arrange things so that players can use any combination of those berries as long they have 5 berries in their inventory. For example 5 Base.BerryBlue should work but also 2 Base.BerryBlue + 3 Base.BerryGeneric1.

I already tried to include constructions like this in the recipe.txt but nothing worked for me:

Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2 = 5

or

[Recipe.GetItemTypes.Berry] = 5

or

Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2,
Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2,
Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2,
Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2,
Base.BerryBlue/Base.BerryGeneric1/Base.BerryGeneric2,

The first two required the player to have 5 berries of one and the same type (i.e. only 5xBase.BerryBlue or 5xBase.BerryGeneric1 and so on but not possible to mix up different berries). The latter one allowed the player to realize the recipe with only one berry and then produced errors. Thanks for any help!

astral dune
#

Can recipes use tags?

gilded hawk
#

Sooo, :remove() on anarraylist works if you are passing the object you want to remove but not the index, this is fucking insane man

astral dune
#

oh ok, they must only expose that overload and not the base version. I'm surprised that actually works from the lua side, pretty slick all things considered

gilded hawk
#

I want to detonate my PC and and start farming irl after this

small topaz
# astral dune Can recipes use tags?

problem with tags is that there might be other things containing the string "berry" which should not be added to the recipe. for example strawberries

astral dune
#

make your own tag and assign it to the berries you want to use

small topaz
astral dune
#

yes, exactly. Like itemtweaker does

small topaz
astral dune
#

If not that, I notice the scripts for most berries include FoodType = Berry and HerbalistType = Berry, dunno if you can use those

astral dune
small topaz
#

ah ok! XD

small topaz
astral dune
#

their Type is just Food, so I wouldn't expect that to work

small topaz
#

this Recipe.GetItemTypes is a custom function. it is also used in various vanilla recipes like Recipe.GetItemTypes.Sugar but it doesn't seem to provide the features I am looking fo

astral dune
#

If you want a custom function you gotta write it

#

you can make something like

function Recipe.GetItemTypes.Berry(scriptItems)
    scriptItems:addAll(getScriptManager():getItemsTag("Berry"))
end
small topaz
#

yeah... what I meant: there are already similar vanilla functions as Recipe.GetItemTypes.Sugar and I wrote a function Recipe.GetItemTypes.Berry in the same way but it didn't work for me.

astral dune
#

what does your function look like?

small topaz
#

the vanilla Recipe.GetItemTypes.Sugar also doesn't allows the player to use different types of sugar like "Base.Sugar" or "Base.BrownSugar" for example (I playtested). therefore not sure if this will help

astral dune
#

that is weird, since the function explicitely adds brown sugar

function Recipe.GetItemTypes.Sugar(scriptItems)
    scriptItems:addAll(getScriptManager():getItemsTag("Sugar"))
    addExistingItemType(scriptItems, "SugarBrown")
    addExistingItemType(scriptItems, "SugarPacket")
end
small topaz
astral dune
#

ah ok, you may be out of luck then

small topaz
#

yeah... I fear so.... only workaround I can think of so far is to implement the whole recipe via lua coding

#

😶

astral dune
#

have you tried something like

[Recipe.GetItemTypes.Berry] = 1,
[Recipe.GetItemTypes.Berry] = 1,
[Recipe.GetItemTypes.Berry] = 1,
[Recipe.GetItemTypes.Berry] = 1,
[Recipe.GetItemTypes.Berry] = 1,
small topaz
willow estuary
#
Recipe Make Something
{
 ExampleItem1/ExampleItem2/ExampleItem3,
 ExampleItem1/ExampleItem2/ExampleItem3,
 ExampleItem1/ExampleItem2/ExampleItem3,
 ExampleItem1/ExampleItem2/ExampleItem3,
 ExampleItem1/ExampleItem2/ExampleItem3,
 ExampleItem1/ExampleItem2/ExampleItem3,

Result: ExampleResult,
}
small topaz
#

this is the error which is then generated:

STACK TRACE

Callframe at: PerformMakeItem
function: perform -- file: ISCraftAction.lua line # 58 | Vanilla

ERROR: General , 1666392633221> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method).
ERROR: General , 1666392633221> DebugLogStream.printException> Stack trace:
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at se.krka.kahlua.integration.expose.caller.MethodCaller.call(MethodCaller.java:62)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:198)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:188)
at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:182)

willow estuary
small topaz
#

setting all this into module Base { } probably??

small topaz
willow estuary
#

Huh, beats me then?

small topaz
#

in this screenshot I just play-tested the code (no other codes or mods enabled

small topaz
willow estuary
#

I guess having multiple identical ingredient fields breaks a recipe; never was anything that was needed in vanilla so doesn't surprise me?

small topaz
#

yeah. I also guess this is due to some strange duplication issues

toxic mica
#

There’s this mod that puts Ford trucks in the game. Especially four door ones. Does anyone know by chance which mod it is? I tried looking for it no luck.

thick karma
#

I actually discovered the green arrow text function is exposed and tried modding it to silence it, but unfortunately it didn't work or I did it wrong. Gotta revisit later... may be a dead end. 😭

jade chasm
#

Hey guys I got my art gallery guaranteed spawn working!! Mod to be published soon. Thank you to everyone for providing resources that helped me out.

brazen grove
#

I have a question that I'm really hoping someone can help me with....
I've made a book, skinned it, everything is great, until I use the book to read it... the skin it then uses reverts back to the original book when reading. How can I change this? Where do I look up this skin/model for when reading this book?

glacial flicker
#

How does one find the name of a tile to make use of it in a mod?

vast nacelle
# brazen grove I have a question that I'm really hoping someone can help me with.... I've made ...

Have you created/defined a WorldStaticModel and a Static Model?

{
DisplayCategory = SkillBook,
Weight    =    0.1,
Type    =    Literature,
DisplayName    =    Some Book,
Icon    =    SomeBook,
ReplaceOnUse    =   SomeBook,
StaticModel = SomeBookOpen, <--- Used when reading the book
WorldStaticModel = SomeBookClosed, <--- Used when placing the book on the ground
}
model SomeBookClosed
{
mesh = WorldItems/SomeBookOpen,
texture = WorldItems/SomeBook,
}
model SomeBookOpen
{
mesh = WorldItems/SomeBookOpen,
texture = WorldItems/SomeBook,
scale = 0.4,
}```
small topaz
#

is there a quick way to append two java.util.ArrayLists without iterating through them?

ancient grail
gilded hawk
#

🎉

brazen grove
small topaz
#

Hey there! Does anyone knows what those strange error messages mean?

ERROR: General , 1666406172835> RenderThread.logGLException> OpenGLException thrown: GL Error code (1286) encountered.
Error translation: Invalid framebuffer operation (1286)
While performing: TextureID.noMips.start
ERROR: General , 1666406172847> ExceptionLogger.logException> Exception thrown org.lwjglx.opengl.OpenGLException: GL Error code (1286) encountered.
Error translation: Invalid framebuffer operation (1286)
While performing: TextureID.noMips.start at PZGLUtil.checkGLErrorThrow line:23.
ERROR: General , 1666406172848> DebugLogStream.printException> Stack trace:
org.lwjglx.opengl.OpenGLException: GL Error code (1286) encountered.
Error translation: Invalid framebuffer operation (1286)
While performing: TextureID.noMips.start
at zombie.core.opengl.PZGLUtil.checkGLErrorThrow(PZGLUtil.java:23)
at zombie.core.textures.TextureID.generateHwId(TextureID.java:592)
at zombie.core.textures.TextureID.createTexture(TextureID.java:508)
at zombie.core.textures.TextureID.createTexture(TextureID.java:491)
at zombie.core.opengl.RenderContextQueueItem.invoke(RenderContextQueueItem.java:77)

#

one user of my mod reports them but I have no idea what this is about. is this even caused by a mod or more a system issue?

bronze yoke
#

what does your mod do?

small topaz
# bronze yoke what does your mod do?

it adds some anatomically correct nude texture to male and female characters (ra's body mod). all those features are essentially clothing items which are automatically equipped to the player. but I think this error maybe a non-standard issue. never seen it before and for the vast majority of users, the mod seems to work flawless

bronze yoke
#

hmmm it could be related, this is a graphics engine crash

small topaz
#

maybe graphic card too weak??

#

btw I can also not reproduce the error by myself

bronze yoke
#

most likely

#

i think i've seen errors like this to do with lack of video memory

astral dune
#

could just be an old video card that doesn't support certain openGL operations

#

hmmm ,it would have to be real old

#

either way, unless you're writing custom shaders for your texture this one isn't really your fault and I doubt there is much you can do

bronze yoke
#

unless your texture is insanely high resolution or something it's out of your hands

astral dune
#

hey albion, you're running the unstable build right? Does your mechanics window look like this?

bronze yoke
#

give me a second

small topaz
astral dune
#

I don't remember all the parts being colored like that all the time before, also can't seem to right click on the hood anymore. Not sure if I broke something or not

#

ah ok

bronze yoke
#

they did make some changes to the mechanics ui this update, don't remember if the colours looked this way but i can right click the hood

#

this is all i remember seeing in the patch notes

astral dune
#

I notice they added % of gas and ... ya that

bronze yoke
#

oh you mean right clicking the hood on the picture? i didn't even know you could click those...

#

yeah, i can't right click it there

astral dune
#

ya, you can, but its always been a little hit and miss

small topaz
astral dune
#

integrated graphics, rip

small topaz
#

i think it is a quite old model (from 2011 or so???)

bronze yoke
#

yeah that's pretty weak, it's unfortunate

astral dune
#

tell them to update their opengl/graphics drivers as far as they can and hope for the best, but honestly that is meant to be showing spreadsheets

bronze yoke
#

make sure they've turned on texture compression

#

i'd be surprised if the game was running without it on that thing but just in case

bronze yoke
#

you couldn't right click the hood even then though

astral dune
#

ya, that's more familiar, they only turned red when broken, and maybe green for a second after being repaired

#

thanks for having a look

#

still slogging through this UI stuff, but we're getting there

bronze yoke
#

the bright colours are a little garish honestly, i hope that's easy to mod back

astral dune
#

ya, assuming its not a bug I imagine the did it for quicker identification of issues, but the color of the %s beside the part names was good enough imo

bronze yoke
#

it's part of their big push with this 'good colour/bad colour' feature i think

astral dune
#

good colour bad colour?

bronze yoke
#

it's a great idea, particularly for accessibility

#

yeah basically in the unstable build you can set your 'good colour' and 'bad colour' (green and red by default, as in previous builds) and these colours will show up everywhere in the ui

astral dune
#

thats pretty nice, R/G colorblindness is super common. All the UI's I build for work I take careful note of which colors I use

ruby urchin
#

Any snippet to check if a object is N, W, S, E dir?

kindred dagger
#

Not sure. Maybe take a look at the item with the chunk debugger in admin mod? If anything you'll be able to tell the sprites

ancient grail
ruby urchin
#
local getWindowSquare = function(window)
    local north = window:getSprite():getProperties():Is(IsoFlagType.WindowN);
    local west = window:getSprite():getProperties():Is(IsoFlagType.WindowW);

    if north then
        local square = window:getSquare()

        if square == window:getIndoorSquare() then
            local extSquare = getCell():getGridSquare(square:getX(), square:getY() - 1, square:getZ());

            return { square, extSquare };
        end

        return { square, window:getIndoorSquare() };
    end

    if west then
        local square = window:getSquare();

        if square == window:getIndoorSquare() then
            local extSquare = getCell():getGridSquare(square:getX() - 1, square:getY(), square:getZ());

            return { square, extSquare };
        end

        return { square, window:getIndoorSquare() };
    end

    return nil;
end
kindred dagger
#

Do you know how to get the item type of a moveable? I'm trying to get HamRadio1 or Base.HamRadio1 from a placed down radio but I can't figure it out.

ancient grail
#

if instanceof(tObj, "IsoRadio") then

kindred dagger
#

I specifically need to return HamRadio1, not any other kind of radio. Otherwise I'm already using that snippet to check the frequency

#

Currently doing it with getSprite():getName() but I was wondering if there was a better way

#

(Not at home so can't show my code atm)

fast galleon
kindred dagger
#

Oh, I'll have to give that a try then. getType():getFullType() ?

fast galleon
#

Full type includes also the module, like base if you need it.

kindred dagger
#

Yeah that'll do. I'll do a string.find(type, "HamRadio") to include all ham radios so module probably doesn't matter

#

Thanks for your help 👍

fast galleon
#

then maybe start with just getType

kindred dagger
#

I tried that and it did not work, so maybe I was missing something

fast galleon
#

Print the item you're using it on to see what you have.

kindred dagger
#

How do you do that again? I don't use the in-game console much. My function checks all objects in a radius around the player then checks if it's a radio, turned on, on the right frequency, then the sprites to make sure it's the exact radio I need

fast galleon
#

yeah sorry, doesn't work

#

getDeviceData():getDeviceName()
works but could be translation name

kindred dagger
#

I tried that, it is, unfortunately. Better Sorting changes the radio names and messed up my mod, that's how I figured it out

small topaz
#

when playing the game in split screen, how do I get the second player?

hearty dew
summer rune
#

How can I spawn a Container in the world, like a kitchen counter ? Any snippet you can point me to?

hearty dew
# small topaz when playing the game in split screen, how do I get the second player?
--[[
    Gets all players matching a predicate. The default predicate is all players that aren't dead.
    
    Usage example:
    local all_living_players = LUtils.getPlayers()
    local all_players_named_bob = LUtils.getPlayers(function(p) return p:getDisplayName() == "bob" end)

    Notes:
    getNumActivePlayers:
    - Singleplayer: number of local players in client (including all split screen players)
    - Client: number of local players in client (including all split screen players)
    - Server: 1, but getSpecificPlayer() calls always return nil on server
    
    getOnlinePlayers:
    - Singleplayer: nil
    - Client: lists all players (including split screen players)
    - Server: lists all players (including split screen players)
    
    getConnectedPlayers: trash. only seems useful for working with scoreboard?
    - Singleplayer: 0
    - Client: only updates when a player manually open scoreboard, but lists all players then
    - Server: 0
]]
#

getNumActivePlayers

small topaz
hearty dew
small topaz
hearty dew
#

getSpecificPlayer only looks up the 4 local players (getNumLocalPlayers will return 1-4 as I recall). getSpecificPlayer(0) happens to return the first player, and many mods use that to get the one local player, but that relies on the assumption that it will always return the 1st split screen player. It is better to get the player object from some other context (e.g. the player that is associated with whatever action was taken that resulted in the code to run)

If some user is playing online multiplayer while splitscreen (like him and friend on couch are joining the same dedicated server), that can be an issue

#
razabUtils.getPlayers = function(predicate)
    local result = {}
    predicate = predicate or function(player)
        return not player:isDead()
            -- and player:getCurrentSquare() -- Will filter out players sufficiently far from client that their square isn't loaded
    end
    if not isClient() and not isServer() then
        -- singleplayer
        for i = 0, getNumActivePlayers() - 1 do
            local player = getSpecificPlayer(i)
            if player and (predicate == true or predicate(player)) then
                table.insert(result, player)
            end
        end
    else -- multiplayer
        local onlinePlayers = getOnlinePlayers()
        for i = 0, onlinePlayers:size() - 1 do
            local player = onlinePlayers:get(i)
            if player and (predicate == true or predicate(player)) then
                table.insert(result, player)
            end
        end
    end
    
    return result
end
#

Basically, my advice would be:

  1. Use an existing context to get the player object if at all possible
  2. When not in singleplayer, if can't do 1, use getOnlinePlayers to get other players
  3. When in singleplayer, if can't do 1, use getNumActivePlayers with getSpecificPlayer to get other (splitscreen) players
fast galleon
kindred dagger
#

I could do that, true

fast galleon
#

Fun fact I used to place the myModule.ItemName and pickup a moveable.spritename item...

#

autoconversion from game

small topaz
hearty dew
#

getPlayer is the same as getSpecificPlayer(0). Same issues, yes

#

Same advice I said about getSpecificPlayer applies to getPlayer. I'd not use that api (unless I'm okay with not properly handling split screen)

#

so in most cases, I just use the "player" which is given to me by event which may work out of the box?
Yes, this is ideally what to do, get the player object from some existing context (e.g. the event that the player initiated)

thick karma
#

After further testing... I AM hiding Weapon perk level-up pop-ups. Maintenance is the ONLY mf green halo text for leveling that seems to appear when I am hiding HUD... Ugh what a mystery

hearty dew
small topaz
# hearty dew If you have a specific scenario when you don't have a context to get a player fr...

oh many thanks!. I try: whenever a new game starts or a game is loaded, I automatically equip the player certain cothing items. for loading a game, I use the event OnGameStart but this doesn't have a player variable as parameter (at least according to the wiki: https://pzwiki.net/wiki/Modding:Lua_Events/OnGameStart ). I therefore used just player=getPlayer() in this case and this is probably the problem. the people reporting the problem even said that the main problems occur when the second split-screen player leaves game and enters again...

fast galleon
#

Maybe the onCreatePlayer event would be fitting

hearty dew
frosty estuary
#

I need to check a item modData right when it is about to be picked up from the floor. Which function can I override to check it?

small topaz
fast galleon
frosty estuary
small topaz
#

still another but related question: in a lot of cases, vanilla functions have a variable "player" as argument. in those cases, is it safe to simply use this variable for accessing the player or is it better to do something special before I access, for example smth like

local playerObj = getSpecificPlayer(player)

?

#

and let's say that the vanilla function also only uses the player variable for accessing the inventory or skills for example...

hearty dew
small topaz
frosty estuary
#

Or if there is another one to use, because you said that there is some kinks if I have to edit the modData, which is what I need to do.

thick karma
#

BUAAA BUAAAHAHAAAA

#

@bronze yoke I may have a somewhat-but-not-all-that-wonky workaround

#

OnWeaponSwing can solve the combat Maintenance side of hiding XP notifications for me.

#

Buaaaaaaa buaaaahahaaaaa

#

IT WILL ALL BE HIDDEN

#

I WILL HIDE THE WORLD

fast galleon
#

That's for when I pick up things

#

for placing it goes after the original

#

the findonsquare is similar to the vanilla function

#

ISMoveableSpriteProps:findOnSquare( _square, _spriteName )

blissful salmon
#

Question about "transmitCompleteItemToServer()"
When exactly do I have to call this? For example if I set
self.character:getBodyDamage():getBodyPart(BodyPartType.Hand_R):SetScratchedWeapon(true);
do I have to call it on the character in multiplayer games?

frosty estuary
#

Thanks, I will try it

thick karma
#

What did I mess up sigh

fast galleon
frosty estuary
#

A regular item that I'm setting to function as a sensor, the mod data is to set it as active or inactive, if it is active on the floor, when the player grab it back I need to set the data to inactive again

hearty dew
#

If you're just dealing with regular inventory items (not moveables, like couches and stuff you need to go into place mode to pick up), you might need to look at ISInventoryItemTransferAction

frosty estuary
fast galleon
#

Yeah it's a different action then.

hearty dew
#

There's no way for additional split screen players to send chat messages, is there?

small topaz
# drifting ore i'm trying to modify/add to stats and things

you can modify stats of the player as well as stats of the food items in question. as pseudocode, it is smth like player:setUnhappyness(10) or foodItem:setUnhappyness(10). dont know the excat syntax by head an write on my mobile phone. but you can just search the project zomboid java doc to find the relevant commands (try searching for unhappyness or unhappiness for example)

blissful salmon
# blissful salmon Question about "transmitCompleteItemToServer()" When exactly do I have to call t...

After searching the lua code I only found this in the context of placing worlditems. So I assume it's just releated to stuff in the "world". Now I asked myself what is about ":transmitModData()" for example of a zombie. Do I have to call this after I modified some data or does it automaticly syncing with all clients and server?
For example:

local modData = zombie:getModData()
--do stuff with modData
zombie:transmitModData()

When I use this code for example on a server can I use the modData added on the client? As I understand it this is the case...
Is there a general tutorial how modData works?

bronze yoke
#

it does not automatically sync, as you often don't need to sync it, and sometimes specifically don't want to

blissful salmon
bronze yoke
#

items exist entirely(?) on the client, so there's not really any way for them to not sync moddata

blissful salmon
#

Thx, I'll have a look.

blissful salmon
#

(Because these are not only existing on the client)

bronze yoke
#

yes, as far as i know literally everything but items need manual synchronisation

blissful salmon
#

ok, thx...Slowly I'm beginning to understand...

placid delta
gilded hawk
#

I was thinking, this code can be used to achieve debouncing, kinda like I do it in javascript using setTimeout

function debounce(func, timeout = 300){
  let timer;
  return function(...args) {
    if (timer) {
      clearTimeout(timer);
    }
    
    timer = setTimeout(() => {
      func.apply(this, args);
    }, timeout);
  };
}
ancient grail
#

function WetWeight()
local modif = 0
local pl = getPlayer() 
local inv = getPlayer():getInventory()
local it = getPlayer():getInventory():getItems()
local isize = getPlayer():getInventory():getItems():size()

if it:isEmpty() then return end
for i = 0, isize - 1 do 
if it:get(i):IsClothing() and it:get(i):getWetness() ~= nil and it:get(i):getWetness() > 0 then
modif=((it:get(i):getWeight())+(it:get(i):getWetness() * 0.01))
it:get(i):setWeight(modif)
it:get(i):setCustomWeight(true)
end
end 
inv:setDrawDirty(true);
pl:getHumanVisual()
end

function CheckUnliCarry()
if not getPlayer():isUnlimitedCarry() then 
Events.OnKeyPressed.Add(WetWeight);
Events.OnContainerUpdate.Add(WetWeight);
Events.OnGameStart.Add(WetWeight);
end
end
Events.OnPlayerUpdate.Add(CheckUnliCarry)
astral dune
#

I think I'm getting a hang of OO with lua, still need to do some proper tests but i think I can succesfully store an "object" in modData and restore its full functionality when loading it again later

bronze yoke
#

does anyone know if i can add translation strings programmatically? i have some item names that could be constructed by combining strings that already exist

#

nevermind, i think i can do this by messing with the item script

astral dune
#

if not, it looks like the Translator class is exposed, so you may be able to pull it off

astral dune
#

its much simpler than I make it seem

bronze yoke
astral dune
astral dune
# weak sierra please elaborate :p

Best I can tell, you can't store userdata or functions in moddata, it doesn't save. If you build your object around that, as well as give it a constructor that can take an "instance" of itself, then you can reinitialize that moddata as the object. It even remains in the same place in memory

hearty dew
astral dune
#

take for example this prototype

function EnginePart.new(obj)
    local instance = type(obj) == "table" and obj or {}
    setmetatable(instance, EnginePart)
    instance.category = instance.category or "Other"
    instance.condition = instance.condition or 100
    instance.name = instance.name or error("Part must have name")
    instance.type = instance.type or error("Part must have type")
    return instance
end

if its passed a table, which we'll have to assume is or was an EnginePart at some point, it reinitializes it as an instance of EnginePart so you can call its instance functions again

#

I made the mistake of including some enumerators and such in the original object, which bloats the moddata representation of that, which is why I feel you have to be cognizant of the fact you're trying to store the instance when its not in use

bronze yoke
#

well yeah, if you just don't store it as an object it works

astral dune
#

well, unless its an object you pulled from java, there aren't really any objects, just tables

#

the functions that are assigned to this object disappear in the moddata, but reinitializing it like this restores them later

hearty dew
astral dune
#

the #modeling channel is probably a better bet tbh

last flax
#

I follow this

#

but okay

astral dune
#

someone here may be able to help, not kicking you out, just saying the people who do this stuff all day are in that channel

last flax
#

okay thanks for the info

astral dune
ancient grail
#

When i
item:setWeight()
It works but the players inventory capacity doesnt show that

Why? 😮‍💨angry cold hungover ded

bronze yoke
#

might need to redraw, does it update if you move an item from/to your inventory?

ancient grail
#

Nope

hearty dew
#

Yea, there's a function in the inv pane or inv page (I forget which) to redraw those capacity numbers, if I remember right. You might check what exactly they calculate when they redraw the text

ancient grail
#

The weight is changed as u can see here 😦

#

So i need to look for "redraw"?

#

So this means that the weoght is actually applied its just the string thats not showing it?

hearty dew
#

It is in function ISInventoryPage:prerender()

astral dune
#

Just reposting this here since I don't think they believed me when I said I wasn't kicking them out 😭
#modeling message

ancient grail
#

And i cant just use to that? Imean call that function

astral dune
#

discord doesn't do previews of linked discord posts? ridiculous

ancient grail
astral dune
#

well hopefully someone somewhere can help

weak sierra
#

that is odd

astral dune
#

forgot I had modded my java and now 41.78 has undone it 😭

astral dune
ruby urchin
hearty dew
# hearty dew Can give you latest version if you want. Let me try to fix it up a bit, was in m...
local defaultMessageSettings = {
  textColor = {r = 0.3, g = 1.0, b =0.0},
  showAuthor = true,
  shouldAttractZombies = true,
}

harrisonUtils.addChatTab("my fancy tab title", "my fancy chat",
    "/fancy", "/f", defaultMessageSettings)

@thorn bane Today I updated the custom chat tabs with most of the vanilla java-side chat message features working, color, overhead text, server alert, zombie attraction. The interface changed a bit since the previous version. I think the interface is pretty settled though. Let me know how you like it or if anything is missing. Wondering if I should handle sending messages to other clients or if that should be left to clients.

alpine scroll
hearty dew
alpine scroll
#

Thank you

trail lotus
#

any good modders looking to make a couple dollars? i may have a job for you. i host a custom server that resembles living in a player ran economy with no zombies. its only in alpha at the moment how ever its being worked on quite a bit. if you'd like to join the team let me know we are always working on something!

#

my main focus right now is a respawn system. obviously in regular pz you die you make a new character. i wanna keep players from making new players and limit them to one rp character. when they die id like keys to stay persistent to them and be removed from the dead character (basically make the key chain virtual) also we are in need of a license system. im hoping to create a virtual wallet that player given licenses and certs can be placed in and will be virtual same as the keychain. otherwise a simple ui that displays the licenses would work as well. maybe a "ask to inspect licenses" and when the license holder accepts it displays the license that said character has.

bronze yoke
#

i'm always looking for something to do!

trail lotus
#

let me know if anyones interest we have lots of other projects as well and will grow as time goes on the server is 100+ members 🙂

#

i could gladdly use other types of modders as well! moddling and so on.

gilded hawk
#

Is it possible to "require" and hook to a local function?

hearty dew
#

Not easily, if at all. You might be able to read a file into a function (using getModFileReader and loadstring)and run the function with an environment you control using setfenv (then do something about preventing the original from loading e.g. shadowing the original with your own file that has the same path), but I haven't tried it yet

trail lotus
#

anyone wanna look into a simple phone ui? like if i have a phone i can text other players if i have their number. also possibly voicecall? also a side implentation with admin placeable payphones would be awesome. this is for a custom rp server

#

i say simple but im sure its utterly complex. id slide some money for server use.

reef zealot
#

Does anyone know how I would go about modifying the vehicle door behavior? I'm not sure the specifics of what I want to do, but I'd like to modify the size of the hitbox for getting in and shorten the timer. I see the code in VehicleCommands.lua for door opening that makes sure the door isn't locked and does exists, and I'm assuming that I'd need to modify whatever args.open is to accomplish this? I'll admit I don't know much about lua, I do know some python so lua does look at least a little familiar, I assume args.open is a function located somewhere else but I have no idea where that would be.

bronze yoke
#

args.open sounds like a property of a table 'args'

reef zealot
#

ok, and where would I start looking for that table?

thick karma
astral dune
#

I'm pretty sure the area you need to stand in to open the door is part of the vehicle scripts. You could either alter the scripts in your mod or use something like vehicle tweaker to do it

#

Opening the door I'm not sure of, may be a TimedAction. VehicleCommands is a local table so you can't access anything going on there very easily

reef zealot
#

the bit I'm referring to is
function Commands.setDoorOpen(player, args) local vehicle = getVehicleById(args.vehicle) if vehicle then local part = vehicle:getPartById(args.part) if not part then noise('no such part '..tostring(args.part)) return end if not part:getDoor() then noise('part ' .. args.part .. ' has no door') return end part:getDoor():setOpen(args.open) vehicle:transmitPartDoor(part) else noise('no such vehicle id='..tostring(args.vehicle)) end end
located in <game root>/media/lua/server/VehicleCommands.lua

#

I couldn't find anything that seemed relevant to it being a TimedAction

bronze yoke
#

you'd want to find where this command is sent from, the args are going to be set there

#

search setDoorOpen in your ide and see what comes up

thick karma
astral dune
#

setDoorOpen is called by the timed actions ISCloseVehicleDoor and ISOpenVehicleDoor, unsurprisingly

#

I think it actually only opens the hood

#

Vehicles.Use.Door in Vehicles.lua might be a better place to start looking

reef zealot
#

I don't know about the hood but I do know when you enter or exit a vehicle it outputs information about vehicle setDoorOpen and what specific door is being set to open

#

and I don't see anything relevant to the timer for entering the vehicle under Vehicles.Use.Door

#

to my understanding timedactions are only for actions that have an animation? There are references to timedactions for the hood and trunk but not for the normal doors