Array
(
    [scriptVersion] => 7
    [oeValues] => Array
        (
            [Name] => Stasis Trap
            [Art] => ReplaceableTextures\CommandButtons\BTNStasisTrap.blp
            [Ubertip] => This trap is used by the orcs to stun their enemies. It's not very reliable though.
            [abilList] => Array
                (
                )

        )

    [settings] => Array
        (
            [author] => Boekie
            [authorDisplay] => |cff00CD00Boekie|r
            [balanceTip] => Array
                (
                )

            [rarity] => unique
            [goldcost] => 200
            [version] => 1.0
        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => Header
                    [code] => globals
    Unit array resultArray //Instead of numResults, use a resultArray so you only have to iterate once.
    endglobals
    
    //Do not remove or rename this function!
    //Put your initialization tasks here, this function will be called on map init
    private function init takes nothing returns nothing
	endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [name] => 
                            [goldcost] => 0
                            [explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => Periodic
                    [code] => local Tower tower = itm.getCarrier()
    local integer lvl = tower.getLevel()
    local Iterate inRange = Iterate.overUnitsInRangeOfCaster(tower,TARGET_TYPE_CREEPS,1000) //Can set this at the start.
    local Unit next //Used as next during the iterate and the unit to affect during the other loop.
    local integer indexCounter = 0
    local integer loopCounter = 3

      
    loop
        set next=inRange.next()
        exitwhen next==0
        set resultArray[indexCounter] = next
        set indexCounter = indexCounter+1
    endloop
   
    if(indexCounter > 0) then //Commented lines here are for setting the period to a low time when no creeps are around,
                              //remove them if you don't want this to happen. Also if these lines are used, the On Level
                              //Up code isn't needed.
        loop
            set loopCounter = loopCounter - 1
            set next = resultArray[GetRandomInt(0,indexCounter-1)]
            
            if tower.getLevel() == 25 then
                call cb_stun.applyOnlyTimed(tower, next, 1.0) 
            else
                call cb_stun.applyOnlyTimed(tower, next, 0.5) 
            endif
            
            call SFXAtUnit("Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl",next.getUnit())
            exitwhen loopCounter == 0
        endloop
    endif
                    [values] => Array
                        (
                            [visible] => true
                            [PERIODIC_period] => 8
                            [name] => Activate Trap
                            [goldcost] => 200
                            [explain] => Every |cffFFFF808|r seconds this trap stuns |cffFFFF803|r creeps in |cffFFFF801000|r range for |cffFFFF800.5|r seconds.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.5|r seconds stun at level |cffFFFF8025|r
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

)