• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[Spell] How do "Magic circle"

Status
Not open for further replies.
Level 6
Joined
Apr 16, 2011
Messages
158
Well I'd like help making a magic pulled units in a certain region, the area of effect spell is like a circle.
The problem is I want an effect where the units are pulled slowly to the caster
The effect is going to a certain region and returns to the User who launched,
so when the effect is to pull back the units, someone knows how to do?
I leave here the model I have, I do not remember where ...

GUI no matter what method, Jass, just give me a direction
 

Attachments

  • magiccircle.mdx
    2.1 KB · Views: 78
Level 7
Joined
Jul 3, 2011
Messages
251
Give a few more details please.

Do you want this circle to follow the caster if he moves? If not will the caster be able to move? Do you want it to pause the units being pulled back or make it able for them to attempt to run?
 
Level 7
Joined
Jul 3, 2011
Messages
251
On contraction, you can just decrease a real so it will be the same radius as the dummies, EnumUnitsInRange it, check if they are allies/buildings/invulnerable/and if you want, magic immune, if all checks out then move that unit towards the caster by an amount you set.

To move units towards the caster, get the casters x and y with
JASS:
set x = GetUnitX(whichunit) 
set y = GetUnitY(whichunit)
then do this
JASS:
set x2 = x + <distance> * Cos((<angle>) * bj_DEGTORAD)
set y2 = y + <distance> * Sin((<angle>) * bj_DEGTORAD)
You can get the angle with
JASS:
function AngleBetweenPoints takes location locA, location locB returns real
    return bj_RADTODEG * Atan2(GetLocationY(locB) - GetLocationY(locA), GetLocationX(locB) - GetLocationX(locA))
endfunction
Which would be
JASS:
bj_RADTODEG * Atan2(<secondY> - <firstY>, <secondX> - <firstX>)
Then
JASS:
SetUnitX(whichunit, x2)
SetUnitY(whichunit, y2)
 
Status
Not open for further replies.
Top