#mod_development

1 messages ยท Page 139 of 1

sour island
#

getPlayer() should be just player, as the command has it

open drum
#

so ill just use player instead

sour island
#

๐Ÿ‘

open drum
#

wow, thanks chuck

#

that was a huge help

#

learnt new things today

#

better me today than yesterday xD

stable ether
#

I am having some trouble here. I want replace a vanilla tile texture, everything is made. I just cant for the life of me figure out how i need to pack it for it to work. Any help is appreciated โค๏ธ

wise lion
#

is anyone able to let me know why this isnt working? Im trying to make a mod which removes sunday driver after a certain amount of time but it isnt removing the trait

`local ttr = 90

function CheckVehicle(player, vehicle, args)
local player = getSpecificPlayer(0)
if player:isDriving() and player:HasTrait("SundayDriver") then
ttr = ttr - 1
if ttr <= 0 then
player:RemoveTrait("SundayDriver")
end
end
end

Events.EveryOneMinute.Add(CheckVehicle)`

bronze yoke
#

removetrait doesn't exist

#

try player:getTraits():remove("SundayDriver")

glass basalt
#

I'm having a very weird problem. I am modifying a recipe like so:

if modList:contains("86oshkoshP19A") then
    script:getRecipe("Make Side Spare Tire Mount"):setCategory("KI5")
...

which is loaded like so:

recipe Make Side Spare Tire Mount
{
BlowTorch=5,
keep WeldingMask,
SmallSheetMetal=4,
SheetMetal=4,
Screws=1,

Result:P19ASpareMount1_Item,
Time:750.0,
Category:P19A,
SkillRequired:MetalWelding=6,
OnGiveXP:Recipe.OnGiveXP.MetalWelding25,
}

But the game immediately gives me a null error. I'll pull it up in a bit

#

the previous lines work just fine, up until my lua script performs this line

#

it is IN the game, why is this happening

#
-----------------------------------------
STACK TRACE
-----------------------------------------
function: KI5CraftingUnifiedRecipePatcher.lua -- file: KI5CraftingUnifiedRecipePatcher.lua line # 22 | MOD: Unified KI5 Crafting Category.
[24-03-23 22:32:34.744] ERROR: General     , 1679722354744> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: setCategory of non-table: null at KahluaThread.tableget line:1689..
#

it's not null... ๐Ÿคฆโ€โ™‚๏ธ

bronze yoke
#

you might need to include the module

glass basalt
#

module is Base tho

bronze yoke
#

probably not then

glass basalt
#

or apparently not, it is RunFlat
tf? thanks KI5

#

thank you for rubberducking me lol

bronze yoke
glass basalt
#

script:getRecipe("RunFlat.Make Side Spare Tire Mount"):setCategory("KI5")
how do I include the module exactly

bronze yoke
#

i think that's good

glass basalt
#

we'll see !

bronze yoke
#

i'll get the source up just in case

glass basalt
#

sweet, it works

bronze yoke
#

nice!

glass basalt
#

feels very weird with the spaces in there, alongside the module dot

wise lion
glass basalt
#

hmmm, new problem: how do I get the first index of a Java Array? Will [0] work in this case?

    dupeList = script:getAllRecipesFor("Make M747 4 Tire Axle 1") -- should return 2 recipe objects
    dupeList[1]:setCategory("KI5")
    dupeList[2]:setCategory("KI5")
bronze yoke
#

you want to use :get(), not [] and yeah, count from zero

glass basalt
#

gotcha, thank you

bronze yoke
#

a useful snippet for that kind of thing is

for i = 0, array:size()-1 do
    local item = array:get(i)

end
glass basalt
#

I'll have to use a for loop later for some shared recipes, so I'll use that

#

darn, the loop isn't working with recipes

indigo hemlock
#

what kind of syntax highlighting suits the most in VSC for .txt files with items definitions?

glass basalt
#

look up "ZedScript" in the VSCode extensions

#

if that is what you are using

#

custom made for PZ's texts, because they are unique syntax

indigo hemlock
red tiger
#

It's a work in progress

indigo hemlock
red tiger
#

Building in the docs and auto fill ATM.

glass basalt
bronze yoke
glass basalt
#

why shouldn't getting each Recipe object by its index in the ArrayList not properly update then?

bronze yoke
#

it seems like you're putting in the name of a recipe, not the name of the result item

glass basalt
#

ohhhhhhh shoot

bronze yoke
#

if you want to get all recipes by a certain name, i think all you can do is loop through the entire recipe list (if it fits your case, please just for that module), and check the name in the loop

obsidian pasture
#

Sorry for question but how can i add an item inside a container (backpack) in lua.

glass basalt
#

my problem: some recipes are in Base

#

i think I will instead look for the result item, since most of these duplicate recipes are for one item but use different resources to craft

bronze yoke
#

you're trying to move all the recipes you're changing into the same category right? something like this might make things easier

local wantedRecipes = {
    ["Make M747 4 Tire Axle 1"] = true,
    ["Another Recipe Name"] = true,
}

local recipes = ScriptManager.instance:getAllRecipes()
for i = 0, recipes:size()-1 do
    local recipe = recipes:get(i)
    if wantedRecipes[recipe:getOriginalName()] then
        recipe:setCategory("KI5")
    end
end
glass basalt
#

hmmmm pretty elaborate
I'll use this then, thank you again

#

i think instead of making the whole recipe list, ill append the recipes I want to that list so that the for loop runs faster

#

how is this?

local recipesToModify = {}

if modList:contains("67commando") then
    recipesToModify["Make Commando Viewport"] = true
...
bronze yoke
#

i actually have no idea if it's faster to check mod ids or not, so whichever works

glass basalt
#

no, checking the mod ids will definitely slow it down, but in the case of a person only using one mod, their game won't have to consistently check for recipes that don't exist

#

clean code execution rather than speed ig

#

because the entire code operation is bloat
curse that KI5

bronze yoke
#

my guess is that not checking them and just having the entire table populated regardless would actually be faster

#

since :contains() is a java method, i would guess that any performance lost from having a bigger table to look the name up in would be made up for by how slow lua-java communication is - but it's pedantry, and it's not during gameplay so who cares

glass basalt
#

hmm that's true

#

i also realized that some mods have the same recipes and making exclusions to check for multiple mods if they are enabled for one specific recipe is stupid

#

big fat masterlist it is

glass basalt
bronze yoke
#

ah, that's right

#

