#mod_development

1 messages · Page 198 of 1

atomic crow
#

There’s existing night vision goggle mods already, you could take a look at how they work.

drifting ore
#

that's a smart idea, thank you!

#

Hmm, what about glowing zombies? or a way to make them turn a different color, for example in thermal vision creatures glow bright

raven zinc
#

Does anyone know why the cursor wouldn't show up in game?

atomic crow
pulsar rock
#

Nice work!

nova socket
# pulsar rock Nice work!

Thanks, today I shed even more blood and tears thou.
Had some dedicated server syncing issues to fix kek

pulsar rock
#

That's modding for ya bob_lul

pulsar rock
#

Say, are there limitations to Moddata?

#

I'm trying to save the following structure:

myModNameData = {
  tile = {
    x = 1234,
    y = 1234,
    z = 1234
  },
  tileType = "someString"
}

ModData.getOrCreate("myModName") = myModNameData

But it appears to only save tileType.

#

Does it not allow for tables inside of tables to be saved?

#

Is there an issue with integers?

nova socket
pulsar rock
#

So, I should also be able to save IsoObjects? (such a squares or items)

nova socket
#

Just to be sure what I actually transmit as data is

{
    ['base'] = {
        ['name'] = "Immersive Trader",
        ['range'] = 10,
        ['icon'] = "media/textures/Shop.png",
        ['x'] = 12598,
        ['y'] = 955,
        ['z'] = 0
    },
    ['data'] = {
        ['Weapons'] = {            
            {"Base.Katana", 1, "Base.Money", 4000, 1250},
            {"Base.AssaultRifle2", 1, "Base.Money", 2000, 1000},
            {"Base.AssaultRifle", 1, "Base.Money", 1500, 750},
            {"Base.HuntingRifle", 1, "Base.Money", 1000, 500},
            {"Base.VarmintRifle", 1, "Base.Money", 1000, 500},
            {"Base.DoubleBarrelShotgun", 1, "Base.Money", 750, 400},
            {"Base.DoubleBarrelShotgunSawnoff", 1, "Base.Money", 750, 300},
            {"Base.Shotgun", 1, "Base.Money", 600, 300},
            {"Base.ShotgunSawnoff", 1, "Base.Money", 600, 200},
            {"Base.Revolver_Long", 1, "Base.Money", 500, 250},
            {"Base.Revolver", 1, "Base.Money", 300, 150},
            {"Base.Revolver_Short", 1, "Base.Money", 300, 150},
            {"Base.Pistol2", 1, "Base.Money", 300, 150},
            {"Base.Pistol", 1, "Base.Money", 300, 150}
        },
        ['Weapon Parts'] = {
            {"Base.x8Scope", 1, "ICurrency.GemScrap", 100, 25},
            {"Base.x4Scope", 1, "ICurrency.GemScrap", 50, 15},
            {"Base.x2Scope", 1, "ICurrency.GemScrap", 25, 10}
        },        
        ['Ammo'] = {
            {"Base.Bullets45", 30, "Base.Money", 150, 3},
            {"Base.Bullets44", 30, "Base.Money", 125, 3},
            {"Base.308Bullets", 30, "Base.Money", 100, 2},
            {"Base.556Bullets", 30, "Base.Money", 100, 2},            
            {"Base.ShotgunShells", 24, "Base.Money", 100, 3},
            {"Base.Bullets9mm", 30, "Base.Money", 50, 1}
        },                
        ['Currency'] = {
            {"ICurrency.GoldScrap", 1, "Base.Money", 0, 10},
            {"ICurrency.SilverScrap", 1, "Base.Money", 0, 5},
            {"ICurrency.GemScrap", 1, "Base.Money", 0, 25},
            {"ICurrency.GemScrap", 1, "ICurrency.GoldScrap", 5, 0},
            {"ICurrency.GemScrap", 1, "ICurrency.SilverScrap", 10, 0}
        },
        ['Miscellaneous'] = {
            {"Base.PetrolCan", 1, "Base.Money", 250, 100},
            {"Base.Bag_ALICEpack_Army", 1, "Base.Money", 1000, 500}
        }
    }    
}
#

So there is a lot of various data

pulsar rock
#

Hm

nova socket
#

And it goes through normally to client

pulsar rock
#

I'm a bit puzzled as to what is wrong with my code then hmm

#
    local firstLink = {
        tile = WarpTiles.toXYZTable(inProgressLink[2]),
        tileType = inProgressLink[3]
    }

    local secondLink = {
        tile = WarpTiles.toXYZTable(_tile),
        tileType = _tileType
    }

    print("Saving link (performed by " .. playerObj:getUsername() .. ")")

    local link = {
        source = firstLink,
        destination = secondLink
    }

    WarpTiles.saveTileData(firstLink.tile, firstLink, secondLink)
    WarpTiles.saveTileData(secondLink.tile, secondLink, firstLink)

    local linkTable = WarpTiles.getModData()

    table.insert(linkTable, link)

    WarpTiles.syncModData()
#

The saveTileData stuff works

#
--- Get the mod data table.
---@return KahluaTable
WarpTiles.getModData = function()
    ModData.request(WarpTiles.modDataKey)
    return ModData.getOrCreate(WarpTiles.modDataKey)
end
#

WarpTiles.getModData ^

#

It saves the tileType fields properly, and I can access those through source & destination, but not the "tile" fields.

nova socket
#

Basically on server you need to do getOrCreate(), then fill with stuff and once you are ready you need to transmit() it.
On other end (client) you need to have two events OnInitGlobalModData and OnReceiveGlobalModData - first is to catch data already transmitted, second is to catch data updated.

#
-- Moddata
local function onInitGlobalModData() 
    ModData.request("IShopsData");
end
local function OnReceiveGlobalModData(module, packet)
    if module == "IShopsData" or module == "IShopsObjects" then
        if packet then
            IShops:print('Getting data packet from server');
            ModData.add(module, packet)
        else
            IShops:print('Getting update packet from server');
        end
    end    
end

Events.OnInitGlobalModData.Add(onInitGlobalModData)
Events.OnReceiveGlobalModData.Add(OnReceiveGlobalModData)

Something like that on client

#

add() is required on other end

pulsar rock
#

The issue isn't syncing. It's not saving the entire table for whatever reason.

nova socket
#

Not saving where on receiving end?

pulsar rock
#
    local firstLink = {
        tile = WarpTiles.toXYZTable(inProgressLink[2]),
        tileType = inProgressLink[3]
    }

    local secondLink = {
        tile = WarpTiles.toXYZTable(_tile),
        tileType = _tileType
    }

    local link = {
        source = firstLink,
        destination = secondLink
    }

    local linkTable = WarpTiles.getModData()

    table.insert(linkTable, link)

    WarpTiles.syncModData()
#

This is the relevant bit of code

#

It's not saving the tile portion of the first & second link tables.

#

But it is saving tileType

nova socket
#

oh wait you are talking a IsoObject mod data

#

I'm talking about Global Mod Data its a different entity.

pulsar rock
#

No, I'm talking about global mod data

pulsar rock
nova socket
#

sec

#

so what data type you transmit again? tiletype as a string?

pulsar rock
#

Yep

#

And tile as a table of 3 integers

#
--- Convert a tile to an x,y,z table.
---@param _tile IsoObject
--- The tile to be converted.
---@return table
--- An x,y,z table representing the tile.
WarpTiles.toXYZTable = function(_tile)
    return {
        x = _tile:getX(),
        y = _tile:getY(),
        z = _tile:getZ()
    }
end
nova socket
#

Weird huh

pulsar rock
#

This is the toXYZTable method ^

#

I use this method in other places, and it seems to work fine there, so it's not returning nil as far as I'm aware

nova socket
#

what is exactly WarpTiles.syncModData()

pulsar rock
#
--- Sync the mod data table to the server & clients.
WarpTiles.syncModData = function()
    ModData.transmit(WarpTiles.modDataKey)
end
nova socket
#

oh well makes sense

pulsar rock
#

Simply a transmit with the key pre-filled

nova socket
#

tileType = _tileType could this issue be related to linking it as _ variable?

pulsar rock
#

How so?

#

They're two different variables

#

Unless LUA does funky stuff with underscores

nova socket
#

ye

#

because lua has _ and __ under the box

pulsar rock
#

I don't think those do anything functional, though?

#

They're just conventions

nova socket
#

plain example is class inheritance with setmetatable and self.index = __self shit

pulsar rock
#

Yeah, those are just conventions for variables

nova socket
#

Its just weird string is not going through. Your chain seems right

#

You do trasmit() and you have request() and probably add() too

hollow lodge
#

I'm having trouble with russian translations, I'm using notepad++, what are the steps to follow? or how should i save my itemname_ru.txt? 🇷🇺 🇷🇺🇷🇺🇷🇺🇷🇺🇷🇺🇷🇺🇷🇺

fast galleon
pulsar rock
#

That's a variable I set up for ease of use

#

"myModData" was just an example snippet

nova socket
#

I would double check kek

pulsar rock
#

Minimal viable example of what I was doing

#

Is there a simple way to browse global mod data?

#

An sqlite database file somewhere?

#

Or a way to attach a debugger to the LUA script somehow?

nova socket
#

In debug mode debuggers Dev section there is GlobalModData viewer

pulsar rock
#

How do you enable debug mode again?

nova socket
#

-debug as startup param

pulsar rock
#

Also, there isn't a quick way to reload LUA while hosting a server, by any chance?

#

Without having to reboot the test server entirely

nova socket
#

No unfortunately not on the server, in hosted game or singeplayer you can do that safely in F11

pulsar rock
#

Much appreciated for the help so far btw!

fast galleon
#

there is however a reloadlua command

nova socket
#

however might be viable if you have an event with remote exectuin

#

so client debug console can send sendServerCommand

#

and the server reload file scripted, but it already sounds more like liability

pulsar rock
#

Quick side question, is there a simple way to do a reliable timer?

#

Or do I just use os.time() and go from there?

fast galleon
# hollow lodge I'm having trouble with russian translations, I'm using notepad++, what are the ...

There are some guides around.

To sum up: use the same file name as the game and the same encoding.

Check this.
https://github.com/TheIndieStone/ProjectZomboidTranslations/blob/1e66032c6953a30d1d5a30e6cd9e132eac809458/.gitattributes#L25

GitHub

Translation files for Project Zomboid. Contribute to TheIndieStone/ProjectZomboidTranslations development by creating an account on GitHub.

hollow lodge
#

makes sense

nova socket
#

lemme post it again

#
function IC:sleepDo(seconds, func, condition)
    local time = os.time();
    local targetTime = time + seconds;
    if condition == nil then condition = true end; -- Optional 


    local function OnSleepTick()
        local timeNew = os.time();
        if not condition then 
            Events.OnTick.Remove(OnSleepTick);
            return
        end
        if timeNew >= targetTime then
            Events.OnTick.Remove(OnSleepTick);
            func();
        end
    end
    Events.OnTick.Add(OnSleepTick)
