#mod_development
1 messages · Page 1 of 1 (latest)
I mean, I watch this channel solely to provide help where I can and to simultaneously learn what I can from others. I can't speak for others, but I'm not about to go out of my way to track down your mod just to be able to see it just to figure out whether or not I can help, and when I don't even know what your mod is and therefore have any interest in it.
If the car is vanishing even in SP it's probably triggering a failsafe if not causing it to rubberband away
Have you tried lowering that amount?
i'll be back soon, when i'm back, will unhide the mod and link it, alright? (Sorry for late reply, i dove into a rabbit hole of the concept of converting trucks and busses into homes, and i'm honestly inspired. Would love to have such a home 😄 )
Having a little issue here with item positions when they're dropped
My sword seems to not want to rotate on itself but rotates around a center, kind of like the moon around the earth
Anybody ever had this happen to them?
I'd like to forcefully move the mesh in blender so it goes to the correct location but then it won't sit right in the hands of the character
try changing the origin of the mesh maybe?
Moving the origin seems to mess up the grip fo the weapon, and it also still helicopters around when I rotate in place mode
but thanks for the suggestion
I've solved my problem, there's actually an ingame editor for managing item placements
now the sword still rotates SLIGHTLY strange but much much better
i tried understanding this
ending up with this ```lua
function squished2(items, result, player)
player:getBodyDamage():setStress(player:getBodyDamage():getStress() + 40);
player:getBodyDamage():setPanic(player:getBodyDamage():getPanic() + 40);
end
somehow it doesn't work
can't find your message anymore, but I think there might also be an issue with having 2 oncreates defined. I dont think you can do that. you could just call one of them from inside the other function
Taking a whack at making everything a weapon but not directly using scripts wish me luck
somehow it works with 2 of those in case of boredom reduction
something seems wrong with .lua file i made
with fuction squished 2
setstress doesn't belong to there. set stress belongs to a stats object, while getbodydamage() gives you bodydamage object. you would need to find the correct function to give you the stats object
oh okay, thanks
Hello, I'm looking to see if anyone has a mod list recommended for MP bushcraft survival - farming, fishing, living off land.
@jagged ingot ya I still had issues getting the audio replacement to work so I just scrapped the whole thing lol
way out of my league on that one
The game engine is not designed for infinite weight items, and I'd recommend not using them.
finallly
so i managed to fix it
i am getting current stress stat from game
as setting it as number
function squished2(items, result, player)
local stats = player:getStats();
local currentStress = stats:getStress();
stats:setStress(currentStress + .15);
end```
Back
I'm going to try and make a few 100% reduction backpacks 😛
(If possible)
one question, maybye try to make it 99.99999999% reduction with 99999999999 cap?
Probably better off reading through the java to see if there's any hard limits
although I too like to break stuff
The game no longer registers "normal" items in debug
Or just define it as nil
Iirc Nil functions the same as absolute 0 and in a lot of use cases makes it not apply
An issue is that an infinitely usable backpack will break the UI or saving
Since it'll be insanely large hashes
setting it to nil|null will most likely trigger failsafes
or break any math related to it
At this rate we might need to hardcode the game so infinite weight items/over capacity containers aren't possible and don't break saves etc. 😄
not to mention when the Java looks for an int/float type it will get null instead
He tried that and it breaks vehicles
Not sure why you don't just look at what god mode does and disable the burden of carrying shit
instead of hitting the items leverage points - just tap into onplayerupdate
Maybe instead of limit (hardcode wise) the weight of items, instead just say that <any> container/inventory can only store 5000 different stacks of items max (the amount of same item would only count if multiple stacks are made) (Maybe 5000 stacks is to much, just an example) That would stop save corruption with inf-weight items, no?
So each stack, be it 50, 1 or 47, that would count 3 towards the 5k hard limit...
why?
If to many items breaks saves, this method would counter that
a soft-fix if you will
sure the game have lots of items, but i doubt people will hit 5000 different stacks in one container anyways, at least not in normal play
But the only way to get that many items would be to allow for negative weight items to work
which would take time to debug edge cases that shouldn't even occur
100% weight reduction might work tho
even if it's 99.99%, it would still be one heck of a great backpack XD
Overweight containers break saves when programming them, or when you store items in game and overload a container?
If the latter, that's a bit alarming as it's very easy to go over a container's limit
Yes, that's why I recommend people don't use over capacity containers.
They also seem to mess up vehicle physics.
anyone have a good modlist they could share with me i cant really compile a good list of mods without getting errors
again, a limit to stacks would mitigate this a great deal. Weight in static (non-moving) containers should not really be a problem. if it is. something is messed up with the code overall...
the game doesn't really have stacks
that's all visual
the limit is done with weight
didn't know... good to know
I've only ever heard of overweight containers losing items from vehicles - and that was a while ago
usually because the trunk item took damage and lowered it's capacity but the items inside stayed
I can understand you'd want a limit to players/vehicles/backpacks inventories, as they are physically dynamic, but for a box or closet, a limit to how many items it can store, rather then by weight would cut most issues down (i assume)
kind of arbitrary tbh
the issues of lost items also occurred before they polished up the save system
eh... i would say i'm among the very few players that not only hoards, but use mods that makes my game appear more like a semi-creative mode. So storage becomes important 😛
idk if @willow estuary's experiences are recent or not
from a save integrity perspective, hard limiting based on type count or a weight limit is arbitrary - the limit is whatever doesn't break the game
and again - not likely to break
Here is my mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2313935048
I'm trying to make the "funny pills" into medicine items instead of an actual food item, so the player can technically eat as many they want, when ever they want, but doing this just turns them into an object then outright a medicine item.
Save files can corrupt easily if the storage data is gigantic
I imagine the inventories are saved using a hash
Or atleast, I'd hope so because storing individual data points in a table seems extremely heavy on save file size
they parse specific data that is mutable afaik
the issue of negative weighted items only becomes a problem for vehicles because it ties weight to physics
Inb4 we find out they use Sass and its the 90s again
Gonna update my -100000 inventory item to only -100 (if people need more "space" they can just make more. This should NOT cause vehicles to go flying into the universe each time such an item is placed inside... 😛
idk specifics, but the last time they changed save formats dropped file size by alot
You should try the bags with weight reduction instead
Then you can place them inside the cars eitherway
Correction not Sass
I will, but gonna give the -100 a try first, just to see how the vehicles behave...
Chuck, you good with modding?
I ask, cause i REALLY wish to make my pills work correctly x.x
right now, they are a food item. and with food items, you can't eat all you want. Eventually, your char's belly is stuffed.
but Medicine in the game works differently, you can eat all you like.
Wouldn't a solution to the backpack issue be applying a trait when its worn
Its kinda ass backwards
But it would work, no?
my limit to modding this game is EXTEMLY limited
Most of my mod is learned from looking at other mods and base game's code. However. Medicine confuses the ever loving f*** outta me
The weight issue most likely will be solved once i replace my -100 weight item with a spiffo backpack with 100% weight reduction 😉
Once i got the medicine done, i can consider my mod done.
Pretty sure medicine is it's own type of thing
medicine in large is very rigid / limited scope
probably overdue for an overhaul
maybe, yeah...
afk-ish, gonna go experiment with the -100 weight feature
used to be -100000 which clearly is to much of a reduction, lol
public void JustTookPill(InventoryItem var1) {
if ("PillsBeta".equals(var1.getType())) {
if (this.getParentChar() != null && this.getParentChar().getStats().Drunkenness > 10.0F) {
this.getParentChar().BetaBlockers(0.15F);
} else {
this.getParentChar().BetaBlockers(0.3F);
}
var1.Use();
} else if ("PillsAntiDep".equals(var1.getType())) {
if (this.getParentChar() != null && this.getParentChar().getStats().Drunkenness > 10.0F) {
this.getParentChar().BetaAntiDepress(0.15F);
} else {
this.getParentChar().BetaAntiDepress(0.3F);
}
var1.Use();
} else if ("PillsSleepingTablets".equals(var1.getType())) {
var1.Use();
this.getParentChar().SleepingTablet(0.1F);
if (this.getParentChar() instanceof IsoPlayer) {
((IsoPlayer)this.getParentChar()).setSleepingPillsTaken(((IsoPlayer)this.getParentChar()).getSleepingPillsTaken() + 1);
}
} else if ("Pills".equals(var1.getType())) {
var1.Use();
if (this.getParentChar() != null && this.getParentChar().getStats().Drunkenness > 10.0F) {
this.getParentChar().PainMeds(0.15F);
} else {
this.getParentChar().PainMeds(0.45F);
}
} else if ("PillsVitamins".equals(var1.getType())) {
var1.Use();
Stats var10000;
if (this.getParentChar() != null && this.getParentChar().getStats().Drunkenness > 10.0F) {
var10000 = this.getParentChar().getStats();
var10000.fatigue += var1.getFatigueChange() / 2.0F;
} else {
var10000 = this.getParentChar().getStats();
var10000.fatigue += var1.getFatigueChange();
}
}
}
looks to be entirely java side
hopefully the wonderful work being done on liquids gets done on medicines/blood
medicine could probably be handled entirely as a food item tbh
{
Weight = 0,
StressChange = -200,
UnhappyChange = -200,
BoredomChange = -200,
DisplayName = Funny Pills,
Icon = AGCMFunnyPills,
Tooltip = Tooltip_AGCMFunnyPills,
StaticModel = PillBottle,
WorldStaticModel = Vitamins_Ground,
UseDelta = 0.05,
Type = Drainable,
DisplayCategory = FirstAid,
UseWhileEquipped = FALSE,
}```
My "funny pills"
So how do you peak inside the java source, are you using a decompiler ?
you can open the files with windows - but for better searching I decompiled it yeah
I want to see how the inventory UI is put together so I can add a extra tab to it. Its beginning to annoy me I cant sort by weight.
that's done in Lua - so no need to decompile
Not had a chance to learn PZ modding, this is just me getting into it
but I'd recommend getting an IDE so you're not just browsing files on a hunch
I use IntelliJ
Yeah got the community version of IDEA.
Which lua plugin do you use? Using EmmyLua but not sure if its the best
That's what I use
@full socket I'd recommend setting this up: https://github.com/Konijima/PZ-Libraries
so I tried to make a custom car skin, and it says my car just does not exist???
{
mesh = vehicles/Vehicles_LuxuryCar,
shader = vehicle_multiuv,
invertX = FALSE,
scale = 0.01,
}
vehicle MadokaItasha
{
mechanicType = 3,
offRoadEfficiency = 0.8,
engineRepairLevel = 6,
playerDamageProtection = 0.8,
engineRPMType = firebird,
model
{
file = Vehicles_LuxuryCar,
scale = 1.8200,
offset = 0.0000 0.2473 0.0000,
}
spawnOffsetY = 0.12999995,
skin
{
texture = Vehicles/vehicle_MadokaMagica,
}
textureMask = Vehicles/vehicle_MadokaMagica_mask,
textureLights = Vehicles/vehicle_MadokaMagica_lights,
textureDamage1Overlay = Vehicles/Veh_Blood_Mask,
textureDamage2Overlay = Vehicles/Veh_Blood_Hvy,
textureDamage1Shell = Vehicles/Veh_Damage1,
textureDamage2Shell = Vehicles/Veh_Damage2,
textureRust = Vehicles/Veh_Rust,```
this is just the part of code I changed from the file ^
Thanks i was looking for a workspace configuration 🙂
This will decompile the java and annotate it all for Lua
and I get this error when trying to look at my car ingame
WARN : General , 1658504891771> VehicleType.initNormal> vehicle type "Base.MadokaItasha" doesn't exist
also allowing you to use ctrlshiftF and ctrlN to find phrases or filenames throughout
Do you have module Base { above?
Perfect thanks 🙂
You'd probably want to look in InventoryPane or InventoryPage
self.typeHeader = ISResizableButton:new(self.column3-1, 0, self.column4 - self.column3 + 1, self.headerHgt, getText("IGUI_invpanel_Category"), self, ISInventoryPane.sortByType);
self.typeHeader.borderColor.a = 0.2;
self.typeHeader.anchorRight = true;
self.typeHeader.minimumWidth = 100
self.typeHeader.resizeLeft = true
self.typeHeader.onresize = { ISInventoryPane.onResizeColumn, self, self.typeHeader }
self.typeHeader:initialise();
self:addChild(self.typeHeader);
hmm might be easy enough to do - seems like it would auto adjust sizes
I hate messing with UI
Nope it looks like its manually rendered, no generic definitions.
self.typeHeader.minimumWidth = 100 seems promising
Cant just slap a new header on this with text, gotta modify the rendering code 
oh well yeah
unfortunately alot of the UI stuff could do with alot more partitioning/APIs
you're probably going to have to overwrite the entire function
unless there's a .addHeader lol
I was hoping for ```cs
var columnDef = new ColumnDefinition()
columnDef.Render = ...
panel.Columns.Add(columnDef)
Better roll up those sleeves. So how should I go about this as it seems I need to replace a function, is there a code cave method to do this or will I need to overwrite the file?
Taking a look at it - if it happens during CreateChildren you should be able to slap an additional change on a safe overwrite
then I have this for the mechanical overlay lua
Make a lua file in the client/ directory:
require "ISUI/ISInventoryPane"
local ISInventoryPane_createChildren = ISInventoryPane.createChildren
function ISInventoryPane:createChildren()
---do stuff before
ISInventoryPane_createChildren(self)
---do stuff after
end
Unless UI classes are more finicky than I know - this should safely overwrite the function
function ISInventoryPane:renderdetails(doDragged) is where we render the item contents
local itemName = item:getName(); line 2327 onwards is the item name
if item:getJobDelta() > 0 then line 2369 onwards is the category name
Not sure what a job delta is.
I will have to override both createChildren and renderdetails
renderdetails is about 400 lines. Been awhile since I had to dig deep into code like this, 😄
render details would list weight values I assume?
Oh crap your right. I'll just have to override it and start putting dummy text into it to see if it's correct.
The only issue is this will also kill support for other mods if they screw with this file.
require "ISUI/ISInventoryPane"
local ISInventoryPane_createChildren = ISInventoryPane.createChildren
function ISInventoryPane:createChildren()
---do stuff before
ISInventoryPane_createChildren(self)
---do stuff after
self.weightHeader = ISResizableButton:new(self.column3-1, 0, self.column4 - self.column3 + 1, self.headerHgt, "weight", self, ISInventoryPane.sortByType);
self.weightHeader.borderColor.a = 0.2;
self.weightHeader.anchorRight = true;
self.weightHeader.minimumWidth = 100
self.weightHeader.resizeLeft = true
self.weightHeader.onresize = { ISInventoryPane.onResizeColumn, self, self.weightHeader }
self.weightHeader:initialise();
self:addChild(self.weightHeader);
end```
it's super broken due to the fact you have two columns trying to anchor right
The widths are all calculated at time of item render. It doesn't use the button as a reference it seems
Is there anyway to reload Lua at runtime or will I have to restart each time ?
changed the lua since I didn't notice the object is being referenced - now it's weightHeader
I think -debug in launch options adds a reloadingfunction
if not Aiteron wrote AUD which has it
Your a legend, thanks 😄
Don't know if that will help with UI as it's initilized
np
and yeah seems like you may have to hard overwrite render details
or you could leave weight details off - as you can now sort by weight
🤷♂️
I'll just override it, make it a proof of concept.
Discord crashes ofc when I make a spelling mistake.
I want to add 2 columns, W and SW just to filter by weight and stack weight.
well the first one is basically already done if you can figure out how to anchor center
hello! havent even start playing the game yet, but would you recommend any mods that must have to improve the game?
or just play without mods first
Just figured out where it;s used
lmao
although displaying it would still be a thing you can do
Honestly never use those buttons - had no clue
Okay, so my Backpack works flawlessly, However... It's inventory icon is a questionmark
I did make a custom inventory icon, but apparently i messed up?
i'll keep working on the backpack...
but it seems to work just fine
you have to use a specific format for item icons
filename = Item_x script Icon = x
generating normal items to weapons works great but then I have no way to formulate how to derive sounds that isn't as much work as hand tailoring them
going to just consolidate this as testUnit for my old vanilla weapons mod
{
DisplayCategory = Bag,
WeightReduction = 100,
Weight = 1,
Type = Container,
Capacity = 100000,
DisplayName = Strange Back Bag,
IconsForTexture = AGCMBackpack,
CanBeEquipped = Back,
OpenSound = OpenBag,
CloseSound = CloseBag,
PutInSound = PutItemInBag,
ClothingItem = Bag_SchoolBag,
BloodLocation = Bag,
RunSpeedModifier = 1.25,
AttachmentReplacement = Bag,
ReplaceInSecondHand = Bag_Schoolbag_LHand holdingbagleft,
ReplaceInPrimaryHand = Bag_Schoolbag_RHand holdingbagright,
WorldStaticModel = SchoolBag_Ground,
}```My backpack
No clue why inventory icon won't show
it uses same code as base game, except ofc for the reduction and such...
The item works, but not it's icon
you dont have Icon
change IconsForTexture to Icon
done
Okay, so now i only have one problem left: The dreaded Medicine.
want to convert this: item AGCMFunnyPills { Weight = 0, StressChange = -200, UnhappyChange = -200, BoredomChange = -200, DisplayName = Funny Pills, Icon = AGCMFunnyPills, Tooltip = Tooltip_AGCMFunnyPills, StaticModel = PillBottle, WorldStaticModel = Vitamins_Ground, UseDelta = 0.05, Type = Drainable, DisplayCategory = FirstAid, UseWhileEquipped = FALSE, } into a medicine item, and i havent had any luck trying to make a custom item thus far...
game treats it only as an "object"
last question (currently)
How many storage containers can you wear? (I know of the backpack/duffelbag)
nvm, the wiki answered my question... forgot about the wiki
well, as far as i see, there is only 3... I mean slots...
Fanny pack front & back, and a backpack or similar..
3 extra storage containers on the player beyond their standard inventory
so yeah, a couple more items to add to my mod 😛
actually, most of these scripts are in .txt format, for some reason.
Are they actually just lua?
I'm just wondering how to make comments...
Hey all
Trying to get two items to be given when I open a box
but I only get the first one (twinkies)
and not the TWBOpened (twinkies box open)
Any ideas? Thanks
if the base game has any items that that has the "open" feature, maybe look how they are done and copy those?
ok im out of logic thinking my brain out from window.....
What The Hell just happen
use ; than ,
thanks will try
no just random colors in random places ....
and there nothing works expect shell texture ...
well, thanks for making me chuckle due to that random driving, on a more serious note, i honestly have no clue as to what goes on... i would hazard a guess and claim that there is a bug in the texture handling? maybe shadows breaking??
okay, lol what the hoot? the ending... looks like some kind of overlay texture being applied, and it just goes bananas
back in old NES 2D games, you could get to these weird out of bounds areas where everything goes weird. Looks like you got a car that partially goes out of bounds with it's own textures 😄
isen't that texture layer meant for shine effect for cars?
idk
I don't think it would be that easy to do. as the stat changes and effects from the medicine items are defined in the java not lua, and are hard coded. So you would have to make your own custom context menu option for those items, if you would want them to mimic the medicine in the game.
btw, how do i make comments in these recipe files and that like?
double dash, or slash or???
nvm
no i meant, i like to make comments in my files to seperate sections and such
As silly as some might think it, i just like to do it...
lua is too much simply you need to every line make -- for comment due there are no comment block ...
-- aiming while moving, gain nimble xp (move faster in aiming mode)
if player:isAiming() and xpUpdate.randXp() then
xp:AddXP(Perks.Nimble, 1);
end
-- if you're walking with a lot of stuff, you may gain in Strength
-- but who know how it will work in game...
if player:getInventoryWeight() > player:getMaxWeight() * 0.5 then
if xpUpdate.randXp() then
xp:AddXP(Perks.Strength, 2);
end
end
on another note. In the DebugLog file, i get this:
[22-07-22 19:59:48.939] WARN : Recipe , 1658512788939> RecipeManager.resolveItemModuleDotType> WARNING: module "AGCMCheatItemsRecipes" may have forgot to import module Base.
If i ask it to import, the game darn nearly dies... sooo should i just ignore? it's not exactly an error, and the mod works regardless...
you should use an Oncreate to give the other item. the oncreate would just reference a function that is run, and gives the player the item.
ignore almost half or more mods on Workshop have the same error about missing import from base
--[[
aaaaaa
aaaaaaaaaaa
aaaaaaa
--]]
well something new
gotcha, ignor i shall
my knowledge is from 2008 xD
I believe it is "/ * * " to start a comment and "* * /" to close one, but without the spaces. discord wants to do formatting with them and idk what discord would use to escape that. This is for the script files ie the .txt ones

in txt you don't have something like comment
all is plain text
it's design layout loosk very XML or LUA or something
might be .txt, but formatting looks very... familar
pretty sure an item definition in zomboid will get messed up, if you have random text in there that will mess up the processing
ofc they are plain text. but they are interpreted by zomboid for items, recipe, etc. using /** and **/ let you escape that behaviour and write notes in the file, without screwing things up.
even the lua is just plain text as well
still some ideas ?
Any evil dead fans in the modding community?
okay, ran into a weird bug with my new fannybags...
If i double click them, they appear as if being worn, but just appear, but if i rightclikc them i can tell it to wear either on front or back as per normal... anyone got a clue?
want me to post the code for the items?
I guess i messed something up...
woah... okay, yeah, i didn't notice, but it tosses errors at me when i just double click the item
No one can help me get my Fannypacks to work?
you gotta actually post stuff if you want help
like the fanny pack. if you want help to check your item, post it here so people can actually see it. and if you are getting an error. just post the error you are getting
alrighty
{
DisplayCategory = Bag,
WeightReduction = 100,
ClothingItemExtra = AGCMFannyPackBack,
ClothingItemExtraOption = FannyPack_WearBack,
clothingExtraSubmenu = FannyPack_WearFront,
Weight = 1,
Type = Container,
Capacity = 100000,
DisplayName = Belly Pack (Front),
Icon = AGCMFannyPackF,
OpenSound = OpenBag,
CloseSound = CloseBag,
PutInSound = PutItemInBag,
BodyLocation = FannyPackFront,
ClothingItem = Bag_FannyPackFront,
CanBeEquipped = FannyPackFront,
WorldStaticModel = FannyPack_Ground,
}
item AGCMFannyPackBack
{
DisplayCategory = Bag,
WeightReduction = 100,
ClothingItemExtra = AGCMFannyPackFront,
ClothingItemExtraOption = FannyPack_WearFront,
clothingExtraSubmenu = FannyPack_WearBack,
Weight = 1,
Type = Container,
Capacity = 100000,
DisplayName = Butt Pack (Back),
Icon = AGCMFannyPackB,
OpenSound = OpenBag,
CloseSound = CloseBag,
PutInSound = PutItemInBag,
BodyLocation = FannyPackBack,
ClothingItem = Bag_FannyPackBack,
CanBeEquipped = FannyPackBack,
WorldStaticModel = FannyPack_Ground,
}```
The items in question
the error:
```-----------------------------------------
function: createItem -- file: ISClothingExtraAction.lua line # 75
function: perform -- file: ISClothingExtraAction.lua line # 52.
[22-07-22 20:39:15.419] ERROR: General , 1658515155419> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getVisual of non-table: null at KahluaThread.tableget line:1689..
[22-07-22 20:39:15.419] ERROR: General , 1658515155419> DebugLogStream.printException> Stack trace:.
[22-07-22 20:39:15.422] LOG : General , 1658515155422> -----------------------------------------
STACK TRACE
-----------------------------------------
function: createItem -- file: ISClothingExtraAction.lua line # 75
function: perform -- file: ISClothingExtraAction.lua line # 52.
[22-07-22 20:39:15.424] LOG : General , 1658515155424> bugged action, cleared queue ISClothingExtraAction.
[22-07-22 20:45:25.001] LOG : General , 1658515525001> -------------------------------------------------------------
attempted index: getVisual of non-table: null.
[22-07-22 20:45:25.001] LOG : General , 1658515525001> -----------------------------------------
STACK TRACE
-----------------------------------------
function: createItem -- file: ISClothingExtraAction.lua line # 75
function: perform -- file: ISClothingExtraAction.lua line # 52.
[22-07-22 20:45:25.002] ERROR: General , 1658515525002> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getVisual of non-table: null at KahluaThread.tableget line:1689..
[22-07-22 20:45:25.002] ERROR: General , 1658515525002> DebugLogStream.printException> Stack trace:.
[22-07-22 20:45:25.005] LOG : General , 1658515525005> -----------------------------------------
STACK TRACE
-----------------------------------------
function: createItem -- file: ISClothingExtraAction.lua line # 75
function: perform -- file: ISClothingExtraAction.lua line # 52.
[22-07-22 20:45:25.007] LOG : General , 1658515525007> bugged action, cleared queue ISClothingExtraAction.
I dunno what to do... Confused...
the error happens when i double click, like you normally would to quickly wear an item.
And then the item vanishes
deleted from inventory and world
hmm, it looks fine to me. maybe try setting a reasonable value for the capacity first to see if it works. Maybe the engine doesn't like such a large number
weird, it's fine with my backpack... but sure, why not
attempted index: getVisual of non-table: null.
[22-07-22 21:14:31.336] LOG : General , 1658517271336> -----------------------------------------
STACK TRACE
-----------------------------------------
function: createItem -- file: ISClothingExtraAction.lua line # 75
function: perform -- file: ISClothingExtraAction.lua line # 52.
[22-07-22 21:14:31.336] ERROR: General , 1658517271336> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getVisual of non-table: null at KahluaThread.tableget line:1689..
[22-07-22 21:14:31.337] ERROR: General , 1658517271337> DebugLogStream.printException> Stack trace:.
[22-07-22 21:14:31.340] LOG : General , 1658517271340> -----------------------------------------
STACK TRACE
-----------------------------------------
function: createItem -- file: ISClothingExtraAction.lua line # 75
function: perform -- file: ISClothingExtraAction.lua line # 52.
[22-07-22 21:14:31.341] LOG : General , 1658517271341> bugged action, cleared queue ISClothingExtraAction.```Still the same error...
Changed the weight down to just 1, so it's like default Fannypacks...
so can craftable furniture like lets say cabinets, be given the effects of refrigerators? so you can plug them in and use them with a generator? asking this because im looking to see if i cant help robot add refrigerated and icebox cellars to hydrocraft continued
and like a big firepit for large food cooking that has the same effects from a charcoal bbq
it somehow doesnt find the item to create
try adding the module name in
ClothingItemExtra = MyMod.AGCMFannyPackFront,
not sure but could be that
Not sure how... the import thing?
Anyone know if the meth mod works or if it is buggy
add the module name to your script txt
item AGCMFannyPackFront
{
DisplayCategory = Bag,
WeightReduction = 100,
ClothingItemExtra = AGCMFannyPackBack, <------ here like MyModuleName.AGCMFannyPackBack
ClothingItemExtraOption = FannyPack_WearBack,
clothingExtraSubmenu = FannyPack_WearFront,
Weight = 1,
Type = Container,
Capacity = 100000,
DisplayName = Belly Pack (Front),
Icon = AGCMFannyPackF,
OpenSound = OpenBag,
CloseSound = CloseBag,
PutInSound = PutItemInBag,
BodyLocation = FannyPackFront,
ClothingItem = Bag_FannyPackFront,
CanBeEquipped = FannyPackFront,
WorldStaticModel = FannyPack_Ground,
}
The same module name used at the top of that file
LED car!
I should get back to making that script thingy. haha
I can see that technicality be confusing for many people.
Idk if that would prevent that kind of mistake tho
cause Base.items doesnt need the module name at the start but modded items neeeds it
Oh if you write your UI code to, you can yeah.
Force it & export it. Make it convenient.
cause ItemFactory.createItem will default to Base
I'm not sure why that decision was made.
Sounds like a short-term benefit but a possible issue down the road with human error.
its not that bad, in fact if you make a mod you should mostly specify your module name
since you could have item with the same name but different module name
(I'm on the side of explicitly typing the module)
Ah. That could be built into a command like how Minecraft does it.
minecraft:stone
/give player stone
well i think it must have been added later for mod support
anyhow thats just how it is
Good point.
😄
I'm messing with vanilla weapons and tweaking vanilla scripts with scriptmanager - does that stuff have to be in shared?
locking out my MP server
You can check if you're executing code from the shared directory via isClient() and isServer() so I don't see why trying that would hurt.
it's an old mod of mine - runs fine in client/
IIRC the server runs and calls ScriptManager.
hm
I'll test it out
im guessing the clients and servers items don't match and it throws a fit
Was thinking this as well. I'm not experienced in this category of modding so someone else might know. 🙂
you are getting world dictionary error and then game closes?
Twinkies!
Hey, how can I disable a vanilla trait?
which trait is it
💪
There's a bunch I'm trying to remove (multiplayer, btw), say "Sunday driver" as an example
Not too sure if setRemoveInMP is a reasonable way to go around it though, feels hacky if there's a better way to actually remove it from the list
In your server do you use any other mod that effect traits?
Also im going to show you but i suggest you make your mod unlisted so that people dont use it cause that will most likely break with other trait mods lol
Sure :P
create a file in media\lua\shared\NPCs\CustomMainCreationMethods.lua
add this to it:
Events.OnGameBoot.Remove(BaseGameCharacterDetails.DoTraits);
BaseGameCharacterDetails.DoTraits = function()
-- addTrait here
-- setMutualExclusive here
-- keep this at the end
TraitFactory.sortList();
local traitList = TraitFactory.getTraits()
for i=1,traitList:size() do
local trait = traitList:get(i-1)
BaseGameCharacterDetails.SetTraitDescription(trait)
end
end
Events.OnGameBoot.Add(BaseGameCharacterDetails.DoTraits);
Look at \media\lua\shared\NPCs\MainCreationMethods.lua to take what you want.
I am not responsible if this break your game 😛
No problem, thanks :D
nah but youll get error if something is wrong and you can fix it
Yeah just wasn't sure how the list of traits was being populated in the first place
Thanks dude :D
If dont know if you have to adjust the professions too
Makes me wonder though, since I see ZombiesZoneDefinition.lua over there - is zombie spawning managed through Lua?
definition yeah
My man, you truly are a god of thought
anybody here know how to copy the abilities of one item in code to another?
such as an ice box, for a powered freeze cellar, where it has to be plugged into the generator, and has the ability to freeze things in it
the idea being both the icebox and the cellar are furniture you craft
I released a personal extension to the "True Music" mod. I didn't find this music in other mods so... it contains 14 musics both in vinyl and boombox, the music list is in the description of the workshop page.
https://steamcommunity.com/sharedfiles/filedetails/?id=2838616385&searchtext=Battlefield
Curious. Did you compose those 14 tracks?
No no, the music is from a playlist that i'm always listening to, it contains badass songs to wipe out an entire army
Oh ok
I'm not saying the entire music list because is a long description but if you wanna i can send it xd
This is my first mod, maybe in next time i will make Battlefield stuff
Like BF 2142 Outfits
All good. It's good to start with less complex mods.
How would I write it to add 2 items to the "ReplaceOnUse" Line?
I've tried ReplaceOnUse = Item1;Item2,
Dont seem to work though
ReplaceOnUse is a 1:1 afaik
You'd want to look at any onuse Lua calls instead of you want multiple items
Right so i'm hella new to modding just tryna make a couple items for my server what does that mean in english lmao?
Does anyone have any expertise in localization, I'm trying to put in french and its not working at all.
this is one of the files i have for my mod french in this case.
I have Russian, Spanish, and English working fine with the exact same layout, but french just seems to hate me
(ignore the missing characters, thats just because i don't have the french language pack installed)
set the encoding to
where do you set it to that encoding?
what text editor are you using
otherwise Shift+Control+P and type encoding
you can also set the default encoding in your editor settings
Would that work with polish and german as wwell?
i do not know exactly
even after chaning the encoding youll have to retype the text correctly
ah okay i'll give that a try, thanks
apparently copying the text still has a broken format
i had to set my editor to default window-1252 cause upon restart the editor would mess all my languages file
I know i had this issue with russian, but it gave unreadable text
it didn't give english like it is now
So... based on user-experience, it's pretty clear there's some kind of cap, or soft cap, to how many zombies are allowed to be active on a server. Once too many zombies gather in one place some of them "phase out", only to pop back into existence once the area calms down a bit resource-wise.
This happens on any server seemingly, seen it on 4gb ded-ram servers, and seen it on a 64gb server multiple times.
Anyone happen to have poked around about this issue/limitation before to see if there's a way to change when this starts happening server-side?
even just pointing towards where this is handled in the server code would be a big help!
alot of the different languages need different encodings. you can see them here
https://github.com/TheIndieStone/ProjectZomboidTranslations/blob/master/.gitattributes
here is the description that found the issue
https://github.com/TheIndieStone/ProjectZomboidTranslations/issues/155
@shadow geyser also, while you're here, any word on fixing Hydro's irrigation system? had a lot of people complaining on the server that they just straight up don't work.
that or a server-function bypass for the infinite log pile, since .71 broke it so it doesn't let players change weight values since that's handled client side as is.
huh, didn't know about the log pile thing. will take a look. and not yet on the irrigation thing. lifes been busy
all good, just asking out of curiosity since one of our players brought irrigation up again today.
basically the infinite log pile's lua is all in the client folder from what I saw. .71 removed a lot of client permissions on servers, so it does give logs to players and players can craft them... but they can't change weight values on it or some other stuff (prob doesn't let them remove the item at 0 weight either), so as it is... it is literally an "infinite" log pile.
issue won't be repeatable on an admin/debug mode account if you're gonna test it, since those bypass .71 client permission restrictions on servers
if you want an example of a bypass, there's a vehicle dismantling mod we use that has a bypass mod on the workshop, essentially just names a function in the server lua folder and uses that function on the client lua rather than the base-game remove function.
might have had a line about letting clients use the function too, been a while since I looked at it.
https://steamcommunity.com/sharedfiles/filedetails/?id=2833065348&searchtext=vehicle+recycling @shadow geyser here's the mod with an example of using a server lua to bypass client restrictions*
thanks. that will be really useful
Okay, finally back, and i lost track of what i had to do yesterday.
Something about Importing the mod or what not, because my custom fannypacks apparently don't create the correct object or what ever...
I'm not sure how to do this import module thing, i'd love to know tho, so that my mods will work right.
from what I remember, someone was suggesting to you to provide the full path for the item in the clothingItemExtra. you can infer it from the file, but the easiest way to confirm it is probably ingame. in the debug menu. you should be able to get the full name of the item which will be something.youritem
Hello there
I want to automatically publish the number of zombies killed by the time in the game on discord.
How can I do that
How NOT to do that: Spin around hard and fast near your computer, so much so that you can barely stand still when you want to. Once you come to your senses, kiss your screen and yell out some incoherent bs for the heck of it and then hope someone more helpful then me will show up to give you the help you need ^_^
I'll try that a bit later, a bug in my rimworld mod cropped up, currently playtesting with another mod to locate the issue. then will look into my pz mod. Thanks.
what do you want to say?
... um... Mooo?
?
There is a log where it writes the perk information. It also says how long it lived in this log file.
I think you can get information from this file. It doesn't just say how many zombies were killed.
anyone know how to get english translation from a diff language client? my perk log is a bit unreadable lol
[22-07-22 06:41:37.475] [Avax][6084x5310x1] gained Skill** [烹飪][5].**
[22-07-22 08:45:02.406] [Avax][7319x6488] gained Skill [木工][5].
[22-07-22 09:13:46.234] [Snowman][7927x8747] gained Skill [Mechanics][6].
I am using the Perkfactory.Perk:getName() function
apparently theres an unused version of the padded jacket texture? the second image is the one that's actually used
you are messing with a texture that was pre-release anims build
there is more than just that one
yeah i've noticed a lot of the old textures that were in preview stuff from years ago but this one looks more recent
it uses the current artstyle and is in the same folder as the current jacket textures
Any way to stop big splotches of dirt appearing on your character even at just 1 dirtiness? Would it be possible to only start showing the grime texture after a certain threshold?
oh my
I have narrowed my STR issue to one thing: Sending the updated vehicle to the client. I'm not sure how I'd do that. Any ideas on what I'd use to transmit the updated vehicle?
This is a really dumb question: is there a way to change which clothes a new character on a server spawns with?
@jagged ingot - having the changes to scriptmanager in server also prevented the game from launching - but shared works great. 🤷♂️
What are you trying to do and what are you getting ?
local VanillaWeaponsExpanded = {
["Base.Plunger"] = {
["HitFloorSound"] = "PlungerPop",
["SwingAnim"] = "Stab",
},
local function expandWeapons()
local SM = getScriptManager()
local allItems = SM:getAllItems()
local expandedWeaponsText
local leftOverNormalsText
for i=0, allItems:size()-1 do
---@type Item
local itemScript = allItems:get(i)
local iModuleDotType = itemScript:getFullName() -- module.Type
local expandedWeaponInfo = VanillaWeaponsExpanded[iModuleDotType]
if expandedWeaponInfo then
for param,data in pairs(expandedWeaponInfo) do
itemScript:DoParam(param.." = "..data)
end
expandedWeaponsText = expandedWeaponsText or " Applied On:\n"
expandedWeaponsText = expandedWeaponsText.." "..itemScript:getFullName()..", \n"
else
if tostring(itemScript:getType()) == "Normal" then
leftOverNormalsText = leftOverNormalsText or " Normal Types Remaining:\n"
leftOverNormalsText = leftOverNormalsText.." "..itemScript:getFullName()..", \n"
end
end
end
if getDebug() then
local debugText = "Vanilla Weapons Expanded:"
if expandedWeaponsText then debugText = debugText..expandedWeaponsText end
if leftOverNormalsText then debugText = debugText..leftOverNormalsText end
print(debugText)
end
end
expandWeapons()
When put in client/server the game can't host - just terminates with no errors.
Works as expected in shared tho - and always works in SP
ah okay you are editing script item
Refactoring an old mod that makes more items weapons, yeah
Just wanted to update the solution, in case someone ctrl+f's "scriptmanager
The old version of this mod actually used item tweaker - probably should have checked lol
always though its weird cause clients loads all 3 directory client/server & shared.
but server never loads clients which is logical
oh my
for client to load server directory is understandable for single player
I figured server would be the ideal place but it might be triggering some anticheat
my cat robbed my desktop chair so i need a brake
Hmm
Maybe clients are loaded on the server too ... not quite sure about that one tho.
ill have to mess around with prints and see what happens
he runs the main core function onboot
that may be the difference
Honestly, I would have used itemtweaker but I disliked the format of using a function for each param
probably could just make a wrapper that pulls my table 🤔
no point in doing that if your script works.
Item tweak is just a wrapper for doparam in the end
fair/true
I also wanted to print what items where changed and what's left over - keeps me on track lol
Neat
I could download a bunch of mods and get their item types this way too
Im messing in unity until stable is updated then im going into an update frenzy
will sync all my updates in the same minute.
that'll be fun for the steam comments
Im thinking to eventually set that git action from community api to update each of my mods
so uhh, the 2 masters of MP code. I have a question for ya?
Are you going to auto auth the 2fa?
Ill have to check that out
I don't know about that for me - EHE's sound syncing is still kicking my ass, but shoot
I've got code that sends a client command, and the command runs setScriptName(Name) on the server side. Only issue with it? I'm unable to figure out how to send the changes to the client.
You can send data back using server commands
oh?
sendServerCommand
Events.OnServerCommand.Add()
and what would I do on the client side once the client receives the command?
Events.OnServerCommand.Add(onCommand)--/server/ to client
Events.OnClientCommand.Add(onCommand)--/client/ to server
k
check this repo it will probably help, there is also example mod in the readme
but what would I send in the server command?
what do you wanna send to the clients?
depends what you're doing
server receives command from client to "trigger" changing the vehicle script
server changes vehicle script
wait changing script?
I'm lost at sending the updated vehicle data to client
setScriptName(vehicle name), yes
to convert 1 type of vehicle to another?
if you're trying to replace it entirely wouldn't overwriting the script work?
Oh, you want certain vehicles to be from specific departments - you made the multi department response cars right?
I don't suppose the spawn distribution tables are that advance?
won't work
because the vanilla blockade, for example...
hardcoded to use vanilla cars
but the current system for this works, buuuut
on servers, and only in a server setting. The doors bug out
as in the console gets this nasty null error, and the doors are unable to be locked/unlocked
local function onCommand(_module, _command, _dataA, _dataB)
--serverside
if _module == "sendLooper" then
if _command == "ping" then
--print("--sendLooper:ping -- ".._dataB.command)
sendServerCommand("sendLooper", _dataB.command, _dataB)
end
end
end
Events.OnClientCommand.Add(onCommand)--/client/ to server
basically you can bounce commands from server/clients
won't that cause lag?
you could have a command fire off a client -> server -> to all clients
but I dont get why it wouldn't just be applying to all clients when they get close to the vehicle
it does
not as long as the data you're sending is brief
ah
so you're issue isn't really syncing clients - it's saving the change on the server
so here's the function that triggers when the client fires off the trigger
function Commands.setVehicleChange(player, args)
local vehicle = getVehicleById(args.vehicle)
if vehicle then
vehicle:setScriptName(args.script)
print("Deez Nutz!")
end
end```
How/when are you applying the change anyway? Onload?
are you preventing it from reapplying?
yes
if GetVehicleScript == "Base.CarLightsPolice" or GetVehicleScript == "Base.PickUpVanLightsPolice" or GetVehicleScript == "Base.85vicsheriff" or GetVehicleScript == "Base.87capricePD" or GetVehicleScript == "Base.91blazerpd" or GetVehicleScript == "Base.92crownvicPD" then Plus if it's in the XY range
what happens if you prevent it from reapplying
it'll ignore the car
by that I mean you're storing which cars got changed already
oh
you aren't?
I was curious why it doesn't reapply when you come back to it
rather than once a minute I would look into square load
just don't put any prints in any main part of the code
it will lag your game
the error is it only "refreshes" the car once you come back to it. It doesn't "refresh" until then
alr
OnSquareLoad?
Events.LoadGridsquare.Add()
ah
and I have something to help cause I don't think there's a way to grab cars hold on
---@param square IsoGridSquare
---@param returnFirst boolean
---@return table|BaseVehicle table of BaseVehicles or just 1 BaseVehicle
function getVehiclesIntersecting(square, returnFirst)
local vehicles = getCell():getVehicles()
local intersectingVehicles = {}
for v=0, vehicles:size()-1 do
---@type BaseVehicle
local vehicle = vehicles:get(v)
if vehicle:isIntersectingSquare(square:getX(),square:getY(),square:getZ()) then
if returnFirst then
return vehicle
end
table.insert(intersectingVehicles, vehicle)
end
end
if #intersectingVehicles==1 then
return intersectingVehicles[1]
end
return intersectingVehicles
end
vanilla only has getVehicleIntersecting as a boolean
wrote this for EHE shooting at cars
ah
you'd have to for loop the return or rip this apart to just apply
local GetVehicles = getWorld():getCell():getVehicles();
if GetVehicles ~= nil then
for i=0, GetVehicles:size()-1 do
GetVehicle = GetVehicles:get(i);
GetVehicleX = GetVehicle:getX();
GetVehicleY = GetVehicle:getY();
GetVehicleScript = GetVehicle:getScriptName();```
there's what I use
also it sometimes returns a single car
hmm
the issue with that is you probably don't want to scan the entire cell's worth of cars every time a new square is loaded
yeah
yeah
kind of a pickle I guess
indeed it is
they need some lua events for oncreate for cars and items
yep
so the cars turn back to their normal selves only in MP?
no
with code A. It'll work, but the cars don't save the change to the server. As in leaving and coming back to the car it'll be the old vanilla car, and rerun the change. Plus doors tend to break. As in you won't be able to lock/unlock em. And it'll blast about "part = null"
that happens even in SP?
no it doesn't
only on the server
code B. doesn't have that door issue, but the darn car won't update. As in it'll stay a vanilla car until you leave and come back
so you need the server to setScript onclients
I think so
but yeah, this is the big roadblock. The car doesn't "update" itself
is the one a minute code firing from inside client / shared / server?
once a minute fires from client
then sends a client command
which then a file in server handles the script change
that's another issue to deal with
does scriptReloaded fix the issue of having to leave and come back?
yes
I thought code B didn't have a doors issue though
it's used in debug:
function ISVehicleMenu.onDebugSetScript(playerObj, vehicle, scriptName)
vehicle:setScriptName(scriptName)
vehicle:scriptReloaded()
hmmm
if GetVehicleX >= Riverside[1] and GetVehicleX <= Riverside[2] and GetVehicleY >= Riverside[3] and GetVehicleY <= Riverside[4] then
if str_rsresult == RSPDCar[1] then
GetVehicle:setScriptName(RSPDCar[1]);
GetVehicle:scriptReloaded();
--GetVehicle:setScriptName(RSPDCar[1]);
elseif str_rsresult == RSPDCar[2] then
GetVehicle:setScriptName(RSPDCar[2]);
GetVehicle:scriptReloaded();
--GetVehicle:setScriptName(RSPDCar[2]);
elseif str_rsresult == RSPDCar[3] then
GetVehicle:setScriptName(RSPDCar[3]);
GetVehicle:scriptReloaded();
--GetVehicle:setScriptName(RSPDCar[3]);
end
end
maybe the reloaded can be run for the clients as to avoid the issue with code A?
oh?
let's see
this game man
"Let me take 84 years to load a SP world"
lol
no dice
start a sp game with low to no zombies and it will load fast
it is at no zeds. My PC's just trash. Lol
ah rip
yeah, no dice on that
you sent it as a command within your other command?
Also @thin hornet figured out an even better way to handle my overhaul - ```lua
local WeaponProfiles = {
["SmallStab"] = {
["MaxRange"] = "0.8",
["MinAngle"] = "0.65",
["Type"] = "Weapon",
},
}
local VanillaWeaponsExpanded = {
["Base.CarvingFork"] = {
["wep_profile"]="SmallStab",
},
["Base.Toothbrush"] = {
["wep_profile"] = "SmallStab",
["MinDamage"] = "0",
["MaxDamage"] = "0",
},
}
taking the technique used for EHE presets hehe
local expandedWeaponInfo = VanillaWeaponsExpanded[iModuleDotType]
if expandedWeaponInfo then
local weaponProfileID = expandedWeaponInfo["wep_profile"]
if weaponProfileID then
for param,data in pairs(WeaponProfiles[weaponProfileID]) do
if not expandedWeaponInfo[param] then
itemScript:DoParam(param.." = "..data)
end
end
end
for param,data in pairs(expandedWeaponInfo) do
if param ~= "wep_profile" then
itemScript:DoParam(param.." = "..data)
end
end
hmmm
cooking is hard
I wonder if I could grab the models and modify them in realtime
would be a slog to edit them by hand :\
although it may be unavoidable given not every item will work with rotating it the same way
sorry I'm LATE, but yeah
on the server file: lua local args = { vehicle = vehicle:getId() } sendServerCommand('str', 'vehicleReload', args)
And in the client_Receive file:
function Commands.vehicleReload(vehicle, args)
local vehicle = getVehicleById(args.vehicle)
if vehicle then
--vehicle:setScriptName(args.script)
vehicle:scriptReloaded()
--vehicle:transmitUpdatedSprite()
print("Deez Cows!")
end
end```
Would it be possible to create some sort of bot that can be in PZ as an admin, stood next to a HAM radio, that broadcasts music via a PZ account over the radio? Like have it scan the PZ console for youtube links that will allow the players to jump on the frequency and 'request' songs via the radio that que the bot to play it via a virtual mic input to the HAM Radio?
And you're setting script on the server side?
yes
it's printing the message I assume
yes
strange, and setting script above scriptreload in client side doesn't change anything?
what about trying to set and reload the script on both sides?
That's Code A.
Got a good chunk done: https://steamcommunity.com/sharedfiles/filedetails/?id=2357915214
Applied On: Base.Bowl, Base.WineEmpty2, Base.Tweezers, Base.Teacup, Base.MugRed, Base.PopBottleEmpty, Base.TreeBranch, Base.Corkscrew, Base.Plunger, Base.Chopsticks, Base.Dart, Base.Saw, Base.BeerEmpty, Base.LugWrench, Base.Mugl, Base.PercedWood, Base.PlateFancy, Base.PaintbucketEmpty, Base.MugWhite, Base.BucketEmpty, Base.MugSpiffo, Base.CarvingFork, Base.Pot, Base.GlassWine, Base.EmptyJar, Base.ModernCarMuffler1, Base.ModernCarMuffler2, Base.ModernCarMuffler3, Base.WineEmpty, Base.PlateBlue, Base.GlassTumbler, Base.WoodenStick, Base.WhiskeyEmpty, Base.WaterBottleEmpty, Base.PlasticCup, Base.BleachEmpty, Base.Kettle, Base.PlateOrange, Base.Toothbrush, Base.Plate, Base.GardenSaw, Base.KnittingNeedles, Base.EmptyPetrolCan, Base.NormalCarMuffler2, Base.NormalCarMuffler3, Base.NormalCarMuffler1, camping.TentPeg, farming.RemouladeEmpty, farming.WateredCan, farming.GardeningSprayEmpty, farming.MayonnaiseEmpty,
-- Server Side
-- Server Side
local function onClientCommand(module, command, player, args)
if module ~= "MyModName" then return; end
if command == "vehicleReload" then
local vehicle = getVehicleById(args.vehicleId)
if vehicle then
vehicle:scriptReloaded(); -- reload on server side
print("Vehicle id " + tostring(args.vehicleId) + " reload!");
sendServerCommand('MyModName', command, args); -- send the change back to all players
end
end
end
Events.OnClientCommand.Add(onClientCommand);
-- Client Side
-- Client Side
local function onServerCommand(module, command, args)
if module ~= "MyModName" then return; end
if command == "vehicleReload" then
local vehicle = getVehicleById(args.vehicleId)
if vehicle then
vehicle:scriptReloaded(); -- reload in this client
print("Vehicle id " + tostring(args.vehicleId) + " reload!");
end
end
end
Events.OnServerCommand.Add(onServerCommand);
-- Client function to reload vehicle for everyone
function reloadVehicle(vehicle)
local args = { vehicle = vehicle:getId() };
sendClientCommand('MyModName', 'vehicleReload', args); -- send command to server
end
alright, 2 questions for that
- Where does
setScriptNamecome in? - Won't that right there reload the vehicle every tick?
week 2. started continue fighting with random working textures on cars
Okay sorry for asking, can you describe me very briefly exactly what you want to do please
well
Keep hope
I've got code on the client that if a car meets criteria (is the right scriptName within XY), it sends a client command.
Which then the server runs setScriptName(Name).
Where I'm lost is transmitting the change to the clients
as in, so you don't have to leave/unload the cell and come back for the changes to apply
setScriptName changes the vehicle?
yes
but
clients won't see it
until they leave the area and come back
Sorry if I'm being confusing
created detailed car for GTA5 is more easier than make working textures for cars here...
have created 4 models here and all works self just have problem with textures.... that is pain as hell
-- Server Side
local function onClientCommand(module, command, player, args)
if module ~= "MyModName" then return; end
if command == "setVehicleScript" then
local vehicle = getVehicleById(args.vehicleId)
if vehicle then
vehicle:setScriptName(args.scriptName);
vehicle:scriptReloaded();
print("Vehicle id " .. tostring(args.vehicleId) .. " set script to " .. args.scriptName .. "!");
sendServerCommand('MyModName', command, args);
end
end
end
Events.OnClientCommand.Add(onClientCommand);
-- Client Side
local function onServerCommand(module, command, args)
if module ~= "MyModName" then return; end
if command == "setVehicleScript" then
local vehicle = getVehicleById(args.vehicleId)
if vehicle then
vehicle:setScriptName(args.scriptName);
vehicle:scriptReloaded();
print("Vehicle id " .. tostring(args.vehicleId) .. " set script to " .. args.scriptName .. "!");
end
end
end
Events.OnServerCommand.Add(onServerCommand);
function setVehicleScript(vehicle, scriptName)
local args = { vehicle = vehicle:getId(), scriptName = scriptName };
sendServerCommand('MyModName', 'setVehicleScript', args);
end
Then just use:
setVehicleScript(vehicle, newScriptName)
this should do it on the server and then on each client regardless
ok
sorry have to edit i keep making mistake lol
lol
so wait, in my main code. Which triggers the whole thing
I'd use setVehicleScript(vehicle, newScriptName) ?
or do I use sendClientCommand?
Yeah but you can set that function as a local and place it in the script that will call
ah
So when does this get triggered
quite simply because I don't know a better way?
haha
it currently scans the cell for cars, and if a car in the list meets the criteria, it'll run the code for that car
and anything beyond every minute just isn't dynamic enough
so it loop all car in a cell every in-game minutes
lets try to find a more optimized way
I could shove modData on the cars scanned?
maybe
but let's at least get the system working first. LOL
well one thing you could do is
local ticks, previousCell = 0, nil;
local function onTick()
ticks = ticks + 1;
if ticks < 10 then return; end
ticks = 0;
-- So we run only once every 10 ticks
local currentCell = getCell();
if previousCell ~= currentCell then
previousCell = currentCell;
-- Do you stuff here only if we changed cell
end
end
Events.OnTick.Add(onTick);
oh?
well so this way it would only check the cars in a cell once
and if you change cell it would check again for that new cell
ah
And only one player need to do it cause the server/client comand we made will change it for everyone logically in that cell.
And those that enter that cell later will receive the server version of that car
and doing it will OnTick will prevent run the function too fast or too slow depending of the timescale of the game
alright
it isnt, ok never done that before so no idea why but maybe something we can find in the source
so the code goes in the "do stuff here if changed cell" part of that?
yeah the code keep track of the last cell scanned and will only scan again if the player changes cell
ah
did you ever get a car changed with a code?
what was it
the doors would bug out
Anyone know how to get replaceonuse to giveback 2 items?
GetVehicle:setScriptName(JCSDCar[3]);
GetVehicle:scriptReloaded();
GetVehicle:setScriptName(JCSDCar[3]);```
It's in there twice because somehow the car wouldn't save to the server otherwise.
but by "doors would bug out" Basically if you interacted with or tried to lock the doors/trunk, it'd blast a "silent error" in the log. Something to do with a "null door". Plus it wouldn't let the lock/unlock action finish
are we even suposed to change a vehicle this way
how about deleting and adding a new one?
Then keys would be lying on the ground?
I'm not against that idea. Just the whole "linked keys" dilemma
that stuff should happen only to unowned/undriven car right?
but don't keys have a chance to spawn around cars/on zeds?
yeah
Is it possible to remove those?
vehicle:trySpawnKey() from the server
ah like removing the previous key if one was there
ye
here's the door error btw
java.lang.NullPointerException: Cannot invoke "zombie.vehicles.VehicleDoor.load(java.nio.ByteBuffer, int)" because the return value of "zombie.vehicles.VehiclePart.getDoor()" is null.
do you have more of the error stack?
Well we can know if a car has spawned a by using
vehicle:getKeySpawned() == true
So basically we get the current key number, we delete vehicle, we spawn a vehicle and set the key id to the previous one
ye
I think?
C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\lua\client\DebugUIs\ISSpawnVehicleUS.lua
yeah no we wont be able to
Would be great if the server could send admin command anonymously
without an actual admin on
local command = string.format("/addvehicle %s", tostring(self:getVehicle()))
SendCommandToServer(command)
else
addVehicle(tostring(self:getVehicle()))
end```
since server is pretty much admin itself
exactly
SendCommandToServer can only be sent from client (admin) to server
its different from SendClientCommand
also this is the java script that spawn a vehicle
BaseVehicle var8 = new BaseVehicle(IsoWorld.instance.CurrentCell);
var8.setScriptName(var1);
var8.setX((float)var4 - 1.0F);
var8.setY((float)var5 - 0.1F);
var8.setZ((float)var6 + 0.2F);
if (IsoChunk.doSpawnedVehiclesInInvalidPosition(var8)) {
var8.setSquare(var9);
var8.square.chunk.vehicles.add(var8);
var8.chunk = var8.square.chunk;
var8.addToWorld();
VehiclesDB2.instance.addVehicle(var8);
return "Vehicle spawned";
} else {
return "ERROR: I can not spawn the vehicle. Invalid position. Try to change position.";
}
hmm
we do not have access to add the vehicle to the vehicle db
otherwise we could do similar to this command on the server
ah
problem with SendCommandToServer is that its only available on GameClient
after looking at addToWorld() I got an idea
what if instead of scriptReloaded, we somehow unload and reload the vehicle?
let's see
addVehicle(String scriptName)
yeah
public static BaseVehicle addVehicle(java.lang.String string)
in globalObject
try it from the server side tho
lets check to delete a vehicle
vehicle:permanentlyRemove()
ah, thnx
you have to call those two
from the server
vehicle:removeFromWorld()
vehicle:permanentlyRemove()
alr, wish me luck
Hi everyone, first time here :3
Quick question, I did a revamp version of the Riverside map artwork (I plan to redo the rest too). I have a question about how to make mods in the near future so people can add these if they want them in their game. Should I ask that kind of info here?
local keyId = oldVehicle:getKeyId();
local x, y, z = oldVehicle:getX(), oldVehicle:getY(), oldVehicle:getZ();
oldVehicle:removeFromWorld();
oldVehicle:permanentlyRemove();
local vehicle = addVehicle(scriptName);
vehicle:setX(x);
vehicle:setY(y);
vehicle:setZ(z);
vehicle:setKeyId(keyId);
yeah on client it would probably not work
k
Sure and there is #mapping too for tile and map related stuff
gosh. I sure love it when my integrated server decides it wants to take 84 years to boot 🙂
You can also reload existing script without restarting
on the server?
yeah
how? LUL
loll
the F11 menu?
in your chat box type:
/reloadlua server/mymod/scriptToReload.lua
ah
"unexpected symbol near /"
try this in your server console
reloadlua server/MyModName/MyScript.lua
without the /
there is none
oh you using host button?
okay you can also setup a local dedi to test
eh
start much faster
just used the f11 menu
grab that software and i can help you out setting up
already got it downloaded. LUL
k?
create a shortcut of StartServer64.bat
drag it into your Zomboid folder
for quick access
you will have to delete the db
and stop using the host
cause host will change the admin user
so basically delete C:\Users\Konijima\Zomboid\db\servertest.db
you can use the host to set your settings
Oh well, it is not a map like... a playable map. It is a new image for the actual map haha. I want to remade all maps and if people like them gave the possibility to add these through a mod or something (sorry I don't know s*** about creation mods 😦 )
after deleting try to run the shortcut
oh cool
nice design 😄
and how would I add mods?
you can use the Host button to change your servertest config
ah
but just start the server using the shortcut
first try it will boot up and eventually ask twice for a new admin password
It's crashing due to a failed download
LOG : General , 1658625713849> 228,902,853> Workshop: DownloadPending GetItemState()=NeedsUpdate|DownloadPending ID=1510950729```
Assertion Failed: Illegal termination of worker thread 'CFileWriterThread'
have a look into C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\scripts\newitems.txt thats where default map are
mhm ok two sec
well go in host button, click delete player and delete world
delete that db file
make sure you have servertest config
you can edit the bat file to change the ram use me i use only 2g cause my shitty laptop -Xms2g -Xmx2g
ah
Also the vehicle isn't removing
when you crossline your text does it mean that it the statement is not valid anymore?
nah
xD
I use it for emphasis/offtopic
ah for me it kinda cancel it
server's still crashing
I'll just stick with the integrated
yeah i supose
ain't got time for that shite. Lol
-- Server Side
local function onClientCommand(module, command, player, args)
if module ~= "STR" then return; end
if command == "setVehicleScript" then
local vehicle = getVehicleById(args.vehicleId)
if vehicle then
local keyId = oldVehicle:getKeyId();
local x, y, z = oldVehicle:getX(), oldVehicle:getY(), oldVehicle:getZ();
oldVehicle:removeFromWorld();
oldVehicle:permanentlyRemove();
local avehicle = addVehicle(scriptName);
avehicle:setX(x);
avehicle:setY(y);
avehicle:setZ(z);
avehicle:setKeyId(keyId);
--vehicle:scriptReloaded();
print("Deez");
--sendServerCommand('STR', command, args);
end
end
end
Events.OnClientCommand.Add(onClientCommand);```
if vehicle:meetsRequirements() then
local args = { vehicle = GetVehicle:getId(), script = "Base.85crownvic_rosewoodpolice" }
sendClientCommand(player, 'STR', 'setVehicleChange', args)```
?
alr
did Deez print into the coop-console.txt?
yeah
i bet if you come back the car might be there
maybe something about transmitting that didnt work
this
I was sending the wrong command
trying it now
lol
also totally didn't just get a GTA:Online ad on Twitch.... Why are they still milking that game?!!?
coz R* $$$$$$$
But I guess that's only the stats of a map?
Well I guess I had to read a full guide about how to make a mod first haha
Find a mod that does what you want if it exist and check its structure
otherwise you also have default template in your zomboid directory
C:\Users\Konijima\Zomboid\mods\examplemod for quick testing locally
C:\Users\Konijima\Zomboid\Workshop\ModTemplate for workshop publishable
But still a guide would help you much better lol
If i get some time soon ill try to make my own guide for complete starter
That would be awesome 😄
figured out why. Let's see if this new system works
good news and bad news, @thin hornet
It removed the car, but didn't place a new one?
well thats a first
ah
its seem that addVehicle try to use the player to place the vehicle
var2.setX(IsoPlayer.getInstance().getX());
var2.setY(IsoPlayer.getInstance().getY());
which would mean its a client function
even tho it doesnt check for server or client
ah
could try addVehicleDebug
addVehicleDebug(String scriptName, IsoDirections direction, Integer skinIndex, IsoGridSquare square)
addVehicleDebug(scriptName, nil, nil, square)
and what would square be?
well all it does is set it to no rust, no damage
lol
but it doesnt check for debug mode
ah
local keyId = oldVehicle:getKeyId();
local x, y, z = oldVehicle:getX(), oldVehicle:getY(), oldVehicle:getZ();
local rust = oldVehicle:getRust();
oldVehicle:removeFromWorld();
oldVehicle:permanentlyRemove();
local square = getSquare(x, y, z);
local vehicle = addVehicleDebug(scriptName, nil, nil, square);
vehicle:setKeyId(keyId);
vehicle:setRust(rust);
-- probably need to set part condition here
vehicle:setGeneralPartCondition(1.3, 10.0)
errr
am backies
UNGA BUNGA! This works, buuut.... It's a bit slow on the draw, and the car's direction isn't retained. But, it works?
neat
oh, and the key's not transferring ownership
What is the API or library to use for PZ ?
hmmmm
I'm trying to upload a mod and it keeps saying "Your mod is missing a mod.info file" while the file is right there
Nevermind, I got it
for the recipe mod is there way to get more than one item for result? and is there place I can look at for ongivexp for all skills list
Sure take a look at lua/server/recipecodes.lua
For giving multiple result item you would use a OnCreate function
thank you ill have a look at it
anybody know how to copy the abilities of one thing like a fridge to another buildable piece of furniture from the same build menu? such as lets say a refrigerated cellar
Anyone know how hard it'd be to make a mod that makes food respond to the ambient temperature?
So you can store it outside during winter like in the long dark
i feel like thats a good basegame suggestion, you may want to consider making a forum post about that, outdoors temperature affect on food, for possible preservation of fish you catch in winter or something
Alright I'll might try suggesting it here
Is there someone who would make a Hairbow mod I'd love to have one in some RP stuff?
When working with UI, should self:drawRectBorder work automatically? In my case, it seems to do nothing. Comparing vanilla code.
Example I'm using: self:drawRectBorder(10, 10, xOffset, yOffset, 1.0, 1.0, 1.0, 1.0) for an ISCollapsableWindow:derive object
Can sandbox presets be shared with mods? (I havent seen it happen, so don't even know if possible)
how do i make recipes that does not require anything to craft?
I have a few info-type items i want the player to be able to make, but with no cost.
the closest i have is this:
{
keep [Recipe.GetItemTypes.RipClothing_Cotton]/[Recipe.GetItemTypes.RipSheets],
Result:AGCMFrayBerries,
Sound:Hammering,
Time:10.0,
Category:AGCM 1,
}```That is as close to a free recipe as i can get.
just wondering if there is a more direct way?
try keyring?
If you wanted something more seamless you could drop a nameless object in player's inventories to act as a catalyst
this is actually a pretty great idea!
How about just making custom context menu?
Conjuring >
Fray Berries
You would add a tag to all item that can be conjured or what ever you do.
Then you would find all script item that has the tag and add them to a sub-context of Conjuring option.
Then you would add a custom TimedAction that is triggered by the selected option and pass in the selected item type to the timed action and add it on perform.
That could give you more freedom if skills or special condition are required to be met, even tho recipe have most of this
Wouldn't that add more context menu options everywhere?
could restrain it with more conditions
but i dont know what is the end goal so im just suggesting
I know I just really dislike the right-click-context menus lol
he could add it to the Q radial menu
what is conjuring, isnt it like calling for spirits and demon?
and isnt Fray Berry a person?
I don't know if he wants to imply magic - but conjuring just means out of thin air
if it is just information, it might make more sense to just create a menu for it that opens with a keypress
Poltergeist
Based on his other mods/ideas I think he just wants a free way to get food
Make it cost mana
using a recipe to give you information, while it works, is kind of obscure. and if you use a UI popup, you can do stuff like having tabs for different info and stuff, rather than having to try to organize the info with different recipes
Then a mix of it all
- A conjuring book
- A custom context menu on the item to open a UI
- A UI with all the conjuring info
- Potentially a radial menu if the book is inventory
Or something like old school cheat codes.
Left, Right, Left, Right, Up, Down, X, Y
or something like a demonic spell written into the chat that triggers the conjuring at the cost of health point 👹
why not find all the dragon balls and make a wish
I actually always liked the medieval fantasy world set in a far off modern apoc
could be an interesting overhaul for PZ
Yes, conjuring is to call forth from nothing. or spawning or what ever... I just wanted the recipe to have a "title" of sorts 😛
No need ot think to deeply about what i call the recipe.
Fray Berry is berries that are VERY fatty. Custom food item.
Made them for the heck of it
My mod is called "AGCM" (Another Generic Cheat Mod) 😛
surprisingly, despite this mod, i personally find the game quite hard regardless 😛
am awake
welcome back to the land of the aware
heh
well anyways, Konijima, that thing we got "working" last night? It's not saving the vehicle's direction?
You can specify the direction as the second param of the addDebugVehicle function
alright. Noted
but it seems there's no getVehicleDirection() though?
aaaaand I'm dummz
getDir()
getAngleX, getAngleY, getAngleZ, setAngles(float x, float y, float z)
if getdir isn't working, I'm not positive but I think you can't send objects over commands
ah
newVehicle:setDir(oldVehicle:getDir());
in his case it would just be
local oldDir = oldVehicle:getDir();
local newVehicle = addDebugVehicle("", oldDir, nil, square)
Just define olddir before you remove it? hehe
yeah thats not the whole code
hes grabbing the info from the old car then he removes it and add a new one and assign the old prop to it
somehow act as a way of replacing a vehicle by an other. since setScriptName() and scriptReloaded() didnt seem to work
im going to birthday party all day, have a good one yall