Jump to content

Help with custom item required... and asked for.


Recommended Posts

Hello everyone.

It's me again. I have asked for help with my character and I have recieved it for what I am very grateful. Now there is the hardest part on which I need proper explanation step by step.

I want to give my character an item. It's his (her) personal item like Lucy is for Woodie. It's a lantern. It's name is Luna. It doesn't need to get fueled and it works non-stop. 

I have done graphics for this lantern according to template ripped directly from the game files itself.

 

kf03si.png

 

I think I know where to find the code for the original ingame lantern but I have no clue what to do with it.

That's the first time in my life I am adding an item to the character - basically creating two mods in one. If you find people like me - asking and begging for help - annoying, then I can promise to you that if I will know how to do it, I won't ask for help on this particular mather again.  

 

So, once again. I need to add this lantern to starting items in my character. I have done the character already, but didn't even touch the lantern script as I have no clue how to do it. I'd like to ask you to explain to me what files to create, what and where shall I copy stuff from the original game, what to change in the code so it lasts without fuel. The rest - color of light etc can stay the way it is. 

 

Thanks for your help in advance. I hope this community will keep amazing me with it's honesty and warm welcoming, as one day I might be the one sorting somebody else's code out and helping people.

 

And once again, I hope for a quick answer.

Farewell lads.

Oscar.

Link to comment
Share on other sites

@CarbonLord, where exactly are you having issues? Choose one of the following:

 

I'm stuck with creating the animation files.

I'm stuck with creating the prefab file for the lantern.

I'm stuck making the item show up in game.

 

Without knowing exactly what you've done other than creating the actual graphics for the item we don't know where to start to help you. 

Link to comment
Share on other sites

That's exactly the point, I have created the graphics and I don't know what to do next. If you could just point a direction then I will follow it.

 

 

 

EDIT: In case you think I am some lazy fat ****, I am not. I just hoped that if this item is already in the game (lantern), then there is no problem in creating just an other variation of it.

Edited by CarbonLord
Link to comment
Share on other sites

Okay, the first problem I've faced is the fact that my item is not showing up in my hand. I can see it in my inventory and on the ground, but not when I am holding it. Second thing is how do I add the lantern functions to it - the light, the mechanics, how do I remove the durability/fuel?

Pasting a code: 

local assets={    Asset("ANIM", "anim/myitem.zip"),    Asset("ANIM", "anim/swap_myitem.zip"),     Asset("ATLAS", "images/inventoryimages/myitem.xml"),    Asset("IMAGE", "images/inventoryimages/myitem.tex"),}local prefabs = {}local function fn()     local function OnEquip(inst, owner)        --owner.AnimState:OverrideSymbol("swap_object", "swap_myitem", "swap_myitem")        owner.AnimState:Show("ARM_carry")        owner.AnimState:Hide("ARM_normal")    end     local function OnUnequip(inst, owner)        owner.AnimState:Hide("ARM_carry")        owner.AnimState:Show("ARM_normal")    end     local inst = CreateEntity()    local trans = inst.entity:AddTransform()    local anim = inst.entity:AddAnimState()    local sound = inst.entity:AddSoundEmitter()    MakeInventoryPhysics(inst)         anim:SetBank("myitem")    anim:SetBuild("myitem")    anim:PlayAnimation("idle")     inst:AddComponent("inspectable")         inst:AddComponent("inventoryitem")    inst.components.inventoryitem.imagename = "myitem"    inst.components.inventoryitem.atlasname = "images/inventoryimages/myitem.xml"         inst:AddComponent("equippable")    inst.components.equippable:SetOnEquip( OnEquip )    inst.components.equippable:SetOnUnequip( OnUnequip )     return instendreturn  Prefab("common/inventory/myitem", fn, assets, prefabs)

No idea why I can't see it in my hands. Do you have any idea?

Link to comment
Share on other sites

@CarbonLord, Okay so with the animation make sure you check out this link: http://forums.kleientertainment.com/files/file/1127-dst-equipable-hand-slot/

 

If you look at the images with the tutorial you will see some of what you need to do in Spriter. Play with this tutorial and your image, eventually you will figure out how to make it show up in your hand. Usually it's a Bank and/or Build  not being set properly in the actual prefab file.

 

As far as adding the light effect, you would copy/paste the code from the lantern into your prefab where it was in the original prefab. To remove durability you wouldn't add the "fueled" component. Anywhere you see the components.fueled being called you would need to determine what it's being called for and adjust the code to do what you want it to do.

Link to comment
Share on other sites

did it, still not working. Any other ideas? could it be connected to the fact that I moved the pivot point into some other place? (top of the lamp to make it feel like it's heavy)

 

 

@CarbonLord, Okay so with the animation make sure you check out this link: http://forums.kleientertainment.com/files/file/1127-dst-equipable-hand-slot/

 

If you look at the images with the tutorial you will see some of what you need to do in Spriter. Play with this tutorial and your image, eventually you will figure out how to make it show up in your hand. Usually it's a Bank and/or Build  not being set properly in the actual prefab file.

Link to comment
Share on other sites

I've done all I could with this tutorial but it keeps crashing the game now. Apparently this tutorial is not for Don't Starve Together. Any idea what I could do now? I've previously managed to get an item ingame, the icon in the inventory and the animation on the ground was visible, but when I held it in my hand it didn't appear with my character. 

 

As stated, I did everything by the book. What's happening, I wonder.

Link to comment
Share on other sites

@CarbonLord, I'm the one that made the tutorial which I directed you to, it indeed does work for DST as I only mod for DST. It has the updated information in the prefab file as well as information in the tutorial images folder which gives you a slight understanding of what needs to be done which isn't really explained in the original tutorial which you linked. 

 

As stated before the most common culprit for why the item doesn't show up is the animation BANK and animation BUILD are not properly set when equipping the item and/or in the main function for the item. The BANK is the animation entity name in Spriter, the Build is the Spriter project name and the Symbol is the folder in which the image is contained within the Spriter Project. If an image is not in a folder it has no symbol name as far as I'm aware. Make sure all 3 of them match and it should start working properly.

owner.AnimState:OverrideSymbol("swap_object", -- Symbol to override "swap_myitem", -- BANK to use. "swap_myitem" -- SYMBOL to override it with.)

Relevant images:

 

Animation BANK:

XduLdOt.png

 

Symbol NAME:

m5YCbWw.png

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