#mod_development
1 messages ยท Page 185 of 1
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
AddItem
I hope they change it in b42
lowercase addItem is only used for passing in an already existing item
So many people have problems witjh addItem and AddItem
those people need to get umbrella :3
if its that simple thats silly
Im still doing the old looking up java docs and looking at vanilla code way lol
by already existing item you mean an item already in inventory correct
yeah
an instance of an item, not just a string telling it which item to create a new one of
so if i want to roll item instead of add item in my code I would add a line like baginv: itempickerjava.rollItem ?
Do you want to add an item from a distro list?
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
i think you'd have to use a combination of fillContainer and ForceForContainers actually
I feel bad cause i'm sure these are questions that get constantly asked
local inv = playerObj:getInventory()
i don't see how you could get a ItemPickerJava.ItemPickerRoom for the other one
no, this is the first time anything like this has come up in my time here
Isnt he trying to add items to a bag?
you're right i need to add local inv = player...
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
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?
i'm not even sure if the item is added to the inventory by the time OnCreate is called
Its reference in the result but i think its added after the function ran
I usually go to debug and try the syntax there
Before actually creating the structures
(To each their own)
Its easier to write if know the syntax.
Im saying this cuz im trying out zombie functions atm hehe
my debugging so far as been console review, no clue how to do it otherwise. When I say I'm new i mean very new
do you have debug mode on?
but we were looking to add some endgame depth to our playthroughs and this is a precursor to that.
no
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
under advanced launch options
yeah
i was just running cheat menu for spawning etc
but an error trace and lua console sound very helpful
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.
googling forceforcontainers returned 0 results ๐
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
fillContainer seems like what I'm looking for just need to find an example of it somewhere now.
i can't see how to force it to use a specific list, it'll just pick randomly as usual
Is it not possible to create custom tables drawn from the vanilla list to call from ?
rollContainerItem seems to be the key actually
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
all of these have really misleading names
I agree from an outsider looking in
most of them have singular names and then i look inside and it tries to add every single item in the distribution table
so in the debug menu if a line of code is green what does that indicate?
could you screenshot? i might just be having a moment but i don't think i've ever seen green code
ohh right, i never quite processed what colour that was
that means it's the current line
Also points out where the error occurs
in this case it's still an error because you define inv in the loop that needs inv to generate
okay so currently with the inv = line added its throwing no code but not adding the item to the container inventory.
Put it outside the for loop
oh i didn't even notice, do not do Recipe.OnCreate = {}
that wipes the entire oncreate table
Also way too many ends
lol thank you
1 too many my mistake
I had it as SupplyFlares.Recipe.OnCreate = {} but that wasn't working at all
you have to define each part as a table
e.g.```lua
SupplyFlares = {}
SupplyFlares.Recipe = {}
SupplyFlares.Recipe.OnCreate = {}
You can male Recipe.OnCreate.SupplyFlares if you want
local inv = playerObj:getInventory()
for i = 0, inv:getItems():size() - 1 do
local inv = playerObj:getInventory()
local bag = inv:getItems():get(i);
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
and i don't need to declare any kind of Recipe.OnCreate?
it's declared by vanilla already
will this only target the bag created this time
yeah
thats so much cleaner, then i just have to figure out the code that replaces the base.bandage with rollContainerItem
First check if the current code works
hmm still not adding bandages to the bag
is the file in the server folder?
but it did add it to the playerinvenotry
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
my luas are located under mod/media/lua/server
What did it add to the inventory?
Whats your current function like?
function Recipe.OnCreate.SupplyBagBlue(playerObj, square, result)
local baginv = result:getInventory();
baginv:AddItem("Base.Bandage");
end
the one albion posted above
ohh my bad
oh no worries whatsoever
i misread the params
I'm learning plenty
the order is actually function Recipe.OnCreate.SupplyBagBlue(items, result, player)
Lmao
i thought it was the third because object, arrayList2, inventoryItem2 but object is the function to call ๐
this worked
thank you so much
local inv = playerObj:getInventory()
for i = 0, inv:getItems():size() - 1 do
~~~ local inv = playerObj:getInventory()~~~
local bag = inv:getItems():get(i);
ty we actually bypassed this with a simpler bit of code
well albion bypassed it
Yeah using the arg
I'm still learning to translate what a param and arg are so you guys are awesome
Thats the proper way.
Im just pointing stuff out cuz you said you are new to this.
oh no i appreciate it
some of it goes over my head i'm just like sure that makes sense
The local can reach inside the loop cuz its declared OUTSIDE and BEFORE the loop
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
if it's true it looks in the junk table instead
alright im gonna give that last bit a test run
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?
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
that whole code should be enough to fill the container
local baginv = result:getInventory();
local distContainer = ItemPickerJava.getItemContainer("bedroom", "crate", "ClothingStorageWinter", false)
ItemPickerJava.rollContainerItem(result, player, distContainer)
baginv: AddItem(distContainer);
distContainer is a reference to the java object that stores the data about distributions
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)
ohhhh
(the lua tables are eventually parsed into java for performance reasons)
so i don't need the baginv:additem line at all?
nope
rollContainerItem should basically run the normal loot spawner on that container for that distributions table
if that works i just need to set the amount of items to roll
distrib lists have gaps
does it repeat until fill
zombrand will try to add a number 50% of the time
Right..
Maybe have em put into his table or something
Cuz i was thinking he can use lootzed similar functions
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
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
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
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
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
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
this may work if i can reference the vanilla generation lists in my distriblist
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
btw this is how you use codeblocks on discord
``
--lua codes here
``
Anyways goodluck with your mod
appreciate it greatly
with the code you sent me it adds a single item to the bag from that list
oh really?
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
use a for loop```lua
for i = 1, 5 do
-- code you want to repeat
end
if it only adds one each time you don't need to do that weird stuff
just i = 1, (number you want)
i = items:size()-1 < 5 do
worked oddly enough
correction worked oddly gonna try i = 1, (number you want)
Has anyone made an automation mod like on Minecraft / Factorio etc?
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?
getCell is an instance method, you need an instance of an object to call it, not just the class
Ok, but why does only getCell() work as well?
because that's a global method
do i not have to write getplayer() whenever i use an "IsoPlayer()" function?
thank you
may i ask what an instance method is exactly?
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
ok, i understand, thanks
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?
I would do getPlayer():getCell() insteaf
getWorldX always returns zero
there's no difference between getPlayer():getCell() and getCell() except the first one takes more performance
This seems to be throwing an error and not working;
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
for i = 1, 5 do
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
it is attached to the player, the cell is not a static object but the entire currently loaded area
it doesn't 'change' because there is only one in existence
So getPlayer():getCell() anf getCell() return the same thing?
yes, there is always only one cell and all the getCell() methods return the same one
Wow
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
Will it give also cells back that are not loaded in?
the cell is the currently loaded area, there are no 'unloaded cells'
Bjt there are multiple ways to get a cell, or do they all point to the same function?
they all point to the same function
Damn
there being multiple is one of the many reasons i think this was probably different in the past
How do i get the player cell then?
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
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
there is only ever one cell
What if i call getCell() on the server?
but that returns always the same
yes, there is only one cell
what
Ah
Where you are currently
but the object string is also the same always
because it's the same object
okok
but, what do i have to do to get the world relative coords of my cell or character position?
getPlayer():getX() getPlayer():getY()
and what does purpose does getCell() even have?
it has a lot of object lists and utilities
it's the object that governs everything that is currently loaded
Yesss, that worked
e.g. if i wanted to scan for zombies i would want to use its zombie list
like getCell():getZombieList()?
yeah
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?
i'm confused again
0, 0 is because those properties are deprecated
but how would getzombieList be any useful?
it has all currently loaded zombies
all on every part of the map?
on every currently loaded part of the map
no, in multiplayer it's only stuff that's loaded for the current client
and for the server the list is empty
ok
very confusing (for me) but thank you for your time and help. I think i'm beginning to understand
Its a bumpy road to modding in pz
definitely
Just wanted to make sure to thank you for your and Alphas help today. Got tied up on other stuff but I appreciate the guidance.
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?
you can add the item to the zombie's inventory OnZombieDead
Wouldn't that trigger for every zombie dead and I'd have to make further checks to know
yeah
put to shared folder
if a square isnt loaded due to player being away from it, can i not access such square?
you can't
gets triggered
is there a way to force load or something maybe?
Hm I guess it's worth trying

