. . . Posted February 25, 2022 Share Posted February 25, 2022 (edited) There doesn't seem to be a "inst:HasTag(FOODTYPE.MEAT.."_eater")" tag.. so is there any other way? Edited February 25, 2022 by . . . Link to comment https://forums.kleientertainment.com/forums/topic/137735-solved-how-to-check-if-players-a-carnivore/ Share on other sites More sharing options...
CarlZalph Posted February 25, 2022 Share Posted February 25, 2022 1 hour ago, . . . said: There doesn't seem to be a "inst:HasTag(FOODTYPE.MEAT.."_eater")" tag.. so is there any other way? Check out the eater component's diet handling. Most of it's inside a table being stored, but there are other functions that may change how you go about doin' some things. 2 Link to comment https://forums.kleientertainment.com/forums/topic/137735-solved-how-to-check-if-players-a-carnivore/#findComment-1542091 Share on other sites More sharing options...
. . . Posted February 25, 2022 Author Share Posted February 25, 2022 (edited) 44 minutes ago, CarlZalph said: Check out the eater component's diet handling. Most of it's inside a table being stored, but there are other functions that may change how you go about doin' some things. I did check basically everything from the eater component I thought there could be a way to see what the character can eat using inst.components.eater.preferseating == { FOODTYPE.MEAT } but it didn't do anything I got no idea how I can check if inst.components.eater.preferseating has a certain value in it either which I assume would be an easy way to see if they only ate meat or not everything else in eater seemed useless for what I was trying to do because the only other thing which can check if you can eat something "inst.components.eater.CanEat(food)" only takes into account the player's foodgroup and not foodtypes they will refuse so using that code to check would say like wigfrid can eat carrots Edited February 25, 2022 by . . . Link to comment https://forums.kleientertainment.com/forums/topic/137735-solved-how-to-check-if-players-a-carnivore/#findComment-1542101 Share on other sites More sharing options...
CarlZalph Posted February 25, 2022 Share Posted February 25, 2022 6 minutes ago, . . . said: inst.components.eater.preferseating == { FOODTYPE.MEAT } but it didn't do anything That'd be comparing a table to a new table, which in LUA would mean they're not identical. You'd need to iterate over the table and check if your target entries are there. 2 Link to comment https://forums.kleientertainment.com/forums/topic/137735-solved-how-to-check-if-players-a-carnivore/#findComment-1542106 Share on other sites More sharing options...
. . . Posted February 25, 2022 Author Share Posted February 25, 2022 26 minutes ago, CarlZalph said: You'd need to iterate over the table and check if your target entries are there. Do you know how I'd do this? I don't really know anything about how tables work or how to check what's in a table Link to comment https://forums.kleientertainment.com/forums/topic/137735-solved-how-to-check-if-players-a-carnivore/#findComment-1542115 Share on other sites More sharing options...
CarlZalph Posted February 25, 2022 Share Posted February 25, 2022 27 minutes ago, . . . said: Do you know how I'd do this? I don't really know anything about how tables work or how to check what's in a table This is getting a bit into basic LUA, which I'd recommend reading up on the user manuals for. But here's a quick example of iterating an ipairs table and checking for one value. local a = {23, 45, 67,} for i, v in ipairs(a) do print(i, v, v == 45) end Quote 1 23 false 2 45 true 3 67 false 2 Link to comment https://forums.kleientertainment.com/forums/topic/137735-solved-how-to-check-if-players-a-carnivore/#findComment-1542121 Share on other sites More sharing options...
. . . Posted February 25, 2022 Author Share Posted February 25, 2022 It was hard to get my head around it, but I managed to do it, thanks 1 1 Link to comment https://forums.kleientertainment.com/forums/topic/137735-solved-how-to-check-if-players-a-carnivore/#findComment-1542130 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