Jump to content

Recommended Posts

I did some snooping and I couldn't find any topics that answered this question (that or i'm a terrible detective). I'm currently working on a mod and I was wondering if there was a way that could increase a boomerang's impact damage the further it has to travel to it's target.

On 7/24/2018 at 5:39 AM, Makishim said:

You can start a timer when the function OnThrown's called. When OnHit's called you get the timer value and does: damage + (timer * aditional damage).

Any idea how I would write that in the context of this code:

local function OnThrown(inst, owner, target)
    if target ~= owner then
        owner.SoundEmitter:PlaySound("dontstarve/wilson/boomerang_throw")
    end
    inst.AnimState:PlayAnimation("spin_loop", true)
end

local function OnHit(inst, owner, target)
    if owner == target or owner:HasTag("playerghost") then
if owner ~= nil and owner.components.inventory ~= nil and owner.components.inventory.isopen then
        if inst.components.equippable ~= nil and not owner.components.inventory:GetEquippedItem(inst.components.equippable.equipslot) then
            owner.components.inventory:Equip(inst)
        else
            owner.components.inventory:GiveItem(inst)
        end
        owner:PushEvent("catch")
    end
    else
        ReturnToOwner(inst, owner)
    end
    if target ~= nil and target:IsValid() then
        local impactfx = SpawnPrefab("impact")
        if impactfx ~= nil then
            local follower = impactfx.entity:AddFollower()
            follower:FollowSymbol(target.GUID, target.components.combat.hiteffectsymbol, 0, 0, 0)
            impactfx:FacePoint(inst.Transform:GetWorldPosition())
        end
    end
end

I did have a look at how DS RoG did timers in the SGmoose file as that has a disarm cooldown timer, but it didn't have anything on getting the values of the timer. The help is greatly appreciated.

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