#mod_development
1 messages Β· Page 541 of 1
In the beta
I'm on 41.71
It takes a long time for the game to start
:/
Okay the game is starting. I will see if in 41.71 it undoes what 41.70 did without the notes saying so, which I doubt
Also can you post a screenshot of what you see?
Okay it took a long time for the game to start but I took some screenshots.
Hey are you still there?
:|
does anyone know a way to save and load custom mod data in case the player leaves and rejoins the game? I've made a mod that adds items which have custom effects that last anywhere between 60 to 1500 seconds and I need those effects to stay in case the player leaves and rejoins.
ah I think I found out playerObject:getModData()
I love you 3000
Hey Olipro come on what happened? We were talking examples. :/
i have a 3d model of shoes + textures for them that i want to put in the game, but i tried it already and sucked really bad at it. can i pay someone to get them functional in game, spawning, rarities, and able to be uploaded on steam workshop?
The hardest part would be attaching the model to the player model bone structure so that it stays on your feet when you move around. As for all the script related stuff just look at other similar clothing mods and copy them with your adjusted values.
You can even just look at the vanilla shoes for an example
The model looks really good btw. Reminds me of Denji from Chainsaw man.
I'm tweaking Even Worse Looting so that empty containers don't get locked. The event triggers on Events.OnFillContainer.Add and I've added in if shouldLock and isEmpty then shouldLock = nil end
But now nothing is being locked as far as I can tell
Do containers start empty immediately? Is there something else I can check?
I take that back, containers are spawning locked, but there are still locked and empty ones
Nevermind, if shouldLock and container:isEmpty() then works apparently
welp. I've gotten the network code to work-ish, but now I'm getting an error...
java.lang.NullPointerException: Cannot invoke "java.util.ArrayList.get(int)" because "zombie.vehicles.VehiclePart.getScriptPart().models" is null.
how on earth do I check for this, and fix it when it occurs?
Hey i have had a dumb problem for a hot minute, so i figured this is the best place to ask
i'm trying to log a steamID when a player is created and I can't for the life of me get any events to work related to creation of a survivor
if you have any clue as to why this may be please reach out to me thanks
sorry I changed how I did things this is no longer an issue π
Is anybody here familiar with the Survivors 2-in-1 mod?
If so, how do you add unique survivors?
ive already got someone working on it, but thank you!
np
huh
ima replace my gun with a donut
how do you make custom animations?
in project zomboid
Hi everyone! I need a little help with translation, I have this code on scripts/ mymodname.txt
recipe Comida_ligera_por_Dinero /*Name of the recipe*/
{
destroy Money=3,
keep FoodTrader,
Result: Base.CannedSardines,
CanBeDoneFromFloor:true,
Category:Money,
Time:5,
OnTest:Change_All_For_Money_OnTest,
}```
and on shared/translate/EN, I have this code on the "Recipes_EN.txt"
```prolog
Recipes_EN = {
Recipe_Comida_ligera_por_Dinero = "Light Food for Money(3)"
}```
When I play the game, it doesn't translate, does some one know what am I doing wrong? Do I need to store the variable or call it differently? Sorry I'm pretty new at coding/moding
change
recipe Comida_ligera_por_Dinero
to
recipe Comida ligera por Dinero
Damn, I'm somewhat stupid haha thanks! Will let you know if it works π
Erase that, I'm just learning π
np
It worked!! You are a genius! Thanks a lot!
I also seem to workaround the problem using:
DisplayName_Comida_Ligera_por_Dinero = "Light Food for Money(3)" But I guess the way you taught me is way better/easier π
Thanks!
Bad practice
I thought so, I kinda felt that wasn't quite right haha
damn
lua is weird
the hell
oh my
for clarification: This happens whenever I use setScriptName, then scriptReloaded on a server.
what are .pack files and how do I make them
If I had time I would update it, is it currently broken?
DMing me is a better way to reach my btw, I donβt check here often
Pack files contain the sprites used by the game. You can view/create pack files via the map editor TileZed. Check the pins in the mapping channel
EDIT: #mapping message
Does it have everything from build 41?
The vanilla pack files are located within media\texturepacks and always contain the latest sprites
If you download and install the editors, you can view the pack files
okay, thank you, I had tilezed and worlded installed but didn't know about the pack viewer lol
Unless you have custom tiles, you dont need to create any pack files
I'm on the search for the gnome tile so I can create more gnomes, so far it's been an hour long hassle solely looking for the gnome 
Thank you though, now that I can find it I can truly reach best modder status
in that same link I provided, it provides a download to the latest tilesheets for the editors (these are PNG files) where you can find the gnome on this sheet:
it's been in vegetation this entire time 
thank you even more lol
yeah, i mainly do mapping so the sheet names are almost burnt into my memory
I think I've had an outdated tile pool this entire time lol, rip
One more question because I'm dumb and for some reason can't figure this out, that discord link sends me to this, https://theindiestone.com/forums/index.php?/topic/21951-the-one-stop-tilezed-mapping-shop/, where do I get the tile sheets from here
1Here you will find a (hopefully) comprehensive guide to map modding using TileZed, from scratch, to uploading to Steam Workshop. Step 1) Installation and setup Spoiler - Download the latest version of TileZed here 3 Step 2) Creating a new map - Creating A Master Image Spoiler The first thing you...
I went to "Step 1) Installation and setup", then "LATEST TILEZED AND WORLDED (DECEMBER 21 2021)", and then " Tileset images" which is where the outdated tiles are, but couldn't find them on the actual original site
Give me a sec, iirc its a bit convoluted with the links. I'll track down the latest tilesheet link.
ok, its the 2nd pinned msg in mapping!
#mapping message
Alright, thanks a lot once again lol, I've been using year old tiles for 6 months 
I believe there was but I dunno what it was lol
I think you'd be better off adding a context menu option
Whoa whoβs the modder who creating this awesome mod?????? Please pm me π π
is it impossible to save player mod data inside the OnSave/OnPostSave event? It works outside of it but the stuff I want to save runs every tick and I'd rather save once when necessary for performance reasons like when the player quits.
modData is already saved
I mean if I define/change it in there, it's not saved
?
local function OnSave()
local player = getSpecificPlayer(0)
local playerModData = player:getModData()
playerModData.test = "test"
end
Events.OnSave.Add(OnSave)
this doesn't work player:getModData().test won't be there when I load
do it during playing
type in the console do local playerModData = getPlayer():getModData(); playerModData.test = "test" end
yeah that works, I was just hoping if it was possible to do it inside the OnSave event or when the player quits since if I don't, I'd have to save it each tick because what I want to save is a timer and it's going to change each tick and I'm worried of the performance implications of that. And I wouldn't know when the player would quit which is why I'd have to save it each time it changes.
but its not saving each tick
modData is a table in memory
it gets saved when the game saves
anyway using the on tick event isnt a good idea
if you want to tick that often every minute is fast enough
well in my case it's stuff like:
"Player loses 0.5 hp every 1 second for 30 seconds" or
"Player gains 0.025 endurance every 1 second for 60 seconds" etc
I want it to be smooth instead of an instant increase in value, not sure if there's a better way to do that
the stuff that runs each tick is the timer for those
every minute is every ingame minute you underestimate how fast it is
I tested OnSave and it did not seem to run when I exited to the main menu.
you sure? if I print something I see it in the console.txt afterwards
I tested it months ago and I was sure that it did not print things to me when the game exited to the main menu.
there's getFileWriter and getFileReader in the exposed Lua GlobalObject, I'll try that
why
y tho
Why do you need to switch instead of staying on modData? I guess I don't understand why you can't be updating the state of modData while you're ticking, which would include removing the previously added effects
I've made a custom timer class that I can specify how often it emits an event that any object can connect to with any callback it wants and it's widely used for my mod so it felt a bit too much code to write for every object that wanted something to run in a timer.
like then I would have to manually write player:getModData().timeLeft = player:getModData().timeLeft - deltaTime
and all the rest of the logic for every timer for every object that wanted a timer.
since right now it's a timer about the player I want to save I'd do player:getModData().timeLeft = timer.timeLeft which is fine and I'd manually create a new timer class based on that data when the game loads I was just curious if it was possible to not write the above line of code in an OnTick event and instead do it in an OnSave event since that's when it's needed.
@drifting stump @undone crag because if I can save a file in the OnSave event and then load it, I wouldn't have to access modData each tick/minute. It would save having to do garbage collection more often
Oh. Can you explain main concept of your mod and why you need timers? (If it not secret)
it think you still dont understand what modData really is
having a local variable = {} and assigning something to that table is the same as assigning to modData
they are both a table in memory
TextureCombiner is not exposed to Lua DDD:
sure, I guess easiest way to explain is that I want to add these items
https://escapefromtarkov.fandom.com/wiki/Medical
in Project Zomboid. Mainly the "List of Stimulators" section, so different effects that last for some amount of time and then effects that happen after a certain delay.
I don't want the effects to be instantaneous
I get that, I'm just trying to avoid having to access both the modData table and the timer data table again. and I can't just access the modData table because of the reasoning I gave above unless I am missing something
I was thinking of using three base textures - red, green and blue - and using TextureCombiner to combine the item's model's texture with primary colours, and making a new model entry with getScriptManager():ParseScript, to make people able to paint their items using paint they find in the game, but this all broke at one point in the chain - the ability to combine textures T_T
also I want the effects to be smooth which is why I'm using OnTick for the timers and not EveryMinute etc, also it's in my understanding that EveryMinute would scale with the sandbox day settings which is not something I want.
As idea:
isRegenTimerOn = false
function OnEat(food)
if food == "regenStimulator" then
player:getModData().regenStimulantTimer = 600
if not isRegenTimerOn then
Events.OnTick.Add(RegenStimulantTimer)
isRegenTimerOn = true
end
end
end
function RegenStimulantTimer()
local modData = getPlayer():getModData()
if modData.regenStimulantTimer > 400 and modData.regenStimulantTimer < 600 then
doBuff(getPlayer())
elseif modData.regenStimulantTimer > 100 and modData.regenStimulantTimer < 200 then
doDebuff(getPlayer())
end
if modData.regenStimulantTimer > 0 then
modData.regenStimulantTimer = modData.regenStimulantTimer - 1
else
isRegenTimerOn = false
Events.OnTick.Remove(RegenStimulantTimer)
end
end
But this may not work after save load
Need add check onLoad if some timers is on
Interesting idea. I will think about it, maybe will transfer idea to other devs π
ah thanks, this gave me an idea. Since I want this timer ticking to be a bit more decoupled from the effects of the stimulant when I create a new timer I could pass in an optional table where it should store the timer data(eg. the modData of the player)
so example:
local timer = Timer:new(5.0, player:getModData())
and it would save the timer data in there
and the way I made it is so I can connect any function to that timer then
example:
timer:connect("tick", function() doBuff(getPlayer()) end)
@cunning canyon yeah, check the discussions on your workshop item, I posted a workaround and a code cleanup, since the copypaste of all those game functions is unnecessary
super dumb lua question, but i dont know how to word it for google... Do I need to define my functions in the order that they are ran similar to c++? or can i call a function that is defined later in the lua file?
as long as they are declared before calling them then it's fine, and you can define them later.
example
local foo, bar
function foo()
bar()
end
function bar()
end
foo()
but this won't work
local function foo()
bar()
end
local function bar()
end
read more here: https://stackoverflow.com/questions/41070456/is-there-a-way-to-put-local-functions-in-any-order-in-lua
https://stackoverflow.com/questions/65849897/in-lua-is-there-forward-declaration
@pliant sphinx
understood, its the same way in c++. thank you!
- note the above only applies to functions declared
local, globals are uneffected
I made it work and it saves and loads correctly, thanks!
Functions are first-class in lua so they are basically just variables that happen to be a function
hey guys, what does getModData() do exactly? Can't find any documentation on it, is it a global method or something, could someone clear my mind here please?
It's a Java function
I guess I'll pop open intellij and figure it out, I'm feeling charitable/curious
well okay but what it gives back? a table?
yeah, it just returns a KahluaTable
looks like it's a way to store data persistently
and no, it's not global
have you found it in intellij, where is the definition of this function?
it's defined for: InventoryItem, GameTime, GlobalObject, GlobalObjectSystem, IsoGridSquare, IsoMetaGrid, IsoObject, IsoThumpable, ClimateManager and VehiclePart
note that it could very well be subclasses, I just did a search for all declarations
Huh, shame it's not defined for rooms and buildings, albeit you could just use an arbitrary square.
Also exist global ModData
you mean the global function getServerModData ?
No, I mean class ModData
local tab = ModData.getOrCreate("SomeDatabaseTable")
ah I see, the Java class is exposed to lua
only issue there? There's like 2 rail lines across the map. Trains would be awesome, yes. But they'd literally be useless
ModData pretty useful for client-server database or just client database
@tame mulch while I have you here - is there anything built into the game that lets you profile execution times of registered lua events (rather than just the option that makes it log when something takes "too long")
π
expand the rail roads?
if you can go to the effort of making working trains, you can go to the effort of modifying the map to have more train lines π
iirc, the devs fear the magical thing called "work". Jkjk, I love the PZ devs π
anyways uhhhh. Aiteron
remember when you told me to use sendClientCommand?
I got that working, but I'm getting an odd bug
java.lang.NullPointerException: Cannot invoke "java.util.ArrayList.get(int)" because "zombie.vehicles.VehiclePart.getScriptPart().models" is null.
I don't sure. I think no
occurs when I use scriptReloaded() to update the vehicle for clients?
I am not worked with profiling
ah well, I guess I can just patch Event.trigger()
What exactly you want to add?
an option so that it's not just hardcoded to 250
It's on serverside?
and I HATE to be the guy yacking in the middle of a convo, but it sometimes does a similar error in regard to doors
yep
you can frequently end up with lag that's "death by a thousand cuts" - no single event takes too long, but cumulatively it is
@fiery pecan does it not also give you a stack trace for the NPE?
dang
Maybe need send command to clients, and on clients sides reload script?
perhaps. Great... More work...
oh wait, you're causing the NPE from Lua?
yeah
got a link to the code?
can I dm the files?
It's not hard) I did big client server architecture on sendClientCommand and ModData.transmit and all works fine)
sure
k
@cunning canyon actually, let me save you the time: https://steamcommunity.com/workshop/filedetails/discussion/2398274461/4827307257599995452/
hey guys, is there a way to call original method that was overwritten?
generally, no
that is, assuming you're talking about something overwritten by someone else and you have no control over it
if you can execute some code before they do, then sure
omg then this code is a mess
sounds like you might have an X Y problem - why do you need to access the original method?
not me, I'm fixing a mod
OK, what's the problem, can you pastebin the relevant code?
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.
alrighty, and what's broken?
it just loops
"it"?
I guess TCMusic.oldISRadioWindow_activate = ISRadioWindow.activate is responsible for execution of the original method?
yeah
well for some reason when TCMusic.oldISRadioWindow_activate( _player, _item, bol ); executes it just goes again to the start of this method
welp, then it sounds like it's getting assigned twice
personally, I prefer to use a local
local oldActivate = ISRadioWindow.activate
then just swap out all the calls to TCMusic.oldISRadioWindow_activate for oldActivate
that'll at least guarantee it can't be double assigned
thing is, are there any other locations in the code that use TCMusic.oldISRadioWindow_activate ?
(I'd hope not, but who knows)
only this place
strange though, how did it work on earlier versions then? Or it never worked?
well, in the snippet you pasted, there's nothing in there that would make it call itself infinitely
but at least if you reduce it to a local, you'll rule out anything else interfering
Would anyone know the Use delta of 6 uses? as 6 uses would be 1.666 reoccurring
well, it would be 0.1666...
Yeah, but surely that would leave just enough for 7?
welcome to the world of floating point numbers
I thought as much
just tried it, same thing happening, any advice where to dig?
if you really must limit it to 6, you'll have to write some code that checks the total amount remaining
Nah I guess ill just settle with 7 or 8
although actually, doesn't the game refuse to let you use it if the use delta is > total amount anyway?
Yeah but then surely you would be left with a unusable trash item
Although that doesn't sound so bad
@heavy turret I'd use debugstacktrace() to print out the call chain
I think you have to run the game with -debug to utilise that function
I did make a model for it anyway.. so I dont see the issue in an unusable trash item
hmm
I shall consider my options
If you don't define the MagazineType parameter for a weapon does it assume it has an internal magazine?
it would appear so, yes
Cool, thanks.
can parameters be an issue? maybe I need to define the original ISRadioWindow somewhere?
@heavy turret can you link/upload the full mod?
if you place it on the ground then yes
in some patch they changed placeable radios to deviceObject or something
im on 41.68
the first thing I see is that ISRadioWindow.activate doesn't take 3 arguments, just two: _player and _deviceObject
but that shouldn't matter, it'll just be ignored
Indeed, probably was used before
OK, so lemme reproduce the issue
I need to give myself a boombox item and then do what?
just stick it on the ground and try to use it?
Is there an easy way to make a player say something or add Halotextnote to them, from server
have you tried dropping object and not placing? @heavy turret
well that is a workaround, but I wanted to fix this
oh wait, if dropping I think you get the same issue
as I recal if you drop it it should become a 3d object as if you would place it
they're not the same though
3d object is an item whereas proper placement is a Moveable
i noticed that if you play it before you place it it activates a 3rd Device Options that actually works haha
@heavy turret yeah, I got the same error, but it's not looping
So maybe need to change tile properties?
so if you open a vanilla radio the same way the radio will work?
it's broken because _item:getSprite() returns nil
if you equip it and then access the device options, one of the options after you place it works as intended
yup
could you try placing a vanilla radio on ground and click device options? will vanilla ui pop up?
I guess it should crash as well if you don't fix the getSprite issue as you can not get past if statement
If you plan to fix True music, I can help. Anyway It's me changed how works radio in patch .71
that would be great if I can get some help
it indexes a table of pre-defined names to figure out if it's a boombox
but why is it doing that off the sprite
can't it just use getName() direct from the IsoObject?
idk, took me a lot of time to just understand this code, I think earlier _item was passed to Isradiowindow.activate and the mod worked
what happens if you put TCMusic.oldISRadioWindow_activate after it checks for "IsoWaveSignal", will it loop back to the start?
if sprite and TCMusic.WorldMusicPlayer[_item:getSprite():getName()] then```
I changed it to that and it no longer crashes
now I just need to find a clean way for it to figure out that it's a boombox and it should be fine
Check world items in square?
well, we already have the _deviceObject
surely we can pull some unique attribute off of it
if getSprite() returns nil why do you need it?
do you understand what the code is doing?
I'm not sure anymore lol
TCMusic.WorldMusicPlayer is a table with key(s) used to figure out if we have a boombox
for whatever reason, he decided to call getSprite():getName() which evidently used to work
and at some point, they made the game not assign a sprite to it, probably because it's a 3D object and therefore pointless
I'm going to see what getName() returns and if it's a reasonable string, use that
welp, that's also nil
I understand that part, but why are you putting sprite in the if statement?
the if needs to be changed completely I think
you can do _item:getDeviceData():getDeviceName();
you forgot I sent a pastbein earlier?
well, that isn't localised is it?
localised means it's stored in memory?
no, I mean depends on what language your game is set to
You fixed it? Need more help?
oh, the languages...
ya
is there a way to check it without switching languages?
doesn't appear to be localised
this feels a bit shitty, I think we should probably put a proper attribute on the item script
but for now, I'll live with this hack till it's verified fully working and then clean it up
bingo, it works
Everything works with boombox? π
Yep
cool, this'll be much cleaner
is the key just called ModData?
nah, can't be, no definitions
For add custom param to item script, just write any non keyword param (Like: "customItemName = boombox,")
Then you will can get it by item:getModData().customItemName
But it works for inventory items
ah ok, so I can just define arbitrary key/value pairs in the item.txt
should have remembered that myself, I used it for making containers interchange gasoline/water
guys I went with my dog and you already fixed everything?
try inserting a tape, there is the same getsprite getname issue
no, I lied, it just doesn't error now, I don't think the cassette GUI is rendering properly
F
we also need a workaround how to interact with vanilla radios, if we can execute vanilla isradiowindow.activate that should work
so, getModData() just returns a table with RadioItemID -> 350546709
and absolutely nothing else in it
I guess I need to get the underlying item
Can you send me item script?
sure, but I think this is because the WaveSignalDevice when placed in the world is different from the inventory item
Yep
I think we can just check square for items, find item with RadioItemID and put this item to func
so, the current code works by overriding ISRadioWindow.activate
we already have the _deviceObject as second param
just need a "nice" way of identifying it
We need inventory item?
right, _deviceObject is an instance of IsoWaveSignal
Here how it works in PZ - to IsoWaveSignal object saved id of Inventory item, that placed on the same square
brilliant, that'll do nicely
@tame mulch actually, isn't that a bit inefficient? I can obtain the IsoRadio by directly calling _deviceObject:getDeviceData():getParent()
But we need not IsoRadio. We need Inventory Item
ah, I see, so it's not quite the same when you obtain it this way
@tame mulch yeah, that doesn't do anything useful, the _deviceObject argument I have is identical to the object I obtain from iterating over getObjects() and finding it
Try to find InventoryItem
if instanceof(obj, "WorldInventoryItem") then obj:getItem():getId() == radioID
just to see what happens, I printed out all moddata for everything on the square
there are 3 items total, 2 have nothing, one is the same IsoRadio and still only has RadioItemID
worth a punt, let's see
nah, that just returns the same IsoRadio that I already have from the function param, too
on the other hand, the array has only one element
Found it:
local wobs = sq:getWorldObjects();
for i = 0, wobs:size()-1 do
local o = wobs:get(i);
if instanceof(o, "IsoWorldInventoryObject") then
if o:getItem():getID() == _item:getModData().RadioItemID then
result = o:getItem()
end
break;
end
end
Hello guys,i have a quick inquiry
i want to change the vehicle data of a certain vehicle mod,the skateboard mod
I have found most of the things i want to do myself,but i want to make sure i understand some variables correctly
Specifically,how are engineforce,enginequality and maxspeed put into the equation of how the game works
maxspeed is 2.0f,what does this mean for example?
How is engineforce used and what exactly is rollInfluence?
Thank you for your time
Oh, maybe better ask developer of this mod)
aren't these variables globally implemented?
This is specific mod, I don't know how it works (as vehicle?). But maybe someone will can help
i checked a video and i have found that all vehicles use variables such as "Engineforce","maxspeed" and "Enginequality"
I don't know about rollInfluence,that might be custom
So rollInfluence aside,how are Engineforce and maxspeed calculated into the vehicle
If i want to set a maxspeed of 100km/hour for example,what value would i need to set maxspeed to?
@heavy turret alright, the UI shows up correctly finally
and it's working in a "nice" way by obtaining the moddata
however, I can't insert a cassette, don't get any errors, it just won't accept it
guess I'll have to poke through ISTCBoomboxWindow, unless someone knows something I don't
Yep, same issue π I hope not need rewrite full mod :/ I tried do this, but too much work
must be an issue with isValidAddMedia()
I got errors when trying to insert the cassette
musicPlayer = TCMusic.WorldMusicPlayer[self.device:getSprite():getName()]``` it should be this one
I don't remember as I was stuck with the first error
did you spawn in the cassette?
yes
hm, it just shows in red and won't take the cassette
screw it, I'll just shove a print in the function and see if it's even executing
can you pastbein the tickcheckmusic file?
I do agree with you - I would expect this to also shit itself and crash
or just pop a file here if server accepts it
it's only a few lines, one sec
local square = _item:getSquare()
local objects = square:getWorldObjects()
local playsMusic = false
for i = 0, objects:size() - 1 do
local obj = objects:get(i)
if instanceof(obj, 'IsoWorldInventoryObject') and obj:getItem():getID() == _item:getModData().RadioItemID then
playsMusic = obj:getItem():getModData().PlaysMusic
break
end
end
if playsMusic then
ISTCBoomboxWindow.activate( _player, _item )```
you need to add PlaysMusic = TRUE to both the items in their script files
(i.e. the boombox and vinyl player)
@heavy turret did you make any changes to TCMusic.searchBoombox ?
I did not
so, ISTCBoomboxAction:isValidAddMedia() doesn't even execute for me :\
I did to state when it works from loot menu device options. Need only fix for 3d objects
so the code is like this? elseif instanceof(_item, "IsoWaveSignal") then local square = _item:getSquare() local objects = square:getWorldObjects() local playsMusic = false for i = 0, objects:size() - 1 do local obj = objects:get(i) if instanceof(obj, 'IsoWorldInventoryObject') and obj:getItem():getID() == _item:getModData().RadioItemID then playsMusic = obj:getItem():getModData().PlaysMusic break end end if playsMusic then ISTCBoomboxWindow.activate( _player, _item ) else TCMusic.oldISRadioWindow_activate( _player, _item, bol ); end
yep
did you test with vanilla radios?
you mean do vanilla radios still behave as vanilla radios?
yea
yes
and script file -> ```model TCVinyl_Ground
{
mesh = WorldItems/TCVinyl,
texture = WorldItems/TCVinyl_BaseColor,
scale = 0.015,
PlaysMusic = TRUE,
}
model TCBoombox_Ground
{
mesh = WorldItems/TCBoombox,
texture = WorldItems/TCBoombox_BaseColor,
scale = 0.0015,
PlaysMusic = TRUE,
}```
π’
TCTrueMusic.txt
oh right, missed it
ok, cool, I got it to error out when inserting the cassette
had to pick it up and place it again, weird, anyway, progress
I just started the game, F
what is happening, why is it not looping anymore and if TCMusic.oldISRadioWindow_activate it goes to the original function, maybe the game bugged out for me and I needed to restart?
and I either pasted the code in the wrong place or it doesn't work for me, the PlayMusic is NOT TRUE for me when clicking on the boombox
and when clicking boombox it just opens the vanilla ui for radio
yeah, I'll just get it working and send the code over
I think we're very close to getting this working
damn, a savior for 200k people if we can get the fix in the workshop, don't know if we can without author permission
ah shite, yeah, there is that
well, we can just upload it as a new item that depends on TrueMusic
it'll be a bit of a pain in the arse because we'll need additional code to inject the ModData values
unless someone knows of a way to override an item directly from scripts?
oh wait, I think we can do that
You can upload fix with dependency of original mod. You can override functions or files of original mod. And iBrRus said that he publish fix for TrueMusic when next patch released to stable
weird, this can be fixed in a way that it works on both new and old :\
Not exactly. Radio in 68 build bugged. I fixed it in new patches
what was bugged?
Not correct saved IsoRadio
ah
speaking of bugged, vehicle radios have no DeviceData so you can't listen to radio stations on them now
It will be fixed soon I think
I did an ugly hack on the Java code to get the text printed to the chat box
namely: inst.getDevices().stream() .map(WaveSignalDevice::getDeviceData) .filter(DeviceData::isVehicleDevice) .filter(DeviceData::getIsTurnedOn) .filter(data -> data.getChannel() == var4) .map(DeviceData::getParent) .forEach(dev -> distInternalInvoke(inst, dev, var1, var2, var3, var5, var6, var7, var8, var9, var10, var11));
Oh!
ur the mvp mate
@tame mulch feeling charitable enough to tell me what I need to do to add moddata to an item from my own mod?
I know how to do it with Lua code but that's a bit hacky if there's a pure script-only way to do it
Sure! Example
item TestItem
{
...,
myCustomParam = 69420,
}
print(item:getModData().myCustomParam) -- => 69420
@tame mulch I mean say someone already created item SomeItem{ ... } - I want to then add my own values to that
do I just redeclare the item?
Oh, do like in ItemTweaker:
(one sec, I will find example)
if you want to edit an already existing item do
getScriptManager():getItem("Module.SomeItem"):DoParam("")
@heavy turret here, give this a shot
there are also setters for a lot of things
local item = ScriptManager.instance:getItem("Base.TowBar")
item:DoParam("myParam = 69420")
or by setters for default params
yeah, that's how I've done it before
I thought there was a pure script file way
alright, good enough
@tame mulch are items guaranteed to be loaded before your Lua executes or do I need to put it in an event?
Better add to event:
Events.OnGameBoot.Add
is there a way to temporarily increase player fitness/strength? also is there a way to alter perception radius?
what's the function to do that?
just make sure you don't bugger up their XP π
yeah I'll keep it in mind
I don't know, but if I wanted to, I'd go and look at the code for the debug window that lets you cheat your stats
true
what does "strength" actually do? maybe it would be better to alter what it does instead if possible because I was kinda hoping if the player is lvl 10 I could get them to like a temporary lvl 11
are there any mods that add a search bar for inventories?
@heavy turret right, all done, uploaded it as its own workshop mod: https://steamcommunity.com/sharedfiles/filedetails/?edit=true&id=2809787779
Is it okay to save stuff about the player in the moddata for the player in the server?
I mean in the multiplayer
Depends what data and how you will use it
I want to save a new player max levels and skill points
So basically a map
and client will need to access it
Can I reliably just save data straight to player moddata and will it work on relog?
Or should I make my own database using the server and save into the lua folder
Relog I think yes. After death - no
That's perfect
Thanks
I want to have player unlock levels from gameplay and then redistribute them manually
@tame mulch was there any technical reason why predicatePetrol requires a container to have a full unit of gasoline in it in order to be allowed to fill up a generator?
you are a legend man, thank you
I think this is not full unit, this is at least 1 use of gas container
I think better load it to pastebin and attach link in comment to mod page
Aiteron! Thanks, I would post to the mod page but comments are disabled there.
@late hound Maybe this'll work? lol
@tame mulch well, the thing is, I made a mod that lets you use the various water containers as gas containers and that check prevents a water bottle being used, because its total volume is less than a single unit
Just realized this is in the improper channel.
Hmmm. I think with water different use delta system. You used new tag system?
it does now, previously I hacked it by setting up metatables that wrapped the real function calls into java
I say previously, I still do that for a lot of stuff
but since you added the tags for the generator, that looked like a nice quick fix
and far less convoluted that using metatable magic
Did similar things when I was modder π
What exactly you don't like?
from a functionality standpoint? not all that much - from a performance standpoint? LuaJ can compile scripts to Java bytecode rather than just interpreting them
you can also create multiple separate lua states and execute each on its own thread - I don't think Kahlua can do that
Can anyone help me with this??
@tame mulch so it turns out that calling BaseVehicle.scriptReloaded on a server absolutely buggers it right now because the PZBullet native library isn't loaded - ends up with java.lang.UnsatisfiedLinkError: zombie/core/physics/Bullet.removeVehicle(I)V
looks like the server init function should also call Bullet.init()
But why we need scriptReloaded on servers?
that's a question for @fiery pecan
he's using it to replace vehicle textures on the fly it seems
well, you see. It seems to be the only way for vehicles to update changes to clients in a server environment
What changes you want to update?
changes to the vehicle itself
like...
my mod takes a 85vicsheriff, from Filibuster's mod, and makes it a 85vic_STR_Rosewood, for example
Oh, complete change script on another. Hmmm
yeah
it works, but it doesn't update the changes
as in, I have to TP away and come back
for the script change to appear without ScriptReloaded
It works only on 1 client or don't work anywhere?
it's not a particularly healthy thing because the thread constantly throws exceptions after the failed setScriptReloaded call
it won't appear for anyone without script-reloaded
I can check later this things, if it need. I added changing skins and colors for vehicles for MP in last patches. Maybe this thing and vehicle rotation will be next (if I will have time)
if someone really needs to fix this right now, you could write a small wrapper around zombie.network.GameServer.main() that calls Bullet.init() and then invokes the original main
sounds good Aiteron. Thanks for even considering it π
@old zealot this is an excerpt from a vehicles script file from build 40; in the comments are explanations for some of the parameters used in the vehicle scripts.
Is there documentation on how each weapon parameter works? eg; I'm guessing HitChance is out of 100? Does AimingPerkHitChanceModifier increase hit chance by that value per aiming skill or that amount at 10 Aiming? etc
AimingPerk modifiers are by individual level.
I'm not sure is there is a comprehensive, up to date explanation of weapon parameters? I could definitely benefit from one of those myself.
Thanks. If you do happen to learn of one I'd be very interested
I will check it out,it will help me a lot.thanks!
I know almost nothing about the variables and functions in PZ but maybe add a check to see if a player is holding containers such as garbage bags and check there
Before that one,add a check to see if a player has a backpack equipped.if so,check there
@outer pawn um, is it ignoring the backpack, or just removing the first item it finds?
or do you intentionally want to just remove only one item
Is everything that is on the player inside "Inventory"??
yes
yes
Hmm alright then
hence the "recurse" part of the functions
There should be a way for that function to record from which place it removed the item
yeah, I think it's because you're calling Remove() from the wrong place
once you have the item (also, you should be checking that it actually returned a valid item) you can call getItemContainer() to get its container
then call remove from that
Is this a good channel for general questions about published mods?
Iβm trying to find a mod to replace a couple features from Britaβs guns. Specifically the suppressors.
Iβm not a fan of just how many different guns Britas adds to the game, along with the deluge of ammo types. But I really like the different suppressors, especially shotgun suppressors.
Alternatively if thereβs a way to limit what guns spawn to just one gun per βtypeβ (handgun, revolver, shotgun, rifle, assault rifle, etc), thatβd make using Britas tolerable.
yeah, that's a question for #mod_support
Okie, thanks
although to answer the last sentence, yeah, there is a way - you could write your own script that manipulates ProceduralDistributions
Oof
it's not a particularly big job, but obviously, having at least some coding capability is necessary
Yeah, Iβve got some very rudimentary experience, but itβs very rusty.
have a look at media/lua/server/ProceduralDistributions.lua in Britas
Iβll ask over in support if anyone knows about another mod with similar suppressors
is this for a server or just for yourself?
Solo play
oh, then you don't even need to bother doing your own mod, that's just to avoid violating their copyright
Not that concerned with βbalanceβ. =^__^=
since you're solo, just hack up the files any way you see fit
open it, delete whatever you don't like
Iβll have a look then.
Itβs not a bad mod, I just donβt feel like playing Arma Outfitter in my zombie apocalypse
I don't suppose there's a way to make it so that Brita's RPG and Flamethrower projectiles come out lower instead of on top of the player's head like an invisible halo is firing them?
Lol
does mod options let you turn down spawn rates of individual items?
I'm looking at the Javadoc, and I can't find anything on how to ban a SteamID on a server. Is there a function for that?
Not sure honestly. Iβll have to check
I cant get mods to work on my server
Any diagnosis?
I do enable them but dont want to work
I found some strange thing about animation
aiming and shooting in strafe has no issue
but it seems like aiming and standing still bugs out animations
I see the idle turning animation is not sustaining it's weight
unlike strafe aim
plz fix
i guess this is why sometimes the attack is missing the aiming zone
maybe forcibly setting the variable is the bad idea as a modder

