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

Simple spellpack in jass

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: maddeem
Few simple spell what easy to modify:

1. archer arrow rain: channel based and mainly work till u got mana or till u dont give different order
2. frost nova: simple nova what reduce the movement speed and hurt
3. fire nova: simple nova what knockback
4. arcane nova: simple
5. simple jump
6. simple damage over time
7. simple shuriken what bounceing (jump from enemy to enemy)
8. five sword (credit to shamanyouranus for sword model): summon 5 sword what leech the hp from target and give to u

1. Cure: Instant heal
2. Regen: Heal over time
3. Aoe Amplify damage
4. Aoe stun
5. Elemental escape (slowdown enemies, speed up caster)
6. Armageddon (half hp&mp convert to aoe damage)
7. Meteor (aka inferno animation with delayed dmg)
8. Normal firebolt with custom damage and timer (timer calculate the distance and time till firebolt hit the target)

it was made in 2 map
http://shadowvzs87.uw.hu/pack1.w3x
http://shadowvzs87.uw.hu/pack2.w3x

no pic about fireball/firebolt coz its everybody know


1.jpg

2.jpg

3.jpg

4.jpg

5.jpg

6.jpg

7.jpg

8.jpg

9.jpg

10.jpg

11.jpg

12.jpg

13.jpg



the jass in next post

Keywords:
jass gui easy beginner spell pack simple
Contents

Just another Warcraft III map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. Reviewed by Maker, Simple spellpack, 30th Dec Add importing instructions Add version number Flame attacked shouldn't be on when there are no flames in the map if (...

Moderator

M

Moderator

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


Reviewed by Maker, Simple spellpack, 30th Dec

  • Add importing instructions
  • Add version number
  • Flame attacked shouldn't be on when there are no flames in the map
  • if ( GetUnitState(u, ConvertUnitState(0)) > 0 ) then -> if GetWidgetLife(u) > 0 then [*]Instead of using local variables for effects you destroy immediately, use DestroyEffect(AddSpecialEffect(...)) [*][icode=jass](IsUnitEnemy(u, GetTriggerPlayer())==true) -> IsUnitEnemy(u, GetTriggerPlayer())
  • Instead of ConvertAttack/Weapon/Damage type, use WEAPON_TYPE_something, DAMAGE_TYPE_something, ATTACK_TYPE_something, where something is the type
  • OrderId2StringBJ... no, use non BJ
  • You only need to null locals when you don't use them anymore, not if you're going to set them again. (Arrow Rain)
  • JASS:
    loop
            exitwhen a > 1000
            ...
            set a = a + 1
    ^Make the 1000 configurable, a spell creating 1000 dummies won't be approved
  • When you declare locals, don't set them initially to null
  • Improve tooltips, look at dedault Blizzard tooltips for reference
  • Fix green icons

Optional improvements
  • Fix indenting
  • TriggerSleepAction adds 0.1-0.2 seconds to the spesified time in single player. Use a timer instead
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
5. icons... i dont got something good icon this is why i used craps coz anyway i am sure if maybe somebody what use it then he can find better icon like this:
Firenova: http://www.hiveworkshop.com/forums/icons-541/btnsupernova-85146/?prev=search=nova&d=list&r=20
Jump: http://www.hiveworkshop.com/forums/icons-541/btnjump-152805/?prev=search=jump&d=list&r=20
Shuriken: http://www.hiveworkshop.com/forums/...rike-131684/?prev=search=shuriken&d=list&r=20
Frost nova: http://www.hiveworkshop.com/forums/icons-541/btniceblast-56545/?prev=search=ice&d=list&r=20
Arrow Rain: http://www.hiveworkshop.com/forums/.../?prev=search=arrow%20rain&r=20&d=list&page=2


Cure
JASS:
function Trig_InstantHeal_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Trig_InstantHeal_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit ut = GetSpellTargetUnit()
    local real heal = ((I2R(GetUnitAbilityLevel(u, 'A000')) + 4.00) / 5.00) * (GetHeroInt(u, true) + GetUnitState(u, ConvertUnitState(3)) / 10.00)
    local real chp = GetUnitState(ut, ConvertUnitState(0))
    local string s = null
    local effect f = null
    set s = "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl"
    set f = AddSpecialEffectTarget(s, ut, "origin")
    if ((chp + heal) > GetUnitState(ut, ConvertUnitState(1))) then
        set heal = (GetUnitState(ut, ConvertUnitState(1))) - chp
    endif
    call SetUnitState(ut, ConvertUnitState(0), (chp + heal))
    call TriggerSleepAction(1)
    call DestroyEffect (f)
    set f = null
    set s = null
    set u = null
    set ut = null
endfunction


function InitTrig_Instant_Heal takes nothing returns nothing
    set gg_trg_Instant_Heal = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Instant_Heal, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Instant_Heal, Condition( function Trig_InstantHeal_Conditions ) )
    call TriggerAddAction( gg_trg_Instant_Heal, function Trig_InstantHeal_Actions )
endfunction

Regen

JASS:
function Trig_Regen_heal_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction

function Trig_Regen_heal_Actions takes nothing returns nothing
    local boolean b = false
    local unit u = GetTriggerUnit()
    local unit ut = GetSpellTargetUnit()
    local real heal = (GetUnitAbilityLevel(u, 'A001') + 4) / 10.00 * GetHeroInt(u, true) + 1
    local real chp = GetUnitState(ut, ConvertUnitState(0))
    local integer hdur = 30
    local integer i = 0
    local string s = null
    local effect f = null

    loop
        exitwhen b == true

        if ( GetUnitState(ut, ConvertUnitState(0)) > 0 ) then
            set s = "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl"
            set f = AddSpecialEffectTarget(s, ut, "origin")
            set chp = GetUnitState(ut, ConvertUnitState(0))
            call SetUnitState(ut, ConvertUnitState(0), chp + heal)
            call TriggerSleepAction(1)
            call DestroyEffect (f)
        else
            set b = true
        endif

        if (i==hdur) then
            set b = true
        endif
        set i = i + 1
    endloop


    set f = null
    set s = null
    set u = null
    set ut = null
endfunction


function InitTrig_Regen_heal takes nothing returns nothing
    set gg_trg_Regen_heal = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Regen_heal, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Regen_heal, Condition( function Trig_Regen_heal_Conditions ) )
    call TriggerAddAction( gg_trg_Regen_heal, function Trig_Regen_heal_Actions )
endfunction

Aoe amplify

JASS:
function Trig_Aoe_Amplify_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A002'
endfunction

function Trig_Aoe_Amplify_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit pu
    local unit array ua
    local integer bdur = 15
    local integer a = 0
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local group gr = CreateGroup()
    local string s = "Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl"
    local string s1 = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeDamageTarget.mdl"
    local effect f = AddSpecialEffectTarget(s, u, "overhead")
    local effect array df
    local player p = GetOwningPlayer(u)
    local integer i = 0
    local integer d

    call GroupEnumUnitsInRange(gr, x, y, 250.00, null)
    loop
        set pu = FirstOfGroup(gr)
        exitwhen (pu==null)
        if ((IsUnitEnemy(pu, GetTriggerPlayer())) and (GetUnitState(pu, ConvertUnitState(0)) > 0)) then
            set df[i] = AddSpecialEffectTarget(s1, pu, "overhead")
            set ua[i] = pu
            call UnitAddAbility( ua[i], 'A006')
            call IssueImmediateOrder( ua[i], "stop" )
            call IssueImmediateOrder( ua[i], "berserk" )
            set i = i + 1
        endif
        call GroupRemoveUnit(gr, pu)
    endloop
    call DestroyGroup(gr)
    set d = i
    set i = 0
    call TriggerSleepAction(1)
    call DestroyEffect(f)
    loop
        exitwhen (a==bdur - 1)
        call TriggerSleepAction(1)
        loop
            exitwhen (i==d)
            if GetUnitState(ua[i], ConvertUnitState(0))<=0 then
                call DestroyEffect(df[i])
                call UnitRemoveAbility( ua[i], 'A006' )
                set df[i] = null
                set ua[i] = null
            endif
            set i = i + 1
        endloop
        set i = 0
        set a = a + 1
    endloop

    loop
        exitwhen (i==d)
        if (ua[i]!=null) then
            call DestroyEffect(df[i])
            call UnitRemoveAbility( ua[i], 'A006' )
            set df[i] = null
            set ua[i] = null
        endif
        set i = i + 1
    endloop

    set f = null
    set s = null
    set u = null
    set gr = null
    set p = null
    set s1 = null
endfunction


function InitTrig_Aoe_amplify_damage takes nothing returns nothing
    set gg_trg_Aoe_amplify_damage = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Aoe_amplify_damage, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Aoe_amplify_damage, Condition( function Trig_Aoe_Amplify_Conditions ) )
    call TriggerAddAction( gg_trg_Aoe_amplify_damage, function Trig_Aoe_Amplify_Actions )
endfunction

Aoe Stun (lion roar)

