#archived-modding-development

1 messages · Page 490 of 1

stiff otter
#

thanks

vocal spire
#

had to explain that multiple times to some people

stiff otter
#

@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

vocal spire
#

Wdym

#

IT WORKS

#

I DID IT

#

I CREATED CUSTOMKNIGHT +

#

@stiff otter send me the link to the example mod github?

stiff otter
#

examplemod1

#

I can't add a csproj into my solution for some reason

vocal spire
#

Found a sln

stiff otter
#

all i want to do is build to a dll and test if it works unmodified

#

huh

vocal spire
#

Just download everything

stiff otter
#

there are 3 example mods

vocal spire
#

The entire example mods folder

#

Then you get your sln

stiff otter
#

ok but I only want one example mod:|

vocal spire
#

Just try it

stiff otter
#

ok

vocal spire
#

(Haven’t tried) I think if you build a project with multiple solutions, they are still separate

stiff otter
#

uh

#

It didnt work

vocal spire
#

What did you do?

#

Open the sln file?

stiff otter
#

It added some stuff but they both say unloaded

#

lemme get a screenshot

#

they dont have any contents

vocal spire
#

Ok.........

#

There is a lot wrong here

#

You didn’t open the sln I showed you

stiff otter
#

what do you mean

#

hold on did I fuck up

vocal spire
#

You didn’t open the sln I showed you

#

Yes you did

#

You didn’t open the sln I showed you

stiff otter
#

oh im so sorry

#

I opened the modding api

#

one second

#

it sort of worked but examplemod1 didnt load

vocal spire
#

Screenshot

stiff otter
#

project file cannot be found

#

but its right here

#

its no big deal Ill just use the other ones

vocal spire
#

And you opened it from the Example Mods folder you downloaded

stiff otter
#

yes

vocal spire
#

And you didn’t remove anything or change the file structure

stiff otter
#

nope

#

its fine

#

ill use examplemod2

vocal spire
#

Ok

jolly oriole
#

you could try 3, i think that is what i used as a template for my mod

vocal spire
#

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

stiff otter
#

trying 2 rn

#

YAY

#

it works

#

now to edit stuff

vocal spire
#

Yay

stiff otter
#

cool it even shows in the modinstaller

#

how do I change the name

#

is that hard

vocal spire
#

Change the class name, the file name, the assembly name, and the namespace name

#

And the default namespace

stiff otter
#

thanks

vocal spire
#

And the solution and project names

stiff otter
#

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

vocal spire
#

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

stiff otter
#

so with a hook?

vocal spire
#

Yes

#

Forgot which one

#

Lightbringer would be a good place to look

stiff otter
#

found it

#

thanks

vocal spire
#

Putting the finishing touches on ck+/ck2

stiff otter
#

one more thing

vocal spire
#

Yes?

stiff otter
#

is there a way to set how many godseeker hearts a player has?

#

like locked masks

vocal spire
#

Idk

stiff otter
#

ok

jolly oriole
#

yes

stiff otter
#

how

jolly oriole
#

why did i delete my message where i detailed that

vocal spire
#

Idk

#

Why did you delete your messages

#

lol

stiff otter
#

also if you know what is the difference between max base health and max health

vocal spire
#

Max base health is the max health you can have without lifeblood I think

#

Idk

jolly oriole
#

max base health is your max health without extra hearts from the hearts charm

stiff otter
#

ok

#

so how do you add locked hearts

#

godseeker hearts

vocal spire
#

Why would you need to do that?

#

Oh

#

I think I see what you are saying

stiff otter
#

I want to make a mod where when you take damage twice you lose a max mask

#

but not perminantly

vocal spire
#

Oh

stiff otter
#

I could do it with save data but that seems hard

vocal spire
#

Why do you need to remove godseeker masks then?

#

The only way to do it is with save data

stiff otter
#

I would want to add a godseeker mask when you take damage twice

vocal spire
#

Oh

stiff otter
#

and then remove them all when you hit a bench

jolly oriole
#

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

stiff otter
#

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?

vocal spire
#

Wdym re add them

stiff otter
#

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

vocal spire
#

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

stiff otter
#

yeah

vocal spire
#

Ok

#

Then you should be good

#

Unless

#

The player uses alt f4

stiff otter
#

oh hold on

#

it saves your max masks so yeah

