1. Are you planning to upload your awesome map to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  5. Dismiss Notice
  6. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Trigger Viewer

Elementscrafts Custom Hero 1.3.w3x
Variables
Variables
choose mode
race
race heroic
race Option Short Mode
gladiator
gladiator Option Map 1
gladiator Option Map 2
gladiator Option Map 3
gladiator Option Alternate Spawn
gladiator Option Standard Spawn
gladiator Option No Tp
gladiator Init Randomize Map
gladiator Init Randomize Spawn
gladiator Alternate Spawn
gladiator Map 4
gladiator map 4 first init
gladiator map 3 first init
gladiator Map 3 BC
gladiator Map 2 EI
gladiator Map 1 WI ReRoll
gladiatorAdOptions
gladiatorAdOptionsEnd
training
gladiator Hc
gladiator Mythic
micro wars
arenas 3 rounds
Moba
Moba Entrenchment
disable others
GUI Knockback System [Paladon]
---------------------------
Readme
Actions to apply
---------------------------
GUI Knockback Sytem
---------------------------
Cast A Knockback
Get Knockback
---------------------------
Sample Readme
---------------------------
Sample Meele Knockback Spell
Sample Explosion Spell
Sample Warstomp Spell
GUI SpellEvent
ClassAbilities
GUI SpellEvent
Init Trigger
onExcomb give item
onExcomb 8
onExcomb 7
onExcomb 6
onExcomb 5
onExcomb 4
onExcomb 3
onExcomb 2
onExcomb 1
onExcomb 0
onExcomb combine last
level up and upgrade item
AddLumberOnlevelUp
Upgrade Boots
Upgrade Bow
Upgrade Pendant
Upgrade Spellstrike
Upgrade WD
Upgrade Jade
Upgrade Brutalizer
public functions
command zoom
command rename hero
ms command
command skipmicro
skipescort1
test trees
pressESCmovetoprofessions
placeTreesOrDestructibles
randomMusic
Create GameMode Hint Info
choosehero
pick hint
pick hero event
create chooser
create heroes to select
gamestart
CTickMasterSystem
CTIckMasterSystTrig
CTIckTomeOfPower
CTIckBlink
OneSecPermaUnitSyst
Oozemancy unit die
OneSecBlAttack
OneSecIllusionsDies
OneSecPermaUnitSystPeriodic
Specialization and Professions
SpecsTrainNewTrait
SpecsChooseTrait
SpecsstartChoosingTrait
functGiveItemiffreeInventory
GetItem External Combiner
SpecsInit
SpecsPrepare
SpecsStartChoosingInnate Skill
SpecsInnateBigShotSkin
SpecsChooseInnateSkill
SpecsInitClasssesforAll
StartInitRandomizeShopItems
SpecsChooseClass
SpecsStartLearnExternalAbilitycrafter
SpecsStartChoosingAttr Bonus
SpecsStartChoosingProf
SpecsUpgradeLevelScaling
SpecsUpgrade00No Profession
SpecsUpgrade01ScalingAttr Bonus
SpecsUpgrade01AtrBonus
SpecsUpgrade02Engineering
SpecsUpgrade03Necromancy
SpecsUpgrade03NecromancyB
SpecsUpgrade04Apothecary
SpecsUpgrade05Alchemy
SpecsUpgrade06Blacksmithing
SpecsUpgrade06BlacksmithingB
SpecsUpgrade06BlacksmithingC
SpecsUpgrade06BlacksmithingD
SpecsUpgrade07IceCreamMan
SpecsUpgrade07IceCreamManB
SpecsUpgrade07SellIceCrem
SpecsUpgrade07IceCreamManPeriodic
SpecsUpgrade08SpaceMarine
SpecsUpgrade08SpaceMarineB
SpecsUpgrade09ArcanistRune
SpecsUpgrade09Arcanist
SpecsUpgrade10Admiral
race
race Moba unit owner change
race warden defence
race warden defence L
race warden Rj
race warden RjB
race warden RjB Copy
race warden RjBL
race warden RjBL Copy
race warden RjL
race warden death
race warden death L
race heroic demon wave 3
race heroic demon wave 3 L
race heroic wards
race heroic win condition
race heroic win condition L
race spawn 1
race spawn 2
race spawn 2 AI
race necro AI
race rocks death
race rocks make one weak
race rocks color
race treant team 0
race treant team 1
race leaver
race water back team 0
race water back team 1
race water effect on
race water effect off
race bonus
race boss 1 team 1
race boss 1 team 0
raceheroic t 1 R tele
raceheroic t 0 L tele
race hero revive
race victory
race team0 win func
race team1 win func
race wood income
race start
race roll unit spawntypes
race init heroic
race area randomize environment
race run after start short mode
race heroic elder of treants AI
race supply movement
race DXP expired
raceAIBots
raceAI water back team 1
raceAI water back team 0
raceAIBotsPeriodic Order 3s
mobaAIBotsPeriodic Order 3s
raceAIBotsInitFunct
raceAIBotsPeriodicPause
raceAIBotsPeriodicBuy
raceAIBotsPeriodicGoldBuy
botsAI use spells orders
botsAI use spells periodic on
Training
training respawn periodic
training respawn func
race-teambattle
race to teambattle
race start TB
TeamB hero dies
TB to Moba
common
ability forget spell
hide forget spell dialog
Summoned Bug workaround
GetItem
SideQuests
CreateSideQInMobaMap
InGameModeItems
CreateQ1
Q1End
CreateQ1b
Q1bEnd
CreateQ2
Q2Lever
CreateQ3
Q3End
CreateQ3b
Q3bEnd
CreateQ3c
Q3cEnd
CreateQ3d
Q3dEnd
CreateQ4
initialization
Neutral Passive limit Fix
set color codes visibility
Init Spell Recipes
Quest Help
set anythingelse
caption
setSpells
setItems
set glad units
set glad units Alternate
set glad boss
set micro init
SetSpellPower
YBrflr
gladiator
glad free bounty
glad revive hero and trees
glad refresh hp
glad create start items
glad drop 1 item boss kill
glad drop item wave
glad leaver
glad soft Revive
glad lvl 2 shop enable
glad start
glad Weather Roll
glad Weather End
glad Digging Enter X
glad isl2 Tp Enter
glad isl2 Tp Expired
glad spawnunits
glad refreshtimerexp
glad spawnboss
glad next Level
glad hero die
glad surival hero die
glad survival
glad boss 1 AI
glad boss 2 AI
glad boss 2 AI Mass Purge
glad boss 2 AI Mass Purge Timer
glad boss 4 AI
glad boss 5 AI
glad boss 5 AI Alternate
glad boss 5 AI Alt Mass Sleep
glad boss 6 AI
glad boss 7 AI
glad boss 7 spawns
glad boss 8 Spawn
glad boss 10 periodic
glad boss 10 summon 1
glad boss 10 summon 2
glad boss 10 summon 3
glad boss 10 summon 4
glad boss 10 epic summon
glad boss 10 summon death
glad boss 10 summon death 2
gladiator digging sub
glad Digging Leave X
glad Digging Periodic X
gladiator map 3 feats
map 3f place item
map 3f pickup1
map 3f pickup2
map 3f pickup3
micro wars
micro simulate remove unit ability
miceo unit gets bought
micro prepare price
micro fight in hint
micro revive hero
micro unit dies
micro unit changes ownership
micro twoplayerfight
micro nextfight
micro add level to heroes
micro nextround
micro start
micro game end
micro player leaves
micro board create
Spell Ability Evolutions
Shockwavelvl5
BreathOfFrostlvl5
HealDuallvl5
WatElemlvl5Explo
Bloodlustlvl5
SerpentWardlvl5
RainofFlvl4 6
FlameStrike lvl5
Spell Triggers Innate
Summon magical c
Elemental Blast
Hunter Shot
Mystic Bolt
Hidden Powers
Ambush
Ambush B
Slam
Smash
Combo Strike
Execute
Mage Blast
Spell Triggers
Crushing Wave mastery
Healing Wave mastery
Healing Ward mastery
Barrel of Rum
Ship Artillery
RaiseDead
AnimateDead
Plasma Shocks
Invisibility
Mana Beam
Mana Beam 02 periodic
Greater Affliction
Item Discombobulation Suit
Item Refresher Orb
Item Mysterious Tincture
Item GGrowl Master X7
Item Warp Portal Shard Gladiator
Item Tablet of everlasting hunger gladiator
Item Pickbait
Item Pickbait Pick
Item Orbital Bombardment
Courier Scrap
Sop Call Comet
Sop Teleport
Seal of Power
Necro Coin
Super Elemental
Pressure Punch
Pressure Punch item
Exorcism
ExorcismTimer
Netherbalm First Activation
Netherbalm Damage Amplify
Nature Call
Iceflash Golem
Freeze Damage Reduction
Shield Barrier
Shield Barrier Reduction
Sealing Flames Main
Sealing Flames Timer
On Nether Pulse Mine Die
Meta Blast
Cleansing Beam
Decompose
Decompose 2 sec Loop
Frostbolt
AAFrostArmor
ABFaerie Burn
AAInferno
AAWar Stomp
AARejuv
ABInnervate
ABHoly Shield
ABPhoenix Strike
ABMolten Bombs
ABTornado
ABCrystal Field
ABMolten Bombs cd Reset
ACFlamestrike Reset
ABSea Throw Reset
ABFeral Spirit
ABForce of Nat
ABAnim Treants
AARoar
ACBreathOfFire
ACIncinerateSearingArr
ACFlamestrike
ADDoubleSpiders
ADBlizzard
ADIllusionDrain
ADLightning Shield
ADPurge
AAFirebolt
AAForked
AAChainL
CycloneCd
Leech Mana
Mind Control
DisruptorCloudOnCast
EarthquakeOnCast
Earthquake 1 sec Loop
ADDoubleLavaSpawn
LifebloomOnCast
Lifebloom 1 sec Loop
Transformation activator
Transformation on goblin die effect
Explosive Barrel Die Effect
Fan of Knives 3
Shadow Dash
Magic TriMissiles
Tentacle Spell
Summon Panda
Summon Panda 2
Summon Panda 3
Nosferatu
Draw Soul
Blue Flames
Frostbomb
Detonate
Flame Burst
Craft Item
Divine Intervention
Mass Lightning Shield
Mass Entangle
ElectrocutePick
ElectrocutePeriodic
Electrocute1
Electrocute2
Electrocute3
Monsoon
Mark of Starfall
Sea Throw
The Construct Limit
The construct die crystal drop
Arcane Shield First Use
Arcane Shield
OneSec Blue Shield
Gdd Tester
Boulderskin First Use
Boulderskin
Elemental Retribution First Use
Elemental Retribution
Slimebolt First Use mastery
Slimebolt Die
Rpg and Battleground
Rpg preInit
Arenas to Battlegrounds
Battleground do Mobacleaning
RpgInitZones
Rpg Zone Lands of Conquest
Rpg Zones Unit Dies
Rpg On Kill
Moba
Moba Init Entr
Moba Remove no Ent stuff
Moba main boss
Moba main boss Kill
Moba main boss Re
Moba shuffle dealers function
Moba top hill clear on kill
Moba bot hill clear on kill
Moba start
Moba Mysterious Gold Pack
Moba experience reducer
Moba Creep Spawn
Moba minion Idle Check
Moba Jungle Spawn
Moba MiniB Kill
Moba On Kill
Moba Hero Revive
Moba victory tm0
Moba victory tm1
Moba lumber income
Moba gold income
Moba minion movement UGMid0
Moba minion movement UGMid1
Moba minion movement UGTopC
Moba minion movement UGTop1
Moba minion movement UG BotC
Moba minion movement UG Bot0
moba leaver
moba survival
moba surival hero die
Moba Hero Revive Timer
Moba Hero Revive Timer10
Moba Hero Revive Timer1
Moba Hero Revive Timer2
Moba Hero Revive Timer3
Moba Hero Revive Timer4
Moba Hero Revive Timer5
Moba Hero Revive Timer6
Moba Hero Revive Timer7
Moba Hero Revive Timer8
Moba Hero Revive Timer9
Advanced Items
WandSwap
ItemAct
Spellstrike Sword
Wand of Crippling
Wand of Slowing
Wand of Faerie Burn
SpellstrikeGlovesUse
SpellstrikeGlovesUseII
PhantasmageStaff
ShadowServitorsStaff
GoblinMinerKit
Clock Warp
KeyoftheGreaterKnowledge
Bloodlust Shield
Blessed Bracers
TerramancerMedallion
Goblin Pocket Factory
itemBrilliant Moonstone
SmokingPipe
Epidemic
Leech Pendant
WitchDoctorGuiseUse
Faerie Staff
Sacred Reactive Armor
Icemaster Staff
Firemaster Staff
Windmaster Staff
Archdruid Staff
Void Sorcery Staff
One Purchase Items
Mercenary Contract
Moba Entr Fortify Perimeter
GDD
GDD Variable Creator
GUI Friendly Damage Detection

You will have to change GetItemID when you replace the element items

Do not start (zahl) numbers with zeros

Spell Array needs to be allocated in GUI trigger SetSpells
function getMaximumNumberOfSpells takes nothing returns integer
  return 8
endfunction

function getForgetSpellEffect takes nothing returns string
  return "war3mapImported\\HeroGlowImport.mdx"
endfunction

function getSpellAt takes integer index returns integer
  return udg_SpellArray[index]
endfunction

function getNumberOfSpells takes nothing returns integer
  // number of 3 different items combinations ((9*8*7)/8) 
  // + number of 2 same + 1 other combinations (9*8)
  // + number of 3er combinations (9)
  return 165

endfunction

function getSpellRecipeTypeAt takes integer index returns integer
  return udg_ItemArray[index]
endfunction

function getSpellPowerAbility takes nothing returns integer
  return 'A03K'
endfunction

function HATable takes nothing returns hashtable
    if udg_HATable == null then
        set udg_HATable = InitHashtable()
    endif
    return udg_HATable
endfunction

function SetHandleHandle takes handle subject, string name, agent value returns nothing
    if value==null then
       call RemoveSavedHandle( HATable(), GetHandleId(subject), StringHash(name))
       return
    endif
    call SaveAgentHandle( HATable(), GetHandleId(subject), StringHash(name), value)
endfunction
function SetHandleText takes handle subject, string name, texttag value returns nothing
    call SaveTextTagHandle(HATable(), GetHandleId(subject), StringHash(name), value)
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
    call SaveInteger(HATable(), GetHandleId(subject), StringHash(name), value)
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    call SaveBoolean(HATable(), GetHandleId(subject), StringHash(name), value)
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
    call SaveReal(HATable(), GetHandleId(subject), StringHash(name), value)
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
    call SaveStr(HATable(), GetHandleId(subject), StringHash(name), value)
endfunction

