#archived-modding-development
1 messages · Page 506 of 1
Not sure which parts you're unfamiliar with, but here's a broad swing: UnityAction seems to be the same as the stdlib's Actions. Both UnityAction and Action are essentially links to functions. UnityAction<Scene, Scene> specifically is a link to a function that takes in a Scene as its only argument, and returns a Scene, ex:
Scene Foo(Scene scene) {
// ... some code
}
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.
it just because of decomp
yes
it just does that because of the hook
Whatever triggers the activeSceneChanged event will give the arguments
it's automatic, as when the event is invoked, it calls each subscriber and passes the required parameters
wait nevermind I forgot I already have things that do that so I can check those 
Aight so it's just dnspy working confusingly
(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)
well, dnspy is displaying it as it is, it's just that the source code gets compiled in such a way
A lot of stuff in C# is compiled to simpler/more explicit code
Yeah don't worry john I didn't get what you were talking about anyways 
dnSpy does its best to decompile it into more sensible stuff but it doesn't catch everything
aw bummer
they're called 'events' in C# if you want to look up more about it
or delegates
delegates are called function pointers in other languages if you've got a background elsewhere
sometimes functors
Anyways thanks everyone 
What does Mod<SaveSettings> instead of Mod do?
Wasn’t that removed?
It allows for settings stored in the save file
Makes sense
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
if i update sfcore on the modinstaller that is
imma try adding a journal like inventory page for the items first
and if 1.5 releases before i finish that, then y'all are screwed lmao
lol
It seems that the Texture2d.LoadImage that was used by Traitor God is no longer in use
?
But I can't seem to use ImageConversion either
Is UnityEngine.ImageConversionModule.dll referenced
Np
Should've seen that
@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?
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
totes. i'll bring it to some modestly useful state and call it good enough then
imma just put these here for visibility:
https://github.com/Ayugradow/ModInstaller/pull/62
https://github.com/Ayugradow/ModInstaller/pull/61
oof
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
Is "them" Jewel (Job Change mod)? Because that user ID doesn't match theirs.
Them?
I'm jewel, yes. Made the job change mod and sent in an update a few hours ago, sorry!
I'll need to try and get it fixed tomorrow.
Silly%?
Please do enlighten me
hey um
where can i find the skins
pins
i already have the mod
What about the shade
You talking about customknight?
yes
Just go to the pins in #archived-modding-help
the shade doesn't drop geo?
I mean
All geo lost
So you can die only once and after that all geo will be permanently lost upon death
oh that, will be steel soul, to sell rancid eggs
Ah
Well if the point is to get all money then a system that involves permanently losing money results in losing anyways
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
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)
sad
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?
application quit is going to be too late
I use BeforeSaveGameSave(is that the name of the hook?)
yeah but doesnt that also get triggered upon saving at a bench?
like SFGrenade said?
Did not think of that
ill see if this works
@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
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;
}
Aha, AfterSaveGameSave maybe
Just remembered
So in BeforeSaveGameSave set it to normal, after set it back to your custom amount
do i not have this issue when using BeforeSaveGameSave?
sry ping
But you’re setting it back to the custom value here
so then it never saves the custom value to file?
I think so
ah ok
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
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?)
AfterSaveGameSaveHook
same problem
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
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?
there's a constant for it
sry im not good at coding so idk what that means lol
public const string thingyorsomethingwhatisthename
Constants.MENU_SCENE
I mean what do i place in targetScene for it to activate at the titlescreen
private void ChangeScene(string targetScene)
{
throw new NotImplementedException();
}
lol
(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?
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
It's just the other form of linq
can do it with the fluent api instead if you'd like
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"))
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
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
How do we know hm is the current element?
Or is that just what the syntax is all about?
might wanna take a look at this https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/lambda-expressions
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"
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.
I thought it was that at first but you gave it a different name
heh
pretty much - I'm doing a crap job of explaining it rn lul
it's alright
Yep, basically. The magic happens in Where() itself
naw, you got it down good
I understood so you explained just fine 
I'm missing something to squeeze in between them, not sure what
.Select(hm => hm.gameObject)
Where?
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?
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
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"
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.
maybe shouldn't have used the wording "disposing of it" when dispose is it's own thing 
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. 🙂
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
Mhm, it looks like the dnspy color scheme so I'm assuming it's something that got decompiled imprecisely
Okay, when you say upload my source code to github, do you mean make a new file called jobChange source code and copy the source into there, or upload the jobChange.csproj directly to it, or something else entirely?
Do you use visual studio to code?
Or... I guess uploading the entirety of the HKTest1 file into it? And yup.
Look up how to upload something to a GitHub repository in visual studio
It helps to understand Git, if you don't already. GitHub has great tutorials on their site. Just FYI
Trying to use StartCoroutine but it doesn't recognise it, what am I missing?
Does the class need to be a monobehaviour?
Looks like it, yes.
Hm
Is it alright if my main class, the Mod one, is also a monobehaviour or should I split them?
Huh. Trying... to follow the directions, but I have no sync option. Which apparently is needed?
I don't know unity well enough to say ¯_(ツ)_/¯
Try it, haha
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
I'm just curious how it was that transtrans did it in one file
Ah wait that might be it
it calls it on GameManager
That's a good way to go
can i request mod here ?
#modding-discussion is a place for talking modding ideas
just listen to jamie, generally, haha
thank you
Oh, glad I was helpful. Have fun!
Time to make another 6 enemies
I can't believe you made them racist
White lol
lmao I just turned it from crystals to, ah, a different crystal
u racist towards pink crystals smh
Nice now explain how you did it on the api docs lol
No, no I promise 
- get texture of enemy
- replace texture
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
Are you gonna make it open scource?
The boss, most likely
This one, no
Not gonna release it publically at all, most likely
Sad
publicly
not open source mods smh
true
56, you can't say that when you made transtrans not open source
bro it's like two lines I ain't making a repo
I put the source in this channel anyways I think
All I just made was an even-lower-effort transtrans
gimme page number then
There we go, now it works.
Get the project to load to the github. It finally loaded, though. So yay!
just component name
i don't think you even qualify it
it's whatever MonoBehaviour.GetComponent(string) takes
more specifically
Get the project to load to the github. It finally loaded, though. So yay! I sent in the pull request. The SHA1 didn't change, since i just fixed the google drive file without any issue and the link for it stayed the same.
Woo, nice!

the sha1 changes when the content of the mod dll changes
So we can finally see the code?
Oh, the dll didn't change. The only thing that has changed was the readme file, so it can now be viewed.
.... I did something wrong again, didn't I?
no, you didn't
in the linked message i pinged the person with a walking knife as a nickname
i was sent the sha1 smh
smh
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?
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
OH!
I... didn't... know that...
I thought the SHA1 was the part of the google view link, the code part. ^^;
no, that's the google drive id used to create the correct link to download it programatically
I got somewhere online a tool
i use 7-zip
I use 7-zip as well. Never done anything with sha1, though.
right click -> crc sha -> sha-1
.... Wow. It really was that easy. Thank you.
can even double click it to easy copy paste
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
And thanks, there. Now the SHA1 is correct, hopefully it all works okay now.
#transtrans 

finally, the context ive been waiting for haha
Woo, the readme for job change now works. 😄
I'm pretty sure there's a lot of animated emoji slots available on the server. I'd imagine if someone exported a .gif of the sprites, then requested that be added, it wouldn't be an issue. (I know there used to be a message when #server-feedback was a thing, that gifs submissions were far more likely to be added)
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
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
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 @_@
no
should be fine
I should fix my error logging throwing an error but nothing else should be broken
Just build it like any other project. Why are you trying to build it?
in fact I have never build any project
Are you using visual studio?
Yes I have visual studio and I'm on linux btw
eh how?
Are you asking how to screenshot or what references are
what is references
Screenshot the entirety of visual studio
Well I have no idea how to use vscode to build
what is that
That is the .sln file of the solution
It doesn’t matter for what they’re trying to do
doesn't one use the .cs or .csproj file?
Open the folder
then screenshot?
No
That’s where these files are
Sorry, explained very badly
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??
?
I don't know C# very well
do i need to tell vs that this is an class library?
Well how did you create the project
So how can i build this project?
So i create a project then what
Put the .cs file in the project or copy the code
Make sure it’s a class library targeting .net framework 3.5 btw
vscode definitely != vs
will there then also be the references or do i jest make random references
You can add the references to the game’s files(mainly playmaker, assembly C sharp, unity engine, unity engine core module)
it's not hard
Adding the references is required to build
Otherwise welcome to the world of 100 errors in one file
yeah i know
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
Np
im missing one (also needed serecore btw):
Error CS1061 'Texture2D' does not contain a definition for 'LoadImage' and no accessible extension method 'LoadImage' accepting a first argument of type 'Texture2D' could be found (are you missing a using directive or an assembly reference?)
unity texture conversion or w/e
Reference UnityEngine.ImageConversionModule.dll
ok
got it
how does it look for the image file??
how can you just not add an image and it still works
it's an embedded resource
if you don't have the image then it's not going to work
Do I hear null reference exception
is it in the dll? or am i dumb cause i dont understand
This
how do i add it
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
just plop it in the place where the .cs is?
and how do i edit it
Well you right click the project click add click add existing then select the image
oh ok
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
Did you click add existing?
ah lol
what do i right click
The project
not the picture?
Ok
In vs right click the project
Nothing about the picture yet
Project, not solution
I see it
when i right click Class1.cs up top theres no propereties
"click properties"
oh ok
then where
im completely lost lol
Red: oh okay
Green: lol i found that random image in #modding-discussion
Blue: lol i was clicking that
Also you want to expand(click the arrow) next to the project
.
ah
I meant the IMAGE once it’s in there
Pure_Zote is the random image
Refer to this
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
Why do you need serecore?
its a recuired reference
Does transtrans need it? I thought I looked at the code and it wasn’t needed
if i dont reference it i get an error
What’s the error
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?)
Is that the only error
emily just say your problem
yea
Yeah
Just remove
using SeanprCore
then why is it there lol
56 just likes serecore
why is it there
idk
Emily just say you’re problem in #archived-modding-help smh
you're
Yes
Blame autocorrect
thats easier
Unless your problem is coding related go to #archived-modding-help
Well I assume it is coding related then
just dm me smh
Still typing
extremely interesting
Yee
@ mods?
???
Welcome
wth i didn't even...
Magic
there's someone that just types the whole day to invite people prob just bot
ah relationship advice in #archived-modding-development
lol
@fair rampart
🤔
uhh shouldve told this to mods instead of dropping it in this channel
yeah i dont know where to do this lol
why not in #off-topic why here of all places you could choose
idk
presumably because this is where the constant typing indicator is
yeah
if it wasn't bot it would react
Several people typing
@fair rampart
You want relationship advice?
Go make a mod for your friend using https://radiance.host/apidocs/
lol
Yeah
They will love you for it.
hk dating sim activate
lol
next time send a mod mail (preferably) or DM us if you have an issue and you dont know where to drop it
when will sid finish making that
never

Oh it’s actually a thing
its on hk dicussion
ye
Several people typing should fix
It’s back
please i am begging you simply stop speaking about it
anyway just get back to wtv you guys were discussing and just let the mods handle this, thank you
I get the feeling we’re not using this channel for it’s intended purpose, but it’s probably fine
no need to flood this channel by constantly talking about it
just ban the bot
on it
Ah, you guys are ahead of me on this one.
Who are you
Someone from other channels
its dead

Gg
please just shush it
true af
Yeah
thats a good way to avoid my sick bot 😔
i cant read every message sent if you just talk with the typing indicator 
crazy
what image did you use?
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?
you can do it from code or use unity studio or something
serecore has a method for the former
Very convenient
so are all the sprites in globalgamemanagers or not??
do what
idk i just used a random image of a hunter
online lol
thx
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
try to use a 8192x8192 png image for thk
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
does findobjectsoftype find inactive objects? i actually don't know
I believe not, it finds (The singular does, I misread) first active object it sees. To my knowledge
foreach (GameObject go in Object.FindObjectsOfType<whatever>(true))?
... don't forget to replace the whatever with the type you're searching
what do i fill in whatever
so probably Healthmanager
foreach (GameObject go in Object.FindObjectsOfType<HealthManager>(true))
gives me an error
because it's an array of HealthManagers, not GameObjects
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)
FindObjectsOfType?
Discord tos?
The overload with the bool for inactive objects
Oh
lol
Idk if that exists either
god fucking dammit
it indeed doesn't exist
FindObjectOfType does exist
F
its what the original code also uses
Yeah, well, it's nice to see how much easier unity is to work with over the years haha.
Just wait until GameObject.find(thk name) isn’t null with a coroutine
We're talking about the version of that with the true in there. You can't use that, it's probably where the error came from.
Or once you load into their scene find the parent and go down the hierarchy
Error CS0030 Cannot convert type 'HealthManager' to 'UnityEngine.GameObject'
and
Error CS1501 No overload for method 'FindObjectsOfType' takes 1 arguments TransMod
if it helps
This
Change GameObject go to HealthManager hm
Or HealthManager nameofitidkwhatyouwant
or just var item
Yeah
foreach (GameObject go in Object.FindObjectsOfType<HealthManager>(whatdoitypehere?)
Beautiful 
so i cant just type in (x => x.gameObject.name.Contains(""))) the name of thk?
(x => x.gameObject.name.Contains("HereTHK??")))
Alright so I'm assuming this occurs because they use a different spritesheet while mining
seems right
Of course, that'll give you the Healthmanager
yeah problem is that it doesn't work 
so you want to then do .Select(hm => hm.gameObject)
even when i dont give an argument, what causes everything to become the image
if i just do ("") then everything becomes the image except thk
sure
yes
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
yeah problem is that i dont know how to do that 
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
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
Aight so
I'm just going to go ahead and ask that you learn to use the code blocks in discord. It will be 100000x easier to share and understand code once you do that. Info on that here: https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-
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());
}```
this??
See these two parts?
yes
Yes, but more like what no one posted above. For multi-line blocks.
what no one posted lol
yes
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
it checks if the scene changed then sees if "GG_Lost_Kin" is there right
and then run the swippity swap on it
Not exactly
hm
When the scene is changed, SceneChanged() gets called
With two arguments passed into it
arg0 is the previous scene
arg1 is the new scene
like (x => x.gameObject.name.Contains(""))
it checks if the new scene is the lost kin scene in godhome
No, no, even simpler
Just GameObject.Find("")
ah
Because you have only one, and you know exactly where it is
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;
}
}
i don't believe THK's gameobject is called THK but i might be wrong
the scene is Room_Final_Boss_Core
what do i place at WhatHere??
can't you just leave it empty, as THK is the only enemy in the room?
So do i call it The Hollow Knight or Hollow Knight
Oh, uh
use debug to find the names of enemies
oh ok
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
THK is called Hollow Knight Boss
I meant you add a coroutine that instead of adding any altering component, it will simply swap the skin
@cedar hemlock
so i..
add the same thing?
i dont understand lol
but sadly i gtg now
ill ask again tommorow
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?
Hm, does InsertMethod on fsms need ModCommon to work?
Any way to go around it?
Reimplement it (InsertMethod), it is implemented as static methods and extensions in modcommon.
class c : FsmStateAction
{
public void OnEnter()
{
test.method();
}
}
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.
btw, i wrote that directly in discord, so idk if that's missing things
override keyword
I didn't know that off the top of my head, I was just looking at modcommon's source, haha
vs or rider will tell you though lol
Heyo I'm back
Hm
This seems kind of I-don't-understand-this right now
I'll just use modcommon I guess
hello im back
Hi back, I'm Godfriend 
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
pretty sure they are both no one and godfriend
show your code after doing this and I'll tell you what to do
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.
Why do you need to reference newtonsoft specifically?
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)
I mean why can’t you just use it from the ModdingApi
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
Have a slightly different version for hk modding?
I don't care whose version of those types I use, but I can't even get the redirected resolve to work.
Well... That dramatically decreases the usefulness of making it general purpose at all. I don't want to do that.
I added a debug print to my static constructor and now it doesn't crash.... Weird. Probably some runtime bs. How exhausting. 😩
{
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;
}
}
even though you wouldn't need a whole ass class for just that and that StartCoroutine(FindHK()) is possible, it looks good
eh i just used what was already there
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
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'
i mean
GameObject.Find("Hollow Knight Boss"); is kinda the gameobject you're looking for
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
where do i place that
i dont understand
just attach this monobehaviour onto a persistent gameobject (like the gamemanagers gameobject) and whatever you want to do with the return value of GameObject.Find("Hollow Knight Boss"); directly beneath it
like this?
var x = GameManager.instance?.gameObject.GetComponent<KinFinder>();
{
var x = GameManager.instance?.gameObject.GetComponent<HKfinder>();
go.GetComponent<tk2dSprite>().GetCurrentSpriteDef().material.mainTexture = _tex;
}``` ?
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
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;
//something here to start skinchange
}
```?
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
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>(); ?
var x = GameObject.Find("Hollow Knight Boss"); ?
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
the name x does not excist in current context
by the way can I see the texture you're going to put on?
Screenshot?
i will show you later now i just have a crystal huinter
How do you plan changing the skin if you dont have a new skin
i first want the code working
if ya really want to know
Just do the x.changeSkinShenanigans right after x = GameObject.Find
oh okay
Oh so you do have a skin
Cool
Anwyays
Wait
Woaj
before or after yield return null
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
i just used the code that was in the example mod
Yeah but that was code for changing a boss's movements and all, too
just yeet the class part?
You can do everything in one tiny class
When I wrote this, I meant this is basically the entire code
You don't need more than that
Nope what 
{
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;
}
}
}
}
nope i cant just yeet the class part
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
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
and just yeet private void Start() { USceneManager.activeSceneChanged += SceneChanged; }
and
{
USceneManager.activeSceneChanged -= SceneChanged;
}```
from the deleted class
{
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;
}
}
}````?
Wait why does that say transtrans 
Have been just using the transtrans as a base this whole time?
Anyways this seems like it should work 
Any problems beyond this point are because I probably forgot things
yeah lol
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?
i don't see anything with Transtrans
Yeah I definitely forgot things 
I'd suggest changing the name of your mod btw-
yeah ill try
i added public ClassName(): base("The Name You Want") { } but it says that the method must have an return type
maybe because ClassName has to be the name of your class
oh lol
such as?