#

ill just use savedata

vocal spire
#

more confusion

#

Mod settings?

stiff otter
#

yeah

#

sorry

vocal spire
#

Ok

#

Good

stiff otter
#

also hollow knight is now not loading

#

what

vocal spire
#

Wait a while

stiff otter
#

does that mean I fucked up

vocal spire
#

Probably not

#

If you did, you can check the modlog

stiff otter
#

its just sitting on the main title screen with no menu

vocal spire
#

Oh

#

Null reference exception

#

Did you try to access player data in initialize by chance?

stiff otter
#

no

jolly oriole
#

something maybe killed the camera

stiff otter
#

I made a modhook

#

imma try disabling and running

#

same thing

#

mod isnt running

vocal spire
#

?

#

Then it’s another mod

stiff otter
#

huh

#

one sec

#

I think I fucked up my mod folder

#

is there a way to reset it

vocal spire
#

What

#

Screenshot

#

Also no

stiff otter
#

FUCK

vocal spire
#

Screenshot

stiff otter
#

screenshot what

vocal spire
#

The mods folder

stiff otter
#

ok

vocal spire
#

So?

#

You are missing Vasi

#

That’s the problem

stiff otter
#

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

vocal spire
#

did you use the wrong hook?

stiff otter
#

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

stiff otter
#

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

vocal spire
#

Yes there is a hook for it somewhere I tgink

jolly oriole
#

some save game save hook

vocal spire
#

There’s like a million

jolly oriole
#

BeforeSavegameSaveHook

vocal spire
#

Anyway, CustomKnight+ is almost done other than adding stuff people can copy for the enums in it

stiff otter
#

so the save game hook only happens when you do a bench?

vocal spire
#

No

stiff otter
#

it happens other times right like when you enter the city

#

so hmm

vocal spire
#

Any time it is before the game saves

stiff otter
#

when does the game save

vocal spire
#

Ex: quitting the game

stiff otter
#

it does it all the time rihgt

#

like when you grab any item

vocal spire
#

Just exiting and benching

#

I don’t think so

stiff otter
#

then how come items are saved if you get one and then quit

#

OOOOH

#

yeah that makes sense

vocal spire
#

Time to finish CustomKnight+!

stiff otter
#

what is it

vocal spire
#

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

stiff otter
#

I dont know what custom knight is but that sounds cool

vocal spire
#

I feel sorry for you

stiff otter
#

how do you resprite content anyway

vocal spire
#

......

stiff otter
#

like what if I wanted to make all of greenpath dead for some reason

vocal spire
#

Ok that’s different

#

Have you seen skins

stiff otter
#

ive seen player skins

#

like the hollow knight skin

#

and the radiance skin

vocal spire
#

Yeah

#

Have you ever wondered how people made those?

stiff otter
#

I am right now

vocal spire
#

CustomKnight

stiff otter
#

ok

#

is it a mod?

#

is it a program?

vocal spire
#

........................

stiff otter
#

bruh

#

im new to this ok

vocal spire
#

Mod

#

It’s the most common mod I have seen people ask for

stiff otter
#

ok

#

so can you resprite other stuff

vocal spire
#

Yes

stiff otter
#

like how does customknight work

vocal spire
#

You put sprite sheets in a certain spot

#

And it reads them and replaces the originals

stiff otter
#

oh

#

so you have to mess with files in your code

#

sounds like a pain

vocal spire
#

Look at how jngo did it

#

I actually did it in 2 lines

stiff otter
#

jngo

#

is that a mod

vocal spire
#

Bruh

stiff otter
#

dont laugh

#

im new to modding

#

I only got into it because I wanted to make my own

vocal spire
#

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

stiff otter
#

so you made a fork of it?

vocal spire
#

No.....

#

Completely different mod with completely different code

stiff otter
#

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

vocal spire
#

The area where you start the game?

#

Like, when you land there it resets the health?

stiff otter
#

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

vocal spire
#

Well

stiff otter
#

Its so strange

vocal spire
#

The game saves

#

When you die

stiff otter
#

I have it so it saves the right health amount

#

and it actually works

vocal spire
#

?

stiff otter
#

but when I walk forward it fills back up

vocal spire
#

I’m not getting the problem

stiff otter
#

like I respawn at 3 mhp and then it fills up to 5 for no reason