function GetHandleInt takes handle subject, string name returns integer
    return LoadInteger(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
    return LoadBoolean(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleReal takes handle subject, string name returns real
    return LoadReal(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleString takes handle subject, string name returns string
    return LoadStr(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleUnit takes handle subject, string name returns unit
    return LoadUnitHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleItem takes handle subject, string name returns item
    return LoadItemHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return LoadTimerHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleText takes handle subject, string name returns texttag
    return LoadTextTagHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return LoadTriggerHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleEffect takes handle subject, string name returns effect
    return LoadEffectHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleGroup takes handle subject, string name returns group
    return LoadGroupHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
    return LoadLightningHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleWidget takes handle subject, string name returns widget
    return LoadWidgetHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleLocation takes handle subject, string name returns location
    return LoadLocationHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandlePlayer takes handle subject, string name returns player
    return LoadPlayerHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleRegion takes handle subject, string name returns region
    return LoadRegionHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleRect takes handle subject, string name returns rect
    return LoadRectHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleForce takes handle subject, string name returns force
    return LoadForceHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleFogmodifier takes handle subject, string name returns fogmodifier
    return LoadFogModifierHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleTimerDialog takes handle subject, string name returns timerdialog
    return LoadTimerDialogHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction

function HaveHandleHandle takes handle subject, string name returns boolean
    return HaveSavedHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function HaveHandleInt takes handle subject, string name returns boolean
    return HaveSavedInteger(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function HaveHandleReal takes handle subject, string name returns boolean
    return HaveSavedReal(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function HaveHandleString takes handle subject, string name returns boolean
    return HaveSavedString(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function HaveHandleBoolean takes handle subject, string name returns boolean
    return HaveSavedBoolean(HATable(), GetHandleId(subject), StringHash(name))
endfunction

function RemoveHandle takes handle subject, string name returns nothing
    call SaveAgentHandle(HATable(),GetHandleId(subject),StringHash(name), null)
    call RemoveSavedHandle(HATable(),GetHandleId(subject),StringHash(name))
endfunction
function RemoveInt takes handle subject, string name returns nothing
    call SaveInteger(HATable(),GetHandleId(subject),StringHash(name), 0)
    call RemoveSavedInteger(HATable(),GetHandleId(subject),StringHash(name))
endfunction
function RemoveReal takes handle subject, string name returns nothing
    call SaveReal(HATable(),GetHandleId(subject),StringHash(name), 0.0)
    call RemoveSavedReal(HATable(),GetHandleId(subject),StringHash(name))
endfunction
function RemoveBoolean takes handle subject, string name returns nothing
    call SaveBoolean(HATable(),GetHandleId(subject),StringHash(name), false)
    call RemoveSavedBoolean(HATable(),GetHandleId(subject),StringHash(name))
endfunction
function RemoveStr takes handle subject, string name returns nothing
    call SaveStr(HATable(),GetHandleId(subject),StringHash(name), null)
    call RemoveSavedString(HATable(),GetHandleId(subject),StringHash(name))
endfunction

function FlushHandleLocals takes handle subject returns nothing
    call FlushChildHashtable(HATable(), GetHandleId(subject) )
endfunction

// not part of offical lib but required:
function GetHandleTriggerAction takes handle subject, string name returns triggeraction
    return LoadTriggerActionHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction

function SetHandleTriggerAction takes handle subject, string name, triggeraction value returns nothing
    if value==null then
       call RemoveSavedHandle( HATable(), GetHandleId(subject), StringHash(name))
       return
    endif
    call SaveTriggerActionHandle( HATable(), GetHandleId(subject), StringHash(name), value)
endfunction

// DamageModify functions are from danny760311 (http://www.wc3jass.com/viewtopic.php?t=2653)
// Deleted 5.7.1
//-------------------------------------------
// end of lib
//-------------------------------------------
function getSpellPowerOf takes unit target returns integer
  return GetUnitAbilityLevelSwapped(getSpellPowerAbility(), target)
endfunction

function setSpellPowerOf takes unit target, integer value returns nothing
  local integer oldValue = getSpellPowerOf(target)
  if (value > 0) then
    if (oldValue == 0) then
      call UnitAddAbilityBJ( getSpellPowerAbility(), target )
    endif
    call SetUnitAbilityLevelSwapped( getSpellPowerAbility(), target, value )
  else
    call UnitRemoveAbilityBJ( getSpellPowerAbility(), target )
  endif
endfunction

function CharToID takes string value returns integer
  set value = StringCase(value, true)
  // storm
  if value == "S" then
    return 0
  endif


  //earth
  if value == "E" then
    return 1
  endif

  //fire
  if value == "F" then
    return 2
  endif

  // light
  if value == "L" then
    return 3
  endif

  // water
  if value == "W" then
    return 4
  endif

  // dark
  if value == "D" then
    return 5
  endif

  //energy
   if value == "Y" then
    return 6
  endif

//Xarcanum
   if value == "X" then
    return 7
  endif

// Transmutation
  if value == "T" then
    return 8
  endif

  return -1 // unknown item

return 0
endfunction


function GetItemID takes item value returns integer

  //storm
  if GetItemTypeId(value) == getSpellRecipeTypeAt(0) then
    return 0
  endif

  //earth
  if GetItemTypeId(value) == getSpellRecipeTypeAt(1) then
    return 1
  endif

  //fire
  if GetItemTypeId(value) == getSpellRecipeTypeAt(2) then
    return 2
  endif

  // light
  if GetItemTypeId(value) == getSpellRecipeTypeAt(3) then
    return 3
  endif

  // water
  if GetItemTypeId(value) == getSpellRecipeTypeAt(4) then
    return 4
  endif

  // dark
  if GetItemTypeId(value) == getSpellRecipeTypeAt(5) then
    return 5
  endif

  //cosmos
  if GetItemTypeId(value) == getSpellRecipeTypeAt(6)  then
    return 6
  endif

//Xarc
  if GetItemTypeId(value) == getSpellRecipeTypeAt(7)  then
    return 7
  endif

//Transmut
  if GetItemTypeId(value) == getSpellRecipeTypeAt(8)  then
    return 8
  endif

  return -1 // unknown item
endfunction

function IndexOf takes integer Z3, integer Z2, integer Z1 returns integer
  local integer Zahl
  local integer temp

  // Z1 soll den groessten Wert, Z2 den zweitgroessten und Z3 den kleinsten Wert beinhalten:
  if (Z3 > Z1) then
    set temp = Z1
    set Z1 = Z3
    set Z3 = temp
  endif
  if (Z2 > Z1) then
    set temp = Z1
    set Z1 = Z2
    set Z2 = temp
  endif
  if (Z3 > Z2) then
    set temp = Z2
    set Z2 = Z3
    set Z3 = temp
  endif

  // Die Zahlen werden als String aneinander gereiht und wieder zu einer Zahl gemacht
  set Zahl = ( S2I( ( I2S(Z3) + I2S(Z2) ) + I2S(Z1)))

  // Anhand dieser Zahl wird der Index berechnet den der Zauberspruch HAT  if (Zahl <= 135) then
  if (Zahl <= 135) then
    if (Zahl <= 35) then
      if (Zahl <= 13) then
        if (Zahl <= 4) then
          if (Zahl <= 1) then
            if (Zahl <= 0) then
              if ( Zahl == 0 ) then
                return 0
              endif
            else
              if ( Zahl == 1 ) then
                return 6
              endif
            endif
          else
            if (Zahl <= 2) then
              if ( Zahl == 2 ) then
                return 7
              endif
            else
              if (Zahl <= 3) then
                if ( Zahl == 3 ) then
                  return 8
                endif
              else
                if ( Zahl == 4 ) then
                  return 9
                endif
              endif
            endif
          endif
        else
          if (Zahl <= 6) then
            if (Zahl <= 5) then
              if ( Zahl == 5 ) then
                return 10
              endif
            else
              if ( Zahl == 6 ) then
                return 54
              endif
            endif
          else
            if (Zahl <= 11) then
              if ( Zahl == 11 ) then
                return 11
              endif
            else
              if (Zahl <= 12) then
                if ( Zahl == 12 ) then
                  return 36
                endif
              else
                if ( Zahl == 13 ) then
                  return 42
                endif
              endif
            endif
          endif
        endif
      else
        if (Zahl <= 23) then
          if (Zahl <= 15) then
            if (Zahl <= 14) then
              if ( Zahl == 14 ) then
                return 48
              endif
            else
              if ( Zahl == 15 ) then
                return 41
              endif
            endif
          else
            if (Zahl <= 16) then
              if ( Zahl == 16 ) then
                return 55
              endif
            else
              if (Zahl <= 22) then
                if ( Zahl == 22 ) then
                  return 16
                endif
              else
                if ( Zahl == 23 ) then
                  return 49
                endif
              endif
            endif
          endif
        else
          if (Zahl <= 26) then
            if (Zahl <= 24) then
              if ( Zahl == 24 ) then
                return 47
              endif
            else
              if (Zahl <= 25) then
                if ( Zahl == 25 ) then
                  return 38
                endif
              else
                if ( Zahl == 26 ) then
                  return 56
                endif
              endif
            endif
          else
            if (Zahl <= 33) then
              if ( Zahl == 33 ) then
                return 20
              endif
            else
              if (Zahl <= 34) then
                if ( Zahl == 34 ) then
                  return 46
                endif
              else
                if ( Zahl == 35 ) then
                  return 51
                endif
              endif
            endif
          endif
        endif
      endif
    else
      if (Zahl <= 113) then
        if (Zahl <= 55) then
          if (Zahl <= 44) then
            if (Zahl <= 36) then
              if ( Zahl == 36 ) then
                return 57
              endif
            else
              if ( Zahl == 44 ) then
                return 25
              endif
            endif
          else
            if (Zahl <= 45) then
              if ( Zahl == 45 ) then
                return 44
              endif
            else
              if (Zahl <= 46) then
                if ( Zahl == 46 ) then
                  return 58
                endif
              else
                if ( Zahl == 55 ) then
                  return 30
                endif
              endif
            endif
          endif
        else
          if (Zahl <= 66) then
            if (Zahl <= 56) then
              if ( Zahl == 56 ) then
                return 59
              endif
            else
              if ( Zahl == 66 ) then
                return 60
              endif
            endif
          else
            if (Zahl <= 111) then
              if ( Zahl == 111 ) then
                return 1
              endif
            else
              if (Zahl <= 112) then
                if ( Zahl == 112 ) then
                  return 12
                endif
              else
                if ( Zahl == 113 ) then
                  return 13
                endif
              endif
            endif
          endif
        endif
      else
        if (Zahl <= 123) then
          if (Zahl <= 115) then
            if (Zahl <= 114) then
              if ( Zahl == 114 ) then
                return 14
              endif
            else
              if ( Zahl == 115 ) then
                return 15
              endif
            endif
          else
            if (Zahl <= 116) then
              if ( Zahl == 116 ) then
                return 61
              endif
            else
              if (Zahl <= 122) then
                if ( Zahl == 122 ) then
                  return 17
                endif
              else
                if ( Zahl == 123 ) then
                  return 43
                endif
              endif
            endif
          endif
        else
          if (Zahl <= 126) then
            if (Zahl <= 124) then
              if ( Zahl == 124 ) then
                return 62
              endif
            else
              if (Zahl <= 125) then
                if ( Zahl == 125 ) then
                  return 39
                endif
              else
                if ( Zahl == 126 ) then
                  return 63
                endif
              endif
            endif
          else
            if (Zahl <= 133) then
              if ( Zahl == 133 ) then
                return 21
              endif
            else
              if (Zahl <= 134) then
                if ( Zahl == 134 ) then
                  return 37
                endif
              else
                if ( Zahl == 135 ) then
                  return 53
                endif
              endif
            endif
          endif
        endif
      endif
    endif
  else
    if (Zahl <= 256) then
      if (Zahl <= 224) then
        if (Zahl <= 155) then
          if (Zahl <= 144) then
            if (Zahl <= 136) then
              if ( Zahl == 136 ) then
                return 64
              endif
            else
              if ( Zahl == 144 ) then
                return 26
              endif
            endif
          else
            if (Zahl <= 145) then
              if ( Zahl == 145 ) then
                return 50
              endif
            else
              if (Zahl <= 146) then
                if ( Zahl == 146 ) then
                  return 65
                endif
              else
                if ( Zahl == 155 ) then
                  return 31
                endif
              endif
            endif
          endif
        else
          if (Zahl <= 166) then
            if (Zahl <= 156) then
              if ( Zahl == 156 ) then
                return 66
              endif
            else
              if ( Zahl == 166 ) then
                return 67
              endif
            endif
          else
            if (Zahl <= 222) then
              if ( Zahl == 222 ) then
                return 2
              endif
            else
              if (Zahl <= 223) then
                if ( Zahl == 223 ) then
                  return 68
                endif
              else
                if ( Zahl == 224 ) then
                  return 18
                endif
              endif
            endif
          endif
        endif
      else
        if (Zahl <= 235) then
          if (Zahl <= 226) then
            if (Zahl <= 225) then
              if ( Zahl == 225 ) then
                return 19
              endif
            else
              if ( Zahl == 226 ) then
                return 69
              endif
            endif
          else
            if (Zahl <= 233) then
              if ( Zahl == 233 ) then
                return 22
              endif
            else
              if (Zahl <= 234) then
                if ( Zahl == 234 ) then
                  return 40
                endif
              else
                if ( Zahl == 235 ) then
                  return 35
                endif
              endif
            endif
          endif
        else
          if (Zahl <= 245) then
            if (Zahl <= 236) then
              if ( Zahl == 236 ) then
                return 70
              endif
            else
              if (Zahl <= 244) then
                if ( Zahl == 244 ) then
                  return 27
                endif
              else
                if ( Zahl == 245 ) then
                  return 52
                endif
              endif
            endif
          else
            if (Zahl <= 246) then
              if ( Zahl == 246 ) then
                return 71
              endif
            else
              if (Zahl <= 255) then
                if ( Zahl == 255 ) then
                  return 32
                endif
              else
                if ( Zahl == 256 ) then
                  return 72
                endif
              endif
            endif
          endif
        endif
      endif
    else
      if (Zahl <= 356) then
        if (Zahl <= 336) then
          if (Zahl <= 333) then
            if (Zahl <= 266) then
              if ( Zahl == 266 ) then
                return 73
              endif
            else
              if ( Zahl == 333 ) then
                return 3
              endif
            endif
          else
            if (Zahl <= 334) then 
              if ( Zahl == 334 ) then
                return 23
              endif
            else
              if (Zahl <= 335) then
                if ( Zahl == 335 ) then
                  return 24
                endif
              else
                if ( Zahl == 336 ) then
                  return 74
                endif
              endif
            endif
          endif
        else
          if (Zahl <= 345) then
            if (Zahl <= 344) then
              if ( Zahl == 344 ) then
                return 28
              endif
            else
              if ( Zahl == 345 ) then
                return 45
              endif
            endif
          else
            if (Zahl <= 346) then
              if ( Zahl == 346 ) then
                return 75
              endif
            else
              if (Zahl <= 355) then
                if ( Zahl == 355 ) then
                  return 33
                endif
              else
                if ( Zahl == 356 ) then
                  return 76
                endif
              endif
            endif
          endif
        endif
      else
        if (Zahl <= 455) then
          if (Zahl <= 444) then
            if (Zahl <= 366) then
              if ( Zahl == 366 ) then
                return 77
              endif
            else
              if ( Zahl == 444 ) then
                return 4
              endif
            endif
          else
            if (Zahl <= 445) then
              if ( Zahl == 445 ) then
                return 29
              endif
            else
              if (Zahl <= 446) then
                if ( Zahl == 446 ) then
                  return 78
                endif
              else
                if ( Zahl == 455 ) then
                  return 34
                endif
              endif
            endif
          endif
        else
          if (Zahl <= 555) then
            if (Zahl <= 456) then
              if ( Zahl == 456 ) then
                return 79
              endif
            else
              if (Zahl <= 466) then
                if ( Zahl == 466 ) then
                  return 80
                endif
              else
                if ( Zahl == 555 ) then
                  return 5
                endif
              endif
            endif
          else
            if (Zahl <= 556) then
              if ( Zahl == 556 ) then
                return 81
              endif
            else
              if (Zahl <= 566) then
                if ( Zahl == 566 ) then
                  return 82
                endif
              else
                if ( Zahl == 666 ) then
                  return 83
                endif
              endif
            endif
          endif
        endif
      endif
    endif
  endif

if (Zahl <= 100) then
       if ( Zahl == 37 ) then
                  return 115
                endif
       if ( Zahl == 77 ) then
                  return 118
                endif
       if ( Zahl == 57 ) then
                  return 89
                endif
       if ( Zahl == 67 ) then
                  return 91
                endif
       if ( Zahl == 47 ) then
                  return 97
                endif
       if ( Zahl == 7 ) then
                  return 98
                endif
       if ( Zahl == 27 ) then
                  return 99
                endif
       if ( Zahl == 17 ) then
                  return 100
                endif
       if ( Zahl == 8 ) then
                  return 120
                endif
       if ( Zahl == 18 ) then
                  return 128
                endif
       if ( Zahl == 28 ) then
                  return 129
                endif
       if ( Zahl == 38 ) then
                  return 130
                endif
       if ( Zahl == 48 ) then
                  return 131
                endif
       if ( Zahl == 58 ) then
                  return 132
                endif
       if ( Zahl == 68 ) then
                  return 133
                endif
       if ( Zahl == 78 ) then
                  return 151
                endif
       if ( Zahl == 88 ) then
                  return 156
                endif
endif // endif zahl <100

if (Zahl <= 200) then
       if ( Zahl == 167 ) then
                  return 104
                endif
       if ( Zahl == 157 ) then
                  return 114
                endif
       if ( Zahl == 177 ) then
                  return 110
                endif
       if ( Zahl == 117 ) then
                  return 111
                endif
       if ( Zahl == 137 ) then
                  return 112
                endif
        if ( Zahl == 147 ) then
                  return 86
                endif
        if ( Zahl == 127 ) then
                  return 87
                endif
       if ( Zahl == 118 ) then
                  return 121
                endif
       if ( Zahl == 128 ) then
                  return 134
                endif
       if ( Zahl == 138 ) then
                  return 135
                endif
       if ( Zahl == 148 ) then
                  return 136
                endif
       if ( Zahl == 158 ) then
                  return 137
                endif
       if ( Zahl == 168 ) then
                  return 138
                endif
       if ( Zahl == 178 ) then
                  return 139
                endif
       if ( Zahl == 188 ) then
                  return 157
                endif
endif // endif 100<zahl <200

if (Zahl <= 300) then
       if ( Zahl == 267 ) then
                  return 84
                endif
       if ( Zahl == 277 ) then
                  return 109
                endif
         if ( Zahl == 247 ) then
                  return 94
                endif
        if ( Zahl == 227 ) then
                  return 95
                endif
       if ( Zahl == 257 ) then
                  return 105
                endif
       if ( Zahl == 237 ) then
                  return 106
                endif
       if ( Zahl == 228 ) then
                  return 122
                endif
       if ( Zahl == 238 ) then
                  return 140
                endif
       if ( Zahl == 248 ) then
                  return 141
                endif
       if ( Zahl == 258 ) then
                  return 142
                endif
       if ( Zahl == 268 ) then
                  return 143
                endif
       if ( Zahl == 278 ) then
                  return 144
                endif
       if ( Zahl == 288 ) then
                  return 158
                endif
endif // endif 200<zahl <300

if (Zahl <= 400) then
       if ( Zahl == 377 ) then
                  return 116
                endif
       if ( Zahl == 357 ) then
                  return 88
                endif
       if ( Zahl == 337 ) then
                  return 96
                endif
       if ( Zahl == 347 ) then
                  return 102
                endif
       if ( Zahl == 367 ) then
                  return 103
                endif
       if ( Zahl == 338 ) then
                  return 123
                endif
       if ( Zahl == 348 ) then
                  return 145
                endif
       if ( Zahl == 358 ) then
                  return 146
                endif
       if ( Zahl == 368 ) then
                  return 147
                endif
       if ( Zahl == 378 ) then
                  return 152
                endif
       if ( Zahl == 388 ) then
                  return 159
                endif
endif // endif 300<zahl <400

if (Zahl <= 500) then
       if ( Zahl == 447 ) then
                  return 101
                endif
        if ( Zahl == 467 ) then
                  return 90
                endif
       if ( Zahl == 457 ) then
                  return 107
                endif
       if ( Zahl == 477 ) then
                  return 108
                endif
       if ( Zahl == 448 ) then
                  return 124
                endif
       if ( Zahl == 458 ) then
                  return 148
                endif
       if ( Zahl == 468 ) then
                  return 149
                endif
       if ( Zahl == 478 ) then
                  return 153
                endif
       if ( Zahl == 488 ) then
                  return 160
                endif
endif // endif 400<zahl <500

if (Zahl <= 600) then
       if ( Zahl == 577 ) then
                  return 113
                endif
        if ( Zahl == 557 ) then
                  return 92
                endif
         if ( Zahl == 567 ) then
                  return 93
                endif
       if ( Zahl == 558 ) then
                  return 125
                endif
       if ( Zahl == 568 ) then
                  return 150
                endif
       if ( Zahl == 578 ) then
                  return 154
                endif
       if ( Zahl == 588 ) then
                  return 161
                endif
endif // endif 500<zahl <600

if (Zahl <= 700) then
        if ( Zahl == 667 ) then
                  return 85
                endif
       if ( Zahl == 677 ) then
                  return 117
                endif
       if ( Zahl == 668 ) then
                  return 126
                endif
       if ( Zahl == 678 ) then
                  return 155
                endif
       if ( Zahl == 688 ) then
                  return 162
                endif
endif // endif 600<zahl <700

if (Zahl <= 900) then
       if ( Zahl == 777 ) then
                  return 119
                endif
       if ( Zahl == 778 ) then
                  return 127
                endif
       if ( Zahl == 788 ) then
                  return 163
                endif
       if ( Zahl == 888 ) then
                  return 164
                endif
endif // endif 700<zahl <900


return 164 //always Returns last SpellArray ability
endfunction


function StringToID takes string value returns integer
  local integer itemID1
  local integer itemID2
  local integer itemID3
  local boolean wrongInput

  set itemID1 = CharToID(SubStringBJ(value, 1, 1))
  set itemID2 = CharToID(SubStringBJ(value, 2, 2))
  set itemID3 = CharToID(SubStringBJ(value, 3, 3))

  set wrongInput = false

  if itemID1 == -1 then
      set wrongInput = true
  endif
  if itemID2 == -1 then
      set wrongInput = true
  endif
  if itemID3 == -1 then
      set wrongInput = true
  endif
  
  if wrongInput then
    return -1
  else
    return IndexOf(itemID1,itemID2,itemID3)
  endif

endfunction

//returns a handle used  to store the recipes of the spells.
function getConstSpellHandle takes nothing returns handle
  return HATable()
endfunction

function getSpellRecipeIndex takes integer spellIndex, integer number returns integer
    return GetHandleInt(getConstSpellHandle(), I2S(spellIndex) + "_recipe" + I2S(number))
endfunction

function initSpellRecipes takes nothing returns nothing
  local integer itemId0
  local integer itemId1
  local integer itemId2
  local string spellIndexString

  set itemId0 = 0
  loop
    set itemId1 = 0
    loop
      set itemId2 = 0
      loop
        set spellIndexString = I2S(IndexOf(itemId0, itemId1, itemId2))
        call SetHandleInt(getConstSpellHandle(), spellIndexString + "_recipe0", itemId0)
        call SetHandleInt(getConstSpellHandle(), spellIndexString + "_recipe1", itemId1)
        call SetHandleInt(getConstSpellHandle(), spellIndexString + "_recipe2", itemId2)
        set itemId2 = itemId2 +1
        exitwhen (itemId2 >= 9)
      endloop
      set itemId1 = itemId1 +1
      exitwhen (itemId1 >= 9)
    endloop
    set itemId0 = itemId0 +1
    exitwhen (itemId0 >= 9)
  endloop

endfunction


function showForgetSpellDialog takes nothing returns nothing
  local integer spellIndex
  local dialog forgetDialog
  local button spellButton
  local button cancelButton
  local integer playerId

  set playerId = GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))
  set forgetDialog = udg_forgetDialog[playerId]

  call FlushHandleLocals(forgetDialog)
  call SetHandleHandle(forgetDialog, "target", GetTriggerUnit())
  call DialogClearBJ(forgetDialog)
  // for {spellIndex = 0; spellIndex < getNumberOfSpells(); spellIndex++}
  set spellIndex = 0
  loop
      if ( GetUnitAbilityLevelSwapped(getSpellAt(spellIndex), GetTriggerUnit()) > 0 ) then
        set spellButton = DialogAddButtonBJ (forgetDialog, GetAbilityName(getSpellAt(spellIndex)))
        call SaveInteger(HATable(),GetHandleId(forgetDialog), GetHandleId(spellButton), spellIndex)
      endif
      set spellIndex = spellIndex +1
    exitwhen (spellIndex >= getNumberOfSpells())
  endloop
  set cancelButton = DialogAddButtonBJ (forgetDialog, "cancel")
  call SaveInteger(HATable(),GetHandleId(forgetDialog), GetHandleId(cancelButton), -1)
  call DialogDisplayBJ( true, forgetDialog, GetOwningPlayer(GetTriggerUnit()) )
endfunction

function forgetSpell takes unit target, integer spellIndex returns nothing
  local integer itemCounter
  local integer itemIndex
  local integer wood = 0
  local integer level = GetUnitAbilityLevelSwapped(getSpellAt(spellIndex), target)
  local integer levelCounter
  local integer recipeItem
  local boolean failure = false

  if (IsUnitDeadBJ(target)) then
    call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(target)), "Can't remove spell from dead unit." )
    set failure = true
  endif

  if (not failure) then

if (level > 4) then
set level = 4
endif

    // for (itemCounter = 0; itemCounter < 3; itemCounter++)
    set itemCounter = 0
    loop
      set itemIndex = getSpellRecipeIndex(spellIndex, itemCounter)
      if (udg_forgetGivesWood) then
        set wood = wood + (level * udg_race_item_wood_value[itemIndex])
      else
        set recipeItem = getSpellRecipeTypeAt(itemIndex)
        set levelCounter = 0
        loop
          call CreateItemLoc( recipeItem, GetUnitLoc(target) )
          set levelCounter = levelCounter + 1
          exitwhen (levelCounter >= level)
        endloop
      endif
      set itemCounter = itemCounter +1
      exitwhen (itemCounter >= 3)
    endloop

    if ( wood > 0 ) then
      call CreateTextTagUnitBJ( ( ( "+" + I2S(wood) ) + " AP" ), target, 0, 10, 95, 92, 90, 20  )
      call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
      call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
      call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
      call AdjustPlayerStateBJ( wood, GetOwningPlayer(target), PLAYER_STATE_RESOURCE_LUMBER )
    endif

    call SetUnitUserData( target, GetUnitUserData(target) - 1)
    call UnitRemoveAbilityBJ(getSpellAt(spellIndex), target)
    call setSpellPowerOf(target, getSpellPowerOf(target) - level)

    call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(target)), ( "Ability recycled: " + GetAbilityName(getSpellAt(spellIndex)) ) )
    call AddSpecialEffectTargetUnitBJ( "head", target, getForgetSpellEffect() )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
  endif
endfunction

//function Trig_ttt_Func001001002 takes nothing  returns boolean
//    return ( IsUnitAliveBJ (GetFilterUnit()) == true  )
//endfunction

function BouncingOrbstrikeForHero takes unit Thero returns nothing
    local location Point_Copy = GetUnitLoc(Thero)
       
    local integer AAinteger = ( ( GetHeroStatBJ(bj_HEROSTAT_INT, Thero, true) * 3 ) + 0 )
     call CreateNUnitsAtLocFacingLocBJ( 1, 'n047', GetOwningPlayer(Thero), Point_Copy, Point_Copy )
       call UnitApplyTimedLifeBJ( 4.00, 'BTLF', GetLastCreatedUnit() )
        call BlzSetUnitBaseDamage( GetLastCreatedUnit(), AAinteger, 0 )
        //call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", AAunitTemp1 )
    
    call RemoveLocation(Point_Copy)
   
    set udg_CTickMasterInstancesRunning = ( udg_CTickMasterInstancesRunning + 1 )
    set udg_CTickMasterMaxInstances = ( udg_CTickMasterMaxInstances + 1 )
    set udg_CTickMasterIntType[udg_CTickMasterMaxInstances] = 2
    set udg_CTickMasterIntUnit[udg_CTickMasterMaxInstances] = Thero
    set udg_CTickMasterIntValue01[udg_CTickMasterMaxInstances] = 1
    set udg_CTickMasterIntTicksRemaining[udg_CTickMasterMaxInstances] = 4
    call EnableTrigger( gg_trg_CTIckMasterSystTrig )
    set Thero = null
endfunction

function handleForgetButtonClick takes nothing returns nothing
  local integer spellIndex
  local dialog forgetDialog
  local button spellButton
  local unit target

  set spellButton = GetClickedButtonBJ()
  set forgetDialog = GetClickedDialogBJ()
  set spellIndex = LoadInteger(HATable(), GetHandleId(forgetDialog), GetHandleId(spellButton))
  set target =  GetHandleUnit(forgetDialog, "target")

  call DialogDisplayBJ( false, forgetDialog, GetOwningPlayer(target) )
  if (not (spellIndex == -1)) then // cancel button?
    call forgetSpell(target, spellIndex)
    
    // hook for upgraded recycle    
    if ( GetPlayerTechCountSimple('R021', GetOwningPlayer(target)) == 1 )  then
	call SetUnitManaBJ( target, ( GetUnitStateSwap(UNIT_STATE_MANA, target) + ( GetUnitStateSwap(UNIT_STATE_MAX_MANA, target) * 0.10 ) ) )
	call AddSpecialEffectTargetUnitBJ( "chest", target, "Abilities\\Spells\\Items\\AIma\\AImaTarget.mdl" )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        call BouncingOrbstrikeForHero (target)	
    endif
   

  else    
  
  if (UnitRemoveAbility(target,'A03L')) then
  call UnitAddAbility (target,'A03L')
  endif
  if (UnitRemoveAbility(target,'A04X')) then
  call UnitAddAbility (target,'A04X')
  endif

  endif
set target = null
endfunction

function HeroCombineSpell takes unit hero returns nothing
  local integer ItemID1
  local integer ItemID2
  local integer ItemID3
  local integer I
  local integer Index
  // position of items:
  local integer pos1
  local integer pos2
  local integer pos3
  local integer skill_level
  local boolean success
  local integer wood
  local integer randomit 
  set ItemID1 = -1
  set ItemID2 = -1
  set ItemID3 = -1

  set I = 1
  loop // for I := 1 to 9 do
    exitwhen (ItemID3 >= 0)
    if ItemID1 == -1 then
      set ItemID1 = GetItemID(UnitItemInSlotBJ(hero, I))
      set pos1 = I
    else
      if ItemID2 == -1 then
        set ItemID2 = GetItemID(UnitItemInSlotBJ(hero, I))
        set pos2 = I
      else
        if ItemID3 == -1 then
          set ItemID3 = GetItemID(UnitItemInSlotBJ(hero, I))
          set pos3 = I
        endif
      endif
    endif
    set I = I +1
    exitwhen (I > 6)
  endloop

  if ItemID3 >= 0 then // there are three items to combine
    set Index = IndexOf(ItemID3,ItemID2,ItemID1)
    set skill_level = GetUnitAbilityLevelSwapped(getSpellAt(Index), hero)

    if (skill_level < 3) then
      if skill_level == 0 then
        if (GetUnitUserData(hero) < getMaximumNumberOfSpells()) then
          // Increase spell counter of unit
          call SetUnitUserData( GetTriggerUnit(), ( GetUnitUserData(GetTriggerUnit()) + 1 ) )
          call UnitAddAbilityBJ( getSpellAt(Index), hero )
          set success = true
        else
          call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(hero)), "You already have maximum number of spells" )   
          set success = false
        endif
      else
        call IncUnitAbilityLevelSwapped( getSpellAt(Index), hero )
        set success = true
      endif 
    else
            
