• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] 'Dash' Ability

Status
Not open for further replies.
Level 4
Joined
Dec 31, 2014
Messages
68
Hello all, this is kinda object/trigger related.
I watched a video on youtube of how to make a simple dash ability which uses shockwave as a base spell, then to target a point and have the unit instantly move-in-increments to the target, to use in my map. I don't want something like Blink as I have some locked doors etc which the Blinkers could teleport over.

I managed to get the simple dash to work but I would like to make it so that the unit can target anywhere in their view and to do the ability from the casting units position, but at a certain distance they cannot 'Dash' any further. (Blink has this sort of setup I believe)
Heres an image of what I would like to do;


So the Unit uses Dash from their position on the left, targets where the target is, but I want it to stop at a certain distance (Middle).

These are the triggers that the tutorial suggested; There are likely some trigger issues here also so if there are can you please let me know how to fix them, or any alternatives.

Variables;

Angle - Real
Caster - Unit
DashPoint - Point Array(3)
Distance - Real
Increment - Real

  • Dash Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dash
    • Actions
      • Set Caster = (Triggering unit)
      • Set DashPoint[0] = (Position of Caster)
      • Set DashPoint[1] = (Target point of ability being cast)
      • Set Distance = (Distance between (Position of Caster) and DashPoint[1])
      • Set Increment = 50.00
      • Set Angle = (Angle from (Position of Caster) to DashPoint[1])
      • Trigger - Turn on Dash Loop <gen>
  • Dash Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set Distance = (Distance - Increment)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Distance Greater than 0.00
        • Then - Actions
          • Set DashPoint[2] = (Position of Caster)
          • Set DashPoint[3] = (DashPoint[2] offset by Increment towards Angle degrees)
          • Unit - Set mana of Caster to 0.00
          • Unit - Move Caster instantly to DashPoint[3]
        • Else - Actions
I don't think the Dash Loop above is great because of the fast periodic-event, the video wasn't descriptive why he did what he did.
Here is the video for reference.https://www.youtube.com/watch?v=Wal2c6NQGIU

Thanks
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
"Set x = (x - Increment)"
... minus increment ... sure bro :D
(I know you copied from youtube but still.)

"Unit - Set mana of Caster to 0.00"
Why exactly?

You can make an If/Then/Else and check if the Distance is larger than 600 and if so, you set the distance to 600.
(You limit Distance to be 600 then.)

However, this is not MUI... nor MPI.
Only one unit in your map can use this spell at the same time.
It is a very bad approach of doing such things.
Maybe you dont need it but that doesnt make it right.
 
Level 4
Joined
Dec 31, 2014
Messages
68
Hey, yeah I just did exactly what the tutorial said, I cant say I really understood the increment section or the arithmetic functions but It does work in-game. I wanted to post them to hear peoples thoughts on it also, Iv not done trigger spells before so I plead ignorance with all this haha.

The mana thing I wasn't decided on what I wanted to do with it's costs etc, I had a thought of it being like an 'ultimate' ability that drained all stam/ana but.. early days, the priority was to see if it would work or not!

I'll give your proposed if/then a go tomorrow but you said that what that tutorial did is a very bad approach to it? How would you do it?
I only really want something straight forward and not too fancy - just something to simulate dodging/evading/jumping out of the way of say an enemy charging at you etc, at the cost of their mana. I would want it for multiplayer use also by the way, is that what you mean by MUI/MPI?
Thanks
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
MUI is short for Multi Unit Instanceable.
It means that multiple units can make use of the same thing at the same moment.

Your spell isnt.
So if you cast the spell, then your unit will dash.
However, when another unit casts the same spell while the first is dashing, the first one will stop at that moment.

MPI is short for Multi Player Instanceable.
It means that multiple players can make use of the same thing at the same moment.
In this situation it would mean that only one unit for each player can dash at the same time.


I would use a system that handles dashes.
My Missile System is able to move units as well.
However, I didnt bother making it able to move the units with collision checks.
So your unit will be able to pass through other units, buildings, trees and cliffs.
Only when the dash ends, he gets placed on a spot that is walkable.

Any other dash system would work (if properly designed) and you should choose one based on your needs.
Why try making it yourself if you could instead use something that has already been made and tested several times?
 
Level 12
Joined
May 22, 2015
Messages
1,051
Distance is the total distance to travel. Increment is how far to travel each step. You stop when the total distance to travel is <= 0. I guess it is mostly just funny to call it "increment" when you are subtracting that amount. Increment means you increase lol.

Are you basically asking to cap this at a certain distance?

At this line:
Set Distance = (Distance between (Position of Caster) and DashPoint[1])
The distance may be larger than your max. Just add an if statement right after to cap it:
  • if (multiple actions)
    • condition
      • Distance is Greater than 1000
    • then (actions)
      • Set Distance = 1000
    • else (actions)
This will set it so that the distance cannot be more than 1000. You can change 1000 in the condition and in the then actions into any number you want (just make sure they match) and that will be the max distance it can go.

You can set the ability cast range to 99999 so that you can cast it anywhere and your hero will go in that direction.

A small tip, use breath of fire or carrion swarm instead of shockwave. Shockwave can cause weird lag spikes. If you set the travel distance to 0, it can cause permanent lag every time you cast it (until you quit the map lol).
 
Level 4
Joined
Dec 31, 2014
Messages
68
Hello all, apologies for the delay in my response. I managed to find another spell which supported this feature that I could adjust variables to cap the distance.

Hi Saus, yeah that was basically what I wanted to do thanks. About shockwave, oh good call, thanks for letting me know! I'm also trying to fix memory leaks in my map so that will help things along nicely.
 
Status
Not open for further replies.
Top