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. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  5. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  6. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  7. The results are out! Check them out.
    Dismiss Notice
  8. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  9. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  10. 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

Warlords Empire 0.41b AI open project.w3x
Variables
Inicialización
Map Begin
FirstScreen
start hash
loading Units Patch
Setting Units patch
Setting Buildings
Setting Race units
Setting Extras
Setting Skills
Quest
hiddingunits
Selecting race
StartingAI
credits1
credits2
credits3
clear
---------------game modals conf------------
infonovice
infowarrior
infowarlord
Melee mode
disnomelee
Range mode
disnorange
Mage mode
disnomage
Tank mode
disnotank
unit mode end
Novicemode
Warriormode
WarlordMode
------------boards---------------
Build Multiboard
timerturno
get vampire
actualiza
debugs
builder
demo1
kill
tunnel
---not ready---
abretunel
entratunel
cierratunnel
Visual Texts
MK
Ptext
Build resources
Thief
Thief Gold
Mtrust text
Thief Kp
upgradeunit
UP
---------recovering-----------
RCV
BUR
TGR
TGS
conquista
owningbuild
Pillage A
Pillage B
Pillage C
AutorebuildA
AutorebuildB
AutorebuildC
Autodestroy
Debbuger
income
SE
gmode
taxing
Tax Neutral
otros
Innate
Ar mode
cameras
droped item
deadvamp
EB
MB
Dies
Settleof
Trainingodd
ranks
SER
FR
SR
TR
FOR
FIR
SIR
Skills
HDD
VS
PI
------------Thumder skills---------------
MP
-------------Sniper skills--------------
SSR
SS
CM
RF
-------------Explosives skills--------------
NB
NA
IBTT
IM
IB
---------------------------
AL
MT
DS
------fallenwarlord--------------
DD
fc
co
---gnoll---
SJ
sn
sen
STA
CB
AC
SH
SI
-----------EtrollsnOrc------------
BMS
BMSc
KU
DKU
VU
LO
LOH
LB
-----------night elfs skills------------
LF
silverslashX
Masterslash
-----------Elvens skills------------
BG
Elven militia
Elven warrior
phoenix fire
-----------Ogre skills------------
Bowling
basher pierce
BasherTxt
KS
-----------Ogre Slam------------
Ogreslam
Ogslamdmg
OgreslamB
VampireOrde
Vampireordecast
Vampireordeloop
VampireordelooB
Vampireordeend
ice storm
Oil flask
grand fire
daytime
nighttime
vampiredead
Dammned Fire
breathdeath
breathdeath back
Deathreplace
breathdeath end
Bonebag
bonebag
bonebagH
bonebagCall
bonebagHCall
Disarm
Disarm Unit
Rearm
Rearm Unit
Brutal Hit
brutal hit
brutal hitA
Ghoul Attck
bat storm
bloodyAura
bloodyAuraoff
battlepressence
Condena
Trapping
holylight
crusadershield
Frenzy
Blood lust
Shadowstrike
blink
blink Hero
Lanza roca
Lanza rocab
batattackeffect
frenzyon
-----------Frenzy Hero---------------
frenzyheroOn
Castfrenzy
provoke
Repel
knock_B
repeler
repelerON
repeler off
Ravager+
ravager
furyon attack
ravager off
Misc
Player Leaves
names city
obstacles
Wall
Wf
AI Common Orders
AI defends
AI Def ON
-------------tower AI--------------
AITowerON
AI CheckTON
AI CastTower
----------Resch-----------------
AI Ends Resch
AI Start Resch
AI ResearchArmor
AI ResearchDamage
AI ResearchHp
AI ResearchTower
------------Army---------------
AI Trainmelee
AI TrainRange
AI TrainMage
AI TrainTank
AI TrainFlying
AI Upgradebar
-------------Attacks--------------
AI Expand attack
AI Weak target
AI Siege attack
AITMM
AI Events
AIFU
AISU
AITF
AIDU
AIDR
Generic AI triggers
detect AI
disable Ai selector
AT
abilitiesOrcAI
SFAI
SEAI
SSAI
SAAI
SBAI
SDAI
SCAI
STAI
SDVAI
SIAI
SRAI
rescatab
shopping
buyorder
buyanks
buyankorder
Recognize
move f rescue
move f rescueb
move f rescuec
AImoveheroG
AIheroscape
owningcastleAi
AIHR
AIHD
AHL
AIThirdcape
AI4
saladino masive
saladino expansion
saladino ataque expansion
saladino investigar
saladino atacar
saladino defender
saladino defender ally
saladino entrenar
End
Removehandles
Defeat teamR
Defeat teamB
win1
cinematicend1
win2
solomode 2
solomode 1
Escribe debajo el código del guión personalizado especial para el mapa. El texto se incluirá en el guión del mapa después de declarar las variables y antes de los códigos de los detonadores.

Enm = udg_Ebony_player[1]
call CreateNUnitsAtLoc( 1, udg_Tower_build[udg_Race[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]], GetOwningPlayer(GetTriggerUnit()), udg_Build_points[udg_Tower_int], bj_UNIT_FACING )
cancel order: ForceUICancelBJ
//===============================For AI Request============================

function Is_struct takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == true )
endfunction

function Ownerfilter takes nothing returns boolean
    local integer n = udg_tplayernumber
    return ( GetOwningPlayer(GetFilterUnit()) == Player(n - 1) )
endfunction

function Hp_ok takes nothing returns boolean
    return ( GetUnitLifePercent(GetFilterUnit()) > udg_min_life )
endfunction



//================== AI Training =====================

function Non_Struct takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction

function Check_AI_numbers takes nothing returns boolean
    local integer n = udg_tplayernumber
    return CountUnitsInGroup(GetUnitsOfPlayerMatching(Player(n), Condition(function Non_Struct))) <= 100 
endfunction


function AiFirstUpgrade takes nothing returns nothing
    local integer n = udg_tplayernumber
    call IssueTrainOrderByIdBJ( GetEnumUnit(), udg_Fupgrade_build[udg_Race[n + 1]] )
    set n = 0
endfunction


function AiSecondUpgrade takes nothing returns nothing
    local integer n = udg_tplayernumber
    call IssueTrainOrderByIdBJ( GetEnumUnit(), udg_Supgrade_build[udg_Race[n + 1]] )
    set n = 0
endfunction


function AiTrainMelee takes nothing returns nothing
    local integer n = udg_tplayernumber
        call IssueTrainOrderByIdBJ( GetEnumUnit(), udg_Mele_Unit[udg_Race[n + 1]] )
    set n = 0
endfunction

function AiTrainMage takes nothing returns nothing
    local integer n = udg_tplayernumber
     call IssueTrainOrderByIdBJ( GetEnumUnit(), udg_Mage_Unit[udg_Race[n + 1]] )
    set n = 0
endfunction

function AiTrainTank takes nothing returns nothing
    local integer n = udg_tplayernumber
    call IssueTrainOrderByIdBJ( GetEnumUnit(), udg_Tank_Unit[udg_Race[n + 1]] )
    set n = 0
endfunction


function AiTrainRange takes nothing returns nothing
    local integer n = udg_tplayernumber
    call IssueTrainOrderByIdBJ( GetEnumUnit(), udg_Range_Unit[udg_Race[n + 1]] )
    set n = 0
endfunction

function AiTrainFlying takes nothing returns nothing
    local integer n = udg_tplayernumber
    call IssueTrainOrderByIdBJ( GetEnumUnit(), udg_Flyng_Unit[udg_Race[n + 1]] )
    set n = 0
endfunction

//=================use two next functions linked============

function FirstBuildingTrain takes integer playernumber, integer order returns nothing
    local unit upon
    local integer c = 1
    set udg_tplayernumber = playernumber
    set udg_AI_army[udg_tplayernumber] = GetUnitsOfPlayerAndTypeId(Player(udg_tplayernumber), udg_Main_build[udg_Race[udg_tplayernumber + 1]])
    if (order == 1) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainMelee)   

    elseif (order == 2) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainRange)   

    elseif (order == 3) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainMage)   

    elseif (order == 4) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainTank)   

    elseif (order == 5) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainFlying)  

    elseif (order == 6) then 
     set upon = GroupPickRandomUnit(udg_AI_army[udg_tplayernumber])
    call SelectUnitForPlayerSingle(upon, Player(udg_tplayernumber) )
    loop
    exitwhen c > 7
    call ForceUICancelBJ( Player(udg_tplayernumber) )
    set c = c + 1
    endloop    
    call IssueTrainOrderByIdBJ( upon, udg_Fupgrade_build[udg_Race[udg_tplayernumber + 1]] )

   endif

    call DestroyGroup (udg_AI_army[udg_tplayernumber])  
    set udg_tplayernumber = 0  
    set upon = null
    set c = 0
endfunction


//=================use two next functions linked============

function SecondBuildingTrain takes integer playernumber, integer order returns nothing
    local unit upon 
    local integer c = 1
    set udg_tplayernumber = playernumber
    set udg_AI_army[udg_tplayernumber] = GetUnitsOfPlayerAndTypeId(Player(udg_tplayernumber), udg_Fupgrade_build[udg_Race[udg_tplayernumber + 1]])
   
   if (order == 1) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainMelee)   

    elseif (order == 2) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainRange)   

    elseif (order == 3) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainMage)   

    elseif (order == 4) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainTank)   

    elseif (order == 5) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainFlying)   
  
    elseif (order == 6) then 
    set upon = GroupPickRandomUnit(udg_AI_army[udg_tplayernumber])
    call SelectUnitForPlayerSingle(upon, Player(udg_tplayernumber) )
    loop
    exitwhen c > 7
    call ForceUICancelBJ( Player(udg_tplayernumber) )
    set c = c + 1
    endloop    
    call IssueTrainOrderByIdBJ( upon, udg_Supgrade_build[udg_Race[udg_tplayernumber + 1]] )

 endif

    call DestroyGroup (udg_AI_army[udg_tplayernumber])  
    set udg_tplayernumber = 0  
    set upon = null
    set c = 0
endfunction


//=================use two next functions linked============

function CastleBuildingTrain takes integer playernumber, integer order returns nothing
    set udg_tplayernumber = playernumber
    set udg_AI_army[udg_tplayernumber] = GetUnitsOfPlayerAndTypeId(Player(udg_tplayernumber), udg_Supgrade_build[udg_Race[udg_tplayernumber + 1]])
   
   if (order == 1) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainMelee)   

    elseif (order == 2) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainRange)   

    elseif (order == 3) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainMage)   

    elseif (order == 4) then 
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainTank)   

    elseif (order == 5) then 
     
     call ForGroup(udg_AI_army[udg_tplayernumber], function AiTrainFlying)   
   endif

    call DestroyGroup (udg_AI_army[udg_tplayernumber])  
    set udg_tplayernumber = 0  

endfunction


//===0000    call ForGroup( udg_AI_army[udg_tplayernumber], function Train2 ) 00000

//==================AI research =================

function ReschArmor takes nothing returns nothing
    call IssueUpgradeOrderByIdBJ( GetEnumUnit(), 'R002' )
endfunction

function ReschDamage takes nothing returns nothing
    call IssueUpgradeOrderByIdBJ( GetEnumUnit(), 'R001' )
endfunction

function ReschLife takes nothing returns nothing
    call IssueUpgradeOrderByIdBJ( GetEnumUnit(), 'R000' )
endfunction

function ReschDefBuild takes nothing returns nothing
    call IssueUpgradeOrderByIdBJ( GetEnumUnit(), 'R004' )
endfunction

//================Linked functions=================
function TechBuildingOrder takes integer playernumber, integer order returns nothing
    set udg_AI_army[playernumber] = GetUnitsOfPlayerAndTypeId(Player(playernumber), udg_Tech_build[udg_Race[playernumber + 1]])
    if (order == 1) then
    call ForGroup(udg_AI_army[playernumber], function ReschArmor)
    elseif (order == 2) then
    call ForGroup(udg_AI_army[playernumber], function ReschDamage)
    elseif (order == 3) then
    call ForGroup(udg_AI_army[playernumber], function ReschLife)
    elseif (order == 4) then
    call ForGroup(udg_AI_army[playernumber], function ReschDefBuild)
    endif
    call DestroyGroup (udg_AI_army[playernumber])
endfunction

//===============================================

function SetMinor takes integer Apl, integer Bpl returns integer
    local integer P1 = GetPlayerUnitCount(ConvertedPlayer(Apl), false)
    local integer P2 = GetPlayerUnitCount(ConvertedPlayer(Bpl), false)
    if ( P1 > P2) then
        return Bpl
    endif
        return Apl
endfunction

//===============================================

function CheckWeakEbony takes integer playernumber returns integer
    local integer c = 1
    local integer t  
    local integer minor
     loop
        exitwhen c > 4
        set t = (GetConvertedPlayerId(udg_Ebony_player[c]) - 1)
        if (t != 0) then
          set minor = SetMinor(playernumber,t)
          set c = c + 1
        else
          set c = c + 1
        endif
    endloop
   return minor
endfunction

function CheckWeakTyr takes integer playernumber returns integer
    local integer c = 1
    local integer t  
    local integer minor
     loop
        exitwhen c > 4
        set t = (GetConvertedPlayerId(udg_tyr_player[c]) - 1)
        if (t != 0) then
          set minor = SetMinor(playernumber,t)
          set c = c + 1
        else
          set c = c + 1
        endif
    endloop
   return minor
endfunction

function CheckAiGold takes player AIPlayer, integer gold returns boolean
    return ( GetPlayerState(AIPlayer, PLAYER_STATE_RESOURCE_GOLD) >= gold ) 
endfunction


function CheckAiKPoints takes player AIPlayer, integer kpoint returns boolean
    return ( GetPlayerState(AIPlayer, PLAYER_STATE_RESOURCE_LUMBER) >= kpoint ) 
endfunction

function CheckAiPlayerRank takes player p, integer kills returns boolean
    return ( GetPlayerScore(p, PLAYER_SCORE_UNITS_KILLED) >= kills )
endfunction

//===============================Massive attack============================
function Mass_Attack takes player Enm, player Own returns nothing
   local integer C = 1
   local integer mon = GetRandomInt(1, 3)
   local location Ep
   local group army
   local group s_army
   local group Enemg


   
    if ( mon != 3) then

           call DestroyGroup (Enemg)
           call DestroyGroup (army)
           call DestroyGroup (s_army)
           call RemoveLocation(Ep) 
        return
    endif
    set Enemg = GetUnitsOfPlayerMatching(Enm, Condition(function Is_struct))
    set Ep = GetUnitLoc(GroupPickRandomUnit(Enemg))
    call DestroyGroup (Enemg)
    set army = GetUnitsOfPlayerMatching(Own, Condition(function Hp_ok))
        loop
        exitwhen C > 10
        set s_army = GetRandomSubGroup(12, army)
        call GroupPointOrderLocBJ( s_army, "attack", Ep )
        call GroupRemoveGroup( s_army, army )
        call DestroyGroup (s_army)
        set C = C + 1
    endloop

    call DestroyGroup (army)
    call RemoveLocation(Ep) 
    set mon = 0
endfunction

function AIattack takes integer playernumber, location target returns nothing
   local group g = GetUnitsOfPlayerMatching(Player(playernumber), Condition(function Hp_ok))
   local group sg
   local integer c = 1
     loop
        exitwhen c > 10
        set sg = GetRandomSubGroup(12, g)
        call GroupPointOrderLocBJ( g, "attack",target)
        call GroupRemoveGroup(sg, g )
        call DestroyGroup (sg)
        set c = c + 1
    endloop
    call DestroyGroup (g)
    call RemoveLocation(target) 
    set c = 0
endfunction

function AIattackb takes integer playernumber, location target returns nothing
   local group g = GetUnitsOfPlayerMatching(Player(playernumber), Condition(function Non_Struct))
   local group sg
   local integer c = 1
     loop
        exitwhen c > 10
        set sg = GetRandomSubGroup(12, g)
        call GroupPointOrderLocBJ( g, "attack",target)
        call GroupRemoveGroup(sg, g )
        call DestroyGroup (sg)
        set c = c + 1
    endloop
    call DestroyGroup (g)
    call RemoveLocation(target) 
    set c = 0
endfunction

//================== AI Expander order =============

function Noself takes integer playernumber returns boolean
    return ( GetFilterPlayer() != Player(playernumber) )
endfunction

function Noally takes integer playernumber returns boolean
    return ( IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), Player(playernumber)) == false )
endfunction

function Is_enemy takes nothing returns boolean
   local integer playernumber = udg_tplayernumber
   return (Is_struct() and Noself(playernumber) and Noally(playernumber))
endfunction

//== local player Pl = Player(6)

function Exp_order takes player Pl, real range returns nothing
   local integer m = GetRandomInt(1, 3)
   local group targetg 
   local location target

   set udg_tplayernumber = GetConvertedPlayerId(Pl)-1
   set targetg = GetUnitsInRangeOfLocMatching(range, GetPlayerStartLocationLoc(Pl), Condition(function Is_enemy))


   if ( m != 3 ) then
      call DestroyGroup(targetg)
      call RemoveLocation (target)   
      return

   elseif ( IsUnitGroupEmptyBJ(targetg) == false ) then
      set target = GetUnitLoc(GroupPickRandomUnit(targetg))
        call AIattack(udg_tplayernumber,target)
   endif

  call RemoveLocation(target)
  call DestroyGroup (targetg)

  set m = 0
  set range = 0
  set Pl = null

endfunction

//======================AI Defending ===============00



function DefOrder takes nothing returns nothing
    local integer n = udg_tplayernumber
    call IssuePointOrderLocBJ( GetEnumUnit(), "attack", udg_target[n] )
    set n = 0
endfunction

function AiDefendOrder takes real range, integer playernumber, unit attacked  returns nothing
    local group g 
    local integer p = playernumber 

    set udg_tplayernumber = playernumber
    set udg_target[p] = GetUnitLoc(attacked)   
    set g = GetUnitsInRangeOfLocMatching(range, udg_target[p], Condition(function Ownerfilter))

    call ForGroup( g, function DefOrder)
    call DestroyGroup (g)
    call RemoveLocation(udg_target[p])

    set udg_tplayernumber = 0
   set p = 0
endfunction

//=========================== AI defending ally ================

function CheckAlly takes unit attacked returns boolean
    local integer n = udg_tplayernumber
    return (( udg_AI_defending_on[n] == false ) and ( IsUnitType(attacked, UNIT_TYPE_STRUCTURE) == true ) and ( IsPlayerAlly(GetOwningPlayer(attacked), Player(n)) == true ))
endfunction

function DefAllyFilter takes nothing returns boolean
    local integer n = udg_tplayernumber
    return (Non_Struct() and  (GetOwningPlayer(GetFilterUnit()) == Player(n - 1)))
endfunction

function DefAllyOrder takes nothing returns nothing
    local integer n = udg_tplayernumber
    call IssuePointOrderLocBJ( GetEnumUnit(), "attack", udg_target[n] )
endfunction

function AIDefendAlly takes real range, integer playernumber, unit attacked returns nothing
    local integer p = playernumber
    set udg_tplayernumber = playernumber

    set udg_target[p] = GetUnitLoc(attacked)
    set udg_AI_army[p] = GetUnitsInRangeOfLocMatching(range, udg_target[p], Condition(function DefAllyFilter))
    if ( IsUnitGroupEmptyBJ(udg_AI_army[p]) == true ) then
        call DestroyGroup (udg_AI_army[p])
        set udg_AI_army[p] = GetUnitsInRangeOfLocMatching(range * 1.5, udg_target[p], Condition(function DefAllyFilter))
    endif
    call ForGroup( udg_AI_army[p], function DefAllyOrder )
    call DestroyGroup (udg_AI_army[p])
    call RemoveLocation(udg_target[p]) 
   set udg_tplayernumber = 0
   set p = 0
endfunction


function Attackweak takes integer playernumber returns nothing
  local integer targetnumber 
 
 if (playernumber <= 4) then
    set targetnumber = CheckWeakEbony(playernumber)
    if (targetnumber == playernumber) then
      set targetnumber = 0
      return
    endif
   else
   set targetnumber = CheckWeakTyr(playernumber) 
    if (targetnumber == playernumber) then
     set targetnumber = 0
     return
    endif
 endif
 
   call Mass_Attack(Player(targetnumber),Player(playernumber))
 set targetnumber = 0
endfunction

function Total_Attack takes player Pl returns nothing
   local integer m = GetRandomInt(1, 3)
   local group targetg 
   local location target

   set udg_tplayernumber = GetConvertedPlayerId(Pl)-1
   set targetg = GetUnitsInRangeOfLocMatching(39999, GetPlayerStartLocationLoc(Pl), Condition(function Is_enemy))


   if ( m != 3 ) then
      call DestroyGroup(targetg)
      call RemoveLocation (target)   
      return

   elseif ( IsUnitGroupEmptyBJ(targetg) == false ) then
      set target = GetUnitLoc(GroupPickRandomUnit(targetg))
        call AIattackb(udg_tplayernumber,target)
   endif
  call RemoveLocation(target)
  call DestroyGroup (targetg)
  set m = 0
  set Pl = null


endfunction
 
function TotalAttack takes integer playernumber returns nothing
  local integer targetnumber 
 
 if (playernumber <= 4) then
    set targetnumber = GetRandomInt(5, 8)
   else
   set targetnumber =  GetRandomInt(1, 4)
 endif
 
   call Total_Attack(Player(targetnumber))
 set targetnumber = 0
endfunction
 
