#mod_development
1 messages ยท Page 54 of 1
can you show the line?
^^
Ow this is a first mod for you
Best of luck man.
yup. thank you
ah... onexitvehicle has been removed from the game
there's still a trigger in the java, but the event isn't actually registered lol
okay great so the lua events wiki page is outdated
it's quite outdated
I think OnExitVehicle is either bugged or wasnt ment to be used that way
so where can I see actual events that work in the game?
or is there no resource for that?
Hmm. It appears that the OnExitVehicle is null at this time. I'm not a pro with events. It looks correct to me.
i'm going to go through whichever events aren't registered and remove them from my pr
hopefully the maintainer will see that someday lol
OnUseVehicle
and OnExitVehicle both do this while
OnEnterVehicle works fine
?? onExitVehicle still works
these 3 are pretty essential to making what I want to make so I dont know if there are alternatives or the events are called something else now?
unless you're getting it in some weird way it's not even registered to Events
hmm, I'll have to double check, it was working as of 41.76
and the only part of the code that attempts to trigger it is related to teleporting out of vehicles
are you looking in the java or the lua?
the java... i suppose it could be registered in lua
most of the vehicle events are lua and client only
oh. So how can I access those?
it's registered in vanilla client, so there shouldn't be any issues with getting it before it's registered or anything
oh, wait, no, doesn't client load second?
last
and i bet this file is in shared or server?
its in shared yeah
pretty sure you can just register the event early if you want it
but it doesn't fire in shared so you may as well just add it in client
I need it to edit the condition values of vehicle parts, I dont think I can do that client side.
try
Events.OnGameBoot.Add(function()
Events.OnExitVehicle.Add(PlayerSay)
end)
i don't think onexitvehicle will even trigger on the server?
ya, its only on the client
so either move the OnExitVehicle-related code to the client folder or use the code above, whichever works best for how you're organising your code
you can just register the event early, its just a string
but I would recommend putting the code in client, ya
Well I wouldnt know how to relay that information from one script to another so I guess I will use the code above
You can put a moddata whenever the player enters the vehicle
getVehicle()
Then as he leaves
If not getVehicle() then
Just nil the moddata
While triggering the function you want
Hmm, well I have no idea what moddata is and when its triggered so I will have to find some documentation about that
Anyone understand this error? ๐ฆ (For context: I just deleted a same-name folder in mods and renamed another mod to the name of the preexisting folder and renamed some files in the mod directory.)
no implementation found generally means you passed the wrong number of arguments to a function that has multiple implementations.
many objects in game have modData, which is just a table you can stuff data into if you'd like. Its a little tricky making sure it saves when you exit sometimes, but its very handy. Its never triggered, its just a table
sendClientCommand has versions that accept 3 or 4 arguments (player, module, command, args)
But isn't skipping unnecessary arguments okay in Lua? Also, this code was working before I renamed files.
but it's a java function
you need to pass an empty table if you don't want any arguments
generally yes, but like albion says, its a java function
i don't know why that was working before, that isn't working code
Okay interesting. That's all well and good but it doesn't explain why this was working a second ago...
so the method @ancient grail suggested would have to be ran OnTick or something?
yeah i really wouldn't recommend doing it that way
yeah I kinda want to avoid using OnTick as much as possible
thats a good call
mod data is just a table attached to many kinds of objects, the benefit being that it saves to the savefile
sadly theres no events for vehicles taking damage so I will probably have to use it at some point
oh god, are you making vehicle armour too?
errybody making armor
yeah but i didn't know what they were for
yeah i've got a nearly finished vehicle armour mod, and anonymous has been working on some kind of vehicle damage api for like two months
i just settled for reverting damage on part updates lol
oh that, sounds like a good idea
I do that for offroading damage, because that's when its calculated anyway
just check if armor is there, if yes revert damage and subtract the damage from armor piece
yeah that's how mine works
anonymous has been doing some crazy extensive stuff to catch damage as it happens
so part updates happen when the condition of a part is changed?
no, they just happen fairly regularly
oh I see
ya
less often than ontick but still pretty often
@bronze yoke @quasi geode Well, sure enough, that fixed it, but I really wish I knew why it let me get away with that until the folder-name changing.
I originally wanted to make a counter so my on tick even would happen every 60 ticks, I am not sure if that would actually make any improvements performance wise, but that was my idea
my mod fires an event instead. So if you hit a tree it will say "taking this much damage from tree at x,y"
Never threw an error there before that, and I ran it several times...
even faster, OnTick passes the number of ticks so you can just modulo it
function BetterBatteries.itemHasBatteryRemoved(item)
local modData = item:getModData().batteryRemoved
local isBool = type(modData) == "boolean"
local isString = type(modData) == "string"
return isBool and modData or (isString and string.lower(modData) == "true" or false)
end
This is the strangest thing I've ever had to write.
oh right I could totally do that
oh hey wait I can remove the or false at the end
This would significantly reduce the performance impact of the code right? Since I am running the if statements only every second and only thing I am doing every tick is just that modulo operation
you could argue isString is redundant too, unless some weird mod starts throwing a third type into your moddata
That's true
Same kinda goes for the string.lower method, but really that's just extra padding to make sure it's OK
It does feel kinda pointless to be working on this, as you are working on your own armor system and Anonymous is making the events. But at this point I spent too much time on it to leave it I feel haha
haha well i've been pretty lazy with it as i've been caught up in other projects
Thank y'all again for the help
only modelled about half of the them, only did test textures for one, never really thought about balance
here's a thought: 'true' and true both evaluate to true, so if you're sure nobody is going to interfere with your moddata you can still do if item:getModData().batteryRemoved then
What annoys me about custom vehicles with armor is that the base game vehicles dont have armor, therefor they are not created equal. Vehicle armor only works if all the vehicles in my game have the ability to be armored up, And I have not seen a single mod that gives armor to base game vehicles
yeah that's how i've always felt
i don't like when mods are inconsistent with the vanilla game, it throws me out of things
I mean, I am a 3D artist by trade. If you want any help in that regard Id be more than happy to assist
oh that'd be great, my models are kind of crappy lol
this whole coding this is fun but frustrating as hell. I would much rather focus on the model side of things
Heres one more question. How do you deal with damage thats caused while a player is not inside the vehicle?
i think the part updates still fire?
okay so how do you get the vehicle to run the part update on?
do you just run the part update on every vehicle loaded?
ooh
i assume the java runs a part update too, and when it does it triggers a given lua function too
I completely forgot that I can define a function on the part
I think I can just about figure this out, but if you have a solid base and you'd want me to work on models for that Id rather start with that
And i think some of them have lockdown modding permission
So it means you cant copy their ways making lots of stuff incompatible
If things just got standardized compatibility would be a cakewalk. But I doubt that would ever happen
a build 42 vehicle rework with official armour support has been mentioned
i don't think they specified if vanilla vehicles will get armour then, but i've heard it's something they've wanted to do, so i wouldn't be surprised
build 42 is quite the ways away though right?
my mod is sort of intended to be a holdover until tis does it better lol
yeah thats kinda what I had in mind too
Though TBF I feel like the base game vehicles could do with a rework visually in general, or at least the wheels haha
i've heard people complain about it a lot before and i always thought they were daft, but for some reason today it really struck me that the vanilla vehicles really are too big...
too big? Thats not something I have heard before
I am not american so I cant really say, But cars in that era were pretty damn huge
What are you working on anyways? If you dont mind me asking
an armor mod for all the vanilla cars. I was also thinking of completely remodeling all the vanilla cars but that depends on how much time I will have
Another thing I really wanted to add was "plow" sort of part to put in the front of your car. It would reduce the amount of slowdown you get from running over zeds
but I have no idea how to implement something like that so thats on the back burner
Damn my discord on mobile is crap.. anyways wrent u working in the same thing before @bronze yoke
yeah they are, we just talked about this
Ahh ok cool
I cant seem to scroll history on mobile
view imgs, and sometimes my msgs dont get sent.lol
So I am working on a submenu right now and I'm a bit confused regarding how I need to attach functions to it... can someone help me out?
FTM.onFillInventoryContextMenu = function(playerIndex, menu, items)
if items[1].name == "Magic Map" then
menu:addOption("Jump", items, FTM.jump, playerIndex);
local favorites = menu:addOption("Jump to Favorite");
local subMenu = menu:getNew(menu);
menu:addSubMenu(favorites, subMenu);
-- ???
-- subMenu:addOption("Safehouse", {}, FTM.jump("Safehouse"), playerIndex);
-- subMenu:addOption("Safehouse", items, FTM.jump("Safehouse"), playerIndex);
-- subMenu:addOption("Safehouse", items[1], FTM.jump("Safehouse"), playerIndex);
end
end
When I try adding the option to the submenu, I cannot seem to make it activate upon clicking the submenu item... Instead, right-clicking the parent inventory item is automatically firing my submenu function.
add the submenu to the option, not the menu
Can you clarify what that looks like? Would I do favorites:addSubMenu(favorites, subMenu)?
or favorites:addSubMenu(menu, subMenu)?
hold on, i've confused myself
vehicles can only take damage from 2 things when nobody is in it: another vehicle crashing into it, or a player attacking it. There are different ways to detect those. As far as I know, no part updates happen when the car is empty and off
sorry, my bad, what you're doing is right
not certain about the part updates, but I know for a fact the engine stops updating once its cooled down
Hmmm, unfortunately not completely right because of behavior I mentioned... haha
interesting, thank you for the info
Anyone know how the "overrides" functionality works for items?
I asked this questions around 3 hours ago. Maybe someone who is on now has an idea if I can do that (as described clone a base shirt with own texture) or even better how I can do it. ๐
You can create a new shirt item with the same stats, Same goes for the new model with just a different texture
I'm not sure how to do this. As I stated in the original question I don't understand how exactly the model / texture / item is linked together:
#mod_development message
in the XML file
"<m_BaseTextures>clothes\shirt_tshirt_textures\shirt_formal</m_BaseTextures>
</clothingItem>"
the texture is located in textures/clothes
so you just replace that with the path of your other texture
and assign that shirt model to your new item
So does the item.txt -> ClothingItem = Shirt_FormalWhite, refer to the name of the xml file?
I am pretty sure yes
But I don't want to overwrite original code. So can I copy the original folder structure to the xml files to my mod directory and place my newItem.xml in there refernce my own texture etc. I never messed with clothing so far. For normal items like weapons I used models.txt so far.
Because I have no clue. And if I make a typo somewhere but I know it should work it makes it easier for me ๐
hey folks! putting this out here in case anyone who's online at the time might be able to give me some insight:
albion wrote most of this code for me (thanks albion!) but we ran into a rather curious issue that no one seems to be able to figure out. https://pastebin.com/bFH45JaW
this code causes containers to hugely overpopulate with cassettes (9 is the average i saw, or so) for basically no reason. as far as we can tell, it's set up properly, but even if the number in ZombRand is just 1, with only 1 item in each loot table's entry, it will seemingly spew tons of the replacement items into the container anyway
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
the code here is intended to set a customizable limit to the number of cassettes that can spawn in one container--it adds a dummy item to the loot tables of containers, and then replaces that dummy item with items chosen from the list, and it's supposed to replace them with a random number between 1 and the sandbox setting cassetteDropNumberA (which for my testing was always 1)
so in theory it should produce only ever one cassette per container, but for some reason it just. SPEWS them into containers
omfg someone needs to write a mod that stops server from disconnecting you when you spend too long in the F11 menu istfg
it completely pauses the game when you do that, so you're just timing out
i don't know if we can even touch that
sigh
Man I am so confused about how to add the function to the submenu option
So easy to make it appear
Just can't fire it correctly
local subOption = subMenu:addOption("Safehouse");
subOption.onSelect = FTM.jump;
almost works, but I need to pass a parameter...
so I tried...
local subOption = subMenu:addOption("Safehouse");
subOption.onSelect = FTM.jump;
subOption.param1 = "Safehouse";
But param1 got ignored.
Just as a basic question. If you don't replace the dummy item, can you confirm that there is only this 1 item in the container?
What (other) tests did you do so far?
Then I try
local subOption = subMenu:addOption("Safehouse");
subOption.onSelect = FTM.jump("Safehouse");
and this causes the action to fire as soon as I right-click the item (rather than left-clicking submenu entry as I want), but it does use the param correctly...
my code uses ISContextMenu:getNew, not menu:getNew
yknow, that's a good question i'll test that next
but as for the other question:
i've tested it without the sandbox setting in the field at all to make sure that isn't breaking it (it wasn't)
and i've tested it with only a single item in a single container's drop table, which resulted in the same thing
yeah i'm just playing spot the difference at this point
totally
Do you have a working example of a submenu from one of your mods I can glance at?
local itemOption = subMenuDuplicate:addOption(item:getDisplayName());
local subMenuAmount = ISContextMenu:getNew(subMenuDuplicate)
subMenuDuplicate:addSubMenu(itemOption, subMenuAmount)
subMenuAmount:addOption('1', item, duplicateItem, 1)
subMenuAmount:addOption('5', item, duplicateItem, 5)
subMenuAmount:addOption('10', item, duplicateItem, 10)
subMenuAmount:addOption('25', item, duplicateItem, 25)
subMenuAmount:addOption('50', item, duplicateItem, 50)
well well...
so one entry in a container's drop table can produce multiple of the same item
@bronze yoke i think we have our culprit lol
so then--does anyone know of a way to ensure that if an item drops in a container's loot table, it only drops one of those items?
Are you 1000000% sure this still works? When I do it this way, it superficially "works" (the function fires when I select it), but the parameter is not getting passed (e.g., my duplicateItem equivalent is not receiving its equivalent of 25)....
FTM.onFillInventoryContextMenu = function(playerIndex, menu, items)
if items[1].name == "Magic Map" then
menu:addOption("Jump", items, FTM.jump, playerIndex);
local favorites = menu:addOption("Jump to Favorite");
local subMenu = menu:getNew(menu);
menu:addSubMenu(favorites, subMenu);
local subItems = ISInventoryPane.getActualItems(items);
local subOption = subMenu:addOption("Safehouse", subItems, FTM.jump, "Safehouse");
end
end
it absolutely works
each entry in a dist table has rolls chance of spawning (ie: rolls determines how many may spawn)
Okay cool oh crap I undid the menu: change lemme try that
unless they broke context menus completely in one minor patch it's fine
No dice ๐ฆ
FTM.onFillInventoryContextMenu = function(playerIndex, menu, items)
if items[1].name == "Magic Map" then
menu:addOption("Jump", items, FTM.jump, playerIndex);
local favorites = menu:addOption("Jump to Favorite");
local subMenu = ISContextMenu:getNew(menu);
menu:addSubMenu(favorites, subMenu);
local subItems = ISInventoryPane.getActualItems(items);
local subOption = subMenu:addOption("Safehouse", subItems, FTM.jump, "Safehouse");
end
end
Any other ideas?
if you want to ensure only 1 appears (without changing the rolls value in the table) and you're already using the event to replace the dumy tapes with real ones, just remove any excess dummies
(Identical behavior, I think menu and ISContextMenu are interchangeable.)
that's what i was thinking
just use the system to delete any more dummies than 1 and then replace
I'm not that familiar with the loottable stuff I only added an item to some of the containers. It newer spawned more than one so far. But I understand it as a probability for each item that spawns in the container to be this specified item.
i'll bug albion to help me out with it when they're less busy! i'm not smart enough to code that myself but it sounds like something that oughta be not too difficult to just have it delete any excess items
Which container type do you check atm for the cassette? (for example: CrateCompactDiscs)
pretty sure it runs this on all containers?
Yes. But there is a file called Distributions.lua under media/lua/server/items/
oh oh you mean which container type do i check when testing
LivingRoomShelfNoTapes
i currently have a stripped down testing version that only spawns cassettes in that specific kind of container with this entry:
table.insert(ProceduralDistributions.list["LivingRoomShelfNoTapes"].items, 25 * SandboxVars.MFTEOTW.lootrarityfactorA);```
you can lookup for example shelfs in this file. there is for example:
{name="CrateCandyPackage", min=0, max=1, weightChance=40},
I assumed this can contain 1 item max. But newer checked the code... So assumed the max is 9 I expect the system to start with 1 roll which item it will be and go to the next...
or at least something in this direction... But I'm sure someone else knows more about this than me...
In the ProceduralDistributions.lua it's defined as follows:
LivingRoomShelfNoTapes = {
rolls = 4,
items = {
this likely is not the correct way to do it, but you can try
subMenu:addOption("Safehouse", subitems, function() FTM.jump("Safehouse") end)
So I would expect 4 items. But I don't really know how it works in details. But I should learn that too ๐
it goes through the items table 4 times in that example, each entry has 4 chances to spawn
Ah, thanks.
So the answer of Fenris_Wolf explains your problem...
yeah, i gotcha! at this point the answer to this problem is probably to set up the system further to delete any duplicate items before it begins replacing
This should work. You can move the inner loop outside or if it just have to be one item from the list like follows:
local function onFillContainer(_roomName, _containerType, container)
local dummies = container:getAllType("Tsarcraft.BlankCassetteMain") -- dummy item type
for i = 0, dummies:size()-1 do
container:Remove(dummies:get(i))
end
local itemChoice = ZombRand(#itemList)+1
local item = container:AddItem(itemList[itemChoice])
container:addItemOnServer(item)
end
Not a bad idea at all, I'll lyk if that works.
But the probability changes with the amount of rerolls the container does for each item. So if you want the spawn chances of the cassette by type then you have to do it by yourself in lua.
ya, at this point theres not really any point with for the dummy / replacement concept, since as Soul says the probability will jump around based on number of rolls per container. much easier to just include a ZombRand probability check in the OnFillContainer to have them spawn
You win ultimate hero of my last five minutes award! Thanks for being brilliant!
lol
ya, I dunno how the addOption function is supposed to work, its quite odd to me that it has param1,param2,param3 etc instead of just .... I haven't done context menu stuff in a couple months and forget it entirely
Because they couldn't think of a way to do this with infinite params:
function ISContextMenu:allocOption(name, target, onSelect, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10)
if #self.optionPool == 0 then
table.insert(self.optionPool, {})
end
local option = table.remove(self.optionPool, #self.optionPool)
table.wipe(option)
option.id = self.numOptions
option.name = name
option.onSelect = onSelect
option.target = target
option.param1 = param1
option.param2 = param2
option.param3 = param3
option.param4 = param4
option.param5 = param5
option.param6 = param6
option.param7 = param7
option.param8 = param8
option.param9 = param9
option.param10 = param10
option.subOption = nil
return option
end
function ISContextMenu:addOption(name, target, onSelect, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10)
if getCore():getGameMode() == "Tutorial" then
if self:getOptionFromName(name) then
return;
end
end
local option = self:allocOption(name, target, onSelect, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10);
option.iconTexture = nil
self.options[self.numOptions] = option;
self.numOptions = self.numOptions + 1;
self:calcHeight()
self:setWidth(self:calcWidth())
return option;
end
However, knowing this is what happens to the param1 is not helping me understand wtf it isn't working ๐ญ
Oh well you gave me a perfect working solution so I am done worrying about it.
Ty again
Was stuck there awhile
I'm sure it'll come up when I'm trying to do context stuff a month from now XD
"Now you know, and knowing is half the battle." โ GI Joe.
surely they could've just done option.params = {...}?
Right?
i get the feeling that the context menu code is very old because it's just a little odd?
I have no idea.
like why are the arguments first parameter -> function -> other parameters, that just seems unnecessarily confusing
lol it's quite wonktastic
I wonder how quick table.sort is. I have an array of objects that a vehicle has collided with, and I want to sort it... it can't be too bad, especially since the array will probably be pretty small
i think you worry about performance far too much
I play with a rtx3080 and I get like 15 fps if I drive full speed fully zoomed out, I don't want to compound that terrible performance any more than I have to, lol
that's because of the renderer though
you're not wrong
generally, any lag from mods is coming from insanely inefficient algorithms, not using table.sort on an event
it all adds up. In this case its probably not bad, but if I didn't pre-prune the list, and the comparison was expensive, it could easily cause issues
in fact, just getting in a vehicle a first time causes a big lag spike on my old save game, most likely because of too many mods with armor code doing their checks
this. performance should always be a consideration given the insane number of mods people like to run, a good number of which probably dont optimize their code for performance
performance should always be a consideration in all programming! i'm just saying not to stress micro-optimisations
sure. over optimization and worrying about performance during non-critical time is pointless but in too many cases its ignored completely ๐
if this is for passing an argument for an event, consider that not sorting the table could cause multiple other mods to need to sort the table - it just depends how useful having the table sorted is
for context, when a collision happens I'm scanning every square in a circle the diameter of the length of the car (possibly ~100 squares), and iterating through every object in that square to see if it is collideable. If I then sort the result by say the dot product of vectors... well now we're doing a lot of square roots and a lot of calls to the java. Its worth thinking about to cut any corners you can. You're right though, it probably won't break the bank.. .this time
100 squares!?
some modded vehicles get pretty long
a semi trailer could potentially collide with a lot of things at the same time, lol.
best I can tell from the code, the physics engine determines if there was a collision, then the java goes "oh shit the car stopped real suddenly, must have been a collision", then it does this exact process to try and find the culprit
its not great
Don't vehicles have a is in square array?
if it does, it isn't using it for its own hit detection
Anyone know where the campfire sitting animations are stored?
Feedback on Meditation: "I did notice that when I am 3-4 titles away from a lit campfire, my character goes into the pose then stands up right away and it keeps looping. Works everywhere else though, great job - Namaste"
What is getType()
I got a question: Is there a (relatively simple) way to include water from a sink/water source into a recipe? For example:
{
Toothbrush,
Toothpaste;1,
Water=1,
Result:Toothbrush,
Time:500.0,
}```
Is there a way to replace the `Water=1,` with something that will refer to a water source as well, and not just any bottles/etc in your inventory?
I'm thinking about developing an stone/iron mining mod, i imagine I could easily repurpose the code for cutting down trees, correct?
At long last, I've updated Better Batteries to be marginally less garbage with unsupported mods.

A day and night, gone.
Also probably yes.
as a test of the hit detection I started ramming another car beside a fence without ever touching the fence. It eventually broke. That's proof enough for me that it's not a false positive when I detect it, lol
how do I get the current ticks?
IngameState.numberTicks
I don't see a function anywhere to get that, although if its exposed I guess I can find a way
maybe I'll just pass in a timestamp and ignore the ticks
yeah i had a look around and i couldn't see a way to get to that
There's a timestamp that is time the game is up if I recall
there is a getTimestamp getTimeStampMs, getGameTime, getTimeInMillis
not to mention the functions in os
there's a getGametimeTimestamp() too, but i assume that is to do with world time
I'll have to look through them all, but nothing pertinent showed up in "find usages" for that value so I dunno
if you find a way let me know, this is gross lol
Delay.OnTick = function(tick)
Delay.currentTick = tick
well, getTimeInMillis and getTimeStampMs give the same value, and getTimestamp gives the same value but in whole seconds
getGametimeTimestamp gives a completely different value, so that's possibly it
my guess is that comes from GameTime and not the session though
public static long getGametimeTimestamp() {
return GameTime.instance.getCalender().getTimeInMillis() / 1000L;
}
```yeah...
blegh
strange oversight, lol
IngameState doesn't seem to be exposed either, I can't get a hold of its instance. Looks like outputting ticks from an OnTick event is the only option
is there somewhere I can see what all is contained within self.deviceData? (working on the base game radios if that helps)
it's probably an instance of the java class right? if it is then this page should help https://projectzomboid.com/modding/zombie/radio/devices/DeviceData.html
declaration: package: zombie.radio.devices, class: DeviceData
it is, and that is what i'm looking for, thanks!
had the code put little arrows where the game calculates a collision. Its, uh... unexpected
just an idea and hear me out:
rollerblades
๐ผ ๐ผ
how do i make the sandbox option revert to its default setting?
is there anything i can just delete?
You can edit the file to make it default...
there is a resetToDefault function
Probably resets all of them
There's also the same function for the ConfigOption class
so SandboxSettings.SettingsPage.Setting:resetToDefault()
Anybody knows which Lua libraries are available for use in modding PZ?
Watch bootleg 81330's clip Untitled and discover the newest trending Project Zomboid clips on Medal.tv -- your place for gaming moments.
so how do i fix the scaling and uhh rotation
cause its backwards and wayyyy to large
Hey random question, is it possible to control the player name plate based on equipped items, i.e hide if wearing a mask?
Are there vanilla recipes with a success chance?
I am thinking of something like fail to convert an item, keep one of base items, remove the other. So probably have onCreate function that adds or removes the items?
also I assume if I make an item and add data it will be fine as is, and no need to sync anything, if it's in player inventory?
Doable
I couldn't find anything in game code, would make a great mod though
Whats the best way to store an array on a string
Since they have commas ( , )
Its kinda hard to store them on files or sandboxvar
What i did was just used a diffrent delimiter which was ( @ )
Looked terrible
Esp due the fact that im storing coords
maybe someone here has a better way of doing this
Sample would be
"10000@5000@0",
soo its been a rather relatively long time since I last modded in PZ and ngl kinda forgot most basics ๐ฌ
Currently, I am trying to check if the player right clicks a vehicle and using the following code. Problem is they're being detected as IsoObject, the same as 70% of other items.
Events.OnFillWorldObjectContextMenu.Add(function(player, context, worldobjects)
vehicle = nil
for veh,worldObject in ipairs(worldobjects) do
--if instanceof(worldObject, 'IsoGenerator') then
-- vehicle = worldObject
--end
print(worldObject:getClass():getName())
end
print(vehicle)
end)```
Is there a rather unique identifier to them?
A Graphic for all the BloodLocations.
Might be useful for some to have the overview.
Does anyone have an idea how complicated could be or if theres already a mod that changes the initial time setting?
Somethig like this:
Whats wrong with the @ sign? Does the string have to be human readable? As long you have a delimiter that doesn't conflict with other content your fine. Depending on the content I often use ";" or "/" or "$".
function ISRenameEverything:onRenameVehicle(playerObj, vehicle)
if button.internal == "OK" then
if button.parent.entry:getText() and button.parent.entry:getText() ~= "" then
vehicle:getModData().renameEverything_vehicleName = button.parent.entry:getText()
end
end
end```
I am trying to update a vehicle's moddata using this but apparently its not working. Whenever I try to call the value, it returns nil. Am I missing something?
Yeah to be honest i know that it has to be human readable but i could find any that would work
; Didnt
And _ didnt
I wasnt able to try -
Its too late now the mods done
Special thnx to buffy and burryaga
https://steamcommunity.com/sharedfiles/filedetails/?id=2892401130
failing ; i generally go with |
Thanks very much @ancient grail for the Fast Travel Mod work
For those looking for some custom mod work, he's easy to work with and communicates well. Worth the money when you need specific functionality in your servers/worlds.
Anyone around today happen to know the answer to this? I'm still looking around in the files trying to figure out how the game decides to animate sitting differently when I'm by a fire, but I'm not quite understanding it... all I know is that instead of entering the ordinary sitting loop, something else happens, and as a result my custom animation for the act of sitting down (rather than the state of being down) starts looping... (and the animation that is supposed to be looping after I sit never begins looping)
@bronze yoke Thanks, I had refocused on those files and decided maybe I was missing an override there... Would you expect I need to override everything in that folder with my animation to make sure it has priority (except maybe ext)? I am currently about to try that. Just got done adding a modded version of every sit-on-ground file in AnimSets/player/sitonground
i'm not even sure if ext is used
Damn no dice regardless
I overwrote them all but I'm still looping beside the fire ๐ฆ
by any chance do yall know the pz mod where you can choose to spawn with any bag and clothing item?
that's a sandbox setting
Its not a mod
The mod was fashion montage but its broken and also obsolete. When starting a new run in sanbox enable unlock clothing I think?
Anyone have any good ideas for reliably detecting a nearby (active) heat source such as a campfire or fireplace? Trying to interrupt the animation override when I'm in those scenarios since I can't make the animation work right now...
campfires are global objects so you could use getLuaObjectOnSquare or whatever it's called and it'd probably be a lot cheaper than scanning squares for objects, not sure if there's a similar workaround for fireplaces though
I just found this... it seems promising?
function SCampfireSystem:lowerFuelAmount()
for i=1,self:getLuaObjectCount() do
local luaObject = self:getLuaObjectByIndex(i)
if luaObject.isLit then
local amt = 1
-- if RainManager.isRaining() and luaObject.exterior then amt = 2 end
luaObject.fuelAmt = math.max(luaObject.fuelAmt - amt, 0)
luaObject:changeFireLvl()
end
end
end```
I think I can hook function CGlobalObjectSystem:getLuaObjectByIndex(index), determine whether the target is a lit thing, and if it is, determine whether it's near a player, and if it is, disable my animation override
If anyone is reading this and sth please tell me a better way lmao
the thing is, if you can't find a similar thing with fireplaces (i don't think they're global objects) then you're going to have to loop through nearby objects anyway and this is pointless
you mean I'm to have to use for i=1,self:getLuaObjectCount() do ... end? I had already planned to need that loop... but I was thinking about how to access the x and y value of the returned object. AFAIK getLuaObjectByIndex(i) returns the modData and that doesn't have immediate access to the x and y I need...
what i mean is if fireplaces can't be found easily too you're going to have to loop through isoobjects in range of the player, and at that point using global object functions isn't really saving any performance
I see... so they may have the same animation effect but one is not in the lua objects...
yeah, campfires are global objects so we can use that shortcut but it looks like fireplaces are just java
Hmmm... so it looks like in Lua I can check if a fireplace is lit like this??
function ISMoveableSpriteProps:getInfoPanelFlagsPerTile( _square, _object, _player, _mode )
. . .
if instanceof(_object, "IsoFireplace") then
InfoPanelFlags.tooHot = InfoPanelFlags.tooHot or (_object and (_object:isLit() or _object:isSmouldering()));
end
Question is, what is that object?
and how is it sent...
an IsoFireplace. You should be able to search for usages of that function to see how its normally provided its inputs
for i=1,square:getObjects():size() do
local object2 = square:getObjects():get(i-1)
if instanceof(object2, "IsoFireplace") then
fireplace = object2
end
end
Hmmm maybe bingo?
ya, you'll have to do that on every square nearby, its how PZ handles a lot of these kinds of checks, its also how I'm currently determining what objects people hit with a car
@astral dune Fair enough. Do you think it would be prohibitively slow to check for lit stuff in a 10x10 centered on the player? Seems like a lot of checking just to activate the animation
Gotta be an easier way...
Only electricity
it looks like in the Java they combine all the flags into a single field per square, so they can simply run one check per square to see if tooHot is active anywhere in the square, for example. We don't seem to be able to do the same so we have to iterate through every object in the square. There is typically only a couple objects per square, but that's still a couple hundred checks, you don't want to do it too often
Ooooooof.
Crap.
So that's why they can check so much faster for whether heat is near me? They really don't keep heat sources separate?
Sheesh
doing it once, when they sit down, then keeping a reference to the fireplace you found to check if its state has changed while they're sitting, its probably as performant as you can make it. Will still break if someone builds and lights a fireplace beside you while you're meditating but what are the chances of that? lol
Pz logic
we can't? i've seen squares tested for flags that should belong to objects
the type of flags I was looking at I couldn't, but it looks like there are different collections of flags. the InfoPanelFlags in his code snippet looks like its accessible
I hear you. Thanks for the insight. I may hook campfire lighting to protect against that latter case because I can be obsessive but I am just hoping this can run fast enough not to feel absurd when I sit down. Might need to add a toggle for this setting for potato PCs.
i would be shocked if doing one nearby object scan caused a significant lag spike
ZomboidBitFlag was the container I was not able to access before, for checking if a lightswitch was present in a square
the range can't be too long right? you have to get pretty close to the campfires
ya, its should be fine to run once while sitting, just don't run it every tick of the meditation, haha
Alright, trying THIS...
Yogi.manhattan = function(x, y, z, a, b, c)
return math.abs(x - a) + math.abs(y - b) + math.abs(z - c)
end
Yogi.warming = function(player)
local squares = {}
for x = -5, 5 do
for y = -5, 5 do
for z = -5, 5 do
squares[x .. ", " .. y] = getSquare(player:getX() + x, player:getY() + y, player:getZ() + z)
end
end
end
for location, square in squares do
for index = 0, square:getObjects():size() - 1 do
local object = square:getObjects():get(index)
if instanceof(object, "IsoFireplace") then
if object:isLit() then
local x = player:getX()
local y = player:getY()
local z = player:getZ()
local a = object:getX()
local b = object:getY()
local c = object:getZ()
if Yogi.manhattan(x, y, z, a, b, c) < 15 then
return true
end
end
end
end
end
local campfireData = SCampfireSystem.instance
if not campfireData then return false end
for index = 1, campfireData:getLuaObjectCount() do
local luaObject = campfireData:getLuaObjectByIndex(index)
local object = campfireData.system:getObjectByIndex(index - 1)
if luaObject.isLit then
local x = player:getX()
local y = player:getY()
local z = player:getZ()
local a = object:getX()
local b = object:getY()
local c = object:getZ()
if Yogi.manhattan(x, y, z, a, b, c) < 15 then
return true
end
end
end
return false
end
Crossing fingers, what a cluster.
wonder if I should mention not to SCamfire on client side
Huh why not?
It doesn't exist clientside?
Well I am loading up so I am about to find out the hard way, regardless...
Shit I wrote .getX facepalm
I wish you were wrong so bad.
๐ญ
Maaan I'm gonna have to send server commands just to tell players where these campfires are...
Mega-oof
I still struggeling with my problem from yesterday.
#mod_development message
So far I tried it this way:
#mod_development message
but I didn't manage to bring it to work. I copied the original shirt item to my mod and renamed the ClothingItem according to my new named xml.
When I mouseover the shirt in the inventory I get the following exception:
STACK TRACE
-----------------------------------------
Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@5c5568e3
function: render -- file: ISToolTipInv.lua line # 108 | Vanilla
ERROR: General , 1669323908447> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at GeneratedMethodAccessor456.invoke.
ERROR: General , 1669323908447> DebugLogStream.printException> Stack trace:
...
Caused by: java.lang.NullPointerException: Cannot invoke "zombie.core.skinnedmodel.visual.ItemVisual.getHole(zombie.characterTextures.BloodBodyPartType)" because "<local14>" is null
at zombie.inventory.types.Clothing.DoTooltip(Clothing.java:215)
at zombie.inventory.InventoryItem.DoTooltip(InventoryItem.java:619)
... 45 more
My files look like this:
scripts/clothing/shirts.txt
module SoulMod
{
item Shirt_FormalWhitePent
{
DisplayCategory = Clothing,
Type = Clothing,
DisplayName = Formal Shirt Pent,
ClothingItem = Shirt_FormalWhitePent,
BodyLocation = Shirt,
Icon = ShirtGeneric,
BloodLocation = ShirtLongSleeves,
Insulation = 0.25,
WindResistance = 0.15,
FabricType = Cotton,
WorldStaticModel = Shirt_Ground,
}
}
clothing/clothingItems/Shirt_FormalWhitePent.xml
<?xml version="1.0" encoding="utf-8"?>
<clothingItem>
<m_MaleModel></m_MaleModel>
<m_FemaleModel></m_FemaleModel>
<m_GUID>ac7976de-2c73-44ea-9392-5d24ac1fb649</m_GUID>
<m_Static>false</m_Static>
<m_AllowRandomHue>false</m_AllowRandomHue>
<m_AllowRandomTint>false</m_AllowRandomTint>
<m_AttachBone></m_AttachBone>
<m_BaseTextures>clothes\shirt_tshirt_textures\shirt_formalPent</m_BaseTextures>
</clothingItem>
textures/clothes/shirt_tshirt_textures/Shirt_FormalPent.png (binary)
I don't even know if this is even possible or at least a good approach. Maybe its easier to create a new model...
Try same thing just change the s to c, like CCamfire. I haven't looked too close your code but it's usually something like that.
I'm very glad you're right this time. You're pretty hit or miss, I gotta say. ๐
That moment when you accidentally fixed the problem you didn't know you could fix... (???)
The ironic thing here is that my immediate goal was to stop this animation from happening altogether...
But instead it just... worked the way I originally intended...
I have no idea wtf
So... confused...
It's as if the animation gets triggered, and then the game starts trying to trigger the animation again over and over... but at that point my protection is intervening and saying, "No, we shouldn't be running that animation because we're near a fire..." and yet it is already running that animation next to a fire... I just... what?
I wonder if it's actually because it's raining or something... maybe the fire isn't having its normal effect...
Omfg. @bronze yoke @astral dune I fixed my problem so damn long ago and didn't even know
Fixing the other animation files COMPLETELY worked.
I didn't NOTICE because I was still subscribed to my workshop mod.
And it wasn't a lua conflict, so the checksum never warned me of the difference.
My bad, am super dumb.
All those loops were pointless and unnecessary lmao
sigh
They just triggered the Lua checksum conflict that led me to disable my workshop sub.
๐
My bad... thanks for putting up with me.
do any other files store anything related to zpop or zombie settings besides those prefixed with zpop
we all have been there
Someone has an idea if I'm on the right way with this?
Still facing this problem. Would be lovely if someone's got an idea
nvm i just realised I never passed the button into the function
I also have an other question. I want to create a candle like item which can be held in hand or be placed in the world. The first part with holding it in the hand seems to work but what do I have to do now? Do I have to create kind of a worlditem like a lamp and use the "pickup/place" actions on the left pane. Or can I go with the normal place function from the context menu. I want the the item to be able to switch on or of if "placed" in the world.
How do you reverse
local playerObj = getSpecificPlayer(player)``` and use PlayerObj to get player?
playerObj:getPlayerNum()
tyy
Can you put a character limit in a textbox? Also how do you check if player is currently in Singleplayer or Multiplayer?
anyone know of a mod where you can clean stuff with water instead of bleach
Currently I use this:
SoulMod.isSoloGame = (not isClient() and not isServer())
and then you can check:
if SoulMod.isSoloGame then ...
of course you use your mod name ๐
Thanks!
Is OnFillWorldObjectContextMenu used for populating the context menu that appears when you simply right click the ground?
How yould you guys rank the difficulty of modding in these items from scratch?
- Weapon/tool
-Firearm (crossbow) - Hooded jacket
- Bag
I plan on making all of these but Im new to pz modding so Id like to start from easiest and work my way up
Good evening, returning player here, is there some kind of compilation here for working mods for singleplayer? I really want to go back playing in this game but i can't help myself but install mods. and Now my character won't pick up or transfer any items ๐ฆ
I'm pretty sure jacket would be easiest and bag 2nd
Hey guys so I'm fairly new to this but I'm currently working on editing a tool tip. I wanted to add another line of text so i added it to my translation and i get it to show no problem, even have break working correctly. Now Im being picky because i would like to turn my one getText() red. Is this possible? What would be the code format?
hey guys, what could this mean when uploading a workshop map for the first time?
Make sure workshop folder is structured exactly right (correct folder names), images are correct resolution and color depth, workshop.txt and mod.info aren't excessively long and don't have weird characters... All of these things seem to be potentially relevant to upload working properly.
<RED>
ok, i have double checked all of these things, and still i get the same error. im clueless at this point
local testTooltip = getText("IGUI_Tooltip_Warning").."\n".."\n".." "..getText("IGUI_Tooltip_Start").."\n"
where would i insert that lol
before the part you want to be red
i keep trying to insert it and i reload the lua in debug and it fails. so im missing something
I recommend recreating each file in a new workshop folder, reexporting images (be sure to flatten them), and deleting the id line from workshop.txt so that it makes a new workshop item, just in case current one bugged somehow.
Is it possible to add leather to animals after theyve been butchered?
what color depth needs to be used for images?
Hi I wanted to make custom professions and stuff where would I start?
Is it possible to toggle enable/disable mods from a another mod
Like sandbox option
Like getactivatedmod("modname):disable()
Perhaps
Sorry I fell asleep, idr poster but preview was 24... I recommend you check a working mod
If you flatten before exporting in Gimp, poster and preview should be fine using default export settings for png
@vapid hull but if you actually forget to flatten, the depth may be wrong, and if so the upload will fail
declaration: package: zombie.characters.professions, class: ProfessionFactory
Also possibly https://projectzomboid.com/modding/zombie/characters/traits/TraitFactory.html if you want your professions to have unique traits
declaration: package: zombie.characters.traits, class: TraitFactory
Is setting a condition on a weapon a thing?
check ProjectZomboid\media\scripts\items_weapons.txt
I don't know items that well but I know the weapons have a lot of defined properties in that file
Many thanks
If I wanted to switch a candle on and off in the world, I might model it on the light switches:
ISLightContextMenu.doMenu = function(player, context, worldobjects, test)
if test and ISWorldObjectContextMenu.Test then
return true
end
local thump = nil
local square = nil
for _, v in ipairs(worldobjects) do
square = v:getSquare()
if instanceof(v, 'IsoThumpable') then
if not v:haveFuel() then
if v:getModData()['IsLighting'] then
thump = v
end
end
end
end
if test then
return ISWorldObjectContextMenu.setTest()
end
if thump then
if thump:isLightSourceOn() then
context:addOption(getText 'ContextMenu_Turn_Off', thump, ISLightContextMenu.onToggleThumpableLight, player)
elseif thump:getSquare():haveElectricity() or (SandboxVars.ElecShutModifier > -1 and GameTime:getInstance():getNightsSurvived() < SandboxVars.ElecShutModifier) then
context:addOption(getText 'ContextMenu_Turn_On', thump, ISLightContextMenu.onToggleThumpableLight, player)
end
end
end
Events.OnFillWorldObjectContextMenu.Add(ISLightContextMenu.doMenu)
I doubt it gets a lot more straightforward than this...
Welp I just crashed zomboid for the first time trying to get Magnet Fishing to work.
Yaaay!
First time for everything huh?

Famous last words of zomboid: "LOG : General , 1669373818058> Final tier was 2"
Truer words have rarely been spoken
LOG : General , 1669373818058> Final tier was 2, indeed, Zomboid. LOG : General , 1669373818058> Final tier was 2, indeed.
It's refreshing talking to another human being after pulling an all nighter
hello. i'm looking for information about ProceduralDistributions.lua file..
does anyone know where to find it?
i want to add some item on my PZ game
Lol what you don't like one-way communication with error message windows? @quasi kernel
I had some info on ProceduralDist but it's not coming to me atm, apologies
Also, the error message window wasn't very chatty. Very unfortunate.
Now I get to spam the ever loving crap out of prints until I figure out what's crashing
Steam\steamapps\common\ProjectZomboid\media\lua\server\Items
thank you!
In general, using Windows search in Steam\steamapps\common\ProjectZomboid\media will find a lot of the files you need while modding. A lot of others will be on https://zomboid-javadoc.com/41.65/
Javadoc Project Zomboid Modding API package index
@normal kite
thank you, can i hav one more question?
Haha they say never ask to ask in places like this
Even if I don't know someone else might
But I am lurking
@tacit ermine what do you know about PZ Extender
https://github.com/pz-extender/extender
I ask because I'm trying to figure out an error about "Failed to find Premain-Class manifest attribute in pz-extender-framework.jar"
started down the path of adding a manifest.mf file using gradle, which the project uses, but I'm coming up short. Last time I switched the project over to Maven in order to add the manifest and that worked, but this time I have decided to pause and ask more about this error
er let me look, it's been a while since I worked on that code
you need to restart the save for alot of ui stuff. Ui stuff are initialized in the start of the game, so modifying Lua and reloading them doesn't immediately get reflected on some things. this might be one of those things. if it still doesn't work, I can show an example for getting the red text working later when I get back to my pc
how are you launching the game with the jar exactly? it should be the aspectj JAR you pass to the -javaagent option in the game JVM options, and pz-extender-framework.jar should be on the classpath
so I'm on linux (if that matters at all)
"vmArgs": [
"-javaagent:/Path/To/Your/Artifacts/pz-extender-framework.jar",
"-javaagent:/Path/To/Your/Artifacts/pz-extender-api.jar",
"-Djava.awt.headless=true",
yeah so the -javaagent option should point to an aspectj JAR and the extender JARs themselves should be specified on the classpath via a -classpath option, let me see if I have a premade configuration file
ah, that was the aop.xml file I saw, gotcha
yeah if you have an example of the launching args, I would love that
PhysicsObject thing is hardcoded?
sorry, don't have a ready made example right now (and actually it doesn't look like I left this in a place where you can just drop it in and get going), I can put one together and update the repo when I'm back from work. For now here's a rough outline:
javaagentshould point to a local copy of this JAR https://repo1.maven.org/maven2/org/aspectj/aspectjweaver/1.9.9.1/aspectjweaver-1.9.9.1.jarpz-extender-*.jarfiles should be moved to theclasspathentry in the ProjectZomboid64.json file- The
classpathentry also needs to contain all the JARs that pz-extender depends on, there's no easy way to grab those right now without writing a Gradle command to print the classpath (i.e. inextender-framework/build.gradle.kts#pzLaunch64)- In the thing I worked on prior to pz-extender I used the shadow plugin to create a single JAR with all the dependencies in it https://github.com/garyttierney/project-zomboid-server/blob/master/game-server-agent/build.gradle.kts#L57-L66, that could be done here and you only need to add the single JAR from the build folder to
classpath
- In the thing I worked on prior to pz-extender I used the shadow plugin to create a single JAR with all the dependencies in it https://github.com/garyttierney/project-zomboid-server/blob/master/game-server-agent/build.gradle.kts#L57-L66, that could be done here and you only need to add the single JAR from the build folder to
you can also start the game with Gradle via gradle pzLaunch64 and see the full list of options it constructs
@ember kernel Hey I saw your message on my mod this morning and I was hoping you might be able to touch base with me about some of the mods your running. I think the smoking issue may be a conflict but I'm not sure.
I am testing now, and the mod seems to be working... I do not become a nervous wreck in seconds even with smoker trait, although if I artificially increase the time since last cigarette I CAN make my stress level start rising while meditating
But it does not happen in seconds... it would take probably 10 minutes minimum at the rate it's going...
I see. The only mods that I have that might affect smoker trait users is More Traits and Jigga's Green Fire. Other than that, I'm not quite sure what might affect it.
Hmmm I have had issues with More Traits in the past. I will take a look at it. I stopped running that mod because it was throwing exceptions for me
I have not yet tested alongside Green Fire but I'll do that first since I have it
Failing that, I may have you send me server config so I can just check the error log
One thing to note as well, I've only had it happen occur once and that was when I first booted my server with your mod
Hmmm intriguing
Haven't had it happen again so far though
I do not initialize any player stats or anything crazy
So i'm not sure why that would occur only once...
Veeery odd.
The thing is I might be the only one who experienced it so I don't think you need to investigate it further for now
For sure. Please feel free to DM me if you get any more data on that.
I'll make sure to leave a comment again with more info and a potential log file if it does happen again though!
I like to make my mods as error-free as I can
If we can reproduce the bug I'll kill it
I may actually add a bonus drain for smokers tbh
I think it's reasonable to let players meditate instead of smoking.
That's a thing people actually do.
(Just bonus stress drain)
sorry to be a pain @tacit ermine but when I run that gradle task I get No main class specified and classpath is not an executable jar.
@ember kernel It's a conflict with jigga's Green Fire but I have no idea how off the top of my head. Pretty sure it's something that mod does, rather than something my mod does, mainly because my mod has no existing mechanism for (A) arbitrarily setting stats to faraway levels, and (B) increasing any of these negative stats in the first place.
my adjustments are all relative adjustments:
if player:getStats():getFear() > 0 then
local currentFear = player:getStats():getFear()
local newFear = math.max(0, currentFear - meditationVars.fearRecovery)
player:getStats():setFear(newFear)
end
if player:getStats():getPanic() > 0 then
local currentPanic = player:getStats():getPanic()
local newPanic = math.max(0, currentPanic - meditationVars.panicRecovery)
player:getStats():setFear(newPanic)
end
if player:getStats():getAnger() > 0 then
local currentAnger = player:getStats():getAnger()
local newAnger = math.max(0, currentAnger - meditationVars.angerRecovery)
player:getStats():setFear(newAnger)
end
if player:getStats():getStress() > 0 then
local currentStress = player:getStats():getStress()
local newStress = math.max(0, currentStress - meditationVars.stressRecovery)
player:getStats():setStress(newStress)
end
if player:getBodyDamage():getBoredomLevel() > 0 then
local currentBoredom = player:getBodyDamage():getBoredomLevel()
local newBoredom = math.max(0, currentBoredom - meditationVars.boredomRecovery)
player:getBodyDamage():setBoredomLevel(newBoredom)
end
if player:getBodyDamage():getUnhappynessLevel() > 0 then
local currentUnhappiness = player:getBodyDamage():getUnhappynessLevel()
local newUnhappiness = math.max(0, currentUnhappiness - meditationVars.happinessRecovery)
player:getBodyDamage():setUnhappynessLevel(newUnhappiness)
end
They get the current value, then adjust it by the sandbox variable for that value.
There is no way for them to increase these values because the delta gets subtracted and the delta is strictly nonnegative.
Grats!
Only thing I need to do is make fished up water containers have tainted and we're done
Just gotta adjust the loot tables and make a thumbnail from there
I wish we have a channel filled with FAQ like this
Check it... jigga's mod prevents me from zeroing my stress at all. I cannot manually set it to 0, even when I haven't smoked lately.
I can make it higher than .509 etc., but I cannot make it lower.
By the way, when I joined with jigga's mod, it immediately increased panic, stress, unhappiness, and boredom for me. @ember kernel
Congratulations man
have you changed gamePath in gradle.properties?
@ember kernel I solved it, thank you SO much for reporting that issue!
There is a separate getStressFromCigarettes component of getStress that has to be individually zeroed.
Updating mod soon.
Why cant i change the display name using doParam?
anyone know a mod that is a xp multiplier for singleplay?
its a feature in base game
heh
ya all
i have question
i know what means when object calls null
aka it calls nothing
but what in hell means calling nil
null2?
what like a book or just a skill multiplier?
I put electricity on x2.5, u need to change settings in Sandbox
Object tried to call nil
anyone will give me any help how to fix this issue i have
nah only for hosting a mp not for singleplayer
aight tnx
both for single and mp
nil is null
Whats the diffrence?
Ah i see
A value that is declared but not usable

You're awesome.
@ember kernel I pushed the update. Be aware that I made invisibility OFF by default, so please jump into sandbox options and enable the new One With The Force option if you like that ability.
I do NOT know if it fixes the spawn-with-higher stress issue, however the mod DOES allow you to meditate away smoking stress now, so in theory it should not be a major issue if that only happens once when players first install the mod. I cannot trigger the issue anymore, so I'm not even sure it can still be triggered, but I did not consciously fix that, so I have no way of being sure.
Fine by me, thanks again!
I figured it out, did not ever get the <RED> tag to work. Instead defined drawText with its RGB variables.
thats wierd, I wonder why it didnt work for you. the <RED> tag is used quite alot in the vanilla lua code. you should be able to just replace the rgb tag "RGB:1,0,0" with "<RED>". Although I do see some places where they still use the rgb tags to show things in red. might be a weird implementation detail on which function they use to display text.
Yea so heres how i had to do it (if anyone cares) I was modifying skill journal to be consumed on read and wanted to insert a tooltip to warn the players
require "ISUI/ISToolTipInv"
local tooltipWarning = getText("IGUI_Tooltip_Warning")
local function drawDetailsTooltip(tooltip, tooltipWarning, tooltipStart, skillsRecord, x, y, fontType)
local fnt = {r=0.9, g=0.9, b=0.9, a=1}
tooltip:drawText(tooltipWarning, x, y, fnt.r, 0, 0, fnt.a, fontType)
tooltip:drawText(tooltipStart, x, y+20, fnt.r, fnt.g, fnt.b, fnt.a, fontType)
tooltip:drawText(skillsRecord, x+20, y+40, fnt.r, fnt.g, fnt.b, fnt.a, fontType)
end
How do I know if a event is clientside or serverside?
is there any reason why you aren't just inserting the text you want to be displayed into the description of the tooltip object? rather than making new drawText calls?
uhhh not specifically is it better practice to keep drawtext calls low? Im new to this so im not really aware of best practices
well the description is normally where you would put the text you want displayed. you should be able to properly use the text tags like the <RED>, RGB:#,#,# or <LINE>
I guess as long as you get it to look like what you want, it shouldnt make a difference. I don't think there is a "problem" doing it that way, but in future, its probably easier to just do that rather than all the extra work with the drawtext calls
it also will handle the width and length and the newlines for you, so you don't need to set them
tag will work if you put text somewhere where rich text is used, otherwise it's just text, here it makes sense to use the rgb to drawText.
if it works, it works
don't break it
lol ^
i uh will look at that route - so its just editing the item script in "media/scripts" right? and whats the new variable i add for description? Silly to ask but is there a resource for this?
ISTooltipInv use java to make the tooltip, right? But it also uses the tooltip txt of item.
the display name parameter is only read if the game can't find a translation string for that item
that's what this page is for https://pzwiki.net/wiki/Modding
it does not uses "tooltip =" in the item it manifests its own tooltip window from the dependency
im looking into this deeper and im seeing what you guys are saying just taking a minute to wrap my head around it
You can add a line to item with setTooltip(string), but I don't know if it will convert the tag.
But it lacks
Categories
So i can never change it if it has a translation?
if the request for the name is coming from lua (and as far as i know that's the only place the names are used), you can hook the get name function
print(isClient()) print(isServer())
do
local metatable = __classmetatables[zombie.inventory.types.Literature.class].__index
local old_getName = metatable.getName
function metatable.getName(self)
if getNumActivePlayers() == 1 and Literacy.PlayerHasReadBook(getPlayer(), self) then
return getText('IGUI_ReadIndicator', old_getName(self))
end
return old_getName(self)
end
end
```this is an item name override i wrote for my literacy mod, you'd have to change a few things like the type being overwritten and how you check if you need to overwrite it but this should be a decent guide
๐ค never seen __classmetatables before
you can use it to overwrite kahlua's reference to java functions
same result as calling getMetatable on an instance of the object, but without requiring an instance, I assume
little confused as to how zombie.inventory.types.Literature.class works without quotes
we're getting the value of zombie.inventory.types.Literature.class, not using 'zombie.inventory.types.Literature.class' as a string key
so there is a _G.zombie.inventory.types.Literature.class variable?
honestly i have no idea, i didn't actually notice that before but this is tested code so there must be
hmm, I wonder if that will somehow let me get my hands on IsoGameCharacter... I can't remember why I need it, but it seemed important at the time
its type is userdata I assume?
yeah
interdasting. Provided getClassField() works on those "classes" that could save a lot of hassle. I'll give'r a go when I get home
albion I am seeing an issue with vanilla read timed action, I use speed up to read faster but when I hit esc time keeps going on fast, and I just realised my option is reset for timed actions
lol
anyone know a good online lua 5.1 interpreter? Trying to test some setfenv getfenv stuff but all the interpreters I have found are 5.3 which doesn't have those functions anymore
so instead of doing the draw text there, you just put the text into the following:
tooltip.description = "your text here with tags"
thanks!
I think the proper to do it, if it is just simple text and not anything dynamic, is to use a tooltip_EN.txt files, and you would insert the text there. then you can use just the item definition to have the tooltip = Tooltip_youritem. then in the translation file a line with Tooltip_youritem = "tooltip text here". so depending on what you are doing this might be the "better" way to do it.
How do I know what a event got replaced by? For example it says OnBeingHitByZombie is obsolete but what replaces it?
Would you consider it a bug that ISBasetimedAction:setTime(time) doesn't actually set the time on the java action?
This was so confusing for me when I started modding, I had no idea why it didn't work.
What's a good way to debug / test a multiplayer mod that involves other players?
Like the mod isn't uploaded to workshop, how would I test it with a friend?
I've been stuck trying to find why my attachments rotations aren't applied the same for the worldmodel of the weapon and when it is actually equipped or stowed on the back.
its OnPlayerGetDamage or something now, and passes a parameter to tell you what caused it
I already tryed OnPlayerGetDamage and it only passes 3 parameters, first is the player that gets damage, second is damage type and third damage amount. Nothing like attacker
did the old event tell you who the attacker was?
damage type is what I was referring, because it includes other damage besides zombies
It actually didn't tell me anything about zombie attacks, only bleeding when i got attacked by a zombie
its a shame really, because from the java code it would be very easy to pass a parameter with some sort of identifier, but they don't ever do that. So you're left with scanning the area and making an educated guess, or just not doing anything with the source of damage at all
Also kinda shocked how much of a steep learning curve modding in this game has, like you get so little information ๐
you don't even know if a function / event is client or serverside, one event even told me it's not client and server lol
yeah, you have to use
self:setTime(newTime)
self.action:setTime(newTime)
it's kind of silly i think... what's the point of the lua function if it doesn't change the java time?
so maybe it is a bug, but TIS usually don't want to fix minor things that don't affect vanilla
the lack of documentation is a bit of a problem, but I find it easier than java modding once you have the info
I'm kinda used to gmod documentation or in general some kind of good documentation that tells you what everything does, example and what realm it can run at client / shared / server
I replied to you btw . U must have missed it
You mean this one right?
Ye
yes, I keep lua max as is and change action max and current so that delta stays the same
I tryed using it with OnWeaponHitCharacter in a client lua and it told me both client and server false or do I have to use the code in a shared lua for that?
if you're testing in singleplayer, isClient() and isServer() will always return false
I used to just cancel the action and start a new instead before.
Ahh I see.. so I really have to host from the menu to test it?
if you want to see how it works in MP, ya
yeah u_u
Damn alright..
i've been using this
function ISReadABook:changeMaxTime(newTime)
local mult = newTime / self.maxTime
self:setTime(newTime)
self.action:setTime(newTime)
self:setCurrentTime(self.action:getCurrentTime() * mult)
end
How would I test a mod that involves a other player when it's not in the workshop?
i feel your pain bro
Yep cuz singleplayer doesnt have a server
And without a server the player isnt a client
i usually run a dedicated server locally and two clients
^
It's driving me nuts ahahah
You can have that player download the mod
Directly from you
i try to correct the attachments orientations the other day and after 1 day of contants trial and error i give up.
So he gets the option to download it when he connects to my local hosted server?
I think I'm falling in the same routine lol
you'll have to send him the files manually
bruh
also, i thought i'd clarify what the client/shared/server folders actually mean, because it can be confusing - the client runs all three, and the server runs only server and shared - so the server and shared folders are more for organisation than a specific purpose, they aren't really separate 'realms'
Yes
auto download is workshop only afaik
yeah i think so too
you can throw it on the workshop as unlisted
Oh yeah sorry it will if its on the steam
It wont if its not. So you have to manually send em the file
Which is a pain. . so just upload it
Can't I just host with one client and join with another? so I only have the mod once and don't have to sync it? ._.
for some reason whenever i try to make a world with mods in mp it keeps copying the file and removing all the mods when i got to load it, it makes a compleatly seperate instance (fixed)
you'll need to play in non-steam mode to do that, but yes
the launch option -nosteam will do that
ah thx, was just about to ask that. Do both clients have to be nosteam?
don't they have to be anyways just to launch multiple instance?
yeah, non-steam clients can't join steam servers
you can sort of get around this actually, but the same steam account can't be connected to two servers (or the same server twice) anyway
@smoky meadow based?
How would I add Night Vison to a face mask?
Is it like adding bite defense, and Insulation in script file of the mod?
Can I somehow make the second account admin so both can join with debug mode?
or do I really have to host a seperate server for that?...
Damn I just got the nausea moodle in real with that solution
are there like... must-have mods that are widely accepted in all multiplayer?
/setaccesslevel username admin
How are building stories handled?
Like, how does the game pick if a house is burned down or something?
Does this work in-game or just some server console?
in the in-game chat, as long as the player typing it has admin of course
or, wait, actually
if you're hosting in game, i don't know if access levels save...? i remember having an issue like that, i think that's why i started using dedicated servers to test
the server loads mods from the same user directory as the client does
Ahh okay but can you reload the lua while it runs or do you have to restart?
you can reload files on the server manually using a command (something like reloadlua directory/file.lua) and if you disable the checksum you can just rejoin when you change the client files
Can I just reload it while my clients are connected to test the mod after changes?
it'll only reload the copy on the server, so unless it's server-only code that won't work
you can reload the client code as well from the client terminal, I believe
not sure if you need the debug terminal or just the chatbox with admin rights
What exactly do you mean with the checksum? So once you update the mod just rejoin or still have to reload them?
wow you did it what's the offset can you send it to me?
If you are using my mod I'll be fixing it in a bit with an update.
i was wondering if i will post my gun mod in the public. i have a fully automatic fire mechanics a working suppressor, but this offset thing is im struggling on.
But if its for your own mod, when exporting your silencer/weapon part make sure these are unchecked so that both your ground attachement and in hand attachment follow the same axis
In blender*
aw i used 2.79b
I'm using 2.92, but can't you upgrade/ download a portable blender instance if you want to absolutely keep a 2.79b instance
i have 2.92 in my desktop but that shit is so complicated i used by the 2.79b version of blender, it takes time for me to adapt into newer versions
ahahah I feel ya, my blender skills are questionable at best
after months of making guns nonstop i try to make custom shooting animations but i didn't find any 2.79b tutorial of it, but a newer versions have. so i give it a try, when i try the newer version it felt alien to me. the new mechanics are confusing.
I'm guessing a lot of ui changes happened between those 2 version? I'm sure the keyboard shortcuts are the same tho, if you are familiar with those you shouldn't feel too far from home
i didn't found that setting in my current version,but i think this is the equivalent of saving the location, scale and rotation on a model.
When the chunk is loaded first time
Interesting, is it possible to force a certain story to happen?
Interesting, cause I was looking for a way to burn down all the buildings
And I know there is a building story for it
here
3? I only noticed one O.o
Oh wait, RBBurnt, RBBurntCorpse, RBBurntFireman
for i=1,getWorld():getRandomizedBuildingList():size() do
local story = getWorld():getRandomizedBuildingList():get(i-1)
if instanceof(story,"RBBurnt") or instanceof(story,"RBBurntCorpse") or instanceof(story,"RBBurntFireman") then
print("test fires 2: story chance",Fires.SandboxRandomChance[SandboxVars.WorldOnFire.RBBurnt])
story:setChance(Fires.SandboxRandomChance[SandboxVars.WorldOnFire.RBBurnt])
end
end
Wait, is this in lua? o.O
it's in my mod
This looks good enough, thank you!
Did you apply the transforms? meaning scales are all at 1.0, rotation and position is at 0 for each axis?
yeah all, it become set to 0 after i apply, location, rotation and set to 1 in scale.
hmmm, and what if you import it in 2.92 and just export the same model with the options I sent you?
i see so the model is set in the X axis.
I was planning to test this, but didn't need it. Get the story and do story:setAlwaysDo(true)
I will give it a shot ๐ ๐
Does it work from server side? lua player:getInventory():AddItem(item);
hey kinda new to programing does anybody know how to make a script that shutsdown the server when theres no players
there's a few mods that shut down the server when mods need updates, have a look at how they do it
for the record, https://replit.com/languages/lua uses 5.1, at least right now. If you want to mess around with setfenv or whatever else may be obsolete in 5.3 like https://rextester.com/l/lua_online_compiler uses
I just wish one of these interpreters would give you the opportunity to mess with require
thank you
do you happen to know the name of one of these mods
udderly up to date does it
yes, I did.
why not just install lua?
why would I when clean simple interpreters exist that I don't have to compile or store? haha
lol. well you dont need to compile, getting precompiled binaries is simple enough. but sure you'd have to store it, but at least then you wouldnt have to hunt around looking for online versions wishing for features that are missing XD
not like a lua installation is large
I wouldn't know, I haven't tried to look for prebuilt binaries, with a nice gui like Haskell has so I don't have to set up another dev environment, etc etc
being mainly a debian linux user, i'm lazy and get to apt-get install them. my dev machine keeps 5.1, 5.2 and 5.3 installed
The LuaBinaries files are intended for advanced users and programmers who want to incorporate Lua in their applications or distributions and would like to keep compatibility with LuaBinaries
ya, lots of dev stuff is easier in linux
that being said, there is a link on this page to https://github.com/rjpcomputing/luaforwindows, which is old enough to have never updated past the last build of 5.1 ๐
lol
oddly enough, this is my most used lua enviornment https://github.com/scoder/lupa
I've had a vendetta against python ever since a university course I took expected you to know it even though there was no other course that taught it or required it, lol
"you don't know python? Well I suppose I could let you write your course work in jython"
lol. ya i ended up learning it because it was a requirement for a course
should learn it someday, it does seem to get used everywhere
yep its worthwhile to know
Did anyone found where TIS is doing the check for the count of rooms in a building for the random stories?
I'm referring to this from the "Update 41.78 Patch Notes"
Disabled some Randomized Survivor Safehouses from occurring in instances where a building has over 10 rooms, or is a spawn location.
The limit is 10 for some and 20 for other Randomized Survivor Safehouses.
This also means the Toilet Paper story is now disabled in buildings that have over 10 rooms or are spawn locations, which will likely reduce the amount of Reddit posts about it by 50%.
If found the line for the room check inside java\randomizedWorld\randomizedBuilding\RBOther.java
But I'm still struggling to figure out how to re-enable it or manipulate it, I would like to re enable this "feature/bug" and make it so you can decide to spawn in a specific story
Once you figure it out, please make a mod where every house is a toiletpaper house
I'm trying to make that everything is burned down, but I will also do that ๐
lol
So, for my understanding
The code that handles the random stories is inside java\randomizedWorld\randomizedBuilding\RandomizedBuildingBase.java and inside java\randomizedWorld\randomizedBuilding\ are all the building stories.
Inside java\randomizedWorld\* are also the random survivor and vehicle zones
got my modlist working heck yeah
is there a way to, say, get a table of all player skills and their levels?
alternatively, just all player skills, like carpentry etc.
You could take a look at my alzheimer mod, I did something like that
kk
local perks = {}
for i=0, Perks.getMaxIndex() - 1 do
local perk = PerkFactory.getPerk(Perks.fromIndex(i));
local parent = perk:getParent()
local isNotPassiveOrAgility = parent ~= Perks.None and parent ~= Perks.Passiv and parent ~= Perks.Agility
local currentXp = player:getXp():getXP(perk)
local info = player:getPerkInfo(perk)
local level = info and info:getLevel() or 0
table.insert(perks, perk:getName())
end
mk
If there is any server owners looking for a modder / admin with experience, DM me im open to do commissions and have alot of free time.
I know how to set up servers - mods - make mods or pack mods into mod packs if allowed.
Basic knowledge of blender
Great knowledge with graphic design.
@gilded hawk what's the "parent ~= Perks.None" about?
I think it's because there are depecrated perks (eg: smithing) and they have parent none, and I was using that boolean to ignore it
I can't remember exactly tho
Should be, yeah
yea it worked
tysm i think i cut down my code by like 50 lines lmaoo
and also made it compatible with mods that add new skills
Glad to hear this 
like for each skill i had to manually ctrl c ctrl v and ugh it was a pain
and even worse it didnt even include modded skills lul
Oh, damn
WOOOOOOOO
I did it!@
local EBD = {
RBBurntDef = nil
}
function EBD:getBurnedDownStory()
if self.RBBurntDef ~= nil then
-- print('cached RBBurntDef')
return self.RBBurntDef
end
for i = 0, getWorld():getRandomizedBuildingList():size()-1 do
local rb = getWorld():getRandomizedBuildingList():get(i);
if rb and rb:getName() == "Burnt" then
self.RBBurntDef = rb
-- print('rb:getName(): ', rb:getName())
end
end
end
function EBD:burnItAllDown(square)
if not square then
return
end
local x = square:getX()
local y = square:getY()
if isClient() then
return
end
local building = square:getBuilding()
if not building then
return
end
-- randomizeBuilding(BuildingDef var1) inside RBBurnt, will set building to all explored
if building:isAllExplored() then
return
end
print('burn down building in square: '..x..', y:'..y)
self.RBBurntDef:randomizeBuilding(building:getDef());
end
function EBD:LoadGridsquare(square)
self:getBurnedDownStory()
self:burnItAllDown(square)
end
Events.LoadGridsquare.Add(function (square)
EBD:LoadGridsquare(square)
end);
There is only one issue tho ๐ค
if a building in split in between 4 squares, and the game only loads 1 square, only the part of the building in that single square will be burned, and the other 3 will not, because randomizeBuilding will set that building building:isAllExplored to true :(, does anyone of you have a suggestion? ๐ฆ
Anyone have any good guesses re. the precise name of something someone would call the "Equipment Tab" mod?
I see this:
https://steamcommunity.com/sharedfiles/filedetails/?id=2733680483
Maybe?
whats the mod i see on yt where people have a canteen equiped to their belt
One of these
It works!
I updated the code too, found a nice way to check if a building is fully rendered
local EBD = {
RBBurntDef = nil
}
function EBD:getBurnedDownStory()
if self.RBBurntDef ~= nil then
-- print('cached RBBurntDef')
return self.RBBurntDef
end
for i = 0, getWorld():getRandomizedBuildingList():size() - 1 do
local rb = getWorld():getRandomizedBuildingList():get(i);
if rb and rb:getName() == "Burnt" then
self.RBBurntDef = rb
-- print('rb:getName(): ', rb:getName())
end
end
end
function EBD:burnItAllDown(square)
if not square then
return
end
local x = square:getX()
local y = square:getY()
if isClient() then
return
end
local building = square:getBuilding()
if not building then
return
end
-- randomizeBuilding(BuildingDef var1) inside RBBurnt, will set building to all explored
if building:isAllExplored() then
return
end
local buildingDef = building:getDef()
if not buildingDef:isFullyStreamedIn() then
return
end
print('burn down building in square [x: ' .. x .. ', y:' .. y .. ']')
self.RBBurntDef:randomizeBuilding(buildingDef);
end
function EBD:LoadGridsquare(square)
self:getBurnedDownStory()
self:burnItAllDown(square)
end
Events.LoadGridsquare.Add(function(square)
EBD:LoadGridsquare(square)
end);
@astral dune replacing if rb and rb:getName() == "Burnt" then with if rb and rb:getName() == "RBOther" then will make every house a toilet paper house
rip meta locations
i need to know which one tho
beautiful
๐งป
are there any events related to voice chat? or is it possible for a mod to interact with the voice chat system at all?
So I've been working on a patch to Small Town First Responders. Basically, the idea is to add a bunch of clothing and bag options from SWAT Pack, Paw Low Loot and ADVANCED Gear to the STFR zed spawns. I've also incorporated the SWAT Pack SWAT zeds into the STR tables, and tweaked their gear to share a bit of the same aesthetic. So SWAT zeds from different towns will have different helmets.
The Riot Zeds have a bit more gear variety, and the bags and rigging bits look real nice on them:
I also touched up the EMS spawns. They'll have chest rigs and carrier vests from Adv Gear, as well as bags and pouches from SWAT Pack and PLLoot.
I made some custom textures for the Medic vest and Paramedic version of the SWAT pouch so they match the PLLoot Medic bag aesthetic. I'm particularly proud of them. ๐
IDK when I'll release this, maybe this weekend? Still got to sus out some issues and do some bugfixing to make sure everything works right.
could i get some help downloading the multiplayer true music mod? My computer is being dumb and not allowing the file to download on my browser so i need someone to dm me it
hoping this makes sense
its kinda just downloading a shortcut to the download
im wondering if mod people who do this more often could help
I intend to drastically improve this, but I feel like some of you will appreciate it now, so I'm gonna drop it here. See your capacities at higher font sizes and screen resolutions (gives options for moving stuff in inventory & loot headers so they no longer overlap capacities at any screen size afaik). https://steamcommunity.com/sharedfiles/filedetails/?id=2893439110
Hey mx youre back.. i wanted to ask you something
You and olipro once talked about doparam right .
Im going to pm u instead hehe
Checks of the files are the same to prevent cheating . Desync, un imaginable errors, etc
nice burn down code
obviously LoadGridSquare is a not good event, but there are no better alternatives.
I guess you only sleep in cars now
oh, burn down cars too
so i got this from burryaga.. (thnx dude ๐ )
but i dont know how to convert it into something the context menu only works on other player or items
Example.addMenuOptions = function(playerIndex, menu, objects, test)
if test then return true end
local player = getSpecificPlayer(playerIndex)
if not player then return end
menu:addOption("Option Name 1", player, Example.functionName);
menu:addOption("Option Name 2", player, Example.functionName);
menu:addOption("Option Name 3", player, Example.functionName);
end
Events.OnFillWorldObjectContextMenu.Add(Example.addMenuOptions)
do i remove the player index if i want to target items
and if i want to target players do i change the player index into playernum?
playerIndex is the game giving you the playerNum
if you want to add option for specific item, go through worldobjects (called objects above) and check if they match the item you want.
hey guys
is there a mod that makes the ui larger?
playing in 2k and above makes is rather small, and i noticed that the character overall menu and other stuff like that are much larger on mod page screenshots
is it because of a lower resolution or a mod?
if you scoll just a little
you would see burryagas mod about making UI bigger
That only works with the inventory loot window?
Or every UI? Because the overall page where the lifelong stats, medical tab etc are
isn't mentioned in the description
idk
What exactly is zombie.characters.IsoPlayer?
I searched the type up but I can't access fields like accessLevel or username
i think isoplayer is the player character
I'm trying to increase the muzzle flash size (I find the default one too tiny), anyone knows how this could be done? Increasing the muzzleflash texture resolution doesn't do the trick.
Also tryed accessing the Health field from IsoGameCharacter still nil
you mean hp?
you want hp?
getBodyDamage():getOverallBodyHealth() is the thing ur looking for
Just trying to access anything really... figuring this mess out
I want to get the safety status from both players from the OnWeaponHitCharacter event
by safety status I mean the built in pvp switch
I want to make a mod where you can change the pvp / pve status only in the safehouse and BOTH need pvp enabled to damage each other, current safety system makes no sense to me.
I have zero clue what kind of variable that is, I can't access anything from both IsoPlayer and IsoGameCharacter
Anyone have a list of useful vanilla coords? Awesome houses? Police stations? Etc?
A) Try something like attacker:isAsleep() and :getForname(). I don't know if the field variables are directly accessible from your context (i.e. public).
B) If those don't work, attacker is probably an index. Try local player = getSpecificPlayer(attacker), then try player:isAsleep(). Keep in mind, you need a : not . for all of these method calls on the Java functions.
C) If neither A nor B gets you anywhere, the doc is probably wrong, but as far as I know you declared the function correctly.
@unique harbor Forname at least is protected:
protected java.lang.String Forname
https://www.geeksforgeeks.org/protected-keyword-in-java-with-examples/
See different package non-subclass -- that's probably your condition.
Just found a post where someone used :getFullName and it works, so I guess it's really that you can't access the Fields... thx!
Ayyy
old cheat menu had a bunch of those to teleport to
reborn version may have still have them, not sure
you can access fields that are public via a simplistic reflection API the game exposes
but use getters when they exist
I'm actually using that website people pass around, it's pretty useful for what I'm doing
Anyone know of any mod or vanilla uses for the keyboard "X" key while the world map is open?
How do you use that reflection Api?
getNumClassFields, getClassField, getClassFieldVal
you have to loop thru the fields using the first two and then call the third one using the info from that
easy to write a little wrapper for it
not sure why they didn't just offer one lol
Yeah wouldn't question that after the detailed documentation and everything so far ๐
a few fields just plain don't work btw
it only works on public fields, but even some public fields just throw exceptions
one in particular i've found is "dir" on vehiclezones
so if u hit that, probably isn't you
Thx will give it a try!
Part of getClassField sets it to be accessible, should work on private fields too
But if the class of the thing isn't exposed to the Lua you won't be able to manipulate it
Question in Noir's shop and the subsequent Shopsx is there a way to get multiple items (Such as stray nails) to show up in a group rather than populating as a single item. Specifically asking for the sell tab. Looking to tweak this for a future server and im just not sure listing every single nail is the best ui experience
If I use setName on an inventory Item, will it stop being translated?
I want to change name of recipe result and that's how evolved recipes do it too.
hm, maybe I'll use doparam displayName everytime before give item
hoo boyo. Glad STFR's still relevent. LUL Great job!!!
One of the biggest pains with my self-hosted server are mod updates.
Workshop items will be updated and if I dont catch it in time and restart the server, users will not be able to connect anymore. Their clients will be updated and my server will be stale.
I wanted a way to automatically restart the server if a mod updates.
I am open to hear everyone suggestions on how to resolve this problem. but I did go ahead and put together a little hodge-podge solution using bash, steamcmd and rcon
I would love to receive any feedback, good bad and ugly on this one
there's a couple mods to do this
udderly up to date will shut down your server a little after a mod updates, under the assumption that your server will restart itself
Was gonna say you can use udderly with rcon and a daemon service, but if you can packacge it simpler that would be good too
Does anyone know when distributions are applied?
im trying to figure out how to capture the gas from the gasstation and be able to refil and depleat it.. its not a moddata .. not sure if its properties yet.. but if anyone knows anything pls help... im super stuck
local player = getPlayer()
local cell = player:getCell()
local x, y, z = player:getX(), player:getY(), player:getZ()
local xx, yy, zz
local rad = 3
for xx = -rad, rad do
for yy = -rad, rad do
local square = cell:getGridSquare(x + xx, y + yy, z)
for i=0, square:getObjects():size()-1 do
local obj = square:getObjects():get(i)
if obj:getPipedFuelAmount() then
obj:getPipedFuelAmount()
print(obj:getPipedFuelAmount())
end
end
end
thnx
obj:getPipedFuelAmount()
if (this.hasModData() && !this.getModData().isEmpty()) {
Object var3 = this.getModData().rawget("fuelAmount");
if (var3 != null) {
var1 = (Double)var3;
}
}
if (this.sprite.getProperties().Is("fuelAmount")) {
that's what it checks
obj:setPipedFuelAmount(int) might work
๐โค๏ธ
Omg thank you finaly
I really should make it a habit to check the java . But k always forget.
Ill try this tomorrow.
Thank you poltergeist!
I think I've run into a problem.
Is there a way to properly modify distributions via a sandbox setting before they're applied?
In other words, making it so I can remove / replace items in accordance to a sandbox option before they spawn?
sandbox settings load after distributions are applied, but you can just reapply them before the world actually loads any items
What do you reckon I should connect to for that?
i use OnInitGlobalModData
you just need to call ItemPickerJava.Parse() after you've messed with the distributions
Hey guys, a couple friends and I were trying to implement a pvp gamemode where there are extraction points people can use to teleport into vaults, from which they can trade their items ranging anywhere from guns, stolen jewellery, other players' dog tags to food and cigarettes etc.; much like an isometric escape from tarkov.
I was able to install/code the mods for teleportation from extraction points and shopping (both of which were previously moderated by admins), however my friends who were fairly new to the game constantly complained about the gunplay.
Imo the combat in the game is mostly fine for pve stuff, though now that they have easier access to guns it didn't feel that engaging when it comes to pvp. We have theorised a system where players instead of clicking on targets they want to shoot at, would have a visible arc which would get narrower and narrower based on: how high their aiming skill is, for how long they have been standing still, what gun they use etc. From that, any targets that are in this arc and are visible to them would have a probability of getting shot when the attacking player fires the gun based on: distance, if there are any other targets between them such as zombies or other players etc.
All this would basically provide a more conventional aiming system. But, I'm completely stuck and have no idea on which class functions to use to implement such a system and also whether it would conflict with the existing pvp mechanics.
Do you guys think that this would be feasible and/or enjoyable? Help/ideas from devs or experienced modders would be much appreciated.
I am having issues getting a clothing mod to appear in my mods list, no clue what it could be since I followed the clothes mod tutorial to the letter than corrected myself based upon the example mod included with that tutorial.
It was MOD.info that was not set up right
How to add an item to player inventory from server side code?
I use client/server commands
I see, it works. I just hoped there was another way.
afaik player inventories only exist on the owner's client
Y'all reckon anyone would want a compatibility mod between Le Gourmet Revolution, Soul Filcher's Awesome / Farming Time, and Mo' Crops?
They each add at least one crop the others don't have, so personally I think it'd be interesting to have a compat mod between them all.
And why are they incompatible to each other?
They override each other's crops on a number of occasions.
You can't plant the crop unless you have the right mod's seeds, which sometimes just doesn't happen??
Sure a conversion recipe works, but there's a better way to go about it.
I'm doing it in conjunction with a conversion recipe.
I'm not sure what kind of crops are overridden. But I guess the future patch will change it. It may help to improve compatibility or make it worse. Vanilla plants:
They override stuff like corn, eggplants, lettuce, etc between one another which causes some weird effects.
Question, When I get a error like this on a clothing modding, what would be the best solution for it?
Question - would i have to make a new world object .txt and a new wepon text if i wanted it to say have a folding chair useable as a melee weapon and a peice of furniture? or just one text with properties for both? as in foldingChair_melee and foldingChair_Sitee?
obj:getProperties():Is("fuelAmount")
this worked but it only printed true or false
doesnt allow me to edit the value still
local function checkFuel()
local player = getPlayer()
local cell = player:getCell()
local x, y, z = player:getX(), player:getY(), player:getZ()
local xx, yy, zz
local rad = 1
for xx = -rad, rad do
for yy = -rad, rad do
local square = cell:getGridSquare(x + xx, y + yy, z)
for i=0, square:getObjects():size()-1 do
local obj = square:getObjects():get(i)
if obj:getPipedFuelAmount() and obj:getPipedFuelAmount() > 0 then
local fuelamt = obj:getPipedFuelAmount()
print(obj:getProperties():Is("fuelAmount"))
print(fuelamt)
CheckFuelOff()
end
end
end
end
end
function CheckFuelOn()
getPlayer():setHaloNote("CheckFuelOn")
Events.OnTick.Add(checkStuff);
return true
end
function CheckFuelOff()
getPlayer():setHaloNote("CheckFuelOff")
Events.OnTick.Remove(checkFuel);
end
heres what i have so far
try setting the data with that name
sorry, what is not working
did you try the setPipedFuelAmount ?
ill try again
i did that at first
didnt work
but imight have done it incorrectly
there is a weird case in that function if you try to set to 0, it sets it to -1, no idea if that matters for you.
it just reverts but i think i know why
its porobably on how i tryied to reduce it
it hink its working now
how do i get the max?
obj:getPipedFuelAmount():getMax() ?
lol dindt work
I'm not sure there was a sandbox check and some other thing.
starting value is random
so everything has getPipedFuelAmount() by default? cuz i get all the zeros
if idont do this
obj:getPipedFuelAmount() > 0
os if incase i accidentaly make it zero i wont be able to refil anymore?
lol
did you try if Is("fuelAmount) then print .Val("fuelAmount")
Ah ok so thats what determines if it its the fuelpump object
But everything else
Has getpipefuel to zero instead of nil
Ok got it
Its kinda weird
So when you want to control the WeaponHitCharacter Hook so the damage doesn't happen based on target / attacker would I put it in client / shared or server? ._.
Are crossbows and bolts easy to mod in?
I was thinking of copying the structure of a bolt action but limit the mag size to only be the chamber
But I imagine having the bolt be in the zombie would be a bit rough
I don't know about crossbows but Ninja Science has a simple system to add shurikens to corpses, however if you miss they just vanish.
Yeah you probably have to do math for that mod
Like if you miss.it will calculate where you are aiming and spawn an item on the ground
Anyone knows how far the
getUseableVehicle()
``` checks?
Is there a way to use a custom book model while reading? using a custom book model always seems to result in an invisible book model.
@fast galleon Pushed a copy shortcut into Position Breakdown
U need the static model
Yeah it was using a model without any vertex group
I don't need to create the XML file for it do I?
Xml are for animations and clothing afaik
It's like for book items, reskins work but custom models seem to not work
pretty weird (at least that's what happens on my end)
It might have worked but its scale is too big or is under the ground or something
Try using the attachment editor its not my forte but thats what i know atleast
I don't know if someone will read my request but may I humbly ask for a death korps of krieg armor and a templer knight armor? I think since we already have all the other utilities and weapons it would make a great addition
local function hookChecker(attacker, target, weapon, damage)
local atkSafety = attacker:getSafety()
local tarSafety = target:getSafety()
print(atkSafety:isEnabled())
print(tarSafety:isEnabled())
if (atkSafety:isEnabled() or tarSafety:isEnabled()) then
print("AVOIDED")
return false
end
print("DEALT")
return true
end
Hook.WeaponHitCharacter.Add(hookChecker)
Why exactly doesn't it work?
It seems to deal no damage both returning false and true
What is the purpose of this function? All it seems to do is return a boolean (to nowhere), true iff both attacker and target of a recent hit have disabled "safety".
Does OnCreatePlayer fire when players are initially created during Character Creation, or does that fire when a player object is initially created after joining a server?
Contact the author of the mod that made the other stuff
Post on the comment section of his mod
The function is added to a hook. I want to stop the player from taking damage when one has PVP disabled.
So you have a 'real' PVE / PVP system
Havent seen any pz mod code with the
Hook.
Instead of Events.
So you mean using the event and avoidDamage()
You have to look at the lost of pz lua Events
https://pzwiki.net/wiki/Modding:Lua_Event
Not sure if thos is the updated one
What does your Hook look like? I've never seen anyone write Hook.EventName.Add so I have no clue what it's going to do there
I dont hink it exists
But we could be wrong
If it does this would be revolutionary
I based my code on this message:
#mod_development message
All I've ever seen is Events.EventName.Add . . .
Very new to this modding and hate it so far lol, trying to get into it
Fascinating
I guess the only other way would be to use the WeaponHitCharacter and then avoidDamage() ?
Well, that person is a genius, so they're probably right.
ASSUMING you CAN do what you're trying to do, I would guess it's Hooks.HookName.Add not Hook.HookName.Add
Following the Events.EventName pattern.
Try adding an s
I mean Hook does seem to work, but it negates every damage for me rn even to zombies
doesn't matter if I return true or false
So you have tried this to be sure?
local function hookChecker(attacker, target, weapon, damage)
return false
end
Hook.WeaponHitCharacter.Add(hookChecker)
Whats that going to do?
Also, just FYI, based on Fenris message, the Hook event seems like it should be called HookWeaponHitCharacter, not WeaponHitCharacter, so I'm very confused about the path from his message to your code
When game fires OnWeaponHitCharacter we catch OnWeaponHitCharacter... so if game fires HookWeaponHitCharacter I would expect to catch HookWeaponHitCharacter, not WeaponHitCharacter
So I would expect Hooks.HookWeaponHitCharacter.Add
Hmmm
I mean I could try your code but mine already does both return false and return true.
It prints either AVOIDED or DEALT.
I never knew this till today thank you. Imight explore more of this
WeaponHitCharacter is a vanilla event right?
@unique harbor Okay Hook.WeaponHitCharacter is correct
I just checked the table in game
Hoe did you check the table
You can do stuff like for k, v in pairs(Hook) do print(k , v) end and stuff
Fenris comes to the rescue
Anyways so youre code is like part of the original function right and it justs adds to it not overwrite it right?
I corrected my assessment a bit further down
#mod_development message
its been quite a few years since i actually used this feature
So you can't actually use the hook to disable the damage since you can't return when to allow it?
If I get your message right
ya you may have to use the event and avoidDamage()
Ahh okay, thx for letting me know!
the hooks are used to cancel, but other then that no real difference
does anybody have experience with making items multipurpose, I can make bucket be container but then equipping it in hand has no sprite, weapon bucket works fine in primary hand but has no container.
When I reloadlua on the server, why does it not take the changes?
and bucket with water probably reset container items
