Jump to content

Problem with my mod


Recommended Posts

Ok so i wanted to make my character to have a negative sanity aura and it kinda works? except my character also gets negative sanity which i don't really want
 
Also i wanted that if i wear a garland sanity aura will be equal zero but my character gets negative sanity

Here is my sanity aura code

 

    inst:DoPeriodicTask(60.0, function(inst)
        if inst.components.sanity and inst:HasTag("playerghost") then
            return
        end
        local x,y,z = inst.Transform:GetWorldPosition()

        local players = TheSim:FindEntities(x, y, z, 5, {"player"}, {"playerghost", "INLIMBO"}, nil)
        
        for _,v in ipairs(players) do
            if v.components.sanity then
                v.components.sanity:DoDelta(-1)
            end
        end
    end)


I just started making my character and I'm not really good at LUA coding so sorry if i look dumb

 

Link to comment
Share on other sites

13 hours ago, fixerhere said:

TheSim:FindEntities(x, y, z, 5, {"player"}, {"playerghost", "INLIMBO"}, nil)

Add the players tagg next to playerghost and INLIMBO if you want only the character to not get it 

ifyou want everyone else to get it do

 

"If v ~= inst then"

Then should make it so that if it finds you then it should work 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Ok i think i found something but i'm not sure if it's right
Tagg is called "healingflower" but it's in the hats_lavaarena prefab so it's probably wrong 

Also i don't know if i'm blind but i don't see garland onequip?

Only garland code i saw is this one


 

    local function flower_custom_init(inst)
        inst:AddTag("open_top_hat")
        inst:AddTag("show_spoilage")
    end

    local function flower()
        local inst = simple(flower_custom_init)

        inst.components.floater:SetSize("med")
        inst.components.floater:SetScale(0.68)

        if not TheWorld.ismastersim then
            return inst
        end

        inst.components.equippable.dapperness = TUNING.DAPPERNESS_TINY
        inst.components.equippable:SetOnEquip(opentop_onequip)

        inst:AddComponent("perishable")
        inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST)
        inst.components.perishable:StartPerishing()
        inst.components.perishable:SetOnPerishFn(inst.Remove)

        MakeHauntableLaunchAndPerish(inst)

        return inst
    end

 

 

Edited by fixerhere
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...