#mod_development

1 messages ยท Page 168 of 1

ancient grail
#

Hi

weary matrix
#

can you show line 58 of ISCraftAction.lua ?

proven bough
#

uhhhh yeah one sec...

weary matrix
#

if you can add a few lines of context that would be nice

#

before and after

frank elbow
#

What is happening in ScavHunt.lua? This likely means you're using the wrong type so it can't find a proper invocation target (actually, looking further down, maybe just a nil param)

ancient grail
proven bough
#

local resultItemCreated = RecipeManager.PerformMakeItem(self.recipe, self.item, self.character, self.containers);

#

That's line 58

ancient grail
#

Thnx bud @weary matrix

proven bough
#
-- function Recipe.OnCreate.CreatePuzzleStaff(items, result, player)   
  weap = {"ASS.puzzlestaff"};
  box1 = weap[ZombRand(1)];
  player: getInventory():AddItem(box1);
end
frank elbow
#

Can you show more of the context? I assume you're creating an ISCraftAction somewhere and doing stuff with it?

proven bough
#

That's literally the whole file ๐Ÿฅฒ

frank elbow
#

I suppose it's occurring as a result of the recipe then

proven bough
#

Like, when I go into the game, I'm able to craft the item just fine, but it keeps chucking that error at me

#
    recipe Combine Puzzle Pieces
    {
        puzzle1,
        puzzle2,
        puzzle3,
        puzzle4,
        puzzle5,
        puzzle6,
        puzzle7,
        puzzle8,
        puzzle9,
        puzzle10,
        
        Result: puzzlestaff,
        Time:100.0,
        OnCreate: Recipe.OnCreate.CreatePuzzleStaff,
        Sound:PutItemInBag,
    }
#

There's the create recipe

frank elbow
#

I may be misremembering, but I believe ZombRand with integers works with an exclusive range

#

Meaning ZombRand(N) โ†’ integer in [0, N), thus ZombRand(1) โ†’ 0. If this is the case, your box1 will always be nil, since indexing starts from 1

#

It's possible that the error occurs there, and the Java code responsible for executing the OnCreate callback throws it as the exception you're seeing

#

Looking at the Caused by exception, it seems likely that that's the culprit

proven bough
#

Right, sooo how would you recommend I fix this issue? I'm quite new to coding in general, so advice is greatly appreciated ๐Ÿ™‚

#

Would adding a +1 integer to the zombrand do anything? or would that break it even further?

frank elbow
#

Excellent intuition, that's what I would suggest. I think you'd be better off basing your ZombRand number directly off of the length of the table as well, so you can change it without worrying about breaking it

#

Also: using local variables is recommended

proven bough
#

Alrighty, I'll try adding a +1 to the zombrand and see if that changes anything

#

Okay, so it didn't pop up with an error this time, but it gave me two staves instead of one

frank elbow
#

Well, that seems to be what you're telling it to do

#

Your recipe has Result: puzzlestaff, and the OnCreate callback adds another

proven bough
#

Theoretically...do I even NEED the oncreate function?

#

I suppose I do

frank elbow
#

If you only want to create one item and do not need any side effects, you don't need it

#

I assumed from your use of the random function that you want to randomize something in the future

proven bough
#

Oh that was mostly just me being lazy and copying over the code from my last mod to see if I could do it that way ๐Ÿ˜›

#

Just removed the call for the oncreate function from the recipe, let's see how this pans out...

#

Heeeell yeah, that did it. Thanks for the help Omar! ๐Ÿ˜„

drifting ore
#

Are you talking to me ?

neon bronze
#

Whats the way to play a sounds through a player? Is it through the players sound emitter?

fast galleon
#

Would there be any errors from having nights survived < 0 so that world age is also < 0?

#

I tested it briefly before, but maybe I missed something.

red tiger
#

Gson and Kahlua exposer.

#

Don't need anything else really.

neon bronze
thin hornet
#

@neon bronze PlaySound will transmit automatically and yes it will play 3D, PlaySoundImpl will play 3D but not transmit so would be heard locally only

neon bronze
#

Thank you

trim mist
gilded hawk
jaunty marten
gilded hawk
weary matrix
#

I'm trying to use getUrlInputStream, this is my code so far:

local function readByte(dataInputStream)
        local status, byte = pcall(function()
                return dataInputStream:readByte()
        end)

        return status and byte or nil
end

local function downloadConfig(config)

        if not config or not config.url then
                print("Config URL missing!")
                return
        end

        local output = ""
        local dataInputStream = getUrlInputStream(config.url)
        local byte = dataInputStream:readByte()
        while byte do
                output = output .. string.char(byte)
                byte = readByte(dataInputStream)
        end
        dataInputStream:close()
        print(output)

end
``` It is working as expected, but my concern is the call to pcall doesn't seem to prevent a stack trace on the java side:
```Caused by: java.io.EOFException
    at java.base/java.io.DataInputStream.readByte(Unknown Source)
#

and also I'm getting a red square error

tawdry solar
#

anyone know where icons are stored?

weary matrix
#

@tame mulch any way to catch java exceptions from Lua? Otherwise I'm not sure how to read from dataInputStream without triggering an exception, because you'll always get EOFExcpeption at the end of input. I also tried to use the method dataInputStream:available() but it's always returning 0. Other methods that don't trigger EOFException require a java byte array, but from what I remember we can't instantiate java arrays from Lua

weary matrix
tawdry solar
bronze yoke
#

in the texture packs

weary matrix
#

@bronze yoke hey, any clue about my problem?

bronze yoke
#

sorry, not a clue - never worked with the url stream or even the file streams, and i'm usually in a position to avoid exceptions, not handle them

weary matrix
#

I wish I was in a position where I could avoid it ๐Ÿ˜„

#

anyway thx for your answer

trim mist
tawdry solar
#

he was one of the translators

weary matrix
tawdry solar
trim mist
#

Is there ever a time where staff does like an AMA?

bronze yoke
#

i think it's in the UI packs

tawdry solar
#

oh

weary matrix
weary matrix
tawdry solar
#

ask me anything

trim mist
#

It stands for --

#

yeah tahat

weary matrix
#

ah hum

trim mist
#

basically just a period of time that's set aside to answer questions

tawdry solar
#

usally for upcoming updates

trim mist
#

like an hour or so

weary matrix
#

I think they did it sometimes, not sure how regular it is though

tawdry solar
#

also normally live

trim mist
#

I'd love to leverage that to ask some modding questions

tawdry solar
#

100% worst part of mod dev is icon creation

weary matrix
bronze yoke
#

if you just need to create one you can just dump a png into textures

tawdry solar
#

but ive finished my mod

#

this is just the last thing

weary matrix
tawdry solar
#

oh shit

#

i gotta do distributions

#

ty for reminding me

#

i also got a question

#

for dists

#

is the base.item or whatever

#

just the item name

#

like this

bronze yoke
#

yeah, prefixed with the module

tawdry solar
#

i dont have a mod

bronze yoke
#

if the module is base you can usually just omit it

tawdry solar
#

oh

#

its base

#

so yeah

#

its base.Bolo

trim mist
# weary matrix which questions you need answered that can't be answered here? ๐Ÿ˜…
  • is there a way to add animations with a higher speed scale, and allow only some players to use those? I've tried adding animation xmls with different filenames and m_names, but all my attempts to allow only some players access to those have ended with overriding the other animations, so all players get the higher speed scale.
  • Is it possible to add outlines to zombies without aiming at them? My attempts to do it each frame result in no visible change.
  • Are there plans to allow modders to affect vision? What about the hearing radius, thermoregulators (changing base core temp, stopping sweat, etc), shaders, or interactions with NPCs?
#

among others haha

weary matrix
weary matrix
tawdry solar
#

i thought he coded or sm

weary matrix
#

nope, not that I know of at least

tawdry solar
#

but ik aiteron does that

weary matrix
#

yes he does

trim mist
bronze yoke
#

i'll look over it again quickly, but i'm 100% sure i checked before and it was just impossible

weary matrix
trim mist
#

let me also look into it haha

bronze yoke
#

the problem is that because it works when aiming it doesn't work from anything else

#

it's always overwritten by what aiming is doing

weary matrix
#

if it's only on the java side and stuff are not exposed then you're fucked

#

with all my respect ๐Ÿ˜‚

tawdry solar
#

my distributions dont work smh

weary matrix
#

upload the file or something

tawdry solar
#

RYT

#

oops

weary matrix
tawdry solar
#

idk

#

ill check

#

it just didnt show up in lootzed

weary matrix
#

IIRC it has to be in server but I'm not 100% sure, or maybe shared

#

try to add print("Something") to your distribution file, and then look for Something in console.txt. If not found it probably means your file is not loaded

tawdry solar
weary matrix
tawdry solar
weary matrix
#

shouldn't it be something like: media/lua/server/Items/?

humble raft
#

Is there a discrete zombie/player base class you can work from to make new enemies from?

bronze yoke
#

i'd be surprised if that would even work on non-sprite objects

weary matrix
bronze yoke
#

the actual aiming highlight is called outlineColor and is not exposed at all

weary matrix
# tawdry solar Maybe

if it's still not working just check any mod that do distribution to see where they put their distribution file

bronze yoke
#

