Jump to content

Need some help creating a Character mod.


Recommended Posts

Hello people. I am kinda a newb here, so I am sorry for any mistakes I make.

 

I really want to learn how to create a Don't Starve character in this game, one for my self, and one for my bestfriend, for now I'll test things on my character.

I watched some videos on how to create a character, used some tools off this website, and did everything the person said in the video, I think it might be a little outdated, but not sure, when I wanted to test how things was going with me doing the coding to the character it crashes.

I got a bit upset, I already made the whole template character drawing as well, even having image being showed of the character would make me happy if I knew what to do.

 

If anyone has the time to show me or teach me how to create a character, I would really appreciate it a bunch! Or even replacing a character thats already been made to look like the character (if you know what I mean) I made would be awesome too.

 

Thanks for reading and taking your time, I am sorry if I sound stupid, I'm just so new to this. xD

Link to comment
Share on other sites

Hey ZackOcs, I'm glad that video helped you out (from the extended sample character thread). I'm trying to make a character too, and I'm learning a lot about lua files and modding in the process.

I just wanted to extend the help, since you seem to still be having trouble with some things too.

You mentioned you wanted to make your character weak to the cold? I might be able to help you out with something like this, since my character is weak to fire.

(I also figured it would be best to talk with you about this in another topic, rather than the one for the mod)

Link to comment
Share on other sites

Hey ZackOcs, I'm glad that video helped you out (from the extended sample character thread). I'm trying to make a character too, and I'm learning a lot about lua files and modding in the process.

I just wanted to extend the help, since you seem to still be having trouble with some things too.

You mentioned you wanted to make your character weak to the cold? I might be able to help you out with something like this, since my character is weak to fire.

(I also figured it would be best to talk with you about this in another topic, rather than the one for the mod)

 

Yeah, thank you very much for the video, it was really useful!

You seem very good with all these files and coding. So, like you said, are you willing to help me make him weak to cold? If you are, I have to thank you again, so what shall I do? :D

Link to comment
Share on other sites

Yes of course! I'm assuming you're coding this in the proper lua file, in the prefab folder?

9eeed053cc0e24aea5a43743aae9491a.png

This one being for lure. Currently I was messing around with how hard fire damage hits him, and gaining sanity from rain. I basically looked into Willow and WX's prefab lua files and reversed some of their perks.

 

For something like being 'weak' to the cold, I would need to know more specifically what you mean. Don't characters already take a huge health penalty when freezing?

I would start out with this by looking into the lua for freezing.

6f4965307323d6aaf625b04471427a10.png

Which seems to be located in the components section. Huh... I've never worked with files in here, so I don't know if they'd transfer well into your character mod, however.

local states = {    FROZEN = "FROZEN",    THAWING = "THAWING",    NORMAL = "NORMAL",}

This line of code in the beginning suggests there states can be used when naming things inside your character (for perks).

For example, you can use the instance of FROZEN or THAWING as something your character, say, gains hunger from or something.

 

So what exactly did you mean by weak to cold? :grin:;

Link to comment
Share on other sites

Yes of course! I'm assuming you're coding this in the proper lua file, in the prefab folder?

9eeed053cc0e24aea5a43743aae9491a.png

This one being for lure. Currently I was messing around with how hard fire damage hits him, and gaining sanity from rain. I basically looked into Willow and WX's prefab lua files and reversed some of their perks.

 

For something like being 'weak' to the cold, I would need to know more specifically what you mean. Don't characters already take a huge health penalty when freezing?

I would start out with this by looking into the lua for freezing.

6f4965307323d6aaf625b04471427a10.png

Which seems to be located in the components section. Huh... I've never worked with files in here, so I don't know if they'd transfer well into your character mod, however.

local states = {    FROZEN = "FROZEN",    THAWING = "THAWING",    NORMAL = "NORMAL",}

This line of code in the beginning suggests there states can be used when naming things inside your character (for perks).

For example, you can use the instance of FROZEN or THAWING as something your character, say, gains hunger from or something.

 

So what exactly did you mean by weak to cold? :grin:;

 

