Jump to content

Basic range attack.


Recommended Posts

I am making a character who i wish to have a basic attack that is ranged instead of the normal melee attack but the problem is... i have no idea where to start XD.

 

Any help on just where to start?

Link to comment
Share on other sites

I'm looking for the same thing. I just finished all the character art finally, so now I'm looking to give the character its properties.

 

This is my first mod, so I don't know where to start, besides looking in the base game files. I thought McTusk might be the answer, but it seems he just equips a blow dart item to use (which disappears when he dies).

Link to comment
Share on other sites

I meant nothing equipped. Would I be able to call something like this? (From the Bishop)
 

local function EquipWeapon(inst)
    if inst.components.inventory and not inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) then
        local weapon = CreateEntity()
        --[[Non-networked entity]]
        weapon.entity:AddTransform()
        weapon:AddComponent("weapon")
        weapon.components.weapon:SetDamage(inst.components.combat.defaultdamage)
        weapon.components.weapon:SetRange(inst.components.combat.attackrange, inst.components.combat.attackrange+4)
        weapon.components.weapon:SetProjectile("spit")
        weapon:AddComponent("inventoryitem")
        weapon.persists = false
        weapon.components.inventoryitem:SetOnDroppedFn(inst.Remove)
        weapon:AddComponent("equippable")
        
        inst.components.inventory:Equip(weapon)
    end
end
Link to comment
Share on other sites

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
 Share

×
  • Create New...