#mod_development

1 messages · Page 70 of 1

sour island
#
---values and methods taken from `zombie\characters\BodyDamage\Nutrition.java`

---Values from vanilla (41.78)
local caloriesDecrease = {}
caloriesDecrease.Exercise = 0.13
caloriesDecrease.Sleeping = 0.003
caloriesDecrease.Normal = 0.016
---additional rates
caloriesDecrease.Sitting = caloriesDecrease.Normal*0.66
``` listed at the top of the mod
#
public final class Nutrition {
   private IsoPlayer parent;
   private float carbohydrates = 0.0F;
   private float lipids = 0.0F;
   private float proteins = 0.0F;
   private float calories = 0.0F;
   private float carbohydratesDecreraseFemale = 0.0032F;
   private float carbohydratesDecreraseMale = 0.0035F;
   private float lipidsDecreraseFemale = 7.0E-4F;
   private float lipidsDecreraseMale = 0.00113F;
   private float proteinsDecreraseFemale = 7.0E-4F;
   private float proteinsDecreraseMale = 8.6E-4F;
   private float caloriesDecreraseFemaleNormal = 0.016F;
   private float caloriesDecreaseMaleNormal = 0.016F;
   private float caloriesDecreraseFemaleExercise = 0.13F;
   private float caloriesDecreaseMaleExercise = 0.13F;
   private float caloriesDecreraseFemaleSleeping = 0.003F;
   private float caloriesDecreaseMaleSleeping = 0.003F;
   private int caloriesToGainWeightMale = 1100;
   private int caloriesToGainWeightMaxMale = 4000;
   private int caloriesToGainWeightFemale = 1000;
   private int caloriesToGainWeightMaxFemale = 3000;
   private int caloriesDecreaseMax = 2500;
   private float weightGain = 1.3E-5F;
   private float weightLoss = 8.5E-6F;
   private double weight = 60.0D;
   private int updatedWeight = 0;
   private boolean isFemale = false;
   private int syncWeightTimer = 0;
   private float caloriesMax = 0.0F;
   private float caloriesMin = 0.0F;
   private boolean incWeight = false;
   private boolean incWeightLot = false;
   private boolean decWeight = false;
ancient grail
#

I have no clue what the diff is but aslong as the sledge works for me then im fine with using it
Is the cause for the colider to remain ? Cuz i doubt

jagged ingot
#

Anger. Very anger..

#

Lua by default does not support RegEx.

#

Going with a lib I found.

cinder shadow
dark wedge
# jagged ingot Lua by default does not support RegEx.

There is a valid reason for this given in the LuaDocs though:
Unlike several other scripting languages, Lua does not use POSIX regular expressions (regexp) for pattern matching. The main reason for this is size: A typical implementation of POSIX regexp takes more than 4,000 lines of code. This is bigger than all Lua standard libraries together

sour island
#
   private float caloriesDecreraseFemaleNormal = 0.016F;
   private float caloriesDecreaseMaleNormal = 0.016F;
   private float caloriesDecreraseFemaleExercise = 0.13F;
   private float caloriesDecreaseMaleExercise = 0.13F;
   private float caloriesDecreraseFemaleSleeping = 0.003F;
   private float caloriesDecreaseMaleSleeping = 0.003F;
#

The rates were different at one point

cinder shadow
#

I see, how do those values, sprint 1.3, run 1.0, and walk .6, derived from those?

thick karma
#

No

#

This

#

Is odd

#

I still need to try your remove functions but had to go AFK for a minute and may not be able to take a look for a little while

#

Will update you when I do

jagged ingot
#

That'd be helpful.

#

Someone made that library for Lua so I'm going to write typings for it.

sour island
cinder shadow
#

actually yeah i see them now further down, cool thanks

sour island
#

In the calculate stats portion yeah

#

Sorry forgot the rates aren't used

thick karma
jagged ingot
young grotto
#

seems like im getting this issue


ERROR: General     , 1672084719443> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: AuthenticAnimationsExtra of non-table: null at KahluaThread.tableget line:1689.```

```lua
local activatedMods = getActivatedMods()

if activatedMods:contains("AuthenticAnimations") then

  require "ISUI/ISEmoteRadialMenu"
  require "ISAuthAnimEmoteRadialMenu.lua"

  ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = nil;
  ISEmoteRadialMenu.icons["Sprint002"] = nil;
  
else

  print("AuthenticAnimations mod is not activated")
end
jagged ingot
#
const UPPER_REGEXP = '/^[A-Z]+$/';
jagged ingot
#

I could do charCodes of 65 to 100.

#

Seems primitive and not something I want to do.

#

Ehh fine. You win.

agile vigil
young grotto
#

I'm trying to create a patch for Authenthic Animation to remove naruto run
basically changing this line

ISEmoteRadialMenu.menu["AuthenticAnimationsExtra"].subMenu["Sprint002"] = getText("IGUI_Emote_Naruto");

to nil

dull moss
#

k, inteliji question, anyone knows how to disable it auto-finishing my functions? I disabled everything in code completion and it still completes it

#

it's annoying

ancient grail
#

Filename and just change the animation on it

#

I know why cuz it can exploit endurance

#

I have the same issue with auth anim

young grotto
#

oh

#

replacing it to other xml

ancient grail
#

encumbrance endurance and injury
Right?

#

No same name and same animation name

#

Or the string name i think i fogot aslong as its not pointing to that run animation of vanilla
If u can send the xml code here i can help u further

robust jetty
#

Someone knows what 'getCore()' does?

ancient grail
#

No man just the text of it not the file

#

So we can see

young grotto
#

ah my bad

#
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="looped.xml">
    <m_Name>Sprint002</m_Name>
    <m_AnimName>Zombie_Sprint02</m_AnimName>
    <m_deferredBoneAxis>Y</m_deferredBoneAxis>
    <m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
    <m_BlendTime>0.30</m_BlendTime>
    <m_Conditions>
        <m_StringValue>Sprint002</m_StringValue>
    </m_Conditions>
    <m_SubStateBoneWeights>
        <boneName>Dummy01</boneName>
        <weight>2.5</weight>
    </m_SubStateBoneWeights>    
</animNode>
jagged ingot
#

@thick karma

const A_Code = `A`.charCodeAt(0);
const Z_Code = 'Z'.charCodeAt(0);
/**
 * @param s The string to test.
 * @returns True if the string contains any upper-case letter.
 */
const containsUppercase = (s: string): boolean => {
  if(s == null || s.length === 0) return false;
  for(let i = 0; i < s.length; i++) {
    const a = s.charCodeAt(i);
    if (A_Code <= a && a <= Z_Code) return true;
  }
  return false;
};

const camel = 'camelCase';
const kebab = 'kebab-case';
console.log(containsUppercase(camel));
console.log(containsUppercase(kebab));
ancient grail
#

Unhave to create another xml file with the same name located on the same folder of that file... But it should be modified..
Change the m_AnimName instead of Zombie_Sprint02 change it something else

young grotto
#

oh I see, just replacing it and load it after

ancient grail
#

Anything u want . It doesnt have to exist but if u want u can check out the vanilla emotes to find animations u can use

#

That eill remove the zed run animation but it will still show naruto run
But atleast this solution solves your problem right

#

Let me know if it worked

molten cobalt
#

Hi all, got a quick question, I'm looking at creating a profession/trait, but I wanted to create my own trait, I can find the location of professions in the game files, but not where the traits are, any ideas?

ruby urchin
#

deadbody AnimSet is hard-coded? apparently his xml never is loaded

dull moss
#

or whatever the name

molten cobalt
dull moss
#
    local fisher = TraitFactory.addTrait("Fishing", getText("UI_trait_Fishing"), 4, getText("UI_trait_FishingDesc"), false);
    fisher:addXPBoost(Perks.Fishing, 1)
    fisher:getFreeRecipes():add("Make Fishing Rod");
    fisher:getFreeRecipes():add("Fix Fishing Rod");
ancient grail
#

Thats scattered across multiple lua

#

U can just search for the trait amd

#

Name*

dull moss
#

if you mean traits that actually do stuff (aka trait logic) it is indeed scattered around

ancient grail
sour island
#

Would there be a way to not scatter the traits effects? Asking hypothetically. It would be nice not to scatter it but you'll have to scatter something.

young grotto
# ancient grail Let me know if it worked

it sorta works, I replaced the xml with this

<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="looped.xml">
    <m_Name>Sprint002</m_Name>
    <m_AnimName>Bob_EmoteVomit</m_AnimName>
    <m_BlendTime>0.30</m_BlendTime>
    <m_Conditions>
        <m_StringValue>Sprint002</m_StringValue>
    </m_Conditions>
    <m_SubStateBoneWeights>
        <boneName>Dummy01</boneName>
        <weight>1.0</weight>
    </m_SubStateBoneWeights>
</animNode>
``` but then it asks for looped.xml inside the folder too so I added that.
Now when I click it, it didnt do anything
ancient grail
#

Thats cool yourbpurpose wasto remove not replace anyways

#

So there

young grotto
#

huh neat

dull moss
#

can I chain ternary operator? KekW

#

(square:isInARoom() and player:isInARoom() and 2 or 1)

sour island
#

Yes

dull moss
#

nice

sour island
#

I've been using them to avoid if variable then spam

young grotto
molten cobalt
sour island
#

The effects are scattered all over you'll have to search for hasTrait()

dull moss
sour island
#

