Jump to content

Adding a New Container


Recommended Posts

I was trying to experiment with modding on DST and I thought why not try to make a simple recolored chest for practice, After about 6 errors, I got an error that I can't seem to fix.

The log.txt give the following error:

..\source\animlib\animmanager.cpp(429) :: Tried to add build [treasure_chest] from file [../mods/mymod/anim/newchest.zip] but we've already added a build with that name!

My thought is that because of copying the build.bin and anim.bin from: Don't Starve Together Beta/data/anim/treasure_chest.zip.

 

I'm not sure how to open or edit the .bin files or if the problem is even them. I tried opening them the ktools krane, but it just made the atlas-01.png which really didn't help, probably did something wrong.

 

The mod is now working fine except for 1 thing, my chest has a hitbox of 9 chests together(3x3) as if it was a big chest.

 

Any help would be appreciated. 

(Code can be found in a post below)

Edited by Aquaterion
Link to comment
Share on other sites

Inside build.bin there is a treasure_chest id, that you need to change.

 

http://forums.kleientertainment.com/topic/27247-new-asset-tools-animations-textures-sounds-and-layouts/

 

Try using Spriter.

 

 

Hey, thanks for the Reply and confirming where the problem was. I installed spriter but I'm not sure how good I am at using it. I tried putting my newchest.png at x=0 y=0 and saving it as .scml like the post says, but it says you need some sort of Mod tools installed which I can't find where to get.

Link to comment
Share on other sites

(Sorry for double post, Can't seem to find the edit button)

Is there a way to rename this "id" with krane? In the read-me it had this

"--rename-build <build name>

Renames the input build to the given name."

 

If that is usable and I could know what exactly to write to do it, that would be perfect. Thanks.

 

Edit: The Edit button finally appeared!

 

Edit2: I Downloaded the Tools thing, Thanks. At least now I know how to upload the mod once I get it to work since I still don't have a clue on how to use Spriter.

Edited by Aquaterion
Link to comment
Share on other sites

Ok So I managed to use krane to get the .scml and I also put the .png in my mods/mymod/anim folder together with the .scml like the tutorial said but when it starts compiling it only compiles the singleplayer mod "screeher" which I didn't download.(I know it's a KLEI made mod)

Link to comment
Share on other sites

Ok So instead I used Matt's Build Renamer and fixed the build.bin problem, but now the anim.bin has the same problem. Is there any renamer program for that?

 

What do you mean by anim.bin has the same problem? Did you copy the anim.bin from the treasurechest.zip or did you create your own?

 

Ok so the anim.bin shouldn't change unless your editing the animation of said item..

Edited by Crazybait24
Link to comment
Share on other sites

What do you mean by anim.bin has the same problem? Did you copy the anim.bin from the treasurechest.zip or did you create your own?

 

Ok so the anim.bin shouldn't change unless your editing the animation of said item..

Yea I just figured it out like 5 minutes ago from a thread on about making a new axe and using the same axe anim.bin.

 

Thanks.

 

The Mod is working find but when I craft it to place it, it has a huge hitbox that makes it have to be around 2 chests away from other items to be able to be placed, how can i change that?

Link to comment
Share on other sites

require "prefabutil"local assets={	Asset("ANIM", "anim/ui_chest_3x3.zip"),	Asset("ANIM", "anim/foodchest.zip"),	}local function onopen(inst)     inst.AnimState:PlayAnimation("open")	 	inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_open")end local function onclose(inst) 	inst.AnimState:PlayAnimation("closed")	inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_close")end local function onhammered(inst, worker)	inst.components.lootdropper:DropLoot()	inst.components.container:DropEverything()	SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())	inst.SoundEmitter:PlaySound("dontstarve/common/destroy_wood")		inst:Remove()endlocal function onhit(inst, worker)	inst.AnimState:PlayAnimation("hit")	inst.components.container:DropEverything()	inst.AnimState:PushAnimation("closed", false)	inst.components.container:Close()		endlocal function onbuilt(inst)	inst.AnimState:PlayAnimation("place")	inst.AnimState:PushAnimation("closed", false)	endlocal function chest(style)	return function()		local inst = CreateEntity()		inst.entity:AddTransform()		inst.entity:AddAnimState()		inst.entity:AddSoundEmitter()		inst.entity:AddMiniMapEntity()                inst.entity:AddNetwork()        inst.MiniMapEntity:SetIcon(style..".png")        inst:AddTag("structure")        inst.AnimState:SetBank("chest")        inst.AnimState:SetBuild("foodchest")        inst.AnimState:PlayAnimation("closed")        MakeSnowCoveredPristine(inst)        if not TheWorld.ismastersim then            return inst        end        inst.entity:SetPristine()		inst:AddComponent("inspectable")		inst:AddComponent("container")        inst.components.container:WidgetSetup("treasurechest")		inst.components.container.onopenfn = onopen		inst.components.container.onclosefn = onclose		inst:AddComponent("lootdropper")		inst:AddComponent("workable")		inst.components.workable:SetWorkAction(ACTIONS.HAMMER)		inst.components.workable:SetWorkLeft(2)		inst.components.workable:SetOnFinishCallback(onhammered)		inst.components.workable:SetOnWorkCallback(onhit) 		inst:AddComponent("hauntable")		inst.components.hauntable.cooldown = TUNING.HAUNT_COOLDOWN_SMALL		inst.components.hauntable:SetOnHauntFn(function(inst, haunter)			local ret = false	        if math.random() <= TUNING.HAUNT_CHANCE_OCCASIONAL then	            if inst.components.container then	                local item = inst.components.container:FindItem(function(item) return not item:HasTag("nosteal") end)	                if item then	                    inst.components.container:DropItem(item)	                    inst.components.hauntable.hauntvalue = TUNING.HAUNT_MEDIUM	                    ret = true	                end	            end	        end	        if math.random() <= TUNING.HAUNT_CHANCE_VERYRARE then	        	if inst.components.workable then	                inst.components.workable:WorkedBy(haunter, 1)	                inst.components.hauntable.hauntvalue = TUNING.HAUNT_MEDIUM	                ret = true	            end	        end	        return ret		end)		inst:ListenForEvent("onbuilt", onbuilt)		MakeSnowCovered(inst)			return inst	endendreturn Prefab( "common/foodchest", chest("foodchest"), assets),		MakePlacer("common/foodchest_placer", "chest", "foodchest", "closed")

I'm guessing it's something to do with placer, because if I make a normal chest, I can put it very close to the new chest.

Link to comment
Share on other sites

You have to use "common/treasurechest_placer" instead of "common/foodchest_placer".

 

I tried that yesterday. I have about 8 chests made all in 1 lua, so when i did that, the placer took the texture of the last chest I made a placer for, so when ever I go craft a chest, even the default one, it would use the texture of chest8, and it still had the same hitbox, not sure how..

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