Fancy_Fox_Pers Posted February 9, 2017 Share Posted February 9, 2017 (edited) I use this to make a creature destroy trees and boulders on its path. But when it destroys trees it only yields one log, no matter which tree gets destroyed. My guess is that it is not dropping any loot for the tree at all but rather only the stump. How to fix this? Spoiler local function OnDestroyOther(inst, other) if other:IsValid() and other.components.workable ~= nil and other.components.workable:CanBeWorked() and other.components.workable.action ~= ACTIONS.NET and not (other:HasTag("wall")) then SpawnPrefab("collapse_small").Transform:SetPosition(other.Transform:GetWorldPosition()) if other.components.lootdropper ~= nil and (other:HasTag("tree") or other:HasTag("boulder")) then other.components.lootdropper:SetLoot({}) end other.components.workable:Destroy(inst) end end local function OnCollide(inst, other) if other ~= nil and other:IsValid() and other.components.workable ~= nil and other.components.workable:CanBeWorked() and other.components.workable.action ~= ACTIONS.NET and Vector3(inst.Physics:GetVelocity()):LengthSq() >= 1 then inst:DoTaskInTime(2 * FRAMES, OnDestroyOther, other) end end local function WorkEntities(inst) local pt = inst:GetPosition() local ents = TheSim:FindEntities(pt.x, pt.y, pt.z, 5, nil, { "insect", "INLIMBO" }) local heading_angle = inst.Transform:GetRotation() local dir = Vector3(math.cos(heading_angle * DEGREES), 0, -math.sin(heading_angle * DEGREES)) for i, v in ipairs(ents) do if v:IsValid() and v.components.workable ~= nil then local offset = (v:GetPosition() - pt):GetNormalized() if offset:Dot(dir) > .3 then v.components.workable:Destroy(inst) end end end end Sorry for posting so much by the way. Maybe these threads can help others as well though. Edit: FYI, destroying boulders always yields the right loot, according to the boulder type Edited February 9, 2017 by Thibooms Link to comment https://forums.kleientertainment.com/forums/topic/73930-how-to-drop-all-the-loot-of-a-tree/ Share on other sites More sharing options...
Lumina Posted February 9, 2017 Share Posted February 9, 2017 Search how the bearger/deerclop are doing their destroying functions ? Or meteors ? Link to comment https://forums.kleientertainment.com/forums/topic/73930-how-to-drop-all-the-loot-of-a-tree/#findComment-865202 Share on other sites More sharing options...
Fancy_Fox_Pers Posted February 9, 2017 Author Share Posted February 9, 2017 (edited) 1 hour ago, Lumina said: Search how the bearger/deerclop are doing their destroying functions ? Or meteors ? This is the bearger. The bearger actually has it worse. He doesn't drop the loot from trees at all and doesn't destroy the stump for some reason. Trees do drop loot when he mowes them down with attacks though Update: got it. Just use the deerclops files; he does lootdrop correctly Edited February 9, 2017 by Thibooms Link to comment https://forums.kleientertainment.com/forums/topic/73930-how-to-drop-all-the-loot-of-a-tree/#findComment-865204 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