set success = false

if (skill_level == 3) then

if ( udg_SpellArrayEvoInt[Index] >= 1 ) then

set randomit = GetRandomInt(1, udg_SpellArrayEvoInt[Index])
set success = true

loop
    exitwhen randomit < 1
    call IncUnitAbilityLevelSwapped( getSpellAt(Index), hero )
    set randomit = randomit - 1
endloop

endif
endif

if (success == false) then
call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(hero)), "Ability is max level." )
endif
      
    endif
    if success then
      call RemoveItem( UnitItemInSlotBJ(hero, pos1) )
      call RemoveItem( UnitItemInSlotBJ(hero, pos2) )
      call RemoveItem( UnitItemInSlotBJ(hero, pos3) )
      call UnitAddItemByIdSwapped( 'I007', hero )
      call setSpellPowerOf(hero, getSpellPowerOf(hero) + 1)
      
    else
      if udg_forgetGivesWood then
        call RemoveItem( UnitItemInSlotBJ(hero, pos1) )
        call RemoveItem( UnitItemInSlotBJ(hero, pos2) )
        call RemoveItem( UnitItemInSlotBJ(hero, pos3) ) 
        set wood = udg_race_item_wood_value[ItemID1] + udg_race_item_wood_value[ItemID2] + udg_race_item_wood_value[ItemID3]

        call CreateTextTagUnitBJ( ( ( "+" + I2S(wood) ) + " AP" ), hero, 0, 10, 95, 92, 90, 20  )
        call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
        call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
        call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
        call AdjustPlayerStateBJ( wood, GetOwningPlayer(hero), PLAYER_STATE_RESOURCE_LUMBER )
      else
        call UnitRemoveItemFromSlotSwapped( pos1, hero )
        call UnitRemoveItemFromSlotSwapped( pos2, hero )
        call UnitRemoveItemFromSlotSwapped( pos3, hero )
      endif
    endif
  endif

endfunction

function HeroCombineSpellExt takes unit heroComb, unit hero, integer playerID returns nothing
  local integer ItemID1
  local integer ItemID2
  local integer ItemID3
  local integer I
  local integer Index
  // position of items:
  local integer pos1
  local integer pos2
  local integer pos3
  local integer skill_level
  local boolean success
  local integer wood
local integer randomit
  set ItemID1 = -1
  set ItemID2 = -1
  set ItemID3 = -1

  set I = 1
  loop // for I := 1 to 9 do
    exitwhen (ItemID3 >= 0)
    if ItemID1 == -1 then
      set ItemID1 = GetItemID(UnitItemInSlotBJ(heroComb, I))
      set pos1 = I
    else
      if ItemID2 == -1 then
        set ItemID2 = GetItemID(UnitItemInSlotBJ(heroComb, I))
        set pos2 = I
      else
        if ItemID3 == -1 then
          set ItemID3 = GetItemID(UnitItemInSlotBJ(heroComb, I))
          set pos3 = I
        endif
      endif
    endif
    set I = I +1
    exitwhen (I > 6)
  endloop

  if ItemID3 >= 0 then // there are three items to combine
    set Index = IndexOf(ItemID3,ItemID2,ItemID1)
    set udg_LSIndexForPlayer[playerID] = Index
    set skill_level = GetUnitAbilityLevelSwapped(getSpellAt(Index), hero)

    if (skill_level < 3) then
      if skill_level == 0 then
        if (GetUnitUserData(hero) < getMaximumNumberOfSpells()) then
          // Increase spell counter of unit
          call SetUnitUserData( hero, ( GetUnitUserData(hero) + 1 ) )
          call UnitAddAbilityBJ( getSpellAt(Index), hero )
          set success = true
        else
          call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(hero)), "You already have maximum number of spells" )   
          set success = false
        endif
      else
        call IncUnitAbilityLevelSwapped( getSpellAt(Index), hero )
        set success = true
      endif 
    else
             
     set success = false

if (skill_level == 3) then

if ( udg_SpellArrayEvoInt[Index] >= 1 ) then

set randomit = GetRandomInt(1, udg_SpellArrayEvoInt[Index])
set success = true

loop
    exitwhen randomit < 1
    call IncUnitAbilityLevelSwapped( getSpellAt(Index), hero )
    set randomit = randomit - 1
endloop

endif
endif

if (success == false) then
call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(hero)), "Ability is max level." )
endif
      
    endif
    if success then
      call RemoveItem( UnitItemInSlotBJ(heroComb, pos1) )
      call RemoveItem( UnitItemInSlotBJ(heroComb, pos2) )
      call RemoveItem( UnitItemInSlotBJ(heroComb, pos3) )
         if IsUnitType(hero,UNIT_TYPE_DEAD) == false then
      call UnitAddItemByIdSwapped( 'I007', hero )
          endif
      call setSpellPowerOf(hero, getSpellPowerOf(hero) + 1)
      
      set wood = udg_race_item_wood_value[ItemID1] + udg_race_item_wood_value[ItemID2] + udg_race_item_wood_value[ItemID3]
      set udg_LSWoodForPlayer[playerID] = wood

    else
      if udg_forgetGivesWood then
        call RemoveItem( UnitItemInSlotBJ(heroComb, pos1) )
        call RemoveItem( UnitItemInSlotBJ(heroComb, pos2) )
        call RemoveItem( UnitItemInSlotBJ(heroComb, pos3) ) 
        set wood = udg_race_item_wood_value[ItemID1] + udg_race_item_wood_value[ItemID2] + udg_race_item_wood_value[ItemID3]

        call CreateTextTagUnitBJ( ( ( "+" + I2S(wood) ) + " AP" ), hero, 0, 10, 95, 92, 90, 20  )
        call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
        call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
        call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
        call AdjustPlayerStateBJ( wood, GetOwningPlayer(hero), PLAYER_STATE_RESOURCE_LUMBER )
      else
        call UnitRemoveItemFromSlotSwapped( pos1, heroComb )
        call UnitRemoveItemFromSlotSwapped( pos2, heroComb )
        call UnitRemoveItemFromSlotSwapped( pos3, heroComb )
      endif
    endif
  endif

endfunction


function HeroAddLastSpellCN takes integer woodB, integer IndexB, unit heroB returns nothing
  local integer skill_levelB
  local boolean success
  local integer Index
local integer randomit

  set Index = IndexB
  set skill_levelB = GetUnitAbilityLevelSwapped(getSpellAt(Index), heroB) 
  
   if (skill_levelB < 3) then
     if skill_levelB == 0 then
       if (GetUnitUserData(heroB) < getMaximumNumberOfSpells()) then

          call SetUnitUserData( heroB, ( GetUnitUserData(heroB) + 1 ) )
          call UnitAddAbilityBJ( getSpellAt(Index), heroB )
          set success = true
        else
          call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(heroB)), "You already have maximum number of spells" )   
          set success = false

        endif
      else

        call IncUnitAbilityLevelSwapped( getSpellAt(Index), heroB )
        set success = true

      endif 
    else             

set success = false

if (skill_levelB == 3) then

if ( udg_SpellArrayEvoInt[Index] >= 1 ) then

set randomit = GetRandomInt(1, udg_SpellArrayEvoInt[Index])
set success = true

loop
    exitwhen randomit < 1
    call IncUnitAbilityLevelSwapped( getSpellAt(Index), heroB )
    set randomit = randomit - 1
endloop

endif
endif

if (success == false) then
call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(heroB)), "Ability is max level." )
endif
    endif

    if success then
	if IsUnitType(heroB,UNIT_TYPE_DEAD) == false then
      call UnitAddItemByIdSwapped( 'I007', heroB )
	endif
      call setSpellPowerOf(heroB, getSpellPowerOf(heroB) + 1)     
    else       
      call AdjustPlayerStateBJ( woodB, GetOwningPlayer(heroB), PLAYER_STATE_RESOURCE_LUMBER )
    endif
  
endfunction

// hero classes
function ClassGetAbilityCostAtIndex takes integer spellIndex returns integer
local integer itemCounter
local integer itemIndex
local integer wood = 0

 // for (itemCounter = 0; itemCounter < 3; itemCounter++)
    set itemCounter = 0
    loop     
      set itemIndex = getSpellRecipeIndex(spellIndex, itemCounter)
      set wood = wood + (1 * udg_race_item_wood_value[itemIndex])
      set itemCounter = itemCounter +1
      exitwhen (itemCounter >= 3)
    endloop

return wood
endfunction

function ClassTryLearnAbilityIndexHero takes integer IndexB, unit heroB returns nothing
  local integer skill_levelB  
  local integer Index
  local integer randomit
  local integer woodB
  local boolean success

set woodB = ClassGetAbilityCostAtIndex (IndexB)

if (woodB >  GetPlayerState(GetOwningPlayer(heroB), PLAYER_STATE_RESOURCE_LUMBER)  ) then
call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(heroB)), ( I2S(woodB) + " Ability Points required") )   
set success = false
return
endif

  set Index = IndexB
  set skill_levelB = GetUnitAbilityLevelSwapped(getSpellAt(Index), heroB) 
  
   if (skill_levelB < 3) then
     if skill_levelB == 0 then
       if (GetUnitUserData(heroB) < getMaximumNumberOfSpells()) then

          call SetUnitUserData( heroB, ( GetUnitUserData(heroB) + 1 ) )
          call UnitAddAbilityBJ( getSpellAt(Index), heroB )
          set success = true
        else
          call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(heroB)), "You already have maximum number of spells" )   
          set success = false

        endif
      else

        call IncUnitAbilityLevelSwapped( getSpellAt(Index), heroB )
        set success = true

      endif 
    else             

set success = false

if (skill_levelB == 3) then

if ( udg_SpellArrayEvoInt[Index] >= 1 ) then

set randomit = GetRandomInt(1, udg_SpellArrayEvoInt[Index])
set success = true

loop
    exitwhen randomit < 1
    call IncUnitAbilityLevelSwapped( getSpellAt(Index), heroB )	
    set randomit = randomit - 1
endloop

endif
endif

if (success == false) then
call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(heroB)), "Ability is max level." )
endif
    endif

    if success then
	if IsUnitType(heroB,UNIT_TYPE_DEAD) == false then
      call UnitAddItemByIdSwapped( 'I007', heroB )
	endif
      call setSpellPowerOf(heroB, getSpellPowerOf(heroB) + 1)           
      call AdjustPlayerStateBJ( (0 - (woodB)), GetOwningPlayer(heroB), PLAYER_STATE_RESOURCE_LUMBER )
    endif
endfunction

// utility and spell functions
// ===================

function ShortStunAtPointForPlayerInt takes integer localPlayerInt, location localPoint  returns nothing
    call CreateNUnitsAtLoc( 1, 'n00U', ConvertedPlayer(localPlayerInt), localPoint, 0.00 )
    call UnitAddAbilityBJ( 'A0DN', GetLastCreatedUnit() )
    call UnitApplyTimedLifeBJ( 3.00, 'BTLF', GetLastCreatedUnit() )
    call IssueImmediateOrderBJ( GetLastCreatedUnit(), "stomp" )
    call RemoveLocation(localPoint)
endfunction


// trace missile spell
// ===================
// configuration:
// --------------
function traceMissile_getDamagePerMissile takes nothing returns real
  return 75.0
endfunction

function traceMissile_getUnitTypeId takes nothing returns integer
  return 'n00O'
endfunction

function traceMissile_getMissileBirthSound takes nothing returns sound
  return gg_snd_CreateRotatingBlade
endfunction

function traceMissile_getMissileHitSound takes nothing returns sound
  return gg_snd_RotatingBladeHit
endfunction

function traceMissile_getMissileBirthDistance takes nothing returns real
  return 120.0
endfunction

function traceMissile_getMissileRadius takes nothing returns real
  return 25.0
endfunction

function traceMissile_getSpellRadius takes nothing returns real
  return 800.0
endfunction

function traceMissile_getMissileDuration takes nothing returns real
  return 9.0
endfunction

// functions:
// --------------
function traceMissile_handleHit takes nothing returns nothing
  local real damage = traceMissile_getDamagePerMissile()
  local trigger hitTrigger = GetTriggeringTrigger()
  local unit source = GetHandleUnit(hitTrigger,"source")
  local unit target = GetHandleUnit(hitTrigger,"target")
  local unit missileUnit = GetHandleUnit(hitTrigger,"missile")
  local unit triggeringUnit = GetTriggerUnit()
  if (GetUnitTypeId(triggeringUnit) != traceMissile_getUnitTypeId()) then
    call DisableTrigger(hitTrigger)
    if (triggeringUnit == source) then
      call UnitDamageTargetBJ(target, GetTriggerUnit(), damage, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_DIVINE)
    else
      call UnitDamageTargetBJ(source, GetTriggerUnit(), damage, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_DIVINE)
    endif
    call PlaySoundOnUnitBJ( traceMissile_getMissileHitSound(), 100, missileUnit)
    call KillUnit(missileUnit)
  endif
endfunction

function traceMissile_handleDeath takes nothing returns nothing
  local trigger deathTrigger = GetTriggeringTrigger()
  local trigger hitTrigger = GetHandleTrigger(deathTrigger, "hitTrigger")
  local timer orderTimer = GetHandleTimer(deathTrigger, "orderTimer")
  call DisableTrigger(deathTrigger)
  call DisableTrigger(hitTrigger)
  call FlushHandleLocals(deathTrigger)
  call DestroyTrigger(deathTrigger)
  call FlushHandleLocals(hitTrigger)
  call DestroyTrigger(hitTrigger)
  call FlushHandleLocals(orderTimer)
  call DestroyTimer(orderTimer)
endfunction

function traceMissile_handleOrderTimer takes nothing returns nothing
  local timer orderTimer = GetExpiredTimer()
  local unit target = GetHandleUnit(orderTimer, "target")
  local unit missileUnit = GetHandleUnit(orderTimer, "missile")
  local location targetLocation
  if (IsUnitAliveBJ(target)) then
    set targetLocation  = GetUnitLoc(target)
    call IssuePointOrderLocBJ( missileUnit, "move", targetLocation )
    call RemoveLocation(targetLocation)
    set targetLocation  = null
  else
    call KillUnit(missileUnit)
  endif
endfunction

function traceMissile_create takes unit source, unit target returns nothing
  local trigger hitTrigger
  local trigger deathTrigger
  local timer orderTimer
  local location sourceLocation
  local location targetLocation
  local location birthPlace
  local unit missileUnit
  local real angle
  local integer timedLifeTypeDefault = 'BTLF'
  local real orderInterval = 0.2

  set sourceLocation = GetUnitLoc(source)
  set targetLocation = GetUnitLoc(target)
  set angle = AngleBetweenPoints(sourceLocation, targetLocation)
  set birthPlace = PolarProjectionBJ(sourceLocation, traceMissile_getMissileBirthDistance(), angle)

  call CreateNUnitsAtLoc( 1, traceMissile_getUnitTypeId(), GetOwningPlayer(source), birthPlace, angle)
  set missileUnit = GetLastCreatedUnit()

  set hitTrigger = CreateTrigger()
  call SetHandleHandle(hitTrigger, "source", source)
  call SetHandleHandle(hitTrigger, "target", target)
  call SetHandleHandle(hitTrigger, "missile", missileUnit)
  call TriggerAddAction( hitTrigger, function traceMissile_handleHit )

  set deathTrigger = CreateTrigger()
  call SetHandleHandle(deathTrigger, "hitTrigger", hitTrigger)
  call TriggerRegisterUnitEvent( deathTrigger, missileUnit, EVENT_UNIT_DEATH )
  call TriggerRegisterUnitInRangeSimple( hitTrigger, traceMissile_getMissileRadius(), missileUnit )
  call TriggerAddAction( deathTrigger, function traceMissile_handleDeath )


  set orderTimer = CreateTimer()
  call SetHandleHandle(deathTrigger, "orderTimer", orderTimer)
  call SetHandleHandle(orderTimer, "missile", missileUnit)
  call SetHandleHandle(orderTimer, "target", target)
  call TimerStart(orderTimer,orderInterval , true, function traceMissile_handleOrderTimer)

  call UnitApplyTimedLifeBJ( traceMissile_getMissileDuration(), timedLifeTypeDefault, missileUnit )
  call PlaySoundOnUnitBJ( traceMissile_getMissileBirthSound(), 100, missileUnit)

  call RemoveLocation(sourceLocation)
  call RemoveLocation(targetLocation)
  call RemoveLocation(birthPlace)
endfunction

function traceMissile_filterIsAliveEnemeyOfTriggeringUnit takes nothing returns boolean
  return IsUnitAliveBJ(GetFilterUnit()) and IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()))
endfunction

function traceMissile_handlePickSpellTarget takes nothing returns nothing
  call traceMissile_create(GetTriggerUnit(),GetEnumUnit())
endfunction

function traceMissile_handleUnitCastsSpell takes nothing returns nothing
  local group targets
  local location casterLocation
  set casterLocation = GetUnitLoc(GetTriggerUnit())
  set targets = GetUnitsInRangeOfLocMatching(traceMissile_getSpellRadius(), casterLocation, Condition(function traceMissile_filterIsAliveEnemeyOfTriggeringUnit))
  call ForGroupBJ( targets, function traceMissile_handlePickSpellTarget )
  call RemoveLocation(casterLocation)
  call DestroyGroup(targets)
endfunction



// hero armor skill
// ===================
// configuration:
// --------------
// removed in 5.7.1


// --- micro wars  code --

function microwars_getPlayerCount takes nothing returns integer
  return udg_micro_playerCount
endfunction

function microwars_setPlayerCount takes integer value returns nothing
  set udg_micro_playerCount = value
endfunction

function microwars_getPlayerAt takes integer index returns player
  return udg_micro_playerList[index]
endfunction

function microwars_setPlayerAt takes integer index, player value returns nothing
  set udg_micro_playerList[index] = value
endfunction

function microwars_getPlayerScore takes player target returns integer
  return udg_micro_playerScore[GetConvertedPlayerId(target)]
endfunction

function microwars_setPlayerScore takes player target, integer value returns nothing
  set udg_micro_playerScore[GetConvertedPlayerId(target)] = value
endfunction

function microwars_increasePlayerScore takes player target returns nothing
  call microwars_setPlayerScore(target, microwars_getPlayerScore(target)+1)
endfunction

function microwars_getPlayerRank takes player target returns integer
  return udg_micro_playerRank[GetConvertedPlayerId(target)]
endfunction

function microwars_setPlayerRank takes player target, integer value returns nothing
  set udg_micro_playerRank[GetConvertedPlayerId(target)] = value
endfunction



function micowars_addPlayer takes player playerToAdd returns nothing
  local integer index
  set index = microwars_getPlayerCount()
  call microwars_setPlayerCount(index + 1)
  call microwars_setPlayerAt(index, playerToAdd)
  call microwars_setPlayerScore(playerToAdd, 0)
endfunction

function microwars_removePlayer takes player playerToRemove returns nothing
  local integer index
  local integer index0
  local integer index1
  local player playerAtIndex
  local player playerAtIndex0
  local player playerAtIndex1
  local boolean playerInList
  local player lastPlayerInList

  set index = 0
  loop
    exitwhen index >= microwars_getPlayerCount()
    set playerAtIndex = microwars_getPlayerAt(index)
    exitwhen (playerAtIndex == playerToRemove)
    set index = index + 1
  endloop

  set playerInList = (index !=  microwars_getPlayerCount())
  if (playerInList) then
    // shift all other players to close the gap in the list:
    set index0 = index
    set index1 = index+1
    loop
      exitwhen index1 >= microwars_getPlayerCount()
      set playerAtIndex0 = microwars_getPlayerAt(index0)
      set playerAtIndex1 = microwars_getPlayerAt(index1)

      call microwars_setPlayerAt(index0, playerAtIndex1)

      set index0 = index0 +1
      set index1 = index1 +1
    endloop
    call microwars_setPlayerCount(microwars_getPlayerCount()-1)
  endif

set playerAtIndex = null
set playerAtIndex0 = null
set playerAtIndex1 = null
set lastPlayerInList = null

endfunction


