#mod_development

1 messages · Page 145 of 1

fading horizon
#

so much trial and error

rancid panther
#

your workshop page is on tetris mode

merry saffron
#

Horde manager isn't working to spawn zombies. Is it bugged?

ancient grail
merry saffron
rancid panther
#

if your zombie population is set to 0 you cannot spawn zombies

fast galleon
#

is zed pop set to 0?

rancid panther
#

same brain

merry saffron
#

Ah, that's it

#

I was hoping it had changed since i lasted tried to do zombie testing in debug many years ago

#

Is there a way to see the health of a door in debug?

twilit rune
#

Hello there!
What is the best way to implement sandox options for a mod? With the help of mod options? Or is there any better way?

merry saffron
#

Is there any way to make it so zombies get bored and give up after hitting something for a while?

fading horizon
#

i am so satisfied with this rn

#

modpage if anyone wants to see the layout

#

id appreciate if someone checked that it looks okay on their pc and not just mine lol

twilit rune
#

PC looks nice, but mobile goes brr if you mind it at all

rancid panther
#

it's really steam's fault for all this

nova dome
#

hey guys I'm making my first mod by forking another one and I am struggling with figuring out how the data is arranged in these lua tables. There are tables in a table but some of them are empty so I can't just dump them, I tried some inspect library but couldn't get it to work

#

wwyd

glass basalt
#

Steam Mobile is a steaming pile of shit for navigation, even with the major UI update they did. Better than nothing though.

glass basalt
glass basalt
nova dome
ancient grail
#

I have a code to reenable that using console

#

The zed spawn i mean

neon bronze
#

To see what the list has

nova dome
neon bronze
#

Double click the line in fileviewer through the f11 menu

nova dome
#

scrolling the file list I now understand why the mod maker has a separate file for next to every function in the project

rancid panther
#

is there a boolean check to see if a function is currently being run?

nova dome
#

i should see the contents in object stack?

warm vessel
neon bronze
#

Yep or somewhere on the left

#

Just double click it and a new window will open

rancid panther
#

are light switches the actual source of light in this game?

#

nvm

nova dome
neon bronze
#

Could be a java array

#

I dont know if they get printed as tables though

rancid panther
#

wait are they actually?

nova dome
#

there's a KahluaTable which doesn't open in the debugger

neon bronze
#

How do you get the table?

nova dome
#

u mean where it's from? or how i see it in the debugger

neon bronze
#

In the code

nova dome
#

it seems essentially for example getTraits();

#

it's playerdata

neon bronze
#

Could you paste the call here? Im not on pc rn

nova dome
#

this is the one part of the table I'm interested in ```function RecoverableTraits:Save(player)
Respawn.Data.Stats.Traits = {};

local traits = player:getTraits();
for i = 0, traits:size() - 1 do
    table.insert(Respawn.Data.Stats.Traits, traits:get(i));
end

