DrownedCancer Posted September 3, 2016 Share Posted September 3, 2016 Hiya guys, I'm new to this whole new modding thing for "Don't Starve Together" and I have a problem with items. I created an item for a mod I'm working on and whenever i drop the item I cant pick it back up. Like the item shows on the ground but it won't highlight for me to pick up. If anyone has a way of fixing this that would be amazing! Here is how the code looks like for the prefab. :3 local assets = { Asset("ANIM", "anim/racket.zip"), Asset("ANIM", "anim/swap_racket.zip"), } local prefabs = { "impact", } local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_racket", "racket") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") local ammo = owner.components.inventory:FindItem(function(item) return item.prefab=="ball" end) if ammo ~= nil then inst.components.weapon:SetDamage(80) inst.components.weapon:SetRange(8, 10) inst.components.weapon:SetProjectile("ball") end if ammo == nil then inst.components.weapon:SetProjectile(nil) inst.components.weapon:SetRange(0,0) inst.components.weapon:SetDamage(30) end end local function onunequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") end local function onattack(inst, attacker, target) local ammo = attacker.components.inventory:FindItem(function(item) return item.prefab=="ball" end) if ammo ~= nil then ammo.components.stackable:Get(1):Remove() end ammo = attacker.components.inventory:FindItem(function(item) return item.prefab=="ball" end) if ammo == nil then inst.components.weapon:SetProjectile(nil) inst.components.weapon:SetRange(0,0) inst.components.weapon:SetDamage(20) end end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("racket") inst.AnimState:SetBuild("racket") inst.AnimState:PlayAnimation("idle") if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/racket.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) inst:AddComponent("finiteuses") inst.components.finiteuses:SetMaxUses(TUNING.SPEAR_USES) inst.components.finiteuses:SetUses(TUNING.SPEAR_USES) inst.components.finiteuses:SetOnFinished(inst.Remove) inst:AddComponent("weapon") inst.components.weapon:SetDamage(30) inst.components.weapon:SetRange(0, 0) inst.components.weapon:SetProjectile(nil) inst.components.weapon:SetOnAttack(onattack) return inst end STRINGS.NAMES.RACKET = "Waluigi's Racket" STRINGS.RECIPE_DESC.RACKET = "Waluigi's signature racket!" return Prefab( "common/inventory/racket", fn, assets) Link to comment https://forums.kleientertainment.com/forums/topic/69965-item-modding-cant-pick-up-item-after-dropped/ Share on other sites More sharing options...
Neu7ral Posted September 4, 2016 Share Posted September 4, 2016 (edited) Edit: No, it wasn't what I was thinking, that happened to me too, you have the exported racket file? Edited September 4, 2016 by Neutral_Steve Link to comment https://forums.kleientertainment.com/forums/topic/69965-item-modding-cant-pick-up-item-after-dropped/#findComment-810325 Share on other sites More sharing options...
DrownedCancer Posted September 4, 2016 Author Share Posted September 4, 2016 I gave it a shot and it didn't work. I compared the coding between these 2 that are on the character atm but for some reason I can't pick up the racket but I can pick up the ball. local assets = { Asset("ANIM", "anim/ball.zip"), } local function onthrown(inst, data) inst.AnimState:SetOrientation(ANIM_ORIENTATION.OnGround) end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) RemovePhysicsColliders(inst) inst.AnimState:SetBank("ball") inst.AnimState:SetBuild("ball") inst.AnimState:PlayAnimation("idle") if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/ball.xml" inst:AddComponent("stackable") inst:AddComponent("projectile") inst.components.projectile:SetSpeed(30) inst.components.projectile:SetOnHitFn(inst.Remove) inst.components.projectile:SetOnMissFn(inst.Remove) inst.components.projectile:SetOnThrownFn(onthrown) return inst end STRINGS.NAMES.BALL = "Tennis Ball" STRINGS.RECIPE_DESC.BALL = "Congratz its a ball." return Prefab( "common/inventory/ball", fn, assets) Link to comment https://forums.kleientertainment.com/forums/topic/69965-item-modding-cant-pick-up-item-after-dropped/#findComment-810329 Share on other sites More sharing options...
Neu7ral Posted September 4, 2016 Share Posted September 4, 2016 Yeah yeah, I was wrong, may I can check your exported racket file? not the swap one. Link to comment https://forums.kleientertainment.com/forums/topic/69965-item-modding-cant-pick-up-item-after-dropped/#findComment-810331 Share on other sites More sharing options...
DrownedCancer Posted September 4, 2016 Author Share Posted September 4, 2016 Sure thing racket.scml racket.zip Link to comment https://forums.kleientertainment.com/forums/topic/69965-item-modding-cant-pick-up-item-after-dropped/#findComment-810336 Share on other sites More sharing options...
Neu7ral Posted September 4, 2016 Share Posted September 4, 2016 (edited) Thanks :3 I think I got it. Replace your old racket file with this one. racket.zip Also you wasn't able to pick it because you moved the default pivot. By the way. Nice Waluigi mod, he's my favorite. Edited September 4, 2016 by Neutral_Steve Link to comment https://forums.kleientertainment.com/forums/topic/69965-item-modding-cant-pick-up-item-after-dropped/#findComment-810337 Share on other sites More sharing options...
DrownedCancer Posted September 4, 2016 Author Share Posted September 4, 2016 Wow! It worked! Thanks a bunch for this. It means alot :3 Link to comment https://forums.kleientertainment.com/forums/topic/69965-item-modding-cant-pick-up-item-after-dropped/#findComment-810339 Share on other sites More sharing options...
jeff9898989 Posted September 22, 2020 Share Posted September 22, 2020 On 9/3/2016 at 10:29 PM, Neu7ral said: default pivot where should change default setting ? Link to comment https://forums.kleientertainment.com/forums/topic/69965-item-modding-cant-pick-up-item-after-dropped/#findComment-1373404 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