• 🏆 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!

Marci Rebound from Dota 2

Status
Not open for further replies.
Level 4
Joined
Jun 16, 2012
Messages
25
So I wanted to recreate my favorite hero in dota 2 since shes not in dota 1 yet, but i'm stumped on how i could make her second ability rebound work

Its an ability that is cast on a unit, she leaps on top of the unit and then instantly rebounds to a targeted location wherever the mouse is hovering.
any tips/ideas? id rather stay way from having 2 separate abilities that switch out because i think it would be buggy however i probably can do it that way if no one else has any ideas

i think all i would need is to get the mouse position of the player but im not sure how to do that
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,641

I can tell you now that it's not going to perform well, especially online, but it's worth a shot.

I imagine the best method would be to detect the usage of the ability order, then cancel that order and enable mouse tracking, and display the vector targeting indicator using Special Effects that follow the mouse. The mouse tracking process would use some fairly simple math to get the distance/angle between the target unit and your mouse. The min/max distance limit can be applied at the end with a simple If Then Else that checks:
If distance < X then set distance to X and if distance > Y then set distance to Y.

You would then need a way to cancel the mouse tracking process, which I guess would be done by checking if the Marci player issues another order/right clicks/left clicks their mouse. You could then put the ability on cooldown/spend the mana cost and finally run the trigger which handles the movement/damage/stun stuff.

Edit:
I attached a demo map with the targeting component of Rebound implemented. There's still a lot more to do but I got you started.
 

Attachments

  • Rebound 1.w3m
    64.5 KB · Views: 9
Last edited:

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,641
I was bored and felt like finishing it :peasant-ok-hand:

I think it turned out okay but I'm sure there's some bugs. Also, for some reason I couldn't get the Channel ability to ignore Enemy Units in it's Targets Allowed field (1.33 bug?) so you'll probably want to switch to an ability that can only target Allies. Oh and there's some GetLocalPlayer() usage in there to hide the Special Effect / Lightning from other players, if you experience Desyncs then it's safe to assume it has to do with them.
 

Attachments

  • Rebound 3.w3m
    45.8 KB · Views: 13
Last edited:

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,641
No problem, and I just updated the map again to fix some minor issues that were bothering me.

Nothing major, I added some Stop orders and Animation resets to the "end" parts of the Movement trigger so that the Hero's animation doesn't get frozen. It's an issue that stems from the SetUnitAnimationByIndex() function. Once that function's animation is finished it doesn't automatically reset like the other animation functions do.

The Stop orders are there to prevent weirdness that revolves around the BlzPauseUnitEx() function but may be unnecessary in this case. This function came with I want to say version 1.32 and acts like a triggered Stun. The issue is that it can cause unwanted Orders to be issued by the Unit multiple times in rapid succession. It probably has something to do with the fact that I'm calling it in response to a "A unit Starts the effect of an ability" Event. Anyway, the Stop order seems to fix it so I added it, better safe than sorry. Another important thing about BlzPauseUnitEx() is that it stacks using a counter system-at least it did last time I tested it. Meaning if you run it twice on a unit, setting the boolean to True (true = stun, false = unstun), you'll need to Unstun that unit twice to remove the stun effect. These counters can probably even go in the negatives preventing future stuns from happening (sort of cool if you could create Stun immunity with this). Long story short, if you start playing around with this function and notice units getting permanently Stunned, now you know why.

Some things that could be improved:
  • Lightning could take into consideration Z-height. At the moment it's clipping through the ground and will not play nice with terrain height.
  • Damage could come from the Hero rather than the Dummy - Useful for Kill credits in "A unit dies" triggers.
  • Flying Height is handled poorly. A smooth arcing motion can be achieved with some extra effort.
  • The Movement triggers use the SetUnitX/Y functions which ignore Pathing entirely. This means that you can easily get stuck in Deep water, on cliffs, and out of bounds. A Pathing checker could be implemented to prevent the unit from reaching these spots but that might limit the movement capabilities in an undesirable way.
  • The MouseUtils system Registers each player by default which is convenient but could also be unnecessary if only a select few players take advantage of it. This could probably be managed by Unregistering/Registering Players manually.
 
Last edited:
Status
Not open for further replies.
Top