#mod_development

1 messages ยท Page 241 of 1

echo rune
#

Thanks brothers, it was the name of the file. now working properly

small topaz
#

also true XD but they are still there shown in the interface at least

solar rover
#

All the infection stuff would be easy enough because it's already there. As a total newb i would guess you just need to script checks for wet condition, then add that status to a be tracked for duration and after x time apply condition. But then you need to tell the game to do something about it? So maybe you need to make a wet-infection condition of your own that you can then link to walking speed and pain levels? Sounds like work

sonic ibex
#

It'd be cool if they added blisters to the game as an injury type ๐Ÿค”

#

I did not know that ๐Ÿ˜… so no need to disinfect?

bronze yoke
#

iirc they make the wound heal a lot slower

#

but without a wound i don't think they do anything at all, they don't make you sick or anything like some people might assume

#

there's similarly little reason to clean bandages

#

all dirty bandages do is increase the chance of infection, but because of a bug(?) a wound can't be infected more than once, and in my experience wounds usually get infected the first time pretty fast even if you try to avoid it

#

a lot of the medical system is just designed to look more significant than it is ๐Ÿ˜…

sonic ibex
#

That's a shame. Hopefully they flesh it out a bit in a future update. The need to have good hygiene and clean clothes would be cool. Dental care and such. Imagine having to extract a tooth ๐Ÿ˜ง

echo rune
#

a wire and a door ๐Ÿ˜…

sonic ibex
#

๐Ÿ˜ฌ tooth infections would be a bitch to deal with.

drifting ore
#

@thick karma sorry for another ping. Would you happen to know how importing or creation of character works for project zomboid? I am looking to import or create an animal into the game.

vestal gyro
#

Wound infections should 100% give you sickness

#

I know its a mod already

#

But the medical system should be much more fleshed out

sonic ibex
#

I need to find a server with high realism

#

Also How about a mod that makes you have to search through containers to find stuff? Say you have a crate and it's full. You'd only really be able to see what is on top, and would have to dig through to find anything else.

civic tree
#

looks cool, too bad i couldnt join them cause of my ping

civic tree
cobalt star
#

is Lua the standard for PZ modding? I'm a scripting modder for BG3 and we basically only use Lua there, however when researching PZ I hear about using Java (like here https://github.com/cocolabs/pz-modding-guide), I wonder if that's even considered nowadays

bronze yoke
#

nobody makes java mods

red tiger
red tiger
#

Most mods don't require modding Java.

#

If you're doing core-related changes, you'll need to.

#

Just note that you'll be in a heavy minority and some discussions surrounding Java modding can be touchy depending on who you talk to.

cobalt star
red tiger
#

I touch and do both these things.

bronze yoke
#

ok, *one guy makes java mods

#

no mo culling is in common usage, there's a couple more niche ones that have some popularity, but apart from that it's not really done, mostly because it's a hassle to install

#

and by hassle i mean 'takes a minimal amount of effort' but we are in the era of the steam workshop ๐Ÿ˜…

cobalt star
red tiger
#

The only unofficial alternative to Lua is TypeScript and it is compiled to Lua in order to run.

#

@cobalt star Since you're familiar with Lua I'd imagine you knowing about the vscode extension lua the language-server for Lua.

#

That should help you get familiar with the API when writing the code itself. For examples, I wouldn't know where to look.

cobalt star
red tiger
#

@bronze yoke Manages the Event API while I manage the other API.

cobalt star
red tiger
red tiger
#

The documentation in this game is verrrry lacking, if not missing altogether. Keep this in mind too.

#

(My current project is third-party documentation)

cobalt star
red tiger
red tiger
#

I use it for a React HTML project and it's been compiling and running in PZ.

#

If you need to reference that project's package.json, it's PipeWrench-UI on my organization.

#

I'll get back to it eventually.

#

Working on this for now:

#

:3

red tiger
tiny stirrup
# red tiger