Name Type Is Array Initial Value
Ability_temp abilcode No
actual_income integer Yes
Actual_shop group No
actualbound rect Yes
AI_army group Yes
AI_ASG_F group Yes
AI_ASG_m group Yes
AI_ASG_M group Yes
AI_ASG_R group Yes
AI_ASG_T group Yes
AI_attacking_on boolean Yes
AI_defending_on boolean Yes
AI_exptime real Yes
AI_FU_ON boolean Yes
AI_hash hashtable No
Ai_item item No
AI_loc location No
Ai_raceUnits group No
AI_RSCHng boolean Yes
AI_SU_ON boolean Yes
AI_timers hashtable No
AI_TowerRatio real Yes
AIBattletime real Yes
AIC_AssaultLover real No 60.00
AIC_CityLover real No 4000.00
AIC_CountryLover real No 8000.00
AIC_EmpireLover real No 15000.00
AIC_ExpandLover real No 60.00
AIC_FightLover real No 90.00
AIC_FlyDefault real No 80.00
AIC_FlyHate real No 120.00
AIC_FlyLover real No 40.00
AIC_MageDefault real No 60.00
AIC_MageHate real No 90.00
AIC_MageLover real No 20.00
AIC_MeleDefault real No 30.00
AIC_MeleHate real No 70.00
AIC_MeleLover real No 15.00
AIC_PillageLover boolean Yes
AIC_RangeDefault real No 50.00
AIC_RangeHate real No 90.00
AIC_RangeLover real No 20.00
AIC_RazeLover boolean Yes
AIC_RDefault real No 70.00
AIC_RHate real No 100.00
AIC_RLover real No 50.00
AIC_SiegeLover real No 240.00
AIC_TankDefault real No 70.00
AIC_TankHate real No 100.00
AIC_TankLover real No 25.00
AIC_TowerHate real No 1000.00
AIC_TowerLover real No 400.00
AIC_TowerNormal real No 600.00
AIExpAttackratio real Yes
AIGoldArmor integer Yes
AIGoldDmg integer Yes
AIGoldHp integer Yes
AIGoldState integer Yes
AIKillpState integer Yes
AIKillsState integer Yes
AIMassAttackratio real Yes
AIRangeExp real Yes
AIRangeMass real Yes
AIReschAR real Yes
AIReschDMG real Yes
AIReschHP real Yes
AITrainFlyingRatio real Yes
AITrainMagRatio real Yes
AITrainMeRatio real Yes
AITrainRangeRatio real Yes
AITrainTankRatio real Yes
AIUpgradetime real Yes
Alexander_target location No
AllG group No
AllP location No
AllU unit No
Anibal_target location No
Arca_destruida boolean Yes
archamgepoint1 location No
archamgepointcaster location No
archmagecaster unit No
archmagecurseunit unit No
archmagegroup group No
archmagerect rect No
Arrow_hash hashtable No
Atila_army_1 group No
Atila_target location No
Av_on_group group No
basher_dmg real No
basher_targetpoint location No
basher_txt string No
bashercaster unit No
bashertarget unit No
bat_caster unit No
bat_real real No
bat_storm_count integer No
BMS hashtable No
BMS_C unit No
BMS_G group No
BMS_T location No
bonebag_angle real No
bonebag_caster unit No
bonebag_castp location No
bonebag_target location No
bonebag_targetB location No
bonebag_Utarget unit No
brutal_angle real No
brutal_increment real No 30.00
brutal_tmp location No
brutal_tmp1 location No
brutal_tmp2 location No
brutalHit_target unit No
brutalHit_unit unit No
Builder_temp unit No
buildingpoint location No
builds integer Yes
buy_point location No
buy_shop group No
buy_true boolean No
buy_unit unit No
buyingunit unit No
C_wall integer No
cache hashtable No
cast_obstacle integer No
Caster unit No
Castle_mode_value integer No
Castwall abilcode Yes
Castwall_hash hashtable No
Charguer_Unit unitcode Yes
CHT_L string No
CHT_O string No
cont integer No
Cont_ai integer No
count_a integer No
count_b integer No
Cu_order string No
D_item item No
Damned_fire_caster unit No
Dangle real Yes
Dead_time boolean No
dead_tower_point location No
death_point location No
death_t timer No
Dennygroup group No
DenUnit unit No
DIgroup group Yes
distancia real Yes
distancia_b real Yes
Dpoint location No
DS_ang real No
DS_ang2 real No
DS_c unit No
DS_Dst real No
DS_g group No
DS_g2 group No
DS_gt group No
DS_p location No
DS_p2 location No
DS_p3 location No
DS_t unit No
Dscale real Yes
Ebony_inc integer No
Ebony_player player Yes
EbonyForces integer No
egc group No
egh group No
egv group No
Enemy_Ebony_target group No
Enemy_tyr_target group No
ExitTunnel_unit unit Yes
FA real No
fake_innate abilcode Yes
flask_attaking unit No
flask_group group No
flask_unit_point location No
flask_unit_pointB location No
Flyng_Unit unitcode Yes
FoodareaT rect No
FoodGroup group No
fortress_mode_value integer No
free_contador integer No
Fupgrade_build unitcode Yes
gmode trigger No
Grupo_rescate group No
Guard2_Unit unitcode Yes
Guard3_Unit unitcode Yes
Guard_Unit unitcode Yes
hasst boolean Yes
Have_mageW boolean Yes
Have_meleeW boolean Yes
Have_rangeW boolean Yes
Have_tankW boolean Yes
HD boolean Yes
hero_esc group No
HG group No
hiddengroup group No
hidetax boolean Yes
HR unit Yes
IB_R real No
IB_U unit No
IB_X real No
IB_Y real No
ice_chaos_point location No
ice_chaos_region rect No
ice_chaos_timer timer No
ice_time real No
Iconpatch string Yes
Icont integer No
IM_BG group No
IM_BP location No
Inc_armor integer No 50
Inc_dmg integer No 75
Inc_hp integer No 75
infogame string No . Type -gmode for see details about currently game mode.
Init_timer timer No
Innate abilcode Yes
Innate_Ability hashtable No
Innate_counter integer Yes
Innate_group group Yes
Innate_id integer No
INTW integer No
ISH hashtable No
IU unit No
Juana_target location No
Killer_temp integer No
kiss_value real No
kissed_unit unit No
Kissing_life real No
kissing_unit unit No
Knock_angle real No
Knock_attacked unit No
knock_increment real No -40.00
Knock_tmp1 location No
Knock_tmp2 location No
Knock_tmp3 location No
knock_unit unit No
kunyonya_group group No
level_bat integer No
level_batstorm real No
Lightc hashtable No
Load_U hashtable No
mage_on boolean No
Mage_Unit unitcode Yes
Main_build unitcode Yes
Mele_Unit unitcode Yes
melee_on boolean No
min_life real No 90.00
mission1 quest No
ModeC hashtable No
Modetext string No
moneda integer No
MP hashtable No
Mtrust real No
Mtrustr real No
Mtrustt real No
muerte real Yes
Muertes_1 real No
Muertes_2 real No
Muertes_3 real No
Muertes_4 real No
Muertes_5 real No
Muertes_6 real No
Muertes_7 real No
Muertes_8 real No
NBL integer No
new_point location No
ngc group No
ngh group No
ngv group No
Novice_On boolean No
Obs_loc location No
Obstacles abilcode Yes
obstacles_hash hashtable No
Obuy_unit unit No
ogc group No
ogh group No
Ogreslam_effect effect No
Ogslam_angle real No
Ogslam_atkedpoint location No
Ogslam_atkpoint location No
Ogslam_Atkunit unit No
ogslam_cont integer No 31
Ogslam_destinypoint location No
Ogslam_increment real No 35.00
Ogslam_Targetunit unit No
Ogslamint integer No
Ogslamtxt string No
ogv group No
Otbuild unitcode Yes
owned_Main unitcode Yes
owned_second unitcode Yes
owned_third unitcode Yes
Ownhash hashtable No
pbuild location No
Percival_scape group No
pillager unit No
Player_Ai player Yes
Player_color string Yes
player_count integer No
player_online integer No
Player_Race player No
Player_rank string Yes |cffffcc00Novice|r
Player_ready boolean Yes
provoke_on boolean No
punto_construccion location No
Q_Commands string No
Q_Instructions string No
Q_Wincondition string No
Race integer Yes
Rand_innate integer No
rand_point location No
Random_trash unit No
Random_trashP location No
Randomholy integer No
range_on boolean No
Range_Unit unitcode Yes
ravager_count integer No
ravager_end integer No
ravager_on boolean Yes
ravager_player integer Yes
ravager_timer timer Yes
ravager_unit unit Yes
rect_p location No
Relic1_p location No
Relic2_p location No
repel_count integer No
repel_end integer No
repel_on boolean Yes
repel_player integer Yes
repel_timer timer Yes
repel_unit unit Yes
rescate_count integer No
rescate_countB integer No
Saladino_army group No
Saladino_army1 group No
Saladino_exp group No
Saladino_target location No
saladinobajoataque boolean No
Save_U hashtable No
Selected_item item No
setting_on boolean No
settle unit Yes
settlevent boolean Yes
sgc group No
sgh group No
sgv group No
Shop_build unitcode Yes
shop_near boolean No
shop_zone rect Yes
si_innate integer No
Siege_Unit unitcode Yes
Skills_list hashtable No
SNP hashtable No
solo_on boolean No
sound_Now sound No
SR real No
SSR hashtable No
SSRU unit No
SStriked_unit unit No
ST hashtable No
STE string No Our zone is safe now, check your tech building to install your settlement.!!!
Stronghold_mode_Value integer No
SU unit No
SUA real No
Succubus_esc group No
summoner_bat player No
Supgrade_build unitcode Yes
Surfer_angle real No
Surfer_arrow unit No
surfer_arrow group No
Surfer_dist real No
Surfer_link lightning No
Surfer_Lt location No
Surfer_on boolean No
Surfer_p1 location No
Surfer_p2 location No
Surfer_p3 location No
Surfer_unit unit No
Surfer_unl boolean No
TAIdef integer No
tank_on boolean No
Tank_Unit unitcode Yes
target location Yes
Tarjeted_Trash unit No
Tarjeted_trashP location No
tax1 integer Yes
tax2 integer Yes
tax3 integer Yes
tct integer No
Tech_build unitcode Yes
Temp_group1 group No
Temp_group2 group No
Temp_group3 group No
temp_point location No
temp_point2 location No
temp_region rect No
temp_unit unit No
tempdest destructable No
TempPN integer No
TGE string No Your army clams you: We need train to be more powerfull. Go to the tech house and set your training portal!.
TGR boolean Yes
tgroup group No
thief_gold_A integer No
thief_kp_A integer No
timer timer No
Timer_turno integer No
Tower_build unitcode Yes
tower_in_rect boolean Yes
Tower_int integer No
tower_min real No 39999.00
Tower_next unit Yes
Tower_p location No
tower_rect rect No
tower_tmp real No
tpg force No
tplayernumber integer No
tr timer No
Tunnel_on boolean Yes
turno integer No
tyr_player player Yes
TyrForces integer No
unitmode timer No
Unitstoremove group No
UP_Dtrange integer No
UP_effect string Yes
UP_loadint integer No
UP_loadtype integer No
UP_rank integer No
utr unitcode No
vampire_group group No
Vampire_pos location No
Vampire_rot location No
vampire_unit unit No
VampireOrde_caster unit No
VampireOrde_face real No
VampireOrde_group group No
VampireOrde_pointa location No
VampireOrde_pointc location No
VampireOrde_pointS location No
VampireOrde_pointX location No
VampireOrde_pointY location No
VampireOrde_pointZ location No
VampireOrde_rect rect No
VampireOrde_timer timer No
VampireOrde_variant1 real No
Vampiretemp_caster unit No
victory_B real No
victory_R real No
vudu_dmg real No
vudu_group group No
vudu_unit unit No
Walldoodad destructablecode Yes
walltype unitcode Yes
Warlord_on boolean No
Warrior_on boolean No
waves hashtable No
wcounter integer No
wdoodad integer No
weak_target boolean Yes
Xmax real No
Xmin real No
Ymax real No
Ymin real No

function Trig_Map_Begin_Actions takes nothing returns nothing
 local integer c = 1
 local integer d = 1
 local integer e = 5


    set udg_Xmin = GetRectMinX(GetPlayableMapRect())
    set udg_Xmax = GetRectMaxX(GetPlayableMapRect())
    set udg_Ymin = GetRectMinY(GetPlayableMapRect())
    set udg_Ymax = GetRectMaxY(GetPlayableMapRect())
    call SetTimeOfDay( 5.30 )
    call TriggerSleepAction( 0.20 )
    call ShowUnitHide( gg_unit_n01B_0146 )
    call ShowUnitHide( gg_unit_n01B_0147 )
    call ShowUnitHide( gg_unit_n01B_0148 )
    call ShowUnitHide( gg_unit_n01B_0153 )
    call ShowUnitHide( gg_unit_n01B_0154 )
    call ShowUnitHide( gg_unit_n01B_0155 )
    call ShowUnitHide( gg_unit_n01B_0156 )
    call ShowUnitHide( gg_unit_n01B_0177 )



    set udg_turno = 1
    set udg_Timer_turno = 20
    set udg_setting_on = true

    loop
        exitwhen c > 8
        if (GetPlayerSlotState(ConvertedPlayer(c)) == PLAYER_SLOT_STATE_PLAYING) then
            set udg_player_online = ( udg_player_online + 1 )
            call SetPlayerFlagBJ( PLAYER_STATE_GIVES_BOUNTY, true, ConvertedPlayer(c) )
            set udg_actualbound[c] = RectFromCenterSizeBJ(GetPlayerStartLocationLoc(ConvertedPlayer(c)), 900.00, 900.00)
            call SetPlayerStateBJ( ConvertedPlayer(c), PLAYER_STATE_RESOURCE_GOLD, 100 )
            call SetPlayerAbilityAvailableBJ( false, 'A06D', ConvertedPlayer(c) )
            call SetPlayerAbilityAvailableBJ( false, 'A06J', ConvertedPlayer(c) )
            call SetPlayerAbilityAvailableBJ( false, 'A06M', ConvertedPlayer(c) )
        else
        endif
        set c = c + 1
    endloop

    loop
        exitwhen d > 4
        if (GetPlayerSlotState(ConvertedPlayer(d)) == PLAYER_SLOT_STATE_PLAYING) then
            set udg_TyrForces = ( udg_TyrForces + 1 )
            set udg_tyr_player[udg_TyrForces] = ConvertedPlayer(d)
        else
            set udg_victory_R = ( udg_victory_R + 1 )
        endif
        set d = d + 1
    endloop

    loop
        exitwhen e > 8
        if (GetPlayerSlotState(ConvertedPlayer(e)) == PLAYER_SLOT_STATE_PLAYING ) then
            set udg_EbonyForces = ( udg_EbonyForces + 1 )
            set udg_Ebony_player[udg_EbonyForces] = ConvertedPlayer(e)
        else
            set udg_victory_B = ( udg_victory_B + 1 )
        endif
        set e = e + 1
    endloop
    set udg_Player_color[1] = "|cffff0000"
    set udg_Player_color[2] = "|cff0000cc"
    set udg_Player_color[3] = "|cff1ce6b9"
    set udg_Player_color[4] = "|cff003399"
    set udg_Player_color[5] = "|cffffff00"
    set udg_Player_color[6] = "|cfff29400"
    set udg_Player_color[7] = "|cff009036"
    set udg_Player_color[8] = "|cfff19fc1"
    call SetPlayerColorBJ( Player(0), PLAYER_COLOR_RED, true )
    call SetPlayerColorBJ( Player(1), PLAYER_COLOR_BLUE, true )
    call SetPlayerColorBJ( Player(2), PLAYER_COLOR_CYAN, true )
    call SetPlayerColorBJ( Player(3), PLAYER_COLOR_PURPLE, true )
    call SetPlayerColorBJ( Player(4), PLAYER_COLOR_YELLOW, true )
    call SetPlayerColorBJ( Player(5), PLAYER_COLOR_ORANGE, true )
    call SetPlayerColorBJ( Player(6), PLAYER_COLOR_GREEN, true )
    call SetPlayerColorBJ( Player(7), PLAYER_COLOR_PINK, true )
    set udg_Relic1_p = GetUnitLoc(gg_unit_n001_0079)
    set udg_Relic2_p = GetUnitLoc(gg_unit_n001_0086)
endfunction

//===========================================================================
function InitTrig_Map_Begin takes nothing returns nothing
    set gg_trg_Map_Begin = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Map_Begin, function Trig_Map_Begin_Actions )
endfunction

 
function Trig_FirstScreen_Actions takes nothing returns nothing
    local integer c = 1
    set udg_temp_point = GetRectCenter(gg_rct_RaceRect)
    call StartTimerBJ( udg_unitmode, false, 15.00 )
    loop
        exitwhen c > 8
        call PanCameraToTimedLocForPlayer( ConvertedPlayer(c), udg_temp_point, 0 )
        set c = c + 1
    endloop
  set c = 0
    call RemoveLocation(udg_temp_point)
    call TriggerSleepAction( 1.00 )
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_3149" )
endfunction

//===========================================================================
function InitTrig_FirstScreen takes nothing returns nothing
    set gg_trg_FirstScreen = CreateTrigger(  )
    call TriggerAddAction( gg_trg_FirstScreen, function Trig_FirstScreen_Actions )
endfunction

 
function Trig_start_hash_Actions takes nothing returns nothing
    call StartTimerBJ( udg_Init_timer, false, 60.00 )
    call CreateTimerDialogBJ( GetLastCreatedTimerBJ(), "TRIGSTR_5492" )
    call TimerDialogDisplayBJ( true, GetLastCreatedTimerDialogBJ() )
    // Enabling Data storing (work fine this?)

    set udg_cache = InitHashtableBJ(  )
    set udg_Lightc = InitHashtableBJ(  )
    set udg_Save_U = InitHashtableBJ(  )
    set udg_Load_U = InitHashtableBJ(  )
    set udg_ModeC = InitHashtableBJ(  )
    set udg_waves = InitHashtableBJ(  )
    set udg_Arrow_hash = InitHashtableBJ(  )
    set udg_Skills_list = InitHashtableBJ(  )
    set udg_Innate_Ability = InitHashtableBJ(  )
    set udg_obstacles_hash = InitHashtableBJ(  )
    set udg_Castwall_hash = InitHashtableBJ(  )
    set udg_ST = InitHashtableBJ(  )
    set udg_SNP = InitHashtableBJ(  )
    set udg_ISH = InitHashtableBJ(  )
    set udg_SSR = InitHashtableBJ(  )
    set udg_MP = InitHashtableBJ(  )
    set udg_BMS = InitHashtableBJ(  )
    set udg_AI_hash = InitHashtableBJ(  )
    set udg_AI_timers = InitHashtableBJ(  )
    set udg_Ownhash = InitHashtableBJ(  )

    call DestroyTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_start_hash takes nothing returns nothing
    set gg_trg_start_hash = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_start_hash, 0.50 )
    call TriggerAddAction( gg_trg_start_hash, function Trig_start_hash_Actions )
endfunction

 
save unit type | world nexus = 1 ( this work saving same key ids in save_U table hash with next upgrade unit)
loading Units Patch
  Events
    Time - Elapsed game time is 1.70 seconds
  Conditions
  Actions
    -------- High melee units --------
    Hashtable - Save 1 as 1 of (Key (String(Captain))) in Load_U
    Hashtable - Save 2 as 1 of (Key (String(Phoenix Knight))) in Load_U
    Hashtable - Save 3 as 1 of (Key (String(Dwarven Leader))) in Load_U
    Hashtable - Save 4 as 1 of (Key (String(Brutal Grunt))) in Load_U
    Hashtable - Save 5 as 1 of (Key (String(Tirain Kobold))) in Load_U
    Hashtable - Save 6 as 1 of (Key (String(Dark Stalker))) in Load_U
    Hashtable - Save 7 as 1 of (Key (String(Skeleton Champion))) in Load_U
    Hashtable - Save 8 as 1 of (Key (String(Warden (Ne Melee)))) in Load_U
    Hashtable - Save 9 as 1 of (Key (String(Smirking Thief (third)))) in Load_U
    Hashtable - Save 10 as 1 of (Key (String(Troll Desolator (melee)))) in Load_U
    -------- Basic melee units --------
    Hashtable - Save 11 as 1 of (Key (String(Soldier))) in Load_U
    Hashtable - Save 12 as 1 of (Key (String(Elven Militia (em)))) in Load_U
    Hashtable - Save 13 as 1 of (Key (String(Dwarf))) in Load_U
    Hashtable - Save 14 as 1 of (Key (String(Grunt))) in Load_U
    Hashtable - Save 15 as 1 of (Key (String(Kobold))) in Load_U
    Hashtable - Save 16 as 1 of (Key (String(Fallen Villager))) in Load_U
    Hashtable - Save 17 as 1 of (Key (String(Skeleton))) in Load_U
    Hashtable - Save 18 as 1 of (Key (String(Sentinel (Ne Melee)))) in Load_U
    Hashtable - Save 19 as 1 of (Key (String(Bandit (base)))) in Load_U
    Hashtable - Save 20 as 1 of (Key (String(Dark Troll (melee)))) in Load_U
    -------- Medium melee units --------
    Hashtable - Save 21 as 1 of (Key (String(Major))) in Load_U
    Hashtable - Save 22 as 1 of (Key (String(Elven Warrior))) in Load_U
    Hashtable - Save 23 as 1 of (Key (String(Dwarven Warrior))) in Load_U
    Hashtable - Save 24 as 1 of (Key (String(Heavy Grunt))) in Load_U
    Hashtable - Save 25 as 1 of (Key (String(Kobold Geomancer))) in Load_U
    Hashtable - Save 26 as 1 of (Key (String(Vampire))) in Load_U
    Hashtable - Save 27 as 1 of (Key (String(Skeleton Warrior))) in Load_U
    Hashtable - Save 28 as 1 of (Key (String(High Sentinel (Ne Melee)))) in Load_U
    Hashtable - Save 29 as 1 of (Key (String(Thruan (Second)))) in Load_U
    Hashtable - Save 30 as 1 of (Key (String(Dark Hunter (melee)))) in Load_U
    -------- high range units --------
    Hashtable - Save 31 as 1 of (Key (String(Crossbowman))) in Load_U
    Hashtable - Save 32 as 1 of (Key (String(Hunter))) in Load_U
    Hashtable - Save 33 as 1 of (Key (String(Sniper))) in Load_U
    Hashtable - Save 34 as 1 of (Key (String(Blade Master (range)))) in Load_U
    Hashtable - Save 35 as 1 of (Key (String(Gnoll Assasin))) in Load_U
    Hashtable - Save 36 as 1 of (Key (String(Demoness))) in Load_U
    Hashtable - Save 37 as 1 of (Key (String(Reaver))) in Load_U
    Hashtable - Save 38 as 1 of (Key (String(Night Stalker))) in Load_U
    Hashtable - Save 39 as 1 of (Key (String(Killer (Third)))) in Load_U
    Hashtable - Save 40 as 1 of (Key (String(Ravager (range)))) in Load_U
    -------- Basic range units --------
    Hashtable - Save 41 as 1 of (Key (String(Archer (human)))) in Load_U
    Hashtable - Save 42 as 1 of (Key (String(Archer))) in Load_U
    Hashtable - Save 43 as 1 of (Key (String(Coltman))) in Load_U
    Hashtable - Save 44 as 1 of (Key (String(Edge (range)))) in Load_U
    Hashtable - Save 45 as 1 of (Key (String(Sneak Gnoll))) in Load_U
    Hashtable - Save 46 as 1 of (Key (String(Succubus))) in Load_U
    Hashtable - Save 47 as 1 of (Key (String(Skeletal Archer))) in Load_U
    Hashtable - Save 48 as 1 of (Key (String(Night archer))) in Load_U
    Hashtable - Save 49 as 1 of (Key (String(Rogue (base)))) in Load_U
    Hashtable - Save 50 as 1 of (Key (String(Troll (range)))) in Load_U
    -------- medium range units --------
    Hashtable - Save 51 as 1 of (Key (String(Archer Master))) in Load_U
    Hashtable - Save 52 as 1 of (Key (String(Ranger))) in Load_U
    Hashtable - Save 53 as 1 of (Key (String(Rifleman))) in Load_U
    Hashtable - Save 54 as 1 of (Key (String(Edge Warrior (range)))) in Load_U
    Hashtable - Save 55 as 1 of (Key (String(Hunter Gnoll))) in Load_U
    Hashtable - Save 56 as 1 of (Key (String(Dark Maiden))) in Load_U
    Hashtable - Save 57 as 1 of (Key (String(Skeletal hunter))) in Load_U
    Hashtable - Save 58 as 1 of (Key (String(Night Hunter))) in Load_U
    Hashtable - Save 59 as 1 of (Key (String(Assasin (second)))) in Load_U
    Hashtable - Save 60 as 1 of (Key (String(Berseker Troll (range)))) in Load_U
    -------- high mage units --------
    Hashtable - Save 61 as 1 of (Key (String(Archmage (mage)))) in Load_U
    Hashtable - Save 62 as 1 of (Key (String(Warcaster))) in Load_U
    Hashtable - Save 63 as 1 of (Key (String(TNT Team))) in Load_U
    Hashtable - Save 64 as 1 of (Key (String(Farseer (orc mage)))) in Load_U
    Hashtable - Save 65 as 1 of (Key (String(Granite Golem))) in Load_U
    Hashtable - Save 66 as 1 of (Key (String(Dark Princess))) in Load_U
    Hashtable - Save 67 as 1 of (Key (String(Necromancer))) in Load_U
    Hashtable - Save 68 as 1 of (Key (String(Arcane Master (Ne Mage)))) in Load_U
    Hashtable - Save 69 as 1 of (Key (String(Impostor))) in Load_U
    Hashtable - Save 70 as 1 of (Key (String(Master of Pets))) in Load_U
    -------- basic mage units --------
    Hashtable - Save 71 as 1 of (Key (String(Magician (mage)))) in Load_U
    Hashtable - Save 72 as 1 of (Key (String(Sorceress))) in Load_U
    Hashtable - Save 73 as 1 of (Key (String(Powder Team))) in Load_U
    Hashtable - Save 74 as 1 of (Key (String(Servant (orc Mage)))) in Load_U
    Hashtable - Save 75 as 1 of (Key (String(Earth Golem))) in Load_U
    Hashtable - Save 76 as 1 of (Key (String(Fallen Maiden))) in Load_U
    Hashtable - Save 77 as 1 of (Key (String(Warlock))) in Load_U
    Hashtable - Save 78 as 1 of (Key (String(Druid (Ne Mage)))) in Load_U
    Hashtable - Save 79 as 1 of (Key (String(Fallen Priest))) in Load_U
    Hashtable - Save 80 as 1 of (Key (String(Macumba))) in Load_U
    -------- Medium mage units --------
    Hashtable - Save 81 as 1 of (Key (String(Wizzard (mage)))) in Load_U
    Hashtable - Save 82 as 1 of (Key (String(Superior Sorceress))) in Load_U
    Hashtable - Save 83 as 1 of (Key (String(Mortar Team))) in Load_U
    Hashtable - Save 84 as 1 of (Key (String(Shaman (orc mage)))) in Load_U
    Hashtable - Save 85 as 1 of (Key (String(Stone Golem))) in Load_U
    Hashtable - Save 86 as 1 of (Key (String(Vamp))) in Load_U
    Hashtable - Save 87 as 1 of (Key (String(Master Warlock))) in Load_U
    Hashtable - Save 88 as 1 of (Key (String(Arcane Druid (Ne Mage)))) in Load_U
    Hashtable - Save 89 as 1 of (Key (String(Acolyte))) in Load_U
    Hashtable - Save 90 as 1 of (Key (String(Witchdoctor))) in Load_U
    -------- High tank units --------
    Hashtable - Save 91 as 1 of (Key (String(Knight))) in Load_U
    Hashtable - Save 92 as 1 of (Key (String(Bloody Calvary (tank)))) in Load_U
    Hashtable - Save 93 as 1 of (Key (String(Thunder Lord (tank)))) in Load_U
    Hashtable - Save 94 as 1 of (Key (String(Devastator (tank)))) in Load_U
    Hashtable - Save 95 as 1 of (Key (String(Big Boss))) in Load_U
    Hashtable - Save 96 as 1 of (Key (String(Count Vampire))) in Load_U
    Hashtable - Save 97 as 1 of (Key (String(Ghoul))) in Load_U
    Hashtable - Save 98 as 1 of (Key (String(Master Huntress))) in Load_U
    Hashtable - Save 99 as 1 of (Key (String(Dark Knight (tank 3 )))) in Load_U
    Hashtable - Save 100 as 1 of (Key (String(Implacable (tank)))) in Load_U
    -------- Basic tank units --------
    Hashtable - Save 101 as 1 of (Key (String(Light Calvary))) in Load_U
    Hashtable - Save 102 as 1 of (Key (String(High Infantry (tank)))) in Load_U
    Hashtable - Save 103 as 1 of (Key (String(Mountain Dwarf (tank)))) in Load_U
    Hashtable - Save 104 as 1 of (Key (String(Raider (tank)))) in Load_U
    Hashtable - Save 105 as 1 of (Key (String(Ogre))) in Load_U
    Hashtable - Save 106 as 1 of (Key (String(Elite Vampire))) in Load_U
    Hashtable - Save 107 as 1 of (Key (String(Zombie))) in Load_U
    Hashtable - Save 108 as 1 of (Key (String(Huntress))) in Load_U
    Hashtable - Save 109 as 1 of (Key (String(Renegade (tank1)))) in Load_U
    Hashtable - Save 110 as 1 of (Key (String(Headhunter (tank)))) in Load_U
    -------- Medium tank units --------
    Hashtable - Save 111 as 1 of (Key (String(Calvary))) in Load_U
    Hashtable - Save 112 as 1 of (Key (String(High Calvary (tank)))) in Load_U
    Hashtable - Save 113 as 1 of (Key (String(Steelbreaker (tank)))) in Load_U
    Hashtable - Save 114 as 1 of (Key (String(Wolfryder (tank)))) in Load_U
    Hashtable - Save 115 as 1 of (Key (String(Ogre Boss))) in Load_U
    Hashtable - Save 116 as 1 of (Key (String(Vampire Impaler))) in Load_U
    Hashtable - Save 117 as 1 of (Key (String(Strong Zombie))) in Load_U
    Hashtable - Save 118 as 1 of (Key (String(Huntress Leader))) in Load_U
    Hashtable - Save 119 as 1 of (Key (String(Oppressor (tank2 )))) in Load_U
    Hashtable - Save 120 as 1 of (Key (String(Headhunter Berserk (tank)))) in Load_U
