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

[Spell] Area around Casting Unit

Status
Not open for further replies.
Level 5
Joined
Aug 6, 2009
Messages
136
Here's a little idea of what I want to do, it's rather simple but it will help me understand things.

When the Hero casts Windwalk, 6 positions around the hero (or more if possible) will be marked for a few seconds.
Then, the marked areas will change into some sort of an explosion which will hurt enemies in that area.

My main problem is.
How do I find out the value of a circle around the position of the Hero casting a spell?
Since I need the positions, I also need to calculate the area.
But i'm very unsure of how this will work out.

Thanks in advance.
 
Level 12
Joined
Oct 16, 2010
Messages
680
1.save x/y coordinate of unit position
2. determine the effect's coords by this formula
effect's coords are x2,y2
the distence between unit and the effects (the radius) is r
the angle toward the effect is deg

x2 = x+cos(deg)*r
y2 = y+sin(deg)*r

determine the effects locasions like this then group units around these points within a range what u prefer when they explode
 
Level 25
Joined
May 11, 2007
Messages
4,651
Haven't tried it yet, but it should be something like this:

Trigger 1: Marking 6 places

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Big Boss - Big Slam
  • Actions
    • Set tempPoint1 = (Position of (Triggering unit))
    • Set tempInt2 = 6
    • For each (Integer tempInt) from 1 to tempInt2, do (Actions)
      • Loop - Actions
        • Set tempReal = (60.00 x (Real(tempInt)))
        • Set tempPoint2 = (tempPoint1 offset by 256.00 towards tempReal degrees)
        • Unit - Create 1 Circle of Power for (Owner of (Triggering unit)) at tempPoint2 facing Default building facing degrees
        • Unit - Add a 4.00 second Water Elemental expiration timer to (Last created unit)
        • Custom script: call RemoveLocation(udg_tempPoint2)
    • Custom script: call RemoveLocation(udg_tempPoint1)
Trigger 2: Explosions!
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Circle of Power
  • Actions
    • Set tempPoint1 = (Position of (Triggering unit))
    • Special Effect - Create a special effect at tempPoint1 using Explosions\ExplosionBIG.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_tempPoint1)
Just give the Circle of Power (or your dummy unit that you want) the Goblin Mine - Damage Upon Death ability.
After 4 seconds, all enemy units near the circles take a big whooping damage.
 
Level 5
Joined
Aug 6, 2009
Messages
136
So this is how it looks like in-game.
I tried to change the number on the "TMInteger 2" from 6 to 8.
That 'caused a bit lag. But other than that it works as I want it too.

I think it's easier to learn when you have it right in front of oneself.

As for now, thanks!

Also, you chose the "Water elemental" as an expiration timer. Does it matter which one I chose for any specific purposes?
 

Attachments

  • Test Spells.w3x
    21.9 KB · Views: 73
Status
Not open for further replies.
Top