#mod_development

1 messages · Page 526 of 1

calm depot
#

actually, you can skip that and go straight to media/lua/client/TimedActions/ISDropWorldItemAction.lua

#

line 42 is where it places an item at specific coordinates

hidden compass
#

@willow estuary @calm depot
Thanks for your reply, I'll try it.

willow estuary
#

In general, when people are as vague as you are, there's not much there to motivate or engage qualified bystanders?

I'd suggest being more specific about what you want help with.

hidden compass
#

This is a continuation of the case of placing items in specific locations at the start of the game.
I have succeeded in placing items by specifying a location.

However, for example, if the character is current in Muldraugh and I try to get a grid of West Point, which is far away, I get an error (getCell() returned nil).

        local sq = getCell():getGridSquare(10634, 10412, 0)
        local worldItem = sq:AddWorldInventoryItem("P4StealthCamo.P4StealthCamoBlueprint", 0.1, 0.1, 0.2)

I want to place items in a specific location at the start of the game (Event.OnGameStart), no matter where I choose as the starting point.
I tried running the event hook script on the Server side, but the result was the same.

Any ideas?

willow estuary
drifting ore
#

Ok so

hidden compass
drifting ore
#

Ik this is a big convo lately

#

If I wanted to make a mod that ONLY spawns volatiles with a custom texture

#

Would there be any feasible way

calm depot
#

@hidden compass no point in placing an item if the client can't see it anyway - why not fire it off if Events.LoadGridSquare coincides with the location?

hidden compass
warped pebble
#

Can I see somewhere in co-op mode that the mods are active?

hidden compass
faint jewel
#

are there any one seat vehicles?

spark void
faint jewel
#

good idea

#

2 seaters 😦

drifting ore
faint jewel
#

me?

#

i do!

drifting ore
#

I have soon finished my UI API, all of you, do you have any menu ideas that I could do as an example?

faint jewel
#

something like that? lol

drifting ore
#

drag and drop is a mess so it's almost impossible to use it

faint jewel
#

that's a purely VISUAL change. the mechanics would still be the same.

drifting ore
#

Still impossible. Go check the ISInventoryPane and ISInventoryPage, if you understand something about drag and drop you call me xD

#

Here the kind of UI that my mod to in 11 line of code

faint jewel
#

well that would be nice...

#

but i would HIGHLY reccommend a margin.

drifting ore
#

There is, just not use here

faint jewel
#

so for an idea then... a "job board"

#

that would bring up THAT menu based on the jobs available.

drifting ore
#

Good idea

sharp wind
drifting ore
#

It was a visual mockup he did

sharp wind
daring palm
#

Guys. I'd like to test a couple of mods of mine in Multiplayer before uploading them in the steam workshop. How do I do that?

sharp wind
#

There's a guide for that, check pin for the link

daring palm
sharp wind
#

Personally, I never needed to download the dedicated server

#

the game comes with a script for hosting locally

#

all you need to do is make a host file, and make sure it points to the workshop for mods

#

then put your mods in the workshop folder and boot up the server

#

then join locally on 127.0.0.1

#

you are now playing multiplayer with client/server mode

daring palm
#

thank you, dude

ruby juniper
#

Is there a mod that makes the game brighter?

#

I can barely see anything

daring palm
#

@sharp wind thank you again, It worked

#

@drifting ore nice work with the docs, btw. Keep it going. Very useful

frigid rain
#

Where do I generate the lua file that goes in: tiles->lua->server->items->EXAMPLE.lua?

faint jewel
frigid rain
drifting ore
#

Hello peeps! Sorry to slot this in the middle of the conversation, I've a super-quick mod question, I wanted to make a Dawn Of The Dead style spawn mod - In the LUA for the spawnpoints, what (and where) do I put the height to spawn on the roof of the mall?

I have this so far:

worldX = 33
worldY = 22
posX = 13874
posY = 5877

Obviously the X and Y are the 3d coordinates, is there a 3rd coord to govern height?

willow estuary
#

worldZ/posZ should be it.

drifting ore
#

That's what I thought, but they weren't listed in the template I'm using - I'll give it a shot - appreciate the quick response 👍

#

@willow estuary any idea if it's just 0, 1, 2 etc or whether there is actual measurement to it?

faint jewel
willow estuary
#

It's just simple integers like that, starting with 0. 1 being the first aboveground level etc.

drifting ore
#

Groovy, ty!

willow estuary
#

👍

drifting ore
#

@willow estuary and anyone else interested, this is not exactly how it works. Here's a reference for anyone else trying to modify spawn points: #mapping message
I'm sure there's a reason it is so conveluted... 🙄

#

That took too long to type up 😅 (edit: and work out)

willow estuary
#

That took too long to type up :sweat_smile: (edit: and work out)
Oh man, I feel bad in that this is common knowledge in the mapping sphere? stressed

#

Post this in the mapping channel with an informative header however? Worth pinning there for sure.

gilded hawk
#

Yeah a pin might be nice

drifting ore
#

First time modder here, programmer by trade though - so wasn't too much of an issue... Welcome to post it and pin it by all means

distant heron
#

i have a relatively light mod request hoping to see if anyone would be willing to help me out. ive been looking around and i cant seem to find any mods anywhere for this. nothing even close

#

its just a light cheat mod that makes static storage containers such as fridges, tables with drawers, crates, etc. have infinite capacity

#

or even just high capacity in general

fair frost
faint jewel
#

oh man.

#

this is nuts.

tacit bobcat
#

Hey guys, is there a mod which allows you to queue up cassettes and play them after each other ?

faint jewel
#

holy crap we need a tool programmer.

grim girder
#

jw , has anyone seen or know of a mod that puts in NON military tractor trailers and or construction vehicles

vivid flare
#

maybe tomorrow

grim girder
#

whats tmr?

vivid flare
#

maybe people will see such a mod tomorrow

grizzled grove
faint jewel
#

wellll... a car tool would be nice.

#

shows the car model and the wheels and lets you line them up. squares for the seats etc.

grizzled grove
#

isn't that what the debug vehicle tool does?

faint jewel
#

the what now?

grizzled grove
#

when you run in debug mode, the quick panel has a vehicle editor

#

fyi, i've never actually used it to edit anything, just poked at it enough to say "hey neat"

willow estuary
#

Yeah, that's exactly what the vehicle debug tool does.

faint jewel
#

okay so uh... what do the debug do?

late hound
faint jewel
#

does nothing.

hearty herald
#

Isn't the vehicle debug menu accessed ingame from the debug window?

#

I think I used it once to rotate a car after landing it on the side, since I thought it was silly I couldn't push it over 😂

faint jewel
#

well i can't get past this main menu

willow estuary
hearty herald
#

The F11 window can be closed by pressing F11 again

faint jewel
#

it doesn't close.

hearty herald
#

If you mean the full screen debug thing that lets you look at lua script

faint jewel
#

it just sits.

willow estuary
faint jewel
#

f11 all day

hearty herald
#

Sometimes I had to press it twice or thrice if there are lua errors that bring it back up again. Try unchecking that "break on error" ?

willow estuary
faint jewel
#

i did

hearty herald
#

Could always restart the game I guess. 😂

faint jewel
#

doing everything i can to get that to go away lol.

#

f6?

#

hmmm

nimble spoke
hollow crown
#

They don’t crash saves and have like 500 storage space

#

And are pretty easy to find

real cape
#

I have a question/ request if possible if anyone is bored and likes the idea. Would it be possible to add a function that is exactly like "take some dirt" except you don't need a sack and it deletes the dirt when you do it? But also leave alone the take dirt option but create a new ui selection for "make path"? I have to make a lot of trails to get to my base off the road and the overgrowth is a pain but even worse is filling all the sacks just to find places to dump them out and do it all over again.

hollow crown
#

Don’t think you can delete dirt like at all

#

Even with a mod

hearty herald
#

Can't you access the world tiles through Lua though? Might be able to edit it

hollow crown
#

You could probably just put a path over it though

real cape
#

Is it different than a normal tile?

hollow crown
#

Like cement or something

hollow crown
#

You could maybe “delete” dirt but I don’t know what you would put under the missing dirt

hearty herald
#

I think he just wants to make a path on grass and stuff without having a sack

hollow crown
#

Actually that isn’t a bad idea

#

Like if you use a shovel you can make a path

real cape
#

Well I mean like you can take the dirt now and put it in a sack. The trashcan has a delete function that can delete pretty much anything in it. I just don't want to collect the dirt I'm digging when clearing a path

hearty herald
#

I've had annoyances trying to make a path myself at some point, definitely seems like a decent thing to have. Just turning the grass upside down to get dirt instead of grass lmao

hollow crown
#

Ohhh

#

Can’t you remove grass

#

Without touching dirt

real cape
#

Yeah cause once you remove the top tile of grass nothing grows there

hollow crown
#

Pretty sure it’s already a feature

real cape
#

I'm not sure on the coded level I just know in game you have to dig the dirt to remove the top tile. Once that is done nothing will grow back.

hearty herald
#

Remove vegetation only removes the, flowers n stuff above the grass tile

real cape
#

You can cut the grass but it grows back, quite quickly at that

hollow crown
#

Hmmm

faint jewel
#

i need to get rid o grass when you drive over it.

#

for... reasons.

real cape
#

Also doesn't stop saplings and bushes from growing

hollow crown
#

Hopefully someone makes a mod of this

real cape
#

But like I said once that type tile of grass is removed and only dirt is showing the. Nothing grows back.

