1.24 Problem: Help fix the best spells I've seen

SanKakU

Member
Reaction score
21
http://www.wc3c.net/showthread.php?p=1106529#post1106529

I'm not sure how many of you can tell what the spells do just by looking at the code, and if you don't want to go back to 1.23 to check out the spells, i don't blame you, but I assure you, these spells are amazing.

There is also a new fiery hero model/skin that the fire spells would probably go quite good with.

The Fire Dissipation, sweet, don't remember the other stuff but that one alone is well worth salvaging.
Really, the Ball and Chain spell is really great too, it was amazing to see just how fantastic a custom spell could be. it didn't feel like any other war3 spell in the slightest(like if there were a brand new melee hero, - which isn't going to happen- he would have a spell like this maybe). It's all amazing. Let me quote JonNny as to the current problem, sums it up quite nicely:

"Sure it cannot work because of the changes which came with the patch
I used H2I which could easily replaced with the new GetHandleId() function
but all those I2U or I2E cannot be relaced and i would have to rewrite a big part of the script changing everything to Hashtables and stuff"

I posted something about this awhile ago...not sure where or even if it was at this forum... the I2U and I2E problem...I know this 1.24 stuff is still pretty new to everyone but I hope these awesome spells might be good incentive for some of you smart coders out there to tackle the new hashtables and whatever.
 

Jesus4Lyf

Good Idea™
Reaction score
397
It's really not that hard.
JASS:
globals
    hashtable TYPECAST_HASH=InitHashtable()
endglobals
function H2I takes agent h returns integer
    local integer id=GetHandleId(h)
    call SaveAgentHandle(TYPECAST_HASH,0,id,h)
    return id
endfunction
//! textmacro I2X takes LETTER, TYPE, CASETYPE
function I2$LETTER$ takes integer id returns $TYPE$
    return Load$CASETYPE$Handle(TYPECAST_HASH,0,id)
endfunction
//! endtextmacro
//! runtextmacro I2X("E","effect","Effect")
//! runtextmacro I2X("U","unit","Unit")
// And so on.

Go finish it. :)
 

SanKakU

Member
Reaction score
21
doing that, i'm not sure what to do next, do i also need to save a game cache into the hashtable for example? how would i do that?
 

Jesus4Lyf

Good Idea™
Reaction score
397
It replaces everything at the "X2X" level. In other words...

It provides a different set of H2I, I2U, I2E, etc, all using hashtables.
Forget gamecache. Just finish the different I2X functions you need with the textmacro lines like [LJASS]//! runtextmacro I2X("L","location","Location")[/LJASS].
 

SanKakU

Member
Reaction score
21
oh wow, so.........idk, i guess i'm going about the problem all wrong.

anyway...:banghead:
okay. so like, i screwed up LHS which used H2I, i guess i fixed it simply by renaming all that LHS H2I as H2IOLD.

so going back i'm trying to figure out what's missing. just doing that and what you wrote warcraft at least will load up now. but, the spell is far from working, but i'm not sure why. the unit disappears and the fires do not move anywhere and that's it. it might just be some stupid overlooked error that i can't find, but idk.
 

SanKakU

Member
Reaction score
21
You're not showing any code.

I cannot help you.

ok, what i mean is...i did exactly as you showed, and then, i did in the globals section:

gamecache cache

i did this because i was getting errors about gamecache.
now even though doing that made the errors go away, the spells aren't working.

the code of the spells is in the thread which i linked, but i'll post it here, since you seem to be requesting that.

going over some of that, i feel like i kindof remember that i'm not sure what the event was, and that it might be cast rather than effect, which is more usual, but using cast and the other spell event's don't work alike. they all will do the same thing which is what i described above.

JASS:
globals
    hashtable TYPECAST_HASH=InitHashtable()
    gamecache cache
endglobals
function H2I takes agent h returns integer
    local integer id=GetHandleId(h)
    call SaveAgentHandle(TYPECAST_HASH,0,id,h)
    return id
endfunction
function I2U takes integer id returns unit
    return LoadUnitHandle(TYPECAST_HASH,0,id)
endfunction

// And so on.


// Fire Dissipation
// Fire/Heat - Submission for the Spell Olympics 2008
// Created by JonNny aka WorIdEdit - Please give credits if you use this Spell
// in your map
scope dissipation initializer I
globals
private integer i
private integer ii
private constant real Speed = 9.00  //The Speed of the Spirits
private constant real TimerEvent = 0.02 //How fast the Timer runs
private constant real circle = 4.00 //The Speed of the Spirits circling arround the Target Location
private constant integer GlowNumber = 8 // The Number of created Spirits which move
private constant real ExplosionRange = 450.00 // The Range of the Explosion dealing damage and pushing units away
private constant string Effect = "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl" //The Model of the Explosion appearing when being recomposed
endglobals 


private function firedissipationheight takes real maxdistance returns real
    return maxdistance/8 + 150  // The max. height the Spirits reach on their movement
endfunction

private function DamageDealt takes integer level returns real
    return 25.00+(55.00*I2R(level)) // The max. dealt damage on explosion
endfunction

private function PushRate takes integer level returns real
    return 2.50+(3.75*I2R(level)) // The rate of units being pushed away
endfunction

private function IsUnitPushedAway takes unit u , unit uu returns boolean 
// change the Conditions for the affected units here (push only)
return (u!= uu) and (IsUnitType(u, UNIT_TYPE_STRUCTURE) == false ) and (GetUnitState(u, UNIT_STATE_LIFE) > 0)
endfunction 

private function IsUnitDamaged takes unit u , unit uu returns boolean
// change the Conditions for the affected units here (Damage)
return (IsPlayerEnemy(GetOwningPlayer(u), GetOwningPlayer(uu)) == true ) and (IsUnitType(u, UNIT_TYPE_STRUCTURE) == false ) and (GetUnitState(u, UNIT_STATE_LIFE) > 0) and ( IsUnitType(u, UNIT_TYPE_MECHANICAL) == false ) and ( IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false )
endfunction

private function FadeOut takes integer red , integer green , integer blue , unit u  returns nothing
local integer q = 1
local integer qq= 4
    loop
        exitwhen q>qq
        call SetUnitVertexColor(u,red,green,blue,(255-(64*q)))   
        call TriggerSleepAction(0.01)
        set q = q + 1
    endloop
    call ShowUnit(u, false)
endfunction

private function FadeIn takes integer red , integer green , integer blue , unit u returns nothing
local integer q = 1
local integer qq= 4
    call ShowUnit(u, true)
    loop
        exitwhen q>qq
        call SetUnitVertexColor(u,red,green,blue,(64*q))   
        call TriggerSleepAction(0.01)
        set q = q + 1
    endloop
endfunction

private function DestroyEffectDelayed takes real t , effect e returns nothing
call TriggerSleepAction(t)
call DestroyEffect(e)
endfunction

private function Damage takes nothing returns nothing 
    local timer t = GetExpiredTimer()
    local unit u = I2U(GetStoredInteger(cache,I2S(H2I(t)),"Hero"))
    local location l = GetUnitLoc(u)
    local real move = GetStoredReal(cache,I2S(H2I(t)),"dmg") 
    local real distance = ExplosionRange
    local group g =  GetUnitsInRangeOfLocMatching(ExplosionRange,l,Filter(function FilterDebug))
    local unit a= null
    local real x = 0.00
    local real y =  0.00
    local real xx = GetUnitX(u)
    local real yy = GetUnitY(u)
    local real dx = 0.00
    local real dy = 0.00
    local real d = 0.00
    local real angle = 0.00
    loop
        set a = FirstOfGroup(g)
        exitwhen a==null
        call GroupRemoveUnit(g,a)

            set x = GetUnitX(a)
            set y = GetUnitY(a)
            set angle = bj_RADTODEG * Atan2(y - yy, x - xx)
            if (a != u) and IsUnitPushedAway(a,u)  then
                set dx = xx - x
                set dy = yy - y
                set d = SquareRoot(dx*dx+dy*dy)
                call SetUnitX(a,x + move*((ExplosionRange-d)/ExplosionRange) * Cos(angle * bj_DEGTORAD))
                call SetUnitY(a,y + move*((ExplosionRange-d)/ExplosionRange) * Sin(angle * bj_DEGTORAD))
            else
            endif
    endloop
    if move > 0 then 
        call StoreReal(cache, I2S(H2I(t)), "dmg", (move-0.25))
        call TimerStart(t,TimerEvent,false,function Damage)
    else 
        call FlushStoredMission(cache, I2S(H2I(t))) 
    endif
    call RemoveLocation(l)
    set l = null
    set a = null
    set u = null
    set t = null
    call DestroyGroup(g)
    set g = null
endfunction

