Jump to content

I need help with my mod


Recommended Posts

I am trying to make a Funtime Freddy mod, and currently, I am stuck. The game freezes whenever I choose the character (This I am trying many things to fix). Other than that, my character has three main perks that I will need help making when/if I can fix this bug, the perks are:

1. He has an built-in ice box, this is compensated for by having him move slightly slower, and unable to equip body and head items.

2. Funtime Freddy has night vision. This is compensated for with Funtime Freddy losing sanity during the day.

3. Funtime Freddy Brings along Bon-Bon. Bon-Bon is an equippable item that lets Funtime Freddy gain sanity in the dark, and negate the daytime sanity drain. Bon-Bon also has a secondary function when equipped, when held, Bon-Bon de-agros mobs after Funtime Freddy (This of course doesn't effect big bads). Bon-Bon also can be dropped or thrown, in which Bon-Bon will act like Bernie, where he will attack mobs. Bon-Bon seems overpowered, but Bon-Bon has a major downside, his crappy durability, Whenever Bon-Bon attacks a mob, gets attacked by a mob, or Funtime Freddy gets attacked while Bon-Bon is in his inventory, Bon-Bon loses 1% durability, and when broken, will become rubble on the ground. Bon-Bon can of course be healed for 10% durability per gear and when broken can be fixed similarly to how you can tame clockworks, by repairing him with three gears, this will make a new Bon-Bon with 25% durability, making gear farming essential if you want to have any sanity.

Funtime Freddy has 225 health, 150 hunger, and only 100 sanity. I know how to make custom stats. But if you guys can help me with the other perks and help me to fix this bug that prevents me from progressing any further, I would be grateful

Edited by Dragolantis
Link to comment
Share on other sites

Basic debugging tutorial: whenever anything funky happens with your mod, go to Documents/Klei/DoNotStarveTogether and read the error logs. If the game freezes on character selection it is most likely a basic syntax problem in the character prefab file. Also, any print statements you make in code are saved to a log (either the client or the server one) so you can debug by checking function execution and checking variable values.

I think you can use a equippable item tutorial to create an ice box, or just start the game with a Bearger Insulated Pack/ Warly Chef Pouch and hijack the unequip functions. This is not that easy, though. The alternative is to hijack the equip calls, so it's a "pick-your-own-poison" situation. I don't think the game has any built-in method to create non-equippable items but I might be wrong.

Night vision should be the easiest; there is a whole file called playervision.lua that deals with it and there should be a lot of examples. There might be some trouble with the HUD and there might be some trouble with the auto-toggle but I believe setting the self.forcenightvision flag should be enough. Sanity drain is easy to code, and there are a few tutorials on sanity auras and a lot of mods and uses in the game code to compare.

Creating a custom Bernie is not that hard, as well, and you can start by cloning Bernie and doing some tweaks. It disabling the sanity debuffs should be a matter of changing tags, and the durability aspect should be a matter of appropriate ListenForEvent calls to use a custom function on hit. You may even be able to use the same repair action for clockworks.

Link to comment
Share on other sites

Thank you! I just needed to make my own topic, when I try to fix my issues on other topics I don't get a straight answer. This is really helpful. I am substantially new to Lua. I have done coding before, but only using blocks, you know, sites like scratch and tynker? Good place to start, but too limited on resources to actually get anything done. Simple though. I understand what I'm supposed to do but not really how to do it completely. If I have another issue, I am definitely posting on this thread again.

Link to comment
Share on other sites

This is me a half hour later. I was trying to fix the mod by continuously starting again from scratch, trying something different, and tossing it in the trash if it didn't work. guess what? IT WORKED!!! I FIXED THE ERROR!!! I am really happy about this.

Best part: I actually made a back-up of my successful version! So if, probably when, I fail and need to start over, I have this to avoid getting the issue again! Happy Day!

Edited by Dragolantis
  • Like 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...