But if it doesn't work I probably did
What things are you using?
And what do you reference
the modlog doesn't even show it
Csharp, Playmaker, and some unity engines
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;
you do have your mod in the mods folder, right?
yeah
It appears in topleft?
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
i did make it embedded
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?
[ERROR]:[UNITY] - NullReferenceException: Object reference not set to an instance of an object
[ERROR]:[UNITY] - TransHK.TransMod+<SetSprite>d__5.MoveNext ()
yes
{
Log("Setting sprites");
var boss = GameObject.Find("Hollow Knight Boss");
boss.GetComponent<tk2dSprite>().GetCurrentSpriteDef().material.mainTexture = _tex;
yield return null;
}```
i mean, it's proably the 3rd line lol
but why does it work for tiktiks but not for thk
oh no
https://docs.unity3d.com/ScriptReference/GameObject.Find.html it only returns active gameobjects
so?
have fun ig lmao
theres no fix?
no fixes, only workarounds
how do i workaround
- get the parent gameobject
- navigate manually to the one you want
yeah i have 0 idea what you mean
another alternative is
- reference sfcore in the project
- add a
Scene sceneparameter toSetSprite()(you give it thearg1scene object) - Change
GameObject.Findtoscene.Find
you mean with 2 SetSprite(Scene arg1)?
yes, though then step 3 would be arg1.Find
{
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
let me take a wild guess
- the arg isn't supplied in
GameManager.instance.StartCoroutine(SetSprite()); - in
arg1.Find("Hollow Knight Boss");, there is noFindmethod
ez
- change the line containing
GameManager.instance.StartCoroutine(SetSprite());toGameManager.instance.StartCoroutine(SetSprite(arg1));
2:
- reference sfcore in the project
- add a
using SFCore.Util;at the top (orusing SFCore.Utils;, idk which one it is)
what does autocomplete give you for namespaces when typing using SFCore. ?
monobehaviours
only that?
yeah
are you sure you're using the sfcore from the modinstaller?
you didn't find it?
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
Another fix:
yield return new WaitWhile(!GameObject.Find(“Hollow Knight Boss”));
var Boss = GameObject.Find(“Hollow Knight Boss”); ```
fuck yield return new WaitWhile, demolishes fps
Ok
Error CS0176 Member 'GameObject.Find(string)' cannot be accessed with an instance reference; qualify it with a type name instead
I just made it a class
the error is refering to retGo = go.Find(name);
Change it to retGo = go.transform.Find(name).gameObject;
Autocorrect is evil
What’s the error
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] -
That doesn’t seem related to your code
Found your error lower down
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] -
???
Did you make a class called This and put the method in there
public static class
maybe
Very interesting name for a class
Anyways I suggest adding some logging to find exactly where the error occurs
In the Find method
?
the Mod class, which TransHK.TransMod inherits from, has the Log method defined, for all new classes that has to be made from scratch
oh
Also it needs to be an instance right?
how do i define it
could be like https://github.com/SFGrenade/SFCore/blob/master/CharmHelper.cs#L406 to make it copyable and fancy, but doesn't copy and paste nicely with static classes
how do i make it working in a static
it has problem with everything with log in the name lol
public static void Log(string s)
{
Modding.Logger.Log(“[Thing]” + s);
}
all kinds of things expected and unexpected
$"[Thing] - {s}" is more fancy though
Good point
that fixed it
The quotes probably copied over weird
hmm
SFGrenades code doesn't give an single log
and the same error ofc
i aint gonna post modlog since the exact same
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;
}
}


