Greystar Posted August 10, 2024 Share Posted August 10, 2024 I have been trying to make a mod that tweaks the birdcage but I can not figure out how to access what type of bird is occupying the cage. If anyone has any suggestions it would be great. I thought about trying to use GetOccupant() but I am not sure how to use it and it's only ever used with the birdcage. I looked at the GetOccupant() function in the scripts and it's very basic, but if I can us it to get what bird_type is in the birdcage I can get the rest to work. Basically what I am trying to do is add to the food list when you give the bird additional items you could say give it a twig and it'll drop a feather for you. Or you could feed it say monster lasagna and get a guaranteed guano drop from it, etc. I don't need someone to write the code (I have a programmer background so I can figure out how, once I get the LUA code I need to figure out what kind of bird is in the cage. Link to comment https://forums.kleientertainment.com/forums/topic/158958-trying-to-get-what-type-of-bird-is-in-the-birdcage/ Share on other sites More sharing options...
Haruhi Kawaii Posted August 11, 2024 Share Posted August 11, 2024 On 8/10/2024 at 8:45 AM, Greystar said: I have been trying to make a mod that tweaks the birdcage but I can not figure out how to access what type of bird is occupying the cage. If anyone has any suggestions it would be great. I thought about trying to use GetOccupant() but I am not sure how to use it and it's only ever used with the birdcage. I looked at the GetOccupant() function in the scripts and it's very basic, but if I can us it to get what bird_type is in the birdcage I can get the rest to work. Basically what I am trying to do is add to the food list when you give the bird additional items you could say give it a twig and it'll drop a feather for you. Or you could feed it say monster lasagna and get a guaranteed guano drop from it, etc. I don't need someone to write the code (I have a programmer background so I can figure out how, once I get the LUA code I need to figure out what kind of bird is in the cage. Do you mean like this? AddPrefabPostInit("birdcage", function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end local AcceptTest = inst.components.trader.test if AcceptTest then inst.components.trader.test = function(inst, item, giver, ...) print("Bird in cage: " .. inst.bird_type) return AcceptTest(inst, item, giver, ...) end end end) 1 Link to comment https://forums.kleientertainment.com/forums/topic/158958-trying-to-get-what-type-of-bird-is-in-the-birdcage/#findComment-1740192 Share on other sites More sharing options...
Greystar Posted August 11, 2024 Author Share Posted August 11, 2024 14 hours ago, Haruhi Kawaii said: Do you mean like this? AddPrefabPostInit("birdcage", function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end local AcceptTest = inst.components.trader.test if AcceptTest then inst.components.trader.test = function(inst, item, giver, ...) print("Bird in cage: " .. inst.bird_type) return AcceptTest(inst, item, giver, ...) end end end) Maybe. I'll have to test. I've been trying to figure out a way to get the bird_type and I'll see if the function I'm using will let me do it from something like that. I am not using the AddPrefabPostInit, because the mod I'm tweaking someone else wrote so I'm using there code. I suppose I could just add it to their code though and do it after the fact instead of in the function. Link to comment https://forums.kleientertainment.com/forums/topic/158958-trying-to-get-what-type-of-bird-is-in-the-birdcage/#findComment-1740247 Share on other sites More sharing options...
Greystar Posted August 19, 2024 Author Share Posted August 19, 2024 On 8/10/2024 at 10:31 PM, Haruhi Kawaii said: Do you mean like this? AddPrefabPostInit("birdcage", function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end local AcceptTest = inst.components.trader.test if AcceptTest then inst.components.trader.test = function(inst, item, giver, ...) print("Bird in cage: " .. inst.bird_type) return AcceptTest(inst, item, giver, ...) end end end) Seems to have worked once I got it into the right function, now I can get feathers from the birds as well as the other items you can normally get from the bird cage. Thanks for your assistance. 1 Link to comment https://forums.kleientertainment.com/forums/topic/158958-trying-to-get-what-type-of-bird-is-in-the-birdcage/#findComment-1741359 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