Jump to content

How to make all new starting items for Character


Recommended Posts

I am currently making a character mod for Charlotte Wiltshire from Hello Charlotte. I am wanting to add items based on her book of truth and anxiety pills. Her book of truth is supposed to allow her to regain 20-30 sanity per usage, still unsure how much, and her anxiety pills are supposed to stop a constant sanity drain, that I'm not even sure how to implement, for a few minutes. Both of the items should be craftable as well. This is my very first mod, and help would be much appreciated. Thank you very much!

Edited by Tailsdoll113
Link to comment
Share on other sites

Hello hello,

Templates used:
Sorry for the late reply but to code this you can use either tutorials written by PanAzej or Yakuzashi to get a template for a basic item.
The most common template for a character is the Extended Sample Character, which will be the easiest to use.

Tutorials on how they work:
I'm also assuming you've started out coding so for any further information I'll link a tutorial on getting started --> Click Here
But if you would rather check out the specific things we are looking at i.e. Components and Prefabs Hornete has pretty good tutorials there.

This will be explained below however if you'd like to check out the components used they are in the folder locations scripts\components\sanity and scripts\components\book

On 5/30/2022 at 11:29 PM, Tailsdoll113 said:

Her book of truth is supposed to allow her to regain 20-30 sanity per usage

 

Spoiler

--code should be put inside the book code
local function OnRead(inst, reader)
	if reader.components.sanity ~= nil then -- If the character has the component sanity it will add/subtract the amount of sanity given.
         reader.components.sanity:DoDelta(THE_AMOUNT) -- examples: -10 , -20 or -30
    end
       return true
end

local function OnPeruse(inst, reader)
    --anything that is only specific to wurt can be put here
       return true
end

-- This can be explained further by hornets tutorial.
inst:AddComponent("book")

-- When read the function will be called/used that has the name OnRead.
inst.components.book.onread = OnRead

-- When people that peruse like wurt the function will be called/used call OnPeruse.
inst.components.book.onperuse = OnPeruse

 

 

On 5/30/2022 at 11:29 PM, Tailsdoll113 said:

her anxiety pills are supposed to stop a constant sanity drain

just realised you specified what it was but I can't make the change rn sorry

 

Spoiler

-- code put in the pills

local function oneaten(inst, eater)
    if eater ~= nil and eater.components.sanity ~= nil then
        eater.components.sanity.dapperness = 0
    end
end

    inst:AddComponent("edible")
    inst.components.edible.healthvalue = ANY_HEALTH_INCREASE -- e.g 10, 5, 0 e.c.
    inst.components.edible.hungervalue = ANY_HUNGER_INCREASE
    inst.components.edible:SetOnEatenFn(oneaten)

 

 

Edited by Thomas Die
I'm blind.
Link to comment
Share on other sites

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
 Share

×
  • Create New...