#mod_development

1 messages ยท Page 267 of 1

ancient grail
#

you need to reverse the loop

#

if its forward it will error

bright fog
ancient grail
#

the code is not the problem
its the explanation on the problem/situation/goal is

bright fog
#

It's ok

#

-# Use this format for easier reading:
```lua
<code here>
```

#

@modern hamlet for code blocks

ancient grail
#

hmmm.. cuz when i removed stuff from my functional atm mod
i used reversed forloop
then send something to server code cant remember exact syntax

bright fog
#

Also that just won't even work here

ancient grail
#

ill check

modern hamlet
#

its' working now lol

bright fog
#

The problem here is that you loop from 1 to stuff, then try to access stuff[i]

modern hamlet
#

except for the inventory window.

bright fog
#

That won't even work

modern hamlet
#

?

bright fog
#
            for i = 1, stuff do
                local item = stuff[i]
                container:Remove(item)
            end
#

This won't work

modern hamlet
#

it is working

bright fog
#

Then you didn't show us the right code, bcs that won't work lol

modern hamlet
#

i put stuff in, stuff gets removed

bright fog
#

I just explained why

#

You are looping from 1 to stuff, meaning stuff is a number

#

But then you try to access entry i from stuff, meaning stuff needs to be a table

#

So either stuff is a number or table, but in both cases it will error

#

Or it's just not even running through your code here

#

This is what it should be

            for i = 1, #stuff do
                local item = stuff[i]
                container:Remove(item)
            end
#

You're running this server side ? Then you should see errors in your coop-console if host or dedicated server console

modern hamlet
#

sadly i just dont know enough to communicate it in a non dumb way

#

lol

#

i appreciate the help

ancient grail
#
    local totalSellAmt = 0
    local pl = getPlayer()
    local piecePrice = 0
    for i = atm:getItems():size(), 1, -1 do
        local toSell = atm:getItems():get(i - 1);
        piecePrice = FunctionalATMs2.checkQty(toSell)
        if toSell and piecePrice > 0 then
            print('Sold ' .. toSell:getType() .. ' for ' .. piecePrice)
            pl:setHaloNote(tostring('Sold ' .. toSell:getType() .. ' for ' .. piecePrice))
            totalSellAmt = totalSellAmt + piecePrice
            if isClient() then atm:removeItemOnServer(toSell); end
            atm:DoRemoveItem(toSell);
        end
        getPlayerLoot(0):refreshBackpacks()
    end
    return totalSellAmt
bright fog
#

Also caching that atm:getItems()

#

Anyway, DoRemoveItem sound like a more plausible method to remove items

#

Or I'd feel like it would properly sync stuff

modern hamlet
#

thanks both of you ๐Ÿ™‚

ancient grail
bright fog
#

Not sure what it does

ancient grail
#

im already used to it plus my snippets / shortcuts / hotkeys
are all sets

str = string
int = integer
flr = floor
sq = square
pl = player
targSq = destination
spr = sprite
wpn = weapon
zed = zombie
car = vehicle
targ = otherplayer
sprName = spritename
obj= object
dmg = damage
opt = option
func = function
inv = inventory
tab = table
clan = faction
sh = safehouse
hp = health
bd = bodydamage

im aware i should make it readeable
i truely am but nah

bright fog
#

Nah just I was confused at wtf atm was lmao, as it seemed to be an inventory

#

But then realized it's just an ATM

ancient grail
#

atm
cuz functional atm

#

its the obj

bright fog
bright fog
ancient grail
bright fog
#

Yeah I'm more in the team that full name is way more readable

#

Actually make your variable properly understandable with a simple read

#

Tho I should put myself some naming conventions in my code, as I sometimes tend to go wild lol

ancient grail
bright fog
#

Tbf PZ naming is really not bad

ancient grail
modern hamlet
#

well, i'm so dumb with modding, that i gotta get smart to know if pz is dumb

bright fog
#

Overall what things seem to be, is usually what they are

ancient grail
#

then theres object vs items

#

lots of different items too

and inventory can be container or panel

#

it requires research and debugging for me to get familiar with it
so yeah it creates confusion really

but we get used to it in the long run i guess

ancient grail
bright fog
#

I think I saw something about that, that the player just no longer exists on death

ancient grail
#

i wanted to set its outfit to special zed
but i couldnt
tried corpse tried player

bright fog
#

Go through every zombies, check if reanimated

#

Maybe you can identify the player there

ancient grail
#

maybe neet to fetch all the zed from the list and try and identify

albion mention the moddata gets transferred so that might be the solution

fleet bridge
#

Iirc when you view zombies in cell you can make player zombies show up as a different color. One of the admins in our server does it to hunt for player corpses that wander off.

bright fog
#

Reanimated zombies

timid scarab
#

Anyone know if there's any documentation / tutorials to adding custom zombie types?

bright fog
#

I've made a framework for it however

#

The mod I made with it

#

And ik another person managed to make custom zombies themselves too, but they haven't posted it as a public mod and is linked to their server modpack

#

My guide on how to use is incomplete

#

Haven't had any motivation in the last 2-3 months to do any work on it

#

But you can do things with it, easily

stark tusk
#

Hi guys, im encountering some weird issue where the game is throwing an error on this specific piece of code in this recipe, not sure what im doing wrong, despite it throwing an error, the resulting items still receive the correct values im looking for

timid scarab
bright fog
#

player

#

Not sure, but might be player

#

Vanilla never gives IsoPlayer for player argument

#

Always a number which is linked to split screen players

#

Use that

#
local player = getSpecificPlayer(player)
#

That's my guess

#

(I guess you can replace player)

#

Use it before your for loop

stark tusk
stark tusk
bright fog
#

Actually either it's result the problem

#

OR it's item

stark tusk
#

prolly cuz result is multiple?

bright fog
#

Maybe I'm not familiar enough with it

#

One suggestion when this kind of things happen

#

Just add a print of your variables

#

And in the console, look what it prints

#

You can do that for player, you can do that for results

#

You can do that when for result:getHungChange()

#

And see what it outputs

#

Don't hesitate to print

#

That way it can tell you what type of variable it is

stark tusk
#

this works?

bright fog
#

No +

stark tusk
#

any tips for testing this? i always have to restart my game

bright fog
#
print("Item"..tostring(item))
#

This

stark tusk
#

gotcha, thanks

bright fog
#

Always run your variable through a tostring as if it's nil for example you will error due to not being able to concat "Item" and nil

#

if you tostring you can never get this problem

#

So it's a good habit to have imo

stark tusk
#

gotcha

bright fog
#

Or do like me and half the time don't even bother to concat strings lol, just directly print the variable

#

print(item)

#

Just for a big chain of prints it can be a pain to determine wtf is what

bright fog
#

Not item

#

As I think it's what is causing problems

stark tusk
#

yep i also added a print for result

stark tusk
#

hmm, it got fixed after i explicitly checked for the type
if item:getType() == "PancitPot" or item:getType() == "PancitPan" then

#

weird

bronze yoke
nimble vale
#

If I was using getFileReader to read a .txt file in the folder "Zomboid\Lua\Logs\Chat" should that be possible? because I can write to that folder in a .txt file. Any help would be super.

bronze yoke
#

it's possible, what problem are you having?

nimble vale
#

im getting a stacktrace error from it. I'd use getModFileReader but since its outside of my mod I didn't think that'd work.

#

"-----------------------------------------
STACK TRACE

Callframe at: getFileReader
function: monitorChatFile -- file: ChatLogger.lua line # 104 | MOD: ChatLogger
function: Add -- file: ChatLogger.lua line # 128 | MOD: ChatLogger.
[24-10-24 12:41:48.510] LOG : General , 1729788108510> ."

#

is it because of the monitorChatFile specifically?

bronze yoke
#

can you show the line/function that calls it?

nimble vale
#

dooooooooh i know why I think its a read/monitor issue (not enough coffee) "Events.OnTick.Add(function()
LMSWindow:monitorChatFile()" So what I'm trying to do is monitor for new entries. Then send new entries to a chat window I made in single player but I want it to update as often as possible so I probably did OnTick, any suggestions for something close to real time that won't conflict?

stark tusk
nimble vale
#

would using something like this local checkInterval = 2000 prevent that or do you think I need to make the time between monitoring longer?

rapid gale
#

How do I test my mod? I've made my changes on my github and want to test it locally..'

nimble vale
#

C:\Users\YourUsername\Zomboid\mods

#

there sure be an example mod folder there to show you how to set up the structure if you have problems

#

dont forget to setup the mod.info file as well

#

then when you boot up pz it should populate with your mod to enable

true nova
nimble vale
# true nova if everyTenMinutes is too long a trick i've seen is have a counter added to OnTi...

I tried a work around checking os.date ontick until it hits my desired time. my latest issue is I have a problem reading from a file and displaying it in my custom chat window, I for the life of me can't figure it out. I'm pretty sure I made it work once in the media folder* I had it monitoring OnTick though and manually typed in the text file, but monitoring OnTick was blocking my reads if I remember correctly*. but I'm using another program to write to the file. So to avoid read/write/access issues I had to setup some form of delay before my event fired off.

So pretty much user types in text chat box, checks if its focused and when they press enter. it starts the on tick os.date pull till 15 seconds has passed to limit the use of ontick and also using monitoring on tick for changes in the file for similar issues (read/write/access). Then when it stops, it ends the EveryOneMinute and reads the txt file and puts it in the chat window.

been working on it for three days and everytime I get close something else breaks.

So if anyone has any suggestions I haven't tried i'd love to hear them!

true nova
# nimble vale I tried a work around checking os.date ontick until it hits my desired time. my ...

I'm not sure what your issue is exactly. my suggestion would be to put a print() at certain points that will be easy to find and you can see what parts are working and what is not. I have not messed with the file reader but here is an example from a mod i have messed with that uses it. the .ini file it is reading exists in the mod inside the media folder.