JASS:
function Trig_Aoe_Stun_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A003'
endfunction

function Trig_Aoe_Stun_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit pu
    local unit ud
    local integer sdur = 4
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local group gr = CreateGroup()
//set s = "Units\\NightElf\\Wisp\\WispExplode.mdl"
    local string s = "Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl"
    local effect f = AddSpecialEffectTarget(s, u, "origin")
    local player p = GetOwningPlayer(u)

    call GroupEnumUnitsInRange(gr, x, y, 250.00, null)
    loop
        set pu = FirstOfGroup(gr)
        exitwhen (pu==null)
        if ((IsUnitEnemy(pu, GetTriggerPlayer())) and (GetUnitState(pu, ConvertUnitState(0)) > 0)) then
            set ud = CreateUnit (p, 'o000', GetUnitX(pu) , GetUnitY(pu), 0)
            call UnitApplyTimedLife( ud, 'BTLF', 1.5 )
            call UnitAddAbility( ud, 'A009')
            call SetUnitAbilityLevel( ud, 'A009', 1 )
            call IssueTargetOrder( ud, "firebolt", pu )
        endif
        call GroupRemoveUnit(gr, pu)
    endloop
    call DestroyGroup(gr)
    call DestroyEffect(f)
    set f = null
    set s = null
    set u = null
    set gr = null
    set p = null
    set ud = null
endfunction


function InitTrig_Aoe_Stun takes nothing returns nothing
    set gg_trg_Aoe_Stun = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Aoe_Stun, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Aoe_Stun, Condition( function Trig_Aoe_Stun_Conditions ) )
    call TriggerAddAction( gg_trg_Aoe_Stun, function Trig_Aoe_Stun_Actions )
endfunction

Elemental escape

JASS:
function Trig_Elemental_escape_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A004'
endfunction

function Trig_Elemental_escape_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit pu
    local unit array ua
    local integer bdur = 5
    local integer a = 0
    local real spdred = 50 / 100.00
    local real spdinc = 50 / 100.00
    local real spdc = GetUnitMoveSpeed(u) * spdinc
    local real array spd
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local group gr = CreateGroup()
    local string s = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeEmbers.mdl"
    local string s1 = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
    local string s2 = "Abilities\\Spells\\Items\\OrbCorruption\\OrbCorruptionMissile.mdl"
    local effect f1 = AddSpecialEffectTarget(s, u, "foot left")
    local effect f2 = AddSpecialEffectTarget(s, u, "foot right")
    local effect array df
    local player p = GetOwningPlayer(u)
    local integer i = 0
    local integer d

    call SetUnitMoveSpeed( u, GetUnitMoveSpeed(u) + spdc )

    call GroupEnumUnitsInRange(gr, x, y, 325.00, null)
    loop
        set pu = FirstOfGroup(gr)
        exitwhen (pu==null)
        if ((IsUnitEnemy(pu, GetTriggerPlayer())) and (GetUnitState(pu, ConvertUnitState(0)) > 0) and (pu!=u)) then
            set df[i] = AddSpecialEffectTarget(s1, pu, "origin")
            set ua[i] = pu
            call SetUnitVertexColor(ua[i], 100, 100, 255, 255)
            set spd[i] = GetUnitMoveSpeed(ua[i]) * spdred
            call SetUnitMoveSpeed( ua[i], GetUnitMoveSpeed(ua[i]) - spd[i] )
            set i = i + 1
        endif
        call GroupRemoveUnit(gr, pu)
    endloop
    call DestroyGroup(gr)
    set d = i
    set i = 0
    call TriggerSleepAction(1)
    loop
        exitwhen (i==d)
        call DestroyEffect(df[i])
        set df[i] = AddSpecialEffectTarget(s2, pu, "overhead")
        set i = i + 1
    endloop

    set i = 0

    loop
        exitwhen (a==bdur - 1)
        call TriggerSleepAction(1)
        loop
            exitwhen (i==d)
            if GetUnitState(ua[i], ConvertUnitState(0))<=0 then
                call DestroyEffect(df[i])
                call SetUnitMoveSpeed( ua[i], GetUnitMoveSpeed(ua[i]) + spd[i] )
                call SetUnitVertexColor(ua[i], 255, 255, 255, 255)
                set df[i] = null
                set ua[i] = null
            endif
            set i = i + 1
        endloop
        set i = 0
        set a = a + 1
    endloop

    loop
        exitwhen (i==d)
        if (ua[i]!=null) then
            call DestroyEffect(df[i])
            call SetUnitMoveSpeed( ua[i], GetUnitMoveSpeed(ua[i]) + spd[i] )
            call SetUnitVertexColor(ua[i], 255, 255, 255, 255)
            set df[i] = null
            set ua[i] = null
        endif
        set i = i + 1
    endloop

    call SetUnitMoveSpeed( u, GetUnitMoveSpeed(u) - spdc )
    call DestroyEffect(f1)
    call DestroyEffect(f2)
    set f1 = null
    set f2 = null
    set u = null
    set gr = null
    set p = null
    set s = null
    set s1 = null
    set s2 = null
endfunction


function InitTrig_Elemental_escape takes nothing returns nothing
    set gg_trg_Elemental_escape = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Elemental_escape, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Elemental_escape, Condition( function Trig_Elemental_escape_Conditions ) )
    call TriggerAddAction( gg_trg_Elemental_escape, function Trig_Elemental_escape_Actions )
endfunction

Armageddon

JASS:
function Trig_Perdition_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A005'
endfunction

function Trig_Perdition_Actions takes nothing returns nothing
    local boolean b = false
    local unit u = GetTriggerUnit()
    local unit pu
    local real dmg = GetUnitState(u, ConvertUnitState(0)) / 2 + GetUnitState(u, ConvertUnitState(2)) / 2
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local string s1 = "Units\\NightElf\\Wisp\\WispExplode.mdl"
    local effect f1 = AddSpecialEffectTarget(s1, u, "origin")
    local string s2 = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
    local effect f2 = AddSpecialEffectTarget(s2, u, "origin")
    local group gr = CreateGroup()

    call SetUnitState(u, ConvertUnitState(2), GetUnitState(u, ConvertUnitState(2)) / 2 )
    if (GetUnitState(u, ConvertUnitState(0)) > 1) then
        call SetUnitState(u, ConvertUnitState(0), GetUnitState(u, ConvertUnitState(0)) / 2 )
    endif
    call GroupEnumUnitsInRange(gr, x, y, 250.00, null)
    loop
        set pu = FirstOfGroup(gr)
        exitwhen (pu==null)
        if ((IsUnitEnemy(pu, GetTriggerPlayer())) and (GetUnitState(pu, ConvertUnitState(0)) > 0)) then
            call UnitDamageTarget(u, pu, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
        endif
        call GroupRemoveUnit(gr, pu)
    endloop

    call TriggerSleepAction(1)
    call DestroyEffect (f1)
    call DestroyEffect (f2)
    call DestroyGroup(gr)
    set f1 = null
    set s1 = null
    set f2 = null
    set s2 = null
    set u = null
    set gr = null
endfunction


function InitTrig_Perdition takes nothing returns nothing
    set gg_trg_Perdition = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Perdition, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Perdition, Condition( function Trig_Perdition_Conditions ) )
    call TriggerAddAction( gg_trg_Perdition, function Trig_Perdition_Actions )
endfunction

Meteor

JASS:
function Trig_Meteor_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A007'
endfunction