function microwars_sortPlayerList takes nothing returns nothing
  // bubble sort is used as the list contains only 10 items
  local integer index0
  local integer index1
  local boolean listChanged
  local player player0
  local player player1
  local integer score0
  local integer score1
  loop
    set index0 = 0
    set index1 = 1
    set listChanged = false
    loop
      exitwhen index1 >= microwars_getPlayerCount()

      set player0 = microwars_getPlayerAt(index0)
      set player1 = microwars_getPlayerAt(index1)
      set score0 = microwars_getPlayerScore(player0)
      set score1 = microwars_getPlayerScore(player1)

      if (score0 < score1) then
        call microwars_setPlayerAt(index1, player0)
        call microwars_setPlayerAt(index0, player1)
        set listChanged = true
      endif

      set index0 = index0 + 1
      set index1 = index1 + 1

      set player0 = null
      set player1 = null
    endloop
    exitwhen not listChanged
  endloop
endfunction


function microwars_shufflePlayerList takes nothing returns nothing
  local integer index0
  local integer index1
  local player player0
  local player player1
  local integer remainingIterations
  local integer playerCount = microwars_getPlayerCount()

  set remainingIterations = 30
  loop
    exitwhen remainingIterations == 0
    set remainingIterations = remainingIterations - 1

    set index0 = GetRandomInt(0, playerCount-1)
    set index1 = GetRandomInt(0, playerCount-1)
    set player0 = microwars_getPlayerAt(index0)
    set player1 = microwars_getPlayerAt(index1)
    call microwars_setPlayerAt(index0, player1)
    call microwars_setPlayerAt(index1, player0)
    
    set player0 = null
    set player1 = null
  endloop
endfunction

// requires a sorted list
function microwars_calculateRank takes nothing returns nothing
  local integer index0
  local integer index1
  local player player0
  local player player1
  local integer score0
  local integer score1
  local integer rank
  local integer counter


  set rank = 1
  set counter = 1
  call microwars_setPlayerRank(microwars_getPlayerAt(0),rank)
  set index0 = 0
  set index1 = 1
  loop
    exitwhen (index1 >= microwars_getPlayerCount())

    set player0 = microwars_getPlayerAt(index0)
    set player1 = microwars_getPlayerAt(index1)
    set score0 = microwars_getPlayerScore(player0)
    set score1 = microwars_getPlayerScore(player1)
    set counter = counter + 1
    if (score0 > score1) then
      set rank = counter
    endif
    call microwars_setPlayerRank(player1,rank)

    set index0 = index0 + 1
    set index1 = index1 + 1

    set player0 = null
    set player1 = null
  endloop
endfunction

function initUItestForRAAZ takes nothing returns nothing
  
local framehandle act01cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 8)
local framehandle act02cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 9)
local framehandle act03cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 10)
local framehandle act04cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 11)

local framehandle act05cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 4)
local framehandle act06cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 5)
local framehandle act07cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 6)
local framehandle act08cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 7)

local framehandle act09cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 3)
local framehandle act10cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 2)
local framehandle act11cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 0)
local framehandle act12cui = BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 1)

local framehandle set01cui = BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP_BUTTON,0)

local framehandle herolevelcui = (BlzGetFrameByName("SimpleHeroLevelBar",0))
//local framehandle herocui00 = BlzGetOriginFrame(ORIGIN_FRAME_HERO_BAR, 0)
//local framehandle herocui01 = BlzGetOriginFrame(ORIGIN_FRAME_HERO_BUTTON, 0)
//local framehandle invcui03 = BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, 3)

//call BlzFrameSetAllPoints(BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0))
//call BlzFrameSetVisible ( (BlzGetFrameByName("MainPanel",0)) , false)
//call BlzFrameSetScale ( (BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP,0)) , 0.7)
//call BlzFrameSetScale ( BlzGetFrameByName("BottomButtonPanel",0) , 0.5)

call BlzFrameSetScale ( herolevelcui , 0.85)

//call BlzFrameClearAllPoints(herocui00)
//call BlzFrameClearAllPoints(herocui01)

//call BlzFrameSetPoint(herocui00, FRAMEPOINT_TOPLEFT, invcui03, FRAMEPOINT_TOPRIGHT, 0.02, 0.0)

set herolevelcui = null
//set herocui00 = null
//set herocui01 = null
//set invcui03 = null

call BlzFrameClearAllPoints(act01cui)
call BlzFrameClearAllPoints(act02cui)
call BlzFrameClearAllPoints(act03cui)
call BlzFrameClearAllPoints(act04cui)
//call BlzFrameClearAllPoints(set01cui)

call BlzFrameClearAllPoints(act05cui)
call BlzFrameClearAllPoints(act06cui)
call BlzFrameClearAllPoints(act07cui)
call BlzFrameClearAllPoints(act08cui)
call BlzFrameClearAllPoints(act09cui)
call BlzFrameClearAllPoints(act10cui)
call BlzFrameClearAllPoints(act11cui)
call BlzFrameClearAllPoints(act12cui)

call BlzFrameSetPoint(act04cui, FRAMEPOINT_TOPLEFT, set01cui, FRAMEPOINT_TOPRIGHT, 0.01, 0.03) 
call BlzFrameSetPoint(act02cui, FRAMEPOINT_LEFT, act04cui, FRAMEPOINT_RIGHT, 0.0, 0.0)
call BlzFrameSetPoint(act03cui, FRAMEPOINT_LEFT, act02cui, FRAMEPOINT_RIGHT, 0.0, 0.0)
call BlzFrameSetPoint(act01cui, FRAMEPOINT_LEFT, act03cui, FRAMEPOINT_RIGHT, 0.0, 0.0)
call BlzFrameSetPoint(act05cui, FRAMEPOINT_LEFT, act01cui, FRAMEPOINT_RIGHT, 0.0, 0.0)
call BlzFrameSetPoint(act06cui, FRAMEPOINT_LEFT, act05cui, FRAMEPOINT_RIGHT, 0.0, 0.0)
call BlzFrameSetPoint(act07cui, FRAMEPOINT_LEFT, act06cui, FRAMEPOINT_RIGHT, 0.0, 0.0)
call BlzFrameSetPoint(act08cui, FRAMEPOINT_LEFT, act07cui, FRAMEPOINT_RIGHT, 0.0, 0.0)
call BlzFrameSetPoint(act09cui, FRAMEPOINT_LEFT, act08cui, FRAMEPOINT_RIGHT, 0.0, 0.0)
call BlzFrameSetPoint(act10cui, FRAMEPOINT_LEFT, act09cui, FRAMEPOINT_RIGHT, 0.0, 0.0)
call BlzFrameSetPoint(act12cui, FRAMEPOINT_LEFT, act10cui, FRAMEPOINT_RIGHT, 0.0, 0.0)
call BlzFrameSetPoint(act11cui, FRAMEPOINT_LEFT, act12cui, FRAMEPOINT_RIGHT, 0.0, 0.0)

set act01cui = null
set act02cui = null
set act03cui = null
set act04cui = null
set act05cui = null
set act06cui = null
set act07cui = null
set act08cui = null
set act09cui = null
set act10cui = null
set act11cui = null
set act12cui = null

set set01cui = null

endfunction

function SetRandomColorAndTransparencyForUnit takes unit Tunit returns nothing
	local real Real9
	local real Real8
	local real Real5
	local real Real3	
	
    	set Real9 = GetRandomReal(0, 100.00)
   	set Real8 = GetRandomReal(0, 100.00)
  	set Real5 = GetRandomReal(0, 100.00)
   	set Real3 = GetRandomReal(0, 55.00)
    	call SetUnitVertexColorBJ( Tunit, Real9, Real8, Real5, Real3 )	

set Tunit = null
endfunction
Name Type Is Array Initial Value
AAAPoint3 location No
AAAPoint4qtp location No
AAAPoint5Qplace location No
AAAPoint8 location No
AAgroup group No
AAgroup3 group No
AAinteger integer No
AAinteger2 integer No
AAinteger4 integer No
AApoint location No
AApoint2 location No
AApoint3 location No
AApoint4 location No
AAunitTemp1 unit No
AAunitTemp2 unit No
AAunitTemp3 unit No
AAunitTemp4 unit No
ACgroup group No
ACpoint1 location No
ACpoint2 location No
ACunit unit No
AFDamage real Yes
AFDamagePlus real Yes
AFIndex integer No
AFInstancesRunning integer No
AFOwner unit Yes
AFSeconds integer Yes
AFTicks integer Yes
AFUnitGroup group Yes
AIgroupAvatar group No
AIgroupEntRoots group No
AIgroupFirebolt group No
AIgroupLavaSpawn group No
AIgroupPoly group No
AIgroupSerpentW group No
AIgroupShackles group No
AIgroupWatElem group No
AktivPlayers force No
AtkWave2 group No
CenterofMobaSpawn0 location No
CenterofMobaSpawn1 location No
chooser_visiblity_modifieres fogmodifier Yes
chooser_visiblity_modifieres2 fogmodifier Yes
CTickMasterHelperInt integer No
CTickMasterInstancesRunning integer No
CTickMasterIntTicksRemaining integer Yes
CTickMasterIntType integer Yes
CTickMasterIntUnit unit Yes
CTickMasterIntValue01 integer Yes
CTickMasterMaxInstances integer No
CTickMasterTempPoint location No
DecDamage real Yes
DecIndex integer No 0
DecInstancesRunning integer No 0
DecOwner unit Yes
DecTarget unit Yes
DecTicks integer Yes
DSAngle real No
DSConversion real No
DSDmg real No
DSGroup group No
DSTotalDmg real No
ElectrocuteGroup group No
ElectrocuteGroup2 group No
ElectrocuteGroup3 group No
EQCenterPoint location Yes
EQDamage real Yes
EQIndex integer No 0
EQInstanceOpen boolean Yes
EQInstancesRunning integer No 0
EQIntegerr integer No
EQOwnerUnit unit Yes
EQRadius real Yes
EQSeconds integer Yes
EQtempGroup group No
ExorcismD20ChanceCount integer No
ExorcismResetIntAr10 integer Yes
ExorcismResetIntIndex integer No
ExorcismResetTimer timer No
ExorcismResetUnitAr10 unit Yes
FBurstGroup group No
FBurstGroup2 group No
FBurstGroup3 group No
FBurstGroup4 group No
FBurstGroup5 group No
FBurstGroup6 group No
FBurstGroup7 group No
FBurstGroup8 group No
FBurstGroup9 group No
FBurstPoint location No
FBurstPoint2 location No
FBurstPoint3 location No
FBurstPoint4 location No
FBurstPoint5 location No
FBurstPoint6 location No
FBurstPoint7 location No
FBurstPoint8 location No
forgetDialog dialog Yes
forgetGivesWood boolean No true
FPeriodicItems group No
FPeriodicItems2 group No
FPeriodicItems3 group No
FPeriodicItems4 group No
game_end timer No
GameModeLocalItem item No
GDD__Integers integer Yes
GDD__LeftMapGroup group No
GDD__TriggerArray trigger Yes
GDD__UnitArray unit Yes
GDD_Damage real No
GDD_DamagedUnit unit No
GDD_DamageSource unit No
GDD_Event real No
gla_boss_skill0 abilcode Yes
gla_boss_skill1 abilcode Yes
gla_boss_skill2 abilcode Yes
gla_boss_skill3 abilcode Yes
gla_boss_upgrades techcode Yes R000
glad_and_race_heros group No
glad_bonusfromtablet integer No
Glad_BossArray unitcode Yes
Glad_BossUnit unit No
glad_free_bounty timer No
glad_free_bounty_count integer No 0
glad_Level integer No 1
glad_next_scroll_index integer No 0
Glad_NumberArray integer Yes 1
Glad_SupNumberArray integer Yes 0
Glad_SupUnitArray unitcode Yes
Glad_Timer_BossLevel timer No
Glad_Timer_NextLevel timer No
Glad_UnitArray unitcode Yes
Glad_unitgroup group No
gladboss1timer timer No
gladbosslvlint integer No
gladDiggingInt integer No
gladDiggingUnit unit No
GladHcEnabled boolean No
gladiatorRandomMap boolean No true
gladiatorRandomSpawn boolean No true
gladIsland2NumberofTps integer No
gladisWon boolean No false
gladLivesLeft integer No
gladMapNumber integer No 1
GladMaxPudg integer No
GladMythicEnabled boolean No
gladMythicIntUnitNumber integer No
gladNoTpBool boolean No false
gladrefreshtimer timer No
gladWarpPortalOverride boolean No
Group group No
Group2 group No
Group3 group No
groupDecom group No
GroupMA01 group No
groupNoTeleportWarp group No
HATable hashtable No
HeroType unitcode No Hamg
IceCreamRandomRoll100 integer No
Integer integer No
Integer10 integer No
Integer11 integer No
Integer12 integer No
Integer13AIRandom integer No
Integer14 integer No
Integer15Cyclone integer No
Integer16HshotCrit integer No
Integer17 integer No
Integer18 integer No
Integer19 integer No
Integer19SpcRevive integer No
Integer2 integer No
Integer20randomroll integer No
Integer3 integer No
Integer4 integer No
Integer5 integer No
Integer5SealingF integer No
Integer6 integer No
Integer6SealingF integer No
Integer7 integer No
Integer8NecroC integer No
Integer9 integer No
IntegerAIRunningTeam integer No
IntegerDecom integer No
Integerr2Decom integer No
Integerr3 integer No
IntItemRandomRoll integer No
IntItemRandomRoll2 integer No
IntItemRandomRoll3 integer No
IntItemRandomRoll4 integer No
IntItemRandomRoll5 integer No
IntItemRandomRoll6 integer No
IntItemRandomRoll7 integer No
IntRandomRoll100 integer No
IntWeatherRainIntensify integer No
IntWeatherRoll integer No
Isl2TpTimer timer No
ItemArray itemcode Yes
itemLeechTempUnit unit No
ItemType itemcode No
KB_Angle real Yes
KB_Casters unit Yes
KB_CountBuffs integer No
KB_DestroyTrees boolean Yes
KB_EffectCounter integer Yes
KB_EffectCounter2 integer Yes
KB_Effects_1 string Yes
KB_Effects_2 string Yes
KB_GeneralIntegers integervar Yes
KB_JumpEffReal real Yes
KB_JumpOn boolean Yes
KB_KnockbackedUnits group No
KB_Levels integer Yes
KB_MaxDistance real Yes
KB_ReachedDistance real Yes
KB_ReducedReal real No
KB_ReduceSpeedReal real Yes
KB_SpecificSpeed real Yes
KB_StartPositions location Yes
KB_TempPoint location Yes
KB_TempReal real No
KB_TotalKnockUnits integer No
KB_Units unit Yes
KBA_Caster unit No
KBA_DestroyTrees boolean No
KBA_DistancePerLevel real No
KBA_Level integer No
KBA_SpecialEffects string Yes
KBA_Speed real No
KBA_StartingPosition location No
KBA_TargetUnit unit No
LichCurHp real No
LichTargHp real No
local_row integer No
localRegion rect No
localused_destructible destructable No
localused_int1 integer No
localused_int2 integer No
localused_int3_wood integer No
localused_int4 integer No
localused_player1 player No
localused_player2 player No
localused_player3 player No
localused_playergroup force No
localused_real real No
localused_Skill abilcode No
localused_unit1 unit No
localused_unitgroup group No
LoopInt integer No
LSIndexForPlayer integer Yes
LSWoodForPlayer integer Yes
MBdamage real Yes
MBinstance integer No
MBintRunning integer No
MBL lightning Yes
MBlevel integer Yes
MBLi lightning No
MBowner unit Yes
MBPc location No
MBPt location No
MBstacks integer Yes
MBtarget unit Yes
MBtargetPoint location Yes
micro_arenaSpawnPointA rect Yes
micro_arenaSpawnPointB rect Yes
micro_Base rect Yes
micro_chests unit Yes
micro_current_round integer No 1
micro_fights integer No
micro_items itemcode Yes
micro_number_of_rounds integer No 10
micro_playerCount integer No 0
micro_playerList player Yes
micro_playerRank integer Yes
micro_playerScore integer Yes
micro_price itemcode No
micro_prices itemcode Yes
micro_prices_size integer No 10
micro_rankToString string Yes
micro_timer_fightinhint timer No
micro_timer_nextfight timer No
micro_Units_Of_Player group Yes
micro_UnitsToKill group Yes
Moba_BossUnit unit No
Moba_castle_of_team unit Yes
moba_heroes group Yes
moba_team force Yes
MobaEntrenchmentOn boolean No
MobaEntrGroupDestroy group Yes
MobaHillDealers unit Yes
MobaIntCreepSpawn01 integer No
MobaMiniB unit No
MobaMysteriousGoldPack item No
MobaReviveTimer timer Yes
MobaReviveUnit unit Yes
MobaUGBot0 group No
MobaUGBot1 group No
MobaUGIdle0 group No
MobaUGIdle1 group No
MobaUGJungle group No
MobaUGMid0 group No
MobaUGMid1 group No
MobaUGTop0 group No
MobaUGTop1 group No
mobaUnitTemp unitcode No
OSPIntData01 integer Yes
OSPIntData02 integer Yes
OSPIntHelperInt integer No 0
OSPIntInstancesOn integer No 0
OSPUnitData01 unit Yes
pick_hint_timer timer No
placeTreesNumber integer No
placeTreesPoint location No
placeTreesRegion rect No
placeTreesType destructablecode No
Player_HeroType unitcode Yes
PlayerGroupRecommended force No
playerIdToColorCode string Yes
Players_training force No
Players_who_have_to_choose force No
PlayList string No
Point location No
Point10 location No
Point11 location No
Point12 location No
Point12B location No
Point12C location No
Point13 location No
Point14 location No
Point15 location No
Point2 location No
Point3 location No
Point4 location No
Point5NecroC location No
Point6 location No
Point7AIBotsOrders location No
Point8 location No
Point8Sa location No
Point8SaT location No
Point9 location No
Point9Sa location No
Point_Copy location No
PointAmbush location No
PointAmbushB location No
PointDecom location No
PointDS location No
PointMoba location No
PointMobaHQ0 location No
PointMobaHQ1 location No
ProfessionInt integer No
ProfessionTempPlayerID integer No
QUnits unit Yes
race_bonus_wood integer No 200
race_cheap_items itemcode Yes
race_goal_of_team rect Yes
race_item_wood_value integer Yes
race_rocks group Yes
race_start_aera_of_team rect Yes
race_supply_fear_of_team integer Yes
race_supply_of_team unit Yes
race_team force Yes
race_treants unitcode Yes
RaceBotsAIBuyValue integer No
RaceBotsAIIntPause integer No
RaceBotsAIItemProgress integer Yes
RaceBotsAIOn boolean No
RaceBotsAIPoint location No
RaceBotsAIPointB location No
RaceBotsAIProgress integer Yes
RaceBotsAIReal real No
RaceBotsAITempG group No
RaceDoubleXpTimer timer No
RaceDoubleXpTW timerdialog No
RaceHcWards timer No
RACEHEROIC boolean No false
raceOverrideReviveMethod boolean No false
RaceSeedInt integer No
raceShortModeOn boolean No
RaceSpawn1 unitcode No
RaceSpawn1H unitcode No
RaceSpawn1Hint integer No
RaceSpawn1int integer No
RaceSpawn2 unitcode No
RaceSpawn2H unitcode No
RaceSpawn2Hint integer No
RaceSpawn2int integer No
RaceSpawn3 unitcode No
RaceSumGminiboss unit Yes
RaceT0AIBotsHeroes group No
RaceT1AIBotsHeroes group No
Real real No
Real10 real No
Real11 real No
Real12SupWatElem real No
Real2 real No
Real3 real No
Real4GDD real No
Real5 real No
Real6Gdd real No
Real7GddAmplify real No
Real8 real No
Real9 real No
RealInSk01 real No
RHSpawnTimer4 timer No
RHSpawnTimer4L timer No
rpgPointTeam0Start location No
rpgPointTeam1Start location No
rpgTempInteger integer No
rpgTempInteger2 integer No
rpgTempInteger3 integer No
rpgTempPoint location No
RSpawnTimer1 timer No
RSpawnTimer2 timer No
RSpawnTimer3 timer No
Sample_Group group No
Sample_Point location No
SealingFTimer timer No
SpecialEffectType1 string No
SpecsMainHeroOf unit Yes
SpecsPoints12 location Yes
SpecsTempPlayer player No
SpecsTempPlayerID integer No
SpecsTempPoint location No
SpecsTempUnit unit No
Spell_Power_Max integer Yes
SpellArray abilcode Yes
SpellArray_Size integer No 165
SpellArrayEvoInt integer Yes
SpellEventAbility abilcode Yes
SpellEventHash hashtable No
SpellEventTrigger trigger Yes
SSeSGlobalTransparencyModifier real No 30.00
StartTigger trigger No
TeamBattleBoolStarted boolean No false
TeamBattlePoints integer Yes
TeamBattleRaceSingleP boolean No
TeamBattleT0heroes group No
TeamBattleT0heroesMax group No
TeamBattleT1heroes group No
TeamBattleT1heroesMax group No
TeamBattleTimer timer No
tempGroup group No
test_game boolean No false
Timer1015Mins timer No
Timer_gamestart timer No
TimerMobaGoldPackSpawn timer No
TimerMobaJungleSpawn timer No
TimerMobaMinionSpawn timer No
TimerMobaMinionSpawnFirst timer No
TimerWeatherEnd timer No
TimerWeatherRoll timer No
TrainingCreepGroup group No
TrainingNext integer No
TrainingOn boolean No
TWindMobaSoldiers timerdialog No
TWindRevive timerdialog Yes
unitTemp unit No
unitTemp2 unit No
unitTemp2SealingF unit No
unitTemp3 unit No
unitTemp4 unit No
unitTemp5 unit No
unitTemp6 unit No
unitTemp7 unit No
unitTempDecom unit No
WeatherEffectVariable weathereffect No
WeatherRegion rect No
XcombTempPlayerID integer No
XcombTempPlayerID2 integer No
XcombTempPlayerID3 integer No
race
  Events
    Unit - A unit enters start_race <gen>
  Conditions
  Actions
    Destructible - Kill Foot Switch 0323 <gen>
    Sound - Play BattleNetDoorsStereo2 <gen>
    Trigger - Run disable_others <gen> (checking conditions)
    Wait 1.00 game-time seconds
    Unit - Remove (Entering unit) from the game
    Trigger - Turn on race_start <gen>
    Set VariableSet StartTigger = race_start <gen>
    Trigger - Add create_chooser <gen> to the trigger queue (Checking conditions)