hmm maybe actually... if you could use the weird field stuff to get it you might be able to mess with it, the class is exposed and the field is public

#

i gave up on that idea immediately because you can't set fields, but you wouldn't actually need to set it in this case, since it's an object

trim mist
#

albion, if I go further with this idea I'd likely need to lean on you pretty heavily in that case.

bronze yoke
#

oh... but you'd need to set another field to make it render

#

that's disappointing

trim mist
#

but-- if you have any other ideas about what I could do-- my use case is trying to show zombies outside of vision within a limited range. To represent "smell"

thin hornet
#

arent zombies outlined when aiming at them?

bronze yoke
#

that's what we're discussing

weary matrix
trim mist
#

My thoughts have been outlining zombies, using a moodle to represent how close they are (a la the sixth sense mod), but I'm not really sure if there's any other options

#

and I hate the idea that they could be, you know. Actually seen moving rather than hinted at in the outline approach

bronze yoke
#

i think with field shenanigans you can change the colour, but it doesn't matter because it won't render unless bOutline is true, which doesn't have a setter - and i'm also not really sure how arrays (as opposed to arraylists) behave in kahlua so maybe the first part isn't possible anyway

weary matrix
thin hornet
#

Could add a circle on the ground that represent a range?

bronze yoke
#

i remember seeing some getters that convert arrays to arraylists, so i'm guessing arrays might be problematic...?

trim mist
trim mist
weary matrix
thin hornet
#

The debug UI usually have circles when selecting squares (spawn zombie for example)

weary matrix
#

I know some maps add an overlay, but not sure if it can be used from a mod

bronze yoke
#

got fed up with my decompile misbehaving while looking into this, quickly ran beautiful java, it's a lifesaver

jaunty marten
fast galleon
#

-5 % 24 = ?
lua 5.4: 19
kahlua: -5

jaunty marten
#

trying to handle end of networking process by pcall is some of crazy thing tbh

weary matrix
fast galleon
#

can you help?

jaunty marten
#

but as I think there's network limitation for 65536 bytes for each stream so if config is big u will need to split it and send separated, after u got all chucks of original config concat and json unjsonify it

#

I can show to u how it can looks like but example not from pz but gmod

weary matrix
#

Don't care about the JSON part though, all i need is Lua

#

Not sure if an example from gmod is going to be relevant though

jaunty marten
#

oh wait, I misstook in that r u trying

#

mybad

#

I see u tried :readFully()

#

but u missed with one thing

#

first argument is TO WHERE data will be written

#

u don't need any bytes info

weary matrix
#

Problem with readFully is you need a java byte array, but you can't instanciate a byte array from lua

#

AFAIK

jaunty marten
#

in lua byte have some different object?

#

byte is a common string

weary matrix
#

A java byte array is no simple string

jaunty marten
#

I'm not sure that it will handles like that

#

but never tested so yea can't guarantee

weary matrix
neon bronze
#
module Base{
    
    sound ScoutLaugh2{
        category = Player,
        clip
        {
            file = sound/Scout_laughhappy02.ogg,
        }
    }
}
```` the sound script file in question
#

ok nvm figured it out, its just strange that you have to parse through the name of the file and not the sound name as you defined it

fathom dust
#

is there a way to remove the fuel from the gas tank of a vehicle with dev tools for testing?

fading arrow
#

Really struggling to find a way to add custom zombie animations, all mods I found only used stock. Can anyone bumb me in the right direction, please?

weary matrix
bronze yoke
#

iirc it just creates one if it doesn't find a script by that name but can find a matching sound file, so if you don't need to do anything fancy it's probably not a big deal to not have one

#

it probably has some performance impact to create it live but it only has to do that the first time you try to play it

thin hornet
fathom dust
neon bronze
bronze yoke
#

i think your sound path is wrong

neon bronze
#

I guess i forgot the media

red tiger
#

Are there any snake-related items in the vanilla game?

bronze yoke
#

i have a feeling you're not asking about the bandana

red tiger
#

Didn't know PZ had those.

bronze yoke
#

it's been a long time...

woven brook
#

Anyone know the hydrocraft devs discord?

#

i'd like to ask him about snagging an asset

heady crystal
#

Anybody know if it's possible to spawn a particle in a certain square?

#

Like a muzzle flash or something

woven brook
#

embed fail

lyric scaffold
#

how longs it supposed to take for a mod to get accepted by steam? been like this for the past hour and a half

#

1gb true music mod

bronze yoke
#

i've never even heard of a waiting time

lyric scaffold
#

yeah i've uploaded other mods before and it was short if not instant

#

think i should just duplicate it and try again

#

?

bronze yoke
#

maybe yeah, it sounds like something might have gone wrong

lyric scaffold
#

aight

autumn garnet
lyric scaffold
#

might be a far stretch but do you think you think opening a lua file as a txt document mightve fucked it up?

#

because thats the only real thing i did out of the usual

gilded hawk
#

is there a safe way to make sure a breakpoint set in the lua debugger works even if this breakpoint is in a function used in the Events.OnGameStart?

bronze yoke
#

why would that stop it from working?

gilded hawk
#

Well, it's not working

gilded hawk
gilded hawk
#

Does anyone know why group:setHideModel does not work with the Back body location?
I'm trying to hide the backpack

red tiger
#

This is a question for everyone here who codes: Would you code python 3 if you could code python for modding PZ?

#

Hey @gilded hawk . Have you tried using the new EmmyLua typings for PZ?

frank elbow
#

My answer is no, but figured I'd add both reactions so it's easier to keep track (feel free to react to them yourself & I'll make it accurate)

red tiger
#

The reason I ask is because I looked into the possibility of supporting python for modding PZ and it is possible.

frank elbow
#

Certainly sounds interesting, but I'd just stick to Lua as usual ๐Ÿ˜„

red tiger
#

I personally have no preference.

bronze yoke
#

i have been working in python a lot recently, but i like to stay native... as native as scripting languages get anyway

gilded hawk
#

If it's umbrella then yes, I am, and it's lot's of fun. I'm using it for my casualoid project

red tiger
#

niiiiiice.

#

I need to advertise Umbrella.

#

You've used PipeWrench so you know It's trying to do the same but in Lua.

gilded hawk
#

Yeah, I found that even if I'm a seasoned js/ts dev, I still prefer to stay native and Umbrella + PzStudio is a great combo

#

Holy shit I found a almost native way to hide backpack! ๐ŸŽ‰

fathom dust
gilded hawk
red tiger
#

Lua typings that exposes and defines the PZ API used for modding.

fathom dust
#

so pzstudio looks like a mod organization tool. i'm not clear on what this means in the descrption, what is it responding to? dynamically monitor and respond to changes

mellow frigate
#

Hello there, what should I look for to control the camera position in other ways than Vanilla ? No Java modification. Has someone already done such thing ?

#

Someone already played with IsoCamera.SetCharacterToFollow ?

shrewd violet
#

Modmanager on pure bash))

#

(under cygwin)

jaunty marten
#

there's no any text part about validation, it's just hidden so change visible state of it

lyric scaffold
#

it wasnt, how true music works is that they give you some preset then you add in .mp3 files and you use an exe file to conver them to .ogg file, my antivirus blocked that exe

#

so i just turned it off and it worked

jaunty marten
lyric scaffold
#

yeah ik bout that, but when i uploaded the mod through the game it had a name and a preview pic

#

i couldnt change the visibility either

#

it also mentionned the mod was 0.000 megabytes, even tho the file contained something like 1gbs worth of music

#

it also didnt even have a name at first, i juse renamed it to "j" just to see

#

but anyways it works now so it doesent matter much

jaunty marten
#

good then yes

thin hornet
#

I made pzstudio to suite my needs but im all open for PR on github for any improvements and ideas.

#

I have plan in the future to implement a translation manager too for making translating mods easier

ancient grail
plain crane
#

Heya! New modder here. I'm getting these error messages in my logs. for GazTigr it's trying to load a file that isn't installed because I accidentally left the modID in there when I wanted to remove it, but the rest I'm certain are installed

novel barn
#

@plain crane I'm also pretty new here so I don't know if I'm barking up the wrong tree, but by any chance are you testing with the -nosteam flag? If you are then your client won't pick up anything from the workshop.

plain crane
low magnet
#

is there a way to spawn items inside an equipped bag?

gilded hawk
ancient grail
#

spawn bags with items inside

heres a code we used for Signs of Sickness Server - ToxSick Event

local shotgun = InventoryItemFactory.CreateItem("Base.DoubleBarrelShotgun");
local bag = InventoryItemFactory.CreateItem("Base.ShotgunCase1");
shotgun:setTooltip("initially has 6 chambered  shells");
shotgun:setClipSize(6);
shotgun:setCurrentAmmoCount(60);
shotgun:setRoundChambered(true);
shotgun:setAimingTime(90);
shotgun:setMinDamage(shotgun:getMinDamage()*2)
shotgun:setMaxDamage(shotgun:getMaxDamage()*2);
shotgun:setName("SOS ToxSicK Event Shotgun"); 
getPlayer():getInventory():AddItem(bag);
getPlayer():setWornItem("Back", bag);
bag:setName("SOS ToxSicK Event Gun Case"); 
bag:getItemContainer():AddItem("BladeSOS.Bloodbath");    
bag:getItemContainer():AddItem(shotgun);

