#mod_development

1 messages ยท Page 503 of 1

teal slate
#

Yeah, no, it uses generics

#

Not subclasses

#

So it's an instance of Class<InventoryItem>, and getClass() on that is just Class.

weary matrix
#

writing some java code to prove you wrong ๐Ÿ˜‚

#

@teal slate so if you compile this:

import java.lang.reflect.Method;

public class Test {

    public int someMethod() {
        return 0;
    }

    public static void main(String[] args) throws Exception {
        Test test = new Test();
        Method[] methods = test.getClass().getDeclaredMethods();
        for (Method method : methods) {
            System.out.println(method);
        }
    }
}
``` and run it, it prints this:
```$ java Test 
public static void Test.main(java.lang.String[]) throws java.lang.Exception
public int Test.someMethod()
teal slate
#

that's not what I'm doing, though

#

oh wait

#

public class Test

#

yeah, but

#

that's because you made a subtype of class

#

try it with Test as an object

weary matrix
#
        Test test = new Test();
        Method[] methods = test.getClass().getDeclaredMethods();```
teal slate
#

public class Test

weary matrix
#

so what?

#

in LuaManager it's the same:

        @LuaMethod(name = "getClassFunction", global = true)
        public static Method getClassFunction(Object object, int int1) {
            Method method = object.getClass().getDeclaredMethods()[int1];
            return method;
        }
#

InventoryItem is declared as a class too?

#

I mean it is a class, the same way my Test class is

teal slate
#

wait

#

aghhh i'm

#

i haven't slept

#

:)

#

yeah, i'm silly

#

it won't work, darn

#

though, wait

#

Method[] methods = test.getClass().getDeclaredMethods();

#

what i'm doing is effectively equivalent to Method[] methods = test.getClass().getClass().getDeclaredMethods();

#

try that @weary matrix

weary matrix
#

sure

#

hold on

#

ok this one indeed returns the method from Class

#

because you're getting the superclass of Class<Test> which is Class<Class> or just Class

#

but from Lua I presume you'd need the class Class to be exposed right?

teal slate
#

I don't think so!

#

Because we never pass Class around.

weary matrix
#

how do you get a reference to the super class of Class<Clothing>?

teal slate
#

Rather, we don't manipulate the userdata in Lua at all. We just pass the userdata between various Java functions.

#

Not being exposed doesn't mean we can't access the class; it just means it doesn't have a metatable set.

weary matrix
#

yes, so how would you get access to the methods of Class?

teal slate
#

Via getClassFunction, which is a global function in Lua.

#

If we can't call a Method directly, well... it was worth a shot!

weary matrix
#

but the getClassFunction() is doing the same as the Test example I showed you, so it wouldn't allow us to get reference to the methods of Class

weary matrix
#

it would only give access to the method of InventoryItem

teal slate
#

InventoryItem.class is equivalent to getClass() on an InventoryItem.

#

And getClassFunction calls getClass() on the object passed, so it's basically inventoryItem.getClass().getClass().getDeclaredMethods()

weary matrix
#

it is, but it will return a Class<InventoryItem> not a class, the same way my test.getClass() returns Class<Test> not class

teal slate
#

no, that's what InventoryItem.class is

#

that's Class<InventoryItem>

#

calling getClass() on Class<InventoryItem> will just give Class

weary matrix
#

@teal slate what's the difference between getClassFunction and this:

    public static void main(String[] args) throws Exception {
        Test test = new Test();
        Method[] methods = test.getClass().getDeclaredMethods();
        for (Method method : methods) {
            System.out.println(method);
        }
    }
}
teal slate
#

Nothing, that should work

weary matrix
#

no

teal slate
#

oh you edited it

weary matrix
#

as I showed you it only prints the methods from the class Test

teal slate
#

like I said, test is an object

weary matrix
#

yeah I copy pasted the last version by mistake

teal slate
#

do getClass().getClass()

#

like

#

the difference is in what yo're passing

weary matrix
#

but you can't call getClass().getClass() with the method getClassFunction:

        @LuaMethod(name = "getClassFunction", global = true)
        public static Method getClassFunction(Object object, int int1) {
            Method method = object.getClass().getDeclaredMethods()[int1];
            return method;
        }
teal slate
#
    public static void main(String[] args) throws Exception {
        Test test = new Test();
        listClassFunctions(test);
        listClassFunctions(test.getClass());
    }

    public static void listClassFunctions(Object obj)
    {
        Method[] methods = obj.getClass().getDeclaredMethods();
        for (Method method : methods) {
            System.out.println(method);
        }
    }
teal slate
#

we're not passing an InventoryItem instance

#

we're passing Class<InventoryItem>

#

(which is what the Lua variable InventoryItem.class is)

weary matrix
#

no ๐Ÿ˜‚

#

let me show you

#

@teal slate ```java
import java.lang.reflect.Method;

public class Test {

public int someMethod() {
    return 0;
}

public static void listClassFunctions(Object obj) {
    Method[] methods = obj.getClass().getDeclaredMethods();
    for (Method method : methods) {
        System.out.println(method);
    }
}

public static void main(String[] args) throws Exception {
    Test test = new Test();
    listClassFunctions(test);
}

}

$ javac Test.java
$ java Test
public static void Test.main(java.lang.String[]) throws java.lang.Exception
public static void Test.listClassFunctions(java.lang.Object)
public int Test.someMethod()

teal slate
#

you're creating a new Test

#

InventoryItem.class is equivalent to (new InventoryItem).getClass()

#

which is Class<InventoryItem>

#

then we do getNumClassFunctions(InventoryItem.class)

#

which calls getClass() on Class<InventoryItem>

#

which returns Class.

weary matrix
#

ah now I see what you mean ๐Ÿ˜‚

#

sorry

teal slate
#

It's fine, I was having a little trouble understanding myself until I sat down and put it all together

#

This is why you don't not sleep and code

weary matrix
#

so let's assume we can get all the method of Class with this:

local Class = {}
for i=0, getNumClassFunctions(InventoryItem.class) - 1 do -- any class would work
    local func = getClassFunction(InventoryItem.class, i)
    Class[func:getName()] = func
