Jump to content

Need help with character sprite and custom perks.


Recommended Posts

I'm still new into the modding community. I got the basics down. The text, the mod on the steam workshop, etc. I was wondering if there is a simple way of making sprites. I'm really a noob when it comes to this stuff so I would love some help. 

 

I also need some help with custom perks. One of them is my character would gain sanity from holding gold up to a certain amount of gold, like warbuck's perk. Another one is his is picky so he can't eat certain things deemed "gross." The last one would be that he wouldn't lose as much sanity from digging up graves.

 

I'd appreciate if someone could help me. Please and thank you!

Link to comment
Share on other sites

local function sanityfn(inst)
    local delta = 0
    local nfuel_amount = inst.components.inventory:Count("insert prefab name")
    
    if nfuel_amount >= 40 then
        delta = TUNING.SANITYAURA_MED    
    elseif nfuel_amount >= 30 then
        delta = TUNING.SANITYAURA_SMALL         
    elseif nfuel_amount >= 10 then
        delta = TUNING.SANITYAURA_TINY * 2 
    elseif nfuel_amount >= 5 then
        delta = TUNING.SANITYAURA_TINY  
    end

    return delta
end

 

 

inst.components.sanity.custom_rate_fn = sanityfn

Link to comment
Share on other sites

5 hours ago, thomas4845 said:

local function sanityfn(inst)
    local delta = 0
    local nfuel_amount = inst.components.inventory:Count("insert prefab name")
    
    if nfuel_amount >= 40 then
        delta = TUNING.SANITYAURA_MED    
    elseif nfuel_amount >= 30 then
        delta = TUNING.SANITYAURA_SMALL         
    elseif nfuel_amount >= 10 then
        delta = TUNING.SANITYAURA_TINY * 2 
    elseif nfuel_amount >= 5 then
        delta = TUNING.SANITYAURA_TINY  
    end

    return delta
end

 

 

inst.components.sanity.custom_rate_fn = sanityfn

Is this the code for gaining sanity via gold as the user mentioned? (Seems so) And is this able to be swapped out for any item?

I was working on a perk like this for a character of mine on the workshop, but was wanting to use a different item other than gold.

And was also wondering if there was a way to have more than 1 item affect it. (For example, rock, nitre, gold, flint all gain sanity.)

Edited by Angel_Octoling
Link to comment
Share on other sites

5 hours ago, thomas4845 said:

local function sanityfn(inst)
    local delta = 0
    local nfuel_amount = inst.components.inventory:Count("insert prefab name")
    
    if nfuel_amount >= 40 then
        delta = TUNING.SANITYAURA_MED    
    elseif nfuel_amount >= 30 then
        delta = TUNING.SANITYAURA_SMALL         
    elseif nfuel_amount >= 10 then
        delta = TUNING.SANITYAURA_TINY * 2 
    elseif nfuel_amount >= 5 then
        delta = TUNING.SANITYAURA_TINY  
    end

    return delta
end

 

 

inst.components.sanity.custom_rate_fn = sanityfn

Ok I got the code in. Now where would I place it?

Link to comment
Share on other sites

character

 

i'm sure you should be able to do it i just need more time i'm currently dealing with homework right now

you'll also need this it's an extra component for counting prefabs this stuff is off the creator of wauls so thank him later

inventory_postinit.lua

AddComponentPostInit("inventory", require("components/inventory_postinit")) this in modmain

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...