#mod_development

1 messages Β· Page 78 of 1

kindred current
#

hi

#

is there a place to get started?

#

I want to edit the insurgent mod to add more traits

ancient grail
#

You cant edit some other authors mod without permission

kindred current
#

Of course, I won't edit it without permisson (besides I don't have the skills to)

#

but uh

#

just the wkik?

ancient grail
#

U could just make yournown trait mods . You need to check the lua files regarding traits . Then it will depend on how the trait functions

#

You should probably want to look at multiple traits mod before starting to code just to be able to grasp the idea. And learn lua in general

kindred current
pulsar heath
#

im having issues with getFileWriter and reader...
Can read a file and get the data from it, but when i try to write to it... nop... the file remains unchanged.

getPlayer():Say("file: "..tostring(file))
local reader = getFileReader(file, true)
 local line = reader:readLine()
  while line ~= nil do
    -- Split the line into fields
    line = string.gsub(line, ',', '|')
    local fields = {}
    for field in string.gmatch(line, '([^,]+)') do
      table.insert(fields, field)
    end
    -- Extract the values of the Name, Reward Name, Cost, and Status fields
    local name = fields[1]
    local reward_name = fields[2]
    local cost = fields[3]
    local status = fields[4]
    -- Print the values
    print('Name: ' .. name)
    print('Reward Name: ' .. reward_name)
    print('Cost: ' .. cost)
    print('Status: ' .. status)
    -- Read the next line
    line = reader:readLine()
  end
reader:close()
#

this bit works... but after when i do

#

the bit to write the file with an empty string... nothing happens

#

even if its something simple like

getPlayer():Say("file: "..tostring(file))
local writer = getFileWriter(file, true)
writer:write("")
writer:close
#

dont see anything wrong in the code but i suck with lua...

#

i even went the simpler way and try to run the code by just reading 1 line, then closing the reader declaring the writer writing an empty string and closing the file... it reads... but the file isnt modified... and no errors... so im tottally lost

#

i even used pcall to try and catch any error... same thing

#

no errors no changes to the file

ancient grail
#

What error does it show

pulsar heath
#

thats the problem... no errors

#

it just doesnt write the file

#

im prolly missing something stupid and simple... but i dont see what

ancient grail
#

Ow shiiz... Can you try and encapsulate it on a function and just trigger using debug

pulsar heath
#

i started with a function...

#

then broke it down to just code to simplify since i was getting the same problem

#

the debug log shows no error

#

i even added prints for every bit of the code to show in the log what was happening

#

if i create a new file... it creates the file and whatever i pass to the writer shows up... but i cant be creating files for no reason... the point is to use only one file...

ancient grail
#
function ResurrectID()
local Graveyard = getFileReader("Graveyard.ini", true);
if not Graveyard then return end
while true do
local line = Graveyard:readLine()
if not line then
Graveyard:close()
break
end
print(line)
SendCommandToServer(string.format("/unbanid " .. line))
end
Graveyard:close();
GraveDig() -- then flush table data
end
function BuryFool()
local bdDude = getPlayer():getUsername()
local Graveyard = getFileWriter("Graveyard.ini", true, true); 
local bdSid=(getSteamIDFromUsername(getPlayer():getUsername() .. "\n"));
Graveyard:write(bdSid);
Graveyard:close();
SendCommandToServer(string.format("/banid " .. bdSid));
print("RIP: " .. bdDude .. "  " .. bdSid); 
end
#

heres what i have

#

from old proj

pulsar heath
#

hmm im missing 1 boolean it seems

ancient grail
#

ahh thats the append

#

if it overwrites or append forgot which one is true

pulsar heath
#

so i just need to set it to false

#

i think

ancient grail
#

might be

#

try one and youll know which one after that for sure

pulsar heath
#

yeah, will do so... missing one arg... damn... i need to go and sleep... thanks gonna try it out

ancient grail
#

Owryt goodnight

pulsar heath
#

getFileWriter(filename, File Create Boolean, Append to file Boolean)

#

damn... one arg missing...

#

it works now... thank @ancient grail

#

thanks

ancient grail
#

🫑

raw canopy
#

Hi, guys!

Is there a way to execute lua as a command to a server?

My case: I want to give a player not just an item, but a bag of items. Also, I want to be able to do it as a command that could be executed via RCON.

I couldn't find a command like "execute lua", so is Java-patching (adding new server command definition) the only way to achieve this?

ancient grail
#

Create a mod item that when u OnCreate it auto gives all the stuff
Send that item to the player

#

Its either that or create a rcon command using jabs mod

raw canopy
ancient grail
#

🫑

pulsar heath
#

cant sleep while the brain is still working πŸ˜„

so since all the heavy weight will be done by the app i coded in vb.net

local line = ReadReward:readLine()
local rewards = {}
local events = {
  ["zombies"] = function(value) zombieEvent(tonumber(value)) end,
  ["gift"] = function(value) giftEvent(value) end,
  ["airevent"] = function(value) AirEvent(value) end,
  ["random"] = function() RandomEvent() end
}
local action = events[reward_type]
while line ~= nil do
    rewards[#rewards + 1] = line
    line = ReadReward:readLine()
end
ReadReward:close()
if action then
  action(rewards[5])
else
  -- Handle invalid reward type
end
local WriteReward = getFileWriter("rewards.txt", true, false)
WriteReward:write('')
WriteReward:close()

the code above ( apart from a thing or two i still need to add, like the actual functions to the triggered) will be handling the game side bit of the mod , gonna have to credit @ancient grail on the mod, since he unstuck my brain after several hours of me being an utter idiot and not noticing an arg was missing πŸ˜„

ancient grail
pulsar heath
#

and its usually the easier bits that stomp me...

#

a comma out of place or a missing ) or whatever...

ancient grail
#

wasnt really a big deal i just gave you reference and you found the problem and solution on your own

#

lol

#

but thnx man πŸ™‚

pulsar heath
#

well a true master shows the way but not how to walk it

#

thats what you did πŸ™‚

ancient grail
#

stressed im truely far from that panic

#

Anyways does anyone know if i can auto toggle a sandbox

#

Like i have 2 sandbox bool
If on of em is true it sets the other false
Automagically

#

To be more specific
I have an option if it snares the zed and the other is if the zed is killed by the trap

#

I want to make it so that when u choose kill then the snare is auto off

#

I cant seem to find this anywhere

neon bronze
#

hey can anyone help me out? Im tryint to add a context option for the inventory page but it doesnt initiate it

jagged ingot
#

Good morning.

neon bronze
# jaunty marten show the code how you did it
function removeItem(item, player)
    if item:getWorldItem() ~= nil then
        item:getWorldItem():getSquare():transmitRemoveItemFromSquare(item:getWorldItem());
        item:getWorldItem():removeFromWorld()
        item:getWorldItem():removeFromSquare()
        item:getWorldItem():setSquare(nil)
        getPlayerLoot(player):refreshBackpacks()
        return
    end

    if item:isEquipped() then
        local playerObj = item:getContainer():getParent()

        item:getContainer():setDrawDirty(true);
        item:setJobDelta(0.0);
        playerObj:removeWornItem(item)

        local hotbar = getPlayerHotbar(playerObj:getPlayerNum())
        local fromHotbar = false;
        if hotbar then
            fromHotbar = hotbar:isItemAttached(item);
        end

        if fromHotbar then
            hotbar.chr:setAttachedItem(item:getAttachedToModel(), item);
            playerObj:resetEquippedHandsModels()
        end

        if item == playerObj:getPrimaryHandItem() then
            if (item:isTwoHandWeapon() or item:isRequiresEquippedBothHands()) and item == playerObj:getSecondaryHandItem() then
                playerObj:setSecondaryHandItem(nil);
            end
            playerObj:setPrimaryHandItem(nil);
        end
        if item == playerObj:getSecondaryHandItem() then
            if (item:isTwoHandWeapon() or item:isRequiresEquippedBothHands()) and item == playerObj:getPrimaryHandItem() then
                playerObj:setPrimaryHandItem(nil);
            end
            playerObj:setSecondaryHandItem(nil);
        end
    end

    if isClient() and not instanceof(item:getOutermostContainer():getParent(), "IsoPlayer") and item:getContainer():getType()~="floor" then
        item:getContainer():removeItemOnServer(item);
    end

    item:getContainer():DoRemoveItem(item);
end
function removeItems(items, player)
    for i, item in ipairs(items) do
        removeItem(item, player)
    end
end
#
local function RemoveItemContextOptions(player, context, items)
    --if not (isDebugEnabled() or (isClient() and (isAdmin() or getAccessLevel() == "moderator"))) then return true; end

    local container = nil
    local resItems = {}
    for i,v in ipairs(items) do
        if not instanceof(v, "InventoryItem") then
            for _, it in ipairs(v.items) do
                resItems[it] = true
            end
            container = v.items[1]:getContainer()
        else
            resItems[v] = true
            container = v:getContainer()
        end
    end

    local listItems = {}
    for v, _ in pairs(resItems) do
        table.insert(listItems, v)
    end

    local removeOption = context:addOption("Delete:")
    local subMenuRemove = ISContextMenu:getNew(context)
    context:addSubMenu(removeOption, subMenuRemove)

    subMenuRemove:addOption("1 item", listItems[1], removeItem, player)
    subMenuRemove:addOption("selected", listItems, removeItems, player)
end

Events.OnFillInventoryObjectContextMenu.Add(RemoveItemContextOptions)
#

technically its only the removeitemtool from debug but only the inventory one and without the check for debug

#

but it doesnt pop up on the right click

jaunty marten
#

try to add debug print in RemoveItemContextOptions function to check if it's even calls

#

but as I see it should work

neon bronze
#

Yea just found out the mod isn’t getting initialised at all

#

Like the files don’t even load in

neon bronze
#

nope it doesnt work at all

thick karma
#

It triggers them but they still won't see you. They stumble toward the sound.

