#mod_development

1 messages ยท Page 89 of 1

pulsar heath
#

but still a local for that module

jaunty marten
#

outside could not work cos mb PZCalendar.getInstance() returns different instance when lua loads

red tiger
pulsar heath
#

even inside

#

no matter where you put it

bronze yoke
#

why would the time be different from line to line of your code

jaunty marten
#

u even don't change the time

#

u get it

pulsar heath
#

i dont want to change the time

jaunty marten
#

u always have same instance

red tiger
#

Even still.. redundant calls like that are bad practice.

pulsar heath
#

redundant for me is when it works without it

#

without it doesnt work

red tiger
jaunty marten
#

XD

pulsar heath
jaunty marten
#

last try to show u

pulsar heath
#

i see 2 lines with the time

#

and its the same value

#

oh sorry 4 lines

jaunty marten
#

now look at right side

jaunty marten
pulsar heath
#

with the same value

#

5 23 59

jaunty marten
#

1 line ur code and 2 line optimized code with calendar as local var

#

working ๐Ÿค”

pulsar heath
#

working?

bronze yoke
#

proof that your code and this code do exactly the same thing

jaunty marten
#

as u see

pulsar heath
#

it has the same VALUE

#

let it run for while

jaunty marten
#

yes, same value

pulsar heath
#

and show me the value changes

jaunty marten
#

ยฏ_(ใƒ„)_/ยฏ

#

working

pulsar heath
#

still thinking how that is an improvement, the vars are still there

bronze yoke
#

calling a function is slow, java function even slower, better do it once instead of three times

pulsar heath
#

thank you

bronze yoke
#

and it's less ugly

pulsar heath
#

that i cant take as a reply to my question

#

i can

#

so basicly what youre saying it to create a local instace call and catch the values from that

#

instead of calling a new instance for every value i need

#

correct?

red tiger
jaunty marten
jaunty marten
#

it's always same

pulsar heath
#

the way you replied you just said, this is bad

#

usually saying thats wrong, this is right because x or y

#

thats a critique

red tiger
pulsar heath
#

rage bait?

#

๐Ÿ˜„

#

if you dont wanna reply just dont reply

#

but telling me thats wrong to it this way

#

i rather you dont reply at all

jaunty marten
#

now it's more looks like trolling

#

the three of us saying same things

red tiger
#

You're breaking the "be lovely" rule. Take the suggestion or don't.

pulsar heath
#

im breaking the be lovely rule?

#

albion pointed out why it was bad

#

you simply said its wrong, this is right

#

thats all im saying

jaunty marten
#

that's all it takes

#

only if u not a full beginner

#

if u already creating big mod u should know 3 calls need more performance than 1 single call

#

it's basic logic

#

I hope u got smth good practice from this discussion

pulsar heath
#

i see blocked messages warning so if any of you two are talking to me dont bother, i got the help i needed from albion and have taken the liberty to avoid interacting with you guys, so good luck and please do ignore me if you can, be lovely

ancient grail
#

ow shit thats a great idea

sour island
#

whats that lua interpreter from

red tiger
#

Looks like a mod.

ancient grail
red tiger
#

A glorified loadstring text body. Useful

sour island
#

nah, I don't think so

jaunty marten
#

okay, have a good day XD

sour island
#

He won't see it - no point on continuing it

jaunty marten
sour island
#

what a lovely mod name

red tiger
#

( is anti-cheat guy)

jaunty marten
#

yea but still poor text input

sour island
#

Why does a cheatmenu have a lua interpreter?

jaunty marten
#

it's maximum in pz for now

sour island
#

Oh - it's actually like cheating tools?

jaunty marten
red tiger
#

Lol.

sour island
#

When I think of cheat menus I assumed it'd be like for single player use for more or less spawning items, god mode, traits, xp, etc- that sounds more like a debug tool

pulsar heath
bronze yoke
#

i'd take a complete guess that the creator just created it as a utility for themselves anyway and at that point you may as well include it, it does somewhat fit

jaunty marten
#

tbh good thing cos at least for me almost all useful functions are there and no need to create mine dev menu

sour island
#

What does the show modData window look like?

jaunty marten
red tiger
#

Lol. Reminds me of a cheat mod for mp that tried to call itself anti-cheat.

sour island
#

nah - show modData isn't vanilla

jaunty marten
sour island
#

AUD has one - so I'm curious - hmmmm

jaunty marten
sour island
#

ah - it's aud then

sour island
#

I'm improving off of AUD atm

#

lmk if you find any issues or want to test what I have

#

Also supports cars, zombie, corpses

red tiger
red tiger
jaunty marten
sour island
#

Also did this the other day

red tiger
sour island
#

Nah, I asked aileron if it would be ok to use his mod as a base and give it a face lift

#

This window is pulling the options off of the cheat menu and decorating the functions into toggles

jaunty marten
sour island
#

Probably create a new mod

jaunty marten
#

oh, cool

red tiger
#

I love improved UI projects..

#

Even better when commissioned.

sour island
#

Not to rehash the past convo about steam workshops - but I don't think Aiteron would want me to nag him to upload stuff lmao

red tiger
sour island
#

Requires 2FA spoofing afaik

#

or disabled 2FA

open drum
#

hello fellow modders

#

i bring a question today which is bugging me for couple of days now

jaunty marten
#

hello there

open drum
#

could someone explain why VirtualZombieManager.instance:createRealZombieNow(X, Y, Z);

#

this works

#

while VirtualZombieManager():createRealZombieNow(X, Y, Z);

#

this brings null error?

#

thought .instance is just a variable

red tiger
#

VirtualZombieManager is that class.

open drum
#

yes

jaunty marten
#

VirtualZombieManager even not a function or metatable

red tiger
#

You can't execute a class object

jaunty marten
#

it's just a table with some functions

faint jewel
#

๐Ÿ˜

red tiger
sour island
#

do you mean to have written VirtualZombieManager:createRealZombieNow(X, Y, Z); ?

#

and is your question about instances?

open drum
#

im sorry, since im a beginner python user, i thought one can call a class.. i guess it works differently in Lua

open drum
jaunty marten
red tiger
#

Lua uses colon like python passes self to calls for instances

sour island
#

it's the created object from the class

open drum
#

ah

sour island
#

I'm not 100% sure why it needs one - or if it even has one

#

there should only be 1 zombiemanager

#

Maybe a java -> kahlua -> lua thing

red tiger
#

So foo:bar() is the same as foo.bar(self)

open drum
#

oh..

red tiger
#

Thought explaining that would help you with python xp

sour island
#

But you'd only instance something if you needed to have multiple instances of it?

#

I think IsoWorld does something wacky where it creates an instance to use for getWorld

sour island
#

and using IsoWorld. in Lua returns the original

bronze yoke
#

when i googled why you would use a singleton, literally all i could find was 'don't', so i have no idea

open drum
#

hmm i see

red tiger
#

I singleton in my job.

bronze yoke
#

i didn't look too deeply but that was the theme of the first few results

sour island
#

what's a singleton? .?

red tiger
#

Keep OOP while coding global code? Hell yeah

open drum
#

one more question, im trying to study how to change an attribute of zombies (such as strength, speed and health)

red tiger
#

Java singletons are common practice

open drum
#

Im guessing the attributes are saved in Class IsoZombie

#

i have found strength and speed in there

#

but coulnd't find the health

#

is the variable in a different name ? or am i looking at a wrong class?

#

i've tried to search it on forum but couldn't find any

sour island
#

You can change attributes for single/specific zombies but it's kind of counterintuitive - as zombies constantly recalculate their stats you'll have to plug in the changes onZombieUpdate - if that's what you want

sour island
#

I think IsoZombie uses some variables from IsoGameCharacter - like health

open drum
#

it does say it is inheriting it

sour island
#

the classes for players, gameCharacters, zombies are a bit mangled from new features coming in

#

speed is from gameCharacter but behaves differently in players/zombies

#

if I recall

#

same for health... sort of

open drum
#

so when a zombie spawns, its executing all those 3 classes at once?

sour island
#

it's inherited so yes if you want to think about it that way - but not isoPlayers

open drum
#

i see

sour island
#

isoObject -> isoMovingObject -> isoGameCharacter
| |
isoPlayer isoZombie

