Error_iD10t Posted February 17, 2025 Share Posted February 17, 2025 As the title says I've been trying to figure how this could be achievable--at least with the limited amount of knowledge I have with Lua since this is my first modding project. I've been mainly learning programming off of the simple crash courses and reading the game scripts themselves. I know in Wormwood's skill tree his Bee Kind skill does the exact thing that I'm looking for, however I don't see it anywhere when I look in the files so I'm kind of clueless. Would really appreciate the help! Link to comment https://forums.kleientertainment.com/forums/topic/164180-help-wanted-want-to-make-it-so-butterflies-dont-run-away-from-the-player/ Share on other sites More sharing options...
Baguettes Posted February 17, 2025 Share Posted February 17, 2025 Apparently Wormwood's checks will only see if his skill is activated and prevents butterflies from flying away from him, no tags involved.. This is stored inside a butterfly's brain file, so that's a bit beyond my knowledge. I do not really see any possible solutions to this myself. Hopefully others can help, though. 2 Link to comment https://forums.kleientertainment.com/forums/topic/164180-help-wanted-want-to-make-it-so-butterflies-dont-run-away-from-the-player/#findComment-1798518 Share on other sites More sharing options...
yanecc Posted February 17, 2025 Share Posted February 17, 2025 AddGlobalClassPostConstruct("behaviours/runaway", "RunAway", function(self) local _shouldrunfn = self.shouldrunfn or function() return true end function self.shouldrunfn(hunter, inst) if inst.prefab == "butterfly" and hunter:HasTag("player") then return false else return _shouldrunfn(hunter, inst) end end end) 3 Link to comment https://forums.kleientertainment.com/forums/topic/164180-help-wanted-want-to-make-it-so-butterflies-dont-run-away-from-the-player/#findComment-1798689 Share on other sites More sharing options...
oregu Posted February 17, 2025 Share Posted February 17, 2025 (edited) AddBrainPostInit("butterflybrain", function(brain) --print(brain) if u need to debug local runaway for i,node in ipairs(brain.bt.root.children) do if node.name == "RunAway" then runaway = node break end end if not runaway then print("[butterflybrain] Couldn't find the 'RunAway' behaviour in this brain!") return else runaway.hunternotags = runaway.hunternotags or {} table.insert(runaway.hunternotags, "butterflywhisperer") end end) Anything with the "butterflywhisperer" tag will not have the butterfly run away Edited February 17, 2025 by oregu 3 Link to comment https://forums.kleientertainment.com/forums/topic/164180-help-wanted-want-to-make-it-so-butterflies-dont-run-away-from-the-player/#findComment-1798710 Share on other sites More sharing options...
Error_iD10t Posted February 18, 2025 Author Share Posted February 18, 2025 8 hours ago, yanecc said: AddGlobalClassPostConstruct("behaviours/runaway", "RunAway", function(self) local _shouldrunfn = self.shouldrunfn or function() return true end function self.shouldrunfn(hunter, inst) if inst.prefab == "butterfly" and hunter:HasTag("player") then return false else return _shouldrunfn(hunter, inst) end end end) 7 hours ago, oregu said: AddBrainPostInit("butterflybrain", function(brain) --print(brain) if u need to debug local runaway for i,node in ipairs(brain.bt.root.children) do if node.name == "RunAway" then runaway = node break end end if not runaway then print("[butterflybrain] Couldn't find the 'RunAway' behaviour in this brain!") return else runaway.hunternotags = runaway.hunternotags or {} table.insert(runaway.hunternotags, "butterflywhisperer") end end) Anything with the "butterflywhisperer" tag will not have the butterfly run away Both of these work really well! Thanks a bunch for the help I would've no idea what to do otherwise. Link to comment https://forums.kleientertainment.com/forums/topic/164180-help-wanted-want-to-make-it-so-butterflies-dont-run-away-from-the-player/#findComment-1798898 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