Spell Ice Trap

BRUTAL

I'm working
Reaction score
118
Ice Trap

Requires GTrigger, Key Timers 2; all included in the map.

Spell Description: Icicles pop out of the ground circling a targeted unit, and trapping everything inside. Any ground units trapped inside cannot get out, and no ground units can enter. This ability can be used to separate you from an army, and fight off a smaller number of enemy at a time. Deals damage per second to enemy ground units near the icicles.

Screen Shots:
icetrap1qz5.jpg


icetrap2wc7.jpg

Code:
JASS:
// Ice Trap by BRUTAL.
// Requires GT, and KT2.
// Credits are welcome but not necessary.
// October 12th 2009.

scope icetrap initializer init

globals
    private constant integer ID='A000' // ID of the ice trap spell.
    private constant integer IMMO_ID='A001' // ID of the ice immolation spell.
    private constant integer DUMMY_ID='h000' // ID of the ice trap unit.
    private constant integer PATH_BLOCK='YTpb' // ID of the path blocker that is created.
    private constant real PERIOD=.04 // Period of the KT2 timer.
    private constant real SCALE=1. // Scale size of ice trap unit.
    private constant integer ALPHA=75 // Percent transparency of ice trap unit.
    private constant integer MAX_UNITS=36 // Number of units that will circle around.
endglobals

private constant function DURATION takes integer level returns real
    return 6.+3.*level
endfunction

private constant function DISTANCE takes integer level returns real
    return 270.+ 20.*level
endfunction

private struct Data
    unit caster
    real x
    real y
    real angle
    integer pbInt=0
    integer ticks
    integer maxTicks
    destructable array pathBlock[MAX_UNITS]
    
    static method create takes unit u, real tx, real ty returns Data
        local Data data=Data.allocate()
        set data.caster=u
        set data.x=tx
        set data.y=ty
        set data.angle=GetUnitFacing(u)+140
        set data.ticks=R2I(DURATION(GetUnitAbilityLevel(data.caster,ID))/PERIOD)+10
        set data.maxTicks=data.ticks
        return data
    endmethod
    
    method circle takes nothing returns nothing
        local integer level=GetUnitAbilityLevel(.caster,ID)
        local real dis=DISTANCE(level)
        local real dur=DURATION(level)
        local real x=.x+dis*Cos(.angle*bj_DEGTORAD)
        local real y=.y+dis*Sin(.angle*bj_DEGTORAD)
        local unit u=CreateUnit(GetOwningPlayer(.caster),DUMMY_ID,x,y,bj_RADTODEG*Atan2(y-.y,x-.x))
        call SetUnitScale(u,SCALE,SCALE,SCALE)
        call SetUnitVertexColor(u,255,255,255,R2I(2.55*ALPHA))
        call UnitApplyTimedLife(u,'BTLF',dur)
        call UnitAddAbility(u,IMMO_ID)
        call SetUnitAbilityLevel(u,IMMO_ID,level)
        call IssueImmediateOrder(u,"immolation")
        set .angle=.angle+360./MAX_UNITS
        set .pathBlock[.pbInt]=CreateDestructable(PATH_BLOCK,x,y,0,1,0)
        set .pbInt=.pbInt+1
        set u=null
    endmethod
    
    method end takes nothing returns nothing
        local integer i=0
        loop
        exitwhen i==MAX_UNITS
            call KillDestructable(.pathBlock<i>)
            set i=i+1
        endloop
    endmethod
endstruct 

private function PeriodicFunc takes nothing returns boolean
    local Data data=KT_GetData()
    set data.ticks=data.ticks-1
    if data.ticks&lt;=0 then  
        call data.end()
        return true
    else
        if data.ticks&gt;=data.maxTicks-MAX_UNITS then
            call data.circle()
        endif
    return false
    endif  
endfunction 

private function actions takes nothing returns nothing
    call KT_Add(function PeriodicFunc,Data.create(GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY()),PERIOD)
endfunction

private function init takes nothing returns nothing
    call TriggerAddAction(GT_RegisterStartsEffectEvent(CreateTrigger(),ID),function actions)
endfunction

endscope</i>


Feedback is welcomed, if you see any bugs or mistakes let me know.
DL the map.
 

Attachments

  • Ice Trap gui.w3x
    51 KB · Views: 777
  • Ice Trap vJass.w3x
    54.4 KB · Views: 557
