#mod_development
1 messages · Page 242 of 1
Huh, how come?
it isn't?
He fixed that a while ago, he no longer sends the table but the boolean
yo guys what about talking?)
Am I not simply passing a boolean to the function?
Yeah, I got rid of the table
What more is causing it to not work? :O
well, i must have missed that. i'll go back to learning then
The problem is that
function AcidRainDamage()
end
Events.EveryOneMinute.Add(AcidRainDamage)
Events.EveryOneMinute.Add(AcidRainDamage) does not give arguments to the function added to it
https://pzwiki.net/wiki/Lua_Events/EveryOneMinute
So you can't have an argument there
Let me write you something that fixes your entire thing bcs shit's stressing me out lmao
Oooooh, I didn't catch that, but that's true
Hahaha sure, I only started learning Lua as well as modding PZ like two days ago so there's still a lot I need to learn
But it's very fun once whatever you're making actual works
yeah np, got to start somewhere
and it’s even more fun when after updating the mod the game stops starting and the error in the debug clearly does not indicate the line))
Wait why do you even need that entire server side command thing ?
You want to have the rain toggle on and off ?
Eventually once I wise up I'd like the server to be able to schedule different rain events, my reasoning behind doing it this way is that once my custom rain event starts it will toggle the damage the player takes from rain on/off. Without the toggle the player gets damaged by all rain
Overall cleaner code, got to fix the whole command thing using OnGameStart which can't be used here
You can do something cleaner with a cleaner base like this
There's most likely a few things here and there to clean
But this should teach you on or two things
ello, does anyone know where to find definitions or stats for containers? Not bags but like furniture such as fridges?
Good question actually
Awesome, thank you! I'll give it a look! :)
Wouldn't if isServer() then return end have the opposite effect of not running while it's run on the server?
You are right actually
Or am I mistunderstanding how it works
I was just going to ask what the "not" operator was haha
Something to know:
Servers load:
- /shared
- /server
Clients load:
- /shared
- /server
- /client
On an unrelated note, what are your opinions regarding easter eggs in other people's mods?
Does it tick you off if you see something in the mod that's not clearly stated to be included?
It's okay, depends what the easter egg is
I want to add picture frames with picturess of my cats in them
If it's like "Ahah you went to coordinate x y z so now you are infected", uh no
Lol that would be funny
I don't think that has ever been done but it would be very funny
The best example is Trellai which has easter eggs everywhere on its map
I love it when you find things like that in games, going out of bounds just to see a picture of one of the developer's pets
Yea
I remember a map for counter strike: source (i think?) that spawned a .png of a cat which then starts shooting lasers from it's eyes and destroying the map
👀
Guys, maybe you know a command on how I can create a tree in a square?
You need a java mod
Gravy I pinged here made this with a java mod
https://cdn.discordapp.com/attachments/1224384563581550622/1230712664628400168/Treeeees.mp4?ex=6664703c&is=66631ebc&hm=adf158336130dd8eebf3bcd1b5a1d7ef587fbe7e4b6437246a2aa337a73b354c&
But java mod means manual installation
Then I should watch the video on YouTube)) thx
It seemed to me that there was a Lua method for creating a tree.(
You can add a tree with lua, but it wont' follow the normal seasons or grow anymore
to add a tree which will lose its leaves and keep growing, you have to use a java-mod
Good to know, I didn't remember the specifics
I just need a dried tree that won’t grow)))
Then just place the tiles
no need for lua or anything
you can just do that with the brush tool
? how XD
I probably wrote it incorrectly) it’s clear how to add this in the map editor, I was talking about the spawning of a tree after the harvest has died.
this is so useful you have no idea
I don't know what you mean..
Wdym you get ?
As the link code
imgur doesn't make the diff between images and videos
Use what I wrote
[video mp4=https://i.imgur.com/bwmq1nd.mp4[/img][/video]
With your link
You get this
I have no idea what that even is

Just paste this shit in your Steam page
-Official link formatting guide
https://steamcommunity.com/comment/Recommendation/formattinghelp
-A very neat guide that shows available BBCode tags and with some detail behind them
https://steamcommunity.com/sharedfiles/filedetails/?id=2807121939
-Guide demonstrating some of the BBCode elsewhere than the Workshop
https://steamcommunity.com/sharedfiles/filedetails/?id=812684948
-A website to do Steam markdown in real time, useful to test your modpage presentation
https://bijx.github.io/Steam-Markup-Generator/
Go check out my tutorial on Steam pages and what you can do
I'll do that
But just copy this in your Steam page
Example in my steam page
just to verify it works
It works, I had no idea the link contained the video I thought I was supposed to make a link like that somehow
Yea basically
I'll read the tutorial so I can figure out how to get a link like that, for future stuff
👌
I haven't detailed in the guide how the link I believe
For Github like I explained it's a bit tricky
But once you know how it's easy
For example, this is my github link to the video, but I can't use this link
https://github.com/SirDoggyJvla/Susceptible-Overhaul/blob/main/images/natural_drain.mp4
I need to get the raw link
But if you click "View raw" it downloads the mod depending on your browser
So what you do is
right click "View raw"
inspect element
you should see the raw link in the source code of the webpage
how do you properly delete an item? I have a condition if it spawns a ranged weapon I remove it.
And you know it's the right link because it has "raw" in it, so use that
[video mp4=https://github.com/SirDoggyJvla/Susceptible-Overhaul/raw/main/images/natural_drain.mp4][/video]
ItemContainer:Remove(InventoryItem)
So how would I approach this if its a world placed Item?
Access the ItemContainer then use Remove(InventoryItem)
I don't remember how you access ground items, I'm not familiar enough with item handling
There's a way to access it I believe but can't remember how
You get the square and then iter through all the objects on it then find the object that has the item in its container and then remove it
I believe thats how it works
If its an item in the world poaced
You sure there isn't a better way ?
Something akin to t his?
Might be off by some degree
What's "itemSpawned" ?
But i thibk thats how i used to remove stuff ik the world
Oh yea just get kts parent container
Then you don't need to do any of that
Ah yes my bad yes :Remove(itemSpawned) but otherwise its fine?
And then remove from it
You need to get the container it's in
I'm not sure which method you need to use, getContainer() maybe ?
:getParentContainer() i believe exists
I didn't find it
In InventoryItem
declaration: package: zombie.inventory, class: InventoryItem
Man im off with my references today
So this would function like this?
or could I do item:getOuterMostContainer:Remove(item)?
Something like that
But I'm not sure what you need to use to access the container the item is in
getRightClickContainer()?
They are both of type ItemContainer
Oh nevermind :getContainer() is a thing. so just use that? https://projectzomboid.com/modding/zombie/inventory/InventoryItem.html#getContainer()
declaration: package: zombie.inventory, class: InventoryItem
Yea, item:getContainer() returns the container the item is currently inside of
getOuterMostContainer() is for getting the root container in a situation where you have a bag in a bag in a bag in a...
Hmm getting a attempted index: Remove of non-table: null error
Oh pff wait, I need to remove the setcondition method haha.
Well this is the StoryItemSpawner mod so it only spawns in the world so it should always have a world square to be in right?
Since I use brita's mod and it handles its own distro, StoryItemSpawner it spawns way to many guns even with extremely rare 0.05x loot. So I just check if its a gun when it spawns an item and remove it. That's the idea.
Does tbe item spawn in the world and not in containers?
I gotta double check some code, but when an item is on the floor, instead of being in a container it has a IsoWorldInventoryObject
You can get that with item:getWorldItem()
and then call :removeFromSquare() or :removeFromWorld()? Weird thing is that It did seem to work, no guns no errors. but I'll check again.
Here's a snippet from the InventoryTransferActions
Its a bit overcomplicated it seems
elseif self.srcContainer:getType()=="floor" and self.item:getWorldItem() ~= nil then
if instanceof(self.item, "Radio") then
local square = self.item:getWorldItem():getSquare()
local _obj = nil
for i=0, square:getObjects():size()-1 do
local tObj = square:getObjects():get(i)
if instanceof(tObj, "IsoRadio") then
if tObj:getModData().RadioItemID == self.item:getID() then
_obj = tObj
break
end
end
end
if _obj ~= nil then
local deviceData = _obj:getDeviceData();
if deviceData then
self.item:setDeviceData(deviceData);
end
square:transmitRemoveItemFromSquare(_obj)
square:RecalcProperties();
square:RecalcAllWithNeighbours(true);
end
end
self.item:getWorldItem():getSquare():transmitRemoveItemFromSquare(self.item:getWorldItem());
self.item:getWorldItem():getSquare():removeWorldObject(self.item:getWorldItem());
-- self.item:getWorldItem():getSquare():getObjects():remove(self.item:getWorldItem());
self.item:setWorldItem(nil);
self.destContainer:AddItem(self.item);
else
We can assume we're not dealing with a radio, so I guess you just need:
self.item:getWorldItem():getSquare():transmitRemoveItemFromSquare(self.item:getWorldItem());
self.item:getWorldItem():getSquare():removeWorldObject(self.item:getWorldItem());
self.item:setWorldItem(nil);
self.destContainer:AddItem(self.item);
He doesnt need the self.destContainer bit since i believe he just wants to remove them from the world
true yeah no destination
if _item:IsWeapon() then
if _item:isRanged() then
_item:getWorldItem():getSquare():transmitRemoveItemFromSquare(self.item:getWorldItem());
_item:getWorldItem():getSquare():removeWorldObject(self.item:getWorldItem());
_item:setWorldItem(nil);
else
if ZombRand(10) >= SandboxVars.WeaponLoot then
_item:setCondition(ZombRand(1, ZombRand(SandboxVars.WeaponLoot+1, math.max(_item:getConditionMax(), SandboxVars.WeaponLoot+1))));
end
end
end
So this then?
You need to change the self.items to _item
Ah true, how do I display code in discord like you btw?
Ah yes, forgot i had to make a new line.
Does loading a save with a new mod reload the lua for the whole game, or do I have to restart it to see the effect?
Probably wouldn't hurt to nil check the worldItem before trying to remove it
Quitting to the main menu then loading a saves tends to work for 99% of stuff in my experience
yea
Alright, most of my errors with the syntax comes from me using C# out of habit.
~= nil
lua is special like that
lua will also cast to bools automatically when you check objects, so you can shorthand it to
if _item:getWorldItem() then
Gotcha, I personally like having everything typed out. I don't like soft typed languages for that reason
is then needed?
ye
Gotcha, and do ; make any issues at the end of the line? I just realised I added them everywhere out of habit
if _item:IsWeapon() then
if _item:isRanged() then
if _item:getWorldItem() ~= nil then
_item:getWorldItem():getSquare():transmitRemoveItemFromSquare(_item:getWorldItem());
_item:getWorldItem():getSquare():removeWorldObject(_item:getWorldItem());
_item:setWorldItem(nil);
end -- I guess end is mandatory?
else
if ZombRand(10) >= SandboxVars.WeaponLoot then
_item:setCondition(ZombRand(1, ZombRand(SandboxVars.WeaponLoot+1, math.max(_item:getConditionMax(), SandboxVars.WeaponLoot+1))));
end
end
end
You need to change directly in the workshop.txt
thanks
Awesome it seems to have worked, thank you so much. ❤️
And of course big fan of your inventory tetris mod. Can't play without it and I'm extremely excited for the pockets update :)
Alright. This is wild. I'm surprised that joypad and joypad-data are packaged on the Lua-side.
IMO seems like a needless "re-invent the wheel" solution.
shared/joypad/JoypadSetup.lua#JoypadControllerData
Initially this code looks like it should be raised to Java. The engine looks like it already had constructs for this solution which confuses me as to why it's managed on the Lua-end.
Thanks again for pointing out the nuance of those method-definitions in sub-classes to ISUIElement @wet sandal
Looks like the next definitions / documentation I'll need to write are Joypad.
@wet sandal Alright I got a few more minutes and decided to jump in and check stuff out. I have a few immediate observations. First, this bug, which seems to have fairly obvious origins:
Second I am not sure how I am supposed to open the context menu but you have rebound our context menu button, which is among the most important buttons that we are used to using. I'm not sure about that decision, personally.
Rebinding the context menu button to some unknown button led me to try Circle and immediately fire that bug
Your right-bumper loop reliably fires this error when I hit bottom of inventory and it tries looping back to the top; could be an interaction with Proximity Inventory.
Opening context with Circle feels pretty subjectively bad to me since that's normally the button for closing it, and it no longer works for that.
Once I push past errors I do see you rebound X to Circle. I really wouldn't unless it's optional. Feels bad from perspective of longtime gamepad player.
There is no way to close context menu once it's open. I can move items around while context menu is open.
Also none of our QoL shortcuts work anymore. Gamepad players cannot sort, cannot use Start for double-click functionality (which used to let us quick equip / eat / drink / use)... also bumper functionality feels very wrong to me subjectively because you're overriding the bumper accessibility settings that I explicitly chose from the vanilla menu.
I use R1/L1 to move up and down containers on one side of my panels; I use left and right to switch between panels
It's a vanilla option and it's broken badly with this mod on.
Yeah, my key takeaways here are:
- Don't change major bindings in a way that will be counterintuitive by e.g. making standard cancel buttons into activate buttons. I would only offer such drastic changes optionally.
- Don't break any useful vanilla accessibility functions like swapping between containers using bumpers.
- Familiarize yourself with many inventory management advantages of Wookiee Gamepad Support so you know when useful features break and why. A lot of the breakage could surely be prevented.
@wet sandal ❤️
Hello, not sure this is the place to ask, but I was hoping to commission the Jin Roh Armor for a PZ mod.
Deleted OG message so not to break up the previous message
Health Overhaul mod WIP

Does anyone know where I might find the code behind Hemophobic's bloody clothes/body check? Just tryin to find some actual numbers on it.
Thanks a lot ❤️
👌
Weird you're getting so many errors, was doing testing last night and didn't get one, but I had debug mode off now that I think about it.
I get what you mean about the button mappings, but at the same time with Tetris, pickup, drop, and rotate become important controls that need to be really natural to access.
I'll probably just add full control rebinding options.
Pickup and drop could easily be circle since stacks don't work anymore
Changing button there was just not necessary.
Rotate is going to most likely need to be a hold press situation.
Alternatively it could be a toggle on any given item to minimize need for bindings.
I think letting people rotate WHILE moving after activation with Circle would make more sense
No, activation of movement is with X
Or A
I'm saying activate movement with Circle since circle became unbound when stacking and unstacking shortcut stopped making sense.
Swapping pickup over to right face button is the main thing I suppose.
Otherwise, I think the errors you're getting are messing up my intended controls
Unless that was hiding somewhere?
Fair. Don't forget the R/L thing. Kind of a big deal. Anybody who has found that setting isn't going to want to go back to the old way lightly.
It'll be a sure source of disappointment to anyone who knows
Looping through 5 or 10 bags instead of being able to go up and down is just bad
I guess you may not try to accommodate mods like ExtraSauce Sac but again those are a huge deal for us. Saves a ton of time on nonsense clicking.
Ignoring Tetris, do you Equipment UI is good to go?
I'll check it out more. I was kind of analyzing them together.
hadn't even run them separately
Ah fair
I will try Equipment UI alone
I was running equipment UI alone mostly since the ControllerNode class lives there when fixing the errors you shared earlier
And see how it plays with everything else
Maybe I messed up Tetris then
It seems less nuclear at a glance so I'm optimistic.
Switching focus off the UI with a single button is much less complicated an overhaul obv
That shouldn't need to break anything really
Anyways, just wanna say. I really appreciate the feedback and testing. I want this controller support to go smooth and this is a huge help!
Breaking some things in IT is likely inevitable
That's to be understood
But I think important ones like tabbing both directions through containers and shortcuts like Sort and Double-Click on gamepad should be preserved
In fact all context-menu based functions should be preserved... not sure why item context menu related functionality should ever need to break... You got the item and the player object, all should go fine.
I am resubbing to mods so give me a few to get back to you about EUI
I cleared out 1777 mods today and am dropping back down to what i actually use
lol mod support really adds up
I'll update you further ASAP
@wet sandal I spent this afternoon working on fleshing out documentation for the JoyPad folders.
That looks very cool! Can't wait to get my lungs bitten 
I dont remember both my lungs being in my right chest 
Looks great as a WIP tho!
How realistic would a Zipline mod be? I feel like it's not too unlikely that survivors might make a system for travelling without going to the streets
Rule of cool trumps all
I'm guessing it could be done. I wouldn't expect easy. But fully agree with Omar.
If it's cool and you can make it happen, you must do it.
And zips would be cool
I didn't realize until after I sent that that “realistic” probably meant “feasible” 😅
I guess it would share mechanics with sheet ropes but going horizontal instead
No it meant realistic 😂 like would that be a thing in an apocalypse. I think yes.
Oh, then yeah I could see it
Maybe. Might need to be pretty entirely new. I don't know if the rope climbing mechanic could be repurposed for sliding animations. I think it involves calling a Java function or two iirc
100% someone would do it.
When I worked on gamepad and animation support for Ladders, we just had to make them climb rope and changed the animation for doing so.
Also changed some tile flags to allow things to be rope-climbed
I'm unsure how you would be able to prevent gravity effects otherwise. Game would presumably be strongly inclined to see you as falling
But then again there is a flying mod
So just do that and land under a rope I guess
Hmm yeah if there is a flying one, could be a good place to start
I looked around but I'm not sure if they ever published it
But it was 100% proof of concept
For your goal
@drifting ore
Had to type mentions and colon and click the word to start entering your username fyi
Ooo
Just seen this
Okay thanks
I hate how my name looks on your phone haha
It’s not as perfect lol
Lmao I would never have known your name looked even anywhere. My phone butchers that font
Even profile text is that way
i see it the same as how you see it
just sayin
Guessing she's on an iPhone
Usually explains basic miscommunication of simple things like fonts and emojis and such
most likely
So I found the mod I want. However, how do you guys import models? I am looking at the Dogs mod and I am wanting to import a Bernese Mountain Dog.
I am not assuming I can just import any model and it turn into PZ form lmao.
I am not a modeling guy... I've done an animation by using a model provided for Blender but never yet imported my own... #modeling best for this kind of modding question.
Okay thanks.
Hi! When updating a mod, is it possible to only change the
require=
field in the mod.info file? Or is this not possible for an already existing mod on the workshop?
it's possible but it's a bad idea if you can avoid it
removing a dependency is fine but adding one is going to cause problems for current users who don't have the new dependency
it is about a mod which has just beeing published a few minutes ago. not by me but by a new modder whom I trying to help a bit.
problem is that after changing the requirement only, the update seems to not take place somehow... so I was wondering is there might be a problem with it
should be fine to my knowledge
hmmm... then the new modder is doing smth wrong which I don't know about. for me, just updating the mod info file always works too
or any experiences that an update might take very long until it is registered in the steam workshop?
ok... update worked now.
Problem is that the steam workshop page does not correctly show the required mod in the side panel. Is there any thing more beside setting the require= field in the mod.info file you have to do for making this work?
Really big shot in the dark here, but is there a way to automate a ban based on certain conditions in MP servers? (Through programming)
I'm Trying to make it so if players reach 0 in either strength or fitness, they will be banned and required to make a new character.
if you want them to make a new character, just kill them.
I'm trying to make a unique system that punishes players for dying too much
Yeah, I was just responding to this from you: " if players reach 0 in either strength or fitness, they will be banned and required to make a new character." As being killed requires you to make a new character.
The actual goal is to let people die, but to make it so dying too quickly one after the other is enough to kill your character for good
Events.OnNewGame.Add(KickPlayerFnS)
function KickPlayerFnS(player)
local fitness = self.char:getXp():getLevel(Fitness) >= 1
local strength = self.char:getXp():getLevel(Strength) >= 1
if fitness == 0 or strength == 0 then
self.char:ban("Your Character is too weak to survive, please make a ticket for a new character or to appeal a character revive.")
end
end
You need to add the function to the event after creating such function
Okay thank you! That's definitely the place i fucked up lmao
Did you figure that out?
There's a separate button on Steam page
hey i'm very new to project zomboid and am not really sure if this is the place to ask for beginner modding help but i've been struggling to understand the documentations
i wanted to make a mod that adds a craftable poster from a game a friend of mine made as sort of a random surprise to her
i already have a ".pack" file with the asset but i'm not really sure where to go from there 😅
The require= field does not apply the the workshop item, it applies to the mod. (further explanation for clarity: the workshop item contains one or more mods, which may have different dependencies specified in mod.info)
I don't think there's a way to specify dependencies in workshop.txt. There very well may be & I'm just not aware of it. But the user who uploaded it can add requirements of other workshop items from the workshop page
I swear I did a quick scroll to see whether it was answered already & did not see this, smh this is a much more concise way to put it
many thanks! now I see what your have to do!!
Are there any mods that let you scan for radio frequencies? Like move a dial until you hear something?
@wet sandal New info and questions. First info:
This error suggests that even though it went through a branch that should have defined menu as something, menu had no definition on line 1399. Perhaps createMenu did not return its normal result?
Question: How do I see the Equipment UI on gamepad? I can't actually figure out how to make it show up. I've only thrown this error lol. But most of the UI still works normally with EQUI on (bumper container switching works, sorting shortcut works, quick item actions work).
And this happened when I went to quit game:
(could not recommend debug more strongly... and WGS almost as strongly [though these don't seem to involve any conflict, it's still better to spot them early if they do arise])
Final trace:
Let me know how to actually use the UI as intended when you get this
You've got one heck of a mod conflict going on because I get none of the errors you're showing
I bound the equipment UI to select, but Wookie Gamepad overwriting that I guess
@thick karma may I message you?
Yeah that's been sort in WGS for years
I can probably find a way to make it work together, I'll look at your code to figure out where you fire the select press
Yep
I'll just post this in one post so I'm not making multiple comments:
Either looking for or suggesting four mods/ideas:
-
Submod of Expanded Helicopter Events that add Zombrex drops. Some added customizable options include specific amount of days between drops, how much Zombrex is dropped, and whether or not these drops eventually stop coming like other heli-events (this would make surviving bites impossible long-term). Other options would be to make them incredibly rare, practically a miracle, following the collapse. Mod idea like this is based off supply drops in Dying Light where they drop Antizin.
-
Mod where zombies totally ignore you. Think Ghost Mode from debug menu, except you can still make noise such as shoot guns, shout, step on class, among other things. You can still do everything normally, just that the zombies ignore you completely. A customizable option in the sandbox menu would allow them to essentially be "drawn" to your general area. Similar to One of Us by BitBraven, the zombies would chase you up to a certain point and then stop, so they'll always be around you. Even if you get up close to them, they'll never attack you because they don't care about you. On its own, a mod like this is pretty pointless though funny, but it would be designed to be coupled with mods such as Susceptible, adding a lingering threat. While the zombies don't acknowledge you and therefore won't directly attack you, they can still infect you through the air.
-
Mod that adds UV lights that repel zombies, similar to UV lights in Dying Light. There are already mods that alter zombie behavior depending on the time of day. When UV lights are added, zombies will not enter a specific radius around them. However, there is a 5% chance that a zombie may be/become resistant to the UV light's effets and directly attack the lights/generators to shut them off. In spite of that, these lights would help provide open safe-zones, or just safer zones.
- Mod utilizing mods like Hazardous Zones or Radiated Zones that add Radiation Storms, similar to those in Fallout 4. These are their own weather systems that are either powerful windstorms or powerful rainstorms with a greenish hue. There are three levels of radstorms depending on if rain or simply windy fog:
- Level 1 storms are low in threat; light rain, decent radiation dosage. If rain, hazmat keeps you 100% safe. If fog, gas mask only needed. Lasts around 24-48 hours. Brightness is light.
- Level 2 storms are moderate-to-severe; medium-to-heavy rain, moderate-to-severe radiation dosage. If rain, hazmat keeps you 100% safe, but may take periodic minimal damage when outside. If fog, gas mask only needed, but your mask may take periodic damage when outside. Lasts around 24-72 hours. Brightness is dim, cloudy skies.
- Level 3 storms are severe; heavy rain, akin to peak tropical rainstorms/blizzards in winter, heavy radiation dosage. If rain, hazmat will take further periodic damage. If fog, hazmat suit is needed, will still take periodic damage. Lasts around 24-96 hours. Brightness is dim, akin to heavy storms.
All durations customizable.
BLACK STORMS are "hell-on-earth", no level tier needed. Heaviest rain, hurricane force winds, can break windows. Deadly radiation dosage within minutes, maybe even less. Gas mask will not protect you. Hazmat suit only, will take heavy periodic damage when outside, halved when inside. They are the shortest-lasting storms, anywhere between 12-24 hours; also customizable duration. Brightness is almost pitch-black, as dark as pitch-black nights.
To protect yourself while indoors without proper clothing, you'll need to cover windows and doors with either plastic sheeting and duct tape or metal sheeting. Metal sheeting is more effective. Only metal sheeting will protect you during Black Storms.
If using Basements mod, basements and other structures will protect you 100%. Just be stocked up!
- Storms will be announced via EBS similar to normal weather systems. You'll have anywhere between 2-5 days to prepare. However, BLACK STORMS will appear anywhere between 2-7 days after announcement:
"WARNING: DEADLY RADIOLOGICAL EVENT DETECTED. ETA, 3 DAYS. TAKE SHELTER."
😄
@wet sandal Did you actually test Quit to Desktop after opening and closing player inventory with debug mode on?
Because I just did it with none of my own mods that remotely touch inventory in any way (even disabled Proximity Inventory and other highly popular stuff that isn't mine which personally is not how I would test or recommend testing), and this error still fires for me, and the error strongly implies that your mod is the only relevant mod:
I would say there is a 99.9% chance your mod causes this. I have not looked deeply at the others yet.
That said, the select functionality DID work with everything else disabled and I WAS able to navigate and activate context menu on items in the Equipment UI, so good job on that front
That said, I do have some recommendations on that front.
Poor Not getting absolutely bullied lmao
Awwww ❤️
Have you even received a single answer from him ?
Not meant to sound that way
Yes Not is responsive!
Notloc has been very responsive
He's just busy right now
Bcs I keep seeing you message him but never his answers 
Well I have more to say about it than he does lol
(also why do you not dm him about these ?)
He is currently developing and he is not aware yet of the things I'm bringing to his attention
This is a learning environment and he suggested not having a preference for DM's.
I generally discuss modding in the open for lurkers who are learning if nobody has a preference.
But I will happily take this to DM's if anyone wants me to do so.
ngl probably no one understands shit of your reports but Not himself 
Lmao probably not.
But
Someone might
There are some people who do, definitely.
But yeah a lot of people are just scratching heads or tuning out I'm sure.
@wet sandal If I were you, I would strongly reconsider the binding, as I mentioned, is overwriting something many of us (gamepad users) have found useful for a long time, so destroying that without replacing it is undesirable.
~~On that train of thought, D-Out (Left from Inventory or Right from Loot) is a much more available shortcut, and sort of makes intuitive sense for opening a panel outside of inventory... currently it is just a secondary way to get to the other panel (when in inventory, right goes to the loot panel [which is right of inventory by default], but left loops to the loot panel as well). ~~ On second thought, I don't love this idea either because some weirdos might like moving inventory and loot in such a way that they are used to a different right-left relationship between those tabs. L3 (Left Stick Click) is available, and that seems like a way better choice.
Alternatively you could design a trigger-activated shortcut.
@wet sandal Another thing to consider:
Gamepad players like moving their UIs too and have been doing so via mods like WGS for years.
By forcing panel rearrangement to show their UI, you are complicating showing your UI without a conflict.
In this case, Loot begins left-aligned and your trigger moves it.
Then it becomes like this when it's gone:
If you're going to move those panels, you should save both of their initial positions and sizes and revert to their original states when you're done
On the bright side, EQUI has not yet done anything to prevent panel positions from saving correctly; the save-UI-position functionality added by WGS for gamepad players still works, but opening EQUI messes it up.
Alternatively, to make life much easier for yourself, you could not move those panels and just draw panel centered on top of them.
I would say going halfway on this endeavor (moving them but without doing anything to ensure those moves will be compatible with other mods) is worse than not doing it at all.
Seeing the panel on top of the UIs would not bother anyone... having UI's relocate and messed up by the panel stands to bother many.
@wet sandal (Sorry for double-ping, dropped messages in #mod_support like a scrub.) Also, fwiw, I have confirmed that L3 is fully unbound and available with my mods running for opening the EQUI.
I tested this and it worked fine alongside my mod:
og_ISInventoryPage_onJoypadDown = ISInventoryPage.onJoypadDown
function ISInventoryPage:onJoypadDown(button)
og_ISInventoryPage_onJoypadDown(self, button)
if button == Joypad.LStickButton then
self:toggleEquipmentUIForController()
end
end
Nice!
I'll read through all the feedback soon.
No rush, I know we all become available at different times
I hope I don't sound bullying 😭 my concern is the gamepad player experience, nothing is personal and ❤️
@wet sandal I cannot 10000% guarantee that this error is yours because I ran it alongside a bunch of mods that should in theory have nothing to do with it, but I can guarantee that if you change your code from:
Events.OnGameBoot.Add(function()
local og_removeInventoryUI = removeInventoryUI
function removeInventoryUI(id)
local data = getPlayerData(id);
if data then
data.playerInventory:destroyEquipmentUi()
end
og_removeInventoryUI(id)
end
end)
to
Events.OnGameBoot.Add(function()
local og_removeInventoryUI = removeInventoryUI
function removeInventoryUI(id)
local data = getPlayerData(id);
if data and data.playerInventory then
data.playerInventory:destroyEquipmentUi()
end
og_removeInventoryUI(id)
end
end)
Your mod will no longer throw errors when Quit to Desktop is selected in multiplayer.
Try not to miss this one. Nobody can patch it out for you if you forget without overwriting your whole file due to your use of in-line function declarations.
I'm still trying to reproduce this and can't, so it must be some obscure edge case. I'm trying to do it again. Was an accident of button mashing the first time.
finished a bunch of hats today, including a variant of the riot helmet
i used the in game icons for bass, and the icon for the mounted deer trophy to make the bass and deer ballcaps
@wet sandal You are not crazy. This is a rare vanilla gamepad input error that I can reliably trigger by squeezing L2, D-Pad Down, and Cross (X) at approximately the same time due to rare edge case situations that the vanilla code assumes will not happen, in which the call to vanilla's createMenu will not return anything at all. I may patch this out in my next update to Wookiee Gamepad Support after the weekend.
Ignore this bug.
(I'll handle it.)
It's unlikely anyone would ever discover it without squeezing all the buttons at once trying to guess a shortcut.
All things considered, from what I know so far, I'd say Equipment UI will be a 10/10 instant sub for me if it uses an unused binding (e.g. L3), it either doesn't move or properly restores the UI positions when it opens slash closes, and it doesn't throw an error on Quit to Desktop. I don't see any other obvious issues with it, and the good parts look and feel nice to me.
END OF MY MESSAGES TO YOU FOR NOW, NOTLOC. ❤️
Hey guys do you know any event or method I could listen to/override to detect player crashing against something (other than player / zombie) while driving? I've been searching and tried a few thing for a while now and can't find anything
Also, is there any way to know if the player has a specific mod installed?
getActivatedMods():contains("ModID")
How did you search out of curiosity?
I think this is the only situation in Lua you can hook
Ho, thanks!
Tried looking for anything related to crash or car damage in BaseVehicle, media/scripts/vehicle and media/lua/vehicle, and also took a look at the events listed in the pzwiki.
I think I'm missing the Commands object, where can I find it? I'm relatively new to PZ modding and modding in general, done a few things but I have a lot to learn still
I'll try that, thank you!
More importantly, you're missing a strategy. Do you know how to index folders in Windows?
I don't think I do, I'm clearly not Windows sysAdmin knowledgeable, always though windows search kinda sucks so I never use it
Sucks less if you learn how to use it. Today, you do. 😉
You're right, I always assumed it was just not great and limited but never bothered to even think it could be better than I though
Follow these instructions to enable indexing and add Steam/steamapps/workshop/, Steam/steamapps/common/, and %UserProfile%/Zomboid/ to your indexed locations.
https://www.geeksinphoenix.com/blog/post/2022/05/15/optimize-searching-for-files-in-windows-10-and-windows-11-using-indexing-options
@chrome veldt
When you're done adding the locations, go through the list of types and make some adjustments.. find ".lua" and ".java" extensions, and check the radio option that says to search file contents.
Also, I believe you'll need to add .info as an extension, then set that to also index file contents
That'll let you search mod.info files in Windows search for matching mod IDs, which can be useful for finding obscure hidden copies of mods quicker.
Thanks a lot, that'll greatly improve my workflow 😄
Yeah after those locations are indexed and you tell the indexer to also index file contents, you can Windows search in file browser those various folders and subfolders for stuff in the files
If you had searched for "crash" like that, you would've seen VehicleCommands.lua in the list, and I bet you'd have realized it might be important
And then you search for crash in that file and voila.
Yeah, you're absolutely right, I believe I can also use the VSCode indexed search within the media folder, right?
Yes
Either path is faster to what you need.
Manual exploration is not the way
Usually
Unless desperate and things have weird names
Ok, thanks for your help!
the crash command doesn't seems to be called ever. Added a print to log the received events and I get some, like setDoorOpen, but never crash, maybe it's called under specific conditions (car flipping?)
Interesting. Not sure. So just to be clear you are listening to serverside vehicle commands and you're seeing some but not that one eh?
Yes, exactly
That looked like the only reference to crashing in Lua so maybe currently unused
Maybe they just track damage somehow not involving the word crash
Yeah, I think that's my best bet at this point. I also though about monitoring the velocity changes to detect a crash (which I can see being logged in the console.txt) but that seems less optimal than damage monitoring
bro did you make a mod called no quickdraw or something like that?
i didnt make it, comissioned it from braven and we cooked on it a bit to make it so players cant insta draw weapons, and the weapon draw speed to the players level in that weapon class.
but it is listed on my workshop
or used to
i just folded it into another pack with the rest of my mods to use on my server
its not in the workshop anymore? bro i was using that shit 
noticed it instantly, its a pretty needed nerf imo
can i get it somehow?
I didnt think anyone else outside of my server would be using my stuff lol
well, to be fair it is kind of a specific ass mod, but i liked it a lot
liked it enough to come bitch to you about it lol
I'll send you a link to the collection it no resides in. Theres other helpful things in there you can enabled/disable like realistic healing times, zombie speed modifiers, and other stuff. If you like it and want to reupload yourself you can do that as well
thank you bro, really appreciate it
dm sent
@hallow knoll Second, you probably need to share a zip of mod for someone to look at
It could be lots of things
Idk unless someone knows workshop upload error 16 off the top
I think 8 is a long workshop.txt
No clue what 16 is
I want to make an item turn into something else/replace if its been in a x container for x amount of time. Which lua files handle these things?
Ok, as I tested and checked, I can UPDATE mods but can't UPLOAD them any way, cause I tried upload the same item I just updated and whoosh and err 16
global objects
check out farming
So I am working on a mod and reloading lua is going on in the top right corner. At some point it goes to just the background of the main menu. Does anyone have suggestions?
Check consoles for error messages
this mod thing im trying to do doesnt seem to work, is the location ok?
Looks right. You could share the file so someone can take a look at it. Also you could throw in a simple test to make sure file is loaded
E.g.
local spammo = function(player)
player:Say("I'm a banana!")
end
Events.OnPlayerMove.Add(spammo)
Also debug menu can be used to check if file is loaded
heres the file, its the same as the base one, just with some numbers tweaked
Maybe the values are proportional within areas...
So 1:1:1 is just a third of each
Maybe getting rid of them requires something else...
im thinking in just turning it down to 0 then see if something breaks or if it works
brb
That or try
ZombiesZoneDefinition.TrailerPark = {}
Idk if those zones even get used anywhere... having trouble finding the usage tbh.
yeah that did it
the zones themselves do get some use, i notice it and it can get in the way if youre trying to set up specific stuff
thanks a lot for the guide btw, couldnt have done shit without help
Well clearly they do if that did it I just could not find the code haha but nice work.
Abandoned Trailer Parks on Steam next week?
haha imagine, i think my problem is so specific no one has ever noticed
Ghost Parks?
Nahhhh someone wants to go live in peace in a trailer park
There are enough players I'm sure that niche exists
theyre not even deserted, they just dont spawn a survivor zed every 5 zeds, just normal zeds
hehhe ill think of something and post it if i see someone bitching about finding too much survivor backpacks and shit lol
Just started modding this game, so bear with me.
In scripts is there some way to extend Base definitions rather than overriding them? I'm trying to implement some custom attachment models and from what I can gather I need to:
- Add a
ModelWeaponPartproperty to the base item(s) - Add
attachmentdata to the base model(s)
It'd be nice if I could do both of those things without needing to copy over entire definitions... Maybe it's not possible, but I imagine extending would make more sense for the sake of interop between mods.
I'm not entirely sure what you mean. You want to create your own attachments and add them to already existing guns and make them actually appear on them with ModelWeaponPart thingy? If you don't want to override whole gun (i assume you don't) i belive there is way to do it with lua and DoParam or something similiar
Correct, I've already created my own item and model definitions and pointed them to the right assets, eg.
module Stealth {
imports { Base }
item Suppressor {
DisplayCategory = WeaponPart,
Type = WeaponPart,
DisplayName = Suppressor,
...
}
model Suppressor {
mesh = Suppressor,
}
}
But they don't actually show in game, because the base items eg. Handgun, Handgun02, etc... must specify what models to use for what attachments and the relative offsets and rotations in game.
I can just rip the original definitions out of the game directory and paste them in my mod files but... That would not only be annoying and redundant, it would also clobber any other mods that happened to override the same base definitions, which seems like a bad idea.
BTW if you use vscode you can use my extension called ZedScript. You'll need to set the language to ZedScript but yeah it could help you out.
Nice. Neovim user, but maybe I'll take a look and port it over 😛
Everyone uses VS Code for PZ modding bcs we have the Umbrella extension for PZ code formatting
Yeah. I used VSCode for a while, the ecosystem is great. But you'll have to pry nvim out of my cold dead hands lmao.
murders the Outsider for the bit
actually pries nvim from the Outsider's cold dead hands, lights his copy of nvim on fire, and finally performs a Satanic ritual to resurrect him from the ashes of his mistakes
Hi! I have made a function in lua but for some reason it doesn't load in at all
I have followed the following folder structure:
No Gun Face\media\lua\server
function JustABadDream(player)
local body = player:getBodyDamage();
if body:isInfected() then
body:setInfected(false);
body:setInfectionLevel(0);
end
end ```
and this is the error message the console gave me
wanted to ask if anyone else (with more lua experience) had a similar issue at some point
How did you try using it
Context is probably the issue.... E.g. folder structure or code order
in a crafting recipe, one second I will copy the code over
{
keep RPAlmanach,
Result: RPAlmanach,
RemoveResultItem:true,
Time: 1600.0,
Category:Survivalist,
Tooltip: OOC use only - game mechanical cure,
OnCreate:JustABadDream,
AnimNode: TestingSome,
CanBeDoneFromFloor:true,
Prop2: BookYellowBrown_Ground,
} ```
I have tried to make very small steps, first making the item work, then adding the other things little by little
Can anyone help me for making a trait mod
ı cannot figure out how can ı make
I looked for examples or other mods but what ı do never camed in game
Make sure you follow all instructions
Remove what isn't needed, change names of files and IDs and variables appropriately, etc.
thx
Can you just drop the whole file here
One thing I immediately notice is your signature is wrong for OnCreate but that doesn't explain the error you're seeing
It would cause others
of course! one second, zipping it up
Should be
end
that's an empty zip lol
im trying to add guns to the list of this file, how should i do it so i do it as a mod and not by modifying the original file?
the code should be alr, im mostly asking about file locations and such
your functionname should have the Recipe.OnCreate prefix for it to work
also the wrong prefix for for comments might screw up pz reading the file
will give that a try! thanks for the input!
it doesn't need that prefix
the recipe should be able to find any globally accessible function
the comment at the start of your file is invalid syntax and causing the file to fail to compile
in lua, use -- comment for single line comments and --[[ comment ]] for block comments
This is actually not necessary
There are vanilla functions that do not use the prefix e.g.
Totally valid
Just clarifying for science
i love when even vanilla doesnt follow its own standard
Just saw this sorry but yeah do this @compact tinsel
on it!
also dont they need to expand their function to house the 3 args that are getting passed to?
You have to have one to follow one
So I check console for error:
'ERROR: General , 1717948231599> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method).
ERROR: General , 1717948231600> DebugLogStream.printException> Stack trace:
java.lang.reflect.InvocationTargetException'
can anyone help me ?
why that mod isn't working ?
thank you all, the function is at least working in the sense of getting recognized
(the infection keeps coming back, need to find out how to fix that, buuut I'm sure I'll find out somehow)
Hi, im new to modding and in this server but anyone knows how the Bump code works? like how can i mitigate the damage from a fall when a player push me to the ground
or just if its there any fall animation without damage included
https://www.youtube.com/watch?v=fRvbpSIa3EY Like the falls on this video for reference of what i want to get
Pushing is super op in pvp in some project zomboid multiplayer! Enemy getting to close? Push and stomp and you'll be winning PvP fights in Project Zomboid Multiplayer like nothing! (except against guns lmao)
#projectzomboid #projectzomboidmultiplayer #memes
don't pin me down on my words, but I think what you are looking for is lua territory
though I don't have any clue where you would have to start searching (I have also started recently)
hello!
does anybody know a way, to look up, from a lua script, current armor values of Armor on the player character?
I want to do some math on that for an RPG system i'm workign on. But i can't get it to work, for the life of me.
I tried to do it through local wornItems = player:getWornItems()
but i'm too dumb to actually get it to work.
I am here once more, this time I hope~~ it's~~ my error is a bit less complicated
I have tried making an addition to the code up here.
My thought process was: okay, make a variable, then set the weight and take 2 away
I tried the function first with setting the weight to 75 but it just doesn't show up ingame
player:setWeight(weightNum-2);```
dont understand still have trouble finding it
Hi! Is it possible to change a 3d model of clothing item via lua code? Smth like clothingItem:setModel("something") ?
thanks ill take a look rn
getWornItems() gives you a list of all items the player is wearing. you could simply iterate through the list and check each clothing's protection value
that's what i did!
Works like a charm
thank you razab.
@small topaz Do you know how to add a custom comand, as well?
Is it possible to turn a savegame into a mapmod? (As in I save the chunk all my stuff and my base is in, make a private mod of it, and therefore am able to teleport it into a new map)
btw is there any way to make the log walls go diagonal on a square? (even if takes all the square hitbox to move and makes weird invisible hitbox) so "circulars" walls design can be a reality, i did not find any mod so thats why i ask
You would have to make your own tiles, but yes, definitely possible
i have nearly no clue about modding, will it be all on Lua and 3 or 4 tutorials and i have it done or do i need to touch java and get 7 weeks of videotutorials to try and make it?
Naaaaaah, you need to watch like ten minutes of a daddie dirkie dirks guide on youtube, download the project zomboid modding tools, and then paint the angled log wall (or modify the existing log walls to your liking) in gimp (or any other picture editing program you like). It is not too hard to learn, might take some tries though
ill try then ye, and for add it into the game do i need to make another tab in the context menu or can i just add it to the existing carpintery tab?
I am not 100% certain about this since I have not tried it, and I usually try to keep my fingers off vanilla stuff as much as possible, but it should be doable to add it there
okey, thanks man
https://www.youtube.com/watch?v=Fbvb6LeX0Sw
This is Part 1 of said tutorial 🙂 Has 3 parts
Quick video on getting custom tiles in the project zomboid editors (buildinged, tiled and worlded)
If you like what im doing please consider donating to my Patreon.
https://www.patreon.com/DaddyDirkieDirk
Im attempting to create a mod to store stats in a database for display on a website or discord bot etc any pointers on where would be a good place to start would be appreciated I would also like to make a web/discord admin tool as well as I havent been able to findy anything along these lines. Im an experienced web developer but new to project zomboid modding.
Likely going to use FileWriter.
Idk about the Discord bot reading it
But FW can write the file to Zomboid/Lua for reading later
Okay thanks ill look into it
Didn't spawn it off its immediate parent
See True Music Jukebox or Jumper for correct working examples
I'm in a prison of my own making 😂
I'll take a closer look thanks for the pointer
Good luck!
The submenus appear correctly, if I didn't spawn it off the correct parent wouldn't it pop up incorrectly as well?
I'd have to review the code to remember why exactly it happens but for some reason it is counterintuitively possible to attach submenu to correct submenu in such a way that grandsubmenu doesn't properly identify its parent and the chain of closing out context submenus breaks
Or perhaps it's that the parent doesn't know its own child idr for sure
All I know with certainty is what works and doesn't from experience with getting and fixing that error
You're probably right and I just assumed I got it right when it snapped in place the first time. I'll review more thoroughly
yep it looks like you aren't associating those specific submenus with the context menu itself for that option. once you do that it will work correctly
@fleet bridge When those menus close they depend on the variables in these functions to be set right to follow parent-child connections from the origin menu thrrough all submenus. I can't say exactly what you did wrong except that how you did it is not ensuring variables are set right for these guys:
function ISContextMenu:closeAll()
self:hideAndChildren()
local isJoypad = JoypadState.players[self.player+1]
local parent = self.parent
if isJoypad and (parent == nil) then
setJoypadFocus(self.player, self.origin)
end
while parent do
parent:setVisible(false)
if isJoypad and (parent.parent == nil) then
setJoypadFocus(self.player, parent.origin)
end
parent = parent.parent
end
end
-- . . . . .
function ISContextMenu:hideAndChildren()
self:hideSelf()
for _,option in ipairs(self.options) do
if option.subOption and self:getSubMenu(option.subOption) then
self:getSubMenu(option.subOption):hideAndChildren()
end
end
-- FIXME: this only works for the global context menu for each player
if self.instanceMap == nil or #self.instanceMap == 0 then return;end
for k, v in ipairs(self.instanceMap) do
v:hideAndChildren();
end
end
Thank you both 👍
Good luck!
are there any built in animations for lever action guns?
Hello guys,
I am struggling to add an ISBaseTimeAction for my mod, I don't understand what's happening...
Here is the file I wrote for it (It's just a simple test I wanted to do to understand how these actions works, nothing extraordirary^^)
CrossWordMod = CrossWordMod or {}
CrossWordMod.CrossWordAction = ISBaseTimedAction:derive("CrossWordMod_CrossWordAction")
function CrossWordMod.CrossWordAction:isValid()
return true
end
function CrossWordMod.CrossWordAction:update()
--
end
function CrossWordMod.CrossWordAction:start()
self:setActionAnim("Loot")
self.character:SetVariable("LootPosition", "Mid")
end
function CrossWordMod.CrossWordAction:stop()
ISBaseTimedAction.stop(self)
end
function CrossWordMod.CrossWordAction:perform()
-- Reduce stress when the action is completed
local player = self.character
local stressReduction = 0.2
player:getStats():setStress(player:getStats():getStress() - stressReduction)
-- Ensure stress does not go below 0
if player:getStats():getStress() < 0 then
player:getStats():setStress(0)
end
ISBaseTimedAction.perform(self)
end
function CrossWordMod.CrossWordAction:new(character, duration)
local o = ISBaseTimedAction.new(self, character)
setmetatable(o, self)
self.__index = self
o.character = character
o.maxTime = duration * 60
return o
end
-- Add the action to the context menu
local function createCrossWordMenu(player, context, worldObjects, test)
local option = context:addOption("Do crosswords", nil, function()
local action = CrossWordMod.CrossWordAction:new(player, 2) -- 2 minutes
if action and player then
ISTimedActionQueue.add(action)
else
print("Error: Action or player is nil")
end
end)
option.toolTip = ISWorldObjectContextMenu.addToolTip()
option.toolTip.description = "Reduce stress by crosswording."
end
Events.OnFillWorldObjectContextMenu.Add(createCrossWordMenu)
The error is popping as soon as I right click my menu option on my character. Error is popping every second of the 2 minutes the action should use.
And the game is breakpointing here :
Did you read the error ?
Yep but for real I can't find what is the problem...
here is what I have in console
Did you see 3 first line of what you are showing me ?
Starting from here
Bcs the line where you an error isn't what you show here, it's at line 81 you get the error
hi, does anyone know how to add extra pain/damage effects to the health panel? and how to indiciate its being treated with a custom item? eg. if i want to add a stick on poultice to treat a leg ulcer (and show that the leg has an ulcer) or use a sticky heatpack, how would i indiciate that in the health panel? I know how to manipulate exisiting vanilla conditions like bleeding, deep wound etc but not sure how to add new conditions. any pointers to mods I can reference would be helpful too. thanks!
Made a trait, works well, except that it does nothing right now.
I want to make it something that seems simple. Eating raw cockroaches doesn't change unhappiness, and eating cooked roaches increases it instead,
but I have no idea how to make this work without overriding the vanilla roaches.
what can i do? i want it to be compatible with everything
i am trying to make a mod that adds a custom craftable poster
i have made a ".pack" file and a ".tiles" file and managed to create the item and the recipe in a way that it shows up in game
i am however incapable of placing it somewhere (i don't even know if it can find the proper tile)
help would be greatly appreciated ^^
Could be a dozen things. If you want to, I can have a look (dm me your zipped up mod)
Well you're gonna have to override the vanilla item if the player has the trait
But like I said only if the player has it
Idk how else you are supposed to make it work
you can use script manager and doparam to add or change the OnEat line, then create an OnEat function (or decorate/wrap the original one, if there is one) to do a different thing if the player has a trait
this code does that every item can be stored in every hotbar thing?
like a pistol on a normal belt, a katana in a pistol holster or something?
cause if it does that i dont want it, its to delete it
I was never able to reproduce this one, but adding a nil check is no issue so I did it.
Did you have an NPC mod or something installed?
I've noticed NPC mods run code they shouldn't sometimes as if the NPC is a full player. Just the only reasonable guess I can come up with for why code that destorys the player's UI has no UI to destroy.
Do you run the game in debug mode?
Hi! Is it possible to assign a new texture to a clothing item via lua coding during game although the texture is not specified in the item's xml file?
I've asked a few times but I think that got missed
I do
Yeah Idk why those processes are different but that was the only context for that bug
Well, I added the nil check, so it should be handled now.
Auto layout now avoids moving your panels
Probably by faaar the easiest / best way to handle that
I'll try it again soon
I am excited
That one's for sure going on the server when you finish
IT might just not let me carry enough stuff lol I dunno about that one but I still wanna help make sure it's good for the people and also for myself if I ever visit an IT server
Dropping 50-60 of my vinyls on the ground when I spawn because there aren't slots for that many items anymore made me a little sadface lol
lol
But obviously in the context of the mod it makes sense
I use weight reduction mods I am the opposite of target market for IT lmfao I just want to carry stuff like I'm Link and keep it moving
Completely fair, IT is a mood
I just have to celebrate this somewhere... got some motivation today and solved the key zombie animation porting steps I needed to solve to make a Shaun of the Dead stealth mod
So that's on the way soon lol
That's my vibe... make fake zombie noises, act like zombie, all is well now
happy for you brother
stealth mod sounds pretty cool, ill be waiting to try it
🔥
You could have asked me for zombie animations and how to get them in the game lol
Not sure the right place, but could I potentially have someone read through my mod I made and why it isn't working. 🫠
question since i have seen java and lua now here
in what language is zomboid programmed?
The game itself uses both, but modding generally only uses lua
any specific reason why modding is mainly lua?
Ease of use
Java modding is a lot more involved
Lua, you just make a file in the right spot and your on your way
ah alr, cuz im a pretty solid bit into java (im delulu) and it would be interesting to see how they handle generics etc
tbh i dont even have the game yet, but in order to learn some stuff about games and how they are made or generally what you do, id like to look at modding communities of interesting games
im very sorry if i broke a conversation in here tho
but thanks very much for the quick awnser
lol I knew where they were but not which ones I needed exactly to get player to take on the animations of zombies. Thank you though
There are many idle animations and finding the right one took some trial and error.
Eventually got it sorted.
Almost all of them are used
That may be and that's all well and good but the key ingredient for me was to have a script that said this:
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>defaultIdle</m_Name>
<m_AnimName>Zombie_Idle</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SpeedScale>0.23</m_SpeedScale>
<m_SpeedScaleRandomMultiplierMin>0.2</m_SpeedScaleRandomMultiplierMin>
<m_SpeedScaleRandomMultiplierMax>1.25</m_SpeedScaleRandomMultiplierMax>
<m_BlendTime>0.35</m_BlendTime>
<m_randomAdvanceFraction>0.50</m_randomAdvanceFraction>
<m_Conditions>
<m_Name>zombieImpersonator</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Transitions>
<m_Target>lunge1</m_Target>
<m_blendInTime>0.5</m_blendInTime>
<m_blendOutTime>0.5</m_blendOutTime>
</m_Transitions>
<m_Transitions>
<m_Target>lunge2</m_Target>
<m_blendInTime>0.5</m_blendInTime>
<m_blendOutTime>0.5</m_blendOutTime>
</m_Transitions>
</animNode>
in player/idle
I was trying to to use just the necessary xml and not go overboard copying in a bunch of stuff I didn't need.
This works perfectly so far for idling like a zed
@bright fog I do have one question left since you're offering lmao but it's not animation related, just Zombie related...
Yeah ?
People tell me that ghost mode makes you invisible to other players in addition to zombies... First, is that accurate? Not talkin admin, just setGhostMode(true)
Yes
Okay see this is why I need more testing friends lol because now I'm not sure
Getting mixed info
I wonder if I can just use ghost mode only to avoid zeds
Hmm
And remain visible to others
Did you check the camouflage zombie mod ?
Nah
public boolean isGhostMode() {
return this.isInvisible();
}
public boolean isInvisible() {
return this.invisible;
}
This sets useless the zombies
So zombies can't target you ever
This has the slight problem of modifying zombie speed
zombie:setUseless(true)
I'm currently playing a lot with it and trying to figure out the best way to remove zombie targeting but I'm not 100% satisfied with what it does
Is that unsynced?
Uuuh good question
Because I don't want zeds to stop attacking other nearby players
Just because I'm acting like a zed
They will stop attacking any players
I mean
If you don't force sync it you will probably get massive desync issues
snakes camoflage mod works fine for this also
and doesn't set them useless if i recall
In multiplayer? @slow hound
hmm
So like one person can be camo and another can be visible? @slow hound
yes
I need to check it out then
it only stops the aggro on the person themselves
i'd played with my lady using this before and it works as you would expect
it also is janky as well but overall should give an idea if i remember
It does, it sets useless zombies
Does the same thing as Braven
Damn
ahhh lol weird. myb braven prolly borrowed the concept apologies
small part of it that shows it
if Vdist >= 1.3 and Vdist <= (10 * levelDetection) then
if Moodle.getValue() > 0.0 and Functions.allowDetection(source) then
if zombie:getModData().playerDetected == nil or zombie:getModData().playerDetected == true then
if not zombie:isUseless() then
zombie:setUseless(true);
zombie:getModData().playerDetected = false;
end
end
else
if zombie:isUseless() then
zombie:setUseless(false);
zombie:getModData().playerDetected = false;
end
end
else
if Vdist < 1.3 then
if zombie:isUseless() then
zombie:setUseless(false);
zombie:getModData().playerDetected = false;
end
end
if Vdist > 10 then
if zombie:getModData().playerDetected == false then
if zombie:isUseless() then
zombie:setUseless(false);
end
zombie:getModData().playerDetected = true;
end
end
end
end
The last method I heard of is from Poltergeist
But it's very janky
And it would still cause the problem of the zombie never targeting any players
I super hate this solution lmfao
My instinct is to just give everyone ability to see ghost mode.
It sets the properties of the tiles the zombie is on to smoke which makes the zombie incapable of targeting
Me too
eh
Don't think you can do that ?
Idc about large servers with admin needs for this particular mod
i know glytcher and some others at one point in time were developing a mod where you play as the zombie, i remember seeing they handled the aggro. but no idea how. just shooting things out there
It's a goof mod for playing among friends
does clearAggroList() do anything?
Most likely the same thing
What large server is going to let people hide from zombies by acting like one AND cares about having secret admin police?
haha
Or secret admin maintenance as the case may be
public void clearAggroList() {
try {
Arrays.fill(this.aggroList, (Object)null);
} catch (Exception var2) {
}
}
What does aggroList even do
What is it used for
can't you just remove zombies directly from the java list? or exclude them from being added if you have certain conditions? i have looked so little at those classes
The problem is that a lot of stuff are just handled java side
actually you know what. that's not located in media
yea you are right
it's zombiepopman
bleh
And even if you end up removing the zombie it will most likely be readded then run the code that uses the list and then lua code runs
It's exactly like what I tested, to setTarget(nil) to remove a zombie agro
You can't do that
Bcs it doesn't care, it will readd the target anyway
The moment it runs the java
And like I'm having a problem too where I need a way to get specific zombies to not target you but end up having to rely on setUseless and smoke tile properties
And none of those satisfy my needs bcs at the end I still need to have zombies to move at specific points
And I found a way to make zombies move where I want but if it's using the pathing system it's glitchy and doesn't properly react
And if it's the actual manual movement of zombies I need to create a pathing system to have the zombie not run into walls and shit like that
And like I could maybe do that but uh it's really not great
Would need to recreate an entire pathing system, would have to go study various available methods to do such a thing or maybe recreate the java pathing system and reimplement it in lua then modify it
@wet sandal You about to drop EQUI update?!?!?!?!?!?!!?!?
I just noticed I can't launch my server with your beta lmfao
Assuming hidden or deleted.
Would it be possible to hide the contents of containers if the player has no light source?
Yea it's out
Ready for the trial by fire
Damn I'm subbin
If I can keep pace I'll update Tetris next week and do a patch for Equipment UI for anything I missed at the same time
Sounds good, I'll let you know today if I see any glaring issues
Definitely
@bright fog I just tested in HOST mode and I am a ghost and other player can see me just fine
So I'm gonna do it this way
Will update you if I find weird situations later but I am optimistic
Hmm
Too bad I can't use that
Yeah sorry
i been looking into this and it seems you have to modify a damage value to decrease aggro and then when the aggro = 0 then you can remove the zombie from the aggro list and use something like spotted to prevent more aggro being added from that specific player since the only way aggro seems to be added is by being spotted or by damage. by being spotted it adds some kind of fake damage to the zombie to raise the aggro of that player
i think i read through that correctly. havent went over the whole thing yet but it's looking doable

what ?
LOL... yeah.... i'm trying to figure out the aggro value part but i'm confusing myself also. it does seem like there is some way to handle aggro though
when im off work i'll try to look more and see if i can give a better example. this is why i normally wait til after work to make comments haha
private static class Aggro {
IsoMovingObject obj;
float damage;
long lastDamage;
public Aggro(IsoMovingObject var1, float var2) {
this.obj = var1;
this.damage = var2;
this.lastDamage = System.currentTimeMillis();
}
public void addDamage(float var1) {
this.damage += var1;
this.lastDamage = System.currentTimeMillis();
}
public float getAggro() {
float var1 = (float)(System.currentTimeMillis() - this.lastDamage);
float var2 = Math.min(1.0F, Math.max(0.0F, (10000.0F - var1) / 5000.0F));
var2 = Math.min(1.0F, Math.max(0.0F, var2 * this.damage * 0.5F));
return var2;
}
}
ill leave that for now and come back later maybe my brain won't be too jello for it
Well, if you find out I'm interested
If LuaManager.java lists a class as exposed, does that mean I could edit that class purely in Lua? And if so, how would I do that?
I see this.setExposed(IsoPlayer.class); and what I want to change is in that class.
No it means you can call that stuff
Ah. So I could modify the return, but not the formulas inside the called function?
Can only decorate how that function gets called when Lua calls it
Not quite... Only the return in Lua calling from Lua
Java will call original Java
I'm not sure I understand the distinction...
Well a Lua script can call getPlayer():getPlayerNum() or a Java class can call getPlayer():getPlayerNum(). You can hook and decorate only the first situation's result
How can I tell if a given method can be called from Lua? Would it have to be in LuaManager or similar?
If the function is in the exposed classes in that long list of exposed stuff then it's functions should be exposed
Cat on me
Linking you difficult
Basically what I'd love to do is change this...
if (var4 != null && var4.getSprite() != null && var4.getSprite().getName() != null) {
String var5 = var4.getSprite().getName();
if (var5.contains("blends_natural_01") && var8) {
var7 = 2;
} else if (!var5.contains("blends_natural_01") && this.getCurrentSquare().getBuilding() == null) {
var7 = 1;
}
}```
...and shift var7 = 2 to 1, and var7 = 1 to 0.
It's within updateFootInjuries()
Which... as far as I can tell seems to be the only injury type not called by Lua, but I'm not sure.
Rewriting that in Lua would be a headache and it wouldn't stop game from getting wrong result if a Java function calls that
Which it definitely would...
I don't think it's exposed
Hrm... is there any way to use Lua to lie to it about the return of, like, this.isWalking vs this.isRunning?
Or... to periodically reset footInjuryTimer, with the period dependent on movement speed type?
Not sure. What is your goal broadly?
Alternatively, could I just change it on my machine and not publish it? I'd like to publish the mod, but...
Well, basically I find the frequency of foot injuries on most terrain types to be absurd. Orders of magnitude too high, like needing several bandages to walk across a well-manicured suburban lawn, or along a sidewalk. So I want to tone that down significantly but I'd rather not just completely disable it, especially for walking through trees.
So you are perfectly named
I am indeed. xD
Haven't worn a thing on my feet in well over a decade, and I promise, you don't slash your feet to bits walking on soft grass, or smooth pavement, heh.
The mod "Callused Feet" attempted to disable it entirely by intervening in the injury call and set "scratch resistance" to 100, but it's broken and abandoned (if it ever worked at all, which I'm somewhat dubious about given comments on the Workshop page), and... there's got to be a more elegant way.
So where would I look to see what I can do in Lua? Event.java inside the Lua folder?
Ah, that's tiny.
There are a bunch of TriggerHook methods in LuaHookManager, for different numbers of internal variables... is that useful to me? Only seems to go up to 6, and this method has at least 7...
Really I wish they'd just expose those parameters to sandbox settings... but is probably pretty low priority. There's definitely interest in the playerbase, but probably not a ton. On the other hand, it's a pretty easy change, I'd think.
I wonder why it's only in java? Maybe because it gets called a whole lot, the whole time the player is moving, so it needs to be pretty fast?
@tiny stirrup I have a workaround for you
Really?
local pl = getPlayer()
local sq = pl:getSquare();
for i=0, sq:getObjects():size()-1 do
local obj = sq:getObjects():get(i)
local spr = obj:getSprite()
if spr then
if spr:getName() and spr:getName() == "yourspritename" then
print(spr:getName());
end
end
if obj:getOverlaySprite() == "yourspritename" and obj:getOverlaySprite():getName() then
print(obj:getOverlaySprite():getName())
end
local attachedSprites = obj:getAttachedAnimSprite()
if attachedSprites ~= nil then
for i = 0, attachedSprites:size()-1 do
local spr = attachedSprites:get(i):getParentSprite()
if spr and spr:getName() == "yourspritename" then
spr:getName()
end
end
end
end
double check syntax and format. i did not test this
Interesting... the idea being to to interfere with checking what kind of square the player is on?
wherever you're standing on
you can change the square thats just what i do to quickly check for stuff
you can break down this code into 3 functions btw.
sprite, overlaysprite, attachedsprite
I'm not super clear on how that helps... I'm not super experienced in java. Most of my coding experience is ancient, and C++
i think attached sprites are for stuff like tv? not really quite sure tho
but we use lua
you could try and run it on lua console whilst on debug
But what is it intended to do?
youre trying to find "blends_natural_01" sprite right so there. i just didnt implement the contains() but still it should work
What exactly are you trying to help him do?
Hmm
Well
Yeah I'm... a little confused. Would the idea be to always return null? That'd make heavy wilderness tiles look like normal outdoor tiles, wouldn't it? But that's the opposite of what I want to do. My problem is with normal outdoor tiles. I'd considered maybe making it think "not blends_natural_01" tiles are always building tiles, but I'm not sure how to do that.
Here's a thing:
local BarefootWarrior = {}
BarefootWarrior.movedEnoughToHurt = function(player)
if whateverConditionsYouWant then
return true
end
return false -- Until you decide it's true
end
BarefootWarrior.toughenFeet = function(player)
if BarefootWarrior.movedEnoughToHurt(player) then return end
local leftFoot = player():getBodyDamage():getBodyPart(BodyPartType.Foot_L)
local rightFoot = player():getBodyDamage():getBodyPart(BodyPartType.Foot_R)
if leftFoot:HasInjury() then
leftFoot:RestoreToFullHealth()
end
if rightFoot:HasInjury() then
rightFoot:RestoreToFullHealth()
end
end
Events.OnPlayerMove.Add(BarefootWarrior.toughenFeet)
BarefootWarrior.recoverFeet = function(player)
if player:isMoving() then return end
whateverConditionsYouWant = resetThemOverTimeSpentResting
end
Events.OnPlayerUpdate.Add(BarefootWarrior.recoverFeet)
return BarefootWarrior
And link me when you're done because I'd fully run this
But fair warning people are going to want you to convert it into a skill 100%
That effectively monitors foot health and if you haven't moved enough to get a foot injury, it heals it immediately?
Yep
And you decide how long it takes before the player can actually injure their feet
You could also set other conditions
So that could be packaged into a trait or skill?
like check whether they're on glass
A skill could be really interesting...
You could in theory have a skill that determines how long they can go without resting
Get better at going barefoot over time, which is pretty realistic.
And even give glass resistance and stuff at high levels
People would very much be into it
Refer to other mods that add skills if interested, beyond what I can show you without doin the research
It... would seriously push my capabilities... would you be willing to co-author it, maybe? Or I could just worship you forever if you do it? 🙃
I do have a mod that adds a trait that adds unhappiness over time if you're not barefoot, and adds happiness if you are.
oh just saw what he posted the java getsprite thing . and so i wrote something from old snippets
Which I totally didn't rip off of a nudist trait mod at all.
But, y'know, that's coding. xD
your name makes sense now
That's me.
I do like your workaround @thick karma. The more I think about it I think it's a better solution than anything else I've considered. Maybe make it specific to scratches so it doesn't magically heal deep wounds/glass shards? 🤔
Yeah just check the player's position for anything you think SHOULD hurt right away
And include it in the raw time check
etc
I mean that code above will get you very much started. I can't guarantee I'll get to any more of it on any specific schedule but if you make a genuine effort and get fully stuck someone here will likely try to help
There's shockingly little differentiation between tiles. Pretty much just default, indoors, and rough terrain denoted by blends_natural_01, but... maybe shrubs or the like.
There is a getBrokenGlass() on squares
Would you be willing to mentor me through it a bit?
so you can just check player:getSquare():getBrokenGlass()
I will most likely be around but there are a lot of people who know the same things I know. I would just stay active in these channels.
Yeah, I'm fine with how it handles that. In real life, glass isn't nearly so scary, especially flat glass from things like windows, which generally lay flat on hard surfaces. But then I thought about it on grass or dirt, where the surface could easily prop it up, plus most people think glass is pretty problematic.
Heh, you'd be surprised how many times over how long I've asked about this...
can someone help me with this? i added guns to the table of superb survivors and they all spawn correctly, some of them work correctly but the ones that use modded bullets dont spawn them. im trying to add them too but im not sure how to
Anyone know if we've gotten the devs to cough up any formatting changes for b42 recipes yet? Especially how they're doing workbench reqs.
I am dying to get back to the grind
i found that, seems to be what has the type of bullets so it then can spawn boxes for it. i tried modifying it, but its not working
this
are the group/whatever-it-was/things you load in at the start of a script on that script? It's either that or you need to add that to the item id's
because by default it could be assuming that's all base. items
wait im dumb im thinking recipe scripts
well, the file its a little larger than what im showing and the screenshot is from the original file from the mod
hehe, its ok. this is from SuperSurvivorsCombatUtilities
so, mod already has this in to support orgm and it's not working or did you add some of these yourself?
the orgm comes within the files. wait, the thing if(ismodenabled("ORGM")) then retun bullets.. "_box" end is what enables all the other elseif lines?
i dont have the mod, does that mean all the elseif lines are like not taken into account?
uh... just looking at that, that shouldn't be the case? looks more like it's just running that check and then ending that section before moving on to... what looks like brita's ammo?
prob just an orgm compatibility thing they shoved into the same function
yeah, im no modder but i thought that too because of the "end" at the end of the line
doesnt say anything about britas
been a hot minute since I messed around with Brita's stuff, but those look like mostly what Brita's ammos are named
cant really think of another mod that'd be using 4 gauge
or 30-06
what gun mods are you using?
oh, i didnt know that
im trying to make it work with guns of 93. i already ""had it working"" because i tweaked a minor something and it turned the vanilla weapons into gunsof93 ones
but today i added all the guns of the mod to the pool in the weapons list file
yup thats the one
give me like 5 mins to go dig into that rq
sure, thanks btw
are the survivors using whatever guns use 30-06 spawning with their ammo properly?
havent checked with that one specificaly, ive been spawning them and it has a little chance to spawn with a garand (the weapon that uses that)
it looks like those should be working because this mod uses the same itemid for it's 30-06 as Brita's. a lot of the other bullets for that mod aren't the same though.
there's the mod's ammo item script
those are what you want to get added into that section of the lua script
item NAME - NAME is the itemid.
yeah, for the modified thing i did i copied them straight of the items scripts too
lemme show u rq
this is what mine looks like, that doesnt work
theres more to it tho, this is i guess what tells the npcs how much ammo they get from each box, i edited them too
adding the right names and such
could be whats making everything fail
honestly, that shouldn't cause them not to spawn in a container/inventory
that's just telling the mod how many bullets each box is intended to turn into, but turning boxes into bullets is handled solely through recipes, it's not an actual stat on the box... as cool as it would be to have ammo boxes act like fluid items.
yeah i guess, still worth mentioning just in case
can you link the survivors mod you're using exactly?
I think that first section of the script might not be what you're looking for
interesting, im inclined to believe it is what controls the thing im trying to change because i did something wrong and now no ammo spawns on npcs at all
can someone help
aight. not seeing a ton of people having the same issues, but based on the singular existing standalone compatibility mod to make britas guns work with it, it doesn't seem like you should need to mess with the ammos in that file? I'm not sure. Superb Survivors for the most part looks like it's automatically grabbing the ammotype and ammobox variables from the gun they hold so just adding the weapons to their usable guns list should work? as far as them spawning in with the ammo, I can't find the part of the code actually governing that and it's getting pretty late here for me.
Worst case, could always try asking nolanritchie on steam to see if they can give some insight on the issue.
but I can say that the whole box to bullet/bullet to box lines in there don't seem to actually control what ammo they spawn with in their inventories. that seems to be more for like... if they loot a box of ammo and need to turn it into reloadable bullets.
i see, i guess thats what im doing next. thanks a lot for your help friend
ello! i was wondering how to have it so you spawn with a box that has items in it. I know how to get the box to spawn where I want it, but I dont know if dictating what's in the box is possible
if getActivatedMods:contains('ORGM') then
So now I'm to the point of not getting textures to show or the recipe functions to work but hey the game at least loads lol
show us what you have
module UwuChildhoodSnacks
{
imports
{
Base
}
model GreenCrayon_Ground
{
mesh = WorldItems/Candle,
texture = WorldItems/GreenCrayon_Ground,
scale = 0.5,
}
model BlueCrayon_Ground
{
mesh = WorldItems/Candle,
texture = WorldItems/BlueCrayon_Ground,
scale = 0.5,
}
model RedCrayon_Ground
{
mesh = WorldItems/Candle,
texture = WorldItems/RedCrayon_Ground,
scale = 0.5,
}
model BrownCrayon_Ground
{
mesh = WorldItems/Candle,
texture = WorldItems/BrownCrayon_Ground,
scale = 0.5,
}
model PurpleCrayon_Ground
{
mesh = WorldItems/Candle,
texture = WorldItems/PurpleCrayon_Ground,
scale = 0.5,
}
model YellowCrayon_Ground
{
mesh = WorldItems/Candle,
texture = WorldItems/YellowCrayon_Ground,
scale = 0.5,
}
model BlackCrayon_Ground
{
mesh = WorldItems/Candle,
texture = WorldItems/BlackCrayon_Ground_Ground,
scale = 0.5,
}
model OrangeCrayon_Ground
{
mesh = WorldItems/Candle,
texture = WorldItems/OrangeCrayon_Ground,
scale = 0.5,
}
model CrayonBox_Ground
{
mesh = WorldItems/JuiceBox,
texture = WorldItems/CrayonBox_Ground,
scale = 0.5,
}
model EmptyCrayonBox_Ground
{
mesh = WorldItems/JuiceBox,
texture = WorldItems/EmptyCrayonBox_Ground,
scale = 0.5,
}
model GlitterGlue_Ground
{
mesh = WorldItems/Glue,
texture = WorldItems/GlitterGlue_Ground,
scale = 0.5,
}
}
your textures in the wrong folder
based on what you wrote on the model
you either transfer the textures or change the script by removing the worlditems
the screenshot you sent has prefix items. it means they are for icons right? however k dont see the worlditems folder so ...
Okay. So then I would get the 3d model mesh image to recolor to what I want them to look like for the worlditems folder?
if you have the right textures for it then yes.
Okay. That helps.
Is mod development a good way to learn more about programming? I've made interfaces for world of warcraft before using lua, should I give it a try?
The last part that I don't have an idea as to why it isn't working is this.
You're trying to call the function GiveCrayons while your function is GiveCrayon
Oh god use a table please
Same thing, use a table
Let me show you how
local crayon = {
[1] == "Red",
[2] == "Blue",
[3] == "Green",
[4] == "Black",
......
}
function ....
local item = crayon[crayonChance]
-- maybe add a check for item not nil if needed
getPlayer():getInventory():AddItem("Base."..item.."Crayon")
end
Made it small bcs writting from phone but you could simply give the entire item name in the list considering you have some options that are formated differently like the Box
Also your ZombRand goes from 1 to 7
So these 2 last options will never appear
go for it
ZombRand(1,8)
it actually starts with 0 but since 1 is defined then it will start with 1 . and it will end on 7 not 8. so basically it will generate a random number from 1 to 7. and if it hits 1. since the condition is ==1 . then the code will execute. . which is give player bunch of crayons.
this can be done using table and suggest that you do it using tables.
what doggy wrote is a similar code using table but instead of spawning all crayons when you hit 1 . it will spawn 1 crayon which is whatever assigned to the key .. so if you hit 1 then yiu recieve "(Red" as a string . and will be placed inside the "Base."..
HERE
.."Crayon")
result should then be
"Base.RedCrayon"
if you hit 1
an item which only can be crafted or an item which can spawn in a container when game starts?
an item which is crafted and then placed
into a container
You could try to add mod data to the item when it is placed in the container and use it to check how long the item stays in there.
I can think of 2 ways how to transform the item into the new one if time is over:
-
Whenever player opens the container's inventory, check whether an item of your type is present, whether it is old enough and if so, delete the item and replace it with the new one
-
Store the container somewhere in the global mod data (best thing is here to store container's coordinates on the map I guess since mod data can easily store numerical values). Then use an event like Event.EveryDays and check each for each of the containers whether the respective items are old enough. If so, delete them and replace with the new ones.
In both cases, it might be necessary to make sure the items are properly removed and replaced on server side. In the second variant, you may also need to make sure that the container is removed from global mod data in case it doesn't contain the item anymore (if player has removed it or if it has been removed).
All this is just a brainstorm but I guess both versions might work somehow.
EDIT: Btw first version can have the disadvantage that the item only changes if player looks into the container (this could lead to undesirable behavior in case the item is lying on the ground and it's 3D model is rendered). So I guess the 2. version might be even better. Or should it just change if it is in a specific container for a long time?
Thank you so much!
one more thing
what does the number thats at the end of this do
table.insert(ProceduralDistributions["list"]["CafeteriaSnacks"].items, 5);
It's the value inserted in the table
has smth to do with the probability an item spawns in a specific area
It's inserting in a table that is in a table in a table
so is it like 5% chance or?
The tables
ProceduralDistributionslistCafeteriaSnacksitem
That I'm not sure, from my understanding it's a weight
im trying to get my items to have 20% chance to spawn but cant figure out what value to use
unfortunately I don't know anymore what this number exactly means for the spawnrate 😂
But there are definitely people here who know this. Asked this same question some time ago and got a precise answer here. But I already forgot XD
do you remember how you asked? i might be able to search your question
unfortunately not
hmm was it this
yes!!! that was the related discussion! at least I am quite sure it was the same question you have
You might want to directly insert items then in the container but tbf I'm not an expert on the subject so maybe not
hmm idk i am probably doing something wrong with distribution
table.insert(ProceduralDistributions["list"]["BakeryMisc"].items, "Steak");
table.insert(ProceduralDistributions["list"]["BakeryMisc"].items, 10);
this is what I do for a item, is this correct way to do it?
Should be yes
what is BakeryMisc? an item?
as Sir Doggy Jvla then ... looks good to me too
https://steamcommunity.com/sharedfiles/filedetails/?id=3265709024
finished another mod
Hi guys, i created a tiles mod with all the correct .tiles and .pack files but cant seem to find those tiles on the debug menu (brush tool) with the mod installed. What i can try to fix the issue? Already placed the mod.info pack and tiledef with the numbers and idk what to do
hi, I have a small question regarding crafting recipes
I want the character to hold something in their hands as they perform the recipe, this is what I tried (the ??? I am unsure about what to write there):
{
keep RPBeer/RPBourbon,
Result: RPAlmanach,
RemoveResultItem:true,
Time: 1600.0,
Category:Survivalist,
Tooltip: OOC use only - game mechanical cure,
OnCreate:Recipe.OnCreate.JustABadDream,
AnimNode: DrinkBottle,
CanBeDoneFromFloor:true,
Prop2: ????,
Sound: sound/PZ_DrinkingFromBottle,
}```
I'm sure there are a few issues with the sounds and animations, but I can figure those out on my own.
My question would be, could I force the recipe to use the prop the player right clicked / uses for the crafting recipe?
Or do I need to really make as many instances as I want the character items to hold? e.g. if I have a recipe with 6 items, do I need to have 6 recipes?
its not possible to assign percent the number of items to spawn is unknown (due to mods)
imagine if 5 mods assign their item 20% then it wont actually be 20%
unless one mode overwrites everything and force a function to do the math and ultimately assigns everything an average then force your item to become 20% tho thats so unlikely . so yeah the weight just represent chances. cuz the game rolls for each item and im not sure but that might be the number of times it will attempt to spawn your item. higher value, higher chance
Thank you. So this would go first and then I'd have lines that do oncreate? Just so I understand. The function and definition of what local crayon is regards defining so that when crayonchance is added what to pull from?
you want to use Prop1: Source=1,
or Prop2: Source=1, i forget which hand is which
Does the red bracket being there provide a 'definition' for the coding that is pointed at by the blue coding?
Like when it says "local item=" it is connecting the information at the beginning to the function code so it knows what is supposed to be connected to what? I'm not home ATM otherwise I would share what I put in the document.
More trying to break it down so I understand lol
thank you! I will give it a try
The local for crayon here is in the main base of the file and will be accessible within the entire file
So function can access locals in the same level
While local item can only be accessed by things in the same level as it is
Doing crayon[crayonChance] will access the key within the table crayon and give out the corresponding value
OnCreate:Recipe.OnCreate.GiveCrayons,
function Recipe.OnCreate.GiveCrauons(items, result, player)
player:getInventory():AddItem("Base.RedCrayon");
player:getInventory():AddItem("Base.BlueCrayon");
player:getInventory():AddItem("Base.BrownCrayon");
player:getInventory():AddItem("Base.BlackCrayon");
player:getInventory():AddItem("Base.OrangeCrayon");
player:getInventory():AddItem("Base.PurpleCrayon");
end
Would the rest then look like this?
Okay. I think I understand better. Thank you.
Uh
I apologize if I'm getting it wrong still lol I've only ever messed with some css coding when I was much younger on neopets. 😅
local crayon = {
[1] == "Base.RedCrayon",
[2] == "Base.BlueCrayon",
[3] == "Base.GreenCrayon",
[4] == "Base.BlackCrayon",
[5] == "Base.BrownCrayon",
[6] == "Base.YellowCrayon",
[7] == "Base.OrangeCrayon",
[8] == "Base.PurpleCrayon",
[9] == "Base.EmptyCrayonBox", -- you made a typo in your original code writing Cragon ?
}
function Recipe.OnCreate.GiveCrayon(items,results,player)
local crayonChance = ZombRand(1,10)
local item = crayon[crayonChance]
if not item then return end
getPlayer():getInventory():AddItem(item)
end
Ah. Okay. Would mine I posted be more if I did randomization from a packaged item? With the zombrand part?
Forgot to add it
Just tried it out and it didn't place the prop into the character's hand
Do I need to define the source somewhere first?
Right right. Just understanding the difference between. Thank you. I'll try when I get home.
Your code, is a chain of if and Albion tested it when we talked about both method and using the if is actually slower
With the table, you don't have to fail N if before accessing N+1 condition
You just directly go to the value
Okay. That makes sense.
It's also way easier to organize
So whenever you can use that, it's most likely better to use it
The cases where you can't use that is if you use < > conditions
(and probably more example cases where you can't use it but these are the main ones that came to my mind)
nevermind! I just realized I didn't assign the items static models!
oh yea, if you dont have static models it doesnt show up in the hands
does anyone know if there's some sort of function in lua to define a radius from an origin (like player spawn) and have an event occur if the player leaves that radius? I'm working on a modded start where the player has a house arrest ankle monitor.
(trying to use this as a vehicle to re-learn lua, haven't really touched it since some extremely basic garrys mod scripts over a decade ago)
No but you can most likely do some simple math to check it out
I assume the best way to start would be to investigate how modded spawn points work as that will be dealing with the same coordinate code
That's really not needed