Maybe you can help me, then! The mod I want to make is so simple if I can edit the java, but I'm not sure how to make my edits override the vanilla code, and I'm not sure if it can be done via Lua (I think probably it can't).

#

I've been looking at APIs to see if anyone's already exposed what I need, but... I kinda doubt it.

#

The only way I can think to do it with Lua would be to intervene when the entire class is loaded, probably on loading into a game, and replace the entire class with a slightly tweaked one... but that'd definitely be pushing the limits of what I know how to do, and then some.

red tiger
#

Depends. If it's a Lua class then yes? If not then no.

tiny stirrup
#

Is IsoClass

tiny stirrup
#

Is IsoPlayer

red tiger
#

Java, and no.

#

I keep pushing this commons-like Java patch project but I haven't released anything publicly yet although it already has enough to release something for people to mess with.

tiny stirrup
#

Is Zomboid Storm?

red tiger
#

?

tiny stirrup
#

But yes! A way to patch the java code is precisely what would let me do this.

red tiger
#

I don't use pzstorm.

#

Capsid is also not recommended.

#

Umbrella pre-compiles typings.

tiny stirrup
#

Well, the mod I intend to make would tweak the formulas for how often you cut your feet walking barefoot outside.

There's a mod that attempted to just wholly disable that feature, but I don't really like that idea. I just want to tweak the devs' really bizarre underestimation of human feet, so you don't need four bandages to walk across a single manicured suburban lawn or down a pristine sidewalk.

#

All I'd need to do is change like... 9 lines in updateFootInjuries in IsoPlayer.

#

As a stretch goal, I'd expose some of the variables I'd be changing in a sandbox settings tab, like how harsh the two types of outdoor terrain are, how likely it is to get a scratch based on movement speed, and the base for the foot injury timer, so players can decide for themselves.

#

The existing mod that tries to just disable the entire system looks like it monitors constantly the call to check to see if the character is wearing shoes or not, and temporarily adds 100% scratch protection for that event, which is just... so blunt and inelegant. And also it's broken and doesn't work anymore anyway, and... I'm not sure it ever did, given the comments in its workshop page.

#

Would a mod made with your project need any special installation by users? Or could it just be a simple "click Subscribe" mod like most, @red tiger?

#

(Presumably with a dependency)

#

I have considered other ways of doing it, like periodically resetting footInjuryTimer, but that's much clunkier and less flexible.

red tiger
tiny stirrup
#

Meaning for me myself? Or just not-multiplayer?

red tiger
#

just for you.

tiny stirrup
#

I'd like to publish it... but am willing to consider not. I do already have a supporting mod published, though, and there is interest in the community.

#

Why, just thinking of having me recompile the game with the edits? xD

red tiger
#

That's why I asked. You could do that yourself it seems.

#

Like you understand what to do.

tiny stirrup
#

To some extent...

red tiger
#

What's holding you back?

tiny stirrup
#

Is decompiling, editing, and recompiling consistent enough to just work?

red tiger
#

You'll need to recompile against the game's compiled class files.

#

If IsoPlayer has errors on decompilation then you'll need to fix those.

tiny stirrup
#

I'm not a professional... I've been a coding hobbyist all my life, starting with AppleBASIC on my parents Apple II-C, and I took some programming classes in college, so I'm not a novice, but this is still beyond anything I've done before, or at least in over two decades.

See I... know the general gist of what it means to recompile against the game's compiled class files, but I don't know how to actually do that.

red tiger
#

Hmm ok

tiny stirrup
#

I take it what I want to do is pretty rough, in a publishable form?

red tiger
tiny stirrup
#

What about the idea of resetting the timer periodically? The period would give me at least a little control, especially if I can detect walking vs. running vs. sprinting purely in Lua.

red tiger
#

If damage can be interpreted per instance in Lua then you could fling off a few of them based off of a percentage calculation to offset it.

tiny stirrup
#

I mean yeah, if I could just patch the class, it'd be super simple. But I'm aware that "just patch the class" is a big hurdle.

red tiger
#

I'd argue that these sorts of events should be done in Lua to begin with.

tiny stirrup
#

I mean, most of them are. It's frustrating... almost any other injury in the game seems to be triggered in Lua. Just this one thing is hard-coded for some reason. It feels like maybe a very early decision made in an early version, that just never got updated to a new system as they progressed.

red tiger
#

I wish that a lot of things were Lua-side. =/

tiny stirrup
#

I mean literally it would take me about two minutes to edit what I need to edit in the java.

#

Just edit these, and a few lines down, change 8500 in if (Rand.Next(Rand.AdjustForFramerate(8500 - this.footInjuryTimer)) <= 0) { to something higher (which is what I'd expose in mod options), and maybe reduce the scratch time it adds if that doesn't feel like enough.

#

Speaking of which... a lot of numbers have an F after them, like these... what does that do, just let it know it's a floating point?

#

Anyway... it sounds like it's kind of a no-go for publishing it without a patch system or some complicated shenanigans... is there an easy guide to follow for how to recompile just this class? Obviously I'd have to redo the changes after every game update, but those seem... <_< Less than frequent, here. *cough*

ripe lava
#

Looking to get a clothing/costume mod made. Would be a big onesie essentially but the hard part would be the art portion and creating the actual character we would like as a costume. I guess the closest thing it would be to is making a zombie skin replacer such as OccultZed

tiny stirrup
#

What is it you want the outfit to be?

tiny stirrup
#

Oh wait... I just realized, the game isn't mostly one giant archive file like I'm used to, it's in tons of small files... so can I just compile IsoPlayer.class?

I'm not sure I fully understand how this is working, though, as there's IsoPlayer but also IsoPlayer$1, $2, $InputState, $MoveVars, etc. InputState, MoveVars and such are categories in the decompiled code, but 1 and 2 are not, so does it just split it into two chunks for more granular editability? How do I know which one to replace? Or do I do the whole IsoPlayer.class? @red tiger

ionic sentinel
#

Is there a way to check if the player is crouched?

#

or to detect when the player crouches?

small topaz
# ionic sentinel Is there a way to check if the player is crouched?

player:isSneaking() will return true then. However, there are a few things to note: it will always return true when the player presses the sneak button, also when the player is sitting or aiming. In those cases, the player is actually not in the sneaking animation but will automatically go to sneaking animation when sitting/aiming ends (in case player does not stop sneaking by pressing the sneak button again). Possible that there are other situations like that but I know for sure that this applies in the case of sitting and aiming.

In case you mean with crouching that the player is sneaking near a wall, you could try this instead:
player:isSneaking() and player:checkIsNearWall() >= 1
This is true when player sneaks near a wall and therefore goes into a take-cover position. My remarks from above concerning sitting/aiming also apply here.

small topaz
# tiny stirrup Well, the mod I intend to make would tweak the formulas for how often you cut yo...

Haven't you found a way to realize this by using lua only? Irrc, whenever player gets an injury, the game triggers the event OnClothingUpdate. Not 100% though but maybe worth a try. In case this applies, you could try to use this event. Only problem I see here is that whenever you get a foot injury and the event triggers, it is not obvious how to detect that the injury is due to walking without shoes and not due to a zombie or broken glass lying on ground assuming that in the latter cases, you probably won't change anything about the injury. I still speculate that it will be possible somehow...

tiny stirrup
# small topaz Haven't you found a way to realize this by using lua only? Irrc, whenever player...

Yeah, but I don't want the character's feet to be immune to zombie attacks, or scratches from walking through trees or stepping on glass. I want realism. And unfortunately, while most injuries happen in Lua, that one specific case happens purely in java.

The mod "Callused Feet" tries to do exactly that, with some pretty involved stuff, but the last patch broke it to the point that the game just disables it. I'm not convinced it worked before that patch, either, as there were varying reports of its reliability.

small topaz
#

I see where the problem is...

But when using the lua event, couldn't you just check whether there are zombies near the player, glass or rough terrain is on the tile the player walks on and stuff? In case not, chances are good that the injury comes from walking without shoes alone and then you could try to remove the injury manually (or remove it with a certain chance). In case zombies are present for example, you could simply not change anything about injuries. Still possible that the injury is then in fact due to having no shoes and not from a zombie but it could still be an ok-ish approximation to what you'd like to achieve.

Just an idea though and not sure whether this is acceptable for your project...

EDIT: Ok... there are still complications. For example when there is more than one injury on the player's feet, things can still get messy I guess...

frank elbow
#

I've done simple java mods by just manually recompiling with the target version set to the one the game expects. Didn't need any dependency other than javac

frank elbow
#

Note that this may not work for every file in the game since it assumes every dependency the file needs is in the class path specified. This should be true for most, though

tiny stirrup
#

You can't do it within the IDE? I'm using IntelliJ IDEA 2024.1.2

frank elbow
#

๐Ÿคท๐Ÿพ

#

I don't use that IDE

tiny stirrup
#

It's also saying the file is read-only... but within its own menu structure, it thinks it isn't (I can "make read-only" rather than "make editable")

frank elbow
#

Are you looking directly at a .class file, according to the IDE?

#

That is, I know it's decompiledโ€”but does it say .class?

tiny stirrup
#

Yeah, both in the decompiled directory and the one in the ProjectZomboid directory

frank elbow
#

Then my guess would be you're looking at something that's being decompiled on-the-fly. Just a guess though (I know IDEA can do it, no idea whether it's the case right now)

#

i.e., if you drag the file into notepad it wouldn't be what you're looking at there

#

Unfortunately I don't actually remember how I decompiled itโ€”I think I used fernflower directlyโ€”but people here have recommended beautiful-java, which you can find with a search here. That likely decompiles it to a permanent file, as opposed to IDEA's temporary decompilation

tiny stirrup
#

Yeah, I used beautiful-java

#

It created teh game's whole directory tree, decompiled

frank elbow
#

In that case I'm back to ๐Ÿคท๐Ÿพ Dunno enough about that IDE to know what's going on there

#

Mine decompiled to .java. I don't think javac would care, at any rate

tiny stirrup
#

Yeah, they're .java in the decompiled directory

#

I wonder if it's because it's within Program Files...

drifting ore
#

I want to make an item turn into something else/replace if its been in a x container for x amount of time. Which lua files handle these things?

tiny stirrup
ionic sentinel
bronze yoke
#

the game has not had an update of any form released since 2022 ๐Ÿ˜…

#

looking at its code, i think it was probably ai generated and never tested

#

most of the structure makes sense but the actual protection part entirely relies on functions that just don't exist at all

muted garnet
#

I can get the character's walk or cancel keypress using if player:pressedMovement(false) or player:pressedCancelAction() then -- some code end
but how do I get the "WalkTo" action in "WalkTo" action? After the player pressed "WalkTo" when walking by "WalkTo" action

muted garnet
#

I have an action in which the player approaches an object, I need to cancel the action if the player uses "WalkTo" while walking

#

if the player does not use "WalkTo" while moving to the object, then the action does not need to be canceled

thick karma
#

Ah no

bronze yoke
#

there's an event when the keybind is used, i don't think the context menu fires it but that probably triggers a global lua function you can hook anyway

thick karma
#

I think I see what they're saying now... I think what they really want is an onComplete function for their action that only occurs if the approach to the object is successful

#

I have an example one sec.

#

They have an action they're firing right after a walkto times event

muted garnet
#

for better understanding, I need check in InTick that player will not use right click "WalkTo" timed action again, cuz it breaks the walking for two players


local function onTick(player, clickedPlayer, args)

    function InTick()

        if player:pressedMovement(false) or player:pressedCancelAction() then
            sendClientCommand("123", "noBusys", args)
            return
        end


        local distance = player:DistTo(clickedPlayer)
        
        if distance <= 1 then 

            ISTimedActionQueue.clear(player)
            Events.OnTick.Remove(InTick)
            ISTimedActionQueue.add(SomeTimedAction:new(player, clickedPlayer, args))

        end

    end

    Events.OnTick.Add(InTick)
end

Events.OnServerCommand.Add(function(module, command, args)

    if command == "noBusys" then
        ISTimedActionQueue.clear(getPlayerByOnlineID(args.clickedPlayerID))
        ISTimedActionQueue.clear(getPlayerByOnlineID(args.playerID))
        Events.OnTick.Remove(InTick)
    end

if not (module == "123" and (command == "onAcceptWindowRequest" or command == "onAcceptWindowRequestclickedplayer")) then return end

local player
local clickedPlayer

        if command == "onAcceptWindowRequest" then

            player = getPlayerByOnlineID(args.playerID)
            clickedPlayer = getPlayerByOnlineID(args.clickedPlayerID)

        else

            player = getPlayerByOnlineID(args.clickedPlayerID)
            clickedPlayer = getPlayerByOnlineID(args.playerID)

        end

            ISTimedActionQueue.add(ISWalkToTimedAction:new(player,clickedPlayer:getSquare()))
onTick(player, clickedPlayer, args)

end)
thick karma
muted garnet
#

Yep

#

I already have a check for canceling the action and walking with the keys

        if player:pressedMovement(false) or player:pressedCancelAction() then
            sendClientCommand("123", "noBusys", args)
            return
        end
#

but if player clicks "WalkTo" this check not working

thick karma
#

I mean I have an idea but intuition is telling me this has to be overkill lol

muted garnet
#

overkill?

thick karma
#

I am skeptical that all this is necessary to make two players walk to each other properly

muted garnet
#

what do you mean?

thick karma
#

If that is your fundamental goal

#

That two players walk to each other

#

I just don't see all of this OnTick business as likely necessary...

#

That is the goal, yes? It's not a follow mod or something is it? It's just that you want two players to close the gap between each other automatically?

muted garnet
#

If you do not set these checks, then if the players interrupt the action of walking towards each other, they will not be able to start the action again until the server is restarted

#

No

thick karma
#

That seems like shortcoming of the timed action design

muted garnet
#

I need the players to approach each other before the action begins

thick karma
#

Hmmm

#

I mean intuitively it seems to me that you should be able to accomplish that with a modified WalkTo action without the weird onTick/InTick function. I'm torn about what to tell you because you're closer to weird solution than one that would feel intuitively logical to me.

#

We may be able to make the weird solution work with a final hack but if it's so sensitive to interruptions I'm not sure if it's the ideal strategy in the first place.

muted garnet
#

what solution do you mean, please tell me more details?

thick karma
#

One way would be to decorate the base ISWalkToTimedAction:new function.

#

Run the function as normal and set some accessible variable to true, and if thatVariable then you send noBusys.

#

When you first trigger the event you set thatVariable = nil to ensure that the variable does not exist unless someone runs a new walkTo action after initiating the movement you triggered.

#

You might call thatVariable something like yourModule.justFiredWalkTo... it might be best to make that a table so you can track each local player separately, as in yourModule.justFiredWalkTo[playerIndex], if you want to be robust.

muted garnet
#

you mean like this?:

someVariable = nil

local function onTick(player, clickedPlayer, args)
-- some code
someVariable = true
end

function ISWalkToTimedAction:start()
if someVariable then return end

    self.character:getPathFindBehavior2():pathToLocation(self.location:getX(), self.location:getY(), self.location:getZ());
end
thick karma
#

No you would decorate the signature function ISWalkToTimedAction:new (character, location, additionalTest, additionalContext)

#

Do you know how to decorate functions yet?

muted garnet
#

a little

thick karma
#

Well you decorate that one such that it runs normally and then you set the variable and then you return the new object.

#

Now personally my instinct is to handle this differently. I would be inclined to make a custom WalkTo action with a modified definition of success

#

A successful event would complete when I reached the other player and OnSuccess I would then trigger the server's "we're dealin" behavior

#

And if I reached the halfway point and the other player weren't there, I'd wait X seconds (or ticks) and bail under assumption of failure if user never showed up.

#

And eventually that action would terminate reliably without bugging out a player.

#

In other works, I would make a new WalkToTimedAction and then customize that action's update function

#

So I would just go

  local action = ISWalkToTimedAction:new(character, location, additionalTest, additionalContext)
  function action:update()
    -- Check conditions of failure or success that make sense for my
    -- custom event.
  end
#

That way I don't need a decoration of the vanilla module

#

Nor do I need to write my own custom module that is essentially a duplicate of ISWalkToTimedAction

#

And while you're at it you would call action:setOnComplete(onCompleteFunc, arg1, arg2, arg3, arg4)

#

And make sure the way you defined update() ran through action:perform() on success so that your custom onComplete function would fire.

muted garnet
#

but the player will still be able to call the vanilla Walk To, right?

thick karma
#

Yeah but that should not matter if you fully followed what I'm suggesting above.

#

Because the process would go:

  1. Players approach each other.
  2. If and only if 1 goes well, fire the client command that connects the two clients in a state of interaction.
  3. While clients are interacting, routinely check their distance. If their distance becomes > maximum allowed, cancel action.
  4. Players who remain near each other proceed through interaction by other normal means.
#

I don't see an obvious point of failure if you make the process follow these fundamental rules.

#

Why would activating WalkTo on either client mess up this process in a way that would bug a client? I would think it shouldn't and if it does you have some other problem.

muted garnet
#

2,3,4 points are already implemented, the only problem is that the player can use Walk To, when one client uses Walk To, the second client will continue to walk to the point until the first client stops walking, also, if the first client is nearby, then the second client will start an action, this problem is not very critical, but quite funny

#

and I believe that if it can be solved in a simple way, then why not

thick karma
#

I would pick a fixed location approximately halfway between the players; I would not update their goal based on the movement of the other player.

muted garnet
#

I mean that if the distance between the players before the start of the action is 1, then they first moved to a distance of 5 and only then started the action

wintry finch
#

Gonna' start a map mod for PZ in preperation for build 42 changes/additions. Though with PZ modding I'm 99% noob(I've made professions before spiffo ) and modded other games.

But what's the best tutorial now days for PZ map modding to go to? And the best way to get the tiling going? I saw a map tutorial by Daddy Dirk from 2021 just not sure if that's still the most relevant.

bright fog
#

Daddy Dirk is good I believe

small topaz
#

Hi! What is the command to check whether a particular modded sandbox option has been set to true in lua? Thanks!

zinc epoch
#

What encoding should i use to encode polish letters properly?

bright fog
zinc epoch
#

Thank you! :)

small topaz
agile vigil
#

Is there a way to set a custom weight on an InventoryContainer in code? setActualWeight seems not to exist on the InventoryContainer I'm working with, in the ISInventoryTransferAction

bright fog
#

Did you look at the PZ java doc ?

solar rover
#

@sour island Hiya Chuck! I used some slap-chop magic with Expanded heli events models/skins + TTAJ1bl4's UH 60 scripts to make a civilian heli. Asking for permission to use those parts if I also get TTA's perms for his code base. Always happy to credit and link, thanks for all the work!

agile vigil
bright fog
agile vigil
bright fog
agile vigil
#

Exactly ๐Ÿ˜„

bright fog
neon bronze
#

How do you call it in your code?

bright fog
#

InventoryContainer inherits a bunch of InventoryItem class methods

#

And it inherits setActualWeight

#

So you can apply setActualWeight on InventoryContainer

#

It could also be a problem of the method being available but not actual doing the correct thing on the java side

agile vigil
#
local destination = self.destContainer;
destination:setActualWeight(0.1)
destination:setCustomWeight(true);

Crashes with Object tried to call nil in transferItem on the second line.

bright fog
#

There's a lot of methods that are exposed and that you can use, yet in the java they don't do shit or what they do is unused by the game

agile vigil
#

And from in-game debug GUI to show that is an I- Ah.

agile vigil
#

It is not

bright fog
#

Your function ?

agile vigil
#

The name of the function I'm inside of.

bright fog
#

Yeah right

agile vigil
#
require "ISInventoryTransferAction";


local originalTransferItem = ISInventoryTransferAction.transferItem;

---@param action ISInventoryTransferAction
function ISInventoryTransferAction:transferItem(item)
    originalTransferItem(self, item);
    if self:isAlreadyTransferred(item) and self.weightAlreadyAdjusted then
        return;
    end
    if not self:isAlreadyTransferred(item) then
        return;
    end

    ---@type InventoryContainer
    local source = self.srcContainer;
    ---@type InventoryContainer
    local destination = self.destContainer;

    if (source:getType() == "FirstAidKitSwiftlyPacked") then
        source:setActualWeight(10.0);
        source:setCustomWeight(true);
    end

    if (destination:getType() == "FirstAidKitSwiftlyPacked") then
        destination:setActualWeight(0.1)
        destination:setCustomWeight(true);
    end

    self.weightAlreadyAdjusted = true;
end
#

Full code here, but simplified to the stuff that matters in the above example, because it was a little obtuse otherwise.

#

But yeah, I see the error.

#

It is not an InventoryContainer, it is an ItemContainer.

bright fog
#

Indeed

#

And you can't modify its weight

#

Rip

agile vigil
#

It has a containingItem and inventoryContainer field, so I can access those, probably.

bright fog
#

I'm not familiar with these class and item/container handling so eh

bright fog
#

welp gl gtg, you got the doc so maybe you can figure something out

agile vigil
#

I already had the decompiled code and kahlua definitions, so it was more just noticing that my thing wasn't what I thought.

bright fog
#

๐Ÿ‘Œ

#

if you find something I'm interested

sour island
agile vigil
#

Aye, we got there.

sour island
#

Chat just updated for me

agile vigil
sour island
#

The way containers are handled is probably the better way to handle behaviors in items - but the class names are very hard to follow lol

sour island
agile vigil
# bright fog if you find something I'm interested

Perfect. Then I have my path to success.

I was planning to make items capable of holding "bulk stuff", similar to Pantry Packing, but without hardcoding lots of crafting recipes.

To start with, I stored things in modData for my faux-container, but it was quickly a little dirty and hard to see things.

With this approach, what I'll do is modify the weight of the bulk storage item dynamically when the player puts something in or takes it out. I'll probably use modData on the container item, just to sanity check and be a bit defensive, in case an exploit is found that lets you remove items or add items without the weight update applying.

require "ISInventoryTransferAction";

---@param instance Object
---@param fieldName String
local function getField(instance, fieldName)
    local i = 0
    while true do
        local field = getClassField(instance, i)
        if field:getName() == fieldName then
            return getClassFieldVal(instance, field)
        end
        i = i + 1
    end
end

local originalTransferItem = ISInventoryTransferAction.transferItem;
---@param action ISInventoryTransferAction
function ISInventoryTransferAction:transferItem(item)
    originalTransferItem(self, item);
    if self:isAlreadyTransferred(item) and self.weightAlreadyAdjusted then
        return;
    end
    if not self:isAlreadyTransferred(item) then
        return;
    end

    ---@type ItemContainer
    local source = getField(self.srcContainer, "inventoryContainer");
    ---@type ItemContainer
    local destination = getField(self.destContainer, "inventoryContainer");

    if (source and source:getType() == "FirstAidKitSwiftlyPacked") then
        source:setActualWeight(10.0);
        source:setCustomWeight(true);
    end

    if (destination and destination:getType() == "FirstAidKitSwiftlyPacked") then
        destination:setActualWeight(-10.0);
        destination:setCustomWeight(true);
    end

    self.weightAlreadyAdjusted = true;
end
agile vigil
sour island
#

There's an example of how to get java fields in Lua in the community repo

#

I've been meaning to make it a usable API for the frameworks portion

agile vigil
#

I just used this old goldie

---@param instance Object
---@param fieldName String
local function getField(instance, fieldName)
    local i = 0
    while true do
        local field = getClassField(instance, i)
        if field:getName() == fieldName then
            return getClassFieldVal(instance, field)
        end
        i = i + 1
    end
end
agile vigil
solar rover
#

Sorry to ping you at random Chuckleberry!

sour island
agile vigil
# sour island Strategy?

Like, is there a better way than numerically going through the class fields and selecting once you find a name match?

sour island
agile vigil
#

I could just add a memoization here, since I'm always getting the same field.

sour island
solar rover
sour island
sour island
solar rover
#

yessir

#

well its EHE's model too

#

just TT's code

sour island
#

Where were you able to find the old models?

solar rover
#

They're still in the mod pack lol

sour island
#

Ah

solar rover
#

My server thought I was trolling them when Udderly kept spawning the parts and random Civ heli that didnt work

#

So I figured I would make it work ๐Ÿ˜‰

sour island
#

The newer models look a lot nicer. ๐Ÿ˜ข

#

But, I'll forward the request and video over to the modellers.

solar rover
#

Thanks a bunch!

#

I'm happy to upgrade to a nice model too hahah

bright fog
#

Like adding antibiotic pills inside a small fake container

agile vigil
bright fog
#

You could make a framework for it

agile vigil
#

That was the original plan, but I can't really be bothered with it now that I can just use real containers and adjust their weights ๐Ÿ˜„

agile vigil
# bright fog You could make a framework for it
local function addFirstAidKitPackedStorage()
    local proxies = MutiesBulkStorage.Proxies;
    MutiesBulkStorage.AddStorage(fak.itemType);
    -- Add disinfectants to the storage
    local disinfectantType = "Base.Disinfectant";
    MutiesBulkStorage.AddStorableToStorage(fak.itemType, disinfectantType);
    MutiesBulkStorage.AddFieldToStorable(fak.itemType, disinfectantType,
            "alcoholPower", proxies.getAlcoholPower);
    MutiesBulkStorage.AddFieldToStorable(fak.itemType, disinfectantType,
            "deltaUses", proxies.getUses, proxies.setUses);
    MutiesBulkStorage.AddLimitToStorable(fak.itemType, disinfectantType, fak.LimitNames.Disinfectant);
    -- Add painkillers to the storage
    local painkillersType = "Base.Pills";
    MutiesBulkStorage.AddStorableToStorage(fak.itemType, painkillersType);
    MutiesBulkStorage.AddFieldToStorable(fak.itemType, painkillersType,
            "deltaUses", proxies.getUses, proxies.setUses);
    MutiesBulkStorage.AddLimitToStorable(fak.itemType, painkillersType, fak.LimitNames.Painkillers);
    -- Dynamically add bandages as storables
    local allItems = getScriptManager():getAllItems();
    for i = 0, allItems:size() - 1 do
        ---@type Item
        local item = allItems:get(i);
        if item:isCanBandage() then
            local type = item:getFullName();
            MutiesBulkStorage.AddStorableToStorage(fak.itemType, type);
            MutiesBulkStorage.AddFieldToStorable(fak.itemType, type,
                    "bandagePower", proxies.getBandagePower);
            MutiesBulkStorage.AddLimitToStorable(fak.itemType, type, fak.LimitNames.Bandage);
        end
    end
end
Events.OnInitGlobalModData.Add(addFirstAidKitPackedStorage);

I wrote it forever ago, but it was always intended as a kind of framework with storages (the first aid kit) and storables (the stuff that goes inside).

The main limitation I kept running into was having to create these proxy functions so I could get and set uses for items, or adjust alcohol power, or God forbid I stored food with their million getter/setter combos.

#

It honestly made the code so hard to decipher and require so many pieces of indirection that whenever I've taken a break and come back, I've just kinda stared at it for 20 minutes, then closed IntelliJ and walked away.

bright fog
#

Can't read that I'm on phone but I have other stuff to do before looking into it ngl

zenith igloo
#

just want to make sure the player is not holding a firearm (so a melee weapon or a tool etc.) I tried everything I could find yet none of them worked till now anyone has any ideas?

#

if getPlayer():getPrimaryHandItem():getSubCategory() != "Firearm" then if not getPlayer():getPrimaryHandItem():getSubCategory() == "Firearm" then

#

if weapon:isHandWeapon() then (weapon is a parameter)

#

if not weapon:isRanged() then

#

etc.

#

I started to feel like blind, if anyone has an idea I appreciate it

echo rune
#

Morning people. Anyone know wher i can find the character parameters like hunger, stamina, calories, health, etc. I search everywhere in the LUA files but i can't find them. i want to add a "mana" parameter that refills over time without any requirement

zinc epoch
#

How do i translate item names in a mod i'm making?

#

Like i have the translation files, but it doesn't display properly.

zinc epoch
#
ItemName_EN=
{
    ItemName_GlassOfBleach = "Glass of Bleach",
}

What am i missing here?

#

I think i might have figured out what i did wrong.

drifting ore
#

Is there a file where I can dress zombies the way I want? Like for example if I wanted all girl zombies to where dresses, is this possible?

zinc epoch
#

Is there any way to get if player drank a spefific item?

bright fog
#

The drink action to be more specific

vast flint
fleet bridge
vast flint
#

Is it possible to enable chat in SP so I can type admin commands ?!

vast flint
#

they changed it ? Was possible in 2015 ๐Ÿ˜ฆ

trim yacht
#

Am I missing something or is there not a way to check a players inventory from server side? eg:?

  • playerObj:getInventory():getItemCountRecurse(name)
  • playerObj:getInventory():getItemCount(name)
  • playerObj:getInventory():getItems():size()

All return expected on client, but 0 or nil on server

bright fog
#

Could verify it

vast flint
#

or let me asks the question another way, how would I start to add a right menu to a container so I can change it's max content amount ? I dont know the difference between amincontextmenu and debugcontextmenu

bright fog
vast flint
vast flint
#

that is the issue basically it would need to use ServerCommand to trigger other mods as normal

#

since it uses its own window that mod back from 2015 didnt use the built-in sendservercommand

bright fog
zinc epoch
vast flint
bright fog
#

But there's most likely a reason it's like that so you'll have to verify it actually works properly

vast flint
#

and how do I change it from another code ? Obviously for a mod I cant just tell the player to change their game file and to not verify game integrity

#

seems like the only way so far would be to copy-paste it without the isclient()

bright fog
#

That function should be global

#

So just replace the function

#

In another file, redefine the function

-- your file
 ISChat.createChat = function()
    ...
end
zenith igloo
wet sandal
thick karma
#

Love to see it.

thick karma
# wet sandal Finally getting my head around controller support

Food for thought: we need a mod to use player-to-player trade; that mod depends on sending focus back to the inventory panel after temporarily focusing on the player trade panel. I know you have plans for heavy editing. Food for thought before you get deep into it, you would simplify compatibility with this existing need greatly if all edits came down to modifications of type ISInventoryPage (iirc; in other words, the type of the table that comes back when you call getPlayerInventory(0)), so that the mod is still fundamentally sending focus back to that object. Other minor adjustments might be needed from there, but I could work them out more easily if this the starting point.

(Though I guess we can always branch to a custom UI if necessary.)

wet sandal
#

So how I've got this going for Equipment UI, and it will be the same for Tetris, is the only thing I modify on the vanilla panel's is navigation to allow selecting the equipment ui panel if its open

#

The rest is all handled automagically by my class ControllerNode, which gets injected into every ui element I need to have controller support

thick karma
#

Sounds awesome

#

I am stoked to see you workin on that

#

I almost tackled it myself a few months ago but just did not have the energy lol

#

I did take a look at your stuff

#

People want that support bad.

wet sandal
#

Basically, the nodes intercept the controller events, see if they can do something with them, if not, they defer to the vanilla handler

thick karma
#

Nice. Sounds like the right way to do things.

#

I will definitely make sure to do any minor changes needed on my end to ensure compatibility with your stuff if you get yours working independently.

#

Feel free to ping me with updates so I can try to be on top of that when you drop it.

wet sandal
#

๐Ÿ‘

#

Hoping to update Equipment UI asap and Tetris a week after

#

(Equipment UI has some changes that Tetris requires and I don't want to be in another situation where the workshop lets people run outdated copies of Equipment with latest Tetris)

thick karma
#

for sure.

wet sandal
#

Unlisted copy I use for MP testing, has the new controller support uploaded

gleaming sorrel
#

I had a dream about a zombie apocalypse
I'm making a texture for it but to make it accurate
I need to know how to just
Make crawling zombies really fast
As some of the zombies in the dream crawled on all fours

#

I think it would also be extremely horrifying to see a zombie crawl at you at the speed of a sprinter

inland flume
#

Now i wanna find a server with that ๐Ÿ˜ญ

agile vigil
sonic ibex
#

A common problem with MP zomboid is the servers continue while you are offline. Loot gets taken or expires, the players progress and things move on. Like say you want to travel a long distance but only get an hour to play a day.. .

So I'm wondering if it'd be possible to have a mod that lets you set offline goals for your player? Say you want to practice carpentry or read a book. You set the activity in some UI, go offline and then when you log back in it does some logic based on how long you were away and gives a little experience or progress on the book. Maybe even a little loot?

Would that be a difficult thing to implement?

bright fog
#

Difficult ? Probably not

bright fog
gleaming sorrel
bright fog
#

And increase the speed scale factor

#

This will make animations run faster and thus the movements of the zombies too

gleaming sorrel
bright fog
#

No need for anything fancy

#

Would require you to modify a few AnimSets

sonic ibex
bright fog
#

Involves a lot of stuff but you shouldn't let that slow you down. The problem is that you might need to get some experience in lua to do it properly

sonic ibex
#

I see, well I'm a dev but I have never used Lua. It's similar to python right?

gleaming sorrel
bright fog
gleaming sorrel
sonic ibex
#

XML is a markup language like html so I assume it's done through code.

bright fog
#

It's really easy to do

gleaming sorrel
# bright fog It's really easy to do

I'd assume it is but I really don't know what I'm doing

I'm not exactly sure what speed scale is
Though I'd think it's just a number in the code that I can increase

#

I hope

sonic ibex
# bright fog Sort of yeah

Can you point me in the right direction to get started? Maybe I need to look at a spawn script or something? Find out the time they logged off and the current time?

solar rover
#

Scrolled too fast, found it~

bright fog
bright fog
#

Just go check the AnimSets folder then crawler zombie

#

You'll see it's very easy to navigate

#

If you want an example mod that speeds down or slows down zombies, check the mods for slower sprinters

agile vigil
#

Anyone know how to build the integer required to make an ImmutableColor, if I already have the rgba values?

bright fog
#

Not sure what you mean by that but I know how to create an ImmutableColor with rgba values

agile vigil
#

Please enlighten me, then. All I could find was the decode function, which takes an integer in string form.

agile vigil
#

Yes

bright fog
agile vigil
#

How strange, I don't have the .new in my luadocs.

#

Oh nevermind, I do ๐Ÿ˜„

agile lily
#

Hello! Is anyone sitting on any decent resources regarding getting started with Lua programming for PZ? ๐Ÿค 
I'm starting out small and am currently trying to figure out how to write "hello world" in the console when booting the game up lol

thorn cipher
#

Best place to start

agile lily
humble crater
#

@solar rover hey did you ever end up figuring out how to delete books once they're read?

agile lily
#

How would I go about setting the overal body health of a player if certain conditions are met?

solar rover
humble crater
#

will let ya know if i get anywhere with it

ancient grail
bronze yoke
#

setting overall body health doesn't do anything, the game recalculates that value every tick

agile lily
#

The way I've been doing it so far has been like this:

` if intensity > 0
then

    local playerHealth = getPlayer():getHealth()

    getPlayer():setHealth(playerHealth - intensityToDamage)

    print(playerHealth)

end`
bronze yoke
#

```lua
paste code here
```

agile lily
#

Eventually the player dies, but the health in the health panel doesn't update to show it

bronze yoke
#

the player's 'health' is a weighted average of the health of each of their body parts

#

the game calculates that average every tick when it's processing health stuff, so if you change it, it just gets discarded and replaced by whatever it normally would be anyway for the purpose of actual calculations

small topaz
#

Hi! Is it possible to organize your xml files from the media/clothing/clothingItems folder into different subfolders (assuming you correctly specify this in fileGuidTable ofc)? Just asking because in the vanilla game, there are no subfolders but using them would make the organization so much easier...

agile lily
ancient grail
# agile lily Ah, that's fair then I suppose. So to cause "global" damage you could go about j...

just incase you need this

BodyPartType.Foot_L
BodyPartType.Foot_R
BodyPartType.ForeArm_L
BodyPartType.ForeArm_R
BodyPartType.Groin
BodyPartType.Hand_L
BodyPartType.Hand_R
BodyPartType.Head
BodyPartType.LowerLeg_L
BodyPartType.LowerLeg_R
BodyPartType.Neck
BodyPartType.Torso_Lower
BodyPartType.Torso_Upper
BodyPartType.UpperArm_L
BodyPartType.UpperArm_R
BodyPartType.UpperLeg_L
BodyPartType.UpperLeg_R
agile lily
#

Is there anywhere I can get the java references without having to decompile the game?

ancient grail
#
getPlayer():getBodyDamage():getBodyPart(BodyPartType.Hand_R)
ancient grail
#

i think

small topaz
#

in the clothing xml files, what is the parameter
<m_Static>false</m_Static>
doing?

vast flint
#

what property do I need to reset to keep perishable fresh indefinitely in a container shop ? Id run it like once per day and make sure item sold have 0 days freshness ?

modern knot
#

I just made my first ever mod, and I'm trying to test it but my items don't appear in the item list when I'm testing my mod in debug mode. What are some things I might be doing wrong, or what are some reliable resources I can use to troubleshoot?

hollow lodge
hollow lodge
#

idk how the animations are made tho

modern knot
vast flint
#

mostly asking this for others in the channel cuz I just started but how are you trying to load the item ? lua console ? debug mod with an item list ? loot list ?

modern knot
hollow lodge
#

what type of mod

#

clothing, items, guns

modern knot
#

It's an items mod

hollow lodge
#

oh, i'm not familiar with those, try copying a workshop mod that already exists

#

and does the same

modern knot
hollow lodge
#

mmm verify all lines of code

#

perhaps a typo

#

or a missing "," can ruin your code

modern knot
#

Thanks! Taking a close look EDIT: Verified all code multiple times now lol

vast flint
#

depending on what your mod add if you post it somewhere and its for b41 someone might be willing to try to load it and figure whats wrong ๐Ÿ˜„

gleaming sorrel
#

Is there anyway I can go through the radio messages and TV messages and change them

I wish to change every message from the Project Zomboid lore to my own
So the people can learn the general state of things while they play

agile lily
viral hill
#

can you confirm @agile lily?

agile lily
#

Yup! Seems to contain a lot of those things, I ain't going through it to see if it's all of the lore though. It's a lot to read x)

gleaming sorrel
#

Thank you I'll check it out
The radio data should be what I need

agile lily
#

Now I get to ask the questions. How do I start/define a period of rain through code?

#

There's a boolean called "isRaining" but I'm not too sure how to use it, if it actually starts the rain or if it just checks if it already is raining

viral hill
viral hill
#

okie :3 just making sure

rare token
rare token
agile lily
#

I only started dabbling with this today so forgive me if I'm being a bit slow <:)

vast flint
rare token
agile lily
vast flint
#

honestly id recommend setting up procyon, cfr or fernflower manually even though it is more advanced

#

and tell it to process all classes file in the game folder and subfolders

#

cuz it seems limited to do it file and file and I personally prefer being able to grep or GetChildItem | For-Each in powershell

vast flint
#

so youd probably have to use climatemanager

vast flint
#

ie: in lua for example fx = getCell():getWeatherFX(); .fx:setPrecipitationIsSnow(_value);

modern knot
#

Here are some snippets from my mod's lua files. Can someone identify what I'm doing wrong please? My items don't appear in the debug item list, but the mod appears to load.

From Recipes lua:

{
        imports
        {
        Base
        }

        recipe Unfold Picnic Blanket
        {
            FoldedPicnicBlanketPink,

            Result:PicnicBlanketPink,
            Sound:PutItemInBag,
            AnimNode:RipSheets,
            Time:20.0,
        }
    
        recipe Fold Picnic Blanket
        {
            PicnicBlanketPink,

            Result:FoldedPicnicBlanketPink,
            Sound:PutItemInBag,
            AnimNode:RipSheets,
            Time:60.0,
        }
        
        recipe Make Pink Picnic Blanket
        {
            keep Needle,
            Thread =5,
            Sheet=3,
            [Recipe.GetItemTypes.HairDyePink]=2,

            Result:PicnicBlanketPink,
            Sound:PutItemInBag,
            AnimNode:Disassemble,
            SkillRequired:Tailoring=2,
            Category:Tailoring,
            Time:120.0,
        }```
        
From Items Lua:
```module Base
{
    item PicnicBlanketPink
    {
    DisplayCategory = Camping,
    Weight = 2.4,
    Type = Normal,
    DisplayName = Pink Picnic Blanket,
    Icon = PicnicBlanketPink,
    WorldStaticModel = PicnicBlanket,
    }
    
    item FoldedPicnicBlanketPink
    {
    DisplayCategory = Camping,
    Weight = 1.2,
    Type = Normal,
    DisplayName = Pink Folded Picnic Blanket,
    Icon = FoldedPicnicBlanketPink,
    WorldStaticModel = FoldedPicnicBlanket,
}```
    
From Models Lua:
```module Base
{
        model PicnicBlanketPink
        {
        mesh = PicnicBlanket,
        texture = WorldItems/PicnicBlanketPink,
        scale = 0.15,
        }
        
        model FoldedPicnicBlanketPink
        {
        mesh = FoldedPicnicBlanket,
        texture = WorldItems/PicnicBlanketPink,
        scale = 0.15,
}```
Attached folders screenshot for reference.
#

Here's my models folder too, since I forgot to include it in the screenshot above. They are FBX files, the icons and textures are PNGs with indexed colors for compression
EDIT:
All feedback is welcome! This is my first mod, and I have no idea what I'm doing so far.
Also, I don't think the distributions lua file is an issue because I've noticed in the console that it loads without issue along with the mod, but there's no indication of any other part of the mod loading.

verbal yew
#
module Base
{
        recipe Unfold Picnic Blanket
        {
            FoldedPicnicBlanketPink,

            Result:PicnicBlanketPink,
            Sound:PutItemInBag,
            AnimNode:RipSheets,
            Time:20.0,
        }
    
        recipe Fold Picnic Blanket
        {
            PicnicBlanketPink,

            Result:FoldedPicnicBlanketPink,
            Sound:PutItemInBag,
            AnimNode:RipSheets,
            Time:60.0,
        }
        
        recipe Make Pink Picnic Blanket
        {
            keep Needle,
            Thread =5,
            Sheet=3,
            [Recipe.GetItemTypes.HairDyePink]=2,

            Result:PicnicBlanketPink,
            Sound:PutItemInBag,
            AnimNode:Disassemble,
            SkillRequired:Tailoring=2,
            Category:Tailoring,
            Time:120.0,
        }
} -- close Base {
#

another look fine

modern knot
gleaming sorrel
vast flint
#

I wonder if there is a mod in which there was ever self-driving

#

especially with the cell, lot etc thing I dunno if you could even know that something distant is a road and astar it

undone tapir
#

There is. Don't remember the name of the top of my head but you open the map and place waypoints and the car auto drives

#

Turns and all that shit

solar rover
#

its from the "NAVIGATION" mod

azure rivet
#

Hello, does anyone know the script to identify when a player is in idle?

grizzled burrow
#

Hi so I'm completely new to modding this game but real quick question how hard is it to mod like a custom radio station into the game

#

Or add a CD that has multiple tracks on it that works like a music CD

wet sandal
#

playerNumber is 0 unless playing splitscreen co-op where its 0 to 3

grizzled burrow
wet sandal
grizzled burrow
#

Thank you

wet sandal
#

About 80% done.

half remnant
#

Hey guys, just a general question.

Is there a way to pull out info about all players on a server?
For example, what's the distribution of occupations and traits among players etc.

Is there a mod for such things or third-party software?

agile lily
#

Currently it's a bit unclear to me in which cases I should write code for the client, server or for it to be shared. Is there any reading regarding this?

ancient grail
# agile lily Currently it's a bit unclear to me in which cases I should write code for the cl...

Server and client cant access their files

So you can have 2 goobal function named the same kn each folder and it wont overwrite themselves

Client and server can access files from shared

Client does more control on player stuff thats local

Server is where you would want definitions to go to and global events etc.
If you place something like a spawn function and you want it to Only happen once for example then out it on the server
Otherwise it will spawn many times cuz each player can trigger it

Im not explaining this clearly...lol

I suggest you look at how vanilla does it

But just to ask
What are you trying to build?

bronze yoke
#

server folder globals will overwrite client folder globals

agile lily
# ancient grail Server and client cant access their files So you can have 2 goobal function nam...

Ahhh, I think I get it... -sorta-. Right now I'm trying to make an acid rain mod which damages the player and applies burns & other nasty effects if they're caught outside. I've got the very basics working thus far (detecting if you're inside/outside, getting damage from the intensity of rainfall and so on...) but this has all been stuff I've written on the client-side of things, which seems to work fine in singleplayer. I'm not asking for any particular reason other than me suspecting I'll need to know how this works at one point or another cold

ancient grail
agile lily
#

I think that's a good idea, as soon as I figure out how to create my own "weather events". I was asking about this yesterday but couldn't figure it out haha. Currently ALL rain damages the player, which makes it a bit too predictable. Eventually I'd like to be able to define different storm presets that get picked from a list. Probably should get to decompiling the game so I can get a closer look at things, haven't found any examples so far that are accessible in the media/ folder.

I really appreciate the advice though, you've all been very helpful so far :D

#

On a second unrelated note, how would you go about implementing chance based randomness to the game? Using math.random from lua seems to make PZ a bit angry

bronze yoke
dense bison
#

Hi, I'm a beginner working on creating a new trait: 'Undead Stalker' for a game character. I'm struggling to implement these features efficiently and seek guidance to finalize the code. I put this code into a new Lua file in the media\lua\client directory.
My goals:
Create the 'Undead Stalker' trait with the following enhancements:
Increase character size by 25%.
Double strength and fitness.
Boost XP gain for strength and fitness by 60%.
Double defense and endurance.
Lower bite chance to 15%.
Double attack range.
Reduce panic and fatigue by 4 and 2 times, respectively, against zombies.
Expand inventory capacity by 1.5 times.
Enable reversion to human form within 5 seconds after zombification, removing zombification effects.
Organize functions and variables into a separate table to prevent conflicts with global elements.
Here is my code:

vast flint
#

is there any mod so I can debug my mod with an existing save IN PEACE WITHOUT BEING INVISIBLE like debug ghost mode does ?!

#

like what is usually called no target in other games

vast flint
agile lily
vast flint
#

and stop it with stopraining or forecasts system

ancient grail
ancient grail
bright fog
#

Didn't even knew that was a thing

#

But you sure it's not deprecated ?

bronze yoke
#

it isn't a thing

bright fog
#

Bcs I've never seen it used

ancient grail
#

Theres no such thing

#

Only for cell and markers

bright fog
bright fog
#

So he used it wrongly then

ancient grail
#

Tho why not right imean isnt that something that we should have available would be nice to have that really

ancient grail
#

Omg thats gona so cool
Like every player kills they gain size

agile lily
#

I'd love for some special infected to keep you on your toes

ancient grail
agile lily
#

Spider-boys that can climb buildings once 42 drops

#

chef's kiss

ancient grail
#

Climbing buildings can actually be done now i think

bright fog
#

Yup

bright fog
agile lily
#

Oh yeah, I saw that too. Looks really nice :D

ancient grail
#

So yeah you have to to set the outfit right? But its not gona be incremental unless you make lots of outfit models(same model but diff sizes)

dense bison
#

Is there any code that can help players revert to being human after turning into a zombie?

#

I meant, with this trait, is there a possibility of immunity after being infected, or a chance to return to being human after turning into a zombie? Is there any code that accomplishes this?

bright fog
#

Basically

#

Still some limitations but I didn't knew that was doable

bright fog
#

I don't think so

#

But you can become immune that's for sure

#

There's a lot of mods with such a feature

ancient grail
#

but thats what i could find in a short time so i guess one of em might work

#

but threre are 2 types of infection im always confused as to which one is the zed infection

bright fog
#

Lol understandable

bronze yoke
#

the one on bodydamage will always be zombie infection, you can't get a full body wound infection

agile lily
agile lily
#

I suspect there needs to be something more there to help define which cell it's supposed to affect

bronze yoke
#

there is only one cell, if it's returning nil the game has not loaded yet

bright fog
#

The cell around the player I believe ?

#

There's always a confusion on player cell and map cell tho

bronze yoke
#

the IsoCell object is not related to map cells

agile lily
#

Huh, weird. I've set the function to trigger every ingame hour so I'm pretty sure the game is loaded

bright fog
#

Hmm

#

I use it I believe and it does work

#

So hard to say what breaks for you ?

#

Overwriting getCell globaly maybe ?

bronze yoke
#

can you show the code that shows it returning nil?

agile lily
#

Sure

#

Nevermind, I tested it and it does return the cell, the weather change doesn't seem to cooperate though

#
    local getTheDarnCell = getCell()
    local var1 = getCell():getWeatherFX()
    
    var1:setFogIntensity(1);

    --prints affected cell
    print(getTheDarnCell)
end

Events.EveryHours.Add(ChangeWeather)```
#

I give up

bright fog
#

The weather change applies to the getCell() ?

agile lily
#

No, nothing happens when it calls "setFogIntensity(1)"

vast flint
#

so without changing the vanilla game .luas what is the fastest way I can test the above code in-game ? ๐Ÿ˜„

#

I wanna be a weather wizard too

#

but it seems like even for one line of code you need the whole modding template

vast flint
# agile lily Sure

I suspect youd probably need all values, I used this help you but it would probably need a full climate def before it display something and in the code they just call setfogintensity too but that is along the rest of cell having values. Maybe weatherfx is off for that cell in that particular moment etc. At this point Id suggest looking at the weather wizard mod and see how they did it

agile lily
#

Might have figured out something that works

#

Need to test it

vast flint
#

seems more complicated than IRL to make it rain ๐Ÿ˜„

agile lily
#

This does not create an error, it just doesn't do anything "getClimateManager():transmitServerStartRain(100)"

#

AAAAAAARGH FINALLY

wise parcel
#

i'm looking to replace the warehouse in muldraugh with a better, more expanded version. anyone got any pointers on how I'd be able to clone the nearby roads and buildings into the mapping tools?

#

for context, it's the mass-genfac warehouse packed full of metal on the mainroad of muldraugh

bronze yoke
#

there's a decompile of the vanilla map floating around somewhere on github

#

you can build off of that

#

someone in #mapping can probably give you a link

wise parcel
#

damn thanks man

#

found it myself ๐Ÿ™๐Ÿป

agile lily
vast flint
#

that is a big of a nuclear option ๐Ÿคฃ

#

"light rain doesn't work" - k let's do a hurricane then

agile lily
#

Hahahahha

wise parcel
#

just what i needed

bronze yoke
#

glad i could help!

wise parcel
#

was originally planning to try remake the whole cell 1:1 ๐Ÿ˜ญ

#

strange

vast flint
#

unless you are copying it by code which is probably not possible very hard this is a pure mapping thing

floral raft
#

Is it possible to change player's accesslevel to admin using OnConnected function?
I dont understand how to....

thick karma
#

You might need to disable certain anti-cheats to allow that to work

vast flint
#

can setadmin sets intermediate level like moderator ?

thick karma
#

No clue

floral raft
#

like

#

I didnt found it

thick karma
#

I just know setAdmin() will toggle admin mode when you're in -debug

floral raft
#

on wiki

vast flint
#

I changed most debugs lua to work without -debug in SP lol by direct editing. Know that this cant be a mod but nice practice regardless

thick karma
floral raft
#

ty

vast flint
#

couldnt stand having the lua debugger in the way

floral raft
thick karma
#

I didn't say that. I don't know when it will work. I just don't use it when I'm not debugging.

vast flint
vast flint
#

so... huh...

#

lua methods are globals right ? So I could call another mod methods right ?

bronze yoke
#

if they are global

thick karma
vast flint
#

but even if they are in a table I can go throught the table to call it ? Like for instance ISUICheatMenu:ObjectCheatMenu if im not too rusty in lua ?

#

(I last did lua in opencomputers in minecraft in 2020 so Im a bit rusty ๐Ÿ˜ฆ )

bronze yoke
#

if that table is global

vast flint
#

it is defined as ISUICheatMenu = ISUICheatMenu or {}; cant find any other definition for it...

thick karma
thick karma
#

Unless I suppose local ISUICheatMenu = nil appears somewhere above that in the file, which is highly unlikely.

vast flint
#

No just a bunch of required. For my target mod if all else fail the target has sendClientCommand(playerObj,"shop", "ImportStores", {}) and it's loading exportedshops.txt in its folder. I dont know if sendclientcommand actually works in SP though

hearty gulch
#

So I start a game with a sandbox variable set to -150. and it works all nice. But when I load the save next time it resets to its default value being 30.
What could be the issue? How do you save and retrieve a sandbox variable?

vast flint
#

So my method so far would be : 1) gather items in a container in-game, spawning it with item menu (so it only work with an uncraftable one like locker) 2) click a button in my mod to export the container in exportedshops.txt using zomboid legal IO to put it in the other mod folder 3) call the other mod with sendclientcommand 4) profit or critical failure

vast flint
bronze yoke
#

you'd use the former to get it

hearty gulch
#

This works the first time on starting a new save, but when loading it afterwards it fails and uses default values from the sandbox vars

bronze yoke
#

you're caching it too early

#

when the file runs the game hasn't loaded the sandbox options for the save yet

#

if you want to cache them do it during OnInitGlobalModData (the earliest event after sandbox options load)

vast flint
#

did you use initSandboxVars() as well at some point to add your ownj sandbox vars or the game lua is lying ?

bronze yoke
#

this works when creating a new save because the sandbox options are still set from the menu screen

hearty gulch
bronze yoke
#

in your case i don't think you need to cache them at all, you can just call on the sandbox option directly during your OnInitSeasons

hearty gulch
#

like this?

bronze yoke
#

yeah, looks good

vast flint
hearty gulch
#

I've tried this earlier, but I had both Server and Client versions running at the same time. Now I'm server only.

bronze yoke
hearty gulch
#

And I need this only in the Server lua folder right? No shared or client necessary for something this small?

vast flint
#

meh I have so many self-blockages about learnoing lua ๐Ÿ˜ฆ

#

but in hospital I was stuck with my laptop and no internet and learned most python basic in 6 hours (the programming language not the snake) ๐Ÿ˜ฆ so when I really want to I can

bronze yoke
#

i would guess that this will automatically synchronise to clients when done from the server, but you'll have to test that yourself

#

however be mindful that the server folder runs on the client as well

hearty gulch
#

Yeah that's the reason removing the caching didn't work the first time.

warm plover
#

hello. never really worked with mods before and am new to coding so please bear with me as i proceed to butcher this question.

is there a way to use FindAndReturn() to do partial matches? or perhaps some other way to read the inventory that returns an array?
like if i had Base.xxxyyyzzz, where yyy was always static, xxx and zzz has multiple variations (to include blank), how would i go about building a list of everything that has a matching yyy?
if needed, zzz only has 4 variations so i'd be willing to run multiple times for yyyzzz too, but would prefer running only once

#

spent some time trying to resolve it myself, but i don't know my way around documentation well enough to figure anything out ๐Ÿ˜ฌ

agile lily
ancient grail
hearty gulch
warm plover
#

now if we pretend those are the only things in the item list that have "Helmet", for my example...
xxx = "Base.Hat_Crash"
yyy = "Helmet"
zzz = "FULL"
i basically want to find and return for anything that contains "Helmet" in my inventory

ancient grail
#

Oh wait i think i misunderstood

You probably ment look for an item which is partially similar to your input

I think its
:contains("Helmet")

grizzled fulcrum
# hearty gulch like this?

sorry for replying but I just want to say that is a really nice font choice, I need a 4k monitor so bad

hearty gulch
agile lily
#

Is it possible to call a function in the client from a server script?

civic tree
bright fog
#

Allowing you to run functions that you can access from that /client file in a server side

modern knot
wet sandal
#

On Windows
myFile.lua and MYFILE.LUA are the same file.

#

On Mac and Linux they are not

gleaming sorrel
wet sandal
#

๐Ÿ˜ฐ

#

Sonic crawlers and Susceptible!? That mask's gonna fall off

gleaming sorrel
modern knot
silk mason
#

hi! i'm trying to add new sounds to an already existing mod, does anyone know if a table like this:

{
    sound MBatHit
    {
        category = SnakeMods,
        clip
        {
            file = media/sound/MetalBat_Impact3.wav, 
            volume = 1.0,
        }
    }
}```

could hold multiple sounds for variation?
#

i was also wondering if i could add some sort of pitch variation to said sounds, i'm pretty much new to LUA, but i know that a module called pitchVariation exists but don't know how to apply it here

thick karma
# silk mason hi! i'm trying to add new sounds to an already existing mod, does anyone know if...

Yes it can:

module Jumper {
    imports {
        Base
    }
    sound Rifting
    {
        category = Player,
        clip
        {
            file = media/sound/jump1.ogg,
        }
        clip
        {
            file = media/sound/jump2.ogg,
        }
        clip
        {
            file = media/sound/jump3.ogg,
        }
        clip
        {
            file = media/sound/jump4.ogg,
        }
        clip
        {
            file = media/sound/jump5.ogg,
        }
        clip
        {
            file = media/sound/jump6.ogg,
        }
        clip
        {
            file = media/sound/jump7.ogg,
        }
        clip
        {
            file = media/sound/jump8.ogg,
        }
        clip
        {
            file = media/sound/jump9.ogg,
        }
        clip
        {
            file = media/sound/jump10.ogg,
        }
        clip
        {
            file = media/sound/jump11.ogg,
        }
        clip
        {
            file = media/sound/jump12.ogg,
        }
        clip
        {
            file = media/sound/jump13.ogg,
        }
        clip
        {
            file = media/sound/jump14.ogg,
        }
    }  
}
silk mason
#

No worries, much obliged for the fast response!

grizzled burrow
#

I don't know why the file size is so big

thick karma
#

yeah

#

Very odd

grizzled burrow
#

I just deleted all of the images and the file size did not change at all

thick karma
#

Uhhhh are you sure you're zipping the same folder you're emptying?

grizzled burrow
#

Yep I'm 100% sure

thick karma
#

Okay well 185 MB was the size of the original file

#

So it sounds like whatever you're doing is not deleting the data that needs deleted for some reason

#

Almost half-way, the ETA is a total lie because speed isn't stable

grizzled burrow
#

Actually wait couldn't I just make an .rar file to compress it even more?

thick karma
#

At this point probably not worth it

#

Already halfway through'

#

Unless compressing from .zip to .rar will reduce size by > 50%

#

Doubt it

#

I don't want to jinx it but Google givin me all the bandwidth now

#

From hours to seconds lol jeez

grizzled burrow
#

Rip

#

I am clarifying really quickly I am getting legal rights to use the music that I put in the mod

thick karma
#

@grizzled burrow k

#

So you don't even see this?

grizzled burrow
#

No

thick karma
#

Then I'm going to take a shot in the dark and guess that you have this directory in Zomboid/mods

grizzled burrow
#

Ye

#

That's what the video guy said to do

thick karma
#

Needs to be in Zomboid/Workshop

#

You likely misunderstood; it's in Zomboid/mods when testing

grizzled burrow
#

Oh wait

thick karma
#

When you move it for upload it goes to Workshop

grizzled burrow
#

No I'm sitting here I'm looking at it I'm wrong it's in the workshop file

thick karma
#

So does your directory go Zomboid/Workshop/True Music Addon/Contents/mods/truemusic_addon?

#

etc?

grizzled burrow
thick karma
#

Wrong Workshop folder

#

That's **ProjectZomboid/**Worskhop

#

Which despite the one-word difference is enormously different from Zomboid/Workshop

#

And is a common mistake

#

Zomboid/Workshop is in your user directory

#

You can open it on Windows by typing Windows Key + R and dropping this in it: %UserProfile%/Zomboid/Workshop

grizzled burrow
#

So I'm looking for zomboid not project zomboid

thick karma
#

Correct. It's not in the game installation folder. It's in your user directory.

grizzled burrow
#

I feel so dumb I'm not even going to lie to you

thick karma
#

It's an easy mistake to make

grizzled burrow
#

I've been sitting here going off of this stupid guide on YouTube for the past like 30 minutes wondering what I've been doing wrong this entire time

thick karma
#

There are many very similarly named things throughout Zomboidland

#

Takes great care not to mistake one thing for another.

grizzled burrow
#

All right thank you I'm going to go back to working on my mod and get rid of all of the stupid placeholder text I put

#

This was my first ever time modding this game

thick karma
#

While I'm looking at this, I'm gonna throw some other tips out there that the guide may or may not cover or communicate effectively to you.

#

In workshop.txt file, make sure you set title and description, but do not set id. In fact, you can delete id= line entirely and Steam will create it for you when you first upload your mod.

#

I wouldn't name my parent folder True Music Addon. You are free to be descriptive; the mod will still work. I would go with True Music Addon - Amazing Music if that's your working title. (: not allowed in folder name).

#

Alternatively you can drop the True Music Addon entirely -- that is not necessary at all for the mod to work. Some people put True Music at the end of the mod name and that's fine too -- e.g., "Music for the End of the World [True Music]"

grizzled burrow
#

Well the entire mod is just going to be adding all of trocadero's music into the game

warm plover
thick karma
#

How does the mod not name itself

#

๐Ÿ˜‰

grizzled burrow
#

I want to sucker Punch you so badly sir

thick karma
#

lmfao what it's a perfect name

grizzled burrow
#

I've never felt my body physically heat up like that before

thick karma
#

Don't hate the player

grizzled burrow
#

No I'm going to use that I just I'm mad about the pun

grizzled burrow
thick karma
#

Anyhoo so yeah you can change True Music Addon folder name to Truecadero Music, and I would personally change the truemusic_addon subfolder of Contents/mods to TruecaderoMusic (I generally avoid spaces in folders and filenames at that level of the mod).

thick karma
grizzled burrow
#

Okay yeah that's what I thought you meant

thick karma
#

You have the mod in Zomboid/Workshop/True Music Addon... I'm calling the last of those three folders the "parent folder" of your mod.

#

You could have many workshop items adjacent to it in the Zomboid/Workshop folder.

grizzled burrow
#

So does this look better?

thick karma
#

Standard practice for many of us would be to use that same smashed foldername (TruecaderoMusic) as the mod id (on the id= line of mod.info, which, again, you must not confuse with the id= line of workshop.txt [again, the latter of these does not even need to exist until you upload]).

grizzled burrow
#

C:\Users\gayman1\Zomboid\Workshop\Truecadero Music\Contents\mods\TruecaderoMusic

thick karma
#

Yes

#

In scripts there are 4 files

grizzled burrow
#

So I don't need to worry about the workshop. Text

thick karma
#

It is very important that you do not forget to append a unique id to those files

grizzled burrow
#

How would I go about doing that

thick karma
#

No wait

#

hold on

#

Let me double-check

#

It may be the Lua ones not the scripts

#

Yes, the scripts, too.

#

Okay so you pick a random long number, perhaps 10 digits.

grizzled burrow
#

Well I know what I'm going to do

#

I'm going to do the lyrics from one of their songs

thick karma
#

Okay yeah that would work

grizzled burrow
#

So where would I exactly edit it at

thick karma
#

Just nothing too insanely long idk what the limits are here.

grizzled burrow
#

Would it be like this?

thick karma
#

But basically you need to edit these four filenames:

grizzled burrow
#

TCGSoundsTCVinylplayer24110617.txt

#

Or doesn't not matter where I put it?

thick karma
#

I doubt it matters but I have not experimented.

#

What you did is standard.

#

All 4 files get the same number

grizzled burrow
#

Okay so pretty much like this?

thick karma
#

Stuff in items needs renamed as well

#

lua/server/items

#

and lua/shared

grizzled burrow
#

Just do the same thing that I did last time?

thick karma
#

Yep

thick karma
#

Yeah afaik the scripts and all the mods Lua files are what you have to rename

grizzled burrow
#

All right boom I did it

#

So are you familiar with this mod/template at all?

thick karma
#

Somewhat yes

grizzled burrow
#

Okay so I know it adds vinyl into the game and this is going to kind of sound dumb but would you know how to add like a custom image on the vinyl in the game

#

Textures what I'm looking for

#

Work well I think you know what I mean

thick karma
#

Music for the End of the World does that. I would recommend referring to that mod for guidance.

Basically, in your current item scripts (the MusicScript txt files), you have a line that says this:

WorldStaticModel = Tsarcraft.TCVinylrecord3,

#

This points to a generic record model provided by True Music

grizzled burrow
#

I think I understand?

thick karma
#

You would change that to say
WorldStaticModel = Tsarcraft.VinylRECORDNAME(YEAR)Model,

Then you would make a model somewhere else in that file by adding a new block just like the item blocks that looks like this:

    model VinylRECORDNAME(YEAR)Model
    {
        mesh     =    WorldItems/TCCover,
        texture  =    WorldItems/VinylRECORDNAME(YEAR),
        scale    =    0.0012,
    }

Or .0012 is used by MFTEOTW. You might want your vinyls to be slightly bigger or smaller, that's on you.

grizzled burrow
#

I think I'll just let it stay generic

thick karma
#

Fair

grizzled burrow
#

You're doing a very good job at explaining it but I don't understand a word you're saying

thick karma
#

It's always an upgrade you can consider if your mod is popular.

grizzled burrow
#

Is there a video/image guide for this?

thick karma
#

No I am translating things for you by reading the mod files for other mods that do this.

ancient grail
grizzled burrow
#

My head is starting to hurt

thick karma
ancient grail
#

for _, v in ipairs(stuffList) do
    if v:contains('Hat') then
        print(v)
    end 
end
--prints: RedHat BlueHat

@warm plover

thick karma
#

There are no further steps

#

That would be the last detail you needed to learn

#

But honestly I recommend a break @grizzled burrow ๐Ÿคช

#

Breaks are good

#

These things take time and energy

warm plover
#

i tried getPlayer():getInventory():contains("text") but just got "false"

#

oh. wait. let me try it with the for loop

#

sorry. new to this

ancient grail
#

unfiltered

local inv = getPlayer():getInventory() 
for i = inv:getItems():size() - 1, 0, -1 do
    local item = inv:getItems():get(i)
    print(item:getFullType())    
end    

#

filtered

local inv = getPlayer():getInventory() 
for i = inv:getItems():size() - 1, 0, -1 do
    local item = inv:getItems():get(i)
    if item:getFullType():contains('Worm') then
        print(item:getFullType())
    end
end    

warm plover
#

thank you

ancient grail
wet sandal
#

I want to turn this game into the Sims

gleaming sorrel
#

I tried to do this through imagur and it didn't work

bright fog
gleaming sorrel
#

I see no option

bright fog
#

You open the image, then open the source image in another tab and you'll have the link for it

#

I did a guide for that I believe on the modding Discord

#

No I didn't

#

I will do it later today

#

But yeah you need the raw link of your image and video

#

Video is a bit annoying to do

#

Also I believe imgur does work

#

I did use it

bright fog
gleaming sorrel
#

This is the video I'm trying to do it with
But I just can't for the life of me get it to work

untold radish
#

some more bags ive been working on

bright fog
gleaming sorrel
bright fog
gleaming sorrel
#

Possible

bright fog
#

An example with github

[video mp4=https://github.com/SirDoggyJvla/Susceptible-Overhaul/raw/main/images/natural_drain.mp4][/video]
#

That link requires a bit of a trick to get

#

Bcs for images, if you open the source image it gives you raw link

#

But for videos if you open the video in another tab, it downloads it

#

So what you have to do is copy the link to the video, and in that link there's a part you need to modify

#

Bcs the link won't give the raw,.it will give smthg else

#

So where the raw is supposed to be, you have to modify the link to replace the part that took its place

dense bison
#

Hi, I am in the process of creating the Undead Stalker trait. In this function, I want panic, fatigue, and stress to be reduced to 0 when I have this trait, but it is not working. Here is my code:

agile lily
#

Anyone able to hook me up with an example of how to call a function on the client from the server?
I read earlier that it's possible, just not too sure how to actually do it ๐Ÿซ  .

bronze yoke
# agile lily Anyone able to hook me up with an example of how to call a function on the clien...
-------------------
-- server file
-------------------

-- table of arguments to send to the client
local args = {}

sendServerCommand("MyMod", "MyCommand", args)
-- if you have a specific player to send it to, use this instead
sendServerCommand(targetPlayer, "MyMod", "MyCommand", args)

-------------------
-- client file
-------------------
local function handleServerCommand(module, command, args)
    if module ~= "MyMod" then return end
    if command == "MyCommand" then
        myFunction(args)
    end
end

Events.OnServerCommand.Add(handleServerCommand)
agile lily
drifting ore
#

Please optimize this game

modern knot
#

How does the case-senstive file system affect mods on Mac? My mod doesn't appear to work on Mac (items don't show up in item list), and I'm not sure where to start to fix it

agile lily
modern knot
sour island
#

Better to post this one pastebin or something similar.

#

Or to attach it as a file

modern knot
untold radish
#

anyone know where to find the scripts for the military duffel bag and medical bag? they are not in with the rest of the backpack scripts

hollow lodge
#

perhaps in containers or containersnew

wet sandal
modern knot
red tiger
#

They're case-sensitive about it?

wet sandal
#

Unix is

red tiger
#

Oh that's right.

#

I'm used to the Windows environment.

bronze yoke
#

didn't they patch that out ages ago?

wet sandal
#

I've only ever modded under build 41 and it's been a thing I've had to deal with

bronze yoke
#

you should be consistent anyway but it should ignore case

#

because it was causing so many problems

#

it would've been one of the last patches of b41

#

so around a year and a half ago

#

yeah, it was the very last major patch actually

#

- When sorting the relative paths of scripts and Lua files to determine load order, the relative paths are first converted to lowercase. This is to fix platform differences breaking checksums in multiplayer. It also fixes the issue where the same file might be loaded more than once if mods use different capitalization for the same file or folder.

wet sandal
thick karma
#

@wet sandal

#

ayo

#

Finally got around to tryin this

#

DMs or here for code chat?

#

Errors and such

wet sandal
#

Either is fine iwth me

modern knot
thick karma
#

Okay in NotlocControllerNode you have problematic decorations of onJoypadDirRight etc.

#

Here you forward a UIElement as input to that function:

#

But that function expects joypadData

#

(et cetera)

wet sandal
#

the ui element is taking the place of self

thick karma
#

Doesn't work

wet sandal
#

But yea, I need to get the joypad data

thick karma
#

When it gets forwarded to functions expecting valid joypad data, it is possible they'll get nil instead.

red tiger
thick karma
#

And when they do you trigger errors that are not possible following vanilla convention

#

You must pass the exact form of variable these vanilla gamepad functions expect or they will get pissy fast

red tiger
#

@wet sandal I'm currently documenting the ISUI library and just did most of ISUIElement.

thick karma
#

In the case of the error I saw, self.og_onJoypadDirRight(self.uiElement) led to an error because self.uiElement was nil instead of joypadData

#

Need to figure out how to reliably pass the expected data here. Odd to be called from a function receiving dx, dy... Hmmm.

#

Does a NotlocControllerNode reliably have a player controller index?

#

You can use the controller index to grab the correct joypad data object

#

But I do not know exactly what's available in this module at a glance. Seems its fed joypad data from an external file..

wet sandal
#

Yea I think I've got it fixed uploading now

thick karma
#

Oh cool.

#

I'll try it out

wet sandal
#

Sorry, didn't realize that those functions had a param

#

The vanilla ISInventoryPage was my base

red tiger
thick karma
#

No worries, this controller code can be a bit hard to follow.

red tiger
#

This might help. I researched as much as I could into the joyData stuff.

#

It looks like there's legacy fields for ISUIElement.

#

Check out zombie.input.JoypadManager

thick karma
#

Also ISPanelJoypad explains some things, and JoyPadSetup explains others, and ISButtonPrompts explains yet others.

red tiger
#

Oh and the sub-class Joypad in there.

thick karma
red tiger
red tiger
thick karma
#

I see I don't remember finding or trying Joypad specifically. I think I saw functions in the Manager I wanted but couldn't access them but I'm about to test it

wet sandal
#

Might be worth documenting this @red tiger

--- Triggered when the down-direction of the arrow-pad of the joypad is pressed.
--- 
--- @return void
function ISUIElement:onJoypadDirDown() end

--- Triggered when the left-direction of the arrow-pad of the joypad is pressed.
--- 
--- @return void
function ISUIElement:onJoypadDirLeft() end

--- Triggered when the right-direction of the arrow-pad of the joypad is pressed.
--- 
--- @return void
function ISUIElement:onJoypadDirRight() end

--- Triggered when the up-direction of the arrow-pad of the joypad is pressed.
--- 
--- @return void
function ISUIElement:onJoypadDirUp() end

These functions are actually being called by the game with a param often referred to as joypadData

#

joypadData's contents:

wet sandal
#

@thick karma Fix uploaded, should properly ferry the joypad data through now

#

Good catch there!

red tiger
#

BTW I started a long-term project working on third-party documentation for the API of the game.

wet sandal
#

Oh, joypadData is also present after button in ISUIElement:onJoypadDown

red tiger
#

I wrote a webpage that makes it easy for me to document the game's API. Will be crawling over things over time.

civic tree
#

can i disable some of these somehow?

sonic ibex
#

You know what would be a cool thing to add? Ziplines and those rope hooks that can be thrown to a roof and used to climb up

#

Go from roof to roof like this ๐Ÿ˜…

warm plover
#

is there a trigger for when a repair finishes?

agile lily
#

Would anyone like to take a look together with me and try to figure out why I can't call a function from the server to the client?

#

I think I must've done something stupid, just not sure what ๐Ÿ™ƒ .

warm plover
#

question

#

on server side, why is true stored in array? ๐Ÿค”

agile lily
#

That's just me saying "random BS, GO!!" and trying out things I think might work

warm plover
#

i'm pretty new to this myself

agile lily
#

I think my reasoning was that the array will contain the arguments you pass onto the command you want to send

warm plover
#

so i dunno if it even changes anything

agile lily
#

But that's probably wrong

wet sandal
#

When does the Event OnGameStart fire on the server?
I suspect that might be the issue.

  1. Does it actually fire on servers?
  2. If it does, is the client connected to receive the command at this point?
bright fog
warm plover
bright fog
red tiger
# bright fog

I really wish that PZ didn't force everyone to use a high-quality PRNG.

bright fog
bright fog
warm plover
#

{true} == true means false

bright fog
warm plover
#

that's what trog is doing

red tiger
agile lily
#

Hmmm, so what do I do regarding the array? How do I pass arguments to the client from the server?

warm plover
bright fog
#

Also that's a complete missuse of args

warm plover
#

server line 1
client line 49/53
client line 3

bright fog
#

You can send args = nil and it will work if you just want a check for your command

red tiger
#

You don't need to send table data to send a command.

bright fog
warm plover
#

i'm trying to say that client line 3 will always return false, no matter what server line 1 reads. acidrain will never run

#

or am i misunderstanding how lua works

#

because i might, since i'm brand new to coding in general

bright fog
#

First off: please change MyMod and MyCommand

-- client side file
function HandleServerCommand(module, command, args)
 
    if module ~= "AcidRain" then return end
    if command == "AcidRain_start" then
        AcidRainDamage(true)
    end

end
 
Events.OnServerCommand.Add(HandleServerCommand)
-- server side file
function AcidRainEvent()
    getClimateManager():triggerCustomWeatherStage(WeatherPeriod.STAGE_TROPICAL_STORM, 12)
    sendServerCommand("AcidRain", "AcidRain_start", nil)
    print("Acid Storm active.")
end

Events.OnGameStart.Add(AcidRainEvent)
#

Secondly: don't make your function global so:
First off: please change MyMod and MyCommand

-- client side file
local function HandleServerCommand(module, command, args)
 
    if module ~= "AcidRain" then return end
    if command == "AcidRain_start" then
        AcidRainDamage(true)
    end

end
 
Events.OnServerCommand.Add(HandleServerCommand)
-- server side file
local function AcidRainEvent()
    getClimateManager():triggerCustomWeatherStage(WeatherPeriod.STAGE_TROPICAL_STORM, 12)
    sendServerCommand("AcidRain", "AcidRain_start", nil)
    print("Acid Storm active.")
end

Events.OnGameStart.Add(AcidRainEvent)
agile lily
bright fog
agile lily
bright fog
#

Remember to replace RandomInt(maxValue, minValue) with ZombRand(min,max)

agile lily
bright fog
#

This devilish place which you need to learn how to use

warm plover
bright fog
#

It will work if he does AcidRainDamage(true)

#

wait

#

Wait no

#

No you are right

#

It won't work

#

Yes that won't work at all @agile lily