• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Detecting Front Angle of a Unit

Status
Not open for further replies.
Level 4
Joined
May 21, 2015
Messages
70
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: 76
Level 14
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: 37
Status
Not open for further replies.
Top