[JASS] Detecting Front Angle of a Unit

Level 4
Joined
May 21, 2015
Messages
69
I want to detect the front angle of a unit because I am making a custom unit cast a custom carrion swarm through triggers and I want it to be in jass

P.S: I am a noob in jass. I have attached a part of the trigger (Capture.png) it is in GUI first. I want the angle detection. :D
 

Attachments

  • Capture.PNG
    Capture.PNG
    64.2 KB · Views: 63
Level 13
Joined
Oct 8, 2012
Messages
498
Heya. Made you a test map with comments in it. Try to study it and became the most AWESOMENESS triggerer of wc3!
JASS:
scope TEST initializer onInit

globals
    unit GREEN_GUARD_DRAGON
    unit DUMMY
endglobals

function update takes nothing returns nothing
    local unit u = GREEN_GUARD_DRAGON
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real angle
 
    call SetUnitX(DUMMY, x)
    call SetUnitY(DUMMY, y)
 
    set angle = GetUnitFacing(u) * bj_DEGTORAD
    set x = x + 100 * Cos(angle)
    set y = y + 100 * Sin(angle)
    call IssuePointOrder(DUMMY, "carrionswarm", x, y)
endfunction

function onInit takes nothing returns nothing
    set GREEN_GUARD_DRAGON = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
    set DUMMY = CreateUnit(Player(0), 'h000', 0, 0, 0)
 
    call TimerStart(CreateTimer(), 1.00, true, function update)
endfunction

endscope
I have high hopes for you!
 

Attachments

  • DraDraDragooon!.w3x
    8.5 KB · Views: 31
Top