#

Idk tbh, maybe?

#

I dunno, when I setInvisible it just makes zombies not see me. What does Ghost do beyond making you invisible?

amber fiber
thick karma
#

Even though they can't see you?

#

Or you want them to see you if you make noise?

amber fiber
# thick karma You want them to attack you when they hear you?

Well basically I would like to achieve that I can put zombie Guts on my clothes, the more you got, the harder it becomes for Zombies to notice you, you can walk up clother to them, so they will attack you later xD or only when you do stuff like shoot around.

XD only the zombie triggering change is still ??? For me xD

thick karma
neon bronze
#

If i load up a mod with a wrong id or a non sensical one in its mod.info will the mod not get initialised?

thick karma
neon bronze
thick karma
#

Missing dependencies for one

#

Maybe it needs Mod Options e.g.

#

Check MODS in main menu and find the mod in that list

amber fiber
neon bronze
#

My mod does get loaded in but the only file it has is not initialised

#

And there are no errors or anything

thick karma
#

Hmmm, in my experience, generally if a mod doesn't load and there are no errors, it's either because I'm missing a dependency, or the mod cannot be found because its location is not what the game expects.

#

Did you change mod's id AFTER adding it to server? That would not work

hot patrol
#

Say I want to add my own textures to the Fjord Mustard car mod how would I go about doing so?

#

without overwritting their stuff

neon bronze
#

No im doin the mod on my computer in sp

#

The file does not show up but the mod itself does in the pause menu under mods

thick karma
#

I would inspect the file that isn't showing up carefully for weirdness, like invisible characters that don't seem to go away when you hit Delete.

#

Maybe something odd preventing file from being read at all or throwing errors.

neon bronze
#

You mean in the name or in the file itself?

grizzled cedar
#

I need help on exiting the interior of the bus in the rv interior mod

jaunty marten
#

mb u have conflicts

jagged ingot
#

Hmm I think I may have an idea on how to save some memory in the game with a Java edit. If I end up testing it, I'll mention the results.

#

It has to do with the core of the game's render engine.

#

Am doing deep edits to the render engine today. πŸ™‚ A lot of fun.

#

An "Optifine" for PZ might happen if I keep walking through it.

neon bronze
hot patrol
#

Can someone help me with adding car textures to the autotsar mods?

tardy wren
jagged ingot
#

Yeah stuff like zombies and model animation states.

tardy wren
#

I wonder what will stop working after the overhaul

#

But seriously, they're rewriting it

#

A few blogs past there's a vid showing it

jagged ingot
#

Tried to look for it. =/

polar prairie
#

now with laser attachment.

mellow karma
#

Does anywhere know the default path for getModFileWriter? I've saved info in a file and can pull that information back up but I can not find the file on my pc. I'm hosting a local dedicated server.

#

Nevermind, I found it. I thought I had checked /user/zomboid

#

Nevermind again. The file is written to your main mod folder, with mod.info.

ancient grail
ancient grail
tardy vessel
#

hello I am having an issue with my one of my first uploaded mods from the workshop. It works for single player but when I try and enable the mods on my server I get an error "server has stopped during launch (NormalTermination)". Any reason this might be? Thank you.

#

I found my problem. the visibility for the mod was friends only and I fixed it by making the mod public.

limber oar
#

Is there a way to define male/female hairstyles in HairOutfitDefinitions? I know it can be done in ZombiesZoneDefinition w/ maleHairStyles= and femaleHairStyles= but I'm not aware of similar segregation on the outfit level.

thick karma
ancient grail
limber oar
#

Honestly at this point I'd settle for just doing it in ZombiesZoneDefinition, but maleHairStyles and femaleHairStyles don't seem to work as expected either...I keep getting dudes spawning in with afros and stuff even when I have it set to a 100% chance of using one hairstyle for guys.

#

I even tried splitting out the men and women into two completely separate outfits and just defining it that way, but interestingly, it seems like even if the "chance" defined in ZombiesZoneDefinition adds up to 100, restricting the gender of a spawnable outfit introduces a chance of spawning a random zombie if it rolls opposite.

#

So, for example:

#
    TestFemale = {
        name="FemaleOutfit",
        chance=50,
        gender="female",
    },
    TestMale = {
        name="MaleOutfit",
        chance=50,
        gender="male",
    },
}```
#

This should, at least by my understanding, force only TestFemale and TestMale (w/ a 50% chance of either), with no chance for random zombies, but it actually seems to create a 25% chance for TestFemale and 25% for TestMale with 50% chance to spawn a random zombie when the roll fails to hit the preferred gender on both.

ancient grail
#

i dont think the chance is percent based

#

its just the chance

#

imagine the chance is like a ticket the more ticket you have the more chance of winning

limber oar
#

The dev comments say:
-- Chance at 75 means 75% of the zombies spawning (except mandatory) will have this outfit, the other 10% will have generic, the total chance of them all should be <= 100

ancient grail
#

but i could be wrong

#

ahh i see

limber oar
#

In that particular example 10% is left "undefined" to fill the generics, but the current version of my mod fills to 100% to cut out the generics and it works fine

#

It's just trying to control these damn hairstyles that is -- pardon the pun -- leading me to rip my hair out

#

AFAIK you can't set gender-specific hairstyle restrictions in HairOutfitDefinitions and the gender-specific restrictions in ZombiesZoneDefinition don't seem to work. So, you have one pool of hairstyles for both genders to pull from. But the individual hairstyle chances together can't exceed 100, and if there are female or male-specific hairstyles in the pile, it just ignores those and counts it as random, so e.g. you have a 50% for Donny and 50% for Long and it will spawn your guy with Donny 25% of the time despite the fact that Donny is the only male haircut in the pile...

#

And you can't set Donny to 100% without removing all the other hairstyles and thus forcing the females to go bald...

hollow sand
#

Is there a mod that allows admins to enforce moodles onto players?

ancient grail
#

i couldnt find any on test that checks if the food is rotten and if it is then it can be used to for cooking

#

anyone knows ?

jagged ingot
#

Spent my entire day modding but I got as much done as I wanted to.

#

I have GLSL shaders for diffuse and backdrop for UI.

ancient grail
#
    recipe Empty Griddle Pan
    {
       destroy GriddlePanFriedVegetables,

       Result:GridlePan,
       OnGiveXP:Recipe.OnGiveXP.None,
       Time:40.0,
       Category:Cooking,
       Sound:EmptyPan,
       AllowRottenItem:true,
    }
fast galleon
#

I wasted a few hours trying to use Isogridsquare:discard() to reset erosion data but nothing good happens

ancient grail
#

found this now i need to apply it on stew and soup but the thing is tthose are evolved recipe afaik

jagged ingot
ancient grail
#

evolvedrecipe Soup
{
BaseItem:WaterPot,
MaxItems:6,
ResultItem:PotOfSoupRecipe,
Cookable:true,
Name:Prepare Soup,
CanAddSpicesEmpty:true,
AllowRottenItem:true, /* <<<<<<<<<< will this work??? */
}

ancient grail
vast nacelle
#

Don't Evolved Recipes already allow some amount of rotten food based on your cooking level?
I imagine if that does work, it'd just make all rotten food usable regardless of level.

jagged ingot
#

Kind of sucks that what I'm working on is so technical and deep modding but yeah the result will be amazing.

#

For those versed in render coding I'm passing the off-screen FBO texture to a shader for backdrop rendering for UI.

#

I'm working on having options to select a shader for a UIElement or the like.

#

So UI drawing can be offloaded to shaders and be able to do a lot more in realtime.

#

To sum it up: I want to do this in PZ:

#

Am half-way there. :3

ancient grail
#

if you have that trait then you can cook rotten no matter what cooking level

jagged ingot
#

Oh and to show I have a diffuse shader for UI too:

#

AFK for probably a week. Cya.

ancient grail
rain shard
#

Hi guys! I'm trying to search for a function that grabs the character's name and not the account username, currently trying to write out a way to replace usernames on the minimap for nearby players for character names

unborn citrus
#

How would I start making mods?

ancient grail
rain shard
drifting ore
#

Blacksmith:addXPBoost(Perks.Forgaing, 3);
is there something wrong with it

bronze yoke
#

Forgaing?

ancient grail
# unborn citrus How would I start making mods?

https://pzwiki.net/wiki/Modding:Lua_Events https://theindiestone.com/forums/index.php?/topic/2530-mod-permissions/ https://github.com/FWolfe/Zomboid-Modding-Guide https://steamcommunity.com/id/Dislaik/myworkshopfiles/?section=guides https://projectzomboid.com/modding/index-files/index-1.html https://gist.github.com/Konijima/7e6bd1adb6f69444e7b620965a611b74 https://theindiestone.com/forums/index.php?/topic/15188-item-and-recipe-script-variables-brief-description/ https://www.lua.org/pil/contents.html

limber oar
#

What kind of mod do you wanna make?

bronze yoke
#

i think it's called PlantScavenging anyway

unborn citrus
#

At the moment at least

#

I don't have much coding experience unfortunately

limber oar
#

Good luck! Trick is to start with a small project, and then use the skills you learn from that to build out incrementally.

ancient grail
unborn citrus
limber oar
unborn citrus
#

I'll look around for it

#

My big goal over time is to recreate the Darkwood map in PZ

vast nacelle
limber oar
#

I've been smashing my head against hairstyles all day and am still no closer to solving my problem than before

unborn citrus
#

I just gotta wrestle with ADHD

unborn citrus
limber oar
#

Alright, I'm 8 hours in, I've tried everything, nothing works. I'm fairly convinced at this point that the feature is broken. Has anyone actually gotten maleHairStyles and femaleHairStyles working in their ZombiesZoneDefinition?

#

It should not be this difficult to set different hairstyles for male and female zombies but apparently it is.

ancient grail
#

Check out authentic z

#

Peach added loads of zeds i bet it included hair

limber oar
#

One of the first places I looked. They don't define any hairstyles in ZZD, only in HairOutfitDefinitions, and in all those cases it's WAD because the outfit is gender-limited, so there's no problem of male and female hairstyles being glomped together into a single outfit definition.

#

I tried splitting into male and female outfits but then that runs into the aforementioned issue wherein the area starts getting a bunch of random zombies because of the spawn roll system.

#

So it seems like, barring a fix/workaround that I've not yet found, I have to choose between either:

  • Defining hairstyles for the male and female, but diluting the zone with a bunch of random generic zombies
  • Keeping the zone's zombie distribution as I want it, but turning a bunch of them bald because the hairstyle roll doesn't ignore opposite gender hairstyles and will just generate a bald head instead if the hairstyle it hits is ineligible
#

This can't be right, but I cannot for the life of me figure out any other options.

#

It's especially frustrating because this should be incredibly easily handled by simply defining the male/female hairstyle pools w/ maleHairStyles and femaleHairStyles but those just don't seem to do anything at all.

drifting ore
#

What does this mean?

last flax
drifting ore
#

oh ok thx

ancient grail
#

Uou cant just put files there like zips or exe or whatever theres a structure

drifting ore
#

i did everything correct and i tryed i tryed downloading it and it doesnt work

thick karma
#

@ruby urchin Hey, came to my attention today that my custom animation is not visible to other players when I do it. Only visible locally. Have you perhaps solved how to communicate the animation to other players? Would I need to tell the server to tell all clients to set my animation variable locally?

pulsar heath
#

i had a similar problem with the integration

#

the target of the event would see the zombies... every other player would not

thick karma
#

Okay so if I just do the player:setVariable calls server side, the animation will play for everyone?

pulsar heath
#

you can make the call locally

#

the code has to be ran server side

drifting ore
#

im having a panic and heart attack

#

is this correct

pulsar heath
#

you can try something simple as to keep your lua scripts in the shared lua folder

#

remove the poster.png

#

thats the wrong place for it πŸ™‚

thick karma
pulsar heath
#

mod code can be ran locally or server side

thick karma
#

You mean in client or server right?

pulsar heath
#

thats why you have the client , server and shared folder inside the lua folder

#

if you only have code on the client, its client only

#

server server only and shared both

thick karma
#

gotcha I just wasn't sure if you meant clientside or something else when you said locally... That's why I was confused how I could run it clientside and serverside... but you meant run it in shared?

#

And that will be fine?

pulsar heath
#

anything you put on shared will be available on both server and sp

thick karma
#

Right

pulsar heath
#

client only sp, it will work

#

but nobody else will see it

#

only the player itself

thick karma
#

Understood. I will attempt to make it visible in MP by moving some code to shared.

pulsar heath
#

im a lazy bastard an i just stick everything into shared when making mods that can be used on a server or a sp

#

and

vast nacelle
#

Any know if you can stipulate which version or tint of a clothing piece an outfit should use in the clothing.xml?

drifting ore
#

where do i put the media folder

#

do i put it in Contents\buildings\creative\mods

#

???

vast nacelle
#

Contents/mods/[YourModName]/media

#

For example

drifting ore
#

and media stay in the for Main folder folder

#

correct

vast nacelle
#

preview and workshop should be in the same folder as Contents
media should be in a folder alongside mod.info in Contents/mods

drifting ore
#

I lost braincells

craggy furnace
#

I can do that for you

ancient grail
ancient grail
dark wedge
# thick karma <@390594866511609856> Hey, came to my attention today that my custom animation i...

I know I am a bit late, but if it is a TimedAction you need to use the following to set the Animation variables in the Action:

self:setAnimVariable("Variable", "Value")
...```
Accepts boolean and strings, this syncs the animation state for the TimedAction across MP.
Setting the variable directly on the character i.e. `character:setVariable()` does not sync over multiplayer, regardless of where the code is located at. You need to do this yourself
thick karma
thick karma
ancient grail
dark wedge
dark wedge
#

