#mod_development

1 messages Β· Page 541 of 1

calm depot
#

Do you have an example, I haven't seen this

undone crag
#

In the beta

calm depot
#

I'm on 41.71

undone crag
#

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?

undone crag
#

Okay it took a long time for the game to start but I took some screenshots.

#

Hey are you still there?

#

:|

cinder vault
#

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()

mint jolt
#

I love you 3000

undone crag
coral blade
#

uhh

#

Hi

#

Chuck's firearms Plus mods is no more?

#

ID is 2723232301

old blade
#

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?

hot patrol
#

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.

runic bear
#

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

fiery pecan
#

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?

weak hamlet
#

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 πŸ™‚

drifting ore
#

Is anybody here familiar with the Survivors 2-in-1 mod?

#

If so, how do you add unique survivors?

pseudo lake
hot void
old blade
#

ive already got someone working on it, but thank you!

hot void
#

np

umbral heron
#

huh

#

ima replace my gun with a donut

#

how do you make custom animations?

#

in project zomboid

mint jolt
#

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
keen frost
#

change
recipe Comida_ligera_por_Dinero
to
recipe Comida ligera por Dinero

mint jolt
#

Damn, I'm somewhat stupid haha thanks! Will let you know if it works πŸ˜„

mint jolt
keen frost
#

np

mint jolt
#

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!

mint jolt
umbral heron
#

lua is weird

#

the hell

fiery pecan
#

oh my

fiery pecan
tranquil reef
#

what are .pack files and how do I make them

cunning canyon
#

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

latent orchid
tranquil reef
latent orchid
#

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

tranquil reef
#

okay, thank you, I had tilezed and worlded installed but didn't know about the pack viewer lol

latent orchid
#

Unless you have custom tiles, you dont need to create any pack files

tranquil reef
#

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 crying

#

Thank you though, now that I can find it I can truly reach best modder status

latent orchid
#

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:

tranquil reef
#

it's been in vegetation this entire time bruh

latent orchid
#

yeah, i mainly do mapping so the sheet names are almost burnt into my memory

tranquil reef
#

I think I've had an outdated tile pool this entire time lol, rip

tranquil reef
# latent orchid yeah, i mainly do mapping so the sheet names are almost burnt into my memory

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

#

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

latent orchid
#

Give me a sec, iirc its a bit convoluted with the links. I'll track down the latest tilesheet link.

tranquil reef
abstract raptor
#

I believe there was but I dunno what it was lol

#

I think you'd be better off adding a context menu option

trail lotus
#

Whoa who’s the modder who creating this awesome mod?????? Please pm me πŸ™‚ 😎

cinder vault
#

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.

drifting stump
#

modData is already saved

cinder vault
#

I mean if I define/change it in there, it's not saved

drifting stump
#

?

cinder vault
#
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

drifting stump
#

do it during playing

#

type in the console do local playerModData = getPlayer():getModData(); playerModData.test = "test" end

cinder vault
#

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.

drifting stump
#

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

cinder vault
#

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

drifting stump
#

every minute is every ingame minute you underestimate how fast it is

undone crag
#

I tested OnSave and it did not seem to run when I exited to the main menu.

cinder vault
undone crag
#

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.

cinder vault
#

there's getFileWriter and getFileReader in the exposed Lua GlobalObject, I'll try that

drifting stump
#

why

undone crag
#

y tho

chrome egret
#

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

cinder vault
# chrome egret Why do you need to switch instead of staying on modData? I guess I don't underst...

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

tame mulch
drifting stump
#

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

undone crag
#

TextureCombiner is not exposed to Lua DDD:

cinder vault
#

I don't want the effects to be instantaneous

cinder vault
undone crag
#

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

cinder vault
tame mulch
# cinder vault sure, I guess easiest way to explain is that I want to add these items https://e...

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

tame mulch
undone crag
#

:o

#

I was thinking I might have to learn to use Storm.

cinder vault
#

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)

calm depot
#

@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

pliant sphinx
#

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?

cinder vault
#

@pliant sphinx

pliant sphinx
#

understood, its the same way in c++. thank you!

quasi geode
#
  • note the above only applies to functions declared local, globals are uneffected
cinder vault
calm depot
#

Functions are first-class in lua so they are basically just variables that happen to be a function

heavy turret
#

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?

calm depot
#

It's a Java function

#

I guess I'll pop open intellij and figure it out, I'm feeling charitable/curious

