theceruleanflash Posted July 14, 2015 Share Posted July 14, 2015 Hey, I was planning on adding some unique characteristics to my character, but I can't figure out how. First, I want to make it so he does not have hunger, and he cannot eat anything either. I would also like to make it so that he passively regens health over time. Thanks for any help Link to comment Share on other sites More sharing options...
Blueberrys Posted July 15, 2015 Share Posted July 15, 2015 @theceruleanflash Health regen. There are other ways to do it too depending on your requirements. See the health component to understand it better. Hunger component.-- Set it to maxinst.components.hunger:SetPercent(1)-- Disable functions so it can't be changedfunction inst.components.hunger:DoDelta() endfunction inst.components.hunger:SetPercent() end Link to comment Share on other sites More sharing options...
theceruleanflash Posted July 16, 2015 Author Share Posted July 16, 2015 Hey, I think I'm missing something in my code. In my log.txt, it says [string "../mods/Darth Vader/scripts/prefabs/darthva..."]:48: variable 'AddSimPostInit' is not declared Link to comment Share on other sites More sharing options...
Blueberrys Posted July 16, 2015 Share Posted July 16, 2015 @theceruleanflash AddSimPostInit is for modmain. Just call the functions through your player instance in the prefab script.-- In create function (usually "fn") where inst refers to the player's instance local time = 2 -- seconds local amt = 1 inst:DoPeriodicTask(time, function() inst.components.health:DoDelta(amt) end) Link to comment Share on other sites More sharing options...
theceruleanflash Posted July 16, 2015 Author Share Posted July 16, 2015 I'm kind of confused on where the code goes 'cause I keep getting crashes. What should go in the modmain and what should go in the character prefab? Link to comment Share on other sites More sharing options...
Mobbstar Posted July 16, 2015 Share Posted July 16, 2015 I'm kind of confused on where the code goes 'cause I keep getting crashes. What should go in the modmain and what should go in the character prefab? all of the code posted on this page goes to your character file, where you presumably set the speech sound. Link to comment Share on other sites More sharing options...
TheShadeofTheNorth Posted July 16, 2015 Share Posted July 16, 2015 I'm kind of confused on where the code goes 'cause I keep getting crashes. What should go in the modmain and what should go in the character prefab? You can add all of this in the character prefab if you want , in the function named fn local fn = function(inst) Link to comment Share on other sites More sharing options...
theceruleanflash Posted July 16, 2015 Author Share Posted July 16, 2015 Hey, it seems the crashes have stopped, but the regen isn't working. Does anyone know why? thanks for the help so far 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.