#mod_development
1 messages · Page 510 of 1
I think your code is applied before the connection is completed tho?
Yeah, it should be restricted to admins only, but I use debug to test my MP stuff and it works, when locally hosted at least?
I might have to test with the default admin account named admin, not sure that has anything to do with it tho
It actually might.
Alright ill test and tell the result
Hmm... interesting. 🤔
I mean me writing shoddy code would be the least surprising thing. Maybe I accounted for that? Or maybe someone changed it after I left.
The block was built as more of stop gap measure at the time
Yeah, I do some really funky stuff in MP with global mod data and I couldn't imagine developing it w/o the access to veiwing GMD that debug mode provides?
Would be nice if isAdmin gave default access to debug tool
When I register for an even like this Events.OnPlayerDeath.Add(createToken);
The code is running on client side. how can I make the same subscription on server side?
How to make a custom skill or perk:
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/How to make a custom skill or perk.md
@keen temple
link is broken. i do appreciate documentation though as a noob lol
Known bug, the dev behind the foraging system told me it will be fixed eventually
Haha, yeah I change the name, fix
using username admin with admin access didnt work, same error in debug mode.
LOG : Network , 1642098528777> Delay processing packet of type IsoRegionServerPacket while loading game
LOG : General , 1642098528789> ===================================
ERROR: General , 1642098528790> java.lang.RuntimeException: Cannot override modID. ModID=pz-vanilla
ERROR: General , 1642098528791> at zombie.scripting.objects.Item.setModID(Item.java:3223)
ERROR: General , 1642098528792> at zombie.world.DictionaryDataClient.parseCurrentItemSet(DictionaryDataClient.java:37)
ERROR: General , 1642098528792> at zombie.world.WorldDictionary.init(WorldDictionary.java:213)
ERROR: General , 1642098528793> at zombie.iso.IsoWorld.init(IsoWorld.java:2296)
ERROR: General , 1642098528793> at zombie.gameStates.GameLoadingState$1.runInner(GameLoadingState.java:260)
ERROR: General , 1642098528797> at zombie.gameStates.GameLoadingState$1.run(GameLoadingState.java:217)
ERROR: General , 1642098528797> at java.base/java.lang.Thread.run(Unknown Source)
LOG : General , 1642098528798> WorldDictionary: Warning: error occurred loading dictionary!
ERROR: General , 1642098528800> ExceptionLogger.logException> Exception thrown zombie.world.WorldDictionaryException: WorldDictionary: Cannot load world due to WorldDictionary error. at WorldDictionary.init line:255.
ERROR: General , 1642098528801> DebugLogStream.printException> Stack trace:
zombie.world.WorldDictionaryException: WorldDictionary: Cannot load world due to WorldDictionary error.
at zombie.world.WorldDictionary.init(WorldDictionary.java:255)
at zombie.iso.IsoWorld.init(IsoWorld.java:2296)
at zombie.gameStates.GameLoadingState$1.runInner(GameLoadingState.java:260)
at zombie.gameStates.GameLoadingState$1.run(GameLoadingState.java:217)
at java.base/java.lang.Thread.run(Unknown Source)
LOG : General , 1642098528814> LuaEventManager: adding unknown event "OnPreUIDraw"
LOG : General , 1642098528815> LuaEventManager: adding unknown event "OnPostUIDraw"
thanks for letting me know, that was driving me nuts
i set my client debug mode through the .json file
ill try checing the server settings..
How are you hosting the server?
Dedicated server on linux ubuntu 20
The mod you are trying to debug is installed on both client and server?
Then I'm not sure I'm afraid, sorry.
Yeah no worry ill keep reading that source code xD
The error actually come from
--- scripting/objects/Item.java
public void setModID(String var1) {
if (GameClient.bClient) {
if (this.modID == null) {
this.modID = var1;
} else if (!var1.equals(this.modID) && Core.bDebug) {
WorldDictionary.DebugPrintItem(this);
throw new RuntimeException("Cannot override modID. ModID=" + (var1 != null ? var1 : "null"));
}
}
}
might have to validate files or reinstall maybe an scripts/items.txt has been edited by mistake nope
oh well ill have to live without debug mode 😆
seems the mods are not appearing on my game even tough they are enabled on the main menu, I'm forced to start a new game?
select your save in the load menu and then click "more" at the bottom and you can change its mods
thank you
When I register for an even like this Events.OnPlayerDeath.Add(createToken);
The code is running on client side.
How can I make the same subscription on server side?
does anybody know?
If it the event doesn't trigger on server side, you might have to sendClientCommand to a server script of yours to handle it.
how do I know what events trigger on what side?
you browse the source code
the Java?
yes you search your event in there and check if it run only one side or if both side are handled
you will see something like GameClient.bClient == true
😄
Thank you! These things are great for learning and practicing too
are silencers part of vanila game? or just brita?
is the Java code indexed somewhere or do I need to look at my local and decompile the java classes
You will have to decompile it, source code is not publicly available
you want OnCharacterDeath
yes or OnPlayerDeath
How to make a custom trait:
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/How to make a custom trait.md
I am gessing Character means more than just the players
also zombies and (eventually) npcs
that us very useful I ned to get the java decompiled
Otherwise all is on the javadoc
There is multiple way to decompile, one ive been using is capsid.
https://github.com/pzstorm/capsid
But i think other people just use some java decompiler which i never try yet
I could not find this info in the javadoc (known which side event fires)
everyone uses fernflower
they're just invoking it in a different way
a shame storm is abandoned
https://zomboid-javadoc.com/41.65/zombie/characters/IsoPlayer.html
This is the IsoPlayer class and you can see the sub class
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, class: IsoPlayer
@tacit ermine yeah but @weary matrix is back with some javamod
I already wrote my own framework
nice
I should make myself a java mod to enable debug mode but thats never that easy.
what do you mean enable debug mode? I just pass -debug on the command line
yeah i cant join my server with it, something wrong with items and world dict
How trivial would it be to make certain tiles (i.e. garage doors) invincible to player (or all) damage? (i.e. don't let players break garage doors)
is there a function I can hook into when a tile is attacked?
(not via Destroy - already figured this out, just via general damage)
if all you care about is debugging locally just edit the class
can just patch out the mod ID check
mhm ill check this out thanks
Is there a method to update client or server data for a player?
I noticed yesterday that If I have a client side code that uses AddExp() for example to give the player exp the client sees that instantly but I was logged it as admin and I did not see the other player change till he relogged
it's sent to the server every time you call AddXp
stats aren't usually networked to other players
the only time they are is for that admin panel
that is why the Admin player did not see the change
and the admin panel requests the stats from the server for the player you select when you open it
seems it does not do it every time
show your full AddXp call
one of the parameters is an option that prevents it being sent
if tostring(i) == "Sprinting" then
player:getXp():AddXP(perk, increaseXP/SandboxVars.XpMultiplier);
elseif tostring(i) == "Fitness" or tostring(i) == "Strength" then
player:getXp():AddXP(perk, increaseXP);
else
player:getXp():AddXPNoMultiplier(perk, increaseXP*4/SandboxVars.XpMultiplier);
end
seems the server gets it but the admin player does not see it reflected
yes, that's what I said
the admin panel has a special call to get stats for another player
is there a way to force it to resend it or refresh the admin player?
I see
well it is a minor issue
yeah you can probably just call the same thing the admin panel does
but it only works for admins
does the conditionmodifier mean that the item gets 20% more durability each time i repair it?
yeah, but after being scaled down by the number of times it's been repaired
and after applying the skill bonus
also is there a way to assign a custom sound to the fixing?
and what determines how much is repaired? is it the Fixer?
and what does globalitem do except for being used in all Fixers below
is it possible to persist a value in my server script after restart ?
it's the fixer, yeah, 4 things factor in:
- the material you're fixing it with
- the number of times the item has been repaired
- the difference in skill level from your character and the fixer skills
- the condition modifier
X axis is the number of times repaired, b is the difference in skill levels, c is ConditionModifier
2 scrapmetals should repair less than 1 smallsheetmetal in my recipe
it's order of appearance I think
switch(arg2.getFixers().indexOf(arg3)) {
case 0:
var4 = 50.0D * (1.0D / (double)arg0.getHaveBeenRepaired());
break;
case 1:
var4 = 20.0D * (1.0D / (double)arg0.getHaveBeenRepaired());
break;
default:
var4 = 10.0D * (1.0D / (double)arg0.getHaveBeenRepaired());
}
first gets a multiplier of 50, second 20, third 10
very good to know. thx
Anyone know off-hand if there's an existing Lua function I can hook into for this?
Can someone help me with JDGui? I cant decompile the gamefiles because I get this error: Unsupported class file major version 59
I run Fedora 35 with openjdk 17 installed and set as the used java version
I think it still uses my also installed openjdk 11, although I've set the 17 as my default version
Hey modders! I made a backpack that should only be spawned by server admins
Then I just create the item!
But in our server we found a zombie with the backpack... Theres a way to prevent it?
what does the script look like?
I don't think JD-GUI was updated to parse classes from Java 15 and later
use Fernflower in IntelliJ IDEA or recaf instead
Does it have a unique clothing item xml? I'm guessing it looks the same as a vanilla backpack, and uses the same clothing item .xml
When that happens, mod items using a vanilla xml, zombies can accidentally spawn wearing the mod item instead.
EDIT: You'll probably also need a filGuid xml file in your mod folder with that references the new clothing xml files if you add one.
😲 Thanks, will take IntelliJ then
Did you ever figure this out? I think it has to be in a.pack file. With chat bubble (https://steamcommunity.com/sharedfiles/filedetails/?id=2688676019), I discovered my image file HAD to be in a .pack file.
i used the default decompiler jar in intellij from the command line then do the browsing with jd-gui seems to work fine
ClothingItme = Bag_BigHikingBag is your problem, see my reply above.
oh sure
I just want the same bag, but with a different skin
And I want to do it with a lot of itens
just another skin
but only for admins
then I will need to create the xml?
well, if you want it to be visible then yes
I already see some of theses xmls from others mods
but how I can generate thats ids?
have some tool?
any guide link or something like this?
Free Online GUID/UUID Generator
ohh thankyou
This seems to be the go-to guide for adding clothing items; some of it won't be applicable, in that you're reskinning existing models and not making new ones, but it should cover all the necessary stuff for adding you admin items?
https://steamcommunity.com/sharedfiles/filedetails/?id=2648115890
I will check now! Really thanks
🤙
Yeah! I think just the part of the guide about the xml already solve all my problems!
how can i make an item spawn equipped to a zombie
This is how I do it? Modded items so it's not a vanilla example.
Anybody using Filibuster Rhymes' Used Cars? Wanted to ask if there's any good sports car
Damn I wish people weren’t such gate keepers in this community, completely toxic as hell. @drifting ore bless your heart, people have a lot to learn from you.
Was just messing around with the attechement editor in debug mode, and found there's an attachement point for "knife_belt_back", which when parenting a knife to it, put's it to the back, as if there was a back belt slot. Hints at a future feature? A leftover from a mod? Watcha think?
Anyone else getting stuck on "loading scripts" when launching zomboid? Only thing that fixes this is reinstalling zomboid, and everytime I enable my custom modifed mods like GunFighter Custom, Brita's weapon pack Custom, it just gets stuck at "loading scripts" forever again
Dead link
Official Dislaik's Documentations
Do we agree it's the same as the steam guide?
steam guide?
Some dif but rly similar
Default Occupations and Traits updated to work using the Profession Framework.
(I wasn't sure if the Github version was totally updated or missing something, so I did the list myself and checked each one using the Vanilla , the Wiki and the Lua files itself. I Think I didn't miss any. Even added some of the deactivated ones if anyone wants to mess with it)
any good UI mod, like diff icons
the ones in the PF might be outdated, thats why they're still in the examples i havent checked in a while. cant confirm the .RemoveDefaultProfessions and traits flag is 100% working in all instances (ie: mp respawns etc) i havent fully tested. the require a the top there is unnecessary
Btw this help alot on the server side
how would i add custom text so that i can use getText() on it?
Check the files in lua/shared/Translated/
appreciations!
Made that quickly this evening
https://github.com/MrBounty/PZ-Mod---Doc
It's a bunch of info to help modding
oh really? How?
why is player:getBodyDamage():getBodyParts() giving an err of '_len not defined' ? I can see that bodyParts in object stack has a bunch of values btw.
in making a mod using the PF that's gonna be used in multiplayer tomorrow, so if it works properly or not, I will be sure to report it
But hey, thanks for making this great tool, it's really useful
ah cool thanks. i suspect it will work fine but havent just tested that part yet
I'm currently making server side mods
in java and noticed a pattern that some changes are easier done in lua that java
since editing class files is not fun with all the errors
since on server side steam doesn't do anything, ur changes are safe
as an example I added combat logs to a server I'm in
in a different file and several new admin commands
however when it comes to adding something like a reputation system it would be much nicer to use lua
and since your framework can add lua callback that means less changes have to be made on the java side
__len is length
you're trying to get a size on it?
@ionic galleon ah yeah I see. So you've made javamods already?
quick recovery
yes
or rather kinda they are intended for to be used on the server side alone
@ionic galleon hmm so for example if you add a global function only on server side, you can still call it from client side or what?
no, the idea is like consider something like a proper combat log
here is an example
[13-01-22 21:08:28.072][PVP] MikkiGBreezys attacked Goggarinn and did 0.5 damage.```
ah I see
or another example is event boards
custom admin commands
only need to be added on the server side
I do the same to export metrics from the server to Grafana
lots of use-cases for server only mods
you would need to add your class manually to commandBase
since they don't use reflection at all
for whatever reason
@ionic galleon what do you mean manually?
Is there a mod to adjust reading time? I checked the usual sources and found nothing. I triple checked the sandbox settings and couldn't find anything there. The trait is laughable and not worth taking.
you have to edit commandBase
and add your class to childrenClasses
Hmm, so with the new additions of the global ModData in 41.51, does that mean the old ways of things such as local gt = getGameTime(); local modData = gt:getModData(); is obsolete? Do I need to change everything over to using the ModData.get() etc functions?
@ionic galleon yeah but you can do it directly from a javamod using a Patch?
no need to recompile it yourself I mean
u need to.
you can modify classes at runtime before they load
commandBase doesn't check for sub types
@ionic galleon just implement getPatches() in your javamods and you won't need to recompile anyting 😛
well, I'm a dot net type of guy and to me not having function and field pointers just breaks me
wait what :/
function and field pointers?
since it's just a pointer
@ionic galleon here's a Patch example with a javamod to increase MaxPlayers: https://github.com/quarantin/javamods/blob/main/src/javamods/mods/MaxPlayersMod.java
however if you interrupt the loading of a dll you can even add fields and enums in runtime
i was going to threaten u to make a wiki
xD
yeah, you can do the exact same thing on the JVM
I'm not afraid of your threat, want me to give you access to the project wiki? 😂
well, that would make my threats feel empty I would have to find something else to threaten u for
smh
yeah of course
DROPKICK MOD
also after a lot of tuning we managed to hit 128 player server
trying to iterate to get each burn status with isBurnt()
Did you try ?
local bodyParts = player:getBodyDamage():getBodyParts()
for i=1,bodyParts:size() do
local bodyPart = bodyParts:get(i-1)
bodyPart.isBurnt()
end
local bodyParts = player:getBodyDamage():getBodyParts();
for i=1,bodyParts:size() do
local bodyPart = bodyParts:get(i-1)
if not bodyPart:isBurnt() and player:isOutside() then
bodyPart:setBurnTime(10);
end
end
its pretty much the same thing but i get the len error
and in objectstack it shows theres body parts
Where do you can that ? Maybe before the player is create
You might be applying getBodyDamage() to the wrong "player"?
The code uses player for the player index and player object indiscriminately, so it can be confusing sometimes.
I get player with specficiplayer by online id
and the obj stack thing shows the right player because I can look at the name
Where can I see the IP of my server In game ?
The error is at for i=1,bodyParts:size() do? can you paste the console.txt where is the error ?
😛
what do you mean pretty much the same thing?
if you've wrote #bodyParts, that'd be wrong
So wait size() shouldn't be size()-1?
It's gotta be your player being incorrect.
tempTestFunc = function(key)
if key == 51 then
local bodyParts = getSpecificPlayer(0):getBodyDamage():getBodyParts();
for i=1,bodyParts:size() do
local bodyPart = bodyParts:get(i-1)
if not bodyPart:isBurnt() and getSpecificPlayer(0):isOutside() then
print("true")
end
end
end
end
Events.OnKeyPressed.Add(tempTestFunc)
[0][1][2]
i=1-1 =0, i=2-1=1, i=3-1=2 - I guess not nvm
I got the booster shot yesterday, so the 5G is killing my brain rn
Lmao Chuck. Giving you a ping @lapis stump so you don't bang your head for too long.
Has anyone already launched two games, create a server on one and join it on the other?
you need to do it in non-steam mode iirc
My exemple come from vanilla game file so I dout
I exclusively use i=0, size()-1, just for legibility reasons -- just got confused cause it seems like the code is otherwise fine
How are you getting the player tho? cause as others have mentioned that's rather important
i have sp and mp functions to get player
Yes, very useful for testing MP stuff. If you're not aware, you can launch more than 1 instance by changing -Dzomboid.steam=1 to -Dzomboid.steam=0 in the bat files that launch the game/server:
\steamapps\common\ProjectZomboid\ProjectZomboid64.bat
\steamapps\common\Project Zomboid Dedicated Server\StartServer64.bat
Hmm, those are the only 2 changes I made. Well, that and making sure I launch the game with ProjectZomboid64.bat
Are you manually opening your ports? You will need to increment 1 for each player
Nop, do I need for local ? I was hoping not
I don't think so, I have my firewall and everything on and it functions fine.
in debug mode is there a faster way to heal player from injuries ?
Tick god mode on/off
i still die from burning/bleeding
Odd, it always heals me.
invincible cheat or god mode something else ?
It's under general debuggers:
or N
Ahh, yeah it's also the key 'N'. I forget about that, much quicker.
yep god mode is working ty
@brittle jewel When I connect my second game I get Error: already authenticate. An idea ?
Hmm...do you have the whitelist enabled on your local server? Maybe that's it?
Wait no, it didn't save when I did steam = 0
Lol that'll do it!
both need to be steam = 0 ?
ip has to be localhost iirc
You know where I can find it ?
I tried, the non steam game find the steam server but don't want to connect
oh you need to run both in non-steam
and the steam game don't find the non steam server
That what I trough
Thx
Bruh i'm so done with mod uploading to the workshop, current system sucks ass
The mod followers must be tired of redownloading small patches
they get wound up if their server's not updating but it's a tiny fraction
nothing to lose sleep over
Oh yeah, specially with how happy i am with the result ^^
Now i can finally do a full cryogenic winter run without issues 
Do you know how to pass one in debug mode ?
Pass one? You mean get into the server with the debug client?
Yep but not the steam version
When launching with the .bat?
Yes
Ahh okay, just add -debug to the end of the line starting with ".\jre64\bin\java.exe"
Nice thx
Client only, I don't think you need to/can make a server debug(?)
Ok good to know
For y'all's Dedicated Server needs: https://pzwiki.net/wiki/Dedicated_Server
Just make sure you have your user you'll log as with admin access level or the server may not let a -debug client load in
You can always setaccesslevel username admin in the server console to allow them in with debug
Ok I will put me admin, I was wondering how
Are there any mods for like... Multi-generator efficiency, or auto-generator-switching? Not being able to leave home for more than 24 hours before your Gen turns off is bunk
Can I add code to all isoGenerator ? And trigger it every hour
if I wanted to persist a table between server restarts how would I do it?
hmm interesting thx
is player:getUsername() the account name people register w/ on whitelist servers?
Is there a way to get the current color of the a players hair and make the worn item that color?
I have noticed that if you edit (with debug mode) a revolver or handgun's stats to have minimum recoil time/recoil delay, the rate of fire is basically as fast as you can click.
Is there a way to achieve a similar result with the m16 ? Or is there a way to speed up the fire rate ?
I hear people keep saying that ItemTweaker is obsolete. Does Vanilla PZ support a way to nonitrusively change items now?
always has?
getScriptManager():getItem("Base.BaseballBat"):DoParam("Weight = 30")
which is what i'd imagine ItemTweaker does essentially, but probably in a cleaner format (never really looked)
Is there a staightforward way/guide to mod an existing game trait? I found resources on how to add new traits. I haven't found anything about modding a trait, especially a trait on an existing MP server and character. I just found this message, is that pointing in the right direction?:
#mod_development message
@willow estuary I'm sorry, am I an idiot or is this not working?
I think I took it one step too far on the MRE Chicken before trying to use the heater?
Is plastic pipe a vanilla item? Need it for silencer (which is a modded item)
part of me wants to make a "cowboy" mod that adds dusters and period firearms but another part of me knows that that is foolish
I mean there used to be a really cool wild west map
So wild west themed items would be cool
Trying to call ModData.transmit("myModTableKey") from the server to send to the client, following the instruction:
void ModData.transmit(String key)
- this will attempt to transmit the table with given key, when called on server this is send to all clients, when called on client send to server. (see note on receiving moddata below)
This triggers the OnReceiveGlobalModData event on the client perfectly with the key, but it seems to be missing any modifications I made to the table.
Am I missing a step somewhere?
i think its becouse your bottle is favorited
i had similar issues reported to me and favorited tools was the cause
Specifically, it seems to not like me doing this:
GlobalModData.somePlayers[target] = target where target is an IsoPlayer
Don't use craft helper. Craft helper does not provide accurate information whether a recipe passes all the tests required to make a recipe or present the tool tip information associated with recipes.
b41 Craft Helper is also half a year behind the changes to the vanilla crafting.
As recipes get more sophisticated and take advantage of the fancy new features that were added, and will continue to be added, to the system, I imagine that craft helper will continue to provide even more inaccurate and confusing misinformation to people that use it.
Learned that just any 'sub table' will not be transmitted through the network.
I'm only using craft helper in this case in an attempt to illustrate my confusion with a picture.
In this case I seem to have all the usual necessary prerequisite materials to heat the MRE that I'd just opened, but for some reason I couldn't and I couldn't figure out why.
Only booted up craft helper after I was having issues cooking the MRE I'd opened.
How feasible is a Zombie Starvation mod? Like, over time, zombies eventually just starve to death and die? I'm thinking in the sense of 28 Days Later, where the infected starve to death 4-5 weeks after the initial outbreak, allowing NATO to begin reconstruction efforts.
It would be interesting for those attempting a 28 Days Later style run, surviving long enough for the majority of infected to starve to death, but small pockets of infected will remain here and there to make enough a threat, alongside respawn times if set right. So the peak populations starve, but respawns still give you the threat of infected.
I think it'll make the game too easy
You can just gather food, get a van and sit on the wilderness for 4 weeks near some lake
Although I barely survived for 1 week
Now that I think about it, zombie starvation mod would add a possibility of winning. Just make it no respawn as a new character and that would be pretty interesting.
anybody knows what this entry is about?
item Glue
{
DisplayCategory = Material,
Weight = 0.1,
Type = Drainable,
UseDelta = 0.2, <----------------------------------------------- ????
UseWhileEquipped = FALSE,
DisplayName = Glue,
Icon = Glue,
Tooltip = Tooltip_FixItems,
SurvivalGear = TRUE,
WorldStaticModel = Glue,
}
Numerical value associated with how quickly the item drains.
It has five uses, in that 1 divided by 0.2 (the Use Delta) = 5.
the delta of an item is 0 (empty) to 1 (full)
so if i want like a large glue i could just make a new item and set the UseDelta to 0.1 then i could use 10 times?
more or less, yeah
the weight have nothing to do with it?
no
but then how come the water bottle change the weight as we drink it?
well yeah, item weight will decrease with each delta use
PagMan
it's pretty straight forward. it - like everything else in PZ modding - has it's quirks. the decimals get a little silly sometimes; when setting a usedelta of 0.1, it doesn't use exactly 0.1 of the 1.0, never really figured that out
on the glue case there would be 0.1 kg for 5 uses so 10 uses would be 0.2kg and delta = 0.1 makes sense i think i saw the glue weight 0.08 once when i used it playing
i will test that out and let u guys know later
thanks!
that's what wiki says

are you guys still alive btw
idk like 15 maybe
we added a shit ton of mods
its pretty cool except the fact we have to restart the server for each mod update
:((
:MEGADANK:
NotARealName was right i just test the regular glue in-game and it wont reduce weights with uses
the only difference i found betheen water botle and glue is this
CanStoreWater = TRUE,
i guess only water and gasoline do that
it's probably coded in the engine
i guess
its not a big problem for me anyway i still can make my large glue lol
i just give it more weight i guess
PZ give us just this school glue 😄
Finally finished modifying 217 music files in zomboids music bank to create the only working music replacement mod on the workshop for build 41
idk ..to stop everyone from jumping into cars stright away i guess
hmm, all of my drainable items decrease in weight as they are consumed...not sure why your results are saying otherwise
also ReplaceOnDeplete = WaterBottleEmpty,
I guess the difference between full glue bottle and empty one isn't big
and not neccecary to add
weight is always updated upon use of an item, referenced from zombie/inventory/types/DrainableComboItem.java ... you can have some control over it; you can use WeightEmpty = n when defining your item to have it scale from it's starting weight to that weight instead, when used. so yeah, the change on woodglue with it weighing 0.1 would be negligible
it says DrainableComboItem
so do you have make like full glue bottle and empty glue bottle
for it work
Anybody make a mod that makes zeds just as affected by fog and snow as you are..? This is ridiculous.
No - a drainable item is removed when it is depleted, if replaceOnDeplete isn't set
oh
If i add a vehicle mod to an already established server will the vehicles spawn in undiscovered areas?
I guess, I never use it
Can I add code to all isoGenerator ? And trigger it every hour
I think world generates when you create it
you need to add a few more mods, at 150 mods it shows like it has no mods at all xD
took me long enough, but it was staring me in the face "player.say" is the client side of life, where it doesn't even interact with chat and thus never gets passed on the server. Why did I have to try it even after being warned? because I'm stubborn ^^'
Still have to wait for my mate to connect the server (cos my machine cant handle 2 pz open) but solo testing did gave me the "chat interaction".
My only doubt is: does it trigger the sound? (not shout, just "speak" sound - as that would be neat)
does anyone know why, when I edit the "RecoilDelay" of a revolver to be 0, on MP I can shoot a fast as I can click but on single player (with debug mode) it is much slower ?
I've noticed server mods aren't loaded when you solo
the same goes for client mods when you host
makes sense, but I'm not using any mod here
oh, then I'm at loss :)
just clicking on "edit item" with the vanilla revolver
do you know if there is a way to increase the rate of fire of firearms ? or is there a fix value ?
wouldn't know. I myself have been just trying stuff out. I would search on the media/lua/shared lua files
I remember having seen a file with revolver on its name, and a couple of others with "reload" on it -- you might find clues there
thank you
anyone know any good modding tutorials? It doesnt have to be this game I'm just trying to get a good starting point. I'm not all that new to coding in general, just the game side of it
i guess it depends what you want to do, i followed one to make firearms yesterday and it was very helpful
i just created a rifle, do you know why i can't attach anything to it ?
is there any easy way to make my own moodles?
That would be a great start. I want to try and make a gate that opens via remote. just trying to start from the bottom
tbh i just opened the events webpage
and from there
if u click on any class
it takes u to a gigantic list of all classes in the game
so i just use that
that and i dont think there are a lot of tutorials
yeah i kept seeing that PZ documentation is pretty spread out haha. I'll check the events! Thank you!
thats why i dont really mind if someone sends me other game tutorials.
well i watched the ones from blackbeard, not very in-depth but what i needed
I'll start with his vids. Thanks for the advice man
How can you make your challanges
Is there a way to call a function after the player has eaten food?
I'm making a trait that makes you not lose happiness when you eat bad food, I'm planning on using profession framework to implement the traits
anyone knows where can I see the red errors that pop up when stuff breaks? is it actually logging it somewhere?
cant remember which file it place them in but if you run zomboid in debug mode it should auto press f11 to see the errors
just remember you cant join a server with out admin account if you open the game in debug mode
@thin hornet going to be a damn long messenger you going to type
@iron salmon Is it possible to remove the debug check that throw and stop the game from running in future patch please.
In: zombie\scripting\objects\Item
Line: 2661 to 2664
public void setModID(String var1) {
if (GameClient.bClient) {
if (this.modID == null) {
this.modID = var1;
} else if (!var1.equals(this.modID) && Core.bDebug) {
WorldDictionary.DebugPrintItem(this);
throw new RuntimeException("Cannot override modID. ModID=" + (var1 != null ? var1 : "null"));
}
}
}
This check only throw in debug mode on a MP client.
It is useless as it is now, cause it doesn't give info about what exact item is faulty.
Without debug mode you can join the server and the items are working.
With debug mode it just throw for but doesn't help in anyway to fix the "problem".
Error that it throw look like:
java.lang.RuntimeException: Cannot override modID. ModID=MyModWhatEver
When it should:
A) Tell what item is fautly
or
B) Do nothing just like without debug mode on
Thanks TIS if you can fix this.
would it not be better to post a bug report on the forum rather than pinging a single dev on discord
that message is gonna be like 20 pages up within the hour
This is why i pinged Nasko directly, so he can relay it to the dev team.
At least that what i was told to do at some point in the past.
But yeah might as well just try it on the forum im just not very active there.
oh fair enough
this channel moves quite fast, I jsut assume things would get missed
you can post without an account on the TIS forum, I think
beause the game is set to be in 1993 xD i see what you did there ;P
yea even the bug forum is more or less useless xD
i guess that why he ping the person so he can get right to the place for the messenger
So guys, im trying to override some Base items in a scripts.
But t with debug mode game wont let me join, without it i can join and the overriding works.
almost no one ping me ^^but i only have eneable direct ping
im trying
module Base {
imports {
Base,
}
Wouldnt't that be the proper way of doing it?
you just have to be admin on the account ot join the server with debug mode?
Yeah join in debug mode is ok
Im allowed
The thing is that check i filled in the message to nasko
It throw an error just because debug is on
I'm so damn confused where is the code that handles the food unhappines O.o.
media\lua\client\TimedActions\ISEatFoodAction.lua has no reference to UnhappyChange
i think it based on the item and not the action it self ?
Like, inside the action of using the item?
it's not Lua, it's Java
public float getUnhappyChange() {
float var1 = this.unhappyChange;
if (this.isFrozen() && !"Icecream".equals(this.getType())) {
var1 += 30.0F;
}
if (this.Burnt) {
var1 += 20.0F;
}
if (this.Age >= (float)this.OffAge && this.Age < (float)this.OffAgeMax) {
var1 += 10.0F;
}
if (this.Age >= (float)this.OffAgeMax) {
var1 += 20.0F;
}
if (this.isBadCold() && this.IsCookable && this.isCooked() && this.Heat < 1.3F) {
var1 += 2.0F;
}
if (this.isGoodHot() && this.IsCookable && this.isCooked() && this.Heat > 1.3F) {
var1 -= 2.0F;
}
return var1;
}
item:setUnhappyChange(0)
Well, it's gonna be dirty but should workd
// InventoryItem
public void setUnhappyChange(float var1) {
this.unhappyChange = var1;
}
that won't work
that's just the base value used in the calculation of getUnhappyChange
you'd need to set it to something that zeroes out after those additions/subtractions
Maybe this? with ofcouse the check for the trait
local function NukeUnhappyfood()
local player = getPlayer()
local p_h = player:getStats():getHunger()
--print("AUTO EAT (onevery10minutes)","hunger:",p_h)
--if p_h > 0.15 then
local playerInv = player:getInventory():getItems()
local mmfood
--print("HUNGRY")
for i=0, playerInv:size()-1 do
local item = playerInv:get(i)
if item:IsFood() then
item:setUnhappyChange(0)
end
end
--end
end
Events.OnPlayerUpdate.Add(NukeUnhappyfood)
because In my head I was hoping for An even to listen to, or a function hook (like in pd2 modding)
this is gross but this'll do it:
local unhappiness = item:getUnhappyChange()
item:setUnhappyChange(-unhappiness)
yep that
Okay I understand
Now question is, how do I make this run on the item before eating? I would need to hook to the function of eating
Like a prehook
, at least that's how I would do it when modding a game like pd2
local ISEatFoodAction_perform = ISEatFoodAction.perform;
function ISEatFoodAction:perform()
if i have the trait yo then
local unhappiness = self.item:getUnhappyChange()
self.item:setUnhappyChange(-unhappiness)
end
ISEatFoodAction_perform(self);
end
pd2? payday?
yeah
like unit testing ? ^^
It's on all food eaten if you have the trait
then a check for the trait will do
nothing wrong with rotten food if you have 7 in cooking ^^
One trait give you no unhappines when eating sad food, the other will give you 50% more sadness.
It's kinda of a joke traits duo. British and Italian trait. I'm making it for a friend of mine
Thank you
We are trying to roleplay as ourselves in our server lol
And I make the mods needed to do it
so you eat rotten food irl?
is it possible to toggle shader on/off in LUA?
@thin hornet have you tried to make 3D model change 3D model over time ? and if so is it easy or hard? ^^
my friend probably can, holy shit that person has no taste buds whatsoever, while I want to cook tasty stuff
what shader are you trying to toggle?
custom shader for water droplet effect
Like having the 3d model of an in-hand model changed based on some properties?
you just want to see how it looks without the shader?
more like 3D model onGround.
no i want to toggle it on/off only if its raining and im wearing mask/hazmat suit
Not sure you can do that cause changing the model would probably change it for all items
oh
look at how rainbarrels work
those change sprite as they fill
could presumably do the same thing with a model I guess
rainbarrel are isoboject/tile tho
sfix 3d object is like the can food you can place on the disk and so on
I think this is causing a stackoverflow
lmao yes
can you show error tho ?
Sure
DROPKICK MOD PLEASE
Should be this, if there is a different way to show me pls tell me cause im still noob at zomboid modding
easier if you copy paste from C:\Users\YOURUSERNAME\Zomboid\console.txt
my eyes cant read the screenshot atm
when I select the mod from select mods
@thin hornet btw konijima why dont you use a real barrel valume for the fuel barrel in the fuel API ?
or make it like sandbox variable
Yeah that was the problem, the error was thrown by the missing poster.png
I can still read logs, yey 
The amount can be changed for custom barrels but the vanilla one i default it to 400 like the rain barrel cause it doesnt have the fuel property by default and i'm not overwriting it at all.
But yeah i could make it a sandbox variable thats a good idea.
also i could make an option to allow picking it up with liquid in it
ill check this out thanks
i know it dont have the fuel propety by default because was thinking to make another kind of mod and use the same vanilla barrels ^^ which might make conflics for the mods but nothing other then that
FuelAPI only check if the custom name is Barrel so technically all isoobject with custom name Barrel will act as fuel container
The new barrel from the military outpost in LV is not a barrel its a metal drum so im happy about it cause that would have been a problem
i know already had a look into the cooding to see how you solve the problem ^^ only because i didnt knew how to grab a isoobject
Ah cool glad it helped
Log reset when starting the game, so if game crash read the log before launching the game again
Good thanks
Now I need to sort out why the code is doing notthing 👀
but my lunch break is nearly over
Does ItemTweaker allow tweaking base recipes?
If not anyway of tweaking recipes?
I mean, im trying to override them right now, but MP debug mode kill my game Grrrr
is it possible like to make a mod that change the inventory hud of pz
I think all GUI and hud is Lua script if so yes it is?
Great
Would it be possible to mod they zombies so the look different? Maybe so the zombies look like something from a H.P. Lovecraft novel
there's a mod on the workshop that adds a new equiped hud sooo you might want to look at it (search for "equiped" you should find it)
does anyone know where the vehicle damage values are i.e. how much hitting a zombie damages your vehicle
i'd also like to change how much failing to install a part damages it
i at least know its in the java code
PUNCHING MOD
TerrorZeds managed to give the special infected different looks
probably is possible to change the zombie models
definitely the zombie skins
adding more I have no idea but it's probably do-able
Yea, wasnt thinking to add any, just maybe reskining. Just throw the idea out there. I'm no modder, was just curious if it was possible
Does someone know what exactly the "Survivalist" ZoneDefinition is?
I imagine it could mean this "tent camps" in the nature
Yeah that's a good idea. Survivors could settle fights the good clean way with boxing.
If I do something like that:
local function everyTenMinutes()
local player = getPlayer()
local modData = player:getModData()
-- Code
player:transmitModData()
end
Events.EveryTenMinutes.Add(everyTenMinutes);
Is it going to be call for every player in a server ?
I forget exactly where they're stored but I'm pretty sure they're just in the normal base game directory unpacked so you just mimic the folder structure with your new skins that match the same names
yeah there we go
roblox looking motherfuckers
yeah but that would replace it for all the zombies
yeah but there are different zombies
each Zombie skin tone could be different
and male/female
We could probably also add more if we figured out how the game allotted these textures and added more to that table
and have a mod that adds more
idk if that's too close to the bone though
theyre based on skintone though
so if a player turned into a zombie theyd have one of them based on their skin colour
yep
If you wanted the zombies not to make people that way you'd probably have to add more skins that only are assigned to zombie gen
player:setHealth(0)?
One message removed from a suspended account.
Anybody up to making a more interactive discord bot with the game? Just to receive certain info such as how many players in the server, weather conditions, what mods are installed. Just an example of a couple
I tried adding MinutesPerPage= to my Sandbox Preset and it didn't work.
Does this only work in the Server.ini?
Is there a reason why player:getModData() would return an empty list? player is an isoPlayer
I don't get a nil but an empty list, what i find weird because I use onCreatPlayer to init some variable in modData
show the full code and the context it runs in
does anyone know what variable/flag/whatever allows shotguns to shoot at multiple things at the same time ? I'm pulling my hair out rn
ProjectileCount = 5
what i thought but i created another weapon that has projectilecount 5 as well but it can only outline 1 zombie at a tim
Sorry, ahahaha, there's multiple ones
MaxHitCount = 4
yeah, put that one too !
Oh shoot, well the approach I would try would be to take the vanilla shotgun item script, copy it and change the name/display name to what you're trying to make.
Then, testing as you go, change this new script into the script for the weapon you want to make?
Shotguns work for this, so if you take the shotgun script, and modify it into what you want, then it should have that property?
yeah, i guess that's what i should do then... Thanks !
Good luck! Looking at the shotgun script I also see MultipleHitConditionAffected = FALSE, I have no idea what that does, but maybe that's the missing part?
what's the metal value ?
Oh, that was used in the disabled former blacksmithing system that was before my time?
i think it means that if you hit multiple ombies there is a multiplier to the condition damage the weapon takes (like an axe)
Yeah, that's what I would guess? Just a shot in the dark given that it references the multiple thing?
i suppose
Taking a vanilla item, and "swapping" out the values to the item that you want to make is a pretty solid method though; it's my go-to.
doing it rn, if this doesn't work i'll sleep for 48 hours straight
That sometimes can help as well 😄
quick question while we're at it
i made a rifle but can't attach anything to it, do I have to make .x files of the rifle with all attachments ?
Nah, weapon attachments can be completely separate models, and that how it's generally done?
I don't know of any specific guide to the subject, but something on this might help: https://www.youtube.com/playlist?list=PLwV27NP3RkJl27tveCa9EMMvAdjmGXZsf
I'm familiar with using it, the weapon attachment stuff code wise, but I've never made anything for it model-wise so I don't know the nuts and bolts of that end?
You can also use .fbx files instead of .x files FYI, it can be easier, although they need to be reduced in scale vs the x file format version, seems to be a fair bit too at .01/1% IME?
Ok, so I want to add an option in the health panel when you right click.
For the moment it works fine in solo or in MP on oneself but in multiplayer on another person, the modData is empty.
The handler of my timed action
function HCutArm:new(panel, bodyPart)
local o = BaseHandler.new(self, panel, bodyPart)
o.items.ITEMS = {}
o.bodyPart_TOC = find_bodyPart_TOC(panel.character:getModData(), bodyPart)
return o
end
It's at panel.character:getModData() that I get en empty table
I also tried panel:getPatient:getModData() but same
The panel is here media\lua\client\XpSystem\ISUI\ISHealthPanel.lua
I'm not sure if other players mod data is ever sent to you, will have to look
I tried adding MinutesPerPage= to my Sandbox Preset and it didn't work.
Does this only work in the Server.ini?
Mmmmm so how can I have acces to the modData of an other player ? Can't I ? I'm affraid to have to use global moddata and that would lead to redo a lot of code
yeah i tried this and it didn't seem to work... Not the priority though. And the shotgun thing, it worked !
🤙
doesn't look like you can
afaict it's only networked for objects
Is there an event like onPlayerConnect to get the isoplayer of a player that connect to a server ?
there's a global function to get the list of connected players IIRC
First make it functional then do it in an event.
Start by having a loop on the server that checks all clients
Or just all players
Or even use OnPlayerUpdate
btw -- any way of having code completion for lua on vs code ?
no
Ok I will need to check every x time I guess, that stupid. I just want to init some variable when somebody connect
can't you use onConnected and then getPlayer() ? (https://pzwiki.net/wiki/Modding:Lua_Events/OnConnected)
OnConnected is a client event
any way of know beforehand on the wiki? because the page says nothing about that (or.. im blind)
no, I just looked for where the java code triggers it
I should be able to use it. I request the global data, add my data and return it
Every thing on client
do you only care about running it on the client?
@tacit ermine when the event is triggered from GameClient or GameServer it's easy but otherwise do you have a good way to find out that could get automated?
I've been working on a IntelliJ script that walks the call tree and looks for an if (GameServer.bServer) but it's pretty tricky
What I did back in the day: send a comment from the client to the server once the OnConnected event is fired
right now I still just read the code manually
yeah ok
I don't even know that it's rly mean to run code on server or client xD So I guess client is enough
guess I should just take some time to hardcode this info in my wiki scripts
@drifting ore my rule of thumb is unless you know you need it on server side, it should be client side 😛
best I have right now is a script that automates the parameter types of events
Hahaha, that's exactly what I was thinking 😂
check out zdoc and intellij's emmy lua plugin
as for vscode, no
Btw I gonna make a tuto to add an timed action to the health panel when I gonna finish understand, it might help some
i don't really care for the vscode, as long as I can have code completion for pz functions :P
[also, intellij rules.]
other thing, surely there's a getKey(keycode) that returns the ascii of that code, right ?
Keyboard.getKeyName(keycode)
man. I need to read some manual ^^'
yeah, I meant text -- essentially I don't want to get stuck on the keycode because that can be a different key for anyone
and I'd wager there's no way of adding a custom key for a thing, right ? that'd be too good ^^'
hey uh sorry to bother you guys
nope
how do we turn on mods on a server ?
custom key?
user A chooses "k" and user B chooses "j" but both do the same
uhhh
keybind! thats the name
maybe you can hook into that though
the game options menu is in lua
and that does remapping
(I just thought of that. I'll have to read more on the subject; I'm a complete noob at lua and pz)
actually you should use Input.getKeyName
Keyboard.getKeyName doesn't handle shift modifiers the way you'd expect
would be an edge case, but thanks for remembering :)
the options code just stores the keycode in GameOptions
Anyone know how to create a Vector2 instance? Im having trouble with that
Ah
theres a junk lua file at shared/Util/Vector2.lua that overrides the Vector2 java class. you'll have to replace the file with a empty one to properly create a new Vector2 instance
Haven't tried that, i was trying to create one with Vector2()
You're a blessing
but ya, as sfix said Vector2.new(x, y) will work once that junk file is dealt with
oh weird, didn't spot that file
does kahlua let you specify a fqcn? maybe zombie.iso.Vector2.new(...) works without getting rid of that file
not sure i've ever tried? as far as i recall though the Vector2 class isnt used in the lua at all beyond that junk file (least wasnt last time i looked)
yeah I don't see anything besides some uses of a different Vector2f class in the vehicle debugger
ya
I have a client lua file that will load for one server but not the other. I'm only loading the file on the client. The 2nd server is looking for the file to be on the server also. Anyone have this issue or know how to resolve this?
Both servers are mine. Would settings do this?
yes you can make it just as 1 item
Is it possible to make a zombies vision so low that they can't see you?
Try #mod_support for support of how to use mod, this channel is for help people that make mod ^^
Hey guys, quick questions. Is there any way to affect zombies in dark areas to be sprinters? More of an ~I am Legend vibe~
There's already a mod for that I believe it's called night sprinters.
Well It would work in a different manner, mostly related to zombies inside warehouses or houses without any light source to be effectively sprinters
Even at Day time and such
guys what is your opinion on this; on my mod there is a bunch of cosplay outfits, should i make them all so they cant be ripped? some will be expensive and players wont want to acidentally rip the ones the are not wearing, should i take it off?
you could always just make it repairable ? if it is? isnt it level 7 tailoring there make perfect repair ?
no thats is another thing, they are repairable like regular clothing, but ripping is another set
ohh i see 🙂
yeah basicly if you remove this:
FabricType = Cotton,
you wont be able to rip it for straps
i guess i will remove it from all my outfits prb
hey i made this new Glue here, its working the model and such, but its not fixing my spear like the regular glue, i prb need to set another thing than just the item itself
i copy from the glue item:
item Wiz_LargeGlue
{
DisplayCategory = Material,
Weight = 0.4,
Type = Drainable,
UseDelta = 0.05,
UseWhileEquipped = FALSE,
DisplayName = Glue Bottle,
Icon = Wiz_LargeGlue,
Tooltip = Tooltip_FixItems, <-------------i tought this alone would able it as a glue, but i think i need more coding here
SurvivalGear = TRUE,
WorldStaticModel = Wiz_LargeGlue_ground,
}
when i click the spear the option to fix with my glue wont appear
cotton 😮 look like you need a havest for that xD lol
did you remember to make a fixing.txt file and added this clue to each item ?
how do i make it so a tool loses condition after being used in a recipe?
no u need a fixing too? cool i will try
something with unit
ah yes thanks man
🙂
fixing Fix Door Welding
{
Require : FrontCarDoor1;FrontCarDoor2;FrontCarDoor3;RearCarDoor1;RearCarDoor2;RearCarDoor3;RearCarDoorDouble1;RearCarDoorDouble2;RearCarDoorDouble3,
GlobalItem : BlowTorch=5,
ConditionModifier : 1.2,
Fixer : SheetMetal; MetalWelding=3;Mechanics=2,
Fixer : SmallSheetMetal=2; MetalWelding=3;Mechanics=2,
}
I dont think you can make specific items for "fixing"
you would have to add them to the existing scripts for fixing items
the Tooltip is the description of an item.
yes i need to add my item like this:
fixing Fix Axe
{
Require : Axe,
Fixer : Woodglue=2; Woodwork=2,
Fixer : DuctTape=2,
Fixer : Glue=2,
Fixer : Scotchtape=4,
Fixer : Wiz_LargeGlue=2,
}
for each thing the glue fixes
yes
ubt keep in mind
the higher up the fixer is the more durability it will repair
i wonder if i need to repeat the others or just like set something like this
so right now becouse its at bottom, your glue will fix only 1%
fixing Fix Axe
{
Require : Axe,
Fixer : Wiz_LargeGlue=2,
}
this would also make duct tape worse tho
switch(arg2.getFixers().indexOf(arg3)) {
case 0:
var4 = 50.0D * (1.0D / (double)arg0.getHaveBeenRepaired());
break;
case 1:
var4 = 20.0D * (1.0D / (double)arg0.getHaveBeenRepaired());
break;
default:
var4 = 10.0D * (1.0D / (double)arg0.getHaveBeenRepaired());
}```
i dont know if you overwrite vanilla fixing with this
hum i dont have to change that too do i? where is that file from
yeah lol prb should do the other way
i dont get that
what tool you look for ?
i dont understand the order of the fixers say how much they fix? so what is that number 2 and 4 there?
first gets a multiplier of 50, second 20, third 10
hmm cant remember damn im sry djvirus
hum if i set like this, my large glue will fix just like the glue?
fixing Fix Axe
{
Require : Axe,
Fixer : Woodglue=2; Woodwork=2,
Fixer : DuctTape=2,
Fixer : Glue=2;Wiz_LargeGlue=2,
Fixer : Scotchtape=4,
}
lol i never seen that on the code
its often used in recipes
this is so confusing.. i dont even know what those numbers mean now
with ducttape is 2 and scotch is 4?
i will try now
or you can fix 50% with half a roll of duct tape
lol i dont know why but this Glue=2/Wiz_LargeGlue=2,made all my custom models disapear
what you trying to do ?
i set the way you told me
fixing Fix Axe
{
Require : Axe,
Fixer : Woodglue=2; Woodwork=2,
Fixer : DuctTape=2,
Fixer : Glue=2/Wiz_LargeGlue=2,
Fixer : Scotchtape=4,
}
it make most of my icons and models disapear lol
make my glue work like the regular glue
since djvirus told me if i stick them on the order i will mess around with the below items fixing power
ohh you want your glue work like normal woodglue ?
this will mess around vanilla mechanixs
i think the way they code this is horrible tbh
fixing Fix Axe
{
Require : Axe,
Fixer : Woodglue=2; Woodwork=2,
Fixer : DuctTape=2,
Fixer : Glue=2,
Fixer : Wiz_LargeGlue=2,
Fixer : Scotchtape=4,
}``` just do that for now
that will make scotchtape fix only 1% acording to Djvirus
i dont want my mod to change anything on vanilla coding
also my glue would be worst than the regular glue
tbh this makes absolutly no sense to me
why they code it like that...
of the % fixing ?
off course...this should have a script to give each item fixing power stats separate
now make the order determine that is pretty lame imo
still something is from javacode hmm cant remember where the % fix is place if it lua or java code
strane why they game dont accept a 'and' entry there
not good idea
switch(arg2.getFixers().indexOf(arg3)) {
case 0:
var4 = 50.0D * (1.0D / (double)arg0.getHaveBeenRepaired());
break;
case 1:
var4 = 20.0D * (1.0D / (double)arg0.getHaveBeenRepaired());
break;
default:
var4 = 10.0D * (1.0D / (double)arg0.getHaveBeenRepaired());
}```
first gets a multiplier of 50, second 20, third 10
@mint sphinx
if they have a 'AND' that is ';' there should be a 'OR' too, and its not '/' aparently
so that the java code ^^
very frustating this 😦
try to make a new recipe
maybe it doesnt overwrite it, but add it
i doubt it but i will try
like this right
fixing Fix Axe
{
Require : Axe,
Fixer : Wiz_LargeGlue=2,
}
if it not working just change the name abit like fixing fix axe2
if it make a conflict
yes
you cant do that
it checks for the itemname
there is no "axe2"
thats why you dont need to write translations for fixer
the item name is the Require : axe
and yea i know translation is a bit annoring sometimes 🙂 but easier then doing them in barothauma
you might year sadly
what im setting doing right now for my framework try to make all the translation correctly ^^
but if you change the name of the recipe it wont mess around the links tiba?
like virus say you might need to do a translate files
so the translatation link would be missing
ok guys so this works, but it does override lol
fixing Fix Spear
{
Require : SpearCrafted,
Fixer : Wiz_LargeGlue=2,
}
i will try to give it a new name like tiba said
dont do mine if that one work
i also know why my outfit disapear; when you create new recipes you mess around the orders i guess
but look if you get dubble recipe in the recipe book for fixing the spear
it does not work man, it Overrides vanilla recipes, so my glue works and the vanilla one dont now
yea this way it works
fixing Fix Spear2 <----- new recipe name
{
Require : SpearCrafted,
Fixer : Wiz_LargeGlue=2, <--- new item
}
where i see the 'fixing spear recipe on the book again?
now just need to set that scale lol my glue is not THAT big
thank you both for the help!
look like a small bottle of glue you have on that picture xD
lol
i wonder if this set will mess around the fixing power order or just make it as my glue is a extra 1st item
i think your glue will just be do as normal so you glue will count as a repair
i just test it does not look like regular glue lost power
yeah i guess this will work 🙂
i just delete the items that dont use glue and replace the name of all the recipes, putting a 'wiz' prefix
fixing Wiz Fix Spear
{
Require : SpearCrafted,
Fixer : Wiz_LargeGlue=2,
}
regular glue have 5 uses mine should give 20
but i notice that 2 means it uses 2
so to fix a spear it will have 10 uses i guess
like the regular glue have like 2-3 uses
depends on delta uses
item Glue
{
DisplayCategory = Material,
Weight = 0.1,
Type = Drainable,
UseDelta = 0.2, <------ lower amount more usages the item has
UseWhileEquipped = FALSE,
DisplayName = Glue,
Icon = Glue,
Tooltip = Tooltip_FixItems,
SurvivalGear = TRUE,
WorldStaticModel = Glue,
}
yeah i know i set delta to 0.05
okay ^^ 🙂
thanks 🙂
i fill some of the code or item usages is like spaghetti code ^^
what is really pain to do are tiles, i just wanted 1 tile on my mod but i dont know if its worth to make it
im using a 3D item for now
yea.. its a machine, the machine that able the player to trade things of my mod
i wanted it as a tile, so it could be solid and clean and all
size of a oven more or less
how do you build it ?
a normal recipe ?
but still its not a tile, so people can walk trough it
yeah its a recipe, player build it and place it
because you could always try to make it as a building option
and then just make a picture of your 3d model to make it to 2d ^^
like a steel crate?
i guess you could do that then just the propeties you have to transfere to the tile/isoobject
When I do getScriptManager():getItem("Base.Bag_Schoolbag"):DoParam("WeightReduction = 95"). It works fine in singeplayer but in multiplayer the value only changes when I spawn the item in using cheat menu. Every time I tested I made a new world and checked spawned items and their value remains the same. The file is in the server folder(but have also tried in client and shared). could someone help me by telling what's wrong?
im modding this game for months now and i never was able to create a server, not even without any mods, it just bugs after i try to load again, tbh MP need a lot of work yet
the thing is that i cant make the tile appear in-game, i made just like the mod 'immersive solar panels' and the tile wont show
since its just 1 item i might try to find someone to do it for me
and credit the person later
I see. One weird thing is when I use ItemTweakerAPI it works fine, but for my specific use case ItemTweakerAPI won't work so I can't use it
when i create a server, it works, i play, when i exit the game and enter again, the world simple wont load, this happened to me everytime i made a server
no mods
can I get a list of players around a certain player, by any chance?
(I'd think I'd need player xy and then *n that and check if onlineplayer is inside that?)
awyeah. getPlayer().BodyLocation :D
(wait. reading the docs... it feels like my legs can be on another location than my body ... ... is.. is that a thing?)
Hey there ! Somehow, an item i made shows only half of its texture ! The rest is pitch black. The "colormap" looks correct and works fine in blender.
look on the bright side, at least you see half of it :D
True ! I just don't understand why...
Either a magic trick or a landmine, but yes
ooooh! I didn't know that that was a thing ^^'
so, I'm assuming players xy = heads xy? :P
Wait i was just kidding ! I have no idea
bruh
nude mod ?
what lmao
oh yeah i use that mod and your clothing one
😳
😳
I was curious so I took a look at the docs, as a disclaimer I'm not PZ modder so take what I say with a grain of salt. What you found was an enumeration of main body sections (I say main because it lacks the more specific subdivisions). I think what you want is getX, getY and getZ which are inherited from IsoMovingObject, or maybe getFacingPosition. There are a couple of other things which seem like positions (getLrx, getLx) but those ones seem like the most likely to be basic positions (this doesn't directly answer your question about getting players around a player, but hopefully it helps you get there)
Oh actually, there's also DistTo (& DistToProper, dunno the difference) which accepts another IsoMovingObject. That'd probably be easier for comparison
Man tress are such a blight in the erosion system, they spawn at such an unreasonably high rate.
I want to catch the erosion actions, check for tree spawning and check their tile, see if it's gravel (since we can make gravel paths), and stop them from spawning, but can't figure out where to even start with it.
Hi hi! How do you guys insert an image with a link in the steam description?
I try to use
<a href="URL">
<img src="imageURL">
</a>
But it reads it as a text 🤔
I can't really find a comprehensive list. This one is from steam but it's old as heck.
https://steamcommunity.com/comment/Guide/formattinghelp
Images are [img]image[/img] and you would want to wrap that with a [url=] so: [url=google.com][img]image[/img][/url]
Daaaamn thank you, it worked!
Also, before you go through the headache of trying to center it, here's something I use for that too: https://center.steam.design/
@opal wind yeah, but it does start, it just slows it some, the spawn rate of trees after a couple months is still ridiculous. And I want people to be able to put effort into paving a road to eliminate the issue.
i agree yeah, kinda hard to do thou, hope you manage!
🤔 interesting, but didn't understand how to use it lol you place the text (in this case [url=] so: [url=google.com][img]image[/img][/url]) and then press center?
@opal wind I'm confident I could if I knew any events or the like that I could hook into, documentation isn't ideal
hi, first time trying to create an MP server with a few assorted mods that i've picked in the workshop and when i start the server, it just gets terminated and idk what's wrong
i've enabled everything in MODS from the main menu and added everything in 'Steam Workshop' and 'Mods' in the Server Settings and i'm not sure where else to look
hi there! currently working on a mod an need a random number in my lua code. more precisely, i have an array called "colors" and i want to randomly pick an element from it. so i need something like "colors[i]" where i is a random integer between 1 and the size of the array. in vanilla code, the devs often use a construction like "ZombRand(#colors)" in such a situation and i'd like to try to use "ZombRand" too. But how exactly is ZombRand defined? What can it take as arguments and what output does it produces? many thanks!
Correct. It isn't perfect with images, but with some manual adjustment it looks good. That's how I centered this:
Here's a pretty good resource about ZombRand: https://theindiestone.com/forums/index.php?/topic/15376-how-zombrand-works/
TLDR: ZombRand(5) possible values = 0, 1, 2, 3, 4
many thanks!!
Start with your c:\users\username\Zomboid\console.txt if hosting in game, or server-console.txt if using dedicated host. Start from the last line and read up, hopefully you'll see something.
that post on ZombRand is incomplete
@LuaMethod(
name = "ZombRand",
global = true
)
public static double ZombRand(double var0) {
if (var0 == 0.0D) {
return 0.0D;
} else {
return var0 < 0.0D ? (double)(-Rand.Next(-((long)var0), Rand.randlua)) : (double)Rand.Next((long)var0, Rand.randlua);
}
}
@LuaMethod(
name = "ZombRandBetween",
global = true
)
public static double ZombRandBetween(double var0, double var2) {
return (double)Rand.Next((long)var0, (long)var2, Rand.randlua);
}
@LuaMethod(
name = "ZombRand",
global = true
)
public static double ZombRand(double var0, double var2) {
return (double)Rand.Next((int)var0, (int)var2, Rand.randlua);
}
@LuaMethod(
name = "ZombRandFloat",
global = true
)
public static float ZombRandFloat(float var0, float var1) {
return Rand.Next(var0, var1, Rand.randlua);
}
theres multiple variations on it
Looking for some advice here, my dynamic radio channel isn't be initiated in MP despite it following the exact same principles of the vanilla automated ones
I was trying to register the dynamic radio to my global mod data, but global mod data is loaded after the radio, so it doesn't exist yet
it works ofc in singleplayer, it's purely a MP issue
so, if my array stores values for i=1,...,5, i need array[ZombRand(array:size())+1] to generate a random entry?
Could you see if you could load the radio, or your radio part, after the world is loaded?
Oh, the world doesn't instance until a player is connected?
LOG : General , 1642213565688> 0> name = Automated Emergency Broadcast System, freq = 103000, cat = Emergency, uuid = EMRG-711984
LOG : General , 1642213565689> 0> Found radio channel: Automated Emergency Broadcast System, freq = EMRG-711984, freqcheck = 103000, multi = 1
LOG : General , 1642213565690> 0> scriptmanager = zombie.radio.scripting.RadioScriptManager@38caad46, isNewGame = true
LOG : General , 1642213565691> 0> Loading Facility-7 Radio
LOG : General , 1642213565692> 0> name = Secure Insurgent Frequency, freq = 600000, cat = Military, uuid = INSR-59755
LOG : General , 1642213565693> 0> Found radio channel: Secure Insurgent Frequency, freq = INSR-59755, freqcheck = 600000, multi = 1
LOG : Radio , 1642213565694> 0> Radio setting new game start times
LOG : Radio , 1642213565694> 0> Time since the apocalypse: 1
LOG : Radio , 1642213565694> 0> Radio loaded.
LOG : Radio , 1642213565694> 0> ################################################
LOG : Radio , 1642213565694> 0>
LOG : General , 1642213565694> 0> Facility-7 Mod Data has been initialized!```
thats the order it does it in right, as that is sp, but it very possible that it doesn't load properly until a player connects
I could attemp to load the radio at the same time that I initialize the mod data
not exactly, if its a java arraylist, then array:get(ZombRand(array:size())...if your dealing with a lua table list then array[ZombRand(#array) +1]
and no, sadly, this doesn't seem to work.
thanks for the hint. but i think it is the table (at least they apply the function table.insert to it....)
The vanilla game attaches the mod data to Game Time for the radio, which is what I originally had but that also didn't work
to explain, the basic usage of zombrand will stop at the number given as a arg (if theres 5 items in your list, it returns 0 to 4, but not 5), #array returns the number of items (ie: 5), lua will index that table list as 1 to 5 so you need to add +1 to the result, (otherwise your trying to fetch items 0-4, not 1-5)
With my own stuff, I think Global Mod Data becomes accessible after CharacterCreationProfession.initWorld, or it's other equivalents? This is client side, mind you, but in both SP and MP? (although after the first time you load into a world with global mod data, it appears the global mod data remains accessible after quitting to menu for SP).
Interesting, alright, that explains some of its bizare behaviour
Yeah, the "phantom global mod data" may even persist in MP, albeit I think that's just a client side copy, and not any remaining connection to the server?
But it complicated developing funky stuff that uses it 😄
The issue appears to be a mix of that, combined with the fact that if I don't add the radio during the radio load sequence then it doesn't actually get added..
sadly the radio loads before the global mod data, so I can use the global mod data for lots but not the radio..
Could you modify your radio station to comply with the mod data record at a later point after the radio load sequence perhaps?
...probably not that flexible however.
Hmm, I could try to grab the moddata from gametime and assign it to the global one from the server
I recall that mod data stored to game time was unreliable in a MP context?
That might be the reason the global mod data system was added in 41.5.
thats the issue i'm running into, is it purely unaccessible or just locked behind server or client?
My experience was that it wasn't actually persistent? game time mod data that is.
I use global mod data, the system added in 41.5, exclusively on account of that.
And sorry, if you were talking about game time mod data throughout our convo, then the info I told you about when and how it loads was in regard to the global mod data, not game time. My bad.
i also made a Disinfectant Gallon (x4 times more quantity) its a little bit different from the glue (fixing item), the tooltips to use it are separated (or they will carry the same name ingame)
the regular game uses disinfectant to produce 'alcohol' cotton hehe
Yeah thats why I've switched, its just that the radios load before moddata smh
Ah okay, good, was worried there was a miscommunication 😄
Aha no no, we're on the same page lol
Okay, so I don;t have a handle on the specifics, but you can record and load data to text files on the server instead of using mod data?
Oh? perhaps that is what is needed..
This is some code that a friend hooked me up as a reference, for some future plans I have in that vein. So I saved it, but have never tried it or anything?
function loadFunFile(filename)
local file = getFileReader(filename, true) -- goes in the Zomboid/Lua cache directory, true/false to create the file if non-exsistant (i think? cant remember)
if not file then return end
local lines = {} -- empty table for now
while true do
local line = file:readLine() -- read a line, not sure if BufferedReader class can return the whole file at once.
if line == nil then -- nothing returned, end of file, close and break from loop
file:close()
break
end
table.insert(lines, line) -- add the line to the table
end
return loadstring(table.concat(lines, "\n")) -- join the lines togeather with "\n" and load the string. not sure if the readLine() strips file endings, so read them just to be sure
end
local someFun = loadFunFile("somefile.lua") -- store it in a variable.
someFun() -- execute the function
The loadstring function is similar to loadfile, except that it reads its chunk from a string, not from a file. For instance, after the code
f = loadstring("i = i + 1")
f will be a function that, when invoked, executes i = i + 1:
i = 0
f(); print(i) --> 1
f(); print(i) --> 2
and the link they provided me with https://www.lua.org/pil/8.html
thats for executable code though, not quite a mod data replacement
Hmmm, alright, well then close but no cigar...
Yeah, sorry, I've dabbled with more relevant stuff, data itself that is, being recorded to file and such, but it was a long time ago?
well the concept is kinda the same, just need to chop out some code (and add some more for writing the file)
Meant to mention this earlier, I looked at the docs when you initially posted your message. The NatureTrees erosion category class might be helpful, but I couldn't find anything about events bc I don't know how zomboid handles them. There was a method that had something to do with validation, but presumably that's called internally & I wouldn't know how you'd override it without recompilation if so
Yeah it's all good, I can see that it just reads the file and executes what it reads. I'd need to add the whole writing segment like Fenris said
Unsure if it's exposed by pz, but the Lua standard library has utilities for io
Which includes file writing
writeSettingsFile = function(tbl, filename)
local file = getFileWriter(filename, true, false)
if not file then
return
end
for key, value in pairs(tbl) do
file:write(key .. " = ".. tostring(value) .. "\r\n")
end
file:close()
end
readSettingsFile = function(tbl, filename)
local file = getFileReader(filename, true)
if not file then return end
while true do repeat
local line = file:readLine()
if line == nil then
file:close()
return
end
line = string.gsub(line, "^ +(.+) +$", "%1", 1)
if line == "" then break end
for key, value in string.gmatch(line, "(%w+) *= *(.+)") do
tbl[key] = value -- note that value will be a string, you may need to convert to number or w/e
end
until true end
return tbl
end