heavy turret
#

well okay but what it gives back? a table?

calm depot
#

yeah, it just returns a KahluaTable

#

looks like it's a way to store data persistently

#

and no, it's not global

heavy turret
#

have you found it in intellij, where is the definition of this function?

calm depot
#

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

willow estuary
#

Huh, shame it's not defined for rooms and buildings, albeit you could just use an arbitrary square.

tame mulch
#

Also exist global ModData

calm depot
#

you mean the global function getServerModData ?

tame mulch
#

No, I mean class ModData

local tab = ModData.getOrCreate("SomeDatabaseTable")
dry vessel
#

working train mode

#

like u can fix the train and it can like go around the map

calm depot
#

ah I see, the Java class is exposed to lua

fiery pecan
tame mulch
#

ModData pretty useful for client-server database or just client database

calm depot
#

@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")

dry vessel
#

expand the rail roads?

calm depot
#

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 πŸ˜„

fiery pecan
#

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.

fiery pecan
tame mulch
calm depot
#

ah well, I guess I can just patch Event.trigger()

tame mulch
calm depot
#

an option so that it's not just hardcoded to 250

fiery pecan
fiery pecan
calm depot
#

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?

fiery pecan
#

uhhh

#

let me check

#

DebugLogStream.printException> Stack trace:.

#

that's it

calm depot
#

dang

tame mulch
# fiery pecan yep

Maybe need send command to clients, and on clients sides reload script?

fiery pecan
calm depot
#

oh wait, you're causing the NPE from Lua?

fiery pecan
#

yeah

calm depot
#

got a link to the code?

fiery pecan
tame mulch
calm depot
#

sure

fiery pecan
#

k

calm depot
heavy turret
#

hey guys, is there a way to call original method that was overwritten?

calm depot
#

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

heavy turret
#

omg then this code is a mess

calm depot
#

sounds like you might have an X Y problem - why do you need to access the original method?

heavy turret
#

not me, I'm fixing a mod

calm depot
#

OK, what's the problem, can you pastebin the relevant code?

heavy turret
calm depot
#

alrighty, and what's broken?

heavy turret
#

it just loops

calm depot
#

"it"?

heavy turret
#

I guess TCMusic.oldISRadioWindow_activate = ISRadioWindow.activate is responsible for execution of the original method?

calm depot
#

yeah

heavy turret
#

well for some reason when TCMusic.oldISRadioWindow_activate( _player, _item, bol ); executes it just goes again to the start of this method

calm depot
#

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)

heavy turret
#

only this place

#

strange though, how did it work on earlier versions then? Or it never worked?

calm depot
#

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

storm scarab
#

Would anyone know the Use delta of 6 uses? as 6 uses would be 1.666 reoccurring

calm depot
#

well, it would be 0.1666...

storm scarab
#

Yeah, but surely that would leave just enough for 7?

calm depot
#

welcome to the world of floating point numbers

storm scarab
#

I thought as much

heavy turret
calm depot
#

if you really must limit it to 6, you'll have to write some code that checks the total amount remaining

storm scarab
#

Nah I guess ill just settle with 7 or 8

calm depot
#

although actually, doesn't the game refuse to let you use it if the use delta is > total amount anyway?

storm scarab
#

Yeah but then surely you would be left with a unusable trash item

#

Although that doesn't sound so bad

calm depot
#

@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

storm scarab
#

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

weary crypt
#

If you don't define the MagazineType parameter for a weapon does it assume it has an internal magazine?

calm depot
#

it would appear so, yes

weary crypt
#

Cool, thanks.

heavy turret
calm depot
#

@heavy turret can you link/upload the full mod?

calm depot
#

wut, I used that recently

#

it's broken?!?

heavy turret
#

if you place it on the ground then yes

calm depot
#

I see

#

you're working on 41.71?

heavy turret
#

in some patch they changed placeable radios to deviceObject or something

#

im on 41.68

calm depot
#

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

heavy turret
#

Indeed, probably was used before

calm depot
#

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?

heavy turret
#

place item

#

click device options

calm depot
#

ah, you're on 41.68... I'm on unstable

#

(41.71) - let's see if it breaks for me

fast galleon
#

Is there an easy way to make a player say something or add Halotextnote to them, from server

heavy turret
#

probably will get the same error

#

since change to placed objects was before

fast galleon
#

have you tried dropping object and not placing? @heavy turret

heavy turret
#

