#mod_development

1 messages ยท Page 72 of 1

pseudo ermine
#

yeah well 90% of the context ive seen Lua in is just official game mod support

sour island
#

I was going to just make it a looped action - people tended to want control over the two types of reading

thick karma
#

I would say it's streamlined well enough that it feels subjectively easier to me than modding e.g. NMS

pseudo ermine
#

i have an A level in computer science but i fucking suck at programming (they also literally only taught us python in college level...)

thick karma
#

Hello World in PZ was a smidge faster than in NMS for me

#

But then again I modded NMS in C# and did not have to do that.

pseudo ermine
#

nms?

thick karma
#

(though I heard Lua was not necessarily more efficient, Idk).

#

No Man's Sky.

pseudo ermine
#

ahh

#

didnt even know nms had a modding scene

thick karma
#

I made a mod that propagated plants and animals more so you could find forest planets and such

sour island
#

Also I finished converting the XP boosting calculations

thick karma
#

Huge modding scene in NMS

pseudo ermine
#

wow

#

im an ED player lol

thick karma
#

Because NMS is not competitive, no one (smart) cares if you mod online

sour island
#

pretty straight forward except for the whole while() while() thing

#

I think most of it was to get the right perk (not sure)

thick karma
#

So people frequently play online with a ton of mods

pseudo ermine
#

ive been eyeing up nms for a while but its never gotten to the top of my "to play" list

#

ahh yeah igy

sour island
#

also TIL if you eat more than 300 proteins you don't get a boost to strength XP

pseudo ermine
#

fronteir are too money focused to allow modding support for elite dangerous

agile vigil
thick karma
#

I got several hundred hours out of playing and modding NMS so I don't hate the game, but I did leave the game because I am disappointed by how the devs approach updates to that game.

#

I would say it's a game experience worth exploring

pseudo ermine
#

fair

#

if i can get it cheap sometime i probably will

thick karma
#

I think it's 30 r.n.

#

for holidays

sour island
pseudo ermine
#

too much xd

#

im talking like 10 quid

thick karma
#

They have kept it at $60 when off-sale for SO long it's crazy

sour island
#

I can now decide to cap it at 0.25 while still taking in proteins, traits, etc

thick karma
#

But yeah g.l.

#

I'm sure someday the price will drop

sour island
#

There's a few quirks in here that I didn't know about tho

pseudo ermine
thick karma
#

But in fairness it does give you quadrillions of planets to explore @pseudo ermine

sour island
#
    ---perks boostMap based on career and starting traits
    local xpBoostID = pXP:getPerkBoost(perk)
    local xpBoostMultiplier = 1

    if xpBoostID == 0 and (not isSkillExcludedFrom.SpeedReduction(perk)) then
        xpBoostMultiplier = 0.25

    elseif xpBoostID == 1 and perk==Perks.Sprinting then
        xpBoostMultiplier = 1.25

    elseif xpBoostID == 1 then
        xpBoostMultiplier = 1

    elseif xpBoostID == 2 and (not isSkillExcludedFrom.SpeedIncrease(perk)) then
        xpBoostMultiplier = 1.33

    elseif xpBoostID == 3 and (not isSkillExcludedFrom.SpeedIncrease(perk)) then
        xpBoostMultiplier = 1.66

    end
agile vigil
thick karma
#

Haha since it's procgen the game is damn near endless if you just like exploring

pseudo ermine
#

the amount put into said planets is what i care about xd

thick karma
#

Last I checked you couldn't land in Elite

sour island
#

speed increase excluded perks are strength and fitness

thick karma
#

Not anywhere interesting

pseudo ermine
#

what?

#

ah

thick karma
#

That was years ago

#

But you couldn't land on any cool planets

sour island
#

this is why they can start at 3 but not recieve the boosts

thick karma
#

Because they weren't done

pseudo ermine
#

well elites more of a sim of an accurate milky way

thick karma
#

Only dust balls

pseudo ermine
#

like the star locations are accurate from 2014 starmaps then they used an algorithm to fill in the gaps

sour island
#

sprinting get's it's own caveat if you start with sprinting 1 though

thick karma
#

In NMS you can literally take off a planet, fly through atmosphere into space, jump through a black hole to another solar system, fly down to a planet in that system, and land in a lush tropical rainforest.

pseudo ermine
#

with horizons non atmospheric landings were added, and they are some places like thargoid and guardian surface bases

sour island
#
local isSkillExcludedFrom = {}
---@param perk PerkFactory.Perk
function isSkillExcludedFrom.SpeedReduction(perk) return (perk == Perks.Sprinting or perk == Perks.Fitness or perk == Perks.Strength) end
---@param perk PerkFactory.Perk
function isSkillExcludedFrom.SpeedIncrease(perk) return (perk == Perks.Fitness or perk == Perks.Strength) end
pseudo ermine
#

with oddyssey there are surfaces with atmosphere, boots on the ground

agile vigil
pseudo ermine
#

but its still sparce

thick karma
#