local function readAirdropsPositions()
    print("[Air Drop] Loading air drops positions...")
    local fileReader = getFileReader("AirdropPositions.ini", true)
    local lines = {}
    local line = fileReader:readLine()
    while line do
        table.insert(lines, line)
        line = fileReader:readLine()
    end
    fileReader:close()
    airdropPositions = loadstring(table.concat(lines, "\n"))() or {}
    print("[Air Drop] Positions loaded");
end
nimble vale
# true nova I'm not sure what your issue is exactly. my suggestion would be to put a print()...

`function LMSWindow:readLastChatEntry()
local reader = getFileReader("C:/Users/thegl/Zomboid/mods/ChatLogger/media/chat.txt", true)
if not reader then return nil end

local lines = {}
local currentLine = reader:readLine()

while currentLine do
    table.insert(lines, currentLine)
    currentLine = reader:readLine()
end

reader:close()

if #lines == 0 then return nil end

-- Join multiple lines to form one chat entry
local lastEntry = table.concat(lines, "\n")
return lastEntry

end`

Thanks, mine is like this because of my crazy delay system I setup. Out of curiosity where did you have your "AirdroPositions.ini" file located at in the mod structure for it to read?

#

I tried saving to \media to write instead of the Lua folder (where I could) to see if it would read from there, but now I can't have my external program write there ded I keep getting "Error saving response to chat file: [Errno 13] Permission denied: 'C:\Users\thegl\Zomboid\mods\ChatLogger\media"

true nova
#

it was in the mods media folder

nimble vale
#

Yeah I thought so, so you can write to Lua folders, but read from media :X

true nova
#

im actually not sure where the mod makes the files. I'm looking but it doesn't start with it i don't think, it makes it on game start i think

nimble vale
#

I'm wondering if there's no folder that has both read/write, but I figured my program outside of pz would have access to write, after all I can manually edit a .txt file in media and it let's me and works. So it's a bit confusing

true nova
#

so getfilereader will write a file there if it doesn't exist

#

not that that helps whatever program. i just thought thats neat lol

nimble vale
#

reaaaaaaally, thats interesting. I'm actually doing another python script just to write "hello world" to text files in different folders to test external write abilities.

#

it is

#

thank you again I might end up using it eventually ๐Ÿ™‚

#

hmmm my other python script worked... so i must have messed up formatting my directory on my other script lol

true nova
#

that's pretty cool. Probably how people have made things like streamer integration where chat can spawn enemies

nimble vale
#

yeaaaaaah i'm doing something sorta like that. I was working on a api to actually connect a AI LLM to PZ but it's a lot of work and a bit beyond my skill level right now. So my work around is I wrote a command prompt interface in python, my character uses the single player custom chat window to type in chat > then its saved to a log (was in Lua folders) and then the python script passes that to Koboldcpp and triggers a reply which should write back to a text file which gets read and sent to the custom chat window. This is just Part 1 of my crazy idea...

#

I was working on it and almost had it, but I was up for like 30 hours straight, erased my code by accident had to start over :X

true nova
#

oh no. rip in piece to all lost code everywhere ๐Ÿซก . i like to think When something like that happens that i was just wrong and i'm doing it the right way this time

nimble vale
#

Yeah I had some bad file management that night and thought it was like version 17 and not version 20 of my code and deleted old versions and realized I deleted the good version lol... this is like day 4 for what I thought would be a one day project.

#

Oh jeez I forgot to put my .txt at the end of my path for saving on my other program haha it worked to media, now I just have to fix my code to pass it to the chat window... again

#

lack of sleep is great โ˜•

nimble vale
#

So thank you โค๏ธ

true nova
#

no problem, also note that the boolean parameter in that function is what makes it make the file if it isn't there, if i'm reading it correctly

nimble vale
#

I premade the file, had the boolean already just in case i did something dumb like hmmm... delete it? Not that I would ever do something like that... ๐Ÿคช

orchid drift
#

Yeah, Im not very sure how functions work or how to properly name certain aspects to make it work properly

ancient grail
stark tusk
#

Hi guys, got an inquiry, how do we define if a world object is thumpable (destroyable) or not? Im trying to

  1. make an admin-spawnable version that shouldnt be destroyable, and
  2. i want to adjust the health values of the non-admin version of the object im modding so they dont get destroyed quickly
true nova
ancient grail
nimble vale
#

I swapped back to monitoring now that I realized one of my main issues was a save file path in my external program, still working on getting it to display in the window, cant remember how i did it a couple days ago

stark tusk
ancient grail
stark tusk
#

object sorry

ancient grail
bronze yoke
#

that's the opposite of what they asked lol

ancient grail
stark tusk
#

im not exactly sure how the code assigns IsoThumpable to objects i place, though im guessing thats the default behavior for player-placed objects

ancient grail
#

setThumpable?

usually it spawns the object with the properties assigned to the tile/sprite itself based on .tiles file

#

moveables are thumpables by default

stark tusk
stark tusk
ancient grail
#

you could probably try and mess around with the tile properties via tilezed or play around vanilla tiles using lua console debug

stark tusk
#

yup ill do that

#

thank you

ancient grail
#

just to learn about it

ancient grail
stark tusk
ancient grail
#

you can spawnit and bypass the properties too . there lots of ways doing this

1 example would be spawn something else and then change its sprite

nimble vale
#

You know the worst part? when your tired, messing up, have debuggers running, no stack traces and it still doesn't work ๐Ÿ˜†

dry chasm
# nimble vale dooooooooh i know why I think its a read/monitor issue (not enough coffee) "Even...

Instead of filereader you can try getFileInput(filename).
So something like this:

-- file path starts from %UserProfile%\zomboid\lua\
-- in this example: %UserProfile%\zomboid\lua\externalChat.txt
local file = getFileInput("externalChat.txt")
Events.OnTick.Add(function()
  -- unexpected if file is nil
  if not file then error("File is not defined.") return end
  -- if nothing remains to be read, we don't need to do anything else
  if not file:available() > 0 then return end
  
  -- do whatever you want with it here, ex.:
  print(file:readLine()); -- reads new line whenever a new line is added.
  -- if using readLine, ensure ideally that every entry for the chat ends with a linebreak
  -- otherwise you'll receive an empty string on the next addition
  -- (so text + linebreak instead of linebreak + text)
end)
nimble vale
nimble vale
#

Welp it took me like 4 days but thanks ya'll because I got the first half of my idea done. Gotta finetune the ai personality but this assistant persona was easier for testing.

#

some finetuning and polish but this part is almost done Thank you again everyone!

ancient grail
#

you're making an AI?

nimble vale
#

๐Ÿ˜› mb

#

we'll see how motivated I am after taking this long to do this and I still have some cleaning up to do on it

ancient grail
#

wizardry

nimble vale
#

But a AI chat interface is a great start already.

ancient grail
#

no sh*t

nimble vale
#

I think im the first, its a crazy work around but making a API comparable to discord is... tedious

#

I started but i don't know enough.

ancient grail
#

wdym comparable to disc

nimble vale
#

and thank you, im going to smoke a bowl finally and like maybe play a game for the first time in a almost a week

#

Sooooooo discord's Api is pretty similar to what I accomplished but way better.

ancient grail
#

you mean like discord bots?

nimble vale
#

there's like an officially supported api where you can connect full discords servers to game servers

#

chat, death logs you name it pretty much

ancient grail
#

can i get a link?

#

i havent messed with discord stuff
im gona post the link on the mod tools thread

nimble vale
#

you can open the classes and see the code, theres some websites that mention it, and old posts but I'd have to dig between the old ones before this and the newer ones

#

when i was digging through the classes they even coded their own color in servers ๐Ÿ˜› that was cute

#

Because yeah I thought about running it through discord but honestly I wanted more functionality game wise if I expanded my little project here

nimble vale
#

great hopefully it helps someone, you can use JD-GUI to peek at the class files in zomboid if your curious

ancient grail
#

whats that? tho we have ways to decompile already

ancient grail
nimble vale
#

If you have problems opening a class in a folder, copy one, paste it, rename it to a .java In the folder, open it with JD GUI and all the classes are accessible.

#

and if anyone is wondering the whole javadoc website is 107mb ๐Ÿ˜†

grizzled fulcrum
#

It's not bad for single-class decompilation to quickly check stuff though

minor wharf
#

item Drink
{
DisplayName = "Blue Fanta",
}

Why in game is it referred to as "Blue Fanta" and not Blue Fanta, im not really sure what type this if it doesnt treat "" as a string

ancient grail
ancient grail
minor wharf
# ancient grail remove the "

It is possible to get it to accept strings in the "" format, I want to use lua bytecode as the name for the item and have lua interpret it to kind of "hide" the name, like if you ran print("\101\120\97\109\112\108\101\95\115\116\114\105\110\103") it would print example_string and not the raw bytecode

ancient grail
#

i dont know anything about bytecode
hopefuly someone comes along and answer your question

minor wharf
#

thank you for help

ancient grail
#

that will surely print
\101..

civic prism
#

Is there a mod that adds a foraging keybind?

#

nvm found it

bright fog
#

A key to toggle on off foraging ?

civic prism
#

yeah, it's "search" in the settings so i missed it

robust locust
#

Hiya, I've got a question regarding tile definitions... what exactly does the blocksPlacement setting do? I've got something attached to the wall, but not noticed any placement blocking with other items, so I'm unsure what it does.

bronze yoke
#

keep in mind that despite the name, pz's 'scripts' format is not a scripting language and it won't do anything intelligent

#

you may have some luck renaming the item from lua, but doing it through scripts is a dead end

ancient grail
#

i was wrong

#

you cant place anymore tile objects (not items)

rapid gale
#

any clue about what causes this error? i'm testing a recipe change for The Only Cure locally

#

Whenever I click on the crafting menu it throws an error and doesn'tdisplay

bronze yoke
#

