Jump to content

Recommended Posts

Alright. So I had some crashy issues, which should be fixed, but now I am confused.

 

How do I make a sanity gain from spiders, in this case, specific only to my character? I tried overwriting the sanity aura from spiders in spider.lua, but that just made all characters get sanity gain from them, obviously.

 

Also, how do I implement sanity drain during the day and sanity gain during the night?

I tried this

 

inst.components.sanity_day_gain = -5
inst.components.sanity_night_mid = +5
inst.components.sanity_night_dark = +20
 
But I think I botched it. Didn't I?

Should it be like this instead?

inst.components.sanity_day_gain = -5/(day_time*32)
inst.components.sanity_night_mid = +5/(night_time*20)
inst.components.sanity_night_dark = +20(night_time*2)
I will be thankful for any and all help.
 

I'm sorry but it looks like you're just making up variables in hopes of them doing something. None of the components you modified exists and if they would exist they would certainly not work like that.

What you'll need to do is hook into the spider prefab and listen for "dusktime" and "daytime" events and change the sanityaura accordingly. You can find tons of examples on how to listen for these events in the vanilla files and also on the forum.

And for modifying sanity auras, I'd suggest simply using multiples of the existing tuning variables (as seen in spider.lua)

I can't give you any code samples right now though.

I'm sorry but it looks like you're just making up variables in hopes of them doing something. None of the components you modified exists and if they would exist they would certainly not work like that.

What you'll need to do is hook into the spider prefab and listen for "dusktime" and "daytime" events and change the sanityaura accordingly. You can find tons of examples on how to listen for these events in the vanilla files and also on the forum.

And for modifying sanity auras, I'd suggest simply using multiples of the existing tuning variables (as seen in spider.lua)

I can't give you any code samples right now though.

I figured out how to modify tuning variables for sanity auras, but how do I go about sanity drain during the day? I wasn't making up random variables, I was referring to to the values in tuning.lua, but that obviously doesn't work. Should I code a custom component or overwrite the sanity component to include drain during the day? On second thought, I should probably look at the sanity component. Right? I hate writing on forums because I think while typing and change my mind mid-paragraph.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...