#mod_development

1 messages Β· Page 530 of 1

hearty herald
#

since everything is a table

thin hornet
#

yeah but there is like 2 sort of table, key table and index table and mixed (which become like a key table in reality)

#

this is why we have pairs() for looping key table and #table to loop indexes table

#

#keyTable wouldnt work

hearty herald
#

I see

#

Well, just use the good ol access index then

#

that you showed

thin hornet
#

your updated post up there should be good now lets just see what happen with that mixed procedural thingy

hearty herald
#

Honestly just want to know if the apple drops often and the procedural item

#

Cuz if you get apple & the procList item, then mixed works

thin hornet
#

inventory\ItemPickerJava.java

#

thats where the distribution is parsed in java

hearty herald
#

I haven't been able to find the java stuff yet

#

otherwise I'd have looked at it already

#

πŸ˜‚

#

I think you have to find a rar file or something and export it

#

But I never bothered

thin hornet
#

from my understanding, if rolls is found it will completly ignore your procedural stuff

hearty herald
#

Hmm. So you're saying, we would have to edit it in postMerge?

#

By taking the entirety of inventoryMale, make a procList out of it

#

Add it into proclist, clear inventorymale and add procedural=true, add our proclist and inventorymale that we jsut made?

thin hornet
#

yeah

#

or just set rolls to nil

#

it will go to procedural automatically

#
   private static void ParseSuburbsDistributions() {
      KahluaTableImpl var0 = (KahluaTableImpl)LuaManager.env.rawget("SuburbsDistributions");
      Iterator var1 = var0.delegate.entrySet().iterator();

      while(true) {
         label57:
         while(var1.hasNext()) {
            Entry var2 = (Entry)var1.next();
            String var3 = var2.getKey().toString();
            KahluaTableImpl var4 = (KahluaTableImpl)var2.getValue();
            if (var4.delegate.containsKey("rolls")) {
               ItemPickerJava.ItemPickerContainer var12 = ExtractContainersFromLua(var4);
               containers.put(var3, var12);
            } else {
               ItemPickerJava.ItemPickerRoom var5 = new ItemPickerJava.ItemPickerRoom();
               rooms.put(var3, var5);
               Iterator var6 = var4.delegate.entrySet().iterator();

               while(true) {
                  while(true) {
                     if (!var6.hasNext()) {
                        continue label57;
                     }

                     Entry var7 = (Entry)var6.next();
                     String var8 = var7.getKey().toString();
                     if (var7.getValue() instanceof Double) {
                        var5.fillRand = ((Double)var7.getValue()).intValue();
                     } else if ("isShop".equals(var8)) {
                        var5.isShop = (Boolean)var7.getValue();
                     } else {
                        KahluaTableImpl var9 = null;

                        try {
                           var9 = (KahluaTableImpl)var7.getValue();
                        } catch (Exception var11) {
                           var11.printStackTrace();
                        }

                        if (var9.delegate.containsKey("procedural") || !var8.isEmpty() && var9.delegate.containsKey("rolls") && var9.delegate.containsKey("items")) {
                           ItemPickerJava.ItemPickerContainer var10 = ExtractContainersFromLua(var9);
                           var5.Containers.put(var8, var10);
                        } else {
                           DebugLog.log("ERROR: SuburbsDistributions[\"" + var3 + "\"] is broken");
                        }
                     }
                  }
               }
            }
         }

         return;
      }
   }
#

well its an iterator, its analyze each entry and goes deeper

#

on the highest level its analyzing if it find rolls it handle it as a regular distribution table.
if not then it try to analyze deeper and find for the isShop or procedural field

hearty herald
#

local function ProceduralZombieLoot()
  -- get inventoryMale/female
  local maleInv = Distributions.all.inventorymale
  local femInv = Distributions.all.inventoryfemale
  -- extract roll&items into a Procedural gen
  ProceduralDistributions.list.inventorymale = {
    rolls=maleInv.rolls,
    items=maleInv.items
  }
  ProceduralDistributions.list.inventorfemale = {
    rolls=maleInv.rolls,
    items=maleInv.items
  }
  table.insert(maleInv.ProcList, {name="inventorymale", min=1,max=1,weightChance=100})
  table.insert(maleInv.ProcList, {name="inventoryfemale", min=1,max=1,weightChance=100})
  maleInv.rolls = nil
  femInv.rolls = nil
  -- done?
end
Events.OnPostMerge.Add(ProceduralZombieLoot)
#

Some bullshit liek that lol

thin hornet
#

yup

#

should work

hearty herald
#

forgot the nil

#

The ProcList should already exist from merging the tables

#

so just have to add the procedurally generated inventorymale

thin hornet
#

by the way you can also just access those inner table like this local maleInv = Distributions.all.inventorymale

hearty herald
#

hmm that looks better

thin hornet
#

oh damn i just realize that all.inventorymale is where the zombie loot is defined xD

hearty herald
#

Yeah its the random shit zombies have on them, except for their outfit loot

thin hornet
#

right

hearty herald
#

Honestly making a utility mod with just that postmerge thing might be useful haha

#

Allowing people to add ProcLists to zombies

#

& mods that edit the default list would still work with it

thin hornet
#

now for the event stuff

#

there is really not much happening there xD

#

they all triggered one after the other

hearty herald
#

Yeah

#

it should do that

thin hornet
#

So that mean you can do anything to them before they get picked up by the next line which start parsing them

#

yeah i was expecting something else, but i see why now

hearty herald
#

The default suburbsdist does nothing on pre

thin hornet
#

the mixup of java and lua is confusing sometime

hearty herald
#

it does all the work in merge

#

Then it calls post

#

which the defauilt thing does nothing in, again

#

It used to remove Razors lol

#

probably as a test

#
local function postDistributionMerge()
    --RemoveItemFromDistribution(SuburbsDistributions, "Razor")

    --DeepPrintDistributionTable(SuburbsDistributions,"")
end
thin hornet
#

Razors matter

hearty herald
#

It removed all razors lmao

thin hornet
#

pretty cool

hearty herald
#

I assume that's what it would usually be used for

#

However, we could hook to OnmMerge instead of PostMerge

#

It just feels safer to hook on PostMerge

#

Because then you know 100% it's already mer ged lol

thin hornet
#

yeah but changing the inventory for a procedural list even if done in the postmerge seems like a plan for breaking stuff if ever someone attempt to do something to that table

#

i wonder why its not already a proc list tho

#

probably cause proc list was initiated to not repeat the same stuff everywhere, but maleinventory is not repeated anywhere else.

hearty herald
#

Yeah

#

But I doubt a mod will be changing the list after it's been parsed?

#

Can you even do it after the parse?

thin hornet
#

nah its parsed only once

hearty herald
#

Which would mean postMerge is the last place to change it

#

So it probably can't break it unless other mods utilise postmerge and do something strange

#

But in worst case, you can tell people to put your mod later in load order

#

Or do mods have a variable for prefered load order?

#

Like, if you set a high number it will be more likely ot load later

thin hornet
#

for example if someone this change maleinventory before you by idk, reusing your code, then it would break cause the field wouldnt exist anymore

hearty herald
#

Hmm

#

Well, that's pretty niche

thin hornet
#

lot of people copy other mods without knowing that what they are actually doing

#

xD

hearty herald
#

The whole making the zomb inventories into ProcLoots is niche to begin with!

#

In fact, you can parse the entire table and make everything that is rolls+items into Proctables

#

It's not that difficult

#

But since it was just 2 tables I didn't even bother doing loops for it

thin hornet
#

For example, people copy ItemTweaker into their mod. Everytime it overwrite the globals

hearty herald
#

They just copy the thing wholesale?

thin hornet
#

so if you were to have an edited ItemTweaker in yours but someone else add the unedited ItemTweaker again after yours then your edited version is not there anymore

hearty herald
#

Guess ppl gotta start renaming everything with their initials or modname

thin hornet
#

So best way to not get that problem when including something like ItemTweaker into your own mod, is to make it local and or change the global names

hearty herald
#

Can't you simply make it so your mod requires itemTweaker?

#

And just use it by require

thin hornet
#

that would be the proper way of using "API" mods

#

but people prefer not have dependencies most of the time

#

its a bit messy

hearty herald
#

Hmm

#

Dependencies are great tho πŸ˜‚

thin hornet
#

often due to lack of knowledge

hearty herald
#

Also gives credit to the author of the API in a direct way

thin hornet
#

yeah but sometime you may want to have your own edited version if you need more feature from it.

hearty herald
#

Can't you use some form of extensions in lua?

#

If the API is stored in an object, you could add your own functions to it

thin hornet
#

if its global, but if you mess with it it can also break other mod that require it

hearty herald
#

I just noticed my Role has changed to "builder" lol

thin hornet
#

I like to make my APIs local and export it, and then any other script that want to use it need to require it into a local variable, this prevent modification to the original object kindof

hearty herald
#

That's a good way of doing it I suppose

#

I guess to use things like classes in lua you need to make a function .new() that creates the empty object and populated it with functions etc?

thin hornet
#

yeah using ISBaseObject is a good thing for making classes that need to be instanciated

hearty herald
#

Well, hopefully the asura guy will find some use in our rambling lmao

thin hornet
#

Oh yeah im glad now i feel like I know more about how the distribution works than like 2 hour ago

hearty herald
#

Hopefully that'll make it easier to mod things πŸ˜‚

thin hornet
#

Probably writing a Guide would be a good thing if any exist

hearty herald
#

I think the insight that if rolls exist and isn't nil, then procedural is completely ignored even if procedural=true

#

is pretty valuable

#

in fact, does it ever check procedural?

#

oh it does

#

var9.delegate.containsKey("procedural") || !var8.isEmpty()

#

var9 contains procedural, or not not var8 ?

#

lol

#

oh okay

#

I see

#

var8 is the ProcList in this instance

#

I'm pretty certain

#

However, its using or instead of and

#

which seems weird

#

makes it seem like you can completely ommit procedural as long as you have the list...?

thin hornet
#

mhm

hearty herald
#

it's quite the clusterfuck lol

#

var8 i also compared to isShop

thin hornet
#

