#mod_development
1 messages Β· Page 232 of 1
I just know that, you can make your images as large as you want
And they'll fit in the modpage
But if they are too small, they might not take the entire space
So like at a minimum I know my images take the whole page so I use that or more
I think the important part is finding your style, in my case I just took back Susceptible's style to really feel like an extension to it
But something really nice I made for example recently
You can even add videos
Like not gif, actual videos in your mod pages
Yeah
I think I'm going to start work on some images to use
Maybe a picture of courtman medical
The 2 patient images and the symptoms chart
At least for the Boiling Rash
I really want to go all out with a government briefing style
Sort of like
A document full of information you would give to someone to explain the situation
There is alot I could do to make it look really nice
You can take for example TLOU symptom charts
You could even make these spawn around the world
Make it an item
That looks really good
And I love the idea of making it an item
I could have them spawn all over the place like the government was handing them out like crazy when it started spreading
Yeah
Check out Expanded Helicopter Events
They have some items like that that you open like a map
Chuck's also made a framework to easily add new custom map items like that
I'm really glad that there are some bases to work from
My main problem so far has just been trying to make the actual symptoms chart
(Because Adobe likes to cause pain)
And figuring out how to actually put the image into the description
Because I honestly have no idea how people do that
Haha
Let me show you my mod page code
Also guides I used to learn Steam markdown:
https://steamcommunity.com/sharedfiles/filedetails/?id=2807121939
https://steamcommunity.com/sharedfiles/filedetails/?id=1245720477
https://steamcommunity.com/comment/Recommendation/formattinghelp
List of all markup (BBCode) tags on Steam, where they can be used, their parameters and issues surrounding them....
This guide shows you how to embed images and buttons in the description of artwork, screenshots, and workshops.
https://i.imgur.com/m9mCPUE.png
https:/...
This should help
Thank you for the resources
I've been struggling to get this information for awhile
Don't hesitate if you have any questions
Especially for hosting your images and videos
Anyway gtg sleep now
Anyone would have some spare time to help me understand why my mod options doesn't show up in SandboxVars options ?
Send your option file
I think I made it π Thanks π
I have a question tho. I just made a little mod that expand Braven's "Erase Map Data" mod (with is courtesy). I chose to have a sandbox option to "Erase All map" or "Erase only visited areas". The main objective of this mod is to be able to play with map full revealed but still be able to erase visited areas on death. I wonder if it would be better to just check server map options and select the right choice depending of the server map option. What do you think ?
π
Can someone help me figure out why my case item isn't spawning items?
Hmm ok, I don't understand why my sandbox options are in the main options and not in my own category...
I've inserted the case itself into multiple things and it works fine
but the case is always empty even tho I have this
Anyone can help me with that bug ?
what about sharing your sandbox options definition ? sandbox-options.txt
That would have been a good idea, you're right ! But I just found the problem !
My previous verison was :
option EraseMapXpanded = {
type = enum, numValues = 2, default = 1,
page = EraseMapXpanded, translation = EraseMapXpanded_option,
valueTranslation = EraseMapXpanded_optionChoices,
}```
without the ".Option" it just adds a line in the vanilla Sandbox options, with the ".Option" it adds a new category π
Do you know how I can inject comments in the SandboxVars.lua in my mod options category so when people edit the file they can have hints on what numbers does what ?
My mod is now uploaded and public, with courtesy of Braven for the original code !
https://steamcommunity.com/sharedfiles/filedetails/?id=3229943586
Anyone can help me finding relationship between Nutrition() and Stats():Hunger() ? How the first one affects the second one ? I'm making a mod that tries to simulate fast forwarding time in MP by draining stats, but I don't find how Nutrition & Hunger are tied together π
the short answer is they aren't tied together
when you eat food you gain nutrients and lose hunger, but nutrients and hunger don't really interact with each other
ok, so if I want to simulate passing time, then I should update player Stats():Hunger() rather than Nutrition() right ?
both decrease over time
if you increase hunger but don't decrease nutrition it'll be difficult to lose weight
ok, so I need to find where are hidden the increase/decrease Stats in the code to be able to simulate what I want π
kERHUS found me this :
ThirstIncrease = 0.000019,
ThirstSleepingIncrease = 0.000015,
ThirstLevelToAutoDrink = 0.1,
ThirstLevelReductionOnAutoDrink = 0.1,
HungerIncrease = 0.00005,
HungerIncreaseWhenWellFed = 0,
HungerIncreaseWhileAsleep = 0.000025,
FatigueIncrease = 0.00012,
StressDecrease = 0.00003,
BoredomIncrease = 0.0030,
BoredomDecrease = 0.0385,
UnhappinessIncrease = 0.001,
StressFromSoundsMultiplier = 0.00002,
StressFromBiteOrScratch = 0.0001,
AngerDecrease = 0.0001,
BroodingAngerDecreaseMultiplier = 0.3,
SleepFatigueReduction = 0.0001,
but I don't know where they found this π
i think that's from ZomboidGlobals.lua
yeah, because it loads the values from the lua table in Load()
do you know which one ? I'm trying to figure out how the stats update is made, so I can simulate it, also I'm trying to figure out what impact has the hours per day sandbox option on those stats updates.
ZomboidGlobals from defines.lua
ok got them, thanks a lot @bronze yoke ! Do you know if the hours per day sandbox option modify those numbers ? Or maybe it's only the update that is made on in game time rather than RL time ?
hunger is updated every tick but it's adjusted for in game time
i haven't researched nutrition but i would imagine it to be the same
ok, so to simulate on a MP server the stats update due to fast forwarding when reading, I would just have to do the maths and apply the changes, no need to adapt it to the server day lenght options, right ?
Also, in BodyDamage.Class there are stuff like that :
setBoredomLevel((float)(getBoredomLevel() + ZomboidGlobals.BoredomIncreaseRate * GameTime.instance.getMultiplier()));
I guess that "getMultiplier" is the fast forward multiplier so is always = 1 in MP, so I don't care and can ignore it.
it's a time delta that accounts for game speed and day length
Does PZ not allow debug module for lua? Was going to write some logging stuff but I get "non-table" so I'd assume it's a no.
Is there a list of lua modules that are available for PZ mods?
it doesn't
that sucks
oh well logging isn't that important lol just wanted to see if I could've made it better
for the umbrella addon i was able to disable intellisense for those libraries, so i can quickly find that if you want to know which ones aren't available
yes please π
debug, io, package are not implemented
I do use umbrella but I still get intellisense
ok ty!
also parts of the os library aren't available either, but i don't have a list of what exactly isn't
did you download it manually or get it from the lua addon manager? unfortunately it's a feature exclusive to the latter method
I used the Lua Addon Manager in vscode
that's odd then, no idea what that's about
I can only assume it might be a result of emmylua or vscode's lua thing
the addon manager lets me set some default settings for the language server when using the addon, i guess that part doesn't work for everyone
"Lua.runtime.version": "Lua 5.1",
"Lua.runtime.path": [
"shared/?.lua",
"client/?.lua",
"server/?.lua"
],
"Lua.completion.requireSeparator": "/",
"Lua.workspace.preloadFileSize": 800,
"Lua.runtime.builtin": {
"debug": "disable",
"io": "disable",
"package": "disable"
}
```specifically these
you can disable those manually from the extension settings if you want
ty! I put this in my .luarc.json file and it worked perfectly
Can I get the values of Stats Increase that are in ZomboidGlobals ?
For instance https://zomboid-javadoc.com/41.78/zombie/ZomboidGlobals.html#HungerIncrease
Javadoc Project Zomboid Modding API declaration: package: zombie, class: ZomboidGlobals
I would like to have something like getZomboidGlobals():getHungerIncrease()
they're read from the lua table i pointed you to, just read them from there
so I should have :
require ZomboidGlobals
or
require defines.lua
you kinda found it with this code here
eg ZomboidGlobals.HungerIncrease and ZomboidGlobals.HungerIncreaseWhenExercise etc
ok thanks, do I need to add a require XXX or as global data it's always loaded ?
Also you don't need to require ZomboidGlobals because it is global table and not a file
the latter
you should be able to yes
Do you think this code would work or I'm missing something ?
well you can always test it
sure π
but from a quick glance it looks like it would work
the idea of the mod is to simulate fast forwarding time in MP, by adding stats decrease when player read, using the minutesperpage config of the server
the bottom line where you are adding your callback
it should be
Events.OnPlayerUpdate.Add(readwithfriends())
ok thanks π also, it's better to have this on server side right ?
With the code above, it wouldn't quite work on the server side
to my knowledge, getPlayer() is client side for getting the client player (the one you control).
The only thing I am unsure if it would work on the client side is getServerOptions (which you need to add a () too)
A good thing to note is that the way PZ is networked, client side handles most of the stuff. Server side is only used for somewhat specific things. Most things you can do on the client side only (for better or for worse)
but all the stats stuff is server side I think
You can set stats from the client
It sounds weird, I thought that too but it's how this game is
ok, also, to answer your question, getPlayer() can be server side. I use it in another mod I made.
I am not aware of that, I have never heard of it being server side
someone can correct me :p
This is my mod that uses getPlayer() in a server side .lua
so I should have the getServerOption() in a server side file, and the rest in client side ?
I just tried to call getPlayer() on the server side and it's nil so I have no idea how you used it
like that, and it works π at least it was working last time I played with it
I call for the player in the function
local function getInfectionProgress(player)
and
function onCreateBloodAnalysis(items, result, player)
yes I see, I think I am wrong one sec
You can get the server options from the client btw
ok I just tested it 3 more times, getPlayer may not work as you think it might on the server side
I called getPlayer() on both client/server and got two different IsoPlayer.
but I played with my mod for days on a dedicade server and it worked as intended. But I'm curious to learn more π
Server IsoPlayer is just a generic one named "Bob"
I'd like to think so, but I'd expect it to error if it were trying to execute the functions on the client
I too am curious on why the hell this works but honestly I have no idea
How it feels when I first tested my mod thats adds a trait that lets you craft pipebombs and it got no error actually work and the only thing that didn't work at the start was displaying the name, description and icon
stats are entirely client side
if you don't have a server check in your file it will run on the client, this only works because it is also running on the client, getPlayer() never returns anything on the server
albion do you know why you can call getPlayer on the server at all?
you can't
putting a file in the server folder is not enough to make it only run on the server, this is running on the client
ok so even if my lua file is on the server folder, it runs as if it were in client folder ?
Maybe it's because of the recipe?
because game just load lua files in alphabetical order ?
the game loads files in this order
vanilla shared -> modded shared -> vanilla client -> modded client -> vanilla server -> modded server
each stage is loaded alphabetically
possibly to do with logical client/logical server stuff?? I am actually curious why the hell asilar's code was working then
on the server, client is skipped vanilla shared -> modded shared -> vanilla server -> modded server
but the client does not skip server
infact the majority of the lua in the vanilla server folder is client only
my brain just enhanced to the fourth dimension
ok π That's also why I thought stats was serverside then I guess
if you want your file to only run on the server you should start it with if isClient() then return end
and I thought minecraft's client/server model was hard π
or rarely if not isServer() then return end
singleplayer is neither a client or a server, so it passes the first check, but not the second
usually you still want server stuff to run in singleplayer so the first one is more often useful
oh ok, so it's ok to get this error when I load the mod on the main menu, but it won't return an error when the game is running ?
probably
well getPlayer wont return anything in the menu since there is no player
I thought OnPlayerUpdate would only update in the game where there is a player but I guess not?
I guess there is a way to avoid that error right ? π
Oh wait
It's because I told you to do that stuff outside of the event callback
you could probably do it like this:
local plr = nil
function readwithfriends()
print(plr:getUsername())
-- Your stuff here
end
Events.OnPlayerCreate.Add(function ()
plr = getPlayer()
end
Events.OnPlayerUpdate.Add(readwithfriends)
``` or something similar
although im not sure if the callback will actually set the local variable because it's in a callback
idk my mind is fried im going to sleep
thanks for the help
Would it be possible to hook into the "Delete All" action that you can use in trashbins to run some code? How could I do?
The code would be, take the trash container and cicle to see all the items it contains and take for all the items the weight from them and than add this to a variable, when the "delete all" is used that value is given to something...
@bronze yoke damn, my mod doesn't work. Would you have some spare time to try to help me debug it ?
Does it raise an error for using the :getUserName() method?
aoqia was not sure so I didn't try their code, shoud i try it like it's written here ?
but it's only onplayercreate, so if player just log back in, it won't work, right ?
no, it's fired every time they join
but it should be OnCreatePlayer
not OnPlayerCreate
syntax error: Events.OnPlayerUpdate.Add(readwithfriends())
when you do readwithfriends() you call the function and pass the result (nothing), you want to do just Events.OnPlayerUpdate.Add(readwithfriends) to pass a reference to the function
so it should be :
Events.OnPlayerUpdate.Add(readwithfriends)
instead of :
Events.OnPlayerUpdate.Add(readwithfriends())
?
yeah
Ok, trying π
Good morning!
does the UnhappinessIncrease is obsolete ?
This is defined in ZobmoidGlobals & defines.lua, but not in Stats Class
ok
bDamage:setUnhappynessLevel(bDamage:getUnhappynessLevel()-(deltaUnhappiness/minperpage-deltaUnhappiness));``` ?
ok, I don't get any error now, this is the last version of the code :
but the mod doesn't work as intended : player doesn't get thirsty or hungry when reading a 220 pages book (in solo play when you read a 220 pages book with fast forward, you get hungry/thirsty)
stats:setHunger(stats:getHunger()-(deltaHunger/minperpage-deltaHunger));
won't deltaHunger/minperpage-deltaHunger always be a negative value? if minperpage is above 1
you're reducing their hunger
minperpage is at 0.2 on my test server
oo
server side lua?
so it's positive
for example :
deltahunger = 0.0030
minperpage = 0.2
deltaHunger/minperpage = 0.0030/0.2 = 0.0030*5 = 0.015
and deltahunger/minperpage-deltahunger = 0.01470
client side, as stats are handled by client and not server
hunger from 0 to 1.0 or 0 to 100?
dunno, it's vanilla coded right ?
based on BodyDamage.class I think it's 0 to 1.0
hmm
maybe
It's 24 hours later but hey, here ya go!
missing commas can cause problems even on the last line of a block
Would it be possible to hook into the "Delete All" action that you can use in trashbins to run some code? How could I do?
The code would be, take the trash container and cicle to see all the items it contains and take for all the items the weight from them and than add this to a variable, when the "delete all" is used that value is given to something...
function ISInventoryPane:removeAll(player)
You can do:
local originalRemoveAll = ISInventoryPage.removeAll
function ISInventoryPage:removeAll()
originalRemoveAll(self)
-- add your logic here
end
or
function ISInventoryPane:onConfirmDelete(button)
if button.internal == "YES" then
local object = self.inventory:getParent()
local playerObj = getSpecificPlayer(self.player)
local args = { x = object:getX(), y = object:getY(), z = object:getZ(), index = object:getObjectIndex() }
sendClientCommand(playerObj, 'object', 'emptyTrash', args)
end
self.removeAllDialog = nil
end
hmm, need look into object emptyTrash command
is it possible that solo play stats drain and MP stats drain are not equal ? even if you setup your server as "Normal" for statsdecrease ?
how can I find the ranges (numbers) of stats like boredom, fatigue, hunger, thirst and unhappiness ? I have weird numbers with my mod when I print the stats
Boredom is from 0 to 100 according to BodyDamage.class
UnhappynessLevel is also from 0 to 100 I think
and Hunger, Thirst and Fatigue should be from 0 to 1.0 I guess
I managed to have my function working (for readwithfriends mod)
but the results are not as intended
When I tried a solo play to test, I red the 220 pages with fast forward, and at the end I was at second stage of thirst and first stage of hunger
In MP with my mod, after the 220 pages I was at last level of Hunger (took damage from it), and first level of unhappyness, and zero level of thirst
it is better than before, but doesn't work as intended.
drains too much hunger and unhappyness, and not enough thirst
Any idea ?
try multi on getGameTime():getGameWorldSecondsSinceLastUpdate()
BoredomChange = (deltaBoredom/minperpage-deltaBoredom)*getGameTime():getGameWorldSecondsSinceLastUpdate()
or, as i say before - print getStats onPlayerUpdate, (last stat - previous) = delta per tick
in standart setting (1 hour daylenght)
TchernoLib gives a simple interface for delta time convertions between Simulated World Hours and Real Time Seconds: luatime.getRealtimeSeconds2WorldHours(sbTime) / luatime.getWorldHours2RealtimeSeconds(worldHours)
Hello, I want to make my own mod but I dont have any knowledge of coding. How can I begin with making a mod/coding? Can anyone recommend a good tutorial?
I suggest looking at other mods to start learning how to mod
.
I wouldn't say there's one single tutorial to encompass everything, but:
1- You can learn by looking at the lua code of the game and other mods.
2- To easily find what you're looking for in game files, use a tool that has the feature for "Search in files". I personally use Notepad++ for this.
3- You can also do some searches on this channel for your problem or question. Chances are it was asked before
4- There are tons of tutorials out there and github repos to help you get started. Unfortunately I'm not able to link you to them right now, but you can easily find them by searching for links or terms including GitHub in this channel
5- The community is very supportive so if you ever need help regarding something feel free to ask here
Happy modding :)
Could someone help me? I'm trying to get the items in the trunk but I get an object call nil error when I use getItems() even though it's part of a container and it's not empty.
Thanks kERHUS. I am afraind I don't understand all this enough. I don't get why our initial maths are wrong, is it because in vanilla/solo Stats are not drained with OnPlayerUpdate ? but with OnTick ? or another event ?
i'm not sure, OnTick should be same as OnPlayerUpdate
but i think defines vars uses like not ontick, should be something else
or this is vars just... not mention for this
it general - as i say
find delta per tick
not like global variables from defines
just do stuff like
local function test()
local stats = player:getStats();
print("BoredomStat = "..stats:getBoredom());
end
Events.OnUpdatePlayer.add(test)
in log u get lines with print
Are you sure that getPartById and getItemsContainer return an object?
like
0.01
0.04
0.07
etc
nevermind.
push pause, get last (0.07) and previous (0.04)
0.07 - 0.04 = 0.03
this is delta boredom
for example
local items = nil
local function getTrunkItems(vehicle)
if vehicle ~= nil then return end
items = vehicle:getPartById("TrunkBed"):getItemContainer():getItems()
end
Events.OnUpdatePlayer(getTrunkItems)
here vehicle - it's player
Events.OnUpdatePlayer.Add(getTrunkItems)*
OnUpdatePlayer take param to isoCharacter
not Vehicle
Actually this code is written backwards, too, if that's how it is in your file. You tell the code to return end if vehicle is NOT nil
local function getTrunkItems(ass)
local function getTrunkItems(goverments)
ass, goverments - just like local player
This means it only proceeds when vehicle is nil, i.e., there is no valid object to work with
items = vehicle:getPartById("TrunkBed"):getItemContainer():getItems()
vehicle - it's player in this situation
getPartByid from player?!
No it's nil (if that line is ever reached)
if vehicle ~= nil then return end guarantees vehicle will be nil
It only gets past that line if vehicle IS nil
It's supposed to be if vehicle == nil then return end
The code may have other problems, but this is definitely one of them
local function getTrunkItems(vehicle) -- HERE VEHICLE IT"S PLAYER!!!
if vehicle ~= nil then return end -- IF NOT PLAYER THEN NOTHING, YEP?!
end
Events.OnUpdatePlayer.add(getTrunkItems)```
You are supposed to bail from functions when the variable you need to exist IS nil
Sorry, the wrong file was uploaded
Vehicle is passed player but my point is that in theory you cannot make it past the condition of that function unless it's called with vehicle = nil
I understand what you're saying but you're missing what I'm saying
The items = line literally never happens UNLESS in theory vehicle is nil, which it probably won't be unless you manually call the function
local function getTrunkItems(player)
if player:getVehicle() == nil then return end
end
Events.OnUpdatePlayer.add(getTrunkItems)```
ah yep
But yeah in addition to that problem, as kERHUS is saying, the function is designed to receive a player, not a vehicle.
?
yeah
umbrella has been updated! the main new feature is event callback alias types, you can now annotate a function as an event callback using this method:```lua
---@type Callback_OnCreatePlayer
local myOnCreatePlayer = function(playerNum, player)
-- your ide will automatically understand that playerNum is an integer, and player is an IsoPlayer
end
Events.OnCreatePlayer.Add(myOnCreatePlayer)
i've also added type definitions for functions linked to scripts: ``Item_OnCreate``, ``Item_OnCooked ``, ``Item_OnEat``, ``Item_AcceptItemFunction``, ``Recipe_OnCanPerform``, ``Recipe_OnTest``, ``Recipe_OnCreate``, ``Recipe_OnGiveXP``, ``VehiclePart_init``, ``VehiclePart_create``, ``VehiclePart_checkEngine``, ``VehiclePart_checkOperate``, ``VehiclePart_update``, ``VehiclePart_use``, ``VehiclePart_Install_test``, ``VehiclePart_Install_complete``, ``VehiclePart_Uninstall_test``, ``VehiclePart_Uninstall_complete`` - these should make interacting with these script properties much easier, especially as documentation for these is otherwise poor
the latest version of the events documentation has also been pushed, which includes descriptions for most* events' parameters, class definitions for events that pass complex tables (i.e. inventory context menu events), and enum types for events that pass strings
oh
That's cool
Well, it may still have errors since I'm bathing myself in what I remember of the code since I don't have access to it right now.
my hero, i need u!
before u say u knowledge about zombies is to big
blushes
uh π
how to stagger them or drop down on the floor
There's methods you can apply on zombies to do that
Give me a sec
zombie:knockDown(true)
I believe it is
Tho not sure if that makes the zombies crawler actually
setStaggerBack(true) hmm... should be stuff to direction from player and zombie...
Have never used the stagger one
I'm trying it in my juggernauts zombies
Guessed it
Made a disease awareness poster
π
local function shouldBeStanding(zombie)
-- as of 41.71:
-- leg break, head bash, vehicle hit: isKnockedDown
-- randomized vehicle stories: wasFakeDead / crawlerType = 1
-- fakeDead: wasFakeDead
-- Kate and Baldspot: crawlerType = 1
-- createhorde2command: isKnockedDown / crawlerType = 1
-- Note that isKnockedDown and crawlerType are not transferred on the network
-- so not reliable when generated by server for client-owned state like knockedDown
return not zombie:isKnockedDown()
and not zombie:isStaggerBack()
and zombie:getCrawlerType() == 0
and not zombie:wasFakeDead()
end
local function SmashAllZombiesOnMyWay(player, zombie)
-- ΠΈΠ³ΡΠΎΠΊΠΈ Π·ΠΎΠΌΠ±ΠΈ Π±Π΅ΠΆΠΈΡ ΠΈΠ»ΠΈ ΡΠΏΡΠΈΠ½ΡΡΠ΅Ρ
if not player:isZombie() and (player:isRunning() or player:isSprinting())
and zombie:isZombie() and shouldBeStanding(zombie) then
local zSmash = 0
if player:isSprinting() then zSmash = 0 end
local zRandomizer = ZombRand(101)
if zSmash > zRandomizer then
zombie:setStaggerBack(true)
player:Say("zombie stagger back")
else
zombie:knockDown(true)
player:Say("zombie knockDown")
end
player:setKnockedDown(false)
player:setFallOnFront(false)
player:setBumpStaggered(false)
--player:setBumpType("stagger");
player:setVariable("BumpFall", false);
--player:setVariable("BumpDone", true);
--player:setVariable("BumpFallType", "pushedFront");
end
end
Events.OnCharacterCollide.Add(SmashAllZombiesOnMyWay)```
who can test it?
Why don't you test it lol ?
im not at home yet
bruh...
but player can fall down...
and cancel run when collide...
AHAHAHA
main problem - player can fall. it's so much offen when you sprint
player:setBumpType("stagger");
player:setVariable("BumpFall", false);
player:setVariable("BumpDone", true);
player:setVariable("BumpFallType", "pushedFront");
so funny
Is it possible to "nudge" a world object by changing it's WorldPos slightly?
I am trying to remove a vehicle and create a return with what was in the trunk, could someone help me?
That's cool haha
What did you do to have the player fall stumble backwards ?
@thick karma https://asledgehammer.github.io/Mallet/
=)
The tool is live. Glad to get it into BETA so soon.
Nice, I'll give it a try soon.
Looking good, looking forward to helping out with providing documentation. Is there a project anywhere for tracking coordination? Could be good, for setting up a community doc repo (or integrating into Umbrella)
Yeah the repo is on the greet msg IIRC.
We should look into generating json files with your older code.
Outing myself for not reading the greet message because I wanted to jump right in π
I'll still need to update that code; probably gonna scrap the overhaul I was doing for more sophisticated analysis
This is the power of brain surgery hahah
What do you think of the rich text editor?
I use QuillJS and wrote my own conversion code for markdown to their format "delta".
The greet msg also links to a test JSON file that you can load.
I like it. Could be good to provide a shortcut for code
Oh there's a preview pane on the bottom.
If your window is wide, a 3rd panel on the right appears.
still stuck on this :c
I can't figure out why the boxes come out empty
i don't think this is loading even
I'm adding a copy button for code windows right now.
@frank elbow I plan to expand this to Java API in the future.
That way Umbrella can take both and apply it to IntelliSense, giving more details / documentation to modders.
Heck yeah
This was the plan for like two years.
Anyone know how to insert a loot table into an item? I'm trying to replicate it but can't
I'm struggling to figure out what you did here
I've searched the site the image is hosted from and can't find a way to do so myself
I've searched through the internet and haven't been able to find 1 working tutorial on how to put images into the description
Best I got was a tiny little image icon
But no image
So I host my images on Github
I couldn't find out how so I tried to use imigur and it failed
Ok so
You can use imgur but you need to use this:
And the issue is that imgur links eventually die
If you want something permanent, you use something else, like Github and to use images from Github you do that:
-open image
-right click on the image
-open image in another tab
-copy link
-https://raw.githubusercontent.com/SirDoggyJvla/Susceptible-Overhaul/main/images/mod_advancement.png
And then just use this image with
[img]https://raw.githubusercontent.com/SirDoggyJvla/Susceptible-Overhaul/main/images/mod_advancement.png[/img]
I did it
It actually worked
Thank you
Sir Doggy out here laying down the steam formatting knowledge. ππ»
Ya bro. I should spend some actual time on the propane station page. It's basically just a solid block of text. lol
I am sure plenty of people take a look at it and go "tl;dr". π€£
Presenting a mod can be important, I'll prepare my current big project a fuck ton before releasing it on the modpage
I want it to be as clean and presentable as possible to increase its visibility
Yeah huge walls of texts are just useful for no one ngl
I've been searching for how to do that for so long
I only found 1 tutorial on the subject and it was outdated
Yeah... readability is what I am lacking. I really should put some effort into it.
Even when you get in the technical aspect of a mod, there's better ways to present it
Usually I leave the technical stuff on side pages like Discussions and shit like that
I mean, the workshop will still work, but this can definitely stop people from asking a ton of stupid questions
It won't stop those from being a thing haha
But there will be less questions
I don't think many people have even seen the Propane Station mod.
Melo did some dope tiles for me though, so hopefully that changes soon. I'll try to make the workshop page worthy of his effort when I get the changes rolled out.
Nope! I dynamically place them! β€οΈ
It may have been at one point, when TiReKs was still managing it.
Right
Then Aika inherited it, and I helped her out with it, then I took it full time when people started being shitty towards her. π
It changed a lot over time, for sure.
yikes
Ok so something you could do for your modpage, is add points on the PZ map of where the propane stations are
And you could even hide the various points with a spoiler on the image
So if people don't want to get spoiled
Oh! Good advice!
Also you can probably drop the tutorial for old maps
It's been ages since then
People will all use the most recent version
(Also damn that mod is old asf)
I would add an example image of the propane tiles being shown
Perhaps you could show it's compatible with any map mods
I can give you an Excel file with almost every map mods in my modlist and every cells they occupy, to find example mod maps that replace one of the locations of your propane tanks
It absolutely is! π€£
I would appreciate it!
My GF asked me to make a mod that shows a message when your armor get's a hole, what do you think?
Pretty cool
It's barely readable
But you could manage since you'd look at specific cells
You could just look at which modded maps are on the cells of your propane spawns
Actually usefull
Any Idea why my vehicle texture would be showing as a red and white checkerbox texture? I've checked and made sure all the names match and the file sizes are correct
me when people talk about issues in the mod workshop comments instead of uploading on github so I get no notifications moment
GitHub is life.
Any way to find what's the value of "Minutesperpage" in a solo play ? in MP it's in Server Options, but in Solo I don't know where to get the data
ok, I did a test in a solo game, survival difficulty, no reading perk on the character : it took 450 in-game minutes to read 220 pages. In MP, default value is 1 minute per page, so it's 220 in-game minutes for the 220 pages, so it's around 2.045 faster in MP than in SP. That explains part of the issue I get with my mod.
Is it possible to add comments within the recipe/item/model .txt files? Trying to organize stuff and make it easy to find sections/categories.
I've used this before. π€£
yeah, the syntax is /* YOUR COMMENT */
Thank you!
=)
Yup
This looks nice.
The Markdown support is there.
:D
Going to start documenting the ISUI library either tonight or tomorrow.
Encountering another little challenge π How can I hide one of the Insurgent mod Traits if I don't want it to be available to players on my server ? I tried several things but it didn't work.
if you're doing it through a mod, you can just create a new trait with the same name and set it as a profession trait (but not give it to any profession)
the new trait will overwrite the old one
So best way is to make a "fork" of original mod ? or what you are saying is different from that ?
you can do it from a separate mod
if you were going to fork the original you might as well just delete the code that adds it in the first place
yeah, I'm sorry my coding knowledge is quite limitated compared to you, so I am afraid I don't get all you said in the first answer π¦
-- normal trait initialisation from the original mod, creates MyTrait
TraitFactory.addTrait("MyTrait", name, cost, desc, false)
-- overwrites MyTrait with a new trait, the boolean makes it a profession specific trait, which basically just makes it unobtainable if you don't give it to a profession
TraitFactory.addTrait("MyTrait", name, cost, desc, true)
I dug in Insurgent mod code, but it's kinda complicated, maybe I'll dig in another profession/trait mod simplier than insurgent to try to figure it out
This : TraitFactory.addTrait("Undying", getText("UI_trait_Undying"), 10, getText("UI_trait_UndyingDesc"), false, false)
so I just create a lua file in shared folder with :
TraitFactory.addTrait("Undying", getText("UI_trait_Undying"), 10, getText("UI_trait_UndyingDesc"), false, true) and make it load after insurgent and I'm good ?
should be the first boolean set to true, but yeah
ok, no need any 'require' because I don't mind if it's desc is not good or so ?
you should require the file that adds the trait so you can ensure your file loads after it
Require the file in the resurgent mod that adds that trait, specifically. Just to clarify and help you avoid getting confused. π
ok thank you so much ! I'll give it a try tomorrow, time to sleep now π
Hiyas, I'm working on an animation mod to replace the default walking animations. Would anyone be able to give me a breakdown on the animation xml files?
I managed to get my animation into the game - however the player is moving at half its usual speed. Help would be lovely lmao
player:setBumpType("stagger");
player:setVariable("BumpFall", false);
player:setVariable("BumpDone", true);
player:setVariable("BumpFallType", "pushedFront");
Well yeah but which one
all, without one line player stumb in animation and not moving
The same lines trigger the fall of zombies ?
nope, zombie:knockDown(true)
local function shouldBeStanding(zombie)
-- as of 41.71:
-- leg break, head bash, vehicle hit: isKnockedDown
-- randomized vehicle stories: wasFakeDead / crawlerType = 1
-- fakeDead: wasFakeDead
-- Kate and Baldspot: crawlerType = 1
-- createhorde2command: isKnockedDown / crawlerType = 1
-- Note that isKnockedDown and crawlerType are not transferred on the network
-- so not reliable when generated by server for client-owned state like knockedDown
return not zombie:isKnockedDown()
and not zombie:isStaggerBack()
and zombie:getCrawlerType() == 0
and not zombie:wasFakeDead()
end
local function SmashAllZombiesOnMyWay(player, zombie)
-- ΠΈΠ³ΡΠΎΠΊΠΈ Π·ΠΎΠΌΠ±ΠΈ Π±Π΅ΠΆΠΈΡ ΠΈΠ»ΠΈ ΡΠΏΡΠΈΠ½ΡΡΠ΅Ρ
if not player:isZombie() and (player:isRunning() or player:isSprinting())
and zombie:isZombie() and shouldBeStanding(zombie) then
local zSmash = 70
if player:isSprinting() then zSmash = 30 end
local zRandomizer = ZombRand(101)
if zSmash > zRandomizer then
zombie:setStaggerBack(true)
player:Say("zombie stagger back")
else
zombie:knockDown(true)
player:Say("zombie knockDown")
end
-- player:setKnockedDown(false)
-- player:setFallOnFront(false)
-- player:setBumpStaggered(false)
player:setBumpType("stagger");
player:setVariable("BumpFall", false);
player:setVariable("BumpDone", true);
player:setVariable("BumpFallType", "pushedFront");
end
end
Events.OnCharacterCollide.Add(SmashAllZombiesOnMyWay)```
What do zombie:knockDown(true) and zombie:setStaggerBack(true) do ?
What's the diff
zombie:setStaggerBack(true) -- zombie staggers from the collision, but dont fall on floor
when you push a zombie but they don't fall
stagger animation
knockDown - knock down xD
player:setKnockedDown(false) -- don't work, looks like if player start fall - its somewhere not it this function, maybe OnPlayerUpdate?!
player:setFallOnFront(false) -- same
player:setBumpStaggered(false) -- disabled collider for player... if im rigtly understood
like here
idk how to set player not fall if player run into zombies
it seems like he stumbles over them at some point in time...
how to get this text?
it's noise(" ")?
It's helper text with arrow. I can can send you the correct name later, I'm not at home right now
ill be waiting
my ugly Say:
Aah I see
You were helping me yesterday - I managed to get my animation into the game thanks to you! However, I'm replacing the default walking animations, and my animation seems to be halving the player speed... Would you happen to know anything about that?
it's not require here, when u collide with zombie - they staggered on default
oooooooo
thanks, king!
Yo np good to have a new fellow animator xD
For the speed issue, it's the translation data (the bone) that dictates the speed of the character
This means you can also just speed up your animation either in the xml file of the walking animation, or in Blender
Oh, how does that translation data bone work in Blender?
Sorry, none of the guides I've looked at have mentioned it at all!
HaloTextHelper.addTextWithArrow(player, text, false, 255, 100, 100)
if cachedHoles and itemHoles > cachedHoles then
local text = item:getDisplayName() .. ' ' .. getText("IGUI_garment_Hole")
---@diagnostic disable-next-line: param-type-mismatch
HaloTextHelper.addTextWithArrow(player, text, false, 255, 100, 100)
end
@verbal yew I based, my code off this one: https://steamcommunity.com/sharedfiles/filedetails/?id=2921642476
Since you've mentioned it, I've tried repositioning the bone, rotating it and scaling it.. I'm not sure what I'm doing anymore

aaawwww eaaaah
aaaaaaaaaaaaaw yeah!
That looks so good!
Have you seen what other crap I made based on "Cars in the Snow"?
Does anyone know if there's a better function for checking multiple items?
Example:
local toothbrush = playerInv:getItemFromType("Toothbrush")
This only gets toothbrush, but if I have say ToothbrushRed it does not get it. I have a handful of toothbrush items and I do not want to write this line above for every single toothbrush. I thought of doing this:
local toothbrushNames = { "Toothbrush", "ToothbrushRed", "ToothbrushGreen", }
local toothbrushes = {}
for _, v in pairs(toothbrushNames) do
local foundToothbrush = playerInv:getItemFromType(v)
if foundToothbrush ~= nil then
table.insert(toothbrushes, foundToothbrush)
end
end
But is there a better way I am not thinking of?
nice, i would definitely add in my VLC support for this mod π
the most standard way would be to add a Toothbrush tag to the items and use getFirstTag("Toothbrush")
you can also use getFirstEval with a function that takes an item argument and returns true if the item is a valid catch to implement custom searching logic
I have but I'm not familiar with vehicles
Rotating it won't do anything (I believe)
How does it work is that it defines the distance traveled by the character, since the animation isn't moving within the environment, it stays at the center of the environment
I think I will just do this, especially since other mods can access tags but not my custom eval function, ty!!
im not release it, very downgrade for performance
Yeaaah there really isn't any perfect animation guide, yet
I've managed to fix my movement speed, tyvm
I'll make my own after this
Is it possible to store a vehicle in a way that when it is removed from the world the variable still retains it?
Is it possible to speed the animation up or down in the xml files? The animation works great, but it's a little too slow, and speeding the animation up in Blender seems to make it hang on the last frame for a little bit before going to the next loop
who know it's possible to predetermine catched fish?
or it's randomized only in getFishByLure() javacoded side?!
iirc a line like "<m_SpeedScale>0.80</m_SpeedScale>" sets the animationsspeed (in this case 0.80)
I've tried playing with that line and I'm not seeing a difference
It's befuddling me lmao
mhm, then I have no idea, lol π
We're working on one actually already
Yup you can
Can't show you the code now but it's just speed_scale
Check the java
Probably not ?
I see. Unfortunately, this doesn't seem to be doing much for me
I have also managed to completely destroy my animation... So, I'm gonna have fun figuring THIS out
Oh I fixed it
I reopened my Blender file and the export settings reset lmao
Yup
Do you have any idea why <m_SpeedScale> isn't doing anything for me?
I have a question, i am getting a error whenever i hit a zombie, what mod could be causing it?
@manic magnet my test failed, due to bad usage of require function.
I'm not sure how to use it. For now, I have my own .lua file in the exact same directory path as the required file and I have this code :
TraitFactory.addTrait("Undying", getText("UI_trait_Undying"), 10, getText("UI_trait_UndyingDesc"), true, false)```
Should I store my file in /lua/shared/ directly ? How to write the require argument ? What am I doing wrong ?
Look at the other mod, how is the filename of their file that their TraitFactory.addTrait call is being named in? Also, what directory path is it in under their mod?
@violet shell βπ»
A mistake when writing it in the xml ?
All I've done is overwrite the original game files, because I'm trying to edit the walking animations and stuff
So like, bar for bar, the xml file is the same as the original
require paths are absolute, starting from shared/client/server
e.g. shared/MyMod/MyFile.lua would be required as require "MyMod/MyFile" regardless of where you are calling it from
if the other mod adds its trait on an event (OnGameBoot is commonly used) you need to do it on that event too or your code will actually be running first
Reason: Bad word usage
it's : /lua/shared/insurgent/Traits/UndyingTrait.lua
And the begining of the file is :
UndyingTrait = CreateInsurgentTrait()
UndyingTrait.name = "Undying"
UndyingTrait.insurgentExclusive = true
function UndyingTrait.Create()
return TraitFactory.addTrait("Undying", getText("UI_trait_Undying"), 10, getText("UI_trait_UndyingDesc"), false, false)
end```
Which speed scale did you change ?
looks like they use a custom mechanism for registering their trait which isn't fully implemented in this file alone, it might be enough to just do this```lua
require "insurgent/Traits/UndyingTrait"
-- replace it with an empty function so nothing happens when it gets called
UndyingTrait.Create = function() end
Ok thanks, gonna try this π
I've tried changing the first one, and the one with Bob_Walk
@bronze yoke out here being an MVP! ππ»
Hmm
It didn't do anything ?
Perhaps try to modify directly in the game's files ?
Also it does run your animation ?
I didn't seem to do anything, no
My animations work - I ended up resorting to changing it in Blender
Did you try to put very high numbers ?
Yeah
@grim yarrow try changing it by higher number?
Off topic, but how's this for bad luck? In my testing for the animation (debug world so it doesn't matter), I got scratched and infected

