• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Help with unit position.

Status
Not open for further replies.
Level 12
Joined
Mar 23, 2008
Messages
942
I want to make a rasengam spell that works that way:

You cast the spell
A clone appear at your side, facing you, and you facing the clone.
You gain the ability
The clone vanish

  • Rasengam Cast
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Rasengan (based in war stomp)
      • (Level of Rasengan (hand effect) for (Casting unit)) Equal to 0
    • Actions
      • Set SpellPoint[0] = ((Position of (Casting unit)) offset by (((Facing of (Casting unit)) + 5.00), ((Facing of (Casting unit)) + 5.00)))
      • Unit - Pause (Casting unit)
      • Unit - Create 1 Naruto bunshin for Neutral Passive at SpellPoint[0] facing ((Facing of (Casting unit)) + 180.00) degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Rasengan (hand effect) to (Casting unit)
      • Unit - Unpause (Casting unit)
But I'm really bad with positions things, I just did some random numbers to see what happens, but the clone appear inside me facing Idontknow what side o.o
 
Level 4
Joined
Jul 23, 2007
Messages
129
Well, for example, I am making a spell called "Summon Quezecotl". It summons a large yellow Quatl that rains down lightning on enemy units for 10 seconds (based off the Guardian Force from Final Fantasy VIII).

How could I create special effects to appear in a circle around the casting point? The idea is for a ring of electric splashes (chain lightning target graphic) to appear in a circle and, a few seconds later, Quezecotl appears in the center of the circle and begins attacking.

Right now the spell works fine, so all I really need is to figure this out to make it look cooler.
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
weather you know jass or gui, i'll try to explain the basic logic of this. Make a loop of say 36 steps(since full circle is 360 degrees, you would spawn 36 effects each 10 degrees aside from the past one. The number of effects you can easily adapt later). Inside a loop, determine the location as loc = >centerlocation<, offset by >radius< towards >loopcontrol*10<. This may sound complicated at first but i'll explain every little bit of it. Loop is needed to change the angle of your polar projection and to create multiple effects, of course. The number of steps of the loop determines the number of effects(plain and simple). centerlocation is self explanatory, i believe. radius is a fixed value or variable determining the radius of your circle. loopcontrol is a variable which counts loop steps(this is important) eg. if loop is on step 30 of 36 the angle should be 300 degrees. Since your control variable will almost never be 1:1 with the number of degrees(that would mean 360 steps!), you need a modifier to adjust the angle value. The modifier is calculated simply by dividing 360 with the number of steps, in our case 360/36 = 10. That modifier gives us exact angle to put our effect on. In order to destroy effects later on, it would be wise to store them in an array. I hope you'll find this helpful :D
 
Level 4
Joined
Jul 23, 2007
Messages
129
So, if, for example, I wanted a special effect at every degree I would do something like this
  • Events:
  • Unit begins the effect of an ability
  • Conditions:
  • Ability Being Cast equal to Summon Quezecoltl
  • Actions:
  • For Each Loop Integer from 1 - 360, do actions:
    • Actions:
    • Created Special Effect at (target point of ablility being cast) offset by (160) towards (loopcontrol x 10).
I assume the value in 'offset by' determines the radius of the circle, the larger the value the larger the circle that is created.

The towards loopconrol x 10 is the part I'm foggy on. Would you mind clarifying a bit?
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
you took that part for granted, i see. Your loop has 360 steps, meaning you'll have 360 effects. If you want one at every degree, that means the modifier is 360/360 = 1 and therefore changes nothing. the x10 part is the modifier and you must align it to give a full circle of effects otherwise you get too few or too much of them. The upper function is okay, just set the modifier to 1 aka remove it.
 
Level 4
Joined
Jul 23, 2007
Messages
129
Oh, I think I understand. So, if I only wanted 36 effects I would do this:

  • Events:
  • Unit begins the effect of an ability
  • Conditions:
  • Ability Being Cast equal to Summon Quezecoltl
  • Actions:
  • For Each Loop Integer from 1 - 36, do actions:
    • Actions:
    • Created Special Effect at (target point of ablility being cast) offset by (160) towards (loopcontrol x 10).
