Jump to content

New to coding, would like help with adding perks to my character mod


Recommended Posts

Hello, i believe this is my first time posting here. forgive me for any further mistakes i make (sorry if my English is a little weird too)

I've recently decided that i wanted to make a custom character on DST, been working on it for a few days with my free time. i managed to add a few things that have been what i've been looking for with the extended sample character, however i still have a few perks that i want to add. i'm trying to make my character benefit from the winter season (regen sanity, take longer to starve, defense boost if possible)
and struggle a little during other seasons (sanity drain, hunger drain).

I've only added few things currently; resistance to solid freezing, slow to reach low temperature, quick to reach high temperatures and additional dmg taken from lighting

I'm fairly new to coding, so i don't exactly know what i'm doing but its been working so far. i'd like some help with adding certain things since i'm not well known with coding.

Here's what i want to add if its possible:

* Gain sanity regen, take longer to starve, attack and defense boost (if possible) only during the winter.

* Drain more sanity and hunger if the season is either Summer/spring.

* Chance of freezing mobs on-hit (not including bosses) (optional, i'm not sure if this would be possible to code in).

* Sanity gain after killing a mob

* Movement speed increased during winter, or when wet (optional)

* Benefit more from eating Fish tacos (Fav food)

Any help with coding at least one of these would be much appreciated, if possible, i'd like to be able to customize the numbers/stats to my liking. it would also be helpful if anyone could suggest options similar to what i would like to add, just in case. again, i'm new to coding so i might not know where exactly the codes should go and where to put them. so far most of the codes that i have added are in the prefabs>main.lua file.

 

 

kodomo.lua temperature.lua

Edited by Ugly boy
Link to comment
Share on other sites

To set a favorite food, you have to add this under the [master_postinit = function] section in the prefabs > character.lua file: inst.components.foodaffinity:AddPrefabAffinity("meatballs", TUNING.AFFINITY_15_CALORIES_HUGE)
Change "meatballs" for whatever food you want, in this case it would be "fishtacos"

  • Like 1
Link to comment
Share on other sites

Howdy. I have implemented changes inside this file. kodomo.lua

Quote

* Gain sanity regen, take longer to starve, attack and defense boost (if possible) only during the winter.

* Drain sanity and hunger during both Summer/spring.

* Sanity gain after killing a mob

* Movement speed increased during winter, or when wet (optional)

I have marked things you can modify, but they are quite visible (as numbers ofc).

Let me know if you will have any questions. Cheers!

 

Edit:

Quote

* Chance of freezing mobs on-hit (not including bosses) (optional, i'm not sure if this would be possible to code in).

I will try to do this tomorrow or later this night. I know how to add freezing perk to the weapon/handslot item only

Edited by Yakuzashi
  • Thanks 1
Link to comment
Share on other sites

Maybe this isn’t helpful, but there is a global variable called TheWorld where you can access what season you are in. You could then listen for the season change event, and then update all the modded characters in the world in accordance with the new season

  • Like 1
Link to comment
Share on other sites

3 hours ago, Yakuzashi said:

Let me know if you will have any questions. Cheers!

Thank you so much! i've been looking to add these perks in specific for a while, now my character finally has them. there's a bit of an issue though. when my sanity starts to drain during the summer/spring, the draining seems to stack on itself somehow, it does the same for the sanity gain during winter, draining/gaining more sanity than its supposed to. also, is there a way to remove the sound and flashy red/green when the sanity is being drained or gained from the season? i was more thinking that it would go down similar like hunger but slower

Edited by Ugly boy
Link to comment
Share on other sites

kodomo.lua

I have fixed sound and flash issue with every sanity tick.

The inst:DoPeriodicTask method is not 100% accurate in terms of time, so with every tick you have some leftover of decimals and hundredths, which overtime lead to stacking problem. I'll try to find any workaround...but it might be quite hard.

Cheers!

  • Thanks 1
Link to comment
Share on other sites

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
 Share

×
  • Create New...