dnjswns951 Posted December 21, 2014 Share Posted December 21, 2014 I tried that when the character eats evil petals, health goes up by 1. and here is my code.... in my modmain.lua file local function oneatingpetals_evilevilpostinit(inst) inst:AddComponent("edible") inst.components.edible.healthvalue = 1 inst.components.edible.hungervalue = 0 inst.components.edible.foodtype = "VEGGIE" end AddPrefabPostInit("petals_evil", oneatingpetals_evilevilpostinit) it works fine. But in the game, when I open the console screen, it says "components "edible" already exists!" So I am just wondering if this code is OK or is there better way to achieve it. The other way I tried is that I copied the whole petals_evil.lua file and changed code in that file. And put that file in my mod(scrips/prefab) folder, and it also worked fine. So which one is better way to to this? Or is there a even better way? Link to comment Share on other sites More sharing options...
Mobbstar Posted December 21, 2014 Share Posted December 21, 2014 That means literally just that: petals are edible per default, yet you attempt to add the edible component again. You can't make them ediblier EDIT: As you said, there's no issue in leaving that line there, but it spams the log.txt a bit... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.