Jump to content

Need help making a dashing ability for a weapon


Recommended Posts

I'm trying to make a weapon allow its owner to "dash" toward the target when attack is clicked if they are more than a few feet away.  I have looked at premade items and I have searched the forums and I have not found anything similar to this so I decided to make a post.  

 

In detail, I would like the weapon to dash (or teleport if dash doesnt work) to a target when you attack them. I would like to avoid being able to dash to a target area if able to avoid the abuse of spamming it and using it for mobility. I've thought of a pseudo dash  by temporarily increasing the owner's movement speed to a very high amount and removing it after the attack.

 

Thank you in advance for any help.

Link to comment
Share on other sites

@DarkXero, Thanks! I'll hopefully get to add that into my character's weapons soon. Where did you get that code from? Or if you made it, how did you learn it? I've been looking for stuff to learn from but nothing is that great.

Edited by vanclan117
Link to comment
Share on other sites

@vanclan117, I hacked and slashed everything.

 

For the dashing pole, I made a spear like prefab, with a special component that uses the weapon component.

This allowed me to create a ComponentAction to use an action, the Dash action, on right click.

For the new action, as it's not defined as instant, I had to create a new stategraph state.

This state is a combination of the attack state and the jumping in wormholes animation.

Teleporting the player during the wormhole jump and cutting it before the ground swallows him is great.

For long jumps it looks ugly, but I'm going to say it's just motion blur.

 

For the blinking pole, I used the fact that StartAttack was called on the combat component of the Wilson stategraph holder.

Then all I needed to do was override StartAttack with something that teleported you near your target.

I also made use of combat targeting, in order to use the attack range for the blink range.

Way easier than the dashing pole, a less hacky, more creative solution.

 

I smashed my head against a wall for 2 months until things made sense.

I also am a programmer, so noticing details like these may be easier for me than for you.

So just do things little by little until they make sense for you, it eventually will.

Any doubts, we are here.

Link to comment
Share on other sites

@DarkXero, I am also a programmer which is why I enjoy this so much ^_^ but I have not dealt with anything like Lua. It seems similar to what Second Life is, though I programmed that many many years ago.  I know a lot of languages but nothing seems similar to Lua. Also having no list of "StartAttack" does X, I cant really self teach in a quick way.

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