end
pulsar rock
#

It's moreso for cooldowns on specific methods

nova socket
#

So you can even loop it until condition is met

fast galleon
pulsar rock
#

Debounce?

#

Possibly?

nova socket
#

usage is something like

local function func()
    if whatevercondition then return end -- End it
    -- Do your stuff every N-seconds

    -- Repeat (optional)
    IC:sleepDo(1, func);
end
IC:sleepDo(1, func);
#

equivalent of setInterval from JS

pulsar rock
#

Does that not block other parts of the script? Or is LUA async / threaded?

nova socket
#

It uses OnTick and os.time() to measure time, only then performs it removing itself from OnTick span.

#

so its technically performed only in one frame

#

But in general I would not recommend looping something really heavy anyways.

fast galleon
nova socket
#

or this, but thats a whole mod

#

does anyone know where are all base items icon textures are located

#

it does seem its inside of some of the .packs?

sour island
#

Speaking of reloading Lua, I plan to look into having clientside force that on servers - but only if in debug mode for the tools.

#

Also for the error magnifier, I'm toying with the idea of having clients send their errors to the server so admins can check them.

nova socket
#

But how you wanna do it in case of runtime exceptions? or Lua can handle them?

sour island
#

Errors are processed to get added to the UI pop up / f11

#

For error magnifier I grab that list and clean it up somewhat

#

So yes, although there are some errors that don't get added to this list

#

I think streamlining error management is a good step for the community at large

#

It's a lot of steps and time for most people to go back and forth - and they're not really obligated to commit to helping a modder. Just like it's not an obligation the modder tackles every bug. But yeah, the current system is not friendly for either party. 😅

#

I'm always grateful for people who go through the trouble of finding their console logs. But they also send me hours of logs.

#

The debug tools I mentioned are part of the community project - if this is a project you'd want to help with / want help with @nova socket .

#

It's kind of in limbo as I told myself I'd not commit to a large project and only work on this off and on...

#

But it's automatically updated off GitHub every Friday.

nova socket
#

oh wait

#

lmao

#

no idea is unique kek

sour island
#

Yeah, that was one of the reasons I wanted to start this

#

I think we've all spent half a day making something only to discover it's an obscure vanilla function or already exists

nova socket
#

I subbed and pinned repo If I come up with some usefullness ill post a pull request.

sour island
#

Sounds good 👍

#

I'm looking into a vote to pull system

#

But ... also terrified of that

nova socket
#

I found that stuff like this might be overly useful

function IShops:getItemCondition(item)
    if not item then return -1 end;
    if item:IsDrainable() then return item:getUsedDelta() end
    if item:IsWeapon() then return item:getCondition() / item:getConditionMax() end
    if item:IsClothing() then return item:getCondition() / item:getConditionMax() end
    if item:IsFood() then
        local stage = item:HowRotten();
        if stage == -2 then return 1 end
        if stage == -1 then return 0.75 end
        if stage == 0 then return 0.5 end
        return 0;
    end
    return -1;
end

function IShops:checkItemParent(item)
    if not item then return false end;
    local container = item:getContainer();
    if not container then return false end;
    local parent = container:getParent();
    if not parent then return false end;
    if parent ~= getPlayer() then return false end;
    return true;
end
#

or this, but its borrowed from one of the mods

function IShops:chatMessage(msg, visual, channel)
    local chatMsg = {
        getTextWithPrefix = function(self)
            return msg
        end,

        getText = function(self)
            return msg
        end,
        
        setText = function(self, newMsg)
            msg = newMsg
        end,
        
        isOverHeadSpeech = function() return not visual end, -- 
        isServerAlert = function() return visual end,
        isShowAuthor = function() return false end,
        isServerAuthor = function() return true end,
        getAuthor = function() return false end,
        getRadioChannel = function() return -1 end
    };
    ISChat.addLineInChat(setmetatable({ msg = msg.."\t" }, chatMsg), channel or 0)
end
#

funny is that food has 2 stages of freshness

#

-2 fresh and -1 is also fresh

sour island
#

Ishops? :0

#

I also made a shops mod

#

As for APIs I'm steering away from including those into the project in favor of general utility stuff.

#

I need to incorporate quality checks for items in my shops

#

Right now it's just a blanket > 75%

#

Would be cool if people wanted intentionally broken items

#

Or rotten food etc

fathom barn
#

Hey, is there any tutorial on the resolutions for the menu background? I downloaded a bunch of main menu mods and investigated them but they're all weirdly cropped.

raw tulip
#

yes, this doesnt work
how would I do an "or" for these two items?

#

"you can use 4 smallSheetMetal OR 2 sheetMetal" is my goal

#

similarly, how could I create "any of"

#

the game wants EITHER 6 metalPipe or 6 metalBar

#

not like 4 metalPipe and 2 metalBar

#

since I kinda want them to be the "same thing"

bronze yoke
#

two different recipes with the same name can accomplish the first

#

recipes are extremely rigid

nova socket
raw tulip
bronze yoke
#

yeah, i mean as a whole there's just very little flexibility in how they work

raw tulip
#

no OR or ANDs?

tiny wolf
#

Hello everybody,

Trying to understand how loot and procedural distribution works to configure my mod.
Do you know videos or forums which learn how to use ProceduralDistribution, Rolls, weighchance etc... please guys ? 🙂 ❤️

bronze yoke
#

no, infact every single condition is evaluated separately

#