function Trig_Meteor_Actions takes nothing returns nothing
    local unit pu
    local unit u = GetTriggerUnit()
    local real xt = GetSpellTargetX()
    local real yt = GetSpellTargetY()
    local real dmg = (GetUnitAbilityLevel(u, 'A001') + 4) / 10.00 * GetHeroInt(u, true) + 1
    local real hdmg = dmg / 2
    local string array s
    local effect f = null
    local group gr = CreateGroup()
    set s[1] = "Objects\\Spawnmodels\\Demon\\InfernalMeteor\\InfernalMeteor.mdl"
    set s[2] = "Objects\\Spawnmodels\\Demon\\InfernalMeteor\\InfernalMeteor2.mdl"
    set s[3] = "Objects\\Spawnmodels\\Demon\\InfernalMeteor\\InfernalMeteor3.mdl"
    set s[4] = "Objects\\Spawnmodels\\Human\\SmallFlameSpawn\\SmallFlameSpawn.mdl"
   
    set f = AddSpecialEffect (s[GetRandomInt(1, 3)], xt, yt)
    call TriggerSleepAction(2.5)
    call DestroyEffect (f)
    set f = AddSpecialEffect (s[4], xt, yt)

    call GroupEnumUnitsInRange(gr, xt, yt, 150.00, null)
    loop
        set pu = FirstOfGroup(gr)
        exitwhen (pu==null)
        if ((IsUnitEnemy(pu, GetTriggerPlayer())) and (GetUnitState(pu, ConvertUnitState(0)) > 0)) then
            call UnitDamageTarget(u, pu, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
        endif
        call GroupRemoveUnit(gr, pu)
    endloop

    call TriggerSleepAction(0.5)

    call GroupEnumUnitsInRange(gr, xt, yt, 150.00, null)
    loop
        set pu = FirstOfGroup(gr)
        exitwhen (pu==null)
        if ((IsUnitEnemy(pu, GetTriggerPlayer())) and (GetUnitState(pu, ConvertUnitState(0)) > 0)) then
            call UnitDamageTarget(u, pu, hdmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
        endif
        call GroupRemoveUnit(gr, pu)
    endloop
    call TriggerSleepAction(1)
    call DestroyEffect (f)
    call DestroyGroup(gr)
    set gr = null
    set f = null
    set s[1] = null
    set s[2] = null
    set s[3] = null
    set s[4] = null
    set u = null
endfunction


function InitTrig_Meteor takes nothing returns nothing
    set gg_trg_Meteor = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Meteor, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Meteor, Condition( function Trig_Meteor_Conditions ) )
    call TriggerAddAction( gg_trg_Meteor, function Trig_Meteor_Actions )
endfunction

Simple Firebolt

JASS:
function Trig_Fireball_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A008'
endfunction

function Handlerfunc takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = GetTriggerUnit()
    local unit ut = GetSpellTargetUnit()
    local real dmg = (GetUnitAbilityLevel(u, 'A001') + 4) / 10.00 * GetHeroInt(u, true) + 1
    call UnitDamageTarget(u, ut, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
    call PauseTimer(t)
    call DestroyTimer(t)
    set t = null
    set u = null
    set ut = null
endfunction

function Trig_Fireball_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit ut = GetSpellTargetUnit()
    local unit uc = null
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real xt = GetUnitX(ut)
    local real yt = GetUnitY(ut)
    local real ang = 180.0 / 3.14159 * Atan2(yt - y, xt - x)
    local real missilespeed = 1000
    local real time = (SquareRoot((xt - x) * (xt - x) + (yt - y) * (yt - y))) / missilespeed
    local player p = GetOwningPlayer(u)
    local timer t = CreateTimer()

    set uc = CreateUnit (p, 'o000', x , y, ang)
    call UnitAddAbility( uc, 'ACfb')
    call IssueTargetOrder( uc, "firebolt", ut )
    call UnitApplyTimedLife( uc, 'BTLF', 1.5 )

    call TimerStart(t, time, false, function Handlerfunc)
     
    set t = null
    set u = null
    set ut = null
    set uc = null
    set p = null
endfunction


function InitTrig_Fireball takes nothing returns nothing
    set gg_trg_Fireball = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Fireball, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Fireball, Condition( function Trig_Fireball_Conditions ) )
    call TriggerAddAction( gg_trg_Fireball, function Trig_Fireball_Actions )
endfunction

Flame steps
JASS:
function Trig_Falmes_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A009'
endfunction

function Trig_Falmes_Actions takes nothing returns nothing
    local integer a = 0
    local unit u = GetTriggerUnit()
    local unit u1 = null
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real g = 3.14159 / 180
    local integer dur = 100
    local integer utime = 5
    local player p = GetOwningPlayer(GetTriggerUnit())
    local string s = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeEmbers.mdl"
    local effect f1 = AddSpecialEffectTarget(s, u, "foot left")
    local effect f2 = AddSpecialEffectTarget(s, u, "foot right")
    call SetUnitMoveSpeed( u, GetUnitMoveSpeed(u) + 50 )
    call SetUnitPathing( u, false )
    loop
        exitwhen a > dur
        set x = GetUnitX(u)
        set y = GetUnitY(u)
        if ( GetUnitState(u, ConvertUnitState(0)) > 0 ) then
            set u1 = CreateUnit (p, 'h002', x , y, 0)
            call UnitApplyTimedLife( u1, 'BTLF', utime )
            call SetUnitPathing( u1, false )
            call TriggerSleepAction(0.05)
        endif
        set a = a + 1
    endloop
    call DestroyEffect(f1)
    call DestroyEffect(f2)
    call SetUnitMoveSpeed( u, GetUnitMoveSpeed(u) - 150 )
    call SetUnitPathing( u, true )
    set u = null
    set u1 = null
    set p = null
    set f1 = null
    set f2 = null
    set s = null
endfunction


function InitTrig_Flames takes nothing returns nothing
    set gg_trg_Flames = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Flames, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
    call TriggerAddCondition( gg_trg_Flames, Condition( function Trig_Falmes_Conditions ) )
    call TriggerAddAction( gg_trg_Flames, function Trig_Falmes_Actions )
endfunction

Arrow Rain

JASS:
function Trig_Arrow_Rain_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'ANcl'
endfunction

function Unit_Group3 takes nothing returns boolean
    local unit u = GetFilterUnit()
    local unit ut = GetTriggerUnit()
    local real dmg = 10 + (GetUnitAbilityLevel(ut, 'ANcl')) * 50
    if (IsUnitEnemy(u, GetTriggerPlayer())==true) then
        call UnitDamageTarget(ut, u, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
    endif
    set u = null
    set ut = null
    return false
endfunction

function Trig_Arrow_Rain_Actions takes nothing returns nothing
    local integer a = 0
    local integer b = 0
    local integer c = 0
    local integer d = 0
    local integer e = 0
    local unit u = GetTriggerUnit()
    local unit u1 = null
    local unit u2 = null
    local real x1 = GetUnitX(u)
    local real y1 = GetUnitY(u)
    local real x2 = GetSpellTargetX()
    local real y2 = GetSpellTargetY()
    local real x3 = 0
    local real y3 = 0
    local real x4 = 0
    local real y4 = 0
    local real g = 3.14159 / 180
    local player p = GetOwningPlayer(u)
    local string s = "Abilities\\Spells\\Other\\Drain\\ManaDrainTarget.mdl"
    local effect f = AddSpecialEffectTarget(s, u, "origin")
    local group gr = CreateGroup()

    loop
        exitwhen a > 1000
        loop
            exitwhen b > 10
            set x3 = x1 + GetRandomReal(0, 200.00) * Cos(g * GetRandomReal(0, 360.0))
            set y3 = y1 + GetRandomReal(0, 200.00) * Sin(g * GetRandomReal(0, 360.0))
            set u1 = CreateUnit (p, 'h000', x3 , y3, 0)
            call UnitAddAbility(u1, 'Amrf' )
            call UnitRemoveAbility(u1, 'Amrf' )
            call SetUnitFlyHeight( u1, 1500.00, GetRandomReal(800.00, 1000.00) )
            call UnitApplyTimedLife( u1, 'BTLF', 3.00 )
            set u1 = null
            set b = b + 1
        endloop
        
        if (a > 5) then

            loop
                exitwhen c > 10
                set x4 = x2 + GetRandomReal(0, 200.00) * Cos(g * GetRandomReal(0, 359.0))
                set y4 = y2 + GetRandomReal(0, 200.00) * Sin(g * GetRandomReal(0, 359.0))
                set u2 = CreateUnit (p, 'h001', x4 , y4, 0)
                call UnitAddAbility(u2, 'Amrf' )
                call UnitRemoveAbility(u2, 'Amrf' )
                call SetUnitFlyHeight( u2, GetRandomReal(5.00, 40.00), GetRandomReal(900.00, 1000.00) )
                call UnitApplyTimedLife( u2, 'BTLF', 6.00 )
                set c = c + 1
            endloop
            set d = d + 1
            if ((a / 4 * 4) == 0) then
                call GroupEnumUnitsInRange(gr, x2, y2, 200.00, Condition(function Unit_Group3))
                call SetUnitState(u, ConvertUnitState(2), GetUnitState(u, ConvertUnitState(2)) - 5)
            endif
        endif
        call TriggerSleepAction(0.1)
        if ((OrderId2StringBJ(GetUnitCurrentOrder(u)) != "channel") and (GetUnitState(u, ConvertUnitState(0)) > 0)) then
            set a = 10000
        elseif (GetUnitState(u, ConvertUnitState(2)) < 5.00) then
            set a = 10000
            call IssueImmediateOrder( GetTriggerUnit(), "stop" )
        endif
        set a = a + 1
        set e = e + 1
        set b = 0
        set c = 0
    endloop
    call DestroyEffect(f)
    set d = e - d
    set a = 0
    loop
        exitwhen a > d
        loop
            exitwhen c > 10
            set x4 = x2 + GetRandomReal(0, 200.00) * Cos(g * GetRandomReal(0, 359.0))
            set y4 = y2 + GetRandomReal(0, 200.00) * Sin(g * GetRandomReal(0, 359.0))
            set u2 = CreateUnit (p, 'h001', x4 , y4, 0)
            call UnitAddAbility(u2, 'Amrf' )
            call UnitRemoveAbility(u2, 'Amrf' )
            call SetUnitFlyHeight( u2, GetRandomReal(10.00, 30.00), GetRandomReal(900.00, 1000.00) )
            call UnitApplyTimedLife( u2, 'BTLF', 6.00 )
            set c = c + 1
        endloop
        call TriggerSleepAction(0.1)
        if ((a - I2R(R2I(a / 4)) * 4) == 0) then
            call GroupEnumUnitsInRange(gr, x2, y2, 200.00, Condition(function Unit_Group3))
        endif
        set a = a + 1
        set c = 0
    endloop

    call DestroyGroup(gr)
    set gr = null
    set u = null
    set u1 = null
    set u2 = null
    set p = null
    set s = null
endfunction


function InitTrig_Arrow_Rain takes nothing returns nothing
    set gg_trg_Arrow_Rain = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Arrow_Rain, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Arrow_Rain, Condition( function Trig_Arrow_Rain_Conditions ) )
    call TriggerAddAction( gg_trg_Arrow_Rain, function Trig_Arrow_Rain_Actions )
endfunction

JASS:
function Trig_Untitled_Trigger_003_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A007'
endfunction

function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
    local unit uc = GetTriggerUnit()
    local unit u = GetSpellTargetUnit()
    local unit u1
    local unit u2
    local unit u3
    local unit u4
    local unit u5
    local integer a = 0
    local integer h1 = 330
    local integer h2 = 320
    local integer d = 10
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real g = (3.14159 / 180)
    local real x1 = x + 300 * Cos(g * 0)
    local real y1 = y + 300 * Sin(g * 0)
    local real x2 = x + 300 * Cos(g * 72)
    local real y2 = y + 300 * Sin(g * 72)
    local real x3 = x + 300 * Cos(g * 144)
    local real y3 = y + 300 * Sin(g * 144)
    local real x4 = x + 300 * Cos(g * 216)
    local real y4 = y + 300 * Sin(g * 216)
    local real x5 = x + 300 * Cos(g * 288)
    local real y5 = y + 300 * Sin(g * 288)
    local real sp = 100
    local real hp = GetUnitState(u, ConvertUnitState(0))
    local real chp = hp
    local real cchp = GetUnitState(uc, ConvertUnitState(0))
    local real mhp = hp / 33
    local lightning l1 = null
    local lightning l2 = null
    local lightning l3 = null
    local lightning l4 = null
    local lightning l5 = null
    local lightning l6 = null
    local lightning l7 = null
    local lightning l8 = null
    local lightning l9 = null
    local lightning l10 = null
    local player p = GetOwningPlayer(GetTriggerUnit())
    local string s1 = "Abilities\\Spells\\Human\\DivineShield\\DivineShieldTarget.mdl"
    local effect f = AddSpecialEffectTarget(s1, u, "origin")
    call SetUnitInvulnerable( u, true )
    call PauseUnit( u, true )
    set u1 = CreateUnit (p, 'h003', x1 , y1, 0)
    call UnitAddAbility(u1, 'Amrf' )
    call UnitRemoveAbility(u1, 'Amrf' )
    call SetUnitFlyHeight( u1, h1, sp * 4 )
    set u2 = CreateUnit (p, 'h003', x2 , y2, 0)
    call UnitAddAbility(u2, 'Amrf' )
    call UnitRemoveAbility(u2, 'Amrf' )
    call SetUnitFlyHeight( u2, h1, sp * 4 )
    set u3 = CreateUnit (p, 'h003', x3 , y3, 0)
    call UnitAddAbility(u3, 'Amrf' )
    call UnitRemoveAbility(u3, 'Amrf' )
    call SetUnitFlyHeight( u3, h1, sp * 4 )
    set u4 = CreateUnit (p, 'h003', x4 , y4, 0)
    call UnitAddAbility(u4, 'Amrf' )
    call UnitRemoveAbility(u4, 'Amrf' )
    call SetUnitFlyHeight( u4, h1, sp * 4 )
    set u5 = CreateUnit (p, 'h003', x5 , y5, 0)
    call UnitAddAbility(u5, 'Amrf' )
    call UnitRemoveAbility(u5, 'Amrf' )
    call SetUnitFlyHeight( u5, h1, sp * 4 )
    call UnitAddAbility(u, 'Amrf' )
    call UnitRemoveAbility(u, 'Amrf' )
    call SetUnitFlyHeight( u, h2, sp )

    call TriggerSleepAction(3.2)
    call UnitApplyTimedLife( u1, 'BUan', d + 15 )
    call UnitApplyTimedLife( u2, 'BUan', d + 15 )
    call UnitApplyTimedLife( u3, 'BUan', d + 15 )
    call UnitApplyTimedLife( u4, 'BUan', d + 15 )
    call UnitApplyTimedLife( u5, 'BUan', d + 15 )

    set l1 = AddLightningEx("DRAL", true, x1, y1, 320, x, y, 320)
    call SetLightningColor(l1, 1, 0, 0, 1)
    set l2 = AddLightningEx("DRAL", true, x2, y2, 320, x, y, 320)
    call SetLightningColor(l2, 1, 0, 0, 1)
    set l3 = AddLightningEx("DRAL", true, x3, y3, 320, x, y, 320)
    call SetLightningColor(l3, 1, 0, 0, 1)
    set l4 = AddLightningEx("DRAL", true, x4, y4, 320, x, y, 320)
    call SetLightningColor(l4, 1, 0, 0, 1)
    set l5 = AddLightningEx("DRAL", true, x5, y5, 320, x, y, 320)
    call SetLightningColor(l5, 1, 0, 0, 1)
    call TriggerSleepAction(0.01)
    set l6 = AddLightningEx("LEAS", true, x1, y1, 320, x5, y5, 320)
    call SetLightningColor(l6, 0, 0, 1, 1)
    call TriggerSleepAction(0.01)
    set l7 = AddLightningEx("LEAS", true, x2, y2, 320, x1, y1, 320)
    call SetLightningColor(l7, 0, 0, 1, 1)
    call TriggerSleepAction(0.01)
    set l8 = AddLightningEx("LEAS", true, x3, y3, 320, x2, y2, 320)
    call SetLightningColor(l8, 0, 0, 1, 1)
    call TriggerSleepAction(0.01)
    set l9 = AddLightningEx("LEAS", true, x4, y4, 320, x3, y3, 320)
    call SetLightningColor(l9, 0, 0, 1, 1)
    call TriggerSleepAction(0.01)
    set l10 = AddLightningEx("LEAS", true, x5, y5, 320, x4, y4, 320)
    call SetLightningColor(l10, 0, 0, 1, 1)
    loop
        exitwhen a > d
        call TriggerSleepAction(1)
        call SetUnitState(u, ConvertUnitState(0), chp - mhp)
        call SetUnitState(uc, ConvertUnitState(0), cchp + mhp)
        set chp = GetUnitState(u, ConvertUnitState(0))
        set cchp = GetUnitState(uc, ConvertUnitState(0))
        set a = a + 1
    endloop
    call TriggerSleepAction(1)
    call DestroyLightning(l1)
    call DestroyLightning(l2)
    call DestroyLightning(l3)
    call DestroyLightning(l4)
    call DestroyLightning(l5)
    call DestroyLightning(l6)
    call DestroyLightning(l7)
    call DestroyLightning(l8)
    call DestroyLightning(l9)
    call DestroyLightning(l10)
    call SetUnitFlyHeight( u1, 1500, sp * 4 )
    call SetUnitFlyHeight( u2, 1500, sp * 4 )
    call SetUnitFlyHeight( u3, 1500, sp * 4 )
    call SetUnitFlyHeight( u4, 1500, sp * 4 )
    call SetUnitFlyHeight( u5, 1500, sp * 4 )
    call UnitAddAbility(u, 'Amrf' )
    call UnitRemoveAbility(u, 'Amrf' )
    call SetUnitFlyHeight( u, 0, sp )
    call TriggerSleepAction(3)
    call PauseUnit( u, false )
    call SetUnitInvulnerable( u, false )
    call DestroyEffect(f)
    set u = null
    set u1 = null
    set u2 = null
    set u3 = null
    set u4 = null
    set u5 = null
    set p = null
    set f = null
    set s1 = null
    set l1 = null
    set l2 = null
    set l3 = null
    set l4 = null
    set l5 = null
    set l6 = null
    set l7 = null
    set l8 = null
    set l9 = null
    set l10 = null
endfunction


function InitTrig_Magical_sword takes nothing returns nothing
    set gg_trg_Magical_sword = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Magical_sword, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Magical_sword, Condition( function Trig_Untitled_Trigger_003_Conditions ) )
    call TriggerAddAction( gg_trg_Magical_sword, function Trig_Untitled_Trigger_003_Actions )
