Jump to content

I need help creating a custom character in DST (with answers as I slowly figure it all out)


Recommended Posts

ORIGINAL QUESTION:

I want my custom character to have a faster base movement speed on trails, but not anywhere else. I've tried altering the self.fastmultiplier and self.runspeed in the locomotor.lua file in components, but it would either increase my normal walking speed or just do nothing at all.

ANSWER I FOUND:

I ended up scraping the idea altogether and proposed a better (easier) idea. Since he has a lot of sanity, I made it so he could move (very slightly) faster when he reaches 50 sanity, and even faster at 30 sanity (I might make these numbers smaller, however). He only ever goes up to 1.2x the normal character speed (TUNING.WILSON_RUN_SPEED), because movement speed in a game about kiting is one of the most important aspects. If you want to add this into your code, this is how I did it (I put this in my character's lua file right under my character's start inventory. I included notes on what it does and where I got the idea from):

 

--From the AMAZING Cecil the Jester character mod by Овощ года, who is a real life saver! I was trying to figure out how to fairly code in some faster movement speed, and this is the answer!
local function onsanitychange(inst, data, forcesilent)
local currenthealth = inst.components.health.currenthealth
    if inst.sg:HasStateTag("nomorph") or
        inst:HasTag("playerghost") or
        inst.components.health:IsDead() then
        return
    end
    local silent = inst.sg:HasStateTag("silentmorph") or not inst.entity:IsVisible() or forcesilent
        if inst.components.sanity.current < 50 then
  inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.1)
  elseif inst.components.sanity.current < 30 then
  inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.2)
  else
  inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1)
 --This is saying that if the character's sanity is lower than 50, then his runspeed is 1.1x faster, and if his sanity is less than 30, his runspeed is 1.2x faster.
 --The last line is just confirming that if none of the two lines above apply, his runspeed is normal.
end
end
 
There's a picture of how this should appear in your code (if you use notepad++)help.thumb.png.bf63974b5efaf77127be7b8529b2b820.png
Edited by fatherhitsme
Added an answer to my previous question for anyone who needs help with this problem as well. I also changed the title to reflect this change.
Link to comment
Share on other sites

ORIGINAL QUESTION:

I want my custom character to be able to revive himself completely once with no help from anything (headstone, Florence Postern, telltale heart, etc). All other times that he needs to be revived, however, I want him to have to use 2 telltale hearts to revive himself (and he would not be able to use the Florence, headstone, etc). If some parts of this code are just not possible, I would completely understand and alter it as needed.

MY ANSWER (so far):

As shown in the picture above, I just put a life giving amulet into his starting inventory. I gave him a few spoken lines describing why he has one, but I haven't found a solution to either prevent him from using other means of reviving himself or using only one heart to revive himself. I had a slight bit of trouble coding this (it was the first thing I put into my mod, so I was very new at lua, which I still am) so this will most likely help someone out (you can get rid of the "fishsticks", and the "mashedpotatoes", but I left it in for reference):

local start_inv =
{
        "fishsticks",
  "mashedpotatoes",
  "amulet",
}

 

I put this right where it is in the esctemplate provided in the forums, but I will include a picture anyway just in case anyone is having trouble or not using the esctemplate.halp.thumb.png.317cad4f3910a572cb2ca654a47ec40f.png

 

Edited by fatherhitsme
Link to comment
Share on other sites

I am creating a character with a higher max sanity, and with the sanity drain of Wendy (who normally loses sanity slower than everybody else in DST). To balance this out, I want him to lose a little bit of sanity every time he hits a living creature (not including shadow monsters that attack you when you're at insanely low sanity levels). If I am able to code different levels of sanity taken away for different animals that would be really good too, but I understand if it just isn't doable.

I also want to try and work on him gaining sanity back by doing odd things that normally wouldn't (befriending pigs, feeding moleworms, etc). If there are any tips that you could give me, that would be extremely helpful!

Link to comment
Share on other sites

I have a friend who is trying to code a custom character with a slight allergy to honey. This would mean that any food that is made that requires honey would not be edible to this character (similar to Warly, who is only able to eat crockpot food). Items that use honey as a filler in a crockpot would still be edible, and other foods that CAN use honey but don't REQUIRE honey would also be able to be eaten, just not honey and foods that have to be created with honey.

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