Jump to content

How to create unique perks for a custom character?


Recommended Posts

Hello! I'm rather new to modding, and I've been trying to add a custom character based on one I've had as an OC for a while. I've been using Extended Sample Character (https://forums.kleientertainment.com/files/file/950-extended-sample-character/?page=5) and have followed the tutorial on how to edit dialogue, perk names, images, etc, but my character has a few special perks that I want to implement and am having a bit of trouble figuring out.

His first perk is the ability to transform into a dragon. I figured I could maybe look at the script for Woodie's werebeaver form, as well as Dragonfly, but I'm not sure what I would need from either of them or if that's even the right way to go about it. The idea is that he is able to temporarily turn into a dragon (for maybe three minutes?), with a cooldown of a few days. The dragon is stronger than he is, but is constantly flying, meaning he can't pick things up. I also wanted it to be able to breathe fire, so I thought I could look at how the fire staff is done, but again, I have no idea if that's what I need to actually do. His attacks while in this form would be similar to the way Dragonfly swipes with her claws. If his HP reaches 0 somehow, instead of dying, he would be knocked out of his dragon form, and have half of his max hunger, sanity, and hp, but if he comes out of it when the timer runs out, his sanity and hp are filled to max, with his hunger drained significantly, similar to the effects of sleeping. The dragon also would ideally radiate heat and light.

His second unique perk is that he has a cat that permanently follows him around, and cannot die, similar to a pet. He wouldn't have to adopt the cat or carry an item to keep her with him, ideally, but if that's not possible, I was thinking I could maybe use an item like Chester's eyebone or Star-Sky that he would have to hold to keep her nearby (perhaps a collar or something). Like a pet, I wanted her to get hungry occasionally but also wanted to restrict her to only being able to eat meat, excluding monster meat (my character wouldn't feed his cat something he can't eat and would ideally say as much if it's attempted), with crock pot recipes including meat (excluding monster lasagna) satiating her for longer, and if unfed for too long, she will attack small animals like rabbits, birds, moles, and butterflies, and maybe even fish from a pond, so as to "hunt", stopping after consuming a value of 1 meat. She would also attack enemies threatening my character with a damage output similar to that of a catcoon, but not do as much damage when she's hungry (like Wolfgang? but I'm not sure how to give that attribute to a follower). I wanted her to be able to be petted to give a small amount of sanity as well.

There are also a couple of unique crafting recipes I wanted him to have, but I think I know how to do that? I'd appreciate it if someone could help me with that anyway, just in case I'm wrong. I also wanted him to start out with an unbreakable sword in his inventory (that I will draw using the machete from SW as a reference) similar to Woodie's axe, but it drains some sanity when equipped, like a dark sword. As well, I want him to have a bit of resistance against overheating, but more trouble staying warm since he is a dragon.

I haven't got any of his perks actually started yet, but I do have some ideas for starting points that I mentioned above. I would sincerely appreciate any help someone can offer me, even if you're letting me know that some things I want aren't currently possible in the game. I'm mostly needing help figuring out the dragon transformation and the cat. If you've made it this far, thanks so much for reading, and I hope you have a nice day, even if you can't help me out. c:

Edited by smoltair
Link to comment
Share on other sites

You say that you're rather new to modding, and you're talking about doing some of the most flamboyant perks I've ever heard of :D That whole dragon thing is going to be a massive amount of work to get right. Lots of things to consider when making a character work in ways characters do not normally work e.g. fake flying, restricting actions, breathing fire. I'm not even sure I could do this, but then I don't have a lot of experience doing characters.

If I were you, and was new to this, I would start at the bottom of your post and work myself up. Simple things first. But first, look at my newcomer post, and get ready for a ride, because if you're going through with this, it'll be many, many days of coding, debugging and fighting with Spriter.

I would definitely start with the sword, since you'll learn a lot just from doing that. You can check out the item examples in my newcomer post to see how it all works, and then just rewrite the code to make it a sword instead of e.g. the Cactus Armor. There's an example for making a recipe for your prefab in the Cactus Armor mod, as well. If you have more recipes and unique items, do those, as well.

Then you can start looking at other pet mods, to see how a cat could be done. Here's one. Most of the other mods change existing pets or make pets playable, but that ones seems to add new pets.

This will show you how to Change animation build at runtime. Only the two first functions are interesting to you, SetNormalKin and SetNightmareKin. You have to switch between two animation builds in order to change appearance, and all other code making changes between these forms should happen in those functions as well. You can trigger these forms by listening for events or using keybindings.

Link to comment
Share on other sites

@Ultroman Thank you so much for the reply! I am... very ambitious for someone who has not actually made a mod for anything before, I know, but I am determined to figure out how to do all of this. The idea of having my character be playable really excites me, as do the challenges I'm gonna have to overcome if I wanna finish it!

I really appreciate that you took the time to give me these tips! I will definitely read through everything you've linked me to, and take a look at that mothlings mod that adds the new pets as well. Thanks again!

Link to comment
Share on other sites

Wow, your attitude is just right for this kind of thing :D Just keep your chin up when it doesn't work for three days straight xD We're here to help. But at the beginning, it'll be best if you got a grasp of LUA and just got a lot of studying the game-code and other mods under your belt. You'll get there. Especially with that attitude. You can do it! :D

Link to comment
Share on other sites

@Ultroman Thanks! I'm already starting to get the hang of reading LUA, and looking at the game's code in order to base my mod off of something existing. It's really interesting to explore something I've never really done before. One question I have at the moment is, do I need to have a modmain file for every item I add in my mod in addition to the character, or do I just write it all into one modmain file? Sorry if the answer seems obvious, but I just wanna know before I go ahead and write a separate modmain (with a different name like "swordmain") for every item I add in xD

Link to comment
Share on other sites

If you want to make a new item for the game, that item needs its own prefab file, just like the character. There is an example of creating a new item complete with a recipe if you need that, in the newcomer post (the Cactus_Armor.zip).

Link to comment
Share on other sites

@Ultroman if you don't mind a few more questions, I wanted to know if I should create each item as a separate mod just to test that it's working, and if so, how would I go about inserting them into the character mod? I'm working on the sword now, which is not craftable and the character is going to spawn in with it in his inventory. I also wanted to restrict other players from picking it up, like they would get the "I can't do that" dialogue instead of grabbing it. I've been using the dark sword as a model along with your cactus armor mod and am also wondering if this

  inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)
    inst.components.equippable.dapperness = TUNING.CRAZINESS_MED

in the dark sword code is where it says that it drains sanity. My initial assumption is yes but I wanted to double check and also ask if leaving it the way it is will be fine if I want the sword my character has to drain sanity when held like the dark sword does. I am also wondering as well if the anim files create themselves when images are converted to TEX and XML in their corresponding folders, or if I need to do that myself? Sorry for so many questions, I just want to make sure I'm doing things correctly xD

Link to comment
Share on other sites

We just did character-specific item code in another thread. Your question about merging an item mod into a character mod is also answered there.

Yes, that is the code that applies sanity drain. You need to also copy the "onequip" and "onunequip" functions that the code references, though.

I'm not sure about the anim files. I think you need to build them using Spriter or ktools or something. There are tutorials about how to create them in the tutorial sections of the forum (which are linked to in the newcomer thread).

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