For 360 effects I would do this

  • Events:
  • Unit begins the effect of an ability
  • Conditions:
  • Ability Being Cast equal to Summon Quezecoltl
  • Actions:
  • For Each Loop Integer from 1 - 360, do actions:
    • Actions:
    • Created Special Effect at (target point of ablility being cast) offset by (160) towards (loopcontrol).
Finally, what is loopcontrol? Is it a point variable that I need to create or is it a function that I can select in the World Editor?
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
loopcontrol is a name of integer variable that counts loop steps. As far as i'm concerned, you can name it willy :D i just thought loopcontrol is more appropriate. Yes, considering the fact that it is an integer, it will require conversion to real to work for angle but that is no problem, i suppose.
 
Level 4
Joined
Jul 23, 2007
Messages
129
Willy, Hahaha. This is almost like having an IM conversation. You reply quick.

So, does Willy need to be an array? Then in the loop the function would say "Willy[Integer A]"?
 
Level 4
Joined
Jul 23, 2007
Messages
129
Do I need to have an action in my map initialization that sets Willy to equal Integer A?

EDIT: Allow me to clarify. My Question is how does the WE know that Willy stands for Integer A? Does it automatically assume so if there is no value already assigned to Willy? Or do I set Willy to always = integer A so that I can use him in loops like this one?
 
Level 4
Joined
Jul 23, 2007
Messages
129
Ok, when I get home from work I am going to try to create this:

  • Events:
  • Unit begins the effect of an ability
  • Conditions:
  • Ability Being Cast equal to Summon Quezecoltl
  • Actions:
  • For Each Loop Integer from 1 - 36, do actions:
    • Actions:
    • Create Special Effect (chain lightning target effect) at (target point of ablility being cast) offset by (160) towards (Integer A x 10).
This should create 36 electric splashes in a circle at 160 distance from the target point of the ability.

SOund good to you? If so, I'll post again once I've had a chance to create and test it. Thanks!
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
That is just perfect :D i hope you learned the logic now. However, many new but not so important problems will occur sooner or later, all coming directly from GUI hell XD Yes, the fearsome leaks are present in this function. Dough they won't interfere with the function's work, they may fill up the memory if the spell is cast often. The leak part is not my area of specialty but there is a load of good tutorials on how to remove them right here on the hive. As a little guideline, all handle extends leak(in this case effects and locations). You'll need to find your way towards polishing the trigger above but you made a good start. Good luck with it further on :D

p.s.
double posts are not really appreciated here, i advise you to use the edit button, just to keep yourself away from admin warnings.
 
Level 4
Joined
Jul 23, 2007
Messages
129
Thanks. It was an accident, after submitting my new post did not appear on the page so I submitted it again. Then suddenly both were there! Can and admin deleted one of them?
 
Level 4
Joined
Jul 23, 2007
Messages
129
Excellent! The Double-post is no more!!! I'm getting off work soon, so I'm gonna log off. Thanks for your help Volvox. If I had 10 or more rep I would gladly +REP you.

EDIT: Hey you gave me +REP! Awesome. That's my first point! Thanks very much.

EDIT2, 8/6/08 9:30am: Well I created the trigger last night and, WOOT, it works! I ran into a couple of funny problems, for example I accidenly put Integer A + 10 instead of x 10. Also, I accidenly set the trigger up to loop itself, so the effect kept firing over and over and created some wacky graphical glitches! Anyway, I solved these issues and it works perfectly.

After getting comfortable with the basics, I began to monkey with it a bit. The result is what is the coolest custom ability I've created to date.

When 'Summon Quezecoltl' is cast, a small ring of electricity appears around the target point (radius 100), then .5 seconds later another ring flashes farther out (radius 250), then farther (400), then another at 250 again,then another at 100, and then a huge plume of lightning strikes at 50 radius and Quezecotl appears inside the plume in a swirl of energy. Lightning rains down upon all enemy units in range for the next 10 seconds and then Quezecotl vanishes, returning to the ether from which he came.

It looks so cool. I can whip up a sample map for the spell and post it if you would like to see it. It isn't anywhere near efficient enough to post in the spells forum, but its works for my purposes. Maybe my next goal should be to make it submit-able.
 
Last edited:
Status
Not open for further replies.
Top