end```

#

it's pretty convoluted maybe i should try to focus on this exact function first

neon bronze
#

What table do you want from this?

nova dome
#

i need a string list of names of the traits the character has basically

#

but at a later point by loading the saved data when character is no longer alive

#

maybe I just need to do my own saving function or sth

neon bronze
#

So far i know there is a GetFromIndex for perks maybe look in the pz documentation for calls

#

I meant traits not perks

nova dome
warm vessel
#

Yes

thorny pollen
#

player:getTraits():toString() is this what you want?

#

written to file as example

rancid panther
#

jesus christ

#

flashbanged me

rancid panther
#

so if i made the nearest tile the sound emitter source, would that make it so every tile a dif emitter?

nova dome
rancid panther
#

i think i might be able to use PlayWorldSound

#

i'll take another look at it tomorroe

fading horizon
#

tetris mode is complete

#

what do yall think

rancid panther
#

i bet if you do a t spin the whole description will disappear

#

🤣

fading horizon
#

lmao

rancid panther
#

it looks great!

thorny pollen
rancid panther
#

i got .01 progress on my mod today at least since i only had so little free time

rancid panther
#

i separated the startup function to its own event so i can test it and do other things to make sure it functions properly

#

and ofc every progress leads to 10 more questions

thorny pollen
rancid panther
#

maybe for statistics

thorny pollen
#

yeah

rancid panther
#

that's info i wish i had sometimes

fading horizon
thorny pollen
fading horizon
viral notch
#

where to set how much player get XP for fixing something ?

fading horizon
#

gn everyone

viral notch
#

im looking to give player 20xp per repair custom item but not sure where to set it

thorny pollen
cosmic condor
#

better keep full width and let the user read from top to bottom

fading horizon
#

It is full width just two columns

viral notch
#

is there way to request from player to have item but wont be taken after use?
like in receipt you use keep option but in fixing ?

fading horizon
#

Technically more info per space

cosmic condor
#

that will make people refuse to read further

#

when they read from left to right and hit the box, they will be unsure if they should read the next right box or the bottom box

viral notch
#

anyone can help me with fixing script ?

viral notch
#

it can be damaged and destroyed but want to make option to fix it with xp for carpentry skill...

thorny pollen
#

you can use this but you'll have to do some steps before it to get a InventoryItem

viral notch
#

it is item already

#

but to fix i want to give xp in fixing function
not as recipe function

thorny pollen
#

do you want it like fixing weapons where you right click on it in inventory

viral notch
thorny pollen
#

like is it when It's on the window in the world you can repair it?

viral notch
#

is like anything

thorny pollen
#

oh so It's these types of files

viral notch
#
fixing NameYourFIX
{}
thorny pollen
#

where do you find the vanilla ones?

drifting ore
#

Does anyone know if it is complicated, or if there is a simple way to make a mission system? Something similar to the snake mod pack, where I go to a container, drop an item and it automatically gives me back another one (or make an npc).

viral notch
# thorny pollen oh so It's these types of files

problem is in game when you repairing cloths you Tailoring exp
when repair something electric like radios or tv or even generator you get Electrical exp
and when repair vehicles you get Mechanics exp

and i'm looking where is located that file for refer XP of repairing those items....

#

from vehicle parts only found for fixing engine .... for rest parts still not sure

nimble spoke
drifting ore
nimble spoke
drifting ore
#

Okay, thank you. Because that's what I was interested in, that the player would complete some quests to complete the map, even if it was something as simple as delivering items. I'm looking forward to seeing it when it comes out.

loud moth
#

Hello I'm a novice Modder and I'm trying to make a mod that adds in Chloe's pickup Truck from Life is Strange I've got the model and I've even spent some time finding the right coordinates for all the interactable on the truck but when I load the mod into my game the trucks body is completely invisible, how I made the mod is i went and found a mod a truck mod and severally edited the code, models and general information to better suit my mod

#

im not sure if there are any tools to make this easier but ive been doing it manually so far

drifting ore
#

any info in the log?

loud moth
#

im not really sure i can tell whats old and whats new is it possiple to move the log out of the folder and boot the game with just my mod to see only those logs?

drifting ore
#

You do not receive any errors when running the game?

loud moth
#

last i remeber was error number 4 i think but i can check again

worldly olive
drifting ore
#

Remember that when you add a vehicle to the game, you must start a new game. check the error code.

loud moth
#

alright ima go see if there are any errors just a moment please :)

nimble spoke
viral notch
#

small question can be used Moveable item in crafting

neon bronze
#

I know it can be used as a result

viral notch
#

crap

worldly olive
viral notch
#

BrokenGlass is defined as moveable item so ugh i wanna make from it bulb

#

glue + broken glass + metal scrap + metal wire = light bulb

nimble spoke
#

If there were no changes to that. Moveables can be the result of a recipe but not ingredients

viral notch
#

dam it why it is defined in game as moveables object not as item

#

is there way to move that object to item ?

#

like convert

#

when you have Moveable_Broken_Glass in inventory it will replace that with item.BrokenGlass ?

neon bronze
#

Pretty sure moveables stay moveables in inventory

loud moth
fast galleon
drifting ore
loud moth
drifting ore
#

You have set it in : /MyMod/Vehicles/chloecartxt ?

#

mymod = your name mod

loud moth
#

yessss i think

drifting ore
#

You are getting this error because it is not well configured in the mod itself, check it. Sometimes the solution is the simplest there is. And if I remember correctly, PZ's 3d modding supports OBJ, FBX, and 3DS

loud moth
#

yea after i get it half ass working ima go back through and fix any
or bad lua code

#

yep that was the problem

#

lol

#

now i got other issues that i actually know how to fix

#

thx so much!!

drifting ore
#

If I remember correctly, that error is due to dimensional issues in the texture, if you have used the texture of a sports car in that car, that will happen, try with a normal texture of that car to see if it still gives you error.

red tiger
#

That screenshot looks pretty cool.

#

Hey. Anyone know of any "Templates" for types of items or any scripts that are available online for helping modders?

#

I can fully integrate these for the VSCode extension that I'm currently writing.

#

Like "Create New Weapon" command generating a template where name, tooltip, and some other things could be filled in as a starter for weapons.

nova dome
red tiger
#

Implementing templates for new script definitions..

brazen fossil
#

any idea what i could have fucked up? XD

red tiger
#

Both the PZWiki and Wolf's guide doesn't have documentation to describe the item block.

old crescent
#

where can I find the custom non pvp zone file

old crescent
brazen fossil
#

wait, really?

#

what should it be?

old crescent
#

maybe, .. not sure .. but majority the texture size

#

check the vanilla texture size of that specific cart

brazen fossil
#

its the same

#

1024x1024

old crescent
#

file size

brazen fossil
#

huh...

#

but it worked before

neon bronze
#

anyone knows where the weapons that get spawned stuck in zombies are defined?

old crescent
#

maybe some people knows

brazen fossil
#

its not texture size i fucked up something in code trying to add the estate

nimble spoke
neon bronze
#

yep found it thanks

red tiger
#

The Recipe block in scripts is always such a trouble-child...

red tiger
indigo current
#

my bad

#

i'll delete and move over

red tiger
#

Going hard on them docs. heheh.

#

Making it so there's no way that the scripter couldn't figure out something when scripting. =)

#

The extension is more intelligent with scope-detection too so I can also make it where options only shows up when in a valid scope.

#

like

vehicle MyVehicle {
  // ...
  part MyPart {
    // ...
  }
}
#

Templates / auto-complete should help out a bit.

ancient grail
#

wait jab

#

you have a functional vehicle script syntax ultimate tool now

#

woah

#

this is groundbreaking

#

links pls

#

@red tiger PLEASE SIR

#

this will solve our current syntax confusion

red tiger
#

I mean.. I'd need to fill this portion out for the extension.

#

That might take upwards of a week for vehicles alone, however it is planned.

ancient grail
#

ok looking forward to this like 100%

red tiger
#

I'd need to figure out how vehicles work.

ancient grail
red tiger
#

If I had someone construct vehicle "templates" for types, I could add them as commands.

#

I have hover-documentation & auto-complete support already in-place and ready to go after vehicles when I get there.

ancient grail
#

maybe ask skiz if his willing? idk

red tiger
#

I still don't know how to script lol.

#

@faint jewel Up to you bud if you want to throw a hand in vehicle templates.

ancient grail
#

creator of zedscripts dunno how to script thats ironic

red tiger
#

BTW the vanilla scripts currently in Build 41 are full of dead properties that were removed ages ago.

red tiger
#

A lot of the scripts in PZ can be cleaned up if a formatter detected and either commented or removed dead properties.

#

That and the insane whitespace / tabbing.

#

I have to write another Lexer because the one I wrote was for digesting script-data, not for formatting.

#

After documentation comes formatting. After that I can begin to look into diagnostics & error-detection along with "Quick Fix" support. =)

ancient grail
#

Goodluck boss

neon bronze
#

does anyone know how to rerender a zombie? I add an attached item to it but it wont show unless its dead

bronze yoke
#

i've seen zombie:resetModel()

#

don't know if that actually does what you want but that seemed to be what it was meant to do in the code i saw it in

merry saffron
#

Is there any way to make it so zombies get bored and give up after hitting something for a while?

drifting ore
#

How do I make a distribution

#

I’m can’t do that, that takes so fucking long

indigo hemlock
drifting ore
#

How can I tell if my item is spawning?

dusk saddle
#

I'd suggest going into debug mode, enabling the 'LootZed' cheat and going to a location where your item would spawn. From there you can right click on a container icon in your inventory to access LootZed. It'll have a list of items and their spawn chances

sour island
#

I'm considering making lootZed easier to use in the community tools 🤔

#

Or maybe more obvious

#

Perhaps just a little (!) next to the button

drifting ore
#

I’m about to publish my mod and it’s not showing up in the workshop creation tab on zomboid

sour island
#

Do you have the workshop folder setup properly?

drifting ore
#

How do I do that

#

I just put it in

sour island
#

It needs to be in the local workshop folder for starters.

drifting ore
#

Where’s that

sour island
#

And you need a folder in there that contains the mod's content and workshop.txt

#

It's your local cache folder -- usually user/Zomboid/Workshop

bronze yoke
#

copy the structure of Workshop/ModTemplate

drifting ore
#

How do I get to my local cache

#

Nvm I see it

#

I named it content instead of contents

#

Now it’s saying preview.png is not readable

merry saffron
#

What zombie state determines whether they are aggroed? is it walkTowardState, isAttacking, or something else? Also, when a zombie thumps on a door, while seeing a player through it, is it both thumpState, and whatever the state for aggro is as well at the same time?

bronze yoke
#

i haven't looked into it specifically, but i don't think aggro itself is a state?

young granite
#

I'm pretty new to PZ modding and i wonder if there's an explosion event and can i trigger it on zombie hit?

merry saffron
bronze yoke
#

probably getTarget()?

merry saffron
#

How might I determine how long a zombie has been in a thumping state?

bronze yoke
#

you might need to use OnAIStateChange to record the time they entered the state

#

and then compare to the current time

merry saffron
#

Are there any mods that significantly change zombie behavior? I could use one as reference

viral notch
#

is possible to add in temple location of place item?

merry saffron
bronze yoke
fading horizon
#

i have the best idea for a mod

#

i think i can make it today

merry saffron
#

How do I force a zombie out of a state or change a zombie's state?

bronze yoke
#

changeState(state)

#

i've heard the zombie ai usually interferes with stuff like that though

dusk saddle
#

Aloha there, folks. I've been having some technical difficulties with getting the lunch box spawns to work, it claims they're null. I presume there might be something wrong with the script here? I have the Distributions.lua file marked as required (where they reside in) - though they don't seem to work. The vending machines work just fine on the other hand.

table.insert(Distributions["all"]["Lunchbox"].items, "PompsItems.PISchoolMilkChocolate");
table.insert(Distributions["all"]["Lunchbox"].items, 1.0 * SandboxVars.PompsItems.DrinksSpawnRate);
bronze yoke
#

doesn't seem like Lunchbox is under all

#

Distributions["Lunchbox"].items should be good

dusk saddle
#

Ah all right, appreciated. I'll give 'er a go

#

Evidently, I needed it to be SuburbsDistributions - I was under the impression that was wrong and left the ["all"] part - all better now!

merry saffron
#

Can anyone help me understand what I'm doing wrong here? I want zombies to stop thumping if they haven't seen their target for 15 seconds, but it isn't working.

bronze yoke
#

zombie:getCurrentStateName() returns a string, but you are comparing it to an object

merry saffron
#

I just forgot to remove name from the getCurrentState

#

That didn't work either though

bronze yoke
#

i'd throw in a print to make sure your code actually gets to this point
zombie:changeState(IdleState:instance());

bronze yoke
merry saffron
#

So maybe I'm misunderstanding what output "getTargetSeenTime" does

#

Ah, it's not how long since they've last seen the target; it's how long they've seen the current target for

#

How can I get the time since a target was last seen by a zombie?

atomic trout
#

how are you supposed to set up folders for a workshop item in project zomboid.

bronze yoke
#

look at Zomboid/Workshop/ModTemplate

drifting ore
#

I made a recipe and when I test it the result is make and a part of the recipe. I also don’t know how to make it so the result it multiple items

fading horizon
#

wip preview of my next mod

merry saffron
#

How does the zombie ThumpTimer work?

atomic trout
drifting ore
#

only one of my recipes is working in this script pls help this is only my second mod jaja

merry saffron
#

How do I access a zombie's "TimeSinceSeenFlesh" field?

#

I saw another mod do this. Should doing this allow me to access a zombie's fields?
local zombieData = objectData[zombie]

rancid panther
drifting ore
rancid panther
#

nope. im not on my pc atm so i cant preview files

drifting ore
#

Oh ok

rancid panther
#

if i remember later and u havent got an answer i will take a look, but i dont really do anything with scripts

drifting ore
#

has anyone ever tried to make a house indestructible? it will not break even with fire, explosions or sledgehammer.
I want to make a warehouse that can only be accessed if you have a card (simulating a key) and can not destroy any part, both the zombies and the player. to make a mission system. Something like Labs de escape from tarkov. if u play the game

#

Bro

merry saffron
#

In this file, how do I access zombie's 'TimeSinceSeenFlesh' field?

rancid panther
drifting ore
#

?

#

wdy,

#

wdym

rancid panther
#

items.txt
recipes.txt

drifting ore
#

oh i see thx

rancid panther
#

which recipe works

drifting ore
#

dismantle knife

#

thats the only one

heavy jewel
#

has anyone here worked on modding the stealth system on the Java side?

drifting ore
#

ehm

#

this is real?

#

idk for programing

drifting ore
#

-- Function to activate the mission
function activateMission()
-- Get the player
local player = getPlayer()

-- Create a new mission
local mission = player:getModData().mission

-- Define the mission details
mission.name = "Deliver Object to Designated Crate"
mission.complete = false
mission.crate = "Crate XXX"
mission.item = "Object ZZZ"

-- Display the mission objectives
player:Say("I need to deliver the " .. mission.item .. " to the " .. mission.crate .. ".")
player:Say("The " .. mission.item .. " is in my inventory.")

end

#

-- Function to check if the mission is complete
function checkMissionComplete()
-- Get the player
local player = getPlayer()

-- Get the mission data
local mission = player:getModData().mission

-- Check if the player has delivered the item to the crate
if not mission.complete and player:getInventory():contains(mission.item) and player:getTile():getObjects():contains(mission.crate) then
    -- Remove the item from the player's inventory
    player:getInventory():RemoveOneOf(mission.item)
    
    -- Add the new items to the crate
    local crate = player:getTile():getObjectList():get(mission.crate)
    crate:AddItem("Object VVV")
    crate:AddItem("Object MMM")
    
    -- Set the mission as complete
    mission.complete = true
    
    -- Display a message to the player
    player:Say("Mission complete! The " .. mission.item .. " has been delivered to the " .. mission.crate .. ".")
end

end

heavy jewel
# drifting ore this is real?

yeah, for real. there's a couple references to the Java API in the docs, but I can't tell if anyone is actually patching Java for their mods.

drifting ore
#

This should not work then, should it?

#

Because it would seem too much to me that an AI could generate a mission in project zomboid.

merry saffron
#

Can I access a java class's fields from lua?

bronze yoke
#

well not total... but it's nowhere near a complete releasable mod

heavy jewel
bronze yoke
#

sometimes you can grab fields with reflection but it's really annoying and ugly

#

and for some reason a couple select fields throughout the entire game just work

#

now that i think about it it might be because they're static fields

heavy jewel
#

do you have an example of a directly accessed field on the lua side?

bronze yoke
#

ScriptManager.instance

#

GameTime.instance to a lesser extent - for some reason that gives you a cursed instance that doesn't work properly, which doesn't make any sense, but it sure is a thing that happens

heavy jewel
#

mmm. LuaManager.setExposed

drifting ore
bronze yoke
#

missing commas after Time: entries

drifting ore
#

In a few days a quest creation system will be released, I'm looking forward to see it and see how it works. The problem in PZ is the late game, even if you set it to maximum difficulty and with very little loot, in the long run you have nothing to do.

drifting ore
rancid panther
#

u

bronze yoke
#

you

drifting ore
#

Now to crafting menu won’t open

#

This is a disaster

merry saffron
#

Does getThumpTimer() work at all? When I use it, I just get 0

heavy jewel
# bronze yoke GameTime.instance to a lesser extent - for some reason that gives you a cursed i...

there seems to be a pretty general method of getting Java fields on the Lua side (getClassFieldVal): https://theindiestone.com/forums/index.php?/topic/22480-anticipating-zombies-edited-zombie-behavior-now-in-lua/&do=findComment&comment=260478

bronze yoke
#

yeah, that's the reflection stuff i was talking about

heavy jewel
#

gotcha. it does look like static fields might get exposed by default, but I can't confirm. nothing in the kahlua docs, anyways.

bronze yoke
#

yeah, i couldn't really see anything in the java explicitly exposing them

rancid panther
drifting ore
rancid panther
#

from the name KR, i would just differentiate them with KR_items.txt and KR_recipes.txt or something

#

try putting them back in your main file and see if it works again. and if it works, show me what both files look like when u separated them

#

my guess would be that you're missing the module Base{ or } in your new file, if you just cut it out and paste it to a new file

drifting ore
#

What’s the “or”

#

Now crafting menu just won’t open @rancid panther

rancid panther
#

i just said or

drifting ore
#

Oh

#

Well the entire thing is fucked now

#

Idk what happned lmao

rancid panther
#

you put them back together yet?

#

if it worked like that before then just put it back like that until you understand how it works

drifting ore
#

Yup

#

I did I

#

It’s still fucked

rancid panther
#

send the file again

drifting ore
#

K

#

@rancid panther

shut oar
#

I think it's because the last couple recipes have lowercase keys instead of PascalCase

#

like it should be Result, rather than result

drifting ore
#

what

#

i have no ide what ur saying

shut oar
#
recipe assemble machete
{
sharpenedmacheteblade,machetehandle,keep Hammer,   
result:Machete,
sound:Hammering,
SkillRequired:maintenance=6,
Time:400.0,
Category:General,
}

recipe make Whetstone
{
Stone,Stone,keep Hammer,
result:Whetstone,
sound:Hammering,
SkillRequired:maintenance=2,
Time:400.0,
Category:General,
}

recipe make knife handle
{
Plank,keep Saw,
result:knifehandle,
sound:Sawing,
SkillRequired:maintenance=2,
Category:General,
}

recipe make machete handle
{
Plank,keep Saw,
result:machetehandle,
sound:Sawing,
SkillRequired:maintenance=4,
Category:General,
}

these ones are doing result instead of Result

#

same for sound too

#

and as far as i know its case sensitive

rancid panther
#

you suddenly started changing the case capitalization in everything

drifting ore
#

ITS FIXED

#

OMFG

#

THANKS YOU ALL ARE GODS IN MY EYES

#

OMFG

#

OMFG

rancid panther
#

that'll be $5

shut oar
#

it was the capitalization, yes?

drifting ore
#

That and I’m shit at this

rancid panther
#

are u editing these in windows notepad?

shut oar
#

we all start somewhere

rancid panther
#

you should get a proper code editing and reading application if ur gonna be doing this

drifting ore
#

Lmao

#

Probably yeah

#

Next is the ground models

rancid panther
#

also now that it works, i recommend putting them in separate .txt files now that you how it should look

#

it's better for organization to separate the items from the recipes

drifting ore
#

I’m def gonna do that, looking through all that shit was a nightmare

rancid panther
#

also, tabbing will help you look through your stuff

drifting ore
#

What’s tabbing

rancid panther
#

tabbing

drifting ore
#

Oh I see

#

OHHH I THOUGHT I NEEDED TO DO THAT AT FIRST

#

stressed me out fr

rancid panther
#

idk if notepad lets u do it, but you should be able to just press tab

#

in a code reader it does it automatically or you can press tab or even highlight and press tab

drifting ore
#

Any good code readers you reccomend?

rancid panther
#

i use visual studio code but others recommend notepad++

#

as long as u have something

shut oar
#

sublime text is a pretty alternative to notepad++

drifting ore
#

I’ve been using visual code editor

rancid panther
#

oh so it should be automatically doing that for you

drifting ore
#

I didn’t see it do anything

shut oar
#

theres a vscode extension that does highlighting and autocomplete for pz scripts you could download to make your life easier

shut oar
#

yeah, but from my experience its not perfect some of the options are missing

rancid panther
#

vscode already autocompletes stuff but the addon might help autocomplete stuff specifically in the zomboid format

drifting ore
#

Oh i see

#

Also

#

I want to 3d gorund models but I don’t know how

#

Where could I go to get help

rancid panther
drifting ore
#

Thx

young granite
#

how can i generate explosion or splash damage on successful zombie hit?

rancid panther
primal remnant
#

Will do, thanks much.,

open drum
#

guys, i have a question about ArrayList

#

let's say I want to find a match that matches the result of index 1 in

#

mylist = {key1:hello, key2:bye}

#

just like dictionary in python

#

can this be possible?

#

or do I have to make 2 separate lists?

merry saffron
open drum
#

i do know I can get index number by using For iterate

#
myArrayList = {"apple", "banana", "orange", "grape"}

function getIndex(myArrayList, item)
  for i, v in ipairs(myArrayList) do
    if v == "orange" then
      return i
    end
  end
end


#

this gives the index number which is an integer

#

but can it be used as something similar to dictionary in python?

#

what i want to do is:
have a "python dictionary like" {item: file directory address}
for loop that matches index "item"
return its file directory address

#

not sure if i made myself clear...

#

i guess i can make 2 separate arraylists and get index number from list 1, and call index from list 2 after..? which seem redundant

fading horizon
#

how can i quickly set the players stress level through the console?

open drum
#

i think there's a method for it

#

but stress might b bound with another trait as well

#

in admin panel

rancid panther
#

i have it

#

1 sec

open drum
#

can u edit the .. ah he has it

#

XD

rancid panther
#

they

#

print(getPlayer():getStats():getStress())

open drum
#

ah then i guess u can do

#

setStress()

rancid panther
#

yep

open drum
#

🙂

rancid panther
#

since ur using a vape mod i also assume you need getStressFromCigarettes

open drum
#

yea i think that's a good idea

fading horizon
#

🤔

#

person says theres a bug in my mod

#

i test it

#

can't reproduce

rancid panther
#

that happens when you make a mod that becomes p popular

#

what is the bug they say?

fading horizon
#

that vaping adds stress instead of relieving it

#

but

#

before vape
true = vape
after vape

rancid panther
#

they probably have smoker trait and expected it to remove cig stress

fading horizon
#

i need to look into this smoker trait

#

i legit don't even know how vanilla functions

#

i just made the vapes and cigs without looking int o it

#

wait

#

is smoker trait a mod?

rancid panther
#

no it is vanilla

#

negative trait

fading horizon
#

even with smoker it reduces stress

ancient grail
rancid panther
#

if you do

local playerStats= getPlayer():getStats()

stuff
playerstats.setStressFromCigarettes(playerstats.setStressFromCigarettes - .5)```
or something like this, it should decrease their stress from lack of smoking
ancient grail
#