In NMS you can get inside of your mech, boost off the ground, and (with mods that enable more boost and flight energy for mechs), literally fly to another planet (or more realistically a planet's moon) in your mech.

pseudo ermine
#

but look at my FPS when on said surface base

sour island
#

This would just flatten/cap the XP as if they didn't start with any added skills

thick karma
#

Yeah that's why I chose NMS over Elite, I wanted a fuller experience of playing on the ground (in high FPS)

agile vigil
# sour island I don't see how so

I usually play with a mod that changes the rates, so instead of: 0.25 > 1 > 1.33 > 1.66 it'd be 1 > 1.25 > 1.5 > 1.75 > 2 for example

sour island
#

Which mod is that?

agile vigil
#

Lemme find it.

pseudo ermine
#

and ive experienced its emptyness ive travelled to saggitarius A*

sour island
#

That should have no impact

pseudo ermine
#

๐Ÿ˜ฉ

thick karma
#

Keep in mind the colors are heavily modded

pseudo ermine
#

bruh

#

ur character on drugs fr

thick karma
#

Also jetpack and player speed was modded

#

I modded t.f. out of NMS

#

lmao

sour island
#

it claims to be doing that - but I 'm pretty sure it's just rewarding more XP after the fact

pseudo ermine
#

nice xd

#

ive considered getting into modding but id probably just get rly stressed out

thick karma
#

But yeah I need that lush planet experience or space sims not appealing to me

pseudo ermine
#

because i get extremely stressed with programming

agile vigil
thick karma
pseudo ermine
#

well yeah

#

thats all development xd

thick karma
#

Those are keys

#

Haha

sour island
# agile vigil I mean, it goes both ways. It can subtract xp ๐Ÿ˜„
vents.AddXP.Add(function (gamechar, perk, xpAmount)
    local perkLevel = gamechar:getPerkLevel(perk)
    local boostLevel = gamechar:getXp():getPerkBoost(perk)
    
    local mult = UxptMultiplierMath.skill(perk) * UxptMultiplierMath.actualBoost(perk, boostLevel) * UxptMultiplierMath.extra(perk, perkLevel)
    local extraXP = xpAmount * (mult - 1)

    if extraXP > 0 then
        gamechar:getXp():AddXP(perk, extraXP, false, false, false)
    end
end)
thick karma
#

Also, following a good tutorial can save you a lot of energy and Q&A, and there are a couple pretty good ones available on YouTube.

pseudo ermine
#

fair

pseudo ermine
#

id probably start with blade and sorcery

#

because modding in weapons seems incredibly user friendly with that

sour island
#

I imagine most people wouldn't bother decorating the original function

thick karma
#

Hell yeah I have never played it

sour island
#

there's an addXP hook

pseudo ermine
#

from what ive seen its like importing a model and then defining edges and weights and grab points etc

sour island
#

which you can bypass in addXP

thick karma
#

There are many weapon mods in PZ too so I imagine it is far from impossible, but that's not my expertise

sour island
#

so the journals don't interact with his mod at all

dim hill
#

Anyone knows of a mod that adds more craftable melee weapons? (Not drops, just craftable)

sour island
#

hmm...

pseudo ermine
sour island
#

I could add something here to account for his added/detracted XP

#

I'd have to test it more

pseudo ermine
#

just nice devs

sour island
#

but I think it should work as is

#

since he's calling addXP

pseudo ermine
#

anyway its stopped raining i gtg, british weather has given me 30 seconds to do bike maintinence while dry

#

o7

agile vigil
thick karma
#

My bad

#

Hello!

#

I just overlooked it mid writing stuff to Tann

sour island
#

I'm trying to think out what impact it could have

ancient grail
#

Its all good

#

Ooow im a katana now ๐Ÿ™‚ cool

agile vigil
# sour island since he's calling addXP

And yeah, that'd mean you're adding his XP on top of existing XP, though. So.. If you're making the XP values equal 0.25 mult, then his level 0+ multipliers would just be even more XP, no?

sour island
#

What I'd be targeting is lowering the boostmap calc to always be 0

#

which nets 0.25, yes

#

but then his added XP would be thrown on top

#

I think that would be fine(?)

#

is hook is ran after mystuff

agile vigil
ancient grail
#

@sour island @drifting stump helped me with the lock thing it now points to the floor by default

sour island
#

oh nice

sour island
ancient grail
#

UI.inventoryPane.inventory = UI.backpacks[#UI.backpacks].inventory

sour island
#

it could be that his mod would be netting alot more XP to the player but almost nothing in the journal lol

#

which is kind of good(?)

agile vigil
#

Potentially? laugh

sour island
#

well he calls addXP so that would be recorded too actually

#

I think it should be fine

agile vigil
#

My head is trying to figure out how I would want to do this exact same thing.

I have the pre-modifier XP recorded in my diary, same as you have with your new hook.

Now I just need to decide what drawbacks I'm willing to have.

Very tempted to simply use AddXP and let the modifiers do their magic when I'm reading the diary, but with a penalty like 20% per trait's difference. (Unless the trait is in some exception list, like Under/Overweight)

sour island
#
    ---perks boostMap based on career and starting traits
    local xpBoostID = 0--pXP:getPerkBoost(perk)
    local xpBoostMultiplier = 1

    if xpBoostID == 0 and (not isSkillExcludedFrom.SpeedReduction(perk)) then xpBoostMultiplier = 0.25
    --elseif xpBoostID == 1 and perk==Perks.Sprinting then xpBoostMultiplier = 1.25
    --elseif xpBoostID == 1 then xpBoostMultiplier = 1
    --elseif xpBoostID == 2 and (not isSkillExcludedFrom.SpeedIncrease(perk)) then xpBoostMultiplier = 1.33
    --elseif xpBoostID == 3 and (not isSkillExcludedFrom.SpeedIncrease(perk)) then xpBoostMultiplier = 1.66
    end
#

this is what I'm doing -- basically as with the vanilla -- sprinting/fitness/strength still get x1, everything gets x0.25

#

what's weird is sprinting is excluded from reductions but not increases

#

so I think fast learners can learn how to sprint faster but slow learners are fine lmao

agile vigil
sour island
#

probably an oversight, the XP code seems very old compared to other stuff

#

it also confirms that the isoGameCharacter is an isoPlayer before checking nutrition

#

so this code is probably as old as isoSurvivor

#
  • the fact they don't identify skills based on combat parent for pacifist
#
if player:HasTrait("Pacifist") and (perk:getParent()==Perks.Combat or perk==Perks.Aiming) then traitMultiplier = 0.75 end
#
if (IsoGameCharacter.this.Traits.Pacifist.isSet()) {
                                 if (var6.getType() != PerkFactory.Perks.SmallBlade && var6.getType() != PerkFactory.Perks.LongBlade && var6.getType() != PerkFactory.Perks.SmallBlunt && var6.getType() != PerkFactory.Perks.Spear && var6.getType() != PerkFactory.Perks.Maintenance && var6.getType() != PerkFactory.Perks.Blunt && var6.getType() != PerkFactory.Perks.Axe) {
                                    if (var6.getType() == PerkFactory.Perks.Aiming) {
                                       var9 *= 0.75F;
                                    }
                                 } else {
                                    var9 *= 0.75F;
                                 }
                              }
#

I don't remember the parents ever not being in game though

agile vigil
#

I've only been here in Build 41, so I ain't got a clue ๐Ÿ˜„

sour island
#

I was here before cars but everything is a blur

#

Only started modding at the start of covid

#

Love this game, and I'm glad the modding community seems to be growing again

ancient grail
#

U ancient god tier wizard

agile vigil
#

^Truth.

sour island
#

nah, I'm still learning

agile vigil
#

Well that's the one sure thing when doing any type of programming ๐Ÿ˜„

sour island
#

Can the uploader check if the poster is the default image and automatically set it to unlisted?

drifting stump
#

those settings mods make me want to bash my head in

#

why why did brita and arsenal think it was a good idea

sour island
#

it's an open barn door at this point - but Arsenal should have made the template version unlisted

#

afaik unlisted mods can still be downloaded

drifting stump
#

they can and anyone can see them they just need the link

#

doesnt show up in searches

sour island
#

I believe the game should have no issues grabbing updates either

#

Someone told me there isn't an issue writing into Lua/ so I wonder what issue I'm having and if it's the same modOptions has

#

My settings can be changed locally to work - but modOptions can't for some reason

agile vigil
#

Perhaps it'd be enough to just default to the mod being unlisted when uploading in Zomboid? Then opening the overlay to your mod afterward. You'll see the yellow banner at the top saying "HEYO UNLISTED BRUV"

Clarification: Keep the drop-down options or what we have now, just make the default selection not-public.

drifting stump
#

yeah no issues writing to Lua/

#

i use it for server sided configs

sour island
sour island
agile vigil
agile vigil
sour island
#

I can check

thick karma
#

When you try to give yourself a lantern via item menu without reading:

agile vigil
faint jewel
#

server.lua

    local car = addVehicleDebug(args.type, args.dir, nil, sq)
    local carid = car:getID()
    sendServerCommand("KYRPT", "getTrailer", {trailer = carid}); 

client.lua

local Commands = {};
Commands.KYRPT = {};


Commands.KYRPT.getTrailer = function(player, args)
  print("it Fired")
  local car = args.trailer;
end



local onServerCommand = function(module, command, args)
 if Commands[module] and Commands[module][command] then
 Commands[module][command](args)
 end
end

Events.OnServerCommand.Add(onServerCommand)

why it error?

#

ERROR: General , 1672201348457> 58,528,300> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: trailer of non-table: null at KahluaThread.tableget line:1689.

#

when if i do a print after setting vcarid it says 3

frank elbow
#

Your function expects two arguments and you're passing one

#

Commands.KYRPT.getTrailer, I mean. It expects player and args, so if you pass only one then args will be nil

faint jewel
#

oh son of a.

#

thank you.

#

forest through the trees and all.

#

sendServerCommand("KYRPT", "getTrailer", {player = player, trailer = carid});

#

hmmm same thing still.

frank elbow
#

Have you modified the code for onServerCommand?

#

Regardless of what you send via sendServerCommand, if you don't call the function with the correct number of arguments some of them will be nil

faint jewel
#
 if Commands[module] and Commands[module][command] then
 Commands[module][command](args)
 end
end
#

that part?

frank elbow
#

Yeah, the Commands[module][command](args) bit

#

args is one value

faint jewel
#

it's an array. being passed as one

frank elbow
#

Mhm, so it's one value (confusing use of "value" here, I realize. I mean to say it's a single variable, not to imply that it isn't a reference type)

#

Unless you unpack it or otherwise get the player key out of it, it's going to be passed as one argument

faint jewel
#

so why does this work with my onclientcommand.

#

but then coming back it breaks?

frank elbow
#

I'd have to see it to answer that

brazen grove
#

Hey all, I've made a few custom zombies and I wanted to add loot to them. I've been looking at the code in TheyKnew and the UndeadSurvivor mod and I cannot for love nor money get it to work for my mod.
I don't fully understand how the code works so I may be missing something and was wondering if someone could explain what I'm doing wrong?

This is the code in question:

`function CheckDrops(zombie)
if not zombie:getOutfitName() then return false end
local outfit = tostring(zombie:getOutfitName());
local inv = zombie:getInventory();

if outfit == "Stalker" then
    if 50 >= ZombRand(1, 100) then
        inv:AddItems("Base.Maggots", 1);
    end
    if 30 >= ZombRand(1, 100) then
        inv:AddItems("Base.Maggots", 1);
    end
end`

I have created a file in the same location of my mod and tried the following:

`function CheckDrops(zombie)
if not zombie:getOutfitName() then return false end
local outfit = tostring(zombie:getOutfitName());
local inv = zombie:getInventory();

if outfit == "*My Zombie Outfit Name*" then
    if 100 >= ZombRand(1, 100) then
        inv:AddItems("Base.Hat_SantaHat", 1);
    end
    if 1 >= ZombRand(1, 100) then
        inv:AddItems("Base.Hat_SantaHats", 1);
    end

end`

I have my name of my outfit (which I know is working and spawning correctly) in place of My Zombie Outfit Name but no matter how many of that zombie I kill I never get a Santa hat (which I chose as a test item but have tried others). Can anyone identify what I am doing wrong?

agile vigil
#

What calls CheckDrops?

brazen grove
# agile vigil What calls `CheckDrops`?

I have no idea, that's what I'm stuck with, this code if from a mod I was told to look at to figure out how to add loot to zombies, there are a few bits I don't understand at all as I've never used it

frank elbow
#

You may want to search through the mod you're comparing with to see what calls it, since the function won't run unless it's called

agile vigil
brazen grove
#

Oh sorry, yeah the code is at the bottom Events.OnZombieDead.Add(CheckDrops);

agile vigil
#

This line hooks into the "OnZombieDead" event (which fires each time a zombie dies, naturally), and then adds the function named "CheckDrops".

Is that also in your code?

brazen grove
#

Events.OnZombieDead.Add(CheckDrops); is at the bottom of the file yeah, after the rest of the code

agile vigil
agile vigil
# brazen grove yeah

If you run the game with the -debug launch parameter and open a world with the mod enabled, could you press F11, scroll to your lua file in the lower-right corner view, click it, and then double click the line in your code that starts with if not zombie:getOufitName()? (It should change colour)

This sets a breakpoint, so the next time that code is fired, it'll open this view and we can debug from there. Go kill something to trigger it ๐Ÿ˜›

sour island
#

the zombie in OnZombieDead is not the body but the zombie before it dies btw

#

loot doesn't transfer unless it's a dead player

agile vigil
#

Does that mean Undead Survivor fails to put stuff in zeds' pockets? laugh

sour island
#

it may have set the zombies as undead players artificially with the boolean or probably yes and they add the loot elsewhere

#

zombies are very particular with loading/unloading it's kind of a pain but I had the same issue when adding loot for mine

agile vigil
#

I see nothing that indicates UndeadSurvivor does anything extra than what BigZombie is doing above, when I look through the UndeadSurvivor code. I wouldn't be too surprised if the UndeadSurvivor code had this bug.

brazen grove
#

This sounds like something far too complex for me, I guess my custom zombies will have to do without loot lol

brazen grove
agile vigil
sour island
#

hmmmm

#

I lied

#
---@param zombie IsoObject | IsoGameCharacter | IsoZombie
---@param player IsoObject | IsoGameCharacter | IsoPlayer
function eHelicopter_zombieAI.onDead_gottaGoFast(zombie, player, bodyPart, weapon)
    if ZombRand(100) <= 25 then
        zombie:getInventory():AddItems("Base.AlienPowerCells", ZombRand(1,4))
    end
    if ZombRand(1000) <= 1 then
        zombie:getInventory():AddItem("Base.AlienBlaster")
    end
end

---

Events.OnZombieDead.Add(eHelicopter_zombieAI.onDead)
#

I guess it does work

agile vigil
#

In that case, I'm not sure why it isn't working for BigZed ๐Ÿ˜ฆ

sour island
#

btw ZombRand(100) will never be 100

#

that may be why

agile vigil
#

Naw, they did both types of if statement, just in case.

sour island
#

the other is a 1/100 tho

agile vigil
#

Well, I mean, if 100 >= ZombRand(1, 100) is a 100% ๐Ÿ˜›

sour island
#

its 0%

#

ZombRand(n) = 0 to n-1

agile vigil
#

ZombRand produces numbers from a (inclusive) to b (exclusive) right? 100 is surely always larger than 99.

sour island
#

ZombRand(n, N) = 0+n to N-1

#

oh right

agile vigil
#

Also, my diary now gives XP, woo.

sour island
#

congrats

#

I should test my zombies...

#

I got pulled from my journal to fix something related to my shops

#

._.

brazen grove
#

I really wish I understood code better, I've managed to get by with most things but now I'm lost lol

fast galleon
sour island
#

I'll confirm if mine spawn items

brazen grove
fast galleon
#

And the distribution table?

brazen grove
fast galleon
#

nevermind

sour island
#

is there a dead body loot specific to outfit?

#

I don't think there is

agile vigil
#

They do the whole if outfit == "this outfit" thing for that ๐Ÿ˜„

fast galleon
fast galleon
sour island
#

Yeah my loot doesnt work

brazen grove
#

I copied the outfit from where it's defined in clothing which is what the Undead Survivor mod

sour island
#

Either my loot never worked or something was changed recently

#

If the stalker mod has maggots appear they probably do it in another way and never removed that one

#

None of them have any cells/guns

#

ah yeah distributions have a outfit section

#

it's probably handled in there

fast galleon
sour island
#

UndeadSurvivor's maggots don't spawn from OnDeadZombie

#

if they're there

brazen grove
#

I am lost at this point. All I know is I've been watching a streamer and the undead survivors tend to have extra loot when he kills them. I can't figure out how it's done

sour island
#

is he using the stalker mod?

#

there currently isn't a way to track the deadbody from the onDeadZombie event -- if you want more loot you'll have to add it to the loot distribution for that outfit

brazen grove
#

I don;t understand coding well enough to understand how to do that. Until now I've gotten by on trial and error lol

sour island
#

have you ever messed with distributions?

brazen grove
#

Yes but I use what I understand to be an old method. Because I learned mapping I make a room definition and create the following

SuburbsDistributions.petshop = { counter = { rolls = 2, items = { "Dogfood", 100, "DogChew", 70, } }, }

So I know that the room I set as petshop will spawn that loot in the counters.

As far as I'm aware this is a really old method but it's all I've ever needed.

I have also been given code to add items I've created to categories such as

`BZM.tab_addMagProcedural_Plushies = function(x,count)
ProceduralDistributions = ProceduralDistributions or {};
ProceduralDistributions.list = ProceduralDistributions.list or {};
ProceduralDistributions.list[x] = ProceduralDistributions.list[x] or {};
ProceduralDistributions.list[x].items = ProceduralDistributions.list[x].items or {};
table.insert(ProceduralDistributions.list[x].items,"BZMClothing.SpiffoDredd");
table.insert(ProceduralDistributions.list[x].items, count);
table.insert(ProceduralDistributions.list[x].items,"BZMClothing.SpiffoBatman");
table.insert(ProceduralDistributions.list[x].items, count);
end

BZM.tab_addMagProcedural_Plushies("GigamartToys",0.1)`

But again for me this was copy and paste, I never learned how it worked, just was told that it worked and when I've tested it in debug it shows in the possible loot

sour island
#
require "Items/Distributions"
Distributions.all.Outfit_AmbulanceDriver = { 
    rolls = 1, 
    items = { 
        "FirstAidKit", 2, 
        "Gloves_Surgical", 10, 
        "HandTorch", 8, 
        "Hat_SurgicalMask_Blue", 10, 
    }, 
    junk = { rolls = 1, items = {} } 
}
#

Outfits are listed under the all{}

#

this should inject this table inside safely

agile vigil
#

(FYI @brazen grove : You can use three backticks

```lua
like this
```

to create nice code blocks with lua formatting.)

brazen grove
brazen grove
sour island
#

require "Items/Distributions"

agile vigil
sour island
#

server/items/distributions

#

This code has to go in the server folder to work safely

brazen grove
brazen grove
sour island
#

The snippet I gave you is all you should need

#

Btw super weird helis has special zombies - if you wanted to see some tricks

brazen grove
#

Cheers, I''ll have a look anyway as my brain isn't very "normal", I'm a visual learner lol

sour island
#

Good thing we ran into eachother as I had no clue about my own zombie loot issue

brazen grove
#

Well I'm glad it helped haha. One thing I've learned about modding, you can have issues and no-one will tell you, you can also have perfectly working code and get a comment about how you broke their game and it's not even your mod lol

sour island
#

If you hate spam and have multiple outfits with the same loot:

#
require "Items/Distributions"

local alienOutfits = {"AlienTourist", "AlienRedneck", "AlienSanta", "AlienBeefo"}
for _,outfitID in pairs(alienOutfits) do
    SuburbsDistributions.all["Outfit_"..outfitID] = {
        rolls = 1,
        items = {
            "AlienPowerCells", 25,
            "AlienPowerCells", 25,
            "AlienPowerCells", 25,
            "AlienPowerCells", 25,

            "AlienBlaster", 1,
        },
        junk = { rolls = 1, items = {} }
    }
end
bleak prairie
#

Anyway I can check if someone is inside a building

fast galleon
#

but, he can too

sour island
#

Strange, getting errors with this

#

attempted index on non table for distros ๐Ÿค”

fast galleon
#

SuburbsDistributions or [1]

sour island
#

ah

#

you're right

bleak prairie
sour island
#

Note to self don't hit 'respawn all dead' when they're all sprinters

brazen grove
#

I just tried ```require "Items/Distributions"

Distributions.all.Monmouth_UnknownHost = {
rolls = 2,
items = {
"HockeyMask", 100,
"Hat_SantaHatGreen", 100,
"SpiffoTail", 100,
},
junk = { rolls = 1, items = {} }
}```
and no luck >.<

sour island
#

that's my bad Distributions should be SuburbsDistributions

#

also, I haven't gotten one to drop yet

brazen grove
#

lol

sour island
#

this is why I hate messing with distributions though

#

what's the caveat to junk vs items?

#

I recall something like junk ignores loot %

#

yeah idk, this is odd

brazen grove
#

SuburbsDistributions.all.Monmouth_UnknownHost = { 
    rolls = 2, 
    items = { 
        "HockeyMask", 99, 
        "Hat_SantaHatGreen", 50, 
        "SpiffoTail", 1, 
    }, 
    junk = { rolls = 1, items = {} } 
}``` 
No luck either :/
sour island
#

scratch that

#
    if container:getType() == "inventorymale" or container:getType() == "inventoryfemale" then
        local containerType = container:getType()
        if container:getParent() ~= nil and instanceof(container:getParent(), "IsoDeadBody") then
            containerType = container:getParent():getOutfitName()
        end
        if containerType ~= nil then
            local containerDist = SuburbsDistributions["all"]["Outfit_" .. containerType]
            if containerDist == nil then
                containerDist = SuburbsDistributions["all"][container:getType()]
            end
            LootZedTool.SpawnItemChecker.containerType = containerType
            LootZedTool.rollItem_CalcChances(containerDist, container, true, player, nil)
        end
        return
    end
#

Yeah, I'm not sure why it's not spawning stuff

#

Do you also delete all the zombies around you when testing?

#

I know that that impacts loot spawn

brazen grove
#

Yeah I do, delete them all then only spawn in the custom one in batches

sour island
#

I'm going to move the items into junk

#

wait... that snippet is only in the lootzedtool

#

I don't see Outfit_ used anywhere else

#

it's in java java

var9 = (ItemPickerJava.ItemPickerContainer)((ItemPickerJava.ItemPickerRoom)rooms.get("all")).Containers.get("Outfit_" + var4);
#

๐Ÿค” very weird, not sure what about the % chance would warrant not being able to find anything

brazen grove
#

I just tried the Undead Survivor mod, spawned a bunch of nomads and they all have loads of extra loot on them ๐Ÿ˜ฎ

#

and it's all the stuff in the OnDeathDistributions.lua >.<

#

I don't get how it works lol

sour island
#

weird

brazen grove
#

It definitely works on that mod, I cannot for love nor money figure out how though

sour island
#

let me rerun my original method

fast galleon
#

this should still be relevant

#

I can definitely insert new stuff there

sour island
#

Just tried that

#

yep, sure enough stalker works

brazen grove
#

I've tested it over and over and it works, I just can't replicate it lol

sour island
#

heh
undead survivor has this

        if getActivatedMods():contains("ExpandedHelicopterEvents") then
            if 50 >= ZombRand(1, 100) then
                inv:AddItems("EHE.ProteinBar", 1);
            end
        end
brazen grove
#

Yeah but I don't have ExandedHelicopterEvents installed and it works for me

#

I think that's just to add the protein bar into the loot pool if the mod is installed right?

sour island
#

Yeah, just thought it was funny

#

but yeah I can't seem to replicate the ...wait

#

god I'm dumb

brazen grove
#

?

sour island
#

"EHE.ProteinBar"

#

I transitioned all the items over to EHE/SWH a while back

#

Are your items Base?

brazen grove
#

I tried it with and without

sour island
robust jetty
#

@sour island have u ever made a guide ?

sour island
#

my issue was that I had Base.

#

@brazen grove go back to checkDrops and paste your entire file

#

oh wait, this means my distro issue was also from the fact I used Base

brazen grove
#

I deleted mine as it wasn't working but I can type it up again

sour island
#

Do you use intelliJ?

#

there's a version history you can skim through

sour island
brazen grove
#

I have no idea what that is :/

robust jetty
#

modding

sour island
brazen grove
#

Notepadd++

sour island
sour island
brazen grove
#

?

#

People talk about me? must be bad LUL

sour island
#

lmk when you have the draft - we can try to figure it out

brazen grove
sour island
#

Can't say with children around

ancient grail
#

Im intrigued lol not children spiffos

#

You get warned

robust jetty
#

What do you stream @brazen grove ?

sour island
#

(also I'm joking) but you should probably look into using something like VSC or intelliJ

ancient grail
#

I believe his a mapper

sour island
#

if you plan to dabble more with Lua

ancient grail
#

Nice save

brazen grove
#

Yeah I made a map, then I added things to that map, then Peach showed me how to 3D model so I've been learning that. I just try and learn as much as possible lol

robust jetty
#

Nice

ancient grail
#

Wow and now you will learn how to code?! You awsome man

brazen grove
#

but I am interested in what people have been saying...

sour island
#

It's mostly from unkH and how much he loves you

brazen grove
#

I only started mapping a year ago, 3d modelling I learned in a day with Peach but code... I'm a visual learner, code baffles me

sour island
brazen grove
#

OHHHHH!!!! If it's UkH then it will be about how I troll him endlessly

#

Poor man still doesn't know what I've sent him for xmas

ancient grail
#

Nice

brazen grove
#

Funnily enough it's him that's caused me to try and figure this out as I'm making him as a zombie lol

sour island
#

Nice

ancient grail
brazen grove
#

Yeah, he's all made and ready to go, done his tattoo sleeve etc, just need to make the right items spawn on him now

sour island
#
function CheckDrops(zombie)
    if not zombie:getOutfitName() then return false end
    local outfit = tostring(zombie:getOutfitName());
    local inv = zombie:getInventory();
    
    
    if outfit == "*My Zombie Outfit Name*" then
        if 100 >= ZombRand(1, 100) then
            inv:AddItems("Base.Hat_SantaHat", 1);
        end
        if 1 >= ZombRand(1, 100) then
            inv:AddItems("Base.Hat_SantaHats", 1);
        end
end
#

is SantaHat vanilla? the green one?

bleak prairie
#

How would I check if im inside a building?

brazen grove
sour island
#

it is vanilla, just thinking of possible issues

#

btw you have a typo in 'Hat_SantaHats'

#

and AddItem() can be used with out the second argument if you just want 1 anyway

brazen grove
#

I'll change the items once it works, I just wanted to get it working. Just going to test it again now

sour island
#

and you have the events call on the bottom under this?

#
function CheckDrops(zombie)
    if not zombie:getOutfitName() then return false end
    local outfit = tostring(zombie:getOutfitName())
    local inv = zombie:getInventory()
    
    print("Outfit: "..outfit)
    if outfit == "Monmouth_UnknownHost" then
        if 100 >= ZombRand(1, 100) then
            inv:AddItem("Base.Hat_SantaHat")
        end
        if 1 >= ZombRand(1, 100) then
            inv:AddItem("Base.Hat_SantaHat")
            --inv:AddItems("Base.Hat_SantaHat", 2)
        end
    end
end

Events.OnZombieDead.Add(CheckDrops)
#

Try that, the print will tell you what the outfitID is just in case it's not what you think it is

fast galleon
brazen grove
# sour island ```lua function CheckDrops(zombie) if not zombie:getOutfitName() then return...
    if not zombie:getOutfitName() then return false end
    local outfit = tostring(zombie:getOutfitName());
    local inv = zombie:getInventory();
    
    
    if outfit == "Monmouth_UnknownHost" then
        if 100 >= ZombRand(1, 100) then
            inv:AddItems("Base.Hat_SantaHat", 1);
        end
        if 1 >= ZombRand(1, 100) then
            inv:AddItems("Base.Hat_SantaHats", 1);
        end
        if 50 >= ZombRand(1, 100) then
            inv:AddItems("Base.Hat_SantaHats", 1);
        end
end

Events.OnZombieDead.Add(CheckDrops)```

I used that code and it still didn't work :/
sour island
#

try adding the print

fast galleon
#

think I said that an hour ago

sour island
#

my code was scuffed for a different reason - so I assumed undead was too

#

which taught me how to add loot to body distros so that's a plus

#

chances are the outfitID is something else

drifting ore
#

isn't isInARoom() a thing?

fast galleon
brazen grove
drifting ore
#

so that should work for checking if someone is in a room

#

or will only check for actual rooms

brazen grove
drifting ore
#

don't get me wrong i am still learning... a lot. also an art person learning code ๐Ÿ˜›

sour island
#

If you run the game with -debug in launch options you'll see an outputwindow

#

otherwise they're in the console.txt - in /users/BZM/Zomboid/

#

Also, if this is a mod that's already published - you need to unsubscribe from it

#

Otherwise the game will be using that version

brazen grove
#

Oh I know that, I never sub to it, just run off the workshop one

#

That's the console log but I'm not sure what I'm looking for

fast galleon
sour island
#

After you killed a zombie it would print out 'Outfit: n'

#

assuming that's what the print says

brazen grove
sour island
#
SEVERE: Error found in LUA file: C:/Users/bigzo/Zomboid/Workshop/Monmouth County/Contents/mods/Monmouth County/media/lua/server/Monmouth_OnDeathDistribution.lua
ERROR: General     , 1672247557439> ExceptionLogger.logException> Exception thrown se.krka.kahlua.vm.KahluaException: Monmouth_OnDeathDistribution.lua:19: 'end' expected (to close 'function' at line 3) near `<eof>` at LexState.lexerror line:278.
ERROR: General     , 1672247557439> DebugLogStream.printException> Stack trace:
se.krka.kahlua.vm.KahluaException: Monmouth_OnDeathDistribution.lua:19: 'end' expected (to close 'function' at line 3) near `<eof>`
#

you dropped this

end
brazen grove
sour island
#

I changed mine, as I copied yours from before

#

it was missing an end at the end

#

should be three ends

brazen grove
#

OK I've added that and will try again >.<

sour island
#

I don't suppose notepad++ has any sort of syntax highlighting?

brazen grove
sour island
#

it doesn't have a warning/error for missing an end or )/}?

brazen grove
#

That's how it looks, that's with the extra end and still no santa hats :/

sour island
#

any errors in console?

bleak prairie
#

How would I be able to check if someone is visible?

brazen grove
sour island
#

I dont see the file loaded in this log

#

Did you change it's name?

brazen grove
#

No :/

#

I'll boot it up and try again >.<

sour island
#

Wait

#

do you have undead survivors also installed?

#

your function is global

#

you might be overwriting yourself

#
local function CheckDrops(zombie)
    if not zombie:getOutfitName() then return false end
    local outfit = tostring(zombie:getOutfitName())
    local inv = zombie:getInventory()

    print("Outfit: "..outfit)
    if outfit == "Monmouth_UnknownHost" then
        if 100 >= ZombRand(1, 100) then
            inv:AddItem("Base.Hat_SantaHat")
        end
        if 1 >= ZombRand(1, 100) then
            inv:AddItem("Base.Hat_SantaHat")
            --inv:AddItems("Base.Hat_SantaHat", 2)
        end
    end
end

Events.OnZombieDead.Add(CheckDrops)
#

simply add a local before function

brazen grove
#

OK I'll try that in a sec, I have it installed but not active

sour island
#

then that wasn't the issue, weird it's not showing up in the loaded files

brazen grove
#

Still not working. I'll try changing it to local

sour island
#

Unless there's another CheckDrops somewhere it shouldn't matter

brazen grove
#

Well....

#

added that local and all of a sudden, santa hats :/

#

I guess I have something using checkdrops already? lol

robust jetty
#

If the file is working it will appear here, if you are in debug mode

sour island
#

most likely you have another version of it somewhere?

#

intelliJ also lets you search all files within a project

#

not to keep hyping it up

brazen grove
sour island
#

๐Ÿ‘

#

auto-completion for Lua functions - class lookup etc

brazen grove
# sour island ๐Ÿ‘

I appreciate all the help man, I'm going to go add the items I want to spawn on and my xmas present just got delivered so I have an RC car to play with lol

sour island
#

nice

#

and no problem

#

always sucks when there's some weird thing blocking progress

timber falcon
#

a bomb that makes zombies dance

#

idk man that sounds like fortnite but it'll be funny to watch hordes of zombies dance to california while half of the hoard mauls you down

eternal garnet
#

I was just about to say are you a Fortnite player lol

timber falcon
#

I don't play that shit

#

I just see memes about Fortnite

ancient grail
#

Make en dance like thriller

faint jewel
#

quick quick i need a script to grab all players with a moddata on them! ggoogogogogogogo

#

also, we need a "helpful snippets" sub channel.

cinder shadow
#

Im new to this, is there a list of all the functions/commands you can use? All the mods I'm studying, they have commands that will pull the the temperature, or the players health etc. How do you know what commands do all this or it's documented somewhere?

sour island
cinder shadow
#

ah cool thanks

sour island
#

Let's you use a lookup

#

you do need to know some of the classes - in this case the descript and nutrition are under isogamecharacter

cinder shadow
#

interesting, i see

faint jewel
#

that's too much damned work.

#

throw code at the wall and see what sticks!

ruby urchin
faint jewel
#

weeak

ruby urchin
#

honestly, I can't understand why, imagine you need a snippet to get all players, you just go to search bar and you will find all snippet related with that

faint jewel
#

I'mma try and get one added to the... OTHER modding discord lol.

#

IKR!

#

that's what i am looking for.

fast galleon
#

what's the other server with blackjack and snippets?

faint jewel
#

dm'd

sour island
#

I think the snippets were all on the pinned comments

#

but it became unwieldy

#

this was before #threads tho

last flax
#

I tried looking in the .class files, but I don't have decompilers to open those files.

faint jewel
#

hahah restart the game.

#

you messed up while editing it.

#

it got mad.

#

that means reboot.

sour island
#

If a function is added into Events.X.Add() is it a reference or a copy?

#

Can I change X later?

quasi geode
#

reference

sour island
#

yep, the issue was on my end

faint token
#

Hi guys, can someone tell me what's wrong with this code?

    TraitFactory.addTrait("sanctuarytrait", getText("UI_trait_Sanctuary"), 20, getText("UI_trait_Sanctuarydesc"), false);
end

Events.OnGameBoot.Add(SanctTraits);```

For some reason, with only this, the server get the "CFileWriterThread" error and dont startup
tropic tide
#

Hi all . I have a Pb on a pz mod in development. I spawn a unique bag type object at world creation. There should only be one. This bag has an unlimited capacity and a weight close to zero. The player can thus place it where he wishes. it will serve as a "base" or "shop" . I can then add items (weapons etc) in this bag according to the actions of the players. It all works very well. My problem now. The bag object is saved in a variable named TBAG when it is created. This variable is erased each time the game is restarted or the player dies and recreates a new character.
How to store, save the bag object in lua and find it when we launch the game again (continue game)? Please can you send me some sample code or point me in the right direction...

faint jewel
#

so hey, about that chunka code i was hunting...

#

quick quick i need a script to grab all players with a moddata on them! ggoogogogogogogo

faint jewel
#

you are all slow and i had to write this... monstrosity to appease myself.

#

there are villagers at my door with pitchforks.

sour island
#

you must write your own util functions from scratch to earn the veteran badge

#

there's 12 in all

faint jewel
#

bruuuuuuuuh i have like 28 tiny little shits.

#

i even wrote a tiny little shit to HELP ANOTHER TINY LITTLE SHIT.

#
-- Maffs Halp
function math.sign(v)
    return (v >= 0 and 1) or -1
end
function math.round(v, bracket)
    bracket = bracket or 1
    return math.floor(v/bracket + math.sign(v) * 0.5) * bracket
end```
#

see?

#

and that's just to be able to round numbers!

sour island
#

why can't you just add 0.5 to floor?

faint jewel
#

i wanted to be able to say math.round(v,.0005); and it round it to the ten thousandths.

faint jewel
#

MWAHAHAHAHAHAHAHA

#

now the REAL question.,... does car:getID() STAY as car id?

#

i basically need a way to track a VERY specific vehicle without the joy of moddata.

#

with moddata i could just staple the job id on and be done.

#

but NOOOOOO vehicles can't DO moddata

humble oriole
#

Is there a list anywhere of all the anim nodes for recipes?

faint jewel
#

anyways i 'm adding my snipplets to the other discord

humble oriole
#

Is there any way to do x number of or are we forced to use one of in recipes?

#

Lead00Buck/Improvised00Buck=9,

#

Was hoping that would work, but I don't think it will.

faint jewel
#

hey @sour island you down for a cleanup pass on something?

astral dune
#

just a driveby comment to point out that moddata does work on vehicles

dull moss
#

since in lua tables are passed by reference

local function insertValueInSleepTable(value, table)
    table.insert(table, 1, value)
    if #table > 100 then
        table.remove(table)
    end
end

local modData = player:getModData().DynamicTraitsWorld.SleepSystem;
insertValueInSleepTable(5, modData.Last100PreferredHour)```

will something like this work?

modData looks like this
```lua
player:getModData().DynamicTraitsWorld = player:getModData().DynamicTraitsWorld or {};
local modData = player:getModData().DynamicTraitsWorld
modData.SleepSystem = modData.SleepSystem or {};
modData.SleepSystem.Last100PreferredHour = modData.SleepSystem.Last100PreferredHour or {};
#

like It'll remove element from moddata table, right?

sour island
#

don't use .remove()

dull moss
#
  1. why?
  2. what to use instead?
sour island
#
  1. I tried looking for a snarky thing online, but it reindexes every index - you might as well run table.insert() for every entry
#
  1. depends on the table but you can just nil keyed entries
#

if your keys are numeric then you'll have to figure that one out - it's one of the 12 util functions every modder writes

dull moss
#

i really dont need keys here

#

I just need to store 100 numbers

#

in order in which I write them

#

unless Im misunderstanding usage of keys

sour island
#

if your keys are not in numeric order then the order is not accurate

dull moss
#

which as far as I understand are pretty much good to find stuff in your table by, well, specific key

sour island
#

one of the weird things about Lua

dull moss
#

this lua bullshit is getting on my nerves, why couldn't they just make non-keyed tables work fine

ancient grail
#

If u dont use .remove
U use= nil instead?

dull moss
sour island
#

you can use nil as is if the key isn't numeric

#

I have a safe(r) table remove

#

I can clean it up

#

what is the condition for removing them?

dull moss
#

literally jsut oldest one

sour island
#

so first?

dull moss
#

ye

#

i mean depending where you add new entries

#

if you add them at pos1

#

then last

sour island
#

so I suggest you stick the newest in first

#

if you nil the last entry the entry is cleanly removed

#

if you nil something with entries after it the entry stay there as a nil

#

what I was going to give you literally slides the entries over -- and it's less intensive than remove

dull moss
#
local function insertValueInSleepTable(value, table)
    table.insert(table, 1, value)
    if #table > 100 then
        table[101] = nil;
    end
end

local modData = player:getModData().DynamicTraitsWorld.SleepSystem;
insertValueInSleepTable(5, modData.Last100PreferredHour)```
?
sour island
#

yes, that works

ancient grail
#

Your player isnt on the param tho

#

So should be getPlayer()

dull moss
#

he is, i just took imporant lines

ancient grail
#

Got it

dull moss
#

thx for help

patent quiver
#

There's no way to get intellisense/code completion into an IDE for this right? There's no SDK or anything?

dull moss
#

best shit ever

sour island
#
---needs to be numerically ordered list
local function softRemove(tbl)

    local tblLen = #tbl
    --clear entries that are too far
    for i=1, tblLen do
        if CONDITION then
            tbl[i] = nil
        end
    end
    --prepare new index for table
    local newIndex = 0
    --iterate through and overwrite nil entries
    for i=1, tblLen do
        if tbl[i]~=nil then
            newIndex = newIndex+1
            tbl[newIndex]=tbl[i]
        end
    end
    --cut off end of list based on newIndex
    for i=newIndex+1, tblLen do
        tbl[i]=nil
    end

end
patent quiver
#

Thank christ, I thought I was going to have to do this blind

sour island
#

This is what I use for EHE targeting lists

#

I don't know if there's something already in vanilla that does this

dull moss
#

I wish discord would have "personal pins" functionality where you can pin things for yourself

sour island
#

but apparently it's less costly than table.remove()

dull moss
#

fuck

#

there, personal pin achieved

#

then just ctrl+f for it

molten cobalt
#

Hey, so I'm really new to this, and I want to create a trait that causes you to take damage when you're outside during the day time

I've got my trait available to select in-game but I can't figure out how to actually code the functionality

This is what I would like to happen, a very basic thing I just wrote

if player isOutside and CurrentTime >=09:00 then getMinDamage

Totally sure none of that is in the correct format, but that's the gist of it, any pointers - even to guides would be appreciated

Once I get that working I'll look into getting the moodle added but I just wanted the basic functionality first

dull moss
#

is that pseudocode of what you have or is that general gist of what you figured what you need so far?

molten cobalt
#

A general gist, but I need the time to be between 09:00 and 20:00, so greater that 9, but less that 20:00

dull moss
#
local function vampireTrait()
  local player = getPlayer();
  local timeOfDay = getGameTime():getTimeOfDay();
  if timeOfDay > 9 and timeOfDay < 22 and player:isOutside() then
    -- take damage here, havent looked much into it but you should look in bodydamage in javadoc
  end
end

Events.EveryTenMinutes.Add(vampireTrait)
#

probably here

#

ctrl+f for damage, alternatively look through list up here see what probably can be used to deal damage

#

or wait for someone to help with that. Havent done much bodydamage myself so idk

#

if you want trait to work every minute use EveryOneMinute

molten cobalt
#

Ok all that is amazing, thank you ๐Ÿ™‚

dull moss
#

generally i'd recommend everyminute for what you trying to do

dull moss
#

lele there's literally AddDamage

#

public void AddDamage(int int1,
float float1)

dim hill
#

Is there a mod that adds more stuff to build?

dull moss
#

int is probably player:getPlayerNum()

#

and float is damage

#

@molten cobalt

molten cobalt
#

Ok great thank you

#

I'll have a look and let you know I get on ๐Ÿ™‚

frank elbow
dull moss
#

uh?

frank elbow
#

So you should either rename the parameter or keep a reference to insert (or the global table)

dull moss
#

arent passed args local?

frank elbow
#

They are, I'm saying the second arg will shadow the table in the global scope

dull moss
#

can you explain for my dum dum brain

frank elbow
#

Not dumb, I'm just not explaining well ๐Ÿ˜„

astral dune
#

shadowing is when you use the same name for a local variable that a global variable has, thereby blocking your access to the global

dull moss
#

yea but do i care about it?

#

OOOOH

frank elbow
#

The table variable that contains insert, remove, etc. is in the global scope. By naming a parameter table, you are shadowing it, which anonymous explained above

dull moss
#

I do cuz i wanna use global .insert

frank elbow
#

Mhm

dull moss
#

Gotcha

#

cheers

#
local function insertValueInSleepTable(value, tableToInsertInto)
    table.insert(tableToInsertInto, 1, value)
    if #tableToInsertInto > 100 then
        tableToInsertInto[101] = nil;
    end
end```
#

so dis good, right?

frank elbow
#

Yup, looks good. I wonder why you aren't just returning early to block inserts above 100 rather than undoing them, though

dull moss
#

cuz i wanna remove oldest entry

#

not just block it at 100

frank elbow
#

Ohh, gotcha

dull moss
#

thx

dim hill
#

Anyone knows why @sour island's Shops & Traders mod won't show anything when I hover "Shops"?

dull moss
astral dune
#

p. sure inserting at 1 means the code has to go and redo all the keys in the table, I would probably just implement a ring buffer for something like that

dull moss
#

redoing keys == reshuffling table or extra processing time?

#

smolbrain < my brainscan btw

#

cuz honestly as long as it doesnt reshuffle im fine with milisecond of extra processing time

astral dune
#

since you're capping it at 100 it probably doesn't add too much time, but of course it has to reshuffle

frank elbow
#

Since it's 100 elements to move at most it's not that big of a deal (ninja'd), but I agree w Anonymous that it could be improved

dull moss
#

NotLikeDis the whole point was to remove oldest entry

#

if it shuffles it its lost

frank elbow
#

It's not shuffled, it's moving each element by 1

dull moss
#

ah

astral dune
#

which is shuffling, lol

dull moss
#

ye then its fine, its small table

astral dune
#

I guess we mean different things

dull moss
#

no

#

thats shifting

frank elbow
#

Ya, understood as random shuffle

dull moss
#

shifting != shuffling

frank elbow
#

Technically it is a shuffle, but everyone uses shuffle to imply randomness

#

Denotation vs connotation

dull moss
#

ah

astral dune
#

shifting is a subset of shuffling

dull moss
#

told you

#

literally my brainscan

astral dune
#

either way, as long as you're not doing this every tick, its probably fine

dull moss
#

ye, every 10 min

#

so negligible

astral dune
#

ya

sour island
#

inserting at 1 is also costly?

#

would the thing I gave him be better than inserting at 1?

#

also I think I got a working reverse engineer XP calculation

astral dune
#

costly as in O(n), once every 10 minutes with n = 100 doesn't matter

dull moss
#

I mean from my moddata names it's quite understandable what kind of mod im making, but either way I came up with cool way to dynamically ear/lose More/Less sleep traits. Every sleep that player takes I mark midpoint, then I count last 100 midpoints averages which is this player preferred sleep schedule (aka when they are used to sleep), then if they sleep withing +-6h of that midpoint it counts for them upkeeping their schedule, if they sleep outside of it, it counts against it. So that way you can shift your schedule and for example sleep between 13-23h marks and stil keep the earned trait cuz your body adjusted to it

#

pretty cool stuff I think

sour island
#

neat

dull moss
#

ye i have a bunch of really cool custom systems

#

cant wait for realease

#

๐Ÿ˜„

limber oar
#

Anyone have any idea why my mod textures aren't reloading ingame? I'm in debug and all that but swapping out the texture PNGs doesn't go "live" until I restart the game. Needless to say this is really tossing a wrench in my workflow.

#

Is there some option I need to enable (or disable)? Some setting in the mod itself?

dull moss
#

Prob PZ limitation

patent quiver
#

I haven't had luck getting it to be consistent ingame either. Just restart all the time.

dull moss
#

It can reload lua files from debug menu like 80% of the time so hoping for textures idk man xd

patent quiver
#

Sometimes it doesn't even work between loads

#

So I just have to fully reboot game

limber oar
#

Blech. I wish there was a way to edit textures on-model without needing to boot the game every time...

#

Change pixel > reboot game > needs to be a diff pixel > reboot game

#

Turns a small retexture into a whole day's work

patent quiver
#

Yea, I messed with textures on one item for 3 hours last night.

#

But tbf I had a rare bug caused by an image that was too large. Make sure your image sizes are correct.

limber oar
#

They should be, they're drawn directly on the OG textures.

patent quiver
#

Good. I tried to put an icon in that was like 3x larger than it should have been and it caused my item to not have the "grab" context action

#

took forever to find the cause

limber oar
#

At least knowing that everyone else is suffering and it isn't just me helps a little

patent quiver
#

Same

limber oar
#

It's especially frustrating because the textures aren't consistently UV mapped, so one pixel somewhere will get stretched out like crazy to wrap around an arm or something

#

Doing something as simple as "draw a straight line across the skirt hem" is nigh impossible

patent quiver
#

That's rough

limber oar
#

c'est la vie

sour island
#

Now I can decide what gets stored

ancient grail
#
function doStashSpawn()
    local sx = math.floor(getPlayer():getX())
    local sy = math.floor(getPlayer():getY())
    local sz = getPlayer():getZ() 
    local cs = getPlayer():getCurrentSquare() 
    local cell = getCell():getGridSquare(sx+(ZombRand(-15,15)), sy+(ZombRand(-15,15)), sz);
    local stash = IsoThumpable.new(cell, cs, "location_community_cemetary_01_43", false, 
    ISDoubleTileFurniture:new("Crate", "location_community_cemetary_01_43", "location_community_cemetary_01_43"));
    stash:setIsContainer(true);
    stash:getContainer():setType("Crate");
    local maxSpawnItem = SandboxVars.SES.scMaxSpawn
    local rollSpawn = ZombRand(1, maxSpawnItem)
        for i = 1, rollSpawn do 
        local spawnables = getScriptManager():getAllItems()
        local itemPicked = spawnables:get(ZombRand(1, #spawnables))
        stash:getContainer():AddItems(itemPicked:getFullType(), 1);
        cell:AddTileObject(stash);
            if isClient() then stash:transmitCompleteItemToServer(); end
        end
        getPlayerLoot(0):refreshBackpacks()
        getPlayerInventory(0):refreshBackpacks()
end

local function StashAndCorpseSpawn()
    local StashSpawnChance = SandboxVars.SES.scChanceStash
    local CorpseSpawnChance = SandboxVars.SES.scChanceCorpse
    if ZombRand(1, 1000) <= StashSpawnChance then doStashSpawn() end
    if ZombRand(1, 1000) <= CorpseSpawnChance then doCorpseSpawn() end
end

Events.OnPlayerMove.Add(StashAndCorpseSpawn)
#

will this work?

patent quiver
dull moss
#

nope, all was clear

#

well

#

I did have to reinstall inteliji

#

cuz i had 2021

patent quiver
#

Yea, I did that first thing

dull moss
#

and guide is for 2022 so i was just like "fuck it i'll just reinstall"

patent quiver
#

But I got failed/skipped annotations, and "WARN: Unable to find mod.info file"

#

I couldn't find the exact SDK

dull moss
#

just make sure you follow all steps and try again thats all i can say

patent quiver
#

I got 17.0.5 but they used 17.0.3 openjdk

dull moss
#

i use other jdk as well

patent quiver
#

Hm, are you sure you just didn't notice the warnings?

dull moss
#

at which step

patent quiver
#

A few of them - particularly the annotate step and the mod.info warning is in setupworkspace

dull moss
#

huh?

patent quiver
#

I guess that particular warning shows in all of them

dull moss
#

which steps here

#

b3? b7? c1?

patent quiver
#

C

dull moss
#

did u not get this?

patent quiver
#

Yea, I did ultimately.

dull moss
#

well i minimized my shit so i jsut waited until i got that

patent quiver
#

Aight it's probably fine.

dull moss
#

maybe i did get warnings idk

patent quiver
#

First time using tools like this so I just don't know what's normal.

dull moss
dull moss
sour island
#

is ... is it working?

dull moss
#

yes

#

had to do some magic with hours

#

how can I send like a snippet which you can expand

#

seen ppl do it in discord

#

nice

#

whole system ^

#

spent last 10 min making it properly calculate average betweem 21pm and 4am cuz it was giving like 12am as an answer

#

cuz well yaknow (21+4)/2 is 12.5

#

thought i accounted for that in find midpoint

#

but was missing that last bit
if midPoint <= 6 then midPoint = midPoint + 24 end

#

now just need to add passive negative ticking to SleepHeathiness if players are awake for more than 20h and all done

#

pretty cool, huh

#

gotta do few more tetsts see if it does everything correctly

#

is there a way to check modData from debug mode?

#

like the table

#

i know that when it throws error you can go dig around in last called variables, including tables

#

but without that

#

fully works, both when you sleep thorough midnight (so your starting hour is higher than your end hour) and through the day, when starting hour is lower than end hour

#

well this was fun

#

code would look so much cleaner if i didnt have those loggers in but I kinda want to leave them in if I need them again sadge like in 29 lines i have 10 ofthem being commented out as loggers sadge

sour island
#

gimme that code a second

dull moss
#

except there was + 24 missing in 1 place

#

I cleaned it up a bit actually

#

lemme send fresh one

#

ah, local currentPreferredTargetHour = calculateAverage(modData.Last100PreferredHour); should be in the body of main function

#

actually it'd be less demanding to keep it in both ifs

#

than to do calculations every 10 min

#

then i only count it when player is sleeping or after they finished sleeping

sour island
#
local function sleepSystem()
    local player = getPlayer();
    local modData = player:getModData().DynamicTraitsWorld.SleepSystem;
    local timeOfDay = getGameTime():getTimeOfDay();
    local currentPreferredTargetHour = calculateAverage(modData.Last100PreferredHour);
    local lowerBoundary = calculateTime(currentPreferredTargetHour, -6);
    local upperBoundary = calculateTime(currentPreferredTargetHour, 6);
    --print("DTW Logger: Time of Day: "..timeOfDay);
    --print("DTW Logger: Boundaries L:"..lowerBoundary.." and U:"..upperBoundary);
    if player:isAsleep() then
        if modData.CurrentlySleeping == false then
            modData.WentToSleepAt = timeOfDay;
            modData.CurrentlySleeping = true;
        end
        
        local SleepHealthiness = ((timeOfDay > lowerBoundary or timeOfDay < upperBoundary) and 200) or -200
        modData.SleepHealthinessBar = math.min(SleepHealthiness, modData.SleepHealthinessBar + 1 / 6);
        print("DTW Logger: Between boundaries of "..lowerBoundary.." and "..upperBoundary);
        print("DTW Logger: SleepHealthinessBar ".. modData.SleepHealthinessBar);

    end
    if not player:isAsleep() and modData.CurrentlySleeping == true then

        local time = ((modData.WentToSleepAt > timeOfDay and 24) or 0) + timeOfDay
        print("DTW Logger: old currentPreferredTargetHour: "..currentPreferredTargetHour)
        print("DTW Logger: findMidpoint("..modData.WentToSleepAt..", "..time..")="..findMidpoint(modData.WentToSleepAt, time));
        insertValueInSleepTable(findMidpoint(modData.WentToSleepAt, timeOfDay), modData.Last100PreferredHour);
        print("DTW Logger: new currentPreferredTargetHour: "..calculateAverage(modData.Last100PreferredHour));

        modData.CurrentlySleeping = false;
    end
end
#

does this help

dull moss
#

oh u combined ifs

#

nice

sour island
#

I can redo it on the newer one

dull moss
#

na, no need, but thanks ๐Ÿ˜„

#

I use those myself sometimes

#

but on much smaller statements where it's easier to understand without having to think about it for X seconds

trail oracle
#

I am new to modding. I am trying to run a basic Lua in the following directory:

C:\Users\ghoul\Zomboid\mods\mymod\media\lua

I've enabled the mod but when I play the game nothing happens.
What could be the issue I am having?
Below is the code in my lua file:

local function EveryTenMinutes()
-- Java: we get the first player
local player = getSpecificPlayer(0);

-- Java: let the player speak    
player:Say("I like turtles.");

end

Events.EveryTenMinutes.Add(EveryTenMinutes)

dull moss
#

for example

local rainProtection = (primaryItem and primaryItem:isProtectFromRainWhileEquipped()) or (secondaryItem and secondaryItem:isProtectFromRainWhileEquipped());
local rainGain = rainIntensity * (rainProtection and 0.5 or 1);
sour island
#

btw there's an issue

#

currentPreferredTargetHour is cut off from it's define

#

purple means global

dull moss
#

yea i fixed it

#

this is final look atm

sour island
#

also it's not just about combining ifs, makes it easier to change later/maintain with out having to jump around

dull moss
#

ye but then i have to figure out later what was in those ifs

#

its much easier to read 2 ifs

#

to me at least

#

a bit more inconvenient, I agree

sour island
#

I can see that - that's also why I include extra ()s

#

helps me keep track of OOP at a glance

dull moss
#

also this is not correct
local SleepHealthiness = ((timeOfDay > lowerBoundary or timeOfDay < upperBoundary) and 200) or -200

sour island
#

did I get it backwards?

dull moss
#

oh wait no i missed next line

#

yea no I definitely prefer upper combination to be unfolded

#

local time = ((modData.WentToSleepAt > timeOfDay and 24) or 0) + timeOfDay this one is short and simple

sour island
#

local X = ((true) and 200) or -200

dull moss
#

ye

#

but you see i had to look at it for 10 seconds

sour island
#

it takes some getting used to for sure

dull moss
#

its easier for you cuz you're more experienced

#

๐Ÿ˜„

finite owl
dull moss
#

anyway 4 am, gn all ๐Ÿ˜„

sour island
#

btw shouldn't that check be an AND?

#

to be in the boundaries?

dull moss
#

nope

sour island
#
local timeInBoundaries = timeOfDay > lowerBoundary or timeOfDay < upperBoundary
local SleepHealthiness = (timeInBoundaries and 200) or -200
modData.SleepHealthinessBar = math.min(SleepHealthiness, modData.SleepHealthinessBar + 1 / 6);
```might be easier to read
dull moss
#

cuz my time can be between 0 and 30

#

eh, im not sure i can even explain it honestly

#

it works

dull moss
#

if u wanna toy with it and see for yourself, can send the thing with all the extra functions it calls

sour island
#

nah, I really need to jam out this journal update

#

kind of been putting it off

dull moss
sour island
#

really don't wanna deal with people up in arms over it behaving differently lol

dull moss
#

One of must-have mods getting update? Sign me in, chief

sour island
#

might add a sandbox to allow for career XP to be transcribed

#

also need to still write out the TV tracking

#

I have the framework laid out

dull moss
#

that's just same as setting free trait points to 100

sour island
#

oh, not the starting skills, never

dull moss
#

ah

sour island
#

I mean the bonus you get to XP earned

dull moss
sour island
#

right now when you transcribe you get the XP you've earned recorded as if it were flat

dull moss
#

oh

sour island
#

but like any starting points over 0 nets a % bonus

dull moss
#

ye

#

but in any case i go bedge

sour island
#

I translated the XP bonus math into Lua - so I can now decide what gets transcribed lol

#

alrighty, same for me actually

#

Also to hype this up

#

and to keep me on it too

#

Need to work on the license stuff so it's on the up and up

ancient grail
#

anyone knows what table the zombie distro is

sour island
#

For dead bodies?

faint jewel
#

zombie bistro?

limber oar
#

Can the ContextMenu files have new entries added "a la carte," or does the whole file need to be overwritten?

summer fractal
#

Anyone got a mod that can give u skills etc. Shooting, carpentry, farming

finite owl
# limber oar Can the ContextMenu files have new entries added "a la carte," or does the whole...

You can add your own callback to the OnFillInventoryObjectContextMenu or OnFillWorldObjectContextMenu events, and add your option(s) to the context. This is how it works in RV Interior to add the "Exit" option when right-clicking in the world inside a vehicle interior:

local function onPlayerSelectExit(player)
    sendClientCommand(player, "RVInterior","clientStartExitInterior", {})
end

local function addExitOption(playerId, context)
    local player = getSpecificPlayer(playerId)
    if RVInterior.playerInsideInterior(player) then
        context:addOption(getText("UI_exitrvinterior"), player, onPlayerSelectExit)
    end
end

Events.OnFillWorldObjectContextMenu.Add(addExitOption)
ancient grail
#

is there such a thing?

faint jewel
#

anyone made a function that spawns a tile server side?

ancient grail
#

i thought you already have that function

faint jewel
#

i mean a fucking tile that doesn't disappear when the people leave.

#

no i cheated.

ancient grail
#
if isClient() then skizotsTile:transmitCompleteItemToServer(); end
faint jewel
#

and my server has 48 of the signs stacked on each other.

#

object:transmitCompleteItemToServer() you mena THIS

#

which i have. and does shit.

sour island
#

If you can create an object you could make a command

#

Client -> server, then transmit back

faint jewel
#

and THAT is what i am asking for lol.

sour island
#

That is if there isn't a vanilla function already like the one Glytcher mentioned

#

I'm not at my PC atm but commands are kind of tedious

#

Have you made one before?

faint jewel
#

the one i am USING is client side and i cannot for the life of me get the dumb server to spawn one. so that it stays put.

#

are fishing nets visible in mp?

#
    local grid = getCell():getGridSquare(x, y, z);
    local net = IsoObject.new(grid, sprite, "FishingNet");
    grid:AddTileObject(net)
    net:transmitCompleteItemToServer();
``` this is how the do it.
sour island
#

Is your sign an isoObject?

faint jewel
#

it's a tile in the tilesheet lol.

#
            local sname = tileSpawn.Tile
            local object = IsoObject.new(sq,sname)        
            sq:AddSpecialObject(object);        
            object:getSprite():setName(sname);
            local signData = object:getModData();
            signData.loc = tileSpawn.loc;
            object:transmitCompleteItemToServer()
            object:transmitModData()
``` my current spawning method.
sour island
#

You can prescribe a sprite to an isoObject, as with nets

#

Try the add tile thing?

faint jewel
#

i THINK that is what i had at first. but hey i'll give it at hrow.

finite owl
#

What's the difference between a "tile object" and a "special object"? I can see that IsoGridSquare has methods to AddSpecialObject and AddTileObject, and that the IsoGenerator calls tile.AddSpecialObject...

#

(I'm also trying to spawn an IsoObject and have it actually save/persist, and likewise having no luck)

faint jewel
ancient grail
#

anyone knows what table the zombie distro is

faint jewel
#

yeah that didn't work either :/

ancient grail
#

imean if they die and the stuff with em

finite owl
#

@faint jewel there's another method IsoGridSquare.transmitAddObjectToSquare(object, number), but that appears to just be calling AddTileObject followed by either transmitCompleteItemToServer or transmitCompleteItemToClients, depending on whether it's client- or server-side.

#

For what it's worth.

faint jewel
#

i might have just accomplished it!

finite owl
#

What worked?

faint jewel
#

well I had to fix some old code.

#

so now... WE TEST!

#

nvm.

#

no sign at all now.

#

le sigh

#

stupid variable

#

okay so it spawns... but it does NOT stay.

#

but it's gotta be spawning something or there wouldn't be all those damned mod datas.

vast pilot
#

How would I make an object that gives combat skill experience when hit with a weapon?

#

I'm trying to make a training dummy

faint jewel
#

wtf does getCell():setDrag(cursor,0) do?

ancient grail
ancient grail
vast pilot
#

Right now I'm just looking through the code of other mods that add world objects to see if I can piece something together

finite owl
#

I'd guess a start would be to make an object which is an IsoThumpable, which I believe will generate the event OnWeaponHitThumpable when it's hit by a weapon.

#

Looks like there are 3 parameters passed to the event callback: the IsoGameCharacter who hit the thumpable (could be a zombie or a player or...), the HandWeapon which was used to hit it, and the IsoThumpable itself.

vast pilot
#

I would probably use the HandWeapon, so that I can make it give experience to whatever skill that weapon is tied to

#

Does VSCode have libraries for PZ? I know IntelliJ has some but I'd prefer to not have to download another IDE

finite owl
#

You'd want to check the 3rd parameter first, to see if it was your training dummy object (because every thumpable in the world will generate that same event when it's hit)

vast pilot
#

Okay

#

Thanks

faint jewel
#

anyone know of a mod that spawns tiles that aren't MAP based.

#

i just wanna drop a tile and have the server acknowledge it

finite owl
#

I got my Metal Drum spawning and persisting, if that's of interest. My problem turned out to be not that it wasn't persisting, but that I was creating it incorrectly, so I was getting a pile of invalid objects but my code to check whether the square had a metal drum already wasn't finding one.

#

I ended up doing this:

    local object = ISMetalDrum:new(nil, "crafted_01_29")
    object:create(square:getX(), square:getY(), square:getZ(), false, "crafted_01_29")
    square:transmitAddObjectToSquare(object.javaObject, -1)
#

That's somewhat specific to metal drums, but the trick that might be useful is fishing out the javaObject from the returned Lua object to pass to square:transmitAddObjectToSquare

faint jewel
#

huh?

finite owl
#

Well, that's an IsoObject (or an IsoThumpable actually) rather than a tile, so I don't know how relevant it is for you.

faint jewel
#

i'm doing the mall map sign basically.

#

ISMetalDrum where did you get that from?

finite owl
#

ISMetalDrum is an object defined by PZ in lua/server/MetalDrum/BuildingObjects/ISMetalDrum.lua

faint jewel
#

well shit.

finite owl
#

What's the item name of the mall sign?

faint jewel
#

well i created my own.

#

and there's two variations

#

tileSpawn.Tile = that's what feeds in the name.

finite owl
#

So I guess that you'd create the object directly using something like IsoThumpable.new(getCell(), square, "your_sprite_name")?

#

How are you creating it in Lua at the moment?

faint jewel
#
            local sname = tileSpawn.Tile

            --this spawns the tile, and pdes not work.
            local grid = getCell():getGridSquare(x, y, z);
            local sign = IsoObject.new(grid, tileSpawn.Tile, tileSpawn.Tile);
            grid:AddTileObject(sign)
            sign:transmitCompleteItemToServer();

            -- this transmits the mod data. and works.
            local signData = sign:getModData();
            signData.loc = tileSpawn.loc;
            sign:transmitModData()

            local object = ISMetalDrum:new(nil, sname)
            object:create(x, y, z, false, sname)
            sq:transmitAddObjectToSquare(object.javaObject, -1)
            
            --local object = IsoObject.new(sq,sname)        
            --sq:AddTileObject(object);        
            --object:getSprite():setName(sname);
            --tileSpawn.spawned = true;            
            --table.remove(JobBoardTileSpawns.toSpawn, i);
``` throwing all the code i can find at it XD
finite owl
#

So the ISMetalDrum javaObject is just created by something like the IsoObject.new call you already have (it's created IsoThumpable.new).

#
    local cell = getWorld():getCell();
    self.sq = cell:getGridSquare(x, y, z);
    self.javaObject = IsoThumpable.new(cell, self.sq, sprite, north, self);
faint jewel
#

that's it?

finite owl
#

It does a bunch of other stuff too, setting maxhealth and break sounds and waterMax and things. I don't know how much of the other stuff is relevant though.

faint jewel
#

i just need to make a collideable object that the server remembers.

finite owl
#

Does the drum in your code above get remembered, but the sign doesn't?

faint jewel
#

i didn't do the drum lol.

#

was asking about it and never ran it.

faint jewel
#
            local sq = getCell():getGridSquare(x, y, z);
            local sign = IsoThumpable.new(getCell(), sq, sname, false, ISSimpleFurniture:new("Job Board", sname, sname));
            sign:setIsContainer(false);
            sign:setCanPassThrough(false);
            sign:setIsDismantable(false);
            sq:AddTileObject(sign);
            if isClient() then
              sign:transmitCompleteItemToServer();
            end
            triggerEvent("OnObjectAdded", sign)
``` this aint work either.
vast pilot
#

Okay, dumb question I know, but how do I code a thumpable?

fast galleon
#

@vast pilot
not sure what you want, but literally the message above

faint jewel
#

that didn't work though polty.

winter thunder
#

So- For my drug mod, I am looking to add some additional traits that represent the really harsh, irreversible side effects of drug abuse. Anyone have any solid traits ideas?

faint jewel
#

it spawns them locally but NOT on the server.

winter thunder
faint jewel
#

it should transmit it to the server.

#

but does not.

finite owl
#

Could you run the code to create the sign on the server side instead?

fast galleon
#

I am sure you'll find somebody to fix it ๐Ÿ˜…

winter thunder
#

This seems to be related to the issue

#

"However you must be aware that if you modify the moddata of an object client side, it is not modified server side. IS added methods to sync client/server object like sendObjectChange or transmitModData but these methods are not universally supported by every class.

So whenever you modify moddata on client side and rely on it on server side you will have to send a client command and modify it on the server."

finite owl
# fast galleon <@506431095730864141> not sure what you want, but literally the message above

I don't know much about the custom-item-definition-and-sprites side of things, as I've mostly been doing code, sorry. If you wanted to spawn the training dummy from code, then something like Skizot's snippet would be a start... you call IsoThumpable.new with the cell, square, sprite name, "north" parameter (?) and a Lua object which wraps the IsoThumpable Java object. But you'd probably want to make a custom piece of furniture that a player can craft and place in the world, and I don't know how to hook that up.

#

So much of Zomboid's code is hard-coded if statements checking if something is this specific object type, or that specific object type... it's a really brittle and hard-to-extend architecture.

#

Oh, blah, sorry

winter thunder
finite owl
#

That was meant to be @vast pilot

winter thunder
#

Then youd just need to make a script for the recipe of that item, which is also simple

fast galleon
#

If you want to do a simple test, try this

local sign = IsoThumpable.new(sq:getCell(), sq, "KYRO_Tiles_03", false, {})
finite owl
#

I've seen callbacks in a recipe when something is crafted, but wouldn't you want it to invoke something when the object is placed?

fast galleon
#

and just to verify, you do this from client?

#

@faint jewel

faint jewel
#

yes

#

i repurposed that from a mod that WORKS.

winter thunder
#

lol

faint jewel
#

yes i saw it and no it is no what i need.

winter thunder
#

damn

#

I tried

#

<3

faint jewel
#

ty though โค๏ธ

fast galleon
#

which part of code doesn't work though

#

add a bunch of prints and minimise the number of outside factors

faint jewel
#

here's the thing it works. technically.

#

but iot doesn't save the sign if you leave the chunk.

#

when you come back to it its says no Sign, Making one!

fast galleon
#

can you share the code that prints that

faint jewel
#
function checkTileSpawns(sq)
  local x, y, z = sq:getX(), sq:getY(), sq:getZ();
  if #JobBoardTileSpawns.toSpawn > 0 then
    for i = #JobBoardTileSpawns.toSpawn, 1, - 1 do
      local tileSpawn = JobBoardTileSpawns.toSpawn[i];
      if x == tileSpawn.x and y == tileSpawn.y and z == tileSpawn.z then
        local SignExists = checkForSign(sq, tileSpawn.Tile)
          if SignExists then
            print("there's a sign here, move along!");            
          else
            print("no Sign, Making one!"); 
            local sname = tileSpawn.Tile

            local sq = getCell():getGridSquare(x, y, z);
            local sign = IsoThumpable.new(getCell(), sq, sname, false, ISSimpleFurniture:new("Job Board", sname, sname));
            sign:setIsContainer(false);
            sign:setCanPassThrough(false);
            sign:setIsDismantable(false);
            sq:AddTileObject(sign);
            if isClient() then
              sign:transmitCompleteItemToServer();
            end
            triggerEvent("OnObjectAdded", sign)

            -- this transmits the mod data. and works.
            local signData = sign:getModData();
            signData.loc = tileSpawn.loc;
            sign:transmitModData()
          end
      end
    end
  else
    Events.LoadGridsquare.Remove(checkTileSpawns);
  end
end
#

enjoy!

finite owl
#

Does the square that's supposed to have the sign end up with no extra objects on it when you return to the area, or if you check it with F2 is it accumulating a bunch of borked objects?

fast galleon
#

we have to go deeper, what is checkForSign??????

#

what he said, I was thinking about that

#

also when you spawn something you should remove it from JobBoardTileSpawns.toSpawn somewhere?

#

gotta go, hope you find the answer

winter thunder
#

hey also- Anyone here know the people that made the mods -> iMedicine (Nyamops) or Zombie Virus Vaccine (Demonius) ?

Haven't seen anything from either of them in a long time... :( Both Russian, Nyamops seemed to have disappeared last spring, and Demonius the summer of 2021. Just didnt know if anyone had heard anything

faint jewel
#
function checkForSign(square, signsprite)
  for i=1,square:getObjects():size() do
    local obj = square:getObjects():get(i-1)
    if obj:getSprite() and obj:getSprite():getName() then
      local spriteName = obj:getSprite():getName()
      if spriteName == signsprite then
          print("there's a sign!"); 
          return true;
      end
    end
  end
  return false;
end
winter thunder
sour island
flint beacon
#

how is it possible to use setSprite to change a sprite of an existing object when using a recipe

pulsar rock
#

How slow is CheckModsNeedUpdate generally?

#

It hasn't picked up a pending update yet for the past ~30 minutes hmm

cobalt lark
#

does anyone know of a mod that makes noise when a bandage gets dirty

round depot
#

Can we have a thread for us pleb's mod ideas? Just in case we have a good idea that someone else might be able to pull off

sour island
drifting ore
#

@sour island Love your mods. Could you possibly make a simple mod that increases being drunk duration?

pulsar rock
#

Which is working fine, except for the fact that the command isn't actually finding mod updates