#mod_development
1 messages · Page 526 of 1
@willow estuary @calm depot
Thanks for your reply, I'll try it.
In general, when people are as vague as you are, there's not much there to motivate or engage qualified bystanders?
I'd suggest being more specific about what you want help with.
This is a continuation of the case of placing items in specific locations at the start of the game.
I have succeeded in placing items by specifying a location.
However, for example, if the character is current in Muldraugh and I try to get a grid of West Point, which is far away, I get an error (getCell() returned nil).
local sq = getCell():getGridSquare(10634, 10412, 0)
local worldItem = sq:AddWorldInventoryItem("P4StealthCamo.P4StealthCamoBlueprint", 0.1, 0.1, 0.2)
I want to place items in a specific location at the start of the game (Event.OnGameStart), no matter where I choose as the starting point.
I tried running the event hook script on the Server side, but the result was the same.
Any ideas?
The code is only able to interact with squares that are loaded/instanced and "exist", which is, I believe, a 150 tile radius around the player.
Here. if you check the pinned posts, the topmost post is a link to the modding resources section of the PZ Wiki.
There I found: https://github.com/Konijima/PZ-Community-API/tree/master/Contents/mods/CommunityAPI/media/lua/client/SpawnerAPI
Ok so
Sure, I'll check it thank you.
I think same to you, getCell() java method was just return current cell.
public IsoCell getCell() {
return IsoWorld.instance.CurrentCell;
}
Ik this is a big convo lately
If I wanted to make a mod that ONLY spawns volatiles with a custom texture
Would there be any feasible way
@hidden compass no point in placing an item if the client can't see it anyway - why not fire it off if Events.LoadGridSquare coincides with the location?
Yes, you are right.
I'd like to place a limited number of items in the game,
so I'm going to put a Spawn reservation in ModData at the start of the game and execute it when it becomes available.
Can I see somewhere in co-op mode that the mods are active?
Item spawn is now work well, thank you all help. 🙂
https://www.pepepepe.com/zomboid/20220219-1.mp4
are there any one seat vehicles?
not in vanilla I don’t think. Filibusters adds a couple tractors that might be one seat?
There is a mod that add motorbike, never tried but i guess it's only one seat
I have soon finished my UI API, all of you, do you have any menu ideas that I could do as an example?
Hahaha, no that is too hard
drag and drop is a mess so it's almost impossible to use it
that's a purely VISUAL change. the mechanics would still be the same.
Still impossible. Go check the ISInventoryPane and ISInventoryPage, if you understand something about drag and drop you call me xD
Here the kind of UI that my mod to in 11 line of code
There is, just not use here
so for an idea then... a "job board"
that would bring up THAT menu based on the jobs available.
Good idea
Nice UI, is that available somewhere?
Read his messages lol
It was a visual mockup he did
I did, I thought it meant he actually had the UI coded
Guys. I'd like to test a couple of mods of mine in Multiplayer before uploading them in the steam workshop. How do I do that?
There's a guide for that, check pin for the link
sry. I couldn't find anything in the pin. Do you have the link?
Personally, I never needed to download the dedicated server
the game comes with a script for hosting locally
all you need to do is make a host file, and make sure it points to the workshop for mods
then put your mods in the workshop folder and boot up the server
then join locally on 127.0.0.1
you are now playing multiplayer with client/server mode
thank you, dude
@sharp wind thank you again, It worked
@drifting ore nice work with the docs, btw. Keep it going. Very useful
Where do I generate the lua file that goes in: tiles->lua->server->items->EXAMPLE.lua?
sorry no, just a mock up
That's incredible, good job, will that be released to the public?
Hello peeps! Sorry to slot this in the middle of the conversation, I've a super-quick mod question, I wanted to make a Dawn Of The Dead style spawn mod - In the LUA for the spawnpoints, what (and where) do I put the height to spawn on the roof of the mall?
I have this so far:
worldX = 33
worldY = 22
posX = 13874
posY = 5877
Obviously the X and Y are the 3d coordinates, is there a 3rd coord to govern height?
worldZ/posZ should be it.
That's what I thought, but they weren't listed in the template I'm using - I'll give it a shot - appreciate the quick response 👍
@willow estuary any idea if it's just 0, 1, 2 etc or whether there is actual measurement to it?
does not exist. it's just a picture.
It's just simple integers like that, starting with 0. 1 being the first aboveground level etc.
Groovy, ty!
👍
@willow estuary and anyone else interested, this is not exactly how it works. Here's a reference for anyone else trying to modify spawn points: #mapping message
I'm sure there's a reason it is so conveluted... 🙄
That took too long to type up 😅 (edit: and work out)
That took too long to type up :sweat_smile: (edit: and work out)
Oh man, I feel bad in that this is common knowledge in the mapping sphere? 
Post this in the mapping channel with an informative header however? Worth pinning there for sure.
Yeah a pin might be nice
First time modder here, programmer by trade though - so wasn't too much of an issue... Welcome to post it and pin it by all means
i have a relatively light mod request hoping to see if anyone would be willing to help me out. ive been looking around and i cant seem to find any mods anywhere for this. nothing even close
its just a light cheat mod that makes static storage containers such as fridges, tables with drawers, crates, etc. have infinite capacity
or even just high capacity in general
new siren for Rosewood PD
https://gyazo.com/4c1c10782dbd9b1e08c0ee1523dd99e6
Hey guys, is there a mod which allows you to queue up cassettes and play them after each other ?
holy crap we need a tool programmer.
jw , has anyone seen or know of a mod that puts in NON military tractor trailers and or construction vehicles
maybe tomorrow
whats tmr?
maybe people will see such a mod tomorrow
i'm not exactly the person for this, but what are you looking for?
wellll... a car tool would be nice.
shows the car model and the wheels and lets you line them up. squares for the seats etc.
isn't that what the debug vehicle tool does?
the what now?
when you run in debug mode, the quick panel has a vehicle editor
fyi, i've never actually used it to edit anything, just poked at it enough to say "hey neat"
Yeah, that's exactly what the vehicle debug tool does.
Hit the checkbox " break on error" then hit F11
does nothing.
Isn't the vehicle debug menu accessed ingame from the debug window?
I think I used it once to rotate a car after landing it on the side, since I thought it was silly I couldn't push it over 😂
well i can't get past this main menu
The F11 window can be closed by pressing F11 again
it doesn't close.
If you mean the full screen debug thing that lets you look at lua script
it just sits.
f11 all day
Sometimes I had to press it twice or thrice if there are lua errors that bring it back up again. Try unchecking that "break on error" ?
i did
Could always restart the game I guess. 😂
Infinite capacity is not possible. Even increasing capacity too much can explode saves. It has happened with mods that increase vehicle trunk capacity
I recommend TOS backpacks
They don’t crash saves and have like 500 storage space
And are pretty easy to find
I have a question/ request if possible if anyone is bored and likes the idea. Would it be possible to add a function that is exactly like "take some dirt" except you don't need a sack and it deletes the dirt when you do it? But also leave alone the take dirt option but create a new ui selection for "make path"? I have to make a lot of trails to get to my base off the road and the overgrowth is a pain but even worse is filling all the sacks just to find places to dump them out and do it all over again.
Can't you access the world tiles through Lua though? Might be able to edit it
You could probably just put a path over it though
Is it different than a normal tile?
Like cement or something
Idk probably
You could maybe “delete” dirt but I don’t know what you would put under the missing dirt
I think he just wants to make a path on grass and stuff without having a sack
Well I mean like you can take the dirt now and put it in a sack. The trashcan has a delete function that can delete pretty much anything in it. I just don't want to collect the dirt I'm digging when clearing a path
I've had annoyances trying to make a path myself at some point, definitely seems like a decent thing to have. Just turning the grass upside down to get dirt instead of grass lmao
Yeah cause once you remove the top tile of grass nothing grows there
Pretty sure it’s already a feature
I'm not sure on the coded level I just know in game you have to dig the dirt to remove the top tile. Once that is done nothing will grow back.
Remove vegetation only removes the, flowers n stuff above the grass tile
You can cut the grass but it grows back, quite quickly at that
Hmmm
Also doesn't stop saplings and bushes from growing
Hopefully someone makes a mod of this
But like I said once that type tile of grass is removed and only dirt is showing the. Nothing grows back.
Yeah thats why I figures I'd ask. I wish I could code but unfortunately I can barely sit through a 10 min long youtube video of, well anything really
Totally possible. Are you willing to pay for it? If yes send me a message
where can i locate the sound database?
has anyone done new vehicle sounds?
While I don't know my way around the codebase, I would be surprised if there was a readymade function for this. I assume your best bet would be to get all zombies that are within a few tiles of your car and check some stuff on them. There might be a boolean for "can't get up" on the zombie? Since they can't get up when you stand on them or have a car on top of them.
dammit jim. she's dead.
you might have luck if you found how the game detects if a zombie is under a wheel for damage
or under a car to stop them getting up
it might be part of the vehicle data or part of the player/zombie data
local vehicle = getPlayer():getVehicle()
local square = vehicle:getSquare()
local list1 = square:getWorldObjects()
local list2 = square:getObjects()
inspect the returning values of list1 and list2. I'm sure one of them will return corpses on the ground
I don't remenber which one tbh
some sort of object I guess
you may iterate over the returning list to figure out which kind of objects you're dealing with
for ex: square:getObjects() return a list of IsoObject
you may further inspect it by querying its type with obj:getType()
was someone making a vanilla style gun mod with an AK?
local treetree = objects:get(index) how would i get it to spit out what is in that index?
for some reason I broke the crafting menu 
i broke the whole ass game and made a murderous haunted mower
change model to a roomba https://pbs.twimg.com/media/D6N9LYeUcAEcOzR.jpg
Did you get it to remove grass?
i will as soon as i make it stop TERRORIZING THIS NEIGHBORHOOD.
yeah that is very weird
Just call explode() on the square you're above and you're set.
OH GOD IT FLIES NOW
So you're saying... https://www.youtube.com/watch?v=ygr5AHufBN4
Shhh no tears
Only dreams now
Unrustle your jimmies
Lawnmower created by flyingthingz.com
The song is Miserere by Gregorio Allegri. This recording is performed by The Tallis Scholars.
the riding variety
time to play find the missing comma I guess
who was it that can do custom animations?
this cannot stand. he needs a legit "driving a mower" stance.
remember the drive by shooting feature too
https://youtu.be/rX070AEWiUU
Hell yeah
Disclaimer: Under Section 107 of the Copyright Act 1976, allowance is made for "fair use" for purposes such as criticism, comment, news reporting, teaching, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favo...
anyone know how to remove foliage via lua?
ISRemoveGrass.lua in the client timed actions folder has some code ISRemovePlantCursor.lua on the server folder building objects folder also has some code that hopefully should be helpful
I think removeplantcursor has the code you are looking for
return not item:isBroken() and item:hasTag("CutPlant")
end
function ISRemovePlantCursor:create(x, y, z, north, sprite)
local square = getWorld():getCell():getGridSquare(x, y, z)
if self.removeType == "bush" then
ISWorldObjectContextMenu.doRemovePlant(self.character, square, false)
elseif self.removeType == "grass" then
ISWorldObjectContextMenu.doRemoveGrass(self.character, square)
elseif self.removeType == "wallVine" then
ISWorldObjectContextMenu.doRemovePlant(self.character, square, true)
end
end
function ISRemovePlantCursor:isValid(square)
if self.removeType == "bush" or self.removeType == "wallVine" then
local playerInv = self.character:getInventory()
local hasCuttingTool = playerInv:containsEvalRecurse(predicateCutPlant)
if not hasCuttingTool then
return false
end
end
return self:getRemovableObject(square) ~= nil
end```
for index=0, objects:size()-1 do
local GrassBush = objects:get(index)
if instanceof(GrassBush, "IsoTree") then
GrassBush:Damage(GrassBush:getMaxHealth() * 0.9)
if not GrassBush:getModData().soundbreak then
GrassBush:getModData().soundbreak = 1
vehicle:playSound("VehicleHitTree")
end
-- if not vehicle:getEmitter():isPlaying("BreakObject") then
-- -- vehicle:playSound("breakdoor")
-- end
end
end
``` how would i make this do that. get rid of bushes and grass instead of trees?
can i reload a vehicles server script in debug?
or do i have to restart?
so quiet
Is it difficult to mod if you have no basic knowledge of programming and you get easily frustrated with coding?
depends on what you want to do, some types of mods do not require coding/or you just need to follow the template from already made items/weapons.
did you check the code for the plough in Agrotsar Farming Company?
it has a plough
that in theory atleast for me sounds like it should detect grass right?
it switches it to dirt i think'
rather just removing the grass
and they way they do it it removes EVERYTHING.
lol
Javadoc Project Zomboid Modding API declaration: package: zombie.iso, class: IsoGridSquare
a boolean called bFlattenGrassEtc
exists
uhm could this be it?
isCommonGrass
i'll try to find them
I'd love to see a mod that makes gaining skills 0.1% more potent by every zombie the player kills.
Might be applied on needs deteriorating slower too.
yeah this are not used in any lua file
that sound possible, the game already tracks kills and the fast learner trait has the code for xp gain
yeah like i said... it's rough
do you remember what the context menu says when the players want to remove the grass/bushes you want the lawnmower to remove?
found this code in timedactionstest.lua
Tests.remove_grass = {
run = function(self)
local square,x,y,z = getSquareDelta(2, 2, 0)
removeAllButFloor(square)
newObject(x, y, z, "e_newgrass_1_48", "Grass")
luautils.walkAdj(PLAYER_OBJ, square, window)
ISTimedActionQueue.add(ISRemoveGrass:new(PLAYER_OBJ, square))
end
}
Tests.remove_bush_hands = {
run = function(self)
local square,x,y,z = getSquareDelta(2, 2, 0)
removeAllButFloor(square)
local object = newObject(x, y, z, "f_bushes_1_8", "")
-- square:getErosionData():reset()
ErosionMain.LoadGridsquare(square)
luautils.walkAdj(PLAYER_OBJ, square, window)
ISTimedActionQueue.add(ISRemoveBush:new(PLAYER_OBJ, square, nil))
end
}
timed actions...
at somepoint what is a "grass"/"bush" has to be defined
it has to be somewhere
it's a "removetype"
ISWorldObjectContextMenu.doRemovePlant(self.character, square, false)
elseif self.removeType == "grass" then
ISWorldObjectContextMenu.doRemoveGrass(self.character, square)```
i think this is the section of the code that tells the game to remove the grass
function ISRemoveGrass:perform()
local sq = self.square local args = { x = sq:getX(), y = sq:getY(), z = sq:getZ() } sendClientCommand(self.character, 'object', 'removeGrass', args) ISBaseTimedAction.perform(self)end
and at the end it tell the character to perform the timed action
and then the next part of the code sets the time
@faint jewel i think you want use IsoFlagType.canBeCut for the bush and IsoFlagType.canBeRemoved for the grass
this is the codes that check if a bush and grass are present
function ISRemoveBush:getBushObject(square)
if not square then return nil end
for i=1,square:getObjects():size() do
local o = square:getObjects():get(i-1)
if o:getSprite() and o:getSprite():getProperties() and o:getSprite():getProperties():Is(IsoFlagType.canBeCut) then
return o
end
end
return nil
end
function ISRemoveGrass:isValid()
for i=0,self.square:getObjects():size()-1 do
local object = self.square:getObjects():get(i);
if object:getProperties() and object:getProperties():Is(IsoFlagType.canBeRemoved) then
return true
end
end
return false
end
yeah
so how do i remove the objects with THAT.
lol
and how the hell do you scale a square?
OH SHIT I GOT IT. WOOOO
okay... so currently... it murders zombies WAY too easily.
is there a way to check if a zombie is on the ground?
Heyo I'm trying to make my first map and 3 tutorials got me this far but I can't seem to actually get down any land or walls, not sure how to go about that, any help is welcome.
look up daddys videois.
For sure!
Daddy Dirkie?
aye
the tools in steam might be outdated btw latest versions are always in the forums https://theindiestone.com/forums/index.php?/topic/44033-latest-tilezed-and-worlded-december-21-2021/
new tiles were also recently released that include the sprites for the curved roads https://theindiestone.com/forums/index.php?/topic/49081-latest-tilesets-feb-16-2022/
ok
Honestly I can't even figure out how to place a patch of grass.
most tutorials show this like pen you can use but i dont see it
You don,t build like other types of mapmakers. You use images and the program generates the grass water and roads, and zombie spawn rate
Worlded
hiow the hell do you damage a zombie?
So there are no map makers that are like WorldPainter for minecraft or something, this WolrdEd is more like MCEdit if you know what that is
I see why there aren't a lot of maps
#mapping is the channel where all the mapping experts post and where people can get mapping questions answered.
Asking mapping questiong in this channel is like trying to order sushi at a burger place?
I assumed making a map is a mod and mod_support at the top says to come here for that.
lol technicalities
It's not a big deal, and people direct people to the wrong channels constantly.
is my calculation wrong or are the weight to volume relationships in PZ for containers basically arbitrary? https://pastebin.com/zJT0ntnc
(you can run the code in any lua interpreter, like https://replit.com/languages/lua to get the values)
from the values I'm producing, the bourbon bottle should hold less water than a regular water bottle
Oh there isn't any rigorous internal logic or consistent weight to volume simulation in PZ items so much as that the values "were just made up as they went along."
Item weights, once you start looking at them, are bananas and all over the place.
OK, so it's not just me
I've written a mod that allows containers to arbitrarily store gasoline or water and now I'm tweaking it to have realistic weights and usage deltas
not sure if "realistic" is a good approach anyways
I mean, gasoline has a relative weight of ~0.75 so there's no reason not to use it
as for usage deltas... why not?
Does anyone know how to sync "dealing damage to zombies" in MP? Turns out if the code runs in server side, there is no way to send this change to client sides, and if it runs in clint side, the server and other players will not register the damage, cause de-sync. This problem is bugging me for days, anyone know if there is a solution to this?
yeah, do it on the client side
zombies that attack the player exist in a sort of "bubble" - namely, they are local to the client
(mainly so people don't get pissed off about dying because the server decides a zombie killed them with old data)
create functions on server & client side to send and receive the damage amount so other clients can update it
of course, there's nothing you can do about clients with shitty internet, it'll just be delayed by however long it takes for the packet to get through
does anyone knows a clean way to introduce a new body location which is rendered before all the vanilla locations? i would like to do that without overwriting the vanilla BodyLocations.lua. only idea i have so far is to backup the vanilla body locations, use a reset command to delete them all and then defining them again by prefixing the new locations but not sure if this is the best way to do this.
Check my personal version of BodyLocations.lua in my Dressing Time mod. It was planned to allow that and promote compatibility for mods using it
thanks! i'll have a look.
anyone has a quick fix for the MP mods?
Jans out here kicking out cop car skins 24/7 jeesus
I think that needs a better explanation
no explanation, just fix! now!
Anyone as any idea where the file/s that manages the credits displayed in the main screen is located/named?
(Searching it but not yet found )
Yo, I was looking around in the spawn settings for items in Brita's armor pack mod, I was wondering if someone could help me find out what the following numbers mean
Hello i was wondering is the guid text necessary if i am doing multiple items difference colors and textures?
@red jewel it's the spawn probability, higher values make something more likely relative to others
look at the base game's ProceduralDistributions to get a better idea
where would I be able to find that specific file
thank you very much
well, that'll narrow it down enough that a directory search will take less than a second
yes : )
I am still working on introducing new body locations and sorting them to get a correct rendering order. could it be the case that sorting body locations via code within the client folder does not affect the rendering order? i have some code sorting the locations which works as intended if I put it into the shared folder but if I put the same code to client, the rendering order is wrong (although the game runs without errors). any ideas?
Very nice !!
How would i go about making a mod that retextures vanilla clothes
I want to make a mod that makes the police uniforms brown like in the Walking Dead
Is there a reason why in someone's code they would assign a variable with local stuff = player.getVehicle and player:getVehicle() ?
That variable would be what vehicle a player is in if they are in one.
Yes, but why the and ?
this would likely error on the first part, unless it was local stuff = player.getVehicle and player:getVehicle() (note the lack of () on the first part)
Why not just local stuff = player.getVehicle or local stuff = player:getVehicle() ?
it's a typo on my part
ah, well the first part player.getVehicle checks if the method actually exists before trying to call it with and player:getVehicle()
its a safety check basically
that way incase for some reason getVehicle doesnt exist in the player variable (ie: it was passed a incorrect object that wasnt a IsoPlayer instance) it wont throw a exception
though its really a odd check, since it would have to actually be a table or some other java object...if player was nil or a number (for example) it would still throw the exception there
huh it entirely depends. lol player is just a variable. so depends what gets assigned to it
So it will get run on both client and server
well it's a function that gets added to the OnPlayerUpdate
So I guess player here will get the right index
How could I add more zombie outfits
Like say I want a zombie variant that always spawns with a duffle bag and an army helmet, how would I make this variant
@vivid flarethanks man
Search "ZombiesZoneDefinition.lua" in modeling section and read recent messages you have lots of info there
Anyone as any idea where the file/s that manages the credits displayed in the main screen is located/named?
I just want a trading mod that functions like true music’s style, where there’s the base mod that adds trading, then mods by other people that add support for specific modded items, while the base trade mod ONLY has vanilla items
to be fair, the one mod, currency variety mod, does exactly this
but I really don't like how it functions
I like having cash as a base for trades
Rn I think dingos trade mod has excellent balance, but it requires green fire and britas to function
Is there a mod that makes zombies decay over time? Like they start out great and then like 3 months later most of them are dead or really slow
@quasi geode @worldly olive I saw you guys had problems inserting data in the XPBoost HashMap. I ran in the same problem and I found a workaround for that. I don't know if this is going to be useful for you, but
- create a fake profession with
ProfessionFactory.addProfession - populate the fake profession's perk-xpboost with the method
addXPBoost( perk, newPoint ) - and then add the profession into player's descriptor
player:getDescriptor():setProfessionSkills( fakeprofession )
The only drawback is that when you insert a new profession in the descriptor, it clears the previous table. So you have to make sure to add the previous data in the fake profession's perk-xpboost as well
You don't have to worry about that anymore as in the 41.66 build a new function to do that is included 🙂
player:getXp():setPerkBoost(perk, boost);
My fellow Devs, I did a thing https://steamcommunity.com/sharedfiles/filedetails/?id=2759865696
Coercing userdata is pain
Oh good, I can't remove embeds on my phone, well shit, sorry for that
will this affect the functionality of the "old" command addXPBoost(....,...) in any way?
Nope, the addXPBoost adds exactly the same boost but through a trait, this is something that you can use mid-game to add that exact boost to the map
Both does the same in different circumstances
ah...ok... so.... the planned function is for IsoPlayer while the old one is for defining professions/traits...?
Yes, this is how you use it:
player:getXp():setPerkBoost(perk, boost);
are you sure setPerkBoost exists in public class XP
I only found getPerkBoost defined
You have a copy of 41.66?
let me see
I think you would know if you did, TIS would have given it to you
No. I'm using 41.65
Yeah, because the only people who have 41.66 would have received it personally from TIS
dammit. That could have saved me a lot of time
I mentioned this
This will be in the 41.66
Wait ~one week
I aware now. Thanks btw
wait. How do you guys know which changes in the API will come?
It is also included in the changelog:
- Added IsoGameCharacter.XP.setPerkBoost(Perk perk, int level). This is for mods that want to change an existing player's XP multiplier for a skill.
And as mentioned, this is the syntax
It is the same as getPerkBoost
Why does it not like this at all? It calls it a non-table and won't load the game
VehicleQueries.OnUse = {}
function VehicleQueries.OnUse(player, vehicle, ...)
local vehicle = player:getVehicle() or nil
if vehicle ~= nil then
print("Entered:" .. vehicle:getScriptName())
end
end
Events.OnUseVehicle.Add(VehicleQueries.OnUse)
Someone know how to get players when right click on the world, to add a context option to perform action on an other player. Like when we open the health check menu. I know the event OnFillWorldObjectContextMenu but where to find players that was here ?
i might be wrong, but should your inits for VehicleQueries use square brackets?
No
Apparently, OnUseVehicle is not something standard
I have to add it to the LuaEventManager first
yep i did it for the character bio mod
let me get the code
local clickedPlayer
for i, v in ipairs(worldObjects) do
local movingObjects = v:getSquare():getMovingObjects()
for i = 0, movingObjects:size() - 1 do
local o = movingObjects:get(i)
if instanceof(o, "IsoPlayer") then
clickedPlayer = o
break
end
end
end
worldObjects is the var passed to OnFillWorldObjectContextMenu
Nice, thx !
how do I require something in the server folder of the main game when my lua script is in the shared folder?
shared is loaded first so its already loaded or are you importing a module
Haven't done a mod in a bit, so decided to have some fun and did a silly craftable & fully functional sledgehammer mod
https://steamcommunity.com/sharedfiles/filedetails/?id=2760032629
what's the recommended way to generate a random number in a PZ mod? I tried calling math.random() but it throws an exception.
ZombRand --- my bad
ZombRand(10), for example, will generate a number from 0-9 (yes I know it's confusing 🤪 ).
thank you, that's just what I needed
👍
Upload my API to make simple UI:
https://steamcommunity.com/sharedfiles/filedetails/?id=2760035814&searchtext=
this is promising. I'll surely give it a try
you dont. theres a load order: shared, then client, then later server. last i checked the server folder didnt even exist on the path until after client is loaded (thus making any require statements impossible)
so can anyone tell me how to tell if a zombie is on the ground rather than standing up?
not dead, just knocked over.
Oh, I didn't know about the load order
No wonder I had to add the OnUseVehicle to the luaevent
:/
if zombie and NOTDEAD and ONGROUND then
-- do damage and spray blood.
elseif zombie and ISDEAD then
-- remove corpse and spray lots of blood.
end```
i need that NOTDEAD and ONGROUND and ISDEAD
but not sure how to get them.
likely from a mod user downloading it thinking it's a new toy
what mod?
Yeah, I just don't rly get why put a negative ranking like that, if you don't like, don't use
thumbs up and an award for you
Wait so how do you do it. Can you do it without needing to code
Or do I still need to edit it in an editor
There is an example in the same folder that adds my new locations
Do I just need to change file text then. Or like what. I can do text files
A lua file
I modded song of syx a lot. Still need to upload it im bad at that
Ah. Maybe I can private message you if I have trouble. I can't look rn. But you said it was in the mod folder right?
Hello. Can someone help me with this? Im learning how to make mods I watched Blackbeard's video on how to make the soda bottle and i figured out how to copy and paste a bunch of other stuff together. Now im trying something different and have created a recipe that calls a function that spits out a few lines of text. Ive got it to work but what im trying to do is get a pause before each line of text is said over the players head. The same way it does for the TV and Radios. Ive looked at the radio code in the PZ files and its a bit more complex then im capable of at the moment.
@drifting ore you should make a simple mod that requires your api. that was people can use it as a base.
😄
What you're suggesting to do is a bit more complicated.
The ways this are normally done is through some kind of callback attached to an event.
The event occurs, and it'll execute the callback (your code that says something).
I don't know enough about what events PZ provides, but there's a chance you need to make your own event.
A really simple way to do this is to create a timer either via a task or coroutine or thread or something, that executes your callback when the timer elapses.
Only issue is I don't know if lua is sophisticated enough to do that. I know Java can, so it's a matter of figuring out how to get the lua to call into the java runtime and execute some code.
Ultimately, it may be a pretty in depth undertaking.
Somebody who knows this codebase better might entirely negate everything I've said though
zombie:getCurrentState() == ZombieOnGroundState.instance(); this worked. zombie:isDead() this did not.
@jagged fulcrum
@signal frost Yeah thats more then what im capable of.
damn that is brutal sounding lol.
it goes BRRRRRRRRRRRRRRRRRR when you sit on a zombie.
but no dmg. and i want bloods everywhere.
zombie:Damage(zombie:getMaxHealth() * 0.9) does not dmg like i had hoped it would.
zombie:splatBloodFloorBig() ALSO DOES NOT SPLAT. ugh
sigh.
zombie:Damage(zombie:getMaxHealth() * 0.9) does not damage, and throws errors. i just want it to yeet blood everywhere and hurt the zombie.
*yet 😉
Does anyone know if the OnClientCommand event gets triggered for all clients on a server? For instance if one client calls sendClientCommand() do all clients call the function passed in the arguments? I'm having issues having a client action inform the server to have all clients perform that same action.
My goal is to have each client create a lightsource to attach to a cells lamppost. Currently only the client who performed the action creates the lightsource so others cant see it.
I think I have to make use of OnServerCommand? Have a client inform the server of the action and the server sends out a command to all the clients to do the same behavior?
Yes.
grrrr
@eager trail you need a periodic event
local function createPeriodicEvent( frequency, delay, callback, args )
local EVENT = {}
EVENT.frequency = frequency
EVENT.delay = delay * 60
EVENT.count = 1
EVENT.callback = callback
EVENT.args = args
local run = function(ticks)
if ( ticks % EVENT.delay ) == 0 then
EVENT.count = EVENT.count + 1
EVENT.callback( EVENT.args )
end
if EVENT.count > EVENT.frequency then
Events.OnTick.Remove( EVENT.run )
end
end
EVENT.run = run
Events.OnTick.Add( run )
end
You can use it to say "Hello" 3x separated by a 1 sec delay
local function saySomething( phrase )
getPlayer():Say( phrase )
end
createPeriodicEvent( 3, 1, saySomething, "Hello" )
dang it. it sucks when someone puts you on the right path and vanishes lol.
omg... it id doing the zombie:splatBloodFloorBig() but it's just a tiny puddle
i want SPRAY!
Hey all, new to Project Zomboid modding and also new to Lua. Would anyone be able to tell me how i can select the right item from a table via its class?
Eg, I have a table of
1 - zombie.iso.IsoObject 2 - zombie.iso.objects.IsoWorldInventoryObject
but i cant figure out how to select the inventory object
I have tried
for i,v in ipairs(items) do if instanceof(v,"IsoWorldInventoryObject") then mycodehere end end
But no luck there
me and zombies aren't doing to well either
ARGH i need blood spray!
?
@daring palm Thanks for the reply. Not sure how to get this to work. I copied this to my file and its crashing at this line. Also i need it to say 3 to 5 different lines of text with a 3 or 5 second delay in between. Am i supposed to copy and paste
createPeriodicEvent( 3, 1, saySomething, "Hello" ) the amount of times i want and adjust the numbers as needed?Sorry am noob.
if instanceof(v,"IsoWorldInventoryObject)then
That is missing a ".
@undone crag Sorry that was a quick rough type up of what i have tried, not the actual code block. I have been at this for 2 days
i have also tried "zombie.iso.objects.IsoWorldInventoryObject"
corpses dont count as zombies so yay
okay so i found them static moving objects. yay for oxymorons
youd have to run it on every tick and keep track of how many ticks have passed
i had to do it to get around media not playing in multiplayer
blue = zombie:splatBloodFloorBig() i want more of the green than the blue. i want sprays
that feels like the blue splatter is not being given any x,y,z speed for the splatter effect and all the blood is getting dumped in one place
other similar code like https://zomboid-javadoc.com/41.65/zombie/iso/IsoFloorBloodSplat.html
Javadoc Project Zomboid Modding API declaration: package: zombie.iso, class: IsoFloorBloodSplat
have floats for xyz
okay... would that not just be the position?
i mean if you can tell me how to make the come from under my character and shoot out 90 degrees to the left. you would be a god.
to my right.. sorry
is there a way to reload a vehicle lua ingame?
what about this one?
https://zomboid-javadoc.com/41.65/zombie/iso/objects/IsoBloodDrop.html
Javadoc Project Zomboid Modding API declaration: package: zombie.iso.objects, class: IsoBloodDrop
how would that be used though lol
a bit out of my range, sorry
owait, that's wrong
public class IsoBloodDrop extends IsoPhysicsObject {
public float tintb = 1.0F;
public float tintg = 1.0F;
public float tintr = 1.0F;
public float time = 0.0F;
float sx = 0.0F;
float sy = 0.0F;
float lsx = 0.0F;
float lsy = 0.0F;
static Vector2 temp = new Vector2();
public IsoBloodDrop(IsoCell cell) {
super(cell);
}
inb4 blood geyser because of test numbers
float sy = 0.0F;
float lsx = 0.0F;
float lsy = 0.0F;
what are thoooose?
not entirely certain. i remember seeing someone talking about it with teleport stuff, but can't recall the details. some coordinate trickery
now i've got Blue Danube stuck in my head.
wait an iso object... that's what i would detect. not what i created.
is there not an IS coder that hangs out here?
I'm trying to make two traits that are opposites, for example one is "Big" and the other is "Small", both of these can be enabled though which obviously doesn't make sense. The vanilla game handles this by removing the opposite when one is enabled, so grabbing "Overweight" removes "Fit" from the list, how can I do that for modded traits?
theres an exclusive option.
taht you can make it here it can't be used with the listed traits.
if i remember correctly.
isCorpse:removeCorpse()
how the hell do i get rid of a corpse if none of the commands work?!
-- corpse removing
local corpse = square:getStaticMovingObjects()
for index=0, corpse:size()-1 do
local isCorpse = corpse:get(index)
if instanceof(isCorpse, "IsoDeadBody") then
print("Dead go Splat!")
print(corpse)
isCorpse:removeCorpse()
vehicle:playSound("mower_fatality")
end
end
the Throw Them Out the Window mod comes to mind, maybe you can glean something from that?
uses timed things
but is an idea
self.character:getInventory():Remove(self.corpse)
nvm lol
that's how they do it is remove it from inventory.
oh, does the mod have you pick up the corpse first?
yeah you gotta pick em up to throw em out the windows lol.
ah, sorry
hey at this point... ANY idea is a good idea.
isCorpse:removeFromWorld() doesn't give an error, but... doesn't remove it either.
soooo... other than the blood... it's done.
and i want a MONSTER blood splat. where are those set at?
addBloodSplat(sq, 15); there are in the scenario luas.
10.12.17.13.15. those are the only types listed.
or used at least.
hello all, been spending the last couple days learning all i can about PZ modding, but have run into a few snags if anyone has a moment to help.
I'm having trouble understanding how to implement some things like Event listener functions and executing functions from the GlobalObject fom within Event functions.
this channel has been mostly me talking to myself lol.
how do I print values? I'm used to using lua print("This value is: " + valueInt) but that is giving me an error
print("This value is: ",valueInt)
Alright, thanks
I was going for a basic goal of sending chat a message when a player joined the server. I tried something like this in my client lua ```local function announceArrival()
processGeneralMessage("...has joined the server.")
end
Events.OnChatWindowInit.Add(announceArrival)```
or with OnConnected as well
but i get Caused by: java.lang.NullPointerException: Cannot invoke "zombie.chat.defaultChats.ServerChat.createServerMessage(String)" because "this.serverChat" is null
addBloodSplat(square, 17)
addBloodSplat(square, 15)
addBloodSplat(square, 13)
addBloodSplat(square, 12)
addBloodSplat(square, 10)
``` the red circle is ALL of those.
they are ALL the same.
AddBlood
public void AddBlood(int wx,
int wy)
addBloodSplat
public void addBloodSplat(float x,
float y,
float z,
int Type)
where would i find where those types are defined?
I made a mod that replaces typical book titles with 'lore appropriate' versions
https://steamcommunity.com/sharedfiles/filedetails/?id=2760417215
LOL
How do you name/call a lua table with only numerical key (using table.insert) ? And a table with string as key (using table["key"]=value) ?
A numerical table ?
okay in what way?
if you don't give it a string key you will only retrieve it by a number. myTable = {}; table.insert(myTable, 3.14); table.insert(myTable, 42);
@drifting ore you mean you want to insert a value at a specific place?
table.insert(table, X, value)
where X is the number to insert it at, values are shifted, not overwritten
you can't shift non-integer keys, you'd have to do 2 assignments
table.newKey = table.Key table.Key = newValue
i wish my stuff wasn't so engine dependant 😦
what?
trying to make blood spray where i need it to.
but i can't even create it correctly.
i want something like the green area,
sounds like something you'd need to do in Java, I don't think Lua has quite that much granularity exposed to it
this is the best i can get lol. and it's with a mod.
No I mean, is there a term for table with only numerical key from 1 to x (I call it a vector or 1D array). And a term for table with only string as key ? Maybe there is not
and it was actually 3 zombies in tht shot.
the one on the bottom side is the size that it makes.
@drifting ore no, Lua doesn't care, there are only semantic behaviours
e.g.ipairs() will ignore non-numeric keys and stop if there's a gap
Yeah I know that everything is table, there was maybe just a name for this type of table
I suppose you can informally refer to it as a pure array table
addBloodSplat(float, float, float, int) - Method in class zombie.iso.IsoChunk
AddBloodToMap(int, IsoChunk) - Method in class zombie.VirtualZombieManager```
if it has contiguous indexes starting from 1
i use addBloodSplat
the only things I can think of that only work "properly" with a contiguous array table are ipairs(), the # operator and unpack()
although you can exploit that fact to include additional data that you don't want to iterate
using ipairs/#/unpack on {1,2,3, x = 5} will produce identical results to {1,2,3}
Now, that's interesting! 🤔
heh, well you could equally use the __index metamethod too, but the former is a bit faster to execute
e.g. setmetatable({1,2,3}, { __index = {x = 5})
IsoMovingObject has a Move function that takes a Vector2 - I don't see why not
if i could create a few of those with different velocitys.... i think that would be what i need.
you might want to use setNx and setNy then, the Move function applies the game's time to determine how fast it should be
doy ou know of a mod that does something like that?
nope, I'm just reading the code
Tracked down the problem of cheat menu having errors to my wallet mod
Item also no longer appears in inventory in previous saves where I had it
Anything wrong with this code?
It was working fine yesterday, I changed the weightreduction from 10 to 1 and went to bed. Woke up and the problem started.
There's no module for your item, module [BLANK/NOTHING]
I mean, don't literally use "module [BLANK/NOTHING]", but you likely need a module defined for your item to work properly.
So do I type anything in there or is there a specific type I need to use? I've made some other items and they work fine with the module blank.
Huh, well, I don't know? I don't have any experience with items without modules, but the whole engine is designed around items having them?
Maybe it's automatically assigning module Base to your item.
But I'd suggest getting in the habit of using modules to avoid any zaniness that this may be responsible for.
Myself, I use module Base for almost everything, unless I have a reason to do otherwise, in that it overall, for most purposes, makes things "simpler".
disgusting 😏
Modules are basically namespaces, use them to avoid conflicts
I always use them, to avoid overlapping with shit injected by people like you 😛
@eager trailthe createPeriodicFunction function is working fine because it uses no global variables whatsoever. There must be something within your code.
I'm going to provide you an example related to what you want
- create a list of phrases to be said
local moods = {
'good',
'bad'
}
local saying = {
[moods[1]] = {
"Today I feel bad",
"It looks like I'm going to",
"DIEEEEEEEEEEEEEEEEE"
},
[moods[2]] = {
"Beautiful day",
"I think I'm going to relax"
}
}
- create the callback function
local function saySomething( args )
local phrase = args.phrases[ args.index ]
args.index = args.index + 1
getPlayer():Say( phrase )
end
- invoke it
local whichMood = ZombRand( #moods ) + 1
local mood = moods[ whichMood ]
local phrases = saying[ mood ]
createPeriodicEvent( #phrases, 3, saySomething, {phrases = phrases, index = 1} )
Pastebin, please
sry
also, why wouldn't you just write sayings = {good = {<stuff>}
it only makes sense if you're iterating or the values are known only at runtime
not a proficient in lua. That's a good advice though
Added it but I'm still getting errors
Possibly unrelated, but if something is module Base, you don't need to import Base and such.
don't put it in base, and at the very least, don't import Base from Base
If nothing else, there will be "warn" messages in console about "Module Base imports itself" which will have people who are combing their console logs trying to fix their servers and such coming to you about the message.
I hope from the sentence itself it is apparent why that is nonsensical
just don't put your stuff in Base, there's absolutely no justifiable reason to do so
What should I put it in?
it's arbitrary, whatever you want
module MyCoolAssMod
Ohhhhhh
just don't choose something that already exists and is used by something else
A good bet would be whatever your mod's ID is
^this
Should I still import base or remove that part? Module is currently "WAL"
well if it's not base anymore, importing doesn't hurt.
Generally imports are used for purposes such as making recipes inter-module compatible?
However, you can also include the module prefix for items in recipe scripts and not import. Not that there's any reason to, really, since import exists but it will work.
if any of your stuff relies on something in Base, yes, if not, no, doesn't really matter if you import it anyway, though.
unless you really want to name an item the same as something already in Base
what doesn't work?
Cheat menu giving me errors when opening the item spawner and the item vanishing on previous saves that I had said item on
What errors
items will vanish because the original module + item id no longer exist
Sounds like you have more going on than just that simple script file
It just shows a red error msg in the corner
Press F11 or open the console log
HMMMMMMMMM idea.
i wonder if i can FAKE a spray
addBloodSplat(square, index)
end```
i wonder if i can get that to start small and go to the right of my character increasing in size.and going out a little with each iteration.
it would LOOK like a spray
just WAY bigger.
@zinc token I don't know what cruciblecore is, but it has broken code
Hmm, odd. If I disable the wallet mod item spawner works fine. I only have CheatMenu, 2 of my other mods and the wallet mod installed when it happends
I also have no clue what cruciblecore is either
Try removing the DisplayCategory value
item spawner breaks for anything basically and I think there are no text entries for that category
Nope, still get an error/spawner not opening
addBloodSplat seems to have access to the RNG variable zomrand from some of the code i've found in the lua
addBloodSplat(x+0.5, y+0.5, z, ZombRand(20))
yeah that's changes the index.
but i do each of the index in that and they are all the same.
notice they are all the same just stacked.
yeah
that's what i am doing now.
it would LOOK like a spray
HMM
sooo it sort of works?
but it needs work.
if it ends up making to much blood you could add a condition on top and make it create blood if a random number is hit
this should add more variance to the splatter
is it even possible to follow the rotation of a vehicle now that i think about it?
yes
my detection square is always infront of my vehicle.
dm'd you a pb of what my lua looks like.
85-91 are where i am trying to fake it.
have tried printing those
and see how they change
during driving?
the x y coord
what the newx and newy are? or xxx or xx?
yes the numbers you get
see if they are updating like you would expect
once the car starts rotating
well again... which variables?
newx ,newy since those are the ones for the blood right?
well those are only created when you hit a corpse
Well it's not part of the game so obviously it's a mod you have enabled
i dunno why it is only making it go one way the math atleast for me adds. you are calling your deltt and adding it to the coords
I fixed the cursed wallet
Turns out the Mod ID "WAL" is already in use and upon changing it, it worked.
I'm amazed at myself on how it took me 2 hours to figure this out
lol might i say... i suggested one earlier LOL
I must've missed it, WAL is probs in use for some wall tile mod or something
What MP mod are people using for locking player made doors and gates? We had one on the server I'm on, but it vanished from workshop... (Sorry if wrong channel)
that looks like decent splatter
sigh.
this is the closest i can make them. i wish they could be closer... but the angle is WAY more important.
Question How does one create a custom category for an item?
I'd like for, lets say, an ID card to have "Documentation" next to it instead of "Literature".
This is an example of a custom display category I use in an item script
item 100_DollarBundle
{
DisplayCategory = Money,
Weight = 1,
DisplayName = Bundle of $100 Dollar Bills,
icon = PA_BillBundle,
Type = Normal,
WorldStaticModel = PA_BillBundle,
StaticModel = PA_BillBundle,
}
And here is the IG_UI_EN.txt file I have in \media\lua\shared\translate\EN
IGUI_EN = {
IGUI_ItemCat_Money = "Money",
}
https://pastebin.com/X9MwsWEa lines 85-92, how do i get the to come out 90 degrees to the right of the vehicle? and more varied art would be nice too.
if one of those rednames has an idea how to do the blood chunk that spawns blood that would be WAY better but this is what i have.
Anyway to change the type of the item aswell so I can add the type to a keyring-like container?
Is this a new item or an existing item?
KeyRings accept Key category items, but that category is problematic in that when any Key-category item spawns in a container, it will be made into a door key for the building that container is in, if any.
New Item
Example;
OnlyAcceptCategory = Documentation,
And changing the category item also changes how the game engine handles it, what parameters it can have, etc.
Oh, I don't believe that you can make new item Categories; new Display Categories yes, but the actual item Categories are hardcoded in java.
1 second, I'll show yu something
This item used the AcceptItemFunction parameter to dictate what kinds of items it accepts; my custom lua Accept_Wallet function is used to determine if an item can go into it.
item Wallet_pa
{
Weight = 0.2,
Type = Container,
DisplayName = Wallet,
Icon = Wallet_01,
StaticModel = Wallet,
WorldStaticModel = Wallet,
Capacity = 1,
AcceptItemFunction = Accept_Wallet,
}
And here is a simplified version of the lua code I use
function Accept_Wallet(container, item)
local iType = item:getType()
if iType == "Meth" or iType:contains("Baggie") then return true end
local weight = item:getWeight()
if weight > 0.1000001 then return false end
return item:getDisplayCategory()=="Money"
end
I have the weight check so heavier Money DisplayCategory items, like my bundles of bills, cannot be put into the wallet.
So you could have AcceptItemFunction = Accept_Documentation as a parameter for your item, and
function Accept_Documentation(container, item)
return item:getDisplayCategory()=="Documentation"
end
Hmm, which .txt would the function code go in?
It would have to be in a lua file in one of the lua directories.
Just a text file with the above code in it, but with .lua instead of .txt at the end. Probably any of the Client, Server or Shared lua directories would work, /media/lua
Thanks, works perfectly! Now people can't shove whole books into their wallet 🙂
😄 👍
It's super disappointing that discord is used to share all this information
because it's literally impossible to read all of this and a ton of important info is missed out on by 99% of people interested because its posted in here :/
The only thing I can find on search engines is a bunch of scattered documents either pointing here or a forum post from 2013, in no way detailing the most up to date methods. Half finished github readmes and wiki entries
COME OUT THE SIDE DAMN YOU! NOT STRAIGHT DOWN!
Ultimately it's up to the people who are willing to create guides and resources to create them; we're attempting to have a centralized repository here, but it's up to the community to contribute to it.
https://pzwiki.net/wiki/Modding
But also, the current build of PZ is definitely not the PZ that will be 1.0, a lot of this stuff may be obsolete by then. I'm not sure that many comprehensive guides would have a shelf life with that in mind?
There's multiple things that change different aspects of modding in the patch notes for the upcoming 41.66 build.
There's a constant flow of information in here that is swept upwards into the abyss that will only exist for that single conversation, no one else that could use that information will find it. Important tidbits that could be useful to everyone, things people didn't even know they might need are lost in here. If you're lucky enough to find it in the search feature, it's spread between half broken conversation or ignored.
In a forum at least the most relevant information is pushed to the top
Discord isn't a replacement for forums
The only way that situation gets better is for people to write out their findings in a more concrete medium
It's a chat room
So I have helped MrBounty update his docs on UI window creation, and I plan to flesh out the Translations text file explanation as well
Think about how many people could actually help write in those mediums assuming they could at least search on Google ya know? I'm just saying we should make more of an effort to keep the forums up to date
There is no up to date information on modding on that search engine
Everything dates back to at least 2015*
Yeah that
That's great, it's a great starting guide
for starting off
setup your IDE and here's the docs, but it's not living documentation that stems from user interaction
"Hey, is there a better function I can use to call http endpoints? I'm doing so and so but seems buggy, anyone got advice?" "Yeah! It's this function: and you can do so and like this" vs "heres the java docs and lua events listt"
is there a function to get the actual time in a precise moment like os.clock?
it's a great wiki, and im happy to have it
damn see that
but no one else is going to have an answer to what that guy is asking, what he just asked for will disappear upwards
I already searched in different places, even in the game code
Well if you have any proposals or concrete suggestions to encourage people to utilize the forums as some sort of centralized modding repository, I'd suggest bringing them to @iron salmon as they're the community manager? I'm just a channel janitor.
Funnily enough I just noticed your the creator of the same money mod we're using on for a server I'm devving for
Which the upgraded wallets I'm making for my ID pack are expanding off
Small world eh?
I know I was just hoping to open a dialogue about it
Try this
local gTime = getGameTime()
local timeOfDay = gTime:getTimeOfDay()
print("Time of Day " .. tostring(timeOfDay))
Haha, glad to be of help.
I think it would be cool to start encouraging people to also make a post on the forum with the question they'd asked. If they're willing to do it, that would be better than not at all. Someone could just copy and paste a reply. That's just an idea
Thanks! i'll try
start consolidating information there at least, most up to date stuff as of 2022, links to the wiki, other resources that are scattered from the steam forums, to reddit and other places
Yeah, some people started collect resources about modding. Maybe need complete this on pzwiki
sigh.. still straight down. but it makes for fun screenshots.
I got a question about UI. I'm injecting a button into ISCharacterScreen.render function.
The button renders fine, but the click action doesn't work. Does anyone have some idea why? Here's the injecting code
function ISCharacterScreen:render()
original_ISCharacterScreen_render(self)
local w = 75
local h = 30
local button = ISButton:new( 300, 200, w, h, "My button", self, btnclick )
button.internal = "MYBUTTON"
button:initialise()
button:instantiate()
button.borderColor = {r=0.7, g=0.7, b=0.7, a= 0.5}
self:addChild(button)
end
That would be a great start, but just asking if the person who popped a question in here if they'd mind posting it on the forums too, and maybe get a Discord bot and channel that acts like an RSS feed for the mod forums would also be nice. It would encourage forum engagement
this doesn't seem to work, I need a function that returns the actual world time in seconds every time I call it, like os.clock
I think need add button not in render function. You create new button each tick
getTimestamp() return current time in seconds
The wiki is solid but it should be maintained by trusted people, where the forum should contain caveats and off the wall information from whatever people need to ask about, it would allow all this information to be search indexed
anyway i'll stfu now
I need something more precise, like nanoseconds
to measure the time elapsed since I called a function
Only Ms exist:
getTimestampMs()
Hi peeps, is there a way to make a recipe possible with one of the items being on the floor?
Here's an example
recipe Disinfect Rag
{
destroy RippedSheets,
WaterSaucepan;10,
CanBeDoneFromFloor:true,
Result:AlcoholRippedSheets,
Time:100.0,
Heat:-0.22,
Category:Health,
}
you were right. I created it inside :create function and it's working now. thanks
Is Zomboid on JDK 8 or 18
Thank you Blair, also thank you for the fantastic Base mod for Toxic fog which soul used for our Toxic zones!
np! Glad you enjoy suffering through it 🙂
hahah they really arent on the server but whats life without challenge
Thanks! that could work
java 15
thanks
Poop?
hello, i am trying for a basic goal of sending chat a message when a player joined the server. I tried something like this in my client lua cal
function announceArrival()
processGeneralMessage("...has joined the server.")
end
Events.OnConnected.Add(announceArrival)
but i get Caused by: java.lang.NullPointerException: Cannot invoke "zombie.chat.defaultChats.ServerChat.createServerMessage(String)" because "this.serverChat" is null
What am i doing wrong?
Oh lmao, the blood is dark enough where at a glance it looks like 💩
Maybe because processGeneralMessage must be on server side
well the weird part is i can get it to work in other client side events. like OnGameTimeLoaded i can call processGeneralMessage
that is from the client lua
better?
Then serverChat is not init at moment of connect. Need wait when GameTimeLoaded. Why not use OnGameTimeLoaded ?
i just want it to come out the side the that no matter which way it's facing.
it's ALWAYS down.
i think OnGameTimeLoaded only loads once per server start right not each time a player connects? not sure
Isn't facing angle one of the parameters it accepts? I have not read what you posted before but I guess you're the one supposed to give it an angle
Would anyone know how to make a universal storage system?
Example;
I'd put something into an ATM Storage box in Rosewood, drive to Muldraugh, go into the ATM there and see the item I placed in Rosewood
since it would interact with the gore settings in sandbox mode.
i had to cheat as i don't thinkl those are accessible.
but PLEASE prove me wrong lol.
https://pastebin.com/X9MwsWEa lines 85-92 is how this is mde.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Better
Cant wait for the new happy wheels mod
lol its super close.
if i can get the spray to go the right direction....
then it's party time.
then we'll go all the way.
I wish one of the red names would step in and say "oh hey here's the fix to that. this will make blood spatter just right."
and then provide code. XD
They have a long ass list of modder wishes and dreams, so tuck in for the looooooong haul
hahahaha
well if i can figure out why my code the reads the front of my vehicle wont spew blood out the side... i'd be happy too.
Anyone know a way to set a mag to be full via a recipe by chance?
Is it reading the front of the vehicle relative to the vehicle
Or to the world
Cus I imagine the vehicles orientation to the world isn't like
Dynamic
Idk vehicles are weird
everything i use is in the pastebin.
Hello, I am creating a clothing mod and for an outfit that is only placed on the shoulders, I do not want the "BloodLocation" to be placed on the lower torso, do you know what this category is called?
Without looking anything up, I'd say it's likely just UpperTorso?
I tried to try it, but it didn't work.
Huh. 1 second
UnderwearTop might work; from looking at the vanilla clothing scripts it looks like Blood Locations uses the Clothing Body Locations.
anyone familiar with creating chat messages programmatically? having problems finding a way to do so with the Events system
more specifically i want to create a chat message upon user conn/dc from the server
I tried something like this in my client lua
processGeneralMessage("...has joined the server.")
end
Events.OnConnected.Add(announceArrival)
but chat is not available yet here i guess.
I've tried numerous other events but none seem to work for what i need. If anyone has some insight i would be greatly appreciative
Here is a super simple example, I'll leave it up to you to flesh it out and complete it.
- The important thing is the
OnCreatepart of your recipe; example recipe:
recipe Fill Magazine
{
9mmClip,
Result:9mmClip,
Time:20,
OnCreate:Fill_Magazine,
}
- The above code needs a lua file in one of the lua directories with this lua function in it;
media/lua/serveris where the vanilla recipe lua code is for example.
function Fill_Magazine(items, result, player)
result:setCurrentAmmoCount(result:getMaxAmmo())
end
Sorry, I did some digging, and this appears to be the list of BloodLocations for Clothing Items.
Jacket,
LongJacket,
Trousers,
ShortsShort,
Shirt,
ShirtLongSleeves,
ShirtNoSleeves,
Jumper,
JumperNoSleeves,
Shoes,
FullHelmet,
Apron,
Bag,
Hands,
Head,
Neck,
UpperBody,
LowerBody,
LowerLegs,
UpperLegs,
LowerArms,
UpperArms,
Groin;
thanks, I think if I can do it with this.
👍
wanna take a look at mine blair? you seem to hit it on the head for everyone else lol.
i just wish there was like a "debug.drawline" or something.
so i can see where that code is pointing
Sorry, that's not anything I have any experience with?
All this other stuff dovetails with my own work.
lol was worth a try XD
me and some friends are extremely new to project zombiod is there any recommended special infected mods that can help spice up the game?
terrorzeds but it's went awol.
awol?
absent without leave.
can you link something that is still good? or??
no where to find it.
well is there any other special infected mods?
authenticz
can you link it?
Morning all, starting day 3 of trying to figure this out. Would anyone be able to tell me how i can select the right item from a table via its class?
Eg, I have a table of
1 - zombie.iso.IsoObject 2 - zombie.iso.objects.IsoWorldInventoryObject
but I cant figure out how to select the inventory object
Can you provide more context on how the table is generated in the first place, where it's being invoked, etc.?
Im getting it from a grid square that i get from the context menu location. Im trying to interact with inventory item on the ground but when iterating i get errors because i dont know how to ignore the IsoObject in the iteration
local items = square:getLuaTileObjectList()
Have you taken a look at ISWorldObjectContextMenu.createMenu?
Perhaps more importantly, ISWorldObjectContextMenu.fetch
There's a ton of code in there that has to do with figuring out what sort of object is being handled
I see lots of calls to instanceof
I have tried quite a few different intanceof variations with no success thus far.
I havent looked into ISWorldObjectContextMenu, I cant seem to find a reference to it anywhere. Im using https://zomboid-javadoc.com/41.65/ and jd-gui on the decompiled code as my references, am I missing something here?
Javadoc Project Zomboid Modding API package index
Are you only looking in the Java code? I found ISWorldObjectContextMenu.lua under <ProjectZomboid install dir>\media\lua\client\ISUI
Yup, just added the media folder to my references and up it popped. Feel a bit stupid on that one, at least I have a lot more to work with now. Thanks for the help, I knew it would be some simple mistake.
No worries man, I'm coming at it from the flip-side of you. I've done a lot of digging in the lua but basically no work getting set up to look at the Java and dive in.
who would be the best person to poke at for that spray angle thing?
like... whos big daddy lua?
or big mama..
Hey there! does somebody knows if there's a way to change the isValid for the ISClimbSheetRopeAction.lua that applies for both the option in the context menu and the button E? The changes that I make to that function only applies for the "Climb" in the Context Menu but doesn't apply if the player press E 🤔
okay question... can i spawn an object and then MOVE it on update? if so how?
Can you provide a little more context? How are you operating on it currently?
My guess is that if you somehow manage to disable temporarily IsoFlagType.climbSheetTop[X] from the target IsoSquare/IsoWindow, the method canClimbSheetRope will fail for both: button E and context menu.
Now since you're already injecting the context menu to provide your custom logic, you can also add a keypress event on E to inject the very same logic, bypassing the canClimbSheetRope.
E uses are controlled by java, I don't think there is anything you can do about that
Basically trying to override the isValid with this:
function ISClimbSheetRopeAction:isValid()
if not player:HasTrait("Obese") or not player:HasTrait("Very Underweight") then
if self.down then
return self.character:canClimbDownSheetRope(self.character:getCurrentSquare())
end
return self.character:canClimbSheetRope(self.character:getCurrentSquare())
end
end
If I do this I can avoid a player that has the trait "Obese" to climb the rope sheet if it is done using the context menu but I can't avoid the player to climb by pressing E
I'm actually overriding the vanilla function, simply adding a new validation
Damn...
but the vanilla function won't work because it's only appliable to the context menu action
Have you tried to disable the flag on IsoWindow to force the java function canClimbSheetRope to fail?
I think Ive made something "similar" with IsoFire
I've changed the flag of a square to "water" to never flame a specific spot I wanted to
and it worked
Hmmmm, not sure what you mean 🤔 sorry I haven't done much things that are not related to IsoGameCharacter, I have been mostly with that
There are flags associated with some "objects" like IsoWindow and IsoSquare
lots of java functions test those flags to perform an action
you can manipulate those flags
if you erase the flags like climbSheetTopW, climbSheetTopN ... associated with the IsoWindow, then the climbing function will fail always even though thereis a sheet rope there
this is good because now you can apply your custom logic bypassing those checks or replicating them accordingly
to make things less complicated, I'll tell you my problem. Basically speaking, I wanted to make a specific square not flammable. The problem is that I can't change the IsoFire class because it is java coded. However, I can manipulate the flags so that the IsoFire fails while checking to flame the spot
It's an indirect way to achieve what you want
But, my question is, if you do that, you can decide when it is valid and when it is not? I mean, you say "then the climbing function will fail always even though thereis a sheet rope there", the "always" word is the one that makes me doubt
you got control over the context menu. So you're placing your logic there. You can return true
as you're doing
since it fails, you can now have the opportunity to KeyPressedEvent on key E and execute the action
but you'll need to check at least if there's a sheet rope in front of you
and execute player:climbSheetRope or player:climbDownSheetRope
Hmmmm, interesting, will take a look at that and see if the effort is worth it
Thanks for the suggestion
yeah. It's much more complicated to the IsoFire thing, but I think it's achievable
is it possible to reload vehicle luas without restarting PZ?
how do i start making amod
okay, in need of the assistance here... how would i create a 3d object (not a sprite) and then save that object to a variable that i can then move as needed.
can anyone help me figure out how to use something like (from the javadoc) zombie.network.GameClient.sendWorldMessage in LUA. I'm having a hard time understanding how to use anything from javadocs other than what's exposed from zombie.Lua.LuaManager.GlobalObject
local deltt = {}
deltt[1] = math.sin(math.rad(angle))
if math.abs(vehicle:getAngleZ()) > 90 then
deltt[2] = -math.cos(math.rad(angle))
else
deltt[2] = math.cos(math.rad(angle))
end
local xxx = vehicle:getX()
local yyy = vehicle:getY()
xxx = math.ceil(xxx + 0.01*deltt[1])
yyy = math.ceil(yyy + 0.01*deltt[2])```
would this NOT get directly ahead of me by 0.01? and if so where doe it lose the angle?
yo skiz how long have you been asking questions in here?
are there better times or days? seems pretty dead
it usually is.. but sometimes it helps my brain to ask the abyss.
the groups that i COULD ask for help hide behind paywalls.
how do i make words appear over a characters head?
that's how my angle code works.
getPlayer():Say("Hi") ???
there are better times for sure. I've got lots of replies
so my angle works.
but why is it not spewing out he right WAY?!
ugh
hotdog, would you mind checking out my pastebin?
all the blood id going at the same angle. straight down
if i;'m going in the direction of blue. the blood goes the green path when it should go red path. the problem is... it does that on ALL directions.
Have you printed the generated values to confirm they are what you expect?
yeah but they al;ways say the same when they SHOULD change.
did you printed the number from the cutting square?
is that portion working?
?
if i remember that code was also used in your portion for detecting the cutting square?
and that was working(?)
wit cuts the grass fine.
but does the number do a 360 when you turn since you are using the angle of the car?
no
0-90-0
or 0 to -90 to 0
okay soooo,.... i THINK i might be on the right ISH track
Is the car turn in radians? Does it use quaternions or something else?
Because the math can be very different
One more thing, you might be grabbing the wrong axis if it always goes the same way.
Say, roll & pitch instead of yaw
https://pastebin.com/X9MwsWEa lines 85-92
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
You could make it spit out the values, then in debug rotate the lawnmower with the car debug
well i have it so if delta1 is 1 it srays in front of you. but delta1 = 0 and the blood goes no where.
https://pastebin.com/Bvqeerpg that's the new version.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
print("D1: ", math.ceil(deltt[1]) ," -- D2: ", math.ceil(deltt[1]) ," -- A: ", math.ceil(angle) , " -- X,Y:" , math.ceil(xxx) ,",", math.ceil(yyy) ," -- ax, ay: ", math.ceil(vehicle:getX()),",",math.ceil(vehicle:getY()))
i call ALL of the relevant variable there.
i mean i could stream if you want o see it?
and to the wind they go! lol.
I assume ISOMovingObject is what cars are?
what line?
Not in your code, just in general
Because it has some potentialyl interesting methods, such as "getFacingPosition" "getFutureWalkedSquare" and "getHitDir"
Either way my personal intuition when it comes to dealing with angles is that it's usually better to use build in matrix/vector classes to handle it for you. You get a position vector and add direction vector multiplied by velocity, voila.
well i have those.
local angle = vehicle:getAngleY()
local xxx = vehicle:getX()
local yyy = vehicle:getY()
position and angle
no idea how o add 45 degree to the right.
It'd be something like, newPos = oldPos + (Matrix3f(1,0,0).rotX(angle))
Though I think it should be rotZ in zomboid probably, and it assumes that positive X is forward
If it's not radians I would say it's a pain to work with
-360 to +360 is slightly better I guess
local angle = vehicle:getAngleY()
local deltt = {}
deltt[1] = math.sin(math.rad(angle))
if math.abs(vehicle:getAngleZ()) > 90 then
deltt[2] = -math.cos(math.rad(angle))
else
deltt[2] = math.cos(math.rad(angle))
end
local xxx = vehicle:getX()
local yyy = vehicle:getY()
xxx = math.ceil(xxx + 0.01*deltt[1])
yyy = math.ceil(yyy + 0.01*deltt[2])```
that's how it's getting it.
via radians.
Idk Isometrics are hard
because XYZ in world, and each Z is one level upwards
Is it possible to get quaternion instead of angle?
so you get -90 to 90 forboth d[1] and d[0]
Quaternions seem like a harder solution lol
Quaternions on their own are already kind of confusing
Simpler programatically
Because you'd jsut be using built in functions of the java library for vector math they have
I still think its an issue with how vehicle angles work
Like interpolating the direction of the vehicle relative to the world
Some games have the rotation based on Vehicle-To-World
Well, most
So the vehicle has a changing angle relative to the world
But some games Ive seen do it backwards
Where its like, rotation relative to its starting position
Which can be some arbitrary angle
That's a weird one
Angles should always be based on the center of the objects though 🤔
Javadoc Project Zomboid Modding API declaration: package: zombie.iso, class: IsoMovingObject
that would get a facing position i think.
Yeah that's the function I saw that looked interesting, well one of them
Out of curiosity. How much of a nightmare would it be to remove the health bar entirely from PZ? Ghetto or not, how baked into death and other mechanics is it?
Necessary for a med overhaul, which would probably be nightmarish.
A lot of the stuff thats hardcoded into the game is unchangeable
Iirc UI layouts is part of that
I figure you could do a ghetto fix of just making it stay maxed. Yeah. I wasn't sure if it was hardcoded, and if it would be possible to make a low maintenance solution so it was a non-factor.

That would definitely make it harder. Mechanically any idea?
Just trying to think of how impossible it would be to even attempt making PZ blood-volume based instead of health-bar based.
I mean
You can add UI
Could just add a blood level UI
And then as you bleed out, lower the health bar respectively
Yeah that's fine. I am more talking the mechanics of health bar damage if you get me? Like having unbandaged wounds causes constant damage I want to rip that out so there's other punishments for having unbandaged wounds.
Ripping out is probably impossible. Maybe I'll snoop, it's a very specific question so I understand.
Since yknow, you'd be bleeding out slowly
Yeah it's just it wouldn't be necessary if you have bleeding be more involved if you get me.
But yeah someone much more qualified with how the base mechanics work would probably be more helpful
I mean I notice there's nobody who seems to have attempted this other than immersive medicine, so I am going to guess this isn't easy. I might look at their code just to understand how much the game fights you on this.
Are you also certain that the math ceiling is proper?
if math.abs(vehicle:getAngleZ()) > 90 then
deltt[2] = -math.cos(math.rad(angle)) the delta 2 is the Z rotation?!
so why is delta1 the Y rotation?
local angle = vehicle:getAngleY()
local deltt = {}
deltt[1] = math.sin(math.rad(angle))
No clue, I thought you had some special cases in place for when you rotate it
the thing is... without rotation... it works... i can move it INFRONT of the car by increasing the 0.01
I'm not good at angle math, I just use the built in libraries to do it all for me
By the way, they are both using y angle, just checking different things
?
the variable 'angle' is used in both. It's just doing the whole check with the split in middle or whatever
If Z angle is whatever, it's negative, else positive
But try changing the check to AngleY instead
so my friend and i have a server with apexhosting and realized we can do pz, is there anyway we can use server modmanager for it?? and if so how ty
without context it sounds sus lmao
can anyone answer a quick question, I got a mod for a car off the workshop but I want it to spawn very rarely, would I change this code here?
`VehicleZoneDistribution.good.vehicles["Base.fhqMX5NARally"] = {index = -1, spawnChance = 4};
VehicleZoneDistribution.sport.vehicles["Base.fhqMX5NARally"] = {index = -1, spawnChance = 40};`