Your effects can be leveraged from one file but you may need to require() some vanilla files

molten cobalt
#

Ok brilliant cheers all

sour island
#

Really depends on what you'd want

molten cobalt
#

Well I'm planning on doing something where you take damage depending on certain circumstances like being inside for example

#

Or take more damage from certain things

ancient grail
#

What variable are u going to modify for that to work?
I think the dmg dependends on source of dmg not by reciever
So unwould have to revamp the system

fast galleon
ancient grail
#

But im not sure

dull moss
jagged ingot
#

I'm also share-heavy.

ancient grail
#

Ow

#

Good to know good to know

jagged ingot
#

I code using the "utility-first" approach.

dull moss
#

I yeet everything in client since i mostly work with traits and they are all client-sided

sour island
#

Code should be where the vanilla code is if you're leveraging any of it

ancient grail
#

@agile vigil shared folder lol u might be right

sour island
#

Client for UI for example

agile vigil
ancient grail
#

Not yet im afk . Hehe im just tagging u cuz of the convo abt the shared folder

drifting stump
agile vigil
#

Ah 😄

sour island
#

Shared would be actually pretty rare tbh - but there's a few stuff stuck in there to act as a means to validate between client/server

sour island
ancient grail
agile vigil
#

In @ancient grail and I's case, we have code that changes what Parts a vehicle has. Sounds like the perfect case of Shared 😄

sour island
#

I threw everything in shared when MP hit and it was a mess

ancient grail
drifting stump
sour island
#

Again, if the vanilla code you refer to is shared by all means -- also if you need the same functions in both client/server

ancient grail
#

Ow

drifting stump
#

i code in a way where client and server logic is split

sour island
drifting stump
#

well some stuff ive had to because thats where vanilla has it

#

arent distros in shared?

#

so yeah ive had to but actual code i split

sour island
#

They are, I think some stuff got put in shared for anticheat

ancient grail
#

Well i guess its up to the modder then... Since we have a split
Poltergeist deltamango shared
Chuck browser vanilla

sour island
#

You're going to run into issues dumping everything in shared lol

jagged ingot
#

Why does it have to be mutually exclusive?

#

ISUI has no place in shared or server.

#

coordinate-manipulation utilities can be in shared.

drifting stump
#

very true

#

but i dont think glytch3r means dumping libs into shared XD

jagged ingot
#

client-server-shared is basically a way to keep code clean.

#

Hopefully one day we'll see a java solution much like it. 🙂

sour island
#

Dumping into shared works if you're only in SP tho

drifting stump
#

hopefully one day clients wont load server 🙂

sour island
#

They don't in MP

drifting stump
#

they do

jagged ingot
drifting stump
#

🙏

sour island
#

But I thought they don't if you're a connected client

drifting stump
#

clients do indeed load server

sour island
#

When I host from the main menu client and server are distinct entities

drifting stump
#

which is why i highly enjoy this line of code

if not isServer() then return end
sour island
#

I have to do that for my code to work in SP

jagged ingot
#

☝️

sour island
#

For some reason client commands don't fire

jagged ingot
#

I use it for my mod loader.

sour island
#

I hate that serverCommand can fire in SP but client ones dont

#

Or maybe it's the other way around

#

But yeah even as the host and client I have to communicate between the two - I assumed connected players wouldn't be also loading server stuff

#

Is their server entity communicating with the host's?

jagged ingot
#

The server has become more of a glorified bouncer for client-auth for a lot of things.

#

This is why cheats popped up when B41 Multiplayer came out.

#

It's way more of a hollow shell than it used to be in old MP.

#

It did eliminate lag bites though.. Thank god.

bronze yoke
#

client and server are distinct entities, it's just that both run code from the server folder

sour island
#

I haven't tested with a dedicated setup only from the main menu

#

Seems like the distinction between server shared and client shouldn't be a thing with the new MP

winter thunder
#

Default of an hour gives me like 24 in-game mins / min, or about 0.4 in-game minutes /second.

Trying to figure out the best means to set some effects, but I don’t want to ride the onTick function unless I have to. Seems like OnMinute might be a good stand in?

Since I can’t mess with the base rates of change for hunger, thirst, or otherwise- It seems like I’ll have to supplant my own changes

sour island
#

Don't be afraid of the ontick

#

Half the game's systems are incorporated into it

ancient grail
#

use on tick to a local function i guess wont hurt

#

not sure but thats what i observe from most ontick

sour island
#

Just have a means to validate if it should run

winter thunder
#

Yeah, it just only needs to trigger if the player has taken a drug, and only while they are under the effect of it

jagged ingot
#

My HTML engine will do this.

winter thunder
jagged ingot
#

I learned a thing.

#

I also learned that the update function hook that UIElement runs is very slow regardless of FPS & UI FPS.

#

I use the tick hook to fix this.

#

That's why my animations are super smooth.

#

If you instantiate a UIElement object, pass a table with update(), prerender(), render(), and onResize(width, height) defined.

sour island
#

I was kind of surprised render is called every few ticks

#

Is it common practice to call rendering that fast?

jagged ingot
#

Depends on what you're rendering.

#

TIS probably didn't plan on doing animations to their UI in the way that say I am with my tech demo so that's no surprise.

sour island
#

DrawText only works on render afaik

#

It clears next frame

jagged ingot
#

Yes because it runs on the render thread.

sour island
#

Should I be using label and their text instead of my UI has unchanging text?

jagged ingot
#

It's a draw command. It isn't stored anywhere. All it does is send info to the SpriteRenderer used to render the UI that's then dumped when executed at the next tick.

jagged ingot
#

My CSS implementation allows for you to do it the way you're thinking of doing it with the option to also add code for every tick.

sour island
#

Just concerned I'm rendering stuff needlessly

#

But I didn't see a way to add text as it's own thing.

jagged ingot
#

Nope. As long as you call it once for every render tick, you're doing what you're supposed to do.

sour island
#

Hmm

drifting stump
#

update isnt commonly used

jagged ingot
drifting stump
#

all the drawing and therefore animations would be done in one of the renders

#

i guess having a lower ticking function is also useful

jagged ingot
#

It's not easily known to the end-user though.. that's the issue I have with it.

astral dune
#

wish I had Chuck's error output mod for Minecraft right now

drifting stump
winter thunder
#

Like- if I could just have something run on tick for a predetermined timeframe, and not have it check/run that constantly that would be incredible

sour island
#

You can

winter thunder
#

Oh?

winter thunder
dull moss
#

you add event and then remove it

#
function everyTick()
  -- code here
  if xyz then 
    Events.OnTick.Remove(everyTick)
  end
end

function func1()
  if abc then 
    Events.OnTick.Add(everyTick)
  end
