#archived-modding-development

1 messages · Page 506 of 1

jolly jungle
#

Can someone explain this line?

SceneManager.activeSceneChanged += new UnityAction<Scene, Scene>(this.SceneChanged);
native pelican
jolly jungle
#

Hm

#

Why doesn't it just hook to this?

native pelican
#

I suspect the explicit involvement of UnityAction might not be necessary here, because I would expect an implicit conversion between a function and UnityAction. But I'm not familiar with C# to know if that's even possible.

jolly oriole
#

it just because of decomp

jolly jungle
#

Wait so how would it look in the normal code

#

just += scenechanged?

jolly oriole
#

yes

jolly jungle
#

and how do I make it pass the arg0 and arg1?

#

or does it just do that?

jolly oriole
#

it just does that because of the hook

native pelican
#

Whatever triggers the activeSceneChanged event will give the arguments

prime urchin
#

it's automatic, as when the event is invoked, it calls each subscriber and passes the required parameters

jolly jungle
#

wait nevermind I forgot I already have things that do that so I can check those zote

#

Aight so it's just dnspy working confusingly

native pelican
#

(I was wrong about Action giving a return value btw, Actions always return void, but i dont' think i tripped you up w/ that anyways)

jolly oriole
#

well, dnspy is displaying it as it is, it's just that the source code gets compiled in such a way

prime urchin
#

A lot of stuff in C# is compiled to simpler/more explicit code

jolly jungle
#

Yeah don't worry john I didn't get what you were talking about anyways zote

prime urchin
#

dnSpy does its best to decompile it into more sensible stuff but it doesn't catch everything

native pelican
#

aw bummer

prime urchin
#

they're called 'events' in C# if you want to look up more about it

jolly oriole
#

or delegates

native pelican
#

delegates are called function pointers in other languages if you've got a background elsewhere

#

sometimes functors

jolly jungle
#

Anyways thanks everyone grublove

jolly jungle
#

What does Mod<SaveSettings> instead of Mod do?

vocal spire
#

Wasn’t that removed?

jolly jungle
#

Looking at two years old code right now

vocal spire
#

It allows for settings stored in the save file

jolly jungle
#

Makes sense

vocal spire
#

Though there is a new method, the old one can be done through SFCore tmk

#

The class in the <> must inherit from ModSettings, there you can look at another mod for details

#

Then there’s Mod<SaveSettings, GlobalSettings> which is the same but global settings too

jolly oriole
vocal spire
#

lol

#

please, I like doing it that way

jolly oriole
#

imma try adding a journal like inventory page for the items first

vocal spire
#

Ok

#

Gl

jolly oriole
#

and if 1.5 releases before i finish that, then y'all are screwed lmao

vocal spire
#

lol

jolly jungle
#

It seems that the Texture2d.LoadImage that was used by Traitor God is no longer in use

vocal spire
#

?

jolly jungle
#

But I can't seem to use ImageConversion either

vocal spire
#

Is UnityEngine.ImageConversionModule.dll referenced

jolly jungle
#

most likely not

#

thanks

vocal spire
#

Np

jolly jungle
#

Should've seen that

native pelican
#

@jolly oriole my interest in the silly % mod is kinda waning. i figured out all the things necessary to do it (you were right that i don't need to track monster spawns, just geo spawns) and its some reasonably straightforward implemenation now. i know you're involved with the silly % stuff, any interest in taking it over?

jolly oriole
#

i never thought that there was going to be a mod for it

#

and tbh, i don't have quite the interest in taking it over

native pelican
#

totes. i'll bring it to some modestly useful state and call it good enough then

jolly oriole
copper nacelle
#

@thorn halo yours is missing an updated sha1 for the dll

#

Wtf

#

invalid user

prime urchin
#

oof

vocal spire
#

Huh

#

Cool

#

Also if somebody is able to contact them, you should suggest that they upload their source code to GitHub instead of a dll

merry lotus
#

Is "them" Jewel (Job Change mod)? Because that user ID doesn't match theirs.

copper nacelle
#

yes

#

it wasn't showing up on mobile so i tried copying user id

#

@woeful igloo e

woeful igloo
#

Them?

#

I'm jewel, yes. Made the job change mod and sent in an update a few hours ago, sorry!

woeful igloo
#

I'll need to try and get it fixed tomorrow.

jolly jungle
#

Please do enlighten me

jolly oriole
#

get as much geo as possible

#

while only getting the geo from one enemy exactly once

abstract elk
#

hey um
where can i find the skins

deep wave
#

pins

abstract elk
#

i already have the mod

jolly jungle
jolly jungle
abstract elk
jolly jungle
jolly oriole
jolly jungle
#

I mean

#

All geo lost

#

So you can die only once and after that all geo will be permanently lost upon death

jolly oriole
#

oh that, will be steel soul, to sell rancid eggs

jolly jungle
#

Ah

#

Well if the point is to get all money then a system that involves permanently losing money results in losing anyways

cedar hemlock
#

Does SavegameSaveHook only work on save-quitting or also when sitting on a bench or other savespots?

#

and if no is there a hook that only activates upon quitting

jolly oriole
#

the save hooks do activate when sitting on a bench or on other savespots
save+quit doesn't have its own hook
ApplicationQuitHook activates when quitting the application though (who would've guessed)

cedar hemlock
#

sad

cedar hemlock
#

ok so I used:
"ModHooks.Instance.ApplicationQuitHook += Quit;"
then on quit i said:
"PlayerData.instance.charmCost_24 = 2;"
but when i quit the game then remove my mod and load a save it still costs 3 notches.
(my mod sets it to three by using:
"ModHooks.Instance.SavegameLoadHook += Load;"
then,
"private void Load(int id)
{
PlayerData.instance.charmCost_24 = GreedCost;
}")

#

GreedCost being 3

#

does anyone know why it is still 3?

copper nacelle
#

application quit is going to be too late

vocal spire
#

I use BeforeSaveGameSave(is that the name of the hook?)

deep wave
#

can't you see when the quit_to_menu scene is loaded too?

#

or that 🥴

cedar hemlock
#

like SFGrenade said?

vocal spire
#

Did not think of that

cedar hemlock
vocal spire
#

@woeful igloo could you also upload the code from your mod on github? From my experience it’s the general use for uploading a mod to GitHub, and it lets new modders use your mod as an example of how to do certain things

cedar hemlock
#

If i want the hook to activate on the main menu what should i call it

#

Main_Title didn't work

#

private void SceneLoaded(string Menu_Title)
{
Log("Quit, set charmcost to 2");
PlayerData.instance.charmCost_24 = 2;
}

vocal spire
#

Aha, AfterSaveGameSave maybe

#

Just remembered

#

So in BeforeSaveGameSave set it to normal, after set it back to your custom amount

cedar hemlock
#

sry ping

vocal spire
deep wave
#

so then it never saves the custom value to file?

vocal spire
#

I think so

vocal spire
#

Just remembered I thought I saw it in a boss mod a while ago that adds a lever to a boss statue

#

Since those bug out a lot

#

Ex: setting a variable in save settings to using alt, setting using alt to false in before, setting using alt to the variable in save settings in after

cedar hemlock
#

Error CS1061 'ModHooks' does not contain a definition for 'AfterSaveGameSave' and no accessible extension method 'AfterSaveGameSave' accepting a first argument of type 'ModHooks' could be found (are you missing a using directive or an assembly reference?)

vocal spire
#

AfterSaveGameSaveHook

cedar hemlock
#

same problem

vocal spire
#

¯_(ツ)_/¯

#

I’ll look for it again

#

Probably got the name wrong

cedar hemlock
#

oh if you dont add after

#

on the docs it says: SavegameSaveHook, Called directly after a save is saved, id is the save slot of the saved file

#

so after isn't neccesery

vocal spire
#

Yeah

#

Just saw

#

Assumed after since I remembered before for the other one

cedar hemlock
#

Ok it works thnx!

#

the only problem is that people can overcharm without the overcharm effect but ill fix that later

#

does anyone know the scene name of the main menu?

copper nacelle
#

there's a constant for it

cedar hemlock
#

sry im not good at coding so idk what that means lol

vocal spire
#

public const string thingyorsomethingwhatisthename

copper nacelle
#

Constants.MENU_SCENE

cedar hemlock
#

I mean what do i place in targetScene for it to activate at the titlescreen
private void ChangeScene(string targetScene)
{
throw new NotImplementedException();
}

vocal spire
#

If (targetScene == Constants.MENU_SCENE)
{
Do something
}

#

@cedar hemlock

cedar hemlock
#

oh ok

#

am i doing something wrong?

copper nacelle
#

capital i

#

if not If

cedar hemlock
#

lol

jolly jungle
#

(From Traitor God)

Sprites.Add(Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)));
So, the vector is passed as the "pivot point"... does that mean it just makes the image centered?

jolly oriole
#

where the gameobject is placed is the middle of the image

#

so yes

jolly jungle
#

Thanks

#

Can someone explain how this line works?

#

Wait my bad it's this entire thing

#

It seems unnecessarily complicated

#

I hope that it's only dnspy doing its thing and not that that's how I'll need to do it every time

copper nacelle
#

It's just the other form of linq

#

can do it with the fluent api instead if you'd like

prime urchin
#

it's using LINQ query and doing it complicated-like - looks like it'd be the same as Object.FindObjectsOfType<HealthManager>().Where(hm => hm.name.Contains("Climber"))

jolly jungle
#

Hm

#

So there's no way to do it that I understand, not right now

#

I mean I get almost all of it?

#

hm => hm.name.Contains("Climber")
Just not this

prime urchin
#

it's using LINQ and that's a predicate

#

it's like an inline method

#

Where() basically loops through the collection and passes you the current element

#

so hm is the current element and we're using it to return a bool value

jolly jungle
#

How do we know hm is the current element?

#

Or is that just what the syntax is all about?

prime urchin
jolly jungle
#

Ah I think I get it

#

So

#

hm => hm.name.Contains("Climber")) means we take the current thing as hm, and then return the result of the other expression, which checks for it being named "climber"

stone elm
#

It just means you've created an anonymous (without a name) function that takes in 1 element (in this case whatever type the enumerable carries) and returns a boolean result.

jolly jungle
#

heh

prime urchin
#

pretty much - I'm doing a crap job of explaining it rn lul

jolly jungle
#

it's alright

stone elm
#

Yep, basically. The magic happens in Where() itself

stone elm
jolly jungle
#

I understood so you explained just fine hollowknice

#

I'm missing something to squeeze in between them, not sure what

copper nacelle
#

.Select(hm => hm.gameObject)

jolly jungle
#

Where?

copper nacelle
#

in the linq expression

#

doesn't really matter if it's before or after the where

jolly jungle
#

Ah, thanks

#

So it takes the gameobject that has hm?

#

Cool, works now

#

One last thing for now (as in, the next few minutes, I guess) - what are the uses of the two lines assigning null to things?

stone elm
#

Do you have experience in any other proglangs? Sometimes it's easier to describe concepts in terms of a familiar language

#

Although I can't answer the null question, was just wondering generally

deep wave
#

setting it to null is the equivalent of disposing of it, it's essentially saying "i don't need this anymore, so i'm going to stop keeping track of it"

stone elm
#

Setting to null eliminates a reference, and if there are no more references then the GC may collect it

#

It's not the same as IDisposable.Dispose (just noting to prevent confusion) unless something's going on out of view.

deep wave
#

maybe shouldn't have used the wording "disposing of it" when dispose is it's own thing TeeHee

stone elm
#

It's just silly semantics in 90% of cases. I tend to be a very literal person so I try to use more precise wording... I know not everyone is the same way so I just chime in if it's helpful.

#

Or at least I hope it's helpful. 🙂

copper nacelle
#

it's a useless assignment in this context pretty sure

#

No use in overwriting a local at the end of a loop

#

Might be the state machine field

stone elm
#

Mhm, it looks like the dnspy color scheme so I'm assuming it's something that got decompiled imprecisely

woeful igloo
vocal spire
#

Do you use visual studio to code?

woeful igloo
#

Or... I guess uploading the entirety of the HKTest1 file into it? And yup.

vocal spire
#

Look up how to upload something to a GitHub repository in visual studio

stone elm
#

It helps to understand Git, if you don't already. GitHub has great tutorials on their site. Just FYI

jolly jungle
#

Trying to use StartCoroutine but it doesn't recognise it, what am I missing?

#

Does the class need to be a monobehaviour?

stone elm
#

Looks like it, yes.

jolly jungle
#

Hm

#

Is it alright if my main class, the Mod one, is also a monobehaviour or should I split them?

woeful igloo
jolly jungle
#

Seems like no

stone elm
#

Try it, haha

jolly jungle
#

Failed tamershrug

#

Now we know

stone elm
#

Oh, well, that's right. Silly me. Anyway, you can probably just grab a component that is a monobehaviour from Unity and have it start the coroutine for you

#

Look at the FsmStateAction class which contains a PlaymakerFSM object which does its coroutines

jolly jungle
#

I'm just curious how it was that transtrans did it in one file

jolly jungle
#

it calls it on GameManager

stone elm
#

That's a good way to go

jolly jungle
#

Thanks :D

#

Time to try this

quasi ridge
#

can i request mod here ?

deep wave
stone elm
#

just listen to jamie, generally, haha

quasi ridge
#

thank you

jolly jungle
#

It works!

#

Thanks @stone elm

stone elm
#

Oh, glad I was helpful. Have fun!

jolly jungle
#

Time to make another 6 enemies

copper nacelle
#

I can't believe you made them racist

jolly jungle
#

And then move on to other things

#

Wdym

cedar hemlock
#

White lol

jolly jungle
#

lmao I just turned it from crystals to, ah, a different crystal

jolly oriole
#

u racist towards pink crystals smh

cedar hemlock
jolly jungle
jolly oriole
#
  1. get texture of enemy
  2. replace texture
jolly jungle
#

Once I'm done with this practice mod (and maybe another one) I'll be modding a boss and that one should explain all this

cedar hemlock
#

Are you gonna make it open scource?

jolly jungle
#

The boss, most likely

#

This one, no

#

Not gonna release it publically at all, most likely

cedar hemlock
#

Sad

jolly jungle
#

publicly

jolly oriole
#

not open source mods smh

copper nacelle
#

true

jolly jungle
#

Anyways I'm off to rebalance coloring

#

Ciao

jolly oriole
#

56, you can't say that when you made transtrans not open source

copper nacelle
#

bro it's like two lines I ain't making a repo

#

I put the source in this channel anyways I think

jolly jungle
jolly oriole
#

gimme page number then

woeful igloo
#

There we go, now it works.

jolly jungle
#

For now, at least

#

@woeful igloo what were you trying to do?

#

Also congrats shroompog

copper nacelle
#

i am too lazy to find the page number

jolly oriole
#

poggers

#

the behaviour string of a CallMethodProper is the full classpath?

woeful igloo
#

Get the project to load to the github. It finally loaded, though. So yay!

copper nacelle
#

just component name

#

i don't think you even qualify it

#

it's whatever MonoBehaviour.GetComponent(string) takes

#

more specifically

woeful igloo
jolly jungle
#

Woo, nice!

copper nacelle
jolly oriole
#

the sha1 changes when the content of the mod dll changes

jolly jungle
#

So we can finally see the code?

copper nacelle
woeful igloo
#

Oh, the dll didn't change. The only thing that has changed was the readme file, so it can now be viewed.

jolly oriole
woeful igloo
#

.... I did something wrong again, didn't I?

jolly oriole
#

no, you didn't

#

in the linked message i pinged the person with a walking knife as a nickname

copper nacelle
#

i was sent the sha1 smh

jolly oriole
#

smh

woeful igloo
#

I was the one who sent him that. :x I thought I was supposed to make a github for the link, and then make a google drive that holds the zip file and use that to make the SHA1?

deep wave
#

the SHA1 is a property of the dll, not the upload

#

the dll changes, the sha1 of that dll changes

#

it's used to be able to detect when a mod has been updated and download the new version

woeful igloo
#

OH!

#

I... didn't... know that...

#

I thought the SHA1 was the part of the google view link, the code part. ^^;

deep wave
#

no, that's the google drive id used to create the correct link to download it programatically

woeful igloo
#

Well, I'm an idiot. :x

#

How does one find the SHA1?

jolly oriole
cedar hemlock
#

I got somewhere online a tool

jolly oriole
#

i use 7-zip

woeful igloo
#

I use 7-zip as well. Never done anything with sha1, though.

jolly oriole
#

right click -> crc sha -> sha-1

woeful igloo
#

.... Wow. It really was that easy. Thank you.

jolly oriole
#

can even double click it to easy copy paste

merry lotus
# copper nacelle the tech

This is a link to the source code of Transtrans by 56 so that it can be used as an example of how to modify enemy sprites.
This messages exists so that it's easily searchable in the future, because Discord Search is terrible; hopefully it'll help someone find it in the future.
#transtrans

#archived-modding-development message

woeful igloo
#

And thanks, there. Now the SHA1 is correct, hopefully it all works okay now.

jolly jungle
#

#transtrans transpass

deep wave
jolly jungle
#

I want this here so much rootcry hollowcry beastcry

stone elm
woeful igloo
#

Woo, the readme for job change now works. 😄

merry lotus
jolly jungle
#

Yeah but you can't use animated without nitro

#

And if you have nitro you can just put it on a private server for yourse;f

granite kestrel
#

Hello I try to build the hollow point mod but I don't know how to do

#

Can anyone teach me how to compile such project

merry lotus
#

Is the current issue that's been breaking both Mod Installers for a bunch of people known much about yet?
For some reason both Installer 1 and 2 are falling to load the mod lists for some people, and crashing a lot.
Here's a recent example: #archived-modding-help message

I'm just wondering if this is something where I should say "manually install for a few days" or if it's something where new installers are needed again @_@

copper nacelle
#

no

#

should be fine

#

I should fix my error logging throwing an error but nothing else should be broken

vocal spire
granite kestrel
#

in fact I have never build any projectsoulpensive

vocal spire
#

Ok

#

Are you trying to edit hollow point’s code or play it

granite kestrel
#

I want to edit it

#

Like editing values or something

vocal spire
#

Ok

#

Where did you purchase hollow knight

granite kestrel
#

steam

#

but I install at another location

vocal spire
#

Are you using visual studio?

granite kestrel
#

Yes I have visual studio and I'm on linux btw

vocal spire
#

Ok

#

Could you screenshot the references in the project?

granite kestrel
#

eh how?

vocal spire
#

Are you asking how to screenshot or what references are

granite kestrel
#

what is references

vocal spire
#

Screenshot the entirety of visual studio

granite kestrel
vocal spire
#

Well I have no idea how to use vscode to build

cedar hemlock
#

what is that

vocal spire
#

That is the .sln file of the solution

#

It doesn’t matter for what they’re trying to do

cedar hemlock
#

doesn't one use the .cs or .csproj file?

vocal spire
#

Open the folder

granite kestrel
#

then screenshot?

vocal spire
#

No

vocal spire
#

Sorry, explained very badly

cedar hemlock
#

also you cant see the references in a cs file??

#

i am using the transtrans.cs from yesterday

#

but theres also no build option

#

do i need to tell vs that this is something else??

vocal spire
#

?

granite kestrel
#

I don't know C# very well

cedar hemlock
#

do i need to tell vs that this is an class library?

vocal spire
cedar hemlock
#

i just clicked it

vocal spire
#

Well you need to create a project

#

You can’t just have a lone .cs file and build it

granite kestrel
#

So how can i build this project?

vocal spire
#

Idk how to in vscode

#

Vscode != visual studio tmk

cedar hemlock
vocal spire
#

Put the .cs file in the project or copy the code

#

Make sure it’s a class library targeting .net framework 3.5 btw

deep wave
#

vscode definitely != vs

cedar hemlock
#

will there then also be the references or do i jest make random references

vocal spire
#

You can add the references to the game’s files(mainly playmaker, assembly C sharp, unity engine, unity engine core module)

copper nacelle
#

it's not hard

vocal spire
#

Adding the references is required to build

copper nacelle
#

you just use omnisharp

#

and hit the build button

vocal spire
cedar hemlock
granite kestrel
#

Ok I downloaded the visual studio exe file and I will try to run on my dual-boot windows.

#

I will ask for help when I meet any problem

#

Thank you so much

vocal spire
#

Np

cedar hemlock
copper nacelle
#

unity texture conversion or w/e

vocal spire
#

Reference UnityEngine.ImageConversionModule.dll

cedar hemlock
#

ok

#

got it

#

how does it look for the image file??

#

how can you just not add an image and it still works

copper nacelle
#

it's an embedded resource

#

if you don't have the image then it's not going to work

vocal spire
#

Do I hear null reference exception

cedar hemlock
vocal spire
#

It’s in the project

#

You made one from scratch, so you don’t have the image so

vocal spire
cedar hemlock
#

how do i add it

vocal spire
#

You get an image of a tictic spritesheet(edited or not) and add it to the project under the expected name of the image. Edit the image’s properties to make it’s build action embedded resource

cedar hemlock
#

and how do i edit it

vocal spire
#

Well you right click the project click add click add existing then select the image

vocal spire
#

Once it’s there in vs, right click it, click properties, then click build action, then click the arrow next to it, then select embedded resource in the drop down menu

cedar hemlock
#

bitmap file?

#

or icon

vocal spire
#

?

#

Screenshot what you’re trying to do

cedar hemlock
vocal spire
#

Did you click add existing?

cedar hemlock
#

ah lol

vocal spire
#

The project

cedar hemlock
#

not the picture?

vocal spire
#

?

#

What step are you on

cedar hemlock
#

i need to right click it

#

the first right click

vocal spire
#

Ok

#

In vs right click the project

#

Nothing about the picture yet

#

Project, not solution

cedar hemlock
#

its not there lol

vocal spire
#

I see it

cedar hemlock
#

when i right click Class1.cs up top theres no propereties

vocal spire
#

Also you clicked the solution

#

I never said anything about the stuff up there

cedar hemlock
#

"click properties"

cedar hemlock
#

then where

#

im completely lost lol

vocal spire
#

Editing a screenshot hold on

#

Red: solution
Green: why is that there
Blue: project

cedar hemlock
vocal spire
#

Also you want to expand(click the arrow) next to the project

cedar hemlock
#

when theres no build action 👀

#

am i blind??

copper nacelle
#

are you looking for the build button

#

or

copper nacelle
#

ah

vocal spire
#

I meant the IMAGE once it’s in there

cedar hemlock
#

Pure_Zote is the random image

vocal spire
#

Why is it in the solution tho

#

And not the project

cedar hemlock
#

oh i made ultra mistake

#

i added the image to the solution

vocal spire
cedar hemlock
#

ok i got it

#

ok so in Debug theres also a serecore.dll i can just use the one from the modinstaller right?

#

prob yes

vocal spire
#

Why do you need serecore?

cedar hemlock
#

its a recuired reference

vocal spire
#

Does transtrans need it? I thought I looked at the code and it wasn’t needed

cedar hemlock
#

if i dont reference it i get an error

vocal spire
#

What’s the error

cedar hemlock
#

Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'SeanprCore' could not be found (are you missing a using directive or an assembly reference?)

vocal spire
#

Is that the only error

cedar hemlock
#

emily just say your problem

cedar hemlock
vocal spire
#

Yeah

vocal spire
#

Or dm if you’re muted

vocal spire
cedar hemlock
#

then why is it there lol

vocal spire
#

¯_(ツ)_/¯

#

Ask 56, not me

cedar hemlock
#

56 just likes serecore

copper nacelle
#

who

#

what

#

is that in transtrans

cedar hemlock
#

why is it there

copper nacelle
#

idk

vocal spire
copper nacelle
#

you're

vocal spire
#

Yes

cedar hemlock
#

we cant dm you if you dont message

#

just dm me

vocal spire
cedar hemlock
#

thats easier

vocal spire
#

Well I assume it is coding related then

cedar hemlock
#

just dm me smh

vocal spire
#

Still typing

copper nacelle
#

bro

#

let them type in peace

cedar hemlock
#

smhsmh

#

why would you want to invite people

#

pls stop

#

stop pls

copper nacelle
#

extremely interesting

vocal spire
#

Yee

cedar hemlock
#

@ mods?

floral furnace
#

???

vocal spire
#

Welcome

cedar hemlock
#

wth i didn't even...

vocal spire
#

Magic

cedar hemlock
ornate rivet
cedar hemlock
#

lol

vocal spire
#

Yes

#

Just what I needed

cedar hemlock
#

@fair rampart

vocal spire
#

🤔

floral furnace
#

uhh shouldve told this to mods instead of dropping it in this channel

cedar hemlock
ornate rivet
#

why not in #off-topic why here of all places you could choose

cedar hemlock
#

idk

copper nacelle
#

presumably because this is where the constant typing indicator is

cedar hemlock
#

yeah

vocal spire
#

Ah

#

Fixed

cedar hemlock
#

if it wasn't bot it would react

vocal spire
#

Several people typing

ornate rivet
cedar hemlock
#

lol

vocal spire
ornate rivet
#

They will love you for it.

cedar hemlock
#

lol

floral furnace
#

next time send a mod mail (preferably) or DM us if you have an issue and you dont know where to drop it

ornate rivet
#

when will sid finish making that

copper nacelle
#

never

ornate rivet
vocal spire
#

Oh it’s actually a thing

cedar hemlock
#

what

#

how

#

we safe?

#

dont see it anymore

ornate rivet
#

just click on a different channel and you won't see it

#

not very hard my guy

cedar hemlock
#

its on hk dicussion

vocal spire
#

Yay it left

#

Oh

#

lol

#

Let them deal with it

cedar hemlock
#

ye

vocal spire
#

Several people typing should fix

cedar hemlock
#

ill stop now

#

bye

vocal spire
#

It’s back

copper nacelle
#

please i am begging you simply stop speaking about it

floral furnace
#

anyway just get back to wtv you guys were discussing and just let the mods handle this, thank you

vocal spire
#

I get the feeling we’re not using this channel for it’s intended purpose, but it’s probably fine

floral furnace
#

no need to flood this channel by constantly talking about it

leaden hedge
#

just ban the bot

floral furnace
#

on it

grand osprey
#

Ah, you guys are ahead of me on this one.

vocal spire
#

Who are you

grand osprey
#

Someone from other channels

floral furnace
#

its dead

grand osprey
vocal spire
#

Gg

ornate rivet
#

please just shush it

copper nacelle
#

true af

vocal spire
#

Yeah

leaden hedge
#

thats a good way to avoid my sick bot 😔

#

i cant read every message sent if you just talk with the typing indicator FeelsBadMan

cedar hemlock
#

bruh it didn't work

jolly oriole
#

crazy

cedar hemlock
#

bruh i forgot modcommon

#

the image is to big lol

cedar hemlock
#

mine is either too smal or too big

#

also i ripped the globalgamemanagers using Utinyripper but i cant find all the sprites

#

are they somewhere else?

copper nacelle
#

you can do it from code or use unity studio or something

#

serecore has a method for the former

#

Very convenient

cedar hemlock
#

so are all the sprites in globalgamemanagers or not??

cedar hemlock
#

can you change the sprite of an boss?

#

if yes what is thk called

jolly jungle
#

What image did you use?

cedar hemlock
#

idk i just used a random image of a hunter

jolly jungle
#

Where did you get it though/

#

?

#

this is the hunter spritesheet

cedar hemlock
cedar hemlock
jolly jungle
#

Yes but where

#

Did it look like this one?

cedar hemlock
#

no it was just an image

#

that was probably the problem

#

ok im starting to believe its impossible to make thk differen

#

i just gave no arguments and it worked on everything exept thk

jolly oriole
#

try to use a 8192x8192 png image for thk

cedar hemlock
#

thats not the problem

#

he doesnt change

#

he stays the same

#

foreach (GameObject go in Object.FindObjectsOfType<HealthManager>().Select(x => x.gameObject).Where(x => x.gameObject.name.Contains("")))

#

i literally typed nothing and he doesn't change

jolly oriole
#

does findobjectsoftype find inactive objects? i actually don't know

stone elm
#

I believe not, it finds (The singular does, I misread) first active object it sees. To my knowledge

jolly oriole
#

do FindObjectsOfType<whatever>(true)

cedar hemlock
#

foreach (GameObject go in Object.FindObjectsOfType<whatever>(true))?

jolly oriole
#

... don't forget to replace the whatever with the type you're searching

cedar hemlock
#

what do i fill in whatever

jolly oriole
#

so probably Healthmanager

cedar hemlock
#

foreach (GameObject go in Object.FindObjectsOfType<HealthManager>(true))

#

gives me an error

jolly oriole
#

because it's an array of HealthManagers, not GameObjects

stone elm
#

I'm pretty sure that function doesn't exist in the unity version HK uses (unless we're talking about the next patch with it upgraded)

cedar hemlock
#

with me just explain it like im 4

#

so how do i fix it

vocal spire
stone elm
vocal spire
#

Oh

cedar hemlock
vocal spire
#

Idk if that exists either

jolly oriole
#

it indeed doesn't exist

cedar hemlock
#

FindObjectOfType does exist

vocal spire
#

F

cedar hemlock
#

its what the original code also uses

stone elm
#

Yeah, well, it's nice to see how much easier unity is to work with over the years haha.

vocal spire
#

Just wait until GameObject.find(thk name) isn’t null with a coroutine

stone elm
vocal spire
#

Or once you load into their scene find the parent and go down the hierarchy

cedar hemlock
#

Error CS0030 Cannot convert type 'HealthManager' to 'UnityEngine.GameObject'
and
Error CS1501 No overload for method 'FindObjectsOfType' takes 1 arguments TransMod

#

if it helps

vocal spire
#

Change GameObject go to HealthManager hm

#

Or HealthManager nameofitidkwhatyouwant

jolly oriole
#

or just var item

vocal spire
#

Yeah

cedar hemlock
#

foreach (GameObject go in Object.FindObjectsOfType<HealthManager>(whatdoitypehere?)

jolly jungle
#

Beautiful beastcry

cedar hemlock
#

so i cant just type in (x => x.gameObject.name.Contains(""))) the name of thk?

#

(x => x.gameObject.name.Contains("HereTHK??")))

jolly jungle
jolly jungle
#

Of course, that'll give you the Healthmanager

cedar hemlock
#

yeah problem is that it doesn't work zote

jolly jungle
#

so you want to then do .Select(hm => hm.gameObject)

cedar hemlock
#

even when i dont give an argument, what causes everything to become the image

jolly jungle
#

Wdym?

#

Can you show your code?

cedar hemlock
#

if i just do ("") then everything becomes the image except thk

cedar hemlock
jolly jungle
#

Wait before that

#

You're trying to change the skin of thk?

cedar hemlock
#

yes

jolly jungle
#

Because that's a specific enemy, you don't need to do all this

#

You can just wait for the game to detect you entered their room

#

And then find thk

#

and change skin

cedar hemlock
#

yeah problem is that i dont know how to do that zote

jolly jungle
#

Check out other projects

#

I personally used Traitor God for a lot of things, but that's a bit complicated

#

Try Lost Lord maybe?

#

My own Buzzbo does the entire find-room-and-then-find-boss part, too, but not the reskin

cedar hemlock
#

var x = GameManager.instance?.gameObject.GetComponent<KinFinder>();?

#

idk where it is

#
    {
        private void Start()
        {
            USceneManager.activeSceneChanged += SceneChanged;
        }

        private void SceneChanged(Scene arg0, Scene arg1)
        {
            if (arg1.name != "GG_Lost_Kin") return;

            StartCoroutine(AddComponent());
        }

        private static IEnumerator AddComponent()
        {
            yield return null;

            GameObject.Find("Lost Kin").AddComponent<Kin>();
        }

        private void OnDestroy()
        {
            USceneManager.activeSceneChanged -= SceneChanged;
        }
    } ```
#

where do i add thk

jolly jungle
#

Aight so

stone elm
jolly jungle
#

You see how it does this part?

private void Start()
{
    USceneManager.activeSceneChanged += SceneChanged;
}

private void SceneChanged(Scene arg0, Scene arg1)
{
    if (arg1.name != "GG_Lost_Kin") return;

    StartCoroutine(AddComponent());
}```
cedar hemlock
#

this??

jolly jungle
#

See these two parts?

cedar hemlock
#

yes

stone elm
cedar hemlock
#

what no one posted lol

jolly jungle
#

Alright so

#

Do you understand what it does?

cedar hemlock
#

does this work

#

nope

cedar hemlock
jolly jungle
#

You need to do triple ` btw

#

not just one

#

Anyways

#

So now, instead of AddComponent(), you can add something that directly looks for something with thk's name

cedar hemlock
#

it checks if the scene changed then sees if "GG_Lost_Kin" is there right

jolly jungle
#

and then run the swippity swap on it

cedar hemlock
#

hm

jolly jungle
#

When the scene is changed, SceneChanged() gets called

#

With two arguments passed into it

#

arg0 is the previous scene

#

arg1 is the new scene

cedar hemlock
jolly jungle
#

it checks if the new scene is the lost kin scene in godhome

jolly jungle
#

Just GameObject.Find("")

cedar hemlock
#

ah

jolly jungle
#

Because you have only one, and you know exactly where it is

cedar hemlock
#

StartCoroutine(GameObject.Find("THK"));

#

then i need to change GG_Lost_Kin too right?

#
        private void Start()
        {
            USceneManager.activeSceneChanged += SceneChanged;
        }

        private void SceneChanged(Scene arg0, Scene arg1)
        {
            if (arg1.name != "ThisNeedToChange") return;

            StartCoroutine(GameObject.Find("THK"));
        }

        private static IEnumerator AddComponent()
        {
            yield return null;

            GameObject.Find("WhatHere??").AddComponent<Kin>();
        }

        private void OnDestroy()
        {
            USceneManager.activeSceneChanged -= SceneChanged;
        }
    }
deep wave
#

i don't believe THK's gameobject is called THK but i might be wrong

#

the scene is Room_Final_Boss_Core

cedar hemlock
#

what do i place at WhatHere??

deep wave
#

can't you just leave it empty, as THK is the only enemy in the room?

cedar hemlock
jolly jungle
#

Oh, uh

deep wave
#

use debug to find the names of enemies

cedar hemlock
jolly jungle
#

You misunderstood what I meant when I said

So now, instead of AddComponent(), you can add something that directly looks for something with thk's name

#

Sorry for being unclear

deep wave
#

THK is called Hollow Knight Boss

jolly jungle
#

I meant you add a coroutine that instead of adding any altering component, it will simply swap the skin

#

@cedar hemlock

cedar hemlock
#

add the same thing?

#

i dont understand lol

#

but sadly i gtg now

#

ill ask again tommorow

jolly jungle
#

So anyone has any idea how I change the skin of the miners only once they get aggroed?

#

This what they look like now while calm

#

When calm, they use the same sheet as Myla

#

Should I add to them a component that detects when they get aggroed and only then will change their texture?

jolly jungle
#

Hm, does InsertMethod on fsms need ModCommon to work?

jolly oriole
#

i don't think that it's in playmaker normally

#

so yes

jolly jungle
#

Any way to go around it?

jolly oriole
#

include modcommon?

#

or make your own fsmstateaction class that calls your method

jolly jungle
#

Too complex for me now

#

So I'll need to settle for modcommon

stone elm
#

Reimplement it (InsertMethod), it is implemented as static methods and extensions in modcommon.

jolly oriole
#
class c : FsmStateAction
{
  public void OnEnter()
  {
    test.method();
  }
}
stone elm
#

It wouldn't be crazy to copy-paste with some attribution.

#

SFGrenade's answer is probably more concise if you just want to use it once or twice, though.

jolly oriole
#

btw, i wrote that directly in discord, so idk if that's missing things

stone elm
#

override keyword

#

I didn't know that off the top of my head, I was just looking at modcommon's source, haha

jolly oriole
#

vs or rider will tell you though lol

jolly jungle
#

Heyo I'm back

#

Hm

#

This seems kind of I-don't-understand-this right now

#

I'll just use modcommon I guess

cedar hemlock
#

hello im back

jolly jungle
#

Hi back, I'm Godfriend elderbug

cedar hemlock
#

you're no one lol

#

but you meant that i do IEnumerator CheckHK then in that do GameObject.Find("Hollow Knight Boss")

#

and then yield return null

vocal spire
vocal spire
stone elm
#

I'm having a hell of a time getting a mod dependency to load (which itself depends on newtonsoft.json). The catch is that this dependency cannot itself depend on the moddingapi... I brought this up before and had solved it somewhat with an AssemblyResolve binding but now I'm running into the issue again and attempting to resolve the assembly myself seems to crash HK. (Hooray)

#

Anyone have any leads/ideas on how I might go about making this work out? I'm a little up in the air right now as I bash my head against it.

vocal spire
#

Why do you need to reference newtonsoft specifically?

stone elm
#

Do you have a better json serializer/deserializer that works in 3.5 and is forward/backwards compatible for other users of my library? I really wish I could use something else that might work everywhere but it's pretty niche right now

#

newtonsoft is nice at least in that it's forward compatible and binding redirects let future users of my lib use any version above my referenced version (which is low due to 3.5 constraint)

vocal spire
#

I mean why can’t you just use it from the ModdingApi

stone elm
#

The lib that needs it is general purpose and not tied to HK modding api. I cannot reference the api to retain that agnostic requirement

vocal spire
#

Have a slightly different version for hk modding?

stone elm
#

I don't care whose version of those types I use, but I can't even get the redirected resolve to work.

stone elm
#

I added a debug print to my static constructor and now it doesn't crash.... Weird. Probably some runtime bs. How exhausting. 😩

cedar hemlock
# vocal spire show your code after doing this and I'll tell you what to do
    {
        private void Start()
        {
            USceneManager.activeSceneChanged += SceneChanged;
        }

        private void SceneChanged(Scene arg0, Scene arg1)
        {
            if (arg1.name != "Room_Final_Boss_Core") return;

            StartCoroutine FindHK;
        }

        private static IEnumerator FindHK()
        {
            GameObject.Find("Hollow Knight Boss");
            yield return null;
        }

        private void OnDestroy()
        {
            USceneManager.activeSceneChanged -= SceneChanged;
        }
    }
jolly oriole
cedar hemlock
#

eh i just used what was already there

jolly oriole
#

self promo: SFCore allows one to search for gameobjects in scenes, so arg1.Find("Hollow Knight Boss") is possible and also prevents instances where you try to find an object in one scene, but get one with the same name from another loaded scene

cedar hemlock
# cedar hemlock ```internal class KinFinder : MonoBehaviour { private void Start() ...

but do i just copy paste ```private void Start()
{
USceneManager.activeSceneChanged += SceneChanged;
}

    private void SceneChanged(Scene arg0, Scene arg1)
    {
        if (arg1.name != "Room_Final_Boss_Core") return;

        StartCoroutine FindHK;
    }

    private static IEnumerator FindHK()
    {
        GameObject.Find("Hollow Knight Boss");
        yield return null;
    }

    private void OnDestroy()
    {
        USceneManager.activeSceneChanged -= SceneChanged;
    }```

into where i want it?

#

No issues found so i guess so

#

but how do i put it in my own code

#

foreach (GameObject go in Object.FindObjectsOfType<HealthManager>().Select(x => x.gameObject).Where(x => x.gameObject.name.Contains("")))

#

if I do foreach (GameObject go in Object.FindObjectsOfType<HKfinder>()) i get ```
Error CS0030 Cannot convert type 'Transtrans.TransMod.HKfinder' to 'UnityEngine.GameObject'

jolly oriole
#

i mean
GameObject.Find("Hollow Knight Boss"); is kinda the gameobject you're looking for

cedar hemlock
#

so where do i place it

#

foreach (GameObject go in Object.FindObjectsOfType<HKfinder>().Select(x => x.gameObject).Where(x => x.gameObject.name.Contains(""))) doesn't give an error

#

if i delete .Where(x => x.gameObject.name.Contains("")

#

it also doesn't

#

so do i need to use ``` foreach (GameObject go in Object.FindObjectsOfType<HKfinder>().Select(x => x.gameObject))
{
go.GetComponent<tk2dSprite>().GetCurrentSpriteDef().material.mainTexture = _tex;
}

#

aparently not

cedar hemlock
#

i dont understand

jolly oriole
cedar hemlock
#

like this?

#

var x = GameManager.instance?.gameObject.GetComponent<KinFinder>();

#
            {
                var x = GameManager.instance?.gameObject.GetComponent<HKfinder>();
                go.GetComponent<tk2dSprite>().GetCurrentSpriteDef().material.mainTexture = _tex;
            }``` ?
jolly jungle
#

No, not exactly

#

What you want, in pseudocode, is this

Start()
{
    hook activeSceneChanged to SceneChanged
}

SceneChanged (previous, current)
{
    if current is THK's scene, start SkinChange
}

SkinChange ()
{
    thk = find(THK's name here)
    thk.changeSpriteTo(text)
}```
Or something like that
#

I don't know how to actually write pseudocode anyways

#

You can also just not do a coroutine for this but idk if that's a good idea

cedar hemlock
jolly jungle
#

Yes kind of but

#

GameObject.Find("Hollow Knight Boss");
This returns the boss
You want to place it inside some var so you can actually do things on it later

cedar hemlock
#

so on //something here to start skinchange I type: var x = whatherehelpme

#

if you didn't notice im not rly good at coding

#

what do i type after var x = ?

#

var x = GameManager.instance?.gameObject.GetComponent<HKfinder>(); ?

jolly jungle
#

Nonono

#

I mean

#

You store GameObject.Find("Hollow Knight Boss"); in the variable

cedar hemlock
#

var x = GameObject.Find("Hollow Knight Boss"); ?

jolly jungle
#

Yeah, like that

#

Now x is basically the Hollow Knight

#

and now you jsut do x.changeSkinShenanigans

#

The shenanigans being GetComponent<tk2dSprite>().GetCurrentSpriteDef().material.mainTexture = _tex;

#

Now, if I didn't miss anything or mess up entirely in my explanation, this should work

cedar hemlock
#

the name x does not excist in current context

jolly jungle
#

by the way can I see the texture you're going to put on?

jolly jungle
cedar hemlock
jolly jungle
#

Wdym

cedar hemlock
jolly jungle
#

How do you plan changing the skin if you dont have a new skin

cedar hemlock
jolly jungle
#

Please
Forget all this part

#

You don't need it

#

If you have a specific enemy

cedar hemlock
jolly jungle
#

Just do the x.changeSkinShenanigans right after x = GameObject.Find

cedar hemlock
#

oh okay

jolly jungle
#

Cool

#

Anwyays

#

Wait

#

Woaj

cedar hemlock
#

before or after yield return null

jolly jungle
#

What's all this

#

You're overcomplicating all this

#

And moving a lot of things around

#

You don't need a whole class for this

cedar hemlock
#

i just used the code that was in the example mod

jolly jungle
#

Yeah but that was code for changing a boss's movements and all, too

cedar hemlock
#

just yeet the class part?

jolly jungle
#

You can do everything in one tiny class

jolly jungle
#

You don't need more than that

cedar hemlock
#

so just yeet the clss part

#

nope

jolly jungle
#

and whatever the foreach is in right now

#

Can you show the top part of the code?

jolly jungle
cedar hemlock
#
{
    public class TransMod : Mod
    {
        private Texture2D _tex;

        public override void Initialize()
        {
            USceneManager.activeSceneChanged += SceneChanged;

            Assembly asm = Assembly.GetExecutingAssembly();
            
            foreach (string res in asm.GetManifestResourceNames())
            {
                using (Stream s = asm.GetManifestResourceStream(res))
                {
                    if (s == null) continue;

                    byte[] buffer = new byte[s.Length];
                    s.Read(buffer, 0, buffer.Length);
                    
                    _tex = new Texture2D(2, 2);

                    _tex.LoadImage(buffer, true);
                }
            }
        }

        private void SceneChanged(Scene arg0, Scene arg1)
        {
            GameManager.instance.StartCoroutine(SetSprite());
        }

        private IEnumerator SetSprite()
        {
            yield return null;

            // Finding just HealthManagers and going up is faster I think
            
        }
        internal class HKfinder : MonoBehaviour
        {
            private void Start()
            {
                USceneManager.activeSceneChanged += SceneChanged;
            }

            private void SceneChanged(Scene arg0, Scene arg1)
            {
                if (arg1.name != "Room_Final_Boss_Core") return;

                StartCoroutine(FindHK());
            }

            private static IEnumerator FindHK()
            {
                var x =GameObject.Find("Hollow Knight Boss");
                yield return null;
            }

            private void OnDestroy()
            {
                USceneManager.activeSceneChanged -= SceneChanged;
            }
        }
    }
}
cedar hemlock
jolly jungle
#

Wait no

#

Wrong foreach

#

gimme a sec here

#

Alright so your SetSprite is already a coroutine

#

You don't need another one

#

Now ou want to make it run only when in the boss room

#

internal class HKfinder : MonoBehaviour
Yeet this entire thing, you don't need it

#

So you want to move the if (arg1.name != "Room_Final_Boss_Core") return; to the other SceneChanged
So setsprite will only happen in thk's room

#

then you can move the code from inside FindHK() and place it inside SetSprite()

#

and then add after that the x.changeSkinShenanigans

jolly oriole
#

i usually don't do this, but

namespace ThkSpriteChange
{
    public class ThkSpriteChangeMod : Mod
    {
        private Texture2D _tex;

        public override void Initialize()
        {
            USceneManager.activeSceneChanged += SceneChanged;
            using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("ThkSpriteChange.thksprite.png"))
            {
                byte[] buffer = new byte[s.Length];
                s.Read(buffer, 0, buffer.Length);
                _tex = new Texture2D(2, 2);
                _tex.LoadImage(buffer, true);
            }
        }

        private void SceneChanged(Scene from, Scene to)
        {
            if (!to.name.Equals("Room_Final_Boss_Core")) return;
            GameObject.Find("Hollow Knight Boss").GetComponent<tk2dSprite>().GetCurrentSpriteDef().material.mainTexture = _tex;
        }
    }
}

could be one form of changing thk sprite

cedar hemlock
#

and just yeet private void Start() { USceneManager.activeSceneChanged += SceneChanged; }
and

            {
                USceneManager.activeSceneChanged -= SceneChanged;
            }```
from the deleted class
cedar hemlock
# jolly jungle and then add after that the `x.changeSkinShenanigans`
{
    public class TransMod : Mod
    {
        private Texture2D _tex;

        public override void Initialize()
        {
            USceneManager.activeSceneChanged += SceneChanged;

            Assembly asm = Assembly.GetExecutingAssembly();
            
            foreach (string res in asm.GetManifestResourceNames())
            {
                using (Stream s = asm.GetManifestResourceStream(res))
                {
                    if (s == null) continue;

                    byte[] buffer = new byte[s.Length];
                    s.Read(buffer, 0, buffer.Length);
                    
                    _tex = new Texture2D(2, 2);

                    _tex.LoadImage(buffer, true);
                }
            }
        }

        private void SceneChanged(Scene arg0, Scene arg1)
        {
            if (arg1.name != "Room_Final_Boss_Core") return;
            {
                GameManager.instance.StartCoroutine(SetSprite());
            }
        }

        private IEnumerator SetSprite()
        {
            // Finding just HealthManagers and going up is faster I think
            var boss = GameObject.Find("Hollow Knight Boss");
            boss.GetComponent<tk2dSprite>().GetCurrentSpriteDef().material.mainTexture = _tex;
            yield return null;
        }
    }
}````?
jolly jungle
#

Wait why does that say transtrans zote

#

Have been just using the transtrans as a base this whole time?

#

Anyways this seems like it should work itssoulgood

#

Any problems beyond this point are because I probably forgot things

jolly jungle
#

Well that explains it

#

Cuz the transtrans is meant to swap the skins of all tiktiks

cedar hemlock
#

he aint blue

#

fail

#

what

#

it isn't even in the modlog

#

i only get:

[ERROR]:[UNITY] - ActionButtonIconBase.GetButtonIcon (HeroActionButton actionButton)
[ERROR]:[UNITY] - ActionButtonIconBase.RefreshButtonIcon ()
[ERROR]:[UNITY] - ActionButtonIconBase.OnEnable ()
[ERROR]:[UNITY] - ActionButtonIcon.OnEnable ()
[ERROR]:[UNITY] - UnityEngine.GameObject:SetActive(Boolean)
[ERROR]:[UNITY] - GameCameras:StartScene()
[ERROR]:[UNITY] - GameCameras:SceneInit()
[ERROR]:[UNITY] - GameManager:BeginScene()
[ERROR]:[UNITY] - <BeginSceneTransitionRoutine>c__AnonStorey13:<>m__3()
[ERROR]:[UNITY] - <BeginRoutine>c__Iterator0:MoveNext()
[ERROR]:[UNITY] - UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[ERROR]:[UNITY] - ```
#

does it have anything to do with it?

jolly oriole
#

i don't see anything with Transtrans

jolly jungle
#

Yeah I definitely forgot things zote

cedar hemlock
jolly jungle
#

I'd suggest changing the name of your mod btw-

cedar hemlock
#

i added public ClassName(): base("The Name You Want") { } but it says that the method must have an return type

jolly oriole
#

maybe because ClassName has to be the name of your class

cedar hemlock
#

oh lol

jolly jungle
#

But if it doesn't work I probably did

#

What things are you using?

#

And what do you reference

cedar hemlock
#

the modlog doesn't even show it

cedar hemlock
cedar hemlock
# jolly jungle What things are you `using`?
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using Modding;
using UnityEngine;
using UnityEngine.SceneManagement;
using UObject = UnityEngine.Object;
using USceneManager = UnityEngine.SceneManagement.SceneManager;
jolly oriole
cedar hemlock
#

yeah

jolly jungle
#

It appears in topleft?

cedar hemlock
#

ehm wait a sec

#

yes

#

modlog gives same error

[ERROR]:[UNITY] - NullReferenceException: Object reference not set to an instance of an object
[ERROR]:[UNITY] - TransHK.TransMod+<SetSprite>d__5.MoveNext ()
[ERROR]:[UNITY] - UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress)
[ERROR]:[UNITY] - UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
[ERROR]:[UNITY] - TransHK.TransMod:SceneChanged(Scene, Scene)
[ERROR]:[UNITY] - UnityEngine.SceneManagement.SceneManager:UnloadScene(String)
[ERROR]:[UNITY] - <BeginSceneTransitionRoutine>c__AnonStorey13:<>m__2()
[ERROR]:[UNITY] - <BeginRoutine>c__Iterator0:MoveNext()
[ERROR]:[UNITY] - UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[ERROR]:[UNITY] - 
#

