Rosten Posted December 7, 2013 Share Posted December 7, 2013 (edited) So, what i'd like to know is, how can i have an item that can be edible, specifically to a character, AND, whenever he eats said item, for a effect to be applied E.g. add a tag to the character, activating a timer, and when said timer is up, said effect is removed Edit - Oh hey, 555 posts. yay, i guess. Edited December 7, 2013 by Blazingice26 Link to comment https://forums.kleientertainment.com/forums/topic/30248-effects-on-eating/ Share on other sites More sharing options...
HoneyHam Posted December 7, 2013 Share Posted December 7, 2013 (edited) I have no clue, but look around in Depth Worm Fruit coding I'd guess. Edit: Or WX-78 for his lightning effect.Or Woodie for his Werebeaver effect. Edited December 7, 2013 by TooMuchHoneyHam Link to comment https://forums.kleientertainment.com/forums/topic/30248-effects-on-eating/#findComment-385912 Share on other sites More sharing options...
Rosten Posted December 8, 2013 Author Share Posted December 8, 2013 Alright, I think i have an idea, give me a minute Link to comment https://forums.kleientertainment.com/forums/topic/30248-effects-on-eating/#findComment-385935 Share on other sites More sharing options...
Rosten Posted December 8, 2013 Author Share Posted December 8, 2013 (edited) maybe add something like---------------------------------------------------------------local function item_oneaten(inst, eater)GetPlayer():AddTag("fridge")endinst:AddComponent("edible")inst.components.edible.foodtype = "EFFECTGIVER"inst.components.edible:SetOnEatenFn(item_oneaten)-----------------------------------------------------------------Then add something from Wx's script that lets it eat that type of food?Or maybe, just add-----------------------------------------------------------------inst:AddComponent("edible")inst.components.edible.foodtype = "EFFECTGIVERICE"inst.components.edible:SetOnEatenFn(item_oneaten)----------------------------to the item then add----------------------------local function oneat(inst, food) if food and food.components.edible and food.components.edible.foodtype == "EFFECTGIVERICE" thenGetPlayer():AddTag("fridge")------------------------------To the character? Edited December 8, 2013 by Blazingice26 Link to comment https://forums.kleientertainment.com/forums/topic/30248-effects-on-eating/#findComment-385939 Share on other sites More sharing options...
HoneyHam Posted December 8, 2013 Share Posted December 8, 2013 maybe add something like---------------------------------------------------------------local function item_oneaten(inst, eater)GetPlayer():AddTag("fridge")endinst:AddComponent("edible")inst.components.edible.foodtype = "EFFECTGIVER"inst.components.edible:SetOnEatenFn(item_oneaten)-----------------------------------------------------------------Then add something from Wx's script that lets it eat that type of food?Or maybe, just add-----------------------------------------------------------------inst:AddComponent("edible")inst.components.edible.foodtype = "EFFECTGIVERICE"inst.components.edible:SetOnEatenFn(item_oneaten)----------------------------to the item then add----------------------------local function oneat(inst, food) if food and food.components.edible and food.components.edible.foodtype == "EFFECTGIVERICE" thenGetPlayer():AddTag("fridge")------------------------------To the character?Uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh............................................................................................... Link to comment https://forums.kleientertainment.com/forums/topic/30248-effects-on-eating/#findComment-385943 Share on other sites More sharing options...
Rosten Posted December 8, 2013 Author Share Posted December 8, 2013 Could someone let me know what line of code sets a particular characters default insulation? so i can change that at will Link to comment https://forums.kleientertainment.com/forums/topic/30248-effects-on-eating/#findComment-386133 Share on other sites More sharing options...
Rosten Posted December 8, 2013 Author Share Posted December 8, 2013 Also, how would one make a character have a certain max hunger, but start at a lower max hunger then that, e.g has 300 max hunger, starts at 150 hunger Link to comment https://forums.kleientertainment.com/forums/topic/30248-effects-on-eating/#findComment-386137 Share on other sites More sharing options...
Rosten Posted December 8, 2013 Author Share Posted December 8, 2013 (edited) So, im taking a shot in the dark with the first thing i wanted to do (in the OP) i've added this function, and so it occurs on eating a certain itemlocal function onfreeze(inst, data)GetPlayer():AddTag("fridge")inst.components.health:SetMaxHealth(125)inst.components.hunger:SetMax(250)inst.components.sanity:SetMax(150)inst.components.combat.damagemultiplier = 1.inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.0) inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.0) local Temperature = Class(function(self, inst)self.inherentinsulation = -30 local Health = Class(function(self, inst)inst.components.health.fire_damage_scale = 5self.fire_damage_scale = 5end end end Edited December 8, 2013 by Blazingice26 Link to comment https://forums.kleientertainment.com/forums/topic/30248-effects-on-eating/#findComment-386139 Share on other sites More sharing options...
Malan-Tai Posted December 8, 2013 Share Posted December 8, 2013 Also, how would one make a character have a certain max hunger, but start at a lower max hunger then that, e.g has 300 max hunger, starts at 150 hungerIf you mean he spawns at half his hunger, look in the Wolfgang codes, if you mean he has to upgrade his hunger, look in the WX codes. Link to comment https://forums.kleientertainment.com/forums/topic/30248-effects-on-eating/#findComment-386147 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