#mod_development

1 messages ยท Page 36 of 1

hearty dew
#

We did. There was only self and the original returned nothing ๐Ÿ˜…

hollow current
#

aaa

hearty dew
#

That's me deflecting blame btw :p

hollow current
#

haha

#
function ISMoveableSpriteProps:pickUpMoveable()
  return items
  original_ISMoveableSpriteProps_pickUpMoveable( _character, _square, _createItem, _forceAllow )
end```
#

so, like this, ye?

hearty dew
#

I suppose it'd be best to pass arbitrary args and always return the result to be best compatible if they change the function in the future to future proof yourself

local original_ISMoveableSpriteProps_pickUpMoveable = ISMoveableSpriteProps.pickUpMoveable

function ISMoveableSpriteProps:pickUpMoveable(...)
  -- pre stuff
  local result = original_ISMoveableSpriteProps_pickUpMoveable(self, ...)
  -- post stuff
  return result
end
hollow current
#

oh items is not even a global var

hearty dew
hollow current
#

How'd you go about patching AddItem?

hearty dew
#

It is a java object. Their functions live in a metatable (It's how kahlua exposes java APIs in the lua code)

#

I have a utility to do that, sec

thin junco
#

Hey i got an question for you guys since someone might know how mods work

#

Do i need to put certain mods at c/users/zomboid/mods in order for them to work properly?

#

I used to do them a year ago but problem is

-it takes more space
-need to manually update it every time an mod updates

#

And i am hosting an Local server

hearty dew
# hollow current How'd you go about patching AddItem?
ArendamethUtils = ArendamethUtils or {}

--[[
    Usage example:
    
    ArendamethUtils.patchClassMethod(zombie.inventory.types.Moveable.class, "getDisplayName", function(original_fn)
            return function(self, arg1, arg2, ...)
                local modData = self:getModData()
                if modData and modData.new_value then
                    return modData.new_value
                end
                local result = original_fn(self, arg1, arg2, ...)
                result.someProperty = false
                return result
            end
        end)
]]
ArendamethUtils.patchClassMethod = function(class, methodName, createPatch)
    local metatable = __classmetatables[class]
    if not metatable then
        error("Unable to find metatable for class "..tostring(class))
    end
    local metatable__index = metatable.__index
    if not metatable__index then
        error("Unable to find __index in metatable for class "..tostring(class))
    end
    local originalMethod = metatable__index[methodName]
    metatable__index[methodName] = createPatch(originalMethod)
end

Sec, I need to lookup the right java class

hollow current
hearty dew
#

For mods you download via steam, they go into a different directory and don't need to move them around manually

fast galleon
thin junco
#

Do i just need to put all of them though?

#

For example brita's weapons causes the server to not start, wonder if putting it on zomboid/mods will fix it

hearty dew
#

For mods I'm developing to upload to workshop, I have them in Zomboid/Workshop

thin junco
#

Or some not working mods

hearty dew
#

There are 3 places mods are loaded from

thin junco
#

Yeah i know

hearty dew
thin junco
#

I host my server without putting any mods at zomboid/mods

1 year before i used to put it all in zomboid/mods then host it

#

So putting an mod in that directory won't matter?

hearty dew
#

It won't make a difference if the mod is in Zomboid/mods or in the directory steam automatically installs mods to

#

(when running pz in steam mode)

#

If you are running -nosteam, pz will ignore mods installed in the steam mod directory. In which case, you should put them in Zomboid/mods

thin junco
#

but since I am hosting an local server I have to not use -nosteam yes?

#

for my friends to join

hearty dew
# hearty dew ```lua ArendamethUtils = ArendamethUtils or {} --[[ Usage example: ...
LOG  : General     , 1665821550646> ----------  zombie.inventory.ItemContainer@38d138b4  ----------
----------  Fields  -----------
----------  Methods  ----------
InventoryItem                        AddItem                       (String)
boolean                              AddItem                       (String, float)
InventoryItem                        AddItem                       (InventoryItem)
ArrayList<InventoryItem>             AddItems                      (String, int)
void                                 AddItems                      (InventoryItem, int)
InventoryItem                        DoAddItem                     (InventoryItem)
InventoryItem                        DoAddItemBlind                (InventoryItem)
InventoryItem                        AddItemBlind                  (InventoryItem)

Sorry, wanted to finish this so I could look up java methods in the console.. Need to patch AddItem on the ItemContainer class

hearty dew
#

Because that java method is overloaded, need to check the parameters too

hollow current
#

you should really upload all of those utils somewhere for others. They prove to a be useful in a lot of cases

hearty dew
#
if instanceof(item, "InventoryItem") then
  -- case I'm interested in
else
  return original_fn(self, item, ...)
end
hearty dew
# hollow current you should really upload all of those utils somewhere for others. They prove to ...

I'd have to think of way to do that that doesn't end up with versioning issues like other APIs have encountered, e.g. the ItemTweaker api. The way the steam workshop and pz mods do dependencies and multiple versions of the same file, it might result in a situation where people make copies of the files to have their own version, and that'd mask newer versions I'd want to use (ItemTweaker has this issue)

hollow current
#

an overall put-together code would look sth like this?

local original_ISMoveableSpriteProps_pickUpMoveable = ISMoveableSpriteProps.pickUpMoveable
local created_item

function ISMoveableSpriteProps:pickUpMoveable(...)
  --local worldObj = self:findOnSquare( self.square, self.spriteName );
  local result = original_ISMoveableSpriteProps_pickUpMoveable(self, ...)
  -- post stuff
  return result
end

ArendamethUtils.patchClassMethod(zombie.inventory.ItemContainer.class, "AddItem", function(original_fn)
  return function(self, item, ...)
  if instanceof(item, "InventoryItem") then
    created_item = item
    local result = original_fn(self, item, ...)
  else
    local result = original_fn(self, item, ...)
  end
  -- post stuff
  return result

end
end)
fast galleon
#

Wonder if you can use that to get back functionalities that stop when you pause game.

#

Instead of overwriting all lua for each version

hearty dew
#

Can simplify this bit if you care to:

 if instanceof(item, "InventoryItem") then
    created_item = item
 end
 local result = original_fn(self, item, ...)
 return result
hollow current
#

ah yes makes a lot more sense

hearty dew
#

There is also OnRenderTick. That one only fires when unpaused, iirc.
(maybe I switched the two, idk)

fast galleon
#

no they call getgametimecontrols and if it's paused then they don't add buttons, etc

drifting ore
#

I always thought that with the addition of silent hill inspired mods, somebody would have made a special zombie mod that goes beyond ai. "death knell day" I think has done the most for this. I just think It'd be cool to have a pyramid head enemy the player has to worry about in certain zones with great loot

#

or for that matter any horror game antagonist

#

Im half considering getting into modding and trying my hand at it

fast galleon
hollow current
#
function ISMoveableSpriteProps:pickUpMoveable(...)
  local square_name = self.square:getModData().renameEverything_name
  local result = original_ISMoveableSpriteProps_pickUpMoveable(self, ...)
  -- post stuff
  if square_name then
    created_item:getModData().renameEverything_name = square_name
  end
  return result
end```
getting an error thrown at ``local square_name = self.square:getModData().renameEverything_name`` :x
hearty dew
#

What's the error?

hollow current
#
ERROR: General     , 1665823078742> DebugLogStream.printException> Stack trace:```
#

lemme inspect it

#

or actually try to print it in the first place

hearty dew
#

Sounds like square is nil?

fast galleon
#

result get data

hollow current
#

ye apparently it is

hearty dew
#

Does ISMoveableSpriteProps have square? Wasn't that from ISMoveableAction?

hollow current
#

i thought it'd be valid since i'd have attempted to use something like local worldObj = self:findOnSquare( self.square, self.spriteName ); firsthand

hearty dew
#

Inside ISMoveableSpriteProps:pickUpMoveable(...), self refers to an instance of ISMoveableSpriteProps, so self:findOnSquare works

#

Taking a step back, is it the square that has the metadata or the world object? I'm confused

hollow current
# fast galleon created item = ???
ArendamethUtils.patchClassMethod(zombie.inventory.ItemContainer.class, "AddItem", function(original_fn)
  return function(self, item, ...)
  if instanceof(item, "InventoryItem") then
    created_item = item
  end
  local result = original_fn(self, item, ...)
  -- post stuff
  return result```
Basically refers to object that is created using AddItem
hollow current
fast galleon
#

but aren't you naming it result?

hearty dew
#

What if there are two items on the square?

fleet goblet
#

If I modified a dedicated server mod from Filezilla, how would I make sure everyone who logs in sees the updates?

hollow current
#

the item classes it'll work with are only Radio and Moveable
You can't place two Radios on the same square

#

but apparently I didn't check Moveables

#

lemme see

hearty dew
#

I think things like cabinets are Moveables, and you can place a radio on a square with a cabinet

hollow current
#

soo i'll have to store the moddata on the world object after all

hearty dew
#

To answer your question though, one of the parameters to the pickUpMoveable function is the square.

If storing the moddata in the square, you'd need to use that parameter.

If storing the moddata in the world object, you can use local obj = self:findOnSquare(square, self.spriteName)

hollow current
fast galleon
#

The function you said that gives you error has a result variable but not a created_item

hollow current
#

to use in another function

fast galleon
#

sorry I thought that line gave you error

hearty dew
#

There is a code path through pickUpMoveable where you pick up multiple moveables at a time. How do you even do that in the game?

hollow current
#

still though i have no idea lol

hearty dew
#

To handle that case we can't figure out, you'd need to use self.isForceSingleItem

fast galleon
#

try printing the item inside your overwrite before you save the created item

wait, soory I keep thinking created item is wrong

#

could be a string

hearty dew
#
                s.isForceSingleItem = props:Is("ForceSingleItem") or false;

Has to do with the type of sprite / world object

fast galleon
#

nevermind me

hollow current
#

ever get that brain lag while coding when you forget what you're doing and why and what you need to do and you just sit in front of the screen, trying to "restart" your brain?

#

that's how i just felt lol

hearty dew
hollow current
hollow current
fast galleon
hollow current
#

okaaaay in my attempt to switch from tiles to world objects

#

I replaced the :perform snippet to :placeMoveable

#
function ISMoveableSpriteProps:placeMoveable(...)
  local result = original_ISMoveableSpriteProps_placeMoveable(self, ...)
  -- post stuff
  local worldObj = self:findOnSquare( self.square, self.origSpriteName );
  print(worldObj)
  return result
end```
aaand worldObj returns nil
#

hmm I think its because the .self before square and origspritename

hearty dew
#

There is no self.square. self inside placeMoveable is a ISMoveableSpriteProps. ISMoveableSpriteProps doesn't have that field.

self.square was on ISMoveableAction back when you were patching its perform

#
function ISMoveableSpriteProps:placeMoveable( _character, _square, _origSpriteName )

...

function ISMoveableSpriteProps:pickUpMoveable( _character, _square, _createItem, _forceAllow )

ISMoveableSpriteProps doesn't have self.square, but when perform calls ISMoveableSpriteProps:placeMoveable (etc), it passes its square in as a parameter

#

So you need to get it from the function parameters

#

Sorry, long winded way of saying that ๐Ÿ˜…

hollow current
#

haha np but it definitely made it way more clear for me, thanks!

thick karma
#

Anyone know how to send an Accept (or Apply or whatever) command to update options based on a new setting state?

#

Found this promising function that seems to be involved in deicdin whether to show my name in-game

#

getCore():setShowYourUsername(param)

#

It's not 100% clear to me from context if param is a bool at all, but I'm like 95%+ confident it is

#

Unfortunately, calling it, while error-free, did diddly squat to hide my username when I sent "false"

#

I'm thinking maybe this prepares options to update before user applies settings

hearty dew
#
LOG  : General     , 1665825174615> ----------  zombie.core.Core@17a1f3cb  ----------
----------  grep: ShowYour  ----------
----------  Fields  -----------
----------  Methods  ----------
boolean               isShowYourUsername                    ()
void                  setShowYourUsername                   (boolean)
#

It's a boolean

hearty dew
hearty dew
thick karma
#

When I run that command from the debug terminal it works

#

What does this mean?

#

(assume you reach that line from the Lua)

#

(I can confirm programmatically that I am reaching that line)

thick karma
hearty dew
hearty dew
#

    public boolean isShowYourUsername() {
        return this.showYourUsername;
    }

    public void setShowYourUsername(boolean bl) {
        this.showYourUsername = bl;
    }

That's all they do

#

Some client of that class calls isShowYourUsername() to do the actual rendering (or not)

#
$ grep -r isShowYourUsername ProjectZomboid/zombie/
grep: ProjectZomboid/zombie/characters/IsoGameCharacter.class: binary file matches
grep: ProjectZomboid/zombie/core/Core.class: binary file matches
#

IsoGameCharacter, looks like

thick karma
#

Maybe not a client-level privilege? Seems odd if not

hearty dew
#
    protected void updateUserName() {
        if (this.userName != null && this.isoPlayer != null) {
            BaseVehicle baseVehicle;
            boolean bl;
            Object object = this.isoPlayer.getUsername(Boolean.valueOf(true));
            if (this != IsoPlayer.getInstance() && this.isInvisible() && IsoPlayer.getInstance() != null && IsoPlayer.getInstance().accessLevel.equals("") && (!Core.bDebug || !DebugOptions.instance.CheatPlayerSeeEveryone.getValue())) {
                this.userName.ReadString("");
                return;
            }
            Faction faction = Faction.getPlayerFaction((IsoPlayer)this.isoPlayer);
            if (faction != null) {
                if (this.isoPlayer.showTag || this.isoPlayer == IsoPlayer.getInstance() || Faction.getPlayerFaction((IsoPlayer)IsoPlayer.getInstance()) == faction) {
                    this.isoPlayer.tagPrefix = faction.getTag();
                    if (faction.getTagColor() != null) {
                        this.isoPlayer.setTagColor(faction.getTagColor());
                    }
                } else {
                    this.isoPlayer.tagPrefix = "";
                }
            } else {
                this.isoPlayer.tagPrefix = "";
            }
            boolean bl2 = this.isoPlayer != null && this.isoPlayer.bRemote || Core.getInstance().isShowYourUsername();

That's where it is called. hmm

thick karma
#

Shared or server?

hearty dew
thick karma
#

Unfortunately it seems to be mattering

#

I will refresh server

#

Pretty sure I had the right version loaded, but I'll switch just in case

#

There are two listed because one is from Steam and one is my live edit

#

I checked F11 and the file looked right

hearty dew
#

    public static Core getInstance() {
        return core;
    }

    @LuaMethod(name="getCore", global=true)
    public static Core getCore() {
        return Core.getInstance();
    }

Doesn't seem to be doing anything tricky

hearty dew
#

It'd do nothing if run server-side (I think)

thick karma
#

Yeah I have no clue but I know the code chunk is reached because the line above it is running fine

#

It's currently in client

hearty dew
#

Let me try it real quick

thick karma
#

That's the moment where it goes wonky

#

File address at the top

hearty dew
#

It has no effect when I call it in the lua console. Probably need to trigger IsoCharacter:updateUserName() somehow after setting it

hollow current
#

btw I can't seem to get findOnSquare to work. printing square returns nil lol

thick karma
#

(Unknown keycodes are screenshots)

#

Bear with Windows crapshoot screenshotting

#

I legit just typed this: getCore():setShowYourUsername(false)

#

In debug console of a hosted game

#

With I think AC 3 and 12 disabled for other mods iirc

#

That's all I had to do

#

I don't know how I triggered anything else

#

I just hit enter

#

And voila

hearty dew
hollow current
#
function ISMoveableSpriteProps:placeMoveable(...)
  local result = original_ISMoveableSpriteProps_placeMoveable(self, ...)
  -- post stuff
  --local worldObj = self:findOnSquare( square, self.spriteName );
  print(square)
  return result
end```
hearty dew
#

You have to add the variable to the function parameter list to get a reference to the parameter

#

placeMoveable(character, square, ...)

#

Doing that changes the contents of ..., so have to change the call to original after doing that

hollow current
#

so like:

#
function ISMoveableSpriteProps:placeMoveable(character, square, ...)
  local obj_square = square
  local result = original_ISMoveableSpriteProps_placeMoveable(self, character, square, ...)
  -- post stuff
  --local worldObj = self:findOnSquare( square, self.spriteName );
  print(square)
  return result
end```
hearty dew
hollow current
#

ah I can't just put the parameters I want in any order

hearty dew
#

If you look at the vanilla implementation of it (what I copied above). You can see the parameters the function already has

hollow current
#

it must be the way its defined in vanilla

hearty dew
#

Yea. To change the order, you'd have to go in and change all the call sites and change the original implementation

hollow current
#

ah lets not do that

hearty dew
#

:p

hollow current
#

edited it, looks correct now?

hearty dew
#

have to add those parameters to the call to the original too. With this change, the character and square arguments are no longer contained in ... (which is a way to reference an arbitrary number of remaining arguments)

#

original(self, character, square, ...)

hollow current
#

Edited again. I thought you said we have to change the call to original though, that's why I left it the way it is, assuming that changes the call to original

#

but if not it, then what?

hearty dew
hearty dew
hollow current
#

aaah my bad is misinterpreted what you meant. Seems like its printing square fine now

hearty dew
thick karma
#

Yeah sorry that function is odd

#

I am still trying to get it sorted but may take a break and come back in a bit. So confused. Improved the rest of what I'm trying to do instead. (Making debug, chat, and server info vanish on aim, reappear on Enter key. For controller players like me.)

hollow current
#

It finally works!

#

Thanks so much once again!

hearty dew
fast galleon
#

@hearty dew Thank you

local fakeNotPaused
TyrirSenpaiUtils.patchClassMethod(zombie.ui.SpeedControls.class, "getCurrentGameSpeed", function(original_fn)
    return function(self, ...)
        local speed = original_fn(self, ...)
        if speed == 0 and fakeNotPaused then
            return 1
        else
            return speed
        end
    end
end)
local orISInventoryPaneContextMenucreateMenu = ISInventoryPaneContextMenu.createMenu
ISInventoryPaneContextMenu.createMenu = function(...)
    fakeNotPaused = true
    local original = orISInventoryPaneContextMenucreateMenu(...)
    fakeNotPaused = nil
    return original
end
hollow current
#

Soo I tried to change this to the name stored in the moddata as well. This appears in the condition where you're either placing an item or picking up an item. I tracked the function that makes it appear to this:
function ISMoveableSpriteProps:getSpriteGridCache( _square, _verifyOnly, _getWorldObjects )
Looking at its code though, I am not quite sure if that's the one

hearty dew
hollow current
#

the same menu appears when you're in place mode and moving your mouse between the tiles

hearty dew
#

Do you know what's rendering that window?

hollow current
#

that's what I am trying to figure out. My search lead me so far nowhere except function ISMoveableSpriteProps:getSpriteGridCache( _square, _verifyOnly, _getWorldObjects )

hearty dew
#

I'd start by searching for static strings in the UI

#
$ grep -r 'Hold button and move cursor to rotate' ProjectZomboid/media/lua
ProjectZomboid/media/lua/shared/Translate/EN/IG_UI_EN.txt:    IGUI_HoldButton = "Hold button and move cursor to rotate object",
#
$ grep -r 'IGUI_HoldButton' ProjectZomboid/media/lua
ProjectZomboid/media/lua/server/BuildingObjects/ISMoveableCursor.lua:                        infoPanel:setFooterText( getText("IGUI_HoldButton")..".[br/]'"..Keyboard.getKeyName(getCore():getKey("Rotate building")).."' = "..getText("IGUI_Cycle2").."."..lastbit, UIFont.Small );
ProjectZomboid/media/lua/server/BuildingObjects/ISMoveableCursor.lua:                        infoPanel:setFooterText( getText("IGUI_HoldButton")..".[br/]'"..Keyboard.getKeyName(getCore():getKey("Rotate building")).."' = "..getText("IGUI_Cycle3").."."..lastbit, UIFont.Small );
hollow current
#

function ISMoveableCursor:setMoveableMode( _mode )

#

local infoPanel = self:getInfoPanel();

#

should be infopanel

winter basalt
#

does anyone know how i would render text on the screen? i don't want to use menu boxes or anything just draw text on the screen

hollow current
#

I don't actually have any idea how it works since I just found that function in the code of one of the mods

thick karma
hollow current
#

I traced the rendered window all the way to ISMoveableInfoWindow.lua but can't find where exactly does it render the object's name

fast galleon
#

@hollow current did you check the line infopanel:setBodyText(

hearty dew
#

That renders an array of lines (self.bodyText), among other things. Might be easier to modify the name used where that bodytext is set

#

(easier than parsing the text in each line and changing it, or similar)

hollow current
#

inspected the worldObj to see if it had a setName function

#

the result was rather weird tho

#

lemme print

#

so, code:

function ISMoveableSpriteProps:placeMoveable(character, square, origSpriteName, ...)
  local item = self:findInInventory(character, origSpriteName );
  local item_name = item:getModData().renameEverything_name

  -- pre stuff
  local result = original_ISMoveableSpriteProps_placeMoveable(self, character, square, origSpriteName, ...)
  -- post stuff

  local worldObj = self:findOnSquare( square, self.spriteName );
  ArendamethUtils.inspect(worldObj, 2)
  --worldObj:setName("Test")

  if item_name then
    worldObj:getModData().renameEverything_name = item_name
  end
  return result
end```
#

it prints:

#
(userdata) zombie.iso.objects.IsoRadio@7836dc66 <
           <METATABLE> => table 0x1843472298 {
                          .   [__index] => table 0x1920433559  ** PRUNED. Max depth reached **
                          }
>
#

i tried calling a setName on it anyways, which didn't work obviously but somehow didn't throw any errors

hearty dew
#

** PRUNED. Max depth reached ** That means it went to the depth you specified (2), and didn't go any further

#

so would need to set to 3 to print out what's inside that table in the __index field

#

the default is 3 too if you don't pass any number

hearty dew
hollow current
#

okay that does make sense, it has a setName() function

#

but yet it doesn't appear when picking it up for example

hearty dew
#

The body text is what is rendered. I'd try to find out what sets that body text

hearty dew
hollow current
#

function ISMoveableInfoWindow:setBodyText( _bodyTextTable, _font, _align)

#

the function code doesn't seem to have a lot to do with item name either

hearty dew
#
            infoPanel:setBodyText( _moveProps:getInfoPanelDescription( _square, _object, self.character, ISMoveableCursor.mode[self.player] ), UIFont.Small );

It calls _moveProps:getInfoPanelDescription to provide the body text. Might check that out

hollow current
#
       if InfoPanelFlags.name then infoTable = ISMoveableSpriteProps.addLineToInfoTable( infoTable, getText("IGUI_Name")..":", 255, 255, 255, Translator.getMoveableDisplayName(InfoPanelFlags.name), 0, 255, 0 ); end```
#

I believe that's what we're looking for

#

so if I understand it correctly, it has a locally defined infoTable and if InfoPanelFlags.Name is not nil, it adds the item's name to that table

#

but how do we exactly override the vanilla name with our own one?

hearty dew
#

yep

#

It passes InfoPanelFlags.name there into Translator to localize the name

#

Can you change InfoPanelFlags.name before that statement is executed?

hollow current
#

lemme see if I can put something together, one min

hearty dew
winter basalt
#
@SubscribeEvent
    public void onPlayerTick(OnPlayerMoveEvent event) {
        IsoPlayer player = IsoPlayer.getInstance();
        if (player != null) {
            player.addLineChatElement("The player is walking!!!");
        }
    }```
working on a mod with this new shit api i found
#

took me like fucking 3 days to get a project setup with it

hollow current
#
function ISMoveableSpriteProps:getInfoPanelFlagsGeneral( _square, _object, _player, _mode )
    InfoPanelFlags.name = self.name;```
#

okay i guess this is it

hearty dew
#

Nice ๐Ÿ™‚

hollow current
winter basalt
#

it doesn't help that it seems like that everything in this game is made with lua in mind

hollow current
#

i guess a sensible code looks like this?

#
local original_ISMoveableSpriteProps_getInfoPanelFlagsGeneral = ISMoveableSpriteProps.getInfoPanelFlagsGeneral

function ISMoveableSpriteProps:getInfoPanelFlagsGeneral(square, object, ...)
  local obj_name = object:getModData().renameEverything_name
  if obj_name then
    InfoPanelFlags.name = obj_name 
  end
  
  -- pre stuff
  local result = original_ISMoveableSpriteProps_getInfoPanelFlagsGeneral(self, square, object, ...)
  -- post stuff

  return result
end```
thick karma
#

@hearty dew In the mood for programming slapstick?

hearty dew
hollow current
#

i thought that'd overwrite the original

thick karma
#

So I am playing with ways to toggle UI stuff, reading, exploring, learning, you know. And I discover, lo and behold, there is a function very near a function I'd already found called toggleUI

#

"toggleUI!" I think to myself

#

How convenient that sounds!

#

I'll explore it!

#

I visit toggleUI, and I find this: ISUIHandler.allUIVisible = not ISUIHandler.allUIVisible;. "Oh, lovely," I think. "I was tracking that manually, and because I did so, I missed toggles when I pressed start to go to the Main Menu, causing one missed press exiting the Main Menu every time."

hearty dew
thick karma
#

"I wonder if I can just change my code to call toggleUI, and then when I enter the main menu, I'll naturally be using the game's system of UI toggling, so everything will be fiiiine."

hollow current
#

ah I should first call the original then set it?

thick karma
#

run, test, run, test, run, test

#

"Damn it, not working. Wonder if I can see how the Main Menu is opened when I press start. I do know where the Joypad stuff is."

hollow current
#

yess, it works

thick karma
#

search, hate self, search, hate self

hollow current
#

Thanks once again so much!

thick karma
#

"Aha! Right here!"

function JoypadControllerData:onPauseButtonPressed()
    local joypadData = self.joypad
    if UIManager.getSpeedControls() and not isClient() then
        if UIManager.getSpeedControls():getCurrentGameSpeed() == 0 or getGameTime():getTrueMultiplier() > 1 then
            if MainScreen.instance and MainScreen.instance.inGame and MainScreen.instance:isReallyVisible() then
                -- return to game below
--[[
            elseif joypadData.pauseKeyTime and (joypadData.pauseKeyTime + 750 > getTimestampMs()) then
                -- double-tap, go to main menu below
--]]
            else
                UIManager.getSpeedControls():ButtonClicked("Play")
                return
            end
--[[
        else
            joypadData.pauseKeyTime = getTimestampMs()
            UIManager.getSpeedControls():ButtonClicked("Pause")
            return
--]]
        end
    end
    if MainScreen.instance and MainScreen.instance.inGame then
        ISUIHandler.setVisibleAllUI(MainScreen.instance:isVisible())
#

Oh, great, so when the main menu is launching, it... wait... What???

#

"ISUIHandler.setVisibleAllUI(MainScreen.instance:isVisible())"

#

Why.. but... it says... but why???

#

IN THEIR OWN START BUTTON FUNCTION THEY USE THE WRONG TRIGGER

#

So the damn boolean flag doesn't even get set right

hearty dew
#
isReallyVisible()

These function names lol

thick karma
#

Omfg

#

I can't even discuss their naming practices

#

I'll lose my damn mind

#

Specifically, if you missed it, ISUIHandler.allUIVisible = not ISUIHandler.allUIVisible is in toggleUI but doesn't happen in the above code-block because they just directly call ISUIHandler.setVisibleAllUI(), which toggleUI would have done

#

That's clearly its entire purpose

hearty dew
#
  local isVisible = MainScreen.isntance:isVisible()
  if isVisible then
    local isReallyVisible = MainScreen.isntance:isReallyVisible()
    if isReallyVisible then
      local ohReallyVisible = MainScreen.isntance:yesReallyIsVisible()
    end
  end
thick karma
#

lmfao

hearty dew
thick karma
#

Yeah omfg

#

Why call it allUIVisible?

#

Oh yeah, because that guy skipped BASIC HUMAN COMMUNICATION in PRESCHOOL

#

lol sorry

#

"I'll just use new words, I'm sure it'll be fine."

#

"isVisibleAllUI" is boring

#

laaaaame

#

Some old man wrote it that way

#

I'm callin it allUIVisible

#

lol nah f.r. though it was probably the same programmer who wrote it both ways and it never crossed their mind

#

Omg I'm gonna have to write the most convoluted decoration function to fix this

#

This is so stupid-looking lol

hollow current
#

quick question but how do you update a dedicated server hosted locally to the latest game build
Edit: Figured it out

thick karma
#

@hearty dew omg tfw publishing your mod leads you to spend hours fixing a dev's buggy design.

#

It's only a matter of time before someone reports this, trying so hard to beat them to it ๐Ÿ˜ญ

#

ahhhh tfw you succeed

frosty estuary
#

Hi. I'm making some clothes and I want the player can't be able to workout while using it. Is there any property I can add to or what function can I overrride to do it?

thick karma
#

@hearty dew Shout-out to our boys at PZ ๐Ÿคช

local function setReallyVisibleAllUI(visible)

    if not visible then

        priorVisibility = ISUIHandler.allUIVisible
        ISUIHandler.allUIVisible = false
        ISUIHandler.setVisibleAllUI(false)

    else
        
        ISUIHandler.allUIVisible = priorVisibility
        ISUIHandler.setVisibleAllUI(priorVisibility)

    end

end
hearty dew
frosty estuary
#

Thanks... I will try it

livid geode
#

Hello everyone.. so version 41.77.7 recently came aboard changing the function of displaying the version number and most likely something else along with it
Ever since then I've been getting lots of errors in different mods. Today I got the chance to go through the DebugLog and scan the codes, only to discover it is something about the versions. Here is the list of all the affected lines that actually stopped working and caused all those mods to just break. Mods are SimplePlayablePiano and ArcadeMachines and CheatMenuRB.

--ALL THE KNOWN ERRORS SINCE 41.77.7

local ver_str = core:getVersionNumber()
CheatCoreCM.PZVersion = tonumber(string.match(getCore():getVersionNumber(), "%d+")) -- checks game version
local versionNumber = tonumber(string.match(getCore():getVersionNumber(), "%d+"))
local customsFileCheck = CheatCoreCM.checkFile("CheatMenuRB", "teleport_locations/customlocations.txt")
compassCore.processJson()
require "CheatMenuRebirth/Teleport/GPSWindow"
local versionNumber = tonumber(string.match(getCore():getVersionNumber(), "%d+"))
if getCore():getVersionNumber() == "41.50 - IWBUMS" then
if getCore():getVersionNumber() == "41.50 - IWBUMS" then
if getCore():getVersionNumber() == "41.50 - IWBUMS" then
if getCore():getVersionNumber() == "41.50 - IWBUMS" then

If anyone can help me fix this and inform the mod developers about the issues so that they can fix it quickly I'd really appreciate it. Thanks ahead. โค๏ธ

#

What seems to repeat a lot is getCore():getVersionNumber()

#

What I get is this: STACK TRACE; Object tried to call nil in CheatOption.lua; ERROR: General , 1665838039739> 0> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Object tried to call nil in CheatOption.lua at KahluaUtil.fail line:82..
[15-10-22 14:47:19.739] ERROR: General , 1665838039739> 0> DebugLogStream.printException> Stack trace:.

#

(in-game this happens whenever I right click something lol-- unplayable with debug mode on)

thick karma
#

@hearty dew Breakthrough!

hearty dew
# livid geode What I get is this: STACK TRACE; Object tried to call nil in CheatOption.lua; ER...

The error sounds like the indie stone devs removed getCore() from the zombie.Lua.LuaManager.GlobalObject java class.


    @LuaMethod(name="getCore", global=true)
    public static Core getCore() {
        return Core.getInstance();
    }

You could decompile the 41.77.7 version of the java class (ProjectZomboid/zombie/Lua/LuaManager$GlobalzObject.class) here http://www.javadecompilers.com/ to check real quick, and see if there is something comparable added in its place.

thick karma
#

I can now not only toggle UI without the weird keypress skip coming out of menu after having UI off

#

but when I come out of menu after entering when my UI was off

#

the game... REMEMBERS

#

MUAHAHAHAHA

#

BASIC QOL FEATURES

#

HAHAHAHAHA YOU'LL NEVER STOP ME PZ

hearty dew
hearty dew
frosty estuary
livid geode
#

What does it actually do ๐Ÿ˜…

hearty dew
#

select ProjectZomboid/zombie/Lua/LuaManager$GlobalzObject.class from the pz game directory to upload. It will create java code from the compiled code in the .class file (decompile it back to source code you can read)

#

Then you can search it to see if it has a getCore method still

livid geode
#

Ah thanks

#

Very lovely tool

#

shows this

hearty dew
#

If that still exists, then you could check ProjectZomboid/zombie/core/Core.class for getVersionNumber

livid geode
#

this is the only thing that came up

#

so it is just Version without the Number thingy

hearty dew
#

You're looking for a function definition like you have with getCore above

thick karma
hearty dew
livid geode
#
 @LuaMethod(name = "getPublicServersList", global = true)
    public static KahluaTable getPublicServersList() {
        final KahluaTable table = LuaManager.platform.newTable();
        if (!SteamUtils.isSteamModeEnabled() && !PublicServerUtil.isEnabled()) {
            return table;
        }
        if (System.currentTimeMillis() - GlobalObject.timeLastRefresh < 60000L) {
            return table;
        }
        final ArrayList<Server> list = new ArrayList<Server>();
        try {
            if (getSteamModeActive()) {
                ServerBrowser.RefreshInternetServers();
                final List getServerList = ServerBrowser.GetServerList();
                for (final GameServerDetails gameServerDetails : getServerList) {
                    final Server server = new Server();
                    server.setName(gameServerDetails.name);
                    server.setDescription(gameServerDetails.gameDescription);
                    server.setSteamId(Long.toString(gameServerDetails.steamId));
                    server.setPing(Integer.toString(gameServerDetails.ping));
                    server.setPlayers(Integer.toString(gameServerDetails.numPlayers));
                    server.setMaxPlayers(Integer.toString(gameServerDetails.maxPlayers));
                    server.setOpen(true);
                    server.setIp(gameServerDetails.address);
                    server.setPort(Integer.toString(gameServerDetails.port));
                    server.setMods(gameServerDetails.tags);
                    server.setVersion(Core.getInstance().getVersion());
                    server.setLastUpdate(1);
                    list.add(server);
                }
                System.out.printf("%d servers\n", getServerList.size());
            }
#

this it?

#

no-- ok

livid geode
#

Looking in the wrong place

#

wait

#

sorry

#

I feel so dumb

livid geode
#

would this be the same stuff

#

idk what it was before

#

but getVersionNumber doesn't exist

#

these three are version related-- idk which one would I use in the code to fix it rly

hearty dew
#

You might try reimplementing the old getVersionNumber in lua using that new getVersion method

#

Hopefully the indie stone devs add it back though ๐Ÿ˜…

livid geode
#

It broke like 3 mods as far as I know-- but from what I can see many mods have this getVersionNumber thingy

#

is there a way I can inform them directly so that they are aware of what they've done

#

xD

#

or at least get some response to know if this'll be reverted back or no

hearty dew
#
__classmetatables[zombie.core.Core.class].__index.getVersionNumber = __classmetatables[zombie.core.Core.class].__index.getVersion
#

If you put that in a shared/ lua file that loads early (name it something like !!!!!fix_getVersionNumber.lua and put it in media/lua/shared/), that might fix the other mods

hearty dew
#

I guess that's the official way to report issues

livid geode
#

I think I have a forum account already so I'll go there and report that asap

#

Thanks a lot Tyrir

#

you have been helping my dumbass too many times โค๏ธ

hearty dew
#

See if that fixes the issue for you

#

I can't test it since I don't have the new version and not interested in breaking all my mods on an unstable build, but if the new getVersion method does the same as the prior getVersionNumber method that was removed, that should fix the problem

livid geode
#

I'll definitely try this for the server

#

I fixed my mod by switching from getVersionNumber to getVersion. So that definitely worked

hearty dew
#

All that mod does is make calls to the old getVersionNumber actually call the new getVersion

livid geode
#

But there is no way for me to fix the others os this will definitely help. Wish we weren't forced to move to unstable, for some reason our server runs on branch="" which is stable but it can only be joined using a client unstable BETa.
I talked to tech-support and they werent able to help.. weird stuff

#

I hope the final 41 version fixes everything ๐Ÿ˜ฆ

fast galleon
#

so not sure why, but the collapse button in the UI I have been working is now not in the top right corner

#

I have to use setX on it to move it

#

and it's ok if I don't use activateView when I open the window

ok, not sure why it breaks but made it work

thick karma
#

@hearty dew So I have this code that almost seems to work, right up until I use the function.

print(tostring(getServerOptions():getOptionByName("DisplayUserName").setValue(true)))

Debug suggests setValue exists when I exclude the arguments and parentheses... tells me it's a function and gives me an address. But when I try to use it, no dice.

I think it's related to this: https://zomboid-javadoc.com/41.65/zombie/network/ServerOptions.html#getOptionByName(java.lang.String)

If you look at that function, you'll notice it claims to return the interface instead (which does not have a setValue method) of one of its implementations (e.g., BooleanServerOption, which has a setValue method).

It seems maybe the function is there but not usable possibly because of this extension issue and the way the function translates into Lua... Can you think of any way to make this function work? Or help me understand an alternate means for accomplishing the same signal?

hearty dew
#
LOG  : General     , 1665843870475> ----------  zombie.network.ServerOptions@1e87569b  ----------
----------  grep: getOptionByName  ----------
----------  Fields  -----------
----------  Methods  ----------
interface ServerOptions$ServerOption  getOptionByName       (String)
LOG  : General     , 1665843989405> ----------  userdata  ----------
(userdata) zombie.network.ServerOptions$BooleanServerOption@4bde1434 <
           <METATABLE> => table 0x929852329 {
                          .   [__index] => table 0x1170891972 {
                          .                .   [asConfigOption] => function 0x799838746
                          .                .   [getTooltip] => function 0x2025002934
                          .                .   [getValueAsString] => function 0x752224810
                          .                .   [resetToDefault] => function 0x976004912
                          .                .   [getValueAsObject] => function 0x1910234669
                          .                .   [isValidString] => function 0x288712967
                          .                .   [setValueFromObject] => function 0x221165137
                          .                .   [setDefaultToCurrentValue] => function 0x1382323683
                          .                .   [getValue] => function 0x2103513908
                          .                .   [setValue] => function 0x1202069710

Yea, it has a setValue function exposed by kahlua.

#

after calling setValue, the expected value is there when calling getValue

thick karma
#

Wait it's working for you?

hearty dew
#
LOG  : General     , 1665844153704> ----------  boolean  ----------
true
LOG  : General     , 1665844159903> ----------  nil  ----------
nil
LOG  : General     , 1665844161920> ----------  boolean  ----------
false

#

yea

thick karma
#

Can you share exactly how you wrote it?

hearty dew
#

the nil is the result of the setValue call. Can ignore that

#
getServerOptions():getOptionByName("DisplayUserName"):setValue(false)
thick karma
#

Mmmmmm crap maybe needed colon

#

Oof will try in a minute

hearty dew
#

Oh, yea. You need to use a colon when invoking java methods via lua

#

You'd use . for java fields

livid geode
#

@hearty dew your little mod fixed it all

#

Thanks again

bronze yoke
#

the javadoc says it returns the interface because it can return any of the implementing classes

cyan frost
#

anyone have a guide to make your own arsenal gunfighter settings for a dedicated server?

thick karma
#

@hearty dew omfg Tyrir I hope you get elected President

weak sierra
#

that option doesn't toggle it clientside tho

#

that's an option for all players on the server

#

and will require admin

#

in mp

teal summit
#

WHAT DOES THIS EVEN MEAN I CANT FIND THE ISSUE!!!!!!!!!!!!!!!!!!!!!11

#

can anyone please tell me

#

is wrong with this

thick karma
#

@weak sierra Unfortunately, the name is still terrible. ๐Ÿ˜ญ

teal summit
#

A working mod....it's nice to see people living MY DREAM

thick karma
#

Thanks @gilded hawk !

#

Omg so many hurdles

#

But now it works really well

#

For both controller and keyboard afaik

thick karma
#

No mod menu customization of key yet

#

But I my name 100% is hidden correctly and I'm hoping since it throws no errors and worked in the debug, it'll work for other players online

#

Can someone please help me confirm? Haha

#

No worries I'll launch -nosteam and try it actually, I guess hopefully that should work

hearty dew
teal summit
#

Alright let me load it up again because I got mad and shut everything down

thick karma
#

How do I actually invite myself to my game when I launch two -nosteam apps???

#

Just occurred to me I have no idea how to join myself without Steam

hearty dew
#

select join and set the ip to 127.0.0.1

teal summit
hearty dew
#
ERROR: General     , 1665849811810> ExceptionLogger.logException> Exception thrown se.krka.kahlua.vm.KahluaException: unknown item type "SMUIClothinge.Hat_ShemaghDown" in ClothingSelectionDefinitions.EPIRifleman.Female at BaseLib.error line:292.
ERROR: General     , 1665849811811> DebugLogStream.printException> Stack trace:
se.krka.kahlua.vm.KahluaException: unknown item type "SMUIClothinge.Hat_ShemaghDown" in ClothingSelectionDefinitions.EPIRifleman.Female
    at se.krka.kahlua.stdlib.BaseLib.error(BaseLib.java:292)
    at se.krka.kahlua.stdlib.BaseLib.call(BaseLib.java:120)
    at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:182)
    at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:1007)
    at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
    at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1812)
    at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66)
    at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139)
    at zombie.Lua.Event.trigger(Event.java:64)
    at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:65)
    at zombie.gameStates.MainScreenState.enter(MainScreenState.java:295)
    at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:65)
    at zombie.GameWindow.logic(GameWindow.java:297)
    at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    at zombie.GameWindow.frameStep(GameWindow.java:764)
    at zombie.GameWindow.run_ez(GameWindow.java:680)
    at zombie.GameWindow.mainThread(GameWindow.java:494)
    at java.base/java.lang.Thread.run(Unknown Source)
LOG  : General     , 1665849811815> -----------------------------------------
STACK TRACE
-----------------------------------------
Callframe at: error
function: debugClothingDefinitions -- file: CharacterCreationMain.lua line # 977 | Vanilla
function: initClothing -- file: CharacterCreationMain.lua line # 987 | Vanilla
function: randomGenericOutfit -- file: CharacterCreationHeader.lua line # 236 | Vanilla
function: createChildren -- file: CharacterCreationHeader.lua line # 28 | Vanilla
function: instantiate -- file: ISUIElement.lua line # 653 | Vanilla
function: addChild -- file: ISUIElement.lua line # 1082 | Vanilla
function: create -- file: CharacterCreationHeader.lua line # 122 | Vanilla
function: instantiate -- file: MainScreen.lua line # 797 | Vanilla
function: addToUIManager -- file: ISUIElement.lua line # 1009 | Vanilla
function: LoadMainScreenPanelInt -- file: MainScreen.lua line # 2191 | Vanilla
function: LoadMainScreenPanel -- file: MainScreen.lua line # 2100 | Vanilla
#

unknown item type "SMUIClothinge.Hat_ShemaghDown" in ClothingSelectionDefinitions.EPIRifleman.Female

teal summit
#

e

#

THE DAMN E

#

I SEEE IT

#

THE EEEEEEEEEEEEEE

#

thank you

#

hopefully thats the issue

#

it worked thank you

thick karma
hearty dew
#

Yea, that's a pain in the ass. I wish -nosteam mode had a way to include the workshop mod directory

thick karma
#

Yeah I am over it

hearty dew
#

-additionalmoddirs="path/to/steam/stuff" or similar

thick karma
#

I'll just wait for bug reports

#

Lmao oh okay

#

Or that

thick karma
hearty dew
#

Ideally, whatever path you provide as an argument, so you could include steam workshop mods or an extra mod dir you use for development, etc

thick karma
#

Seems useful tbh

#

Alright I will launch again and attemot to use the proper flags

thick karma
hearty dew
#

Err, no. I'm saying it is a pain in the ass to test mods in -nosteam mode because a commandline option like that doesn't exist ๐Ÿ˜…

#

I wish they had one so you could include steam mods even when running -nosteam

thick karma
#

Ohhhhhhhhhhhh

#

Lmao I'm waiting for the bug reports

#

Bahahaha hopefully it works

#

I'm concerned it requires some special privilege being server setting

weak sierra
thick karma
weak sierra
#

i told u this like 3 times, but those settings ur messing with are server-side INI file config stuff

#

the server determines whether u see ppl's names or not normally

#

and it's pushed to clients only on login or

#

/reloadoptions

#

u can hook where those act and toggle it locally but actually changing the option may well not work right

#

or may work but have side effects

#

by all means tho test it

#

maybe it can be done on the client end w/o ill effect

#

but i am concern

#

:P

thick karma
#

Yeah, I need someone to join me and test this tbh. I don't know if it will work as expected.

#

I tried launching -nosteam and couldn't even see my mods

#

I don't know how to do MP testing on mods independently if they don't show up in the list...

#

I am setting the server settings afaik, so it may well affect everyone. I see what you're saying totally

#

I am not sure how those server settings actually determine whether to draw the names... unfortunately those might be buried in some lists that are only referenced by index. Got a little lost when I went that direction

weak sierra
#

i make a dedicated server locally

#

and test with that as if it were a real server

#

:p

thick karma
#

Oof

#

Really didn't want to have to go that far lol

#

I'll look into it later

#

Likely has unintended behavior... I'll try to test ASAP and remove if necessary

weak sierra
#

i can test it on my test server when i have time

#

but the caveat is "when i have time"

#

lol

#

im kinda taking a break from intensive shit to do during the weekend

limber summit
#

I rewrote this with just the new recipe and seemed to remove a lot of stuff. Is there a way to simply add a recipe w/out touching the existing code? I don't want to overwrite anything, just want to add something.

vast nacelle
#

If you just want the recipe to get into the game, what you had here would work if you just delete the 'NeedToBeLearn:true,' line

#

Otherwise you need to add a means of learning it

limber summit
#

I wanted to add the recipe to engineers only on spawn, basically

#

And to the magazine

#

For non-engineers

vast nacelle
#

Then add a lua file to /media/lua/client/ that has this:

    local engineer = ProfessionFactory.getProfession('engineer');
    engineer:getFreeRecipes():add("Make New Smoke bomb");
end

Events.OnCreateSurvivor.Add(AddNewEngieRecipe);```
thorn bane
#

Anyone know where I can find the models that are used in the game?

#

Juuust found them lmao

vast nacelle
#

That'll add it to the Engineer at least. Need a bit more to add it to the existing magazines.

limber summit
#

Cool, thanks! I think I got the magazine portion correct already

thick karma
#

@weak sierra I updated again and disabled the hiding of other players for now

#

Everything else should be working for now if you want to use it. Works better than the original.

#

I'll push a new update after I find someone to help me test multiplayer

limber summit
#

Ok, it ain't much, but got first tiny mod workin as intended.

#

Ty @vast nacelle

radiant venture
limber summit
#

Yeah, that's the next thing. Gonna add newspaper/tin can

#

Starting small, but i'm going to try to add a lot more scrap/junk functionality to engineer items

radiant venture
#

hell yeah, i had a similar idea like letting engi make a upgarde to the generator that increases the amount of gasoline it can hold, might be something you could try adding to yours if you're confident enough

limber summit
#

sounds fun

#

I have some ideas for engineers and electrician functionality stuff but then sometimes it's hard to differentiate the two professions.

radiant venture
#

that's true sadly

limber summit
#

I think it's partly because I have no idea what type of engineer the engineer of this game is supposed to be

#

or have been

radiant venture
#

i'm guessing an explosives engineer or something in the degree of chemics

limber summit
#

if it was an electrical/mechanical/systems/chemical/etc

radiant venture
#

chemical seems the most fitting

#

cause like they know about aerosol combustion

#

and the set up of how aerosol bombs need to be built is very finicky

limber summit
#

yeah, I like that

#

I think that can make what I try to have the engineer do be more specific

#

It's good to have limits/constraints

radiant venture
#

hit me up if needed for ideas xd

limber summit
#

Yeah, just list em. I'll start a spreadsheet ๐Ÿ˜„

radiant venture
limber summit
#

yeah acids crossed my mind too

#

FBI bout to put me on a list after seeing my wikipedia searches

#

I'ma tell em, "It was all for a video game, sirs and madams"

radiant venture
#

oh believe me I've attempted modding some of this stuff and the FBI didn't do shit after I literally googled "explosives you can build with every day objects"

limber summit
#

๐Ÿ˜„

#

I wonder about having electrician make generators more effective somehow and engineers make them hold more gas.

radiant venture
#

hmm seems fair enough

fossil badge
limber summit
#

Sounds fun to aspire towards as a newbie modder with this game

astral dune
#

Was wondering what kept vehicle engines updating after you turned it off and walked away. Had a hunch that it has something to do with the engine's temperature so I output it

#

I was right, but funnily enough the engine's temperature is completely decoupled from ambient. When you start a car up its apparently at 0 degrees and has to get back to 0 before it stops updating, haha

limber summit
#

What are folks thinking for bleach bombs? Two ideas I see are:

  • Creating a new item for "drain cleaner" and putting that mix in a container
  • Adding item for "potassium chloride pills/liquid" and a distilling process and putting that in a container
#

Any other chemical/acid item ideas?

limber summit
#

Drain cleaner seems like a good idea cuz apparently it's also used in sulfur acid attacks...again...officer...it's for a vieo game

thick karma
#

Is this spawn "points" (as opposed to regions) file deprecated?

#

Weird that it was created for the dedicated server but apparently not for any of my local servers

astral dune
#

More fun vehicle shenanigans I've found:

  • the heater consumes gas and electricity
  • Max speed effects your gas consumption even driving at lower speeds
  • You burn less gas at higher rpms as long as you're not in top gear yet
limber summit
#

Would it be feasible to use the "evolved recipe" mechanic to make bombs with variable effects?

bronze yoke
#

i think it's possible

limber summit
#

Cool, I'll go nerd learn about how that stuff works. I think it'd be great to instead of having base items, have them be scalable with certain skills so they're stronger just like having higher weapon skill makes weapons stronger.

#

base items that are static strength, that is.

bronze yoke
#

:getExtraItems() seems to return an array of the ingredients currently in an evolved recipe item

midnight mica
#

does anyone know of a mod that has an example of kicking people from the server?
SendCommandToServer("/kickuser "" .. username .. "" -r "" .. args.reason .. """)
This one doesn't work since the client needs admin access, i'd like for players to get kicked automatically when they break some rules, those would be detected client side

pine fiber
midnight mica
astral dune
#

doesn't look like anything usable is exposed for KickUserCommand. I'm having the same issue with ServerMessageCommand. The command objects themselves don't appear to be exposed to the lua, so they can only be accessed via sendCommandToServer, but then it checks your access rights before allowing it. The commands themselves are capable of being called without a user attached, but I don't see any way to actually do that. If you could get the server to send a command to itself then maybe, but so far I don't see any way to do it

static oyster
#

Question, what happens to the player character when the player enters a car? Does the game stops rendering the player model? If anyone knows this

astral dune
#

I believe they disappear, ya. Although some vehicle mods keep you visible, which can lead to funny stuff like weapons sticking out of the windshield

static oyster
#

I see, I wonder if I could use some line of code to achieve the same effect for another thing

vague quiver
limber summit
#

Is there a special place to find the evolveditem finished items? For example, the normal sandwich that you might find as salvage is in items_food.txt but the values it gives do not correlate with sandwiches that are made from the evolveditem process.

#

and evolvedrecipes doesn't list the values of the final items, just their names.

bronze yoke
#

that's because the values of an evolved recipe's result are based on the input ingredients, whereas the ones you find use the values in the script

#

they are the same item

astral dune
#

OnUseVehicle being in the server folder while only ever running on the client is driving me insane

astral dune
#

Anyone know of a guide for making UI elements?

undone elbow
#

There are very many UI elements in the game via Lua. The game code is the guide with examples.

astral dune
#

the game code is not a guide, you can only root through uncommented code for so much. In all fairness, I'd rather get no answer than a dismissive one, thank you.

fast galleon
fast galleon
#

Is there a way to see who's calling my function so that I don't need to overwrite them individually.

undone elbow
#

getVersion doesn't exist on 41.77

summer rune
#

is there a way to implement visible waypoints for players for quests?

#

static world markers, or something like that.

ruby urchin
summer rune
ruby urchin
#

Unfortunately, I no longer have the code, I lost it in a format ๐Ÿคฆ but I'm sure that it is on lua side, let me see if I can find it

ancient grail
ruby urchin
# summer rune YES please. how?

client/Context/World/ISContextDebugHighlights.lua#L51 ->
local arrow = getWorldMarkers():addDirectionArrow(getPlayer(), _square:getX(), _square:getY(), _square:getZ(), "dir_arrow_up", c.r, c.g, c.b, 0.95);

ancient grail
hearty dew
hearty dew
#

Updated it to work on stable builds if you wanted to use it on stable

thick karma
#

Can anyone halp me get my dedicated server to show up right?

daring dagger
thick karma
#

I've got made and in my favorites, I'm guessing my ports aren't right but I'm seeing different information from different sources

hearty dew
#

If you are connecting locally to test mods, you shouldn't have to deal with ports (unless you have some insane firewall setup) when connecting locally to 127.0.0.1

thick karma
#

Hmmm well afaik I have the server running here...

#

But I have no idea how to set the numbers here to get it to show up

hearty dew
#

change the IP field to 127.0.0.1

thick karma
#

Omg that was all I had to do

hearty dew
#

Are you in steam mode?

thick karma
#

facepalm

#

That just changed all the info I think it may have worked

#

it's loading Lua

#

โค๏ธ

hearty dew
#

Oh, okay. Nice

thick karma
#

I had possibly already done any other steps you had in mind... I even forwarded ports like crazy and opened them up in Windows Defender

hearty dew
#

Wasn't sure if it'd work running in steam mode, but glad it did. It's a little more wonky to get working correctly in steam mode

thick karma
#

I assume it's in Steam mode if the bat had a line saying something like D.steam=1 and had no line saying -nosteam

#

1 is usually true so unless Lua is THAT full of hate...

#

lol jk

thick karma
#

So I am now connecting as a user rather than an admin and that's useful presumably for testing, but what if I want to see how things look for a second player connecting to this server? Do I need to relaunch in Steam mode and connect from two no-steam clients? Will that cause the server to stop connecting players to mods? Or will the nonsteam users created automatically download the mods to some folder on my computer reserved for nonsteam Zomboid modding?

ancient grail
#

anyone knows a tutorial for making pz animations from scratch?

thick karma
#

@weak sierra Tiny update to the mod (username state would always stay hidden after hiding it if you launched the game with username hidden; that has been fixed). 100% works as user, at least with the anticheats disabled that I tend to disable (confirmed by starting my own dedicated server. Thanks to @hearty dew for helping me finish that.

thick karma
#

Sorry to anyone dealing with early stages of launching this mod. More complicated than I thought it would be (A) making basic changes to UI in game while in MP, and (B) explaining to the Steam community why a mod needs to exist.

#

@bronze yoke I think you were interested in using this. Sorry I had to repost. Now that I am able to test on a dedicated server and I have fixed the description, I have no intention of doing so again.

thick karma
#

lol when people downvote my mods on Steam without giving any reason (presumably because they wouldn't want to use the mod personally or just because their souls are made of poop), I hate them so much.

#

I mean not the whole them, but the part of them that works like that.

#

I am just so annoyed by the mindset of someone who downvotes mods just because they don't want to use them... sigh

simple lodge
bronze yoke
thick karma
# bronze yoke non-steam clients cannot play on steam servers

Sorry I don't understand whether that applies to my situation... I launched PZ through Steam, and I launched the server with "D.steam=1" or something like that set... Would my server have launched as nosteam by default? I didn't click the nosteam bat....

bronze yoke
#

i thought your question was 'do i need to use a steam server and two non-steam clients', sorry

thick karma
#

No I must have misspoken if I implied that

bronze yoke
#

but everything will need to be nosteam if you plan on using two clients, as it won't authenticate your steam account twice

thick karma
#

Oof... How do people connect game to their mods in nosteam mode? Mine wouldn't load...

bronze yoke
#

just put them in zomboid/mods

thick karma
#

Okay so if I copy all of my online mods into zomboid/mods they will appear to the nosteam client?

bronze yoke
#

they should!

thick karma
#

Okay phew I will try lmao what a cluster

#

Wish I could spawn fake online users near me for testing

bronze yoke
#

god yeah

thick karma
#

I will get it figured out though, your help is clarifying as usual

#

@bronze yoke Will I need to pull them out of their numbered Steam Workshop folders? Or will they be recursively located even if they're a bit buried?

bronze yoke
#

unsure but i would do it anyway

thick karma
#

Okay fair sounds good

#

I think I'll check on recursive loading once because it'll take only a minute to test and save a lot of time if it works.

visual abyss
#

how does one spawn zombies

#

for testing weapons

boreal crow
limber summit
hearty dew
visual abyss
#

I figured it out. Zombie Brush in Cheats

#

when in single player

thick karma
#

If you read the desc you'll see it does a smidge more than simply hide UI. It will eventually hide all usernames if at all possible, and hopefully XP updates and other stuff not currently hidden by hiding UI.

astral dune
ancient grail
#

is there a startup parameter to relocate the whole zomboid folder(on the steam folder not the user)

my windows drive is full and i wanted to move all the files tk a diffrent drive.. i was able to movethe users file but i want tk move everything else

ancient grail
thick karma
glacial ore
#

Does anyone know a mod that allows other players (who have their own safehouses) to be able to be added to my safehouse? Atm my friend and I have two separate houses and its annoying that he can't sit and interact in my safehouse.

alpine scroll
#

Anyone knows which temp the container need to be to freeze foods?

boreal crow
thick karma
# boreal crow I'd say that's still hiding UI, usernames are still a UI element. Sounds nice, j...

You should tell the devs, since the UI-hiding function doesn't hide usernames. Programmatically hiding usernames is a separate endeavor entirely.

The relationship is that playing without a UI is cinematic; it makes a game feel more like a movie. Dawn of the Dead is famous zombie movie. The mod's goal is to make playing feel more like being in a zombie movie like Dawn of the Dead. People may not notice how the title relates to the mod's purpose, but it certainly relates.

#

Fwiw I agree with you. Hiding names should be part of hiding UI. Unfortunately, in vanilla, it's not. Also, in vanilla, playing gamepad, I can't even hide the UI. I would much rather the vanilla game have basic UI hiding and complete gamepad support. Then my poorly named mod would not need to exist at all, lol.

gilded hawk
#

Does anyone have a suggestion on how to make this code look better?

local locations = {
    ["ZedDmg"] = true
    -- TODO: ADD MORE HERE
}
function IsBannedBodyLocation(bodylocation)
    return locations[bodylocation] or string.find(bodylocation, "MakeUp_") or string.find(bodylocation, "Transmog_") or string.find(bodylocation, "Hide_")
end
#

I have the suspicion this will be come a very long chain of 'or' statemens once I find all the other strings to match

thick karma
#
local function go(test)

   return false or
          false or
          false or
          false or
          false or
          test or
          false

end

print(tostring(go(true)))
print(tostring(go(false)))

This prints

true
false
gilded hawk
#

Yeah I decided to do that, I'll bother about code clarity once it becomes a problem for now i'm just using a line break

thick karma
#

For sure just figured I'd throw it out there in case you were gonna one-line it

drifting ore
#

does the modded trait "Incomprehensive" work in multiplayer?

thick karma
#

Yo random question when I loaded my own server for the first time I noticed a ton of assets failing to load, but this never throws exceptions in debug mode? What's going on here? Are these just mod conflicts that don't cause live issues or what? Or is this not common enough to guess without seeing the errors?

thick karma
#

Gotta figure that out myself

drifting ore
#

the description for incomprehensive is "You tend to find less items while searching containers"

bronze yoke
thick karma
#

Hmmm just so weird because it shouts ERROR at me like it matters, and then seems to not matter

#

Need to inspect the logs further I think

#

I copy-pasted but haven't had time to read em

#

AFK

bronze yoke
#

zomboid spams errors about a bunch of stuff that aren't really errors, so i don't really think much about it

#

like all that stuff about vehicle distributions and stuff

bronze yoke
weak sierra
bronze yoke
#

it looks like it just deletes items when a player with incomprehensive first opens a container

weak sierra
#

better perf too

#
stringList = {
"something" = true,
"something else" = true,
}

if stringList[someString] then
  --Do things :D
end```
gilded hawk
weak sierra
#

u can generate the table at runtime too no?

#

what's the problem

gilded hawk
#

๐Ÿค”

weak sierra
#

table.insert(stringList, something)

bronze yoke
#

BodyLocationGroup:getAllLocations()?

weak sierra
#

if that is a thing then just do this and execute ur table building and such on a load-time event

#

rather than early

#

unless u have need to build it early

#

in which case "load this after clothing mods" or make the name start with Z or something

gilded hawk
#

I'll think about it, i don't know if it's possible for me to generate the list of banned body locations

weak sierra
#

btw u ever gonna fix that medical fanny pack?

gilded hawk
#

The antibiotics issue?

weak sierra
#

and similar items

#

yeah

gilded hawk
#

didn't I fixed it already? ๐Ÿค”

weak sierra
#

if you did then maybe my override did something to stop it from fixing

gilded hawk
#

I'll check now since Im free

weak sierra
#
    {
        DisplayCategory = Bag,
        WeightReduction    =    95, /*50->95*/
        ClothingItemExtra = Bag_MedFannyPackFront,
        ClothingItemExtraOption = FannyPack_WearFront,
        clothingExtraSubmenu = FannyPack_WearBack,
        Weight    =    0.2,
        Type    =    Container,
        Capacity    =    2,
        DisplayName    =    Medical Fanny Pack (Back),
        Icon    =    MedFannyPack,
        IconsForTexture = MedFannyPack;MedFannyPack_Red;MedFannyPack_Blue,
        OpenSound   =   OpenBag,
        CloseSound   =   CloseBag,
        PutInSound   =   PutItemInBag,
        BodyLocation = FannyPackBack,
        ClothingItem = Bag_MedFannyPackBack,
        CanBeEquipped = FannyPackBack,
        RunSpeedModifier = 0.98,
        WorldStaticModel = FannyPack_Ground,
    }```
#

all i do is adjust the weight reduction

#

but if u added some new function or smth

#

(this is an unlisted mod for my server so i don't care to use itemtweaker type overrides here)

#

i read the code and it still didn't look like it'd check that field, something was commented out

gilded hawk
#

It seems to work

weak sierra
#

mm

gilded hawk
#

I wonder If I uploaded it tho

#

๐Ÿ‘€

weak sierra
#

that's entirely possible lmao

#

lemme post the lua

#

from my copy

gilded hawk
#

Can you send me your 2850483881\mods\MxBackpacks\media\lua\server\MxBags_AcceptItemFunction.lua

weak sierra
#

precisely what i was bout to do heheh

#
-- This is based off media\lua\server\Items\AcceptItemFunction.lua

MxAcceptItemFunction = MxAcceptItemFunction or {}

function MxAcceptItemFunction.MedicalOnly(container, item)
    -- print(tostring(item:getScriptItem().Medical)) -- Apparently this does not work :-/
    return item:getStringItemType() == "Medical" or item:getDisplayCategory() == "FirstAid"
end```
#

doesnt look so new

#

just item type and display cat

#

a commented out attempt to check .Medical

gilded hawk
#
-- This is based off media\lua\server\Items\AcceptItemFunction.lua

MxAcceptItemFunction = MxAcceptItemFunction or {}

function MxAcceptItemFunction.MedicalOnly(container, item)
    -- print(tostring(item:getScriptItem().Medical)) -- Apparently this does not work :-/
    return item:getStringItemType() == "Medical" or item:getDisplayCategory() == "FirstAid"
end

Same here

weak sierra
gilded hawk
#

I think you have a mod that changes the display category

weak sierra
#

i do actually yes

#

i use Better Sorting

#

now that u mention it

gilded hawk
#

What the display category for the antibiotics?

weak sierra
#

this one is incredibly popular

#

were u to pick one to support

#

:p

#

i do not know off teh top of my head

gilded hawk
#

๐Ÿ‘€

weak sierra
#

i also was unable to put Zomboxivir Ampuoles in there from They Knew mod

#

not sure if Better Sorting covers that or no

#

it may well

gilded hawk
#

it might

#

Check the sauce of better sorting, it might be there

weak sierra
#

poking at that rn

#

TweakItem("TheyKnew.Zomboxivir","DisplayCategory","Medical");

gilded hawk
#

๐Ÿ‘€

#

what about the antibiotics?

weak sierra
#

same

#

it's pretty nicely consistent

#

here's base game medical stuff

#
--MEDICAL
TweakItem("Base.AlcoholBandage","DisplayCategory","Medical");
TweakItem("Base.AlcoholedCottonBalls","DisplayCategory","Medical");
TweakItem("Base.AlcoholRippedSheets","DisplayCategory","Medical");
TweakItem("Base.AlcoholWipes","DisplayCategory","Medical");
TweakItem("Base.Antibiotics","DisplayCategory","Medical");
TweakItem("Base.Bandage","DisplayCategory","Medical");
TweakItem("Base.BandageDirty","DisplayCategory","Medical");
TweakItem("Base.Bandaid","DisplayCategory","Medical");
TweakItem("Base.BlackSage","DisplayCategory","Medical");
TweakItem("Base.Comfrey","DisplayCategory","Medical");
TweakItem("Base.ComfreyCataplasm","DisplayCategory","Medical");
TweakItem("Base.CommonMallow","DisplayCategory","Medical");
TweakItem("Base.CottonBalls","DisplayCategory","Medical");
TweakItem("Base.Disinfectant","DisplayCategory","Medical");
TweakItem("Base.FirstAidKit","DisplayCategory","Medical");
TweakItem("Base.Ginseng","DisplayCategory","Medical");
TweakItem("Base.LemonGrass","DisplayCategory","Medical");
TweakItem("Base.Pills","DisplayCategory","Medical");
TweakItem("Base.PillsAntiDep","DisplayCategory","Medical");
TweakItem("Base.PillsBeta","DisplayCategory","Medical");
TweakItem("Base.PillsSleepingTablets","DisplayCategory","Medical");
TweakItem("Base.PillsVitamins","DisplayCategory","Medical");
TweakItem("Base.Plantain","DisplayCategory","Medical");
TweakItem("Base.PlantainCataplasm","DisplayCategory","Medical");
TweakItem("Base.Splint","DisplayCategory","Medical");
TweakItem("Base.SutureNeedle","DisplayCategory","Medical");
TweakItem("Base.SutureNeedleHolder","DisplayCategory","Medical");
TweakItem("Base.Tissue","DisplayCategory","Medical");
TweakItem("Base.ToiletPaper","DisplayCategory","Medical");
TweakItem("Base.Tweezers","DisplayCategory","Medical");
TweakItem("Base.WildGarlic","DisplayCategory","Medical");
TweakItem("Base.WildGarlicCataplasm","DisplayCategory","Medical");```
gilded hawk
#

Oh, look at this, so clean

weak sierra
#

yeah lol

#

it only plays with display cats too

gilded hawk
#

Damn, I might install that mod too lol

weak sierra
#

so if these things weren't "Item"

#

it's even compatible with More Loot Settings

#

the only such that that mod supports

#

:P

#

it's good

#

xD

gilded hawk
#

Damn ๐Ÿ˜ฎ

#
-- This is based off media\lua\server\Items\AcceptItemFunction.lua

MxAcceptItemFunction = MxAcceptItemFunction or {}

function MxAcceptItemFunction.MedicalOnly(container, item)
    -- print(tostring(item:getScriptItem().Medical)) -- Apparently this does not work :-/
    return item:getStringItemType() == "Medical"
        or item:getDisplayCategory() == "FirstAid"
        or item:getDisplayCategory() == "Medical"
end

I'll push this one asap

weak sierra
#

holy shit

#

999,554 Current Subscribers

#

they bout to have 1m

gilded hawk
#

๐ŸŽ‰

weak sierra
#

thanks

#

:)

#

and now u can go "COMPATIBLE WITH BETTER SORTING"

#

lol

gilded hawk
#

Also I haven't released 5+ new bags because i'm waiting for my gf to make the icons and textures for them pain

safe silo
#

I'm looking for the vanilla code on how heat sources work. Planning on creating a heater but cant figure out where to look

gilded hawk
#

So, all this time for my transmog mod I have been using item:setClothingItemAsset to set the ClothingItemAsset aka the ClothingItem = in the text files

Should I keep using setClothingItemAsset or should I use item:DoParam("ClothingItem = StuffHere") ?

What are the implications of changing my code to use item:DoParam ? ๐Ÿค”

alpine scroll
#

Hello everyone. Stupid question here

#

I am trying to add a freezer container to the back of a truck

#

That is ok, its working

#

However

#

The item keeps its description of "Fresh, uncooked" until I relog on the client

#

I do freeze it via a /server/ lua file

#

How do I update the item on the client so it gets the new properties?

midnight mica
#

does anyone know how to ban/kick a player from the server side in lua?
when sending the command from the client it needs admin permissions

weak sierra
#

doparam only works before something is instantiated and affects every instance of the item

#

it's for like

#

editing script file at runtime

#

u def want the function

#

also it seems ur QOL anarchist cookbook magazines are somehow incompat with chuck's Named Literature

#

u read em and it spits a big ol' error, very strange

gilded hawk
weak sierra
#

i do also patch ISReadABook for my book xp mod, but that shouldn't touch magazines

#

but in case relevant..

#

it just "can't find it"

#

very odd.

gilded hawk
#

Oh, I do edit the check pz-MxsQoLPack\Contents\mods\MxsMagazines\media\lua\client\magazinesISReadABook.lua

weak sierra
#

oh do u

gilded hawk
#

Yeah

weak sierra
#

nutritionist one works fine tho

#

somehow

#

that's the one i'd expect something weird with

gilded hawk
#

Ah, interesting ๐Ÿค”

weak sierra
#

got trait and everythin, no error

#

the anarchist cookbooks yield no recipe on my server just an error

#

lol

#

and they are just normal recipe mags afaik

#

so very odd

gilded hawk
#

Odd the way I made the anarchist magazine is quite simple and vanilla like

#
item AnarchistCookbook1
    {
        DisplayCategory = SkillBook,
        Weight    =    0.1,
        Type    =    Literature,
        DisplayName    =    The Anarchist Cookbook Vol. 1,
        Icon    =    EngineerMag1,
        TeachedRecipes  =   Make Flame bomb,
        ReplaceOnUse    =   EngineerMag1,
        StaticModel = Magazine,
        WorldStaticModel = MagazineEngi1Ground,
    }
weak sierra
#

yeah i have no damn idea

#

@sour island

#

poke

sour island
#

?

gilded hawk
weak sierra
#

my reading mod wraps the original and still calls it normally, so it shouldn't interfere, Mx's script is pretty vanilla

#

yet it spits errors about not being able to find the item

#

unless it's a red herring and some other thing is to blame

#

oh wait Mx

#
    ReplaceOnUse    =   EngineerMag1,
#

item AnarchistCookbook1

#

can't find MxQoLPack.EngineerMag3

#

it was u

#

that shudda errored on ur end even

#

the names dont match

#

did u not test :O

gilded hawk
#

I have the mod on my server O.o and I never got this error lol

sour island
#
local ISReadABook_perform = ISReadABook.perform
function ISReadABook:perform()
    local bookNameLitInfo = self.item:getModData()["namedLit"]
    if bookNameLitInfo and self.stats then

        ---@type IsoPlayer|IsoGameCharacter
        local player = self.character
        local bodyDamage = player:getBodyDamage()
        local stats = player:getStats()
        local title = bookNameLitInfo["title"]
        local UnhappyChange, StressChange, BoredomChange = namedLit.readerMemory.statsImpact(self.item,title,player)

        stats:setStress(math.max(0,stats:getStress()+StressChange))
        bodyDamage:setUnhappynessLevel(math.max(0,bodyDamage:getUnhappynessLevel()+UnhappyChange))
        bodyDamage:setBoredomLevel(math.max(0,bodyDamage:getBoredomLevel()+BoredomChange))

        namedLit.readerMemory.addReadTime(self.item,title,self.character)
    end

    ISReadABook_perform(self) --line 24
end
#

line 24 is just calling the vanilla function

gilded hawk
#

I'm testing rn and checking

weak sierra
sour island
#

no problem

#

I fixed that other issue you found

weak sierra
#

ah cool :D

sour island
#

(I think?)

gilded hawk
sour island
#

Oh wait no, I couldn't replicate it - but I think it was related to server/client

#

shouldnt actually cause an issue

weak sierra
#

it doesn't create an issue in practice

#

but it does produce an undesirable error during load

weak sierra
gilded hawk
#

No clue confused_alex

#

I'm pushing a fix anyway, maybe it will fix on your side

weak sierra
#

bizarre

#

ur game magic D:

#

it should either throw an error or find the base item and replace it with that when u read it

#

xD

safe silo
wanton dirge
#

function testMod.getPlayerInfo()
    testMod.player = getPlayer()
    testMod.player.accessLevel = testMod.player:getAccessLevel()
    print(testMod.player)
    print(testMod.player.accessLevel)
end

Event.OnKeyPressed.Add(testMod.getPlayerInfo)```

Am I using Event.OnKeyPressed.Add wrong? This should print my player and access level each time any key is pressed but it breaks at the event. ๐Ÿ˜ฌ
#

Actually, nothing happens on keypress but the client breaks when loading into the game.

bronze yoke
#

i don't think player.accessLevel is writable

astral dune
#

does OnKeyPressed have parameters?

bronze yoke
#

yeah

astral dune
#

I assume adding an event listener that doesn't take the correct parameters would cause problems, but I've never tried

weak sierra
#

:p

#

i have no idea how u evaded that problem but i can't be the only one who ran into it given its nature lol

gilded hawk
#

I dunno evelynn

#

I got no comments under the mod about it

weak sierra
#

my vehicle spawning mod was broken for like 4 days and nobody said anything

#

:)

#

either way it's fixed now

safe silo
#

sorry for asking this the third time but I'm having a ton of issues with figuring out where to go from here, no mods have done this before either so might not be possible.

Can I create an item in-game that acts as a heat source? Like just, is it possible or should I stop trying lol

steep copper
#

Hi, i try to make my first mod on project zomboid, actually, i wan't to trigger a function everytime a player join the server (it's a hosted server)

So, i try to use the event "OnConnected" but it's doesn't work and i don't understand why. Some peoples to help me ? thx

#

`local function printPlayers()
print("successfully connected !!")
local players = getAllPlayers();
print(players)
end

print(isServer())
if isServer() then
print("it's Server !! qqqq")
Events.OnConnected.Add(printPlayers);
end`

#

qqq it's to find easily things with Ctrl+F

#

Everything works, except that the event is never trigered

thick karma
steep copper
#

Yes

thick karma
#

Is it giving you any errors? Or doing anything? Just curious. I would expect an error because you seem to be trying to print a function that would likely return boolean, but I believe I have to cast those as string to print them safely in Lua

#

Wondering if you see anything in your error log reflecting what I see

#

E.g., I have never seen anyone use getAllPlayers() and I can't find it in the doc

#

I'm not sure whether that function exists

#

Or what it returns

#

If it returns anything I would expect it to return an array of player objects, which I don't think Lua would casually print

steep copper
#

actually no errors, everything is print, except players, i've made different tests, with simple print in the function like print("abcd")
"it's Server !! qqqq" is printed fine, the only problem is that the event seems to be never triggered

#

so the function never run

thick karma
#

So you want it to print when players connect to server but it's not? Are you testing this on a dedicated server?

steep copper
#

Nope it's an hosted server, through Steam

thick karma
#

I'm not sure when it would have an opportunity to detect your connection while your Lua is running... You might connect before your Lua loads when you're host

#

Idk tbh

steep copper
#

That's what i was thinking about

#

i'm gonna try more events

thick karma
#

But you might try using OnCreatePlayer

steep copper
#

OnCreatePlayer is not triggered on Character Creation ?

thick karma
#

It would probably be triggered as you entered game with new character

steep copper
#

i try these

thick karma
#

Is your goal to always print a message when player joins server?

#

Or just test an event hook?

steep copper
#

Nope, i try events for an other project of mods

thick karma
#

Your OnConnected function could be working, but you might need someone to join you to see it work

#

I might be free to help you test later

steep copper
#

I try the other events

thick karma
#

If you see "it's Server !! qqqq" then the function should be getting added successfully.

#

It looks like you wrote it correctly

steep copper
#

Yes, so myb your right, i can't trigger the event as the host

thick karma
#

You should at least see successfully connected maybe, but I don't know if getAllPlayers() is legit

#

Where did you find that function

steep copper
#

i removed it for print("abcd") actually, for the test

#

that's my creation actually x)

thick karma
#

I don't think it works unless you have a function you wrote somewhere

bronze yoke
#

i think OnConnected fires on the client

thick karma
#

Just so you know

#

That will get what you probably meant to get when you tried printing getActivePlayers()

steep copper
#

Actually i have this on client side
`local function test()
if isServer() then
local playerObj = getPlayer();
print("adfdf");
print(playerObj:getUsername());
print('adfdf"')
end
end

print("qwertyuiop");
Events.OnConnected.Add(test);`

grim rose
#

One question, what damage type is food poisoning in project zomboid?

#

I need to know what to writte in lua to make my pills do effect

thick karma
steep copper
#

OnCreatePlayer do nothing too, even if i delete my character

thick karma
thick karma
steep copper
#

`local function printco()
print("successfully connected !!")
end

print(isServer())
if isServer() then
print("it's Server !! qqqq")
Events.OnCreatePlayer.Add(printco);
end`

thick karma
#

You need to include them in printco as step one of fixing that

#

OCP events send 2 params and if your function can't receive params there will be issues.

steep copper
#

`
local playername = "leevmealone"
local playerId = 0

local function printco(playerId, playername)
print("successfully connected !!")
end

print(isServer())
if isServer() then
print("it's Server !! qqqq")
Events.OnCreatePlayer.Add(printco);
end`

#

Like this ?

thick karma
#

Correct.

#

Afaik, that should work. I would imagine it would even work for you hosting alone if you load up with that

#

Actually

#

Maybe not

#

print(isServer()) may need to be print(tostring(isServer()))

#

I have gotten errors in Lua trying to print booleans without casting

#

Maybe only when I concatenate though, Idr for sure.

steep copper
#

actually it's work fine

#

i have the true

thick karma
#

I missed a paren above

#

Sorry about that

#

Should be 3 closing

thick karma
#

Because I have for sure thrown errors trying to go, "Blah is " .. boolVar

steep copper
#

nice to know

thick karma
#

In that case, tostring fixes it

#

Also tostring can help confirm functions exist in the debug console

#

Just do Class.function instead of Class:function()

#

You can tostring it and it will tell you it's a function and give a mem address

#

Or it'll say nil or something

#

iirc

#

It will not work lol obv

steep copper
#

yes seems logic, we can only concatenate strings

thick karma
#

Sure, some languages would do that automatically with basic datatypes

#

Especially when the variables have no explicit type

steep copper
#

actually OCP doesn't work too, it's a client side event ?

thick karma
#

Literally we just right variable = and Lua rolls with it, but don't you dare try to say variableA = variableB + variableC without knowing what types B and C are

#

It's a little counterintuitive in context.

thick karma
steep copper
#

i try on client

#

i was on server side with it

#

does nothing on client side too

#

i will definitely try more simple events, it's weird

#

i'm gonna try EveryTenMinutes

#

EveryTenMinutes work

#

it's time for me to go sleep, it's 4am here

#

good night/day

thick karma
#

Haha goodnight sorry will help more next time if you want.

thick karma
#

@weak sierra Great news! I am currently testing on a server with 3 players and flipping that server setting does NOT affect everyone else! It's safe to hide and show usernames that way as far as I can tell!

#

I am going to push the update soon and wish you the best of luck with it

#

I still plan to figure out how to hide XP updates in a future patch

weak sierra
#

:D

#

was worried bout that but im glad i was wrong

#

did u test what happens if an admin does it?

#

then maybe

#

i guess u can't do /reloadoptions while it's on can u cuz no chat box

#

so probably fine even if it would do that.. cowThink

thick karma
#

At least that's my likeliest interp of the results

#

I did it with two clients next to one another to see how their names would be affected... Client A hiding ui had no effect at all on Client B. Then I joined with Client C to determine if Client A's recent settings change would be pulled by Client C. Nope. Client C had default server settings

#

I am satisfied that it's safe but if you find out I'm wrong I am happy to attempt to improve it. You have more testers and contexts so who knows what conflicts could arise.

bronze yoke
#

maybe something is bugged or something?? like 66% downvotes seems insane

thick karma
#

I only have 6 responders

#

No bugs, no comments indicating such

#

I think there are some people who aggressively hate my name

bronze yoke
#

i guess not many people bother to vote on mods at all but i'd expect the people who'd get mad enough to bother to downvote would be even rarer

thick karma
#

I think there are others who believe the mod is pointless because they're too dense to see its use case

#

Or how it improves on base-game UI hiding

#

And maybe some people are just mean to all new mods

#

But of 6 votes, 4 down, no explanations.

#

Feel free to lmk if it bugs, but I get no errors and it works flawlessly for me

#

I really think there is a small handful of people who know my mod exists and are mad because they think it's already in vanilla and I modded for nothing

#

They spotted it and downvoted it together literally minutes after I posted

#

No way they tried it

weak sierra
#

:P

thick karma
#

I hear you, lol I try not to but I'm just salty about people sometimes

#

But you're right, important thing is the mod benefits people

#

Now I want to figure out how to hide experience gains / level-up messages in no-hud mode.

#

Not sure what keyword to hunt first but maybe XP is all I got

#

Oh yeah I should trace the text itself

#

what does it say like fitness +1?

viral vale
#

Not really sure where to go really but my first mod Lingering Whispers https://steamcommunity.com/sharedfiles/filedetails/?id=2874678809 is doing pretty well, i'm interested in the modding scene but my coding skills aren't very good, I was wondering if anyone wanted to collaborate on working on adding additional content to this mod or future mods. My skillset is mostly 3D modelling, writing and game design and i'm leaning towards specializing in creepy mods

bronze yoke
#

i'd love to help out, should the project interest me

viral vale
# bronze yoke i'd love to help out, should the project interest me

Currently this mod allows for a low probability for zombies to regain consciousness for a split-second during state-sensitive scenarios, allowing them to speak, such as when you are fighting them, when they are idling, bashing on a door, etc. I'm interested in expanding upon this further by creating even more unsettling scenarios and things they can say

bronze yoke
#

yeah i saw it, i thought it was a great idea

viral vale
#

There is a lot that can be done with a slowly degrading consciousness that doesn't need to be entirely speech based as well, such as zombies having a very low probability to open doors to return to places that have significance to them, such as a church, their home, etc

#

Then in terms of future projects, i'm interested in creating pre-apocalypse and post-apocalypse notes that can be found throughout the game that deliver on a whole range of emotions when you go through, find and read them

#

If anyone is interested in assisting, i'd love a hand ๐Ÿ˜›

bronze yoke
#

oh hell yeah

#

the atmosphere is what makes zomboid what it is for me, so a bunch of extra lore stuff to read would be great

viral vale
#

Yeah totally, I think zomboid has a lot of untapped potential for that kind of atmospheric and subtle horror

thick karma
# viral vale If anyone is interested in assisting, i'd love a hand ๐Ÿ˜›

I might be down, too. I kind of want to try to add Mod Options to your Lingering Whispers โ€” if you aren't already on it? Regardless, it sounds amazingly awesome; I just want it to happen more frequently (and I think various people have their own preferred frequencies). Would be nice to freely set that value. I am also planning to learn Mod Options for another mod I have, anyway.

Regarding this new idea, I might be down to write stuff for you out of pure boredom, or even get friends to pitch in some stories.

bronze yoke
#

the code side of that would be really easy, but i'm not much of a writer

viral vale
#

Kinda like bumping into those scenes you find throughout the game, a burnt car wreck with two corpses, a room where a wife was zombified and the husband decided to end it, all those kinds of scenes but then expanded into written form of rare glimpses at the people that walked the earth

vast nacelle
#

@viral vale Maybe place a discussion post on your mod where you can ask people to "submit" personal notes that you can use/adapt into the pre/post apocalypse notes? Get a body of different styles/emotions using crowd sourcing.

bronze yoke
#

my literacy mod has had a full revamp done for over a month but i don't want to write the dialogue it needs LOL

viral vale
viral vale
viral vale
bronze yoke
#

i'm very familiar with sandbox options, i could drop them in for you

viral vale
#

Sure ๐Ÿ˜ Feel free to see if you can get that working, that kind of stuff would take me awhile of just bashing my head on a keyboard, so any help to improve that function would be awesome haha

bronze yoke
#

i won't be at my computer until tomorrow, but i'll take a look then

viral vale
#

No problem ๐Ÿ˜› If anyone else wants to jump on board, lemme know ๐Ÿ™‚

thick karma
viral vale
thick karma
bronze yoke
#

burryaga would be good at that

#

it's rare to see someone who types with proper grammar without giving off a condescending tone

thick karma
#

YES

#

YES

#

YES

#

Not sex