#mod_development

1 messages · Page 201 of 1

feral crane
#

local rng = ZombRand(100) < SandboxVars.Taunts.rng

if rng == 1 then
taunt:playSound("taunt_" .. ZombRand(1, 19))
end
end

Events.OnGameStart.Add(OnGameStart);
Events.OnZombieDead.Add(onZombieDead)
``` so i have this now, but i dont think it will work because of ```if rng == 1 then``` what do i do about this?
frank elbow
#

I think you ought to read through https://www.lua.org/pil/1.html, firstly—it'll help you to understand the code better and intuit things like this. The rng variable is the condition you're checking for, so it can be used directly in the if statement without comparing with 1

open drum
#

thanks. ill take a loook and try. is there any mod that u know which i can take a look as an example?

frank elbow
finite kettle
#

FINALLY I DID IT. I REWORKED PZ'S STEALTH SYSTEM

drifting ore
#

I want a mod where you have options by rightclicking a door of a building that is claimed by you to create a key for
a buildings maindoor(s) //[exterior doors]
individual🚨interior roomdoors
and a masterkey

Who can make that? I would be willing to throw some bucks in, team play with strangers suck rn

vernal ore
#

Not sure about exterior doors though

#

Like sheds

drifting ore
vernal ore
#

Individual interior doors? Why not just use a seperate building unless youre bunking with other players

drifting ore
#

They can only create a key and this applies to all doors of this building

drifting ore
#

I think that shouldnt be too nieche of an request

vernal ore
#

It would definitely be a rework of how structures work in project zomboid

#

Or attaching a seperate identificer for doors but that'd require seperating a buildings 5 rooms in to 5 seperate buildings

drifting ore
#

Are you a coder?

vernal ore
#

I asked for this similar thing from others a while ago and got those same answers

drifting ore
#

Oh

#

I thought if u know all that maybe you can do it😄

vernal ore
#

Just letting you know it might be more than youd expect for payment

#

im in the middle of requesting a mod for baldurs gate 3 rn ngl

drifting ore
#

Well i hope someone around will face this challenge and some redbullmoney and the praise of the community will be enough for him

vernal ore
drifting ore
#

Yea if you have a squad member that wants to f you over when you are not looking, this wont stop him

vernal ore
#

It would

#

Unless hes busting down your door?

#

At that point a lock wont matter

drifting ore
#

Individual locks or squad rank-based locks would make things so easier

drifting ore
#

Its about placing them in a safehouse

vernal ore
#

So an invincible, lockable door only specific people can get

#

Thats easily exploitable

drifting ore
#

Yea you could burn the wall

#

You cant cover everything

#

But at least some of it

vernal ore
#

Im going to:
Renember where you disconnected
Build 4 doors around it
Private lock it

#

Unbreakable death box unless you get admin help

drifting ore
#

😂

vernal ore
#

Or you light yourself on fire

drifting ore
#

So while the indestructible lock is only openable for the owner, the tooltip shall display the owners name

drifting ore
vernal ore
#

Thats the thing if somebody wants to fuck you over

#

They dont care if theyre caught

drifting ore
#

He can only do it once tho

vernal ore
#

And at this point

drifting ore
#

And if you dont insist on waiting in a death box just write the admin and log off you will be ok

vernal ore
#

Just light the base on fire

drifting ore
#

But if everybody has his private ‚safe‘ area

#

People will be less tempted to fck around

vernal ore
#

Right but im stating that private locks wont help any of your problems, just get container locks, padlocks are a resource in zomboid

drifting ore
#

I played scum for like 3 years, you can lock the doors rankbased there

#

In 3 years with lots of squadplay it never happened that somebody broke the doorframe

#

Just some people of the same rank stole from each other and it happened very rarely

drifting ore
#

I never heard of those

vernal ore
#

Padlocks can be attached to crafted crates

drifting ore
#

Only crafted?

vernal ore
#

Im not sure, but its easy to make crates

#

It creates 2 keys

#

Specific to that padlock

drifting ore
#

I just found the wiki of it

#

But the creates are easily destructable

vernal ore
#

Walls are also

#

Sledgehammer

#

Its not even like exhaustion

#

Project zomboid if you want to get in to a location its incredibly easy

drifting ore
#

I got it

#

I just need someone to mod a padlockable indestructable crate

#

That Sounds cheap af

vernal ore
#

Just:

  1. If somebody wants to just ruin your day, fire.
  2. If somebody wants your stuff, the average server allows that, its called raiding.
  3. If you are scared of your allies betraying you, you shouldnt be allies.
drifting ore
#
  1. I know i know
#

But if u have like a group of 6 people

#

And 1 fucks around

#

And destroys the ‚relationship‘ between all

#

And there is like no way to track him down

#

Better to restrict his fuckaroundability

#

I think raiding people + their vehicles is enough, especially for someone like me who is happy if he can play 6h in a week, having the base raided when im gone sucks big time

#

I didnt know about the padlocks that helped a lot

true plinth
#

hello everyone,
i have a question please.
I made a "poster's mod" and i can put my poster on wall. That's good. (with Tiles properties, texture packs, etc).

But i want to test if the player shoot on the poster.
For that i code this little method :

local function OnWeaponSwingHitPoint(character, handWeapon)
    local player = character;
    local shootPos = player:getAttackTargetSquare()
    for i = 1, shootPos:getObjects():size() do
        local thisObject = shootPos:getObjects():get(i - 1)
        print(thisObject:getName())
        if thisObject ~= nil then
            local sprite = thisObject:getSprite()

            if sprite ~= nil then
                local name = thisObject:getSprite():getName()
                print(name)
            end
        end
    end
end

Events.OnWeaponSwing.Add(OnWeaponSwingHitPoint)

But it's really strange because i don't see the sprite name of the poster, i only see "block object" (wall, furniture).
It seems that my poster tile is like an overlay, does someone know how to get the overlay tile with lua code please ?

outer yarrow
#

I want to make a ground object light up, where can i find the objects like buildable lamps in the media folder?

feral folio
#

Can you weapons mod makers hurry up and make an L85A2 rifle?

carmine isle
#

Trying to make a set of tiles, I have some set to be moveables with the pickup weight set to 50. They aren't intended to be moved by anyone but staff. Ingame however, they still only show up with 5 weight. Any ideas as to why that would be?

carmine isle
open drum
#

buenos dias amigos

vast basalt
#

Does anyone have a mod they either made or use for a freezer vehicle?

azure rivet
verbal yew
#

How should look construction like:

if ... then
 elseif ... then
    ...
 elseif ... then
    ...
 else
    ...
end

or

if ... then
 elseif ... then
    ...
  end
 elseif ... then
    ...
  end
 else
    ...
  end
end
#

?

bronze yoke
#

the first one, but the elseifs generally wouldn't be indented

#

otherwise it implies that the the elseifs are within the scope of the first if

verbal yew
#

understood, thanks

random finch
#

Is there something wrong with this?

if getSandboxOptions():getOptionByName("KnockedDownAllowed"):getValue() == false then
        ...some code
end
#

My Error:

ERROR: General     , 1697692438253> 1,705,070,465> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getValue of non-table: null at KahluaThread.tableget line:1689.
#

I've worked with mod sandbox options but never vanilla. KnockedDownAllowed is a vanilla option.

bronze yoke
#

sounds like it's not finding the option by that name

random finch
#

weird, bc its there

#

Also, here

bronze yoke
#

that's a server option not a sandbox option

random finch
#

RIP

#

Thanks man

verbal yew
bronze yoke
#

that actually is visible only for that player

#

vanilla uses it for some stuff like that

verbal yew
#

oh... nice

verbal yew
#

player:Say(getText("ContextMenu_EmergencyReload")..tostring(ArmorSlot_Jacket:getModData().zReAASCount))?

bronze yoke
#

yeah

#

there's also overloads of getText to format it into the string

#

IGUI_XP_readingspeed = "Reading Speed: %1%",
getText("IGUI_XP_readingspeed", readingSpeed)
would show e.g. "Reading Speed: 50%"

#

%1, %2, %3 etc get replaced by the arguments

verbal yew
#

useful information, thanks

cedar anvil
#

Thank! As you told me "player:playSound()" was what I needed!

lunar shore
#

How can I check that if a certain sound is produced, an event is triggered?

verbal yew
#

how to create check option for sandbox?

#

type = boolean, ?

verbal yew
bronze yoke
#

queen actually ^^

verbal yew
bronze yoke
#

ok good ^^ very often i have people in here thinking i am a guy LOL

verbal yew
#

I think I went too far with the script...
300 lines for the clothing update event drunk

verbal yew
#

i mean this part:
ArmorSlot_Jacket:getVisual():removeHole(0)
ArmorSlot_Jacket:getVisual():removeHole(1)
ArmorSlot_Jacket:getVisual():removeHole(2)
ArmorSlot_Jacket:getVisual():removeHole(3)
ArmorSlot_Jacket:getVisual():removeHole(4)
ArmorSlot_Jacket:getVisual():removeHole(5)
ArmorSlot_Jacket:getVisual():removeHole(6)
ArmorSlot_Jacket:getVisual():removeHole(7)
ArmorSlot_Jacket:getVisual():removeHole(8)
ArmorSlot_Jacket:getVisual():removeHole(9)
ArmorSlot_Jacket:getVisual():removeHole(10)
ArmorSlot_Jacket:getVisual():removeHole(11)
ArmorSlot_Jacket:getVisual():removeHole(12)
ArmorSlot_Jacket:getVisual():removeHole(13)

#

0-13

#

bodyPartIndex

random finch
random finch
#

For context. This throw nil as comment labels below.

local function OnWeaponHitCharacter(attacker, target, handWeapon, damage)

    if target:isZombie() then return end
    
    local atkCooldown = attacker:getCooldown() --throws nil
    local tarCooldown = target:getCooldown()
    attacker:Say(atkCooldown)
    target:Say(tarCooldown)

    atkSafety:setCooldown(0)
    tarSafety:setCooldown(0)
end

Events.OnWeaponHitCharacter.Add(OnWeaponHitCharacter)
hollow current
#

Any idea if there's an equivalent of sandboxOptions:sendToServer() but for SP, to change SP sandbox settings?

hollow current
#

Solved :)

subtle crane
#

trying to make a pz mega map, and these cell overlaps keep coming up:

#

should i be concered...? none of the maps are even close to 0,0 so its just a little bug right?

feral crane
#

how do i make multiple functions in the same .lua file? the earliest one stops working if i add another function big noob question i know

hollow current
feral crane
#

wasnt using end correctly

hollow current
#

By the way. I have an issue with SandboxOptions:sendToServer(), it works if the client player is set to admin only. I tried to instead use sendClientCommand() and apply the sandbox options server-side. They're applied according to few print() statements, but no actual changes appear in effect in-game. What's causing this?

P.S.: I could solve this by temporarily setting the player's access level to admin then re-setting it after sending the sandbox settings to server, but seems like a cheap solution and definitely not optimal

Edit: Solved - Check #mod_development message

hollow current
short yoke
#

I am new to modding and can’t find any documentation on this, is it possible to change the size of models in game in real time (like x happens and makes zombies shrink to 1/2 size) or can the size of 3d models in game not be affected

feral crane
#

how do i make the player the source of a sound for an audio file instead of a zombie or sound manager?

#

is that even possible?

frank elbow
frank elbow
hollow current
frank elbow
#

I don't remember off the top of my head. There's a tool that's supposed to do it for you but requires some tinkering to work; I think I ultimately just used fernflower directly

#

I'll see if I can find the tool

hollow current
#

Thanks

#

I will try to see if I can use sendServerCommand after sending the client command, maybe that's what I am missing to make it work

frank elbow
hollow current
#

Thanks!

frank elbow
pseudo apex
#

Hello, can anyone help me with a Lua file? I have an item that, when used while placed on the ground, doesn't get consumed 😦

hollow current
hollow current
pseudo apex
feral crane
#
if SandboxVars.DukeTaunts.qtog == false then return end
    if qtaunt == Keyboard.KEY_Q then
    local character = function(player)
    character:getEmitter():PlaySound("yell_" .. ZombRand(1, 17))
    end
    end
end``` how come this doesn't play any sound or give any errors? what am i missing?
fast galleon
undone crag
undone crag
# feral crane wasnt using end correctly