another one used as template for Kentucky RP server


local spwnbag = InventoryItemFactory.CreateItem("Base.Bag_Schoolbag")
spwnbag:getItemContainer():AddItem("Base.Apple");
spwnbag:getItemContainer():AddItem("Base.Apple");
spwnbag:setCapacity(70)
spwnbag:setWeightReduction(70)
spwnbag:setName("Kentucky RP - Store Items"); 
getPlayer():getInventory():AddItem(spwnbag);
getPlayer():setWornItem("Back",spwnbag);
getPlayer():resetModel();
weary matrix
low magnet
ancient grail
#

You might want to test it to figure out what it does
Just paste that on the lua console
Then modify as u see fit

#

You wont have to look for the syntax as everything id there already
Goodluck

weary matrix
#

@hardy flint Hey, do you mind sharing a code snippet to see how to use getUrlInputStream() properly?

#

right now I'm able to retrieve content, but not without triggering a java exception at end of file

#

hum guess I could use a BufferedReader to avoid the exception, but that feels a bit overkill

#

damn, I would need InputStreamReader but it's not exposed :/
Also tried readUTF but getting EOFException as well
only thing working is readLine() but it's deprecated...

fathom dust
#

am i correct in interpretting that there is only a single shared random number generator in Lua?

#

should i not seed it if i need to use it? will that potentially mess up other things using it that may want the seed persisted?

fathom dust
#

anyone know if there's some reason goto would not work in PZ's lua? I can't find anything wrong with my syntax

#

if not ShouldDoThing(thing) then goto continue end
...
::continue::

weary matrix
fathom dust
#

ah, thanks

weary matrix
#

but the Kahlua version in pz is based on lua 5.1 IIRc

#

if you need continue you have to wrap your code inside if blocks

fathom dust
#

yeah np just wanted to make sure i understood why it wasn't working

#

ah, so math.random is not available either. is there an RNG solution?

fast galleon
fast galleon
fathom dust
#

ZombRand works great thanks for the tip!

weary matrix
#

OK so using getUrlInputStream() like this is working:

        local output = ''
        local dataInputStream = getUrlInputStream(config.url)
        local line = dataInputStream:readLine()
        while line do
                output = output .. line
                line = dataInputStream:readLine()
        end
        dataInputStream:close()
``` but the `readLine()` method is deprecated so I'm wondering if someone knows of a better way?
shrewd violet
#

Instead of debugging who replaces who ingame

weary matrix
shrewd violet
#

Or just in one csv/xml/json

#

Primary goal was to recategorize all that tons of new items

weary matrix
shrewd violet
#

Not yet, still writing some stuff

fast galleon
#

How does PZ handle online players that are out of cell bounds? Is there a player object, no square?

neon bronze
#

is there a guide on setting up custom setting options?

weary matrix
ancient grail
#

I just tossed something that might replace readline which you mentioned

#

Idont have any odea about the read steam thing. But i know how to open browser to a specific url
Tho someone mentioned it doesnt work anymore

red tiger
#

Also openUrl() is a defunct API call. Not sure why it isn't rid of at this point since it was confirmed to be replaced or removed from TIS a ways ago.

#

Unfortunately people won't be able to click buttons in-game that opens a discord invite link.

#

(So freaking useful back in 2017)

weary matrix
#

I just did it

red tiger
#

It'd be very dirty / tricky.

weary matrix
#

no

#

except for the part where you can't catch the eventual exceptions related to IO/network errors

red tiger
#

The only method I figured out was to run a separate process to catch file requests / changes using an IO reader.

weary matrix
#

@red tiger

                @LuaMethod(name = "getUrlInputStream", global = true)
                public static DataInputStream getUrlInputStream(String string) {
                        if (string != null && (string.startsWith("https://") || string.startsWith("http://"))) {
                                try {
                                        return new DataInputStream((new URL(string)).openStream());
                                } catch (IOException ioException) {
                                        ioException.printStackTrace();
                                        return null;
                                }
                        } else {
                                return null;
                        }
                }
red tiger
#

Yes. You modified the Java.

weary matrix
#

lol no

#

this is vanilla

red tiger
#

If this is a server solution then yes this will work.

#

The fuck? Where did this come from?

weary matrix
#

probably a recent release

red tiger
#

I searched for this sort of thing occassionally.

weary matrix
#

yeah me too, been looking for it since day 1 of modding pz ๐Ÿ˜‚

red tiger
#

I was the biggest bitch about not having any access to URL stuff.

weary matrix
#

but now you can! ๐Ÿ˜„

red tiger
#

I was told the original one was disabled due to issues with security concerns.

#

This isn't any safer.

#

Oh wait it sort of is.

weary matrix
#

so for example with ModGuardian I'll be able to report the IP of servers that run modpacks with your mods ๐Ÿ˜

red tiger
weary matrix
red tiger
#

Hopefully that's all you piss off.

weary matrix
#

who else could I piss off? ๐Ÿค”

red tiger
#

It might bother the devs. I'm not one so I can't say they would.

#

Mod packs has always been such an annoying fight in the mud.

#

It's also data-gathering.

#

It might be an issue?? I wouldn't be the guy to be mad about what you're trying to do here specifically.

#

It's a different attempt to control the issue you have where people steal your stuff.

#

There's no official means to combat this problem so I don't think anyone should get mad at you for doing this.

#

Same with my mod loader.

#

It makes mods "exclusive content".

weary matrix
#

yeah I agree the data-gathering part is an issue

#

because of GDPR etc

red tiger
#

Even with good-faith, someone will eventually spoil it for all of us.

weary matrix
#

but it's a lesser offense than stealing intelectual property? So that makes it ipso-facto legal because there's no other way to report the later crime?

red tiger
#

One could argue that your firewall logs IPs.

weary matrix
red tiger
#

I don't think it'd fully translate to your case.

weary matrix
#

for example in france, it's illegal to record someone unless he agrees to

#

but if you record someone to report a crime he's commiting, and there's no other way to prove the crime, then you're allowed

#

kind of

red tiger
#

Anyways thought I'd bring this point up to maybe help you think about the implementation. I'd like to see the results.

#

It's somewhat frowned on however some MC premium plugins do licensing and key tracking.

#

It's the same problem, really.

weary matrix
#

the thing is I won't be logging all server IPs that use my stuff, only the ones caught in the act of stealing

red tiger
#

When people package mods, they sometimes alter them so if your goal is to ping an endpoint, they could remove that code.

weary matrix
#

like:

if modpackDetected then
    logServerIP()
end```
red tiger
#

As a mod packer, I'd remove it.

weary matrix
#

the code is not in clear text

red tiger
#

I mean.. I'd be fine finding it but would all mod packers?

weary matrix
#

it is very easy to reverse it, but then you get heavily obfuscated code with no symbols and no newlines and you can't indent the code using beautifier tools

#

so yeah of course it's possible

#

my bet is that most mod packers are not smart enough

red tiger
#

Can't you load your own mod files via IO readers?

#

Could run a checksum.

weary matrix
#

I don't know if you can load your own mod files

#

but yeah I'll probably add some sort of anti-tampering at some point

red tiger
#

getMod('mod_id').getFolder()

#

or something.

#

I did this in the past.

#
local modInfo = getModInfoByID("my_mod");
local modDir = modInfo.getDir();

@weary matrix

weary matrix
red tiger
weary matrix
#

most filesystem related global functions are checking if you have ".." etc in your path

red tiger
#

That's the root so you don't need it.

weary matrix
#

let's see

weary matrix
#

so you can't use the File methods on it

#

meaning you'll have to open the files by path, and I'm not sure it's possible

red tiger
#

If you can digest a file's contents then it's possible.

weary matrix
#

can you?

red tiger
#

yesss

weary matrix
#

how?

red tiger
#

You use the reader.

#

Take that string, complete the path and then open a reader instance.

weary matrix
#

but most reader function open files in the cache folder

#

then you'd have to go up to the parent using ".." etc but those functions check for ".." and forbid it

#

