Jump to content

Recommended Posts

Hi! So as the title says i'm trying to add the gestalt attack to my moded character. Here's my function and where it's called.

Right now it's crashing and I think it also isn't runing my other function that spawns fx when she's above a sanity threashold. Any help would be really awesome! I do plan on releaseing her to the workshop along with Wramp, so stay tuned for that.

local function WendalynGestaltAttack(inst, owner, data, target)
    if owner ~= nil and (owner.components.health == nil or not owner.components.health:IsDead()) then
            local target = data.target
            if target and target ~= owner and target:IsValid() and (target.components.health == nil or not target.components.health:IsDead() and not target:HasTag("structure") and not target:HasTag("wall")) then
 
                -- In combat, this is when we're just launching a projectile, so don't spawn a gestalt yet
                if data.weapon ~= nil and data.projectile == nil
                        and (data.weapon.components.projectile ~= nil
                            or data.weapon.components.complexprojectile ~= nil
                            or data.weapon.components.weapon:CanRangedAttack()) then
                    return
                end
 
                local x, y, z = target.Transform:GetWorldPosition()
 
                local gestalt = SpawnPrefab("alterguardianhat_projectile")
                local r = GetRandomMinMax(3, 5)
                local delta_angle = GetRandomMinMax(-90, 90)
                local angle = (owner:GetAngleToPoint(x, y, z) + delta_angle) * DEGREES
                gestalt.Transform:SetPosition(x + r * math.cos(angle), y, z + r * -math.sin(angle))
                gestalt:ForceFacePoint(x, y, z)
                gestalt:SetTargetPosition(Vector3(x, y, z))
                gestalt.components.follower:SetLeader(owner)
 
            if owner.components.sanity ~= nil then
                owner.components.sanity:DoDelta(-1, true) -- using overtime so it doesnt make the sanity sfx every time you attack
            end
        end
    end
end

Here's where it's being called along with my other Fx function

inst.components.combat.onhitotherfn = WendalynMoonWeaponFx
 
    inst.components.combat.onhitotherfn = WendalynGestaltAttack

If you need my mod to look at I can provide my prefab files and such. Again, any help would be really appreciated! :D

Here's the characters i'm working on! just incase anyone was interested.

image.png.3eea7ba85d4acee315223f035e66b74a.png

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