e.g.```
Apple=1,
Apple=1,

raw tulip
#

even though theres two of them seperately hahaha

bronze yoke
#

for the 'any of' issue, someone was in here trying to work it out for weeks, it's just not supported

#

you can do it with food to an extent but not with anything else

raw tulip
#

hm....

raw tulip
raw tulip
#

same with metal bars and metal pipes, and even lead pipes Blinking
so if only there was a way to make pipes of each

nova socket
sour island
#

Like [hammer] or what not

bronze yoke
#

how so?

#

they just add to the item list

sour island
#

Evaluate the item type and count

bronze yoke
#

they're evaluated at script load

sour island
#

Oh?

#

Yeah then you're stuck making a recipe for each I guess

raw tulip
fast galleon
#

good thing next version updates recipe system

raw tulip
#

make a recipe for metal pipes
make a recipe for metal bars
make a recipe for lead pipes
right?

sour island
#

You'd have to make one for each count of ingredients

#

If you want pipes/bars = 4 you only need 1

#

If you want a=4, b=6, c=8 you'd need three.
a/b=4, c=6 means just 2 recipes

#

The issue is you can't define the amount per ingredient and use OR?

#

They have to all be the same amount

raw tulip
sour island
#

There is an OR

#

And is just default ...

#

Can you not define the amount if you use or at all?

raw tulip
#

the amount is applied to the entire selection
"MetalPipe/MetalBar=6"

sour island
#

Yes.. that's an OR

raw tulip
#

means 6 of metalpipes or 6 metalbars

#

if you have 3 of each it wont let you craft yeah

#

which is what im trying to get at

tiny wolf
sour island
#

Ah you're worried about the anyof

raw tulip
#

ANYOF itemA/itemB

sour island
#

Yeah.... that uh

raw tulip
#

yeah... Sadge

sour island
#

I wonder how far you can push the evaluation functions for ingredients

#

I feel like it should be possible... even if you have to really bend it in Lua

bronze yoke
#

you can do this stuff with them but i didn't recommend it since you're basically just rewriting recipes at that point

sour island
#

Yeah a bit

raw tulip
#

thus heres my question now.

#

pipe or bar

sour island
#

What is this recipe for?

#

Would a middle man object be ok?

raw tulip
#

crafting a generator

sour island
#

Like convert the items into something to prepare them

raw tulip
#

hm....

sour island
#

Then you could use 6 of those

#

Although I feel great pain suggesting adding a dead-end single use item

raw tulip
#

dang... the wiki has uses for both the bar and pipes

#

metal bars are for construction

#

and pipes are for furnishings

#

lead pipe is a no go, no recipes. its a weapon Blinking

sour island
#

You can totally use those

#

You can use any item in a recipe, keep or use any, etc

#

Just no any of apparently

#

🧠

raw tulip
#

nah not gonna use "keep" since its being used to construct the generators bars

sour island
#

You can generate recipes dynamically

#

Make one recipe for every combination on boot

#

🙉

#

All the cardinal sins

raw tulip
#

METAL PIPE IT IS.

#

@sour island@bronze yokealright finally, are these fair to the player?

sour island
#

Sure? Seems like a good investment of resources

#

Game balance is kind of subjective

raw tulip
#

its a fucken generator so its hella expensive

#

pretty big deal so it needs to be difficult

verbal yew
#

Radio.ElectricWire?

#

emmm

#

okay

raw tulip
raw tulip
verbal yew
#

SheetMetal
SheetMetal

double?

#

maybe change one to SmallSheetMetal

raw tulip
#

ah thanks, that one was supposed to be smallsheetmetal

#

I'll correct that

verbal yew
bronze yoke
#

but it is in the radio module

raw tulip
verbal yew
#
recipe zReVCPersonalComputer
    {
        ElectronicsScrap=15,
        ElectricWire=8,
        LightBulb=6,
        SmallSheetMetal=4,
        SheetMetal=2,
        Screws=16,
        destroy CarBattery1/CarBattery2/CarBattery3=1,
        destroy Radio.TvAntique/Radio.TvWideScreen/Radio.TvBlack=1,
        WeldingRods=5,
        BlowTorch=1,
        keep WeldingMask,
        Result:Moveables.appliances_com_01_72=1,
        Sound:Blow_Torch_A,
        Time:1300.0,
        Category:Equipment,
        CanBeDoneFromFloor:False,
        SkillRequired:MetalWelding=2;Electricity=2,
        Prop1:BlowTorch,
        NeedToBeLearn:true,
        OnTest:LabRecipes_IsNearWorkbench,
        OnGiveXP:LabRecipes_GiveXP_Large,
        Tooltip:Tooltip_zReVC_Workbench,
    }

strange...

#

my recipe work fine but ok

bronze yoke
#

if you import the radio module you don't have to

raw tulip
#

oh.... well its fine right?

bronze yoke
#

yeah, i prefer not to import for one item anyway

tiny wolf
raw tulip
#

ah. yeah I think this current method is sufficient

#

thanks anyways

verbal yew
#

only spoon(author) use same item id with another module

#

in this engineer mod:

module Radio
{
    imports
        {
             Base,
        }
bla bla bla

    item ElectricWire
    {
        DisplayCategory = Electronics,
        Weight    =    0.1,
        Type    =    Normal,
        DisplayName    =    Electric Wire,
        Icon    =    Wire,
        ColorRed = 244,
        ColorGreen = 164,
        ColorBlue = 96,
        WorldStaticModel = ElectricWire,
    }
raw tulip
#

@verbal yew@bronze yoke@sour island thanks for your assistance everyone! that should be all for now. I'll release these soon

#

in the meantime, heres something interesting

nova socket
#

FYI: Weapons with condition set to over 150(?) will be broken down to 0 after player relogs/restarts the same game.

#

Anticheat shenanigans?

raw tulip
#

so im making a quick mod that allows people to switch the appearance of the sledgehammer

verbal yew
#

okay, yep, vanilla have radio module for ElectricWire, but I'm wondering why there are problems adding it to craft.
i have it without import radio in module in my recipe and it's work fine ^^'

sour island
dreamy birch
#

thats cute

raven zinc
raw tulip
#

@verbal yew@bronze yoke@sour islandthe mods are now available on the steam workshop (sort by Most Recent), thanks for your contribution!

mellow frigate
#

I wonder why it would'nt

maiden stump
#

do i code in visual studio?

verbal yew
#
local function CraftGeneratorRTFL(Name, Property, Value)
    local Item = ScriptManager.instance:getItem(Name)
    Item:DoParam(Property.." = "..Value)
end

    CraftGeneratorRTFL("Base.ElectronicsMag4","TeachedRecipes","Generator;Craft Generator")

drop it in lua/client

#

this will add to the magazine with teaching how to use generators the ability to craft them

#

but look at your opinion, I just suggested...

#

ou!
and

NeedToBeLearn:True,

in recipe

manic relic
#

question

#

how do I make zomboids wear my new clothing items?

raw tulip
#

I dont know anything about LUA or how to lock the recipe behind an existing book, so this is a huge help/good balance addition

raw tulip
#

craftable 2 wheel trailer (vehicle) SUSSYWHAT

#

2 wheels, suspension, a TON of metal sheets, a lot of propane/blowtorch and high mechanics and metalworking requirements

#

I don't know if it's even possible to spawn a vehicle without cheating

#

or how you would even construct this... thing? through the crafting menu??

#

the trailer is rare, but it's something that's really sought after. and if you're super unlucky, you won't find one

raven zinc
#

The Sims : Zomboid UI

sour island
#

Can anyone help me test something in MP for like 5 minutes?

verbal yew
#

somehow toxic... too contrasting or something...

#

look like windows xp

raven zinc
#

Well thats the aesthetic of the original Sims

verbal yew
#

The Sims 1?

raven zinc
#

Yup

verbal yew
#

Jesus...

raven zinc
#

I mean zomboid is just sims 1 with zombies after all, is it not?

verbal yew
#

As for me, this is a very ancient palette, very toxic and eye-catching...
Reminds me of 1990-2000, old ugly websites... brrrr

sour island
#

It's an omage lol

verbal yew
#

just imho

sour island
#

see @verbal yew

verbal yew
#

i react on them.
ESC menu look fine

raven zinc
verbal yew
#

Just with peripheral vision, all the panels cut into the eyes - this is what I don’t consider normal.
But this is just my opinion xD

bronze yoke
#

i'm fond of it

sour island
#

probably more of a nostolgia thing

#

streaming game night development - also would appreciate any testers

raven zinc
#

I mean sims 1 UI can be considered ugly, but I certainly see it as more nostalgic than anything

sour island
#

monopoly incoming

#

watch me struggle at pixel art

raven zinc
raven zinc
#

Love it!

#

90s to 2000's games knew what was up

verbal yew
sour island
#

pimp my ride?

verbal yew
#

we set game in your game when you play game
and another recursion

sour island
#

oh that meme

#

damn you're as old as I am

verbal yew
#

not know, i'm 28 years old

sour island
#

damn you're younger than me

sour island
#

Not by much whippersnapper

verbal yew
#

okey google, urbandictionary com

#

damn, I did something and the descriptions of the trits in the game disappeared...
although it is there when creating a character

sour island
#

pixel art hard

sour island
#

not** actually bad

#

my attempt looks like an ugg

verbal yew
#

hmm...

sour island
#

p happy with this

#

shape wise anyway, added the final shadows

median prairie
#

That is adorable hahahha

sour island
#

ty

#

Trying to use a VM for MP testing and its failing cause the VM doesnt have openGL 💀

verbal yew
#

guys

#

need your help

sour island
#

I'll trade you

#

help for help

verbal yew
#

i have old code:

function CrowbarWindow:doUnlock()
    if self.mode == MODE_VEHICLE_DOOR then    -- ДВЕРЬ МАШИНЫ
        self.lockpick_object:getDoor():setLocked(false);
        self.lockpick_object:getDoor():setLockBroken(true);
    end

i need that stuff:

local args = { vehicle = self.vehicleID, part = self.priableObjectID, locked = false, open = true }
            sendClientCommand(self.character, 'vehicle', 'setDoorLocked', args)
            sendClientCommand(self.character, 'vehicle', 'setDoorOpen', args)

but i can't understand where does the information come from and how to apply for them.
If i try use it, vehicleID derive nil

sour island
#

If you have self.lockpick_object:getDoor() maybe you can work your way back if this is a car part?

#

self.lockpick_object = car?

verbal yew
#

Now I'll try to figure out all the connections

#

one min

sour island
#

I can't get my VM to launch PZ

#

😦

#

I just need someone to move some game pieces to see if the syncing issue was fixed

verbal yew
#

first - addSlice - when trigger BetLock.UI.startLockpickingVehicleDoorCrowbar

function BetLock.UI.addOutsideOptions(playerObj)

    local endurance = playerObj:getStats():getEndurance() -- zRe
    --local strength = playerObj:getPerkLevel(Perks.Strength) -- zRe

    local menu = getPlayerRadialMenu(playerObj:getPlayerNum())
    if menu == nil then return end

    local vehicle = playerObj:getUseableVehicle()
    if vehicle == nil then return end

    local part = vehicle:getUseablePart(playerObj)
    if part and part:getDoor()then
    
        if part:getDoor():isLocked() then
            local playerSkill = playerObj:getPerkLevel(Perks.Lockpicking)
            if vehicle:getModData().LockpickLevel == nil then
                vehicle:getModData().LockpickLevel = BetLock.Utils.getLockpickingLevelVehicle(vehicle)
            end

            -- ОПЦИЯ ВЗЛОМА МОНТИРОВКОЙ
            local inv = playerObj:getInventory();
            local crowbar = inv:getFirstTagEvalRecurse("zReBLCrow", predicateNotBroken);
            if not crowbar then
                menu:addSlice(getText("ContextMenu_Require", getItemNameFromFullType("Base.Crowbar")), getTexture("media/textures/BetLock_lockpick_Crowbar_Icon.png"))
            elseif endurance <= 0.5 then
                menu:addSlice(getText("UI_enduranceRequireCar"), getTexture("media/textures/BetLock_lockpick_Crowbar_Icon.png"))
            --elseif strength <= 3 then
            --    menu:addSlice(getText("UI_strengthRequireCar"), getTexture("media/textures/BetLock_lockpick_Crowbar_Icon.png"))
            else
                local text = getText("UI_BetLock_LockpickDoorCrowBar") .. " \n(" .. getText(vehicle:getModData().LockpickLevel.name) .. ")" 
                menu:addSlice(text, getTexture("media/textures/BetLock_lockpick_Crowbar_Icon.png"), BetLock.UI.startLockpickingVehicleDoorCrowbar, playerObj, part)
            end
#

second - trigger CrowbarWindow.createVehicleDoor

function BetLock.UI.startLockpickingVehicleDoorCrowbar(playerObj, part)
    local vehicle = part:getVehicle()
    playerObj:facePosition(vehicle:getX(), vehicle:getY())
    local inv = playerObj:getInventory();
    local crowbar = inv:getFirstTagEvalRecurse("zReBLCrow", predicateNotBroken);
    
    if not playerObj:isItemInBothHands(crowbar) then
        ISInventoryPaneContextMenu.equipWeapon(crowbar, true, true, playerObj:getPlayerNum())
        return
    end

    ISTimedActionQueue.add(ISPathFindAction:pathToVehicleArea(playerObj, vehicle, part:getArea()))
    ISTimedActionQueue.add(EmptyAction:new(playerObj, CrowbarWindow.createVehicleDoor, nil, playerObj, part))
end 
sour island
#

local vehicle = playerObj:getUseableVehicle()

verbal yew
#

third - CrowbarWindow:createVehicleDoor where trigger self.mode == MODE_VEHICLE_DOOR

function CrowbarWindow:createVehicleDoor(playerObj, part)
    local modal = CrowbarWindow:new(Core:getInstance():getScreenWidth()/2 - WINDOW_WIDTH/2 + 300, Core:getInstance():getScreenHeight()/2 - 500/2, WINDOW_WIDTH, WINDOW_HEIGHT)
    modal.lockpick_object = part
    modal.mode = MODE_VEHICLE_DOOR
    modal.character = playerObj
    modal.diffLevel = part:getVehicle():getModData().LockpickLevel.num
    modal.addingXP = part:getVehicle():getModData().LockpickLevel.xp
    modal.isGarage = false

    modal:initialise()
    modal:addToUIManager()
end

four - result

function CrowbarWindow:doUnlock()
    if self.mode == MODE_VEHICLE_DOOR then    -- ДВЕРЬ МАШИНЫ
        self.lockpick_object:getDoor():setLocked(false);
        self.lockpick_object:getDoor():setOpen(true);
        self.lockpick_object:getDoor():setLockBroken(true);
verbal yew
#
local args = { local vehicle = playerObj:getUseableVehicle(), part = self.priableObjectID, locked = false, open = true }
            sendClientCommand(self.character, 'vehicle', 'setDoorLocked', args)
            sendClientCommand(self.character, 'vehicle', 'setDoorOpen', args)

?

#

how about part?

#

part = vehicle:getUseablePart(playerObj)?

sour island
#

You're trying to get the vehicle id from in the crowbar code?

#

Or you're trying to update the vehicle in the server?

verbal yew
#

second

sour island
#

did you try transmitting the part?

#

assuming the part/door is what determines if it's locked or not

#

vehicle:transmitPartItem(VehiclePart)

#

vehicle:transmitPartModData(VehiclePart)

verbal yew
# sour island did you try transmitting the part?

nope...
I found fix solution in Common Sense

local args = { vehicle = self.vehicleID, part = self.priableObjectID, locked = false, open = true }
            sendClientCommand(self.character, 'vehicle', 'setDoorLocked', args)
            sendClientCommand(self.character, 'vehicle', 'setDoorOpen', args)

but not know how to adaptive it in Better Lockpicking, because in Better Lockpicking it has:

function CrowbarWindow:doUnlock()
    if self.mode == MODE_VEHICLE_DOOR then    -- ДВЕРЬ МАШИНЫ
        self.lockpick_object:getDoor():setLocked(false);
        self.lockpick_object:getDoor():setLockBroken(true);
    end

but it's not sync for other player

sour island
#
    local args = { vehicle = self.vehicle:getId(), part = self.part:getId(), locked = false }
    sendClientCommand(self.character, 'vehicle', 'setDoorLocked', args)
#

not sure if there's one for breaking

verbal yew
sour island
#

there's a file for the commands, but i forget what its called

#

what's the error?

verbal yew
sour island
#

that means self.vehicle isn't a thing

#

What is lockpick_object ?

#

is says getDoor() - is the lockpick object the vehcile part for the door - and it's getting the door object?

sour island
#

if the lock_object is the part you can use getVehicle() on it

verbal yew
#

modal.lockpick_object = part

sour island
#

vehicle = lockpick_object:getVehicle():getId()

verbal yew
#

part = ?

sour island
#

part is the item

#

while it is called a door, it has a door object attached to it

verbal yew
#
local args = { vehicle = lockpick_object:getVehicle():getId(), part = self.part:getId(), locked = false }
    sendClientCommand(self.character, 'vehicle', 'setDoorLocked', args)

?

sour island
#

uh

verbal yew
sour island
#

if there is a self.part

#

other wise i'd use lockpick_object

#

lockpick_object:getId()

#

I'm not sure if there's a command to break the lock

#

I know there's a file housing the command stuff but it's not registered in CAPSID

#

and I forget the name of the file

#

found it

#

VehicleCommands.lua

#

housed in /server/

#

this is basically a vanilla clientcommand afterall, so you can write your own

#

so you're not sending 2 commands for both things

#
function Commands.setDoorLocked(player, args)
    local vehicle = getVehicleById(args.vehicle)
    if vehicle then
        local part = vehicle:getPartById(args.part)
        if not part then
            noise('no such part '..tostring(args.part))
            return
        end
        if not part:getDoor() then
            noise('part ' .. args.part .. ' has no door')
            return
        end
        if not part:getDoor():isLockBroken() then
            part:getDoor():setLocked(args.locked)
        end
        --vehicle:toggleLockedDoor(part, player, args.locked)
        vehicle:transmitPartDoor(part)
    else
        noise('no such vehicle id='..tostring(args.vehicle))
    end
end
#

unfortunately these are local

#

so you'll have to write it differently to be a command

#

sucks that it's local - would have been nice to insert custom ones

sour island
# verbal yew https://tenor.com/view/sad-cat-lonely-upset-crying-gif-12536795
---THIS IS CALLED IN CLIENT
sendClientCommand(self.character, 'crowbar', 'vehicleDoor', { vehicle=lockpick_object:getVehicle():getId(), part=lockpick_object:getId() })

---THIS GOES IN /SERVER/
local function crowbarCommands(module, command, player, args)

    if module == "crowbar" and command == "vehicleDoor" then
        local vehicle = getVehicleById(args.vehicle)
        if not vehicle then return end

        local part = vehicle:getPartById(args.part)
        if not part then return end

        if not part:getDoor() then return end

        part:getDoor():setLocked(false)
        part:getDoor():setLockBroken(true)

        vehicle:transmitPartDoor(part)
    end
end
Events.OnClientCommand.Add(crowbarCommands)
#

not tested

#

the clientCommands you were trying to use is just a vanilla version

#

but you should be able to use these just fine

#

there isn't one that breaks the lock like you want

#

hence this

verbal yew
#

God...
I'm just ready to cut out the mini-game with a crowbar and take the working function, only instead of the chance to predetermine the time for lockpicking and wasting stamina...

sour island
#

Does this command not work?

verbal yew
#

nope.

sour island
#

error?

verbal yew
#

Most likely I'm doing something wrong...
maybe I don't use reqire in head of local function...

sour island
#

this shouldn't need a require

#

unless you mean for the other mod?

#

is this like a patch/expansion?

verbal yew
#

nope. this in one mod

sour island
#

which?

verbal yew
#

better lockpicking

sour island
#

what's that line exactly?

#

sendClientCommand(self.character, 'crowbar', 'vehicleDoor', { vehicle=lockpick_object:getVehicle():getId(), part=lockpick_object:getId() })?

#

that would imply lockpick_object = nil

verbal yew
sour island
#

do you use github?

verbal yew
sour island
verbal yew
sour island
#

Where is CrowbarWindow:createVehicleDoor(playerObj, part) called?

#

seems like you're setting the part wrong

verbal yew
#

ISTimedActionQueue.add(EmptyAction:new(playerObj, CrowbarWindow.createVehicleDoor, nil, playerObj, part))

sour island
#

yeah looking

#

if part is nil at the end there's something wrong with how the argument is being passed

verbal yew
#
require "TimedActions/ISBaseTimedAction"

EmptyAction = ISBaseTimedAction:derive("EmptyAction")

function EmptyAction:isValid()
    return true
end

function EmptyAction:update()
end

function EmptyAction:start()
end

function EmptyAction:stop()
    ISBaseTimedAction.stop(self)
end

function EmptyAction:perform()
    self.func(self.arg1, self.arg2, self.arg3, self.arg4)
    ISBaseTimedAction.perform(self)
end

function EmptyAction:new(character, func, arg1, arg2, arg3, arg4)
    local o = {}
    setmetatable(o, self)
    self.__index = self
    o.character = character
    o.maxTime = 1
    
    o.func = func
    o.arg1 = arg1
    o.arg2 = arg2
    o.arg3 = arg3
    o.arg4 = arg4
    
    return o
end
#

but it's use in most part, for windows and door like thumb or isoObject

sour island
#

the first arguement is null for self?

#

ISTimedActionQueue.add(EmptyAction:new(playerObj, CrowbarWindow.createVehicleDoor, nil, playerObj, part))

verbal yew
#

character - playerObj
Func - CrowbarWindow
Arg1 - nil

#

or...

#

nah, idk

sour island
# verbal yew

in here can you print the arguments before the command is called

#

and check the log

#

specifically print(lockpick_object)

#

may have to put tostring() around it

#

making CrowbarWindow:createVehicleDoor( use . instead and ditching the nil argument won't impact anything as well

sour island
#

so it's nil?

#

try the . on create and dropping the nil argument

verbal yew
#

looks like

#

ISTimedActionQueue.add(EmptyAction:new(playerObj, CrowbarWindow.createVehicleDoor, ., playerObj, part)) ?

sour island
#

., ?

verbal yew
#

I didn't understand what to try ^^'

sour island
#

ISTimedActionQueue.add(EmptyAction:new(playerObj, CrowbarWindow.createVehicleDoor, playerObj, part)

#

If this doesnt help, just put prints for part in all the steps

#

see where it goes wrong/gets lost

#

you're like 90% there

verbal yew
#
STACK TRACE
-----------------------------------------
function: createVehicleDoor -- file: CrowbarWindow.lua line # 204 | MOD: zRe Better Lockpicking BETA
function: perform -- file: EmptyAction.lua line # 20 | MOD: zRe Better Lockpicking BETA.
[26-09-23 09:30:56.002] ERROR: General     , 1695702656002> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getVehicle of non-table: null at KahluaThread.tableget line:1689..
[26-09-23 09:30:56.002] ERROR: General     , 1695702656002> DebugLogStream.printException> Stack trace:.
[26-09-23 09:30:56.005] LOG  : General     , 1695702656005> -----------------------------------------
STACK TRACE
-----------------------------------------
function: createVehicleDoor -- file: CrowbarWindow.lua line # 204 | MOD: zRe Better Lockpicking BETA
function: perform -- file: EmptyAction.lua line # 20 | MOD: zRe Better Lockpicking BETA.
[26-09-23 09:30:56.005] LOG  : General     , 1695702656005> .
[26-09-23 09:30:56.005] LOG  : General     , 1695702656005> [zReBetterLockpickingBETA]     creating new sourcewindow: C:/Users/kERHUS/Zomboid/Workshop/zRe BetterLockpicking BETA/Contents/mods/zRe BetterLockpicking BETA/media/lua/server/Lockpicking/Crowbar/CrowbarWindow.lua.
[26-09-23 09:31:10.920] LOG  : General     , 1695702670920> bugged action, cleared queue     EmptyAction.

without nil

#

usssssssssssaaaaaaaaaaaaaaaaaaaaa

#

nah

#

i just drop it

#

not my level

#

thanks for help

sour island
#

attempted index: getVehicle of non-table: null

#

it's the same error

#

so the issue wasn't how it's being called

#

part is nil to begin with

#

try putting a print in BetLock.UI.startLockpickingVehicleDoorCrowbar( for it's part

#

it will most likely be nil

verbal yew
#

no, I’m done, I’m going to go to bed, I’ve been poking around with this bullshit all night...

sour island
#

👍

#

if it's available somewhere I can take a look

verbal yew
#

I can send files

Unfortunately, I don't live on GitHub...

sour island
#

nothing that can't wait

verbal yew
#

Okay, thanks again, goodbye

prisma gale
#

Hello, I cant seem to get a custom name working, any idea where iv gone wrong

verbal yew
sour island
#

oh... it should have been self.lockpick_object

#

I forgot to type out self.

prisma gale
sour island
pale eagle
#

@sour island Hello when can we expect the poker mods ? (Don't want to hurry you, I just want to settle an argument on my server with a good old fashioned poker stand off)

drifting ore
#

Cannot invoke "zombie.inventory.types.HandWeapon.getType()" because "<parameter1>" is null Can someone translate this for me to something coherent?

lone shard
#

anyone else have a problem downloading Basements?

sour island
#

Trying to setup a VM didn't work, so I scrounged up an old laptop - currently installing pz

#

There's a lingering issue of multiple interactions with pieces causing desync

pale eagle
#

Thx hope you will find a way to do magic with the code sir

sour island
pale eagle
#

Thx I should take a look tonight

muted garnet
#

Is there any way to change the color of the created context menu?

tiny wolf
#

**Hello guys,
Want to add a new container type into an existing vanilla container to transform this :
**
militarycrate = {
procedural = true,
procList = {
{name="ArmyStorageElectronics", min=0, max=9999, weightChance=50},
{name="ArmyStorageGuns", min=0, max=1, weightChance=100},
{name="ArmyStorageMedical", min=0, max=9999, weightChance=50},
{name="ArmyStorageOutfit", min=0, max=2, weightChance=50},
{name="ArmyStorageAmmunition", min=0, max=3, weightChance=50},

Into this :

militarycrate = {
procedural = true,
procList = {
{name="ArmyStorageElectronics", min=0, max=9999, weightChance=50},
{name="ArmyStorageGuns", min=0, max=1, weightChance=100},
{name="ArmyStorageMedical", min=0, max=9999, weightChance=50},
{name="ArmyStorageOutfit", min=0, max=2, weightChance=50},
** {name="ArmyStoragePistols", min=0, max=2, weightChance=50},**
{name="ArmyStorageAmmunition", min=0, max=3, weightChance=50},

Please anybody knows how to add this into the Vanilla table with an external file into the mod ?

fast galleon
# tiny wolf **Hello guys, Want to add a __new container type__ into an __existing vanilla co...
GitHub

ImmersiveSolarArrays for Project Zomboid. Contribute to radx5Blue/ImmersiveSolarArrays development by creating an account on GitHub.

tiny wolf
#

I'll give it a try

distant ivy
#

Hello i need a little help with evolved recepies
i create a custom item CannedSauce
i have a recepie that open the cannedsauce to cannedsauceopen
the cannedsauceopen have some evolved recepies with pasta (for example), in game when i mix the cannedsauceopen with pasta i get "Open can Sauce pasta" instead of "sauce pasta"
this is the item

item CannedSauceOpen
{
DisplayName = Open can Sauce,
DisplayCategory = Food,
Type = Food,
Weight = 0.4,
Icon = CannedBologneseOpen,
CannedFood = TRUE,
EatType = can,
EvolvedRecipe = Pizza:12;Burger:12;Omelette:8;Stew:12;Stir fry Griddle Pan:12;Stir fry:12;Sandwich:8;Sandwich Baguette:8;Salad:12;Roasted Vegetables:12;PastaPot:12;PastaPan:12;RicePot:12;RicePan:12,
/EvolvedRecipeName = sauce,/
FoodType = Meat,
Packaged = TRUE,
ReplaceOnUse = TinCanEmpty,
DaysFresh = 3,
DaysTotallyRotten = 5,
HungerChange = -24,
Calories = 400,
Carbohydrates = 31,
Lipids = 9,
Proteins = 16,
StaticModel = CanOpen,
WorldStaticModel = CanOpenBolognese,
Tags = HasMetal,
}

tardy wren
#

The very thing you have commented out

distant ivy
verbal yew
#
local function zReAdjustItem(Name, Property, Value)
    local Item = ScriptManager.instance:getItem(Name)
    Item:DoParam(Property.." = "..Value)
 end

zReAdjustItem("AuthenticZLite.BunnyEars", "CanHaveHoles", "false");

If the mod is not connected, then an error appears referring to this line with the item.
Is there any way to improve the code so that if there is no item, it simply skips it?

#

but not like

if getActivatedMods():contains("AuthenticZLite") then
zReAdjustItem("AuthenticZLite.BunnyEars", "CanHaveHoles", "false");
end
tardy wren
#

Or check if Item then

verbal yew
#

I didn't understand, a little

#

can u write example?

#

pcall(zReAdjustItem("AuthenticZLite.BunnyEars", "CanHaveHoles", "false"));?

verbal yew
verbal yew
#
local function zReAdjustItem(Name, Property, Value)
    local Item = ScriptManager.instance:getItem(Name)
if Item then
    Item:DoParam(Property.." = "..Value)
end
 end
#

?

tardy wren
#

Yes

#

If there is no item of that name, the getItem returns nil

#

And nil inside an If evaluates to false

#

So it's a simple null-check

#

Probably the faster option tbh

verbal yew
#

thanks :3

tiny wolf
#

Do you know if there is a way to force the player to use an object in Perfect condition into a recipe ? To do not let him use used objects ?

verbal yew
#

in recipe:
OnTest:MyModFuncName,
in lua folder on server side:

function MyModFuncName(sourceItem, result)
  if sourceItem:hasTag("zReRepairableVest") then -- OR ANOTHER METHOD TO CALL YOUR ITEM
    if sourceItem:getCondition() < sourceItem:getConditionMax() then
      return false
    end
  end
  return true
end
tiny wolf
verbal yew
#

for string with reqire

tiny wolf
#

have you got an example ?

verbal yew
#

add it in recipe:
Tooltip:Tooltip_zReRAC_MustHaveHole,

translate file EN:

Tooltip_EN = {
    Tooltip_zReRAC_MustHaveHole = "Vest Armor must be damaged!<br>Take it off before repairing!<br> ",
}

for example

tiny wolf
#

Oh yes ok, to see it into the game 😉

verbal yew
#

look like

verbal yew
#

Tooltip_EN

tiny wolf
#

ok 👍 thank you

verbal yew
verbal yew
#

now, I'm thinking....

#

it's work?

#

I just woke up, and for some reason now it seems to me that I missed something...

#

My recipe simply has three functions built in...

  keep [Recipe.GetItemTypes.zReRAC_Is_Armor],  -- add item into recipe
  OnCreate:zReRAC_Repair_Armor,                -- func for result
  OnTest:zReRAC_Can_Repair_Armor,              -- check item condition

And now I'm trying to figure out whether there were links to others or not...

#

looks like not ^^'

tiny wolf
#

i gonna try

#

Tooltip Works

#

but my perfect item does'nt work into the recipe

#

but i commented your hasTag line to skip this condition

#

is it important ?

verbal yew
tiny wolf
#

i'm adding

tiny wolf
#

condition is not true

verbal yew
tiny wolf
#
    recipe Vendre Pistolet Glock 18C
    {   destroy Base.EFK_G18C,
        keep TancredTrader,

        Result:    Money=168,
        CanBeDoneFromFloor:true,
        Category:Money,
        Time:0,
        OnTest:Change_All_For_Money_OnTest,
        OnTest:ItemGoodCondition,
        Tooltip:Tooltip_EFK_ConditionReparation,        
    }
verbal yew
#

ah... 2 onTest

#

if i'm not wrong work only one

tiny wolf
verbal yew
#

what do your OnTest:Change_All_For_Money_OnTest?

tiny wolf
#

i can do without

#

so i gonna try without it 😉

verbal yew
#

u can do stuff for items with another condition (bad or good) but it get u another money count - depending on condition item (in one recipe) ^^'

tiny wolf
#
    recipe Vendre Pistolet Glock 18C
    {   destroy Base.EFK_G18C,
        keep TancredTrader,

        Result:    Money=168,
        CanBeDoneFromFloor:true,
        Category:Money,
        Time:0,
        OnTest:ItemGoodCondition,
        Tooltip:Tooltip_EFK_ConditionReparation,        
    }
#

it doesn't work too

#
function MyModFuncName(sourceItem, result)
    if sourceItem:hasTag("EFK_Selling") then -- OR ANOTHER METHOD TO CALL YOUR ITEM
      if sourceItem:getCondition() < sourceItem:getConditionMax() then
        return false
      end
    end
    return true
  end
#

ItemGoodCondition.lua into the server folder

#
    item    EFK_G18C    {    
                
    DisplayName                     =    Glock 18C Pistol    ,
    Icon                            =    G18,    
    WeaponSprite                    =    G18,    
    Type                            =    Weapon,    
    SubCategory                     =    Firearm,    
    Ranged                          =    TRUE,    
    IsAimedFirearm                  =    TRUE,    
    WeaponReloadType                =    handgun,    
    FireMode                        =    Auto,    
    FireModePossibilities           =    Auto/Single,    
    AttachmentType                  =    Holster,
    Tags = EFK_Selling,    
#

The Item have got the Tag EFK_Selling

verbal yew
#

hmm

#

OnTest:ItemGoodCondition,

but function MyModFuncName

#

OnTest should contain name of function

#

if OnTest:ItemGoodCondition, then function ItemGoodCondition(sourceItem, result)

tiny wolf
#

what a beginner mistake !

#

sorry i'm a little tired

#

i restart my tries 😉

verbal yew
#

don’t worry, Im far from ideal of coding and I know what it is xD

tiny wolf
tiny wolf
#

Thanks again mate 😉 🎉

verbal yew
#

nice

verbal yew
#

tip 2:
Ou! And file name ^^'

#

ItemGoodCondition just look like perhaps something that occurs frequently ^^'

#

most likely not, but the name is too non-individual

#

may be need do func local (like local function MyModFuncName(sourceItem, result), for reduce another thing, but i'm not sure can local func be called from another places, need ask veteran's of codding

tiny wolf
#

Yeah i'll add my mod name near to it 😉 thanks for this advices 🙂

verbal yew
#

Why u wont want sell any item on condition side?

#

it's possible do for get another count of money, condition dependent

tiny wolf
#

first answer : to be honnest i don't know how to do 🤣

verbal yew
#

u want?

#

i can help

tiny wolf
#

second one : i'm putting the Escape From Tarkov gameplay into the Project Zomboid game

verbal yew
#

not playing...

tiny wolf
#

Into Tarkov, people stop to buy the item after a condition

#

so into PZ, because player can repair weapon, it invite player to think when he loots or to repair to sell 😉

#

and i think it's harder and more interesting

#

final answer : all my project is based on the classic recipe system

#

i was looking for a good mod to manage buy/sell in solo i didn't find anything

#

and because next build will reset the classic recipe system, i don't look too much on little details for the moment about recipes 😉

#

just trying to make something working good with a lot of features

#

and will try to do better into every feature after 🙂

verbal yew
tiny wolf
#

but you question is really good 🙂 in perfect case i hope to let player sell an item 100 - 60 % with a decreased price

#

and under 60%, don't accept the item 😉

#

I'm more blue than Blood Angels 😉

verbal yew
tiny wolf
verbal yew
#

Who work with UI?

#

how to lock render with 60 FPS?

drifting ore
#

been forever but slowly getting back into it. you can force it. can probably do more with java side also
mainoptions.lua

getCore():getOptionUIRenderFPS()
getCore():setOptionUIRenderFPS()
verbal yew
#

not option in setting

#

just like info?

#

i want try to use it

#

Current problem - Better Lockpicking has render UI with lockpicking and if your FPS high (more than 100 with UIFBO false) - this do more problem for lockpicking, arrow move very fast or bobbypin breaking so fast

#

Empirically, the following was identified:

if (getCore():getOptionUIFBO() == true) then
    arrowSpeed = 3    -- separate interface processing ON (30 fps) (Best for 30 fps)
    else
    arrowSpeed = 1.5 -- separate interface processing OFF (vsync 60 fps) (Best for 60 fps)
    -- But if FPS unlock some people has 400+ FPS and it's very big speed...
end
bronze yoke
#

you should use delta time rather than relying on the fps cap, otherwise slowdown/speedup are unavoidable

verbal yew
#
local arrowTex = getTexture("media/textures/BetLock_arrow.png") --
local arrow_scale_step = 0

local arrowSpeed = 0
if (getCore():getOptionUIFBO() == true) then
    arrowSpeed = 3    -- separate interface processing ON (30 fps)
    else
    arrowSpeed = 1.5 -- separate interface processing OF (vsync 60 fps)
    -- But if FPS unlock some people has 400+ FPS and it's very big speed...
end
--local zReBLfps = self:getFPS()

local arrow_dx = arrowSpeed
local arrow_step_to_x = (WINDOW_WIDTH - xShift*2)/100

local crowbarTimer = 0
local progressBarVal = 0

local lastRenderMillis = nil
#
function CrowbarWindow:render()
    self:drawText(getText("UI_Controls_Crowbar"), self.width/2 - (getTextManager():MeasureStringX(UIFont.Small, getText("UI_Controls_Crowbar")) / 2), 10, 1,1,1,1, UIFont.Small);

    self:drawProgressBar(xShift, yShift, WINDOW_WIDTH - xShift*2, 20, progressBarVal, {r=0, g=0.6, b=0, a=0.8 })
    self:drawRectBorder(xShift, yShift, WINDOW_WIDTH - xShift*2, 20, 1, 0.4, 0.4, 0.4)

    self:drawTexture(arrowTex, xShift - arrowTex:getWidth()/2 + arrow_scale_step*arrow_step_to_x, 75+30, 1, 1, 1, 1)
    
    local currentMillis = math.floor(getTimeInMillis())
    local isNewTimeStep = false
    if lastRenderMillis ~= currentMillis then
        lastRenderMillis = currentMillis
        isNewTimeStep = true
    end


    if crowbarTimer > 0 then return end
    
    local endurance = self.character:getStats():getEndurance()
    --- zRe anti-abuze system
    if endurance <= 0.5 then
        self:close()            --CrowbarWindow.instance:close()
        return
    end---
    
    if isNewTimeStep then
        arrow_scale_step = arrow_scale_step + arrow_dx
        if arrow_scale_step >= 100 then
            arrow_scale_step = 100
            arrow_dx = -arrowSpeed
        elseif arrow_scale_step <= 0 then
            arrow_scale_step = 0
            arrow_dx = arrowSpeed
        end
    end
end
kindred meadow
#

i just made a weapon model in blender. how do i change where on the item my character holds?

bronze yoke
#

this way it will behave the same at any fps

verbal yew
#

Can you be more specific for complete dummies? ^^'

bronze yoke
#

wherever you move something, multiply the amount of movement by that

#

e.g. it looks like in this code it should be used as ```lua
arrow_scale_step = arrow_scale_step + arrow_dx * UIManager.getMillisSinceLastRender()

