• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Chain Freezing Spell

Status
Not open for further replies.
Level 16
Joined
Mar 3, 2006
Messages
1,564
This spell was made long ago by Darky27 when this site was named wc3sear.ch and I don't even know where has he gone.

Its good spell but at that time MUI and leaks was of little concern thats why you may - or may not; as I am not profesional with JASS - found some leaks or not MUI.

Here is the script taken exactly from his map:

JASS:
//===========================================================================
// Trigger:       Chain Freezing
// Script Author: Darky27
// Info:          Like chainlightning.. just better
//===========================================================================

function Trig_Chain_Freezing_Conditions takes nothing returns boolean
    return ( GetSpellAbilityId() == 'A000' )
endfunction

function Trig_Chain_Freezing_Actions takes nothing returns nothing
    local real height
    local real time
    local real raisetime
    set udg_ChainFreezingCounter = 0
    call CreateNUnitsAtLoc( 1, 'e001', Player(0), GetUnitLoc(GetSpellAbilityUnit()), bj_UNIT_FACING )
    call SetUnitInvulnerable( GetLastCreatedUnit(), true )
    call SetUnitPathing( GetLastCreatedUnit(), false )
    set udg_ChainFreezingUnit = GetLastCreatedUnit()
    call UnitAddAbilityBJ( 'Aloc', udg_ChainFreezingUnit )    
    call StartTimerBJ( udg_ChainFreezingTimer, true, 0.03 )
    set height = GetUnitDefaultFlyHeight(udg_FrostTarget)
    if (height < 40) then
        set height = 40
    endif
    set time = DistanceBetweenPoints(GetUnitLoc(udg_ChainFreezingUnit), GetUnitLoc(udg_FrostTarget)) / 1000
    set raisetime = (RAbsBJ(height - GetUnitFlyHeight(udg_ChainFreezingUnit))) / time
    call SetUnitFlyHeightBJ( udg_ChainFreezingUnit, height, raisetime )
endfunction

function Trig_Chain_Freezing_Target_Conditions takes nothing returns boolean
    return ( GetIssuedOrderIdBJ() == String2OrderIdBJ("sleep") )
endfunction

function Trig_Chain_Freezing_Target_Actions takes nothing returns nothing
    set udg_FrostTarget = GetOrderTargetUnit()
endfunction

function Trig_Chainfreezing_Group takes nothing returns boolean
    return (( IsUnitEnemy(GetFilterUnit(), Player(0)) == true ) and ( GetFilterUnit() != udg_FrostTarget ) and ( IsUnitAliveBJ(GetFilterUnit()) == true ))
endfunction

function Trig_Chainfreezing_Timer_Actions takes nothing returns nothing
    local real height
    local real time
    local real raisetime
    local unit temp
    call SetUnitPositionLoc( udg_ChainFreezingUnit, PolarProjectionBJ(GetUnitLoc(udg_ChainFreezingUnit), 30.00, AngleBetweenPoints(GetUnitLoc(udg_ChainFreezingUnit), GetUnitLoc(udg_FrostTarget))) )
    if ( DistanceBetweenPoints(GetUnitLoc(udg_ChainFreezingUnit), GetUnitLoc(udg_FrostTarget)) <= 50.00 ) then
        set udg_ChainFreezingCounter = udg_ChainFreezingCounter + 1
        if ( IsUnitIdType(GetUnitTypeId(udg_FrostTarget), UNIT_TYPE_FLYING) == true ) then
            call AddSpecialEffectTargetUnitBJ( "origin", udg_FrostTarget, "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl" )
            call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        else
            call AddSpecialEffectTargetUnitBJ( "origin", udg_FrostTarget, "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl" )
            call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        endif
        call CreateNUnitsAtLocFacingLocBJ( 1, 'e000', Player(0), PolarProjectionBJ(GetUnitLoc(udg_FrostTarget), 100.00, 0.00), GetUnitLoc(udg_FrostTarget) )
        set temp = GetLastCreatedUnit()
        call SetUnitInvulnerable( temp, true )
        call IssueTargetOrderBJ( temp, "frostnova", udg_FrostTarget )

        set udg_FrostTarget = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(800, GetUnitLoc(udg_FrostTarget), Condition(function Trig_Chainfreezing_Group)))
        set height = GetUnitDefaultFlyHeight(udg_FrostTarget)
        if (height < 40) then
            set height = 40
        endif
        if (udg_FrostTarget == null) then
            set udg_ChainFreezingCounter = 2 + (udg_ChainFreezingLevel * 2)
        endif
        set time = DistanceBetweenPoints(GetUnitLoc(udg_ChainFreezingUnit), GetUnitLoc(udg_FrostTarget)) / 1000
        set raisetime = (RAbsBJ(height - GetUnitFlyHeight(udg_ChainFreezingUnit))) / time
        call SetUnitFlyHeightBJ( udg_ChainFreezingUnit, height, raisetime )
        if (udg_ChainFreezingCounter == 2 + (udg_ChainFreezingLevel * 2) ) then
            call PauseTimerBJ( true, udg_ChainFreezingTimer )
            call UnitRemoveAbilityBJ( 'Aloc', udg_ChainFreezingUnit )
            call RemoveUnit( udg_ChainFreezingUnit )
        endif
    endif
