#archived-modding-development
1 messages · Page 490 of 1
had to explain that multiple times to some people
@vocal spire im trying to import an example mod into visual studio
but its not working because there is only a .csproj and no sln
Wdym
IT WORKS
I DID IT
I CREATED CUSTOMKNIGHT +
@stiff otter send me the link to the example mod github?
examplemod1
I can't add a csproj into my solution for some reason
Just download everything
there are 3 example mods
ok but I only want one example mod:|
Just try it
ok
(Haven’t tried) I think if you build a project with multiple solutions, they are still separate
It added some stuff but they both say unloaded
lemme get a screenshot
they dont have any contents
You didn’t open the sln I showed you
Yes you did
You didn’t open the sln I showed you
oh im so sorry
I opened the modding api
one second
it sort of worked but examplemod1 didnt load
Screenshot
project file cannot be found
but its right here
its no big deal Ill just use the other ones
And you opened it from the Example Mods folder you downloaded
yes
And you didn’t remove anything or change the file structure
Ok
you could try 3, i think that is what i used as a template for my mod
My templates go wayyy back. I think I used lightbringer as a template for dreamshield, dreamshield as a template for lm, lm as a template for Uuwuu, Uuwuu as a template for another mod, and now that mod as a template for CustomKnight+ since that mod was where I first tested the code I found for making a new tk2dspritecollectiondata
No wait
I used dreamshield as a template for lolkins and then lolkins as a template for lm
Yay
Change the class name, the file name, the assembly name, and the namespace name
And the default namespace
thanks
And the solution and project names
how would I make the base hp 3
lmk if there is somewhere on the docs I can look so I dont have to bother you
Playerdata
Best place to set it would be creating a new save so you don’t need to calculate what to set it to every time you load a save
so with a hook?
Putting the finishing touches on ck+/ck2
one more thing
Yes?
Idk
ok
yes
how
why did i delete my message where i detailed that
also if you know what is the difference between max base health and max health
max base health is your max health without extra hearts from the hearts charm
I want to make a mod where when you take damage twice you lose a max mask
but not perminantly
Oh
I could do it with save data but that seems hard
Why do you need to remove godseeker masks then?
The only way to do it is with save data
I would want to add a godseeker mask when you take damage twice
Oh
and then remove them all when you hit a bench
i think the godseeker masks isn't the option, as saving the current max masks in the mod and setting save data masks accordingly is the better option
ok
thanks
actually Ill just save how many masks have been lost in game data and then re-add them so that I dont have to deal with charms or anything
would thank break stuff?
Wdym re add them
like if youve lost 2 of your max health
all I need to do when you hit a bench is add exactly 2 to your max health
Well, if you have edited save data and don’t have settings, then you don’t know what the max health should be
Or are you just going to store the number of lost masks in a int or something
yeah
Wait a while
does that mean I fucked up
its just sitting on the main title screen with no menu
Oh
Null reference exception
Did you try to access player data in initialize by chance?
no
something maybe killed the camera
FUCK
Screenshot
screenshot what
The mods folder
oh
thanks
thank you so much it worked
my mod doesnt tho
weird
the docs say NewGameHandler takes an int but c# says it doesnt
did you use the wrong hook?
nope the mod log does my things
my guess is that the game sets the maxhealth after that hook which would be annoying
it does ugh
got it to work yay
@vocal spire sorry to bother again but is there any way to check if the player hits a bench?
like rests on it
Yes there is a hook for it somewhere I tgink
some save game save hook
There’s like a million
BeforeSavegameSaveHook
Anyway, CustomKnight+ is almost done other than adding stuff people can copy for the enums in it
so the save game hook only happens when you do a bench?
No
Any time it is before the game saves
when does the game save
Ex: quitting the game
then how come items are saved if you get one and then quit
OOOOH
yeah that makes sense
Time to finish CustomKnight+!
what is it
Use your own spritesheets to make animations
Think CustomKnight but better
But it only supports animations on the knight rn
I have a idea for more though
I dont know what custom knight is but that sounds cool
I feel sorry for you
how do you resprite content anyway
......
like what if I wanted to make all of greenpath dead for some reason
I am right now
CustomKnight
........................
Yes
like how does customknight work
You put sprite sheets in a certain spot
And it reads them and replaces the originals
Bruh
Used to be modding staff but left to take a break or something
Ok
They made a lot of mods and updated CustomKnight to what it is today
so you made a fork of it?
oh
ok anyway
im having a weird problem
it seems like the area where you land somehow sets your maxhealth back to 5 in certain cases
like It will show as 3 but if I die in kings pass it then respawns me at 3, but then it fills up to 5 again as I walk forward
Well
Its so strange
?
but when I walk forward it fills back up
I’m not getting the problem
You said you reduced the health to 3
max health yes
I forgot you said that
And you set all max health values correctly?
I assume
Im just setting PlayerData.instance.maxHealth
should I set base max health too
Probably
ok
nope
it happens even with other benches
but I haven't tried setting the base health yet
Then it’s probably the base health since the problem is consistent
im in game
Oh
debug menu works and shows im moving around
And Vasi?
And modcommon?
I think?
and yeah modcommon
Ok my understanding of how max health works is getting worse and worse
so its not reducing the max health when you take damage
Yeah
but for some reason it resetting to 2 when I respawn
Wait
so somewhere it got set to 2
I
but only actually updates when I respawn
Think there is a method in HeroController
The numbers are correct
The ui isn’t updating
Think there is a method in HeroController
@vocal spire
really?
HeroController.instance.AddHealth(-1);
ok
I thought you meant to update ui
but using a method to take stuff makes more sense?
except whats the method for taking max hp
I see your point
:(
open dnspy
what is it?
yes?
how do I use monobehaviour stuff
wdym
using UnityEngine;
what c# ide are you on
vs community
oh yeah I can just do that
go to the managed folder of hk
np lol
hmm
maybe my mod just isnt possible
wdym
call the update yourself
the ui update?
yeah
wonder how to do that
fsm
yeah
did team cherry really use it for ui?
rip
huh
I don't blame them for using it though, it costs a good amount
Ive never really gotten why you would wanna use something like that
because it makes making ai easier
personally I just feel like I would want to make a system myself
less I have to look up
But who knows
alright I got the veiwer
you guys know that addhealth is for healing, and takehealth is for taking damage?
is there takemaxhp?
public void AddToMaxHealth(int amount)
which one
10
there are 11
yeah
probably removed
so which is real
maybe they were from a unused area
one for each mask that one can get in the base game
all of them
still
you know you can broadcast a message to all of them at once(I think)
so what am I even doing when I change stuff
wdym
So do I need to change anything inside the fsm viewer
you can't
if you were able to modify the asset files, then it wouldn't be a good mod
k
me brains are hurtin
I think I get what this is
so if I just set the state to checkmaxhp I can update all of them
but that sounds real unstable
OR
I could add a state that checks the max hp after it gets damaged
before pause frame
would that work?
of each health?
yes
the eaiser method of those is setting the state, but i would set the state to reinit
or whatever it was called
would that break anything that was currently happening?
might
it seems like it could cause alot of glitches
the more stable method seems to be to just change the fsm
wouldn't be the first mod to break stuff lol
but what would be happening to them
I bet I can manage it
haha yeah but Id like it to be playable
at least sort of stable
i don't like FSMs, which is why i made classes/function that others can use so they don't interact with FSMs
https://github.com/SFGrenade/SFCore/blob/master/SFCore/CharmHelper.cs
no, you don't want to do stuff like this yourself
everything
btw @vocal spire how far are the additional inventory spaces?
not far
pog
I had an idea for another type of item tho
and that has been taking up my time
I got it working once
but once I added multiple, it didn't work
I even reverted my code, and it still wouldn't work
another type of item
as in "another item" or an actual new type of item?
wow
then my previous messages happened
(for the player to buy or to sell?)
I didnt know you could even make new content
ah ok, so like those ancient eggs
wow really?
yeah
yes
anyone is actually making a mod about that
there is also pale court
pale court is really big
ever realize that a tool has too much utility that you don't have time for it
not only new rooms, but also abominations of rooms that expand dynamically the further you go
I could add so much
oh yeah forgot that one
Which is stressful
that room is fun
Goddammit
gonna use that room when I contemplate my life when code won't work
https://www.youtube.com/watch?v=CL5nNLNtXzo for reference
Things are going along nicely
A scene, which dynamically enlarges the further you go.
now Im gonna spend 2 years making a complete hollowknight mix up and never finish it
wait
k I'm gonna continue testing why a 100 pixel image isn't showing up as big as I hoped in customknight+
Can I make bosses appear in different places
YOOO
one of the easiest things to do
but wouldnt it mess up the animations?
@vocal spire yep, there is something going on with the images in game vs otherwise imported
making some of them work correctly tho
animations are fine
it's the fsms that have pre determined positions for stuff
that mess stuff up
so what if I wanted to have soul warrior where false knight is
that would be hard right?
what about the death animation?
no problem
I think you mean soul master
I mean soul warrior
Like it would be cool to have two soul warriors instead of false knight
false knight breaks the ground
yeah
yeah that would be kind of hard
so maybe not for false knight
can still be done
goddammit
this rabbit hole is deeper than I thought
I wanted this to just be a fun side thing
yep, with soul warrior you only need to edit the fsm variables where he can teleport (min and max X value)
imagine putting soul master in though
maybe
basically I want to make a hollow knight export mode
yes
i know
well
It would be if I didn't change much
but now that I can
im tempted to
I was just thinking that the new health mechanics would do most of the heavylifting
and I then make the main bosses as fast as their harder versions
but yeah its likely never going to be finished as It will be a much bigger project than I expect it to
lol
but thats ok because I have other projects I will finish, this is just for fun
while we are on the topic of big mods that will never be finished
I had an idea for a holloween mod collaboration between most of the modders to make a sort of candy hunt where you must find more and more of them to get prizes from elderbug or someone
maybe a rogue member of the grimm troupe since nightmares and halloween go well together
sounds big
maybe more stuff like enemies protecting them
again, why I suggested a large collaboration
but im sure you can finish it in 17 days right?
i wonder if somebody could mod hollow knight into silksong before silksong releases
ok back to modding
where do I modify fsm
wdym in instance?
initalize
not at all
it seems like you need to use a monobehaviour?
no
you need the ActiveSceneChanged Hook on UnityEngine.SceneManagement.SceneManager
I think
ugh
can be on a monobehaviour
why
im trying it
why do you need vasi and why do you need sfcore?
reference it in the project, then you can do stuff like
SFCore.whateverthefuckinamedtheclasses.function
I was gonna look at vasi for reference but
@jolly oriole I did and i cant find anything useful
are you adding a item charm or achievement or player footprint?
you said it has functions for fsm?
i said that i did stuff with fsm, but functions for fsm has ModCommon
which i used
alot
so its in modcommon
what does vasi do
does vasi have fsm stuff?
yes
got angry when it conflicted when i had to use both it and modcommon
pretty much identical though from what I have seen
now to find out why my globalsettings didn't load
ok so where do I use vasi
like when do I set the actions and all that
thats all I need to know
just trying stuff
ok
It seems the most promising at the moment
I found the methods
I just need to know when to use them
but modcommon has pretty much the same methods
in dnspy?
w h e n
well
you find the object the fsm is on
you use the LocateMyFSM(fsm name) method on it
when the object is active
Ok
you can only modify it when it isn't null
hmm
because if it's null, well, it's null
so I need to find out how to access the health stuff
you need the ActiveSceneChanged Hook on UnityEngine.SceneManagement.SceneManager
@vocal spire
should work when paired with an IEnumerator with a WaitWhile(()=>!GameObject.Find(object name))
wdym
that hook doesnt exist on SceneManager
hold on
others have used it
you can also use On.HeroController.Start
I need to specify scenemanagement.scenemanager because there seems to be another class with the same name
who would do that
since the fsms likely persist through scene transitions
?
idk, did you reference it twice?
which one is it?
I was right
its the wrong one
but for some reason i have to do UnityEngine.SceneManagement.SceneManager and not just SceneManagement.SceneManager
I mean, that's what we do
weird
idk where you got SceneManagement alone from but it doesn't exist for me
yeah I guess c# is just weird like that
you have to do the whole thing
how do I get the name of the fsm
is it the exact same as the on in the fsm viewer
yes
except for some reason after you open the fsm, it seems to remove _ from the name
health_display
ok
you search for it at some point after a save has started
but how am I supposed to figure out what to search for
is there a scene view or something :|
I suggest On.HeroController.Start since you probably only need to modify them once since they probably persist through rooms
we have the scene hiearchies
but
in fsm viewer
the part before the - is the go name
should be
cool
what variables does heroController.start take
or whatever they are called
parameters
nvmd I can just see the file
ok...... what did you do?
also to auto fill out hooks in vs, do the += then press tab, then press enter
So I'm having a problem in globalsettings where in a list, a default version of the type will be added to the beginning of the list. Anyone know how to solve? I could just remove the first thing in the list but I don't wan't to mess up something when/if it gets fixed
ok, removing seems to have fixed it, but still removed the non added stuff
so what i'm trying to do is make the player take damage every time they kill an enemy, but in return increase soul gain
the soul gain works, but the take damage part doesn't
and i'm pretty sure i'm hooking into the kill thing correctly
i thought maybe it was because i didn't have journal, so i gave myself that but it still doesn't work
line 17
Do it in HeroController
oh
Will update the ui properly
how do i do that?
Use HeroController.instance.TakeDamage
oh ok
oh and in the onSoulGain, dont do return 33;, that would give the player 33 soul everytime they get soul, so a soul totem would give like 300 soul or something
lol
oh lol
Was gonna mention that but didn’t know if it was intentional
i just wanted it to be from enemies
Just add soul when you call the taking damage
i mean, from like one hit though
oh right
do i need to create an object of type UnityEngine.GameObject in order to use TakeDamage
Wdym
TakeDamage requires four parameters
Ohhhh
one of them is gameobject
Hold on
oh wait can i do HeroController.instance.gameobject
No
oh
Look in dnspy for the code in takedamage
uhh
Or ilspy
Ilspy can be used on Mac I think
oh ok
what is currently wanted?
To take health from the hero when killing enemies
when killing enemies
On.HealthManager.Die?
there's the journal event in modhooks as well
Isn’t that what they are using?
yeah
i'm currently using the RecordKillForJournalHook for that
there's just no need for a healthmanager hook imo
But they need a GameObject
apparently
just get the death effects parent
That makes sense
shouldn't it be possible to just make a tiny filter list for "enemies" that don't count towards the health taken/soul gain gained?
yeah you can just filter on the name hash
wouldn't that just kill the player if they have 5 max health
yes
That’s the point
Ilspy
Idk either
is there something that i can use to update the ui?
HeroController TakeHealth should update the UI, at least i saw that here one or the other time
for the soul gain?
yeah
you have got to be kidding me
ilspy is vsix and vsix files only work on windows?
Linux?
mac
AvaloniaILSpy
ty
Should probably have that pinned
https://github.com/icsharpcode/AvaloniaILSpy/releases cross-platform ilspy
one sec, wrong copy paste
you could hook into
On.HealthManager.TakeDamage
then do in the hook
orig(self, hitInstance);
int additionalCharge = 0;
#region literally stolen from HeroController.SoulGain(), but only this part, other part of it has hardcoded soulgain stuff
int tmpInt = PlayerData.instance.GetInt("MPReserve");
PlayerData.instance.AddMPCharge(additionalCharge);
GameCameras.instance.soulOrbFSM.SendEvent("MP GAIN");
if (PlayerData.instance.GetInt("MPReserve") != tmpInt)
{
GameManager.instance.soulVessel_fsm.SendEvent("MP RESERVE UP");
}
#endregion
why wouldn't you just call mpgainspa w/ the soul amount tho
maybe FSM differences, checking it rn
cool, ilspy works now
it wasn't working because for some reason the actual executable was a textedit document
@jolly oriole why couldn't i just only do PlayerData.instance.AddMPCharge(additionalCharge);?
ok, there are differences, the "MP GAIN" event does checks for orb flash and the focus prompt, the "MP GAIN SPA" goes directly to just filling up the orb, not checking the "Orb Flash?" and "Check Focus Prompt" FSM states
@languid goblet the ui wouldn't update
oh ok
oh so basically if the amount of soul changes, then you tell the fsm to update
so ig take
orig(self, hitInstance);
int additionalCharge = 0;
HeroController.instance.AddMPChargeSpa(additionalCharge);
you can also ILHook SoulGain
is additionalCharge the amount of soul i want to add
That just gives soul on enemy hit so you can modify the value completely
yes
the extra soul
i think
alright
well, that's an issue
maybe i could just kill the player if their health is 1
and then they kill an enemy
i thought takehealth would takecare of it
apparently not
any TakeDamage
TakeDamage has a bunch of parameters that i don't know how to find
yea, TakeDamage does it, although it requires way more things
you can just make up shit ngl
just create a go or pass in the knight
Set the collision side to unknown
and just make everything false
i guess i'll try it
and just make everything false
the GameObject, Enum, int or int?
lol
what's unknown
CollisionSide.other i think
ok
but everything except left and right works
what's the hazardtypes
i think there was an enum for it
it's asking for an int
Well
i guess i could try and find it with ilspy
use 0, or HazardType.NON_HAZARD
oh ok
i would actually check but my power is out
Oof
that definetly isn't quite poggers
Reverse 
Nice!
amazing
so for example does blackmoth just hook into the dash pressed and then always return true or smth
dash vector hook
for length and such
and then it just sets the cooldown very low
ah ok
and yes, it also hooks into ModHooks.Instance.DashPressedHook
that's for like elegy only though yeah?
idk, the hook is 110 lines
🥴
but seems to be a complete rewrite on how dashes work (or ripped from other functions)
https://github.com/seanpr96/Blackmoth/blob/master/Blackmoth/BlackmothMod.cs#L356 if you want to take a look
it's description: "Port of Gradow's blackmoth mod to the modding api "
ok, looking at gradows api version now
that is not as long, just setting up some variables and returning true
ok nvm, most of it was moved into another function
yeah Serena's repo is from a while back when they first created and moved to the api
yeah, the hook in the newer version has around 160 lines of mod code
any idea why this isn't working
i looked at modlog and i think there's some sort of error every time i try to hook into the attack animation
what does it say
your project is built against .net 4
you need to target 3.5
It's under project settings
oh
there's no option for 3.5
and it's targeting 3.1 currently
do i need a different version of visual studio or smth
you just need the targeting pack probably
oh yeah also my project structure is different
from the other mods and videos i saw
oh
Are you talking about .net core 3.1?
i made a new project and copied my code over
because i think i was using the wrong template?
now .net core 3.5 is an option but when i try to build it gives me errors about version conflict
and also the thing is, the other test mod i made worked but this one isn’t for some reason
Class library but .net framework not .net core
wait no it is .net framework
Yes that is fine
these are the errors
or warnings i guess
...ok you've got to be kidding me, it works now
i literally didn't change anything
how do i turn on the debug log? figured it out myself nvm i still don't know how to get the debug log
sorry if i'm asking too many questions
cool programmer
HooKnows
that guy who stuffs the code full of if statements
how did you add the new journal entry?
hold on
private void JournalList_BuildEnemyList(On.JournalList.orig_BuildEnemyList orig, JournalList self)
{
var go = GameObject.Instantiate(self.list[4]);
go.PrintSceneHierarchyTree();
var listitem = go.GetComponent<JournalEntryStats>();
listitem.convoName = "MyJournal";
listitem.sprite = sprite2;
go.transform.Find("Portrait").GetComponent<SpriteRenderer>().sprite = sprite;
//go.transform.Find("Portrait").Find("Journal Frame(Clone)").GetComponent<SpriteRenderer>().sprite = sprite;
go.transform.Find("Name").GetComponent<SetTextMeshProGameText>().convName = "MyJournal";
self.list = self.list.Append(go).ToArray();
orig(self);
}
On.JournalList.BuildEnemyList += JournalList_BuildEnemyList;
oh, that's what build enemy list does
cool
I chose 4 randomly and it's actually gruzz mother
oh yeah
i was messing around
and i managed to make it so that every single nail slash has mop + longnail work with it
so
small pog i guess

what references do you need
hold on
I think all you need other than the usual stuff is Vasi
Sorry, was finishing something and the pc died
hmm
using System.Linq;
np
ok, small question: for my shellwood nail mod, how could i use the slashhithook to run different code depending on whether i hit an enemy or another object
check what layer it is on and if it has a healthmanager component
just a healthmanager should probably do though
so like if gameobject.healthmanage != null or smth
yeah
ok
but with getcomponent
oh ok
gameobject.GetComponent<HealthManager>()
thanks
np
Breaking news!: Person has idea when thinking of stuff to add so something. Then they think of a whole new modded boss
I think I have finished setting every value in it
10/10 would do again
k gn now im sleeping
final code is
K now I really want to make a helper for it for some reason even though it is the simplest thing in the world to do
Just something to automatically manage the hooks
Helper code worked first try
Only a couple more features to add to it that deal with custom stuff in fsms
did it work first time with one mod using it or several?
Haven’t tried multiple yet, but they should work