#

ill get a video

vocal spire
#

Oh

#

I remember now

stiff otter
#

what

#

is there a trigger there that does that

vocal spire
#

You said you reduced the health to 3

stiff otter
#

max health yes

vocal spire
#

I forgot you said that

stiff otter
#

yeah sorry

#

but you dont know what the thing causing that is

vocal spire
#

And you set all max health values correctly?

stiff otter
#

I assume

#

Im just setting PlayerData.instance.maxHealth

#

should I set base max health too

vocal spire
#

Probably

stiff otter
#

ok

#

nope

#

it happens even with other benches

#

but I haven't tried setting the base health yet

vocal spire
#

Then it’s probably the base health since the problem is consistent

stiff otter
#

ok

#

uhhhh

#

my screen is black now for no reason

vocal spire
#

Starting up hk?

#

That’s normal

stiff otter
#

im in game

vocal spire
#

Oh

stiff otter
#

debug menu works and shows im moving around

vocal spire
#

Hmm

#

Did you accidentally modify anything else?

stiff otter
#

I added debug mod

#

ill see if that was the issue

#

yes it was

#

for some reason

vocal spire
#

Strange

#

We’re any other mods enabled other than yours and debug?

stiff otter
#

yeah

#

hpbar and qol

vocal spire
#

And Vasi?

stiff otter
#

oh yeah

#

wait

vocal spire
#

And modcommon?

stiff otter
#

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

vocal spire
#

Yeah

stiff otter
#

but for some reason it resetting to 2 when I respawn

vocal spire
#

Wait

stiff otter
#

so somewhere it got set to 2

vocal spire
#

I

stiff otter
#

but only actually updates when I respawn

vocal spire
#

Think there is a method in HeroController

#

The numbers are correct

#

The ui isn’t updating

stiff otter
#

ok

#

is there a way to do that

vocal spire
#

Think there is a method in HeroController
@vocal spire

stiff otter
#

ill look

#

theres nothing in HeroController or UiManager

#

at least that I can find

vocal spire
#

really?
HeroController.instance.AddHealth(-1);

stiff otter
#

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

vocal spire
#

I said it was a method on herocontroller

#

why would they need one?

#

hmm

stiff otter
#

idk

#

I do

vocal spire
#

I see your point

stiff otter
#