race heroic
  Events
    Unit - A unit enters start_race_heroic <gen>
  Conditions
  Actions
    -------- Race heroic is a copy of race (almost exact ,,,do not modify a lot) --------
    Set VariableSet RACEHEROIC = True
    Destructible - Kill Foot Switch 2083 <gen>
    Sound - Play BattleNetDoorsStereo2 <gen>
    Trigger - Run disable_others <gen> (checking conditions)
    Wait 1.00 game-time seconds
    Unit - Remove (Entering unit) from the game
    Trigger - Turn on race_start <gen>
    Set VariableSet StartTigger = race_start <gen>
    Trigger - Add create_chooser <gen> to the trigger queue (Checking conditions)
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
race Option Short Mode
  Events
    Unit - A unit enters race_Short_Mode <gen>
  Conditions
  Actions
    Trigger - Turn off (This trigger)
    Sound - Play RotatingBladeHit <gen>
    Environment - Change terrain type at (Center of race_Short_Mode <gen>) to Sunken Ruins - Large Bricks using variation -1 in an area of size 1 and shape Circle
    Animation - Change Circle of Power Option 0524 <gen>'s vertex coloring to (80.00%, 50.00%, 80.00%) with 30.00% transparency
    Animation - Change Circle of Power Option 0524 <gen>'s animation speed to 0.00% of its original speed
    Set VariableSet raceShortModeOn = True
gladiator
  Events
    Unit - A unit enters start_gladiator <gen>
  Conditions
  Actions
    Destructible - Kill Foot Switch 0001 <gen>
    Sound - Play BattleNetDoorsStereo2 <gen>
    Trigger - Run disable_others <gen> (checking conditions)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        gladiatorRandomSpawn Equal to True
      Then - Actions
        Trigger - Run gladiator_Init_Randomize_Spawn <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        gladiatorRandomMap Equal to True
      Then - Actions
        Trigger - Run gladiator_Init_Randomize_Map <gen> (checking conditions)
      Else - Actions
    Wait 1.00 game-time seconds
    Unit - Remove (Entering unit) from the game
    Trigger - Turn on glad_start <gen>
    Set VariableSet StartTigger = glad_start <gen>
    Set VariableSet GladHcEnabled = False
    Trigger - Add create_chooser <gen> to the trigger queue (Checking conditions)
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Option Map 1
  Events
    Unit - A unit enters start_glad_island_1 <gen>
  Conditions
  Actions
    Trigger - Turn off gladiator_Option_Map_1 <gen>
    Trigger - Turn off gladiator_Option_Map_2 <gen>
    Trigger - Turn off gladiator_Option_Map_3 <gen>
    Sound - Play RotatingBladeHit <gen>
    Environment - Change terrain type at (Center of start_glad_island_1 <gen>) to Sunken Ruins - Large Bricks using variation -1 in an area of size 1 and shape Circle
    Animation - Change Circle of Power Option 0408 <gen>'s vertex coloring to (80.00%, 50.00%, 80.00%) with 30.00% transparency
    Animation - Change Circle of Power Option 0408 <gen>'s animation speed to 0.00% of its original speed
    Set VariableSet gladiatorRandomMap = False
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Option Map 2
  Events
    Unit - A unit enters start_glad_island_2 <gen>
  Conditions
  Actions
    Trigger - Turn off gladiator_Option_Map_1 <gen>
    Trigger - Turn off gladiator_Option_Map_2 <gen>
    Trigger - Turn off gladiator_Option_Map_3 <gen>
    Sound - Play RotatingBladeHit <gen>
    Environment - Change terrain type at (Center of start_glad_island_2 <gen>) to Sunken Ruins - Large Bricks using variation -1 in an area of size 1 and shape Circle
    Animation - Change Circle of Power Option 0296 <gen>'s vertex coloring to (80.00%, 50.00%, 80.00%) with 30.00% transparency
    Animation - Change Circle of Power Option 0296 <gen>'s animation speed to 0.00% of its original speed
    Trigger - Run gladiator_Map_2_EI <gen> (checking conditions)
    Set VariableSet gladiatorRandomMap = False
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Option Map 3
  Events
    Unit - A unit enters start_glad_BC <gen>
  Conditions
  Actions
    Trigger - Turn off gladiator_Option_Map_1 <gen>
    Trigger - Turn off gladiator_Option_Map_2 <gen>
    Trigger - Turn off gladiator_Option_Map_3 <gen>
    Sound - Play RotatingBladeHit <gen>
    Environment - Change terrain type at (Center of start_glad_BC <gen>) to Sunken Ruins - Large Bricks using variation -1 in an area of size 1 and shape Circle
    Animation - Change Circle of Power Option 0409 <gen>'s vertex coloring to (80.00%, 50.00%, 80.00%) with 30.00% transparency
    Animation - Change Circle of Power Option 0409 <gen>'s animation speed to 0.00% of its original speed
    Trigger - Run gladiator_Map_3_BC <gen> (checking conditions)
    Set VariableSet gladiatorRandomMap = False
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Option Alternate Spawn
  Events
    Unit - A unit enters start_glad_Alternate_Spawn <gen>
  Conditions
  Actions
    Trigger - Turn off gladiator_Option_Alternate_Spawn <gen>
    Trigger - Turn off gladiator_Option_Standard_Spawn <gen>
    Sound - Play RotatingBladeHit <gen>
    Environment - Change terrain type at (Center of start_glad_Alternate_Spawn <gen>) to Sunken Ruins - Large Bricks using variation -1 in an area of size 1 and shape Circle
    Animation - Change Circle of Power Option 0281 <gen>'s vertex coloring to (80.00%, 50.00%, 80.00%) with 30.00% transparency
    Animation - Change Circle of Power Option 0281 <gen>'s animation speed to 0.00% of its original speed
    Trigger - Run gladiator_Alternate_Spawn <gen> (checking conditions)
    Set VariableSet gladiatorRandomSpawn = False
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Option Standard Spawn
  Events
    Unit - A unit enters start_glad_Standard_Spawn <gen>
  Conditions
  Actions
    Trigger - Turn off gladiator_Option_Alternate_Spawn <gen>
    Trigger - Turn off gladiator_Option_Standard_Spawn <gen>
    Sound - Play RotatingBladeHit <gen>
    Environment - Change terrain type at (Center of start_glad_Standard_Spawn <gen>) to Sunken Ruins - Large Bricks using variation -1 in an area of size 1 and shape Circle
    Animation - Change Circle of Power Option 0410 <gen>'s vertex coloring to (80.00%, 50.00%, 80.00%) with 30.00% transparency
    Animation - Change Circle of Power Option 0410 <gen>'s animation speed to 0.00% of its original speed
    Set VariableSet gladiatorRandomSpawn = False
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Option No Tp
  Events
    Unit - A unit enters start_glad_NoTp <gen>
  Conditions
  Actions
    Trigger - Turn off (This trigger)
    Sound - Play RotatingBladeHit <gen>
    Environment - Change terrain type at (Center of start_glad_NoTp <gen>) to Sunken Ruins - Large Bricks using variation -1 in an area of size 1 and shape Circle
    Animation - Change Circle of Power Option 0037 <gen>'s vertex coloring to (80.00%, 50.00%, 80.00%) with 30.00% transparency
    Set VariableSet gladNoTpBool = True
Randomization options can be changed later via Gladiator additional options.
gladiator Init Randomize Map
  Events
  Conditions
  Actions
    -------- Randomize Map --------
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        glad_Level Less than 2
      Then - Actions
        Set VariableSet Integer = (Random integer number between 1 and 3)
      Else - Actions
        Set VariableSet Integer = (Random integer number between 1 and 4)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        Integer Equal to 1
      Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            gladMapNumber Not equal to 1
          Then - Actions
            Trigger - Run gladiator_Map_1_WI_ReRoll <gen> (checking conditions)
          Else - Actions
      Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            Integer Equal to 2
          Then - Actions
            Trigger - Run gladiator_Map_2_EI <gen> (checking conditions)
          Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                Integer Equal to 3
              Then - Actions
                Trigger - Run gladiator_Map_3_BC <gen> (checking conditions)
              Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    Integer Equal to 4
                  Then - Actions
                    Trigger - Run gladiator_Map_4 <gen> (checking conditions)
                  Else - Actions
Randomization options can be changed later via Gladiator additional options.
gladiator Init Randomize Spawn
  Events
  Conditions
  Actions
    Set VariableSet Integer = (Random integer number between 1 and 3)
    -------- Randomize Unit Pool --------
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        Integer Equal to 2
      Then - Actions
        Trigger - Run gladiator_Alternate_Spawn <gen> (checking conditions)
      Else - Actions
        Trigger - Run set_glad_units <gen> (checking conditions)
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Alternate Spawn
  Events
  Conditions
  Actions
    Trigger - Turn on set_glad_units_Alternate <gen>
    Trigger - Run set_glad_units_Alternate <gen> (checking conditions)
    Trigger - Turn off set_glad_units <gen>
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Map 4
  Events
  Conditions
  Actions
    -------- Move All Gladiator Content to Lands of C --------
    Set VariableSet gladMapNumber = 4
    Set VariableSet Point4 = (Center of Moba_UG_TopC <gen>)
    Region - Center gladiator_spawnpoint_NW <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Moba_start_t_1_Heroes <gen>)
    Region - Center gladiator_spawnpoint_NE <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Moba_start_team_0 <gen>)
    Region - Center gladiator_spawnpoint_SW <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Moba_UG_BotC <gen>)
    Region - Center gladiator_spawnpoint_SE <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Moba_T1_Perimeter1 <gen>)
    Region - Center glad_boss_10_summon__1 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of MobaRiverCenterRight <gen>)
    Region - Center glad_boss_10_summon__2 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Moba_T0_Perimeter1 <gen>)
    Region - Center glad_boss_10_summon__3 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of MobaRiverCenterLeft <gen>)
    Region - Center glad_boss_10_summon__4 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Moba_Playable_Area <gen>)
    Region - Center gladiator_item_drop <gen> on Point4
    Region - Center gladiator_base <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Moba_Playable_Area <gen>)
    Region - Center gladiator_Lich_Tp_zone <gen> on Point4
    Region - Center glad_visiblity_area <gen> on Point4
    Region - Center gladiator_domain <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Trigger - Run gladiator_map_4_first_init <gen> (checking conditions)
gladiator map 4 first init
  Events
  Conditions
  Actions
    Wait 0.20 game-time seconds
    Trigger - Turn off (This trigger)
    Set VariableSet Point4 = (Center of Moba_Building_Tm1_HQ <gen>)
    Unit - Create 1.Fountain of Health for Neutral Passive at Point4 facing Default building facing degrees
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Moba_Building_Tm0_HQ <gen>)
    Unit - Create 1.Fountain of Mana for Neutral Passive at Point4 facing Default building facing degrees
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of MobaMainBossTp2 <gen>)
    Unit - Create 1.Greater Voidwalker for Neutral Hostile at Point4 facing Default building facing degrees
    Custom script: call RemoveLocation(udg_Point4)
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Neutral Building - Enable Mysterious Portal 0460 <gen>
    Unit - Unhide Mysterious Portal 0460 <gen>
    Set VariableSet Point4 = (Center of Moba_Entr_Shop_Tm0 <gen>)
    Unit - Create 1.Ancient Siege Golem for Neutral Hostile at Point4 facing (Random angle) degrees
    Custom script: call RemoveLocation(udg_Point4)
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Set VariableSet Point4 = (Center of Moba_Entr_Shop_Tm1 <gen>)
    Unit - Create 1.Ancient Siege Golem for Neutral Hostile at Point4 facing (Random angle) degrees
    Custom script: call RemoveLocation(udg_Point4)
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Set VariableSet Point4 = (Center of Moba_Top_Forest <gen>)
    Unit - Create 1.Heroic Protector for Neutral Hostile at Point4 facing Default building facing degrees
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Moba_Bot_Forest <gen>)
    Unit - Create 1.Heroic Protector for Neutral Hostile at Point4 facing Default building facing degrees
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Point(-11200.00, -680.00))
    Unit - Create 1.Assassin for Neutral Hostile at Point4 facing Default building facing degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Custom script: call RemoveLocation(udg_Point4)
    Hero - Set (Last created unit) Hero-level to 9, Hide level-up graphics
    Hero - Disable experience gain for (Last created unit).
    Hero - Create Ring of Protection +3 and give it to (Last created unit)
    Item - Make (Last created item) Drop from Heroes upon death
    Unit - Add Critical Strike (EFY) to (Last created unit)
    Unit - Set level of Critical Strike (EFY) for (Last created unit) to 3
    Hero - Create Cloak of Agile Spellshield and give it to (Last created unit)
    Unit - Add Avatar (YXT) to (Last created unit)
    Unit - Set level of Avatar (YXT) for (Last created unit) to 3
    Set VariableSet Point4 = (Center of MobaMainBoss <gen>)
    Unit - Create 1.Will o Wisp (boss 8) for Neutral Hostile at Point4 facing Default building facing degrees
    Unit - Create 1.Will o Wisp (boss 8) for Neutral Hostile at Point4 facing Default building facing degrees
    Unit - Create 1.Will o Wisp (boss 8) for Neutral Hostile at Point4 facing Default building facing degrees
    Unit - Create 1.Will o Wisp (boss 8) for Neutral Hostile at Point4 facing Default building facing degrees
    Unit - Create 1.Queen of Suffering for Neutral Hostile at Point4 facing Default building facing degrees
    Item - Create Gem of True Seeing at Point4
    Set VariableSet GameModeLocalItem = (Last created item)
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Point(-3270.00, -8150.00))
    Unit - Create 1.Enraged Jungle Stalker for Neutral Hostile at Point4 facing Default building facing degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Point(-800.00, -11350.00))
    Unit - Create 1.Bronze Dragon for Neutral Hostile at Point4 facing Default building facing degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Custom script: call RemoveLocation(udg_Point4)
gladiator map 3 first init
  Events
  Conditions
  Actions
    Wait 0.20 game-time seconds
    Trigger - Turn off (This trigger)
    Set VariableSet Point4 = (Point(3200.00, 15500.00))
    Unit - Create 1.Lightning Revenant for Neutral Hostile at Point4 facing (Random angle) degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Unit - Create 1.Lightning Revenant for Neutral Hostile at Point4 facing (Random angle) degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Point(4980.00, 12511.00))
    Unit - Create 1.Bandit Lord for Neutral Hostile at Point4 facing (Random angle) degrees
    Custom script: call RemoveLocation(udg_Point4)
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Set VariableSet Point4 = (Point(4555.00, 12340.00))
    Unit - Create 1.Goblin Land Mine for Neutral Hostile at Point4 facing (Random angle) degrees
    Custom script: call RemoveLocation(udg_Point4)
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Set VariableSet Point4 = (Point(4870.00, 15950.00))
    Unit - Create 1.Mana Burning Treant (race) for Neutral Hostile at Point4 facing (Random angle) degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Unit - Create 1.Poison Treant for Neutral Hostile at Point4 facing (Random angle) degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Unit - Create 1.Corrupted Treant for Neutral Hostile at Point4 facing Default building facing degrees
    Custom script: call RemoveLocation(udg_Point4)
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Set VariableSet Point4 = (Point(4050.00, 14620.00))
    Unit - Create 1.Fire Panda for Neutral Hostile at Point4 facing (Random angle) degrees
    Custom script: call RemoveLocation(udg_Point4)
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Unit - Remove classification of Summoned from (Last created unit)
    Set VariableSet Point4 = (Point(5050.00, 11480.00))
    Unit - Create 1.Archmage for Neutral Hostile at Point4 facing Default building facing degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Custom script: call RemoveLocation(udg_Point4)
    Hero - Set (Last created unit) Hero-level to 6, Hide level-up graphics
    Hero - Disable experience gain for (Last created unit).
    Hero - Set Name of (Last created unit) to Unknown Archmage
    Hero - Create Ring of the Archmagi (version 3) and give it to (Last created unit)
    Item - Make (Last created item) Drop from Heroes upon death
    Unit - Add Sealing Flames (FXT) to (Last created unit)
    Unit - Add Sea Throw (WWX) to (Last created unit)
    Unit - Set level of Sea Throw (WWX) for (Last created unit) to 3
    Unit - Add Control Magic (SFY) to (Last created unit)
    Unit - Set level of Control Magic (SFY) for (Last created unit) to 2
    Set VariableSet Point4 = (Point(2500.00, 13100.00))
    Unit - Create 1.Death Revenant for Neutral Hostile at Point4 facing (Random angle) degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Set VariableSet Point4 = (Point(2600.00, 12600.00))
    Unit - Create 1.Infernal for Neutral Hostile at Point4 facing (Random angle) degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Point(3000.00, 12250.00))
    Unit - Create 1.Infernal for Neutral Hostile at Point4 facing (Random angle) degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Point(3380.00, 12720.00))
    Unit - Create 1.Infernal for Neutral Hostile at Point4 facing (Random angle) degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Point(1900.00, 12500.00))
    Unit - Create 1.Eredar Warlock for Neutral Hostile at Point4 facing 25.00 degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Point(1800.00, 12300.00))
    Unit - Create 1.Eredar Warlock for Neutral Hostile at Point4 facing 25.00 degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Point(1750.00, 12250.00))
    Unit - Create 1.Dreadlord for Neutral Hostile at Point4 facing 25.00 degrees
    Unit Group - Add (Last created unit) to groupNoTeleportWarp
    Hero - Set (Last created unit) Hero-level to 12, Hide level-up graphics
    Hero - Disable experience gain for (Last created unit).
    Hero - Set Name of (Last created unit) to Lord ScaryS
    Custom script: call RemoveLocation(udg_Point4)
    Unit - Add Purify (LYX) to (Last created unit)
    Unit - Add Meteor Clash (EDX) to (Last created unit)
    Unit - Add Sleep (WDD) to (Last created unit)
    Unit - Set level of Sleep (WDD) for (Last created unit) to 3
    Unit - Add Vampiric Aura (WDT) to (Last created unit)
    Unit - Set level of Vampiric Aura (WDT) for (Last created unit) to 5
    Unit - Add Red Lightning (SDX) to (Last created unit)
    Unit - Set level of Red Lightning (SDX) for (Last created unit) to 5
    Unit - Add Control Magic (SFY) to (Last created unit)
    Unit - Set level of Control Magic (SFY) for (Last created unit) to 2
    Hero - Create Brutalizer and give it to (Last created unit)
    Hero - Create Titanforged Shield and give it to (Last created unit)
    Unit - Set Max HP of (Last created unit) to ((Max HP of (Last created unit)) + 300)
    Hero - Create Cloak of Agile Spellshield and give it to (Last created unit)
    Hero - Create Tome of Power and give it to (Last created unit)
    Item - Make (Last created item) Drop from Heroes upon death
    Hero - Create |c009370D8Warp Portal Shard|r and give it to (Last created unit)
    Item - Make (Last created item) Drop from Heroes upon death
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Map 3 BC
  Events
  Conditions
  Actions
    -------- Move All Gladiator Content to Blighted City --------
    Set VariableSet gladMapNumber = 3
    Set VariableSet Point4 = (Center of BlightedCitySpawnpoint_1_NW <gen>)
    Region - Center gladiator_spawnpoint_NW <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of BlightedCitySpawnpoint_2_NE <gen>)
    Region - Center gladiator_spawnpoint_NE <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of BlightedCitySpawnpoint_3_SW <gen>)
    Region - Center gladiator_spawnpoint_SW <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of BlightedCitySpawnpoint_4_SE <gen>)
    Region - Center gladiator_spawnpoint_SE <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of BlightedCity_little_point_NE <gen>)
    Region - Center glad_boss_10_summon__1 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of BlightedCity_little_point_SE <gen>)
    Region - Center glad_boss_10_summon__2 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of BlightedCity_little_point_SW <gen>)
    Region - Center glad_boss_10_summon__3 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Random point in BlightedCity_little_point_NW <gen>)
    Region - Center glad_boss_10_summon__4 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Blighted_City_Center <gen>)
    Region - Center gladiator_item_drop <gen> on Point4
    Region - Center gladiator_base <gen> on Point4
    Region - Center gladiator_Lich_Tp_zone <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Blighted_City_Playable_Area <gen>)
    Region - Center glad_visiblity_area <gen> on Point4
    Region - Center gladiator_domain <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Trigger - Run gladiator_map_3_first_init <gen> (checking conditions)
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Map 2 EI
  Events
  Conditions
  Actions
    -------- Move All Gladiator Content to Sunken Island --------
    Set VariableSet gladMapNumber = 2
    Set VariableSet Point4 = (Random point in Island_2_Spawnpoint_1_NW <gen>)
    Region - Center gladiator_spawnpoint_NW <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Random point in Island_2_Spawnpoint_2_NE <gen>)
    Region - Center gladiator_spawnpoint_NE <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Random point in Island_2_Spawnpoint_3_SW <gen>)
    Region - Center gladiator_spawnpoint_SW <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Random point in Island_2_Spawnpoint_4_SE <gen>)
    Region - Center gladiator_spawnpoint_SE <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Random point in Island_2_little_point_NE <gen>)
    Region - Center glad_boss_10_summon__1 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Random point in Island_2_little_point_SE <gen>)
    Region - Center glad_boss_10_summon__2 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Random point in Island_2_little_point_SW <gen>)
    Region - Center glad_boss_10_summon__3 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Random point in Island_2_little_point_NW <gen>)
    Region - Center glad_boss_10_summon__4 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_2_Center <gen>)
    Region - Center gladiator_item_drop <gen> on Point4
    Region - Center gladiator_base <gen> on Point4
    Region - Center gladiator_Lich_Tp_zone <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_2_Playable_Area <gen>)
    Region - Center glad_visiblity_area <gen> on Point4
    Region - Center gladiator_domain <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