save unit type | link from Load_U to save_U = 1 ( this work saving same key ids in load_U table hash with root unit)
Setting Units patch
  Events
    Time - Elapsed game time is 1.60 seconds
  Conditions
  Actions
    -------- hero melee units --------
    Hashtable - Save (String(Templar Warlord)) as 1 of 1 in Save_U
    Hashtable - Save (String(Phoenix Warlord)) as 1 of 2 in Save_U
    Hashtable - Save (String(Dwarf Warlord)) as 1 of 3 in Save_U
    Hashtable - Save (String(Orc Warlord)) as 1 of 4 in Save_U
    Hashtable - Save (String(Kobold Warlord)) as 1 of 5 in Save_U
    Hashtable - Save (String(Vampire Warlord)) as 1 of 6 in Save_U
    Hashtable - Save (String(Skeleton Warlord)) as 1 of 7 in Save_U
    Hashtable - Save (String(Warden Warlord)) as 1 of 8 in Save_U
    Hashtable - Save (String(Thief Warlord)) as 1 of 9 in Save_U
    Hashtable - Save (String(Troll Warlord (melee))) as 1 of 10 in Save_U
    -------- Medium melee units --------
    Hashtable - Save (String(Major)) as 1 of 11 in Save_U
    Hashtable - Save (String(Elven Warrior)) as 1 of 12 in Save_U
    Hashtable - Save (String(Dwarven Warrior)) as 1 of 13 in Save_U
    Hashtable - Save (String(Heavy Grunt)) as 1 of 14 in Save_U
    Hashtable - Save (String(Kobold Geomancer)) as 1 of 15 in Save_U
    Hashtable - Save (String(Vampire)) as 1 of 16 in Save_U
    Hashtable - Save (String(Skeleton Warrior)) as 1 of 17 in Save_U
    Hashtable - Save (String(High Sentinel (Ne Melee))) as 1 of 18 in Save_U
    Hashtable - Save (String(Thruan (Second))) as 1 of 19 in Save_U
    Hashtable - Save (String(Dark Hunter (melee))) as 1 of 20 in Save_U
    -------- High melee units --------
    Hashtable - Save (String(Captain)) as 1 of 21 in Save_U
    Hashtable - Save (String(Phoenix Knight)) as 1 of 22 in Save_U
    Hashtable - Save (String(Dwarven Leader)) as 1 of 23 in Save_U
    Hashtable - Save (String(Brutal Grunt)) as 1 of 24 in Save_U
    Hashtable - Save (String(Tirain Kobold)) as 1 of 25 in Save_U
    Hashtable - Save (String(Dark Stalker)) as 1 of 26 in Save_U
    Hashtable - Save (String(Skeleton Champion)) as 1 of 27 in Save_U
    Hashtable - Save (String(Warden (Ne Melee))) as 1 of 28 in Save_U
    Hashtable - Save (String(Smirking Thief (third))) as 1 of 29 in Save_U
    Hashtable - Save (String(Troll Desolator (melee))) as 1 of 30 in Save_U
    -------- range Heroes units --------
    Hashtable - Save (String(Shooter Warlord)) as 1 of 31 in Save_U
    Hashtable - Save (String(Hunter Warlord)) as 1 of 32 in Save_U
    Hashtable - Save (String(Sniper Warlord)) as 1 of 33 in Save_U
    Hashtable - Save (String(Blade Warlord)) as 1 of 34 in Save_U
    Hashtable - Save (String(Sneak Warlord)) as 1 of 35 in Save_U
    Hashtable - Save (String(Succubus Warlord)) as 1 of 36 in Save_U
    Hashtable - Save (String(Reaver Warlord)) as 1 of 37 in Save_U
    Hashtable - Save (String(Night Warlord (ranged))) as 1 of 38 in Save_U
    Hashtable - Save (String(Assasin Warlord)) as 1 of 39 in Save_U
    Hashtable - Save (String(Ravager Warlord (range))) as 1 of 40 in Save_U
    -------- Medium range units --------
    Hashtable - Save (String(Archer Master)) as 1 of 41 in Save_U
    Hashtable - Save (String(Ranger)) as 1 of 42 in Save_U
    Hashtable - Save (String(Rifleman)) as 1 of 43 in Save_U
    Hashtable - Save (String(Edge Warrior (range))) as 1 of 44 in Save_U
    Hashtable - Save (String(Hunter Gnoll)) as 1 of 45 in Save_U
    Hashtable - Save (String(Dark Maiden)) as 1 of 46 in Save_U
    Hashtable - Save (String(Skeletal hunter)) as 1 of 47 in Save_U
    Hashtable - Save (String(Night Hunter)) as 1 of 48 in Save_U
    Hashtable - Save (String(Assasin (second))) as 1 of 49 in Save_U
    Hashtable - Save (String(Berseker Troll (range))) as 1 of 50 in Save_U
    -------- High range units --------
    Hashtable - Save (String(Crossbowman)) as 1 of 51 in Save_U
    Hashtable - Save (String(Hunter)) as 1 of 52 in Save_U
    Hashtable - Save (String(Sniper)) as 1 of 53 in Save_U
    Hashtable - Save (String(Blade Master (range))) as 1 of 54 in Save_U
    Hashtable - Save (String(Gnoll Assasin)) as 1 of 55 in Save_U
    Hashtable - Save (String(Demoness)) as 1 of 56 in Save_U
    Hashtable - Save (String(Reaver)) as 1 of 57 in Save_U
    Hashtable - Save (String(Night Stalker)) as 1 of 58 in Save_U
    Hashtable - Save (String(Killer (Third))) as 1 of 59 in Save_U
    Hashtable - Save (String(Ravager (range))) as 1 of 60 in Save_U
    -------- Mage Heroes units --------
    Hashtable - Save (String(Mage Warlord)) as 1 of 61 in Save_U
    Hashtable - Save (String(Sorceress Warlord)) as 1 of 62 in Save_U
    Hashtable - Save (String(Explosive Warlords)) as 1 of 63 in Save_U
    Hashtable - Save (String(Lightning Warlord)) as 1 of 64 in Save_U
    Hashtable - Save (String(Golem Warlord)) as 1 of 65 in Save_U
    Hashtable - Save (String(Vamp Warlord)) as 1 of 66 in Save_U
    Hashtable - Save (String(Lich Warlord)) as 1 of 67 in Save_U
    Hashtable - Save (String(Druid Warlord (Ne mage))) as 1 of 68 in Save_U
    Hashtable - Save (String(Fallen Warlord)) as 1 of 69 in Save_U
    Hashtable - Save (String(Vudú Warlord)) as 1 of 70 in Save_U
    -------- Medium mage units --------
    Hashtable - Save (String(Wizzard (mage))) as 1 of 71 in Save_U
    Hashtable - Save (String(Superior Sorceress)) as 1 of 72 in Save_U
    Hashtable - Save (String(Mortar Team)) as 1 of 73 in Save_U
    Hashtable - Save (String(Shaman (orc mage))) as 1 of 74 in Save_U
    Hashtable - Save (String(Stone Golem)) as 1 of 75 in Save_U
    Hashtable - Save (String(Vamp)) as 1 of 76 in Save_U
    Hashtable - Save (String(Master Warlock)) as 1 of 77 in Save_U
    Hashtable - Save (String(Arcane Druid (Ne Mage))) as 1 of 78 in Save_U
    Hashtable - Save (String(Acolyte)) as 1 of 79 in Save_U
    Hashtable - Save (String(Witchdoctor)) as 1 of 80 in Save_U
    -------- High mage units --------
    Hashtable - Save (String(Archmage (mage))) as 1 of 81 in Save_U
    Hashtable - Save (String(Warcaster)) as 1 of 82 in Save_U
    Hashtable - Save (String(TNT Team)) as 1 of 83 in Save_U
    Hashtable - Save (String(Farseer (orc mage))) as 1 of 84 in Save_U
    Hashtable - Save (String(Granite Golem)) as 1 of 85 in Save_U
    Hashtable - Save (String(Dark Princess)) as 1 of 86 in Save_U
    Hashtable - Save (String(Necromancer)) as 1 of 87 in Save_U
    Hashtable - Save (String(Arcane Master (Ne Mage))) as 1 of 88 in Save_U
    Hashtable - Save (String(Impostor)) as 1 of 89 in Save_U
    Hashtable - Save (String(Master of Pets)) as 1 of 90 in Save_U
    -------- Tank Heroes units --------
    Hashtable - Save (String(Knight Warlord)) as 1 of 91 in Save_U
    Hashtable - Save (String(Bloody Warlord)) as 1 of 92 in Save_U
    Hashtable - Save (String(Thunder Warlord)) as 1 of 93 in Save_U
    Hashtable - Save (String(Chieftain Warlord)) as 1 of 94 in Save_U
    Hashtable - Save (String(Ogre Warlord)) as 1 of 95 in Save_U
    Hashtable - Save (String(Dark Warlord)) as 1 of 96 in Save_U
    Hashtable - Save (String(Ghoul Warlord)) as 1 of 97 in Save_U
    Hashtable - Save (String(Huntress Warlord)) as 1 of 98 in Save_U
    Hashtable - Save (String(Darkness Warlord)) as 1 of 99 in Save_U
    Hashtable - Save (String(Berserk Warlord)) as 1 of 100 in Save_U
    -------- Medium tank units --------
    Hashtable - Save (String(Calvary)) as 1 of 101 in Save_U
    Hashtable - Save (String(High Calvary (tank))) as 1 of 102 in Save_U
    Hashtable - Save (String(Steelbreaker (tank))) as 1 of 103 in Save_U
    Hashtable - Save (String(Wolfryder (tank))) as 1 of 104 in Save_U
    Hashtable - Save (String(Ogre Boss)) as 1 of 105 in Save_U
    Hashtable - Save (String(Vampire Impaler)) as 1 of 106 in Save_U
    Hashtable - Save (String(Strong Zombie)) as 1 of 107 in Save_U
    Hashtable - Save (String(Huntress Leader)) as 1 of 108 in Save_U
    Hashtable - Save (String(Oppressor (tank2 ))) as 1 of 109 in Save_U
    Hashtable - Save (String(Headhunter Berserk (tank))) as 1 of 110 in Save_U
    -------- high tank units --------
    Hashtable - Save (String(Knight)) as 1 of 111 in Save_U
    Hashtable - Save (String(Bloody Calvary (tank))) as 1 of 112 in Save_U
    Hashtable - Save (String(Thunder Lord (tank))) as 1 of 113 in Save_U
    Hashtable - Save (String(Devastator (tank))) as 1 of 114 in Save_U
    Hashtable - Save (String(Big Boss)) as 1 of 115 in Save_U
    Hashtable - Save (String(Count Vampire)) as 1 of 116 in Save_U
    Hashtable - Save (String(Ghoul)) as 1 of 117 in Save_U
    Hashtable - Save (String(Master Huntress)) as 1 of 118 in Save_U
    Hashtable - Save (String(Dark Knight (tank 3 ))) as 1 of 119 in Save_U
    Hashtable - Save (String(Implacable (tank))) as 1 of 120 in Save_U