I might be able to pin point why that happens

fading horizon
#

unless you want just a snippet

ancient grail
#

Im afk

#

Yes snippet pls

fading horizon
#

okay one sec ill type it up

rancid panther
#

the smoker trait probably also adds a "time since last smoked" thing or something

#

oh i was right

#

lua/server/recipecode.lua

#

from the looks of it, if you just use setStressFromCigarettes, it will handle the time since as well

ancient grail
#
----- OnEat_Cigarettes IS NOT RECIPE CODE.  IT IS CALLED BY IsoGameCharacter.Eat() -----
-- smoking cigarettes gives more bonus to a smoker
function OnEat_Cigarettes(food, character, percent)
    local script = food:getScriptItem()
    percent = percent * (food:getStressChange() * 100) / script:getStressChange()
    local bodyDamage = character:getBodyDamage()
    local stats = character:getStats()
    if character:HasTrait("Smoker") then
        bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() - 10 * percent);
        if bodyDamage:getUnhappynessLevel() < 0 then
            bodyDamage:setUnhappynessLevel(0);
        end
        stats:setStress(stats:getStress() - 10 * percent);
        if stats:getStress() < 0 then
            stats:setStress(0);
        end
        local reduceSFC = stats:getMaxStressFromCigarettes()
        stats:setStressFromCigarettes(stats:getStressFromCigarettes() - reduceSFC * percent);
        character:setTimeSinceLastSmoke(stats:getStressFromCigarettes() / stats:getMaxStressFromCigarettes());
    else
