#mod_development

1 messages ยท Page 167 of 1

weary matrix
#

pz is insecure anyway, you can't do much about that unless you rewrite the java part from scratch

dull moss
#

honestly caring about how hard it is to cheat with your mod is waste of brainpower

#

just code assuming nobody cheats

#

ez

#

same with splitscreen

#

Making mod support splitscreen is like making 7 PZ players happy

#

So just don't bother

red tiger
#

Also, you have options if your mod is used on a server for protection against theft.

drifting ore
#

i think mb i could create a table of player ids or smth that have already told the server they have spawned in n that would be the best i could do security wise

red tiger
#

You can request the server to send part of the code for a mod on the workshop and have the workshop copy be incomplete.

trim mist
#

ANybody know what exactly this does? This isn't for objects is it?

weary matrix
#

so I have this function doSomething in shared. It's possible that it will be called from any of client, server, or shared. When doSomething is called I need to send a command to client side so I use sendServerCommand from there. But right now it feels like the client is not notified when sendServerCommand is called.
In shared I have this:

function doSomething()
               print("DEBUG: doSomething")
               sendServerCommand("ModGuardian", "popup", {
                        config,
                        textID,
                })
end```
In client I have this:
```lua
local function OnServerCommand(module, command, data)
        print('WTF:')
        print(module)
        print(command)
        print(data)
end

Events.OnServerCommand.Add(OnServerCommand)
#

I can see "DEBUG: doSomething" in the log, but not the WTF debug

#

and no error of course

#

@red tiger ?

red tiger
#

Tab 16 spacing? Are you mad?

weary matrix
#

nah I use regular tabs, just discord is adding crap

red tiger
#

That should work.

weary matrix
#

well it simply doesn't ๐Ÿ˜…

red tiger
#

It's how you listen for server commands.

#

Is it Event or Events? Would fail if you called something that doesn't exist.

#

module, command, data.. that's right.

weary matrix
#

it's Events from what I can see in other mods

red tiger
#

Don't worry.. I gaslight myself every time I look at Lua code.

#

It's a language feature.

weary matrix
#

same for me ๐Ÿ˜‚

red tiger
#

It does look right..

#

@bronze yoke Any ideas why?

weary matrix
#

I have to learn Lua again every time I need to read/write Lua code

red tiger
#

I know you can send server commands to either everyone or a player specifically.

#

so that should be fine.

bronze yoke
#

testing in singleplayer?

red tiger
#

You can look at my ModLoader as it implements the event and command.

weary matrix
#

oh so no server?

red tiger
#

oh... looool

bronze yoke
#

server commands don't work in singleplayer

weary matrix
#

damn it ๐Ÿ˜‚

bronze yoke
#

even though client commands do... u_u

red tiger
#

In singleplayer the Java API for sending commands is not ran.

weary matrix
#

@bronze yoke could you explain the difference between sendClientCommand and sendServerCommand?

red tiger
#

You can replace the command function in Lua so it'll work in singleplayer..

weary matrix
#

maybe I can use sendClientCommand

bronze yoke
#

the name refers to the sender

red tiger
#
_G.sendServerCommand = function() .. end
bronze yoke
#

the player arg for client commands is to specify a specific split screen player as the sender, for server commands it's to specify a recipient

red tiger
#

Then you can triggerEvent('OnServerCommand', ..);

weary matrix
red tiger
#

Working on PIpeWrench has fucked me up so much. I know the dumbest stuff you can do with Kahlua..

bronze yoke
#

no, clients never receive client commands and vice versa

red tiger
#

Yes. You can however fake it.

bronze yoke
#

if you want a client message to relay to other clients you have to ping it off the server

weary matrix
#

so how could I notify client from shared?

bronze yoke
#

you'd have to handle it differently for client and server if it has to run on both

weary matrix
#

so maybe something like this:

if isClient() then
sendClientCommand()
else
sendServerCommand()```?
bronze yoke
#

other way around but yeah basically

weary matrix
#

like this? I updated the code

red tiger
#

It's not hard to fake the process on singleplayer.

bronze yoke
#

yeah, you'd need something on the server to relay the server commands as client commands though

red tiger
#

You'd be bouncing and triggering the event based on a state check

weary matrix
#

oh damn, pz is a f*cking nightmare ๐Ÿ˜‚

bronze yoke
red tiger
#

I also see people in here linking your events repo instead of Umbrella. KermitS

#

xD

#

Yeah I'm whining.. so what?

bronze yoke
#

the md file linked earlier? i've been out with my girlfriend so i didn't get a chance to respond to that

red tiger
#

All good, really.

bronze yoke
#

the human readable md version isn't in the stubs repo because i wanted to keep it slim

#

so it's not in umbrella either, though it's linked in the stub readme

red tiger
#

Oh yeah.. link that up if you want.

#

Also add your donation or info in there, unless you don't want to.

bronze yoke
#

on my way home now so i'll do that when i'm next at my computer

#

i gotta add the md to the github action at some point too

turbid gale
#

I'm trying to figure out the best way to get every time as it's spawned in on game load, as I want to change icons on some of them, but I'm not coming up with any good solutions. Any suggestions on what event hooks or what not are a good place to start looking?

drifting ore
#

how can i get the player's current profession?

bronze yoke
#

iirc player:getDesc():getProfession()

weary matrix
#

is it correct to assume this?

if getCore():getGameMode() ~= "Multiplayer" then
    print("we are in singleplayer mode")
end```
bronze yoke
#

i think so! usually if not (isClient() or isServer()) is used but i don't think it matters

weary matrix
#

thx for confirming. Now I'm wondering how someone would detect coop mode

#

but do people really play coop?

bronze yoke
#

do you mean splitscreen? there's something like getnumactiveplayers

red tiger
#

You can be in a state where isClient() and isServer() are both false.

drifting ore
#

anyone got any idea why my event isn't being removed?

#

nvm

drifting ore
#

anyone know how i can get the players current cell?

#

i tried player:getCell() but it doesn't seem to work

weary matrix
bronze yoke
#

just getCell()

#

all the object/square/etc get cell methods are redundant, there is only ever one cell so they all point to the same thing

drifting ore
#

oh

#

this is from the server btw

bronze yoke
#

player:getCell() probably should work too, i think there is one for that

bronze yoke
#

yeah, i meant that i was confused why that didn't work

drifting ore
#

this is what i'm doing rn but it doesn't seem to work

bronze yoke
#

getRooms() returns a list of RoomDefs, but roomSpotted wants an IsoRoom

drifting ore
#

oh, should i just use :getIsoRoom() then?

bronze yoke
#

yeah, try that

#

i wonder if there's a more direct way to get them from the building but that should work

drifting ore
#

wtf it's erroring at this part now

#

nvm it decided to work randomly lol

#

ty

#

server:

local function handleClientRequest(module, command, player, args)
    if module == "PrisonerProfession" then
        if command == "OnSpawned" then
            local rooms = player:getBuilding():getDef():getRooms()

            for i = 0, rooms:size() - 1 do
                local room = rooms:get(i)
                if room then
                    room = room:getIsoRoom()

                    local cell = player:getCell()
                    cell:roomSpotted(room)
                end
            end
        end
    end
end

Events.OnClientCommand.Add(handleClientRequest)```
client:
```lua
local PrisonerProfession = {}

PrisonerProfession.OnSpawned = function()
    sendClientCommand(getSpecificPlayer(0), "PrisonerProfession", "OnSpawned", {})

    Events.OnPlayerUpdate.Remove(PrisonerProfession.OnSpawned)
end