Setting Buildings
  Events
    Time - Elapsed game time is 0.80 seconds
  Conditions
  Actions
    -------- Emblems --------
    Set Shop_build[1] = Life Fountain (shop)
    Set Shop_build[2] = Arcane Vault (shop)
    Set Shop_build[3] = Colossus (shop)
    Set Shop_build[4] = Dwarven Emblem (shop)
    Set Shop_build[5] = Reductionary (shop)
    Set Shop_build[6] = Ancient Guardian (shop)
    Set Shop_build[7] = Sacred Life (shop)
    Set Shop_build[8] = Generator (shop)
    Set Shop_build[9] = Undead Energy (shop)
    Set Shop_build[10] = Gargoyles Spire (shop)
    -------- Researchers --------
    Set Tech_build[1] = War Mill (tech)
    Set Tech_build[2] = Apothecary (tech)
    Set Tech_build[3] = Arcane Tower (tech)
    Set Tech_build[4] = Abandoned Refuge (tech)
    Set Tech_build[5] = Spy House (tech)
    Set Tech_build[6] = Night Sentinel (tech)
    Set Tech_build[7] = Sacred Stone (tech)
    Set Tech_build[8] = Tribe Emblem (tech)
    Set Tech_build[9] = Damned temple (tech)
    Set Tech_build[10] = Haunted Monastery (tech)
    -------- Basic Barracs --------
    Set Main_build[1] = Burrow
    Set Main_build[2] = Elven Hall
    Set Main_build[3] = Fortress
    Set Main_build[4] = Little House
    Set Main_build[5] = Stash
    Set Main_build[6] = Refuge
    Set Main_build[7] = Hovel
    Set Main_build[8] = Hut
    Set Main_build[9] = Altar
    Set Main_build[10] = Haunted House
    -------- Medium Barracs --------
    Set Fupgrade_build[1] = Tribal Camp
    Set Fupgrade_build[2] = Elven Sanctuary
    Set Fupgrade_build[3] = Stronghold
    Set Fupgrade_build[4] = Army Station
    Set Fupgrade_build[5] = Thiefs Hall
    Set Fupgrade_build[6] = Hunters Hall
    Set Fupgrade_build[7] = Bastion
    Set Fupgrade_build[8] = Troll Hut
    Set Fupgrade_build[9] = Mortuary
    Set Fupgrade_build[10] = Haunted mansion
    -------- Castles --------
    Set Supgrade_build[1] = Keep
    Set Supgrade_build[2] = Elven Castle
    Set Supgrade_build[3] = Castle
    Set Supgrade_build[4] = Dwarf Fortress
    Set Supgrade_build[5] = Slayers Hall
    Set Supgrade_build[6] = Night Fortress
    Set Supgrade_build[7] = Fortress
    Set Supgrade_build[8] = Harborage
    Set Supgrade_build[9] = Graveyard
    Set Supgrade_build[10] = Haunted Castle
    -------- Owned basics --------
    Set owned_Main[1] = Owned Burrow
    Set owned_Main[2] = Owned Elven Hall
    Set owned_Main[3] = Owned Fortress
    Set owned_Main[4] = Owned House
    Set owned_Main[5] = Owned Stash
    Set owned_Main[6] = Owned Refuge
    Set owned_Main[7] = Owned Hovel
    Set owned_Main[8] = Owned Hut
    Set owned_Main[9] = Owned Altar
    Set owned_Main[10] = Owned Haunted House
    -------- Owned medium --------
    Set owned_second[1] = Owned Tribal Camp
    Set owned_second[2] = Owned Elven Sanctuary
    Set owned_second[3] = Owned Stronghold
    Set owned_second[4] = Owned Army Station
    Set owned_second[5] = Owned Thiefs Hall
    Set owned_second[6] = Owned Hunters Hall
    Set owned_second[7] = Owned Bastion
    Set owned_second[8] = Owned Troll hut
    Set owned_second[9] = Owned Mortuary
    Set owned_second[10] = Owned Haunted Mansion
    -------- Owned castles --------
    Set owned_third[1] = Owned Keep
    Set owned_third[2] = Owned Elven Castle
    Set owned_third[3] = Owned Castle
    Set owned_third[4] = Owned Dwarven Fortress
    Set owned_third[5] = Owned Slayers Hall
    Set owned_third[6] = Owned Night Fortress
    Set owned_third[7] = Owned Fortress (orcs)
    Set owned_third[8] = Owned Harborage
    Set owned_third[9] = Owned Graveyard
    Set owned_third[10] = Owned Haunted Castle
    -------- towers --------
    Set Tower_build[1] = Rock Tower (brutes)
    Set Tower_build[2] = Arcane Tower (highelf)
    Set Tower_build[3] = Defensive tower (human)
    Set Tower_build[4] = Canon Tower (dwarf)
    Set Tower_build[5] = Renegade Tower (mercenaries)
    Set Tower_build[6] = Ancient Guardian (night elfs)
    Set Tower_build[7] = Orc Tower (orcos)
    Set Tower_build[8] = Guardian Spirit (trolls)
    Set Tower_build[9] = Cold Tower (undeads)
    Set Tower_build[10] = Chaos Tower (vampires)
    -------- Obstacles --------
    Set Otbuild[1] = Outpost (wall)
    Set Otbuild[2] = elven refuge (wall)
    Set Otbuild[3] = Farm (wall)
    Set Otbuild[4] = Village (wall)
    Set Otbuild[5] = Cage (wall)
    Set Otbuild[6] = Moonwell (wall)
    Set Otbuild[7] = Chaos Pit (wall)
    Set Otbuild[8] = Sting
    Set Otbuild[9] = Tomb (wall
    Set Otbuild[10] = Abandoned House (wall
    -------- Wall --------
    Set walltype[1] = wall (brute)
    Set walltype[2] = wall (elven)
    Set walltype[3] = wall (human)
    Set walltype[4] = wall (dwarf)
    Set walltype[5] = wall (merc)
    Set walltype[6] = wall (nelf)
    Set walltype[7] = wall (orc)
    Set walltype[8] = wall (troll)
    Set walltype[9] = wall (undead)
    Set walltype[10] = wall (vampire)
Setting Race units
  Events
    Time - Elapsed game time is 1.80 seconds
  Conditions
  Actions
    Set Mele_Unit[1] = Kobold
    Set Mele_Unit[2] = Elven Militia (em)
    Set Mele_Unit[3] = Soldier
    Set Mele_Unit[4] = Dwarf
    Set Mele_Unit[5] = Bandit (base)
    Set Mele_Unit[6] = Sentinel (Ne Melee)
    Set Mele_Unit[7] = Grunt
    Set Mele_Unit[8] = Dark Troll (melee)
    Set Mele_Unit[9] = Skeleton
    Set Mele_Unit[10] = Fallen Villager
    Set Range_Unit[1] = Sneak Gnoll
    Set Range_Unit[2] = Archer
    Set Range_Unit[3] = Archer (human)
    Set Range_Unit[4] = Coltman
    Set Range_Unit[5] = Rogue (base)
    Set Range_Unit[6] = Night archer
    Set Range_Unit[7] = Edge (range)
    Set Range_Unit[8] = Troll (range)
    Set Range_Unit[9] = Skeletal Archer
    Set Range_Unit[10] = Succubus
    Set Mage_Unit[1] = Earth Golem
    Set Mage_Unit[2] = Sorceress
    Set Mage_Unit[3] = Magician (mage)
    Set Mage_Unit[4] = Powder Team
    Set Mage_Unit[5] = Fallen Priest
    Set Mage_Unit[6] = Druid (Ne Mage)
    Set Mage_Unit[7] = Servant (orc Mage)
    Set Mage_Unit[8] = Macumba
    Set Mage_Unit[9] = Warlock
    Set Mage_Unit[10] = Fallen Maiden
    Set Tank_Unit[1] = Ogre
    Set Tank_Unit[2] = High Infantry (tank)
    Set Tank_Unit[3] = Light Calvary
    Set Tank_Unit[4] = Steelbreaker (tank)
    Set Tank_Unit[5] = Renegade (tank1)
    Set Tank_Unit[6] = Huntress
    Set Tank_Unit[7] = Raider (tank)
    Set Tank_Unit[8] = Headhunter (tank)
    Set Tank_Unit[9] = Zombie
    Set Tank_Unit[10] = Elite Vampire
    Set Flyng_Unit[1] = Harpy
    Set Flyng_Unit[2] = DragonHawk
    Set Flyng_Unit[3] = Ice Drake
    Set Flyng_Unit[4] = Griffin
    Set Flyng_Unit[5] = Red Dragon
    Set Flyng_Unit[6] = HippoGryph
    Set Flyng_Unit[7] = Wyvern Rider
    Set Flyng_Unit[8] = Batryder
    Set Flyng_Unit[9] = Frost Wyrm
    Set Flyng_Unit[10] = Gargoyle
    -------- unlimit units train --------
    For each (Integer A) from 1 to 8, do (Actions)
      Loop - Actions
        For each (Integer B) from 1 to 10, do (Actions)
          Loop - Actions
            Player - Limit training of Mele_Unit[(Integer B)] to -1 for (Player((Integer A)))
            Player - Limit training of Mage_Unit[(Integer B)] to -1 for (Player((Integer A)))
            Player - Limit training of Range_Unit[(Integer B)] to -1 for (Player((Integer A)))
            Player - Limit training of Tank_Unit[(Integer B)] to -1 for (Player((Integer A)))
            Player - Limit training of Siege_Unit[(Integer B)] to -1 for (Player((Integer A)))
Setting Extras
  Events
    Time - Elapsed game time is 0.50 seconds
  Conditions
  Actions
    Set Castwall[1] = Cast wall (brute)
    Set Castwall[2] = Cast wall (elven)
    Set Castwall[3] = Cast wall (human)
    Set Castwall[4] = Cast wall (dwarf)
    Set Castwall[5] = Cast wall (merc)
    Set Castwall[6] = Cast wall (nelf)
    Set Castwall[7] = Cast wall (orc)
    Set Castwall[8] = Cast wall (troll)
    Set Castwall[9] = Cast wall (undead)
    Set Castwall[10] = Cast wall (vampire)
    Set Obstacles[1] = Obstacle (brutes)
    Set Obstacles[2] = Obstacle (Helfs)
    Set Obstacles[3] = Obstacle (human)
    Set Obstacles[4] = Obstacle (darwf)
    Set Obstacles[5] = Obstacle (Mercs)
    Set Obstacles[6] = Obstacle (nelfs)
    Set Obstacles[7] = Obstacle (orc)
    Set Obstacles[8] = Obstacle (troll)
    Set Obstacles[9] = Obstacle (undeads)
    Set Obstacles[10] = Obstacle (vampires)
    Set UP_effect[1] = Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
    Set UP_effect[2] = Abilities\Spells\Other\Levelup\LevelupCaster.mdl
    Set UP_effect[3] = Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
    Set UP_effect[4] = Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
    Set UP_effect[5] = Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
    Set UP_effect[6] = Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
    Set UP_effect[7] = Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
    Set UP_effect[8] = Abilities\Spells\Other\HowlOfTerror\HowlCaster.mdl
    Set UP_effect[9] = Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
    Set UP_effect[10] = Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
    Set shop_zone[1] = secureZone1 <gen>
    Set shop_zone[2] = secureZone2 <gen>
    Set shop_zone[3] = secureZone3 <gen>
    Set shop_zone[4] = secureZone4 <gen>
    Set shop_zone[5] = secureZone5 <gen>
    Set shop_zone[6] = secureZone6 <gen>
    Set shop_zone[7] = secureZone7 <gen>
    Set shop_zone[8] = secureZone8 <gen>
    Set Iconpatch[1] = ReplaceableTextures\CommandButtons\BTNOgre.blp
    Set Iconpatch[2] = ReplaceableTextures\CommandButtons\BTNElfVillager.blp
    Set Iconpatch[3] = ReplaceableTextures\CommandButtons\BTNFootman.blp
    Set Iconpatch[4] = ReplaceableTextures\CommandButtons\BTNHeroMountainKing.blp
    Set Iconpatch[5] = ReplaceableTextures\CommandButtons\BTNBanditSpearThrower.blp
    Set Iconpatch[6] = ReplaceableTextures\CommandButtons\BTNArcher.blp
    Set Iconpatch[7] = ReplaceableTextures\CommandButtons\BTNGrunt.blp
    Set Iconpatch[8] = ReplaceableTextures\CommandButtons\BTNForestTroll.blp
    Set Iconpatch[9] = ReplaceableTextures\CommandButtons\BTNZombie.blp
    Set Iconpatch[10] = ReplaceableTextures\CommandButtons\BTNHeroDreadLord.blp
    Set Innate[1] = Absorption (innate)
    Set Innate[2] = Armored (innate)
    Set Innate[3] = Damage (innate)
    Set Innate[4] = Dexterity (innate)
    Set Innate[5] = Engineer (innate)
    Set Innate[6] = Spy (innate)
    Set Innate[7] = Velocity (innate)
    Set Innate[8] = Vitality (innate)
    Set Innate[9] = regeneration (innate)
    Set fake_innate[1] = absorption fake_innate
    Set fake_innate[2] = Armored fake_innate
    Set fake_innate[3] = Damage fake_innate
    Set fake_innate[7] = Velocity fake_innate
    Set fake_innate[8] = vitality fake_innate
    Set fake_innate[9] = Regeneration fake_innate
    Set Walldoodad[1] = B004 (destructablecode)
    Set Walldoodad[2] = B007 (destructablecode)
    Set Walldoodad[3] = B003 (destructablecode)
    Set Walldoodad[4] = B000 (destructablecode)
    Set Walldoodad[5] = B009 (destructablecode)
    Set Walldoodad[6] = B006 (destructablecode)
    Set Walldoodad[7] = B005 (destructablecode)
    Set Walldoodad[8] = B001 (destructablecode)
    Set Walldoodad[9] = B008 (destructablecode)
    Set Walldoodad[10] = B002 (destructablecode)
    Set Dangle[1] = 270.00
    Set Dangle[2] = 270.00
    Set Dangle[3] = 270.00
    Set Dangle[4] = 270.00
    Set Dangle[5] = 305.00
    Set Dangle[6] = 270.00
    Set Dangle[7] = 270.00
    Set Dangle[8] = 270.00
    Set Dangle[9] = 270.00
    Set Dangle[10] = 335.00
    Set Dscale[1] = 1.00
    Set Dscale[2] = 0.90
    Set Dscale[3] = 0.50
    Set Dscale[4] = 1.00
    Set Dscale[5] = 1.30
    Set Dscale[6] = 1.00
    Set Dscale[7] = 0.85
    Set Dscale[8] = 0.60
    Set Dscale[9] = 0.90
    Set Dscale[10] = 0.70
This for Ai learning instructions
function Trig_Setting_Skillsfor_AI_Actions takes nothing returns nothing
    // global skills
    call SaveIntegerBJ('A018', 1, 101, udg_Skills_list )
    call SaveIntegerBJ('A019', 2, 101, udg_Skills_list )
    call SaveIntegerBJ('A01A', 3, 101, udg_Skills_list )
    // ---------------------------------------------------------------meele
    // templar w
    call SaveIntegerBJ( 1, 1, StringHashBJ(UnitId2StringBJ('H00O')), udg_Skills_list )
    call SaveIntegerBJ('A06S', 1, 1, udg_Skills_list )
    call SaveIntegerBJ('A01E', 2, 1, udg_Skills_list )
    // phoenix w
    call SaveIntegerBJ( 2, 1, StringHashBJ(UnitId2StringBJ('H02D')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 2, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 2, udg_Skills_list )
    // dwarf w
    call SaveIntegerBJ( 3, 1, StringHashBJ(UnitId2StringBJ('H00N')), udg_Skills_list )
    call SaveIntegerBJ( 'A01B', 1, 3, udg_Skills_list )
    call SaveIntegerBJ( 'A00T', 2, 3, udg_Skills_list )
    // orc w
    call SaveIntegerBJ( 4, 1, StringHashBJ(UnitId2StringBJ('O000')), udg_Skills_list )
    call SaveIntegerBJ( 'A01D', 1, 4, udg_Skills_list )
    call SaveIntegerBJ( 'A01C', 2, 4, udg_Skills_list )
    // kobold w
    call SaveIntegerBJ( 5, 1, StringHashBJ(UnitId2StringBJ('E00C')), udg_Skills_list )
    call SaveIntegerBJ( 'A05A', 1, 5, udg_Skills_list )
    call SaveIntegerBJ( 'A059', 2, 5, udg_Skills_list )
    // vampire w
    call SaveIntegerBJ( 6, 1, StringHashBJ(UnitId2StringBJ('U00V')), udg_Skills_list )
    call SaveIntegerBJ( 'A038', 1, 6, udg_Skills_list )
    call SaveIntegerBJ( 'AUcs', 2, 6, udg_Skills_list )
    // skeleton w
    call SaveIntegerBJ( 7, 1, StringHashBJ(UnitId2StringBJ('U011')), udg_Skills_list )
    call SaveIntegerBJ( 'A03I', 1, 7, udg_Skills_list )
    call SaveIntegerBJ( 'A03Z', 2, 7, udg_Skills_list )
    // warden w
    call SaveIntegerBJ( 8, 1, StringHashBJ(UnitId2StringBJ('E00G')), udg_Skills_list )
    call SaveIntegerBJ( 'A06O', 1, 8, udg_Skills_list )
    call SaveIntegerBJ( 'A087', 2, 8, udg_Skills_list )
    // thief w
    call SaveIntegerBJ( 9, 1, StringHashBJ(UnitId2StringBJ('H02A')), udg_Skills_list )
    call SaveIntegerBJ( 'A0A0', 1, 9, udg_Skills_list )
    call SaveIntegerBJ( 'A0A1', 2, 9, udg_Skills_list )
    // troll w
    call SaveIntegerBJ( 10, 1, StringHashBJ(UnitId2StringBJ('O00C')), udg_Skills_list )
    call SaveIntegerBJ( 'A002', 1, 10, udg_Skills_list )
    call SaveIntegerBJ( 'A07J', 2, 10, udg_Skills_list )
    // ---------------------------------------------------------------ranged
    // shooter w
    call SaveIntegerBJ( 11, 1, StringHashBJ(UnitId2StringBJ('E00O')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 11, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 11, udg_Skills_list )
    // hunter w
    call SaveIntegerBJ( 12, 1, StringHashBJ(UnitId2StringBJ('E001')), udg_Skills_list )
    call SaveIntegerBJ( 'A008', 1, 12, udg_Skills_list )
    call SaveIntegerBJ( 'A00I', 2, 12, udg_Skills_list )
    // sniper w
    call SaveIntegerBJ( 13, 1, StringHashBJ(UnitId2StringBJ('E00L')), udg_Skills_list )
    call SaveIntegerBJ( 'A0AK', 1, 13, udg_Skills_list )
    call SaveIntegerBJ( 'A0AH', 2, 13, udg_Skills_list )
    // blade w
    call SaveIntegerBJ( 14, 1, StringHashBJ(UnitId2StringBJ('O00N')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 14, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 14, udg_Skills_list )
    // sneak w
    call SaveIntegerBJ( 15, 1, StringHashBJ(UnitId2StringBJ('H00E')), udg_Skills_list )
    call SaveIntegerBJ( 'A08K', 1, 15, udg_Skills_list )
    call SaveIntegerBJ( 'A08P', 2, 15, udg_Skills_list )
    // succubus w
    call SaveIntegerBJ( 16, 1, StringHashBJ(UnitId2StringBJ('E009')), udg_Skills_list )
    call SaveIntegerBJ( 'A02C', 1, 16, udg_Skills_list )
    call SaveIntegerBJ( 'A02Z', 2, 16, udg_Skills_list )
    // reaver w
    call SaveIntegerBJ( 17, 1, StringHashBJ(UnitId2StringBJ('E00B')), udg_Skills_list )
    call SaveIntegerBJ( 'A03P', 1, 17, udg_Skills_list )
    call SaveIntegerBJ( 'A03Q', 2, 17, udg_Skills_list )
    // night w
    call SaveIntegerBJ( 18, 1, StringHashBJ(UnitId2StringBJ('H00O')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 18, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 18, udg_Skills_list )
    // slayer w
    call SaveIntegerBJ( 19, 1, StringHashBJ(UnitId2StringBJ('H00O')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 19, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 19, udg_Skills_list )
    // ravager w
    call SaveIntegerBJ( 20, 1, StringHashBJ(UnitId2StringBJ('N02J')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 20, udg_Skills_list )
    call SaveIntegerBJ( 'A011', 2, 20, udg_Skills_list )
    // ---------------------------------------------------------------mage
    // mage w
    call SaveIntegerBJ( 21, 1, StringHashBJ(UnitId2StringBJ('H02M')), udg_Skills_list )
    call SaveIntegerBJ( 'A08G', 1, 21, udg_Skills_list )
    call SaveIntegerBJ( 'A08H', 2, 21, udg_Skills_list )
    // sorceres w
    call SaveIntegerBJ( 22, 1, StringHashBJ(UnitId2StringBJ('H02L')), udg_Skills_list )
    call SaveIntegerBJ( 'A0A3', 1, 22, udg_Skills_list )
    call SaveIntegerBJ( 'A06P', 2, 22, udg_Skills_list )
    // explosive w
    call SaveIntegerBJ( 23, 1, StringHashBJ(UnitId2StringBJ('N02S')), udg_Skills_list )
    call SaveIntegerBJ( 'A0AB', 1, 23, udg_Skills_list )
    call SaveIntegerBJ( 'A0A7', 2, 23, udg_Skills_list )
    // lightning w
    call SaveIntegerBJ( 24, 1, StringHashBJ(UnitId2StringBJ('O00B')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 24, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 24, udg_Skills_list )
    // golem w
    call SaveIntegerBJ( 25, 1, StringHashBJ(UnitId2StringBJ('N020')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 25, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 25, udg_Skills_list )
    // vamp w
    call SaveIntegerBJ( 26, 1, StringHashBJ(UnitId2StringBJ('H00W')), udg_Skills_list )
    call SaveIntegerBJ( 'A04G', 1, 26, udg_Skills_list )
    call SaveIntegerBJ( 'A04T', 2, 26, udg_Skills_list )
    // lich w
    call SaveIntegerBJ( 27, 1, StringHashBJ(UnitId2StringBJ('U01E')), udg_Skills_list )
    call SaveIntegerBJ( 'A045', 1, 27, udg_Skills_list )
    call SaveIntegerBJ( 'A047', 2, 27, udg_Skills_list )
    // druid w
    call SaveIntegerBJ( 28, 1, StringHashBJ(UnitId2StringBJ('E00F')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 28, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 28, udg_Skills_list )
    // fallen w
    call SaveIntegerBJ( 29, 1, StringHashBJ(UnitId2StringBJ('H02O')), udg_Skills_list )
    call SaveIntegerBJ( 'A08X', 1, 29, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 29, udg_Skills_list )
    // vudu w
    call SaveIntegerBJ( 30, 1, StringHashBJ(UnitId2StringBJ('O00I')), udg_Skills_list )
    call SaveIntegerBJ( 'A07P', 1, 30, udg_Skills_list )
    call SaveIntegerBJ( 'A07S', 2, 30, udg_Skills_list )
    // ---------------------------------------------------------------tank
    // knight w
    call SaveIntegerBJ( 31, 1, StringHashBJ(UnitId2StringBJ('H00Q')), udg_Skills_list )
    call SaveIntegerBJ( 'A049', 1, 31, udg_Skills_list )
    call SaveIntegerBJ( 'A04C', 2, 31, udg_Skills_list )
    // bloody w
    call SaveIntegerBJ( 32, 1, StringHashBJ(UnitId2StringBJ('H030')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 32, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 32, udg_Skills_list )
    // thunder w
    call SaveIntegerBJ(33, 1, StringHashBJ(UnitId2StringBJ('H02W')), udg_Skills_list )
    call SaveIntegerBJ( 'A0AP', 1, 33, udg_Skills_list )
    call SaveIntegerBJ( 'A0AQ', 2, 33, udg_Skills_list )
    // chieftain w
    call SaveIntegerBJ( 34, 1, StringHashBJ(UnitId2StringBJ('H02N')), udg_Skills_list )
    call SaveIntegerBJ( 'A08C', 1, 34, udg_Skills_list )
    call SaveIntegerBJ( 'A08E', 2, 34, udg_Skills_list )
    // ogre w
    call SaveIntegerBJ( 35, 1, StringHashBJ(UnitId2StringBJ('O00D')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 35, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 35, udg_Skills_list )
    // dark w
    call SaveIntegerBJ( 36, 1, StringHashBJ(UnitId2StringBJ('U01G')), udg_Skills_list )
    call SaveIntegerBJ( 'A04R', 1, 36, udg_Skills_list )
    call SaveIntegerBJ( 'S002', 2, 36, udg_Skills_list )
    // ghoul w
    call SaveIntegerBJ( 37, 1, StringHashBJ(UnitId2StringBJ('U01A')), udg_Skills_list )
    call SaveIntegerBJ( 'A03V', 1, 37, udg_Skills_list )
    call SaveIntegerBJ( 'A04F', 2, 37, udg_Skills_list )
    // huntress w
    call SaveIntegerBJ( 38, 1, StringHashBJ(UnitId2StringBJ('E00K')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 38, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 38, udg_Skills_list )
    // bandit w
    call SaveIntegerBJ( 39, 1, StringHashBJ(UnitId2StringBJ('H02S')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 39, udg_Skills_list )
    call SaveIntegerBJ( 'A08V', 2, 39, udg_Skills_list )
    // berserk w
    call SaveIntegerBJ( 40, 1, StringHashBJ(UnitId2StringBJ('O00K')), udg_Skills_list )
    call SaveIntegerBJ( 'A06S', 1, 40, udg_Skills_list )
    call SaveIntegerBJ( 'A01E', 2, 40, udg_Skills_list )
endfunction

//===========================================================================
function InitTrig_Setting_Skills takes nothing returns nothing
    set gg_trg_Setting_Skills = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Setting_Skills, 1.00 )
    call TriggerAddAction( gg_trg_Setting_Skills, function Trig_Setting_Skillsfor_AI_Actions )
endfunction

 
Quest
  Events
    Time - Elapsed game time is 1.40 seconds
  Conditions
  Actions
    Quest - Create a Required quest titled The Game with the description Welcome to Warlords Empire.In this land you must conquer a safe zone near your base and defend it from any enemy invasion while you are owning all enemy bases. The main target of the battle is destroy all enemy emblems (that healer shop in your base). There are 4 emblems per complete team ( also teams can be 1v1, 2v2, 3v3, etc). Across the game you could have castles, fortress and barracs to train your army and towers to guard any possible invasion way. You can conform your army with 4 unit types: light melee, ranged, mage and heavy melee (some races have little diferents types ej: heavy ranged from trolls) and any unit from these types can evolute to warlord killing lots of units in battlefield or training grounds. Warlord unit is hero type, can be revived on the tech center and max level is 25., using icon path ReplaceableTextures\WorldEditUI\Editor-Random-Unit.blp
    Quest - Create a Required quest titled Gold and Killer Points with the description |cffffcc00Getting Gold Resources.|rthe main way for get gold is conquest neutral and enemy buildings, when each turn ends a tax is collected from any training building owned by you. Basic buildings gives less gold than castles. When you destroy a enemy training building you get 1/10 of the current amount of gold from last owner player but that player loses 1/20 of his resources. A second way to get gold is killing, killing and killing. The map flag is on, any killed unit gives bounty gold reward. Also the mercenaryes race always is stealing resources from buildings and units.|cffffcc00Getting Killer Points Resources.|rLumber resource is replaced with killer points. There are 3 ways to get killer points, the main way is getting ranks. For each rank that you gain killing a certain amount of enemy units, you get a major bonus of killer points, indeed when you reaches a new rank in first or second position you gain an extra killer points bonus. The second way is killing upgraded units, those units have a killer point bounty per grade. Second upgrades have 1 killer point bounty, Third upgrades have 2 killer points bounty and Warlords units have 3 killer points bounty. Another way to get killer points is taking the massive killing event. that succed when you kill 7 or more units in little time, in the same point or diferents points at same time. getting 5 killer points. See thief´s skill for more killer points., using icon path ReplaceableTextures\CommandButtons\BTNChestOfGold.blp
    Quest - Create a Required quest titled Game Play with the description |cffffcc00Game Genre:|r Risk & Strategy.- To improve the balance of the game, all races have the same way to upgrade Life, Armor and Damage. All requirements are removed from previous version. - All races have four units to conform an army. only four warlords are allowed per each player, one warlord of each type.- Each training building can cast a tower build to improve zone defenses, but there are requirements to get the tower, all races have towers allowed.- Each race have flying units except the dwarfs. they are the unique race having siege units.- Each race have charger units.- Each race have tech building to research upgrades and revive dead Warlords. if a tech building is destroyed the owner can buy another tech building on the neutrals shops. use this to accelerate researchs.- This map contains four training grounds (two more than last version) but the new places are a little more slow because the respawn convokes only 1 creep., using icon path ReplaceableTextures\CommandButtons\BTNSpellBookBLS.blp
    Quest - Create a Required quest titled Ranks & Events with the description RANK EVENTS|n|n|cffffcc00Warrior|r : When you has killed 25 units in game. First warrior gets 50 killer points, Great Warrior gets 45 killer points, and the rest get 40 killer points.|n|n|cffffcc00Master|r : When you has killed 60 units in game. Grand Master gets 85 killer points, High Master gets 72 killer points, and the rest get 60 killer points.|n|n|cffffcc00General|r : When you has killed 110 units in game. Chieftain General gets 120 killer points, Great General gets 100 killer points, and the rest get 80 killer points.|n|n|cffffcc00Killer|r : When you has killed 180 units in game. Killer Psychopath gets 160 killer points, Evil Killer gets 130 killer points, and the rest get 100 killer points.|n|n|cffffcc00Chacal|r : When you has killed 260 units in game. Unholy Chacal gets 200 killer points, Butcher Chacal gets 160 killer points, and the rest get 120 killer points.|n|n|cffffcc00Warlord|r : When you has killed 400 units in game. Warlord gets 260 killer points, Overlord gets 200 killer points, and the lords get 140 killer points.|n|n|cffffcc00MASSIVE KILL|r|n|nWhen you kill more than 7 units at same time. Gets 5 killer points bonus.|n|n|cffffcc00Settlement|r: When you complete some buildings to conform your Empire. Settlement requires 1 Castle type building, 1 Medium Type building, 3 Basic type building and 5 towers. when you get the settlement event check your tech building to cast it.|n|n|cffffcc00Training Ground|r: When you gets the Master rank and reach to 100 suply capability. Check your tech building to cast it. , using icon path ReplaceableTextures\CommandButtons\BTNSpellBookBLS.blp
    Quest - Create a Required quest titled Credits & Commands with the description |cffffcc00GOLD CREDITS|r- Loadingscreen and rank voice effects by me (avahor)- Improved load with Pitzermike´s widgetizer tool.- thanks to supertoinkz for his help on translated texts.- Big thanks to pyramidhe@d for his amazing model "maggot"- Custom models and buttons authors signed into map with follow commands: -credits 1/2/3 |cffffcc00USABLE COMMANDS|r-mm, -melee, -mg, -magic, -rm, -range, -tm, -tank, -novice, -warrior, -warlord, -hidetax, -showtax, -zoom, -ar, -clear, -gmode, -credits 1, -credits 2, -credits 3, using icon path ReplaceableTextures\CommandButtons\BTNSpellBookBLS.blp
    Quest - Create a Optional quest titled Game Modes with the description |cffffcc00NOVICE MODE|rCommand:|cffffcc00-novice|rFor new players. In this mode you can get warlords quickly, Set upgrades to minimal kills requirements.Income tax per turn is increased to |cffffcc0015|r gold por each |cffff0000Basic training building|r, |cffffcc0030|r gold per each |cffff0000Medium training Building|r, |cffffcc0060|r per each |cffff0000High training building|r.|cffffcc00WARRIOR MODE|rCommand:|cffffcc00-warrior|rFor experienced players and non warlords users. In this mode you can get warlords on normal speed, Set upgrades to standar kills requirements.Income tax per turn is reduced to |cffffcc008|r gold por each |cffff0000Basic training building|r, |cffffcc0022|r gold per each |cffff0000Medium training Building|r, |cffffcc0036|r per each |cffff0000High training building|r.|cffffcc00WARLORD MODE|rCommand:|cffffcc00-warlord|rFor Experts, Pros, and non Warlords users (full massive controll) players. In this mode you can get warlords slowly, Set upgrades to maximun kills requirements.Income tax per turn is reduced hard to |cffffcc006|r gold por each |cffff0000Basic training building|r, |cffffcc0016|r gold per each |cffff0000Medium training Building|r, |cffffcc0024|r per each |cffff0000High training building|r.|cffffcc00Melee Mode|r : -mm -meleeAllows only the use of the first main basic unit for all players.|cffffcc00Range Mode|r : -rm -rangeAllows only the use of the range main basic unit for all players.|cffffcc00Mage Mode|r : -mg -magicAllows only the use of the medium mage unit for all players.|cffffcc00tank Mode|r : -tm -tankAllows only the use of the advanced heavy unit for all players.you need to set any mode before the races are loaded into the portal race., using icon path ReplaceableTextures\CommandButtons\BTNEngineeringUpgrade.blp
    Quest - Create a Optional quest titled Unit´s Evolution with the description In this game any killer unit has the chance of evolute into another more stronger unit. Each unit have an upgrading way, where the final unit is hero type and rank is Warlord. When a unit kills another unit (non friendly / non allied) a counter is revealed over himself. the first number is the currently amount of kills for that unit, the second number reveals the number of kills required for evolute to the next grade.|nWhen a unit becomes to the new grade the first counter is reset to zero and start again for the next rank. the maximun grade for each unit is warlord. The requirements are diferent for each unit type, because some unit can kill more easily than others, then this diferent amount helps to game balance.|nWhen a unit have 3 or more killed, an passive ability is added, the "killer brand" skill gives to the killer unit a little bonus of attack speed and movement speed. this skill can be upgrade after 12/36/80 kills., using icon path ReplaceableTextures\CommandButtons\BTNEngineeringUpgrade.blp
    Quest - Create a Optional quest titled AI support with the description In game you can use all slots with computer controller. AI support was designed to emulate a little experienced human player. Indeed after some time of training you can own easy the Ai support. Take care of expanded Ais, those becomes hardest enemies. to set Ai, the game give us a number of whisp, send these whisp into the circles of power near your Ai selection. u can set all slots with same Ai config, or diferents Ais. this feature combined with unit modes feature, give us a new experience gameplay., using icon path ReplaceableTextures\CommandButtons\BTNEngineeringUpgrade.blp
    Quest - Create a Optional quest titled Changelog with the description - Increased AI set time.- Enabled player leaves warning., using icon path ReplaceableTextures\CommandButtons\BTNEngineeringUpgrade.blp
hiddingunits
  Events
    Time - Elapsed game time is 0.50 seconds
  Conditions
  Actions
    Set hiddengroup = (Units in hiddenunitB <gen>)
    Unit Group - Pick every unit in hiddengroup and do (Remove (Picked unit) from the game)
    Custom script: call DestroyGroup (udg_hiddengroup)
    Set hiddengroup = (Units in hiddenunitC <gen>)
    Unit Group - Pick every unit in hiddengroup and do (Remove (Picked unit) from the game)
    Custom script: call DestroyGroup (udg_hiddengroup)
    Set Unitstoremove = (Units in Removeshops <gen>)
    Unit Group - Pick every unit in Unitstoremove and do (Remove (Picked unit) from the game)
    Custom script: call DestroyGroup (udg_Unitstoremove)
    Set Unitstoremove = (Units in Aunits <gen>)
    Unit Group - Pick every unit in Unitstoremove and do (Remove (Picked unit) from the game)
    Custom script: call DestroyGroup (udg_Unitstoremove)
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
function Trig_Selecting_race_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetManipulatingUnit()) == 'e00D'
endfunction

function Trig_Selecting_race_Func004002002 takes nothing returns boolean
    return ( R2I(GetItemLifeBJ(GetFilterItem())) == udg_Race[GetConvertedPlayerId(udg_Player_Race)] )
endfunction

function Trig_Selecting_race_Actions takes nothing returns nothing
    local location newpoint
   
    call DisableTrigger( gg_trg_Tank_mode )
    call DisableTrigger( gg_trg_Mage_mode )
    call DisableTrigger( gg_trg_Melee_mode )
    call DisableTrigger( gg_trg_Range_mode )

    set udg_Player_Race = GetOwningPlayer(GetManipulatingUnit())
    set udg_Race[GetConvertedPlayerId(udg_Player_Race)] = R2I(GetItemLifeBJ(GetManipulatedItem()))
    set udg_Player_ready[GetConvertedPlayerId(udg_Player_Race)] = true
    set udg_Selected_item = RandomItemInRectBJ(gg_rct_itemsRects, Condition(function Trig_Selecting_race_Func004002002))
    call DisplayTextToForce( GetPlayersEnemies(udg_Player_Race), ( ( udg_Player_color[GetConvertedPlayerId(udg_Player_Race)] + GetItemName(udg_Selected_item) ) + ( " Empire|r is here commanded by " + ( ( udg_Player_color[GetConvertedPlayerId(udg_Player_Race)] + GetPlayerName(udg_Player_Race) ) + "|r" ) ) ) )
    call RemoveItem( udg_Selected_item )
    call RemoveUnit( GetManipulatingUnit() )
    set newpoint = GetRectCenter(udg_actualbound[GetConvertedPlayerId(udg_Player_Race)])
    call CreateNUnitsAtLoc( 1, udg_Shop_build[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, newpoint, bj_UNIT_FACING )
    call GroupAddUnitSimple( GetLastCreatedUnit(), udg_buy_shop )
    set udg_buildingpoint = OffsetLocation(newpoint, 0.00, 700.00)
    call CreateNUnitsAtLoc( 1, udg_Tech_build[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_buildingpoint, bj_UNIT_FACING )
    call SaveUnitHandleBJ( GetLastCreatedUnit(), 1, GetConvertedPlayerId(udg_Player_Race), udg_ST )
    call RemoveLocation(udg_buildingpoint)
    set udg_buildingpoint = OffsetLocation(newpoint, -450.00, 350.00)
    call CreateNUnitsAtLoc( 1, udg_Main_build[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_buildingpoint, bj_UNIT_FACING )
    call SelectUnitForPlayerSingle( GetLastCreatedUnit(), udg_Player_Race )
    call RemoveLocation(udg_buildingpoint)
    call CreateNUnitsAtLoc( 1, 'h007', udg_Player_Race, newpoint, bj_UNIT_FACING )
    call UnitAddItemByIdSwapped( 'I001', GetLastCreatedUnit() )
    call UnitAddItemByIdSwapped( 'amrc', GetLastCreatedUnit() )
    call UnitAddItemByIdSwapped( 'whwd', GetLastCreatedUnit() )
   
    if (udg_melee_on == true) then
      call CreateNUnitsAtLoc( 8, udg_Mele_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, newpoint, bj_UNIT_FACING )
      call TriggerExecute( gg_trg_disnomelee )

    elseif (udg_range_on == true) then
      call CreateNUnitsAtLoc( 8, udg_Range_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, newpoint, bj_UNIT_FACING )
      call TriggerExecute( gg_trg_disnorange )

    elseif (udg_mage_on == true) then
      call CreateNUnitsAtLoc( 8, udg_Mage_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, newpoint, bj_UNIT_FACING )    
      call TriggerExecute( gg_trg_disnomage )

    elseif (udg_tank_on == true) then
      call CreateNUnitsAtLoc( 8, udg_Tank_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, newpoint, bj_UNIT_FACING )
      call TriggerExecute( gg_trg_disnotank )

    else
    call CreateNUnitsAtLoc( 5, udg_Mele_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, newpoint, bj_UNIT_FACING )
    call CreateNUnitsAtLoc( 2, udg_Range_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, newpoint, bj_UNIT_FACING )
    call CreateNUnitsAtLoc( 1, udg_Mage_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, newpoint, bj_UNIT_FACING )

    endif



    call RemoveLocation(newpoint)
    call ResetToGameCameraForPlayer( udg_Player_Race, 0 )
    call PanCameraToTimedLocForPlayer( udg_Player_Race, GetPlayerStartLocationLoc(udg_Player_Race), 1.00 )

endfunction

//===========================================================================
function InitTrig_Selecting_race takes nothing returns nothing
    set gg_trg_Selecting_race = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Selecting_race, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddCondition( gg_trg_Selecting_race, Condition( function Trig_Selecting_race_Conditions ) )
    call TriggerAddAction( gg_trg_Selecting_race, function Trig_Selecting_race_Actions )
endfunction

 
function filterpr takes nothing returns boolean
    return ( GetOwningPlayer(GetFilterUnit()) == udg_Player_Race )
endfunction

function slotON takes nothing returns boolean
    return (( udg_Player_ready[udg_Cont_ai] == false ) and (GetPlayerSlotState(ConvertedPlayer(udg_Cont_ai)) == PLAYER_SLOT_STATE_PLAYING))
endfunction

function RemoveG takes nothing returns nothing
    call RemoveUnit( GetEnumUnit() )
endfunction

function RemoveIT takes nothing returns nothing
    call RemoveItem( GetEnumItem() )
endfunction

function Trig_StartingAI_Actions takes nothing returns nothing
    set udg_Cont_ai = 1
    loop
        exitwhen udg_Cont_ai > 8
        if (slotON()) then
            set udg_Player_Race = ConvertedPlayer(udg_Cont_ai)
            set udg_Ai_item = RandomItemInRectSimpleBJ(gg_rct_itemsRects)
            set udg_Race[GetConvertedPlayerId(udg_Player_Race)] = R2I(GetItemLifeBJ(udg_Ai_item))
            set udg_Ai_raceUnits = GetUnitsInRectMatching(gg_rct_RaceRect, Condition(function filterpr))
            call RemoveUnit( GroupPickRandomUnit(udg_Ai_raceUnits) )
            set udg_Player_ready[GetConvertedPlayerId(udg_Player_Race)] = true
            call DestroyGroup (udg_Ai_raceUnits)
            call DisplayTextToForce( GetPlayersEnemies(udg_Player_Race), ( ( udg_Player_color[GetConvertedPlayerId(udg_Player_Race)] + GetItemName(udg_Ai_item) ) + ( " Empire|r is here commanded by " + ( ( udg_Player_color[GetConvertedPlayerId(udg_Player_Race)] + GetPlayerName(udg_Player_Race) ) + "|r" ) ) ) )
            call RemoveItem( udg_Ai_item )
            set udg_new_point = GetRectCenter(udg_actualbound[GetConvertedPlayerId(udg_Player_Race)])
            call CreateNUnitsAtLoc( 1, udg_Shop_build[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_new_point, bj_UNIT_FACING )
            call GroupAddUnitSimple( GetLastCreatedUnit(), udg_buy_shop )
            set udg_buildingpoint = OffsetLocation(udg_new_point, 0.00, 700.00)
            call CreateNUnitsAtLoc( 1, udg_Tech_build[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_buildingpoint, bj_UNIT_FACING )
            call SaveUnitHandleBJ( GetLastCreatedUnit(), 1, GetConvertedPlayerId(udg_Player_Race), udg_ST )
            call RemoveLocation(udg_buildingpoint)
            set udg_buildingpoint = OffsetLocation(udg_new_point, -450.00, 350.00)
            call CreateNUnitsAtLoc( 1, udg_Main_build[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_buildingpoint, bj_UNIT_FACING )
            call RemoveLocation(udg_buildingpoint)
            call CreateNUnitsAtLoc( 1, 'h007', udg_Player_Race, udg_new_point, bj_UNIT_FACING )
            call UnitAddItemByIdSwapped( 'I001', GetLastCreatedUnit() )
            call UnitAddItemByIdSwapped( 'amrc', GetLastCreatedUnit() )
            call UnitAddItemByIdSwapped( 'whwd', GetLastCreatedUnit() )
 
   if (udg_melee_on == true) then
      call CreateNUnitsAtLoc( 8, udg_Mele_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_new_point, bj_UNIT_FACING )
      call TriggerExecute( gg_trg_disnomelee )

    elseif (udg_range_on == true) then
      call CreateNUnitsAtLoc( 8, udg_Range_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_new_point, bj_UNIT_FACING )
      call TriggerExecute( gg_trg_disnorange )

    elseif (udg_mage_on == true) then
      call CreateNUnitsAtLoc( 8, udg_Mage_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_new_point, bj_UNIT_FACING )    
      call TriggerExecute( gg_trg_disnomage )
 
   elseif (udg_tank_on == true) then
      call CreateNUnitsAtLoc( 8, udg_Tank_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_new_point, bj_UNIT_FACING )
      call TriggerExecute( gg_trg_disnotank )

    else

    call CreateNUnitsAtLoc( 5, udg_Mele_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_new_point, bj_UNIT_FACING )
    call CreateNUnitsAtLoc( 2, udg_Range_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_new_point, bj_UNIT_FACING )
    call CreateNUnitsAtLoc( 1, udg_Mage_Unit[udg_Race[GetConvertedPlayerId(udg_Player_Race)]], udg_Player_Race, udg_new_point, bj_UNIT_FACING )
    endif
           
            call RemoveLocation(udg_new_point)
            call ResetToGameCameraForPlayer( udg_Player_Race, 0 )
            call PanCameraToTimedLocForPlayer( udg_Player_Race, GetPlayerStartLocationLoc(udg_Player_Race), 1.00 )
            call TriggerSleepAction( 0.50 )
        else
        endif
        set udg_Cont_ai = udg_Cont_ai + 1
    endloop

    call DisableTrigger( gg_trg_Tank_mode )
    call DisableTrigger( gg_trg_Mage_mode )
    call DisableTrigger( gg_trg_Melee_mode )
    call DisableTrigger( gg_trg_Range_mode )

    call TriggerSleepAction( 5.00 )
    set udg_Unitstoremove = GetUnitsInRectAll(gg_rct_RaceRect)
    call ForGroupBJ( udg_Unitstoremove, function RemoveG )
    call DestroyGroup (udg_Unitstoremove)
    call EnumItemsInRectBJ( gg_rct_itemsRects, function RemoveIT )


   if (GetTriggerExecCount(gg_trg_StartingAI) == 1) then
      call TriggerExecute( gg_trg_detect_AI )
   endif

endfunction

//===========================================================================
function InitTrig_StartingAI takes nothing returns nothing
    set gg_trg_StartingAI = CreateTrigger(  )
    call TriggerRegisterTimerExpireEventBJ( gg_trg_StartingAI, udg_Init_timer )
    call TriggerAddAction( gg_trg_StartingAI, function Trig_StartingAI_Actions )
endfunction

 
credits1
  Events
    Player - Player 1 (Red) types a chat message containing -Credits 1 as An exact match
    Player - Player 2 (Blue) types a chat message containing -Credits 1 as An exact match
    Player - Player 3 (Teal) types a chat message containing -Credits 1 as An exact match
    Player - Player 4 (Purple) types a chat message containing -Credits 1 as An exact match
    Player - Player 5 (Yellow) types a chat message containing -Credits 1 as An exact match
    Player - Player 6 (Orange) types a chat message containing -Credits 1 as An exact match
    Player - Player 7 (Green) types a chat message containing -Credits 1 as An exact match
    Player - Player 8 (Pink) types a chat message containing -Credits 1 as An exact match
  Conditions
  Actions
    Game - Display to (Player group((Triggering player))) the text: - Horsebackarcher by |cffffcc00Kaycei|r- Fortress by |cffffcc00Mr. Bob|r - Arcane Tower by |cffffcc00Mr. Bob|r- Dwarven Paladin by |cffffcc00General frank|r- Dwarven Warrior by |cffffcc00General frank|r- Rifleman By unknown- Elven Warrior by Orc.- Dwarven Worker by |cffffcc00Immclovin|r- LeedwarvenHatcher by |cffffcc00Leeroy|r - BTNHunter by |cffffcc00Mc.goblin|r- Blood Elf Shieldman by |cffffcc00Elenai|r- Crossbowman by |cffffcc00kitabatake|r
credits2
  Events
    Player - Player 1 (Red) types a chat message containing -Credits 2 as An exact match
    Player - Player 2 (Blue) types a chat message containing -Credits 2 as An exact match
    Player - Player 3 (Teal) types a chat message containing -Credits 2 as An exact match
    Player - Player 4 (Purple) types a chat message containing -Credits 2 as An exact match
    Player - Player 5 (Yellow) types a chat message containing -Credits 2 as An exact match
    Player - Player 6 (Orange) types a chat message containing -Credits 2 as An exact match
    Player - Player 7 (Green) types a chat message containing -Credits 2 as An exact match
    Player - Player 8 (Pink) types a chat message containing -Credits 2 as An exact match
  Conditions
  Actions
    Game - Display to (Player group((Triggering player))) the text: - Night elf archer by |cffffcc00wingednosering|r- Human archer by |cffffcc00Happy Tauren|r - Prime Matron (Demon walord) by |cffffcc00Dickxunder|r- BTNANAHolyCross by |cffffcc00Anachron|r- BTNEnslave by |cffffcc00SantoRayo[iP]|r- Dead Eye (Skeletal Archer) by |cffffcc00jigrael|r- Black wings by |cffffcc00hanza-ru|r- Captain royal(templario) by |cffffcc00tranquil|r- HeroViking by |cffffcc00Alastor|r- Herowilddwarf by |cffffcc00Khael theron|r- HerodeathKnight by |cffffcc00Alastor|r- Blood Elf Calvary by |cffffcc00General Frank|r- BloodPhoenix Cruzader by |cffffcc00General Frank|r- Icons downloaded from Hiveworkshop
credits3
  Events
    Player - Player 1 (Red) types a chat message containing -Credits 3 as A substring
    Player - Player 2 (Blue) types a chat message containing -Credits 3 as An exact match
    Player - Player 3 (Teal) types a chat message containing -Credits 3 as An exact match
    Player - Player 4 (Purple) types a chat message containing -Credits 3 as An exact match
    Player - Player 5 (Yellow) types a chat message containing -Credits 3 as An exact match
    Player - Player 6 (Orange) types a chat message containing -Credits 3 as An exact match
    Player - Player 7 (Green) types a chat message containing -Credits 3 as An exact match
    Player - Player 8 (Pink) types a chat message containing -Credits 3 as An exact match
  Conditions
  Actions
    Game - Display to (Player group((Triggering player))) the text: - Rodstrodle Cavalier by |cffffcc00Cavman|r - Cruzader Helm by |cffffcc00ikillforeyou|r - Cruzader Shield Icon by |cffffcc00Dmazz|r- Exorcist Armor Icon by |cffffcc00Kelthuzad|r - Unholy Armor Icon by |cffffcc00Kelthuzad|r - Dark elf Icon Icon by |cffffcc00Tenebrae|r - Elite Vampire model by |cffffcc00Jack of Shadow|r - Vamp Model (Vamp) by |cffffcc00Inquisitor|r Beautyfull!- Dwarven Statue by |cffffcc00Unknown|r- Dwarven Berserker by |cffffcc00Tranquil|r - Vapire Impaler by |cffffcc00Jack of Shadow|r - Katana by |cffffcc00Kitabake|r - Paladin Temple by |cffffcc00Mr. Bob|r - Dwarven Villager by |cffffcc00Koondad|r - Stone Wall by |cffffcc00Kitabatake|r - Housevar by |cffffcc00Amigurumi|r- TribalCamp by |cffffcc00Mr.bob|r
clear
  Events
    Player - Player 1 (Red) types a chat message containing -clear as An exact match
    Player - Player 2 (Blue) types a chat message containing -clear as An exact match
    Player - Player 3 (Teal) types a chat message containing -clear as An exact match
    Player - Player 4 (Purple) types a chat message containing -clear as An exact match
    Player - Player 5 (Yellow) types a chat message containing -clear as An exact match
    Player - Player 6 (Orange) types a chat message containing -clear as An exact match
    Player - Player 7 (Green) types a chat message containing -clear as An exact match
    Player - Player 8 (Pink) types a chat message containing -clear as An exact match
  Conditions
  Actions
    Game - Display to (Player group((Triggering player))) the text: ...
function Trig_infonovice_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), ( "Upgrades for melee unit at: |cffffcc004 Kills - 8 Kills - 16 Kills|r" + "" ) )
    call DisplayTextToForce( GetPlayersAll(), ( "Upgrades for ranged unit at: |cffffcc006 Kills - 12 Kills - 20 Kills|r" + "" ) )
    call DisplayTextToForce( GetPlayersAll(), ( "Upgrades for tank units at: |cffffcc008 Kills - 16 Kills - 24 Kills|r" + "" ) )
    call DisplayTextToForce( GetPlayersAll(), ( "Fortress Income: " + "|cffffcc0015|r Gold" ) )
    call DisplayTextToForce( GetPlayersAll(), ( "Stronghold Income: " + "|cffffcc0030|r Gold" ) )
    call DisplayTextToForce( GetPlayersAll(), ( "Castle Income: " + "|cffffcc0060|r Gold" ) )
endfunction

//===========================================================================
function InitTrig_infonovice takes nothing returns nothing
    set gg_trg_infonovice = CreateTrigger(  )
    call DisableTrigger( gg_trg_infonovice )
    call TriggerAddAction( gg_trg_infonovice, function Trig_infonovice_Actions )
endfunction

 
function Trig_infowarrior_Actions takes nothing returns nothing
    call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), ( "Upgrades for melee unit at: |cffffcc008 Kills - 16 Kills - 24 Kills|r" + "" ) )
    call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), ( "Setting upgrades for ranged unit to: |cffffcc0012 Kills - 24 Kills - 32 Kills|r" + "" ) )
    call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), ( "Setting upgrades for tank units to: |cffffcc0014 Kills - 28 Kills - 36 Kills|r" + "" ) )
    call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), ( "Fortress Income: " + "|cffffcc008|r Gold" ) )
    call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), ( "Stronghold Income: " + "|cffffcc0022|r Gold" ) )
    call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), ( "Castle Income: " + "|cffffcc0036|r Gold" ) )
endfunction

//===========================================================================
function InitTrig_infowarrior takes nothing returns nothing
    set gg_trg_infowarrior = CreateTrigger(  )
    call DisableTrigger( gg_trg_infowarrior )
    call TriggerAddAction( gg_trg_infowarrior, function Trig_infowarrior_Actions )
endfunction

 
function Trig_infowarlord_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), ( "Setting upgrades for melee unit to: |cffffcc006 Kills - 16 Kills - 36 Kills|r" + "" ) )
    call DisplayTextToForce( GetPlayersAll(), ( "Setting upgrades for ranged unit to: |cffffcc008 Kills - 20 Kills - 40 Kills|r" + "" ) )
    call DisplayTextToForce( GetPlayersAll(), ( "Setting upgrades for tank units to: |cffffcc0014 Kills - 28 Kills - 46 Kills|r" + "" ) )
    call DisplayTextToForce( GetPlayersAll(), ( "Fortress Income: " + "|cffffcc006|r Gold" ) )
    call DisplayTextToForce( GetPlayersAll(), ( "Stronghold Income: " + "|cffffcc0016|r Gold" ) )
    call DisplayTextToForce( GetPlayersAll(), ( "Castle Income: " + "|cffffcc0024|r Gold" ) )
endfunction

//===========================================================================
function InitTrig_infowarlord takes nothing returns nothing
    set gg_trg_infowarlord = CreateTrigger(  )
    call DisableTrigger( gg_trg_infowarlord )
    call TriggerAddAction( gg_trg_infowarlord, function Trig_infowarlord_Actions )
endfunction

 
function Trig_Melee_mode_Conditions takes nothing returns boolean
    return ( TimerGetElapsed(udg_unitmode) < 15 )
endfunction

function Trig_Melee_mode_Actions takes nothing returns nothing
  local integer c = 1
   loop
    exitwhen c > 8
       call AdjustPlayerStateBJ( 300, ConvertedPlayer(c), PLAYER_STATE_RESOURCE_GOLD )  
    set c = c + 1
   endloop
   set c = 0

    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_5944" )

    set udg_melee_on = true

    call DisableTrigger( GetTriggeringTrigger() )
    call DisableTrigger( gg_trg_Tank_mode )
    call DisableTrigger( gg_trg_Mage_mode )
    call DisableTrigger( gg_trg_Range_mode )
endfunction

//===========================================================================
function InitTrig_Melee_mode takes nothing returns nothing
    set gg_trg_Melee_mode = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Melee_mode, Player(0), "-MM", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Melee_mode, Player(0), "-MELEE", false )
    call TriggerAddCondition( gg_trg_Melee_mode, Condition( function Trig_Melee_mode_Conditions ) )
    call TriggerAddAction( gg_trg_Melee_mode, function Trig_Melee_mode_Actions )
endfunction

 
function Trig_disnomelee_Actions takes nothing returns nothing
    local integer c = 1  

    loop
        exitwhen c > 8
        call SetPlayerTechMaxAllowedSwap( udg_Mage_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Range_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Tank_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Siege_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Flyng_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        set c = c + 1
    endloop
    set c = 0
    call DisableTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_disnomelee takes nothing returns nothing
    set gg_trg_disnomelee = CreateTrigger(  )
    call TriggerAddAction( gg_trg_disnomelee, function Trig_disnomelee_Actions )
endfunction

 
function Trig_Range_mode_Conditions takes nothing returns boolean
    return ( TimerGetElapsed(udg_unitmode) < 15 )
endfunction

function Trig_Range_mode_Actions takes nothing returns nothing
  local integer c = 1
   loop
    exitwhen c > 8
       call AdjustPlayerStateBJ( 300, ConvertedPlayer(c), PLAYER_STATE_RESOURCE_GOLD )  
    set c = c + 1
   endloop
   set c = 0

    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_5943" )

    set udg_range_on = true
   

    call DisableTrigger( GetTriggeringTrigger() )
    call DisableTrigger( gg_trg_Tank_mode )
    call DisableTrigger( gg_trg_Mage_mode )
    call DisableTrigger( gg_trg_Melee_mode )

endfunction

//===========================================================================
function InitTrig_Range_mode takes nothing returns nothing
    set gg_trg_Range_mode = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Range_mode, Player(0), "-RM", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Range_mode, Player(0), "-RANGE", false )
    call TriggerAddCondition( gg_trg_Range_mode, Condition( function Trig_Range_mode_Conditions ) )
    call TriggerAddAction( gg_trg_Range_mode, function Trig_Range_mode_Actions )
endfunction

 

function onrange takes nothing returns nothing
    local integer c = 1
   
    loop
        exitwhen c > 8
        call SetPlayerTechMaxAllowedSwap( udg_Mele_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Mage_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Tank_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Siege_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Flyng_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        set c = c + 1
    endloop
  set c = 0
    call DisableTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_disnorange takes nothing returns nothing
    set gg_trg_disnorange = CreateTrigger(  )
    call TriggerAddAction( gg_trg_disnorange, function onrange )
endfunction

 
function Trig_Mage_mode_Conditions takes nothing returns boolean
    return ( TimerGetElapsed(udg_unitmode) < 15 )
endfunction

function Trig_Mage_mode_Actions takes nothing returns nothing
  local integer c = 1
   loop
    exitwhen c > 8
       call AdjustPlayerStateBJ( 590, ConvertedPlayer(c), PLAYER_STATE_RESOURCE_GOLD )  
    set c = c + 1
   endloop
   set c = 0

    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_5942" )

    set udg_mage_on = true

   
    call DisableTrigger( GetTriggeringTrigger() )
    call DisableTrigger( gg_trg_Tank_mode )
    call DisableTrigger( gg_trg_Range_mode )
    call DisableTrigger( gg_trg_Melee_mode )

endfunction

//===========================================================================
function InitTrig_Mage_mode takes nothing returns nothing
    set gg_trg_Mage_mode = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Mage_mode, Player(0), "-MG", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Mage_mode, Player(0), "-MAGIC", false )
    call TriggerAddCondition( gg_trg_Mage_mode, Condition( function Trig_Mage_mode_Conditions ) )
    call TriggerAddAction( gg_trg_Mage_mode, function Trig_Mage_mode_Actions )
endfunction

 

function onmage takes nothing returns nothing
    local integer c = 1

    loop
        exitwhen c > 8
        call SetPlayerTechMaxAllowedSwap( udg_Mele_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Range_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Tank_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Siege_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Flyng_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        set c = c + 1
    endloop

    call DisableTrigger( GetTriggeringTrigger() )
    set c = 0
endfunction

//===========================================================================
function InitTrig_disnomage takes nothing returns nothing
    set gg_trg_disnomage = CreateTrigger(  )
    call TriggerAddAction( gg_trg_disnomage, function onmage )
endfunction

 
function Trig_Tank_mode_Conditions takes nothing returns boolean
    return ( TimerGetElapsed(udg_unitmode) < 15 )
endfunction

function Trig_Tank_mode_Actions takes nothing returns nothing
  local integer c = 1
   loop
    exitwhen c > 8
       call AdjustPlayerStateBJ( 1850, ConvertedPlayer(c), PLAYER_STATE_RESOURCE_GOLD )  
    set c = c + 1
   endloop
   set c = 0

    call DisplayTextToForce( GetPlayersAll(), "|cffffcc00Tank mode enabled:|r 1850 gold are added to all players")

    set udg_tank_on = true

 
    call DisableTrigger( GetTriggeringTrigger() )
    call DisableTrigger( gg_trg_Mage_mode )
    call DisableTrigger( gg_trg_Range_mode )
    call DisableTrigger( gg_trg_Melee_mode )

endfunction

//===========================================================================
function InitTrig_Tank_mode takes nothing returns nothing
    set gg_trg_Tank_mode = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Tank_mode, Player(0), "-TM", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Tank_mode, Player(0), "-TANK", false )
    call TriggerAddCondition( gg_trg_Tank_mode, Condition( function Trig_Tank_mode_Conditions ) )
    call TriggerAddAction( gg_trg_Tank_mode, function Trig_Tank_mode_Actions )
endfunction

 

function ontank takes nothing returns nothing
    local integer c = 1

    loop
        exitwhen c > 8
        call SetPlayerTechMaxAllowedSwap( udg_Mele_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Mage_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Range_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Siege_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        call SetPlayerTechMaxAllowedSwap( udg_Flyng_Unit[udg_Race[GetConvertedPlayerId(ConvertedPlayer(c))]], 0, ConvertedPlayer(c) )
        set c = c + 1
    endloop
    call DisableTrigger( GetTriggeringTrigger() )
   set c = 0
endfunction

//===========================================================================
function InitTrig_disnotank takes nothing returns nothing
  set gg_trg_disnotank = CreateTrigger(  )
  call TriggerAddAction( gg_trg_disnotank, function ontank )
endfunction

 
unit mode end
  Events
    Time - unitmode expires
  Conditions
  Actions
    Game - Display to (All players) the text: Setting unit mode end.
    Trigger - Turn off (This trigger)
function Trig_Novicemode_Conditions takes nothing returns boolean
    return udg_setting_on == true
endfunction

function Trig_Novicemode_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), ( ( GetPlayerName(Player(0)) + " has Selected/Defaulted |cff7777aaNovice Mode|r" ) + udg_infogame ) )
    // Switching booleans conditions
    set udg_setting_on = false
    set udg_Modetext = "Novice Mode"
    set udg_Novice_On = true
    set udg_Warrior_on = false
    set udg_Warlord_on = false
    // Switching Constants conditions
    call SaveIntegerBJ( 6, 1, 1, udg_ModeC )
    call SaveIntegerBJ( 12, 2, 1, udg_ModeC )
    call SaveIntegerBJ( 24, 3, 1, udg_ModeC )
    call SaveIntegerBJ( 10, 1, 2, udg_ModeC )
    call SaveIntegerBJ( 20, 2, 2, udg_ModeC )
    call SaveIntegerBJ( 30, 3, 2, udg_ModeC )
    call SaveIntegerBJ( 8, 1, 3, udg_ModeC )
    call SaveIntegerBJ( 16, 2, 3, udg_ModeC )
    call SaveIntegerBJ( 28, 3, 3, udg_ModeC )
    call SaveIntegerBJ( 12, 1, 4, udg_ModeC )
    call SaveIntegerBJ( 24, 2, 4, udg_ModeC )
    call SaveIntegerBJ( 32, 3, 4, udg_ModeC )
    set udg_Castle_mode_value = 60
    set udg_Stronghold_mode_Value = 30
    set udg_fortress_mode_value = 15
    set udg_gmode = gg_trg_infonovice
    call DestroyTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_Novicemode takes nothing returns nothing
    set gg_trg_Novicemode = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Novicemode, Player(0), "-novice", true )
    call TriggerAddCondition( gg_trg_Novicemode, Condition( function Trig_Novicemode_Conditions ) )
    call TriggerAddAction( gg_trg_Novicemode, function Trig_Novicemode_Actions )