--        bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() + 5);
--        if bodyDamage:getUnhappynessLevel() > 100 then
--            bodyDamage:setUnhappynessLevel(100);
--        end
        bodyDamage:setFoodSicknessLevel(bodyDamage:getFoodSicknessLevel() + 14 * percent);
        if bodyDamage:getFoodSicknessLevel() > 100 then
            bodyDamage:setFoodSicknessLevel(100);
        end
    end
end
#
    {
        DisplayCategory = Junk,
        Count    =    20,
        HungerChange    =    0,
        Weight    =    0.005,
        RequireInHandOrInventory    =    Matches/Lighter,
        Type    =    Food,
        DisplayName    =    Cigarettes,
        StressChange    =    -5,
        Icon    =    IckySticks,
        CustomContextMenu = Smoke,
        CantBeFrozen = TRUE,
        OnEat = OnEat_Cigarettes,
        StaticModel = Cigarette,
        EatType = Cigarettes,
        WorldStaticModel = CigarettePack_Ground,
        CustomEatSound = ,
    }
fading horizon
#
item GnomeBarRB
    {
        DisplayCategory    =    Vape,
        Weight             =    0.05,
        CantBeConsolided   =    TRUE,
        UseWhileEquipped   =    FALSE,
        Type               =    Drainable,
        DisplayName        =    GnomeBar (Rainbow Blast),
        Icon               =    rainbowblast,
        StaticModel        =    GnomeBarRB,
        WorldStaticModel   =    GnomeBarRB_ground,
        ReplaceOnDeplete   =    GBEmpty,
        Tags               =    HasMetal,
        AttachmentType     =    Walkie,
    }```
#
function hitVape:perform()                              -- 
    local isNotBurned = true;
    local grabbedName = self.item:getDisplayName();
    if string.find(grabbedName, "Empty") then isNotBurned = false; end
    
    if (isNotBurned) then                               
-- !! If the vape is a normal vape with charge 

-- !! Add happiness bonus when hitting a vape
self.character:getBodyDamage():setUnhappynessLevel(self.character:getBodyDamage():getUnhappynessLevel() - 3); 
        
-- !! Add stress bonus when hitting a vape
self.character:getStats():setStress(self.character:getStats():getStress() - 0.05);                
                    
-- !! Make sure stress & unhappiness do not go below 0
if self.character:getBodyDamage():getUnhappynessLevel() < 0 then self.character:getBodyDamage():setUnhappynessLevel(0); end

if self.character:getStats():getStress() < 0 then self.character:getStats():setStress(0); end                         
#
-- !! if the vape is an empty burned vape
 elseif not isNotBurned then                                     
-- " *cough* *cough* "
self.character:Say(getText("UI_vape_cough0"));              
      
 -- !! Add unhappiness bonus when hitting an empty vape
self.character:getBodyDamage():setUnhappynessLevel(self.character:getBodyDamage():getUnhappynessLevel() + 5);   
     
-- !! Add stress bonus when hitting an empty vape
self.character:getStats():setStress(self.character:getStats():getStress() + 0.02);                                    

-- !! Make sure stress & unhappiness do not rise above 100%
if self.character:getBodyDamage():getUnhappynessLevel() > 100 then
   self.character:getBodyDamage():setUnhappynessLevel(100); 
end

if self.character:getStats():getStress() > 1 then 
  self.character:getStats():setStress(1); 
end```
#

item definition
performance for normal vape
performance for empty vape

rancid panther
#

maybe the person is smoking an empty vape and thinks the feature is a bug

ancient grail
#

When did you call the function

fading horizon
#

this is in the perform section of the timed action

rancid panther
#

i would just add the setStressFromCigarettes thing right below setStress

fading horizon
#

didn't know that was a thing you could set

#

i gotta go find that

ancient grail
#

Wait wait your item is triggering your onperform?

#

I think im about to learn something new

#

Here i thought i would be helping you

How the what the what

rancid panther
#

i think they just did a custom context option instead of a recipe onEat

fading horizon
#

yes

#

that's how

ancient grail
#

Ahhh ok so thats how

#

Makes sense now

#

Alot

fading horizon
#

i don't want to format t his because of the comments

#

so have a pic

ancient grail
#

Ok so the co text menu trigger the time action

fading horizon
#

this is how it works

#

hopefully legible on mobile

ancient grail
#

Then ok ok simple solution on the onperfomr trigger the cig function by copy pasting it turning it into local function
And replace or declare the
Food
Character
Percent
params

fading horizon
#

then ill try your method glytch3r

rancid panther
#

how can i set a sound emitter to be a tile relative to the player

open drum
#

i think Maemento mori

#

made it work last time

ancient grail
#

She wants to add the cig function

#

Vanilla

#
local function vapeNicotineEffect(character, percent)
    local configureME  = -5
    percent = percent * (configureME * 100) / configureME
    local bodyDamage = character:getBodyDamage()
    local stats = character:getStats()
    if character:HasTrait("Smoker") then
        bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() - 10 * percent);
        if bodyDamage:getUnhappynessLevel() < 0 then
            bodyDamage:setUnhappynessLevel(0);
        end
        stats:setStress(stats:getStress() - 10 * percent);
        if stats:getStress() < 0 then
            stats:setStress(0);
        end
        local reduceSFC = stats:getMaxStressFromCigarettes()
        stats:setStressFromCigarettes(stats:getStressFromCigarettes() - reduceSFC * percent);
        character:setTimeSinceLastSmoke(stats:getStressFromCigarettes() / stats:getMaxStressFromCigarettes());
--[[ else
        bodyDamage:setFoodSicknessLevel(bodyDamage:getFoodSicknessLevel() + 14 * percent);
        if bodyDamage:getFoodSicknessLevel() > 100 then
            bodyDamage:setFoodSicknessLevel(100);
        end --]]
    end
end


function hitVape:perform()     
    vapeNicotineEffect(self.character, -5)
--TODO add the rest of your code

end
#

or you can just remove the else

#

cuz vape isnt cig right

fading horizon
#

got distracted making another program lol

#

going to add that function now, ty glytch3r I really appreciate it!

ancient grail
fading horizon
#

the issue wasn't even on my end

#

the user removed the smoker trait mid game with debug menu and it messed with their settings somehow

#

lol

#