endfunction
arcane nova
JASS:
function Unit_Group1 takes nothing returns boolean
    local unit u = GetFilterUnit()
    local unit ut = GetTriggerUnit()
    local real dmg = 10 + (GetUnitAbilityLevel(ut, 'A006')) * 50
    if ((IsUnitEnemy(u, GetTriggerPlayer())==true)) then
        call UnitDamageTarget(ut, u, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
    endif
    set u = null
    set ut = null
    return false
endfunction

function Unit_Group2 takes nothing returns boolean
    local unit u = GetFilterUnit()
    local unit ut = GetTriggerUnit()
    local real dmg = 10 + (GetUnitAbilityLevel(u, 'A006')) * 50
    local real d = SquareRoot((GetUnitX(ut) - GetUnitX(u)) * (GetUnitX(ut) - GetUnitX(u)) + (GetUnitY(ut) - GetUnitY(u)) * (GetUnitY(ut) - GetUnitY(u)))
    if ((IsUnitEnemy(u, GetTriggerPlayer())==true) and (d > 300)) then
        call UnitDamageTarget(ut, u, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
    endif
    set u = null
    set ut = null
    return false
endfunction


function Trig_Firebolt_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A006'
endfunction

function Trig_Firebolt_Actions takes nothing returns nothing
    local unit uc = GetTriggerUnit()
    local integer a = 0
    local integer d1 = 150
    local integer d2 = 900
    local integer fnr = 36
    local real h = 180 / 3.14159
    local real g = 360 / fnr * 3.14159 / 180
    local real r
    local real ux = GetUnitX(uc)
    local real uy = GetUnitY(uc)
    local real x1
    local real y1
    local real x2
    local real y2
    local unit u
    local player p = GetOwningPlayer(GetTriggerUnit())
    local group gr = CreateGroup()
    loop
        exitwhen a > fnr
        set x1 = ux + d1 * Cos(g * a)
        set y1 = uy + d1 * Sin(g * a)
        set x2 = ux + d2 * Cos(g * a)
        set y2 = uy + d2 * Sin(g * a)
        set r = h * Atan2(y2 - y1, x2 - x1)
        set u = CreateUnit (p, 'h004', x1 , y1, r)
        call SetUnitPathing( u, false )
        call IssuePointOrder (u, "move" , x2, y2)
        call UnitApplyTimedLife( u, 'BTLF', 1.3 )
        set a = a + 1
    endloop
    call GroupEnumUnitsInRange(gr, ux, uy, 300.00, Condition(function Unit_Group1))
    call TriggerSleepAction(0.5)
    call GroupEnumUnitsInRange(gr, ux, uy, 600.00, Condition(function Unit_Group2))
    call DestroyGroup(gr)
    set uc = null
    set p = null
    set u = null
    set gr = null
endfunction


function InitTrig_Explosive_nova takes nothing returns nothing
    set gg_trg_Explosive_nova = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Explosive_nova, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Explosive_nova, Condition( function Trig_Firebolt_Conditions ) )
    call TriggerAddAction( gg_trg_Explosive_nova, function Trig_Firebolt_Actions )
endfunction

Jump

JASS:
function Trig_Jump_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A008'
endfunction

function Unit_Group takes nothing returns boolean
    local unit u = GetFilterUnit()
    local unit ut = GetTriggerUnit()
    local real dmg = 10 + (GetUnitAbilityLevel(ut, 'A008')) * 50
    if (IsUnitEnemy(u, GetTriggerPlayer())==true) then
        call UnitDamageTarget(ut, u, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
    endif
    set u = null
    set ut = null
    return false
endfunction

function Trig_Jump_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local integer a = 0
    local integer h = 400
    local real fsp1 = 600
    local real fsp2 = 900
    local integer d = 10
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real x1 = x + 330 * Cos(GetUnitFacing(u) * 3.14159 / 180)
    local real y1 = y + 330 * Sin(GetUnitFacing(u) * 3.14159 / 180)
    local player p = GetOwningPlayer(GetTriggerUnit())
    local string s1 = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
    local effect f = null
    local group gr = CreateGroup()
    call SetUnitInvulnerable( u, true )
    call UnitAddAbility(u, 'Amrf' )
    call UnitRemoveAbility(u, 'Amrf' )
    call SetUnitFlyHeight( u, h, fsp1 )
    call IssuePointOrder (u, "move" , x1, y1)
    call TriggerSleepAction(0.5)
    call UnitAddAbility(u, 'Amrf' )
    call UnitRemoveAbility(u, 'Amrf' )
    call SetUnitFlyHeight( u, 0, fsp2 )
    call TriggerSleepAction(0.3)
    set x = GetUnitX(u)
    set y = GetUnitY(u)
    set f = AddSpecialEffect(s1, x, y)
    call GroupEnumUnitsInRange(gr, x, y, 250.00, Condition(function Unit_Group))
    call TriggerSleepAction(0.2)
    call SetUnitInvulnerable( u, false )
    call DestroyEffect(f)
    call DestroyGroup(gr)
    set u = null
    set gr = null
    set p = null
    set f = null
    set s1 = null

endfunction


function InitTrig_Jump takes nothing returns nothing
    set gg_trg_Jump = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Jump, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Jump, Condition( function Trig_Jump_Conditions ) )
    call TriggerAddAction( gg_trg_Jump, function Trig_Jump_Actions )
endfunction

frost nova

JASS:
function Unit_Group4 takes nothing returns boolean
    local unit u = GetFilterUnit()
    local unit ut = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitX(u)
    local real dmg = 10 + (GetUnitAbilityLevel(ut, 'A004')) * 50
    if ((IsUnitEnemy(u, GetTriggerPlayer())==true)) then
        call UnitDamageTarget(ut, u, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
    endif
    set u = null
    set ut = null
    return false
endfunction

function Trig_Frostnova_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A004'
endfunction

function Trig_Frostnova_Actions takes nothing returns nothing
    local unit uc = GetTriggerUnit()
    local integer a = 0
    local integer d1 = 50
    local integer d2 = 600
    local integer fnr = 36
    local real h = 180 / 3.14159
    local real g = 360 / fnr * 3.14159 / 180
    local real r
    local real ux = GetUnitX(uc)
    local real uy = GetUnitY(uc)
    local real x1
    local real y1
    local real x2
    local real y2
    local unit u
    local player p = GetOwningPlayer(GetTriggerUnit())
    local group gr = CreateGroup()
    loop
        exitwhen a > fnr
        set x1 = ux + d1 * Cos(g * a)
        set y1 = uy + d1 * Sin(g * a)
        set x2 = ux + d2 * Cos(g * a)
        set y2 = uy + d2 * Sin(g * a)
        set r = h * Atan2(y2 - y1, x2 - x1)
        set u = CreateUnit (p, 'h005', x1 , y1, r)
        call SetUnitPathing( u, false )
        call IssuePointOrder (u, "move" , x2, y2)
        call UnitApplyTimedLife( u, 'BTLF', 1.5 )
        set a = a + 1
    endloop
    call TriggerSleepAction(0.5)
    call GroupEnumUnitsInRange(gr, ux, uy, 600.00, Condition(function Unit_Group4))
    call DestroyGroup(gr)
    set uc = null
    set p = null
    set u = null
    set gr = null
endfunction


function InitTrig_Frostnova takes nothing returns nothing
    set gg_trg_Frostnova = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Frostnova, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Frostnova, Condition( function Trig_Frostnova_Conditions ) )
    call TriggerAddAction( gg_trg_Frostnova, function Trig_Frostnova_Actions )
endfunction

Dot

JASS:
function Trig_Dot_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A002'
endfunction

function Trig_Dot_Actions takes nothing returns nothing
    local unit uc = GetTriggerUnit()
    local unit ut = GetSpellTargetUnit()
    local integer a = 0
    local integer h1 = 330
    local integer h2 = 320
    local integer d = 20
    local real hp = (GetUnitState(ut, ConvertUnitState(1))) / 100 //max hp 1%
    local real dmg = 10 * (GetUnitAbilityLevel(uc, 'A002')) + hp
    local player p = GetOwningPlayer(ut)
    local string s = "Abilities\\Spells\\NightElf\\shadowstrike\\shadowstrike.mdl"
    local effect f = AddSpecialEffectTarget(s, ut, "overhead")
    call TriggerSleepAction(3.2)
    loop
        exitwhen a > d
        if ( GetUnitState(ut, ConvertUnitState(0)) > 0 ) then
            call UnitDamageTarget(uc, ut, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
            call TriggerSleepAction(1)
        endif
        set a = a + 1
    endloop
    call DestroyEffect(f)
    set ut = null
    set uc = null
    set p = null
    set f = null
    set s = null
endfunction


function InitTrig_Dot takes nothing returns nothing
    set gg_trg_Dot = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Dot, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Dot, Condition( function Trig_Dot_Conditions ) )
    call TriggerAddAction( gg_trg_Dot, function Trig_Dot_Actions )
endfunction

Shuriken

JASS:
function Trig_Shurikken_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Trig_Shurikken_Actions takes nothing returns nothing
    local boolean exit = false
    local unit u = GetTriggerUnit()
    local unit ut = GetSpellTargetUnit()
    local unit us = null
    local unit pu = null
    local unit lu = null
    local integer mu = 3 + (GetUnitAbilityLevel(u, 'A000')) * 2
    local integer cu = 0
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real nx = GetUnitX(ut)
    local real ny = GetUnitY(ut)
    local real xs
    local real ys
    local real dx = 0
    local real dy = 0
    local real d = 600
    local real dmg = 10 + (GetUnitAbilityLevel(u, 'A000')) * 50
    local player p = GetOwningPlayer(u)
    local group gr = CreateGroup()

    set us = CreateUnit (p, 'h007', x , y, 0)
    loop
        exitwhen ( cu >= mu )
        set exit = false
        if (cu > 0) then
            call GroupEnumUnitsInRange(gr, xs, ys, 450.00, null)
            loop
                set pu = GroupPickRandomUnit(gr)
                exitwhen (pu==null) or (exit==true)
                if ((IsUnitEnemy(pu, GetTriggerPlayer())) and (pu!=ut) and (pu!=lu) and (GetUnitState(pu, ConvertUnitState(0)) > 0)) then
                    set lu = ut
                    set ut = pu
                    set d = 450
                    set exit = true
                endif
                call GroupRemoveUnit(gr, pu)
            endloop
        endif
        if (ut == null) then
            call SetUnitExploded(us, true)
            call KillUnit(us)
        endif
        call IssueTargetOrder( us, "attack", ut )
        loop
            exitwhen ( d < 80.00 )
            set xs = GetUnitX(us)
            set ys = GetUnitY(us)
            set nx = GetUnitX(ut)
            set ny = GetUnitY(ut)
            set dx = nx - xs
            set dy = ny - ys
            set d = SquareRoot(dx * dx + dy * dy)
            call TriggerSleepAction(0.05)
            call IssueTargetOrder( us, "attack", ut )
        endloop
        call UnitDamageTarget(u, ut, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
        set cu = cu + 1
    endloop
    call UnitApplyTimedLife( us, 'BUan', 0.1 )
    call DestroyGroup(gr)
    set ut = null
    set us = null
    set u = null
    set lu = null
    set p = null
    set gr = null
endfunction


function InitTrig_Shurikken takes nothing returns nothing
    set gg_trg_Shurikken = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Shurikken, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Shurikken, Condition( function Trig_Shurikken_Conditions ) )
    call TriggerAddAction( gg_trg_Shurikken, function Trig_Shurikken_Actions )
endfunction
 
Last edited:
Level 10
Joined
Sep 19, 2011
Messages
527
Cure
local real heal = ((I2R(GetUnitAbilityLevel(u, 'A000')) + 4.00) / 5.00) * (GetHeroInt(u, true) + GetUnitState(u, ConvertUnitState(3)) / 10.00)

You don't need to convert integers to real.

local real chp = GetUnitState(ut, ConvertUnitState(0))

->

local real chp = GetWidgetLife(ut)

JASS:
    local string s = null
    local effect f = null
    set s = "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl"
    set f = AddSpecialEffectTarget(s, ut, "origin")

->

JASS:
    local string s = "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl"
    local effect f = AddSpecialEffectTarget(s, ut, "origin")

call TriggerSleepAction(1)

Don't use Waits, use timers instead.

This spell is not MUI.

Regen
local real chp = GetUnitState(ut, ConvertUnitState(0))
What?, don't use ConvertUnitState, makes dificult read the code.

In the loop, you don't need create a boolean variable to exit.
You can use exitwhen true and the loop will over.

This spell is not MUI.

AoE Amplify
local player p = GetOwningPlayer(u)

->

local player p = GetTriggerPlayer()

local group gr = CreateGroup()

If you will use a group only for enumerate units, then you can use this instead:

local group gr = bj_lastCreatedGroup

But remember, don't destroy this group, only clean it when you finished.

This spell is not MUI.

AoE Stun
You forget to null "u" variable.
The same corrections that I give you in the AoE Amplify spell.

Elemental Scape
Same corrections.

This spell is not MUI.

Armageddon
Same and is not MUI.

Meteor
Same and is not MUI.

Simple Firebolt
Mmm, you're using wrong the timers. You also need Hashtables.
This spell is not MUI.

Flame steps
Same corrections but this one is MUI.

Arrow Rain
Same and is not MUI.

I'm tired, too many spells xD

You have creativity ;).