endfunction

function Trig_Chainfreezing_Research_Conditions takes nothing returns boolean
    return ( GetLearnedSkillBJ() == 'A000' ) 
endfunction

function Trig_Chainfreezing_Research_Actions takes nothing returns nothing
    set udg_ChainFreezingLevel = udg_ChainFreezingLevel + 1
endfunction

function Trig_Chain_Freezing_Remove_Conditions takes nothing returns boolean
    return ( GetSpellAbilityId() == 'A001' )
endfunction

function Trig_Chain_Freezing_Remove_Actions takes nothing returns nothing
    call RemoveUnit( GetSpellAbilityUnit() )
endfunction

//===========================================================================
function InitTrig_Chain_Freezing takes nothing returns nothing
    local trigger Chain_Freezing_Remove = CreateTrigger(  )
    local trigger Chainfreezing_Research = CreateTrigger(  )
    local trigger Chainfreezing_Timer = CreateTrigger(  )
    local trigger Chain_Freezing_Target = CreateTrigger(  )
    set gg_trg_Chain_Freezing = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Chain_Freezing, Player(0), EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddCondition( gg_trg_Chain_Freezing, Condition( function Trig_Chain_Freezing_Conditions ) )
    call TriggerAddAction( gg_trg_Chain_Freezing, function Trig_Chain_Freezing_Actions )
    call TriggerRegisterPlayerUnitEventSimple( Chain_Freezing_Target, Player(0), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerAddCondition( Chain_Freezing_Target, Condition( function Trig_Chain_Freezing_Target_Conditions ) )
    call TriggerAddAction( Chain_Freezing_Target, function Trig_Chain_Freezing_Target_Actions )
    call TriggerRegisterTimerExpireEventBJ( Chainfreezing_Timer, udg_ChainFreezingTimer )
    call TriggerAddAction( Chainfreezing_Timer, function Trig_Chainfreezing_Timer_Actions )
    call TriggerRegisterPlayerUnitEventSimple( Chainfreezing_Research, Player(0), EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( Chainfreezing_Research, Condition( function Trig_Chainfreezing_Research_Conditions ) )
    call TriggerAddAction( Chainfreezing_Research, function Trig_Chainfreezing_Research_Actions )
    call TriggerRegisterPlayerUnitEventSimple( Chain_Freezing_Remove, Player(0), EVENT_PLAYER_UNIT_SPELL_FINISH )
    call TriggerAddCondition( Chain_Freezing_Remove, Condition( function Trig_Chain_Freezing_Remove_Conditions ) )
    call TriggerAddAction( Chain_Freezing_Remove, function Trig_Chain_Freezing_Remove_Actions )
endfunction

I have started this thread because I wanted to bring this spell into attention. So what do you think of it ?
 
Status
Not open for further replies.
Top