end```
#

something like this should work

winter thunder
#

Oh… holy shit… I love you 😂

dull moss
#

i think

winter thunder
#

Thank you

dull moss
#

havent tried myself removing events yet

winter thunder
#

I mean, if it works- that would be a godsend. It would make so many things easier haha. I figure I could have a counter in there of sorts too, so it would know when to shut itself off

dull moss
#

ye in moddata

winter thunder
#

Dope

drifting stump
#

at that point why even register the ontick

#

run what you want on the 10min

dull moss
#

that was my example

#

there renamed

jagged ingot
#

mmmm

#

I have more CSS rules implemented now.

#

To do with background-image and background-repeat

winter thunder
#

Yeah I want something to only trigger on consumption, and for it to fire ontick. So I need a way to create that, without it constantly riding the OnTick event and bloating that 😂 so if I can make a way to create the event and remove it after the effect is over, that would be great

dull moss
#

go test

#

if it works cuz I wanna know too

astral dune
#

that will work, you're only using ontick while its active, so as long as "xyz" isn't an expensive operation it should be fine

dull moss
#

i prefer sticking to everyMinute if i need something real-time-ish

drifting stump
#

you dont need to have tick accuracy on buffs/debuffs

dull moss
#

^

jagged ingot
#

Most mods do not need a fast event to hook.

#

My stuff is very special in this case. It has to have it.

winter thunder
#

For sure, but for some UI things I will probably need it. For the stat stuff I will probably use the same functionality but for every minute

dull moss
#

just put everything onto OnTick, essentially all other events are just variations of OnTick anyway

winter thunder
astral dune
#

run it twice per tick just to be sure

dull moss
drifting stump
#

all my code is now generated with a function running ontick

#

of course it is also executed on that tick

#

but dont worry i wont leave all those generated objects lying around

#

i shall trigger a gc cycle along with it too

winter thunder
#

I actually have my code outsourcing itself to an AI chat bot, which write the code for me, then inputs it back into the system, and fires it, all within every tick :)

dull moss
#

also ofc all my stuff is global so i can access it

drifting stump
dull moss
#

lua defaults everything to local anyway

#

right

drifting stump
#

actually a very talked about thing

#

was recognized it was a mistake making things global by default

winter thunder
#

Personally, I make sure to name all of my global variables really uniquely to make sure nothing accidentally messes with them. Things like x, y, z, var1, var2, player, etc. really helps keep all of my variables super transparent :)

drifting stump
#

eevryone should learn to code by reading the decompiled code

#

int1, int2, int3

astral dune
sour island
winter thunder
sour island
#

Depends on what timing one wants

#

Can also use timestamps

dull moss
#

Kpog I officially helped someone with code in PZ

#

Now I'm a man

astral dune
dull moss
winter thunder
#

Thankfully I’m on my phone so I just zoomed lol

dull moss
#

DC doesn't want any of that bullshit

winter thunder
dull moss
#

That's literally me 1 week ago

#

Now I helped someone

winter thunder
#

Hell yeah 😎

sour island
#

That's still me

dull moss
#

Chuck and albion are biggest gigachads in this channel

winter thunder
dull moss
jagged ingot
#

Damn..

drifting stump
sour island
#

There's always someone more knowledgeable than you about something

winter thunder
#

Delta and Browser really getting the short end of the stick here 😭 no love

sour island
#

And several dozen people will always beat 1 very smart person

dull moss
sour island
#

If not in work output, at least physically

drifting stump
#

you see the difference is to talk to us you gotta axe us a question

jagged ingot
#

Time doesn't count as experience however I've been around since 2014.

drifting stump
#

i will not apologize

dull moss
winter thunder
#

honestly love how open the community here is to collaboration and helping out others

sour island
#

The veteran badge looks like a bumblebee I kind of wish I had the axe

dull moss
#

Axe is cool ngl

drifting stump
#

never figured out how you get it is it just messages sent or a combo with how long youve been here?

astral dune
#

I want the katana

dull moss
#

is katana after axe?

drifting stump
#

guessing its just messages for me to still be axe

astral dune
#

ye I think so

dull moss
#

Both Katana and Axe cool tbh

winter thunder
#

So- if I just post all of my code snippets one line at a time… 👀

drifting stump
#

see thats where youre going wrong

dull moss
drifting stump
#

the entire code should be in one line anyway

dull moss
winter thunder
#

On character at a time 😂

jagged ingot
#

Uhm..

#

You can uglify Lua.

#

One of my mods does this.

winter thunder
jagged ingot
#

Oh. I use a minifier on a website.

#

I ofc use Prettier for my TS.

winter thunder
#

It’s like when William J. Runnings accidentally walked twice at the same time in 1845. Humans have been running ever since

neon bronze
#

Anyone knows how you can turn an IsoObject into an IsoThumpable?

drifting stump
#
local square = object:getSquare()
  --triggerEvent("OnObjectAboutToBeRemoved", object)
  square:transmitRemoveItemFromSquare(object)
  local properties = object:getProperties()
  local newObject = IsoThumpable.new(object:getCell(), square, object:getSprite():getName(), properties:Is("collideN"), nil)
  newObject:setBlockAllTheSquare(properties:Is("collideN") and properties:Is("collideW"))
  newObject:setIsThumpable(properties:Is("collideN") or properties:Is("collideW"))
  newObject:setContainer(object:getContainer())
  for i = 1, object:getContainerCount() - 1 do
    newObject:addSecondaryContainer(object:getContainerByIndex(i))
  end
  square:AddSpecialObject(newObject)
  newObject:transmitCompleteItemToServer()
neon bronze
#

couldnt i just call setThumpable if i already get an IsoObject?

drifting stump
#

dont see that function anywhere

neon bronze
#

Ah misread setIsThumpable as IsoThumpable

#

Btw does the call .instanceof() get me IsoObject if i call it on my original object?

#

Like object.instaceof(IsoObject)?

jagged ingot
#

Wheeee

#

Would be cool if there was a DrawTexture call that could allow for every possible transformation.

wet sandal
#

Oooooh

#

You rotated the texture?

jagged ingot
#

Yeah.

#

Angle calls doesn't support scaling though so that's not good.

wet sandal
#

I need something like that soon, lest I generate new temp rotated textures...

#

Inventory Tetris is coming along nicely

#

Ground remains a list, because I can't really make that a grid

jagged ingot
#

Very neato.

#

Would be cool if the 3D item could be rendered in the UI.

#

(I think you can?)

wet sandal
#

Oh really?

#

That would probably look cleaner

jagged ingot
#

Not sure how the vehicle mods do it.

#

Maybe they render it to a frame texture and just do that.

#

I'll look at making <img /> elements tomorrow.

drifting stump
#

can definitely do 3d models in uis

#

ive done it

jagged ingot
#

I'll probably add a custom CSS rule for rotations.

drifting stump
#

but that many 3d models for a ui?

jagged ingot
drifting stump
#

think the game already does that

fast galleon
#

if you're going for realism, you could also remove character inventory.

wet sandal
#

Lots left to do, its probably gonna be a few tiny separate grids

#

like the Tarkov pockets

#

Equipped items will not take space

jagged ingot
#

Oh.. Oh no.

#

I just thought "I should make my own canvas engine"..

#

I'm thinking that I'll need to write dynamic CSS stuff to a texture image and then load it in.

fast galleon
#

nice

sour island
neon bronze
sour island
#

hmm is there something to call from methods to get the this?

#
function patchClassMethod.create(original_function)
    return function(self, perksType, XP, passHook, applyXPBoosts, transmitMP)
        print("XP TRACKING: "..tostring(perksType).." +"..XP)
        --.." ("..tostring(passHook or true)..", "..tostring(applyXPBoosts or true)..", "..tostring(transmitMP or false)..")")
        return original_function(self, perksType, XP, passHook or true, applyXPBoosts or true, transmitMP or false)
    end
end

function patchClassMethod.apply()
    print("SkillRecoveryJournal: accessing class:`zombie.characters.IsoGameCharacter$XP.class` method:`AddXP`")
    local class, methodName = XP.class, "AddXP"
    local metatable = __classmetatables[class]
    local metatable__index = metatable.__index
    local originalMethod = metatable__index[methodName]
    metatable__index[methodName] = patchClassMethod.create(originalMethod)
end
patchClassMethod.apply()
#

I guess I could use getPlayer() but I honestly hate that for the fact I don't know which player it grabs in co-op

dull moss
#

anyone can save me few rounds of testing and tell me few details on ISInventoryTransferAction:perform()?
Does it perform action technically separately for each entitiy? I'm trying to count amount of items and weight moved by character.

for i,item in ipairs(queuedItem.items) do
        self.item = item
        -- Check destination container capacity and item-count limit.
        if not self:isValid() then
            self.queueList = {}
            break
        end
        self:transferItem(item);
    end

^ part of original code that moves items, from my understanding. I'm not sure with how it works, is it a table, is it on item per item basis? sadge

sour island
#

It does each mouse action

dull moss
#

what if i select multiple items

sour island
#

you you let go of the mouse you can be dragging a group of items or a stack

#

or a group with multiple stacks

dull moss
#

hm

jagged ingot
#

Oh man that's so silly..

dull moss
#

so If I want my stuff to count weight and item count properly i'll have to steal code from original file to see how it handles it?

#
function ISInventoryTransferAction:perform()
    original_transfer_perform(self);
    local player = self.character;
    local item = self.item;
    local itemWeight = item:getWeight();
    local modData = player:getModData().DynamicTraitsWorld;
end```
guess it won't be so simple ![sadge](https://cdn.discordapp.com/emojis/780599777342783508.webp?size=128 "sadge")
jagged ingot
#

So TIS does have constructors to pass pixel data for Texture, however they removed the code for the constructors of those objects.

#

The other ones don't use the exposed objects.

#

I literally have to save a drawing of some sort to a file then read it.

#

Big bummer.

sour island
#

There's a few pitfalls where its not easy to mod or change stuff with out a facelift

dull moss
jagged ingot
#

Expose ImageData and TextureID, or a sandboxedBufferedInputStream.

dull moss
#

I jsut wanna count transferred items and their weight

jagged ingot
#

Aaaaahhh man.

#

Well at least I can make a draw cache folder as a solution.

sour island
#

depends what you're trying to do

jagged ingot
#

I think I'm done for the day.

neon bronze
# drifting stump what does it break

Its just a system ive built for a mod but it takes things from a sprite so when i use it on a worldobject it fails but not when i spawn the same object with the brush tool

dull moss
#

it works

#
local original_transfer_perform = ISInventoryTransferAction.perform;
function ISInventoryTransferAction:perform()
    local player = self.character;
    local item = self.item;
    local itemWeight = item:getWeight();
    local modData = player:getModData().DynamicTraitsWorld;
    print("Moving an item with weight of "..itemWeight);
    original_transfer_perform(self);
end```
#

prints out item by item

#

even when bulk moving

fast galleon
dull moss
#

now i just need to make an exception for cigarettes cuz they are weird

fast galleon
#

'edibles'

dull moss
#

base game btw
TraitFactory.addTrait("Dextrous", getText("UI_trait_Dexterous"), 2, getText("UI_trait_DexterousDesc"), false);

#

its fine its not like they were coding it in IDE with spellcheck

#

that's very recent technology

#

released this year on all major IDEs

drifting stump
#

but does it work?

dull moss
#

you know what would be cool

#

if besides require= in mod.info we could put incompatible= so game complains at users for using incompatible mods

drifting stump
#

you can do that in code

sour island
#

Better than getspecificplayer(0) which every old mod uses

dull moss
#

Ah yes, I also like consistency, just like PZ devs
TraitFactory.addTrait("Organized", getText("UI_trait_Packmule"), 6, getText("UI_trait_PackmuleDesc"), false);

drifting stump
#

can do for the community api

dull moss
#

?

drifting stump
#

can add something like that to the community api

#

a thing i thought about was downloading dependencies too

dull moss
#

lets say im inserting my code into a base game perform function. Is there a way to stop doing that at some point? PepeThink

#

midgame or at least mid-restarts

drifting stump
#

you could reassign the function back to the original

dull moss
#

elaborate pls?

#
local original_transfer_perform = ISInventoryTransferAction.perform;
function ISInventoryTransferAction:perform()
    original_transfer_perform(self);
    -- some stuff here
end```
#

