Jump to content

Recommended Posts

 

@TiagoAbreuReal

-- where inst is the hauntable itemlocal old_onhaunt = inst.components.hauntable.onhauntinst.components.hauntable:SetOnHauntFn(function(inst, doer)    -- Do something    return old_onhaunt(inst, doer)end)

 

This code inside:

 

local function fn()return instend

Please, look my code full:

 

local assets ={Asset("ANIM", "anim/r_shelter.zip"),Asset("SOUND", "sound/common.fsb"),}local function onhaunt(inst)        inst.AnimState:PlayAnimation("idle")inst.AnimState:PushAnimation("idle", true)inst.SoundEmitter:PlaySound("dontstarve/common/resurrectionstone_activate") end-- Classe que adiciona os atributos ao item e define sua caracteristicalocal function fn()    local inst = CreateEntity()    local trans = inst.entity:AddTransform()    local anim = inst.entity:AddAnimState()    local netw = inst.entity:AddNetwork()    MakeInventoryPhysics(inst)    inst.AnimState:SetBank("r_shelter")    inst.AnimState:SetBuild("r_shelter")    inst.AnimState:PlayAnimation("idle", true)inst:AddTag("structure") inst:AddTag("shelter")    if not TheWorld.ismastersim then        return inst    end          inst.entity:SetPristine()    -- Add o componente de inspecionar o item    inst:AddComponent("inspectable")    inst.components.inspectable:RecordViews()    -- / Add o componente de inspecionar o item    -- Add o item ao inventario    inst:AddComponent("inventoryitem")    inst.components.inventoryitem.imagename = "r_shelter"    inst.components.inventoryitem.atlasname = "images/inventoryimages/r_shelter.xml"    -- / Add o item ao inventario    -- Add o componente de assombrar o item    inst:AddComponent("hauntable")    inst.components.hauntable:SetHauntValue(TUNING.HAUNT_INSTANT_REZ)    -- / Add o componente de assombrar o item    return instendreturn Prefab( "common/r_shelter", fn, assets),MakePlacer( "common/r_shelter_placer", "r_shelter", "r_shelter", "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...