#

if i'm understanding how this code works

verbal yew
#

im try it now, thanks

#

holy sh...

#

okay. has big effect

#

trying put it something else, but your help so great, thanks a lot

#
    --local currentMillis = math.floor(getTimeInMillis())
    local currentMillis = UIManager.getMillisSinceLastRender() -- zReBL
#

perfect

verbal yew
random finch
#

Adding zombie loot

require "Items/SuburbsDistributions"

table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Base.Money")
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 100.00)

table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Base.Money")
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 100.00)

How do I set an item amount and add extra rolls? Also, will this override vanilla or modded item distributions in this table doing it this way?

My thought is to merge a new table into the existing table to avoid conflicts, but my thought process may be wrong.

bronze yoke
#

this won't override anything

#

the item amount is defined in the item script, and the number of rolls is specific to the container type

#

that is, it's not a per item thing, the entire container is rolled however many times it's set to

random finch
#

Hrmm, I would have to create new item entries to set the amount? Not something like this?
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Base.Money:5")

bronze yoke
#

no, i don't think there's any trick like that

random finch
#

Hrmm, is it different for zombie loot? Maybe something like this will work.
#mod_development message

table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, { name = "Base.Money", min = 1, max = 99, weightChance=50});
bronze yoke
#

that's for adding a loot table, not an item

