Jump to content

How to create item for modded character


Recommended Posts

Depends on the item.. If it's a weapon, you can just look at an already made weapon's file, like tentacle spike or wigfrid's spear. Look into the file, and make a copy of it, change things to suit your needs. Then add the new item to the starting items for your character.

Link to comment
Share on other sites

6 minutes ago, demonio1337 said:

ok , what i didnt inderstand is where is the mod files? it just give assests,zip with png files, i need to create the rest? like modmain.lua and the anim folder with tex?

If you scroll to the bottom of that tutorial you'll find this link to a wand made by Cheerio:

Spriter Example: Equippable Item

That has all of the files and the folder structure you need.

Edited by beforeidecay96
Link to comment
Share on other sites

3 minutes ago, beforeidecay96 said:

It should have worked.

You put the wand folder in "C:\Program Files (x86)\Steam\SteamApps\common\Don't Starve Together Beta\mods", right?

now work , just forget to tipe the " in the debugspawn

Edited by demonio1337
Link to comment
Share on other sites

2 hours ago, demonio1337 said:

yep didtn work

Yeah, I just tested it and it isn't working for me either.

My twin sister is going to post in here in a little bit and give you her working weapon so you can use that. :3

EDIT: I figured out the problem with the wand. In the modinfo.lua it's api_version was set to "6". Just change that to "10" and it should spawn.

Edited by beforeidecay96
Link to comment
Share on other sites

2 minutes ago, beforeidecay96 said:

Yeah, I just tested it and it isn't working for me either.

My twin sister is going to post in here in a little bit and give you her working weapon so you can use that. :3

Now its working , so why have that tousand of assets on step 2 if is working? 

if i want to change the inventory image i will need to put that assets comand line?

Link to comment
Share on other sites

I believe you add this bit of code to the prefab:

inst:AddComponent("weapon")
inst.components.weapon:SetDamage(40)

You can change the number of damage to whatever number you want it to be, depending on how much damage you want it to do. Higher number does more damage.

Edited by beforeidecay96
Link to comment
Share on other sites

58 minutes ago, demonio1337 said:

now how i make the item appers for everyone in the server without upload in work shop?

i want to make the item spawn with my character

Okay, you're going to move files from the weapon folder you just worked with to your character folder.

STEP 1

First, let's start by moving the animation rar files. Go into your weapon's "anim" folder and copy the two rars from there then paste them in your characters "anim" folder.

dstweapontut1.thumb.png.1c5b3fdbc2905b61

STEP 2

Move the inventory image over into images>inventoryimages.

STEP 3

Next go to scripts>prefabs and then put your weapons prefab in there.

STEP 4

Open your character's modmain.lua and then add your weapons prefab name at the top under your character's prefab name.

NOTE: My character's name is "Nishiki" and my weapon is called "kunai", but you need to put yours whatever you named your character and weapon.

dstweapontut2.thumb.png.b1c5459b3d2ffb2c

STEP 5

We're going to add another thing in your character's modmain.lua. Find the part that says "the character select screen lines".

It should look like this:

-- The character select screen lines
STRINGS.CHARACTER_TITLES.nishiki = "The Unfledged"
STRINGS.CHARACTER_NAMES.nishiki = "Nishiki"
STRINGS.CHARACTER_DESCRIPTIONS.nishiki = "*Is a ninja"
STRINGS.CHARACTER_QUOTES.nishiki = "\"I have neither a place to go nor a purpose for my existence.\""

And add this code below all of that code, so that it looks like this now:

-- The character select screen lines
STRINGS.CHARACTER_TITLES.nishiki = "The Unfledged"
STRINGS.CHARACTER_NAMES.nishiki = "Nishiki"
STRINGS.CHARACTER_DESCRIPTIONS.nishiki = "*Is a ninja"
STRINGS.CHARACTER_QUOTES.nishiki = "\"I have neither a place to go nor a purpose for my existence.\""