:(

vocal spire
#

open dnspy

stiff otter
#

what

#

HA

#

there is one!

vocal spire
#

what is it?

stiff otter
#

AddToMaxHealth() :|

#

should have checked first

vocal spire
#

lol

#

I just saw it as you sent that message

stiff otter
#

well

#

I really hope team cherry made it so negatives work

#

one more thing

vocal spire
#

yes?

stiff otter
#

how do I use monobehaviour stuff

vocal spire
#

wdym

stiff otter
#

It says I need to add a using

#

but I cant add the using they want

vocal spire
#

using UnityEngine;

stiff otter
#

hmm

#

doesnt work

vocal spire
#

do you have a reference to UnityEngine.dll

#

and UnityEngine.CoreModule.dll

stiff otter
#

how do I do that

#

Im very c# references illerate

vocal spire
#

what c# ide are you on

stiff otter
#

vs community

vocal spire
#

right click references

#

click add

#

click browse

stiff otter
#

oh yeah I can just do that

vocal spire
#

go to the managed folder of hk

stiff otter
#

Ive been using code so long

#

thanks

vocal spire
#

np lol

stiff otter
#

ugh

#

same thing

#

it doesnt update when you get hit

#

but does when you respawn

vocal spire
#

hmm

stiff otter
#

maybe my mod just isnt possible

vocal spire
#

it is

#

let's try updating it manually

stiff otter
#

wdym

vocal spire
#

call the update yourself

stiff otter
#

the ui update?

vocal spire
#

yeah

stiff otter
#

wonder how to do that

vocal spire
#

fsm

stiff otter
#

ive read about fsm

#

its playmaker right?

#

something to do with that?

vocal spire
#

yeah

stiff otter
#

did team cherry really use it for ui?

vocal spire
#

probably

#

they used it for a lot

stiff otter
#

rip

vocal spire
#

they used to use it for enemy health

#

luckily they changed to monobehaviour

stiff otter
#

huh

vocal spire
#

I don't blame them for using it though, it costs a good amount

stiff otter
#

Ive never really gotten why you would wanna use something like that

vocal spire
#

because it makes making ai easier

stiff otter
#

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

jolly oriole
#

you guys know that addhealth is for healing, and takehealth is for taking damage?

stiff otter
#

is there takemaxhp?

jolly oriole
#

public void AddToMaxHealth(int amount)

vocal spire
#

yeah

#

it didn't update the ui

stiff otter
#

doesnt work

#

I opened the healthdisplay in fsm

vocal spire
#

which one

stiff otter
#

10

vocal spire
#

lol

#

ok

stiff otter
#

why are there 10

#

what the fuck tc

jolly oriole
#

there are 11

vocal spire
#

yeah

stiff otter
#

yeah

#

wtf

vocal spire
#

probably removed

stiff otter
#

so which is real

vocal spire
#

maybe they were from a unused area

jolly oriole
#

one for each mask that one can get in the base game

vocal spire
#

all of them

stiff otter
#

no fucking way

#

this hurts

#

I thought they were good at programming

jolly oriole
#

it's all the same fsm

#

just different variables

stiff otter
#

still

vocal spire
#

you know you can broadcast a message to all of them at once(I think)

stiff otter
#

so what am I even doing when I change stuff

vocal spire
#

wdym

stiff otter
#

like what do i need to do to update them through code

#

why am I here

vocal spire
#

send a event to the fsm

#

well

#

you can leave if you want

stiff otter
#

So do I need to change anything inside the fsm viewer

vocal spire
#

you can't

stiff otter
#

ok

#

I see

vocal spire
#

if you were able to modify the asset files, then it wouldn't be a good mod

stiff otter
#

oh I found the docs part for this

#

lemme see if I can do it on my own

vocal spire
#

k

stiff otter
#

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?

jolly oriole
#

of each health?

stiff otter
#

yes

jolly oriole
#

the eaiser method of those is setting the state, but i would set the state to reinit

#

or whatever it was called

stiff otter
#

would that break anything that was currently happening?

vocal spire
#

might

stiff otter
#

it seems like it could cause alot of glitches

#

the more stable method seems to be to just change the fsm

jolly oriole
#

wouldn't be the first mod to break stuff lol

vocal spire
#

but what would be happening to them

stiff otter
#

I bet I can manage it

#

haha yeah but Id like it to be playable

#

at least sort of stable

jolly oriole
#

i don't like FSMs, which is why i made classes/function that others can use so they don't interact with FSMs

stiff otter
#

like a mod core?

#

honestly I would rather do it myself

jolly oriole
stiff otter
#

mm

#

it looks fine

#

what could possibly go wrong

vocal spire
#

everything

stiff otter
#

and nothing more

#

seems like a good deal

jolly oriole
#

btw @vocal spire how far are the additional inventory spaces?

vocal spire
#

not far

jolly oriole
#

pog

vocal spire
#

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

jolly oriole
#

another type of item
as in "another item" or an actual new type of item?

vocal spire
#

a new type of added item

#

sellable items/relics

#

I was able to add one to the shop

stiff otter
#

wow

vocal spire
#

then my previous messages happened

jolly oriole
#

(for the player to buy or to sell?)

vocal spire
#

sell

#

I call it shop because that's what it's called in the code

stiff otter
#

I didnt know you could even make new content

vocal spire
#

you can add new rooms

#

you can do basically anything now

jolly oriole
#

ah ok, so like those ancient eggs

stiff otter
#

wow really?

vocal spire
#

yeah

stiff otter
#

add new rooms?

#

damn

vocal spire
#

yes

#

anyone is actually making a mod about that

#

there is also pale court

#

pale court is really big

stiff otter
#

ever realize that a tool has too much utility that you don't have time for it

jolly oriole
#

not only new rooms, but also abominations of rooms that expand dynamically the further you go

stiff otter
#

I could add so much

vocal spire
#

oh yeah forgot that one

stiff otter
#

Which is stressful

vocal spire
#

that room is fun

stiff otter
#

Goddammit

vocal spire
#

gonna use that room when I contemplate my life when code won't work

jolly oriole
stiff otter
#

now Im gonna spend 2 years making a complete hollowknight mix up and never finish it

#

wait

vocal spire
#

k I'm gonna continue testing why a 100 pixel image isn't showing up as big as I hoped in customknight+

stiff otter
#

Can I make bosses appear in different places

vocal spire
#

yes

#

ez

stiff otter
#

YOOO

vocal spire
#

one of the easiest things to do

stiff otter
#

but wouldnt it mess up the animations?

jolly oriole
#

@vocal spire yep, there is something going on with the images in game vs otherwise imported

vocal spire
#

making some of them work correctly tho

stiff otter
#

Ive seen randomizers do it and have everything kinda

#

be broken

vocal spire
#

animations are fine

#

it's the fsms that have pre determined positions for stuff

#

that mess stuff up

stiff otter
#

so what if I wanted to have soul warrior where false knight is

#

that would be hard right?

vocal spire
#

not hard

#

just edit where he can teleport to

stiff otter
#

what about the death animation?

vocal spire
#

no problem

stiff otter
#

how he breaks the ground?

#

Dude

vocal spire
#

I think you mean soul master

stiff otter
#

I mean soul warrior

vocal spire
#

but

#

he doesn't break the ground

stiff otter
#

Like it would be cool to have two soul warriors instead of false knight

#

false knight breaks the ground

vocal spire
#

ok

#

OHHHHH

stiff otter
#

yeah

vocal spire
#

yeah that would be kind of hard

stiff otter
#

so maybe not for false knight

vocal spire
#

can still be done

stiff otter
#

goddammit

#

this rabbit hole is deeper than I thought

#

I wanted this to just be a fun side thing

jolly oriole
#

yep, with soul warrior you only need to edit the fsm variables where he can teleport (min and max X value)

vocal spire
#

imagine putting soul master in though

stiff otter
#

That would be interesting

#

but you cant beat him without dash

vocal spire
#

k

#

make him slow then

stiff otter
#

maybe

vocal spire
#

lol

#

but

stiff otter
#

basically I want to make a hollow knight export mode

vocal spire
#

where is the city crest

#

k

#

that's not a small project

stiff otter
#

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

vocal spire
#

ok

#

then pair the double versions with mini bosses

#

lol

stiff otter
#

but yeah its likely never going to be finished as It will be a much bigger project than I expect it to

vocal spire
#

lol

stiff otter
#

but thats ok because I have other projects I will finish, this is just for fun

vocal spire
#

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

stiff otter
#

sounds big

vocal spire
#

maybe more stuff like enemies protecting them

#

again, why I suggested a large collaboration

stiff otter
#

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

vocal spire
#

code

#

reference modcommon or vasi

stiff otter
#

yes but

#

in instance?

#

ok

vocal spire
#

wdym in instance?

stiff otter
#

initalize

vocal spire
#

not at all

stiff otter
#

oh

#

ill look in modcommon

vocal spire
#

k

#

using Modcommon.Util;

#

then you have access to all the fsm stuff

stiff otter
#

it seems like you need to use a monobehaviour?

vocal spire
#

no

#

you need the ActiveSceneChanged Hook on UnityEngine.SceneManagement.SceneManager

#

I think

stiff otter
#

ugh

vocal spire
#

can be on a monobehaviour

stiff otter
#

ok

#

how do I find the vasi source

#

@jolly oriole how do I use sfcore

vocal spire
#

why

stiff otter
#

im trying it

vocal spire
#

why do you need vasi and why do you need sfcore?

jolly oriole
#

reference it in the project, then you can do stuff like

SFCore.whateverthefuckinamedtheclasses.function
stiff otter
#

I was gonna look at vasi for reference but

#

@jolly oriole I did and i cant find anything useful

vocal spire
#

are you adding a item charm or achievement or player footprint?

stiff otter
#

you said it has functions for fsm?

vocal spire
#

wait

#

did you say their own helper mod wasn't useful?

#

lol

jolly oriole
#

i said that i did stuff with fsm, but functions for fsm has ModCommon

#

which i used

#

alot

stiff otter
#

so its in modcommon

vocal spire
#

or vasi

#

but from my use vasi is a bit more complicated

stiff otter
#

what does vasi do

jolly oriole
#

does vasi have fsm stuff?

vocal spire
#

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

stiff otter
#

ok so where do I use vasi

#

like when do I set the actions and all that

#

thats all I need to know

vocal spire
#

you can use both vasi and modcommon

#

why the sudden switch?

stiff otter
#

just trying stuff

vocal spire
#

ok

stiff otter
#

It seems the most promising at the moment

#

I found the methods

#

I just need to know when to use them

vocal spire
#

but modcommon has pretty much the same methods

stiff otter
#

couldnt find them

#

the point still stands

vocal spire
#

in dnspy?

stiff otter
#

w h e n

vocal spire
#

well

#

you find the object the fsm is on

#

you use the LocateMyFSM(fsm name) method on it

stiff otter
#

stop

#

thats how

#

i need when

vocal spire
#

?

#

well

stiff otter
#

like when do I modify the values in the first place

#

at init?

vocal spire
#

when the object is active

stiff otter
#

Ok

vocal spire
#

you can only modify it when it isn't null

stiff otter
#

hmm

vocal spire
#

because if it's null, well, it's null

stiff otter
#

so I need to find out how to access the health stuff

vocal spire
#

you need the ActiveSceneChanged Hook on UnityEngine.SceneManagement.SceneManager
@vocal spire

stiff otter
#

ugh

#

I couldnt find that

#

Ive used it before in unity but it doesnt exist here

vocal spire
#

should work when paired with an IEnumerator with a WaitWhile(()=>!GameObject.Find(object name))

#

wdym

stiff otter
#

that hook doesnt exist on SceneManager

vocal spire
#

it does

#

I have used it

stiff otter
#

hold on

vocal spire
#

others have used it

stiff otter
#

wait

#

oh

vocal spire
#

you can also use On.HeroController.Start

stiff otter
#

I need to specify scenemanagement.scenemanager because there seems to be another class with the same name

#

who would do that

vocal spire
#

since the fsms likely persist through scene transitions

#

?

#

idk, did you reference it twice?

stiff otter
#

ugh idk cheif

#

scenemanager is weird and isnt the unity one

vocal spire
#

which one is it?

stiff otter
#

I was right

#

its the wrong one

#

but for some reason i have to do UnityEngine.SceneManagement.SceneManager and not just SceneManagement.SceneManager

vocal spire
#

I mean, that's what we do

stiff otter
#

weird

vocal spire
#

idk where you got SceneManagement alone from but it doesn't exist for me

stiff otter
#

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

vocal spire
#

yes

#

except for some reason after you open the fsm, it seems to remove _ from the name

stiff otter
#

ok so would it be _healthdisplay ?

#

also how would I find the right gameobject

vocal spire
#

health_display

stiff otter
#

ok

vocal spire
#

you search for it at some point after a save has started

stiff otter
#

but how am I supposed to figure out what to search for

#

is there a scene view or something :|

vocal spire
#

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

stiff otter
#

oh sick

#

thats the gameobject name?

vocal spire
#

should be

stiff otter
#

cool

#

what variables does heroController.start take

#

or whatever they are called

#

parameters

#

nvmd I can just see the file

vocal spire
#

ok...... what did you do?

#

also to auto fill out hooks in vs, do the += then press tab, then press enter

vocal spire
#

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

vocal spire
#

ok, removing seems to have fixed it, but still removed the non added stuff

languid goblet
#

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

vocal spire
#

Where are you calling the add soul code?

#

Oh wait

#

Take damage is working

languid goblet
#

line 17

vocal spire
#

Do it in HeroController

languid goblet
#

oh

vocal spire
#

Will update the ui properly

languid goblet
#

how do i do that?

copper nacelle
#

Use HeroController.instance.TakeDamage

languid goblet
#

oh ok

jolly oriole
#

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

vocal spire
#

lol

jolly oriole
languid goblet
#

oh lol

vocal spire
#

Was gonna mention that but didn’t know if it was intentional

languid goblet
#

i just wanted it to be from enemies

vocal spire
#

Just add soul when you call the taking damage

languid goblet
#

i mean, from like one hit though

vocal spire
#

Well

#

Use on to replace the code that calls that when you hit an enemy

languid goblet
#

oh right

#

do i need to create an object of type UnityEngine.GameObject in order to use TakeDamage

vocal spire
#

Wdym

languid goblet
#

TakeDamage requires four parameters

vocal spire
#

Ohhhh

languid goblet
#

one of them is gameobject

vocal spire
#

Hold on

languid goblet
#

oh wait can i do HeroController.instance.gameobject

vocal spire
#

No

languid goblet
#

oh

vocal spire
#

Hold on

#

You need a hook that gets you the enemy go

languid goblet
#

oh

#

is there something that can just update the UI?

vocal spire
#

Look in dnspy for the code in takedamage

languid goblet
#

uhh

vocal spire
#

Or ilspy

languid goblet
#

dnspy is an exe

#

i'm on mac

vocal spire
#

Ilspy can be used on Mac I think

languid goblet
#

oh ok

jolly oriole
#

what is currently wanted?

vocal spire
#

To take health from the hero when killing enemies

languid goblet
#

when killing enemies

jolly oriole
#

On.HealthManager.Die?

vocal spire
#

lol

#

Good idea

#

Gives a health manager that you can get the GameObject of

copper nacelle
#

there's the journal event in modhooks as well

vocal spire
#

Isn’t that what they are using?

copper nacelle
#

yeah

languid goblet
#

i'm currently using the RecordKillForJournalHook for that

copper nacelle
#

there's just no need for a healthmanager hook imo

vocal spire
#

But they need a GameObject

jolly oriole
#

apparently

copper nacelle
#

just get the death effects parent

vocal spire
#

That makes sense

jolly oriole
#

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?

vocal spire
#

Anyway who wanna use TakeHealth(5)

#

Idk, why is that needed?

copper nacelle
#

yeah you can just filter on the name hash

languid goblet
#

wouldn't that just kill the player if they have 5 max health

copper nacelle
#

yes

vocal spire
#

That’s the point

languid goblet
#

oh

#

is there something that i can use to update the ui?

vocal spire
#

Ilspy

languid goblet
#

i have no idea how to use that

#

i'm trying to figure out how to install it

vocal spire
#

Idk either

jolly oriole
#

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

languid goblet
#

oh

#

sick, it works now

#

time to figure out how to hook into hitting enemies

jolly oriole
#

for the soul gain?

languid goblet
#

yeah

#

you have got to be kidding me

#

ilspy is vsix and vsix files only work on windows?

copper nacelle
#

Linux?

languid goblet
#

mac

copper nacelle
#

AvaloniaILSpy

languid goblet
#

ty

copper nacelle
#

Should probably have that pinned

jolly oriole
#

one sec, wrong copy paste

languid goblet
#

i.. have no clue what that does

#

is MP just soul?

copper nacelle
#

yeah

#

any mpgainspa

#

fsm eventing by hand x5fiftPrime

jolly oriole
#

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
copper nacelle
#

why wouldn't you just call mpgainspa w/ the soul amount tho

jolly oriole
#

maybe FSM differences, checking it rn

languid goblet
#

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);?

