#mod_development
1 messages ยท Page 46 of 1
would'nt "unlisted" just make its safe, its for friends or solo
maybe mostly
maybe i misunderstand
pretty much
u'd have to really hit it off big to get much attention tho
you cna upload private mods tho, you don't need to release stuff "public" if you don't want to
yeah your mod would have to be massive for it to become a nuisance
you can set the privacy to your friendlist or unlisted
or private and give permission to specific users as co-creators, so only them can see the mod
not trying to hide the mod, just trying to keep from tying my personal life to anything public on the internet
Hence the name ๐
haha, exactly
@hearty dew I'm having some trouble with the code we were working on. If you remember this guy: (moved it down a few posts so I could post it with proper code highlighting)
anyway, I've used it like so:
CPU.interceptEventHandlerRegistration("OnClientCommand", function(originalEventHandler, module, command, player, args)
if module == "vehicle" and command == "crash" then
RDWRER.Utils.printToCar("Crash Detected", args.vehicle)
print("Crash Detected")
end
local result = originalEventHandler(module, command, player, args)
-- post-stuff
return result
end)
problem is, my printToCar function you see there is somehow called 7x every car crash, once for each time OnClientCommand.Add was called during initialization
I don't get what's going on
you added it seven times, so it runs seven times, right?
seven different commands were registered, checking the module and command should filter out the other ones, but its not.... I think you're right though, I'm just struggling to figure out exactly where this falls down
i think you've gone too deep and confused yourself
every OnClientCommand listens for every command, it doesn't matter if you check for the module and command, because all seven of your callbacks are doing that every time
thats right... so I have to tag the correct eventhandler somehow
or prevent the other ones from getting wrapped in the first place.. that's probably the better plan
may not be possible, as Event.Add is just passed what is typically a local or anonymous function, I don't think I have any way of knowing for sure which eventhandler is being passed at that point. Crap
hmm, well...
is the file you're trying to hook in the client folder?
wait...
no of course it isn't lol
VehicleCommands is my target. Its in the server folder, so I can run the interception in Shared to get ahead of it
if you make sure your file loads last in shared, then keep an iterator and only hook the xth one, since vanilla always loads first and in the same order
it's a little prone to being broken by updates but it would at least work
ya, its brittle but may be the best option
Hey guys, just curious if anyone has tried to mod the default plumbing system at all? I haven't seen any mods that change it at all and I'm wondering if it's a limitation or just not enough interest. Might try and learn lua just to make it myself lol
like plumbing taps to water barrels? that's pretty much all lua, i've been working around it recently
There's a mod with pipes, irrigation for farming.
is there a known upper limit for the time specified for recipes?
(search turned up nothing)
Yeah specifically to plumb between 2 stories, I tried plumbing to a bathtub but it resets itself every time I load the save
I'd love to make a mod so that if you put a rain barrel on a roof you can just plumb it to the whole house, or maybe build a water pump that requires electricity
plumbing is basically just a timedaction and a clientcommand
Can you elaborate on this?
hmm... although it looks like the specifics of tying a water source to a tap is java, but i don't know if it'd really be too difficult to replace that system with a lua one
(sidenote: recipe is successfully using a time of 19200, so there might be an upper limit, but it's pretty heckin high :3 )
I'm not super familiar with lua but do you think it would be possible to start by editing code for the generator and simply change it to provide water instead of electricity?
unfortunately the generator is heavily java
i might do something like that for water goes bad... but i really should just finish off water filters first lol
Hmm well thanks for the help guys, I should probably do some more research. Just trying to figure out where to start learning
Oh, hmm.. That function you're trying to decorate in VehicleCommands is file local and inaccessible, right?
ya, they're commands, which is why we were trying to intercept the OnClientCommand handler, but that isn't going to work as its currently implemented
I wonder if I could force the file to load immediately after I turn on the intercept, then turn it off again
I'm not sure how require works but it may
currently looking to see if there is any way to get information out of a passed function, like its name or signature. Tried to use getfenv to see if the local vars were in there but I guess it doesn't work like that
Yea, you could try that to see if it narrows down the set of intercepted even registrations. You can't require a server file before the server files begin to load, otherwise that'd be an easy solution
require "VehicleCommands" would be the correct syntax if it worked, right?
Could start intercepting event registration late in shared/ loading and stop it early in server/ loading.. Maybe there's a better way though
that was my suggestion, seems like the easiest way of doing things
Isn't it in the vehicle/ folder? If so, it'd be require("vehicle/VehicleCommands")
just trying to find something less brittle before going that route. If anyone manages to sneak a file in after mine or if the vanilla code changes it would break
to be fair, the chance that someone puts a file that loads after yours and also registers OnClientCommand in shared is pretty low
and vanilla b41 probably won't have a major enough change to break it ever
ya, looks like its my only option, Tyrir was correct that requiring a server file out of sync doesn't seem to work
VehicleCommands.OnClientCommand = function(module, command, player, args)
if module == 'vehicle' and Commands[command] then
local argStr = ''
args = args or {}
for k,v in pairs(args) do
argStr = argStr..' '..k..'='..tostring(v)
end
noise('received '..module..' '..command..' '..tostring(player)..argStr)
Commands[command](player, args)
end
end
Events.OnClientCommand.Add(VehicleCommands.OnClientCommand)
This is the function of interest, right?
yes, there are two different commands that pass through that function that I want to intercept
It's Vehicles/VehicleCommands
sad face
LOG : General , 1667626057773> 4,592,748> Trying to force load vehicle commands
WARN : Lua , 1667626057774> 4,592,748> LuaManager$GlobalObject.require> require("Vehicles/VehicleCommands") failed
Trying to work out a safe way to determine whether the decorated event handler is the event handler of interest..
Might be able to inject a parameter to test that
Think you could. Going to be kind of messy/hacky, but hopefully less brittle
-- So we can try to call this with our own player object and getVehicle
-- implementation in order to check if this is the right event handler
function Commands.setStoplightsOn(player, args)
local vehicle = player:getVehicle()
if vehicle then
vehicle:setStoplightsOn(args.on)
else
noise('player not in vehicle')
end
end
CPU.interceptEventHandlerRegistration("OnClientCommand", function(originalEventHandler, module, command, player, args)
if module == "vehicle" and command == "crash" then
RDWRER.Utils.printToCar("Crash Detected", args.vehicle)
print("Crash Detected")
end
local result = originalEventHandler(module, command, player, args)
-- post-stuff
return result
end, function(originalEventHandler)
local shouldDecorate = false
local player = {
getVehicle = function()
shouldDecorate = true
end
}
originalEventHandler("vehicle", "setStoplightsOn", player)
return shouldDecorate
end)
CPU.interceptEventHandlerRegistration = function(eventName, eventHandlerDecorator, shouldDecorateEventHandler)
-- ..... [clip]
Events[eventName].Add = function(eventHandler)
if not shouldDecorateEventHandler or shouldDecorateEventHandler(eventHandler) then
local newEventHandler = function(...)
return eventHandlerDecorator(eventHandler, ...)
end
-- Use the original Add function to add the new wrapped handler
local result = originalAdd(newEventHandler)
CPU.RegisteredEventHandlers[eventName] = CPU.RegisteredEventHandlers[eventName] or {}
CPU.RegisteredEventHandlers[eventName][tostring(eventHandler)] = newEventHandler
return result
else
return originalAdd(eventHandler)
end
end
-- ... [clip]
That approach might work. Would be a lot easier if we had debug to figure out what event handler we have before decorating it
This approach would only be brittle to a change in the Commands.setStoplightsOn function
trying my best to understand what this is doing
oh I see, you're closuring shouldDecorate in a fake getVehicle function and trying to bait the event handler into calling it
I would never think of these things
Instead of simply registering the wrapped event handler, it calls a function shouldDecorateEventHandler to determine whether to Add the decorated version or the original. The implementation of shouldDecorateEventHandler above calls the original event handler with a stubbed player object to check if it is the event handler of interest. If it is the one we want, the setStoplightsOn command will interact with the stubbed player object in a known way, which the stubbed player object records by setting the local variable shouldDecorate to true.
yea
Ping me if there are any issues with it. I can't test it atm, so probably has some problems
it makes sense. SetStoplightsOn will fail silently because it checks if a vehicle is returned, which there won't be. Other event handlers should ignore it entirely since they don't handle vehicle commands. Potentially another mod could cause a problem with it, but its quite unlikely
and you've managed to still make it generic enough to work with other things. impressive as always
Right. Also, if that doesn't work, you can put a counter inside shouldDecorateEventHandler to register the nth event handler, like albion suggested
LOG : General , 1667628284856> 6,819,831> CPU.interceptEventHandlerRegistration: Events.OnClientCommand.Add(closure 0x1017050857) called
LOG : General , 1667628284857> 6,819,832> VehicleCommands: received vehicle setStoplightsOn table 0x1021311233
LOG : General , 1667628284858> 6,819,832> VehicleCommands: player not in vehicle
LOG : General , 1667628284858> 6,819,832> Found the correct event handler, decorating
๐ฅฒ
Thank you for your help again, you too albion
Finally released that money mod I was in here with earlier ^-^
Huge thanks @bronze yoke for that assist ^-^ โก
(hope you don't mind I listed you in the credits and linked to your steam profile >.>)
oh thank you very much ^u^
๐ no no, thank you hun. Helped me out alot there lmao
Seems simple, but half the mod wouldn't be possible without that nudge to modData haha
sigh, building cheat was reenabled and I was adding the plank to my inventory
*plank Barricade cursor works
Anyone knows how you can save a changed table so that it stays the same the next time you log in?
how do i get my trait to show up inside the character creation menu?
i want to mod the game for fun quickly, not 100% learn lua, it would be appreciated if the answer was simplified to something alone the lines of
_
"Event.OnPlayerCreation(local Get:TraitFactory.Trait())
local badteeth = TraitFactory.addTrait...... ex
_
is it required to learn lua. & not just get random free answers to specific questions, if thats a frowned upon thing here ill just go learn lua & read 10,000 lines of stuff i hardly need to know for what im trying to do (i know the basics)
goodmorning any expert out that can suggest a mod to craft fridge and other stuff???? also i played at a server and to craft more things u used to get magazines that u read 1 time from zombies any mod like that maybe????
function SandboxOptions.ZombieConfigGet:TraitFactory.Trait(); --?? not working
I want to know the specific meanings of the arguments of mod weapons. Is there a document or tutorial or sth?๐
Yes, it's frowned upon to not learn things yourself and expect strangers to write your code for you. Not just here, but in programming in general.
Hey y'all, in this game, if collapse is assumed not to mean "close", what do you think someone would mean by saying "make the inventory collapse"?
the pin button of ui
Hm?
hides everything except the title
So if I pin it and then toggle hiding it does that?
I clicked pin earlier but didn't toggle so I didn't catch that behavior
I figured it would just keep it when I hit i
it takes some time unfocused
I'll click pin and see what happens.
I hover over inventory, it opens, then after some time closes
I made them, I just don't have a Rust texture which I link to an empty image, so it still has a texture
I have them correctly, I've checked several times
Okay that's good
how can I post code lines here?
```lua -- code here ```
```
--TODO
```
Anyone know what the difference is between getLvlSkillTrained and getNumLevelsTrained?
Starting skill, levels trained
Oh, sorry. Should've specified, these in the Literature class
the lvlSkillTrained is also used for the tooltip bookname
This is what I have. Base textures are showing good, Mask is working and Lights too, but not showing any damage or blood.
book one is 1-2
meaning can train first level and second
vanilla books have all numLevelsTrained as 2
wait, 0 is a valid value?
start from 0 so that to change tooltip bookname
as long as it's not -1 I think
I think so
anyway... Vanilla books would return 1,3,5,7,9 in that order, right?
Now, about skills
getXpForLevel returns how much XP is needed in total to reach the next level from the specified level, right?
Whereas
getTotalXpForLevel would give like... A sum of all the costs from levels 1 to specified?
Anyone happen to know the command that the game uses to collapse and expand your inventory/loot when you have them pinned and your mouse focus changes?
Example:
For a normal skill like Carpentry, getXpForLevel(5) would return me 1500, whereas getTotalXpForLevel(5) would return 2775?
How to change a value of a vanilla item?
I've been trying out my mod now and still doesn't show the blood and damage textures on it
Hi, i try to understand the utility and the use of ComboItem Type.. I'm unable to get their name or other through lua
I've tried to put the Blood texture as Rust texture and isn't showing either
Hey I am trying to make a patch for fallout weapons and arsenal attachments, if I understand correctly, itemtweaker allows me to do this?
imports
{
Base
}
item Base.Launcher
{
MountOn = MCX_Spear; MCX_Virtus; MCX_VirtusPatrol; MCX_Socom;
M16A1; M16A2; M16A3; M4; M4A1; Bush_AR15_MOE; Bush_XM15; Bush_XM15_Custom;
SCARL; SCARH; SCAR20; G28; H416; MK18; M723; XM117;
LVOA_C; ColtM16; M16Tape; M16Wood;
K2_1; K2_203; K2C1_PH; K1DEV; K2_C1; DR_200;
newWeaponToMountOn1; newWeaponToMountOn2,
}
and have that just change the list of allowed weapons for the attachment right?
Also, how do I add required mods? (to make sure itemtweaker is loaded first)
In your mod.info file, you would specify them. For example, the following is one of mine that's a patch between two of my mods. Note that last line "require=". If you have more than one required mod, simply separate the mod IDs with a comma.
name=ZedHead Jewelery - ZedHead Money Module
poster=poster.png
id=ZedSHeadJeweleryMoneyModule
require=ZedHeadJewelery,ZedHeadMoney
itemtweaker doesn't go through scripts
if getActivatedMods():contains("ItemTweakerAPI") then
require("ItemTweaker_Core");
else return end
TweakItem("Base.Needle","Icon", "Worm");
TweakItem("Base.Needle","Tooltip", "Wearable: Waist");
TweakItem("Base.Needle","DisplayCategory", "Repair");
using item tweaker is not so popular anymore though
it causes a ridiculous amount of startup lag
i dont know how to code in any way shape or form
May i see the blood and rust texture
Whats a combo item again?
Item tweaker
Pz wiki
custom sqlite trigger
local SQLite = require 'SQLite';
--///////// JUST FOR TESTING /////////
local onKeyStartPressed = function(key)
local source = getPlayer(); if not source then return end
if key == Keyboard.KEY_NUMPAD0 then
local result = SQLite.execute("SELECT * FROM whitelist;");
print(result)
for k,v in pairs(result) do
print(k)
print(v)
end
end
end
Events.OnKeyStartPressed.Add(onKeyStartPressed);
Holy shit shis was my mod project that i wasnt able to complete
@undone elbow I'm sorry to bother you again, but I was curious if you could help me solve something about your mod...
When I call :set(false) on a boolean Mod Options option object (e.g., modSettings:getData("closeMenusByAiming"):set(false)) while I am in the Options menu, it toggles that object to false. So, e.g., if I fire that during the onUpdate of a different object, I can make one box's state change as soon as I click another. That's working perfectly.
However, let's say Options is closed, I'm in-game, and I use the debug console to get a reference to that same boolean data object (and modSettings is visible). Now I try to use :set(false), but nothing happens. I'm guessing you have a better idea why nothing happens than I do, since you made Mod Options. Is there a way to set and apply a setting change when the Options window is closed? And, if not, is there any way you could add a function, perhaps :update or :forceSet, that works even when you're not in the Main Menu, as an alternative to setting before applying? I want to be able to force apply a setting change in my mod while the Main Menu is not visible (this would be something only admins can do... I already know how to limit the privilege, I just need a function that works when the client fires it...)
can u access vehicles.db with this ._.
it seems ur not picking a database, so are u sandboxed into just the main db?
Does Kahlua not support the # operator to get the element count of an array?
local newarr = {
"one",
"two",
"three",
}
return (#newarr)
Should return 3, for example
local randint = ZombRand(#newarr)
return randint
Should then return 0, 1, or 2 following the same logic.. (obv assuming you didn't actually return #newarr in the first place, and assigned it instead as a var)
if it's java array then use array:size()
#works only for lua tables that have keys 1,2,3,... and can't skip any
oh wait
Nah, just a local array in Lua; for selecting an item randomly from a pre-defined array
your example should work?
hmm... well, unfotunately it isn't working. I'm actually helping @dusk saddle with a project they're working on. That's basically the code I wrote earlier yesterday for them, that I thought would work, but it's throwing an error for them.
Aye, I can supply some pics of the code if you need 'em
However, line 240 is simply local roll = ZombRand(#FNAList)
So like... am stumped... Because I'm using almost identical code myself for something else in one of my mods lolz
what's the error
@dusk saddle
That's the error as far as I'm aware, I'll relaunch and see if anything more comes up
Actually, yeah. Re-launch and send me your console.log and I'll grab the error from it >.>
STACK TRACE
-----------------------------------------
function: PIFNAFRandSelect -- file: PompsRecipeLua.lua line # 240 | MOD: Pomp's Items
Callframe at: PerformMakeItem
function: perform -- file: ISCraftAction.lua line # 58 | Vanilla
LOG : General , 1667671295319> __len not defined for operand
LOG : General , 1667671295379> creating new sourcewindow: C:/Users/Gavin/Zomboid/mods/PompsItems/media/lua/server/PompsRecipeLua.lua
ERROR: General , 1667671299620> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: __len not defined for operand at KahluaUtil.fail line:82.
ERROR: General , 1667671299621> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: __len not defined for operand
So... maybe that operator isn't supported?
probably not a table
yep, that's possible due getDBSchema() and getTableResult(), I tried to access by some more independent paths, but unfortunately, everything is very isolated, but now that you mention it, I think I've seen some global function that handles vehicles.db did you try manipulateSavefile()?
I have no Rust texture yet, I have these Blood textures
usually the not defined appears when I try to do stuff with nil, so in this case you might be trying to get length of nil
Working on that with them now; I think we may have narrowed down a portion of it.
I think you're treading new ground, haha. This is interesting
i have not
am entirely unfamiliar with all of these
someone told me it was sandboxed such taht i could not open the file
via external library
and they are a skilled coder so i beieved them
and just dismissed the idea of accessing it from lua out of hand
:|
holy shit that method
it lets u do so much fancy shit
only deletions tho
all deletions except "mods.txt" creation
still thanks for turning me on to that function could be useful
dont know if deleting the vehicles.db will help with accessing it tho heh
anyone want a super extensive project? would pay some good dollars for it....
we are talking cold hard cash
idea is simple, drill oil, put it in barrels, then take it some where to refine to either diesel or petrol (gas) cuz im merican, but then gas of refined oil could be used to fill up gas stations. whether its diesel or gas. also the gas stations would need to show quantity of fuel available. if we could make it work with our custom build store mod it would be even cooler cause then players could buy and sell gas essentially as well as cars could buy gas from gas stations... this is for a larger rp server.
Does the base game support towing a vehicle that has a trailer being towed? Or even a vehicle towing a smaller vehicle? If not, is this a game engine limitation or something, or can this be done via mods ๐
you can tow a vehicle, but i don't think you can tow something that is towing something else
You cannot daisy chain
my guess is that if you force the game to do that with mods the physics go insane, otherwise they'd just let us do it anyway
It's possible. I could make such a feature. I'd say that everything is possible. But I think that this is not entirely correct. Let's say the user sets an option to true, closes the menu, then opens it again, and sees that the option is false. It looks buggy. Is there another way to reach your goal than mixing in the dark the options defined by the user?
woops I posted that in the wrong discussion board, my bad
I would inform the user via an informational popup that the admin had changed their settings for the mod so that it does not look buggy.
If you COULD add this feature, you would be my damn hero, because it would solve a major issue for me
No pressure
I know how much work modding is ๐
I think such a popup should be a part of ModOptions. This will be honest if someone else wants to push new options from the server. I should think about it to make a neat concept.
Hey I asked this on Steam but nobody seems to know of one. Maybe some of you do. I'm looking for a mod that makes wound infections dangerous. The only two I have found aren't really what I'm looking for. One inadvertantly gets rid of corpse sickness (otherwise it would be perfect), the other actually makes you take damage for applying dirty bandages to wounds (which is really crappy for injuries that bleed so much your bandages dirty in a second, basically becomes a death sentence).
I just want something to make it to where you actually have to maintain your wounds properly or you could potentially die from a wound infection. To bring that risk, which should be much greater than it is. Does anyone know of a mod that does this?
But yes, no doubt, having it be part of Mod Options would be amazing
Also, if you ever feel like allowing us to add our own mod page as an option, I have no doubt many would love that feature. Not sure how hard that would be
But that is more an aesthetics and QoL thing
Function is my main priority here tbh
No problems. I like the idea. And I just need to find time to implement it.
I use Disinfect or Die, no way of knowing it its one of the ones you're referring to.
yeah that's the one that, if I read it correctly, will make you take damage if you apply a dirty bandage to a bleeding wound. So you can see where that would basically guarentee death with the right kind of wound.
Bonus points if the pop-up is closeable using B-button on gamepads... Haha but you know whatever is possible
The other one I looked at was deadly infections, but sadly from the comments, it also has a side effect of removing corpse sickness
I can possibly help with that part
I don't recall taking immediate damage from adding a dirty bandage to a wound, but I suppose its possible
disinfect or die seems a bit overtuned in general
Yeah, from the comments (and many state this): When you get a bleeding injury in the neck, which drops your health extremely quick, and you don't manage to get a bandage on right away, this mod pretty much sentences you to death. The bandage will get dirty, which means the mod will make you take damage just for wearing a dirty bandage.
that is why I passed it over
it damages you pretty fast and often it damages you before the wound even shows up as infected
i'm not sure of the exact reasoning for that, i've never looked at the code, but it's frustrating to be taking constant damage with no indication of why
Also the deadly infections mod is having issues where people get a small cut,bandage it, and die after sleeping ๐ Yeaaah just a bit overtuned on that too. Something that gives you a reasonable chance to actually care for the wound would be nice lol
iirc there is a setting for how much damage you take, but if its not your jam then that's fine.
i should make something like it myself sometime but i've got so many things to do
It seems like something super niche, when I search for infection or wound infection, most of the mods relate to zombification
I guess most of us aren't wanting to punish ourselves even more ๐
I appreciate it. Thank you. Feel free to ping me here or in PM. I don't use a joystick and don't like it in general, it's in a box somewhere, so I could use your code as is.
Sure! I am AFK, but give me a little while (hopefully a few hours or so) and I will send what I know about catching a Joypad B Button from a menu. I know several menus that do it, I am sure I can easily find their code in vanilla. E.g. the menu that asks users to confirm unsaved settings has both an A and a B button.
@ruby urchin Do those sql apis work server-side? I was messing with them awhile back, and I never could find a way to get them to function server-side (because the java code did a check to determine if the client is admin, if I'm remembering correctly)
nop, I was trying for several days, but events don't sync with the main thread (probably exists another way to that, but I want send-receive on only one function)
Oh, will be a problem if the client need be a admin
lol, "something". Apparently zeds also attack your trunk lid, trunk and hood when attempting to get into the vehicle. But nothing else
hmm, but the damage is only client side? I let the zombies destroy everything they could get to (aside from the windows), then removed them. Went out and smacked the o% trunk only for it to go back up to 95%. Odd
I've noticed this with the windows as well, actually. If I stop a window from being broken on the server, it still breaks noiselessly on the client, and a zombie can still "bite" you through the schrodinger's window. Get out and hit it yourself and it reappears
not overly surprising really. there was some MP optimization changes a while back, where 'control' zombies in a certain radius of a player get transferred to the client instead of the server to reduce 'lag bites' and similar issues in tense situations
right now I'm trying to put together a event system that allows me and potentially other modders to see what damage is happening to a vehicle, from what source, how much, which parts, etc. Its pretty challenging with this kind of desync existing in the vanilla code
I've just noticed that some recipes that creates "food" items gives cooking exp without the "OnGiveXP" function in the script at all
If those things are occurring client-side, it's reasonable to capture those events client-side, and then through client/server commands send the events to where they need to be (on the server, possibly on other clients)
it's a bug?
I have a "hopefully" smal issue. I created an item:
item FishGuts
{
DisplayCategory = Material,
Weight = 4.0,
Type = Drainable,
UseWhileEquipped = FALSE,
UseDelta = 0.05,
DisplayName = Fish Guts,
Icon = FishBone,
ConsolidateOption = ContextMenu_Merge,
SurvivalGear = TRUE,
WorldStaticModel = FishBone,
}
```
which I want do get when a fish is cut in to filets... So I hooked into
```function SoulMod.Recipe.OnCreate.CutFish(items, result, player)```
This works so far but my guts are always weight 4.0. I want to set them only as a percentage of the whole value... so if the stack is full. 4 is ok. But I ohly have for example 0.4 it should be only 0.4 (kg?)
I created my item as follows:
```
...
local gutsItem = InventoryItemFactory.CreateItem("SoulMod.FishGuts", restGutsDelta)
player:getInventory():AddItem(gutsItem)
```
Even is my "restGutsDelta" is wrong calculated. It should not have a weight of 4. So assume my idea of using CreateItem with my delta parameter does not what I expected. Do I have to create an item without this delta parameter and then do what?
I admit that I just don't have the energy to look into the java code atm. Hopefully someone know how to do this...
My idea based on the javadoc InventoryItemFactory:
```public static InventoryItem CreateItem(String itemType, float useDelta)```
I hope I wrote an understandable text. ๐
using "OnGiveXP:Recipe.OnGiveXP.None," in the recipe fixed it, but it was surprising to see the "ongiveXP" working without being added to the script itself, answering myself to add the solution to the log in case someone looks for the function as I did.
-- Default function to award XP when using a recipe.
function Recipe.OnGiveXP.Default(recipe, ingredients, result, player)
for i=1,ingredients:size() do
if ingredients:get(i-1):getType() == "Plank" or ingredients:get(i-1):getType() == "Log" then
player:getXp():AddXP(Perks.Woodwork, 1)
end
end
if instanceof(result, "Food") then
player:getXp():AddXP(Perks.Cooking, 3)
elseif result:getType() == "Plank" then
player:getXp():AddXP(Perks.Woodwork, 3)
end
end
It has a default implementation apparently
When you callCreateItem with a useDelta of 0.4, it still creates an item with 4.0?
I'm checking how to add a custom recipe. Basically it's a pot of soup with the same ingredients I always use. Is it possible by adding a custom recipe txt file? I've taken this as an example:
`recipe Make Cake Batter
{
keep Spatula/[Recipe.GetItemTypes.Spoon]/[Recipe.GetItemTypes.Fork],
Bowl,
[Recipe.GetItemTypes.Flour]=2,
[Recipe.GetItemTypes.BakingFat];15,
[Recipe.GetItemTypes.Sugar];10,
[Recipe.GetItemTypes.Egg]=2,
Yeast,
[Recipe.GetItemTypes.Milk];5,
Result:CakeBatter,
NeedToBeLearn:true,
Time:50.0,
Category:Cooking,
OnGiveXP:Recipe.OnGiveXP.Cooking10,
OnTest:Recipe.OnTest.WholeEgg,
}` and I see how to add the items to the recipe, but I'm unsure about the result. If I set the result to PotOfSoup won't I receive a "bare" pot? Am I correct in my assumption that I also need to add a new "target" item as the result?
(also, why some items have [type];qty and some have [type]=qty?
Kind of yes... The bar shows maybe 3% "filled" but the weight is 4... It didn't show different values... It was always 4.
Does anyone know where I can find the sunflower vase in the scripts? Unfortunately, it is not at Moveables / NewMovables. Thank you!
I'll do a test again with explicit 0.4 as second value...
Remind me please.. In vanilla, when an item is partially used, does its weight normally reduce to a fraction of it's remaining use? (e.g. a Thread drops from 0.1 weight to 0.05 when it is 50% used)?
Or is this a feature you want to add?
The bar is like expected on 2/5 but the weight is still 4.0. I don't read this wrong or do I?
As far as I know it goes down to a fraction. I'll also check this in a second... But thats what I expected... Give me a second...
Hmm... maybe I'm wrong... The thread is always 0.1 but I'll check the pot of water...
What is the exact text of it in the game (e.g. when mousing over it)? I don't see "Sunflower Vase". If it is from a mod, it'd be in the mod's folder btw
This is what I tried to achieve:
Oh, hmm.. Maybe fluid containers function a bit differently. I'd have to check
Maybe I just based on the wrong item.
Hopefully can leverage whatever water containers do to adjust their weight
I used the thread as template...
Mm
item WaterPot
{
DisplayName = Cooking Pot with Water,
DisplayCategory = Water,
Type = Drainable,
Weight = 3,
Icon = Pot_Water,
CanStoreWater = TRUE,
EatType = Pot,
FillFromDispenserSound = GetWaterFromDispenserMetalBig,
FillFromTapSound = GetWaterFromTapMetalBig,
IsCookable = TRUE,
IsWaterSource = TRUE,
RainFactor = 1,
ReplaceOnDeplete = Pot,
ReplaceOnUseOn = WaterSource-WaterPot,
Tooltip = Tooltip_item_RainFromGround,
UseDelta = 0.04,
UseWhileEquipped = FALSE,
StaticModel = CookingPot,
WorldStaticModel = CookingPotWater_Ground,
}
I also opend this in my editor. But I don't get what makes it to scaling the weight...
I'd guess some of the fluid filling functions do something to adjust the weight
I think I have no choice then checking the java code... but I'm to fatigue today... I'll check it tomorrow...
I also think it has to be something in this direction...
I can also generate the guts in items of 0.1 weight and then use them further... But I want to cook them anyway in to fishoil and then I'm on the same problem like now ๐
But I know if you don't know then it isn't something that everbody knows...
self.itemTo:setUsedDelta(self.itemToEndingDelta);
self.itemTo:updateWeight();
That's from ISTransferWaterAction.lua
Hmm... I'll take one try and call updateWeight() ๐
Doesn't seems to be the whole magic... I tested two cases:
local gutsItem = InventoryItemFactory.CreateItem("SoulMod.FishGuts")
gutsItem:updateWeight()
player:getInventory():AddItem(gutsItem)
and
local gutsItem = InventoryItemFactory.CreateItem("SoulMod.FishGuts")
gutsItem:setUsedDelta(0.4)
gutsItem:updateWeight()
player:getInventory():AddItem(gutsItem)
It stays 4.0.
But don't waste your energy... I'll check it tomorrow. Hopefully my brain is "on fire" then... ๐
My game is in German, so I canยดt tell you the name. but the item is definitely vanilla. in the Zomboid Wiki itยดs called "Orange Plant" and named "Vegetation ornamental 01 6.png"
Tell me the german name
It's a tile. An IsoMoveable can be created from certain tiles (that are marked as moveable)
It's in media/newtiledefinitions.tiles in the vegetation_infoor_01 tileset within that file. You can use TileZed to view it
is there a hook for interacting with containers
im trying render a ui element to the screen when the player opens certain containers
i think you could use OnRefreshInventoryWindowContainers for that
thanks for this that will do!
i was trying to use OnFillContainer but it was not doing what i wanted lol
ah, on fill container is when loot spawns
makes sense because it would work whenever the player saw the container
ty again i been looking for like 45 minutes
Hey there, anyone had any chance of working with moddata and vehicle ? I cannot understand why my moddata is "vanishing". My code work when I attach the moddata values to the player instead of the vehicle, but that's not what i'm looking for
BaseVehicle should inherit the getModData() method from IsoObject right ?
I've only had modData retain successfully if I do it server side
putting moddata on a vehicle on the client just gets overwritten the next time the vehicle is loaded
the transmit moddata functions also only appear to go one way, so I use a clientcommand to transmit the moddata manually
right I see
thanks for the answer @astral dune , i'll test that
no worries. I've also had better luck putting the moddata on a part of the vehicle instead of the vehicle itself, but I think they fixed the bug that required that
A simple var attached to each vehicle was a too beautiful idea for randomized car lighters ๐
oO i saw that on other mods ๐ i understand why now
@weak violet #mod_support is the channel you're looking for I think.
no one was answering
typically you'll have better luck if you give details right away instead of waiting for someone to reply before giving them
yeah, those kids need to learn that first. also they dont think about how long this game exists and how its like to answer the same questions over and over and over and...
eh I wouldn't go so far. In real life its considered polite to beat around the bush a while before asking for help, otherwise its too "transactional" or whatever. It can be confusing for people to be told on the internet "Don't ask to ask, just say it"
D:
did we ever reach a verdict on what load order does? i'm under the impression that it literally does nothing, everything loads alphabetically with ties broken by mod id, is that correct?
I thought ties were broken by the load order, no?
my understanding was that ties were broken by mod id alphabetically - people often prefix patch ids with ZZZ for example, and this has worked for me recently
Oh, I did not know that
is load order even a vanilla feature? i've never seen a button for it, except for map mods
Not explicitly in the UI, no. There is an order of mod ids in config files
hmm maybe the mod menu just sorts them alphabetically when it saves?
I was pretty sure ZZZ was to use alphabetical order to avoid the ties, also a dev was in here just the other day when we were talking about it to confirm that mod order matters ??
since they're displayed alphabetically i guess they would save that way
The vanilla mod menu appends each enabled mod to the end of the list, if memory serves
this post
hmm... maybe mod ids with zs in them are just a misunderstanding then
well if you do it that way you don't have to worry if the end user has ordered his mods correctly, in theory
it obviously sorts them by name not id ๐คฆ
Oh, the server mod selection UI does explicitly have a mod order actually.. forgot about that
You can move mods up/down to change the order
hmm well luckily the steps i gave to the host i'm talking to worked, even if they may have been based on faulty assumptions? lol
what I don't get, is if you use mod manager, is you can order mods by both their steam ID an their name, and the order doesn't have to be the same. No idea how that works out
Perhaps order is important for maps loaded from mods? Or is only the Maps= line in the config important for such mods?
maps is important, if anything overlaps the last map loaded wins
Mm, the question is if that's controlled by the Maps= line in the config, or the mod order
its the maps config, its completely seperate from mod order
i'll mess around with this a bit tomorrow because my hastiness leading me not to write my update as a patch might cause problems from this
a fairly simple test could be set up, with a couple fake mods named A , B, C or so, with different files that all print their names to the console. we could solve this once and for all if set up properly
Anyone know if you can run the java decompilation and annotation gradle tasks without intellij i.e. with just gradle?
i think it's probably possible, it didn't seem like anything in there was really being done specifically by the ide when i ran it
i don't know what your target is but the files i got out of it weren't really amazing for vsc though, they use a slightly different annotation scheme than any vsc plugin
I'll give it a try. Just wanted to avoid installing a whole ide I won't use for it :p
ooh, hmm
stuff like inheritance doesn't work and i had to help it with types and events
and there was no 'go to definition' support for java functions, which it sounds like does work in intellij
I mainly just wanted the source so I can search for references quicker than greping the .class files and decompiling them file-by-file
it'll suit that purpose well, that's mostly what i've used it for
it's the only java decompiler that seems to run on my computer for whatever reason
i gave rewriting it to produce something more useful for vsc a look, but i just couldn't work out all the gradle stuff
I know load order matters for loading saves with different order, it reloads lua first ๐คทโโ๏ธ
Y'all can someone explain the absolute weirdest shit r.n.?
If I type: print(ui:get(25):getUIName()) in console, I get inventory0. But, if I type:
local testVariable = ui:get(25):getUIName()
print(testVariable)
It prints nil instead of the string. What the heck is going on? Can I store the string in Lua form in a variable somehow?
Put " "
^
To make it a string
Ohhh like concat it?
Maybe i havent tried making things like this as string
Umm didn't work
Is there a .ToString() method in linux?
Try print(tostring())
Or something similar
Trying to store the tostring also returned nil
How the hell does print even work on this object
Or try printing first the value
The first value of nil?
No the uiget thing
It's not a table
It's a java.lang.String
But somehow Lua print can parse it
So it must be parseable
If it doesnt give u a print then storing it to a variable will not help
You are not understanding the weirdness of this situation
It DOES print
It does NOT store to a variable
That's what's so weird
I can print it just fine
But if I try to store the thing I am printing, it's suddenly nil
It's like quantum programming fuckery I swear to you
I don't know much about Lua, but could it be possible that it's the way that a variable is stored or someth?
Try it in console:
local what = ui:get(25):getUIName()
print(what)
print(ui:get(25):getUIName())
You will get
nil
inventory0
Can you try;
local var
func():
var = abc;
print(var)
local what = ui:get(25):getUIName(); print(what)
each line in the console is run as its own lua chunk so has its own scope for local variables
Oh wtf
Okay thank you Tyrir as usual
Shit I swore I had done that before
I hadn't
I clearly used a global box
Must have assigned my working variable to my DOTZ or IR before
And didn't think about it
Tyrir using the cosmic power of the universe to be the smartest being in the project zomboid modding community
One of them, no doubt.
There is the __tostring metamethod. tostring() should use that (idk exactly what kahlua does)
Imagine how frustrating it must have been without Tyrir
Happened to me yesterday i just had my call function below the end of its parent function
It took me 4 hrs of rewritting and learning only to find out my initial code could have worked if i had placed it on top the end
shelf:setIsContainer(true);
shelf:getContainer():setType("shelves");
is it possible to set the container amt
I dont believe its possible to change it since the type is what determine the container amt i think
And only crate and shelves is available
As i looked into the lua folder. This nust be done probably java sided
Does anyone know if the forage zones actually deplete? It seems like I can stay at a small patch of forest and stuff keeps coming.
I don't understand what you want to do.
tile containers get their properties from the sprite, which is from tiles file. There's definitely more than crate and shelves.
Ow . U know the syntax for the capacity
from lua, there seems to be a Java method setCapacity(int)
I dont know how to do java coding yet
Ahhh i get it
I can use setcapacity
Thnx ill try it
@fast galleon didnt work
local pl = getPlayer()
local sq = getCell():getGridSquare(pl:getX(), pl:getY(), pl:getZ());
local shelf = IsoThumpable.new(getCell(), sq, "location_shop_accessories_genericsigns_01_6", false,
ISSimpleFurniture:new("shelves", "location_shop_accessories_genericsigns_01_6", "location_shop_accessories_genericsigns_01_6"));
shelf:setIsContainer(true);
shelf:setCapacity(5);
shelf:setCanPassThrough(false);
shelf:setIsDismantable(false);
shelf:setCanBeLockByPadlock(true);
shelf:getContainer():setType("shelves");
sq:AddTileObject(shelf);
if isClient() then
shelf:transmitCompleteItemToServer();
end
it spawns the thing when i remove the setcapacity but if tits there it throws off an error
setCapoacity only works with inventory containers mostprobably
can i call getCell() on the server and what cell do i get?
should be something like
shelf:getContainer():setCapacity(5)
ow wait
yep nvm didnt work
ahh ill try something
maybe after u set the type to shelves?
yep
thats what im going to try
nohp stil didnt work
error still points to the set capacity
Is it possible to change how long does it takes for the forage zones to get refilled?
Maybe theres a setContainerCapacity() ?
Ill try yo find if theres something pike that
Damn it
it works for me, changing existing container
LOG : General , 1667735028964> zombie.inventory.ItemContainer@41d221f7
LOG : General , 1667735028964> 5
LOG : General , 1667735046666> zombie.inventory.ItemContainer@41d221f7
LOG : General , 1667735046667> 50```
I see, you try make everything manually, is your container valid?
maybe try doing shelf:createContainersFromSpriteProperties()
Ok i will
Can i get the snippet for changing existing containrs
print(getPlayer():getSquare():getSpecialObjects():get(0):getContainer():setCapacity(5))
just console testing
Ty
Shouldnt have hidden their name so others could avoid being scammed by them
I get your point but still
But still what?
I dont want to do that ๐ฆ
Protect others from scammers?
His not totally a scammer tho he did pay me from previous lessons
He only scams sometimes
Is it possible to change how long does it takes for the forage zones to get refilled?
Ill tell u via pm
Sent u pm
I dont suppose anyone knows of a way to get the mac address of a player?
I see the console txt outputs hardware info
I have reports of players sharing accs and even steam accounts to bypass steam ID to abuse skill recovery journals lol
not too bothered by it but I do feel bad for server admins dealing with scummy people
Depending on how you are planning to solve that, there might be some fields on GameClient you could use to fingerprint the client
PublicServerUtil.getMacAddress. Doubt it is exposed though
Can't test it atm
you take a willing commission work with understood payment, why not scroll up to the part where we discussed how payments between us WILL work & how it is 100% based on what i DEEM worthy of learning, this is not a job u must take & it was an offer from me, so far i've given you 20$ USD & did learn some stuff, but to think you deserve 5$ for a 10 min convo where i learned NOTHING is insane my friend, i would like to protect others from scammers too
Where i can read zomboid's api documentation?
to anyone doing any commission work with lua & modding please discuss & understand playment before you do ANYTHING, otherwise you will "feel" like you are being wronged
Yall should probably deal with this in private
i agree but he posted a thing
so lets just take note, commissioners beware of who u work with
that being said "paid by thing learned" is super silly, not sure how that got off the ground
& discuss beforehand please
My man just outed himself in front of everyone
???..... i outed myself?
i pay the man 20$ for almost nothing IMO
now he wants another 5$ for literlaly 10min of time that still left me confused with no progress
w.e
He covered up your name to save you from the embarrassment. You could have said nothing about it here
You're just continuing to build your reputation
Oh, what you could do is parse that hardware info from console.txt and build a fingerprint from it
like i care? once again, its something to discuss before hand if u do any commission work dealing with people
Yeah, that's what I was thinking
You're right, I would definitely clarify that I expect payment upon delivery of goods or based on my time spent, NOT the buyer's arbitrary feelings
As someone who has done commissions, set a fixed price that both are happy with (even if you have to awkwardly ask them 3 times in a row), always expect to not get paid even then, and always triple your estimated time to complete it.
Tutoring isn't a commission though. The right thing to do is to pay someone for their time regardless.
This sounds like a lesson for both parties to confirm payment/rates
this is why i clarified my willingness to pay for any knowledge or help beforehand so he would not feel scammed & also mentioned that i should be considered a last resort as i will pay very little & have allot of free time to learn it myself
any knowledge or help
Except the help he gave you that time, I guess
so i cannot stress enough, that when dealing with modding or any type of commissioned work with people on discord you MUST discuss payment beforehand
once again i payed 20$ already for what i consider not much
simply dont work with me then
it that easy
that is the lesson he learned
And hopefully everyone else who reads this
indeed
anyway, anyone familiar with Say() know why it wouldn't inherently be MP capable?
as far as I can tell Say() is used from the chat window - but it doesn't broadcast
Yeah
I think it works both sp and mp tho
Seems like it should
But it wouldnt for your case?
It only shows up for the player themselves
Ah i think so
Hello everyone, I need light, I'm looking for an event: when the cell unloads
i need get vehicles before cell unloaded
getUseableVehicle()
The overhead speech bubble is only done if the author of the message is the current (client) player. Just is coded that way java-side
I did a example with Say() https://steamcommunity.com/sharedfiles/filedetails/?id=2735092774 #Example 3
ah, you fired a command
I should have just done that, but I was kind of curious why Say() wasn't inherently MP transmitting
Suprised no one tried to make a spellcasting mod
Maybe because throwables are garbage to code
You can get a ChatElement, which is used to display the overhead messages, using IsoGameCharacter.getChatElement
I hope a simple physics system gets added next for thrown items lol
Yeah, I was just hoping to do less work lol
if message:isOverHeadSpeech() then
local color = message:getTextColor() or {r = 1, g = 1, b = 1}
local range = message:getRange() or 60.0
player:addLineChatElement(message:getText(), color.r, color.g, color.b, UIFont.Dialogue,
range, "default", true, true, true, true, true, true)
end
Have them working in custom chat tabs I'm working on, forgot about them
Would that also be overhead or just in the chat?
It's both
and it would work in MP?
Don't think I specifcally tested multiplayer, but ought to work. This doesn't go through that code that compares author name to player name
oh
I can test real quick
idk if you can set position of a item_ground, something like item:setX(), if it were exposed, surely it is possible
I mean for projectile arcs
the current system seems way too simple and still uses the 2d sprites afaik
I saw a mod use 3d projectiles, but it is highly obfuscated
would be neat to have an aiming system where you can control the arc based on how close you aim to yourself and holding down the left click
basically old school archery flashgames - but in this case for throwing items to distract zombies, or moltovs, or even archery technically
This is what I was using before,
player:Say(text, return_color.r, return_color.g, return_color.b, UIFont.NewSmall, vol, "default")
Very similar args, but Im curious what the last 6 trues are doing
Oh, I didn't yet finish the networking for the custom chat tabs
so not broadcast to other players
Seems to work in MP atleast bymyself
surprisingly I didn't realize but Say() uses huge font even though I had newSmall
Those last few are whether or not to interpret rich text codes, embedded images in text, .. few other things I don't recall offhand
Oh, it working, yea
@ancient grail #2892no, I'm looking for an "event" when unloading the cell, to getVehicles and apply my code.
UIFont.Dialogue fixes the font issue
I must have read the java wrong. Makes sense now that I see it in action. It will show the overhead if the author of the ChatMessage equals the player name.
That's in -nosteam
ty @ruby urchin and @hearty dew
I was also curious if there's a way to intercept out going Say()'s
conditional speech plays messages but it also parses the phrases through filters
I was wondering if I could apply the filters to player inputted text
You can intercept lua-side calls of Say(), yea. Can do that by decorating the function on IsoPlayer
There is a global function, processSayMessage (or something like that), you could use to intercept text players type into the chat window too I believe
Err, wait a minute. I had things confused. Say() doesn't work. Chatting via the General tab does though.
--[[
Usage example:
ChuckUtils.patchClassMethod(zombie.inventory.types.Moveable.class, "getDisplayName", function(original_fn)
return function(self, arg1, arg2, ...)
local modData = self:getModData()
if modData and modData.new_value then
return modData.new_value
end
local result = original_fn(self, arg1, arg2, ...)
result.someProperty = false
return result
end
end)
]]
ChuckUtils.patchClassMethod = function(class, methodName, createPatch)
local metatable = __classmetatables[class]
if not metatable then
error("ChuckUtils.patchClassMethod: Unable to find metatable for class "..tostring(class))
end
local metatable__index = metatable.__index
if not metatable__index then
error("ChuckUtils.patchClassMethod: Unable to find __index in metatable for class "..tostring(class))
end
local originalMethod = metatable__index[methodName]
metatable__index[methodName] = createPatch(originalMethod)
end
hmm sorry had to step away
this would let me replace or add onto existing functions?
btw for context this is to make a drunk filter
๐
Either one. You provide it a function to replace the original. You also have original_fn to use to call the original
ah I see that now
ChuckUtils.patchClassMethod(zombie.characters.IsoPlayer.class, "Say", function(original_fn)
return function(self, arg1, ...)
arg1 = "I always say this"
return original_fn(self, arg1, ...)
end
end)
Something like that. Didn't test it
In this case how would I grab the player object?
self is the player object
Oh I assumed self was the method
All the arguments in that returned function are what the original function would receive
Say() has a number of overrides too iirc, so be mindful of that
Is it possible to change how long does it takes for the forage zones to get refilled?
Doesnt seem to work outright - I am using the chat window though -- should I use the addChatline instead?
So patchClassMethod will only intercept calls to java objects done from lua code. Is that what you are trying to do here?
Typing in a message into the General tab of the chat window doesn't call addChatline from lua (it might call it from the java-side, I'm unsure)
I think udderevelyn wrote something like this
If you want to intercept General tab chat window messages before they are sent to the java side, decorating processSayMessage would do that, I believe
hm, I can check the arguments to control what gets changed too
local original_processSayMessage = processSayMessage
function processSayMessage(command)
command = "modified"
return original_processSayMessage(command)
end
can you overwrite methods that way?
yep
there's an every minute event, right? not seeing it in the list
Tyrir is a wizard
It's nothing special, just a function in the global table _G. What's special about it is it is tied to a java method that kahlua takes care of
that's the standard approach to replace a method in modding generally
UdderEvelyn is a Wizard
i hook OnPlayerMove and throttle it to every 7 seconds (configurable)
there's no unload event afaik but there is a reuse event for gridsquares
See that.. wizadry
EveryOneMinute
thanks
.
how often does OnPlayerUpdate fire btw, if nothing is changing for the player of meaning will it still fire pretty regularly?
need to choose between those.
this is only a very temporary event handler that will be removed in a few seconds after login
so.. i guess not that serious of a decision
event load cell exist?@weak sierra
for squares, not cells
the game doesn't load cells
it loads chunks and squares
it has a chunk relevance system
ha yes, loadGridSquare
where it loads/preloads things that are seen as needed or soon needed on the server end
yeah
but also reusegridsquare
reuse occurs when a square is being recycled to display something else
so it means a square was unloaded too
not sure if u can get the unloaded info tho
or do anything with it once that happens
if this is for ur vehicle position remembering mod
i'd hook when you get in and out of cars
for the whether they're in
as for the vehicle position
that's more complex and i assume what ur on
for optimization
hmm
could hook BaseVehicle.update
and throttle it to every minute or so
and only if player car
or better yet
hook a player event like onPlayerMove (if it fires in a car, i assume it does)
again throttle it
maybe to every X seconds
if in car
store car pos
in global mod data
on my vehicle respawn i throttle to every 7 seconds
i estimate that provides a decent coverage with movement
even when going quick
in fact i know it fires in a car, i do that in my vehicle respawn mod
:p
i've never tried it myself, but this sort of thing has come up a few times in here and the conclusion has always been 'it's impossible'
pretty frequently, if memory serves. Was near every tick or every several ticks.. Can use something like this to observe events:```lua
for i, j in pairs(Events) do
local c = 0
local limit = 10
j.Add(function(...)
c = c + 1
if c == limit then
info(" >==-- Events."..i.." "..tostring(limit).." events raised. Discontinuing")
elseif c < limit then
info(" >==-- Events."..i)
end
end)
end
This works, but similar question - would I have to use getPlayer() to get the correct player?
Yes, and it just so happens that getPlayer() is the correct player because there is no way for split screen players to use the chat window as far as I could figure
that is true
pretty sizable update if this works - all with like 6 new lines of code
I was curious, would I /should I be applying the rest of the arguments?
Conditional Speech
ah
we've considered adding that a few times but as an RP server might be a bit weird if the character injects personality on their own, heheh
the update would apply the filters to typed chat
you could disable the moodle phrases
and have moodles impact how players type
yes
local original_processSayMessage = processSayMessage
function processSayMessage(command, ...)
command = "modified"
return original_processSayMessage(command, ...)
end
Like that? You could. If one day a new version adds more parameters to that function, your code wouldn't break if you did. So doing that would make it less brittle in that regard
the first line is what I typed
second is from the moodle increasing
drunk filter incoming
awaits
also the player should stammer when cold
would be cool to have lots of these things for all the moodles that it makes sense for
i assume ur already looking at that
like panic and tired and such
there are phrases and filters for most moodles
before now they only got applied to stock phrases
yeah
Q: is there a per-player disable option should someone wish to apply their own flavor?
not necessarily a requirement for our use but it would make it more likely to pass a vote i think for those who might wish to do it manually
The config mod I wrote up forces everyone to use what the host/admins set
mk
speaking of, I'm told there are still issues with configs and the cache lua folder
so I might have to revisit that
OnTick works for this btw. That's what I've used to get some code to run after all the world loading events
im making a mod that gives u a grace period on login
The loading events are a bit different between single player and multiplayer, so I've relied on the 1st OnTick to simplify handling the events differently between sp and mp
player is invis for N seconds and J seconds if u move instead
20s if u sit still (more grace period in case loading still) and 10 seconds if u start moving
that way when ppl log in and a horde happens to have walked into where they were
they aren't just fucked
this is important when a crash occurs in combat, for instance..
or when the server reboots for update when ur fighting
or just u log off someplace weird
OR even just zombies come to ur gen at ur house
while ur offline
lord knows
so this really only applies to mp since the load times and continue-running-when-ur-gone are why it's needed
Ah, so playerupdate should work well in that case, I'd hope, and I think it gives you the correct player object too as a parameter
i was going to hook OnPlayerMove separately
I feel like this already happens for SP
but i guess i could check the coordinates from inside of OnPlayerUpdate
and keep it to one handler
atleast from what I notice zombies dont respond right away
well even if it does it want control
fair enough
i want a halo note to tell the user, and i want much longer
although I think something like GTA where the player is faded out would be better to avoid abuse
you could logout near someone's base and relog as a means ot recon
if you're invisible
it's not KOS in normal circumstances
ah
yeah
well we run some 500 mods
so that'd be a hell of a lot of work to load in and out
hehe
but that could be an issue yeah
how do u avoid that potential tho other than logging
i did have that thought
brb
eventually when NPCs are added
it would be kind of cool if players were more like group managers
so maybe the AI could take over
but realistically PVP is hard to balance
also I don't think there would be a clean way to show the player is there but also make them impervious/invisible
there will always be cases where maybe the player would have been unseen and now it's broadcasted
another mod uses zombies dont attack instead of invis
the only similar mod i could find
but that lets zeds follow u
so..
lol
too bad there's not an "invis to zombies only"
then again that'd be wrong too in many cases
RP server like mine, person just being ignored by zombies but visible
for my server if someone tried to kill u while ur spawning in that'd be fail rp
and if someone tried to recon u by relogging repeatedly by ur base
that'd also be not ok
but since the focus isn't pvp
im more worried about the legit use cases
Are you having alot of issues of players relogging into a zombie horde?
yes
xD
we have 5.5x pop
and hordes set up in ways where they move a lot
and some users with high ping, and occasional crash issues from game bugs
etc
we had zed hearing really high before too so they'd cluster up at a running generator
heh
does anyone have any experience with modding the clothing.xml file?
for some reason, every new outfit i add will not work...
even if i literally copy and paste an existing outfit and change the guid, it dosent work
does the guid correlate to the outfit itself? or is the guid written and initialized somewhere?
Idk if there will be any perfect way to deal with it but there's probably a really low tech low impact solution
did you see the guides on #modeling?
i have though it dosen't work
is there a way to debug this issue? like im pretty lost with problems like these and have no idea where to check as there is almost nothing on the internet about this what so ever
the clothing stuff is very tedious and particular - so you're not at fault
Are you trying to add outfits?
Do you see the outfit listed but no items?
yes i am trying to add a new outfit and i do see it in the outfit list
exactly
what does the outfit block look like?
you might be missing a tag close
do you have <outfitManager> around it?
<?xml version="1.0" encoding="utf-8"?>
<outfitManager>
<m_MaleOutfits>
<m_Name>WTTTest</m_Name>
<m_Guid>5b475d5d-082b-456b-bc78-d7fcb265245b</m_Guid>
<m_Top>false</m_Top>
<m_Pants>false</m_Pants>
<m_AllowPantsHue>false</m_AllowPantsHue>
<m_AllowTopTint>false</m_AllowTopTint>
<m_AllowTShirtDecal>false</m_AllowTShirtDecal>
<m_items>
<itemGUID>92d60950-28a8-42cb-bee6-0384069f250d</itemGUID>
</m_items>
<m_items>
<itemGUID>7445da27-d930-4290-af26-515a04c96f8f</itemGUID>
</m_items>
<m_items>
<itemGUID>6c247231-dbe5-45cd-8e93-78d4ef716ff9</itemGUID>
</m_items>
<m_items>
<itemGUID>993a89f1-7dde-406d-ba1f-3d02d14db5cc</itemGUID>
<subItems>
<itemGUID>1a355b1d-3b97-4a11-a244-2b80aad8c009</itemGUID>
</subItems>
</m_items>
</m_MaleOutfits>
</outfitManager>
And these are vanilla items?
yes they are vanilla items
are you putting this inside the media/clothing/ folder in your mod?
yes
i think actually it may need it to reinitialize the guid's in the mod directory? or smth?
maybe as a reference?
ill try something
if you're only using vanilla items it shouldn't
but I'm not an expert at clothing stuff
im looking at other mods and it seems to be that they reference items in the fileguidtable that they use in the outfits
@weak sierra
is a good idea use a json as database?
yup that was the case!
you need to reference the items you use in the fileguidtable
which is really not efficient with custom mods wow
as you need to include both directory and guid
yes you do, not sure why
@weak sierra
for those who use the brita armor but the night vision device how is it activated?
Im wondering how to get a stat to constantly change a variable, the best way to try to explain i with a pic.
(the numbers are 100% chance to trip because every time i've tried to add anything that changes "trips values" based on the players current state/actions it breaks & will not work at all, so i used 100% fall ratio as a "your code is broken" if i dont fall..)
Basically if i remove the lines
_
- panic;
local panic = _player:getStats(stats:getPanic());
.
then everything will work fine. I've tried calling values in many dif ways & it seems most dont work.
examples: local panic = stats:getPanic(); or local wet = _playerdata:Wet() & then trying to have those + or - my % to fall
- I don't think you want a semicolon in the middle of your statement
- You're calling
panicbefore it's defined
i forgot to mention when i put it ontop it doesnt work at all
this is why i put it on the bottom now
Well it definitely doesn't work on the bottom
ok
so back to top at least is a start for me
so this time i didnt even bother with making panic effect anything, this results in 200 errors a second & 0% trip rate but if i remove the line : local panic = _player:getStats(stats:getPanic()); it works perfectly....
What does the error say?
my brain is officially rattled cause ive tried like 40 dif ways
will check next time i run this but its obviously written wrong atm anyway so i must change it first & come up with #41 attempt to call panic into my situations
I'd figure out the specific error before making more changes which could potentially give you a different error
you have basic syntax errors that are causing you problems. Also, if this code worked as you seem to intend they would trip at all times
yes i want 100% trip rate because if i dont trip it lets me know that my other calls are not working... if i remove the () & the call stats it doesnt give errors & simply doesnt work either lol
Probably the greatest debugging strategy I have ever heard tbf
idk if thats serious or not but yea lmfaooo its good, lets me get the it all set up, trying to go for a hyper realistic thing where you only trip or fumble a weapon under bad conditions & NEVER in good ones, not completely random, based off playerstats & such
if i could just fine tune the "butter fingers & noodle legs" traits id be playing the game rather then modding lol, but i want that hyper realism of natural human flaw, & will make it so on a perma death hosted world lollol
@weak sierra
lel
I hope you add the occasional ...hic! to the end of drunk sentences just like in WoW
This is out of context
the vote so far is 9:3
in favor
never know where it'll go tho
i posted that there as more example
Just updated
also I updated Named Lit to include comics
idk if changed the sandbox options for that yet
variety is good 
there are non-superhero comics out there too u know
lol
i admit that's a tiny fraction though
๐
It would go against the current direction of art
They're all piece-meal color swaps
except for a special 1
Speaking of which - I just used the top 250 sold per year - and they were all super hero as far as I could tell save for some alien and predator stuff
I can always add more to it
that's def a fair way to do it tbh
i remember growing up in the 90s seeing star wars comics and such too but that wasn't most of it xD
it was a bit more overwhelming than books or even magazines
I didn't include volumes for magazines cause there wasn't that much value as far as I could tell
but I was tempted to try and include issue # for comics for collecting purposes
but it was a bit daunting
so I eliminated duplicate titles within the years
and dropped issue # from my db
the online list I used also only went as far back as 84
hey fellas, I'm doing this, SQLite DB has many restrictions, and I really don't know if it will be possible to work on it freely, but I made a JSON database, I don't even know if it's convenient, but there is
{
"test" : [
],
"players" : [
{
"name" : "Test1",
"displayname" : "Tes1",
"id" : 1
},
{
"name" : "Test2",
"displayname" : "Test2",
"id" : 2
}
]
}
The apocalypse left us with only 1 porn model
Or maybe 2 cuz of the skin color
U planned to bypass restriction by doing a json?
No, use JSON like a database
Ow yeah that works but you still can play with the whitelist tho
Client need be admin to access to db, so you can't do many things
Altjo i have a script that dimms the screen or sends them back to mainmenu that can be used as an alternative i think
how do i replace individual sound files, like the jumpscare sounds
cant figure this out 
you can just replace the audio files if you want
name it the same and do a mod thats supposed to be the same directory as the file u want to replace
or you can make a script that overwrites this
sound ZombieSurprisedPlayer
{
category = Zombie,
clip
{
event = Game/ZombieSurprisedPlayer,
}
}
@bronze walrus
is there an event that fires when the player picks up an item?
better yet, can someone link me to the list of events? i'm struggling to find it
why is smoking cigar counts as on_eat
seems like anything consumed in any form is on eat & the items being "eaten" must be specified lol, its weird i agree
ya guys think this will work
local modData = player:getModData()
if player:getTraits():contains("AllThumbs") then modData['hasAllThumbs']; end
if player:getTraits():contains("SlowReader") then modData['hasSlowReader']; end
if player:getTraits():contains("Dextrous") then modData['hasDextrous']; end
if not player:getTraits():contains("AllThumbs") then player:getTraits():add("AllThumbs"); end
if not player:getTraits():contains("SlowReader") then player:getTraits():add("SlowReader"); end
if not player:getTraits():contains("Dextrous") then player:getTraits():add("Dextrous"); end
above is a temporary effect.. below if the effects is gone
if modData['hasAllThumbs'] == nil and player:getTraits():contains("AllThumbs") then player:getTraits():remove("AllThumbs"); end
if modData['hasSlowReader'] == nil and player:getTraits():contains("SlowReader") then player:getTraits():remove("SlowReader"); end
if modData['hasDextrous'] == nil and player:getTraits():contains("Dextrous") then player:getTraits():remove("Dextrous"); end
The thing in trying to do here is that the player gets all 3 traits if he doesnt have it yet
Then remove it
The mod data is there so that incase he originally has the trait then it shouldnt be removed
why does this always = 1
_
local hps = _player:getHealth();
_
i assumes Health is the white meter that drops, but when i call bleeding or blood or bleed instead of health i get errors, but health should be a 0-100# i assume yet it = 1 nomatter how damaged i am or how much my health has gone lower
once i figure out how to make the players moodles & statuses values effect other values i want them to effect ill porb be done with coding, i literally been over a week trying to "tweak" 2 already written mods to be "better & realistic"
Nvm abt this figured it out
local hps = _player:getHealth();
local pan = _playerdata:getEndurance();
top value always results in "1" unless dead.... the bottom value breaks my code..... i've also tried to bottom without the work "data", i truly dont understand how im supposed to call upon players conditional states as the numbers they are durring gameplay
OK.... so im done trying, just gonna play solo, i am willing to commission it for a total of 20$ for the "more traits mod" to be overhauled, i already have allot of code & information prepared as i have been trying to do this for over a week myself. Noone will help without money, & teaching me will cost me more (as im a fool) so if anyone wants a 20$ commision to rehaul the "more traits mod" lmk
only want noodle legs & butter fingers to work diffferntly
& some prices of the perks changes, literally that is it
my failure is i cannot figure how _player:gethealth(); is = to 1 no matter how hurt he is, from perfect to almost dead his "health" was still 1 somehow... not to mention my code breaks every time i try to call Panic() into the ratio of tripping
2 traits overhauled, all prices on the traits changed, 20$. i cannot figure it would take more then 1 hour for someone who knows the code
1 "pre existing" mod changed a bit
u should ask the mod owner directly if u can commission him/her
nah man, just tunnel vision, which happens to everyone focusing to hard on a specific problem ๐
lol
yea a week of rattling my brain over it i just want to scream, i feel like im just missing like 1-2 little bits of info that would result in me being able to do it myself
after saying his script is written as "sloppy" live on twitch
i would have preferred them to write is cleaner, but the result is the same, i complained because it made it hard for me to recode
was there a reason you bring this up?
if u wanna do it ur self, u have to embrace the challenge. that is coding in a nutshell. u get frustrated, u get even more frustrated, eventually u solve the problem, u get an aha moment, u are proud, the next problem comes along, sigh, and repeat.
i very well know, this is my first time with LUA but not my frist time dealing with code
or modding
so u well know, that u can do it. just take a breather. and take another look at it later. but remember if u do, dont publish ur modified version. only the mod owner is allowed to do so. that is why commissioning them is actually a smart move.
oh unless u just make a patch, which does not require u to reupload the whole mod. then it would be fine.
100% aware of the unlisted laws lol
Anybody knows if translations are planned to change? Seems like most files use unnecessary formatting.
File: media/lua/shared/Translate/En/Tooltip_En.txt
--// Formatting tips // textArg = "Language Text" // 1st line is skipped // lines that have -- are skipped // lines that end with .. are skipped // ..
Tooltip_txt= "My Text"
I think it's more related to lua formatting the strings or something
Because those look lime Lua key symbols thingies
-- is a comment line, .. is string concatenation
yeah i agree with @tardy wren . I think those are just warnings / hints for people that will translate a mod into different languages. so most of them are not familiar with coding / modding / lua syntax.
I mean, translations usually add
first line: Tooltip_En
{
text = "My text"
/* comment */
}
which are mostly not used,
except for the valid text line which is added
Huh, so maybe that's why it's broken on my end... I need to check what's up
also commas are unnecessary
translation is text that is loaded how a code fragment, that's why need commas
seems to work without?
player:getBodyDamage():getOverallBodyHealth() gives you hp value from 0 to 100
at least a line break is enough
player:getStats():getPanic() is for panic from 0 to 100
6-30 is slight panic
30-65 is panic
65-80 is high panic
80 and above is max panic
mhm but panic and hp is 0 to 100
Technically there is no difference between using 1 or 100
and those r the stats he needs
Yeah
If I recall the health that's 0 to 1 is only the total used for the UI
Setting that one to 0 kills you tho
Also Zombies have a health of 2
Fun fact
u can modify that to 14 for every zombie once during zombieupdate and see what happens to the player base ๐
i dont think i wanna know
I set my super spiffo to 10000
Also if he somehow dies it fires a location event to revive outfit matches
The only way he has "died" (caught on a stream) was poorly pathing over a railing and getting stuck in water
that is cool.
Unfortunately I didn't see a way at the time to prevent death
But with what I learned yesterday it could be done a bit easier
has he a specific zombie model?
He has a unique costume
awesome. now u gotta share a picture ๐
okay okay. i guess there is a new cute undead challenge for my players. fun fact: they liked the zombies with 14 HP and asked for more ๐ฅฒ
How hard is it to kill 14 HP zombies?
I found that even at 10000 HP some weapons would instantly kill
Hm, good question all the dmg of our weapons is also heavily reduced and modified. I noticed that I need generally 1-2 more hits for every zombie.
Google says readLine doesn't need commas
Is 10k the maximum then?
we also have some zombies with specific outfits that regenerate their HP alltogether after a few seconds.
Nah, I tried 1 million
Hence I just left it on 10k and worked out a delayed revive
What mod is this?
CDDA?
thankyou for the free tips! i may try again & just have it click*
Zambies is the zombie mod we use, but we patched some stuff for our needs. and the weapon tweaks are not part of any mod.
I mean, the spears sometimes do make an attack that doesn't drop their HP to 0, but still kills the zombie
Tho I wonder how much the 1 hp translates to the damage numbers mod values
ok so how does transmitModData and getModData exactly work? Trying to set up a table for an item which will be used in a timed Action, where the said table will be changed and then it should be saved by the server but i cant get my head around how to do it?
IIRC getModData basically you can set metadata and transmitModData is send that data to server
does this also work sp with transmitModData and getModData?
wait, can i create getModData for anything, like for any item aswell?
yes, many mods make use of that. eg. nvg items store, the brightness and so on.
this is what ive been trying to figure out the whole day lol
showting progress tho .. its just confusing to code with modadata
Think you can since there is a getModData call for an item
almost everything has modData, but getting it to save properly is the challenge
hmm, funnily enough it seems atleast for sp that just calling getModData for items is enough to store the variable, there is no need to transmitModData for it
transmitModData is usually to send changes you've made on the server to the client, so ya its probably not really necessary for SP
can i then check if i am in sp or in mp to save it, since when i transmitModData in sp it causes an error and i dont have a dedicated server to test it
well atleast in the Pz Api website there is not transmitModData for an IsoItem soooo
I believe those mod data methods are on IsoObject, or some common superclass
But it is the same form of syntax as getModData right? Cause iโd do transmitModData after i set my variable but the game keeps erroring for me when i put in the call
anyone have a resource regarding how the new 3D items on ground work in terms of the default spawns? e.g. pots on kitchen counters, etc.
What is the code and error?
I guess in general its that im trying to transmitModData on an inventoryItem and not on an IsoObject
But ive no idea whether the changed moddata of an item will be saved to the server
So essentially the situation is
self.gun:getModData()
(Do some stuff)
self.gun:transmitModData()
what are you trying to do?
@neon bronze
permanent change to all item?
use item tweaker
if for a certain gun only
local shotgun = InventoryItemFactory.CreateItem("Base.DoubleBarrelShotgun");
shotgun:setTooltip("initially has 6 chambered shells");
shotgun:setClipSize(6);
shotgun:setCurrentAmmoCount(60);
shotgun:setRoundChambered(true);
shotgun:setAimingTime(90);
shotgun:setMinDamage(5)
shotgun:setMaxDamage(12);
shotgun:setName("SOS ToxSicK Event Shotgun");
getPlayer():getInventory():AddItem(shotgun);
heres a debug snippet i wrote that we used for a server event.
Nah, nah im trying to set a variable for a gun in its moddata
Hey guys, I was wondering if anyone can guide me if time allows it?
So i can call it up in other codrs
guys what if theres no sleep on the server and i did getPlayer():getStats():setFatigue(50)
how will they reduce the fatigue
Indeed, it doesn't have transmitModData. It appears to be saved when InventoryItem.save is called though, so I'd expect it to be saved client-side
Ok but when the said item gets dropped on the floor and then picked up by another player will he have the same modData as player A or a totally different one?
Not sure, didn't trace the save method calls that far
or should i do this
if getServerOptions():getBoolean("SleepAllowed")
then getPlayer():getStats():setFatigue(50) end
Well, guess thats just more testing for people
Could look to see what the code does between the client and server when an item is dropped on the client. Or could just quickly test it
Yeah iโd just give the code to someone i know who has a server to test it and see if it works but i hope it does
Since i didnt see anywhere in other code snippets that stuff like ammo in a gun has to be manually transmitted to the server
Probably coffee and vitamins.
You know, like most IT people.
thnx
If you have a server with no sleep and you regularly set fatigue up by a couple, you could create a thriving market for coffee.
good idea