its called TransHK

jolly jungle
#

Wait there may be something wrong in the texture loading

#

Not sure

cedar hemlock
#

i did make it embedded

jolly jungle
#

Actually, looking at the modlog, I have no idea what's wrong

#

yay bote

cedar hemlock
#

ok added some logs

#

private void SceneChanged(Scene arg0, Scene arg1) = Scenechanged
private IEnumerator SetSprite() = Setting sprites
public override void Initialize() = starting
foreach (string res in asm.GetManifestResourceNames()) = GetManifestRescourceNames

#

the errors start at [INFO]:[DebugMod] - [DREAM GATE] File dreamgate.dat not found!
and end at
[INFO]:[TransMod] - Setting sprites

#

so private IEnumerator SetSprite() is broken?

jolly oriole
#
[ERROR]:[UNITY] - NullReferenceException: Object reference not set to an instance of an object
[ERROR]:[UNITY] - TransHK.TransMod+<SetSprite>d__5.MoveNext ()

yes

cedar hemlock
#
        {
            Log("Setting sprites");
            var boss = GameObject.Find("Hollow Knight Boss");
            boss.GetComponent<tk2dSprite>().GetCurrentSpriteDef().material.mainTexture = _tex;
            yield return null;
        }```
jolly oriole
#

i mean, it's proably the 3rd line lol

cedar hemlock
#

but why does it work for tiktiks but not for thk

jolly oriole
#

oh no

cedar hemlock
#

so?

jolly oriole
#

have fun ig lmao

cedar hemlock
#

theres no fix?

jolly oriole
#

no fixes, only workarounds

cedar hemlock
#

how do i workaround

jolly oriole
#
  1. get the parent gameobject
  2. navigate manually to the one you want
cedar hemlock
#

yeah i have 0 idea what you mean

jolly oriole
#

another alternative is

  1. reference sfcore in the project
  2. add a Scene scene parameter to SetSprite() (you give it the arg1 scene object)
  3. Change GameObject.Find to scene.Find
cedar hemlock
#

you mean with 2 SetSprite(Scene arg1)?

jolly oriole
#

yes, though then step 3 would be arg1.Find

cedar hemlock
#
        {
            Log("Setting sprites");
            var boss = arg1.Find("Hollow Knight Boss");
            boss.GetComponent<tk2dSprite>().GetCurrentSpriteDef().material.mainTexture = _tex;
            yield return null;
        }``` ?