#

i don't think zombie loot even supports multiple loot tables but if it did i don't think it'd be all that helpful anyway

north arrow
#

does anyone know if chanceOfAttachedWeapon works like degrade chance?

So it would be "1 out of X" X being the value its set to?

#

Or am I mistaken?

#

I'm lost here

livid ingot
#

real quick, is there a way to select the radio.xml file and making changes programmatically

verbal yew
#

god damn, i fix camera lock position for cars...

#

8 month of trying...

urban wind
#

howdy all

#

Anyone know if it's possible to use the new tags for scripting a recipe? I'm trying to create a recipe where it uses one unit of any source of gasoline as part of the recipe

hollow current
blazing vine
#

Check your export settings on the guide

nova vortex
#

Hi so

#

I have an idea for a death music replacer

#

Anyone willing to give me a crash course on how to make?

nova vortex
#

at the very least where the hell does Workshop put the mods because I'm trying to learn this

hollow current
hollow current
#

Should get you started on most of stuff

nova vortex
#

dont see anything on music replacement there

#

at least not immediately

drifting ore
#

rephrasing myself: is it possible to get the current online players coordinates?

neon bronze
#

getPlayer():getX()
getPlayer():getY()

drifting ore
#

no sorry, this code runs on the client, i want to get the X and Y coordinates of the current online players (all of them)