procedural or (notEmpty and rolls and items)

#

i think it read it like so

hearty herald
#

I think java conditionals shorthand

thin hornet
#

like it the first is true it probably not read the restart of the condition or im not too sure

hearty herald
#

so procedural true would make it so the or is whatever

#

Well yes,

#

if proc is true rest is ignored

#

well, what i'm curious of is that

#

it doesn't seem like it actually checks that procedural is true

#

it simply puts the var8 and var10 into the var5.container

#

var9 seems to be the table with keys

#

and var10 is the containers from var9

#

so maybe keyvaluepairs?

#

or maybe whatever is inside each key from var9

thin hornet
#

look at line 251

hearty herald
#

I don't have the whole file lmao, just what you posted πŸ˜‚

thin hornet
#

its handle it in an other method

hearty herald
#

that method also doesn't check if the bool is true lol

#

but it does save the variable

#

so maybe its used later

thin hornet
#

its prioritize procedural

#

so even if rolls + procedural is set

#

it will be procedural first

hearty herald
#

It does check the procedural

thin hornet
#

they all go into that other method

#

and its check for procedural first

hearty herald
#
// line 678
if (var0.procedural) {
rollProceduralItem(var0.proceduralItems, var1, var5, var3, var4);
} else {
if (var0.junk != null) {
   doRollItem(var0.junk, var1, var5, var3, var2, true, var4);
}

doRollItem(var0, var1, var5, var3, var2, false, var4);
}
#

It only checks if .procedural is true at line 678 from what i've seen so far

#

line 1039 checks it too

#

ah, here it gets the list of procedural items

#
// line 1039
if (var5 != null && var5.procedural) {
ArrayList var6 = var5.proceduralItems;

for(int var7 = 0; var7 < var6.size(); ++var7) {
   ItemPickerJava.ProceduralItem var8 = (ItemPickerJava.ProceduralItem)var6.get(var7);
   if (var2.equals(var8.name)) {
      ItemPickerJava.ItemPickerContainer var9 = (ItemPickerJava.ItemPickerContainer)ProceduralDistributions.get(var2);
      if (var9.junk != null && var3) {
         return var9.junk;
      }

      if (!var3) {
         return var9;
      }
   }
}
}
#

so there are 2 places in the code that uses .procedural inside a conditional

thin hornet
#

no matter what those other function do

#

the moment its parsed if it has procedural = true everything else will be ignored

hearty herald
#

hmm

thin hornet
#

the other functions you talk about are only using the "already parsed" data

hearty herald
#

So do you think, if we add procedural=true to something, we should also do the postmerge thing for that thing?

#

Since it seems it might completely ignore the normal items then?

thin hornet
#

if you add procedural and procList to maleinventory, its will simply ignore the original items and rolls yeah

#

so using post merge to move the original rolls items into a procList is still valid.

#

but unsetting the rolls after is useless

hearty herald
#

That's good to know then

hearty herald
#

btw, do you need the require for distributions?

thin hornet
#

not really, all vanilla script are loaded before mods

hearty herald
#

@thin hornet @blazing radish I think this should work, but i haven't tested it.

-- ExampleDistributions.lua
require('Items/Distributions')
require('Items/ProceduralDistributions')

local ExampleTable = {
    all = {
        inventoryfemale = {
            items = {"Watermelon", 100,}
            procedural = true,
            ProcList = {
                {name="ExampleProc", min=1, max=2, weightChance=5}
            }
        },
        inventorymale = {
            items = {"Apple", 100,}
            procedural = true,
            ProcList = {
                {name="ExampleProc", min=1, max=2, weightChance=5}
            }
        }
    }
}
ProceduralDistributions.list.ExampleProc = {
    rolls = 1,
    items = {
        "Screwdriver", 1,
    }
}
table.insert(Distributions, ExampleTable);

-- Example to add default loot into it's own ProcTable to keep it, should work with other mods modifying the default loot.
local function fixEntry(entryMain, entryName)
    local entry = entryMain and Distributions[entryMain] or Distributions
    entry = entryName and entry[entryName]
    -- return if invalid entry
    if not entry or not entry.rolls or not entry.items then
        -- will this print somewhere?
        print("invalid entry, entryMain:", entryMain, " entryName:", entryName)
        return 
    end
    ProceduralDistributions.list[entryName] = {
        rolls=entry.rolls,
        items=entry.items
    }
    entry.procedural = true -- sets to true just in case.
    entry.ProcList = entry.ProcList or {} -- makes sure ProcList exists
    table.insert(entry.ProcList, {name=entryName, min=1, max=1, weightChance=100})
end
local function PostProceduralFix()
    fixEntry("all", "inventorymale") -- Distribution.all.inventorymale
    fixEntry("all", "inventoryfemale") -- Distribution.all.inventoryfemale
    fixEntry(nil, "SomeBag") -- should print invalid entry.
end
Events.OnPostMerge.Add(PostProceduralFix)
thin hornet
#

add a local to entry = Distributions[entryMain][entryName]

hearty herald
#

Good catch

#

Btw, when a table contains a single item, does the weight matter?

#

I figured the chance of an item appearing would be weight/totalweight

thin hornet
#

Not too sure how the weightChance work honestly

hearty herald
#

I think weightChance is different from weight

#

weightChance is probably a straiht up 0-100%

#

but just weight is usually competing against other weights

thin hornet
#

its seems so, and can even be omitted

hearty herald
#

Using weight efficiently is probably best done using a binary tree

#

First split would be half items

#

Or half maxweight

#

half items would be more efficeint

#

The primitive competing weight is just placing it in an array, then using a for loop that removes the weight of the item each iteration and stops when your random number is less than weight of the item you're on right now

#

naturally binarytree will be faster if you have a lot of items

#

but for small amounts, the array version should work just fine

thin hornet
#

so weightChance is the weight for the entry in the procList array

#

so if you had only one proc entry you dont even need to set the weightChance

hearty herald
#

What if you have minimum 1 and maximum 2?

#

Would it always be 2 if it's only one item, or will it be an actual chance

#

Guess we'd see if I bothered to test the thing I wrote earlier

#

Since I set screwdriver to min 1 max 2 with weightchance 5

thin hornet
hearty herald
#

hmm, also one thing that might chance how I wrote the fix function

#

If you have a proc table with rolls higher than 1

#

If you proc that table, does it add 1 item per roll?

#

Or should you reverse it, and say 1,rolls on the proctable isntead and put the proctable rolls to 1

thin hornet
#
local function fixEntry(entryMain, entryName)
    local entry = Distributions[entryMain] and Distributions[entryMain][entryName]
    if not entry or not entry.rolls or not entry.items then return; end

    ProceduralDistributions.list[entryName] = {
        rolls=entry.rolls,
        items=entry.items
    }
    entry.procedural = true;
    entry.ProcList = entry.ProcList or {}; -- probably good to define this in case its not set
    table.insert(entry.ProcList, {name=entryName, min=1, max=1, weightChance=100})
end
hearty herald
#

Yah it might contains some bugs as I'm not very used to lua

#

I figured it would be paired with something that already set it to procedural, but you're absolutely correct that it's good to make sure

#

I assumed you wouldn't try to do something you know won't work πŸ˜‚

thin hornet
#

xD

hearty herald
#

But if you wanted to go through every single entry, say procedurally

#

then yes those checks are needed

#

Yo ugonna have to check is entry exists too then

#

cuz it could be nil

#

shouldn't it has or nil on entry too?

#

I think lua conditional assignment is weird af

thin hornet
#

what do you mean, which line

hearty herald
#

Tho, C conditional assignment is also pretty sorcery

#

something like a = (true) ? b : c

thin hornet
#

if i recall

#
local entry = Distributions[entryMain] and Distributions[entryMain][entryName]
--- if the first condition is not nil the other one will be the result
hearty herald
#

hmm

#

but what is the result if the first one is false

thin hornet
#

and if the other is nil too then it will result to nil too

hearty herald
#

isn't that the or nil is usually for?

#

or does it keep the nil from the first assignment

thin hornet
#

if the first condition is not met it wont go to the other one, therefore its should be nil or false
if the first condition is met then it will assign the second condition as the result which in turn could be nil if that key doesnt exist

#

If we were to add parenthesis then it would simple return true or false

hearty herald
#

I did consider making a check for Main being nil i nthe function, in order to ignore that and just go on entryname

#

Incase there is an container that isn't classified under sometyhing

#

but I think everything is under something

#

inside distributions

#

The thing that the function doesn't do, is if theres something that is 3 deep

#

My first thought was making a list that you could go through in order to dig down, but I figured it's not needed for the example

#

Didn't need to make something universally applicable

thin hornet
#

nothing is 3 deep?

hearty herald
#

I didn't check, so I don't know

#

From what I saw, it's either RoomName.ContainerType

#

or All.containertype

thin hornet
#

i think its only 2 deep,

#

its all the same

#

other than

#

bags

hearty herald
#

Hmm

#

Are bags 1deep or 3?

thin hornet
#

bags are 1 deep only

hearty herald
#

Yeah so there is a case for making the Main disregarded

#

If I wanted to expose the fix function that should definitely be included, but I'm not really a modder πŸ˜‚

#

I haven't really made anything yet

#

I tried makign a few things, but it was quite the hassle

drifting ore
#

Can I add a custom recipe to a vanilla magazine ?

thin hornet
#

you could override the vanilla magazine i supose oh its an item you could use ItemTweaker

hearty herald
#
local entry = entryMain and Distributions[entryMain] 
entry = entry and entry[entryName] or Distributions[entryName]
if not entry then return end
#

That should do it right?

#

if entryMain is nil it should become Distributions[entryName]

thin hornet
#
-- Example to add default loot into it's own ProcTable to keep it, should work with other mods modifying the default loot.
local function fixEntry(entryMain, entryName)
    local entry;
    if Distributions[entryMain] and Distributions[entryMain][entryName] then
        entry = Distributions[entryMain][entryName];
    else
        entry = Distributions[entryMain];
    end
    if not entry or not entry.rolls or not entry.items then return; end

    ProceduralDistributions.list[entryName] = {
        rolls=entry.rolls,
        items=entry.items
    }
    entry.procedural = true -- sets to true just in case.
    entry.ProcList = entry.ProcList or {} -- makes sure ProcList exists
    table.insert(entry.ProcList, {name=entryName, min=1, max=1, weightChance=100})