private function Move takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit glow = I2U(GetStoredInteger(cache, I2S(H2I(t)), "Glow"))
    local location l = GetUnitLoc(glow)
    local real angle = GetStoredReal(cache,I2S(H2I(t)),"angle")
    local real distance = GetStoredReal(cache,I2S(H2I(t)),"maxd")
    local real moved = GetStoredReal(cache,I2S(H2I(t)),"moved")
    local real x = GetLocationX(l) + Speed * Cos(angle * bj_DEGTORAD)
    local real y = GetLocationY(l) + Speed * Sin(angle * bj_DEGTORAD) 
    local integer Movement = GetStoredInteger(cache,I2S(H2I(t)),"Movement")
    local effect explosion = null
    local unit hero = null
    local real movement = 0.00
    local integer level
    local location loc = null
    local group g = null
    local unit a = null
    local real d = 0.00
    local real dx = 0.00
    local real dy = 0.00
    if Movement == 1 then
    call SetUnitPosition( glow , x,y )
    set moved = moved + Speed
    call SetUnitFlyHeight (glow , (80.00 + Sin((moved/(1.75*distance))*3.1415)*firedissipationheight(distance)) , 400)
    call StoreReal(cache, I2S(H2I(t)), "maxd", distance)
    call StoreReal(cache, I2S(H2I(t)), "moved", moved) 
    call StoreInteger(cache, I2S(H2I(t)), "Glow", H2I(glow))  
    if moved > distance then 
        set angle = bj_RADTODEG * Atan2(y - GetStoredReal(cache,I2S(H2I(t)),"yt"), x - GetStoredReal(cache,I2S(H2I(t)),"xt"))
        call StoreInteger(cache, I2S(H2I(t)), "Movement", 2)  
        call StoreReal(cache, I2S(H2I(t)), "maxd", GetUnitFlyHeight(glow))
        call StoreReal(cache, I2S(H2I(t)), "moved", 0.00) 
        call StoreReal(cache, I2S(H2I(t)), "angle", angle)
    else 
    endif  
    call TimerStart(t,TimerEvent,false,function Move)
else
if moved*1.5 > distance then
        if GetStoredInteger(cache,I2S(H2I(t)),"MoveHero") == 1 then
            set hero = I2U(GetStoredInteger(cache, I2S(H2I(t)), "Hero"))
            call SetUnitPosition( hero, GetStoredReal(cache,I2S(H2I(t)),"xt"),GetStoredReal(cache,I2S(H2I(t)),"yt")) 
            call FadeIn.execute(255,255,255,hero)    
            call PauseUnit(hero, false)  
            call SetUnitPathing( hero, true )            
            if (GetLocalPlayer() == GetOwningPlayer(glow)) then
            call SelectUnit(hero ,true)
            endif
            call StoreInteger(cache, I2S(H2I(t)), "MoveHero", 2)
            set moved = moved + 75.00
            set hero = null
            else
        endif
