#mod_development

1 messages ยท Page 185 of 1

bronze yoke
#

or just rollItem actually

patent knoll
#

Recipe.OnCreate = {}

function Recipe.OnCreate.SupplyBagBlue(playerObj, square)
for i = 0, inv:getItems():size() - 1 do
local bag = inv:getItems():get(i);
if bag ~= nil then
if bag:getFullType() == "SupplyFlares.SupplyBagBlue" then
local baginv = bag:getInventory();
baginv:addItem("Base.Bandage");
end
end
end
end

bronze yoke
#

AddItem

neon bronze
#

I hope they change it in b42

bronze yoke
#

lowercase addItem is only used for passing in an already existing item

neon bronze
#

So many people have problems witjh addItem and AddItem

bronze yoke
#

those people need to get umbrella :3

patent knoll
#

if its that simple thats silly

neon bronze
#

Im still doing the old looking up java docs and looking at vanilla code way lol

patent knoll
#

by already existing item you mean an item already in inventory correct

bronze yoke
#

yeah

#

an instance of an item, not just a string telling it which item to create a new one of

patent knoll
#

so if i want to roll item instead of add item in my code I would add a line like baginv: itempickerjava.rollItem ?

neon bronze
#

Do you want to add an item from a distro list?

patent knoll
#

i apologize for having no idea what im doing lol and so few people use java in their mods its hard to find

#

I want to add like 3-5 items from the vanilla distro lists so if mods add items to these lists it can populate those items as well

bronze yoke
#

i think you'd have to use a combination of fillContainer and ForceForContainers actually

patent knoll
#

I feel bad cause i'm sure these are questions that get constantly asked

ancient grail
bronze yoke
#

i don't see how you could get a ItemPickerJava.ItemPickerRoom for the other one

bronze yoke
neon bronze
#

Isnt he trying to add items to a bag?

bronze yoke
#

no he's right

#

inv comes from nowhere

patent knoll
#

you're right i need to add local inv = player...

bronze yoke
#

OnCreate functions get passed the result item as their third argument

#

you can just use that instead of looping through the inventory looking for it

neon bronze
#

I mean if its a bag wouldnt it be simple to reference the .items list and do ZombRand from 1 to #.items list to add a random amount of items?

bronze yoke
#

i'm not even sure if the item is added to the inventory by the time OnCreate is called

neon bronze
#

Its reference in the result but i think its added after the function ran

ancient grail
patent knoll
bronze yoke
#

do you have debug mode on?

patent knoll
#

but we were looking to add some endgame depth to our playthroughs and this is a precursor to that.

#

no

bronze yoke
#

you can launch the game with -debug for debug mode

#

it'll give you an in-game error trace and a lua console, and a bunch of cheats and stuff for testing

patent knoll
#

under advanced launch options

bronze yoke
#

yeah

patent knoll
#

i was just running cheat menu for spawning etc

#

but an error trace and lua console sound very helpful

crystal terrace
#

ye try to explore it, you can also double click on lines of code to set at break point so you can take a look at what holds what value at that instant.

patent knoll
bronze yoke
#

ok it turns out that isn't real

#

there's only forcefortiles, zones and rooms

#

the dist lists are done on a per-container basis anyway

patent knoll
#

fillContainer seems like what I'm looking for just need to find an example of it somewhere now.

bronze yoke
#

i can't see how to force it to use a specific list, it'll just pick randomly as usual

patent knoll
#

Is it not possible to create custom tables drawn from the vanilla list to call from ?

bronze yoke
#

rollContainerItem seems to be the key actually

patent knoll
#

my concern there is just mod compatability, if a mod adds foods I'd like it possible for them to drop as long as the modder bother to designate vanilla distribution locations

bronze yoke
#

all of these have really misleading names

patent knoll
#

I agree from an outsider looking in

bronze yoke
#

most of them have singular names and then i look inside and it tries to add every single item in the distribution table

patent knoll
#

so in the debug menu if a line of code is green what does that indicate?

bronze yoke
#

could you screenshot? i might just be having a moment but i don't think i've ever seen green code

patent knoll
bronze yoke
#

ohh right, i never quite processed what colour that was

#

that means it's the current line

neon bronze
#

Also points out where the error occurs

bronze yoke
#

in this case it's still an error because you define inv in the loop that needs inv to generate

patent knoll
#

okay so currently with the inv = line added its throwing no code but not adding the item to the container inventory.

neon bronze
#

Put it outside the for loop

bronze yoke
#

that wipes the entire oncreate table

neon bronze
#

Also way too many ends

patent knoll
#

lol thank you

neon bronze
#

1 too many my mistake

patent knoll
#

I had it as SupplyFlares.Recipe.OnCreate = {} but that wasn't working at all

bronze yoke
#

you have to define each part as a table

#

e.g.```lua
SupplyFlares = {}
SupplyFlares.Recipe = {}
SupplyFlares.Recipe.OnCreate = {}

neon bronze
#

You can male Recipe.OnCreate.SupplyFlares if you want

patent knoll
#

local inv = playerObj:getInventory()
for i = 0, inv:getItems():size() - 1 do
local inv = playerObj:getInventory()
local bag = inv:getItems():get(i);

bronze yoke
#

you can skip a lot of this code by just using the result passed from OnCreate```lua
function Recipe.OnCreate.SupplyBagBlue(playerObj, square, result)
local baginv = result:getInventory();
baginv:AddItem("Base.Bandage");
end

patent knoll
#

and i don't need to declare any kind of Recipe.OnCreate?

bronze yoke
#

it's declared by vanilla already

neon bronze
#

Recipe.OnCreate is already an existing table

#

You just add your stuff to it

patent knoll
bronze yoke
#

yeah

patent knoll
#

thats so much cleaner, then i just have to figure out the code that replaces the base.bandage with rollContainerItem

neon bronze
#

First check if the current code works

patent knoll
#

hmm still not adding bandages to the bag

bronze yoke
#

is the file in the server folder?

patent knoll
#

but it did add it to the playerinvenotry

bronze yoke
#

oh huh

#

vanilla's recipe code is in the server folder, so the table won't exist yet unless it's also in server since server runs last

patent knoll
#

my luas are located under mod/media/lua/server

neon bronze
patent knoll
#

the blue supply bag and the bandage

#

both to player inventory

neon bronze
#

Whats your current function like?

patent knoll
#

function Recipe.OnCreate.SupplyBagBlue(playerObj, square, result)
local baginv = result:getInventory();
baginv:AddItem("Base.Bandage");
end

#

the one albion posted above

bronze yoke
#

ohh my bad

patent knoll
#

oh no worries whatsoever

bronze yoke
#

i misread the params

patent knoll
#

I'm learning plenty

bronze yoke
#

the order is actually function Recipe.OnCreate.SupplyBagBlue(items, result, player)

neon bronze
#

Lmao

bronze yoke
#

i thought it was the third because object, arrayList2, inventoryItem2 but object is the function to call ๐Ÿ˜…

patent knoll
#

thank you so much

ancient grail
#

local inv = playerObj:getInventory()
for i = 0, inv:getItems():size() - 1 do
~~~ local inv = playerObj:getInventory()~~~
local bag = inv:getItems():get(i);

patent knoll
#

well albion bypassed it

ancient grail
#

Yeah using the arg

patent knoll
#

I'm still learning to translate what a param and arg are so you guys are awesome

ancient grail
#

Thats the proper way.
Im just pointing stuff out cuz you said you are new to this.

patent knoll
#

oh no i appreciate it

#

some of it goes over my head i'm just like sure that makes sense

ancient grail
#

The local can reach inside the loop cuz its declared OUTSIDE and BEFORE the loop

bronze yoke
#

here's my guess on how to use rollContainerItem```lua
local distContainer = ItemPickerJava.getItemContainer("bedroom", "crate", "ClothingStorageWinter", false)
ItemPickerJava.rollContainerItem(result, player, distContainer)

#

and here's where i got the strings from, obviously not the one you want

#

but that should show you where (i think) it wants the strings from

patent knoll
#

what does the false in the above string refer to?

#

or arg not string

bronze yoke
#

if it's true it looks in the junk table instead

patent knoll
#

alright im gonna give that last bit a test run

bronze yoke
#

yeah i don't really know if it'll work

#

but it seems correct

patent knoll
#

so I'd declare local distcontainer.... and then id do something like baginv: distContainer?

#

and is there a limit to the number of procgens I can include?

bronze yoke
#

just one, if you want multiple you can put them all in a list and choose one randomly

#

or if you want multiple to be spawned, just do the code for each one

bronze yoke
patent knoll
#

local baginv = result:getInventory();
local distContainer = ItemPickerJava.getItemContainer("bedroom", "crate", "ClothingStorageWinter", false)
ItemPickerJava.rollContainerItem(result, player, distContainer)
baginv: AddItem(distContainer);

bronze yoke
#

distContainer is a reference to the java object that stores the data about distributions

ancient grail
#

I just read back
And saw your objective
Im thinking you dont need to use the java code you mentioned

You just need to be able to reference the list from the distribution table somehow
And just do something like