well that is a workaround, but I wanted to fix this

fair frost
heavy turret
#

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

calm depot
#

they're not the same though

#

3d object is an item whereas proper placement is a Moveable

heavy turret
#

F

#

well then one issue at a time

ebon axle
#

i noticed that if you play it before you place it it activates a 3rd Device Options that actually works haha

calm depot
#

@heavy turret yeah, I got the same error, but it's not looping

fast galleon
#

So maybe need to change tile properties?

heavy turret
#

so if you open a vanilla radio the same way the radio will work?

calm depot
#

it's broken because _item:getSprite() returns nil

ebon axle
#

if you equip it and then access the device options, one of the options after you place it works as intended

heavy turret
#

I guess it should crash as well if you don't fix the getSprite issue as you can not get past if statement

tame mulch
heavy turret
calm depot
#

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?

heavy turret
#

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

heavy turret
calm depot
#
            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

tame mulch
#

Check world items in square?

calm depot
#

well, we already have the _deviceObject

#

surely we can pull some unique attribute off of it

heavy turret
#

if getSprite() returns nil why do you need it?

calm depot
#

do you understand what the code is doing?

heavy turret
#

I'm not sure anymore lol

calm depot
#

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

heavy turret
#

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();

calm depot
#

ah yes, of course

#

perfect, that's a winner

heavy turret
#

you forgot I sent a pastbein earlier?

calm depot
#

well, that isn't localised is it?

heavy turret
#

localised means it's stored in memory?

calm depot
#

no, I mean depends on what language your game is set to

tame mulch
#

You fixed it? Need more help?

heavy turret
#

oh, the languages...

calm depot
#

ya

heavy turret
#

is there a way to check it without switching languages?

calm depot
#

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

tame mulch
calm depot
#

seems to

#

can I define ModData for an item in its .txt script?

tame mulch
#

Yep

calm depot
#

cool, this'll be much cleaner

#

is the key just called ModData?

#

nah, can't be, no definitions

tame mulch
#

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

calm depot
#

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

heavy turret
#

guys I went with my dog and you already fixed everything?

heavy turret
calm depot
#

no, I lied, it just doesn't error now, I don't think the cassette GUI is rendering properly

heavy turret
#

F

#

we also need a workaround how to interact with vanilla radios, if we can execute vanilla isradiowindow.activate that should work

calm depot
#

so, getModData() just returns a table with RadioItemID -> 350546709

#

and absolutely nothing else in it

#

I guess I need to get the underlying item

tame mulch
calm depot
#

sure, but I think this is because the WaveSignalDevice when placed in the world is different from the inventory item

tame mulch
#

Yep

calm depot
tame mulch
#

I think we can just check square for items, find item with RadioItemID and put this item to func

calm depot
#

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

tame mulch
#

We need inventory item?

calm depot
#

right, _deviceObject is an instance of IsoWaveSignal

tame mulch
#

Here how it works in PZ - to IsoWaveSignal object saved id of Inventory item, that placed on the same square

calm depot
#

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()

tame mulch
calm depot
#

ah, I see, so it's not quite the same when you obtain it this way

calm depot
#

@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

tame mulch
#

if instanceof(obj, "WorldInventoryItem") then obj:getItem():getId() == radioID

calm depot
#

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

tame mulch
#

Hmmm

#

maybe getSpecialObjects. Hmmm

calm depot
#

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

tame mulch
old zealot
#

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

tame mulch
#

Oh, maybe better ask developer of this mod)

old zealot
#

aren't these variables globally implemented?

tame mulch
#

This is specific mod, I don't know how it works (as vehicle?). But maybe someone will can help

old zealot
#

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?

calm depot
#

@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

tame mulch
calm depot
#

must be an issue with isValidAddMedia()

heavy turret
#

I got errors when trying to insert the cassette

calm depot
#

who doesn't love some print() driven debugging?

#

what error did you get

heavy turret
#
        musicPlayer = TCMusic.WorldMusicPlayer[self.device:getSprite():getName()]``` it should be this one
#

I don't remember as I was stuck with the first error

calm depot
#

did you spawn in the cassette?

heavy turret
#

yes

calm depot
#

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

heavy turret
#

can you pastbein the tickcheckmusic file?

calm depot
#

I do agree with you - I would expect this to also shit itself and crash

heavy turret
#

or just pop a file here if server accepts it

calm depot
#

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 ?

heavy turret
#

I did not

calm depot
#

so, ISTCBoomboxAction:isValidAddMedia() doesn't even execute for me :\

tame mulch
#

I did to state when it works from loot menu device options. Need only fix for 3d objects

heavy turret
#

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

calm depot
#

yep

heavy turret
#

did you test with vanilla radios?

calm depot
#

you mean do vanilla radios still behave as vanilla radios?

heavy turret
#

yea

calm depot
#

yes

heavy turret
#

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,
}```
calm depot
#

