ZeldaDoll Posted May 11, 2022 Share Posted May 11, 2022 Hello, I am making a bee themed character of a friend for her birthday. I am looking for help on making it so bees won't attack the character when she is harvesting honey or during the spring. I was able to make it so the wasps hives do not attack, but I have not figured out how to apply the code to the bee box and spring time angry bees. Any help is greatly appreciated as her birthday is in a week and I am running out of time! This is the last piece I need to complete the mod. Here is what I have for making bees not attack: (in modmain) local function FriendlyWaspInit(prefab) local function OnNearBy(prefab, target) if prefab.components.childspawner ~= nil and not target:HasTag("beefriend") then prefab.components.childspawner:ReleaseAllChildren(target, "killerbee") end end if prefab.components.playerprox then prefab.components.playerprox:SetOnPlayerNear(OnNearBy) end end AddPrefabPostInit("wasphive", FriendlyWaspInit) Link to comment https://forums.kleientertainment.com/forums/topic/140173-urgent-need-help-making-bees-not-attack-on-harvest-in-spring-for-custom-character/ Share on other sites More sharing options...
IronHunter Posted May 13, 2022 Share Posted May 13, 2022 AddPrefabPostInit("beebox", function(inst) if not GLOBAL.TheWorld.ismastersim then return end if inst.components.childrenspawner then local _ReleaseAllChildren = inst.components.childrenspawner.ReleaseAllChildren inst.components.childrenspawner.ReleaseAllChildren = function(self, target, prefab,...) return not target:HasTag("beefriend") and _ReleaseAllChildren(self, target, prefab, ...) end end end) This should do it for when you harvest you won't release the bees, as for preventing them from aggroing onto you in spring you'll need to mess with the retarget code. Easiest way is to just give your character the plantkin tag if you are super short for time. 1 Link to comment https://forums.kleientertainment.com/forums/topic/140173-urgent-need-help-making-bees-not-attack-on-harvest-in-spring-for-custom-character/#findComment-1569968 Share on other sites More sharing options...
ZeldaDoll Posted May 13, 2022 Author Share Posted May 13, 2022 19 hours ago, IronHunter said: AddPrefabPostInit("beebox", function(inst) if not GLOBAL.TheWorld.ismastersim then return end if inst.components.childrenspawner then local _ReleaseAllChildren = inst.components.childrenspawner.ReleaseAllChildren inst.components.childrenspawner.ReleaseAllChildren = function(self, target, prefab,...) return not target:HasTag("beefriend") and _ReleaseAllChildren(self, target, prefab, ...) end end end) This should do it for when you harvest you won't release the bees, as for preventing them from aggroing onto you in spring you'll need to mess with the retarget code. Easiest way is to just give your character the plantkin tag if you are super short for time. Thank you so much for your help! I tried the bee box code you posted and put it in modmain and unfortunately it didn't work. Link to comment https://forums.kleientertainment.com/forums/topic/140173-urgent-need-help-making-bees-not-attack-on-harvest-in-spring-for-custom-character/#findComment-1570202 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