endfunction

 
function Trig_Warriormode_Conditions takes nothing returns boolean
    return udg_setting_on == true
endfunction

function Trig_Warriormode_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), ( ( GetPlayerName(Player(0)) + " has selected |cffffcc00Warrior Mode|r" ) + udg_infogame ) )
    // Switching booleans conditions
    set udg_setting_on = false
    set udg_Modetext = "Warrior Mode"
    set udg_Novice_On = false
    set udg_Warrior_on = true
    set udg_Warlord_on = false
    // Switching Constants conditions
    call SaveIntegerBJ( 8, 1, 1, udg_ModeC )
    call SaveIntegerBJ( 16, 2, 1, udg_ModeC )
    call SaveIntegerBJ( 24, 3, 1, udg_ModeC )
    call SaveIntegerBJ( 12, 1, 2, udg_ModeC )
    call SaveIntegerBJ( 24, 2, 2, udg_ModeC )
    call SaveIntegerBJ( 32, 3, 2, udg_ModeC )
    call SaveIntegerBJ( 12, 1, 3, udg_ModeC )
    call SaveIntegerBJ( 22, 2, 3, udg_ModeC )
    call SaveIntegerBJ( 34, 3, 3, udg_ModeC )
    call SaveIntegerBJ( 14, 1, 4, udg_ModeC )
    call SaveIntegerBJ( 28, 2, 4, udg_ModeC )
    call SaveIntegerBJ( 36, 3, 4, udg_ModeC )
    set udg_Castle_mode_value = 36
    set udg_Stronghold_mode_Value = 22
    set udg_fortress_mode_value = 8
    set udg_gmode = gg_trg_infowarrior
    call DestroyTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_Warriormode takes nothing returns nothing
    set gg_trg_Warriormode = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Warriormode, Player(0), "-warrior", true )
    call TriggerAddCondition( gg_trg_Warriormode, Condition( function Trig_Warriormode_Conditions ) )
    call TriggerAddAction( gg_trg_Warriormode, function Trig_Warriormode_Actions )
