Jump to content

Recommended Posts

I'm currently working on a Wagstaff mod for DST and I've hit a snag related to his voice changing based on his health. I'll try to provide as many details as possible.

Currently, his talk_LP file work s correctly, I'll attach videos / the code used to make it work.

local function SGWilsonPostInit(sg)
    local oldtalk = sg.states["talk"].onenter

    sg.states["talk"].onenter = function(inst, noanim)
        oldtalk(inst)

        if inst:HasTag("hasvoiceintensity_health") then
            local percent = inst.components.health:GetPercent()
            inst.SoundEmitter:SetParameter("talk", "intensity", percent)
        end
    end
end

AddStategraphPostInit("wilson", SGWilsonPostInit)

Here's the code, to run through it simply, Wagstaff has the 'hasvoiceintensity_health' tag, It checks the percent he has of his max HP, which it then increases/decreases the intensity based on that value, which is a parameter the sounds have. Lower health means less intensity. Here's a video example of it in-game, and in FMOD.

This, works as intended completely. Now onto the problem.

When doing an emote, it doesn't effect the intensity variable at all. Here's the code that I've been testing to have it work.

local function SGWilsonPostInit(sg, data)
    local oldemote = sg.states["emote"].onenter
    sg.states["emote"].onenter = function(inst, data)
        oldemote(inst, data)
        

        if inst:HasTag("hasvoiceintensity_health") then
            local percent = inst.components.health:GetPercent()
            inst.SoundEmitter:SetParameter("emote", "intensity", percent)
        end
    end
end


AddStategraphPostInit("wilson", SGWilsonPostInit)

In-game and in FMOD;

Any assistance is appreciated :)

Edited by A Pufferfish
Had too much empty space at bottom

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