PtitENoli Posted January 23, 2015 Share Posted January 23, 2015 Hello again! I'm still working on my character. I wanted that when she eats mushrooms, she level up and gain a small amount of health. I succeed with that code: if food and food.components.edible and food.prefab == "red_cap" or food.prefab == "green_cap" or food.prefab == "blue_cap" then--give an upgrade!inst.level = inst.level + 1applyupgrades(inst) inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")inst.components.health:DoDelta(20) But how do you remove the bad effects from the mushrooms eaten raw ? Because ingame, my character is still hurts by the mushroom and says that it wasn't good. Thanks you! Link to comment https://forums.kleientertainment.com/forums/topic/49607-removing-bad-effects-from-mushroom-for-my-characters/ Share on other sites More sharing options...
rezecib Posted January 23, 2015 Share Posted January 23, 2015 @PtitENoli, http://forums.kleientertainment.com/topic/48762-character-perk-problemrequest/ Link to comment https://forums.kleientertainment.com/forums/topic/49607-removing-bad-effects-from-mushroom-for-my-characters/#findComment-605238 Share on other sites More sharing options...
PtitENoli Posted January 26, 2015 Author Share Posted January 26, 2015 Thanks you Rezecib! I already read that posts, but didn't connect with my problem. I managed to get it work Link to comment https://forums.kleientertainment.com/forums/topic/49607-removing-bad-effects-from-mushroom-for-my-characters/#findComment-606112 Share on other sites More sharing options...
rezecib Posted January 26, 2015 Share Posted January 26, 2015 @PtitENoli, I was referring to this part: Add this to your master_postinit in the character prefab file:local OldEat = inst.components.eater.Eatinst.components.eater.Eat = function(self, food) if self:CanEat(food) and food.prefab:find("berries") then food.components.edible.healthvalue = food.components.edible.healthvalue + 5 end return OldEat(self, food)endThat should work for both cooked and raw berries. If you want just one of them, change the food.prefab:find() part to food.prefab == "berries" or "berries_cooked". You can use the same approach, targeted to the prefab names of the mushrooms, to modify their food values for just your character. Link to comment https://forums.kleientertainment.com/forums/topic/49607-removing-bad-effects-from-mushroom-for-my-characters/#findComment-606114 Share on other sites More sharing options...
PtitENoli Posted January 26, 2015 Author Share Posted January 26, 2015 Yes, sorry for my english, what I meant to say was that thanks to this part I was able to do my effect! Link to comment https://forums.kleientertainment.com/forums/topic/49607-removing-bad-effects-from-mushroom-for-my-characters/#findComment-606138 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