NamelessName Posted May 9, 2020 Share Posted May 9, 2020 Tallbirds are exterminating like 40% of grass geckos sometimes. How to make them friendly vs them? Someone who wants to make such a mod? Link to comment https://forums.kleientertainment.com/forums/topic/118116-mod-request-tallbird-friendly-vs-grass-geckos/ Share on other sites More sharing options...
rawii22 Posted May 9, 2020 Share Posted May 9, 2020 I took a look at it's prefab file and probably the only thing of interest it that is has a combat component. I'm pretty sure that tallbirds attack anything that gets close to their nests. The first thing I would think to do is to find some way of modifying some function in the combat component, probably a targeting system, to check if the one attacking is a tallbird and if the target is a grass gecko and then cancel the rest of the actions. I think a good place to look for examples would be the eyeplant and wormwood. Eyeplants attack everyone except wormwood, so maybe there's a system of tags or a series of checks in one of the two files or component. Just whatever enemy/mob you can think of that has an exception (like webber and spiders) Link to comment https://forums.kleientertainment.com/forums/topic/118116-mod-request-tallbird-friendly-vs-grass-geckos/#findComment-1332326 Share on other sites More sharing options...
NamelessName Posted May 10, 2020 Author Share Posted May 10, 2020 5 hours ago, rawii22 said: I took a look at it's prefab file and probably the only thing of interest it that is has a combat component. I'm pretty sure that tallbirds attack anything that gets close to their nests. The first thing I would think to do is to find some way of modifying some function in the combat component, probably a targeting system, to check if the one attacking is a tallbird and if the target is a grass gecko and then cancel the rest of the actions. I think a good place to look for examples would be the eyeplant and wormwood. Eyeplants attack everyone except wormwood, so maybe there's a system of tags or a series of checks in one of the two files or component. Just whatever enemy/mob you can think of that has an exception (like webber and spiders) Finally some help in this forum. Ok thanks man, I will take a look at the eyeplant and wormwood, thats a start. Link to comment https://forums.kleientertainment.com/forums/topic/118116-mod-request-tallbird-friendly-vs-grass-geckos/#findComment-1332392 Share on other sites More sharing options...
NamelessName Posted May 10, 2020 Author Share Posted May 10, 2020 I couldnt find where to edit the "tag" component... Link to comment https://forums.kleientertainment.com/forums/topic/118116-mod-request-tallbird-friendly-vs-grass-geckos/#findComment-1332482 Share on other sites More sharing options...
krylincy Posted May 10, 2020 Share Posted May 10, 2020 in the tallbird lua there is the function where it is decided to target or not local function IsValidTarget(guy) return not guy.components.health:IsDead() and inst.components.combat:CanTarget(guy) --smallbirds that aren't companions are parented --to other tallbirds, so don't target them! and (not inst:HasTag("smallbird") or inst:HasTag("companion")) end So the quick and dirty fix for you could be to just add the smallbird tag to the grasgeckos AddPrefabPostInit("grassgekko", function(inst) inst:AddTag("smallbird") end) The correct way would be to rewrite this "IsValidTarget" function in the tallbird lua. Not sure if removing the combat component may help but you can try it this way: AddPrefabPostInit("grassgekko", function(inst) if inst.components ~= nil and inst.components.combat ~= nil then inst:RemoveComponent("combat") end end) But I think this will also end up that nobody can kill them at all. Link to comment https://forums.kleientertainment.com/forums/topic/118116-mod-request-tallbird-friendly-vs-grass-geckos/#findComment-1332486 Share on other sites More sharing options...
NamelessName Posted May 10, 2020 Author Share Posted May 10, 2020 (edited) 2 hours ago, krylincy said: in the tallbird lua there is the function where it is decided to target or not local function IsValidTarget(guy) return not guy.components.health:IsDead() and inst.components.combat:CanTarget(guy) --smallbirds that aren't companions are parented --to other tallbirds, so don't target them! and (not inst:HasTag("smallbird") or inst:HasTag("companion")) end So the quick and dirty fix for you could be to just add the smallbird tag to the grasgeckos AddPrefabPostInit("grassgekko", function(inst) inst:AddTag("smallbird") end) The correct way would be to rewrite this "IsValidTarget" function in the tallbird lua. Not sure if removing the combat component may help but you can try it this way: AddPrefabPostInit("grassgekko", function(inst) if inst.components ~= nil and inst.components.combat ~= nil then inst:RemoveComponent("combat") end end) But I think this will also end up that nobody can kill them at all. Thank you man for this very well written code. I added this into my mainmod.lua, however the first bit of code for smallbird, did not work at all (they still attack them). Its strange, I would have assumed it would work, so thats a shame. The second code however did exactly what you said. So no one can attack them., but I dont want that (just tallbird). Is there any other piece of code you know would work? Either way, thanks so very much for your help. I learned a lot from just that small bit of code you gave me. This forum felt dead until you came around man. Edited May 10, 2020 by NamelessName Link to comment https://forums.kleientertainment.com/forums/topic/118116-mod-request-tallbird-friendly-vs-grass-geckos/#findComment-1332511 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