Someone requested that I show how to create a simple trigger based leap "ability". The full tutorial is actually the documentation in the trigger comments of a downloadable example at: http://www.sc2mapster.com/assets/simple-leap-function/
What this function does is allow you to give it any "casting" unit, and a point(even a position of a unit), and an animation to be played for the "casting" unit, and it will simulate a leaping motion on the "casting" unit from its initial position to the position of the target, while playing the given animation.
This isn't a tutorial in the strictest of sense, but since this is completely trigger based I felt a heavily documented example would serve a lot more useful then just a lot of pictures with explanation.
I think this looks quite bad...Its not as smooth as I hoped.
Im not sure how could you make the ability smoother, since you dont want to be too slow and it should look like a natural jump.
I quess that would work for a tutorial anyway. You can propably figure way to make the jump look better with changing the values.
edit* If you want to make leap spell look like a half circle instead of triangle, you can also use mathetmatic functions like sin. Then you dont even need to detect when unit starts to go down.
example:
5*Sin(4*tmpReal) = units flying height;
where 5 = amplitude(how hight the unit will go),
(4*tmpReal) = how fast will the unit rise/lower itself (tmpReal is used inside the loop to increase the value, like this; tmpReal = tmpReal + 1).
I dont remember too mucha bout math, but I think this formula produces good results too and simplifies the leap spell.
I dont bother explaining how the sin works, but you should test it out. NO NEED FOR DETECTING UNIT GOING DOWN/UP
I know it's some time since the last post (106 days) ^^ but since I stumped over this topic, others might as well. So to make a perfect half-circle as zenx1 says, use the form here:
middleHeight*(sine(distance%)*pi)
where middleHeight is the height you want the unit to have at the top-point. If you want that perfect half-circle, middleHeight should be the distance between startPoint and endPoint devided by two.
and distance% is how far the unit has already traveled according to the start-distance between the start point and end-point.
You just update this value as you move the unit from the start-point towards the end-point. The only value that should be modified is distance%, middleHeight is just a constant.
EDIT: Apparently the editor have decided to use American math-values, what a shame.. For this form, just replace PI by 180
Someone requested that I show how to create a simple trigger based leap "ability". The full tutorial is actually the documentation in the trigger comments of a downloadable example at: http://www.sc2mapster.com/assets/simple-leap-function/
What this function does is allow you to give it any "casting" unit, and a point(even a position of a unit), and an animation to be played for the "casting" unit, and it will simulate a leaping motion on the "casting" unit from its initial position to the position of the target, while playing the given animation.
This isn't a tutorial in the strictest of sense, but since this is completely trigger based I felt a heavily documented example would serve a lot more useful then just a lot of pictures with explanation.
I notice you have a collapsed if statement there in the while loop. anything important inside? :-P
@solthar: Go
Agh yeah thats my fault, here is the collapsed block (You can also download the map at: http://www.sc2mapster.com/assets/simple-leap-function/ to view it in the trigger editor)
I think this looks quite bad...Its not as smooth as I hoped.
Im not sure how could you make the ability smoother, since you dont want to be too slow and it should look like a natural jump.
I quess that would work for a tutorial anyway. You can propably figure way to make the jump look better with changing the values.
example:
5*Sin(4*tmpReal) = units flying height;
where 5 = amplitude(how hight the unit will go),
(4*tmpReal) = how fast will the unit rise/lower itself (tmpReal is used inside the loop to increase the value, like this; tmpReal = tmpReal + 1).
I dont remember too mucha bout math, but I think this formula produces good results too and simplifies the leap spell.
I dont bother explaining how the sin works, but you should test it out. NO NEED FOR DETECTING UNIT GOING DOWN/UP