?
lol if that's in degrees, it's just a little over 4 full turns... why is that not modulo 360? π
it does in strafe
but it does not in idle state
don't ask me why
wheeeeeee
at least now you can go full auto
without .... that strange rpm decrease
based on recoil
the accuracy already tanks in burst
47.19 MB
kinda bummer its riddled with hacks
how do u repair brita's weapons
Does anyone have an example of overwriting an lua function? I made a mod to overwrite ISVehicleMechanics:doPartContextMenu(part, x, y) but i keep getting errors when i try it out, i copy pasted the original code into a new function and commented out the code i don't want. Also assigned the old function to my new function but i probably did something wrong
Can you send code here? I will check
idk its gonna help
It's part of my codes
it stores the original in somewhere
and replaces it in gamestart event
and you can reload the code
the reason why i did the shallowcopy is well
it did something funny when starting the new game
when i didn't used that shallow copy as original reference in monkey patch code
Interesting. This code for hook after original function calls?
Yes
The biggest issue was the health menu
somehow it didn't get hooked in the boot
so I had to move more further
Inventory Bag Icon was "instanced"
so I couldn't access metatable
so I had to make another hook for that one too
probably creating new button did the thing i guess
Why just not use like this?
local oldISHealthPanel_doBodyPartContextMenu = ISHealthPanel.doBodyPartContextMenu
function ISHealthPanel:doBodyPartContextMenu(bodyPart, x, y)
oldISHealthPanel_doBodyPartContextMenu(self, bodyPart, x, y)
-- your code
end
well I prefer reference original once
because while i was making inventory render code and some UI monkey patching mods
quick patching codes actually made game crash a lot
and calling things twice or third time
idk maybe im suck
but I structure things to be reloaded
because... its kinda calling out the name so i hate to say it
due to ItemTweak Framework
restarting game is actually depressing
because it prints all the overridden items
which costs I/O, resulting game to restart WAYYYYYYYY slower
so I make things can be reloaded
file by file
just it
You mean reload lua files without restart game?
By F11 not work in your case?
f11 works
but the monkypatching lives
unless i load entire lua files from start
(which still does not guarantees the initial state, even starting new game does not provides fresh state)
its still based on my personal experience
kinda looking into zomboid java code
so yet to judge anything yet
still have a lot of questions in my mind tho
As idea - try fix ItemTweaker for disable I/O overrided items
If you have questions - can ask, maybe I will can help
well
- people copy pasted the whole code
into their mod
so its spreading like virus
print() is evil
but if they like to do so on every single mod
i can't help it tbh
- the question is mostly personal ranting ;-;
like why muzzle flash is hardcoded
no render target codes (dynamic texture generation)
I heard about this. Maybe in future patches I will add param for flash to item script
well more like
the lua - java bindings are too niche
for like
how about setting custom model for muzzle flash (since it's harded coded mesh rendering)
maybe particle rendering (i know depth buffer is yet to come so i get it)
As i know, muzzle flash it's just images
huh
yeah
2 images
Yeah almost forgot to mention
idk why some model's normals get flipped
i mean
light normal is fine
but the culling is flipped
i guess some sketch thing is going on
i suspect it is related with transforms
because when i unflip the culling
the attachment coordinate get inverted
Oh, I don't know
bruh moments
prolly adding an option for flipping the cull
also the new version of zomboid tend to have a lot of model origin issues
Hmmm
i haven't looked the code
but i assume the texture rendering code is based on the model's local transform
instead of fixed camera
i guess it's time to look into fbx importer?
Also I wonder is there a way to generate items and recipes with lua
Y'know, generating bullets and things is tedious
The World attachment is not used for the world items I think.
This minds me. Come on Olipro we were talking examples but you disappeared.
show us yours
Hello, someone knows what needs to be done if you want to edit an mod for private use? I've been using an mod to make the vanilla guns better but it also reduces their sound radius, which I didn't want and the original author hasn't updated it for almost an year (but it does works)
the files itself are pretty easy and straightforward to edit since I only wanted the original sound radius, but what else needs to be done? simply posting it on the workshop looked like worked, but in game when I tried to open my server the game loads up briefly and closes under normal termination, checking the files to see what's up says that the mod failed to download or load basically
- Minimal Display Bars
ID: 2004998206
i also have that one installed.
it does work in mp. no need to configure.
default works fine.
yes. some of those are tweaks for the mods.
all necessary.
you just have to install it from the Mod menu in settings
does anyone know if these stats shown in the wiki are modifiable in lua?
I looked but couldn't find anything :(
What I've been doing for that is just editing the file itself and distributing the modified txt file directly over discord... but it's also just a coop server with only me and 1 other person so it's not that big of a deal.
here is probably me and 2 more who bought the game recently, but I simply fail to understand what else I need to do to make then work with the workshop
I can't help you with the workshop angle unfortunately, I found it faster to just directly overwrite rather than try to figure it out.
Can anyone build a custom respawn mod for a server or know of one. the server includes owning property so basically it has to create a character and make players keep that character after "death"
basically respawn with the skills you had pre-opening the bathroom door?
Is there a mod who lets you chose any starting equipement you want?
Do most mods work in multiplayer thinking of downloading some and trying them with my friends
how can i replace the context menu recipe option with a red version if the player cannot do it currently?
or if it is easier, how can i add a tooltip to an item?
how possible is a RC car mod, e.g character stands still holding controller
as a camera follows a little tiny RC
How much ram yall got allocated to modded mp servers?
you need a LOT @wide widget
I had to dedicate 32 gigs for like 11 or 14 mods
how often do you restart it @wide widget ? If you dont regularly restart the server the memory grows. We have to do it twice daily on our community server. 18 GB for 87 mods and roughly 10 ppl at a time
I restart the server before i play, it doesnt like to stay up if i do leave it on
Anyone know how to add animations in lua?
For example i want to add cough animation for function, when character smoke too much.
Tried a lot of variations but nothing works 
Even tried to make custom animation with bob cough and run it like playEmote but still nothing.
game does is like
option = context:addOption(...)
option.notAvailable = true
I need help, this is my first time ever modding and I want to add an Excalibur Umbra Warframe into the game with all my build, how do I do it
do you have any experience in 3D modelling and coding?
No
sounds like you're trying to sprint before you can crawl
I have to extract the Warframe's model from the original game right?
that sounds like a copyright violation, but, ignoring that detail, sure, assuming you successfully manage to do so, you need to convert it to an FBX model
although given the graphical capabilities of the game, I suspect the detail level of the model is a bit beyond what PZ will handle
is there a way to package all of the mods to avoid constant server restarts due to workshop mod update?
yep, and also a copyright issue
go look at how a mod is arranged and you can figure it out. If you want to risk the ire of whoever's stuff you copy, that's on you
is there a tutorial to this? i'm not too familiar with these things
- i wouldn't worry about any form of copyright infringement π
look at the mod template
but thank you for the warning
you'll see there's a "mods" folder inside it
then look at any actual mod, you'll also see it has a "mods" folder
I'm sure you can figure out how to cut and paste folders into a single mods directory
Thank you π
how? to get it on full auto?
someone should make wall tiles that are corrugated metal panels
for base building
the metal walls look cool, but a bit extra for me
like 2 long metal panels bolted together
there's a problem with the vanilla m16 sound. it gets muted halfway if you fire it on full auto. instead the shoot sound get replace by cartridge fall sound.
https://www.youtube.com/watch?v=mohnL9QmNrA
Is this edited or can you actually do this with the treadmill mod?
This mod makes threadmills USABLE in Project Zomboid. πββοΈ
Link to the mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2752895143
For Project Zomboid Memes: https://youtube.com/playlist?list=PLb-ygipQATfcN5VROKKj7FcQiEa_SVjR7
For Project Zomboid Mods: https://youtube.com/playlist?list=PLb-ygipQATfehFDmizVjlTodc-Ez_IXD6
For Projec...
is there a way to make a gun fire in burst mode?
shoot three times
fast
and rest your finger
or wait my next mod
or go longer burst
still can't figure out that slight desync between shot
Some respawn system for my mod π
where is the wasted text
WATCH NEW 2021 VERSION HERE: https://youtu.be/v6wNY1KBKDk
Subscribe for different GTA stuff: https://www.youtube.com/c/GTAContentChannel?sub_confirmation=1
#gta #wasted
Respawn system using simple UI library
you mean anachronistic guns?
anachronistic is when something is present that only exists in the future
for my taste
i mean
AK-12
is obviously
not available in 1990
i haven't heard of AK in 1912
which is full auto
unless BF1
lol
also idk it's fixed in recent version
i managed to find out
why the hell gun sound
just cuts off
when player is like
20 units away
nothing wrong with letting people have anachronistic guns if they want them, but having "lore-friendly" options is good
also i prefer less ammo types
and more gun
not like
30 different caliburs
sitting in the storage
who the fuck is going to use 22lr
in zombie apocalypse
what is this? guns for ants?
I suppose if it's all you could find, and you're good at headshots, you might go for it
depends on what you're firing it out of and how many grains in the ammo
Most gun mods for PZ past and future donβt know restraint
Everything is overdone and over cooked
Oh hey itβs me
i still don't understand
why the gun sound volume
is not documented
it could be really immersive
when it comes to MP
isn't that basically all FMOD driven?
no
who said that
that's a custom gunsound
with 3 more lines
in 3 digits on my credit cards
you want to hear all the cool gunsounds
in the far distance
i know it
FMODSoundEmitter has a playSound() function which takes a string, and x/y/z coords
is your burst mode a LUA code or just a Script?
plus a few other overloads
lua
no
just play the sound
FMOD override only should take place
when the place is fucked up beyond the repair
what are you calling to play the sound right now?
right, so why don't you use the playSound() overload that takes X/Y/Z coords or an IsoGridSquare?
then it's positional audio
sq = getSpecificPlayer(0):getSquare()
to remember the square
to play the sound
why should i use
playSound(x,y,z,s,u,s)
ah, you're already invoking it on the IsoGridSquare
ye
and that works fine, I would hope
also that sound works in MP
and it's basically
free fix
no lua code
using the hack from the game
i rely on Recoil delay to increase RPM.
why work when you don't have to work
this is actually firing the gun
not single fire
with 3 bullets
{
category = Item,
clip
{
distanceMax = 150,
reverbFactor = 15.0,
reverbMaxRange = 150.0,
file = media/sound/308cal_1.wav,
}
clip
{
distanceMax = 150,
reverbFactor = 15.0,
reverbMaxRange = 150.0,
file = media/sound/308cal_2.wav,
}
clip
{
distanceMax = 150,
reverbFactor = 15.0,
reverbMaxRange = 150.0,
file = media/sound/308cal_3.wav,
}
}```
It was fun
until i saw
that reverb factor
is not even used in the game
i see.
so without this sound script
your/other gun mod
is basically wooden stick gunfight
because no one knows that you're using the real gun
did you increase ProjectileCount?
no
so it's set to 1?
i like you gun mod btw. you finally manage to make it full auto.
Hello guys. Would any of you big brains know how to add a button into a context menu which would trigger a timed action? π€
i wish i can teach but it's late night in here so im going to go sleep, other big brains will help
into which menu?
The context menu. The one you bring up with right click. I can't figure out how to add a new button into it.
oh I see
yeah, one sec
you want to define a function for the OnPreFillWorldObjectContextMenu event
Im thinking about OnFillWorldObjectContextMenu or OnFillInventoryObjectContextMenu events... but then im totally lost on how to actually insert the button
Oh yeah, forgot about that one
then give client/ISUI/ISWorldObjectContextMenu.lua a read
context:addOption(); hmm π€
people who use semicolons in lua make me sad
Im sorry π
C# is too stuck in my head ;c
When using OnPreFillWorldObjectContextMenu... Do I need to specify all the parameters? or do I just leave it as OnPreFillWorldObjectContextMenu(player, table, items)?
hm?
Im a bit confused
if a Lua function is passed more arguments than it takes, the extra arguments are discarded
OnPreFillWorldObjectContextMenu takes 4 arguments
anyone know where i can find vehicle:repair() function? i'd like to make a repair function that only repairs cars to a certain %, can't seem to find it in either server/client/shared .lua files, is it something thats beyond reach perhaps?
but if you don't need them all, you don't have to define them - providing they're at the end of the list
@midnight mica you can't find it because it's defined in Java
BaseVehicle and VehiclePart
is it possible to mod this? or we limited to lua
what do you mean by mod it?
oh you want to set its condition
there's setCondition for that
yes, but for the entire car in one click
well then you'll have to iterate over all the car's parts and set their condition individually
don't want my server to be full of 100% cars, but also don't want em all to be stripped of engines/parts π
thanks, il try to work with that
Hi, how could I extend the food type so I can add a variable to it and add a new option in its item context menu?
what is it you want to do?
as in, what's the goal here
(the purpose of the mod, not how you think you should code it)
is it possible to look into this function somewhere "vehicle:getPartById()"? i'd like to know all the return values
so i can loop trough em, to fix each part individually
don't do that
use getPartByIndex()
and obviously, getPartCount() to figure out how many there are
ah they are indexed per vehicle, so i wont get the police lights on a nyala for example?
no, it's just an array index
sweet, thanks for the tip
as in, from 0 to getPartCount()
For the variable I want to add a counter, but the drainable type doesn't fullfil what I need
And in the context menu I wanna add an option that changes the item into another
@dapper vector sounds like you have an XY problem https://en.wikipedia.org/wiki/XY_problem
is there a website where all the vehicle functions are listed?
yeah, there's the javadoc
personally, I find it to be pretty useless and just dump all the .class files
Well that's how I thought I could do it
yes, that's why it's called the X Y problem
rather than asking about your problem, you ask about a pre-supposed solution
Forget about extending the food type, how could I implement the changes that I describe earlier to make an item?
just describe what you're trying to do with food like you would in the description of the item on the steam workshop
because right now, I'm still not clear on what you want to do
I think this is better
I wanna create a mate, a regional drink in some countries of South America. You can't drink it as any drink, you need to pour water into some kind of vessel (the mate itself), which has to be filled with leaves. You drink it with a straw.
For that, I want a countdown that diminishes every time you drink it. When it hits zero, the item changes into "another" mate, which is flavorless, but you can still keep drinking it. In the other hand, I want to add an option that you can clean the mate, so it turns into an another item.
Also, you can drink the mate as long as you have a thermos filled with water (which I have to make too, but I don't think is more complex than a drinkable item).
OK, and you also need to heat it, I imagine?
this should be solveable by creating a set of recipes and an evolved recipe that handles the heating part
ReplaceOnUseOn should solve the issue of drinking it
amount hits zero, it becomes another item type that's full
The water in the thermos has to be heated
And I forgot to mention that every time you drink it, the water in the thermos should diminish a little
that'll be a bit trickier and require some scripting since the game doesn't have any script vars for enforcing a specific water temperature
I would suggest getting it working purely with stuff in the scripts folder and you can later move onto making it more "fancy"
or in other words "don't try to do everything all at once or you'll have an unpleasant debugging time"
yea, you are right
But I don't think I can avoid the scripting part
Which I have no idea where I need to start to write something for the game
Is there anything that needs to be done for an server recognize and download an mod ? Still having the problem of an mod I made making the server go instantly into normal termination saying it couldnt download the mod
Hey guys, I have a question. Is it possible to use a placed item as a "crafting station"? I'm trying to make it so that you must be in the proximity of a ham radio to do specific recipes.
@dapper vector a recipe can have an OnCanPerform and OnCreate specifier to run a lua function
take a look through scripts/recipes.txt - there's plenty of vanilla stuff that uses it
@pure crescent yeah, upload it to the steam workshop and then configure its workshop ID in the server's .ini file
@kindred dagger yes, "The Workshop" mod does exactly this
I don't think they did anything special beyond making the workbench item part of the recipe
(and obviously, the recipe doesn't consume it)
yeah, you just need CanBeDoneFromFloor:true
Oh, didn't think about it, gonna try later and tell if it worked
The Workshop adds its own item that you drop on the ground, though. I'm trying to use the existing ham radios that you gotta place like furniture
if it doesn't, it's you. because that's how the vast majority of servers get their mods
oh, you want to detect a Moveable
I've an old mod that I was using for the vanilla guns and tried to simply edit the sound radius back to vanilla, hopefully I can get it working
Basically, yeah. I'm not very good at modding so I'm asking here
gonna have to write your own lua function for that and reference it in the recipe with OnCanPerform
How would you detect that specific item? getName() or something like this?
iterate through the squares in the player's vicinity and check for the object with something like getName, yes
I don't know if the ham radios (or many items, actually) are given a name when placed, but that's a good start
if not, I imagine getSprite() or getIcon() will do
That should be easy enough to find
actually, since it's a radio, you should be able to call getDeviceData():getDeviceName() if simply getName() is no-go
just make sure you validate it's an instanceof IsoRadio first
or was it just Radio - I forget, try both
I'm not quite sure how to do that. I'm not experience with PZ modding at all
you use the instanceof function
Your thoughts on better sorting?
trying to repair car parts in a loop, but it wont seem to work, anyone can check my code, maybe im overseeing something silly
"won't seem to work" isn't very descriptive
it does nothing? it throws an error? what?
does nothing, made a copy of setting part condition with diff named functions, calling a command on the server, but there it doesn't seem to arrive
client side i need to enter the condition i want the car to be, then server side it should loop through each part and set it to the desired value
pastebin the code
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.
client side i call this: sendClientCommand(playerObj, "vehicle", "setCarCondition", { vehicle = vehicle:getId(), condition = condition })
have you checked the server log to see if there's any error?
I made a Occupation mod where each occupation is overridden with more balanced skill levels etc.
Each Occupation has their own : veteran:getFreeRecipes():add("Dismantle Weapons");
Which in turn comes from our Nirvana Crafting Mod : recipe Dismantle Weapons
I thought all I had to do here was add : NeedToBeLearn:true,
But even when the Occupation mod adds this recipe it will never show when NeedToBeLearn:true.
Turning NeedToBeLearn:false will sadly show it to all Occupations which is not what I'm going for.
What am I doing wrong here?
not specifically, im on debug so shouldn't it throw an error there?
are you running solo?
hosted on my pc
well then the game itself is just a client
it doesn't see server errors, because the server is a separate java process
alright thanks, il try to find if there are any
@gaunt swallow make the player learn the recipe via learnRecipe
veteran:getFreeRecipes():add is not the only way?
ah I see, you're inserting it on the trait
hm, yeah, that is a little odd - well, make the player learn it anyway, if that doesn't fix it, maybe the name is wrong
Do you mean via a recipe book then? Or how would this code look "LearnRecipe"?
see client/RadioCom/ISRadioInteractions.lua
obviously, you don't care about the radio part
Where do I find this ?
well, it's lua code, so under media/lua
srry missed that
player:learnRecipe(recipe); so this would be what im looking for?
drop that along each profession?
providing you have the IsoPlayer object, sure
now i lost you ^^
um... well that's unfortunate
Something is not right here and I struggle to find documentation about context menu 'addOption' function.
I have only found the structure of the function and some usecases but that hardly helps.
Im not that good with coding
I'm happy to provide pointers in the right direction, but that's about as far as my interest level goes
Totally understand that
The option does show in the context menu appropriately, and is also based on a condition with an item, but getting the timed action to fire?
what are you calling addOption() with?