still adding this for smoker trait functionality tho

fading horizon
#

should I add the ability to gain the smoker trait?

#

from smoking a vape

#

like a 1/100 chance or something?

fading horizon
#

can you use translations in you script item definition files

#

like just the .txt files

#

like instead of
DisplayName = GnomeBar (Empty),
is there a way to do
DisplayName = IGUI_item_vapeEmpty

rancid panther
rancid panther
fading horizon
#

i literally found that as i got the ping

#

haha

#

thank you

rancid panther
#

lol

#

np

#

what format is your sound file saved as?

#

oh god im getting so caught up on the sound stuff

#

i cant figure any of it out

#

AYY

#

okay it is now a 3d sound

fading horizon
#

.ogg

#

has to be .ogg i think

#

sorry for late reply

#

zoned out

rancid panther
#

yea i got it

#

so the mods that have sound balancing issues must be using .wav

rancid panther
#

any idea how to change the volume of specific sounds in the game?

#

particularly fridge humming and other electronics

fading horizon
#

context:getOptionFromName("Favorite")

#

do y'all think this will work if the game is a different language

rancid panther
#

it is used in vanilla so it should work

#

name probs different from display name

neon bronze
#

Maybe try with getText()?

rancid panther
#

does anyone know where this file location actually is?

#

is it only server sided?

fading horizon
#

.

#

..\Steam\steamapps\common\ProjectZomboid\media\sound\banks\Desktop

#

try somewhere around here

#

someone mentioned it as a weird place that another sound ended up

#

i think i ended up getting the mod to work with the smoker trait finally

#

ended up making the whole script a lot better

#

how it be with coding

rancid panther
#

thanks

rancid panther
#

i might be able to use it to simulate a world power outage without changing elecshutmodifier

#

and if so, i'd also be able to do the same thing with my power on function

fading horizon
#

i did it! I totallyfixed the bug and made the mod function with the smoker trait

#

also while scrolling through my mods i noticed greenfire has addictions and withdrawals so i might provide functionality with that

rancid panther
#

one thing after another

open drum
#

guys

#

im having a problem

#

could someone help me with this?

#
function: create -- file: Wuro_client_UI.lua line # 100 | MOD: Wuro Core -[DEBUG]
function: OpenmagZ_OnCreate -- file: Wuro_client_UI.lua line # 158 | MOD: Wuro Core -[DEBUG]
Callframe at: PerformMakeItem
function: perform -- file: ISCraftAction.lua line # 58 | Vanilla
function: perform -- file: Skill Recovery Journal Write.lua line # 7 | MOD: Wuro Core -[DEBUG]

LOG  : General     , 1680526197922> 
LOG  : General     , 1680526326301> creating new sourcewindow: B:/SteamLibrary/steamapps/common/ProjectZomboid/media/lua/client/DebugUIs/ISFastTeleportMove.lua
LOG  : Lua         , 1680526327139> Loading: C:/Users/sungc/Zomboid/mods/Wuro Core [DEBUG]/media/lua/client/Wuro_client_UI.lua
LOG  : Lua         , 1680526327640> Loading: C:/Users/sungc/Zomboid/mods/Wuro Core [DEBUG]/media/lua/client/Wuro_client_UI.lua
LOG  : General     , 1680526330875> SexyZpage
LOG  : General     , 1680526330876> -------------------------------------------------------------
attempted index: javaObject of non-table: null

LOG  : General     , 1680526330876> -----------------------------------------
STACK TRACE
-----------------------------------------
function: addChild -- file: ISUIElement.lua line # 1081 | Vanilla
function: create -- file: Wuro_client_UI.lua line # 100 | MOD: Wuro Core -[DEBUG]
function: OpenmagZ_OnCreate -- file: Wuro_client_UI.lua line # 158 | MOD: Wuro Core -[DEBUG]
Callframe at: PerformMakeItem
function: perform -- file: ISCraftAction.lua line # 58 | Vanilla
function: perform -- file: Skill Recovery Journal Write.lua line # 7 | MOD: Wuro Core -[DEBUG]

ERROR: General     , 1680526330877> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: javaObject of non-table: null at KahluaThread.tableget line:1689.
#
function MyUI:create()
local btnWid = 175
    local btnHgt = FONT_HGT_SMALL + 2 * 4
    local padBottom = 10
    print(name)
    
    if name == SexyZpage then
        self.image = ISImage:new(self:getWidth()*0.001, self:getHeight()*0.001, 0, 0, getTexture("media/ui/mag/pic1.png"));

    end
    -- self.image.scaledWidth = self:getWidth()
    --self.image.scaledHeight = self:getHeight()
    self:addChild(self.image);
    


    self.cancel = ISButton:new(self:getWidth() - btnWid + 55 , self:getHeight() - padBottom - btnHgt, btnWid*0.5, btnHgt, "cancel", self, MyUI.onOptionMouseDown);
    self.cancel.internal = "cancel";
    self.cancel:initialise();
    self.cancel:instantiate();
    self.cancel.borderColor = self.buttonBorderColor;
    self:addChild(self.cancel);


end```
#

i think something is wrong after print(name)

#

can't figure out what it is..

rancid panther
#

try name == "SexyZpage"

#

@open drum

open drum
#

ah!

#

Eureka...

#

thanks..

#

that was very dumb of me

rancid panther
#

no prob

#

i do it all the time

open drum
#

new problem

#
function MyUI:create()
local btnWid = 175
    local btnHgt = FONT_HGT_SMALL + 2 * 4
    local padBottom = 10
    print(name)
    
    for i, v in pairs(list_tres) do
    
        if v == name then
        
        return i
                
        end
        print(i.."chking")
    end
    print(i)```
#

why can't i call return index value of "i" to print(i) ??

#

i checked with print that it went into for loop then successfully found v == name

neon bronze
#

i is only in the for loop

#

And return ends the whole function btw

open drum
#

oh i see

old crescent
#

does any one knows how to manual edit non pvp zone
like the file itself

drifting ore
#

Mod is almost done and ready for release

open drum
old crescent
#

when I set the non pvp zone ingmae . my game crashes

open drum
#

    {
        
         mag_page/mag_page2/mag_page3/mag_page4/mag_page5/mag_page6/mag_page7/mag_page8/mag_page9/mag_page10/mag_page11/mag_page12/mag_page13/mag_page14/
         mag_page15/mag_page16/mag_page17/mag_page18/mag_page19/mag_page20,
        
        Result: mag_page,
        RemoveResultItem: False,
        NeedToBeLearn:False,
        Sound:PutItemInBag,
        Time:3.0,
        OnCreate:OpenmagZ_OnCreate,
        Category:WURO_recipe, 
        
    }```
#

    local chk = result
    local name = chk:getName()
    print(chk)
    local myUI = MyUI:new()
    myUI:create();
    myUI:addToUIManager();

        

end```
#

guys i have a problem

#

when i do DO SMTH recipe perferm

#

it only produce result item mag_page

#

thus result is always mag_page

#

but i have a list

#
function MyUI:create()
local btnWid = 175
    local btnHgt = FONT_HGT_SMALL + 2 * 4
    local padBottom = 10
    print(name)
    
    for i, v in pairs(list_tres) do
    
        if v == tostring(name) then
        print(i)
        self.image = ISImage:new(self:getWidth()*0.001, self:getHeight()*0.001, 0, 0, getTexture(tostring(list_dos[i])));


        --self.image.scaledWidth = self:getWidth()
        --self.image.scaledHeight = self:getHeight()
        self:addChild(self.image);
        


        self.cancel = ISButton:new(self:getWidth() - btnWid + 55 , self:getHeight() - padBottom - btnHgt, btnWid*0.5, btnHgt, "cancel", self, MyUI.onOptionMouseDown);
        self.cancel.internal = "cancel";
        self.cancel:initialise();
        self.cancel:instantiate();
        self.cancel.borderColor = self.buttonBorderColor;
        self:addChild(self.cancel);
        
        else
            return
        end
        
    end```
#

that gets different texture depending on the diff. names of result item

#

is there any way to solve this problem?

red tiger
#

Good morning.

open drum
#

mornign jab

drifting ore
#

hi, is its possible to we make a mod that player can make an ice cube or ice cream from scratch? so basically i just thinking about lets say if "ice cream mixtures" freezing then replace it with ice cream. Thx

open drum
#
function MyUI:create()
local btnWid = 175
    local btnHgt = FONT_HGT_SMALL + 2 * 4
    local padBottom = 10
    print(name.."here")
    
    for i, v in pairs(list_tres) do
    
        if v == tostring(name) then
        print(i)
        self.image = ISImage:new(self:getWidth()*0.001, self:getHeight()*0.001, 0, 0, getTexture(tostring(list_dos[i])));


        --self.image.scaledWidth = self:getWidth()
        --self.image.scaledHeight = self:getHeight()
        self:addChild(self.image);
        


        self.cancel = ISButton:new(self:getWidth() - btnWid + 55 , self:getHeight() - padBottom - btnHgt, btnWid*0.5, btnHgt, "cancel", self, MyUI.onOptionMouseDown);
        self.cancel.internal = "cancel";
        self.cancel:initialise();
        self.cancel:instantiate();
        self.cancel.borderColor = self.buttonBorderColor;
        self:addChild(self.cancel);
        
        else
            return
        end
        
    end```