or something like that

ancient grail
#

How do i do that exactly?

#

Create a new xml file? Or lua? Is it possible to do that on lua

#

I wanted the duration to be configureable

#

Via sandbox

dark wedge
# ancient grail How do i do that exactly?

You could 100% do this via singleplayer, for multiplayer it would take some sync work on your part. In your Action definition (XML), just set:

    <m_Name>NAME</m_Name>
    <m_AnimName>ANIMATION_NAME</m_AnimName>
    <m_SpeedScale>SPEEDVARIABLE</m_SpeedScale>```
Then in your action or whatever, it would be:
```character:setVariable("SPEEDVARIABLE", 5)```
Or whatever you wanted the speed to be.
ancient grail
#

Im using the default stagger animation

#

Push from behind

thick karma
# ancient grail Pls do share the code

Client:

Yogi.reportAnimation = function(displayName, state)
    local arguments = {
        displayName = displayName,
        state = state
    }            
    sendClientCommand("Meditation", "Animation Toggle", arguments)
end

Yogi.acknowledgeAnimation = function(mod, command, arguments)
    if mod ~= "Meditation" or command ~= "Animation Toggle" then return end

    local displayName = arguments.displayName
    local state = arguments.state
    local buddies = getOnlinePlayers()
    
    for index = 0, buddies:size() - 1 do
        local buddy = buddies:get(index)
        if buddy:getDisplayName() == displayName then
            if state then
                buddy:setVariable("Meditative", state)
            else
                buddy:clearVariable("Meditative")
            end
            return
        end
    end
end

Events.OnServerCommand.Remove(Yogi.acknowledgeAnimation)
Events.OnServerCommand.Add(Yogi.acknowledgeAnimation)

Server:

local function changeAnimationState(mod, command, player, arguments)
    if mod ~= "Meditation" or command ~= "Animation Toggle" then return end    
    sendServerCommand(mod, command, arguments)
end

Events.OnClientCommand.Add(changeAnimationState)

I pass true for state when activating the animation and false for state when deactivating the animation; I might be able to pass nil for state and clear variable by setVariable(name, nil) but I am too tired of experimentation to make sure it works lmao so probably not bothering for now.

ancient grail
#

Gotcha ill try this

dark wedge
dark wedge
ancient grail
#

Ow snap

#

That complicates things

Can i make like the fall and the stand up 2 diffrent thing and just the layong on the ground is the configureable speed

#

And im aiming for mp . Cuz my version already works sp

Like i mentioned its not synced

upper oak
#

So I'm working on a mod for a different character model and I can't seem to rescale the model. If I scale the Bip01 skeleton root and mesh together, when the game starts the model seems to be scaled to normal size no matter how I scale it.

But if I just scale the mesh, then it really messes up the animations since the skeleton is mis-sized for the mesh.

  • okay, I figured out I just needed to "apply transforms" in Blender. But doing that results in the character being stretched out. I think I need to rescale all the animations for this character?
dark wedge
ancient grail
#

Hold on

#

Here sir

#

@dark wedge

#

SLR

ancient grail
dark wedge
# ancient grail Hold on

So, you can definitely turn these into TimedActions and get better results, instead of it being a Timer. Essentially you would replace all of your:
pl:setVariable() calls into the appropriate TimedAction:

self:setAnimVariable("BumpDone", true) -- replaces player:setVariabla()
self:setActionAnim("BearTrapped") -- replaces player:playerEmote()
...etc...

All of the other player function calls (like pl:setBumpType()) would be done in the start() function of your TimedAction too. Those should be synced by the game
The only thing is the speed, which you will need to sync yourself if doing MP. But using that example @thick karma posted is a good way to get that variable to sync, and for that each player will need to have the player:setVariable() call made.
You will also need to convert your Emotes into Actions (just rename the folder to actions ) and change the condition <m_Name>emote</m_Name> to be <m_Name>PerformingAction</m_Name> The value for that condition should be what you want to set in setActionAnim()
Hope that makes sense, tried not to make a page and a half in this channel but still give info. lol

ancient grail
#

Ye i tried doing the timeactio. By using the one i did before as template but i failed so i reverted to this way for now

ancient grail
#

I mean the emote. The problem with the emote however is that u can still move or cancel right

upper oak
ancient grail
#

If theres a way for me to create a custom anim that cant move and use any emote then that might be useful

I still dont get much of whats goin on with xml but thnx for the advice i saved it as notes ill look at it again when im back doing this

#

The bip thing right maybe i misunderstood you

thick karma
#

@dark wedge I have a head-scratcher for you if you're bored and lurking lol

thick karma
#

I am trying to apply a function when the amount of light in the player's general vicinity is below a certain threshold. The catch is that the function applies light to the player's general vicinity, such that continuing to perform this calculation using, e.g., player:getSquare():getLightLevel(player:getPlayerNum()) will continue to yield opposite results in a dark space; the light function will be triggered, then disabled, then triggered, then disabled, etc.

dark wedge
thick karma
#

So the question becomes: how do I use the player's overall visibility or the overall lighting of the player's current location (even their square) in determining whether to continue lighting that square if the lighting of the square affects the condition of whether the square continues to need to be lit?

dark wedge
thick karma
#

Hmmm changing threshold based on whether light is on... I'll consider this. Might actually work better than I thought it could at first... I'll give it some thought. At first I thought everywhere I went with my light reported a 1 at my feet which was not informative, but I did find a few places that reported less and I forgot to revisit this idea...

#

(1 on 0 - 1 brightness scale, which I thought was inevitable due to standing on a light source, but later it proved not to be... I found some places I could stand and only get .7, .85, etc.)

#

I guess I could require the lighting to be consistently different for a certain number of frames in a row to prevent flickering when walking in and out of dark corners or something

dark wedge
#

Oh, that would make sense that it would be more consistently showing 1 on the square you are on. Maybe you can get the light of the square in front, or to the side of you if there is a wall in the way or something?

thick karma
#

Yeah the math gets complicated fast there. Is there a wall, am I in a room, is the other side of the wall outside my room, etc. Oof. Been considering looking into that more deeply but was hoping for a clever creative solution that doesn't require so many calculations per event.

dark wedge
#

If you get the adjacent square by getting the player's direction, you can use the "isWallTo" to check that relatively quick. it would be a bit of extra work, but possibly more accurate to check the external light level there if you are generating light

thick karma
#

Yeah I see what you're saying

#

Just get a little further from the source and it'll be a more consistent difference from its unlit state in all/most unlit states (except I guess if I'm in an extremely bright area).

#

I guess I could isWallTo in the forward, left, and right direction and average them pretty fast. Maybe that data would be more reliably useful, given possibility of standing in corners and stuff.

#

if there's no wall, check brightness, add to avg

#

maybe 2 squares away each

#

Idk getting too tired to experiment fully but can't resist urge to brainstorm lol

dark wedge
#

I like that. if you're going 2 squares away though, i'd just get the immediate radius around you.

thick karma
#

I hear you, I already have a radial loop but I think it's misleading because of squares that get reported dark behind you

#

Actually

#

Nah I need to fix something lol

#

Damn it too tired to write right

dark wedge
#

I feel that. I'm having a hard time focusing on writing my own code. ha. i keep getting lost in all of the tabs i have open

thick karma
#

lol jesus I am just going to show you

#

embarrassing lmao

#

I will delete it after

dark wedge
thick karma
#

Average light level around player, no wall checks:

Darkvision.lighting = function(player)

    local x, y, z = player:getX(), player:getY(), player:getZ()

    local total = 0

    for xShift = -3, 3 do

        for yShift = -3, 3 do

            local square = getSquare(x + xShift, y + yShift, z)

            local light = square:getLightLevel(player:getPlayerNum())

            total = total + light

        end

    end

    return total / 49

end
dark wedge
#

All of the light! Forever! ha

thick karma
#

And then when I ran the code and saw the same number a lot I figured gee nothing is wrong here

ancient grail
#

Ok thnx ill try to copy the stagger animation and replace the animation

thick karma
#

But yeah I'll add isWallTo checks that would be a nice touch... maybe only go out to -2, 2 with isWallTo checks and see how it runs

#

Don't wanna go too crazy here

ancient grail
dark wedge
#

For sure. You can also check if a square is outside, and do things accordingly.

thick karma
#

This seems to be yielding a number I could possibly work with:

Darkvision.lighting = function(player)
    local x, y, z = player:getX(), player:getY(), player:getZ()
    local origin = player:getSquare()
    local total = 0
    for xShift = -2, 2 do
        for yShift = -2, 2 do
            local square = getSquare(x + xShift, y + yShift, z)
            if not origin:isWallTo(square) then
                local light = square:getLightLevel(player:getPlayerNum())
                total = total + light
            end
        end
    end
    return total / 49
end
ancient grail
#

Within the xml? I can do it on lua tho
But iwould still like the traps to function indoors so that wouldnt be necessary

kindred current
#

oh yay

#

I can make the edit

#

the mod author says it's fine in his faq for the mod

ancient grail
#

Cool but would still be cool to credit him tho

kindred current
ancient grail
#

So that we sorta help each other out and all that

#

Yep figured πŸ™‚

kindred current
#

I credit people who just provide technical help as well

ancient grail
#

🫑

thick karma
#

I actually tell people not to use other people's mods in my mod descriptions

#

😈

#

lol jk obviously

pulsar heath
#

i usually tell ppl to use my mods at their own risk πŸ˜„

drifting ore
#
    local playerOne = getPlayerByUserName("One")
    local playerTwo = getPlayerByUserName("Two")
    playerOne:say("Hello player two")
    playerTwo:say("Hello player one")

I'm missing something real obvious here... I'm trying to write a MP mod for the first time and trying to access the 2nd player is a nightmare. So I tried using getplayerbyusername to ease the process since I know the username in this case

#

This is inside a basic function

fast galleon
#

The problem I had yesterday after discard square is, after exit / enter chunk the square become an invisible blackness. It blocks from entering it and with no clip it disappears him.

shadow geyser
tame mulch
fast galleon
#

After teleporting the square gets some random objects

#

Aiteron how to reset erosion data of square

drifting ore
shadow geyser
#

by function i meant the getPlayerByUsername function

#

im not sure, haven't used those functions personally it a while

tame mulch
shadow geyser
#

the say function definitely work client side, idk about from serverside

fast galleon
drifting ore
#

I'll be completely honest I read what the difference between those 3 folders is but I figure it's easiest to just put all in shared and forget about it (I know it's dumb but at this point idk what else πŸ˜‚ )

shadow geyser
#

you would need to send a command from the server to the client

drifting ore
tame mulch
# fast galleon <@460779707797995521>

What you mean "data"?
You can disable erosion on square

square:disableErosion()

and remove erosion ("wall vines")

square:removeErosionObject("WallVines")
fast galleon
#

e.g commented out code in vanilla
square:getErosionData:reset()

tame mulch
fast galleon
#

it's not exposed?

tame mulch
shadow geyser
# drifting ore Thank you as well ❀️

not sure if there is a better example, but take a look at ISHealthPanel.lua and clientCommands.lua. at the very bottom of ISHealthPanel.lua, you can see how the client receives a command from a server, and from clientCommands.lua you can see how sendServerCommand is used to send the command from the server to a client

fast galleon
#

Deleting all objects, is acceptable loss, but I sure I could just add them back.

tame mulch
fast galleon
#

    --local slice = SliceY.new()
        --local newSq = IsoGridSquare.getNew(cell,slice,x,y,z)
        local newSq = oldSq
        --local newSq = cell:getOrCreateGridSquare(x,y,z)
        newSq:setX(x);
        newSq:setY(y);
        newSq:setZ(z);
        newSq:getObjects():add(oldFloor)
        --newSq:addFloor("blends_natural_01_64")
        newSq:RecalcProperties()
        chunk:setSquare(wx,wy,z,newSq)
        cell:ConnectNewSquare(newSq,true)
        --newSq:FixStackableObjects()
        --createTile("blends_natural_01_64",newSq)
        --DoTileObjectCreation(IsoSprite var0, IsoObjectType var1, IsoGridSquare var2, IsoCell var3, int var4, int var5, int var6, String var7)
        newSq:RecalcAllWithNeighbours(true)
#

it seems to break when I exit the chunk, doing different combos seems to produce desired effect.

ancient grail
tame mulch
ancient grail
fast galleon
#

No, it doesn't reload the chunk

tame mulch
ancient grail
#

Would that be possible to do? Like restore containers via lua

tame mulch
#

but it restore 10*10 area

#

with walls, floor, etc

ancient grail
#

Do we have such plugins? Cant we manually delete the chunk instead

fast galleon
#

I still use your lock picking mod, a bit edited obviously but can't play without it. β™₯️

ancient grail
#

I use AuD alot . Edited too for debugging

ancient grail
#

I actually know how to do it was just wondering if it would be possible lua side

#

For admin convinience
Like toss a debug function they can just run

#

It takes a long time to restore it with the chunk delete method

fast galleon
#

If you feel adventurous, check how vanilla deletes all map files from a save.
manipulateSavefile command.

ancient grail
#

Hmmmm... Ill pin that thought . Thnx

rustic grove
#

question:
Is this page incorrect for the player parameter? https://pzwiki.net/wiki/Modding:Lua_Events/OnFillWorldObjectContextMenu
Asking because if do this:

    print(player:getX())
end

Events.OnFillWorldObjectContextMenu.Add(OnFillWorldObjectContextMenu)```