well, running that code on vanilla recipes only took my computer 1 millisecond (and it's only counting in milliseconds), so performance probably isn't a massive concern either way

glass basalt
#

awesome, thanks for checking

#

i finished adding all the recipe names I have so far into the list. time to test it ๐Ÿ˜Ž

#

amazing, took no time at all and everything I intended

bronze yoke
#

nice!

glass basalt
#

even code-monkeying the recipe list is easy. duplicate template, insert recipe name, continue

glass basalt
#

Need some insight: I have a lot of mods and I don't like it tbh. Some are very specific that are basically tailored for myself, only public for others that might care. I would like to consolidate those specific mods into one "Miscellaneous Tweaks" mod that just includes everything. I would then document every change I have made in it, and give others permission to upload their own separate versions if they wish to do so.
Are there any flaws to this?

odd fjord
#

Hi! Need some help. I made this item,
item MightyHammer{ DisplayName = Mighty Hammer, Icon = MightyHammer, WorldStaticModel = MightyHammer, Weight = 0.5, }

and this function.
function OnObjectPickedUp(tileObject, player) if tileObject:getItem():getType() == "MightyHammer" and not player:hasPerk("Carpentry") then player:getXp():AddXP(Perks.Carpentry, 75) end end

how do I attach this function to the item?

glass basalt
odd fjord
#

I have a kinda similar thing to that

#

function OnLoad() Events.OnObjectPickedUp.Add(OnObjectPickedUp) end

#

i used this but it doesnt work

glass basalt
#

you do not need that in a function

#

because then you are calling a function to call a function

#

just put the event function append at the bottom of your lua script

#

it'll auto load on start

odd fjord
#

last question, is there an event for when an item is picked up by the player? like, if it's grabbed and goes into the inventory

#

i am looking at the wiki and i dont see something like that

glass basalt
#

You likely need to find what gives the ability to execute lua code when a specific item is picked up, using the item scripts

#

similar to Food type items using the OnEat field

open drum
#

what will be the best way to play a sound for everyone in a region

#

in a MP

#
getSoundManager():PlayWorldSound('pumpaction', getPlayer():getSquare(), 0, 500, 50, false); ```
#

this doesn't seem to work in MP

glass basalt
#

you need a specific player, to play that sound on the server

open drum
#

oh yea

#

i changed it to player

#

im sorry

glass basalt
#

is the code client-side or server-side?

open drum
#

it was player:getSquare()

glass basalt
#

i think it needs to be server-side

open drum
#

i sent it through sendclientcommand

glass basalt
#

gotcha

open drum
#

and put the code inside the server side

glass basalt
#

test it ๐Ÿ˜Ž

open drum
#

local perform = function (module, command, player, args)
print(command)
--local command = {};

    
    if module == "Quest" and command == "generatormission" then 
        getSoundManager():PlayWorldSound('pumpaction', player():getSquare(), 0, 500, 50, false); 
        getSoundManager():PlayWorldSound('bigExplosion', player():getSquare(), 0, 500, 50, false); 
        print("recieved code from client with "..command)    
        local X = player:getX();
        local Y = player:getY();
        local Z = player:getZ();
        
        chunk1 = player:getChunk();
    
    
        VirtualZombieManager.instance:AddBloodToMap(44, chunk1)
        
        VirtualZombieManager.instance:createHordeFromTo(X+50, Y, X, Y, 80)
        VirtualZombieManager.instance:createHordeFromTo(X+50, Y+5, X, Y, 80)
        VirtualZombieManager.instance:createHordeFromTo(X, Y-80, X, Y, 150)
        VirtualZombieManager.instance:createHordeFromTo(X-50, Y, X, Y, 80)
        VirtualZombieManager.instance:createHordeFromTo(X-50, Y+5, X, Y, 80)
        VirtualZombieManager.instance:createHordeFromTo(X, Y+50, X, Y, 80)
        
    


    
    end

end


Events.OnClientCommand.Add(perform)```
#

so this is the whole thing

#

and i tested it on dedicated server

#

zombies spawn fine

#

just the sound doesn't play

glass basalt
open drum
#

ah yea,

#

nope.. still not playing

glass basalt
#

you need to reload lua

open drum
#
local perform = function (module, command, player, args)
print(command)
--local command = {};

    
    if module == "Quest" and command == "generatormission" then 
        getSoundManager():PlayWorldSound('pumpaction', player:getSquare(), 0, 500, 50, false); 
        getSoundManager():PlayWorldSound('bigExplosion', player:getSquare(), 0, 500, 50, false); 
        print("recieved code from client with "..command)    
        local X = player:getX();
        local Y = player:getY();
        local Z = player:getZ();
        
        chunk1 = player:getChunk();
    
    
        VirtualZombieManager.instance:AddBloodToMap(44, chunk1)
        
        VirtualZombieManager.instance:createHordeFromTo(X+50, Y, X, Y, 80)
        VirtualZombieManager.instance:createHordeFromTo(X+50, Y+5, X, Y, 80)
        VirtualZombieManager.instance:createHordeFromTo(X, Y-80, X, Y, 150)
        VirtualZombieManager.instance:createHordeFromTo(X-50, Y, X, Y, 80)
        VirtualZombieManager.instance:createHordeFromTo(X-50, Y+5, X, Y, 80)
        VirtualZombieManager.instance:createHordeFromTo(X, Y+50, X, Y, 80)
        
    


    
    end

end


Events.OnClientCommand.Add(perform)```
#

server restarted

glass basalt
open drum
#

yea true, u r right

glass basalt
#

try also :setVolume(2.0) after the playworldsound

#

in case it is a volume issue

open drum
#

interesting

#

i had this played in SP and it was playing the sound fine, but in MP it didn't

#

can getsoundmanager b only working on client side?

glass basalt
#

okay, try moving the soundmanager to client-side

#

maybe

open drum
#

good suggesting

glass basalt
#

to time it right, you can try sending a client command back to the player

open drum
#

so... sendservercommand?

#

but woulnd't that only be recieved to the 1 player who is performing the action?

glass basalt
#

but not everyone will be able to hear the sound unless you send commands to everyone

open drum
#

i wanted to b played in everyone on the region

glass basalt
open drum
#

yea eactly my though

glass basalt
#

make a for loop that gets new players by their index and send the command

#

to them

open drum
#

then what would b the best way to play it for all online player in the region?

#

hmm...

#

a loop

glass basalt
#

if it is by region, then it should be silent for those not close

#

because world sound

open drum
#

i hoped there to b a simpler function that would do the magic

glass basalt
#

๐Ÿคทโ€โ™‚๏ธ

open drum
#

hmm since u know

#

in MP

#

there's girl and guy screaming sounds (ambient sound)

glass basalt
open drum
#

that is heard by everyone in the region

glass basalt
#

those sounds are the meta events that draw zombies closer to players

#

I think they are handled very differently

open drum
#

i see

glass basalt
#

i will also write the for loop for that array, since I learned how to use them today

open drum
#

haha i really suck at them

#

like, i still can't figure out how to loop through items in the world

glass basalt
#
local playerList = getConnectedPlayers()
for i = 0, playerList:size() - 1 do
  sendServerCommand(playerList:get(i), "modName", "newSoundCommand", { playerSoundOrigin = player, })
end
open drum
#

is getconnectedplayers() under globalobject class?

glass basalt
#

there, you need one argument

#

yes

#

should be server-side

open drum
#

i just saw void addSound(IsoObject source, int x, int y, int z, int radius, int volume)

#

in that glass

#

class**

glass basalt
#

hmmmmmmmm

open drum
#

do you think that would also work?

#

xD

glass basalt
#

maybe

#

try it, it wouldn't hurt

open drum
#

maybe i can try playing it on console

viral notch
#

is there mod for more safe hauses?

glass basalt
open drum
viral notch
#

like i have one but my friend wants to invite me to his one but rn can't due limit of one safe hause per player...

glass basalt
#

search for it in the steam workshop

open drum
#

bikinitools has one too

#

addSound('pumpaction',5938, 5354, 0, 50, 50)

#

that produced error when executed on console...

#

does this mean that the game can't find the method?

glass basalt
#

one of the parameters was invalid

#

try running it through a file to be sure

#

lua console is kinda wonky

#

and doesn't know everything about what files are loaded

open drum
#

i see

#

hmm i guess editing and reloading lua from debug won't help for dedicated server right? since it's in server folder?

#

ugh.. too much to restart the server..

#

and update the workshop..

#

u know what's funny?

#

getSoundManager():PlayWorldSound('pumpaction', player:getSquare(), 0, 500, 50, false);

#

this works well on console

#

so i suppose it's client sided function and can't b executed on server folder

glass basalt
#

yeah... try doing the multi-send server command

open drum
#

yea, then i guess ill have to do what you suggested, iterate through players

#

and execute it to all

glass basalt
open drum
#

i am using it on my server

#

and i was sooooo greatful

#

made my crafting page lot cleaner XD

#

thank you for your effort

glass basalt
#

it seems every day more and more people realize that I made plenty of useful mods lol

open drum
#

hahaha

#

savior~

glass basalt
#

next QoL mod is removing the stupid recipes that Tsar's Common Library adds, because I don't use muscle cars from the 2010s !

open drum
#

hahah i support that !

glass basalt
#

today I finish like 7 things out of the 50 i need to do stressed

open drum
#

gee...

#

and here i am...

#

struggling to do one thing

#

XD

glass basalt
#

i struggled to add 2 timed actions for 3 days, it's nothing new lol

chrome egret
#

Good morning all!

open drum
#

good morning

open drum
#

timed action seemed confusing

#

i still don't get when to use

#

intance, new(), and nothing at all

glass basalt
glass basalt
open drum
#

like some needs new() some just .intance and some just directly methods so confusing...

glass basalt
#

I used a template somewhere, one sec

chrome egret
open drum
#

this will help me greatly

old crescent
#

need help

#

im creating a respawn time of a player when they die .. where can I find the on respawn event

chrome egret
#

There is no respawn event as far as I'm aware.

open drum
torn igloo
#

is there like a drag and drop for UI ๐Ÿฅน

open drum
#

then you will have to disable player's death UI

#

after using

#

Event.OnDeath

#

i think that's what's called

#

or onplayerdeath

chrome egret
#

Events.OnPlayerDeath

open drum
#

yea that

#

XD

#

thanks

chrome egret
#

You can find how it's currently set up in ISPostDeathUI:

old crescent
#

then I'll add a timer for it to run again

glass basalt
open drum
#

yea

old crescent
#

got it

#

ineed help again.. is it possible to count the nunber of death

frank elbow
old crescent
#

per player

frank elbow
#

Perhaps someone else has a better suggestion, but I think you'd need to store that information server-side. If OnPlayerDeath fires on the server you could use that to increment the appropriate counter and associate with the player (by username, presumably)

#

For SP it'd be more straightforward

old crescent
#

where does the clients datas stores.. ??

ancient grail
#

On the client machine

old crescent
#

ok

frank elbow
#

I guess it's worth asking what the use case is first, actually

#

If it's only to display a total death count to the player you may design it differently

#

I'd personally still probably store it on the server

old crescent
#

or Ill put it on admin panel .. and add number of death in the database

ancient grail
#

Maybe global moddata

old crescent
#

My Idea is .. when a player dies, Ill disable the function of the respawn button(NEW CHARACTER) and modify its Text to "Respawn in mm:ss".

chrome egret
#

Minus any server-side syncing you might want to do, you could simply override ISPostDeathUI to have the button disabled by default and enabled when the timer is finished.

neon bronze
#

i would not advise overriding vanilla files since most mods utilize them as a backbone rather you could call a new Instance of PostDeathUI and call createChildren, there it makes the respawn button. Then you just grab the button and override its onClick function with yours

#

Or you overwrite the create children functiontbh

frank elbow
#

Yeah, seems like an override would be appropriate. Could just grab a reference to the respawn button & change its text and disable it (after calling the original createChildren)

neon bronze
#

and obviously renable it later when its needs to

#

you could do that with some events tbh although Ive no idea how much time they take

thick scarab
#

Hey people, is this the right place to ask for mod development support? I am extremely new to modding, and I am currently looking to create a mod of my own. It is a tremendously bigger undertaking than I initially expected, but I am trying to push through

thick scarab
#

I probably have stupid questions, but In this case, does the "SteamGeneratorLEDs" need to be a texture file? Or what would it be in this context

red tiger
#

Good morning.

thick scarab
#

Hello!

fast galleon
thick scarab
#

Yes, I'm trying to edit one of his mods to fit my needs. I have genuinely no clue how to start from scratch

fast galleon
#

require returns the table at the end of the file named "..."

#

lua file

thick scarab
#

Ah, thanks

red tiger
frank elbow
#

We can only dream

frank lintel
#

found something interesting in log file... timedactions dont seem to follow normal loading order

frank elbow
#

How so?

frank lintel
#
LOG  : Lua         , 1679725486222> Loading: media/lua/client/TimedActions/ISInsertMagazine.lua
LOG  : Lua         , 1679725486222> Loading: E:/GameFiles/steamapps/workshop/content/108600/2704811006/mods/Snow is water - v1.3 - Full Version/media/lua/client/TimedActions/ISInventoryTransferAction.lua
LOG  : Lua         , 1679725486223> Loading: media/lua/client/TimedActions/ISLightActions.lua
LOG  : Lua         , 1679725486224> Loading: media/lua/client/TimedActions/ISLoadBulletsInMagazine.lua```
#

mod timedctions get thrown right in the middle of main loading not on the end when all the mod for client get loaded up

frank elbow
#

Sure it isn't because of their filenames? Those are in alphabetical order, after all

frank lintel
#

well if I didnt scroll down more to see all the rest of the mods loaded I wouldnt have though it was odd

#

like all after vehicle...

frank elbow
#

Ah, gotcha. I think it's because that's an override of a vanilla timedaction, so it's loading when the vanilla ones load

frank lintel
#

yeah interesting oddity never seen that documented

frank elbow
#

That's true for all overrides of vanilla files afaik. I believe it loads all of the filenames before actually executing any of them

frank lintel
#

I was testing all that but I never expanded it that much to think there was some exceptions looks like now gotta do ti all for client and server

#

well thats the thing I cant find anything that it's overriding

frank elbow
#

ISInventoryTransferAction.lua

frank lintel
#

yeah for the mod I cant find that in my game folder

frank elbow
#

It is there

frank lintel
#

I wanted to see what it was changing and to a compare but never could find it

frank elbow
#

Look in client/TimedActions

frank lintel
#

pz.zombie.client.....

#

or you meaning in debug when the game all loaded up?

frank elbow
#

media/lua/client/TimedActions/ISInventoryTransferAction.lua

red tiger
#

Cleaned up a wiki page for the Icon property for item scripts.

#

Felt the wording and formatting was odd.

#

I'm surprised that the food state suffix doesn't follow a delimiter like _

frank elbow
#

Spoiled is also a valid way to specify a rotten icon

frank lintel
#

odd all that time was trying to look for the java version makes sense why didnt find it.

#

guess Im just copy and pasting all these lua's by hand one of these days

frank elbow
#

Why copy paste?

frank lintel
#

because at this point I dont trust nor can use the method generating it atm

frank elbow
#

Unsure what you mean by the method generating it

red tiger
#

More informative.

#

=)