how would one do that?

drifting stump
#
ISInventoryTransferAction.perform = original_transfer_perform
#

its that shrimple

dull moss
#

hm

#

I see

#

any way of preventing it firing in the future? PepeThink
like where can i put if in there so with next time player launches the game it wouldn't overwrite it? PepeThink

dark wedge
# dull moss any way of preventing it firing in the future? <:PepeThink:585563074661187605> ...

You can do an override at any time for the most part. For instance, I do this override on start only if a mod isn't enabled:

local function doOverride()
    if getActivatedMods():contains('SwapIt') then print("Not overriding because SwapIt is enabled!") return end
    local _ISHotbar_equipItem = ISHotbar.equipItem
    function ISHotbar:equipItem(item) ... end```
So can just conditionally check for this when you do an override too.
sturdy salmon
#

Here is a simple example, which I have just tested.
What it does is the following.
Every time a zombie dies, it displays the player's counter.
And then, when it reaches 70, it gives him a crowbar.

local function ZombKilled()
    getPlayer():Say("Zombies killed: " .. getPlayer():getZombieKills())
    if (getPlayer():getZombieKills() == 70) then
        getPlayer():getInventory():AddItem("Crowbar")
    end
end

Events.OnZombieDead.Add(ZombKilled)
#

For some, it may be a bit silly.
But if you have never done anything, this example may be useful to you.

#

Actually, I realized that it's wrong.
Because it shows zombies - 1, so you have to add 1 to the counter.

#

The idea is to make a configuration file, where you can put, number of zombies and random prizes, and that can be configured to give prizes to the players, who reach a certain number.

#

Now yes, it was only necessary to increase the counter by 1.

sour island
#

I wonder if this can be used to do something I wanted to try

#

making unique instances of XP gains way higher

#

and taper down

sturdy salmon
#

What is inside the method, can be edited without problems, moreover, that method is called, every time a zombie dies, but you have many more events that you can use. It depends on what you want to do, but yes, you can increase or decrease the experience...

#

In fact, you can use a random number, and do something with it.

#

For example this.

#
local function ZombKilled(zombie)
    if (ZombRand(3) == 0) then --selects a random number between 0-2
        getPlayer():Say("0 came out.")
        zombie:getInventory():AddItem("Crowbar")
    else
        getPlayer():Say("He left the: " .. ZombRand(3))
    end
end

Events.OnZombieDead.Add(ZombKilled)
sour island
#

selects a random number between 0-2

sturdy salmon
#

This means that if the 0 comes out randomly, it adds a lever to the zombie, but... it doesn't always work, because it depends on whether the zombie has space or not in its inventory, but by giving it to the player, you guarantee that he will always receive the prize.

sturdy salmon
sour island
#

it is, the n represents how many numbers

#

3 = 0, 1, 2

sturdy salmon
#

Correct, you always start from zero in programming. But I had forgotten.

dull moss
#

He doesn't know about lua tables

sturdy salmon
#

Not really, I'm just learning.
But I know other languages.

dull moss
#

It was a joke directed at lua, no worries

sturdy salmon
abstract raptor
#

I keep getting a "No Such Function" error

#

anyone know what causes this?

dull moss
#

Probably no such function

#

jk, idk KekW

abstract raptor
#

.> But there is a function

#

I have this function right here.

#
    sayThis = ZombRand(4);
    updatePosition = true;
    if sayThis == 0 then
        player:Say("Probably YOU hallucinating. You're a real weirdo, you know that?");
        audio = player:getEmitter():playSound("AskMortWhatHeIs1");
    elseif sayThis == 1 then
        player:Say("Isn't it obvious? I'm a talking skull.");
        audio = player:getEmitter():playSound("AskMortWhatHeIs2");
    elseif sayThis == 2 then
        player:Say("Bored of your inane questions.");
        audio = player:getEmitter():playSound("AskMortWhatHeIs3");
    elseif sayThis == 3 then
        player:Say("Angry. I was chilling in the afterlife before you summoned me here.");
        audio = player:getEmitter():playSound("AskMortWhatHeIs4");
    end
    Events.OnPlayerUpdate.Add(PI_AzaMusic_Update)
end```
dull moss
#

check for typos, i made at least 15 typos in last week and thought something was broken

sturdy salmon
#

Try the following

#
function AskMortWhatHeIs(items, result)
    local player = getPlayer()
    sayThis = ZombRand(4)
    updatePosition = true
    if sayThis == 0 then
        player:Say("Probably YOU hallucinating. You're a real weirdo, you know that?")
        audio = player:getEmitter():playSound("AskMortWhatHeIs1")
    elseif sayThis == 1 then
        player:Say("Isn't it obvious? I'm a talking skull.")
        audio = player:getEmitter():playSound("AskMortWhatHeIs2")
    elseif sayThis == 2 then
        player:Say("Bored of your inane questions.")
        audio = player:getEmitter():playSound("AskMortWhatHeIs3")
    elseif sayThis == 3 then
        player:Say("Angry. I was chilling in the afterlife before you summoned me here.")
        audio = player:getEmitter():playSound("AskMortWhatHeIs4")
    end
end

Events.OnPlayerUpdate.Add(AskMortWhatHeIs)
#

I'm telling you, because I have not always received the player as a parameter. Then, perhaps, he does not know who to "aim".

#

It appears that not all events welcome the player.

#

Although I could be wrong, because I am still investigating.

abstract raptor
#

Hmm okay

sturdy salmon
#

Anyway, I don't know if the method call is right.

#

Events.OnPlayerUpdate.Add(AskMortWhatHeIs)

#

I think it would have to be that way.

abstract raptor
#

here for more context; maybe I missed something? I'm gonna try the changes you proposed -- but a similar format worked for my playable instruments mod

sturdy salmon
#

Now things may change.

#

Try it as you have it then. But with that change.

#

More than anything, in case you are not getting the player.
And for that reason, it generates the failure.

abstract raptor
#

Hmm I wonder if this means my playable instruments mod is broken XD

sour island
#

what is 'PI_AzaMusic_Update' ?

abstract raptor
#
function PI_AzaMusic_Update(player)
    if (updatePosition) then
    player:getEmitter():setPos(player:getX() + 0.5, player:getY() + 0.5, player:getZ()) 
    player:getEmitter():tick()
    end
end```
sour island
#

'No Such Function' appears as a lua manager thing - do you have the error and any stack trace?

#

Is 'AskMortWhatHeIs' only ran once? Cause otherwise you'd be adding that function everytime

abstract raptor
sour island
#

Check line 113 I guess

#

looks like there's a typo

abstract raptor
#
function AntagonizeMort(items, result, player
    sayThis = ZombRand(3);
    updatePosition = true;
    if sayThis == 0 then
        player:Say("WHY DO YOU TORMENT ME MORTAL!?");
        audio = player:getEmitter():playSound("MortAntagonize1");
    elseif sayThis == 1 then
        player:Say("JUST SEND ME BACK TO HELL! I HATE IT HERE!");
        audio = player:getEmitter():playSound("MortAntagonize1");
    elseif sayThis == 2 then
        player:Say("YOU'RE A JERK!");
        audio = player:getEmitter():playSound("MortAntagonize3");
    end
    Events.OnPlayerUpdate.Add(PI_AzaMusic_Update)

end```
#

I'm not seeing a typo...

#

it's the second line of this

#

OH

#

WAIT

#

there it is

#

Duh

#

it's always a missing parenthesis

#

thanks chuck

sour island
#

I don't think you should be adding the function every time tho

dull moss
#

kek

sour island
#

once at the bottom after it's defined should be enough

sour island
#

Even discord's coloration got it - the 3 should be green

abstract raptor
#

it works now

#

😄

sour island
#

Seems like LuaCallFrame LuaClosures aren't exposed?

cinder shadow
#

Hello again @sour island , thanks for help before. I've figured what I want to do now with calories but at somewhat of a loss on how to get started. I've studied your calorie mod inside out and kind of understand what is going on (im very new to this).

