# Spawning Units in a circle

Status
Not open for further replies.

#### Sabelion

Level 9
Hey I am using GUI and I wonder how I spawn units in a circle around my caster when I cast a spell. Like summoning smoke in a wide circle around my caster and then making them a unit group so it like damages all units that stand close to it.

I did find a guide http://www.hiveworkshop.com/forums/f279/chapter-1-static-shapes-gui-7337/ but I doesnt understand alot of that. So if somebody just coud tell me how to figure out the points and stuffs like that or just give me a the code for a circle plz.

remember I use GUI.

#### Rmx

Level 19
Well try For loop integer A and spwan unit like offset of the hero by 300 and angle 60 x For loop integer A .... Remember to remove leaks

#### -Berz-

Level 37
You need a loop, and a formula, but formula depends on the number of units spawned, so make points at 360 / <number of units> x loop index.

#### Sabelion

Level 9
Well try For loop integer A and spwan unit like offset of the hero by 300 and angle 60 x For loop integer A .... Remember to remove leaks

This is what I did
• Fire Wall
• Events
• Unit - A unit Begins casting an ability
• Conditions
• (Ability being cast) Equal to Fire Wall
• Actions
• Set FireWallCaster = (Casting unit)
• Set FireWallMiddle = (Position of (Casting unit))
• Unit - Create 1 Fire Wall (Dummy) for Player 1 (Red) at (FireWallMiddle offset by 400.00 towards ((Real((Integer A))) x (360.00 / 36.00)) degrees) facing (Random angle) degrees
• Unit - Create 1 Fire Wall (Dummy) for Player 1 (Red) at (FireWallMiddle offset by 400.00 towards ((Real((Integer A))) x (360.00 / 36.00)) degrees) facing (Random angle) degrees
• Set FireWallDummy = (Last created unit)
• Trigger - Turn on Fire Wall Damage <gen>
• Trigger - Turn on Fire Wall Cancel <gen>
• Wait 6.00 seconds
• Trigger - Turn off Fire Wall Damage <gen>
• Trigger - Turn off Fire Wall Cancel <gen>
• Unit - Remove FireWallDummy from the game
This doesnt work, can somebody tell me what the problem is?

Yes I know that it has some leaks but It aint done yet. I will fix other stuffs once I get a circle

#### -Berz-

Level 37
Something like that

Now just put everything in a loop like this:

• spawn
• Events
• Conditions
• Actions
• For each (Integer A) from 1 to 36, do (Actions)
• Loop - Actions
• <your actions here>
Oh and create only one dummy in the loop not two, because loop will make 36 dummies, so if you leave 2 dummies it will create 72 dummies.

#### jadegolem

Level 7
• Trigger
• Events
• Conditions
• Actions
• For each Integer A from 1 to 12
• Loop - Actions
• Create 1 <Unit> at position of (Point offset by 500 towards (Real) degrees)
• Set Real: Real + 30

#### Sabelion

Level 9
Okey thanks guys any simple way of removing the spawned units?

Level 7
Add timed life?

#### Sabelion

Level 9
Worked thanks, and do somebody know how to ehh do so that all units in 150 range of the spawned units will take like 20 damage per second? I tried but as most of the times I tries, it didnt work out very well...
• Fire Wall Damage
• Events
• Time - Every 0.50 seconds of game time
• Conditions
• Actions
• Unit Group - Pick every unit in (Units within 150.00 of (Position of (Matching unit)) matching ((Unit-type of (Matching unit)) Equal to Fire Wall (Dummy))) and do (If (((Picked unit) belongs to an enemy of (Owner of (Matching unit))) Equal to True) then do (Unit - Cause (Matching unit) to damage (Picked unit), dealing 20.00 damage of attack type Spells and damage type Normal) else do (Do nothing))

#### Sabelion

Level 9
Ok nice ;P

Status
Not open for further replies.

Replies
6
Views
594
Replies
4
Views
734
Replies
2
Views
572
Replies
3
Views
582
Replies
6
Views
990