Jump to content

Recommended Posts

I have been trying to find these skills on the forum if possible so that I may implement them onto a character, but to no avail have I had success. Would anyone be able to point me in the right direction for resolving these issues please?

 

maxwell summons (working codex umbra)
damage adjusts with sanity
dies at 0 sanity
only eats meat
eats monster meat with no downsides (webber)
higher sanity regen

 

I think I kinda know about the sanity just not 100% sure how the dapperness options work on the character.. If only applicable at time or constant.

Regarding Maxwell summons, depends if you just want to copy Maxwell's effects and use them or make a custom 'Codex Umbra'. The latter would be much harder, first could be achieved by adding "shadowmagic" tag and "reader" component to your character. See how it's done in waxwell.lua (Maxwell's prefab).

-------------------------

Damage scaling with sanity - put:

inst:ListenForEvent("sanitydelta", onsanitychange)

somewhere in the master_postinit in your character's prefab and a function "onsanitychange" somewhere above, where you'll specify what damage multiplier will be applied at what sanity value. Current sanity value is stored in:

inst.components.sanity.current

Damage multiplier can be declared as:

inst.components.combat.damagemultiplier = value

where 'value' is your number. Regular damage multiplier is 1.

-------------------------

Only eats meat:

inst.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODTYPE.MEAT })

put this in your character's master_postinit.

-------------------------

Can eat monster meat:

inst.components.eater.strongstomach = true

in character's master_postinit.

-------------------------

Sanity regen:

inst.components.sanity.dapperness_mult = value

change 'value' to a number. Regular dapperness is 1.

Edited by PanAzej
11 hours ago, PanAzej said:

Damage scaling with sanity - put:


inst:ListenForEvent("sanitydelta", onsanitychange)

somewhere in the master_postinit in your character's prefab and a function "onsanitychange" somewhere above, where you'll specify what damage multiplier will be applied at what sanity value. Current sanity value is stored in:


inst.components.sanity.current

Damage multiplier can be declared as:


inst.components.combat.damagemultiplier = value

where 'value' is your number. Regular damage multiplier is 1.

 

Would there be a way to make it based on percent of sanity? Like from 100% sanity the character has base multiplier, but at 0% he has 0.5?

Or would it require me to input a variable for each point to make damage fall off?

11 hours ago, MemphisMyst said:

 

Would there be a way to make it based on percent of sanity? Like from 100% sanity the character has base multiplier, but at 0% he has 0.5?

Or would it require me to input a variable for each point to make damage fall off?

Well, the sanitydelta is triggered every time the sanity of character changes. So, for example, you could just do this:

local function onsanitychange()
   inst.components.combat.damagemultiplier = (inst.components.sanity.current / inst.components.sanity.max) + 1
end

Current sanity / max sanity should return a number between 0 and 1 (basically, percentage). If you add 1 to it, then your character should have 1 damage multiplier at 0 sanity and scaling up to 2 multiplier when at full sanity.

 

This is just an example. If you'd divide the percentage by 2 and add 0.5 instead of 1 then you should get your "0.5 dmg mult while at zero sanity scaling up to 1 dmg mult at full sanity" effect.

 

I'm pretty bad at math, but I think it could work this way, if I'm not mistaken, of course.

Edited by PanAzej

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