Jump to content

[HELP] Reducing a Characters Work Speed


Recommended Posts

Hello, I am a bit new to the Don't Starve modding scene. However, I have both java and c# coding experience. I have also programmed basic games in both. I am currently working on creating a character missing who is missing his arm. Due to this I was going to make his work speed, chopping wood, gathering, mining, etc., to be slower than normal.

 

I first looked at Woodie's lua file, but his increased chop speed seems to be based off Lucy's effectiveness instead. I then decided to look at different files and came up with an idea to try to reduce a tool's effectiveness, whenever the character picks it up. However, that seemed to crash the game. It also brought to my mind the possible error of reducing the effectiveness every time it is picked up causing it to become useless. I assume the reason it crashed was because a tool's effectiveness cannot be reduced below 1 or I simply coded it badly, still new to lua and the games engine. 

 

My second attempt was to instead reduce the characters power behind each swing rather than their speed. I created a function that was similar to woodie's added beaverness per chop, that instead added half a hit to the tree's hits left. This didn't crash the game, but the tree simply didn't ever get chopped down. 

 

I would like to see if there is a way to do this and if their is if I could get some help. Out of all the stats, that the character has so far this is the first to give me a problem. Just in case anyone is interested in who this character might be. He is a character from another popular media and his name is Rick. Also, sorry if my grammar is subpar. Math, computers, and logic are the things I enjoy.

 

TL;DR

Need help reducing chop, mining, gather speed for a character. 

Link to comment
Share on other sites

To slow down the rate at which a character can perform an action, have a look in the player stategraph file (SGwilson.lua). You'll see for chopping that Woodie as a shorter animation cycle that other characters. I haven't tried it, but lengthening the cycle should slow down the work rate (I believe it counts as one unit of 'work' done when the animation cycle completes). The number of blows required to chop down a tree or mine something is linked to the tool used, as you have already discovered. There will be a way to add a listen event to the character that will apply a debuff to the tool when picked or used without causing a crash. It might get a bit messy and need some trial and error before you can settle on an approach though.

Link to comment
Share on other sites

Thanks for the response. I was wondering if I could mess with the animations to change its speed that was going to be my next attempt at fixing it. But, again thank you. I am still very new to lua and this games engine. Can't wait to finish my Rick mod so I can get started on Tyreese. I plan to make him similar to woodie except with a hammer and his transform mode based off how many enemies he has killed in a short amount of time. I am basing this off of his rampage in the last season where he was surrounded and started going h.a.m..

 

I will be putting your name in my mods credits section.


Thanks for the response. I was wondering if I could mess with the animations to change its speed that was going to be my next attempt at fixing it. But, again thank you. I am still very new to lua and this games engine. Can't wait to finish my Rick mod so I can get started on Tyreese. I plan to make him similar to woodie except with a hammer and his transform mode based off how many enemies he has killed in a short amount of time. I am basing this off of his rampage in the last season where he was surrounded and started going h.a.m..

 

I will be putting your name in my mods credits section.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...