jolly oriole
#

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

languid goblet
#

oh ok

#

oh so basically if the amount of soul changes, then you tell the fsm to update

jolly oriole
#

so ig take

orig(self, hitInstance);
int additionalCharge = 0;

HeroController.instance.AddMPChargeSpa(additionalCharge);
copper nacelle
#

you can also ILHook SoulGain

languid goblet
#

is additionalCharge the amount of soul i want to add

copper nacelle
#

That just gives soul on enemy hit so you can modify the value completely

#

yes

#

the extra soul

languid goblet
#

ok

#

so if i wanted each hit to give 33, then it'd be 22

jolly oriole
#

i think

languid goblet
#

alright

#

maybe i could just kill the player if their health is 1

#

and then they kill an enemy

jolly oriole
#

i thought takehealth would takecare of it

languid goblet
#

apparently not

copper nacelle
#

any TakeDamage

languid goblet
#

TakeDamage has a bunch of parameters that i don't know how to find

jolly oriole
#

yea, TakeDamage does it, although it requires way more things

copper nacelle
#

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

languid goblet
#

i guess i'll try it

jolly oriole
#

and just make everything false
the GameObject, Enum, int or int?

vocal spire
#

lol

languid goblet
#

what's unknown

jolly oriole
#

CollisionSide.other i think