verbal yew
#

guys, what do function Myfunc:perform() in ISBaseTimedAction?

#

and what is the difference between perform and stop

jolly goblet
#

Does anyone have a step-by-step tutorial on how to create my custom tiles and be able to use them?

faint jewel
remote sonnet
#

Which event triggers when you update the sandbox settings?

fast galleon
fast galleon
remote sonnet
fast galleon
#

it processes the packet and applies to java and lua I guess. Saving is probably done on shutdown.

remote sonnet
#
local function CFIEnable()
    if SandboxVars.CustomizableFakeInfection.Enable == true then
        Events.OnPlayerUpdate.Add(UpdateFakeInfection)
        Events.EveryOneMinute.Add(CustomizableFakeInfection)
    end
end

Events."???".Add(CFIEnable)

I got that setting in the sandbox options that either enables or disables the script and I'm not quite sure on which event It should update

#

Or if it even needs an event. 😄

fast galleon
#

yeah, OnInitGlobalModData is good for this.

random finch
fast galleon
#

yeah, most action don't do nothing unless it's finished

remote sonnet
# fast galleon yeah, `OnInitGlobalModData` is good for this.
local function UpdateFakeInfection(player)
    if SandboxVars.CustomizableFakeInfection.Enable == true then
        local bodydmg = player:getBodyDamage();
                etc ...
                etc ...

So that modinit didn't work for me, I probably ducked it up. I just added the SandboxVar in question to the actual functions and it seems to work. 🤷

If it's set to false it'll just skip the function entirely.

fast galleon
#

not sure what you mean, this event triggers during loading. Before this event, the options will not be loaded from the save most times, unless you create a character. You need to quit to menu after you change the options.

remote sonnet
#

Uhh... so I got these functions

local function UpdateFakeInfection(player)
 -- Does Something
end
local function CustomizableFakeInfection()
 -- Does Something
end

Events.OnPlayerUpdate.Add(UpdateFakeInfection)
Events.EveryOneMinute.Add(CustomizableFakeInfection)

Each of these functions now check for the SandboxVars.CustomizableFakeInfection.Enable == true and if it isn't true it'll just end the function.

local function UpdateFakeInfection(player)
    if SandboxVars.CustomizableFakeInfection.Enable == true then
         -- Does Something
    end
end
local function CustomizableFakeInfection()
    if SandboxVars.CustomizableFakeInfection.Enable == true then
         -- Does Something
    end
end

Events.OnPlayerUpdate.Add(UpdateFakeInfection)
Events.EveryOneMinute.Add(CustomizableFakeInfection)
#

The whole thing is a huge Rube Goldberg machine 😂

If nested in If nested in for loop nested in ifs* ...

kindred meadow
#

can anyone explain what "OnCreate:BSItem_OnCreate" means

#

the wiki doesn't do a very good job

fast galleon
#

fyi, overlays don't change alpha in 41.78. The object sprite is barely visible but the overlay sprites are bright in darkness.
* this happens when you add overlay colour.

v.42 probably not an issue

#overlaySprite

mellow frigate
fast galleon
#

At that point I'd rather add more sprites pre-coloured to the game.

hollow current
#
local playersList = getOnlinePlayers();
for i=1,playersList:size() do
  local player = playersList:get(i-1)
  local x = player:getX()
  local y = player:getY()
end```
bronze yoke
#

keep in mind if you want this to reliably get *every* player it needs to be done on the server side

random finch
#

Why does the Crack not show up in LootZed?
ZedDistro.lua

require 'Items/SuburbsDistributions'

table.insert(SuburbsDistributions.all["Outfit_Police"].items, "Base.PA_Crack")
table.insert(SuburbsDistributions.all["Outfit_Police"].items, 100.00)
verbal yew
#

where contain button for "Trunk is unlocked"?

random finch
#

The light itself is the button.

verbal yew
#

wooooow

#

bad things

#

if u have state for TrunkDoor like LockBroken

#

vanilla hole...

#

for vanilla function override i should create lua file in same folder with another file name but same func name?

drifting ore
verbal yew
#

Yeah, fixed

#

Chuck Chuck Chuck

#

ehhhh...

sour island
#

?

#

I was going to ask about that

#

lock being broken usually means it can't be opened doesn't it?

#

that's how the building windows work (don't they?)

verbal yew
#

we do it for Crowbar lockpicking

sour island
#

ah

verbal yew
#

crowbar break lock => but u can use lock func for trunk fine and it's do state to lock

#

for another door work fine

verbal yew
#

min

sour island
#

that looks right?

verbal yew
#

i mean, where i should put that?

#

and should it be derive or require in headline?

sour island
#

I tend to go with whatever vanilla does for UI

#

so requiring the file is fine

verbal yew
#

i should do req, yep?

sour island
#

yeah

#

you can have multiple requires

#

just require the UI file if you're going to call that close

verbal yew
#

how about folder?
CrowbarActionAnim.lua in client/lockpicking/Actions folder
CrowbarWindow.lua in client/lockpicking/Crowbar folder

#

require "lockpicking/crowbar/CrowbarWindow"?

#

and where need put this:

local win = CrowbarWindow.instance
        win:setVisible(false);            -- zRe Force Close FIX
        win:removeFromUIManager();        -- zRe Force Close FIX
        win:close()                -- zRe Force Close FIX```
#

i try put it in :Stop

#

mhmhm...

#

it's in perform

sour island
#

I think perform = complete

#

so that's the right place

verbal yew
sour island
#

is there a complete?

verbal yew
#

win:setVisible(false); -- zRe Force Close FIX
win:removeFromUIManager();
this param not work on preform

sour island
#

error?

verbal yew
#

but work on stop

verbal yew
verbal yew
sour island
#

paste it

verbal yew
#

min

sour island
#

the error lol

#

click the clipboard icon

verbal yew
#

yep, i know

#

get crash

sour island
#

ouch

verbal yew
#

when i open Error Magnifier frame

#

generate it's

#

nah, can't copy xD

#
[28-09-23 08:23:49.006] DEBUG: Vehicle     , 1695871429005> BaseVehicle.update                  > Vehicle vid=252 velocity last=( 1,792E-2  1,863E-1  1,202E-3)/0,187192 current=(-5,152E-3  1,758E-1 -3,460E-4)/0,175903 delta=0,023127.
[28-09-23 08:24:07.845] ERROR: General     , 1695871447845> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Stack overflow at Coroutine.ensureCallFrameStackSize line:96..
[28-09-23 08:24:07.846] ERROR: General     , 1695871447846> DebugLogStream.printException> Stack trace:.
[28-09-23 08:24:08.058] LOG  : General     , 1695871448058> -----------------------------------------
STACK TRACE
-----------------------------------------
function: clear -- file: ISTimedActionQueue.lua line # 158 | Vanilla
function: close -- file: CrowbarWindow.lua line # 168 | MOD: zRe Better Lockpicking
function: stop -- file: CrowbarActionAnim.lua line # 61 | MOD: zRe Better Lockpicking
Callframe at: StopAllActionQueue
function: clear -- file: ISTimedActionQueue.lua line # 158 | Vanilla
function: close -- file: CrowbarWindow.lua line # 168 | MOD: zRe Better Lockpicking
function: stop -- file: CrowbarActionAnim.lua line # 61 | MOD: zRe Better Lockpicking
Callframe at: StopAllActionQueue
#