I basically want to modify the 1.0, 1.3, and .6 values listed here in the nutrition.class file of the vanilla game:

         var1 = 1.0F;
         this.setCalories(this.getCalories() - (this.isFemale ? this.caloriesDecreraseFemaleExercise : this.caloriesDecreaseMaleExercise) * var1 * var3 * GameTime.getInstance().getGameWorldSecondsSinceLastUpdate());
      } else if (this.parent.isSprinting() && this.parent.isPlayerMoving()) {
         var1 = 1.3F;
         this.setCalories(this.getCalories() - (this.isFemale ? this.caloriesDecreraseFemaleExercise : this.caloriesDecreaseMaleExercise) * var1 * var3 * GameTime.getInstance().getGameWorldSecondsSinceLastUpdate());
      } else if (this.parent.isPlayerMoving()) {
         var1 = 0.6F;
         this.setCalories(this.getCalories() - (this.isFemale ? this.caloriesDecreraseFemaleExercise : this.caloriesDecreaseMaleExercise) * var1 * var3 * GameTime.getInstance().getGameWorldSecondsSinceLastUpdate());```

I don't want to change anything else except those three numerical values for the mod. Do I basically copy all of this above into the function of the new mod text file, then at the end of it, end it with Events.OnPlayerUpdate?  Or is that overkill and I can do something even simpler if I just want to change those three numbers?
dull moss
#

you can ask Chuck to add sandbox option

cinder shadow
#

his mod is more complex and does a lot more with carry weight and temperature etc, I purely just want to change those multipliers

dull moss
#

are you playing single player?

cinder shadow
#

ya

dull moss
#

then literally just edit those values in his mod and leave it be

#

unless mod gets update it will stay like that

cinder shadow
#

that above text is not from his mod, its from the basegame nutrition.class file. I was just using his to learn the concept of how to go about approaching it, but I dont think he changes those three values in his from vanilla.

#

also I wanted to share the mod with some others who were interested in altered calorie burn rates

dull moss
#

you said you want to use his mod but change 3 values

#

just change those values in his mod and that's it

#

no real need to create new mod/patch/tweak or anything

cinder shadow
#

so again, its not from his mod. Im using his mod to just learn "conceptually". His mod appears to do much more such as affect carry weight and temp etc.

dull moss
#

ah

#

ye then u need Chuck

sour island
#

The approach I use is to recalculate the vanilla nutrition process - calculate my own with changes - then find the difference and only add that on

#

there's no way to inject directly into the vanilla nutrition process

cinder shadow
#

I see. how does it know to replace the vanilla nutrition process with your calcs?

sour island
#

you can overwrite the entire calcstats using the luahook - but that includes hunger and thirst

sour island
#

the vanilla processes run as normal

cinder shadow
#

oh and then yours modifies the final result up or down etc?

sour island
#

No

sour island
#

you can do the same

#

my mod has sandbox options for caloric burn rates

cinder shadow
#

so two parrallel nutrition calcs run the, the vanilla game, and yours, and if yours is say 10 calories lower, yours reduces or adds that?

sour island
#

what exactly are you trying to change?

cinder shadow
#

ya i saw that, I wanted to change running/sprinting and walking all differently from each other, your sandbox option is just global though I think?

sour island
#

It is, I can add more nuanced ones - I didn't see a point tho

cinder shadow
#

I mean, if its really easy I would love you for that, adding 3 sandbox options, one for sprint, one for run, one for walk. But I am also fine trying to learn this. BTW my motivation for this was recent game changes that I think dont differentiate the burn rate of running and walking enough, hence why I wanted to change one more than the other.

remote blaze
#

Does anyone know if there is some sort of OnZombieCreate event similar to OnPlayerCreate? I'm not sure where to find good documentation for the APIs, I want to run some code when zombies are spawned or come into the player's simulation bubble (so not meta zombies, don't care about them). I haven't been able to find anything so far, but im new to the PZ code

#

OnZombieDeath would work, but I want my changes to be visible to the player before they die

sour island
#

This is where I used to have differences being applied - as old vanilla code had none

#

you can change the baseRate for the recalc here similar to how it's done in the vanilla side

#

I'd add sandbox options so people could change it to their whim

#

that process is more involved but - you'd just add them to the sandbox options txt and translation

#

If you want to give it a shot on the github I can fix any issues

#

Currently messing with coroutine/callframes trying to see if I can identify when addXp is run from TVs

cinder shadow
#

Hmm ok let me study that part. To clarify though, do you mean I should add baseRate = [valueiwant] below each?

sour island
#

yes that should work

#

it uses the same variables across vanilla to mine

#

so setting them in mine at that point would change rebalancedRate

cinder shadow
#

cool cool, thanks man. I will try that prob tomorrow and report back.

sour island
#

👍

dull moss
#

almost done

#

16 + weight system

#

think i can finish it by the end of the year

#

oh wait its 27th

#

KekW nevermind

sour island
#

I think I figured out a work around - but I hate it

#

I can identify the file addXp is ran from - I can check if it's the radioInteractions file

#

and track it to then compare it

dull moss
#

why hate though

sour island
#

LOG : General , 1672109100975> [Skill Recovery Journal] func:OnDeviceText file:ISRadioInteractions line:292
LOG : General , 1672109100976> [Skill Recovery Journal] XP TRACKING: p:EllaAndrews -- Cooking +50

#

cause it's kind of super hacky

#

I can atleast account for career multipliers without doing some hacky shit

#

this even circumvents free levels from professions/traits

#

damn so much work can be thrown out the window

drifting ore
#

Hello, I'm hacing a problem with PZ mods not working at all on my MP server, any suggestions to figure out why they aren't working?

opal rivet
#

Could you tell me the problem?

viral karma
drifting ore
#

Anyone got an idea how to make Fuel API mod work properly? IT keeps randomizing the fuel on barrels when picking them up and placing down again

young grotto
#

pardon me for barging in, can someone point me to the files/place that can show me all [Recipe.GetItemTypes.XXXX]

#

I'm trying to find one for alcohol

#

nevermind found it, its at \ProjectZomboid\media\lua\server\recipecode.lua

drifting ore
ancient grail
thick karma
#

Y'all my poor character died of boredom (and maybe a wee bit of exposure) while I was just sitting here forever trying to figure out this collision nonsense. If anyone is online who happens to know exactly how to make objects (specifically trees) stop colliding with players, ♥️.

#

(but in a nondestructive way! I want to restore it later!)

drifting ore
#

i swear its in tile properties. maybe im crazy

winter thunder
#

Don’t think you can mess with those on the fly tho

drifting ore
#

no but you should be able to create a duplicate technically right?

winter thunder
#

Could, but that could get cumbersome when you are dealing with all the different tree variations too

thick karma
#

Problem is even hidden, they continue to collide and block light

winter thunder
#

Ah. Well, if you are already hiding them, could you just temporarily remove the whole tree?

#

Bc that seems like an issue with the tiles more than anything

thick karma
#
for index = objects:size() - 1, 0, -1 do         
    local object = objects:get(index)
    if instanceof(object, "IsoTree") then
        if not Druid.hidden[object] then

            Druid.hidden[object] = square
        
            Druid.lastDeadTree = object
            
            object:removeFromSquare()
            object:removeFromWorld()

            square:transmitRemoveItemFromSquare(object)
            square:RemoveTileObject(object)

        end
    end
end
#

This is hiding without removing collision, for context.

thick karma
#

But the game did not do that.

bronze yoke
#

java time?

thick karma
#

Idk where to look unfortunately.

#

not sure how Java does tree-on-player collision

#

or collision period

stiff furnace
#

I was curious if anyone knew if it was possible to edit server settings via lua? It would be more efficient than what I am thinking I'd have to do.

I have a questline for my server - and every player that finishes the quest can make a choice to impact the server...by adjusting the zombie population modifier by + or - .1 (for example).

thick karma
#

But really I need a Lua connection no matter what is going down in Java.

#

In theory, if the game removes collision when I sledgehammer these trees, I can trip it at least 1 way (destructive though this is)

#

But I would like a more precise way that preserves the object

bronze yoke
#

what i mean is it doesn't seem like a problem you're going to solve without understanding the java

thick karma
#

or a way to restore the object

#

Yeah but you've said that about problems you personally helped me solve so now I'm too stubborn to give up @bronze yoke

#

🤪

#

Bahahaha there must be a way

bronze yoke
#

yeah i'm the one who read the java @_@

thick karma
#

Somebody know things quick!

winter thunder
#

You might be able to mess with these

#

Or these

#

Or. Hear me out. Automatically move the tree somewhere to some other coords and then put it back 😂

#

Idk what the purpose of this is for, but there are a handful of things to at least dig around in

thick karma
#

So check this out... when I run into a tree... I'm not colliding with an object at all (maaaaan)

#

I feel like that absurd statement deserves a maaan at the end, but it is also truish

#

Testing this:

Events.OnObjectCollide.Remove(Druid.defyPhysicsUponSmackingTree)

Druid.defyPhysicsUponSmackingTree = function(player, object)

    print("Player")

    print(player)

    print("Door")
    
    print(object)

end

Events.OnObjectCollide.Add(Druid.defyPhysicsUponSmackingTree)
#

It is triggered when I run into objects, such as windows, but not when I run into trees.

bronze yoke
#

doesn't surprise me, they don't block your movement they just slow you

thick karma
#

Yeah mega-oof

#

So it's the meta-collision non-collision type collision

#

or something

#

Where you like collide but don't

#

And stuff

#

Ironically

#

setNoClip works

#

Would think that would stop collision

#

But no, also covers mysterious tree non-collision slowdown business

bronze yoke
#

time to check what noclip does

thick karma
#

@bronze yoke this.noClip = false;

bronze yoke
#

😔

thick karma
#

And then it disappears

#

So they use getNoClip some places I guess I'll check how

bronze yoke
#

time to scan the entire codebase for noClip checks i guess

thick karma
#

sorry isNoClip*

#

I wonder if this is related

   public float getGlobalMovementMod(boolean var1) {
      return !this.isGhostMode() && !this.isNoClip() ? super.getGlobalMovementMod(var1) : 1.0F;
   }
#

Oooooo

   public boolean isInTrees2(boolean var1) {
      return !this.isGhostMode() && !this.isNoClip() ? super.isInTrees2(var1) : false;
   }
#

Mmmmmmm

#

Alright. Gonna pass out. Must continue seeking breadcrumbs tomorrow. Thanks for moral support and suggestions all

stiff furnace
#

Good luck Burryaga

young grotto
#

hello gents, I'm trying to modify existing recipe, adding new items requirements but I can't quite figure out the function to add items like addRequiredSkill

#

my code is like this

function modify_recipe()
    local recipes = getScriptManager():getAllRecipes()
    for i = 0, recipes:size() - 1 do
        local recipe = recipes:get(i)
        if recipe:getOriginalname() == "Make M998 Net Trunk Barrier" then
            recipe:additems?
        end
    end
end

Events.OnGameBoot.Add(modify_recipe);
#

is there add items function for lua?

bronze yoke
#

it's like DoSource or something

#

source is definitely the keyword you're looking for

stiff furnace
#

Does anyone know if it's possible to edit server settings with lua?

young grotto
sturdy salmon
#

Question: Is it possible to access a container through the coordinates or is it better to access it through the id? My idea, is to try to identify a container for example and remove all the loot from it. If anyone knows of an example, or somewhere to look, I would appreciate it because the truth is that I do not understand if it is possible or not, it is not entirely clear to me. Thanks.

#

With this, I access the player's coordinates.
In these coordinates I have a container.
I would like to "access" it.

#
local function playerPosition()
    local player = getPlayer()
    player:Say("x: " .. player:getX())
    player:Say("y: " .. player:getY())
    player:Say("z: " .. player:getZ())
end

Events.EveryTenMinutes.Add(playerPosition)
bronze yoke
#

you can grab the square from coordinates or the player object itself, and then loop through the objects on that square looking for containers

#

it depends on exactly what the final application of this is though - if you want to access containers at a specific position and not just near the player, you will run into issues with the square not being loaded

sturdy salmon
#

My idea was to add loot in my own containers. For example, if I put a box, my idea is that loot appears in it, so to speak. The game generates loot, but in the game's own containers, not in those created by the player.

#

The problem is that there are certain containers that do not regenerate loot, then, until I solve that problem, my idea was to generate a mod, which through a coordinate system, access to some containers, and clean the content, to add a certain loot.

#

But I am totally lost. I don't fully understand the information on this site: https://projectzomboid.com/modding/, so sometimes I'm not sure how to use the different methods. Some of them I could understand, but many of them, I really don't understand.

#

But hey, I started yesterday, I guess it's just a matter of time.

#

I was able to make a reward system at least.

#
local itemsAwards = {}

itemsAwards[230] = "Axe"
itemsAwards[235] = "Cigarettes"
itemsAwards[240] = "Crowbar"
itemsAwards[260] = "Axe"

local function zombKilled()
    local player = getPlayer()
    player:Say("zombies killed: " .. player:getZombieKills() + 1)
    for key, value in pairs(itemsAwards) do
        if (player:getZombieKills() + 1 == key) then
            player:Say("Congratulations, you just won")
            player:getInventory():AddItem(value)
        end
    end
end

Events.OnZombieDead.Add(zombKilled)
#

While it works, there may be another way to do it.

bronze yoke
#

it could be a little cleaner but overall that's basically how you do it

sturdy salmon
#

In the for, I could have been more specific with the names.
But, since it worked for me, I started to investigate something else.
And in the end, I kept it that way.

bronze yoke
#

you didn't actually need to use a loop at all

#

something like

local reward = itemsAwards[player:getZombieKills() + 1]
if reward then
    player:getInventory():AddItem(reward)
end
```would be a little cleaner
young grotto
#

can Override:true be used to override mod recipe in the scripts?

sturdy salmon
#

Thank you very much for the example. @bronze yoke

young grotto
#

nevermind found a workaround, just set ishidden and create new recipe script

mighty ether
#

is it possible to change character anim speeds? ex. I get a laceration on my hand and I use a item to counter act the swing speed debuff

ancient grail
#

Sandbox atleast not sure if the server option is possible but i think it is

neon bronze
#

Sandbox settings do have the stuff for zombies and how they behave right?

jagged ingot
#

Good morning.

ancient grail
#

Anyone knows how to check if an items name is edited
If setCustomName() == true then
Will this work?

neon bronze
#

I think setCustomName() is a void function as in it returns nothing

#

And you need to pass a boolean to it

jagged ingot
#

or the is / has companion that occasionally accompanies the getter.

neon bronze
#

Does getPlayer() work regardless if i call it in mp or sp?

agile vigil
#

So long as you call it on clientside, I believe so.

pliant dirge
#

Hi everybody, not a modder myself per se but is this the place to look into finding a modder to commission a small map mod? <10 buildings total

neon bronze
neon bronze
#

Nice

#

I always used getSpecificPlayer for that but i dont think it works correctly for mp

ancient grail
pliant dirge
ancient grail
jagged ingot
#

You're assuming too much.

ancient grail
#

Or maybe not true so i can just do

if setCustomName() then return

#

Ok

jagged ingot
#

Take a look at the documentation.

#

sets should be voids.

ancient grail
#

Ok

ruby urchin
faint jewel
#

that thing is a creeper lol.

rancid panther
#

my professions mod (made with profession framework) appears to crash the game when i try to use the randomize button or select a preset character

faint jewel
#

also, a sit/lay animation might be nice.

rancid panther
#

and roll over

jagged ingot
#

It looks like it is very underweight.

ruby urchin
#

Yeah lol, I'm not a modeler or an animator, so I hope to improve it in the next updates

jagged ingot
#

Ah. No worries. Just giving you some thoughts & notes.

#

Rigging that thing was fun. Hope I can find it in my files someday..

ruby urchin
#

also PZ don't allow create more bones, so it is a little hard to adapt those things

jagged ingot
#

I can see B42 opening up a whole new market for work on 3D animals.

sour island
#

Recipes lua functions have to be global right?

flint beacon
#

is it possible to force the player to wear a mask or gloves for example to craft a recipe? like they actually have to have it equipped.

If so how could I make this possible?

drifting stump
#

however it can access tables

sour island
#

Fortunately lol

drifting stump
#

so just dump them on Recipe.Something.Something

dull moss
sour island
#

I wonder if there could be a workaround for that - or if there's not much of a point

drifting stump
#

can also wear them onperform

sour island
#

I actually usually avoid Recipes. cause I rather not add another point of compatibility with some other mod that wants to break everything

flint beacon
sour island
#

Going back through and refactoring skill recovery journal, I don't even know what this was for

---@param player IsoGameCharacter | IsoPlayer
function SkillRecoveryJournalWritingOnCanPerform(recipe, player, item)
    if item and (item:getType() == "SkillRecoveryJournal") then
        return true
    end
    return false
end
drifting stump
#

correct functions would be OnCanPerform and OnTest

drifting stump
flint beacon
#

I’ve tried but no luck so far sadly I’ve been stuck on this for a bit now

#

Oh damn I finally have a sledgehammer

drifting stump
#

what about it are you stuck on

flint beacon
#

🤔

sour island
#

Breaking bottles on your head is a old (commented out I think) recipe - it checks for wearing a mask

#
-- Example OnCanPeform function.
function Recipe.OnCanPerform.HockeyMaskSmashBottle(recipe, playerObj)
    local wornItem = playerObj:getWornItem("MaskEyes")
    return (wornItem ~= nil) and (wornItem:getType() == "Hat_HockeyMask")
end
#

Actually not commented out - left in as an example

flint beacon
#

Ooo

jagged ingot
#

Cramming some videos and read some books on C# and Azure stuff. I have a programming "test" in a few hours for a job. Hopefully I'll get it. 🙂

flint beacon
#

This helps

sour island
#

This is in recipecode.lua

jagged ingot
#

I may also get involved with this mod by either extending it or submitting changes to the git.

flint beacon
faint jewel
#

pop quiz: How would i select all vehicles within 10 tiles of a tile and check if they have mod data on them.

jagged ingot
#

chunk:getVehicles()?

#

pseudo-code.

#
if x_min <= x and x <= x_max and y_min <= y and y <= y_max then
  push to some collection
end
sour island
#

getCell():getVehicles()

#

Why stop at 10

jagged ingot
#

I'm curious at how the API implements grabbing entities.

faint jewel
#

because they are deliveing to a specific point.

sour island
#

You can use Mango's radius check

robust jetty
jagged ingot
#

Minecraft had a problem where looking up certain entities in a World filtered through literally every entity when using their lookup methods.

jagged ingot
#

(AFAIK)

drifting stump
#

i really dont like that api

robust jetty
#

f

jagged ingot
#

I don't prefer it but it does expose the issue with the vanilla UI API.

drifting stump
#

its very strict on what you can do

flint beacon
drifting stump
#

and barely simplifies things

jagged ingot
#

People may think that my HTML solution will be difficult.

#

If you know HTML and CSS logic it'll be nothing.

sour island
#

So you have to be careful

drifting stump
#

that api pretty much just off loads positioning ui elements and by doing that forces a certain layout

jagged ingot
#

It's a decent attempt and seems to be helping a few.

#

@drifting stump I also want to be open about the development of this engine. Being able to make custom elements will probably be useful for adding some 'preset' UI for things like radial menus and buttons in order to help keep things simple for users while still providing the more advanced modifications that comes with the usual development of web front-end.

#

striving for modularity and expansions is a goal of it. Hopefully this extra work will pay off in time.

drifting stump
#

@jagged ingot you were wondering about 3d models in ui

#
local FONT_HGT_SMALL = getTextManager():getFontHeight(UIFont.Small)
local FONT_SCALE = FONT_HGT_SMALL / 14

local modelUI = ISUI3DScene:new(self.x + self.width, self.y, 400 * FONT_SCALE, self.height)
modelUI:initialise()
modelUI.onMouseMove = function(self, dx, dy)
  if self.mouseDown then
    local vector = self:getRotation()
    local x = vector:x() + dy
    x = x > 90 and 90 or x < - 90 and - 90 or x
    self:setRotation(x, vector:y() + dx)
  end
end
modelUI.setRotation = function(self, x, y)
  self.javaObject:fromLua3("setViewRotation", x, y, 0)
end
modelUI.getRotation = function(self)
  return self.javaObject:fromLua0("getViewRotation")
end
modelUI.javaObject:fromLua1("setDrawGrid", false)
modelUI.javaObject:fromLua1("createVehicle", "vehicle")
modelUI.javaObject:fromLua3("setViewRotation", 45 / 2, 45, 0)
modelUI.javaObject:fromLua1("setView", "UserDefined")
modelUI.javaObject:fromLua2("dragView", 0, 30)
modelUI.javaObject:fromLua1("setZoom", 6)
modelUI.javaObject:fromLua2("setVehicleScript", "vehicle", "Base.VanSpiffo")

modelUI.closeButton = ISButton:new(modelUI.width - 15 * FONT_SCALE, 5 * FONT_SCALE, 10 * FONT_SCALE, 10 * FONT_SCALE, nil, modelUI, function(self)
  self:setVisible(false)
  self:removeFromUIManager()
  ServerPointsUI.instance.preview = nil
end)
modelUI.closeButton:setDisplayBackground(false)
modelUI.closeButton:setImage(getTexture("media/ui/Dialog_Titlebar_CloseIcon.png"))
modelUI.closeButton:forceImageSize(modelUI.closeButton.width, modelUI.closeButton.height)
modelUI.closeButton:initialise()
modelUI:addChild(modelUI.closeButton)
modelUI:addToUIManager()
#

here you an example of vehicle rendering

jagged ingot
#

WALL OF TEXT hi

faint jewel
#

ooooohhhhhh

#

add a 3d model function to the ui api!

#

and make it a button!

drifting stump
#

iirc items have to be with a different java thingy and i didnt get around to messing with it

jagged ingot
#

Should make a Gist for something like that.

#

Would be good to throw links at people for this. 🙂

neon bronze
#

Anyone knows how you can add multiple instances of a InventoryTransferAction? I do it with a for loop but only adds one InventoryTransferAction or atleast my char performs it only one time

jagged ingot
#

Will be fun making something like a HTML element for 3D objects.

drifting stump
#

ill have to look again at item rendering

drifting stump
robust jetty
#

This is the page where I got the Neo scav style inventory

#
ArtStation

First of all, I want to thank The Indie Stone team for making such a great game! They have given many players years of fun and I hope it continues for another century! I also want to thank the man under the nickname Daniel Grusuk for his divine soundtrack for the game! And I want to thank the person named Nikita Moskalev for the gorgeous art for...

drifting stump
#

do they have a crafing menu rework

robust jetty
#

I found it again

faint jewel
#

holy shit i want that.

drifting stump
#

ive definitely not been hitting my head trying to come up with a design because all i can do is code

jagged ingot
#

I can help with design ideas if you need it.

drifting stump
neon bronze
#

All the arguments are correct btw

#

But i think passing a list through might work

jagged ingot
#

Oh wait.. yeah it is. The main menu requires texturepack modding if you want to get rid of the PZ logo.

sour island
#

I was actually thinking the setup pages for new games could be consolidated

jagged ingot
#

My client-mod patch has a flag API to turn of rendering the Java-rendered main menu stuff.

sour island
#

that UI concept is pretty rad

drifting stump
#

can just render over the original

sour island
#

in-game I think needs more work

jagged ingot
#

I plan to write a UI redesign with my engine and my GLSL uniforms API for shading UI to have support for things like frosted glass.

neon bronze
#

No passing a list through does not work

sour island
#

Are you trying to transfer multiple items?

neon bronze
#

Yea

sour island
#

ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, item:getContainer(), container))