Take note that moving Region via GUI does not work when A unit enters region or Leaves region events are used as this type of event creates separate local region variable from region accesible only with vJass.
gladiator Map 1 WI ReRoll
  Events
  Conditions
  Actions
    -------- Move All Gladiator Content to Blighted City --------
    Set VariableSet gladMapNumber = 1
    Set VariableSet Point4 = (Center of Island_1_Spawnpoint_1_NW_Copy <gen>)
    Region - Center gladiator_spawnpoint_NW <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_1_Spawnpoint_2_NE_Copy <gen>)
    Region - Center gladiator_spawnpoint_NE <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_1_Spawnpoint_3_SW_Copy <gen>)
    Region - Center gladiator_spawnpoint_SW <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_1_Spawnpoint_4_SE_Copy <gen>)
    Region - Center gladiator_spawnpoint_SE <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_1_little_point_NE_Copy <gen>)
    Region - Center glad_boss_10_summon__1 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_1_little_point_SE_Copy <gen>)
    Region - Center glad_boss_10_summon__2 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_1_little_point_SW_Copy <gen>)
    Region - Center glad_boss_10_summon__3 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_1_little_point_NW_Copy <gen>)
    Region - Center glad_boss_10_summon__4 <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_1_Center_Copy <gen>)
    Region - Center gladiator_item_drop <gen> on Point4
    Region - Center gladiator_base <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
    Set VariableSet Point4 = (Center of Island_1_Playable_Area_Copy <gen>)
    Region - Center gladiator_Lich_Tp_zone <gen> on Point4
    Region - Center glad_visiblity_area <gen> on Point4
    Region - Center gladiator_domain <gen> on Point4
    Custom script: call RemoveLocation(udg_Point4)
gladiatorAdOptions
  Events
    Unit - A unit enters gladiatorAdOptions <gen>
  Conditions
  Actions
    Unit - Move (Triggering unit) instantly to (Center of gladiator_choose_mode <gen>)
    Camera - Pan camera for (Owner of (Triggering unit)) to (Center of gladiator_choose_mode <gen>) over 0 seconds
gladiatorAdOptionsEnd
  Events
    Unit - A unit enters gladiatorAdOptionsEnd <gen>
  Conditions
  Actions
    Unit - Move (Triggering unit) instantly to (Center of Start_area <gen>)
    Camera - Pan camera for (Owner of (Triggering unit)) to (Center of Start_area <gen>) over 0 seconds
training
  Events
    Unit - A unit enters start_training <gen>
  Conditions
  Actions
    Sound - Play GoodJob <gen>
    Set VariableSet TrainingOn = True
    Set VariableSet forgetGivesWood = True
    Environment - Change terrain type at (Center of start_training <gen>) to Icecrown Glacier - Rune Bricks Cliff using variation -1 in an area of size 1 and shape Circle
    Animation - Change Circle of Power Training 0293 <gen>'s vertex coloring to (80.00%, 50.00%, 80.00%) with 30.00% transparency
    Animation - Change Circle of Power Training 0293 <gen>'s animation speed to 0.00% of its original speed
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        gladiatorRandomMap Equal to True
      Then - Actions
        Trigger - Run gladiator_Init_Randomize_Map <gen> (checking conditions)
      Else - Actions
    Trigger - Turn off (This trigger)
gladiator Hc
  Events
    Unit - A unit enters start_gladiator_Hc <gen>
  Conditions
  Actions
    Destructible - Kill Foot Switch 2122 <gen>
    Sound - Play BattleNetDoorsStereo2 <gen>
    Trigger - Run disable_others <gen> (checking conditions)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        gladiatorRandomSpawn Equal to True
      Then - Actions
        Trigger - Run gladiator_Init_Randomize_Spawn <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        gladiatorRandomMap Equal to True
      Then - Actions
        Trigger - Run gladiator_Init_Randomize_Map <gen> (checking conditions)
      Else - Actions
    Wait 1.00 game-time seconds
    Unit - Remove (Entering unit) from the game
    Trigger - Turn on glad_start <gen>
    Set VariableSet StartTigger = glad_start <gen>
    Set VariableSet GladHcEnabled = True
    Trigger - Add create_chooser <gen> to the trigger queue (Checking conditions)
    Skip remaining actions
    Set VariableSet forgetGivesWood = False
gladiator Mythic
  Events
    Unit - A unit enters start_gladiator_Mythic <gen>
  Conditions
  Actions
    Destructible - Kill Foot Switch 4416 <gen>
    Sound - Play BattleNetDoorsStereo2 <gen>
    Trigger - Run disable_others <gen> (checking conditions)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        gladiatorRandomSpawn Equal to True
      Then - Actions
        Trigger - Run gladiator_Init_Randomize_Spawn <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        gladiatorRandomMap Equal to True
      Then - Actions
        Trigger - Run gladiator_Init_Randomize_Map <gen> (checking conditions)
      Else - Actions
    Wait 1.00 game-time seconds
    Unit - Remove (Entering unit) from the game
    Trigger - Turn on glad_start <gen>
    Set VariableSet StartTigger = glad_start <gen>
    Set VariableSet GladHcEnabled = True
    Set VariableSet GladMythicEnabled = True
    Trigger - Add create_chooser <gen> to the trigger queue (Checking conditions)
micro wars
  Events
    Unit - A unit enters start_micro_wars <gen>
  Conditions
  Actions
    Set VariableSet micro_number_of_rounds = 15
    Destructible - Kill Foot Switch 0176 <gen>
    Sound - Play BattleNetDoorsStereo2 <gen>
    Trigger - Run disable_others <gen> (checking conditions)
    Wait 1.00 game-time seconds
    Unit - Remove (Entering unit) from the game
    Trigger - Turn on micro_start <gen>
    Set VariableSet StartTigger = micro_start <gen>
    Set VariableSet forgetGivesWood = True
    Trigger - Add create_chooser <gen> to the trigger queue (Checking conditions)
arenas 3 rounds
  Events
    Unit - A unit enters start_micro_wars_3_rounds <gen>
  Conditions
  Actions
    Set VariableSet micro_number_of_rounds = 5
    Destructible - Kill Foot Switch 4498 <gen>
    Sound - Play BattleNetDoorsStereo2 <gen>
    Trigger - Run disable_others <gen> (checking conditions)
    Wait 1.00 game-time seconds
    Unit - Remove (Entering unit) from the game
    Trigger - Turn on micro_start <gen>
    Set VariableSet StartTigger = micro_start <gen>
    Set VariableSet forgetGivesWood = True
    Trigger - Add create_chooser <gen> to the trigger queue (Checking conditions)
For future implementation.
Moba
  Events
    Unit - A unit enters start_Moba <gen>
  Conditions
  Actions
    Destructible - Kill Foot Switch 3200 <gen>
    Sound - Play BattleNetDoorsStereo2 <gen>
    Trigger - Run disable_others <gen> (checking conditions)
    Wait 1.00 game-time seconds
    Unit - Remove (Entering unit) from the game
    Trigger - Turn on Moba_start <gen>
    Set VariableSet StartTigger = Moba_start <gen>
    Trigger - Add create_chooser <gen> to the trigger queue (Checking conditions)
For future implementation.
Moba Entrenchment
  Events
    Unit - A unit enters start_Moba_Entrenchment <gen>
  Conditions
  Actions
    Destructible - Kill Foot Switch 4470 <gen>
    Sound - Play BattleNetDoorsStereo2 <gen>
    Trigger - Run disable_others <gen> (checking conditions)
    Wait 1.00 game-time seconds
    Unit - Remove (Entering unit) from the game
    Trigger - Turn on Moba_start <gen>
    Set VariableSet StartTigger = Moba_start <gen>
    Set VariableSet MobaEntrenchmentOn = True
    Trigger - Add create_chooser <gen> to the trigger queue (Checking conditions)
disable others
  Events
  Conditions
  Actions
    Trigger - Turn off YBrflr <gen>
    Trigger - Turn off (This trigger)
    Trigger - Turn off gladiator <gen>
    Trigger - Turn off gladiator_Hc <gen>
    Trigger - Turn off gladiator_Mythic <gen>
    Trigger - Turn off micro_wars <gen>
    Trigger - Turn off arenas_3_rounds <gen>
    Trigger - Turn off Moba <gen>
    Trigger - Turn off Moba_Entrenchment <gen>
    Trigger - Turn off race <gen>
    Trigger - Turn off race_heroic <gen>
    Trigger - Turn off training <gen>
    -------- Options --------
    Trigger - Turn off gladiator_Option_Map_1 <gen>
    Trigger - Turn off gladiator_Option_Map_2 <gen>
    Trigger - Turn off gladiator_Option_Map_3 <gen>
    Trigger - Turn off gladiator_Option_Alternate_Spawn <gen>
    Trigger - Turn off gladiator_Option_Standard_Spawn <gen>
    Trigger - Turn off gladiator_Option_No_Tp <gen>
    Trigger - Turn off race_Option_Short_Mode <gen>

----------------------------------------------------------------------------Paladon presents----------------------------------------------------------------------------



GUI Knockback System v.1.60


1-What this system allows you to make:
This system allows you to attach a knockback effect to whatever you want.
You can easily specify speed, range and other knockback effects.
The specified values only apply for the spell you specified them, so other spells using the knockback effect are completely autonomic and their values are free selectable.

2-How to imort the system into your map?
The system consists of the two triggers 'Cast A Knockback' and 'Get Knockback' as well as every variable with the 'KB_' and the 'KBA_' prefix.
You don´t need any of the custom units, spells, buffs, items or whatever.
Just copy the both named triggers into your map as well as the variables.

3-How to attach finally a knockback?
To attach the imported system to a spell, create a new spell and apply the actions of the 'Actions to apply' trigger for every unit which shall receive the knockback.
That´s all you need.

I recommend you to check the samples. I created three samples using different options.

Please give me credits for the system if you use it in your map or own spell ;)

Actions to apply
  Events
  Conditions
  Actions
    -------- This is the caster of the knockback. --------
    -------- If you use spells, it´s mostly the 'triggering unit' or the 'casting unit'. --------
    Set VariableSet KBA_Caster = (Triggering unit)
    -------- --------
    -------- This is the unit knocked back. Set this variable to the unit which should receive the knockback. --------
    -------- Use for example 'Target unit of ability being cast' or 'picked unit', 'attacking unit', 'casting unit', 'triggering unit' or whatever. --------
    Set VariableSet KBA_TargetUnit = (Target unit of ability being cast)
    -------- --------
    -------- This is the location from where the unit should be knocked back. --------
    -------- Don´t set this location to the position of the unit which should be knocked back. --------
    Set VariableSet KBA_StartingPosition = (Position of (Casting unit))
    -------- --------
    -------- This saves the level of the spell. --------
    -------- If the level shouldn´t influence the knockback, set the variable to 1. --------
    Set VariableSet KBA_Level = (Level of (Ability being cast) for (Triggering unit))
    -------- --------
    -------- This determines the speed of the knockback. --------
    -------- If you set the speed to 0, the unit won´t move. --------
    Set VariableSet KBA_Speed = 7.00
    -------- --------
    -------- This determines the distance knockbacked per level of the spell. --------
    -------- If the level shouldn´t influence the knockback, simply set this variable to the distance you wish. --------
    Set VariableSet KBA_DistancePerLevel = 150.00
    -------- --------
    -------- The following both variables store the path of the effects used. --------
    -------- Effect[1] is more often used than Effect[2]. --------
    Set VariableSet KBA_SpecialEffects[1] = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
    Set VariableSet KBA_SpecialEffects[2] = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
    -------- --------
    -------- Set the following variable to 'false' to allow trees to survive a collision with a knocked unit. --------
    -------- Set the following variable to 'true' to kill trees upon collision with a knocked unit. --------
    Set VariableSet KBA_DestroyTrees = True
    -------- --------
    -------- After setting the needed variables we start the knockback. --------
    Trigger - Run Cast_A_Knockback <gen> (checking conditions)
    -------- Done. The unit knockbacked if the trigger triggers. --------
The both following triggers are the GUI Knockback System. Without these both triggers the system won´t work.
Simply copy and paste the variables with the prefix 'KB_' and 'KBA_'into your map. Then copy and paste the both triggers into your map.
Check the 'Readme' and 'Sample Readme' for more information.
Cast A Knockback
  Events
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (KBA_TargetUnit is in KB_KnockbackedUnits.) Equal to True
      Then - Actions
        Unit Group - Remove KBA_TargetUnit from KB_KnockbackedUnits.
        Set VariableSet KB_CountBuffs = (KB_CountBuffs - 1)
        For each (Integer KB_GeneralIntegers[2]) from 1 to KB_TotalKnockUnits, do (Actions)
          Loop - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                KB_Units[KB_GeneralIntegers[1]] Equal to KBA_TargetUnit
              Then - Actions
                Set VariableSet KB_GeneralIntegers[1] = KB_GeneralIntegers[2]
                Set VariableSet KB_GeneralIntegers[2] = KB_TotalKnockUnits
              Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            KB_TotalKnockUnits Greater than KB_GeneralIntegers[1]
          Then - Actions
            Set VariableSet KB_Levels[KB_GeneralIntegers[1]] = KB_Levels[KB_TotalKnockUnits]
            Set VariableSet KB_Units[KB_GeneralIntegers[1]] = KB_Units[KB_TotalKnockUnits]
            Set VariableSet KB_Angle[KB_GeneralIntegers[1]] = KB_Angle[KB_TotalKnockUnits]
            Set VariableSet KB_MaxDistance[KB_GeneralIntegers[1]] = KB_MaxDistance[KB_TotalKnockUnits]
            Set VariableSet KB_ReachedDistance[KB_GeneralIntegers[1]] = KB_ReachedDistance[KB_TotalKnockUnits]
            Set VariableSet KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = KB_ReduceSpeedReal[KB_TotalKnockUnits]
            Set VariableSet KB_SpecificSpeed[KB_GeneralIntegers[1]] = KB_SpecificSpeed[KB_TotalKnockUnits]
            Set VariableSet KB_Effects_1[KB_GeneralIntegers[1]] = KB_Effects_1[KB_TotalKnockUnits]
            Set VariableSet KB_Effects_2[KB_GeneralIntegers[1]] = KB_Effects_2[KB_TotalKnockUnits]
            Set VariableSet KB_DestroyTrees[KB_GeneralIntegers[1]] = KB_DestroyTrees[KB_TotalKnockUnits]
            Set VariableSet KB_EffectCounter[KB_GeneralIntegers[1]] = KB_EffectCounter[KB_TotalKnockUnits]
            Set VariableSet KB_EffectCounter2[KB_GeneralIntegers[1]] = KB_EffectCounter2[KB_TotalKnockUnits]
            Set VariableSet KB_GeneralIntegers[1] = (KB_GeneralIntegers[1] - 1)
          Else - Actions
        Set VariableSet KB_Units[KB_TotalKnockUnits] = No unit
        Set VariableSet KB_TotalKnockUnits = (KB_TotalKnockUnits - 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            KB_CountBuffs Equal to 0
          Then - Actions
            Set VariableSet KB_TotalKnockUnits = 0
            Trigger - Turn off Get_Knockback <gen>
          Else - Actions
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        KB_CountBuffs Equal to 0
      Then - Actions
        Trigger - Turn on Get_Knockback <gen>
      Else - Actions
    Set VariableSet KB_CountBuffs = (KB_CountBuffs + 1)
    Set VariableSet KB_TotalKnockUnits = (KB_TotalKnockUnits + 1)
    Set VariableSet KB_Casters[KB_TotalKnockUnits] = KBA_Caster
    Set VariableSet KB_Levels[KB_TotalKnockUnits] = KBA_Level
    Set VariableSet KB_Units[KB_TotalKnockUnits] = KBA_TargetUnit
    Set VariableSet KB_StartPositions[KB_TotalKnockUnits] = KBA_StartingPosition
    Set VariableSet KB_TempPoint[KB_TotalKnockUnits] = (Position of KBA_TargetUnit)
    Set VariableSet KB_Angle[KB_TotalKnockUnits] = (Angle from KB_StartPositions[KB_TotalKnockUnits] to KB_TempPoint[KB_TotalKnockUnits])
    Set VariableSet KB_MaxDistance[KB_TotalKnockUnits] = (KBA_DistancePerLevel x (Real(KBA_Level)))
    Set VariableSet KB_ReachedDistance[KB_TotalKnockUnits] = 0.00
    Set VariableSet KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = 0.00
    Set VariableSet KB_SpecificSpeed[KB_TotalKnockUnits] = KBA_Speed
    Set VariableSet KB_Effects_1[KB_TotalKnockUnits] = KBA_SpecialEffects[1]
    Set VariableSet KB_Effects_2[KB_TotalKnockUnits] = KBA_SpecialEffects[2]
    Set VariableSet KB_DestroyTrees[KB_TotalKnockUnits] = KBA_DestroyTrees
    Set VariableSet KB_EffectCounter[KB_GeneralIntegers[1]] = 0
    Set VariableSet KB_EffectCounter2[KB_GeneralIntegers[1]] = 0
    Unit Group - Add KBA_TargetUnit to KB_KnockbackedUnits
    Custom script: call RemoveLocation (udg_KBA_StartingPosition)
    Custom script: call RemoveLocation (udg_KB_TempPoint [udg_KB_TotalKnockUnits] )
    Custom script: call RemoveLocation (udg_KB_StartPositions [udg_KB_TotalKnockUnits] )
Get Knockback
  Events
    Time - Every 0.03 seconds of game time
  Conditions
  Actions
    For each (Integer KB_GeneralIntegers[1]) from 1 to KB_TotalKnockUnits, do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (KB_Units[KB_GeneralIntegers[1]] is in KB_KnockbackedUnits.) Equal to True
          Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                KB_ReachedDistance[KB_GeneralIntegers[1]] Greater than or equal to KB_MaxDistance[KB_GeneralIntegers[1]]
              Then - Actions
                Unit Group - Remove KB_Units[KB_GeneralIntegers[1]] from KB_KnockbackedUnits.
                Set VariableSet KB_CountBuffs = (KB_CountBuffs - 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    KB_TotalKnockUnits Greater than KB_GeneralIntegers[1]
                  Then - Actions
                    Set VariableSet KB_Levels[KB_GeneralIntegers[1]] = KB_Levels[KB_TotalKnockUnits]
                    Set VariableSet KB_Units[KB_GeneralIntegers[1]] = KB_Units[KB_TotalKnockUnits]
                    Set VariableSet KB_Angle[KB_GeneralIntegers[1]] = KB_Angle[KB_TotalKnockUnits]
                    Set VariableSet KB_MaxDistance[KB_GeneralIntegers[1]] = KB_MaxDistance[KB_TotalKnockUnits]
                    Set VariableSet KB_ReachedDistance[KB_GeneralIntegers[1]] = KB_ReachedDistance[KB_TotalKnockUnits]
                    Set VariableSet KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = KB_ReduceSpeedReal[KB_TotalKnockUnits]
                    Set VariableSet KB_SpecificSpeed[KB_GeneralIntegers[1]] = KB_SpecificSpeed[KB_TotalKnockUnits]
                    Set VariableSet KB_Effects_1[KB_GeneralIntegers[1]] = KB_Effects_1[KB_TotalKnockUnits]
                    Set VariableSet KB_Effects_2[KB_GeneralIntegers[1]] = KB_Effects_2[KB_TotalKnockUnits]
                    Set VariableSet KB_DestroyTrees[KB_GeneralIntegers[1]] = KB_DestroyTrees[KB_TotalKnockUnits]
                    Set VariableSet KB_EffectCounter[KB_GeneralIntegers[1]] = KB_EffectCounter[KB_TotalKnockUnits]
                    Set VariableSet KB_EffectCounter2[KB_GeneralIntegers[1]] = KB_EffectCounter2[KB_TotalKnockUnits]
                    Set VariableSet KB_GeneralIntegers[1] = (KB_GeneralIntegers[1] - 1)
                  Else - Actions
                Set VariableSet KB_Units[KB_TotalKnockUnits] = No unit
                Set VariableSet KB_TotalKnockUnits = (KB_TotalKnockUnits - 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    KB_CountBuffs Equal to 0
                  Then - Actions
                    Set VariableSet KB_TotalKnockUnits = 0
                    Trigger - Turn off (This trigger)
                  Else - Actions
              Else - Actions
                Set VariableSet KB_ReducedReal = ((KB_SpecificSpeed[KB_GeneralIntegers[1]] / KB_MaxDistance[KB_GeneralIntegers[1]]) x KB_ReachedDistance[KB_GeneralIntegers[1]])
                Set VariableSet KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = (KB_ReducedReal - (KB_ReduceSpeedReal[KB_GeneralIntegers[1]] x 0.10))
                Set VariableSet KB_TempReal = ((KB_SpecificSpeed[KB_GeneralIntegers[1]] - KB_ReduceSpeedReal[KB_GeneralIntegers[1]]) x 2.00)
                Set VariableSet KB_TempPoint[1] = (Position of KB_Units[KB_GeneralIntegers[1]])
                Set VariableSet KB_TempPoint[2] = (KB_TempPoint[1] offset by KB_TempReal towards KB_Angle[KB_GeneralIntegers[1]] degrees.)
                Set VariableSet KB_EffectCounter[KB_GeneralIntegers[1]] = (KB_EffectCounter[KB_GeneralIntegers[1]] + 1)
                Set VariableSet KB_EffectCounter2[KB_GeneralIntegers[1]] = (KB_EffectCounter2[KB_GeneralIntegers[1]] + 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    KB_DestroyTrees[KB_GeneralIntegers[1]] Equal to True
                  Then - Actions
                    Destructible - Pick every destructible within 200.00 of KB_TempPoint[2] and do (Actions)
                      Loop - Actions
                        Destructible - Kill (Picked destructible)
                  Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    KB_EffectCounter[KB_GeneralIntegers[1]] Equal to 6
                  Then - Actions
                    Set VariableSet KB_EffectCounter[KB_GeneralIntegers[1]] = 0
                    Special Effect - Create a special effect at KB_TempPoint[1] using KB_Effects_1[KB_GeneralIntegers[1]]
                    Special Effect - Destroy (Last created special effect)
                  Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    KB_EffectCounter2[KB_GeneralIntegers[1]] Equal to 8
                  Then - Actions
                    Set VariableSet KB_EffectCounter2[KB_GeneralIntegers[1]] = 0
                    Special Effect - Create a special effect at KB_TempPoint[1] using KB_Effects_2[KB_GeneralIntegers[1]]
                    Special Effect - Destroy (Last created special effect)
                  Else - Actions
                Unit - Move KB_Units[KB_GeneralIntegers[1]] instantly to KB_TempPoint[2]
                Custom script: call RemoveLocation (udg_KB_TempPoint[1])
                Custom script: call RemoveLocation (udg_KB_TempPoint[2])
                Set VariableSet KB_ReachedDistance[KB_GeneralIntegers[1]] = (KB_ReachedDistance[KB_GeneralIntegers[1]] + KB_TempReal)
          Else - Actions
I recommend you to check the samples. I created three samples using different options.
The samples use custom object editor spells which no further effects.

Sample Meele Knockback
This sample uses a custom object editor spell with a range of 50 which doesn´t deal any damage or has further effects.
The only thing to do is to apply the 'Actions to apply' for the spells conditions.

Sample Explosion Spell
This sample causes an AoE Knockback at the targeted position. The Knockback affects more than one unit, so you have to create a loop (check the trigger) to apply the actions to every unit knocked back.

Sample Warstomp Spell
This trigger works like the Sample Explosion Spell. It simply knocks the enemied units around the caster back.
Here applies too:
The Knockback affects more than one unit, so you have to create a loop (check the trigger) to apply the actions to every unit knocked back.

YOU DON´T NEED THE SAMPLES TO USE THE SYSTEM ;)

Sample Meele Knockback Spell
  Events
    Unit - A unit Begins casting an ability
  Conditions
    (Ability being cast) Equal to
  Actions
    -------- This are the applied actions of the 'Actions to apply' trigger. --------
    Set VariableSet KBA_Caster = (Triggering unit)
    Set VariableSet KBA_TargetUnit = (Target unit of ability being cast)
    Set VariableSet KBA_StartingPosition = (Position of (Triggering unit))
    Set VariableSet KBA_Level = (Level of (Ability being cast) for (Triggering unit))
    Set VariableSet KBA_Speed = 7.00
    Set VariableSet KBA_DistancePerLevel = 150.00
    Set VariableSet KBA_SpecialEffects[1] = Abilities\Spells\Undead\OrbOfDeath\OrbOfDeathMissile.mdl
    Set VariableSet KBA_SpecialEffects[2] = Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
    Set VariableSet KBA_DestroyTrees = True
    Trigger - Run Cast_A_Knockback <gen> (checking conditions)
    -------- --------
Sample Explosion Spell
  Events
    Unit - A unit Begins casting an ability
  Conditions
    (Ability being cast) Equal to
  Actions
    -------- This are spell effects. They don´t affect the knockback. --------
    Set VariableSet Sample_Point = (Target point of ability being cast)
    Set VariableSet Sample_Group = (Units within 250.00 of Sample_Point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit)).) Equal to True)))).)
    Destructible - Pick every destructible within 200.00 of Sample_Point and do (Actions)
      Loop - Actions
        Destructible - Kill (Picked destructible)
    Special Effect - Create a special effect at Sample_Point using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
    Special Effect - Destroy (Last created special effect)
    -------- --------
    -------- This are the applied actions of the 'Actions to apply' trigger. They are in a loop to affect more than one unit. --------
    Unit Group - Pick every unit in Sample_Group and do (Actions)
      Loop - Actions
        Set VariableSet KBA_Caster = (Triggering unit)
        Set VariableSet KBA_TargetUnit = (Picked unit)
        Set VariableSet KBA_StartingPosition = (Target point of ability being cast)
        Set VariableSet KBA_Level = (Level of (Ability being cast) for (Triggering unit))
        Set VariableSet KBA_Speed = 9.00
        Set VariableSet KBA_DistancePerLevel = 200.00
        Set VariableSet KBA_SpecialEffects[1] = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
        Set VariableSet KBA_SpecialEffects[2] = Abilities\Weapons\RedDragonBreath\RedDragonMissile.mdl
        Set VariableSet KBA_DestroyTrees = True
        Trigger - Run Cast_A_Knockback <gen> (checking conditions)
    -------- --------
    Custom script: call RemoveLocation (udg_Sample_Point)
    Custom script: call DestroyGroup (udg_Sample_Group)
