#mod_development
1 messages ยท Page 225 of 1
even though it's in the lua folder it's not actually lua, and the game is hardcoded to check that path for them
Ok cool
And don't worry, someone will reupload the entire thing just to add 1 localization ๐
How would I mod the entire first season of two and a half Men into Pz?
what is the line of text for giving xp for metalworking
How can I link the game to the modding thing Im doing? I am getting thousands of warnings of this type
if you have git installed you can use the addon manager to download umbrella (in vscode, ctrl-shift-p -> lua: addon manager -> search for umbrella and enable)
Oh my god thanks, that removed 90% of the warnings
I had forgotten to enable Umbrella, I just installed it -_-
ERROR: General , 1711069162014> 25,567,899,605> at zombie.scripting.objects.ScriptModule.getItem(ScriptModule.java:480) getting this error when loading up the server after updating my mod
any suggestions?
Can the client transfer custom data to the server?
can someone explain to me how server commands work
Yes. I assume you're referring to Global Moddata, so yea its possible. It's possible as well with normal Moddata tied to specific objects, but it has its own functions, depending on the case. There are multiple mentions of both types of data on the discord, so you'd find a lot of information on how to implement either by searching them
Oh, Thank u!
Can I transfer audio data/raw data?
You use server command when you want to send some kind of data or execute a function on a client, and the command is sent from the server. You do this using sendServerCommand(player, 'MyModule', 'MyCommand', argsTable). Example:
sendServerCommand(player, 'MyModule', 'MyCommand', { message = "Hello! This is sent to client!" })```
Not specifying the player will send the command to all connected clients.
You can define the command as follows:
```lua
local MyModuleServerCommands = {}
function MyModuleServerCommands.MyCommand(args)
print(args.message)
end
local function OnServerCommand(module, command, args)
if module == 'MyModule' then
MyModuleServerCommands[command](args)
end
end
Events.OnServerCommand.Add(OnServerCommand)
is this being written correctly?
recipe Make Duct Tape
{
LeatherStrips=5,
Woodglue=5,
ammomaker.ammomaker_RecPlastic,
NearItem:forge,
Result:DuctTape,
Sound:PZ_FoodSwoosh,
Time:200.0,
Category:Cooking,
OnGiveXP:Recipe.OnGiveXP.Cooking5,
}
I really have no idea about audio data. What do you mean exactly by raw data?
binaries
I'm newbie in modding, sorry
I don't understand how entire game works
I am not really sure about this regard, sorry, but generally you use global moddata when communicating between server/clients with data that isn't tied to a specific object.
What is global moddata?
simply data that is used by the mod and isn't necessarily tied to an object (like a character/item/vehicle/etc)
Oh, ok, i see
looks correct to me, but i haven't personally worked all that much with recipes to be able to identify potential issues with the definition. It'd be ideal to test it
lua doesn't really support binary formats well but you can technically send anything as long as you can represent it as a string
it generally tends to lack libraries for file formats
Thank u for answer
I want to make mod which lets u upload music on server and server will be transfer that audio to all clients
i think you might be able to read the files and even send the data but i don't know if you'd be able to get the client to actually use it
i don't think there's anything exposed to lua that would allow you to load arbitrary sound data, and loading files is sandboxed to mod directories which you shouldn't write to or the checksum will fail
Hi everyone, I'm working on a mod that would allow player to do a backward step dodge , I made some progress on the scripting part, but I am shit animator with 0 animations skill. Is there someone skilled I can commission to make the animation for me?
trying to get this recipe to use the Forge from Crafting Enhanced Core. But it's not working
recipe Make Duct Tape
{
LeatherStrips=5,
Woodglue=5,
ammomaker_RecPlastic,
NearItem:Forge,
Result:DuctTape,
Sound:PZ_FoodSwoosh,
Time:200.0,
Category:Cooking,
OnGiveXP:Recipe.OnGiveXP.Cooking5,
}
any advice or do I need to import Crafting Enhanced Core?
Where do I place a local mod in order to test it in game?
on windows, %UserProfile%/Zomboid/mods/
Ok, I added it, but it crashes and I have no idea where to look for the crash reason
It didnt crash with debug mode off, but it crashed when debug mode was on
the game logs to Zomboid/console.txt
Well I am really pissed off, a lot of stuff isnt working with my mod and I dont really know how to fix it or where to look for the errors
What is the purpose of BodyDamage for each player? I ask this because you can do playerObj:getMoodleLevel(moodleType), playerObj:getBodyDamage():getMoodleLevel(moodleType) and playerObj:getBodyDamage():getUnhappynessLevel() and from what I can see they do the exact same thing.
How in the world do I completely overwrite a vanilla gun?
I have it set as
module Base
{
item Pistol
and all that but even when I re-name it at the "DisplayName" spot and change it's models and textures, for some reason it still comes up as the "M9 Pistol".
Vanilla doesnt use the DisplayName in the script as its actual display name but the translation files in lua/shared/translations
Is that it? Holy moley I hope it is
Thank you a ton. That was it
One is made to directly get unhapiness without referencing the type, and getMoodle can most likely be applied to 2 different class "IsoPlayer" and whatever is called BodyDamage in java
So while yes it feels redundent, there's lots of things that can be redundent in the game but this can have different uses
sorta makes sense
BodyDamage does many things other than that
the redundant methods are just for convenience
there can also be cases where the method has moved and the redundant methods exist for backwards compatibility
Good night/good morning guys
I wanted to know something, if it's possible.
What are the steps to ensure that a certain tile can only be built with a certain skill level?
Crafting Enhanced Core doesn t have support for that
Yes, I know, but the creator gave me permission to modify the framework. So I'm trying to think of a way to integrate this
In the object recipe you need to add a new table with the skill name and level, and in the function that materials are verified add a check for those skills.
where do I find the functions that make items remember stuff like durability when used for crafting? And can I make it remember more stuff, like magazin or ammo count for guns?
in tile definition, what this is called location_shop_fossoil_01_14?? i need to use it for a check is it the TileName or CustomName?
what's the name of this properties? the name you see when you use brushtool to copy tiles
trying to get this script to give a small amount of metalworking xp
Result:ScrapMetal,
Time:30.0,
OnGiveXP:Recipe.OnGiveXP.Blacksmith1,
Category:Welding,
AnimNode:Disassemble,
CanBeDoneFromFloor:true,
Prop1:Screwdriver,
Prop2:CDplayer,
}
something im missing here?
ISCraftAction, should have thought of this. Thank you โค๏ธ
Blacksmith is not Metalworking. use "Metalworking" instead of Blacksmith. If this does not work, try "MetalWelding". I am uncertain wich of both is true
makes sense
recipe Make Wood Glue
{
Salt=1,
Flour=3,
Water=2,
keep [Recipe.GetItemTypes.Bowl],
Result:Woodglue,
Sound:PZ_FoodSwoosh,
AnimNode:Craft,
CanBeDoneFromFloor:true,
Time:200.0,
Category:Cooking,
OnGiveXP:Recipe.OnGiveXP.Cooking5,
}
this one is giving me trouble
I wanted it to keep the bowl but it doesn't even recognize the bowl in the in game recipe
have all of the items but won't actually craft it
This stuff is managed in the lua (recipecode.lua on server). So if you want to add bowls in the recipe, they need an entry there
oh bowls don't work like the [Recipe.GetItemTypes.Screwdriver]?
They would, if they had a lua entry like the screwdriver or hammer has
ah okay so in my server recipexode.lua i need to add it in
basically yes, but you dont really want to alter the vanilla lua files, especially not if you want to publish a mod (you can test stuff in there though, just dont forget to make copies of the original data)
so in theory if I just remove the bowl line it should work?
from your recipe? I would assume so
I also noticed in the recipecode that Woodglue is actually WoodGlue
addExistingItemType(scriptItems, "WoodGlue")
or does that even matter
I am honestly not certain about this, but if you want to play safe, just write it with capital G
alright and last but not least
recipe Make Duct Tape
{
LeatherStrips=5,
Woodglue=5,
ammomaker_RecPlastic,
keep [Recipe.GetItemTypes.Paintbrush],
NearItem:Forge,
Result:DuctTape,
AnimNode:Craft,
CanBeDoneFromFloor:true,
Time:80.0,
Category:Cooking,
OnGiveXP:Recipe.OnGiveXP.Cooking5,
OnCreate:BSItem_OnCreate,
NeedToBeLearn:false,
}
this one here im trying to make it so folks have to be near the forge for it to work
however it won't actually craft
I dont think that paintbrush has an entry in recipecode either, so it does not work, just like the bowl
what exactly is the issue?
so I was looking to make it use while near the Forge
which is a base item
but it dosn't work
did it work before adding the Forge line?
Did it work?
I shouldn't have to import Base for it to work no?
server is restarting with udderly so will take a bit
ill let you know
I am not sure about this part. But if you can see the recipe and other recipes from the same script work, it should not be nescessary
ah okay
The only use of "NearItem" I see on the vanilla scripts, is for the anvil. This stuff has not been introduced yet fully (or did I somehow miss like half the game? :D), plus the Anvil has an extra lua file describing it, so that might be why it is not working
hmmm
should i try that then?
because there is an anvil connected to it when it is built
I was copying the code from another mod to match
{
imports
{
Base,
}
/************************ Metal ************************/
recipe Cut In Metal pipe
{
SheetMetal=1,
NearItem:MetalCutter,
Result : MetalPipe=3,
Time : 80,
Category : MetalCutting,
Sound : weldingmachine,
CanBeDoneFromFloor : TRUE,
NeedToBeLearn: falsed,
}
but maybe they are using the code in their own scripts to pull from
what mod is this?
Machines
Yes, that one has lua for all the "NearItem"-Items
Did you test your mod together with machines?
Yea I have the mod in server
but I guess I need to import machines?
or maybe the Forge id is just worded different
I have no clue, I am not that good with the lua stuff
Ah! ๐ That could be it!
nameID = "Forge Table",
Yes, that is what their lua says, I see it
now if that doesn't work ill try Importing MCH
I would advise you to test your stuff in singleplayer, so you dont have to reload the server each time you make a tiny change
yea that is fair
just load up the mods using the crafts and go from there
In debug mode, you often dont even have to restart your game, just reload the lua ๐ very quick and easy (tends to not work if you add new files though, then it is restart time. changing existing files seems to work though)
dope ill try that
so do i have to create a text in lua/server
or does it just runs in the defult pz api?
i dont think i know anything about it really
yea, you create a file to define the server command, say, MyModule_ServerCommands.lua, and input a code similar to the example I gave you
then whenever you want to use that command, you use the sendServerCommand snippet from anywhere in your code, as long as you're sure it's being run on server
yea should be. Though something to keep in mind is that if you're manually setting them, just server commands won't be enough since the command originates from a client (an admin), so you will have to use a combination of both Client Commands and server commands
well we did manage to make it work in coop
Shouldn't be a problem then
can i dm you ?
sure
is anyone experiencing an issue in which your character becomes invisible while sprinting?
is it possible to generate new item types at runtime? say blue watermelons
I'll go ahead and promote the last update for my submod for Lifestyle: Hobbies here
if it's in the wrong section I'll delete it
the game crashes when i equip my weapon any idea where to look?
Hi guys. I made a backward dodge animation. but in game it looks horrible. The backward dodge functionality is working but animation is not. Does anyone know how to fix this?
Issue with armature export
In export settings > armature > swap primary and secondary to respectively X and Y
It worked! thank you so much
๐
offtopic but is this the vanilla character model?
i managed to remove over 1000 vanilla items from spawning, however the bullets and ammo boxes still appear no matter what - any clue what might be the case?
nope it is from the mod variable skin 3
Change their Displaycategory to anything else
Hello everyone and sorry for my bad English...
I'm now getting into mods that add recipes and I'm starting with simple things
I would like to create a recipe to make jam with 20 berry units.
I wanted to make it so that you could use different types of berries to create the jam.... but I'm stuck
Is there a command that can allow you to create this type of recipe???
Here's how I set up the recipe:
recipe Create Berry Jam
{
destroy EmptyJar,
destroy JarLid,
BerryGeneric1/BerryGeneric2/BerryGeneric3/BerryGeneric4/BerryGeneric5/WinterBerry/BeautyBerry= 30,
Sugar= 1,
WaterPot= 1,
CanBeDoneFromFloor:TRUE,
SkillRequired:Cooking=1,
OnGiveXP:Recipe.OnGiveXP.Cooking1,
Time:2000.0,
Heat:-0.22,
AnimNode:Craft,
Category:Base,
}
ERROR: General , 1711157789335> ExceptionLogger.logException> Exception thrown java.lang.NullPointerException: Cannot invoke "String.indexOf(int)" because "<parameter1>" is null at ScriptManager.getItemName line:193.
ERROR: General , 1711157789335> DebugLogStream.printException> Stack trace:
java.lang.NullPointerException: Cannot invoke "String.indexOf(int)" because "<parameter1>" is null
at zombie.scripting.ScriptManager.getItemName(ScriptManager.java:193)
at zombie.core.skinnedmodel.ModelManager.addStaticForcedTex(ModelManager.java:1817)
at zombie.core.skinnedmodel.ModelManager.addStatic(ModelManager.java:1812)
at zombie.core.skinnedmodel.ModelManager.addEquippedModelInstance(ModelManager.java:1055)
at zombie.core.skinnedmodel.ModelManager.DoCharacterModelEquipped(ModelManager.java:976)
at zombie.core.skinnedmodel.ModelManager.ResetCharacterEquippedHands(ModelManager.java:842)
at zombie.core.skinnedmodel.ModelManager.update(ModelManager.java:1254)
at zombie.gameStates.IngameState.updateInternal(IngameState.java:1698)
at zombie.gameStates.IngameState.update(IngameState.java:1333)
at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:101)
at zombie.GameWindow.logic(GameWindow.java:298)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:765)
at zombie.GameWindow.run_ez(GameWindow.java:681)
at zombie.GameWindow.mainThread(GameWindow.java:495)
at java.base/java.lang.Thread.run(Unknown Source)
I can't get my two-handed weapon to show, when I equip it in both hands, the game crashes.
not sure but my best guess based on the error is that there's something wrong with the weapon definition in the script file
might need to have another look at it
New mod to make Hazardous Zones use Susceptible's framework
https://steamcommunity.com/sharedfiles/filedetails/?id=3196616278
recipe Create Berry Jam
{
destroy EmptyJar,
destroy JarLid,
BerryGeneric1/BerryGeneric2/BerryGeneric3/BerryGeneric4/BerryGeneric5/WinterBerry/BeautyBerry= 1,
Sugar= 1,
WaterPot= 1,
Result:BerryJam=1, /* result */
CanBeDoneFromFloor:TRUE,
SkillRequired:Cooking=1,
OnGiveXP:Recipe.OnGiveXP.Cooking1,
Time:2000.0,
Heat:-0.22,
AnimNode:Craft,
Category:Base,
OnTest:MyBerryJamLuaFuncOnTest, /* here LUA FUNC for check, if false, then can't create */
OnCreate:MyBerryJamLuaFuncOnCreate, /* here LUA FUNC when recipe done, we should remove another 29 count of berries (1 in recipe, 29 in invenotry) */
Tooltip:Tooltip_NeedTotalBerry30count, /* string for translate */
}
function MyBerryJamLuaFuncOnTest(item)
if DO STUFF HERE then
--Where we count the total number of all berries in the inventory, if not 30 then return false
return false
end
return true -- if total number of berries == 30
end
function MyBerryJamLuaFuncOnCreate(items, result, player)
--DO STUFF HERE with counter 29, where we remove 29 berries from player inventory
end
don't use OnTest if you aren't testing the actual item, use OnCanPerform
massive waste of performance
Hello pals! Do you know how to replicate the reduction of panic like the beta blockers but with a food item?
hmmm
Random question
Have recipe as
ScrapMetal=1, (or using just ScrapMetal)
keep <mymodtool>,
Result:Screws=10,
Time:100.0,
Category:Welding,
But yet the output for the recipe is somehow stuck on 50 and not 10? Using craft helper to view recipes it even shows as the wrong result number.
because Screws like item in scripts have string Count = 5
Anyone? ๐ฆ
I guess for panic you will have no choice but adding new lua
beta blockers are hardcoded
you can use an OnEat function to reduce the player's panic
you'll probably want to have a mechanism to do it over time like beta blockers do, instantly reducing the player's panic doesn't do much since it goes down pretty fast on its own and goes back up very quickly
What I did is the following:
item ItemSampleFood
{
DisplayName = Bolillo,
DisplayCategory = Food,
Type = Food,
Weight = 0.2,
Icon = MakiBolillo,
FoodType = Bread,
Packaged = TRUE,
DaysFresh = 10,
DaysTotallyRotten = 6,
HungerChange = -15,
Calories = 120,
Carbohydrates = 20,
Lipids = 2,
Proteins = 4,
Tooltip = Tooltip_PillsBetablocker, --This to add the "reduces panic" text
OnEat = OnEat_Function,
CustomEatSound = EatingCrispy,
WorldStaticModel = ItemSampleStaticModel,
}
Where OnEat_Function is the following:
function OnEat_Function(food, character, percent)
local playerBody = character:getBodyDamage();
-- heal moodles and status
playerBody:setPanicReductionValue(01);
end
it reduces the Panic value, but it reduces it continuously, without stopping haha
how can I make it only over a small time frame? like for 20 in-game minutes or something like that ๐ฆ
what should my files layout be like if im combining 2 mods into one?
function newMyModedOnEat_Function(food, character, percent) -- in your food onEat should be write this func
local playerData = character:getModData().newMyModedReducedStatusTimer;
if playerData == nil or playerData < 30 then -- Where 30 - it's your count of event tick, here be Events.EveryHours.Add
playerData = 30 -- 30 hours on this example
end -- when we eat food again - it's restore 30 to counter
end
function newMyModedHealthAdjust_Function()
local player = getPlayer();
local playerData = player::getModData().newMyModedReducedStatusTimer;
local Body = player:getBodyDamage(); -- maybe player:getStats(), im not sure
local zGetPanic = Body:getPanic();
local zReducePanic = 0.012; -- your number of reduced here, every hour panic be reduced on 0.012 in this example
local zReducedPanic = "";
local zSetPanic = Body:setPanic();
if playerData > 0 then
zReducedPanic = zGetPanic - zReducePanic;
if zReducedPanic < 0 then
zReducedPanic = 0
end
zSetPanic = zReducedPanic;
playerData = playerData - 1; -- reduced counter every hour
end
end
Events.EveryHours.Add(newMyModedHealthAdjust_Function)
something like this +-
not sure about getBodyDamage, with panic it's should be getStats() if im not wrong
items.txt
module CRMConsigneeOutfit
{
imports
{
Base
}
item CRM_KillStick
{
DisplayCategory = Weapon,
MaxRange = 1.5,
StaticModel = CRM_KillStick,
WorldStaticModel = CRM_KillStick_Ground,
MinAngle = 0.8,
Type = Weapon,
MinimumSwingTime = 2,
KnockBackOnNoDeath = FALSE,
SwingAmountBeforeImpact = 0.02,
Categories = Improvised;Spear,
ConditionLowerChanceOneIn = 10,
Weight = 4.5,
SplatNumber = 1,
PushBackMod = 0.3,
SubCategory = Spear,
ConditionMax = 7,
MaxHitCount = 2,
DoorDamage = 5,
SwingAnim = Spear,
DisplayName = Kill Stick,
MinRange = 1,
SwingTime = 2,
KnockdownMod = 0,
SplatBloodOnNoDeath = FALSE,
Icon = Base.Nightstick,
RunAnim = Run_Weapon2,
IdleAnim = Idle_Weapon2,
TreeDamage = 0,
TwoHandWeapon = TRUE,
CriticalChance = 30,
CritDmgMultiplier = 10,
MinDamage = 1.5,
MaxDamage = 2,
DamageCategory = Slash,
DamageMakeHole = TRUE,
BreakSound = SpearMacheteBreak,
HitFloorSound = SpearMacheteHit,
ImpactSound = SpearMacheteHit,
DoorHitSound = SpearMacheteHit,
HitSound = SpearMacheteHit,
SwingSound = SpearMacheteSwing,
SoundMap = SpearStab SpearMacheteStab,
AttachmentType = Shovel,
Tooltip = Tooltip_CRM_KillStick,
}
}
meshes.txt
module CRMConsigneeOutfit
{
imports
{
Base
}
model CRM_KillStick
{
mesh = Weapons/2handed/CRM_KillStick,
texture = Weapons/2handed/text_CRM_KillStick,
attachment world
{
offset = 0.0000 0.2450 0.0000,
rotate = 0.0000 0.0000 0.0000,
}
}
model CRM_KillStick_Ground
{
mesh = WorldItems/Weapons/2handed/CRM_KillStick,
texture = Weapons/2handed/text_CRM_KillStick,
attachment world
{
offset = 0.0000 0.2450 0.0000,
rotate = 0.0000 0.0000 0.0000,
}
}
}
I don't know if the modules are ok or if I have to leave them all in Base.
Although I have tried all possible combinations before and the game still crashes when equipping the weapon.
Icon = Base.Nightstick, -- this is normal?
I've tried with Base. and without it, it still crashes.
replace back all params with those of Spear machete until it stops crashing
Does nightstick icon file name is Item_Nightstick?
I thought I didn't have to use the Item_ Although if I'm using the Base module I might replace it.
ok, give me a moment
Item_ should be only in the png file. In your code you only need to put the name after the
_
Png file: Item_Nightstick
Icon= Nightstick
It is a problem with the object. In blender I have exported it applying the scale to 1 and also to 0.1 (as all the imported .x items come)
oh.. @sour island ... i just opened up your new errorFixifier mod.. and made me laugh...
upon reading your mod description, I couldn't help but to open up the .lua ...
and BAM....
engageEvent(month, data)... ```
Hmm i don't see a display name parameter
Maybe that's the issue?
DisplayName = Kill Stick,
Hehe
I really don't know what to do anymore, everything is fine in Blender. I export it with all the transformations applied. The path of the configuration is ok, it has to be some parameter. I've also checked the , and none of them are missing.
I did. As soon as I put StaticModel = CRM_KillStick, Already crashes
Because I won't have to put the Sprite with my custom model, will I? I mean what it uses is a .png image not the .fbx/.x model.
@errant bluff what's is the problem u r having again? i missed it
When I equip my two-handed custom weapon, the game crashes me
StaticModel references an entry in your models script (or a model entry). The model entry then references the actual texture and mesh. If done correcty, there should then be no crash
Do you have WeaponSprite in your script?
You are right. It has to be WeaponSprite, not StaticModel. Missed that totally
Trying it right now
That was!
Awesome ๐
Anyone know what lua function handles this texture? patches_<body_part>_<fabric_type>? Is it just on ISGarmentUI.lua?
This texture ?
patches<body_part><fabric_type> This format
I was hoping to get the invisible clothing patches as a sort of benefit for Tailor occupation instead of just replacing the patches' actual texture with blank image
But I just confused myself checking over between ISGarmentUI.lua and ISInventoryPaneContextMenu.lua
If you can give me any pointers, that would be great, thanks!
They are hardcoded in java, you can't change them from lua
oh man that sucks
Looks awesome pal!
im Trying to make a recepie that changes output depending on calories, result is LTSBitsMeat and the are spawned in but in the
OnCreate it cant find the LTSBits Meat the CakeSlice get spawned any idea for the reason?
player:getInventory():AddItem("CakeSlice"); --vanilla
player:getInventory():AddItem("LTSBitsMeat"); --From a different mod
update:
found the problem i neaded to add the module
player:getInventory():AddItem("DLTS.LTSBitsMeat");
Thank you all for your help!
Hey, I got a quick question, how can I find what ItemGUID it refers to which Item in the gamefiles ?
I've got a list of ItemGUID that I need to find what item they refers to
Now I have another problem. I have a face shield that has a transparent texture. What happens is that this transparency affects the mask. The beard disappears and the jacket also disappears in the area of the face shield.
Here you can see that it looks good, in the character info window but...
What looks good is the T-shirt under the jacket
<clothingItem>
<m_MaleModel>media\models_X\Static\Clothes\M_CRM_ProtectorFaceShield.fbx</m_MaleModel>
<m_FemaleModel>media\models_X\Static\Clothes\F_CRM_ProtectorFaceShield.fbx</m_FemaleModel>
<m_GUID>14fef8bf-aacf-4939-b91a-6a3313331e0d</m_GUID>
<m_Static>true</m_Static>
<m_AllowRandomHue>false</m_AllowRandomHue>
<m_AllowRandomTint>false</m_AllowRandomTint>
<m_AttachBone>Bip01_Head</m_AttachBone>
<m_MasksFolder>media/textures/Clothes/Hat/Masks</m_MasksFolder>
<textureChoices>clothes\hat\CRM_ProtectorFaceShield</textureChoices>
</clothingItem>
If I have the name of an item like "Base.ConcretePowder" is it possible to get the display name from that item in the script without creating the item? I know if I Add.Item("Base.ConcretePowder") and then do a getDisplayName() on it, I can get the name but trying not to spawn the items first.
Not too sure about that
getItemNameFromFullType("Base.ConcretePowder")
Does anyone know how fuel pumps determine whether or not it has power running? My blackouts mod seems to have a problem with gas stations in particular
it seems that once the gas pump's value is stored, that particular pump will stay on forever
@rancid panther ISWorldObjectContextMenu.doFillMenu maybe, checks if there's electricity in "createMenu" first, look for "haveFuel" around line 1300, and adds it to the context menu.
doFillFuelMenu
thanks! that sounds like what i'm looking for
does anyone know how the game remembers what contents are stored in e.g. containers and vehicles, as well as fuel contents, etc.
Thank you very much, worked perfectly! ๐
Hello, all. I have a quick question. Is it possible to override the interval in which Protein Boost works (without messing with Java)? The next question (if possible with Lua) would then be: what needs to be overriden?
Thanks.
So, I tried and tried again. I've watched innumerable lesson videos and endured hours upon hours of misery, but I still can't figure things out. The muzzleflash appears to be coming from the origin, however when I alter the origin to the tip of my model's barrel, the positioning in the hand changes, and I am unable to adjust it after that. How can I make my pistol's muzzleflash appear in the correct location?
images provided:
1: the current origin in blender
2: the current placement of the pistol in the players hand
3: Export settings
4: better view of model
(if anybody knows the fix to this please message me or reply.)
if I want to patch a recipe to change it from another mod in my own, do I need to import that mod to mine to overwrite it?
where i can find car models?
media/models_X/vehicles
Project Zomboid is Complaining about a "then" that should be near = on line 304, however there IS a "then" there, can someone help me?
if getmdplayer.IsTagged = true then
if something == something then
not =
==
Okay, got it
Hi guys,
I'm trying to make a custom profession and I want to force specific traits (Obese for example) when selecting the profession.
Now, when I use addFreeTrait("Obese") it does what I want but you are able to remove the Obese trait (with the side effect that you can get infinite points by exploiting it).
I tried looking at how the game does it with the 'Cook' trait, using Cook2 and setting it as mutuallyExclusive but I could not get that to work.
Can anyone give me some pointers?
should predetermine Obese trait
because Obese trait have param like points and pick/unpick
look into code, like trait from veteran
or u can look into SOTO mod, where be created custom traits for this situation (because veteran hardcoded, traits with weight i think too), Hea created custom trait - its swap on original after start, for working param
I can't quite see it now but I am indeed missing the swapping on creating the character. I will try some more tomorrow with this information, thanks a lot
Anyone knows at what rate does the game plays its animation? I'm having trouble setting a time duration for a 20 frames animation.
I was assuming 30 fps. So I set the timer to be 1/30 * 20 frames =667 ms and the animation is still janky in game
Now its throwing this error near "end"
that error likely means too many ends
I made my animation but in game it looks janky as hell
I experimented with changing the blend timer and doesn't seem to help
<m_BlendTime>0.1</m_BlendTime>
<m_BlendOutTime>0.4</m_BlendOutTime>
it might be janky but damn that's still good animation though pal
Did you use a reference to create it ?
Hey pal I believe with time you will get better and there are people here to help if you ask.
What I would suggest is more movement on the pelvis
The center of the body is too fix
Doesn't move enough
Just adding a bit of motion to it would accentuate that movement
Yep I used the animation prior to dodging as reference. Somehow when in games it still looks janky. I increased the blend time in the XML file. And then it looks better now, but the animation is still different from what I made in blender. Bummer
Thanks for the advice. I'm gonna try it out.
@formal kraken try the suggestion from @bright fog see if that helps with the animation.
Find a reference video of backward dodging
Perhaps you could base yourself on backward doges from TLOU:
https://youtu.be/UBN5qSgaZYw?si=bpONYB0kY49GAm2k
It is so satisfying when the dodge animation is just right and looks so cinematic.
@bright fog Hey pal is that the first or second game ?
hard to clearly see the animation tho that's the issue
I initially commissioned someone I found on the internet to make this dodge animation and this it what they sent back to me
Is there none in mixamo that can be used?
hmm interesting site
oof so bad
i mean all traits has another category with personal param, like + or - free points, pickable.
some traits like personal for woodcutter or security or veteran without points (0) and unpickable.
in code its look like if u pick profession Veteran, its get u veteran trait - this trait 0 points and unpickable.
If i pick your custom profession - its get me Obese, but this trait has param like free points and pickable
then we need New trait like Obese2 and func with event OnCreateCharacter like if player has trait Obese2 then remove Obese2, add Obese
(or change player weight, not sure how work this trigger for Obese)
does anyone know why this doesnt work, it works when its under another traits function but cancels that trait out?
When is that triggered ?
i dont know what you mean
@mellow frigate
not sure about how work this framework, maybe here should be event for launch this function...
i dont think my function is ever triggered, i dont know how to code just been trying to reverse engineer other peoples code for what i want
the function you base this code from, when is it triggered ?
Did you check where it's referenced ?
local function fastTrait(_player)
-- Your code here
end
Events.OnGameStart.Add(fastTrait)
try this
yeah
yeh im not sure just learning
Events trigger functions at specific timings called "Events"
also is there a fast way to test traits without having to go to main menu turn off a mod and reload lua
In this case it would trigger your function every ticks, which isn't optimal
-debug
debug menu yeah
F11 ingame
Write "-debug" in the steam property for PZ
ok will do thanks
yeah mines in french so he can't read it either
i got it
yup
ok i got this but its progress
if player:HasTrait("hermes") then
If you used OnGameStart the player is not created at that event
that's possibly yeah
should i just try everytenminutes to see if its works?
While I understand this one keeps getting shared bcs it's up-to-date, I don't suggest starting with it to properly read Events, etc, it's way easier in this documentation:
https://pzwiki.net/w/index.php?title=Category:Current_Lua_Events&pageuntil=Lua+Events%2FSwitchChatStream#mw-pages
why? i thinked this event begin when you loaded on game (after create player)
Wait easier to read all the available events, what they do, what they use and example codes for them
I'm not sure
I think the player is created yeah
because when u create menu - u not in game.
For example:
I join on server. I'm in create menu. Server stop, but i'm not droped - i'm in creating menu
i'm not sure...
need albion xD
this is events break my head...
I know
that was literally my point lmao
"this one boots after gamestart"
wait a minute
OnGameStart does have the player created
you just answered my question and I didnt even type it -w-
Events.OnGameStart.Add(
function()
if getPlayer() then
print("HELLO WORLD")
end
end
)
LOG : General , 1711257694361> [TLOU_InfectedFork] HELLO WORLD
bruh Spiffo
I need to add this method to my notes xD
Quick test since I was in-game with my mod
does spiffo bot eval lua code?
hm hm hmmm
Fixed old error now we have new error, its complaining line 16 being null
that could help, first off yeah
Don't make it global
tho not sure if that's the exact reason of the error
you can't use getPlayer() outside of a function, that executes on the main menu before there is a player
so it will return nil
ah i see
ill use on game boot
or smth similar
tho you could initialize a variable stored localy in the file and then write inside it getPlayer() once player is spawned to not have to call getPlayer() everytime ?
I would have to redefine player and player mod data in each function and if statement, or it would break
just what I said above if you don't want to access getPlayer() everytime in your functions
that most likely works, create a variable in file, initialize OnGameStart with your local file variable with getPlayer() and that should do the job
Interesting aspect I didn't consider, good to know for the future
is there anything i could do to make mine easier to read?
I am not sure :/
I don't know what's possible on github in terms of presentation
local player = getPlayer()
same as playerObj?
i mean, don't need get player, u can just use playerObj, no?
the only things I could think of was making a global table or making a local table and getting/setting the table when needed but I ended up just making it global for now because it's such a pain to replicate the mod data to a variable constantly
A list of every Events names would probably help to see at a first glance what's available
and yes you can just do player:getModData() everywhere but it is very messy (me no likey)
Tho I didn't realized you changed it and it's not just a table anymore
i'm planning to split hooks + script functions to another page at some point
since this page is very very long now ๐
yeah github issue I feel like
so should i use OnLoad or OnGameStart
This gives the use to working on the modding wiki even more
whichever tbf
OnGameStart does the job
guys, guys!!!
local player = getPlayer()
same like playerObj?
getPlayer() == playerObj ?
But yeah I really like the presentation on this page:
https://pzwiki.net/w/index.php?title=Category:Current_Lua_Events&pageuntil=Lua+Events%2FSwitchChatStream#mw-pages
Makes it very clear and easily readable
Not sure the github long list bother's people tho
something like that could be added
but it would probably take the form of a table like the old format
your old format or the wiki ?
my old format
I feel like the dark mode of github doesn't help reading in the case of your list
also the fact this list could possibly be improved upon by removing Lua Events/
is there anywhere explaining why using globals is bad? and at what point is it fatal? using 1 global, 5, 10?
globals are slower and can cause mod conflicts
coding moments xD
Might be time for you to switch to vs code by now lol ?
lazy for me
Reading through the side list, I feel like removing "Parameters" would possibly make it easier to read
I'm used to working in a notepad++
understandable, I was like that, then I tried VS code
And I'm never switching back
not up to me, it's automatically generated from the headers in the file ๐
yeah I kind of guessed it
Through you could not make parameters a header perhaps ?
It then wouldn't show
it'd make the script functions harder to read to have no heading for it, but i'm not hard set on the current format or anything
it'd be harder to distinguish returns and parameters
would it ?
I mean, you could also make a cell in those table which says parameters or returns
Also the fact you have two distinct tables
(also I didn't knew there were Events with return values)
these aren't events, they're just sharing a page right now
ah nvm then
it's sort of a generic container for function signatures referenced in scripts and stuff, i never found any documentation of them anywhere
umbrella will contain stubs for them in the next update too
nice
I've used bolded text for similar purposes before. Could also try lower heading levels, dunno whether github's outline goes all the way to h6
bold looks good, i'll change it to generate that later
probably when i get around to separating it into individual events/hooks/callbacks pages
I agree with this kinda
one table with params and return values combined is a better idea imo
trying to distinguish which is what is the only caveat
idk something could be like this, just an idea though.
truth be told as long as it holds information I need I couldn't care how bad it looks
Sorry for all the posts in here, however, I wanna figure out how to play a sound, I used this
(
local soundmg = getSoundManager();
soundmg:PlaySound("soundThunder", false, 0);
)
guys
what is
ERROR: General , 1711274269656> 262,386,482> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: __lt not defined for operand at KahluaUtil.fail line:82.
ERROR: General , 1711274269656> 262,386,483> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: __lt not defined for operand
mean?
what's the __lt not defined for operand suppose to mean ?
you're using a non-number in a < operation
oh
usually this is something being nil unexpectedly
i see.. must b a nil then
since i pre-set it for 0
thanks ill try it again by putting exception
Looking tor small script where can limit to Spawn selected vehicles with some parts
Someone know where to add that or how to create it?
Expl vehicle A will spawns 1/8 with doors and 7/8 will without
what is the difference between blacksmith and metalwelding xp?
I'll just leave this here...
https://steamcommunity.com/sharedfiles/filedetails/?id=3199203573
I still need help on this
Did you take this from the base game somewhere ?
nope
Then that's most likely wrongly used
i've tried renaming the sound file to a lot of stuff
Yes
Did you make a script for it ?
The only times its referenced is in the code i pasted in the original message
Then you need to make a script file for your sound
Alright, ill figure out how
just search for sound scripts in the script files of the game
Would a CCTV mod be possible in this game? Like to have a security cam for example outside your hideout that you could connect to a TV and then view? Viewing the camera would take you away from viewing your character and would switch to the live cam footage stream?
What would even be the POV of your camera ...?
That's an isometric game with only visuals from top
Even if it was possible, your camera view wouldn't make any sense lol
true
what about a drone.

lol
so giving this a little more thought, what if the cam view is just a live image (camera view is not panning) of the area where the cam is set up? Much like we don't see how our character is actually seeing things, we see our character and everything around them, couldn't the cam footage not just show the area where the cam is set up, showing the cam itself and everything around it on screen?
The issue is that I'm pretty sure camera view is hardcoded
You place a cam down, add power source, and adds that feed to your cam feeds
Nice
My point still stands
does this mean its not possible to show an area where you character is currently not present at?
basically yeah I think
Would require someone to look deeper into it
I know one or two guy looked into cameras to remove the FOV effect for modding and recording purposes
ah I see
idk if they found anything about being able to move the camera's position
And I have no knowledge in that field but what I heard is that this kind of stuff seems to be very hard to deal with, and possibly barely modable
With b42 it could change tho with the changes to FOV
after 2 days of fun work; finished my first zomboid mod and released it :3
@nova socket can i pm you?
For?
im modder from firetrail and wheelbarrow,
and im building a mod recommender in-game, to people discover passively,
people can add content via discord bot
and it be featured on the mod automatically
the ui part will take care about:
turn a modlist table (modname=shortdesc),
the data structure into visual, into a good ui
in the first, it will serve tier 0 (mods from 300 subs to 100k), and in the future will add others tiers to cover mainstreams and popular ones
are you interested to be co-creator?
I'm fairly certain that guy isn't the creator of the mod he mentioned in his original message
Also why don't you make something that automatically picks up mods to showcase ?
?
i dont have the AI skills, to make a great short description (the hard part, and require human, is to that part)
it is possible to do, but convert and fit the text size in-game, will be hard to do
Or just don't show a description ?
Just show the name + cover of the mod
If the cover and name is clean and people are curious, they can check it out
it will be not usable, many people will not know what the mod does, or their usefulness
its not possible to use image i think
Funny you say considering that's how the workshop works rn
People don't read a small description for mods they see in the workshop
They read the name, check the cover and get curious about it
i have data, and workshop didnt work great
look that
Click on it, see what it does
wdym it didn't work great
Like bro, that's base statistics, that's completely normal to have this kind of stuff
Like really, this kind of behavior is normal
There's a bunch of people who don't play with 1000 mods like some of us and they just want some QOL mods, maybe clean and good quality mods that improve a little bit upon the features of the game
Add something easy and unique
Then you have the ones with huge mod list, that are interested by a lot of stuff, and that's a spectrum so it varies for everyone
I don't complain about the current popularity my mods have, in fact I think they are fairly know and they just keep growing
Like this is the mod
my worry about fully automated is let pass mods that people didnt consider recommend to others
Well, yeah, and no
and even if i do it,
i still will need a co-creator to make an ui that fits and looks great
The system doesn't work on recommendations. Yes a mod can grow very quickly if everyone recommends a mod, but if you end up recommending every single mods on the workshop, there's no way everyone will look at them and use them that's my point
While showing off mods in-game to show new mods to others is a nice idea, I really think you should just present the 30 current popular mods of the week
The issue is that a bunch of people don't look further than the 9 mods on the main Workshop page
And you end up having smaller mods that don't get enough popularity bcs they just didn't reach those 9 slots
Once you reach those 9 slots, you're mod will explode in popularity
So what you would need to do is just show the mods further than those 9 slots to actually end up with a good system to promote medium mods that could pass under the radar
One example I can show you is this mod:
https://steamcommunity.com/sharedfiles/filedetails/?id=3172171349&searchtext=PALSJ
We were talking with PALSJ about it and how it didn't pick up on the workshop
The mod is very very clean and a lot of people would most likely like it and use it
But bcs it didn't reach those 9 slots, it didn't pick up enough attention and didn't get enough popularity
It would be this kind of stuff you want to showcase with a showcase mod
are you considering, that is possible to cycle passively in-game?
(the mod itself can change to next item)
there is no need to limit to 30 most popular of week
If you don't limit yourself, you end up showing useless mods that absolutely no one will ever use. Bad mods stop at the 2nd page of the 30 most popular of the week and don't go further, good enough mods in standard will grow to at least the 1st page
Let's say a player sees 5 mods on the menu page everytime he launches the game
the hard part to me (that i didnt solved proper) is to make people to understand what is that mod about, and fit small summary in game, and visual present data at in-game ui
Everytime he launches the game that's 5 random new mods shown to him
If you show 30 most popular mods of the week, there's a good chance he'll see 90% of those during the week
If you show the 60 however, that's way way less
Half the chance of seeing every mods
And the issue is that within these 60, there's a good chunk of those who are just bad in quality and you don't want to show those
but its is a trade off
new people players will lose old working mods
No offense, but I'm not sure how is that related to me?
it doesn't feel much like a spotlight if it's just showing what's already popular on the workshop
But you don't need that, just showing the mod as a popular mod will say "ok this mod is appreciated by a lot of people, this means it's worth taking a look"
you appear to know how to code ui, at your workshop
I explained the issue already, you have a bunch of good mods that just pass right under the radar because they are not reaching the top 9 of the week
like this one for example
as i mention, i do will split into tiers
to serve most popular, and new ones,
all tiers can fit, but its is future planned
They could pick up a lot more attention if they were shown a bit better to the public, only those who actively look at the mod page further than the top 9 will see those and help share them
I think your mod will be useless to 95% of players, ngl
The issue is that why would I download a mod that will bloat my mod list, just to show new mods and I'm a casual guy that doesn't go through the workshop so why would I even bother download that one mod that just shows other mods
The system needs to be smart, like it would actually need to be a framework that players implement within their own mods, so it automatically activates the system once someone has that framework
If you end up with 100 mods having your framework and one of them is popular, people will use it and boom trigger the system to show popular mods of the week
I'm usually a lone dog on modding part, but what are you up to where you need UI.
I'm not a UI/UX I'm a systems designer in base. UI just came to be my strong part too.
well, i see a lot o people, asking on reddit for mod suggestions, recommendations, must haves, should be on vanilla,
and on workshop comments too
i just need to achieve something stable, and ok to use, and its is being made, and there is nothing like that at workshop yet
You're facing a big design issue: most of the player base will NOT download your mod because they don't have a use for it
If you add your mod within everyone's else mod, people will actually use it
And I'm not talking about a dependency to your mod to use mods others make, but like actually implement the code within their own mods
?
Your idea is great, promote a bit smaller mods, show them to the public, I love it
but there's really this issue that people will probably not download your mod
i dont get it,
you are looking for achieve which final objective?
with that
guess I need to draw something so you understand
i don't think bloatware is the solution
My idea to implement is mod within other people's mods ?
I mean, considering it could be a single .lua file that everyone will share exactly the same, it would technically be a single .lua file for every single mods that implement it
(Also is it even possible to access outside lists of popular mods)
i didn't see you say that, but that's even worse, stuff like that has been causing terrible issues for years ๐
how so ?
just make sure the mod never changes
mine mod recommender, is seeking for, steps
have an options to people select tiers, (and maybe tags too),
im not seeking to start with full complete solution, mvp first, its is because of that, that im starting with tier 0 (from 300 to 100k)
and keep mod running, they will be able to discover something new at some point, passivelly
( just a metaphor, its is like an antivirus with receive new data update from time to time)
Well yeah, but again most people will most likely not download your mod at all and those who do could just in two clicks go in the workshop and view popular mods of the week
That's what I do for example to check on new mods
first i don't think you should sneak unwanted content into unrelated mods, it's annoying for the users, but second you will probably need to update it ever and having it in more than one mod basically guarantees this will not work
yeah I agree with those points
we had a lot of issues before because people would bundle item tweaker into their mods, a couple mods changed its api and caused all other mods using it to break when using those mods
Yeah alright I agree with those points but what would you even suggest he does to actually have his mod spotlight be used ?
that's the issue, I can assure people will most likely not use your mod, it's bloating their mod lists for no reasons with something they could check outside of the game with 2 clicks
I will personally not add such a mod
if it had a cleaner ui i think it'd be quite appealing
mod manager is very popular and that doesn't do anything you can't do already
Yeah was my idea, like make a custom menu mod like the ones we see poping up these days and implement it in it
Like Dane did with his 10YL launcher
while developing, i notice that modlist should be protected from external modifications, because it can open destructive behavior from others mods, and unfairness,
it should be extendable just by an new ui, not the modlist data structure itself
Custom launcher, that modifies the interface
That could definitely be appealing to others to use
Just do yours tbf, I gave you my ideas and my opinion on your concept, the issues with it and what to do to fix those
Just I'm telling you, it needs to be more than just a spotlight mod or it needs to be implement in other random mods to be used (which I agree with Albion, is really not great)
The menu mod could really be good
my mod does have integration with steam overlay, to access workshop
Make a framework that's the spotlight and create menu mods that use this framework with the mod spotlight
Doesn't matter, doesn't change my point that people will not bloat their modlist with a mod that's just about mod spotlights lol
Like do like these mods:
https://steamcommunity.com/sharedfiles/filedetails/?id=3190759181&searchtext=
Custom menu that's cool, people will actually use it
And like those new main menu style mods use a framework that adds new stuff to the menu with music
Could be the exact same concept but with mod spotlights
that is what i worry about, and looking for more skilled people
it will be a dream to get good ui people like mod manager, craft helper, mods that deal hard with ui
(braven, notloc, star, noctisfalco, Tchernobill, PePePePePeil, Champy...)
or just a small team for ui, or help on that, i dont think am able to do that, other than infra and scripting non ui
Why do you just not learn how to use those ?
@mellow frigate
it will take too much time, i only have saturdays, dealing with work and study,
a year ago, probably i can do, as i did with fire trail
im backend developer
The way I started the UI was to look in the base game and modify from there. BM is a Brush Tools on steroids lol
i do some of that too,
with dragon radar (it is item viewer from debug), radial menu, vhs in vehicles (its the radio window modified), rebalance yourself,
but we do not have something similar to reuse unfortunally, but thanks for pin point that (or if we do, comment and i can work on this, and a mod too)
but did you guys think that come up with good ui, we probably solve the short description by humans (i do a pool and people are more willing to use than collaborate with input)
from interface tags, we have only 122 of 1470 mods (8.3%), it is a very small percentage, its very hard to find ui devs, because atm is the worst/hard part to deal with
its is not too much inviting to deal with until now
a lot on reddit, asking for mod recommendation, instead go to workshop, and stops on #1 to #7 page
and from time to time we have, this should be on vanilla comments, or must have on steam workshop page
Reason: Bad word usage
I deployed ChatGPT Powered Radio-Only NPCs on Wasteland RP's server! Currently using them as new-player tutorial NPCs to introduce our players to our hub-town, fast-travel system, and in-game currency and then also as lore drop NPCs which give bits of lore for our upcoming storylines and events. Figured I would share with you all some the technical things I had to overcome to get these working, and some of the guards I put in place to keep costs down.
The Interface
Seeing as from lua we can not make any web requests for the API calls to OpenAI, I had to resort to using an external program. But then I still had the issue of: The only interface to "outside" of PZ lua offers is FileReader and FileWriter. So, I designed a simple protocol around file reads and writes, basically using files as a crude API.
To implement this API on the PZ side I created two sets of "commands". OutCommands and InCommands, then a corresponding OutCommandWriter and InCommandParser. These handle taking lua objects and converting them into line delineated strings or from line delineated strings into lua objects. Finally, its all tied together with a FileMonitor which will watch a specific file in the lua directory, and when it has lines will read them in, pass them to the parser, then write back to that file with zero data (effectively resetting it). The out command writer will just write to files sequentially named 0.txt, 1.txt, .. etc.
On the custom app side of things, I do the inverse. I have a monitor which holds any commands it wants to send to PZ in a buffer. Once it sees that file is now zero size, it will batch write out any commands in buffer then wait until it gets zero'd out again. The reading commands from PZ is simple as it can just read each file in order then delete them.
This combined gives me a latency of about a 500ms, which is plenty good enough for conversational NPCs.
Triggering NPCS
In-game NPCs are triggered 3 ways. For new players they get triggered automatically. A message is sent to the player there is an NPC available for them to interact with. All they need to do is tune into a specific frequency on their radio. For lore, we leave notes in the world with a frequency available, then use an in-game UI to set which NPC we want to "listen" to that frequency. Finally, we can manually send an NPC to be available for a player, in which they behave like the new-player NPCs which show a message to the user to trigger them.
Keeping Costs Down
Obviously, running these NPCs costs us as OpenAI's ChatGPT API is not free. To keep costs down we have a couple safeguards. Each NPC has a hard coded limit to the number of messages back and forth it will send with a player. All "lore/world" NPCs limit each player to one conversation each, and finally we have a hard dollar amount cutoff. Our current costs per day to run these is about $2.00usd, with days with lots of lore drops coming closer to $5.00usd.
You can see the PZ mod code in our modpack here: https://gitlab.com/wasteland-rp/wastelandmodpack/-/tree/main/Contents/mods/WastelandGptNpcs/media/lua/server/GptNpcs This doesn't include the actual OpenAI program/interface or our actual NPC code, as that's something I am holding close to chest for the time being.
The images attached is my character (Josh Smith) having a conversation with our Tutorial NPC. Some of the other NPCs we have are: "Crazy Dan" - an old man who spouts conspiracy theories about the apocalypses and spreads rumors about our player factions; "Old Friend" - An NPC which reads our players character sheets, then invents a person who is an old friend of theirs to catch up; and "Isaac Hill" - A young guy who was robbed by our largest antag faction, and warns people to steer clear of them.
Anyways... enough rambling. Been working on this for months and just wanted to share some of the technical stuff with y'all. ๐ค
hey, i'm helping someone set up a server, and they got some errors that say Stack trace: se.krka.kahlua.vm.KahluaException: MasamuneDefinitions.lua:21: unexpected symbol near <eof> . so i looked at that file, and it looks like it's missing a close bracket ```AttachedWeaponDefinitions.MasamuneStomach = {
chance = 0.5,
weaponLocation = {"Stomach"},
bloodLocations = {"Torso_Lower","Back"},
addHoles = true,
daySurvived = 30,
weapons = {
"Base.Masamune",
},
}
AttachedWeaponDefinitions.MasamuneBack = {
chance = 0.5,
weaponLocation = {"Masamune in Back"},
bloodLocations = {"Back"},
addHoles = true,
daySurvived = 30,
weapons = {
"Base.Masamune",
},``` but i downloaded it just to make sure the file hadn't gotten edited or something and that sure is what it says. i've never made a mod that added weapons to zombies, but is there supposed to be a close bracket there?
yeah, there should be
If anyone wants custom recipes for their game, let me know.
Is there a better lua console than the one which appears at the bottom left in debug mode? Like maybe a mod or something. Or if there is no replacement, is there a way to increase size of the standard one?
That's insane, so it only works in multiplayer currently right ?
You can read from the file directly
Hmm, I can probably live with that. Thanks.
Reason: Bad word usage
You can open PZ directly with the console, in the game directory is ProjectZomboid64ShowConsole.bat. It's easier to view than opening the file and reloading it each time it's updated. You can also add other parameters, such as debug and changing the cache directory.
At the end of line 7:
-cp %PZ_CLASSPATH% zombie.gameStates.MainScreenState -debug -cachedir=C:\Users\%username%\ZomboidDEV %1 %2
Change %username% with yours.
I'll keep that in mind, thanks, but right now tail -f the.log.file seems easier to set up.
What .bank file in the sounds folder contains EVERY Sound? I'm ripping some stuff and I'm curious where I can find it
Depends I think
What sounds you want ?
Usually it's in media/sounds
You have a bunch of sounds there and for .bank files
It's media/sounds/banks/desktop
And I know a majority of the sounds are in ZombieSound
Like zombies sounds but not only, a lot of footstep stuff, attacks I guess and others
Seriously impressive, also used the filewriter to export csv data to connect to an external database for one of my mods to workaround the lack of webhooks, but this is next level..
Correct. A lot of the mods on WL and made for our environment specifically, which is MP.
Iโm a very very rookie modder. I know jackshit about lua, my only mod was changing the intro script, but I wanna do something else. The OCP Gear mod has a gas mask in it. But, the mod is incompatible with Noirโs Attachments. I found an addon that makes it compatible, but I still canโt put the Rangerโs Gas Mask on the utility slot. Can someone help me figure out how to do that?
The noise of a generator can attract zeds, and if the generator is in the middle of the street, unprotected and working, would zeds attack it to destroy it?
you think there could be demand for something like that as a framework? or would it be too simple to cook up / need to be too specialized for people's use cases
wait you could access information outside of a player's computer via mods ?
The mod does not read, only writes out, I use it for my mod territory warfare, people capture territory starting a king of the hill type event which lasts 20 minutes, when the event is completed, the winning faction, the timestamp and players involved are exported to a text file in CSV format, I then use a PHP script attached to a cronjob to take that data and implement it into a database, there are then cronjobs for alerting players via discord on the state of territory so everyone can keep track even if they're not in the game to see, I'll attach a few screen shots ๐
The hardest part was honestly taking that data and somehow managing to get an accurate output at the end of the week of who remained in control of each territory for the longest.
I have no idea how I'd go about that in all honesty, writing out is fairly easy, but working with that data is totally dependent on your goals, but if we're talking just sending strings to discord which I know a few people have bashed there heads against walls to figure out just dm me and I'll hook u up ๐
a simple way to capture server environment stuff and send it as strings to discord or even just a different process might be pretty useful
thx for the offer
not sure i have the time right now for it but if this week ends up looking alright then maybe
You are more than welcome to hijack my InCommands/OutCommands code and repurpose
you just need an external program on the other side to parse and generate those commands
yeah i've got to look into that
right now i really dont have a lot of insight into how pz dedicated servers work
its basically just a headless PZ instance
still gotta get into the guts of it
not like i've tinkered with exporting data out of headful PZ instances
i'm gonna step away from the keyboard before i get too excited about this but yeah it should be fun
Yeah with discord "integrations" stuff like this is very easy now, i'll stick the generic script i use in here for anyone to stumble upon in the future, just gotta make sure you have php and curl extension installed on your box and this will read a text file and shit out the contents for your discord integrations bot to speak out!
<?php
// Directory to search for the log file
$directory = '/home/pzserver/';
// Name of the log file to process
$logFileName = 'texttosend.txt';
// Discord webhook URL
$webhookUrl = 'https://discord.com/api/webhooks/yourdiscordintergrationboturl';
// Path to the specific log file
$logFilePath = $directory . $logFileName;
if (file_exists($logFilePath)) {
$content = file_get_contents($logFilePath);
if (!empty($content)) {
$payload = json_encode([
'content' => $content
]);
$ch = curl_init($webhookUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
if ($response === false) {
echo 'Failed to send webhook request for log file: ' . $logFileName . PHP_EOL;
} else {
echo 'Webhook sent successfully for log file: ' . $logFileName . PHP_EOL;
}
} else {
echo 'Log file is empty: ' . $logFileName . PHP_EOL;
}
unlink($logFilePath);
} else {
echo 'Log file not found: ' . $logFileName . PHP_EOL;
}
but as gravy is saying, there's a multitude of ways you can acheive the same thing in multiple languages
im not sure how much i like the idea of using php and curl and webhooks
I do a lot of writing of data here: https://gitlab.com/wasteland-rp/wastelandmodpack/-/blob/main/Contents/mods/PzWebStats/media/lua/server/PzWebStats.lua?ref_type=heads
Things like player stats, weather, server date/time, all available items in game, etc.
I then use that data for our admin interface and player reports
Like, to generate these!
yeah this makes me look like a caveman in comparison hahah
i've got experience writing discord bots and parsers
now websites... not really but i'm working on that
but alright i gotta go for real lel
guys, what event i should use for zombie spawn distributions if i have sandbox options (they can be changed in game process)?
require 'NPCs/ZombiesZoneDefinition'
local function zReVAC2_SpawnRate()
local specZombieSpawnChance = SandboxVars.zReV2.SpecZombieSpawnChance * 0.001;
table.insert(ZombiesZoneDefinition.Default,{name = "zReVAC2_ZombieECO", chance= specZombieSpawnChance});
end
OnInitGlobalModData?
I'm trying to figure out how to change one of the stats that are generated in this recipe, (among others found in recipecode.lua); how would I go about doing that? Do I have to overwrite the function or can I just change a single stat-calculation's line?
function Recipe.OnCreate.CutFillet(items, result, player)
local fillet = nil
for i=0,items:size() - 1 do
if items:get(i):getType() == "FishFillet" then
fillet = items:get(i)
break
end
end
if fillet then
local hunger = math.max(fillet:getBaseHunger(), fillet:getHungChange())
fillet:setBaseHunger(hunger * 0.5)
fillet:setHungChange(fillet:getBaseHunger())
fillet:setActualWeight(fillet:getActualWeight() * 0.5)
result:setBaseHunger(fillet:getBaseHunger())
result:setHungChange(fillet:getBaseHunger())
result:setActualWeight(fillet:getActualWeight())
result:setWeight(result:getActualWeight())
result:setCustomWeight(true)
result:setCarbohydrates(fillet:getCarbohydrates());
result:setLipids(fillet:getLipids());
result:setProteins(fillet:getProteins());
result:setCalories(fillet:getCalories());
end
end
Is there an event which is triggered after all mods have been loaded?
OnGameBoot perhaps ?
Isn't this triggered when your mod is loaded?
Another question: is it possible to define a custom event?
Yeah I think
Any idea how I can get a list of all active mods? Could then simply check OnGameBoot which mods are counted as active. I tried several things with the command "getMod()" but this gave me always an "Object tried to call nil" error
getMods()
ah sorry, I meant "getMods()" (and not "getMod()") was just a typo... but this didn't work for me somehow when I use this OnGameBoot
getMods() cannot return nil. you made something else. the returned type is List (cast from ArrayList) see LuaManager.java
if I am wrong and the function is broken, getActivatedMods() may be of use.
thanks I'll try that
getActivatedMods() seems work fine for me!
However, the getMods() command does indeed result in Object tried to call nil error when I use it like this:
local myList = getMods() -- console.txt shows the error occurs in this line
if not myList:isEmpty() then
print("TEST OUTPUT: bla")
end
end
Events.OnGameBoot.Add(myTest)```
But anyway, the getActivatedMods() seems to be sufficient for me.
Thanx ๐
I am the one who has to thank you!
we both learnt something, that's teamwork.
Is there an event for when a IsoContainer is placed?
hi, i'm trying to figure out how to make a mod that makes it so the ranger's gas mask from OCP Gear can be attached to the utility slots from Noir's Attachments. Can anyone help me?
is
local wornItems = playerObj:getWornItems();
if not item then return end
Not the correct method for checking if I'm wearing an item?
There are like 15 different ways to check for an item and the list is not super informative as to what each of them do
what exactly is "item" in your code? also, playerObj is not defined there
moreover, is your question how to check whether your characters wears a specific item or do you want to check whether they wear anything at all or are nude?
I have the item defined above it, and I'm looking for that specific item.
if your item is a specific inventory item, you might try
wornItems:contains(item)
... at least according to Zomboid's java doc (see here: https://projectzomboid.com/modding/zombie/characters/WornItems/WornItems.html). Also make sure that your playerObj is defined
Should I instead be using pl rather than playerObj
actually nevermind, i got another questions guys
Don't know what else you have in your code. Where did you took playerObj from or how do you define it? "pl" is the player so you could try this.
function PendantHappinessFunction()
local pl = getPlayer();
local wornItems = pl:getWornItems();
if not item then return end
local getSad = pl:getBodyDamage():getUnhappynessLevel()
local modifySad = getSad - SandboxVars.Pendant.Rate;
local Sadness = (math.floor(getSad*100)/100)
for i=0, #PendantItem do
if item:getFullType() == PendantItem[i] then
pl:getBodyDamage():setUnhappynessLevel(modifySad);
if modifySad <= 0 then pl:getBodyDamage():setUnhappynessLevel(0); end
--local endurance = self.character:getStats():getEndurance() - 0.0001 * getGameTime():getMultiplier()
--self.character:getStats():setEndurance(endurance);
end
end
end
Events.EveryOneMinute.Add(PendantHappinessFunction);```
I'm loosely hacking together this from some existing code as a test to see if I can make worn items apply effects
in this instance, it's just a pendant item that reduces unhappiness
but I keep getting hit with a problem when it gets to the actually checking for the item
There is a different mod that is for an item you hold in your hand and reduces your unhappiness, and the search code does this
local pl = getPlayer();
local item = pl:getSecondaryHandItem();
if not item then return end
But, just changing it to local item = pl:getWornItem(); throws an error
I think one problem is that "item" does not has any value in your code.
it doesn't have a value in the working code snipped from the other mod
but shouldn't this be declaring a local variable?
"getWornItem()" does not work. You need "pl:getWornItem(bodyLocation)" where bodyLocation is the name of a body location, for example, "local item = pl:getWornItem("Jacket")". This will result in the item the player wears on the jacket location. It is either "nil" if no jacket is worn or the actual jacket object
Is there a full index of those bodylocations?
Not listed on the wiki as far as I can find
also note the difference between two commands you are working with: "pl:getWornItems()" with "s" at the end returns smth like a list of all items the player wears. "pl:getWornItem(bodyLocation)" without "s" returns the single the player is wearing at the location.
An important distinction, good catch thank you
there is a list of all body location in the installation folder of Project Zomboid. Can be found in media/lua/shared/NPCs/BodyLocations.lua. There you see all locations which exist in the vanilla game. (Mods may add additional location though)
I'll go take a look and report back
You said you want to check whether the player wears a specific item. For which item do you want to check this?
It's going to be a necklace item called Timeless_Pendant
A modded item I guess??
it's being added by my test mod
I haven't touched lua since probably 2012 with Roblox development!
Necklaces are typically worn on the body location "Necklace". So you could try
if item and item:getFullType() == "Base.Timeless_Pendant" then
-- do something ...
else
-- do something else
end```
Only works in case your Timelss_Pendant belongs to the "Base" module in its script.txt entry. This entry also contain a field called "BodyLocation = ..." which tells you which body location it actually has. In the above code, you might then replace "Base." and "Necklace" with the correct values.
It is in the Base module, so that's good
necklase should be it's display name? name in the module?
In the above code, "Necklace" is the body location. What body location does your Timeless_Pendant has?
then the above code fragement might work for you to check whether player wears the Timeless_Pendant
where did you add the check in your code?
local pl = getPlayer();
local item = pl:getWornItem("Necklace");
if item and item:getFullType() == "Base.Pendant"
then```
then there's the function to reduce unhappiness after that
did you remove the lines
if not item then return end```
and
```if item:getFullType() == PendantItem[i] then
...
end```
from your old code? Especially the second one will cause an error...
yes
can you post your new code?
well, I didn't strip the if item getfulltype
I did add quotes to the Necklace type and that hasn't thrown an error yet
charmItem = {[1]="Base.Pendant"}
function CharmFunction()
local pl = getPlayer();
local item = pl:getWornItem("Necklace");
if item and item:getFullType() == "Base.Pendant"
then
local getSad = pl:getBodyDamage():getUnhappynessLevel()
local modifySad = getSad - SandboxVars.Charm.Rate;
local Sadness = (math.floor(getSad*100)/100)
for i=0, #charmItem do
if item:getFullType() == charmItem[i] then
pl:getBodyDamage():setUnhappynessLevel(modifySad);
if modifySad <= 0 then pl:getBodyDamage():setUnhappynessLevel(0); end
--local endurance = self.character:getStats():getEndurance() - 0.0001 * getGameTime():getMultiplier()
--self.character:getStats():setEndurance(endurance);
end
end
end
end
Events.EveryOneMinute.Add(CharmFunction);```
formatting is quite suboptimal because it is hard to see which "end" closes which "if" or which for-loop ๐
๐ yeah I know hold on
It was in the original working code, I'm honestly not sure its function
not goodXD
in case you just want to reduce unhappiness when the item is worn, this is pbbly not needed anymore. Moreover the "charmItem" seems to be defined as a global variable which is not a good idea!
and why do you use "Base.Pendant" now and not "Base.Pendant_Timelss"?? This will in fact not throw an error but you have to use the item's script name to make it work
It's called pendant
ok
I think the display name is Timeless pendant, which doesn't help for the scipt
true
charmItem = {[1]="Base.Pendant"}
function CharmFunction()
local pl = getPlayer();
local item = pl:getWornItem("Necklace");
if item and item:getFullType() == "Base.Pendant"
then
local bodyDamage = player:getBodyDamage()
bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() - 10)
bodyDamage:setBoredomLevel(bodyDamage:getBoredomLevel() - 20)
end
Events.EveryOneMinute.Add(CharmFunction);
shortened and simplified the boredom and unhappiness stuff
bigger numbers also easier to test
looks a bit better right now. but I would delete the first line "charmItem = ..." . and this is still a pain to read!! XD
maybe better this:
local pl = getPlayer();
local item = pl:getWornItem("Necklace");
if item and item:getFullType() == "Base.Pendant" then
local bodyDamage = player:getBodyDamage()
bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() - 10)
bodyDamage:setBoredomLevel(bodyDamage:getBoredomLevel() - 20)
end
end
Events.EveryOneMinute.Add(CharmFunction)```
Think you forgot an "end" in your code
doesn't like local bodydamage = player.getBodyDamage()
and better to give your function a more unique name or in case you do not need this function at any other place, you can just make it local:
local function CharmFunction()
yeah, maybe try
pl:getBodyDamage()
cause "player" is not defined in your code
mm true
should I move it up by the other local variables at the top?
Or should I only read for it once the function calls
wdym?
function
local pl = getplayer
local item
local bodydamage
if then statement
bodydamage can stay in the if-condition if you do not need it elsewhere
main error in your code is because you use "player:getBodyDamage()" instead of "pl:getBodyDamage()"
cool! And as I said, either give your function a more unique name or make it local. Has otherwise an increased chance to cause conflicts with other mods or even with the vanilla game.
one last thing, is there anything special I need other than print ("message") to output to console?
nothing that I know of...
Good evening, everyone. Maybe someone experienced here can help me,
I am the creator of mod machines, and it uses the framework
"crafting enchanted core" by default, the framework does not have the function to require
"player skill" materials only
A friend of mine who understands a little more tried to add this to core, but without success.
can anybody help me?
Here below are the two main files
One is the core of the mod, and the other is the machine creation page
In this case, I'm trying to make the bench saw, carpentry skill 3 is required
What i can/should i do?
Hey! I've modified your mod and added the skill requirements, reorganized the tooltip and corrected some issues. I also changed the requiredTools to a table so you can add more tools. This is how it looks.
Just replace your files with the ones from this archive.
Mod suggestion... Alarms don't trigger once the power is out? Or at least after a certain time peroid after that after the batteries for the alarm run out?
Alarms can be triggered after power is out?
Hi everyone! iirc, there is a command which you can use in the new() function of a timed action which makes it so that the player cannot use the right-click aim cursor while the action is running. Problem is that I do not remember where I saw this command and what this command was. XD Does anyone happens to know what the command was? I think it was smth like
o.hideAimOutline = true
but not sure...
Does anyone have any video tutorial/guide for creating texturepacks? I am trying to expand Shops by adding new NPC textures, and I have defined the png files properly, like for the existing naming conventions, i followed npcshop_0, npcshop_1 .. and so on.
There's also the tiles file which I assume is 1:1 based on the image on the texturepack file, so I copied to make it count to 18 (which is the number of png files on the texturepack).
And I defined the sprite faces based on their png filename but when I try it in-game, it won't show
for some reason, it's working now with the latest texturepack but noninteractive, i'll just see how i can tweak this
I can't for the life of me find where item icon textures are stored in the game files, can anyone point me in the right direction?
media/textures/Item_<itemname>
If it's not there, it maybe on the texturepack
And I searched the whole ProjectZomboid directory for toothbrush icon but no avail
About that, is there a tool to open pack file?
TileZed
ok ty
Man thank you so much, i Loved that you made a awesome work
If you want me to put a link to your steam or something like that you can send it here, you are a angel thank you so much
No need! After working on something similar for a few months it was quite easy to make those changes.
I also mentioned your help with the mod, and I really appreciate it. Yesterday a friend and I spent a long time getting this to work
Yes
On top of the previously posted questions; I've noticed that recipecode.lua has what I assume to be a local function in it that all recipes use, would I have to copy that over or is that unnecessary if the require "recipecode" line is already in my own file?
How do I iterate through a KahluaTable? Is it the same as a lua table?
kahlua is lua
good to know XD
There's some stuff you can't use but it's mostly the same yeah
why would adding zombrand to my lua script make it stop appearing in the F11 debug menu?
I'm trying to tie a random effect to a zombrand
local checkRoll = zombRand (1, 5)
if checkRoll == 1 then (do thing)
elseif checkRoll == 2 then (do thing)
... etc ...
end
is this not the correct usage?
ZombRand should be capitalised, and there shouldn't be a space between it and the opening bracket
so ZombRand(1,5)
I do have that, in the actual code
function pendantFunction()
local pl = getPlayer();
local item = pl:getWornItem("Necklace");
if item and item:getFullType() == "Base.Pendant" then
print ("Found memorable necklace")
local checkThought == ZombRand(1, 5)
if checkThought == 1 then
local bodyDamage = pl:getBodyDamage()
bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() - 1)
bodyDamage:setBoredomLevel(bodyDamage:getBoredomLevel() - 2)
print ("Small bonus")
elseif checkThought == 2 then
local bodyDamage = pl:getBodyDamage()
bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() - 3)
bodyDamage:setBoredomLevel(bodyDamage:getBoredomLevel() - 5)
print ("Medium bonus")
elseif checkThought == 3 then
local bodyDamage = pl:getBodyDamage()
bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() - 5)
bodyDamage:setBoredomLevel(bodyDamage:getBoredomLevel() - 10)
print ("strong bonus")
elseif checkThought == 4 then
local bodyDamage = pl:getBodyDamage()
bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() - 10)
bodyDamage:setBoredomLevel(bodyDamage:getBoredomLevel() - 20)
print ("very strong bonus")
end
end
Events.EveryTenMinutes.Add(pendantFunction);
you're missing an end
Am I? Notepad++ is not very helpful in keeping track of those
The individual elseifs don't need and end, right
until after the final one
It's still not showing up, unfortunately.
local checkThought == ZombRand(1, 5) should use a single =
is it possible to access sandbox variables in the .txt scripts?
no
If anyone has a idea its best to just make it ?
hey dm me :) nice to meet same nationality
I dont know if you can help me, but of course i would want to meet someone from the same nationality ;)
Hello there, I uploaded a fix for the cases builders do not understand why their newly built home is not detected as inside by Vanilla: https://steamcommunity.com/sharedfiles/filedetails/?id=3202305691
If I wanted to add my own suit of armor so to speak how do I do it
There are also instances when stairs break the interior state and you have to encase them with walls, and leave the part where you walk up free.
If, for example, you don't have another room above the stairs, the downstairs room is not "inside".
It's probably because there are those holes left in the ceiling for the stairs
But the problem with the corners is the most common.
Could it just be that there is no roof above the stairs ? If so that's not really a bug. Inside requires 'encased' and 'FullRoof'. The roof level can vary for a same room.
I have the exact opposite of you, with roof above all squares of the room except the stairs, My room is considered inside. The stairs are also considered part of the room and inside (even though there is no roof above my head when I'm on the stairs)
Stair inside even with no roof (room light + 22degree inside)
Just up the stairs I'm outside (no room lighting+19degree outside).
This is gold!
Suggestion: and about that weird transparency with player buildings? Can you create a mod to emulate the player bulding like the pre-existent buildings?
I'm talking about this: https://steamcommunity.com/app/108600/discussions/0/4290313152619615220/
Hey fellow survivors, Let's talk about building in Project Zomboid. Have you ever noticed the difference between the structures we build and the ones already in the game? There's a clear contrast: player-made structures have this transparency, allowing me to see whats is inside and outside my building, thats totally imersion breaking while the g...
That's another level. Also It may be handled differently in B42.
let's pray to get fixed in B42
Weird, but I know I was helping players fix the buildings they made on a server, and in some cases it was the stairs.
If you ever get a reproduction procedure, feel free to ping me.
When players press a keyboard key, is there an easy way to distinguish between the case that the player keeps pressing it for a longer time and the case that the player only shortly tabs the key? For example, vanilla game seems to distinguish between shortly tabbing "E" for opening a window and holding "E" for a longer time to climb through a window.
There are ways to handle something close the the 'E' behaviour from lua. The 'E' behaviour itself is handled java side and its results are available lua side so you can use it and partially interact with it. easy or not is very relative. I'd say not easy.
Thanks for the reply. I agree that this is probably not super easy...
idk much but you can do event like Events.OnKeyPressed and Events.OnKeyKeepPressed
does this line of coding work?
AlcoholWipes=2/Disinfectant=2,
trying to make it so you can use either wipes or disinfectant for a recipe
recipe Make Empty Syringe
{
BlowTorch=1,
AlcoholWipes=2/Disinfectant=2,
RecPlastic=2,
Needle,
Result:EmptySyringe
NearItem:Laboratory Table,
AnimNode:Craft,
Time:400.0,
Category:Health,
}
what the recipe looks like
HOLYCOW!!! BEST!
Thanks for the hint. Already know those events and I guess you can probably use them somehow them to check whether a key is just tabbed or keep pressed. Thing is that doing it this way is probably not "easy"...
AlcoholWipes/Disinfectant=2, (it's mean 2 AlcoholWipes or 2 Disinfectant)
that is what i thought but for some reason server won't load with it
or won't allow click to start
wdym by tabbed?
u can't predetermine AlcoholWipes=3/Disinfectant=2, for example
oh sorry... I mean that you press a key only for a short moment in time and not keep pressing it for a longer period. my English is not the best sometimes...
thank you @verbal yew
its ok I thought you meant tapped but I wasnt sure
So you want like different hold times for different keybinds
oh... I think "tap" is the right word and not "tab" for what I meant....
yes, so to say
In this case, I think open window is just the OnKeyPressed event and the climb through window is OnKeyKeepPressed
ok... I'll try those and check what their exact difference is. this could help me...
I have no idea how you'd do it without modifying some of the java somehow since OnKeyKeepPressed only has an argument key and no duration
wait hold on
ISHotbar has a self.keyPressedMS that represents how long a key has been pressed for
like
(getTimestampMS() - self.keyPressedMS) > 500
Hi! Does one of you know how to make guns remember stats (like ammo count) when used in a recipe (something simple like a new guncolor)? Or maybe knows of a mod that already does something like this, where I can see how it works? I unfortunately am not good enough at lua stuff to figure this out myself by looking at the game files
maybe helpful for me... I'll check that out
does your recipe replace and old gun with a new one?
So this is all in lua/client/Hotbar/ISHotbar.lua but
It registers OnKeyStartPressed event callback and sets the variable keyPressedMS to getTimestampMs()
Then it uses that keyPressedMs variable to calculate how long it's pressed for in the OnKeyKeepPressed event clalback.
I can only assume that getTimestampMs() gets the current time in miliseconds and by subtracting the old time with the new time, you will get difference
-- example
local keyPressedMs
function onKeyStartPressed(key)
keyPressedMs = getTimestampMs()
end
function onKeyKeepPressed(key)
local diff = (getTimestampMs() - keyPressedMs)
if diff > 200 -- 200ms
print("Held for more than 200ms!")
end
end
Events.OnKeyStartPressed.Add(onKeyStartPressed)
Events.OnKeyKeepPressed.Add(onKeyKeepPressed)
use gun1 to make gun2, with the exact same stats, but referring to a different model as the only change. Gun2 takes over gun1's conditions, due to vanilla works, but not whether it has a magazine or how many bullets are in it
thos type of thinge can usually be done by using the recipes OnCreate function
requires lua coding though
exactly! ๐ The lua part is my problem though, I tried it in every way I could think of, but after having to verify my files twice now because of messing everything up too badly, I gave up ๐
Plus I could not find a mod that already does something like this, where I could borrow codesnippets
why do yo uhave to verify game files? unless you are modifying original files which not recommended
You could have a look at the vanilla lua file server/recipecode.lua to get a first idea how it works. But I am quite sure that there are dozens of mods using this too.
my lua skills are so bad, that I have no idea how to tell the game to do something different as it originally does, than changing the original files - what even worked for some other problems I had previously. But you are right of course
well what are you trying to tell the game differently?
You can override what the game does in your own mod too
do you maybe have an idea what mods do this? (dont look or so, just if you have a mod on mind)
the game files by IS will teach you 10x better than most mods I found
once I found a mod that executed somewhere between 150 and 200 table.insert copy pasted (not even in for loop) every hour in game
but indie stone will never let someone put that in their game xd
I strongly agree with aoqia here. The vanilla code contains a lot of OnCreate functions which are quite short and simple.
ok, then I will keep on trying
if you want more guidance, I'd suggest using vscode or a decent ide like jetbrains with lua extension and opening the steam ProjectZomboid/media/lua folder so you can just search all the files for some text
like if you need to know how to use OnCreate like above you can just search the game files for every instance that OnCreate is used
Some basic info for the OnCreate function: It must be put to the server folder. The Header typically looks like this
function Recipe.OnCreate.MyCustomFunction(items, result, player, ...)
Iirc, "items" is the list of ingredient items, "result" is the result of the recipe. So you just have to pick out your old gun from "items" and transfer all relevant stats from it to the new gun which will be in "result". Getting and transferring the stats will pbbly be done by using java commands.
Thanks man! That helps a lot
also important is that you tell your recipe txt script it should execute your OnCreate function. This should work by adding the line
OnCreate:Recipe.OnCreate.MyCustomFunction,
to the script
look, in a million years I would not have thought of this myself. But now that you say it, everything makes sense, and now I also know how my function activates. Really, thank you a lot! Just had a massive "aaaaaaah!!!" moment
To further clarify stuff a bit more, here is a minmal example which will transfer the condition of the old gun to the new one:
local oldGun = nil
for i=1,items:size() do
local item = items:get(i-1)
if item:getFullType() == "Base.YourOldGunsScriptName" then
oldGun = item -- grab the old gun for further work
break
end
end
if oldGun then
local condition = oldGun:getCondition()
result:setCondition(condition)
end
end```
I made this example out of my head and did not test it but should be smth like this.
That makes sense! If I see it correctly, it calls a specific gun, so each gun would need its own little function like that?
If you have several recipes with different ingredient guns, one way to realize this is indeed to make several OnCreate functions. One for each recipe
That will be fun! Thanks a lot โค๏ธ
Oh wow! Just using the getTimestamp() is really a good idea! I thought about using the game tick via OnTick event somehow to check the time but I think Timestamp is much easier here
bing bong Tell your friends, we've updated <3 https://steamcommunity.com/sharedfiles/filedetails/?id=3172171349&tscn=1711520754
Hello friends, trying to promote the modding discord by asking a prompt: https://www.reddit.com/r/projectzomboid/s/3Brst3eeO4
Let people know what your pipedream idea for a mod was.
I must be blind, but I cant see the request channel
What is the time field for TimedActions? I'd assume it's miliseconds but I am not so sure.
You'd need to go through onboarding / check special roles / agree to the user agreement. This is also in regards to the discord linked there, not this discord.
It should be ms.
ty
I cant find what you are talking about, google also did not really help
Well, you're not in the discord that is linked, as I mentioned.
id like to ask everyone to be on the lookout for a modified version of my backpack flags mod that may appear on the workshop
somebody thinks they're "trolling" by releasing racist versions of my mod
here is a now deleted comment they also left on my profile
i'm not as active in the community anymore but I definitely don't want any of my mods associated with anything like this and would appreciate anyone elses assistance.
Or if anyone knows anything else I can do here, it would be appreciated.
yikes
I usually report such behaviors.
I also note: that same account is currently requesting PZ vanilla game support on my last mod..
hey huh
idk if i came to the right place to ask
but is it possible to script an item to be both Food and Drainable?
As in a food item that can be used as a drainable item in recipes?
Aren't the various dried legumes like that?
Wait a minute, most food items that are also ingredients are kinda like that, you can eat them whole, 1/2 or 1/4 and some part of their nutrition is used according to what is specified for each meal-type whenever it's used in cooking.
Can you give me an example to clarify what exactly you want to do?
i liked your photo
would be really nice if you could
Do you mean just food recipes btw?
Yeah
It is meant to be like
Powdered milk
Eat it dry in a pinch
or mix it with water
I could get it into the game as a food item quite easily as it seems to be meant to
but i couldn't figure how to give it a drainable bar like, say, thread or towels
Maybe if this isn't possible you could make two items that look similar with same name for dry powder and powdered milk mixed with water
the powder+water will be a drainable and the powder itself will be a food?
I thought about i didn't want you to spend the whole bag in a single milk bottle y'know
And i dont think making like, individual itemf for each portion used would be the optimal way
Hmm, that may be possible, but I don't understand enough lua to help you with that.
Not that I'd know, but from reading through the files, using intermediate items is almost certainly going to be easier, if for no other reason than that you can use existing items, recipes etc. as a template.
Furthermore, I'm in need of assistance myself when it comes to the lua scripts.
I just can't get a recipe override to work at all.
Best of luck with your project too.
they cant release and upload mods to the public without your permission. You can ask them nicely if they dont you can make a complaint I believe.
I dont know if generic reporting works prob does. Never had such an issue
Queston, When it comes to the Scripts folder right, is it possable to add more folders in that directory? So it would go Scripts/Folder 1,Folder 2 and so fourth.
Yes
It's even done by the base game
ok cool, do i have to add anything to make that work or just make the folder and go nuts
Anyone know with the new update if switching to server side will make my server more laggy? I have about 40 people average daily and if it's gonna make server play laggier I wouldn't be happy about that
Talking about switching client actions to server side
Depends
Hey there, quick question, I want to edit the durability of weapons included in VFE Stalker. I found where to edit that (ConditionMax in the weapon .txt file), i just wanted to know, the changes will be applied to all weapons (even ones i already looted), or it will apply only to the new guns i find?
does anyone know if it is possible to add/change the CustomName and GroupName of a tile in Events.OnLoadedTileDefinitions.Add()? I have been able to change other properties of the tile but not these two, when attempted the tile changes to "Green Oven" every time. kinda funny actually...\
does anyone have a good tuturial link since no one in this chat has the time to explain adding clothing and armor as mods. like making them
Haha, I ran into that problem too, I searched through all the game files and java side, to no avail. I don't understand why it doesn't change correctly, and particularly why to Green Oven lol
hilarious... if i don't give it a name the pick up works but placement fails. if i let it be a green oven it works perfectly...
looks fine in blendr ๐ญ
I don't know much about the textures, but I did learn that if blender created a multilayer texture it won't work in PZ.
its like its still using the old 3d map on the exported model maybe?
texture is just a flat png made in photoshop
yeah, I found out that some 3d models use multiple flat files to make the full set of textures but PZ only uses one. Did not know this until I loaded the 3d model and some parts were missing. Looked similar to this issue you have in the photo. Evidently there is a way to force all the different texture layers into one flat that doesn't overlap, but it's beyond my abilities.
ill try copying to a blank doc
๐ช๐ฎ๐๐ฐ๐ต ๐๐ต๐ฒ ๐ก๐ฒ๐ ๐จ๐ฝ๐ฑ๐ฎ๐๐ฒ๐ฑ ๐ง๐๐๐ผ๐ฟ๐ถ๐ฎ๐น: โก๏ธ https://youtu.be/eE7FedDW2AI
In this Blender tutorial, I will show you how to bake multiple materials to one texture map.
I forgot to mention in the tutorial: Before baking any texture maps that are not contributing to the base color, (Roughness, Metallic, Normal) You should set the image's color space to No...