#

Yeah thats why I figures I'd ask. I wish I could code but unfortunately I can barely sit through a 10 min long youtube video of, well anything really

nimble spoke
faint jewel
#

where can i locate the sound database?

faint jewel
#

nvm that for now.

#

how can i tell if my car is over a body? (player or zombie)

faint jewel
#

has anyone done new vehicle sounds?

hearty herald
# faint jewel how can i tell if my car is over a body? (player or zombie)

While I don't know my way around the codebase, I would be surprised if there was a readymade function for this. I assume your best bet would be to get all zombies that are within a few tiles of your car and check some stuff on them. There might be a boolean for "can't get up" on the zombie? Since they can't get up when you stand on them or have a car on top of them.

faint jewel
#

dammit jim. she's dead.

shut valley
#

or under a car to stop them getting up

#

it might be part of the vehicle data or part of the player/zombie data

daring palm
#

inspect the returning values of list1 and list2. I'm sure one of them will return corpses on the ground

#

I don't remenber which one tbh

faint jewel
#

well i found trees are iso... what is grass though?

#

the grass you remove.

daring palm
#

some sort of object I guess

#

you may iterate over the returning list to figure out which kind of objects you're dealing with

#

for ex: square:getObjects() return a list of IsoObject

#

you may further inspect it by querying its type with obj:getType()

stuck latch
#

was someone making a vanilla style gun mod with an AK?

faint jewel
#

local treetree = objects:get(index) how would i get it to spit out what is in that index?

abstract raptor
#

for some reason I broke the crafting menu unhappy

faint jewel
#

i broke the whole ass game and made a murderous haunted mower

faint jewel
#

check out my streeam in the voice channel.

#

it's just nuts

hearty herald
#

Did you get it to remove grass?

faint jewel
#

i will as soon as i make it stop TERRORIZING THIS NEIGHBORHOOD.

shut valley
#

yeah that is very weird

hearty herald
#

Just call explode() on the square you're above and you're set.

faint jewel
#

OH GOD IT FLIES NOW

hearty herald
faint jewel
#

the riding variety

abstract raptor
#

time to play find the missing comma I guess

faint jewel
#

who was it that can do custom animations?

#

this cannot stand. he needs a legit "driving a mower" stance.

shut valley
# faint jewel who was it that can do custom animations?

remember the drive by shooting feature too drunk https://youtu.be/rX070AEWiUU

Hell yeah

Disclaimer: Under Section 107 of the Copyright Act 1976, allowance is made for "fair use" for purposes such as criticism, comment, news reporting, teaching, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favo...

▶ Play video
faint jewel
#

anyone know how to remove foliage via lua?

shut valley
#

I think removeplantcursor has the code you are looking for

    return not item:isBroken() and item:hasTag("CutPlant")
end

function ISRemovePlantCursor:create(x, y, z, north, sprite)
    local square = getWorld():getCell():getGridSquare(x, y, z)
    if self.removeType == "bush" then
        ISWorldObjectContextMenu.doRemovePlant(self.character, square, false)
    elseif self.removeType == "grass" then
        ISWorldObjectContextMenu.doRemoveGrass(self.character, square)
    elseif self.removeType == "wallVine" then
        ISWorldObjectContextMenu.doRemovePlant(self.character, square, true)
    end
end

function ISRemovePlantCursor:isValid(square)
    if self.removeType == "bush" or self.removeType == "wallVine" then
        local playerInv = self.character:getInventory()
        local hasCuttingTool = playerInv:containsEvalRecurse(predicateCutPlant)
        if not hasCuttingTool then
            return false
        end
    end
    return self:getRemovableObject(square) ~= nil
end```
faint jewel
#
                    for index=0, objects:size()-1 do
                        local GrassBush = objects:get(index)
                        if instanceof(GrassBush, "IsoTree") then
                            GrassBush:Damage(GrassBush:getMaxHealth() * 0.9)
                            if not GrassBush:getModData().soundbreak then
                                GrassBush:getModData().soundbreak = 1
                                vehicle:playSound("VehicleHitTree")
                            end

                            -- if not vehicle:getEmitter():isPlaying("BreakObject") then
                            --     -- vehicle:playSound("breakdoor")
                                
                            -- end
                            
                        end         
                    end
``` how would i make this do that. get rid of bushes and grass instead of trees?
#

can i reload a vehicles server script in debug?

#

or do i have to restart?

faint jewel
#

so quiet

pulsar niche
#

Is it difficult to mod if you have no basic knowledge of programming and you get easily frustrated with coding?

shut valley
#

depends on what you want to do, some types of mods do not require coding/or you just need to follow the template from already made items/weapons.

faint jewel
#

ARGH

#

this isd riving me nuts.

shut valley
faint jewel
#

it's like the grass isn't an object.

#

say what?

shut valley
#

it has a plough

#

that in theory atleast for me sounds like it should detect grass right?

faint jewel
#

it switches it to dirt i think'

#

rather just removing the grass

#

and they way they do it it removes EVERYTHING.

#

lol

shut valley
#

a boolean called bFlattenGrassEtc

#

exists

#

uhm could this be it?

#

isCommonGrass

faint jewel
#

i've not seen that used.

#

either of those.

shut valley
pulsar niche
shut valley
shut valley
faint jewel
#

yeah like i said... it's rough

shut valley
faint jewel
#

remove grass lol

#

remove bush

#

OMFG. i have created the destroyer of worlds.

shut valley
#

found this code in timedactionstest.lua

Tests.remove_grass = {
run = function(self)
local square,x,y,z = getSquareDelta(2, 2, 0)
removeAllButFloor(square)
newObject(x, y, z, "e_newgrass_1_48", "Grass")
luautils.walkAdj(PLAYER_OBJ, square, window)
ISTimedActionQueue.add(ISRemoveGrass:new(PLAYER_OBJ, square))
end
}

Tests.remove_bush_hands = {
run = function(self)
local square,x,y,z = getSquareDelta(2, 2, 0)
removeAllButFloor(square)
local object = newObject(x, y, z, "f_bushes_1_8", "")
-- square:getErosionData():reset()
ErosionMain.LoadGridsquare(square)
luautils.walkAdj(PLAYER_OBJ, square, window)
ISTimedActionQueue.add(ISRemoveBush:new(PLAYER_OBJ, square, nil))
end
}

faint jewel
#

timed actions...

shut valley
#

at somepoint what is a "grass"/"bush" has to be defined

faint jewel
#

square:transmitRemoveItemFromSquare(GrassBush)

#

that is BAD.

shut valley
#

it has to be somewhere

faint jewel
#

it's a "removetype"

