#mod_development
1 messages · Page 52 of 1
I am literally just trying to access the modData as a test and its firing a null table
Nvm I think I found that issue at least, was trying to do that before the player existed
This has been a troublesome one...
Is there a way to hide items like armor, bag, hat and such on characters? <m_Masks> and <m_UnderlayMasksFolder> don't seem to work for those stuff
Does anyone have experience with adding new shaders to PZ or know if it's even possible?
doesn't the blind trait add a shader? it must be possible
Gaaaaaaah this is so fucking annoying. I keep getting a attempt to index non table error from the last block in this function.... maybe I am just not initializing the modData right?
function transporter.AddPoint( player, id, x, y, z )
local player = getPlayer();
local modData = player:getModData();
modData.SavedTeleportPoints[id] = modData.SavedTeleportPoints[id] or {};
if not id then
error("There was no ID given", 2 );
end
if type(id) ~= "string" then
error("The given ID is not a string", 2 );
end
-- transporter._regPoints[ id ] = {
modData.SavedTeleportPoints[id] = {
X = x,
Y = y,
Z = z or 0
};
end
Like from where I try to save the coordinates
is this on the server? getPlayer() only works on the client
yea
i assume so at least, its in a Client folder
does it need to be on server to save it?
is modData.SavedTeleportPoints initialised somewhere?
how would I do that? I thought this would take care of that
modData.SavedTeleportPoints[id] = modData.SavedTeleportPoints[id] or {};
modData.SavedTeleportPoints = modData.SavedTeleportPoints or {} before that
your code only creates the sub-table for that id, you never created the main table so it's bugging out
When this happens, you can click Error and still see console info
Even when everything is wonktastified.
Yea, still though when you break the debugger you probably fucked up royally somehow
I think that was it
😩 finally
Harder than dark souls
how do i disable the esc key
im doing a heroin mod and i want to make it so that any controls is disabled thru out the effect
im almost there its just that when the player pressess esc key the player stands up and cancels the animation
the downed system on the server just adds the timed action every frame to get around that, if that works for you
i should replay the animation every tick?
@bronze yoke @lyric bolt @rough goblet https://steamcommunity.com/sharedfiles/filedetails/?id=2889964195
nice!
lmk if anyone has any issues at any screen sizes and I'll fix but I think the way the code is written should work for all sizes.
congrats man
I mean honestly trivial mod lmao but I'm super happy to have it myself
Esp on controller it sucked because we don't get the mouseover effect
So even the selected mod's name is invisible for us (okay half visible when it's long... We can see short mod names okay.)
anyways is there a better alternative than to flood actions ? i mean cant i just store the players keybind then force the keys to do nothing then revert it back to original?
you should check what code makes escape cancel timed actions
i'd be interested if you find it, i don't have time to look for it right now but it is causing an unfortunate side-effect with the downed thing
im searching every getcore() on the lua
-- the true boolean is to create the file is it doesn't exist
local keyFile = getFileReader("keys.ini", true);
-- we fetch our file to bind our keys (load the file)
local line = nil;
local version = 0
-- we read each line of our file
while true do
line = keyFile:readLine();
if line == nil then
keyFile:close();
break;
end
if not luautils.stringStarts(line, "[") then
local splitedLine = string.split(line, "=")
local name = splitedLine[1]
local key = tonumber(splitedLine[2])
if name == "VERSION" then
version = key or 0
elseif knownKeys[name] then
key = MainOptions.upgradeKeysIni(name, key, knownKeys[name].key, version)
-- ignore obsolete bindings, override the default key
knownKeys[name].key = key
getCore():addKeyBinding(name, key)
end
end
@bronze yoke
function ISVehicleMechanics:onKeyRelease(key)
if key == Keyboard.KEY_ESCAPE then
if isPlayerDoingActionThatCanBeCancelled(self.chr) then
stopDoingActionThatCanBeCancelled(self.chr)
else
self:close()
end
end
if key == getCore():getKey("VehicleMechanics") then
self:close();
end
end
found it .. but how am i supposed to use this
and its for vehicle
dude, you're a wizard thank you!!!
i was wondering if it was my 3400x1440 but my buddy at 1080 had same issue
ISTimedActionQueue.clear may be of interest. The function that the UI you posted calls is IsoPlayer.StopAllActionQueue, which only ever seems to be called from button presses in GUIs
I have very long eyebrows!
Does it look right at both resolutions? I didn't bother checking higher resolutions but it seemed like it should work because the code is based on what I believe to be the width of the container and a fixed button size and some fixed spacing.
Cool
I wasnt sure about the codes i find so jam evrything and hope for the best lol
However i managed to make it work using albions tip to just spam the action
So i spamed the emote and whenever i press esc thebplayer remained doing the aimation asigned which was the intended
Hey thats my line haha
let's goo
I just made the HEV Suit
oh that's sick
haha well i'd imagine it would be
0.01% chance to find it.
90% of protection against bullets, 85% against bites and 80% against scratches.
However, it's heavy too.
Probably I will add it to the Workshop soon.
Found a way to get a list of all the valid targets when a player attacks, but only zombies, not vehicles 😩 I was so close
Try again tomorrow
#mapping message
You'll probably need to export the right pack, not sure where the flags are though.
Wow i wanted to this exact samething..
Can we get the link to this mod? If its uploaded already
Hey, quick question. I'm new to modding, and I was wondering if there was a way to create a simple custom meta event, specifically the one that spawns 3D objects like with the chips & soda party?
Heyo fellas, what's the thing needed to do so you don't have to restart PZ everytime you make changes to your code?
A players precense is required when spawning stuff
Just so u know
Is there somewhere some documentation on how to write the sandbox-options.txt files?
I'm trying to understand what I can do with it (like adding text or maybe a field that is not enabled in which I can write some info etc)
this is what i've been working with but I was wondering if there are more things we can do beside true/false field, select and free text
https://github.com/theCrius/project-zomboid-random-zombies-full/blob/main/media/sandbox-options.txt
Depends on what you changed
Sometimes there are lua files that can be reloaded using the debugs panel or console
But its generally based
On how the code works or written
If its something like maps items vehicle etc
It wont work
Learn from other mods
Which is what ur already doing so i guess thts that
Bool enum integer string array float double
Nit sure if theres float actually
I think you misunderstood the question @ancient grail. I know about the various type of options. What I am asking is if there is a documentation somewhere because "go and dig random mods" is definitely NOT the way everyone can go about it. For example in the "core" configurations there is the "proper zombies" checkbox that disable the entire page and set it to default values. Is it possible for mod's config? I guess so but how to do it? Someone must know.
@TIS Dev, the last updated broke ripping clothes for my prox inventory mod and I have no idea how to fix it, can I get some advice?
https://steamcommunity.com/sharedfiles/filedetails/?id=2847184718&tscn=1668740269
Also broke my rip all clothes mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2779627490&tscn=1668732881
Something is wrong with ripping clothes but I have no idea what
Welcome back Mx!
Ow thats sad to hear
Thank you, I'm here just to inform the devs about this weird thing, I haven't touched my mod in weeks now, so I'm confident is something that happened in the last update
Heres the email mx write em some
I assume there's no errors @gilded hawk
You'll have to plug in prints every step/if statement and see what it prints
it's actually for a custom rp server.
Yeah no errors 😦
Ow ok..
@faint jewel we work for the same server btw
oh?
check change list? in's intentional
Where? 🤔
Ye saw a post on support claiming ripping sheets has a bug or something
Must be the same issue
not last patch but I remember a note saying ripping will be limited
This is odd, why?
Did they explain it anywhere?
Cuz you end up ripping your stuff im guessing
I think it was to together with lowering maggots for performance.
not that it solved the issue
You can't rip stuff your wearing unless you do it directly afaik
There's a specific check for it
Performance has probably more to do with it
Being you can generate hundreds of objects quickly and scatter them around
I'm not sure about this but I think ripping with right click only checks that inventory, e.g corpse clothes. But the crafting UI seems to get all the containers(multiple corpses).
Right click context grabs all I believe
You can right click a shirt and see rip (50) if your next to a pile of bodies
If they removed that feature that's a good change
I saw difference a few days ago, again not 100% in this.
omg why does anyone do animations this is insanity.
Hmm maybe I remembered it wrong - could have pulled the clothing to the floor first maybe
I wonder how hard an actual stack item system would be to work out
I imagine it would need a bit of overhaul
A simpler solution could be to force the rip action into the recipes that need them
i.e.: if you're bleeding you can use a rippable piece of clothing and the means to rip it
dirty bandages after the fact can act as normal
but that's to avoid people from I assume dumping hundreds of easily creatable objects
Which if someone is determined enough they could get around
So would one issue my mod wont upload is that the ID in workshop.txt is identical to the mod template's ID in workship.txt? How do I get a new id?
When you go through the upload process it asks if you need a new ID.
Then why do I keep getting this? The folders are structured correctly.
What is 2880293575?
Why are you uploading the default modtemplate?
Ouch. My solution to this is upload it with new ids . But happened only for personal more that are unlisted so no biggie
I am not, I used it as said template
But you have to edit it
I did, but I do not know what to set the ID to
that looks fine
And there is no "do you want a new ID?" prompt
yeah there is
right before that screen
the ID I was speaking about was not the modID but workshopID
I never bothered to change the versions for somereason. Does it auto update?
I don't know if that matters tbh
Probably if u have a to jump back to previous version via steam
What happens when I go through the steps
Are you using any mod menu related mods?
I see the issue
Check your workshop text
remove the ID there
assuming you are using the mod template workshopID
The game skips that step if you already have a workshopID
Found the issue I think
Which goes back to when I said 'remove the ID line' but I got the mod.info and workshop.txt mixed up
Anyone know where you can find the scripts for the different medical items?
I deleted the workshop.txt altogether
When creating a new item the only tag you can use is "medical"
that works too
Will see if this works
It should generate one
It did.
The issue I had was I copy pasted the template's workshop.txt and then just edited the file
I did, but it just put it right back.
I left it at id= and it would put the same ID back in
uhh
you should see the new button for get new ID
hm, trying to test it now
Nah it seems to work if I remove the ID line
did you make sure to save and restarted your game?
Is there a function to modify player speed?
Im making a drug that gives a player turbo speed for a few seconds
Had same problem. You check imeds for reference . The author doesnt reply tho
Thanks! Didn't think about that one, but it's a good idea
You could do what i did
And just give them a temporary trait which is the fast runner
Yeah cuz you cant find the medical on the lua for some friken reason.
But imeds code is super complicated for my level . I like to keep it as simple as much as possible if i could
It even has its own events if i remembrr correctly. Anyways goodluck
most health stuff isn't lua
gotcha, ill have to make one then i think
What is the 'proper way' to get the player in lua, I see people doing it all different kinds of ways, passing a player param, just using getPlayer(). self.character?
self.character is a property of timed actions, if you're using one you should definitely use it
otherwise, a lot of events and functions pass either a player object or a playernum for getSpecificPlayer()
and then you can consider looping through getSpecificPlayer, and then you can use getPlayer()... but honestly little of that matters when nobody plays in splitscreen anyway
So self.character is probably the best?
when available!
When is it available tho?
in a timed action
Kk so the function needs to be a timed action?
Is there a limit to the cars that can be in a game?
Hmm, I cannot find how to actually affect speed, I see more traits does some stuff with adjusting equipment speed modifiers
@deft falcon hi sorry to ping you but if you could spare some time to debunk as to how you modified the speed, will be a great lesson for us
Hey, Just wanted to ask. I am starting to learn how to mod and want to make sure. Are the Fenris Wolf and RoboMat guides the best place to start or is there something newer more up to date out now?
Yeh they are great materials
I personally just look at the media folder most of the time tho
okay thank you. I just asked because I noticed RoboMat's guide is from 2013 and most of the images in the tutorial are 404 errors. But if its still relevant I will definitely go trough it
Fenris' is relevant, don't know robomat's
Same here. And also fenris is active
I am trying to understand Lua and how to work with it.
I want to make a mod that gives the vanilla cars attachment options for homemade armor. Thats the end goal at least. I know its been done before but I have no idea how hard it will be haha.
Probably very advance for a first mod proj.
giving them an armor item is easy, making it actually do something efficiently is hard, rendering it on the car is ????
oh yeah not a first mod. Thats just what I am aiming to be able to do
Cool goodluck!
the way I have seen other mods do it is :
Lets say you have armor on your hood. Whenever the car hood gets damaged past 90% a script puts it back to 100% health and subtracts % from the armored part.
I am guessing this is quite unoptimized though
but its a solution I can at least wrap my head around
yes, they do that by checking the condition of every part of the vehicle every cycle, very inefficient. I haven't looked yet but I'm unclear on whether anybody actually handles damage to vehicles when nobody is in it
I am guessing theres no "on vehicle damage" event
unfortunately no. Thats actually the mod I'm making, lol
Thats a good suggestion the devs tho
oh
well that sounds fantastic
so what is the mod youre making?
it it an event extension library?
ya, we mentioned it to Aiteron the last time he was around, sounds like build 42 may get some of that
Lit
I'm attempting to create an event based damage framework for vehicles. Currently I have events for
- Crashing into players
- Crashing into zombies
- Crashing into inanimate objects
- Player breaking into a car through the window
- Zombie attacking windows
- Offroading wear and tear
Still working on... - Player attacking vehicle with a weapon
- Zombie attacking parts other than windows when they can't reach the window
oh thats really really cool
What's the command to set someone's pain levels?
I don't know if vehicles can take damage from something like a grenade, so I'd still have to look into that, but as far as I know that's a complete list of damage a vehicle can take
will this framework be publicly available?
If I finish it before 42, lol
thats fair enough
getPlayer():getBodyDamage():setPain()
I think
But i only typed this as im using mobile u might need to double check
It could be getStats()
anyways I gonna go try a mod or something
best of luck
The mods I like for survival: 1) Mod Manager
2) Tsar's Common Library v.1.30
3) The Forest
4) Primitive Survival
5) Craft Helper Continued
6) Yaki's Makeshift Clothing
7) Improvised Backpacks by Maxwell218
8) Fluffy Hair
9) Handmade Weapons
10) Recipes+ By Revolution
11) Zaedyn's QoL Recipes
12) Torch By Revolution
13) Zombies drop more lighters and matches
14) TrueActions_1.08
15) Zaedyn's Wilderness Recipes
16) Rugged Recipes
17) Insect Ingredients
18) ST Survival Tailor
19) Torch
20) Yaki's Makeshift Clothing
21) Bow and Arrow
22) Snake's Modpack
23) Well's Construction
Check out KI5 mods
Their armor system is among the best I've heard
doesnt bring up anything on the workshop
ki5 is the developer, he makes a tonne of vehicle mods
oh I read that as K15
haha yeah its gonna take me a bit to understand how this works
its more or less what you described earlier
he added armour?
many of his vehicles have armor, ya
but not the one I have obviously...
time to change my vehicle mods list again
before I start doing any of this. Its possible to make a mod that modifies the base vehicles right? Or do I have to make a copy of a vanilla vehicle to be able to modify it?
yes, you can. Vehicle scripts can be altered at runtime
what speed
well this is going to be an interesting weekend
So my mod seems to make the game freeze on startup when it syas "Loading Scripts" and I either have to close it through task manager by repeatedly clicking end task, or let it run it's course and close on it's own
As a side effect of working on damage events I found and fixed a bug with the blood on vehicles lol, don't know how no one noticed it before me
Odd seeing as it's just a recipe txt
what was it?
rounding errors cause the bloodIntensity to get stuck at 3.9999%
so nobody got to see the vehicles in full bloody glory after mowing through a couple dozen zeds
I took screenshots but I'm not at home atm
do you mean the speed modifiers on clothing? those don't actually work
Hello there friends, how do you play an animation through LUA?
does any one know what kind of value the carbs.proteins,lipidscalories. is based on ?
yea but what metric are they using per kg or pr 100 gram or is it number / weight
like have an item weight 100gram so if i write the 100 lipid is that based on the 0.1 weight from the items or is it based on a fix amount of weight
For the players
not even sure that speed are implemented into the game yet
Thnx for replying
getPlayer():playEmote()
Is that just for emotes or is that for all animations? Thanks either way :)
ok, but debug has 2 ways of moving faster
Where do you find these things??
teleport forward slightly and less time for animation
You have to use timebased codes for actions
You can only do limited animations with emote
Unless you know how to make animations for pz or you can manipulate the xml
Like authentic animation did
I did this to the zed on the floor with back against the wall. Used it for my heroin mod
Gmhahahhh
Exactly what I’m making now too
But can’t you just play one of the normal animations that are in the game?
You cant u have to create xml file that does that since animations are diffrent from one another
Like some are loop, some are used while moving some are for zeds some are for humans
Etc
Does anyone have wilderness survival based modlist they use?
#mod_support would be much more appropriate i think
mod_support is for figuring out how to install / figure out issues one could be having with mods
its for "end user questions", while this channel is for "making mods I guess"
a mod recommendation would fit better in pz_chat
although it doesn't matter too much
Does anyone know exactly how reportEvent turns "EventSitOnGround" into a signal to the data that actually makes you sit? I have a custom XML and a custom FBX and I am trying to figure out how to trigger my event similarly to how sitting is triggered (as it would be an alternate sit animation associated with a trait).
(Trying this in #modeling, too, not sure where the question is more likely to get answered.)
Didn't Dislaik write a guide on animation? haven't looked at it yet but it might have something useful in it for this
I may be using it for all I know but the guide ends with some odd sitch where you loop the new animation into the walking state by tying to a boolean and toggling that boolean on or off, rather than discretely triggering it.
Yeah I am using Dislaik's guide.
The animation he teaches us to include works a bit differently than my goal... trying to change the animation that happens when players click "Sit on ground", but conditionally.
are you trying to instantiate animations between players? I did something like that here https://steamcommunity.com/sharedfiles/filedetails/?id=2728300240
or if you want a clear example, also you can see the example #3 on https://steamcommunity.com/sharedfiles/filedetails/?id=2735092774
which made me wonder why mx made a mod that lets u remove them
yeah i just decided not to say anything when that was going on 😅
now we just need a mod to make them work
:P
placebo effect is serious though, i know ppl tailoring their clothes on my server, and it's good for RP 
there are many other mechanics in pz that don't do what people think they do, but thinking they do makes the game more fun...
I am trying to fire an alternative sitting animation if the player has a certain trait...
I do not know if that requires instantiating animations "between" players... I would hope / assume not.
I just want my one player to sit down according to a specific animation and then fall into my new animation loop after that. Instead of sit causing player to sit and then remain sitting, I want player to cross legs and stay that way.
it uses player:setVariable('SitGroundAnim', 'Idle')
If you're planning on making it work in MP, you probably will, unless there's some other way to sync setVariable to other players
mmm, dang.
Okay well I'll start with SP and expand from there
So when I call reportEvent("EventSitOnGround"), that function is ultimately just setting the SitGroundAnim player variable to Idle to trigger that animation?
from what i can tell, yeah
So that explains this pretty well @bronze yoke
<m_Conditions>
<m_Name>SitGroundAnim</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>Idle</m_StringValue>
</m_Conditions>
But I'm not sure how the animation clears that idle string after finishing the initial sit, and how the code passes into
<m_Transitions>
<m_Target>sit_loop</m_Target>
<m_AnimName>Bob_SitGround_ActionToSitIdle</m_AnimName>
<m_speedScale>1</m_speedScale>
</m_Transitions>
From:
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>sit_action</m_Name>
<m_AnimName>Bob_SitGround_ActionIdle</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_SpeedScale>0.30</m_SpeedScale>
<m_BlendTime>0.30</m_BlendTime>
<m_Conditions>
<m_Name>SitGroundAnim</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>Idle</m_StringValue>
</m_Conditions>
<m_Conditions>
<m_Name>hasTimedActions</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Transitions>
<m_Target>sit_loop</m_Target>
<m_AnimName>Bob_SitGround_ActionToSitIdle</m_AnimName>
<m_speedScale>1</m_speedScale>
</m_Transitions>
</animNode>
This seems key in moving from SitGroundAnim = Idle ("Sit down, Bob") into sit_loop ("Stay sitting, Bob"), but how does the game know I finished sitting so that its time to transition?
you will need to use TimedAction
Do you know where the game does this for vanilla sitting? @ruby urchin
you won't be able to copy the way vanilla does it, it's some java ai state stuff
I see. So the way modders trigger their modded animations is pretty different from how it's triggered in vanilla generally?
ProjectZomboid\media\lua\client\ISUI\ISWorldObjectContextMenu.lua#L4516-L4518
Apparently reportEvent is in charge of sync some anims, but they are limited
public enum EventType
{
EventSetActivatedPrimary,
EventSetActivatedSecondary,
EventFishing,
EventFitness,
EventEmote,
EventClimbFence,
EventClimbDownRope,
EventClimbRope,
EventClimbWall,
EventClimbWindow,
EventOpenWindow,
EventCloseWindow,
EventSmashWindow,
EventSitOnGround,
wasBumped,
collideWithWall,
EventUpdateFitness,
EventFallClimb,
EventOverrideItem,
ChargeSpearConnect,
Update,
Unknown;
}
i'm only now trying to learn this system, but i don't think this is actually how it works
Totally fair, thanks, I have nfi
I am trying to guess based on names of stuff
If I had to guess, "sit_loop" seems to be about just staying in the sitting position somehow
it's sit_in > sit_loop (at any time during this, sit_rubhands and sit_warmhands can be triggered by changing SitGroundAnim, and sit_action can be triggered by setting hasTimedActions) > sit_ext
Ohhhhh... I see... I was just looking at sit_in... So what is sit_action vs sit_in?
I would've thought sit_action was the action to sit down
Clearly not...
Sit_in makes sense... going into the sit state
sit_action is when your character stretches out their legs while reading or reloading
Ohhhhhhhhhhhhh
Okay so basically to do my animations I just need to activate my animation conditions, and the animation just started happening? Literally just setVariable on my player and voila (in SP)?
i believe so
Interesting
You're trying something like this?
I think I see what I need to do... Going to try it out.
yeah that's pretty much what i was thinking
Thanks, I do have that.
For some reason I was just hoping that I could reportEvent in a way that led to my animation the same way I could report sitting. I'll just make my own reportEvent so things look clean and do my variable setting in there
how would one go about adding another mesh on a vehicle, Like when I put the hood on the vehicle a separate mesh appears
Haha I am open to solutions from wherever they come!
I would also think this may be a modeling question
he was responding to me
I deleted my question and posted it in modeling
Btw, no biggie asking general stuff here - as topics can blend - I just figured people in there might know more. 👍
i was able to do it like this:
model Vehicles_CarNormal_Cowcatcher
{
mesh = vehicles/Vehicles_CarNormal_Upgrades|Cowcatcher,
texture = vehicles/carnormal_upgrades,
shader = vehiclewheel,
scale = 0.01,
}
...
part Cowcatcher
{
model Cowcatcher
{
file = Vehicles_CarNormal_Cowcatcher,
}
}
Hmmm... getPlayer():setVariable('SitGroundAnim', 'Idle') actually does not trigger the sit animation @bronze yoke
i think you need to report the event first
Well reporting the event is sufficient by itself
that's what the event uses to change which animation is currently playing
try sitting and using getPlayer():setVariable('hasTimedActions', true), i think that will switch you to the action animation
getPlayer():reportEvent("EventSitOnGround") -> ?????? -> player:setVariable("SitGroundStuff", values) -> Player is Sitting
you just wanted to change the sitting animation based on a trait right?
Nada on getPlayer():setVariable('hasTimedActions', true)
yyyyup
But I don't even really know how to trigger my animation yet
tbh
did you look at the example dislaik sent? that seemed exactly like what you're looking for
ah, it has to be 'true'
getPlayer():setVariable('hasTimedActions', 'true')
basically just copy how sit_action works but set its variable based on whether you have the trait
No dice on getPlayer():setVariable('hasTimedActions', 'true') either
please try the mod dislaik sent earlier - i'm pretty sure it's exactly what you're looking for
ah... you're just not allowed to do that
i think if it were your own variable it would work fine
I see.
Where can I find which variables I can use to modify stuff through code?
you can find a reference for the java functions here https://zomboid-javadoc.com/41.65/ and anything from lua in your ProjectZomboid/media/lua folder
Javadoc Project Zomboid Modding API package index
And the Lua is visible uncompiled in in your Project Zomboid directory, in media
Very good, thank you!
@ruby urchin In your example you just sent me, I notice you changed the idle folder to sitonground and in sit.xml I see that instead of naming the AnimName "AnimationGuide" you named it "Bob_SitGround"... How did you make that decision? Where is "Bob_SitGround" used in your files?
a correction: sit_ext is either unused or something else
No biggie, I can't even get the basic step of seeing my animation in game yet
I'll worry about flow once I can at least trigger the gd thing
the standing up animation is getup/fromSitOnGround
That's the hurdle for now
anyone got some good tips? i'm just getting into project zomboid modding, know how to use lua, but no clue how modding project zomboid works
got like atleast a year and a half experience with lua
@void fractal
@void fractal
yeah i've taken a look at project zomboid's directory but my question mostly is like
@void fractal
https://github.com/Konijima/PZ-Libraries
can i just tap into project zomboid's functions or do i need to require them in some way
you can just use them
Anything global of course.
(meant to reply to him woops)
with a year and a half of lua experience i assume they know about scope!
yeah
i guess i'll try to do a lil bit of digging to see if i can make my own timed action
thanks for the links
that's a good place to start
oh god
Lmao horrifying...
is he okay
I think I killed him
LOL
tbh i wish project zomboid had a "dev quickstart" much like rimworld does
of course it's the meditation mod again
creates a basic world instantly without having to choose anything
Haha I want to add animation before I publish it 😈
you haven't even published it yet?? wow
Nah it's the one I'm holding back
I've published 6 other lmao
Been working on that one 2nd longest
But I can't resist urge to learn animation for it
what program yall modding on anyways?
I use VS Code.
ah same
IntelliJ for decompiling the Java
well do you have any handy plugins for vscode?
i mostly use vscode for c# so no clue if there's any good lua plugins
Not for this game but if you ever do web design you absolutely must install Live Server
Live Server is a priceless time saver for many little things lol
ooh i do web design sometimes
Right click file -> run local website in your browser.
That's what Live Server lets you do
wait thats neat
I just add a T-pose animation with that name action
the guid plugin can be useful for zomboid, but not exactly a huge deal
lol, check the export settings on the guide
I did check them but I will check them again haha
@ruby urchin Your posted config:
What I'm about to do:
Am I missing anything?
Yeah, the primary and secondary bone orientation
ohhhhhh lmmfao
That WOULD explain the insanity we just witnessed
Tysm
You're awesome
are you able to remotely play a timed action using the debug console?
kinda just wanna test if i set this up correctly but have no code to trigger it
okay but how exactly do I use this do I put this into the template for the car part that I want to use?
or am I way over my head on this one?
ISTimedActionQueue.add(TimedActionName:new(whatever parameters your constructor takes))
as long as it ends up in the script for the part that you want to add the model
ah sick thanks
i.e. if you want it to be the hood, make sure the hood part has
model Hood
{
file = HoodModelName
}
let's gooo
i'm glad you got it figured out, i was starting to do some insane stuff
lol that was the best kind of bug
anyone knows a way to check any of the following:
- number chunks explored by player
- any kind of measurement how much of map is revealed by player (since it's revealed in squares, there should be some way of counting how many of those squares is present on players map)
- anything similar
What I'm trying to do is figure out a way of finding any kind of indication how much of map player has explored.
So far best thing I came up with is checking character coordinates every 1/10 in-game minutes and calculating distance to last position and then storing that value and that would kinda represent how far character traveled but you can jsut walk in same town forever and it would keep increasing which is not the best way
@dull moss If you're fine with a solution that only starts counting once the mod is installed, have you tried
MM = MM or {}
-- Stored in a file, you have to write loadSquareCounter
MM.mySquareCounter = MM.loadSquareCounter()
local function LoadGridsquare(square)
MM.mySquareCounter = MM.mySquareCounter + 1
end
Events.LoadGridsquare.Add(LoadGridsquare)
?
yeah i forgot to respond but i went through a bunch of java and concluded that that was probably the only way to do this
idk haven't tried it
In a bit though, cooking 😄
none of the map discovery stuff is exposed
I am busy running slow tests trying to get my animation perfect 😦
Its actually surprisingly difficult to hit a vehicle with a gun. You pretty much have to stand directly beside it
i've had difficulties hitting them with melee weapons
Well, I should be able to very efficiently detect weapon damage then, thats pretty heartening
now to test molotov cocktails. If I can figure out how to throw one
ya, that's what I thought, they don't damage cars either
All I have left is to figure out how to detect when a zombie attacks something that isn't a window, and I think I have all bases covered for vehicle damage, aside from something a mod might add
btw this is the difference in maximum blood from hitting zombies in vanilla (left) and with the rounding issue solved (right)
Almost there, lol. Then I can make the mod this whole mess was intended to support
Are we allowed to use goto in Zomboid? Getting a mysterious error lookin for an equals sign in a place it doesn't seem to need one...
Anyone?
Yogi.ticksSpentWaiting = {}
Yogi.awaitBlessing = function(ticks)
local nobodyWaiting = true
for playerIndex = 0, getNumActivePlayers() - 1 do
local player = getSpecificPlayer(playerIndex)
-- ERRORS ON LINE BELOW
if not player then goto next end
if not Yogi.ticksSpentWaiting[playerIndex] then goto next end
nobodyWaiting = false
. . .
i don't think kahlua has goto
it doesnt. wasnt added til 5.2 (kahlua is based off 5.1)
you trying to use goto for a continue like statement? (ie skipping to the next for)
Fascinating actually
Thanks for the pro tip
Tempting
I literally just finished rewriting with a skip variable when I saw your response
Deciding whether it's worth replacing it with this other style
Yeaaaaaah you sold me
Ultimately saves me like 4 or 5 boolean checks
- NumActivePlayers potentially
Tyvm @quasi geode
Ugh so close yet so far. Just cannot get my animation to trigger when I want it to be happening. Blargh.
It just doesn't show the animation on the way to the ground for some reason. If I manually trigger the animation state while I'm on the ground, it loops with proper timing, but on the way down the character just rapidly collapses into the loop state...
Okay the solution is not nearly as event driven as I want it to be but it is very near working locally...
I am doing a thing!
Sigh now the problem... the way I forced it to work is not framerate friendly... reaaaally need to figure out how to run the animation once and smoothly transit into the loop on sit...
I.e., this is no good:
<animNode>
<m_Name>Meditate</m_Name>
<m_AnimName>Meditate</m_AnimName>
<m_EarlyTransitionOut>true</m_EarlyTransitionOut>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_SpeedScale>1.50</m_SpeedScale>
<m_BlendTime>0.20</m_BlendTime>
<m_Looped>false</m_Looped>
<m_Conditions>
<m_Name>Meditate</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
</animNode>
Because it doesn't automatically replace the sitting part of the sit down on ground animation set.
I really need to figure out how to sub my animation for just that sitting part conditionally...
@ruby urchin If you have any enlightening input here when you have time, would appreciate... probably gonna give up on it for the night soon. (Gotten a lot closer though so still happy with the proximity to being finally done. Thanks for that.)
You can try to add the rest of the conditions
each animation is executed at a certain moment due to certain conditions that are met (should be the same way for sit_in, sit_loop, sit_out, etc...)
SNIPPET: run a lua file
local file = getModFileReader("Id_Mod_Here", "Test.lua", false);
local script = loadstream(file, "Test.lua");
script();
lol oh man, that is so ripe for exploit I don't even know what to say
is it? you'd already need to be able to execute lua code to do it
shouldnt that be loadstring not loadstream?
anyone who would want to run their own code would just have to use your mod and copy in a file after the checksum test
granted zomboid isn't really secure in any way, but this just add insult to injury, lol
how does healing someone else work on lua side
oh hrm guess not, since theres no actual reading the lines.. that a custom function you defined?
maybe that's related to that exploit i couldn't reproduce
its from kahlua, loadstream -> return callFrame.push(loadis((Reader) input, name, null, callFrame.getEnvironment()));
getModFileReader return a Reader Class
its only problematic if your mod does it clientside. its perfectly valid to store lua code in files server side and only read it there, which allows you to:
- edit without having to redistribute updates
- keep server side code secret from snooping players
ah
Probably loadstring is more insecure, you simply need to find the memory address of the string variable
dont define the variable or call the function unless its the server & clients wont have a memory address to find
I would like this to work like that, but always there will be a bro doing difficult things
would this not give a checksum error if it's a lua file? What if you use another folder or .txt?
ya use another folder and w/e file extension you want, such as getFileReader for files stored in the Zomboid/Lua cache directory, that way its not in the mod folder, and not distributed to clients at all
being able to have secret serverside code is intriguing ngl
do i
put local on both var declare or just one of em
if result:get(i):getType() == " BottleMeth" then
local safeChance = 70
else
local safeChance = 90
end
if i declare it like this
local safeChance = 90
for i=0, result:size()-1 do
if result:get(i):getType() == " BottleMeth" then
safeChance = 70
end
end
or is this better
safeChance scope is inside the if so probably no
if you make it local in the if then you won't be able to get the variable later, you should do it like in the second example
then how do i properly declare local
i didnt make it local on the if
its above
then if you put local in the if it's going to be a new variable with the same name and you still won't be able to access the value when that scope ends
ok so ill just put local everytime?
anyone know which mod allows you to sit in chairs, among other things?
I thought this was #pz_b42_chat, my b... but hey, it is modding at least.
#mod_support would be the right channel but the answer is true actions
Thank you.
recipe Make Biscuits
{
destroy MuffinTray,
keep Spatula/[Recipe.GetItemTypes.Spoon]/[Recipe.GetItemTypes.Fork],
keep Bowl,
Water=1,
Flour=1,
Salt;1,
BakingSoda=1,
[Recipe.GetItemTypes.BakingFat];1,
Result: Muffintray_Biscuit,
NeedToBeLearn:true,
Category:Cooking,
Time:50,
}
anyone knows why the salt uses ;
biut water doesnt
they are both drainables
ow wait salt isnt drainable
ahh its probably cus it means evolverecipe
nvm i answered my own question lol
damn got alot of questions i really dont know how to test
item Sodium_Thiosulfate
{
DisplayCategory = Meth,
Weight = 0.2,
Type = Drainable,
UseDelta = 0.1,
UseWhileEquipped = FALSE,
DisplayName = Sodium Thiosulfate,
Icon = Sodium_Thiosulfate,
StaticModel = Sodium_Thiosulfate_Hand,
WorldStaticModel = Sodium_Thiosulfate_Ground,
CantBeFrozen = TRUE,
EvolvedRecipe = Pizza:1;Soup:1;Stew:1;Pie:1;Stir fry Griddle Pan:1;Stir fry:1;Burger:1;Salad:1;Roasted Vegetables:1;RicePot:1;RicePan:1;PastaPot:1;PastaPan:1;Sandwich:1;Sandwich Baguette:1;Taco:1;Burrito:1;Beverage:1;Beverage2:1;Beer:1;Beer2:1,
Spice = true,
HungerChange = -5,
ThirstChange = 10,
UnhappyChange = 1,
WorldStaticModel = Salt,
FoodType = NoExplicit,
Tags = MinorIngredient;Salt,
Poison = true,
PoisonDetectionLevel = 1,
PoisonPower = 5,
UseForPoison = 5,
}
will this work as an alternative to salt?
local variable will access only in if statement
so i should make everything contain local?
no I meant u can't use this variable outside if statemtn
local b = true
if b then
local a = true
else
local a = false
end
print(a) -> nil
local a
if b then
a = true
else
a = false
end
print(a) -> true
ahh gotcha
Hey hello everyone. I'm working on a big project at the moment but I'm stuck: Do you know if there is a way to disable trait selection in the game? thanks!
i thought stuff like this was only within functions
could someone help me with creating a simple lua code that will allow me to have access to the admin/debug vehicle spawning feature in singleplayer wtihout having to turn on debug?
sp doesnt have chat box right?
its not possible
try to download necroforge it might have something you need
not sure
i have managed to get the UI to show up, but error counter wouldnt stop counting and i cant spawn vehicle nor close the UI window again
it would be easier if you use local hosted server instead of sp
only cons would be is that you dont have the fastforward and the pause
other than that you have everything multiplayer has
Not in vanilla to my knowledge, but I think you could mod the next page button of map selection to skip straight to the character (model) creation panel
@ruby urchin @bronze yoke Omg I finally got it. I had accidentally tried to assign a string variable to a boolean animation condition, so my add-on to the vanilla sit-in and sit-loop wasn't working. Thanks so much again for all the help guys!
@LuaMethod(name = "sendBandage", global = true)
public static void sendBandage(final int n, final int n2, final boolean b, final float n3, final boolean b2, final String s) {
GameClient.instance.sendBandage(n, n2, b, n3, b2, s);
}
@LuaMethod(name = "sendCataplasm", global = true)
public static void sendCataplasm(final int n, final int n2, final float n3, final float n4, final float n5) {
GameClient.instance.sendCataplasm(n, n2, n3, n4, n5);
}
@LuaMethod(name = "sendStitch", global = true)
public static void sendStitch(final IsoGameCharacter isoGameCharacter, final IsoGameCharacter isoGameCharacter2, final BodyPart bodyPart, final InventoryItem inventoryItem, final boolean b) {
GameClient.instance.sendStitch(isoGameCharacter, isoGameCharacter2, bodyPart, inventoryItem, b);
}
@LuaMethod(name = "sendDisinfect", global = true)
public static void sendDisinfect(final IsoGameCharacter isoGameCharacter, final IsoGameCharacter isoGameCharacter2, final BodyPart bodyPart, final InventoryItem inventoryItem) {
GameClient.instance.sendDisinfect(isoGameCharacter, isoGameCharacter2, bodyPart, inventoryItem);
}
how do i do something like this if its not even part of the lua code
i want to use sendBandage()
@ancient grail sendBandage is in GlobalObject:
sendBandage(int int1,
int int2,
boolean boolean1,
float float1,
boolean boolean2,
java.lang.String string)
^ so you should be able to just call it directly
Not sure what the values are for
I believe that's just because decompiled but idk
I assume they didn't name their variables int1 and boolean1 everywhere.
Checking out GameClient should give a better idea of their purpose, idk either
yeah but im making something similar
not exactly the same
i want to applyNacrcan()
which is some nasal spray that you apply to people that are high on heroin
so you wake them up
so im looking to do something similar but not the esxact thing
any ideas?
yeah sorry i wasnt clear
cuz the thing is i can just copy and paste the whole bandage code and just modify it but then im going to be stuck on that particular global. unless i have the ability to code the function itself
how will that be possible tho
I'm not really familiar with activating functions of items in inventory that affect the player state... I would look for a mod that does that using original items. Maybe Green Fire?
@ancient grail
Sorry I can't offer details there.
Ive done the state
The part where someone elses intrupt that state is the hard part
Maybe albion knows
Cuz she did made an arrest mod
If you already know how to change the player's state, can't you just change it again the same way?
I just need other players to wake up other players that are heroin drugged
The player affected by heroin cannot move
So heshe cannot fix self
Only paramedics can or other player
Using narcan item
Its other player affecting other player
Thats the thing i need
Maybe if i can capture a diffrent player like right click context menu it be alot easier
Sorry for the typos using mobile
Ok thanks for the help/idea I'll check it out!
I wanted to check in and see if people had similar experiences with the Expanded Helicopter Events mod; seems not to be working with the latest patch. Can anyone confirm this?
question if i nil a moddata thats non exsitent will it cause error
modData['plNarcan'] = nil
or do i need to check
if not modData['plNarcan'] == nil then modData['plNarcan'] = nil end
ill just do the checks lol
no
the checks won't do anything
why
local modData = getPlayer():getModData();
--nill the mod datas
if not modData['heroinDuration'] == nil then modData['heroinDuration'] = nil end
if not modData['plDisabled'] == nil then modData['plDisabled'] = nil end
if not modData['heroinDuration'] == nil then modData['heroinDuration'] = nil end
if not modData['plNarcan'] == nil then modData['plNarcan'] = nil end
if you couldn't assign values to table keys that didn't exist already you'd never be able to make a table
You can also house those within another table
modData.glytch3rsMod = {}
modData.glytch3rsMod.heroinDuration = 1
You don't need the [""] if there aren't spaces I believe
if anything the checks should be ```lua
if modData['heroinDuration'] then modData['heroinDuration'] = nil end
ok cool thnx chuck
amm is it possible to add OnTest to an item with OnEat
i can make a lua for on eat too right?
----- OnEat_WildFoodGeneric IS NOT RECIPE CODE. IT IS CALLED BY IsoGameCharacter.Eat() -----
-- if item is poisoned, apply the rest of its negative effects here
function OnEat_WildFoodGeneric(food, character, percent)
local script = food:getScriptItem();
local bodyDamage = character:getBodyDamage();
local stats = character:getStats();
if food:getPoisonPower() > 0 then
bodyDamage:setFoodSicknessLevel(bodyDamage:getFoodSicknessLevel() + (50 * percent));
if bodyDamage:getFoodSicknessLevel() > 100 then
bodyDamage:setFoodSicknessLevel(100);
end;
end;
end
tho it says its not a recipe code
then i cant make on test if i use oneat omg
cuz i have smokeable heroin and its doing the inject function using oneat
while the other thats injectables are oncreate
So I want to highlight a whole chunk, I tried adding IsoSprite and renderGhostColour but it did nothingwhich is weird. Same thing works when I have setDrag in other places.
So I will test next the addGridsquareMarker, any tips?
this kind of check will skip any keys that are explicitly set to false, which is probably not desirable. (but yes, checking is unnecessary)
I'd really like to highlight the whole square and not some weird circle, without adding new textures.
some of the debug tools highlight squares
thanks, that reminded me something I will go investigate
local square = getCell():getGridSquare(x, y, z)
if square and square:getFloor() then
square:getFloor():setHighlightColor(r, g, b, a)
end
what i used to use (probably still valid)
just tried that, works nice
nice I can set colour like that?
yep
Oow sorry i forgot to post
Figured out how to capture nearby players
Just need to know if i can put moddata on them
function applyNarcan()
local player = getPlayer()
local cell = player:getCell()
local x, y, z = player:getX(), player:getY(), player:getZ()
local xx, yy, zz
for xx = -4, 4 do
for yy = -4, 4 do
local square = cell:getGridSquare(x + xx, y + yy, z)
for c = 0, square:getMovingObjects():size() - 1 do
local chr = square:getMovingObjects():get(c)
if instanceof(chr, "IsoGameCharacter") and player ~= chr and chr:hasModData() then
if chr:getModData()['plDisabled'] == true then
--print(chr:getUsername())
chr:getModData()['plNarcan'] = true;
end
end
end
end
end
end
if this works then i have done what i need
without going thruu the istimedbase thing
How to get full partID? Currently using: part:getId(), doesn't include Base. or whatever mod it is apart of.
Tried part:getScriptName() but return nil.
local part = vehicle:getPartByIndex(i)
local partId = part:getId()
maybe getScriptPart()
i've noticed that modules don't really work very well in vehicle scripts, so it might just not be possible
getInventoryItem() is what I want I think
When there is a will there is a way.
partItem:getModID() or partItem:getModName() - gonna test
Hey all - software dev here very new to modding for zomboid and looking for some help. I've found this template which allows to write mods in TS and then compile to lua, which looks pretty neat. I'm a bit confused with how the reactivity for getPlayer() works. I'm trying to run a simple function which makes the user say something when a zombie is targeting them -> player.isZombieAttacking(), this should return a boolean. Trying to run it within the onPlayerUpdate event, but it always returns false. Any ideas?
If you function has (player)
Then you just use player
Thats what i know atleast
I just go with getPlayer() most of the time cuz its easier to just copy and paste on debug console
does getPlayer() always get updated regardless of the event you're running?
I've noticed the onPlayerUpdate event has a player parameter, which I expected would be reactive but seems to always be false anyway
how do you get IsoPlayer == false
yeah, you need use isZombieAttacking() on zeds
If its server
IsServer() and not isClient()
Iguess
wrong reply again?
omg mixing highlight and WorldMarker looks nice
it's so nice I want to make to add sound and make them blink for Zombie Party
Ammm how do u remove em ?
probably with :remove()
Gotcha
so far I only change position
I'd tell you but I quit the game.
the damage zombies do to your hood and trunk when trying to eat you is clientside only and not real 😩 how am I supposed to detect this
you can get the mod of the item in that part, but i don't think you can get the mod of the part
i don't think the difference is going to matter very often but that's what i was thinking about
I already got the full part id.
how did you do that?
part:getInventoryItem():getFullType()
that's the item, not the part
parts are more like slots
as i said, the difference will rarely if ever matter, but there is one
Is it possible to detect when a particular sound has been played, or to add an event to a sound script?
The answer to the first question appears to be "No, but you can detect when a WorldSound has been played, as well as where, how loud and at what radius"
"and what object did it"
So I was thinking about importing vanilla animation into Blender and I find that instead of FBX they are all just "X" files (literally I found the X files)... Can these somehow be imported into Blender to mod them and make custom versions of these vanilla animations?
Hi guys, im new to modding and I started trying to do simple recipes about crafting beef jerky. Thats the recipe, i've tried to make it work but the recipe inst working. Can someone check it for me and tell what is wrong with my mod?
can i commission someone to make me a car in game?
you have an incorrect structure, go to C:\Users\YOURPCNAME\Zomboid\Workshop, there is a mod template, also you can find some mod on the workshop, the closest thing to what you are doing, subscribe and inspect it, you can will find them on ...\Steam\steamapps\workshop\content\108600
Ty
its working now
https://steamcommunity.com/sharedfiles/filedetails/?id=2890748284 Made a little mod.
nice, I have a thing for comfy food preservation gameplay
Hey, anyone here have some suggestions for the cost of a Military BPV in Hydrocraft money?
I set it at 30$ because zombies will rip it and such, but IDK if that's too little.
I remember a debate recently about whether Cell always describes the same 300/300 square area or if it can move around. In my research I've found that IsoWorld.CurrentCell is what is used for selecting valid targets, so if it really is just the cell you're in and not something centered on the player, then you can't target anything across cell lines with a weapon. Just something I noticed
I don't see anything in the code to imply it moves, either
i've always been concerned by that possibility but never really bothered to test it
if it works...
if there is an easy way to find a cell border in game, it could be tested without too much trouble
Hello! I was wondering how difficult it'd be to make a mod that when you put out food while it's cold, it'll either freeze or become, well, cold depending on the temp outside
I'm dismayed to hear that isn't the vanilla experience. I don't have any experience working with items though
I've not checked that that's not vanilla but given the info in #pz_b42_chat it seems likely
Nevertheless such a feature makes sense lmao, we put out our food into the cold all the time
I have been known to put beers in the occasional snowdrift, ya
well in my test world its -4C and the apple I just threw on the ground has no temperature effects, so I guess its not vanilla
looks like food's freezing state is given by the container it is in, and "floor" is explicitly not capable of freezing anything
there is an OnContainerUpdate that fires when a piece of food updates, but only if the food has gone from Fresh > Not Fresh or Not Fresh > Rotten, so that doesn't look useful either
I'm not going to look any further, but it doesn't look promising.
so in short, you'd need to make yer own check for it huh?
I suppose you could try to detect any time someone drops a piece of food on the ground, and have something running in the background keeping it updated, but that could get laggy
you can loop through dropped items near the player every now and then and change their temperature
and simulate all the time spent away when you come near an item
if necessary
which reminds me, is there a "detect objects within radius" function? or is it always "get all objects in cell then filter them by distance"
not that i know of
that's probably how such a function would work anyway, so it's not a massive loss
if its a small radius (like melee) I suppose I could get all the nearby squares and check what objects are in them
that's how i would do it
Congrats
@hearty dew Sorry to ping you, but do you think it would be possible to hijack print() to include the origin file/mod?
Using ISImage, can you change the opacity of the .png you draw on screen?
Or is there a better way to draw an image with variable opacity?
local print_original = print
function _G.print(...)
print_original("\[TEST\]",...)
end
Just need to figure out the much more difficult thing about grabbing the mod or file that's relevant 🤔
next to impossible, I imagine
This will be revolutionary if your able to do this
Cant yiu hack the java side?
The snippet works to add test on it
Is this cuz of the smash no smash? Lol
hm? no
Haha ok
Has anyone worked with pcall? apparently don't work
Lool if its a unique string it can easily be traced
They generally work. In some cases, there are kahlua bugs (e.g. if called inside a coroutine)
Can't think of a way to do that off the top of my head. The debug api would allow you to get the filename I believe, but that's not implemented in kahlua
If just trying to track that down, can you grep the steam mod folder for the string?
I did this, but still doesn't catch the error
local a = function()
asasdasdad() --this function doesn't exist
end
local status, err = pcall(a);
I don't have the mods the end-user does
Don't really want to download 50+ mods either lol
This should probably be a vanilla feature
Is there someone here who can make a patch for this mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2681635926&searchtext=fjord
Similar to how stack traces list filenames
I will pay $$ to have a patch that fixes this mod
if you do ```lua
local a = function()
error("foo")
end
will it catch that? I believe that worked when I tried it. Maybe certain errors aren't caught and some are?
Idk who to go to but this mod is broken but it's so awesome, I will pay for someone to please make a patch for it so it can work again.
The author of the mod is basically displaced by Ukraine War
it's been six months, no word from him
Do you guys know anyone who will take paid commission for patch?
Mm.. There might be something helpful in the GlobalObject. I glanced over some functions related to getting the current routine.. might be something related to current frame or function or filename
but what you are doing is creating an error
Looking over stuff now
That was for dislaik
Correct. And pcall is supposed to catch errors you create
lua compiler say other thing :s
probably this version of lua works differently
There's this under kahluautil
public static String rawTostring2(Object var0) {
if (var0 instanceof String) {
return "\"" + (String)var0 + "\"";
} else if (var0 instanceof Texture) {
return "Texture: \"" + ((Texture)var0).getName() + "\"";
} else if (var0 instanceof Double) {
return numberToString((Double)var0);
} else if (var0 instanceof LuaClosure) {
LuaClosure var6 = (LuaClosure)var0;
return var6.toString2(0);
} else if (var0 instanceof LuaCallFrame) {
LuaCallFrame var5 = (LuaCallFrame)var0;
return var5.toString2();
} else if (var0 instanceof LuaJavaInvoker) {
if (var0.toString().equals("breakpoint")) {
return null;
} else {
LuaJavaInvoker var1 = (LuaJavaInvoker)var0;
MethodDebugInformation var2 = var1.getMethodDebugData();
String var3 = "";
for(int var4 = 0; var4 < var2.getParameters().size(); ++var4) {
if (var2.getParameters().get(var4) != null) {
var3 = var3 + var2.getParameters().get(var4);
}
}
String var10000 = var2.getReturnType();
return "Java: " + var10000 + " " + var0.toString() + "(" + var3 + ")";
}
} else {
return var0 != null ? var0.toString() : null;
}
}
Not sure if I can grab the 'object' in question
specifically the 'LuaClosure' of the print being passed
@sour island Look at how LuaThreatWindow.lua gets the filename using the globalobject functions
local coroutine = getCurrentCoroutine();
local count = getCallframeTop(coroutine);
for i= count - 1, 0, -1 do
local o = getCoroutineCallframeStack(coroutine,i);
if o ~= nil then
local s = KahluaUtil.rawTostring2(o);
if s ~= nil then
self.callframeStack:addItem(s, {call = o, line = getLineNumber(o)});
end
end
end
Can trim that down to get only the top callframe
The S would be the string I need right?
If so, get the frame right below that
LOG : General , 1668912620592> [function: SuperSurvivorsOnTick -- file: SuperSurvivorsMod.lua line # 73 | MOD: Superb Survivors] weaponhitcharacter
😮
😮
😲
😮
I could just use string manipulation at this point -but I wonder if I can grab the MOD: piece alone
😮
I will never say anything is impossible again
with enough elbow grease anything is possible
tough act to follow, but I did make some progress today myself. I've officially found ways to detect all the different types of damage a vehicle can take, and am now working on differentiating things. Like for example the difference between hitting a vehicle and a tree. Or who is to blame in a vehicle/vehicle collision
Or who is to blame in a vehicle/vehicle collision
Maybe can sell your algorithm to state farm insurance 😂
maybe once I've worked out the kinks, lmao
Nice
Having a suite of more functions would be great
Going to wrap up the print debugger thing tomorrow
Need to formulate a poster concept
haha, the important part
I forgot multiple arguments in print indent
also parsed vanilla prints by checking for the " | MOD: " string
thank you @hearty dew
I'll stream the poster creation in discord
yes
from Unix age
what's my best bet if I want ms?
mb, no secs, milisecs
I was use this local time = math.floor(os.time() * 1000) but I think TIS already added that (or probably always was there)
ya, I was kust using os.difftime(os.time(), timestamp), but its giving me seconds. Wasn't sure if it was the difftime or the os.time() function that was giving me seconds
does getTimestampMs() not work for you?
that doesn't show up in my autocomplete, is that also in os?
oh I see, its in _G, what is the difference between it and getTimeInMillis?
getTimeInMillis exists on the GameTime too, maybe it counts simulation time
the coordinate system of a vehicle's extents doesn't match the coordinates of the game world, lmao
z is vertical in the world and y in the vehicle's extents. Silly
IIRC is a local position
extents x = width, y= height, z = length
is there a proper way to add a mod requirement via the steam workshop upload menu? Or do I need to edit the item in steam outside of PZ?
you can do require=mod1,mod2 on mod.info, but via steam workshop apparently is the more proper way
ok, that's what I figured just wanted to make sure there wasn't a "proper" way
mod requirement you specify in mod.info. Workshop item requirement you have to do it via the steam ui afaik
which one causes the auto-load of the requirement in ModOptions?
the workshop is barely any more than an automatic download/updater
man, I've tried getName(), getScriptName() getObjectName() and getSpriteName() on every IsoObject I've come across and they all come back with nil or "none" or "IsoObject", what gives
What gives is pz's software design uses inheritance where it probably doesn't make a great deal of sense, heh
ya, like my favourite thing to point out, the fact that a potato or a sock or a notebook all have suspension compression
still, I'm trying to get a user-readable list of objects and its being difficult. trying getTextureName now
from IsoObject getItem, then getName or getFullType or whatever
just know devices like radios might not work, only sprite from them
user-readable list of which objects? Vehicle parts? Arbitrary java object?
The results of IsoGridSquare:getObjects()
trying to determine what a vehicle hits when a collision happens, so I scan the area at the point of collision. If its not a vehicle I want to look for walls, fences, that sort of thing
Oh, for world objects, I've seen a mod use the sprite name like poltergeist suggested
and yea, some don't have sprites, like radios. That mod actually has a bug where it causes an exception when you click on radios
IsoObject doesn't have a getItem() method
believe this vague code I'm recalling used getSprint() then getName() on the sprite?
would be funny if getSprite():getName() worked but getSpriteName() didn't, but its possible
function Basement.IsObjectHatch(obj)
local spriteName = obj:getSprite():getName() or obj:getSpriteName();
for _, size in pairs(Basement.Sizes) do
if spriteName == Basement.HatchSprite[size].E or spriteName == Basement.HatchSprite[size].N then
return true;
end
end
end
radios (and maybe some other objects) return nil when getSprite() is call though
so don't write it like above :)
interesting
Another option is to check the type and use a method/field appropriate to that type
my bad, a number of world items save the inventory item
what kind of name are you trying to get when you say 'readable'?
getSprite can return nil, so you either check is it exists and call getName or use getTextureName directly without getSprite
i think quite a lot of objects don't have a name good enough to be shown to players, but i don't know if that's what you're going for
if instanceof(sink, "IsoWorldInventoryObject") then
source = sink:getItem():getName()
else
Along these lines. If you search the vanilla code, you'll see they do this is numerous places
it just needs to be readable by me while I roam around ramming into things, so I can make sure my hit detection is actually picking up relevant tiles
so far all I'm getting is the road under the car, so I'm not sure
ProjectZomboid/media/lua/client/Camping/CCampfireSystem.lua: return instanceof(isoObject, "IsoObject") and isoObject:getName() == "Campfire"
getName() works on campfires I presume :p
You might can just print out the class name?
or a combination of all these things
that's a bit of a special case, the object is created in lua and given its name there
getClass():getName() I think (in debug mode)
we're getting there
oops i replied the wrong message 😅
i mean the campfire one
Ah
Actually tostring() will handle that for you, I believe
that's how I print out userdata (java) objects
which prints out something like zombie.blah.IsoRadio if memory serves
ya, its usually just IsoObject in this scenario, but that's ok, the sprite thing worked
I quite quite yet figure out if something is collidable, but I can tell if something can be damaged by the vehicle, so its a start
oh here we go getProperties().Is(IsoFlagType.collideN) on a square
This makes me wonder if there is a sprite property that determines if an object is collidable
There is IsoFlagType.collideN and IsoFlagType.collideW, which is called on the whole square. I'm about to try it
well I'm able now to detect collideable squares, and damageable tiles, but surprisingly not trees
LOG : General , 1668926407641> 40,865,616> searching for collision objects
LOG : General , 1668926407642> 40,865,616> Collideable square at x-4 y-2
LOG : General , 1668926407642> 40,865,617> Collideable square at x-3 y-2
LOG : General , 1668926407642> 40,865,617> Potential Collision: fencing_01_24 x-3 y-2
LOG : General , 1668926407643> 40,865,617> Collideable square at x-2 y-2
LOG : General , 1668926407643> 40,865,618> Potential Collision: fencing_01_25 x-2 y-2
LOG : General , 1668926407643> 40,865,618> Collideable square at x-1 y-4
LOG : General , 1668926407644> 40,865,618> Potential Collision: fencing_01_27 x-1 y-4
LOG : General , 1668926407644> 40,865,618> Collideable square at x-1 y-3
LOG : General , 1668926407644> 40,865,619> Potential Collision: fencing_01_26 x-1 y-3
LOG : General , 1668926407645> 40,865,619> Potential Collision: fencing_01_29 x-1 y-2
LOG : General , 1668926407646> 40,865,621> End of collision search
So this is gonna sound stupid, but i have never made a mod for anything before and i have been intrested in adding a bunch of new songs into PZ (the true music mod with the mixtapes), i was wondering if this is an extremely hard task or not, and what skills i need, like programming etc
not really anything more than slightly technical computer use, they have a tool to make music packs for that
Aight
@hearty dew have you tried using the getClassFunction function? I've been able to grab a private method, but can't seem to call it, was hoping you knew the syntax
Can only invoke it in -debug mode
You need to use the invoke method on the java.lang.reflect.Method object to call it
hmm, will invoke takes an object and an array of inputs. Doesn't seem to work for me, but maybe a lua "array" is insufficient
in the end I want this for non-debug code, so if invoke is provisionally exposed I'll just to have to do something else
I thought you could pass in individual the parameters (including the self object as the first if the method is an instance method)
Might be an overload for invoke to do that
But, yes, it is only exposed in -debug
this what you looking for or no?
canPassThrough = true;
javaObject:setModData(copyTable(ISItem.modData));
javaObject:setIsThumpable(ISItem.isThumpable);
javaObject:setCanPassThrough(false)
javaObject:setCanBarricade(true)
javaObject:setThumpDmg(8)
javaObject:setIsContainer(false)
javaObject:setIsDoor(false)
javaObject:setIsDoorFrame(false)
javaObject:setCrossSpeed(1.0)
javaObject:setBlockAllTheSquare(false)
javaObject:setName("WoodenWallFrame")
javaObject:setIsDismantable(false)
javaObject:setCanBePlastered(false)
javaObject:setIsHoppable(false)
javaObject:setIsThumpable(true)
javaObject:setModData(copyTable(modData))
javaObject:setMaxHealth(50)
javaObject:setHealth(50)
javaObject:setBreakSound("BreakObject")
javaObject:setSpecialTooltip(false)
Probably not
@ancient grail
...
getWorldMarkers():removeGridSquareMarker(marker)
i did this and if i spawn 1 i can delete it
but if i spawn alot
like alot
i cant delete it anymore
also is it possible to make it show to everyone
local x, y, z = getPlayer():getX(), getPlayer():getY(), 0
local xx, yy, zz
local stand = getPlayer():getCurrentSquare():getRoomID()
local mainSq = getPlayer():getSquare()
for xx = -12, 12 do
for yy = -12, 12 do
local square = getPlayer():getCell():getGridSquare(x + xx, y + yy, 0)
if square:getRoomID() == stand then
table.insert(PoisonTiles, square);
if isDebugEnabled() then
mark = getWorldMarkers():addGridSquareMarker("circle_center", "circle_only_highlight", square , 1,0,0, true, 0.5)
TestMarkers.add(mark);
end
if not square:getModData()['isMethlab']==true then
square:getModData()['isMethlab']=true;
end
end
end
end
heres the code i used to spawn it
it will be a great feature to be able to remove it after the tile isnt poison anymore but its not important for me to do that
ill try this if i can find time ... thnx. im sure itll work.
im curious what will happen if you name your char nil....
ow nvm just remembered usernames are strings
how do i print all moddata of an object
its a table so why cant i get the contents of it
nvm figured it out
for k, v in pairs(getPlayer():getModData()) do
print("k: ", k, " v: ", v)
end
local format, concat, rep, ipairs, pairs, tostring = string.format, table.concat, string.rep, ipairs, pairs, tostring
local istable = {["table"] = true}
local isstring = getmetatable("")
function table.ToPlain(tbl, lvl)
lvl = lvl or 1
local out = {}
local indent = rep("\t", lvl)
local len = 0
for _ in pairs(tbl) do
len = len + 1
end
if len == 0 then
return "{}"
end
local isSeq = len == #tbl
for k, v in (isSeq and ipairs or pairs)(tbl) do
if isSeq then
k = ""
elseif isstring ~= getmetatable(k) then
k = "[".. tostring(k) .."] = "
elseif k:find(" ", 1, true) then
k = "[\"".. k .."\"] = "
else
k = k .." = "
end
if istable[type(v)] then
out[#out + 1] = k .. table.ToPlain(v, lvl + 1)
else
out[#out + 1] = k .. (
isstring == getmetatable(v) and format("%q", v) or tostring(v)
)
end
end
if len == 1 then
return "{".. out[1] .."}"
end
return "{\n".. indent .. concat(out, ",\n" .. indent) .."\n".. rep("\t", lvl - 1) .."}"
end
function table.Print(tbl)
print(table.ToPlain(tbl))
end
PrintTable = table.Print
PrintTable(table)
ow shit this a new util u wrote?
thnx man 🙂
your timer mod is always part of my mods
lol
The mod im trying to do now is the narcan
A nasal spray that wakes up players from heroin effect
The heroin effect makes the player unable to move
So i just need the item to re enable em to move
My approach is using moddata
Like once a specific moddata is detected on tick then player wakes up
I think my code is just too messy atm which is why it wouldn't work lol
Recursively print all table values in a table after making sure things are tables?
yup
I feel like everyone makes one of those eventually lol
Nice
lol word I did not make a recursive one yet I'm lame I guess.
Mine just boringly shows the one table I am looking at
Also depends on my knowing it's a table
I've made at least two
I forget what the second was for half but it parsed every other entry
There was a community project that fell through
It was supposed to be a community API
Kind of wish there was a GitHub repo to add changes to game Lua files
Strictly for moddability + more utility
That would be sooo useful TBH
...maybe some more up-to-date docs too on where to find different functions, what shizz does, etc.. more updated item list... lolz
...I had to manuallt use debug mode to get base names for a third of the jewelery for example, because things like bellybutton rings aren't in the existing wiki >.>
I don't mind doing the work, but it would be nice if there was a simple way to share that info I gather with others that might eventually use it. I have zero clue how to update the wiki personally, soo... ;-;
@true vault try: https://github.com/Konijima/PZ-Libraries
Would let you ctrl+shift+f through files
That'd be more for java exposure stuff
For script files you can just add the base game's media folder as a project
Should work out of the box to look stuff up
I have the media folder as a library
I.. kinda do that already (I only make script and recipe edits still), and although searching is way easier now, I would still love a listing of the various functions and what they do/where they are lolz l.. Or maybe more of an abstract on how the game accomplishes various things.
is there any good hearing aid mods that work in mp
I need a good name for my utility mod that adds the mod's name for print()
I'm thinking 'fingerPrint'
Lovely mod community of PZ
I propose an idea...
Someone make a mod that replaces the Zombies with bugs from Starship Troopers
Thank you friends 🙂
How much are you paying?
I can make the models. Beyond that I am kinda hopeless haah
than again replacing the meshes probably isnt very hard
Is there any way to manipulate the transparency of an entire .png you draw into the game somehow? (As ISImage, as an element of an ISPanel, anything?)
Great question lol
Dunno what mods are goin for these days
lol (almost*) never what they're worth
Probably true
is PZ ever planning on giving proper documentation for mod makers? I am going trough any docs I can find but most of the mare either outdated or unfinished.
I am really new to modding in general and this is making it exceptionally hard to get anything working
B41.78 blew up all the mods
I mean it's a fundamental issue of trying to pay for something like this. A mod < a game, so most people think "mod cheaper than game", but making a mod takes a lot of time for an individual, so the transaction is sort of inherently unbalanced.
And it also ruins a few gun mod
What about .78 blew up guns mods? The texture changes?
Just the coding’s
What broke in the gun mod?
also could I ask. Items have a WorldStaticModel. which pulls the model from models or modelx_X right?
how do I define the texture for the model?
it pulls from the model script
scripts/models_items.txt
yes yes
does the file have to be named models_items or can I name it something else?
But for anyone who thinks they'd like to take it on, I am decently serious about the starship troopers bug mod idea
Open to discussing what it'd take
you can name it whatever you want - as long as it's the media/scripts/ folder within your mod
and follows the same formatting obviously
same applies to any script.txt
You can also use Lua to handle scripts
but it's a bit more work that way - and only suitable if you're trying to do something specific
Well at the moment I am just trying to create an item.
Than I want to make the item attachable to a vehicle
and than I want to give it functionality
uh
vehicle stuff is a bit out of my wheelhouse - as the scripts for cars are alot more nuanced
yeah Ive noticed
but there's a few car attachment mods you can pick apart
I treid that but many they are so confusing I could never wrap my head around it
I imagine there's going to be scripts for the item, with models on the floor - then there's model for being on the car
yeah thats kinda what I am hoping for
afaik PZ doesn't support orientation changes along x/y for it's model scripts - only rotations
I could be wrong
the things that will actually be difficult is adding a new attachment slot for a vehicle and giving it the functionality
I repurposed the on floor models to act as in-hand for a mod that makes alot of random junk weapons - and I couldn't get it to be offset to look better
hopefully I can figure that out
That stuff should be available in those mods for car armor and bags on top
yeah it is. I just dont understand it hhaha
but hey. custom item done, custom on ground mesh is done
so at least I am getting some kind of knowledge
👍
Hello everyone! Is there any official modding guides?
this one is my favourite
https://github.com/FWolfe/Zomboid-Modding-Guide
okay so I am trying to understand how vehicle parts work. I know the vehicle file uses templates for all its parts like template Tire.
But I dont understand how those files define the item that that car part is associated with
For example tire has : "itemType = Base.OldTire;Base.NormalTire;Base.ModernTire," where are these items stored in? I cant find it anywhere
oh nvm
I am stupid
they are in the vehiclesitems.txt
