Sign in to follow this  
Yushicus

Help with character stats?

Recommended Posts

Yushicus    0

Okay so, I made a mod of my OC, Albast.

I was thinking it would be cool if he could gradually lose sanity when alone, but regain sanity around some animals and other players.

(He's afraid of being alone and can't do well on his own without feeling insecure and lonely.)

 

I want to add this, but I don't know if it's possible, and I'm really bad at scripting.

I've seen people give characters all kind of unique powers and stats, but I really have no idea how.

Does anyone know what I could do?

Share this post


Link to post
Share on other sites
Amalleus    13
On 06.03.2017 at 1:49 AM, Yushicus said:

Does anyone know what I could do?

You may just get some of default (or custom from workshop) character prefabs and see their code. F.e. Wendy has next string of code

inst.components.sanity.neg_aura_mult = TUNING.WENDY_SANITY_MULT

It reduces sanity decrement from negative auras. But in your case code will be harder. I may write you step by step algorithm how would i make it:

Put DoPeriodicTask in your character prefab and in this task scan area around you for prefabs. If prefab would be some player or animals your character would have sanity regen dependent on amount of these matches (or filter it other way). F.e. you have 2 animals and 1 player around yourself then you would have sanity regen increase by your_default_amount*3. And if you will not have any matches under your filter then you will have sanity regen increase by your_default_amount*0 = 0.

Since DoPeriodicTask runs code every X seconds this would mean logic will be like that:

inst.mysanityregen = 0
inst:DoPeriodicTask(0.2, function()
	--1. delete previous sanity regen amount.
	inst.components.sanity.dapperness = inst.components.sanity.dapperness - inst.mysanityregen
	--2. filter your entities around you how you like it and 
	--	calculate your new sanity regen amount.
	inst.mysanityregen = .......
	--3. Finally apply it to your character.
	inst.components.sanity.dapperness = inst.components.sanity.dapperness + inst.mysanityregen
end)

I hope this would help you.

Share this post


Link to post
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
Sign in to follow this