hmmm CrowbarWindow.lua

function CrowbarWindow:close()
    self.lockpick_object:getModData()["BetLock_crowbarProgressBar"] = progressBarVal

    getCore():addKeyBinding("Left", self.character:getModData()["Lockpick_Left"])
    self.character:getModData()["Lockpick_Left"] = nil
    getCore():addKeyBinding("Right", self.character:getModData()["Lockpick_Right"])
    self.character:getModData()["Lockpick_Right"] = nil
    getCore():addKeyBinding("Forward", self.character:getModData()["Lockpick_Forward"])
    self.character:getModData()["Lockpick_Forward"] = nil
    getCore():addKeyBinding("Backward", self.character:getModData()["Lockpick_Backward"])
    self.character:getModData()["Lockpick_Backward"] = nil
    getCore():addKeyBinding("Melee", self.character:getModData()["Lockpick_Melee"])
    self.character:getModData()["Lockpick_Melee"] = nil
    
    ISTimedActionQueue.clear(self.character) -- <---- THIS IS 168 line 

    CrowbarWindow.instance = nil
    ISPanel.close(self)
end
#

CrowbarActionAnim.lua

function CrowbarActionAnim:stop()
    if self.sound and self.sound:isPlaying() then
        getSoundManager():StopSound(self.sound)
    end
    
    local win = CrowbarWindow.instance
        win:setVisible(false);
        win:removeFromUIManager();
        win:close();                     -- < --- THIS IS 61 line

    ISBaseTimedAction.stop(self)
end
sour island
#

put it above remove

#

CrowbarWindow.instance = nil

#

wait

verbal yew
#

hmm, may be just copy function CrowbarWindow:close() without ISTimedActionQueue.clear(self.character)

#

like :close2()

sour island
#
function gameNightWindow:closeAndRemove()
    self:setVisible(false)
    self.elements = {}
    self:clearMovingPiece()
    self:removeFromUIManager()
    if gameNightWindow.instance == self then gameNightWindow.instance = nil end
end
#

I usually write my own close which includes remove

verbal yew
#

i think ISTimedActionQueue.clear(self.character) in function CrowbarWindow:close() just workaround, when u complete minigame

function CrowbarActionAnim:new(character, isGarage, lockpick_object)
    local o = {}
    local zReBLLO = self.lockpick_object
    setmetatable(o, self)
    self.__index = self
    o.character = character
    o.lockpick_object = lockpick_object
    o.maxTime = 50000
    o.isGarage = isGarage
    
    return o
end
#

action time 50000

#

hhmhmhmh

#

brain assault

#

okey,may be i'm understood, I'll try some stuff

sour island
#

If you need the action to continue while the game goes on you can just make the action looped

verbal yew
#

this is action looped when minigame goes

#

it's work fine

sour island
#

Are you using a timed action to make the player animate?

verbal yew
#

but when u atacked by zombies - it's turn off control

#

like this

#

u can't move by SWDA, because minigame change control mode

#

only with mouse

#

your animation stop

#

but UI not close

sour island
#

you can use update() in the UI

#
function gameNightWindow:update()
    if (not self.player) or (not self.square) or ( self.square:DistToProper(self.player) > 1.5 ) then
        self:closeAndRemove()
        return
    end
#

you can pull the current action

verbal yew
#

hmhmhmh

sour island
#

but what you have should work

verbal yew
#

okey. im try it, thanks for tip

verbal yew
#

but not control

#

swda not work xD

#
function CrowbarWindow:closeFromActionAnim()    -- zReBL Фикс при прерывании взлома зомбиками
    self.lockpick_object:getModData()["BetLock_crowbarProgressBar"] = progressBarVal

    getCore():addKeyBinding("Left", self.character:getModData()["Lockpick_Left"])
    self.character:getModData()["Lockpick_Left"] = nil
    getCore():addKeyBinding("Right", self.character:getModData()["Lockpick_Right"])
    self.character:getModData()["Lockpick_Right"] = nil
    getCore():addKeyBinding("Forward", self.character:getModData()["Lockpick_Forward"])
    self.character:getModData()["Lockpick_Forward"] = nil
    getCore():addKeyBinding("Backward", self.character:getModData()["Lockpick_Backward"])
    self.character:getModData()["Lockpick_Backward"] = nil
    getCore():addKeyBinding("Melee", self.character:getModData()["Lockpick_Melee"])
    self.character:getModData()["Lockpick_Melee"] = nil
    
    --ISTimedActionQueue.clear(self.character)

    CrowbarWindow.instance = nil
    ISPanel.close(self)
end
sour island
#

you can grab the action's update

#

i forget what the function is called

#

could end the action if there's no instance open

sudden kestrel
#

making a pretty simple mod for a few buddies and had a question im wondering about

how would you go about changing

CustomEatSound = DrinkFromCarton
to another sound of your choice?

ive attempted just switching the name of the mp3 to the name of my sound which didnt work

sudden kestrel
#

I only have 1 script with the item and its consume sound, changed that consume sound to be
CustomEatSound = media/sound/mysoundname

#

hopefully that works

#

nah didnt work

#

wait

sudden kestrel
#

@fast galleon would it be

{
category = player,
clip
{ event = character/survival/drink/blank,
}
}```
#

thats my maybe guess

fast galleon
#

no add file = path to your sound

sudden kestrel
#

file = media/sound/filename

#

got it

fast galleon
#
    sound zxCalloutGetOverHere
    {
        category = Player,
        clip { file = media/sound/scorpion-get_over_here.mp3, volume = 0.5,}
    }
sudden kestrel
#

mine is up being

sound DrinkingFromChocolate
{
category = Player,
clip
{
file = media/sound/samsulekmilk,
}
}```
#

I seem to have forgotten the .mp3

#

also volume might come in handy later on

#

@fast galleon thank you for your help

#

I actually got the sound working

#

might have to tune it a tad down as it just blew my head off but I am one step closer

#

today I custom drew pixel art for the icon, made up the mod files and now the sound file

#

just need the ingame models for dropping it on the floor and holding it

#

wait maybe nvm just a holding it model

#

this ones funny

#

oops I dropped my PNG

#

as for how it looks in the inventory

tropic hedge
#

Hi everyone,

I'm writing modData using ModData.add(String key, LuaTable table).

For some reason if the client doesn't close correctly, the moddata may not be saved to the harddisk.
Is something missing? Like an event?

I found in the documentation ( https://www.projectzomboid.com/modding/zombie/world/moddata/GlobalModData.html ) that there is Java API Moddata:save(), but is say:

" TurboTuTone. This class is not exposed to Lua, ModData.java which callbacks to this is exposed instead. "

Is there any way to use it? There is a solution?

Thank you

bronze yoke
#

ModData is the lua api for GlobalModData, if that doesn't have it you're probably out of luck

#

you can write files and read them in if it's absolutely critical

fast galleon
tropic hedge
tropic hedge
fast galleon
#

in debug mode you need to properly quit, out of debug it's a bit safer from my experience.

#

It's not only the moddata that is not saved...

tropic hedge
fast galleon
tropic hedge
fast galleon
#

well I still lean towards saving it on server, unless it's something that is allowed to be changed by the users.

tropic hedge
fast galleon
#

This is not exactly something I'm very familiar with. I do have some irregular syncing mods, but nothing inspiring.

vernal island
#

how do I force player to wear welding mask in a recipe script?

tropic hedge
random finch
#

So, I want to use sandbox vars for distributions. Seems sandbox vars are loaded after distribution tables. Tried using ItemPickerJava.Parse() on Events.OnInitGlobalModData.Add. Results in LootZed tables being correct but the item will not drop.

Any other suggestions?

sour island
#

Also, by chance - the message above related to your next step - as there are events when data is received

#

that's when you can decide how to treat the data

#

You don't really need to house the data on clientside at all - so I would suggest keeping it on server and pulling it when needed

#

Actually 🤔

#

If the globalmoddata never gets wiped for players' version of it

#

you may not need the server at all

#

I'm pretty sure that data is tied to the world/save

#

even in MP

neon bronze
#

anyone knows how you can use rgb in translations?

hollow lodge
#

I can't seem to recreate a fannypack item by copying the same vanilla coding, everything works fine ingame except there is no model showing

#

item MedicalFannyPackFront
{
DisplayCategory = Bag,
WeightReduction = 50,
ClothingItemExtra = MedicalFannyPackBack,
ClothingItemExtraOption = FannyPack_WearBack,
clothingExtraSubmenu = FannyPack_WearFront,
Weight = 0.2,
Type = Container,
Capacity = 1,
DisplayName = Medical Fanny Pack (Front),
Icon = MedicalFannyPack,
OpenSound = OpenBag,
CloseSound = CloseBag,
PutInSound = PutItemInBag,
BodyLocation = FannyPackFront,
ClothingItem = MedicalFannyPackFront,
CanBeEquipped = FannyPackFront,
RunSpeedModifier = 0.98,
WorldStaticModel = FannyPack_Ground,
}

item MedicalFannyPackBack
    {
        DisplayCategory = Bag,
        WeightReduction    =    50,
        ClothingItemExtra = MedicalFannyPackFront,
        ClothingItemExtraOption = FannyPack_WearFront,
        clothingExtraSubmenu = FannyPack_WearBack,
        Weight    =    0.2,
        Type    =    Container,
        Capacity    =    1,
        DisplayName    =    Medical Fanny Pack (Back),
        Icon    =    MedicalFannyPack,
        OpenSound   =   OpenBag,
        CloseSound   =   CloseBag,
        PutInSound   =   PutItemInBag,
        BodyLocation = FannyPackBack,
        ClothingItem = MedicalFannyPackBack,
        CanBeEquipped = FannyPackBack,
        RunSpeedModifier = 0.98,
        WorldStaticModel = FannyPack_Ground,
}
#

I just copied everything from the vanilla files, except I added the "Medical" here and there

winter bolt
#

the line "ClothingItem = MedicalFannyPackBack" refers to the .xml files inside media/clothing/clothingitems

urban wind
# hollow lodge I can't seem to recreate a fannypack item by copying the same vanilla coding, ev...

Dont quote me on this as I'm brand spanking new to modding.... but I think that ClothingItem = MedicalFannyPackBack, should just be default (ClothingItem = FannyPackBack, if that's the default).

My guess is the script pointing towards a particular model for the clothing item, MedicalFannyPack, which doesn't exist, so it just doesn't display.

