. . . Posted September 23, 2016 Share Posted September 23, 2016 (edited) Hello, I need help !!!!!! So, sometimes when my entity pickups/harvests item it goes braindead & nobody can help me with that... So, I was wondering is there a way I can force restart my entity's brain? I tried code like inst.sg:GoToState("idle") inst:ClearBufferedAction() inst.sg:ClearBufferedEvents() inst.brain:ForceUpdate() inst.brain:Stop() inst.brain:Start() but none of them do anything for when my entity is braindead... Can someone please tell me if there's any other code to make my entity forget any action it wanted to preform & just follow it's leader again ...? Edited September 29, 2016 by SuperDavid Please...help me... Link to comment https://forums.kleientertainment.com/forums/topic/70354-solved-how-to-make-entity-forget-action-it-wants-to-preform/ Share on other sites More sharing options...
. . . Posted September 24, 2016 Author Share Posted September 24, 2016 (edited) Somebody, Help me...!! Please...!! Edited September 24, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/70354-solved-how-to-make-entity-forget-action-it-wants-to-preform/#findComment-817685 Share on other sites More sharing options...
. . . Posted September 27, 2016 Author Share Posted September 27, 2016 (edited) Someone...!! Help...!! Please...!! Edited September 27, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/70354-solved-how-to-make-entity-forget-action-it-wants-to-preform/#findComment-818980 Share on other sites More sharing options...
. . . Posted September 29, 2016 Author Share Posted September 29, 2016 Can someone at least tell me how I can make my entity cancel these actions if it doesn't preform the action on it's target within 3 seconds or when it's leader wanders 6 dist away from it? I really would appreciate help because I definitely am not smart enough to do this on my own & I really don't want to remove these functions from my entity ... local function PickupAction(inst) local target = nil local action = nil if inst.sg:HasStateTag("busy") or inst.sg:HasStateTag("attack") or inst.sg:HasStateTag("working") or (inst.components.inventory and inst.components.inventory:IsFull()) then return end local pt = inst:GetPosition() local ents = TheSim:FindEntities(pt.x, pt.y, pt.z, SEE_ITEM_DIST, nil, NO_TAGS, inst.components.eater:GetEdibleTags()) if not target then for k,v in pairs(ents) do if v and v:IsOnValidGround() and inst.components.eater:CanEat(v) and v.components.inventoryitem and not v.components.inventoryitem:IsHeld() and TargetNotClaimed(inst, v) then target = v break end end end if target and not target:HasTag("fire") then local action = BufferedAction(inst,target,ACTIONS.PICKUP) return action end end local function HarvestAction(inst) -- Food On Ground > Pots = Farms = Drying Racks > Plants local target = nil if inst.sg:HasStateTag("busy") or inst.sg:HasStateTag("attack") or inst.sg:HasStateTag("working") or (inst.components.inventory and inst.components.inventory:IsFull()) then return end local pt = inst:GetPosition() local ents = TheSim:FindEntities(pt.x, pt.y, pt.z, SEE_STRUCTURE_DIST, nil, NO_TAGS) -- Look For Crop > Cook Pots > Drying Racks if not target then for k,item in pairs(ents) do if (item.components.stewer and item.components.stewer:IsDone()) or (item.components.dryer and item.components.dryer:IsDone()) or (item.components.crop and item.components.crop:IsReadyForHarvest()) then if TargetNotClaimed(inst, item) then target = item break end end end end if target and not target:HasTag("fire") then return BufferedAction(inst, target, ACTIONS.HARVEST) end -- Berry Bushes > Carrots if not target then for k,item in pairs(ents) do if item.components.pickable and item.components.pickable.caninteractwith and item.components.pickable:CanBePicked() and table.contains(PICKABLE_FOODS, item.components.pickable.product) and TargetNotClaimed(inst, item) then target = item break end end end if target and not target:HasTag("fire") then return BufferedAction(inst, target, ACTIONS.PICK) end end Link to comment https://forums.kleientertainment.com/forums/topic/70354-solved-how-to-make-entity-forget-action-it-wants-to-preform/#findComment-819923 Share on other sites More sharing options...
DarkXero Posted September 29, 2016 Share Posted September 29, 2016 Upload the whole brain lua file. Link to comment https://forums.kleientertainment.com/forums/topic/70354-solved-how-to-make-entity-forget-action-it-wants-to-preform/#findComment-819950 Share on other sites More sharing options...
. . . Posted September 29, 2016 Author Share Posted September 29, 2016 Here's the brain if you need the other files for the whole entity then tell me i'll post right away, and thanks so much !!!!!!!!!!!!!!!!!!!!!!! tieravilbrain.lua Link to comment https://forums.kleientertainment.com/forums/topic/70354-solved-how-to-make-entity-forget-action-it-wants-to-preform/#findComment-819963 Share on other sites More sharing options...
DarkXero Posted September 29, 2016 Share Posted September 29, 2016 Alright, try this one. tieravilbrain.lua Link to comment https://forums.kleientertainment.com/forums/topic/70354-solved-how-to-make-entity-forget-action-it-wants-to-preform/#findComment-819995 Share on other sites More sharing options...
. . . Posted September 29, 2016 Author Share Posted September 29, 2016 (edited) Okay, I think it works now, thank you so, so, so, so,so much DarkXero I could've never done this in a million years !!!!!! If the entity goes braindead again then i'll comback again but hopefully it's completely fixed for good now, thank you !!!!!! Edited September 29, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/70354-solved-how-to-make-entity-forget-action-it-wants-to-preform/#findComment-819996 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