#

then i get 2 errors

jolly oriole
#

let me take a wild guess

#
  1. the arg isn't supplied in GameManager.instance.StartCoroutine(SetSprite());
  2. in arg1.Find("Hollow Knight Boss");, there is no Find method
cedar hemlock
jolly oriole
#

ez

#
  1. change the line containing GameManager.instance.StartCoroutine(SetSprite()); to GameManager.instance.StartCoroutine(SetSprite(arg1));
#

2:

  1. reference sfcore in the project
  2. add a using SFCore.Util; at the top (or using SFCore.Utils;, idk which one it is)
cedar hemlock
#

yes, i referenced sfcore

#

and tried utils

jolly oriole
#

what does autocomplete give you for namespaces when typing using SFCore. ?

cedar hemlock
#

monobehaviours

jolly oriole
#

only that?

cedar hemlock
#

yeah

jolly oriole
#

are you sure you're using the sfcore from the modinstaller?

cedar hemlock
#

yep

#

i can see if theres an update

jolly oriole
#

oh fuck

#

haven't updated it with that code yet lmao

cedar hemlock
#

lol

#

is it on github

jolly oriole
#

actually no

#

gimme a second, maybe i can find it in one of my other repos

cedar hemlock
#

you didn't find it?

jolly oriole
#