frank elbow
#

"Spoiled" erasure ๐Ÿ˜ข

red tiger
frank elbow
#

Ya

red tiger
#

Is it consequential to use?

frank elbow
#

Overdone is also equivalent to Burnt, so I figured it was just missed

#

Nah

red tiger
#

Okay cool thx.

frank lintel
#

I'll get in it more but atm gotta head to work laterz.

red tiger
#

Long function is long.

small topaz
#

Does anyone knows whether the vanilla game takes farming speed into account when giving farming xp? So, giving more xp when farming speed is set to slow or very slow? I checked the code and have the impression that it does not but I am wondering whether anyone can confirm.

frank elbow
red tiger
#

Adding enum support for my extension API.

#
        Type: {
            type: 'enum',
            values: ITEM_TYPES,
            description: `
            ${DESC}
            Possible types:
            - AlarmClock
            - AlarmClockClothing
            - Clothing
            - Container
            - Drainable
            - Food
            - Key
            - Literature
            - Map
            - Moveable
            - Normal
            - Radio
            - Weapon
            - WeaponPart

            ${EXAMPLE}
            ${CODE}zed
            Type = Weapon,
            ${CODE}
            `,
        },
frank elbow
#

Looks like it's missing KeyRing

red tiger
#

lol

frank elbow
#

Maybe none of the scripts actually use it, I just remember it from decoding the save info

red tiger
#

Also why does VehicleType use numeric values when they represent String values?

frank elbow
#

Good question

#

That very well could've been an enum too, strange

red tiger
#

Going to absolutely write into my API support to show the enum names before applying the numeric value.

#

That really bothers me. =/

fast galleon
#

this one mod I was editing was adding a type of 94741 or something, he only used it for batteries though.

#

that made them have special features like display tooltip conditions, naming, etc.

red tiger
#

I think that I'm going to use block comments for now.

#

like VehicleType: 1 /* Standard */,

red tiger
#

I don't like the look but it works for now.

#

My API:

VehicleType: {
    type: 'enum',
    values: {
        Standard: 1,
        HeavyDuty: 2,
        Sport: 3
    },
    description: `
    Types:
    - 1 = Standard
    - 2 = Heavy Duty
    - 3 = Sport
    `,
}
#

At least people can see what the value is. This will probably be useful for other properties. =/

#

One day I'll figure out how to do diagnostics so when the value 4 or something is placed, the editor will underline it with a warning.

#

Auto-gen description enum values & cleaner API. :D

#
        VehicleType: {
            type: 'enum',
            values: {
                1: 'Standard',
                2: 'HeavyDuty',
                3: 'Sport',
            },
        },
drifting ore
#

hmm, i make some patch of true music for my server

#

i upload to steam

#

and my server dont install it even i add it in .ini file

#

does anyone know why?

frank elbow
#

I think #mod_support would be more appropriate for that question (assuming it's an add-onโ€”just noticed you said "patch", so disregard this suggestion if it's not an add-on). Checking the logs may help you, though

drifting ore
#

oh, addon

#

sorry

wooden lodge
#

How do you make all zombies naked /spawn naked?

ancient grail
#

Spawn you cant till next build

#

But if you manage to get the zed the. You could do same thing as how you would a player i think

bronze yoke
#

you can remove all outfits from the outfit table

#

somebody did this a few weeks ago

atomic crow
#

Okay, I donโ€™t know a damn thing about modding but Iโ€™m getting so annoyed by this issue that Iโ€™m going to do it myself. How would I go about adding a trait that keeps the playerโ€™s temperature within a fixed range?

#

Or rather, keeps them from going above a certain point, I keep dying to fever because of random body temperature fluctuations with seemingly no cause.

red tiger
#

I keep telling myself that I need to go to eat lunch but I keep coding.

#

lol.

#

I'm converting over my sets for properties to an improved API.

fast galleon
atomic crow
#

And I canโ€™t think of any mods we have that would possibly do anything with player temperature.

#

Iโ€™ve posted about this in #mod_support in the past but Iโ€™ve gotten to the point where I just want to do something about it myself.

bronze yoke
#

are you wearing a bunch of layers in summer?

sour island
#

Perhaps a modded item is too insulated

atomic crow
#

Iโ€™m literally naked in 70 degree temps

#

And my internal temp is over 100 degrees

bronze yoke
#

there's a sandbox option to make your world hot, but it sounds like a broken mod to me

#

i don't think it goes that hot

atomic crow
#

None of my friends are having this problem is the weirdest part of it

sour island
#

You're on SP?

#

I would copy your save and slowly turn off mods to figure out what's going on

atomic crow
#

Multiplayer, and Iโ€™m not even the host so Iโ€™d have to wait for the host to update our collection to have a complete mod list.

red tiger
#

My VSCode extension is now updating & validating on the marketplace.

#

=)

#

Adding all the changes.

humble oriole
#

is it possible to completely build recipes from lua?

bronze yoke
#

yeah