#

could someone help me where i did this wrong?

#

"SexyZpage",
"SexyZpage2",
"SexyZpage3",
"SexyZpage4",
"SexyZpage5",
"SexyZpage6",
"SexyZpage7",
"SexyZpage8",
"SexyZpage9",
"SexyZpage10",
"SexyZpage11",
"SexyZpage12",
"SexyZpage13",
"SexyZpage14",
"SexyZpage15",
"SexyZpage16",
"SexyZpage17",
"SexyZpage18",
"SexyZpage19",
"SexyZpage20",



}```
#

i have list here

#

and it only work with the 1st item

#

it's not working from 2nd value to 20th..

#

name = SexyZpage works well

#

but when name = SexyZpage2 or above, its not working..i can't figure out why

neon bronze
#

try doing ipairs insted of pairs maybe

#

and then put v inside

sour island
#

It's cause you're actively comparing v to the name

#

The name is the first one I assume

#

Also - why are you firing through the list anyway?

#

What is list_dos?

fast galleon
#

checking scopes could be a good idea too

sour island
#

Yeah, I'm on my phone so it's hard to tell what's going on

open drum
#

so i get the name of the item

#

and compare it from the list

#

then get its index number

#

and use that index number to call the directory address of the file

#

was local at first but now it's global

#
function OpenmagZ_OnCreate(items, result, player)
    print(result)
    chk = result
    name = chk:getName()
    print(name)
    
    myUI = MyUI:new()
    myUI:create();
    myUI:addToUIManager();

        

end```
open drum
#

so change to ipairs?

#

oki

#

with first item it shows index well which is 1

#

then when i do 2nd item

#

index is not passing

#

i didn't really understand fully what he meant 😦 sadly

open drum
old crescent
#

@sour island di you know the location of the custom non pvp files

fast galleon
#

maybe I'm wrong but why not use result:getType() and name the textures accordingly? This seems like a long topic and I haven't read everything. Also reading from mobile.

open drum
#

what does getType return?

#

seems like it will just do the same thing wouldn't it?

#

getType() is calling the item variable

#

getName() calls item display name

neon bronze
#

it returns the name of the item as its named in its .txt file

open drum
#

yea just checked

#
local list_tres = {

"SexyZpage",
"SexyZpage2",
"SexyZpage3",
"SexyZpage4",
"SexyZpage5",
"SexyZpage6",
"SexyZpage7",
"SexyZpage8",
"SexyZpage9",
"SexyZpage10",
"SexyZpage11",
"SexyZpage12",
"SexyZpage13",
"SexyZpage14",
"SexyZpage15",
"SexyZpage16",
"SexyZpage17",
"SexyZpage18",
"SexyZpage19",
"SexyZpage20",



}```
#

so ill change that to item name

#

thus, it would probably do the same i think

neon bronze
#

you could do key, value pairs, tedious but easy to call

open drum
fast galleon
#

Is it still there that you return if the name doesn't match?

open drum
#

yea, still 1st one on the list work

#

2nd index not returning

open drum
#

for i, v in pairs(list_tres) do

#

i thought i is the index or key

#

and v is value or item

neon bronze
#

No you made a table i mean a dictionary so you could just say list_tres[itemtype]

open drum
#

yea i wanted to do the dictionary

#

at first

#

but i asked here whether if it's same as python

#

and no one really gave me a clear answer Xd....

#

i guess it works in lua too

sour island
#

What is 'name' in the function?

#

I see a if v == name that could be an issue?

neon bronze
sour island
#

Nvm didn't see the replies

open drum
#

yea the name is result:getName()

open drum
#

i guess if or iteration doesn't work, ill have to do tons of if and elseif

sour island
#

You can iterate but it's not needed for this

open drum
#

ah?

sour island
#

You could just name the texture the same as what ever string you expect

open drum
#

hmm

#

so item1 = "media/ui/pic1.png"

#

something like that?

sour island
#

If pic1 is the name, yes

#

I also see list_tres, but not list_dos

#

Could you be referring to another list accidentally?

open drum
#
local list_uno = {

"WURO_items.mag_page",
"WURO_items.mag_page2",
"WURO_items.mag_page3",
"WURO_items.mag_page4",
"WURO_items.mag_page5",
"WURO_items.mag_page6",
"WURO_items.mag_page7",
"WURO_items.mag_page8",
"WURO_items.mag_page9",
"WURO_items.mag_page10",
"WURO_items.mag_page11",
"WURO_items.mag_page12",
"WURO_items.mag_page13",
"WURO_items.mag_page14",
"WURO_items.mag_page15",
"WURO_items.mag_page16",
"WURO_items.mag_page17",
"WURO_items.mag_page18",
"WURO_items.mag_page19",
"WURO_items.mag_page20",



}


local list_dos = {

"media/ui/mag/pic1.png",
"media/ui/mag/pic2.png",
"media/ui/mag/pic3.png",
"media/ui/mag/pic4.png",
"media/ui/mag/pic5.png",
"media/ui/mag/pic6.png",
"media/ui/mag/pic7.png",
"media/ui/mag/pic8.png",
"media/ui/mag/pic9.png",
"media/ui/mag/pic10.png",
"media/ui/mag/pic11.png",
"media/ui/mag/pic12.png",
"media/ui/mag/pic13.png",
"media/ui/mag/pic14.png",
"media/ui/mag/pic15.png",
"media/ui/mag/pic16.png",
"media/ui/mag/pic17.png",
"media/ui/mag/pic18.png",
"media/ui/mag/pic19.png",
"media/ui/mag/pic20.png",



}

local list_tres = {

"SexyZpage",
"SexyZpage2",
"SexyZpage3",
"SexyZpage4",
"SexyZpage5",
"SexyZpage6",
"SexyZpage7",
"SexyZpage8",
"SexyZpage9",
"SexyZpage10",
"SexyZpage11",
"SexyZpage12",
"SexyZpage13",
"SexyZpage14",
"SexyZpage15",
"SexyZpage16",
"SexyZpage17",
"SexyZpage18",
"SexyZpage19",
"SexyZpage20",



}
#

these are lists i made

sour island
#

Ah, I see you're relying on the keys to match

open drum
#

yea

#
    for i, v in pairs(list_tres) do
    
        if v == tostring(name) then
        print(i)
        self.image = ISImage:new(self:getWidth()*0.001, self:getHeight()*0.001, 0, 0, getTexture(tostring(list_dos[i])));```
#

so i compare name from list tres and get its index

#

then use that index to call string out from list_dos

#

and set that to texture

#

and when i tested it, 1st item which is "sexyZpage" works perfectly

#

but when sexyZpage2 shows up, its index isn't passing

#

so texture is getting nil

sour island
#

And the name gets printed?

open drum
#

yes

sour island
#

Does the I?

#

I'd try to print V before the compare to name