Sample Warstomp Spell
  Events
    Unit - A unit Begins casting an ability
  Conditions
    (Ability being cast) Equal to Chain Lightning (effect only)
  Actions
    -------- This are spell effects. They don´t affect the knockback. --------
    Set VariableSet Sample_Point = (Position of (Triggering unit))
    Set VariableSet Sample_Group = (Units within 250.00 of Sample_Point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit)).) Equal to True)))).)
    Destructible - Pick every destructible within 200.00 of Sample_Point and do (Actions)
      Loop - Actions
        Destructible - Kill (Picked destructible)
    Special Effect - Create a special effect at Sample_Point using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
    Special Effect - Destroy (Last created special effect)
    -------- --------
    -------- This are the applied actions of the 'Actions to apply' trigger. They are in a loop to affect more than one unit. --------
    Unit Group - Pick every unit in Sample_Group and do (Actions)
      Loop - Actions
        Set VariableSet KBA_Caster = (Triggering unit)
        Set VariableSet KBA_TargetUnit = (Picked unit)
        Set VariableSet KBA_Level = (Level of (Ability being cast) for (Triggering unit))
        Set VariableSet KBA_StartingPosition = (Position of (Triggering unit))
        Set VariableSet KBA_Speed = 5.00
        Set VariableSet KBA_DistancePerLevel = 150.00
        Set VariableSet KBA_SpecialEffects[1] = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
        Set VariableSet KBA_SpecialEffects[2] = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
        Set VariableSet KBA_DestroyTrees = True
        Trigger - Run Cast_A_Knockback <gen> (checking conditions)
    -------- --------
    Custom script: call RemoveLocation (udg_Sample_Point)
    Custom script: call DestroyGroup (udg_Sample_Group)
function Trig_testtrig255_Func001C takes nothing returns boolean
    if ( not ( IsUnitAliveBJ(udg_SpecsMainHeroOf[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]) == false ) ) then
        return false
    endif
    return true
endfunction


function Trig_ClassAbilities_Conditions takes nothing returns boolean
    if  ( GetItemType(GetManipulatedItem()) == ITEM_TYPE_ARTIFACT ) then
        return true
    endif
    return false
endfunction