no

#

that's the models

heavy turret
#

😒

calm depot
#

TCTrueMusic.txt

heavy turret
#

oh right, missed it

calm depot
#

ok, cool, I got it to error out when inserting the cassette

#

had to pick it up and place it again, weird, anyway, progress

heavy turret
#

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

calm depot
#

yeah, I'll just get it working and send the code over

#

I think we're very close to getting this working

heavy turret
#

damn, a savior for 200k people if we can get the fix in the workshop, don't know if we can without author permission

calm depot
#

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

tame mulch
#

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

calm depot
#

weird, this can be fixed in a way that it works on both new and old :\

tame mulch
#

Not exactly. Radio in 68 build bugged. I fixed it in new patches

calm depot
#

what was bugged?

tame mulch
#

Not correct saved IsoRadio

calm depot
#

ah

#

speaking of bugged, vehicle radios have no DeviceData so you can't listen to radio stations on them now

calm depot
#

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));

tame mulch
#

Oh!

calm depot
#

@heavy turret guess what?

#

everything's working πŸ˜„

heavy turret
#

ur the mvp mate

calm depot
#

@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

tame mulch
calm depot
#

@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?

tame mulch
#

Oh, do like in ItemTweaker:
(one sec, I will find example)

drifting stump
#

if you want to edit an already existing item do

getScriptManager():getItem("Module.SomeItem"):DoParam("")
calm depot
drifting stump
#

there are also setters for a lot of things

tame mulch
#
local item = ScriptManager.instance:getItem("Base.TowBar")
item:DoParam("myParam = 69420")
#

or by setters for default params

calm depot
#

yeah, that's how I've done it before

#

I thought there was a pure script file way

#

alright, good enough

calm depot
#

@tame mulch are items guaranteed to be loaded before your Lua executes or do I need to put it in an event?

tame mulch
cinder vault
#

is there a way to temporarily increase player fitness/strength? also is there a way to alter perception radius?

calm depot
#

cool

#

@cinder vault sure, level them up and then level them down later

cinder vault
#

what's the function to do that?

calm depot
#

just make sure you don't bugger up their XP πŸ˜‰

cinder vault
#

yeah I'll keep it in mind

calm depot
#

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

cinder vault
#

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

calm depot
cinder vault
#

oh nice

#

time to find out if those can be adjusted

vapid wind
#

are there any mods that add a search bar for inventories?

calm depot
zenith smelt
#

Is it okay to save stuff about the player in the moddata for the player in the server?

#

I mean in the multiplayer

tame mulch
zenith smelt
#

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

tame mulch
zenith smelt
#

That's perfect

#

Thanks

#

I want to have player unlock levels from gameplay and then redistribute them manually

calm depot
#

@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?

heavy turret
tame mulch
#

I think better load it to pastebin and attach link in comment to mod page

thorny garnet
#

@late hound Maybe this'll work? lol

calm depot
#

@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

thorny garnet
#

Just realized this is in the improper channel.

tame mulch
calm depot
#

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

tame mulch
calm depot
#

I live in hope one day PZ will move to LuaJ

#

it kicks the pants off of Kahlua

tame mulch
calm depot
#

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

old zealot
calm depot
#

@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()

tame mulch
calm depot
#

that's a question for @fiery pecan

#

he's using it to replace vehicle textures on the fly it seems

fiery pecan
tame mulch
fiery pecan
#

changes to the vehicle itself

#

like...

#

my mod takes a 85vicsheriff, from Filibuster's mod, and makes it a 85vic_STR_Rosewood, for example

tame mulch
fiery pecan
#

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

tame mulch
#

It works only on 1 client or don't work anywhere?

calm depot
#

it's not a particularly healthy thing because the thread constantly throws exceptions after the failed setScriptReloaded call

fiery pecan
tame mulch
#

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)

calm depot
#

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

fiery pecan
willow estuary
#

@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.

weary crypt
#

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

willow estuary
#

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.