I get this:

STACK TRACE

function: OnFillWorldObjectContextMenu -- file: vendingMachineTest.lua line # 163 | MOD: Vending Machine Test
Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@8c04f4fb
function: createMenu -- file: ISWorldObjectContextMenu.lua line # 1543 | Vanilla
function: createMenu -- file: ISMenuContextWorld.lua line # 50 | Vanilla
function: createWorldMenu -- file: ISContextManager.lua line # 28 | Vanilla
function: doRClick -- file: ISObjectClickHandler.lua line # 60 | Vanilla
function: onObjectRightMouseButtonUp -- file: ISObjectClickHandler.lua line # 379 | Vanilla

LOG : General , 1673259707910> Object tried to call nil in OnFillWorldObjectContextMenu
LOG : General , 1673259707994> creating new sourcewindow: C:/Users/<meh>/Zomboid/mods/VendingMachineTest/media/lua/client/vendingMachineTest.lua

if I just print the player parameter out while playing Solo it shows as 0. So instead of the player parameter being an IsoPlayer is it just the index of the player?
vast nacelle
rustic grove
ancient grail
#

Dont add print

#

It will spam it

#

Ow sorry om wrong

#

It will only print ehen u click the context. I misread

#

I thiught the print was outside the context

#

Cuz theres a mod that did this
Which reminds me

@sour island how do i use fingerprint
It still doesnt show the mod that prints

rustic grove
#

also, thanks to you folks I learned something else

ancient grail
#

I forgot to ask u this ... Damn i have so many stuff i need to do... stressed angry

rustic grove
#
local function OnFillWorldObjectContextMenu(player, context, worldObjects, test)
    -- Your code here
end

Events.OnFillWorldObjectContextMenu.Add(OnFillWorldObjectContextMenu)

how did I not know there's color coding for languages in discord πŸ˜‚

calm depot
#

it's commonly called "syntax highlighting"

drifting ore
#

I'm confused as to what the item type or name is. Like, if I'm using getItemCount("Type"), what goes in type? Its name, it's id, it's category?

fast galleon
#

generally full type is a string like "Base.Item"
if you break it down it's module.type
you find it in scripts

module myModule { item myItem {} }
#

@drifting ore

calm depot
ancient grail
#

I might be doing it wrong or somethings conflicting

rancid tendon
sour island
ancient grail
#