open drum
#
LOG  : General     , 1680541066542> mag_page
LOG  : General     , 1680541066542> mag_pagehere
LOG  : General     , 1680541066543> 1
LOG  : General     , 1680541069908> zombie.inventory.types.Literature@50c3f3b8
LOG  : General     , 1680541069908> mag_page2
LOG  : General     , 1680541069909> mag_page2here```
#

so here is the result of 2 items

#

if i create the first item

#

it gets its index "1"

#

when i do 2nd

#

name of item passes (here i used getType() temporarly)

#

but index isn't showing

sour island
#

Print V

#

To confirm

#

Ooh

#

I can't tell cause of the formatting

#

But if that else then return is inside the for loop

#

It's going to cancel the for loop the first failure it runs into

#

That should be why you're getting locked at 2

#

Also though -- this could be a lot cleaner if you use a key/value pair

#

Not defining the keys makes them 1,2,3,etc by default

open drum
#

ah fixed it

#

thank you all

#

for help

tardy wren
#

how do I overwrite a recipe again?

neon bronze
#

Override: true ?

sour island
#

Also I do recommend not for looping if possible

#

You can use Lua tables like an associative array

open drum
#

trying to find a better way to execute this other than using OnCreate

#

maybe i should look up custom context menu..

fading horizon
#

just updated gnomebars with two new flavors

#

works with vanilla smoker trait now too

fading horizon
#

you can look at my mod for an example

#

its an entirely custom tooltip

#

custom tooltip with a custom timed action

modern hamlet
#
local x,y = player:getX(), player:getY()

local closePlayers = {}
for playerIndex = 0, getNumActivePlayers() -1 do
  local p = getSpecificPlayer(playerIndex)
  local distance = IsoUtils.DistanceTo2D(x, y, p:getX(), p:getY())
        
  if distance < 20 then
    table.insert(closePlayers, playerIndex)
  end
end
print("CLOSE PLAYERS COUNT: "..#closePlayers)

Im trying to find the close players but it prints 1 all the time (it only finds me). What am I doing wrong?

neon bronze
#

Trying getting the players id and compare it to yours

#

You are in mp right?

modern hamlet
#

yes

neon bronze
#

Good, i know i would make the mistake of trying that in sp

reef karma
# fading horizon works with vanilla smoker trait now too

hey! I just read the patch notes. I would like to put my input here for the battery situation.
I guess the easiest way to put it, was the idea to make these reachable vapes or one time use?
They look like rechargeable to me so I would vote for the battery implementation.
But just adding the battery to the current durability seems like it would be annoying. I would make the overall durability proportional if you add the function to change the battery.. 3 times or whatever

#

does this make sense?

fading horizon
#

irl you can recharge them with a usb c charger forever

#

they just run out of juice so eventually its just burned cotton and no flavor

open drum
fading horizon
#

yw

#

it has custom backgrounds

#

colors

#

variable height

#

etc

#

should have most stuff you will need

#

and its well commented

open drum
#

nice nice

reef karma
#

from the ones I used to sell, one full pod lasted a lot longer than one full charge

#

i would treat the charges as the batteries and the full pod as the item durability

#

I am sorry if i am making it more complicated lol

fading horizon
#

hmm

#

no that makes sense

#

ill deal with that later

#

i'm making a new mod rn

#

i'm excited for it lol

reef karma
#

as expected, go get it lol.lmk if you more questions in dmg or here. i think it could work

modern hamlet
# modern hamlet ```lua local x,y = player:getX(), player:getY() local closePlayers = {} for pla...

I changed my code to this and its working now 🚀

local players = getOnlinePlayers()
  
local x,y = player:getX(), player:getY()
local closePlayers = {}
for playerIndex = 0, players:size() -1 do
  local p = players:get(playerIndex)
  local distance = IsoUtils.DistanceTo2D(x, y, p:getX(), p:getY())
        
  if distance < 20 then
    table.insert(closePlayers, playerIndex)
  end