else
endif
    if moved > distance then 
        if GetStoredInteger(cache,I2S(H2I(t)),"MoveHero") == 2 then
            set level = GetStoredInteger(cache,I2S(H2I(t)),"level")
            set hero = I2U(GetStoredInteger(cache, I2S(H2I(t)), "Hero"))
            set loc = GetUnitLoc(hero)
            set explosion = AddSpecialEffectLoc(Effect, loc)  
            call DestroyEffect(explosion)
            call StoreInteger(cache, I2S(H2I(t)), "Hero", H2I(hero))
            call StoreReal(cache, I2S(H2I(t)), "dmg", PushRate(level))
            set g =  GetUnitsInRangeOfLocMatching(ExplosionRange,loc,null)
            call TimerStart(t,0.15,false,function Damage) 
            loop
                set a = FirstOfGroup(g)
                exitwhen a==null
                call GroupRemoveUnit(g,a)
                set bj_lastCreatedEffect = AddSpecialEffectTarget("Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl" , a, "chest")
                call DestroyEffectDelayed.execute(0.15,bj_lastCreatedEffect)
                set dx = GetUnitX(a) - GetUnitX(hero)
                set dy = GetUnitY(a) - GetUnitY(hero)
                set d = SquareRoot(dx*dx+dy*dy)
                if  IsUnitDamaged(a,hero) and hero != a then
                    call UnitDamageTarget(hero, a, DamageDealt(level)*((ExplosionRange-d)/ExplosionRange), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                else 
                endif
 
            endloop              
            
            call DestroyGroup(g)
            set g = null
            set a = null

            call RemoveLocation(loc)
        else
        call FlushStoredMission(cache, I2S(H2I(t)))         
        endif
        call RemoveUnit(glow)
    else            
        call SetUnitFlyHeight (glow , (distance-moved) , 1000)
        call SetUnitPosition( glow ,  GetStoredReal(cache,I2S(H2I(t)),"xt") + (120*(1-(moved/distance))) * Cos(angle * bj_DEGTORAD),GetStoredReal(cache,I2S(H2I(t)),"yt") + (120*(1-(moved/distance))) * Sin(angle * bj_DEGTORAD) )
        set moved = moved + (0.3*Speed) 
        set angle = angle + circle + 4*(moved/distance)
        call StoreReal(cache, I2S(H2I(t)), "moved", moved) 
        call StoreReal(cache, I2S(H2I(t)), "angle", angle) 
        call TimerStart(t,TimerEvent,false,function Move)
    endif 
    call RemoveLocation(l)
endif
    set glow = null
    set loc = null
    set t = null
    set hero = null 
    set explosion = null
    set l = null
endfunction

private function Dissipation takes nothing returns nothing
    local unit array u
    local timer array t
    local location array l
    local unit caster = GetTriggerUnit()
    local real x = GetUnitX(caster)
    local real y = GetUnitY(caster)
    local real angle =0.00
    local real distancemax = 0.00
    local location target2 = GetSpellTargetLoc()
    local location target = null
    local unit testposition = CreateUnitAtLoc(GetOwningPlayer(caster),'h00P',target2,0) 
    local real array xt
    local real array yt
    local real size = GetRandomReal(180,300)
    set target = GetUnitLoc(testposition)
    call RemoveUnit(testposition)
    call FadeOut.execute(255,255,255,caster)
    set i = 1
    set ii = GlowNumber 
        loop
        exitwhen i>ii
        set size = GetRandomReal(275,350)
        set xt<i> = GetLocationX(target) + (120.00 * Cos( 360 / ii * i * bj_DEGTORAD))
        set yt<i> = GetLocationY(target) + (120.00 * Sin( 360 / ii * i * bj_DEGTORAD))
        set t<i> = CreateTimer()
        set l<i> = Location(x + GetRandomReal(50.00,125.00) * Cos(GetRandomReal(0.00,360.00) * bj_DEGTORAD),y + GetRandomReal(25.00,150.00) * Sin(GetRandomReal(0.00,360.00) * bj_DEGTORAD)) 
        set u<i> =  CreateUnit(GetOwningPlayer(caster),&#039;h00Q&#039;,x,y,0)  
        call SetUnitScale( u<i>, size*0.01, size*0.01, size*0.01)
        call IssuePointOrderLoc( u<i>, &quot;move&quot;, l<i> )
        set distancemax = SquareRoot((GetLocationX(l<i>)-xt<i>)*(GetLocationX(l<i>)-xt<i>)+(GetLocationY(l<i>)-yt<i>)*(GetLocationY(l<i>)-yt<i>))
        set angle = bj_RADTODEG * Atan2(GetLocationY(l<i>) - yt<i>, GetLocationX(l<i>) - xt<i>) +180.00
        call FadeIn.execute(GetRandomInt(25,200),GetRandomInt(125,255),GetRandomInt(25,200),u<i>)
        call StoreReal(cache, I2S(H2I(t<i>)), &quot;angle&quot;, angle)
        call StoreReal(cache, I2S(H2I(t<i>)), &quot;xt&quot;, GetLocationX(target)) 
        call StoreReal(cache, I2S(H2I(t<i>)), &quot;yt&quot;, GetLocationY(target)) 
        call StoreReal(cache, I2S(H2I(t<i>)), &quot;maxd&quot;, distancemax)
        call StoreReal(cache, I2S(H2I(t<i>)), &quot;moved&quot;, 0.00) 
        call StoreInteger(cache, I2S(H2I(t<i>)), &quot;Glow&quot;, H2I(u<i>)) 
        call StoreInteger(cache, I2S(H2I(t<i>)), &quot;Movement&quot;, 1) 
        if i == ii then
             call StoreInteger(cache, I2S(H2I(t<i>)), &quot;level&quot;, GetUnitAbilityLevel(GetTriggerUnit(),&#039;A058&#039;))
             call StoreInteger(cache, I2S(H2I(t<i>)), &quot;Hero&quot;, H2I(GetTriggerUnit()))
             call StoreInteger(cache, I2S(H2I(t<i>)), &quot;MoveHero&quot;, 1)
        else 
        endif
        call TimerStart(t<i>,0.75,false,function Move)    
        call RemoveLocation(l<i>)
        set t<i> = null
        set l<i>= null
        set u<i> = null
        set i = i + 1
    endloop
    call TriggerSleepAction(0.50)
    call PauseUnit(GetTriggerUnit(), true)  
    call SetUnitPathing( GetTriggerUnit(), false )  
    set testposition = null
    set caster = null
    call RemoveLocation(target)
    call RemoveLocation(target2)
    set target = null
endfunction

private function A takes nothing returns nothing
    if GetSpellAbilityId() == &#039;A058&#039; then
call Dissipation()
endif
endfunction
private function I takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TAF_PUE( t,EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddAction( t, function A )
endfunction
endscope</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>

that was fire dissipation, the one i like the most, the others are also great and i want to get them working too and are just set aside for now in a disabled trigger:
JASS:

// Chained Up //
// Created by JonNny aka WorIdEdit - Please give credits if you use this Spell
// in your map //
globals 
private constant real BoulderHeight = 50.00 //The height of the boulder when lying of the ground
private constant real ChainHeight = 40.00 //Defines the height the chain will lock up
private constant real ChainPartDistance = 35.00 //The Distance between each part of the chain 
private constant real ChainHoldTimer = 0.03 //Set the time the Chain function executes
private constant string BoulderDeathEffect = &quot;Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl&quot; //The effect which appears when the boulder is removed
private constant real BoulderSpeedThrown = 12.00 //The speed the boulder is thrown
endglobals


private function BoulderWeight takes real level returns real
    return (0.5-0.15*level)  //Declares how easy it is to pull this boulder (1 = 100% = easy  , 0 = 0% = not moveable)
endfunction

private function ChainLength takes real level returns real
    return 375.00-(50.00*level)  //Defines the length of the chain for each level
endfunction

private function Duration takes real level returns real
    return 12+(4*level) // The Time this Boulder will last
endfunction

private function Height takes real d returns real
    return 0.70*d  // The max.height the Boulder will reach on this throw
endfunction

private function ChainedUpID takes nothing returns boolean
    return GetSpellAbilityId() == &#039;A05A&#039; //The condition this script runs (Casted spell must be your spell)
endfunction

private function GetDistance takes unit u , unit uu returns real
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real xx = GetUnitX(uu)
    local real yy = GetUnitY(uu)
    return SquareRoot((xx-x)*(xx-x)+(yy-y)*(yy-y))
endfunction

private function RemoveUnitDelayed takes unit u , real t returns nothing
call TriggerSleepAction(t)
call RemoveUnit(u)
endfunction

private function ChainHold takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit array chain
local unit target = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;target&quot;))
local unit boulder = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;boulder&quot;))
local real x = GetUnitX(target)
local real y = GetUnitY(target)
local real xx = GetUnitX(boulder)
local real yy = GetUnitY(boulder)
local real s = 0.00
local real level = GetStoredInteger(cache, I2S(H2I(t)), &quot;level&quot;)
local real d = ChainLength(level)
local real angle = bj_RADTODEG * Atan2(y - yy, x - xx)
local real z = 0.00
local real tb = GetDistance(target,boulder)
local effect e = null
local location l = null
if GetDistance(target,boulder) &gt; d then
    set angle = bj_RADTODEG * Atan2(y - yy, x - xx)
    set s = (tb - d )* BoulderWeight(level)
    call SetUnitX(target,(xx + d * Cos(angle * bj_DEGTORAD)))
    call SetUnitY(target,(yy + d * Sin(angle * bj_DEGTORAD)))
    call SetUnitPosition( boulder ,( GetUnitX(boulder)+ s * Cos((0+angle) * bj_DEGTORAD)),(GetUnitY(boulder)+ s * Sin((0+angle) * bj_DEGTORAD)))
else
endif
set i = 1
set ii = GetStoredInteger(cache, I2S(H2I(t)), &quot;ChainParts&quot;)

    loop
        exitwhen i&gt;ii
        set chain<i> = I2U(GetStoredInteger(cache, I2S(H2I(t)), I2S(i)))
        call SetUnitFacingTimed( chain<i>, angle+90, 0.01 )
        set z = ChainHeight +(I2R(i)/I2R(ii)*GetUnitFlyHeight(target))- (Sin(((GetDistance(chain<i>,boulder)/tb))*3.1415)*ChainHeight*2.25*((1-tb/ChainLength(GetStoredInteger(cache, I2S(H2I(t)), &quot;level&quot;)))))
        call SetUnitFlyHeight (chain<i> , z , 400)
        set x = GetUnitX(boulder) + (((tb-45)*i/ii)+45)*0.95 * Cos(angle * bj_DEGTORAD)
        set y = GetUnitY(boulder) + (((tb-45)*i/ii)+45)*0.95 * Sin(angle * bj_DEGTORAD)
        call SetUnitPosition(chain<i>,x,y)
        set chain<i> = null
        set i = i + 1
    endloop   
if (GetUnitState(target, UNIT_STATE_LIFE) &gt; 0) and (GetUnitState(boulder, UNIT_STATE_LIFE) &gt; 0) then
    call TimerStart(t,ChainHoldTimer,false,function ChainHold)
else
set i = 1
set ii = GetStoredInteger(cache, I2S(H2I(t)), &quot;ChainParts&quot;)
    loop
        exitwhen i&gt;ii
        set chain<i> = I2U(GetStoredInteger(cache, I2S(H2I(t)), I2S(i)))
        call RemoveUnit(chain<i>)
        set chain<i> = null
        set i = i + 1
    endloop 
    set l = GetUnitLoc(boulder)
    set e = AddSpecialEffectLoc(BoulderDeathEffect,l)
    call DestroyEffect(e)
    call KillUnit(boulder)
    set e = null
    call RemoveLocation(l)
    set l = null
    call RemoveUnitDelayed.execute(boulder,0.25)
call FlushStoredMission(cache, I2S(H2I(t))) 
endif
set boulder = null
set target = null
set t = null
endfunction

private function BoulderThrow takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit boulder = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;boulder&quot;)) 
local unit target = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;target&quot;)) 
local real z = 0.00
local unit caster = null
local real d = GetStoredReal(cache, I2S(H2I(t)), &quot;d&quot;)
local real angle = bj_RADTODEG * Atan2(GetUnitY(boulder) - GetUnitY(target), GetUnitX(boulder) - GetUnitX(target))+180.00
local real dd = GetDistance(boulder,target) 
local integer level = GetStoredInteger(cache, I2S(H2I(t)), &quot;level&quot;)
local unit array chain
local real tx
local real ty
local effect e = null
local location l = null
if dd &lt; 100 then 
    set caster = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;caster&quot;)) 
    call SetUnitPathing(boulder, true )   
    call SetUnitTimeScale(boulder, 0.00)
    call SetUnitFlyHeight (boulder , BoulderHeight , 4000)
    call SetUnitPosition( boulder ,GetUnitX(boulder),GetUnitY(boulder))
    set l = GetUnitLoc(boulder)
    set e = AddSpecialEffectLoc(BoulderDeathEffect,l)
    call DestroyEffect(e)
    set e = null
    call RemoveLocation(l)
    set l = null
    set i = 1
    set ii = R2I((ChainLength(level)-45)/ChainPartDistance)
    call StoreInteger(cache, I2S(H2I(t)), &quot;ChainParts&quot;, ii)
    loop
        exitwhen i&gt;ii
        set tx =  GetUnitX(boulder) + (dd*i/ii) * Cos(angle * bj_DEGTORAD)
        set ty =  GetUnitY(boulder) + (dd*i/ii) * Sin(angle * bj_DEGTORAD)
        set chain<i> = CreateUnit(GetOwningPlayer(caster),&#039;h00S&#039;,tx,ty,angle) 
        call SetUnitTimeScale(chain<i>, 2.50)
        call StoreInteger(cache, I2S(H2I(t)), I2S(i), H2I(chain<i>))
        set chain<i> = null
        set i = i + 1
    endloop    
    call TimerStart(t,ChainHoldTimer,false,function ChainHold)
    set caster = null
else 
    set z = 0.00 + Sin(((d-dd+100)/(d)*3.1415))*Height(d)
    call UnitAddAbility(boulder, &#039;Amrf&#039;)
    call UnitRemoveAbility(boulder, &#039;Amrf&#039;)
    call SetUnitFlyHeight (boulder , z , 4000)

    call SetUnitPosition(boulder,GetUnitX(boulder) + BoulderSpeedThrown * Cos(angle * bj_DEGTORAD),GetUnitY(boulder) + BoulderSpeedThrown * Sin(angle * bj_DEGTORAD))
    call TimerStart(t,ChainHoldTimer,false,function BoulderThrow) 
endif    
set t = null
set boulder = null 
set target = null   
endfunction

private function ChainUp takes nothing returns nothing
    local unit u = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local real xx = GetUnitX(target)
    local real yy = GetUnitY(target)
    local real tx = 0.00
    local real ty = 0.00
    local integer level = GetUnitAbilityLevel(u,&#039;A05A&#039;)
    local timer t = CreateTimer()
    local unit boulder = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),&#039;h00R&#039;,xx,yy,0.00) 
    local real x = GetUnitX(boulder)
    local real y = GetUnitY(boulder)
    local real d = SquareRoot((xx-x)*(xx-x)+(yy-y)*(yy-y))
    local real angle = bj_RADTODEG * Atan2(yy - y, xx - x)
    call SetUnitPathing(boulder, false )
    call UnitAddAbility(boulder, &#039;Amrf&#039;)
    call UnitRemoveAbility(boulder, &#039;Amrf&#039;)
    call SetUnitFlyHeight (boulder , BoulderHeight , 4000)
    call UnitApplyTimedLife( boulder, &#039;BTLF&#039;, 30.00 )
    call SetUnitPosition(boulder,GetUnitX(u),GetUnitY(u))
    call StoreInteger(cache, I2S(H2I(t)), &quot;level&quot; , level)
    call StoreInteger(cache, I2S(H2I(t)), &quot;target&quot;, H2I(target))
    call StoreInteger(cache, I2S(H2I(t)), &quot;boulder&quot;, H2I(boulder))
    call StoreInteger(cache, I2S(H2I(t)), &quot;caster&quot;, H2I(u))
    call StoreReal(cache, I2S(H2I(t)), &quot;d&quot;, GetDistance(u,target))
    call TimerStart(t,ChainHoldTimer,false,function BoulderThrow) 
set t = null
set u = null
set boulder = null
set target = null
endfunction


// Wind Rush //
// Created by JonNny aka WorIdEdit - Please give credits if you use this Spell
// in your map //
globals
private constant real EffectDistance = 80.00  //The distance between each effect
private constant real EffectTimer = 0.05 //How fast the Effects are Created / The Units &quot;Rushes&quot; (Time to Travel =  (Distance/EffectDistance)*EffectTimer)
endglobals 

private function DestroyEffectD takes real t , effect e returns nothing
call TriggerSleepAction(t)
call DestroyEffect(e)
endfunction

private function RemoveUDelayed takes unit u , real time returns nothing
    call TriggerSleepAction(time)
    call RemoveUnit(u)
endfunction

private function UnitCreation takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local real x = GetStoredReal(cache,I2S(H2I(t)),&quot;x&quot;)
    local real y = GetStoredReal(cache,I2S(H2I(t)),&quot;y&quot;)
    local real angle = GetStoredReal(cache,I2S(H2I(t)),&quot;angle&quot;)
    local unit u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),&#039;h00T&#039;,x,y,angle)
    call RemoveUDelayed(u,0.5)
    call FlushStoredMission(cache, I2S(H2I(t)))
    set u = null
    set t = null
endfunction

private function DelayedUnitCreation takes real angle , real time , real x , real y returns nothing
    local timer t = CreateTimer()
    call StoreReal(cache, I2S(H2I(t)), &quot;x&quot;, x)
    call StoreReal(cache, I2S(H2I(t)), &quot;y&quot;, y)
    call StoreReal(cache, I2S(H2I(t)), &quot;angle&quot;, angle)
    call TimerStart(t,time,false,function UnitCreation)
    set t = null
endfunction

private function ShowUnitD takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = I2U(GetStoredInteger(cache,I2S(H2I(t)),&quot;u&quot;))
    call ShowUnit(u,true)
    call PauseUnit(u, false)
    if (GetLocalPlayer() == GetOwningPlayer(u)) then
        call SelectUnit(u, true)
    endif
    set t = null
    set u = null
endfunction

private function ShowUnitDelayed takes real time , unit u returns nothing
    local timer t = CreateTimer()
    call StoreInteger(cache, I2S(H2I(t)), &quot;u&quot;, H2I(u))
    call TimerStart(t,time,false,function ShowUnitD)
    set t = null
endfunction


private function WindRush takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local real XX = 0.00
    local integer EffectNumber = 0
    local real x = GetUnitX(caster)
    local real y = GetUnitY(caster)
    local real angle =0.00
    local real maxdistance = 0.00
    local real moveddistance = 0.00
    local location target = GetSpellTargetLoc()
    local unit testposition = CreateUnitAtLoc(GetOwningPlayer(caster),&#039;h00P&#039;,target,0) 
    local real x2 = GetUnitX(testposition)
    local real y2 = GetUnitY(testposition)
    call PauseUnit(caster, true)
    call TriggerSleepAction(0.25)
    call RemoveUnit(testposition)
    set angle = bj_RADTODEG * Atan2(y2 - y, x2 - x)
    set maxdistance =  SquareRoot((x-x2)*(x-x2)+(y-y2)*(y-y2))
    set EffectNumber =  R2I((((maxdistance - (ModuloReal(maxdistance,EffectDistance)) / EffectDistance)))/EffectDistance)
    call ShowUnit(caster, false)
    call SetUnitX(caster,x2)
    call SetUnitY(caster,y2)
    set i = 0
    set ii = EffectNumber - 1
        loop
        exitwhen i&gt;ii
        call DelayedUnitCreation(angle, EffectTimer*i,x + ((maxdistance/EffectNumber)*i) * Cos(angle * bj_DEGTORAD),y + ((maxdistance/EffectNumber)*i) * Sin(angle * bj_DEGTORAD))
        set i = i + 1
    endloop
    call ShowUnitDelayed(EffectTimer*ii+0.15,caster)
    set testposition = null
    set caster = null
    call RemoveLocation(target)
    set target = null
endfunction</i></i></i></i></i></i></i></i></i></i></i></i></i>


oh one last thing, using textmacros and not doesn't seem to be making a difference, they both seem to do the same thing, unless i'm missing something about the textmacros and am not using them right...which i suppose is a good possibility. as you can tell i experimented with taking away textmacros to see if that changed anything and it didn't, so it would be a good guess that i didn't use them properly. or rather...i was supposed to use them in some fashion that i failed to. :/
 

Jesus4Lyf

Good Idea™
Reaction score
397
Didn't really read your post, sorry if I missed something.
JASS:
gamecache cache

-->
JASS:
gamecache cache = InitGameCache(&quot;SpellsStuff.w3v&quot;)

Should like. Fix things.

Post again with code if you have trouble.

Make sure you have copied the textmacro code I posted in, it provides the H2I and I2U functions and whatnot. :)
Edit: Oh, you wrote them yourself. All good. Whatever you like. :)
 

SanKakU

Member
Reaction score
21
you're right, that worked.

i'm having trouble with another spell though, which is related to this.

here's what i've been working on...

i marked the trouble section with a bunch of

//

//

//

//

so...you should spot it easier that way. i don't get much online time nowadays otherwise i would've cut it out but i don't want to risk missing any code that might be vital right now trying to do that. i hope i didn't miss something after doing that...
JASS:
globals
    hashtable TYPECAST_HASH=InitHashtable()
    gamecache cache = InitGameCache(&quot;SpellsStuff.w3v&quot;)
endglobals
function H2I takes agent h returns integer
    local integer id=GetHandleId(h)
    call SaveAgentHandle(TYPECAST_HASH,0,id,h)
    return id
endfunction
function I2U takes integer id returns unit
    return LoadUnitHandle(TYPECAST_HASH,0,id)
endfunction
function I2E takes integer id returns effect
    return LoadEffectHandle(TYPECAST_HASH,0,id)
endfunction
// And so on.


// Fire Dissipation
// Fire/Heat - Submission for the Spell Olympics 2008
// Created by JonNny aka WorIdEdit - Please give credits if you use this Spell
// in your map
scope dissipation initializer I
globals
private integer i
private integer ii
private constant real Speed = 9.00  //The Speed of the Spirits
private constant real TimerEvent = 0.02 //How fast the Timer runs
private constant real circle = 4.00 //The Speed of the Spirits circling arround the Target Location
private constant integer GlowNumber = 8 // The Number of created Spirits which move
private constant real ExplosionRange = 450.00 // The Range of the Explosion dealing damage and pushing units away
private constant string Effect = &quot;Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl&quot; //The Model of the Explosion appearing when being recomposed
endglobals 


private function firedissipationheight takes real maxdistance returns real
    return maxdistance/8 + 150  // The max. height the Spirits reach on their movement
endfunction

private function DamageDealt takes integer level returns real
    return 25.00+(55.00*I2R(level)) // The max. dealt damage on explosion
endfunction

private function PushRate takes integer level returns real
    return 2.50+(3.75*I2R(level)) // The rate of units being pushed away
endfunction

private function IsUnitPushedAway takes unit u , unit uu returns boolean 
// change the Conditions for the affected units here (push only)
return (u!= uu) and (IsUnitType(u, UNIT_TYPE_STRUCTURE) == false ) and (GetUnitState(u, UNIT_STATE_LIFE) &gt; 0)
endfunction 

private function IsUnitDamaged takes unit u , unit uu returns boolean
// change the Conditions for the affected units here (Damage)
return (IsPlayerEnemy(GetOwningPlayer(u), GetOwningPlayer(uu)) == true ) and (IsUnitType(u, UNIT_TYPE_STRUCTURE) == false ) and (GetUnitState(u, UNIT_STATE_LIFE) &gt; 0) and ( IsUnitType(u, UNIT_TYPE_MECHANICAL) == false ) and ( IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false )
endfunction

private function FadeOut takes integer red , integer green , integer blue , unit u  returns nothing
local integer q = 1
local integer qq= 4
    loop
        exitwhen q&gt;qq
        call SetUnitVertexColor(u,red,green,blue,(255-(64*q)))   
        call TriggerSleepAction(0.01)
        set q = q + 1
    endloop
    call ShowUnit(u, false)
endfunction

private function FadeIn takes integer red , integer green , integer blue , unit u returns nothing
local integer q = 1
local integer qq= 4
    call ShowUnit(u, true)
    loop
        exitwhen q&gt;qq
        call SetUnitVertexColor(u,red,green,blue,(64*q))   
        call TriggerSleepAction(0.01)
        set q = q + 1
    endloop
endfunction

private function DestroyEffectDelayed takes real t , effect e returns nothing
call TriggerSleepAction(t)
call DestroyEffect(e)
endfunction

private function Damage takes nothing returns nothing 
    local timer t = GetExpiredTimer()
    local unit u = I2U(GetStoredInteger(cache,I2S(H2I(t)),&quot;Hero&quot;))
    local location l = GetUnitLoc(u)
    local real move = GetStoredReal(cache,I2S(H2I(t)),&quot;dmg&quot;) 
    local real distance = ExplosionRange
    local group g =  GetUnitsInRangeOfLocMatching(ExplosionRange,l,Filter(function FilterDebug))
    local unit a= null
    local real x = 0.00
    local real y =  0.00
    local real xx = GetUnitX(u)
    local real yy = GetUnitY(u)
    local real dx = 0.00
    local real dy = 0.00
    local real d = 0.00
    local real angle = 0.00
    loop
        set a = FirstOfGroup(g)
        exitwhen a==null
        call GroupRemoveUnit(g,a)

            set x = GetUnitX(a)
            set y = GetUnitY(a)
            set angle = bj_RADTODEG * Atan2(y - yy, x - xx)
            if (a != u) and IsUnitPushedAway(a,u)  then
                set dx = xx - x
                set dy = yy - y
                set d = SquareRoot(dx*dx+dy*dy)
                call SetUnitX(a,x + move*((ExplosionRange-d)/ExplosionRange) * Cos(angle * bj_DEGTORAD))
                call SetUnitY(a,y + move*((ExplosionRange-d)/ExplosionRange) * Sin(angle * bj_DEGTORAD))
            else
            endif
    endloop
    if move &gt; 0 then 
        call StoreReal(cache, I2S(H2I(t)), &quot;dmg&quot;, (move-0.25))
        call TimerStart(t,TimerEvent,false,function Damage)
    else 
        call FlushStoredMission(cache, I2S(H2I(t))) 
    endif
    call RemoveLocation(l)
    set l = null
    set a = null
    set u = null
    set t = null
    call DestroyGroup(g)
    set g = null
endfunction

private function Move takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit glow = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;Glow&quot;))
    local location l = GetUnitLoc(glow)
    local real angle = GetStoredReal(cache,I2S(H2I(t)),&quot;angle&quot;)
    local real distance = GetStoredReal(cache,I2S(H2I(t)),&quot;maxd&quot;)
    local real moved = GetStoredReal(cache,I2S(H2I(t)),&quot;moved&quot;)
    local real x = GetLocationX(l) + Speed * Cos(angle * bj_DEGTORAD)
    local real y = GetLocationY(l) + Speed * Sin(angle * bj_DEGTORAD) 
    local integer Movement = GetStoredInteger(cache,I2S(H2I(t)),&quot;Movement&quot;)
    local effect explosion = null
    local unit hero = null
    local real movement = 0.00
    local integer level
    local location loc = null
    local group g = null
    local unit a = null
    local real d = 0.00
    local real dx = 0.00
    local real dy = 0.00
    if Movement == 1 then
    call SetUnitPosition( glow , x,y )
    set moved = moved + Speed
    call SetUnitFlyHeight (glow , (80.00 + Sin((moved/(1.75*distance))*3.1415)*firedissipationheight(distance)) , 400)
    call StoreReal(cache, I2S(H2I(t)), &quot;maxd&quot;, distance)
    call StoreReal(cache, I2S(H2I(t)), &quot;moved&quot;, moved) 
    call StoreInteger(cache, I2S(H2I(t)), &quot;Glow&quot;, H2I(glow))  
    if moved &gt; distance then 
        set angle = bj_RADTODEG * Atan2(y - GetStoredReal(cache,I2S(H2I(t)),&quot;yt&quot;), x - GetStoredReal(cache,I2S(H2I(t)),&quot;xt&quot;))
        call StoreInteger(cache, I2S(H2I(t)), &quot;Movement&quot;, 2)  
        call StoreReal(cache, I2S(H2I(t)), &quot;maxd&quot;, GetUnitFlyHeight(glow))
        call StoreReal(cache, I2S(H2I(t)), &quot;moved&quot;, 0.00) 
        call StoreReal(cache, I2S(H2I(t)), &quot;angle&quot;, angle)
    else 
    endif  
    call TimerStart(t,TimerEvent,false,function Move)
else
if moved*1.5 &gt; distance then
        if GetStoredInteger(cache,I2S(H2I(t)),&quot;MoveHero&quot;) == 1 then
            set hero = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;Hero&quot;))
            call SetUnitPosition( hero, GetStoredReal(cache,I2S(H2I(t)),&quot;xt&quot;),GetStoredReal(cache,I2S(H2I(t)),&quot;yt&quot;)) 
            call FadeIn.execute(255,255,255,hero)    
            call PauseUnit(hero, false)  
            call SetUnitPathing( hero, true )            
            if (GetLocalPlayer() == GetOwningPlayer(glow)) then
            call SelectUnit(hero ,true)
            endif
            call StoreInteger(cache, I2S(H2I(t)), &quot;MoveHero&quot;, 2)
            set moved = moved + 75.00
            set hero = null
            else
        endif
