Jump to content

High sanity loss around skeletons/ghosts/hounds?


Recommended Posts

So I feel kind of stupid for not knowing how to do something that (I'd assume) is rather simple, but... I need help. I'm making a Steve Rogers custom character, and I want him to be brave. In other words, not as afraid of evil flowers, tentacles, etc. as other characters are. But, at the same time, I want to make it so he loses MUCH more sanity around ghosts and hounds, and possibly skeletons, if that's possible. I've poked around the forums for help on this, but I didn't find much.

 

Could someone help? I'm quite new to modding, only having made one mod before, so I don't have too much of a clue as to what I'm doing.

Link to comment
Share on other sites

Try this:

 

AddPrefabPostInit("skeleton", function(inst) --PREFAB name here, e.g. "hound" or "flower_evil"

    if inst.components.sanityaura then --assure this thing has an aura

        inst.components.sanityaura.aura = inst.components.sanityaura * 2 --this duplicates the drain, you can use TUNING values as found in the tuning.lua

    end

end

Link to comment
Share on other sites

Try this:

 

AddPrefabPostInit("skeleton", function(inst) --PREFAB name here, e.g. "hound" or "flower_evil"

    if inst.components.sanityaura then --assure this thing has an aura

        inst.components.sanityaura.aura = inst.components.sanityaura * 2 --this duplicates the drain, you can use TUNING values as found in the tuning.lua

    end

end

 

Alright, thank you. And this goes where? steve.lua, I assume?

Link to comment
Share on other sites

Thank you! It's not crashing, so that's a good sign. Slight problem, however; skeletons don't seem to be giving off a negative aura after putting in the code.

 

You're right, because there's no negative aura to double. Replace the "inst.components.sanityaura * 2" with "TUNING.SOMEVALUE", you can find those values in tuning.lua

Link to comment
Share on other sites

You're right, because there's no negative aura to double. Replace the "inst.components.sanityaura * 2" with "TUNING.SOMEVALUE", you can find those values in tuning.lua

 

Nothing I try seems to work. Maybe it's because I'm tired, but whenever I play around with it to try and fix it, it either simply doesn't work, or I get an error saying something like "unexpected symbol around '='." Here's what I have right now.

AddPrefabPostInit("skeleton", function(inst)    if inst.components.sanityaura then        inst.components.sanityaura.aura = TUNING.SANITY_MED    endend

I really am sorry for taking up your time for something so simple.

Link to comment
Share on other sites

Nothing I try seems to work. Maybe it's because I'm tired, but whenever I play around with it to try and fix it, it either simply doesn't work, or I get an error saying something like "unexpected symbol around '='." Here's what I have right now.

AddPrefabPostInit("skeleton", function(inst)    if inst.components.sanityaura then        inst.components.sanityaura.aura = TUNING.SANITY_MED    endend

I really am sorry for taking up your time for something so simple.

 

My bad, you have to obviously make the sanity aura when there isn't one. It's not your brain that's not working :p

 

Try this:

AddPrefabPostInit("skeleton", function(inst)

    if inst.components.sanityaura then

        inst.components.sanityaura.aura = -TUNING.SANITY_MED

    else

        inst:AddComponent("sanityaura")

        inst.components.sanityaura.aura = -TUNING.SANITY_MED

    end

end

Link to comment
Share on other sites

@Whitefang45 Technically, yes, you can do the same for them, but it's kinda messy to rewrite the same code.

local function changeSanityAura(inst)    if inst.components.sanityaura then        inst.components.sanityaura.aura = inst.components.sanityaura.aura*2    else        inst:AddComponent("sanityaura")        inst.components.sanityaura.aura = -TUNING.SANITY_MED    endendAddPrefabPostInit("skeleton", changeSanityAura)-- AddPrefabPostInit("hound", changeSanityAura)-- etc...

For more info, read about how post init functions work.

Link to comment
Share on other sites

Try this:

 

AddPrefabPostInit("skeleton", function(inst) --PREFAB name here, e.g. "hound" or "flower_evil"

    if inst.components.sanityaura then --assure this thing has an aura

        inst.components.sanityaura.aura = inst.components.sanityaura * 2 --this duplicates the drain, you can use TUNING values as found in the tuning.lua

    end

end

 

 

It's not Working for me, is suppose to put in modmain.lua isn't it?

 

 

is supposed to put something before or after this code? it's not working for me.

Link to comment
Share on other sites

It's not Working for me, is suppose to put in modmain.lua isn't it?

 

 

is supposed to put something before or after this code? it's not working for me.

 

Yes modmain.lua

BUT that code only amplifies sanityaura, this code adds a negative aura if it needs to.

 

local TUNING = GLOBAL.TUNING

 

local function changeSanityAura(inst)
    if inst.components.sanityaura then
        inst.components.sanityaura.aura = inst.components.sanityaura.aura*2
    else
        inst:AddComponent("sanityaura")
        inst.components.sanityaura.aura = -TUNING.SANITY_MED
    end
end
 
AddPrefabPostInit("prefabname", changeSanityAura)
 
as described by BlueBerrys.
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...