languid goblet
#

ok

jolly oriole
#

but everything except left and right works

languid goblet
#

what's the hazardtypes

jolly oriole
#

i think there was an enum for it

languid goblet
#

it's asking for an int

vocal spire
#

Well

languid goblet
#

i guess i could try and find it with ilspy

jolly oriole
#

use 0, or HazardType.NON_HAZARD

languid goblet
#

oh ok

copper nacelle
#

i would actually check but my power is out

vocal spire
#

Oof

jolly oriole
#

that definetly isn't quite poggers

vocal spire
#

Reverse shroompog

languid goblet
#

my first mod
and it only took 2 hours zotewheeze

knotty monolith
#

Nice!

jolly oriole
#

amazing

languid goblet
#

so for example does blackmoth just hook into the dash pressed and then always return true or smth

copper nacelle
#

dash vector hook

#

for length and such

#

and then it just sets the cooldown very low

languid goblet
#

ah ok

jolly oriole
#

and yes, it also hooks into ModHooks.Instance.DashPressedHook

copper nacelle
#

that's for like elegy only though yeah?

jolly oriole
#

idk, the hook is 110 lines

copper nacelle
#

🥴

jolly oriole
#

but seems to be a complete rewrite on how dashes work (or ripped from other functions)

copper nacelle
#

