Jump to content

Recommended Posts

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

@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

@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)

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.

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)
Edited by TheShadeofTheNorth

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...