#
        ISWorldObjectContextMenu.doRemovePlant(self.character, square, false)
    elseif self.removeType == "grass" then
        ISWorldObjectContextMenu.doRemoveGrass(self.character, square)```
shut valley
#

i think this is the section of the code that tells the game to remove the grass

function ISRemoveGrass:perform()

local sq = self.square

local args = { x = sq:getX(), y = sq:getY(), z = sq:getZ() }

sendClientCommand(self.character, 'object', 'removeGrass', args)


ISBaseTimedAction.perform(self)

end

#

and at the end it tell the character to perform the timed action

#

and then the next part of the code sets the time

#

@faint jewel i think you want use IsoFlagType.canBeCut for the bush and IsoFlagType.canBeRemoved for the grass

this is the codes that check if a bush and grass are present

function ISRemoveBush:getBushObject(square)
if not square then return nil end
for i=1,square:getObjects():size() do
local o = square:getObjects():get(i-1)
if o:getSprite() and o:getSprite():getProperties() and o:getSprite():getProperties():Is(IsoFlagType.canBeCut) then
return o
end
end
return nil
end

function ISRemoveGrass:isValid()
for i=0,self.square:getObjects():size()-1 do
local object = self.square:getObjects():get(i);
if object:getProperties() and object:getProperties():Is(IsoFlagType.canBeRemoved) then
return true
end
end
return false
end

faint jewel
#

yeah

#

so how do i remove the objects with THAT.

#

lol

#

and how the hell do you scale a square?

faint jewel
#

OH SHIT I GOT IT. WOOOO

faint jewel
#

okay... so currently... it murders zombies WAY too easily.

#

is there a way to check if a zombie is on the ground?

drifting ore
#

Heyo I'm trying to make my first map and 3 tutorials got me this far but I can't seem to actually get down any land or walls, not sure how to go about that, any help is welcome.

faint jewel
#

look up daddys videois.

drifting ore
#

For sure!

drifting ore
faint jewel
#

aye

shut valley
drifting ore
#

ok

drifting ore
#

most tutorials show this like pen you can use but i dont see it

shut valley
drifting ore
#

what

#

what programs?

#

oh wait

#

I read that wrong

shut valley
#

Worlded

faint jewel
#

hiow the hell do you damage a zombie?

drifting ore
#

So there are no map makers that are like WorldPainter for minecraft or something, this WolrdEd is more like MCEdit if you know what that is

faint jewel
#

worse than htat lol.

#

like a bad nightmare of the sims map editor.

drifting ore
#

I see why there aren't a lot of maps

willow estuary
drifting ore
faint jewel
#

lol technicalities

willow estuary
#

It's not a big deal, and people direct people to the wrong channels constantly.

calm depot
#

from the values I'm producing, the bourbon bottle should hold less water than a regular water bottle

willow estuary
calm depot
#

OK, so it's not just me

#

I've written a mod that allows containers to arbitrarily store gasoline or water and now I'm tweaking it to have realistic weights and usage deltas

vivid flare
#

not sure if "realistic" is a good approach anyways

calm depot
#

I mean, gasoline has a relative weight of ~0.75 so there's no reason not to use it

#

as for usage deltas... why not?

verbal ivy
#

Does anyone know how to sync "dealing damage to zombies" in MP? Turns out if the code runs in server side, there is no way to send this change to client sides, and if it runs in clint side, the server and other players will not register the damage, cause de-sync. This problem is bugging me for days, anyone know if there is a solution to this?

calm depot
#

yeah, do it on the client side

#

zombies that attack the player exist in a sort of "bubble" - namely, they are local to the client

#

(mainly so people don't get pissed off about dying because the server decides a zombie killed them with old data)

#

create functions on server & client side to send and receive the damage amount so other clients can update it

#

of course, there's nothing you can do about clients with shitty internet, it'll just be delayed by however long it takes for the packet to get through

small topaz
#

does anyone knows a clean way to introduce a new body location which is rendered before all the vanilla locations? i would like to do that without overwriting the vanilla BodyLocations.lua. only idea i have so far is to backup the vanilla body locations, use a reset command to delete them all and then defining them again by prefixing the new locations but not sure if this is the best way to do this.

nimble spoke
sick mirage
#

anyone has a quick fix for the MP mods?

fair frost
drifting ore
#

Jans out here kicking out cop car skins 24/7 jeesus

nimble spoke
vivid flare
#

no explanation, just fix! now!

lusty nebula
#

Anyone as any idea where the file/s that manages the credits displayed in the main screen is located/named?

#

(Searching it but not yet found )

red jewel
#

Yo, I was looking around in the spawn settings for items in Brita's armor pack mod, I was wondering if someone could help me find out what the following numbers mean

daring yacht
#

Hello i was wondering is the guid text necessary if i am doing multiple items difference colors and textures?

calm depot
#

@red jewel it's the spawn probability, higher values make something more likely relative to others

#

look at the base game's ProceduralDistributions to get a better idea

red jewel
calm depot
#

media/lua/server/<somewhere>

#

your OS can search directories, use it

red jewel
calm depot
#

well, that'll narrow it down enough that a directory search will take less than a second

small topaz
#

I am still working on introducing new body locations and sorting them to get a correct rendering order. could it be the case that sorting body locations via code within the client folder does not affect the rendering order? i have some code sorting the locations which works as intended if I put it into the shared folder but if I put the same code to client, the rendering order is wrong (although the game runs without errors). any ideas?

quartz badge
#

How would i go about making a mod that retextures vanilla clothes

#

I want to make a mod that makes the police uniforms brown like in the Walking Dead

sharp wind
#

Is there a reason why in someone's code they would assign a variable with local stuff = player.getVehicle and player:getVehicle() ?

willow estuary
#

That variable would be what vehicle a player is in if they are in one.

sharp wind
#

Yes, but why the and ?

quasi geode
sharp wind
#

Why not just local stuff = player.getVehicle or local stuff = player:getVehicle() ?

#

it's a typo on my part

quasi geode
#

ah, well the first part player.getVehicle checks if the method actually exists before trying to call it with and player:getVehicle()

#

its a safety check basically

#

that way incase for some reason getVehicle doesnt exist in the player variable (ie: it was passed a incorrect object that wasnt a IsoPlayer instance) it wont throw a exception

#

though its really a odd check, since it would have to actually be a table or some other java object...if player was nil or a number (for example) it would still throw the exception there

sharp wind
#

player is okay to use for MP ?

#

the lua file is in the shared folder

quasi geode
#

huh it entirely depends. lol player is just a variable. so depends what gets assigned to it

sharp wind
#

So it will get run on both client and server

#

well it's a function that gets added to the OnPlayerUpdate

#

So I guess player here will get the right index

quartz badge
#

How could I add more zombie outfits

#

Like say I want a zombie variant that always spawns with a duffle bag and an army helmet, how would I make this variant

grim girder
#

@vivid flarethanks man

sinful vessel
lusty nebula
#

Anyone as any idea where the file/s that manages the credits displayed in the main screen is located/named?

drifting ore
#

I just want a trading mod that functions like true music’s style, where there’s the base mod that adds trading, then mods by other people that add support for specific modded items, while the base trade mod ONLY has vanilla items

#

to be fair, the one mod, currency variety mod, does exactly this

#

but I really don't like how it functions

#

I like having cash as a base for trades

#

Rn I think dingos trade mod has excellent balance, but it requires green fire and britas to function

hollow crown
#

Is there a mod that makes zombies decay over time? Like they start out great and then like 3 months later most of them are dead or really slow

daring palm
#

@quasi geode @worldly olive I saw you guys had problems inserting data in the XPBoost HashMap. I ran in the same problem and I found a workaround for that. I don't know if this is going to be useful for you, but

  1. create a fake profession with ProfessionFactory.addProfession
  2. populate the fake profession's perk-xpboost with the methodaddXPBoost( perk, newPoint )
  3. and then add the profession into player's descriptor player:getDescriptor():setProfessionSkills( fakeprofession )

The only drawback is that when you insert a new profession in the descriptor, it clears the previous table. So you have to make sure to add the previous data in the fake profession's perk-xpboost as well

worldly olive
#

You don't have to worry about that anymore as in the 41.66 build a new function to do that is included 🙂

#

player:getXp():setPerkBoost(perk, boost);

calm depot
#

Oh good, I can't remove embeds on my phone, well shit, sorry for that

small topaz
worldly olive
#

Nope, the addXPBoost adds exactly the same boost but through a trait, this is something that you can use mid-game to add that exact boost to the map

#

Both does the same in different circumstances

small topaz
#

ah...ok... so.... the planned function is for IsoPlayer while the old one is for defining professions/traits...?

worldly olive
#

Yes, this is how you use it:

player:getXp():setPerkBoost(perk, boost);

daring palm
#

are you sure setPerkBoost exists in public class XP

#

I only found getPerkBoost defined

calm depot
#

You have a copy of 41.66?

daring palm
#

let me see

calm depot
#

I think you would know if you did, TIS would have given it to you

daring palm
#

No. I'm using 41.65

calm depot
#

Yeah, because the only people who have 41.66 would have received it personally from TIS

daring palm
#

dammit. That could have saved me a lot of time

worldly olive
#

This will be in the 41.66

calm depot
#

Wait ~one week

daring palm
#

I aware now. Thanks btw

#

wait. How do you guys know which changes in the API will come?

worldly olive
#

It is also included in the changelog:

  • Added IsoGameCharacter.XP.setPerkBoost(Perk perk, int level). This is for mods that want to change an existing player's XP multiplier for a skill.
daring palm
#

I'll keep an eye on that from now on

#

ty guys

worldly olive
#

It is the same as getPerkBoost

sharp wind
#

Why does it not like this at all? It calls it a non-table and won't load the game

VehicleQueries.OnUse = {}

function VehicleQueries.OnUse(player, vehicle, ...)
    local vehicle = player:getVehicle() or nil
    if vehicle ~= nil then
        print("Entered:" .. vehicle:getScriptName())
    end
end

Events.OnUseVehicle.Add(VehicleQueries.OnUse)
drifting ore
#

Someone know how to get players when right click on the world, to add a context option to perform action on an other player. Like when we open the health check menu. I know the event OnFillWorldObjectContextMenu but where to find players that was here ?

grizzled grove
sharp wind
#

No

#

Apparently, OnUseVehicle is not something standard

#

I have to add it to the LuaEventManager first

drifting stump
#

let me get the code

willow estuary
drifting stump
#
local clickedPlayer
for i, v in ipairs(worldObjects) do
  local movingObjects = v:getSquare():getMovingObjects()
  for i = 0, movingObjects:size() - 1 do
    local o = movingObjects:get(i)
    if instanceof(o, "IsoPlayer") then
      clickedPlayer = o
      break
    end
  end
end
#

worldObjects is the var passed to OnFillWorldObjectContextMenu

drifting ore
#

Nice, thx !

sharp wind
#

how do I require something in the server folder of the main game when my lua script is in the shared folder?

drifting stump
#

shared is loaded first so its already loaded or are you importing a module

willow estuary
rotund meadow
#

what's the recommended way to generate a random number in a PZ mod? I tried calling math.random() but it throws an exception.

willow estuary
#

ZombRand(10), for example, will generate a number from 0-9 (yes I know it's confusing 🤪 ).

rotund meadow
#

thank you, that's just what I needed

willow estuary
#

👍

drifting ore
daring palm
quasi geode
faint jewel
#

so can anyone tell me how to tell if a zombie is on the ground rather than standing up?

#

not dead, just knocked over.

sharp wind
#

No wonder I had to add the OnUseVehicle to the luaevent

faint jewel
#

:/

#
                    if zombie and NOTDEAD and ONGROUND then
                        -- do damage and spray blood.
                    elseif zombie and ISDEAD then
                        -- remove corpse and spray lots of blood.
                    end```
#

i need that NOTDEAD and ONGROUND and ISDEAD

#

but not sure how to get them.

drifting ore
#

POV: You just released a mod to help modders and the first ranking is negative

sharp wind
#

likely from a mod user downloading it thinking it's a new toy

faint jewel
#

what mod?

sharp wind
#

his UI library

#

look up a bit

faint jewel
#

i subbed and positived it 😛

#

screw the kids

drifting ore
#