Greetings.
 
Could you please post the Jass code? Nevermind, just noticed.

edit
Here are a few tips:
- NEVER use ConvertXXX functions because using their global counterparts is way more efficient.
common.j creates these globals for you so you don't have to spam ConvertXXX functions and slow
your map down.
- Always use GetWidgetLife when trying to get the health of a unit/doodad/destructible/item.
- NEVER create a local group. Global groups should be used for enumeration (way faster). If you're
only going to do a simple group enumeration, I'd recommend using bj_lastCreatedGroup so you don't
have to waste more space and declare your own global group.
- Don't make your special effect strings locals, that would be stupid. It would be much better to
create a global string instead so the user can easily configure it. If you want to stick to Jass, you
can use a function like this:
JASS:
function GetEffect takes nothing returns string
    return ""
endfunction
- You don't need waits to destroy special effects. If you create an effect and destroy it instantly,
it will display the animation and destroy itself when it's done.
- Combine the Actions and the Conditions (learn to use Conditions only). You can check if the
correct spell was casted with an if/then/endif block. This is faster because conditions run about
3x faster than actions
- NEVER EVER EVER use this: ==true. Because without it, EVERYTHING would run exactly
as it should anyways.
- Your nova spell is all wrong. You shouldn't order the units to move, you should set their X,Y coordinates
with a timer. Ordering them to move will cause them to do some really wierd shit. Unit orders in Warcraft
III are very bugged and slow as hell. If you create a large map with lots of systems and units on the map,
casting the spell would create the dummy units and you'd see them stopping and going at really awkward
intervals.
-
JASS:
        set x1 = ux + d1 * Cos(g * a)
        set y1 = uy + d1 * Sin(g * a)
        set x2 = ux + d2 * Cos(g * a)
        set y2 = uy + d2 * Sin(g * a)