GLOBAL.STRINGS.NAMES.KUNAI = "Kunai."
GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.KUNAI = "A weapon used by ninja."

STEP 6

In your character's prefab file you need to add this code (with your weapon prefab name instead of kunai):

local start_inv = {
	"kunai"

It should be underneath your local assets and look like this:

local prefabs = {}
local start_inv = {
	"kunai"
}

---------------------------------

That should be it, but if it doesn't work, let me know what error you got.

Edited by beforeidecay96
  • Like 1
Link to comment
Share on other sites

6 minutes ago, demonio1337 said:

inst:AddComponent("weapon")
inst.components.weapon:SetDamage(40)

thanks , work but when i put this codes the game crash

Here, just use my lua for my kunai and rename everything that says kunai to whatever you named your weapon.

kunai.lua

If you're using Notepad++ you can use ctrl+f to find and rename it all. It makes things way easier.

Edited by beforeidecay96
Link to comment
Share on other sites

32 minutes ago, demonio1337 said:

thank , now i just need all lines of speaks and perks lines , where i get it?

Alright, in your characters folder go into scripts and there should be a file there that is called "speech_yourcharactername". That file holds all of the speech for your character. Change the lines how you see fit.

 

Now for your perks - it's in your modmain.lua, I mentioned it earlier, the "character select screen lines"

It looks like this:

-- The character select screen lines
STRINGS.CHARACTER_TITLES.nishiki = "The Unfledged"
STRINGS.CHARACTER_NAMES.nishiki = "Nishiki"
STRINGS.CHARACTER_DESCRIPTIONS.nishiki = "*Is a ninja"
STRINGS.CHARACTER_QUOTES.nishiki = "\"I have neither a place to go nor a purpose for my existence.\""

You just edit the third strings line. This one:

STRINGS.CHARACTER_DESCRIPTIONS.nishiki = "*Is a ninja"

Mine only has one perk, but if you want multiple perks you have to do it like this:

STRINGS.CHARACTER_DESCRIPTIONS.nishiki = "*Is a ninja\n*Another perk here"

Make sure you put the \n* part, and also make sure you have the * at the start of the first perk.

 

I hope I wrote everything you needed to know down and you can understand it all. Good luck! ^-^

EDIT: Oh, and for the perks, what I showed you is just text that  shows up on the character select screen. If you want a perk that changes your characters abilities or something (like being immune to the cold for example) you have to add some code to your prefab for that.

Edited by beforeidecay96
  • Health 1
Link to comment
Share on other sites

7 minutes ago, demonio1337 said:

yep its the perks abilities, dont have like an line with all abilities perks?

No. You'll have to look around in the games files. Is there a thing in the game already that does something similar to what you want? I need to know what it is that you want your character to be able to do.

Edited by beforeidecay96
Link to comment
Share on other sites

1 hour ago, demonio1337 said:

lose sanity in rain , glow in the dark and only eats vegetables

I looked into Wigfrid's prefab (which is called wathgrithr.lua) and found the code that allows her to eat meat and nothing but meat then tweaked it to what you wanted.

Add this bit into your characters prefab down at the bottom in "local master_postinit = function(inst)" below your characters speed settings and stuff:

inst.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODTYPE.VEGGIE })

That should make it to where your character only eats veggies.

 

As for the other two perks you want, I'm still looking into those.

 

EDIT: Alright, I found out how to make your character glow in the dark.

Paste this in the same place I had you put the "only eats veggies" code:

inst.entity:AddLight() --light is not a component
inst.Light:Enable(true)
inst.Light:SetIntensity(0.55)
inst.Light:SetRadius(0.45)
inst.Light:SetFalloff(0.5)
inst.Light:SetColour(255/255,255/255, 150/255)

Your character should glow now. You can change some of those settings if you don't like how it glows.

EDIT 2: I couldn't figure out how to get the sanity drain while in rain. Perhaps someone with more experience coding can help you with that. Sorry. ^^;

Edited by beforeidecay96
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...