• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[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 8
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 8
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