You should cache the Cos(g * a)/Sin(g * a) reals into local variables inside the loop to increase efficiency
because running functions twice is really pointless and puts a damper on the map.
- I see you're repeatedly calling functions everywhere instead of caching them into locals.
For example:
JASS:
    local boolean exit = false
    local unit u = GetTriggerUnit()
    local unit ut = GetSpellTargetUnit()
    local unit us = null
    local unit pu = null
    local unit lu = null
    local integer mu = 3 + (GetUnitAbilityLevel(u, 'A000')) * 2
    local integer cu = 0
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real nx = GetUnitX(ut)
    local real ny = GetUnitY(ut)
    local real xs
    local real ys
    local real dx = 0
    local real dy = 0
    local real d = 600
    local real dmg = 10 + (GetUnitAbilityLevel(u, 'A000')) * 50
    local player p = GetOwningPlayer(u)
    local group gr = CreateGroup()
You're repeating the GetUnitAbilityLevel function twice. Why don't you cache it into a local variable instead?
Also, you should make the damage configurable. You should create a function that returns a damage formula
instead of inlining it directly into the code. At the moment, all your spells are very hard to configure.
And on a side-note, you shouldn't create local groups. Using global groups is way better. I see you're using
GroupPickRandomUnit for enumerating. DONT. Because that adds an entire group enumeration
for every unit in the group making these spells extremely inefficient. Use FirstOfGroup instead.
- There are places in the code where you're repeating functions that are always going to return the same
value for one execution inside loops. That's very inefficient. Look here:
JASS:
            loop
                set pu = GroupPickRandomUnit(gr)
                exitwhen (pu==null) or (exit==true)
                if ((IsUnitEnemy(pu, GetTriggerPlayer())) and (pu!=ut) and (pu!=lu) and (GetUnitState(pu, ConvertUnitState(0)) > 0)) then
                    set lu = ut
                    set ut = pu
                    set d = 450
                    set exit = true
                endif
                call GroupRemoveUnit(gr, pu)
            endloop
You put GetTriggerPlayer() inside a loop. You should cache it into a local variable instead. This will way faster.
And instead of using a boolean to exit the loop, just use exitwhen true anytime you want to get
out of the function.

There are a lot more things that I want to list, but I've already typed too much, but here are a few brief tips anyways:
- Try to use SquareRoot functions less because if you're going to use one for comparisons, you'd get the same
results without including the SquareRoot, but you'd have to multiply the other real number by itself.
- STOP USING Convert functions.
- NEVER USE ORDERS for spells with a mass of dummy units BECAUSE IT WOULD BE VERY slow and LAGGY.

edit
Otherwise, good job on those effects.
 
Last edited:
Level 7
Joined
Sep 2, 2011
Messages
349
Hello there. Please, improve the tooltip. It's hardly to cast spells with same icons. Some of them still has tooltip missing. Icons missing. Colliding hotkeys and other minor stuff. I am having trouble with the Shuriken. As you cast them again and again, some Shuriken just stand there. I guess its not MUI.

Rating: 3/5
I like the spells yet they are poorly coded
Some of them are not that original
Tooltips needs to be fixed
The knockback on the nova, doesn't look good at all
Arrow Rain has unrealistic damage detection
Other than that, the spells are cool and has nice effects.
Fix these, please.


