Codelyy Posted July 25, 2015 Share Posted July 25, 2015 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 More sharing options...
StarmanUltra Posted July 25, 2015 Share Posted July 25, 2015 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 More sharing options...
Noggle Posted July 25, 2015 Share Posted July 25, 2015 by basic attack, do you care if they have a weapon equipped, or do you mean with nothing equipped? The former is incredibly easy, the second one, not so much Link to comment Share on other sites More sharing options...
StarmanUltra Posted July 25, 2015 Share Posted July 25, 2015 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) endend Link to comment Share on other sites More sharing options...
DarkXero Posted July 27, 2015 Share Posted July 27, 2015 inst.components.combat:SetRange(attack, hit)attack being distance for the attack to be valid to start.hit being distance needed between attacker and attacked for the damage to apply. Link to comment Share on other sites More sharing options...
StarmanUltra Posted July 28, 2015 Share Posted July 28, 2015 Holy crap I didn't think there was a single-line solution! Obviously I want to do more with it than cheaty ranged melee swings, but this helps a ton! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now