1

131ackout

Guest
OMG, THATS INTENSE!!!!

+rep :p

EDIT: Can't give the rep, have to spread first. :)
 

Kazuga

Let the game begin...
Reaction score
110
Didn't you make this for the spellcontest...? Cause I have seen this in the contest and I assume you made it?
Anyway it looks awsome.
 

Ghostwind

o________o
Reaction score
172
It looks pretty nice. Maybe to add it so that it makes the weather snow around the area when you use it =)
 

BRUTAL

I'm working
Reaction score
118
OMG, THATS INTENSE!!!!

+rep

EDIT: Can't give the rep, have to spread first.
thanks :p

Didn't you make this for the spellcontest...? Cause I have seen this in the contest and I assume you made it?
Anyway it looks awsome.
ya, i did note the
This is one of the spells that i submitted for the second Hero Contest. I just fixed it up the code, and made MUI.
that i put :p
thanks though

It looks pretty nice. Maybe to add it so that it makes the weather snow around the area when you use it =)
ty, i'll try that
 

BRUTAL

I'm working
Reaction score
118
okay, added the snow effects, and fixed the loading screen saying "wind tunnel" :p
 
1

131ackout

Guest
I don't see any snow effects in the screenshot.

I'm busy, don't have time to test the map.

:p
 

BRUTAL

I'm working
Reaction score
118
ya, i dont feel like adding new screenshots ><
just test it when you got time :p
 

Sim

Forum Administrator
Staff member
Reaction score
534
There's a little mess in the tooltip, has something to do with color codes. :p

The collision thing is messy. Sometimes the Ice Lord can pass through the wall, sometimes he cannot. Seriously though, remove that feature. Nobody can pass through ice, whether or not he created it. :p Adds a strategy feature too: don't trap yourself in!

This part of the code is causing it, most probably:

Code:
Five
    Events
        Time - Every 0.01 seconds of game time
    Conditions
        (Number of units in ItWalkUg) Greater than 0
    Actions
        Unit Group - Pick every unit in ItUg2 and do (Actions)
            Loop - Actions
                Set TempInt = (Custom value of (Picked unit))
                Set ItTriggUnitPos[TempInt] = (Position of ItTriggunit[TempInt])
                Set ItWalkPos[TempInt] = (Position of ItWalkThrough[TempInt])
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        And - All (Conditions) are true
                            Conditions
                                (Distance between ItWalkPos[TempInt] and ItTriggUnitPos[TempInt]) Greater than (220.00 + ((Real((Level of Ice Trap  for ItCaster[TempInt]))) x 20.00))
                                (Distance between ItWalkPos[TempInt] and ItTriggUnitPos[TempInt]) Less than (340.00 + ((Real((Level of Ice Trap  for ItCaster[TempInt]))) x 20.00))
                    Then - Actions
                        Unit - Turn collision for ItCaster[TempInt] Off
                    Else - Actions
                        Unit - Turn collision for ItCaster[TempInt] On
        Custom script:   call RemoveLocation(udg_ItTriggUnitPos[udg_TempInt])
        Custom script:   call RemoveLocation(udg_ItWalkPos[udg_TempInt])

Apart from that, well done!
 

BRUTAL

I'm working
Reaction score
118
There's a little mess in the tooltip, has something to do with color codes.
o? i'll check it out

The collision thing is messy. Sometimes the Ice Lord can pass through the wall, sometimes he cannot. Seriously though, remove that feature. Nobody can pass through ice, whether or not he created it. Adds a strategy feature too: don't trap yourself in!
i know, i couldnt get it perfect . Originally that feature was not put in, i added it because someone suggested it and i thought it would be okay
i might as well take it out if i cant perfect it :p
thanks anyways
---------------------
Okay, uploaded a new file;
-fixed the tooltips
-fixed a levelskip problem
-removed the walk in/out part
-added new screenshots
 

BRUTAL

I'm working
Reaction score
118
i would, but its about the spells, not the hero :p
plus that would make the file size go up
 

Sim

Forum Administrator
Staff member
Reaction score
534
Merge your other (future) spells in (a) spellpack(s) please, but do not add this one. It will stay as a single submission.
 
B

Bonebuster

Guest
Healing

Maybe if u are traped in circle it heals u or something like that really cool spell :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top