Events.OnPlayerUpdate.Add(PrisonerProfession.OnSpawned)```
pliant yarrow
#

Hey, albion, I was bored and decided to include an easter egg in my mod based on our conversation. In the neurodivergent mod I made an unused trait icon called trait_albion for Pinkie Pie nyannHappy

bronze yoke
#

omgg :D

pliant yarrow
#

I just see you in here always being helpful, plus I used to watch MLP myself and was bored so I decided to do a little sprite art mikacomfy

bronze yoke
#

that's so cool, thank you!

gilded hawk
#

Does anyone know how to use the media\lua\client\DebugUIs\TextureViewer.lua and how to access in ingame? I can't figure how which debug tool uses it

#

Like, what are these files?

bronze yoke
#

they sound like they might be related to the f11 menu

bronze yoke
drifting ore
#

np

bronze yoke
#

if you double click a cached texture in the callstack it might preview it like that

trim mist
#

Oh oops. I asked for help in modelling instead of here

#

Hey guys, does anyone have any idea why these new animations I added are overwriting the standard ones?

#
<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>Slinkytrying</m_Name>
    <m_AnimName>Bob_WindowStruggleLoop</m_AnimName>
    <m_deferredBoneAxis>Y</m_deferredBoneAxis>
    <m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
    <m_StopAnimOnExit>true</m_StopAnimOnExit>
    <m_SpeedScale>1.06</m_SpeedScale>
    <m_BlendTime>0.27</m_BlendTime>
    <!--<m_SpeedScale>0.80</m_SpeedScale>
    <m_BlendTime>0.20</m_BlendTime>-->
    <m_Conditions>
        <m_Name>OpenWindowOutcome</m_Name>
        <m_Type>STRING</m_Type>
        <m_StringValue>struggle</m_StringValue>
    </m_Conditions>
    <m_Events>
        <m_EventName>WindowOpenAttempt</m_EventName>
        <m_Time>End</m_Time>
        <m_ParameterValue></m_ParameterValue>
    </m_Events>
    <m_Events>
        <m_EventName>WindowAnimLooped</m_EventName>
        <m_Time>End</m_Time>
        <m_ParameterValue>struggle</m_ParameterValue>
    </m_Events>
    <m_Events>
        <m_EventName>WindowStruggleSound</m_EventName>
        <m_Time>Start</m_Time>
        <m_ParameterValue></m_ParameterValue>
    </m_Events>
</animNode>
#

I've renamed everything in these folders... super confused as to why these are the default anims now

gilded hawk
#

YEeeeeeeeeeeeeeeah. I can preview textures now!

pliant yarrow
#

I've still been having a problem for a little bit. I'm trying to randomly roll stat boosts on a trait, and my script kinda works, I can randomly addXP but when I try addXPBoost it gives me errors. I've been fussing with it for a while and don't know what I'm doing wrong. If anyone could help I would really appreciate it. If not, that's okay. I can provide more code but the last line is what's giving an error. SilverPleads

player:getTraits():add("SpecialInterest")
SpecialInterest:addXPBoost(Perks.Mechanics, 1)```
weary matrix
#

also what's the error you're getting?

#

oh have you tried Perk.Mechanics instead of Perks.Mechanics?

pliant yarrow
#

I'm getting the error "attempted index: HasTrait of non-table: null at KahluaThread.tableget line:1689"
SpecialInterest is a trait I made using ProfessionFramework. I was going off one of the guides on the modding wiki on adding traits that said that's how you add xp boosts, "trait:addXPBoost(Perks.[perk], #)"

weary matrix
#

cause it seems Perks is not exposed:

$ grep -R setExposed| grep Perk
zombie/Lua/LuaManager.java:            this.setExposed(PerkFactory.class);
zombie/Lua/LuaManager.java:            this.setExposed(PerkFactory.Perk.class);
zombie/Lua/LuaManager.java:            this.setExposed(PerkFactory.Perks.class);
zombie/Lua/LuaManager.java:            this.setExposed(IsoGameCharacter.PerkInfo.class);
weary matrix
pliant yarrow
#

Okay. Thank you very much for the help. I have no idea where it's getting the player variable as null or how to fix it. SilverSweat

weary matrix
#

@faint jewel Hey man, I got this error while moving a cardboard box:

LOG  : General     , 1686005302236> 39,795,204> Placing item of type furniture_storage_02_27
LOG  : General     , 1686005302239> 39,795,207> Need item of type Base.CardboardBoxCarry
LOG  : General     , 1686005302246> 39,795,213> ERROR: addToItemRemoveSendBuffer parent=zombie.characters.IsoPlayer@391d2767 item=zombie.inventory.types.InventoryContainer@4ccc53ad
LOG  : General     , 1686005302246> 39,795,214> -----------------------------------------
STACK TRACE
-----------------------------------------
Callframe at: removeItemOnServer
function: placeMoveable -- file: VisibleMoveablesExtensions.lua line # 74 | MOD: Skizot's Carryable Everything
function: placeMoveableViaCursor -- file: ISMoveableSpriteProps.lua line # 1536 | Vanilla
function: perform -- file: ISMoveablesAction.lua line # 161 | Vanilla

ERROR: General     , 1686005302247> 39,795,214> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method).
ERROR: General     , 1686005302247> 39,795,214> DebugLogStream.printException> Stack trace:
java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)```
pliant yarrow
# weary matrix try `getPlayer():HasTrait`

I'm sorry for asking silly beginner questions, but my girlfriend's not here to help me right now. I tried adding the line and it didn't change anything, I don't know if I added it wrong or in the wrong spot or something. koBlush

#

I'm new to modding and very sheepish about asking for help here since I'm so inexperienced but my girlfriend insists I should ask when I need help SilvShy

weary matrix
#

Well can't really tell you unless you show the code

pliant yarrow
#
    local chance_of_SpecialInterest = starting_chance + 95
    local roll = ZombRand(100) + 1
    local SpecialInterestRoll = roll <= chance_of_SpecialInterest
    if player:HasTrait("Fishing") and SpecialInterestRoll and player:HasTrait("SpecialInterest") then
        player:getTraits():add("ExtraSpecialInterest") 
        ExtraSpecialInterest:addXPBoost(Perk.Fishing, 1)
        print("Extra Special Interest Fishing")
        return
    elseif player:HasTrait("Fishing") and SpecialInterestRoll then 
        player:getTraits():add("SpecialInterest")
        SpecialInterest:addXPBoost(Perk.Fishing, 1)
        print("Special Interest Fishing")
    end```
#

This was my original code

weary matrix
#

and I wish I had a girlfriend I can ask help with coding, lucky you ๐Ÿ˜‚

pliant yarrow
#

Yeah, she's great, but unfortuantely her expertise with lua and Zomboid coding is limited, and she's busy with FF raiding nyannSadge

weary matrix
#

I can't see the call to getPlayer() in this code

pliant yarrow
#

I removed it when I got the error because I wasn't sure if I typed it write or put it in the right spot, got embarrassed and didn't want to look dumb if i did it wrong koBlush

#

I had it between these lines initially since these were where the error was happening and I thought this is where I needed to call. Sorry, I'm embarassed of my spaghetti code player:getTraits():add("ExtraSpecialInterest") ExtraSpecialInterest:addXPBoost(Perk.Fishing, 1) and between these two player:getTraits():add("SpecialInterest") SpecialInterest:addXPBoost(Perk.Fishing, 1)

weary matrix
#

well being dumb or inexperienced are 2 different things IMHO

#

try this:

    local player = getPlayer()
    local starting_chance = player:HasTrait("Lucky") and 10 or 5
    local chance_of_SpecialInterest = starting_chance + 95
    local roll = ZombRand(100) + 1
    local SpecialInterestRoll = roll <= chance_of_SpecialInterest
    if player:HasTrait("Fishing") and SpecialInterestRoll and player:HasTrait("SpecialInterest") then
        player:getTraits():add("ExtraSpecialInterest") 
        ExtraSpecialInterest:addXPBoost(Perk.Fishing, 1)
        print("Extra Special Interest Fishing")
        return
    elseif player:HasTrait("Fishing") and SpecialInterestRoll then 
        player:getTraits():add("SpecialInterest")
        SpecialInterest:addXPBoost(Perk.Fishing, 1)
        print("Special Interest Fishing")
    end```
pliant yarrow
#

Still got the same error. I started the function way up above with local player = getSpecificPlayer(0) is that a problem?

weary matrix
#

should work as well

#

@pliant yarrow I doubt you're getting the same error though, can you show me?

pliant yarrow
#

It's exactly the same, I've been getting this same error all day

weary matrix
#

no it's a different one

#

the first one was about trying to call HasTrait() on something that was null, now the error is about trying to call addXPBoost() on something that is null

#

so now the problem is your SpecialInterest variable being null

pliant yarrow
#

Ah, thank you, sorry for my mistake

weary matrix
#

what is the type of SpecialInterest?

#

I don't see where you assign a value to SpecialInterest

pliant yarrow
#

So I made the Special Interest trait with Profression Framework, and was going off this page from the modding wiki but I don't know if the Profession Framework works with this format.
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/How to make a custom trait.md
I tried this

    name = "UI_trait_SpecialInterest",
    description = "UI_trait_SpecialInterestdesc",
    icon = "trait_SpecialInterest",
    cost = 0,
    profession = true,
    exclude = {
        
    },
})```
GitHub

Contribute to MrBounty/PZ-Mod---Doc development by creating an account on GitHub.

#

Again thank you very much for your help

weary matrix
#

@pliant yarrowWhy do you need ProfessionFramework? You can add a trait in vanilla

pliant yarrow
#

I only used it because this is part of a larger mod that uses it to add items on spawn and daily functions tied to traits and such

weary matrix
#

ok

pliant yarrow
#

I can make the special interest traits vanilla I just need to know how to make them hidden

weary matrix
#

Anyway the documentation you posted uses TraitFactory.addTrait not ProfessionFramework.addTrait

woven brook
#

Anyone know some good mods for context menu examples?

pliant yarrow
#

Yeah, I'm gonna probably change these two traits to vanilla traits and see if it should work. I should be able to make things work from here. I appreciate all your help and patience.

#

Like I said, this was part of somebody else's mod I am patching and adding on to because they don't have time for it anymore and I got their permission to develope the mod

weary matrix
pliant yarrow
#

Yes

#

And the original modder used Profession Framework for various things

weary matrix
#

@pliant yarrow Try this:

local SpecialInterest = ProfessionFramework.addTrait('SpecialInterest', {
    name = "UI_trait_SpecialInterest",
    description = "UI_trait_SpecialInterestdesc",
    icon = "trait_SpecialInterest",
    cost = 0,
    profession = true,
    exclude = {
        
    },
})
print("DEBUG:",SpecialInterest)```
#

then search for DEBUG: in your console.txt

woven brook
#

can you simulate 2+ clients in debug mode?

weary matrix
woven brook
#

steam wont throw a fit if both instances have the same ip right?

weary matrix
#

I doubt it

woven brook
#

ok ty

#

making my first zomboid mod atm

#

pretty cool

weary matrix
#

otherwise people playing in the same house couldn't be playing the same game

woven brook
#

yeah but they generally have different steamids

weary matrix
#

oh, you asked about IPs, not steam IDs ๐Ÿ˜‚

woven brook
#

I did ๐Ÿ’€

#

sorry

#

tired

#

anyway

weary matrix
woven brook
#

yea ik

#

mistake

weary matrix
#

you could try but then yeah, steam might block it

#

still worth a try though

woven brook
#

making kind of a last of us inspired mod

#

basically

weary matrix
#

and please let us know the answer to that question ๐Ÿ˜‰

woven brook
#

will do

#

basically 5% of players are randomly given an "immune" trait

#

or it can be chosen for 16 points

#

the twist is

#

immune players brains can be harvested with specialty equipment to make cures

weary matrix
#

loool ๐Ÿ˜‚

woven brook
#

yep

weary matrix
#

how can you know if someone has the immune trait ?

woven brook
#

blood test

weary matrix
#

do you have to inspect their body? ๐Ÿ˜›

woven brook
#

So

weary matrix
woven brook
#

You can either just test their brains while they're dead (very cheap)

#

or

#

alive blood test (takes longer)

#

your options are basically

#

-Quarantine a bit person and wait

#

-Blood test

#

-just see if their brain works

weary matrix
#

so the immune player has to agree to the blood test? (Assuming he's alive of course)

woven brook
#

Yeah and I might add prisonerr support

#

so you can do it on restrained ones

#

idk tho

weary matrix
#

but why would a player submit to a blood test then? ๐Ÿ˜‚

woven brook
#

So

#

im making it for an RP server

#

of mine

#

10 years later and 60-70% of the pop starts in military/gov controlled safezone

#

and the gov can uh

#

harvest brains

woven brook
#

also

#

I will probably make it so head injuries don't allow brain harvesting

weary matrix
#

well between threats of getting shot and getting my brain harvested I would always choose the threat of getting shot ๐Ÿ˜‚

woven brook
weary matrix
#

ah yeah, true

woven brook
#

(5% random, the trait is really expensive)

#

I might raise it from 16 to 20 something

weary matrix
#

hum, so what would entice a player to choose this trait?

woven brook
#

not turning ever

#

if they get bit

weary matrix
#

ah right

#

makes sense

woven brook
#

yep

#

the trait is overall beneifical but

#

it carries the risk of having your brain harvested

#

also considering adding a minor treatment

#

where you can take immune blood to delay turning

#

without killing them

weary matrix
#

so you're injecting yourself with immune blood and it will slow down zombification?

woven brook
#

also it needs specialty equipment to do all this

weary matrix
#

hum but does it work in the tv show? I kind of remember that no

weary matrix
#

ok

woven brook
#

Not a 1:1 copy

#

In tlou ellie is the only immune

weary matrix
#

that we know of

woven brook
#

Ye

weary matrix
#

so will you make electrified fences? ๐Ÿ˜„

#

been thinking about it for a while ๐Ÿ˜‚

woven brook
#

this is my first zomboid mod

weary matrix
#

just kidding

woven brook
#

lol

#

Pretty good progress so far

#

first 2 hours of work

gilded hawk
weary matrix
weary matrix
# woven brook maybeeee

and if you touch it by mistake you have to press space many times to get a chance to push yourself out of the electricity, with very low chance of succeeding for each try ๐Ÿ˜‚

#

the only thing that I have no idea how it could be done is to animate the fence tiles so that it looks like there's electricity going through

#

night all

pliant yarrow
#

Have a good night, thank you so much for the help Wave

woven brook
#

baro player spotted

ancient grail
#

Is this out?

trim mist
#

I'm gonna be going to bed soonish, any help would be absolutely poggers. Otherwise this is kind of killed in the crib

drifting ore
drifting ore
#

man what the heck

drifting ore
#

anyone know if there are any proper ways to detect when a new character is created? i was originally just using OnGameStart but that wont work in multiplayer, i tried OnCreateLivingCharacter and OnCreateSurvivor but those only fire once, if i try and create a character after that on the same save/world they don't fire again.

ancient grail
ancient grail
trim mist
#

I saw you posting about similar issues in the past and tried to glean something from it, but no dice haha

ancient grail
#

Do you have the x files? For animation

#

Im not sure i have done anything with windows yey

#

Did you overwrite the animaton? If you did it should work
Of it didnt then there a problem with the anim file

To check if its loaded i use animation viewer

trim mist
#

So the x-files are currently the same. The idea I had was increasing the speed scale (and blend speed) for certain animations, and if there was an TimedAction that used one then to replace it. Said animation should only trigger if player has a trait

#

Currently the standard animations are being overwritten by the faster animations, and I'm not sure why. I tried to name them differently. Do I have to copy and rename the x-files too?

#

Ideally only the players with the trait would have some animations sped up

woven brook
#

Hm

#

anyone know how I can check the traits of a player corpse?

woven brook
#

what im doing atm is logging all players with that rait when with oncreateplayer and then iterating through it and seeing if the name matches the corpse name, its a pretty bad solution and if anyone else has idea lmk

ancient grail
#

Or the time action maybe

ancient grail
trim mist
# ancient grail You have to modify the blend time

I think i've done that--take a look:

<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>Slinkystart</m_Name>
    <m_SpeedScale>1.06</m_SpeedScale>
    <!--<m_SpeedScale>0.80</m_SpeedScale>-->
    <m_AnimName>Bob_WindowStruggle_Start</m_AnimName>
    <m_deferredBoneAxis>Y</m_deferredBoneAxis>
    <m_Looped>false</m_Looped>
    <m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
    <m_BlendTime>0.27</m_BlendTime>
    <!--<m_BlendTime>0.20</m_BlendTime>-->
    <m_Events>
        <m_EventName>WindowAnimLooped</m_EventName>
        <m_Time>End</m_Time>
        <m_ParameterValue>start</m_ParameterValue>
    </m_Events>
</animNode>

Filename for the above is "Slinkystart.xml". The commented out lines are the original sections

ancient grail
#

<m_BlendTime>0.01</m_BlendTime>
try

#

see if it works

#

<m_SpeedScale>8</m_SpeedScale>

ancient grail
#

just tweak it from there

trim mist
#

It does change in the middle of the game

#

So when I open a window now it's insanely fast haha

#

I just wish it would only do that after checking if I had a specific trait. As of right now, all players get the faster animations despite the rename

drifting ore
trim mist
woven brook
#

(This is my fist zomboid mod)

#

writing/reading moddata I mean

drifting ore
woven brook
#

fuck im stuck here

drifting ore
#

A quiet buzzing hum would be good enough imo

weary matrix
ancient grail
gilded hawk
ancient grail
ancient grail
woven brook
ancient grail
woven brook
#

1st day progress went well

#

Got the brain model done

weary matrix
woven brook
#

Microscope model done

#

Microscope and brain items done

#

Lua immune trait and random chance of getting it

#

And the extraction surgery process

#

Zomboid modding is pretty accessible

weary matrix
#

@woven brook i see you've been working hard ๐Ÿ˜

woven brook
#

yessir

#

Helps Iโ€™ve wrote an excess of 30k lua lines before

#

๐Ÿ’€

weary matrix
woven brook
#

I bet yeah

#

Definitely gonna make the mod very configurable for server owners

#

Since its basically an MP exclusive mod

#

Also

#

If anyone has ideas lmk

ancient grail
woven brook
#

lol thanks

#

Just wish discord search was better

ancient grail
#

What are you trying to search?

jolly ivy
#

Hello, is there any chance to implement a couple of ammo types for weapons (for example, default and incendiary) and get the type of loaded-in gun ammo from the Handgun object?

neon bronze
#

Yes define the ammotypes with / inbetween them in the script for your weapon

jolly ivy
neon bronze
#

It will load the best ammo itself but youโ€™d have to probably write to the guns moddata what ammo is currently in

jolly ivy
weary matrix
#

@tame mulch Hello mate, there seem to be a regression with sendServerCommand() in single player mode. In previous versions it was possible to trigger code in client using

Events.OnServerCommand.Add(function()
    -- do something
 end)``` but it's not working anymore, the event is not triggered in client code and the handler not called. I confirmed this with multiple modders who realized their mod was not working properly anymore in single player. Any clue about this?
fast galleon
weary matrix
jolly ivy
#

