Jump to content

Recommended Posts

Sabeku

I was wondering if you could help me with making my character faster (for the extended sample character template mod) because I don't really know how to use the thing in Wx78's folder for his speed boost. I'm sorry, I'm really new to modding. And also sorry for posting my original post on the wrong topic.

Sabeku

I was wondering if you could help me with making my character faster (for the extended sample character template mod) because I don't really know how to use the thing in Wx78's folder for his speed boost. I'm sorry, I'm really new to modding. And also sorry for posting my original post on the wrong topic.

 

Hello! I believe you're in the right place. Strange that I didn't get a notification for the mention though...

Anyway, to help you I would first recommend that you look into other character mods with perks similar to what you want, then looking into their code to see how they did it.

I also mentioned you could use that line in WX's code for the speed boost as well.

Since you mentioned you're new to modding, I'll try to make this less code intensive for you.

Coffgirl's custom character mod has a speed boost to her character very similar to WX's code.

 

WX78's code:

inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED*(1+runspeed_bonus)

Coffgirl's code for faster walking / running:

inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.5)inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.5)

So, changing this up for your character, I would change the 1.5 with a bigger number to be able to see the change immediately (to see if it works in game) then lower it until it feels right. Remember that the asterisk (*) means to multiply, so we don't need to change it too much for it to make a big effect. I'm not sure why there is a distinct difference between walk and run, so to be safe we'll use both.

 

The code I'll be using is this:

inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 3)inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 3)

Now, where do you plug this code in?

We'll be putting this in your character's prefab lua file. It should be located in dont_starve>mods>[Your character's name or esctemplate]>scripts>prefab>[Your character's name or esctemplate] lua file.

When you open this and scroll to the bottom, you'll see something like this (with your character's name, assuming you replaced all the names correctly):

local fn = function(inst)		-- choose which sounds this character will play	inst.soundsname = "willow"	-- Minimap icon	inst.MiniMapEntity:SetIcon( "esctemplate.tex" )		-- Stats		inst.components.health:SetMaxHealth(150)	inst.components.hunger:SetMax(150)	inst.components.sanity:SetMax(200)end

For the walkspeed, we can add that anywhere here. So I'll paste it right underneath the stats, like this:

local fn = function(inst)		-- choose which sounds this character will play	inst.soundsname = "willow"	-- Minimap icon	inst.MiniMapEntity:SetIcon( "esctemplate.tex" )		-- Stats		inst.components.health:SetMaxHealth(150)	inst.components.hunger:SetMax(150)	inst.components.sanity:SetMax(200)		inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 3)	inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 3)end

And it should work in game! Just remember that if you're using a DST character, the local fn = function(inst) changes to local master_postinit = function(inst). You would paste the code exactly the same though, so no worries there!

I should mention only copy the two lines of code, then paste it in your character's prefab, not the entire local fn=function(inst) paragraph, because it has "esctemplate.tex" in it, which should already be replaced by your character's name. You don't want it replacing back to the esctemplate because then the code might break.

 

I just pasted this code in Lure's mod and it worked, so it should work with your mod too.

I hope this helps! :grin:

Edited by Sabeku

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
×
  • Create New...