Like you can determine what mods are doing the prints

sour island
#

Last I checked it worked, I don't think anything was changed. What is your print that you're testing?

#

Or what print are you seeing in the log that you want to figure out the origin of?

#

Made the panel from AUD pull the options off the cheats menu and convert them into buttons

ancient grail
#

Didnt tell me anything

sour island
#

Is the print going to client or server?

ancient grail
#

It shows on the lua debug console

#

If that helps

#

Must be client

thick karma
sour island
#

What is the print message?

#

If it doesn't show a mod next to it in console then it's vanilla

kindred current
#

How do I make my code dependent on another mod's code?

#

Just use names used in the other mod?

jaunty marten
#

u can add a few mods by separate mod_id by comma

#

if u need to get exactly in-game if any mod is activate then u can use getActivatedMods()

#

it returns array with mod_id of all activates mods

#

works same for mp and sp

thick karma
#

Anyone know whether it's terribly compatibility unfriendly to add new clothing categories as some mods do? Or is it just a matter of giving the clothing item a unique category name?

#

Considering feasibility of a "Hair Extensions" category so that people could add highlights and other color patterns to their hair.

opal linden
#

hello, how do i make traits that aren't compatible with professions?

#

for example

#

a trait that gives +4 mechanics to not be compatible with the mechanic profession

polar prairie
#

first two models done. both are shown with laser-upgrade attached.

wide oar
#

Question, i've been trying to make a gun mod- specifically, the Silver Ghost handgun from RE4. I have it set up, but when i enable it to test it my game freezes on LUA, then i get 3 errors and im stuck in a hudless menu until i close the game, then it wont launch until i delete the mods folder. i dont really know what to do

polar prairie
polar prairie
wide oar
polar prairie
#

have you tried removing the distribution and instead spawn it in with debug-mode?

wide oar
#

i havent, but if i enable it at all, once it starts loading lua i get stuck forever in loading lua, and then i get 3 errors and im stuck in a hudless screen and have to restart and delete the mods folder so it disables the mod. if i enable it in a server, the server takes forever to load and then crashes, and if i load it in the actual menu, it does that :/ w

ancient grail
#

If you could clarify your question.. people might be able to help u

ancient grail
ancient grail
wide oar
#

okay soooo i removed distribution and enabled the mod annd it froze still

#

then i just get stuck on this screen forever

polar prairie
#

okay one sec.

wide oar
#

ok D: i stayed up all night trying to get these mods (few mods for my server i was making, which includes that silver ghost) so i reallllyyy hope we can get it to work, then at least 2 out of 3 of my mods would have worked lol.

polar prairie
#

try to remove the fix weapon code.

#

and see if it works.

#

you can insert it back after. there's some issue with it.

wide oar
#

Okay, one second. i will try that

#

like that?

polar prairie
#

yes

vast nacelle
#

Yeah, that fixing recipe is incorrect.
You're using your display name in the ingredients.
It should be your Type (e.g. item silver_ghost)

{
Require: silver_ghost,

Fixer: silver_ghost; Aiming=3,
}```
wide oar
#

ahh

#

hmm

#

one sec im still trying to figure out if removing it fixed it

stone garden
#

hey anyone want hear my mod idea

#

im an long time waiting for someone make it

dull moss
#

dude

#

just stop

stone garden
ancient grail
#

Pls stop

#

No one wants to do freelabor

stone garden
#

i just wanted someone to make mod idea happen

ancient grail
#

Then work on it or spent on it why is this hard for you to understand man

#

Im not the first person who said this

wide oar
# wide oar

removing it hasnt fixed it, once i enable it i get reloading lua for a bit adn then a freeze and the hudless screen

#

hhhhhhhhhh

stone garden
#

no offense but thats true

ancient grail
#

Go anywhere in the world and ask if they are willing to work on your idea no matter what industry try it
Let us know if you succeeded

wide oar
#

1 error each time.. hm

dull moss
#

It's not even about that

#

It's about the fact that you've been asking ppl here for 1 month

#

Just stop

#

If you want your mod to happen, do it yourself

#

Like 90% of people here

wide oar
#

09-01-23 10:05:51.982] LOG : Mod , 1673280351982> loading SILVER.
[09-01-23 10:05:52.000] LOG : General , 1673280352000> translator: language is EN.
[09-01-23 10:06:51.814] ERROR: General , 1673280411814> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method)..
[09-01-23 10:06:51.817] ERROR: General , 1673280411817> DebugLogStream.printException> Stack trace:.

ancient grail
#

You dont have the cash then spend the time learing, working, coding.. not posting same stuff here

Its a frowned upon thing but its not against the rules

My advice is just learn to code we will help you

dull moss
#

Is moddata limited in any way? I have a table A in it. Table A consists of quite a few Table Bs. Each Table B holds quite a big amount of integers. Can running something like that throw this error?

[29-12-22 22:10:21.487] ERROR: General , 1672348221487> 0> ExceptionLogger.logException> Exception thrown java.nio.BufferOverflowException at HeapByteBuffer.put..```
stone garden
#

thrats why

#

:(

dull moss
#

well then it's not going to happen

vast nacelle
dull moss
#

Thought so too, each table B usually would be up to 30k integers which is honestly not a lot in programming terms

ancient grail
#

Spamming here aint going to produce the mod i tell you.. find a better job or organize your time thats it.. im stopping now

dull moss
#

maybe something to do with data transfer in mp?

#

fuck knows

ancient grail
dull moss
#

elaborate pls

#

i thought it works but someone reported that it throws this error

ancient grail
#

Wait ill link to what i did before

#

But it might be irrelevant

tardy wren
#

30k integers is only 120kB of data, not much

dull moss
#

ye but

wide oar
# wide oar oh my god

i have no idea how that got there, im testing it rn, i would not be surprised if that is why it was broken lol

ancient grail
dull moss
#

if there are multiple tables of them

sour island
dull moss
sour island
#

I may also look into grouping buttons a bit

#

With categories

#

And I need to look into supporting custom buttons

ancient grail
wide oar
#

well

ancient grail
#

like if your building customizeable thing

wide oar
#

heres what i got from my error log when i try and load it into my server

#

[09-01-23 10:14:07.878] LOG : Mod , 1673280847878> 718,690,542> loading SILVER.
[09-01-23 10:14:08.500] LOG : Lua , 1673280848500> 718,691,164> Loading: media/lua/shared/Sandbox/Apocalypse.lua.
[09-01-23 10:15:47.474] ERROR: General , 1673280947473> 718,790,137> Exception in thread "main" .
[09-01-23 10:15:47.475] ERROR: General , 1673280947475> 718,790,138> java.lang.OutOfMemoryError: Java heap space.
[09-01-23 10:15:47.475] ERROR: General , 1673280947475> 718,790,138> at java.base/java.util.Arrays.copyOf(Unknown Source).
[09-01-23 10:15:47.475] ERROR: General , 1673280947475> 718,790,139> at java.base/java.util.ArrayList.grow(Unknown Source).
[09-01-23 10:15:47.476] ERROR: General , 1673280947476> 718,790,139> at java.base/java.util.ArrayList.grow(Unknown Source).
[09-01-23 10:15:47.476] ERROR: General , 1673280947476> 718,790,139> at java.base/java.util.ArrayList.add(Unknown Source).
[09-01-23 10:15:47.476] ERROR: General , 1673280947476> 718,790,139> at java.base/java.util.ArrayList.add(Unknown Source).
[09-01-23 10:15:47.476] ERROR: General , 1673280947476> 718,790,140> at zombie.scripting.ScriptParser.parseTokens(ScriptParser.java:303).
[09-01-23 10:15:47.477] ERROR: General , 1673280947476> 718,790,140> at zombie.scripting.ScriptManager.ParseScript(ScriptManager.java:71).
[09-01-23 10:15:47.477] ERROR: General , 1673280947477> 718,790,140> at zombie.scripting.ScriptManager.LoadFile(ScriptManager.java:147).
[09-01-23 10:15:47.477] ERROR: General , 1673280947477> 718,790,140> at zombie.scripting.ScriptManager.Load(ScriptManager.java:758).
[09-01-23 10:15:47.477] ERROR: General , 1673280947477> 718,790,141> at zombie.network.GameServer.doMinimumInit(GameServer.java:1393).
[09-01-23 10:15:47.478] ERROR: General , 1673280947477> 718,790,141> at zombie.network.GameServer.main(GameServer.java:688).

#

i have 32gb of ram so i feel like its endlessly repeating some part of the code until it overflows, leading to that? that would be my guess

sour island
#

One of your scripts is busted

ancient grail
sour island
#

Interesting

#

Custom is down the line

#

Not sure if a search bar would be good tho

wide oar
#

loading the mod single player:

#

[09-01-23 10:17:24.931] LOG : Mod , 1673281044931> loading SILVER.
[09-01-23 10:17:24.949] LOG : General , 1673281044949> translator: language is EN.
[09-01-23 101823.023] ERROR: General , 1673281103023> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method)..
[09-01-23 101823.026] ERROR: General , 1673281103026> DebugLogStream.printException> Stack trace:.

#

Hm..

sour island
#

Even if it's a bit overwhelming - the intended use would be to put your go-to buttons on the quick bar or whatnot

vast nacelle
#

Would be nice if I could put the "Select Zombie" and "Make Selected Zombie do X" Right-Click options in an easier to access spot when setting up photo-ops.

fast galleon
#

Do more trees actually spawn in game, or just once? Erosion seems to be a one time thing.

wide oar
#

well you know what

#

two things:

#

the code i based that gun on was outdated

#

and all my sounds were .wavs

#

oops

polar prairie
dull moss
#

how to check if game is singleplayer or multiplayer? I want to run function only if its singleplayer

#

getGameMode()?

wide oar
#

i literaly remadfe it

#

my server is STILL stuck on initializng

#

and i STILL Crash

