Name | Type | is_array | initial_value |
R5UC_ActivationState | boolean | Yes | |
R5UC_ConvertedUnitGroupPreview | group | Yes | |
R5UC_ConvertibleForce | force | Yes | |
R5UC_DestLocations | location | Yes | |
R5UC_Enabled | boolean | Yes | |
R5UC_LinkedRegions | integer | Yes | |
R5UC_MaxLevelOfConvertedUnit | integer | Yes | |
R5UC_MaxRandomDistance | real | Yes | |
R5UC_NumberOfConverters | integer | No | |
R5UC_OwningForce | force | Yes | |
R5UC_SourceLevelWeight | real | Yes | |
R5UC_SourceNumberWeight | real | Yes | |
R5UC_SourceRegions | rect | Yes | |
R5UC_SumOfLevels | integer | Yes | |
R5UC_SumOfLevelsMax | integer | Yes | |
R5UC_SumOfUnits | integer | Yes | |
R5UC_SumOfUnitsMax | integer | Yes | |
R5UC_TriggeringRegions | rect | Yes | |
R5UC_UnitPool | integer | Yes | |
R5UC_UnitPoolLevels | integer | Yes | |
R5UC_UnitSelectionKind | integer | Yes | |
R5UC_UnitsToConvert | group | Yes | |
R5UC_UnitsToNotConvert | group | Yes |
function Trig_Enable_Unit_Converter_0_Conditions takes nothing returns boolean
if ( not ( GetTriggerUnit() == gg_unit_Hamg_0192 ) ) then
return false
endif
return true
endfunction
function Trig_Enable_Unit_Converter_0_Actions takes nothing returns nothing
set udg_R5UC_Enabled[0] = not udg_R5UC_Enabled[0]
call ExecuteFunc("Trig_R5UC_Add_Remove_Unit_To_Converter_Update")
if udg_R5UC_Enabled[0] then
call DisplayTextToForce( GetPlayersAll(), "Unit Converter #0 is enabled")
else
call DisplayTextToForce( GetPlayersAll(), "Unit Converter #0 is disabled")
endif
endfunction
//===========================================================================
function InitTrig_Enable_Disable_Unit_Converter_0 takes nothing returns nothing
set gg_trg_Enable_Disable_Unit_Converter_0 = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Enable_Disable_Unit_Converter_0, gg_rct_Region_005 )
call TriggerAddCondition( gg_trg_Enable_Disable_Unit_Converter_0, Condition( function Trig_Enable_Unit_Converter_0_Conditions ) )
call TriggerAddAction( gg_trg_Enable_Disable_Unit_Converter_0, function Trig_Enable_Unit_Converter_0_Actions )
endfunction
function Trig_Enable_Unit_Converter_0_and_3_Conditions takes nothing returns boolean
if ( not ( GetTriggerUnit() == gg_unit_Hamg_0192 ) ) then
return false
endif
return true
endfunction
function Trig_Enable_Unit_Converter_0_and_3_Actions takes nothing returns nothing
set udg_R5UC_Enabled[0] = not udg_R5UC_Enabled[0]
set udg_R5UC_Enabled[3] = not udg_R5UC_Enabled[3]
call ExecuteFunc("Trig_R5UC_Add_Remove_Unit_To_Converter_Update")
if udg_R5UC_Enabled[0] then
call DisplayTextToForce( GetPlayersAll(), "Unit Converter #0 is enabled")
else
call DisplayTextToForce( GetPlayersAll(), "Unit Converter #0 is disabled")
endif
if udg_R5UC_Enabled[3] then
call DisplayTextToForce( GetPlayersAll(), "Unit Converter #3 is enabled")
else
call DisplayTextToForce( GetPlayersAll(), "Unit Converter #3 is disabled")
endif
endfunction
//===========================================================================
function InitTrig_Enable_Disable_Unit_Converter_0_and_3 takes nothing returns nothing
set gg_trg_Enable_Disable_Unit_Converter_0_and_3 = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Enable_Disable_Unit_Converter_0_and_3, gg_rct_Region_006 )
call TriggerAddCondition( gg_trg_Enable_Disable_Unit_Converter_0_and_3, Condition( function Trig_Enable_Unit_Converter_0_and_3_Conditions ) )
call TriggerAddAction( gg_trg_Enable_Disable_Unit_Converter_0_and_3, function Trig_Enable_Unit_Converter_0_and_3_Actions )
endfunction
//===========================================================================
function InitTrig_R5UC_Convert_Units takes nothing returns nothing
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_GetConverter takes nothing returns integer
local integer i
set i = 0
loop
exitwhen i >= udg_R5UC_NumberOfConverters
if (IsPointInRegion(GetTriggeringRegion(), GetRectCenterX(udg_R5UC_SourceRegions[i]), GetRectCenterY(udg_R5UC_SourceRegions[i]))) then
return i
endif
set i = i + 1
endloop
return -1
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_Conditions takes nothing returns boolean
local integer unitConverter = Trig_R5UC_Add_Remove_Unit_To_Converter_GetConverter()
if (unitConverter == -1) then
return false
endif
if (IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) or IsUnitType(GetTriggerUnit(), UNIT_TYPE_SUMMONED)) then
return false
endif
if (udg_R5UC_ConvertibleForce[unitConverter] != null) then
return (IsUnitInForce(GetTriggerUnit(), udg_R5UC_ConvertibleForce[unitConverter]))
endif
return true
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_CalculateUnitLevel takes integer unitConverter returns integer
return R2I(udg_R5UC_SourceLevelWeight[unitConverter] * I2R(udg_R5UC_SumOfLevels[unitConverter]) + udg_R5UC_SourceNumberWeight[unitConverter] * I2R(udg_R5UC_SumOfUnits[unitConverter]) + 0.5)
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_Func001 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_Get_Random_Unit takes integer unitConverter, integer level returns integer
local integer randomUnit = -1
local integer offset = (udg_R5UC_UnitSelectionKind[unitConverter]-1) * 10
if offset < 0 then
set randomUnit = ChooseRandomCreepBJ(level)
else
set randomUnit = udg_R5UC_UnitPool[GetRandomInt(udg_R5UC_UnitPoolLevels[offset+level-1], udg_R5UC_UnitPoolLevels[offset+level]-1)]
endif
return randomUnit
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_Show_Preview takes integer unitConverter returns nothing
local integer unitLevelLeft
local integer unitLevel
local unit createdUnit
local real createdUnitX
local real createdUnitY
local force playerForce = GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit()))
// Remove all the units from the previous preview
call ForGroup( udg_R5UC_ConvertedUnitGroupPreview[unitConverter], function Trig_R5UC_Add_Remove_Unit_To_Converter_Func001 )
// Create the new unit(s) basing on the sum of the levels of the "offered" units
set unitLevel = Trig_R5UC_Add_Remove_Unit_To_Converter_CalculateUnitLevel(unitConverter)
loop
exitwhen unitLevel == 0
if (unitLevel > udg_R5UC_MaxLevelOfConvertedUnit[unitConverter]) then
set unitLevelLeft = udg_R5UC_MaxLevelOfConvertedUnit[unitConverter]
else
set unitLevelLeft = unitLevel
endif
set createdUnitX = GetLocationX(udg_R5UC_DestLocations[unitConverter]) + GetRandomReal(-udg_R5UC_MaxRandomDistance[unitConverter], udg_R5UC_MaxRandomDistance[unitConverter])
set createdUnitY = GetLocationY(udg_R5UC_DestLocations[unitConverter]) + GetRandomReal(-udg_R5UC_MaxRandomDistance[unitConverter], udg_R5UC_MaxRandomDistance[unitConverter])
set createdUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), Trig_R5UC_Add_Remove_Unit_To_Converter_Get_Random_Unit(unitConverter, unitLevelLeft), createdUnitX, createdUnitY, bj_UNIT_FACING)
call SetUnitInvulnerable( createdUnit, true )
call GroupAddUnitSimple( createdUnit, udg_R5UC_ConvertedUnitGroupPreview[unitConverter] )
call SetUnitColor( createdUnit, GetPlayerColor(GetOwningPlayer(GetTriggerUnit())) )
call SetUnitVertexColorBJ( createdUnit, 100, 100, 100, 50.00 )
set unitLevel = unitLevel - unitLevelLeft
endloop
call DisplayTextToForce( playerForce, "UC #" + I2S(unitConverter) + ", Units(" + I2S(udg_R5UC_SumOfUnits[unitConverter]) + "), Levels(" + I2S(udg_R5UC_SumOfLevels[unitConverter]) + "), Converted Levels(" + I2S(Trig_R5UC_Add_Remove_Unit_To_Converter_CalculateUnitLevel(unitConverter)) + ")" )
call DestroyForce(playerForce)
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_AddUnitToGroup takes integer unitConverter, unit u returns boolean
local boolean result = true
if udg_R5UC_SumOfLevelsMax[unitConverter]>0 then
set result = udg_R5UC_SumOfLevels[unitConverter] + GetUnitLevel(u) <= udg_R5UC_SumOfLevelsMax[unitConverter]
endif
if udg_R5UC_SumOfUnitsMax[unitConverter]>0 then
set result = result and udg_R5UC_SumOfUnits[unitConverter] < udg_R5UC_SumOfUnitsMax[unitConverter]
endif
if result then
set udg_R5UC_SumOfLevels[unitConverter] = ( udg_R5UC_SumOfLevels[unitConverter] + GetUnitLevel(u) )
set udg_R5UC_SumOfUnits[unitConverter] = ( udg_R5UC_SumOfUnits[unitConverter] + 1 )
call SetUnitInvulnerable( u, true )
call GroupAddUnitSimple( u, udg_R5UC_UnitsToConvert[unitConverter] )
call SetUnitVertexColorBJ( u, 100, 100, 100, 50.00 )
else
call GroupAddUnitSimple( u, udg_R5UC_UnitsToNotConvert[unitConverter] )
endif
return result
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_AddNotAddedUnitsToGroup takes integer unitConverter returns nothing
local group g = udg_R5UC_UnitsToNotConvert[unitConverter]
local group tg = CreateGroup()
local unit u
loop
set u = FirstOfGroup(g)
exitwhen u == null
if not Trig_R5UC_Add_Remove_Unit_To_Converter_AddUnitToGroup(unitConverter, u) then
call GroupAddUnitSimple(u, tg)
endif
call GroupRemoveUnit(g, u)
endloop
call DestroyGroup(g)
set udg_R5UC_UnitsToNotConvert[unitConverter] = tg
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_RemoveUnitFromGroup takes integer unitConverter, unit u, boolean lastUnitConverter, boolean disabledUnitConverter returns boolean
if IsUnitInGroup(u, udg_R5UC_UnitsToConvert[unitConverter]) then
set udg_R5UC_SumOfLevels[unitConverter] = ( udg_R5UC_SumOfLevels[unitConverter] - GetUnitLevel(u) )
set udg_R5UC_SumOfUnits[unitConverter] = ( udg_R5UC_SumOfUnits[unitConverter] - 1 )
call GroupRemoveUnitSimple( u, udg_R5UC_UnitsToConvert[unitConverter] )
if lastUnitConverter then
call SetUnitVertexColorBJ( u, 100, 100, 100, 0 )
call SetUnitInvulnerable( u, false )
endif
if not disabledUnitConverter and (udg_R5UC_SumOfLevelsMax[unitConverter]>0 or udg_R5UC_SumOfUnitsMax[unitConverter]>0) then
call Trig_R5UC_Add_Remove_Unit_To_Converter_AddNotAddedUnitsToGroup(unitConverter)
endif
return true
else
call GroupRemoveUnitSimple( u, udg_R5UC_UnitsToNotConvert[unitConverter] )
endif
return false
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_Update takes nothing returns nothing
local integer i = 0
local integer j
local unit u
local group g
loop
exitwhen i >= udg_R5UC_NumberOfConverters
if (udg_R5UC_ActivationState[i] != udg_R5UC_Enabled[i]) then
set g = GetUnitsInRectAll(udg_R5UC_SourceRegions[i])
loop
set u = FirstOfGroup(g)
exitwhen u == null
if udg_R5UC_Enabled[i] then
call Trig_R5UC_Add_Remove_Unit_To_Converter_AddUnitToGroup(i, u)
else
set j = i
loop
set j = udg_R5UC_LinkedRegions[j]
exitwhen udg_R5UC_Enabled[j]
exitwhen i == j
endloop
call Trig_R5UC_Add_Remove_Unit_To_Converter_RemoveUnitFromGroup(i, u, not udg_R5UC_Enabled[j], true)
endif
call GroupRemoveUnit(g, u)
endloop
call DestroyGroup(g)
if not udg_R5UC_Enabled[i] then
call GroupClear(udg_R5UC_UnitsToNotConvert[i])
endif
call ClearTextMessages()
call Trig_R5UC_Add_Remove_Unit_To_Converter_Show_Preview(i)
set udg_R5UC_ActivationState[i] = udg_R5UC_Enabled[i]
endif
set i = i + 1
endloop
endfunction
function Trig_R5UC_Add_Remove_Unit_To_Converter_Actions takes nothing returns nothing
local integer unitConverter
local integer startingUnitConverter
local trigger unitDeathTrigger
local boolean unitAddedOrRemoved
local unit u
if ( GetTriggerEventId() == EVENT_UNIT_DEATH ) then
call DisplayTextToForce( GetPlayersAll(), "x" )
endif
set startingUnitConverter = Trig_R5UC_Add_Remove_Unit_To_Converter_GetConverter()
if startingUnitConverter != -1 then
set unitConverter = startingUnitConverter
set u = GetTriggerUnit()
loop
if (udg_R5UC_ActivationState[unitConverter]) then
set unitAddedOrRemoved = false
if ( GetTriggerEventId() == EVENT_GAME_ENTER_REGION ) then
set unitAddedOrRemoved = Trig_R5UC_Add_Remove_Unit_To_Converter_AddUnitToGroup(unitConverter, u)
// set unitDeathTrigger = CreateTrigger()
// call DisplayTextToForce( GetPlayersAll(), "Trigger creation" )
// call TriggerRegisterUnitEvent(unitDeathTrigger, u, EVENT_UNIT_DEATH)
// call TriggerAddAction(unitDeathTrigger, function Trig_R5UC_Add_Remove_Unit_To_Converter_Actions )
else
set unitAddedOrRemoved = Trig_R5UC_Add_Remove_Unit_To_Converter_RemoveUnitFromGroup(unitConverter, u, true, false)
endif
if unitAddedOrRemoved then
if unitConverter == startingUnitConverter then
call ClearTextMessages()
endif
call Trig_R5UC_Add_Remove_Unit_To_Converter_Show_Preview(unitConverter)
endif
endif
set unitConverter = udg_R5UC_LinkedRegions[unitConverter]
exitwhen unitConverter == startingUnitConverter
endloop
endif
// if ( GetTriggerEventId() == EVENT_UNIT_DEATH ) then
// call DisplayTextToForce( GetPlayersAll(), "Trigger destruction" )
// call DestroyTrigger(GetTriggeringTrigger())
// endif
endfunction
function Trig_R5UC_Add_RemoveUnit_To_Converter_Init_Unit_Pool takes nothing returns nothing
set udg_R5UC_UnitPoolLevels[0] = 0
set udg_R5UC_UnitPoolLevels[1] = 31
set udg_R5UC_UnitPoolLevels[2] = 68
set udg_R5UC_UnitPoolLevels[3] = 110
set udg_R5UC_UnitPoolLevels[4] = 140
set udg_R5UC_UnitPoolLevels[5] = 163
set udg_R5UC_UnitPoolLevels[6] = 186
set udg_R5UC_UnitPoolLevels[7] = 196
set udg_R5UC_UnitPoolLevels[8] = 205
set udg_R5UC_UnitPoolLevels[9] = 212
set udg_R5UC_UnitPoolLevels[10] = 218
set udg_R5UC_UnitPool[0] = 'ewsp' // Wisp (1)
set udg_R5UC_UnitPool[1] = 'hgyr' // Flying Machine (1)
set udg_R5UC_UnitPool[2] = 'hmil' // Militia (1)
set udg_R5UC_UnitPool[3] = 'hpea' // Peasant (1)
set udg_R5UC_UnitPool[4] = 'nban' // bandit (1)
set udg_R5UC_UnitPool[5] = 'nenc' // corrupted treant (1)
set udg_R5UC_UnitPool[6] = 'ngna' // Gnoll Poacher (1)
set udg_R5UC_UnitPool[7] = 'ngno' // Gnoll Robber (1)
set udg_R5UC_UnitPool[8] = 'nhar' // Harpy Scout (1)
set udg_R5UC_UnitPool[9] = 'nhfp' // fallen priest (1)
set udg_R5UC_UnitPool[10] = 'nkob' // Kobold (1)
set udg_R5UC_UnitPool[11] = 'nmrl' // murloc tiderunner (1)
set udg_R5UC_UnitPool[12] = 'nrzs' // razormane scout (1)
set udg_R5UC_UnitPool[13] = 'nrzt' // quillboar (1)
set udg_R5UC_UnitPool[14] = 'nsat' // Satyr Trickster (1)
set udg_R5UC_UnitPool[15] = 'nsca' // skeletal archer(summoned) (1)
set udg_R5UC_UnitPool[16] = 'nsce' // SkeletonWarrior(summoned) (1)
set udg_R5UC_UnitPool[17] = 'nska' // skeletal archer (1)
set udg_R5UC_UnitPool[18] = 'nske' // SkeletonWarrior (1)
set udg_R5UC_UnitPool[19] = 'nslm' // sludge minion (1)
set udg_R5UC_UnitPool[20] = 'nspb' // black spider (1)
set udg_R5UC_UnitPool[21] = 'nspd' // spiderling (1)
set udg_R5UC_UnitPool[22] = 'nspg' // green spider (1)
set udg_R5UC_UnitPool[23] = 'nspr' // spider (1)
set udg_R5UC_UnitPool[24] = 'nsty' // Satyr (1)
set udg_R5UC_UnitPool[25] = 'nwiz' // apprentice wizard (1)
set udg_R5UC_UnitPool[26] = 'nzep' // GoblinZeppelin (1)
set udg_R5UC_UnitPool[27] = 'opeo' // Peon (1)
set udg_R5UC_UnitPool[28] = 'uaco' // Acolyte (1)
set udg_R5UC_UnitPool[29] = 'ushd' // Shade (1)
set udg_R5UC_UnitPool[30] = 'uske' // SkeletonWarrior (1)
set udg_R5UC_UnitPool[31] = 'earc' // Archer (2)
set udg_R5UC_UnitPool[32] = 'ebal' // Glaive Thrower (2)
set udg_R5UC_UnitPool[33] = 'edot' // DruidoftheTalon (2)
set udg_R5UC_UnitPool[34] = 'edry' // Dryad (2)
set udg_R5UC_UnitPool[35] = 'edtm' // DruidoftheTalonMorph (2)
set udg_R5UC_UnitPool[36] = 'efon' // Treant (2)
set udg_R5UC_UnitPool[37] = 'ehip' // Hippogryph (2)
set udg_R5UC_UnitPool[38] = 'hfoo' // Footman (2)
set udg_R5UC_UnitPool[39] = 'hmpr' // Priest (2)
set udg_R5UC_UnitPool[40] = 'hmtm' // MortarTeam (2)
set udg_R5UC_UnitPool[41] = 'hmtt' // Siege Engine (2)
set udg_R5UC_UnitPool[42] = 'hsor' // Sorceress (2)
set udg_R5UC_UnitPool[43] = 'nbrg' // brigand (2)
set udg_R5UC_UnitPool[44] = 'ncea' // CentaurArcher (2)
set udg_R5UC_UnitPool[45] = 'ncer' // centaur drudge (2)
set udg_R5UC_UnitPool[46] = 'ndtp' // dark troll shadow priest (2)
set udg_R5UC_UnitPool[47] = 'ndtr' // darkTroll (2)
set udg_R5UC_UnitPool[48] = 'nfsp' // forest troll shadow priest (2)
set udg_R5UC_UnitPool[49] = 'nftr' // ForestTroll (2)
set udg_R5UC_UnitPool[50] = 'ngrk' // mud golem (2)
set udg_R5UC_UnitPool[51] = 'nitp' // ice troll priest (2)
set udg_R5UC_UnitPool[52] = 'nitr' // IceTroll (2)
set udg_R5UC_UnitPool[53] = 'nltl' // lightning lizard (2)
set udg_R5UC_UnitPool[54] = 'nmpg' // murloc plaguebearer (2)
set udg_R5UC_UnitPool[55] = 'nmrr' // murloc huntsman (2)
set udg_R5UC_UnitPool[56] = 'nspp' // spirit pig (2)
set udg_R5UC_UnitPool[57] = 'nwlt' // timber wolf (2)
set udg_R5UC_UnitPool[58] = 'nwwf' // white wolf (2)
set udg_R5UC_UnitPool[59] = 'ocat' // Demolisher (2)
set udg_R5UC_UnitPool[60] = 'odoc' // WitchDoctor (2)
set udg_R5UC_UnitPool[61] = 'ohun' // HeadHunter (2)
set udg_R5UC_UnitPool[62] = 'oshm' // Shaman (2)
set udg_R5UC_UnitPool[63] = 'uban' // Banshee (2)
set udg_R5UC_UnitPool[64] = 'ugar' // Gargoyle (2)
set udg_R5UC_UnitPool[65] = 'ugho' // Ghoul (2)
set udg_R5UC_UnitPool[66] = 'umtw' // MeatWagon (2)
set udg_R5UC_UnitPool[67] = 'unec' // Necromancer (2)
set udg_R5UC_UnitPool[68] = 'esen' // Huntress (3)
set udg_R5UC_UnitPool[69] = 'hrif' // Rifleman (3)
set udg_R5UC_UnitPool[70] = 'nadw' // blue dragon whelp (3)
set udg_R5UC_UnitPool[71] = 'narg' // battle golem (3)
set udg_R5UC_UnitPool[72] = 'nbdr' // black dragon whelp (3)
set udg_R5UC_UnitPool[73] = 'nbzw' // bronze dragon whelp (3)
set udg_R5UC_UnitPool[74] = 'ndtt' // darkTrollTrapper (3)
set udg_R5UC_UnitPool[75] = 'nenp' // poison treant (3)
set udg_R5UC_UnitPool[76] = 'nftt' // ForestTrollTrapper (3)
set udg_R5UC_UnitPool[77] = 'ngh1' // ghost (3)
set udg_R5UC_UnitPool[78] = 'ngnb' // gnoll brute (3)
set udg_R5UC_UnitPool[79] = 'ngns' // Gnoll Assassin (3)
set udg_R5UC_UnitPool[80] = 'ngnw' // gnoll warden (3)
set udg_R5UC_UnitPool[81] = 'ngrw' // Green Dragon Whelp (3)
set udg_R5UC_UnitPool[82] = 'nhdc' // deceiver (3)
set udg_R5UC_UnitPool[83] = 'nhrr' // harpy rogue (3)
set udg_R5UC_UnitPool[84] = 'nhrw' // harpy witch (3)
set udg_R5UC_UnitPool[85] = 'nitt' // ice troll trapper (3)
set udg_R5UC_UnitPool[86] = 'nkog' // Kobold Geomancer (3)
set udg_R5UC_UnitPool[87] = 'nkot' // kobold tunneler (3)
set udg_R5UC_UnitPool[88] = 'nmfs' // murloc flesheater (3)
set udg_R5UC_UnitPool[89] = 'nmrm' // murloc nightcrawler (3)
set udg_R5UC_UnitPool[90] = 'nnwa' // nerubian warrior (3)
set udg_R5UC_UnitPool[91] = 'nnwl' // nerubian webspinner (3)
set udg_R5UC_UnitPool[92] = 'nogr' // Ogre Warrior (3)
set udg_R5UC_UnitPool[93] = 'nqbh' // quillboar hunter (3)
set udg_R5UC_UnitPool[94] = 'nrdk' // Red Dragon Whelp (3)
set udg_R5UC_UnitPool[95] = 'nrog' // rogue (3)
set udg_R5UC_UnitPool[96] = 'nrvf' // fire revenant (3)
set udg_R5UC_UnitPool[97] = 'nrzb' // razormane brute (3)
set udg_R5UC_UnitPool[98] = 'nskf' // burning archer (3)
set udg_R5UC_UnitPool[99] = 'nskg' // giant SkeletonWarrior (3)
set udg_R5UC_UnitPool[100] = 'nskm' // skeletal marksman (3)
set udg_R5UC_UnitPool[101] = 'nslf' // sludge flinger (3)
set udg_R5UC_UnitPool[102] = 'nslh' // salamander hatchling (3)
set udg_R5UC_UnitPool[103] = 'nssp' // spitting spider (3)
set udg_R5UC_UnitPool[104] = 'nsts' // satyr shadowdancer (3)
set udg_R5UC_UnitPool[105] = 'nwzr' // rogue wizard (3)
set udg_R5UC_UnitPool[106] = 'ogru' // Grunt (3)
set udg_R5UC_UnitPool[107] = 'orai' // Raider (3)
set udg_R5UC_UnitPool[108] = 'osw1' // spirit wolf level 1 (3)
set udg_R5UC_UnitPool[109] = 'ucry' // CryptFiend (3)
set udg_R5UC_UnitPool[110] = 'edcm' // DruidoftheClawMorph (4)
set udg_R5UC_UnitPool[111] = 'edoc' // DruidoftheClaw (4)
set udg_R5UC_UnitPool[112] = 'ehpr' // Hippogryph Rider (4)
set udg_R5UC_UnitPool[113] = 'hkni' // Knight (4)
set udg_R5UC_UnitPool[114] = 'hwat' // WaterElemental (4)
set udg_R5UC_UnitPool[115] = 'nass' // assassin (4)
set udg_R5UC_UnitPool[116] = 'ncen' // Centaur outrunner (4)
set udg_R5UC_UnitPool[117] = 'ncim' // Centaur impaler (4)
set udg_R5UC_UnitPool[118] = 'ndtb' // dark troll berserker (4)
set udg_R5UC_UnitPool[119] = 'ndth' // dark troll high priest (4)
set udg_R5UC_UnitPool[120] = 'nele' // enraged elemental (4)
set udg_R5UC_UnitPool[121] = 'nfrl' // Furbolg (4)
set udg_R5UC_UnitPool[122] = 'nfrp' // Furbolg Panda (4)
set udg_R5UC_UnitPool[123] = 'nfrs' // Furbolg Shaman (4)
set udg_R5UC_UnitPool[124] = 'nfsh' // forest troll high priest (4)
set udg_R5UC_UnitPool[125] = 'nftb' // forest troll berserker (4)
set udg_R5UC_UnitPool[126] = 'ngir' // goblin shredder (4)
set udg_R5UC_UnitPool[127] = 'ngsp' // GoblinSapper (4)
set udg_R5UC_UnitPool[128] = 'nith' // ice troll high priest (4)
set udg_R5UC_UnitPool[129] = 'nits' // ice troll berserker (4)
set udg_R5UC_UnitPool[130] = 'nowb' // wildkin (4)
set udg_R5UC_UnitPool[131] = 'nrvs' // frost revenant (4)
set udg_R5UC_UnitPool[132] = 'nsgt' // giant spider (4)
set udg_R5UC_UnitPool[133] = 'nwen' // Wendigo (4)
set udg_R5UC_UnitPool[134] = 'nwlg' // giant wolf (4)
set udg_R5UC_UnitPool[135] = 'nwwg' // giant white wolf (4)
set udg_R5UC_UnitPool[136] = 'okod' // KodoBeast (4)
set udg_R5UC_UnitPool[137] = 'osw2' // spirit wolf level 2 (4)
set udg_R5UC_UnitPool[138] = 'owyv' // Wind Rider (4)
set udg_R5UC_UnitPool[139] = 'uabo' // Abomination (4)
set udg_R5UC_UnitPool[140] = 'echm' // Chimaera (5)
set udg_R5UC_UnitPool[141] = 'hgry' // GryphonRider (5)
set udg_R5UC_UnitPool[142] = 'hwt2' // WaterElemental level 2 (5)
set udg_R5UC_UnitPool[143] = 'ncks' // centaur sorceror (5)
set udg_R5UC_UnitPool[144] = 'nenf' // enforcer (5)
set udg_R5UC_UnitPool[145] = 'nepl' // plague treant (5)
set udg_R5UC_UnitPool[146] = 'nfel' // fel stalker (5)
set udg_R5UC_UnitPool[147] = 'ngnv' // Gnoll Overseer (5)
set udg_R5UC_UnitPool[148] = 'nhhr' // heretic (5)
set udg_R5UC_UnitPool[149] = 'nhrh' // harpy hag (5)
set udg_R5UC_UnitPool[150] = 'nkol' // kobold taskmaster (5)
set udg_R5UC_UnitPool[151] = 'nnwr' // nerubian seer (5)
set udg_R5UC_UnitPool[152] = 'nnws' // nerubian spider lord (5)
set udg_R5UC_UnitPool[153] = 'nogm' // ogre mauler (5)
set udg_R5UC_UnitPool[154] = 'nomg' // ogre magi (5)
set udg_R5UC_UnitPool[155] = 'nrzm' // razormane medicine man (5)
set udg_R5UC_UnitPool[156] = 'nsln' // sludge monstrosity (5)
set udg_R5UC_UnitPool[157] = 'nslr' // salamander (5)
set udg_R5UC_UnitPool[158] = 'nsqt' // sasquatch (5)
set udg_R5UC_UnitPool[159] = 'nstl' // satyr soulstealer (5)
set udg_R5UC_UnitPool[160] = 'nwzg' // renegade wizard (5)
set udg_R5UC_UnitPool[161] = 'osw3' // spirit wolf level 3 (5)
set udg_R5UC_UnitPool[162] = 'otau' // Tauren (5)
set udg_R5UC_UnitPool[163] = 'hwt3' // WaterElemental level 3 (6)
set udg_R5UC_UnitPool[164] = 'nadk' // blue drake (6)
set udg_R5UC_UnitPool[165] = 'nbdk' // black drake (6)
set udg_R5UC_UnitPool[166] = 'nbzk' // bronze drake (6)
set udg_R5UC_UnitPool[167] = 'ndtw' // darkTrollwarlord (6)
set udg_R5UC_UnitPool[168] = 'nfrb' // Furbolg Tracker (6)
set udg_R5UC_UnitPool[169] = 'nftk' // Forest Troll Warlord (6)
set udg_R5UC_UnitPool[170] = 'ngdk' // Green Drake (6)
set udg_R5UC_UnitPool[171] = 'ngh2' // wraith (6)
set udg_R5UC_UnitPool[172] = 'ngst' // rock golem (6)
set udg_R5UC_UnitPool[173] = 'nitw' // ice troll warlord (6)
set udg_R5UC_UnitPool[174] = 'nmmu' // murloc mutant (6)
set udg_R5UC_UnitPool[175] = 'nowe' // enraged wildkin (6)
set udg_R5UC_UnitPool[176] = 'nrdr' // Red Drake (6)
set udg_R5UC_UnitPool[177] = 'nrvl' // lightning revenant (6)
set udg_R5UC_UnitPool[178] = 'nsbm' // brood mother (6)
set udg_R5UC_UnitPool[179] = 'nsqe' // elder sasquatch (6)
set udg_R5UC_UnitPool[180] = 'nthl' // thunder lizard (6)
set udg_R5UC_UnitPool[181] = 'nwld' // dire wolf (6)
set udg_R5UC_UnitPool[182] = 'nwnr' // elder wendigo (6)
set udg_R5UC_UnitPool[183] = 'nwrg' // war golem (6)
set udg_R5UC_UnitPool[184] = 'nwwd' // white dire wolf (6)
set udg_R5UC_UnitPool[185] = 'ufro' // FrostWyrm (6)
set udg_R5UC_UnitPool[186] = 'nbld' // bandit lord (7)
set udg_R5UC_UnitPool[187] = 'nfre' // Furbolg Elder Shaman (7)
set udg_R5UC_UnitPool[188] = 'nfrg' // Furbolg Champion (7)
set udg_R5UC_UnitPool[189] = 'nhrq' // harpy queen (7)
set udg_R5UC_UnitPool[190] = 'nnwq' // nerubian queen (7)
set udg_R5UC_UnitPool[191] = 'nogl' // ogre lord (7)
set udg_R5UC_UnitPool[192] = 'nrzg' // razormane chieftain (7)
set udg_R5UC_UnitPool[193] = 'nslv' // salamander vizier (7)
set udg_R5UC_UnitPool[194] = 'nsqo' // sasquatch oracle (7)
set udg_R5UC_UnitPool[195] = 'nwns' // Wendigo shaman (7)
set udg_R5UC_UnitPool[196] = 'nba2' // doom guard (summoned) (8)
set udg_R5UC_UnitPool[197] = 'nbal' // doom guard (8)
set udg_R5UC_UnitPool[198] = 'ncnk' // centaur khan (8)
set udg_R5UC_UnitPool[199] = 'nelb' // berserk elemental (8)
set udg_R5UC_UnitPool[200] = 'nfra' // Furbolg Ursa Warrior (8)
set udg_R5UC_UnitPool[201] = 'ninf' // Infernal (8)
set udg_R5UC_UnitPool[202] = 'nowk' // berserk Wildkin (8)
set udg_R5UC_UnitPool[203] = 'nrvi' // ice revenant (8)
set udg_R5UC_UnitPool[204] = 'nwzd' // dark wizard (8)
set udg_R5UC_UnitPool[205] = 'nggr' // granite golem (9)
set udg_R5UC_UnitPool[206] = 'nrvd' // death revenant (9)
set udg_R5UC_UnitPool[207] = 'nsgg' // siege golem (9)
set udg_R5UC_UnitPool[208] = 'nsqa' // ancient sasquatch (9)
set udg_R5UC_UnitPool[209] = 'nsth' // satyr hellcaller (9)
set udg_R5UC_UnitPool[210] = 'nstw' // storm wyrm (9)
set udg_R5UC_UnitPool[211] = 'nwna' // ancient wendigo (9)
set udg_R5UC_UnitPool[212] = 'nadr' // blue dragon (10)
set udg_R5UC_UnitPool[213] = 'nbwm' // black dragon (10)
set udg_R5UC_UnitPool[214] = 'nbzd' // bronze dragon (10)
set udg_R5UC_UnitPool[215] = 'ngrd' // green dragon (10)
set udg_R5UC_UnitPool[216] = 'nrwm' // Red Dragon (10)
set udg_R5UC_UnitPool[217] = 'nsll' // salamander lord (10)
endfunction
function Trig_R5UC_Convert_Units_GetConverter takes nothing returns integer
local integer i
set i = 0
loop
exitwhen i >= udg_R5UC_NumberOfConverters
if (IsPointInRegion(GetTriggeringRegion(), GetRectCenterX(udg_R5UC_TriggeringRegions[i]), GetRectCenterY(udg_R5UC_TriggeringRegions[i]))) then
return i
endif
set i = i + 1
endloop
return -1
endfunction
function Trig_R5UC_Convert_Units_Conditions takes nothing returns boolean
local integer unitConverter = Trig_R5UC_Convert_Units_GetConverter()
if unitConverter == -1 then
return false
endif
if (not udg_R5UC_ActivationState[unitConverter]) then
return false
endif
if ( not IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) ) then
return false
endif
if (udg_R5UC_OwningForce[unitConverter] != null) then
return (IsUnitInForce(GetTriggerUnit(), udg_R5UC_OwningForce[unitConverter]))
endif
return true
endfunction
function Trig_R5UC_Convert_Units_Func001 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction
function Trig_R5UC_Convert_Units_Func002 takes nothing returns nothing
call SetUnitOwner( GetEnumUnit(), GetOwningPlayer(GetTriggerUnit()), true )
call SetUnitVertexColorBJ( GetEnumUnit(), 100, 100, 100, 0.00 )
call SetUnitInvulnerable( GetEnumUnit(), false )
endfunction
function Trig_R5UC_Convert_Units_Actions takes nothing returns nothing
local integer unitConverter
local integer startingUnitConverter
local integer firstUnitConverter
local integer sumOfLevels
local integer sumOfUnits
set startingUnitConverter = Trig_R5UC_Convert_Units_GetConverter()
set unitConverter = startingUnitConverter
// Remove all the units to convert
call ForGroup( udg_R5UC_UnitsToConvert[unitConverter], function Trig_R5UC_Convert_Units_Func001 )
// Change the owner of the preview units
call ForGroup( udg_R5UC_ConvertedUnitGroupPreview[unitConverter], function Trig_R5UC_Convert_Units_Func002 )
// Clear the first preview group(s)
call GroupClear ( udg_R5UC_ConvertedUnitGroupPreview[unitConverter] )
// Resets the variables (but saves their values before)
set sumOfLevels = udg_R5UC_SumOfLevels[unitConverter]
set sumOfUnits = udg_R5UC_SumOfUnits[unitConverter]
set udg_R5UC_SumOfLevels[unitConverter] = 0
set udg_R5UC_SumOfUnits[unitConverter] = 0
call ClearTextMessages()
// If there are units left in the group of the units not the convert (i.e.
// candidate to be converted but exceeding the number of unit or level
// thresold), then process this Unit Converter and all the linked ones so
// that the previews are properly updated
if FirstOfGroup(udg_R5UC_UnitsToNotConvert[unitConverter]) != null then
// Add the units in the group of units to not convert to the Unit
// Converter
call Trig_R5UC_Add_Remove_Unit_To_Converter_AddNotAddedUnitsToGroup(unitConverter)
set firstUnitConverter = startingUnitConverter
loop
// cicle other linked Unit Converters (if any)
set unitConverter = udg_R5UC_LinkedRegions[unitConverter]
exitwhen unitConverter == startingUnitConverter
// let's determine the first (i.e. the one with the lowest index) Unit
// Converter of the chain
if firstUnitConverter > unitConverter then
set firstUnitConverter = unitConverter
endif
if udg_R5UC_ActivationState[unitConverter] then
// Adjust the variables
set udg_R5UC_SumOfLevels[unitConverter] = udg_R5UC_SumOfLevels[unitConverter] - sumOfLevels
set udg_R5UC_SumOfUnits[unitConverter] = udg_R5UC_SumOfUnits[unitConverter] - sumOfUnits
// Add the units in the group of units to not convert to the Unit
// Converter
call Trig_R5UC_Add_Remove_Unit_To_Converter_AddNotAddedUnitsToGroup(unitConverter)
endif
endloop
// now update all the previews
set unitConverter = firstUnitConverter
loop
call Trig_R5UC_Add_Remove_Unit_To_Converter_Show_Preview(unitConverter)
set unitConverter = udg_R5UC_LinkedRegions[unitConverter]
exitwhen unitConverter == firstUnitConverter
endloop
else
loop
// cicle other linked Unit Converters (if any)
set unitConverter = udg_R5UC_LinkedRegions[unitConverter]
exitwhen unitConverter == startingUnitConverter
// clear the preview group and remove its units
call ForGroup( udg_R5UC_ConvertedUnitGroupPreview[unitConverter], function Trig_R5UC_Convert_Units_Func001 )
// Resets the variables
set udg_R5UC_SumOfLevels[unitConverter] = 0
set udg_R5UC_SumOfUnits[unitConverter] = 0
endloop
endif
endfunction
//===========================================================================
function InitTrig_R5UC_Add_Remove_Unit_To_Converter takes nothing returns nothing
local integer i
local integer j
call Trig_R5UC_Add_RemoveUnit_To_Converter_Init_Unit_Pool()
set udg_R5UC_NumberOfConverters = 4
// Initialization of defaults
set i = 0
loop
exitwhen i >= udg_R5UC_NumberOfConverters
// (mandatory) Source Region where to put the unit to convert
set udg_R5UC_SourceRegions[i] = null
// (mandatory) Destination Location where the preview and the converted units
// will be put
set udg_R5UC_DestLocations[i] = null
// (optional) Enabled: if true the Unit Converted is active otherwise is
// disabled (i.e. it does not convert any unit).
// The default value is true.
set udg_R5UC_Enabled[i] = true
// (optional) Maximum random distance from the destination location (if greater
// than 0, avoids multiple converted flying units to be placed in the
// exact same place). Default is 0
set udg_R5UC_MaxRandomDistance[i] = 0
// (optional) Unit Selection Kind (0-1): the group from which to select the
// converted units:
//
// 0 = random creep from the current tileset
// 1 = random unit from all the non-hero, non-campaign units
// >1 = random unit from a customized set
//
// default is 0
//
// By default no customized set is present, customized sets can be
// provided by extending udg_R5UC_UnitPoolLevels and
// udg_R5UC_UnitPool in this way:
//
// 1) add new unit types to udg_R5UC_UnitPool (unit types must be
// grouped by level, so that level 1 unit types are added first,
// followed by level 2 unit types, level 3 unit types, etc.);
//
// 2) append in udg_R5UC_UnitPoolLevels how the "boundaries" of the
// levels: for example, if the last element of the array is
// udg_R5UC_UnitPoolLevels[10] and the last level 1 unit is in
// udg_R5UC_UnitPool[230] (and, hence, the first level 2 unit is
// in udg_R5UC_UnitPool[231]), then this line must be added:
//
// set udg_R5UC_UnitPoolLevels[11] = 231
//
// then if the last level 2 unit is at position 242, the
// following line must be added:
//
// set udg_R5UC_UnitPoolLevels[12] = 243
//
// etcetera, until level 10.
//
// Be sure to not skip any level (i.e. have at least one unit type
// for level).
//
set udg_R5UC_UnitSelectionKind[i] = 0
// (optional) Maximum Level of Converted Unit (1-10): the maximum level of a converted
// unit, i.e. if 6 is specified no unit of level greater than 6 will
// be generated. Given a total level, lower values of this parameter
// will give more units of lower levels, while bigger will give less
// units of higher levels.
// Default is 10
set udg_R5UC_MaxLevelOfConvertedUnit[i] = 10
// (optional) Owning Force: tells to which force the Unit Converter belongs;
// only the heroes of the players of that force are allowed to
// activate it.
// Default is null (any hero can activate the Unit Converter)
set udg_R5UC_OwningForce[i] = null
// (optional) Convertible Force: tells the units of which player(s) are
// convertible by the Unit Converter.
// Default is null (any unit is converted)
set udg_R5UC_ConvertibleForce[i] = null
// (optional) The maximum for the sum of levels of the units to convert.
// If this value is greater than 0, it represents an upper limit to
// the sum of the levels of the units to convert. Adding more units
// after this limit is reached prevent them to be part of the units
// to convert (i.e. they won't be converted if the Unit Converter is
// activated).
// If this value is 0 no limit is applied.
// Default is 0.
set udg_R5UC_SumOfLevelsMax[i] = 0
// (optional) The maximum for the number of the units to convert.
// If this value is greater than 0, it represents an upper limit to
// the number of the units to convert. Adding more units after this
// limit is reached prevent them to be part of the units to convert
// (i.e. they won't be converted if the Unit Converter is activated).
// If this value is 0 no limit is applied.
// Default is 0.
set udg_R5UC_SumOfUnitsMax[i] = 0
// (optional) The weight to be used in the converted unit(s) level calculation,
// respectively for the sum of the levels to be converted and for the
// number of units to be converted.
//
// For example a value of 1.0 for udg_R5UC_SourceLevelWeight and 0.0
// for udg_R5UC_SourceNumberWeight means that the level of units to
// be converted and the level of converted units are 1:1, so that
// putting 5 footmen (level 2) into the Unit Converter produces a
// level 10 ( = 5 * 2) unit.
// Default is 1.0 for set udg_R5UC_SourceLevelWeight and -0.5 for
// udg_R5UC_SourceNumberWeight so that the level of the converted
// unit(s) is the sum of the levels of the units to be converted
// minus the half of the number of units to be converted (e.g. if
// 5 footmen (level 2) are put into the unit converter a unit of
// level 8 ( = 5 * 2 - 5 * 0.5 = 10 - 2.5 = 7.5 => 8) is obtained.
set udg_R5UC_SourceLevelWeight[i] = 1.0
set udg_R5UC_SourceNumberWeight[i] = -0.5
// All the other global variables are for internal use only: DON'T TOUCH THEM!!
set i = i + 1
endloop
// *****************************************
// Initialization of Unit Converters (BEGIN)
// *****************************************
// Modify the following to change the number and/or the behavior of the Unit
// Converter(s)
set udg_R5UC_SourceRegions[0] = gg_rct_Put_Units_Here
set udg_R5UC_TriggeringRegions[0] = gg_rct_Put_Hero_Here
set udg_R5UC_DestLocations[0] = GetUnitLoc(gg_unit_ncop_0185)
set udg_R5UC_MaxRandomDistance[0] = 50
set udg_R5UC_MaxLevelOfConvertedUnit[0] = 10
set udg_R5UC_OwningForce[0] = GetForceOfPlayer(Player(0))
set udg_R5UC_ConvertibleForce[0] = udg_R5UC_OwningForce[0]
set udg_R5UC_SumOfLevelsMax[0] = 16
set udg_R5UC_SourceRegions[1] = gg_rct_Larger_source_region
set udg_R5UC_TriggeringRegions[1] = gg_rct_Put_Hero_Here_2
set udg_R5UC_DestLocations[1] = GetUnitLoc(gg_unit_nfoh_0013)
set udg_R5UC_MaxRandomDistance[1] = 200
set udg_R5UC_UnitSelectionKind[1] = 1
set udg_R5UC_MaxLevelOfConvertedUnit[1] = 6
set udg_R5UC_ConvertibleForce[1] = GetForceOfPlayer(Player(2))
set udg_R5UC_SumOfUnitsMax[1] = 4
set udg_R5UC_SourceRegions[2] = gg_rct_Smaller_source_region
set udg_R5UC_TriggeringRegions[2] = gg_rct_Put_Hero_Here_3
set udg_R5UC_DestLocations[2] = GetUnitLoc(gg_unit_nzep_0015)
set udg_R5UC_MaxRandomDistance[2] = 30
set udg_R5UC_UnitSelectionKind[2] = 1
set udg_R5UC_MaxLevelOfConvertedUnit[2] = 10
set udg_R5UC_SourceRegions[3] = gg_rct_Put_Units_Here
set udg_R5UC_TriggeringRegions[3] = gg_rct_Put_Hero_Here_4
set udg_R5UC_DestLocations[3] = GetUnitLoc(gg_unit_ncop_0017)
set udg_R5UC_MaxRandomDistance[3] = 50
set udg_R5UC_UnitSelectionKind[3] = 1
set udg_R5UC_MaxLevelOfConvertedUnit[3] = 8
// ***************************************
// Initialization of Unit Converters (END)
// ***************************************
set gg_trg_R5UC_Add_Remove_Unit_To_Converter = CreateTrigger( )
set gg_trg_R5UC_Convert_Units = CreateTrigger( )
set i = 0
loop
exitwhen i >= udg_R5UC_NumberOfConverters
set j = i - 1
loop
exitwhen j < 0
exitwhen udg_R5UC_SourceRegions[i] == udg_R5UC_SourceRegions[j]
set j = j - 1
endloop
call TriggerRegisterEnterRectSimple( gg_trg_R5UC_Convert_Units, udg_R5UC_TriggeringRegions[i] )
if j<0 then
call TriggerRegisterEnterRectSimple( gg_trg_R5UC_Add_Remove_Unit_To_Converter, udg_R5UC_SourceRegions[i] )
call TriggerRegisterLeaveRectSimple( gg_trg_R5UC_Add_Remove_Unit_To_Converter, udg_R5UC_SourceRegions[i] )
set udg_R5UC_LinkedRegions[i] = i
else
set udg_R5UC_LinkedRegions[i] = udg_R5UC_LinkedRegions[j]
set udg_R5UC_LinkedRegions[j] = i
set udg_R5UC_ConvertibleForce[i] = udg_R5UC_ConvertibleForce[j]
endif
set udg_R5UC_ConvertedUnitGroupPreview[i] = CreateGroup()
set udg_R5UC_UnitsToConvert[i] = CreateGroup()
set udg_R5UC_UnitsToNotConvert[i] = CreateGroup()
set udg_R5UC_SumOfLevels[i] = 0
set udg_R5UC_SumOfUnits[i] = 0
if udg_R5UC_MaxRandomDistance[i]<0 then
set udg_R5UC_MaxRandomDistance[i] = 0
endif
if udg_R5UC_MaxLevelOfConvertedUnit[i]<1 then
set udg_R5UC_MaxLevelOfConvertedUnit[i] = 1
elseif udg_R5UC_MaxLevelOfConvertedUnit[i]>10 then
set udg_R5UC_MaxLevelOfConvertedUnit[i] = 10
endif
set udg_R5UC_ActivationState[i] = udg_R5UC_Enabled[i]
set i = i + 1
endloop
call TriggerAddCondition( gg_trg_R5UC_Add_Remove_Unit_To_Converter, Condition( function Trig_R5UC_Add_Remove_Unit_To_Converter_Conditions ) )
call TriggerAddAction( gg_trg_R5UC_Add_Remove_Unit_To_Converter, function Trig_R5UC_Add_Remove_Unit_To_Converter_Actions )
call TriggerAddCondition( gg_trg_R5UC_Convert_Units, Condition( function Trig_R5UC_Convert_Units_Conditions ) )
call TriggerAddAction( gg_trg_R5UC_Convert_Units, function Trig_R5UC_Convert_Units_Actions )
endfunction