end```
How would you pass the instance on which to call Class.cast()?
weary matrix
teal slate
#

I'm not 100% sure if you can call Methods from Lua like this, but it's worth a shot

weary matrix
#

but Class.cast() only takes on argument not two

#

I mean Class.cast() is not a static method from Class

teal slate
#

Exactly.

#

Instance methods in lua take the first argument as the instance to run it on.

weary matrix
#

aah ok

#

hmm let's try it

teal slate
#

So instead of instance.instanceMethod(), you'd use instance:instanceMethod(), which is syntactic sugar for instance.instanceMethod(instance)

weary matrix
#

so this is what you mean right?

    local Class = {}
    for i=0, getNumClassFunctions(InventoryItem.class) - 1 do -- any class would work
        local func = getClassFunction(InventoryItem.class, i)
        Class[func:getName()] = func
    end

    for k = 0, items:size() - 1 do

        local item = items:get(k)
        local superclass = Class.getSuperclass(InventoryItem.class, item)
        local test = Class.cast(superclass, item)
        print('DEBUG')
        print(test)
#

hmmm
Exception thrown java.lang.RuntimeException: Object public native java.lang.Class java.lang.Class.getSuperclass() did not have __call metatable set at KahluaUtil.fail line:82.

#

guess I have to call metatable() and declare a __call method but not sure how

#

I really suck at Lua

teal slate
#

Are you running it in debug mode?

#

Oh, wait. Might be a special way to invoke Methods

weary matrix
#

yes with debug mode

#

shouldn't I?

teal slate
#

You should, yeah

#

I'll look into the methods thing in a bit

#

Aha, it's invoke

#

Class.getSuperclass.invoke(InventoryItem.class)

#

Class.cast.invoke(superclass, item)

weary matrix
#

interesting, I think the call for getSuperclass is working, if I do this: Class.getSuperclass:invoke(InventoryItem.class), but then getting an error on the cast

#

got an error but no exception

#

trying again with a fresh start

#

damn

#
        local superclass = Class.getSuperclass:invoke(InventoryItem.class)
        local test = Class.cast:invoke(superclass, item)
``` is giving me just this error, but no real stack trace ๐Ÿ˜ฆ
```LOG  : General     , 1640787205601> creating new sourcewindow: /home/co/Zomboid/mods/ModHack/media/lua/client/ModHack/StatsWindow.lua
LOG  : General     , 1640787219094> -----------------------------------------
STACK TRACE
-----------------------------------------
Callframe at: invoke
function: onKeyPressed -- file: StatsWindow.lua line # 188
function: OnKeyPressed -- file: StatsWindow.lua line # 103

LOG  : General     , 1640787219095> 
teal slate
#

not :

#

wait

#

yeah, not colon

weary matrix
#

if I don't use the : syntax, then I'm getting this:


    at se.krka.kahlua.integration.expose.MethodArguments.assertValid(MethodArguments.java:123)
    at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:186)
    at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:182)
    at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:1007)
    at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
    at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1812)
    at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66)
    at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139)
    at zombie.Lua.Event.trigger(Event.java:64)
    at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:88)
    at zombie.input.GameKeyboard.update(GameKeyboard.java:65)
    at zombie.GameWindow.logic(GameWindow.java:240)
    at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    at zombie.GameWindow.frameStep(GameWindow.java:745)
    at zombie.GameWindow.run_ez(GameWindow.java:661)
    at zombie.GameWindow.mainThread(GameWindow.java:475)
    at java.base/java.lang.Thread.run(Unknown Source)
LOG  : General     , 1640787058708> -----------------------------------------
STACK TRACE
-----------------------------------------
Callframe at: invoke
function: onKeyPressed -- file: StatsWindow.lua line # 188
function: OnKeyPressed -- file: StatsWindow.lua line # 103
teal slate
#

oh wait wait

#

Class.cast.invoke(superclass, superclass, item)

#

try that?

#

that or

#

Class.cast.invoke(InventoryItem.class, superclass, item)

#
    local Class = {}
    for i=0, getNumClassFunctions(InventoryItem.class) - 1 do -- any class would work
        local func = getClassFunction(InventoryItem.class, i)
        Class[func:getName()] = func
    end

also this bit can be put anywhere in your code, ideally it would only be run once

#

(*ideally-*ideally none of this would be necessary)

weary matrix
#

hmm but cast() only takes one argument, two if you count the object receiving the call

#

how could it work with 3 arguments?

#

mmm maybe I don't need to call getSuperclass() at all actually

teal slate
#
            if (self == null || !clazz.isInstance(self)) {
                methodArguments.fail(syntaxErrorMessage("Expected a method call but got a function call."));
                return methodArguments;
            }
#

maybe

#

... oh wait

#

yeah, we're

#

casting to InventoryItem, aren't we

#

:P

weary matrix
#

yes

teal slate
#

Class.cast.invoke(InventoryItem.class, item)

weary matrix
#

yeah

#

except with the : instead of .

teal slate
#

Class.getSuperclass:invoke(InventoryItem.class) oh this is why i think

#

no, you can't use :

weary matrix
#

doesn't work if I dont

teal slate
#

wait

#

oh yeah no i'm silly

#

yes, :

weary matrix
#

damn, same thing ๐Ÿ˜ข

#
LOG  : General     , 1640787622876> -----------------------------------------
STACK TRACE
-----------------------------------------
Callframe at: invoke
function: onKeyPressed -- file: StatsWindow.lua line # 188
function: OnKeyPressed -- file: StatsWindow.lua line # 103

LOG  : General     , 1640787622876> 
#

it's weird cause it seem I can cal getSuperclass() but not cast()

#

not sure what's the difference

teal slate
#

what does getSuperclass() return?

#

try printing it

#

Class.cast:invoke(InventoryItem.class, item) ought to work fine

weary matrix
#
LOG  : General     , 1640787898375> class java.lang.Object
#

mmm wait I had something funky, hold on

#

mmm no same thing ๐Ÿ˜ข

#
LOG  : General     , 1640788044745> class java.lang.Object
LOG  : General     , 1640788044817> creating new sourcewindow: ~/Zomboid/mods/ModHack/media/lua/client/ModHack/StatsWindow.lua
LOG  : General     , 1640788050095> -----------------------------------------
STACK TRACE
-----------------------------------------
Callframe at: invoke
function: onKeyPressed -- file: StatsWindow.lua line # 176
function: OnKeyPressed -- file: StatsWindow.lua line # 103

LOG  : General     , 1640788050095> 
#

with this code:

    local Class = {}

    for i=0, getNumClassFunctions(InventoryItem.class) - 1 do -- any class would work
        local func = getClassFunction(InventoryItem.class, i)

        Class[func:getName()] = func
    end

    for k = 0, items:size() - 1 do

        local item = items:get(k)
        local superclass = Class.getSuperclass:invoke(InventoryItem.class)
        print('SUPERCLASS')
        print(superclass)
        local test = Class.cast:invoke(InventoryItem.class, item)
        print('DEBUG')
        print(test)
#

same thing as when I pass the superclass variable to cast()

#

mmm

#

but so that means InventoryItem.class.getSuperclass()is Object not Class? ๐Ÿ˜ฎ

drifting ore
#

OnZombieSpawn event?

weary matrix
drifting ore
#

OnZombieUpdate is a loop no?

weary matrix
#

it is

weary matrix
# drifting ore OnZombieUpdate is a loop no?

but you can do something like this:

zombies = {}
function OnZombieUpdate(zombie)
    if not zombies[zombie] then
        zombies[zombie] = true
        -- you got a spawned zombie here
    end
end```
#

not sure that would work depending what you're trying to achieve though

random token
#

Anyone know if it's possible to "add" a mesh to another with a mod? I want to create a mod that allows players to reinforce cars with metal plates mad max style.

#

I should probably start by adding a new car of some sort I guess and work my way up from there.

weary matrix
#

and I definitely want mad max style cars !!!! ๐Ÿ˜„ ๐Ÿ˜„ ๐Ÿ˜„

#

also protection for the tires please! ๐Ÿ˜‚

random token
#

is there a way to download workshop mods and just get the files?

#

rather than having to go digging into my folders

random token
weary matrix
#

anything to get mad max cars really ๐Ÿ˜‚

#

maybe @hollow shadow knows

teal slate
random token
weary matrix
teal slate
#

oh i'm just making a joke about kahlua making some

weary matrix
teal slate
#

questionable choices :P

weary matrix
#

cause the generics are "erased" at compile time, they're just here to let the compiler check for type safety

#

and the super class of Class<T> is Object anyway

teal slate
#

hmmmmmmmmm

random token
winged lotus
#

Hey @weary matrix you seems pretty much skilled with modData manipulation, I was wondering, how can I add modData to some IsoObject?

This crashed for me โคต๏ธ

for i=0,sq:getObjects():size()-1 do
    ...
    local tileIsoObject = sq:getObjects():get(i);
    ...
    local modData = tileIsoObject:getModData():getOrCreate('BarricadedWorld')
weary matrix
weary matrix
#

getOrCreate is static IIRC

glass rampart
#

hey, is there any guide or some info on how ZombiesZoneDefinition works?

weary matrix
glass rampart
#

sigh i see, ty any way

weary matrix
glass rampart
#

well it is sort of understandable how it is working, im digging rn through one of the mods to find out how where is object that he adds

#