fast galleon
dull moss
#

why not isclient?

fast galleon
#

SP is not client

dull moss
#

ah

#

cheers

#

can i purge my moddata by assigning nil to it?

#

should work, right?

wide oar
#

Can anyone help me with my gun mod that refuses to work no matter what i do?????

astral dune
#

dont ask to ask. Nobody wants to commit to helping you if they have no idea what your issue is. Post your problem and then anyone can evaluate for themselves if they can help

jaunty marten
#

@dull moss

dull moss
#

thanks

#

How to catch gamemode
#musicmaniacpins

#

personal pins system

jaunty marten
#

genius

#

he-he

fast galleon
dull moss
#

smart

wide oar
#

Ok i give up

#

thanks!!!!!!!!!!!

dull moss
#

No problem thumbsupcat

fast galleon
#

nice

dull moss
#

alternatively you can copy links to msg somewhere else but that requires extra actions so fuck that

wide oar
#

Any other project zomboid modding servers that exist

#

????

#

Or is this the only one/

frank elbow
#

If there are, I doubt they will be any more receptive to "can anyone help me?" without any details

dull moss
jaunty marten
wide oar
#

Okay, the details are this: I am making a handgun mod. I have it set up, however when I launch a server with it, it stalls and then crashes with the "NormalTermination" error. When I launch it in single player, it hangs on reloading lua, then kicks me to a hudless menu, where i then have to restart my game and delete the mods folder so i can actually get in again. I have several error logs that I will provide you with. As well as the actual .rar. People told me it was a random typo in the code, and i fixed that, and it still kept freezing. I even went and redid the entire mod, and it still is freezing and its making me very upset because i spend way too long on it and i did not sleep last night. I am at a complete and total loss.

#

Then here's a debug log from singleplayer. Both are with that mod, and show what happens every single time i have tried to get into the world with that mod. I feel like I am overlooking something very simple and it's getting on my nerves.

vast nacelle
#

@wide oar You're missing a closing "}" on "model silver_ghost {". With that, it loads to main menu.

vast nacelle
#

No. You need a closing bracket after the attachment world block

wide oar
#

ah my bad, like this:

