Jump to content

Modding Help: Custom Pet/Companion + Other Perks


Recommended Posts

I'm trying to create a pet/companion for my mod. I want them to behave almost identically to how Woby does with Walter in the fact that they spawn with him and can't be killed, just without the big form and storage options.

I also want the pet to be able to act similar to Abigail in how she can attack when the player is attacked, and also have a riled up/soothe option attached to a custom item. Does anyone know how I could implement this? I'm new to modding and coding both, so please bear with me. 

Some people on reddit told me to look through the code to find similar things and tweak them, but I'm having trouble knowing which codes do what and how to tweak them. For example, I'm trying to make a perk where the character doesn't overheat as often as the normal player. I've looked into it a little, and decided that reverse-engineering Wilson's beard mechanic would probably do the trick. My only issue now is that I don't know what code to take and how to tweak it.

Any help at all would be greatly appreciated, thank you!

P.S., is there any way I can get to the sprite files for Woby so I can make sprites for the pet/companion I'm trying to create?

Link to comment
Share on other sites

If you are new to modding and having problems with this, it's probably better to first learn a bit more about lua and modding before trying to make a companion. The people on reddit are right, it's always good to look how somebody else did it, you can also have a look at other mods, how they implemented the changes to their character or how they added a companion.

If you want to know which code does what, you have to understand how they function by analyzing the functions they have and what they do.

For example, for your less overheat perk, clothes give you insulation, some make you overheat slower. From there you can see that these clothes have the component insulator. Insulator has a function GetInsulation(), to return the value of the insulation, which will be needed if you want to use this insulation. If you search for this function in all of scripts folder, you will find the temperature component, that each player has. There you can see how beard and clothes change the insulation, and you will find these two values, self.inherentinsulation and self.inherentsummerinsulation. By changing self.inherentsummerinsulation you get more time before your character overheats. By adding something like 

inst.components.temperature.inherentsummerinsulation = 120

into the master postinit, your character has an as good insulation as if wearing a Summer Frest.

If you get more experience, things like this will be easier.

For your P.S., have a look at the answer I just gave there:

I hope this helps :)

  • 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...