Oh I am sorry for not being very specific, that's a mistake I seem to do a lot. ^^;

 

But, when I mean by being "weak" to cold. Maybe his health drains down 2x faster or something? Or he gets cold way too easily? Either one would fit. Looking into those files you showed me gives me a hint on what to do, but I might mess up, haha. :grin:; Its not a way too important perk to add, so don't worry much if we aren't able to do this somehow. :grin:

Link to comment
Share on other sites

Ah, I already made a big post and lost it... anyway, lets try this again.

Since what you want to do already has a code, that makes this easier! In the instance of my character taking more fire damage, it was as simple as changing the number or multiplier to a higher digit. I'm assuming we'll be doing the same thing with yours. :grin:

 

Oh, actually, before we begin I should mention it helps to look at other character mods to see if it can be used in your mod. (You shouldn't just copy their code though (unless they allow it), as it's sort of bad mannered.)

 

This character, Floe, has perks relating to winter and freezing. Its important to mention that this character doesn't seem to be compatible with DST, as I believe freezing or things related with precipitation (ROTG) doesn't transfer into DST.

 

However,

125332c3c0e42cbe616bc7cec2416e0b.png

She seems compatible with the original DS, so the author of this mod might be able to port her into DST! Anyway, moving on.

 

If we open up her prefab lua we'll see this line of code over here

if GetSeasonManager():IsWinter() theninst.components.combat.damagemultiplier = 1.1inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.1)inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.1)inst:AddComponent("recovery")

Looks like this maker her damage in the winter a little stronger and her walk speed faster. There is a recovery component related to this mod as well, however we're looking specifically at the "if GetSeasonManager():IsWinter() then" line. This line of coding seems to reference, well, winter. If we do a search on this....

I found a mod related to a hound flute.

Their coding here seems to be "if GetSeasonManager():IsWinter() or GetSeasonManager():IsSpring() then". I wonder if this is the line of coding that can be used in DST?

 

Moving back to Floe's lua, we can see it references these two components: (near the top of the lua)

 

    inst:AddComponent("recovery")
    inst:AddComponent("freezable")

 

Since these are components, lets look in that folder for these luas. Since we already looked at freezing, lets look at recovery instead. (we're looking at this to see if we can make it negative, to reduce healing) This is actually located in Floe's script folder. Therefore, I'm assuming they made this code, so proceed with caution because if you want to use it, I would highly recommend asking them if you can, and if you are, to be sure to credit them.

(Doing a back search on this code could see if it already exists as well)

 

I won't look into that, actually, because we might not need to. Moving back to the freezable lua, we'll see right below the code I mentioned above (in floe's lua) is this line:

 

    inst.components.freezable:SetResistance(999)

 

Which makes her resistant to the cold. I'm assuming if we set this value to 0, they'll have no resistances? (heads up that I also found this topic that might be useful)

 

I'd recommend adding this line right underneath your stats, like this

	-- Stats		inst.components.health:SetMaxHealth(300)	inst.components.hunger:SetMax(120)	inst.components.sanity:SetMax(120)	inst.components.freezable:SetResistance(0)

Also note that you can probably also set this number to negative, but that might make your character always cold!

 

Anyway, hope this helps and let me know if this code works at all, then we can see into increasing the freeze damage.

Link to comment
Share on other sites

Ah, I already made a big post and lost it... anyway, lets try this again.

Since what you want to do already has a code, that makes this easier! In the instance of my character taking more fire damage, it was as simple as changing the number or multiplier to a higher digit. I'm assuming we'll be doing the same thing with yours. :grin:

 

Oh, actually, before we begin I should mention it helps to look at other character mods to see if it can be used in your mod. (You shouldn't just copy their code though (unless they allow it), as it's sort of bad mannered.)

 

This character, Floe, has perks relating to winter and freezing. Its important to mention that this character doesn't seem to be compatible with DST, as I believe freezing or things related with precipitation (ROTG) doesn't transfer into DST.

 

However,

125332c3c0e42cbe616bc7cec2416e0b.png

She seems compatible with the original DS, so the author of this mod might be able to port her into DST! Anyway, moving on.

 

If we open up her prefab lua we'll see this line of code over here

if GetSeasonManager():IsWinter() theninst.components.combat.damagemultiplier = 1.1inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.1)inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.1)inst:AddComponent("recovery")

