DrownedCancer

  • Content Count

    17
  • Joined

  • Last visited

Community Reputation

18 Good

About DrownedCancer

  • Rank
    Junior Member
...

Recent Profile Visitors

285 profile views
  1. 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)
  2. 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)