Unstable Duplicate v1.00

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
This is my first vJass skill. Everything about the skill is on the map. I've made all explanations about the skill on the map. You can set it's damage or decide it shall kill trees or not by commands. Thanks for testing it.

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

function Trig_UD_cast_Func000A takes nothing returns boolean
    if ( not ( udg_Temp_IndexSize == 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_UD_cast_Func001A takes nothing returns boolean
    if ( not ( udg_Temp_IndexSize > udg_Temp_IndexMax ) ) then
        return false
    endif
    return true
endfunction

function Trig_UD_cast_Actions takes nothing returns nothing
    if ( Trig_UD_cast_Func000A() ) then
        call EnableTrigger( gg_trg_UD_loop )
    else
    endif
    set udg_Temp_IndexSize = ( udg_Temp_IndexSize + 1 )
    if ( Trig_UD_cast_Func001A() ) then
        set udg_Temp_Index[udg_Temp_IndexSize] = udg_Temp_IndexSize
        set udg_Temp_IndexMax = udg_Temp_IndexSize
    else
    endif
    set udg_Temp_Int = udg_Temp_Index[udg_Temp_IndexSize]
    set udg_Temp_Unit1[udg_Temp_Int] = GetTriggerUnit()
    set udg_Temp_Unit2[udg_Temp_Int] = GetSpellTargetUnit()
    set udg_Temp_Loc1 = GetUnitLoc( udg_Temp_Unit1[udg_Temp_Int] )
    set udg_Temp_Loc2 = GetUnitLoc( udg_Temp_Unit2[udg_Temp_Int] )
    set udg_Temp_Facing1[udg_Temp_Int] = AngleBetweenPoints( udg_Temp_Loc1, udg_Temp_Loc2 )
    set udg_Temp_Real1[udg_Temp_Int] = DistanceBetweenPoints( udg_Temp_Loc1, udg_Temp_Loc2 )
    call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer( udg_Temp_Unit1[udg_Temp_Int] ), PolarProjectionBJ( udg_Temp_Loc1, 70.00, GetUnitFacing( udg_Temp_Unit1[udg_Temp_Int] ) ), GetUnitFacing( udg_Temp_Unit1[udg_Temp_Int] ) )
    set udg_Temp_Unit3[udg_Temp_Int] = GetLastCreatedUnit()
    call SetUnitVertexColorBJ( udg_Temp_Unit3[udg_Temp_Int], 66.00, 66.00, 66.00, 50.00 )
    set udg_Temp_Loc3 = GetUnitLoc( udg_Temp_Unit3[udg_Temp_Int] )
    set udg_Temp_Effect1 = "Abilities\\Spells\\Undead\\Possession\\PossessionMissile.mdl"
    set udg_Temp_Effect2 = "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl"
    call SetUnitPathing( udg_Temp_Unit3[udg_Temp_Int], false )
    call PauseUnitBJ( true, udg_Temp_Unit3[udg_Temp_Int] )
    set udg_Temp_Targetloc1[udg_Temp_Int] = PolarProjectionBJ( GetUnitLoc( udg_Temp_Unit2[udg_Temp_Int] ), udg_Temp_Real1[udg_Temp_Int], udg_Temp_Facing1[udg_Temp_Int] )
    call RemoveLocation( udg_Temp_Loc1 )
    call RemoveLocation( udg_Temp_Loc2 )
    call RemoveLocation( udg_Temp_Loc3 )
endfunction

//===========================================================================
function InitTrig_UD_cast takes nothing returns nothing
    set gg_trg_UD_cast = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_UD_cast, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_UD_cast, Condition( function Trig_UD_cast_Conditions ) )
    call TriggerAddAction( gg_trg_UD_cast, function Trig_UD_cast_Actions )
endfunction
[/hidden]