no, the inventory doesn't exist until just before that event
Starts fuming
well i think it does but it gets wiped when they die
This is MESSED UP reeee
where are you adding it to their items to spawn at death?
As soon as I spawn them
i think only the zombie's owner's list matters
Ugh this is gonna impact performance. I hate this. This is just wrong
is there a way to store complex objects somewhere?
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
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,
}
}
is your script called items.txt?
keep file names diff from vanilla
if it's the same name and directory it overrides vanilla/other mods files
do something liek myitems.txt or just anything to distinguish it
Does it even matter if i'm on a different module?
modules are for item name conflicts, file name conflicts are a separate issue
if there are two scripts/items.txt, the game will only run one no matter what
so every mod on the workshop has to use a different name for their own items?
yeah
ok, thanks
Whats the difference between OnCreateSurvivor and OnCreatePlayer
it fires for IsoSurvivor objects, which are only used for the character creation preview right now
so would either work for detecting when a character spawns into the world?
no, only OnCreatePlayer is reliable
thank you
it's the texture iirc
we discussed it here
you can just pass nil, but i recommend using the item factory anyway
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.
Do I need to change getFileWrite as well?
that should write to whichever environment it's running on
oh, your code triggers on OnPlayerUpdate, but that's a client only event, so it never triggers on the server
Ah, then do i need to use OnTick then?
O is there a better way to update the value server side
i would caution against writing a file every tick in general, but yes that's the closest equivalent
player:die()
end```
i'm not understanding the issue with this code. I get errors everytime I click the button on my UI
getPlayer():Kill(nil)
I defined player
this worked. Thank you ๐
huh, i use :die() for all my testing and it's never failed me
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?
you literally have to store every property of the object and then use that to set everything back again
extremely tedious and manual
Can I use Events.EveryTenMinutes instead? Does it get called in server?
yeah
at an instance, how many squares are loaded? a cell of 300x300?
or just isoregion
so i should be able to work with 200 x 200 squares at any instance around player
it varies
Is there a wait function for lua?
no
Is there a way to make a timer?
yeah, there's some framework mods on the workshop to simplify it
Would this work?
repeat(Time)
Local CurrentTime = os.time()
while CurrentTime < CurrentTime + 1 do
end
end
end```
it would, but it would also freeze the entire game until it ends
why is that
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
Okay
just crash the game LOL
zomboid heimer
I've recently been successfully crashing the game
apparently items consuming themselves in bizarre ways royally confuses the game
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.
they're compressed in some bank file
they live in UI.pack and UI2.pack in the texturepacks folder
grabbing it from the wiki is usually the easiest way
Yeah I ended up just doing that lol
Project Zomboidheimer (thanks for the name gas 2 go nationalist) is halfway done
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?
no comma on the skill required line
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?
just found out, it simply doesn't change the modData 
you shouldn't even be able to get a reference to unloaded objects
some vanilla recipes specify untainted water, maybe you can reverse it?
shoot which ones do? cause I can probably find it in the recipe scripts then
I may be wrong but I think all food recipes require untained water
but I will check real quick to make sure
no problamo
are you actually making a nuke?
yes
I have the UI finished but im currently trying to make a nuke model in blender
you could make it like a gaint aerosol bomb
where it exploads killing shit and sets fire
its going fine but I am annoyed by how lua doesnt have a wait function
ah
Similar to one of my ideas where I took the pipe bomb and just 10000x it
you can do that?
Taking a break on it. If the nuke mod works out I will go back to it
ah alr
thats how you get better
my brother actually tried helping me with it (he majors in computer science) and he got mad about the documentation for modding
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
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
Time for your 5 hour debugging session
I probably just forgot a comma again. that or there just isn't a way to only use tainted water
you can just make your own function that does the opposite
how? XD
Does anyone know the variable for if you successfully hit a player?- Specifically with a melee weapon-
There's the event OnWeaponHitCharacter
https://pzwiki.net/wiki/Lua_Events/OnWeaponHitCharacter
You'll have to check if the character being hit is a player and if the weapon is a melee weapon.
Gotcha, time to check if something like that exists in the variables
Maybe OnPlayerAttackFinished?
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).
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!
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
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.
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)
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
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
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
Lol
I've forgotten the mod structure for pz.
media> rest of the folders
Where do the scrips go again?
scripts folder
uhm
but where does the scripts folder go cause i knew that
your mod folder
Media folder
Just look at the folder structure section for reference. https://steamcommunity.com/sharedfiles/filedetails/?id=3006109377
Im impressed by how often @crystal terrace and @bronze yoke are active honestly
Until I get bored of modding in pz hopefully it'll be a while๐
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
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
i don't mind helping with what i know๐
soo need a clarification regarding something I may have been percieving correctly for a while. Shouldn't isClient() return true on solo runs?
Only in mp
i seee so its irrelevant anyways for solo
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
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?
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.
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!
Moodle Framework!: https://steamcommunity.com/workshop/filedetails/?id=2859296947
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
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.
I wonder if it has something to do with needing to get the next IsoChunk and maybe loading it while in use
I wonder if building aren't always loaded until they are seen
are you suggesting to load next chunk at end of it?
Yeah that's my guess
i can try that, id like to see how far i can go wrt to player tile
Could I get a copy of that snippit? I'm trying to spawn cars in a nice way ๐
the one i have right now?
ya
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)```
so much glass, thanks!
helps me visualize๐
it's a good idea
Thanks :)
How do I spawn in an item that I made?
With item picker i think its called
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 =?
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
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
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
Are you in debug mode?
yeah but debugging is not exactly my forte yet
From what I know sound files don't play in debug mode
ahhh
It should work in normal gameplay if there's no other problem, happened to me as well.
does the file = line need to be special where it isnt a base game sound
that the structure for my mod
I'm assuming you wrapped all the scripts inside module (just coz I don't see the curly braces here)
I have not waka waka
module SVFlareSound
{
sound SVFlare
{
category = Item,
clip {
file = media/sounds/SVFlare
distanceMax = 300
distanceMin = 1
volume = 0.7
}
}
}
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
i changed it to sound
thanks for your help
gonna test in debug and if that doesn't work ill hop out of debug
alr, make sure to update that change in script as well
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.
i didn't see that option on the website
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.
yep still no sound
you jumped out of debug?
also just looked at this one, values inside clip are missing ","
I am honestly no surprised ๐ Ill check this out in a moment
,'s corrected still no sound lol
ill have to look at another mod that adds sounds and see if i can figure out what im doing wrong
welp, as a last resort id suggest to maybe try converting sound to mono then if you dont find anything.
kk, I've gotta stop working on this but will pick it back up tomorrow
thanks for your help
this was my script while i was learning stuff about addting items, worked for me.
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
Reason: Bad word usage
there is a complete tutorial here: https://theindiestone.com/forums/index.php?/topic/28633-complete-vehicle-modding-tutorial/#comment-292151
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...
Where are sprites kept?
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.
im going back into school in less than a week
the nuke mod must be finished before then
must
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
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
missing comma on DisplayName line
yeah, you can't directly access fields like that
Yeah, it seemed too good to be true
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)
Ho, that's neat, crazy it has to be that hard
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
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?
that's unfortunate
wdym in a given world?
I mean, in the current world
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
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!
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
Alright the nuke is nearly done. A few more hours and we are done.
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?
i'm not sure
shit you might beat me to it, my mod hit a roadblock
Where do I put the icon for my new item?
Keep going I will still be a few hours
also what's up with fire department just casually sitting there jeez
if you look closely there is a firefighter zombie "helping" me
sus
where do I put the icon for items?
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
this look like the right organization?
isn't the save name the creation date?
apart from models folder, everything seems alright to me
Yes, but i believe you can edit it
ah that's good to know
it seems small for a nuke
I was testing out the limits of my computer
didnt want to max out its power and crash my game so I went small for testing
ah alright
but I do bring good news
you will be able to hurl the W59 thermonuclear warhead like its a football
awesome sauce
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
its prolly the same problem im dealing with, you can only work with a limited squares at any time
how many
my bomb has a max radius of 15 tiles when I detonate it
i think it's ~190x190 total
is getOnlineId safe to work with for MP global moddata
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
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.
I cannot accept the range I have
I will try and fix it
no nuke of mine will have a radius of 15 tiles
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.
is there a way to change render distance?
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
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.
Is there a name to this method?
wait, the player id for local player is 0. Wouldnt it be same for everyone?
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)
Could you give an example please? I do not know where to start with doing that
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
its possible that ther's a cap on fire tiles maybe just to not hurt the performance?
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?
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
:(
oh well, thank you! I'll just have to use something else
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?
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?
It is interpreted in java code.
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
AnimSets is a directory under media including xml files that refer to the animations (.x or .fbx)
my fbx won't work for some reason
so something like grab list of character known recipes and find that value
yeah, that's how herbalist works
ok sweet ill give ti a try real quick
you can use isRecipeKnown() instead of looping
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()?
like their traits, the player's known recipes is just a list of strings
that explains it clearly, ty๐
Is there a way I could find the java code?
the best you can do is try to decompile those class files or just read em java docs and work with that info and also teh debugger gives you plenty of info
How do you decompile class files?
there's tools for that, also a steam guide from Tchernobill as well
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
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
So basically they took the Java code and made it unusable for me until i decompile it
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.
Alright well Iโll do that later because itโs 2 am. Goodnight other modders
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.
for some reasons, im getting true for known recipe even tho i havent touched the mag yet
let's see your code
hmm, doesn't seem like that should happen
its like the function doesnt even care what i pass
maybe i need to restart the save and give it another try
yeah, my guess is you got the recipe already somehow
or my guy is a nerd
hello, any reason to why this is happening? the icon size is 120x120
does it need to be a specific size?
32x32, if not sure can always check media/textures in vanilla
alright, thanks!
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
Have you enabled the know all recipes cheat?
thats a great tip also for me thanks
machine never lies
nah its debug mode, something that comes with game for debugging purposes. Way too powerful.
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?
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
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
We need to inform people that those cheat mods are just bugs sources. They should use Vanilla Debug instead of those.
if you want to use it in multiplayer you will need admin privileges on the server iirc
you need to do /setaccesslevel [name] admin
BASED PFP!!!!
thanks
i was checking out some camping fridges in the meantime
me
sry for u
susyphus
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
did it fix?
if not i would put item_ infrom of it
liket his
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.
no that wont work
its the sprite that shows
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?
i did that with another gun
in the same mod
that works
your weaponsprite is wrong, its supposed to be 2000 not 20000
it was showing base game textures
this is the file
WeaponSprite is the Model not the texture of the model
Your model is called js2000 not js20000
model js2000
{
mesh = weapons/firearm/js20000,
texture = weapons/firearm/js20000,
scale = 0.01,
}
}
thats what you have in that script
yea
whats your other item?
you need to put in the weaponsprite field whats your model is called
ooh
in onPlayerGetDamage, does damageType "WEAPONHIT" include also damage inflicted by firearms?
hey guys
Oh, i didnt notice one to many 0 in JS20000, but you got figured it out.
so i noticed different mods are having similar errors
with "Give300MWXP" related stuff
oh nvm im dumb it was always the samemod
yeah it did
aight
reasons for massive ass model?
you can adjust the scale on blender or on the .txt file
how can you edit the tiles around a player or an item?
is the item on next tile to player? or on same tile
Its not near the player. However the player does place the item (totally definietely not a thermonuclear warhead)
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
can you set tiles on fire?
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.
kk
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 run
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
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
Base,
thank you
hmm
neither of my other scripts have the ,
and didn't throw the error
the , isn't necessary
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
friends only usually causes the mod to fail to download entirely
since the server downloads mods anonymously
for testing i'd recommend unlisted instead
im assuming there's some way to add description to context menu options, prolly its passed along when you're building it?
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
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.
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
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)
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.
they were defined elsewhere in my code
oh is it for the translation file for diff languages in shared folder
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
even if i dont plan to add translations for now? I should be able to do that down the road.
even if you only have english it'll let other modders translate it
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?
you can, though annoyingly you have to reupload the mod to change the preview
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.
yeah, it won't let you upload if it's wrong anyway
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
that's right
sweet, thanks.
should i keep visibility something else for testing stuff atm?
someone mentioned "friends" didnt work i believe
right, unlisted it is.
yeah, private and friends don't work well
after the upload, is it safe to remove the folder from workshop? or need to keep it there
you can, but then you won't be able to update it
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"?
oh then you can just move it away yeah
https://steamcommunity.com/sharedfiles/filedetails/?id=3011333569 @covert carbon it's up, btw thanks so much @bronze yoke you been a great help๐ .
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.
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
๐ค
great start, i already found something
. I can see the values are nil in debugger but does the execution stops here. Edit: fixed it btw, put em both into bracket.
the mask are the Filibuster originals ones?
can you print it like you did with the other one?
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!!
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.
I edit it with Notepad ++ never with the integrated gui.
ah thats good tip
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?
0-100, roughly
sandbox settings, zombie population affects it
default sandbox settings are like x0.4 iirc
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.
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.
i think ill keep 10 for now, found like 3 on apoc loot settings that too when i checked 3 libraries. Seems reasonable for now.
what is useDelta for things like gas cans?
wym by that?
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
number of uses = 1 / UseDelta
Wait, so the item spawn chances are percentages, right?
.items, 7);
Means 7%
right?
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
So, while not a straight percentage, it's kind of a percentage?
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
Thank you
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. ๐
how do i add images onto maps
like if i wanted a custom hand image that the player can see in game
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
Would anyone be so kind as to point me towards a tutorial on how to make custom outfits?
you mean armor and that stuff?
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.
There's one on TIS forum no?
congrats
@tawdry solar you should totally start a gas 2 go franchise in pz๐
bud
i have some news for you
its already a franchise
i had an old project for a map
but gave up
I mean make more stuff around it
Clothing, toys etc
yeah
how do i handle versioning my mod on steam? through workshop.txt or just description?
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)
ig i could do that, also for any sort of update i would need to reupload the mod in workshop i assume.
yup
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.
can you add normal textures to models in this game? so far whenever i looked at mods i only saw a regular texture
nope
bummer
animzed when?
What's that
What the "Refill container" Context menu option exactly does?
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.
ItemContainer? What about it
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",
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.
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
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
no, get specific player only grabs local players
as in from the client calling the function
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
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.
i've never noticed any behaviour differences between dedicated and in-game hosted
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?
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
oh ill give it a couple of tries then.
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
are you transmitting the data?
ah nope not to server
:transmitModData()
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?
Bro, someone PLEASE make a modd that adds BMW M3 GTR from NFS most wanted 2006
๐ญ
i might even try to reach kI5
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
Hi. What is correct line to add several atatchment type?
AttachmentType = Bottle,Walkie,
Well to be more specific, I'm wondering if there's any good documentation or references for manipulating container tables
checkout methods for ItemContainer on java docs
Javadoc Project Zomboid Modding API declaration: package: zombie.inventory, class: ItemContainer
good stuff, thanks
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
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
Anybody have experience adding zombies spawn on item use in an area surrounding player?
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
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?
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*
or just use the events to see when the player changes items
Also you have global table forageSystem in .\media\lua\shared\Foraging\forageSystem.lua line 48.
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.
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
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.
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?
`..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
you don't 'need' to require anything, requiring vanilla files doesn't do anything
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.
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
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.
Huh... That makes perfect sense, actually.
Tested it out without the requires, seems to work perfectly!
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
Not using that at the moment, but that's a good idea. I may want to implement that eventually ๐
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.
the server and the client are still completely separate even when hosting in-game
it basically just runs a dedicated server in the background
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?
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
where can i find coop-console.txt, is it in pz folders?
it'd be in user/Zomboid
Hey guys,I've been working on getting my mod to work on multiplayer and since there are very little resources on that topic I have a few questions. isClient() / isServer() What these methods do is clear, however when I call isClient() in a file that is located in shared it returns false althought...
great resource to explain everything around client-server stuff
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
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?
transmitModData doesn't function on player objects
i read somewhere, objects has to be in player inventory for this to work? sorry i meant transmit should be enought o sync globalmoddata?
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
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.
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
that's one way to do it, i think that would work for my use case.
Hello. Is there a possibility to add 2 AttachmentType somehow? i need walkie and bottle. Help plz๐ญ
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);