#

it forks

#

idk if I've conveyed that well

open drum
#

so my guess is that in order for me to keep the zombie health stay high ( for example 400) ill have to execute the check event for every tick or so. This brings me a concern of lag issue

sour island
#

Some of the stats don't recalculate every tick

open drum
sour island
#

also speed is forced into the 3 vanilla speeds

#

you can't have variable speeds

open drum
#

ah

sour island
#

I wanted to have a zombie be even faster than a sprinter ๐Ÿ˜ฆ

open drum
#

:(((

sour island
#

you can do whacky stuff with it

#

also zombie health is 2, player is 1

#

keep that in mind making one with 400 HP

open drum
#

haha

#

understood

red tiger
sour island
#

it was the beefy aliens - I wanted them to sprint a bit faster

open drum
#

thanks for all the helpful answers fellows

astral dune
#

wizard zombies that can blink through walls. Fund it

sour island
#

The best is my unkillable Spiffo

red tiger
jaunty marten
open drum
#

xD

sour island
#

the game doesn't like to make zombies have high health - so on death it resurrects a tick later

#

also it is given sight of the closet player within the cell

open drum
#

interesting

sour island
#

it's set to always walk, can't be stomped on, and flips cars

red tiger
#

Undead being undead.. when the bug is the feature.

open drum
#

oh.. flipping cars..

red tiger
#

Where's the gif of a zombie flipping a car onto a house

sour island
#

not on this pc

open drum
#

my aim is to b able to spawn a boss zombie at command

red tiger
#

I stored it too

#

God that gif

sour island
#

took forever to figure out the physics of it - at one point the car just kept spinning

red tiger
#

Is a national treasure

open drum
#

which acts like anyother zombie so i can control its movement like one you see in debug

open drum
red tiger
#

Man.. I want to drive cars on the second story in the malls

sour island
open drum
#

oh gee

humble oriole
#

Anyone know if you can get the rcon password from debug?

sour island
#

meant to mimic the nemesis or jason

#

as it always shows up and follows you

open drum
limber oar
#

i do want to try a nomad run one of these days

#

i always end up hunkering down and building a base but it would be nice to have an impetus to keep moving

#

i was thinking of downloading that Kino's Journey mod and following her "no longer than 3 days in one location" rule lol

red tiger
sour island
#

One of the more rigid classes in terms of whats available

#

for the flip I'm applying a rotation manually - I don't think there's a way to apply a force

red tiger
#

I think that I am going to aim for a release of a Java mod this weekend.

sour island
#

the issue in the gif is it's too close to the house and the car is trying to flip itself back

#

I think they made cars alot more flip happy

#

there's a java mod on steam for better physics

sour island
#

includes the car not screeching to a stop when someone gets out

red tiger
sour island
#

I can finally enjoy my rollout mod to its full potential

red tiger
#

My mod will unlock the potential for full shader support.

#

Gotta clean it up before releasing it

sour island
#

๐Ÿ‘

#

Would be cool to play as poor eyesighted character

sour island
#

I kind of hope client based experiences become more of a thing

#

like an identification system would be neat - where 1 player can see information others cannot

red tiger
#

Dnd mod when?

sour island
#

dabbling in injuries/diseases (zoonotic with animals coming soon), and needing more first aid skill to understand what each drug would be for is a neat concept to me

#

otherwise you just see the actual name of the drug

#
  • knowing how much is needed
#

barotrauma does this nicely as not having enough medical skill results in the game suggesting horrible treatments

#

rub some ointment on that broken bone

bronze yoke
#

i thought that was the game being weird and did it anyway ๐Ÿ˜…

#

first aid is weirdly weak in zomboid, kind of a nothing skill, so anything to make it more useful sounds good to me

#

specifically a proper implementation of client-sided item names would be nice - the way vanilla does it isn't that clean and doesn't suit every purpose

sour island
#

seeing/masking player's identities would be fun too

ancient grail
rain shard
#

Opening the RecordedMedia folder to figure out how the VHS and CDs play their script and take a look at it

#

Ah. I see. Each line has its own dialogue line. Let me just then reference these lines!

#

I've made a mistake.

dreamy hamlet
#

hey ive got an idea for a mod anyone know whom im to talk to for help making itl be my first mod

limber oar
#

What sort of mod?

rain shard
#

Question for anyone familiar:

I've got an output from WordEd, but I want to use it for CDs instead of a radio broadcast. Is there something else I have to generate beyond copying the format the lua has in the recorded_media lua?

sour island
#

is table.unpack available/exposed? seems to be throwing an error

#

forgot the game uses older Lua, it's just unpack()

tardy wren
#

IS there an event for updating the sandbox option on the server?

pulsar heath
#

?

#

dont know how it works with the server though

golden sparrow
#

Let me send you the exact function

tardy wren
#

I used to cache the settings in my mods and the server owner scolded me since they're already a locally stored array...

golden sparrow
#

Oh okk i don't think so

tardy wren
#

Oh well. I updated my stuff to read the sandboxVars regularly

golden sparrow
tardy wren
#

They're in a nightly coma for the next 12 hours or so so I won't have feedback

golden sparrow
#

Okk good luck then ๐Ÿ˜„

pulsar heath
#

has anyone has tried messing around with the climatemanager?

fast galleon
pulsar heath
#

trying to mess around and trigger storms...
triggerCustomWeatherStage()

#

but from what im reading there is also
transmitTriggerBlizzard()
transmitTriggerStorm()
transmitTriggerTropical()

#

they all use float values right?

#

the float represents what? Duration?

#

the triggercustomweather stage uses two ints

#

but cant figure out what they do... just used a random number in each and nothing happened ๐Ÿ˜„

fast galleon
#

btw I look now at PZCalendar.getInstance() and it always returns a new Calendar.
That means it is a different object every time?

I haven't looked at weather since they updated a few things, so not sure.

pulsar heath
#

it means i have do use a local to get the instance whenever i want up to date values

#

ill post the code i've ended up with

#

a sec

#
        local playerChar = getPlayer()
        local calendar = PZCalendar.getInstance()
        local hour = calendar:get(Calendar.HOUR_OF_DAY)
        local minute = calendar:get(Calendar.MINUTE)
        local second = calendar:get(Calendar.SECOND)
        if hour == 0 then --check if its 0, if true replaces 0 with 24
        TraitEndTime = (24 * 60 + minute + timervalue ) * 60 + second
        else TraitEndTime = (hour * 60 + minute + timervalue) * 60 + second
        end    
        if not playerChar:HasTrait(TWETraitsTable[MyTrait]) then
        playerChar:getTraits():add(TWETraitsTable[MyTrait]);
        table.insert(TWETempTraitsTable, {trait = TWETraitsTable[MyTrait], endtime = TraitEndTime})
        HaloTextHelper.addTextWithArrow(playerChar, getText("UI_trait_"..TWETraitsTable[MyTrait]), true, HaloTextHelper.getColorGreen())
        Events.EveryOneMinute.Remove(TWE_TraitCheck);
        Events.EveryOneMinute.Add(TWE_TraitCheck);
    end
end```
#

then i made a "timer" function

#
        local playerChar = getPlayer()
        local calendar = PZCalendar.getInstance()
        local hour = calendar:get(Calendar.HOUR_OF_DAY)
        local minute = calendar:get(Calendar.MINUTE)
        local second = calendar:get(Calendar.SECOND)
        if hour == 0 then --check if its 0, if true replaces 0 with 24
        currentTime = (24 * 60 + minute) * 60 + second
        else currentTime = (hour * 60 + minute) * 60 + second
        end    
        --print("---twe---------Checking traits------------")
        --print("Current time: " .. currentTime)
        for i, v in ipairs(TWETempTraitsTable) do
        local trait = v.trait
        local endtime = v.endtime
        --print("Index: " .. i )
        --print("Trait: " .. trait)
        --print("EndTime: " .. endtime)
        if endtime <= currentTime then
            print("Removing trait: " .. trait)
            print("Endtime: " .. endtime)
            playerChar:getTraits():remove(trait);
            HaloTextHelper.addTextWithArrow(playerChar, getText("UI_trait_"..trait), false, HaloTextHelper.getColorRed())     
            table.remove(TWETempTraitsTable, i)
            if #TWETempTraitsTable == 0 then
                Events.EveryOneMinute.Remove(TWE_TraitCheck)
                break
            end
        end
        end

end```
#

now the only thing i need to do is to find out why some traits return the label properly and others don't... but thats not something urgent for now

#

so i started working on the next module for the mod... weather events

#

but cant find no info about the values to use on the trigger functions for the weather

#

looking through the vanilla lua, i found some values

#

so i think the 1st value is the type and the second duration?!

#
triggerCustomWeatherStage(3,48);
Tropical
triggerCustomWeatherStage(8,48);
Blizzard
triggerCustomWeatherStage(7,48);
#

the only value that doesnt change is the second arg... so im guessing thats the duration

#

and the first arg the type

#

but cant find any info on it

pulsar heath
#

so i was guessing right... kind off

#

any info of what the stages represent?

#

but what does the stage value represent? The only examples i found are the ones on the vanilla lua that i posted above

#

but i guess those 3 will do

#

nothing happens ๐Ÿ˜

#
clim:triggerCustomWeatherStage(3,48);```
#

no rain nothing

#

oops nevermind... it takes a while

#

ok so the float value is game time hours

fast galleon
#

debug has a Big number of tools to mess with weather. In case you want to test something in particular, once you find what you want you can use that as a reference.

pulsar heath
#

debug crashes my game since the last update

#

thats why im "fishing"

#

but i wonder if i mess around in the debug-ini

#

and change some values to true if it will enabled the debug options that i change to true :\

thick karma
#

(But if you wanna send a sustained forward movement signal using your left joystick in Lua, good luck, pretty sure it's not possible or we don't know how. ๐Ÿ˜ญ)

pulsar heath
#

got the weather bit working, now moving on to more car events... was thinking it would be nice to trigger the alarm of a car or cars near the player and now im entering an area that i know nothing about...

mycar = player:getNearVehicle()```
#

this works if the player is really close to the car

#

any tips of how to detect nearby cars and trigger the alarm?

#

i need to try and reinstall the game again and see if this time that fixes the crash with the debug mode... fishing for code is not fun...

pulsar heath
#

did that as well

#

its a pain having to quit to menu to reload lua

#

change the code in the file load the save again

#

try again... after a few loads restart the game

#

local vehicles = getAllVehicles()
if i print it i get a list of vehicles, but... for some reason i dont think this is correct

#

this is probably the vehicles available in the game...

jaunty marten
sour island
pulsar heath
#

hmm nothing to lose, might as well give it a shot ๐Ÿ™‚

#

hmmm setAlarm(true) doesnt work... lets keep fishing

#

@sour island hows the heat map project going?

#

this mod is awesome!

#

i give up on the alarms for now... but its something nice to add... trigger car or house alarms

sour island
#

Right now it uses the heatmap alongside the old player targeting if no heatmap info is found.

pulsar heath
#

When you make it available for public use let me know... Wanna make a wandering horde mode, and the heat map would make a lot of things more dynamic

thick karma
#

Anyone have any readily available snippets for checking whether the character is holding a reloadable weapon?

#

All I need to know is whether, not the weapon or anything else.

sour island
#

Adding a require after the fact causes issues as servers will boot up and disable all the related mods.

sour island
thick karma
#

Thanks

sour island
#

There's a few things to check for - chamber(ed) rounds and such

thick karma
#

I actually see something promising but apparently I had to fail awhile and ask before I spotted it.

sour island
#

It has that behavior in there too- just saying there's two kinds of reloadable weapons

thick karma
#

Bah doesn't give me what I hoped... booo.

sour island
#

There's all the related functions in there though

#

You might not be able to only use 1 function - but what about getMaxCapacity?

red tiger
#

Any community-released API = drool.

thick karma
#

@sour island getPlayer():getSecondaryHandItem():isReloadable(getPlayer()) (or Primary, obv.)

pulsar heath
thick karma
drifting ore
#

Hey guys, think this is a good place to ask. I heard you can program mods for this game in Java and Lua, is that true?

#

I'm thinking of getting more involved in learning programming in Java so this might be a good start if it is possible

#

I heard it's frowned upon for some reason, dunno why

#

(making mods in java)

#

Ohhh they said because you can't put them on the workshop

#

Now I remember

thick karma
#

You can, however, your end users will need to download an off-workshop program for injecting Java mods, and that program comes with a pretty big caveat that the Java side of modding is open season when it comes to running arbitrary code on their PCs, which may scare away some users. @drifting ore

#

Lua mods remain more user-friendly. Not always as good at or even able to get the job done, depending on the job, but I think a lot of modders are worried about user-friendliness. At least I am.

jovial harness
#

Is there a way to prevent commands from writing in the player's chat? For example the command "/createhorde2" writes "Horde Spawned" in the chat. Or is there a way to clear just one message from the chat ?

finite radish
#

to add to what Burryaga said:
what's a little misleading is that you're really writing Java using Lua syntax in like 95% of the code. there isn't a true Lua API other than for interacting with certain things (events, for example). the majority is just automatically converted Java objects and methods, so it's incredibly hacky and things rarely work the way you'd expect if you understand only Lua or only Java.

drifting ore
#

Having to download more stuff just to play doesn't make much sense for users I think as well

drifting ore
finite radish
# drifting ore Interesting. I'll definitely look into Java a bit more maybe it'll help me under...

it'll definitely help, but if you aren't familiar with Lua's syntax it'll also be pretty confusing once you get into it. I highly recommend this: https://github.com/FWolfe/Zomboid-Modding-Guide
the code section in particular. it's helped me work around the quirks and figure out what's inherently weird/janky/busted in the implementation and the workarounds that are necessary to get things functioning properly.

quasi geode
#

nice to see that guide is still useful. need to actually start updating it at some point.

astral dune
#

its probably the best out there currently

drifting stump
drifting ore
#

What is an API for gaming mods? I read a bit online but didn't fully understand. Is it another mod that you attach as a requirement for your own? Like, something really useful that your mod takes advantage of?

astral dune
#

ya pretty much

#

saves you from having to reinvent the wheel, but ties you to somebody elses update schedule. Upsides and downsides

drifting stump
astral dune
#

if its your own api ya, lol. Or "Utility/Library" mod

drifting stump
#

think public repository you can pr to fix whatever you need fixed when you need

drifting ore
#

So like a really basic example to help me understand... A mod that lists every item and renames them to something easily usable and adds a function to extend this example, if you want to spawn cake, you could type in your code spawn(Cake)

#

This is like a trash example but is that what an API does in a nutshell?

drifting stump
drifting ore
#

ScriptManager is what you use to modify / create new items right?

drifting stump
#

yes

#

there you go an example

drifting ore
#

Thanks!

#

Ah so you simplify like Anon said, something everyone uses and make it more accessible

#

Instead of everyone having to make 150000 lines of code

#

They make 100

drifting stump
#

well it doesnt just simplify it enables new functionality too

drifting ore
#

Oh

astral dune
#

Ya, I suppose you can call something that adds new functionality an API too, although maybe not strictly so

drifting ore
#

Sounds like fun to work on

drifting ore
#

How does your mode require another mod as a dependency

#

Mod*

astral dune
#

For example I'm writing a vehicle damage events mod, that makes collisions fire events that others can use to handle damage or other features

drifting stump
#
name=Expanded Hotwire
poster=poster.png
id=expandedhotwire
require=radialmenuapi
versionMin=41.65
description=Adds the ability to unhotwire a car and make keys if the player has high enough skills.
url=
drifting ore
#

Thanks! Saved that msg, useful ๐Ÿ˜

#

So everything inside of the API mod, you can use in your own mod? Like, functions, tables, etc .?

drifting stump
#

for example expandedhotwire replaces the vanilla hotwire slices without overwriting the whole vehicle radial

astral dune
#

in stricter languages, you're only supposed to touch the interfaces the API provides, which is the actual API part of the "API", lua is similar although most people don't seem to write it to limit access to stuff

drifting stump
#

if any mod wanted to overwrite any of the vehicle slices they would have to overwrite the entire function or do some really hacky stuff effectively making it so only one mod could replace

#

the api dealt with this

drifting ore
#

Like instagrams api

raven spoke
#

Hey guys, anyone knows whats the Brush tool/Fast Move called?
i managed to find most of them but not the Brush tool and Fast Move

  player:setGodMod()
  player:setGhostMode()
  player:setInvisible()
  player:setInvincible()
  player:setShowAdminTag()
  player:setUnlimitedCarry()
  player:setUnlimitedEndurance()
  player:setHealthCheat()
  player:setFarmingCheat()
  player:setCanHearAll()
  player:setMechanicsCheat()
  player:setZombiesDontAttack()
  player:setTimedActionInstantCheat()
  player:setNetworkTeleportEnabled()
  player:setShowMPInfos()```
drifting ore
#

You can only use that which is allowed and provided

astral dune
#

which in lua is any global, or local that has been returned

#

but lots of people just make everything global, not because they want you to access it they just don't know any better, lol

drifting ore
#

So that loops us back into using modules in lua right?

astral dune
#

yes, thats part of properly scoping a lua project

drifting ore
#

Nice

#

I'm gonna learn a bit more about what goes into this and see if I can write one of my own as a test

#

Sounds like it could be useful to others if done properly

astral dune
#

If you can compartmentalize some of the boilerplate or tedious things people often have to do, it likely will be. Just don't pull an ItemTweaker and become really popular while also screwing up everyone's load times, lol

drifting ore
#

I don't have much knowledge in coding but I do have a big willpower when it comes to datamining and alike so might try something with that ๐Ÿคฃ

#

Whats itemtweaker

finite radish
#

a lot of "API"s on the workshop are actually libraries, and a lot of libraries are actually APIs. they're similar and definitions vary, but imo they're distinct

put simply:

  • a library is a collection of useful code/snippets/functions/etc. for a fairly broad range of functionality
  • an API (application program interface) is an interface (duh) for code that's either fairly annoying to interact with, in a different format/location, or for simplifying the functions normally used to access the underlying code
drifting ore
#

Interesting

astral dune
#

which is why I said you may not call some of these things API "strictly", but colloquially its the same

drifting stump
#

what if you combine both and have a framework

finite radish
#

pretty much a small summary though, and people argue about the definition of all of the above constantly

#

even experienced senior devs sometimes argue about the difference between a framework, an API, a library, and a ton of other vague terms that have been misused over generations

astral dune
# drifting ore Whats itemtweaker

an API (more of a wrapper) that handles messing with item scripts. It also prints every single change during loading, which is super duper slow. What it does is actually so simple I don't think anyone should use it

drifting ore
#

Oof

#

Print has that much of an effect in code?

astral dune
#

print is very slow, comparatively

drifting stump
#

prints in kahlua are the devil

drifting ore
#

LOL

#

Gotcha

drifting stump
#

@quasi geode expose logger pls thx ty

astral dune
#

IIRC Tyrir made either his own itemtweaker or some patcher for it that caches all the print strings and then just prints one big list at the end. Made it like 100x faster

drifting stump
#

that should be enough iirc

#

one more 0 and its a crash

sour island
#

Is the issue because of the output render or is it laggy even without it?

#

To clarify - the visual output in debug mode - or is even adding to the text log also laggy?

astral dune
#

anywhere and everywhere

sour island
#

Perhaps having halo text or using say() should be normalized for debug messages

#

Or even a custom UI that scrolls?

#

Personally I try to have getDebug() enclose prints

#

Sorry to the 6 people that legitimately play in debug mode ๐Ÿ˜…

astral dune
#

ya, my modules always shadow print, and change its behaviour based on debug mode. I feel like its good practice

finite radish
#

yeah imo mods should ship without any prints at all - either comment everything out or use a debug flag conditional

#

performance in debug is already skewed anyways, so may as well go wild with them otherwise

ancient grail
red tiger
sour island
#

Console output is also doubled since MP release

#

I include a lot of prints for EHE troubleshooting - what would be an alternative? Text editing/writing?

#

Would it be any different to print at that point?

drifting stump
#

hmmm a ui for debug prints might be a good performance fix

#

though it wont work on servers

sour island
#

Working on a significant update to EHE so prepping troubleshooting now will shave off a lot of work later ๐Ÿ˜…

finite radish
#

significant = flyable helicopters? Pog

finite radish
ancient grail
#

@quasi geode congratulations

sour island
#

So it's just ID info and x/ys for events when states/target change

astral dune
#

if its not happening every tick I wouldn't worry about it too much

#

If there is a way to set up a client-side-only config file where someone could enable/disable troubleshooting messages I would personally do that, but I don't know what kind of lift that is

finite radish
stray yacht
#

Hey all is ISCharacterScreen still a thing? I'm looking for it in the vanilla lua client folder but not seeing it there. I see mods calling it so it's got to be around somewhere...

vast nacelle
stray yacht
#

Xp system!!! Thank you ๐Ÿ™

#

(Good old windows explorer file search being as useless as ever, should've caught that)

vast nacelle
#

Listary is a blessing

stray yacht
#

Oo I'll look into that

stray yacht
finite radish
#

why bother with a different app when VSCode already lets you search by filename PepoThink

#

just ctrl+P and bam

#

you're there

#

(or if you're using intellij, I'm sure there's an equivalent command)

#

(and if you aren't using one of those two for modding then wtf are you doing with your life)

drifting ore
#

as a mapper also i prefer it

#

i dont use vscode to do everything

astral dune
#

intellij searches by filename by double tapping shift, and inside the files through a context menu, but ya I'm downloading this as soon as I get home

drifting ore
#

good to know also ty

#

also is there a way to integrate libraries in vscode like i have setup from the guide for intellij?

#

i figure i can just use the already decomplied libraries but i havent found the way to import them for usage in vscode. love intellij but its base program is super clunky and not straightforward to me

astral dune
#

the decomped libraries should work, but capsid also produces emmylua notations which make intellij the superior choice

cosmic condor
#

How accurate is the "clear description for Moodles" mod?

#

seems like there are many factors taken into account

drifting ore
#

it tells you specifically what stats are added/removed by the thing that causes the moodle. at least assuming you are talking about same thing. like if you obtain the ability to read nutritional values from the thing that generates the moodle. it should show that. or if you get 10% xp bonus or w/e

#

seems to be based on exactly what you gain/lose though for the most part. im sure there is at least one instance where it doesn't work perfectly in that regard

#

does that not make sense? lol

cosmic condor
#

I just want to know where those buffs and debuffs are from

drifting ore
#

if you haven't i'd just check the code out. i havent seen if its a library or not

cosmic condor
#

I've been going through the vanilla lua, but there are far too many points to consider

drifting ore
#

i meant the mod code ๐Ÿ˜›

#

you will see where it obtains the values from

#

if it pulls from the mod that has the moodle or if it uses its own "translated library"

cosmic condor
#

The mod has no lua code. It's just a pure text translation. ๐Ÿ˜…

drifting ore
#

then easy. just converts the values into readable

cosmic condor
#

that's why I would like to know where do they get those numbers

drifting ore
#

i will look at the code of the mod itself and can probably tell you

#

the numbers are predefined in the translation

cosmic condor
#

YES

drifting ore
#

it looks like it decides what the number is

#

no matter what the number is

#

or verbiage

#

so if heavyload is level 4 moodle it's going to say "-20% crit. chance<br>-0.28 attack speed<br>+52% trip chance<br>-32% climb chance<br>-60% speed<br>reduced endurance<br>run/exercise disabled<br>losing HP", no matter what the value is

#

depending on what it pulls

cosmic condor
#

I mean, I would like to know how do they get these number

drifting ore
#

100% got you

#

sorry for useless answer i seee what your question was now

fast galleon
#

from decompiled code

cosmic condor
cosmic condor
#

It's been almost a year since the mod was published, and that's before I got to know PZ

finite radish
#

there haven't been any major changes that I'm aware of that'd affect those values in the last year

#

I haven't kept up with minor patches though, so maybe I missed a few

pulsar heath
#

so im still trying to trigger alarm of a nearby car/house to go off... but now that i had a break and think a bit more... in vehicles the only thing i found related to alarms is 2 booleans isAlarmed() and setAlarmed(), so... i should be looking for something related to sound events to check if the car isAlarmed is true and to trigger the sound in the car location ?

finite radish
#

(or whatever - I don't know if things other than breaking the window can trigger it)

pulsar heath
#

hmmm thats a fair point

finite radish
#

(or your decomp, if that's separate from your workspace)

pulsar heath
#

been looking throught the files the whole day ๐Ÿ˜„

#

learned a few useful things, but also got a lot of dead ends

finite radish
#

wat

pulsar heath
#

nop

#

i found isAlarmed not long ago

#

was looking just for alarm

#

i've been looking not only for that

#

got the weather triggers figured out

#

the fog... almost

finite radish
#

did you follow isAlarmed to see what it executes?

pulsar heath
#

when i search the file contents i searched for anything containing "alarm"

#

in the process of it

#

following the bread crumbs

#

thats what lead me to the possibility of a sound trigger

finite radish
#

took me like 10 seconds to find it, and I didn't even have my editor open

#

gotta work on your ctrl+shift+f skills

pulsar heath
finite radish
#

...bro LMAO

#

are you using notepad to edit?

#

i'm so confused

pulsar heath
#

notepad ++

finite radish
#

ew

#

okay go download VSCode

drifting ore
#

i thought you got intellij setup also mess

#

wiuth lib

pulsar heath
#

i do ... i just dont... like it...

finite radish
#

intellij also works, I'm less familiar with the commands in it but it's also ctrl+shift+F there

drifting ore
#

lmao dont blame ya

finite radish
#

just... don't use explorer lmfao

#

ever

drifting ore
#

is there a way to import libs for reference in vscode?

finite radish
#

that's insane

pulsar heath
#

why not?

finite radish
#

because it's complete dogshit?

pulsar heath
#

i have it setup to look inside the files

finite radish
#

and takes ages?

pulsar heath
#

never let me down so far

finite radish
#

that's not the point LOL

#

okay you have fun with that

#

if you're a masochist that's fine, I accept you, just don't ask for help finding stuff

pulsar heath
#

im not always at my main pc

#

so, i got used to use tools that work on any potato machine

cosmic condor
#

VS Code is potato machine friendly

finite radish
#

VSCode works on anything, it's portable and optimized as fuck

#

yeah lol

cosmic condor
#

My PC is from 2014

finite radish
#

I'm on my shitty laptop right now and I just found that in under 10 seconds

pulsar heath
#

will instal vcs

#

havent used it... in like ages

drifting ore
#

it's really good

pulsar heath
#

but its better than intelli ๐Ÿ˜„

drifting ore
#

i like it over intellij even without libs

#

tons of usefull addons also to imporove productivity

finite radish
#

i use intelliJ for decomp, VSCode for lua

pulsar heath
#

i use notepad and notepad++ for lua ๐Ÿ˜„

drifting ore
#

i saw external library reference in vscode im going to look into that

pulsar heath
#

only open intelli to check the syntax of things i want to use

cosmic condor
#

I ditched Notepad++ since I get to know VS Code

finite radish
#

notepad and notepad++ are dogshit

#

that's coming from me using notepad++ for 10+ years

#

i'd sooner use Sublime or Atom, but even those don't hold a candle to VSCode

cosmic condor
pulsar heath
#

as long as i can type and save file

#

its good enough ๐Ÿ˜„

#

but better is always welcome

cosmic condor
#

it can run on a browser, so your potato pc surely can too

pulsar heath
#

not at my potato pc

#

no problems running anything on this one ๐Ÿ™‚

#

the one i was using a few hours ago its a potato... i7 second generation

#

๐Ÿ˜„

#

still works well enough for basic stuff

cosmic condor
#

mine is 4th lol

#

lots of things will get unsupported soon

#

10 years pc challenge

pulsar heath
#

i've kept my amd skt 939 x64

drifting stump
#

vscode is definitely not "optimized" its made in electron

pulsar heath
#

using that is a challenge

#

but it still works fine for... normal daily use kind off

#

that pc should be hitting the 19 years mark soon

#

i think i got it in 2004 or something

finite radish
#

jesus

pulsar heath
#

hey, it has xfx nvidia 6600 gt sli

#

๐Ÿ˜„

cosmic condor
#

the cost to keep that alive maybe more expensive than buying a new one lol

pulsar heath
#

how thing were so dumb back then

#

its more like a souvenir, and retro is mainstream now... so im not a weirdo for still having my amiga 500

#

๐Ÿ˜„

finite radish
drifting stump
#

electron has massive overhead

#

its a trade off between dev speed and performance

pulsar heath
#

speaking about perfomance... lets check on the app and see if its still working... left it running on a potato pc and should be running for about 6h now...

#

so if it works well on that junk, it should work on any modern pc

finite radish
pulsar heath
#

who has 2gb of ram these days?

#

the lowest end specs averages at 4gb

drifting stump
#

im not talking about ram it exists to be used

#

cpu cycles are holy

finite radish
#

i'm on a shitty old i3 and I can run electron apps just fine lol

drifting stump
#

which is why i said "optimized"

finite radish
#

the quality of the code matters way more

#

there isn't really a good alternative, either

#

electron is pmuch the best option there is

drifting stump
#

there is

#

C or asm

finite radish
#

neither of which run JS?

#

like what

drifting stump
#

exactly

finite radish
#

"ignore platform, just re-code your entire app!"

pulsar heath
#

assembler....

#

dont miss using that

drifting stump
pulsar heath
#

theres is always a trade off no matter what the language

finite radish
#

...if "dev speed" is "make your team re-code across several languages, platforms, and targets" then... sure?

#

but that'd be insane

pulsar heath
#

some have more of a trade off than others

golden sparrow
#

Would someone happens to know if I put a function on WorldSoundEvent client side and call sendClientCommand will the command server side be triggered multiple time if there's multiple player around the sound event ?

finite radish
#

like, no one would reasonably do that - because it'd be stupid

pulsar heath
drifting stump
#

im not sure what youre trying to argue here i simply said vscode is built on an objectively slow platform though it doesnt need more performance

drifting stump
finite radish
#

I wouldn't call it a slow platform by any means, and it isn't unoptimized. just because something is faster doesn't mean that the thing it's faster than is slow

like, I'd consider Usain Bolt pretty fast. but a jet is faster. does that suddenly mean usain bolt is slow? nah.

drifting stump
#

yes

finite radish
#

but comparing a native-focused, restrictive, non-portable desktop app to a web app is ridiculous (like comparing a runner to a jet)

drifting stump
pulsar heath
#

this has escalated quickly

drifting stump
#

anyway these technologies give me a job

finite radish
drifting stump
#

without them being slow i wouldnt be a performance engineer

golden sparrow
pulsar heath
#

getNearVehicle has a very limited range

drifting ore
pulsar heath
#

need to find another way

drifting ore
#

i forget, what is your goal?

#

it's car alarm, but from twitch?

pulsar heath
#

trigger car and houses alarms in a certain radius

#

yup from twitch ๐Ÿ™‚

drifting ore
#

ah

pulsar heath
#

zombies, items, traits, helis, weather, and some car events done

#

now to add more stuff

drifting ore
#

i thought there was a chunk option also

pulsar heath
#

also trying to work on the fog

drifting ore
#

or at least beiung able to trigger by that. i also gues i dont know how you are trying to implement it specifically

pulsar heath
#

but thats not a priority

drifting ore
#

there are two mods using fog very sepficially that will help you

#

one is by soul filcher

#

toxic zones

pulsar heath
#

well, when i figure out howto implement it ill let you know :D... still fishing for ways to do it

drifting ore
#

helps define zones for that type of event at least. not sure if it uses fog though so maybe not great for this usage but maybe could be for other things. i'm looking for other options for the alarm

#

maybe the unused vanilla will work better for that function lol

#

i see a commented out section that is supposed to do same thing

pulsar heath
#

ill probably need to define a radius and sort through the objects in that radius and grab all the cars found

drifting ore
#

no idea if thats outdated or just unoptimized

#

thats probably your best bet honestly

pulsar heath
#

yeah... then from what im reading if the car has the keys in the ignition the alarm wont trigger...

#

now i know why this one didnt trigger the alarm when i tested the command

cosmic condor
pulsar heath
#

anyone who streams on twitch can use it

#

it uses a app with the twitch api library built in

#

so as long as you have an account on twitch you can use the mod

#

made the 1st version around one year ago, perhaps more ...

drifting ore
#

i think i saw someone also grabbing object and using car parts instead of whole car also

pulsar heath
#

so im re learning everything i knew about pz modding...

pulsar heath
#

i use that for the car events ( engine stall, drain gas, etc )

#

also finished the temporary traits option thanks to @dull moss

pulsar heath
#

the 1st version depended on virtual keypresses sent from touch portal... so this time i thought... just make your own app and make the config easier for anyone who wants to use it, and also, that way i dont have to worry about the limitations of the software used as middleman between twitch and the game

#

if i want to do something i just code it in the app and make the mod deal with the app response

#

ok got the alarm thing sorted. now just need to make a function to grab all cars in a raius and randomly set the alarm of one or more

#

but first... find out how to stop the damn alarm lol

red tiger
#

Reminds me.. I need to update the LuaCommands Java mod for streamers to craft custom commands for their Twitch channels.

#

@alpine scroll

#

Am approaching having enough time to work on things again. =)

pulsar heath
#

well when code doesnt work just pull the battery out...

drifting ore
#

oh wait one sec...

#

onDisableAlarm doesn't work?

#

nm im dumb

pulsar heath
#

isnt that related to when the alarm is disabled?

#

ok im just being dumb as usual

#

forgot to set isAlarmed back to false

drifting ore
#

oh lol

pulsar heath
#

๐Ÿ˜

drifting ore
#

was gonna say removing battery isn't ideal so glad you got it figured out

pulsar heath
#

it isnt but its better that the thing not shutting up

pulsar heath
#

thanks

#

๐Ÿ™‚

ancient grail
opal rivet
#

is anyone a good coder?

#

Because I need someone for it

#

I tell you why I want a coder so DM

pulsar heath
#

why dont you just say what you need? And maybe someone around can help you out

opal rivet
#

I'm planning to make a mod M3ss

#

I won't take the credit to myself

#

I just want to make a mod where cars can have snow on them when It's snows

#

That's what I need

#

If there's no help for me then I'm fine with it

#

I know there is mod that has it

winter thunder
#

If I add an event that already exists, will it run the same event twice? Or will it just not add bc its identical

pulsar heath
fast galleon
winter thunder
fast galleon
#

That's hard to understand
do you want to make a new Event like OnTick
or add a function to an event that already exists?

red tiger
#

Do you want to mod the textures or both the model and the textures?

#

(Imagines lumps on the car)

opal rivet
#

We could do both

#

Textures I can do

#

Models as well

pulsar heath
#

see, you already found someone to help you ๐Ÿ˜„

red tiger
#

It'd also be cool to add the option to blur the screen when the windows of the car fog up from the difference of temp inside and outside.

opal rivet
#

That would be cool too

#

Like you have to wipe off the snow out of the windows

red tiger
#

Will be possible once I release my shaders core mod. (Plan to in the coming week)

opal rivet
#

There's this mod

#

But it uses rust

#

as the format it's just a texture

#

I want it to be more then that

#

That might be cool

red tiger
#

I wouldn't blame them for the texture-only application.

opal rivet
#

Neither do I

#

lol

red tiger
#

What would be cool is if you could add child-models to the parent-model being the car. That way we could add 3D snow clumps as an additional model to the car without having to modify the car model.

#

_>

#

<_<

red tiger
#

Would be epic to get that sort of solution. (model hierarchy)

winter thunder
# fast galleon That's hard to understand do you want to make a new Event like` OnTick` or add a...

Sorry- I am trying to hook onto Event.EveryOneMinute

I do Event.EveryOneMinute.Add(MyFunction) that triggers when the player consumes a specific item. Then, that function has its own exit, where it will count the remaining duration and then when that hits 0 will do Event.EveryOneMinute.Remove(MyFunction)

I just want to make sure that when I add my function to the event manager, it wont create duplicates. So- I dont want 20 instances of MyFunction running if they consume 20 of the item. If that makes more sense

red tiger
#

Going AFK. Clocking out of work.

#

Man PZ is so alien to me with 3D models.. That's definitely a good thing to see them in the game now.

#

woot.

astral dune
#

iirc the kentucky vehicle overhaul mod does that for the vanilla ones. And plenty of the modded vehicles come with that by default

opal rivet
#

Yes

#

It's also in vanilla game as well

#

I show you

fast galleon
opal rivet
ancient grail
opal rivet
fast galleon
#

otherwise check length of counters, no sure on the exact format

opal rivet
#

You can play and use them in game as well

#

Which is pretty cool

#

There's only two of these models that has interiors

pulsar heath
#

i remember seing a mod that added realistic action into a military truck, like opening doors, hood etc

#

pretty cool

winter thunder
pulsar heath
#

with very well designed animations as well

opal rivet
#

That's right

astral dune
#

I guess you guys glossed over my post, lol

#

replaces all the vanilla vehicles with ones with animated doors and trunks and stuff

pulsar heath
#

so if someone has the buff or debuff from consuming food, everytime they do it if the counter > 0 then just add to the counter

#

if the counter reaches 0 the buff or debuff is removed

opal rivet
pulsar heath
#

i actually did something similar for temporary traits yesterday but based on real world time

drifting ore
# opal rivet What do you mean?

someone asked about if this was built into game or not. while the functions are, the usage isn't. that is what anon was sharing.

pulsar heath
#

@winter thunder

        local playerChar = getPlayer()
        local calendar = PZCalendar.getInstance()
        local hour = calendar:get(Calendar.HOUR_OF_DAY)
        local minute = calendar:get(Calendar.MINUTE)
        local second = calendar:get(Calendar.SECOND)
        if hour == 0 then --check if its 0, if true replaces 0 with 24
        currentTime = (24 * 60 + minute) * 60 + second
        else currentTime = (hour * 60 + minute) * 60 + second
        end    
        for i, v in ipairs(TWETempTraitsTable) do
        local trait = v.trait
        local endtime = v.endtime
        if endtime <= currentTime then
            playerChar:getTraits():remove(trait);
            HaloTextHelper.addTextWithArrow(playerChar, getText("UI_trait_"..trait), false, HaloTextHelper.getColorRed())     
            table.remove(TWETempTraitsTable, i)
            if #TWETempTraitsTable == 0 then
                Events.EveryOneMinute.Remove(TWE_TraitCheck)
                break
            end
        end
        end

end```
drifting ore
#

thank you also. didn't know this was a thing

winter thunder
# pulsar heath <@226756001628422145> ```function TWE_TraitCheck() local playerChar = g...
  local drugDuration = itemMD.SPDurations

    if drugCore.SPDurations.Stimulants == 0 then
        drugCore.SPDurations.Stimulants = drugCore.SPDurations.Stimulants + drugDuration
        Event.EveryOneMinute.Add(BaseStimulantEffects)
    else
        drugCore.SPDurations.Stimulants = drugCore.SPDurations.Stimulants + drugDuration
    end

So- Something like this? That way I don't add the function unless the duration is already 0

#

I know it has a lot of my own specific naming- But it basically checks the mod data of the item for the duration value, and the mod data of the player for the remaining duration

golden sparrow
#

Oops wrong comment srry

#

@winter thunder

fast galleon
golden sparrow
#

Like you can add an event several time it won't trigger multiple time

astral dune
#

some mixing of terms here. OnTick is an Event, the functions you pass to it don't really have a name, but EventHandler would be more apt

#

trying to add the same Event multiple times does nothing, but multiple handlers to one event is different

golden sparrow
#

I mean having a function added multiple times to an event

astral dune
#

Is that true?

pulsar heath
#

it makes the game go bananas sometimes

#

i made the game crash yesterday

#

because i added the same function several times

golden sparrow
#

If Events.OnEquipPrimary.Add(OnEquipPrimary) is added 10 times the function won't trigger 10 times when you actually equip a primary

pulsar heath
#

but i was using the lua interpreter inside the game

golden sparrow
#

At least from what i've seen in debug

pulsar heath
#

so that might be the reason why

astral dune
#

thats good, but I assume if you pass a closure rather than a pure function it will probably consider it a separate thing

pulsar heath
#

i need a break from raging at my code, so ill guess ill go rage at hs rng ๐Ÿ˜„

red tiger
#

You could also wrap the function inside of another.

astral dune
#

just saying that Events.OnTick.Add(myFunction) will probably ignore extra calls with but Events.OnTick.Add(getMyClosure(data)) probably won't, even with the same data in the closure

red tiger
#

Kahlua's vm translates back and forth with functions as LuaClosures.

I'm clarifying for anyone who doesn't know.

#

All good.

fast galleon
#
zxTest = function()print("test")  end
for i=1,10 do
    Events.OnContainerUpdate.Add(zxTest)
end
--then do
triggerEvent("OnContainerUpdate")

10 prints

#

@golden sparrow

astral dune
#

mystery solved, extra registrations are no good

red tiger
#

Events uses equals check as a map of collections and I think that the hash code is calculated in LuaClosures.. not 100% sure..

golden sparrow
fast galleon
#

SP side?

golden sparrow
#

I must have been wrong in my belief good to know ๐Ÿ˜„

astral dune
#

so then, what does this do? ๐Ÿค”

Events.OnTick.Add(myFunc)
Events.OnTick.Add(myFunc)
Events.OnTick.Add(myFunc)
Events.OnTick.Add(myFunc)
Events.OnTick.Remove(myFunc)
golden sparrow
#

vs lua/server/

winter thunder
#

Everyone act cool- We have a new celebrity typing ๐Ÿ‘€

quasi geode
astral dune
#

well there we go

#

so keep track of your event handlers, cause this could get out of hand quick

winter thunder
#

Ughhhhh.... I am still having errors pop up in game ๐Ÿ˜ญ

I would really appreciate having someone look over my Lua. Idk if I am handling my tables incorrectly, but I am consistently getting issues with the game reading/writing to my mod data

astral dune
#

post it, if you dare

winter thunder
#

This is a function triggers as an OnEat function

function TakeMeth (food, player)
    local modData = player:getModData().StreetPharma
    local drugCore = modData.SPCore
    local itemMD = food:getModData()
    print("Player has taken drugs.")

    local drugPotency = PotencyMod(player, itemMD.SPPotency)
    drugCore.Stimulant = drugCore.Stimulant or 0
    drugCore.Stimulant = drugCore.Stimulant + drugPotency
    print("drugCore.Stimulant = " .. drugCore.Stimulant)

    if drugCore.SPDurations.Stimulants == 0 then
        Event.EveryOneMinute.Add(BaseStimulantEffects)
        print("Began Base Stimulant Effects")
    end

    local drugDuration = itemMD.SPDurations
    drugCore.SPDurations.Stimulants = drugCore.SPDurations.Stimulants + drugDuration
end
#

this is the PotencyMod function called in the middle there

local function PotencyMod(player, potency)
    local base = 1

    if player:HasTrait("Emaciated") then
        base = 1.5
    elseif player:HasTrait("Very Underweight") then
        base = 1.25
    elseif player:HasTrait("Underweight") then
        base = 1.1
    elseif player:HasTrait("Overweight") then
        base = 0.9
    elseif player:HasTrait("Obese") then
        base = 0.75
    end

    if player:HasTrait("IronGut") then
        base = base * 0.9
    elseif player:HasTrait("WeakStomach") then
        base = base * 1.1
    end

    local finalPotency = (base * potency)

    return finalPotency
end
#

And this is my function that initializes the mod data on the player

function InitializePlayerDrugData()
    local modData = getPlayer():getModData()
    modData.StreetPharma = modData.StreetPharma or {}
    local playerMD = modData.StreetPharma

    playerMD.SPCore = playerMD.SPCore or {}
    local drugCore = playerMD.SPCore
    drugCore.Stimulant = drugCore.Stimulant or 0
    print("drugCore.Stimulant = " .. drugCore.Stimulant)

    playerMD.SPDuration = playerMD.SPDuration or {}
    local SPDuration = playerMD.SPDurations
    SPDuration.Stimulant = SPDuration.Stimulant or 0
    print("SPDuration.Stimulant = " .. SPDuration.Stimulant)

    playerMD.SPDrugTiers = playerMD.SPDrugTiers or {}
    local SPDrugTiers = playerMD.SPDrugTiers
    SPDrugTiers.Stimulant = SPDrugTiers.Stimulant or 0
    print("SPDrugTiers.Stimulant = " .. SPDrugTiers.Stimulant)

    print("Initialized Player Mod Data for StreetPharma")
end
Events.OnCreatePlayer.Add(InitializePlayerDrugData);
#

And, here is an example of one of the item scripts

#

(names are currently just for testing purposes lol)

item MethBagBlue
    {
        DisplayName = Blue Razz Meth (Caffeine),
        Type = Food,
        Weight = 0.1,
        HungerChange = -10,
        WorldStaticModel = MethBagBlue,
        Icon = MethBlue,
        CustomContextMenu = Smoke,
        OnEat = TakeMeth,
        SPPotency = 1,
        SPDuration = 15,
    }
jaunty marten
#

will be cool to see error msg too ded

#

@sour island btw can u add button to delete single error and completely clear the list of ones in errorMagnifier?

astral dune
#

which line in InitializePlayerDrugData is 116?

jaunty marten
winter thunder
#

This one

playerMD.SPDuration = playerMD.SPDuration or {}
    local SPDuration = playerMD.SPDurations
    SPDuration.Stimulant = SPDuration.Stimulant or 0        <----- This one
    print("SPDuration.Stimulant = " .. SPDuration.Stimulant)
astral dune
#

SPDurations vs SPDuration

winter thunder
#

โ€ฆ

#

Thanks

#

๐Ÿฅฒ

astral dune
#

lel

#

obviously its hard to see, or we would have just pointed it out instead of asking for the line

sour island
sick umbra
#

A quick question, I've been analysing some code and very often something like that appears:

aFunction():anotherFunction():someOtherOne()

just want to know if that's like a function inside a function or they just return a table

winter thunder
jaunty marten
sick umbra
sour island
winter thunder
# sick umbra oh, thanks, btw, I've seen `getModData()` but I'm not sure what it means. It's l...

Mod data is a table on players, items, and a lot of other things. It holds whatever you want it to.

So- In item scripts, there are specific variables the game recognizes and knows how to handle. If you add in a variable that the game is unfamiliar with, it will treat that as mod data.

On the player, you can set mod data to keep track of things as well. It is also a table, which can have subtables and variables written to it. So- If you wanted to keep track of the total number of oranges the player has ate, you could create a new variable and function to track that.

--Pretend this function triggers when the player eats an orange lol

function ThisTracksOranges()
getPlayer:getModData().Oranges = getPlayer:getModData().Oranges or 0
-- This funciton would create our variable, so that we dont accidentally try to instance a table that doesnt exist.

getPlayer:getModData().Oranges = getPlayer:getModData().Oranges + 1 
-- Now that we are 100% that it exists, we can modify it
end
winter thunder
jaunty marten
#

hard to see structure of table

winter thunder
#

lol

sour island
#

are your 3 tables only 1 deep?

winter thunder
#

It is 1 table, with the added sub tables. Right now, they are only 1 deep, but that is because my main branch had too many moving parts that I couldnt tell what was breaking lol, so I gutted everything except what was 100% necessary to bug test

jaunty marten
bronze yoke
#

this won't initialise new values if you change the format, but since your mod isn't out yet that's not a concern

sick umbra
#

so it's a place where you can store custom variables... does it come empty by default?

sour island
#

I'd suggest making pseudo-objects and use copyTable

jaunty marten
# jaunty marten ```lua local modData = getPlayer():getModData() modData.StreetPharma = modData.S...

if u will some change in structure in future, for example, create new key:

local modData = getPlayer():getModData()
modData.StreetPharma = modData.StreetPharma or {
  SPCore = {
    Stimulant = 0,
  },
  SPDuration = {
    Stimulant = 0,
  },
  SPDrugTiers = {
    Stimulant = 0,
  },
}
-- new key in SPCore
modData.StreetPharma.SPCore.NewValue = modData.StreetPharma.SPCore.NewValue or 0
-- new table in StreetPharma
modData.StreetPharma.SPNew = modData.StreetPharma.SPNew or {}
modData.StreetPharma.SPNew.NewValue = modData.StreetPharma.SPNew.NewValue or 0
sour island
#

@winter thunder I'd even suggest flipping the key/values but that might be personal preference

#

I also don't know how your system works but seeing as there's 3 values tied to stims

#

you could do stimulant = {core=0, duration=0, drugTiers=0}

bronze yoke
#

yeah i was thinking the same thing

winter thunder
#

There is going to be 5 categories of drugs, and probably more than 5 variables that key off of them

So its going to be a bit of a mess either way- But I will 100% consider that haha, sounds much cleaner

drifting ore
#

what do i use to make the text appear above head? teehee

sour island
#

halo text or say()

drifting ore
#

ty

sour island
#

what does core and drugTier do btw?

winter thunder
#

But yeah @sour island I think that will be a lot better- Would mean I can have ~6 tables to hold all the info, instead of a new one for each with the 5 dug cats under each one lol. Appreciate the advice

#

Core is where I store data relating to toxicity, cumulative potency, and categoric potency of the consumed drugs.

Drug tier keeps track of the "tier" of drug high the player is experiencing, I didnt post the function that utilizes that, because that would have been a huge block of unneeded code lol

#

Basically allows me to use the moodle framework to mimic the same tiered effects of other things in the game

sour island
#
local drugData = {ID = "noID", core = 0, duration = 0, drugTiers = 0}

---creates an unreferenced copy of the table
local function newDrugData(ID)
    local newData = copyTable(drugData)
    newData.ID = ID
end
winter thunder
sour island
#

it wouldn't work as efficiently in the case you have now as there's 3 different lists

#

it's a copy of a table - recursive and unreferenced

#

you could create a table for streetpharma and copy that over

#

if there's a specific structure you want - with default values

#
local drugData = {
    SPCore = {
        Stimulant = 0,
    },
    SPDuration = {
        Stimulant = 0,
    },
    SPDrugTiers = {
        Stimulant = 0,
    },
}

---creates an unreferenced copy of the table
local function newDrugData()
    local newData = copyTable(drugData)
    return newData
end
#

Using what you have atm

#

Wouldn't really cost cut in this case although it might make your functions look a bit neater

rain shard
#

Hey guys, I'm getting a WorldDictionary error about a missing script for my item here...

ERROR: General , 1674180190822> 0> zombie.world.WorldDictionaryException: Warning client has no script for item Base.Disc_Homemade

But the script looks like this:

#

What am I doing incorrectly?

thick karma
#

PPZCDs.Disc_Homemade

#

You're apparently referencing Base.Disc_Homemade somewhere, but your module is PPZCDs

#

@rain shard

rain shard
#

Ooh, wait. Okay I see the problem then if that's the case.

#

Thank you.

thick karma
#

Nice.

sour island
#

Looking at github actions -

# .github/workflows/release.yml
on:
  push:
    tags:
    - 'v*.*.*'

jobs:
  build_addon:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Set VERSION env
      run: echo VERSION=${GITHUB_REF:11} >> $GITHUB_ENV
    - name: Build addon with HEMTT
      uses: 16AAModTeam/hemtt@stable
      with:
        command: 'build --release'
    # Upload to Steam Workshop
    - uses: arma-actions/workshop-upload@v1
      with:
        appId: '107410'    # default
        itemId: '1643238133' # Id of item to update
        contentPath: 'releases/${{ env.VERSION }}/@armaforces_mods'
        changelog: 'Content of change notes'
      env:
        STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
        STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
#

wondering how to inject a changelog based on the repo's comit names

#

๐Ÿค”

#

or even generate a changelog based on something in the commit like 'changelog: x'

#

any gitHub heads?

drifting ore
#

does anyone know if makeshift radios spawn on their own or are they craft only ?

drifting ore
#

if I took and changed the text in media/radio/RadioData.xml, would it change what text is shown in the game when the radios are playing ?

rain shard
#

Has anyone had any success actually implementing their own custom CDs? Despite everything mirrored the recording doesn't seem to be in the list itself.

humble oriole
#

Can a recipe require an item to be cooked?

#

or is there a replaceoncooked

#

lol

sour island
humble oriole
#

just use an oncreate to swap it for another item?

sour island
#

nah, in recipes ingredient section you can use functions too

humble oriole
#

well, I'm making a food recipe that I want them to cook, and once it's cooked I want that to be used in a new recipe

drifting ore
#

so is it possible to use sandboxvar with a recipe? lol

#

im trying to do something like this right now

sour island
#
       recipe Open Supplies
    {
       EmergencyFoodSupplyBox,
       keep [EHE_Recipe.CanOpenBoxes],
       Result:NoticeFlyer,
       CanBeDoneFromFloor:true,
       OnCreate:EHE_Recipe.FOOD,
       Time:70.0,
       Sound:OpenBox,
    }
function EHE_Recipe.CanOpenBoxes(scriptItems)
    scriptItems:addAll(getScriptManager():getItemsTag("CanOpenBoxes"))
end
#

You can have the script manager parse through possible usable items

#

OnPerform / OnTest can be used to remove ingredients that don't match what you want

#

also isCooked and setCooked are things

humble oriole
#

I guess I can do an OnTest and have the character say it needs to be cooked

sour island
#

if onTest fails it won't appear as a context

humble oriole
#

hmmm

#

Trying to ponder how to communicate that to the player then

#
    {
       Yeast,
       destroy WaterPotSlurry,

       Result:UnfermentedSlurry,
       Time:50.0,
       Category:Cooking,
       OnTest:Recipe.OnTest.isSlurryCooked,
       OnGiveXP:Recipe.OnGiveXP.Cooking10,
    }```
sour island
#

In this case Yeast wouldnt be cooked eitherway though?

humble oriole
#

yea, but I want the WaterPotSlurry to be cooked

sour island
#

ah

#

OnCanPerform:

#

vanilla has a lua -- for testing if food items are cooked or burnt function Recipe.OnCanPerform.SliceCooked(recipe, playerObj, item) return item and (item:isCooked() or item:isBurnt()) end

jaunty marten
#

@sour island btw need to do when u opens the error menu put error panels on top of other ones spiffo

humble oriole
jaunty marten
sour island
#

ah

rain shard
sour island
#

Replaced the function in debug menu with my own that pulls the functions and names from the tick boxes

cosmic condor
#

that's the UI we're waiting for

#

1 click activation

thick karma
#

lol, a fitting preview to end a really disappointing mod.

sour island
#

couldn't get it to work with controllers?

ancient grail
#

If i create a function from a client that dmgs zeds will ot require sendclientcommand to server?

bronze yoke
#

no

ancient grail
#

Nice

#

Or maybe i should i run it server sided like checks if player is equipped with chain saw and is aiming then if adjacentile == zombie:getSquare

rain shard
#

Is anyone familiar with WordZed enough to answer this question:

Is there a way to make a radio station that plays at a later date than day 0 that isn't just adding a million broadcasts to hit the day range you want?

drifting ore
#

Also do you need to use wordzed to edit the dialogue in the radio ? I am changing radiodata.xml and was wondering if its enough on its own, just replacing.

rain shard
#

WordZed itself is for making new TV Stations and Radio Stations

drifting ore
#

Though it is one big file, taking a while ๐Ÿ˜„

rain shard
#

What I would do is change just a sentence for a radio broadcast you now plays, load up in debug, see if it loads that altered line and blamo

#

Then you know you can continue editing the XML

drifting ore
rain shard
uncut meteor
#

Hello instead of zombie updates updatingg fonctions like this one checking if zombie isAttacking is there a way i can check the same way but only when the zombie bites/damages the target, i am having a problem with zombie isAttacking excueting before the target gets hit meaning player cant fight back needs a ranged wp or some type of handweapon like spear

quaint fiber
#

Guten tag, is there's a way on how to make a helicopter mod for PZ?

sour island
#

progress for anyone interested:

#

eliminated the AUD panel, integrated it into the debug menu, changed the icon of the button, replaced the cheat menu with a panel of toggable buttons

#

best part are the panels are instanced and just need a title and a list of functions fed into it

#

Also, I don't believe AUD had highlight colors for the buttons so I added some

drifting ore
#

yea thats really nice