end
local function PostProceduralFix()
  fixEntry("all", "inventorymale") -- Distribution.all.inventorymale
  fixEntry("Toolbox") -- Distribution.all.inventoryfemale
end
Events.OnPostMerge.Add(PostProceduralFix)
hearty herald
#

If entryMain doesn't exist, it should try also try entryName, is entryMain exists it will try [entryMain][EntryName]

#

All it doesn't have is the rolls and items for return check

#
if not entry or not entry.rolls or not entry.items then return end
``` should have same effect
#

If any of them are nil, it should return

thin hornet
#

isnt that what we did?

hearty herald
#

I hadn't added it

#

Just being ultra fancy with the lua conditional assignments

#
local function fixEntry(entryMain, entryName)
    local entry = entryMain and Distributions[entryMain]
    entry = entry and entry[entryName]  or Distributions[entryName]
    if not entry or not entry.rolls or not entry.items then return end
    ProceduralDistributions.list[entryName] = {
        rolls=entry.rolls,
        items=entry.items
    }
    entry.procedural = true -- sets to true just in case.
    entry.ProcList = entry.ProcList or {} -- makes sure ProcList exists
    table.insert(entry.ProcList, {name=entryName, min=1, max=1, weightChance=100})
end
#

though, does return need a ;?

#

when it's oneline if

thin hornet
#

nope

#

; is never required unless you plan on pasting in the debug command line

hearty herald
#

It's required for multiple statements on one line I think

#

like a=2;b=3;

thin hornet
#

i use ; all the time as an habit to make it clearer

hearty herald
#

Yeah it was my habit too lol

#

actually I think the entry = entry and entry[name] or dist[name]can be shortened

#

to entry = entry[name] or dist[name]

#

Just worried it might go "lol no ur accessing a nil table"

thin hornet
#

for readability

    local entry;
    if Distributions[entryMain] and Distributions[entryMain][entryName] then
        entry = Distributions[entryMain][entryName];
    else
        entry = Distributions[entryMain];
    end
    if not entry or not entry.rolls or not entry.items then return; end

is ok too πŸ˜›

hearty herald
#

No!

thin hornet
#

xD

hearty herald
#

πŸ˜‚

#

what happens if you try to index nil into a table?

#

lol

#

does it treat it like an actual key?

thin hornet
#

yeah i think so

hearty herald
#

I'm a big fan of limiting if statements if possible

#

since they are a performance thief

thin hornet
#

function calls are worst

hearty herald
#

depends on the language since compilers like to paste it into the function I think

thin hornet
#

i mean for pz lua

hearty herald
#

I know you should be storing shit locally

thin hornet
#

its interpreted by the java script engine

hearty herald
#

because if you call java functions that is the worst

#

but calling lua functions I don't think is that bad?

#

Readability and reusability is quite important though as someone who works with the code, so even if lua functions were pain I'd still use them lol

thin hornet
#

sure

#

same

hearty herald
#

I am fully onboard with not going through the java lua interface as much as possible

#
local entry = entryMain and Distributions[entryMain] or Distributions
entry = entryName and entry[entryName]
-- return if invalid entry
if not entry or not entry.rolls or not entry.items then
    -- will this print somewhere?
    print("invalid entry, entryMain:", entryMain, " entryName:", entryName)
    return 
end

I think this should cover all the bases, and looks even shlichker

#

entry becomes Distribution[entryMain] if entryMain exists, otherwise it's Distributions,
entry becomes entry[entryName] if entryName exists, otherwise it's nil

#

But idk if it will screw itself by the assignment of entryName before and entry[entryName] ?

#

does the conditional assignment evaluate to the end before assignment?

#

It should, but you never know lol

thin hornet
hearty herald
#

okay so it seems to do a cuck

#

My C brain melts at that lmao

thin hornet
#

xD

#

install lua on your computer for quick testing, or you can also just use online lua console

hearty herald
#

is there a print for errors btw?

#

Because I haven't personally been able to see prints outside of ingame

thin hornet
#

a print for error?

hearty herald
#

yeah, like when lua errors etc with F11 you see it

#

But I don't see normal print anywhere in F11 menu

#

Maybe you can throw an error somehow for debugging

thin hornet
#

in the in game console

#

and C:\Users\Konijima\Zomboid\console.txt

#

all print should be there

hearty herald
#

hmm maybe would have to check that console.txt for failures of loading

thin hornet
#

yeah that would be there

hearty herald
#

actually no , it is not a cuck

#

because I expect nil if the entryName is nil

#

πŸ˜‚

#

my brain

#

what I need to check is

#
a = {}
a.test = "yaboi"
b = a
a = "test" and a.test
b = nil and b.test
print(a)
print(b)
thin hornet
hearty herald
#

Yeah so it does work

#

good haha

#

it does fully evaluate the conditional assignment

#

before any assignment

#

and it should work same with a string instead of true right?

#

Since boolean in lua is always true unless the value is nil

#

nil or false

thin hornet
#

yeah anything not false or nil would evaluate as true unless specifically asking for a true a == true

hearty herald
#

I really should test this thing, but i am honestly too lazy. my burst of attention is soon done

thin hornet
#

a = {};a.test = "yaboi";b = a;a = "test" and a.test;b = nil and b.test;print(a);print(b);

hearty herald
#

I mean the whole system haha

#

wouldnt surprise me if there are some sleeper bugs in there that won't show up until you use it

#
-- file: ExampleProceduralFix.lua
-- probably contains bugs
require('Items/Distributions')
require('Items/ProceduralDistributions')

-- function fixEntry: Fixes a container to use ProcList while retaining the base loot by adding it as a new procList entry.
-- entryMain: first level in Distributions, such as 'roomName' or 'all'. Some items (like schoolbag) does not have one, leave it as nil for those.
-- entryName: name of the container we want to fix into ProcList, such as inventorymale for male zombie corpses.
local function fixEntry(entryMain, entryName)
    local entry = entryMain and Distributions[entryMain] or Distributions
    entry = entryName and entry[entryName]
    -- return if invalid entry
    if not entry or not entry.rolls or not entry.items then
        print("invalid entry, entryMain:", entryMain, " entryName:", entryName)
        return 
    end
    -- create a distributionName that is sure not to conflict with anything, probably could be ommitted
    local distName = "GeneratedFix_" .. entryName -- lua string concatenation is weird.
    ProceduralDistributions.list[distName] = {
        rolls=entry.rolls,
        items=entry.items
    }
    entry.procedural = true -- sets to true just in case.
    entry.ProcList = entry.ProcList or {} -- makes sure ProcList exists
    table.insert(entry.ProcList, {name=distName, min=1, max=1, weightChance=100})
end
-- Example usage of fixEntry
local function PostProceduralFix()
    fixEntry("all", "inventorymale") -- Distribution.all.inventorymale
    fixEntry("all", "inventoryfemale") -- Distribution.all.inventoryfemale
    fixEntry(nil, "SomeBag") -- should print invalid entry. but some containers with no mainEntry exist.
end
Events.OnPostMerge.Add(PostProceduralFix)
#

if I could be arsed I'd make a global object that you can add entries to a list, which is then read by the OnPostMerge

thin hornet
#

also

    if not entry or not entry.rolls or not entry.items then
        print("invalid entry, entryMain:", entryMain, " entryName:", entryName)
        return 
    end

could be

    if not entry or not entry.rolls or not entry.items then
        error("invalid entry, entryMain:" .. entryMain .. " entryName:" .. entryName)
    end

if you want it to throw the error

hearty herald
#

Just figured it might possibly happen

#

Will the error stop execution?

thin hornet
#

yeah

hearty herald
#

I only really wanted to log it as an error but continue with the rest

#

Guess it's possible to throw the error at the end of the function if a boolean is set to true

thin hornet
#

or just use a pcall

#
local function test(param1)
  error("ERROR!!" .. param1);
end;
if pcall(test, "param1") then
  print("did not throw error");
end;
#

i think error in pcall still write to the console.txt id have to test i forgot

hearty herald
#

is that lua's version of try?

#

but without the catch lol

chrome egret
blazing radish
#

just wow

#

I'l be honest with ya, I didn't understand a thing, this is too advanced for my very beginner knowledge on this

#

I didn't realized it was that hard

hearty herald
#

Well, not sure if that's the best method of doing it. But atleast it's probably more efficient to let java do the work isntead of lua.

blazing radish
#

I see

#

well, tbh I'm very grateful of your help

#

seriously

#

that dive into tbaels lua and java was incredibly mindblowing

#

I realize I need to learn a lot to do somehting good in the future

hearty herald
#

I never tried the code, so I'm not sure it works in practice πŸ˜‚ do tell me if you try it

smoky meadow
#

how to put description on an item? pls help.

simple ingot
#

anyone know what role this code?

#

No matter how much I test, I don't know.

#

It seems to be a health-related figure.

#

Give it up.😎

drifting ore
smoky meadow
smoky meadow
smoky meadow
#

does the spacing need an underscore or not

drifting ore
#

"My description" is a string, so space don't matter

nimble spoke
#

a text entry, like Tooltip_tissue_tooltip

blazing radish
#

or the earlier one where you did the ping?

#

I copiednboth just in case but I wasn't sure

hearty herald
#

Yeah that part should make the base loot of the inventorymale & female into a Procedural table and add it

#

The other thing you need to do is add your own procedural table like in the one above

nimble spoke
simple ingot
hot patrol
#

Anyone know if there are any mods that add a very low chance of surviving a bite or immunity? I want something that doesn't totally change the dynamic of the game but does give you a reason to continue trying to survive after a bite.

blazing radish
hearty herald
#

but I never tried anyof it

simple ingot
blazing radish
#

right?

hearty herald
#

Yah the file has example on both

blazing radish
#

amazing, thank you so much

hearty herald
#

line 0 to 28 could be a file in itself, and 29 to the end could be another file

#

But I think it doesn't matter, they can be in same file lol

#

I had to split it in two when I was pasting code into discord because I don't have nitro lmao, and adding the comments take a lot of characters x)

blazing radish
#

lmao

#

I've read the whole rabbit hole, felt like this meme

#

"I want to add 1 item to every zombie" at starting point

#

"here is how you create your own proc tables and add them to the game without overriding anything" at the end

hearty herald
#

Lmao, as I said there might be another method that doesn't use distributions, or adds it to outfits or something

blazing radish
#

what I don't understand is why using OnZombieDead duplicates the desired item according to the player number

#

and it's even bugged, because it's only "visual", you take the item and instantly dissapears from your inventory

#

annoying as hell

hearty herald
#

hmm

#

Well, the game has some kind of peer to peer

#

And the scripts run on all players I believe as well

blazing radish
#

well, if this doesn't work I'll be returning to OnZombieDead regardless, it seems to be the safest method to do what I want

nimble spoke
simple ingot
faint jewel
#

is it possible to add or remove kills from a player?

weary crypt
#

Is there a way to reduce the weight of an item attached to a belt/holster/back by a particular amount or is it always reduced by a fixed value?

#

Ah, oh well. Thank you.

sharp wind
#

is there a car damage event that can be used?

hearty herald
sharp wind
#

You should be able to since as admin you can edit weight

late hound
weary crypt
#

I'll take a look at that, thank you.

late hound
#

I looked at their code and its more of they ended up making their own system.

weary crypt
#

To call me a novice when it comes to lua would be generous already so if that's the case it's probably over my head.

late hound
#

to act pretty much identical to vanilla, since yeah the default 30% weight reduction that holsters give is defined somewhere in some convoluted way where its just too tough to track down.

drifting ore
#

ZombRand(10) is from 0 to 9 right ?

thin hornet
drifting ore
#

Also, can I set a display name for an inventory item with lua. After looking, I don't think it's possible.

frank elbow
#

I'd send it myself but I can't at the moment, but searching through the files for "rename" or smth should help

native dragon
#

do you guys know where are the water dispenser files?

#

I searching all media files and didnt find anything

#

maybe it have another name but I don't even find the texture

nimble spoke
#

and tile properties go inside .tiles

drifting stump
#

Not on my pc so cant elaborate atm :\

drifting ore
frank elbow
#

I'm at my computer now so I can find it, one moment

drifting ore
#

So you can rename a bag from the contexte menu ? I didn't knew that

frank elbow
#

Yep, that's the way I found out how to rename when I was trying to do the same thing

drifting ore
frank elbow
#

See setName

#

For an example, see ISInventoryContextMenu:onRenameBagClick

drifting ore
#

Ok, thx

native dragon
slate wasp
#

can i use Item properties like BoredomChange on recipes? trying to make a recipe that reduces boredom when crafted

native dragon
#

try

mortal widget
#

If anyone needs a thumbnail for their mod done message me, i'll do it for free i'm very bored.

nimble spoke
faint jewel
#

what is the catch for letting people shoot / swing from cars? does it HAVE to have a window?

hearty herald
#

as a component slot?

faint jewel
#

i want to shoot from a vehicle that has no doors / windows/

#

i'd love to shoot 360 but i heard that was removed.

hearty herald
#

Well I noticed accuracy is super reduced atleast if you're trying to shoot anywhere except the cone of your window

faint jewel
#

i want this to be a thing.

hearty herald
#

lmao

faint jewel
#

but he wont aim.

hearty herald
#

Using the ctrl key instead of right click?

faint jewel
hearty herald
#

or "aiming" stance

faint jewel
#

they do the same thing.

hearty herald
#

Don't think they exactly do

#

in vehicles etc

slate wasp
nimble spoke
nimble spoke
# faint jewel but he wont aim.

Probably because there are no animations for that, even though devs added mod support for showing players in vehicles, that's not a vanilla thing

faint jewel
#

he wont shoot either.

#

and there ARE aiming/shooting in car anims πŸ˜‰

#

can windows that do not exist be set to open?

drifting ore
#

Just found after 1 hour that my issue was table.append instead of table.insert xD

faint jewel
#

a video f the mower in action. adult language warning

#

i so need to get this working lol.

#

blap blap from the back.

slate wasp
#

any tips on how to go about changing player boredom value after calling player:getStats():getBoredom(); ?

faint jewel
#

player:setStats():setBoredom();

slate wasp
#

holy shit thats amazing tysm

#

would using player:setStats():setBoredom(); change the boredom value to a set number or would it subtract or add the value?

faint jewel
#

set number.

#

so just get current bordeom and add/subtract as needed and set it to that.

drifting ore
#

How can I make an item use a battery like the flashlight ?
I understood that you need the trainable type and use UseDelta but what does it represent? How much energy is consumed? And above all, when does the object consume battery and can I cut the consumption?
Like if the object is in a drawer, is it consumes energy? What if the item is in an inventory of a player who is deco?

slate wasp
#

what do the float and float1 refer to in setBoredom​(float float1) ?

thin hornet
#

like 0.1, 1.2, 10.55

slate wasp
#

is there any difference between the float and float1?

thin hornet
#

float is the type, float1 is the variable name

#

here an example of values

self:addSliderOption(stats,"Hunger", 0, 1);
    self:addSliderOption(stats,"Thirst", 0, 1);

    self:addSliderOption(stats,"Fatigue", 0, 1);
    self:addSliderOption(stats,"Endurance", 0, 1);
    local op = self:addSliderOption(stats,"Fitness", 0, 2); -- -1 to 1, use applymod due to slider
    op.applyMod = 1;

    self:addSliderOption(stats,"Drunkenness", 0, 100, 1);

    self:addSliderOption(stats,"Anger", 0, 1);
    --self:addSliderOption(stats,"Boredom", 0, 1);
    self:addSliderOption(stats,"Fear", 0, 1);
    self:addSliderOption(stats,"Pain", 0, 100, 1);
    self:addSliderOption(stats,"Panic", 0, 100, 1);
    self:addSliderOption(stats,"Morale", 0, 1);
    self:addSliderOption(stats,"Stress", 0, 1);
    self:addSliderOption(stats,"StressFromCigarettes", 0, stats:getMaxStressFromCigarettes());
    self:addSliderOption(player,"TimeSinceLastSmoke", 0, 10);
    self:addSliderOption(body,"BoredomLevel", 0, 100, 1);
    self:addSliderOption(body,"UnhappynessLevel", 0, 100, 1);
    self:addSliderOption(stats,"Sanity", 0, 1);

    self:addSliderOption(body,"Wetness", 0, 100, 1);
    self:addSliderOption(body,"Temperature", 20, 40, 0.1);
    op = self:addSliderOption(body,"ColdDamageStage", 0, 1);
    op.title = "ColdDamageStage (hypo 4)";

    self:addSliderOption(body,"OverallBodyHealth", 0, 100, 1);
    op = self:addSliderOption(body,"ColdStrength", 0, 100, 1);
    op.title = "CatchAColdStrength";
    self:addSliderOption(stats,"Sickness", 0, 1);
    self:addSliderOption(body,"InfectionLevel", 0, 100, 1);
    self:addSliderOption(body,"FakeInfectionLevel", 0, 100, 1);
    self:addSliderOption(body,"FoodSicknessLevel", 0, 100, 1);

this give you the minimum and maximum values for each thing

#

sum stuff are in body some other in stats

local player = getPlayer();
local stats = player:getStats();
local body = player:getBodyDamage();
craggy furnace
thin hornet
craggy furnace
#

i still have about 4 other things to add in

#

plus figure a solution for night vision

slate wasp
# thin hornet nice

this is what i have so far, i'm trying to get the setBoredom to use getBoredom - .25 but i'm not sure how i'd format it

function Recipe.OnCreate.Carving(items, result, player)
local currentBoredom = player:getStats():getBoredom();
local currentUnhappiness = player:getBodyDamage():getUnhappynessLevel();

player:setStats():setBoredom(float float1);

end

end

thin hornet
craggy furnace
#

it isnt close nor is anywhere near a substitute

thin hornet
thin hornet
drifting ore
thin hornet
drifting ore
#

Thanks, it's for RP. So no more need for discord. You send a message with the radio frequency to your friend when you need to talk to him

#

For exemple

craggy furnace
drifting ore
#

It takes into account the range of the radio too

thin hornet
#

i havent tested really but it substract a powerlevel from 1

craggy furnace
#

1 sec

#

i am wondering just how much of this originally was just a test to begin with

#

hell, its been around since 2017

#

i am up to my eyes in stuff that needs to be completed right now and would love to just strike it

#

for the meantime i guess brita and myself are just gonna sit and smoke

thin hornet
#

that screenshot come from a mod or was that from the vanilla game debug ?

slate wasp
#

`function Recipe.OnCreate.Carving(items, result, player)
local currentUnhappiness = player:getBodyDamage():getUnhappynessLevel();