red tiger
#

โ˜๏ธ

#

You can manually write out scripts of recipes or write a library to do it.

fast galleon
#

like a RecipeProducer API?

red tiger
humble oriole
#

I'm not seeing a way to do it under script manager

fast galleon
#

RecipeManager

humble oriole
#

but recipes area under scripts pain

bronze yoke
#

i think ScriptManager.instance:ParseScript(string totalFile) is what you're looking for

glass basalt
fast galleon
#

if you use tags you'll also need to call the on lua function or you could obviously just generate that before you try parsing it

fast galleon
red tiger
#

Wouldn't it be cool if you could Ctrl click a item name in a script and go to the definition?

red tiger
#

It's going to be fun showing you all this feature when I implement it.

red tiger
weak sierra
#

i meant from like.. installed mods

red tiger
#

I could perform a scan and store info for mods and vanilla scripts.

weak sierra
#

that'd be super useful

red tiger
#

I thought it would be cool but how useful would it be over being cool?

#

Being useful is sort of how my priority list works. xD

weak sierra
#

well i regularly patch and tweak existing items from other mods

#

as a server owner

#

so being able to in any fashion locate them quicker than going to the folder and doing a string search and then navigating to the path

#

that'd be lovely

red tiger
#

Adding settings right now for existing features.

dark wedge
# red tiger

Would you consider adding auto-formatting to your ZedScript plugin maybe? Just aligning the parameters would help with readability imo. i.e.

module Base {
    item Fisticuffs {
        DisplayName             = Bare Hands,
        DisplayCategory         = Weapon,
        SwingAmountBeforeImpact = 0.05,
        ...etc...               = value
    }
}
red tiger
#

Hahah

#

It's not in the extension though.

#

Do you want me to go ahead and take a look at that next?

dark wedge
#

No need, I'm happy with knowing its a thing being done. haha. I don't have too many scripts going really, and what I do I formatted that way myself. Was just trying out your plugin, pitching an idea.

red tiger
#

That prototype formatter alphanumerically sorts properties.

dark wedge
#

that's handy. although, can that part be disabled? I am trying to keep parameters organized for my scripts. i.e. all things related to damage are in one section, range in another, keep order that way.

red tiger
#

Totally doable.

dark wedge
#

Nice! Thanks!

red tiger
#

(Resumes slamming head into keyboard to make magic happen)

frank lintel
#

Omar you awake?

frank elbow
#

What's up?

frank lintel
#

I never ping ppl, nothing ws saying done.. back... as for why extract the lua's because well unless I can see them normally not with special compiling means... kinda explains itself as I said Im starting to not trust the source.

frank elbow
#

The .lua files are just stored as .lua files in the media subfolder of the game folder, so I'm a bit confused

frank lintel
#

since I dont have such a thing in my game folder so am I.

frank elbow
#

Assuming default (or what I think is default?) installation location on Windows: C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\lua

frank lintel
#

grrr I wsa still in zombie....

#

ya know that place if ya follow class names ya find stuff silly me..

#

ty... now I just have to only deal with java

#

I mean I could see them in game but I didnt think ya meant there.. and Im looking at the folder going wth... sighs

#

and get this... loading order on game load, isnt the same as game start...

#

ie when you see lua reloading when you load/start a game load order diffferent then when you just started it up.

frank elbow
#

Possibly due to a discrepancy between mods you have enabled from the main menu vs mods enabled on a save

frank lintel
#

they the same its just when and where when loading in... seems they get moved/changed a bit

#

Im trying to mentally picture if making a mod like superb... overall structure should look like what... global inits loading prefs first, methods etc, then main game/events after so on..

#

but then like we were talking about before those odd ones since they overwriting/adding to original lua stuff their load order totally different... how to plan on that etc

frank elbow
#

I'd rewrite it to not overwrite them personally (if possible), but that's probably a significant undertaking

frank lintel
#

well thats another thing but right now Im just trying to see if this thing's load ordering is just crap. I still have issues with options with it thats what I been working on.

nimble spoke
#

Ive seen discord bots for that

frank lintel
#

literally google 'discord bot for steam mod updates'

red tiger
#

(Drinks heavily...)

#

โ˜•

#

Fixed a flaw in my tokenizer.

frank lintel
#

that was bigger then I hoped

red tiger
#

I already have a crudely-working formatter.

#

Time to format those silly properties.

frank lintel
#

stares at that same person in a typeless language making enum refs :P

red tiger
#

I'm basically a linguist at this point.

frank lintel
#

no you just a human regex

#

covered in lint

red tiger
#

Hahah.. Don't forget that I've written about 3 transpilers now.

#

xD

small topaz
#

There is a java command item:isHidden() applied to InventoryItems. Does anyone knows how to define that an item "isHidden"?

frank lintel
#

I know.. Im not knocking ya you should know that by now

red tiger
#

Oh I don't think that you are.

frank lintel
#

Im seriously looking at finding some way to replace capsid

red tiger
#

Why do you use capsid again?

frank lintel
#

get the jars and sources

red tiger
#

It does something that ends up in Lua?

frank lintel
#

both

red tiger
#

In the future, there's opportunity for me to take what I wrote to translate to TypeScript and turn that into data that could be fed into some Lua helper tool of sorts.

#

=)

#

The transpiler I paused development for ZedScript intends to fully unzip the Lua code and properly transcribe it.

frank lintel
#

you know I really f'n hate havint to rename jar's to zip just to flipping explore them... grrr

frank lintel
#

thats still somthing running when natively I can do alreadyd

#

but capsid in the most basic sense builds you a set of libraries you then add to IJ as a global lib.

red tiger
#

(Scratches head)

frank lintel
#

and technically one of them isnt even a jar it should be called zip cuz its all lua code. lol

red tiger
#

Why is it that vanilla script files are wildly everywhere with whitespacing..

frank lintel
#

oh dont ask me... I see it even in some mods

red tiger
#

Welp. Time to format it to hell.

frank lintel
#

that and semicolons...

red tiger
#

lol

frank lintel
#

well if its ignored then dont matter but dont flipping mix and match either dont use it or use it everywhere

red tiger
#

I press one format command and it all goes away..

frank lintel
#

Im used to ; usage.

#

dunno if its how its viewed or not but to me it seems right... Cobol was actually the first sandboxed lang. as it had to be run in JCL... ^_^

red tiger
#

When you said I was human regex, you were right.

#

I just typed up a multi-whitespace regex handler line.

#

Straight up. xD

#
function removeExcessWhitespace(s: string): string {
    return s.replace(/[\s]+/g, ' ');
}
frank lintel
#

๐Ÿซฐ

#

btw pls help. regex for start of line to 'match string' to end of line so I can select the whole line using the match

#

I had it other day used it now lost and and cant remember what I did

red tiger
#

Huh?

#

lol

frank lintel
#

regex to match a whole line containing 'a string'

#

it was simple too I did it on regexr webpage

red tiger
#

oh

#
([\s]*)(a string)([\s]*)(?=\n)
#

I think that should work.

frank lintel
#

lemme see

red tiger
#

First and third captures are any amount of whitespace.

#

The 4th capture is a positive lookahead to check for a new line.

frank lintel
#

yeah this was even simpler then that something with start of line character and eol symbols?

#

now I cant find it

red tiger
#

The 2nd capture is what you want to edit as a literal expression.

#

Ehh ok.

#

I'm giving you flexibility there with whitespacing.

frank lintel
#

dunno why I was asking might knew just offhand

red tiger
#

Depends on what you want to capture and how it is formed.

frank lintel
#

its a log file I removed all the junk by inverting my selection after selecting thu a 10k log file everything I wanted :)

#
Expected to find missing API page for path zombie/modding/ActiveMods
Expected to find missing API page for path zombie/iso/sprite/IsoSpriteGrid
Expected to find missing API page for path zombie/chat/ChatMessage
...
#

my search used regex only way could be done for something like that

#

thats actually outta capsid's logfile

#

276 of them...

#

why I was looking at a way to just do it myself big circle if ya following me at all stressed

red tiger
#

Your setup would make me ragequit.

#

ngl

#

I'd like to avoid capsid.

frank lintel
#

I just hate the random 'uknowns' in general its fine.

#

even got the whole java part with zero issues there just lua stuff

#

well this is why I was looking at just making my own libs on both sides and then I can only complain to myself

#

why Im irked it being closed off cuz what is being done isnt nothing secret or unique

red tiger
frank lintel
#

too bad you cant use the | for the lists

red tiger
#

True.

#

It's not impossible though

#

After this vscode extension is done, I'm writing a preprocessor language that'll compile to ZedScript.

#

It'll give me full control and the ability to fix all the flaws concerning this scripting format. =)

