#mod_development

1 messages · Page 111 of 1

stiff furnace
#

I appreciate it

#

I appreciate you taking the time to let me know lol

red tiger
#

Got for-loops implemented today.

#

Translating loop logic between Lua and TypeScript is kind of meh. =(

stiff furnace
#

Nice man

red tiger
#

After loops I'm going to work on instancing "self"

#

Then class generation using a class adapter API I'll build for detecting pseudo-classes in the code and possibly how to implement them too.

#

Yay for progress.

tulip wolf
#

does something like that exist: OnCharacterMovement

bronze yoke
#

OnPlayerMove

tulip wolf
#

I tried Player but it doesn't exist

bronze yoke
#

you won't catch non-player characters with that but it might be what you need

tulip wolf
#

function: OnPlayerMove -- file: PlayerMove.lua line # 17

ERROR: General , 1676093054327> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Object tried to call nil in OnPlayerMove at KahluaUtil.fail line:82.
ERROR: General , 1676093054327> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: Object tried to call nil in OnPlayerMove

bronze yoke
#

can i see your code?

tulip wolf
#

local grassSoundFiles = {
    "media/sound/grass_footstep1.ogg",
    "media/sound/grass_footstep2.ogg",
    "media/sound/grass_footstep3.ogg",
    "media/sound/grass_footstep4.ogg"
}
local grassSoundIndex = 1

local function xyz(player)
    return player:getX(), player:getY(), player:getZ()
end

local function OnPlayerMove(player)
    local x, y, z = xyz(player)
    local surfaceType = player:getSurfaceType()
    if surfaceType == "grass" then
        player:BaseCharacterSoundEmitter(grassSoundFiles[grassSoundIndex], x, y, z, false, 20)
        grassSoundIndex = grassSoundIndex + 1
        if grassSoundIndex > #grassSoundFiles then
            grassSoundIndex = 1
        end
    end
end

Events.OnPlayerMove.Add(OnPlayerMove)```
bronze yoke
#

getSurfaceType() does not exist

dark wedge
tulip wolf
bronze yoke
#

it was saying OnPlayerMove because you named your function that, and the error was in that function

tulip wolf
humble oriole
#

Is there really no player:getOccupation()???

bronze yoke
#

player:getDesc():getOccupation()

humble oriole
#

wow, they buried that

#

I'm still fighting an issue with moving things to a container after removing items from the container inventory

humble oriole
bronze yoke
#

what do you mean?

humble oriole
#

well, there is no getDesc() and I'm looking at getDescription() and there isn't one for IsoPlayer

#

I can see getName() under the profession factory, but I think that just for interacting with professions via lua and not how they're tied to the player

bronze yoke
#

my bad, getDescriptor()

humble oriole
#

( ͡° ͜ʖ ͡°)

#

Occuption - getPlayerByOnlineID(0):getDescriptor():getProfession()

#

Thanks as always

humble oriole
#

ok, so players don't get hasSafehouse(), but Safehouse.hasSafehouse(player) returns the whole safehouse instead of a boolean... because they're doing hasSafehouse(player) do a get. Then did getSafehouse(coord/square) and not getSafehouseByPlayer(player) and getSafehouseBySquare(coord/square).

#

Any reason why Safehouse.hasSafehouse(getPlayerByOnlineID(0)) wouldn't work from debug?

nova socket
humble oriole
#

I'm just doing ~= nil

#

if not SafeHouse.hasSafehouse(player) ~= nil then

nova socket
#

~= is not required

#

if not already checks for nil

humble oriole
#

even better, I wasn't sure it did so was just being explicit

nova socket
#

Pretty much works for any type checks

#

Same for variable default value failover
someVar = someVar or 0 means if someVar is nil then its assigned to 0

#

The only thing I dream if in some languages is something like object.field?.anotherfield?.value like TS has.

humble oriole
#

It's nice at a glance though if you see ~= nil you know that the function doesn't return true/false imo. Probably preference?

nova socket
#

Yeah maybe, I'm just more into compact code as much as possible without damaging human reading.

humble oriole
#

yea, I get that

#

I try to do things with the most efficiency and readability. Compactness isn't as important.

nova socket
#

Yeah as I said not gonna judge any codestyles.

humble oriole
#

aww we can't set a building def 😦

drifting ore
#

lol what are you trying to do

#

i messed around with a lot of that stuff trying to figure out switches

tulip wolf
#

it does not have:

local floorType = floor:getType()``` ???
humble oriole
#

well, any building that has residential rooms is claimable even if it's not orange on the map. So, I've been pondering how we can stop that as server owners. With the knowledge that we can't set a building def, I'll have to look for another way for an admin to swing through and prevent that building from being claimed again.

ancient grail
#

Afaik as long as theres a bed

#

Which is why the hone for the aged and those hardwarestores with rooms above are claimable
Also condo units and hotel

humble oriole
#
    if not safehouse and clickedSquare:getBuilding() and clickedSquare:getBuilding():getDef() then
        local reason = SafeHouse.canBeSafehouse(clickedSquare, playerObj);
        if reason then
            if test == true then return true; end
            local option = context:addOption(getText("ContextMenu_SafehouseClaim"), worldobjects, ISWorldObjectContextMenu.onTakeSafeHouse, clickedSquare, player);
            if reason ~= "" then
                local toolTip = ISWorldObjectContextMenu.addToolTip();
                toolTip:setVisible(false);
                toolTip.description = reason;
                option.notAvailable = true;
                option.toolTip = toolTip;
            end
        end
    end```
ancient grail
#

Ahhh ok
Dubunked!
Lol

#

Anyways what i said was comming from a players perspective / non modder

humble oriole
#

yea, I didn't know till about 30 minutes ago

#

and having a bed might be enough to change the building def

#

so, you could still be right

#

I think it has more to do with the room definition

#

can you access fields with a .[field]

#

like that?

odd fjord
#

do you guys know of any resource than can help me learn how to animate the project zomboid user character?

ancient grail
#

how to control fog on lua

humble oriole
ancient grail
#

🙏

humble oriole
#

oh that's getting it, idk if you can control it with that

#

there's a setFogIntensity under WeatherFX

#

but, that may not work as intended and only draw fog on the client instead of making it foggy via the climate

ancient grail
#

so whats for global

humble oriole
#

oof, I'm not sure I understand how they're doing it on the admin panel

#

lua/client/AdminPanel/ISAdmPanelClimate.lua

#
        var = clim:getClimateFloat(FLOAT_FOG_INTENSITY);
        self.tickBoxFog.selected[1] = var:isEnableAdmin();
        self.sliderFogSlider:setCurrentValue(var:getAdminValue());```
#
    elseif _slider.customData=="FogSlider" and clim:getClimateFloat(FLOAT_FOG_INTENSITY) then
        clim:getClimateFloat(FLOAT_FOG_INTENSITY):setAdminValue(_slider:getCurrentValue());```
#
    elseif _tickbox.customData == "Fog" then
        if clim:getClimateFloat(FLOAT_FOG_INTENSITY):isEnableAdmin() then
            clim:getClimateFloat(FLOAT_FOG_INTENSITY):setEnableAdmin(false);
        else
            local val = self.sliderFogSlider:getCurrentValue();
            clim:getClimateFloat(FLOAT_FOG_INTENSITY):setEnableAdmin(true);
            clim:getClimateFloat(FLOAT_FOG_INTENSITY):setAdminValue(val);
        end```
ancient grail
#

you have idea how to produce sound but only heard localy?

humble oriole
#

local clim = getClimateManager();

stiff furnace
#

Alright. A cookie for anyone who can tell me what is causing the error here. I am not understanding the debug log... The items get removed correctly but an error still occurs ??

    local playerInv = getPlayer():getInventory():getItems()
    local playerInv2 = getPlayer():getInventory()
    local ItemsToRemove = 1
    
    local table = {'Necklace_SilverSapphire', 'Necklace_SilverDiamond', 'NecklaceLong_SilverEmerald', 'NecklaceLong_SilverSapphire', 'NecklaceLong_SilverDiamond','Ring_Right_MiddleFinger_SilverDiamond','Ring_Left_MiddleFinger_SilverDiamond','Ring_Right_RingFinger_SilverDiamond','Ring_Left_RingFinger_SilverDiamond','BellyButton_DangleSilverDiamond','BellyButton_RingSilverAmethyst','BellyButton_RingSilverDiamond','BellyButton_RingSilverRuby','BellyButton_StudSilverDiamond'}
    
    for i=0,playerInv:size() - 1 do
            local ItemType = playerInv:get(i):getType()
            
            for i=0,#table do
                if table[i] == ItemType and ItemsToRemove > 0 then
                    playerInv2:Remove(ItemType)    
                    ItemsToRemove = ItemsToRemove - 1
                end
            end
    end
humble oriole
tulip wolf
#

Guys if there's already an animation in the game, I need to trigger it, right?

humble oriole
#

just find in files for setActionAnim and you'll see what is used in the vanilla code, not sure if there are others

humble oriole
tulip wolf
#

I'm reading this player:animEvent("sitGround")

ancient grail
#

thnx

stiff furnace
#

Changing ItemsToRemove to ItemsToRemove=8 would remove 8 of those items for example

humble oriole
humble oriole
stiff furnace
#

It does...but I unfortunately do not understand it.

attempted index: storePos of non-table: null

I get what those words means, but not put together for this loop 😐

#

I will keep messin' with it

#

It's my 3:00am brain causing problems I think

humble oriole
#

the problem is with storePos not the code you showed

stiff furnace
#

Okay, maybe that's not the error...
I'm new to PZ scripting - typically when I get an error message it pops up on the screen with an error log. This error doesn't it just...shows a blank screen.

#

It shows this:

humble oriole
#

usually that happens to me when I call something that doesn't exist

stiff furnace
#

Ah okay

humble oriole
#

or misspell something

stiff furnace
#

I'm just running this code in the console, ``` local playerInv = getPlayer():getInventory():getItems()
local playerInv2 = getPlayer():getInventory()
local ItemsToRemove = 2

local table = {'Necklace_SilverSapphire', 'Necklace_SilverDiamond', 'NecklaceLong_SilverEmerald', 'NecklaceLong_SilverSapphire', 'NecklaceLong_SilverDiamond','Ring_Right_MiddleFinger_SilverDiamond','Ring_Left_MiddleFinger_SilverDiamond','Ring_Right_RingFinger_SilverDiamond','Ring_Left_RingFinger_SilverDiamond','BellyButton_DangleSilverDiamond','BellyButton_RingSilverAmethyst','BellyButton_RingSilverDiamond','BellyButton_RingSilverRuby','BellyButton_StudSilverDiamond'}

for i=0,playerInv:size() - 1 do
        local ItemType = playerInv:get(i):getType()
        for i=0,#table do
            if table[i] == ItemType and ItemsToRemove > 0 then
                getPlayer():getInventory():Remove(ItemType)
                ItemsToRemove = ItemsToRemove - 1
            end
        end
end```
#

It's probably something silly

#

I appreciate t he help. Maybe after a nights rest I will catch it

humble oriole
#

you may want to also use RemoveOneOf instead of Remove

#

I'd try both

stiff furnace
#

Oh, let me try that

#

It's just odd because the code works lol

humble oriole
#

idk if it'll fix your issue

stiff furnace
#

It does exactly what I want it to

humble oriole
#

you may be looping too many times

stiff furnace
#

Oh probably that

humble oriole
#

so it tries to find a value and there isn't one

#

so it just throws that error

stiff furnace
#

You're right. If I put **return **after ItemsToRemove = ItemsToRemove - 1 it does not throw an error. It also doesn't remove more than 1 item. But that does tell me it's an issue with the table loop

#

Okay. I think it has something to do with removing items while looping...probably not a good idea.

#

I replaced the table with a simple if, then statement and still got the error lol

nova socket
#

@pulsar heath I remember you been working with zombie AI. Is there any simple method to make them start roaming in random directions?

stiff furnace
#
        local hour = getGameTime():getTimeOfDay();
        if( hour < 8.0 ) or ( hour >= 22.0) then
        
            local players = getOnlinePlayers()
            for i=0, players:size()-1, 1 do
                local player = players:get(i)
                local zlist = player:getCell():getZombieList();
                if(zlist ~= nil) then
                    for i=0, zlist:size()-1 do
                        local zed = zlist:get(i)
                        local tempx = zed:getX() + ZombRand(-25,25)
                        local tempy = zed:getY() + ZombRand(-25,25)
                        local tempz = zed:getZ()
                        zed:pathToLocation(tempx,tempy,tempz);
                    end
                end
            end
        end
end
#

For dedi/MP only, but you could easily modify it

nova socket
#

ah zed:pathToLocation to random X,Y.. makes sense.

stiff furnace
#

There is a nil in there!

#

How the

wheat kraken
#

showcase: #mod_development message
userful for debug if you dont have controller, you can test axis using mouse, and to change axis change in code

to
isLeftAnalogStick=True

for modders that dont have controller to test with, this works for simulate controller
i bsc computer science pair programming with chatgpt to produce a python joystick keyboard opensource, to work with vjoy, enjoy

to debug using a virtual controller, to got 99.9% precision use your window screen monitor borders, someone can try optimize the precision using math and screen knowledge (hint you can reduce the screen to fit better the circle of radial menu)

https://github.com/rslgp/virtual-controller-opensource

requirements: vjoy https://sourceforge.net/projects/vjoystick/files/latest/download config 18 buttons there
to run, install python
pip install -r requirements.txt
python chatgpt-keyboard-axis-reifel.py

press F1 to exit

GitHub

a virtual controller opensource coded by bsc Computer Science with pair programming with chatgpt - GitHub - rslgp/virtual-controller-opensource: a virtual controller opensource coded by bsc Compute...

neon bronze
#

When you index over a lua table not a java table

stiff furnace
#

oohh

#

MY LORD

#

That was it the whole time lol

neon bronze
#

👍

stiff furnace
# neon bronze 👍

Also, editing a table while you are iterating over it is not a good idea lol

neon bronze
#

Copy the table and edit the copy while iterating over the og table

stiff furnace
#
    local ItemsToRemove = 2
    
    local table = {'Necklace_SilverSapphire', 'Necklace_SilverDiamond', 'NecklaceLong_SilverEmerald', 'NecklaceLong_SilverSapphire', 'NecklaceLong_SilverDiamond','Ring_Right_MiddleFinger_SilverDiamond','Ring_Left_MiddleFinger_SilverDiamond','Ring_Right_RingFinger_SilverDiamond','Ring_Left_RingFinger_SilverDiamond','BellyButton_DangleSilverDiamond','BellyButton_RingSilverAmethyst','BellyButton_RingSilverDiamond','BellyButton_RingSilverRuby','BellyButton_StudSilverDiamond'}
    
    local removetable = {};
    
    for i=1,playerInv:size() - 1 do
            local ItemType = playerInv:get(i):getType()
            for i=1,#table do
                if table[i] == ItemType and ItemsToRemove > 0 then
                    print (ItemType)
                    removetable[#removetable+1]=ItemType
                    ItemsToRemove = ItemsToRemove - 1
                end
            end
    end
    
    for i=1,#removetable do
        getPlayer():getInventory():Remove(removetable[i])
    end    
    ```
#

Final solutio

#

n

#

I put the items I want removed into a separate array 😐

neon bronze
#

What exactly are you trying to remove?

stiff furnace
#

This is for a more complex recipe system. So instead of duplicating recipes, the player just needs any combination of those 10 items in the table

lunar robin
#

I've been struggling to make this work for a week now.
So I have this array for random name generating, but it wouldn't work for some reason, like the event is not triggered properly.

local firstNameArray = {"Ivan", "Michael"}
local lastNameArray = {"Jackson", "Buba"}
local function generateName(player)
    local firstName = firstNameArray[ZombRand(1, #firstNameArray+1)]
    local lastName = lastNameArray[ZombRand(1, #lastNameArray+1)]
    getPlayer():getDescriptor():setForename(firstName)
    getPlayer():getDescriptor():setSurname(lastName)
end
Events.OnNewGame.Add(generateName)

However, when I type this code (without event block) in the lua interpreter ingame, it works...
So I tried to check whether the function is even running OnNewGame:"

local function generateName(player)
    local firstName = firstNameArray[ZombRand(1, #firstNameArray+1)]
    local lastName = lastNameArray[ZombRand(1, #lastNameArray+1)]
    getPlayer():getDescriptor():setForename(firstName)
    getPlayer():getDescriptor():setSurname(lastName)
    print("DONE")
end

And... "DONE" string is displayed! So the event is triggered, although the name is not changed. What am I doing wrong? Any suggestions would be greatly appreciated!

neon bronze
#

try maybe initializing a new world? the description for the event is
**Triggered after a new world has been initialized. **

#

or try using ZombRandBetween

wheat kraken
tulip wolf
#

Can someone help me? I'm trying something simple:

local keyBind = "b"  -- Defines the key that will trigger the sit action

local function OnKeyPressed(key)
    if key == keyBind then
        local player = getPlayer()
        if player then
            print("Player found, triggering animation...")
            getSpecificPlayer(player):reportEvent("EventSitOnGround")
            print("Animation triggered successfully.")
        else
            print("Player not found.")
        end
    end
end

Events.OnKeyPressed.Add(OnKeyPressed)
tulip wolf
rancid panther
#

did you try just using getPlayer instead of getSpecificPlayer(player)
?

#

i dont know much about modding, but it seems redundant. in my mod i just used getPlayer or getSpecificPlayer(0)

tulip wolf
nova socket
#

Dam that's a trouble. Apparently IsoPlayer is getting instantly culled in MP

lunar robin
#

This is why in case one launches a lan session, it wouldn't work, until he shuts down the session!

rancid panther
#

mine is a trait tho, and i used getPlayer() to give them a wound when they spawn

dark wedge
rancid panther
#

also i was told to test the specific command line in console to make sure that command works

#

if getSpecificPlayer(playerNumber):reportEvent("EventSitOnGround") works using command console, then that part is fine

#

right?

#

im learning too

dark wedge
#

Correct.

rancid panther
#

i want to make another mod some time in the future

#

it'll involve the health panel, so i wanna start out small by making cold packs work to relieve pain that appears on the health panel

#

as in neck pain when u sleep wrong, or muscle soreness etc

dark wedge
#

oh neat. more first aid items always help, there's not enough of them in the game imo.

rancid panther
#

i want to make the first aid skill actually useful, but none of the mods currently out there suit my tastes

#

as well as making first aid from other players helpful

#

like if u have a first aid person in ur party, it would be better for them to patch you up than just carrying sterilized rags in your pocket

tulip wolf
rancid panther
#

im just trying to make my ideal server basically

tulip wolf
#

The sounds mainly, for me it's what makes all the difference

dark wedge
#

Well, since I know some people are curious about the mod I'm working on (and because I want to show off a bit) I have made some pretty big steps forward in how I'm calculating damage now for the offhand attack. Turns out, the whole "SwipeStatePlayer" thing I found really wasn't going to work out, as it still didn't take into account the offhand weapons skills. So, this lead me back to square 1, and I have now re-implemented the weapon damage/hit reaction code for zombies in Lua. There are still some bugs, like I need to figure out the window and fence climbing state stuff, but overall this is working for everything and getting pretty much the same values as vanilla. This has also let me add my own "hit reactions", so zombies will react to the right when you hit them from the left and whatnot too. 😄 I also found there is a Hook that is unused where you can actually handle all of the damage calcs and stuff in Lua. So, I have added an option to hook into that so that my functions handle vanilla attacks too. Still very much WIP on that front, but this ensures consistency between hand damages, AND will also let me expose a whole bunch of stuff in the Sandbox options for combat. Will likely make that the default once I have everything working. Sorry for the book, just a lot to talk about here. drunk Here's a thing of my character hitting a crit because of a zed's back, but 100% calc'd from me.

ancient grail
wheat kraken
rancid panther
#

is there a way to disable debug mode while still in game?

#

or like disable most of its effects?

weary dock
ancient grail
#

panic animation but with checks

function MT.isFearless(pl)   
    if pl:isAccessLevel('admin')  then return true end
    if pl:HasTrait("Desensitized") or pl:HasTrait("Brave") then 
    return true
    end
end
#

we really should add another channel just for animations lol

ancient grail
hot patrol
#

I have been periodically checking to see if it's or @thick karma 's had been released. Very excited to give it a try

pure pollen
weary dock
#

guys, anyone knows how to make tooltips(like painkillers have)? Cuz i was looking on youtube but for no avail

shy hearth
#

using setAdminValue doesn't really work in most cases, pretty sure it only works if there's an admin character on at all times

#

and the non-admin alternatives have weird quirks

#

what're ya trying to do with fog?

red tiger
#

Good morning.

shy hearth
weary dock
shy hearth
#

my pleasure pal

weary dock
# shy hearth my pleasure pal

can u help with another thing? ive found myself stuck on context menus. is there a way to make more than 1 action for consume . like in Open jackets mod i think. imma working on medical items and big contex menus would be terrific i think

#

ive found CustomContextMenu line but does this work with arrays? and if yes what is syntax for that

tulip wolf
#

I'm confused with the rolls system in the distributions... Would it be a probability of the item being in that container?

weary dock
weary dock
#

so prop of item be in container is proporshional to all items in table / to your item

shy hearth
weary dock
#

gonna use that then

tulip wolf
#

if i remove the rolls option, would the item be 100% in a container?

weary dock
#

if so i guess - it will be there

#

but no rolls = no items there from loot table

#

im not sure that u will achieve what u want by that

tulip wolf
#

I want the item always in that container with high probability, for test custom items...

#

For me to know that they are being generated

#

in that specific container

weary dock
#

So u def need to use loot tables

#

Mb try to create special container that bound to ur specific loot table

tulip wolf
weary dock
#

And in table let be like 4 your items and 1 control item then do several rolls and u will get ur item with high prop

#

In theory that must work nice but i didnt work with tables here yet. So mb there will be some technicalities

tulip wolf
#

example: items = { --"Base.p88p", 0.5, This number is very small and I believe that it is very rare for this item to be there

weary dock
#

Which loot table u looking into now? So i can check out this myself

tulip wolf
#

Anyway, I'm going to test with a value of 50 just to make sure the item is there🤣

weary dock
#

Ok, get extinguisher ready

#

drunk 👍

tulip wolf
# weary dock Which loot table u looking into now? So i can check out this myself

to answer your question, I'm looking at this gunstorestorage ={ all={ rolls = 2, items = { "Base.132Box", 2, "Base.500Box", 2, "40Clip", 1, "Base.PPSHClip", 0.7, "Base.LewisDrum", 0.5, "Base.WitchySMGClip", 0.6, "Vest_WitchyCarrier", 0.6, "RogueGreaves", 0.5, "RogueArms", 0.5, "Shoes_Rogue", 0.2, "Gloves_Rogue", 0.3, "Base.medbag2", 0.2, "RogueWaist", 0.5, "Vest_RogueVest", 0.5, "RogueHoodie", 0.5, "RogueMask", 0.3 "Base.strapchest", 0.5, "Base.MVest", 0.5, "Base.m79", 0.2, "Base.WitchySMG", 0.3, "Base.TKShotgun", 0.2, "Base.Lewis", 0.2, "Base.PPSH", 0.4, "Base.ClericRevolver", 0.3, "Base.RogueSniperRifle", 0.2, "Base.MAS38", 0.3, "Base.MASClip", 0.6, },

weary dock
#

Ok i guess up to 10 weight u must be safe for sure

quasi kernel
#

Squawk

weary dock
#

i guess u can max weight up to 100

#

so its like % as i understand

tulip wolf
#

Interesting i can make it harder or easier

weary dock
#

Bag_MoneyBag = {
rolls = 10,
items = {
"Money", 100,

#

yup def up to 100

tulip wolf
#

an item with 0.001 would be perfect and pretty rare

weary dock
#

i guess so but u still need a loot table or to modify existing

tulip wolf
#

there is still a distribution in the folder called ProceduralDistributions I will get even more lost

limber oar
#

Could someone explain the difference between standard recipes and evolved recipes? I don't think I quite get when to use one over the other.

In my case I'm trying to "transform" one item into a related clothing item (think newspaper into newspaper hat), which seems like it would be a candidate for an evolved recipe...but why not just use a standard recipe with the item as an ingredient and the hat as an output?

Is there some advantage to one over the other that I'm missing?

tulip wolf
fast galleon
limber oar
#

So, if each of those lines gives a 10% chance of a saucepan to spawn, even if there's only one spawn roll, it's possible for there to be anywhere between 0 and 10 saucepans in the container.

#

I think the difference in chances between lines is meant to create a "median" likelihood, as in, it's most likely for there to be 1-6 saucepans, less likely for there to be 7-8, and very unlikely for there to be 9-10.

limber oar
#

Disclaimer being that I have no idea if I'm actually right, I haven't looked at the backend code, this is just the conclusion I came to based on my understanding of the roll/spawn system.

tulip wolf
weary dock
#

Anyone worked with ItemTweaker API? I guess imma need some advice

tulip wolf
drifting ore
#

Hello. Is it possible to change engineForce on BaseVehicle?

tulip wolf
weary dock
#

They all have atleast 400-600 horses usually

limber oar
#

How can they have horses if the animal update hasn't come out yet

weary dock
#

And its must be edited cuz i ain't saw any vehicle with that numbers

#

Btw guys any suggestions for firstaid mod? Got +- easy autopsy system and going for medicines

swift linden
#

more medicines is cool for me

#

it adds many more pills and tourniquet, hemostatic powder and syringes

weary dock
#

Thinking about rework (atleast cosmetic) of vanilla drugs

gleaming lynx
drifting ore
swift linden
#

i think he means that

#

so this means higher power for modded cars

drifting ore
#

whut

#

-_-

weary dock
gleaming lynx
weary dock
tulip wolf
# limber oar How can they have horses if the animal update hasn't come out yet

maybe... ```Distributions = Distributions or {}

local distributionTable = {
kitchen_cabinet = {
isContainer = true,
item = {
itemName = "Beercan",
chance = 0.7
}
}
}

table.insert(Distributions, distributionTable)

function checkContainer(container)
if container.id == "kitchen_cabinet" then
if math.random() < container.item.chance then
container:AddItem(container.item.itemName)
end
end
end

Events.OnFillContainer.Add(checkContainer)```

#

it was just an idea... ignore it

weary dock
#

Imma going to call it a day, gn guys

gleaming lynx
weary dock
gleaming lynx
#

And I want to edit the engine power through lua, but I didn't find any functions.

shy hearth
#

when you say engine power dya mean max speed? or something more specific

gleaming lynx
#

But not in script

#

In game

tulip wolf
gleaming lynx
#

Press F - engineForce=1000

limber oar
shy hearth
#

what're you trying to do?

gleaming lynx
shy hearth
gleaming lynx
shy hearth
#

ah yea, that's why I was asking if increasing/decreasing max speed would do

#

you could probably make a part that you could install, which would increase the max speed

#

i'm fairly certain that maxspeed will also translate into like, better pulling power in relation to mass

#

not 1:1 but

drifting ore
#

not just max speed

gleaming lynx
drifting ore
gleaming lynx
shy hearth
#

nevermind, you can set quality, loudness and enginePower with setEngineFeature(x1, x2, x3) respectively

#

where x3 is power

#

i don't know exactly what the difference between engineForce and enginePower is so if you find out then let us know

gleaming lynx
#

I don't understand why it works this way.

drifting ore
#

there's only engineForce in model's description

gleaming lynx
shy hearth
#

yea it looks like the only time enginePower is set directly by the code is in the exit() method

#

idk when that runs, I'd assume it's when a character exits the vehicle but that's a guess

gleaming lynx
#

And that still doesn't answer the question. How to change EnginePower? The exit method is not clear at all....

half anvil
#

im not making a mod but i think if someone turned the zombies into vampires or just based the zombies on the vampires in the book "i am legend" i think that would be really cool

gleaming lynx
bronze yoke
#

oh, that'll work

#

not sure why that didn't come up in my search 😅

#

if you only want to change the engine power, do vehicle:setEngineFeature(vehicle:getEngineQuality(), vehicle:getEngineLoudness(), newPower)

shy hearth
#

it still doesn't because it seems to be overwritten later in the code

bronze yoke
#

yeah, it's going to get reset every time you get out

shy hearth
#

very strange work devs

#

lmao

bronze yoke
#

maybe set it back OnExitVehicle? not sure if that's fired before or after

shy hearth
#

I'd do almost anything to have some comments in the java

bronze yoke
#

my guess why is maybe sunday driver/speed demon originally changed enginepower

#

it definitely seems like a leftover from something like that

gleaming lynx
gleaming lynx
ancient grail
quasi kernel
#

Pray for me gamers, first attempt to see if the 4 new mods I added for the farming patch work well

shy hearth
gleaming lynx
gleaming lynx
quasi kernel
#

It kinda worked first try kinda didn't

gleaming lynx
quasi kernel
#

wha

#

I'm working on farming atm

#

My apologies

gleaming lynx
quasi kernel
#

No worries!! We just vibin

bronze yoke
#

has anyone had issues with OnFillWorldObjectContextMenu not finding the same objects outside of debug mode?

#

when i right click on a tap in debug mode or with admin, it finds the tap on the square and does the context menu stuff as expected, when i do the same without it only finds the tap if i click on the part of the tap that bleeds into another square (and if i do this with admin, it picks it up twice)

#

if i print the size of the worldObjects table, without admin it is 2, and with admin it is 8

drifting ore
#

im going to try out since im using it almost the same way

quasi kernel
#

Someone please kill me

tulip wolf
#

Guys I'm trying to make the character sit on the floor with a specific keyboard key, but he doesn't sit and doesn't show errors on the console. Doesn't it work like that?

drifting ore
#

i havent really checked the table in debug/admin vs not so now i wonder

quasi kernel
#

I was trying to get the Le Gourmet Revolution compatibility for seed packets working without having Le Gourmet Revolution enabled

#

One of the problems of having such a large patcher means I have to make 100% sure that I have every mod enabled

sour island
#

Where do you want it?

drifting ore
#

lololl

quasi kernel
#

Head please.

limber oar
#

If it's any consolation I think "wasting an entire day because of an incredibly obvious and easily fixable error" is a rite of passage for coders everywhere, so welcome to the club.

quasi kernel
#

At least this isn't as bad as having to reprogram basically the entire farming system from the ground up

#

Apparently I was programming it extremely similarly to Filcher despite the fact I didn't even look at how it worked until I patched it in

drifting ore
bronze yoke
#

like a water tap?

drifting ore
#

ahh

#

does it work for some but not others? or just none when not in d/admin

bronze yoke
#

not sure, i've gotten the report a lot and now i'm finally getting it myself

#

i'd be surprised if it happens to everyone since that's a pretty major feature that doesn't work

quasi kernel
#

You can remove functions from events right?

bronze yoke
#

yep

quasi kernel
#

thank god cuz I was just assuming so

#

It is

#

very risky to assume in zomboid

elder solstice
#

Looking to commission a armor mod for PZ/my server.

drifting ore
#
context:insertOptionAfter("Remove Light Bulb", "Change Light Switch Bulb", sprSwitch, ISWorldObjectContextMenu.onLightBulb, true, light, true, player_num, true, remove, bulbitem)
``` i'm struggling with using the onStart feature. anyone have any idea about utilizing  `onLightBulb` here?
#

i can add the booleans for some of these and it will show i used them, but when i just use the arg themselves it just finds nil for bulbitem, remove, and light. i know it's my order or usage of the args here but i cannot figure it out

#

this was all i coudl find on it
insertOptionAfter(prevOptionName, name, target, onSelect, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10)

#

also no matter what i do player is always nil

quasi kernel
#

is remove intended to be a variable?

drifting ore
#

it's looking for it so i'm guessing yea

quasi kernel
#

As in like, local remove = whatever

drifting ore
#

i mean i assumed it would be used in the standard usage of the function?

quasi kernel
#

I guess it'd have to be a regular ol variable to run-

#

hm..

drifting ore
#

ISWorldObjectContextMenu.onLightBulb = function(worldobjects, light, player, remove, bulbitem)

quasi kernel
#

ohh I see

drifting ore
#

yea i'm using that vanill function to remove lightbulb

quasi kernel
#

Gotta love how PZ labels extra params

#

I too love param10

drifting ore
#

yea there is SO many also here

#

i got all to be recognized except player lol....

#

even though im using it fine earlier

#

has to be order im guessing

quasi kernel
#

Probably.

#

Pleh, hope you can manage to sort that out.

drifting ore
#

i literally got it all done except actually removing the damn bulb

quasi kernel
#

How many PZ modders does it take to change a lightbulb

drifting ore
#

worst case i remove it completely and use vanilla method no custom

quasi kernel
drifting ore
#

LOL

supple sapphire
#

How do i make item compostable. Does it just have to be in "food" category or are there other steps?

tulip wolf
#

Can't I use it to make the player perform a sit down action? I used it and I'm still standing...stressed EventSitOnGround local player = getPlayer() if player then player:reportEvent("EventSitOnGround") end

quasi kernel
bronze yoke
drifting ore
#

ahahah okay i did only pass 5 oroginally

#

it just all cam e up nil

#

i tried like every order

quasi kernel
#

mfw how did i not

#

notice that

#

im

#

dying

#

Im so sorry nippy LOL

#

Thank you albion for existing in times of need

supple sapphire
#

I am looking at items in items_food.txt, i see no additional tags aside of ones associated with food.

drifting ore
#

this is how i used it
contextRead5 = context:insertOptionAfter("Remove Light Bulb", "Change Light Switch Bulb", sprSwitch, ISWorldObjectContextMenu.onLightBulb, light, player_num, remove, bulbitem)

#

it seemed like this would be correct

quasi kernel
#

Yeah now that albion mentions it, it just wouldn't pass the extra args.

#

So they would be nil.

drifting ore
#

when i dont use them at all though it throws an error saying player is nil

#

which hurts my brain

quasi kernel
#

Huh..

drifting ore
#

ill try again

#

maybe i was tired and missing something super straight forward

drifting ore
#

keep in mind i am very noobish at this lol

#

haha hey hey

quasi kernel
#

Man it's been a month since i've touched any of this, no worries at all lol

#

I'm rusty

bronze yoke
#

and you're sure they're not nil before the function call?

drifting ore
#

yes because i use player_num earlier to get perk level

#

id assume i can use it same right?

#

since it's being used in the same context as before?

bronze yoke
#

i don't see why you can't

drifting ore
#
local function bulbContext(player_num, context, worldobjects, light, remove, bulbitem)
    local sq = nil

    for i,v in ipairs(worldobjects) do
        local square = v:getSquare();
        if square and sq == nil then
            sq = square
        end
        local sprLight = v:getSprite()
        local sprSwitch = sprLight:getProperties():Val("CustomName") == "Switch"
        if not sprLight then return end -- if not sprite, exit function
        local player = getSpecificPlayer(player_num) -- get player
        local bulbLevel = SandboxVars.Nipswitch.Bulblevel -- Required Electrical level from SandboxVars
        local zapLevel = player:getPerkLevel(Perks.Electricity) -- get player's Electrical level
        local lowLevel = zapLevel <= (bulbLevel - 1) -- set lowLevel to true if player's Electrical level is equal or below SandboxVars
        local contextBulb = context:getOptionFromName(getText("ContextMenu_RemoveLightbulb")) -- get "Read" context menu option
        local dumbText = getText("ContextMenu_One") -- get text for dumb context menu option
        local smartText = getText("ContextMenu_Two") -- get text for smart context menu option
        local toolTip = ISWorldObjectContextMenu.addToolTip() -- get tooltip for context menu option
        local previousPhrase = "" -- set previous phrase to blank
        if sprSwitch and contextBulb and lowLevel then -- if book is in inventory, Read is in the Context Menu, and player's Electrical level is too low
            toolTip.description = dumbText -- set tooltip to dumb text
            local rand = ZombRand(1, 4) -- generate a random number between 1 and 3
            local newPhrase = "" -- set new phrase to blank
            while newPhrase == previousPhrase do -- continue generating new phrase until it's different from previous
                if rand == 1 then
                    newPhrase = "You see a lightbulb socket and become intimidated..."
                elseif rand == 2 then
                    newPhrase = "You wish you knew more about lightbulbs..."
                elseif rand == 3 then
                    newPhrase = "Does my finger go in the light socket..?"
                end
                rand = ZombRand(1, 4) -- generate a new random number between 1 and 3
            end

            previousPhrase = newPhrase -- set previous phrase to new phrase
            local contextRead6 = context:insertOptionAfter("Remove Light Bulb", newPhrase) -- insert new phrase into context menu where "Read" was
            contextRead6.toolTip = toolTip -- set tooltip for new phrase
            contextRead6.notAvailable = true -- set new phrase to not available
            context:removeOptionByName(getText("ContextMenu_RemoveLightbulb")) -- remove "Read" from context menu
        else
            if sprSwitch and contextBulb and not lowLevel then -- if sprite found, Remove bulb is in the Context Menu, and player's Electrical level is high enough
                toolTip.description = smartText -- set tooltip to smart text
                local contextRead5 = context:insertOptionAfter("Remove Light Bulb", "Change Light Switch Bulb", sprSwitch, ISWorldObjectContextMenu.onLightBulb, light, player_num, remove, bulbitem)
                contextRead5.toolTip = toolTip -- set tooltip for "Read"
                contextRead5.notAvailable = false   -- set "Read" to available
                context:removeOptionByName(getText("ContextMenu_RemoveLightbulb")) -- remove "Remove Light Bulb" from context menu
            end
        end
    end
end
Events.OnFillWorldObjectContextMenu.Add(bulbContext)
#

blam

quasi kernel
#

Unrelated but related- I'd avoid using "remove" as a variable name if you can help it.

#

I believe it's reserved by lua.

drifting ore
#

i didn't think i've need it TBh because how it's used in vanilla

#

but i cant figure out.

quasi kernel
#

I doubt it's the only thing causing problems, if it's causing problems at all, but just wanted to point it out.

drifting ore
#

context:addOption(getText("ContextMenu_RemoveLightbulb"), worldobjects, ISWorldObjectContextMenu.onLightBulb, lightSwitch, player, true);

#

this is for addoption tho

#

i'd assume it's not much diff than this

#

when i used this tho also error haha

#

ill try it and see what i get from it. i literally just want my custom option to initiate removing bulb haha D:

quasi kernel
#

I remember addOption having a wonk order of handling functions but I dont recall the specifics, apologies

drifting ore
#

i use it successfully already

#

but for item

bronze yoke
#

the first parameter is before the function, it looks correct to me

drifting ore
#

not woorldobject

neon bronze
#

Maybe try using OnPreFillWorldObjectContextMenu?

drifting ore
#

i do use that for event

quasi kernel
drifting ore
#

oh not prefill

#

i only want it to trigger on click

neon bronze
#

I think the vanilla uses OnPreFill

drifting ore
#

would that make the diff you think... it doesn't make sense but i can try

bronze yoke
#

vanilla doesn't 'use' either, it triggers them

drifting ore
#

yea

neon bronze
#

Thats what i mean

bronze yoke
#

insertOptionAfter isn't going to work with prefill

neon bronze
#

It triggers the event and then fills the context options

#

You could just AddOption

drifting ore
#

where does that land?

#

i use this to keep place in list

bronze yoke
#

at the end

drifting ore
#

yea dont want that

neon bronze
#

Not necessarily

drifting ore
#

it wouldn't matter tbh

#

it's working

#

the ONLY part that isn't is onlightbulb

#

i'm using bad args or bad order

#

i got all context working perfect

#

just need to actually change bulb when click 😄

#

ill try it again with fresh mind here and report back

#

maybe i did something stupid lol

#

i know i dont need bulbitem or remove

#

i think thats only for submenu

bronze yoke
#

both vanilla options use the same function

#

if remove is false then it installs bulbitem, if remove is true then it uninstalls the existing lightbulb

humble oriole
#

Is there a reason why people don't use sandbox variables at this point?

bronze yoke
#

rarely

#

they're useless for per-client options and there are some limited things that load before sandbox options so they can't be used to affect them

humble oriole
#

ah, per client options, yea, that makes sense

glass basalt
#

If I want to remove an event, would the syntax be Events.EventType.Remove() ?

drifting ore
#

yes

glass basalt
#

okay 👍

drifting ore
#

events are added and removed in order also

#

by when you add . to be clear

quasi kernel
#

OMG ITS WORKING

#

CUCUMBERS FROM RUGGED RECIPES CAN BE PLANTED

drifting ore
#

haha nice

quasi kernel
#

Time to see if it works alongside LGR, if it does then

drifting ore
#

very nice

quasi kernel
#

I have officially made

#

quite possibly the first

#

11 mod patcher mod

red tiger
#

Been coding since 9:30 AM. It's 2:30 PM. :D

drifting ore
#

i use it so im extra happy lol

red tiger
quasi kernel
red tiger
#

Made a lot of progress.

humble oriole
#

Is this the correct way to remove items from the distro for a zed's inv?

RemoveItemFromDistribution(SuburbsDistributions["all"]["inventoryfemale"], Bullets22Box, nil, true)
RemoveItemFromDistribution(SuburbsDistributions["all"]["inventorymale"], Bullets22Box, nil, true)```
red tiger
ancient grail
humble oriole
#

I do not control the sheep

red tiger
#

Progress is not slowing down.

quasi kernel
#

Le Gourmet Revolution bell peppers growing alongside Rugged Recipes cucumbers

glass basalt
#

is there a method to get the item that the player currently has equipped, primary or secondary? I can't seem to find it

red tiger
glass basalt
drifting ore
red tiger
#

I might be moving onto class discovery & class adapter API for my transpiler by the end of this weekend. 🤤

drifting ore
#

deciding if make a mod that lets players use tiles to build houses from scratch....

humble oriole
red tiger
#

AKA schematics of houses that you can apply.

drifting ore
#

havent really looked at them but it would use existing tiles. so lets say you have the addams family map on your server and it comes with perts tiles for that

#

zombies destroy the house windows... doors

#

you can replace them and they will also have player built properties as well

#

since those tiles are on the server you would be able to replace them after you destroy previous wall/tile

#

ill look into those other ones but i dont think they work exactly the same

#

would be nice if your windows are broken though and you can replace with exactly same tile that matches your house you take over. if there is a mod that does that, please feel free to let me know

red tiger
#

I have code that repairs windows.

drifting ore
#

for all maps* not just specific

bronze yoke
#

can't you replace windows in vanilla

red tiger
#

Yeah.

drifting ore
#

i meant for non vanilla maps and tiles

humble oriole
#

yea, sounds like More Builds, the problem with those mods is they just blanket the item cost for the building of the item so it's not really balanced.

#

like, military crates with 120 cap cost 2 planks and 2 nails

drifting ore
#

yea i see what you mean. i'll check into how they work, i'm already working on util for handling scaling of craft amounts by level

glass basalt
#

It seems I am not getting the type of item correctly. TVs and Radios are set under "Radio", and that's what I what to check for. What would be the correct method? Or have I misunderstood something

#

the type as shown here

bronze yoke
#

handItem is nil

glass basalt
#

i see that. Does the event not give the item being equipped properly?

bronze yoke
#

also getType() returns internal item name

glass basalt
#

shoot.

bronze yoke
#

never worked with that event before - the wiki can be unreliable but i'd be shocked if that event really didn't pass the item

fast galleon
#

probably an unequip

glass basalt
#

may as well bypass the parameter and just call the item from the player object 🤦‍♂️

bronze yoke
#

it looks like it does pass the item, so it must be an unequip

#

if you start your function with something like if not handItem then return end it should be okay

glass basalt
#

i will try that, thank you kindly

bronze yoke
#

itemtype enum

glass basalt
#

seems to be categories but not the ones defined by the items themselves

humble oriole
fast galleon
#

for key, value in pairs(SuburbsDistributions["all"]) if key:contains("Outfit_") then removeFunc(...) end
wonder if that would work @humble oriole

#

Bullets22Box should be string "Bullets22Box" or "Base.Bullets22Box" ?

glass basalt
#

...how do you actually log to the console
is it this method: writeLog(logger, myLog) and if so, what's the string for the command terminal or the in-game command console

fast galleon
#

print("Hello World")

glass basalt
#

no way

#

is it actually a print statement?

bronze yoke
#

yes

glass basalt
#

the game threw me an error, so I'm assuming it's not simply print() and within a class

bronze yoke
#

it is just print

glass basalt
#

hmm okay, then ill get the error that I'm referring to in a bit

#

strange. now it worked without an issue

#

why did the game then throw an error for the same exact line? this is so frustrating

#

apparently string concatenation is not a thing in lua

#

that was my stupid issue

drifting ore
#

anyone familiar with if getProperties():Val("PickUpLevel") can be set? i thought i seen it was possible but now im not finding anything

bronze yoke
worldly olive
quasi kernel
#

11 mods are officially supported in the patcher now.

#

Snake's included.

worldly olive
#

😮 nice!

quasi kernel
#

Unsure of the stability at this exact moment since I just released an update for it adding 5 mods to the mix, but it should run alright from brief testing.

drifting ore
#

i can say it makes a huge diff prior to update so looking forward to it

#

i dont even use lgr either

#

also has that quick fix for not needing to sow seed packet thing

quasi kernel
#

That's the especially nice thing about this patcher, I made every mod an optional thing.

drifting ore
#

ty for your efforts!

quasi kernel
#

sarghshtrh thank you for appreciating it hehe

#

This has cost me

#

countless hours ill never get back

drifting ore
#

lolol

worldly olive
quasi kernel
#

fr

drifting ore
#

i realized restarting my game 60 times is roughly an hour of my time D:

worldly olive
#

All December and January without modding. Yesterday I came back and I already spent about 10 hours only modding, if not more...

drifting ore
#

didn't think about it before

#

like bare bones no mods lol just hosting a game quick

#

realoading lua for me so hit and miss sometimes also depending on what i change

glass basalt
bronze yoke
#

you can't call fields directly most of the time

dark wedge
#

You are not able to access variables directly, and have to use a getter function to get the value. if there's no get function then you can't check that variable, unfortunately.

glass basalt
#

thats very unfortunate. I just need to check if an item is a TV or not

bronze yoke
#

use item:getDeviceData():getIsTelevision()

#

the item instance not the script item

glass basalt
#

am I able to call that from InventoryItem?

bronze yoke
#

sort of - it's on Radio, an InventoryItem subclass

glass basalt
#

looks like I can, if the parameter passed by the event includes it

#

I will try it out

humble oriole
# fast galleon Bullets22Box should be string "Bullets22Box" or "Base.Bullets22Box" ?

does it need to be explicit when it's base?

Also, I have a pretty big question about IsoObject containers. I'm running into an issue when I remove items from the isoobject on the server side, I have to wait a short period of time before I'm able to put items into that container again or else I get an error. I was able to lower that time with a request sync, but I'd love to get rid of it completely. The error has to do with addtoItemSendBuffer, it's like after I remove items from the inventory it isn't ready yet to receive items.

glass basalt
#

omg it actually works now 😭 I spent 4 hours suffering on this stupid condition check
albion you will be my top credit if I get this mod working and published

tacit tree
#

Could someone help me figure out why my gun isn't appearing when the character equips it in game? Symptoms:

No gun model appears in hands or on the back
Character acts like the hands are empty (shoves instead of pulling a trigger while aiming)
While the invisible weapon is equipped, aiming does play the "M16BringToBear" sound I defined in the weapon's script file.
Magazine context menu does not have an option for "Load/Insert into gun"

glass basalt
#

do you have the model instantiated in a txt file? stupid question, but just to make sure

tacit tree
#

Define instantiated

glass basalt
#

the model is defined in its txt file

#

since models have a .x or .fbx and a .txt file that points Java to it

bronze yoke
#

it sounds like an item script issue to me

tacit tree
#

So... trying to imitate vanilla, I have 2 files in /media/scripts:
One script for weapon stat definitions
One script for item models

I tried putting both the model definition and the item definition in 1 file like Blackbeard's tutorial said to do but it didn't work.

bronze yoke
#

can i see the item script? i think if the model was the issue it'd still behave normally otherwise

#

there just wouldn't be a model

tacit tree
#

Sure, screenshots incomming:

glass basalt
#

are you using blackbeard's tutorial for the nuka cola mod? because it is outdated to some degree

#

i recommend downloading a mod that adds in one firearm (like the fallout ones) and look at its file structure

#

& files

tacit tree
#

Uh... the other one is too big, how do I blockquote text in discord?

glass basalt
#

`

#

text

#

`

#

or three of those in order, i think

tacit tree
#

Too much text for discord to handle aparently.

red tiger
#

Oh man..

#

Translating Lua string library to JS string lib.

#
let reversed = 'Hello, World!'.split('').reverse().join('');
#

lol

glass basalt
#

Jab, i saw you working with TypeScript and lua files. What are you trying to do?

bronze yoke
#

does anyone know if comments with # are allowed in scripts? i've never seen that before and the parts below the first one seem to be the parts that are broken

glass basalt
#

I don't think they work

#

the syntax is // and /* */ i believe

#

java comments

tacit tree
bronze yoke
#

yeah that's what i thought

red tiger
#

I made it possible to mod PZ using TypeScript. I'm rewriting one of the three transpilers it runs on.

tulip wolf
#

Guys this item is from a base game right?table.insert(ProceduralDistributions.list["MeleeWeapons"].items, "Base.medbag2"); table.insert(ProceduralDistributions.list["MeleeWeapons"].items, 1.0);

bronze yoke
# tacit tree

also, is this in scripts/ or a subfolder? this won't be causing your issue but if it's scripts/models_items.txt, that is a very generic name and mods with the same file names will cause conflicts
you should always be careful about this, because of steam workshop weirdness you can't safely change your file structure after release

#

scripts/mymod/models_items.txt is fine of course

glass basalt
glass basalt
tulip wolf
red tiger
#

I want those in my coding environment and Lua lacks this as a language because it isn't designed for this sort of thing.

#

You know what you're working with. Literally.

glass basalt
red tiger
#

It'll tell you if you apply something wrong.

#

When PipeWrench updates to an updated release of PZ and your code doesn't call a revised API call correctly, the compiler will immediately tell you this.

#

You won't need to thumb around to find out why, if you know the offending code to start with.

#

You will save countless hours of time debugging.

glass basalt
tulip wolf
glass basalt
#

i find it funny that PZ is using lua in ways it is not intended, its very specific 🤣

drifting ore
#

if you import, i dont think you need prefix

#

only without i believe

glass basalt
#

otherwise you can also use the prefix, without importing, i think

drifting ore
#

you make a prefix by using module mymodulename

glass basalt
#

it would otherwise throw an error if the mod module doesn't exist

tacit tree
tulip wolf
#

anyway going to try both ._.

drifting ore
#

either way works

red tiger
#

This was painful lol.

glass basalt
#

it is possible to constructors for objects from the java classes? If I want to create an object in the world
or do I need to use a method that constructs it for me

#

example: PocketTVIso = IsoTelevision(cell, square, nil);

tulip wolf
glass basalt
glass basalt
red tiger
#

For Java constructors, use .new()
For Lua constructors, use :new()

#

It's a technical gotcha.

glass basalt
#

ah good to know
if I keep that variable local, will running that same function over and over overwrite the variable? I want the event to only have one instance of that object at all times

quasi kernel
#

Working on a Better Batteries update too because apparently the way I was going about it in the past made duct tape in a friend's server godly

#

Near infinite duct tape!!!

glass basalt
#

not a bug its a feature

quasi kernel
#

yess

tulip wolf
# glass basalt you only need the import statement if you have `module moduleName {}` in a .txt ...
require "Items/ProceduralDistributions"
require "Items/VehicleDistributions"
require "Items/ItemPicker"

module PWp

table.insert(ProceduralDistributions.list["MeleeWeapons"].items, "PWp.Supersword");
table.insert(ProceduralDistributions.list["MeleeWeapons"].items, 5);
table.insert(ProceduralDistributions.list["Foods"].items, "PWp.Heineken");
table.insert(ProceduralDistributions.list["Foods"].items, 5);

--    table.insert(Distributions, 1, distributionTable);
    
    
local function isMod(mod_Name)
    local mods = getActivatedMods();
    for i=0, mods:size()-1, 1 do
        if mods:get(i) == mod_Name then
            return true;
        end
    end
    return false;
end
glass basalt
#

I don't have a lot of experience with the imports, I'm sorry if I am confusing you with my amateurity 😭

tulip wolf
red tiger
#

Did a ton of cleaning on my string stuff.

#

:D

#

Looks way better for string literals.

#

0-index translation also.

glass basalt
#

ahhh, i think I have hit a wall with what I am trying to accomplish
It is possible to link an IsoObject (an object placed in the world) with an InventoryItem (the item that lets you place that object)?
I don't know how the game handles it, and I essentially just want to make an InventoryItem have some properties of an IsoObject (using the player as a reference point in its "position")

fast galleon
#

ScriptParser stripComments

fast galleon
#

Not sure about the buffer thing, what kind of errors happen when you try to add items?

red tiger
#

Got 8 hours in for my code jam weekend so far. :D

fast galleon
#

Kahlua Transpiler

red tiger
#

Planning for 15 min

#

Nah. Lua transpiler

fast galleon
#

split though?

red tiger
#

Split?

humble oriole
# fast galleon Not sure about the buffer thing, what kind of errors happen when you try to add ...
LOG  : General     , 1676159167875> 17,467,539> ERROR: addToItemSendBuffer parent=zombie.iso.objects.IsoThumpable@38ed5454 item=zombie.inventory.types.Food@ef2783a
DEBUG: Multiplayer , 1676159175909> 17,475,573> ItemTransactionManager.receiveOnClient> 2 [ 698125665 : -1 => -1 ]
DEBUG: Multiplayer , 1676159248839> 17,548,504> ItemTransactionManager.receiveOnClient> 2 [ 445151282 : -1 => -1 ]
LOG  : General     , 1676159248939> 17,548,603> ERROR: addToItemSendBuffer parent=zombie.iso.objects.IsoThumpable@38ed5454 item=zombie.inventory.types.Food@7fa4ca8d
LOG  : General     , 1676159248939> 17,548,604> ERROR: addToItemSendBuffer parent=zombie.iso.objects.IsoThumpable@38ed5454 item=zombie.inventory.types.Food@275bfa06
LOG  : General     , 1676159248939> 17,548,604> ERROR: addToItemSendBuffer parent=zombie.iso.objects.IsoThumpable@38ed5454 item=zombie.inventory.types.Food@12942158
LOG  : General     , 1676159248940> 17,548,604> ERROR: addToItemSendBuffer parent=zombie.iso.objects.IsoThumpable@38ed5454 item=zombie.inventory.types.Food@5693fb50
LOG  : General     , 1676159248940> 17,548,604> ERROR: addToItemSendBuffer parent=zombie.iso.objects.IsoThumpable@38ed5454 item=zombie.inventory.types.Food@2e60b04e```
fast galleon
#

lua has no string split

red tiger
#

Yeah. This won't affect the transpiler.

#

Why do you ask? Curious.

fast galleon
#

it just hit me

red tiger
#

If it's because of my use of split, that's generated code to handle a missing string utility in JavaScript.

fast galleon
#

that's like greek to me

red tiger
#

Grabbing food and eating. Might write a format utility that's also not there.

red tiger
#

Lua has some tools that JavaScript doesn't. Vice versa.

#

I have to solve that for situations.

fast galleon
humble oriole
#

How would I do that from the client side

#
function HBGPlungeBiowaste:perform()

    if self.homebiogas:getContainer():getAllCategory("Food"):size() > 0 then
        CBioGasSystem.instance:sendCommand(self.character,"plungeBiowaste", { { x = self.homebiogas:getX(), y = self.homebiogas:getY(), z = self.homebiogas:getZ() }})
    else
        self.character:Say(getText("IGUI_BioGas_ContainerEmpty"))
    end

    self.homebiogas:getContainer():requestSync()

    ISInventoryPage.renderDirty = true

    ISBaseTimedAction.perform(self);
end```
glass basalt
#

are there any mods that create an object that follows the player? as in its separate from the player, and not a vehicle

humble oriole
#

there's a dog one, not sure how great it works

red tiger
#

That dog is scarier than the dogs from silent hill 1.

glass basalt
#

I have found a way to have a "following" object, but its issues are that when the player moves onto a new square, it doesn't remove its instance from the previous square (a logical memory issue), and when my item unequips, it doesn't remove the last instance (fixing it rn)

rigid hull
#

Yo! I'm someone with absolutely no modding experience whatsoever with any game. I'm trying to change a texture or two and essentially make my own personal addon for friends to use. Could I get some help and talk to someone about what I'm trying to do?

glass basalt
#

BUT it doesn't help my issue, as I want to have the object have functions, and not actually appear

glass basalt
rigid hull
#

I'm unsure how to actually access any of those files, how to structure them into a folder, etc.

glass basalt
#

damn, embed isn't working

rigid hull
#

I basically want to change the name of rosewood, and then change the texture of the map you can get to accompany the name I changed it to

undone elbow
#

How to force wake up while sleeping?

glass basalt
#

look at Project Zomboid's media folder

undone elbow
undone elbow
rigid hull
#

dementia

rigid hull
glass basalt
#

the maps folder is the physical positions of everything

#

it doesnt have textures or text

rigid hull
#

got you

#

but I figured it was how I changed map info

glass basalt
#

textures are in their own folder, and the text is in that folder above that i told you

red tiger
#

Wish I could code on this phone

red tiger
#

Too lazy

worldly olive
glass basalt
rigid hull
#

when I change the textures I want to change, and rename things, how do I organize it properly to upload to steam workshop?

glass basalt
#

you organize it the same way it appears in the media folder

#

for the mod info itself, it has a specific folder & file structure that you need to make

rigid hull
#

so I keep everything the same? or do I only include what I want to change?

#

ah okay

glass basalt
#

theres an old tutorial that shows uploading it properly, one sec

thick karma
#

there is a github link showing you the workshop directory structure.

glass basalt
#

This tutorial video will show you how to make a simple drink in Project Zomboid. I will go into the steps involved from start to finish. Read more below.

0:00 intro
1:08 Start
1:44 Searching for images to use in game
2:30 Searching for the Sound Effect
3:06 Creating mod file directory
3:54 Creating mod.info
4:34 Creating a poster
7:14 Adding ne...

▶ Play video
#

I used this to figure out how to upload to the steam workshop

rigid hull
#

ahh okay

red tiger
#

Reminds me that I need to make a tutorial for PipeWrench.

#

Thanks.

thick karma
#

I also used that link when I worked on the textures in Meditation (the other link I sent you), though it was missing some stuff about getting the world models to look right in your hands. @rigid hull

quasi kernel
#

Just updated Better Batteries, fingers crossed that everything doesn't immediately combust and I don't get a bunch of angry comments!

glass basalt
#

that seems to be the only thing steam users are good at

#

complaints and demands

red tiger
#

That's something that I don't deal with because modders are my users.

glass basalt
#

whats a good way to store a variable in memory

tulip wolf
#

ERROR: General     , 1676162706280> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: items of non-table: null at KahluaThread.tableget line:1689.
ERROR: General     , 1676162706280> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: items of non-table: null```
glass basalt
#

two variables, one constanting overwriting the other?

glass basalt
tulip wolf
red tiger
#

Store a variable in the table of your Lua module?

tulip wolf
#

But I don't know how to access the items

glass basalt
#

nvm

tulip wolf
#
table.insert(ProceduralDistributions.list["MeleeWeapons"].items, 5);
table.insert(ProceduralDistributions.list["Food"].items, "PWp.Heineken");
table.insert(ProceduralDistributions.list["Food"].items, 5);```
red tiger
#

I'm drinking and lurking

drifting ore
#

if your module is your mods module then you dont need prefix

glass basalt
#

is line 8 that first line?

drifting ore
#

unles PWp is another mod

tulip wolf
glass basalt
#

try removing the prefix, as Nippy said

red tiger
#

I dream of the day when all the API are intuitive and documented

drifting ore
#

if your items.txt script starts with module PWp then you dont use prefix

#

if you import Base you also dont use prefix Base.

#

only use prefix if the module is not imported or created

glass basalt
red tiger
glass basalt
#

i wish it said somewhere that LuaManager.GlobalObjects is where all of the global functions are, rather than passing it through word-of-mouth

#

because I had no idea until someone told me

red tiger
tulip wolf
glass basalt
red tiger
#

PipeWrench is a prioritization of documentation and type forwarding to combat that very issue.

glass basalt
red tiger
#

It's a node environment for modding PZ with typings of the entire codebase that is exposed for modding.

glass basalt
#

hmmm, it's not possible to write in lua within that transpiler, is it

#

it has to be node and TS

red tiger
#

It tells your IDE what you're working with.

red tiger
#

Lua can be written and interfaces to communicate with Typescript

glass basalt
#

so, could I set my root directory to be the Workshop content folder of a mod, write .lua and .txt files, and PipeWrench interprets all of it with a node server?
something like that? 😅

red tiger
#

More like you can write Lua and Typescript that compiles to Lua.

tulip wolf
#

i am using this code for testing in lua/client, it saves me a lot to test sounds of some items ```-- General mod info
local MOD_ID = "YOUR MOD ID";
local MOD_DESCRIPTION = "adds new items to the game.";
local debugItems = true;


-- Functions



-- Prints out the mod info on startup.

-- Add some items to the player's inventory for testing purposes.
local function giveItems()
if debugItems then
local player = getSpecificPlayer(0);

    player:getInventory():AddItem("modID.ItemNAME");
    player:getInventory():AddItem("modID.ItemNAME");
    player:getInventory():AddItem("modID.ItemNAME");
end

end

-- local function getRandomCondition(_item)
-- _item:setCondition(ZombRand(_item:getConditionMax())+1);
-- end


-- Game hooks


Events.OnGameBoot.Add(info);
Events.OnGameStart.Add(giveItems);

true vault
#

Is there a way to add recipes via Lua, when my own one loads, if it detects other specific mods are "installed"?

red tiger
#

I don't like writing Lua but I know it better than most since I am writing a second transpiler for it.

glass basalt
#

i don't remember how it works, but you somehow refer to the mods installed and check if its enabled

true vault
#

Fair enough. You wouldn't happen to know an example of a mod that does that, off the top of your head, would ya?

Most of the ones I know simply make the patched mod a requirement and assume it's there lolz

glass basalt
#

my brain is blanking rn

#

umm ill take a look

true vault
#

No worries, I can do a search for them; just didn't know if ya knew one already.

red tiger
#

C style syntax is king.

true vault
#

Oh, alright lolz.. I'll take a look at it, thanks skulker

glass basalt
#

i wish this server let me change my server name to my steam one 😮‍💨

true vault
glass basalt
#

lua does all of its dumb syntax for "speed", yet PZ uses it for different reasons

red tiger
true vault
#

That said though, Lua is an excellent choice for what they're doing here. The only HLL faster than Lua, for specific tasks, is C, which is NOT very friendly, especially for new modders to the game to learn...

glass basalt
#

could you imagine ...python instead of lua?

true vault
glass basalt
#

i'd die tbh

red tiger
#

PZ Lua is well beyond the threshold of concern for the scalability argument to be a valid discussion.

true vault
#

Py wouldn't really be an improvement either... same syntax style that's opposite from the mire common languages, and, slower than Lua by a massive degree..

glass basalt
#

hey babe, have you jompiled your Jython jile for your Jroject Jomboid Jod?

true vault
# red tiger Lua isn't for scalability

TBH though, scalability isn't exactly a requirement as far as the game design/concept goes, so although you're completely correct there, it doesn't matter as far as the choice of language to use goes.

quasi kernel
#

As someone that uses Lua regularly because yes, Kahlua just exists.

true vault
# red tiger Kahlua isn't real Lua.

No, but it's still faster tha most other languages, simply due to it's extreme simplicity (which is the main point of Lua in the first place).

quasi kernel
#

Gal does have a point though, Lua is the fastest scripting language so

red tiger
#

It has design flaws because Lua doesn't have a built-in checking solution for OOP -like designs.

quasi kernel
#

When I started adopting OOP for the first time I learned that Lua wasn't all it was cut out to be

#

It made me sad

glass basalt
#

Lua, and every other language meant for scripting

#

but then TS exists and stuff so...

true vault
#

Right and that's what I mean.. For general purpose, Lua is a terrible choice, but if you're making a game that has needs that fit within those limitations, it becomes an excellent choice. As far as PZ goes, it likely fit the bill perfectly at the time.

red tiger
quasi kernel
#

Yeye

undone elbow
#
local option = context:addOption(

Is there a way to get the link to the option AFTER call?

context:addOption(......)
local option = ???
quasi kernel
#

It's possible via funny tables but it's just

#

pleh

#

I'd rather use C# or something for that type of thing

glass basalt
#

I MADE A SPRITE THAT FOLLOWS THE PLAYER
...kinda

true vault
red tiger
#

I use Typescript because it is made for transpilation and provides error detection to keep my code consistent at scale.

quasi kernel
#

It returns the option instance from the function call, either save it in a variable for later or do the top thing.

#

Unless there's some wonk workaround, but knowing zomboid there probably is

bronze yoke
#

context:getOptionFromName("Option Name")

#

else you can look through context.options

red tiger
#

Also afaik my Java to Typescript transpiler is the most advanced Java to Typescript transpiler that exists. XD

quasi kernel
#

Huh, you learn something new everyday.

true vault
red tiger
#

I translate deep generics from the Java language so all PZ typings from it reflects accurately.

glass basalt
quasi kernel
#

I feel bad cuz I'm trying to help then I end up being wrong and it's aaaaa

red tiger
#

I converted to TS but ya know....

quasi kernel
#

I wish I had brAin

glass basalt
#

thoughts?

quasi kernel
#

It haunts you

red tiger
#

Java generics when transpiring is a bitch.

glass basalt
# glass basalt

This isn't even what I'm trying to accomplish argrghhhhhh 🤦‍♂️

red tiger
#

Took me 5 months to perfect.

true vault
quasi kernel
#

I suppose you're right there-

true vault
#

Plus in order to run anything written in TS, you end up having to compile to JS anyways, 95% of them time.

undone elbow
red tiger
quasi kernel
#

Yeah that makes sense

#

Sorry for leading ya the wrong way on accident hehe

red tiger
true vault
quasi kernel
#

I only really know Lua and Java tbh

#

I'm learning a bit of C# and Python tho

#

Python feels really weird compared to Lua-

#

I both love and hate indents being my syntax

red tiger
#

I use TS for what it can do as a mediator not for js syntax sugar.

true vault
# quasi kernel I'm learning a bit of C# and Python tho

I would recommemd learing JavaScript TBH; its the easiest language for learners, despite people saying Py is easier. Py is in fact easy, but unless you plan to never touch any other language, it's terrible to learn because every other language commonly used, is completely different in syntax, compared.

Py is by all rights a good, powerful, and flexible language. Just.. not really great to learn if you intend to learn other languages lolz

red tiger
#

What an insanely useful language TS has been for me over the years

glass basalt
#

is there a method for moving IsoObjects? (as in keeping an object, and not creating it and destroying it)

red tiger
#

If haxe was good I would be using it now.

quasi kernel
#

I've taken a lot of my knowledge from Lua and successfully applied to to Java when I was in school, so that was a pleasant surprise.

tulip wolf
#

It's saying in console function: PWp_ProcDistributions.lua -- file: PWp_ProcDistributions.lua line # 13
(PWp is my mod test)
ERROR: General , 1676165699578> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: items of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1676165699579> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: items of non-table: null

table.insert(ProceduralDistributions.list["MeleeWeapons"].items, 50);
table.insert(ProceduralDistributions.list["Food"].items, "Heineken");
table.insert(ProceduralDistributions.list["Food"].items, 50);``` 
I have to use something like require local/do/item ??
quasi kernel
#

Only reason Python is tempting is because of the number of jobs that'll go "ooga" if you have a cert in it or something.

drifting ore
red tiger
#

UI snd transpilers has become a part of my trade thanks to pz xD

drifting ore
#

you should only have one

true vault
quasi kernel
drifting ore
#

thats it

quasi kernel
#

I enjoy C# endlessly more but that's just how it be

drifting ore
#

then the rest should be fine

quasi kernel
#

Even then I'm still learning it

red tiger
quasi kernel
#

In a nutshell C# just seems like Java but done right.

tulip wolf
true vault
undone elbow
# bronze yoke else you can look through context.options

Seems it works. Thanks!

local TEXT1, TEXT2 = getText("ContextMenu_Sleep"), getText("ContextMenu_SleepOnGround")
local old_fn = ISWorldObjectContextMenu.doSleepOption
ISWorldObjectContextMenu.doSleepOption = function(context, ...)
    old_fn(context, ...)
    -- get last option
    local option = context.numOptions and context.options[context.numOptions - 1];
    if option and (option.name == TEXT1 or option.name == TEXT2) then
        print('Success!')
    end
end
red tiger
glass basalt
red tiger
#

We both know that python doesn't even know what it wants to be

quasi kernel
#

Oh, don't even get me started on how I was gonna have to learn Ruby just to modify my other favorite game

red tiger
#

Watching blender is proof

glass basalt
# tulip wolf I was trying to access the items script folder

`local function AddLootToType(itemName, containerName, itemChance)
local containerData = ProceduralDistributions.list[containerName]
if not containerData then
print("Container does not exist. Are you sure you typed it in correctly?")
return
end

table.insert(containerData.items, itemName);
table.insert(containerData.items, itemChance);

end

-- Example Add
AddLootToType("Item ID", "ArmyStorageElectronics", 1)`
No require required

drifting ore
#

you dont need to require any of your other files unless you are calling anything specifically from them. scripts do not count

true vault
# red tiger I'm laughing way too hard IRL with python rn

Like, I'll admit Py is good with ML amd some other concepts, but beyond that, I don't understand this mad rush to convert perfectly working apps to some new language, just because it's new.. Like, Py is slower than the C's, and provides less system access, resource access, etc... like whyyyyy??? lmao

true vault
red tiger
#

I write transpilers. I'm by definitely insane.

true vault
#

....and they have since switched to JS for the engine scripts, so that's a couple years of my life wasted lolz

quasi kernel
#

OneShot runs on it.

true vault
quasi kernel
#

Absolutely phenomenal game, just wish I could actually understand half the code.

red tiger
quasi kernel
#

o?

red tiger
#

Yup

true vault
#

Well that's a feat in itself... You understand Japanese?

red tiger
#

Back in 28

#

18

true vault
#

Welp, you can tell I'm old because it took me a second to realize you meant 2018, not 1918... LL_facepalm_taiga

red tiger
#

Pre-ukraine, my Russian programming contacts were worth a bit

#

Actually sad now.

true vault
#

We may not be talking about the same thing then Jab; Degica is a Japanese company, not Russian..

red tiger
#

True. I had an opportunity to suv-contract for a Russian friend to type the RPGMaker JavaScript codebase.

true vault
#

Would be kinda surprising either way that they would even consider talking to an outside party too; back in 2008/09 they wouldn't even talk to American companies for the US port of their engine.

red tiger
#

I mean.. I don't blame them.

true vault
#

(they even tried shutting down our forums from what I remember, until they realized that forum happened to be where a massive number of scripts used in games on their engine came from lolz)

tacit tree
#

Does anyone know if there is a problem with non-workshop mods? In testing my problem, I subscribed to a single gun mod, copied the files into my mod and unsubscribed. Then I put my mod in "C:\Users\myusername\Zomboid\mods" and the exact same problem happened... everything works except for an invisible gun model. WHYYYYYYYY

true vault
red tiger
tacit tree
true vault
true vault
# tacit tree It is. Example is the MCX RATTLER mod.

Huh, okay well that kills my train of thought then. Have you downloaded some mods from Nexus to see if their file structure is different? That's probably what what I would check next. I know that mods on Nexus doesn't require the Workshop folder structure, so it may be that..

tacit tree
true vault
#

Aye, and def lemme know if that works; I've been thinking of uploading to there myself maybe too lolz
Make some of my stuff available to non-Steam users too. Plus free download points I can convert to IRL moneh each month haha

#

Alright, welp, time to go re-read that answer I was given forever ago and check into adding recipes dynamically.

glass basalt
#

Should I upload my sprite drawing code somewhere as a resource? It has good potential but I have no clue what for

tulip wolf
#

I'm trying to understand how to generate the item i created from the mod inside the containers

#

still don't understand how the distribution of modified items from mods to containers works in lua

glass basalt
#

The function I posted above injects items into the procedural distribution. I don't know if that's what you're trying to accomplish

#

you simply copy the function and call it

#

and it goes into lua/server/items/Yourfile.lua

tacit tree
#

"attachment world {...}"

What does this function do?

drifting ore
#

oh got it

#

when you place item it's where it sits on that tile

tacit tree
#

Ok, good to know.

This is infuriating. I've literally copied someone else's files that work and put them in my own mod and suddenly it doesn't show the model anymore.

drifting ore
#

did you compare the naming convention used in the scripts themselves?

#

even one cap letter or underscore would do it

tacit tree
#

Yes, I've been over that part with at least 4 different mods as examples.

drifting ore
#

everything after mods should be exactly the same

#

between both

tacit tree
#

What is "WeaponSprite" referencing? Both in game and in files.

tacit tree
#

The entire folder or something more specific?

tulip wolf
#

if weapon> media/textures/2handed or 1handed

#

is the location of the weapon texture

#

I changed the images by photoshop

tacit tree
#

So you are saying that "WeaponSprite = blah" defines the texture to apply as found in /media/textures/blah.png?

tulip wolf
#

yes

#

I changed the texture of a weapon through photoshop, but I don't know if it's the right thing, because i noticed a problem in the drawing

#

example

tacit tree
#

So what does this refer to?

model mygun
{
mesh = weapons/firearm/mygun_model,
texture = weapons/firearm/mygun_texture,
}

true vault
tulip wolf
tacit tree
#

Then what is the difference between texture and WeaponSprite?

true vault
#

A texture is what is applied to the model itself; basically the image that gives it colour, lines, etc.

No clue where a weaponsprite is used

tacit tree
#

Ok... this might be it. In the following function of /media/scripts/mygun.txt, what does the bolded portion need to match? A function? A filename? A variable?

model mygun
{
mesh = weapons/firearm/mygun_model,
texture = weapons/firearm/mygun_texture,
}

true vault
#

That's just the name you want for the model; you reference that in the item definition.

#

So for example... (one sec, grabbing an example from my current mod)

tacit tree
#

So it needs to match:

item mygun
{...}

true vault
#
item PlantFiberCord
{
  DisplayName = Plant Fiber Cord,
  DisplayCategory = Material,
  Weight = 0.15,
  Type = Drainable,
  UseDelta = 0.1,
  Icon = PlantFiberCord,
  WorldStaticModel = PlantFiberCord,
  cantBeConsolidated = false,
}

model PlantFiberCord
{
  mesh = WorldItems/Twine,
  texture = WorldItems/PlantFiberCord,
  scale = 0.55,
}

Notice the WorldStaticModel in the item definition, referring to the model by the same name?