endfunction

 
function Trig_WarlordMode_Conditions takes nothing returns boolean
    return udg_setting_on == true
endfunction

function Trig_WarlordMode_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), ( ( GetPlayerName(Player(0)) + " has selected |cffff0000Warlord Mode|r" ) + udg_infogame ) )
    // Switching booleans conditions
    set udg_setting_on = false
    set udg_Modetext = "Warlord Mode"
    set udg_Novice_On = false
    set udg_Warrior_on = false
    set udg_Warlord_on = true
    // Switching Constants conditions
    call SaveIntegerBJ( 10, 1, 1, udg_ModeC )
    call SaveIntegerBJ( 20, 2, 1, udg_ModeC )
    call SaveIntegerBJ( 30, 3, 1, udg_ModeC )
    call SaveIntegerBJ( 12, 1, 2, udg_ModeC )
    call SaveIntegerBJ( 24, 2, 2, udg_ModeC )
    call SaveIntegerBJ( 36, 3, 2, udg_ModeC )
    call SaveIntegerBJ( 14, 1, 3, udg_ModeC )
    call SaveIntegerBJ( 24, 2, 3, udg_ModeC )
    call SaveIntegerBJ( 32, 3, 3, udg_ModeC )
    call SaveIntegerBJ( 14, 1, 4, udg_ModeC )
    call SaveIntegerBJ( 28, 2, 4, udg_ModeC )
    call SaveIntegerBJ( 46, 3, 4, udg_ModeC )
    set udg_Castle_mode_value = 24
    set udg_Stronghold_mode_Value = 16
    set udg_fortress_mode_value = 6
    set udg_gmode = gg_trg_infowarlord
    call DestroyTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_WarlordMode takes nothing returns nothing
    set gg_trg_WarlordMode = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_WarlordMode, Player(0), "-warlord", true )
    call TriggerAddCondition( gg_trg_WarlordMode, Condition( function Trig_WarlordMode_Conditions ) )
    call TriggerAddAction( gg_trg_WarlordMode, function Trig_WarlordMode_Actions )
endfunction

 
Build Multiboard
  Events
    Time - Init_timer expires
  Conditions
  Actions
    Set setting_on = False
    Countdown Timer - Hide (Last created timer window)
    Custom script: call DestroyTimer( udg_Init_timer )
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        Novice_On Equal to False
        Warrior_on Equal to False
        Warlord_on Equal to False
      Then - Actions
        Trigger - Run Warriormode <gen> (ignoring conditions)
      Else - Actions
    Multiboard - Create a multiboard with 5 columns and (player_online + 5) rows, titled Modetext
    For each (Integer A) from 1 to (player_online + 5), do (Actions)
      Loop - Actions
        For each (Integer B) from 1 to 5, do (Actions)
          Loop - Actions
            Multiboard - Set the display style for (Last created multiboard) item in column (Integer B), row (Integer A) to Show text and Hide icons
        Multiboard - Set the display style for (Last created multiboard) item in column 2, row 1 to Show text and Show icons
        Multiboard - Set the display style for (Last created multiboard) item in column 3, row 1 to Show text and Show icons
        Multiboard - Set the display style for (Last created multiboard) item in column 4, row 1 to Show text and Show icons
        Multiboard - Set the width for (Last created multiboard) item in column 1, row (Integer A) to 15.00% of the total screen width
        Multiboard - Set the width for (Last created multiboard) item in column 2, row (Integer A) to 2.50% of the total screen width
        Multiboard - Set the width for (Last created multiboard) item in column 3, row (Integer A) to 2.50% of the total screen width
        Multiboard - Set the width for (Last created multiboard) item in column 4, row (Integer A) to 2.50% of the total screen width
        Multiboard - Set the width for (Last created multiboard) item in column 5, row (Integer A) to 10.00% of the total screen width
    For each (Integer B) from 1 to 5, do (Actions)
      Loop - Actions
        Multiboard - Set the color for (Last created multiboard) item in column (Integer B), row 1 to (100%, 80%, 20%) with 0% transparency
    Multiboard - Set the text for (Last created multiboard) item in column 1, row 1 to Player
    Multiboard - Set the icon for (Last created multiboard) item in column 2, row 1 to ReplaceableTextures\CommandButtons\BTNSacrifice.blp
    Multiboard - Set the icon for (Last created multiboard) item in column 3, row 1 to ReplaceableTextures\CommandButtons\BTNCastle.blp
    Multiboard - Set the icon for (Last created multiboard) item in column 4, row 1 to ReplaceableTextures\CommandButtons\BTNChestOfGold.blp
    Multiboard - Set the text for (Last created multiboard) item in column 5, row 1 to Rank
    Multiboard - Set the color for (Last created multiboard) item in column 1, row 2 to (100.00%, 100.00%, 0.00%) with 0% transparency
    Multiboard - Set the text for (Last created multiboard) item in column 1, row 2 to (Tyr + Forces)
    Multiboard - Set the text for (Last created multiboard) item in column 5, row 2 to (|cffffcc00Emblems left: + ((String((Integer((4.00 - victory_R))))) + |r))
    Multiboard - Set the color for (Last created multiboard) item in column 1, row (TyrForces + 3) to (100.00%, 100.00%, 0.00%) with 0% transparency
    Multiboard - Set the text for (Last created multiboard) item in column 1, row (TyrForces + 3) to (Ebony + Forces)
    Multiboard - Set the text for (Last created multiboard) item in column 5, row (TyrForces + 3) to (|cffffcc00Emblems Lefts: + ((String((Integer((4.00 - victory_B))))) + |r))
    -------- inserting players --------
    For each (Integer A) from 1 to TyrForces, do (Actions)
      Loop - Actions
        Multiboard - Set the display style for (Last created multiboard) item in column 1, row ((Integer A) + 2) to Show text and Show icons
        Multiboard - Set the icon for (Last created multiboard) item in column 1, row ((Integer A) + 2) to Iconpatch[Race[(Player number of tyr_player[(Integer A)])]]
        Multiboard - Set the text for (Last created multiboard) item in column 1, row ((Integer A) + 2) to (((- + Player_color[(Integer A)]) + (Name of tyr_player[(Integer A)])) + |r)
        Multiboard - Set the text for (Last created multiboard) item in column 2, row ((Integer A) + 2) to ((|cffff0000 + (String((tyr_player[(Integer A)] Units Killed)))) + |r)
        Multiboard - Set the text for (Last created multiboard) item in column 3, row ((Integer A) + 2) to ((|cff7777aa + (String((Count structures controlled by tyr_player[(Integer A)] (Exclude incomplete structures))))) + |r)
        Multiboard - Set the text for (Last created multiboard) item in column 4, row ((Integer A) + 2) to ((|cffffcc00 + (String((tyr_player[(Integer A)] Current gold)))) + |r)
        Multiboard - Set the text for (Last created multiboard) item in column 5, row ((Integer A) + 2) to ((Player_color[(Player number of tyr_player[(Integer A)])] + Player_rank[(Player number of tyr_player[(Integer A)])]) + |r)
    For each (Integer A) from 1 to EbonyForces, do (Actions)
      Loop - Actions
        Set Ebony_inc = ((Integer A) + (TyrForces + 1))
        Multiboard - Set the display style for (Last created multiboard) item in column 1, row (Ebony_inc + 2) to Show text and Show icons
        Multiboard - Set the icon for (Last created multiboard) item in column 1, row (Ebony_inc + 2) to Iconpatch[Race[(Player number of Ebony_player[(Integer A)])]]
        Multiboard - Set the text for (Last created multiboard) item in column 1, row (Ebony_inc + 2) to (((- + Player_color[(Player number of Ebony_player[(Integer A)])]) + (Name of Ebony_player[(Integer A)])) + |r)
        Multiboard - Set the text for (Last created multiboard) item in column 2, row (Ebony_inc + 2) to ((|cffff0000 + (String((Ebony_player[(Integer A)] Units Killed)))) + |r)
        Multiboard - Set the text for (Last created multiboard) item in column 3, row (Ebony_inc + 2) to ((|cff7777aa + (String((Count structures controlled by Ebony_player[(Integer A)] (Exclude incomplete structures))))) + |r)
        Multiboard - Set the text for (Last created multiboard) item in column 4, row (Ebony_inc + 2) to ((|cffffcc00 + (String((Ebony_player[(Integer A)] Current gold)))) + |r)
        Multiboard - Set the text for (Last created multiboard) item in column 5, row (Ebony_inc + 2) to ((Player_color[(Player number of Ebony_player[(Integer A)])] + Player_rank[(Player number of Ebony_player[(Integer A)])]) + |r)
    Multiboard - Show (Last created multiboard)
    Trigger - Turn on timerturno <gen>
    Trigger - Turn on taxing <gen>
    Trigger - Turn on UP <gen>
    Trigger - Turn on actualiza <gen>
function Trig_timerturno_Actions takes nothing returns nothing
    set udg_Timer_turno = ( udg_Timer_turno - 1 )
    if ( udg_Timer_turno == 0 ) then
        set udg_Timer_turno = 20
        set udg_turno = ( udg_turno + 1 )
    endif

    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, ( udg_player_online + 5 ), ( "|cffffcc00Turn: " + ( I2S(udg_turno) + " - ends in:|r" ) ) )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, ( udg_player_online + 5 ), I2S(udg_Timer_turno) )
endfunction

//===========================================================================
function InitTrig_timerturno takes nothing returns nothing
    set gg_trg_timerturno = CreateTrigger(  )
    call DisableTrigger( gg_trg_timerturno )
    call TriggerRegisterTimerEventPeriodic( gg_trg_timerturno, 1.00 )
    call TriggerAddAction( gg_trg_timerturno, function Trig_timerturno_Actions )
endfunction

 
function Trig_get_vampire_Func001002002 takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) == 'n025' )
endfunction

function Trig_get_vampire_Actions takes nothing returns nothing
    set udg_vampire_group = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_get_vampire_Func001002002))
    if ( IsUnitGroupEmptyBJ(udg_vampire_group) == false ) then
        set udg_vampire_unit = GroupPickRandomUnit(udg_vampire_group)
        call EnableTrigger( gg_trg_daytime )
        call EnableTrigger( gg_trg_nighttime )
        call DestroyGroup(udg_vampire_group)
    else
        call DestroyGroup(udg_vampire_group)
    endif
endfunction

//===========================================================================
function InitTrig_get_vampire takes nothing returns nothing
    set gg_trg_get_vampire = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_get_vampire, 80.00 )
    call TriggerAddAction( gg_trg_get_vampire, function Trig_get_vampire_Actions )
endfunction

 
function Trig_actualiza_Actions takes nothing returns nothing
    local integer c = 1

    loop
        exitwhen c > 8
        set udg_builds[c] = ( CountLivingPlayerUnitsOfTypeId(udg_Main_build[udg_Race[c]], ConvertedPlayer(c)) + CountLivingPlayerUnitsOfTypeId(udg_Fupgrade_build[udg_Race[c]], ConvertedPlayer(c)) + CountLivingPlayerUnitsOfTypeId(udg_Supgrade_build[udg_Race[c]], ConvertedPlayer(c)))
        set c = c + 1
    endloop
    set c = 1
   

    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 5, 2, ( "|cffff0000Emblems left:" + ( I2S(R2I(( 4.00 - udg_victory_R ))) + "|r" ) ) )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 5, ( udg_TyrForces + 3 ), ( "|cffffff00Emblems left:" + ( I2S(R2I(( 4.00 - udg_victory_B ))) + "|r" ) ) )

    loop
        exitwhen c > udg_TyrForces
        call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, ( c + 2 ), udg_Iconpatch[udg_Race[GetConvertedPlayerId(udg_tyr_player[c])]] )
        call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, ( c + 2 ), ( ( ( "- " + udg_Player_color[c] ) + GetPlayerName(udg_tyr_player[c]) ) + "|r" ) )
        call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, ( c + 2 ), ( ( "|cffff0000" + I2S(GetPlayerScore(udg_tyr_player[c], PLAYER_SCORE_UNITS_KILLED)) ) + "|r" ) )
        call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 3, ( c + 2 ), ( ( "|cff7777aa" + I2S(udg_builds[GetConvertedPlayerId(udg_tyr_player[c])]) ) + "|r" ) )
        call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 4, ( c + 2 ), ( ( "|cffffcc00" + I2S(GetPlayerState(udg_tyr_player[c], PLAYER_STATE_RESOURCE_GOLD)) ) + "|r" ) )
        call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 5, ( c + 2 ), ( ( udg_Player_color[GetConvertedPlayerId(udg_tyr_player[c])] + udg_Player_rank[GetConvertedPlayerId(udg_tyr_player[c])] ) + "|r" ) )
        set c = c + 1
    endloop
    set c = 1

    loop
        exitwhen c > udg_EbonyForces
        set udg_Ebony_inc = ( c + ( udg_TyrForces + 1 ) )
        call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, ( udg_Ebony_inc + 2 ), udg_Iconpatch[udg_Race[GetConvertedPlayerId(udg_Ebony_player[c])]] )
        call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, ( udg_Ebony_inc + 2 ), ( ( ( "- " + udg_Player_color[GetConvertedPlayerId(udg_Ebony_player[c])] ) + GetPlayerName(udg_Ebony_player[c]) ) + "|r" ) )
        call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, ( udg_Ebony_inc + 2 ), ( ( "|cffff0000" + I2S(GetPlayerScore(udg_Ebony_player[c], PLAYER_SCORE_UNITS_KILLED)) ) + "|r" ) )
        call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 3, ( udg_Ebony_inc + 2 ), ( ( "|cff7777aa" + I2S(udg_builds[GetConvertedPlayerId(udg_Ebony_player[c])]) ) + "|r" ) )
        call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 4, ( udg_Ebony_inc + 2 ), ( ( "|cffffcc00" + I2S(GetPlayerState(udg_Ebony_player[c], PLAYER_STATE_RESOURCE_GOLD)) ) + "|r" ) )
        call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 5, ( udg_Ebony_inc + 2 ), ( ( udg_Player_color[GetConvertedPlayerId(udg_Ebony_player[c])] + udg_Player_rank[GetConvertedPlayerId(udg_Ebony_player[c])] ) + "|r" ) )
        set c = c + 1
    endloop