weary crypt
#

Thanks. If you do happen to learn of one I'd be very interested

old zealot
old zealot
#

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

calm depot
#

@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

old zealot
#

Is everything that is on the player inside "Inventory"??

calm depot
#

yes

old zealot
#

Including backpack items

#

?

calm depot
#

yes

old zealot
#

Hmm alright then

calm depot
#

hence the "recurse" part of the functions

old zealot
#

There should be a way for that function to record from which place it removed the item

calm depot
#

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

rocky wagon
#

Is this a good channel for general questions about published mods?

calm depot
#

depends

#

is it a code question or a support question?

rocky wagon
#

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.

calm depot
rocky wagon
#

Okie, thanks

calm depot
#

although to answer the last sentence, yeah, there is a way - you could write your own script that manipulates ProceduralDistributions

rocky wagon
#

Oof

calm depot
#

it's not a particularly big job, but obviously, having at least some coding capability is necessary

rocky wagon
#

Yeah, I’ve got some very rudimentary experience, but it’s very rusty.

calm depot
#

have a look at media/lua/server/ProceduralDistributions.lua in Britas

rocky wagon
#

I’ll ask over in support if anyone knows about another mod with similar suppressors

calm depot
#

is this for a server or just for yourself?

rocky wagon
#

Solo play

calm depot
#

oh, then you don't even need to bother doing your own mod, that's just to avoid violating their copyright

rocky wagon
#

Not that concerned with β€˜balance’. =^__^=

calm depot
#

since you're solo, just hack up the files any way you see fit

#

open it, delete whatever you don't like

rocky wagon
#

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

safe sinew
#

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?

rocky wagon
#

Lol

pulsar charm
thorn bane
#

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?

rocky wagon
wintry birch
#

I cant get mods to work on my server

#

Any diagnosis?

#

I do enable them but dont want to work

white crag
#

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

#

?

white crag
#

well kinda fixed it by turning on isturning to true

#

when swining the weapon

native shore
# white crag

lol if that's in degrees, it's just a little over 4 full turns... why is that not modulo 360? πŸ˜„

white crag
#

but it does not in idle state

#

don't ask me why

native shore
#

wheeeeeee

white crag
#

at least now you can go full auto

#

without .... that strange rpm decrease

#

based on recoil

#

the accuracy already tanks in burst

undone crag
#

47.19 MB

white crag
#

kinda bummer its riddled with hacks

olive turret
#

how do u repair brita's weapons

midnight mica
#

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

tame mulch
white crag
#

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

tame mulch
# white crag

Interesting. This code for hook after original function calls?

white crag
#

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

tame mulch
#

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
white crag
#

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

tame mulch
#

You mean reload lua files without restart game?

white crag
#

ye

#

Without any sideeffects

tame mulch
#

By F11 not work in your case?

white crag
#

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

tame mulch
#

As idea - try fix ItemTweaker for disable I/O overrided items

tame mulch
white crag
#

well

#
  1. 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

#
  1. the question is mostly personal ranting ;-;
#

like why muzzle flash is hardcoded

#

no render target codes (dynamic texture generation)

tame mulch
white crag
#

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)

tame mulch
white crag
#

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

tame mulch
#

Oh, I don't know

white crag
#

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

tame mulch
#

Hmmm

white crag
#

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

undone crag
#

The World attachment is not used for the world items I think.

undone crag
pure crescent
#

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

shadow tulip
#
  1. 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

fair frost
cinder vault
#

does anyone know if these stats shown in the wiki are modifiable in lua?
I looked but couldn't find anything :(

weary crypt
pure crescent
weary crypt
#

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.

trail lotus
#

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"

pure crescent
#

basically respawn with the skills you had pre-opening the bathroom door?

rigid smelt
#

Is there a mod who lets you chose any starting equipement you want?

brittle apex
#

Do most mods work in multiplayer thinking of downloading some and trying them with my friends

pulsar charm
#

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?

drifting ore
#

how possible is a RC car mod, e.g character stands still holding controller

#

as a camera follows a little tiny RC

wide widget
#

How much ram yall got allocated to modded mp servers?

drifting ore
#

you need a LOT @wide widget

wide widget
ebon axle
#

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

wide widget
polar gyro
#

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 AhriCry

#

Even tried to make custom animation with bob cough and run it like playEmote but still nothing.

fast galleon
winter moss
#

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

calm depot
#