The world model isn't the same as the static model used by characters, so you can't just point towards the ground model, which I believe already has x,y,z, attributes appointed to it.

Again, this is just an educated guess, try it out and LMK

#

yeah what @spongie said

winter bolt
#

yeah you'll have to make a new .xml file in that folder which you reference in the item script

#

inside the xml file you'll need to replace the GUID tag with a new GUID so that it doesn't conflict with any other files. you'll also need to make a "media/fileguidtable.xml" where you reference your new clothingitem .xml file as well as its GUID

#

you can copy the fileguidtable from the vanilla files and use it as a base to start from, just delete everything in there except for your new items

hollow lodge
#

I did all those steps

#

everything shows up on the game except from the model

winter bolt
#

did you add them to the fileguidtable?

hollow lodge
#

yes

#

<files>
<path>media/clothing/clothingItems/MedicalFannyPackBack.xml</path>
<guid>bb4d7252-0769-45ac-b23d-900c549f1043</guid>
</files>
<files>
<path>media/clothing/clothingItems/MedicalFannyPackFront.xml</path>
<guid>f12278ad-58f3-4bb0-aa30-858e34e9eb91</guid>
</files>

winter bolt
#

oh weird

heady crystal
#

Does anybody know if it's possible to fetch a zombie's current animation being played?

winter bolt
hollow lodge
#

it's literally a copypaste

#

the only thing I found strange is that I copied the vanilla .x models for this one

#

and they looked like this

winter bolt
#

thats what the importer does to them it should be fine

hollow lodge
#

the uv map is out of the space

#

I tried doing it without the models in my mod folder, so it should run to the gamefiles

#

didn't work either

winter bolt
#

i noticed that the model names in the vanilla file has a typo lol

#

idk if thats connected or if the actual model name is the same

hollow lodge
#

no, they are just to tell them apart, the front and back models

#

so they are also listed one below the other

#

they are labeled that way on purpose

winter bolt
#

like it says Pact instead of Pack

hollow lodge
#

PACK for the front models, PACT for the back models lol

#

yea

winter bolt
#

but it has back at the end lol

hollow lodge
#

yea the models are named that

#

it's all on purpose

#

idk why

#

they just did it, and it works

winter bolt
#

i cant tell what might be messing it up

#

the only kind of problem in the vanilla file is that they included the "media/models_x" thing and the ".x" when they dont need to include either of those

#

but that usually doesnt break anything

#

try checking the console in debug mode when you equip it and see if it says anything maybe

#

it usually mentions if it cant find the xml file

hollow lodge
#

Ok I'll check

#

I tried converting them to .fbx and erase the .x on the .xml and still didn't work

#

I'm sure I'm missing something so little

verbal yew
#

Need help.
How to check all self inventory (with backpack) for items on has tag?
How to remove this item, if they exist (one count, X count)?

#

self.character:getInventory():containsTag("MyTag")?

sour island
#

Check the java file for item containers

#

There's a boatload of methods

verbal yew
#

getFirstTagRecurse?

#

local myitem = self.character:getInventory():getFirstTagRecurse("MyTag")
myitem:Remove?

sour island
#

That gets 1, the first found

#

You'd need to use container:remove()

verbal yew
verbal yew
sour island
#

The container in this case is the players inventory

#

So self.character:getInventory() etc

verbal yew
#

self.character:getInventory():container:remove(myitem)

verbal yew
#
                    if win.character:getInventory():getFirstTypeRecurse("BobbyPin") then  -- containsType
                          win.character:getInventory():getContainer():Remove():getFirstTypeRecurse("BobbyPin")    
                          -- win.character:getInventory():Remove("BobbyPin")
                    elseif win.character:getInventory():getFirstTypeRecurse("HandmadeBobbyPin") then -- containsType
                        win.character:getInventory():getContainer():Remove():getFirstTypeRecurse("HandmadeBobbyPin") 
                        -- win.character:getInventory():Remove("BobbyPin")
                    else
                        win.breakTimer = 2
                        win.isFailEnd = true
                    end
                    if not (win.character:getInventory():getFirstTypeRecurse("BobbyPin") or                           win.character:getInventory():getFirstTypeRecurse("HandmadeBobbyPin")) then     -- containsType
                        win.breakTimer = 2
                        win.isFailEnd = true
                    end

comments - original

not work...

#

remove item's from inventory, but if them in backpack - nope

hollow lodge
#

@winter bolt I fixed it, I had the texture path wrong all this time

winter bolt
#

ohh

sour island
#

Although recursive should be that lol

#

Oh I see something that may be wrong

#

Isn't inventory the container?

#

Does getInventory():get container() do anything?

blissful salmon
#

I have a "mayby" simple question. For a timed action I equip two items:
ISWorldObjectContextMenu.equip(player, player:getPrimaryHandItem(), tool, true) ISWorldObjectContextMenu.equip(player, player:getSecondaryHandItem(), item, false)
after the action is done I want to convert the "item" to another one which is added to the inventory.
The problem appears when I try to remove the old item in the SecondaryHand. So far I tried to remove it with the following code:
ISInventoryPaneContextMenu.unequipItem(self.item, self.character:getPlayerNum()) self.character:getInventory():DoRemoveItem(self.item)
What I expect is the same behavior when a weapon breaks. The weapon disappears and the broken item is in the inventory. Is there a simple way to do it?

bronze yoke
random finch
#

I have been doing it after. Pretty much at loss for now trying different events.

verbal yew
# sour island Does getInventory():get container() do anything?

not sure i just take it from vanilla:

 items = playerInv:getSomeTypeEvalRecurse(itemFullType, buildUtil.predicateMaterial, itemCount)
                for i=1,items:size() do
                    local item = items:get(i-1)
                    playerObj:removeFromHands(item)
                    if item:getContainer() then
                        item:getContainer():Remove(item);
                    else
                        playerInv:Remove(item)
                    end
                    itemCount = itemCount - 1
                    table.insert(consumedItems, item)
                end
#

but removed array (massive, not know how it be on eng)

#

drunk okey, looks like i do something wrong

sour island
#

Item container is the object type

#

Player:getInventory is a item container

#

You are trying to get the container of a container

#

Also I'm not home, so I might be remembering wrong

#

This should be producing an error or something

verbal yew
#
local zReBLBP = win.character:getInventory():getFirstTypeRecurse("BobbyPin")
local zReBLHBP = win.character:getInventory():getFirstTypeRecurse("HandmadeBobbyPin")
                    if zReBLBP then    -- containsType
                        win.character:getInventory():Remove(zReBLBP)
                    elseif zReBLHBP then -- containsType
                        win.character:getInventory():Remove(zReBLHBP)
                    else
sour island
#

Any errors?

verbal yew
#

not know, test in progress

sour island
#

If this doesn't error out - then the method for finding the item isn't what it's advertised as

verbal yew
#

finding work fine

#

but remove method not work

#

nope!

#

Work on inventory

#

but not trigger into backpack

#

hmhmhmh

mellow frigate
verbal yew
# mellow frigate remove from item:getContainer() not from character:getInventory()

attempted index: Remove of non-table: null function: OnKeyKeepPressed -- file: BobbyPinWindow.lua line # 421 | MOD: zRe Better Lockpicking java.lang.RuntimeException: attempted index: Remove of non-table: null at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689) at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:641) at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980) at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1812) at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66) at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139) at zombie.Lua.Event.trigger(Event.java:64) at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:92) at zombie.input.GameKeyboard.update(GameKeyboard.java:85) at zombie.GameWindow.logic(GameWindow.java:249) at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71) at zombie.GameWindow.frameStep(GameWindow.java:765) at zombie.GameWindow.run_ez(GameWindow.java:681) at zombie.GameWindow.mainThread(GameWindow.java:495) at java.base/java.lang.Thread.run(Unknown Source)

#

oh, item... not character...

#

local zReBLBP = win.character:getInventory():getFirstTypeRecurse("BobbyPin") - item
zReBLBP:getContainer():Remove()?

#

how it's should write... drunk

sour island
#

Remove erroring from a null 🤔

mellow frigate
sour island
#

Am I mistaken, isn't get inventory an item container?

mellow frigate
mellow frigate
blissful salmon
#

It seems I could solve my issue with:
self.character:removeFromHands(self.item) self.character:getInventory():DoRemoveItem(self.item)

verbal yew
#

I think all the mistakes are in Better Lockpicking been fixed

#

hmhmhmh...

verbal yew
#

it's should be do for doors and windows like Thumbnail or IsoObject? (not car doors)

#

i'm just nothing see in vanilla doing client-server command...

function ISLockDoor:perform()
    local soundPrefix = self:getSoundPrefix()
    if self.lock then
        self.door:setLockedByKey(true);
        self.character:getEmitter():playSound(soundPrefix .. "Lock");
--        getSoundManager():PlayWorldSound("lockDoor", self.door:getSquare(), 0, 10, 0.7, true);
    else
        self.door:setLockedByKey(false);
        self.character:getEmitter():playSound(soundPrefix .. "Unlock");
--        getSoundManager():PlayWorldSound("unlockDoor", self.door:getSquare(), 0, 10, 0.7, true);
    end

    local doubleDoorObjects = buildUtil.getDoubleDoorObjects(self.door)
    for i=1,#doubleDoorObjects do
        local object = doubleDoorObjects[i]
        object:setLockedByKey(self.lock)
    end

    local garageDoorObjects = buildUtil.getGarageDoorObjects(self.door)
    for i=1,#garageDoorObjects do
        local object = garageDoorObjects[i]
        object:setLockedByKey(self.lock)
    end

    -- needed to remove from queue / start next.
    ISBaseTimedAction.perform(self);
end
#

And to be honest, I don’t know if it syncs... need testing...

sour island
#

There is vanilla stuff the file doesn't appear in the documenting tools though

verbal yew
#

sounds of relief

sour island
#

Yeah most things are relayed

crisp leaf
#

How do y'all create items? I'm so tired of manually copy pasting stuff I've already made and generation is HORRIBLE to configure, just wondering if y'all use some tool or smth.

urban wind
#

Howdy party people

#

Quick question, anyone know about how the RNG generator works? I'm trying to code for an item I've made to make it super rare (1 in a million example)

sour island
urban wind
#

right, but why are some items on the table 4? Shouldn't the rolls be between 0 and 1?

sour island
#

rolls are how many times the chance is 'rolled'

urban wind
#

oh because it's adjusting the weighting to compensate for the rolls, got it

#

yup ok just answered my own question lol

#

yah in a container with one roll, an item that has 50% chance to spawn would read as 0.5, where as in container with two rolls it would be 1

#

Right?

bronze yoke
#

they're technically 0 to 100

#

but the default spawn settings reduce the chances by 60%

#

so on default settings it's really more like 0 to 250

urban wind
#

😕

#

If the rolls are between 0 to 100 on default, wouldnt it reduce it to 1 to 60