• 🏆 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] GetSpellTargetLoc undefined?

Status
Not open for further replies.
Level 6
Joined
Sep 9, 2006
Messages
92
Using channel as the base spell and it is a point target; trying to get that location to use its x and y values..
JASS:
scope Orb

globals
    private constant integer ABILITY_ID = 'A003'      //ability id of Spark Jump
    private constant integer DUMMY_ORB_ID = 'h001'    //orb id
endglobals

private struct data
    static hashtable h = InitHashtable()
    unit c
    integer lvl
    real dist
    timer tim = CreateTimer()
    
    static method periodic takes nothing returns nothing
    endmethod

    static method create takes nothing returns data
        local data this = data.allocate()
        local real x = GetLocationX(GetUnitLoc(GetTriggerUnit()))
        local real y = GetLocationY(GetUnitLoc(GetTriggerUnit()))
        local real angle = bj_RADTODEG * Atan2(GetLocationY(GetSpellTargetLoc) - y, GetLocationX(GetSpellTargetLoc) - x)
        set .c = GetTriggerUnit()
        set .lvl = GetUnitAbilityLevel(.c, ABILITY_ID)
        set .dist = 400. + (200. * I2R(.lvl))
        call IssuePointOrder(CreateUnit(GetOwningPlayer(.c), DUMMY_ORB_ID, x, y, 0), "move", (x + .dist * Cos(angle * bj_DEGTORAD)), (y + .dist * Sin(angle * bj_DEGTORAD)))
        call SaveInteger(.h,GetHandleId(.tim),0,this)
        call TimerStart(.tim,.01,true,function data.periodic)
        return this
    endmethod

    static method Conditions takes nothing returns nothing
        if GetSpellAbilityId() == ABILITY_ID then
            call .create()
        endif
    endmethod
/////////////////////////////////////////////////////////////////////////////////////////
    static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
        call TriggerAddAction( t, function data.Conditions )
    endmethod
 
endstruct
endscope
clearly not a complete spell but i get an error on the line defining "local real angle" saying "Undeclared variable GetSpellTargetLoc"

(and btw im pretty new to jass; im assumign there's a simple answer to this)
 
Status
Not open for further replies.
Top