#

You have to queue it

#

running a new one will interrupt it as you have experienced

neon bronze
#

Is there a way to get when its finished so i can queue up a new one?

sour island
#

that's handled via the queue

#

you can just keep adding them

#

This is vanilla

function ISInventoryPane:transferItemsByWeight(items, container)
    local playerObj = getSpecificPlayer(self.player)
    if true then
        self:sortItemsByTypeAndWeight(items)
    else
        self:sortItemsByType(items)
        self:sortItemsByWeight(items)
    end
    for _,item in ipairs(items) do
        if not container:isItemAllowed(item) then
            -- 
        elseif container:getType() == "floor" then
            ISInventoryPaneContextMenu.dropItem(item, self.player)
        else
            ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, item:getContainer(), container))
        end
    end
end
#

just forlooped off an items list

neon bronze
#
for i = 1, count do
                    ISTimedActionQueue.add(
                        ISInventoryTransferAction:new(
                            getPlayer(), 
                            getPlayer():getInventory():getItemFromType(item), 
                            getPlayer:getInventory(), 
                            button.data.vmInventory))
                end
#

thats what i do but it adds only one action

#

and i can assure count is not 2 either

dull moss
#

imagine scrolling through 30 profession choices to see bonuses

sour island
#

didnt notice the 'getItemFromType'