for example:

                @LuaMethod(name = "getFileReader", global = true)
                public static BufferedReader getFileReader(String string, boolean boolean1) throws IOException {
                        if (StringUtils.containsDoubleDot(string)) {
                                DebugLog.Lua.warn("relative paths not allowed");
                                return null;
                        } else {
                                String string2 = LuaManager.getLuaCacheDir();
                                String string3 = string2 + File.separator + string;
                                string3 = string3.replace("/", File.separator);
                                string3 = string3.replace("\\", File.separator);
                                File file = new File(string3);
                                if (!file.exists() && boolean1) {
                                        file.createNewFile();
                                }

                                if (file.exists()) {
                                        BufferedReader bufferedReader = null;
bronze yoke
red tiger
#

It was due to a JVM arg in the JSON file for the exe.

bronze yoke
#

maybe? i do remember having no luck with it before

red tiger
#
@LuaMethod(
            name = "getModFileReader",
            global = true
        )
        public static BufferedReader getModFileReader(String var0, String var1, boolean var2) throws IOException
#

java.awt.headless=true is what breaks openUrl()

bronze yoke
#

but now it's used to open the tos in browser

red tiger
#

Wait wtf

bronze yoke
#

createifnull

red tiger
#

this one does cache too.

weary matrix
#

yep

red tiger
#

Okay now I'm fucking angry.

weary matrix
#

it gives you a folder specific to your mod to write files to, but it's not your mod folder

red tiger
#

Maybe my memory of this API is too outdated.

bronze yoke
#

it is the mod folder, isn't it?

weary matrix
# bronze yoke it is the mod folder, isn't it?

I don't think so:

                @LuaMethod(name = "getModFileReader", global = true)
                public static BufferedReader getModFileReader(String string, String string2, boolean boolean1) throws IOException {
                        if (!string2.isEmpty() && !StringUtils.containsDoubleDot(string2) && !(new File(string2)).isAbsolute()) {
                                String string3 = ZomboidFileSystem.instance.getCacheDir();
                                String string4 = string3 + File.separator + "mods" + File.separator + string2;
                                if (string != null) {
                                        ChooseGameInfo.Mod mod = ChooseGameInfo.getModDetails(string);
                                        if (mod == null) {
                                                return null;
                                        }

                                        string3 = mod.getDir();
                                        string4 = string3 + File.separator + string2;
                                }

                                string4 = string4.replace("/", File.separator);
                                string4 = string4.replace("\\", File.separator);
                                File file = new File(string4);
bronze yoke
#

i actually have a mod about done that heavily relies on that fact so i'm quite sure of it

red tiger
#

Forcing the cache dir is cancer.

weary matrix
#

@bronze yoke I'd be curious to see it

weary matrix
bronze yoke
#

i use it to read txt files, writing is a bad idea

#

if you write it'll mess up the checksum forever

weary matrix
#

true

bronze yoke
#

local reader = getModFileReader(mod, "media/musicradio/scripts.txt", false)

weary matrix
#

oh

#

interesting

red tiger
#

Fun fact: the game internally refers to http://pz-mods.net, which is blocked by uOrigin for "Badware risks". TIS might want to rid of that URL.

weary matrix
#

ZomboidFileSystem.instance.getCacheDir(); actually returns the path to your Zomboid folder in your home

#

I always thought it was returning Zomboid/cache or something like that

#

hopefully we'll never get into a modders war where people fuck with other peoples mods ๐Ÿ˜‚

#

the potential is here though

bronze yoke
#

yeah, there's still some evil stuff you can do with mods

red tiger
#

I'm more concerned about being able to read passwords in plaintext in the cache folder than mod wars.

weary matrix
#

of course

bronze yoke
#

oh my god that's actually a thing

red tiger
#

It's been a thing for as long as profiles have been a thing for multiplayer.

#

It's phishable. That's been a issue.

bronze yoke
#

yeah, i just found the relevant files

#

that is shocking

red tiger
#

Until that's fixed, I refuse to take any security solutions for PZ seriously.

weary matrix
#

that said it could be fun to use that to fuck with server owners who use modpacks ๐Ÿ˜‚

red tiger
#

I'm terrified to think of the number of multiplayer accounts that has the same password as something important as a bank account.

weary matrix
red tiger
#

I think it'll possibly hurt people to continue this conversation.

weary matrix
#

๐Ÿค

#

so any clue about a decent hash function available to pz lua?

red tiger
#

Then loadstring(..)()

weary matrix
red tiger
#

If you can't IO your lua files, have your lua code be contained as an encrypted string.

weary matrix
#

it's already the case

#

but we just seen it's possible to read your lua files? So I'm looking for a decent hash function to check integrity of files

#

I would implement some sha stuff myself if we had access to bit operations, but don't want to implement those myself, for my own sanity

red tiger
#

Share with the class when you're done.

weary matrix
#

I just said I won't do it ๐Ÿ˜‚

quaint rapids
#

decompiled the game, and I'm trying to find the code section that handles "Thump" targets for zombies.

gilded hawk
#

@ancient grail So, you asked about making a backpack invisible. I found a solution. Using item:DoParam("BodyLocation = Back") I add the body location to all the backpacks

And by making the user wear an item with a specific body location, in my case group:getOrCreateLocation("Hide_Everything") I then set this bodylocation to hide the backpack using group:setHideModel("Hide_Everything", bodyLocationId)

And this makes the backpack disappear without having to use hacks or respawning the item!

gilded hawk
# gilded hawk <@591976049592631298> So, you asked about making a backpack invisible. I found a...

Code example below

local allItems = getScriptManager():getAllItems()
    for i = 1, allItems:size() do
        local item = allItems:get(i - 1)
        -- If can be canBeEquipped but not getBodyLocation, then it's a backpack!
        -- So, we force the backpacks to have a BodyLocation, so that it can be hidden by pz using the group:setHideModel! 
        if item:getType() == Type.Container and item:InstanceItem(nil):canBeEquipped() ~= "" and item:getBodyLocation() == "" then
            item:DoParam("BodyLocation = "..item:InstanceItem(nil):canBeEquipped())
        end
    end
quaint rapids
#

hmmmm

gilded hawk
#

hmmmm

fast galleon
#

oh you probably mean before that.

weary matrix
#
local function reportModpack(config)

        if not config.report_url then
                return
        end

        local url = config.report_url .. "?"
        local modInfo = getModInfoByID(config.modID)

        local params = {
                modID = config.modID,
                workshopID = config.workshopID,
                serverIP = getServerIP(),
                fakeWorkshopID = modInfo and modInfo:getWorkshopID()
        }

        for key, val in pairs(params) do
                url = url .. key .. "=" .. val .. "&"
        end

        getUrlInputStream(url):close()
end
``` ๐Ÿ˜„ ๐Ÿ˜„ ๐Ÿ˜„
#

@thin hornet modders will be able to receive a notification when one of their mod is found in a modpack ๐Ÿ˜

thin hornet
#

Thats sneaky hehe

weary matrix
#

how cool is that? ๐Ÿ˜‚

thin hornet
#

Implement an API key system where server need to fill the field which then check if the api key is valid

#

Not that i would use this but its funny to see you achieve those things.

weary matrix
#

actually you could use it and keep your code in clear text, just to know the workshop IDs of the modpacks with your stuff in them

thin hornet
#

Yeah considering they do not edit the code

weary matrix
#

of course anyone could remove the code, assuming they know the mod is doing this

#

pretty sure modpackers don't expect this kind of stuff though ๐Ÿ˜

bronze yoke
#

modpackers are not developers

ancient grail
fading horizon
#

that's rly smart

gilded hawk
quaint rapids
#

So, I'm attempting to create a script that stops zombies from damaging doors when not targeting the player. So that when environmental attacks is on, they can still break windows, barricades and other obstacles without targeting the player, but not doors unless aggro-ed.

I found this thing which I think has something to do with the zombie target type, but all that I can find besides coordinate based references to the current target.

Am I looking in the right place?

gilded hawk
quaint rapids
#

yes

#

I';m trying to remove doors from the enviromental attack sandbox option

bronze yoke
#

i'd look for that option

#

see how that's actually implemented

gilded hawk
quaint rapids
#

maybe, but then wouldn't that prevent the zombs from breaking doors when arggroed?

gilded hawk
#

Maybe there is a property that says if a zombie is chasing a player?

quaint rapids
#

other then this here, I don't think so

#

butttt

#

maybe ittl lead to a check for whether the zombies are aggroed and breaking an object?

tawdry solar
#

is this line required for fbx

neon bronze
#

Dont think so, it takes over the angles from blender

fast galleon
#

How to reload animation xml?

neon bronze
#

Or atleast you can update the model live in blender if you re-export in in fbx

thin hornet
quaint rapids
#

hmmmmm. maybe?

thin hornet
#

And thumpable again when the player is next to it kindof

quaint rapids
#

I think there's already a system for thumpability though.

#

depending on whether or not enviromental attacks is enabled, zombies will thump random objects and deal damage to them, however when disabled, they still thump doors and windows, just don't deal damage unless targeting a player

modern knot
#

Hello! First time writing here. Iโ€™m a total newbie when it comes to modding, and my code knowledge is rudimentary at best. That being said, would it be feasible for me to create a mod that allows me to do the following on a multiplayer server:

Creating a modded item to manage ticket items for events:

  • Print (generate) tickets using unique names and preset colors.
  • Punch/stamp used tickets.
    ~ Tickets can be readable (non-editable) items, but it is not necessary.

I realize thereโ€™s a lot of logic involved here, and that itโ€™s more complex than a beginner might imagine, but Iโ€™m open to clever, simpler solutions as well. Let me know what you think might be the best approach.

Thank you! (edited)

thin hornet
bronze yoke
#

that doesn't seem too crazy

thin hornet
#

You could make a single item and rename them in game

#

For the coloring i supose it could work like the clothing color picker?

#

Im not sure there are different color for item other than clothing item

#

Otherwise you make a bunch of different colored items

#

YellowTicket, OrangeTicket etc

#

to know if the ticket was used you can save data into the item ModData

#

id save the world date and time to know when it was used.

#

you could implement expiration the same way

modern knot
#

That would be really cool!

modern knot
thin hornet
#

Generating would be easy

#

a custom context option on the ticket printer machine where you must have black ticket and ink? Then you fill info in a UI like the ticket name and expiration date, valid from date.

modern knot
#

What's the first thing I would do to get started on something like this?

thin hornet
#

Learn how to add items, and creating context options.

#

Items are made into media/scripts/*.txt files

#

Context menu are Lua code into media/lua/client/

ancient grail
#

Is the spiffo bot auto detects hello

#

It does lol

modern knot
thin hornet
#

this may help you get started with mod structure and also offer you insight with intelisense when it's time to code lua.

modern knot
#

Thanks! Checking it out right away

fading horizon
#

Amputations mod is finally out <3. Hope y'all enjoy!

fast galleon
#

Not all doors are thumpable ๐Ÿ™‚

woven brook
tawdry solar
#

can i see the fbx for the lab?

woven brook
#

here

#

one sec

tawdry solar
#

oh so you didnt finish it last night?

woven brook
#

but im working on a proper model

woven brook
tawdry solar
#

you mentioned working on it

woven brook
#

I gothe model

tawdry solar
#

ah

woven brook
#

just havent imported

tawdry solar
#

my models are fucked rn

woven brook
#

loll

tawdry solar
#

and idk why

#

might just make a new item rq

trim mist
#

Hey guys, is there a way to get an item with all it's variables untouched?

bronze yoke
#

wdym?

trim mist
#

guh, words. words are hard

#

Like, every time a player updates their clothing I wanna set their shoe's stomp power. If I don't reference the original variables for the shoe item, if they constantly equip / re-equip they'll have shoes that do like 2000 damage

#

so if I can get a copy of the shoes they have from like, a vanilla list of items and compare it, that'll solve my problem

#

lol

bronze yoke
#

you can use the script item (ScriptManager.instance:getItem("Module.Type") -> Item), or if the thing you need isn't accessible on the script item but is on instances (InventoryItemFactory.CreateItem("Module.Type") -> InventoryItem)

#

needing to create an instance should be very rare though

trim mist
#

based thank you. I knew that was a thing but I didn't know the syntax for it (or what words to search discord with lmao)

trim mist
neon bronze
#

is there a way to check whether the player emitter does not play any sounds at the moment?

sour island
bronze yoke
#

oh damn, i've never seen that before

sour island
#

do you know of something to grab the squares infront of the player?

bronze yoke
#

how many? if it's just one you could do something like player:getSquare():getAdjacentSquare(player:getDir())

sour island
#

oh I didn't think of that

#

I'm trying to reverse egineer which tree is getting hit

#

since ontreehit doesnt give the event the tree

#

had to reverse engineer WeaponLength because the item nor script has a getter for it

bronze yoke
#

i know it's not needed in vanilla but why would we not want the tree u_u

sour island
#

also, get attacking square just gives you back the square your mouse is on

fast galleon
sour island
#

oh?

fast galleon
#

It's a bit random though

sour island
fast galleon
bronze yoke
#

is that with getadjacentsquare?

sour island
#

no something more brutal

#
---@param owner IsoGameCharacter|IsoPlayer|IsoMovingObject
---@param weapon HandWeapon|InventoryItem
function loggingOnWeapon.hit(owner, weapon)
    print("OnWeaponHitTree: weapon: "..tostring(weapon))

    if weapon:getScriptItem():getCategories():contains("Axe") then
        owner:getXp():AddXP(Perks.Logging, 2.5)

        ---@type IsoGridSquare
        local square = owner:getSquare()

        local wepLength = loggingOnWeapon.grabLengthOf(weapon) + 0.5

        local ownerForwardDir = owner:getForwardDirection()
        local ownerX, ownerY = owner:getX(), owner:getY()
        local attackX, attackY = ownerForwardDir:getX(), ownerForwardDir:getY()
        
        print("attack:"..attackX.."  ,"..attackY)

        for i=1, 10, 1 do

            local iDiv = i/10

            ---@type IsoGridSquare
            local attackSquare = getSquare(ownerX+attackX*wepLength*iDiv, ownerY+attackY*wepLength*iDiv, owner:getZ())
            if attackSquare then

                getWorldMarkers():addGridSquareMarker("circle_center", "circle_only_highlight", attackSquare, 0.8, 0.8,0,true, 1, 0.02, 0.2, 1.0)

                print("ATTACK SQUARE")
                square = attackSquare
                ---@type IsoTree|IsoObject
                local tree = square:getTree()
                if tree then
                    print("TREE")
                    local treeSquare = tree:getSquare()
                    if treeSquare then
                        print("TREE SQUARE")
                        square = treeSquare
                    end
                end
            end
        end
    end
end

return loggingOnWeapon
#

took apart the code for weapon hit scans

bronze yoke
sour island
#

I'd have to test getadjacent

#

but that wouldnt account for weapon length I imagine

#

not even sure what the /10 is doing - I assume just running down the vector

fast galleon
#

nice

sour island
#

fortunately you can only have 1 tree per square

bronze yoke
#

yeah this is probably better

sour island
#

or they could add the isoTree to the event call

bronze yoke
#

LOL yeah

sour island
#

unhappy making this hour of my life wasted but I'd be happier

thin hornet
#

i wish we could PR the game

sour island
#

adorable markers

#

damn this is surprsingly effective

sour island
#

though can't blame TIS for not wanting their fans the ability to make direct code suggestions

thin hornet
#

No for sure

sour island
#

looking at whoever added prints to send commands with "1"

bronze yoke
#

i wonder how much having their game source available has impacted piracy

#

i'm guessing 'barely if at all' but still

red tiger
#

I sent them a formal letter suggesting a snippit of code to revolutionize the modding scene with graphics mods.

sour island
#

Truth is there is no way to prevent piracy

red tiger
bronze yoke
#

in baro's case i'm pretty sure they use steam as drm which is... not infallible

red tiger
#

They don't actually use the drm tools Steam provides them.

#

Source: Trust me bro.

#

But serioiusly there's little going on there DRM-wise.

sour island
#

considering their source is open* why would there need to be one?

#

save the money on anti-piracy dev time for lawyers

red tiger
#

Trust me when I say that there's more immediate security concerns / vulnerabilities than piracy right now in the game.

sour island
#

in PZ or Baro?

red tiger
#

PZ.

sour island
#

Ah, I was talking about Baro this whole time

red tiger
bronze yoke
#

me too

red tiger
#

What is Baro?

bronze yoke
#

barotrauma

#

source-available submarine game

red tiger
#

Oh nice.

#

(runs away)

sour island
#

is source-available the proper term for what they do?

#

I've been using open-source* and having to explain

bronze yoke
#

from what i understand, yeah

sour island
#

as you see, I always take the long way around

bronze yoke
#

LOL

#

i'm sure most people would see 'source available' and read 'open source' anyway so that may be best

sour island
#

PZ is sort of doing it already with translations

#

well the same process

red tiger
#

If only people could realize the true power of being able to document PZ as a modder and write non-English documentation as well.

#

If that doesn't catch on I see that as a huge L in the community.

#

That's a big reason why I made the PZ-Rosetta project.

lone nest
#

https://projectzomboid.com/modding/zombie/world/moddata/ModData.html
hello, I have some questions about ModData()

Basically I need to understand the CRUD operations involving it if I use it in a mod.

(If you have examples, great and thanks in advance!)
How to create and save said data.
How to load said data.
How to remove said data.

My assumption on modData() is that all of it is functionally a kaluha table, and that means no functions can be saved to it.
But primary types such as boolean, string, and numbers (float/int) can be saved and referenced by mod functions.

thin hornet
# lone nest https://projectzomboid.com/modding/zombie/world/moddata/ModData.html hello, I ha...

You can save only kahlua types into modData, function can be saved but will be nil the next time it's loaded so it's not a valid type for modData.

IsoObject and some other things have functions to save mod data.

For global modData, you have events to check for changes. You also have a global object named ModData that offer functions to transmit, create etc

Player modData seems to be client side only. It doesn't seem to be transmitted on the server player object.

Item modData seems to only save when in a player inventory.

IsoObject modData needs to be transmitted from the square object if I'm not mistaken.

weary matrix
#

I wish we could register .pz domains ๐Ÿ˜‚

thin hornet
#

Why @weary matrix

weary matrix
thin hornet
#

isn't there a .pz tld available somewhere?

weary matrix
#

nope

#

(I just checked ๐Ÿ˜‚ )

red tiger
#

ez.pz

thin hornet
#

hahaha

#

nice one

weary matrix
thin hornet
#

idk if thats legit but

weary matrix
#

also applying for a new TLD usually cost quite a lot, so much it would be prohibitive for any non-large organisations. Up to $185K or something like that

woven brook
#

working on blood transfusions for evergreenimmunes

lone nest
weary matrix
thin hornet
lone nest
#

๐Ÿค”

weary matrix
# thin hornet idk if thats legit but

yeah many site propose "cheap" tlds, but problem is no one use their DNS, so basically nobody could resolve your domain unless they decide to add said company's dns server to their OS

#

also many of these sites are scams basically

thin hornet
#

@lone nest so for example saving an instance of obj:new() which is a lua object will work but when loaded later it will lose all reference to functions that it contained.

#

But all pure value will be there still

lone nest
thin hornet
#

Think of modData like a json object, it cannot contain anything but table, number, string and boolean.

#

You could load and recreate an instance of an object based on the saved values.

#

So instead of saving a java object, you save its ID and find it again later from the ID.

weary matrix
#

or recreate it from the values of the object depending on the context

thin hornet
#

ya it all depend of what object it is or the end goal of the mod.

lone nest
#

Yeah, I'm trying to understand how the CRUD works.

So MyModData = ModData.Create("tableName"); will create a ModData table if I understand correctly.

thin hornet
#

If ran on client it will be on client only. Until transmitted. And same apply for serverside.

lone nest
#

that's fine, i'm not inclined on MP stuff currently.

jaunty marten
#

@weary matrix btw did u solve problem is urlinputsctream?

lone nest
#

and conditionally, create it if table doesn't exist?

    MyModData = ModData.Create("tableName");
end```
thin hornet
#

there is a function to getOrCreate()

#

which will do the same unless it exist

weary matrix
thin hornet
#

Look it up, I'm on my phone so it may be different

weary matrix
#

so it's not ideal but at least it works

jaunty marten
#

I can't get why with geturlintupstream after init :available() returns false for it

weary matrix
#

I tried readUTF also but you're still getting an Exception at end of stream

jaunty marten
#

I tested

thin hornet
weary matrix
jaunty marten
#

but there's problem with that

#

u can't mark it

#

so and can't use reset

weary matrix
jaunty marten
#

to go into start of stream

#

u didn't get any msg from mate that said what he tested urlstream and it working well?

jaunty marten
red tiger
jaunty marten
#

@red tiger glad to be back hey yes

weary matrix
jaunty marten
weary matrix
weary matrix
#

that's why I don't need JSON

red tiger
#

Thought you'd like it.

jaunty marten
# weary matrix yes

why do we need domain then? is u can't just open specific port on ur vds and just use it like http://ip:port? I'm not working with real servers so not sure about it but sounds like it can work in this way

jaunty marten
weary matrix
jaunty marten
#

good work yes

red tiger
jaunty marten
#

.xyz sounds good, I think

jaunty marten
jaunty marten
thin hornet
#

we need cef ๐Ÿ˜›

weary matrix
jaunty marten
weary matrix
#

it feels clumsy when you're getting back at it, but all your memories come back easily

thin hornet
#

After 6 month brake it was even easier than before

#

Brain classes the information with time so you come back, feels lost a bit but then the magic happen.

red tiger
#

Might happen again for me.

jaunty marten
#

I open vs code for gmod and tried to create ui elements via DPanel:new and couldn't get what's wrong

jaunty marten
jaunty marten
red tiger
#

Explains the emotes.

jaunty marten
#

ha-ha, yea

red tiger
#

I'm probably going job hunting for a better job when I get things together.

jaunty marten
#

I love gmod for I can override everything that I want

weary matrix
red tiger
jaunty marten
red tiger
#

Collections of primitive data type values.

#

Lua only knows what a float / number is.

jaunty marten
#

yea, there're Vector, Angle, Entity

#

and there's huge amount of premade hooks (events) for almost literaly every action love

#

idk why tis can't add much events in code. when we will in vc with aiteron he said there's some problems with performance for adding more events

red tiger
#

Love is a rare item in PZ.

#

No NPCs around to love.

jaunty marten
#

while playing I'm feels awesome

jaunty marten
red tiger
#

Haunted schools pls

jaunty marten
#

single tilting thing about b42 for me it's pipes system wtf

red tiger
#

Reinventing The Sims 1

jaunty marten
#

that was supposed to be my invention cry

regal roost
#

Hi!
I've been trying to make a mod to make bulletproof vests to hide under certain clothing that you can choose via context menu. Basically created a copy of each vest for each layer you want to use them at, assigned them to a newly created body location, and used hide model for each location accordingly. Everything is running fine, however, when assigning locations to your vest when not wearing that clothing (ie.: Wear Vests under Jacket without earing a jacket), this invisible backpack glitch occurs. Using default "vanilla" vest body location works properly. This is my first mod, I've been looking into other similar mods so I can build this one. Do anyone of you encountered this issue before?
Thanks!

weary matrix
#

if not you could probably try to ping MX or Glytch3r

regal roost
weary matrix
gilded hawk
# regal roost Hi! I've been trying to make a mod to make bulletproof vests to hide under certa...

Yes, this issue happens because the bodylocation of your new bulleproof vest is placed after the bodylocation of the Backpacks: Back
And the game has difficulties rendering items that where intended to be under a different bodylocation

You can create a bodylocation and move it under the Back using this code.

local humanGroup = BodyLocations.getGroup("Human");
local yourLocation = humanGroup:getOrCreateLocation("YOUR_LOCATION_HERE");
local list = getClassFieldVal(humanGroup, getClassField(humanGroup, 1));
list:remove(yourLocation)
local index = humanGroup:indexOf("Back") - 1;
list:add(index, yourLocation);

You could also use the transmog mod made by me, if that fits your needs.

humble raft
gilded hawk
# weary matrix oh, I like modguardian.it ๐Ÿ˜„

Check if you can use an .it domain without living in italy if you are not living there, cause some national domains will require you to live of work in the country.
But I don't remember if that applies to italy

weary matrix
gilded hawk
weary matrix
#

however, on the registrar I'm trying to use, they ask for a weird citizen code, so I'm a bit at a loss here ๐Ÿ˜…

weary matrix
#

Q: Who can register a .it domain?
A: The registration of a domain name in the ccTLD .it is permitted only to persons who have citizenship, residence or a registered office in the countries of the European Economic Area (EEA), the Vatican City State, the Republic of San Marino, the Swiss Confederation and in the United Kingdom.

weary matrix
gilded hawk
weary matrix
#

yeah

#

do you know about it?

gilded hawk
#

Yeah, it's an ID on the Italian "health insurance card"

weary matrix
#

hum

gilded hawk
#

Look for a different domain register that does not ask for it

weary matrix
#

so my social security number should be accepted?

gilded hawk
#

I don't think so ๐Ÿ˜…

#

But try ๐Ÿคทโ€โ™‚๏ธ

weary matrix
#

yeah well not sure it will help to add random information in there

gilded hawk
#

Maybe ๐Ÿ‘€

weary matrix
#

looks like it's accepting my SSN

#

๐Ÿฅณ

gilded hawk
#

Nice!

weary matrix
#

never seen a domain so cheap

gilded hawk
#

from where? ๐Ÿ‘€

#

I was actually looking for some cheap domains

weary matrix
#

I computed the price over 10 years of many registrar, this one is 66.5โ‚ฌ, the cheapest after this one is 87โ‚ฌ

weary matrix
#

I'm kidding of course, but the website is really great

gilded hawk
weary matrix
#

my stomach doesn't like .gif ๐Ÿ˜‚

gilded hawk
#

OOOOOF .gg domains are so fucking expensive ๐Ÿ˜ฆ

weary matrix
#

ah yeah

#

I suspect discord bought the .gg tld

#

and they're making $$$ selling .gg domains

gilded hawk
#

Ah goddamit ๐Ÿ˜ฆ

weary matrix
#

maybe they didn't but at minimum they're responsible for the expensive price

gilded hawk
#

Yeah that for sure

regal roost
# gilded hawk Yes, this issue happens because the bodylocation of your new bulleproof vest is ...

wow, thanks!
this code worked flawlessly!

Since I have 2 more bodylocations I did some adaptations. I have no knowledge of lua, just a bit of javascript for processing, but it seems to work properly.

local locationList = {"TorsoExtraVestUnderJ","TorsoExtraVestUnderJS","TorsoExtraVestUnderJSS"}
local arraylength = #(locationList)
local yourLocation;
local list = getClassFieldVal(humanGroup, getClassField(humanGroup, 1));

for i = 1, arraylength, 1
    do    
        yourLocation = humanGroup:getOrCreateLocation(locationList[i]);
        list:remove(yourLocation)
        local index = humanGroup:indexOf("Back") - 1;
        list:add(index, yourLocation);
end```

many thanks!
gilded hawk
drifting ore
#

Say, what's the difference between the items and the junk?

nimble spoke
#

Junk only spawns when items doesnt fill the container

#

Also, items spawn chance is affected by zombie population in the area and junk isnt

drifting ore
#

Ah. So what defines whether a container is filled? If it gets at least a single item from the items pull then does that count as filled?

trim mist
#

Hmm... can anyone tell me why EveryHours() runs when the mod is being initialized on the mod screen, and how I could fix this error?

#

player is nil but getActiveNumPlayers gets 1.... soooo

bronze yoke
#

that doesn't seem possible...?

#

but it also doesn't seem possible for you to be mistaken here ๐Ÿ˜…

nimble spoke
trim mist
#

Oh no, i've stumped albion :S

#

my mod is unrecoverably broken lmao

bronze yoke
#

well you know i've done my research on events

#

everyhours shouldn't be able to be called early since the object it's called by shouldn't even exist, let alone be simulating

#

any other mods active? is there a chance some crazy mod is triggering the event?

trim mist
#

oop--

#

๐ŸŽต one of these things is not like the other ๐ŸŽต

bronze yoke
#

uh oh!

#

at least it was simple

#

i wonder why getNumActivePlayers passes

trim mist
#

yeah it works now... thank you albion lmao

bronze yoke
#

public static int numPlayers = 1; well that was a shockingly quick answer

trim mist
#

what

#

tell me that increases when other people join

bronze yoke
#

oh this is so much worse than i thought

#

numPlayers does not count the number of players

trim mist
#

what

bronze yoke
#

(when adding a new player)
IsoPlayer.numPlayers = Math.max(IsoPlayer.numPlayers, playerNum + 1);

#

it is equal to the highest active player number

#

i see no handling for when a player stops playing

#

i guess that does mean it's actually more useful than i thought, but the name is completely misleading

trim mist
#

is this why there's a getNumActivePlayers?

#

or does that return num players?

bronze yoke
#

yeah, that's the name of the getter for that

trim mist
#

yikies

dawn pagoda
#

Is it normal for items like TVs and Tables to have different amounts of HP? They're all 100 right.

weary matrix
#

@gilded hawk found a domain that suits you? ๐Ÿ˜„

#

@nimble spoke hi, can I talk to you in private please?

nimble spoke
weary matrix
#

thx

proven bough
#

Does anyone know what kind of function or statement I would need to use to say "if you have these mods enabled, include these items, if not, don't do anything"? I'll include a snippet of the code I'm working with in hopes that someone can try and help me figure this out

function Recipe.OnCreate.OpenRareLootBox(items, result, player)
    rweap = {"Base.LeadPipe", "Base.Nightstick", "Base.MetalBar", "Base.Axe", "Base.PickAxe"};
    rsup = {"Base.Bandaid", "Base.Bandage", "Base.Disinfectant", "Base.HandTorch"};
    rarebox1 = rweap[ZombRand(5) +1]
    rarebox2 = rsup[ZombRand(4) +1]
    rarebox3 = rsup[ZombRand(4) +1]
    player: getInventory():AddItem(rarebox1);
    player: getInventory():AddItem(rarebox2);
    player: getInventory():AddItem(rarebox3);
end

So I'm trying to add modded items into my loot box, and I'm trying to make it compatible with BGCTools/Rare Weapons and Shark's Weapon Pack, but I'm unsure how to implement what I want to do. I basically want to say "if you have those mods enabled, add these certain weapons to the rweap category, and if not, don't add them.

thin hornet
proven bough
thin hornet
# proven bough Thank you. I'm guessing I would need to include this at the very top of the code...

Something like that would work yeah

local isMyOtherModActive = getActivatedMods():contains("MyOtherMod")

function Recipe.OnCreate.OpenRareLootBox(items, result, player)
    rweap = {"Base.LeadPipe", "Base.Nightstick", "Base.MetalBar", "Base.Axe", "Base.PickAxe"};
    rsup = {"Base.Bandaid", "Base.Bandage", "Base.Disinfectant", "Base.HandTorch"};
    rarebox1 = rweap[ZombRand(5) +1]
    rarebox2 = rsup[ZombRand(4) +1]
    rarebox3 = rsup[ZombRand(4) +1]
    if isMyOtherModActive then player: getInventory():AddItem(rarebox1); end
    player: getInventory():AddItem(rarebox2);
    player: getInventory():AddItem(rarebox3);
end
proven bough
# thin hornet Something like that would work yeah ```lua local isMyOtherModActive = getActivat...

Would this work? Apologies for constant clarification, I'm really new to this whole coding thing ๐Ÿฅฒ

local isMyOtherModActive = getActivatedMods():contains("BCGTools")

function Recipe.OnCreate.OpenRareLootBox(items, result, player)
    rweap = {"Base.LeadPipe", "Base.Nightstick", "Base.MetalBar", "Base.Axe", "Base.PickAxe"};
    rsup = {"Base.Bandaid", "Base.Bandage", "Base.Disinfectant", "Base.HandTorch"};
    rarebox1 = rweap[ZombRand(5) +1]
    rarebox2 = rsup[ZombRand(4) +1]
    rarebox3 = rsup[ZombRand(4) +1]
    if isMyOtherModActive then
    rweap = {"BCGTools.HandHatchet", "BCGTools.SplittingAxe", "BCGTools.CheapSurvivalKnife", "Base.LeadPipe", "Base.Nightstick", "Base.MetalBar", "Base.Axe", "Base.PickAxe"};
    rarebox1 = rweap[ZombRand(8) +1]
    end
    player: getInventory():AddItem(rarebox1);
    player: getInventory():AddItem(rarebox2);
    player: getInventory():AddItem(rarebox3);
end
#

Also, if that is correct, would I have to do that for each individual mod compat? or is there a way to set up the getactivatedmods to do multiple things at once and say "if this, this, and/or this are active, then add these things"

bronze yoke
#
local activatedMods = getActivatedMods()
local isMyOtherModActive = activatedMods:contains("Mod1") and activatedMods:contains("Mod2") or activatedMods:contains("Mod3")
#

varying based on the exact combinations you want of course

thin hornet
proven bough
#

Right, so I can technically forgo specifying an exact amount of items, and just do #rweap and it'll automatically read the amount of items I have listed there?

bronze yoke
#

ZombRand(#rweap) + 1 or else it can roll zero

thin hornet
#

@proven bough So this way would be the cleanest i can think of right now.

--- check if other mod is active
local isBCGToolsActive = getActivatedMods():contains("BCGTools")

--- insert as many item to the table of your choice
local function insertMany(_table, ...)
  for i, v in ipairs({...}) do
    table.insert(_table, v)
  end
end

--- this one must be global as this will be called by the recipe script
function Recipe.OnCreate.OpenRareLootBox(items, result, player)
    --- Create listing that doesn't require mods
    local rweap = {"Base.LeadPipe", "Base.Nightstick", "Base.MetalBar", "Base.Axe", "Base.PickAxe"};
    local rsup = {"Base.Bandaid", "Base.Bandage", "Base.Disinfectant", "Base.HandTorch"};

    --- If the mod is active add the items to the list
    if isBCGToolsActive then
      insertMany(rweap, "BCGTools.HandHatchet", "BCGTools.SplittingAxe", "BCGTools.CheapSurvivalKnife")
    end

    --- Picks items based on the table lenght using #tableName
    local rarebox1 = rweap[ZombRand(#rweap) +1]
    local rarebox2 = rsup[ZombRand(#rsup) +1]
    local rarebox3 = rsup[ZombRand(#rsup) +1]

    --- Add the 3 random items
    player:getInventory():AddItem(rarebox1);
    player:getInventory():AddItem(rarebox2);
    player:getInventory():AddItem(rarebox3);
end

I see that your variable inside the function where not using local so they where global variables polluting the global scope. Just remember to add local if it is local to this function/file only.

proven bough
fathom dust
#

Is there a way to increase the width of the debug window in the upper right that shows the code? It's too short and there is no horizontal scrollbar

thin hornet
fathom dust
#

ah so mod the debug window lol

mellow frigate
fathom dust
#

how do i turn break on error back on after turning it off? i can't figure out how to manually open the screen where it appears

fathom dust
#

ty

#

the vehicle id for a given vehicle seems to change with each save game load, is where a consistent way to identify a vehicle across save loads? currently using vehicle:getID()

bronze yoke
#

i think getId() is persistent? (lowercase d)

#

lowercase is vehicle id, uppercase is object id

#

ooh maybe getSqlId(), that would *have* to be persistent

#

and the fact that it's separate from getId() makes me think that one isn't

trim mist
#

@bronze yoke I'm hoping to get a little clarification here

bronze yoke
#

oh?

trim mist
#

it dun like it. Is the arrow casting the item as an item?

bronze yoke
#

getItem wants the type of the item, not an item object

#

you can use shoes:getScriptItem() instead

#

and the arrows were just my way of showing that those two functions returned different things, i've been writing a lot of python and it's the return type annotation for a function there

trim mist
#

this works, thank you

#

in other news

#

I thought stoppower was the same as STOMP power. I've seen spelling mistakes that are more or less the same so far in the codebase haha

#

however it is private. that might be an issue

bronze yoke
#

hmm yeah, might need an instance then :(

trim mist
#

will I be able to get the right name to get a new instance if I wrap "shoes" in a "tostring()"?

bronze yoke
#

that will just get you the script item

trim mist
bronze yoke
#

though you'd need to use :getFullType()

#

to make a new instance i'd do InventoryItemFactory.CreateItem(shoes:getFullType())

trim mist
#

there's an INVENTORYITEMFACTORY?! dang okay, that's useful to know

#

thank you

bronze yoke
#

ideally you wouldn't make a new InventoryItem, it's totally a waste, but it doesn't seem accessible on the script so oh well

trim mist
#

ooh... this is a doozy

bronze yoke
#

any issues?

trim mist
#

yep--

#

for some reason taking off my characters shoes is resulting in... a _call variable not being set in a trait...?!

#

Hooking into this function was just supposed to increase the max time for some actions. I have no understanding why the stout trait would be involved here

#

I also see this in the console after getting out of the debug screen

bronze yoke
#

yeah, that's a general error, whenever something goes wrong with an action it nukes the queue

trim mist
#

there is no :create for the ISUnequipAction... no mention of stout (or any traits) in there that I can see

bronze yoke
#

if it has no create, then it's calling the base one

trim mist
bronze yoke
#

the error implies that OriginalTimedActionCreate *is* the trait

#

which clearly isn't what any of the code i can see is doing

trim mist
#

i mean

#

here's my object stack if it helps

#

the stout trait is there, for some reason, in memory

bronze yoke
#

if you comment out line 426, does the error still occur?

#

it'll break the action of course but to confirm what's going on

trim mist
#

one sec

#

ded commenting that line out crashes to main menu

#

when unequipping

#

this is line 61. So. The action itself gets really messed up haha

bronze yoke
#

ah, that must be why it has so much better error checking than literally anything else in the game

trim mist
#

okay, so. I moved line 426 down a bit and now I can do actions that aren't affected by my trait

#

I'm gonna take a wild guess and say that if I do an action that's covered by unweildy hands, it's gonna break. but maybe there'll be a more descriptive error

#
local OriginalTimedActionCreate = ISBaseTimedAction.create;
ISBaseTimedAction.create = function(self)
    OriginalTimedActionCreate(self);
    if self.character:HasTrait("AT_UnwieldyHands")
    then
        for _, action in pairs(AnthroTraitsGlobals.UnwieldyHandsAffectedTimedActions)
        do
            if self.Type == action
            then
                if getDebug()
                then
                    print("UnwieldyHands activated. Old time: "..tostring(self.maxTime).." New time: "..tostring(newTime));
                end
                local newTime = self.maxTime * (1 + SandboxVars.AnthroTraits.UnwieldyHandsTimeIncrease)
                self.maxTime = newTime;
                break;
            end
        end
    end
end
bronze yoke
#

oh, now that i think about it it might be better that your code runs before, or the max time might not get modified?

trim mist
#

for reference this is what it looks like now

#

That's an option. I can still modify it there, it's just a matter of preference I suppose

bronze yoke
#

honestly 'why is my variable becoming Stout' is a new one for me

turbid spindle
#

ok so million dollar mod idea

#

i need someone who can make it

#

totally accurate american healthcare

#

your character has an "insurance" stat that slowly drains over time, and you need to refill it with money

#

if you are uninsured for too long you lose health and die

pearl bronze
fast galleon
unborn valley
stable ether
#

Can any of the hair gurus help me? Ive been trying to make hair but the models arent showing up in-game. I followed Spongies hair mod tutorial to a T. What am I missing? I've included some pics to help

jolly breach
#

Hi everyone. Can anyone point me to a good resource of tutorials to get started in PZ modding? I've found a few different resources, but not sure which are the most up to date or most suited for a newbie.

unborn valley
stable ether
#

dont mind the dumb pic lol

bronze sand
#

You know what would be cool?
A one-time BanHammer, a Sledge Hammer that upon attacking a target banned the target and then itself (the weapon vanishes)

#

Is there a way to ban a player for like, just 30 real life minutes?

bronze sand
plain crane
#

Not sure whether I should ask this here or in mapping but I'm currently using the Louisville only map. I was hoping to modify the map and add a few cells to create custom buildings, LV being a bit too cramped to add anything of any significant size. Is that doable or will that break everything?

trim mist
#

Question for you, did you ever get this working?

tame isle
#

Hey, if I wanted to change a items base values, say dropping the capacity of backpacks, do I just make a txt file in my mods scripts folder that's named after the txt file that handles bag values and have the changed code in it?

fathom dust
#

pretty sure i have this right but just to confirm since i'm new to PZ modding, there is currently no way to extend Java classes or copy instances of Java classes, right? It's just not supported in any way, correct?

unborn valley
novel barn
# trim mist Question for you, did you ever get this working?

Not yet. I've spent all my free time since then wrapping my head around metatables, etc. But ultimately I'm confused because I don't yet understand what Trait contains. Gonna try to dump the whole object in game later and see what I get. If I get to a point where I understand what's going on I'll be sure to let you know!

#

So far I understand the point of metatables and __index but I don't yet understand what Albion is looking for

#

ATM I'm at my MIL for dinner. Gonna dive back in when I get home

prisma gale
#

Anyone had any luck getting anywhere with adding medications, seems pain system is hardcoded in

novel barn
#

Sorry I should be more clear. Albion figured it out for the above two files. I'm sure you could copy and paste it pretty easily for your own trait. I just want to figure out why it works.

ancient grail
ancient grail
red tiger
tame isle
bronze yoke
#

you can edit them but it's very bad practice to overwrite the scripts of existing items

#

it's impossible for a mod like that to be compatible with other mods that do the same thing, and if the vanilla item gets updated your mod will fall behind

#

it's very easy to do in lua instead and dodges those issues

weary matrix
#

also overwriting scripts file means you'll have to redefine all vanilla items otherwise they'll be missing and it can fuck up servers

#

(happend to me once by mistake)

mellow frigate
#

@TIS is there a way to make a camera follow another player in MP ? (a camera from a client following a player from another client, in lua)

tawdry solar
#

i would ask aitrion

#

idk if he likes being pinnged tho

proven bough
#

@thin hornet I've got this bit of code that I'm trying to optimise. You'll see what I mean when I post the code itself, but basically I'm trying to say "if this item is received, then add multiple of them". Here's the way it's been done originally, but I'm wondering if there's a better way...

    if (legendbox2 == "Base.ShotgunShellsBox" or legendbox3 == "Base.ShotgunShellsBox") then
    player: getInventory():AddItem("Base.ShotgunShellsBox");
    player: getInventory():AddItem("Base.ShotgunShellsBox");
    player: getInventory():AddItem("Base.ShotgunShellsBox");
    end
    if (legendbox2 == "Base.EngineParts" or legendbox3 == "Base.EngineParts") then
    player: getInventory():AddItem("Base.EngineParts");
    player: getInventory():AddItem("Base.EngineParts");
    player: getInventory():AddItem("Base.EngineParts");
    player: getInventory():AddItem("Base.EngineParts");
    player: getInventory():AddItem("Base.EngineParts");
    player: getInventory():AddItem("Base.EngineParts");
    player: getInventory():AddItem("Base.EngineParts");
    player: getInventory():AddItem("Base.EngineParts");
    player: getInventory():AddItem("Base.EngineParts");
    player: getInventory():AddItem("Base.EngineParts");
    end
    if (legendbox2 == "Base.SheetMetal" or legendbox3 == "Base.SheetMetal") then
    player: getInventory():AddItem("Base.SheetMetal");
    player: getInventory():AddItem("Base.SheetMetal");
    player: getInventory():AddItem("Base.SheetMetal");
    player: getInventory():AddItem("Base.SheetMetal");
    player: getInventory():AddItem("Base.SheetMetal");
    player: getInventory():AddItem("Base.SheetMetal");
    end
bronze yoke
#

there's an AddItems e.g. AddItems("Base.ShotgunShellsBox", 3)

proven bough
#

Ahhhh I seeeee. So basically all I would need to do is

if (legendbox2 == "Base.ShotgunShellsBox" or legendbox3 == "Base.ShotgunShellsBox") then
AddItems("Base.ShotgunShellsBox", 3)
end
bronze yoke
#

you'd still need to do player:getInventory():AddItems, but yeah

proven bough
#

Ah right. So I'm guessing the AddItems part would go...after the getInventory?

bronze yoke
#

also, if you cache the inventory at the start local inventory = player:getInventory() then you can just do inventory:AddItems("Base.ShotgunShellsBox", 3) it'll look cleaner and run a bit faster

trim mist
#

Well, here's the first version of my furry traits mod!

#

If anyone has some tips on making the page look better, please let me know.
Also, I tried to post a link to my ko-fi in there and steam thinks it's malicious. I've seen other modders put their ko-fi's down--what am I missing?

trim mist
#

About the ko-fi link, there was an errant quote in the url. oops

pliant yarrow
#

I'm almost done with my mod but I've hit another point where I don't know what I'm doing or doing wrong. I'm trying to make an emote make that emote reduce stress. I can make an option appear on the emote radial menu, but no matter what I do I can't make any emotes play in game from it. Looking at other emote mods they seem to pretty much just add the emote to the radial menu, add the anim and xml so I don't know what's missing. SilvShy

pliant yarrow
#

Yes I have an xml file. For testing I was trying to use an emote and xml file already from in the game renamed and edited to match the new name

woven brook
#

is onplayercreated called every load or just initial creation?

pliant yarrow
pliant yarrow
#

Ah, okay

fast galleon
fast galleon
#

Anyway, search for link to Umbrella and Events files from Albion.

red tiger
#

@woven brook @fast galleon

woven brook
#

Is there a vscode extension?

#

Or only intellij

woven brook
#

Said it from memory

#

3 am here just finished handling a 100 player server for4 hours

#

Only admin ๐Ÿ’€

red tiger
#

Lua language server extension on vscode. EmmyLua on IDEA

woven brook
#

Ok ty

red tiger
#

If I could get a microphone I could record a tutorial for setting up environments for modding PZ.

#

Eventually want to do that for java mods.

#

Wishful thinking.

pliant yarrow
#

I'm having a problem now where the game is not recognizing the clap emote. I have no mods active, files validated, fresh install, don't know what the problem is. SilvLurk

fast galleon
pliant yarrow
#

The animation isn't playing though

#

Clap02 will play