end
print("CLOSE PLAYERS COUNT: "..#closePlayers)
spring wind
#

Is the decompiled java code in github somewhere?

neon bronze
#

i dont know but you can just decompile it online

bronze yoke
azure rivet
#

Hello, I am making a wallet, as a container the option to wear does not appear and I could not put it on, can help me?

spring wind
# bronze yoke i don't think that'd be legal 😅

It is, it's the exact same code as in the .class files in a slightly different representation. I was just hoping for something on github because I like their search tools but I can decompile locally

#

Something I'm not clear about is the demarcation between the java/lua code - it seems there's some blurry boundaries there.

bronze yoke
#

the game's class files are not public and making the game's source available is a breach of the tos

fading horizon
reef karma
bronze yoke
#

🥳

fading horizon
#

i can't seem to get recipe sounds to work

#

i have a .ogg file in media\sounds but it doesn't find it

#

i looked at vanilla and they are stored in sounds_player.txt on line

    {
        category = Player,
        clip
        {
            event = Character/Survival/Cooking/OpenCannedFood,
        }
    }```
#

i can't find Character/Survival/Cooking/OpenCannedFood anywhere

#

does anyone have any ideas

#
    {
        StuartLittle,
        keep [Recipe.GetItemTypes.SharpKnife]/[Recipe.GetItemTypes.Saw]/Axe/HandAxe/AxeStone/WoodAxe/MeatCleaver,

        Result:StuartLittleSliced=4,
        OnCreate:Recipe.OnCreate.SliceStuartLittle,
        Time:20,
        Category:Cooking,
        OnGiveXP:Recipe.OnGiveXP.Cooking3,
        AllowRottenItem:true,
        Sound:ratscream,
    }```
hollow shadow
tardy wren
# fading horizon

Idk about you but those sounds don't look like they're inside the folder?

fading horizon
#

they are

tardy wren
#

They aren't indented

fading horizon
#

vscode doesn't indent based on language mode

#

since .ogg has no language

#

it is not indented

tardy wren
#

Okay

fading horizon
tardy wren
#

Did you define the sound effect In code?

fading horizon
#

besides Sound:ratscream, in the recipe code no

tardy wren
#

Like that open canned food

#

As for why you can't find it yourself, it's likely packed in the resource files

#

You need to define a sound pointing at your audio clip and use that in any action

#

At least I think so... Never.made a sound. I only fix vanilla bugs

bronze yoke
#

usually it creates it for you if it isn't already created

#

but looking at how that works might be helpful

fading horizon
#

yeah like my vape mod just makes it for me

#

ecig.ogg in media\sounds and it just works

#

oh

#

its just sound

#

not sounds

#

the folder

#

lol

hard hollow
#

Anyone able to give me a basic run down on how to add cars?

#

If there is a tutorial online you can point me that way too. I have blender and all that

warm vessel
#

Hey y'all, is there a way to give an item like a "description"?

#

Also, anybody know how to add in medical items? As the attributes in Items.txt doesn't specify any medicinal effects, I assume it's in some LUA file, but can't find it

bronze yoke
#

anything that's not in the item scripts is probably hardcoded java stuff

#

the medical system is very basic and not really designed to be moddable

warm vessel
#

fuck

wintry badger
#

Repost in the right channel >.>
Changing the color of blood?
So I have been trying to figure out just how the game controls blood color, I tried changing the blood texture and overlay, but no matter what I change it to, its always got a tint of red to it, and oddly if I try to turn the blood white it turns teal in game on the character model and weapon but it turns pink on the ground ?
if I turn it black it turns black.

Is the color of blood hardcoded in the .class files? or am I missing something.

humble oriole
#

When I craft a food item that has x days fresh and x days to rot it's creating the item with nan on Age(days) is that normal?

#
    {
        DisplayName = Unfermented Corn Slurry,
        DisplayCategory = Food,
        Type = Food,
        Weight = 0.2,
        Icon = Pot_Water,
        DaysFresh = 1,
        DaysTotallyRotten = 1,
        CantBeFrozen = TRUE,
        ReplaceOnUse = Pot,
        ReplaceOnDeplete = Pot,
        ReplaceOnRotten = MoonshineMash,
        HungerChange = -5,
        ThirstChange = +5,
        Unhappiness = +50
        Calories = 33,
        Carbohydrates = 10.74,
        Lipids = 1.53,
        Proteins = 3.68,
        StaticModel = CookingPot,
        WorldStaticModel = CookingPotPasta_Ground,
        Tooltip = Tooltip_item_FermentTime,
        Tags = HasMetal,
    }```
#

do I have a conflicting field?

bronze yoke
#

does this happen when you spawn the item in?

humble oriole
#

no

#

Spawned in ^

#

When it's crafted it doesn't have the (Fresh) designation either

#

likely related to nan, but yea

bronze yoke
#

i remember seeing that some vanilla recipes set the age in their oncreate, so maybe that is normal

humble oriole
#
    result:setAge(items:get(0):getAge());
end```
#

albion do you know if ReplaceonRotten is working?

bronze yoke
#

i've never used it

red tiger
#

Be wary of deprecated properties that are throughout the script files in PZ.

#

I don't know if that one is or not.

#

I'm marking the ones I spot as deprecated in my extension..

humble oriole
#

ReplaceonRotten is still being used in vanilla so I assumed it was working

#
    {
        DisplayName = Ice Cream,
...
        Packaged = TRUE,
        ReplaceOnRotten = IcecreamMelted,
        DaysFresh = 1,
        DaysTotallyRotten = 1,
...
        WorldStaticModel = IceCream,
        Tags = GoodFrozen,
    }```
pale current
#

has anyone ever thought about how pz would be the perfect medium to remaster fallout 1/2?

rancid panther
#

is there a command i can do to change the volume of an individual sound in the game?

tacit plover
#

so it'll be like ReplaceOnRotten = ID.Item,

fast galleon
#

sometimes nan prints when the number is really small, it'd be weird if it actually was nill

#

id = emitter:playSound(...)
emitter:setVoulume(id,num)

rancid panther
#

im looking for a way that i can use to change the volume of certain ambient noises

red tiger
#

Hello.

#

Am torn between working on several projects and now even playing the game again.

rancid panther
#

the advanced volume enabler mod lets me change the volume of individual sounds but i dont see where the actual sounds are handled in vanilla

#

it's interesting cuz my added sound is also in it

fast galleon
#

most options go to the core

red tiger
#

I wish I had complete and total control of PZ's sound engine without modding the core.

#

I did some insane shit when I did mod the core though.

#

(I hooked up the audio engine with a modified shader library that allowed me to modify the screen in realtime using PCM data)

#

(I wrote the shader library and part of this audio mod)

#

=)

tacit plover
#

maybe that'll work

red tiger
#

Wait what? Haven't seen that before.

rancid panther
humble oriole
rancid panther
#

i see DoParam can be used to edit scripts

#

how can i use it for a sound script

fast galleon
#

That's for Item scripts

red tiger
#

I want a mod to exist where it requires a maturity warning for being absolutely batshit insane with psychological stuff.

#

=(

bronze yoke
#

most script types use Load instead

#

with slightly different syntax

rancid panther
#

so if i reuploaded the scripts in my own mod it will use those instead of the vanilla ones?

#

i wanna make p much all electronic ambiance louder with more range

rancid panther
#

awesome it worked

#

how do i find the nearest indoor square?

red tiger
#

Going to document food properties tonight..

rancid panther
#

okay i know how to check if a square is outdoors or indoors now

#

now i need to find out how to check for the nearest indoor square

red tiger
#

Ehh nvm.

#

No progress today. =(

still spindle
#

wait I thinkk I'm at the wrong channel

old crescent
#

when you start a dedicated server where does the server saves

rancid panther
#

how do i create a for loop for getSquare around the player?

rancid panther
#
function ISExtinguishCursor:getClosestSquare(squares)
    local closest = nil
    local closestDist = 1000000
    for _,square2 in ipairs(squares) do
        local dist = IsoUtils.DistanceTo(self.character:getX(), self.character:getY(), square2:getX() + 0.5, square2:getY() + 0.5)
        if dist < closestDist then
            closest = square2
            closestDist = dist
        end
    end
    return closest
end

is this close to what i need to do to get the nearest indoor square?

#

sun sensitive zombies also has something for getting nearest building that is very similar to this, i just dont know how to apply it to the sound manager to play my sound from the square

old crescent
#

understand the basic of looping

#

for "for loop" the parameter are initialization, condition,incrementation

fading horizon
#

is there like a wait() function

#

or something to just eat up time

#

during my timed action i want there to be a chance where you "lose" the item for a few seconds and you're supposed to be looking for it, then the timed action starts

#

i imagine i can do this somehow in waitToStart() i'm just not sure how

rancid panther
#
if ZombRand(1,5) <= 1 then
  add animation
#

IT WORKS

#

now when the player is outside, the power starting up sound effect will only play from an indoor square if they are close enough to one

#

and if they arent near any buildings, they wont hear anything

rancid panther
lofty monolith
#

would it be possible to have wall clocks act as a watch for players in the same room as said wall clock

#

ie. display time if the player doesnt already have a watch

drifting ore
#

Would this work in MP so others can hear the sound too : player:getEmitter():playSound("RandomSoundName");
It plays properly in my SP test.

neon bronze
neon bronze
#

The sound will come off the player though even if he moves

drifting ore
rancid panther
#

still, i need to make a sound you can hear when not around any buildings but still on the power grid

neon bronze
#

Nono i meant the syntax as in „if not square:isOutside() then“

rancid panther
#

idk

#

i guess i could do that too

#

is that the better way to do it?

lyric turtle
#

Can someone check vanilla code for me?

#

Do cars have a function to drop items out of their trunk when low durability AT ALL?

#

So far in my testing that simply DOES NOT happen

rancid panther
#

no

lyric turtle
#

Where did that myth came from then?

#

The game itself, its a tooltip

#

Its an unimplemented feature?

rancid panther
#

IM AN IDIOT 💀

took a screenshot with the lights off so it barely made a difference from the blackout

#

oh well

nimble spoke
lyric turtle
tardy wren
#
-- having a damaged trunk or no trunk at all will make item go on floor
function Vehicles.Update.TrunkDoor(vehicle, part, elapsedMinutes)
    local speedNeeded = 20;
    local steeringModifier = 5;
    -- opened trunk like pickup require more speed/steering
--    if not part:getItemType() then
--        speedNeeded = 60;
--        steeringModifier = 2.5;
--    end
    
    if vehicle:isEngineRunning() and part:getItemContainer() and vehicle:getCurrentSpeedKmHour() > speedNeeded and not part:getItemContainer():getItems():isEmpty() then
        -- if u don't have a trunk door or is in poor condition
        if not part:getInventoryItem() or part:getInventoryItem():getCondition() < 60 then
            -- the more you turn hard, the more chance you'll have to drop item
            local chanceToDropItem = math.abs(vehicle:getCurrentSteering()) * steeringModifier;
            -- the more damaged your trunk is, the more chance you'll have to drop item
            if part:getInventoryItem() then
                chanceToDropItem = chanceToDropItem + ((100 - part:getInventoryItem():getCondition()) / 100)
            else -- no trunk
                chanceToDropItem = chanceToDropItem + 1;
            end
            -- drop item!
            if ZombRandFloat(0, 100) < chanceToDropItem then
                local item = part:getItemContainer():getItems():get(ZombRand(0, part:getItemContainer():getItems():size()-1));
                vehicle:getSquare():AddWorldInventoryItem(item, 0,0,0);
                part:getItemContainer():Remove(item);
            end
        end
    end
end
#

chances are pretty low. not sure how often the update function is called

lyric turtle
#

Ah, I see the problem

tardy wren
#

Are you telling me you read this over and founda bug?

lyric turtle
#

No, no; I see the problem with my testing

tardy wren
#

ah

#

Were you too slow

lyric turtle
#

No, I wasn't driving "recklessly"

#

Items need the vehicle to match at least two conditions

#

Speed above 60mph

#

Turning

tardy wren
#

it's speed above 20

lyric turtle
#

I wasn't turning (although I did a couple times at the ends of the highway, to turn around) for the chances to happen

tardy wren
#

I can't say I've ever had it happen to me

lyric turtle
#

I can already see stuff happening once

#

vehicle:getCurrentSpeedKmHour() > speedNeeded but speed is mph?

tardy wren
#

frankly dunno what unit they use

#

I think yes

lyric turtle
#

Say it still works so the check passes, the part of the function elapsedMinutes happens locally since the vehicle is started or the player gets inside the vehicle, but it never accounts for it?

#

It doesn't matter, for all it cares is speed and steering input

#

Supposedly the state% the lid is, the chances for it to not happen (which makes sense), if no lid then its chance+1, which would return 2?

#

What I'm getting is, either the check doesn't ever happen, or it only happens once and fails to go through

nimble spoke
#

It should not get there, because trunks always have their item installed, and if they didn't you wouldn't be able to have items inside them anyway

#

The very first if checks if it is a container, but as far as I know it only really counts as a container if the item is installed anyway

tardy wren
#

I think I remember that trunks used to be removeable

#

Also this is for the trunk door

#

But analyzing it, yes. For no trunk door, you have 2% per update...

#

More when steering

#

Speaking of advertising... Is there a channel one can post links to their mods?

old crescent
#

any idea about xgamingserver ?

frank elbow
frank elbow
worldly olive
tardy wren
#

does not seem like it

#

though if sleep is a timed action, you may be able to hook into it anyway

#

oh hey

#

ISSleepDialog

worldly olive
#

Oh. Nice one, didn't think on it

#

Will take a look

dense mauve
#

Hello how can i make books faster not instant but like a minute

reef karma
#

sandbox option

#

or server.lua settings (or whatever it is called)

frosty estuary
#

Hi, I need to increase a particular zombie health only when it is created/spawn. Is there a event that i can call to do that? OnZombieUpdate maybe? When this events is called?

bronze yoke
#

every frame for every loaded zombie

frosty estuary
sour island
#

You can use that one

#

You can create a boolean in their modData to prevent repeated calls

#

But the modData doesn't save -- so there's that

#

Not sure if there's a hard cap to zombie hp but I have made a zombie have more hp

frosty estuary
sour island
#

For zombies, yes

frosty estuary
#

Ok thanks... i think I can work with that

fast galleon
#

are you sure it's reset when zombie is moved?

sour island
#

I'm not sure what happens if the zombie is unloaded within the games session -- it may be buffered

#

But it is not persistent in loading from saves

#

This is only true for zombies btw

#

And only if the zombie is not flagged as a former player

frosty estuary
#

Create the moddata if it doesn't exist. Set health while true, make it false after. If it disappear and found it later it will be full health again

sour island
#

That is one issue yea

#

Unless that's fine for you 😅

frosty estuary
#

It will be fine... trying to create some unique zombies for server event.

#

It will not dissappear until its dead

#

Gonna try this way... thanks

sour island
#

You'll need a way to determine which zombie it applies to -- I use a specific outfit for my AI