#mod_development
1 messages ยท Page 321 of 1
yeah exactly. that's why i was wondering if there was a better way to do it. unfortunately i don't think they'll be adding an api for this anytime soon though.
I wanna share with you a good one among steam workshop comments: this guy doesnt care for his subscribers hes not adding it to b42
Oh you monster
Have you not dedicated your life to keeping every mod you ever made up to date with every new patch???!?
I love it when people treat use like full time employed devs
Hey sorry I really want to know what this means ๐
slr also sorry i thought you can change just about any sprite
but i only have this
getPlayer():getPrimaryHandItem():setWeaponSprite('Katana')
this works
but its for weapons
Oh hmm I mean that actually is very interesting, because it accepts 3d models as sprites right? It's the same as just changing the WeaponSprite param in the item script?
Because if so I could just make another sprite where the wheels are rotated slightly and then just swap between them, as long as there's no lag or jitter etc of course
i think its WeaponSprite
Ah sick, thank you! I never thought of trying to just cycle the sprite!
that could probably work. with 2 tyre positions, on 2 identical bikes
it could be matched to the animation via changesprite bool/trigger?
I was gonna try to play around with the AnimationPlayer because I saw it's involved in the dancing doors debug thing. So it must have a way to access the doors where the meshes are animated separately and somehow triggers their open/close animations
declaration: package: zombie.core.skinnedmodel.animation, class: AnimationPlayer
Yeah I think it should be possible!
either option seems do-able for the most part atm
I could also use this as a method to spray paint the bike, just call the setWeaponSprite and change it to a different one that uses a different texture
yeah you just have to keep on changing the sprite as well as the players stance so that it looks its pedaling
and I suggest change the shove too
oooh i havent used this
pls do share what you discover in the future
Yes will do!
yeah you would have to make a table
and the sprite would be the key and the value would be a list of other sprites you loop for the animation
btw i dont the sprite change is synced so you have to test
also you have to reset model next frame for it to render
Ah nice, thank you! I appreciate the tips, these are the kind of things you can end up banging your head against for a while ๐
feel free to dm me if you need help with this i mostly do animation mods
Thank you, appreciate it!
Your conversation made me chuckle. One of my early planned character "missions" is to go have a drink.
me when I have a drink at the (rooms)
Is there a channel/thread for collaboration requests that I've missed? Like somewhere people go look to work on mods together?
#1075939080287834113 is remarkably quiet so I'd say use that to ask or offer ...
Ah nice, I'll give it a shot!
Added right mouse steering to the bike, no more zig-zagging on diagonal roads!
50$ from steam
steamcommunity.com/828264435840
How does this work, is the bike a part of the player's outfit?
Yes kind of, it's technically a container, but it has a clothing item xml that tells it to attach to the Prop2 bone which is the bone that animates the item equipped in left hand when I run my custom animation.
It's equipped in both hands like a weapon/item rather than equipped in a clothing slot
<@&671452400221159444>
(In case it wasn't obvious: spam link, don't click)
Does this method support extra bones? I mean to be able to animate the wheels and pedals?
As it is, no, but there is some way to do it since TIS has a few objects in the game where one part of the mesh is animated separately from another part.
I've been looking into how to trigger/set up those kind of animations, but it's very tricky and I'm probably gonna have to decompile the java to see if it's even a possibility to apply it to my item
why not have the same as car controls
where there's a turn rate, instead of turning instantly
then you can have smooth driving + be able to look around too
and shoot a handgun maybe
It's just a lot more difficult to work with the vehicle system. I can still make a bigger turn radius by implementing more animations, with my method everything is controlled by the animations. So if I want to add acceleration I just do it in the animation.
I can also make it possible to go in one direction but look in a different one, I'm just gonna have to be smart with how I disable/restrict the movement
ah oke
and then I steal a car battery, attach it to the bike and I get an e-bike
?
oh nvm car batteries are 12V
that's not enough
They are if the motors are designed for a 12V supply - car batteries cat put out a lot of power.
that would be a pretty weak bike tho I think
like all the bikes I've seen are 36V or more
Voltage is one part of how much power an electrical system has, it's just an easy one to market.
How many amps?
I know how voltage and amps works
it's still relevant
like obviously you can't run an e-bike on 5 volts
or it would be weak af
you can't just have infinite amps
Not with motors designed for 36. But you can design motors for 12V.
yes but they are weaker motors than 36 volt motors
You can get 12V vehicles with 2HP motors; around ~1500watts.
I mean I've never seen that stuff
so I imagine it must be weaker or have some kind of big drawback
There will be a huge list of tradeoffs being made, including cost. But you can't dismiss things as being weaker just because the voltage is lower.
either way, most bikes are overwhelmingly above 12V so this doesn't even matter, you wouldn't be able to use a 12V battery for e-bikes becaus you would never find a 12V motorized wheel
I mean
Especailly when you're talking about a car battery, which is massive (compare dto ebike batteries) and heavy and has a peak current able to get a car engine turning over.
If you wanted to, yes.
But the marketing would fail even if they were better because "lower number!"
I mean
I studied engineering and was shown some motor tech sheets
but I was never explained like how they design them and like if there's drawbacks to voltages and stuff
but like
You see the same thing in powertools - a race to boast more volts in battery packs while wrting wattage and whattHours in tiny writing somewhere.
I feel like if every motor goes for a higher voltage surely it must be significantly better
I don't think engineers are stupid enough to ignore a good solution just because it's a smaller number so it's hard to market
If that was teh case why are they not using 72V? They just need to recondigre the way teh cells are connected in teh battery packs.
I'm not saying more voltage is purely better
Engineers don't get the final say.
but surely running less amps through a wire is more efficient
Back to what was being discussed - a car battery will easily move a small electric vehicle though if you have 36V motors you'll need to step up the voltage. Or just use three car batteries.
like in a resistance
P = I^2 * R
so like
more amps means more power loss
surely that's awful with 12 volts
And unless you want to add more variety with a mod, have "battery" abd "car battery"
fast burn, more torque,
or slow burn, longer range, lower speed
in simple terms
where "battery" is everything from an AA to a 9V to lantern battery.
https://steamcommunity.com/sharedfiles/filedetails/?id=3461995683 uploaded my first mod with a java component.
I think it would be better to just add a "bike battery" at that point
just to program the chargers to work on it
I mean you could have lithium cells and like assemble it manually DIY
but that sounds like hell lmao
FAQ
Q: What voltage is a bike batery?
A: Yes.
Especially in the 90s!
yeah
And modern electronics uses a lot less power as well.
ehh
Same with thinsg like LED lights.
Less power to do the same thing... which is lost by making our devices do 1000 times more lol
I dunno if that's true
like
software has definitely gotten way way more wasteful of system ressources
for the same operations
If you built a phone with 1990s capabilities you'd be able to get insane battery life nowdays - but that means voice calls, text SMS and if you're lucky snake.
you could make it a lot smaller.
mobiles got pretty small, before the iPhone and big screens became a thing.
local room = NarratedClues.WorldFinder.getLiqourCabinetByDistance(
filterByName: "wellStockedLiquorCabinet",
from: "jimbeamdiablo",
minDistance: "1",
maxDistance: "1.2"...
my wife just looked at my screen and saw vscode open and said "you're an addict" as she was walking to the living room to watch the 100th episode of Gossip Girl this week
Don't hate. I watched about 30 episodes of Dexter over the weekend. Hahaa.
nope, no hate. just irony ๐ and I remember binge watching Dexter. it's a good show!
Oh yeahhh! I love it hahaa. At least until season 5. Then it's 50/50 after that for me.
5 was okish but you could really feel the wheels starting to come off the rails
in Kentucky the Men Wear Dresses too
Aha~i found out a interesting bug @thin swan
Wait, you didnt parent it to Right prop bone?
Oh haha, yeah I intend to change the animation so that instead of shouting, you ring a bell ๐
The left prop bone, I just picked one at random really
looks good
i have a suggestion to improve it
try and add micro sways
when pedal left goes down sway right side tilts higher supposed to be
this small change will significantly increase the animations realism i swear
Yeah I have it on the slow pedal animation, I just forgot to add it for the fast pedal ๐
oooh theres a wall bump xml
might want to play with that too
perhaps make it dismount that will be sick !
mod idea for you modders!!
what if the more zoomed in you are while aiming down you get an accuracy bonus when shooting with the gun #pz_b42_chat message
starting to get bloated. here we go again
ASS utils, must be important!
very much so, and really I thought more people would find a use for it

I'd like to delay this by 14 seconds: if TotalSoundRadius >= 1000 then traits:add("HardOfHearing") getSoundManager():PlaySound("Tinnitus", false, 0.5); print("Trait added: HardOfHearing") end How can I add such a timer to my script?
to clarify, I wanna delay the adding of the trait
so that the audio can finish playing first
why are there so many advertisment trailers lol
function tinyTimer(seconds)
local OnTick
local start = os.time()
local stop = start + seconds
OnTick = function()
if os.time() < stop then
return
end
-- add trait here
Events.OnTick.Remove(OnTick)
end
Events.OnTick.Add(OnTick)
end```
This should get you started. might want to make it local. You call it with: tinyTimer(14)
does anyone know why the trunk on my vehicle wouldnt be working?
im trying to figure it out but im at a loss at this point
Ty bro. I'll integrate it into my script rn and test it
Well hot damn, skateboard just hit 10k subs ๐คฏ
Timer worked perfectly
Just my sound isnt playing lol. Havent figured that part out yet
ty @queen oasis
Make sure you're not in godmode if you're using the emitter to play it
been there, done that, gave me a headache
Hey i know i asked this a bit before, but i still havnt figured it out. Can anyone tell me how to make a world item with a light effect? I dont want to actually have to spawn an IsoLight for it manually, its just a marker, and i want it to be visible even in the dark. ๐
like it's highlighted?
You mean with the outline? No, no need for that. Just glowing around is ok for me. Heck, it doesnt even have to light up the surroundings, also that would be nice, but as long as the item is perfectly visible even during the night im fine with it.
Its meant to be a marker/beacon to be seen, so ofc id like it to be alight so it wont be overlooked in the dark.
I feel like there's probably a way to do it using tile properties
Ive read something about a 'light is on texture' but coudnt quite find what thats meant to be.
Yeah i was thinking about those too, but when i use light in the properties, it doesnt light, so im stuck on that end too.
world markers maybe? It adds a little highlight circle/arrow/whatever on the square
Huh? didnt know something like that even existed, and while it sounds interesting, not quite what i was going for. I have a... picture? tile? for the worldobject i want to use.
An old statue, meant to mark a location.
So once you see it you know youre in the right place. ^^
maybe setOutlineHighlight() ?
https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/iso/IsoObject.html#setOutlineHighlight(boolean)
declaration: package: zombie.iso, class: IsoObject
Sound works ๐
hell yea
but I think my tinnitus sound effect is too high pitched
Might hurt peoples eardums. I can feel it in my ears when it plays lmao
you should hear the tinnitus in my ear
Here's the functions of my mod so far, lmk if yall think I should do more or change something: -- Shooting a gun tracks the weapon's sound radius and adds it to totalSoundRadius -- Aiming level reduces latest radius number by 5% per level -- Wearing Ear Protection negates the latest gunshot radius completely -- When the totalSoundRadius number hits the threshold, hard of hearing is added -- Tinnitus sfx plays the first time you get HOH -- Deaf is added when the number continues to climb after HOH is obtained. It lasts 3 hours -- Not shooting, or shooting with ear protection, reduces totalSoundRadius
Thx, interesting idea, but if i go the lua route then i could also spawn an iso light on it. But that would require event listeners and stuff that i coudnt just remove since id need to remove the source too once the item is removed.
Id prefer to use no lua scripts in relation to the marker if possible. Ofc if i cant, ill still go that route, but id avoid that if possible.
Sounds interesting and makes it more real. Guns are freaking loud. But id check on the weapon noise level too, since you want it to be compatible with other mods (i guess) and there are weapons with silencers out there.
Alr, I'll do that
Lemme check Rain's firearms and other mods with silencers and see how they alter things
compatability with supressor mods will be easy. Wont have to change much
Now what do you guys think the threshold for getting hard of hearing should be? The average gun radius is over 100 so maybe 500 shots? (50,000 total radius)
or should I add an element of randomness
I think maybe I'll make it like a 5% chance every 150 shots or so by default and allow players to change that number in sandbox
Since everyones hearing is different, randomness isnt wrong. Also i just remember, isnt there a positive hearing perk? In that case i think it should negative impact the one owning it, no? ๐
Yeah, it removes keen hearing. Its gonna be a very punishing mod lmao
But I did make deaf only last a few hours so not too punishing
Hard of Hearing is permanent until I start working on updating the Hearing Aid mod from B41 (they gave me permission)
Is there a 'bad hearing' perk? Because accumulating noise wont do as much impact as say, staying besides a mortar while it fires without protection.
I mean I could create my own trait.. but hard of hearing and deaf already exist so I dont wanna lol
ah, hard of hearing was what i meant, so something between deaf and normal
oh, yea
I don't feel like negative perks are that interesting because my criteria for picking bad perks is just "is it free to take" and if not then I don't xd
I wish there were more positive perks, especially with the "trait purchase shop" mod
I love that mod
I'm too lazy to learn zomboid modding so instead all I would ever do is dump a bunch of ideas xd
I'm having trouble figuring this one out. It works fine for Base.Logs. I'm sure I'm overlooking something.
local twigs = { "Base.LargeBranch", "Base.Sapling", "Base.TreeBranch2", "Base.Twigs", "Base.Splinters" }
for i = 0, wobs:size() - 1 do
local o = wobs:get(i)
if instanceof(o, "IsoWorldInventoryObject") then
local fullType = o:getItem():getFullType()
print(fullType) -- finds and prints out twig and branch names like a bawse
if fullType == "Base.Log" then
clickedFlags.logs = true
elseif fullType == "Base.Plank" then
clickedFlags.plank = true
elseif twigs[fullType] then
clickedFlags.twig = true -- doesn't find any damn twigs
end
end
end
Might be wrong, but i think ive read somewhere that lua tables start with 1? Again, correct me if im wrong, but get(i -> 0) should trhow an error? Or what problem do you have?
that's not a lua table, they don't have a get()
it prints the full type fine but it just won't work with the elseif twigs[fullType] then
for _, twig in pairs(twigs) do
if twig == fullType then
clickedFlags.twig = true
end
end
that works. maybe I should just check if twigs[fullType] ~= nil
oh i see
twigs[fullType] looks for an entry in the table with the key fullType, but the types are values
the keys are just 1, 2, 3 etc
do```lua
local twigs = {
["Base.LargeBranch"] = true,
...
}
if you have a Tinnitus sound effect it would be a shame to only use it once... have it just randomly play occasionally when things are quiet. (probably with a "tinnitus " moodle so players know what is happening and don't think it' a sound effect bug.)
Bonus mean points: if it's active it lowers sleep quality.
Rain's suppressors adjust the weapon's soundRadius and soundVolume, so you won't have to do anything to support them unless you're using the weapon's script's sound radius for some reason (which is unlikely)
Take an idea for a perk and break it down into specific game effects; things that can actually be coded (e.g.: "increase hit chance with handguns by 10%, reduce handgun reload speed by 25% and reduce time to equip a handgun by 50%" instead of "make player better with pistols like a gunslinger")
Once you have that we can help you work out what code you need to make. (or tell you that it's in the java so not viable ๐ฆ )
The super simple starting point is make a mod that adds a trait that doesn't actually do anything. Then you starting adding little "if player has trait X do something" to the code at the relevant places.
I thought about that. I'll see if I can add a smaller, shorter version of the ringing sound to play at various times
On the topic of perks. You woudnt know a way to make a perk go over level 10? ๐ฅน
Perks don't have levels - you either have them or you don't. Do you mean skills?
skills, yeah sorry, since nimble is in the perkfactory and i was using perk... well there is that. XD
Lua tables are a whole bunch of confusing, but in this case wobs starts from 0 because it's an ArrayList returned from a function call to Java, and you get element X with wobs:get(X).
I'm not sure about skills over 10 - I've never looked at the code. I think there was a mod that let skills go over 10, bit it's also possible someone was talking about it and hadn't actually done any coding work yet.
Oh, ok i guess ill look if someone has an example mod out there for me then
It's possible the java side of thing will say "sorry, skill maxed" but even if it does you could have a mod that tracks extra levels and intercepts calls to check skill level (so if you have shooting level 10 + ShootingExtraLevels 2 when you say "give me the player's shooting skill" your code says "hold up, make that 12 before you return it")
...and then you probably break a lot of things that were not written for skills over 10. The other way woudl be wherever the skill being over 10 matters, you add code to use the skill+extra levels.
Ah, no i was hoping of dirty hacking the movement restriction and pump the level of nimble over 10, since thats would be the only way to make the speedscale for strafe higher then 1.2. ... Is it weird that i know things like that already but struggle with tables? ๐ค
No, I'm, pretty sure everyone struggles with tables in LUA when they start.
Because they get used in so any hackish ways.
Pro: Flexible. Con: AAAAAAAAARGHH WHAT THE $%^$@# IS HAPPENING HERE!
Honestly, creating an array in C when you had to manually code accessing the correct memory offset with no safety rails was easier to get my head around than lua tables.
Hmmm, one has to love reddit. So someone asks: is there a mod to uncapp skill levels -> and evereyone and their dog comes and tells him how bad an idea that is since grinding to 10 takes forever. XD
Its a whole different topic from his question, no?
See, you seem to expect common sense from reddit. That's your first mistake.
Are there any guides on how to make sandbox options?
not exactly tutorial, but gives you a start
Thats good enough, ty
create a custom version call it Advance Nimble or something
create a custom lua event that triggers whenever you gain nimble xp
create the events function that transfer that xp to the nimble2 only if vanilla nimble is maxed
(you might not need to create custom event, but im just throwing ideas)
Uhm, but java is using the vanilla nimble perk to modify the speed scale, everything else is hardcapped there, so how would a second nimble help with that? Dont quite follow, but then again, you wrote a comment about how you could use a second set of animation xml to speed up and i didnt get that either, since im still not getting it working too. XD
PZ modding honestly starts to make me doubt myself on multple fronts. ๐
Here thats the one i was playing around with, but since i dont quite understand how those files work, no dice on that front too. ^^
@craggy nacelle Have you tried getPlayer():setPerkLevelDebug(Perks.Nimble,20) just to see what happens?
will become 10 iirc
if I want the animation to be endless, but the beginning of the animation was different from the middle and the end, then I need 2 animations, 1 for the beginning of the animation with the PerformingAction condition, and the second animation for the middle and end of the animation, right? Also, please tell me what conditions there are for animations or where I can see them
Is the ISDropItemAction multiplayer compatible ?
Working on the enclosed trailer again, still have no clue why it isnโt letting me access the trunk
Are you using standard part names for the trunk, and what acess function are you using?
yeah all the part names are copy/pasted from vanilla acripts
Anyone know if there is a certain way Body Locations have to be named? are they case sensitive in anyway? I added one and now I'm getting a world dictionary error with a new world
Did you create that body location to begin with? Or added one to clothing item, but no lua
I setup the Lua however my best guess is because I did EXOSuit instead of Exosuit, I've noticed every other body location is named with only the first letter capitalized
I don't think it should cause issues as long as lua one and script one are the same
that's what I thought as well but I've tried everything else I can think of, gonna mess with it some more before I head to bed, I'll try again tomorrow if I don't figure it out
Can you show your script and lua file?
actually yeah, that isn't the issue some have multiple capitals
yeah one sec
how do I do code blocks again?
I can never remember
For B42 (b41 has some difference in animsets) it depends a bit on the animation, because you could just make one long animation that has a different beginning, middle and end, and then just set that to loop.
If you need each part of the animation to trigger something in another animation or in Lua, like for example when you begin the animation it sets a variable to true which you're listening for in your Lua, and trigger a sound and spawns an object. Then when the animation ends it sets the variable to false which stops the sound and despawns the object. Then it's best to split it into two yes, or maybe even three, beginning, middle, end, if you need more control.
thank you
I'm not sure there's a list of known conditions, but you can make your conditions by using player:setVariable("YourCondition", "Your Value") , the value can be string, float, enum, or boolean. In your animset .xml you'd be able to get this variable by using <m_Conditions> <m_Name>YourCondition</m_Name> <m_Type>STRING</m_Type> <m_Value>Your Value</m_Value> </m_Conditions>
It can convert from string < > boolean, so if you do "true" it can still be found using m_Type BOOL.
If you need to get this variable in Lua you use the getter for that type, so for this one you'd use player:getVariableString("YourCondition")
You can see all the getters here
There are other variables set by the vanilla code that you can use as well, like <m_Conditions> <m_Name>PerformingAction</m_Name> <m_Type>STRING</m_Type> <m_StringValue>EquipItem</m_StringValue> </m_Conditions>
Or <m_Conditions> <m_Name>isMoving</m_Name> <m_Type>BOOL</m_Type> <m_Value>true</m_Value> </m_Conditions>
If you want to see which condition is triggered when, open anim viewer in debug mode and just leave variables ticked in, you can see which ones change and then use those in your custom animsets.
declaration: package: zombie.core.skinnedmodel.advancedanimation, interface: IAnimationVariableSource
that didn't work I might have done it wrong
It's the backtick, ` this one, I think you're using this one '
oh yeah, it's the tilde key isn't it
I have EU QWERTY layout and it's shift and then the key next to backspace for me
module Base
{
imports {
Base
}
item EXO_Suit
{
Type = Clothing,
DisplayName = Exoskeleton Suit w/ Vest,
ClothingItem = EXO_Suit,
BodyLocation = Exosuit,
Weight = 12,
Icon = EXO_Suit,
BloodLocation = ShirtNoSleeves;Trousers;Neck;Shoes,
RunSpeedModifier = 0.93,
CombatSpeedModifier = 0.95,
Insulation = 0.65,
WindResistance = 0.30,
BiteDefense = 130,
ScratchDefense = 130,
BulletDefense = 130,
NeckProtectionModifier = 0.5,
Tooltip = Tooltip_Exoskeleton,
ClothingItemExtra = EXO_Suit_ON,
ClothingItemExtraOption = EXO_Suit_ON,
clothingExtraSubmenu = EXO_Suit_Back,
CanHaveHoles = false,
WorldStaticModel= W_EXO_Suit,
}
item EXO_Suit_ON
{
Type = Clothing,
DisplayName = Exoskeleton Suit,
ClothingItem = EXO_Suit_ON,
BodyLocation = Exosuit,
Weight = 12,
Icon = EXO_Suit,
BloodLocation = ShirtNoSleeves;Trousers;Neck;Shoes,
RunSpeedModifier = 0.93,
CombatSpeedModifier = 0.95,
Insulation = 0.65,
WindResistance = 0.30,
BiteDefense = 150,
ScratchDefense = 150,
BulletDefense = 150,
NeckProtectionModifier = 0.5,
Tooltip = Tooltip_Exoskeleton,
ClothingItemExtra = EXO_Suit,
ClothingItemExtraOption = EXO_Suit,
clothingExtraSubmenu = EXO_Suit_ON,
CanHaveHoles = false,
WorldStaticModel= W_EXO_Suit,
}
}
theres the item script it's brita's exo suits that I'm trying to make functional
local group = BodyLocations.getGroup("Human")
:getOrCreateLocation("Exosuit")
there's the BodyLocations.lua
Oh
I forgot a _ in a recipe for EXO_Suit_ON and instead typed EXO_SuitON
that would probably do it huh
that was 2 hours of time and such an easy solutoin if that's all it was, odd though considering I could of sworn I changed that before this issue started and it worked fine but maybe I just wasn't paying attention
@thin swan Thank you very much for the detailed explanation, please tell me, using conditions, can I start another animation right after this one, or do I need to handle all this through lua and the onTick event with a condition check?
I am creating my animation and I want to divide it into 3 stages as you suggested
You can use conditions to trigger transitions! It's honestly a pretty good system once you get used to it.
All you need is something like this:
<m_Transitions>
<m_Target>nameOfOtherAnim</m_Target>
<m_AnimName>Bob_NameOfTransition_Anim</m_AnimName>
<m_blendInTime>0.50</m_blendInTime>
<m_blendOutTime>0.50</m_blendInTime>
<m_SpeedScale>1.00</m_blendInTime>
<m_Conditions>
<m_Name>YourCondition</m_Name>
<m_Type>BOOL</m_Type>
<m_Value>true</m_Value>
</m_Conditions>
</m_Transitions>
This means that when your condition changes from false to true, it will transition to another anim, and it will use the animation set in AnimName to use while transitioning (can also be left empty to not use a transition animation).
The blendTimes and speedscale can be skipped if you're not using a transition animation
You can also set variables inside your animset xml, and have them set at different parts of the animation.
For example:
<m_Events>
<m_EventName>SetVariable</m_EventName>
<m_Time>Start</m_Time>
<m_ParameterValue>YourCondition=true</m_ParameterValue>
</m_Events>
This will set your condition to true when that animation starts
thanks, I'll try it now!
@thin swan Please tell me what's wrong with this animation file?:
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>StartPhase</m_Name>
<m_AnimName>StartPhase</m_AnimName>
<m_Looped>false</m_Looped>
<m_SpeedScale>1.00</m_SpeedScale>
<m_BlendTime>0.20</m_BlendTime>
<m_Events>
<m_EventName>SetVariable</m_EventName>
<m_Time>End</m_Time>
<m_ParameterValue>OnFirstPartFinished=true</m_ParameterValue>
</m_Events>
<m_Transitions>
<m_Target>MediumPhase</m_Target>
<m_AnimName>Bob_MediumPhase</m_AnimName>
<m_Conditions>
<m_Name>OnFirstPartFinished</m_Name>
<m_Type>BOOL</m_Type>
<m_Value>true</m_Value>
</m_Conditions>
</m_Transitions>
</animNode>
<animNode>
<m_Name>MediumPhase</m_Name>
<m_AnimName>MediumPhase</m_AnimName>
<m_Looped>false</m_Looped>
<m_SpeedScale>1.00</m_SpeedScale>
<m_BlendTime>0.60</m_BlendTime>
<m_Conditions>
<m_Name>OnFirstPartFinished</m_Name>
<m_Type>BOOL</m_Type>
<m_Value>true</m_Value>
</m_Conditions>
</animNode>
You should only have one animNode per xml file, the MediumPhase would go in a separate one
If you're on B42 then you have to also place any custom animset in .\YourMod\media\AnimSets, but the files can be blank for these, they just have to have the same name as the xml files in your b42\media\AnimSets folder.
There's a bug causing the game to look for xml files in the b41 folder, but when it finds a file it actually reads them from your b42\media\AnimSets folder if they have the same name.
I'm making a mod for B41 so I don't think that's the problem
I've noticed it also seems to help if you give your variables an inital value on game start, like this:
local initMyAnimVars = function()
local player = getSpecificPlayer(0)
player:setVariable("OnFirstPartFinished", false)
end
Events.OnGameStart.Add(initMyAnimVars);```
Ah, b41 works a bit different, so I'm not sure everything I've said will work there
Sorry, I probably should have said this earlier, please tell me how to do this for build 41?
now the start animation ends and that's it, there is no continuation
I'm afraid I'm not quite sure, I've only ever made animations for b42. I think the principles are the same, you set variables to trigger different stages, but I think the folder structure and naming conventions are different.
For example I have to put my player animations in 42\media\anims_X\Bob and the animation has to be prefixed with Bob_
Not sure if it's the same in B41
I'd say the best way to see would be to check how they handle the climbFence in vanilla, it's a multi-part animation, you should find the animsets here media\AnimSets\player\climbfence
thanks!
update on this, apparently I messed up and missed like 6 different underscores in different places within the recipe codes
why am I like this
ive been there lol
spent three days trying to figure out what was wrong with my mod and it was a single missing comma
done that one as well lol
I'm having trouble with the IsoPlayer:nullifyAiming function, could someone help me figure out how it works ?
Currently I'm trying to get results with the following code but I can still aim freely without any problems.
Events.OnTick.Add(function(tick)
getPlayer():nullifyAiming();
end)
I'm working on B42, I would like to stop the player from aiming when certain criteria are met, is it even possible ?
Yes, only gives lvl10, seems to be hardcapped somewhere. Thankyou anyway. ๐
@thin swan thanks for explaining those files that well, was exactly what i was looking for. Made a copy of it for a rainy day. ^^
what part of an item script does getType return? it would be base."this" right? or am I completely wrong
Should be the type as listed in Type = Container, or Type = Clothing,, or Type = Food, etc
Things that change the java type of the item to a different class derived from InventoryItem
getFullType() is what you want if you want the "Base.MyItem" thingy
Haha no problem! I'm planning on writing a full guide on how to make animations and connect everything in-game, but just need time to do it
you can do something like this if you want it triggered from the xml instead of the lua
<m_Transitions>
<m_Target>IdleRifle</m_Target>
<m_AnimName>Bob_AimToIdle_Rifle</m_AnimName>
<m_blendInTime>0.5</m_blendInTime>
<m_blendOutTime>0.5</m_blendOutTime>
<m_speedScale>1.3</m_speedScale>
</m_Transitions>
Transition calls the animation immediately after the current one right? Is this the correct option?:
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>FirstAnim</m_Name>
<m_AnimName>FirstAnim</m_AnimName>
<m_Looped>false</m_Looped>
<m_SpeedScale>1.00</m_SpeedScale>
<m_BlendTime>0.20</m_BlendTime>
<m_Transitions>
<m_Target>SecondAnim</m_Target>
<m_AnimName>Bob_SecondAnim</m_AnimName>
</m_Transitions>
</animNode>
-- second anim's xml
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>SecondAnim</m_Name>
<m_AnimName>SecondAnim</m_AnimName>
<m_Looped>false</m_Looped>
<m_SpeedScale>1.00</m_SpeedScale>
<m_BlendTime>0.60</m_BlendTime>
</animNode>
you can test by making an emote
i always test animations using emote or the idle
what do you mean about using emotes?
getPlayer():playEmote(' test')
<m_Conditions>
<m_Name>emote</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>test</m_StringValue>
</m_Conditions>
Working on adding a generic cheat-detection module for my anti-cheat. Hopefully that'll cast a broad net for common cheats, like enabling debug mode or forcing admin tools.
Can anyone point me where to look at the vanilla files for furniture like crates?
I found part of it in media/scripts/movables, but not the recipes
Like building them?
media\scripts\entities\furniture\entity_carpentry_crate_lvl1.txt
yup, gracias
I looked at a couple of other b42 mods that built containers, and they are quite a bit different
Depends on which ones you've seen. The recommended method is to use their new scripting method, like the one in that file
that's why I figured it was best to go to the source
Trying to make sandbox option for my mod but it's not creating a new page
I have the sandbox-options, I have the Sandbox_EN, and I tied it to my lua script. Am I missing anything?
that's all you need
if the option doesn't show up at all the issue is definitely something to do with your sandbox-options.txt
alr
Got that fixed. It was just my formatting of the script
plus one of my translations was off
Hello, I was wondering if it's possible to affect a playerObject from code/admin player client when they are not loaded in the admin's current area? Do I need to use a ping/pong server/client command to run the code from their client? Or can I say, adjust their getStats() from my end anywhere on the map?
Completely convulted question without context that I could probably word better..
But for example, can I run a getOnlinePlayers(), and then run through the index of that and to getStats():setPanic() for every online player from my current position, even if they are not loaded onto my screen? Or will that error out?
I'm wondering if this will run successfully when triggered from my admin client player using the function, or if I'll have to use a sendServerCommand() to every player to make it work.
thanks
I want to make a sonic model COS is there any way of reshaping the bones or changing their positions without breaking the entire game?
I don't want my sonic COS to be stretched
Making mods is so time consuming lol. Gotta test it every time I change something
But I'm nearly done
This mod makes my game load in about 3 seconds with full mods. Lmfaooo. https://steamcommunity.com/sharedfiles/filedetails/?id=3459875383
.
ยฟยฟยฟ
Is this mod actually safe? "Multi-Cpu Enhance FIXED" -> https://steamcommunity.com/sharedfiles/filedetails/?id=3459875383
Cause it looks too good to be true ๐
i tried it out
isnt really magic
but it does work and it is indeed safe
kinda messy to add but you'll manage to do it eventually
fought a horde with like 50 or 55 fps
Anyone know an easy way to move a container to a different square?
I tried container:setSquare(newSq) where container is the IsoWorldInventoryObject but it only seems to move the world object model, and not the actual container (InventoryContainer), so visually it looks like it moved, but to access the inventory of the container I have to go back to where it first was teleported from
If I'm making changes to a lua file for a mod that's actively loaded in a game, do I need to completely restart the game to reflect those changes in game? (i.e. does pz cache mod lua files?)
No you can just go to main menu and hit reload lua in the bottom right corner
thanks.
You can also hit F11 and use the lower right section to reload a single lua file BUT that doesn't clean out the existing "lua soup", it just runs the file again. It can be helpful, but often will have wierd side effects.
Downloadable RAM? Sounds genuine.
e.g.: if you attach a function to an event, reloading just hat lua file won't unattach it - the old function is still attached but now you've defined a new MyEventFunction and have no wayto reference teh old one.
it's just changes to the Java startup parameters. No idea how much they help.
You can unload it by reloading the file with some additional code.
use _G to store the old function and then check if not nil
Remove then Add
if you designed a file to be reloaded a lot it would be easy, but goingto main menu and hittting reload is easier lol
I've done both.
Unfortunately loading in an entire framework of dynamically-built code requires me to both reboot my server and recycle my client's connection.
For crafting recipes, I see mode:destroy and mode:keep what's the default? my assumption (dangerous I know) would be that destroy is by default and unnecessary, and keep is required if you want to keep something say a tool. but I'm looking at a cooking recipe in a mod and it was duplicating meat (long term preservation) when you tried to cure meat, and someone recommended mode:destroy, and that seems to work. confusing.
Safest to pretend if you don't specify keep or destroy the behavior is unspecified.
I think it's supposed to relate to the item type, but I also think it does not choose reliably.
has anyone created a mod featuring the Standard Infantry Rifle from World War Z?
slow firing semiautomatic rifle designed for accuracy and lack of jamming
You can easily make a rifle that is semiautomatic, slow firing and doesn't jam.
I like Rain's Firearm's lever action .44 Magnum rifle for that sort of role.
Is there a place where I can find all the bodylocations for wearable items? Working on a mod that adds extra clothes to the character creator but I can't really find what clothes correspond to which bodylocation.
open the error screen use the search box (its not obvious that its a search box) type the name of the lua
open it then hit reload
you can remove the event then add it again
shared/NPCs/BodyLocations.lua
its defined here
and on the actual clothings script
you can also create your own location
But you don't have an easy handle to the function, because MyEventFunction now points to the new MyEventFunction from running the file again. So you can't call Event.SomeEvent.Remove(MyEventFunction) to get rid of the old one.
thank you
There are ways around that, but if you're typing them up on the lua console it's easier to quit to menu -> reload lua
hmm i think you can transfer it onto your players inventory then transfer it on the ground
code is quick enough so you wont notice it wento inside your inventory
i dont know why but this is the way vanilla did it
anyone know how I can make a clothing item increase run speed? preferably through lua
is this an inventory object placed in the world or an IsoObject?
I have a rough idea I'm just not good at typing it out without some kind of guide
atleast not yet
check out tchernobils speed framework
Same way you make it decrease speed, but give it a value over 1.0
but... that won't get your character over 1.0 speed
Which is probably good, because the code has a few "If speedModifier =1.0" type checks to see if you're at sfull speed, and they won't work if your speed modifier is 1.1
I'll check that out.
and yeah @silent zealot I'm hoping there's a way around it as I want to make the exosuits from stalker and brita's make you faster
worst case I'll just try and make it revert back to as if you didn't have a backpack and clothes lowering your speed
I feel they should make you slower but tougher with no endurance loss for jogging/sprinting, but if you want to boost speed.. the speed framework Glytch3r mentioned woudl be good to check out.
I can see that, but I know irl the suits being made now can increase your speed
it's really cool
Fallout power armor works on videogame logic, not real world personal exoskeletion physics ๐
yeah, the whole reason I wanted to do this was because of a video uploaded by Silo Entertainment, he bought exo skeleton legs for airsoft and it made him a lot faster, the military is doing similar things as well
Fair enough.
but fallout power armor definitely works a little differently, I also use the power armor mod made by EtherealShigure
If the speed framework makes it easy to do so, make it a sandbox setting.
That way you make it with the defaults that you think are best, and everyone else adjusts to taste.
I also do this because it's easier than figuring out a balanced value.
"I dunno, 2 feels good... but set it anything from 0 to 100 I'm not the fun police"
I probably won't be releasing this one public as it'll be a modification to an already released functional exoskeletons mod, but if I ever do choose to and I get permission I'll do that for sure
Ethereal is active here, so easy to ask about permissions for public release.
well this ones not their mod, it's this one I'm using for this specifcally https://steamcommunity.com/sharedfiles/filedetails/?id=2924374398&searchtext=functional+exo
and they seem to not be responsive in comments
it does everything I want it to except speed you up
I'll also be making it make you slowly lose endurance instead of not at all
Pretty sure that author will be OK with a patch mod being uploaded given they uploaded this:
probably lol, and I'm not reuploading the entire mod, just the files that I need to change to add compatibility for the brita exoskeletons and file needed for runspeed
Actually that exoskeleton mod is a patch mod too. lol
yeah, I just don't know if they asked for permission from the original author or not
Yeah, you can mod mods the same way you mod vanilla.
Just have your mod loaded after the original
exactly, I'll just be overwriting what I need to
actually might not be able to add compatibility with brita's as easily as I thought so that'll be for another day
Or to be more concise: Mods modders mod modify modder's mods.
pretty much lol
Remember you don't have to replace entire files, or even entire item definitions.
wait is there a way to replace specific functions?
DoParam() lets you adjust an items stats one line at a time. And for lua you want your file to have a unique name, and just touch the functions you want to change; prefix/post patches where those are viable, then replace speciic functions entirely
yes. Make a lua file with a new name, put require "path/to/OriginaLuaFile" at the top
sweet and the path would just be media/lua/client/file right?
Then you can wrap code around a function like:
NepOG_someFunction=FunctionToReplace
function FunctionToRepalce(arg1, arg2)
<do stuff>
local retvalue = NepOG_someFunction(arg1, arg2)
<do stuff>
return retvalue
end
(if there is no return value you can skip that)
you actually drop the media/lua/[client|shared|server]/ bit of the path
okay, I'll definitely do it that way, and just import my new function and anything I replace that way instead
okay so just the luafilename.lua then?
So ProjectZomboid\media\lua\client\Camping\CCampfireSystem.lua would be require "Camping\CCampfireSystem" (no .lua in the require)
okay perfect, I'm gonna be using that system a lot more from now on
Syntax will be a bit confusing if the function name is part of an object.
Tip: SortOfAnObject:SomeFunction(arg1, arg2) is shorthand for SortOfAnObject.SomeFunction(self, arg1, arg2)
I'm gonna be honest I'm so new to lua, I have no idea how to read what you just typed lol
And I've have best results be keeping the renamed original in the same object
eg: ```lua
SortOfAnObject.NepOG_SomeFunction=SortOfAnObject.SomeFunction
SortOfAnObject:SomeFunction(arg1)
<prefix stuff>
SortOfAnObject:NepOG_SomeFunction(arg1)
Mpostfix stuff>
end
I can read code when it's written with item names and everything well enough to understand what it does but when it's written with examples it break me lol
how about:
ISMicrowaveUI.NepOG_addKnobValues = ISMicrowaveUI.addKnobValues
function ISMicrowaveUI:addKnobValues()
ISMicrowaveUI.NepOG_addKnobValues()
self.timerKnob:addValue(306, 120);
end
Now your microwaves has a 2 hour option.
that one I can understand mostly, the 120 would be the hours
Original function looks like:
okay yeah I get that one now
the args are "degrees around the dial" and "minutes" in this case.
yeah the moment actual words are written in like microwave and knob values I can piece it together well enough for trial and error to work
youc an also replace an entire function just by rewriting it:
function ISMicrowaveUI:addKnobValues()
self.tempKnob:addValue(0, 90);
[...]
self.timerKnob:addValue(270, 45);
self.timerKnob:addValue(288, 60);
self.timerKnob:addValue(306, 120);
end
I gotta learn how to read examples like these for sure though
But if you do that and the original function is updated, your mod replaced that update
And if two mods do that to the same function they overwrite each other
yeah I'd rather just import it directly instead of replacing entirely
seems way more compatible
Sometimes there is no practical way to do that, so you just replace a function and accept you may need to update the mod when the game updates... which for zomboid may never happen for anything that isn't part of what they are working on.
Yeah, sometimes it's unavoidable I know that with the other stuff I've worked on
it says to "call the code" how would I do that in the new function?
would it just be by typing that into it instead of just setplayerspeed(player, speedmodifier)
Likely SpeedFramework is a global table, so you can just do
SpeedFramework.SetPlayerSpeed(playerObject, 1.2)
or whatever the units are it used for speedModifier
so something like this should work?
I might be forgettting to add an else or an if actually but
as a base until I fix that
where is exoSuit defined?
it should be defined in ExoSTMain
I can double check that though
unless I need to define it here as well
I don't think that check is what you actually want, you want to know if a player is wearin an exosuit
yes, but there's like 20 different exosuits with different names
the then at the end of the line doe not correpond to an if
And.. I'm not clear what you're doing
yeah I have no idea either, the top half was the original code that's working in the original mod
it's going to take the exoSuit variable, get it's dplayanme, see if that has "exo" in it.
that looks like it belongs in a loop going through all worn items
unless I grabbed the wrong one, actually, I have two subscribed because one doesn't work
Or since you knwo whcih body slot the exosuit isn in just get the item work in that slot, if it's not nil check getFullType()
which will be the base.SuperExoSuit or whatever the item is called, not the Display Name.
Mainly because then you have no worries about translations.
would that work for the other 19 of them?
I don't want to have to type it out for each item which is what the display name string was for
do they all have items with "exo" in the name, and will that give false positives?
If you're doing this for B42 Tags are the better way to go
they do, they all have Exoskeleton, and I'm on b41
I'm not sure if B41 has tags on items, I can't rmember
Then item:hasTag("Exoskeleton")
I should probably make it search for Exoskeleton instead of just exo though if I did go this route
would I have to code that tag or just add it to the item?
Can add it with DoParam()
okay, I've never worked this far into lua so I'll have to look into how to do that
If you're lucky the items already have a tag you can use
they do not sadly
if the original dev used a tag on the item for their code.
yeah the original dev did it the same way I'm doing it
which is why I went this route originally
You can do the same, esepcially if there is existing code to copy
but what you copied looks like a check that is meant to be in a loop of "(for each piece of equipped clothing (is it an exosuit?))"
thats what I did with this section, it's just copied over
it's pulled out of this, I was adjusting the endurance to speed modifier
that relies on exoSuit being set somewhere else.
Would I just have to require the file it's specified in then?
that is better, you can see wornItems is "get the item equipped in the ExoSkeleton slot"
if that in nil, exit.
no ise what ExoState is, I guess "powered on"
Yeah it's used for the power on or off function later the that file
In that file*
and then if there is "Mk3" in the displayname it setFallTime(0)'s the player
it's confusing because wornItems will only get a singular object.
Yeah it only needs to get the suit I'm wearing in that moment
But it needs all of the different exosuits to be detected depending on which one is worn
pretty sure that's a piece of broken code. especially given that it has syntax issues.
Use the RunExoFallEffect as your template
I think it has syntax issues because of something on my end, that's the only thing written in thag file right now, the exofalleffect was my template
where it checks for "Mk3" in teh name, check for "exo" or "Exo" (whichever is used)
Okay, and I should also add the ExoState check i guess huh
but... you don't even need that... Can you just assume that any clothing equppd in the Exoskeleton custom clothing location is an exoskeleton?
You could but it needs to check that it's powered on, plus a couple fo the exosuits don't have the custom location because their from Britas
So by doing the string for the display name it should pick those up as well, atleast I thought
Figure out the appropriate checks then - and for brita's getWornItem("Exoskeleton") will return nil if they don;t use that
suggestion: make it work for one mod first
They do, it has exoskeleton in it, but you're right I should focus on one at a time
I tried putting it into the code next to the function I'm using as a base and even then it's got syntax errors, I'm not really sure what's up
What is this?
you've just pasted the broken code next to good code lol
copy the good code and change what it does
I didn't even notice that lol, my sleep deprived ass is struggling
Also, youre creating EXST_SunSpeedEffect() but... are you actually having that called from somewhere?
no, it's a completely new function for the runspeed using the speedframework, I'm not sure how to call the code from the speedframework yet
wait wrong image
there we go
fuck I forgot to remove the endurance stuff when I copied it
2 am coding
Please tell me why the transition between animations doesn't work, after the first animation the second one doesn't start?:
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>firstAnim</m_Name>
<m_AnimName>Bob_First_Anim</m_AnimName>
<m_Looped>false</m_Looped>
<m_SpeedScale>1.00</m_SpeedScale>
<m_BlendTime>0.15</m_BlendTime>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>firstAnim</m_StringValue>
</m_Conditions>
<m_Transitions>
<m_Target>secondAnim</m_Target>
<m_blendInTime>0.3</m_blendInTime>
<m_blendOutTime>0.3</m_blendOutTime>
<m_speedScale>1.0</m_speedScale>
</m_Transitions>
</animNode>
-- second anim
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>secondAnim</m_Name>
<m_AnimName>Bob_Second_Anim</m_AnimName>
<m_Looped>true</m_Looped>
<m_SpeedScale>1.00</m_SpeedScale>
<m_BlendTime>0.60</m_BlendTime>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>secondAnim</m_StringValue>
</m_Conditions>
</animNode>
-- Timed Action:
self:setActionAnim("firstAnim")
That will depend when you want it to trigger; you probably want to call it from the OnClothingUpdated event https://github.com/demiurgeQuantified/PZEventDoc/blob/develop/docs/Events.md
And have it reset the player speed if they are NOT wearing an exoskeleton
And also call it every time the exoskeleton powers up/down
that would make the most sense to do, I just don't know how to go about that, I'll look at the doc but I struggle to read those sometimes
oh wait
I've done events before
this is all I need right?
How to add animation to the lower part of the character's body?
anyone know how do i trigger light rain in solo debug mode? lol.
Wow amazing. Great work. And I like the mod page description clarity.
How did the java side of things work out for you? What gave you most help or headache? Asking for hypothetical future me.
me-hehe. If chunk loading wasn't such a thing, could easily iterate through inventory and return only on a certain minimum stock level ..
Mhh but those have a hard edge, not really a light effect. I have the feeling too it could have to do with tiles, not items.
awh thats evil I like it ๐
substate the bones
btw, this is assured to load everything ? You know, just because I am paranoid doesn't mean they are not out there to get me, so I just restart the entire game when I test.
Which is why for patching it is better (in all cases?) to first store the original function, then overwrite with your function, then call the original function from within your fresh overwrite and then do your stuff.
example that I learned from Draw On The Map Mod:
-- first time map opens in the player session
ISWorldMap.createChildren_prepatch = ISWorldMap.createChildren;
ISWorldMap.createChildren = function(self)
self:createChildren_prepatch();
. . .
<do your stuff here>
. . .
end
In this case it's not just for modding but to keep the vanilla function alive ๐ฌ but I would think the pattern is transferable?
Good Morning by the way. Commenting to older threads feels like setting a bunch of GOTO (yey Lua 5.1 doesn't even know these). Hope its alright for our overall readability here ๐
to start rain
local mgr = getClimateManager()
mgr:transmitServerStartRain(0.1);
mgr:transmitGenerateWeather(0.1, 1)
to stop
local mgr = getClimateManager()
if isClient() then
mgr:transmitServerStopWeather()
mgr:transmitStopWeather()
else
mgr:stopWeatherAndThunder()
end
Biggest exceptions is if mods override textures/models those are not reloaded. (This is why you have to restart the game after enabling a mod for a new player skin, for example)
You need java 1.7 to match Zomboid B42, and it took a bit of playing around to get the syntax correct to build a file.
$JAVAC="C:\Program Files\Java\jdk-17\bin\javac"
$DEP="D:\pz\42.7\output\dependencies"
$CLASSPATH="C:\Games\Steam\steamapps\common\ProjectZomboid"
$WORKDIR="C:\Users\dougs\Zomboid\Workshop\Nep High Beams 2\Contents\mods\Nep High Beams 2\42\Java"
$JAVAFILE="VehiclePart.java"
$CLASSFILE="VehiclePart.class"
$DESTFOLDER="C:\Games\Steam\steamapps\common\ProjectZomboid\zombie\vehicles\"
echo +-------------------------------------------+
pushd $WORKDIR
& $JAVAC -cp $DEP -classpath $CLASSPATH $JAVAFILE -Xlint:none
copy .\$CLASSFILE $DESTFOLDER
popd
echo +-------------------------------------------+
That's my super ugly powershell build script, to compile one file and copy it into the game directory.
D:\pz\42.7\output\dependencies is from ZomboidDecompler
It annoys me that that I couldn't get the powershell syntax for a single variable used as both ${JAVAFILE).java and ${JAVAFILE}.class
But it was 1am and this worked.
Also worth noting - I'm not treating the .java file as being part of a java project with all the proper checking in the IDE etc, it's just a file on it's own copied from the decompiled source tree.
Not every decompiled file will work immediately; VehiclePart.java compiles as-is with some warnings that can be ignored, IsoGenerator only worked after I got rid of an reference to a compare function that wouldn't resolve (who cares if the list of powered objects is sorted incorrectly? Just gimme more geneator range!) and when I tried one of the rendering functions it utterly rejected me because it's missing every OpenGL reference the code makes.
might not work in solo i cant seem to find the code for solo, but maybe transmit will still work the same, let me know after you test @brave bone
This is from a B42 plumbing fix by Lightja, to start a massive storm:
local function lightja_createtropicalstormtest()
if isClient() then
getClimateManager():transmitStopWeather();
else
getClimateManager():stopWeatherAndThunder()
end
local clim = getWorld():getClimateManager();
if clim then
clim:triggerCustomWeatherStage(8,48);
end
end
Nice. that might come in handy.
Talking about handy, whats your favorite home-made small debug functions to save time?
here's a stupid simple one:
local square = player:getCurrentSquare()
local vehicle = addVehicleDebug("Base.SUV", IsoDirections.N, nil, square)
if not vehicle then
print("โ Failed to spawn vehicle.")
return
end
-- Fill gas tank
local tank = vehicle:getPartById("GasTank")
if tank then
tank:getModData().fuel = 50.0
tank:setContainerContentAmount(50.0)
tank:setCondition(100)
vehicle:transmitPartModData(tank)
else
print("โ ๏ธ No GasTank part found on vehicle.")
end
-- Add key to player inventory
local key = vehicle:createVehicleKey()
if key then
player:getInventory():AddItem(key)
else
print("Failed to create vehicle key.")
end
print("SUV spawned with 50 fuel and key given to player.")
return vehicle
end```
And I am about to write one that lets me long distance "teleport" in singleplayer to a not yet loaded chunk by stutter-stepping 100 squares or so until at destination ๐ซ
Though I wonder how the working vehicle interiors author did it for teleporting into those "virtual rooms" ๐ค
can you pls describe how to do it?
afk rn
Based on how much I use it, easily this:
NepHB2J.DebugSay = function(message)
if NepHB2J.Options.Debug then
print ("NepHB2J: " .. message)
end
end
You can target which bones you want to be affected by your animation by setting a weight for the bones.
So for example to disable all bones you'd do this:
<boneName>Bip01</boneName>
<weight>0.00</weight>
</m_SubStateBoneWeights>```
Bip01 is the parent to the other bones, so setting it to 0 disables all of them.
Then you can go and target the ones you want to animate, so for the legs you'd want to add:
```<m_SubStateBoneWeights>
<boneName>Bip01_R_Thigh</boneName>
<weight>1.00</weight></m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Thigh</boneName>
<weight>1.00</weight></m_SubStateBoneWeights>```
So now those bones will be used in the animation but none of the other ones
I do car spawing via debug menu, it includes fully repair car" (fills up tank) and "give key"
Have you worked much with vehicles? Is it easy to teleport a car from one square to another?
No.
It is the opposite of easy,
as in "stupidly hard"
Haha dang, I figured it probably would be
also this one ```xml
<m_UpperOnly>false</m_UpperOnly>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
Cars are physics opbjects, so to relocate them it's somewhere in the Bullet physics library
fetch the door part
check the function that makes the player enter the vehicle
modify it by adding teleport code
Well then that idea is out the window! I'm trying to figure out how to make attachable containers for the bike, since the weaponpart that goes on it can't be an actual container, and the bike can't be a container either, has to be a weapon
You set set orientation easily (which also forces the car speed to zero) with setAngles(). But teleporting... nope.
I was tinkering with something like this, where the bike spawns a container when it finds an attachment, and then when the player is on the bike, the container is teleported to the same square.
I could then make the container invisible, but still have it show up in the world loot menu.
Might be possible with the right transformation, but that isn't complex; it's hypercomplex, because it invoves quaternions
Yeah that's definitely not gonna be worth trying to implement
you can probably ignore the quaternion and just keep rotation, except there is this whole weird allocate system and.... ugh
Is that so you can give the bike inventory?
Yeah, I've been working with Nik on making everything an attachment to the bike.
The wheels are working, but making a container is tricky because the actual container can't be attached using the weaponpart system
My idea in the video would work I think, but it's only moving the visual object, not the actual container, so when you stop and try to access the container it's not actually there
What item type is the bike?
Just Type = Weapon
Which is honestly pretty interesting, because it's treated as a melee weapon, but attachments works just fine out of the box.
Which means any melee weapon could have attachments
If only mod data could store arbitary object types ๐ฆ
Right?! That was my first idea but then I remembered, no objects allowed...
I abandoned the idea of serializing the inventory on mount/dismount as well lol
yeah, I don't see that working reliably
although...
and
this is an utterly crazy idea...
What if the save method was used to get a serialized object, that was base64 encoded to a string, and stored in a string in moddata?
if you're in build 41 you can use starlit's serialisation module to save and load items
At this point you're making a library for storing anything in anything
No starlit serialization for B42?
i didn't port it to 42 since it's too difficult to update (no way to determine what has changed without doing literally all of the work again) and it's likely to break in future updates and cause issues
Also I don't thing Kahlua will let you make a "bytebufffer" from lua if it doens; thave some mapping defined somewhere in teh java side
I wanted to come back to this chat and say whoever got affected by my rant the other day about the the "Living" part of iso character hierarchy, im stupid and i just found out why its named like that. there is in fact a reason
Of and fun fact: I learned that Lua has a thing called "userdata"
It might look like a number
it might print like a number
it might compare to other numbers like a number
but do anything else and it explodes
isnt userdata only used with C dll to lua interfacing?
userdata is literally user defined data
== works but not <=, =>
it's any type that isn't a lua type basically
I couldn't get it to convert back to a number
for example all java types in pz are userdata
by kahlua magic makes them work.
Adding a new static field to a class does not!
So VehiclePart.NepVerion is accessible as a public static field but it's always userData
a public static int getNepVersion() function works.
was the field an int or Integer?
the latter should be userdata but the former should be number
iirc you call something like :intValue() to convert
I also couldn't make static functions that took arguments, even thouugh adding new non-static functions worked...so I ended up making some thing that shoudl be static non-static so you need a VehiclePart to set a static variable
I'd need to check to be sure.. I copied the other int/integer fields already there because I couldn't rmember which was which
I'll try that sometime
Yes, and a little trailer for additonal storage pls. lol. that one will be difficult, I know.
You want a trailer
I want this
I'll settle for this, but I really want the tricycle and bowler hat.
Zomboid mad max but it takes place in The Netherlands. I'd go watch that movie.
bike mounted machine guns are not utterly rediculous in a post apocalyptic setting
and it's a weapon attachment already.
most fuel a will be dead after a year, bikes will keep going. Need only basic maintenance tools, can handle small paths
and can carry a heavy wepon and also provide a tripod that can be deployed in seconds.
animal:addAttachment
we should make a betting pool on what functions get implemented from vanilla.
I wonder if that means animals can get in vehicle as passenger lol
The helicopter mods work by teleporting the vehicle around. This is from the "warthunder vehicle library": ```
local wTransformFieldNum = nil
local function getJavaFieldNum(object, fieldName)
for i = 0, getNumClassFields(object) - 1 do
local javaField = getClassField(object, i)
if luautils.stringEnds(tostring(javaField), '.' .. fieldName) then
return i
end
end
end
local function moveVehicle(vehicle, x_delta, y_delta, z_delta)
if wTransformFieldNum == nil then
wTransformFieldNum = getJavaFieldNum(vehicle, "jniTransform")
end
if wTransformFieldNum then
local tmpTransform = getClassFieldVal(vehicle, getClassField(vehicle, wTransformFieldNum))
local wTranform = vehicle:getWorldTransform(tmpTransform)
local origin = getClassFieldVal(wTranform, getClassField(wTranform, 1))
origin:set(origin:x() + x_delta, origin:y() + y_delta, origin:z() + z_delta)
vehicle:setWorldTransform(wTranform)
end
end```
Just set the origin to whatever and it should work
Thanks! Ctrl-C/Ctrl-V's it for his notebook
wat the frick is it doing
It does some stuff that presumably finds this part of BaseVehicle:
what are you looking at/for
Madness.
I'm looking at madness.
This is the code that slumbers in the void between languages.
I wonder if the bullet physics library is documented in a way that would help make sense of this
Namely what is getting done with transform objects.
I thought bullet was their own implementation written in C
well the lighting code is at least
There are bullet java clases, though they may just link to C libraries
The lighting engine is their own as far as I can tell, I was trying to figure out if teh built in night vision could be made useful
I found what you mean, I think. they might use it, idk.
When you activate it you get the perfect effect for a split second, then it does something and everything just washed out
they are mostly bindings to native code
(not confirmed that is what they are using)
yep I stumbled upon that too
getPlayer():setWearingNightVisionGoggles(true)
I even tried commenting out bits of code in java to see if I could figure out what it was doing to ruin it, because it worked in B41 (Eris bnightvision/Chucked night vision used it) and it was vastly superior to "green filter and a fake torch"
But I can't recompile the rendering files unless I work out how to reference OpenGL stuff (I think that's the issue)
I just got around to looking this up... they describe pretty much an M14 and hype it up because the US made a new gun for the story instead of using the countless weapons already laying around
(with a bayonet, which an exceprt I read talks up like it's a genius innovation and not a variation on "spear" which has been around since humans figured out how to tie rocks to sticks)
magnet boots
@thin swan @ancient grail thanks guys!
it worked?
I will test it a bit later but thank you for your time
Wait what's that?
Anybody knows what square:isFree(false) the boolean parameter does? It's required
I gotta decompile Java instead of annoying you guys soon probably ..
edit: solved if chatGPT checking JavaDocs from god knows where is correct: "The ignoreActors flag controls whether to consider moving/standing players, zombies, etc."
from IsoGridSquare.java
Yeah that confirms it. thank you. Anything moves in there, and we don't want to run it over, return false. Great for full-self-driving mod ๐
Interesting, I might take a swing at it if I can't figure out a better method.
I was thinking I'd make a vehicle with no collision, invisible model, and it's basically just a trunk that gets teleported to the player. But it's like not even a half-baked idea haha
I see. Just random idea if you end up having to use something like that: you might not need to move the vehicle to the exact location if you replace the access check function for the trunk with your own (then you also don't need the visible trunk area). Then you would just need to make sure the vehicle/trunk is loaded to be able to access it (maybe?)
So, not for debug-spawning but regular mod purpose I want to identify the best suited 3x3 squares to safely and dynamically spawn cars (in a limited radius in the loaded chunk, of course).
I am thinking to adopt a "scoring model" as this can never be black-and-white I think.
And yeah I am aware of runtime performance implications, I can handle "throttled async search" ๐
So I am thinking:
- preferably on parking spot or alternatively a road
- it should be free (sq:isFree(false))
- hard-exclude indoor tiles e.g. via sq:isInARoom
- Considering hasNaturalFloor as another negative to avoid
- avoid sq:hasSlopedSurface
- avoid sq:isWaterSquare
- avoid sq:HasTree
Q1 to you folks: What do you think about the approach and criteria? Have you seen similar function in the wild somewhere?
Q2: what do you think about sq:isSolidFloor, sq:getOpenAir, sq:hasRainBlockingTile, sq:hasFloor, sq:isNotBlocked or other square functions?
I might additionally iterate over objects in a tile anyway (isFree reports true for non blocking objects it seems) and try to avoid very loaded squares via scoring maulus.
Oh interesting idea, that could work actually. I haven't touched vehicles at all, but if that is a possibility it's definitely worth exploring. I'm gonna try first and just transfer it to the users inventory when on the bike, and then dropping when off, and make it non-transferable for the user
to finelly control movements I use similar stuff in TchernoLib shared\Movement\MovePlayer.lua
Does the modding in this game require coding knowledge
Interesting!! So if your MovePlayer.isBlockedTo(fromSquare,toSquare) does all the heavy lifing then I could run it in 3x length 3 "strips" and then identify strips that form a 9-grid. Examine those grids for preferred ground and it means good to go, eh?
Not all of it. It depends how complex you need or want to go. Some of it "simply" requires knowing which files define which things.
Of course "simply" is a big word here. It depends.
yes except that I did not check for B42 specifics yet. e.g. hasSlopedSurfaceis not handled
I got you
You need technical know how
Which i like to think i have, as ive worked on other games before like red alert 2
All technical know how is built by banging your brain against something and enduring the pain until enough learning sets in. So yes that is true for this modding here regardless of coding or not :D. You want something hard enough you'll get there!
And that may be rare enough and I can always check it extra. Hmm. so WDYT is better, I add your mod as dependency or I just grab a copy of your function? ๐ 
Is there some kinda documentation that explains fhe file structure and organization this game uses
Where models are stored, sounds, textures what format theyre in, what program opens them etc etc
the mod is made to be used as a dependency, and I hope to improve it from other modders advices/needs. and also my ego vote for that. that said, do as you please.
I have not come across an end-2-end complete modding guide, especially as the upcoming build42 has changed many things, the documentation out there has to be consumed carefuly check that it says "for b42" or something.
https://pzwiki.net/wiki/File_structure lists things. The rest is distributed on that wiki but more based on topic and you have to get lucky.
If you want to code stuff ask for more.
I would advise you install a simple mod that changes things similar to what you want to change and then look at its file structure.
The steam worshop mods will show up on your disk in a place like steam/steamapps/workshop/content/108600/
Great. I shall look up how to register a dependency then.
You can spawn them in vehicle zones defined by the world. Then you can always make sure it's a free place, i.e. not in buildings/on the water ...
I have an unreleased mod on this
Okay thank yall for the info
I can PM you later about some things I added as maybe re-usable functions. You can think about them. Nothing too exciting to write home about yet. I mean .. maybe the part where I use use vanilla symbols and place multi-line text along-side it ..
you have that stuff up on GH btw in case pull-request?
Sounds very interesting. It is a comprehensive framework if I read the description correctly. I would not want to take a sledgehammer to a knife fight so .. the question would be if there are (any or enough) pre-defined vehicle spawn areas coming along-side this or are getting "identified on the fly or in the background" so that I can rely on a "good enough" vehicle location to be available within, say, 40 squares. (yes we can exclude deep forrests etc haha)
It is not on github
Trying to add Moodles to my mod. They trigger successfully but I thought that resetting the value to 0.0 afterwards would make them disappear and it doesnt. They're good when theyre supposed to be bad and they're bad when they're supposed to be gone lol
are you using MoodleFramework for your moodles ?
???
its not possible
yea. I think I misunderstood how the values act
I thought setting the value to 0.0 made the moodle disappear but idk if thats so
tyvm
If you were using my bicycle, would you accept a somewhat messy workaround like this to be able to attach saddlebags to it and put stuff in it?
It basically first checks to see if a saddlebag is attached (which is not an actual container), and if it is, it will spawn an invisible container (currently the ammo box in the video) that gets transferred from/to user inventory when getting on/off.
The container can not be transferred/equipped, so it's basically stuck in the same square as the bike.
I can easily make it so if the bike is picked up into inventory or put in a car trunk then the container gets transferred along with it.
I would be fine with this. Assuming the container is weightless on the player while walkingbiking
Yeah it would be, just need to make sure that total weight of bag is still counted into travel speed/endurance drain so the more you pack into it, the slower you go/more tired you get
What's the closest anyones come to bringing horses into the game?
There's a group effort by a bunch of modders to make one! They've gotten pretty far with it
nice
Trying to work on a wild west 1800's map
Imma see if I can contact them later IF they're not busy
stupid work-flow question: how to exit current game while in lua error screen without unticking "break on error" first? Background: I want to simply refresh lua and then try again but the game remembers the "break on error" untick, which is not what I want/
Has anyone made a good mod for realistic alcohol & hangovers?
finally someone asking the right questions!
F11 to continue. ALTF4 to exit (windows)
Since its cloth, maybe you could look into the patches for an attachment? Just a random idea tough.
That's not a bad idea, but we had to move away from using the bike as clothing, it's now just a full on weapon.
But I think I'm on to something with this method!
Now it doesn't render the invisible container as a world object, nor as an inventory item, but it still exists, items can be transferred from/to it and the container itself is transferred from/to player when getting on/off bike but doesn't show in inventory, and doesn't weigh you down. And I can get the content weight to use as a speed/endurance modifier
Oh? Nice! Ill have to download your mod when its done and steal your code for that since it sounds interesting. ๐ ๐คช ๐
Haha go for it! ๐
Wizard class with "bag of holding" then.
3x3 "good car spawns near player" - More blue intensity means higher score, red squares are hard no for their respective 9-grid. You can occassional make out the 3-length strip-scanning via Tchernolib MovePlayer.isBlockedTo @mellow frigate .
FYI @coarse sinew
edit: should probably check for other cars already placed . . .
Same for B42 ?
Made this page and added the snipet, thanks
https://pzwiki.net/wiki/ClimateManager
I still have yet to find one in my game. 
Even more cheaters are about to be salty with my updated anti-cheat. 
I'm gonna make the spawns more dynamic so it spawns out in the world instead of in containers.
Right now it has the highest spawn chance in post office parcels, sports stores, and garage tools lol
Okie dokie, I'll look there :p Thanks
I'm gonna make all the parts craftable as well, so with enough mechanics, metalworking and welding, you can build a bike from scratch, and then add more and more upgrades
Thought about building my nicotine system into a substance framework to simulate things like alcohol and caffeine but I don't have much free time these days to properly develop it
Is that a challenge for cheaters ?
Honestly not a terrible idea, and unfortunately: same. Besides I'm not even done with the ZuperCarts fork yet anyway. But I've had a chance to play today and alcohol kinda... ruins my immersion. I wanted to do a nun character who became an alcoholic during the apocalypse but you stay drunk for like 2 hours in game (lolll) and no hangovers. Maybe I'll add it to my list of future ideas if I don't see it done.
Princess ZeldAva
idk about this
i only tried this on the lua consol, mp, b41
Y'all play PZ only to play Zelda lmao
why not spawn another item whenever you have the bike and drop it along with the bike whenever you drop the bike
Yeah that's basically what it does, it spawns the container when equipping a bike that has the correct attached part, and then transfers that to the player, but without rendering it in the inventory UI, and then when the player gets off the bike it's dropped again
oh ok then i thought you wre still figuring out what to do
my bad
No worries ๐ I can see now how my other message looks like that
@thin swan that is, in order for all bones to be animated, I need to write each bone according to this example?:
<m_SubStateBoneWeights>
<boneName>Bip01_R_Thigh</boneName>
<weight>1.00</weight>
</m_SubStateBoneWeights>
If you want all bones to be animated then you can just do <m_SubStateBoneWeights> <boneName>Bip01</boneName> <weight>1.00</weight> </m_SubStateBoneWeights>
It's the parent bone and will instruct all other bones to also animate
@ancient grail your method unfortunately didn't work or i did something wrong
theres an include child bones or something
just modify the parent
Just checked the chat and I see discussions about child bones ๐
you still need the deffered y
but the other one idk if that works tbh
Can you please explain what it is for? It seems like the animation works correctly without it
It tells your character which way is forward, so it really depends on how you exported your animations. If it works fine without it, then you likely exported with the correct rotation
ok
so for example
i have an animation that makes the character do jumping jacks
without the deffered y then the character will remain in its y axis and will not move
it wont go up
Oooh yeah, it's used for the translation_data, you're right
i guess we have different answers lol we could both be correct tho
that is, when animating the lower part of the body, it is better to add xml <m_deferredBoneAxis>Y</m_deferredBoneAxis>, did I understand correctly?
I have noticed it can make the character have the wrong rotation if set to the wrong axis, but it could also have been that I did two things wrong lol
I just throw that in all my animsets tbh, never had issues having it and not needed, but definitely have had issues not having it and needed it ๐
@muted garnet i suggest looking at an animation that makes the player falldown or maybe the sitdown animation
(always refer to the default file, cuz some animation has parents)
parents btw are defined by using the extend
You should also know about conditionpriority.
It's used like this:
<m_ConditionPriority>10</m_ConditionPriority>
It will tell the animation engine to give your animation priority if the same conditions are met in several animsets.
Makes it easier to override vanilla animations and stop them from triggering when you want yours to trigger instead.
yeah i also did this before
some functions can be used yo recycle already existing animations
such as the reverse
this makes it so that you dont have to make the x/fbx twice
what i want to understand is how the flashlight thing works
if we can replicate that then we can combine animations
maybe we wont need to make all them strafe animset files
cuz thats tedious
@thin swan @ancient grail thank you very much, please tell me what I did wrong in transitions? The first animation ends and the second does not start, although both animations work separately, the transition does not work either with vanilla animations. After the first animation, the character simply immediately returns to the original pose without animations:
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>CustomAnim</m_Name>
<m_AnimName>Bob_CustomAnim</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_Looped>false</m_Looped>
<m_SpeedScale>0.10</m_SpeedScale>
<m_BlendTime>2</m_BlendTime>
<m_SubStateBoneWeights>
<boneName>Bip01</boneName>
<weight>1.00</weight>
</m_SubStateBoneWeights>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>CustomAnim</m_StringValue>
</m_Conditions>
<m_Transitions>
<m_Target>DrinkBottle</m_Target>
<m_blendInTime>0.3</m_blendInTime>
<m_blendOutTime>0.3</m_blendOutTime>
<m_speedScale>1.00</m_speedScale>
</m_Transitions>
</animNode>
I'm still not 100% how it all works, but from having messed around with it, it seems that there's more to transitions than just setting a target because from my experience it seems that the animset you're targeting has to actually be triggered in order for transition to work.
So if by the end of your animation there's nothing that makes your character drink from a bottle, then it won't actually play the DrinkBottle animset, so you trying to target that animset won't do anything.
What you'd want is to either check which animset is triggered after your CustomAnim, and then you use that as your target, and in your transition you specify an animation you want to play when going from CustomAnim to whatever other anim (likely going to be idle)
So if it's currently going from CustomAnim to Idle, you'd want to do this:
<animNode>
<m_Name>CustomAnim</m_Name>
<m_AnimName>Bob_CustomAnim</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_Looped>false</m_Looped>
<m_SpeedScale>0.10</m_SpeedScale>
<m_BlendTime>2</m_BlendTime>
<m_SubStateBoneWeights>
<boneName>Bip01</boneName>
<weight>1.00</weight>
</m_SubStateBoneWeights>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>CustomAnim</m_StringValue>
</m_Conditions>
<m_Transitions>
<m_Target>Idle</m_Target> <--- Change this
<m_AnimName>Bob_CustomAnimTransition</m_AnimName> <--- Add this
<m_blendInTime>0.3</m_blendInTime>
<m_blendOutTime>0.3</m_blendOutTime>
<m_speedScale>1.00</m_speedScale>
</m_Transitions>
</animNode>
Or you could have another custom animset which has a condition that is triggered when your first anim stops, because then it will work when you target it.
Now it's clearer to me, thank you very much!
The blend times and speedscale of anims and transitions also plays a big role, so try tweaking those a bit as well if you're not getting the expected results.
Having speedscale at 1.0 and blendTime/in/out at 0.5, and then tweak with like 0.1/0.2 increments until it looks right.
I think the blend times that are set at the top of the animset takes priority over the ones in a transition, but there also seems to be exceptions to this or I just misunderstand something
๐
I finally found one in a gas station counter! :p
Hahaha yes, perfectly realistic location to find a bicycle ๐
Nik was telling me that Zupercarts have some spawn mechanic so they can spawn out in the world. Did you make that?
Yea. It basically checks rooms as the game loads new areas. Take whatever you need from it. It's in the aptly named LUAs: SpawnTrolleyContainer and SpawnCartContainer. The premise is fairly simple: when the game finds a room with the corresponding name, it rolls to spawn one. I have it 0-100. So if it rolls a number that's less than or equal to the given number, one spawns.
Oh that sounds exactly like what I need, thank you so much, I will give credit for it in the workshop description!
Here's a list of room names. Most of them at least.
Amazing, thank you! ๐
thank you. i wish they just added it on the ui.
Hey, I need to add a event trigger to something, I was having issues with OnClothingUpdated where sometimes it just stopped working, I don't want it to be performance heavy like OnEveryMinute would be since this is on a heavily modded server but I need it to trigger soon enough so that it changes roughly when you take the clothing off so EveryTenMinutes won't be fast enough
the codes working fine with EveryTenMinutes so I'm unsure why OnClothingUpdated made it just stop for no reason
How about hooking to the timed action of equiping clothings ?
OnClothingUpdated could just not be triggered in some rare cases possibly, could be a mistake by devs or other reasons
It's not something like OnTick or what
That is something I am unsure on how to do, I'm fairly new to lua
Events need to be manually triggered by code (by the game) so if they forgot to trigger it somewhere, could cause issues possibly
yeah it worked everyonce in a while but then sometimes it either wasn't triggering or just stopped working after it triggered
thanks for this aswell
what are you actually doing?
Making the Exoskeletons from stalker and Brita's make you run faster, I got the code working using Speed Framework with Shoes Speed as a base, however now I need to make sure it triggers
so I'm not sure hooking the timed action will be able to know it's the exoskeleton specifically
actually that shouldn't matter now that I think about it, it checks for that on another line
You can check for it yea
You have access to the item in the instance of the timed action equipping the clothing item
So you can check that the item is in fact the item you should be doing shit on
how would I write the timed action check? I've got a rough idea but I don't know anything about lua and have no idea which timedaction I'm checking for
preferably in simple terms so that I can learn it and try to remember it for future projects instead of having to ask others
You can find Timed actions as Lua files in folders named Timed action
ah I found it thank you
@ancient grail tried local mgr = getClimateManager() mgr:transmitServerStartRain(0.1); mgr:transmitGenerateWeather(0.1, 1)
it is kinda being accepted but nothing is happening.
although I can stop the weather by: local mgr = getClimateManager(); if isClient() then mgr:transmitStopWeather(); else mgr:stopWeatherAndThunder(); end
there are some triggers but, this seems to be directly commands from the climate debuggers ui:
transmitTriggerStorm
transmitTriggerTropical
transmitTriggerBlizzard
but this piece of code works in debug input thingy where you can directly input itensity and hours.
local function lightja_createtropicalstormtest() if isClient() then getClimateManager():transmitStopWeather(); else getClimateManager():stopWeatherAndThunder() end local clim = getWorld():getClimateManager(); if clim then clim:triggerCustomWeatherStage(1,48); end end; lightja_createtropicalstormtest()
clim:triggerCustomWeatherStage(**intensity**,**hours**)
thats weird. it works for me. you tested on MP i assume?
I only tested this in solo b42
you need for solo? then idk how to trigger it if its solo. i couldnt find the code for it
yea solo for now. but @silent zealot code worked in solo ๐ so it should be fine. plus the stop weather works with it in solo.
There seems to be a discrepancy in checking for getAccessLevel() == "admin", and getAccessLevel() == "Admin". Does anyone know why, or which is the correct method?
It's case sensitive
i don't have a copy of b41 easily accessible to check it's the same there, but in b42 it will always be capitalised like Admin
that is an area that's had a major overhaul, and an overhaul that obviously isn't even done yet since multiplayer isn't out, so it's not that unlikely it could have changed
but they kept getAccessLevel() even though they don't call it that anymore presumably for backwards compatibility so i imagine the names must be the same or else there wouldn't be any point to that
you can change both strings to lower case then check
thay way its sure
For instance. I am using this in two different spots, and get two different results.
function testFunction(_keyPressed)
local key = _keyPressed
if getAccessLevel() == "admin" then
if key == 77 then
ISChat.instance.servermsgTimer = 3000
ISChat.instance.servermsg = "Testing..."
end
end
end
This works to make sure that the button only works for an admin character.
But when I do this function, using getOnlinePlayers(), I get a different result with my if>then check
function AnotherFunction()
local onlineUsers = getOnlinePlayers()
for i=0, onlineUsers:size()-1 do
local player = onlineUsers:get(i)
if player:getAccessLevel() ~= "admin" then
print (player:getUsername() .. " is not an admin")
else
print (player:getUsername() .. " is an admin")
end
end
end
This function will show that the user, myself, is NOT an admin, even though I am. If I then change the If>Then check to
if player:getAccessLevel() ~= "Admin" then ...
it then works as intended.
Does anybody know why?
Alright. Then why does the testFunction with the keybind work as intended with checking getAccessLevel() == "admin" then? If it is suppossed to be "Admin"?
my best guess is that getAccessLevel() and player:getAccessLevel() must actually return different capitalisations like that
string.lower(getPlayer():getAccessLevel()) == "admin"
i'll go dig up my b41 source and see if that makes sense
I was guessing the same, but wasn't sure. I'm guessing since the Event Function runs getAccessLevel() on it's own, from the client side, that it may give a different result than getting the player list from the Online Users, and that may give a different result.
ok yeah it's stupid
What you normally do, if the game says tiles missing but you got all dependencies?
the global getAccessLevel() is always lowercase, the IsoPlayer getAccessLevel() is always capitalised
it's stored internally in full lowercase, for some reason the isoplayer one capitalises it before returning it, but the global one doesn't
Okay, that's definitely odd. lol One of those weird things to throw a stick in the spokes. hah
Where did you find this information, if you wouldn't mind me asking? The java docs?
i just looked through the source code
Alright. I decompiled the code a while back, but haven't poked around too much yet.
I appreciate the confirmation though. This would have left me wondering constantly if something was working/broken and just hoping it was right.
it is at least fixed in b42
I can only imagine how many small bits of code had to be changed for this adjustment throughout B42's changes, and all the mods that were ported over. No wonder their bug fix list is miles long each patch they come out with.
Thanks again @bronze yoke . Always there with an answer! ๐
Also, would it be better to check the keystroke first, and then check for admin? Or admin> keystroke? Which would be more performant? I'm assuming keystroke>admin?
keystroke first, yeah
thank you
general rule is that calling functions is insanely expensive
something like comparing a number is basically free in comparison
Yeah, especially in this case the keystroke is already passed. It's just a simple check.
Wasn't noticing this until I posted it.
Do you by chance know of any simple functions/routines that could be used to test performance of your functions, like a profiler in other IDEs?
I thought I had my shot tracker fixed but I just realized it's still counting shove attacks: ``` if not player or player:isDead() then return end
local weapon = getPlayer():getPrimaryHandItem()
if not weapon then return end
if not instanceof(weapon, "HandWeapon") then return end
if not weapon:isRanged() then return end
if player:isDoShove() then return end
local latestRadius = weapon:getSoundRadius()``` It counts the shots correctly, but if Im holding the gun in-hand, it'll still count the shove the same way
doing it in zomboid is always awkward but the easiest way is to do something like this:```lua
local start = os.time()
for i = 1, 1000000 do
-- the code you want to profile here
end
print(os.time() - start) -- how long it took in seconds
Awesome, thanks!
What does os.time do? Is it like gametime?
I'm pretty sure it's the current unix time stamp
Thank you.
Hello! I'm new to PZ and modding. I'm trying to create a mod to modify the required tools to uninstall/install parts in a vehicle. I'm trying to override VehiclePart.getTable() but I'm not being able to get a break inside my function.
Well, it seems I'm not able to override a Java method. That's a bummer. Do you know any other way I could alter the parts' table? I'm trying to make a functional car lift mod.
Of course I cant override canUninstallPart either ๐ข
Not that im doing anything with cars, but im curious. Can someone tell me why it is that when multiple people drive their cars on a server, the server performance drastically declines? Again, just curious.
I mean, its not like players running around have the same effect, so its a bit strange.
do it by hooking onto the lua timedaction
Overriding is not good practice in mods, since other mods may want behavior on it too
I imagine it's less the cars and more the fact that more of the map is being loaded
Have muliple people drive in little circles to confirm, because I agress it's likely map loading.
Especially new chunks that need erosion applied.
Backup slightly - you can override the lua -> java interface, it just won't affect any java -> java function calls.
But you want to make sure whatever you're doing lets the original function call through if whatever special conditions your mod cares about do not apply, or you will break vanilla use of the functions. That also avoid disaster if another mod also changes the function; you can have as many prefix/postfix patches on a function as you want but one modder replacing the whole function breaks it for everyone else. Sometimes that has to be done, but always try to think of a way to avoid it if you can.
Is your goal to change the required tools when a vehicle lift is nearby?
It's doing exactly what you told it to lol.
You could look at the function that handle a gun after being shot - does it need to be racked (bolt action), etc.
ISReloadWeaponAction.lua, under the "shoot shoot bang bang"
If weapon:haveChamber ?
Chamber seperate to the magazine.
Ah. So just isRackAfterShoot
like putting 7+1 rounds in a 1911
it does more than just that, but also - it just gets called like this:
Events.OnWeaponSwingHitPoint.Add(ISReloadWeaponAction.onShoot);
Presumably the parameters to that event don't send the gun as weapon if you shove
Alr
Car is bigger and faster then person
Also, started on the next vehicle in my mod!!
btw I noticed that
honking is louder than gunshots
what's up with that lmao
eh maybe that's better in terms of balance
Depends on the gun I think
louder guns are 200 tiles.
I think house alarms are 500 or something insane.
Vanilla noisemakers are so much of a let down.
So as the Events.OnMouseUp only fires when the mouse is not on any UI element, is there some sort of opposite for running code when the mouse goes up on any piece of UI ?
I was running code from the InventoryPane:OnMouseUp and InventoryPane:OnMouseUpOutside to detect when a click was inside or outside any UI element, but when the inventory is closed, that code is no longer running, is there an UI element that can never be disabled from which I can run my code ? Or is there a better solution that I missed ?
You can make your own onMouseDown function fully if you want, you'd just do something like:
function CustomMouseDown(x, y)
-- Your code here
end
And then add this to trigger on MouseDown events:
Events.OnMouseDown.Add(CustomMouseDown);
This will not run if you do mouse down in a UI element though, for that you'd want to hook the onMouseDown/Up methods of the UI element you want to run your custom code on.
Wait sorry I think I misread
Well I need to trigger an event when the mouse does something on any UI element
Yeah I was reading a bit too fast, my bad
No problem xd
I'm starting to wonder if creating an invisible UI element would be the way to go.
You can tap into IS UI's parent "classes".
There's mouse events for over and off of the UI
But tapping into the parent-UI in a case of off-of would fire for every element.
Well if the child class do not call the super function then my event will not trigger will it not ?
I've already tried using ISUIElement and ISPanel mouse events function to no avail
But maybe I did something wrong
Well I guess I did do something wrong as overriding ISPanel:onMouseUp did work, I'll see what I can do with that thanks !
You might have to override ISPanel and ISPanelJoypad depending on what you're trying to do, because they are both used for panels.
For example the health panel is a ISPanelJoypad while the inventory panel is ISPanel
God having to code for work is so fucking boring now, I just want to make mods ๐ญ
modding is SO fun
It really is! I keep thinking of so many things I want to do, but just don't have enough time to do them all
this!!!!!!
i have a list of like, 65 individual models for this mod im working on and i fear i am far over my head with this!!!!
i also have like two other mods i did halfway
does DoParam for items do nothing?
my current "work" desktop
It should, how are you using it?
im using both
junkLauncher:DoParam("AmmoType = " .. junkLauncher:getAmmoType() .. "/Base.Pot,")
junkLauncher:setAmmoType(junkLauncher:getAmmoType() .. ammo)
but only the last one actually does stuff, DoParam causes the item to error out the ToolTip
b42 i think(or maybe its cuz its solo mode)
doesnt refresh the clothing in game when i update the fbx file
this is a huge problem
i will have to restart everytime i do some changes
anyone knows how to force reload clothing items
I'm not 100% certain, but it might be that you're trying to use DoParam on the wrong object.
If you print(junkLauncher) what kind of object is it?
If it's a zombie.inventory.InventoryItem then DoParam won't work, but if it's a zombie.scripting.objects.Item then it should work
i am getting the item through the ScriptManager:getItem but i believe it returns an Inventory Item
Hmm, the ScriptManager should return the scripting object item over the inventory item.
At least according to https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/scripting/ScriptManager.html#getItem(java.lang.String)
If it actually is returning an inventory item for some reason, then try junkLauncher:getScriptItem():DoParam("AmmoType = " .. junkLauncher:getAmmoType() .. "/Base.Pot,")
declaration: package: zombie.scripting, class: ScriptManager
so actually its not an InventoryItem just an Item but that does have the DoParam
and the setAmmoType
I totally get that. But I think something like this would be harmless
function VehiclePart:getTable(name)
local tbl = old_getTable(self, name)
--- check for Jack requirement. if the Car Lift is near, remove Jack from table
return tbl
end```
This will prevent the check for the Jack along the way, like taking it from inventory and equipping it.
The only mod I looked deep into it's code is Auto Mechanics, and it uses getTable and canUninstallPart. Looks like it would be compatible
yeah I think the best thing to do would be to check for vanilla recipes, and you only do the replacement if they are detected
which seems to be what you've done so

Yes, this is kinda what I'm trying to do. Removing the Jack requirement when a Car Lift is close
The thing is I'm not getting a break when I place a breakpoint in there. That's why I thought I couldn't override a Java method. I have 0 experience with PZ mods. I'm looking on other mod's code and reading the Wiki, reference and, won't gonna lie, some ChatGPT
idk I don't debug with breakpoints
I'm a savage, I'm a print debugger for life
always and forever
lol, I totally print too. Didn't get any results there either. The lua is in the client folder of the mod.
I think the only important places I saw it used was on ISVehicleMechanics:doMenuTooltip, ISVehiclePartMenu.onUninstallPart and ISVehiclePartMenu.onInstallPart. AutoMechanics also uses onUninstallPart to launch the vanilla process
I don't know about Java to Java. Maybe canUninstallPart will and I'm fucked then
you can't override java functions like that, and you shouldn't have to for this.
you need to get the vehicle part first and then check it. You may want to look around in the ISVehiclePartMenu. I think there's some functions in there for checking required items
Thx, i think ill look into that one when im free, since its interesting. Also now i that i think about it, i guess i should look into erosion and see what that one actually does, and especially, when. ๐ค
ISVehicleMechanics has my first challenge on ISVehicleMechanics:doPartContextMenu:
option = self.context:addOption(getText("IGUI_Uninstall"), playerObj, ISVehiclePartMenu.onUninstallPart, part)
self:doMenuTooltip(part, option, "uninstall");
if not ISVehicleMechanics.cheat and not part:getVehicle():canUninstallPart(playerObj, part) then
option.notAvailable = true;
end
end```
If canUninstallPart fails, then the Context Menu option will be disabled. So canUninstallPart is a problem too. If it relays on getTable and I could override it, it would be good. But You all told me I may be able to override Java to Lua, but not Java to Java. So there is my first issue.
Also, inside `doMenuTooltip` there is also a check for displaying the missing tools. It won't block the operation but it doesn't look right to have the missing Jack in red.
Then on `ISVehiclePartMenu.onUninstallPart` (and onInstallPart too) I have the tool inventory transfer and tool equipment code:
```if not ISVehicleMechanics.cheat then
if playerObj:getVehicle() then
ISVehicleMenu.onExit(playerObj)
end
local tbl = part:getTable("uninstall")
ISVehiclePartMenu.transferRequiredItems(playerObj, part, tbl)
local area = tbl.area or part:getArea()
ISTimedActionQueue.add(ISPathFindAction:pathToVehicleArea(playerObj, part:getVehicle(), area))
ISVehiclePartMenu.equipRequiredItems(playerObj, part, tbl)
end```
So even though I could rewrite all those functions and make it work in Vanilla, all other mods using getTable and canUninstallPart (like Auto Mechanics) won't be compatible
Better Car Physics requires to replace Java files manually. It's a nasty thing, but maybe the only way?
you can catch the context menu, check for a lift and remove the jack requirement before it gets anywhere else?
Lemme dig around a little myself. Ironically(or unironically) the only time I've messed with VehicleParts is overriding a lua call to a java function
Lua calls the test functions for the part. Have you tried getting in that way?
function Vehicles.UninstallTest.Default(vehicle, part, chr)
-- and
function Vehicles.InstallTest.Default(vehicle, part, chr)
you could even narrow it down to
function VehicleUtils.testItems(chr, items, typeToItem, tagToItem)
if it's looking for a jack, check for your lift, remove the jack requirement from the script if there's a lift so you don't get the red option
Then put it back when you're done - which is simpler since there is an OnMechanicActionDone event
Is there no formatting Mod Options? The text is all over the place
This ?
Unless I missunderstood what you meant
I was hoping for text formatting, <center> specifically
Rich tags perhaps
I tried <CENTRE> and no dice but I'll mess around. thanks!
Hmm
You could always hack in the UI object LMAO
What do you want to center exactly ?
Like the menu options to be aligned with the line that separates your option text and object ?
yea even if the title could be centered, I'd be able to live with myself
I see what you mean lol
hmm, might have to get creative with spaces
I will grep for it and check for references! Thankss
You can always modify the UI object but eh
Hmm no I don't think it requires you to have spaces
idk why I can't just be happy with way things are. I start with something simple, and then make it 10 times more difficult
The thing is that the issue here is the UI element being missplaced basically not the text itself
Welcome to modding lol
Those tags only work if the panel is derived from ISRichTextPanel or something like that. But that title looks like an ISLabel and you can't use those tags on it. And you need whitespace between tag and text.
Yea like I said you can just go on and modify the UI object itself haha
seriously, right underneath it is addDescription and guess what it is?

made it worse
lol
I can live with this. Thanks!
What did you change lol ?
got rid of the title text and just descriptions with H1 and H2
gonna play around with it more but this is usable
Wait so you nuked a vanilla title ?
Is that title forced ?
Menu Options is forced ?
local options = PZAPI.ModOptions:create("JBLoggingModOptions", "")
options:addDescription("<H1><LEFT> JB's Auto Logging Menu Options")
options:addDescription("<H2><LEFT> Menu options for JB's Auto Logging")
options:addSeparator()
The space is still there for it I think, but just an empty string
Where can I change the Desert eagle clip size? I changed max ammo, but that didn't work
it is forced but I just gave it an empty string
Surprising that this is forced
meeee toooo
I don't remember such an annoying thing being present
I might get around to changing the rest to ISRichTextPanel some day
Is that something which will apply to every mods ?
Aaah so that's the title basically the issue if I understood that right
I didn't do anything except pass an empty string to create
I'm so confused, that must be new because this here is an old screenshot of it
That extra title is kind of fucked
local options = PZAPI.ModOptions:create("modOptionsID", "")
instead of
local options = PZAPI.ModOptions:create("modOptionsID", "Example options")
and then I just used addDescription for the title
local function JBLoggingOptions()
local config = {
checkBox = nil,
colorPicker = nil,
}
local options = PZAPI.ModOptions:create("JBLoggingModOptions", "")
options:addDescription("<H1><LEFT><ORANGE> JB's Auto Logging Menu Options")
options:addDescription("<H2><LEFT> Menu options for JB's Auto Logging")
options:addSeparator()
config.checkBox = options:addTickBox("Always_Show_Menu", getText("UI_options_JBLogging_Always_Show_Menu"), true)
config.checkBox = options:addTickBox("Keep_Menu_At_Top", getText("UI_options_JBLogging_Keep_Menu_At_Top"), false)
config.colorPicker = options:addColorPicker("Select_Color", getText("UI_options_JBLogging_Select_Color"), 0.2, 0.5, 0.7, 0)
end
return JBLoggingOptions()
that's the whole of the code I used
ohh
Which is the 42.0.2 version
hell I thought it was always there
Yeah no that's why I was confused about this title and thought that you simply added a title object
I don't get why they'd add that tho that's so stupid
Like there's ALREADY the mod section title on the left, why double it lol
I'd have to check wtf they are doing here and what adds it
That could be fixed
maybe this in MainOptions
for _, options in ipairs(PZAPI.ModOptions.Data) do
self:addHorizontalLine(y, getText(options.name))
for _, option in ipairs(options.data) do
if option.type == "title" then
self:addTitle(splitpoint, y, getText(option.name))
...```
adds the 'options.name' twice
```lua
function MainOptions:addHorizontalLine(y, text)
...
local label = ISLabel:new(100, self.addY + y + UI_BORDER_SPACING, FONT_HGT_MEDIUM, text, 1, 1, 1, 1, UIFont.Medium)```
Bruh
I wonder when that change happened
Perhaps make a #1318920979581501502
Tho I don't expect anything from that channel anymore to be achieved
idk, they fixed the 'can't use walk-to while dragging a zombie' and I didn't think they would fix that
Idk man there's been some major problems to some insanely important aspects of modding imo
And to my knowledge none of these were fixed lol
- AnimSets needing to be in B41 folder to be loaded
- Mod IDs being improperly loaded, bloating the console with constant spam that the game did not find the workshop ID or some shit like that
- Mod IDs supposedly needing the workshop ID in front of the mod ID (which causes its own set of problems) and is the reason you need \ in front of every mod ID for required in mod.info and identifying if a mod is present in the player save
- Posters not being loaded from content folder at all, even if you put the mod.info in the content folder (that one I guess is less important)
And I just checked they still haven't even fixed the battery removal issue even tho that's literally a request I had made which they implemented but it actually won't even work because of that
#1318920979581501502 message
Personally, I'm holding on to hope that they'll get to them eventuallyโmodding stuff is prob just lower priority and there's a lot to sift through in that channel
As long as the major stuff is addressed before stable we'll survive (otherwise, we will all perish)
I agree BUT imo this causes multiple major problem:
- issues (and requests) end up pilling up in that channel
- this will take ages to sift through and it will get worse the more and more you wait
- modders end up not using that channel anymore because we just barely ever see any changes happening. This personally gave me the feeling that any issues I get are just not worth reporting there because imo it just looks like none of it will ever get fixed
- a lot of these issues are such tiny issues that wouldn't even take that long to fix imo (like the battery thing I mentioned is literally just adding a single tag check)
- some of these issues are actually major issues that REALLY need fixing like I mentioned and they end up getting lost between many many many various smaller issues
So at this point I'm unsure what the motivation was. If it was about trusting modders that tend to touch a lot of technical stuff and end up finding issues players wouldn't even be able to notice simply by skimming through the code, not much is happening.
Same applies for requests where some requests are quite legitimate and could help improve the modding of the game (like my battery electronic tag I had suggested which was introduced but not tested and thus doesn't work)
God the day they change/fix the mod ID system to what it's supposed to be or simply completely change it, it's going to be ABSOLUTE hell for every modders and players about not a single mod working anymore lol
Well, this was a step forward!!! canUninstallPart calls UninstallTest, so I can force the Context Menu to be enabled
I still have the BHS color message saying the tool is missing, though
and then ISVehiclePartMenu.transferRequiredItems() throws an exception for not having the item. I might need to override that too along with ISVehiclePartMenu.equipRequiredItems()
can you get the script item and remove the jack from the install/uninstall items table? Might be easier to get it from the Vehicles.InstallTest.Default & Vehicles.UninstallTest.Default though since the part is passed to those