local boredomChange = player:getBodyDamage():getBoredom() - .05;

player:setBodyDamage():setBoredom(float boredomChange);

end

end`

#

aside form the line about Unhappiness, does anyone see anything super super inherently wrong with this?

thin hornet
#

@slate wasp

function Recipe.OnCreate.Carving(items, result, player)
    local body = player:getBodyDamage();
    local currentUnhappiness = body:getUnhappynessLevel();
    local currentBoredom = body:getBoredomLevel();
    body:setBoredomLevel(currentBoredom - .05);
end
craggy furnace
#

the actual NVG stuff eris uses has roots to vanilla but to what extent i dont know

slate wasp
thin hornet
# slate wasp once again, thank you so so much

also you dont have to add your recipe OnCreate directly into the Recipe.OnCreate table you can just use your own global function with prefix to make sure it never overwrite with other mod like MyMod_Recipe_OnCreate_Carving

slate wasp
#

@thin hornet should the _'s be .'s in MyMod_Recipe_OnCreate_Carving?

thin hornet
#

Recipe.OnCreate.SomeThing
Recipe is a table containing table OnCreate
OnCreate is a table containing OnCreate Functions.
This is vanilla so if an other mod would add a Carving to it, it could conflict

#

So basically you can just name your function how you want with a prefix to make sure its unique.
Then in the recipe script .txt you just link that function there

recipe DoSomething {
  OnCreate:MyMod_Recipe_OnCreate_Carving,
}
#

Its just a tip to prevent conflict

slate wasp
#

ohh so only vanilla tables use periods in spacing?

thin hornet
#

Well Recipe.OnCreate.DoSomething is the same as

Recipe = {
  OnCreate = {
    DoSomething = function()
    end
  }
}
#

You dont Require to add your own function to that vanilla object

#

you can but you dont have to

#
--- myRecipe.txt
recipe DoSomething {
  OnCreate:MyMod_Recipe_OnCreate_Carving,
}
--- myrecipecode.lua
function MyMod_Recipe_OnCreate_Carvin(items, result, player)
end

this would work perfectly and chance of conflict are near zero since the naming is very unique

slate wasp
#

ohh i understand now

fair frost
fiery pecan
#

ok, so. I've got some code, right?

local GetVehicles = getWorld():getCell():getVehicles();
local GetVehicle = GetVehicles:get(i);

GetVehicle:setScriptName(85crownvic_rosewoodpolice);
GetVehicle:scriptReloaded();```
Right?
#

