Jump to content

Custom/Vanilla perk addition issues.


xTheFallenOnesx

Recommended Posts

I'm having an issue adding any Perk to my characters, I'm trying to add Wendy's Resistance to sanity drain from monsters and darkness, And willows increase in sanity when near fire, but when i tried adding them to the characters i either got errors or when trying those specific perks in-game they just didn't work

I'm new to Modding in general and would like to learn more, but everything im trying fails and i don't know how most of this works, Anyone want to assist or try to help me learn sometime? This is for my friends character, mine is in another post with much more custom Perks and such i have little idea on how to go about these lua files outside of following a video.

Well i can post why the game crashes, But i don't know if what i am even doing is wrong. I can add certain things like below, And it just won't work, the game won't crash. Same goes for Wendy's Sanity buff where she doesn't get drained from monsters or darkness, It doesn't crash it just doesn't work and again i am VERY new to this

 

local prefabs =
{
    "willowfire",

}

 

local function sanityfn(inst)
    local x, y, z = inst.Transform:GetWorldPosition()
    local delta = 0
    local max_rad = 10
    local ents = TheSim:FindEntities(x, y, z, max_rad, { "fire" })
    for i, v in ipairs(ents) do
        if v.components.burnable ~= nil and v.components.burnable:IsBurning() then
            local rad = v.components.burnable:GetLargestLightRadius() or 1
            local sz = TUNING.SANITYAURA_TINY * math.min(max_rad, rad) / max_rad
            local distsq = inst:GetDistanceSqToInst(v) - 9
            -- shift the value so that a distance of 3 is the minimum
            delta = delta + sz / math.max(1, distsq)
        end
    end
    return delta
end

 

 

local function common_postinit(inst)
    inst:AddTag("pyromaniac")

end

 

 

local function master_postinit(inst)

inst.components.sanity:SetMax(TUNING.WILLOW_SANITY)
    inst.components.sanity.custom_rate_fn = sanityfn
    inst.components.sanity.rate_modifier = TUNING.WILLOW_SANITY_MODIFIER

    inst:ListenForEvent("sanitydelta", onsanitydelta)

end

No those were just the parts i tried to make the perks work as it was all i seen Mentioning Sanity and Fire. I removed them from my lua already because all it did was load the game normally and not apply the perks, And yes i am talking about Together, there is another forum for that? ;~;

EDIT: I have been in the Don't Starve forums without Realising it, My bad i thought it might have been the same

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