LuciAmitoLom Posted December 10, 2024 Share Posted December 10, 2024 Hello everyone, I have created two structures “Glenda” and “Scatola1”. The mod works: I can craft and place both structures correctly. How can I make it possible to destroy the structures with a hammer? I tried looking in the dst files but all my attempts were failing because the character couldn't hit the structures with the hammer.... How can I make it possible to build “Scatola1” only within a certain distance from “Glenda”? For example, here Glenda's prefab. Quote require "prefabutil" require "recipe" require "modutil" local assets = { Asset("ANIM", "anim/glenda.zip"), Asset("ATLAS", "images/inventoryimages/glenda.xml"), Asset("IMAGE", "images/inventoryimages/glenda.tex"), } local prefabs = { "collapse_small", } local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddMiniMapEntity() inst.entity:AddNetwork() MakeObstaclePhysics(inst, 0.66) inst:AddTag("structure") local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon("glenda.tex") inst.AnimState:SetBank("glenda") inst.AnimState:SetBuild("glenda") inst.AnimState:PlayAnimation("idle") if not TheWorld.ismastersim then return inst end STRINGS.CHARACTERS.GENERIC.DESCRIBE.glenda = "Il mercato di Glenda!" inst:AddComponent("lootdropper") inst:AddComponent("inspectable") inst:AddComponent("workable") return inst end local function onhammered(inst) local fx = SpawnPrefab("collapse_small") fx.Transform:SetPosition(inst.Transform:GetWorldPosition()) fx:SetMaterial("wood") inst.components.lootdropper:DropLoot() inst:Remove() end return Prefab("glenda", fn, assets), MakePlacer("glenda_placer", "glenda", "glenda", "idle") Regards Link to comment https://forums.kleientertainment.com/forums/topic/162200-hammerable-structures-and-build-distance-limit/ 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