Atena 1 Report post Posted March 13, 2015 I make a new food item, the food could change character property(like temperature), but I don't want the monster(spider, hound...) or pigman eat it, because the monster seems not this components(temperaturem talk...), How could I do? My code:local function oneaten(inst, eater) -- Must determine eater is not a character -- How to do?? if eater not character then -- I need the code. return end -- Do something for character end Share this post Link to post Share on other sites
DrSmugleaf 61 Report post Posted March 13, 2015 In your character's prefablocal function oneat(inst, food) if food and food.components.edible and food.prefab == "yourfoodprefab" then inst.components.health:DoDelta(numberToChangeHealthBy) inst.components.hunger:DoDelta(numberToChangeHungerBy) end endAs to how to do something like temperature I have no idea. My only guess would be looking at something you know changes temperature by using it. In your character's prefab master_postinitinst.components.eater:SetOnEatFn(oneat) Share this post Link to post Share on other sites
DarkXero 2889 Report post Posted March 13, 2015 Alternatively,if not eater:HasTag("player") thenfor the check and,local temp = eater.components.temperature:GetCurrent() + 5local maxtemp = eater.components.temperature.maxtempif temp < maxtemp then eater.components.temperature:SetTemp(temp)else eater.components.temperature:SetTemp(maxtemp)endfor the temperature. Share this post Link to post Share on other sites