else
endif
    if moved &gt; distance then 
        if GetStoredInteger(cache,I2S(H2I(t)),&quot;MoveHero&quot;) == 2 then
            set level = GetStoredInteger(cache,I2S(H2I(t)),&quot;level&quot;)
            set hero = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;Hero&quot;))
            set loc = GetUnitLoc(hero)
            set explosion = AddSpecialEffectLoc(Effect, loc)  
            call DestroyEffect(explosion)
            call StoreInteger(cache, I2S(H2I(t)), &quot;Hero&quot;, H2I(hero))
            call StoreReal(cache, I2S(H2I(t)), &quot;dmg&quot;, PushRate(level))
            set g =  GetUnitsInRangeOfLocMatching(ExplosionRange,loc,null)
            call TimerStart(t,0.15,false,function Damage) 
            loop
                set a = FirstOfGroup(g)
                exitwhen a==null
                call GroupRemoveUnit(g,a)
                set bj_lastCreatedEffect = AddSpecialEffectTarget(&quot;Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl&quot; , a, &quot;chest&quot;)
                call DestroyEffectDelayed.execute(0.15,bj_lastCreatedEffect)
                set dx = GetUnitX(a) - GetUnitX(hero)
                set dy = GetUnitY(a) - GetUnitY(hero)
                set d = SquareRoot(dx*dx+dy*dy)
                if  IsUnitDamaged(a,hero) and hero != a then
                    call UnitDamageTarget(hero, a, DamageDealt(level)*((ExplosionRange-d)/ExplosionRange), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                else 
                endif
 
            endloop              
            
            call DestroyGroup(g)
            set g = null
            set a = null

            call RemoveLocation(loc)
        else
        call FlushStoredMission(cache, I2S(H2I(t)))         
        endif
        call RemoveUnit(glow)
    else            
        call SetUnitFlyHeight (glow , (distance-moved) , 1000)
        call SetUnitPosition( glow ,  GetStoredReal(cache,I2S(H2I(t)),&quot;xt&quot;) + (120*(1-(moved/distance))) * Cos(angle * bj_DEGTORAD),GetStoredReal(cache,I2S(H2I(t)),&quot;yt&quot;) + (120*(1-(moved/distance))) * Sin(angle * bj_DEGTORAD) )
        set moved = moved + (0.3*Speed) 
        set angle = angle + circle + 4*(moved/distance)
        call StoreReal(cache, I2S(H2I(t)), &quot;moved&quot;, moved) 
        call StoreReal(cache, I2S(H2I(t)), &quot;angle&quot;, angle) 
        call TimerStart(t,TimerEvent,false,function Move)
    endif 
    call RemoveLocation(l)
endif
    set glow = null
    set loc = null
    set t = null
    set hero = null 
    set explosion = null
    set l = null
endfunction

private function Dissipation takes nothing returns nothing
    local unit array u
    local timer array t
    local location array l
    local unit caster = GetTriggerUnit()
    local real x = GetUnitX(caster)
    local real y = GetUnitY(caster)
    local real angle =0.00
    local real distancemax = 0.00
    local location target2 = GetSpellTargetLoc()
    local location target = null
    local unit testposition = CreateUnitAtLoc(GetOwningPlayer(caster),&#039;h00P&#039;,target2,0) 
    local real array xt
    local real array yt
    local real size = GetRandomReal(180,300)
    set target = GetUnitLoc(testposition)
    call RemoveUnit(testposition)
    call FadeOut.execute(255,255,255,caster)
    set i = 1
    set ii = GlowNumber 
        loop
        exitwhen i&gt;ii
        set size = GetRandomReal(275,350)
        set xt<i> = GetLocationX(target) + (120.00 * Cos( 360 / ii * i * bj_DEGTORAD))
        set yt<i> = GetLocationY(target) + (120.00 * Sin( 360 / ii * i * bj_DEGTORAD))
        set t<i> = CreateTimer()
        set l<i> = Location(x + GetRandomReal(50.00,125.00) * Cos(GetRandomReal(0.00,360.00) * bj_DEGTORAD),y + GetRandomReal(25.00,150.00) * Sin(GetRandomReal(0.00,360.00) * bj_DEGTORAD)) 
        set u<i> =  CreateUnit(GetOwningPlayer(caster),&#039;h00Q&#039;,x,y,0)  
        call SetUnitScale( u<i>, size*0.01, size*0.01, size*0.01)
        call IssuePointOrderLoc( u<i>, &quot;move&quot;, l<i> )
        set distancemax = SquareRoot((GetLocationX(l<i>)-xt<i>)*(GetLocationX(l<i>)-xt<i>)+(GetLocationY(l<i>)-yt<i>)*(GetLocationY(l<i>)-yt<i>))
        set angle = bj_RADTODEG * Atan2(GetLocationY(l<i>) - yt<i>, GetLocationX(l<i>) - xt<i>) +180.00
        call FadeIn.execute(GetRandomInt(25,200),GetRandomInt(125,255),GetRandomInt(25,200),u<i>)
        call StoreReal(cache, I2S(H2I(t<i>)), &quot;angle&quot;, angle)
        call StoreReal(cache, I2S(H2I(t<i>)), &quot;xt&quot;, GetLocationX(target)) 
        call StoreReal(cache, I2S(H2I(t<i>)), &quot;yt&quot;, GetLocationY(target)) 
        call StoreReal(cache, I2S(H2I(t<i>)), &quot;maxd&quot;, distancemax)
        call StoreReal(cache, I2S(H2I(t<i>)), &quot;moved&quot;, 0.00) 
        call StoreInteger(cache, I2S(H2I(t<i>)), &quot;Glow&quot;, H2I(u<i>)) 
        call StoreInteger(cache, I2S(H2I(t<i>)), &quot;Movement&quot;, 1) 
        if i == ii then
             call StoreInteger(cache, I2S(H2I(t<i>)), &quot;level&quot;, GetUnitAbilityLevel(GetTriggerUnit(),&#039;A058&#039;))
             call StoreInteger(cache, I2S(H2I(t<i>)), &quot;Hero&quot;, H2I(GetTriggerUnit()))
             call StoreInteger(cache, I2S(H2I(t<i>)), &quot;MoveHero&quot;, 1)
        else 
        endif
        call TimerStart(t<i>,0.75,false,function Move)    
        call RemoveLocation(l<i>)
        set t<i> = null
        set l<i>= null
        set u<i> = null
        set i = i + 1
    endloop
    call TriggerSleepAction(0.50)
    call PauseUnit(GetTriggerUnit(), true)  
    call SetUnitPathing( GetTriggerUnit(), false )  
    set testposition = null
    set caster = null
    call RemoveLocation(target)
    call RemoveLocation(target2)
    set target = null
endfunction


// Chained Up //
// Created by JonNny aka WorIdEdit - Please give credits if you use this Spell
// in your map //
globals 
private constant real BoulderHeight = 50.00 //The height of the boulder when lying of the ground
private constant real ChainHeight = 40.00 //Defines the height the chain will lock up
private constant real ChainPartDistance = 35.00 //The Distance between each part of the chain 
private constant real ChainHoldTimer = 0.03 //Set the time the Chain function executes
private constant string BoulderDeathEffect = &quot;Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl&quot; //The effect which appears when the boulder is removed
private constant real BoulderSpeedThrown = 12.00 //The speed the boulder is thrown
endglobals


private function BoulderWeight takes real level returns real
    return (0.5-0.15*level)  //Declares how easy it is to pull this boulder (1 = 100% = easy  , 0 = 0% = not moveable)
endfunction

private function ChainLength takes real level returns real
    return 375.00-(50.00*level)  //Defines the length of the chain for each level
endfunction

private function Duration takes real level returns real
    return 12+(4*level) // The Time this Boulder will last
endfunction

private function Height takes real d returns real
    return 0.70*d  // The max.height the Boulder will reach on this throw
endfunction

private function ChainedUpID takes nothing returns boolean
    return GetSpellAbilityId() == &#039;A05A&#039; //The condition this script runs (Casted spell must be your spell)
endfunction

private function GetDistance takes unit u , unit uu returns real
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real xx = GetUnitX(uu)
    local real yy = GetUnitY(uu)
    return SquareRoot((xx-x)*(xx-x)+(yy-y)*(yy-y))
endfunction

private function RemoveUnitDelayed takes unit u , real t returns nothing
call TriggerSleepAction(t)
call RemoveUnit(u)
endfunction

private function ChainHold takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit array chain
local unit target = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;target&quot;))
local unit boulder = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;boulder&quot;))
local real x = GetUnitX(target)
local real y = GetUnitY(target)
local real xx = GetUnitX(boulder)
local real yy = GetUnitY(boulder)
local real s = 0.00
local real level = GetStoredInteger(cache, I2S(H2I(t)), &quot;level&quot;)
local real d = ChainLength(level)
local real angle = bj_RADTODEG * Atan2(y - yy, x - xx)
local real z = 0.00
local real tb = GetDistance(target,boulder)
local effect e = null
local location l = null
if GetDistance(target,boulder) &gt; d then
    set angle = bj_RADTODEG * Atan2(y - yy, x - xx)
    set s = (tb - d )* BoulderWeight(level)
    call SetUnitX(target,(xx + d * Cos(angle * bj_DEGTORAD)))
    call SetUnitY(target,(yy + d * Sin(angle * bj_DEGTORAD)))
    call SetUnitPosition( boulder ,( GetUnitX(boulder)+ s * Cos((0+angle) * bj_DEGTORAD)),(GetUnitY(boulder)+ s * Sin((0+angle) * bj_DEGTORAD)))
else
endif
set i = 1
set ii = GetStoredInteger(cache, I2S(H2I(t)), &quot;ChainParts&quot;)

    loop
        exitwhen i&gt;ii
        set chain<i> = I2U(GetStoredInteger(cache, I2S(H2I(t)), I2S(i)))
        call SetUnitFacingTimed( chain<i>, angle+90, 0.01 )
        set z = ChainHeight +(I2R(i)/I2R(ii)*GetUnitFlyHeight(target))- (Sin(((GetDistance(chain<i>,boulder)/tb))*3.1415)*ChainHeight*2.25*((1-tb/ChainLength(GetStoredInteger(cache, I2S(H2I(t)), &quot;level&quot;)))))
        call SetUnitFlyHeight (chain<i> , z , 400)
        set x = GetUnitX(boulder) + (((tb-45)*i/ii)+45)*0.95 * Cos(angle * bj_DEGTORAD)
        set y = GetUnitY(boulder) + (((tb-45)*i/ii)+45)*0.95 * Sin(angle * bj_DEGTORAD)
        call SetUnitPosition(chain<i>,x,y)
        set chain<i> = null
        set i = i + 1
    endloop   
if (GetUnitState(target, UNIT_STATE_LIFE) &gt; 0) and (GetUnitState(boulder, UNIT_STATE_LIFE) &gt; 0) then
    call TimerStart(t,ChainHoldTimer,false,function ChainHold)
else
set i = 1
set ii = GetStoredInteger(cache, I2S(H2I(t)), &quot;ChainParts&quot;)
    loop
        exitwhen i&gt;ii
        set chain<i> = I2U(GetStoredInteger(cache, I2S(H2I(t)), I2S(i)))
        call RemoveUnit(chain<i>)
        set chain<i> = null
        set i = i + 1
    endloop 
    set l = GetUnitLoc(boulder)
    set e = AddSpecialEffectLoc(BoulderDeathEffect,l)
    call DestroyEffect(e)
    call KillUnit(boulder)
    set e = null
    call RemoveLocation(l)
    set l = null
    call RemoveUnitDelayed.execute(boulder,0.25)
call FlushStoredMission(cache, I2S(H2I(t))) 
endif
set boulder = null
set target = null
set t = null
endfunction

private function BoulderThrow takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit boulder = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;boulder&quot;)) 
local unit target = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;target&quot;)) 
local real z = 0.00
local unit caster = null
local real d = GetStoredReal(cache, I2S(H2I(t)), &quot;d&quot;)
local real angle = bj_RADTODEG * Atan2(GetUnitY(boulder) - GetUnitY(target), GetUnitX(boulder) - GetUnitX(target))+180.00
local real dd = GetDistance(boulder,target) 
local integer level = GetStoredInteger(cache, I2S(H2I(t)), &quot;level&quot;)
local unit array chain
local real tx
local real ty
local effect e = null
local location l = null
if dd &lt; 100 then 
    set caster = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;caster&quot;)) 
    call SetUnitPathing(boulder, true )   
    call SetUnitTimeScale(boulder, 0.00)
    call SetUnitFlyHeight (boulder , BoulderHeight , 4000)
    call SetUnitPosition( boulder ,GetUnitX(boulder),GetUnitY(boulder))
    set l = GetUnitLoc(boulder)
    set e = AddSpecialEffectLoc(BoulderDeathEffect,l)
    call DestroyEffect(e)
    set e = null
    call RemoveLocation(l)
    set l = null
    set i = 1
    set ii = R2I((ChainLength(level)-45)/ChainPartDistance)
    call StoreInteger(cache, I2S(H2I(t)), &quot;ChainParts&quot;, ii)
    loop
        exitwhen i&gt;ii
        set tx =  GetUnitX(boulder) + (dd*i/ii) * Cos(angle * bj_DEGTORAD)
        set ty =  GetUnitY(boulder) + (dd*i/ii) * Sin(angle * bj_DEGTORAD)
        set chain<i> = CreateUnit(GetOwningPlayer(caster),&#039;h00S&#039;,tx,ty,angle) 
        call SetUnitTimeScale(chain<i>, 2.50)
        call StoreInteger(cache, I2S(H2I(t)), I2S(i), H2I(chain<i>))
        set chain<i> = null
        set i = i + 1
    endloop    
    call TimerStart(t,ChainHoldTimer,false,function ChainHold)
    set caster = null
else 
    set z = 0.00 + Sin(((d-dd+100)/(d)*3.1415))*Height(d)
    call UnitAddAbility(boulder, &#039;Amrf&#039;)
    call UnitRemoveAbility(boulder, &#039;Amrf&#039;)
    call SetUnitFlyHeight (boulder , z , 4000)

    call SetUnitPosition(boulder,GetUnitX(boulder) + BoulderSpeedThrown * Cos(angle * bj_DEGTORAD),GetUnitY(boulder) + BoulderSpeedThrown * Sin(angle * bj_DEGTORAD))
    call TimerStart(t,ChainHoldTimer,false,function BoulderThrow) 
endif    
set t = null
set boulder = null 
set target = null   
endfunction

private function ChainUp takes nothing returns nothing
    local unit u = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local real xx = GetUnitX(target)
    local real yy = GetUnitY(target)
    local real tx = 0.00
    local real ty = 0.00
    local integer level = GetUnitAbilityLevel(u,&#039;A05A&#039;)
    local timer t = CreateTimer()
    local unit boulder = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),&#039;h00R&#039;,xx,yy,0.00) 
    local real x = GetUnitX(boulder)
    local real y = GetUnitY(boulder)
    local real d = SquareRoot((xx-x)*(xx-x)+(yy-y)*(yy-y))
    local real angle = bj_RADTODEG * Atan2(yy - y, xx - x)
    call SetUnitPathing(boulder, false )
    call UnitAddAbility(boulder, &#039;Amrf&#039;)
    call UnitRemoveAbility(boulder, &#039;Amrf&#039;)
    call SetUnitFlyHeight (boulder , BoulderHeight , 4000)
    call UnitApplyTimedLife( boulder, &#039;BTLF&#039;, 30.00 )
    call SetUnitPosition(boulder,GetUnitX(u),GetUnitY(u))
    call StoreInteger(cache, I2S(H2I(t)), &quot;level&quot; , level)
    call StoreInteger(cache, I2S(H2I(t)), &quot;target&quot;, H2I(target))
    call StoreInteger(cache, I2S(H2I(t)), &quot;boulder&quot;, H2I(boulder))
    call StoreInteger(cache, I2S(H2I(t)), &quot;caster&quot;, H2I(u))
    call StoreReal(cache, I2S(H2I(t)), &quot;d&quot;, GetDistance(u,target))
    call TimerStart(t,ChainHoldTimer,false,function BoulderThrow) 
set t = null
set u = null
set boulder = null
set target = null
endfunction


// Wind Rush //
// Created by JonNny aka WorIdEdit - Please give credits if you use this Spell
// in your map //
globals
private constant real EffectDistance = 80.00  //The distance between each effect
private constant real EffectTimer = 0.05 //How fast the Effects are Created / The Units &quot;Rushes&quot; (Time to Travel =  (Distance/EffectDistance)*EffectTimer)
endglobals 

private function DestroyEffectD takes real t , effect e returns nothing
call TriggerSleepAction(t)
call DestroyEffect(e)
endfunction

private function RemoveUDelayed takes unit u , real time returns nothing
    call TriggerSleepAction(time)
    call RemoveUnit(u)
endfunction

private function UnitCreation takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local real x = GetStoredReal(cache,I2S(H2I(t)),&quot;x&quot;)
    local real y = GetStoredReal(cache,I2S(H2I(t)),&quot;y&quot;)
    local real angle = GetStoredReal(cache,I2S(H2I(t)),&quot;angle&quot;)
    local unit u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),&#039;h00T&#039;,x,y,angle)
    call RemoveUDelayed(u,0.5)
    call FlushStoredMission(cache, I2S(H2I(t)))
    set u = null
    set t = null
endfunction

private function DelayedUnitCreation takes real angle , real time , real x , real y returns nothing
    local timer t = CreateTimer()
    call StoreReal(cache, I2S(H2I(t)), &quot;x&quot;, x)
    call StoreReal(cache, I2S(H2I(t)), &quot;y&quot;, y)
    call StoreReal(cache, I2S(H2I(t)), &quot;angle&quot;, angle)
    call TimerStart(t,time,false,function UnitCreation)
    set t = null
endfunction

private function ShowUnitD takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = I2U(GetStoredInteger(cache,I2S(H2I(t)),&quot;u&quot;))
    call ShowUnit(u,true)
    call PauseUnit(u, false)
    if (GetLocalPlayer() == GetOwningPlayer(u)) then
        call SelectUnit(u, true)
    endif
    set t = null
    set u = null
endfunction

private function ShowUnitDelayed takes real time , unit u returns nothing
    local timer t = CreateTimer()
    call StoreInteger(cache, I2S(H2I(t)), &quot;u&quot;, H2I(u))
    call TimerStart(t,time,false,function ShowUnitD)
    set t = null
endfunction


private function WindRush takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local real XX = 0.00
    local integer EffectNumber = 0
    local real x = GetUnitX(caster)
    local real y = GetUnitY(caster)
    local real angle =0.00
    local real maxdistance = 0.00
    local real moveddistance = 0.00
    local location target = GetSpellTargetLoc()
    local unit testposition = CreateUnitAtLoc(GetOwningPlayer(caster),&#039;h00P&#039;,target,0) 
    local real x2 = GetUnitX(testposition)
    local real y2 = GetUnitY(testposition)
    call PauseUnit(caster, true)
    call TriggerSleepAction(0.25)
    call RemoveUnit(testposition)
    set angle = bj_RADTODEG * Atan2(y2 - y, x2 - x)
    set maxdistance =  SquareRoot((x-x2)*(x-x2)+(y-y2)*(y-y2))
    set EffectNumber =  R2I((((maxdistance - (ModuloReal(maxdistance,EffectDistance)) / EffectDistance)))/EffectDistance)
    call ShowUnit(caster, false)
    call SetUnitX(caster,x2)
    call SetUnitY(caster,y2)
    set i = 0
    set ii = EffectNumber - 1
        loop
        exitwhen i&gt;ii
        call DelayedUnitCreation(angle, EffectTimer*i,x + ((maxdistance/EffectNumber)*i) * Cos(angle * bj_DEGTORAD),y + ((maxdistance/EffectNumber)*i) * Sin(angle * bj_DEGTORAD))
        set i = i + 1
    endloop
    call ShowUnitDelayed(EffectTimer*ii+0.15,caster)
    set testposition = null
    set caster = null
    call RemoveLocation(target)
    set target = null
endfunction

//

//

//

//

//

//

// Tornado
// Air/Wind - Submission for the Spell Olympics 2008
// Created by JonNny aka WorIdEdit - Please give credits if you use this Spell
// in your map
globals
private constant real TornadoTimer = 0.03 //How fast the Timer runs
private constant string TornadoEffect = &quot;Abilities\\Spells\\NightElf\\Cyclone\\CycloneTarget.mdl&quot; //The effect which is created at the location of the caster
private constant string TornadoOrder = &quot;channeltornadopull&quot; //The OrderID of the Channeled Spell (can be set in the 
private constant real SuckRange = 850.00 // The range the spell will start suck units
private constant real EyeOfTheStormRadius = 100.00 //Defines the radius of the inner circle the units will spin arround ( 90.00° = 0 range , higher angle = bigger radius )
private constant real ElevatorRange = 600.00 //The Range the Units begin beeing sucked into the air (Mind the GravityRate , this range does not mean that the Unit will being lifted
private constant real MaxHeight = 250.00 // The Maximal Height the unit can reach of beein sucked
private constant real HeightChange = 20.00 //The Rate the Units will get Sucked in the Air
private constant real GravityRate = 10.00 //The Rate the Unit will Fall Down after sucked into the air
private constant real DamageRange = 350 // The range the Spell deals Damage / has an effect(like the one below)
private constant string SpellAbilityOrder = &quot;slow&quot; //The Order of the Ability
endglobals

private function DamageAmount takes integer level returns real
return 0.20+(0.15*level) // The damage the Unit deals each &quot;TornadoTomer&quot; seconds
endfunction

private function Suck takes integer level returns real
return 3.8+(2.5*level) // The Speed the Units gets sucked by the Tornado 
endfunction

private function IsUnitSuckAffected takes unit u , unit uu returns boolean 
// change the Conditions for the affected units here (suck only)
return (u!= uu) and (IsUnitType(u, UNIT_TYPE_STRUCTURE) == false ) and (GetUnitState(u, UNIT_STATE_LIFE) &gt; 0)
endfunction 

private function IsUnitSpellAffected takes unit u , unit uu returns boolean
// change the Conditions for the affected units here (Spell Effect + Damage)
return (IsPlayerEnemy(GetOwningPlayer(u), GetOwningPlayer(uu)) == true ) and (u!= uu) and (IsUnitType(u, UNIT_TYPE_STRUCTURE) == false ) and (GetUnitState(u, UNIT_STATE_LIFE) &gt; 0) and ( IsUnitType(u, UNIT_TYPE_MECHANICAL) == false ) and ( IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false )
endfunction

private function RemoveEffect takes unit u returns nothing
local real remaining = GetStoredReal(cache, I2S(H2I(u)), &quot;remaining&quot;)
    loop
    exitwhen remaining &lt; 0.00
    set remaining = GetStoredReal(cache, I2S(H2I(u)), &quot;remaining&quot;) - 0.60
    call StoreReal(cache, I2S(H2I(u)), &quot;remaining&quot;, remaining)
    call TriggerSleepAction(0.01)
    endloop
    call UnitRemoveAbility( u , &#039;B00X&#039; )
    call StoreReal(cache, I2S(H2I(u)), &quot;remaining&quot;, 0.00)
endfunction

private function GetDown takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;unit&quot;))
    local real z = GetUnitFlyHeight(u) 

    call UnitAddAbility(u, &#039;Amrf&#039;)
    call SetUnitFlyHeight(u, ( z - GravityRate), 500)
    call UnitRemoveAbility(u, &#039;Amrf&#039;)
    if z &gt; 0.01 then
        call TimerStart(t,TornadoTimer,false,function GetDown) 
    else
    call StoreInteger(cache, I2S(H2I(u)), &quot;GetDown&quot;, 0)
    call FlushStoredMission(cache, I2S(H2I(t))) 
    endif
    set t = null
    set u = null
endfunction


private function SuckActions takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit hero = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;hero&quot;))
local unit SFX = I2U(GetStoredInteger(cache, I2S(H2I(t)), &quot;SFX&quot;))
local effect e = I2E(GetStoredInteger(cache, I2S(H2I(t)), &quot;e&quot;))
local effect ee = I2E(GetStoredInteger(cache, I2S(H2I(t)), &quot;ee&quot;))
local integer level = GetStoredInteger(cache, I2S(H2I(t)), &quot;level&quot;)
local real z = GetUnitFlyHeight(hero)
local location l = GetUnitLoc(hero)
local group g =  GetUnitsInRangeOfLocMatching(SuckRange,l,null)
local real x = 0.00
local real y = 0.00
local real xx = GetLocationX(l)
local real yy = GetLocationY(l)
local real dx = 0.00
local real d = 0.00
local real dy = 0.00
local unit a = null
local real angle = 0.00
local timer array tt
local integer Int = 1
local real remaining = 0.00
local unit dummy = null
call SetUnitX(SFX,xx)
call SetUnitY(SFX,yy)
if OrderId2String(GetUnitCurrentOrder(hero)) == TornadoOrder then
        loop
        set a = FirstOfGroup(g)
        exitwhen a==null
        call GroupRemoveUnit(g,a)
            set x = GetUnitX(a)
            set y = GetUnitY(a)
            if  IsUnitSuckAffected(a,hero)  then
                set dx = xx - x
                set dy = yy - y
                set d = SquareRoot(dx*dx+dy*dy)
                set angle = -EyeOfTheStormRadius * (1-d/SuckRange) + (bj_RADTODEG * Atan2(yy - y, xx - x))
                call SetUnitX(a,x + Suck(level)*((SuckRange-d)/SuckRange) * Cos(angle * bj_DEGTORAD))
                call SetUnitY(a,y + Suck(level)*((SuckRange-d)/SuckRange) * Sin(angle * bj_DEGTORAD))
                if (d &lt; ElevatorRange) and GetUnitDefaultFlyHeight(a) &lt; 1.00 then
                    set z = GetUnitFlyHeight(a) 
                    if (GetStoredInteger(cache, I2S(H2I(a)), &quot;GetDown&quot; ) == 0 ) then
                        set tt[Int] = CreateTimer()
                        call StoreInteger(cache, I2S(H2I(a)), &quot;GetDown&quot;, 1)
                        call StoreInteger(cache, I2S(H2I(tt[Int])), &quot;unit&quot;, H2I(a))
                        call TimerStart(tt[Int],0.02,false,function GetDown) 
                        set Int = Int+1
                        set tt[Int] = null
                    else
                    endif

                    set z = z + (1-(z/MaxHeight))*(1-(d/ElevatorRange))*HeightChange
                    call UnitAddAbility(a, &#039;Amrf&#039;)
                    call SetUnitFlyHeight(a, z, 1000)
                    call UnitRemoveAbility(a, &#039;Amrf&#039;)
                    else
                endif
                set remaining = GetStoredReal(cache, I2S(H2I(a)), &quot;remaining&quot; )
                if (d &lt; DamageRange) and IsUnitSpellAffected(a,hero) then
                    call UnitDamageTarget(hero, a, DamageAmount(level), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                    if ((&#039;A057&#039; != 0)   and  (remaining == 0.00)) then
                       set dummy = CreateUnit(GetOwningPlayer(hero),&#039;h00O&#039;,xx,yy,0)
                       call UnitAddAbility(dummy, &#039;A057&#039;)
                       call SetUnitAbilityLevel( dummy ,&#039;A057&#039;, level )
                       call IssueTargetOrder( dummy,SpellAbilityOrder, a )
                       call StoreReal(cache, I2S(H2I(a)), &quot;remaining&quot;, 10.00)
                       call RemoveEffect.execute(a)
                    else
                       set remaining = remaining +0.25
                       call StoreReal(cache, I2S(H2I(a)), &quot;remaining&quot;, remaining)
                    endif
                else 
                endif
                
            else
            endif
    endloop

    call TimerStart(t,TornadoTimer,false,function SuckActions) 
else
    call RemoveUnit(SFX)
    call SetUnitTimeScale(hero, 1.00)
    call DestroyEffect(e)
    call DestroyEffect(ee)
    call FlushStoredMission(cache, I2S(H2I(t))) 
endif
set e = null
set ee = null
set hero = null
set a = null
call DestroyGroup(g)
set g = null
call RemoveLocation(l)
set l = null
set SFX = null
set t = null
set dummy = null
endfunction

private function TornadoStart takes nothing returns nothing
    local unit hero = GetSpellAbilityUnit()
    local integer level = GetUnitAbilityLevel(hero,&#039;A059&#039;)
    local timer t = CreateTimer()
    local effect e =   AddSpecialEffectTarget( TornadoEffect , GetTriggerUnit(), &quot;sprite,first&quot; )
    local effect ee =  null
    local location l = GetUnitLoc(hero)
    local unit TornadoSFX = CreateUnitAtLoc(GetOwningPlayer(hero),&#039;h00N&#039;,l,0)
    call SetUnitTimeScale(hero, 1.80)
    call SetUnitTimeScale(TornadoSFX, 1.80)
    call SetUnitVertexColor(TornadoSFX, 200, 200, 200, 175 )
    call StoreInteger(cache, I2S(H2I(t)), &quot;hero&quot;, H2I(hero))
    call StoreInteger(cache, I2S(H2I(t)), &quot;SFX&quot;, H2I(TornadoSFX))
    call StoreInteger(cache, I2S(H2I(t)), &quot;e&quot;, H2I(e))
    call StoreInteger(cache, I2S(H2I(t)), &quot;ee&quot;, H2I(ee))
    call StoreInteger(cache, I2S(H2I(t)), &quot;level&quot;,level)
    call TimerStart(t,0.05,false,function SuckActions) 

    call RemoveLocation(l)
    set l = null
    set e = null
    set ee = null  
    set t = null  
    set hero = null
    set TornadoSFX = null
endfunction

private function A takes nothing returns nothing
local integer iii = GetSpellAbilityId()

if iii == &#039;A058&#039; then
call Dissipation()
elseif iii == &#039;A05A&#039; then
call ChainUp()
elseif iii == &#039;A05B&#039; then
call WindRush()
elseif iii == &#039;A059&#039; then
call TornadoStart()
endif
endfunction
private function I takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TAF_PUE( t,EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddAction( t, function A )

    
    //
    
    //
    
    //
    
    
    call Preload(TornadoEffect)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), &#039;e008&#039;, 380, 380, 0)    
    call UnitAddAbility(bj_lastCreatedUnit, &#039;A059&#039;)        
    call UnitAddAbility(bj_lastCreatedUnit, &#039;A057&#039;)        
    call UnitAddAbility(bj_lastCreatedUnit, &#039;A05A&#039;)        
    call UnitAddAbility(bj_lastCreatedUnit, &#039;A058&#039;)        
    call UnitAddAbility(bj_lastCreatedUnit, &#039;A05B&#039;)        
    call KillUnit(bj_lastCreatedUnit)
endfunction
endscope</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>


i'm not sure what is broken and what is not aside from that the spell is supposed to pull units toward the caster and doesn't. that's the key problem i'm having.

this spell uses I2E whereas the other 3 did not. what exactly am i missing? i'm not sure at all...
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
It's really not that hard.
JASS:
globals
    hashtable TYPECAST_HASH=InitHashtable()
endglobals
function H2I takes agent h returns integer
    local integer id=GetHandleId(h)
    call SaveAgentHandle(TYPECAST_HASH,0,id,h)
    return id
endfunction
//! textmacro I2X takes LETTER, TYPE, CASETYPE
function I2$LETTER$ takes integer id returns $TYPE$
    return Load$CASETYPE$Handle(TYPECAST_HASH,0,id)
endfunction
//! endtextmacro
//! runtextmacro I2X(&quot;E&quot;,&quot;effect&quot;,&quot;Effect&quot;)
//! runtextmacro I2X(&quot;U&quot;,&quot;unit&quot;,&quot;Unit&quot;)
// And so on.

Go finish it. :)


Explain this method of typecasting please?
It doesn't even look like typecasting to me... But then again, I am blind, so...
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
o_O

So, not typecasting.
Oh, that (kinda) makes sense now.
Thanks. :D
 

SanKakU

Member
Reaction score
21
i just wanted to reply back saying that Jesus4Lyf really did fix it all for me, i mean the only thing that was missing was me being an idiot about importing the spell...the tornado pulling one...

it was like there were some constant strings...and they were both some sort of order string...well i got those mixed up but once i reversed them then the spell works just fine. so that's why that I2E spell wasn't working but the others were working...
 

INCINERATE

New Member
Reaction score
12
can you post a demo map of these fixed spells so i can take a look at them also :D ?
 

Attachments

  • kamikaze.w3x
    55.4 KB · Views: 185

SanKakU

Member
Reaction score
21
edit: errm...i have to apologize...right now everything is so messed up in my map right now because i'm reworking mana and hitpoints and trying to make 3 new crazy heroes and trying to come up with item and monster ideas all at the same time...

i guess i'll just post the map i got right now which is still under development.

all of those heroes of course were worked on me so if you want to take any hero or spell ideas from there you have to go through me first. of course a lot of that stuff is things that other people posted, and some of them wish for credit...some of them may not have their credit expressed in the triggers, i don't know, things are a mess right now. if you use anything in there, check with me first. and you can only take something from there if you agree i will have access to an editable version of whatever you're working on, if i ask for it. check for a new thread, i'll post it there.

ok, here is the new thread....they didn't have a forum for this sortof thing here, so i posted it at the other site... http://www.hiveworkshop.com/forums/...s-coming-ancient-frontier-150943/#post1387035
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top