so far, it works. Buuuut

#

there's like a 1/10 chance it'll error out with

[04-03-22 17:29:08.627] ERROR: General     , 1646436548626> 940,993,293> java.lang.NullPointerException: Cannot invoke "zombie.vehicles.VehicleDoor.load(java.nio.ByteBuffer, int)" because the return value of "zombie.vehicles.VehiclePart.getDoor()" is null.
#

how would I fix this? I can see potentially resetting the vehicle if this happens, but how on earth would I check if the door is null?

blazing radish
#

@hearty herald I found a solution for the duplicaiton issue

#

not exactly me, was Dislaik the genuis behind

#

function zombieDeath(zombie)
local inv = zombie:getInventory();

if not inv:contains("Base.Axe") then
    inv:AddItem("Base.Axe", 1);
end

end

Events.OnZombieDead.Add(zombieDeath);

#

I was too afraid to mess with tables and stuff that I don't understand and we were talking about this issue before

last grove
#

Hello, does anyone know how to add several result items to a recipe?

last grove
smoky meadow
#

do you guys know how to create a RNG Lua code.

like Example

you have a Lottery Ticket you open it

and there's a big change you get a paper(as a junk prize) and a low chance to get a gun(as a jackpot price).

i try Zombrand but i dont know how to use it.

faint jewel
#

zombRand(Maxnumber)

smoky meadow
chrome egret
#

ZombRand is a random number generator-- you need to somehow compare to the number to get a truthy value

#

I would probably do it like:

local LOTTERY_WIN_CHANCE = 5;
function OpenLotteryTicket(items, result, player)
   local ticket = ZombRand(0, 100);
   local toGet = "";
   if ticket < LOTTERY_WIN_CHANCE
      toGet = "TicketShard";
   else
      toGet = "Katana";
   end
   player:getInventory():AddItem(toGet);
end
#

There may be more elegant ways to express the conditional, I just didn't like the repetition of player:getInventory():AddItem

#

I just realized you didn't necessarily want to give the paper when not giving the jackpot, but you get the idea

chrome egret
#

Anyone know if there are good resources for pluralization of item names?

clear geode
#

What does BodyLocation variable do in a clothing mod?

blazing radish
#

for example, if you use a fullsuit (coveralls in game), it won't let you use a jacket, pants and more clothes

#

if you use eyes, then it won't be compatible with other eyes items or full masks

#

I hope is understandable enough πŸ˜…

clear geode
#

Got it haha thanks for the explanation!

blazing radish
#

found it!

#

it's on main PZ folder/media/lua/shared/NPCs/BodyLocations.lua

clear geode
#

Alright bro thanks! πŸ˜„

blazing radish
#

np mate, good luck with your work