You could save yourself a lot of searching your code and debugging and reloading by using a program that checks your syntax for you :d
I should have done that but I used notepad++ instead.

feral crane
#

how do i store the result of a randomizer as a single variable?

#

player = getPlayer();
emitter = player:getEmitter();
randomizer = ZombRand(1, 17);

if SandboxVars.DukeTaunts.qtog == false then return end
if emitter:isPlaying("yell_" .. randomizer) then return end

    if qtaunt == Keyboard.KEY_Q then
    emitter:playSound("yell_" .. randomizer)
    end
end``` i tried this but both "randomizer" use different results
undone crag
#

If they use different results then I think it means the function is running multiple times, getting a new random result each time? (just having looked at that one message ^ and not knowing what the problem is) (also, away)

bronze yoke
#

this is correct, your issue is something else

feral crane
#

but because it rolls between 1 and 17 normally it only works 1/17 times

#

lol

bronze yoke
#

1/16 times, the upper bound is exclusive

fast galleon
#

I seem to have an issue triggering climb fence in MP. It works in SP, but for the others I am walking around the fence.

feral crane
#

any idea what the problem could be?

bronze yoke
#

not at all, it is impossible for the value of randomizer to change in this code

#

btw, you should use local variables as much as possible (local player = instead of player =), it can't be happening in this setup but mod incompatibility can happen and cause issues like this when you use globals

#

(and globals are just laggy)

feral crane
#

but they stop working after the first "end"?

#

like if i wanna use it again later

#

i have to create another one?

bronze yoke
#

it stops working after the current scope, e.g.```lua
function whatever()
local foo = bar
end -- foo goes out of scope

function anotherFunction()
local foo = bar
if something then

end

end -- foo goes out of scope here

#

think how many mods want to use the variable name 'player'

#

you don't want two mods messing with each other's data unpredictably like that

feral crane
#

yeah true

#

no way to make it "global" only within my mod?

bronze yoke
#

not really, if you declare it at the top of your file like local player; then it'll be the same variable anywhere within that file

feral crane
#

i tried that it gives me nil errors

bronze yoke
#

if you're doing local player = getPlayer() at the top, it fails because there is no player when the lua first runs and that's when that line will run

feral crane
#

it doesnt fail, but when i go in game and press q i get the nil error

hollow current
#

any idea why printing getPlayer():getBodyDamage():getHealth() in onPlayerTakeDamage prints the body health before the damage is taken?

#

I could get the damage after player takes damage by subtracting the damage from the getHealth but not sure if its prone to logic errors later on

bronze yoke
#

often times it's fired before the health is actually adjusted

#

the logic error you'd be prone to is that this is not always the case, depends on the source of the damage

feral crane
#

albion do you know how to make it so it wont play a sound if the emitter is already playing any sound at all?

#

that might work rather than trying to match the randomizer numbers

frank elbow
#

Are you saying you want it to choose a random number once and have it be the same for that player whenever it's called?

bronze yoke
#

these isClear() and isEmpty() emitter methods seem suspect, don't know what they actually do though

feral crane
frank elbow
#

Then you'll either have to save the last one played for the isPlaying check, or check for all of them

feral crane
#

how would i go about saving the last one played? i figured i could check for all of them but i didnt wanna go down that route

frank elbow
#

The most straightforward way is a variable local to the file

dark wedge
hollow current
#

I think the damage resulted from the event isn't directly related to body damage so my approach won't work anyways. Meaning if damage is 50 and health before damage is 100, it doesn't seem to necessarily mean that new health will be 50. At least per my debugging:

LOG  : General     , 1697737416174> Resulted damage: 79.41693115234375
LOG  : General     , 1697737416175> Player's health before damage: 100
LOG  : General     , 1697737416175> Player's health after damage: 20.58306884765625 (Calculated using health before damage minus resulted damage

Printing actual in-game health via console: 85.5290298461914

Player's health after damage doesn't seem to reflect the actual health in game

hollow current
bronze yoke
#

yeah, unfortunately you cannot predict it for car crash damage

#

the value it gives you is used for a bunch of rng

#

it's more of an intensity metric than a damage amount

#

it hits a random number of limbs, partially based on the 'damage', for a random amount of damage, also partially based on the 'damage'

hollow current
#

This sucks. This ruins the whole logic that I was building my mod upon

bronze yoke
#

in this case i think it is applied before the event is fired but the overall body health isn't updated until the next player tick

hollow current
#

Maybe a work around that gets body health before and after crash

#

The logic won't be optimal probably

#

but its the best workaround for now (?)

bronze yoke
#

the value from getHealth is just the average of the body, but it's only recalculated every player update

#

you could just calculate that

hollow current
#

will try with that approach

#

Thanks for the assistance btw!

feral crane
#

how often does onPlayerMove work? Everytime a movement key is pressed?

bronze yoke
#

every frame while they're holding a movement key and are allowed to move (even if they aren't actually moving, e.g. if they are walking into a wall)

#

it doesn't fire while driving a vehicle

random finch
random finch
#

I am using this function for testing:

local function OnWeaponHitCharacter(attacker, target, handWeapon, damage)

    if target:isZombie() then return end
    
        
    local atkSafety = attacker:getSafety()
    local tarSafety = target:getSafety()
    
    if atkSafety != nil then
        print("atkSafety: " .. atkSafety)
        local atkCooldown = attacker:getCooldown()
        if atkCooldown != nil then
            print("atkCooldown: " .. atkCooldown)
        end
        atkSafety:setCooldown(0)
    end
    
    if tarSafety != nil then
        print("tarSafety: " .. tarSafety)
        local tarCooldown = target:getCooldown()
        if tarCooldown != nil then
            print("tarCooldown: " .. tarCooldown)
        end
        tarSafety:setCooldown(0)
    end

end

Events.OnWeaponHitCharacter.Add(OnWeaponHitCharacter)
frank elbow
random finch
#

atkSafety & tarSafety are always nil

bronze yoke
#

the objects passed by the event are no different from any other character object

random finch
#

I thought they may contain particular info upon certain events.

bronze yoke
#

it doesn't seem like it's ever possible for getSafety() to return null...?

#

it's initialised by default and there's no method that lets you actually destroy the object

#

every character should always have a safety, even with weird interference

random finch
#

Hrmm, that was my thought but then again Im not entirely familar with the API or Java code for that matter.

#

So, ideally I should be getting the Safety object from attacker:getSafety()?

bronze yoke
#

yeah, i can't see any way you wouldn't

random finch
#

This is the only function, and code in general, in this mod that Im using and no other mods to interfere.

frank elbow
#

How are you testing it?

random finch
#

I am testing on a dedi server as well

frank elbow
#

Can't check atm but I'm not certain this would fire for a zombie hitting a player—are you testing with a player hitting a player?

feral crane
random finch
#

Also, I have tried safety enabled and disabled. PvP enabled of course.

feral crane
#

like someone with 240 fps will have it fire 240 times a second while someone with 20 fps only 20?

random finch
feral crane
#

welp that sucks is there any alternative?

bronze yoke
#

not really, pretty much everything is tied to framerate

feral crane
#

what about adding tick rate to OnPlayerMove?

#

possible?

#

to make it consistent across all kinds of pcs

bronze yoke
#

not really possible, easier to just adjust for framerate

#

you can't mess with the event trigger but you can either have some timer to make sure your code doesn't actually activate too often or if it's appropriate just scale the effect by the delta

feral crane
#

should work i think?

subtle crane
#

Hi guys, are there any modders here who would be willing to work on a fairly small project to help expand their portfolio? In short it is a multiplayer tracking gps that can be crafted, that allows the player to locate the cell that another player is in, and is updated every 12 irl minutes. It would be shown on the map with a red outline, and can allow for roleplay scenarios like bounty hunting/hitmen and general PvP hunting. You could also play essentially dream manhunt in pz. Let me know if anyones interested!! :)

uneven vessel
#

hjello

cedar anvil
#

Could anyone tell me how can I use "getPrimaryHandItem()" properly? if player:getPrimaryHandItem() == "ATTS.Zmazon" then~

random finch
#

~~Pretty sure that's right, but you can test with this.

local primHand = getPlayer():getPrimaryHandItem() 
if primHand ~= nil then
      print("PrimaryHandItem" , primHand)