Does anyone know what happens if set the damage value to 0 in the OnWeaponHitCharacter event? Especially with firearms? Will it still create a wound on the character, but no damage?

heady crystal
#

Confused me a lot

weary matrix
#

Any clue what's the priority order for require() when you have same filenames in server/shared/client?
for example let's say I have:

media/lua/server/MyMod.lua
media/lua/shared/MyMod.lua
media/lua/client/MyMod.lua``` and from another mod I do: `require("MyMod")`, which one would be loaded?
tame mulch
weary matrix
# tame mulch Hi. Strange that this works before in SP

really? Hum maybe we misunderstood each others when talking with other modders. There's so many different reason it coudl work or not depending on where is your code (client/shared/server) and from the different game modes (single, multi, coop etc)

#

@tame mulch so what would be a good way to trigger client code from server and shared?

#

in a way that would work in single/multi player/coop games?

#

basically what I need exactly is to be able to trigger the display of a popup from server, client, and shared

#

but UI libs can't be required from shared or from server from my own testing

tame mulch
#

As idea, do on client and server same function for popup. Like on client:

func
  if not isClient() then
    bla bla bla

on server:

sendServerCommand
weary matrix
wind jetty
#

Can anyone confirm there are actually 5 seasons in PZ?

  • Spring
  • Early Summer
  • Summer
  • Autumn
  • Winter
tame mulch
#

Yep

weary matrix
#

ok thx, will try that

fast galleon
#

@weary matrix
#mod_development message

You can not require a file until the appropriate folder is loaded. Usually requires cache the result, so I assume the earliest file will be returned if you use the same name.

weary matrix
#

I wish we could pin that message though

#

also I can confirm it seems correct, because if I put my popup code in client, and call it from shared (at a later time) then it seems to be working properly

#

at least for SP

fast galleon
obtuse juniper
#

Has there been anyone who has look into making a world-changing mod? I'm not saying a breakthrough but more so a mod or a pack of mod that helps to change the entire era/world of the game?

Like having it more to be a fallout-like game with the world looking to be a wasteland or such

#

I know its kinda normal for some modding community to do that with some other games out there

thin hornet
#

@weary matrix

--- return false in SP,   true in MP as a client,    false in MP as a server
isClient()

--- return false in SP,   false in MP as a client,   true in MP as a server
isServer()

--- return true in SP,    true in MP as a client,    false in MP as a server
not isServer()
isClientOrSinglePlayer = not isServer()
isServerOrSinglePlayer = not isClient()
isClientOnly           = isClient()
isServerOnly           = isServer()
isSinglePlayerOnly     = not isClient() and not isServer()
isCoopHostOnly         = isCoopHost()
hoary widget
thin hornet
#

well we never repeat enough drunk

ancient grail
#

this is vanilla code.. i wonder why its written this way


ISWorldObjectContextMenu.onWalkTo = function(worldobjects, item, player)
    local playerObj = getSpecificPlayer(player)
    local parent = item:getSquare()
    local adjacent = AdjacentFreeTileFinder.Find(parent, playerObj)
    if instanceof(item, "IsoWindow") or instanceof(item, "IsoDoor") then
        adjacent = AdjacentFreeTileFinder.FindWindowOrDoor(parent, item, playerObj)
    end
    if adjacent ~= nil then
        ISTimedActionQueue.add(ISWalkToTimedAction:new(getSpecificPlayer(player), adjacent))
    end
end

ISWorldObjectContextMenu.onWalkTo = function(worldobjects, item, playerNum)
    local playerObj = getSpecificPlayer(playerNum)
    local bo = ISWalkToCursor:new("", "", playerObj)
    getCell():setDrag(bo, playerNum)
end

did it overwrite iteself or am i missing the point

ancient grail
ancient grail
jolly ivy
bronze yoke
#
<m_Conditions>
    <m_Name>CondName</m_Name>
    <m_Type>BOOL</m_Type>
    <m_BoolValue>true</m_BoolValue>
</m_Conditions>
```then in code, you control this variable with ``player:setVariable("CondName", true)`` - it should be fine to just set the variable when a player with the trait spawns
#

animations aren't something i work with, i've just helped a few people debug them before, so apologies if something in here is incorrect

#

i think the condition can be a bool, float or string - if this is supposed to be like species specific animation system you might want to use a string species name instead of a bool

vale vapor
#

Hello, i'm searching info on LUA script for Generator. But i don't find file related to it. I'm searching in server file.
Anyone have an idea where i can find it? Thx in advance for help.

bronze yoke
#

generators aren't written in lua, they're java

trim mist
vale vapor
#

ok thx. So it's hard to interact with it for change range for exemple?

trim mist
fading horizon
thin hornet
#

There are methods available for the gen but may not offer all you need.

thin hornet
#

When the generator is started it updates the squares around to set the electricity value on each of them. So maybe it's possible to hook into the action of starting the generator and adding the electricity value on a bigger range. But must not forget to remove the electricity value when turning off the genie.

#

Also that wouldnt effect the fuel consumption outside the vanilla range i think.

vale vapor
#

Ok thx. I will look into it.

thin hornet
bronze yoke
#

watch out for edge cases like when a square you need to turn off is actually still supposed to be powered by something else

fast galleon
mellow frigate
#

Hello there, what is the best way to broadcast a message to all current clients from the server ? (if it auto broad casts to all future clients it is even better)

#

I want the message to be displayed on screen of all users, not an internal sendServerCommand if I can avoid it.

bronze yoke
#

idk if there is anything like that

#

i'd imagine it working like:
when the message is broadcast, sendservercommand to display that message now on all clients, and add that message to a cache
when a player joins, sendclientcommand to ask for the server to send any cached messages to that client

unborn valley
#

Not sure if this is the correct place to post this... but...

#

I have been struggling to find a good mod that allows All Weapons or All Bags to have attachements. Slings Mod didn't work for all guns, Noir's didnt work for all bags, Two Weapons on Back only worked for Vanilla bags... soo...

#

I updated this mod to include all modded bags and useable for all weapons - works great!

#

if anyone wants to test it out and let me know if I have any bugs or duplicates I'd appreciate it! bunnydance
(I only updated it to include more bags from mods, I do not deserve credit for development of this mod. The original dev abandoned it.)

novel barn
#

[Solved and answered below] How does everyone here test their mods for multiplayer? Is it possible to run two instances of the game from one account and test on a private server? Or do you all recruit friends and a server? I've never played multiplayer but I'd like my mods to support it at least.

Forgot to search post history for answer. Doing that now.

trim mist
#

I also need to know the answer for this

bronze yoke
#

you run two instances of the game in non-steam mode

woven brook
novel barn
#

How to test for multiplayer on Windows

  1. The Mod you want to test must be in the Mods folder of your Zomboid Directory (since we'll be testing with the -nosteam flag, the workshop folder will be ignored).
    • My Zomboid folder is located at C:\Users[username]\Zomboid\mods
    • The folder you copy must be the one that immediately contains the media folder. The game apparently doesn't dig through nested folders to find eligible mods otherwise.
  2. open the command prompt (win+R and type "cmd.exe" or any of the other dozens of ways to get the command prompt open)
  3. navigate to where the zomboid EXEs are. For me its:
    • cd "C:\Program Files (x86)\Steam\SteamApps\common\ProjectZomboid"
  4. execute one of the exes (32 or 64) to be the server host:
    • start ProjectZomboid64.exe -nosteam -debug
  5. From the main menu, host a server. Click "Manage settings" in the host game menu. Click "Edit Selected Settings" and click "Mods" from the INI list. Add any mods you need to test from the "Add an installed mod to the list" drop down. Save this configuration change. Back up through the configuration settings and click "Start" to launch the server. Create your admin character as necessary
  6. execute a non -debug instance for your non-admin player:
    • start ProjectZomboid64.exe -nosteam
  7. From the main menu click "Join" to join a server. Fill in the account name and account password fields and save this server. IP and port settings should be correct for local play.
  8. click "Join Server" on your newly favorited 127.0.0.1 server. Create your character as necessary
  9. If you need to see your second character you can use the following teleport command:
    • press tab, t, or enter to open the multiplayer chat window
    • type /teleport "playerTwoName" to jump the admin to player two.
    • if you would prefer to bring them to you, use /teleport "PlayerTwoName" "AdminName"
  10. Test your mod to your heart's content
novel barn
#

If anyone has feedback or criticism of my multiplayer testing walkthrough above, please let me know. I'd like to make sure everything is both explained well but also as streamlined as possible.

red tiger
#

The fact that none of us can pin posts here should be a war crime.

bronze yoke
#

pins were superseded by the wiki page

red tiger
#

It's obvious that people come here before going there.

bronze yoke
#

well, the wiki page is a pin, so anyone who doesn't find something on there wouldn't be looking at the pins anyway

novel barn
#

I'll add what I've written above to the wiki as well

red tiger
#

Like I've said, we need a discord bot that has assignable commands to respond with set text for players to be properly directed to the wiki or other sites with relevant information.

#

If you write a map for showing where things are that's awesome.. except people still need a kiosk to get the map.

#

=)