do you have any experience in 3D modelling and coding?

winter moss
#

No

calm depot
#

sounds like you're trying to sprint before you can crawl

winter moss
#

I have to extract the Warframe's model from the original game right?

calm depot
#

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

fickle relic
#

is there a way to package all of the mods to avoid constant server restarts due to workshop mod update?

calm depot
#

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

fickle relic
#
  • i wouldn't worry about any form of copyright infringement πŸ˜„
calm depot
#

look at the mod template

fickle relic
#

but thank you for the warning

calm depot
#

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

fickle relic
#

Thank you πŸ™

smoky meadow
old blade
#

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

smoky meadow
#

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.

little iron
#

https://www.youtube.com/watch?v=mohnL9QmNrA
Is this edited or can you actually do this with the treadmill mod?

drifting ore
#

XD

#

Looks fun

smoky meadow
#

is there a way to make a gun fire in burst mode?

white crag
#

shoot three times

#

fast

#

and rest your finger

#

or wait my next mod

#

still can't figure out that slight desync between shot

tame mulch
white crag
#

where is the wasted text

autumn garnet
#

Respawn system using simple UI library

craggy furnace
#

Been wanting to mess with weapon anims recently too

white crag
#

Personally brita is too much for me

#

too many guns (with time paradox)

calm depot
#

you mean anachronistic guns?

white crag
#

no i make my own

#

tried brita

#

but brita was too intrusive

calm depot
#

anachronistic is when something is present that only exists in the future

white crag
#

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

calm depot
#

lol

white crag
#

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

calm depot
#

nothing wrong with letting people have anachronistic guns if they want them, but having "lore-friendly" options is good

white crag
#

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?

calm depot
#

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

craggy furnace
#

Most gun mods for PZ past and future don’t know restraint

#

Everything is overdone and over cooked

white crag
craggy furnace
#

Oh hey it’s me

white crag
#

i still don't understand

#

why the gun sound volume

#

is not documented

#

it could be really immersive

#

when it comes to MP

calm depot
#

isn't that basically all FMOD driven?

white crag
#

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

calm depot
#

FMODSoundEmitter has a playSound() function which takes a string, and x/y/z coords

smoky meadow
calm depot
#

plus a few other overloads

white crag
#

lua

#

no

#

just play the sound

#

FMOD override only should take place

#

when the place is fucked up beyond the repair

calm depot
#

what are you calling to play the sound right now?

white crag
#

playSound

#

to play the sound

calm depot
#

right, so why don't you use the playSound() overload that takes X/Y/Z coords or an IsoGridSquare?

#

then it's positional audio

white crag
#

sq = getSpecificPlayer(0):getSquare()

#

to remember the square

#

to play the sound

#

why should i use

#

playSound(x,y,z,s,u,s)

calm depot
#

ah, you're already invoking it on the IsoGridSquare

white crag
#

ye

calm depot
#

and that works fine, I would hope

white crag
#

also that sound works in MP

#

and it's basically

#

free fix

#

no lua code

#

using the hack from the game

smoky meadow
#

i rely on Recoil delay to increase RPM.

white crag
#

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

smoky meadow
white crag
#

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

smoky meadow
white crag
#

no

smoky meadow
#

so it's set to 1?

white crag
#

yes

#

i will upload and post the code sooner or later

#

just currently bit unstable

smoky meadow
white crag
#

brita does it too

#

but my method is bit different

unique trail
#

Hello guys. Would any of you big brains know how to add a button into a context menu which would trigger a timed action? πŸ€”

white crag
#

i wish i can teach but it's late night in here so im going to go sleep, other big brains will help

calm depot
#

into which menu?

unique trail
calm depot
#

oh I see

#

yeah, one sec

#

you want to define a function for the OnPreFillWorldObjectContextMenu event

unique trail
#

Im thinking about OnFillWorldObjectContextMenu or OnFillInventoryObjectContextMenu events... but then im totally lost on how to actually insert the button

unique trail
calm depot
#

then give client/ISUI/ISWorldObjectContextMenu.lua a read

unique trail
#

context:addOption(); hmm πŸ€”

calm depot
#

people who use semicolons in lua make me sad

unique trail
#

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)?

calm depot
#

hm?

unique trail
#

Im a bit confused

calm depot
#

if a Lua function is passed more arguments than it takes, the extra arguments are discarded

#

OnPreFillWorldObjectContextMenu takes 4 arguments