end
```~~
neon bronze
#

Just do if primHand then its faster and better to understand

random finch
#

I find it less readable, but I do see more people doing it that way.

neon bronze
#

As far as i know there is some finicky stuff with ~= nil checks in lua

random finch
#

Interesting, where can i read about it? before I search lol

neon bronze
#

I think albion mentioned it once here sometime ago

bronze yoke
#

if you want to check the type of the item you'd use player:getPrimaryHandItem():getFullType()

cedar anvil
#

Thanks so much yall. It works smoothly as I wanted now! local Handitem = player:getPrimaryHandItem() if Handitem and Handitem:getFullType() == "ATTS.Zmazon" then

weary knoll
#

"The game’s use of ModIDs has been altered to be appended by the workshop ID of each mod. This adjustment is aimed at resolving server issues that result in file mismatch errors when users attempt to connect, due to various mod versions sharing the same ModID. This happens on the Steam Workshop a fair bit due to re-uploads and modpacks. Now, with the workshop number attached to the ModID, only the “correct” version of a mod will be loaded by clients connecting to servers. We’re hoping that this will then lessen frustrations with said cursed file mismatch errors whenever you’re in an area of mod self-conflict."

frank elbow
#

Configuring mod load order, too

bronze yoke
#

i'm happiest about marking incompatible mods

drifting ore
#

How to make same effect as vanilla? Having stat value increase slowly, rather than instant effect? Learning and have been stuck here for long time, ready to move on
help unhappy

bronze yoke
#

my StatsAPI has utilities for this, otherwise it's pretty complicated

#

you need to add the stat every tick adjusting for the time delta until you've added the target amount

drifting ore
#

thank you much

low crest
#

i'm working on a power plant mod and the idea right now is to spawn arrays of invisible generators with modified radius (thanks to the new variable range generator mod) that can power up a big area such as an entire town. Do y'all think its a good idea? or can you think of something better? is there a way i could supply tiles with electricity without having to spawn generators?

boreal garnet
#

i want to add a new face paint. how do i proceed? jaques_beaver

undone crag
# feral crane it doesnt fail, but when i go in game and press q i get the nil error

An example of what albion said:

function whatever()
    local foo = bar
end -- foo goes out of scope

local player = nil
 -- player is now in the scope of both of the functions below this point

function anotherFunction()
    player = getPlayer() -- so now the variable's value is the player rather than nil
end -- the function ending doesn't delete the variable, it keeps its value

function thirdfunction()
    local foo = player -- if you didn't run anotherFunction earlier, the value is still nil
    if something then
    
    end
end -- foo goes out of scope here
drifting ore
#

@bronze yoke Could you provide me an example of what I am trying to accomplish? I will be fine further on, just need to learn by example. I study your code but there is so much, and has furthered my confusion

bronze yoke
#

you can require the mod and call the functions

#

unfortunately a lot of the code there is heavily tied to stats api's inner workings for performance reasons so it's not the easiest to generalise

random finch
#
if player:getCurrentState() == PlayerHitReactionStatePVP.instance()
    ...some code
end

PlayerHitReactionStatePVP.instance() always gives an attempted index: instance of non-table: null error.

Any suggestions on how to get a players pvp hit reaction state?

bronze yoke
#

PlayerHitReactionPVPState

random finch
#

haha

#

thanks albion

edgy locust
#

Good morning.

I am looking for a tutorial on how to insert a custom loading screen. Can someone help me. Would be great. Thank you very much.

high wolf
#

i have a question how hard is it to make mods?

feral crane
#

how do i make a function affect only crawling zombies?

feral crane
#

nvm figured it out its isCrawling()

feral crane
#

addSound(crawler, crawler:getX(), crawler:getY(),crawler:getZ(), 200, 200) why doesnt this attract zombies?

subtle crane
feral crane
#

anyone know what the visual detection range of zombies is?

#

default

west gazelle
#

I think it's the default visual detection range, maybe

feral crane
#

whats the number?

west gazelle
#

🤷‍♂️

west gazelle
#

It's the number for the visual detection range

#

The default one

feral crane
west gazelle
finite kettle
#

is there a way to make this not explode my code whenever I'm in a "There is nothing here" foraging zone?

verbal yew
#

if currentZoneType == nil then return end

finite kettle
#

holy shit it worked thanks guys

subtle crane
#

hi

#

where would i put recipe script for an item

#

would it be in here:

feral crane
#

how do i change the range from which a player can hear a sound? i tried editing scripts txt & increasing the volume of the sound itself, but the player can still only hear it from about 20 tiles away.

finite kettle
drifting ore
#

Somebody can make a padlockable, indestructable metal chest?

edgy locust
lunar shore
#

How do I find out if an object is the source of sound?

 local function TryCapWorldSound()
    local player = getPlayer()
    local stats = player:getStats()
    local item = "Tsarcraft.TCWalkman"
    local required_sound = "Tsarcraft.CassetteNirvana"
    if item:isPlayingUISound() == required_sound
    then
        player:Say("Sound founded")
        stats:setAnger(4)
    else
        player:Say("Error")
    end
end
Events.OnPlayerUpdate.Add(TryCapWorldSound)
polar gyro
#

Anyone know is it possible to add alternative to Base.LugWrench in this reciepe?

            {
                items
                {
                    1
                    {
                        type = Base.Jack,
                        count = 1,
                        keep = true,
                    }
                    2
                    {
                        type = Base.LugWrench,
                        count = 1,
                        keep = true,
                        equip = primary,
                    }
                }
                time = 400,
                skills = Mechanics:1,
                test = Vehicles.UninstallTest.Default,
                complete = Vehicles.UninstallComplete.Tire,
            }```
#

I tried different ways, but nothing works

fast galleon
edgy locust
#

Hello. I Try to programm an own Loadingscreen. I have tried to put something together but it does not work. Can anyone tell me if this code should at least work?

-- Ladescreen-Modul
module("McFlyPZLoadingdscreen", package.seeall);

-- Funktion zum Ändern des Ladescreens
function setCustomLoadingScreen()
    local loadingScreen = getCore():getLoadingScreen();
    loadingScreen:doTexture("media/textures/pz.png");
end
Events.OnGameStart.Add(setCustomLoadingScreen);
granite ginkgo
ebon needle
#

Hello!
I'm trying to make a mod by following Blackbeard's video tutorial, and I'm trying to give myself the item I created using the admin menu, but the item doesn't show up in the menu. Please help

#

Also, if Blackbeard's video tutorial is out of date at this point, please tell me where to get more up to date information

uneven vessel
#

If I wanted to comission an armor set mod who should I be looking at?

heady crystal
#

Anybody know a function to get how many days have been since the game started?

#

Like if there is one

#

I know if you set a date start in sandbox settings it doesn't really take that into account in the date

#

I'm worried getClimateManager:getCurrentDay():getDay() will return the current day of the year and I don't wanna be doing a ton of redundant code or spend the time actually waiting more than one in-game year to know lol

feral crane
#

getGameTime?

bronze yoke
#

getGameTime():getNightsSurvived()

heady crystal
#

Won't this only be for the currenct character?

bronze yoke
#

nope

heady crystal
bronze yoke
#

the name is probably prior to that having any meaning

#

players have a nights survived too but the one on gametime is just 'how many times has 7am passed since the start of the save'

heady crystal
#

Awesome, thanks!

astral dune
#

so if a modder has been manipulating game time to turn the power/water back on, will that stay accurate?

random finch
#

Anyone know how to prevent this hit reaction?

Using OnWeaponHitCharacter with these doesn't do the trick.

target:setIgnoreMovement(false);
target:setHitReaction("");
    
target:setVariable("hitpvp", false);
target:setVariable("hitreaction", false);
target:setVariable("hitreactionpvp", false);


target:clearVariable("HitPvP")
target:clearVariable("HitReaction")
target:clearVariable("PlayerHitReaction")
handWeapon:setPushBackMod(0)
handWeapon:setKnockBackOnNoDeath(false)
bronze yoke
#

unless they explicitly modified it

random finch
#

Also, getting the targets state in OnWeaponHitCharacter or OnPlayerGetDamage always results in IdleState. Even when hit.

    local targetState = target:getCurrentState()
    if targetState ~= nil then
        print("targetState: " , targetState:getName())
    end

LOG : General , 1697840443702> 1,853,075,941> targetState: IdleState

dark wedge
#

At least in the attack stack

random finch
bronze yoke
#

yeah i think i just forced the player into a specific state

random finch
#

This is what you used

bronze yoke
#

my memory fails me 😅

random finch
#

This is what Fajdek used:

local function CancelPVPStagger(player, _, __)
    if player ~= getPlayer() then return end
    if player:getCurrentState() == PlayerHitReactionStatePVP.instance() then
        player:setHitReaction("")
    end
end

Events.OnPlayerGetDamage.Add(CancelPVPStagger)
#

However, in Fajek's case, I dont think he ever tested the code. The state is always Idle at that point. Never comes tout to any other reaction.

Cant get a current State in OnPlayerGetDamage or OnWeaponHitCharacter.

#

Nvm, dhert you werent in that conversation. My bad.

#

I swear I make an attempt at getting rid of stun-lock pvp every year since B41 MP came out. 😅

#

Miss the B40 PvP. Was actually somewhat reasonable if you reduce pvp damage. Standard you would mow player down with high aim skill.

#

I mean, your fixes somewhat help. It becomes stagger PvP. Can juggle players and they can actually shootback. The server options actually work too.

#

KnockedDownAllowed=false

# If true, player can hit again when struck by another player.
PVPMeleeWhileHitReaction=true

#

Are there any guides that deal with animations? Maybe I can take another approach and disable the pvp reaction animations completely.

mellow frigate
# random finch Are there any guides that deal with animations? Maybe I can take another approac...

media/AnimSets/player/hitreactionpvp/HitReaction.xml ```xml
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>HitReaction</m_Name>
<m_AnimName>Bob_HitReact_01</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_Looped>false</m_Looped>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_BlendTime>0.10</m_BlendTime>
<m_BlendOutTime>0.20</m_BlendOutTime>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Bip01</boneName>
<weight>0.20</weight>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_Neck</boneName>
</m_SubStateBoneWeights>
</animNode>

#

or maybe you'll need to handle the inheriting classes conditions overrides and do something brutal and ugly like : ```xml
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>HitReaction</m_Name>
<m_AnimName>Bob_HitReact_01</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_Looped>false</m_Looped>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_BlendTime>0.10</m_BlendTime>
<m_BlendOutTime>0.20</m_BlendOutTime>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Bip01</boneName>
<weight>0.20</weight>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_Neck</boneName>
</m_SubStateBoneWeights>
</animNode>

dark wedge
#

Yea, in that media/AnimSets/player/hitreactionpvp/HitReaction.xml file I would change:
<boneName>Bip01</boneName>
to:
<boneName>Bip01_Spine</boneName>
That SHOULD keep the animation overall but won't apply the translation data of the animation (so no movement impact). I think you would still need to provide all of the PVP hit reaction action files in your mod as an override though, as they all inherit from that base file and my understanding is that the xml action inheritance only works for files in the local directory.

#

Or if you want to remove the animation entirely, make a 0-1 frame animation and set all of them to use that animation file via the top bit in each action file:
<m_AnimName>Bob_HitReact_NothingPVP</m_AnimName>
could work, would be dirty though.

random finch
#

Interesting. Time to get my hands dirty. Thanks fellas.

mellow frigate
heady crystal
#

Anybody ever tried to spawn a corpse on MP?

#

I am using createRandomDeadBody server side and transmitting but they're not lootable for the clients

nova socket
#

Sorting recorded media was a shitshow.
So you can kinda stick to media categories to index VHS both home and retail but SURPRISE MOTHERF**KER apparently CD's media cant be listed as category (not sure why) and global indexes change depending on mods. So you literally have to instantiate item scripted, find needed media, get their ids and compare them to be sure its the same thing..
Yikes.

boreal garnet
#

anyone knows how to create a mod for new face paint makeup option? spiffo

earnest drift
#

Sorry if dumb q but how have people been converting their models to .x from .fbx? Are there any free options?

undone crag
# ebon needle Bump

I don't know who blackbeard is and I've not watched the video but if u paste ur code I cann halp. You can make the message format as lua by typing ` thrice followed by the three letters lua like this

hey
undone crag
ebon needle
# undone crag I don't know who blackbeard is and I've not watched the video but if u paste ur ...
module IBC
{
    imports
    {
        Base
    }

    item IndiesBeerCheat
    {
        DisplayName = Beer Cheat,
        DisplayCategory = Food,
        Type = Food,
        Weight = 0.3,
        Icon = IndiesBeerCheat,
        EvolvedRecipe = Soup:8;Stew:8;Beer:9;Beer2:9,
        FoodType = Beer,
        Alcoholic = TRUE,
        CantBeFrozen = TRUE,
        EatType = popcan,
        Packaged = TRUE,
        ReplaceOnUse = BeerCanEmpty,
        HungerChange = -100,
        ThirstChange = -100,
        UnhappyChange = -100,
        Calories = 0,
        Carbohydrates = 0,
        Lipids = 0,
        Proteins = 0,
        CustomContextMenu = BeginTheCheat,
        CustomEatSound = soda-can-opening,
        StaticModel = BeerCan,
        WorldStaticModel = BeerCan_Ground,
        Tags = LowAlcohol;HasMetal,
        EvolvedRecipeName = Beer Cheat,
    }
}```
ebon needle
#