#

yeah that's not going to work lol

neon bronze
#

Why?

sour island
#

it will be returning the same one item

neon bronze
#

Ok so how can i pass multiple items which are the same essentially

sour island
#

you need to gather a list and for loop like in the vanilla example

jagged ingot
#

Dug up some old pictures of my GLSL Uniforms API tests.

sour island
#

there's probably a vanilla function for returning all items by a specific type, let me check

neon bronze
#

So i can gather those items in a list and loop over them?

drifting ore
#

hey

#

Someon by any chance know where i can get a zombie grab mod?

#

I know thats kinda confusing

drifting ore
#

uh, its a meat shield zombie mod

#

Something like that

#

You can grab a zombie and make him a meat shield

#

idk

sour island
#
   public ArrayList getItemsFromType(String var1) {
      return this.getAllType(var1);
   }
#

This returns a java arraylist though

neon bronze
#

:get(i) should work right?

#

@sour island you are a legend thank you

sour island
#
local player = getPlayer()
local playerInv = player:getInventory()
local items = playerInv:getItemsFromType(ITEM_TYPE)

for i=0, items:size()-1 do
    local inventoryItem = items:get(i)
    ISTimedActionQueue.add( ISInventoryTransferAction:new( player, inventoryItem, playerInv, button.data.vmInventory) )
end
#

you can control the number of them by changing items:size()-1 to n-1

#

if that's something you'd want

#

or I guess something like math.min(items:size(),n)-1 to prevent issues

#

I'm not actually sure what happens if you try to for loop with a count lower than the starting place

faint jewel
#

FFFFFF

#

god this game sucks at grabbing vehicles.

sour island
#

what's your current approach?

#

vehicles may not be loaded in unless a player is near by

sour island
jagged ingot
#

Okay. Going to be away for some of the day. I'll be looking into some stuff later today for PZ modding.

faint jewel
#

the idea is a trucking simulator delivery, so the player and trailer will be abound that point. I just wanna check for a vehicle that has the mod data i placed on it within range of a tile.

#

that was i can complete the job and pay the player.

#

everything is working BUT detecting if the trailer is in range and then removing it.

#

that's the part i am working on adding

sour island
#

could you grab the car the player is driving?

#

boot the player out and then remove the vehicle?

#

otherwise if getVehicles doesn't work - you'll have to parse through near by squares using the for x for y scan

dull moss
#

brah it's learning galaxybrain

"The EveryOneMinute event is a special event in the game that is called every in-game minute. When the event is triggered, any functions that have been added to it using the Add method will be executed."

#

question, Events.OnCreatePlayer passes 2 args: playerIndex, player
is playerIndex same thing as player:getPlayerNum() ?

#

also can I do something like this if i want to account for modded skills?

local totalPerkLevel = 0
for i, perk in ipairs(Perks) do
  local perkLevel = player:getPerkLevel(perk)
  totalPerkLevel = totalPerkLevel + perkLevel
end
sour island
#

Yes

#

I'm actually messing with perks atm

#

PerkFactory.Perks = Perks

#

I'm guessing because it's specifically exposed it can be called that way in the Lua

#

that made me go crazy first time writing skill recovery journal

#

The lua just refers to an undefined global named 'perks'

drifting ore
sour island
#

🤷‍♂️

drifting ore
#

damn

#

I dont know how to dev mods...

#

did you think its simple?

faint jewel
#

local objects = square:getMovingObjects() using that how would i tell if it's a vehicle?

sour island
#

I don't think moving objects include vehicles

faint jewel
#

Direct Known Subclasses:
BaseVehicle, IsoDeadBody, IsoGameCharacter, IsoPhysicsObject, IsoPushableObject, IsoZombieHead

sour island
#

o

#

you can use instance of

#

instanceof()

#

also

#

instanceof

faint jewel
#
function findTrailer()
    --detect the obj with sprite named wew
    local player = getPlayer()
    local cell = player:getCell()
    local x, y, z = player:getX(), player:getY(), player:getZ()
    local xx, yy, zz
      for xx = -15, 15 do
        for yy = -15, 15 do
          local square = cell:getGridSquare(x + xx, y + yy, z)
          if square then
            local objects = square:getMovingObjects()
            for index = 0, objects:size() - 1 do
              local obj = objects:get(index)
              print("object found! name: " .. obj:getObjectName())

            end
          end
        end
      end
  end