frank lintel
#
        float var3 = var0;
        
        if (var0 > var1 & var0 < var2) {  -- this IF is the new part orig was only the two below
            return var3;
        }
        
        if (var0 < var1) {
            var3 = var1;
        }

        if (var3 > var2) {
            var3 = var2;
        }

        return var3;
    }```
red tiger
frank lintel
#

oddly that local var3 makes it faster, if you remove it and just use the args straight up its slower

#

but some reason adding the double logic if helps speed also atleast in how hard I stressed it with a million random()'s

red tiger
#

params are treated specially in most langs.

frank lintel
#

yeah Im thinking it some java bytecode memory stuff here

#

that was my first try was removing that, then found out was slower put that back in and thought of a way added that IF in and was like okay.. didnt expect that either lol

#

thats when I found out > and < are faster then <= >= also

red tiger
#

Going to try blending back in comments with this new formatter.

keen beacon
#

Hi, i'm not a modder but i have a question.

In theory, would it be possible to make a mod that resets world props and assets to default outside of safehouses.
Scenario is this:
Me and my friends run a hosted server, they've gone wild and practically dismantled every piece of furniture, beds, lockers, kitchens, everything in the nearby city while i've dismantled hundreds of boxes and built walls and furnished a warehouse outside of town.

What i want is for safehouses to be left as is, with the loot in it, but everything outside of the safehouses to be reset.
***Just world assets like houses and furniture, the loot inside the furniture etc. ***
Also yeah, not affecting the time and date of the server or anything else like that.

I think the ability to do this would be very appreciated and I'm surprised it's not possible in the vanilla game seeing as dismantling furniture and loot containers is frowned upon on more open multiplayer servers.

#

You know what i mean?

frank lintel
#

I just tried doing it the old school way of basically adding every single jar and class directory's by hand didnt seem to help.

#

as for your ? look into how the world gens think there something that let stuff refill automatic same with how many zombies keep respawning

keen beacon
#

Yeah i know loot containers can have respawn enabled, but that's not what i'm talking about.

I'm talking about restoring the state of the houses in the world, reset the furniture, walls, doors etc, everything that a player might have disassembled or moved outside of the safehouse.

frank lintel
#

again check inside the world gen stuff see if there something for that. otherwise dunno short of knowing where bases are and not wiping the save data and let it flat out regenerate them (if that even works...)

keen beacon
#

Yeah, i don't know anything about modding or scripting or stuff, so im just wondering if it's possible in theory or if i should stop having hopes and dreams spiffo

frank lintel
#

dunno either that was just a quick brainstorm might not even work like that

keen beacon
#

Well, your input is appreciated ๐Ÿ™‚ Hopefully someone looks into it because i think it would be a really useful feature

red tiger
#

There's no spare empty-line below the comment blocks buuut

#

It doesn't get rid of comments.

frank lintel
#

nice

red tiger
#

This isn't as flexible with comments but yeah I'm happy with it for now.

#

The big challenge would be to format selections instead of the entire document.

#

=/

#

Done for the day.

#

Got to think about improving the tokenizer to store empty lines.

frank lintel
#

put the empties where 'you' want'm

#

or should be...

red tiger
#

More than 1 empty line in a row is discarded in other formatters.

#

I'll figure it out when I get time to again.

frank lintel
#

if it was between main sections wouldnt care

red tiger
#

Formatters shouldn't be too aggressive.

frank lintel
#

stomps around the room. "HC Format 4 Life!"

frank elbow
frank lintel
#

coughs bethesda...

#

sorry couldnt help it was just watching SAO abridged..

#

omfg Im dying inside right now laughing cuz of the whole endgame scene on being a software dev... 500 hours of no sleep... seeing god.. oh boy I so feel like Kiyubah (sp?) right now

small topaz
frank lintel
#

is setmetatable a java funct or lua?

red tiger
#

lua

#

it's part of the language.

frank lintel
#

yeah I need to find where its defined

red tiger
#

It's.. a system thing.

frank elbow
#

I was hesitant to answer since the implementation is Kahlua therefore java

red tiger
#

like what stuff in java.lang is to Java.

frank elbow
#

But Lua is the much more straightforward answer

red tiger
#

It's literally Lua's design.

frank lintel
#

well gotta be defined somewhere for the tooltips saying is where Im going

red tiger
#

Kahlua is only reimplementing it.

open drum
#

Guys i have a newbie question...
some functions are executed right away by typing it's methods ex: addAllVehicles()
and some methods requires multiple methods pre-run , for example: getSoundManager():PlayWorldSound('MapOpen', getPlayer():getSquare(), 0, 5, 5, false);
some require classname.instance before it calls a method for example :VirtualZombieManager.instance:createHordeFromTo(X+50, Y, X, Y, 80)
lastly some require classname.new() method called before executing such as MyUI:new()

what's the difference and when do I know when to use what???

frank lintel
#

tired of it crying Im not putting a T in front of something (which infact breaks it)

frank elbow
frank lintel
#

ie trying to find the java/luadoc for it got the same problem with strings

red tiger
frank lintel
#

String != string apparently as a type...

frank elbow
#

I don't think there's a straight answer as to when to use which. You'll have to see the documentation and code examples to know what's appropriate

open drum
frank lintel
#

nvm just found it

#

global.lua...

frank elbow
red tiger
#

Wow.. Besides like about an hour and a half, I spent today coding for 12 hours.

#

Nice.

frank elbow
#

The .instance ones generally have a single instance that (probably) remains the same. They're using the singleton pattern. Getting the instance allows you to execute instance methods

#

As for :new(), that's a similar answer to the "using directly" thing and the "creating an instance" idea. You're creating an instance of something so you can use it

#

I am slightly intoxicated and I hope all of this is said in a way that makes sense

frank lintel
#
---@param arg0 String
---@param arg1 boolean
---@param arg2 boolean
---@return LuaManager.GlobalObject.LuaFileWriter
function getFileWriter(arg0, arg1, arg2) end```
red tiger
#

I mean.. I had to write a prototype of JS code doing what PZ does in Lua with pseudo-classes.

frank elbow
red tiger
#

so I had to learn what setmetatable was doing.

frank elbow
#

But I'm using vs code & LuaLS

open drum
frank lintel
#

yeah did you do that in the annotation or on your side only?

frank elbow
red tiger
#
function setmetatable(o, p) {
    for (const key of Object.keys(p)) {
        o[key] = p[key];
    }
}

//----------------------------------------------//

/* (Lua-like Table-Class constructor) */
BaseObject = {};

/** (Lua-Like Pseudo-Class Type) */
BaseObject.Type = 'BaseObject';

/** (Lua-Like Pseudo-Class Declaration) */
BaseObject.derive = function (Type) {
    return { ...this, Type };
};

/** (Lua-Like Constructor) */
BaseObject.new = function () {
    const _super_ = this;
    return new (function () {
        for (const k of Object.keys(_super_)) this[k] = _super_[k];
    })();
};

//----------------------------------------------//

SubClass = BaseObject.derive('SubClass');
SubClass.bar = true;

//----------------------------------------------//

SubSubClass = SubClass.derive('SubSubClass');

/* (Custom Constructor) */
SubSubClass.new = function (playerName) {
    let o = {};

    setmetatable(o, this);

    o._playerName = playerName;

    return o;
};

SubSubClass.getPlayerName = function () {
    return this._playerName;
};

console.log({ BaseObject, SubClass, SubSubClass });

//----------------------------------------------//

let inst = SubSubClass.new('Jab');

console.log({ playerName: inst.getPlayerName() });
frank elbow
frank lintel
#

is string supposed to be cap'd or not?

open drum
frank elbow
red tiger
#

That's what I got.

#

Heh.

frank lintel
#

okay so just renaming them string shouldnt even care

open drum
#

why VirtualZombieManager.instance:createHordeFromTo(X+50, Y, X, Y, 80) .instance is needed? instead of VirtualZombieManager:createHordeFromTo(X+50, Y, X, Y, 80)

frank elbow
red tiger
#

so that's what setmetatable does.

#

xD

open drum
#

the constructor of VirtualZombieManager says VirtualZombieManager()

frank elbow
frank lintel
#

yeah jab hence why you see this alot...

