FluffytheDreame Posted July 2, 2024 Share Posted July 2, 2024 I've been trying to make a container mod for a little bit. I'm usually able to mess around and after some time figure it out and build off what I managed to find and learn, but the containers scripts are giving me a real run for my money, now I will admit that I am only a few days into modding for don't starve together I've looked at some scripts that I thought may help Pearl's tacklebox being fairly accurate to what I want the container to act like, Spoiler require "prefabutil" local assets = { Asset("ANIM", "anim/ui_alterguardianhat_1x1.zip"), Asset("INV_IMAGE", "alterguardianhatshard"), Asset("INV_IMAGE", "alterguardianhatshard_open"), Asset("ANIM", "anim/rocks.zip") } local function onequip(inst, owner) 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 function onopen(inst) if inst:HasTag("burnt") then return end end local function onclose(inst) if inst:HasTag("burnt") then return end end local function CreateBriefcase() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("rocks") inst.AnimState:SetBuild("rocks") inst.AnimState:PlayAnimation("f1") MakeInventoryFloatable(inst, "med", nil, 0.6) inst:AddTag("weapon") inst:AddTag("portablestorage") inst:AddComponent("weapon") inst.components.weapon:SetDamage(30) inst.components.weapon:SetRange(0, 1) inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("equippable") inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) inst:AddComponent("inventoryitem") --inventory icon management --[[ inst.components.inventoryitem:SetOnPutInInventoryFn(OnPutInInventory) inst.components.inventoryitem:SetOnDroppedFn(OnDropped) inst.components.inventoryitem:SetOnPickupFn(OnPickup) --]] --container function and controller inst:AddComponent("container") inst.components.container:WidgetSetup("briefcase") inst.components.container.onopenfn = onopen inst.components.container.onclosefn = onclose inst.components.container.skipclosesnd = true inst.components.container.skipopensnd = true inst.components.container.droponopen = true --]] -- a list of AddComponents if you want to see something that has a few components honestly Gears has a fair few, check there for a bunch of examples inst:AddComponent("inspectable") --can be inspected by the cast MakeHauntableLaunch(inst) return inst end -- shows the prefab name, in this case it is Sleept tea, DO NOT CAPITALIZE return Prefab("briefcase", CreateBriefcase, assets) I am unsure as to the finer workings and don't QUITE understand how to read the crash messages here is the crash message I am receiving https://gyazo.com/4c790466beb465112bfa65f76056e24d any help is appreciated As I have been caught on this snag for a fair bit now, with no seeming answer in sight Link to comment https://forums.kleientertainment.com/forums/topic/157840-any-help-with-containers/ Share on other sites More sharing options...
FluffytheDreame Posted July 2, 2024 Author Share Posted July 2, 2024 wow this post formatted horribly I apologies in advance! Link to comment https://forums.kleientertainment.com/forums/topic/157840-any-help-with-containers/#findComment-1731684 Share on other sites More sharing options...
alainmcd Posted July 6, 2024 Share Posted July 6, 2024 Welcome to the forums! The error message references two workshop mods (Smarter Crock Pot & Item Info). That does not always mean that the mods are to blame, though in this case, the comments on the Smarter Crock Pot mod page do say it causes crashes. Regardless, you should try to avoid using other mods while developing your own, especially if there's an overlap, as it will make debugging harder. Happy modding! Link to comment https://forums.kleientertainment.com/forums/topic/157840-any-help-with-containers/#findComment-1732977 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now