Zombified off a single scratch
I tried numbers upward of 100, do you think it'll need more?
Rip
No lmao
You won't need more
Game freeze when loading the server (I'm testing on hosted server, not on my dedicated server)
I would like to dabble in making my own mods. How does one go about starting? As in, what sites/programs do you use and any tips are much appreciated
Pinged into resource thread.
Thank you

:)
fish.fish
I love and hate zomboids code
sorry for the late reply but hello XD, so your missing a , at the end of the line should look more like
model BenfordRifle
{
mesh = weapons/firearms/BenfordRifle,
texture = weapons/firearms/BenfordRiflePZ,
scale = 0.03,
}
But i assume someone by now has said something hope you got it fixed!
Yup, other folks got to it! However thank you anyhow!
your more than welcome! i love to help people! and if i cant help i know a lot of people here can do it!
I've been stuck on this for days, I can't replicate the functionality of distribution in a mod
I've managed to create the crate and getting it to spawn in lottable zones
but i can't get the items in it to spawn
it's possible to integrate traits Dextrous and Eagle eyed in character like passive function?
i mean, i want remove this is traits from the game, but functionality from this traits want on passive level
In general, to increase the viewing radius of characters and the speed of moving items, how can I do this?
Nowhere in vanilla did I find a dependence on the presence of these skills...
I believe it's handled in the java
ouh, i find for Dextrous (first scan be like nimblefingers, my wrong)
i can inject into this function? (not have skill to injected)
im just want to decrease maxTime
yep... EagleEyed javecoded(((
anybody here? ^^`
Yes
Just decorate the whole function and adjust its return value
Do you know basic function decoration?
yeeemmm....... ugh....
A is a name you make up, preferably in one of your modules that gets returned so people can have access to it for patches.
B is the exact name of the function you're decorating (ISWorldObjectContextMenu.grabItemTime)
you can write small example for module with returned?
how it should be right
just substitute any word for A, substitute ISWorldObjectContextMenu.grabItemTime for B, put (...) in both parentheses, and change yourAdjustment to .5. You'll move items twice as fast under all conditions.
like
zReIJECTOR = {}
local zReIJECTOR.old_ISWorldObjectContextMenu.grabItemTime = ISWorldObjectContextMenu.grabItemTime
ISWorldObjectContextMenu.grabItemTime = function(playerObj, witem)
return zReIJECTOR.old_ISWorldObjectContextMenu.grabItemTime()*1.5
end
return
?
Close. You need to declare old_ISWorldObjectContextMenu as a subtable of zReIJECTOR first.
Then you also need to pass playerObj and witem to A
._.
The parentheses beside *1.5 need the params from the function header
You could just use ... instead of writing the params though if you have no plan to use them
... can be used to receive and represent an arbitrary list of unspecified parameters after the specific parameters that are named.
I really don't understand what you're talking about...
E.g. you could do (playerObj, ...) and the ... would in that case represent witems
Or you could just to (...) and then ... is going to be playerObj, witems
You're very close already... The line under zReIJECTOR is needs a line above it that declares old_ISWorldObjectContextMenu as a table.
Declaring a table means writing variableName = {}
Try to see what I mean and apply that to this table.
I'll tell you if it's wrong
It's good for you π€ͺ
local zReIJECTOR = {}
zReIJECTOR.old_ISWorldObjectContextMenu = {}
zReIJECTOR.old_ISWorldObjectContextMenu.grabItemTime = ISWorldObjectContextMenu.grabItemTime
ISWorldObjectContextMenu.grabItemTime = function(...)
return zReIJECTOR.old_ISWorldObjectContextMenu.grabItemTime(...)*1.5
end
return
Very close. On line 2, you still need zReIJECTOR. in front of the word "old"
Since you're expecting to access that table inside zReIJECTOR everywhere else
Good afternoon
Almost perfect. Now add the parameters to the () beside *1.5
grabItemTime(...)*1.5?
You can do that, but if you write it that way (which seems like a fine idea here for now), you also need to change "playerObj, witem" to simply "..."
Your functions parameters are playerObj and witem
You need to pass them to the copy of the original function for it to work
If you want, you can change your parameters to ... and also pass ... to the copy of the original function.
Either way will work
I think I understand a little :Π·
Now the only thing you need to do is remove local from both of those lines
And you'll be golden
And if you want them to be local, just make zReIJECTOR itself local
But be aware you'll need to return zReIJECTOR at the end of the file and import it using "require" to use it in other files if you localize it.
Almost everyone here who has been doing this a long time will recommend you do that.
That should work
I've already worked on quality improvements to Mallet with CSS and some feature upgrades.
Although I imagine multiplying by 1.5 would slow you down
Rather than speed you up
Since it's calculating a time requirement
Not sure which one is your goal
ahh, yep, 0.5
At the bottom of the file where you say return, say return zReIJECTOR instead
return at end of file would do nothing
Need to tell it what to return
local zReIJECTOR = {}
zReIJECTOR.old_ISWorldObjectContextMenu = {}
zReIJECTOR.old_ISWorldObjectContextMenu.grabItemTime = ISWorldObjectContextMenu.grabItemTime
ISWorldObjectContextMenu.grabItemTime = function(...)
return zReIJECTOR.old_ISWorldObjectContextMenu.grabItemTime(...)*0.5
end
return zReIJECTOR
Returning the main module of the file is standard
And if you add anything else to that file, be sure to put it above the return line
An unavoidable return line generally needs to be last in any file (or function) in most if not all languages
should my lua file copy path of original function?
i can drop it everywhere into lua/client?
Yes; ISWorldObjectContextMenu will be available in lua/client before your code runs.
Without requiring it
thanks so much :3
hmmm... but how about this? It's not table, but... the structure is different... I canβt figure out how to make an injection here...
I wouldn't be surprised if you could. Allows spaces and relies on translations enclosed by ""... I'd expect most strings to be valid
(i know the EN doesn't but the others do, and the EN in theory could easily grab the whole line trimmed as name)
I do not know though
i'll try it out the hard way i guess lol
This is a complete shot in the dark but maybe someone will know something to point me in the right direction.
How does one determine player dead bodies and zombie dead bodies? In the sandbox setting, there is an option for player body to despawn at a different time than the zombies. What piece of code controls that sandbox setting?
In this case, decorate the same way, but instead of immediately returning A(...), you'll go local o = A(...), then o.maxTime = whatYouWant, then return o
First question: https://zomboid-javadoc.com/41.78/zombie/characters/IsoZombie.html#isReanimatedPlayer()
Second question: sorry, don't know that off the top.
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, class: IsoZombie
Oh wait dead bodies, shit... Hmm
yeah dead body
Javadoc Project Zomboid Modding API declaration: package: zombie.iso.objects, class: IsoDeadBody
exactly
Sorry misread @neat herald
public boolean IsSpeaking() {
return this.Speaking;
}
this.sayLine = var1.getSayLine();
this.SpeakColor = var1.getSpeakColour();
this.SpeakTime = var1.getSpeakTime();
this.Speaking = var1.isSpeaking();
eh
local zRePRREW_IJECTOR2 = {}
zRePRREW_IJECTOR2.ISInventoryTransferAction = {}
zRePRREW_IJECTOR2.ISInventoryTransferAction:new = ISInventoryTransferAction:new
function ISInventoryTransferAction:new(...)
local o = zRePRREW_IJECTOR2.ISInventoryTransferAction:new(...)
o.maxTime = o.maxTime * 0.5
return o
end
return zRePRREW_IJECTOR2
?
All good! Yeah was looking into IsoZombie and IsoDeadBody.
Cannibalism core was recently taken down and I am trying to find out the code functionality to recreate it from scratch
First of all I would recommend putting all clientside decorations in one file unless you're doing really massive filewide decorations. Like, if you're decorating 10 functions from 10 different files, I would definitely definitely condense that.
Just feels bloated to me to make a different parent table and file for minorly decorating each of a dozen functions in a dozen places
Hell yeah I support that goal, cannibalism is classic comedy that should be vanilla Zomboid if you ask me.
Second, when you decorate object functions, you reassign them to backup variables using . instead of :, even though the function is declared with a : in both the original stare and your override version.
So not ISInventoryTransferAction:new, ISInventoryTransferAction.new, on line 3
On both sides of the = sign
The other change you beed to make is that because this is an object function (as opposed to a static function) you need to pass the implied "self" variable before the ...
In other words, the second (...) will become (self, ...). The first, however, will not change, because the : format is responsible for passing "self"... It is not explicitly written in the function header.
And when you call your backup function, you will use . notation instead of :
you mean i can put all this injection into one place, without this stuff, just zRePRREW_IJECTOR and return zRePRREW_IJECTOR in the end of file?
Because YOU are manually passing self, not implicitly passing it.
Remove the second and third returns and refactor zRePRREW_IJECTOR 2 and 3 to just be the original. Put all decorations in one super table
Yes
Just delete 2 and 3 basically
And don't redeclare it over and over of course
That would wipe the backup functions each time you did it
don't understood about self...
ISInventoryTransferAction:new (character, item, srcContainer, destContainer, time)
i should copy like (character, ...)?
No
Your header is fine
Although you need to change the header back to : on the new function
I notice you changed it in wrong place
In the function header, you DO use :
Basically everywhere else you do not
-- ISDropWorldItemAction.lua (client/timedActions/)
zRePRREW_IJECTOR.ISDropWorldItemAction = {}
zRePRREW_IJECTOR.ISDropWorldItemAction:new = ISDropWorldItemAction.new
function ISDropWorldItemAction.new(...)
local o = zRePRREW_IJECTOR.ISDropWorldItemAction.new(...)
o.maxTime = o.maxTime * 0.5
return o
end
?
3rd line : should be .
or :new = :new?
Function line . should be :
-- ISDropWorldItemAction.lua (client/timedActions/)
zRePRREW_IJECTOR.ISDropWorldItemAction = {}
zRePRREW_IJECTOR.ISDropWorldItemAction.new = ISDropWorldItemAction.new
function ISDropWorldItemAction:new(...)
local o = zRePRREW_IJECTOR.ISDropWorldItemAction.new(self, ...)
o.maxTime = o.maxTime * 0.5
return o
end
local o line (...) should be (self, ...)
3rd line still needs fixed. Only the function line uses :
like this?
Yes that looks right
god, it's hard ^^'
So the idea here is that the function line is automatically receiving the object that calls it (the timed action instance in this case) as "self", which is basically a reference to the instance. If you don't know what an instance or an object is, you need to look into Object Oriented Programming a bit and get a feel for the lingo.
:new(...) is the same as saying .new(self, ...)
And therefore the true parameters that need to be passed when calling a function of an instance variable using . notation will be "self, ..."
If there is some way to extract the vanilla traits code from Java into lua? I need to extract some vanilla perks code, like organized or graceful
Hey guys,
I want to create a 0-1 frame animation to disable the hitreactionpvp animation and replace it
Please can someone help me or give me links to get information about animation creation on PZ ? π
Thanks
\ProjectZomboid\media\AnimSets\player\hitreactionpvp
Hey kERHUS
Yes i know it is about this file, but i just don't understand how to "CREATE" and after that how to "CREATE AN 0-1 frame ANIMATION" ^^
try <m_SpeedScale>0.01</m_SpeedScale>
<m_BlendTime>0.01</m_BlendTime>
Quick dumb question... What happens when 2 mods load a LUA File with the same name? Do they both get loaded or does one overwrite the other?
One overwrites the other depending on load order
PSA: Mod authors, don't worry too hard about updating mods to include a highly requested feature or most of all to meet the B42 update. For your own sake, take your time, and test thoroughly when able. Having a few "please update" comments is better than "why did you update / you broke my game" and feeling like you have to crunch for a fix / leaving things broken for extended periods.
Hi there, I'm still stuck with the "how to delete Unstoppable/Undying" trait from Insurgent mod. If anyone have an idea π
TraitFactory.addTrait("SlowLearner", getText("UI_trait_SlowLearner"), -1, getText("UI_trait_SlowLearnerDesc"), true);
where SlowLearner - Unstoppable / Undying
true - removed from create menu
Most people have accepted most mods will be broken anyway π - although it's a bit premature it can be a good "out".
This is original code of the mod :
return TraitFactory.addTrait("Undying", getText("UI_trait_Undying"), 10, getText("UI_trait_UndyingDesc"), false, false)
end``` so I tried this :
```TraitFactory.addTrait("Undying", getText("UI_trait_Undying"), 10, getText("UI_trait_UndyingDesc"), true, false)```
but it didn't work
filename?
of original code ?
original and your
UndyingTrait.lua for original, and Insurgent_Tweaks.lua for mine
I also added on my code a require to be sure my code is loaded after
U in priority
overwrite I
zzz_trait.lua
!!zzz_trait.lua
second has high priority and overwrite first
nevermind
your file should be in priority to overwriting
the path for sorting too (so server/a.lua -> server/a/z.lua -> server/b.lua )
b.lua overwrite a.lua and z.lua
Undying.lua is in lua/shared/Insurgent/Traits/, and mine was in lua/shared/
just rename your lua into !!z_
Sage advice.
Also when B42? ||I joke! I kid!||
No clue, probably soon, but wouldn't recommend planning a vacation around it lol
@violet shell this is actually legit advice with the way Lua loads in PZ.
Honestly the way some people talk about it's release you'd think it was holding up their life plans
Ok I'll try again with a file rename π trying it now
Probably can just name it z_undyingtrait.lua or whatever.
It's my money and I want it now? Only instead of money it's B42?
and my file only contains
TraitFactory.addTrait("Undying", getText("UI_trait_Undying"), 10, getText("UI_trait_UndyingDesc"), true, false)``` right ?
Yeah, then don't actually assign it to a profession, correct.
More like "I refuse to wipe until B42 comes out" + "It's your fault I smell!"
lmaooooooo
I think original code assign it to Insurgent profession π¦
Yes, but you are recreating a whole new trait that overwrites the first trait, so unless they are doing some additional wizardry there it shouldn't matter because your trait replaces the old one and is never reassigned... I think.
Yup, Undying/Unstoppable trait still available π¦
Insurgent Traits creation is quite complex, it uses 4 or 5 different lua files, with 5-6 different events
Woof...
I can copy/paste or put lua files here, but I don't know if it's ok
Anybody know how order for firing functions happens when an event fires?
That's something I haven't had to dig for. @sour island @bronze yoke ??? Maybe? β€οΈ
I would assume it is order they are registered in...
Generally yeah
Okay. If that is the case then we need to figure out what event they are actually registering their trait in @violet shell and do the same thing. If it's something like OnGameStart (I think...) then you want yours to run after.
I don't know the situation but why not alter the function they're using?
Is it accessible?
Events.OnGameBoot.Remove(original_traits);
Events.OnGameBoot.Add(BaseGameCharacterDetails.DoTraits);
Events.OnGameBoot.Add(BaseGameCharacterDetails.DoProfessions);``` in CreateInsurgentTrait.lua
Events.OnNewGame.Add(UndyingTrait.OnNewGame)
Events.OnGameStart.Add(UndyingTrait.OnGameStart)
Events.OnPlayerUpdate.Add(UndyingTrait.OnPlayerUpdate)
Events.OnDawn.Add(UndyingTrait.OnDawn)
end``` in UndyingTrait.lua
If you do yours OnGameStart it should happen after theirs, I would think... but Mr. Finn brings up a good point about simply overwriting their function...
local players = IsoPlayer.getPlayers()
for i=0,players:size()-1 do
local player = players:get(i)
if player and player:isLocalPlayer() and not player:isDead() and player:HasTrait("Undying") then
UndyingTrait.ResetCooldown(player)
end
end
end``` in UndyingTrait.lua
about function, I tried that :
-- replace it with an empty function so nothing happens when it gets called
UndyingTrait.Create = function() end```
Is UndyingTrait global?
And it didn't work : game freeze when I should arrive at the professions screen
Yes, but what if you updated UndyingTrait.Create instead like this:
function UndyingTrait.Create()
return TraitFactory.addTrait("Undying", getText("UI_trait_Undying"), 10, getText("UI_trait_UndyingDesc"), true, false)
end
The same way as you did last time.
ok, let me try
I don't need to add Events right ? I'll just use the original ones ?
I think the problem with this, is that I think the original mod assign the trait to the Insurgent profession already
so changing the boolean should not change anything. But I'm trying right now
So like this:
require "insurgent/Traits/UndyingTrait"
-- replace it with a profession specific trait
function UndyingTrait.Create()
return TraitFactory.addTrait("Undying", getText("UI_trait_Undying"), 10, getText("UI_trait_UndyingDesc"), true, false)
end
Oh... I see what you are saying... hmmm...
I think that I'll just put the price to 100 points, so nobody can buy it π
Hold on... where are they assigning the trait?
yup, Unstoppable/Undying still available with your last code
here ?
Couldn't you modify each of these functions to not assign the trait, on top of making the trait unpurchasable?
function UndyingTrait.RegisterEvents()
Events.OnNewGame.Add(UndyingTrait.OnNewGame)
Events.OnGameStart.Add(UndyingTrait.OnGameStart)
Events.OnPlayerUpdate.Add(UndyingTrait.OnPlayerUpdate)
Events.OnDawn.Add(UndyingTrait.OnDawn)
end
I can't remember how well unregistering events works...
I'll try to raise the price, and see if it works, first of all. Let me check and come back to you
ok
:``
function UndyingTrait.Create()
return TraitFactory.addTrait("Undying", getText("UI_trait_Undying"), 100, getText("UI_trait_UndyingDesc"), true, false)
end``` actually setup the trait at 100 points, as intended π
that's a start π
Can you explain me what do you mean ?
You might be able to modify UndyingTrait.RegisterEvents() and have it return false... maybe?
function UndyingTrait.RegisterEvents()
return false
end
That might not work if it that function gets called before your script runs, though.
ok, maybe the simplier way with raising the cost is enough for what I want, right ?
I have other issues for others mods to chat about π
Can I bother you a little more ? π
local AutotestTrait = TraitFactory.addTrait("AutotestTrait", getText("UI_trait_AutotestTrait"), -2, getText("UI_trait_AutotestTraitdesc"), false, false)
end
function AutotestTrait.OnNewGame(player)
if player:HasTrait("AutotestTrait") then
local inv = player:getInventory();
inv:AddItems("Asilar_Autotest_Knox_Infection.Autotest_KnoxInf", 3);
end
end
Events.OnGameBoot.Add(initAutotestTrait);
Events.OnNewGame.Add(AutotestTrait.OnNewGame);```
will this add a trait "AutotestTrait" and if player buy it, then it'll start with 3 "Autotest" from my mod ?
It seems like it should work just glancing it over?
?
It looks sane. π
I can't know for sure without running it. Most of my process is just trial and error! π
ok
just got an error, the game didn't like the AutotestTrait.OnNewGame π the dot was too much I think π
trying again with AutotestTraitOnNewGame (without the dot)
Wait... but you are defining AutotestTrait itself first?
I mean... that should work if so...
Okay. I see the problem. In your case AutoTestTrait is being assigned as a local variable to the result of a TraitFactory.addTrait call object.
ok, the trait appears on the list, but when I choose it, I don't spawn with the stuff I am supposed to get with the trait
I think I know where I made a mistake, trying again π
I have a question about models/icons
this is the 3Dmodel on the ground : that's fine
but in the inventory, how I can have an icon ?
I know before it was a .png in textures folder, with Item_Itemname.png, but seems it's not that anymore
Ok, trait is working as intended now π At least that's a win π
I don't remember how to do item icons. It's been a long time. π
I think it's still the same π
I used to use modData on items to give them "memory" in another mod I made. I wonder if I can use that on multiple items at once. For instance, can I inject some modData in the 3 items I give at start for those who buy the Trait ?
the goal is to inject in the item modData the name of the player, and then in the function I call to use it, it'll check if the player using it is the "owner" of the item.
This is a message to any modder who doesn't already, please for the love of god use notepad++ cause I didn't and my dumbass left out 2 quotes
which lead to this just
breaking
player:getID() is valid ?
I'm not sure how to get the Player ID, anyone have an idea ?
I think it's player:getUsername
Does anyone have a list of game events/usage? Or by chance, does anyone know if their is an event that is fired when an individual player kills a zombie?
Thank you.
If the code is ran client side, and the event fires, and I run code from that, it should only affect the client/player themselves, is that right?
Context: I'm trying to run code for a player when a zombie is killed by that specific player. Not just when a zombie dies in general.
At that event you can take the zombie's last attacker and compare with the local player
If they are equal do your thing
Do you have a reference for how to do that? It doesn't quite detail that in the list you gave me. Appreciate the help, I'm fairly new to PZ modding.
local function onZombieDead(zombie)
local lastAttacker = zombie:getAttackedBy()
local isoPlayer = getPlayer()
if isoPlayer == lastAttacker then
end
end
Events.OnZombieDead.Add(onZombieDead)
Thank you very much. Is there a reference for this zombie class/function, or the isoPlayer/getPlayer functions?
OnPlayerGetDamage
WOW
@bronze yoke what?!
this is event work on zombie too
i used it for my juggernauts:
local zReJuggernautOutfits = {
"zRe_Military_exo1",
"zRe_Military_exo2",
"zRe_Military_exo3",
"zRe_Military_Tractor",
}
local function zReZombieisJuggernaut(target)
local zombieOutfit = target:getOutfitName()
for _, v in pairs(zReJuggernautOutfits) do
if v == zombieOutfit then return true end
end
return false
end
local function OnWeaponHitCharacter(attacker, target, handWeapon, damage)
if not (target:isZombie() and zReZombieisJuggernaut(target)) then return end
if not target:getModData().zReZFlag then
target:setHealth(40)
target:getModData().zReZAbsorb = 50
target:getModData().zReZFlag = true
target:transmitModData()
end
if target:getModData().zReZAbsorb > 0 then
if handWeapon:isRanged() and target:isOnlyJawStab() then
target:setOnlyJawStab(false)
end
if not handWeapon:isRanged() and not target:isOnlyJawStab() then
target:setOnlyJawStab(true)
end
local AbsorbDamage = 0
if handWeapon:isRanged() then
AbsorbDamage = 1 -- need improve for weapon category/type/caliber etc
end
if not handWeapon:isRanged() then -- if melee, stagger on
target:setStaggerBack(true)
AbsorbDamage = 3 -- need improve for weapon category/type/one-twohands
end
target:setHealth(40)
target:getModData().zReZAbsorb = target:getModData().zReZAbsorb - AbsorbDamage
target:transmitModData()
--target:DoZombieStats()
else
target:setHealth(2)
target:setOnlyJawStab(false)
--target:DoZombieStats()
end
attacker:Say( "zReZFakeHP: "..tostring(target:getModData().zReZAbsorb).." Health: ~"..tostring(math.floor(target:getHealth()*100)) )
end
Events.OnWeaponHitCharacter.Add(OnWeaponHitCharacter)
Hey, I want to make a Gas Helmet mod, can someone direct me to some info or a tutorial, for the coding segment.
module Base
{
/* HELMETS */
item zReV2_1ECO_fullhelmet1
{
Type = Clothing,
DisplayName = zReV2_1ECO_fullhelmet1,
ClothingItem = zReV2_1ECO_fullhelmet1,
ClothingItemExtra = zReV2_1ECO_fullhelmet1A,
ClothingItemExtraOption = zReECOWear_2,
BodyLocation = FullHat,
Icon = zReV2_1ECO_fullhelmet1,
CanHaveHoles = false,
BloodLocation = FullHelmet,
BiteDefense = 100,
ScratchDefense = 100,
BulletDefense = 0,
Insulation = 0.70,
WindResistance = 0.60,
WaterResistance = 1.0,
Weight = 0.4,
Tags = GasMask,
WorldStaticModel = zReV2_1ECO_fullhelmet1_Ground,
}
}
@verbal yew Tyvm
Guid generate in internet
Free Online GUID / UUID Generator
for test:
first catch - trophy fish, i have 10 fishing level,
second catch - trophy fish, but i have 6 lvl (should be more then 8), generate new
chance like randomizer will be in the future
can only speak for my mods, They should update, I have A Large amount.
Pending actual release data on 42'
i can and will adapt, my stuff, etc
But im sure burnout will Hit Many Hard. So i hope people have a Very solid understanding of Patience
Feedback is always good, even if it isnt Shiny and Nice, π
Speaking of, do we have an idea how much the base code will change in B42/what type of mods are more likely to break?
I am currently like working on a decently big update for one of my mods and was wondering if I should wait till B42 to release it
i would expect literally anything to do with crafting at all to break
water containers probably won't be compatible with the new fluid system, weapons almost definitely won't be compatible with the new weapon systems
profession and skill mods are probably quite likely to break too as those systems are supposed to be revamped
basically - everything will break
for lua, anything that adds items to containers from the client side will probably break, and i'm sure there'll be api changes all over the place that break things
i think in most cases the work to port mods will not be colossal but i would expect few to work out of the box
thx god my zombie framework doesn't touch any of these points 
at least my entire mod won't need a rework lol
i'd expect zombies to have a different api
hmm
actually nah
there isn't any reasons for zombies to be changed, even with animals getting added
if they added animals with an entire new class
i was gonna say they'd probably be hooked into whatever the ai system ends up being but they already have some crazy ai stuff to optimise zombie hordes, i doubt the more general ai stuff would be too helpful for zombies
Didn't they plan on optimizing zombies actually ?
they're always optimising zombies
Or perhaps it was something else
that said, the interfaces for characters are probably the most prone to changes in the entire game, so i wouldn't consider them stable either
I'm not touching any of that either lmao
zombies are characters!
Yes I know IsoZombies are IsoGameCharacter :|
IsoGameCharacter is probably very prone to changes
But that mean they would have to rework IsoZombie if they made changes to IsoGameCharacter that could affect zombies then
And thus my mod DOES get affected
And anything related to zombies
yeah
If we go from this principle, literally the entire game is getting reworked
That doesn't make any sense
i'd just say it's very likely that a major update to a zombie game would include changes to zombies
even if i can't think of a specific planned one
I highly doubt they'll change the entire zombie framework, would literally require to rewrite everything related to them
i didn't say they would, though it wouldn't require them to rewrite anything to rename some methods
but it would require all mod developers to change it
Perhaps change one or two thing but what my mod does to zombies is actually fairly disconnected from the general stuff, I just access some info about the zombies and that's mostly it
i'm just saying i wouldn't expect the interface to stay exactly the same in any area of the game, let alone a central one like characters
But wdym by "interface" ? The UI ?
it's a general term for the functions and variables and whatever that a program makes available
in java it has more specific meaning which is somewhat applicable here but that's not specifically what i'm talking about
i've noticed a reluctance to make interface changes when avoidable at all but i don't expect the same from b42 since it's pretty much accepted at this point that it'll break every mod in existence into tiny pieces
didn't they mention in the last thursdoid the game won't even *load* mods that haven't been specifically updated? i don't think they've done that before
deliberately i mean, to my knowledge they're not overhauling how mods actually get loaded
π
They are making changes to mod IDs I believe ?
they are but i don't think we'll need to adjust for that
they're just appending workshop id to the mod id
Yeah
But perhaps mods with the workshop ID downloaded from the workshop won't work ?
Depends if they do it on workshop mod creation/updating
Or just on mod load
i think it'll probably be on mod load, if it's not it'll make dependencies annoying
Perhaps
Reuploading mods with the same ID to have them work for any other mod that depends on it probably won't work
And will require mods to update their dependencies
all the getActivatedMods():contains() calls π
Is there any way to extract the vanilla traits code from Java into lua? I need to extract some vanilla perks code, like organized or graceful
ThursdoΓ―d is published today right ?
yeah
@bronze yoke its possible to inject into java code:
public InventoryItem getItemFromTypeRecurse(String var1) {
return this.getFirstTypeRecurse(var1);
}
public int getEffectiveCapacity(IsoGameCharacter var1) {
if (var1 != null && !(this.parent instanceof IsoGameCharacter) && !(this.parent instanceof IsoDeadBody) && !"floor".equals(this.getType())) {
if (var1.Traits.Organized.isSet()) {
return (int)Math.max((float)this.Capacity * 1.3F, (float)(this.Capacity + 1));
}
if (var1.Traits.Disorganized.isSet()) {
return (int)Math.max((float)this.Capacity * 0.7F, 1.0F);
}
}
return this.Capacity;
}
public boolean hasRoomFor(IsoGameCharacter var1, InventoryItem var2) {
if (this.vehiclePart != null && this.vehiclePart.getId().contains("Seat") && this.Items.isEmpty() && var2.getUnequippedWeight() <= 50.0F) {
return true;
} else if (floatingPointCorrection(this.getCapacityWeight()) + var2.getUnequippedWeight() <= (float)this.getEffectiveCapacity(var1)) {
if (this.getContainingItem() != null && this.getContainingItem().getEquipParent() != null && this.getContainingItem().getEquipParent().getInventory() != null && !this.getContainingItem().getEquipParent().getInventory().contains(var2)) {
return floatingPointCorrection(this.getContainingItem().getEquipParent().getInventory().getCapacityWeight()) + var2.getUnequippedWeight() <= (float)this.getContainingItem().getEquipParent().getInventory().getEffectiveCapacity(var1);
} else {
return true;
}
} else {
return false;
}
}
public boolean hasRoomFor(IsoGameCharacter var1, float var2) {
return floatingPointCorrection(this.getCapacityWeight()) + var2 <= (float)this.getEffectiveCapacity(var1);
}
like lua
local zRePRREW_IJECTOR = {}
zRePRREW_IJECTOR.ItemContainer = {}
zRePRREW_IJECTOR.ItemContainer.getEffectiveCapacity = ItemContainer.getEffectiveCapacity
function ItemContainer.getEffectiveCapacity(...)
local this = zRePRREW_IJECTOR.ItemContainer.getEffectiveCapacity(self, ...)
if self.character -- check trait here should be then
this.Capacity = this.Capacity * 1.5
return this
end
end
only from the perspective of lua
local index = __classmetatables[ItemContainer.class].__index
local old_getEffectiveCapacity = index.getEffectiveCapacity
index.getEffectiveCapacity = function(...)
local capacity = old_getEffectiveCapacity(...)
if something then
capacity = capacity * 1.5
end
return capacity
end
what you are patching when you do this is the lua function that represents the java method, so it doesn't trigger your code if the method isn't being called from lua
hmmm... not working(
the visual weight has become larger (value), but the effective weight is the same...
i would check where this is being enforced
if it's enforced from the java side there isn't anything you can do with this technique
if it's enforced from the lua side you might need to patch a different method instead
ItemContainer.hasRoomFor is checked in the inventory transfer action