midnight mica
#

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?

calm depot
#

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

midnight mica
#

is it possible to mod this? or we limited to lua

calm depot
#

what do you mean by mod it?

#

oh you want to set its condition

#

there's setCondition for that

midnight mica
#

yes, but for the entire car in one click

calm depot
#

well then you'll have to iterate over all the car's parts and set their condition individually

midnight mica
#

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

dapper vector
#

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?

calm depot
#

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)

midnight mica
#

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

calm depot
#

don't do that

#

use getPartByIndex()

#

and obviously, getPartCount() to figure out how many there are

midnight mica
#

ah they are indexed per vehicle, so i wont get the police lights on a nyala for example?

calm depot
#

no, it's just an array index

midnight mica
#

sweet, thanks for the tip

calm depot
#

as in, from 0 to getPartCount()

dapper vector
# calm depot what is it you want to do?

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

calm depot
midnight mica
#

is there a website where all the vehicle functions are listed?

calm depot
#

yeah, there's the javadoc

#

personally, I find it to be pretty useless and just dump all the .class files

dapper vector
calm depot
#

yes, that's why it's called the X Y problem

#

rather than asking about your problem, you ask about a pre-supposed solution

dapper vector
#

Forget about extending the food type, how could I implement the changes that I describe earlier to make an item?

calm depot
#

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

dapper vector
#

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).

calm depot
#

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

dapper vector
#

And I forgot to mention that every time you drink it, the water in the thermos should diminish a little

calm depot
#

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"

dapper vector
#

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

pure crescent
#

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

kindred dagger
#

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.

calm depot
#

@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

pure crescent
kindred dagger
#

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

calm depot
#

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

pure crescent
#

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

kindred dagger
#

Basically, yeah. I'm not very good at modding so I'm asking here

calm depot
#

gonna have to write your own lua function for that and reference it in the recipe with OnCanPerform

kindred dagger
#

How would you detect that specific item? getName() or something like this?

calm depot
#

iterate through the squares in the player's vicinity and check for the object with something like getName, yes

kindred dagger
#

I don't know if the ham radios (or many items, actually) are given a name when placed, but that's a good start

calm depot
#

if not, I imagine getSprite() or getIcon() will do

kindred dagger
#

That should be easy enough to find

calm depot
#

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

kindred dagger
#

I'm not quite sure how to do that. I'm not experience with PZ modding at all

calm depot
#

you use the instanceof function

wintry birch
#

Your thoughts on better sorting?

midnight mica
#

trying to repair car parts in a loop, but it wont seem to work, anyone can check my code, maybe im overseeing something silly

calm depot
#

"won't seem to work" isn't very descriptive

#

it does nothing? it throws an error? what?

midnight mica
#

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

calm depot
#

pastebin the code

midnight mica
#

client side i call this: sendClientCommand(playerObj, "vehicle", "setCarCondition", { vehicle = vehicle:getId(), condition = condition })

calm depot
#

have you checked the server log to see if there's any error?

gaunt swallow
#

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?

midnight mica
#

not specifically, im on debug so shouldn't it throw an error there?

calm depot
#

are you running solo?

midnight mica
#

hosted on my pc

calm depot
#

well then the game itself is just a client

#

it doesn't see server errors, because the server is a separate java process

midnight mica
#

alright thanks, il try to find if there are any

calm depot
#

@gaunt swallow make the player learn the recipe via learnRecipe

gaunt swallow
calm depot
#

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

gaunt swallow
#

Do you mean via a recipe book then? Or how would this code look "LearnRecipe"?

calm depot
#

see client/RadioCom/ISRadioInteractions.lua

#

obviously, you don't care about the radio part

gaunt swallow
#

Where do I find this ?

calm depot
#

well, it's lua code, so under media/lua

gaunt swallow
#

righ right

#

Isnt that only about skills?

calm depot
#

learnRecipe

#

it's right there in the file.

gaunt swallow
#

srry missed that

#

player:learnRecipe(recipe); so this would be what im looking for?

#

drop that along each profession?

calm depot
#

providing you have the IsoPlayer object, sure

gaunt swallow
#

now i lost you ^^

calm depot
#

um... well that's unfortunate

unique trail
#

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.

gaunt swallow
#

Im not that good with coding

calm depot
#

I'm happy to provide pointers in the right direction, but that's about as far as my interest level goes

unique trail
#

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?

calm depot
#

what are you calling addOption() with?