slate wasp
#
        player:getXp():AddXP(Perks.Woodwork, 3);
    else
        player:getXp():AddXP(Perks.Woodwork, 1);```

this should mean that if the players Carp skill Level is LESS THAN or EQUAL to 3, then to give 3 Carp XP, but if higher Level than 3, to give 1 Carp XP when the function is called right? just want to make sure i'm not going crazy.  for some reason it's giving me 1xp regardless.
chrome egret
#

Have you debugged the call to player:getPerkLevel(Perks.Woodwork) just to make sure it's returning the value you expect?

#

otherwise there'd have to be something else going on in the code, I expect

obsidian rapids
#

Yo! Do you guys have any idea which file i'd have to change to set a certain weapon spawning chance to 0 and alter the durability of others ? I mean dont plan on creating a mod but its its the only way i guess i dont mind.

chrome egret
#

A mod would be the way to go if you want to have a controlled way to apply the change, and is absolutely necessary if you want the change for anyone but yourself.

#

Finally figured out counting items via the ItemContainer, and also multi-word searching:

#

Just need to nail handling for hyphenated items and I should be good to move onto searching other areas

#

Then build the timed action support for walking around looking and this mod will be done!

drifting ore
#

Couldn't you like

#

Instead of looking for hyphenated words

#

Just look for whatever word is between the hyphens

#

So like, "pork-steak" would just show as "pork" and "steak"

#

Forgot the term in search algorithms for that

chrome egret
#

The search list is already almost 2100 entries across vanilla, so I would rather not add that complexity if I can simply incorporate everything in the pattern

#

But yes, failing that an approach breaking down the inputs would suffice

winged pebble
#

hello i'm super new into modding here so for example i want someone to enter his age in this line
io.write("enter your age here: ")
user_input = io.read()
print(user_input)

but it doesn't work

drifting ore
winged pebble
#

nvm i think there's something wrong with my interpreter

drifting ore
winged pebble
#

on my local interpreter i can't

#

the web version had 5.1.5 lua
my local interpreter version is 5.4.2

zealous wing
#

So I got Eris NVGs to work with Brita's Armor Pack:

drifting ore
#

io.write asks to enter something in the console right ? It's impossible in game, you must use a UI

zealous wing
#

No problems so far. I think I am starting to understand the lua. πŸ˜›

winged pebble
#

hence why i'm new into this stuff
i'm learning the basics

#

does the game use specific lua version?

zealous wing
#

The latest, presumably. Although this game's been in development for 10 years at this point so who knows. πŸ€ͺ

drifting ore
winged pebble
#

thanks for that

#

but again i'm still new to this i'm learning the basic first.
after that i want to try make a trading mod because i'm inspired by a mod called dingo trading but still need a lot of improvement imo

overall your ui might helps a lot

drifting ore
#

Exemple of an UI to ask a name:

local ui

-- Function when enter is press
local function onEnter(elem, text, args)
    getPlayer():Say(text);
    ui:close();
end

-- UI creation
local function onCreateUI()
    ui = NewUI(); -- Init

    ui:addText('', "Enter name:", _, "Center");
    ui:nextLine();

    ui:addEntry("e1", "", false); -- Add entry
    ui["e1"]:setEnterFunc(onEnter);

    ui:saveLayout();
    ui:close();
end

Events.OnCreateUI.Add(onCreateUI)
winged pebble
#

OHH your the only cure creator mod!
your mod is awesome man! it got into my list of must have mod

drifting ore
#

Thx ^^

#

Has anyone ever made a custom object that uses batteries?

#

I'm trying to figure out how to make my pager consume power

hearty herald
#

Maybe one of the nightvision goggle mods use batteries?

drifting ore
#

Maybe indeed, I will check that

winged pebble
#

try look into better flashlight mod

drifting ore
#

I already did but all items are derivatives of the vanilla flashlight. So energy consumed is managed by the game, not by the mod

drifting ore
hearty herald
#

Well, maybe a workaround would be to "install battery" action with removes a battery from the game and adds a power variable to the item?

#

Using moddata maybe

winged pebble
drifting ore
#

Make a mod and add lua file to it

winged pebble
#

ahh i see

drifting ore
winged pebble
#

i'll dive there after i finish learning lua basic

lusty nebula
#

What the KnockBackOnNoDeath parameter affects/does?

clear geode
lusty nebula
drifting ore
glass grotto
#

hey someone know how to increase the limit of safehouse? i would like to have 2 safe house plz

slate wasp
hearty herald
#

Well, you could just print the result

hearty herald
chrome egret
hearty herald
#

Is the search that intensive that you need the item verification?

#

Just considering things like renamed items

drifting ore
nimble spoke
chrome egret
chrome egret
# drifting ore I don't understand what you mean

On boot I cache the items that exist:

function cacheItems()
    print("Startup, getting cache of items available for searching");
    local allItems = getAllItems();

    local function addTo(set, key)
        set[key] = true;
    end

    ITEMSEARCH_PERSISTENT_DATA.itemCache = allItems;
    ITEMSEARCH_PERSISTENT_DATA.displayNameSet = {};
    ITEMSEARCH_PERSISTENT_DATA.itemsByDisplayName = {};

    local javaItemsSize = allItems:size();
    for x = 0, javaItemsSize -1 do
        local item = allItems:get(x);

        local module = item:getModuleName();

        local name = item:getName();

        local type = item:getType();

        local displayName = item:getDisplayName();

        if not setContains(ITEMSEARCH_PERSISTENT_DATA.displayNameSet) then
            addTo(ITEMSEARCH_PERSISTENT_DATA.displayNameSet, displayName);
            ITEMSEARCH_PERSISTENT_DATA.itemsByDisplayName[displayName] = { item };
        else
            table.insert(ITEMSEARCH_PERSISTENT_DATA.itemsByDisplayName[displayName], item)
            print("We now have more than one item by the display name of " .. displayName);
            for i, v in ipairs(ITEMSEARCH_PERSISTENT_DATA.itemsByDisplayName[displayName]) do
                print(displayName .. "[" .. i .. "]" .. " Module: " .. v:getModuleName());
            end
        end
    end
    print("Done starting up, should have cached display item info for " .. javaItemsSize .. " items provided by getAllItems()");
end
hearty herald
#

There's also the use-case argument, what if you have to search for itemType by their class name, which could be different from display name

chrome egret
#

For sure. My dialog is simple right now but I have a thought for options related to the search: Search by type, as well as specifying how far/long you want the char to look

hearty herald
#

ofc you could fix the whole display name / class name by passing it through a hashtable

chrome egret
# chrome egret On boot I cache the items that exist: ```lua function cacheItems() print("St...

During a search attempt, before actually checking the player's inventory, their loot, etc., I try to cross-verify that such an item exists in some module:

if exactMatch then
        local matches = ITEMSEARCH_PERSISTENT_DATA.itemsByDisplayName[searchText];
        print("Exact match from persistent data on display name: ", ITEMSEARCH_PERSISTENT_DATA.itemsByDisplayName[searchText]);
        for i, match in ipairs(matches) do
            print(match:getDisplayName() .. ": " .. tostring(match:getType()) .. " - " .. match:getModuleName() .. "." .. match:getName());
            -- TODO: If we truly have multiple items, this will always take the last match found, making this non-deterministic
            displayName = match:getDisplayName();
        end
    end

    if displayName == nil then
        local searchPattern = self:createSearchPattern(searchText);
        print("Generated search pattern is: " .. searchPattern);
        displayName = findBestMatch(searchPattern);

        if displayName ~= nil then
            print("Best match found via pattern was: " .. displayName);
        else
            print("No match found via pattern");
        end
    end

    if displayName == nil then
        print("No match found, out of options :(");
        return;
    else
        print("The match we found was: " .. displayName);
    end
hearty herald
#

Just don't know personalyl how often display name is different

chrome egret
hearty herald
#

Well, you can index a hashtable by their displayName to get the classname

#

But that would require setting up a hashtable with every single displayname linked to the associated classname lol

chrome egret
#

Which classname? I've seen module, type, name, display name...

hearty herald
#

Just what I'm calling it the items are referred by a certain name in the code

#

I think if you want to be specific you have to use the module as well?

#

Like Base.Screwdriver isntead of Screwdriver

chrome egret
#

Yes, that is technically considered the "full type"

#

I pieced that together when I started using ItemContainer:getItemCount overloads

slate wasp
#

how would i integrate getZombieKills() into a function? like how boredom is player:getStats():getBoredomLevel, what would be getZombieKills’ equivalent to player:getStats?

chrome egret
#

However people are used to the display names, so I wouldn't want it to be confusing in regards to like - "Why do I have to use this weird name instead of the name I always see in my inventory?"

hearty herald
#

Yeah display name is best

#

But that does run into the issues of people renaming items, perhaps thinking they can find it easier

chrome egret
#

Do you have a ref on item renames? I'd like to see how it works

hearty herald
#

Uh, I think you can right click items an rename from there

#

I know you can do it on cooked food and bags

chrome egret
#

oh shi-

#

Didn't realize it was vanilla

#

Can you tell I've only played this game a bit? πŸ™‚

hearty herald
#

Yah it exists in vanilla

#

My friend renamed food he cooked and gave it to me in MP

#

Luckily it was not the food with the bleach in it LOL

chrome egret
#

πŸ˜„

hearty herald
#

Did you know, if you add bleach into food you don't even see it has bleach in it

#

super trolly

#

Doesn't even contain negative mood

hot patrol
#

You sure? I thought it gives the icon a poison symbol

hearty herald
#

It doesn't on food

chrome egret
#

Apparently bags, food, and map can be renamed

hot patrol
#

At least I know it does when you add poo to food when using the defecation mod

hearty herald
#

Bleach is literally hidden in vanilla cooking

hot patrol
#

Damn I wish the same could be said for the poo stew I made my group.

hearty herald
#

Just give them bleach next time

#

They won't realise whats kiling them

hot patrol
#

Woah now, that's just plain unhinged.

hearty herald
#

Yep, my friend said "I left food for friend2 in the oven"

#

turns out it was the food he tested adding bleach to

#

πŸ˜‚

hot patrol
hearty herald
#

Never trust your friends with food once they learn of this forbidden knowledge btw

#

Well, it's good that it's just bags food and maps I guess

#

I don't think most people really use the rename thing

#

most useful for organisation with bags I guess

chrome egret
#

and there's always the classic "release without the feature, wait for complaints"

hearty herald
#

I can see a compromise

#

If your item validation system says it doesn't exist, you can give them a prompt that says "this is not a default item, search anyway?"

#

Or something along those lines

wispy sequoia
#

Guys, what language PZ mods uses?

hearty herald
#

Lua

olive rose
smoky meadow
#

guy how to make an item that is placeable like the oven or ham radios

#

and guys how make the item that cannot be pick or place by a regular player and only the admin can.

winged pebble
#

need help with lua basic

the_answer = tonumber(io.read())

if the_answer >= 1 then
    print("you'right congrats!")
elseif the_answer <= 0 then
  print("you're wrong!")
end```

if i type any alphabet at the console i got this error

```lua: [string "<eval>"]:4: attempt to compare number with nil
stack traceback
    [string "<eval>"]:4: in main chunk```
#

how can i make the answer is wrong without traceback error

last grove
#

to change Pain and Panic levels is it just panicChange and painChange or do i have to go lua diving for these?

silver zodiac
#

Hey guys, in my ever-changing list of mods, I had one mod that allowed me to reclaim sheets from sheet rope. I've been trying to find which mod it is again, but I haven't had any luck. Wondering if anyone would know off-hand.

I've seen some tailoring mods that have it so you can do it with twine, but none that just allow you to reclaim when you click right on the sheet rope.

clear geode
#

would it be possible to make a 'craftable item' accessible only for a specific Faction in MP?

last grove
last grove
chrome egret
#

For convenience I would probably reorder the conditions:

if the_answer = nil or the_answer <= 0 then
   print("You're wrong!");
else
   print("You're right, congrats!");
end
#

Or separate out the nil check to print something different for non-numeric input

drifting ore
#

Is there an easy fix for item to big on the ground ?

willow estuary
#
  • you can also reszie/modify models, at least fbx models, in realtime in game by changing them in blender etc, and saving/moving them to the pz model directory as well.
drifting ore
#

Wait, I need a model here

#

I don't want to do a model, I suck at it. Just keep the icon like that but smaller

#

You know what ? I will do a model, but just a 3d rectangle

#

Is there something special to know about the model or every fbx is ok ?

hearty herald
#

Do you actually need a model? since a lot of items just use a sprite

smoky meadow
#

how to disable the pick up item option on ham radio. and also disable the disassemble option as well?

drifting ore
chrome egret
#

Wouldn't scale = 1 make it full size? You'd want less than 1, greater than 0, to scale it down yeah?

winged pebble
#

i've been experimenting lua basic overall

chrome egret
drifting ore
#

If I find an error from the game itself, where do I report it ?

#

I got an error when placing a makshift radio

winged pebble
willow estuary
#

You need to have the item script reference the model script like so with WorldStaticModel

    item Aluminum
    {
        DisplayCategory = Material,
        Weight    =    0.1,
        Type    =    Normal,
        DisplayName    =    Aluminum,
        Icon    =    Aluminum,
        MetalValue = 5,
        WorldStaticModel = Aluminum,
    }
drifting ore
#

Still a spite, I must be missing something

thin hornet
#

So we have this new anti-cheat system.
It prevent player from teleporting "illegaly".

#

But the server command to teleport send a packet to the client and the client use this to change the player position:

player:setX(x);
player:setY(y);
player:setZ(z);
player:setLx(player:getX());
player:setLy(player:getY());
player:setLz(player:getZ());
#

But I need to allow players to teleport without admin rights.

#

And using this with my mod kicks the player.

#

Yeah

#

But I do not seem to find a serversided way of doing it

#

I tried setting the player position from the server using a clientCommand event.
It doesn't teleport the client

#

example:

--- client
sendClientCommand("Test", "teleport", pos);
--- server
local function onClientCommand(module, command, playerObj, args)
  if module == "Test" and command == "teleport" then
    playerObj:setX(args.x);
    playerObj:setY(args.y);
    playerObj:setZ(args.z);
    playerObj:setLx(playerObj:getX());
    playerObj:setLy(playerObj:getY());
    playerObj:setLz(playerObj:getZ());
  end
end
Events.OnClientCommand.Add(onClientCommand);
#

sendClientCommand is when the client send a command

#

i sent an example

#

thats what im doing, just to show that i set the player position from the server but that doesnt work on that player client.

#

Seem like position have to be changed client side

#

tested in 41.66?

#

it only kick non admin by the way

#

can you post your example?

#

well i dont know, for me it kick players and thats what i do

#

waiting for 41.67 to disable teleport anti-cheat

#

setting player position from server does nothing.
setting player position from client kicks the player.

#

thats what i get

#

So i would think there is a way to transmit a player new position from a server only method.

#

changing it on server then transmitting it or something but havent found anything yet

#

maybe cause it doesnt move a long distance

#

im trying to teleport across the map

jolly tinsel
#

I was wondering is there anyway to spawn in items that can’t be crafted from the game menu ? I’ve been wanting to try to find a way to place down those big military tents in other parts of the map because I figure it would make a cool looking starting base . Maybe if I use admin mode ? Or a mod maybe ?

thin hornet
#

if there was a getGameServer() we could just use the public static function to sendTeleport from the server directly

brazen fossil
#

uhh... how do i fix this? its either not loading models or models are in wierd place

winter compass
#

Any mods for fixing layer height on graves with snow when they're empty.

errant grove
#

keys disappear from key rings?

#

i have a lot of mods and im on multiplayer

harsh prairie
#

How do I make a mod that replaces a recipe from the base game/another mod?

blazing radish
#

if you do it directly on base it'll work, unless I missed some other error

faint jewel
#

heya guys

serene imp
#

Hey All, having an issue with transferring items on the a multiplayer server... I'm transferring items to containers and bags just fine when all of the sudden the container/bags stops receiving items. Weight Limit is not the issue, and the server is modded, but the thing is I'm the only one experiencing this issue. My ping was a steady 50 ms.

distant mountain
#

Anyone can help me to get mods to work when i try to host a game with one of my friends? I have them active in the main menu and in the server setting but when i go to launch/start the server it does not appear like they are not active or something

faint jewel
#

okay so what da funk,

#

still trying to get this trailer to let me shoot from it.

lusty nebula
#

Anyone know what these two items parameters does/affect?
UseDelta = <<- Present in items like pills/pills containers for example
KnockBackOnNoDeath = <<- Present in items like weapons/hand weapons for example

mortal widget
faint jewel
#

@willow estuary you around?

lusty nebula
#
#

Ok KnockBackOnNoDeath is a boolean so it has the TRUE/FALSE values...Remains to understand for what... πŸ˜„

faint jewel
#

if they don't de, then push them back?

lusty nebula
#

I think I've got it...It should be so...True: If with the weapon of choise you don't kill the zed after have scored a hit and he get close there is the chance that the character will attempt to knock down the zed ( without hitting him directly with the weapon )
FALSE: The character will always hit the zed with the weapon of choice until the zed is not dead without attempting to knock him down/push him

#

( at least this is the impression I have so far after making some tests with TRUE/FALSE activated )

gilded hawk
#

Is there an event for when the player gets close enough to a container? corpse, box, etc etc?

slate wasp
#

custom recipe gives carpentry xp even when there's nothing in the recipe file telling it to? gives .25xp each time it's crafted
```recipe Carve Wooden Block
{
Log,
keep dj_ChiselBad/dj_ChiselGood,

    Result:dj_WoodBlock,
    OnCreate:djCarving_Recipe_OnCreate_Carving,
    Time:250.0,
    Category:Carpentry,
}```

    local body = player:getBodyDamage(); 
    local stats = player:getStats();    
    local currentUnhappiness = body:getUnhappynessLevel(); 
    local currentBoredom = body:getBoredomLevel();  
    local currentStress = stats:getStress(); 

    body:setBoredomLevel(currentBoredom - 40); 
    body:setUnhappynessLevel(currentUnhappiness - 40); 
    stats:setStress(currentStress - .15);
end```
lusty nebula
gilded hawk
#

Thanks love loveyou

lusty nebula
gilded hawk
lusty nebula
#

@gilded hawk Just make some tests first to check that they work because some may be obsolete with 41.66 πŸ˜‰

zealous wing
#

I patched PLLoot Fantasy too. The HECU and ARES masks now have working NV again. πŸ˜„

chrome egret
#

Am I wrong, or shouldn't all public methods of classes under zombie.scripting.objects be available to call from Lua?

#

Trying to call getType, and Recipe.class appears to have a public getType(), but then... Exception thrown java.lang.RuntimeException: Object tried to call nil in cacheRecipes at KahluaUtil.fail line:82.

lusty nebula
#

@zealous wing Mighty! Can't wait that you'll release it! ( I hope soon LOOL πŸ˜„ )

#

( Or rather the number of times the item of interest can be used before ending. Sample: a bottle of pills with UseDelta set to 0.05 will have 20 uses or rather, said in brief, it will simulate 20 pills contained in the pill's container )

serene imp
#

figured out the issue with item transferring. There was a server setting... "item limit" or "container limit" and they changed it and now its no longer happening! πŸŽ‰

errant meteor
zealous wing
#

So I did it myself.

quasi geode
chrome egret
#

Aha, missed that it was declared under the nested class. Thanks for straightening me out.

late hound
scenic mulch
#

Hey Folks.. Is there any other way to make zeds to bite through my vehicle? I'm making a convertible vehicle without any roof and side windows, And I tried removing every window parts except the Windshield on the script and still, they can't hurt me through it. They only keep bumping my vehicle's door forever. Is there any alternatives of doing it?

winged pebble
smoky meadow
#

hey guys how to locate the code for the deletion of items in the ground.

vivid flare
zealous wing
#

Yee yee ass NVGs:

winged pebble
#

though i don't use brita anymore because of how immersion breaking the mod is unless someone made balancing patch

zealous wing
winged pebble
#

we shouldn't discuss more about this stuff here

smoky meadow
#

hello how to add collision on an item. pls help

hearty herald
scenic mulch
vivid flare
#

no, vehicle parts have scripts attached

#
   {
      category = nodisplay,
      lua
      {
         create = Vehicles.Create.Window,
         init = Vehicles.Init.Window,
      }
   }```
#

add this in your vehicle config after the normal windows template

#

create = and init = need to be overwritten, because that's what will add the actual window item to the part. don't know right now how to clear the script

#

in worst case, need to write a custom script that doesn't do anything and add it there instead

scenic mulch
#

Alrighty.. soo do I put the script that does nothing on the client's folder or server?

regal sail
#

Sup gamers, does the AddItem call take arguments for item condition?

#

or is there any other way to spawn an item with custom condinition?

vivid flare
#

turns out the .init script is empty and not doing anything

#

so you might as well use it for create =

#

in full your vehicle config should look like this: template = Window/part/WindowFrontLeft, template = Window/part/WindowFrontRight, part Window* { category = nodisplay, lua { create = Vehicles.Init.Window, init = Vehicles.Init.Window, } }

scenic mulch
#

oh alright

#

soo I don't need to create any extra empty lua scripts for it to work?

vivid flare
#

yes

scenic mulch
#

alrighty

vivid flare
#

i just noticed your vehicle has a windshield

#

so you might want to use part WindowFront* instead

#

and then do the same for the backseats

scenic mulch
#

yep.. also do I have to include the rearleft/right windows for the zeds to hurt the other passengers?

vivid flare
#

yes

scenic mulch
#

hmm alright.

hearty herald
#

If it's lua, can't you simply write ?

create = function() return end,
vivid flare
#

every seat needs a window

vivid flare
hearty herald
#

And does it error if you leave it blank?

#

such as create = nil

vivid flare
#

yes. create = , will not work

hearty herald
#

or leave it out entirely

vivid flare
#

havent tried nil

#

if you leave it out, it will inherit script from base window part, which we don't want in this case

hearty herald
#

Ah, but the file is a lua file right?

#

pretty sure using an anonymous function would work just fine if so

scenic mulch
#

Oh neat its working. Thanks for the help!

hearty herald
#

Just has to hace the correct input

#

Just be wary incase the window.init function in the future has some functionality I guess πŸ˜‚

vivid flare
#

yea.

#

but that's an issue for future :>

hearty herald
#

kek, future you will thank you πŸ˜‚

vivid flare
#

i mean, it's not that hard to make a custom empty function and call that instead

#

i just can't be arsed to explain right now πŸ˜„

#

i'm 110% lua idiot, but even i can do that

hearty herald
#

understandable, have a nice day

scenic mulch
#

Okay soo... The zeds can only bite through front passengers.. Except the rear passengers.. did I do it wrong for the backseats?

bright vessel
#

can someone make batman armour

#

i saw the new batman and i wanna be batman in project zomboid

modern scarab
#

MOD IDEA: "HIVE MIND"
When 1 zed saw you, all the zeds in the whole map knows your location and will hunt you

drifting ore
#

In the patch note of the build 41.67, they say "Fixed GlobalModData.save() not being called on the server.". Does that mean that now global ModData is save beteween restart of server ?

drifting ore
#

Nice, I just released a mod that uses global modData and I needed to save the table with Json.lua. Any idea of ​​the official release? To update my mod in advance and upload it later

hearty herald
#

Can't you get the games version by some function from lua?

drifting ore
hearty herald
#

I suppose there's also the mod version thingy you could use

nimble spoke
#

getCore():getVersionNumber() returns a string

hearty herald
#

So you could check for versionNumber, split it in parts and just do a number check on the last bit to see if it's over a certain theshold?

#

If it's over the threshold you could just unhook whatever event you used to save moddata with json

#

Though i guess your mod will still work when moddata save is fixed so you donm't actually have to change anything πŸ˜‚

nimble spoke
#

shift + del, easiest update ever

#

I'm glad I didn't even look into fixing that when I saw the changelist

gilded hawk
#

does anyone know how is the aim outline is rendered around the zombies?
Cause I would like mod it of instead it being an outline, it becomes an overlay on top of the zombie

chilly beacon
#

Hiya, probably a simple one. but I'm trying to make my own backpack show. it'll use the big hiking bag as its base so I've tried to copy/paste that as a starting point. my character is wearing the bag correctly, as the back weapon goes to the side, but I cannot see anything. Is there something I'm missing?

#

as far as I can tell. everything is referencing eachother, the item actually works, as i can put stuff in the bag etc, its jsut not visible in the world

gilded hawk
#

Also, I'm looking for a good modeller who is also a fan of Tom Clancy The Division for a mod project (ping me or pm me if interested)

errant meteor
smoky meadow
#

hey guys how to add a collision on an item. can any of you guys know?

fresh steppe
#

Hello, I have a question ( that will be easy for all of you I think ) I would like to know how to set XP to the player's perks ? I've seen the AddXP function but not the setXP for the perks

faint jewel
hearty herald
#

I don't see the part with initialising window and create

faint jewel
#
        template = Window/part/WindowFrontLeft,
        template = Window/part/WindowFrontRight,

        part Wind*
        {
            category = nodisplay,
            itemType= Base.nil,

            table install
            {
                recipes = Impossible,
            }

            table uninstall
            {
                recipes = Impossible,
            }
        }
hearty herald
#
        part Wind*
        {
            category = nodisplay,
            itemType= Base.nil,

            table install
            {
                recipes = Impossible,
            }

            table uninstall
            {
                recipes = Impossible,
            }
            lua
            {
               create = Vehicle.InitWindow, -- this one shouldn't do anything, you can use InitWindow or make an empty function...
               init = Vehicles.Init.Window,
            }
        }
#

And does it work being called Wind* isntead of Window* ?

faint jewel
#

gets the windsheild too.

hearty herald
#

Your trailer doesn't have a windshield?

#

πŸ€”

chilly beacon
zenith smelt
#

Are there any good resources for adding UI.
I need text insert box and display boxes

still ledge
#

tell me please, is it possible to make a mod only for the server part? Is it possible for one team? For example, when you enter say nick text in the console, a message is written to the game in / all? Based on the principle of discord integration (it works very poorly for me)

P.S I am writing my GUI in C# for a server and I wanted to implement a bot to manage it, etc.

pulsar drift
#

Conspiracy theory: Brita is an Ai who was programmed to make armor and weapon mods

#

How else would there be that many weapons in Britas weapon pack

smoky meadow
#

is the "HoursForWorldItemRemoval" in the sandbox settings broken. i tried to type a Base item in the description and set the deletion time to 1hour ingame and check the whitelist so that the items that on the whitelist dissapear. but it didn't work.

grave ether
#

Hello

#

Is there any documentation for creating custom challenges? I know it involves lua but I cant find anything on it except for old form posts with no replies.

#

Basically I want to create a custom challenge map that adds items to the players inventory on character creation and gives them a scrape on their shin. Kinda like CDDA but I cant find where the documentation for these functions are or a formatting tutorial for setting up a challenge map.

drifting ore
# zenith smelt Are there any good resources for adding UI. I need text insert box and display b...

You can use my library to make something simple (I recommended), otherwise my guide to make custom UI:
https://steamcommunity.com/sharedfiles/filedetails/?id=2760035814
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Make an custom UI.md

GitHub

Contribute to MrBounty/PZ-Mod---Doc development by creating an account on GitHub.

drifting ore
zenith smelt
#

Sure thing. I'll try it out for sure, I will post any feedback on steam workshop

#

This looks like exactly what I was looking for!

harsh prairie
#

How do I make my mod delete a recipe from the vanilla recipes?

still ledge
#

Guys, I will update the question, is it possible to create a mod that users will not need to install?
#mod_development message

drifting ore
#

What are tou planning to do exactly ?

still ledge
# drifting ore You can make a mod only on the server but players still need to dl it

I understand, sorry ... thanks. So my implementation of the discord bot apparently disappears, to create a custom chat command (((
I wanted to make my GUI with the discord bot inside work on the principle of discord integration, but also accept administration commands to ban, kick, etc.
I wanted to do this through voting in the discord.

drifting ore
#

A UI in the game ? To make vote on a discord ?

gilded hawk
still ledge
#

This is my GUI now, it remains to solve the discord issue

#

And how I see the voting method. then I thought to count the votes from the number of total votes and decide on the percentage of the ban or not

drifting ore
#

No idea about the discord thing, never did that

still ledge
#

Roughly speaking, I am re-inventing discord integration, but for myself, because I want to add commands to the admins, etc., I did it, it remains to do somehow custom console commands and their processing. how to start
In java DiscordBot.this.sender.sendMessageFromDiscord(message.getAuthor().getName(), removeSmilesAndImages); works like this,So I'm trying to figure out how to use this method through the console command to transfer a nickname and text

drifting ore
#

@thin hornet Are you one creator of the computer mod ?

drifting ore
#

Ok, if i want to use your mod to make one, basically make your mod a require. Can I ?

#

I have an idea for a website to exchange objects accessible from the computer

round zenith
#

Ohhh I want to make Amazon for the pc mod!

thin hornet
#

Its a global object so its should be accessible

#

But i have yet to update it to make it more extensible

drifting ore
#

That would be nice. The idea is to use my new pager mod, you post an ad on the site and receive a message on the pager when someone accepts your offer with a channel for the radio to chat or meet, something like that

crimson spindle
#

When building out a distribution list, is there a way to limit the item generation spawn to a specific building on the map? Or even a specific floor on the building?

round zenith
#

@crimson spindle depends on the map design

undone crag
#

Simple UI library maybe that's a good mod oh no what's this it's telling me to rate and favourite! But it is not one of my favourite mods. It looks like I will not be downloading it if lying is part of the deal D:

crimson spindle
round zenith
crimson spindle
#

so how do you do it? lets say you want to limit the spawns to just the hospital buildings?

round zenith
#

@crimson spindle check the tutorials on the wiki

tardy beacon
#

Hey y'all just wondering if there was an NPC survivor mod I just got the game but without npc survivors it feels pretty empty. Maybe I haven't played enough though. Just wondering

crimson spindle
#

@tardy beacon this channel is about making mods.. you're better off posting that in mod support probably.. that said, NPCs aren't a thing yet, but the game devs are working on it.. just wait and see

tardy beacon
#

Ohhh my bad

grim kiln
#

So I have Soul Filcher's Awesome Time, and I'm trying to figure out how to level up masonry? Do I just build a crapton of concrete floors?

faint jewel
#

yay home now.

winter compass
#

Nice welcome home! I just sat down after work with some pizza and tryin' to fix up server πŸ™‚

faint jewel
#

ARGH

#

@hearty herald @vivid flare you guys still around?

crimson spindle
#

If I want to completely overwrite another mod's distribution file...would adding zzz in the front of my file name cause it load after?
ModDistro.lua <<-- original mod file.
zzzModDistro.lua <<-- my file.

chrome egret
#

Search results from surrounding containers:

faint jewel
#

i can NOT get it to let me shoot out of this wagon.

#

any ideas?

#
        template = Window/part/WindowFrontLeft,
        template = Window/part/WindowFrontRight,
        part Window*
        {
            category = nodisplay,
            lua
            {
                create = Vehicles.Init.Window,
                init = Vehicles.Init.Window,
            }
        }

this does not work lol

grave ether
#

Here is the beta for a map mod I am making. Its a survival challenge based off the backrooms. I've been running into some technical difficulties so I may or may not finish it.

slate wasp
#

getting an error telling me that my function doesn't exist? "no such function" any ideas?
```recipe Solve Puzzle Cube
{
Cube,

    Result:Cube,
    RemoveResultItem:true,
    Time:100.0,
    AnimNode:Disassemble,
    Prop1:CubePuzzle,
    OnCreate:djCube_Recipe_OnCreate_SolveCube,
}

}```


    local SolveCube_Chance = 1;
    local ticket = ZombRand(0, 4);
    local toGet = "";
    
    if ticket = SolveCube_Chance
      toGet = "Cube";
    else
      toGet = "Katana";
    end
    
    player:getInventory():AddItem(toGet);

    end
end```
round zenith
#

Anyone know how to resolve my model showing upside down when drinking but is fine when being placed in game?

hearty herald
#

That's the only thing I can think of, I have 0 experience with recipes

slate wasp
hearty herald
#

Tried placing the function above the place where it's referenced?

#

That's a habit from languages like C, where it doesn't know the functions exist unless it's defined before in the file lol

drifting ore
#

I mean isn't it good practice regardless

#

To list functions before their usages

hearty herald
#

So you would make an empty function definition with just the type and that at the top or in a header file, then in a different place write the whole function

#

Yeah It's a habit of mine to put functions above their use place

drifting ore
#

I mean that kind of "hierarchy" is common in every scripting language

#

For obvious reasons

#

Like even Batch and COBOL use that standard

latent rampart
#

Hey all. I'm trying to find a mod that adds kill count to the RADIO_SAVE.txt so I can use it in my streams

#

I can already get the DaysSinceStart from there... lets me get average kills per day and such

#

From what I gather the kill count is probably in the vehicles.db where all the character info is stored? But I have no idea how to access that...

faint jewel
#

ugh

slate wasp
latent rampart
faint jewel
#

the stuff in red isn't working.

hearty herald
crimson spindle
#

I have an item I want to only be able to spawn in the file cabinets/desk of medical clinics/hospitals... patient files, test results, etc. things like that... but I don't want it spawning where the medical supplies go. How do I go about doing that? As far as I can see in the Procedural Distributions there isn't a MedicalOffice table or something similar.

#

Like I know there is OfficeCounter, OfficeDesk, and OfficeDrawers in the procedural distribution list.. however im not sure how to restrict it to just certain locations like the hospital or clinic so they don't spawn in like a law office for example.

hearty herald
#

Well in Distributions.lua there is a sub directory for areas/rooms

#
dentiststorage = { -- Area
        isShop = true,
        metal_shelves = { -- Container
            procedural = true,
            procList = {
                {name="MedicalStorageDrugs", min=0, max=6, weightChance=100},
                {name="MedicalStorageTools", min=0, max=4, weightChance=80},
                {name="MedicalStorageOutfit", min=0, max=2, weightChance=40},
            }
        }
    },
crimson spindle
#

hmmm so then in that example... what i need to do then is define my own proceduralDistro... lets say MedicalOffice.... then add it to that?

hearty herald
#

There is also this:

#
    changeroom = {
        locker = {
            procedural = true,
            procList = {
                {name="FactoryLockers", min=0, max=99, forceForRooms="batteryfactory;brewery;dogfoodfactory;factory;fryshipping;metalshop;radiofactory;warehouse;wirefactory;whiskeybottling"},
                {name="HospitalLockers", min=0, max=99, forceForRooms="hospitalroom"},
            }
        },
#

forceForRooms

#

And as yo ucan see you can have several rooms for it

#

lol

crimson spindle
#

hmmmm

hearty herald
#

So what I think is going on here is

crimson spindle
#

where is the rooms coming from

hearty herald
#

There are room types like Changing Room, Bathroom etc

#

And those ahve their own list

#

Because they are universal across many buildings

#

But if they are inside a say hospital

#

They have roomtype

#

like "hospitalroom"

crimson spindle
#

that makes sense

hearty herald
#

So what you wanted was like hospital office right?

crimson spindle
#

yeah

hearty herald
#

Theres an area called office, and hers an example of the police stuff in it

#
        desk = {
            procedural = true,
            procList = {
                {name="OfficeDesk", min=0, max=99, weightChance=100},
                {name="PoliceDesk", min=0, max=99, forceForRooms="policestorage"},
            }
        },
#

So it has normal officedest stuff

#

But in "policestorage" it also has whatever policeDesk proclist has

#

So Area type is probably part of the map, which defines which desk proclist/itemlist will be used

crimson spindle
#

is there anywhere wher eyou can see all the roomtypes or areatypes?

hearty herald
#

Not sure, I just look through Distributions

crimson spindle
#

or you just have to comb through the distro list.. gotcha

hearty herald
#

with search

#

But there is no "hospitalOffice" or the like

crimson spindle
#

so in those cases can you define your own and append it to the existing distro table?

hearty herald
#

I think what you want to do is