https://raw.githubusercontent.com/SFGrenade/AdditionalMaps/master/Utils/USceneUtil.cs
have

public static GameObject Find(this Scene scene, string name)
{
    if (scene.IsValid())
    {
        GameObject retGo;
        foreach (var go in scene.GetRootGameObjects())
        {
            if (go.name == name)
            {
                return go;
            }
            retGo = go.Find(name);
            if (retGo != null)
            {
                return retGo;
            }
        }
    }
    return null;
}

either as a method in your class (not tested if possible), or in its own public static class (definetly works)

#

or just include the whole linked file in your project

cedar hemlock
#

ok thnx

#

ill look at it later

vocal spire
#

Another fix:


yield return new WaitWhile(!GameObject.Find(“Hollow Knight Boss”));
var Boss = GameObject.Find(“Hollow Knight Boss”); ```
jolly oriole
#

fuck yield return new WaitWhile, demolishes fps

vocal spire
#

Ok

cedar hemlock
#

I just made it a class

#

the error is refering to retGo = go.Find(name);

vocal spire
#

Autocorrect is evil

cedar hemlock
#

it worked

#

ill try again

#

it failed

vocal spire
#

What’s the error

cedar hemlock
#

im looking at modlog gimme sec

#

oh getting the same errror at two places

#
[ERROR]:[UNITY] - NullReferenceException: Object reference not set to an instance of an object
[ERROR]:[UNITY] - ActionButtonIconBase.GetButtonIcon (HeroActionButton actionButton)
[ERROR]:[UNITY] - ActionButtonIconBase.RefreshButtonIcon ()
[ERROR]:[UNITY] - ActionButtonIconBase.OnEnable ()
[ERROR]:[UNITY] - ActionButtonIcon.OnEnable ()
[ERROR]:[UNITY] - UnityEngine.GameObject:SetActive(Boolean)
[ERROR]:[UNITY] - HutongGames.PlayMaker.Actions.ActivateAllChildren:OnEnter()
[ERROR]:[UNITY] - HutongGames.PlayMaker.FsmState:ActivateActions(Int32)
[ERROR]:[UNITY] - HutongGames.PlayMaker.FsmState:OnEnter()
[ERROR]:[UNITY] - HutongGames.PlayMaker.Fsm:EnterState(FsmState)
[ERROR]:[UNITY] - HutongGames.PlayMaker.Fsm:SwitchState(FsmState)
[ERROR]:[UNITY] - HutongGames.PlayMaker.Fsm:UpdateStateChanges()
[ERROR]:[UNITY] - HutongGames.PlayMaker.Fsm:Start()
[ERROR]:[UNITY] - PlayMakerFSM:Start()
[ERROR]:[UNITY] - 
vocal spire
#

That doesn’t seem related to your code

cedar hemlock
#

hmm

#

does look like it in modlig

#

log*

vocal spire
#

Found your error lower down

cedar hemlock
#

oh im blind af

#
[ERROR]:[UNITY] - NullReferenceException: Object reference not set to an instance of an object
[ERROR]:[UNITY] - TransHK.This.Find (Scene scene, System.String name)
[ERROR]:[UNITY] - TransHK.TransMod+<SetSprite>d__5.MoveNext ()
[ERROR]:[UNITY] - UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress)
[ERROR]:[UNITY] - UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
[ERROR]:[UNITY] - TransHK.TransMod:SceneChanged(Scene, Scene)
[ERROR]:[UNITY] - UnityEngine.SceneManagement.SceneManager:UnloadScene(String)
[ERROR]:[UNITY] - <BeginSceneTransitionRoutine>c__AnonStorey13:<>m__2()
[ERROR]:[UNITY] - <BeginRoutine>c__Iterator0:MoveNext()
[ERROR]:[UNITY] - UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[ERROR]:[UNITY] - 
vocal spire
#

Did you make a class called This and put the method in there

vocal spire
#

Very interesting name for a class

#

Anyways I suggest adding some logging to find exactly where the error occurs

cedar hemlock
#

ok ill do that

#

in the new code?

vocal spire
#

In the Find method

cedar hemlock
#

what

#

since when does Log not exist

#

in the current context

vocal spire
#

?

jolly oriole
#

the Mod class, which TransHK.TransMod inherits from, has the Log method defined, for all new classes that has to be made from scratch

cedar hemlock
#

oh

vocal spire
#

Also it needs to be an instance right?

cedar hemlock
#

how do i define it

jolly oriole
cedar hemlock
#

how do i make it working in a static

#

it has problem with everything with log in the name lol

vocal spire
#

public static void Log(string s)
{
Modding.Logger.Log(“[Thing]” + s);
}

cedar hemlock
#

all kinds of things expected and unexpected

jolly oriole
#

$"[Thing] - {s}" is more fancy though

vocal spire
#

Good point

cedar hemlock
vocal spire
cedar hemlock
#

hmm

#

SFGrenades code doesn't give an single log

#

and the same error ofc

#

i aint gonna post modlog since the exact same

vocal spire
#

Did you ever use the Log method?

#

It should log

cedar hemlock
#

wdym

#
public static class Rareclass
    {
        public static void Log(string s)
        {
            Modding.Logger.Log($"[Thing] - {s}");
        }
        public static GameObject Find(this Scene scene, string name)
        {
            Log("NewMethodCalled");
            if (scene.IsValid())
            {
                Log("SceneIsValid");
                GameObject retGo;
                foreach (var go in scene.GetRootGameObjects())
                {
                    if (go.name == name)
                    {
                        Log("if (go.name == name)");
                        return go;
                    }
                    retGo = go.transform.Find(name).gameObject;
                    if (retGo != null)
                    {
                        Log("if retGo != null");
                        return retGo;
                    }
                }
            }
            return null;
        }
    }
vocal spire
#

Ah

#

Then it had a null reference before it reached the log

#

Somehow