Happy Holidays
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
1. In that point for me was original coz i created without watched how was made by others :p
2. what tooltip wrong?
3. yea kinda lame but easy and need the less cpu usage, i think later i will do a knockback system for that but primary point with spellpacks was the custom damage and the less cpu usage.
4. it is similiar than in pw, simple delayed aoe damage when arrow landing, damage detection is easy (call UnitDamageTarget(ut, u, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))) so u can modify the damage as u want and also can store before every damage the damagetype in variable if u use gui dds
5. i dont got when shuriken stand, i tryed many times but for me allways exploded
http://shadowvzs87.uw.hu/pack1.w3x
http://shadowvzs87.uw.hu/pack2.w3x
few icon changed and arrow model changed back to normal

icons posted to 2nd post since u need credit for it if u want use

call TriggerSleepAction(1)

Don't use Waits, use timers instead.

This spell is not MUI.
Why not mui if i dont use global variable?

You don't need to convert integers to real.
fixed

Regen
local real chp = GetUnitState(ut, ConvertUnitState(0))
What?, don't use ConvertUnitState, makes dificult read the code.

In the loop, you don't need create a boolean variable to exit.
You can use exitwhen true and the loop will over.

This spell is not MUI.

AoE Amplify
local player p = GetOwningPlayer(u)

->

local player p = GetTriggerPlayer()

local group gr = CreateGroup()

If you will use a group only for enumerate units, then you can use this instead:

local group gr = bj_lastCreatedGroup

But remember, don't destroy this group, only clean it when you finished.

This spell is not MUI.

AoE Stun
You forget to null "u" variable.
The same corrections that I give you in the AoE Amplify spell.

Elemental Scape
Same corrections.

This spell is not MUI.

Armageddon
Same and is not MUI.

Meteor
Same and is not MUI.

Simple Firebolt
Mmm, you're using wrong the timers. You also need Hashtables.
This spell is not MUI.

Flame steps
Same corrections but this one is MUI.

Arrow Rain
Same and is not MUI.

I'm tired, too many spells xD

You have creativity ;).

1. i used convert unit stat coz need less call
2. i dont got how work that exit when true
3. why not mui a spell if isnt global variable inside?
4. local p and gr thing changed
5. u was nulled...u can see it just with 2 above of nulling ud

i dont got why isnt mui if all was made with locals

1.Always use GetWidgetLife when trying to get the health of a unit/doodad/destructible/item.
2.I'd recommend using bj_lastCreatedGroup so you don't
have to waste more space and declare your own global group.
3. Don't make your special effect strings locals
4.You put GetTriggerPlayer() inside a loop. You should cache it into a local variable instead. This will way faster.
And instead of using a boolean to exit the loop, just use exitwhen true anytime you want to get
out of the function.
1.what about the mana?
if i want change the unit hp by trigger i also must use getwidgetlife?
2.done
3.if no other downside than i dont think its a big problem since difference in path in gui have only 1x\ till in jass its replaced to 2x\\
4. i thought it useless to cacheing everything but i understand the point
 
Level 10
Joined
Sep 19, 2011
Messages
527
1. i used convert unit stat coz need less call
?

2. i dont got how work that exit when true
exitwhen true: exitwhen is a condition. If the condition returns true, then the loop will be over. Is the same that you're doing here, but without necessity of create another variable ;).

i dont got why isnt mui if all was made with locals

Because you're using Waits.
Most on your spells, the only will be bugged are the effects.

Another thing. Maybe you can try with vJASS. The only purpose because it was created, it was to make easy the job to the programmers.
Besides you can use libraries :D (more easy xD).

EDIT:
1.what about the mana?
There yes, you can use Set/GetUnitState(unit, state)

if i want change the unit hp by trigger i also must use getwidgetlife?
If you want to change it, you must use SetWidgetLife()

3.if no other downside than i dont think its a big problem since difference in path in gui have only 1x\ till in jass its replaced to 2x\\
But you can replace that local with a global (more efficient) and the users can configure it without any trouble :).

4. i thought it useless to cacheing everything but i understand the point
Makes more easy the job and you decreases the functions calls.
 
what about the mana?

I said health. For mana, GetUnitState is required.

if no other downside than i dont think its a big problem since difference in path in gui have only 1x\ till in jass its replaced to 2x\\

What? I was saying that you should put the effect string in a function. That's how you can make it easily configurable.

i thought it useless to cacheing everything but i understand the point

It's not useless to cache everything.
For primitive types (string, code, integer, real, boolean):
- Cache them if you're using them more than once.
For handles (units, players, items, groups, widgets, etc..):
- Cache them if you're using them more than twice.

These are the most important rules in Jass 8)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
It's not useless to cache everything.
For primitive types (string, code, integer, real, boolean):
- Cache them if you're using them more than once.
For handles (units, players, items, groups, widgets, etc..):
- Cache them if you're using them more than twice.

These are the most important rules in Jass 8)

nice to know, ty

Because you're using Waits.
Most on your spells, the only will be bugged are the effects.

but local dont changeing if once local is local, no?
so i dont got why problem the wait
And you should really work on making these spells MUI.
Non-MUI spells don't get approved here.

u can explain this?

another thing
for timer function i allways must use different function and cant merge with main function like group enume with 1st unit in group loop?

about hp
SetUnitState(u, UNIT_STATE_LIFE, GetWidgetLife(u)/2)
here also have convert stat, could ignore that somehow?
 
Last edited:
These spells are MUI, but you should remove the waits and use timers because you also have to:
Magtheridon96 said:
- Combine the Actions and the Conditions (learn to use Conditions only). You can check if the
correct spell was casted with an if/then/endif block. This is faster because conditions run about
3x faster than actions
And TriggerSleepAction halts a thread if it's a condition for a trigger.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
These spells are MUI, but you should remove the waits and use timers because you also have to:

And TriggerSleepAction halts a thread if it's a condition for a trigger.

hum.. i thought timer also count in background and in this thread the answer what i got was triggersleep and timer is pretty similiar in cpu usage, just timer more accurated and dont have effect the ping this is why i dont got.

impossible merge the 2 function if i use timer(starter&expired function), right?

http://www.hiveworkshop.com/forums/world-editor-help-zone-98/timer-vs-loop-about-speed-view-209343/
 
Timers are better to use for its accuracy compared to TSA...

Dr Super Good said:
Timer has a much larger resolution than TriggerSleepAction. TriggerSleepAction is limited to 0.1 seconds + delay based on ping (so is slower in multiplayer than singleplayer). Timers can go smaller than 0.001 seconds with realitive accuracy (although they do exhibit inaccuracy at that time such as running 1001 times every second).
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Timers are better to use for its accuracy compared to TSA...

lets say have 2 case:
1. 1x30 sec TSA
2. 30x1 sec TSA


1. so at 30 sec, max +1-2 second if we add the delay from ping (cant be longer delay from ping,no?)
So at this case isnt noticeable, right?

2. so at periodic thing where checked the unit hp every sec the difference is more noticeable, so bigger different at 30x1sec than 1x30second, correct me if i ignored something or my info is wong.

so conclusion for 1-st the TSA enough but at 2nd the TSA could make serious spell duration difference?
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
That's why you don't spam TSA... in the end timers are still better...

and I don't know what you wanted to achieve by comparing two TSA events, when my reply was about TSA and Timer... not to say that whether you use 1 or 2 is based on what you wanted to do...

i dont want achieve anything just i ask coz if it is how i thought than for 1st example in my view point the TSA far better coz difference not noticeable coz TSA was used only 1x and far less code than a timer (1 single line instead 10+ and +1 function worth 1-2 sec delay in worst case)

and if at 2nd case the useing TSA multiple times cause more annoying delay in spell duration then worth to try a periodic timer thing (the delay caused the ping stacking if i use triggersleep multiple times, i think, i am aint sure in this)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Like I said, you're going to have to use Conditions instead of actions everywhere, so even if you wanted to, you CANT use TriggerSleepAction. TriggerSleepAction crashes condition threads. That's why my RegisterPlayerUnitEvent isn't compatible with them.

1.
i am really glad coz u try help and sorry coz my english sucks also i understand the things hardly.

u can give example to any of my spell where i used tiggersleep how can i use timer correct way?

2.
Question about periodic timers
its work something like this? or how the best way when i must use periodic timer or how can
can i turn off lets say x second? (i must use global variable and count everytime when checkunitstat function run?)
JASS:
function trigger_action
local timer t = create timer or what
local unit u = caster
local unit ut = tagetunit
call TimerStart(t, 1, true, function check_unit_stat)

call DestroyTimer(t)
set t = null
endfunction

Function check_unit_stat takes nothing return boolean
local boolean b = false
if (unit hp > 0 ) and (unit mp > 5) then
  do action like damage ut and decrease u mp
set b = true
endif
return b
endfunction
 
