Jump to content

Recommended Posts

Items that work perfectly in non-underground worlds won't spawn even with console commands once underground is activated on a server. I have no idea where my error could be, seeing that an item with a near-identical prefab code works perfectly fine. please help?

____________________________________________________________________________________

local assets=

    Asset("ANIM", "anim/wmw.zip"),
    Asset("ANIM", "anim/swap_wmw.zip"), 

    Asset("ATLAS", "images/inventoryimages/wmw.xml"),
    Asset("IMAGE", "images/inventoryimages/wmw.tex"),
}

    local function OnEquip(inst, owner) 
        --owner.AnimState:OverrideSymbol("swap_object", "swap_wands", "purplestaff")
        owner.AnimState:OverrideSymbol("swap_object", "swap_wmw", "wand")
        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 fn()
    local inst = CreateEntity()
    local trans = inst.entity:AddTransform()
    local anim = inst.entity:AddAnimState()
    MakeInventoryPhysics(inst)
    
    anim:SetBank("wmw")
    anim:SetBuild("wmw")
    anim:PlayAnimation("idle")


    if not TheWorld.ismastersim then
        return inst
    end
    inst.entity:SetPristine()
    
    inst:AddTag("sharp")

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(30)
    inst.components.weapon:SetRange(1, 1)
    
     inst:AddComponent("inspectable")
    
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.imagename = "wmw"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/wmw.xml"
    
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( OnEquip )
    inst.components.equippable:SetOnUnequip( OnUnequip )
    inst.components.equippable.walkspeedmult = (1.2)
    
    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(100)
    inst.components.finiteuses:SetUses(100)
    inst.components.finiteuses:SetOnFinished(inst.Remove)

    return inst
end

return  Prefab("common/inventory/wmw", fn, assets, prefabs)

woscar.zip

Just had to change:

local function fn()
    local inst = CreateEntity()
    local trans = inst.entity:AddTransform()
    local anim = inst.entity:AddAnimState()
    MakeInventoryPhysics(inst)
    
    anim:SetBank("wmw")
    anim:SetBuild("wmw")
    anim:PlayAnimation("idle")

To:

local function fn()
    local inst = CreateEntity()
    
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("wmw")
    inst.AnimState:SetBuild("wmw")
    inst.AnimState:PlayAnimation("idle")

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
×
  • Create New...