function Trig_ClassAbilities_Actions takes nothing returns nothing
    call SetItemCharges( GetManipulatedItem(), 1 )

    if ( Trig_testtrig255_Func001C() ) then
        return
    else
    endif


    set udg_XcombTempPlayerID3 = GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))
    if ( GetUnitName(GetTriggerUnit()) == "Light Combat" ) then
        if ( GetItemTypeId(GetManipulatedItem()) == 'I03R' ) then
            call ClassTryLearnAbilityIndexHero (128, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
        else
            if ( GetItemTypeId(GetManipulatedItem()) == 'I03P' ) then
                call ClassTryLearnAbilityIndexHero (77, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I03S' ) then
                    call ClassTryLearnAbilityIndexHero (17, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I03Q' ) then
                        call ClassTryLearnAbilityIndexHero (41, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                    endif
                endif
            endif
        endif
    else
        if ( GetUnitName(GetTriggerUnit()) == "Heavy Combat" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I03U' ) then
                call ClassTryLearnAbilityIndexHero (155, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I03V' ) then
                    call ClassTryLearnAbilityIndexHero (75, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I03W' ) then
                        call ClassTryLearnAbilityIndexHero (115, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I03T' ) then
                            call ClassTryLearnAbilityIndexHero (1, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Rogue" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I041' ) then
                call ClassTryLearnAbilityIndexHero (125, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I042' ) then
                    call ClassTryLearnAbilityIndexHero (57, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I043' ) then
                        call ClassTryLearnAbilityIndexHero (63, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I044' ) then
                            call ClassTryLearnAbilityIndexHero (39, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Paladin" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I045' ) then
                call ClassTryLearnAbilityIndexHero (3, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I046' ) then
                    call ClassTryLearnAbilityIndexHero (140, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I047' ) then
                        call ClassTryLearnAbilityIndexHero (28, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I048' ) then
                            call ClassTryLearnAbilityIndexHero (20, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Priest" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I04D' ) then
                call ClassTryLearnAbilityIndexHero (23, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I04E' ) then
                    call ClassTryLearnAbilityIndexHero (37, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I04F' ) then
                        call ClassTryLearnAbilityIndexHero (22, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I04G' ) then
                            call ClassTryLearnAbilityIndexHero (96, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Knight of Nature" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I03X' ) then
                call ClassTryLearnAbilityIndexHero (11, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I03Y' ) then
                    call ClassTryLearnAbilityIndexHero (157, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I03Z' ) then
                        call ClassTryLearnAbilityIndexHero (132, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I040' ) then
                            call ClassTryLearnAbilityIndexHero (25, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Cleric" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I049' ) then
                call ClassTryLearnAbilityIndexHero (123, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I04A' ) then
                    call ClassTryLearnAbilityIndexHero (130, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I078' ) then
                        call ClassTryLearnAbilityIndexHero (133, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I04C' ) then
                            call ClassTryLearnAbilityIndexHero (147, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Pandarian Master" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I04H' ) then
                call ClassTryLearnAbilityIndexHero (68, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I04I' ) then
                    call ClassTryLearnAbilityIndexHero (58, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I04J' ) then
                        call ClassTryLearnAbilityIndexHero (112, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I04K' ) then
                            call ClassTryLearnAbilityIndexHero (151, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Marksmanship" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I04L' ) then
                call ClassTryLearnAbilityIndexHero (160, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I04M' ) then
                    call ClassTryLearnAbilityIndexHero (43, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I04N' ) then
                        call ClassTryLearnAbilityIndexHero (54, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I04O' ) then
                            call ClassTryLearnAbilityIndexHero (156, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Anti-Magic" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I04P' ) then
                call ClassTryLearnAbilityIndexHero (35, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I04Q' ) then
                    call ClassTryLearnAbilityIndexHero (51, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I04R' ) then
                        call ClassTryLearnAbilityIndexHero (138, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I04S' ) then
                            call ClassTryLearnAbilityIndexHero (46, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Mage´s Devourer" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I04T' ) then
                call ClassTryLearnAbilityIndexHero (142, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I04U' ) then
                    call ClassTryLearnAbilityIndexHero (79, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I04V' ) then
                        call ClassTryLearnAbilityIndexHero (13, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I04W' ) then
                            call ClassTryLearnAbilityIndexHero (56, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Wizard" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I04X' ) then
                call ClassTryLearnAbilityIndexHero (126, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I04Y' ) then
                    call ClassTryLearnAbilityIndexHero (83, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I04Z' ) then
                        call ClassTryLearnAbilityIndexHero (80, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I050' ) then
                            call ClassTryLearnAbilityIndexHero (48, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Energy Specialist" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I051' ) then
                call ClassTryLearnAbilityIndexHero (85, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I052' ) then
                    call ClassTryLearnAbilityIndexHero (26, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I053' ) then
                        call ClassTryLearnAbilityIndexHero (150, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I054' ) then
                            call ClassTryLearnAbilityIndexHero (135, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Tricksmage" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I055' ) then
                call ClassTryLearnAbilityIndexHero (38, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I056' ) then
                    call ClassTryLearnAbilityIndexHero (64, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I057' ) then
                        call ClassTryLearnAbilityIndexHero (159, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I06Z' ) then
                            call ClassTryLearnAbilityIndexHero (81, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Shapechanger" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I059' ) then
                call ClassTryLearnAbilityIndexHero (162, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I05A' ) then
                    call ClassTryLearnAbilityIndexHero (164, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I05B' ) then
                        call ClassTryLearnAbilityIndexHero (163, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I077' ) then
                            call ClassTryLearnAbilityIndexHero (158, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Conventional Combat Sorcery" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I07G' ) then
                call ClassTryLearnAbilityIndexHero (8, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I05E' ) then
                    call ClassTryLearnAbilityIndexHero (87, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I05F' ) then
                        call ClassTryLearnAbilityIndexHero (40, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I05G' ) then
                            call ClassTryLearnAbilityIndexHero (27, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Blaze" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I05H' ) then
                call ClassTryLearnAbilityIndexHero (19, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I05I' ) then
                    call ClassTryLearnAbilityIndexHero (70, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I05J' ) then
                        call ClassTryLearnAbilityIndexHero (95, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I05K' ) then
                            call ClassTryLearnAbilityIndexHero (84, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Storm Combat" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I07H' ) then
                call ClassTryLearnAbilityIndexHero (120, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I05M' ) then
                    call ClassTryLearnAbilityIndexHero (98, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I05N' ) then
                        call ClassTryLearnAbilityIndexHero (9, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I05O' ) then
                            call ClassTryLearnAbilityIndexHero (118, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Frost" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I05P' ) then
                call ClassTryLearnAbilityIndexHero (149, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I05Q' ) then
                    call ClassTryLearnAbilityIndexHero (124, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I05R' ) then
                        call ClassTryLearnAbilityIndexHero (145, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I05S' ) then
                            call ClassTryLearnAbilityIndexHero (141, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Necromaster" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I05T' ) then
                call ClassTryLearnAbilityIndexHero (31, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I05U' ) then
                    call ClassTryLearnAbilityIndexHero (88, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I05V' ) then
                        call ClassTryLearnAbilityIndexHero (5, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I05W' ) then
                            call ClassTryLearnAbilityIndexHero (32, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Warlock" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I05X' ) then
                call ClassTryLearnAbilityIndexHero (59, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I05Y' ) then
                    call ClassTryLearnAbilityIndexHero (89, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I05Z' ) then
                        call ClassTryLearnAbilityIndexHero (92, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I060' ) then
                            call ClassTryLearnAbilityIndexHero (33, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Cosmic Warlock" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I061' ) then
                call ClassTryLearnAbilityIndexHero (104, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I062' ) then
                    call ClassTryLearnAbilityIndexHero (127, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I063' ) then
                        call ClassTryLearnAbilityIndexHero (114, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I064' ) then
                            call ClassTryLearnAbilityIndexHero (105, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Druid" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I065' ) then
                call ClassTryLearnAbilityIndexHero (134, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I066' ) then
                    call ClassTryLearnAbilityIndexHero (139, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I067' ) then
                        call ClassTryLearnAbilityIndexHero (21, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I068' ) then
                            call ClassTryLearnAbilityIndexHero (152, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Weathercaller" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I069' ) then
                call ClassTryLearnAbilityIndexHero (99, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I06A' ) then
                    call ClassTryLearnAbilityIndexHero (97, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I06B' ) then
                        call ClassTryLearnAbilityIndexHero (108, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I06C' ) then
                            call ClassTryLearnAbilityIndexHero (110, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Keeper of the Grove" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I06D' ) then
                call ClassTryLearnAbilityIndexHero (111, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I06E' ) then
                    call ClassTryLearnAbilityIndexHero (14, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I06F' ) then
                        call ClassTryLearnAbilityIndexHero (86, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I06G' ) then
                            call ClassTryLearnAbilityIndexHero (121, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Bio Hunter" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I06H' ) then
                call ClassTryLearnAbilityIndexHero (12, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I06I' ) then
                    call ClassTryLearnAbilityIndexHero (50, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I06J' ) then
                        call ClassTryLearnAbilityIndexHero (72, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I06K' ) then
                            call ClassTryLearnAbilityIndexHero (29, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Shaman" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I06L' ) then
                call ClassTryLearnAbilityIndexHero (74, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I06M' ) then
                    call ClassTryLearnAbilityIndexHero (36, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I06N' ) then
                        call ClassTryLearnAbilityIndexHero (61, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I060' ) then
                            call ClassTryLearnAbilityIndexHero (42, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Shadow Shaman" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I06P' ) then
                call ClassTryLearnAbilityIndexHero (10, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I06Q' ) then
                    call ClassTryLearnAbilityIndexHero (93, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I06R' ) then
                        call ClassTryLearnAbilityIndexHero (161, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I06S' ) then
                            call ClassTryLearnAbilityIndexHero (154, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Nether-User" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I06T' ) then
                call ClassTryLearnAbilityIndexHero (24, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I06U' ) then
                    call ClassTryLearnAbilityIndexHero (146, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I06V' ) then
                        call ClassTryLearnAbilityIndexHero (45, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I06W' ) then
                            call ClassTryLearnAbilityIndexHero (129, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Vampire" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I06X' ) then
                call ClassTryLearnAbilityIndexHero (148, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I06Y' ) then
                    call ClassTryLearnAbilityIndexHero (113, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I07D' ) then
                        call ClassTryLearnAbilityIndexHero (82, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I070' ) then
                            call ClassTryLearnAbilityIndexHero (34, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Elementalist" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I071' ) then
                call ClassTryLearnAbilityIndexHero (78, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I072' ) then
                    call ClassTryLearnAbilityIndexHero (101, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I05C' ) then
                        call ClassTryLearnAbilityIndexHero (90, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I05D' ) then
                            call ClassTryLearnAbilityIndexHero (94, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Geo-Black Sage" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I073' ) then
                call ClassTryLearnAbilityIndexHero (15, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I074' ) then
                    call ClassTryLearnAbilityIndexHero (137, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I075' ) then
                        call ClassTryLearnAbilityIndexHero (47, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I076' ) then
                            call ClassTryLearnAbilityIndexHero (66, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Feral Hunter" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I079' ) then
                call ClassTryLearnAbilityIndexHero (53, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I07A' ) then
                    call ClassTryLearnAbilityIndexHero (60, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I07B' ) then
                        call ClassTryLearnAbilityIndexHero (44, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I07C' ) then
                            call ClassTryLearnAbilityIndexHero (107, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else
    if ( GetUnitName(GetTriggerUnit()) == "Heavy Combat B" ) then
            if ( GetItemTypeId(GetManipulatedItem()) == 'I07F' ) then
                call ClassTryLearnAbilityIndexHero (7, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
            else
                if ( GetItemTypeId(GetManipulatedItem()) == 'I07E' ) then
                    call ClassTryLearnAbilityIndexHero (73, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                else
                    if ( GetItemTypeId(GetManipulatedItem()) == 'I05L' ) then
                        call ClassTryLearnAbilityIndexHero (91, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                    else
                        if ( GetItemTypeId(GetManipulatedItem()) == 'I04B' ) then
                            call ClassTryLearnAbilityIndexHero (103, udg_SpecsMainHeroOf[udg_XcombTempPlayerID3] )
                        else
                        endif
                    endif
                endif
            endif
        else

    endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
        endif
    endif
endfunction

//===========================================================================
function InitTrig_ClassAbilities takes nothing returns nothing
    set gg_trg_ClassAbilities = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_ClassAbilities, EVENT_PLAYER_UNIT_USE_ITEM )
    call TriggerAddCondition( gg_trg_ClassAbilities, Condition( function Trig_ClassAbilities_Conditions ) )
    call TriggerAddAction( gg_trg_ClassAbilities, function Trig_ClassAbilities_Actions )
endfunction

 
GUI SpellEvent
  Events
  Conditions
  Actions
    Custom script: local integer i = 1
    -------- - --------
    -------- Call the initialization function. --------
    -------- - --------
    Custom script: call ExecuteFunc("InitSpellEvent")
    -------- - --------
    -------- Creating the hashtable. --------
    -------- - --------
    Hashtable - Create a hashtable
    Set VariableSet SpellEventHash = (Last created hashtable)
    -------- - --------
    -------- Over here, I'm just looping through all the abilities to be registered and saving the triggers in a hashtable. --------
    -------- - --------
    Custom script: loop
    Custom script: exitwhen udg_SpellEventAbility[i] == 0
    Custom script: call SaveTriggerHandle(udg_SpellEventHash, udg_SpellEventAbility[i], 0, udg_SpellEventTrigger[i])
    Custom script: set i = i + 1
    Custom script: endloop
    Custom script: endfunction
    -------- - --------
    -------- This function only evaluates and executes one trigger instead of evaluating a thousand triggers and executing one. --------
    -------- - --------
    Custom script: function OnSpell takes nothing returns boolean
    Custom script: local trigger t = LoadTriggerHandle(udg_SpellEventHash, GetSpellAbilityId(), 0)
    -------- - --------
    -------- If the conditions return true, do the actions. --------
    -------- If none of your spell triggers have conditions, you can optimize this system by deleting the 1st and 3rd custom scripts after this. --------
    -------- - --------
    Custom script: if TriggerEvaluate(t) then
    Custom script: call TriggerExecute(t)
    Custom script: endif
    -------- - --------
    Custom script: set t = null
    Custom script: return false
    Custom script: endfunction
    -------- - --------
    -------- This is the Initialization function of the entire system. --------
    -------- - --------
    Custom script: function InitSpellEvent takes nothing returns nothing
    Custom script: local trigger t = CreateTrigger()
    Custom script: call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    Custom script: call TriggerAddCondition(t, Condition(function OnSpell))
    Custom script: set t = null
    -------- - --------
Init Trigger
  Events
    Map initialization
  Conditions
  Actions
    -------- - --------
    Set VariableSet SpellEventAbility[1] = Item Tablet of Everlasting Hunger (glad)
    Set VariableSet SpellEventAbility[2] = Nosferatu (DXX)
    Set VariableSet SpellEventAbility[3] = Draw Soul (DDX)
    Set VariableSet SpellEventAbility[4] = Flame Burst (FFX)
    Set VariableSet SpellEventAbility[5] = Blue Flames (FDX)
    Set VariableSet SpellEventAbility[6] = Frostbomb (SWT)
    Set VariableSet SpellEventAbility[7] = Detonate (EYX)
    Set VariableSet SpellEventAbility[8] = Create (Spellbook 3)
    Set VariableSet SpellEventAbility[9] = Divine Intervention (LLX)
    Set VariableSet SpellEventAbility[10] = Mass Lightning Shield (SSX)
    Set VariableSet SpellEventAbility[11] = Mass Entangle (EEX)
    Set VariableSet SpellEventAbility[12] = Monsoon (SWX)
    Set VariableSet SpellEventAbility[13] = Mark of Starfall (SEX)
    Set VariableSet SpellEventAbility[14] = Sea Throw (WWX)
    Set VariableSet SpellEventAbility[15] = Fan of Knives (SET)
    Set VariableSet SpellEventAbility[16] = Magic Multi-Missiles (YYY)
    Set VariableSet SpellEventAbility[17] = Boulderskin (SEE)
    Set VariableSet SpellEventAbility[18] = Tentacle (EED)
    Set VariableSet SpellEventAbility[19] = Transform (YTT)
    Set VariableSet SpellEventAbility[20] = Phase Dash (SED)
    Set VariableSet SpellEventAbility[21] = Lifebloom (EXT)
    Set VariableSet SpellEventAbility[22] = Earthquake (EEY)
    Set VariableSet SpellEventAbility[23] = Disruptor Cloud (SFT)
    Set VariableSet SpellEventAbility[24] = Mana Leech (FDT)
    Set VariableSet SpellEventAbility[25] = Mind Control (DDY)
    Set VariableSet SpellEventAbility[26] = Cleansing Beam (LLT)
    Set VariableSet SpellEventAbility[27] = Meta Blast (XTT)
    Set VariableSet SpellEventAbility[28] = Discombobulation Suit (item)
    Set VariableSet SpellEventAbility[29] = Iceflash Golem (FWT)
    Set VariableSet SpellEventAbility[30] = Frost Bolt (WYT)
    Set VariableSet SpellEventAbility[31] = Nature's Call (LXT)
    Set VariableSet SpellEventAbility[32] = Netherbalm (LWD)
    Set VariableSet SpellEventAbility[33] = Exorcism (FLT)
    Set VariableSet SpellEventAbility[34] = Pressure Punch (FYY)
    Set VariableSet SpellEventAbility[35] = Seal of Power (XXT)
    Set VariableSet SpellEventAbility[36] = SoP Comet Call
    Set VariableSet SpellEventAbility[37] = SoP Teleport
    Set VariableSet SpellEventAbility[38] = Refresher Orb (Orb)
    Set VariableSet SpellEventAbility[39] = Decompose (EEF)
    Set VariableSet SpellEventAbility[40] = SoP Dimensional Door
    Set VariableSet SpellEventAbility[41] = Greater Affliction (DXT)
    Set VariableSet SpellEventAbility[42] = Mana Beam (YYX)
    Set VariableSet SpellEventAbility[43] = Cyclone (EFW)
    Set VariableSet SpellEventAbility[44] = Plasma Barrage (SST)
    Set VariableSet SpellEventAbility[45] = Pressure Punch (item)
    Set VariableSet SpellEventAbility[46] = Item Mysterious Tincture
    Set VariableSet SpellEventAbility[47] = Courier Scrap (Engineering)
    Set VariableSet SpellEventAbility[48] = Item GGRowl Master X7
    Set VariableSet SpellEventAbility[49] = Item Warp Portal Shard
    Set VariableSet SpellEventAbility[50] = Item Orbital Bombardment Control
    Set VariableSet SpellEventAbility[51] = Exc Storm
    Set VariableSet SpellEventAbility[52] = Exc Earth
    Set VariableSet SpellEventAbility[53] = Exc Fire
    Set VariableSet SpellEventAbility[54] = Exc Light
    Set VariableSet SpellEventAbility[55] = Exc Water
    Set VariableSet SpellEventAbility[56] = Exc Dark
    Set VariableSet SpellEventAbility[57] = Exc Energy
    Set VariableSet SpellEventAbility[58] = Exc X Arcanum
    Set VariableSet SpellEventAbility[59] = Exc Transmutation
    Set VariableSet SpellEventAbility[60] = Variable Spellblast (Innate)
    Set VariableSet SpellEventAbility[61] = Big Shot (Innate)
    Set VariableSet SpellEventAbility[62] = Slam (Innate)
    Set VariableSet SpellEventAbility[63] = Combo Strike (Innate)
    Set VariableSet SpellEventAbility[64] = Execute (Innate)
    Set VariableSet SpellEventAbility[65] = Smash (Innate)
    Set VariableSet SpellEventAbility[66] = Summon Magical Creature (Innate)
    Set VariableSet SpellEventAbility[67] = Universal Spellblast (Innate)
    Set VariableSet SpellEventAbility[68] = Mana Bolt (Innate)
    Set VariableSet SpellEventAbility[69] = Ambush (Innate)
    Set VariableSet SpellEventAbility[70] = Item Pickbait
    Set VariableSet SpellEventAbility[71] = Invisibility (LTT)
    Set VariableSet SpellEventAbility[72] = Raise Dead (EDD)
    Set VariableSet SpellEventAbility[73] = Animate Dead (LDX)
    Set VariableSet SpellEventAbility[74] = item Upgrade Boots
    Set VariableSet SpellEventAbility[75] = item Upgrade Bow
    Set VariableSet SpellEventAbility[76] = item Upgrade Pendant
    Set VariableSet SpellEventAbility[77] = item Upgrade Spellstrike
    Set VariableSet SpellEventAbility[78] = item Upgrade WD
    Set VariableSet SpellEventAbility[79] = Ship Artillery (Admiral Ships)
    Set VariableSet SpellEventAbility[80] = Item Healing (+180 cd30)
    Set VariableSet SpellEventAbility[81] = item Upgrade Jade
    Set VariableSet SpellEventAbility[82] = Rejuvenation (ELL)
    Set VariableSet SpellEventAbility[83] = Firebolt (FFY)
    Set VariableSet SpellEventAbility[84] = Roar (ELD)
    Set VariableSet SpellEventAbility[85] = Meteor Clash (EDX)
    Set VariableSet SpellEventAbility[86] = Frost Armor (LWT)
    Set VariableSet SpellEventAbility[87] = Forked Lightning (SSW)
    Set VariableSet SpellEventAbility[88] = Chain Lightning (SSS)
    Set VariableSet SpellEventAbility[89] = Innervate (EYY)
    Set VariableSet SpellEventAbility[90] = Mass Protection (LYT)
    Set VariableSet SpellEventAbility[91] = Phoenix (FYX)
    Set VariableSet SpellEventAbility[92] = Feral Spirit (SEF)
    Set VariableSet SpellEventAbility[93] = Force of Nature (EEW) glad
    Set VariableSet SpellEventAbility[94] = War Stomp (EEE)
    Set VariableSet SpellEventAbility[95] = Faerie Fire (EFT)
    Set VariableSet SpellEventAbility[96] = Molten Bombs (EFX)
    Set VariableSet SpellEventAbility[97] = Tornado (SFX)
    Set VariableSet SpellEventAbility[98] = Crystal Field (WXT)
    Set VariableSet SpellEventAbility[99] = item Upgrade Brut
    Set VariableSet SpellEventAbility[100] = Breath of Fire (FFL)
    Set VariableSet SpellEventAbility[101] = Flame Strike (FFF)
    Set VariableSet SpellEventAbility[102] = Searing Attack (FFT)
    Set VariableSet SpellEventAbility[103] = Incinerate (Pfeil) (FLY)
    Set VariableSet SpellEventAbility[104] = Exc GiveElement (give item to HeroInv)
    Set VariableSet SpellEventAbility[105] = Conjure Spider Eggs (EWD)
    Set VariableSet SpellEventAbility[106] = Summon Lava Spawn (FWX)
    Set VariableSet SpellEventAbility[107] = Exc Combine Last
    Set VariableSet SpellEventAbility[108] = Siphon Mana (DYT)
    Set VariableSet SpellEventAbility[109] = Animate Treants (EWX)
    Set VariableSet SpellEventAbility[110] = Shockwave (SFF)
    Set VariableSet SpellEventAbility[111] = Heal (LLW)
    Set VariableSet SpellEventAbility[112] = Summon Water Elemental (WWY)
    Set VariableSet SpellEventAbility[113] = Breath of Frost (EWT)
    Set VariableSet SpellEventAbility[114] = Serpent Ward (SSD)
    Set VariableSet SpellEventAbility[115] = Bloodlust (FFW)
    Set VariableSet SpellEventAbility[116] = Rain of Fire (FXX)
    Set VariableSet SpellEventAbility[117] = Healing Wave (SLT)
    Set VariableSet SpellEventAbility[118] = Slime Bolt (WYY)
    Set VariableSet SpellEventAbility[119] = Crushing Wave (WWW)
    Set VariableSet SpellEventAbility[120] = Blizzard (WXX)
    Set VariableSet SpellEventAbility[121] = Healing Ward (LLY)
    Set VariableSet SpellEventAbility[122] = Lightning Shield (SSE)
    Set VariableSet SpellEventAbility[123] = Item Experience Gain (300 x 3)
    Set VariableSet SpellEventAbility[124] = Purge (SEL)
    Set VariableSet SpellEventAbility[125] = Flame Strike (FFF)
    Set VariableSet SpellEventAbility[126] = Blink (SFD)
    Set VariableSet SpellEventAbility[127] = Blink (boots of blinking)
    -------- - --------
    Set VariableSet SpellEventTrigger[1] = Item_Tablet_of_everlasting_hunger_gladiator <gen>
    Set VariableSet SpellEventTrigger[2] = Nosferatu <gen>
    Set VariableSet SpellEventTrigger[3] = Draw_Soul <gen>
    Set VariableSet SpellEventTrigger[4] = Flame_Burst <gen>
    Set VariableSet SpellEventTrigger[5] = Blue_Flames <gen>
    Set VariableSet SpellEventTrigger[6] = Frostbomb <gen>
    Set VariableSet SpellEventTrigger[7] = Detonate <gen>
    Set VariableSet SpellEventTrigger[8] = Craft_Item <gen>
    Set VariableSet SpellEventTrigger[9] = Divine_Intervention <gen>
    Set VariableSet SpellEventTrigger[10] = Mass_Lightning_Shield <gen>
    Set VariableSet SpellEventTrigger[11] = Mass_Entangle <gen>
    Set VariableSet SpellEventTrigger[12] = Monsoon <gen>
    Set VariableSet SpellEventTrigger[13] = Mark_of_Starfall <gen>
    Set VariableSet SpellEventTrigger[14] = Sea_Throw <gen>
    Set VariableSet SpellEventTrigger[15] = Fan_of_Knives_3 <gen>
    Set VariableSet SpellEventTrigger[16] = Magic_TriMissiles <gen>
    Set VariableSet SpellEventTrigger[17] = Boulderskin_First_Use <gen>
    Set VariableSet SpellEventTrigger[18] = Tentacle_Spell <gen>
    Set VariableSet SpellEventTrigger[19] = Transformation_activator <gen>
    Set VariableSet SpellEventTrigger[20] = Shadow_Dash <gen>
    Set VariableSet SpellEventTrigger[21] = LifebloomOnCast <gen>
    Set VariableSet SpellEventTrigger[22] = EarthquakeOnCast <gen>
    Set VariableSet SpellEventTrigger[23] = DisruptorCloudOnCast <gen>
    Set VariableSet SpellEventTrigger[24] = Leech_Mana <gen>
    Set VariableSet SpellEventTrigger[25] = Mind_Control <gen>
    Set VariableSet SpellEventTrigger[26] = Cleansing_Beam <gen>
    Set VariableSet SpellEventTrigger[27] = Meta_Blast <gen>
    Set VariableSet SpellEventTrigger[28] = Item_Discombobulation_Suit <gen>
    Set VariableSet SpellEventTrigger[29] = Iceflash_Golem <gen>
    Set VariableSet SpellEventTrigger[30] = Frostbolt <gen>
    Set VariableSet SpellEventTrigger[31] = Nature_Call <gen>
    Set VariableSet SpellEventTrigger[32] = Netherbalm_First_Activation <gen>
    Set VariableSet SpellEventTrigger[33] = Exorcism <gen>
    Set VariableSet SpellEventTrigger[34] = Pressure_Punch <gen>
    Set VariableSet SpellEventTrigger[35] = Seal_of_Power <gen>
    Set VariableSet SpellEventTrigger[36] = Sop_Call_Comet <gen>
    Set VariableSet SpellEventTrigger[37] = Sop_Teleport <gen>
    Set VariableSet SpellEventTrigger[38] = Item_Refresher_Orb <gen>
    Set VariableSet SpellEventTrigger[39] = Decompose <gen>
    Set VariableSet SpellEventTrigger[40] = Sop_Teleport <gen>
    Set VariableSet SpellEventTrigger[41] = Greater_Affliction <gen>
    Set VariableSet SpellEventTrigger[42] = Mana_Beam <gen>
    Set VariableSet SpellEventTrigger[43] = CycloneCd <gen>
    Set VariableSet SpellEventTrigger[44] = Plasma_Shocks <gen>
    Set VariableSet SpellEventTrigger[45] = Pressure_Punch_item <gen>
    Set VariableSet SpellEventTrigger[46] = Item_Mysterious_Tincture <gen>
    Set VariableSet SpellEventTrigger[47] = Courier_Scrap <gen>
    Set VariableSet SpellEventTrigger[48] = Item_GGrowl_Master_X7 <gen>
    Set VariableSet SpellEventTrigger[49] = Item_Warp_Portal_Shard_Gladiator <gen>
    Set VariableSet SpellEventTrigger[50] = Item_Orbital_Bombardment <gen>
    Set VariableSet SpellEventTrigger[51] = onExcomb_0 <gen>
    Set VariableSet SpellEventTrigger[52] = onExcomb_1 <gen>
    Set VariableSet SpellEventTrigger[53] = onExcomb_2 <gen>
    Set VariableSet SpellEventTrigger[54] = onExcomb_3 <gen>
    Set VariableSet SpellEventTrigger[55] = onExcomb_4 <gen>
    Set VariableSet SpellEventTrigger[56] = onExcomb_5 <gen>
    Set VariableSet SpellEventTrigger[57] = onExcomb_6 <gen>
    Set VariableSet SpellEventTrigger[58] = onExcomb_7 <gen>
    Set VariableSet SpellEventTrigger[59] = onExcomb_8 <gen>
    Set VariableSet SpellEventTrigger[60] = Elemental_Blast <gen>
    Set VariableSet SpellEventTrigger[61] = Hunter_Shot <gen>
    Set VariableSet SpellEventTrigger[62] = Slam <gen>
    Set VariableSet SpellEventTrigger[63] = Combo_Strike <gen>
    Set VariableSet SpellEventTrigger[64] = Execute <gen>
    Set VariableSet SpellEventTrigger[65] = Smash <gen>
    Set VariableSet SpellEventTrigger[66] = Summon_magical_c <gen>
    Set VariableSet SpellEventTrigger[67] = Mage_Blast <gen>
    Set VariableSet SpellEventTrigger[68] = Mystic_Bolt <gen>
    Set VariableSet SpellEventTrigger[69] = Ambush <gen>
    Set VariableSet SpellEventTrigger[70] = Item_Pickbait <gen>
    Set VariableSet SpellEventTrigger[71] = Invisibility <gen>
    Set VariableSet SpellEventTrigger[72] = RaiseDead <gen>
    Set VariableSet SpellEventTrigger[73] = AnimateDead <gen>
    Set VariableSet SpellEventTrigger[74] = Upgrade_Boots <gen>
    Set VariableSet SpellEventTrigger[75] = Upgrade_Bow <gen>
    Set VariableSet SpellEventTrigger[76] = Upgrade_Pendant <gen>
    Set VariableSet SpellEventTrigger[77] = Upgrade_Spellstrike <gen>
    Set VariableSet SpellEventTrigger[78] = Upgrade_WD <gen>
    Set VariableSet SpellEventTrigger[79] = Ship_Artillery <gen>
    Set VariableSet SpellEventTrigger[80] = Barrel_of_Rum <gen>
    Set VariableSet SpellEventTrigger[81] = Upgrade_Jade <gen>
    Set VariableSet SpellEventTrigger[82] = AARejuv <gen>
    Set VariableSet SpellEventTrigger[83] = AAFirebolt <gen>
    Set VariableSet SpellEventTrigger[84] = AARoar <gen>
    Set VariableSet SpellEventTrigger[85] = AAInferno <gen>
    Set VariableSet SpellEventTrigger[86] = AAFrostArmor <gen>
    Set VariableSet SpellEventTrigger[87] = AAForked <gen>
    Set VariableSet SpellEventTrigger[88] = AAChainL <gen>
    Set VariableSet SpellEventTrigger[89] = ABInnervate <gen>
    Set VariableSet SpellEventTrigger[90] = ABHoly_Shield <gen>
    Set VariableSet SpellEventTrigger[91] = ABPhoenix_Strike <gen>
    Set VariableSet SpellEventTrigger[92] = ABFeral_Spirit <gen>
    Set VariableSet SpellEventTrigger[93] = ABForce_of_Nat <gen>
    Set VariableSet SpellEventTrigger[94] = AAWar_Stomp <gen>
    Set VariableSet SpellEventTrigger[95] = ABFaerie_Burn <gen>
    Set VariableSet SpellEventTrigger[96] = ABMolten_Bombs <gen>
    Set VariableSet SpellEventTrigger[97] = ABTornado <gen>
    Set VariableSet SpellEventTrigger[98] = ABCrystal_Field <gen>
    Set VariableSet SpellEventTrigger[99] = Upgrade_Brutalizer <gen>
    Set VariableSet SpellEventTrigger[100] = ACBreathOfFire <gen>
    Set VariableSet SpellEventTrigger[101] = ACFlamestrike <gen>
    Set VariableSet SpellEventTrigger[102] = ACIncinerateSearingArr <gen>
    Set VariableSet SpellEventTrigger[103] = ACIncinerateSearingArr <gen>
    Set VariableSet SpellEventTrigger[104] = onExcomb_give_item <gen>
    Set VariableSet SpellEventTrigger[105] = ADDoubleSpiders <gen>
    Set VariableSet SpellEventTrigger[106] = ADDoubleLavaSpawn <gen>
    Set VariableSet SpellEventTrigger[107] = onExcomb_combine_last <gen>
    Set VariableSet SpellEventTrigger[108] = ADIllusionDrain <gen>
    Set VariableSet SpellEventTrigger[109] = ABAnim_Treants <gen>
    Set VariableSet SpellEventTrigger[110] = Shockwavelvl5 <gen>
    Set VariableSet SpellEventTrigger[111] = HealDuallvl5 <gen>
    Set VariableSet SpellEventTrigger[112] = WatElemlvl5Explo <gen>
    Set VariableSet SpellEventTrigger[113] = BreathOfFrostlvl5 <gen>
    Set VariableSet SpellEventTrigger[114] = SerpentWardlvl5 <gen>
    Set VariableSet SpellEventTrigger[115] = Bloodlustlvl5 <gen>
    Set VariableSet SpellEventTrigger[116] = RainofFlvl4_6 <gen>
    Set VariableSet SpellEventTrigger[117] = Healing_Wave_mastery <gen>
    Set VariableSet SpellEventTrigger[118] = Slimebolt_First_Use_mastery <gen>
    Set VariableSet SpellEventTrigger[119] = Crushing_Wave_mastery <gen>
    Set VariableSet SpellEventTrigger[120] = ADBlizzard <gen>
    Set VariableSet SpellEventTrigger[121] = Healing_Ward_mastery <gen>
    Set VariableSet SpellEventTrigger[122] = ADLightning_Shield <gen>
    Set VariableSet SpellEventTrigger[123] = CTIckTomeOfPower <gen>
    Set VariableSet SpellEventTrigger[124] = ADPurge <gen>
    Set VariableSet SpellEventTrigger[125] = FlameStrike_lvl5 <gen>
    Set VariableSet SpellEventTrigger[126] = CTIckBlink <gen>
    Set VariableSet SpellEventTrigger[127] = CTIckBlink <gen>
    -------- - --------
    Trigger - Run GUI_SpellEvent <gen> (ignoring conditions)
onExcomb give item
  Events
  Conditions
  Actions
    Set VariableSet XcombTempPlayerID2 = (Player number of (Owner of (Triggering unit)))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (SpecsMainHeroOf[XcombTempPlayerID2] is alive) Equal to True
      Then - Actions
        Hero - Give (Item carried by (Triggering unit) in slot 1) to SpecsMainHeroOf[XcombTempPlayerID2]
      Else - Actions
onExcomb 8
  Events
  Conditions
  Actions
    Set VariableSet Integer12 = 8
    Set VariableSet XcombTempPlayerID = (Player number of (Owner of (Triggering unit)))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Owner of (Triggering unit)) Current lumber) Greater than or equal to race_item_wood_value[Integer12]
      Then - Actions
        Player - Add (0 - race_item_wood_value[Integer12]) to (Owner of (Triggering unit)).Current lumber
        Hero - Create ItemArray[Integer12] and give it to (Triggering unit)
      Else - Actions
        Game - Display to (Player group((Owner of (Triggering unit)))) the text: Not enough Ability Points!
onExcomb 7
  Events
  Conditions
  Actions
    Set VariableSet Integer12 = 7
    Set VariableSet XcombTempPlayerID = (Player number of (Owner of (Triggering unit)))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Owner of (Triggering unit)) Current lumber) Greater than or equal to race_item_wood_value[Integer12]
      Then - Actions
        Player - Add (0 - race_item_wood_value[Integer12]) to (Owner of (Triggering unit)).Current lumber
        Hero - Create ItemArray[Integer12] and give it to (Triggering unit)
      Else - Actions
        Game - Display to (Player group((Owner of (Triggering unit)))) the text: Not enough Ability Points!
onExcomb 6
  Events
  Conditions
  Actions
    Set VariableSet Integer12 = 6
    Set VariableSet XcombTempPlayerID = (Player number of (Owner of (Triggering unit)))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Owner of (Triggering unit)) Current lumber) Greater than or equal to race_item_wood_value[Integer12]
      Then - Actions
        Player - Add (0 - race_item_wood_value[Integer12]) to (Owner of (Triggering unit)).Current lumber
        Hero - Create ItemArray[Integer12] and give it to (Triggering unit)
      Else - Actions
        Game - Display to (Player group((Owner of (Triggering unit)))) the text: Not enough Ability Points!
onExcomb 5
  Events
  Conditions
  Actions
    Set VariableSet Integer12 = 5
    Set VariableSet XcombTempPlayerID = (Player number of (Owner of (Triggering unit)))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Owner of (Triggering unit)) Current lumber) Greater than or equal to race_item_wood_value[Integer12]
      Then - Actions
        Player - Add (0 - race_item_wood_value[Integer12]) to (Owner of (Triggering unit)).Current lumber
        Hero - Create ItemArray[Integer12] and give it to (Triggering unit)
      Else - Actions
        Game - Display to (Player group((Owner of (Triggering unit)))) the text: Not enough Ability Points!
onExcomb 4
  Events
  Conditions
  Actions
    Set VariableSet Integer12 = 4
    Set VariableSet XcombTempPlayerID = (Player number of (Owner of (Triggering unit)))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Owner of (Triggering unit)) Current lumber) Greater than or equal to race_item_wood_value[Integer12]
      Then - Actions
        Player - Add (0 - race_item_wood_value[Integer12]) to (Owner of (Triggering unit)).Current lumber
        Hero - Create ItemArray[Integer12] and give it to (Triggering unit)
      Else - Actions