Jump to content

Recommended Posts

I'm fairly new so ignore this if you don't care
How do you grant instant (not over time) sanity gain from killing certain creatures? e.g. spiders
I understand that DoDelta can be used, but I have no clue how to activate it via killing a certain entity.
If you can give a straight answer or link a tutorial that'd be great.

local function OnKill(victim,inst)
        if victim and victim:HasTag() then
            if victim:HasTag == "monster" then
                inst.components.sanity:DoDelta(10)
            end
        end
    end

unsure if something like this would work.

Edited by Sodarrific

got it
local function onkilled(inst, data)
    if data ~= nil and data.victim ~= nil and data.victim:HasTag("monster") then
        inst.components.sanity:DoDelta(50)
        inst.components.hunger:DoDelta(40)
        inst.components.health:DoDelta(15)
    end
end

  • Like 1

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