red tiger
frank lintel
#
    setmetatable(o, self)```
red tiger
#

Oh in Lua? Yeah.

#

But if I'm converting Lua to ES5 JavaScript, I'll need to emulate that.

frank lintel
#

yeah its crying that o isnt a table and Im like WTF you smoking...

#

even Im not that dab'd

open drum
red tiger
#

Knowing what you're talking about reassures me that I'll never be a normal person again.

frank lintel
#

1 sec.

red tiger
#

I'd like to get back to my transpiler project at some point.

open drum
#

maybe if i find a youtube video that explains the diff. between static methods and instance methods, it will help me to understand further

frank lintel
#

its just a table copier from what I gather was gonna post the annotation but it doesnt even explain much

frank elbow
red tiger
#

instance relies on a copy of a constructed object.

#

static is just like a namespace.

#

the class becomes a companion to a static reference, much like a namespace.

open drum
red tiger
#

So think global.

#

global is static.

open drum
#

๐Ÿคง

frank lintel
#

GLOBALS def static :P

red tiger
#

instanced data cannot be implicitly referenced from a static reference frame.

open drum
#

global is static

#

i see

red tiger
#

instanced objects can invoke static members.

#

static members requires a reference to an instance to invoke the non-static members of the object.

frank lintel
#

oops...

red tiger
#

This is why the hierarchy model is taught often in OOP. Static is something beginners to intermediates should avoid.

open drum
#

yea,.. confuses me alot

frank lintel
#

interface...

red tiger
#

Interfaces does not exist in Lua. =)

frank elbow
#

I don't think it's strictly necessary to understand for this use case anyhow. Still worth learning, though

red tiger
#

Hahah

#

You can totally enforce your own model of interfaces but gl with that.

frank lintel
#

but this game does like them on the dark side

red tiger
#

Why do you think I said "Fuck that", and use TypeScript instead? =3

open drum
#

can one give me one example of static method in zomboid??

#

since getPlayer() is instance method

frank elbow
#

getPlayer() is static (global in Lua, since it's exposed as a global); getSquare() on IsoPlayer is an instance method

red tiger
#

This is referred to as "Singleton" or "Instanced" approach. (Singleton is different. This is more instanced)

frank lintel
#

_G ftw

red tiger
#

Anyways..

#

(Runs away)

open drum
#

ok but again.. is getSquare() dont' need IsoPlayer.instance:getSquare()

frank elbow
#

Think of an instance method as something you call on an object

open drum
#

ok

frank lintel
#

Jab now what I was talking about the luaDoc(intellicode) whatever its called being fubar and capsid locked off is why Im irked this perfect example

frank elbow
#

The object in this case being the player. In the other example, the object was VirtualZombieManager.instance

red tiger
#

Once you call a returned object, You are no longer in a static context.

open drum
#

VirtualZombieManger itself is not an object yet

red tiger
#

Think about a multi-story building. You always want to reach up to get what you need.

open drum
#

until it sets a field . instnace?

red tiger
#

static is the ground floor.

open drum
#

ok

frank lintel
#

^

#

the foundation actually would be better phrase I think

red tiger
#

Trying to speak in more normal-minded terms.

#

Heh.

open drum
#

haha

#

im listening

red tiger
#

When you execute a task or operation, you always reach into or touch at least one thing outside of static context.

#

Something stored in global? That's not static but stored in static.

#

It's a bag of goods.

#

You care about the goods, not the bag.

#

It's a container. Nothing more.

open drum
#

oki

red tiger
#

I can explain this in other ways but it will be strictly technically speaking.

open drum
#

u r doing perfectly fine so far xD

#

i would get lot more confused with technical words

red tiger
#

I used to teach students unofficially.

#

Anywho I need to go unwind and get ready for tomorrow.

#

I'm behind about two days in my IRL work.

#

I got absorbed in my vscode adventure.

open drum
#

oki oki

#

good luck

red tiger
#

gn

open drum
#

Ok, so there's this createEatingZombies(IsoDeadBody target, int nb) method in virtualzombiemanager Class

#

I believe this method creates zombie that's eating a deadbody on ground

#

to use this method ill need 1 Deadbody object

#

so i go into IsoDeadBody class and see

#

all the methods

#

among them i see static void addDeadBodyID(short id, IsoDeadBody deadBody)

#

and I see it needs ID and deadbody obj again..

#

it threw me off >.<

frank lintel
#
float = {}```  o.O
frank elbow
#

That's the kind of thing I replaced with ---@alias float number

frank elbow
frank lintel
#

hmmm

#

well everything here defined in types.lua are {}'s

open drum
#

maybe if i do a search on Media folder of Zomboid , i could find an example of it being used?

frank elbow
#

Only a few places where it's necessary

frank lintel
#

too bad you dont got that in a jar file

#

I mean does PZ use any kind of number types or in lua they just numbers...

frank elbow
#

In Lua they're all just number. Type annotations can have integer, but in the version of Lua we're concerned with (later versions have a separate integer type) there's no distinction

frank lintel
#

ugh..

#

seriously if you could get a fixed version of zdoc-lua that would be awesome

frank elbow
#

I think I ended up having to tinker with the batch file a bit

frank lintel
#

I mean I could just flat out refactor the whole dang thing but Im not gonna be sifting thru it so prob could break something

frank elbow
#

I figured it'd be simpler to just modify the output a bit so I went that route

frank lintel
#

well thats the problem where Im getting to now all that work is closed off..

#

gradle gradle...

small topaz
#

How do I get a paramter value of a script.txt item in lua? I mean an item which has is not an InventoryItem. For example, if the itemType is "Base.MyItem" and it has weight defined, how do I access the weight (without creating a dummy InventoryItem via InventoryItemFactory.CreateItem("Base.MyItem") )?

old crescent
#

hello, does anyone knows how to fix the canbesafehouse error?..

#

ive trying to fix this error for about 3 days now.

frank lintel
#

describe?

old crescent
#

when you righclicked on a house .. it gives an error..

#

trying to claim a safe house but when you right clicked on a house .. it gives canbeSafeHouse error

open drum
#

try uploading what the error says in the console

frank lintel
#

hmmm

old crescent
frank lintel
#

looks like its not picking up for the click so its trying to work on nil. this totally vanilla no mods?

#

nvm there mods already see it

old crescent
#

It has an error even without mods

#

What I did was .. I set a static spawn point and removed all the spawn regions and set playersafehouse = true

polar dragon
#

Mod commission " Rising bite Nitro rifle" 125$ Must be compatible with britta's

rancid panther
#

that thread makes me wonder what if there was a mod that added a sniper rifle that made people bitten when shot by it

polar dragon
#

like a piranha gun?

#

sounds very Saints row

#

Oh crap thats the wrong name

rancid panther
#

sure but like zombie piranha

wheat kraken
#

how do controllers use tv vhs o0

it have only a basic supported right, how to remove vhs using controller?

solved
r1 to change focus on windows
and navigate

polar dragon
rancid panther
#

the cruelest pvp experience

polar dragon
#

It could work like the syringer from fallout 4

#

different ammo for different effects

open drum
#

hey guys

#

when i do

#
        local player = getPlayer()
        local X = player:getX();
        local Y = player:getY();
        local Z = player:getZ();

a = player:getCell():getGridSquare(X,Y,Z)```
rancid panther
#

is there a function or definition that shows where windows are able to be shot by guns?

open drum
#

and a:getDeadBody()

#

it returns nil

#

doesn't that bring deadbody?

#

suppose to **

#

nvm found the problem. player suppose to be standing on the zombie

frank lintel
#
        -- Make a table of values then return appropriate value based on num ??
        local r_value = {0, 64000, 32000, 26000, 20000, 16000, 12000, 8000, 4000, 2500, 1000, 400}
        return r_value[num]
--[[
        if (num == 1) then
            return 0
        elseif (num == 2) then
            return 64000
        elseif (num == 3) then
            return 32000
        elseif (num == 4) then
            return 26000
        elseif (num == 5) then
            return 20000
...```  Which would be better the table or if/elseif (in this case a dozen checks...)
open drum
#

in case of dozen of checks...

#

tables def.

#

reduces the lag

hot badge
#

Can anyone make a mod that cuts down pipe bomb's fuses down? I would be willing to bump you some cash

frank lintel
#

thats what I was thinking. wonder if I can put an or on the return incase the [num] is out of range

#

like return (r_value[num] or -1)

#

ooh that works nicely as a nil check and a flag if num is out of range

open drum
#

is there any simple mod that spawns custom zombie for me to take a look at the codes?

#

Authentic Z seems too complicated for my level

#

I want to learn how isoZombie works

#

so that maybe in future I can spawn my own zombies with custom attributes

rancid panther
open drum
#

ah good idead

#

i heard of they knew

hot badge
hot badge
# ancient grail Link is on my profile

Do you want me to join the team orbit discord? The other link just brings me to your workshop, and your steam profile brings me to the team orbit discord

ancient grail
#

Our proccess involves the discord so yep

hot badge
drifting ore
#

What is the most simple way to use big movable items in crafting recipes?

bronze yoke
#

i don't think there is a simple way

#

you make the recipe craft one part and use an oncreate lua function to add the extra parts to the player's inventory

drifting ore
bronze yoke
#

i worked this out for somebody else before, but i won't be able to go find it until tomorrow

drifting ore
wheat kraken
merry saffron
#

Is it possible to mod burnt wrecks to no longer spawn?

rancid panther
#

probably

scarlet kelp
#

Hi everyone! I'm currently working on a mod for Project Zomboid, and I've encountered a problem with the translation process. I was hoping someone here might be able to help me out, thanks!!!

fast galleon
scarlet kelp
#

Oh thank you!!!

#

It doesnt work, is anything wrong with the folder structure or code?

scarlet kelp
#