JASS:
function Trig_UD_loop_Func005A takes nothing returns boolean
    if ( not ( udg_Temp_Boolean == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_UD_loop_Func001A takes nothing returns boolean
    if ( not ( udg_Temp_Unit1[udg_Temp_Int] != null ) ) then
        return false
    endif
    return true
endfunction

function Trig_UD_loop_Func002A takes nothing returns boolean
    if ( not ( udg_Temp_IndexSize == 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_UD_loop_Func003A takes nothing returns boolean
    if ( not ( IsUnitInGroup( udg_Temp_Unit3[udg_Temp_Int], GetUnitsInRangeOfLocAll( 70.00, udg_Temp_Targetloc[udg_Temp_Int] ) ) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_UD_loop_Func004A takes nothing returns boolean
    if ( not ( IsUnitInGroup( udg_Temp_Unit2[udg_Temp_Int], GetUnitsInRangeOfLocAll( 70.00, udg_Temp_Targetloc1[udg_Temp_Int] ) ) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_UD_loop_Func006A takes nothing returns nothing
    call KillDestructable( GetEnumDestructable() )
endfunction

function Trig_UD_loop_Actions takes nothing returns nothing
    set udg_Temp_Loop = 1
    loop
        exitwhen udg_Temp_Loop > udg_Temp_IndexSize
        set udg_Temp_Int = udg_Temp_Index[udg_Temp_Loop]
        if ( Trig_UD_loop_Func001A() ) then
            set udg_Temp_Targetloc[udg_Temp_Int] = GetUnitLoc( udg_Temp_Unit2[udg_Temp_Int] )
            set udg_Temp_Loc2 = GetUnitLoc( udg_Temp_Unit2[udg_Temp_Int] )
            set udg_Temp_Loc3 = GetUnitLoc( udg_Temp_Unit3[udg_Temp_Int] )
            set udg_Temp_Distance_Between[udg_Temp_Int] = DistanceBetweenPoints( udg_Temp_Loc2, udg_Temp_Loc3 )
            call SetUnitPositionLoc( udg_Temp_Unit3[udg_Temp_Int], PolarProjectionBJ( udg_Temp_Loc3, 35.00, AngleBetweenPoints( udg_Temp_Loc3, udg_Temp_Loc2 ) ) )
            call RemoveLocation( udg_Temp_Loc2 )
            call RemoveLocation( udg_Temp_Loc3 )
        else
        endif
        if ( Trig_UD_loop_Func003A() ) then
            if ( Trig_UD_loop_Func005A() ) then
                call EnumDestructablesInCircleBJ( 150.00, GetUnitLoc( udg_Temp_Unit2[udg_Temp_Int] ), function Trig_UD_loop_Func006A )
            else
            endif
            call SetUnitVertexColorBJ( udg_Temp_Unit3[udg_Temp_Int], 0.00, 0.00, 0.00, 100.00 )
            call AddSpecialEffectTargetUnitBJ( "head", udg_Temp_Unit2[udg_Temp_Int], udg_Temp_Effect1 )
            call DestroyEffectBJ( GetLastCreatedEffectBJ() )
            call PauseUnitBJ( true, udg_Temp_Unit2[udg_Temp_Int] )
            call SetUnitPathing( udg_Temp_Unit2[udg_Temp_Int], false )
            set udg_Temp_Loc2 = GetUnitLoc( udg_Temp_Unit2[udg_Temp_Int] )
            set udg_Temp_Distance_Between1[udg_Temp_Int] = DistanceBetweenPoints( udg_Temp_Loc2, udg_Temp_Targetloc1[udg_Temp_Int] )
            call SetUnitPositionLoc( udg_Temp_Unit2[udg_Temp_Int], PolarProjectionBJ( udg_Temp_Loc2, 25.00, udg_Temp_Facing1[udg_Temp_Int] ) )
            call AddSpecialEffectLocBJ( udg_Temp_Loc2, udg_Temp_Effect2 )
            call DestroyEffectBJ( GetLastCreatedEffectBJ() )
            call RemoveLocation( udg_Temp_Loc2 )
        else
        endif
        if ( Trig_UD_loop_Func004A() ) then
            call UnitDamageTargetBJ( udg_Temp_Unit1[udg_Temp_Int], udg_Temp_Unit2[udg_Temp_Int], udg_Temp_Damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
            call RemoveUnit( udg_Temp_Unit3[udg_Temp_Int] )
            call RemoveLocation( udg_Temp_Targetloc1[udg_Temp_Int] )
            call PauseUnitBJ( false, udg_Temp_Unit2[udg_Temp_Int] )
            call SetUnitPathing( udg_Temp_Unit2[udg_Temp_Int], true )
            set udg_Temp_Index[udg_Temp_Loop] = udg_Temp_Index[udg_Temp_IndexSize]
            set udg_Temp_Index[udg_Temp_IndexSize] = udg_Temp_Int
            set udg_Temp_IndexSize = ( udg_Temp_IndexSize - 1 )
            set udg_Temp_Loop = ( udg_Temp_Loop - 1 )
            if ( Trig_UD_loop_Func002A() ) then
                call DisableTrigger( GetTriggeringTrigger() )
                return
            else
            endif
        else
        endif
        set udg_Temp_Loop = ( udg_Temp_Loop + 1 )
    endloop
endfunction

//===========================================================================
function InitTrig_UD_loop takes nothing returns nothing
    set gg_trg_UD_loop = CreateTrigger(  )
    call DisableTrigger( gg_trg_UD_loop )
    call TriggerRegisterTimerEventPeriodic( gg_trg_UD_loop, 0.03 )
    call TriggerAddAction( gg_trg_UD_loop, function Trig_UD_loop_Actions )
endfunction
[/hidden]

Keywords:
duplicate, image, loop, jass, unstable
Contents

Unstable Duplicate (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 14:59, 18th Aug 2012 Maker: Coding is not good enough. Get rid of all the functions coloured red.

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

14:59, 18th Aug 2012
Maker: Coding is not good enough. Get rid of all the functions coloured red.
 
Level 37
Joined
Mar 6, 2006
Messages
9,242
JASS:
function Trig_UD_cast_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A001' ) ) then
        return false
    endif
    return true
endfunction
->
JASS:
function Trig_UD_cast_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction

I changed the category to JASS since this is not vJASS. It looks more like GUI converted to JASS.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
yes, BJ's are really not needed, they only call natives which you can do by yourself. There is very small amount of BJs that may be usefull such as BJDebugMsg or in some cases if you are too lazy to do your own ForGroup then GroupAddGroup may be handy
 
Top