sour island
#

instanceof(obj, "BaseVehicle")

#

you can also use this with otherclass names - it can identify zombies/players using IsoGameCharacter

#

very stronk function

faint jewel
#

okay so where would i stick that in what i have?

sour island
#

Where you want to parse out the vehicles

#

under local obj = objects:get(index) I assume

neon bronze
#

Hey is there a way to render models on client one way and on the server the other way?

cinder shadow
# sour island yes that should work

Hello I was able to take your advice and successfully got your mod to change the calorie walking rate seperate from the running rate, so thanks. two questions:

  1. I notice your mod only seems to affect if I start a brand new game. If I enable it on a game previously started without it, it has no effect. Do you know why that might be and if possible to alter so that I can get it to work on existing saves?

  2. If I wanted to scale back your calorie mod for my purposes just to affect run/walk burn rates, but not add in the new features your mod adds. What would would I remove or zero out to achieve that? I think yours just adds a new weight factor right? I'm not sure what to remove without breaking it.

sour island
#

Mine adds a very slight additional burn to carrying weight

#

the other mention of weight is vanilla - the more personal weight you have the faster you burn

cinder shadow
#

how do i scale back or remove that new additional slight burn?

sour island
#

you can add a new sandbox option, if you're planning to make changes to the original

    --inventory impact
    if SandboxVars.RebalancedCalorieBurning.CarryWeightImpact then
        local carryingRatio = math.max(0,player:getInventoryWeight()/player:getMaxWeight())
        local inventoryModifier = 1+(carryingRatio*0.01)
        rebalancedRate = rebalancedRate / inventoryModifier
    end
#

I'm not sure why it would only affect new saves - are you enabling the mod from the load game menu?

cinder shadow
#

oh so literally only a .01 modifier you added?

sour island
#

well it's carrying/capacity * 0.01

#

it's very slight, only meaningful if you're carrying alot of stuff

cinder shadow
#

I see. i just wanted to replicate that for vannilla atm. Would it break anything you think if I just removed the whole inventory impact section? or I could replicate vanilla simply by changing the .01 to zero?

sour island
#

you can just remove that section

#

Are you going to be releasing the changes as a separate mod?

cinder shadow
#

not sure, just wanted to get it working for my purposes. if so then you will get 99.9 % of all credit if i do

sour island
#

I wouldn't mind adding you as a co-author if you wanted to work on the original

cinder shadow
#

haha ok, well let me see if i can get it working the way i want exactly first then go from there

#

and yeah ill mess with load game mod options, maybe i messed it up there for prior saves. thanks again

sour island
#

no worries, unrelated but a lot of players don't know you have to enable mods from the load game menu for on-going saves -- should really be addressed in the UI somehow

#

that's like 20% of my bug reports

dull moss
cinder shadow
dull moss
#

Herbalist Magazine still gives the trait, right?

bronze yoke
#

no

#

it gives a recipe that gives you most of the effects of the trait

dull moss
#

anyone worked with sounds in here? any chance to catch level of sound player hears? precisely i want to catch very quiet sounds player character hears, want to count sound intensity/volume

drifting stump
faint jewel
#
function findTrailer()
    --detect the obj with sprite named wew
    local player = getPlayer()
    local cell = player:getCell()
    local x, y, z = player:getX(), player:getY(), player:getZ()
    local xx, yy, zz
      for xx = -15, 15 do
        for yy = -15, 15 do
          local square = cell:getGridSquare(x + xx, y + yy, z)
          if square then
            local objects = square:getMovingObjects()
            for index = 0, objects:size() - 1 do
              local obj = objects:get(index)
              print("object found! name: " .. obj:getObjectName())
              if obj:getObjectName() == "Vehicle" then
                print("Vehicle found! name: " .. obj:getObjectName())
                if obj:hasModData() then
                    print("object ModData found!")
                    local tModData = obj:getModData();  
                    if tModData.job ~= nil then   
                        print("job ModData found! name: " .. tModData.job)
                    end
                end
              end
            end
          end
        end
      end
  end
``` this never find the mod data, and i KNOW it's attached.
sour island
faint jewel
#

I could re write that into a main ui....

cinder shadow
#

got it thanks

sour island
faint jewel
#

print("Vehicle found! name: " .. obj:getObjectName())

#

LOG : General , 1672161505094> 18,684,946> object found! name: Vehicle
LOG : General , 1672161505094> 18,684,946> Vehicle found! name: Vehicle
LOG : General , 1672161505095> 18,684,947> object found! name: Vehicle
LOG : General , 1672161505095> 18,684,947> Vehicle found! name: Vehicle
LOG : General , 1672161505097> 18,684,949> object found! name: Vehicle
LOG : General , 1672161505097> 18,684,949> Vehicle found! name: Vehicle
LOG : General , 1672161505097> 18,684,949> object found! name: Player
LOG : General , 1672161505099> 18,684,950> object found! name: Vehicle
LOG : General , 1672161505099> 18,684,951> Vehicle found! name: Vehicle

#

that was three vehicles and me.

#

3 trailers, a truck and me rather lol

sour island
#

I didn't know hasModData was a thing

bronze yoke
#

yeah i don't know if that's causing your issue or not but you don't need that

#

i don't think objects that have moddata can not have moddata?

sour island
#
 public boolean hasModData() {
        return this.table != null && !this.table.isEmpty();
    }
#

Does check if it's empty - so there's that but yeah you don't need it

bronze yoke
#

yeah i was just looking at that - doesn't seem like it should be causing the issue, but definitely unnecessary

sour island
#

Where are you adding the modData?

#

Perhaps you're adding it to the vehicle part

drifting stump
faint jewel
#

i do art.

drifting stump
#

im joking

#

but damn that nesting is something

faint jewel
#

if i knew better ways around it i would.

lusty marsh
sour island
#

I have to assume I need to start a new character as i had a few errors at first

drifting stump
#

regarding that mods and saves thingy it would be fixed simply by removing the mods button from the main menu

#

it has no business being there besides for loading menu replacements

sour island
#

Implementing a mod profile similar to sandbox presets would be most ideal

#

but there's another issue with MP host menu - sandbox options dont appear unless mods are loaded in the main menu

drifting stump
#

maybe simply notifying that the user is not adding mods to a save

sour island
#

could be an alert when you try to load a game - 'there have been mods enabled on the main menu since you last played' -- it does something for when mods have been removed (shows as red)

#

I feel like Zomboid is unique in that saves can use specific mods

#

most other games just use what's currently loaded if I'm not wrong

drifting stump
#

definitely not unique in that

#

but yeah most dont bother with loading for a save

#

they do mark a save for a certain mod list tho

sour island
#

I really hope this weirdness with the journals was a fluke

#

this refactor was supposed to be a couple hours at most

faint jewel
#
    local car = addVehicleDebug(args.type, args.dir, nil, sq)
    local carModData = car:getModData(); 
    carModData.job = args.job;
bronze yoke
#

stage 1: 'a couple hours at most'

sour island
#

7.5XP is recorded as 30

robust jetty
#

Any idea what is wrong here?

faint jewel
#

Commands.KYRPT.spawnTrailer = function(player, args)

#

is the generated code i set on the payer and the trailer, so i can track both of them

sour island
#

You can't store complex objects or references in modData

faint jewel
#

i'm not

#

it's Load + playername + time

sour island
#

o

faint jewel
#

all squished ionto one string.

sour island
#

should be working then

#

do you use AUD? it lets you right click to access modData

faint jewel
#

aud?

sour island
#

aiteron's user debug

#

needs some loving - but still works great and has a few useful tools

#

the journal displays the XP as 30 - but still nets back 7.5

#

the default multiplier for non specialized skills is only .75?

#

what is this conversion

#

oh its .25

#

I already had xp flatten so it's all flat across the board

#

I guess I just need to change the display to match?

drifting stump
faint jewel
#

what now?

drifting stump
#

is that how you generate an id

#

or you then extract those parts from the string

faint jewel
#

it's jsut an id.

drifting stump
#

ah all good

faint jewel
#

local carModData = car:getModData();
carModData.job = args.job;

#

well fuck.

#

apparently... taht is not setting it for the client?

finite radish
#

you're just assigning it to a variable, you aren't doing anything with the variable

agile vigil
sour island
agile vigil
#

Oh oh like that, Chuckle knows their stuff.

sour island
#

but I think cars have an issue with transmitting modData (?)

bronze yoke
#

iirc it was that transmitting didn't work from client to server

sour island
#

just for cars or in general?

bronze yoke
#

just for cars

faint jewel
#

car:transmitModData() or carModData.transmitModData()

bronze yoke
#

i didn't test it myself but somebody here mentioned it a lot

sour island
#

car:transmitModData()

finite radish
#

quick unrelated question for anyone who knows their way around the java codebase:
would (GameServer.bServer || GameClient.bClient) always return true?

bronze yoke
#

no

finite radish
#

what sets those flags? or unsets them, I guess

drifting stump
#

bServer = true if its a server

bronze yoke
#

it returns false in singleplayer

drifting stump
#

bClient = true if its a client connected to a server

#

both false if singleplayer

finite radish
#

oh, so the client isn't a client in singleplayer? interesting