Ok @viscid kelp helped me with the problem, thanks!! it was the single quote in the translations file, it needed to be double quotes ๐Ÿ˜„ !!

viscid kelp
ancient grail
#

anti sledge function + animated tiles for a mod

sour island
#

Does it also prevent other ways to destroy something? Like fire :0

tardy wren
#

Fire not destroying stuff would be fire

ancient grail
#

Wait cssn you sledge fire?

#

Ahh u mean can it not get burnrd

chrome egret
ancient grail
#

Idont think so

#

Maybe if you detect fire and extinguish it if its on the same square? Or hook on how tile burn? Im not really sure

frank lintel
chrome egret
frank lintel
#

yep

chrome egret
#

In Java '&' by itself forces the "and" not to short-circuit or turns it into a bitshift operator. Which use are you intending here?

frank lintel
#

maybe? I could see if && helps any more.

#

honestly was surprized adding in the extra logic actually increased speed.

#

I was running a 33% random of low, inside and high

#

that actually didnt change anything noticeable.

chrome egret
#

Sometimes weird changes make things faster because they align with branch prediction or other CPU arch details

frank lintel
#

oh I know why I was surprised assigning a local inside the method was faster then just using the args directly

chrome egret
#

I think one of the guides, or maybe it's in the Lua docs, mentions that.

#

Even using a local ipairs or pairs is faster apparently

frank lintel
#

yeah since I wasnt changing anything didnt think it effect it like that.

chrome egret
#

(I realize that's not directly comparable with the function args)

frank lintel
#

but that was just something I noticed offhand while roaming about the java classes. this is what Im trying to muddle thru right now. https://github.com/Sycholic/Superb-Survivors/blob/main/client/5_UI/SuperSurvivorOptions.lua

GitHub

SSR aka Superb Survivors github is not being kept up to date. Bringing source up to date of current release game ver 41.78 This is not offical just attempt to update github to current the current...

#

eg, lines 15-27 replaced with this... elseif (option == "SpawnRate") then local r_local = {0, 64000, 32000, 26000, 20000, 16000, 12000, 8000, 4000, 2500, 1000, 400} return (r_local[num] or -1) and in the few other places that had > a few settings/values to get

#

I originally just change it to check the option only first then do the ifs for num values but then realized didnt even need'm

fast galleon
#

options = {lock=1, spawn=2} etc

frank lintel
#

I was thinking of that also but seeing it just returns num if it matches nothing I held off on that till I figure out why it was done that way.

#

and btw can you write booleans to a text file and read it cuz Im wondering why they didnt use bools for any on/enabled off/disabled options

fast galleon
#

just need to translate it when read file

frank lintel
#

I mean they are but a math sense but they then playing with the values cuz the buttons start at 1? I guess...

#

but then mixing it up on how? like look at "Findwork" and "RoleplayMessage' logic... ?o.O?

fast galleon
#

oh is this function for reading the file or for in-game use?

frank lintel
#

file options to load up

#

mod settings which I also gotta fix/change cuz it dont save it per save but as a global pref...

#

but yeah why I was ranting last night about filereader in my IDE crying my " " wasnt a string cuz its expecting a String... lol

#

oh which I fixed I just had to replace all the annotations lulz

fast galleon
#

random idea for Boolean, write only if it's true.

frank lintel
#

I think they using a minimal method in the storage I need to like get the full list of options and look at that

#

I just got irked seeing that mass of IF's like that esp like we talking 12 logic checks of something you know has to be true... after the first one.

#

I first changed it to just a elseif(option == "SpawnRate") then but then realized well shit why not just iterate thru a list (or in lua case table...)

#

I dunno just seems cleaner this way and also now incase someone hand modifies their options file to something out of range I can catch that :)

red tiger
#

Good morning.

frank lintel
#

yo.

keen beacon
#

I was like "BROOOO i was literally **just **asking the same question"

fast galleon
fast galleon
#

or Buildings built by npcs. Like the randomised that we have now, but also rebuilt when you revisit areas.

ancient grail
#

sharing my animated tile code

#

--initialize the main table
KWRRSHOP = {}

--initialize the sub table
KWRRSHOP.tiles = {
    ["Glytch3rTiles_0_0"] =  {name = 'Glytch3rTiles_0_0', shop = "melee", nextstate = "Glytch3rTiles_0_1", sound = "WoodGateOpen"},
    ["Glytch3rTiles_0_1"] =  {name = 'Glytch3rTiles_0_1', shop = "melee", nextstate = "Glytch3rTiles_0_0", sound = "WoodGateClose"},
    ["Glytch3rTiles_0_2"] =  {name = 'Glytch3rTiles_0_2', shop = "car", nextstate = "Glytch3rTiles_0_2", sound = "MapOpen"},
    ["Glytch3rTiles_0_3"] =  {name = 'Glytch3rTiles_0_3', shop = "car", nextstate = "Glytch3rTiles_0_3", sound = "MapOpen"},
    ["Glytch3rTiles_0_4"] =  {name = 'Glytch3rTiles_0_4', shop = "clothes", nextstate = "Glytch3rTiles_0_4", sound = "OpenBag"},
    ["Glytch3rTiles_0_5"] =  {name = 'Glytch3rTiles_0_5', shop = "clothes", nextstate = "Glytch3rTiles_0_5", sound = "OpenBag"},
    ["Glytch3rTiles_0_6"] =  {name = 'Glytch3rTiles_0_6', shop = "firearm", nextstate = "Glytch3rTiles_0_7", sound = "AnimalInWoodTrap"},
    ["Glytch3rTiles_0_7"] =  {name = 'Glytch3rTiles_0_7', shop = "firearm", nextstate = "Glytch3rTiles_0_6", sound = "AnimalInWoodTrap"},
}   
-- credis to fajdek for providing an optimized way of detecting tiles
function KWRRSHOP.isShop(spr)
  return KWRRSHOP.tiles[spr] or false
end 

--initialize the anti sledge function by hooking onto ISDestroyCursor
Events.OnGameStart.Add(function()
    local oldDestroy = ISDestroyCursor.canDestroy;
    function ISDestroyCursor.canDestroy(self, object)       
        local origReturn = oldDestroy(self, object)
        if origReturn then
        local spr = object:getSprite():getName()
            if spr and KWRRSHOP.isShop(spr) and not getPlayer():isAccessLevel('admin')  then
                return false
            else
                return origReturn
            end
        end
    end
end)

-- calls on table KWRRSHOP.tiles to set next sprite and sound effect
local function replaceSprite(obj, square, spr)
    local table = KWRRSHOP.tiles[spr]
    local getSFX = table.sound        
    local setState = table.nextstate    
    getSoundManager():PlayWorldSound(getSFX, square, 0, 5, 5, false);  
    sledgeDestroy(obj)
    obj:getSquare():transmitRemoveItemFromSquare(obj)
    square:AddTileObject(obj);
    obj:setSprite(setState)
    obj:getSprite():setName(setState)
    if isClient() then
        obj:transmitCompleteItemToServer();
        obj:transmitUpdatedSpriteToClients()
    end
end

#

------------------------@pao     this is the only part you should change          ---------------------------
--TODO @pao should open your shop UI

function KWRRSHOP.melee()
    --TODO opens your melee shop UI
    if isDebugEnabled() then print('melee'); getPlayer():Say('melee')  end     
end

function KWRRSHOP.car()    
    --TODO opens your pinkslip UI
    if isDebugEnabled() then print('car'); getPlayer():Say('car')  end     
end

function KWRRSHOP.clothes()    
    --TODO opens your clothing shop UI UI
    if isDebugEnabled() then print('clothes'); getPlayer():Say('clothes')  end     
end

function KWRRSHOP.firearm()
    --TODO opens your firearm shop UI
    if isDebugEnabled() then print('firearm'); getPlayer():Say('firearm')  end     
end


------------------------               ---------------------------
--TODO this is how you determine which shop you call dont change this
function KWRRSHOP.shop(shopType)
    --uses the sub table to find what the sprite represents
    if shopType == 'melee' then KWRRSHOP.melee() end
    if shopType == 'car' then KWRRSHOP.car() end
    if shopType == 'clothes' then KWRRSHOP.clothes() end
    if shopType == 'firearm' then KWRRSHOP.firearm() end
end

------------------------               ---------------------------