finite radish
vast nacelle
#
{
    model silver_ghost 
    {
        mesh = Weapons/Firearm/silver_ghost,
        texture = Weapons/Firearm/kp94,
        
        attachment world
        {
            offset = -0.0190 -0.1670 -0.0040,
            rotate = 50.0000 2.0000 -4.0000,
        }
    }
}```
dull moss
wide oar
#

Yes, keep laughing at me. 😦

#

And thank you, Cosmic.

dull moss
#

It's ok, we all started coding somewhere, I was just like him at some point πŸ™‚

#

it's tough when you don't have any experience

#

You'll get there

finite radish
#

we all start somewhere, but just... look at the vanilla files. like, you must have gotten the format somewhere from an existing example - stick to it NODDERS

vast nacelle
#

@wide oar Also, make sure you aren't subscribed to your own mod on the workshop. PZ will prioritize loading that version before your local version that you've modified.

wide oar
#

ohhhhhhhhhhhhh yeah thats a good tip, that's probably part of my problem. thank you ._.

dull moss
#

Although you really gotta understand the concept of code blacks before you start doing them

#

πŸ˜„

#

if you open something - make sure you close it, simple as that

finite radish
#

on a wholly unrelated note: does anyone know if docs exist for any of the C/C++ code that the game utilizes? you can kinda infer some of the usage via the native calls, but not really

astral dune
#

Intellij does a decent job of catching lua typos, but not scripts

dull moss
#

aand this is also why tabulation is important, you get to see all the blocks you have

finite radish
# dull moss isnt game using java?

the game is, but there are custom C/C++ libraries that the devs created for things like zombie population management and a few other cases

astral dune
#

I think Bullet is C as well

finite radish
#

yup

#

and "clipper" which I'm guessing is collision logic

dull moss
#

meanwhile my code on workshop:

#

make a mod
break ppl MP characters

astral dune
#

RIP

dull moss
#

It's ok, it's fixed now

#

And progres loss shouldn't be too big

thick karma
#

@sour island Would you be open to adding a mod option to Named Lit for hiding this on gamepad?

dull moss
#

I'm not even sure what is rolled back

sour island
thick karma
#

No I mean the overlay that covers what you're selecting

dull moss
#

Isn't that base game behavior?

thick karma
#

It's a little weird knowing what you're highlighting when it's got such a black overlay over most of your selection

#

@dull moss No

#

Here's a normal book with the tooltip drawn in normal place:

dull moss
#

Ah i see what u mean

thick karma
#

Here's how it shows if you use custom text for the built-in tooltip (though it's less flexible afaik because the tooltip text is in an item script file):

#

I'm sure the Named Lit box looks good for most people on KBM because its location is probably determined an little differently, e.g. by the mouse location

#

But it's just a little in the way on gamepad defaults

#

I personally ❀️ Named Lit but a new friend was having trouble navigating inventory with Named Lit in it and was asking which mod was blocking inventory like that

thick karma
# sour island You mean the fact titles don't wrap?

I feel like moving the overlay would take a lot of rethinking how stuff is laid out... e.g. you would probably have to set its (x, y) after you knew how tall it was... In the meantime I would legit write you the Mod Option if you'll add a little boolean flag for it to your ISToolTipInv:render()

#

I would prefer to just be allowed to hide it haha

#

I don't want to stress you out about relocating it

#

Hiding would be sufficient.

sour island
#

I can look at how it's adjusted in vanilla

#

Wouldn't be that hard

#

Might even handle the wrap too now that I have a text wrapper

agile vigil
#

Is there any way to avoid a recipe showing up in the inventory context menu?

Or altering the options provided. I have a first aid kit which can hold multiple bandages, and I simply want the kit to have a context menu option like: "Take Bandage > Adhesive Bandage / Bandage / Sterilized Rag" instead of "Take Adhesive Bandage > One / All", "Take Bandage > One / All" and finally "Take Sterilized Rag > One / All"

wide oar
#

Hey! Quick question. I believe this has to do with the fbx or some such, but when I load in game, i can spawn my gun and ammo and all that, and it works great! the sounds are there, too. however, the gun itself is completely invisible.

fast galleon
agile vigil
fast galleon
#

you can check ISInventorypaneContextMenu.addDynamicalContextMenu

#

I bet you can hook to remove your recipes from the list or something

vast nacelle
#

It's the second one though. You have the FBX in "models_x/Firearms" but your path in your model script entry is "Firearm"

wide oar
#

i was looking through it and saw that and i was like "ohh"

#

LOL

#

now i just need to rotate it

#

any blender export settings i need to be aware of for weapon models?

vast nacelle
#

I recommend pressing Ctrl + A in object mode and then Applying All Transforms (or at least Orientation and Scale) before you export. Makes positioning less headache inducing.

drifting ore
#

local player = getPlayer()
        sendClientCommand(player, "Money", "requestMoney", {id = otherPlayer:getOnlineID()});

Doesn't work for some reason. I get the print that it got to this snippet of code but I think it gets stuck here because anything after this, doesn't happen.

Am I using the "sendClientCommand" right? My code doesn't pop up any errors so idk where to start :/

#

I didn't wanna post more code to avoid spammin ya'll

#
if module == "Money" then
                if command == "requestMoney" then
                        local otherPlayer = getPlayerByOnlineID(args.id)
                        print("The player " .. player:getDisplayName() .. "is requesting" otherPlayer:getDisplayName() .. "$")
                        local hisInventory = otherPlayer:getInventory()
                        local hisBalance = hisInventory:getItemCount("Money")
                        sendServerCommand(otherPlayer, "Money", "Send", {balance = hisBalance})
                        print("We've received the amount he has and sent the command to send it")
                end
        end

This is the receiving end of that command. I feel like I'm using you guys as a Troubleshooting window in Windows and feel so bad bruhcatsad If it's too much ignore me

wide oar
#

HWhat do you do about a gun that is backwards and wont go forwards no matter what lol

drifting ore
#

That's a feature not a bug!

#

It's the zomb apoc after all

wide oar
#

._.

ancient grail
#

guys know why this isnt working

local function adminDeleteOnDeath()
    if isAdmin(getPlayer()) then 
            getPlayer():clearWornItems();
            getPlayer():getInventory():clear();
            getPlayer():resetModel();
    end        
end
Events.OnPlayerDeath.Add(adminDeleteOnDeath)
jaunty marten
#

didn't use these hooks before but sounds like player for mp and character for sp

#

not sure

#

Β―_(ツ)_/Β―

wide oar
#

Why the hell is my gun backwards and how do i make it stop being fucking backwards

#

i've rotated it in blender and that did actually nothing lol

fast galleon
wide oar
#

mine is a gun not a person

ancient grail
#
local function adminDeleteOnDeath(player)
    if isAdmin(player) then 
            player:clearWornItems();
            player:getInventory():clear();
            player:resetModel();
    end        
end
Events.OnCharacterDeath.Add(adminDeleteOnDeath)

@smoky meadow this one worked

#

ill update my mod and it will include this

#

2hrs from now?

#

oops

ancient grail
#

wrong thread

ancient grail
jaunty marten
ancient grail
#

imean on local hosted

jaunty marten
#

then what's doing playerdeath event πŸ€”

#

player death in real life?

smoky meadow
jaunty marten
#

need to test..

jaunty marten
wide oar
fast galleon
wide oar
smoky meadow
jaunty marten
fast galleon
#

Π±Ρ€ΠΎ

jaunty marten
#

россия..

jaunty marten
#

let's go

wide oar
#

uhhhhhhhhhhhhhhhhhh

#

now its facing hte right way

fast galleon
#

better invent Zombie virus, if you have nothing else to do

wide oar
#

but its not i my hands

jaunty marten
wide oar
#

yeah

jaunty marten
#

if it's not in hands then u have progress

#

πŸ‘

ancient grail
#

for i=0,TraitFactory.getTraits():size()-1 do
local trait = TraitFactory.getTraits():get(i);
if trait:getCost() >= 0 then
if not getPlayer():HasTrait(trait:getType()) then getPlayer():getTraits():add(trait:getType()) end
else
if getPlayer():HasTrait(trait:getType()) then getPlayer():getTraits():remove() end
end
end

i just noticed my function isnt adding the custom traits

wide oar
#

GUYS

#

thank you so much everyone

wide oar
#

thank you guys so much

dull moss
#

Ok how the fuck are we supposed to make our mods work with superb survivors if getPlayer() grabs fucking npcs

dull moss
# finite radish `getSpecificPlayer(0)`

so if I replace all my getPlayer() with getSpecificPlayer(0) it should work? Will this apply to MP or do I have to make specific if case to catch if superb survivors is running?

finite radish
drifting stump
#

getSpecificPlayer is for coop players

dull moss
#

all my luas are in client folder, don't have any server-sided scripts

finite radish
drifting stump
#

it is indeed 0

#

locally

#

player 0 in your client

dull moss
#

eh, I'll jsut try, see what happens

drifting stump
#

if its anything to do with split screen players then getSpecificPlayer

#

if you want to grab other players other than local in multiplayer then its getOnlinePlayers

dull moss
#

I want to grab the player

finite radish
#

but maybe that's incorrect

drifting stump
#

it creates fake players

fast galleon
#

getPlayer is just getSpecificPlayer(0) in disquise

dull moss
drifting stump
#

and without looking at code the way its created is probably replacing the main player instance

finite radish
#

but those must be splitscreen/co-op players rather than actual multiplayer players, right? because it only runs in the singleplayer "version" of the game rather than a localhost server

drifting stump
#

therefore getPlayer giving you an npc likely the most recently created

#

no its because it wouldnt be able to create fake players in multiplayer

#

you can have splitscreen players on a server

finite radish
#

it uses SurvivorFactory.CreateSurvivor(); from the looks of it

#

also wild, didn't know that splitscreen worked in MP

drifting stump
#

and cool fact all the split screen players in a single client share the same connection

#

never tested or actually looked to verify but weve theorized before you might be able to get 400 players in a server

#

servers do up to 100 client connections

#

and since split screen shares the same connection it might work

finite radish
#

browser's distinction is important though, if the IDs are client specific

#

(not in the case of singleplayer though)

dull moss
#
SSIsInventoryTransferAction.ISInventoryTransferAction.perform = ISInventoryTransferAction.perform
function ISInventoryTransferAction:perform()

        print("SSIsInventoryTransferAction perform");
    if(self.item ~= nil) then -- edits
    local ssquare = getSourceSquareOfItem(self.item,self.character)
    --print(tostring(ssquare))
    if(ssquare ~= nil) and (self.destContainer:getType() ~= "floor") then
        local OwnerGroupId = SSGM:GetGroupIdFromSquare(ssquare)
        local TakerGroupId = self.character:getModData().Group
            if(OwnerGroupId ~= -1) and (self.item:getModData().FreeToTake == nil)  and (TakerGroupId ~= OwnerGroupId) and (self.character:getModData().ID ~= self.item:getModData().LastOwner) then
                print("ga stealing detected!")
                SSGM:Get(OwnerGroupId):stealingDetected(self.character)
            end
        end
    end

    SSIsInventoryTransferAction.ISInventoryTransferAction.perform(self)
end
function ISInventoryTransferAction:perform() -- confirmed working
    local player = self.character;
    local item = self.item;
    local itemWeight = item:getWeight();
    local modData = player:getModData().EvolvingTraitsWorld.TransferSystem;
    --print("DTW Logger: Moving an item with weight of "..itemWeight);
    modData.ItemsTransferred = modData.ItemsTransferred + 1;
    modData.WeightTransferred = modData.WeightTransferred + itemWeight;
    original_transfer_perform(self);
end

so these 2 things conflict somehow, top is superb survivors, bottom is mine. Throws error that there's null table at
local modData = player:getModData().EvolvingTraitsWorld.TransferSystem;

#
function: perform -- file: ZOverrides.lua line # 23 | MOD: Superb Survivors

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

My guess is that my moddata is not initialized for NPCs?

jaunty marten
dull moss
#

Yes

#

And it throws errors in SP

jaunty marten
#

bruh

dull moss
#

fuck it i'll jsut disable inventory transfer stuff if this bullshit is enabled

#

compatibility achieved

ancient grail
#

Thats a solution tho not bad

dull moss
#

I mean if 98% of my mod works with it, single if statement can make 100% of 98% of the mod work

#

then it's technically 100% of mod working

faint jewel
#

is there a way via code to tell if a user is in the forest?

dull moss
#

my first instinct is to check amount of trees in vicinity

#

there might be more elegant solution or existing function ofc

ancient grail
#

Ye its not really that big of a. Deal if u have just one aspect for a mod like if its mp or sp
Thats all cool i think

Unlike my problem
I published beartraps and a few servers use it excpt for the server who comissioned the mod cuz its causing error for them

But looking at the error logs.
Its cuz of their tile definition is overwritten by some mod
Which i cant fix
The problem is im using vanilla tiles for the mod so theres no way to fix it

dull moss
ancient grail
#

Ow forage zones nice
Well now u have multiple ways to explore

finite radish
# finite radish forage zones

(to elaborate on this, I think you can probably just do square:getZone() where square is the player's current square - but there are likely other pathways to essentially the same thing)

faint jewel
#

what do this do?

dull moss
#

Maybe returns true when you move more slowly cuz you in the trees?

#

Like u know when u in forest your speed drops to shit

#

when you try to go through trees and stuff

finite radish
# faint jewel what do this do?

this returns true ONLY if the tile you're in

  1. has a tree in it
    and
  2. that tree is larger than size 2 (there's 4 sizes, 4 being the largest)
#

it also appears to check for hedges and returns true in that case

#

and also bushes

faint jewel
#

basically... i want to damage people if they are in the forest.

finite radish
#

but what's "the forest"

#

that's a very vague concept

#

forest ZONES? within any tree? next to a tree? etc.

#

if it's vague, use the zones

dull moss
ancient grail
#

Dmg them when they are next to atleast 4 trees maybe

faint jewel
#

is they are not on the paths

#

i dont want players running off.

finite radish
finite radish
dull moss
#

if you check every tick then maybe

finite radish
# dull moss not if you check every minute

to check every minute, you'd still need to either a) have a conditional on the update loop or b) hook into an event handler that fires every minute

both sound like more of a pain in the ass than it's worth when you could instead just check foraging zones

dull moss
#

whats wrong with adding event

#

events are best shit ever

#

love me some events

finite radish
#

that's B

ancient grail
#

Hmm i would probably do what i suggested
Like ontick that regularly check if isInTheJungle()
Lol
Name sucks

Also another check if the event is going on like its not a forever thing .. its just there during this whatver thingnubare doing that seems like its an event

dull moss
#

44

#

Need moar

faint jewel
#

there appear to be NO zones here.

ancient grail
#

Then dmg if theres no zone

#

Lol

finite radish
ancient grail
#

If theres zone kill
If its both zone and no zone then ban

faint jewel
ancient grail
#

Lol im sorry im just too sleepy i guess

faint jewel
#

that's the exported full map.

#

i see no zone... not even forage ones.

finite radish
#

tilezed or worlded?

ancient grail
#

Maybe it needs searching on to check

finite radish
#

try the other, whicever one you're in

finite radish
faint jewel
#

worldzed

ancient grail
#

O ithiught u running on debug

faint jewel
#

it shows them in the other citires.

ancient grail
#

I cant see some of the imgs im on mobile atm

faint jewel
#

see?

ancient grail
#

But for some reason i was able to upload screenshot . Yet not see the img i uploaded

dull moss
finite radish
# faint jewel

i checked this area in-game, looks like the entire thing is actually inside a DeepForest zone

#

even the buildings

#

so you're SOL there

faint jewel
#

yeah so that's what i mean. can't use the forages.

finite radish
#

what's the goal?

faint jewel
#

i dm'ed you it. it's a bit much.

kind fossil
#

Hello modders! Thanks to @autumn garnet's idea I have written a modding project notebook for our Roleplay Serie "Deads & Undeads"
We are looking for modders who would be willing to take those bounties!

We add bounties regularly, don't hesitate to check the page and contact me on Discord if you want to work on one of them
The commissions are paid

dull moss
#

bounties Kpog

kind fossil
dull moss
#

also im r-word

#

instead of disabling whole transfer system

#

I can just check if whoever performing the transfer is a player

#
local original_transfer_perform = ISInventoryTransferAction.perform;
function ISInventoryTransferAction:perform() -- confirmed working
    if self.character == getPlayer() then```
#

and if not, just let original fucntion run

#

started writing changelog

General:
    - Added partial support for Superb Survivors!, traits tied to "Items Transfer" system won't be dynamic if you run it. Problem is that Superb Survivors! uses ISInventoryTransferAction:perform() to make NPCs move items and I use moddata there that doesn't exist for NPCs. If I find a better solution, I'll implement it```
and I was like "Wait, I can just check if action is done by player"
finite radish
#

will those end up equivalent? I know IsoPlayer inherits IsoGameCharacter but I'm not sure if they're implicitly equivalent in lua

dull moss
#

i mean i just tested and from the looks of it it works KekW

#

maybe I should test a bit more PepeThink

finite radish
#

sure, but is it working because the code isn't running? because if the code never runs then of course the code wouldn't run KEKW

dull moss
#

oh u mean if it actually goes into loop

#

YEYEY

#

"it works cuz it never runs"

#

also a solution you gotta admit