And then I have this lua:

#
local MOD_ID = "IBC";
local MOD_NAME = "Indies Beer Cheat";
local MOD_VERSION = "1.0";
local MOD_AUTHOR = "Indie";
local MOD_DECRIPTION = "Adds a cheat beer with a custom sound.";
local debugItems = TRUE;

local function Info()
    print("Mod Loaded: " .. MOD_NAME .. " by " .. MOD_AUTHOR .. " (v" .. MOD_VERSION .. ")");
end

--add mod items to inventory at start if (line 6) local debugItems = TRUE;
local function addItems()
    if debugItems then
        local player = getSpecificPlayer(0);    -- Java: get player one
        local inv = player:getInventory();  -- Java: access player inv
        -- Java: add the actual items to the inventory    
        --inv:AddItem("Base.Axe");    
        --inv:AddItem("Base.RippedSheets");    
        --inv:AddItem("camping.TentPeg");
        inv:AddItem("IBC.IndiesBeerCheat");
    end
end

Events.OnGameBoot.Add(Info);
Events.OnGameStart.Add(addItems);```
bronze yoke
undone crag
#

I am flummoxed or something. If you uncomment a line that adds a base game object, an Axe or a RippedSheets, does that get added? You could try adding `print("hellohail")' to see if th ecode's running although it looks like it is so maybe you don't need to.
edit: albion below :d

#

:o

bronze yoke
#

it should just be local debugItems = true

undone crag
nova socket
#

Does anyone know a proper way of grabbing either all objects in N-radius from square/object or grabbing all squares in radius from square/object?
Purpose: need to poll and return specific tiles in certain radius from local player.

drowsy nexus
#

Hi, I am planning to create a respawn-after-death mod, which would allow players to restore their current skill set. I'd like to ask if there is any docs to access the player objects that contain their current skill set, level, and so on.

hallow hearth
#

Does the game's Lua code support goto statements?

bronze yoke
#

no, it is mostly 5.1 with some missing features

hallow hearth
#

Okay, thank you, that's a shame

nova socket
#

why goto if you have functions

hallow hearth
#

It's just a tool

bronze yoke
#

it's nice for avoiding nesting in loops, because of the lack of continue

hallow hearth
#

It's if statements all the way down otherwise

#

I've never used Lua before so just trying to learn what I can get away with coming from Kotlin

undone crag
fast galleon
lunar shore
#

How can I check the sound is playing?

local function TryCapWorldSound(player)
    local player = getPlayer()
    local stats = player:getStats()
    local item = player:getSecondaryHandItem()

    if item and item:getFullType() == "Tsarcraft.TCWalkman" then
    local soundEmitter = player:getEmitter()
        local soundName = soundEmitter:AmbientSoundLogic:getSoundName()

        if soundName and soundName == "CassetteNirvana" then
            player:Say("Sound found")
            stats:setAnger(4)
        else
            player:Say("Sound not found")
        end
    else
        player:Say("Error")
    end
end

Events.OnPlayerUpdate.Add(TryCapWorldSound)
ebon needle
random finch
tulip cipher
#

anyone think that adding complex chemistry would be fun?

fast galleon
#

I said it's lua, postupdate helps to tick the pz systems. Change the variables, call that and you are in different state or animation.

#

You can also call it to progress into a state and make changes to that.

random finch
#

Ahhhhh, I kinda see what you mean now.

#

Id hate to remove hitreaction alltogether so this route seems much better

#

Looking through some of your mods. Could you point me to one where you have done this before?

fast galleon
#

It's one I am finishing now.

random finch
#

noice, i look forward to another great mod made by you

lunar shore
# lunar shore How can I check the sound is playing? ```lua local function TryCapWorldSound(pla...

So, I solved the problem with the sound check. If it helps anyone here is the code:

local function TryCapWorldSound(player)
    local player = getPlayer()
    local stats = player:getStats()
    local item = player:getSecondaryHandItem()
    local sound = "CassetteNirvana" -- Sound name

    if item and item:getFullType() == "Tsarcraft.TCWalkman" then -- Full type of the object that makes the sound
        local soundEmitter = player:getEmitter()
        if soundEmitter:isPlaying(sound) then
            player:Say("Sound found")
            stats:setAnger(4)
        else
            player:Say("Sound not found")
        end
    else
        player:Say("Error")
    end
end
Events.OnPlayerUpdate.Add(TryCapWorldSound)
random finch
#

I wanna fill an envelope with anthrax and leave it in base for an unlucky soul to find. Maybe some VX nerve agent to slap on other players like what happened to Kim Jong-nam. Perhaps a complex system to brew up an anti-viral I am Legend style.

tulip cipher
#

when did chemisty mean bio weapons?

random finch
#

Haha, those were my first thoughts coming from someone playing PZ exclusively on PvP servers since I started.

feral crane
#

guys how do i make it stop playing a sound once a condition is met? like cut it off midway if necessary

#

ive got a loop that plays sound on repeat until a condition is met, but once the condition has been met it keeps playing the sound file until it finishes. I would prefer if it cut it off immediately. Ive tried getSoundManager getWorldSoundManager and cutting it off via the emitter itself but its not working for some reason

#
    local zombie = idleSprinter:getEmitter()

    repeat

    if zombie:isPlaying("idle_1") then return end
    if zombie:isPlaying("idle_2") then return end
    if zombie:isPlaying("idle_3") then return end
    if zombie:isPlaying("idle_4") then return end
    if zombie:isPlaying("idle_5") then return end
    if zombie:isPlaying("idle_6") then return end
    idleSprinter:playSound("idle_" .. ZombRand(1, 7))

    until(starget)


    local starget = idleSprinter:getTarget()
    local zombie = idleSprinter:getEmitter()

    if starget then

    if zombie:isPlaying("idle_1") then
    getSoundmanager():StopSound("idle_1")
    end
    if zombie:isPlaying("idle_2") then
    getSoundmanager():StopSound("idle_2")
    end
    if zombie:isPlaying("idle_3") then
    getSoundmanager():StopSound("idle_3")
    end
    if zombie:isPlaying("idle_4") then
    getSoundmanager():StopSound("idle_4")
    end
    if zombie:isPlaying("idle_5") then
    getSoundmanager():StopSound("idle_5")
    end
    if zombie:isPlaying("idle_6") then
    getSoundmanager():StopSound("idle_6")
    end

end```
hallow hearth
#

In class BodyPart setHaveBullet() there's a required constructor int doctorLevel.

Anyone know what kind of value it's expecting?

Is it the first aid level required to be able to fix it at all?

fast galleon
woeful plover
feral crane
woeful plover
feral crane
#

and what do you mean the players emitters sounds are only audible to them?

#

isnt it audible to everyone

#

within range of the sound

woeful plover
#

No some sounds are only audible by the player

#

I got some sounds working with looping, and I was able to stop them with a button. However, when I tested it with a friend on a server, he couldn't hear them

woeful plover
#

Yeah that seems ok

#
    --local soundEmitter = getWorld():getFreeEmitter(x, y, 0)
    --soundEmitter:playSound("soundName", x, y, 0)
    --soundEmitter:stopSound(arg0)

That's what i was doing to get a stoppable sound and it worked, but only local

feral crane
#

hm

#

im trying to stop an idling zombies sound once it gets a target dont think it will work for me

woeful plover
#

There's also this

        self.character:getEmitter():playSound(self.soundName)

That sound can be stopped too.

But i don't know if it's audible by others

#

I stop it with self.character:getEmitter():stopSoundByName(self.soundName)

feral crane
#

i tried this it didnt work but i think its because the game no longer thinks the zombie is actively producing the sound?

#

because of the loop?

woeful plover
#

I seem to be calling a different function to you

#

i was able to stop looping sounds just fine

#

using the getFreeEmitter thing

#

so instead of

local zombie = idleSprinter:getEmitter()
and
getSoundmanager():StopSound("idle_1")

why not do

zombie:stopSoundByName('idle_1')

feral crane
#

ill try that

woeful plover
#

i don't know if it works, but it's more similar to the one i know does work

manic relic
#

does anyone know how the game combines the correct icons with the correct textures?

feral crane
#

doesnt seem to work

manic relic
#

what I mean is, for example:

#

the bandana ( the red, blue or black one) hase 3 textures but how does the game know what the right icon is?

#

cause in the scripts there a just the name of the icons that are available

#

can anyone help me out?

frank elbow
# feral crane ``` local starget = idleSprinter:getTarget() local zombie = idleSprinter:...

Where is this code being triggered? It seems you have a few logic errors, looking at the top loop alone: starget is retrieved once before the loop starts, so the loop won't affect the loop condition. If it weren't for the playSound call (which plays the sound on the emitter, which is checked in the next iteration), this would potentially be an infinite loop (if starget were falsy)

#

In clearer terms, it's expected that that'd either play a sound or return, as its only outcomes

frank elbow
# manic relic can anyone help me out?

You can look at the item scripts for bandanas as an example. From media/scripts/clothing/clothing_hats.txt:

item Hat_Bandana
{
    DisplayCategory = Accessory,
    Type = Clothing,
    DisplayName = Bandana (Head),
    ClothingItem = Hat_Bandana,
    BodyLocation = Hat,
    IconsForTexture = BandanaBlack;BandanaBlue;BandanaRed,
    ClothingItemExtra = Hat_BandanaTied;Hat_BandanaMask,
    ClothingItemExtraOption = TieBandana;TieBandanaFace,
    CanHaveHoles = false,
    ChanceToFall = 30,
    Insulation = 0.10,
    Weight = 0.1,
}
item Hat_BandanaTINT
{
    DisplayCategory = Accessory,
    Type = Clothing,
    DisplayName = Bandana (Head),
    ClothingItem = Hat_BandanaTINT,
    BodyLocation = Hat,
    Icon = BandanaBlack,
    ClothingItemExtra = Hat_BandanaTiedTINT;Hat_BandanaMaskTINT,
    ClothingItemExtraOption = TieBandana;TieBandanaFace,
    CanHaveHoles = false,
    ChanceToFall = 30,
    Insulation = 0.10,
    Weight = 0.1,
}
#

Ah, I missed that you asked how it knows

manic relic
#

yeah I did, but I dont understand how the game is able to tell that the blue bandana needs the blue icon

#

hope I explained that right$

frank elbow
#

The IconsForTexture value seems to be your answer?

manic relic
#

probably

#

thank you anyway

#

I have to take a look later into it

frank elbow
#

No problem. If you wanted a more detailed answer, you can see how it's handled in the Item and InventoryItem classes (see the property with the same name + the m_TextureChoice field on the visual)