For the timers, you should use a global variable to track the number of spell instances running.
When a spell is cast, increase it by 1.
If it's equal to one, start the timer (We're only going to use 1 timer per spell).
Add the casting unit to a unit group.
In the loop, we're going to pick all the units in this group and do the actions for each of them. If we need data for the spell, we have to save it in a hashtable using GetHandleId(GetTriggerUnit()) as one of the indicies in the hashtable.
Inside the function that does the actions for each caster, we're going to load this data from the hashtable using the caster's handle Id.
When you want to end the spell effect, decrease the amount of instances by 1.
Check if it's 0, and if it is, pause the spell timer.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
For the timers, you should use a global variable to track the number of spell instances running.
When a spell is cast, increase it by 1.
If it's equal to one, start the timer (We're only going to use 1 timer per spell).
Add the casting unit to a unit group.
In the loop, we're going to pick all the units in this group and do the actions for each of them. If we need data for the spell, we have to save it in a hashtable using GetHandleId(GetTriggerUnit()) as one of the indicies in the hashtable.
Inside the function that does the actions for each caster, we're going to load this data from the hashtable using the caster's handle Id.
When you want to end the spell effect, decrease the amount of instances by 1.
Check if it's 0, and if it is, pause the spell timer.

ups this is far more complex than i thought or TSA is, and i wondering with that much action how can be faster.. ok jass or wc3 is mysterious..

i tryed what u said but really i dont know how can i do :D
1st i started in gui but that still dont change on fact i got no ideea how to do it :D

  • map init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set SpellTable = (Last created hashtable)
  • Holy light
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Holy Light
    • Actions
      • Unit Group - Add (Triggering unit) to CasterGroup
      • Set SpellCast = (SpellCast + 1.00)
      • Hashtable - Save 1 as 0 of 0 in SpellTable
      • -------- i know, from 2 key the 1st is the GetHandleId(GetTriggerUnit()) but 2nd idk also idk what we store in harshtable --------
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in CasterGroup and do (Actions)
            • Loop - Actions
              • -------- why need this group loop? --------
      • -------- also idk where i must decrease the real variable coz i cant use triggersleep so its decreased instantly if i write after loop --------
  • Start Timer
    • Events
      • Game - SpellCast becomes Equal to 1.00
    • Conditions
    • Actions
      • -------- start timer? --------
  • End timer
    • Events
      • Game - SpellCast becomes Equal to 0.00
    • Conditions
    • Actions
      • -------- pause and destory? --------
  • Periodic trigger
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • -------- maybe here i must decrease the integer value in harshtable where the 1 key is trigger unit handle and another is idk what? --------
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Bump, What u think about this Five Sword Remade in jass?
JASS:
function Trig_Magical_Sword_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Magical_Sword_Timer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer id = GetHandleId(t)
    local integer i
    local unit u = LoadUnitHandle(udg_Spell_Table, id, 1)
    local unit ut = LoadUnitHandle(udg_Spell_Table, id, 2)
    local unit dummy
    local real x1
    local real y1
    local real x2
    local real y2
    local real z
    local real hp
    local real spd
    local lightning l
    local integer c = LoadInteger(udg_Spell_Table, id, 6)
    call SaveInteger(udg_Spell_Table, id, 6, c + 1)

    if c < 18 and not IsUnitType(u, UNIT_TYPE_DEAD) and not IsUnitType(ut, UNIT_TYPE_DEAD) then
        if c == 0 then
            set z = LoadReal(udg_Spell_Table, id, 4)
            set i = 0
            loop
                exitwhen i > 4
                set dummy = LoadUnitHandle(udg_Spell_Table, id, i + 10)
                set x1 = GetUnitX(dummy)
                set y1 = GetUnitY(dummy)
                if i == 4 then
                    set dummy = LoadUnitHandle(udg_Spell_Table, id, 10)

                else
                    set dummy = LoadUnitHandle(udg_Spell_Table, id, i + 11)
                endif
                set x2 = GetUnitX(dummy)
                set y2 = GetUnitY(dummy)
                set l = AddLightningEx("DRAL", true, x1, y1, z, GetUnitX(ut), GetUnitY(ut), z)
                call SaveLightningHandle(udg_Spell_Table, id, 20 + i, l)
                call SetLightningColor(l, 1, 0, 0, 1)
                set l = AddLightningEx("LEAS", true, x1, y1, z, x2, y2, z)
                call SaveLightningHandle(udg_Spell_Table, id, 30 + i, l)
                call SetLightningColor(l, 0, 0, 1, 1)
                set i = i + 1
            endloop
            set l = null
            set dummy = null
            set i = 0
        elseif c > 0 and c < 16 then
            set hp = LoadReal(udg_Spell_Table, id, 7)
            call SetWidgetLife(u, GetWidgetLife(u) + hp)
            call SetWidgetLife(ut, GetWidgetLife(ut) - hp)

        elseif c == 16 then
            set i = 0
            set spd = LoadReal(udg_Spell_Table, id, 8)
            loop
                exitwhen i > 4
                call SetUnitFlyHeight( LoadUnitHandle(udg_Spell_Table, id, i + 10), 1500, spd * 4 )
                call DestroyLightning(LoadLightningHandle(udg_Spell_Table, id, 20 + i))
                call DestroyLightning(LoadLightningHandle(udg_Spell_Table, id, 30 + i))
                set i = i + 1
            endloop
                call UnitAddAbility( ut, 'Amrf' )
                call UnitRemoveAbility( ut, 'Amrf' )
                call SetUnitFlyHeight( ut, 0, spd )

            elseif c == 17 then
                call PauseUnit( ut, false )
                call SetUnitInvulnerable( ut, false )
                call DestroyEffect(LoadEffectHandle(udg_Spell_Table, id, 5))


        endif
        call TimerStart(t, 1, false, function Magical_Sword_Timer)
    else
        set i = 0
        loop
            exitwhen i > 4
            call UnitApplyTimedLife( LoadUnitHandle(udg_Spell_Table, id, i + 10), 'BUan', 1 )
            set i = i + 1
        endloop
        call PauseTimer(t)
        call DestroyTimer(t)
        call FlushChildHashtable(udg_Spell_Table, id)
    endif
    set t = null
    set u = null
    set ut = null
endfunction

function Trig_Magical_Sword_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local integer id = GetHandleId(t)
    local unit u = GetTriggerUnit()
    local unit ut = GetSpellTargetUnit()
    local unit dummy
    local real x = GetUnitX(ut)
    local real y = GetUnitY(ut)
    local real nx
    local real ny
    local real spd = 100
    local real hpdrain = GetWidgetLife(ut) / 50
    local player p = GetTriggerPlayer()
    local location loc = GetUnitLoc(ut)
    local real z = GetLocationZ(loc)
    local real z2 
    local real h1 = 330 
    local real h2 = 320 
    local integer i = 0
    local integer c = 0


    call SaveUnitHandle(udg_Spell_Table, id, 1, u)
    call SaveUnitHandle(udg_Spell_Table, id, 2, ut)
    call SaveReal(udg_Spell_Table, id, 3, h1)
    call SaveReal(udg_Spell_Table, id, 4, h2+z)
    call SaveEffectHandle(udg_Spell_Table, id, 5, AddSpecialEffectTarget("Abilities\\Spells\\Human\\DivineShield\\DivineShieldTarget.mdl", ut, "origin"))
    call SaveInteger(udg_Spell_Table, id, 6, c)
    call SaveReal(udg_Spell_Table, id, 7, hpdrain)
    call SaveReal(udg_Spell_Table, id, 8, spd)
 
    call SetUnitInvulnerable( ut, true )
    call PauseUnit( ut, true )
    loop
        exitwhen i > 4
        set nx = x + 300 * Cos(bj_DEGTORAD * i * 72)
        set ny = y + 300 * Sin(bj_DEGTORAD * i * 72)
        set dummy = CreateUnit (p, 'h003', nx , ny, 0)
        call UnitAddAbility(dummy, 'Amrf' )
        call UnitRemoveAbility(dummy, 'Amrf' )
        call MoveLocation(loc,nx,ny)
        set z2 = GetLocationZ(loc)
        call SetUnitFlyHeight( dummy, h1+z-z2, spd * 4 )
        call SaveUnitHandle(udg_Spell_Table, id, i + 10, dummy)
        set i = i + 1
    endloop

    call RemoveLocation(loc)

    call UnitAddAbility(ut, 'Amrf' )
    call UnitRemoveAbility(ut, 'Amrf' )
    call SetUnitFlyHeight( ut, h2, spd )

    call TimerStart(t, 3.5, false, function Magical_Sword_Timer)

    set u = null
    set ut = null
    set dummy = null
    set p = null

endfunction

//===========================================================================
function InitTrig_Magical_sword takes nothing returns nothing
    set gg_trg_Magical_sword = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Magical_sword, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Magical_sword, Condition( function Trig_Magical_Sword_Conditions ) )
    call TriggerAddAction( gg_trg_Magical_sword, function Trig_Magical_Sword_Actions )
endfunction
 

Attachments

  • a_new_spellPack2.w3x
    43 KB · Views: 30
Top