endfunction



//===========================================================================
function InitTrig_actualiza takes nothing returns nothing
    set gg_trg_actualiza = CreateTrigger(  )
    call DisableTrigger( gg_trg_actualiza )
    call TriggerRegisterTimerEventPeriodic( gg_trg_actualiza, 1.00 )
    call TriggerAddAction( gg_trg_actualiza, function Trig_actualiza_Actions )
endfunction

 
function Trig_builder_Actions takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'u01Y', Player(0), GetCameraTargetPositionLoc(), bj_UNIT_FACING )
    call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetLastCreatedUnit() )
    call IssueImmediateOrderBJ( GetLastCreatedUnit(), "humanbuild" )
    call IssueBuildOrderByIdLocBJ( GetLastCreatedUnit(), udg_Otbuild[GetRandomInt(1, 10)], GetUnitLoc(GetLastCreatedUnit()) )
endfunction

//===========================================================================
function InitTrig_builder takes nothing returns nothing
    set gg_trg_builder = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_builder, Player(0), "-build", true )
    call TriggerAddAction( gg_trg_builder, function Trig_builder_Actions )
endfunction

 
demo1
  Events
    Player - Player 1 (Red) types a chat message containing -make as A substring
  Conditions
  Actions
    Set CHT_O = (Entered chat string)
    Set CHT_L = (Substring(CHT_O, 12, 13))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to succ
      Then - Actions
        Unit - Create 1 Succubus Warlord for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to phoe
      Then - Actions
        Unit - Create 1 Phoenix Warlord for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to expl
      Then - Actions
        Unit - Create 1 Explosive Warlords for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to temp
      Then - Actions
        Unit - Create 1 Templar Warlord for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to vamp
      Then - Actions
        Unit - Create 1 Vamp Warlord for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to skel
      Then - Actions
        Unit - Create 1 Skeleton Warlord for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to zomb
      Then - Actions
        Unit - Create 1 Ghoul Warlord for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to ward
      Then - Actions
        Unit - Create 1 Warden Warlord for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to knig
      Then - Actions
        Unit - Create 1 Knight Warlord for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to snea
      Then - Actions
        Unit - Create 1 Sneak Warlord for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Substring(CHT_O, 7, 10)) Equal to trol
      Then - Actions
        Unit - Create 1 Troll Warlord (melee) for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to (Integer(CHT_L)), Hide level-up graphics
      Else - Actions
kill
  Events
    Player - Player 1 (Red) types a chat message containing -kill as An exact match
  Conditions
  Actions
    Unit - Remove (Random unit from (Units currently selected by (Triggering player))) from the game
function Trig_abretunel_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A017'
endfunction

function Trig_abretunel_Func004002 takes nothing returns nothing
    set udg_ExitTunnel_unit[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = GetEnumUnit()
endfunction

function Trig_abretunel_Actions takes nothing returns nothing
    set udg_Tunnel_on[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = true
    call TriggerSleepAction( 0.10 )
    set udg_Temp_group1 = GetUnitsOfPlayerAndTypeId(GetOwningPlayer(GetSpellAbilityUnit()), 'n011')
    call ForGroupBJ( udg_Temp_group1, function Trig_abretunel_Func004002 )
    call DestroyGroup(udg_Temp_group1)
endfunction

//===========================================================================
function InitTrig_abretunel takes nothing returns nothing
    set gg_trg_abretunel = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_abretunel, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_abretunel, Condition( function Trig_abretunel_Conditions ) )
    call TriggerAddAction( gg_trg_abretunel, function Trig_abretunel_Actions )
endfunction

 
function Trig_entratunel_Conditions takes nothing returns boolean
    return udg_Tunnel_on[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))] == true
endfunction

function Trig_entratunel_Actions takes nothing returns nothing
    set udg_temp_point = GetUnitLoc(udg_ExitTunnel_unit[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))])
    call SetUnitPositionLocFacingBJ( GetEnteringUnit(), udg_temp_point, -45.00 )
    call IssuePointOrderLocBJ( GetEnteringUnit(), "attack", OffsetLocation(udg_temp_point, 250.00, -250.00) )
    call RemoveLocation(udg_temp_point)
endfunction

//===========================================================================
function InitTrig_entratunel takes nothing returns nothing
    set gg_trg_entratunel = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_entratunel, gg_rct_Tunel1 )
    call TriggerRegisterEnterRectSimple( gg_trg_entratunel, gg_rct_Tunel2 )
    call TriggerRegisterEnterRectSimple( gg_trg_entratunel, gg_rct_Tunel3 )
    call TriggerRegisterEnterRectSimple( gg_trg_entratunel, gg_rct_Tunel4 )
    call TriggerRegisterEnterRectSimple( gg_trg_entratunel, gg_rct_Tunel5 )
    call TriggerRegisterEnterRectSimple( gg_trg_entratunel, gg_rct_Tunel6 )
    call TriggerRegisterEnterRectSimple( gg_trg_entratunel, gg_rct_Tunel7 )
    call TriggerRegisterEnterRectSimple( gg_trg_entratunel, gg_rct_Tunel8 )
    call TriggerAddCondition( gg_trg_entratunel, Condition( function Trig_entratunel_Conditions ) )
    call TriggerAddAction( gg_trg_entratunel, function Trig_entratunel_Actions )
endfunction

 
function Trig_cierratunnel_Conditions takes nothing returns boolean
    return ( GetDyingUnit() == udg_ExitTunnel_unit[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] )
endfunction

function Trig_cierratunnel_Actions takes nothing returns nothing
    set udg_Tunnel_on[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] = false
endfunction

//===========================================================================
function InitTrig_cierratunnel takes nothing returns nothing
    set gg_trg_cierratunnel = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_cierratunnel, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_cierratunnel, Condition( function Trig_cierratunnel_Conditions ) )
    call TriggerAddAction( gg_trg_cierratunnel, function Trig_cierratunnel_Actions )
endfunction

 
//TESH.scrollpos=-1
//TESH.alwaysfold=0
function TMC takes nothing returns boolean
    return GetKillingUnitBJ()!= GetDyingUnit()
endfunction

function TMA takes nothing returns nothing
  local unit k = GetKillingUnitBJ()
  local texttag t=CreateTextTagUnitBJ("MASSIVE KILL +5kp", k, 0, 14.00, 100.00, 0.00, 0.00, 100.00 )

    call SetTextTagVelocityBJ(t,64,90)
    call PolledWait(2)
    call DestroyTextTag(t)
    set k = null
   
endfunction

//===========================================================================
function InitTrig_MK takes nothing returns nothing
    set gg_trg_MK = CreateTrigger(  )
     call TriggerAddCondition( gg_trg_MK, Condition( function TMC ) )
     call TriggerAddAction( gg_trg_MK, function TMA )
endfunction

 


function Tpillage takes nothing returns nothing
  local unit k = udg_pillager
  local texttag t=CreateTextTagUnitBJ("PILLAGE!", k, 0, 14.00, 70.00, 0.00, 0.00, 100.00 )

    call SetTextTagVelocityBJ(t,64,90)
    call PolledWait(2)
    call DestroyTextTag(t)
    set k = null
   
endfunction

//===========================================================================
function InitTrig_Ptext takes nothing returns nothing
    set gg_trg_Ptext = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Ptext, function Tpillage )
endfunction

 
function Trig_Build_resources_Actions takes nothing returns nothing
   local texttag t=CreateTextTagUnitBJ( ( "+ " + I2S(( GetPlayerState(GetOwningPlayer(GetDyingUnit()), PLAYER_STATE_RESOURCE_GOLD) / 10 )) ), GetDyingUnit(), 0, 8, 100, 100, 25, 15 )
    call SetTextTagVelocityBJ(t,64,90)
    call PolledWait(1)
    call DestroyTextTag(t)
endfunction

//===========================================================================
function InitTrig_Build_resources takes nothing returns nothing
    set gg_trg_Build_resources = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Build_resources, function Trig_Build_resources_Actions )
endfunction

 
function Trig_Thief_Conditions takes nothing returns boolean
return ((GetUnitTypeId(GetAttacker()) == 'n028' ) and (IsUnitType(GetAttackedUnitBJ(), UNIT_TYPE_STRUCTURE) == false) and (GetOwningPlayer(GetAttackedUnitBJ()) != GetOwningPlayer(GetAttacker())) and (IsPlayerAlly(GetOwningPlayer(GetAttackedUnitBJ()), GetOwningPlayer(GetAttacker())) == false))
endfunction

function Trig_Thief_Func003C takes nothing returns boolean
    return (( udg_thief_gold_A == 5 ) or (udg_thief_gold_A == 6 ))
endfunction

function Trig_Thief_Func004C takes nothing returns boolean
    return udg_thief_kp_A == 7
endfunction

function Trig_Thief_Actions takes nothing returns nothing
    set udg_thief_gold_A = GetRandomInt(1, 14)
    set udg_thief_kp_A = GetRandomInt(1, 30)
    if ( Trig_Thief_Func003C() ) then
        call TriggerExecute( gg_trg_Thief_Gold )
        call AdjustPlayerStateBJ( GetUnitLevel(GetAttackedUnitBJ()), GetOwningPlayer(GetAttacker()), PLAYER_STATE_RESOURCE_GOLD )
        call AdjustPlayerStateBJ( ( 0 - GetUnitLevel(GetAttackedUnitBJ()) ), GetOwningPlayer(GetAttackedUnitBJ()), PLAYER_STATE_RESOURCE_GOLD )
    endif
    if ( Trig_Thief_Func004C() ) then
        call TriggerExecute( gg_trg_Thief_Kp )
        call AdjustPlayerStateBJ( GetUnitLevel(GetAttackedUnitBJ()), GetOwningPlayer(GetAttacker()), PLAYER_STATE_RESOURCE_LUMBER )
        call AdjustPlayerStateBJ( ( 0 - GetUnitLevel(GetAttackedUnitBJ()) ), GetOwningPlayer(GetAttackedUnitBJ()), PLAYER_STATE_RESOURCE_LUMBER )
    endif
    set udg_thief_gold_A = 0
    set udg_thief_kp_A = 0
endfunction

//===========================================================================
function InitTrig_Thief takes nothing returns nothing
    set gg_trg_Thief = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Thief, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Thief, Condition( function Trig_Thief_Conditions ) )
    call TriggerAddAction( gg_trg_Thief, function Trig_Thief_Actions )
endfunction

 
function Trig_Thief_Gold_Actions takes nothing returns nothing
   local texttag t=CreateTextTagUnitBJ( ( "-" + I2S(GetUnitLevel(GetAttackedUnitBJ())) + "g" ), GetAttackedUnitBJ(), 0, 9.00, 100, 100, 10.00, 0 )
    call SetTextTagVelocityBJ(t,64,90)
    call PolledWait(1)
    call DestroyTextTag(t)
endfunction

//===========================================================================
function InitTrig_Thief_Gold takes nothing returns nothing
    set gg_trg_Thief_Gold = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Thief_Gold, function Trig_Thief_Gold_Actions )
endfunction

 
function Trig_Mtrust_Actions takes nothing returns nothing
   local texttag t=CreateTextTagUnitBJ( ( "-" + I2S(R2I(udg_Mtrustt))), GetSpellTargetUnit(), 0, 18.00, 100, 10, 10.00, 0 )
    call SetTextTagVelocityBJ(t,64,90)
    call PolledWait(1)
    call DestroyTextTag(t)
endfunction

//===========================================================================
function InitTrig_Mtrust_text takes nothing returns nothing
    set gg_trg_Mtrust_text = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Mtrust_text, function Trig_Mtrust_Actions )
endfunction

 
function Trig_Thief_Kp_Actions takes nothing returns nothing
   local texttag t=CreateTextTagUnitBJ( ( "-" + I2S(GetUnitLevel(GetAttackedUnitBJ())) + "kp"), GetAttackedUnitBJ(), 0, 9.00, 100, 10, 100.00, 0 )
    call SetTextTagVelocityBJ(t,64,90)
    call PolledWait(1)
    call DestroyTextTag(t)
endfunction

//===========================================================================
function InitTrig_Thief_Kp takes nothing returns nothing
    set gg_trg_Thief_Kp = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Thief_Kp, function Trig_Thief_Kp_Actions )
endfunction

 
This is the Main script.
function Clear takes integer unitdata, integer killer_temp, integer looping, integer dtrange, integer loadtype, integer loadint, integer rank, string loadstr, unit k, unit d returns nothing
   
            set unitdata = 0
            set killer_temp = 0
            set looping  = 0
            set dtrange = 0
            set loadtype = 0
            set loadint = 0
            set rank = 0
            set loadstr = null
            set k = null
            set d = null

endfunction


function UPC takes nothing returns boolean
    return IsUnitType(GetKillingUnitBJ(), UNIT_TYPE_HERO) == false
endfunction

function UPA takes nothing returns nothing
    local unit k = GetKillingUnitBJ()
    local unit d = GetDyingUnit()
    local boolean tpe1 = false
    local boolean tpe2 = false
    local boolean tpe3 = false
    local boolean tpe4 = false
    local boolean hav1 = false
    local boolean hav2 = false
    local boolean hav3 = false
    local boolean hav4 = false
    local boolean ck1 = false
    local boolean ck2 = false
    local boolean ck3 = false
    local texttag t = null
    local integer unitdata = 0
    local integer killer_temp = 0
    local integer looping = 1
    local integer dtrange = 0
    local integer loadtype = 0
    local integer loadint = 0
    local integer rank = 0
    local string loadstr = null
    local location newpoint
    local integer innateid
    local integer floop


    set innateid = LoadIntegerBJ(1, GetHandleIdBJ(k), udg_Innate_Ability)


    if ( GetOwningPlayer(k) == GetOwningPlayer(d)  ) then

      call Clear(unitdata,killer_temp,looping,dtrange,loadtype,loadint,rank,loadstr,k,d)
      call RemoveLocation(newpoint)        
      return
    elseif ( IsPlayerAlly(GetOwningPlayer(k), GetOwningPlayer(d)) == true  ) then
      call Clear(unitdata,killer_temp,looping,dtrange,loadtype,loadint,rank,loadstr,k,d)        
      call RemoveLocation(newpoint)
      return
    elseif ( IsUnitType(GetKillingUnitBJ(), UNIT_TYPE_STRUCTURE) == true ) then
      call Clear(unitdata,killer_temp,looping,dtrange,loadtype,loadint,rank,loadstr,k,d)        
      call RemoveLocation(newpoint)
      return
    endif

    set killer_temp = ( GetUnitUserData(k) + GetUnitFoodUsed(d))
    call SetUnitUserData( k, killer_temp )
   
    if ( GetUnitUserData(k) >= 3 ) and ( GetUnitUserData(k) < 12 )  then
        call UnitAddAbilityBJ( 'S000', k )
    elseif ( GetUnitUserData(k) >= 12 ) and ( GetUnitUserData(k) < 36 ) then
        call SetUnitAbilityLevelSwapped( 'S000', k, 2 )
    elseif ( GetUnitUserData(k) >= 36 ) and ( GetUnitUserData(k) < 80 ) then
        call SetUnitAbilityLevelSwapped( 'S000',k, 3 )
    elseif ( GetUnitUserData(k) >= 80 ) then
        call SetUnitAbilityLevelSwapped( 'S000', k, 4 )              
    endif
   

   
    set dtrange = LoadIntegerBJ(1, StringHashBJ(UnitId2StringBJ(GetUnitTypeId(k))), udg_Load_U)
    set loadstr = LoadStringBJ(1, dtrange, udg_Save_U)

    set tpe1 = ( dtrange > 0 ) and ( dtrange < 31 )
    set tpe2 = ( dtrange > 30 ) and ( dtrange < 61 )
    set tpe3 = ( dtrange > 60 ) and ( dtrange < 91 )
    set tpe4 = ( dtrange > 90 ) and ( dtrange < 121 )

    if ( tpe1 == true ) then
        set loadtype = 1
        set loadint = dtrange
    elseif ( tpe2 == true ) then
        set loadtype = 2
        set loadint = ( dtrange - 30 )
    elseif ( tpe3 == true ) then
        set loadtype = 3
        set loadint = ( dtrange - 60 )
    elseif ( tpe4 == true ) then
        set loadtype = 4
        set loadint = ( dtrange - 90 )
     endif
 
   
  set ck1 = (loadint < 11)  
  set ck2 = ( loadint > 10 ) and ( loadint < 21)
  set ck3 = ( loadint > 20 ) and ( loadint < 31)

   if ( ck1 == true ) then

     set rank = 3
   
   elseif ( ck2 == true ) then

     set rank = 1

   elseif ( ck3 == true ) then

     set rank = 2  

   endif
   
    set unitdata = LoadIntegerBJ(rank, loadtype, udg_ModeC)

    if ( unitdata == 0 ) then

       call Clear(unitdata,killer_temp,looping,dtrange,loadtype,loadint,rank,loadstr,k,d)        
       call RemoveLocation(newpoint)
      return
   
    endif
   

    if ( GetUnitUserData(k) >= unitdata ) then
         
           
             if ( rank == 3 ) then
                 
                    set hav1 = ( loadtype == 1) and ( udg_Have_meleeW[GetConvertedPlayerId(GetOwningPlayer(k))] == true )
                    set hav2 = ( loadtype == 2) and ( udg_Have_rangeW[GetConvertedPlayerId(GetOwningPlayer(k))] == true )
                    set hav3 = ( loadtype == 3) and ( udg_Have_mageW[GetConvertedPlayerId(GetOwningPlayer(k))] == true )
                    set hav4 = ( loadtype == 4) and ( udg_Have_tankW[GetConvertedPlayerId(GetOwningPlayer(k))] == true )
                   
                 if (hav1 == true) or (hav2 == true) or (hav3 == true) or (hav4 == true) then

                  call Clear(unitdata,killer_temp,looping,dtrange,loadtype,loadint,rank,loadstr,k,d)        
                  call RemoveLocation(newpoint)
                  return
                 
                 else
                 
                 
         
                 set floop = 1

            loop
                exitwhen floop > 6
                call UnitRemoveItemFromSlotSwapped( floop, k )
                set floop = floop + 1
            endloop
         
            if (loadtype == 1) then
                set  udg_Have_meleeW[GetConvertedPlayerId(GetOwningPlayer(k))] = true
              elseif (loadtype == 2) then
                set  udg_Have_rangeW[GetConvertedPlayerId(GetOwningPlayer(k))] = true
              elseif (loadtype == 3) then
                set  udg_Have_mageW[GetConvertedPlayerId(GetOwningPlayer(k))] = true
              elseif (loadtype == 4) then
                set  udg_Have_tankW[GetConvertedPlayerId(GetOwningPlayer(k))] = true
             endif
           endif
          endif    
                   
        set t = CreateTextTagUnitBJ( I2S(GetUnitUserData(k))+"/"+I2S(unitdata) , k, 0, 9.00, 100.00, 100.00, 100.00, 15.00 )
        call SetTextTagVelocityBJ(t,64,90)
       
        set newpoint = GetUnitLoc(k)

      if ( IsUnitInGroup(k, udg_Grupo_rescate) == true ) then
        call GroupRemoveUnitSimple(k, udg_Grupo_rescate )
      endif
        call GroupRemoveUnitSimple(k, udg_Innate_group[innateid])
        call FlushChildHashtableBJ( GetHandleIdBJ(k), udg_Innate_Ability )
        call RemoveUnit( k )
        call CreateNUnitsAtLoc( 1, String2UnitIdBJ(loadstr), GetOwningPlayer(k), newpoint, bj_UNIT_FACING )
       
        call UnitAddAbilityBJ( udg_Innate[innateid],GetLastCreatedUnit())
        call UnitAddAbilityBJ( udg_fake_innate[innateid],GetLastCreatedUnit())
        call SaveIntegerBJ( innateid, 1, GetHandleIdBJ(GetLastCreatedUnit()), udg_Innate_Ability )

        call AddSpecialEffectLocBJ( newpoint, udg_UP_effect[udg_Race[GetConvertedPlayerId(GetOwningPlayer(k))]] )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        call RemoveLocation(newpoint)
        if ( GetPlayerController(GetOwningPlayer(GetLastCreatedUnit())) == MAP_CONTROL_COMPUTER ) then
            call IssuePointOrderLocBJ( GetLastCreatedUnit(), "attack", GetPlayerStartLocationLoc(GetOwningPlayer(GetLastCreatedUnit())) )
        endif
     else
   
       set t = CreateTextTagUnitBJ( I2S(GetUnitUserData(k))+"/"+I2S(unitdata) , k, 0, 9.00, 100.00, 50.00, 50.00, 35.00 )
       call SetTextTagVelocityBJ(t,64,90)

     endif


    call PolledWait(1)
    call DestroyTextTag(t)
    call Clear(unitdata,killer_temp,looping,dtrange,loadtype,loadint,rank,loadstr,k,d)        
     
endfunction

//===========================================================================
function InitTrig_UP takes nothing returns nothing
    set gg_trg_UP = CreateTrigger(  )
    call DisableTrigger( gg_trg_UP )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_UP, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_UP, Condition( function UPC ) )
    call TriggerAddAction( gg_trg_UP, function UPA )
endfunction

 
Setting settlement stock upgraded units recovers from the death.

GetConvertedPlayerId(GetOwningPlayer(udg_AllU))
function RCVC takes nothing returns boolean
   local unit d = GetDyingUnit()
   local integer dtrange = 0
   local integer loadtype = 0
   local integer loadint = 0
   local boolean b1
   local boolean b2
   local boolean b3
   local boolean b4
   local boolean c1
   local boolean c2
   local boolean c3
   
    set dtrange = LoadIntegerBJ(1, StringHashBJ(UnitId2StringBJ(GetUnitTypeId(d))), udg_Load_U)


    set b1 = ( dtrange > 0 ) and ( dtrange < 31 )
    set b2 = ( dtrange > 30 ) and ( dtrange < 61 )
    set b3 = ( dtrange > 60 ) and ( dtrange < 91 )
    set b4 = ( dtrange > 90 ) and ( dtrange < 121 )

    if ( b1 == true ) then
        set loadtype = 1
        set loadint = dtrange
    elseif ( b2 == true ) then
        set loadtype = 2
        set loadint = ( dtrange - 30 )
    elseif ( b3 == true ) then
        set loadtype = 3
        set loadint = ( dtrange - 60 )
    elseif ( b4 == true ) then
        set loadtype = 4
        set loadint = ( dtrange - 90 )
     endif
 
   
  set c1 = ( loadint > 0 ) and ( loadint < 11)
  set c2 = ( loadint > 10 ) and ( loadint < 21)
  set c3 = ( loadint > 20 ) and ( loadint < 31)

   if ( c1 == true ) then

     set d = null
     set dtrange = 0
     set loadint = 0
     set loadtype = 0

     return true
   
   elseif ( c2 == true ) then


     set d = null
     set dtrange = 0
     set loadint = 0
     set loadtype = 0

     return false

   elseif ( c3 == true ) then

   
     set d = null
     set dtrange = 0
     set loadint = 0
     set loadtype = 0

     return true
   endif
   
   
   set d = null
   set dtrange = 0
   set loadint = 0
   set loadtype = 0

   return false
endfunction

function RCVA takes nothing returns nothing
 local unit d = GetDyingUnit()
 local integer n = GetConvertedPlayerId(GetOwningPlayer(d))
 local group g = GetUnitsOfPlayerAndTypeId(GetOwningPlayer(d), 'h03B')
 local unit m = GroupPickRandomUnit(g)
 local integer stock = LoadIntegerBJ(n,StringHashBJ(UnitId2StringBJ(GetUnitTypeId(d))), udg_ST)

 
    if not (m == null) then

    set stock = stock + 1
    call RemoveUnitFromStockBJ( GetUnitTypeId(d), m )
    call AddUnitToStockBJ( GetUnitTypeId(d), m, stock, stock)
    call SaveIntegerBJ( stock,n,StringHashBJ(UnitId2StringBJ(GetUnitTypeId(d))), udg_ST )

    endif

    set d = null
    set m = null
    set stock = 0
    set n = 0
    call DestroyGroup(g)
 
endfunction

