[JASS] Help with my JASS Spell

Status
Not open for further replies.
Glacier

JASS:
//============================================================================//
// TRIGGER INSTALLATION INSTRUCTION                                           //
//============================================================================//
//Copy and paste all scripts, dummy, and ability, into your maps, and gives   //
//credits for my work.                                                        //
//============================================================================//
//The_Dead_Fight                                                              //
//============================================================================//

function Trig_Glacier_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

//function Trig_Glacier_Func001A takes nothing returns nothing
    //call CreateNUnitsAtLoc( 1, 'h001', Player(0), GetUnitLoc(GetEnumUnit()), bj_UNIT_FACING )
    //call SetUnitAbilityLevelSwapped( 'A001', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A000', GetTriggerUnit()) )
    //call IssueTargetOrderBJ( GetLastCreatedUnit(), "entanglingroots", GetEnumUnit() )
    //call UnitApplyTimedLifeBJ( 0.65, 'BTLF', GetLastCreatedUnit() )
//endfunction

function Trig_Glacier_Actions takes nothing returns nothing
    local unit glaciercaster
    local integer glacierloop
    local location glaciercasterloc
    local location glaciertargetloc
    local real glacierangle
    local location array glaciertemppoint

    set glaciercaster = GetSpellAbilityUnit()
    set glaciercasterloc = GetUnitLoc(glaciercaster)
    set glaciertargetloc = GetSpellTargetLoc()
    set glacierangle = AngleBetweenPoints(glaciercasterloc, glaciertargetloc)
    set glacierloop = ( 7 + ( 2 * GetUnitAbilityLevelSwapped('A000', glaciercaster) ) )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = glacierloop
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call TriggerSleepAction( 0.25 )
        set glaciertemppoint[GetForLoopIndexA()] = PolarProjectionBJ(glaciercasterloc, ( -100.00 + ( 200.00 * I2R(GetForLoopIndexA()) ) ), glacierangle)
        call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(glaciercaster), glaciertemppoint[GetForLoopIndexA()], bj_UNIT_FACING )
        call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetLastCreatedUnit() )
        //call ForGroupBJ( GetUnitsInRangeOfLocAll(250.00, GetUnitLoc(GetLastCreatedUnit())), function Trig_Glacier_Func001A )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call RemoveLocation(glaciercasterloc)
    call RemoveLocation(glaciertargetloc)
    call RemoveLocation(glaciertemppoint[1])
    call RemoveLocation(glaciertemppoint[2])
    call RemoveLocation(glaciertemppoint[3])
    call RemoveLocation(glaciertemppoint[4])
    call RemoveLocation(glaciertemppoint[5])
    call RemoveLocation(glaciertemppoint[6])
    call RemoveLocation(glaciertemppoint[7])
    call RemoveLocation(glaciertemppoint[8])
    call RemoveLocation(glaciertemppoint[9])
    call RemoveLocation(glaciertemppoint[10])
    call RemoveLocation(glaciertemppoint[11])
    call RemoveLocation(glaciertemppoint[12])
    call RemoveLocation(glaciertemppoint[13])
    call RemoveLocation(glaciertemppoint[14])
    call RemoveLocation(glaciertemppoint[15])

endfunction

//===========================================================================
function InitTrig_Glacier takes nothing returns nothing
    set gg_trg_Glacier = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Glacier, function Trig_Glacier_Actions )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Glacier, EVENT_PLAYER_UNIT_SPELL_EFFECT )
endfunction

i want to make any unit around the ice freezed and take damage each second (spell based on etangle roots). Please fix it for me ^O^
 
Level 6
Joined
Jul 22, 2008
Messages
243
Did it work when you made it in GUI first? (It's obvious that you made it that first and converted)
 
Level 11
Joined
Apr 6, 2008
Messages
760
Some code improvments if u dont mind

first off the condition

JASS:
function Trig_Glacier_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
    endif
    return true
endfunction

should be

JASS:
function Trig_Glacier_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000' 
endfunction

next thing i did notice was the location array, srsly u need 1 location or use x/y

ill show u here how u use x/y cords

JASS:
function Trig_Glacier_Actions takes nothing returns nothing
    //Initializer locals spot on instead
    local unit glaciercaster = GetTriggerUnit() //Use Trigger unit it the fastest
    local location glaciertargetloc = GetSpellTargetLoc()
    local real x = GetUnitX(glaciercaster)
    local real y = GetUnitY(glaciercaster)
    local real glacierangle = Atan2(GetLocationY(glaciertargetloc)-y,GetLocationX(glaciertargetloc)-x) //This gets the angle
    local integer glacierloop = ( 7 + ( 2 * GetUnitAbilityLevel(glaciercaster,'A000' ) ) ) 
    local integer index = 0
    local player P = GetOwningPlayer(glaciercaster) //Owner of the caster, so get dont need to get the player everytime u loop
    local unit temp
    
    set x = x + 100 * Cos(glacierangle) //this set the x 100 range infront the caster
    set y = y + 100 * Sin(glacierangle) //same as above
    
    loop
        exitwhen index >= glacierloop
        call TriggerSleepAction( 0.25 ) //this isnt very friendly in multiplayer maps
        set temp = CreateUnit(P,'h000',x,y,bj_UNIT_FACING)
        call UnitApplyTimedLife(temp,'BTLF',5.00)
        //call ForGroupBJ( GetUnitsInRangeOfLocAll(250.00, GetUnitLoc(GetLastCreatedUnit())), function Trig_Glacier_Func001A )
        set index = index + 1
        set x = x + (200*index) * Cos(glacierangle) //this will get the x 200 range towards the targetlocation
        set y = y + (200*index) * Sin(glacierangle) //same as above
    endloop
    
    call RemoveLocation(glaciertargetloc)
    set glaciertargetloc = null
    set glaciercaster = null
    set P = null
    set temp = null
endfunction
 
Last edited:
Status
Not open for further replies.
Top