• 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.

[JASS] Unit: move to a random Point in area and attack ground

Status
Not open for further replies.

JJE

JJE

Level 2
Joined
Jan 29, 2009
Messages
8
Hi all,
I need your help.

I want to make my skill to create Units at a point (already done) and then they should move to a random Point in the targeted area of the skill being cast and attack the ground (their attack is AoE, so thats possible).

My problem is: I dont know which natives or w.e. I should take to make them do so.

Hop you can help me and Thx in advance :)
 
JASS:
local location l = GetSpellTargetLoc()
local real angle = GetRandomReal(0, 2*bj_PI)
local real offset = GetRandomReal(0, AOE)
local real x = GetLocationX(l)+offset*Cos(angle)
local real y = GetLocationY(l)+offset*Sin(angle)
//spell stuff, whatever...
call IssuePointOrder(YourUnit, "attack ground", x, y)
//finish spell, clean leaks etc
Just change AOE to the area of effect of your spell, change YourUnit to the dummy unit you want to attack ground. I think the correct order string is "attack ground", but I'm not 100% sure. It should work, but I'll help you fix it if it doesn't.
 
Status
Not open for further replies.
Top