Jump to content

Charged Volt Goats try to electrocute themselves instead of their attacker when attacked


loganpea
  • Pending

What currently happens in build 676042:

 What is supposed to happen:  The function ran when this happens, and where the error occurs, in prefabs > lightninggoat.lua on line 134:
local function OnAttacked(inst, data)
    if data ~= nil and data.attacker ~= nil then
        if inst.charged then
            if data.attacker.components.health ~= nil and not data.attacker.components.health:IsDead() and
                data.stimuli ~= "soul" and
                (data.weapon == nil or ((data.weapon.components.weapon == nil or data.weapon.components.weapon.projectile == nil) and data.weapon.components.projectile == nil)) and
                not (data.attacker.components.inventory ~= nil and data.attacker.components.inventory:IsInsulated()) then

                data.attacker.components.health:DoDelta(-TUNING.LIGHTNING_GOAT_DAMAGE, nil, inst.prefab, nil, inst)

				--V2C: -switched to stategraph event instead of GoToState
				--     -use HandleEvent to preserve legacy timing
				--     -no longer limited to players only
				inst.sg:HandleEvent("electrocute") --inst should be data.attacker!
            end
        elseif data.stimuli == "electric" or (data.weapon ~= nil and data.weapon.components.weapon ~= nil and data.weapon.components.weapon.stimuli == "electric") then
            setcharged(inst)
        end

        inst.components.combat:SetTarget(data.attacker)
        inst.components.combat:ShareTarget(data.attacker, 20, IsChargedGoat, 3)
    end
end

Steps to Reproduce

local v = c_spawn("lightninggoat") v:DoTaskInTime(0, function() v:setcharged() v:StopBrain() end)
Attack a charged Volt Goat without insulation. You will delta health, but you won't be electrocuted.




User Feedback


There are no comments to display.



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