Yeah, I just don't rly get why put a negative ranking like that, if you don't like, don't use

daring palm
zealous pebble
#

Wait so how do you do it. Can you do it without needing to code

#

Or do I still need to edit it in an editor

nimble spoke
zealous pebble
#

Do I just need to change file text then. Or like what. I can do text files

zealous pebble
#

I modded song of syx a lot. Still need to upload it im bad at that

#

Ah. Maybe I can private message you if I have trouble. I can't look rn. But you said it was in the mod folder right?

eager trail
#

Hello. Can someone help me with this? Im learning how to make mods I watched Blackbeard's video on how to make the soda bottle and i figured out how to copy and paste a bunch of other stuff together. Now im trying something different and have created a recipe that calls a function that spits out a few lines of text. Ive got it to work but what im trying to do is get a pause before each line of text is said over the players head. The same way it does for the TV and Radios. Ive looked at the radio code in the PZ files and its a bit more complex then im capable of at the moment.

faint jewel
#

@drifting ore you should make a simple mod that requires your api. that was people can use it as a base.

faint jewel
#

😄

signal frost
# eager trail Hello. Can someone help me with this? Im learning how to make mods I watched Bla...

What you're suggesting to do is a bit more complicated.
The ways this are normally done is through some kind of callback attached to an event.
The event occurs, and it'll execute the callback (your code that says something).
I don't know enough about what events PZ provides, but there's a chance you need to make your own event.
A really simple way to do this is to create a timer either via a task or coroutine or thread or something, that executes your callback when the timer elapses.
Only issue is I don't know if lua is sophisticated enough to do that. I know Java can, so it's a matter of figuring out how to get the lua to call into the java runtime and execute some code.
Ultimately, it may be a pretty in depth undertaking.
Somebody who knows this codebase better might entirely negate everything I've said though

faint jewel
#

zombie:getCurrentState() == ZombieOnGroundState.instance(); this worked. zombie:isDead() this did not.

#

@jagged fulcrum

eager trail
#

@signal frost Yeah thats more then what im capable of.

faint jewel
#

damn that is brutal sounding lol.

#

it goes BRRRRRRRRRRRRRRRRRR when you sit on a zombie.

#

but no dmg. and i want bloods everywhere.

#

zombie:Damage(zombie:getMaxHealth() * 0.9) does not dmg like i had hoped it would.

#

zombie:splatBloodFloorBig() ALSO DOES NOT SPLAT. ugh

#

sigh.

#

zombie:Damage(zombie:getMaxHealth() * 0.9) does not damage, and throws errors. i just want it to yeet blood everywhere and hurt the zombie.

hexed arch
#

Does anyone know if the OnClientCommand event gets triggered for all clients on a server? For instance if one client calls sendClientCommand() do all clients call the function passed in the arguments? I'm having issues having a client action inform the server to have all clients perform that same action.

#

My goal is to have each client create a lightsource to attach to a cells lamppost. Currently only the client who performed the action creates the lightsource so others cant see it.

#

I think I have to make use of OnServerCommand? Have a client inform the server of the action and the server sends out a command to all the clients to do the same behavior?

faint jewel
#

grrrr

daring palm
#
local function createPeriodicEvent( frequency, delay, callback, args )

  local EVENT = {} 

  EVENT.frequency = frequency
  EVENT.delay     = delay * 60
  EVENT.count     = 1
  EVENT.callback  = callback
  EVENT.args      = args

  local run = function(ticks)
    if ( ticks % EVENT.delay ) == 0 then
      EVENT.count = EVENT.count + 1
      EVENT.callback( EVENT.args )
    end

    if EVENT.count > EVENT.frequency then
      Events.OnTick.Remove( EVENT.run )
    end
  end

  EVENT.run = run

  Events.OnTick.Add( run )

end
#

You can use it to say "Hello" 3x separated by a 1 sec delay

#
local function saySomething( phrase )
  getPlayer():Say( phrase )
end

createPeriodicEvent( 3, 1, saySomething, "Hello" )
faint jewel
#

dang it. it sucks when someone puts you on the right path and vanishes lol.

#

omg... it id doing the zombie:splatBloodFloorBig() but it's just a tiny puddle

#

i want SPRAY!

dark crescent
#

Hey all, new to Project Zomboid modding and also new to Lua. Would anyone be able to tell me how i can select the right item from a table via its class?
Eg, I have a table of
1 - zombie.iso.IsoObject 2 - zombie.iso.objects.IsoWorldInventoryObject

but i cant figure out how to select the inventory object

#

I have tried
for i,v in ipairs(items) do if instanceof(v,"IsoWorldInventoryObject") then mycodehere end end
But no luck there

faint jewel
#

me and zombies aren't doing to well either

faint jewel
#

ARGH i need blood spray!

craggy furnace
faint jewel
#

?

eager trail
#

@daring palm Thanks for the reply. Not sure how to get this to work. I copied this to my file and its crashing at this line. Also i need it to say 3 to 5 different lines of text with a 3 or 5 second delay in between. Am i supposed to copy and paste
createPeriodicEvent( 3, 1, saySomething, "Hello" ) the amount of times i want and adjust the numbers as needed?Sorry am noob.

undone crag
dark crescent
#

@undone crag Sorry that was a quick rough type up of what i have tried, not the actual code block. I have been at this for 2 days

#

i have also tried "zombie.iso.objects.IsoWorldInventoryObject"

faint jewel
#

corpses dont count as zombies so yay

#

okay so i found them static moving objects. yay for oxymorons

drifting stump
#

i had to do it to get around media not playing in multiplayer

faint jewel
#

blue = zombie:splatBloodFloorBig() i want more of the green than the blue. i want sprays

shut valley
#

have floats for xyz

faint jewel
#

okay... would that not just be the position?

#

i mean if you can tell me how to make the come from under my character and shoot out 90 degrees to the left. you would be a god.

#

to my right.. sorry

craggy furnace
faint jewel
#

is there a way to reload a vehicle lua ingame?

grizzled grove
faint jewel
#

how would that be used though lol

grizzled grove
#

a bit out of my range, sorry

faint jewel
#

that DOES seem more like what i am after.

#

it's used in 0 files XD

#

greeeeat

#

lol

grizzled grove
#

owait, that's wrong

#
public class IsoBloodDrop extends IsoPhysicsObject {
    public float tintb = 1.0F;
    public float tintg = 1.0F;
    public float tintr = 1.0F;
    public float time = 0.0F;
    float sx = 0.0F;
    float sy = 0.0F;
    float lsx = 0.0F;
    float lsy = 0.0F;
    static Vector2 temp = new Vector2();

    public IsoBloodDrop(IsoCell cell) {
        super(cell);
    }
shut valley
#

inb4 blood geyser because of test numbers

faint jewel
#
    float sy = 0.0F;
    float lsx = 0.0F;
    float lsy = 0.0F;

what are thoooose?

grizzled grove
#

not entirely certain. i remember seeing someone talking about it with teleport stuff, but can't recall the details. some coordinate trickery

grizzled grove
faint jewel
#

wait an iso object... that's what i would detect. not what i created.

#

is there not an IS coder that hangs out here?

tranquil reef
#

I'm trying to make two traits that are opposites, for example one is "Big" and the other is "Small", both of these can be enabled though which obviously doesn't make sense. The vanilla game handles this by removing the opposite when one is enabled, so grabbing "Overweight" removes "Fit" from the list, how can I do that for modded traits?

faint jewel
#

theres an exclusive option.

#

taht you can make it here it can't be used with the listed traits.

#

if i remember correctly.

faint jewel
#

isCorpse:removeCorpse()

#

how the hell do i get rid of a corpse if none of the commands work?!

#

