Jump to content

Help on adding Special effects to character


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

Link to comment
Share on other sites

@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

@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

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

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.

×
  • Create New...