that's not the right repo ngl

#

it's gradow's

jolly oriole
#

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

copper nacelle
#

yeah Serena's repo is from a while back when they first created and moved to the api

jolly oriole
#

yeah, the hook in the newer version has around 160 lines of mod code

languid goblet
#

i looked at modlog and i think there's some sort of error every time i try to hook into the attack animation

copper nacelle
#

what does it say

languid goblet
#

the rest is just the same thing

#

i'm assuming for every time i attacked

copper nacelle
#

your project is built against .net 4

#

you need to target 3.5

#

It's under project settings

languid goblet
#

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

copper nacelle
#

you just need the targeting pack probably

languid goblet
#

from the other mods and videos i saw

copper nacelle
#

that's fine

#

Looks normal to me

languid goblet
#

oh

dark wigeon
#

Are you talking about .net core 3.1?

languid goblet
#

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

copper nacelle
#

you don't want net core

#

you need net framework

languid goblet
#

what type of project should i use then

#

i used class library

dark wigeon
#

Class library but .net framework not .net core

languid goblet
#

wait no it is .net framework

dark wigeon
#

I don't think there is a .net 3.1 framework

#

Only a 3.5 framework

languid goblet
dark wigeon
#

Yes that is fine

languid goblet
#

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

vocal spire
viral snow
#