function KWRRSHOP.ContextMenu(char, context, worldobjects, test)
    local player = getSpecificPlayer(char)
    if test and ISWorldObjectContextMenu.Test then
        return true
    end
    local menuCreated = false
    for _, object in ipairs(worldobjects) do
        local square = object:getSquare()
        if not menuCreated then
            if square then
                for i = 0, square:getObjects():size() - 1 do
                    local obj = square:getObjects():get(i)
                    local spr = obj:getSprite():getName()
                    --uses the sub table above
                    if spr and KWRRSHOP.isShop(spr) then
                        --walks to the object
                        local adjacent = AdjacentFreeTileFinder.Find(square, player)
                        --added this so when the player is near the object but not facing it, it will still face it
                        player:faceLocationF(square:getX(), square:getY())
                        if adjacent ~= nil then
                            ISTimedActionQueue.add(ISWalkToTimedAction:new(player, adjacent))
                        end
                        local table = KWRRSHOP.tiles[spr]
                        local setState = table.nextstate
                        --replaces the tiles on right click
                        replaceSprite(obj, square,  spr)
                        context:addOption("Shop for "..table.shop , spr, (function()
                            KWRRSHOP.shop(table.shop)
                            --reverts the tile to its original appearance
                            replaceSprite(obj, square, setState)
                            --TODO should maybe do this if incase they cancel, i just dont know how yet
                        end))
                    end
                end
            end
        end
        -- prevents multiple context menu entries
        menuCreated = true
    end
end
Events.OnFillWorldObjectContextMenu.Add(KWRRSHOP.ContextMenu)

#

@zinc pilot what do you think?

#

o his offline

scarlet kelp
#

Hey there, fellow survivors! ๐ŸงŸ

I'm excited to announce that I've just published my very first mod for Project Zomboid - the "Rehydrated Meat" mod! This mod allows you to transform dried meat into tender, delicious meals that will make your survival experience even better.

I want to give a massive shoutout and thank you to @viscid kelp , who helped me with the translation files. Your assistance made this mod possible! ๐Ÿ™Œ

I would really appreciate it if you could give my mod a try and let me know what you think. Your feedback will help me improve and create even more awesome mods in the future.

๐Ÿ”— https://steamcommunity.com/sharedfiles/filedetails/?id=2952771117

Happy surviving, and bon appรฉtit!

keen beacon
scarlet kelp
ancient grail
#

Ye speciific to client

#

Like their server

sour island
#

What shop mod is it using?

ancient grail
#

Its not like any other shop mod right now

#

Non
Pao will do it

sour island
#

oh

ancient grail
#

Make it i mean

#

Like pinksslip view the vehicle stuff

frank elbow
#

Did I just imagine this, or does being drunk make you slur words in chat? Or did it ever? Looking for where that happens out of curiosity & I don't see it anywhere

red tiger
#

Copied my code from ZedScriptParser to the vscode plugin.

#

It'll be useful for formatting.

red tiger
#

Code I spent over 100 hours in.

red tiger
ancient grail
jaunty marten
#

good morning

red tiger
#

You see the progress on my vscode extension?

jaunty marten
ancient grail
#

It wont have same name i doubt it will

jaunty marten
#

so yea

red tiger
#

Working on the formatter and documentation components.

fast galleon
jaunty marten
ancient grail
#

What no we are not using noir. I thought pao was going to make the shop

jaunty marten
red tiger
jaunty marten
#

it's so cool moon_kittylove

red tiger
#

I rewrote the design so that people can easily add to it.

fast galleon
ancient grail
#

Ye they are already using noir so comming to us for the shop mod wouldnt maake sense

#

But ill double check

red tiger
jaunty marten
#

@red tiger

sour island
#

Does Noir have multiple shops? I was under the impression there's 1 store for the entire server

fast galleon
#

is it normal that using kick out of safehouse sends me out of my own safehouse? Not the safehouse I was next to?

red tiger
ancient grail
frank elbow
#

I think having them in .json would make people more likely to contribute but still probably not too many, I presume, since tooling tends to be that way

red tiger
#

(Going to look into persistent data with extensions soonish)

#

Everything I'm doing rn is new to me.

#

(Extensions are)

frank elbow
#

I've never messed with vs code extensions either, so looking forward to reading through the code when I get the chance

autumn garnet
#

Live Template on Intellij

fast galleon
#

maybe it's the money / banking by noir but that name came up.

red tiger
#

Forgot to put my donation stuff on the extension's page.

#

That and my Discord org server.

#

Need to get that thing shaped up.

#

Planned to have a bot that takes the JSON from my parser to provide info to modders.

red tiger
ancient grail
#

For items, recipe, sounds, models, fixing, evolve recipe

autumn garnet
#

I'm going to share my lives templates^^

#

it's just for lua event

#

I use Capsid too

frank lintel
#

I fixed most my issues with that now just would have to look for any others that pop up for type mismatching.

red tiger
#

I think that people would be okay with a very aggressive formatter for now.

#

They don't need to use it.

#

@jaunty marten

#
        Heat: {
            type: 'float',
            description: `
                The parameter indicates the temperature of the resource required for crafting. -1.0 (Very hot) to 1.0
                (Very cold).
            `,
            example: 'Heat: -0.22,',
            values: {
                '-1.0': 'Very hot',
                '1.0': 'Very cold'
            },
            // range: [-1.0, 1.0]
        },
jaunty marten
red tiger
#

Also looks like recipe comments are breaking down in the syntax highlighter.

#

Fixed. Also, this psytrance album is absolutely slapping right now.

#

Recipe is so freaking crazy with syntax that I had to isolate the regex patterns for it.

#

When I get a chance to write the lang that I want to compile down to ZedScript, that's going away. xD

odd fjord
#

is there an event that only triggers if the player's inventory gets updated? like if an item is added to it

autumn garnet
red tiger
#

Heh. Thanks for starring my events repo.

#

So much to do..

#

I just got my deep-parser hooked up to the extension code. Will need to improve the tokenizer to tokenize empty lines.

#

It's a very aggressive formatter since the code I hook into actually generates ZedScript.

#

I also need to figure out which scopes allow for duplicate names.

autumn garnet
#

It's monstrous

red tiger
#

I find that to be a verrrrrrry concerning design choice.

#

Recipe names aren't unique but I coded it this way. Heh.

#

Unique identifiers FTW.

sour island
#

I hope that's changed tbh

red tiger
#

I've a few hundred errors to fix now that I'm upgrading my tokenizer. xD

brave ruin
#

When you are making an item or such like food. Can you put in a chance of HungerChange and UnHappy change etc?

#

Could you for example put
UnhappyChange = -10; -50,

#

?

frank lintel
#

we got a pi or e constant in PZ?

red tiger
#

math.PI not work?

#

You can always copy a somewhat accurate value as a const if not.

#

Silly if not already present.

frank lintel
#

I keep getting nil in console so I dunno

steel delta
#

I need to add a new item I created to the foraging loot table when in an Urban Area, does anyone know how to do this?

frank lintel
#

like just to be not blind say(tostr(math.pi)) should work right?

frank elbow
#

Assuming say and tostr are defined and working, yes

sour island
#

tostring() afaik

frank lintel
#

lemme double check I was just quick typing I mighta actually used that

sour island
#
--- The value of ฯ€.
math.pi = 3.1415
```in `math.lua`
#

But that's part of Lua53

frank elbow
#

I assumed tostr was some custom function of yours lol

frank lintel
#

well its still nill regardless

frank elbow
#

Have you tried printing just math.pi? It should be present, looking at the source

frank lintel
#

hmm odd

#

well that worked I was using say so I can actually read it cuz console goes its own size... but anyhoot seems it uses what java does as well so that answered my Q

frank elbow
#

This got me poking around at Kahlua's stdlib implementations & apparently there's some extra table functions

#

table.newarray for a table that behaves like an array. neat (+ table.isempty, table.wipe, and table.pairs which is the same function as pairs)

frank lintel
#

well I need to update EmmyLua's constants apparently

#

cuz Emmy thinks PI is 3.1415 and thats it lol

#
math.pi = 3.1415```
taken from EmmLua 5.1 plugin math.lua
red tiger
#

Going to make formatting so much easier. :D

sour island
#

Tweaking the skill progress UI to add more clarity for my own sanity with dealing with skill recovery journal users

#

Fortunately I was able to just use gsub in a function decoration

red tiger
#

Worried that people will think the formatter will be broken if / when they use it with broken scripts.

#

Diagnostics are a must. =/

balmy swan
#

Howdy, I've been looking online and around this discord, but I couldn't find anything regarding this,
Would it be possible to disable certain tiles from being destroyable with a sledgehammer, potentially replacing the tool required for those tiles?

frank elbow
#

I think it was @ancient grail that posted an example of just that earlier today (so he'd know)

jaunty marten
brave ruin
#

Do anyone know why katana has two weapon WeaponLength ?


        BaseSpeed = 1,
        WeaponLength = 0.3,
        DamageCategory = Slash,
        DamageMakeHole = TRUE,
        TwoHandWeapon = TRUE,
        WeaponLength = 0.4,
        AttachmentType = BigBlade,
craggy furnace
#

because its an oversight

brave ruin
#

An what?

craggy furnace
#

they were tweaking and accidentally left two in

jaunty marten
brave ruin
sour island
#

When you "unlock" a level it stops showing the XP earned - so you just have the current level's progress

#

same for 'locked' levels

#

Just trying to make the amount of XP easier to count/check

#

What was your xp recovery mod?

jaunty marten
jaunty marten