Lumina Posted November 17, 2016 Share Posted November 17, 2016 inst.components.eater:SetCanEatRaw() As far as i know, this line is used only by bunnymen, gobbler and pigman, and allow them to eat food on the floor that is raw. Not sure that a character need it in any way. Link to comment Share on other sites More sharing options...
Tesumoto Posted November 26, 2016 Author Share Posted November 26, 2016 (edited) I want add health regeneration the character? There is option (inst.components) or need a code? I need health regeneration 1 hp / 4.8 sec Edited November 26, 2016 by Tezumoto Link to comment Share on other sites More sharing options...
. . . Posted November 26, 2016 Share Posted November 26, 2016 2 minutes ago, Tezumoto said: I want add health regeneration the character? There is option or need a code? I need health regeneration 1 hp / 4.8 sec How much's the character's max hp? Link to comment Share on other sites More sharing options...
Tesumoto Posted November 26, 2016 Author Share Posted November 26, 2016 Just now, SuperDavid said: How much's the character's max hp? 200 Link to comment Share on other sites More sharing options...
. . . Posted November 26, 2016 Share Posted November 26, 2016 (edited) This should work, I think inst:DoPeriodicTask(4.8, function() if inst.components.health.current >= 199 then return end inst.components.health:DoDelta(1) end) @Tezumoto If you didn't see this then use the new code. Edited November 26, 2016 by SuperDavid Link to comment Share on other sites More sharing options...
Tesumoto Posted November 26, 2016 Author Share Posted November 26, 2016 1 minute ago, SuperDavid said: This should work, I think inst:DoPeriodicTask(4.8, function() if inst.components.health.current >= 199 then return end inst.components.health:DoDelta(1) end) @Tezumoto If you don't see this then use the new code. This code need add modmain.lua? Link to comment Share on other sites More sharing options...
. . . Posted November 26, 2016 Share Posted November 26, 2016 Just now, Tezumoto said: This code need add modmain.lua? Put in YOURCHARACTER.lua inside master_postinit Link to comment Share on other sites More sharing options...
Tesumoto Posted November 26, 2016 Author Share Posted November 26, 2016 Just now, SuperDavid said: Put in YOURCHARACTER.lua inside master_postinit Thanks for your help, am going to go check it out) Link to comment Share on other sites More sharing options...
Tesumoto Posted November 26, 2016 Author Share Posted November 26, 2016 (edited) 17 minutes ago, SuperDavid said: This should work, I think inst:DoPeriodicTask(4.8, function() if inst.components.health.current >= 199 then return end inst.components.health:DoDelta(1) end) @Tezumoto If you didn't see this then use the new code. I see "the server is stopped". But if this character has disabled everything is working. And if I remove the health regeneration, works without problems) Edited November 26, 2016 by Tezumoto Link to comment Share on other sites More sharing options...
. . . Posted November 26, 2016 Share Posted November 26, 2016 38 minutes ago, Tezumoto said: I see "the server is stopped". But if this character has disabled everything is working. And if I remove the health regeneration, works without problems) I'm sorry about that kinda tired, here this one should work I tested it. Put it in the YOURCHARACTR.lua master_postinit inst:DoPeriodicTask(4.8, function() if inst.components.health and inst.components.health.currenthealth <= 200 and not inst.components.health:IsDead() then inst.components.health:DoDelta(1) else return end end) Link to comment Share on other sites More sharing options...
Tesumoto Posted November 26, 2016 Author Share Posted November 26, 2016 8 minutes ago, SuperDavid said: I'm sorry about that kinda tired, here this one should work I tested it. Put it in the YOURCHARACTR.lua master_postinit inst:DoPeriodicTask(4.8, function() if inst.components.health and inst.components.health.currenthealth <= 200 and not inst.components.health:IsDead() then inst.components.health:DoDelta(1) else return end end) Thank, I check this later) Link to comment Share on other sites More sharing options...
Tesumoto Posted November 26, 2016 Author Share Posted November 26, 2016 27 minutes ago, SuperDavid said: inst:DoPeriodicTask(4.8, function() if inst.components.health and inst.components.health.currenthealth <= 200 and not inst.components.health:IsDead() then inst.components.health:DoDelta(1) else return end end) This code works fine) Thank you for help) Link to comment Share on other sites More sharing options...
Tesumoto Posted November 26, 2016 Author Share Posted November 26, 2016 34 minutes ago, SuperDavid said: I'm sorry about that kinda tired, here this one should work I tested it. Put it in the YOURCHARACTR.lua master_postinit And I can get health begins to recover with 100 to 150?) Or is it too hard? Link to comment Share on other sites More sharing options...
Tesumoto Posted November 26, 2016 Author Share Posted November 26, 2016 (edited) 8 minutes ago, SuperDavid said: You want health to heal when over 100 points but below 150 points? inst:DoPeriodicTask(4.8, function() if inst.components.health and inst.components.health.currenthealth >= 100 and inst.components.health.currenthealth <= 150 and not inst.components.health:IsDead() then inst.components.health:DoDelta(1) else return end end) Less than 100 when the regeneration started and stopped at 150) Edited November 26, 2016 by Tezumoto Link to comment Share on other sites More sharing options...
. . . Posted November 26, 2016 Share Posted November 26, 2016 (edited) 1 hour ago, Tezumoto said: Less than 100 when the regeneration started and stopped at 150) inst:DoPeriodicTask(4.8, function() if inst.components.health and inst.components.health.currenthealth <= 150 and not inst.components.health:IsDead() then inst.components.health:DoDelta(1) else return end end) 28 minutes ago, Tezumoto said: Or it will be last added health when exactly 150. @Tezumoto I think it'll go to 149 then go to 150 & stop adding, but test it to make sure if you want . Edited November 26, 2016 by SuperDavid Link to comment Share on other sites More sharing options...
Tesumoto Posted November 26, 2016 Author Share Posted November 26, 2016 (edited) 1 hour ago, SuperDavid said: inst:DoPeriodicTask(4.8, function() if inst.components.health and inst.components.health.currenthealth <= 150 and not inst.components.health:IsDead() then inst.components.health:DoDelta(1) else return end end) but need fix inst.components.health and inst.components.health.currenthealth <= 149 and not inst.components.health:IsDead() then Or it will be last added health when exactly 150. Edited November 26, 2016 by Tezumoto Link to comment Share on other sites More sharing options...
Tesumoto Posted December 25, 2016 Author Share Posted December 25, 2016 I want to have my character's sanity was restored when it is next to Science Machine and Alchemy Engine (sanity: +1.3/min). Help me with this please. Link to comment Share on other sites More sharing options...
. . . Posted December 25, 2016 Share Posted December 25, 2016 10 minutes ago, Tezumoto said: I want to have my character's sanity was restored when it is next to Science Machine and Alchemy Engine (sanity: +1.3/min). Help me with this please. Put this code in your character's "modmain.lua", I think it would work ! Spoiler if GLOBAL.TheNet:GetIsServer() then AddPrefabPostInit("researchlab", function(inst) inst:AddComponent("sanityaura") inst.components.sanityaura.aura = 0 end) AddPrefabPostInit("researchlab2", function(inst) inst:AddComponent("sanityaura") inst.components.sanityaura.aura = 0 end) AddComponentPostInit("sanityaura", function(self) local old = self.GetAura function self:GetAura(observer) if observer.prefab == "YOURCHARACTERNAMEHERE" and self.inst.prefab == "researchlab" or self.inst.prefab == "researchlab2" then return 5 -- Play around with this number to get the sanity bonus you like end return old(self,observer) end end) end Link to comment Share on other sites More sharing options...
Tesumoto Posted December 25, 2016 Author Share Posted December 25, 2016 8 minutes ago, SuperDavid said: Put this code in your character's "modmain.lua", I think it would work ! Thank you very much, this code works! But, I can reduce the range of this effect? Link to comment Share on other sites More sharing options...
. . . Posted December 25, 2016 Share Posted December 25, 2016 Just now, Tezumoto said: Thank you very much, this code works! But, I can reduce the range of this effect? I wouldn't know how to do that, unfortunately ... Link to comment Share on other sites More sharing options...
Tesumoto Posted December 25, 2016 Author Share Posted December 25, 2016 Just now, SuperDavid said: I wouldn't know how to do that, unfortunately ... And yet too quickly restores sanity. Although I change the number 5 to number 1.3 I need (sanity: +1.3/min) .-. Link to comment Share on other sites More sharing options...
. . . Posted December 25, 2016 Share Posted December 25, 2016 (edited) 1 minute ago, Tezumoto said: And yet too quickly restores sanity. Change the number to something very small like ".01", ".1", ".25" ect. then go up from there ! Edited December 25, 2016 by SuperDavid Link to comment Share on other sites More sharing options...
Tesumoto Posted December 25, 2016 Author Share Posted December 25, 2016 (edited) 2 minutes ago, SuperDavid said: Change the number to something very small like ".01" then go up from there ! And I can set the parameter (Garland * 1)? Garland - Wreath If it can, then how to do it? Edited December 25, 2016 by Tezumoto Link to comment Share on other sites More sharing options...
. . . Posted December 25, 2016 Share Posted December 25, 2016 Just now, Tezumoto said: And I can set the parameter (Garland * 1)? If it can, then how to do it? The easiest way to do it is just put a number, at least that's what I would do.. Because I don't really know how to do the exact same as garland or stuff like that..sorry, I'm not very amazing at coding... Link to comment Share on other sites More sharing options...
Tesumoto Posted December 25, 2016 Author Share Posted December 25, 2016 4 minutes ago, SuperDavid said: The easiest way to do it is just put a number, at least that's what I would do.. Because I don't really know how to do the exact same as garland or stuff like that..sorry, I'm not very amazing at coding... Well, I'm glad that the code works =) Link to comment 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