i mean like ZombiesZoneDefinition.Police = { Leon = { name="Leon", chance=20, gender="male", beardStyles="null:80", }, Jillstars = { name="Jillstars", chance=20, gender="female", },

#

so basically this author set obj leon and it should have its own items correct?

weary matrix
#

i guess

glass rampart
#

but where did he defined this items i cant find

#

well at least this is what i am trying to figure out

weary matrix
glass rampart
#

yes

random token
#

Found a bumper model that looks pretty good:

#

that's the 92 prelude model from a pz mod

winged lotus
# weary matrix try this maybe? ```lua local modData = tileIsoObject:getModData().getOrCreate('...

Good point, I always get confused by these things! However the crash persists, from my experiments, tileIsoObject:getModData() returns a table but running .getOrCreate('BarricadedWorld') on it triggers a crash ๐Ÿค”

local modData = tileIsoObject:getModData()
if modData then
local myModData = modData.getOrCreate('BarricadedWorld') <--- Crash here
end

Crash message is Object tried to call nil

weary matrix
#

mmm weird

weary matrix
weary matrix
#

@glass rampart so IsoZombie.DoZombieInventory has this code:

                this.getInventory().removeAllItems();
                this.getInventory().setSourceGrid(this.getCurrentSquare());
                this.wornItems.setFromItemVisuals(this.itemVisuals);
                this.wornItems.addItemsToItemContainer(this.getInventory());
                InventoryItem inventoryItem;
                for (int int1 = 0; int1 < this.attachedItems.size(); ++int1) {
                    AttachedItem attachedItem = this.attachedItems.get(int1);
                    inventoryItem = attachedItem.getItem();
                    if (!this.getInventory().contains(inventoryItem)) {
                        inventoryItem.setContainer(this.getInventory());
                        this.getInventory().getItems().add(inventoryItem);
                    }
                }
``` but not reallly sure that's helpful
#

guess te magic lies within those lines:

                this.wornItems.setFromItemVisuals(this.itemVisuals);
                this.wornItems.addItemsToItemContainer(this.getInventory());```
glass rampart
#

hmm...

winged lotus
weary matrix
#

but still it's weird that you can't call getOrCreate :/

winged lotus
#

Becauuuuuse I have not thought about it and copied the naming pattern from fence code ๐Ÿ˜…

weary matrix
#

hehe

random token
#

Looks like the devs were actually planning on adding car modifications at some point: https://projectzomboid.com/blog/news/2018/09/beeverdoid/

Hey all, Thursday greetings. IWBUMS BETA 40.14 RELEASED Weโ€™ve just released IWBUMS beta 40.14, which is another release thatโ€™s primarily fix and polish โ€“ our current aim for the devs working on this build being to make lots of quality of life corrections and adjustments while Turbo finishes his weather/climate work and the version can [โ€ฆ]

weary matrix
#

well what I showed is easier for my eyes to parse, but only because I'm used to it I guess

winged lotus
#

Did not thought this little erosion extension mod would interest so much people so I am trying to polish it a little more!

weary matrix
winged lotus
#

Actually I do Events.LoadGridsquare.Add(PlaceWindowsBaricades.loadGridsquare);

weary matrix
#

ah my bad

winged lotus
#

So performance wise this force me to be really straight to the point in the code and don't get me started with prints inside this kind of functions, it takes forever so much harder to debug, need to be cautious with performance... Challenging dev it is!

glass rampart
#

@weary matrix man i think you should get paid for your work, i mean every time i open this ch you always answering some questions or helping ppl, and from my personal experience i know how hard it can be some times!
any way ty for help! and great job on making this ch better and more friendlier ๐Ÿ™‚

weary matrix
#

also you should tell that to TIS ๐Ÿ˜‚

#

never seen a community with everyone so nice actually

supple briar
weary matrix
#

@winged lotus mmm I'm thinking maybe at the time LoadGridsquare is square, ModData might not have been initialized yet? Not sure. What are you doing in this handler?

glass rampart
# weary matrix aawww thank you man, feels good to hear โค๏ธ

some ppl just forget to say simple "thank you" after they receive help and it is kind of demoralizing in some way, and simple "thank you" can make you feel much better and feel that you have not spend your time in vain, ppl tends to forget that to help some one you need to spend your own time and brain power!

#

and btw i found what i was looking for, it was in xml file ... i dunno why did i miss it srsly

weary matrix
#

it is true

weary matrix
glass rampart
#

well i think i have not explain properly what i was looking for in the first place

random token
glass rampart
#

i wanted properties of object (items that can be spawned on it) not how the spawn works

weary matrix
glass rampart
#

thanks!

orchid bane
#

hi guys sorry to bother but I am trying to learn how to mod and have a question: I was reading some codes from mods and was wondering how many times does a function registered on the event Event.OnPlayerUpdate is called per second

weary matrix
#

hehe ๐Ÿ‘

winged lotus
weary matrix
orchid bane
weary matrix
#

yeah

weary matrix
weary matrix
winged lotus
#

Smart! I'll see how I could to that

orchid bane
# weary matrix yeah

but is there like a standard tick rate? or that should not be used to count time passed for example? and TY very much @weary matrix for the swift reply

weary matrix
# winged lotus Smart! I'll see how I could to that

something like this maybe?:

local allWindows = {}
function LoadGridsquare(square)
    if square:hasWindowOrWindowFrame() then
        local key = square:getX() .. 'x' .. square:getY()
        allWindows[key] = true
    end
end```
weary matrix
#

like store the return value once, and at a later time you call getGameTime.getTimeOfDay() again and compute the difference to see how much time has passed?

orchid bane
#

oh ok I see, so the OnPlayerUpdate is called several times per real second and if it is something the is related to game time it is a better if i use those functions since it saves time for cpu. Is that correct?

weary matrix
#

depends if you need in-game time or real-time

orchid bane
#

TY so much for all the help, You are AWESOME @weary matrix ๐Ÿ‘

weary matrix
#

๐Ÿ˜„

brittle jewel
#

Has anyone previously run into this error with sendServerCommand? It seems you can't save the player at all, but I would like to specifically filter out the player who sent the command. I can get around this by sending the player's online ID, and then getting the player by online ID, but I would rather skip that and pass the player if possible.
ERROR: sendServerCommand: can't save key,value=playerShooting,zombie.characters.IsoPlayer@120df990

local args = {handWeaponSoundRadius = args.handWeaponSoundRadius, playerShooting = player}
sendServerCommand('DeafFromGuns', 'toclient', args) --send command to client
#

I know there's also sendServerCommand() with player as the first argument, but that seems to only call the command on that client, rather than pass the player at all.

#

On the plus side, there's quite a few ways to work around this.

quasi geode
#

not possible. it converts the args into a binary representation of a kahlua table. the only accepted values are bool, numbers, strings and additional tables

weary matrix
#

@brittle jewel ```java
while (kahluaTableIterator.advance()) {
if (!TableNetworkUtils.canSave(kahluaTableIterator.getKey(), kahluaTableIterator.getValue())) {
Object object = kahluaTableIterator.getKey();
DebugLog.log("ERROR: sendServerCommand: can't save key,value=" + object + "," + kahluaTableIterator.getValue());
}
}

brittle jewel
#

Ahh okay, thanks!

drifting ore
#

Hi, I have a timedactions which is taking too long because the player is injured and tired. Is there a way to speed it up, just this one?

#

I call the timedactions from lua

weary matrix
#

not working?

drifting ore
weary matrix
drifting ore
winged lotus
#

Is it me that don't know where to search or do we have very little access to erosion data / functions in lua? Also a more global question, when you need to know what you have access to, do you search in the online javadoc or in lua game files?

novel obsidian
weary matrix
#

@drifting ore why is hooking :new not good then?

weary matrix
#

javadoc is useful but doesn't really help understand how the stuff work

quasi geode
#

actually maybe not the IsoDirections (edit: nope..they're fine)

weary matrix
winged lotus
weary matrix
#

you have to decompile

winged lotus
#

Wow there's a tool for that? Thanks for the link ๐Ÿ™

hollow shadow
#

anyone know how i can get a custom amount of metalworking xp?

#

currently there is only for 10, 20, etc

#

but i want 1, 2, 4, 5, 15 etc

weary matrix
gritty sierra
#

Hello! If I made a map, with x cells, then uploaded that map, and played on it for a while. Then later added new cells, not replacing any, would that corrupt the save, or would it continue working as normal? Thanks

weary matrix
drifting ore
hollow shadow
#

i just want a custom amount of metalworking XP xD

#

for recipes

heavy ginkgo
#

Are there any mods for latest build that gives more plantable crops. Like bell peppers and onions

weary matrix
#

@heavy ginkgo you should ask in #mod_support here it's about developing mods

drifting ore
# weary matrix hmmm where is `o` declared?
function ISApplyBandage:new(doctor, otherPlayer, item, bodyPart, doIt)
    local o = {}
    setmetatable(o, self)
    self.__index = self
    o.character = doctor;
    o.otherPlayer = otherPlayer;
    o.doctorLevel = doctor:getPerkLevel(Perks.Doctor);
    o.item = item;
    o.doIt = doIt;
    o.bodyPart = bodyPart;
    o.stopOnWalk = bodyPart:getIndex() > BodyPartType.ToIndex(BodyPartType.Groin);
    o.stopOnRun = true;
    o.bandagedPlayerX = otherPlayer:getX();
    o.bandagedPlayerY = otherPlayer:getY();
    o.maxTime = 120 - (o.doctorLevel * 4);
    local modData = otherPlayer:getModData()
    if doctor:isTimedActionInstant() or modData.TOC.JustCut then
        o.maxTime = 1;
        o.doctorLevel = 10;
    end
    return o;
end
#

I took the on of the game and rewrite it

weary matrix
hollow shadow
drifting ore
#

o.maxTime = 1 when get to return o

hollow shadow
#

thats why im asking here

weary matrix
weary matrix
# hollow shadow thats why im asking here

I don't know anything about recipes, so unless you give more context I don't know how to help. You talked about 10 20 etc have no idea where you get that from for instance. Lua god maybe but can't read your mind yet ๐Ÿ˜‚

drifting ore
weary matrix
# drifting ore hook ?

oh this is just a regular timed action not related to when you wanted to intercept all timed actions?

drifting ore
weary matrix
drifting ore
acoustic siren
#

hey guys, does anybody knows how to draw a text/image fixed on the client ui?

weary matrix
# drifting ore Yes, it's IsApplyBandage in client/timedActions

hmm what about this

function ISBaseTimedAction:adjustMaxTime(maxTime)
    if maxTime ~= -1 then
        -- add a slight maxtime if the character is unhappy
        maxTime = maxTime + ((self.character:getMoodles():getMoodleLevel(MoodleType.Unhappy)) * 10)

        -- add more time if the character have his hands wounded
        if not self.ignoreHandsWounds then
            for i=BodyPartType.ToIndex(BodyPartType.Hand_L), BodyPartType.ToIndex(BodyPartType.ForeArm_R) do
                local part = self.character:getBodyDamage():getBodyPart(BodyPartType.FromIndex(i));
                maxTime = maxTime + part:getPain();
            end
        end

        -- Apply a multiplier based on body temperature.
        maxTime = maxTime * self.character:getTimedActionTimeModifier();
    end
    return maxTime;
end
weary matrix
acoustic siren
drifting ore
molten plaza
#

Can a good Samaritan message me and help me figure out why none of my mods work in mp? Iโ€™m hosting the server on my pc, and itโ€™s just me and a couple friends.

#

I have them subscribed in the workshop, added in the main menu, and added to the server settings.

weary matrix
weary matrix
winged lotus
#

Damn thanks again for the link @weary matrix, decompiled code allowed me to get my hand on getGameTime():getDaysSurvived() and getSandboxOptions():getErosionSpeed() easily!

acoustic siren
#

kind of weird btw

weary matrix
acoustic siren
#

with drawText

weary matrix
#

ah I see

#

either of those could work I guess depending what you want to do

acoustic siren
#
local original_render = ISEquippedItem.prerender

function ISEquippedItem:prerender()
    if isClient() then
        self:drawText("Hello World", 80, 10, 1, 1, 1, 1, UIFont.NewLarge);
    end
    original_render()
end
#

this is what i tried to do

weary matrix
winged lotus
weary matrix
#

Oh also you might have to pass self

sour island
#

Anyone having issues with spawning zombies in MP and having them remain?

acoustic siren
weary matrix
weary matrix
acoustic siren
weary matrix
sour island
#

They disappear instantly

#

Atleast when I use the same method used in the debug window

#

Haven't tested the debug hordeUI though maybe I should

copper umbra
#

Are there any mods or ability to get up close shots of, and different angles of character or zombie models in the game without a 3rd party tool?

sour island
#

Debug animator tool

#

I think you need -debug in launch options

weary matrix
sour island
#

Wander?

#

I can once I'm home

weary matrix
mint sphinx
copper umbra
weary matrix
# sour island Wander?

yeah, pretty sure it will help:

    public void Wander() {
        GameServer.sendZombie(this);
        this.changeState(ZombieIdleState.instance());
    }
sour island
#

Ah

#

Is there one for cars?

weary matrix
sour island
#

Can't seem to get server command to work tbh

weary matrix
# sour island Is there one for cars?

mmm I can see this but it's only for parts:

zombie/vehicles/BaseVehicle.java:    public void transmitPartCondition(VehiclePart vehiclePart) {
zombie/vehicles/BaseVehicle.java:    public void transmitPartItem(VehiclePart vehiclePart) {
zombie/vehicles/BaseVehicle.java:    public void transmitPartModData(VehiclePart vehiclePart) {
zombie/vehicles/BaseVehicle.java:    public void transmitPartUsedDelta(VehiclePart vehiclePart) {
zombie/vehicles/BaseVehicle.java:    public void transmitPartDoor(VehiclePart vehiclePart) {
zombie/vehicles/BaseVehicle.java:    public void transmitPartWindow(VehiclePart vehiclePart) {
weary matrix
sour island
#

He has, I'm probably doing something very minor but wrong

weary matrix
sour island
#

Hmm

weary matrix
#

not sure how to reach it though

sour island
#

I'll do some research

weary matrix
#

@sour island let me know when you have some time, we could try to figure out how to use sendServerCommand properly

weary matrix
copper umbra
#

I am... not sure lol. I am seeing if there is a way to get up close shots of characters that aren't from the 3/4 top down angle

weary matrix
copper umbra
#

Content creator - thumbnails and such

#

Essentially, yes, yes I do ๐Ÿ˜‰

weary matrix
#

fun

#

no clue how to do that though :/

winged lotus
#

Wait Lua tables indexes start a one ?! stressed

weary matrix
#

haha

#

yes....

winged lotus
#

How did I never encountered that in 5 mods x)

weary matrix
#

been using ArrayList I presume? ๐Ÿ˜‚

copper umbra
weary matrix
winter swift
#

Again, anyone has an idea?

flint bolt
#

Is there any way I can get the player SteamID on Lua? player:getSteamID() kind of works, but since this value is a long in java, I get precision errors inside Lua..

blissful meteor
#

Let me know if you get sendservercommand to work properly

#

I'd like to try use it to spawn vehicles in mp through lua

#

@weary matrix

copper umbra
hollow shadow
#

nvm i think i know it now xD

weary matrix
drifting ore
#

How do I use addSound() ? Because on a custom timedActions like that addSound(self.character, self.character:getX(), self.character:getY(), self.getZ(), 50, 50), that give a error (character is ofc a isoplayer)

#

The error: Object tried to call nil in start

#

I think I'm missing something before addSound() but I don't know what

median hollow
#

Any reason as to why my map mod doesn't show up in the mod folder?

teal slate
#

why not self.character:getZ

glass rampart
#

do i need to add to my ZombiesZoneDefinition vanilla objects like nurse or doctorM if i am adding my own objects to that locations?

#

and will it conflict with ZZDef from other mods?

drifting ore
gloomy mantle
#

in hydrocraft 41, is there any way to pick up an anchored mine hole?

lapis stump
#

how do I reload lua without restarting game ?

thin hornet
#

@lapis stump its best to reload the savegame. (go back to menu and go back in game)
Otherwise with the -Ddebug enabled you can access the debug window with F11.
Then you can find the script you want to reload

lapis stump
#

thx

blissful meteor
#

@weary matrix tried it, addvehicle doesn't appear to work through lua though. I'm trying to make it work through completion of a recipe. Strangely addallvehicles works, but spawns every vehicle xD

#

Maybe I'm using addvehicle wrong

weary matrix
blissful meteor
#

I didnt try it using \

#

Recipe.OnCreate.BuyVehicleVan(items, result, player)
addAllVehicles():("KrazAdmin");

#

That spawns all cars on me on completion of the buy van recipe

#

Atm it's just the user for testing, but I'll use x y z later

#

I believe I tried
addVehicle():("Base.Van", "KrazAdmin") but it threw an error

#

@weary matrix

uncut meteor
#

how can you check if the target is a zombie ?
and will it work on MP ?

sour island
#

@blissful meteor ( @weary matrix ) - For vehicle spawning I use addVehicleDebug() as it seems there is more arguments to use

lapis stump
#

with debug mode enabled can i change the weather?

glass rampart
#

@lapis stump yes

#

it should be climate debugger

lapis stump
#

is that in F11 ?

glass rampart
#

no it is in debug menu

#

round icon on the left side of your screen below map icon

#

you can see it only if you enable debug (just in case)

lapis stump
#

thx didnt notice that icon ๐Ÿ™‚

glass rampart
#

np

glass rampart
#

ugh is there any one familiar with ZombiesZoneDefinition? specifically on how to make it compatible with other mods that also change zoneDefinition

glass rampart
#

oh right, she/he is the author of Authentic Z

#

good idea ty!

weary matrix
#

I think he's a he ๐Ÿ˜…

glass rampart
weary matrix
#

indeed

coarse folio
#

Hey guys, does anyone use Autosar Trailers? Am I able to find them in an already existing save game?

glass rampart
#

@late hound hello, sorry to bother you, but if/when you have some spare time i would like to ask you some questions about ZombiesZoneDefinition!

glass rampart
west crystal
weary matrix
mental parrot
#

Hey peeps, new to modding PZ, can't seem to find where bins are located in code to change some qualities. Can anyone tell me where they are located?

#

e.g. Green Bin, Wheelie Bin, not .bin files

ivory perch
lapis stump
ivory perch
#

Thank you very much kind sir!

lapis stump
#

i already know how to program though might be harder for someone with no experience

ivory perch
#

If I have examples to work from I can do it

#

writing fresh mods? No way lol

#

learn as I go

west crystal
#

Hmm, i wonder, is it possible to make a zombie that will explode when hit?

drifting ore
west crystal
#

Not on death

#

On first hit)

drifting ore
# west crystal On first hit)

Mmmmm, that would be more complicated. Should store the variable that the zombie has already been touched. And I guess you want it to be just some zombie?

harsh kindle
#

I have found a few examples for adding new items into the game with the Distributions.lua, what about removing things? If I wanted to change the loot table a bit for example, how does removing something from this work. Also, these methods for adding to the loot table seem rather... complex for something that used to be (iirc) a lot easier?

west crystal
drifting ore
west crystal
#

Nah that was just a theoretical question, i doubt anyone would wanna play with this kind of zedz

drifting ore
#

Well done it could be fun, they just need to be rare and serve a bit as a boss

vivid flare
#

with crappy tools even, because i don't have access to good tools right now

drifting ore
#

Finally I leave the prototyping phase and start the alpha! Many features are not shown here and more will be added.
I now take ideas to my mod, if you have some, don't hesitate

#

guys i need some help iam out of town and might be away for a while need someone to test out my mod and tell me if it needs patching or no your help is very much appreciatedโค๏ธ

graceful snow
#

any good pz modlists for mp?

teal slate
#

alright, i tried a hacky mod to set PRINTDEBUG to true on RadioData and. now my console.log has hung

#

and when i alt-tab out of the frozen window it turns solid red

#

is it because i put it in shared?

#

i'll try moving it to client

sonic helm
#

I think I confused the Steam Workshop with a mod called "Just Muldraugh"

#

I thought it was straight forward :P

dark solar
#

lmao

sonic helm
#

Do people miss the joke in the description?

acoustic siren
#

guys, the events OnConnected and OnDisconnect are triggered from the server?

#

is there a way to know which player has been connected/disconnected?

glass rampart
# sonic helm

i have counter question, Do you think most of the people READ the descr? if at lest 25% had read it it would be already great!

teal slate
#

@weary matrix PRINTDEBUG on RadioData doesn't appear in zomboid-javadoc, is that because it's a default visibility (package) field? if so, that's kind of disappointing ๐Ÿ˜”

#
public final class RadioData {
   static boolean PRINTDEBUG = false;
sonic helm
#

I read the descriptions of things

glass rampart
#

well that's you, that's probably 95% of what users of this ch also do

#

but there is also thousands of usual users

#

who don't give a f about descr and all they want to do is leave raging comment or "detailed" bug report as "this sh*t isn't working" and that's about it ๐Ÿ™‚

lapis stump
#

you can disable comments ๐Ÿ™‚

glass rampart
#

yes, but still there is some that indeed leave descriptive bug reports etc

west crystal
glass rampart
#

well i think they do? unless they blindly installed steam, bought PZ and went to workshop to search for mods? unless they was following images that they liked? xD

west crystal
#

They was just following images

#

If the images are good that means the mod is good too!

sonic helm
#

Lol

west crystal
#

right?

sonic helm
#

I guess SoulFilcher's mods are out

sonic helm
#

Nobody wants download spiffo surrounded by icons :P

west crystal
#

Soul's mods are downloaded by people who already have Soul's mods

glass rampart
#

and if they do not understand some thing from img they just need to press img with finger pointing dow "rate down" coz why not?

lapis stump
#

that persons mod broke my game had to unsub

sonic helm
#

I mean, Hydrocraft was popular because girl and mod theft

nimble spoke
#

You people don't like Spiffo? Do you want to get banned or something?

sonic helm
west crystal
sonic helm
#

And since I'm am Admin at New Dawn/Gateway, where he was an admin once in like, 2015 or so.

#

He stole a lot of shit from other people

#

And just threw it in Hydrocraft

fair frost
#

Yikes

west crystal
#

Yikes

sonic helm
#

I'm honestly glsd 41 killed it

winter bolt
#

that doesnt really surprise me since there are like 15 different artstyles of varying quality lmao

sonic helm
#

Were finally switching over to Soul's stuff as a replacement

west crystal
#

So that's why everything looked so inconsistent in that mod

winter bolt
#

the clipart farm animals are a real highlight for me

teal slate
west crystal
#

lmao

winter bolt
teal slate
#

yeah

winter bolt
#

yikes

teal slate
#

lot of it was taken from other mods without credit

west crystal
#

yikes x2

teal slate
#

hydrocraft is basically frackin' universe for project zomboid lmao

#

both are fun and were basically essential for playing

glass rampart
nimble spoke
teal slate
glass rampart
#

im not trying to defend author of hydro and i have not used it even once

teal slate
#

then what are you trying to do

glass rampart
#

but its just in our time it is hard to create some thing unique

winter bolt
#

if i had a penny for the amount of times that an indie game had a big mod with a ton of content of questionable quality that was really popular for some reason i'd only have 2 pennies but its weird that its happened twice

teal slate
glass rampart
#

ehm read things i wrote earlier? ๐Ÿ™‚

teal slate
#

because if not, it's really unclear what it is you're trying to do

#

"can you say for sure that every idea is original?" is a non-sequitur when we're talking about intellectual property theft

west crystal
teal slate
#

"Y was inspired by X" is not "Y stole wholesale from X"

glass rampart
teal slate
#

yes

#

which is what frackin' did

#

that's at least what i've heard

winter bolt
dim heart
#

What did the author of hydro do?

west crystal
winter bolt
#

discord moment lmao

nimble spoke
#

more important. Is there anything from Hydro that we still don't have covered by a more recent, better implemented mod?

weary matrix
#

@teal slate that's a good question. I have no idea why it's missing but it should be there

winter bolt
#

i guess animals but those are gonna be vanilla soon

teal slate
#

honestly if i wanted any mod of questionable quality to make a comeback it would be uuuh

weary matrix
#

only the private stuff are "supposed" to be missing

teal slate
#

OZMeds

#

i put some work into getting it to work in build 41, but also i'd need to contact the original author about licensing to upload a fixed version

glass rampart
dim heart
sonic helm
teal slate
#

lmao

#

like

#

there's a reason SS13 is a lawyer's worst nightmare

sonic helm
#

And iirc, it killed a lot of mods

teal slate
#

the copyright law there would take decades to unravel

nimble spoke
sonic helm
#

Reason why I'm happy Soul's stuff is modular

dim heart
teal slate
#

what

#

lmao

lapis stump
#

no they arent

teal slate
#

open source has nothing to do with it

sonic helm
#

I also should say, that like

teal slate
#

but open source does not mean it's public domain

#

open source repositories have licenses

sonic helm
#

since we still have another season of the current lore to finish out in B40, we still have to use hydrocraft

teal slate
#

if they have no license it's under All Rights Reserved by default

sonic helm
#

And it causes

#

so

west crystal
teal slate
#

all my mods are published under The Unlicense which means they're released into the public domain

sonic helm
#

much

#

issues

#

not even funny, the console tries to load the same shit over and over

thin hornet
#

From Valve:

Using content from other mods
It's a sad fact, but in some cases content is also being lifted from one mod to another. It's often a misconception that just because a mod is free to download, its contents are also free for you to take and choose from as you wish.

Even if a mod is free or not, the creators of any original work included within it (sounds, materials, models, source code) own the copyright for their work. This is true if you are a high-school kid, a corporation, or just some other modder who puts stuff together for fun. Every author gains these rights by default when they create their work.

The authors alone can decide how and who may use their work and have the law behind them should they decide to take issue of anything used without permission. If you see something in another mod that would be of use to you in your own mod or map, your first step should be to contact the mod team and then specifically ask the creator of the item your after. They and they alone can give you permission to use their work.

If you create contents for mods and don't mind other people using your content, then it could save a lot of trouble and benefit the community as a whole if you release your works under a Creative Commons license. See the Official Website to select a License for your works.
dim heart
#

Mods are open source because they themselves build off of an already existing product

teal slate
#

That's not what open source means.

#

You're thinking of contagious licensing clauses like those in AGPLv3, but PZ is not AGPLv3

sonic helm
#

Look

weary matrix
#

open source is free, but not as in free beers ๐Ÿ˜‚

sonic helm
#

Mod Theft is Bad

teal slate
#

I'm pretty sure PZ is actually All Rights Reserved by TIS

sonic helm
#

Lifting Mods and not providing credit is bad

#

Claiming that EVERYTHING WAS HIS OWN WORK LIKE HYDRO DID WAS BAD

#

can we at least agree on that?

dim heart
#

There simply isn't enough case law on the subject to talk about this in a legal sense

teal slate
#

licenses exist

sonic helm
#

Who cares about legality?

dim heart
teal slate
#

????

#

It is literally a license violation

sonic helm
#

Who said anything about Criminal?

zenith lagoon
#

I actually never tried hydro, it felt to much. Was interested in it but never pulled the trigger on it

teal slate
#

Code without a license is assumed to have all rights reserved by the original author

teal slate
#

it

#

is intellectual property theft

lapis stump
#

if i switch my mod to private will it unsubscribe ppl ?

thin hornet
#

Personally, my mods have no liscence and are open source. I could care less someone use it in his modpack.
If it breaks that his server problem.

sonic helm
#

Can we like....

teal slate
#

never said they would be able to successfully litigate it

sonic helm
#

Stop this arguement?

teal slate
#

but it is theft of intellectual property

#

sure

glass rampart
#

here goes the drama....

west crystal
#

Get the popcorn

teal slate
glass rampart
#

and i thought it was ch for modding ....

sonic helm
#

This sounds like... pointless in the face of "What Hydro did was shitty."

teal slate
#

it releases it into the public domain

winter bolt
#

either way its still shitty to just steal mods and say you made them

sonic helm
#

Basically,

teal slate
#

technically "no license" -> "the original author can tell you to stop whenever and you have no rights"

sonic helm
#

Sorry I started all this

#

I'm sorry

glass rampart
#

we need #quarreling chennel

sonic helm
#

I didn't mean to

teal slate
#

"the unlicense" -> "the work is in the public domain" -> "the original author has no control over what you do"

zenith lagoon
#

On the topic of mods, Why isn't there a breakdancing zombies mod, instead of eating you after you die they jsut breakdance on your corpse

dim heart
#

I don't see why people always have to grandstand over this stuff

thin hornet
#

It's a discussion that still have a purpose.

teal slate
winter bolt
sonic helm
#

Yeah, thanks

mental parrot
#

Can't get an answer for legitimate question but can watch quarrelling with popcorn, typical Discord chat is typical

sonic helm
#

Like, Jade stopped, so like, if she stopped, you should stop too tbh

west crystal
teal slate
#
Class = {}
__classmetatables[Method.class]["__call"] = function (self, args) return self:invoke(args) end
for i=0, getNumClassFunctions(RadioData.class) - 1 do -- any class would work
    local func = getClassFunction(RadioData.class, i)
    Class[func:getName()] = func
    print(func:getName())
end

local PRINTDEBUG = Class.getField(RadioData.class, "PRINTDEBUG")

printdebug is null ๐Ÿ˜ญ

weary matrix
#

@teal slate mmm it's really weird, can't figure out why it's missing. I'm just using the javadoc command, so it should be there

teal slate
#

guess because the field is package-level visibility we can't access it

teal slate
sonic helm
#

That being said, I did ask last night about if a new version of WordZed will come out soon so we can create CDs/VHS tapes

teal slate
#

i'm thinking it's probably the latter, unfortunately

sonic helm
#

Because from the code I found, I don't think I can reverse engineer it

weary matrix
teal slate
#

maybe i should try getDeclaredField??

weary matrix
#

@teal slate only private members should be missing

teal slate
mental parrot
#

@teal slate searched all files in scripts with multiple possible alt names couldn't find any reference, so I'm thinking I'm soo noob to PZ modding that they aren't even mean to be in there to begin with and I just don't know better

teal slate
#

that said, protected ones are visible

weary matrix
#

oh my bad

teal slate
#

YUP

#
./shared/Translate/EN/Moveables_EN.txt:    Empty_Mall_Decoration = "Mall Garbage Bin",
./shared/Translate/EN/Moveables_EN.txt:    Fossoil_Garbage_Bin = "Fossoil Garbage Bin",
./shared/Translate/EN/Moveables_EN.txt:    Garbage_Bin = "Garbage Bin",
./shared/Translate/EN/Moveables_EN.txt:    Green_Garbage_Bin = "Green Garbage Bin",
./shared/Translate/EN/Moveables_EN.txt:    Grey_Garbage_Bin = "Gray Garbage Bin",
./shared/Translate/EN/Moveables_EN.txt:    Recycle_Bin = "Recycle Bin",
./shared/Translate/EN/Moveables_EN.txt:    Round_Bin = "Round Bin",
./shared/Translate/EN/Moveables_EN.txt:    Spiffos_Garbage_Bin = "Spiffo's Garbage Bin",
./shared/Translate/EN/Moveables_EN.txt:    Washing_Bin = "Washing Bin",
./shared/Translate/EN/Moveables_EN.txt:    Wheelie_Bin = "Wheelie Bin",
#

which means those strings will have to be referenced somewhere

#

odd

mental parrot
#

All I was trying to do was update stats to make bins collect rain lol

teal slate
#

trying to find it...

west crystal
mental parrot
#

On first pass probably not, if I get further into PZ modding then possibly

#

I've considered both using them as standard and requiring bleach/cleaning agent to make them usueable, either way it'd be nice to not be a carpenter to catch meaningful rain.

teal slate
#

terrified at the prospect, but it might be that they're only defined on the maps in some weird bespoke way

#

still searching though

mental parrot
#

That's what I thought

west crystal
#

What exactly you guys are trying to do?

mental parrot
#

Find where the Bin items are referenced like the other items to hopefully alter their qualities such as rain collection

teal slate
#

the issue is that they're Moveables and those are

#

weird

west crystal
#

If you would anyway combine/craft them with bleach into different ones

teal slate
#

they said that was only one idea

nimble spoke
#

tile definitions

teal slate
#

NOOO

#

yeah

#

it's

#

in newtiledefinitions.tiles

nimble spoke
#

and the worst part.... overriding tile definitions

teal slate
mental parrot
#

I had a feeling they'd be there but not being familiar I went for asking vs seeking for hours

mental parrot
teal slate
#

hold on though, let me check something

#

aaaaaaaaaaaaaaargh

#

you have to edit it in the tile definitions

nimble spoke
#

the one thing I prefer to stay away from

#

that and actually getting a job

old blade
#

i really wanna make an in depth trading card mod, where you can open packs of cards and get 3 cards from it, with diff rarities and holos / foils and stuff, i just am not sure where to start that project

#

i can make all the visual and 3d assets for it but i have 0 idea how to code lua or java, or script at all

#

do u guys have any pointers for how i might do this? :o

mental parrot
#

Sounds cool

lapis stump
old blade
#

the packs wouldnt be too common unless you found like a dedicated comic book store or smth

mental parrot
#

@teal slate Thank you ๐Ÿ˜„

nimble spoke
old blade
#

do u have any good guides that teach that?

#

or know where i can find some? :0

mental parrot
#

Whats the preferred tool for editting .tile files?

teal slate
#

i've never used it before now :P

lapis stump
#

oh was hoping it was a mod tool for like the whole game ๐Ÿ˜ฆ

old blade
#

is it possible to give certain items an animated icon? like in the inventory?

#

it would be cool to give the foil cards a slight animated glitter around the edges

west crystal
weary matrix
teal slate
#

add -package to javadoc

#

default is protected and public only, i think

#

however i think excluding package members is a good idea because i don't think they're accessible?

#
Class = {}
__classmetatables[Method.class]["__call"] = function (self, args) return self:invoke(args) end
for i=0, getNumClassFunctions(RadioData.class) - 1 do -- any class would work
    local func = getClassFunction(RadioData.class, i)
    Class[func:getName()] = func
    --print(func:getName())
end

local PRINTDEBUG = nil
for i=0, getNumClassFields(RadioData.class) - 1 do
    local field = getClassField(RadioData.class, i)
    print(field)
    if field:getName() == "PRINTDEBUG" then
        PRINTDEBUG = field
        break
    end
end
--local PRINTDEBUG = Class.getField(RadioData.class, "PRINTDEBUG")
print(PRINTDEBUG)
PRINTDEBUG:setBoolean(RadioData, true)

PRINTDEBUG:setBoolean(RadioData, true) still gives attempted index: setBoolean of non-table: null and PRINTDEBUG is nil

#

:|

#

gonna rerun now that i added print(field)

#

oh no it's

#

getting the fields on class

#

๐Ÿ’€

#

RIGHT because. it does class

#

agh

#

time to reimplement getNumClassFields

old blade
#

does anyone know the image size of the little item icons

teal slate
#

#RadioData.class:getDeclaredFields() let's try this

west crystal
old blade
#

okay

#

big ups for the info btw

west crystal
#

although if you want it to be exact as vanilla you can look in the texture files

teal slate
#
Class = {}
__classmetatables[Method.class]["__call"] = function (self, args) return self:invoke(args) end
for i=0, getNumClassFunctions(RadioData.class) - 1 do -- any class would work
    local func = getClassFunction(RadioData.class, i)
    Class[func:getName()] = func
end

local PRINTDEBUG = Class.getField(RadioData.class, "PRINTDEBUG")
PRINTDEBUG:setBoolean(RadioData, true)
#

this might actually work

old blade
#

i think im gonna start actually making assets for this trading card idea

teal slate
#

nope ๐Ÿ’€ agh

#

oops, wrong number of args

#

Class.getField(RadioData.class, "PRINTDEBUG")

#

oh i have to use getDeclaredField

#

only that can get package/protected/private fields

#

__len not defined for operand

#

that's progress baybee

old blade
#

ty :)

teal slate
#

this is becoming a mess

#
Array = {}
for i=0, getNumClassFunctions(declaredFields) - 1 do
    local func = getClassFunction(declaredFields, i)
    Array[func:getName()] = func
end
#

so many shims

#

all this just to enable PRINTDEBUG on RadioData

west crystal
teal slate
#

i am using reflection on reflection on reflection

#

this file is basically a hall of mirrors now

teal slate
#

oh god i know why it didn't work

#

because i used getName

#

and that doesn't take into account signatures

#

local ArrayClass = Class["public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException"]("java.lang.reflect.Array")

#

this is what i have to do now

old blade
#

obviously a texture for a model in game shouldnt be huge or too detailed but is there a max size

weary matrix
#

@teal slate so should I push the doc with -package?

@@ -161,6 +186,20 @@ extends java.lang.Object</pre>
 </section>
 <section class="details">
 <ul class="details-list">
+<!-- ============ FIELD DETAIL =========== -->
+<li>
+<section class="field-details" id="field.detail">
+<h2>Field Details</h2>
+<ul class="member-list">
+<li>
+<section class="detail" id="PRINTDEBUG">
+<h3>PRINTDEBUG</h3>
+<div class="member-signature"><span class="modifiers">static</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="member-name">PRINTDEBUG</span></div>
+</section>
+</li>
+</ul>
+</section>
+</li>
 <!-- ========= CONSTRUCTOR DETAIL ======== -->
 <li>
 <section class="constructor-details" id="constructor.detail">
#

or even -private?

west crystal
teal slate
#

-private would display private variables, though i'm not sure how useful seeing those would be

west crystal
#

I used 1024*1024, you don't really need more

old blade
#

askin cuz im making the model for a card pack rn

teal slate
#

i don't know if -private includes -package implicitly

#

ultimately it's up to you

weary matrix
#

I think it does

#

I guess would be nice to have private fields (some useful methods are private too) just knowing they exist can help

#

but that also makes a lot of extra noise

#

people might get confused like "oh but the method is here but I can't use it" etc

west crystal
#

Hand eating gangpenisham

glass rampart
#

lol what, you could eat with spoons? oO

hollow shadow
old blade
#

yeah i saw that but i didnt really execute it how i envisioned it

hollow shadow
#

tbh the only reason im still using commanders mods is becouse of the trading cards, if you make that mod then ill defno use it

old blade
#

i dont know how to make it in terms of actually implementing it in the game, but im making models / stuff for it right now

hollow shadow
#

omg finally

old blade
#

if someone wants to help me code it into the game then im all down

hollow shadow
#

i was just about to ask about that

mental parrot
#

Unfortunately just altering the tile definitions didn't allow for bin rain collection so I'm guessing the moveable items are referenced elsewhere too unless a property they already have prevents the functionality.

teal slate
#

I am committing sins against modding

#
Class = {}
__classmetatables[Method.class]["__call"] = function (self, args) return self:invoke(args) end
__classmetatables[Field.class]["__call"] = function (self, args) return self:get(args) end

function exposeClass(exposedClass, container)
    for i=0, getNumClassFunctions(exposedClass) - 1 do -- any class would work
        local func = getClassFunction(exposedClass, i)
        func:setAccessible(true)
        container[func:toString()] = func
        --print("'"..func:toString().."'")
    end
    for i=0, getNumClassFields(exposedClass) - 1 do -- any class would work
        local field = getClassField(exposedClass, i)
        field:setAccessible(true)
        container[field:toString()] = field
        --print("'"..field:toString().."'")
    end
end
exposeClass(RadioData.class, Class) -- any class would work

local Object = {}
Object.class = Class["public java.lang.reflect.Type java.lang.Class.getGenericSuperclass()"](RadioData.class)
local objectInstance = Class["public java.lang.Object java.lang.Class.newInstance() throws java.lang.InstantiationException,java.lang.IllegalAccessException"](Object.class);
exposeClass(objectInstance, Object)

local Constructor = {}
Constructor.class = Class["public java.lang.Class java.lang.Class.getComponentType()"](Object["public final native java.lang.Class java.lang.Object.getClass()"](Class["public java.lang.reflect.Constructor[] java.lang.Class.getConstructors() throws java.lang.SecurityException"](Object.class)))
exposeClass(Constructor.class, Constructor)
#

behold, the ability to expose an arbitrary class's methods and fields on a whim (in debug mode only) @weary matrix

#

i'm doing all of this just so i can set one (1) static var

#

i want the TIS devs to look upon this monstrosity and weep

#

or like, the Kahlua devs

weary matrix
teal slate
#

every time i do Array.class = Class["public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException"](Class.class, "java.lang.reflect.Array") it gives me Caused by: java.lang.IllegalArgumentException: wrong number of arguments

#

blurgh

#

... oh wait

#

is it static??

#

it's static

weary matrix
#

yeah has to be

teal slate
#

still getting the error even with just Array.class = Class["public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException"]("java.lang.reflect.Array")

weary matrix
teal slate
#

see, that's weird because it's a java builtin

#

and it's wrong number of arguments

#

oh

weary matrix
teal slate
#

it still is

#

like

weary matrix
#

oh?

teal slate
#

that's the error i'm getting still

#

Caused by: java.lang.IllegalArgumentException: wrong number of arguments

weary matrix
#

any clue which method is receiving invalid number of arguments? is it forName?

teal slate
#

it's forName, yeah

weary matrix
#

and what do you pass it?

teal slate
#
ERROR: General     , 1640831545809> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at GeneratedMethodAccessor579.invoke.
ERROR: General     , 1640831545809> DebugLogStream.printException> Stack trace:
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.GeneratedMethodAccessor579.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
...
Caused by: java.lang.IllegalArgumentException: wrong number of arguments
#

with uhhh

#

Array.class = Class["public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException"]("java.lang.reflect.Array")

#

if kahlua doesn't convert lua strings to java strings i'll be so mad

weary matrix
#

can you show the call itself?

teal slate
#

what do you mean

#

that's the call

weary matrix
#

oh ๐Ÿ˜‚

teal slate
#

__classmetatables[Method.class]["__call"] = function (self, args) return self:invoke(args) end

#

this is how it's invoked

weary matrix
#

mmm but what argument are you passing to forName? I just see "java.lang.String"

teal slate
#

no, no

#

Class["public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException"]

#

this is how you get the method

#

by passing the fully qualified name or w/e

#

including signature

#

then i pass ("java.lang.reflect.Array")

weary matrix
#

oh

#

now I understand ๐Ÿ˜‚

teal slate
#

still unsure why it's giving that

#

wait

#

i can use reflection to get the proper number of arguments ๐Ÿ˜‚

weary matrix
#

but for example if a function expects a string but you pass null, then reflection will fail

#

to find the method/constructor etc

teal slate
#

the signature indicated that it takes java.lang.String and is static

#

๐Ÿค”

#

printed the function and it agrees

#

public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException

weary matrix
#

have you tried to strace the process to see if it's looking for a .class? ๐Ÿ˜„

teal slate
#

uuuuuuuuuuuuugh no ๐Ÿ˜ญ

#
ERROR: General     , 1640831932303> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at GeneratedMethodAccessor579.invoke.
ERROR: General     , 1640831932303> DebugLogStream.printException> Stack trace:
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.GeneratedMethodAccessor579.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at se.krka.kahlua.integration.expose.caller.MethodCaller.call(MethodCaller.java:62)
    at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:198)
    at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:188)
#

i'll look at the kahlua source

weary matrix
#

I hope you have some dolipran ๐Ÿ˜‚

teal slate
#
    @Override
    public void call(Object self, ReturnValues rv, Object[] params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
        if (!hasSelf) {
            self = owner;
        }
        Object ret = method.invoke(self, params);
        if (hasReturnValue) {
            rv.push(ret);
        }
    }
hollow shadow
#

I wish i could undrstand this code so i could laugh too ._.

teal slate
#

the code isn't what's being laughed at, it's me :P

#

i am doing all of this to enable one (1) static var

#

... which i think i could probably do anyway

#

hold on

mental parrot
#

I can safely say a lot of us programmers have been there before and laughed at ourselves for it, our effort vs reward scales often don't work ๐Ÿ™ƒ

teal slate
#

oh my god i don't need to expose java.lang.reflect.Array

#

because.

#

they exposed Iterator already...

#

or i could try java.util.Arrays

mental parrot
#

I think I'm giving up on making bins water collectors for now and moving on to making it a whole new craftable instead

drifting ore
#

I created an item with the variable DisplayCategory = Surgeon Kit but in games the category displayed is IGUI_Item_Cat_Surgeon Kit. Any idea how to get rid of IGUI_ItemCat_?

teal slate
#

okay, incredibly interesting:

#

Arrays.class = Class["public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException"]("java.lang.Object")

#

this gives IllegalArgumentException

mental parrot
#

@drifting ore Steam Games\steamapps\common\ProjectZomboid\media\lua\shared\Translate\EN\IG_UI_EN change in this file

drifting ore
#

The problem is that I am using item:getDisplayCategory() to differentiate between several items. Isn't that going to be a problem? I must also change the place where I make the difference I imagine

thorn bane
#

Just outta curiosity, how hard would it be to create a new UI panel?

sour island
#

@iron salmon - Idk if this is the right place to ask but I'm stumped on something that I don't think anyone else could have experience with:

      if (GameClient.bClient && this.authOwner == null && (!this.bRemote || this.lastRemoteUpdate > 5000)) {
         DebugLog.log(DebugType.Zombie, "removing stale zombie 5000 id=" + this.OnlineID);
         DebugLog.log("Zombie: removing stale zombie 5000 id=" + this.OnlineID);
         removing stale zombie 5000.instance.removeZombieFromWorld(this);
      } else {

When I use addZombiesInOutfit() the zombies instantly despawn - giving the printout message above. I looked in media/lua/client/DebugUIs/ISSpawnHordeUI.lua which is the debug spawners:

   if isClient() then
        SendCommandToServer(string.format("/createhorde2 -x %d -y %d -z %d -count %d -radius %d -crawler %s -isFallOnFront %s -isFakeDead %s -knockedDown %s -health %s -outfit %s ", self.selectX, self.selectY, self.selectZ, count, radius, tostring(crawler), tostring(isFallOnFront), tostring(isFakeDead), tostring(knockedDown), tostring(health), outfit or ""))
        return
    end
    for i=1,count do
        local x = ZombRand(self.selectX-radius, self.selectX+radius+1);
        local y = ZombRand(self.selectY-radius, self.selectY+radius+1);
        addZombiesInOutfit(x, y, self.selectZ, 1, outfit, femaleChance, crawler, isFallOnFront, isFakeDead, knockedDown, health);
    end

Which features a isclient check that deviates from addzombies to a sendservercommand - which makes sense as the command originates off UI - and those zombies don't get hit with the "5000" message and don't get instantly deleted. If my lua is in the server folder, and I'm using addZombiesInOutfit() why are they getting instant deleted?

#

Similar issue with vehicles using addvehicledebug() - they appear for host but not players, and they don't get saved.

#

They also feature a sendservercommand for UI calls on the debug panel.

teal slate
#

Arrays.class = Class["public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException"](Class.class, "java.lang.reflect.Array") throws java.lang.IllegalArgumentException ๐Ÿ˜ฉ

#

okay so it turns out this is because the jvm got tired of giving me detailed debug info

#

tried a fresh restart :)

versed helm
#

Trailer mod works very well in MP lol

#

just dont bring them inside lol

teal slate
#

okay so

#

instead i just. got out a bytecode editor :P

wanton cosmos
#

how would i go about creating an infinite stamina trait?

#

i would like to try to survive as long as possible with extreme sprinter population with pinpoint hearing, bloodhound smelling and eagle sight, by running as much as possible

stiff furnace
#

Hello everyone. I am wondering if anyone would be so kind to point me in the right direction. I have a lot of experience in C+ and Python coding but never sat down to learn lua deeply (I do this as a hobby). Is there a good updated tutorial somewhere? I'm not sure which ones are good...I am specifically trying to figure out how to pull a players username

sour island
#

you can browse the java and documentation for exposed classes and methods

#

but once you have the IsoPlayer in question you can use :getUsername()

stiff furnace
#

Yeah, I think once I figure out the syntax for lua, it will click much faster. I've been coding in python for so long that it feels like I'm back to zero lol

#

A lot of the same principles. I love how easy it is to add new items, weapons, and etc

sour island
#

that is scripting

#

but lua is very basic

stiff furnace
#

Wait....does does IsoPlayer player pull up the local player?

#

local username = Isoplayer(player):getUsername();

#

Like such?

sour island
#

not quite

#

each game has a client attached to it - getplayer() is short hand for getting the main player

#

it gets a bit trickier when you have coop players or online players

stiff furnace
#

Gotcha, so I assume in PZ that getplayer() on a dedicated server would not necessarily pull the local player

sour island
#

but the process is to gather up the isoplayers

thorn bane
#

Found my answer a bit ago, but thanks for the reply here <3

stiff furnace
#

I got something written up, but I know it's wrong lol

sour island
#

in mp the code would be running on client side

#

then updating the server

#

so getplayer would pull what ever player is doing the code

stiff furnace
#

Hmm okay, so close

#

So I am just trying to do check a players username and then add a trait(I think should be simple?) Could I paste the short snippet here? I think I see what you're saying but I am failing to use the getplayers() correctly

#

I do appreciate your time

sour island
#

are you trying to add a trait based on their username?

stiff furnace
#
local function IdentifyPlayer()
  local username = Isoplayer(player):getUsername();
  local players         = getOnlinePlayers();
  print(tostring(Isoplayer(player):getUsername()));
  local array_size     = players:size();
  for i=0, array_size-1, 1 do
    local player = players:get(i);
    if username == "Tester3" then
      TraitFactory.addTrait("Testing", "TestingTestingTesting",-1,"Did this work", false, false);
    end
  end
end
#

Yes

sour island
#

and sure - just know discord uses markdown for code
```lua
codehere
```

stiff furnace
#

Oh! good to know

#

That's really neat

#

I appreciate your patience, I am new to lua...I wish I spent more time with it back in the Gary's mod days

sour island
#
local function IdentifyPlayer()
  local players = getOnlinePlayers()
  for i=0, players:size()-1, 1 do
    local player = players:get(i)
    if player:getUsername() == "Tester3" then
      TraitFactory.addTrait("Testing", "TestingTestingTesting",-1,"Did this work", false, false)
    end
  end
end
#

it's probably your former experience but you can't declare types in lua

#

also ; are unneeded

stiff furnace
#

Hahahha

#

Thank you

#

I am overthinking it

sour island
#

you got the array use right

#

which most people get hung up on

#

as there are lua tables/lists

#

so having a java array to deal within lua gets weird

stiff furnace
#

Yeah, I can see that

#

Chuck, you are a very helpful person

#

You just saved me a headache

sour island
#

idk if this is doing what you think it is though'

stiff furnace
#

Hmm...maybe not?

#

I use this later ```Events.OnCreateSurvivor.Add(IdentifyPlayer);

#

To call it upon character creation...I believe?

sour island
#

TraitFactory (and all the factories as TIS calls them) are for housing behaviors/enums/etc

#

so I think this is creating a trait

#

not actually assigning it

#

OnCreatePlayer also works

stiff furnace
#

Okay, I believe that is what I want, so if you have a certain username the trait pops up and you can select if, if you want.

sour island
#

idk if survivor is used anymore as it was meant for NPCs

stiff furnace
#

OH, I could use OnCreatePlayer to auto assign it

#

Gotcha

sour island
#

I mean traitFactory add makes a new trait in general

#

so anyone would be able to pick it

stiff furnace
sour island
#

if you want only specific people to be able to pick it or be assigned it you'd have to dig into the UI lua to hide certain traits

#

that documentation is good

#

I think @weary matrix made an updated one

stiff furnace
sour island
#

unless I'm mistaken TraitFactory add would be adding to the global list of traits

stiff furnace
#

Interesting

#

I will have to test that

sour island
#

I've read through traits and professions for Skill Recovery Journal

#

the term factory is generally something used to house behaviors/types of objects/instances

icy crown
#

I cannot stop dying, i love this game! Please help

sour island
sour island
#

I'm not really formerly trained or anything - so I only know how TIS uses it

tacit ermine
#

FWIW, only traits with a non-zero cost show up in that list

stiff furnace
#

Well, so far the trait DID show up - so that's a good sign...I will have to grab a buddy and test if it's global

tacit ermine
#

oh, that's only the good trait list actually

#

if you want to hide it you can look for the isRemoveInMP() calls

sour island
#

that might remove it entirely rather than just visually

stiff furnace
#

Okay. I will have to find a different way, @sour island was correct

sour island
#

What is the point of this trait tbh?

stiff furnace
#

It now shows for any username lol

tacit ermine
#

nah, that's only queried for the trait list in the UI

#

see CharacterCreationProfession:populateTraitList

sour island
#

ah

#

that's the lua file you'd have to modify

stiff furnace
#

@sour island Honestly? I am just learning. I was thinking of making a "unique trait" for a friend of mine that only he could use...makes em feel special.

sour island
#

you'd also have to practice safe overloading of lua functions

#

hmm

#

maybe you could just tap into the UI on character stats

#

and spoof a trait?

tacit ermine
#

free traits are also hidden from that list, but that might also hide from from the stats window

sour island
#

idk if it's like this for other games but modding PZ to do things it's not already doing can be a labor of love

stiff furnace
#

Haha okay, so what I'm hearing is that I picked something to try and do that's probably above my skill level at the moment

#

I'm looking at CharacterCreationProfession right now

#

Interesting stuff

tacit ermine
#

yeah, looks like you can hide it from the trait selection UI and still have it appear in the stats panel

sour island
#

maybe not above your skill level - as this isn't a project to be distributed but definitely something that's roundabout

#

that'd work then

#

you can use Events.OnGameBoot instead

#

so it's only added once

#

then in oncreateplayer figure out the actual trait adding per player

#

it's probably a method with in isoplayer or isogamecharacter

tacit ermine
#

it's how profession traits like Burglar are handled:

TraitFactory.addTrait("Burglar", getText("UI_prof_Burglar"), 0, getText("UI_trait_BurglarDesc"), true);
                                                                                                 --^-- make it free 
stiff furnace
#

Okay, that makes sense

#

So add the trait upon launch

#

Hidden

#

Then check for the player name and add it that way

#

Okay

#

Using CharacterCreationProfession:addTrait ?

tacit ermine
#

to add the trait to a player you want to do player:getTraits():add("My Trait Name")

#

where player is some variable with the player you want to add the trait to

stiff furnace
#

Oh...there it is lol

tacit ermine
#

that's the list of all traits, not a characters traits

#

oh nvm

#

it's not, I think, you're right

stiff furnace
#

Man, I really appreciate both of your help

#

You saved me hours of scratching my head

#

It's starting to make a lot more sense. I will need to get better at seeing what functions are already around and how to use them

#

I am going to brb and see if I can write it up

opal wind
#

holy trouble batman!

safe idol
#

Anybody know if True Music can work with custom music on servers?

#

Like would the host have to place the music, or would everyone have to, or does anyone know how that'd work

stiff furnace
#

I'm not 100% sure Teemo, but I'm sure it doesn't work unless everyone has the same music

#

@tacit ermine @sour island Ah man, I'm so close lol. I can get the trait to be made and be invisible (I can add it via admin console) but it won't add during character creation. Do you have one last round of help in you for the night? It's okay if not too

tacit ermine
#

how and when are you trying to add the trait to the character?

solemn horizon
#

is it possible to change electricity and water cutoff to something like 3-5 days instead of 0-30 ?

stiff furnace
stiff furnace
# tacit ermine how and when are you trying to add the trait to the character?

I'm sure I'm messing that up, this is what I have

local function IdentifyPlayer()
  local players = getOnlinePlayers()
  for i=0, players:size()-1, 1 do
    local player = players:get(i)
    if player:getUsername() == "Tester3" then
        player:getTraits():add("Testing1234")
        print ("Testing")
    end
  end
end

and then

Events.OnCreatePlayer.Add(IdentifyPlayer)
#

TraitFactory.addTrait("Testing1234", "Testing1234",0,"Did this work?", true)
That gets ran in a prior function

tacit ermine
#

does the "Testing" print?

stiff furnace
#

I have -debug on, but I don't actually see where it would be printing

#

In the console.txt?

tacit ermine
#

wherever your console output is going, yeah

sour island
#

getonline players also only works for MP

stiff furnace
#

No, output. Hm the function is not executing

stiff furnace