finite radish
ancient grail
dull moss
#
LOG  : General     , 1673298532032> DTW Logger: Moving an item with weight of 0.5```
all good
finite radish
#

πŸ‘

dull moss
#

goes into if

#

man its so convenient to just leave loggers inside the code and just uncomment them when you need them

finite radish
#

or you could just add a debug flag but that works too

dull moss
#

adn then put every print into if?

#

that'd net too many prints

#

I'd rather do it 1by1 depending on what i need

finite radish
#

it's just like
if isDebugEnabled() then <do thing> end

#

given that prints are usually pretty short, you could inline the whole thing like that

dull moss
#

yea but

#

and i have a bunch on stuff on everyminute/10minutes

#

so that'd be a lot of prints

finite radish
#

true

ancient grail
#

Bloodlust meter

#

Soundslike the a zed thing but in sure its not

polar prairie
#

does somebody know if there's a mod that can attach flashlights to weapons (that actually work)?

dull moss
#

brita?

#

works well for me

split cove
#

Hello, can someone help me with a problem that I have in my zomboid project that the game does not open for me?

dull moss
young pasture
#

Hi. is there a mod like airsoft? and players/pvp will just be knocked down(prevent dying)

sour island
#

I haven't tested this with Lua but does table["a"] and table.a under any circumstance not refer to the same entry?

#

I was thinking debugPrint(object, "var") could create a label for the print

#

Also thinking a parameter could lump the message into a temp list and output it into 1 message

dull moss
#

my friend says yes

#

as you can see, my friend is very smart

#

πŸ€“

fast galleon
#

another tree question, would a tree change sprites, grow, etc if it's not in erosion?

sand harbor
#

is it possible to completely override vanilla features with a mod (i.e. changing either wound infection, advanced recipe mood buff or moodle effects) without completely replacing them? I have no idea how I would do anything like this I'm just wondering if it's possible

jaunty marten
#

override without replacing wat? wdym

thick karma
#

Friend on gamepad has an oddly bugged state after running some mods that persists into vanilla (gamepad is now bugged even with mods off); wondering if anyone has seen it. They get caught in an infinite loop while inventory is open in which the game seems to be trying to set their focus to the inventory pane repeatedly, but failing, seemingly because it stops here:

function ISInventoryPage:onGainJoypadFocus(joypadData)
    ISPanel.onGainJoypadFocus(self, joypadData)

    local inv = getPlayerInventory(self.player);
    local loot = getPlayerLoot(self.player);
    inv:setVisible(true);
    loot:setVisible(true);
    getPlayerVehicleDashboard(self.player):removeFromUIManager()
    self.inventoryPane.doController = true;
end

...where it tries to remove the vehicle dashboard from the UI but apparently gets null in Java when trying to obtain said vehicle dashboard. Anyone have any ideas about how this weird loop gets triggered?

PS: Why would the vehicle dashboard appear to return nil when the self.player seems to exist (since inv and loot are set visible successfully)?

humble oriole
#

Can you not replace/remove items from an inventory from the server side?

#

it's strange, when I process the items, the server seems acknowledge they're no longer in the inventory but the client doesn't reflect it

sand harbor
humble oriole
#

depends on how much of the system is written with lua

#

lua can be hooked into/overwritten (overwritting typically is bad though)

#

if it's on the java side, you can hook into it with the tools provided but not overwrite it.

drifting ore
#

do you know how to make a Moodle Framework Trait AKA Virus
???

placid delta
humble oriole
#

oh man, really?

#

I'm just doing this biowastecontainer:Remove(item)

placid delta
#

if ran on client it only effects client, if ran on server only effects server etc

#

might just need to add
biowastecontainer:sendContentsToRemoteContainer()
right after your remove \

#

test it ofc

#

and this assums your processing this code on the server not the client

humble oriole
#

looks like that's depereciated, but there's sync and serverItems

drifting ore
#

do you know how to make a Moodle Framework Trait AKA Virus | Like Nuclear Winter

limber oar
#

Anyone have experience with sandbox options and ZombiesZoneDefinition? Wondering why this doesn't work:


local femaleChanceSetting = 50
if SandboxVars.ModName.GenderRatio = 1 then
    femaleChanceSetting = 0
elseif SandboxVars.ModName.GenderRatio = 2 then
    femaleChanceSetting = 25
elseif SandboxVars.ModName.GenderRatio = 3 then
    femaleChanceSetting = 50
elseif SandboxVars.ModName.GenderRatio = 4 then
    femaleChanceSetting = 75
elseif SandboxVars.ModName.GenderRatio = 5 then
    femaleChanceSetting = 100
end

ZombiesZoneDefinition.School = {
    femaleChance = femaleChanceSetting,
    Student = {
        etc.```

The sandbox options appear properly in the sandbox settings and all that so it isn't an issue with the variable names or what have you.
#

Do I need to use the string defined for enum option1, option2 etc. instead of the numValue defined in sandbox-options.txt? Or is it just not possible to run code directly in ZombiesZoneDefinition?

jaunty marten
#

just print the SandboxVars.ModName.GenderRatio

#

and check if changed vars initialised before ur mod lua

#

cos idk when they are

limber oar
#

Logs are throwing a syntax error for now, gotta try to fix that first. Will report back once that side of things is handled.

dark wedge
limber oar
#

...I think literally every time I have posted a question here the answer has been embarrassingly stupid. Good catch. I swear I'm not usually this incompetent.

dark wedge
#

Sometimes you just need another set of eyes. ha

limber oar
#

Thanks for being mine this time! πŸ˜΅β€πŸ’«

vast nacelle
#

Has anyone by chance made a python script or similar that can take script files and generate translate files for recipes and items?

drifting ore
#

how do people make armor???

vast nacelle
#

Give it high Bite and Scratch defense and you've got armor.

drifting ore
limber oar
#

Do modded enum sandbox options work? No matter what I set mine to I can only ever get them to return their default value. This occurs even with the "example" sandbox mod posted on the wiki (on this Discord, by a TIS dev).

#

This post, in question.

#

Set CustomOption2 to Value #1, 2, 3, 4, or 5, it will always write CustomOption2= 1 in the console.

jaunty marten
limber oar
#

The former. New game, set value in sandbox, loaded game, exited to menu after spawning in, checked console.

#

I've confirmed that integer and double sandbox options work fine, but the enum and string options seem to only return their defaults.

jaunty marten
#

try to print in exactly in debug console after spawning in

jaunty marten
#

enum too

limber oar
#

wat

#

Okay, at least it's something on my end, though no idea what I could be breaking with a mod I haven't touched...

limber oar
jaunty marten
limber oar
#

I've just been checking console.txt, as far as I can tell that's where the example mod prints to.

#

Nothing from the example mod shows up in the debug console on spawn (unless I edit it to do so) by default.

#

Oh, I get what you're saying

#

Okay, yes, it does actually return the right value in the debug console, just not in console.txt

#

If the sandbox vars are not initializing before my mod lua (not 100% that's the issue, just guessing), what's a good way to correct this? I'm trying to modify the ZombiesZoneDefinitions per sandbox options, so that lua is always going to load early, with the other shared files...

vast nacelle
#

Toss your code in a function and add it to Events.OnGameStart?
The first round of Zombies that are spawned at world gen might not reflect your changes, but the rest from then on would.
Not sure on the order of events there.

limber oar
#

The first round of Zombies that are spawned at world gen might not reflect your changes

Hmm. It's not perfect, but zombies are spawned in chunks, right? So, as long as the player doesn't start in one of the areas I'm trying to define, that wouldn't matter much -- do I have that right?

vast nacelle
#

Yes, that is how it works. Only the zombies in the player's immediate area are spawned.

limber oar
#

If it works it's an acceptable interim solution. Though, it could be limiting in the future, as one of my planned features involves a start in the defined area in question. But I suppose I can cross that bridge when I get to it.

#

Presumably there's a way to delete and force zombies to spawn in an area. Maybe some sort of workaround like "on load, delete all zombies in the chunk, then spawn new ones" (which by that time would draw from the updated ZoneDefinitions) would mitigate the problem.

safe idol
#

Eyo, I would like to commission a mod, if somebody would be willing to take it up. Shouldn't be too hard to make either, its just a clothing mod

#

So if anybody is interested, DM me and we can talk numbers and stuff

bronze yoke
limber oar
#

Oh man if that works it'd be perfect

#

This will have to be a tomorrow project

#

It's always the "quick fixes" that balloon into multi-day ordeals and require you to learn new sections of the code :P

humble oriole
#

So, I'm deleting an item from a container on the server side, and it's not updating the inventory on the client side. I tried doing a onServerCommand and it's container:requestServerItemsForContainer() and container:requestSync()

bronze yoke
#

what method are you using to remove the item?

humble oriole
#

biowastecontainer:Remove(item)

#

I also tried DoRemoveItem

#

The server knows it's gone

#

but the client doesn't reflect it until I reload the isoobject

dark wedge
ancient grail
#

You beat me to it

#

I was about to look for it on my snippets

humble oriole
humble oriole
ancient grail
#

Just put that on the last part of your function on wherever u did the change

dark wedge
ancient grail
#

I havent tried server sided editing world objects so i really dont know. Most of the stuff i did are client or shared

bronze yoke
#

if closing the inventory and reopening it still shows the deleted item, i don't think this will help

ancient grail
#

As a matter of fact i havent written anything that used OnClientCommand
Or OnServerCommand

#

Ah then refresh inventory

#

And refresh loot

dark wedge
#

setting that flag should tell the InventoryPage to perform a refresh for all inventory pages for all players on next render tick

ancient grail
#

U mean the render dirty?

dark wedge
ancient grail
#

Did it work for you @humble oriole

humble oriole
#

Putting the dog to bed, I’ll try it in 5 or so

#

do I need to require it?

dark wedge
#

no, its defined as a global

bronze yoke
#

you basically never need to require vanilla afaik

#

none of the vanilla files return anything and they load first anyway

humble oriole
#

no dice,

#

debug is confirming it's being set true