cool programmer

vocal spire
#

definately

#

didn't know what else to put there so I just went with the dumb

languid goblet
#

HooKnows
that guy who stuffs the code full of if statements

vocal spire
#

k

#

currently making something strange for it

languid goblet
#

how did you add the new journal entry?

vocal spire
#

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;

languid goblet
#

oh, that's what build enemy list does

vocal spire
#

it doesn't cover everything yet

#

but it is enough to add a new one

languid goblet
#

cool

vocal spire
#

I chose 4 randomly and it's actually gruzz mother

languid goblet
#

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

vocal spire
languid goblet
#

what references do you need

vocal spire
#

hold on

#

I think all you need other than the usual stuff is Vasi

#

Sorry, was finishing something and the pc died

languid goblet
#

oh ok

#

it says GameObject doesn't have PrintSceneHierarchyTree and ToArray

vocal spire
#

@languid goblet reference modcommon too

#

Forgot to say that

languid goblet
#

oh ok

#

still giving me an error on ToArray

vocal spire
#

hmm

languid goblet
vocal spire
#

using System.Linq;

languid goblet
#

cool

#

ty

vocal spire
#

np

languid goblet
#

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

vocal spire
#

check what layer it is on and if it has a healthmanager component

#

just a healthmanager should probably do though

languid goblet
#

so like if gameobject.healthmanage != null or smth

vocal spire
#

yeah

languid goblet
#

ok

vocal spire
#

but with getcomponent

languid goblet
#

oh ok

vocal spire
#

gameobject.GetComponent<HealthManager>()

languid goblet
#

thanks

vocal spire
#

np

#

Breaking news!: Person has idea when thinking of stuff to add so something. Then they think of a whole new modded boss

vocal spire
#

10/10 would do again

#

k gn now im sleeping

vocal spire
#

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

vocal spire
#

Helper code worked first try

#

Only a couple more features to add to it that deal with custom stuff in fsms

jolly oriole
#

did it work first time with one mod using it or several?

vocal spire
#

Haven’t tried multiple yet, but they should work