feral crane
#

my bad didnt include it for some reason

#

it works as intended except for the fact that i cant figure out how to stop the sound once the condition is triggered

#

it finishes playing

#

even if theres still like 10 seconds left on the clip

frank elbow
feral crane
#

emitter was what i tried first, but it didnt work thats why i went tried soundmanager

#

no errors in console

frank elbow
# feral crane emitter was what i tried first, but it didnt work thats why i went tried soundma...

I'd try restructuring it to avoid the repeat loop logic (and use a table to have less duplicative code). Something like (pardon the strange tabs, written on Discord):

local sounds = {
  'idle_1',
  'idle_2',
  -- and so on; could also generate this with a loop
}

local function OnZombieUpdate(idleSprinter)
  local starget = idleSprinter:getTarget()
  local zombie = idleSprinter:getEmitter()

  local idleSound
  for i = 1, #sounds do
    local sound = sounds[i]
    if zombie:isPlaying(sound) then
      idleSound = sound
      break
    end
  end

  if starget and idleSound then
    zombie:stopSoundByName(idleSound)
  elseif not starget and not idleSound then
    zombie:playSound(sounds[ZombRand(1, #sounds + 1])
  end
end
feral crane
#

wow thanks! I don't really have a grasp on for loops just yet but this will help a lot! Appreciate it 🙂

undone crag
drifting ore
#

my femboy species mod is expanding more than i had originally anticipated

#

its only been like, a few days or so since i uploaded it

#

:3

#

i guess people really wanted smth like this

undone crag
#

1:14 ratio

drifting ore
undone crag
#

Subscribers compared to unique visitors

drifting ore
#

yeh

undone crag
#

(dab)

drifting ore
#

i may actually make my own model for this mod if it keeps growing aswell, and try to learn blender more

#

(i had just retextured an already existing model)

#

one of the issues is that i have absolutely no idea how to create custom hairstyles for this new species

#

and yes, this is a anthro survivors mod

undone crag
#

I have an astrolfo (idk how to spell) meme for this but this aint meme channel :d

drifting ore
#

you know what? now i wanna make a astrolfo model in case this expands

#

thanks :3

undone crag
#

D:

outer yarrow
#

so im adding a light to one of my helmets, ive got temp model as the light bulb, when i attach it to the helmet, it show up under the players feet, is there anyway that i can get it to just dissapear?

manic relic
#

heres my code

#
module Base
{
    item HandAxe
    {
        DisplayCategory = ToolWeapon,
        MaxRange    =    1.1,
        WeaponSprite    =    HandAxe_yellow;HandAxe_green;HandAxe_orange;HandAxe_brown,
        MinAngle    =    0.67,
        Type    =    Weapon,
        MinimumSwingTime    =    3,
        KnockBackOnNoDeath    =    FALSE,
        SwingAmountBeforeImpact    =    0.02,
        Categories    =    Axe,
        ConditionLowerChanceOneIn    =    15,
        Weight    =    2,
        SplatNumber    =    2,
        PushBackMod    =    0.3,
        SubCategory    =    Swinging,
        ConditionMax    =    10,
        MaxHitCount    =    2,
        DoorDamage    =    20,
        SwingAnim    =    Bat,
        DisplayName    =    Hand Axe,
        MinRange    =    0.61,
        SwingTime    =    4,
        KnockdownMod    =    2,
        SplatBloodOnNoDeath    =    FALSE,
        IconsForTexture = Handaxe_yellow;Handaxe_green;Handaxe_orange;Handaxe_brown,
        BreakSound  =   HandAxeBreak,
        DoorHitSound = HandAxeHit,
        HitSound = HandAxeHit,
        HitFloorSound = HandAxeHit,
        SwingSound = HandAxeSwing,
        TreeDamage  =   15,
        CriticalChance    =    15,
        CritDmgMultiplier = 5,
        MinDamage    =    0.7,
        MaxDamage    =    1.5,
        BaseSpeed = 1,
          WeaponLength = 0.35,
          DamageCategory = Slash,
        DamageMakeHole = TRUE,
        AttachmentType = Hammer,
        Tags = ChopTree;CutPlant,
      }
}```
#

or does it only work for hats/clothing items?

#

that multiple textures are possible

bronze yoke
#

yeah

#

it will be possible for other objects in b42

hallow hearth
#

Any major difference in function when adding custom mod parameters when you use mod options vs sandbox options? I guess in mod options players can tweak stuff more for scenarios?

bronze yoke
#

the main difference is that mod options is per-player, sandbox options are the same for everyone on the server

hallow hearth
#

Ooh, news to me. Not modding for MP only, just polishing up a mod I made for myself in case there's wider demand to give some customization options

bronze yoke
#

generally i'd go with sandbox options for most things, people can be weird about dependencies

#

but if something makes more sense to be a 'player preference' thing and not a real gameplay change, mod options is preferable

hallow hearth
#

Yeah

#

It's a simple rp trait mod. Start with some injuries. A more RP friendly way to get a ton of extra trait points if I'm totally honest :p

jolly niche
#

Is there a way to add in a hotkey to drop a specific item and make it activate after landing on the ground?

ivory lance
#

I was wondering

#

Is there a mod which disables falling animation after getting shot by the player?

#

Like, something that would prevent ppl from stunlocking in falling animation durning pvp shooting

mellow frigate
#

see Dhert's answer

drifting ore
#

Take 3

#

Who can make a padlockable, indestructable metal chest?

blissful salmon
#

I'm looking for a solution for the following problem. I created an action which add the content of a bottle to a target. After this action I'd like to put the item back to the storage where it was before the action.
My problem is now that the item changed during the first action because now it's an empty bottle. So I can't transfer it back.

      ISTimedActionQueue.add(AddCustomLiquidIntoCustomLiquidObjectAction:new(playerObj, target, item, 25))
      if returnToContainer and item then
        ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, playerInv, returnToContainer))
      end

Is it possible to get the new item out of the first action?

sullen bobcat
#

Question.
I want to add a set of new variables to the vehicle class as shown in the image below.
What do I use to call these new variables for the vehicle so I can use them in my Lua functions when necessary - in the style of a get?
Examples of what I'm looking help with:
A) I need to check if the Boolean is set to true, and if false or nil return end.
B) I need to get a String Variable and set a local variable to it.
Thanks!
Also apologises for the what im assuming is a stupid question

bronze yoke
#

you can use getModData() to get a table attached to the object, most custom data is put in there

#

e.g. vehicle:getModData().IsArmoredVehicle = true

sullen bobcat
#

Weird, i shall try again

#

Must have had the syntax wrong i guess

mental jackal
#

hey folks! im wondering where item types like in [Recipe.GetItemTypes.RipSheets] is defined, and how can i use them

#

specifically i would like to find the item type for empty cans (beer/pop) and ammo, any help would be greatly appreciated!

bronze yoke
#

they're lua functions, they're all defined in server/recipecode.lua

mental jackal
uneven vessel
#

If I wanted to comission an armor set who should I be looking?

sharp timber
#

How do I set the condition of a vest (bulletproof vest for ex.)?
I'm looking at the documentation but I can't seem to figure out how.

`    local clitem = player:getClothingItem_Torso()
    if clitem then
        clitem:setCondition(clitem:getCondition()-damage)
    end`
#

getclothingitem_torso only seems to get the shirt layer

sage eagle
#

anyone know how to attach items to a belt?

#

i know nothing about this and just wanna be able to put the walkmans from true music onto a belt

#

similar to how you can with radios

drifting ore
#

Take 4: can someone make a padlockable, indestructable metal chest?

sage eagle
#

it doesnt

#

I've tried better belts and authentic Z

random finch
#

Is it cuz for older version of API?

drifting ore
#

Hi, is it possible to spawn zombies without any loot with the horde manager?

random finch
#

No

coarse sinew
manic relic
feral crane
#

is it possible to check if a zombie is male or female?

verbal yew
drifting ore
#

what about checking if a food item is rotten?

feral crane
verbal yew
drifting ore
drifting ore
feral crane
#
local zmale = idleSprinter:isMale()```
feral crane
undone crag
# sharp timber How do I set the condition of a vest (bulletproof vest for ex.)? I'm looking at...

someItem:setCondition(stuff) definitely seems it should work. You could add a print to see if it's defin - oh I just saw your next message which seems to say the problem is getting a reference to the vest? Maybe you could iterate through every worn item or every item in the main inventory and do things like instanceof(item, "Clothing") and item:getBodyLocation() and item:getCoveredParts() though maybe the last one will be not great.

heady crystal
#

This game is making me want to commit self destruct

#

How is it possible that I can have the SAME clothing item, with the same name, the same textures, the same properties, the same ID, same literally everything, in one mod folder and it works, and the other it doesnt

hollow current
#

There a way to print the objects in a square that player right clicks from the OnFillWorldObjectContextMenu? (An object that a player can walk through. A sprite, i guess (?))

I was able to get the square, but the functions I am able to find to use with the square only return actual physical collidable objects (or dropped world objects)

(There are some collidable objects too, part of mapping, that are not showing in the square objects. Any solution to that?)

mellow frigate
#

oh sorry I did not list those, just used square functions + vehicles in the end.

hollow current
#

ye was about to say that

gilded hawk
hollow current
#

I am basically trying to show a context option when a player right clicks an "object" in the world but that object is not collidable which I assume is a sprite

heady crystal
#

And it still won't work

#

So tired. So confused tired

gilded hawk
#

I got some free time, wanna send me the mods, so I can give you an extra pair of eyes?

#

i'm just chilling watching HOTD right lol

heady crystal
#

That'd be great, thanks! 💖

gilded hawk
#

No worries dude, send it in PM, and I'll have a look 👍

hollow current
gilded hawk
bronze yoke
#

in my experience the object list returned by the event isn't reliable at all and you should just get the square and loop through its objects manually

heady crystal
#

Nah it's a new mod

hollow current
heady crystal
#

Btw does anybody know how to mess with Player HP? I swear I found a way once but I seem to have lost it to time

gilded hawk
#

Nope, never tried that tbh

bronze yoke
#

player hp is the average of the hp of all their body parts

hollow current
heady crystal
#

Been trying some stuff like setHealth and setOverallBodyHealth but nothing works

bronze yoke
#

i wouldn't expect much

heady crystal
#

Thank you!

hollow current
#
-- Set the body part health to the new reduced health.
                character:getBodyDamage():getBodyPart(bodyPartType):SetHealth(newBodyPartHealthValue)```
#

My pleasure!

bronze yoke
#

yeah, those methods just set the value that the game automatically recalculates every frame anyway

#

they shouldn't have setters in the first place

heady crystal
#

Here it goes

#
local bodyDmg = playerObj:getBodyDamage()
local bodyParts = bodyDmg:getBodyParts()

for i=0,BodyPartType.ToIndex(BodyPartType.MAX) - 1 do
  local bodyPart = bodyParts:get(i)
  bodyPart:SetHealth(bodyPart:getHealth() - 30)
end
#

This works

fast galleon
#

You can also use ReduceGeneralHealth or AddGeneralHealth for this.

heady crystal
#

Note to self: 0.3 didn't do much, 30 instantly killed the player. 3 is where it's at.

heady crystal
drifting ore
#

so this is my first time making a mod with my own new items, and i've got a 3d blender model exported to .dae but im not sure how to assign it to my custom item, do i just do

#

i've got the model already as .dae in the media/models folder of the mod files

tranquil kindle
#

Isnt FBX and X only supported?

drifting ore
#

idk thats why im asking, i couldnt find much on it online

tranquil kindle
#

If you can, export it as FBX, but then still you need to describe model (not sure how its called ), where you name model and assign both mesh and texture to it

drifting ore
#

hm

#

alright i've got it as fbx

#

in the shading and texture paint panels of blender i already gave it textures and opacity stuff and i have the textures exported into the models folder as well tho i should probs move them to the texture folder

tranquil kindle
drifting ore
#

separate txt file i assume too

tranquil kindle
#

If you want to talk about the models, it be better to move to #modeling to not disturb this channel

drifting ore
#

its alr i found the right reference file in the game files

#

what about for custom icons

#

i've got the icon in the media/textures folder and for my item i set Icon = <pngname>.png

#

but i tested it and there was nothing

#

(my bad for the simple questions, i only started pz modding yesterday so i've yet to get the hang of this properly)

tranquil kindle
#

you have to add Item_<pngname>.png if i remember correctly to that texture, but don't add "item_" in txt file

drifting ore
#

oh alr

tranquil kindle
#

Item_iconname underscore didnt worked above even when edited.

drifting ore
#

alr

#

acc i do have another question about models so i'll ask in #modeling

tranquil kindle
bronze yoke
#

don't include the file extension either

drifting ore
drifting ore
hollow current
# hollow current but yet it returns nil on those none collidable objects

Solved this btw, for anyone with such future issue:

for _, object in ipairs(worldobjects) do
  local sq = object:getSquare()
  local tileObjects = sq:getLuaTileObjectList()
  for _, tileObj in ipairs(tileObjects) do
    local textureName = tileObj:getTextureName()
  end
end```

and add code based on textureName
drifting ore
#

Hey all, lots of fog still on certain things but if I create an isoobject and it’s working great when I create a new one… but my goal is for existing isoobjects of the same to inherit this new isoobject class I’ve made, is there an example of how to make sure it applies on already created isoobjects of that same type?

empty plank
#

can anyone help me make a helmet mod

#

ive been trying for days

ornate parrot
#

I've got a quick question

#

I want to make a mod that basically just makes 2 other variants of some clothes

#

however, I'm not sure how to go about that

#

nor I am not sure how to make that compatable with something like Spongie's Jackets

#

Basically, it's only 2 other colors for the leather jacket

hollow current
#

Pretty sure there's a function to change the color of a clothing item but if I'm not mistaken, it doesn't work with all clothing items. Haven't messed around with it before

ornate parrot
#

Oh I just mean like

#

Adding 2 extra textures the clothes can use

#

Basically the extra textures are really just reskins, for brown and red

#

I'm sure adding that is the easiest part, but making it compatible with something like spongie's feels like where it gets more complicated

sharp timber
undone crag
#

I don't know for sure that there isn't a Java function that gets your clothing item for a certain body location though...

heady crystal
#

Anybody know how to start a fire in a square without causing instant death to nearby players

#

IsoFireManager.StartFire() instantly kills my char if they're close

woven brook
#

Is it somehow possible to get over 100 people on a server?

#

We've gotten 90-100 our last few events and we have really great server specs. Could I modify the server source or something to get over 100?

mellow frigate
rich void
#

Hey ya'll can anyone confirm if my understanding is correct here.

Within the Zomboid Distributions.lua most containers that are within the All sub-table use proc-lists, but their are some exemptions, any container that is outside of a room does not use a proc list because of checks within the Java. But for example, a mailbox is never inside a building and instead explicitly lists items with weights for chances of spawning.

In theory using custom container types and defining them and inserting them into the All sub-table we can spawn loot in containers outside of rooms, given that we list the items via items = { instead of procedural = true yadayada? I'm begging to the iDev gods this is the case 😨

fast galleon
rich void
fast galleon
#

Every item is rolled separately. You can use bigger numbers than 100 as well.

rich void
sour island
dusty oriole
#

@sullen bobcat helped me mod in period-accurate my little ponies

ivory lance
dusty oriole
long grove
#

How can we see the source code? Decompiling does not show names of functions and variables?

bronze yoke
#

function names are maintained

long grove
#

do the zombies have boid-like movement?

hollow current
#

Anyone can explain to me the paramaters of character:Say?

tardy oak
#

Anyone can help setting height on clock top right when wearing a watch. setY() works just fine, but setX() seems to do nothing. What am I missing? (apologies I dont know how to embed code in discord)

stray willow
#

What would the process be of making a tile into an item. Like one that could be picked up, interacted with, etc.

#

Example:

I know base game has a bear trap tile. Now what would I need to do to be able to make the bear trap interactable and able to pick up?

#

Like let's say I wanted to make the bear trap an item. Something that can be grabbed from item list viewer and interacted with. Now I want to use that item in a recipe. Is it as simple as using the asset from the pack and making a new item?

dusk saddle
whole yoke
#

Where can i find the lua code that initiates the little light that appears when you fire a gun?

whole yoke
#

Or for thunderstorms as well, the light flashing

stray willow
#

I'm just trying to find where you can see the tiles like this 👀

#

Can't find where the base game tiles are located to be able to view them like that.

rich void
long grove
#

I've been studying this to get a better idea of zombie behavior. But how does it work in multiplayer?

https://www.youtube.com/watch?v=hglrA6FrxOw&ab_channel=Retanaru

In this video I explain and show off the zombie migration mechanics. The sandbox mode lets us modify many of the main mechanics of the game and allows me to show off what does what. The redistribution hours and in game sound events are the primary movers of zombies while the rally group system and others help to smooth the rest out.

https://ko-...

▶ Play video
neon bronze
dusty oriole
#

🫡 I'm going for period-accuracy for mine

#

(i'll probably have to make g2's as well)

ivory gyro
hallow hearth
peak swan
#

Hello I'm new to making mods for games, and I could use some help. I want to create a mod where the player can tie the sleeves of their jumpsuit around their waist. I tried using the code from Spongie's open jackets mod because I don't have much experience in modding. I also put together the Blender file by combining the fbx file of the boilersuit with the jumperTied file. It sort of worked, but the sleeves doesn't render in game.

silver iris
#

This is probably an extremely stupid question, but is it possible to use tags to limit what items can go inside a bag for example

bronze yoke
heady crystal
#

Never posted a mod here before but I'm proud of this one. Took so much effort!
It wouldn't have been possible without help from @bronze yoke and poor @sour island who had to go through the pain of finding out how to kill a zombie in MP and I just dug it up in this channel 😂

silver iris
#

Found it ignore me 💀

buoyant violet
feral crane
#

how do i make a function last for 2 in-game hours? i cant seem to figure it out

hallow hearth
#

How can I upload a mod to Steam if I have the Gog version of the game? Haven't used Steam since 2012

buoyant violet
tepid dawn
hallow hearth
# buoyant violet <:ded:721361533657022534>

I can download them just fine but for some reason Steam doesn't want free contributions... Not about to buy the game a second time just to be able to put mods I made for myself online

buoyant violet
#

You cant expect to use a steam service outside of steam

#

thats the thing

hallow hearth
#

Just means my mods won't be on steam, instead gonna end up on GitHub. Steam's loss not mine. Basically the same reason I didn't buy the game through them, why should I need to launch a game through their app when there's an option to actually own it permanently?

buoyant violet
#

you can still use zomboid without going via steam services wiith a simple command, plus you can also use mods outside of steam in steam servers you will just have download manually. the workshop is just a perk that will help you keep everything up to date. idk why you are mad, if you dont have the game via steam idk why the complain about wanting to use their service lol

hallow hearth
#

I'm talking about uploading

#

I made the mods in question

#

All I'm trying to do is release my mods on Steam's platform so other people can use them.

drifting ore
#

chat

#

how would i

#

in theory

#

make it so that a custom recipe only uses up a bit of an ingredient instead of the whole item

#

like if i have a custom recipe that uses salt but i dont want it to use up the entire salt shaker

dusk saddle
#

If I recall it's a semicolon (;) and afterwards a number, so for example:
Butter/Lard/Margarine;6,

drifting ore
#

alright great thanks

drifting ore
dusk saddle
#

I've personally never done that sort of thing before. I'd presume that'd work

drifting ore
#

alr

#

one last thing

#

lets say a recipe has 2 or more results

#

would it just be

result:<result1>,
result:<result2>,
#

or

dusk saddle
#

I believe you need OnCreate recipes to have multiple items

drifting ore
#

alr

verbal yew
#

RemoveResultItem:True,
OnCreate:YourFunc

drifting ore
#

gonna have to learn now

verbal yew
#

ahh... okey

drifting ore
#

also

drifting ore
#

what does Packaged = TRUE do for food items

verbal yew
drifting ore
#

oh ok

#

last last thing

drifting ore
#

ok cool thanks

#

couldnt find that site before

#

jeez thats gonna be useful

verbal yew
drifting ore
drifting ore
verbal yew
#

should be in .lua on server folder

#

function Recipe.OnCreate.YourUnicName()
code stuff
end

drifting ore
#

alr cool

#

i know function shit just not the file location coz this is gonna be my first time coding in lua

#

im already pretty good in vb tho it cant be that hard

verbal yew
#

just look like vanilla recipes work

#

some have OnCreate:func

stray willow
#

So... I made the bear trap an item. How would it make it to be able to be picked up and rotated? Also what would I need to do to make it solid like a wall

verbal yew
#

find it func by name in lua folder

#

u can use notebook++ for fast search into folder (and into every file)

drifting ore
#

yeah ik

tepid dawn
#

its an item type, similar to posters and mannequins

drifting ore
tepid dawn
#

actually any furniture in the game i think

verbal yew
stray willow
# tepid dawn I guess you have to make it a "Moveable" item

Right, I figure I need make it like.... say for example:

    {
        DisplayCategory = Furniture,
        Type            = Moveable,
        Icon            = default,
        Weight              = 0.5,
        DisplayName        = Modern Oven,
        WorldObjectSprite    = appliances_cooking_01_13,
    }```

Where it has the moveable type. My question is where does it grab the ways it can be rotated from?
verbal yew
#

not 3d model items in world

tepid dawn
#

they are just sprites ?

#

or am i wrong

verbal yew
#

yep

tepid dawn
#

i don't understand what do you mean im sorry

verbal yew
#

all moveables items - its tiles
tiles - its 2d sprite

#

item with 3d models dropped into floor look like 3d, but not have geometry

#

cant collide

#

etc

verbal yew
tepid dawn
#

ohh i think now I understand.

verbal yew
#

when u try drop on floor moveable items it set u into placament state

#

where u place 2d sprite (tile) in world

#

tile has parameters like collide, etc

hollow kiln
#

Does anyone know roughly how much it costs/how I'd go about commissioning a mod?

hollow kiln
#

I feel like it'd be pretty straightforward, but with no modding experience its hard for me to say

verbal yew
#

what special u want to create?

hollow kiln
#

Essentially a mod that add 'favourites' to your character - either picked during creation or selected randomly. Things like fruit, snack foods, booze etc would have 1 or 2 selected 'favourites' that provide a much larger boost to happiness and drop in bordem when consumed than as standard, providing a cool midgame goal and fleshing out your character a bit.

drifting ore
#

@verbal yew does my function file need any of this copied into it?

#

coz my function and end things dont light up in blue (current function is there only as placeholder)

bronze yoke
#

because your file is a .txt

drifting ore
#

good spot

verbal yew
#

not sure how fill your drainable bottle

#

setWaterAmount.... hmm

drifting ore
#

drainable bottle?

verbal yew
#

what about if the result of a recipe is liquid so i'd want it to be like that too, would i just e.g. put result:<resultname>;100,

drifting ore
#

yeah but im thinking not in a bottle, just a standalone item like milk where if you drink milk you don't keep the carton

verbal yew
#

hmm.....

#

we can create carton bottle drunk

drifting ore
#

well i don't really want one coz the "liquid" item created doesnt need its own container

#

coz you'd just use it for the next recipe

verbal yew
#

Maybe im wrong understood

#

not sure

#

u want recipe, when result item not be full

#

this item contain liquid +-

drifting ore
#

the result item itself is a liquid, not a container of liquid

supple briar
#

So Question, how does the game handle Mods spawning on firearms? Where is that code located?

subtle oriole
#

Quick question, but is it in any way or shape possible to make a map/mod that procedurally builds itself using pre-made “building blocks”?

The basements in B42 will be semi-randomly placed, so I was thinking if it was possible to do something like that, but in a grid pattern, and on the whole map. This can be done either as you move (making it technically infinite?) or by loading the map once (making it finite, but still random every playthrough).

random finch
#

Has anyone successfully found a method to determine if a zombie attacks a player?

#

Seems like a weird question, but it also seems impossible. We use to have OnBeingHitByZombie but it was depredacated.

undone crag
#

The mod "dangerous zombies" might have code for that.

random finch
#

Quite a few changes since this mods last update in 2020

#

Ill check it out though, thanks

jolly niche
#

For the item id in the mod.info, do I just name it whatever I feel like?

tulip cipher
#

For now yes

#

But when you update it to a workshop

#

Add that into there

jolly niche
#

What do you mean?

tulip cipher
#

At least I think

#

If you haven't uploaded your mod to the steam workshop then it doesn't do anything and you can change it to whatever

jolly niche
#

Will uploading it give it a new ID?

tulip cipher
#

Otherwise, it must be the same as the ID for the steam workshop item

jolly niche
#

Ah, gotcha.

tulip cipher
#

Steam give you one, you change yours to the one steam give

jolly niche
#

Next question, is there a way to code in a set hotkey to perform a specific series of actions?

tulip cipher
#

You can use on key pressed

drifting ore
#

@verbal yew for the custom function, what kind of filepath should i have for the function file

#

I have it as mods\ <modname>\media\lua\server

jolly niche
tulip cipher
jolly niche
#

I appreciate it.

verbal yew
drifting ore
#

rn i have a problem where if i try launching the game with the mod it just doesnt work so i cant even test my icons

#

gotta fix that now unhappy

#

@verbal yew is this function missing any important syntax

#

every time i try loading the mod it reloads lua but never finishes, and then i can't relaunch the game unless i delete the mod from my game files

cedar anvil
#

I managed to search for items in the player's bag containerplayer:getClothingItem_Back() but I can't find how I can search the player's other container like the Fanny Pack.

#

I tried to use getClothingItem_Torso():getInventory() But it seems it's not working

drifting ore
#

anybody know how to interpret this 💀

#

chat

astral dune
#

first line of PKCheeseExpandedrecipecode.lua has the word PKCheeseExpandedrecipecode with no '=' sign

drifting ore
#

i know

#

thank you

#

except idk where to put the '='

astral dune
#

why do you have that word?

drifting ore
#

i don't

#

it's the name of my lua file

#

tho maybe

#

just had an idea

#

i realise now

#

my lua file

#

has a module block

#

and an imports block

#

but now i think it might not even need it

#

so i got rid of those two

#

different now

#

crafting menu still doesnt exist

#

im deleting functions

jolly niche
#

If I set the type = Drainable how do I set the number of uses per item?

tranquil kindle
#

Isnt UseDelta for that?

drifting ore
drifting ore
jolly niche
#

Or am I over thinking this, and as soon as it adds up to 1 it's used up?

tranquil kindle
#

To be honest im not so sure, youre doing food item or?

jolly niche
#

I'm doing a light source.

tranquil kindle
#

for example UseDelta = 0.003,

drifting ore
tranquil kindle
#

its for Candle

#

So i assume its this amount from one per tic or whatever its called?

jolly niche
#

I want to make it five uses before depletion, so would that just be UseDelta = 0.2?

tranquil kindle
#

Uses?

drifting ore
#

i think usedelta works by game ticks

#

not uses

jolly niche
#

Hm. I guess I should look at the code for food and aid items then.

jolly niche
#

I keep forgetting the wiki has modding info on it, and spend thirty minutes searching the internet.

drifting ore
#

same

jolly niche
#

I don't want it to tick, I am trying to make it use the item on key press.

drifting ore
#

ok then probs use OnKeyPressed

tranquil kindle
#

Is there item like that either in vanila or modded?

jolly niche
#

The only item close to it doesn't do it the same at all, that's why I'm trying to make it how I think it would be used.

drifting ore
#

might be worth looking at this too

#

doesnt seem to have OnKeyPressed but if you look further on the wiki you'll probs find it

tranquil kindle
drifting ore
tranquil kindle
drifting ore
#

kERHUS told me to use the OnCreate function instead

tranquil kindle
#

Yes, use that function but instead of Add items just get AddExtraItem, i think it was used in some mod that made jars reusable, and recipe gave jar and a lid

drifting ore
#

but its fine i'll just use two separate recipes and have them just use 50% of the base ingredient instead of all of it

tranquil kindle
#

and one of those were added by OnCreate with AddExtraItem i think

drifting ore
#

if i get it to work in the future i'll update the mod

long grove
#

Can anyone help with restoring Hordes Alpha 0.5 (B41) ?

jolly niche
#

If I'm reading this right, using cantBeConsolided = false would allow me to take two similar items like Alcohol Wipes that have been used and combine them to make one fuller item. Or would I have to use the parameter ConsolidateOption to make the items combinable?

stray willow
#

I'm trying to make a crafting recipe and zomboid keeps using:

    {
        DisplayCategory = Weapon,
        MaxRange    =    1.2,
        WeaponSprite    =    Chainsaw,
        MinAngle    =    0.72,
        Type    =    Weapon,
        MinimumSwingTime    =    3,
        KnockBackOnNoDeath = TRUE,
        SwingAmountBeforeImpact    =    0.02,
        Categories    =    Blunt,
        Weight    =    3,
        ConditionLowerChanceOneIn    =    70,
        PushBackMod    =    0.5,
        SubCategory    =    Swinging,
        ConditionMax    =    15,
        MaxHitCount    =    1,
        DoorDamage    =    8,
        SwingAnim    =    Bat,
        CriticalChance    =    35,
        CritDmgMultiplier = 6,
        DisplayName    =    Chainsaw,
        MinRange    =    0.61,
        SwingTime    =    3,
        HitAngleMod    =    -30,
        KnockdownMod    =    0,
        Icon    =    Crowbar,
        RunAnim    =    Run_Weapon2,
        BreakSound  =   BreakMetalItem,
        TreeDamage  =   0,
        MetalValue = 150,
        CriticalChance    =    25,
        CritDmgMultiplier = 3,
        MinDamage    =    0.6,
        MaxDamage    =    1.1,
        BaseSpeed = 1,
        TwoHandWeapon = TRUE,
         WeaponLength = 0.4,
    }```


When I want it to use

  ``` item Chainsaw
    {
        DisplayCategory = ToolWeapon,    
        MaxRange    =    1.2,
        WeaponSprite    =    Chainsaw,
        MinAngle    =    0.72,
        Type    =    Weapon,
        MinimumSwingTime    =    3,
        KnockBackOnNoDeath = True,
        SwingAmountBeforeImpact    =    0.02,
        Categories    =    Axe,
        Weight    =    3,
        ConditionLowerChanceOneIn    =    70,
        PushBackMod    =    0.5,
        SubCategory    =    Swinging,
        ConditionMax    =    15,
        MaxHitCount    =    1,
        DoorDamage    =    8,
        SwingAnim    =    Bat,
        CriticalChance    =    35,
        CritDmgMultiplier = 6,
        DisplayName    =    Chainsaw,
        MinRange    =    0.61,
        SwingTime    =    3,
        HitAngleMod    =    -30,
        KnockdownMod    =    0,
        SplatBloodOnNoDeath    =    TRUE,
        Icon    =    Chainsaw,
        RunAnim    =    Run_Weapon2,
        BreakSound  =   BreakMetalItem,
        TreeDamage  =   35,
        MetalValue = 150,
        CriticalChance    =    25,
        CritDmgMultiplier = 3,
        MinDamage    =    0.6,
        MaxDamage    =    1.1,
        BaseSpeed = 1,
        TwoHandWeapon = TRUE,
         WeaponLength = 0.4,
        DamageMakeHole = TRUE,
        AttachmentType = BigBlade,
        Tags = ChopTree;CutPlant,
        WorldStaticModel = WorldItem_Chainsaw,
    }```
___
```recipe Make a Chainsaw
  {
 Motor,
 Chain=2,
 PetrolCan,
 SheetMetal,
 MetalBar,
 BlowTorch;5,
 keep WeldingMask,
 keep File,
 keep MetalWorkbench,

 Result: Chainsaw,
 Time:500.0,
 Category:Smithing,
 Sound:Hammering,
 SkillRequired:MetalWelding=9,
 AllowDestroyedItem:false,
  }```
Is what I have and the recipe is defaulting to the top one. 

I tried the result as AuthenticZ.Chainsaw but that didn't work. Anyone have suggestions?
low scroll
#

Im looking for the house alarm audio files but the ones used in game are not in the media sound folder, any ideas as to where they are ?

bronze yoke
#

they're in the fmod soundbanks

#

the loose files in the sound folder are almost entirely unused

low scroll
#

How do i open bank files ?

#

Probably need some speical software

#

Thanks anyways

#

i was able to adjust the watch alarm and the alarm clock alarm though

#

Just couldnt find the house alarm file

low scroll
bright wolf
#

if i were looking to make an item mirror some vanilla item functions, where would i look to find how to implement those, and can a single tool act as multiple? think lug and screwdriver and wrench combined. i'm trying to make a multi-tool item from a show i like, and am using it to learn my way around the workflow.

polar gyro
#

I want to make additional attachment point at belt. Just visual adjustment, like AttachmentType Nightstick, Hammer, Meat Cleaver, etx.
Is there any good mods which I can look for?

nova socket
#

Is ModData stored permanently only on server-side?

UPD No its stored permanently anywhere.

boreal rose
#

What exactly does changing the MinAngle stat of a weapon do exactly?
Based on the name I would expect it affects how wide I can swing my weapon to hit a zombie, but to what extent would say, if I were able to swing my weapon and hit a zombie even behind me, what value? That would be maximum usable value, anyhow.
Based on anecdotal observation and most weapon stats being under 1, hovering around 0.7,

#

I stopped here because I found a forum post from 2015 that seems to answer my question

#

Well, the answer isn't fully verified, but doesn't seem hard to test

#

yeah I'm not sure how exactly changing the MinAngle affects the weapon

tranquil kindle
#

The closer to 1 the lesser the angle you can hit player/zombie and same with green outline

#

So you have to be more precise with mouse in terms of aiming

nova socket
#

Any ideas why OnFillWorldObjectContextMenu is listing the same tile multiple times in its worldobjects ?

random finch
#

Anyone know why there are two different addhole functions? Both used in PvP.

addHoleFromZombieAttacks & addHole

formal rain
#

hi, im just getting into learning how to mod pz so i'm sorry about the possibly newbie question but how can i add a blacksmithing skill to make the vanilla smithing recipes tab useable?

tranquil kindle
#

I think there is already mod like that, you could take a look tho and implement your ideas

formal rain
#

👀 i'll try to find it thank you

empty plank
#

is there a fix for my problem my helmet is in half why the model is perfectly fine

outer crypt
#

I set up some code for containers and created some objects that drain but neither is updating to other players on multiplayer servers. Is there something I am missing?

#

even on my test server if I load the box up with equipment and leave it all disappears when I return.

#

I verified in solo that it is not replacing it again but in multiplayer I see no errors

#

thank you for any feedback 🙂

hollow kiln
#

Does anyone know roughly how much/how I would go about commissioning a mod?

formal rain
#

how can i see details of other mods?

#

^to study and learn, not to edit

tranquil kindle
#

At the bottom of mod page you will in most cases find Workshop ID : numbers

#

you copy those numbers, and go to your steam folder>steamapps>workshop and just Search fir those numbers in search bar

formal rain
random finch
#

From Java:

if (this.ParentChar instanceof IsoPlayer && GameClient.bClient && ((IsoPlayer)this.ParentChar).isLocalPlayer())

A player can be both a client and local player?

#

Would be something like this in LUA:

if instanceof(player, "IsoPlayer") and player:getGameClient() and instanceof(player, "IsoPlayer"):isLocalPlayer() then
mellow kettle
#

Does anyone know a mod that adds like currency and shops and lets you access it anywhere in the world?

bronze yoke
#

isLocalPlayer means 'is this IsoPlayer a player who is playing from this process'

random finch
#

Appreciate the clarity.

cursive junco
#

Trying to test a sound right now what would this section of code look like?

tawdry solar
#

and this was 3 months ago

cursive junco
#

I checked your activity before pinging. I don't see the harm in asking but no worries

cursive junco
#

Tried running this as a test and am getting no success, what am I missing

local function onKeyPressed(key)
--the says "Hello world" when pressing the Q key. 
    if key == 16 then
        getPlayer():Say("Hello world")
    end
end

Events.OnKeyPressed.Add(onKeyPressed)

This is being run in ProjectZomboid\mods\Test\media\lua\client\TestScript.lua the mod is on in game
Maybe it's overlapping with the yell? or 16 isn't Q?
I don't know how to check the keycode/ what keycode chart it is using to reference. I also don't know how to debug the code to see where it's failing. Any help would be appreciated.

sturdy salmon
#

Hello, good afternoon. I don't know if this thing that I'm going to mention exists or if someone is already working on it, but I would like to investigate and make a mod that allows you to use the fog shovel, to be able to remove or collect it. If it is not in development, and someone wants to work with me on this idea, we get to work. If it exists, and you can share the mod with me, I would appreciate it. I suppose it would be a similar mechanic to what happens with grass/dirt, which allows you to collect it in a bag. I don't know if that would be the idea, it is more than anything, to allow, in the winter, to clear the path a little. Thank you. https://pzwiki.net/wiki/Snow_Shovel

nova socket
#

Ok a really important one.
How do you properly translate and return world coordinate to screen coordinate? Bunch of things I found in utils does not seem to work outside of mapAPI in the map itself and sometimes not even used anywhere, so probably not implemented.
Anyone?

bronze yoke
#

oh the other way around, isoToScreenX/Y

icy dome
#

Hello ! Can I use a lua mod to run code in C?

bronze yoke
#

no

icy dome
bronze yoke
#

there are a couple languages that can be transpiled into lua but to actually run non-lua code would require hacking the game itself

hollow current
#

can other players/zombies hear sounds played in character:getEmitter():playSound(sound)?

bronze yoke
#

zombies no

#

you have to use addSound to attract zombies

hollow current
#

alright so, im planning to play a sound for all online players, so logically i don't want the player to hear the sound played for him and played for other nearby players, it'll create a very "unnice" duplicate effect, any way to do that?

nova socket
bronze yoke
#

playSoundImpl is clientside, don't have specific information on whether character emitters are normally networked but other emitters are unless you use that one

#

yeah, if your mod doesn't support splitscreen you can just put zero

#

otherwise IsoPlayer:getPlayerNum() for the player whose screen you are trying to get world coordinates from

bronze yoke
#

if you're using this for mouse input then the mouse player is always player zero anyway

robust briar
#

Anyone have a way to legit duplicate/clone an item? I have tried a ton of things less manually going through every possible get/set function for all the possible item types.

#

If I could get an instance of a ByteBuffer in lua.. I could use the save/load methods.. but alas I dont seem to be able to get an instance of a ByteBuffer

bronze yoke
#

that would be bad, they'd both have the same id

robust briar
#

Thats easy to work around

#
function DuplicateItem(item)
    local tempItem = InventoryItemFactory.CreateItem(item:getFullType())
    local b = tempItem:getByteData()
    item:save(b, false)
    local newItem = InventoryItemFactory.CreateItem(item:getFullType())
    local id = newItem:getId()
    newItem:load(b, IsoWorld.getWorldVersion())
    newItem:setId(id)
    return newItem
end
#

This doesn't work

#

But it "feeeeeels close" lol

dense vortex
undone crag
lunar shore
#

How do remove a bandage from a character? The problem is that even with the bandage on, bleeding is applied, instead of removing the bandage and applying bleeding

            local bodyDamage = player:getBodyDamage()
            local bodyParts = bodyDamage:getBodyParts()
            for i=bodyParts:size()-1, 0, -1  do
                local bodyPart = bodyParts:get(i)
                if tostring(bodyPart:getType()) == "Head" then
                    if tostring(bodyPart:getType()) == "Head" and tostring(bodyPart:bandaged())then
                        bodyPart:setBandaged(false)
                        
                        bodyPart:setBleeding(true)
                        bodyPart:setBleedingTime(40)
                    else
                        bodyPart:setBleeding(true)
                        bodyPart:setBleedingTime(40)
                    end
                end
            end
fleet smelt
#

Is exclusively modding serverside possible? Say I wanted to intercept text and only send to certain players etc. Can I do this without sending the client files, or having them uploaded to the workshop?

blissful salmon
#

I'm using the OnCooked attribute on an item. The function so far is called correctly and my code is running.
My new item which I add to the container however disappears when I try to take it out of the container.
I use the following code to add the new item to the container:

  container:AddItem(resultItem)
  --container:addItemOnServer(resultItem)
  container:DoRemoveItem(item)
  --container:removeItemOnServer(item)

I experimented with the ...OnServer functions but I had no luck so far. I assume it's a client/server problem because the item is added on the server (at least thats how I understood it). The lua file is also in the /lua/server/ directory.
Can someone tell me how to do this correctly?

Edit: I forgot to mention that this happends when I Host a server. In solo it seems to work this way.

ebon needle
#

Do you guys see anything wrong with this?

#

I'm trying to replace sounds, but the sounds don't seem to be working

#

What am I doing wrong?

undone crag
#

Maybe the --sounds_item.txt bit is breaking it. -- us used for comments in lua but that bit might need something like /*sounds_item.txt*/

ebon needle
undone crag
#

Maybe having media/sound in the file path is bad? (about sound)

ebon needle
bronze yoke
#

it's supposed to, but sometimes it doesn't

#

you're safe for anything more recent, and most things have been updated to use them

ebon needle
#

I was looking at this mod as reference

#

It has media/sound/

#

But it also has the filetype 🤔 now that I look at it again

livid badger
#

I noticed that farming mods don't work well on servers. In the sandbox, when you hover over a plant, the correct text is displayed, the sprites change correctly, but on the server everything does not work as expected. Has anyone had a similar situation and how did you solve it?

ebon needle
ebon needle
blissful salmon
#

At the moment I'm out of ideas for my problem.
#mod_development message
Does anyone have a hint or know a mod/source which I can check?

undone crag
hallow hearth
mellow frigate
mellow frigate
livid badger
blissful salmon
# mellow frigate you need to give more data: at least the whole OnCook function you made includin...

This is my current function:

function PotWithFishGuts_OnCooked(item)
  print("OnCookedTest: " .. item:getFullType())

  local itemModData = item:getModData()
  itemModData.CurrentCookingTicks = itemModData.CurrentCookingTicks + 1

  if itemModData.CurrentCookingTicks < itemModData.CookingTicksToGetFishOil then
    item:setCooked(false)
    -- Resetting the heat is needed because drainable items stop updating after the container temperature is reached
    item:setHeat(1.61)
    return
  end


  --local character = item:getPreviousOwner()

  local resultItem = InventoryItemFactory.CreateItem(item:getModData().SoulModReplaceOnCooked);
  --if not resultItem or not instanceof(resultItem, "DrainableComboItem") then return end

  resultItem:setUsedDelta(item:getUsedDelta() / 5)
  resultItem:copyConditionModData(item)
  --resultItem:setPreviousOwner(character)

  local container = item:getContainer()

  container:AddItem(resultItem)
  --container:addItemOnServer(resultItem)
  container:DoRemoveItem(item)
  --container:removeItemOnServer(item)
    
end

The file is located in the /lua/server/ folder.

mellow frigate
livid badger
#

Well, I can describe the problem in detail, but as I understand it, you have not encountered this, and I would not like to take up your time.

mellow frigate
mellow frigate
#

at your place I would print everything I can and check nil everywhere in the function

#

server is the place ! 🙂

blissful salmon
#

the item that im cooking is a drainable item. And this part seems to work. The only problem I have is that on a Hosted Server the item that ist createn in the oven disappers in the client inventory on transfer. I also found out that I can directly "Place" the item outside of the container and it stays. When I pick it up afterwards it remains in the inventory.

cursive junco
undone crag
#

You could print something outside of the function definition to see if the lua file is loading?

ebon needle
cursive junco
bronze yoke
#

the mods folder in ProjectZomboid is not usually loaded

mellow frigate
bronze yoke
#

use the one in %userprofile%/Zomboid/

cursive junco
#

That's the ticket, thanks. I was trying to figure out what I was doing wrong in the code all last night and it wasn't in the code. So frustrating.

mellow frigate
ebon needle
mellow frigate