#

Roller Coaster Tycoon wisdom.

#

God damnit.. Now I need roller coasters in PZ.. And trains.

novel barn
#

๐Ÿค” minecart mod

#

runs on charcoal

red tiger
#

All the park guests are zombies.

woven brook
#

My submenus onselect method is executing whenever the context menu is opened, any ideas?

#

its running harvestbrain whenver the menu is opened \

#

wrong screenshot

#

one sec

red tiger
woven brook
#

there we go

novel barn
red tiger
#

This idea is too funny.

woven brook
#

Heres my code

#
    local subMenu = ISContextMenu:getNew(context);
    context:addSubMenu(option, subMenu);


    if equipped then
        if body:isZombie() == false and equipped:getType() == "Scalpel" then
            subMenu:addOption("Harvest Brain", body, harvestBrain(body, playerInv,playerObj,equipped))

      

        end
    end````
bronze yoke
#

you need to pass a reference to the function

red tiger
bronze yoke
#

harvestBrain(body, playerInv,playerObj,equipped) just calls the function and passes the return value as an argument

woven brook
#

Oh

bronze yoke
#

try subMenu:addOption("Harvest Brain", body, harvestBrain, playerInv, playerObj, equipped)

woven brook
#

Thanks.

red tiger
#

Crazy ideas can make you crazier when you find out how easy it is to block it into practical feats.

#

I almost built a server as a modded RCI model for simulating Sim City in PZ.

woven brook
#

alright first part of the mod is done ๐Ÿ˜Ž

red tiger
#

I also want to explore a Factorio-like game mode for PZ.

#

Manipulate the landscape.

woven brook
#

ty albion

woven brook
#

!

#

but

#

do it

red tiger
woven brook
#

im actually kinda suprised at how accessible zomboid modding is

#

api is very nice

red tiger
#

I fell into the niche here for making tools for modding PZ.

woven brook
#

Very cool

red tiger
#

The API is mid.

woven brook
#

its alright

#

I like it so far

bronze yoke
red tiger
#

Who sold you this idea?

woven brook
#

I've also worked with lua for like 30k lines so yea

bronze yoke
#

i mostly agree but it is definitely not the common sentiment

red tiger
#

They're clearly trying to harm you.

thin hornet
#

It's not that bad, it's just not perfect

#

๐Ÿ˜‚๐Ÿคช

red tiger
novel barn
woven brook
#

my only public repo is my worst project ๐Ÿ’€

thin hornet
woven brook
#

anyway

red tiger
#

Not sure why people are so crazy about merge conflicts.

woven brook
#

if anyone has some ideas for this mod lmk

red tiger
#

Git makes merge conflict resolution so easy to handle.

#

It's not Git. It's the project planning.

novel barn
woven brook
#

basic process is:
-5% of players (configurable) are immune and you can also pick it as a trait for 16 points
-People can be blood tested to see if they're immune
-Once a player dies you can harvest their brain with a scalpel and then convert that to cures at a powered lab station if they're immune

#

theres some more depth to it but thats the basics

#

i'll take a video here

red tiger
#

Already kills people.

#

Oh BTW fun fact: You can clone the wiki tree in your GitHub repository by adding .wiki.git to the end of your clone URL. (Replace .git)

#

Your wiki is its own repo.

#

Learning Git is like learning a commercial-grade Lathe, but for a programmer.

#

:D

#

Unfortunately I'm the Git guy for my work ATM. (People ask me when they can't figure out something)

woven brook
#

also a temp brain model I guess

novel barn
#

My thing about the zomboid api is I can't find what's available to me. I wanted to get the length of the array that held all body parts and I spent a day trying everything I could think of. Eventually I found getPlayer():getBodyDamage():getBodyParts():size(). How was I supposed to know that the size method existed? I can't find any documentation anywhere. I've been digging through the javadocs just to get a better understanding of the object structure but it doesn't appear to be 1:1 to the exposed lua structure.

If I want to burn a body part, the javadocs list /zombie/characters/BodyDamage/BodyPart/setBurned() but to do it in lua it's GETcharacter/GETbodydamage/GETbodypart/setburned(). I had to figure that out through trial and error. Size() isn't mentioned in any docs I can find.

red tiger
bronze yoke
#

:size() isn't a zomboid thing, it's a java thing

#

just googling arraylist (and other java types) should come up with docs for them

red tiger
#

Java objects also use 0-indexing while Lua tables uses 1-indexing.

#

This isn't a real Lua environment. It's simulated.

novel barn
#

didn't realize I could use java like that in lua. I'm still in the middle of my lua class and have extremely limited java knowledge.

red tiger
#

Java objects requires .new() where Lua pseudo-classes use :new()

red tiger
#

It isn't full 5.1 but this is the version used when last updating Kahlua2.

#

That information should help you somewhat.

bronze yoke
#

curious, what makes it 'simulated'?

red tiger
#

It imitates the execution and interpretation of Lua script in a virtual machine.

#

I say this because Lua has a strong standard of using the original engine written and compiled in C.

#

Kahlua is a reverse engineering of Lua, meaning that it uses none of the standard builds.

novel barn
red tiger
#

Kahlua also supports unsupported features and syntactic patterns that Lua doesn't.

bronze yoke
#

that makes sense ๐Ÿ‘

red tiger
#

I wrote the portion that covers the Java API for PZ.

thin hornet
#

And this uses umbrella

bronze yoke
#

yeah, i'm actually the author of PZEventStubs

thin hornet
#

Which is a CLI tool

red tiger
#

I'm glad that other people are making tools.

novel barn
#

I'm beginning to notice how tight-knit but active this community is

red tiger
#

Also if you want to go off the deep end, you can mod PZ in TypeScript.

thin hornet
#

Umbrella is a game changer. At this point i started making mod in lua again.

novel barn
#

I've seen that but I'm fine with lua for now. It makes me uncomfortable to write code in a txt file for some reason. ๐Ÿ˜‚ Or maybe I just completely misunderstood what I was looking at. I saw what looked like typescript or lua code in a txt and noped right out

thin hornet
#

Code in a txt file?

red tiger
#

Probably ZedScript.

thin hornet
#

ah yeah ok

red tiger
#

Here's Umbrella in action:

harsh current
#

Sorry to interrupt, but I have what I hope to be a quick question.
I've been poking through the PZ .classes to make some changes for lighting and I can't immediately find the corresponding .jar files except for top-level jars. In fact, not just for lighting but for any jars outside of those hosted on ../ProjectZomboid/

Does this mean I'm not decompiling the project correctly? It seems like all these .class files I'm seeing are supposed to be rolled into a lower-level .jar (eg: ../ProjectZomboid/zombie/iso/somekindofLighting.jar), or is that a misinterpretation of the java structure?

thin hornet
harsh current
#

That's kinda what I figured. I wanted to tweak the visual radius like the 360* workshop mod does, and that also requires circumventing the typical Workshop mod route.

thin hornet
#

Oh yeah java mods can be dope as hell.

bronze yoke
#

i'm not really familiar with how java operates, but my experience with pz has always indicated that the game does just run the loose .class files, if that's your question

red tiger
#

I don't have time to help people do java mods but I'm one of the oldhats here.

red tiger
#

I've modded PZ's Java code for nearly 10 years.

#

There's a few of us but we're sort of closed off as a community.

harsh current
#

Well, I'm pleased to meet you

red tiger
#

Sometimes Java mods can change the game's course.

#

So don't count it out immediately.

thin hornet
#

Minecraft forge was great

#

I wish we had something similar but i doubt we are heading that way anytime soon.

novel barn
red tiger
thin hornet
#

bukkit was noice

#

then it became mcpaper

novel barn
#

Minecraft has Jeb. We have Jab. ๐ŸŽ†

thin hornet
#

Serverside only mods

#

That was great

red tiger
#

I mean.. I do have the unreleased Crowbar project.

#

It isn't trying to be forge. It's trying to add missing modding features.

#

Allows me to do things like this:

thin hornet
#

Lets just add javascript scripting engine?

red tiger
thin hornet
#

blurry bg

trim mist
#

I'd be all over that ngl

#

I can't tell you how many times I've run into things that haven't been exposed. or wanted to do things not possible at all in lua

#

like changing the vision cone, etc.

thin hornet
#

@red tiger was there any protection in place with minecraft java mods? Or there could have been "virus" like mods anytime

red tiger
#

I recently offered TIS to have my ShaderProfile API to manipulate Shader Uniforms from Lua but they declined for vague reasons.

#

I might release it as a mod.

bronze yoke
#

i'd use it

red tiger
harsh current
# trim mist like changing the vision cone, etc.

I'm mean that's what I'm trying to mimic. The aforementioned mod pretty much changes calculateVisionCone() function in zombie/iso/lightingjni.class to just be

return 2.0;
I'd like to take a shot at mimicing it too, but .class files are locked

trim mist
#

I would love to do that but also. I wanna put like a divot of darkness in the middle

#

so I really wanna mess with it lol

bronze yoke
#