//===========================================================================
function InitTrig_RCV takes nothing returns nothing
    set gg_trg_RCV = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_RCV, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_RCV, Condition( function RCVC ) )
    call TriggerAddAction( gg_trg_RCV, function RCVA )
endfunction

 
Setting settlement stock upgraded units selling.
function BURC takes nothing returns boolean
    return GetUnitTypeId(GetSellingUnit()) == 'h03B'
endfunction

function BURA takes nothing returns nothing
    local unit s = GetSellingUnit()
    local integer n = GetConvertedPlayerId(GetOwningPlayer(s))
    local unit l = GetSoldUnit()
    local integer stock = LoadIntegerBJ(n,StringHashBJ(UnitId2StringBJ(GetUnitTypeId(l))),udg_ST)
     
    set stock = stock - 1

    if ( stock < 1) then
   
    call RemoveUnitFromStockBJ( GetUnitTypeId(l), s )
    call SaveIntegerBJ( stock,n,StringHashBJ(UnitId2StringBJ(GetUnitTypeId(l))), udg_ST )

    else

    call RemoveUnitFromStockBJ( GetUnitTypeId(l), s )
    call AddUnitToStockBJ( GetUnitTypeId(l), s, stock, stock)
    call SaveIntegerBJ( stock,n, StringHashBJ(UnitId2StringBJ(GetUnitTypeId(l))), udg_ST )

    endif

    set s =  null
    set l = null
    set stock = 0  
    set n = 0
 
endfunction

//===========================================================================
function InitTrig_BUR takes nothing returns nothing
    set gg_trg_BUR = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_BUR, EVENT_PLAYER_UNIT_SELL )
    call TriggerAddCondition( gg_trg_BUR, Condition( function BURC ) )
    call TriggerAddAction( gg_trg_BUR, function BURA )
endfunction

 
Setting Training ground requirement.s

function TGRA takes nothing returns nothing

local integer ca = 1
local integer cb = 1
local unit u = null
local boolean array tr


    loop
        exitwhen ca > 3
        set tr[ca] = false
        set ca = ca + 1
    endloop

    loop
        exitwhen cb > 8

        set tr[1] = GetPlayerState(ConvertedPlayer(cb), PLAYER_STATE_RESOURCE_FOOD_CAP) > 99

        set tr[2] = GetPlayerScore(ConvertedPlayer(cb), PLAYER_SCORE_UNITS_KILLED) > 59

        set tr[3] = udg_TGR[cb] == false


       
        if (tr[1]==true) and (tr[2]==true) and (tr[3]==true) then
         
          set u = LoadUnitHandleBJ(1, cb, udg_ST)
          call UnitAddAbilityBJ( 'A0AD', u )

          set udg_TGR[GetConvertedPlayerId(ConvertedPlayer(cb))] = true
          call QuestMessageBJ( GetForceOfPlayer(ConvertedPlayer(cb)), bj_QUESTMESSAGE_COMPLETED, udg_TGE )
        endif

        set cb = cb + 1
    endloop

 set ca = 0
 set cb = 0
 set u = null


endfunction

//===========================================================================
function InitTrig_TGR takes nothing returns nothing
    set gg_trg_TGR = CreateTrigger(  )
    call TriggerAddAction( gg_trg_TGR, function TGRA )
endfunction

 
Selling training unit.
function TGSC takes nothing returns boolean
    return GetUnitTypeId(GetSellingUnit()) == 'n031'
endfunction

function TGSE takes nothing returns nothing
     call DestroyEffectBJ(AddSpecialEffectTargetUnitBJ( "chest", GetEnumUnit(), "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" ))
endfunction

function TGSA takes nothing returns nothing
    local unit u = GetSoldUnit()
    local location p = GetUnitLoc(GetSellingUnit())
    local group g

    call SetUnitOwner( u, Player(PLAYER_NEUTRAL_AGGRESSIVE), true )
    call DestroyEffectBJ(AddSpecialEffectTargetUnitBJ( "chest", u, "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" ))

    set g = CreateNUnitsAtLoc( 11, GetUnitTypeId(u), Player(PLAYER_NEUTRAL_AGGRESSIVE), p, bj_UNIT_FACING )
    call ForGroupBJ( g, function TGSE )

    call RemoveLocation(p)
    call DestroyGroup(g)

    set u = null
endfunction

//===========================================================================
function InitTrig_TGS takes nothing returns nothing
    set gg_trg_TGS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_TGS, EVENT_PLAYER_UNIT_SELL )
    call TriggerAddCondition( gg_trg_TGS, Condition( function TGSC) )
    call TriggerAddAction( gg_trg_TGS, function TGSA )
endfunction

 
function Trig_owningbuild_Conditions takes nothing returns boolean
    return (( GetUnitDefaultAcquireRange(GetDyingUnit()) == 1.00 ) or ( GetUnitDefaultAcquireRange(GetDyingUnit()) == 2.00 ) or ( GetUnitDefaultAcquireRange(GetDyingUnit()) == 3.00 ))
endfunction

function Trig_owningbuild_Func002001 takes nothing returns boolean
    return ( GetPlayerController(GetOwningPlayer(GetKillingUnitBJ())) == MAP_CONTROL_COMPUTER )
endfunction

function Trig_owningbuild_Func003001 takes nothing returns boolean
    return ( GetPlayerSlotState(GetOwningPlayer(GetKillingUnitBJ())) == PLAYER_SLOT_STATE_LEFT )
endfunction

function Trig_owningbuild_Func005Func001Func001C takes nothing returns boolean
    return GetUnitDefaultAcquireRange(GetDyingUnit()) == 3.00
endfunction

function Trig_owningbuild_Func005Func001C takes nothing returns boolean
    return GetUnitDefaultAcquireRange(GetDyingUnit()) == 2.00
endfunction

function Trig_owningbuild_Func005C takes nothing returns boolean
    return GetUnitDefaultAcquireRange(GetDyingUnit()) == 1.00
endfunction

function Trig_owningbuild_Actions takes nothing returns nothing
    local location p
    call TriggerExecute( gg_trg_Build_resources )
    if ( Trig_owningbuild_Func002001() ) then
        return
    endif
    if ( Trig_owningbuild_Func003001() ) then
        return
    endif
    set p = GetUnitLoc(GetDyingUnit())
    if ( Trig_owningbuild_Func005C() ) then
        call CreateNUnitsAtLoc( 1, udg_owned_Main[udg_Race[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))]], GetOwningPlayer(GetKillingUnitBJ()), p, bj_UNIT_FACING )
        call UnitApplyTimedLifeBJ( 45.00, 'BTLF', GetLastCreatedUnit() )
            call SavePlayerHandleBJ(GetOwningPlayer(GetDyingUnit()),1,GetHandleIdBJ(GetLastCreatedUnit()),udg_Ownhash)
       call RemoveLocation(p)
    else
        if ( Trig_owningbuild_Func005Func001C() ) then
            call CreateNUnitsAtLoc( 1, udg_owned_second[udg_Race[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))]], GetOwningPlayer(GetKillingUnitBJ()), p, bj_UNIT_FACING )
            call UnitApplyTimedLifeBJ( 45.00, 'BTLF', GetLastCreatedUnit() )
            call RemoveLocation(p)
                call SavePlayerHandleBJ(GetOwningPlayer(GetDyingUnit()),1,GetHandleIdBJ(GetLastCreatedUnit()),udg_Ownhash)
        else
            if ( Trig_owningbuild_Func005Func001Func001C() ) then
                call CreateNUnitsAtLoc( 1, udg_owned_third[udg_Race[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))]], GetOwningPlayer(GetKillingUnitBJ()), p, bj_UNIT_FACING )
                call UnitApplyTimedLifeBJ( 45.00, 'BTLF', GetLastCreatedUnit() )
                 call SavePlayerHandleBJ(GetOwningPlayer(GetDyingUnit()),1,GetHandleIdBJ(GetLastCreatedUnit()),udg_Ownhash)
               call RemoveLocation(p)
            endif
        endif
    endif
    call AdjustPlayerStateBJ( ( GetPlayerState(GetOwningPlayer(GetDyingUnit()), PLAYER_STATE_RESOURCE_GOLD) / 10 ), GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( ( GetPlayerState(GetOwningPlayer(GetDyingUnit()), PLAYER_STATE_RESOURCE_GOLD) / -20 ), GetOwningPlayer(GetDyingUnit()), PLAYER_STATE_RESOURCE_GOLD )
endfunction

//===========================================================================
function InitTrig_owningbuild takes nothing returns nothing
    set gg_trg_owningbuild = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_owningbuild, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_owningbuild, Condition( function Trig_owningbuild_Conditions ) )
    call TriggerAddAction( gg_trg_owningbuild, function Trig_owningbuild_Actions )
endfunction

 
function Trig_Pillage_A_Conditions takes nothing returns boolean
    return ( GetUnitDefaultAcquireRange(GetSpellAbilityUnit()) == 10 )
endfunction

function Trig_Pillage_A_Func006Func001C takes nothing returns boolean
    return udg_Ability_temp == 'A065'
endfunction

function Trig_Pillage_A_Func006C takes nothing returns boolean
    return udg_Ability_temp == 'A00W'
endfunction

function Trig_Pillage_A_Actions takes nothing returns nothing
    local player A = LoadPlayerHandleBJ(1, GetHandleIdBJ(GetSpellAbilityUnit()), udg_Ownhash)
    local location p = GetUnitLoc(GetSpellAbilityUnit())
    call ClearSelectionForPlayer( GetOwningPlayer(GetSpellAbilityUnit()) )
    set udg_Builder_temp = GetSpellAbilityUnit()
    set udg_Ability_temp = GetSpellAbilityId()
    call TriggerSleepAction( 0.10 )
    if ( Trig_Pillage_A_Func006C() ) then
        call CreateNUnitsAtLoc( 1, udg_Main_build[udg_Race[GetConvertedPlayerId(GetOwningPlayer(udg_Builder_temp))]], Player(PLAYER_NEUTRAL_AGGRESSIVE), p, bj_UNIT_FACING )
        call RemoveLocation(p)
        set udg_pillager = GetLastCreatedUnit()
        call TriggerExecute( gg_trg_Ptext )

    call AdjustPlayerStateBJ( (GetPlayerState(A, PLAYER_STATE_RESOURCE_GOLD) / 20), GetOwningPlayer(udg_Builder_temp), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( (GetPlayerState(A, PLAYER_STATE_RESOURCE_GOLD) / -20), A, PLAYER_STATE_RESOURCE_GOLD )

    else
        if ( Trig_Pillage_A_Func006Func001C() ) then
            call RemoveLocation(p)
            return

        endif
        call RemoveLocation(p)
    endif
    call RemoveUnit( udg_Builder_temp )
 set A = null
endfunction

//===========================================================================
function InitTrig_Pillage_A takes nothing returns nothing
    set gg_trg_Pillage_A = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Pillage_A, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Pillage_A, Condition( function Trig_Pillage_A_Conditions ) )
    call TriggerAddAction( gg_trg_Pillage_A, function Trig_Pillage_A_Actions )
endfunction

 
function Trig_Pillage_B_Conditions takes nothing returns boolean
    return GetUnitDefaultAcquireRange(GetSpellAbilityUnit()) == 11.00
endfunction

function Trig_Pillage_B_Func007Func001C takes nothing returns boolean
    return  udg_Ability_temp == 'A065'
endfunction

function Trig_Pillage_B_Func007C takes nothing returns boolean
    return udg_Ability_temp == 'A00X'
endfunction

function Trig_Pillage_B_Actions takes nothing returns nothing
    local player A = LoadPlayerHandleBJ(1, GetHandleIdBJ(GetSpellAbilityUnit()), udg_Ownhash)
    local location p = GetUnitLoc(GetSpellAbilityUnit())
    call ClearSelectionForPlayer( GetOwningPlayer(GetSpellAbilityUnit()) )

    set udg_Builder_temp = GetSpellAbilityUnit()
    set udg_Ability_temp = GetSpellAbilityId()
    call TriggerSleepAction( 0.10 )
    if ( Trig_Pillage_B_Func007C() ) then
        call CreateNUnitsAtLoc( 1, udg_Fupgrade_build[udg_Race[GetConvertedPlayerId(GetOwningPlayer(udg_Builder_temp))]], Player(PLAYER_NEUTRAL_AGGRESSIVE), p, bj_UNIT_FACING )
   
    call AdjustPlayerStateBJ( (GetPlayerState(A, PLAYER_STATE_RESOURCE_GOLD) / 20), GetOwningPlayer(udg_Builder_temp), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( (GetPlayerState(A, PLAYER_STATE_RESOURCE_GOLD) / -20), A, PLAYER_STATE_RESOURCE_GOLD )
       call RemoveLocation(p)
        set udg_pillager = GetLastCreatedUnit()
        call TriggerExecute( gg_trg_Ptext )  

   else
        if ( Trig_Pillage_B_Func007Func001C() ) then
            call RemoveLocation(p)
            return
        else
        endif
        call RemoveLocation(p)
    endif
    call RemoveUnit( udg_Builder_temp )
 set A = null
endfunction

//===========================================================================
function InitTrig_Pillage_B takes nothing returns nothing
    set gg_trg_Pillage_B = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Pillage_B, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Pillage_B, Condition( function Trig_Pillage_B_Conditions ) )
    call TriggerAddAction( gg_trg_Pillage_B, function Trig_Pillage_B_Actions )
endfunction

 
function Trig_Pillage_C_Conditions takes nothing returns boolean
    return ( GetUnitDefaultAcquireRange(GetSpellAbilityUnit()) == 12.00 )
endfunction

function Trig_Pillage_C_Func007Func001C takes nothing returns boolean
    return udg_Ability_temp == 'A065'
endfunction

function Trig_Pillage_C_Func007C takes nothing returns boolean
    return udg_Ability_temp == 'A00Z'
endfunction

function Trig_Pillage_C_Actions takes nothing returns nothing
    local player A = LoadPlayerHandleBJ(1, GetHandleIdBJ(GetSpellAbilityUnit()), udg_Ownhash)
    local location p = GetUnitLoc(GetSpellAbilityUnit())
    call ClearSelectionForPlayer( GetOwningPlayer(GetSpellAbilityUnit()) )

    set udg_Builder_temp = GetSpellAbilityUnit()
    set udg_Ability_temp = GetSpellAbilityId()
    call TriggerSleepAction( 0.10 )
    if ( Trig_Pillage_C_Func007C() ) then
        call CreateNUnitsAtLoc( 1, udg_Supgrade_build[udg_Race[GetConvertedPlayerId(GetOwningPlayer(udg_Builder_temp))]], Player(PLAYER_NEUTRAL_AGGRESSIVE), p, bj_UNIT_FACING )
        set udg_pillager = GetLastCreatedUnit()
        call TriggerExecute( gg_trg_Ptext )  

    call AdjustPlayerStateBJ( (GetPlayerState(A, PLAYER_STATE_RESOURCE_GOLD) / 20), GetOwningPlayer(udg_Builder_temp), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( (GetPlayerState(A, PLAYER_STATE_RESOURCE_GOLD) / -20), A, PLAYER_STATE_RESOURCE_GOLD )


    call RemoveLocation(p)
    else
        if ( Trig_Pillage_C_Func007Func001C() ) then
            call RemoveLocation(p)
            return
        else
        endif
        call RemoveLocation(p)
    endif
    call RemoveUnit( udg_Builder_temp )
 set A = null
endfunction

//===========================================================================
function InitTrig_Pillage_C takes nothing returns nothing
    set gg_trg_Pillage_C = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Pillage_C, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Pillage_C, Condition( function Trig_Pillage_C_Conditions ) )
    call TriggerAddAction( gg_trg_Pillage_C, function Trig_Pillage_C_Actions )
endfunction

 
function Trig_AutorebuildA_Conditions takes nothing returns boolean
    return (( GetUnitDefaultAcquireRange(GetDyingUnit()) == 10 ) and ( GetUnitTypeId(GetKillingUnitBJ()) != 'u003' ))
endfunction

function Trig_AutorebuildA_Actions takes nothing returns nothing
    local location d = GetUnitLoc(GetDyingUnit())
    call CreateNUnitsAtLoc( 1, udg_Main_build[udg_Race[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))]], Player(PLAYER_NEUTRAL_AGGRESSIVE), d, bj_UNIT_FACING )
    call RemoveLocation(d)
    call FlushChildHashtableBJ( GetHandleIdBJ(GetDyingUnit()), udg_Ownhash )
endfunction

//===========================================================================
function InitTrig_AutorebuildA takes nothing returns nothing
    set gg_trg_AutorebuildA = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_AutorebuildA, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_AutorebuildA, Condition( function Trig_AutorebuildA_Conditions ) )
    call TriggerAddAction( gg_trg_AutorebuildA, function Trig_AutorebuildA_Actions )
endfunction

 
function Trig_AutorebuildB_Conditions takes nothing returns boolean
   return (( GetUnitDefaultAcquireRange(GetDyingUnit()) == 11.00 ) and ( GetUnitTypeId(GetKillingUnitBJ()) != 'u003' ))
endfunction

function Trig_AutorebuildB_Actions takes nothing returns nothing
    local location p = GetUnitLoc(GetDyingUnit())
    call CreateNUnitsAtLoc( 1, udg_Fupgrade_build[udg_Race[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))]], Player(PLAYER_NEUTRAL_AGGRESSIVE), p, bj_UNIT_FACING )
    call RemoveLocation(p)
    call FlushChildHashtableBJ( GetHandleIdBJ(GetDyingUnit()), udg_Ownhash )
endfunction

//===========================================================================
function InitTrig_AutorebuildB takes nothing returns nothing
    set gg_trg_AutorebuildB = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_AutorebuildB, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_AutorebuildB, Condition( function Trig_AutorebuildB_Conditions ) )
    call TriggerAddAction( gg_trg_AutorebuildB, function Trig_AutorebuildB_Actions )
endfunction

 
function Trig_AutorebuildC_Conditions takes nothing returns boolean
   return (( GetUnitDefaultAcquireRange(GetDyingUnit()) == 12.00 ) and ( GetUnitTypeId(GetKillingUnitBJ()) != 'u003' ))
endfunction

function Trig_AutorebuildC_Actions takes nothing returns nothing
    local location q = GetUnitLoc(GetDyingUnit())
    call CreateNUnitsAtLoc( 1, udg_Supgrade_build[udg_Race[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))]], Player(PLAYER_NEUTRAL_AGGRESSIVE), q, bj_UNIT_FACING )
    call RemoveLocation(q)
    call FlushChildHashtableBJ( GetHandleIdBJ(GetDyingUnit()), udg_Ownhash )
endfunction

//===========================================================================
function InitTrig_AutorebuildC takes nothing returns nothing
    set gg_trg_AutorebuildC = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_AutorebuildC, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_AutorebuildC, Condition( function Trig_AutorebuildC_Conditions ) )
    call TriggerAddAction( gg_trg_AutorebuildC, function Trig_AutorebuildC_Actions )
endfunction

 
function Trig_Autodestroy_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A065'
endfunction

function Trig_Autodestroy_Actions takes nothing returns nothing
    local location p = GetUnitLoc(GetSpellAbilityUnit())
    call CreateNUnitsAtLoc( 1, 'u003', GetOwningPlayer(GetSpellAbilityUnit()), p, bj_UNIT_FACING )
    call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
    call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", GetSpellAbilityUnit() )
    call RemoveLocation(p)
    call FlushChildHashtableBJ( GetHandleIdBJ(GetSpellAbilityUnit()), udg_Ownhash )
endfunction

//===========================================================================
function InitTrig_Autodestroy takes nothing returns nothing
    set gg_trg_Autodestroy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Autodestroy, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Autodestroy, Condition( function Trig_Autodestroy_Conditions ) )
    call TriggerAddAction( gg_trg_Autodestroy, function Trig_Autodestroy_Actions )
endfunction

 
function Trig_Debbuger_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_5933" )
endfunction

//===========================================================================
function InitTrig_Debbuger takes nothing returns nothing
    set gg_trg_Debbuger = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Debbuger, function Trig_Debbuger_Actions )
endfunction

 

function SEA takes nothing returns nothing
local integer ca = 1
local integer cb = 1
local unit u = null

    loop
        exitwhen ca > 5
        set udg_settlevent[ca] = false
        set ca = ca + 1
    endloop

    loop
        exitwhen cb > 8

        set udg_settlevent[1] = not(udg_hasst[GetConvertedPlayerId(ConvertedPlayer(cb))])

        set udg_Temp_group1 = GetUnitsOfPlayerAndTypeId(ConvertedPlayer(cb), udg_Fupgrade_build[udg_Race[cb]])
        set udg_settlevent[2] = (CountUnitsInGroup(udg_Temp_group1) > 0)
        call DestroyGroup(udg_Temp_group1)
 
       
        set udg_Temp_group1 = GetUnitsOfPlayerAndTypeId(ConvertedPlayer(cb), udg_Supgrade_build[udg_Race[cb]])
        set udg_settlevent[3] = ( CountUnitsInGroup(udg_Temp_group1) > 0 )
        call DestroyGroup(udg_Temp_group1)

        set udg_Temp_group1 = GetUnitsOfPlayerAndTypeId(ConvertedPlayer(cb), udg_Tower_build[udg_Race[cb]])
        set udg_settlevent[4] = ( CountUnitsInGroup(udg_Temp_group1) > 4 )
        call DestroyGroup(udg_Temp_group1)

        set udg_Temp_group1 = GetUnitsOfPlayerAndTypeId(ConvertedPlayer(cb), udg_Main_build[udg_Race[cb]])
        set udg_settlevent[5] = ( CountUnitsInGroup(udg_Temp_group1) > 2 )
        call DestroyGroup(udg_Temp_group1)

        if (udg_settlevent[1]==true) and (udg_settlevent[2]==true) and (udg_settlevent[3]==true) and (udg_settlevent[4]==true) and (udg_settlevent[5]==true) then
         
          set u = LoadUnitHandleBJ(1, cb, udg_ST)
          call UnitAddAbilityBJ( 'A0AC', u )

          set udg_hasst[GetConvertedPlayerId(ConvertedPlayer(cb))] = true
          call QuestMessageBJ( GetForceOfPlayer(ConvertedPlayer(cb)), bj_QUESTMESSAGE_COMPLETED, udg_STE )
       endif

        set cb = cb + 1
    endloop

 set ca = 0
 set cb = 0
 set u = null
endfunction

//===========================================================================
function InitTrig_SE takes nothing returns nothing
    set gg_trg_SE = CreateTrigger(  )
    call TriggerAddAction( gg_trg_SE, function SEA )
endfunction

 
gmode
  Events
    Player - Player 1 (Red) types a chat message containing -gmode as An exact match
    Player - Player 2 (Blue) types a chat message containing -gmode as An exact match
    Player - Player 3 (Teal) types a chat message containing -gmode as An exact match
    Player - Player 4 (Purple) types a chat message containing -gmode as An exact match
    Player - Player 5 (Yellow) types a chat message containing -gmode as An exact match
    Player - Player 6 (Orange) types a chat message containing -gmode as An exact match
    Player - Player 7 (Green) types a chat message containing -gmode as An exact match
    Player - Player 8 (Pink) types a chat message containing -gmode as An exact match
  Conditions
  Actions
    Trigger - Run gmode (ignoring conditions)
function TXC takes nothing returns boolean
    return udg_hidetax[GetConvertedPlayerId(GetTriggerPlayer())] == true
endfunction

function TXA takes nothing returns nothing
   local integer c = 1
    loop
        exitwhen c > 8
        set udg_tax1[c] = ( CountLivingPlayerUnitsOfTypeId(udg_Main_build[udg_Race[c]], ConvertedPlayer(c)) * udg_fortress_mode_value )
        set udg_tax2[c] = ( CountLivingPlayerUnitsOfTypeId(udg_Fupgrade_build[udg_Race[c]], ConvertedPlayer(c)) * udg_Stronghold_mode_Value )
        set udg_tax3[c] = ( CountLivingPlayerUnitsOfTypeId(udg_Supgrade_build[udg_Race[c]], ConvertedPlayer(c)) * udg_Castle_mode_value )
        set udg_actual_income[