Looks like this maker her damage in the winter a little stronger and her walk speed faster. There is a recovery component related to this mod as well, however we're looking specifically at the "if GetSeasonManager():IsWinter() then" line. This line of coding seems to reference, well, winter. If we do a search on this....

I found a mod related to a hound flute.

Their coding here seems to be "if GetSeasonManager():IsWinter() or GetSeasonManager():IsSpring() then". I wonder if this is the line of coding that can be used in DST?

 

Moving back to Floe's lua, we can see it references these two components: (near the top of the lua)

 

    inst:AddComponent("recovery")

    inst:AddComponent("freezable")

 

Since these are components, lets look in that folder for these luas. Since we already looked at freezing, lets look at recovery instead. (we're looking at this to see if we can make it negative, to reduce healing) This is actually located in Floe's script folder. Therefore, I'm assuming they made this code, so proceed with caution because if you want to use it, I would highly recommend asking them if you can, and if you are, to be sure to credit them.

(Doing a back search on this code could see if it already exists as well)

 

I won't look into that, actually, because we might not need to. Moving back to the freezable lua, we'll see right below the code I mentioned above (in floe's lua) is this line:

 

    inst.components.freezable:SetResistance(999)

 

Which makes her resistant to the cold. I'm assuming if we set this value to 0, they'll have no resistances? (heads up that I also found this topic that might be useful)

 

I'd recommend adding this line right underneath your stats, like this

	-- Stats		inst.components.health:SetMaxHealth(300)	inst.components.hunger:SetMax(120)	inst.components.sanity:SetMax(120)	inst.components.freezable:SetResistance(0)

Also note that you can probably also set this number to negative, but that might make your character always cold!

 

Anyway, hope this helps and let me know if this code works at all, then we can see into increasing the freeze damage.

 

Wow! You are really good at this stuff it seems. :grin:

Thank you for all the very helpful tips, I shall look more into this, and I should give you some credit for helping me as well! :-)

 

I think the inst.components.freezable:SetResistance(0) worked.

I set it to inst.components.freezable:SetResistance(5) instead so he won't be 100% bad at the cold. XD But to me, I think it worked, and he gets colder then other characters then usually. Thank you very much! I can't thank you enough, you are too nice to help me out.

and I am pretty sure the freeze damage is somehow kind of used like this?

Link to comment
Share on other sites

Heh, I'm just good at digging around in codes and stuff. I'm still new to all this stuff.

I'm glad I could help, and if you choose to credit me that'd be pretty sweet! :D Although I feel I didn't really do too much...

 

Also I'm so SO glad that code worked for you because I tried adding it to my character and it crashed DS. I think that's how freeze damage works? Huh.

 

If there's anything else you need, just let me know and I'll try to help you out!

Link to comment
Share on other sites

Heh, I'm just good at digging around in codes and stuff. I'm still new to all this stuff.

I'm glad I could help, and if you choose to credit me that'd be pretty sweet! :grin: Although I feel I didn't really do too much...

 

Also I'm so SO glad that code worked for you because I tried adding it to my character and it crashed DS. I think that's how freeze damage works? Huh.

 

If there's anything else you need, just let me know and I'll try to help you out!

 

Well you are really good with codes if your new to it, you are amazing. :grin: I also, I really like your icon. XD The animation to it is really awesome and neat, I saw you studying animation on your page and such, I'm trying to learn it too, I wish you good luck in all your studies as well. :grin:

 

and, you was a huge help if you think so or not, if it wasn't for you, my character could of not been created, I am really thankful for all the help. :-) I have learn more in coding too thanks to you. And of course I'll give you credit! I told my friend about how much you helped me, she thinks your awesome too.

 

My next goals in DST coding is giving him a custom weapon, and another character that I am creating can transform into demon when his health or sanity is half way gone. (kind of like Wolfgang when he gets stronger when hes fuller.)

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