getPlayer():getInventory():addItems(yourDistribList:get(ZombRand(#yourDistribList), qty)

patent knoll
#

ohhhh

bronze yoke
#

(the lua tables are eventually parsed into java for performance reasons)

patent knoll
#

so i don't need the baginv:additem line at all?

bronze yoke
#

nope

#

rollContainerItem should basically run the normal loot spawner on that container for that distributions table

patent knoll
#

if that works i just need to set the amount of items to roll

patent knoll
#

does it repeat until fill

bronze yoke
#

zombrand will try to add a number 50% of the time

ancient grail
#

Maybe have em put into his table or something

Cuz i was thinking he can use lootzed similar functions

bronze yoke
#

this actually does the whole table (rolling for each item), not just one like the name would suggest

#

i think if you wanted to limit the amount of items the easiest way would just be to let it do that and then trim down the number of items afterwards

patent knoll
#

Mostly i just want to be able to reference the vanilla lists for mod computability for instance if britas guns to allow those the potental to spawn in say a weapon supply

ancient grail
#

Right right... Ok ..

#

Yeah im not sure if its possible with bags

patent knoll
#

lol

#

eventually it will be a helicopter supply crate on delay that spawns zombies and noise that attracts more zombies.

#

right now just trying to get the simplest bits taken care of

ancient grail
#

Cuz if you can trigger this via lua that easily then the problems with server problems

containers that are destroyed then replaced manually wont spawn items like it used to do

bronze yoke
#

e.g. doing this after the ItemPickerJava call

local items = baginv:getItems()
-- 5 here should be whatever you want the max items to be
for i = items:size()-1, 5, -1 do
    baginv:Remove(items:get(i))
end
patent knoll
#

function Recipe.OnCreate.SupplyBagBlue(items, result, player)
local baginv = result:getInventory();
local distContainer = ItemPickerJava.getItemContainer("bedroom", "crate", "ClothingStorageWinter", false)
ItemPickerJava.rollContainerItem(result, player, distContainer)
local items = baginv:getItems()
-- 5 here should be whatever you want the max items to be
for i = items:size()-1, 5, -1 do
baginv:Remove(items:get(i))
end
end

patent knoll
bronze yoke
#

if the items list is sorted this could cause skewed distributions though (since it always removes all but the first 5, if they always come out in the same order then the ones that come out later will be rarer as they'll be deleted unless there is less than 5 items already)

#

let me fix that actually

ancient grail
#

btw this is how you use codeblocks on discord
``

--lua codes here

``

#

Anyways goodluck with your mod

patent knoll
bronze yoke
#

oh really?

patent knoll
#

yep

#

but it works fantastic otherwise

bronze yoke
#

in that case you can just loop it

#

that's easier, though i don't quite understand why it works that way from reading the source

patent knoll
#

okay dumb question how do i loop it

#

if then

bronze yoke
#

use a for loop```lua
for i = 1, 5 do
-- code you want to repeat
end

patent knoll
#

would i = items:size()-1 < 5 do

#

work if i wanted 5 items

bronze yoke
#

if it only adds one each time you don't need to do that weird stuff

#

just i = 1, (number you want)

patent knoll
#

i = items:size()-1 < 5 do

#

worked oddly enough

#

correction worked oddly gonna try i = 1, (number you want)

drifting ore
#

Has anyone made an automation mod like on Minecraft / Factorio etc?

rocky abyss
#

Hey I'm very new to modding PZ (started today, with some knowledge in java and lua). I do not really understand the implementation of java methods in lua. For example in the Java docs there is "IsoPlayer" class with the method "getCell()". But if I print(IsoPlayer():getCell()) it gives an error. However print(getPlayer():getCell()) works? using only print(getCell()) works as well? How is this? Is there a simple explaination to this?

bronze yoke
#

getCell is an instance method, you need an instance of an object to call it, not just the class

neon bronze
#

IsoPlayer is the name of the instance

#

Getplayer gets you an IsoPlayer

rocky abyss
#

Ok, but why does only getCell() work as well?

bronze yoke
#

because that's a global method

rocky abyss
#

do i not have to write getplayer() whenever i use an "IsoPlayer()" function?

bronze yoke
#

anything in here can be called on its own

rocky abyss
bronze yoke
#

instance methods need to be called on an instance of the class

#

as opposed to static methods which can be called just from the class

rocky abyss
#

ok, i understand, thanks

rocky abyss
#

Hey, can someone explain why this

function firstFunc()
    print('##########################')

    print('x: ', getCell():getWorldX())
    print('y: ', getCell():getWorldY())
    

    print('##########################')
end


Events.EveryOneMinute.Add(firstFunc)

Alwys prints x:0 and y:0? printing only getCell() is also always the same, even after i teleportet around the map. is this not "attached" to the player?

neon bronze
#

I would do getPlayer():getCell() insteaf

bronze yoke
#

getWorldX always returns zero

#

there's no difference between getPlayer():getCell() and getCell() except the first one takes more performance

patent knoll
#

local items = baginv:getItems()
-- 5 here should be whatever you want the max items to be
for i = 1, 5,
baginv:Remove(items:get(i))
end

bronze yoke
#

for i = 1, 5 do

patent knoll
#

local items = baginv:getItems()
-- 5 here should be whatever you want the max items to be
for i = 1, 5 do
baginv:Remove(items:get(i))
end

#

still throwing an error

bronze yoke
bronze yoke
neon bronze
#

So getPlayer():getCell() anf getCell() return the same thing?

bronze yoke
#

yes, there is always only one cell and all the getCell() methods return the same one

neon bronze
#

Wow

bronze yoke
#

i think at some point there must have been multiple cells because there are so many methods suggesting that, but that is not the case now

neon bronze
#

Will it give also cells back that are not loaded in?

bronze yoke
#

the cell is the currently loaded area, there are no 'unloaded cells'

neon bronze
#

Bjt there are multiple ways to get a cell, or do they all point to the same function?

bronze yoke
#

they all point to the same function

neon bronze
#

Damn

bronze yoke
#

there being multiple is one of the many reasons i think this was probably different in the past

rocky abyss
#

How do i get the player cell then?

bronze yoke
#

getCell()

#

it's not a specific map area, i know in mapping cells are 300x300 areas but that seems to have nothing to do with IsoCell, i'm not even sure if those 'mapping cells' exist at runtime at all

neon bronze
#

I thought there would be a way to fuck around a bit behind the scenes if you could store an object that is not the player and from it get the the objects cell

bronze yoke
#

there is only ever one cell

neon bronze
#

What if i call getCell() on the server?

rocky abyss
bronze yoke
#

yes, there is only one cell

rocky abyss
#

what

neon bronze
#

Its the cell

#

Its your cell

rocky abyss
#

Ah

neon bronze
#

Where you are currently

rocky abyss
#

but the object string is also the same always

bronze yoke
#

because it's the same object

rocky abyss
#

okok

#

but, what do i have to do to get the world relative coords of my cell or character position?

neon bronze
#

getPlayer():getX() getPlayer():getY()

rocky abyss
#

and what does purpose does getCell() even have?

bronze yoke
#

it has a lot of object lists and utilities

#

it's the object that governs everything that is currently loaded

rocky abyss
bronze yoke
#

e.g. if i wanted to scan for zombies i would want to use its zombie list

rocky abyss
bronze yoke
#

yeah

rocky abyss
#

but there are different getCells(). Like from IsoPlayer, IsoWorld, IsoObject. Do they all just basically return 0, 0 for wherever they are located? Except for maybe isoworld, since it is the whole map?

bronze yoke
#

there is only one cell

#

all getCells point to the same cell

rocky abyss
#

i'm confused again

bronze yoke
#

0, 0 is because those properties are deprecated

rocky abyss
#

but how would getzombieList be any useful?

bronze yoke
#

it has all currently loaded zombies

rocky abyss
#

all on every part of the map?

bronze yoke
#

on every currently loaded part of the map

rocky abyss
#

ok, nice

#

So in multiplayer every zombie that is loaded by any player, right?

bronze yoke
#

no, in multiplayer it's only stuff that's loaded for the current client

#

and for the server the list is empty

rocky abyss
#

ok

#

very confusing (for me) but thank you for your time and help. I think i'm beginning to understand

neon bronze
#

Its a bumpy road to modding in pz

rocky abyss
#

definitely

patent knoll
heady crystal
#

So I am using addItemToSpawnAtDeath to... well... Add an item to spawn at a zombie's death lol
But it doesn't work on MP. I am guessing it's not transmitted to the clients. Anybody know if there's any function that would do this?

bronze yoke
#

you can add the item to the zombie's inventory OnZombieDead

heady crystal
#

Wouldn't that trigger for every zombie dead and I'd have to make further checks to know

bronze yoke
#

yeah

fast galleon
#

put to shared folder

crystal terrace
#

if a square isnt loaded due to player being away from it, can i not access such square?

bronze yoke
#

you can't

heady crystal
#

gets triggered

crystal terrace
#

is there a way to force load or something maybe?

heady crystal
crystal terrace
heady crystal
#

Wait can I fetch a zombie's inventory while it's alive

#

I am spawning it

bronze yoke
#

no, the inventory doesn't exist until just before that event

heady crystal
#

Starts fuming

bronze yoke
#

well i think it does but it gets wiped when they die

heady crystal
#

This is MESSED UP reeee

bronze yoke
#

where are you adding it to their items to spawn at death?

heady crystal
#

As soon as I spawn them

bronze yoke
#

i think only the zombie's owner's list matters

heady crystal
#

Ugh this is gonna impact performance. I hate this. This is just wrong

crystal terrace
#

is there a way to store complex objects somewhere?

heady crystal
#

Let me guess, OnZombieDead doesn't work on MP?

#

For the server

#

Only for clients

bronze yoke
#

zombies barely even exist on the server

#

don't bother trying to do anything with them on there

#

if done from the server most things either don't work or delete the zombie for desync

rocky abyss
#

Hi I need help with my mod. Somehow it removes items/recipes but i have no idea why. I only have this in my scripts
items.txt

module TestTest {
imports {
Base
}
item MyItem
{
Type = Food,
DisplayName = My First Item,
Icon = MyIcon,
Weight = 0.1,
}

recipe Do Some Testing
{
    MyItem=5,

    Result:NailsBox=2,
    Time:6.0,

}

}

bronze yoke
#

is your script called items.txt?

crystal terrace
bronze yoke
#

if it's the same name and directory it overrides vanilla/other mods files

crystal terrace
#

do something liek myitems.txt or just anything to distinguish it

rocky abyss
#

Does it even matter if i'm on a different module?

bronze yoke
#

modules are for item name conflicts, file name conflicts are a separate issue

rocky abyss
#

the game uses base, i use TestTest as moduel

#

ok, thanks for information

bronze yoke
#

if there are two scripts/items.txt, the game will only run one no matter what

rocky abyss
#

so every mod on the workshop has to use a different name for their own items?

bronze yoke
#

yeah

rocky abyss
#

ok, thanks

covert carbon
#

Whats the difference between OnCreateSurvivor and OnCreatePlayer

bronze yoke
#

it fires for IsoSurvivor objects, which are only used for the character creation preview right now

covert carbon
#

so would either work for detecting when a character spawns into the world?

bronze yoke
#

no, only OnCreatePlayer is reliable

covert carbon
#

thank you

crystal terrace
#

what is the string value that goes here?

#

is it this one?

bronze yoke
#

it's the texture iirc

#

we discussed it here

#

you can just pass nil, but i recommend using the item factory anyway

crystal terrace
#

ah oki that might not be what im looking for then, i thought i might be able to recreate items. Since i can't really store objects.

glacial viper
#

Do I need to change getFileWrite as well?

bronze yoke
#

that should write to whichever environment it's running on

glacial viper
#

I added the isClient check

#

doesn't seem to create the file

bronze yoke
#

oh, your code triggers on OnPlayerUpdate, but that's a client only event, so it never triggers on the server

glacial viper
#

Ah, then do i need to use OnTick then?

#

O is there a better way to update the value server side

bronze yoke
#

i would caution against writing a file every tick in general, but yes that's the closest equivalent

covert carbon
#
    player:die()
end```

i'm not understanding the issue with this code. I get errors everytime I click the button on my UI
bronze yoke
#

die is correct

#

it's probably getting an error because player is not defined

covert carbon
#

I defined player

covert carbon
bronze yoke
#

huh, i use :die() for all my testing and it's never failed me

crystal terrace
#

hi, found this one while looking for something relevant to my problem. Could you point me to a direction, how should i go about this. Do i store obj as string type and use it to initliase or if there's something you know?

bronze yoke
#

you literally have to store every property of the object and then use that to set everything back again

#

extremely tedious and manual

crystal terrace
#

a minor setback in schedule ig

glacial viper
bronze yoke
#

yeah

crystal terrace
#

at an instance, how many squares are loaded? a cell of 300x300?

#

or just isoregion

bronze yoke
#

it depends on resolution

#

when i tested it it was around ~200x200 for me

crystal terrace
#

so i should be able to work with 200 x 200 squares at any instance around player

bronze yoke
#

it varies

covert carbon
#

Is there a wait function for lua?

bronze yoke
#

no

covert carbon
#

Is there a way to make a timer?

bronze yoke
#

yeah, there's some framework mods on the workshop to simplify it

covert carbon
#

Would this work?

#
    repeat(Time)
        Local CurrentTime = os.time()
        while CurrentTime < CurrentTime + 1 do
        
        end
    end
end```
bronze yoke
#

it would, but it would also freeze the entire game until it ends

covert carbon
#

why is that

bronze yoke
#

everything is single threaded and lua is part of the main game loop

#

only one thing can be running at a time so as long as your timer is running the entire rest of the game is frozen

covert carbon
#

Okay

crystal terrace
#

dont even need nukes now

#

you got em

bronze yoke
#

just crash the game LOL

covert carbon
tawdry solar
#

zomboid heimer

turbid gale
#

I've recently been successfully crashing the game

#

apparently items consuming themselves in bizarre ways royally confuses the game

tawny pendant
#

Iโ€™m looking for the Icon used for Baking soda. But I cant seem to find it anywhere. Is there a folder im missing? Or is this a case of ill just have to make my own? Iโ€™m just trying to use it as a temporary image for my mod in the mod menu.

turbid gale
#

they're compressed in some bank file

#

they live in UI.pack and UI2.pack in the texturepacks folder

bronze yoke
#

grabbing it from the wiki is usually the easiest way

tawny pendant
#

Yeah I ended up just doing that lol

hardy wave
#

Does anyone know what result=8 refers to

#

There is literally 1 entry on google

covert carbon
#

Project Zomboidheimer (thanks for the name gas 2 go nationalist) is halfway done

cobalt fiber
#

So, I saw that you where talking about cells and stuff, and a question got in my mind

#

What happens if I add things to the modData of a object that is out of the loaded area?

tawny pendant
#

can someone explain what Im doing wrong here?

#

im starting to go insane

bronze yoke
#

no comma on the skill required line

tawny pendant
#

I have never wanted to punch a keyboard more in my life

#

is it possible to specify tainted water? or is the only way to add water a recipe to have it accept both?

cobalt fiber
bronze yoke
#

you shouldn't even be able to get a reference to unloaded objects

bronze yoke
tawny pendant
#

shoot which ones do? cause I can probably find it in the recipe scripts then

covert carbon
#

I may be wrong but I think all food recipes require untained water

#

but I will check real quick to make sure

tawdry solar
#

are you actually making a nuke?

covert carbon
#

yes

tawdry solar
#

i wanna see where this is going

#

is it like going well?

covert carbon
#

I have the UI finished but im currently trying to make a nuke model in blender

tawdry solar
#

you could make it like a gaint aerosol bomb

#

where it exploads killing shit and sets fire

covert carbon
#

its going fine but I am annoyed by how lua doesnt have a wait function

tawdry solar
#

ah

covert carbon
tawdry solar
#

you can do that?

covert carbon
#

good question havent tried it yet

#

one sec actually

tawdry solar
#

did your russian roulette thing ever work out

#

i was stalking chat and saw it

covert carbon
#

Taking a break on it. If the nuke mod works out I will go back to it

tawdry solar
#

ah alr

covert carbon
#

When I was making that mod I had 0 coding knowledge

#

now I have a little

tawdry solar
#

thats how you get better

covert carbon
#

my brother actually tried helping me with it (he majors in computer science) and he got mad about the documentation for modding

tawny pendant
#

OnTest:Recipe.OnTest.NotTaintedWater

#

this seems to be the only bit of code related to tainted water, and its so that you can't clean bandages and strips with tainted water

covert carbon
#

OnTest:Recipe.OnTest.TaintedWater

#

wild guess but just do that probably

tawny pendant
#

well its worth a shot

#

well it giving me an error on loading where there wasn't an error on loading isn't a good sign

covert carbon
#

Time for your 5 hour debugging session

tawny pendant
#

I probably just forgot a comma again. that or there just isn't a way to only use tainted water

bronze yoke
#

you can just make your own function that does the opposite

tawny pendant
#

how? XD

drifting ore
#

Does anyone know the variable for if you successfully hit a player?- Specifically with a melee weapon-

dark wedge
drifting ore
#

Gotcha, time to check if something like that exists in the variables

#

Maybe OnPlayerAttackFinished?

dark wedge
#

OnPlayerAttackFinished doesn't give you the target.
OnWeaponHitCharacter gives you (wielder, character, handWeapon, damage)
You just have to check if character is a player (that's what you're hitting), and that handWeapon is a melee weapon (that's what you're hitting with).

drifting ore
#

ohhhhh, okay got it! Thank you for the help!

#

Okay this is a layer deeper than I expected to go with this mod... time to figure out lua events!

tawny pendant
#

Anyone know how I can write a function to allow me to return a jar and lid after a crafting recipe? Specifically Iโ€™m trying to make a recipe that has the player pour something out of jar. So I need to be able to return the jar item without having it as a part of the recipe

#

Nvm figured it out

hardy wave
#

Any mod that allows players to trade items from long distances?

#

I know that there is already a trade UI in the game. Dont see how there isnt yet a mod that does this.

civic kiln
#

hey fellas, anyone knows if there's a way to remove an item's param? i wanna get rid of the "AttachmentType" from an item in my mod using the getActivatedMods to check if a certain mod is active then have the attachmenttype removed from the item

#

but idrk how to completely remove the param. i can set it to blank obviously, but that wouldn't work
(i wanna get rid of it because it causes the item to have the "Attach" option redded out and not work, yet still show)

bronze yoke
#

just do it the other way around

#

only set it if that mod isn't active

#

i think that's one of the few parameters you can't undo at all

civic kiln
#

so you say add the param only when the other mod is active? and if it isn't just end the script there? instead of having the param set in item script as how i'm doing it atm

#

wonder why i hadn't thought of that

#

thanks! that worked flawlessly @bronze yoke

tawny pendant
#

okay so Im trying to upload my finished mod onto the workshop and its throwing me this error. what did I do wrong now

#

never mind, I forgot I was in offline mode

#

I feel like a moron now

limpid grail
#

Lol

warm prawn
#

I've forgotten the mod structure for pz.

crystal terrace
warm prawn
tawdry solar
warm prawn
#

but where does the scripts folder go cause i knew that

tawdry solar
crystal terrace
#

Media folder

crystal terrace
patent knoll
#

Im impressed by how often @crystal terrace and @bronze yoke are active honestly

crystal terrace
#

Until I get bored of modding in pz hopefully it'll be a while๐Ÿ‘€

patent knoll
#

Well I will be here bugging you for a while I feel like, cause I'm still learning all the syntax and its like a foreign language atm

#

So these two lines of code work, is it possible for distContainer to be modified to roll from a list of containers rather than just this specific container. I know I can changed it to any container I want, just wasn't sure if I could have it roll a editable list I can reference to here.
local distContainer = ItemPickerJava.getItemContainer("bedroom", "crate", "ClothingStorageWinter", false)
ItemPickerJava.rollContainerItem(result, player, distContainer)

#

i.e local distContainer = ItemPickerJava.getItemContainer("SVSupplyBag", "SupplyBagBlue") and then have a distribution file with supplybagblue be something like
SVSupplyBag = {
SupplyBagBlue = {
rolls = 3,
procedural = true,
procList = {
{name="SalonCounter", min=0, max=99},
{name="SalonShelfHaircare", min=0, max=99, weightChance=100},
{name="SalonShelfTowels", min=0, max=99, weightChance=10},
{name="SalonShelfTowels", min=0, max=99, weightChance=50},
{name="SalonShelfHaircare", min=0, max=99, weightChance=100},
}
}
}
obviously the above wouldnt work but is there something like this that would be plausable

warm prawn
#

Uhm.

#

Why'd you delete it in the first place?

pallid oasis
#

hey i was thinking about an idea for the mod "super survivors continued" is it possible to edit the AI NPCS so that they KOS

crystal terrace
hollow current
#

soo need a clarification regarding something I may have been percieving correctly for a while. Shouldn't isClient() return true on solo runs?

neon bronze
#

Only in mp

hollow current
#

i seee so its irrelevant anyways for solo

neon bronze
#

Yea i mean in sp you are the only one there so testing for whether isClient() or not is pointless

#

I think albion or someone else wrote a little guide about it

hardy wave
#

Trying to make some safehouse adjustments. Want them to only be allowed to be claimed in safezones but not anywhere else. Is there a mod that does this? Base-game feature?

crystal terrace
#

i think a way around this would be to checkout how mods implement safehouse functionality, if there's a way you can then use that data to check if its a safehouse to begin with. Just an idea.

hollow current
#

Is there some sort of a guide that explains adding a new moodle, and getting it to show/hide in-game? Would be really appreciated!

void cargo
#

Does anyone have any ideas of how to get the nearest road from the player?

#

I'm guessing I'll end up writing code to search each square extending from the player until it's a road tile

crystal terrace
#

interesting, i was trying to find out how many squares i can access around player. Roughly the count was around 97 at tops if there was no larger walls in between. Walls seem to interfere with getting next tile in succession.

void cargo
#

I wonder if building aren't always loaded until they are seen

crystal terrace
#

are you suggesting to load next chunk at end of it?

void cargo
#

Yeah that's my guess

crystal terrace
#

i can try that, id like to see how far i can go wrt to player tile

void cargo
crystal terrace
#

the one i have right now?

void cargo
#

ya

crystal terrace
#

sure

#

local function countTiles(currentSquare)
    if currentSquare then
        currentSquare:addBrokenGlass()
        local northCount = 0
        local southCount = 0
        local northSquare = currentSquare:getN()
        local southSquare = currentSquare:getS()
        while northSquare:getN()~=nil do
            northCount=northCount+1
          --  northSquare:addBrokenGlass()
            northSquare=northSquare:getN()
        end

        while southSquare:getS()~=nil do
            southCount=southCount+1
           -- southSquare:addBrokenGlass()
            southSquare=southSquare:getS()
        end

        print("total no of active tiles:")
        print(tostring(northCount))
        print(tostring(southCount))
    end
    print("calling countTIles, no active square found")
end

local function getActiveSquare()
    
    if player then
        local inventory = player:getInventory()
        local cell = getWorld():getCell()
        if cell then
            local currentSquare = cell:getGridSquare(player:getX(),player:getY(),player:getZ())

            if currentSquare then
                print("found current Square")
                countTiles(currentSquare)
            end
        end
    end
end



Events.EveryTenMinutes.Add(getActiveSquare)```
void cargo
#

so much glass, thanks!

crystal terrace
#

helps me visualize๐Ÿ˜„

void cargo
#

it's a good idea

covert carbon
#

How do I spawn in an item that I made?

neon bronze
#

With item picker i think its called

patent knoll
#

I'm trying to add an item sound that attracts zombies on use by a pretty good range. Do I just need Sound Volume = and Sound Range =?

crystal terrace
#

think so, in sound script you can decide the range i believe

#

test it out by spawning a zed a bit far and using that item for a smaller range first

patent knoll
#

well currently i'm having trouble to actually get it to make the sound

#

I'm using CustomEatSound = SV_Flare,

#

in the item script

#

and the SV_Flare is located in the sound file

#

i can't figure out why its not working though

crystal terrace
#

Do you have the correct format?

#

For sound file

patent knoll
#

i think so

#

my only concern is the module name

#

do all my mod file share a module name

#

or does each script need to have a unique name

#

module SVFlareSound

sound SVFlare
{
category = Item,
clip {
file = media/sounds/SVFlare
distanceMax = 300
distanceMin = 1
volume = 0.7
}
}

#

this is what my sound script looks like

#

and its a wav file so i know thats right

crystal terrace
#

Are you in debug mode?

patent knoll
#

yeah but debugging is not exactly my forte yet

crystal terrace
#

From what I know sound files don't play in debug mode

patent knoll
#

ahhh

crystal terrace
#

It should work in normal gameplay if there's no other problem, happened to me as well.

patent knoll
#

does the file = line need to be special where it isnt a base game sound

#

that the structure for my mod

crystal terrace
patent knoll
#

I have not waka waka

#

module SVFlareSound
{

sound SVFlare
{
category = Item,
clip {
file = media/sounds/SVFlare
distanceMax = 300
distanceMin = 1
volume = 0.7
}
}
}

crystal terrace
#

Now it looks fine, also make sure if the folder name is sound or sounds

patent knoll
#

my folder is sounds

#

base game is sound

crystal terrace
#

I'm not sure if it would mess up but from my experience, game is expecting sound in sound folder.

#

Just the names of files need to be different but structure and folder names has to be same I believe

patent knoll
#

i changed it to sound

#

thanks for your help

#

gonna test in debug and if that doesn't work ill hop out of debug

crystal terrace
patent knoll
#

i did

#

media/sound/SVFlare

crystal terrace
#

and if none of this works, i did one more thing while i was adding sounds. Switched em to mono, might as well use that as last option.

patent knoll
#

i didn't see that option on the website

crystal terrace
#

its not, youd need to edit sound file for that. Whatever software you're using to work with sounds should have an option but lets just give this a try before you jump to this.

patent knoll
#

yep still no sound

crystal terrace
#

you jumped out of debug?

crystal terrace
patent knoll
patent knoll
#

ill have to look at another mod that adds sounds and see if i can figure out what im doing wrong

crystal terrace
#

welp, as a last resort id suggest to maybe try converting sound to mono then if you dont find anything.

patent knoll
#

kk, I've gotta stop working on this but will pick it back up tomorrow

#

thanks for your help

crystal terrace
#

this was my script while i was learning stuff about addting items, worked for me.

patent knoll
#

module SVFlareSound
{

sound SVFlare
{
category = Item,
clip {
file = media/sound/SVFlare.wav,
distanceMax = 300,
distanceMin = 1,
volume = 0.7,
}
}
}

#

I am not totally sure why thats not working

slow graniteBOT
#
sel0ko has been warned

Reason: Bad word usage

umbral abyss
#
The Indie Stone Forums

Hello and welcome to my tutorial. It covers full workflow of vehicle creation for PZ. If you are a complete beginner in 3D modelling, you'll have to watch/read additional tutorials, I won't cover every aspect of model creation and 'where this button is located'. I divide vehicle creation in these...

covert carbon
#

Where are sprites kept?

nimble yarrow
#

steamapps\common\ProjectZomboid\media\texturepacks
You cannot open .pack files with winzip or 7zip or winrar (presumably). But there are PZ modding tools to extract files from these .packs somewhere.

covert carbon
#

im going back into school in less than a week

#

the nuke mod must be finished before then

crystal terrace
#

must

covert carbon
#

anybody see anything wrong with this?

#
{
    item NuclearBomb
    {
        DisplayCategory = Explosives,
        MaxRange    =    10,
        Type    =    Weapon,
        MinimumSwingTime    =    1.5,
        SwingAnim    =    Throw,
        WeaponSprite = Molotov,
        UseSelf    =    TRUE,
        DisplayName    =    W59 Thermonuclear Warhead
        SwingTime    =    1.5,
        SwingAmountBeforeImpact    =    0.1,
        PhysicsObject    =    PipeBomb,
        MinDamage    =    0,
        Weight    =    1.5,
        MaxDamage    =    0,
        MaxHitCount    =    0,
        Icon    =    NukeIcon,
        ExplosionPower  =   10000,
        ExplosionRange  =   20,
        CanBePlaced = TRUE,
        CanBeRemote = TRUE,
        ExplosionSound = PipeBombExplode,
        SwingSound = PipeBombThrow,
        PlacedSprite = constructedobjects_01_32,
        WorldStaticModel = Nuke,
    }
}```
#

this isn't the actual nuke I just wanted to test out if I could make it into an item

chrome veldt
#

Anyone have an idea why I can't iterate through this ArrayList?

local world = getWorld()
local worldCharacters = world.Characters -- public final ArrayList<IsoGameCharacter>
local characterList = ""
for index=0, worldCharacters:size() -1 do -- java.lang.RuntimeException: Object tried to call nil
    characterList = characterList .. worldCharacters:get(index):getFullName() .. ':'
end

There's no getter for the characters, or at least, I didn't find any so I'm trying to use the public Characters field. I feel like world.Characters is wrong but I've tried many other things and nothing succeeded so far

bronze yoke
bronze yoke
chrome veldt
#

Yeah, it seemed too good to be true

bronze yoke
#

there's some absolutely insane function calls to do it, i have an api mod that would actually let you do this with no code changes though (it changes the syntax to be exactly as you've done it)

chrome veldt
#

Ho, that's neat, crazy it has to be that hard

bronze yoke
#

i think you might be able to get that arraylist elsewhere though without adding a dependency

#

i'd have to check exactly how Characters is used and if it differs from the others but if you're just looking for a player list there's other places

#

LOL it's dead code

chrome veldt
#

Yeah, I'm looking for the playerlist in a given world. By any chance, is there a way to identify a world with a unique ID of some sort?

chrome veldt
bronze yoke
#

wdym in a given world?

chrome veldt
#

I mean, in the current world

bronze yoke
#

you can get the local players with IsoPlayer.getPlayers()

#

you can get all players in multiplayer with getOnlinePlayers() but on the client that will only include characters the player has been close enough to load at least once that session

chrome veldt
#

What do you mean by local players? All the singleplayer characters that lived in the world?

#

That's nice, I might move some code in the server then, thanks!

bronze yoke
#

the local players would be the characters currently playing on that client (up to 4 because of splitscreen)

#

i'm not sure if you'd be able to get historical data, i'm pretty sure dead characters get overwritten by the new ones

#

there are some functions to get player data from the database though, so if that's not the case it can probably be done

covert carbon
#

Alright the nuke is nearly done. A few more hours and we are done.

chrome veldt
#

I didn't get into the database part yet, I might need to look into it! Thanks!

#

And do you know if I can identify a world by an ID or something other than the name?

bronze yoke
#

i'm not sure

crystal terrace
covert carbon
#

Where do I put the icon for my new item?

covert carbon
crystal terrace
covert carbon
crystal terrace
#

sus

covert carbon
#

where do I put the icon for items?

chrome veldt
# bronze yoke i'm not sure

That'd be great, I'm looking for a getter for a world creation date, that might do it, but I can't find any for now

crystal terrace
#

texture folder

#

icon files names should have a prefix item_

covert carbon
#

this look like the right organization?

bronze yoke
#

isn't the save name the creation date?

crystal terrace
chrome veldt
#

Yes, but i believe you can edit it

vagrant valley
#

The models file name should be Models_X

#

It still works if you put fbx in it

crystal terrace
#

ah that's good to know

tawdry solar
covert carbon
#

didnt want to max out its power and crash my game so I went small for testing

tawdry solar
#

ah alright

covert carbon
#

but I do bring good news

#

you will be able to hurl the W59 thermonuclear warhead like its a football

tawdry solar
#

awesome sauce

covert carbon
#

ran into an issue with the nuke

#

it can only go so far in range

#

might be a bit longer than I thought to finish

#

but I will still fix it

crystal terrace
covert carbon
#

how many

crystal terrace
#

about 90+ from what i looked into

#

each side

covert carbon
#

my bomb has a max radius of 15 tiles when I detonate it

bronze yoke
#

i think it's ~190x190 total

crystal terrace
#

is getOnlineId safe to work with for MP global moddata

bronze yoke
#

it won't usually be even because it's loaded in chunks and the player won't be in the perfect middle of a chunk

#

and as i mentioned before it does depend on your resolution and maybe other factors

crystal terrace
#

thats strange, i tried grabbing tiles and my counter stopped at 97 tops

#

ah

#

both side

#

right now this problem is beyond my scope, ill prolly work on this later. Ill have to work with that range as of now.

covert carbon
#

I cannot accept the range I have

#

I will try and fix it

#

no nuke of mine will have a radius of 15 tiles

crystal terrace
#

thing is game doesnt load the tiles out of certain range because of performance issues, obviously there might be a way to work with this but i think ill need to dig deeper and learn some new stuff.

covert carbon
#

is there a way to change render distance?

bronze yoke
#

the way to deal with doing stuff to out of range squares is usually to cache the changes and do them when it does load

crystal terrace
#

does it have anything to do with serialization?

#

this explains why fire never dies if you leave the area, they just save the state of tile and render it from there when you show up next time.

covert carbon
crystal terrace
#

wait, the player id for local player is 0. Wouldnt it be same for everyone?

bronze yoke
#

playernums aren't used for networking

#

onlineid is used instead

#

so yeah, everyone's player num is going to be 0 (or 0-3 in splitscreen)

covert carbon
bronze yoke
#

if your range is stopping at 15 tiles then it probably isn't them being unloaded that's the issue

#

you can see further than 15 tiles

crystal terrace
#

its possible that ther's a cap on fire tiles maybe just to not hurt the performance?

warped oriole
#

Is there a way to pass a client event to the server? I'm using onCreatePlayer as a trigger to call SendClientCommand, but the game is still seeing it as a client event. Is there a way to pass a client event to the server, or do I have to just use a server-side event?

bronze yoke
#

so the issue is that oncreateplayer will fire for player 1 before client/server commands actually work

#

for some reason they only work from the second tick onwards, and that fires before the first

warped oriole
#

:(
oh well, thank you! I'll just have to use something else

covert carbon
#

There is one thing I am confused about. When items are defined in their files as "explosives" or "furniture" where is the file that defines what that means?

normal scroll
#

Hello guys, i'm trying to add some animation i made to the game but it won't load, return this error: "Anim set not found" when i try to play. Is there a guide on how to get this done?

mellow frigate
crystal terrace
#

question about mags, say there's a certain skill i wanna give a character but it can be only unlocked after you read a particular magazine. I looked at vanilla mag recipes, it has a section TeachedRecipes, now do i have to define my so called skill somewhere? or i just give it a random value that i check in my lua script

mellow frigate
#

AnimSets is a directory under media including xml files that refer to the animations (.x or .fbx)

normal scroll
#

my fbx won't work for some reason

crystal terrace
#

so something like grab list of character known recipes and find that value

bronze yoke
#

yeah, that's how herbalist works

crystal terrace
#

ok sweet ill give ti a try real quick

bronze yoke
#

you can use isRecipeKnown() instead of looping

crystal terrace
#

ah, just making sure im not lost with my words. If i say TeachedRecipe: whatever and that whatever is no where defined except ill just check for that value in isRecipeKnown()?

bronze yoke
#

like their traits, the player's known recipes is just a list of strings

crystal terrace
#

that explains it clearly, ty๐Ÿ˜„

covert carbon
crystal terrace
covert carbon
#

How do you decompile class files?

crystal terrace
#

there's tools for that, also a steam guide from Tchernobill as well

covert carbon
#

Thank you

#

What is decompiling though?

crystal terrace
#

i don't think the check for knownRecipes is working, the string value matches i double checked but the context menu shows up anyway altho i wrote it inside an if block only if the mag has been read it executes

crystal terrace
# covert carbon What is decompiling though?

when you compile .java files it's converted into bytecode or your .class files in simpler words. It's something which machines understand and work with much more efficiently than your plain strings.

#

the reverse of this process is called decompiling

covert carbon
#

So basically they took the Java code and made it unusable for me until i decompile it

crystal terrace
#

well game is not open source, its their work.

#

even with decomipling you dont get everything, from what i know its just best guesses for the most part that fits the function defintion. The process is not 100% efficeint.

covert carbon
#

Alright well Iโ€™ll do that later because itโ€™s 2 am. Goodnight other modders

empty parrot
#

Hi, any ideas on how to get the world name/save name of the world you are playing?
I'm doing a mod and i want to save some configs to a file with the same name as the world name.

crystal terrace
#

for some reasons, im getting true for known recipe even tho i havent touched the mag yet

bronze yoke
#

let's see your code

crystal terrace
bronze yoke
#

hmm, doesn't seem like that should happen

crystal terrace
#

its like the function doesnt even care what i pass

#

maybe i need to restart the save and give it another try

bronze yoke
#

yeah, my guess is you got the recipe already somehow

crystal terrace
#

or my guy is a nerd

grave fractal
#

hello, any reason to why this is happening? the icon size is 120x120

#

does it need to be a specific size?

crystal terrace
pure kiln
#

hey guys^^

#

im trying to debug a bunch of mods and trying to understand the incompatibilities from a mod developer perspective

#

if you help me gain some insight i will try my best to help you in your development for exchange

#

i can find some errors but without context to the game engine its hard to reverse engineer them

#

i can also just do some testing for you

neon bronze
crystal terrace
#

its a default in debug

#

lol

pure kiln
#

thats a great tip also for me thanks

crystal terrace
#

machine never lies

crystal terrace
pure kiln
#

ill google how to enable it

#

i'm trying to work with a dedicated server here tho : s

crystal terrace
#

from user-experience POV, having an option for something that you dont have atm in context menu(it wont work obv just the option) or displaying that option after you unlock it? thoughts?

crystal terrace
# pure kiln ill google how to enable it

open game settings from steam for pz, then it should have something called launch option under general tab, type -debug in it and just launch the game. Haven't tried in MP tho

pure kiln
#

yeah i'll use the mod, it says here it unlocks mod recipes too

#

because in singleplayer stuff works just fine and dandy

#

with 3x the amount of mods

#

but i want flawless error free for good conscience

#

and understand the errors to ensure everything is going as intended

mellow frigate
grave fractal
#

you need to do /setaccesslevel [name] admin

tawdry solar
pure kiln
#

i was checking out some camping fridges in the meantime

grave fractal
tawdry solar
#

ong

#

im litterally Sisyphus

pure kiln
#

sry for u

grave fractal
#

susyphus

rich void
#

Hello guys, anyone got experience with worldsoundmanager? I'm wondering if anyone knows what the 3 integers relate to exactly?


        getSoundManager():PlayWorldSoundImpl(
            "ClearSkyRadio",
            false,
            zoneId.x1,
            zoneId.y1,
            zoneId.z,
            1,
            1,
            1,
            false
        )

#

I actually can't find what the Booleans are either, I thought one might be related to whether it was a 3d world sound, however both of these set to false still seems to be a 3d world sound

tawdry solar
#

could somone help me

#

2 of my weapons dont work

#

the models dont show up

tawdry solar
#

if not i would put item_ infrom of it

#

liket his

tranquil kindle
# tawdry solar

Other than one to many } at the end i don't see why wouldn't it work, but considering scale= 0.01 maybe it does show but its really small? I tried it once on my first car attempt and it was barely visible, untill i removed scale, or made default scale of 1 in blender.

tawdry solar
#

its the sprite that shows

tranquil kindle
#

Try removing

   {
        Base
    }``` and see if it changes anything? Im not sure why would you even use Module base and then put import Base, but maybe thats something that people do?
tawdry solar
#

in the same mod

#

that works

neon bronze
# tawdry solar

your weaponsprite is wrong, its supposed to be 2000 not 20000

tawdry solar
tawdry solar
#

this is the file

neon bronze
#

WeaponSprite is the Model not the texture of the model

#

Your model is called js2000 not js20000

tawdry solar
neon bronze
# tawdry solar

model js2000
{
mesh = weapons/firearm/js20000,
texture = weapons/firearm/js20000,
scale = 0.01,
}
}

thats what you have in that script

tawdry solar
#

i do?

#

my fault

neon bronze
#

yea

tawdry solar
#

would that be the sawme for my other item

#

eyah it is

neon bronze
#

whats your other item?

tawdry solar
#

tis the issue

#

thanks

neon bronze
#

you need to put in the weaponsprite field whats your model is called

tawdry solar
#

ooh

hollow current
#

in onPlayerGetDamage, does damageType "WEAPONHIT" include also damage inflicted by firearms?

tawdry solar
#

shit works now

#

ty

pure kiln
#

hey guys

tranquil kindle
#

Oh, i didnt notice one to many 0 in JS20000, but you got figured it out.

pure kiln
#

so i noticed different mods are having similar errors

#

with "Give300MWXP" related stuff

#

oh nvm im dumb it was always the samemod

grave fractal
tawdry solar
#

aight

tawdry solar
#

reasons for massive ass model?

tacit plover
covert carbon
#

how can you edit the tiles around a player or an item?

crystal terrace
covert carbon
#

Its not near the player. However the player does place the item (totally definietely not a thermonuclear warhead)

crystal terrace
#

usually you grab x and y coords of player, then use isocell obj to get isogridsquare(tile) and then you basically target objects on that tile. You can also move on that tile in any direction using IsoGridSquare obj in N,S,E,W,NE,SW etc

covert carbon
#

can you set tiles on fire?

crystal terrace
#

if the IsoGridSquare has a method to set fire which it will most likely have, then yes you can pick tile and set it on fire.

covert carbon
#

kk

crystal terrace
#

altho you might be limited in capacity possible performance reasons i believe, but thats something you have to play with and find a suitable range.

#

I bring good news, my mod is short a kickass description and maybe a good poster. I might be able to upload it in a couple of hours after a couple of tests i need to runtired

crystal terrace
#

lf a way to tell if a character has died or not? came accross a bunch fo methods from character class. Any idea which one im looking for?

#

nvm i think i found what i was looking for

patent knoll
#

WARN : Recipe , 1690505687761> RecipeManager.resolveItemModuleDotType> WARNING: module "SupplyFlaresRecipes" may have forgot to import module Base

#

I'm getting this error when I try to launch the server with the mod. Anybody run into this before

neon bronze
#

Base,

patent knoll
#

thank you

#

hmm

#

neither of my other scripts have the ,

#

and didn't throw the error

bronze yoke
#

the , isn't necessary

patent knoll
#

I've been looking, the only other place i've found that language was a bracket error, which im not having

#

it appears making the workshop mod public instead of friends only makes it load without error

#

I'm not sure why they let you upload with friends only visibility if it won't let you use the mod otherwise

bronze yoke
#

friends only usually causes the mod to fail to download entirely

#

since the server downloads mods anonymously

#

for testing i'd recommend unlisted instead

crystal terrace
#

im assuming there's some way to add description to context menu options, prolly its passed along when you're building it?

bronze yoke
#

i think it's just option.tooltip

#
local tooltip = ISWorldObjectContextMenu.addToolTip()
tooltip:setName(getText(translation, name))
tooltip.description = getText('Tooltip_NeedWrench', getItemNameFromFullType('WaterGoesBad.TapFilter'))
option.tooltip = tooltip
crystal terrace
#

sweet, you're awesome.

#

OnCharacterDeath event is not working as i was expecting, since on death of player i dont think i get the id of character instead the data is lost on the corpse i believe. And it gives me the character as an instance.

#

OnPlayerDeath might be worth a try

#

my goal is to grab the GlobalModData for dead character so that tables don't have garbage values until there's a reset or something. I have stored data using character's username as ID but when the character dies, i dont think the event fires. Tried setting a break point in debugger as well, no luck so far.

bronze yoke
#

if you're doing it on the server i don't think the event fires there

#

also you should use OnPlayerDeath, OnCharacterDeath will fire for zombies too

crystal terrace
#

ah i was doing on client side, there's not much inside script except grabbing player username and checking if the there's global mod data for my mod and iteratring over it to remove that playerID

#

nothing too fancy here

#

sometimes the game is buggy as hell, i switched to new save and it works now i think at least the event is fired.

#

works perfectly now

#

the more you work, the more stuff comes to your mind about all sorts of things you could do with your mod. I think ill just one more thing that is tool-tip for context menu and then should be good.

#

tooltip:setName(getText(translation, name)) these values need to be defined somewhere? or we can send a string as well (translation,name)

warped condor
#

getText(translation, name) is a function that takes translation (string) and name (variable). You can simply put string instead of hole getText function.

#

Or simply replace translation,name to string.

bronze yoke
#

they were defined elsewhere in my code

crystal terrace
#

oh is it for the translation file for diff languages in shared folder

bronze yoke
#

you should always use getText() and translation strings for anything that's shown to the player

#

getText() returns the translated string with that name for the current language

#

multiple arguments can be used for inserting extra stuff into the string if the string is set up for that

crystal terrace
#

even if i dont plan to add translations for now? I should be able to do that down the road.

bronze yoke
#

even if you only have english it'll let other modders translate it

crystal terrace
#

ah

#

think i found the source file

crystal terrace
#

of the van?

#

looks cool

#

honestly you can just make textures dont need to dive too much into models early on

#

sounds great, i dont know too much about 3-D modeling but i think i might be able to work with textures in near future.

#

can i reupload preview/poster images? does it be correct in one go?

bronze yoke
#

you can, though annoyingly you have to reupload the mod to change the preview

crystal terrace
#

ah, i can keep the poster img inside my mod folder. i think i only need to make sure the preveiw is 256x256 which will be outisde of that folder.

bronze yoke
#

yeah, it won't let you upload if it's wrong anyway

crystal terrace
#

workshop/modName/Contents/mods/modName/EveryingElseInsideMod is this the correct structure?

#

i think ill need to add two more files in Contents one being workshop.txt and preview

bronze yoke
#

that's right

crystal terrace
#

sweet, thanks.

#

should i keep visibility something else for testing stuff atm?

#

someone mentioned "friends" didnt work i believe

#

right, unlisted it is.

bronze yoke
#

yeah, private and friends don't work well

tame mulch
crystal terrace
#

after the upload, is it safe to remove the folder from workshop? or need to keep it there

bronze yoke
#

you can, but then you won't be able to update it

crystal terrace
#

i wanted to test from steam but after i sub to the mod, the location i see is from workshop.

#

is it because of being "unlisted"?

bronze yoke
#

oh then you can just move it away yeah

crystal terrace
covert carbon
#

I will try it out soon

#

nice thumbnail for it

crystal terrace
#

ty ty, i initially went without the containers but figured it adds more info to what tis about

#

i think i deserve a coffee break now, i havent tested it on MP yet. Is there a way to do it, altho i dont think it should create any problems.

pearl prism
#

other lights works fine?

#

show me the image of the texture of lights

#

lol

#

the names are diferents

#

Check if the names match

#

test it, lets see if it works

#

๐Ÿค”

crystal terrace
#

great start, i already found somethingded . I can see the values are nil in debugger but does the execution stops here. Edit: fixed it btw, put em both into bracket.

pearl prism
#

the mask are the Filibuster originals ones?

#

can you print it like you did with the other one?

empty parrot
#

hi everyone, i'm trying to update the loot midgame using:
getSandboxOptions():set("FoodLoot", 1);
but it seems it doesn't work...
it works with other sandboxOptions, but not with this, any idea why?

thanks!!

crystal terrace
#

a word of advice if you're new to uploading mods to workshop, keep a copy of description that you edited on steam mod page. It's a pain to update it again. Honestly even the guide interface is much better on steam from workshop.

mellow frigate
crystal terrace
#

ah thats good tip

crystal terrace
#

arent these numbers supposed to be odds to roll your item from 0-1? or is it max items that can be present in world?

bronze yoke
#

0-100, roughly

#

sandbox settings, zombie population affects it

#

default sandbox settings are like x0.4 iirc

crystal terrace
#

no wonder i was able to find only one copy on max loot settings in two libraries

#

id like to keep it as rare as generator mag, what numbers to go for? i couldnt find genny mag in the lua files.

mellow frigate
#

Beware modders, I noticed an increase of "friends" invites from Zomboid players. Half of them with VAC ban on record. The few invites that looked legit and I accepted at first lead to no discussion. I had no bad consequence yet but find it suspicious and suggest you reject non-motivated friend requests.

crystal terrace
grave fractal
#

what is useDelta for things like gas cans?

crystal terrace
grave fractal
#

in scripts/item.txt i was looking for gas can cause i wanted to make a mod which adds 2 other gas cans and stumbled onto this:

#

so i wondered what it meant

bronze yoke
#

number of uses = 1 / UseDelta

grave fractal
#

ahhh now i understand

#

thanks

sinful scaffold
#

Wait, so the item spawn chances are percentages, right?
.items, 7);
Means 7%
right?

bronze yoke
#

sort of

#

the final chance is scaled by your loot settings, and the default loot settings aren't 100%

#

iirc they're 60%

#

it's also increased by the zombie density in the area, and probably some other factors

sinful scaffold
#

So, while not a straight percentage, it's kind of a percentage?

bronze yoke
#

yeah, it's just a bit more dynamic

#

most people probably play on default loot settings so i would consider the final chance to be roughly 60% of the number you actually put

sinful scaffold
#

Thank you

dark wedge
#

FINALLY. I got hit reactions syncing in multiplayer for Brutal Handwork. Now I have the bulk of the attack stack all rewritten in Lua and working. ๐Ÿ™‚

sage eagle
#

how do i add images onto maps

#

like if i wanted a custom hand image that the player can see in game

trim mist
dark wedge
# trim mist you mean you got the server to sync with the client? For hit reactions?

No, the server doesn't process any of that information. On hit the attacker sends a command to the sever with the zombie's ID (and some other stuff), and this is then relayed to all players. I build a cache periodically of all zombies in your current cell and organize it by ID so I can just get the zombie's reference by the ID received. I then just call the java hit reaction function, as I don't have access to the "FallDown" state (but I do to all the others. blech).

#

I tried this technique before, but I guess I did something wrong as I rewrote it and its g2g. ha

heady crystal
#

Would anyone be so kind as to point me towards a tutorial on how to make custom outfits?

grave fractal
#

you mean armor and that stuff?

heady crystal
#

No like literally a zombie outfit

#

The definitions and stuff

#

My small brain can't understand it

#

I've added a custom outfit to the definitions, made the random xml file with a guid that I... think works? But still no dice.
So I am missing something, but I can't find any guides or tutorials out there.

crystal terrace
#

There's one on TIS forum no?

tawdry solar
#

congrats

crystal terrace
#

@tawdry solar you should totally start a gas 2 go franchise in pz๐Ÿ‘€

tawdry solar
#

bud

#

i have some news for you

#

its already a franchise

#

i had an old project for a map

#

but gave up

crystal terrace
#

I mean make more stuff around it

tawdry solar
#

oh ryt

#

maybe

#

after im done with my other stuff

crystal terrace
#

Clothing, toys etc

tawdry solar
#

yeah

crystal terrace
#

how do i handle versioning my mod on steam? through workshop.txt or just description?

bronze yoke
#

wdym? if you want a version number then yeah, just put it in the description

#

personally i put mine in the change notes and the mod.info (as modmanager will display it)

crystal terrace
#

ig i could do that, also for any sort of update i would need to reupload the mod in workshop i assume.

bronze yoke
#

yup

crystal terrace
#

has anyone worked with this? seems like this guide might be missing some info

#

connection fails, is what i get mostly.

#

nvm, might have missed a couple of steps๐Ÿ‘€

#

i have my mod in Users/user/Zomboid/mods and followed the steps launch server also making sure to use nosteam flag that allows to disable workshop folder. But not sure why i get this.

grave fractal
#

can you add normal textures to models in this game? so far whenever i looked at mods i only saw a regular texture

bronze yoke
#

nope

grave fractal
#

bummer

opaque fiber
#

animzed when?

crystal terrace
gilded hawk
#

What the "Refill container" Context menu option exactly does?

rancid wraith
#

anyone familiar with the player inventory container object? just started playing around with lua and modding, but i'm finding it difficult to find resources about it sometimes.

crystal terrace
warped condor
#

Who did it with the translation why it doesn't follow the same pattern? half of this, half of that, it's disgusting.

    ContextMenu_Wooden_Wall_Frame = "Wooden Wall Frame",
    ContextMenu_MetalWallFrame = "Metal Wall Frame",
warped condor
#

Same for this type of translation, why the name in there is different than object name ingame.

ContextMenu_BigWiredFence

if I need to translate lets say 30 objects, I would need to add extra layers to the code for those objects.

opaque fiber
# crystal terrace What's that

it was supposed to be a tool shipped with build 41, allowing players to create custom animations and new clothing items easily

#

but last i've heard of it was in a thursdoid well before the stable launch

#

if any devs are on, could you reveal what happened to it? i don't mind that it's not out, but i'd still like to understand what stopped it from being released

crystal terrace
#

might be on the shelf now

#

everyone just cares about B42 now

crystal terrace
#

player MP all by myself xd(just testing stuff)

#

if im running two clients on same system, doing getSpecificPlayer(0) would give me same players?

#

well actually one is server

bronze yoke
#

no, get specific player only grabs local players

#

as in from the client calling the function

crystal terrace
#

that's strange, testing stuff on my mod. Sever side stuff looks cool but the client side there's context menu, there's function call and what not just nothing updates in global mod data at the end

crystal terrace
#

didnt think too much of MP with regards to mod, its seems like whole another ball game.

#

need some help with testing mod on MP, im not sure if firing both client and server from machine could be the problem or if its same behaviour regardless. If anyone is willing to help lmk, you'd need to launch a server for a couple of mins add my mod to it and ill test some stuff.

#

actually ill host the server, id just like to see if other player can use my mods functionality as well.

bronze yoke
#

i've never noticed any behaviour differences between dedicated and in-game hosted

gilded hawk
#

How can i mod a vehicle to increase it's ability to tow? I got asked to improve vehicles towing. And I'm wondering if it's possible doing it via lua

#

I assume I need to increase the torque right?

crystal terrace
#

ye ig, for ex you can compare the values across best towing vehicles in-game and simulate that behaviour a couple of folds, given its possible.

#

I think ambulance and fire trucks are best ones at this job

crystal terrace
#

can server admins see global mod data for everyone?

#

because the mod works but i dont see entry for the client as a server admin

bronze yoke
#

are you transmitting the data?

crystal terrace
#

ah nope not to server

neon bronze
#

:transmitModData()

crystal terrace
#

but this is only for squares and objects tho, im working with GlobalModData

#

ah it also has a transmit method

#

it requies a string val tho, i think it might be the UUID ?

#

i should trigger transmit mod data at every update in globalmoddata right?

drifting ore
#

Bro, someone PLEASE make a modd that adds BMW M3 GTR from NFS most wanted 2006

#

๐Ÿ˜ญ

#

i might even try to reach kI5

limpid grail
#

is there anyone who could make a mod that adds an angle grinder to the game so you can turn regular drums into rain collector drums because if you think about it, if you grind off the top part off a drum, you're left with a drum that can collect rain water

fickle knot
#

Hi. What is correct line to add several atatchment type?
AttachmentType = Bottle,Walkie,

rancid wraith
crystal terrace
#

checkout methods for ItemContainer on java docs

crystal terrace
crystal terrace
#

i have made some changes regarding sending global mod data but it still not working, this is how i call this method inside each block which tweaked globalModData

#

this is my client side event, found this script in discord chats

crystal terrace
#

found some more stuff, i have to check if its client or server before transmitting data? Shouldnt both parties transmit

#

so it can be synced across all clients and server

patent knoll
#

Anybody have experience adding zombies spawn on item use in an area surrounding player?

long grove
#

can someone make a trait mod that puts you in a wheelchair for like +20 points?
like in termina, cant go up stairs without crawling, if your arms are injured you go slower, certain attacks can knock you out of your wheelchair

bronze sand
#

I am curious about something

#

Is it possible to increase the chances to forage a specific list of items by holding a specific thing on as Secondary or Primary?

warped condor
#

I didn't test it, but you have something like this

function ISSearchManager:updateModifiers()
    local character            = self.character;
    --
    self.perkLevel            = self.character:getPerkLevel(Perks.PlantScavenging);
    self.square                = self.character:getCurrentSquare();
    --
    self.modifiers = {
        aimBonus            = math.max(forageSystem.getAimVisionBonus(character) * self.aimMulti, 1),
        sneakBonus            = math.max(forageSystem.getSneakVisionBonus(character) * self.sneakMulti, 1),
        traitBonus            = forageSystem.getTraitVisionBonus(character),
        professionBonus        = forageSystem.getProfessionVisionBonus(character),
        panicPenalty        = forageSystem.getPanicPenalty(character),
        bodyPenalty            = forageSystem.getBodyPenalty(character),
        exhaustionPenalty    = forageSystem.getExhaustionPenalty(character),
        clothingPenalty        = forageSystem.getClothingPenalty(character),
        weatherPenalty        = forageSystem.getWeatherPenalty(character, self.square),
        movementPenalty        = forageSystem.getMovementVisionPenalty(character),
        lightPenalty        = forageSystem.getLightLevelPenalty(character, self.square, true),
    };
end

So I assume you can adjust/modify bonuses.

#

checking if the player wear item could be done with OnPlayerUpdate event*

bronze yoke
#

or just use the events to see when the player changes items

warped condor
#

Also you have global table forageSystem in .\media\lua\shared\Foraging\forageSystem.lua line 48.

elfin stump
#

Anyone ever messed with the ZombiePopulationRenderer? I would like to use the renderCircle function to render a circle on in-game debug ZombiePopulationRenderer but I am have trouble getting it to work. I am unsure how to call a reference to the renderer in game. I have tried getting the rendered like this zpw = ZombiePopulationRenderer() but that throws and error, and I have also tried this zpopNewRenderer(), which lets me call renderCircle on that withour an error, but also without anything rendering. I am suspecting that "zpopNewRenderer()" isn't getting me the same object that I am looking at, but I am not certain.

bronze yoke
#

that sounds like it creates a new one, if you want to change the one the debug menu is using you need to grab it from there

elfin stump
#

k that is what I was thinking and that it isn't being displayed cause its a new one that is just in memory or something. Right now I am trying to extend ZombiePopulationWindow.lua with my function to then call and add the circle, but I am not quite sure how to get the reference to the actual debug window in game from a script that is being called by an event. I do feel like I am getting closer to it tho.

balmy swan
#

Heya folks. I got a few questions in regards to item distributions.
Is there any sort of reference doc for distribution locations or procedural spawns? I'm having trouble finding one.

Also, how would I go about having an item spawn on a zombie?

elfin stump
# balmy swan Heya folks. I got a few questions in regards to item distributions. Is there any...

`..Contents\mods\YOURMOD\media\lua\server\Items\YOURDISTRIBUTIONFILE.lua

require "Items/SuburbsDistributions"
require "Items/ProceduralDistributions"
--I think you need procedural for zombies but not positive

table.insert(SuburbsDistributions["all"]["inventorymale"].items, "SomeItemHere")
table.insert(SuburbsDistributions["all"]["inventorymale"].items, chanceForItem)

table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "SomeItemHere")
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, chanceForItem)
--Chance for item is not a 1 out of 100 chance but is something else that I forget, I think it is the amount of rolls or something like that.`

You can go into debug mode and turn on LootZed to review the chances by looking at dead bodies with the LootZed utility.

#

That example shows male and female adding to zombies via the built in loot distribution system, there is a lot you can do with it, but you will probably want to start by looking at other mods that spawn a lot of items and checking that directory to review them

#

There are a few different ways to spawn loot, and a few different ways to declare it in the existing system

bronze yoke
#

you don't 'need' to require anything, requiring vanilla files doesn't do anything

balmy swan
#

Thank you! I had already figured out the way to add items to containers through the table.insert method, I just couldn't figure out the way to implement it on zombies, which was the infentorymale/inventoryfemale part.

Do you not need to add the require part? I've seen that on pretty much every mod that I've checked out so far.

bronze yoke
#

if you're not storing the return value in a variable, all requiring does is ensure a file runs before yours - and vanilla always runs before mods

elfin stump
#

I've only done it from an old recommendation from way back but what albion is saying sounds right. I think we were doing it to make sure that it loaded after sandbox variables were loaded or something like that, but I would go with what albion is saying unless you have any issues.

balmy swan
#

Huh... That makes perfect sense, actually.
Tested it out without the requires, seems to work perfectly!

elfin stump
#

Good idea to add at the end of your distribute the line "ItemPickerJava.Parse()" if you are using sandbox variables too, sometimes you can end up in cases where distribution files do not update from what is in the sandbox, that line should fix it if you get that condition - I am pretty sure that is the only line you need to correct that

balmy swan
#

Not using that at the moment, but that's a good idea. I may want to implement that eventually ๐Ÿ˜„

crystal terrace
#

trying to understand client-server stuff with regards to modData, i wrote a small script which increases count. One specifically increments count if its a server other one does it regardless. Thing is even tho im hosting atm, isServer() returns false.

bronze yoke
#

the server and the client are still completely separate even when hosting in-game

#

it basically just runs a dedicated server in the background

crystal terrace
#

so it only works if the script is in server folder then ? is that what you mean or id have to host a server somewhere?

bronze yoke
#

isServer() is returning false because you're running it on the host client

#

if you check coop-console.txt the prints shouldn't show up in there since that's the server log

crystal terrace
#

where can i find coop-console.txt, is it in pz folders?

bronze yoke
#

it'd be in user/Zomboid

crystal terrace
#

k, thanks.

#

you're right, i dont see anything in coop-console.txt file

crystal terrace
crystal terrace
bronze yoke
#

just to correct a couple things here, while the server and shared folders are just organisational, the client folder is actually client-only, and for most object types you *can* rely on transmitModData

crystal terrace
#

ah client is for only client side and rest is just which files are loaded first. So dont need to look into server/client side commands just to sync moddata. transmitModData should be enough to sync?

bronze yoke
#

transmitModData doesn't function on player objects

crystal terrace
#

i read somewhere, objects has to be in player inventory for this to work? sorry i meant transmit should be enought o sync globalmoddata?

bronze yoke
#

for globalmoddata i don't tend to work with those methods so i don't know

#

for all my uses i've been able to keep all the global moddata on one end

crystal terrace
#

got it, thanks anyway. if it doesnt work i might look into server/client commands. I honestly dont know if i need to sync the global data, but this is just testing stuff moslty to see if anything im missing.

bronze yoke
#

yeah, usually i have the global mod data server side and use client commands when the client needs to do something

#

but just syncing the mod data is a much better idea if you actually need to use the mod data on the client side

crystal terrace
#

that's one way to do it, i think that would work for my use case.

fickle knot
#

Hello. Is there a possibility to add 2 AttachmentType somehow? i need walkie and bottle. Help plz๐Ÿ˜ญ

gusty wharf
#

has anyone got any idea what the boolean at the end does in?
TraitFactory.addTrait("SpeedDemon", getText("UI_trait_SpeedDemon"), 1, getText("UI_trait_SpeedDemonDesc"), false);