it's honestly not as useful to me now as it was when you were first working on it, i'm not really in the graphics department and the project i did have use for it on is pretty much dead

#

and outside of myself i have no clue how in demand it is

#

but shader control really seems like something we should have

red tiger
#

You would see a revolution in PZ modding if this feature became public consumption.

#

I wouldn't be able to come up with the ideas that people would come up with if they had this in their toolset.

#

I don't sit well with myself holding onto the tool, which is why I offered it to the official game.

#

Now that I know that they don't want it, I can feel better releasing it in some capacity.

thin hornet
#

Shader would do cool drug effect etc

bronze yoke
#

i want to mess with model shaders mostly

#

i never touch ui if i can avoid it x3

trim mist
bronze yoke
#

the animation system seems complex

red tiger
#

A little late but found the pics

trim mist
thin hornet
#

I'm wondering if the dev have special tools that we don't for example software to manage animation xml and zedscripts etc but would be dope to have better tools instead of manually typing every by hand.

red tiger
#

Final pics.

thin hornet
#

In the past i wanted to make a software for managing txt script but got tired.

red tiger
#

Shaders can revolutionize the game if controllable.

trim mist
#

Is there ever like. an AMA thing the devs do?

red tiger
thin hornet
#

Jab has one for the txt script files

trim mist
#

I would love to ask them some questions

thin hornet
red tiger
thin hornet
#

pzpw and pzstudio was really just so i can make my modding more comfortable.

red tiger
#

All I want to work on are tools.

#

Don't need to touch the game.

thin hornet
#

All i'd want to work on is mods

red tiger
#

And that's why you work on mods.

red tiger
#

I haven't launched PZ to work on actual mods in about a year.

#

There's been a couple times for some HTML UI engine mod.

#

But it was so brief.

thin hornet
#

GTA Modding is great, you can use C#, Lua or JS to create mods. And they included CEF for making html,css,js UI.

red tiger
#

Guessing that I'm accidentally making this myself.

#

xD

thin hornet
#

Problem with modding gta is that the game is empty.

#

PZ has everything. so when you create a mod, it really just add more to the game instead of making the game.

#

Downside of pz modding is lack of access to many things in java and the fact that we are stuck to using lua only. But we don't care cause the game is just dope.

red tiger
woven brook
#

guys

#

any ideas on what the mesh for the lab station should be?

wet dune
#

How would I create a simple bolt action rifle?

weary matrix
#

anyone knows if it's possible to install mods on a server without going through the workshop? Same as when you put mods in ~/Zomboid/mods basically

#

@bronze yoke any clue?

bronze yoke
#

the server uses the user directory too

weary matrix
#

oh nice, guess this is new cause I remember trying a while ago and it was not working

weary matrix
bronze yoke
#

you do need to list the mods in the server ini

woven brook
bronze yoke
#

if you meant to get it to use that directory, it should already be using it, though you can tell it to go wherever you want with -cachedir

woven brook
#

same with the brain model

weary matrix
woven brook
#

honestly idk

#

looking for ideas

#

currently the process is just

#

kill immunes

#

extract brain

#

turn into cure at a powered lab station

#

but that seems a little too simple

trim mist
#

You're taking the Last Of Us approach I see

weary matrix
#

๐Ÿ˜‚

cosmic arrow
harsh current
#

Wait throw corpses is your mod? Thanks for that!

weary matrix
#

It is!

#

thx โค๏ธ

harsh current
#

I threw a corpse out a window as recently as today!

weary matrix
#

haha! Glad you like it! ๐Ÿ˜

harsh current
#

Yeah, and it was great to relax with some Project Zomboid afterwards

wet dune
#

Does anyone know how to make a simple gun mod? Is there a good tutorial?

harsh current
#

I havenโ€™t watched it, but whatevs

weary matrix
wet dune
#

Is there someone who has a template or something?

weary matrix
trim mist
#

lord knows I referenced the other big trait mods a lot

bronze yoke
#

they don't own the ideas of how they did it, and they certainly don't own api calls or the script formats - you can definitely check other mods without copying them

harsh current
#

@wet dune have you done programming before?

wet dune
#

Yes

#

On unreal engine

#

But with blueprints

harsh current
#

Ok, then yeah you should be fine by using an existing an existing mod as a template

wet dune
#

I'm making a basic overhaul zomboid server
Basically turning it from zombie survival to war simulation

#

All I'm doing is removing zombies and stamina for now

harsh current
#

It sounds like youโ€™d be better off importing existing weapon packs or other requisite mods and spending time working through integration than building from the ground up

#

But hey the development is part of the fun I guess

wet dune
#

Is there a way to remove all weapons from spawning except one?

weary matrix
harsh current
#

Check out this video. It covers a fair bit of all the relevant stuff related to making a gun mod

#

Including spawning rates

wet dune
#

Ah ok

#

Thanks for your help btw

harsh current
#

Hey co` do you do any amount of Java modding for PZ?

weary matrix
harsh current
#

Maybe you can advise, I had this question earlier but didnโ€™t really get an answer:

I've been poking through the PZ .classes to make some changes for lighting and I can't immediately find the corresponding .jar files except for top-level jars. In fact, not just for lighting but for any jars outside of those hosted on ../ProjectZomboid/

Does this mean I'm not decompiling the project correctly? It seems like all these .class files I'm seeing are supposed to be rolled into a lower-level .jar (eg: ../ProjectZomboid/zombie/iso/somekindofLighting.jar), or is that a misinterpretation of the java structure?

woven brook
#

How can I check for an object at a specific tile?

harsh current
#

Somebody responded and said they thought that PZ just executed the .class files directly but that seems like an uncommon way for a game to do things. It might be true but Iโ€™m not sure yet

harsh current
woven brook
harsh current
#

Oh, dang, I donโ€™t know then

woven brook
#

oof

#

i tried

#

isobjectpicker.pick and picktarget

#

no luck

#

oh better idea

#

I make it an appliance

#

and you "cook" the brain

#

now

#

does anyone know some good appliance modding examples?

#

or vanilla files I should look at

fathom dust
#

Looking for help instantiating a Java class from Lua. Basically I want to copy a vehicle's data so I'm hoping there's a way to make a new BaseVehicle instance and copy the values in from an existing vehicle instance.

weary matrix
woven brook
#

nah I think an appliance is cooler anyway

#

gonna try this

weary matrix
fathom dust
#

thanks, i'll see what comes up through that route

weary matrix
#

a few methods can't be decompiled but it's a limitation of intelliJ decompiler

pliant yarrow
#

Hey co`, I hate to be a bother but I have a question about something you brought up yesterday if that's alright 02shy

#

You said perks isn't exposed and I'm still getting an error assigning a perk boost and I was wondering if I was missing something because I don't know why it's not working
SpecialInterest:addXPBoost(Perk.Fishing, 2) is giving TraitFactory$Trait.addXPBoost> invalid perk passed to Trait.addXPBoost trait=Special Interest perk=null

harsh current
bronze yoke
#

should be Perks.Fishing

pliant yarrow
#

I tried that and it was doing nothing, and then I thought co` said it was Perk but I may be mistaken

weary matrix
bronze yoke
#

it isn't exposed in the usual manner

#

not through the class exposer, the table is added to the lua environment elsewhere

weary matrix
bronze yoke
#

zombie.character.skills.CustomPerks

#

in initLua()

#

they are the exceptions but there are a few things exposed like this

trim mist
#

Anyone know if there's a way I can stop tripping when running through trees?

#

or at least, does anyone know of an event that fires? OnObjectCollide doesn't seem to fire on a character colliding with a tree

pliant yarrow
#

So I'm still a little lost, I don't know how to set Perks to be exposed SilvShy

bronze yoke
#

you don't need to do anything, Perks.Fishing is fine

#

co was mistaken

pliant yarrow
#

Okay, then I'm confused why the xp boost isn't showing up in game. Do I need to do separate code to display the change in level visually? It doesn't appear to raise the level or xp boost at all.

bronze yoke
#

when does the code run?

pliant yarrow
#

on character creation. I take it you need to assign stats to traits on boot?

#

My idea was to avoid creating a bunch of unnecessary traits so on character creation it would roll an XP boost assigned to one trait

bronze yoke
#

oh, so the issue there is that traits kind of don't exist

#

after you create your character your traits are just a list of trait names, stuff like xp boosts are just applied to the character when you create them

#

so if you change the trait after creating the character, it won't do anything to the character

pliant yarrow
#

I gathered that from making the picky eater traits, but the XP boost code seemed contingent on a trait. So this is impossible then I think.

bronze yoke
#

oh, no, it's actually pretty easy

#

player:getXp():setPerkBoost(Perks.Fishing, 2)

#

you might want to add it to their existing perk boost

#

it'd be annoying if you already had a higher boost and this replaced it

thin hornet
#
local playerXp = player:getXp()
local fishingBoost = playerXp:getPerkBoost(Perks.Fishing)
playerXp:setPerkBoost(Perks.Fishing, fishingBoost + 2)
bronze yoke
#

hmm, i see a get/setPerkBoost on IsoGameCharacter, but the javadoc doesn't have it...?

#

it's apparently public and everything

#

that would be slightly tidier to use

#

oops... that's on XP

thin hornet
#

i never use javadoc

bronze yoke
#

same file ๐Ÿ˜‹

thin hornet
#

oh ya

#

XP being a class inside a class

#

didn't know you could have classes inside an other class in java.

pliant yarrow
#

Thank you. That all works. Thank you so much everybody. Heart

weary matrix
woven brook
#

Does getmousex return a relative position or worldposition?

#

relative

#

oof

weary matrix
#

luckily you got your answer ๐Ÿ˜…

red tiger
#

Cool project though.

#

If you can't decompile via FernFlower, use JAD as a secondary.

#

(Use JD-GUI)

drifting ore
#

how do you get a trait when inside a game?

trim mist
drifting ore
#

like when im in a game and you get a trait like underweight overweight etc do you know how to make it

#

second wind

trim mist
#

I'm confused--are you asking how to make a new trait? or assign yourself one when you're already in game?

drifting ore
#

no im saying a tait in the inside pz for a year a staving with a underweight

#

like a trait in the game with future of the game

bronze yoke
#

player:getTraits():add("MyTraitName")

drifting ore
#

how do you give a trait another trait

#

so like feeby <custom trait> has weak

woven brook
#

any ideas why this is throwing an error?

#
    local y = worldobjects[1]:getY()
    local z = worldobjects[1]:getZ()

    local e = getSquare(x, y, z):getObjects()
    if e:size() > 0 then
        for i, ii in pairs(e) do
            print(ii)
        end
    end```