                    -- corpse removing
                    local corpse = square:getStaticMovingObjects()
                    for index=0, corpse:size()-1 do
                        local isCorpse = corpse:get(index)
                        if instanceof(isCorpse, "IsoDeadBody") then
                            print("Dead go Splat!")
                            print(corpse)
                            isCorpse:removeCorpse()
                            vehicle:playSound("mower_fatality")  
                        end
                    end 
grizzled grove
#

the Throw Them Out the Window mod comes to mind, maybe you can glean something from that?

faint jewel
#

uses timed things

#

but is an idea

#

self.character:getInventory():Remove(self.corpse)

#

nvm lol

#

that's how they do it is remove it from inventory.

grizzled grove
#

oh, does the mod have you pick up the corpse first?

faint jewel
#

yeah you gotta pick em up to throw em out the windows lol.

grizzled grove
#

ah, sorry

faint jewel
#

hey at this point... ANY idea is a good idea.

#

isCorpse:removeFromWorld() doesn't give an error, but... doesn't remove it either.

#

soooo... other than the blood... it's done.

#

and i want a MONSTER blood splat. where are those set at?

#

addBloodSplat(sq, 15); there are in the scenario luas.

#

10.12.17.13.15. those are the only types listed.

#

or used at least.

rain current
#

hello all, been spending the last couple days learning all i can about PZ modding, but have run into a few snags if anyone has a moment to help.
I'm having trouble understanding how to implement some things like Event listener functions and executing functions from the GlobalObject fom within Event functions.

faint jewel
#

this channel has been mostly me talking to myself lol.

tranquil reef
#

how do I print values? I'm used to using lua print("This value is: " + valueInt) but that is giving me an error

faint jewel
#

print("This value is: ",valueInt)

tranquil reef
#

Alright, thanks

rain current
#

I was going for a basic goal of sending chat a message when a player joined the server. I tried something like this in my client lua ```local function announceArrival()

processGeneralMessage("...has joined the server.")

end

Events.OnChatWindowInit.Add(announceArrival)```

#

or with OnConnected as well

#

but i get Caused by: java.lang.NullPointerException: Cannot invoke "zombie.chat.defaultChats.ServerChat.createServerMessage(String)" because "this.serverChat" is null

faint jewel
#
                            addBloodSplat(square, 17)
                            addBloodSplat(square, 15)
                            addBloodSplat(square, 13)
                            addBloodSplat(square, 12)
                            addBloodSplat(square, 10)
``` the red circle is ALL of those.
#

they are ALL the same.

faint jewel
#
    AddBlood

    public void AddBlood(int wx,
                         int wy)

    addBloodSplat

    public void addBloodSplat(float x,
                              float y,
                              float z,
                              int Type)

where would i find where those types are defined?

signal frost
pulsar niche
#

Do we have a mod which tells the days left of perishable foods?

#

Awesome!

faint jewel
#

LOL

drifting ore
#

How do you name/call a lua table with only numerical key (using table.insert) ? And a table with string as key (using table["key"]=value) ?

#

A numerical table ?

faint jewel
#

okay in what way?

nimble spoke
calm depot
#

@drifting ore you mean you want to insert a value at a specific place?

table.insert(table, X, value)

#

where X is the number to insert it at, values are shifted, not overwritten

#

you can't shift non-integer keys, you'd have to do 2 assignments

table.newKey = table.Key table.Key = newValue

faint jewel
#

i wish my stuff wasn't so engine dependant 😦

calm depot
#

what?

faint jewel
#

trying to make blood spray where i need it to.

#

but i can't even create it correctly.

#

i want something like the green area,

calm depot
#

sounds like something you'd need to do in Java, I don't think Lua has quite that much granularity exposed to it

faint jewel
#

this is the best i can get lol. and it's with a mod.

drifting ore
#

No I mean, is there a term for table with only numerical key from 1 to x (I call it a vector or 1D array). And a term for table with only string as key ? Maybe there is not

faint jewel
#

and it was actually 3 zombies in tht shot.

#

the one on the bottom side is the size that it makes.

calm depot
#

@drifting ore no, Lua doesn't care, there are only semantic behaviours

#

e.g.ipairs() will ignore non-numeric keys and stop if there's a gap

drifting ore
#

Yeah I know that everything is table, there was maybe just a name for this type of table

calm depot
#

I suppose you can informally refer to it as a pure array table

faint jewel
#
     
addBloodSplat(float, float, float, int) - Method in class zombie.iso.IsoChunk
     
AddBloodToMap(int, IsoChunk) - Method in class zombie.VirtualZombieManager```
calm depot
#

if it has contiguous indexes starting from 1

faint jewel
#

i use addBloodSplat

calm depot
#

the only things I can think of that only work "properly" with a contiguous array table are ipairs(), the # operator and unpack()

#

although you can exploit that fact to include additional data that you don't want to iterate

#

using ipairs/#/unpack on {1,2,3, x = 5} will produce identical results to {1,2,3}

willow estuary
calm depot
#

heh, well you could equally use the __index metamethod too, but the former is a bit faster to execute

#

e.g. setmetatable({1,2,3}, { __index = {x = 5})

faint jewel
#

is it possible to create an isomoving object and make it move?

#

Class IsoBloodDrop

calm depot
#

IsoMovingObject has a Move function that takes a Vector2 - I don't see why not

faint jewel
#

if i could create a few of those with different velocitys.... i think that would be what i need.

calm depot
#

you might want to use setNx and setNy then, the Move function applies the game's time to determine how fast it should be

faint jewel
#

doy ou know of a mod that does something like that?

calm depot
#

nope, I'm just reading the code

faint jewel
#

i can see throwable and stuff but not quite what i want.

#

lol

zinc token
#

Tracked down the problem of cheat menu having errors to my wallet mod
Item also no longer appears in inventory in previous saves where I had it
Anything wrong with this code?

faint jewel
#

i would copy the keyring.

#

but what you have looks right?

zinc token
#

It was working fine yesterday, I changed the weightreduction from 10 to 1 and went to bed. Woke up and the problem started.

willow estuary
#

I mean, don't literally use "module [BLANK/NOTHING]", but you likely need a module defined for your item to work properly.

zinc token
#

So do I type anything in there or is there a specific type I need to use? I've made some other items and they work fine with the module blank.

willow estuary
#

Huh, well, I don't know? I don't have any experience with items without modules, but the whole engine is designed around items having them?
Maybe it's automatically assigning module Base to your item.
But I'd suggest getting in the habit of using modules to avoid any zaniness that this may be responsible for.

#

Myself, I use module Base for almost everything, unless I have a reason to do otherwise, in that it overall, for most purposes, makes things "simpler".

calm depot
#

disgusting 😏

#

Modules are basically namespaces, use them to avoid conflicts

#

I always use them, to avoid overlapping with shit injected by people like you 😛

daring palm
#

@eager trailthe createPeriodicFunction function is working fine because it uses no global variables whatsoever. There must be something within your code.

I'm going to provide you an example related to what you want

  1. create a list of phrases to be said
local moods = {
    'good',
    'bad'
}

local saying = {
    [moods[1]] = {
        "Today I feel bad",
        "It looks like I'm going to",
        "DIEEEEEEEEEEEEEEEEE"
    },

    [moods[2]] = {
        "Beautiful day",
        "I think I'm going to relax"
    }
}
  1. create the callback function
local function saySomething( args )

    local phrase = args.phrases[ args.index ]
    args.index = args.index + 1
    getPlayer():Say( phrase )

end
  1. invoke it
local whichMood = ZombRand( #moods ) + 1
local mood      = moods[ whichMood ]
local phrases   = saying[ mood ]

createPeriodicEvent( #phrases, 3, saySomething, {phrases = phrases, index = 1} )
calm depot
#

Pastebin, please

daring palm
#

sry

calm depot
#

also, why wouldn't you just write sayings = {good = {<stuff>}

#

it only makes sense if you're iterating or the values are known only at runtime

daring palm
#

not a proficient in lua. That's a good advice though

zinc token
#

Added it but I'm still getting errors

willow estuary
calm depot
#

don't put it in base, and at the very least, don't import Base from Base

willow estuary
#

If nothing else, there will be "warn" messages in console about "Module Base imports itself" which will have people who are combing their console logs trying to fix their servers and such coming to you about the message.

calm depot
#

I hope from the sentence itself it is apparent why that is nonsensical

#

just don't put your stuff in Base, there's absolutely no justifiable reason to do so

zinc token
#

What should I put it in?

calm depot
#

it's arbitrary, whatever you want

faint jewel
#

Module Wallet

#

😄

#

solved

calm depot
#

module MyCoolAssMod

zinc token
#

Ohhhhhh

calm depot
#

just don't choose something that already exists and is used by something else

rare sleet
#

A good bet would be whatever your mod's ID is

calm depot
#

^this

faint jewel
#

module RidingMower

#

😄

zinc token
#

Should I still import base or remove that part? Module is currently "WAL"

faint jewel
#

well if it's not base anymore, importing doesn't hurt.

willow estuary
calm depot
#

if any of your stuff relies on something in Base, yes, if not, no, doesn't really matter if you import it anyway, though.

#

unless you really want to name an item the same as something already in Base

zinc token
#

Still doesn't work, is "WAL" already in base?

calm depot
#

what doesn't work?

zinc token
#

Cheat menu giving me errors when opening the item spawner and the item vanishing on previous saves that I had said item on

calm depot
#

What errors

nimble spoke
calm depot
#

Sounds like you have more going on than just that simple script file

zinc token
#

It just shows a red error msg in the corner

calm depot
#

Press F11 or open the console log

zinc token
#

F11 doesn't do anything
Also here

faint jewel
#

HMMMMMMMMM idea.

#

i wonder if i can FAKE a spray

#
                                addBloodSplat(square, index)
                            end```
i wonder if i can get that to start small and go to the right of my character increasing in size.and going out a little with each iteration.
#

it would LOOK like a spray

#

just WAY bigger.

calm depot
#

@zinc token I don't know what cruciblecore is, but it has broken code

zinc token
#

Hmm, odd. If I disable the wallet mod item spawner works fine. I only have CheatMenu, 2 of my other mods and the wallet mod installed when it happends

#

I also have no clue what cruciblecore is either

nimble spoke
#

Try removing the DisplayCategory value

#

item spawner breaks for anything basically and I think there are no text entries for that category

zinc token
#

Nope, still get an error/spawner not opening

shut valley
faint jewel
#

yeah that's changes the index.

#

but i do each of the index in that and they are all the same.

#

notice they are all the same just stacked.

shut valley
#

did you increase the 0.5?

#

since i would guess that means 0.5 of a tile

faint jewel
#

yeah

#

that's what i am doing now.

#

it would LOOK like a spray

#

HMM

#

sooo it sort of works?

#

but it needs work.

shut valley
#

if it ends up making to much blood you could add a condition on top and make it create blood if a random number is hit

#

this should add more variance to the splatter

faint jewel
#

it only does two.

#

and they ALWAYS go in that direction.

shut valley
faint jewel
#

yes

#

my detection square is always infront of my vehicle.

#

dm'd you a pb of what my lua looks like.

#

85-91 are where i am trying to fake it.

shut valley
#

and see how they change

#

during driving?

#

the x y coord

faint jewel
#

what the newx and newy are? or xxx or xx?

shut valley
#

yes the numbers you get

#

see if they are updating like you would expect

#

once the car starts rotating

faint jewel
#

well again... which variables?

shut valley
#

newx ,newy since those are the ones for the blood right?

faint jewel
#

well those are only created when you hit a corpse

calm depot
shut valley
zinc token
#

I fixed the cursed wallet
Turns out the Mod ID "WAL" is already in use and upon changing it, it worked.

I'm amazed at myself on how it took me 2 hours to figure this out

faint jewel
#

lol might i say... i suggested one earlier LOL

zinc token
#

I must've missed it, WAL is probs in use for some wall tile mod or something

vapid vault
#

What MP mod are people using for locking player made doors and gates? We had one on the server I'm on, but it vanished from workshop... (Sorry if wrong channel)

faint jewel
#

if i can get the angle right... this might work.

shut valley
#

that looks like decent splatter

faint jewel
#

sigh.

#

this is the closest i can make them. i wish they could be closer... but the angle is WAY more important.

zinc token
#

Question How does one create a custom category for an item?
I'd like for, lets say, an ID card to have "Documentation" next to it instead of "Literature".

faint jewel
#

TweakItem("Base.Animask1","DisplayCategory","ClothA");

#

but that requires a mod.

willow estuary
# zinc token Question How does one create a custom category for an item? I'd like for, lets s...

This is an example of a custom display category I use in an item script

item 100_DollarBundle
    {
        DisplayCategory = Money,
        Weight            = 1,
        DisplayName     = Bundle of $100 Dollar Bills,
        icon             = PA_BillBundle,
        Type            = Normal,
        WorldStaticModel = PA_BillBundle,
        StaticModel = PA_BillBundle,
    }

And here is the IG_UI_EN.txt file I have in \media\lua\shared\translate\EN

IGUI_EN = {
    IGUI_ItemCat_Money = "Money",
}
faint jewel
#

https://pastebin.com/X9MwsWEa lines 85-92, how do i get the to come out 90 degrees to the right of the vehicle? and more varied art would be nice too.

#

if one of those rednames has an idea how to do the blood chunk that spawns blood that would be WAY better but this is what i have.

zinc token
willow estuary
zinc token
willow estuary
#

And changing the category item also changes how the game engine handles it, what parameters it can have, etc.

#

Oh, I don't believe that you can make new item Categories; new Display Categories yes, but the actual item Categories are hardcoded in java.

#

1 second, I'll show yu something

#

This item used the AcceptItemFunction parameter to dictate what kinds of items it accepts; my custom lua Accept_Wallet function is used to determine if an item can go into it.

    item Wallet_pa
    {
        Weight    =    0.2,
        Type    =    Container,
        DisplayName    =    Wallet,
        Icon    =    Wallet_01,
        StaticModel = Wallet,
        WorldStaticModel = Wallet,
        Capacity = 1,
         AcceptItemFunction = Accept_Wallet,
    }

And here is a simplified version of the lua code I use

function Accept_Wallet(container, item)
    local iType = item:getType()
    if iType == "Meth" or iType:contains("Baggie") then return true end
    local weight = item:getWeight()
    if weight > 0.1000001 then return false    end
    return  item:getDisplayCategory()=="Money"
end 
#

I have the weight check so heavier Money DisplayCategory items, like my bundles of bills, cannot be put into the wallet.

#

So you could have AcceptItemFunction = Accept_Documentation as a parameter for your item, and

function Accept_Documentation(container, item)
    return  item:getDisplayCategory()=="Documentation"
end 
zinc token
#

Hmm, which .txt would the function code go in?

willow estuary
#

It would have to be in a lua file in one of the lua directories.

#

Just a text file with the above code in it, but with .lua instead of .txt at the end. Probably any of the Client, Server or Shared lua directories would work, /media/lua

zinc token
#

Thanks, works perfectly! Now people can't shove whole books into their wallet 🙂

willow estuary
#

😄 👍

inland crater
#

It's super disappointing that discord is used to share all this information

#

because it's literally impossible to read all of this and a ton of important info is missed out on by 99% of people interested because its posted in here :/

#

The only thing I can find on search engines is a bunch of scattered documents either pointing here or a forum post from 2013, in no way detailing the most up to date methods. Half finished github readmes and wiki entries

faint jewel
willow estuary
#

Ultimately it's up to the people who are willing to create guides and resources to create them; we're attempting to have a centralized repository here, but it's up to the community to contribute to it.
https://pzwiki.net/wiki/Modding

But also, the current build of PZ is definitely not the PZ that will be 1.0, a lot of this stuff may be obsolete by then. I'm not sure that many comprehensive guides would have a shelf life with that in mind?

#

There's multiple things that change different aspects of modding in the patch notes for the upcoming 41.66 build.

inland crater
# willow estuary Ultimately it's up to the people who are willing to create guides and resources ...

There's a constant flow of information in here that is swept upwards into the abyss that will only exist for that single conversation, no one else that could use that information will find it. Important tidbits that could be useful to everyone, things people didn't even know they might need are lost in here. If you're lucky enough to find it in the search feature, it's spread between half broken conversation or ignored.

#

In a forum at least the most relevant information is pushed to the top

willow estuary
#

People use the Discord more than they use the Forum, it's just the way it is.

inland crater
#

Discord isn't a replacement for forums

chrome egret
#

The only way that situation gets better is for people to write out their findings in a more concrete medium

inland crater
#

It's a chat room

chrome egret
#

So I have helped MrBounty update his docs on UI window creation, and I plan to flesh out the Translations text file explanation as well

faint jewel
#

this is gonna make me mad 😦

#

SO close.

inland crater
#

Think about how many people could actually help write in those mediums assuming they could at least search on Google ya know? I'm just saying we should make more of an effort to keep the forums up to date

#

There is no up to date information on modding on that search engine

#

Everything dates back to at least 2015*

willow estuary
inland crater
#

Yeah that

#

That's great, it's a great starting guide

#

for starting off

#

setup your IDE and here's the docs, but it's not living documentation that stems from user interaction

#

"Hey, is there a better function I can use to call http endpoints? I'm doing so and so but seems buggy, anyone got advice?" "Yeah! It's this function: and you can do so and like this" vs "heres the java docs and lua events listt"

minor spindle
#

is there a function to get the actual time in a precise moment like os.clock?

inland crater
#

it's a great wiki, and im happy to have it

#

damn see that

#

but no one else is going to have an answer to what that guy is asking, what he just asked for will disappear upwards

minor spindle
#

I already searched in different places, even in the game code

willow estuary
#

Well if you have any proposals or concrete suggestions to encourage people to utilize the forums as some sort of centralized modding repository, I'd suggest bringing them to @iron salmon as they're the community manager? I'm just a channel janitor.

zinc token
# willow estuary 😄 👍

Funnily enough I just noticed your the creator of the same money mod we're using on for a server I'm devving for
Which the upgraded wallets I'm making for my ID pack are expanding off
Small world eh?

inland crater
#

I know I was just hoping to open a dialogue about it

willow estuary
inland crater
#

I think it would be cool to start encouraging people to also make a post on the forum with the question they'd asked. If they're willing to do it, that would be better than not at all. Someone could just copy and paste a reply. That's just an idea

inland crater
#

start consolidating information there at least, most up to date stuff as of 2022, links to the wiki, other resources that are scattered from the steam forums, to reddit and other places

tame mulch
#

Yeah, some people started collect resources about modding. Maybe need complete this on pzwiki

faint jewel
#

sigh.. still straight down. but it makes for fun screenshots.

daring palm
#

I got a question about UI. I'm injecting a button into ISCharacterScreen.render function.
The button renders fine, but the click action doesn't work. Does anyone have some idea why? Here's the injecting code

function ISCharacterScreen:render()

    original_ISCharacterScreen_render(self)

    local w = 75
    local h = 30

    local button = ISButton:new( 300, 200, w, h, "My button", self, btnclick )
    button.internal = "MYBUTTON"
    button:initialise()
    button:instantiate()
    button.borderColor = {r=0.7, g=0.7, b=0.7, a= 0.5}
    self:addChild(button)
end
inland crater
minor spindle
tame mulch
tame mulch
inland crater
#

The wiki is solid but it should be maintained by trusted people, where the forum should contain caveats and off the wall information from whatever people need to ask about, it would allow all this information to be search indexed

#

anyway i'll stfu now

minor spindle
#

to measure the time elapsed since I called a function

tame mulch
last grove
#

Hi peeps, is there a way to make a recipe possible with one of the items being on the floor?

willow estuary
daring palm
inland crater
#

Is Zomboid on JDK 8 or 18

last grove
willow estuary
last grove
#

hahah they really arent on the server but whats life without challenge

minor spindle
tame mulch
inland crater
#

thanks

faint jewel
#

? blood.

#

lawn mower + zombie = bloods errywur.

rain current
#

hello, i am trying for a basic goal of sending chat a message when a player joined the server. I tried something like this in my client lua cal

function announceArrival()
    
    processGeneralMessage("...has joined the server.")

end

Events.OnConnected.Add(announceArrival)

but i get Caused by: java.lang.NullPointerException: Cannot invoke "zombie.chat.defaultChats.ServerChat.createServerMessage(String)" because "this.serverChat" is null

What am i doing wrong?

errant meteor
faint jewel
#

hah

#

it's got the ui over it and it's darker too.

tame mulch
rain current
#

well the weird part is i can get it to work in other client side events. like OnGameTimeLoaded i can call processGeneralMessage

#

that is from the client lua

tame mulch
faint jewel
#

i just want it to come out the side the that no matter which way it's facing.

#

it's ALWAYS down.

rain current
#

i think OnGameTimeLoaded only loads once per server start right not each time a player connects? not sure

nimble spoke
# faint jewel

Isn't facing angle one of the parameters it accepts? I have not read what you posted before but I guess you're the one supposed to give it an angle

faint jewel
#

give what an angle?

#

it's not legit blood spray... i would LOVE that.

zinc token
#

Would anyone know how to make a universal storage system?
Example;
I'd put something into an ATM Storage box in Rosewood, drive to Muldraugh, go into the ATM there and see the item I placed in Rosewood

faint jewel
#

since it would interact with the gore settings in sandbox mode.

#

i had to cheat as i don't thinkl those are accessible.

#

but PLEASE prove me wrong lol.

errant meteor
hollow shadow
#

Cant wait for the new happy wheels mod

faint jewel
#

lol its super close.

#

if i can get the spray to go the right direction....

#

then it's party time.

#

then we'll go all the way.

faint jewel
#

I wish one of the red names would step in and say "oh hey here's the fix to that. this will make blood spatter just right."

#

and then provide code. XD

errant meteor
faint jewel
#

hahahaha

#

well if i can figure out why my code the reads the front of my vehicle wont spew blood out the side... i'd be happy too.

placid hinge
#

Anyone know a way to set a mag to be full via a recipe by chance?

drifting ore
#

Or to the world

#

Cus I imagine the vehicles orientation to the world isn't like

#

Dynamic

#

Idk vehicles are weird

faint jewel
#

everything i use is in the pastebin.

azure rivet
#

Hello, I am creating a clothing mod and for an outfit that is only placed on the shoulders, I do not want the "BloodLocation" to be placed on the lower torso, do you know what this category is called?

willow estuary
azure rivet
willow estuary
#

Huh. 1 second

#

UnderwearTop might work; from looking at the vanilla clothing scripts it looks like Blood Locations uses the Clothing Body Locations.

drifting ore
#

Weird

#

Why can't the just standardize this bored bored

rain current
#

anyone familiar with creating chat messages programmatically? having problems finding a way to do so with the Events system

#

more specifically i want to create a chat message upon user conn/dc from the server

#

I tried something like this in my client lua

    
    processGeneralMessage("...has joined the server.")

end

Events.OnConnected.Add(announceArrival)

but chat is not available yet here i guess.
I've tried numerous other events but none seem to work for what i need. If anyone has some insight i would be greatly appreciative

willow estuary
# placid hinge Anyone know a way to set a mag to be full via a recipe by chance?

Here is a super simple example, I'll leave it up to you to flesh it out and complete it.

  1. The important thing is the OnCreate part of your recipe; example recipe:
    recipe Fill Magazine
    {
        9mmClip,
        Result:9mmClip,
        Time:20,
        OnCreate:Fill_Magazine,
    }
  1. The above code needs a lua file in one of the lua directories with this lua function in it; media/lua/server is where the vanilla recipe lua code is for example.
function Fill_Magazine(items, result, player) 
    result:setCurrentAmmoCount(result:getMaxAmmo())
end
willow estuary
azure rivet
willow estuary
#

👍

faint jewel
#

wanna take a look at mine blair? you seem to hit it on the head for everyone else lol.

#

i just wish there was like a "debug.drawline" or something.

#

so i can see where that code is pointing

willow estuary
#

Sorry, that's not anything I have any experience with?
All this other stuff dovetails with my own work.

faint jewel
#

lol was worth a try XD

drifting ore
#

me and some friends are extremely new to project zombiod is there any recommended special infected mods that can help spice up the game?

faint jewel
#

terrorzeds but it's went awol.

drifting ore
#

awol?

faint jewel
#

absent without leave.

drifting ore
#

can you link something that is still good? or??

faint jewel
#

no where to find it.

drifting ore
#

well is there any other special infected mods?

faint jewel
#

authenticz

drifting ore
#

can you link it?

dark crescent
#

Morning all, starting day 3 of trying to figure this out. Would anyone be able to tell me how i can select the right item from a table via its class?
Eg, I have a table of
1 - zombie.iso.IsoObject 2 - zombie.iso.objects.IsoWorldInventoryObject

but I cant figure out how to select the inventory object

chrome egret
#

Can you provide more context on how the table is generated in the first place, where it's being invoked, etc.?

dark crescent
#

Im getting it from a grid square that i get from the context menu location. Im trying to interact with inventory item on the ground but when iterating i get errors because i dont know how to ignore the IsoObject in the iteration

#

local items = square:getLuaTileObjectList()

chrome egret
#

Have you taken a look at ISWorldObjectContextMenu.createMenu?

#

Perhaps more importantly, ISWorldObjectContextMenu.fetch

#

There's a ton of code in there that has to do with figuring out what sort of object is being handled

#

I see lots of calls to instanceof

dark crescent
#

I have tried quite a few different intanceof variations with no success thus far.
I havent looked into ISWorldObjectContextMenu, I cant seem to find a reference to it anywhere. Im using https://zomboid-javadoc.com/41.65/ and jd-gui on the decompiled code as my references, am I missing something here?

chrome egret
#

Are you only looking in the Java code? I found ISWorldObjectContextMenu.lua under <ProjectZomboid install dir>\media\lua\client\ISUI

dark crescent
#

Yup, just added the media folder to my references and up it popped. Feel a bit stupid on that one, at least I have a lot more to work with now. Thanks for the help, I knew it would be some simple mistake.

chrome egret
#

No worries man, I'm coming at it from the flip-side of you. I've done a lot of digging in the lua but basically no work getting set up to look at the Java and dive in.

faint jewel
#

who would be the best person to poke at for that spray angle thing?

#

like... whos big daddy lua?

#

or big mama..

worldly olive
#

Hey there! does somebody knows if there's a way to change the isValid for the ISClimbSheetRopeAction.lua that applies for both the option in the context menu and the button E? The changes that I make to that function only applies for the "Climb" in the Context Menu but doesn't apply if the player press E 🤔

faint jewel
#

okay question... can i spawn an object and then MOVE it on update? if so how?

chrome egret
daring palm
nimble spoke
worldly olive
# chrome egret Can you provide a little more context? How are you operating on it currently?

Basically trying to override the isValid with this:

function ISClimbSheetRopeAction:isValid()
if not player:HasTrait("Obese") or not player:HasTrait("Very Underweight") then
if self.down then
return self.character:canClimbDownSheetRope(self.character:getCurrentSquare())
end
return self.character:canClimbSheetRope(self.character:getCurrentSquare())
end
end

If I do this I can avoid a player that has the trait "Obese" to climb the rope sheet if it is done using the context menu but I can't avoid the player to climb by pressing E

worldly olive
daring palm
#

but the vanilla function won't work because it's only appliable to the context menu action

#

Have you tried to disable the flag on IsoWindow to force the java function canClimbSheetRope to fail?

#

I think Ive made something "similar" with IsoFire

#

I've changed the flag of a square to "water" to never flame a specific spot I wanted to

#

and it worked

worldly olive
daring palm
#

There are flags associated with some "objects" like IsoWindow and IsoSquare

#

lots of java functions test those flags to perform an action

#

you can manipulate those flags

#

if you erase the flags like climbSheetTopW, climbSheetTopN ... associated with the IsoWindow, then the climbing function will fail always even though thereis a sheet rope there

#

this is good because now you can apply your custom logic bypassing those checks or replicating them accordingly

#

to make things less complicated, I'll tell you my problem. Basically speaking, I wanted to make a specific square not flammable. The problem is that I can't change the IsoFire class because it is java coded. However, I can manipulate the flags so that the IsoFire fails while checking to flame the spot

#

It's an indirect way to achieve what you want

worldly olive
#

But, my question is, if you do that, you can decide when it is valid and when it is not? I mean, you say "then the climbing function will fail always even though thereis a sheet rope there", the "always" word is the one that makes me doubt

daring palm
#

you got control over the context menu. So you're placing your logic there. You can return true

#

as you're doing

#

since it fails, you can now have the opportunity to KeyPressedEvent on key E and execute the action

#

but you'll need to check at least if there's a sheet rope in front of you

#

and execute player:climbSheetRope or player:climbDownSheetRope

worldly olive
#

Hmmmm, interesting, will take a look at that and see if the effort is worth it

#

Thanks for the suggestion

daring palm
#

yeah. It's much more complicated to the IsoFire thing, but I think it's achievable

faint jewel
#

is it possible to reload vehicle luas without restarting PZ?

frail widget
#

how do i start making amod

faint jewel
#

okay, in need of the assistance here... how would i create a 3d object (not a sprite) and then save that object to a variable that i can then move as needed.

rain current
#

can anyone help me figure out how to use something like (from the javadoc) zombie.network.GameClient.sendWorldMessage in LUA. I'm having a hard time understanding how to use anything from javadocs other than what's exposed from zombie.Lua.LuaManager.GlobalObject

faint jewel
#
            local deltt = {}
            deltt[1] = math.sin(math.rad(angle))
            if math.abs(vehicle:getAngleZ())  > 90 then
                deltt[2] = -math.cos(math.rad(angle))
            else
                deltt[2] = math.cos(math.rad(angle))
            end
            local xxx = vehicle:getX()
            local yyy = vehicle:getY()
            xxx  = math.ceil(xxx + 0.01*deltt[1])
            yyy =  math.ceil(yyy + 0.01*deltt[2])```
would this NOT get directly ahead of me by 0.01? and if so where doe it lose the angle?
rain current
#

yo skiz how long have you been asking questions in here?

#

are there better times or days? seems pretty dead

faint jewel
#

it usually is.. but sometimes it helps my brain to ask the abyss.

#

the groups that i COULD ask for help hide behind paywalls.

faint jewel
#

how do i make words appear over a characters head?

faint jewel
#

that's how my angle code works.

daring palm
daring palm
faint jewel
#

so my angle works.

#

but why is it not spewing out he right WAY?!

#

ugh

#

hotdog, would you mind checking out my pastebin?

#

all the blood id going at the same angle. straight down

#

if i;'m going in the direction of blue. the blood goes the green path when it should go red path. the problem is... it does that on ALL directions.

chrome egret
#

Have you printed the generated values to confirm they are what you expect?

faint jewel
#

yeah but they al;ways say the same when they SHOULD change.

shut valley
#

is that portion working?

faint jewel
#

?

shut valley
#

if i remember that code was also used in your portion for detecting the cutting square?

#

and that was working(?)

faint jewel
#

wit cuts the grass fine.

shut valley
#

but does the number do a 360 when you turn since you are using the angle of the car?

faint jewel
#

no

#

0-90-0

#

or 0 to -90 to 0

#

okay soooo,.... i THINK i might be on the right ISH track

hearty herald
#

Is the car turn in radians? Does it use quaternions or something else?

#

Because the math can be very different

faint jewel
#

well it has two deltas.

#

delta 1 = 1 or 0.

#

delta 2 it the 0-90

#

or 0 - -90

hearty herald
#

One more thing, you might be grabbing the wrong axis if it always goes the same way.

#

Say, roll & pitch instead of yaw

faint jewel
hearty herald
#

You could make it spit out the values, then in debug rotate the lawnmower with the car debug

faint jewel
#

well i have it so if delta1 is 1 it srays in front of you. but delta1 = 0 and the blood goes no where.

#

print("D1: ", math.ceil(deltt[1]) ," -- D2: ", math.ceil(deltt[1]) ," -- A: ", math.ceil(angle) , " -- X,Y:" , math.ceil(xxx) ,",", math.ceil(yyy) ," -- ax, ay: ", math.ceil(vehicle:getX()),",",math.ceil(vehicle:getY()))

#

i call ALL of the relevant variable there.

#

i mean i could stream if you want o see it?

faint jewel
#

and to the wind they go! lol.

hearty herald
#

I assume ISOMovingObject is what cars are?

faint jewel
#

what line?

hearty herald
#

Not in your code, just in general

#

Because it has some potentialyl interesting methods, such as "getFacingPosition" "getFutureWalkedSquare" and "getHitDir"

faint jewel
#

i THINK yeah?

#

i am having fun in my anger with code.

hearty herald
#

Either way my personal intuition when it comes to dealing with angles is that it's usually better to use build in matrix/vector classes to handle it for you. You get a position vector and add direction vector multiplied by velocity, voila.

faint jewel
#

well i have those.

#

local angle = vehicle:getAngleY()

#

local xxx = vehicle:getX()
local yyy = vehicle:getY()

#

position and angle

#

no idea how o add 45 degree to the right.

hearty herald
#

It'd be something like, newPos = oldPos + (Matrix3f(1,0,0).rotX(angle))

#

Though I think it should be rotZ in zomboid probably, and it assumes that positive X is forward

faint jewel
#

roty gets the correct rotation ingame.

#

just the numbers are weird

hearty herald
#

If it's not radians I would say it's a pain to work with

#

-360 to +360 is slightly better I guess

faint jewel
#
local angle = vehicle:getAngleY()
            local deltt = {}
            deltt[1] = math.sin(math.rad(angle))
            if math.abs(vehicle:getAngleZ())  > 90 then
                deltt[2] = -math.cos(math.rad(angle))
            else
                deltt[2] = math.cos(math.rad(angle))
            end
            local xxx = vehicle:getX()
            local yyy = vehicle:getY()
            xxx  = math.ceil(xxx + 0.01*deltt[1])
            yyy =  math.ceil(yyy + 0.01*deltt[2])```
that's how it's getting it.
#

via radians.

hearty herald
#

Radian usually go from -π to +π iirc

#

is AngleY the yaw?

drifting ore
#

Iirc because PZ is isometric

#

What would be like

#

"Up"

#

Is technically sideways?

hearty herald
#

Z is usually up

#

I think it is in zomboid too

drifting ore
#

Idk Isometrics are hard

hearty herald
#

because XYZ in world, and each Z is one level upwards

faint jewel
#

deltt[1] is a line that cuts it in half.

hearty herald
#

Is it possible to get quaternion instead of angle?

faint jewel
#

so you get -90 to 90 forboth d[1] and d[0]

drifting ore
#

Quaternions seem like a harder solution lol

#

Quaternions on their own are already kind of confusing

hearty herald
#

Simpler programatically

#

Because you'd jsut be using built in functions of the java library for vector math they have

drifting ore
#

I still think its an issue with how vehicle angles work

#

Like interpolating the direction of the vehicle relative to the world

#

Some games have the rotation based on Vehicle-To-World

#

Well, most

#

So the vehicle has a changing angle relative to the world

#

But some games Ive seen do it backwards

#

Where its like, rotation relative to its starting position

#

Which can be some arbitrary angle

hearty herald
#

That's a weird one

#

Angles should always be based on the center of the objects though 🤔

faint jewel
#

that would get a facing position i think.

hearty herald
#

Yeah that's the function I saw that looked interesting, well one of them

boreal egret
#

Out of curiosity. How much of a nightmare would it be to remove the health bar entirely from PZ? Ghetto or not, how baked into death and other mechanics is it?
Necessary for a med overhaul, which would probably be nightmarish.

drifting ore
#

A lot of the stuff thats hardcoded into the game is unchangeable

#

Iirc UI layouts is part of that

boreal egret
#

I figure you could do a ghetto fix of just making it stay maxed. Yeah. I wasn't sure if it was hardcoded, and if it would be possible to make a low maintenance solution so it was a non-factor.

boreal egret
#

That would definitely make it harder. Mechanically any idea?

#

Just trying to think of how impossible it would be to even attempt making PZ blood-volume based instead of health-bar based.

drifting ore
#

I mean

#

You can add UI

#

Could just add a blood level UI

#

And then as you bleed out, lower the health bar respectively

boreal egret
#

Yeah that's fine. I am more talking the mechanics of health bar damage if you get me? Like having unbandaged wounds causes constant damage I want to rip that out so there's other punishments for having unbandaged wounds.

drifting ore
#

¯\_(ツ)_/¯

#

I mean taking damage for unbandaged bleeding wounds makes sense

boreal egret
#

Ripping out is probably impossible. Maybe I'll snoop, it's a very specific question so I understand.

drifting ore
#

Since yknow, you'd be bleeding out slowly

boreal egret
#

Yeah it's just it wouldn't be necessary if you have bleeding be more involved if you get me.

drifting ore
#

But yeah someone much more qualified with how the base mechanics work would probably be more helpful

boreal egret
#

I mean I notice there's nobody who seems to have attempted this other than immersive medicine, so I am going to guess this isn't easy. I might look at their code just to understand how much the game fights you on this.

faint jewel
#

argh.

#

wiat wait wait.

hearty herald
#

Are you also certain that the math ceiling is proper?

faint jewel
#

if math.abs(vehicle:getAngleZ()) > 90 then
deltt[2] = -math.cos(math.rad(angle)) the delta 2 is the Z rotation?!

#

so why is delta1 the Y rotation?

#

local angle = vehicle:getAngleY()
local deltt = {}
deltt[1] = math.sin(math.rad(angle))

hearty herald
#

No clue, I thought you had some special cases in place for when you rotate it

faint jewel
#

the thing is... without rotation... it works... i can move it INFRONT of the car by increasing the 0.01

hearty herald
#

I'm not good at angle math, I just use the built in libraries to do it all for me

#

By the way, they are both using y angle, just checking different things

faint jewel
#

?

hearty herald
#

the variable 'angle' is used in both. It's just doing the whole check with the split in middle or whatever

#

If Z angle is whatever, it's negative, else positive

#

But try changing the check to AngleY instead

acoustic zinc
#

so my friend and i have a server with apexhosting and realized we can do pz, is there anyway we can use server modmanager for it?? and if so how ty

faint jewel
#

OMG OMG OMG... SO close.

#

it sprays the blood in FRONT of me.

errant meteor
#

without context it sounds sus lmao

faint jewel
#

red makes me happy. green would make me giddy

still meadow
#

can anyone answer a quick question, I got a mod for a car off the workshop but I want it to spawn very rarely, would I change this code here?

`VehicleZoneDistribution.good.vehicles["Base.fhqMX5NARally"] = {index = -1, spawnChance = 4};

VehicleZoneDistribution.sport.vehicles["Base.fhqMX5NARally"] = {index = -1, spawnChance = 40};`

faint jewel
#

yes and no.

#

as the mod would probably just update via the workshop.

still meadow
#

i'm using -nosteam

#

not sure where to read about the values.

#

the spawnChance of 4 and 40 are those percentages?