IgnisDraconi Posted January 7, 2017 Share Posted January 7, 2017 Hello! I'm noob in this area... Any help will be awesome! I'm trying to make a character with this perks: Healt autoregeneration: always active, but slow Healing aura in the night for friends: Mid range. Lose sanity if hungry: starting when the "stomach meter" is at half (if posible). Gain sanity from battle. Don't lose sanity with ghosts and monsters. It could be based on Wilson. I think I will never put this character for download, but of course I'll give credit to anyone who helps me. I have my old testing code, It have no errors but is a mess and I can't make it work propertly. XD Thanks! have a good day and happy new year! Link to comment Share on other sites More sharing options...
Cunning fox Posted January 7, 2017 Share Posted January 7, 2017 For regenerarion you can check heather mod. 1 Link to comment Share on other sites More sharing options...
PanAzej Posted January 8, 2017 Share Posted January 8, 2017 (edited) 6 hours ago, IgnisDraconi said: Healing aura in the night for friends: Mid range. Put this in your character's prefab: local function stopregen(inst) if inst.heal_task ~= nil then inst.heal_task:Cancel() inst.heal_task = nil end end local function startregen(inst) if inst.heal_task == nil then inst.heal_task = inst:DoPeriodicTask(1, function() local x,y,z = inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x,y,z, 5) for k,v in pairs(ents) do if v and v:HasTag("player") and v.components.health and not v.components.health:IsDead() and not v:HasTag("playerghost") and v ~= inst then if TheWorld.state.isnight or TheWorld.state.iscavenight then v.components.health:DoDelta(1) end end end end) end end inst:WatchWorldState("isnight", startregen) inst:WatchWorldState("iscavenight", startregen) inst:WatchWorldState("isday", stopregen) inst:WatchWorldState("iscaveday", stopregen) This will make it so you regenerate 1 health per second to all players but yourself in a small area, only during nights. Edited January 8, 2017 by PanAzej whoops, a mistake Link to comment Share on other sites More sharing options...
IgnisDraconi Posted January 8, 2017 Author Share Posted January 8, 2017 (edited) 8 hours ago, makar5000 said: For regenerarion you can check heather mod. Thanks! I take a look 7 hours ago, TheMightyPikachu said: inst.components.health:StartRegen(healthnumber, seconds) It works perfectly! Thanks very much! =D 2 hours ago, PanAzej said: Put this in your character's prefab: local function stopregen(inst) if inst.heal_task ~= nil then inst.heal_task:Cancel() inst.heal_task = nil end end local function startregen(inst) if inst.heal_task == nil then inst.heal_task = inst:DoPeriodicTask(1, function() local x,y,z = inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x,y,z, 5) for k,v in pairs(ents) do if v and v:HasTag("player") and v.components.health and not v.components.health:IsDead() and not v:HasTag("playerghost") and v ~= inst then if TheWorld.state.isnight or TheWorld.state.iscavenight then v.components.health:DoDelta(1) end end end end) end end inst:WatchWorldState("isnight", startregen) inst:WatchWorldState("iscavenight", startregen) inst:WatchWorldState("isday", stopregen) inst:WatchWorldState("iscaveday", stopregen) This will make it so you regenerate 1 health per second to all players but yourself in a small area, only during nights. Thanks so much! I'll test it right away! =D Edited January 8, 2017 by IgnisDraconi Link to comment Share on other sites More sharing options...
IgnisDraconi Posted January 8, 2017 Author Share Posted January 8, 2017 (edited) And... I found this: local function onkilledcos(inst, data) inst.components.sanity:DoDelta(1.5) end Could someone tell me if this will help me to regen sanity if I kill anything? Thanks Edited January 8, 2017 by IgnisDraconi Link to comment Share on other sites More sharing options...
zUsername Posted January 8, 2017 Share Posted January 8, 2017 35 minutes ago, IgnisDraconi said: And... I found this: local function onkilledcos(inst, data) inst.components.sanity:DoDelta(1.5) end Could someone tell me if this will help me to regen sanity if I kill anything? Thanks local function onkilled(inst, data) if data.victim ~= nil and data.victim.components.health ~= nil then inst.components.sanity:DoDelta(1.5) end end local function master_init(inst) inst:ListenForEvent("killed", onkilled) end Link to comment Share on other sites More sharing options...
IgnisDraconi Posted January 8, 2017 Author Share Posted January 8, 2017 21 minutes ago, zUsername said: local function onkilled(inst, data)... Thanks so much! It works perfectly! Link to comment Share on other sites More sharing options...
IgnisDraconi Posted January 8, 2017 Author Share Posted January 8, 2017 (edited) All the help is working amazing! Thanks everyone! But every time I test the mod I need something to balance the stats XD So... Here I go with my endless questions ... Any idea on how to stop losing sanity from monsters like spiders and ghosts? Thanks agan and mercy on this noob Edited January 8, 2017 by IgnisDraconi Link to comment Share on other sites More sharing options...
zUsername Posted January 8, 2017 Share Posted January 8, 2017 1 hour ago, IgnisDraconi said: All the help is working amazing! Thanks everyone! But every time I test the mod I need something to balance the stats XD So... Here I go with my endless questions ... Any idea on how to stop losing sanity from monsters like spiders and ghosts? Thanks agan and mercy on this noob inst.components.sanity.neg_aura_mult = 0 Link to comment Share on other sites More sharing options...
IgnisDraconi Posted January 8, 2017 Author Share Posted January 8, 2017 10 hours ago, zUsername said: inst.components.sanity.neg_aura_mult = 0 Awesome! Thanks so much again! =D 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