#

line with pairs

#

error is "Expected a table" but it should be one

drifting ore
#

if you panic how do i make it so if you panic for a certain time you get a trait

trim mist
#

This makes more sense. I think if you take a look at the more traits mod (and the dynamic traits mod) you might be able to piece together a solution

woven brook
#

but e[i] is always nil

trim mist
woven brook
#

yup

#

it returns objects

#

every time

#

the right amount for the nile

trim mist
#

You might need to drill down further in the data. For example it might be the lua equivalent of a class, but there might be a straight-up table of objects you can use inside

#

have you been running the game in debug mode?

woven brook
#

yea

ancient grail
#

Give a trait a trait
Omg that is somesort of inception right there

#

Badonn i will send you dm

woven brook
#

I think you're right

#

just looked at the javadocs

#

lemme try smth

trim mist
#

have you been able to take a look at the object in the... break screen or whatever it's called? lol

#

debug screen?

woven brook
#

oh

#

the

#

yeah

#

one sec

#

How do I do that @trim mist ?

#

im in the break screen

trim mist
#

I'm having a brain fart, i'll take some screen caps

woven brook
#

alr

jaunty marten
bronze yoke
#

e is an ArrayList, not a table

woven brook
#

thanks

#

back to square zero now though

trim mist
#

I went overboard oops lol

woven brook
#

ty

bronze yoke
# trim mist

the blank bar at the top of the lua file list is a search bar

trim mist
#

WHAT

#

THAT IS SO USEFUL TO KNOW THANK YOU lmao

novel barn
# trim mist

This is extremely helpful! I didn't realize the current variables were displayed at breakpoints like that!

woven brook
#

finally

#

now those delicous immune brains can be put to use!

novel barn
#

@bronze yoke completely unrelated to anything that's been discussed recently but your learn to read mod is one of my favorites. I'm only just NOW noticing there's a recipe to write your own learn to read mag. Doesn't help me as a solo player but it makes total sense that you could put together some learning materials for a fellow survivor in MP. Just wanted to say thanks for putting together a mod that has improved my enjoyment of this game. ๐Ÿ™‚

bronze yoke
#

oh thank you so much! ^_^

woven brook
# woven brook

Gonna be honest the lab station model is just a microsope I scaled horribly wrong ๐Ÿ’€

#

And I thought

#

Eh good enough

#

Looks sciencey, right?

novel barn
#

I mean I could see the microscope shape but it's convincing enough ๐Ÿ™‚ I only recognized it because I know you mentioned using a microscope as a mesh earlier.

woven brook
#

I had a cool idea

#

Where

#

Using normal brains in the cure machine

#

Sends out counterfeit cures

novel barn
#

You might be closing in on what caused the Knox Virus in the first place ๐Ÿ˜‚

#

something something mad cow disease

woven brook
#

So if you โ€œaccidentallyโ€ put a non immune brain in there then well

#

Wont do shit

#

Sell em to the guy across the street

#

Kidnap the wrong person?

#

No worries just make a fake cure!

woven brook
#

I make infected brains give infection

#

If you put them in

#

And then you can put cures/infections in food

#

That is a great idea

fathom dust
#

anyone know how to make a copy of an instance of a java class from lua by chance?

trim mist
#

If you figure it out, lemme know. I'm pretty sure that's impossible

fathom dust
#

damn. i think i actually need to extend a java class to get what I want. that may also be impossible though

bronze yoke
#

extending is impossible

fathom dust
#

well damn, i guess i have to replicate ISVehicleMechanics then. that's about 1500 lines to sort through

bronze yoke
#

isn't that a lua class?

#

you can extend those fine

fathom dust
#

yes but what i really need is a copy of a vehicle instance

#

if i can't do that, i can reference the original, but have to modify the above Lua class to modify the outputs from the vehicle instead of just extending the vehicle and modifying the getters

jaunty marten
#

xy problem again and again, just say what u really want to do

fathom dust
#

copy a vehicle and modify the values to input into ISVehicleMechanics

#

i.e. skew the values to simulate foggy memory, allowing the player to open the vehicle mechanics view away from the vehicle (that part i have working to some extent already)

jaunty marten
#

why do u want to copy vehicle instead cache the actual object of one

fathom dust
#

my first thought was to copy the vehicle and modify the values of it, or extend it to do so

#

my backup option currently is to replicate ISVehicleMechanics to work with a custom type i make

#

because if i cache the actual object and change values it will change the original vehicle

#

i want to change the values that appear in the vehicle mechanics view without affecting the actual vehicle

jaunty marten
#

for what what

#

@ancient grail btw hello to u too

fathom dust
#

ideally from the minimap, but initially from a context menu option that doesn't require bing next to the thing

jaunty marten
#

you don't need to copy a whole file of vehicle mechanics menu, u can just create copy of it (not file but by derive method) and override functions that handles vehicles parts

#

cache actual vehicle object and use it as usually

fathom dust
#

i actually tried asking about that route first and was told you can't do that

jaunty marten
#

for example I found only 4 functions that handles vehicle parts: ISVehicleMechanics:initParts(), ISVehicleMechanics:recalculGeneralCondition(), ISVehicleMechanics:renderCarOverlay(), ISVehicleMechanics:getMouseOverPart(x, y)

#

there's more to do than just override 4 functions but actually it's easy to be done

novel barn
#

I have a feeling I already know the answer is no but I figured I'd check here just in case. I'm trying to create a sandbox variable for a trait cost. However I think I need an event to actually adjust the trait cost before the user selects it. My code so far:

  1. loads the trait into the game OnGameBoot โœ…
  2. Player adjusts trait value on sandbox screen โœ…
  3. I try to adjust the trait cost and reinitialize the trait between the sandbox screen and the character trait screen ๐ŸŸฅ

My problem is that I need something to trigger the reinitialization and I don't know if any events occur between the sandbox page and the trait screen. None of the events here https://pzwiki.net/wiki/Modding:Lua_Events really stood out as usable.

bronze yoke
#

since the ui is lua you don't really need an event, you can just hook one of the related functions

#

i didn't realise you could just reinitialise the trait like that... i had a bunch of annoying code trying to accomplish the same thing

#

actually might still be necessary, not sure if it would have actually helped with the problems i was facing, but still definitely better to reinitialise it

novel barn
#

can you recall which mods make use of that annoying code? Or did that not get published? I'd like to take a look at what you did and I have no idea how to use hooks yet.

bronze yoke
#

it wasn't published because i couldn't get it quite right and then lost interest

#

i did it by hooking the metatable for getCost() - but if you can just reinitialise the trait that isn't needed

#

the issue i had was that the trait list wouldn't re-sort itself, and if the price went from positive to negative it would stay in the wrong list

#

which might not be an issue in your case but it was in mine

#

i think i got the sorting working...?

novel barn
#

oh I have no idea if I can reinitialize the trait. Honestly I think it's 50/50 if calling the Init function again might just make a second trait...

bronze yoke
#

i checked after you mentioned it and it does

novel barn
#

lol

#

I'll stick with hooking GetCost(). It'll be a good learning opportunity for me.

#

Thanks!

trim mist
#

Anyone have any idea why zombies won't highlight or get an outline?

#

that highlighted bit in the middle is the important part. These commands all run, no error

#

even aiming at a zombie doesn't show any change in their outline

bronze yoke
#

iirc it's updated every frame so lua can't really do anything to it