the result item of a recipe does not exist

rapid gale
#

the items do exist though, i havent' changed the result

#

really not sure what's causing the error here

#

...i was missing a comma

vital karma
#

anyone have a suggestion of how I can check what tile a player right clicks on? want to make it so a context menu appears on specific tiles

main pasture
#

You can add your own function to OnFillWorldObjectContextMenu lua event and check position of the worldItems it returns. It seems to return IsoObjects even when the square is empty

#
local function AddToContextMenu(playerIndex, context, worldItems, test)
    for _, item in ipairs(worldItems) do
        print(item:getX(), ", ", item:getY())
    end

Events.OnFillWorldObjectContextMenu.Add(AddToContextMenu)
bronze yoke
#

it is often recommended to grab the square from the first object in the list and then loop through that square's object list

bronze yoke
#

the list it returns contains the first object it finds of a couple specific types, so many types of objects will simply never appear in it, and you often do actually want to find these duplicates (and if you don't then ignoring them is easy anyway)

main pasture
#

Well the loop is kind of pointless in that case. I just copied it from my code (which actually uses it)

#

Oh I see what you mean. Is it faster to loop the items from the square even if that list already contains everything I want?

bronze yoke
#

no, if the event's list works for you it's a bit faster that way

main pasture
#

ok. thanks

vital karma
robust locust
#

I would like to spawn a guitar that's hanging on the wall, but the procedural generation lua doesn't seem to be spawning any, as I've checked many, many houses. Is there something I'm missing? The items are attached to the wall, so I'm adding the items to the WallDecor list.

table.insert(ProceduralDistributions.list.WallDecor.junk.items, "HMW.AcousticBlack_Hanger");
table.insert(ProceduralDistributions.list.WallDecor.junk.items, 3000);

The number is high just for testing.
Should they go in the "junk" or normal list?
Any help is super appreciated

bright fog
main pasture
# vital karma so I would do this? trying to make a context menu pop up if there is a doghouse ...
local function AddToContextMenu(playerIndex, context, worldItems, test)
    local player = getSpecificPlayer(playerIndex)

    if worldItems[1] ~= nil then
        local square = worldItems[1]:getSquare()

        local objects = square:getObjects()
        for i = 0, objects:size() - 1 do
            local obj = objects:get(i)
            local properties = obj:getProperties()
            if properties:Is("CustomName") and properties:Is("GroupName") then
                if properties:Val("CustomName") == "House" and properties:Val("GroupName") == "Dog" then
                    context:addOptionOnTop("There is a doghouse", player, ClickedDogHouse)
                end
            end
        end
    end
end

Events.OnFillWorldObjectContextMenu.Add(AddToContextMenu)

local function ClickedDogHouse()
    print("Clicked a Doghouse")
end
#

not sure if that is the optimal way, but it was the only way I could figure how to determine if the object was doghouse

sleek delta
#

Hi guys I'm new to the game only played about 2hrs can I play with some one to show me the ropes and have a but of crack with

main pasture
vital karma
robust locust
bright fog
bright fog
robust locust
#

Oh ok. Do you know how the game distributes vanilla items like the flags/posters/etc?

bronze yoke
#

i would've guessed they're just part of the map

true nova
crude reef
#

Hello a friend made a mod for Roleplayining systems (chat improvement, narrative in character improvement in game for MP matches based on roleplayining games)
same as sa-mp or san andreas multiplayer
/me command
/do command
/say improvement
ยฟHow can i upload this to Steamworkshop and share it?

true nova
balmy swan
#

Hey. I don't suppose having choices in a crafting recipe with different amounts is possible, right?
Like how recipes have MetalPipe/MetalBar=2 to do something like MetalPipe=1/MetalBar=2

true nova
balmy swan
#

Gotcha, thank you. Works for me ๐Ÿ˜„

bronze yoke
#

that won't work, those functions aren't really able to select ingredients - ontest just checks individual ingredients and oncanperform is checked before ingredients are even tested

#

if you want to do something like that unfortunately you just need to have multiple recipes - the game allows multiple recipes by the same name for this

true nova
bronze yoke
#

yeah, i guess you could implement that with oncanperform but it would display weirdly in the crafting menu

#

i can see why they're replacing the crafting system ๐Ÿ˜…

true nova
#

just adding some or's to the pz script would be pretty cool. I'm actually a little excited for the liquid system since i remember the mod i did a mixed recipe with was for mixing dye, and i think it sucked the way i had to do it

bronze yoke
#

making sources mutually exclusive would be helpful too

#

if you have two sources that can take the same kind of item, one item can fulfill both sources

#

i think it would be fairly complex to implement that with the current way crafting works though

robust locust
topaz tangle
#

hey, my code for an item mod just, isnt working?
would anyone be able to see if there is anything just, obvoisly wrong with my code?

module Base
{
item nanitetail
{
DisplayCategory = Junk,
Weight = 0.01,
Type = Normal,
DisplayName = nanite injector,
Icon = icon_nanite_tail,
WorldStaticModel = items_nanite_tail,
}

model nanitetail
{
    mesh = nanite_tail,
    texture = nanite_tail,
    scale = 0.00015,
}

}

attached is all i see in game

robust locust
#

Thanks!

true nova
#

the square parameter passes the current square being loaded. square:getObjects() will return an array of all of the objects within. iterate through it keeping in mind it is an array and its index starts at 0. find a wall with the properties you want :getProperties():Is("WallN") then make a new object and add it to the square square:AddTileObject(IsoObject.new(square, spriteName, objectName, false)). i think i actually haven't added isoobjects directly just modified existing

true nova
topaz tangle
#

yeah the icon works now
item doesnt appear still but ive got an idea

true nova
topaz tangle
#

the issue im having is that nothing shows up in game

#

module Base
{
item nanitetail
{
DisplayCategory = Junk,
Weight = 0.01,
Type = Normal,
DisplayName = nanite injector,
Icon = icon_nanite_tail,
WorldStaticModel = nanitetail,
}

model nanitetail
{
    mesh = item_nanite_tail,
    texture = item_nanite_tail,
    scale = 0.00015,
}

}

#

current code

true nova
#

is the model named "item_nanite_tail"? and is it in models_X folder?

topaz tangle
#

yes

robust locust
#

For the icon file, do you have Item_icon_nanite_tail?

topaz tangle
#

yes
the icon works now

#

just not the model

robust locust
#

Have you double checked the point where you export the fbx from? i.e. if you're using blender, making sure all the right boxes were checked?
I had a time where I didn't select the item I was exporting, so it didn't show in-game

topaz tangle
#

i can do that

true nova
#

yeah there doesn't appear to be a mistake. i would guess try exporting the model again or even looking at that one to see if it is even there

topaz tangle
#

re-exported it and nothing chaged

#

maybe an issue with the texture?

true nova
#

the model should still appear if it was the texture, it would just have red/white checkers instead

robust locust
#

The file is 36kb, which sounds right.

topaz tangle
#

ah right, with vehicles it just wont show anything lol

true nova
#

are you restarting the game when checking this? i think models need to be loaded atleast when a game is started

topaz tangle
#

yes i am

robust locust
#

Have you added an item before and got it working, or is this 1st time?

topaz tangle
#

i have in the past

true nova
#

try different scaling?

topaz tangle
#

twice actually

true nova
#

i dont know how the game does it but i would assume if the scale is too different it would default to icon, i have made massive models before though

topaz tangle
#

hmm okay

now it shows the icon and no model

robust locust
#

yea a scaling issue could cause it to not show, I've had that where it was too big

#

Are you using blender to export to fbx?

topaz tangle
#

ywa

#

ywaues

#

yes

robust locust
#

๐Ÿ˜„

topaz tangle
#

had my hand in the wrong spot lol

#

holy shit

robust locust
#

Can you take a screenshot of the export window?

#

yikes!

topaz tangle
#

MIGHT be a bt large

robust locust
#

It was there!

true nova
#

lmao

#

yeah zomboid is very very tiny

topaz tangle
#

its got such an odd scale

true nova
#

try working on tiles. individual. pixels. very visible

robust locust
#

I would look at the units you have the blender object using, and the scale of the item, and the scaling export settings...

bronze yoke
#

that's at 0.00015 ingame scaling stressed

true nova
#

one of the few models i've done is at .000063

robust locust
#

Yea, that is crazy. Have a look at scaling it properly inside blender, so that you don't need to adjust it that much in the code

topaz tangle
true nova
#

ah lol ok so that other one was too small

topaz tangle
#

im fine with slowly adjusting

just need to try and find where it is at after eath tings

robust locust
#

I find you need to change the export setting in blender to 0.01, even if the units and object scale is correct

true nova
#

atleast you figured it out ๐Ÿ™Œ . i always have issues getting models to show

topaz tangle
#

yeah!!!!!
thanks!!!

#

this work is, slightly in vain because its gonna need to be a weapon in the future but it definatly helped me
making a murder drones weapon mod, which will probably have some non-weapons in it as eastereggs

robust locust
#

It all adds to the experience gained and knowledge learned ๐Ÿ™‚

topaz tangle
#

yes!!!! this!!!!!!

#

goated
perfect size

#

need to change some stuff but

#

thanks again!!!!!!

#

Pausing work until tomorrow btw
Tired

#

Gonna do the weapon stuff tomorrow

balmy swan
#

I'm having a bit of a weird issue. I have an itemname with a - in it. This seems fine in the txt file, but lua can't detect those. Any way around it aside from removing the -?

bronze yoke
#

what do you mean lua can't detect them?

balmy swan
#

I have an array with a list of items
Base.Axe for example

It loops through the list and tags them. That works fine.
In that array I have an item called Base.Magazine-Flowers

That doesn't get picked up by the code. I noticed the same thing in the PZ item list viewer, typing a '-' doesn't make the items appear. Figured if it's being used as some kind of escape key?

bronze yoke
#

i don't think there's meant to be any limitation like that but as a rule i would avoid internal names with weird characters in them

balmy swan
#

Yeah ๐Ÿ˜… I'm trying to do something with an item from a mod, so I don't have much choice in the matter. Found a way around it, albeit not as performant.

ancient grail
topaz tangle
# ancient grail what is it

Itโ€™s the nanite injector-syringe thing from disassembly drones tails from the indie animated show murder drones

topaz tangle
#

ive got the weapon part working but, ive noticed this happening

#

not ment to be angled like that

#

better pic

exotic oracle
#

I have a problem with my True Music Addon. When I'm trying to publish it to the workshop it can't. I already checked what does result=9 means, but I think my mod structure is correct. I really don't know what to do, can anyone help me?

dry chasm
long beacon
#

How might I be able to override restoring clothing with tailoring to require a recipe? I'm making a specialization-based recipe system (handed out by staff once players have declared a profession) for a server I'm currently developing and have no clue how to manage this, any ideas on at least where I find the action of restoring? A file path would be appreciated if you could figure one out.

exotic oracle
dry chasm
long beacon
robust locust
long beacon
#

I think I might be able to frankenstein this, do I need to define the recipe elsewhere so it operates on a recipe where it didn't before? The NeedtobeLearn parameter could work in making this require a recipe

if not thread or not needle or (not fabric1 and not fabric2 and not fabric3) then
local patchOption = context:addOption(getText("ContextMenu_Patch"));
patchOption.notAvailable = true;
local tooltip = ISInventoryPaneContextMenu.addToolTip();
tooltip.description = getText("ContextMenu_CantRepair");
patchOption.toolTip = tooltip;
return context;
end

#

I know base game code is formatted a little differently so figuring that out is my biggest issue rn

#

Oh also, how do i get the mod to override this file in specific?

#

I'm not new to programming but I'm really new to file interactivity and this perplexes me a bit

dry chasm
# long beacon I think I might be able to frankenstein this, do I need to define the recipe els...

You can nicely have code display with three backticks, "lua", line break, code, three backticks. ex.:
```lua
print("Hello world")
```

print("Hello world")
```I think the learned recipes are actually just strings that're stored instead of definitely requiring a recipe for it.
So if you do want to just lock it behind something like that, you could check for that (untested, but worth a potential try):
```lua
if not self.chr:isRecipeKnown("ValidTailor") or not thread or not needle or (not fabric1 and not fabric2 and not fabric3) then
--...
end
long beacon
#

(The hello world is a check for functionality, right?)

#

OOH you were talking about displaying code in the discord, nevermind

#

lua print("Guh")

#

ok no I did it wrong lol

dry chasm
dry chasm
long beacon
#

DoContextMenu is definitely the right thing to edit though

dry chasm
# long beacon I need to have it be a mod, wouldn't inserting it into the base code just make i...

yes, hence a custom lua file to make a "patch" for it in your mod.

local originalFunction = ISGarmentUI.doContextMenu
function ISGarmentUI:doContextMenu(...)
  local context = originalFunction(self, ...) -- we run the original and get the context from it
  local option = context:getOptionFromName(getText("ContextMenu_Patch"))
  if not self.chr:isRecipeKnown("ValidTailor") then option.notAvailable = true; end
  return context; -- return original return
end
long beacon
#

I've been able to override base game recipe requirements but only for items

dry chasm
#

you''ll need to check though, it seems to add sub-options to it or with different text if it's actually valid, but it should be something along those lines.

long beacon
#

I'll give it a shot

dry chasm
#

If you do want to check available methods and all for the context, lua\client\ISUI\ISContextMenu.lua
So you could also iterate the options instead of by name and check if part of the name is what you want (just be sure to utilize the getText, as it changes with language selected)

long beacon
#

gotcha

#

I'm guessing I put this one in the lua folder instead of the scripts folder?

#

(Probably doesn't matter actually)

dry chasm
#

yes into lua

#

of your mod*

long beacon
#

gotcha

#

Recipe still isn't required, guess I've some tweaking to do

#

does it need to be within a function itself?

#

probably not but maybe I fucked the formatting

robust locust
#

Does anyone know if you make a custom lua file does it need to be referenced in the mod.info file?

long beacon
robust locust
#

Ok kool beans. Thanks!

dry chasm
# long beacon does it need to be within a function itself?

nah, doesn't.
My example likely doesn''t work as it adds other option(s) which're likely required to be disabled seperately if normally valid.
Hence the idea to just iterate them and check parts of their name for a match.
(Essentially the example likely just "disables" the main option, but not the suboptions which actually do the thing)

long beacon
#

Oh that's right, I just have to find the one that returns true

#

Ok I've figured it out, I need to modify this line to have the requirement in it

        tooltip.description = getText("IGUI_perks_Tailoring") .. " :" .. self.chr:getPerkLevel(Perks.Tailoring) .. " <LINE>" .. ISGarmentUI.ghs .. getText("Tooltip_FullyRestore");
    else
        tooltip.description = getText("IGUI_perks_Tailoring") .. " :" .. self.chr:getPerkLevel(Perks.Tailoring) .. " <LINE>" .. ISGarmentUI.ghs .. getText("Tooltip_ScratchDefense")  .. " +" .. Clothing.getScratchDefenseFromItem(self.chr, fabric) .. " <LINE> " .. getText("Tooltip_BiteDefense") .. " +" .. Clothing.getBiteDefenseFromItem(self.chr, fabric);
    end```
dry chasm
long beacon
dry chasm
#

could also make a similar "patch" to the doPatch function ( I reckon) and before returning disable the option in case the character doesn't have it? ๐Ÿค”
Or, potentially, not do the context menu function in the first place if requirements aren't met ๐Ÿค”

long beacon
#

I mean, it's an if/else about whether the character has the ability to fully restore, and if they don't it gives them the option to patch instead. If I could add the isRecipeKnown("ValidTailor") line to the parameters it that would do exactly what I want it to

dry chasm
#

ah

#

so patching should still be possible

#

just not fully restoring?

long beacon
#

yes

ancient grail
#

making a dungeon mod and heres my idea
i used set skeleton to all zeds when player is inside the dungeon
they have random properties
and they reanimate forever and will have new set of properties

dry chasm
# long beacon yes

๐Ÿค” considering the fully restoring occurs in java, it might be easier to limit the perk level to 7 and below to prevent it then.

long beacon
dry chasm
long beacon
#

I feel like this is just a better option

dry chasm
#

But doing the change in lua would just change the description or disable patching in general

long beacon
#

I do have Java experience

#

but I'd probably be alone there

dry chasm
#

so yeah, probably best to somehow limit xp gain past level 7, but not entirely sure how to approach that.

long beacon
#

me neither

robust locust
#

Can anyone who's a whizz with custom lua files check my code please? It's to do with spawning wall objects on game load. It's not working, and the debug logs aren't showing...
feel free to dm me ๐Ÿ™‚

true nova
# long beacon me neither

you just want the player to not be able to patch unless they've learned a recipe? i think this does that but it may need to go deeper into the context options idr i haven't modified the context menu a lot

local function OnFillInventoryObjectContextMenu(playerIndex, context, items)
    local option = nil
    option = context:getOptionFromName(getText("ContextMenu_Patch"))
    
    if not player:isRecipeKnown("ValidTailor") and option then
        option.notAvailable = true
    end
end

Events.OnFillInventoryObjectContextMenu.Add(OnFillInventoryObjectContextMenu)
#

you can also modify the function from here by removing the option and then adding your own with

context:removeOptionByName(getText("ContextMenu_Patch")) 
context:addOption(getText("ContextMenu_Patch"), player, --yourFunctionNameHere--, parameters passed after player up to 10 after this)
long beacon
#

But if that canโ€™t be done I could try implementing this and giving the tailors the magazine regardless of level

#

(Though non-tailors wonโ€™t be happy with not being able to patch their clothing)

true nova
long beacon
true nova
#

ah may be a bit much. Another thought i had was sending through false xp info somehow on the isocharacter

#

i doubt that would work though. or atleast it wouldn't be simple. i would think make a fake player send that through maybe use some event to steal from your fake characters inventory... or can you set 2 players inventory the same? and multiplayer doesn't like players having multiple selfs so idk how that would act

ocean steeple
#

Hi guys
I'm having trouble with modding a timed action, getting an NPC to fill a water container, anyone know about this?

long beacon
#

Are there any mods that fix the bug where you die instantly upon being bit if you've cured the infection once before?

ancient grail
#

i believe theres a vanilla setting for that if you set it to to instant then the moment you get infected you die

ancient grail
ocean steeple
#

farming is completely broken right now

ancient grail
ocean steeple
#

๐Ÿซก

ancient grail
#

best of luck to you

ocean steeple
# ancient grail best of luck to you

local ItemString = exchangeList[maxEmptyContainer.getFullType()]
ISTimedActionQueue.add(ISTakeWaterAction:new(self.parent:Get(), self.parent:Get():getInventory():AddItem("Base.WaterPot"), 100, obj, 100, maxEmptyContainer))

I tried something like this it didn't crash but it always spawn a new water container

#

ISTimedActionQueue.add(ISTakeWaterAction:new(self.parent:Get(), maxEmptyContainer, 100, obj, 100, maxEmptyContainer))
if I do something like this it just outputs error

ancient grail
#

you want it to pick up the thing?
then remove it from the world

ocean steeple
#

I want to fill an empty pot with water

ancient grail
#

and instead of using its fulltype use the item itself
getItem()

ocean steeple
#

it's kind of painful because I think empty pots are not drainable and pots with water are

ancient grail
#

check out the vanilla time action as to how they refill water container

ocean steeple
#

I have this maxEmptyContainer as item reference

#

Yeah I think I probably have to go through some examples and see if I have any luck

#

thanks man

long beacon
# ancient grail what are you trying to build?

When infection is on but you use mods like first aid expanded's Antizin to cure it, upon the next bite the player will instantly die since internally their infection stage hit maximum.

bronze yoke
#

it's not something that's easy to fix on a global basis, it's not really a bug with the game, it's a bug with poorly made cure mods

ancient grail
long beacon
bronze yoke
#

if the mod is actively developed then go complain about it because it takes literally one line of code to avoid

long beacon
bright fog
#

@long beacon spoiler: don't expect Braven to fix it

#

I'm sure I've seen that problem still be a thing

#

And Braven will not update it

long beacon
#

What would I need to add to fix it? I'm already using a modified version of the mod for the server so I can just add it in on the antizin use code

#

Wait ok this code would imply that it works

#

since it resets infection level

bright fog
#

I think it needs to reset infection time too ? Not sure

#
bodyDamage:setInfectionMortalityDuration(-1)
#

Or something like that

bronze yoke
#

bodyDamage:setInfectionTime(-1)

long beacon
#

OH 0 is the first stage of infection rather than no infection at all, I see

#

oh wait I misinterpreted that, fat-eyed it

#

should work now

#

should I set the rest to -1 for safe measure or will that fuck shit up

bronze yoke
#

i'm gonna be honest i don't think the other lines even do anything LOL

long beacon
#

Infection level might have to do with the antibodies mod

bright fog
#

Check this mod

#

Ik it does it well

bronze yoke
#

at the very least setting sickness doesn't do anything because sickness is calculated every frame based on some other factors

bright fog
#

It's where I learned how to modify infection

bronze yoke
#

infection level i think gets reset when you disable infection anyway

long beacon
#

I'm not doing immunity, I'm having players require a cure, which will require a doctor with the custom recipe to make antizin

#

Already dealt with the whole recipes thing

bright fog
#

It's the same shit

#

You want to remove infection

#

Immunity removes infection

#

Go check it out -_-

long beacon
#

OH you're saying look at the code to see how it does it, my bad

bright fog
#

Yes

long beacon
#

This is how it does it

#

the setInfectionTime(-1) fix should work then

bright fog
#

yea

#

Bcs time keeps ticking down even when not infected

#

And the moment you get infected once more, the time is 0 and you're fucked

#

While if it's -1 it gives a timer

#

Is my guess at least

bronze yoke
#

no, it's a timestamp

#

the game doesn't exactly accumulate infection, it just calculates what it should be based on how long ago you got infected

#

so if you don't reset it, as soon as you get infected again it thinks you've been infected since the first time you got infected and you're supposed to be dead already

bright fog
#

I mean it's basically the same thing anyway

bronze yoke
#

sure

ancient grail
#

while on the topic of infection
any ideas how to capture the last attack that infected the player inorder to prevent it?
like prevent bite
mostlikely based on the time it happened

#

i mean what is the default time when it inflicts the injury?
is it fixed? is it random?

long beacon
#

What is this for? Canโ€™t think of a mod where that would be necessary data, but you can make and use a timer function for when the zombie latches if youโ€™re trying to take advantage of the moment between the latch and the bite

ancient grail
#

oh like for example special zed that dont bite
so any bite wound would be weird

#

or armor that cannot be scratched
so any scratch wound should be nullify

dry chasm
ancient grail
#

have you tested that?

dry chasm
#

Nope, otherwise I'd have a clue instead.

#

was just a guess as I remembered that method from glancing over stuff

ancient grail
dry chasm
ancient grail
#

oh no not just scratch defense
like an active function
also the armor thing was just a spontanus example
maybe trait perhaps

#

if not armor

ashen mist
#

How to I make recipes give out a fraction of an item?

#

Like, 1/10th a jar of gunpowder?

#

Since I know some recipes can do it, see the thread drops from tailoring

tranquil kindle
# ashen mist Since I know some recipes can do it, see the thread drops from tailoring
function Recipe.OnCreate.RipClothing(items, result, player, selectedItem)
    local item = items:get(0) -- assumes any tool comes after this in recipes.txt

    -- either we come from clothingrecipesdefinitions or we simply check number of covered parts by the clothing and add
    local materials = nil
    local nbrOfCoveredParts = nil
    local maxTime = 0 -- TODO: possibly allow recipe to call Lua function to get maxTime for actions
    if ClothingRecipesDefinitions[item:getType()] then
        local recipe = ClothingRecipesDefinitions[item:getType()]
        materials = luautils.split(recipe.materials, ":");
        maxTime = tonumber(materials[2]) * 20;
    elseif ClothingRecipesDefinitions["FabricType"][item:getFabricType()] then
        materials = {};
        materials[1] = ClothingRecipesDefinitions["FabricType"][item:getFabricType()].material;
        nbrOfCoveredParts = item:getNbrOfCoveredParts();
        local minMaterial = 2;
        local maxMaterial = nbrOfCoveredParts;
        if nbrOfCoveredParts == 1 then
            minMaterial = 1;
        end
    
        local nbr = ZombRand(minMaterial, maxMaterial + 1);
        nbr = nbr + (player:getPerkLevel(Perks.Tailoring) / 2);
        if nbr > nbrOfCoveredParts then
            nbr = nbrOfCoveredParts;
        end
        materials[2] = nbr;
    
        maxTime = nbrOfCoveredParts * 20;
    else
        error "Recipe.OnCreate.RipClothing"
    end

    for i=1,tonumber(materials[2]) do
        local item2;
        local dirty = false;
        if instanceof(item, "Clothing") then
            dirty = (ZombRand(100) <= item:getDirtyness()) or (ZombRand(100) <= item:getBloodlevel());
        end
        if not dirty then
            item2 = InventoryItemFactory.CreateItem(materials[1]);
        elseif getScriptManager():FindItem(materials[1] .. "Dirty") then
            item2 = InventoryItemFactory.CreateItem(materials[1] .. "Dirty");
        else
            item2 = InventoryItemFactory.CreateItem(materials[1])
        end
        player:getInventory():AddItem(item2);
    end

    -- add thread sometimes, depending on tailoring level
    if ZombRand(7) < player:getPerkLevel(Perks.Tailoring) + 1 then
        local max = 2;
        if nbrOfCoveredParts then
            max = nbrOfCoveredParts;
            if max > 6 then
                max = 6;
            end
        end
        max = ZombRand(2, max);
        local thread = InventoryItemFactory.CreateItem("Base.Thread");
        for i=1,10-max do
            thread:Use();
        end
        player:getInventory():AddItem(thread);
        player:getXp():AddXP(Perks.Tailoring, 1);
    end
end

This is onCreateFunction that is used for ripping clothes, last one is for thing you asked.

ashen mist
#

huh

grizzled fulcrum
#

Only place it's used is the getter and setter, nowhere else -_-

ashen mist
#

i'd like to just make a recipe like this give less powder

#

like, 1 unit instead of one jar

tranquil kindle
#

Without lua? Most likely not. You need onCreate Function. The one i've pasted is an example, but if you just want it to for example always give 1/10 of jar, it can be simplified

ashen mist
#

Just gotta figure out

  1. overrides
  2. fractions of items
  3. lua
tranquil kindle
#

Im no lua genius, but i'll try to help you with it

#

For overriding recipes i'm sure there was recently talk about it, you could search in here ctrl + f while i test lua thing

young raven
#

is there a way to override/remove an item's evolved recipe? (i want to override a base item that another mod modified, but the evolved recipes are still there)

ashen mist
#

wiki says I could do this

tranquil kindle
#
require "recipecode"
function Recipe.OnCreate.onegunpowderunit(items, result, player)
    local gunpowder = InventoryItemFactory.CreateItem("Base.GunPowder");
    gunpowder:setUsedDelta(0.1);
    player:getInventory():AddItem(gunpowder);
    end

create lua file in lua>server and paste it there, then

 recipe Gather Gunpowder
    {
       Bullets38/Bullets44/Bullets45/Bullets9mm/556Bullets/308Bullets/223Bullets/ShotgunShells,
       RemoveResultItem:true,
        OnCreate:Recipe.OnCreate.onegunpowderunit,
       Result:GunPowder,
      Override:true,
       Time:30.0,
    }

It might work? Lua code does work

tranquil kindle
#

If you want it to be diffrent than single unit, change setUseDelta for other number

ashen mist
tranquil kindle
#

I think it should? There is module thing but if youre using module Base, it should work. I haven't really overriden any recipe yet

ashen mist
#

so after the recipecode thing

#

do i just copy paste the recipe there?

#

like this?

#

I don't really fuss with lua, so I'm not 100% sure of anything

#

@tranquil kindle I think I messed up, I'm still getting full jars

#

oh wait, maybe i make that it's own recipe in the mod's recipe script

#

yeah nvm i have no clue what im doing here

muted garnet
#

Is there a way for InventoryItem to get the recipes of an item, i.e. what recipes use that item?

tranquil kindle
#

recipe is for txt file

ashen mist
#

aight, perfect, thanks

ashen mist
#

but it still executes the recipe

tranquil kindle
#

did you try crafting it?

ashen mist
#

i did, a few times

tranquil kindle
#

It uses removeresult=true so in this helper it might not show result, but lua code should give it to you

ashen mist
#

zero gunpowder given, but i have a feeling we're on the right track

#

oh my b

#

i forgot to remove the recipe from the lua

tranquil kindle
ashen mist
#

the bit supposed to go into text

#

a silly blunder on my end

#

i'll correct and try again

tranquil kindle
#

Is it lua file, or txt file opened in vscode?

ashen mist
#

but yeah my mistake was initially putting both into a lua file

#

and forgetting to move the text half out after moving it to the text file

#

again, silly blunder on my end

#

lua now looks like this

tranquil kindle
#

and txt file?

ashen mist
tranquil kindle
#

modules?

ashen mist
#

HAHA! IT WORKS!

#

KINDA

#

it gives the gunpowder as it's supposed to!

tranquil kindle
#

but?

ashen mist
#

oh i see i see

#

i need to add base to the modules

#

so the override works

i think

#

should look like that yeah?

#

thanks for being oh so very patient with me btw

tranquil kindle
#

It would be easier if you'd show whole file, if its short

ashen mist
tranquil kindle
ashen mist
#

part of a private edit of scrap guns, some balance choices i'm trying to make hinges on reducing how much gunpowder the vanilla gathering recipes give

tranquil kindle
#

Whats this?
module SGuns
module TW
module Base

ashen mist
#

scrap guns, the workshop, and hopefully base game

tranquil kindle
#

Never have i ever seen more than one module there

ashen mist
#

ah, see

tranquil kindle
#

It does work?

ashen mist
#

i was doing a mod tweak for a server

#

couldn't get smth with scrap weapons and SOMW to work

#

so a buddy of mine, he asks to give it a go

#

i go "fuck it, i cant do it"

#

so i send him the file

#

he tells me

#

"yeah i fixed the spears"

#

i ask how, and he shows me that

#

he just added the second module to it

#

and it worked

#

it would read from the other mod

tranquil kindle
#

I'm gonna be honest, i have no idea bout it. I don't really make tweaks to other mods so it "might" work?

ashen mist
#

it just really really wants to co-exist with the vanilla one

#

so it makes that the one thing i gotta fix

tranquil kindle
#

Could you try making separate txt file with just module Base and put that recipe there?

#

I feel like other modules do mess with this

#

So new file with just that recipe might work?

ashen mist
#

you're so smart i should do that

#

something like this to start?

#

i saw the others have like "module_SGuns"

tranquil kindle
#

No, thats just name of file

#
module Base
{
 recipe Gather Gunpowder
{     Bullets38/Bullets44/Bullets45/Bullets9mm/556Bullets/308Bullets/223Bullets/ShotgunShells,
RemoveResultItem:true,
OnCreate:Recipe.OnCreate.onegunpowderunit,
Result:GunPowder,
Override:true,
Time:30.0,
}
}

Thats all that you need in new txt file.

ashen mist
#

it works

#

even though it'll be in an unlisted mod's change log, should the change be approved, you'll still get an added thanks

icy escarp
#

I'm looking for the file that defines what outfits zombies can spawn with in certain places. Does anybody here know where that is?

tranquil kindle
icy escarp
#

Not the outfits themselves

tranquil kindle
#

Ah, sorry

#

One sec

icy escarp
#

Ty

tranquil kindle
icy escarp
ancient grail
ancient grail
tranquil kindle
#

You learn something new every day

ancient grail
#

ive done climate mods before but i forgot all about it
can someone confirm if this will work?
also i dont need it to be global,. actually i want it to be local only

Extend_PZD = Extend_PZD or {}
function Extend_PZD.SetAmbiance(bool)
    if bool then
        local ActiveAmbiance = SandboxVars.Extend_PZD.ActiveAmbiance or true
        if ActiveAmbiance then
            ImprovedFog.setColorR(0.150)
            ImprovedFog.setColorG(0.150)
            ImprovedFog.setColorB(0.700)
            ImprovedFog.setBaseAlpha(0.950)
            ImprovedFog.setRenderEveryXRow(1.000)
            ImprovedFog.setRenderXRowsFromCenter(0.000)
            ImprovedFog.setSecondLayerAlpha(0.300)
            ImprovedFog.setTopAlphaHeight(0.510)
            ImprovedFog.setBottomAlphaHeight(0.980)
            ImprovedFog.setOctaves(6.000)
            ImprovedFog.setAlphaCircleAlpha(0.000)
            ImprovedFog.setAlphaCircleRad(1.650)
            ImprovedFog.setMinXOffset(-20.000)
            ImprovedFog.setMaxXOffset(20.000)
            ImprovedFog.setMaxYOffset(-1.000)
            ImprovedFog.setRenderOnlyOneRow(false)
            ImprovedFog.setDrawDebugColors(false)
            ImprovedFog.setRenderCurrentLayerOnly(false)
            ImprovedFog.setEnableEditing(true)
            ImprovedFog.setHighQuality(false)
            ImprovedFog.setRenderEndOnly(false)
        end
    else
        ImprovedFog.setEnableEditing(false)
    end
    Extend_PZD.isAmbianceActive = bool
end

#

cuz i fear that it wont work for non admins?

thorny latch
#

hi, i am looking at starting pz modding and just wanted to know if the game's modding capabilities support custom networking & sending packets between client and server?
I haven't been able to find any examples yet, so thought I'd ask here first

low spindle
#

hi guys, where in the game files i can find the code for park ranger/lumberjack wood walk skill?

#

i looked at MainCreationMethods but didn't find anything

thorny latch
bronze yoke
#

you can't send objects, just basic lua types

thorny latch
#

eh that's no problem, seems pretty standard for multiplayer games. thanks

bronze yoke
#

yeah, i don't find it very limiting at all

thorny latch
#

yeah seems alright from what you've told me. the goal is to see how easily NPC surivors can be networked with lua

bronze yoke
#

so the problem with multiplayer npcs isn't networking, that should be possible, it's that they straight up refuse to render at all

thorny latch
#

interesting... so even if you spawn a IsoGameCharacter/IsoSurvivor or whatever the type is on all clients - they just don't render?

bronze yoke
#

IsoPlayer is used, and yeah they just don't render

thorny latch
#

that's sad. do you know if there's a workaround for that?

#

I have seen the popular Bandits mod uses zombies instead of IsoPlayer but it seems too hacky

bronze yoke
#

it's not something i've looked into myself but i know a lot of people have and nothing's come up

thorny latch
#

oh ok well looks like I'll be holding off on that idea then for now

low spindle
thorny latch
bronze yoke
#

if i remember right the movement speed through trees is hardcoded, it's applied somewhere in the java

#

it's done by setting an animation variable so you can *probably* do the same thing through lua if that's what you're trying to do

ancient grail
low spindle
#

first i am trying to figure out how the code that give the park ranger/lumberjack tree walk bonus looks like, then i was thinking in turn that bonus in a real trait because im using trait purchase system mod and that profession bonus doesn't seem to be considered a trait, also the marksman trait doesn't seem to work 100%(only foraging bonus seems to work) and i will want to modify that trait too in the future

low spindle
grizzled fulcrum
bronze yoke
#

they are not

low spindle
grizzled fulcrum
#

zombie

#

if you want to change hardcoded Java you're gonna have to make a Java mod which is not as simple as lua

low spindle
#

where i can learn that?

bronze yoke
#

if you just want to add the effect i'm pretty sure it's been done with lua before

low spindle
nimble vale
#

Now I have someone else to blame when I die in PZ ๐Ÿ˜† and I can argue with them haha

ancient grail
#

can you ask it to write code for pz? lol

nimble vale
#

Actually depending on which AI model I load yes and it could.

ancient grail
#

will you be able to control i

#

it

#

like come here
or ask
are you hungry

#

cuz if it has access to its own stats inventory moodles etc then damnnnn

nimble vale
#

So it uses someone elses NPC framework, I modifed a custom survivor template and made it my companion. I've been wanting to set it up so based on in game events it responds based on what's happening, but I havent done that yet.

ancient grail
#

i can zed spotted 3oclock then it rushes to defend at that position lol

nimble vale
#

So it does some of that stuff already, I just need to set it up to send the status of what's happening in game to make the AI aware and respond appropriately

#

but the NPC framework is pretty good already even without that

ancient grail
#

wizardry

#

work with slayers bandits mod that would be so cool

#

question!
would they be able to interact with themselves?

#

npc to npc

nimble vale
#

Yeah, I used PZNS for the Ai-framework which is like a triple modified version of nolan's survivors mod, then a template from someone who worked on PZNS to make a custom NPC, then a mod for cheats, stripped it down rebuilt the window for single player, made a python script to connect to it, made my own script to connect the AI and my character to the chat window and then downloaded the cosmetic mod for Ada Wong.

#

Cuz i didn't really need the cheats part just the window

ancient grail
nimble vale
#

The hardest part was getting the ai and my character to send text to the window after reading text files it was saving stuff too

#

I did the npc part in about 3 hours this morning (formatting issues with text still need to be done and a persona for Ada Wong needs fleshed out more) but no errors thank zombie jesus

#

and mind you I don't know Lua really so it was like me asking AI a thousand questions and using the knowledge I already had from modding to figure out what to add/modify.

#

So I used AI to make an AI mod, so I can argue with AI...

#

I doubt anyone would go to these lengths, but it really makes feel PZ less empty and I've always enjoyed ai companion mods in fallout 4 and skyrim so I was motivated I guess.

timid scarab
#

Sentient AI NPCs before build42

nimble vale
#

Yeah, well gotta work with what we got if we wanna have some fun before we get too old eh? ๐Ÿ˜‚

timid scarab
#

True, if you're uploading it to the workshop can you drop the link here aswell? I've been running superb survivors, bandits npc and shortwave survivors in my playthrough atm
but this would take it to a whole new level

nimble vale
#

I would but since I've modified like 3 other mod's to make it including a python script running through windows command prompt im not sure how much people would appreciate that... so I'd have to include the python program as well too (don't know how I'd do that besides setting up an external link).

#

But if I get it fleshed out some more to where I think it's in a good clean state maybe I'd reach out to them and see if they mind. But knowing how long it takes for people to reply on steam workshop...

ancient grail
#

would be awsome if its mp compatible
i mean even more awsome

nimble vale
#

I've made stuff and had people re-distribute it without credit on there, so I know how that can feel.

nimble vale
ancient grail
nimble vale
#

That's why I had to make that silly chat window for single player

timid scarab
#

Bandits is but it's far less complex than the survivors mods

nimble vale
#

Yeah I got lucky I was crusing github last night and found that PZNS page for teaching people how to make custom NPC's for their mod and I was like THANK YOU because I looked at nolan and others code for NPC's and it's.... advanced

#

Something like 14,000 lines of code at least and just for a companion mod I'd have to figure out how to strip all the un-needed stuff out to make mine.

ancient grail
#

basically hacking the zed and turning them into npc by custom animation and behavior

but they cant do timed actions so its very limited

nimble vale
#

Sounds cool though.

timid scarab
#

If I had any coding knowledge at all I'd add some options to get them to read a book or just sit tf down and chill

ancient grail
#

but it was reported to be buggy so i stopped

nimble vale
#

They've always been that way tbh, but honestly I've always been happy that Nolan made the first mod. He doesn't get enough credit, mostly just annoyed and shat on.

timid scarab
#

The survivor mods are dope tbh, I don't think I'd still be playing without them

ancient grail
#

cuz theres no way for them to ignore target

only way for that is for player to ghostmode
or ignore is set

oh and setuseless
but like albion and burryaga mentioned setuseless can cause issues

nimble vale
#

Well you can tell survivors to stay but they dont sit or anything

#

the ones in this mod just stand still pretty much

ancient grail
#

i basically used the force eat corpse thing
but replaced the animation with the crying one

nimble vale
#

I looked at the .class files and it looks like Nolan pretty much rebuilt zombie ai as NPC ai... when I saw what length he went too my apperciation went up tenfold

timid scarab
nimble vale
#

Yeah I really have been looking forward to NPC survivors for yeeeeeeeeears. So I feel like I finally got what I wanted now.

ashen mist
tranquil kindle
#

What seems to be issue?

ashen mist
ashen mist
#

Up there's the edit I made trying to replicate how you did it with the vanilla recipe

#

the B41 Guns recipes don't have their own module, they seem to override base too

tranquil kindle
#

Correct me if im wrong, but isnt this mod making it so you don't have partial jars and instead makes it so "full jar" is actually 1 unit?

ashen mist
#

Uhh, I don't think so

#

I still have a few tenth full jars from testing

#

Gunpowder's unchanged, still has a delta total of 10

tranquil kindle
#

I'm not sure how you could override those recipes, if they share same name

bronze yoke
#

if you want to override a recipe with multiple definitions you need to do it through lua

ashen mist
#

i see

#

if only i actually knew lua

#

but thank you regardless, now i know a place to start

ashen mist
#

turns out this is way harder to study than you'd think

#

does anybody know if there's any mods i can find with inspiration for this?

#

like, any that override a lot of recipes via lua?

ocean steeple
#

I think the problem is just with this game's documentation, but if you ask chatGPT sometimes it gives reasonable response.

ashen mist
#

cant trust chatgpt

#

it makes things up

ocean steeple
#

you can debug it in game

#

it just tell you which API you could use

bronze yoke
#

if you don't know how to write lua chatgpt will make your problems worse not better

ashen mist
#

i just need like, a base or smth to work off of

#

a format

ocean steeple
ashen mist
#

like i just have to override 13 recipes with the same name

ocean steeple
#

you can check vanilla lua file and overwrite them in your new mod

ashen mist
#

i have a vanilla override that functions in text, courtesy of Nik

#

but it only works with vanilla, i need it to override the FB41R recipes too, but I've been told that's lua only

ocean steeple
#

I haven't checked the mod so don't take my word for it but seems the gunpower jar you are using is a drainable item

ashen mist
#

i want the recipes to give me a jar with one unit in it

ocean steeple
#

maybe you could find an API that set the amount used?

ashen mist
#

like the lua code i posted moments ago?

#

yeah, that works

#

i just need to override the recipes

#

so they give me the gunpowder the way that lua code sets it

ocean steeple
#

sorry if I'm not understanding this correctly, are you trying to modify a code so it gives you a tenth of a jar instead of 1?

ashen mist
#

yes, that's what I'm trying to do

#

the lua adds a thing that gives me the tenth of a jar

bronze yoke
#

try this```lua
local recipes = ScriptManager.instance:getAllRecipes()
for i = 0, recipes:size()-1 do
local recipe = recipes:get(i)
if recipe:getName() == "Gather Gunpowder" then
recipe:setRemoveResultItem(true)
recipe:setLuaCreate("Recipe.OnCreate.onegunpowderunit")
end
end

ashen mist
#

i now need to override the firearms b41 revamp recipes to use said lua function to give me a tenth of a jar when they're used instead of a full one

bronze yoke
#

it doesn't matter, up to how you want to organise things

ocean steeple
#

I suppose, if you just load your code after the B41

ashen mist
#

alright, i'll store them in the same file, since they're both for gunpowder

ocean steeple
#

anyone have a good way using guard case?

#

it seems lua does not support goto with label

#

and no continue

#

so I see huge chunks of if everywhere

bronze yoke
#

there's a weird thing you can do with a repeat to use break as a continue

ocean steeple
#

coding with lua in PZ be like: hungover

bronze yoke
#
for i = a, b do
    repeat
        if condition then break end -- acts as a continue for the for loop
    until true
end
#

i don't personally like it though

ocean steeple
#

๐Ÿฅฒ

#

I think this looks also weird, thx though

grizzled fulcrum
#

just put your oncreate in the recipe (however you manage to do that) and then it's pretty simple after that

ashen mist
#

again, apparently it has to be in lua, which i'll test soon

grizzled fulcrum
grizzled fulcrum
ocean steeple
#

I tried local function, also works but seems bit confusing when you are looking for it

bronze yoke
#

i'd definitely appreciate a continue but i don't like how this approach reads

#

it's not intuitive at all what it's doing from looking at it

grizzled fulcrum
#

true, the readability of it suffers

#

but imo not as much as having so many indents that your code goes off the ide lol

ocean steeple
#

for some reason compiler does not accept this ::continue::

grizzled fulcrum
#

that's the main reason why I use them, kinda like returning early in a func instead of doing 20 if checks

grizzled fulcrum
#

zomboid uses 5.1

ocean steeple
#

๐Ÿคท

ancient grail
#

woot almost done! i just need to configure the cooldown and the treasure chest then my dungeon maker mod is complete...whew.. tookme almost a week for this one

grizzled fulcrum
ancient grail
#

first time adding texture icons to panel
i thought it was hard

im still not used to the sizes . buttons auto change width
i think theres a property to set that off somewhere..

grizzled fulcrum
#

I commend it, because UI is hard in pz

#

it is very annoying to say the least

ancient grail
ashen mist
#

all i need to do now is make the vanilla recipe disappear

#

which i think i can do with obsolete:true

#

after that, it's all good

topaz tangle
#

hey anyone here know where electronic stuff are stored?
trying to make one of the items in my mod scrapable

nimble vale
#

and yeah i like the ui colors too

long beacon
#

How do I actually upload my mod to the workshop?

#

Here's the file path

#

Don't you have to make the ID the first folder, then the folder with the separate mods in it after that

grizzled fulcrum
#

It doesn't follow the same path as the Steam workshop content folder

bronze yoke
#

also it should be MyMod/Contents/mods/

grizzled fulcrum
#

^ true

topaz tangle
#

GOD FUCKING DAMNIT
WHY PZ DEVS WHY

grizzled fulcrum
#

?

topaz tangle
#

.x files

dry chasm
topaz tangle
#

Itโ€™s just like 100000 year old files

#

Itโ€™s okay I did what I needed

limber onyx
#

Hi guys. Whats the code for Cooking Level requirement in a recipe?

I think its SkillRequired:Cooking=X but I just want to be sure

topaz tangle
#

Iโ€™m gonna me learning recipe tomorrow:3
(sorry for unhelpful comment)

muted garnet
#

please tell me, recently my Umbrella addon for VS code stopped working. Having looked into the problem in more detail, I discovered that a different storage location is being written in new folders, please tell me how to fix this problem so that the correct path to the folder is automatically written. When manually replacing the path, the addon works as it should again

#

Is there a way for InventoryItem to get the recipes of an item, i.e. what recipes use that item?

ancient grail
#

you might want to ping albion

dry chasm
nimble vale
#

So I finally got Ada to stay in character with her responses, thankfully. I think my next step is situational awareness now that the AI is staying in character. Inventory info, zombies approaching, getting attacked, etc., I sent her a message indicating we were in muldraugh, ky and she rolled with it which is good. She also has access to conversational history so that should help. I don't think these NPC's eat or drink with this framework which is a bit odd... at least she hasn't yet.

Colby: Hey Ada, My Name is Colby. What are you doing in Muldraugh Kentucky during this new zombie outbreak?
Ada Wong: Hello Colby, I'm here to investigate the cause of the outbreak and find a way to contain it. As an agent of the Umbrella Corporation, I'm well-equipped to handle such situations. How can I assist you?
Colby: Probably a good thing we ran into each out lets team up and take out these zombies.
Ada Wong: That sounds like a plan, Colby. Let's work together to eliminate the threat and find a way to stop the outbreak.

#

Agh, the RE vibes are real ๐Ÿ™‚

#

Sadly she doesn't know what happened to Leon after Raccoon City though :x

ancient grail
#

you cant use this for mp cuz of the npc framework right?
so it means its still possible to use for mp as long as theres a framework?

nimble vale
#

Like I said I don't think any of these work with MP

ancient grail
#

so its possible to make your own player do auto pilot
or atleast talk by itself right?

#

ahh ok i thought its cuz of the npc framework

#

misunderstood that

nimble vale
#

but yeah I'd copy paste what it sends to the AI but its so long here's a screenshot of the text (im actually coding in a summarization feature for the AI so it reduces the text sent since each model has a context limit)

#

So every time it sends: AI settings to control how it responds (all AI programs to chat have this), the persona of Ada Wong (to keep her in character), The conversational history (to remind her of whats happened).

nimble vale
#

So my character doesn't automatically talk to her, it requires user input

#

But yeah the NPC framework is required for this all to run. That's the part that doesn't like MP

#

If I had more time or knowledge I could strip it all down remove all the other NPC's and features and then maybe it would work, but that would be weird because it would only work for 1 NPC

#

so each person would need to run the AI on their pc, my python script and then get all of that to sync on PZ MP which lets be honest... isn't the greatest at syncing even after the multiplayer rework of the code.

topaz lake
#

Itโ€™s a dream of mine with the Expand Helicopter Events mod, in the scenario where the helicopter can shoot at the player, I can change the sound effects to add the ones from GTA San Andreas, specifically add in the helicopter quotes.

#

Is there a tool available where I can extract the audio from PZ and swap it out with other sounds?

ancient grail
nimble vale
#

No its because the pzns framework and (npc mod) is needed for this to work

#

that doesnt support mp

ancient grail
ancient grail
nimble vale
#

Well yeah, but why would you want too, you'd be the only one able to really use it on MP

ancient grail
#

maybe for rp server

#

even if its just conversation
no actions

nimble vale
#

what I mean is, the AI is hosted locally on your pc, when you interact with it, its sent by your pc, so others wouldnt be able to interact with it like you could. If you allowed server chat too, it would be replying to every message and pretty much overloading it trying to respond to each at the same time and your GPU would be like ๐Ÿ”ฅ

ancient grail
#

yeah people can install it too locally

#

all players

nimble vale
#

you could but you still have to factor in sync issues

#

and the likelyhood people are going to run their own AI each... when most can barely run PZ...

#

Like it would be cool if each npc had a dedicated AI but that would cost a lot of money in cloud ai hosting for each one.

ancient grail
#

if you could change its output or capture its output to string locally you can send the string to server
or use global chat

nimble vale
#

which is why one companion seems reasonable

ancient grail
#

thats also something possible

nimble vale
#

thats what i meant earlier but then every message people send in chat would force the ai to reply

ancient grail
#

like a server would have 1 pc online all the time

nimble vale
#

confusing multi turn conversations

ancient grail
#

so thats the one that does the chat
its a player but still
if they want to right

nimble vale
#

AI isn't really great at juggling multiple convos with different people at once

ancient grail
#

hmmm right

nimble vale
#

which is why i said each person would need an ai for each npc

#

otherwise it would literally probably crash or drive the temp of your GPU through the roof

ancient grail
#

how exactly did you send the strings from your app to the game?
how does the game recieve it?
you mentioned discord and python

#

im super curious

nimble vale
#

It's not like in MMO's where multiple people can trigger interactions with an NPC concurrently at the same time and all get different responses

timid scarab
#

So every text input is extracted out the game, run through an AI chat model and the response is imported in real time?

ancient grail
#

was just curious
cuz this could potentially branch out to something new

timid scarab
#

So in order for anyone else to use it they'd need to setup the AI model on their machine?

nimble vale
#

it doesnt use discord that was an option I explored. So it works like this: You run a AI model loading program (mine specifically uses one called Koboldcpp), it has a endpoint (url/IP address with a port) that my python program connects too. It takes the response trims and formats it to save to a text file in the zomboid directory. Then my mod sends it to the custom chat window.

My mod then takes user input from the chat window, sends it to the python program after saving the chat window text to a text file also in the Zomboid directory, which formats it if needed and sends it to Koboldcpp. This triggers a response that causes the AI to send the response to be processed and to the chat using my python program as explained above.

#

They could technically use it but it'd have to configured for the actual MP chat window, and if 2 people talk to it at the same time you'd get a very confusing reply.

ancient grail
#

brilliant

wizardry

nimble vale
#

yeah so its a delicate process and you have to have an understanding of AI limitations to get it to not break if that makes sense

nimble vale
#

Like if i started talking to it suggesting its not Ada Wong that could be done, if I ask it about raiding the PD and another person talks to it about raiding the diner, it could offer conflicting answers while replying to the wrong person even

ancient grail
#

even if it replies with symbol

i mean as long as it interacts for now it can lead to other potential project

nimble vale
#

So symbols can seriously mess it up too

#

I actually have filters set in place for whats called sanitizing it, because some symbols and puncuation and even spaces can break it in chat.

ancient grail
#

if it has the potential to trigger lua function then the possibilities are endless

nimble vale
#

That part is possible, which is sort of how it functions right now just in ways that aren't visible

ancient grail
#

what im saying is
it can be used not just for conversation

#

it can evolve into something else entirely

nimble vale
#

So for example sending inventory info, and situational awareness (the pzns mod has custom dialogue that can be enabled if events in game happens) if I plug into this and how those Lua files trigger the dialogue responses but use them to send info to the AI so it can respond accordingly, then it could influence the NPC in game based on keyword triggers or code in my python program to send triggers to an lua file. either and/or both maybe.

#

But this requires a good understanding of PZ's system, code, the pzns lua code, etc.

#

much less Lua and python.

#

I mean technically nothing is impossible, there's always a work around, but when you involve other people and multiplayer that's a bit too many factors to work in without undesired results/behavior happening

ancient grail
#

is there a public repo?

nimble vale
#

Not yet, like I said I'd have to get permission from PZNS and if i specifically use the Ada NPC template, the guy who did that and then the person who did the Ada cosmetic (all different people) oh and the Chat window I stripped from a cheat mod and modified.

#

So that's like 4 people.

#

and with b42 coming up promising to break all mods, chances are all 4 of these people won't update theirs so .... it'll probably be broken by then anyways

ancient grail
#

if it can control a player account then omg

nimble vale
#

agreed, but again b42 might break everything I need to make this work. This is a work around technically. If there was an actual API network connection for PZ this would be more flawless for those things you mention. I started on one, but its beyond my Lua/Python abilities. I have a good understanding of Networking but it's a huge undertaking on top of all the AI/NPC related stuff.

ancient grail
#

yeah most likely

nimble vale
#

That's why I mentioned Discord, because I believe PZ made something similar for discord bots to connect.

#

So using that as a template for how, much like how nolan used zombie ai as a template for survivor npc's is possible

timid scarab
#

Discord has a rate limiter for bots, so if you've got an AI interacting with multiple users through it then it'll throttle

ancient grail
#

oh and server economy hell yeah thats something that the ai could do
basically only run it using admin pc and only when manually setting up shop
that will give dynamic prices but with real life data

nimble vale
ancient grail
#

yeah but still
like i mentioned even just 1 ai
that has admin controls

#

for simple task that needs calculations

nimble vale
ancient grail
#

yes

#

and create custom rcon commands

nimble vale
#

^

bright fog
ancient grail
#

hell yeah thats gona be fire

timid scarab
nimble vale
#

But again I'm one person half assing python, lua and duct taping this all together soooooo....

nimble vale
bright fog
ancient grail
nimble vale
ancient grail
bright fog
#

I meant as each users run it locally, not on a cloud or anything

nimble vale
#

thats what i mean its possible

#

each person techically could run it locally and play mp and each have a AI companion

#

the problem is network sync mainly

#

because you cant drive cars without teleporting lol

bright fog
#

That's always an important issue, but you can definitely do something about that

nimble vale
#

much less ai's walking and chatting

timid scarab
#

Each user would have to but would you not run into a performance hit with multiple AI NPCs, I'm guessing it would have to be limited to one to be viable?

nimble vale
#

Well that's more of a mod issue with survivor npc's

#

most of them all run on OnTick

#

and framerates vary alot too sooooo

#

good luck calculating that, even using deltas

#

the actual AI side of it wouldnt be the main issue most of it is the NPC mod part

bright fog
# nimble vale the problem is network sync mainly

What you can do is:

  • users asks AI for something
  • send a call to the server, servers tags this NPC has been talked to and sends back to original author to ask the AI for his prompt
  • if another player does the same for the same NPC, the NPC is tagged as been talked to, and call is denied
nimble vale
#

But each AI would also need access to the server which creates a server security issue as well too otherwise no one would see anything happening and it would all be client side

bright fog
#

I did something similar recently, tho not exactly, to scan for players being infected as each info don't know the other players are infected

nimble vale
#

This is one reason why for my purposes doing this alone single player was more practical

#

Also the python program to manage each AI requests to the server and back as a middle man would have to be extensive to manage concurrent requests to multiple users/ multiple ai's

#

So think how difficult it is to mod an NPC survivor mod (most just stole code from nolan and built on it) now imagine doing all this other stuff

#

There's a reason why skyrim's herika mod and fallout 4's mantella mod has a group of 10-12 plus people contributing different aspects

#

and that's still single player LOL

bright fog
nimble vale
#

Yeah factoring in multiplayer is honestly a head ache waiting to happen from so many angles

red tiger
#

Bust out the UMLs.

bright fog
bright fog
nimble vale
#

you'd need to pretty much build a custom npc survivor system, a bigger python program, extensive understanding of pz code, events, netcode and networking and that's all just to start. You'd also need someone to work on the Api connection side.

nimble vale
#

Well the middle man program i use is python

red tiger
#

Did someone say Python?

nimble vale
#

because you need something to communicate between the LLM model loading program and PZ

red tiger
#

I didn't rewrite the event-access part of Pythoid but tis a thing.

nimble vale
#

the Api connection would alleviate some of that

bright fog
red tiger
#

I'm sure your LLM runs in Python 3.

#

I made a mod to PZ that hooks up Jython, a Python 2 engine inside of the JVM to PZ as a full modding platform.

nimble vale
bright fog
#

I've mentioned Jython to another person that was doing exactly that, NPC with AI

nimble vale
#

running the llm

bright fog
#

Then that's not a local LLM ?

red tiger
#

It's available to whoever wants to use it. The typings are also there for people to see the runtime environment of PZ as well.

nimble vale
#

it is

#

I run koboldcpp locally on my pc

#

it connects to my python script which middleman's the responses to and from to pz because of a lack of api connection to open ai endpoints

bright fog
#

Can you not fully run a LLM directly from Python ?

nimble vale
#

these programs are designed usually in python

bright fog
#

That's what I'm thinking about tbf