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

[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