jaunty marten
autumn sierra
#

does anyone know if there's a guide somewhere for editing zone zombie clothing? im working on adding some new hats to the game and im not sure where to start, i have the textures made already and everything i just don't know how to get them to spawn on zone-specific zombies

novel barn
# jaunty marten did u try `OnInitWorld` event?

At face value that seems like it would trigger after character creation. I need to adjust trait values after the sandbox page and before the character creation page. I'll check it out and see if I can figure out when it triggers.

bronze yoke
#

well you struck my curiosity so i took another look at it and i got it working properly this time

jaunty marten
#

at least I hope but in pz usually name of smth do not correspond to reality

novel barn
#

Correct. OnInitWorld happens immediately after the game determines possible spawn locations. Or at least it does with Pillows Random Spawns on. Pillows is probably calling OnInitWorld as well.

unborn rover
#

Anyone have an idea what the result 15 error means? Trying to upload a mod

jaunty marten
novel barn
#

I don't have much in that log file personally

jaunty marten
#

@novel barn so about OnInitWorld did u test that it actually triggers after characters creation?

novel barn
#

I'll turn off all my other mods and try to isolate where it gets called

#

I really should have been in bed 20 minutes ago though. Gonna check this and call it.

bronze yoke
novel barn
#

YES! That's why I stuck around hahaha

bronze yoke
#

it's also on my github if you don't want to go through the steam crap

jaunty marten
#

cos I checked java code and OnInitWorld should be called exactly before character creation phase

bronze yoke
#

wdym? that's not what i'm seeing at all

unborn rover
jaunty marten
#

cos by ur screen I see what u trying to UPDATE existing workshop item

#

instead creating new one

bronze yoke
#

you have left the id of another item in your workshop.txt

novel barn
#

fwiw I changed my traitInit call to the OnInitWorld event and the trait is not found in the selectable traits menu. I would suspect that OnInitWorld happens after the traits screen

jaunty marten
#

ha-ha, I completely forgot how looks character creation in singleplayer

novel barn
#

Ohhh interesting. ๐Ÿค” I guess MP really was a mess for them to get running

unborn rover
jaunty marten
#

seems I found part of code for singleplayer character creation but it won't work for second character creation (after death of first) so albion method will be fine

novel barn
# bronze yoke well, it is now a part of Zombie Contagion's trait module <https://steamcommunit...

Thanks for updating this! I'm looking through it now and there's a lot going on that I don't understand. My Lua class covers metatables next so I'll finish that section and see if it helps make some of this out. Sometimes I just need to bang my head against it for a few hours or days before it clicks. It'll be really constructive for me to have the class on metatables and then a PZ reference to study.

jaunty marten
novel barn
#

re github: Is the workshop synced to your github in any way (is that possible?) or do you just use github to version your code (among other uses)

bronze yoke
#

the latter

#

it's mostly a portfolio really

novel barn
#

literally the main reason I'm here right now.

bronze yoke
#

it is possible to sync them but it's annoying and requires a bot steam account (with their own paid copy of zomboid, i believe)

novel barn
#

my github account is sparse because all my contributions were tied to my former employer in a private repo. Now it looks like I've never done anything

bronze yoke
#

chuck has done it and it sounded like a massive pain

novel barn
#

Yeah I'm happy to just hit upload in the UI. /shrug

#

Alright if I don't stop now I'm going to lose track of time and the sun'll be up. Good night everyone! Thanks for all the help today! ๐Ÿ›๏ธ

mellow frigate
#

Hello there, is there a way to get color selection from sandbox options ?

weary matrix
#

Hey, just realized TIS added getUrlInputStream. Any one tried to use it? I'm wondering what happen in case of network errors (timeouts, invalid domain/name, url etc). Any clue?

#

@tame mulch Hi, I would love to have a way to parse JSON from Lua, without having to implement a JSON parser myself. A global @LuaMethod like parseJSON(String JSONData) that would return a Lua table would be awesome. Have you guys ever discussed this?

tame mulch
mellow frigate
weary matrix
drifting ore
#

Hey all. I had this mod idea and was just curious if it was possible to make, but I doubt it.

There's this game called The Long Drive. The gameplay is pretty simple. You have this randomly generated road in front of you, and points of interest that generate along the way where you can stock up on fuel, food and junk to make your car cooler. I think it would work really well with PZ gameplay, where the POIs would be guarded by zombies and loot was really scarce and stuff, but I guess the main challenge would be the randomly generated road and POIs. I don't think it's possible but I haven't researched it one bit. Figured it would be quicker to ask for a big no here. Thanks!

mellow frigate
weary matrix
#

hum, trying to embed some text with a youtube link in a ISPanelJoypad object, but it seems my link is stripped from the text :/

#

any clue how to fix this?

woven brook
#

can ayone think of some sciency-ish vanilla model?

humble raft
#

Is there a guide I'm missing that covers setting up a VSC workspace, or is IntelliJ the only real option?

woven brook
#

I use vscode

humble raft
#

Thank you!

woven brook
#

wrong screenshot

#

texture issue?

#

or what

#

the uv should be right

weary matrix
#

So I have this Lua code:```lua
self.richText = ISRichTextPanel:new(x, y, self.width - x, self.height - padY - btnHgt - padY - y)
local message = getText("UI_ModGuardian_Youtube_Link") .. " TEST "
self.richText:setText(message)

in shared/Translate/EN/UI_EN.txt I have this:

UI_ModGuardian_Youtube_Link = "https://www.youtube.com/watch?v=5yFPuinN4wI"

But the panel is missing the link, I can see the "TEST" part though. Any clue how to make it so that the link is displayed properly?
#

if I do this then it's working properly:

local message = "https://www.youtube.com/watch?v=5yFPuinN4wI" .. " TEST "```
#

but I'd like to keep the link in Translate if possible

woven brook
#

FINALLY

#

embed fail

humble raft
#

Going through the boilerplate mod practice- is there a specific reason why a recipe with no reagents is uncraftable?

#
recipe Create TestItem
    {
        
        Result:TestItem=1,
        Time:5.0,
        Category:Cooking,
    } ```
#

I see it in the crafting menu and all

fast galleon
humble raft
#

Ahhh gotchya- I wasn't sure if I was just doing it improperly or if that was intended- thank you

fast galleon
#

If the getText returns "" that probably means there's an issue adding the text

weary matrix
fast galleon
#

Can you try it without any special characters

weary matrix
#

hum, I don't think I have any special character. Here's the full content for this file:

UI_EN = {
    UI_ModGuardian_Title = "ModGuardian"
    UI_ModGuardian_Text_PlayerBlacklist = "The author of %1 decided to blacklist you from using his mod."
    UI_ModGuardian_Text_ServerBlacklist = "The author of %1 decided to blacklist your server from using his mod."
    UI_ModGuardian_Text_ExclusiveServer = "The author of %1 decided to make his mod exclusive to a list of servers but yours is not allowed."
    UI_ModGuardian_Text_Modpack = "The author of %1 doesn't want his mod in a modpack. You can still use this mod outside of a modpack, or you can create a Steam workshop collection as per: https://www.youtube.com/watch?v=5yFPuinN4wI"
    UI_ModGuardian_Warning = "Your game won't work until you uninstall this mod."
    UI_ModGuardian_Youtube_Link = "https://www.youtube.com/watch?v=5yFPuinN4wI"
}
#

special characters, you mean like UTF-8? Or do you mean non alphanumeric characters?

fast galleon
#

You can test things fast by printing the value in console, change text in file, reload with Translator.loadFiles and print again. I think that's the right command.

PS: I can get that text in console so it's not that

If there was no translation you would get the string "UI_..."

weary matrix
fast galleon
weary matrix
#

weird

willow scroll
#

can someone make a mod that add a wooden katana , bokuto into the game ?

weary matrix
#

Anyone tried to use getUrlInputStream()? It's returning a DataInputStream object. I'd like to call the method readFully() but it requires a byte array. So I guess I'm fucked right? Also most of the methods can trigger some IOException, so is there a way to catch those exceptions?

weary matrix
#

that is if you're willing to pay for it of course

frank elbow
weary matrix
frank elbow
#

You can just wrap the entire thing in a pcall

weary matrix
proven bough
#

Hey guys, I'm trying to write a little mod that allows me to craft a weapon, and it keeps chucking up an error and I'm not entirely sure how to fix it :/

weary matrix
#

also pcall would catch errors in Lua, but would it catch a Java exception?

frank elbow
#

There's certainly an implementation in kahlua, so unless it was intentionally taken out for some reason it should

frank elbow
#

On second thought, though: the BufferedReader class is exposed. Maybe it would be possible to create an instance of that with the stream

weary matrix
proven bough
#

How do I do the thing where I embed the text, instead of just sending a massive wall of text?

frank elbow
#

```lua
-- code here
```

#

Or send the file, but the code fence works better for mobile

proven bough
#

ffs every time I try to copy it, it just goes to send a .txt instead

#

so uh

frank elbow
proven bough
#

It says it's related to ISCraftAction