//****************************************************
//****************************************************
//****************************************************
//Mapwide Global Utilites:
//****************************************************
//****************************************************
//****************************************************
function FillVial takes unit un returns nothing
local integer i
set i = 1
loop
exitwhen i > 6
if GetItemTypeId(UnitItemInSlotBJ(un, i)) == 'I000' then
call SetItemCharges( UnitItemInSlotBJ(un, i), 3 )
elseif GetItemTypeId(UnitItemInSlotBJ(un, i)) == 'I001' then
call RemoveItem(UnitItemInSlotBJ(un, i))
call UnitAddItemByIdSwapped( 'I000', un )
endif
set i = i + 1
endloop
endfunction
function BonusEnumUnitSelected takes integer o returns nothing
local integer i
local integer bonus
set bonus = udg_TEMP_Integer
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
set i = 9
loop
exitwhen i < 1
if bonus >= R2I(Pow(2, i-1)) then
call UnitAddAbilityBJ( udg_BonusAbility[o + i], GetEnumUnit() )
set bonus = bonus - R2I(Pow(2, i-1))
else
call UnitRemoveAbilityBJ( udg_BonusAbility[o + i], GetEnumUnit() )
endif
set i = i - 1
endloop
endif
endif
endfunction
function BonusArmorEnumUnitSelected takes nothing returns nothing
call BonusEnumUnitSelected(10)
endfunction
function BonusDamageEnumUnitSelected takes nothing returns nothing
call BonusEnumUnitSelected(20)
endfunction
function BonusLifeEnumUnitSelected takes nothing returns nothing
call BonusEnumUnitSelected(30)
endfunction
//custom data funcs (yeah, yeah, i'll use a gamecache someday)
function IsUnitTrain takes unit un returns boolean
if GetUnitUserData(un) == 1 then
return true
endif
return false
endfunction
function SetUnitTrain takes unit un, boolean t returns nothing
if not(IsUnitTrain(un) == t) then
if t then
call SetUnitUserData( un, 1 )
else
call SetUnitUserData( un, 0 )
endif
endif
endfunction
function GetPlayerHeroEnum takes nothing returns nothing
if IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) then
set udg_TEMP_Unit = GetEnumUnit()
endif
endfunction
function GetPlayerHero takes integer id returns unit
//why isn't this just a static variable reference? because it
//used to be, and sometimes the ref would get lost and a player
//couldn't revive. i'm not taking any more chances.
//update: turns out that's not the bug. well fuck.
local group grp
if udg_FreeHero then
return udg_HERO_Ref2[id]
endif
set udg_TEMP_Unit = null
if IsPlayerInForce(ConvertedPlayer(id), udg_Force[1]) then
set grp = GetUnitsOfPlayerAll(ConvertedPlayer(id))
call ForGroupBJ(grp, function GetPlayerHeroEnum )
call DestroyGroup(grp)
endif
set udg_HERO_Ref2[id] = udg_TEMP_Unit
return udg_TEMP_Unit
endfunction
//keepalive
function KeepAliveUnit takes unit un returns nothing
local integer i
if IsUnitInGroup(un, udg_KA_Group) then
set i = 1
loop
exitwhen i > 1000
if udg_KA_Unit[i] == un then
call DestroyTextTagBJ( udg_KA_Text[i] )
call GroupRemoveUnitSimple( un, udg_KA_Group )
set udg_KA_Unit[i] = null
set udg_KA_Text[i] = null
set i = 1000
endif
set i = i + 1
endloop
else
call GroupAddUnitSimple( un, udg_KA_Group )
call CreateTextTagUnitBJ( "KA", un, 0, 10, 100, 100, 100, 0 )
call ShowTextTagForceBJ( false, GetLastCreatedTextTag(), udg_Force[1] )
call ShowTextTagForceBJ( true, GetLastCreatedTextTag(), udg_Force[2] )
set i = 1
loop
exitwhen i > 1000
if udg_KA_Unit[i] == null then
set udg_KA_Unit[i] = un
set udg_KA_Text[i] = GetLastCreatedTextTag()
set i = 1000
endif
set i = i + 1
endloop
endif
endfunction
function RemoveKeepAliveUnit takes unit un returns nothing
if IsUnitInGroup(un, udg_KA_Group) then
call KeepAliveUnit(un)
endif
endfunction
//gamename translator
function AddTranslate takes string strfrom, string strto returns nothing
set udg_TranslateTotal = udg_TranslateTotal + 1
set udg_TranslateFrom[udg_TranslateTotal] = strfrom
set udg_TranslateTo[udg_TranslateTotal] = strto
endfunction
function InitTranslator takes nothing returns nothing
set udg_TranslateTotal = 0
call AddTranslate("custom_h00B", "trainingroom")
call AddTranslate("custom_h00B", "trainroom")
call AddTranslate("custom_n001", "fountain")
call AddTranslate("custom_n001", "fountainofhealth") //prevent creation of regular fountains
call AddTranslate("custom_n001", "fountainofmana")
call AddTranslate("custom_n001", "fountainoflife")
call AddTranslate("custom_n001", "fountainofrejuvenation")
call AddTranslate("custom_h004", "barn")
call AddTranslate("custom_h003", "haycart")
call AddTranslate("custom_h002", "windmill")
call AddTranslate("custom_n00B", "questshop1")
call AddTranslate("custom_n00C", "questshop2")
call AddTranslate("custom_n002", "itemshop")
call AddTranslate("custom_n00J", "blacksmith1")
call AddTranslate("custom_n00D", "blacksmith2")
call AddTranslate("custom_n00L", "blacksmith3")
call AddTranslate("custom_n00E", "haven1")
call AddTranslate("custom_n003", "haven2")
call AddTranslate("custom_n00K", "haven3")
call AddTranslate("custom_n00N", "tower1")
call AddTranslate("custom_n007", "tower2")
call AddTranslate("custom_n00M", "tower3")
call AddTranslate("custom_H007", "elvenarcher")
call AddTranslate("custom_H000", "elvencleric")
call AddTranslate("custom_H001", "humanswordsman")
call AddTranslate("custom_H005", "humanmage")
call AddTranslate("custom_H008", "dwarvenwarrior")
call AddTranslate("custom_H009", "dwarvenrifleman")
call AddTranslate("custom_E005", "ancientofthunder")
call AddTranslate("custom_E004", "ancientofstone")
call AddTranslate("custom_E006", "nightelfdruid")
call AddTranslate("custom_H00A", "nightelfgiant")
call AddTranslate("custom_E003", "nightelfarcher")
call AddTranslate("custom_E001", "nightelfslayer")
call AddTranslate("custom_O001", "taurenbrute")
call AddTranslate("custom_O004", "orcshaman")
call AddTranslate("custom_O000", "orcsamurai")
call AddTranslate("custom_O006", "orcwarlock")
call AddTranslate("custom_O002", "trollranger")
call AddTranslate("custom_O003", "trollpriest")
call AddTranslate("custom_U002", "undeadbanshee")
call AddTranslate("custom_U000", "skeletalsummoner")
call AddTranslate("custom_N004", "undeadranger")
call AddTranslate("custom_N005", "skeletalarcher")
call AddTranslate("custom_U001", "undeadvampire")
call AddTranslate("custom_U003", "skeletalbaron")
call AddTranslate("custom_", "")
endfunction
function TranslateTo takes string str returns string
local integer i
set i = 1
loop
exitwhen i > udg_TranslateTotal
if str == udg_TranslateFrom[i] then
return udg_TranslateTo[i]
endif
set i = i + 1
endloop
return str
endfunction
function TranslateFrom takes string str returns string
local integer i
set i = 1
loop
exitwhen i > udg_TranslateTotal
if str == udg_TranslateTo[i] then
return udg_TranslateFrom[i]
endif
set i = i + 1
endloop
return str
endfunction
function isShop takes integer i returns boolean
if i == 'n002' then //item shop
elseif i == 'n00B' then //quest shops
elseif i == 'n00C' then
elseif i == 'n00J' then //blacksmiths
elseif i == 'n00D' then
elseif i == 'n00L' then
elseif i == 'n00E' then //havens
elseif i == 'n003' then
elseif i == 'n00K' then
elseif i == 'n00N' then //towers
elseif i == 'n007' then
elseif i == 'n00M' then
else
return false
endif
return true
endfunction
//items
function DropCoin takes location pt, integer level returns nothing
if level <= 1 then
call CreateItemLoc( 'I002', pt )
elseif level == 2 then
call CreateItemLoc( 'I003', pt )
elseif level == 3 then
call CreateItemLoc( 'I004', pt )
elseif level == 4 then
call CreateItemLoc( 'I005', pt )
elseif level == 5 then
call CreateItemLoc( 'I006', pt )
elseif level == 6 then
call CreateItemLoc( 'I007', pt )
elseif level == 7 then
call CreateItemLoc( 'I008', pt )
elseif level == 8 then
call CreateItemLoc( 'I009', pt )
elseif level == 9 then
call CreateItemLoc( 'I00A', pt )
elseif level >= 10 then
call CreateItemLoc( 'I00B', pt )
endif
endfunction
function RandomItemDrop takes integer lvl returns integer
//currently ignore lvl
local integer junk
set junk = GetRandomInt(1,6)
if junk == 1 then
return 'manh'
elseif junk == 2 then
return 'tstr'
elseif junk == 3 then
return 'tdex'
elseif junk == 4 then
return 'tint'
elseif junk == 5 then
return 'tpow'
elseif junk == 6 then
return 'texp'
endif
return 0
endfunction
//doodads
// call CreateDestructableLoc( 'ATtr', GetRectCenter(GetPlayableMapRect()), GetRandomDirectionDeg(), 1, 0 )
// call CreateDestructableLoc( 'BTtw', GetRectCenter(GetPlayableMapRect()), GetRandomDirectionDeg(), 1, 0 )
// call CreateDestructableLoc( 'ITtw', GetRectCenter(GetPlayableMapRect()), GetRandomDirectionDeg(), 1, 0 )
function IsBridge takes destructable d returns boolean
local integer dt
set dt = GetDestructableTypeId(d)
if dt == 'LT06' then
return true
elseif dt == 'LT04' then
return true
elseif dt == 'LT05' then
return true
elseif dt == 'LT07' then
return true
elseif dt == 'YT18' then
return true
elseif dt == 'YT16' then
return true
elseif dt == 'YT17' then
return true
elseif dt == 'YT43' then
return true
elseif dt == 'B005' then
return true
elseif dt == 'B007' then
return true
elseif dt == 'B001' then
return true
elseif dt == 'B003' then
return true
elseif dt == 'B004' then
return true
elseif dt == 'B006' then
return true
elseif dt == 'B000' then
return true
elseif dt == 'B002' then
return true
endif
return false
endfunction
function IsGate takes destructable d returns boolean
local integer dt
set dt = GetDestructableTypeId(d)
if dt == 'LTg1' then
return true
elseif dt == 'LTg3' then
return true
elseif dt == 'LTg2' then
return true
elseif dt == 'LTg4' then
return true
elseif dt == 'LTe1' then
return true
elseif dt == 'LTe3' then
return true
elseif dt == 'LTe2' then
return true
elseif dt == 'LTe4' then
return true
elseif dt == 'ATg1' then
return true
elseif dt == 'ATg3' then
return true
elseif dt == 'ATg2' then
return true
elseif dt == 'ATg4' then
return true
endif
return false
endfunction
function MakeGate takes location pt, integer typ, integer dir returns nothing
if typ == 1 then
//gate
if dir == 1 then
call CreateDestructableLoc( 'LTg1', pt, GetRandomDirectionDeg(), 1, 0 )
elseif dir == 2 then
call CreateDestructableLoc( 'LTg2', pt, GetRandomDirectionDeg(), 1, 0 )
elseif dir == 3 then
call CreateDestructableLoc( 'LTg3', pt, GetRandomDirectionDeg(), 1, 0 )
elseif dir == 4 then
call CreateDestructableLoc( 'LTg4', pt, GetRandomDirectionDeg(), 1, 0 )
endif
elseif typ == 2 then
//elvengate
if dir == 1 then
call CreateDestructableLoc( 'LTe1', pt, GetRandomDirectionDeg(), 1, 0 )
elseif dir == 2 then
call CreateDestructableLoc( 'LTe2', pt, GetRandomDirectionDeg(), 1, 0 )
elseif dir == 3 then
call CreateDestructableLoc( 'LTe3', pt, GetRandomDirectionDeg(), 1, 0 )
elseif dir == 4 then
call CreateDestructableLoc( 'LTe4', pt, GetRandomDirectionDeg(), 1, 0 )
endif
elseif typ == 3 then
//demonicgate
if dir == 1 then
call CreateDestructableLoc( 'ATg1', pt, GetRandomDirectionDeg(), 1, 0 )
elseif dir == 2 then
call CreateDestructableLoc( 'ATg2', pt, GetRandomDirectionDeg(), 1, 0 )
elseif dir == 3 then
call CreateDestructableLoc( 'ATg3', pt, GetRandomDirectionDeg(), 1, 0 )
elseif dir == 4 then
call CreateDestructableLoc( 'ATg4', pt, GetRandomDirectionDeg(), 1, 0 )
endif
endif
call SetDestructableInvulnerableBJ( GetLastCreatedDestructable(), true )
endfunction
function MakeWall takes location pt, integer typ, integer dir returns nothing
if typ == 1 then
//gate
if dir == 1 then
call CreateDestructableLoc( 'LTw0', pt, GetRandomDirectionDeg(), 1, 2 )
elseif dir == 2 then
call CreateDestructableLoc( 'LTw3', pt, GetRandomDirectionDeg(), 1, 2 )
elseif dir == 3 then
call CreateDestructableLoc( 'LTw2', pt, GetRandomDirectionDeg(), 1, 2 )
elseif dir == 4 then
call CreateDestructableLoc( 'LTw1', pt, GetRandomDirectionDeg(), 1, 2 )
endif
endif
call SetDestructableInvulnerableBJ( GetLastCreatedDestructable(), true )
endfunction
function MakeWallXY takes real x, real y, integer typ, integer dir returns nothing
local location loc
set loc = Location(x,y)
call MakeWall(loc, typ, dir)
call RemoveLocation(loc)
set loc = null
endfunction
function AngleToDirNum takes real theta returns integer
if GetBooleanAnd(-22.5 <= theta, theta < 22.5) then
return 3 //vert
elseif GetBooleanAnd(22.5 <= theta, theta < 67.5) then
return 4 //diag2
elseif GetBooleanAnd(-67.5 <= theta, theta < 22.5) then
return 2 //diag1
elseif GetBooleanAnd(67.5 <= theta, theta < 112.5) then
return 1 //horiz
elseif GetBooleanAnd(-112.5 <= theta, theta < -67.5) then
return 1
elseif GetBooleanAnd(112.5 <= theta, theta < 157.5) then
return 2
elseif GetBooleanAnd(-157.5 <= theta, theta < -112.5) then
return 4
else
return 3
endif
return -1
endfunction
function AngleToDirNumWrap takes real junk returns integer
local real theta
set theta = junk
if theta >= 180 then
set theta = theta - 360
endif
return AngleToDirNum(theta)
endfunction
function FindFacingDir takes location pt, location target returns integer
return AngleToDirNum(AngleBetweenPoints(pt, target))
endfunction
function FindAlignmentDir takes location pt, location target returns integer
local real theta
set theta = AngleBetweenPoints(pt, target) + 90
if theta >= 180 then
set theta = theta - 360
endif
return AngleToDirNum(theta)
endfunction
// call CreateDestructableLoc( 'LTg1', GetRectCenter(GetPlayableMapRect()), GetRandomDirectionDeg(), 1, 0 )
// call CreateDestructableLoc( 'LTg3', GetRectCenter(GetPlayableMapRect()), GetRandomDirectionDeg(), 1, 0 )
// call CreateDestructableLoc( 'LTg2', GetRectCenter(GetPlayableMapRect()), GetRandomDirectionDeg(), 1, 0 )
// call CreateDestructableLoc( 'LTg4', GetRectCenter(GetPlayableMapRect()), GetRandomDirectionDeg(), 1, 0 )
function DrawWallLine takes location pt, location target returns nothing
local real xmult
local real ymult
local real theta
local integer dir
local real curlen
local real totlen
local real lenmult
local real x = GetLocationX(pt)
local real y = GetLocationY(pt)
local real xt = GetLocationX(target)
local real yt = GetLocationY(target)
set theta = AngleBetweenPoints(pt, target)
set dir = AngleToDirNumWrap(theta + 90)
set totlen = DistanceBetweenPoints(pt,target)
if theta < -112.5 or theta > 112.5 then
set xmult = -1
elseif theta < 67.5 and theta > -67.5 then
set xmult = 1
else
set xmult = 0
endif
if theta < 157.5 and theta > 22.5 then
set ymult = 1
elseif theta < -22.5 and theta > -157.5 then
set ymult = -1
else
set ymult = 0
endif
set x = x + 160 * xmult
set y = y + 160 * ymult
set lenmult = SquareRoot(Pow(xmult*320, 2.00) + Pow(ymult*320, 2.00))
set curlen = lenmult/2
loop
if not(RectContainsCoords(gg_rct_DMarea, x, y)) then
call MakeWallXY(x,y,1,dir)
endif
set x = x + 320 * xmult
set y = y + 320 * ymult
set curlen = curlen + lenmult
exitwhen curlen >= totlen
endloop
// call DisplayTextToForce( GetPlayersAll(), R2S(theta) )
// call DisplayTextToForce( GetPlayersAll(), R2S(xmult) + " " + R2S(ymult) )
endfunction
function FindNearbyGateEnum takes nothing returns nothing
local location pt
set pt = GetDestructableLoc(GetEnumDestructable())
if IsGate(GetEnumDestructable()) then
if DistanceBetweenPoints(udg_TEMP_Location, pt) < udg_TEMP_Real then
set udg_TEMP_Destructible = GetEnumDestructable()
set udg_TEMP_Real = DistanceBetweenPoints(udg_TEMP_Location, pt)
endif
endif
call RemoveLocation(pt)
endfunction
function FindNearbyGate takes location pt returns destructable
set udg_TEMP_Real = 1000000
set udg_TEMP_Destructible = null
set udg_TEMP_Location = pt
call EnumDestructablesInCircleBJ( 1000.00, pt, function FindNearbyGateEnum )
return udg_TEMP_Destructible
endfunction
function BridgeDirection takes destructable d returns integer
local integer dt
set dt = GetDestructableTypeId(d)
if dt == 'LT06' then
return 3
elseif dt == 'LT04' then
return 4
elseif dt == 'LT05' then
return 1
elseif dt == 'LT07' then
return 2
elseif dt == 'YT18' then
return 3
elseif dt == 'YT16' then
return 4
elseif dt == 'YT17' then
return 1
elseif dt == 'YT43' then
return 2
elseif dt == 'B005' then
return 3
elseif dt == 'B007' then
return 4
elseif dt == 'B001' then
return 1
elseif dt == 'B003' then
return 2
elseif dt == 'B004' then
return 3
elseif dt == 'B006' then
return 4
elseif dt == 'B000' then
return 1
elseif dt == 'B002' then
return 2
endif
return -1
endfunction
function GetBridgeTypeAtPt takes location pt returns integer
if RectContainsLoc(gg_rct_Forest, pt) then
return 0
elseif RectContainsLoc(gg_rct_Snow, pt) then
return 2
elseif RectContainsLoc(gg_rct_Desert, pt) then
return 1
elseif RectContainsLoc(gg_rct_Blend_Desert_Snow, pt) then
if GetRectMinX(gg_rct_Blend_Desert_Snow) + GetRectMaxX(gg_rct_Blend_Desert_Snow) >= GetLocationX(pt) * 2 then
return 1
else
return 2
endif
elseif RectContainsLoc(gg_rct_Blend_Desert_Forest, pt) then
if GetRectMinY(gg_rct_Blend_Desert_Forest) + GetRectMaxY(gg_rct_Blend_Desert_Forest) <= GetLocationY(pt) * 2 then
return 1
else
return 0
endif
elseif RectContainsLoc(gg_rct_Blend_Forest_Snow, pt) then
if GetRectMinY(gg_rct_Blend_Forest_Snow) + GetRectMaxY(gg_rct_Blend_Forest_Snow) <= GetLocationY(pt) * 2 then
return 2
else
return 0
endif
elseif RectContainsLoc(gg_rct_Blend_Middle, pt) then
if GetRectMinY(gg_rct_Blend_Middle) + GetRectMaxY(gg_rct_Blend_Middle) <= GetLocationY(pt) * 2 then
if GetRectMinX(gg_rct_Blend_Middle) + GetRectMaxX(gg_rct_Blend_Middle) >= GetLocationX(pt) * 2 then
return 1
else
return 2
endif
else
return 0
endif
else
return 0
endif
endfunction
function GetBridge takes integer typ, integer facing, location loc returns integer
local integer var
if typ == 0 then
//wooden bridge
if facing == 3 then
return 'LT06'
elseif facing == 4 then
return 'LT04'
elseif facing == 1 then
return 'LT05'
elseif facing == 2 then
return 'LT07'
endif
elseif typ == 1 then
//stone bridge
set var = GetBridgeTypeAtPt(loc)
if var == 0 then
//ashenvale
if facing == 3 then
return 'YT18'
elseif facing == 4 then
return 'YT16'
elseif facing == 1 then
return 'YT17'
elseif facing == 2 then
return 'YT43'
endif
elseif var == 1 then
//barrens
if facing == 3 then
return 'B005'
elseif facing == 4 then
return 'B007'
elseif facing == 1 then
return 'B001'
elseif facing == 2 then
return 'B003'
endif
elseif var == 2 then
//winter
if facing == 3 then
return 'B004'
elseif facing == 4 then
return 'B006'
elseif facing == 1 then
return 'B000'
elseif facing == 2 then
return 'B002'
endif
endif
endif
return 0
endfunction
function FindNearbyBridgeEnum takes nothing returns nothing
local location pt
set pt = GetDestructableLoc(GetEnumDestructable())
if IsBridge(GetEnumDestructable()) then
if DistanceBetweenPoints(udg_TEMP_Location, pt) < udg_TEMP_Real then
set udg_TEMP_Destructible = GetEnumDestructable()
set udg_TEMP_Real = DistanceBetweenPoints(udg_TEMP_Location, pt)
endif
endif
call RemoveLocation(pt)
endfunction
function FindNearbyBridge takes location pt returns destructable
set udg_TEMP_Real = 1000000
set udg_TEMP_Destructible = null
set udg_TEMP_Location = pt
call EnumDestructablesInCircleBJ( 1000.00, pt, function FindNearbyBridgeEnum )
return udg_TEMP_Destructible
endfunction
function MakeBridge takes integer typ, location pt returns integer
local destructable d
local location loc
local integer f
set d = FindNearbyBridge(pt)
if d == null then
return -1
else
set loc = GetDestructableLoc(d)
set f = BridgeDirection(d)
call RemoveDestructable(d)
call CreateDestructableLoc( GetBridge(typ,f,loc), loc, GetRandomDirectionDeg(), 1, 0 )
call KillDestructable( GetLastCreatedDestructable() )
call DestructableRestoreLife( GetLastCreatedDestructable(), GetDestructableMaxLife(GetEnumDestructable()), true)
call RemoveLocation(loc)
endif
return 0
endfunction
function GetDoodadVariation takes integer dd returns integer
if dd == 'ATtr' then
return GetRandomInt(0, 4)
else
return GetRandomInt(0, 9)
endif
return 0
endfunction
function GetDoodadTypeAtPT takes location pt returns integer
local real dd
local real df
local real ds
local real dg
local real rnd
if RectContainsLoc(gg_rct_Forest, pt) then
return 'ATtr'
elseif RectContainsLoc(gg_rct_Snow, pt) then
return 'ITtw'
elseif RectContainsLoc(gg_rct_Desert, pt) then
return 'BTtw'
elseif RectContainsLoc(gg_rct_Blend_Desert_Snow, pt) then
//set dd = GetLocationX(pt) - GetRectMinX(gg_rct_Blend_Desert_Snow)
//set tt = GetRectMaxX(gg_rct_Blend_Desert_Snow) - GetRectMinX(gg_rct_Blend_Desert_Snow)
//increase fill count 1 extra because this takes longer to calculate
set udg_GUI_Misc_DoodadFillCount = udg_GUI_Misc_DoodadFillCount + 1
if GetRandomReal(GetRectMinX(gg_rct_Blend_Desert_Snow), GetRectMaxX(gg_rct_Blend_Desert_Snow)) >= GetLocationX(pt) then
return 'BTtw'
else
return 'ITtw'
endif
elseif RectContainsLoc(gg_rct_Blend_Desert_Forest, pt) then
set udg_GUI_Misc_DoodadFillCount = udg_GUI_Misc_DoodadFillCount + 1
if GetRandomReal(GetRectMinY(gg_rct_Blend_Desert_Forest), GetRectMaxY(gg_rct_Blend_Desert_Forest)) <= GetLocationY(pt) then
return 'BTtw'
else
return 'ATtr'
endif
elseif RectContainsLoc(gg_rct_Blend_Forest_Snow, pt) then
set udg_GUI_Misc_DoodadFillCount = udg_GUI_Misc_DoodadFillCount + 1
if GetRandomReal(GetRectMinY(gg_rct_Blend_Forest_Snow), GetRectMaxY(gg_rct_Blend_Forest_Snow)) <= GetLocationY(pt) then
return 'ITtw'
else
return 'ATtr'
endif
elseif RectContainsLoc(gg_rct_Blend_Middle, pt) then
//increase fill count 2 extra because this takes much longer to calculate
set udg_GUI_Misc_DoodadFillCount = udg_GUI_Misc_DoodadFillCount + 2
if GetRandomReal(GetRectMinY(gg_rct_Blend_Middle), GetRectMaxY(gg_rct_Blend_Middle)) <= GetLocationY(pt) then
if GetRandomReal(GetRectMinX(gg_rct_Blend_Middle), GetRectMaxX(gg_rct_Blend_Middle)) >= GetLocationX(pt) then
return 'BTtw'
else
return 'ITtw'
endif
else
return 'ATtr'
endif
else
return 'ATtr'
endif
endfunction
function DoodadFillArea takes rect area, boolean circle returns nothing
local real inc = 150
local real x
local real y
local location pt
local integer dd
//normalize value to multiple of 150 of world coords to prevent tree seams
set x = I2R(R2I(GetRectMinX(area) / 150)) * 150
loop
exitwhen x > GetRectMaxX(area)
set y = I2R(R2I(GetRectMinY(area) / 150)) * 150
loop
exitwhen y > GetRectMaxY(area)
set pt = Location(x + GetRandomReal(-inc/5, inc/5),y + GetRandomReal(-inc/5, inc/5) + ModuloInteger(R2I(x / inc), 2) * inc / 2)
set dd = GetDoodadTypeAtPT(pt)
if GetBooleanOr(not(circle), DistanceBetweenPoints(pt, GetRectCenter(area)) <= (GetRectMaxX(area) - GetRectMinX(area))/2) then
call CreateDestructableLoc( dd, pt, GetRandomDirectionDeg(), 1, GetDoodadVariation(dd) )
call KillDestructable( GetLastCreatedDestructable() )
call DestructableRestoreLife( GetLastCreatedDestructable(), GetDestructableMaxLife(GetLastCreatedDestructable()), true )
if DistanceBetweenPoints(GetDestructableLoc(GetLastCreatedDestructable()), pt) > 100 then
call RemoveDestructable(GetLastCreatedDestructable())
endif
endif
//(prevent trigger from being stopped and prevent game desync(<-?))
set udg_GUI_Misc_DoodadFillCount = udg_GUI_Misc_DoodadFillCount + 1
if udg_GUI_Misc_DoodadFillCount > 500 then
set udg_GUI_Misc_DoodadFillCount = 0
call TriggerSleepAction(0)
endif
call RemoveLocation(pt)
set y = y + inc
endloop
set x = x + inc
endloop
endfunction
//cam
function GUIApplyCamForDM takes player pl returns nothing
//incomplete (zooming not yet done)
//call CameraSetupApplyForPlayer( true, gg_cam_ZoomOutCam, pl, 0.0 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_ROTATION, CameraSetupGetFieldSwap(CAMERA_FIELD_ANGLE_OF_ATTACK, gg_cam_ZoomOutCam), 1.00 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_ANGLE_OF_ATTACK, CameraSetupGetFieldSwap(CAMERA_FIELD_ANGLE_OF_ATTACK, gg_cam_ZoomOutCam), 0.00 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_TARGET_DISTANCE, CameraSetupGetFieldSwap(CAMERA_FIELD_TARGET_DISTANCE, gg_cam_ZoomOutCam), 0.00 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_FIELD_OF_VIEW, CameraSetupGetFieldSwap(CAMERA_FIELD_FIELD_OF_VIEW, gg_cam_ZoomOutCam), 0.00 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_FARZ, CameraSetupGetFieldSwap(CAMERA_FIELD_FARZ, gg_cam_ZoomOutCam), 0 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_ROLL, CameraSetupGetFieldSwap(CAMERA_FIELD_ROLL, gg_cam_ZoomOutCam), 0 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_ROTATION, CameraSetupGetFieldSwap(CAMERA_FIELD_ROTATION, gg_cam_ZoomOutCam), 0 )
endfunction
function GUIApplyZoomForDM takes player pl returns nothing
//boobies
endfunction
//spell
function MakeFirePatch takes player pl, integer lvl, location p, real dur returns nothing
call CreateNUnitsAtLoc( 1, 'n006', pl, GetRandomLocInRect(gg_rct_Dummy_Casters), bj_UNIT_FACING )
//call DisplayTextToForce( GetPlayersAll(), I2S(lvl) )
if lvl == 1 then
call UnitAddAbilityBJ( 'A00R', GetLastCreatedUnit() )
elseif lvl == 2 then
call UnitAddAbilityBJ( 'A00S', GetLastCreatedUnit() )
elseif lvl == 3 then
call UnitAddAbilityBJ( 'A00Q', GetLastCreatedUnit() )
endif
call UnitApplyTimedLifeBJ( dur, 'BTLF', GetLastCreatedUnit() )
call SetUnitVertexColorBJ( GetLastCreatedUnit(), 100, 100, 100, 100.00 )
call IssuePointOrderLocBJ( GetLastCreatedUnit(), "rainoffire", p )
endfunction
//gen
function ClearScreen takes nothing returns nothing
local integer i
set i = 1
loop
exitwhen i > 20
call DisplayTextToForce(GetPlayersAll(), " ")
set i = i + 1
endloop
endfunction
function ClearScreenForce takes force fp returns nothing
local integer i
set i = 1
loop
exitwhen i > 20
call DisplayTextToForce(fp, " ")
set i = i + 1
endloop
endfunction
function ColorName takes string name, integer id returns string
if (id == 1) then
return "|c00FF0000" + name + "|r"
elseif (id == 2) then
return "|c000040FF" + name + "|r"
elseif (id == 3) then
return "|c0000FFBF" + name + "|r"
elseif (id == 4) then
return "|c003F007F" + name + "|r"
elseif (id == 5) then
return "|c00FFFF00" + name + "|r"
elseif (id == 6) then
return "|c00FF7F00" + name + "|r"
elseif (id == 7) then
return "|c0000BF00" + name + "|r"
elseif (id == 8) then
return "|c00FF3FFF" + name + "|r"
elseif (id == 9) then
return "|c00A0A0A0" + name + "|r"
elseif (id == 10) then
return "|c007FBFFF" + name + "|r"
elseif (id == 11) then
return "|c000F5F3F" + name + "|r"
elseif (id == 12) then
return "|c004F2700" + name + "|r"
else
return "|c00303030" + name + "|r"
endif
//-Vuen
endfunction
function ColorNamePl takes player pl returns string
return ColorName(GetPlayerName(pl), GetConvertedPlayerId(pl))
endfunction
function CountEnum takes nothing returns nothing
set udg_TEMP_Integer = udg_TEMP_Integer + 1
endfunction
function PauseEnumUnit takes nothing returns nothing
call PauseUnitBJ( false, GetEnumUnit() )
endfunction
function KillEnumUnit takes nothing returns nothing
call KillUnit( GetEnumUnit() )
endfunction
function RemoveEnumUnit takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction
function isWard takes unit un returns boolean
if GetUnitName(un) == "Healing Ward" then
return true
elseif GetUnitName(un) == "Serpent Ward" then
return true
elseif GetUnitName(un) == "Sentry Ward" then
return true
endif
return false
endfunction
function isDummy takes unit un returns boolean
if GetUnitTypeId(un) == 'n006' then
return true
endif
return false
endfunction
//train
//not a mirror, summoned, a dummy, a flag, a ward, a structure, or dead
function IsCountableTrainUnit takes unit un returns boolean
if IsUnitIllusionBJ(un) then
return false
elseif IsUnitType(un, UNIT_TYPE_SUMMONED) then
return false
elseif isDummy(un) then
return false
elseif GetUnitTypeId(un) == 'h00B' then //training flag
return false
elseif isWard(un) then
return false
elseif not(IsUnitAliveBJ(un)) then
return false
elseif IsUnitType(un, UNIT_TYPE_STRUCTURE) then
return false
endif
return true
endfunction
//is a training unit, and not a dummy, a flag, a ward, a structure, or dead
function IsKillableTrainUnit takes unit un returns boolean
if not(IsUnitTrain(un)) then
return false
elseif isDummy(un) then
return false
elseif GetUnitTypeId(un) == 'h00B' then //training flag
return false
elseif isWard(un) then
return false
elseif not(IsUnitAliveBJ(un)) then
return false
elseif IsUnitType(un, UNIT_TYPE_STRUCTURE) then
return false
endif
return true
endfunction
//math or numerical
function ICap takes integer val, integer low, integer high returns integer
return IMaxBJ(IMinBJ(val, high), low)
endfunction
function RCap takes real val, real low, real high returns real
return RMaxBJ(RMinBJ(val, high), low)
endfunction
function GetArrayMega takes integer i returns integer
return (i - ModuloInteger(i, 10)) / 10 //gets high on 2d base10 array
endfunction
function RShuffle takes real val returns real //random within 1/7 of val
return val + GetRandomReal(-val/7, val/7)
endfunction
function IShuffle takes integer val returns integer
return R2I(RShuffle(I2R(val)))
endfunction
function RBigShuffle takes real val returns real //random within 1/5 of val
return val + GetRandomReal(-val/5, val/5)
endfunction
function IBigShuffle takes integer val returns integer
return R2I(RBigShuffle(I2R(val)))
endfunction
function IsANumber takes string str returns boolean
//Couldn't really think of a simpler way to do this
if (str == "0") then
return true
elseif (str == "1") then
return true
elseif (str == "2") then
return true
elseif (str == "3") then
return true
elseif (str == "4") then
return true
elseif (str == "5") then
return true
elseif (str == "6") then
return true
elseif (str == "7") then
return true
elseif (str == "8") then
return true
elseif (str == "9") then
return true
endif
return false
endfunction
function GetPlayerNumFromStr takes string text returns integer
local integer i
if text == "red" then
return 1
elseif text == "enemy" then
return 1
elseif text == "blue" then
return 2
elseif text == "teal" then
return 3
elseif text == "purple" then
return 4
elseif text == "yellow" then
return 5
elseif text == "ally" then
return 5
elseif text == "orange" then
return 6
elseif text == "green" then
return 7
elseif text == "pink" then
return 8
elseif text == "grey" then
return 9
elseif text == "gray" then
return 9
elseif text == "cyan" then
return 10
elseif text == "lightblue" then
return 10
elseif text == "lb" then
return 10
elseif text == "darkgreen" then
return 11
elseif text == "dg" then
return 11
elseif text == "brown" then
return 12
elseif text == "black" then
return 13
else
set i = S2I(text)
if i < 1 or i > 13 then
return -1
endif
return i
endif
return -1
endfunction
function GetPlayerNumFromStrSafe takes string text returns integer
local integer i
set i = GetPlayerNumFromStr(text)
if i == -1 then
return 13
endif
return i
endfunction
//other
function CropText takes string bla returns string
return bla
endfunction
function CenterText takes string bla returns string
return bla
endfunction
//This should crash WE when attempting to save:
function crash takes nothing returns nothing
if true then
Name | Type | is_array | initial_value |
asdgdfag | rect | No | |
Board | leaderboard | Yes | |
BonusAbility | abilcode | Yes | |
BOOT_Dialog | dialog | No | |
BOOT_DialogNo | button | No | |
BOOT_DialogYes | button | No | |
DebugBoard | multiboard | No | |
DebugBoardCreated | boolean | No | |
DM_Destination | location | Yes | |
DM_DoodPt | location | Yes | |
DM_Misc | integer | Yes | |
DM_MiscBool | boolean | Yes | |
DM_MiscSub | integer | Yes | |
DM_Player | player | Yes | |
DM_SubType | string | Yes | |
DM_Unit | unit | Yes | |
DM_UnitType | unitcode | Yes | |
Force | force | Yes | |
FreeHero | boolean | No | |
GUI_Doodads_Click | trigger | No | |
GUI_Items_Click | trigger | No | |
GUI_Misc_Chat | trigger | No | |
GUI_Misc_DoodadFillCount | integer | No | 0 |
GUI_Misc_Escape | trigger | No | |
GUI_Misc_Poll | trigger | No | |
GUI_Misc_Select | trigger | No | |
GUI_Pointer | unit | Yes | |
GUI_Pointer_Point | trigger | No | |
GUI_Pointer_Unit | trigger | No | |
GUI_Slider_Ref | unit | Yes | |
GUI_Tile | unit | Yes | |
GUI_Tile_Group | group | No | |
GUI_Units_Click | trigger | No | |
HERO_AllowDuplicates | boolean | No | |
HERO_ButtonText | texttag | Yes | |
HERO_FloatCam | boolean | Yes | |
HERO_IsDead | boolean | Yes | |
HERO_LastSel | unit | Yes | |
HERO_Ref2 | unit | Yes | |
HERO_Restrictor | trigger | No | |
HERO_Selection | trigger | No | |
KA_Group | group | No | |
KA_Text | texttag | Yes | |
KA_Unit | unit | Yes | |
MISC_Fountains | group | No | |
Names | string | Yes | |
Status | string | Yes | |
TEMP_Boolean | boolean | No | |
TEMP_Destructible | destructable | No | |
TEMP_Integer | integer | No | |
TEMP_Item | item | No | |
TEMP_Location | location | No | |
TEMP_Player | player | No | |
TEMP_Real | real | No | |
TEMP_RealArray | real | Yes | |
TEMP_Unit | unit | No | |
TRAIN_CountBad | integer | No | |
TRAIN_CountGood | integer | No | |
TRAIN_CountGoodTotal | integer | No | |
TRAIN_CurRoom | unit | No | |
TRAIN_Level | real | No | |
TRAIN_Rooms | group | No | |
TRAIN_Type | unitcode | Yes | |
TranslateFrom | string | Yes | |
TranslateTo | string | Yes | |
TranslateTotal | integer | No |
IF YOU SAVE THIS MAP, IT WILL BREAK.
This map uses a modified TerrainArt/Terrain.slk to
generate the pathing map, which makes the 'fake
cliffs' unwalkable. Saving will compute the pathing
map incorrectly, meaning units will be able to walk
over cliffs. It was left out of the map because it
doesn't actually work unless you extract it and
restart the editor, and to keep the file size small.
This map is save-locked to prevent it from being saved.
If you somehow circumvent the protection and save without
the apprioriate pathing files, please delete it and
e-mail me for an original copy. I don't want people
spreading broken versions online.
If you'd like to make a modification to this map,
I'd be more than happy to send you the required files
via e-mail.
-Vuen ([email protected])
#######################################
# #
# Vuen's D&D Crystal RPG #
# #
# by Nicholas Fraser (Vuen) #
# [email protected] #
# #
#######################################
Okay. This is the readme file for this map.
This map was done entirely in the official
TFT World Editor; no WE mod or JASS editor was
used, and the WE Enhancer was only used to
add cliff terrain tiles to the map.
Feel free to use anything you'd like from this
map, and e-mail me if you have any questions.
If you use any chunks of code verbatim or if
you use my custom models, please leave credit.
I have people criticize me often for calling
it a D&D when it does not use D&D rules. The
reason is because this map was originally called
DM's Land RPG, but no one knew what that meant.
The term RPG has a different connotation when
referring to video games, and it's not the
meaning I want; besides, this map follows in the
footsteps of Neverlax and QuatreDan's D&D maps,
so everyone knows what D&D refers to.
I hope you prefer the pointer over the spawner.
I know I do, and I certainly hope it replaces
spawners in all D&D and RP maps from now on.
Feel free to email me if you have any ideas,
comments, questions, or complaints about this
map, or even if you just want to say 'Hi'!
Your feedback is what makes this map possible.
Happy Roleplaying!
This list is probably missing a bunch of stuff. I
often forget to add stuff here when I change it.
-- version 1.5 (beta100) --
chats hidden, OOC
hero revive bug fixed (hopefully)
new commands
immune
tint
color
life
damage
armor
give
bounty fixes
summons no longer drop gold
mirrors no longer duplicate items
training room fixes
properly ignores summons, mirrors (finally)
border does not kill non-training units, but they are still counted
removing/killing kills all trainunits
spell fixes
firewall no longer dispels blight
summoned / controlled units automatically follow
added walls, line of walls
unit and building lumber costs removed
items
item types, one per unit
all custom items
heroes cannot give items to other heroes
fixed sticky KA bug
added yet more dobrp/qdnd compatibility
palette additions
fountain, trainroom, goldmine
added 'cast spell' ability
-- version 1.0 (beta58) --
original release
I always forget to update this readme, so
half of this is probably done by now. Here's
my 'planned features' list as of this writing:
known bugs
currently none aside from minor fixes
features
hero intro cinematic
dm camera functions
hurt func (damage)
ums/move func (move selected units)
item mover
make/remove hero flag
gold collected / assets leaderboard
kill everything at rightclick function
minor fixes
fountain heal only allegiance
mountain giant tree damage
training remove nearby flag
show floating text only to DMs
head DM float
food limit
turn off ally town under siege
make gold drops bonus hp
neutral sharevis
trainflag death no bounty
set summons from trainunits to trainunit
make Lumber say Experience
fix lava spawns follow
improvements
document commands directly on GUI
create units -> cam pos
select waygate ping
unit random city house, high elf house
trainkill no bounty
customval bits - invuln, train
blink smart unit/item -> blink, queue
blink not past gates/cliffs
blight/dispel manually +effect
naga units, tents (finish palette)
hero balance
?
hero ideas
priest ult wards -> mp/hp xtranquil
heal,ifire,rdead lvlskip
shaman - heal %
night elf blink
abilities
undead phoenix->infernal
fireball/meteor
fire arrow (fireball, immolation)
vampire bite
lightning strike
smite evil (priest/cleric)
find potion
items
weapons (one at a time)
caster items
gold
doodads
energyfield
rain
fog
sickness
walls
accessories:
helmet
glove
circlet/amulet
belt
boots
ring
accessory can:
add attributes
add life/mana
move speed bonus
immolation
magic damage
aura
immune
ideas
non-dm quests
player allegiance - bounty? (good/evil)
item crafting system
invuln all monsts
overhead perm-invuln (attach list boolarray, unitarray, effectarray, largest)
last unit locs: ptarray, boolarray, unitarray, count
hero build houses for respawn point
freeze gameplay (invuln all, stop+hold + ignore orders, reset abil cools)
message log
ka chance to die
follow
waygate (poll dist?)
blink
follow glob players?
mercs
ally, ka (chance?), follow, noinv, match col
town portals
//*************************
// checked for leaks
//*************************
//init
function doMainConstants takes nothing returns nothing
set udg_Force[1] = CreateForce()
set udg_Force[2] = CreateForce()
set udg_Force[3] = CreateForce()
call ForceAddPlayerSimple( ConvertedPlayer(2), udg_Force[1] )
call ForceAddPlayerSimple( ConvertedPlayer(3), udg_Force[1] )
call ForceAddPlayerSimple( ConvertedPlayer(4), udg_Force[1] )
call ForceAddPlayerSimple( ConvertedPlayer(6), udg_Force[1] )
call ForceAddPlayerSimple( ConvertedPlayer(7), udg_Force[1] )
call ForceAddPlayerSimple( ConvertedPlayer(8), udg_Force[1] )
call ForceAddPlayerSimple( ConvertedPlayer(12), udg_Force[1] )
call ForceAddPlayerSimple( ConvertedPlayer(9), udg_Force[2] )
call ForceAddPlayerSimple( ConvertedPlayer(10), udg_Force[2] )
call ForceAddPlayerSimple( ConvertedPlayer(11), udg_Force[2] )
call ForceAddPlayerSimple( ConvertedPlayer(1), udg_Force[3] )
call ForceAddPlayerSimple( ConvertedPlayer(5), udg_Force[3] )
endfunction
function doDebugSharePlayerControl takes nothing returns nothing
call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_SHARED_CONTROL, true, ConvertedPlayer(9) )
call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_SHARED_CONTROL, true, ConvertedPlayer(10) )
call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_SHARED_CONTROL, true, ConvertedPlayer(11) )
call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_SHARED_ADVANCED_CONTROL, true, ConvertedPlayer(9) )
call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_SHARED_ADVANCED_CONTROL, true, ConvertedPlayer(10) )
call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_SHARED_ADVANCED_CONTROL, true, ConvertedPlayer(11) )
endfunction
function doInitPlayers takes nothing returns nothing
//set exp rate
call SetPlayerHandicapXPBJ( GetEnumPlayer(), 50.00 )
//handle alliances:
call SetPlayerAllianceStateAllyBJ ( GetEnumPlayer(), ConvertedPlayer(5), true )
call SetPlayerAllianceStateAllyBJ ( ConvertedPlayer(5), GetEnumPlayer(), true )
//call SetPlayerAllianceStateBJ( ConvertedPlayer(5), GetEnumPlayer(), bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( ConvertedPlayer(9), GetEnumPlayer(), bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( ConvertedPlayer(10), GetEnumPlayer(), bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( ConvertedPlayer(11), GetEnumPlayer(), bj_ALLIANCE_ALLIED )
//call doDebugSharePlayerControl()
endfunction
function doInitDMs takes nothing returns nothing
call SetPlayerAllianceStateBJ( ConvertedPlayer(1), GetEnumPlayer(), bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( ConvertedPlayer(2), GetEnumPlayer(), bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( ConvertedPlayer(1), GetEnumPlayer(), bj_ALLIANCE_ALLIED_ADVUNITS )
call SetPlayerAllianceStateBJ( ConvertedPlayer(5), GetEnumPlayer(), bj_ALLIANCE_ALLIED_ADVUNITS )
// call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_PASSIVE, true, ConvertedPlayer(1) )
// call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_PASSIVE, true, ConvertedPlayer(5) )
// call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_PASSIVE, false, ConvertedPlayer(2) )
// call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_PASSIVE, false, ConvertedPlayer(3) )
// call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_PASSIVE, false, ConvertedPlayer(4) )
// call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_PASSIVE, false, ConvertedPlayer(6) )
// call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_PASSIVE, false, ConvertedPlayer(7) )
// call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_PASSIVE, false, ConvertedPlayer(8) )
// call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_PASSIVE, false, ConvertedPlayer(12) )
//call SetPlayerAllianceStateAllyBJ ( GetEnumPlayer(), ConvertedPlayer(2), false )
//call SetPlayerAllianceStateAllyBJ ( GetEnumPlayer(), ConvertedPlayer(3), false )
//call SetPlayerAllianceStateAllyBJ ( GetEnumPlayer(), ConvertedPlayer(4), false )
//call SetPlayerAllianceStateAllyBJ ( GetEnumPlayer(), ConvertedPlayer(6), false )
//call SetPlayerAllianceStateAllyBJ ( GetEnumPlayer(), ConvertedPlayer(7), false )
//call SetPlayerAllianceStateAllyBJ ( GetEnumPlayer(), ConvertedPlayer(8), false )
//call SetPlayerAllianceStateAllyBJ ( GetEnumPlayer(), ConvertedPlayer(12), false )
endfunction
function Init takes nothing returns nothing
call doMainConstants()
call ForForce( udg_Force[1], function doInitPlayers )
call ForForce( udg_Force[2], function doInitDMs )
//misc
//call EnableWorldFogBoundaryBJ( false, GetPlayersAll() )
call InitTranslator()
//frameskip
call TriggerSleepAction(0)
//init players
//call TriggerExecute( gg_trg_PlayerGlob )
//call TriggerExecute( gg_trg_HeroSelector )
//call TriggerExecute( gg_trg_Inventory )
//init dms
call TriggerExecute( gg_trg_Create )
call TriggerExecute( gg_trg_Units )
call TriggerExecute( gg_trg_Misc )
call TriggerExecute( gg_trg_Items )
//init doodads
call TriggerExecute( gg_trg_Doodads )
//introduce map
call ClearScreen()
call DisplayTextToForce( GetPlayersAll(), "Welcome to Vuen's D&D Crystal!" )
//call DisplayTextToForce( GetPlayersAll(), " This is a WORK IN PROGRESS! Parts of this map are" )
//call DisplayTextToForce( GetPlayersAll(), " incomplete; they will be added in a future release." )
//call DisplayTextToForce( GetPlayersAll(), " Thank you for testing!" )
call DisplayTextToForce( GetPlayersAll(), " " )
call DisplayTextToForce( udg_Force[1], "Please wait while a DM selects available heroes." )
call DisplayTextToForce( bj_FORCE_PLAYER[9], "You are a DM." )
call DisplayTextToForce( bj_FORCE_PLAYER[9], "Press |cFFFFFF00ESC|r to get started!" )
call DisplayTextToForce( bj_FORCE_PLAYER[9], "Help is available in the quest log (|cFFFFFF00F9|r)." )
call DisplayTextToForce( bj_FORCE_PLAYER[10], "You are a DM." )
call DisplayTextToForce( bj_FORCE_PLAYER[10], "Press |cFFFFFF00ESC|r to get started!" )
call DisplayTextToForce( bj_FORCE_PLAYER[10], "Help is available in the quest log (|cFFFFFF00F9|r)." )
call DisplayTextToForce( bj_FORCE_PLAYER[8], "Click a Hero to toggle its availability." )
call DisplayTextToForce( bj_FORCE_PLAYER[8], "|c0000FF00Green|r = Allow, |c00FF0000Red|r = Deny." )
call DisplayTextToForce( bj_FORCE_PLAYER[8], "Choose quickly; the heroes are waiting." )
call TriggerSleepAction(0)
// call CameraSetupApplyForPlayer( true, gg_cam_HeroRestrictor, Player(8), 0 )
endfunction
function InitTrig_Initialization takes nothing returns nothing
set gg_trg_Initialization = CreateTrigger()
call TriggerAddAction(gg_trg_Initialization, function Init)
endfunction
//*************************
// checked for leaks
//*************************
//************************************
//************************************
//********** CHAT **********
//************************************
//************************************
function ShowLocalDebugBoard takes nothing returns nothing
if GetTriggerPlayer() == GetLocalPlayer() then
call MultiboardDisplayBJ( true, udg_DebugBoard )
call MultiboardMinimizeBJ( false, udg_DebugBoard )
endif
endfunction
function doSharePlayerEnumControl takes nothing returns nothing
//careful with gettriggerplayer, its not actually in docommandentered, no guarantees
call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_SHARED_CONTROL, true, GetTriggerPlayer() )
call SetPlayerAllianceBJ( GetEnumPlayer(), ALLIANCE_SHARED_ADVANCED_CONTROL, true, GetTriggerPlayer() )
endfunction
function VulnEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
call SetUnitInvulnerable( GetEnumUnit(), false )
endif
endif
endfunction
function InvulnEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
call SetUnitInvulnerable( GetEnumUnit(), true )
endif
endif
endfunction
function ColorEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
call SetUnitColor( GetEnumUnit(), GetPlayerColor(ConvertedPlayer(udg_TEMP_Integer)) )
endif
endif
endfunction
function TintEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
call SetUnitVertexColorBJ( GetEnumUnit(), udg_TEMP_RealArray[1], udg_TEMP_RealArray[2], udg_TEMP_RealArray[3], udg_TEMP_RealArray[4] )
endif
endif
endfunction
function ImmuneEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
call UnitAddAbilityBJ( 'ACmi', GetEnumUnit() )
endif
endif
endfunction
function UnImmuneEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
call UnitRemoveAbilityBJ( 'ACmi', GetEnumUnit() )
endif
endif
endfunction
function GiveEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
if IsPlayerInForce(ConvertedPlayer(udg_TEMP_Integer), udg_Force[1]) and IsUnitIdType(GetUnitTypeId(GetEnumUnit()), UNIT_TYPE_HERO) then
set udg_TEMP_Boolean = true
else
if IsPlayerInForce(ConvertedPlayer(udg_TEMP_Integer), udg_Force[1]) then
call UnitRemoveAbilityBJ( 'A03N', GetEnumUnit() )
else
if not(isShop(GetUnitTypeId(GetEnumUnit()))) then
call UnitAddAbilityBJ( 'A03N', GetEnumUnit() )
endif
endif
call SetUnitOwner( GetEnumUnit(), ConvertedPlayer(udg_TEMP_Integer), true )
endif
endif
endif
endfunction
function ClearTrainingRoomEnumUnits takes nothing returns nothing
local location loc
local location loc2
local real distance
set loc = GetUnitLoc(GetEnumUnit())
set loc2 = GetUnitLoc(udg_TRAIN_CurRoom)
set distance = DistanceBetweenPoints(loc, loc2)
call RemoveLocation(loc)
call RemoveLocation(loc2)
if GetOwningPlayer(GetEnumUnit()) == ConvertedPlayer(1) then
if distance < 900 then
if IsKillableTrainUnit(GetEnumUnit()) then
call KillUnit(GetEnumUnit())
endif
endif
endif
endfunction
function ClearTrainingRoomMonsters takes unit un returns nothing
local location trainloc
local group grp
set udg_TRAIN_CurRoom = un
set trainloc = GetUnitLoc(udg_TRAIN_CurRoom)
call MoveRectToLoc( gg_rct_TrainingRoom, trainloc )
set grp = GetUnitsInRectAll(gg_rct_TrainingRoom)
call ForGroupBJ( grp, function ClearTrainingRoomEnumUnits )
call DestroyGroup(grp)
call RemoveLocation(trainloc)
endfunction
function KillEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
if GetUnitTypeId(GetEnumUnit()) == 'h00B' then
call ClearTrainingRoomMonsters(GetEnumUnit())
endif
call RemoveKeepAliveUnit(GetEnumUnit())
call KillUnit( GetEnumUnit() )
endif
endif
endfunction
function KeepAliveEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
call KeepAliveUnit( GetEnumUnit() )
endif
endif
endfunction
function RemoveEnumUnitSelected takes nothing returns nothing
local location loc
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3]) then
call RemoveKeepAliveUnit(GetEnumUnit())
if GetUnitTypeId(GetEnumUnit()) == 'h00B' then
call ClearTrainingRoomMonsters(GetEnumUnit())
call KillUnit(GetEnumUnit())
else
set loc = GetUnitLoc(GetEnumUnit())
call AddSpecialEffectLocBJ( loc, "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveLocation(loc)
call RemoveUnit( GetEnumUnit() )
endif
endif
endif
endfunction
function UnitSizeEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
call SetUnitScalePercent( GetEnumUnit(), udg_TEMP_Integer, udg_TEMP_Integer, udg_TEMP_Integer)
call SetUnitMoveSpeed( GetEnumUnit(), I2R(udg_TEMP_Integer) * GetUnitDefaultMoveSpeed(GetEnumUnit()) / 100 )
endif
endif
endfunction
function SideSwapEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3]) then
if GetOwningPlayer(GetEnumUnit()) == ConvertedPlayer(1) then
call SetUnitOwner( GetEnumUnit(), ConvertedPlayer(5), true )
else
call SetUnitOwner( GetEnumUnit(), ConvertedPlayer(1), true )
endif
endif
endif
endfunction
function HeroLevelEnumUnitSelected takes nothing returns nothing
if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
if IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) then
call SetHeroLevelBJ( GetEnumUnit(), udg_TEMP_Integer, true )
endif
endif
endif
endfunction
function DebugCommand takes string str, integer id returns nothing
if udg_DebugBoardCreated then
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, ColorName(str,id) )
call PolledWait( 4.00 )
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, "" )
endif
endfunction
function DoCommandEntered takes integer id returns boolean
local unit GUI_Units = gg_unit_n000_0001
local unit GUI_U_Create = gg_unit_n000_0002
local unit GUI_U_Kill = gg_unit_n000_0003
local unit GUI_U_Remove = gg_unit_n000_0004
local unit GUI_U_Side = gg_unit_n000_0005
local unit GUI_U_Move = gg_unit_n000_0006
local unit GUI_D_Create = gg_unit_n000_0038
local unit GUI_D_Remove = gg_unit_n000_0039
local unit GUI_D_Kill = gg_unit_n000_0040
local unit GUI_D_Revive = gg_unit_n000_0041
local unit GUI_D_Toggle = gg_unit_n000_0042
local unit GUI_D_P_Grove = gg_unit_n000_0123
local unit GUI_D_P_Tree = gg_unit_n000_0124
local unit GUI_D_P_Blight = gg_unit_n000_0125
local unit GUI_D_P_Dispel = gg_unit_n000_0131
local unit GUI_D_P_WoodenBridge = gg_unit_n008_0127
local unit GUI_D_P_StoneBridge = gg_unit_n009_0128
local unit GUI_D_P_Gate = gg_unit_n00G_0136
local unit GUI_D_P_ElvenGate = gg_unit_n00H_0137
local unit GUI_D_P_DemonicGate = gg_unit_n00F_0138
local unit GUI_D_P_StoneWall = gg_unit_n00O_0164
local unit GUI_D_P_Line1 = gg_unit_n00P_0183
local unit GUI_Items = gg_unit_n000_0033
local unit GUI_I_Create = gg_unit_n000_0034
local unit GUI_I_Remove = gg_unit_n000_0035
local unit GUI_I_Move = gg_unit_n000_0036
local unit GUI_I_P_GoldPile = gg_unit_n000_0132
local unit GUI_I_P_GoldCoin = gg_unit_n000_0133
local unit GUI_I_P_PileOfRiches = gg_unit_n000_0079
local unit GUI_M_Portal = gg_unit_n000_0044
local group grp
local player pl
local force fp
local string str
local string text
local integer utype
local integer i1
local integer i2
local integer array ratios
set pl = ConvertedPlayer(id)
if not(IsPlayerInForce(pl, udg_Force[2])) then
//********************RETURN
return false //not a command
endif
set fp = bj_FORCE_PLAYER[id-1]
set str = StringCase(GetEventPlayerChatString(), false)
//Units
if (str == "uc") then
call SelectUnitForPlayerSingle( GUI_U_Create, pl )
elseif (str == "uk") then
call SelectUnitForPlayerSingle( GUI_U_Kill, pl )
elseif (str == "uks" or str == "kill") then
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function KillEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
elseif (str == "ur") then
call SelectUnitForPlayerSingle( GUI_U_Remove, pl )
elseif (str == "urs" or str == "remove") then
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function RemoveEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
elseif (str == "us") then
call SelectUnitForPlayerSingle( GUI_U_Side, pl )
elseif (str == "uss" or str == "side") then
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function SideSwapEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
elseif (str == "um") then
call SelectUnitForPlayerSingle( GUI_U_Move, pl )
//Items
elseif (str == "ic") then
call SelectUnitForPlayerSingle( GUI_I_Create, pl )
elseif (str == "ir") then
call SelectUnitForPlayerSingle( GUI_I_Remove, pl )
elseif (str == "goldcoin") then
call SelectUnitForPlayerSingle( GUI_I_P_GoldCoin, pl )
elseif (str == "gold coin") then
call SelectUnitForPlayerSingle( GUI_I_P_GoldCoin, pl )
elseif (str == "pileofgold") then
call SelectUnitForPlayerSingle( GUI_I_P_GoldPile, pl )
elseif (str == "pile of gold") then
call SelectUnitForPlayerSingle( GUI_I_P_GoldPile, pl )
elseif (str == "gold") then
call SelectUnitForPlayerSingle( GUI_I_P_GoldPile, pl )
elseif (str == "goldpile") then
call SelectUnitForPlayerSingle( GUI_I_P_GoldPile, pl )
elseif (str == "gold pile") then
call SelectUnitForPlayerSingle( GUI_I_P_GoldPile, pl )
elseif (str == "riches") then
call SelectUnitForPlayerSingle( GUI_I_P_PileOfRiches, pl )
elseif (str == "pileofriches") then
call SelectUnitForPlayerSingle( GUI_I_P_PileOfRiches, pl )
elseif (str == "pile of riches") then
call SelectUnitForPlayerSingle( GUI_I_P_PileOfRiches, pl )
//Doodads
elseif (str == "dc") then
call SelectUnitForPlayerSingle( GUI_D_Create, pl )
elseif (str == "dk") then
call SelectUnitForPlayerSingle( GUI_D_Kill, pl )
elseif (str == "dr") then
call SelectUnitForPlayerSingle( GUI_D_Remove, pl )
elseif (str == "dv") then
call SelectUnitForPlayerSingle( GUI_D_Revive, pl )
elseif (str == "dt") then
call SelectUnitForPlayerSingle( GUI_D_Toggle, pl )
elseif (str == "grove") then
call SelectUnitForPlayerSingle( GUI_D_P_Grove, pl )
elseif (str == "tree") then
call SelectUnitForPlayerSingle( GUI_D_P_Tree, pl )
elseif (str == "dispel") then
call SelectUnitForPlayerSingle( GUI_D_P_Dispel, pl )
elseif (str == "blight") then
call SelectUnitForPlayerSingle( GUI_D_P_Blight, pl )
elseif (str == "woodbridge") then
call SelectUnitForPlayerSingle( GUI_D_P_WoodenBridge, pl )
elseif (str == "woodenbridge") then
call SelectUnitForPlayerSingle( GUI_D_P_WoodenBridge, pl )
elseif (str == "stonebridge") then
call SelectUnitForPlayerSingle( GUI_D_P_StoneBridge, pl )
elseif (str == "wood bridge") then
call SelectUnitForPlayerSingle( GUI_D_P_WoodenBridge, pl )
elseif (str == "wooden bridge") then
call SelectUnitForPlayerSingle( GUI_D_P_WoodenBridge, pl )
elseif (str == "stone bridge") then
call SelectUnitForPlayerSingle( GUI_D_P_StoneBridge, pl )
elseif (str == "bridge") then
call SelectUnitForPlayerSingle( GUI_D_P_StoneBridge, pl )
elseif (str == "gate") then
call SelectUnitForPlayerSingle( GUI_D_P_Gate, pl )
elseif (str == "elvengate") then
call SelectUnitForPlayerSingle( GUI_D_P_ElvenGate, pl )
elseif (str == "elven gate") then
call SelectUnitForPlayerSingle( GUI_D_P_ElvenGate, pl )
elseif (str == "demonicgate") then
call SelectUnitForPlayerSingle( GUI_D_P_DemonicGate, pl )
elseif (str == "demonic gate") then
call SelectUnitForPlayerSingle( GUI_D_P_DemonicGate, pl )
elseif (str == "demongate") then
call SelectUnitForPlayerSingle( GUI_D_P_DemonicGate, pl )
elseif (str == "demon gate") then
call SelectUnitForPlayerSingle( GUI_D_P_DemonicGate, pl )
elseif (str == "wall") then
call SelectUnitForPlayerSingle( GUI_D_P_StoneWall, pl )
elseif (str == "stonewall") then
call SelectUnitForPlayerSingle( GUI_D_P_StoneWall, pl )
elseif (str == "stone wall") then
call SelectUnitForPlayerSingle( GUI_D_P_StoneWall, pl )
elseif (str == "line") then
call SelectUnitForPlayerSingle( GUI_D_P_Line1, pl )
elseif (str == "wallline") then
call SelectUnitForPlayerSingle( GUI_D_P_Line1, pl )
elseif (str == "wall line") then
call SelectUnitForPlayerSingle( GUI_D_P_Line1, pl )
//Colors
elseif (str == "red") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[1], pl )
elseif (str == "enemy") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[1], pl )
elseif (str == "enemies") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[1], pl )
elseif (str == "yellow") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[5], pl )
elseif (str == "ally") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[5], pl )
elseif (str == "allies") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[5], pl )
//Misc
elseif (str == "mw") then
call SelectUnitForPlayerSingle( GUI_M_Portal, pl )
elseif (str == "waygate") then
call SelectUnitForPlayerSingle( GUI_M_Portal, pl )
//Invulnerable
elseif (str == "invuln" or str == "invulon") then
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function InvulnEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
elseif (str == "vuln" or str == "invuloff") then
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function VulnEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
//Magic Immune
elseif (str == "immune" or str == "immunon") then
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function ImmuneEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
elseif (str == "mune" or str == "unimmune" or str == "immunoff") then
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function UnImmuneEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
//Hero Level
elseif SubStringBJ(str,1,5) == "level" then
//Get rid of that pesky space people like to add
if (SubStringBJ(str,6,6) == " ") then
set text = SubStringBJ(str,7,StringLength(str))
else
set text = SubStringBJ(str,6,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function HeroLevelEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
//Unit Armor Bonus
elseif SubStringBJ(str,1,5) == "armor" then
//Get rid of that pesky space people like to add
if (SubStringBJ(str,6,6) == " ") then
set text = SubStringBJ(str,7,StringLength(str))
else
set text = SubStringBJ(str,6,StringLength(str))
endif
set udg_TEMP_Integer = IMaxBJ(0, IMinBJ(500, S2I(text)))
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function BonusArmorEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
//Unit Damage Bonus
elseif SubStringBJ(str,1,6) == "damage" then
//Get rid of that pesky space people like to add
if (SubStringBJ(str,7,7) == " ") then
set text = SubStringBJ(str,8,StringLength(str))
else
set text = SubStringBJ(str,7,StringLength(str))
endif
set udg_TEMP_Integer = IMaxBJ(0, IMinBJ(500, S2I(text)))
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function BonusDamageEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
//Unit Life Bonus
elseif SubStringBJ(str,1,4) == "life" then
//Get rid of that pesky space people like to add
if (SubStringBJ(str,5,5) == " ") then
set text = SubStringBJ(str,6,StringLength(str))
else
set text = SubStringBJ(str,5,StringLength(str))
endif
set udg_TEMP_Integer = IMaxBJ(0, IMinBJ(500, S2I(text)/10))
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function BonusLifeEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
//Unit Size
elseif SubStringBJ(str,1,4) == "size" then
//Get rid of that pesky space people like to add
if (SubStringBJ(str,5,5) == " ") then
set text = SubStringBJ(str,6,StringLength(str))
else
set text = SubStringBJ(str,5,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function UnitSizeEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
//Give
elseif SubStringBJ(str,1,4) == "give" then
//Get rid of that pesky 'to' in quatredan
if (SubStringBJ(str,5,6) == "to") then
//Get rid of that pesky space people like to add
if (SubStringBJ(str,7,7) == " ") then
set text = SubStringBJ(str,8,StringLength(str))
else
set text = SubStringBJ(str,7,StringLength(str))
endif
else
//Get rid of that pesky space people like to add
if (SubStringBJ(str,5,5) == " ") then
set text = SubStringBJ(str,6,StringLength(str))
else
set text = SubStringBJ(str,5,StringLength(str))
endif
endif
set udg_TEMP_Integer = GetPlayerNumFromStr(text)
set udg_TEMP_Player = pl
set udg_TEMP_Boolean = false
if udg_TEMP_Integer == -1 then
call DisplayTextToForce( fp, " |c00FF0000Invalid Player: |r" + text )
elseif IsPlayerInForce(ConvertedPlayer(udg_TEMP_Integer), udg_Force[1]) or IsPlayerInForce(ConvertedPlayer(udg_TEMP_Integer), udg_Force[3]) then
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function GiveEnumUnitSelected )
call DestroyGroup(grp)
if udg_TEMP_Boolean then
call DisplayTextToForce( fp, " |c00FF0000Cannot give heroes to players.|r" )
endif
call DebugCommand(str,id)
else
call DisplayTextToForce( fp, " |c00FF0000Cannot give units to |r" + ColorNamePl(ConvertedPlayer(udg_TEMP_Integer)) + "|c00FF0000.|r" )
endif
//Color
elseif SubStringBJ(str,1,5) == "color" then
//Get rid of that pesky space people like to add
if (SubStringBJ(str,6,6) == " ") then
set text = SubStringBJ(str,7,StringLength(str))
else
set text = SubStringBJ(str,6,StringLength(str))
endif
set udg_TEMP_Integer = GetPlayerNumFromStrSafe(text)
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function ColorEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
//Tint
elseif SubStringBJ(str, 1, 4) == "tint" then
//Get rid of that pesky space people like to add
if (SubStringBJ(str,5,5) == " ") then
set text = SubStringBJ(str,6,StringLength(str))
else
set text = SubStringBJ(str,5,StringLength(str))
endif
set i1 = 1
set i2 = 2
loop
exitwhen GetBooleanOr(i2 > StringLength(str), SubStringBJ(text, i2, i2) == " ")
set i2 = i2 + 1
endloop
if GetBooleanOr(i2 > StringLength(str), i2 > 8) then
//dobrp can lick my nuts
set udg_TEMP_RealArray[1] = S2R(SubStringBJ(text, 1, 3))
set udg_TEMP_RealArray[2] = S2R(SubStringBJ(text, 4, 6))
set udg_TEMP_RealArray[3] = S2R(SubStringBJ(text, 7, 9))
if StringLength(str) > 9 then
set udg_TEMP_RealArray[4] = S2R(SubStringBJ(text, 10, 12))
else
set udg_TEMP_RealArray[4] = 0
endif
//so can quatredan. lazy programmers
if udg_TEMP_RealArray[1] > 100 or udg_TEMP_RealArray[2] > 100 or udg_TEMP_RealArray[3] > 100 or udg_TEMP_RealArray[4] > 100 then
set udg_TEMP_RealArray[1] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[2] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[3] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[4] = udg_TEMP_RealArray[1] * 100 / 255
endif
else
//ratios
set udg_TEMP_RealArray[1] = S2R(SubStringBJ(text, i1, i2-1)) * 100
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen GetBooleanOr(i2 > StringLength(str), SubStringBJ(text, i2, i2) == " ")
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[2] = S2R(SubStringBJ(text, i1, i2-1)) * 100
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen GetBooleanOr(i2 > StringLength(str), SubStringBJ(text, i2, i2) == " ")
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[3] = S2R(SubStringBJ(text, i1, i2-1)) * 100
if StringLength(str) > i2 then //we hit a space and there's more - alpha term
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen GetBooleanOr(i2 > StringLength(str), SubStringBJ(text, i2, i2) == " ")
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[4] = S2R(SubStringBJ(text, i1, i2-1)) * 100
else
set udg_TEMP_RealArray[4] = 0
endif
endif
set udg_TEMP_RealArray[1] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[1], 0), 100)
set udg_TEMP_RealArray[2] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[2], 0), 100)
set udg_TEMP_RealArray[3] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[3], 0), 100)
set udg_TEMP_RealArray[4] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[4], 0), 100)
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function TintEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
//Expert
elseif (str == "ka") then
set udg_TEMP_Player = pl
set grp = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroupBJ( grp, function KeepAliveEnumUnitSelected )
call DestroyGroup(grp)
call DebugCommand(str,id)
elseif (str == "control") then
call ForForce( udg_Force[1], function doSharePlayerEnumControl )
call DebugCommand(str,id)
elseif (str == "unlock") then
if pl == ConvertedPlayer(9) then
call DisableTrigger( gg_trg_Hero_Restrictor_Lock )
endif
call DebugCommand(str,id)
elseif (str == "freehero") then
if pl == ConvertedPlayer(9) then
set udg_FreeHero = true
endif
call DebugCommand(str,id)
//Unit Type
else
set utype = String2UnitIdBJ(TranslateFrom(str))
if utype == null then
//********************RETURN
return false //not a command
else
set udg_Status[id] = "unit_create"
set udg_DM_UnitType[id] = utype
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r" + ColorName(TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])), GetConvertedPlayerId(udg_DM_Player[id])) + "|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|cFFFF0000" + TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
call DisplayTextToForce( fp, " Click a tile in the Toolbox to select the owner of the new unit.")
endif
endif
//********************RETURN
return true //is a command
endfunction
function DoChatSystem takes integer id returns nothing
local player pl
local force fp
local integer chatnum
local string text
local string str
local integer i
//local unit GUI_D_P_Grove = gg_unit_n000_0123
//local unit GUI_D_P_Tree = gg_unit_n000_0124
//local unit GUI_D_P_Blight = gg_unit_n000_0125
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set str = GetEventPlayerChatString()
//call SetUnitScalePercent( GUI_D_P_Grove, S2R(str), S2R(str), S2R(str) )
//call SetUnitScalePercent( GUI_D_P_Tree, S2R(str), S2R(str), S2R(str) )
//call SetUnitScalePercent( GUI_D_P_Blight, S2R(str), S2R(str), S2R(str) )
//DoBRP Set Name
if SubStringBJ(str, 1, 7) == "setname" then
if IsANumber(SubStringBJ(str, 8, 8)) then
set chatnum = S2I(SubStringBJ(str, 8, 8))
//Get rid of that pesky space people like to add
if (SubStringBJ(str,9,9) == " ") then
set text = SubStringBJ(str,10,StringLength(str))
else
set text = SubStringBJ(str,9,StringLength(str))
endif
set udg_Names[chatnum + id*10] = text
call DisplayTextToForce( fp, "|c0000FF00Name " + I2S(chatnum) + " set to |r" + ColorName(udg_Names[chatnum + id*10],id))
else
call DisplayTextToForce( fp, "|c00FF0000This map uses the numbers 0-9 instead of symbols for character chatting.|r" )
endif
//Set Name
elseif SubStringBJ(str, 1, 3) == "set" then
if IsANumber(SubStringBJ(str, 4, 4)) then
set chatnum = S2I(SubStringBJ(str, 4, 4))
//Get rid of that pesky space people like to add
if (SubStringBJ(str,5,5) == " ") then
set text = SubStringBJ(str,6,StringLength(str))
else
set text = SubStringBJ(str,5,StringLength(str))
endif
set udg_Names[chatnum + id*10] = text
call DisplayTextToForce( fp, "|c0000FF00Name " + I2S(chatnum) + " set to |r" + ColorName(udg_Names[chatnum + id*10],id))
else
call DisplayTextToForce( fp, "|c00FF0000This map uses the numbers 0-9 instead of symbols for character chatting.|r" )
endif
//Chat Name
elseif IsANumber(SubStringBJ(str, 1, 1)) then
set chatnum = S2I(SubStringBJ(str, 1, 1))
//Get rid of that pesky space people like to add
if (SubStringBJ(str,2,2) == " ") then
set text = SubStringBJ(str,3,StringLength(str))
else
set text = SubStringBJ(str,2,StringLength(str))
endif
call DisplayTextToForce( GetPlayersAll(), ColorName(udg_Names[chatnum + id*10] + ": ",id) + text)
//Narrate (DMs Only)
elseif GetBooleanAnd(SubStringBJ(str,1,1) == "-", IsPlayerInForce(pl, udg_Force[2])) then
//Get rid of that pesky space people like to add
if (SubStringBJ(str,2,2) == " ") then
set text = SubStringBJ(str,3,StringLength(str))
else
set text = SubStringBJ(str,2,StringLength(str))
endif
call DisplayTextToForce(GetPlayersAll(), ColorName("- ", id) + text)
//OOC to All (DMs Only)
elseif GetBooleanAnd(SubStringBJ(str,1,1) == ".", IsPlayerInForce(pl, udg_Force[2])) then
//Get rid of that pesky space people like to add
if (SubStringBJ(str,2,2) == " ") then
set text = SubStringBJ(str,3,StringLength(str))
else
set text = SubStringBJ(str,2,StringLength(str))
endif
call DisplayTextToForce( GetPlayersAll(), " [" + ColorName("OOC: ",id) + text + "]")
//List Names
elseif StringCase(str, false) == "names" then
set i = 0
loop
exitwhen i > 9
if not(udg_Names[i + id*10] == null) then
call DisplayTextToForce( fp, "|c0000FF00 " + I2S(i) + " - |r" + ColorName(udg_Names[i + id*10],id))
endif
set i = i + 1
endloop
//Debug
elseif StringCase(str, false) == "debug" then
call ForForce( GetPlayersAll(), function ShowLocalDebugBoard )
elseif DoCommandEntered(id) then
//is a command - prevents from being ooc
else
//not any command whatsoever - ooc chat
if IsPlayerInForce(pl, udg_Force[2]) then
call DisplayTextToForce( udg_Force[2], " (" + ColorName("DMs: ",id) + str + ")")
else
call DisplayTextToForce( GetPlayersAll(), " [" + ColorName("OOC: ",id) + str + "]")
endif
endif
endfunction
function ChatEntered takes nothing returns nothing
local integer id
set id = GetConvertedPlayerId(GetTriggerPlayer())
//call DisplayTextToForce( GetPlayersAll(), I2S(id) )
call DoChatSystem(id)
endfunction
function InitTrig_Chat takes nothing returns nothing
local integer ip
set gg_trg_Chat = CreateTrigger( )
call TriggerAddAction( gg_trg_Chat, function ChatEntered )
//Add Event: Any Player types Any Chat Message
set ip = 1
loop
exitwhen ip > 12
call TriggerRegisterPlayerChatEvent( gg_trg_Chat, ConvertedPlayer(ip), "", false )
set ip = ip + 1
endloop
endfunction
function Trig_DebugMultiboardMake_Actions takes nothing returns nothing
call TriggerSleepAction(0)
call CreateMultiboardBJ( 4, 12, "Debug Info" )
set udg_DebugBoard = GetLastCreatedMultiboard()
set udg_DebugBoardCreated = true
call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 0, 0, true, false )
call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 0, 0, 7.00 )
call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 4, 0, 4.00 )
call MultiboardDisplayBJ( false, GetLastCreatedMultiboard() )
endfunction
//===========================================================================
function InitTrig_DebugMultiboardMake takes nothing returns nothing
set gg_trg_DebugMultiboardMake = CreateTrigger( )
call TriggerAddAction( gg_trg_DebugMultiboardMake, function Trig_DebugMultiboardMake_Actions )
endfunction
//************************************
//************************************
//********** CHAT **********
//************************************
//************************************
function DMChatEntered takes nothing returns nothing
//set udg_ChatString[GetConvertedPlayerId(GetTriggerPlayer())] = GetEventPlayerChatString()
endfunction
function ForDMChat takes nothing returns nothing
//if GetBooleanAnd(udg_ChatString[GetConvertedPlayerId(GetEnumPlayer())] != "", udg_Echo[GetConvertedPlayerId(GetEnumPlayer())]) then
// call DisplayTextToForce( GetPlayersAll(), udg_ChatString[GetConvertedPlayerId(GetEnumPlayer())] )
// set udg_ChatString[GetConvertedPlayerId(GetEnumPlayer())] = ""
//endif
//commands go here, including set1name, 1bla, -uc etc
endfunction
function MiscPoll takes nothing returns nothing
call ForForce( udg_Force[2], function ForDMChat )
endfunction
function InitTrig_OldChat takes nothing returns nothing
local integer i
local string chars
local string cur
set udg_GUI_Misc_Chat = CreateTrigger( )
call TriggerAddAction( udg_GUI_Misc_Chat, function DMChatEntered )
set i = 1
set chars = "abcdefghijklmnopqrstuvwxyx1234567890!?.,;:()*$@=+-_ "
loop
exitwhen i > 52
set cur = SubStringBJ(chars, i, i)
call TriggerRegisterPlayerChatEvent( udg_GUI_Misc_Chat, ConvertedPlayer(9), cur, false )
call TriggerRegisterPlayerChatEvent( udg_GUI_Misc_Chat, ConvertedPlayer(10), cur, false )
call TriggerRegisterPlayerChatEvent( udg_GUI_Misc_Chat, ConvertedPlayer(11), cur, false )
set i = i + 1
endloop
set udg_GUI_Misc_Poll = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( udg_GUI_Misc_Poll, 0.75 )
call TriggerAddAction( udg_GUI_Misc_Poll, function MiscPoll )
endfunction
function InitTrig_InitAbilRefs takes nothing returns nothing
local integer tot = 10
//armor
set udg_BonusAbility[1*tot + 1] = 'A01D'
set udg_BonusAbility[1*tot + 2] = 'A01C'
set udg_BonusAbility[1*tot + 3] = 'A01B'
set udg_BonusAbility[1*tot + 4] = 'A01A'
set udg_BonusAbility[1*tot + 5] = 'A019'
set udg_BonusAbility[1*tot + 6] = 'A018'
set udg_BonusAbility[1*tot + 7] = 'A017'
set udg_BonusAbility[1*tot + 8] = 'A016'
set udg_BonusAbility[1*tot + 9] = 'A015'
set udg_BonusAbility[1*tot +10] = 'A012'
//damage
set udg_BonusAbility[2*tot + 1] = 'A01H'
set udg_BonusAbility[2*tot + 2] = 'A010'
set udg_BonusAbility[2*tot + 3] = 'A01G'
set udg_BonusAbility[2*tot + 4] = 'A01F'
set udg_BonusAbility[2*tot + 5] = 'A01I'
set udg_BonusAbility[2*tot + 6] = 'A01J'
set udg_BonusAbility[2*tot + 7] = 'A01M'
set udg_BonusAbility[2*tot + 8] = 'A01K'
set udg_BonusAbility[2*tot + 9] = 'A01L'
set udg_BonusAbility[2*tot +10] = 'A014'
//life
set udg_BonusAbility[3*tot + 1] = 'A01Q'
set udg_BonusAbility[3*tot + 2] = 'A01E'
set udg_BonusAbility[3*tot + 3] = 'A01N'
set udg_BonusAbility[3*tot + 4] = 'A01O'
set udg_BonusAbility[3*tot + 5] = 'A01P'
set udg_BonusAbility[3*tot + 6] = 'A01U'
set udg_BonusAbility[3*tot + 7] = 'A01R'
set udg_BonusAbility[3*tot + 8] = 'A01S'
set udg_BonusAbility[3*tot + 9] = 'A01T'
set udg_BonusAbility[3*tot +10] = 'A013'
endfunction
//*************************
// checked for leaks
//*************************
function DoBounty takes nothing returns nothing
local integer level
local real pgold = 1.0 //probability of drop
local real pitem = 0.1 //probability of drop
local integer junk
local location loc
local location loc2
set level = GetUnitLevel(GetDyingUnit())
//call DisplayTextToForce( GetPlayersAll(), I2S(GetUnitUserData(GetDyingUnit())) )
if IsUnitTrain(GetDyingUnit()) then
//Training Room
set pgold = pgold * 0.4
set pitem = pitem * 0.4
endif
if GetRandomReal(0,1) <= pgold then
if IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) then
//set level = GetUnitPointValue(GetDyingUnit())
set level = R2I(GetUnitStateSwap(UNIT_STATE_MAX_LIFE, GetDyingUnit()) / 10)
loop
exitwhen level < 0
set junk = GetRandomInt(1,10)
set loc = GetUnitLoc(GetDyingUnit())
set loc2 = PolarProjectionBJ(loc, GetRandomReal(25,200), GetRandomReal(0,360))
call DropCoin(loc2, junk)
call RemoveLocation(loc)
call RemoveLocation(loc2)
set level = level - junk * 5
endloop
elseif IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) then
set level = GetHeroLevel(GetDyingUnit()) * 3 * 5
loop
exitwhen level < 0
set junk = GetRandomInt(1,10)
set loc = GetUnitLoc(GetDyingUnit())
set loc2 = PolarProjectionBJ(loc, GetRandomReal(25,150), GetRandomReal(0,360))
call DropCoin(loc2, junk)
call RemoveLocation(loc)
call RemoveLocation(loc2)
set level = level - junk * 5
endloop
//plain old unit - not summoned
elseif not(IsUnitType(GetTriggerUnit(), UNIT_TYPE_SUMMONED)) then
set loc = GetUnitLoc(GetDyingUnit())
call DropCoin(loc, IBigShuffle(level))
if level > 5 then
if GetRandomReal(0,1) < pitem then
call CreateItemLoc( RandomItemDrop(level), loc )
endif
endif
call RemoveLocation(loc)
endif
endif
endfunction
function InitTrig_Bounty takes nothing returns nothing
set gg_trg_Bounty = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Bounty, Player(0), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Bounty, function DoBounty )
endfunction
//this trigger just builds the constants table for
// all the item modifiers in the game.
//all MOD arrays are constants, 2d base 1 (inner size 10)
function CreateItemConstantsTable takes nothing returns nothing
//PREFIXES
set udg_MOD_P_Num = 6
//Gold Increase:
set udg_MOD_P_Name[11] = "Wealthy"
set udg_MOD_P_Name[12] = "Rich"
set udg_MOD_P_Name[13] = "Plentiful"
set udg_MOD_P_Name[14] = "Greedy"
set udg_MOD_P_Min[11] = 10
set udg_MOD_P_Max[11] = 40
set udg_MOD_P_Min[12] = 41
set udg_MOD_P_Max[12] = 80
set udg_MOD_P_Min[13] = 81
set udg_MOD_P_Max[13] = 150
set udg_MOD_P_Min[14] = 151
set udg_MOD_P_Max[14] = 250
//Drop Increase:
set udg_MOD_P_Name[21] = "Lucky"
set udg_MOD_P_Name[22] = "Lucky"
set udg_MOD_P_Name[23] = "Fortuitous"
set udg_MOD_P_Name[24] = "Fortuitous"
set udg_MOD_P_Min[21] = 5
set udg_MOD_P_Max[21] = 10
set udg_MOD_P_Min[22] = 11
set udg_MOD_P_Max[22] = 25
set udg_MOD_P_Min[23] = 26
set udg_MOD_P_Max[23] = 50
set udg_MOD_P_Min[24] = 51
set udg_MOD_P_Max[24] = 80
//Experience Rate Increase:
set udg_MOD_P_Name[31] = "Apprentice's"
set udg_MOD_P_Name[32] = "Apprentice's"
set udg_MOD_P_Name[33] = "Magus's"
set udg_MOD_P_Name[34] = "Wizard's"
set udg_MOD_P_Min[31] = 5
set udg_MOD_P_Max[31] = 10
set udg_MOD_P_Min[32] = 11
set udg_MOD_P_Max[32] = 25
set udg_MOD_P_Min[33] = 26
set udg_MOD_P_Max[33] = 50
set udg_MOD_P_Min[34] = 51
set udg_MOD_P_Max[34] = 80
//Damage Increase (%):
set udg_MOD_P_Name[41] = "Jagged"
set udg_MOD_P_Name[42] = "Brutal"
set udg_MOD_P_Name[43] = "Savage"
set udg_MOD_P_Name[44] = "Merciless"
set udg_MOD_P_Min[41] = 5
set udg_MOD_P_Max[41] = 10
set udg_MOD_P_Min[42] = 11
set udg_MOD_P_Max[42] = 25
set udg_MOD_P_Min[43] = 26
set udg_MOD_P_Max[43] = 50
set udg_MOD_P_Min[44] = 51
set udg_MOD_P_Max[44] = 80
//Damage Increase (%):
set udg_MOD_P_Name[51] = "Warrior's"
set udg_MOD_P_Name[52] = "Knight's"
set udg_MOD_P_Name[53] = "Lord's"
set udg_MOD_P_Name[54] = "King's"
set udg_MOD_P_Min[51] = 5
set udg_MOD_P_Max[51] = 10
set udg_MOD_P_Min[52] = 11
set udg_MOD_P_Max[52] = 25
set udg_MOD_P_Min[53] = 26
set udg_MOD_P_Max[53] = 50
set udg_MOD_P_Min[54] = 51
set udg_MOD_P_Max[54] = 80
//Defense Increase:
// set udg_MOD_P_Name[61] = "Sturdy"
// set udg_MOD_P_Name[62] = "Blessed"
// set udg_MOD_P_Name[63] = "Saintly"
// set udg_MOD_P_Name[64] = "Godly"
// set udg_MOD_P_Min[61] = 1
// set udg_MOD_P_Max[61] = 4
// set udg_MOD_P_Min[62] = 5
// set udg_MOD_P_Max[62] = 10
// set udg_MOD_P_Min[63] = 11
// set udg_MOD_P_Max[63] = 20
// set udg_MOD_P_Min[64] = 21
// set udg_MOD_P_Max[64] = 35
//Mana Increase:
set udg_MOD_P_Name[61] = "Lizard's"
set udg_MOD_P_Name[62] = "Serpent's"
set udg_MOD_P_Name[63] = "Drake's"
set udg_MOD_P_Name[64] = "Wyrm's"
set udg_MOD_P_Min[61] = 10
set udg_MOD_P_Max[61] = 40
set udg_MOD_P_Min[62] = 41
set udg_MOD_P_Max[62] = 80
set udg_MOD_P_Min[63] = 81
set udg_MOD_P_Max[63] = 150
set udg_MOD_P_Min[64] = 151
set udg_MOD_P_Max[64] = 250
//SUFFIXES
set udg_MOD_S_Num = 12
//Gold Increase:
set udg_MOD_S_Name[11] = "of Wealth"
set udg_MOD_S_Name[12] = "of Riches"
set udg_MOD_S_Name[13] = "of Plenty"
set udg_MOD_S_Name[14] = "of Greed"
set udg_MOD_S_Min[11] = 10
set udg_MOD_S_Max[11] = 40
set udg_MOD_S_Min[12] = 41
set udg_MOD_S_Max[12] = 80
set udg_MOD_S_Min[13] = 81
set udg_MOD_S_Max[13] = 150
set udg_MOD_S_Min[14] = 151
set udg_MOD_S_Max[14] = 250
//Drop Increase:
set udg_MOD_S_Name[21] = "of Luck"
set udg_MOD_S_Name[22] = "of Luck"
set udg_MOD_S_Name[23] = "of Fortune"
set udg_MOD_S_Name[24] = "of Fortune"
set udg_MOD_S_Min[21] = 5
set udg_MOD_S_Max[21] = 10
set udg_MOD_S_Min[22] = 11
set udg_MOD_S_Max[22] = 25
set udg_MOD_S_Min[23] = 26
set udg_MOD_S_Max[23] = 50
set udg_MOD_S_Min[24] = 51
set udg_MOD_S_Max[24] = 80
//Experience Rate Increase:
set udg_MOD_S_Name[31] = "of the Apprentice"
set udg_MOD_S_Name[32] = "of the Apprentice"
set udg_MOD_S_Name[33] = "of the Magus"
set udg_MOD_S_Name[34] = "of the Wizard"
set udg_MOD_S_Min[31] = 5
set udg_MOD_S_Max[31] = 10
set udg_MOD_S_Min[32] = 11
set udg_MOD_S_Max[32] = 25
set udg_MOD_S_Min[33] = 26
set udg_MOD_S_Max[33] = 50
set udg_MOD_S_Min[34] = 51
set udg_MOD_S_Max[34] = 80
//Damage Increase (fixed):
set udg_MOD_S_Name[41] = "of Maiming"
set udg_MOD_S_Name[42] = "of Gore"
set udg_MOD_S_Name[43] = "of Carnage"
set udg_MOD_S_Name[44] = "of Slaughter"
set udg_MOD_S_Min[41] = 1
set udg_MOD_S_Max[41] = 4
set udg_MOD_S_Min[42] = 5
set udg_MOD_S_Max[42] = 10
set udg_MOD_S_Min[43] = 11
set udg_MOD_S_Max[43] = 20
set udg_MOD_S_Min[44] = 21
set udg_MOD_S_Max[44] = 35
//Damage Increase (fixed):
set udg_MOD_S_Name[51] = "of Worth"
set udg_MOD_S_Name[52] = "of Craftsmanship"
set udg_MOD_S_Name[53] = "of Quality"
set udg_MOD_S_Name[54] = "of Excellence"
set udg_MOD_S_Min[51] = 1
set udg_MOD_S_Max[51] = 4
set udg_MOD_S_Min[52] = 5
set udg_MOD_S_Max[52] = 10
set udg_MOD_S_Min[53] = 11
set udg_MOD_S_Max[53] = 20
set udg_MOD_S_Min[54] = 21
set udg_MOD_S_Max[54] = 35
//Attack Speed Increase:
set udg_MOD_S_Name[61] = "of Readiness"
set udg_MOD_S_Name[62] = "of Alacrity"
set udg_MOD_S_Name[63] = "of Swiftness"
set udg_MOD_S_Name[64] = "of Quickness"
set udg_MOD_S_Min[61] = 5
set udg_MOD_S_Max[61] = 10
set udg_MOD_S_Min[62] = 11
set udg_MOD_S_Max[62] = 25
set udg_MOD_S_Min[63] = 26
set udg_MOD_S_Max[63] = 50
set udg_MOD_S_Min[64] = 51
set udg_MOD_S_Max[64] = 80
//Movement Speed Increase:
set udg_MOD_S_Name[71] = "of Walking"
set udg_MOD_S_Name[72] = "of Pacing"
set udg_MOD_S_Name[73] = "of Haste"
set udg_MOD_S_Name[74] = "of Speed"
set udg_MOD_S_Min[71] = 5
set udg_MOD_S_Max[71] = 10
set udg_MOD_S_Min[72] = 11
set udg_MOD_S_Max[72] = 25
set udg_MOD_S_Min[73] = 26
set udg_MOD_S_Max[73] = 50
set udg_MOD_S_Min[74] = 51
set udg_MOD_S_Max[74] = 80
//Strength Increase:
set udg_MOD_S_Name[81] = "of Strength"
set udg_MOD_S_Name[82] = "of Might"
set udg_MOD_S_Name[83] = "of the Ox"
set udg_MOD_S_Name[84] = "of the Titans"
set udg_MOD_S_Min[81] = 1
set udg_MOD_S_Max[81] = 4
set udg_MOD_S_Min[82] = 5
set udg_MOD_S_Max[82] = 10
set udg_MOD_S_Min[83] = 11
set udg_MOD_S_Max[83] = 20
set udg_MOD_S_Min[84] = 21
set udg_MOD_S_Max[84] = 35
//Agility Increase:
set udg_MOD_S_Name[91] = "of Agility"
set udg_MOD_S_Name[92] = "of Skill"
set udg_MOD_S_Name[93] = "of Accuracy"
set udg_MOD_S_Name[94] = "of Precision"
set udg_MOD_S_Min[91] = 1
set udg_MOD_S_Max[91] = 4
set udg_MOD_S_Min[92] = 5
set udg_MOD_S_Max[92] = 10
set udg_MOD_S_Min[93] = 11
set udg_MOD_S_Max[93] = 20
set udg_MOD_S_Min[94] = 21
set udg_MOD_S_Max[94] = 35
//Intelligence Increase:
set udg_MOD_S_Name[101] = "of Intelligence"
set udg_MOD_S_Name[102] = "of Wit"
set udg_MOD_S_Name[103] = "of Mind"
set udg_MOD_S_Name[104] = "of Consciousness"
set udg_MOD_S_Min[101] = 1
set udg_MOD_S_Max[101] = 4
set udg_MOD_S_Min[102] = 5
set udg_MOD_S_Max[102] = 10
set udg_MOD_S_Min[103] = 11
set udg_MOD_S_Max[103] = 20
set udg_MOD_S_Min[104] = 21
set udg_MOD_S_Max[104] = 35
//Life Increase:
set udg_MOD_S_Name[111] = "of the Jackal"
set udg_MOD_S_Name[112] = "of the Fox"
set udg_MOD_S_Name[113] = "of the Wolf"
set udg_MOD_S_Name[114] = "of the Whale"
set udg_MOD_S_Min[111] = 30
set udg_MOD_S_Max[111] = 80
set udg_MOD_S_Min[112] = 81
set udg_MOD_S_Max[112] = 150
set udg_MOD_S_Min[113] = 151
set udg_MOD_S_Max[113] = 250
set udg_MOD_S_Min[114] = 251
set udg_MOD_S_Max[114] = 400
//Mana Increase:
set udg_MOD_S_Name[121] = "of Energy"
set udg_MOD_S_Name[122] = "of Brilliance"
set udg_MOD_S_Name[123] = "of Sorcery"
set udg_MOD_S_Name[124] = "of Wizardry"
set udg_MOD_S_Min[121] = 10
set udg_MOD_S_Max[121] = 40
set udg_MOD_S_Min[122] = 41
set udg_MOD_S_Max[122] = 80
set udg_MOD_S_Min[123] = 81
set udg_MOD_S_Max[123] = 150
set udg_MOD_S_Min[124] = 151
set udg_MOD_S_Max[124] = 250
endfunction
function InitTrig_ItemConst takes nothing returns nothing
set gg_trg_ItemConst = CreateTrigger( )
call TriggerAddAction( gg_trg_ItemConst, function CreateItemConstantsTable )
endfunction
//This holds the item selection events to display item
// information in the player's leaderboard.
function GetItemValueText takes integer typ, integer value returns string
if typ > 1 then
return "Health: " + I2S(value)
else
return "Damage: " + I2S(value)
endif
endfunction
function GetItemPrefixValueText takes integer prefix, integer value returns string
local integer typ
set typ = GetArrayMega(prefix)
if typ == 0 then
return ""
elseif typ == 1 then
return "+" + I2S(value) + "% gold"
elseif typ == 2 then
return "+" + I2S(value) + "% chance to find items"
elseif typ == 3 then
return "+" + I2S(value) + "% experience rate"
elseif typ == 4 then
return "+" + I2S(value) + "% damage"
elseif typ == 5 then
return "+" + I2S(value) + "% damage"
elseif typ == 6 then
return "+" + I2S(value) + " mana"
endif
return "<unknown effect>"
endfunction
function GetItemSuffixValueText takes integer suffix, integer value returns string
local integer typ
set typ = GetArrayMega(suffix)
if typ == 0 then
return ""
elseif typ == 1 then
return "+" + I2S(value) + "% gold"
elseif typ == 2 then
return "+" + I2S(value) + "% chance to find items"
elseif typ == 3 then
return "+" + I2S(value) + "% experience rate"
elseif typ == 4 then
return "+" + I2S(value) + " damage"
elseif typ == 5 then
return "+" + I2S(value) + " damage"
elseif typ == 6 then
return "+" + I2S(value) + "% attack speed"
elseif typ == 7 then
return "+" + I2S(value) + "% movement speed"
elseif typ == 8 then
return "+" + I2S(value) + " strength"
elseif typ == 9 then
return "+" + I2S(value) + " agility"
elseif typ == 10 then
return "+" + I2S(value) + " intelligence"
elseif typ == 11 then
return "+" + I2S(value) + " life"
elseif typ == 12 then
return "+" + I2S(value) + " mana"
endif
return "<unknown effect>"
endfunction
function onItemSelectionEvent takes nothing returns nothing
local integer id = 0
local player pl
local force fp
local unit un
local integer iid
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set un = GetTriggerUnit()
if isItem(un) then
set iid = FindItemID(un)
call LeaderboardAddItemBJ( ConvertedPlayer(8), udg_Board[id], "", 0 )
if udg_ITEM_Prefix[iid] > 0 then
call LeaderboardAddItemBJ( ConvertedPlayer(9), udg_Board[id], "|c0000FFFF" + CenterText(GetItemPrefixName(udg_ITEM_Prefix[iid])) + "|r", 0 )
else
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(9), udg_Board[id] )
endif
call LeaderboardAddItemBJ( ConvertedPlayer(10), udg_Board[id], "|c00FFFFFF" + CenterText(GetItemMainName(udg_ITEM_Type[iid], udg_ITEM_SubType[iid])) + "|r", 0 )
if udg_ITEM_Suffix[iid] > 0 then
call LeaderboardAddItemBJ( ConvertedPlayer(11), udg_Board[id], "|c0000FFFF" + CenterText(GetItemSuffixName(udg_ITEM_Suffix[iid])) + "|r", 0 )
else
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(11), udg_Board[id] )
endif
call LeaderboardAddItemBJ( ConvertedPlayer(12), udg_Board[id], "", 0 )
call LeaderboardAddItemBJ( ConvertedPlayer(13), udg_Board[id], "|c00FFFFFFReq: Lvl 1, 15/15/15|r", 0 )
call LeaderboardAddItemBJ( ConvertedPlayer(14), udg_Board[id], "|c00AAAAAA" + GetItemValueText(udg_ITEM_Type[iid], udg_ITEM_Val[iid]) + "|r", 0 )
if udg_ITEM_Prefix[iid] > 0 then
call LeaderboardAddItemBJ( ConvertedPlayer(15), udg_Board[id], "|c00AAAAAA" + GetItemPrefixValueText(udg_ITEM_Prefix[iid], udg_ITEM_PrefixVal[iid]) + "", 0 )
else
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(15), udg_Board[id] )
endif
if udg_ITEM_Suffix[iid] > 0 then
call LeaderboardAddItemBJ( ConvertedPlayer(16), udg_Board[id], "|c00AAAAAA" + GetItemSuffixValueText(udg_ITEM_Suffix[iid], udg_ITEM_SuffixVal[iid]) + "", 0 )
else
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(16), udg_Board[id] )
endif
else
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(8), udg_Board[id] )
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(9), udg_Board[id] )
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(10), udg_Board[id] )
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(11), udg_Board[id] )
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(12), udg_Board[id] )
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(13), udg_Board[id] )
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(14), udg_Board[id] )
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(15), udg_Board[id] )
call LeaderboardRemovePlayerItemBJ( ConvertedPlayer(16), udg_Board[id] )
endif
endfunction
function ForItemBoardInit takes nothing returns nothing
call TriggerRegisterPlayerSelectionEventBJ( udg_ITEM_Click, GetEnumPlayer(), true )
endfunction
function InitItemBoards takes nothing returns nothing
set udg_ITEM_Click = CreateTrigger()
call TriggerAddAction(udg_ITEM_Click, function onItemSelectionEvent)
call ForForce( GetPlayersAll(), function ForItemBoardInit )
endfunction
function InitTrig_ItemBoard takes nothing returns nothing
set gg_trg_ItemBoard = CreateTrigger( )
call TriggerAddAction( gg_trg_ItemBoard, function InitItemBoards )
endfunction
function isSword takes integer t returns boolean
if t == 'I01F' then
elseif t == 'I01E' then
elseif t == 'I01G' then
elseif t == 'I01H' then
elseif t == 'I01I' then
elseif t == 'I01J' then
elseif t == 'I020' then
elseif t == 'I01W' then
elseif t == 'I021' then
elseif t == 'I01Z' then
elseif t == 'I01Y' then
elseif t == 'I01X' then
else
return false
endif
return true
endfunction
function isBolt takes integer t returns boolean
if t == 'I01L' then
elseif t == 'I01M' then
elseif t == 'I01K' then
elseif t == 'I01N' then
elseif t == 'I01O' then
elseif t == 'I01P' then
elseif t == 'I025' then
elseif t == 'I026' then
elseif t == 'I027' then
elseif t == 'I024' then
elseif t == 'I023' then
elseif t == 'I022' then
else
return false
endif
return true
endfunction
function isStaff takes integer t returns boolean
if t == 'I019' then
elseif t == 'I01A' then
elseif t == 'I017' then
elseif t == 'I01B' then
elseif t == 'I01C' then
elseif t == 'I01D' then
elseif t == 'I013' then
elseif t == 'I01S' then
elseif t == 'I01R' then
elseif t == 'I01U' then
elseif t == 'I01V' then
elseif t == 'I01T' then
else
return false
endif
return true
endfunction
function isWeapon takes integer t returns boolean
if isSword(t) then
elseif isBolt(t) then
elseif isStaff(t) then
else
return false
endif
return true
endfunction
function isLeather takes integer t returns boolean
if t == 'I00R' then
elseif t == 'I00S' then
elseif t == 'I00T' then
elseif t == 'I00U' then
elseif t == 'I00V' then
elseif t == 'I00Q' then
else
return false
endif
return true
endfunction
function isRobe takes integer t returns boolean
if t == 'I014' then
elseif t == 'I012' then
elseif t == 'I018' then
elseif t == 'I015' then
elseif t == 'I016' then
elseif t == 'I01Q' then
else
return false
endif
return true
endfunction
function isPlate takes integer t returns boolean
if t == 'I00W' then
elseif t == 'I00X' then
elseif t == 'I00Y' then
elseif t == 'I00Z' then
elseif t == 'I010' then
elseif t == 'I011' then
else
return false
endif
return true
endfunction
function isArmor takes integer t returns boolean
if isPlate(t) then
elseif isRobe(t) then
elseif isLeather(t) then
else
return false
endif
return true
endfunction
function isWarrior takes integer t returns boolean
if t == 'H001' then
elseif t == 'H008' then
elseif t == 'O000' then
elseif t == 'O001' then
elseif t == 'U003' then
elseif t == 'U001' then
elseif t == 'E004' then
elseif t == 'E006' then
elseif t == 'E001' then
elseif t == 'H00A' then
else
return false
endif
return true
endfunction
function isSpellcaster takes integer t returns boolean
if t == 'H000' then
elseif t == 'H005' then
elseif t == 'O004' then
elseif t == 'O003' then
elseif t == 'O006' then
elseif t == 'U002' then
elseif t == 'U000' then
elseif t == 'E005' then
else
return false
endif
return true
endfunction
function isRanger takes integer t returns boolean
if t == 'H009' then
elseif t == 'H007' then
elseif t == 'O002' then
elseif t == 'N005' then
elseif t == 'N004' then
elseif t == 'E003' then
else
return false
endif
return true
endfunction
function DoItemError takes string str returns nothing
call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(GetManipulatingUnit())), "|cffffcc00" + str + "|r")
endfunction
function Trig_ItemHandling_Actions takes nothing returns nothing
local integer it
local item im
local integer ut
local integer i
local boolean drop
set im = GetManipulatedItem()
set it = GetItemTypeId(GetManipulatedItem())
set ut = GetUnitTypeId(GetManipulatingUnit())
if GetItemUserData(GetManipulatedItem()) == 2 then
//spellbook being re-picked up
elseif GetItemUserData(GetManipulatedItem()) == 1 and IsPlayerInForce(GetOwningPlayer(GetManipulatingUnit()), udg_Force[1]) then
call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
//prevent heroes from giving eachother items
elseif IsPlayerInForce(GetOwningPlayer(GetManipulatingUnit()), udg_Force[3]) then
//NPC heroes can carry whatever they want
elseif isWeapon(it) then
if isWarrior(ut) and not(isSword(it)) then
if isBolt(it) then
call DoItemError("Warriors cannot carry Bolts or Arrowheads." )
else
call DoItemError("Warriors cannot carry Staffs, Wands or Spellbooks." )
endif
call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
elseif isRanger(ut) and not(isBolt(it)) then
if isSword(it) then
call DoItemError("Rangers cannot carry Swords, Axes, Mauls or Hammers." )
else
call DoItemError("Rangers cannot carry Staffs, Wands or Spellbooks." )
endif
call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
elseif isSpellcaster(ut) and not(isStaff(it)) then
if isBolt(it) then
call DoItemError("Spellcasters cannot carry Bolts or Arrowheads." )
else
call DoItemError("Spellcasters cannot carry Swords, Axes, Mauls or Hammers." )
endif
call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
else
set i = 1
loop
exitwhen i > 6
if isWeapon(GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), i))) and not(UnitItemInSlotBJ(GetManipulatingUnit(), i) == GetManipulatedItem()) then
call UnitRemoveItemFromSlotSwapped( i, GetManipulatingUnit() )
if isStaff(it) then
//fix spellbook empty bug
call SetItemUserData( im, 2 )
call UnitRemoveItemSwapped( im, GetManipulatingUnit() )
call UnitAddItemSwapped( im, GetManipulatingUnit() )
endif
call UnitDropItemSlotBJ( GetManipulatingUnit(), im, i )
call DoItemError("You may only carry one weapon at a time.")
endif
set i = i + 1
endloop
if isStaff(it) then
call TriggerSleepAction(0)
call SetItemUserData( im, 0 )
endif
endif
elseif isArmor(it) then
if isPlate(it) and isSpellcaster(ut) then
call DoItemError("Spellcasters cannot carry Plate armor." )
call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
elseif isRobe(it) and isWarrior(ut) then
call DoItemError("Warriors cannot carry Robe armor." )
call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
else
set i = 1
loop
exitwhen i > 6
if isArmor(GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), i))) and not(UnitItemInSlotBJ(GetManipulatingUnit(), i) == GetManipulatedItem()) then
call UnitRemoveItemFromSlotSwapped( i, GetManipulatingUnit() )
call UnitDropItemSlotBJ( GetManipulatingUnit(), GetManipulatedItem(), i )
call DoItemError("You may only carry one suit of armor at a time.")
endif
set i = i + 1
endloop
endif
endif
endfunction
function InitTrig_ItemHandling takes nothing returns nothing
set gg_trg_ItemHandling = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ItemHandling, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_ItemHandling, function Trig_ItemHandling_Actions )
endfunction
function Trig_ItemDropped_Copy_Conditions takes nothing returns boolean
if ( not ( GetItemUserData(GetManipulatedItem()) != 2 ) ) then
return false
endif
if ( not ( IsPlayerInForce(GetOwningPlayer(GetManipulatingUnit()), udg_Force[1]) == true ) ) then
return false
endif
return true
endfunction
function Trig_ItemDropped_Copy_Actions takes nothing returns nothing
// PREVENT PEOPLE FROM GIVING ITEMS
local item udg_TEMP_Item
set udg_TEMP_Item = GetManipulatedItem()
call SetItemUserData( udg_TEMP_Item, 1 )
call TriggerSleepAction( 0.00 )
call SetItemUserData( udg_TEMP_Item, 0 )
endfunction
//===========================================================================
function InitTrig_ItemDropped_Copy takes nothing returns nothing
set gg_trg_ItemDropped_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ItemDropped_Copy, EVENT_PLAYER_UNIT_DROP_ITEM )
call TriggerAddCondition( gg_trg_ItemDropped_Copy, Condition( function Trig_ItemDropped_Copy_Conditions ) )
call TriggerAddAction( gg_trg_ItemDropped_Copy, function Trig_ItemDropped_Copy_Actions )
endfunction
//*************************
// checked for leaks
//*************************
function DoTrainingRoomEnumUnits takes nothing returns nothing
local location loc
local location loc2
local real distance
set loc = GetUnitLoc(GetEnumUnit())
set loc2 = GetUnitLoc(udg_TRAIN_CurRoom)
set distance = DistanceBetweenPoints(loc, loc2)
call RemoveLocation(loc)
call RemoveLocation(loc2)
if GetOwningPlayer(GetEnumUnit()) == ConvertedPlayer(1) then
if GetBooleanAnd(distance > 700, distance < 1200) then
if IsKillableTrainUnit(GetEnumUnit()) then
call KillUnit(GetEnumUnit())
endif
elseif distance < 700 then
if IsCountableTrainUnit(GetEnumUnit()) then
set udg_TRAIN_CountBad = udg_TRAIN_CountBad + GetUnitLevel(GetEnumUnit())
endif
endif
else
if IsCountableTrainUnit(GetEnumUnit()) then
if (distance < 700) then
set udg_TRAIN_CountGood = udg_TRAIN_CountGood + GetUnitLevel(GetEnumUnit())
set udg_TRAIN_CountGoodTotal = udg_TRAIN_CountGoodTotal + 1
endif
endif
endif
endfunction
function GetTrainingUnitType takes nothing returns integer
local integer level
set level = R2I(I2R(udg_TRAIN_CountGood) / I2R(udg_TRAIN_CountGoodTotal))
if level < 6 then
return udg_TRAIN_Type[GetRandomInt(1, 9) + level * 10]
else
return udg_TRAIN_Type[GetRandomInt(1, 9) + IMaxBJ(IMinBJ(IShuffle((level - 5)/2 + 5),9),0) * 10]
endif
endfunction
function DoEnumTrainingRoom takes nothing returns nothing
local integer utype
local integer lvl
local location trainloc
local location loc
local group grp
set udg_TRAIN_CurRoom = GetEnumUnit()
if IsUnitAliveBJ(udg_TRAIN_CurRoom) then
set trainloc = GetUnitLoc(udg_TRAIN_CurRoom)
set udg_TRAIN_CountGood = 0
set udg_TRAIN_CountGoodTotal = 0
set udg_TRAIN_CountBad = 0
call MoveRectToLoc( gg_rct_TrainingRoom, trainloc )
set grp = GetUnitsInRectAll(gg_rct_TrainingRoom)
call ForGroupBJ( grp, function DoTrainingRoomEnumUnits )
call DestroyGroup(grp)
if udg_TRAIN_CountGood > udg_TRAIN_CountBad then
set loc = PolarProjectionBJ(trainloc, GetRandomReal(0, 600.00), GetRandomReal(0, 360.00))
call CreateNUnitsAtLoc( 1, GetTrainingUnitType(), ConvertedPlayer(1), loc, GetRandomDirectionDeg() )
call RemoveLocation(loc)
call SetUnitTrain( GetLastCreatedUnit(), true )
endif
call RemoveLocation(trainloc)
else
call GroupRemoveUnitSimple( GetEnumUnit(), udg_TRAIN_Rooms )
endif
endfunction
function TrainingRoomPoll takes nothing returns nothing
call ForGroupBJ( udg_TRAIN_Rooms, function DoEnumTrainingRoom )
endfunction
function InitTrig_Training_Room takes nothing returns nothing
set udg_TRAIN_Type[11] = 'nspb'
set udg_TRAIN_Type[12] = 'nspg'
set udg_TRAIN_Type[13] = 'ngna'
set udg_TRAIN_Type[14] = 'ngno'
set udg_TRAIN_Type[15] = 'nmrl'
set udg_TRAIN_Type[16] = 'nsty'
set udg_TRAIN_Type[17] = 'nsat'
set udg_TRAIN_Type[18] = 'nban'
set udg_TRAIN_Type[19] = 'nwiz'
set udg_TRAIN_Type[21] = 'nftr'
set udg_TRAIN_Type[22] = 'nfsp'
set udg_TRAIN_Type[23] = 'ngrk'
set udg_TRAIN_Type[24] = 'nmrr'
set udg_TRAIN_Type[25] = 'nltl'
set udg_TRAIN_Type[26] = 'nwlt'
set udg_TRAIN_Type[27] = 'nbrg'
set udg_TRAIN_Type[28] = 'nfgu'
set udg_TRAIN_Type[29] = 'ndmu'
set udg_TRAIN_Type[31] = 'nbdr'
set udg_TRAIN_Type[32] = 'nftt'
set udg_TRAIN_Type[33] = 'ngns'
set udg_TRAIN_Type[34] = 'ngnb'
set udg_TRAIN_Type[35] = 'ngnw'
set udg_TRAIN_Type[36] = 'nmrm'
set udg_TRAIN_Type[37] = 'nogr'
set udg_TRAIN_Type[38] = 'nrog'
set udg_TRAIN_Type[39] = 'nsc2'
set udg_TRAIN_Type[41] = 'nftb'
set udg_TRAIN_Type[42] = 'nfsh'
set udg_TRAIN_Type[43] = 'nfrl'
set udg_TRAIN_Type[44] = 'nfrs'
set udg_TRAIN_Type[45] = 'nsgt'
set udg_TRAIN_Type[46] = 'nwlg'
set udg_TRAIN_Type[47] = 'nowb'
set udg_TRAIN_Type[48] = 'nass'
set udg_TRAIN_Type[49] = 'nfgb'
set udg_TRAIN_Type[51] = 'ngnv'
set udg_TRAIN_Type[52] = 'nomg'
set udg_TRAIN_Type[53] = 'nogm'
set udg_TRAIN_Type[54] = 'nstl'
set udg_TRAIN_Type[55] = 'nkol'
set udg_TRAIN_Type[56] = 'nsln'
set udg_TRAIN_Type[57] = 'nslr'
set udg_TRAIN_Type[58] = 'nenf'
set udg_TRAIN_Type[59] = 'nwzg'
set udg_TRAIN_Type[61] = 'nrdr'
set udg_TRAIN_Type[62] = 'nftk'
set udg_TRAIN_Type[63] = 'ngst'
set udg_TRAIN_Type[64] = 'nsqe'
set udg_TRAIN_Type[65] = 'nthl'
set udg_TRAIN_Type[66] = 'nowe'
set udg_TRAIN_Type[67] = 'nfrb'
set udg_TRAIN_Type[68] = 'nsbm'
set udg_TRAIN_Type[69] = 'nmmu'
set udg_TRAIN_Type[71] = 'nogl'
set udg_TRAIN_Type[72] = 'nfrg'
set udg_TRAIN_Type[73] = 'nfre'
set udg_TRAIN_Type[74] = 'nhrq'
set udg_TRAIN_Type[75] = 'nrzg'
set udg_TRAIN_Type[76] = 'nslv'
set udg_TRAIN_Type[77] = 'nbld'
set udg_TRAIN_Type[78] = 'npfm'
set udg_TRAIN_Type[79] = 'nehy'
set udg_TRAIN_Type[81] = 'nfra'
set udg_TRAIN_Type[82] = 'ncnk'
set udg_TRAIN_Type[83] = 'nowk'
set udg_TRAIN_Type[84] = 'ninm'
set udg_TRAIN_Type[85] = 'ndqp'
set udg_TRAIN_Type[86] = 'nbal'
set udg_TRAIN_Type[87] = 'ninf'
set udg_TRAIN_Type[88] = 'nwzd'
set udg_TRAIN_Type[89] = 'nelb'
set udg_TRAIN_Type[91] = 'nggr'
set udg_TRAIN_Type[92] = 'nrwm'
set udg_TRAIN_Type[93] = 'nstw'
set udg_TRAIN_Type[94] = 'nsth'
set udg_TRAIN_Type[95] = 'nsgg'
set udg_TRAIN_Type[96] = 'nsll'
set udg_TRAIN_Type[97] = 'nerw'
set udg_TRAIN_Type[98] = 'nsqa'
set udg_TRAIN_Type[99] = 'nahy'
call CreateNUnitsAtLoc( 1, 'h00B', ConvertedPlayer(1), GetRectCenter(gg_rct_TrainingRoomMake), 270.00 )
call GroupAddUnitSimple( GetLastCreatedUnit(), udg_TRAIN_Rooms )
set gg_trg_Training_Room = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Training_Room, 1.00 )
call TriggerAddAction( gg_trg_Training_Room, function TrainingRoomPoll )
endfunction
function HeroSpawn takes nothing returns nothing
local integer id = 0
local player pl
local force fp
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
// if GetBooleanAnd(GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_PASSIVE), RectContainsUnit(gg_rct_HeroSelector, GetTriggerUnit())) then
// call ClearScreenForce(fp)
call CreateNUnitsAtLocFacingLocBJ( 1, GetUnitTypeId(GetTriggerUnit()), pl, GetUnitLoc(gg_unit_h006_0197), OffsetLocation(GetUnitLoc(gg_unit_h006_0197), 0, 500.00) )
// set udg_HERO_Ref[id] = GetLastCreatedUnit()
call UnitAddItemByIdSwapped( 'I001', GetLastCreatedUnit() )
call AddSpecialEffectLocBJ( GetUnitLoc(GetTriggerUnit()), "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call ResetToGameCameraForPlayer( pl, 0 )
call PanCameraToTimedLocForPlayer( pl, GetUnitLoc(gg_unit_h006_0197), 0 )
// call SetCameraTargetControllerNoZForPlayer( pl, GetLastCreatedUnit(), 0, 0, false )
set udg_HERO_Ref2[id] = GetLastCreatedUnit() //should ONLY be used for camera
if isSpellcaster(GetUnitTypeId(GetTriggerUnit())) then
call UnitAddItemByIdSwapped( 'I014', GetLastCreatedUnit() )
elseif isWarrior(GetUnitTypeId(GetTriggerUnit())) then
call UnitAddItemByIdSwapped( 'I00W', GetLastCreatedUnit() )
else
call UnitAddItemByIdSwapped( 'I00R', GetLastCreatedUnit() )
endif
if not(udg_HERO_AllowDuplicates) then
call RemoveUnit(GetTriggerUnit())
endif
if GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER) > 0 then
call AddHeroXPSwapped( GetPlayerState(pl, PLAYER_STATE_RESOURCE_LUMBER), GetLastCreatedUnit(), true )
call SetPlayerStateBJ( pl, PLAYER_STATE_RESOURCE_LUMBER, 0 )
endif
//make sure teleport sound works
call TriggerSleepAction(0)
call AddSpecialEffectLocBJ( GetUnitLoc(GetPlayerHero(id)), "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
// endif
endfunction
function HeroSelection takes nothing returns nothing
local integer id = 0
local player pl
local force fp
local real time = 15.00
local string name = ""
local string desc = ""
local string know = ""
local string lern = ""
local string utyp = ""
local string atyp = ""
local string wtyp = ""
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if GetBooleanAnd(GetPlayerHero(id) == null, GetBooleanAnd(GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_PASSIVE), RectContainsUnit(gg_rct_HeroSelector, GetTriggerUnit()))) then
if (udg_HERO_LastSel[id] == GetTriggerUnit()) then
call HeroSpawn()
else
set udg_HERO_LastSel[id] = GetTriggerUnit()
//Human
if (GetHeroProperName(GetTriggerUnit()) == "Human Swordsman") then
set name = "Human Swordsman"
set desc = "Master of the sword and close combat skills."
set know = "Defend"
set lern = "Inner Fire, Evasion, Critical Strike, Avatar"
set utyp = "Warrior"
set wtyp = "Axes, Swords, Mauls, Hammers"
set atyp = "Plate, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Dwarven Warrior") then
set name = "Dwarven Warrior"
set desc = "Brave and charismatic, especially when drinking."
set know = "Ensnare"
set lern = "Thunder Clap, Bash, Drunken Brawler, Avatar"
set utyp = "Warrior"
set wtyp = "Axes, Swords, Mauls, Hammers"
set atyp = "Plate, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Elven Archer") then
set name = "Elven Archer"
set desc = "Skilled in the art of the bow and arrow."
set know = "Cloud"
set lern = "Healing Ward, Searing Arrows, Critical Strike, Starfall"
set utyp = "Ranger"
set wtyp = "Bolts, Arrowheads"
set atyp = "Any"
elseif (GetHeroProperName(GetTriggerUnit()) == "Dwarven Rifleman") then
set name = "Dwarven Rifleman"
set desc = "A highly skilled, yet greedy sharpshooter."
set know = "Pillage"
set lern = "Cluster Rockets, Concentration, Critical Strike, Transmute"
set utyp = "Ranger"
set wtyp = "Bolts, Arrowheads"
set atyp = "Any"
elseif (GetHeroProperName(GetTriggerUnit()) == "Elven Cleric") then
set name = "Elven Cleric"
set desc = "Follower of the divine, a must for any party."
set know = "Healing Ward"
set lern = "Heal, Sleep, Auto-Blink, Tranquility"
set utyp = "Spellcaster"
set wtyp = "Staffs, Wands, Books"
set atyp = "Robes, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Human Mage") then
set name = "Human Mage"
set desc = "Casts elemental spells to devastate the enemy."
set know = "Cyclone"
set lern = "Chain Lightning, Fire Wall, Blizzard, Thunderstorm"
set utyp = "Spellcaster"
set wtyp = "Staffs, Wands, Books"
set atyp = "Robes, Leather"
//Undead
elseif (GetHeroProperName(GetTriggerUnit()) == "Skeletal Summoner") then
set name = "Skeletal Summoner"
set desc = "Raises and empowers fallen warriors."
set know = "Control Magic"
set lern = "Raise Dead, Dark Ritual, Unholy Aura, Inferno"
set utyp = "Spellcaster"
set wtyp = "Staffs, Wands, Books"
set atyp = "Robes, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Skeletal Archer") then
set name = "Skeletal Archer"
set desc = "A dexterious long-range attacker."
set know = "Lightning Shield"
set lern = "Frost Arrows, Trueshot Aura, Critical Strike, Starfall"
set utyp = "Ranger"
set wtyp = "Bolts, Arrowheads"
set atyp = "Any"
elseif (GetHeroProperName(GetTriggerUnit()) == "Undead Ranger") then
set name = "Undead Ranger"
set desc = "A cunning and manipulative hero."
set know = "Unholy Frenzy"
set lern = "Death Coil, Black Arrow, Silence, Animate Dead"
set utyp = "Ranger"
set wtyp = "Bolts, Arrowheads"
set atyp = "Any"
elseif (GetHeroProperName(GetTriggerUnit()) == "Undead Vampire") then
set name = "Undead Vampire"
set desc = "Suffers from an unquencheable thirst for blood."
set know = "Cannibalize"
set lern = "Bloodlust, Vampiric Aura, Carrion Swarm, Locust Swarm"
set utyp = "Warrior"
set wtyp = "Axes, Swords, Mauls, Hammers"
set atyp = "Plate, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Undead Banshee") then
set name = "Undead Banshee"
set desc = "Supporting spellcaster from the depths of hell."
set know = "Curse"
set lern = "Frost Nova, Howl of Terror, Auto-Blink, Apocalypse"
set utyp = "Spellcaster"
set wtyp = "Staffs, Wands, Books"
set atyp = "Robes, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Skeletal Baron") then
set name = "Skeletal Baron"
set desc = "Mindless, but sturdy brute warrior."
set know = "Ensnare"
set lern = "War Stomp, Cleaving Attack, Endurance Aura, Reincarnation"
set utyp = "Warrior"
set wtyp = "Axes, Swords, Mauls, Hammers"
set atyp = "Plate, Leather"
//Night Elf
elseif (GetHeroProperName(GetTriggerUnit()) == "Night Elf Slayer") then
set name = "Night Elf Slayer"
set desc = "Cunning hero, adept at maneuvering through battles."
set know = "Ensnare"
set lern = "Mana Burn, Immolation, Evasion, Metamorphosis"
set utyp = "Warrior"
set wtyp = "Axes, Swords, Mauls, Hammers"
set atyp = "Plate, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Ancient of Stone") then
set name = "Ancient of Stone"
set desc = "Protector of the Ancient forest."
set know = "Rejuvenation"
set lern = "Hurl Boulder, Bash, Entangling Roots, Earthquake"
set utyp = "Warrior"
set wtyp = "Axes, Swords, Mauls, Hammers"
set atyp = "Plate, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Ancient of Thunder") then
set name = "Ancient of Thunder"
set desc = "Elemental treant. caster of offensive magic."
set know = "Lightning Shield"
set lern = "Forked Lightning, Mana Shield, Brilliance Aura, Thunderstorm"
set utyp = "Spellcaster"
set wtyp = "Staffs, Wands, Books"
set atyp = "Robes, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Night Elf Archer") then
set name = "Night Elf Archer"
set desc = "Long-range defensive hero."
set know = "Healing Ward"
set lern = "Frost Arrows, Trueshot Aura, Feral Spirit, Starfall"
set utyp = "Ranger"
set wtyp = "Bolts, Arrowheads"
set atyp = "Any"
elseif (GetHeroProperName(GetTriggerUnit()) == "Night Elf Druid") then
set name = "Night Elf Druid"
set desc = "Melee shapeshifter and supporting spellcaster."
set know = "Faerie Fire"
set lern = "Healing Wave, Force of Nature, Thorns Aura, Bear Form"
set utyp = "Warrior"
set wtyp = "Axes, Swords, Mauls, Hammers"
set atyp = "Plate, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Night Elf Giant") then
set name = "Night Elf Giant"
set desc = "Massive, but reclusive forest beast."
set know = "War Club"
set lern = "Shockwave, Bash, Endurance Aura, Avatar"
set utyp = "Warrior"
set wtyp = "Axes, Swords, Mauls, Hammers"
set atyp = "Plate, Leather"
//Orc
elseif (GetHeroProperName(GetTriggerUnit()) == "Troll Ranger") then
set name = "Troll Ranger"
set desc = "Agile and versatile spear-thrower."
set know = "Healing Ward"
set lern = "Incinerate, Trueshot Aura, Critical Strike, Starfall"
set utyp = "Ranger"
set wtyp = "Bolts, Arrowheads"
set atyp = "Any"
elseif (GetHeroProperName(GetTriggerUnit()) == "Orc Samurai") then
set name = "Orc Samurai"
set desc = "Cunning hero, skilled in the art of misdirection."
set know = "Berserk"
set lern = "Wind Walk, Mirror Image, Critical Strike, Bladestorm"
set utyp = "Warrior"
set wtyp = "Axes, Swords, Mauls, Hammers"
set atyp = "Plate, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Orc Shaman") then
set name = "Orc Shaman"
set desc = "An excellent supporting spellcaster in battle."
set know = "Ensnare"
set lern = "Bloodlust, Mana Shield, Siphon Mana, Thunderstorm"
set utyp = "Spellcaster"
set wtyp = "Staffs, Wands, Books"
set atyp = "Robes, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Tauren Brute") then
set name = "Tauren Brute"
set desc = "A strong and sturdy defensive warrior."
set know = "Pulverize"
set lern = "War Stomp, Shockwave, Endurance Aura, Big Bad Voodoo"
set utyp = "Warrior"
set wtyp = "Axes, Swords, Mauls, Hammers"
set atyp = "Plate, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Orc Warlock") then
set name = "Orc Warlock"
set desc = "Fanatical sorceror, casting summons and arcane magic."
set know = "Summon Sea Elemental"
set lern = "Rain of Fire, Fire Wall, Summon Bear, Apocalypse"
set utyp = "Spellcaster"
set wtyp = "Staffs, Wands, Books"
set atyp = "Robes, Leather"
elseif (GetHeroProperName(GetTriggerUnit()) == "Troll Priest") then
set name = "Troll Priest"
set desc = "Praised and worshipped hero of the trolls."
set know = "Cripple"
set lern = "Heal, Auto-Blink, Brilliance Aura, Tranquility"
set utyp = "Spellcaster"
set wtyp = "Staffs, Wands, Books"
set atyp = "Robes, Leather"
//Other
elseif (GetHeroProperName(GetTriggerUnit()) == "") then
elseif (GetHeroProperName(GetTriggerUnit()) == "") then
endif
call DisplayTimedTextToForce( fp, time, " ")
call DisplayTimedTextToForce( fp, time, "|c0000FF00" + name + "|r (|c00ffff00" + utyp + "|r) - " + desc )
call DisplayTimedTextToForce( fp, time, "|c007777FFKnows: |r" + know )
call DisplayTimedTextToForce( fp, time, "|c007777FFLearns: |r" + lern )
call DisplayTimedTextToForce( fp, time, "|c007777FFWeapons: |r" + wtyp + " |c007777FFArmor: |r" + atyp )
endif
endif
endfunction
function InitPlayerHeroSelector takes nothing returns nothing
local integer id = 0
local player pl
local force fp
set id = GetConvertedPlayerId(GetEnumPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
//set udg_Status[id] = "none"
//set udg_ChatString[id] = ""
//set udg_HERO_Ref[id] = null
// call ClearScreenForce(fp)
call CreateFogModifierRectBJ( true, GetEnumPlayer(), FOG_OF_WAR_VISIBLE, gg_rct_HeroSelector )
call CameraSetupApplyForPlayer( true, gg_cam_HeroSelector, GetEnumPlayer(), 0 )
call TriggerRegisterPlayerSelectionEventBJ( udg_HERO_Selection, pl, true )
if GetPlayerSlotState(ConvertedPlayer(id)) == PLAYER_SLOT_STATE_PLAYING then
set udg_TEMP_Integer = udg_TEMP_Integer + 1
endif
endfunction
function HeroSelectorInit takes nothing returns nothing
local integer numplayers
set udg_HERO_Selection = CreateTrigger( )
call DisableTrigger( udg_HERO_Selection )
call TriggerAddAction( udg_HERO_Selection, function HeroSelection )
set udg_TEMP_Integer = 0
call ForForce( udg_Force[1], function InitPlayerHeroSelector )
set numplayers = udg_TEMP_Integer
set udg_TEMP_Integer = 0
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelector), function CountEnum )
if numplayers > udg_TEMP_Integer then
set udg_HERO_AllowDuplicates = true
else
set udg_HERO_AllowDuplicates = false
endif
call DisplayTextToForce( udg_Force[1], "Click a Hero to view its description." )
call DisplayTextToForce( udg_Force[1], "Click it again to select it." )
call PolledWait( 1 )
call EnableTrigger( udg_HERO_Selection )
endfunction
function InitTrig_Hero_Selector takes nothing returns nothing
set gg_trg_Hero_Selector = CreateTrigger( )
call TriggerAddAction( gg_trg_Hero_Selector, function HeroSelectorInit )
endfunction
function HeroRestrictorDoneEnum takes nothing returns nothing
if GetUnitUserData(GetEnumUnit()) == 1 then
call SetUnitVertexColorBJ( GetEnumUnit(), 100, 100, 100, 0 )
else
call RemoveUnit( GetEnumUnit() )
endif
endfunction
function HeroAllowEnum takes nothing returns nothing
call SetUnitUserData( GetEnumUnit(), 1 )
call SetUnitVertexColorBJ( GetEnumUnit(), 0.00, 100, 0.00, 0 )
endfunction
function HeroRestrictEnum takes nothing returns nothing
call SetUnitUserData( GetEnumUnit(), 0 )
call SetUnitVertexColorBJ( GetEnumUnit(), 100, 0, 0.00, 0 )
endfunction
function DMRestrictHeroSelect takes nothing returns nothing
local unit bHuman = gg_unit_n000_0283
local unit bOrc = gg_unit_n000_0282
local unit bUndead = gg_unit_n000_0285
local unit bNightElf = gg_unit_n000_0284
local unit bDone = gg_unit_n000_0286
if RectContainsLoc(gg_rct_HeroSelector, GetUnitLoc(GetTriggerUnit())) then
if GetTriggerUnit() == bDone then
call DestroyTextTagBJ( udg_HERO_ButtonText[1] )
call DestroyTextTagBJ( udg_HERO_ButtonText[2] )
call DestroyTextTagBJ( udg_HERO_ButtonText[3] )
call DestroyTextTagBJ( udg_HERO_ButtonText[4] )
call DestroyTextTagBJ( udg_HERO_ButtonText[5] )
call RemoveUnit(bHuman)
call RemoveUnit(bOrc)
call RemoveUnit(bUndead)
call RemoveUnit(bNightElf)
call RemoveUnit(bDone)
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelector), function HeroRestrictorDoneEnum )
//call GUIApplyCamForDM(Player(8))
//call CameraSetupApplyForPlayer( true, gg_cam_ZoomOutCam, Player(8), 0.0 )
call DisableTrigger( GetTriggeringTrigger() )
call DisableTrigger( gg_trg_Hero_Restrictor_Lock )
call TriggerExecute( gg_trg_Hero_Selector )
elseif GetTriggerUnit() == bHuman then
if GetUnitUserData(GetTriggerUnit()) == 1 then
call SetUnitUserData( GetTriggerUnit(), 0 )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelectorHuman), function HeroRestrictEnum )
else
call SetUnitUserData( GetTriggerUnit(), 1 )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelectorHuman), function HeroAllowEnum )
endif
elseif GetTriggerUnit() == bOrc then
if GetUnitUserData(GetTriggerUnit()) == 1 then
call SetUnitUserData( GetTriggerUnit(), 0 )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelectorOrc), function HeroRestrictEnum )
else
call SetUnitUserData( GetTriggerUnit(), 1 )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelectorOrc), function HeroAllowEnum )
endif
elseif GetTriggerUnit() == bUndead then
if GetUnitUserData(GetTriggerUnit()) == 1 then
call SetUnitUserData( GetTriggerUnit(), 0 )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelectorUndead), function HeroRestrictEnum )
else
call SetUnitUserData( GetTriggerUnit(), 1 )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelectorUndead), function HeroAllowEnum )
endif
elseif GetTriggerUnit() == bNightElf then
if GetUnitUserData(GetTriggerUnit()) == 1 then
call SetUnitUserData( GetTriggerUnit(), 0 )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelectorNightElf), function HeroRestrictEnum )
else
call SetUnitUserData( GetTriggerUnit(), 1 )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelectorNightElf), function HeroAllowEnum )
endif
else
if GetUnitUserData(GetTriggerUnit()) == 1 then
call SetUnitUserData( GetTriggerUnit(), 0 )
call SetUnitVertexColorBJ( GetTriggerUnit(), 100, 0, 0.00, 0 )
else
call SetUnitUserData( GetTriggerUnit(), 1 )
call SetUnitVertexColorBJ( GetTriggerUnit(), 0.00, 100, 0.00, 0 )
endif
endif
endif
endfunction
function InitHeroRestrictorEnum takes nothing returns nothing
call SetUnitOwner( GetEnumUnit(), Player(PLAYER_NEUTRAL_PASSIVE), false )
call SetUnitUserData( GetEnumUnit(), 1 )
if not ( GetUnitTypeId(GetEnumUnit()) == 'n000' ) then
call SetUnitVertexColorBJ( GetEnumUnit(), 0.00, 100, 0.00, 0 )
endif
endfunction
function InitHeroRestrictor takes nothing returns nothing
local unit bHuman = gg_unit_n000_0283
local unit bOrc = gg_unit_n000_0282
local unit bUndead = gg_unit_n000_0285
local unit bNightElf = gg_unit_n000_0284
local unit bDone = gg_unit_n000_0286
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelector), function InitHeroRestrictorEnum )
set udg_HERO_Restrictor = CreateTrigger( )
call TriggerAddAction( udg_HERO_Restrictor, function DMRestrictHeroSelect )
call TriggerRegisterPlayerSelectionEventBJ( udg_HERO_Restrictor, Player(8), true )
// call TriggerRegisterPlayerSelectionEventBJ( udg_HERO_Restrictor, Player(1), true )
call CreateTextTagLocBJ( "Human", GetUnitLoc(bHuman), 0, 20.00, 100, 100, 100, 0 )
set udg_HERO_ButtonText[1] = GetLastCreatedTextTag()
call CreateTextTagLocBJ( "Orc", GetUnitLoc(bOrc), 0, 20.00, 100, 100, 100, 0 )
set udg_HERO_ButtonText[2] = GetLastCreatedTextTag()
call CreateTextTagLocBJ( "Undead", GetUnitLoc(bUndead), 0, 20.00, 100, 100, 100, 0 )
set udg_HERO_ButtonText[3] = GetLastCreatedTextTag()
call CreateTextTagLocBJ( "Night Elf", GetUnitLoc(bNightElf), 0, 20.00, 100, 100, 100, 0 )
set udg_HERO_ButtonText[4] = GetLastCreatedTextTag()
call CreateTextTagLocBJ( "Done", GetUnitLoc(bDone), 0, 20.00, 100, 100, 100, 0 )
set udg_HERO_ButtonText[5] = GetLastCreatedTextTag()
call SetUnitScalePercent( bHuman, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( bOrc, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( bUndead, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( bNightElf, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( bDone, 50.00, 50.00, 50.00 )
call SetUnitVertexColorBJ( bHuman, 100, 100, 100, 100 )
call SetUnitVertexColorBJ( bOrc, 100, 100, 100, 100 )
call SetUnitVertexColorBJ( bUndead, 100, 100, 100, 100 )
call SetUnitVertexColorBJ( bNightElf, 100, 100, 100, 100 )
call SetUnitVertexColorBJ( bDone, 100, 100, 100, 100 )
endfunction
function InitTrig_Hero_Restrictor takes nothing returns nothing
set gg_trg_Hero_Restrictor = CreateTrigger( )
call TriggerAddAction( gg_trg_Hero_Restrictor, function InitHeroRestrictor )
endfunction
function Trig_Hero_Reviver_Actions takes nothing returns nothing
local integer id = 0
local player pl
local force fp
local unit un
local integer exp = 0
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set un = GetPlayerHero(id)
if GetBooleanAnd(not(un == null), udg_HERO_IsDead[id] or IsUnitDeadBJ(un)) then
if udg_DebugBoardCreated then
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, ColorName("ESC (rev)",id) )
endif
if gg_unit_h006_0197 == null then
call DisplayTextToForce( GetPlayersAll(), "ERROR: Hero Flag Null!!" )
endif
call ReviveHeroLoc( un, GetUnitLoc(gg_unit_h006_0197), true )
call DisplayTextToForce( fp, "Your death has cost you 1/5th of your experience points." )
call DisplayTextToForce( fp, "You have been revived." )
call ResetToGameCameraForPlayer( pl, 0 )
call PanCameraToTimedLocForPlayer( pl, GetUnitLoc(gg_unit_h006_0197), 0 )
set exp = GetHeroXP(un)
call SetHeroLevelBJ( un, 1, false )
call SetHeroXP(un, R2I(I2R(exp) * 0.80), false )
//note: the reviver does not depend on this;
//this is a hack to try to stop the revive bug.
set udg_HERO_IsDead[id] = false
//call UnitRemoveItemFromSlotSwapped( 1, un )
//call UnitAddItemByIdSwapped( 'tret', un )
//call UnitUseItem( un, GetLastCreatedItem() )
//call UnitAddItemSwapped( GetLastRemovedItem(), un )
if GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER) > 0 then
call AddHeroXPSwapped( GetPlayerState(pl, PLAYER_STATE_RESOURCE_LUMBER), un, false )
call SetPlayerStateBJ( pl, PLAYER_STATE_RESOURCE_LUMBER, 0 )
endif
else
if udg_DebugBoardCreated then
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, ColorName("ESC (cam)",id) )
endif
//change camera
if udg_HERO_FloatCam[id] == false then
set udg_HERO_FloatCam[id] = true
call DisplayTextToForce( fp, "|c0000FF00Camera unlocked.|r")
// call SetCameraTargetControllerNoZForPlayer( pl, null, 0, 0, false )
// call SetCameraFieldForPlayer( pl, CAMERA_FIELD_ROTATION, CameraSetupGetFieldSwap(CAMERA_FIELD_ROTATION, gg_cam_PlayerCam), 1.00 ) else
else
set udg_HERO_FloatCam[id] = false
call DisplayTextToForce( fp, "|c0000FF00Camera locked.|r")
// call SetCameraTargetControllerNoZForPlayer( pl, un, 0, 0, false )
endif
endif
if udg_DebugBoardCreated then
call PolledWait( 4.00 )
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, "" )
endif
endfunction
function InitTrig_Hero_Reviver takes nothing returns nothing
set gg_trg_Hero_Reviver = CreateTrigger( )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hero_Reviver, Player(1) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hero_Reviver, Player(2) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hero_Reviver, Player(3) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hero_Reviver, Player(5) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hero_Reviver, Player(6) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hero_Reviver, Player(7) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hero_Reviver, Player(11) )
call TriggerAddAction( gg_trg_Hero_Reviver, function Trig_Hero_Reviver_Actions )
endfunction
function Trig_Hero_Dies_Conditions takes nothing returns boolean
if ( not ( GetDyingUnit() == GetPlayerHero(GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))) ) ) then
return false
endif
return true
endfunction
function Trig_Hero_Dies_Actions takes nothing returns nothing
local integer id = 0
local player pl
local force fp
local unit un
local integer exp = 0
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set un = GetPlayerHero(id)
//note: the reviver does not depend on this;
//this is a hack to try to stop the revive bug.
set udg_HERO_IsDead[id] = true
call RemoveKeepAliveUnit(GetDyingUnit())
call DisplayTextToForce( fp, "You have died! Press |cFFFFFF00ESC|r to revive." )
endfunction
//===========================================================================
function InitTrig_Hero_Dies takes nothing returns nothing
set gg_trg_Hero_Dies = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(1), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(2), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(3), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(5), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(6), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(7), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(11), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Hero_Dies, Condition( function Trig_Hero_Dies_Conditions ) )
call TriggerAddAction( gg_trg_Hero_Dies, function Trig_Hero_Dies_Actions )
endfunction
//*************************
// checked for leaks
//*************************
function onGUIMiscClick takes nothing returns nothing
local unit GUI_Misc = gg_unit_n000_0043
local unit GUI_M_Portal = gg_unit_n000_0044
local unit GUI_M_Cinematic = gg_unit_n000_0045
local unit GUI_M_Boot = gg_unit_n000_0047
local integer i = 0
local integer i2 = 0
local integer id = 0
local player pl
local force fp
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if (GetTriggerUnit() == GUI_M_Portal) then
set udg_Status[id] = "misc_portal_source"
set udg_DM_Unit[id] = null
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFWay Gate...|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "Left click a Way Gate to deactivate it or to set its destination." )
call DisplayTextToForce( fp, "Right click the ground to create a new Way Gate." )
elseif (GetTriggerUnit() == GUI_M_Boot) then
if id == 9 then
call CameraSetupApplyForPlayer( true, gg_cam_GUI, pl, 0 )
call DisplayTextToForce( fp, "Click the colored tile in the Toolbox of the player you'd like to boot." )
set udg_Status[id] = "misc_boot"
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFBooting...|r" )
set udg_DM_UnitType[id] = 0
set udg_DM_Player[id] = ConvertedPlayer(5)
else
call DisplayTextToForce( fp, "Only the head DM may boot players." )
endif
//toolbox tile clicked
elseif IsUnitInGroup(GetTriggerUnit(), udg_GUI_Tile_Group) then
set i = 1
loop
exitwhen i > 12
if udg_GUI_Tile[i] == GetTriggerUnit() then
set i2 = i
endif
set i = i + 1
endloop
if GetBooleanAnd(udg_Status[id] == "unit_create", not(IsPlayerInForce(ConvertedPlayer(i2), udg_Force[2]))) then
set udg_DM_Player[id] = ConvertedPlayer(i2)
if udg_DM_UnitType[id] == 0 then
call CameraSetupApplyForPlayer( true, gg_cam_Palette, pl, 0 )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|cFF00FF00You have selected '|r|cFFFF0000" + ColorNamePl(ConvertedPlayer(i2)) + "|r|cFF00FF00'.|r" )
call DisplayTextToForce( fp, " Left click the type of unit you would like to create." )
// call DisplayTextToForce( fp, " Click a coloured tile in the Toolbox to select the owner of the new unit.")
// call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
else
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r" + ColorName(UnitId2StringBJ(udg_DM_UnitType[id]), GetConvertedPlayerId(udg_DM_Player[id])) + "|c00FFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|cFF00FF00You have selected '|r|c00FF0000" + ColorNamePl(ConvertedPlayer(i2)) + "|r|cFF00FF00'.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to create a '|cFFFF0000" + UnitId2StringBJ(udg_DM_UnitType[id]) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
call DisplayTextToForce( fp, " Right click to create a '|cFFFF0000" + TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
// call DisplayTextToForce( fp, " Left click a unit in the Palette to select a different unit type." )
// call DisplayTextToForce( fp, " Click a coloured tile in the Toolbox to select the owner of the new unit.")
// call DisplayTextToForce( fp, " Press |cFFFFFF00ESC|r to exit." )
endif
elseif udg_Status[id] == "unit_revive" then
if IsPlayerInForce(ConvertedPlayer(i2), udg_Force[1]) then
if not(GetPlayerSlotState(ConvertedPlayer(i2)) == PLAYER_SLOT_STATE_PLAYING) then
call DisplayTextToForce( fp, ColorNamePl(ConvertedPlayer(i2)) + " is not playing.")
elseif IsUnitDeadBJ(GetPlayerHero(i2)) then
call ReviveHeroLoc( GetPlayerHero(i2), GetUnitLoc(GetPlayerHero(i2)), true )
call DisplayTextToForce( udg_Force[2], ColorNamePl(ConvertedPlayer(i2)) + " has been revived.")
call DisplayTextToForce( bj_FORCE_PLAYER[i2-1], "You have been revived.")
else
call DisplayTextToForce( fp, ColorNamePl(ConvertedPlayer(i2)) + " is not dead!")
endif
else
call DisplayTextToForce( fp, "|c00FF0000Revival of NPC heros is not yet functional.|r")
endif
elseif udg_Status[id] == "misc_boot" then
if IsPlayerInForce(ConvertedPlayer(i2), udg_Force[3]) then
call DisplayTextToForce( fp, "You cannot boot the NPCs.")
elseif i2 == 9 then
call DisplayTextToForce( fp, "You cannot boot yourself.")
elseif not(GetPlayerSlotState(ConvertedPlayer(i2)) == PLAYER_SLOT_STATE_PLAYING) then
call DisplayTextToForce( fp, ColorNamePl(ConvertedPlayer(i2)) + " is not playing.")
else
set udg_Status[id] = "none"
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|c00FFFFFFNo Active Mode|r" )
set udg_DM_Player[id] = ConvertedPlayer(i2)
call DialogSetMessageBJ( udg_BOOT_Dialog, "Boot " + ColorNamePl(ConvertedPlayer(i2)) + "?" )
call DialogDisplayBJ( true, udg_BOOT_Dialog, pl )
endif
endif
endif
endfunction
function DMPressedEscape takes nothing returns nothing
local integer id = 0
local player pl
local force fp
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if udg_Status[id] == "none" then
call CameraSetupApplyForPlayer( true, gg_cam_GUI, pl, 0 )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "Welcome to the onscreen GUI." )
call DisplayTextToForce( fp, "Click a menu item to activate it." )
//call DisplayTextToForce( fp, " Items in |c00777777grey|r are not yet available." )
//call DisplayTextToForce( fp, " Look for them in a future release." )
else
set udg_Status[id] = "none"
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "|c0000FF00You have no current active mode.|r" )
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|c00FFFFFFNo Active Mode|r" )
endif
if udg_DebugBoardCreated then
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, ColorName("ESC",id) )
call PolledWait( 4.00 )
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, "" )
endif
endfunction
function DMMiscSelect takes nothing returns nothing
local unit GUI_Misc = gg_unit_n000_0043
local unit GUI_M_Portal = gg_unit_n000_0044
local unit GUI_M_Cinematic = gg_unit_n000_0045
local unit GUI_M_Effect = gg_unit_n000_0047
local unit GUI_M_Revive = gg_unit_n000_0047
local integer id = 0
local player pl
local force fp
local unit un
local player pu
local location loc
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set un = GetTriggerUnit()
set pu = GetOwningPlayer(un)
//call DisplayTextToForce( GetPlayersAll(), "jiggy" )
if GetBooleanAnd(udg_Status[id] == "unit_kill", GetBooleanOr(IsPlayerInForce(pu, udg_Force[1]), IsPlayerInForce(pu, udg_Force[3]))) then
call RemoveKeepAliveUnit(un)
call KillUnit( un )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
elseif GetBooleanAnd(udg_Status[id] == "unit_remove", IsPlayerInForce(pu, udg_Force[3])) then
set loc = GetUnitLoc(un)
call AddSpecialEffectLocBJ( loc, "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveLocation(loc)
if GetUnitTypeId(GetEnumUnit()) == 'h00B' then
call ClearTrainingRoomMonsters(un)
endif
call RemoveKeepAliveUnit(un)
call RemoveUnit( un )
elseif GetBooleanAnd(udg_Status[id] == "unit_side", IsPlayerInForce(pu, udg_Force[3])) then
if GetOwningPlayer( un ) == ConvertedPlayer(1) then
call SetUnitOwner( un, ConvertedPlayer(5), true )
else
call SetUnitOwner( un, ConvertedPlayer(1), true )
endif
elseif udg_Status[id] == "unit_move" then
//if is hero spawner
if (un == gg_unit_h006_0197) then
call SetUnitPositionLoc( un, udg_DM_Destination[id] )
elseif GetBooleanOr(IsPlayerInForce(pu, udg_Force[1]), IsPlayerInForce(pu, udg_Force[3])) then
set loc = GetUnitLoc(un)
call AddSpecialEffectLocBJ( loc, "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveLocation(loc)
call SetUnitPositionLoc( un, udg_DM_Destination[id] )
call RemoveGuardPosition( un )
if not(IsUnitType(GetLastCreatedUnit(), UNIT_TYPE_STRUCTURE)) then
call SetUnitAnimation( un, "birth" )
endif
call PauseUnitBJ( false, un )
set loc = GetUnitLoc(un)
call AddSpecialEffectLocBJ( loc, "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveLocation(loc)
endif
elseif udg_Status[id] == "misc_portal_source" then
if GetUnitTypeId(un) == 'nwgt' then
//we have a source
set udg_Status[id] = "misc_portal_dest"
set udg_DM_Unit[id] = un
call GUIApplyCamForDM(pl)
call WaygateActivateBJ( false, un )
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFWay Gate Link...|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "Left click a Way Gate to link it to this one." )
call DisplayTextToForce( fp, "Right click the ground to create a linking Way Gate." )
endif
elseif udg_Status[id] == "misc_portal_dest" then
if GetBooleanAnd(GetUnitTypeId(un) == 'nwgt', not(un == udg_DM_Unit[id])) then
//we have a destination
call WaygateSetDestinationLocBJ( un, GetUnitLoc(udg_DM_Unit[id]) )
call WaygateSetDestinationLocBJ( udg_DM_Unit[id], GetUnitLoc(un) )
call WaygateActivateBJ( true, un )
call WaygateActivateBJ( true, udg_DM_Unit[id] )
set udg_Status[id] = "none"
set udg_DM_Unit[id] = null
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "The two Way Gates are now linked." )
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|c00FFFFFFNo Active Mode|r" )
endif
endif
endfunction
function GUIMiscInit takes nothing returns nothing
call DialogClearBJ( udg_BOOT_Dialog )
call DialogAddButtonBJ( udg_BOOT_Dialog, "Yes" )
set udg_BOOT_DialogYes = GetLastCreatedButtonBJ()
call DialogAddButtonBJ( udg_BOOT_Dialog, "No" )
set udg_BOOT_DialogNo = GetLastCreatedButtonBJ()
endfunction
function InitTrig_Misc takes nothing returns nothing
set udg_GUI_Misc_Escape = CreateTrigger( )
call TriggerRegisterPlayerEventEndCinematic( udg_GUI_Misc_Escape, ConvertedPlayer(9) )
call TriggerRegisterPlayerEventEndCinematic( udg_GUI_Misc_Escape, ConvertedPlayer(10) )
call TriggerRegisterPlayerEventEndCinematic( udg_GUI_Misc_Escape, ConvertedPlayer(11) )
call TriggerAddAction( udg_GUI_Misc_Escape, function DMPressedEscape )
set udg_GUI_Misc_Select = CreateTrigger( )
call TriggerRegisterPlayerSelectionEventBJ( udg_GUI_Misc_Select, ConvertedPlayer(9), true )
call TriggerRegisterPlayerSelectionEventBJ( udg_GUI_Misc_Select, ConvertedPlayer(10), true )
call TriggerRegisterPlayerSelectionEventBJ( udg_GUI_Misc_Select, ConvertedPlayer(11), true )
call TriggerAddAction( udg_GUI_Misc_Select, function DMMiscSelect )
call TriggerAddAction( udg_GUI_Misc_Select, function onGUIMiscClick )
set gg_trg_Misc = CreateTrigger( )
call TriggerAddAction( gg_trg_Misc, function GUIMiscInit )
endfunction
function InitGUIDM takes nothing returns nothing
local integer id = 0
set id = GetConvertedPlayerId(GetEnumPlayer())
call CreateLeaderboardBJ( bj_FORCE_PLAYER[id-1], "Current Status" )
set udg_Board[id] = GetLastCreatedLeaderboard()
call LeaderboardSetStyleBJ( udg_Board[id], true, true, false, false )
//call LeaderboardAddItemBJ( ConvertedPlayer(1), udg_Board[id], "|c0000FF00(Echo) BLABLABLA|r", 0 )
//call LeaderboardAddItemBJ( ConvertedPlayer(2), udg_Board[id], "|c000000FFPortal: OFF|r", 0 )
//call LeaderboardAddItemBJ( ConvertedPlayer(3), udg_Board[id], "|c00FFFF00(Cinematic) BLABLABLA|r", 0 )
call LeaderboardAddItemBJ( ConvertedPlayer(4), udg_Board[id], "|c00FFFFFFNo Active Mode|r", 0 )
call LeaderboardDisplayBJ( true, udg_Board[id] )
set udg_Status[id] = "none"
//set udg_ChatString[id] = ""
set udg_DM_Player[id] = ConvertedPlayer(5)
call CreateFogModifierRectBJ( true, GetEnumPlayer(), FOG_OF_WAR_VISIBLE, GetEntireMapRect() )
call GUIApplyCamForDM(GetEnumPlayer())
endfunction
function DoGUIAnims takes nothing returns nothing
local integer i
local string GUI_Tag_Tile = "Spell Lumber Second"
//Units
local unit GUI_Units = gg_unit_n000_0001
local unit GUI_U_Create = gg_unit_n000_0002
local unit GUI_U_Kill = gg_unit_n000_0003
local unit GUI_U_Remove = gg_unit_n000_0004
local unit GUI_U_Side = gg_unit_n000_0005
local unit GUI_U_Move = gg_unit_n000_0006
local unit GUI_U_Give = gg_unit_n000_0007
local unit GUI_U_Size = gg_unit_n000_0009
local unit GUI_U_Revive = gg_unit_n000_0010
local unit GUI_U_Tint = gg_unit_n000_0011
local unit GUI_U_Tint_Invis = gg_unit_n000_0016
local unit GUI_U_Tint_White = gg_unit_n000_0017
local unit GUI_U_Tint_Yellow = gg_unit_n000_0018
local unit GUI_U_Tint_Green = gg_unit_n000_0021
local unit GUI_U_Tint_Red = gg_unit_n000_0020
local unit GUI_U_Tint_Blue = gg_unit_n000_0019
local unit GUI_U_Invincible = gg_unit_n000_0012
//Items
local unit GUI_Items = gg_unit_n000_0033
local unit GUI_I_Create = gg_unit_n000_0034
local unit GUI_I_Remove = gg_unit_n000_0035
local unit GUI_I_Move = gg_unit_n000_0036
local unit GUI_I_P_GoldPile = gg_unit_n000_0132
local unit GUI_I_P_GoldCoin = gg_unit_n000_0133
local unit GUI_I_P_PileOfRiches = gg_unit_n000_0079
//Doodads
local unit GUI_Doodads = gg_unit_n000_0037
local unit GUI_D_Create = gg_unit_n000_0038
local unit GUI_D_Remove = gg_unit_n000_0039
local unit GUI_D_Kill = gg_unit_n000_0040
local unit GUI_D_Revive = gg_unit_n000_0041
local unit GUI_D_Toggle = gg_unit_n000_0042
local unit GUI_D_P_Grove = gg_unit_n000_0123
local unit GUI_D_P_Tree = gg_unit_n000_0124
local unit GUI_D_P_Blight = gg_unit_n000_0125
local unit GUI_D_P_Dispel = gg_unit_n000_0131
local unit GUI_D_P_WoodenBridge = gg_unit_n008_0127
local unit GUI_D_P_StoneBridge = gg_unit_n009_0128
local unit GUI_D_P_Gate = gg_unit_n00G_0136
local unit GUI_D_P_ElvenGate = gg_unit_n00H_0137
local unit GUI_D_P_DemonicGate = gg_unit_n00F_0138
local unit GUI_D_P_Line1 = gg_unit_n00P_0183
local unit GUI_D_P_Line2 = gg_unit_n00P_0182
//Misc
local unit GUI_Misc = gg_unit_n000_0043
local unit GUI_M_Portal = gg_unit_n000_0044
local unit GUI_M_Cinematic = gg_unit_n000_0045
local unit GUI_M_Boot = gg_unit_n000_0047
//Toolbox
local unit GUI_Toolbox = gg_unit_n000_0048
local unit GUI_T_Tile_Blue = gg_unit_n000_0049
local unit GUI_T_Tile_Teal = gg_unit_n000_0050
local unit GUI_T_Tile_Purple = gg_unit_n000_0051
local unit GUI_T_Tile_Orange = gg_unit_n000_0052
local unit GUI_T_Tile_Green = gg_unit_n000_0053
local unit GUI_T_Tile_Pink = gg_unit_n000_0054
local unit GUI_T_Tile_Brown = gg_unit_n000_0055
local unit GUI_T_Tile_Enemy = gg_unit_n000_0056
local unit GUI_T_Tile_Ally = gg_unit_n000_0057
local unit GUI_T_Tile_Gray = gg_unit_n000_0104
local unit GUI_T_Tile_Cyan = gg_unit_n000_0179
local unit GUI_T_Tile_DarkGreen = gg_unit_n000_0207
//Units
call CreateTextTagLocBJ( "Units", GetUnitLoc(GUI_Units), 0, 17.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_Units, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Create (uc)", GetUnitLoc(GUI_U_Create), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Create, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Kill (uk/uks)", GetUnitLoc(GUI_U_Kill), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Kill, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Remove (ur/urs)", GetUnitLoc(GUI_U_Remove), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Remove, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Side (us/uss)", GetUnitLoc(GUI_U_Side), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Side, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Move (um)", GetUnitLoc(GUI_U_Move), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Move, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Give", GetUnitLoc(GUI_U_Give), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Give, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Size", GetUnitLoc(GUI_U_Size), 0, 15.00, 30, 30, 30, 0 )
call SetUnitVertexColorBJ( GUI_U_Size, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Revive", GetUnitLoc(GUI_U_Revive), 0, 15.00, 30, 30, 30, 0 )
call SetUnitVertexColorBJ( GUI_U_Revive, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Tint", GetUnitLoc(GUI_U_Tint), 0, 15.00, 30, 30, 30, 0 )
call SetUnitVertexColorBJ( GUI_U_Tint, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Invulnerable", GetUnitLoc(GUI_U_Invincible), 0, 15.00, 30, 30, 30, 0 )
call SetUnitVertexColorBJ( GUI_U_Invincible, 100, 100, 100, 100.00 )
call SetUnitAnimation(GUI_U_Tint_Invis, GUI_Tag_Tile)
call SetUnitAnimation(GUI_U_Tint_White, GUI_Tag_Tile)
call SetUnitAnimation(GUI_U_Tint_Yellow, GUI_Tag_Tile)
call SetUnitAnimation(GUI_U_Tint_Green, GUI_Tag_Tile)
call SetUnitAnimation(GUI_U_Tint_Red, GUI_Tag_Tile)
call SetUnitAnimation(GUI_U_Tint_Blue, GUI_Tag_Tile)
call SetUnitVertexColorBJ( GUI_U_Tint_Invis, 100,100,100,70 )
call SetUnitVertexColorBJ( GUI_U_Tint_Yellow, 100,100,0,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Green, 0,100,0,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Red, 100,0,0,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Blue, 0,0,100,0 )
call SetUnitScalePercent( GUI_U_Tint_Invis, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( GUI_U_Tint_White, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( GUI_U_Tint_Yellow, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( GUI_U_Tint_Green, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( GUI_U_Tint_Red, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( GUI_U_Tint_Blue, 50.00, 50.00, 50.00 )
call SetUnitVertexColorBJ( GUI_U_Tint_Invis, 30,30,30,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_White, 30,30,30,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Yellow, 30,30,30,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Green, 30,30,30,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Red, 30,30,30,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Blue, 30,30,30,0 )
call RemoveUnit(GUI_U_Tint_Invis)
call RemoveUnit(GUI_U_Tint_White)
call RemoveUnit(GUI_U_Tint_Yellow)
call RemoveUnit(GUI_U_Tint_Green)
call RemoveUnit(GUI_U_Tint_Red)
call RemoveUnit(GUI_U_Tint_Blue)
//Items
// call SetUnitAnimation(GUI_Items, GUI_Tag_Items)
// call SetUnitScalePercent( GUI_Items, 120,120,120 )
// call SetUnitVertexColorBJ( GUI_Items, 50,50,100,0 )
// // call SetUnitVertexColorBJ( GUI_Items, 30,30,30,0 )
// call SetUnitAnimation(GUI_I_Create, GUI_Tag_Create)
// // call SetUnitVertexColorBJ( GUI_I_Create, 30,30,30,0 )
// call SetUnitAnimation(GUI_I_Remove, GUI_Tag_Remove)
// // call SetUnitVertexColorBJ( GUI_I_Remove, 30,30,30,0 )
// call SetUnitAnimation(GUI_I_Move, GUI_Tag_Move)
// // call SetUnitVertexColorBJ( GUI_I_Move, 30,30,30,0 )
call CreateTextTagLocBJ( "Items", GetUnitLoc(GUI_Items), 0, 17.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_Items, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Create (ic)", GetUnitLoc(GUI_I_Create), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_I_Create, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Remove (ir)", GetUnitLoc(GUI_I_Remove), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_I_Remove, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Move", GetUnitLoc(GUI_I_Move), 0, 15.00, 30, 30, 30, 0 )
call SetUnitVertexColorBJ( GUI_I_Move, 100, 100, 100, 100.00 )
call SetUnitAnimation( GUI_I_P_GoldPile, GUI_Tag_Tile)
call SetUnitAnimation( GUI_I_P_GoldCoin, GUI_Tag_Tile)
call SetUnitAnimation( GUI_I_P_PileOfRiches, GUI_Tag_Tile)
call SetUnitVertexColorBJ( GUI_I_P_GoldPile, 100,100,100,100 )
call SetUnitVertexColorBJ( GUI_I_P_GoldCoin, 100,100,100,100 )
call SetUnitVertexColorBJ( GUI_I_P_PileOfRiches, 100,100,100,100 )
call SetUnitScalePercent( GUI_I_P_GoldPile, 200, 200, 200 )
call SetUnitScalePercent( GUI_I_P_GoldCoin, 200, 200, 200 )
call SetUnitScalePercent( GUI_I_P_PileOfRiches, 200, 200, 200 )
set i = 1
loop
exitwhen i > 40
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetRectCenter(gg_rct_PileOfRiches), GetRandomReal(5,100), GetRandomReal(0,360)), "Objects\\InventoryItems\\PotofGold\\PotofGold.mdl" )
set i = i + 1
endloop
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetRectCenter(gg_rct_PileOfRiches), GetRandomReal(5,100), GetRandomReal(0,360)), "Objects\\InventoryItems\\tomeGreen\\tomeGreen.mdl" )
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetRectCenter(gg_rct_PileOfRiches), GetRandomReal(5,100), GetRandomReal(0,360)), "Objects\\InventoryItems\\tomeRed\\tomeRed.mdl" )
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetRectCenter(gg_rct_PileOfRiches), GetRandomReal(5,100), GetRandomReal(0,360)), "Objects\\InventoryItems\\tomeBlue\\tomeBlue.mdl" )
set i = 1
loop
exitwhen i > 40
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetRectCenter(gg_rct_GoldPile), GetRandomReal(5,100), GetRandomReal(0,360)), "Objects\\InventoryItems\\PotofGold\\PotofGold.mdl" )
set i = i + 1
endloop
call AddSpecialEffectLocBJ( GetRectCenter(gg_rct_GoldCoin), "Objects\\InventoryItems\\PotofGold\\PotofGold.mdl" )
//Doodads
call CreateTextTagLocBJ( "Doodads", GetUnitLoc(GUI_Doodads), 0, 17.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_Doodads, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Create (dc)", GetUnitLoc(GUI_D_Create), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_D_Create, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Remove (dr)", GetUnitLoc(GUI_D_Remove), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_D_Remove, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Kill (dk)", GetUnitLoc(GUI_D_Kill), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_D_Kill, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Revive (dv)", GetUnitLoc(GUI_D_Revive), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_D_Revive, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Toggle (dt)", GetUnitLoc(GUI_D_Toggle), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_D_Toggle, 100, 100, 100, 100.00 )
call SetUnitAnimation( GUI_D_P_Grove, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_Tree, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_Blight, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_Dispel, GUI_Tag_Tile)
call SetUnitVertexColorBJ( GUI_D_P_Grove, 100,100,100,100 )
call SetUnitVertexColorBJ( GUI_D_P_Tree, 100,100,100,100 )
call SetUnitVertexColorBJ( GUI_D_P_Blight, 100,100,100,100 )
call SetUnitVertexColorBJ( GUI_D_P_Dispel, 100,100,100,100 )
call SetUnitScalePercent( GUI_D_P_Grove, 400, 400, 400 )
call SetUnitScalePercent( GUI_D_P_Tree, 200, 200, 200 )
call SetUnitScalePercent( GUI_D_P_Blight, 300, 300, 300 )
call SetUnitScalePercent( GUI_D_P_Dispel, 200, 200, 200 )
call AddSpecialEffectLocBJ( GetRectCenter(gg_rct_BlightDispel), "Abilities\\Spells\\NightElf\\TargetArtLumber\\TargetArtLumber.mdl" )
call SetUnitOwner( GUI_D_P_Line1, Player(PLAYER_NEUTRAL_PASSIVE), true )
call SetUnitOwner( GUI_D_P_Line2, Player(PLAYER_NEUTRAL_PASSIVE), true )
//Misc
// call SetUnitAnimation(GUI_Misc, GUI_Tag_Misc)
// call SetUnitScalePercent( GUI_Misc, 120,120,120 )
// call SetUnitVertexColorBJ( GUI_Misc, 50,50,100,0 )
// call SetUnitAnimation(GUI_M_Portal, GUI_Tag_Portal)
// call SetUnitVertexColorBJ( GUI_M_Portal, 30,30,30,0 )
// call SetUnitAnimation(GUI_M_Cinematic, GUI_Tag_Cinematic)
// call SetUnitVertexColorBJ( GUI_M_Cinematic, 30,30,30,0 )
// call SetUnitAnimation(GUI_M_Effect, GUI_Tag_Effect)
// call SetUnitVertexColorBJ( GUI_M_Effect, 30,30,30,0 )
call CreateTextTagLocBJ( "Misc", GetUnitLoc(GUI_Misc), 0, 17.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_Misc, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Waygate (mw)", GetUnitLoc(GUI_M_Portal), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_M_Portal, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Cinematic", GetUnitLoc(GUI_M_Cinematic), 0, 15.00, 30, 30, 30, 0 )
call SetUnitVertexColorBJ( GUI_M_Cinematic, 100, 100, 100, 100.00 )
call CreateTextTagLocBJ( "Boot", GetUnitLoc(GUI_M_Boot), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_M_Boot, 100, 100, 100, 100.00 )
//Toolbox
call CreateTextTagLocBJ( "Toolbox", GetUnitLoc(GUI_Toolbox), 0, 17.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_Toolbox, 100, 100, 100, 100.00 )
call SetUnitAnimation(GUI_T_Tile_Blue, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Teal, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Purple, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Orange, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Green, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Pink, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Brown, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Enemy, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Ally, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Gray, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Cyan, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_DarkGreen, GUI_Tag_Tile)
call SetUnitVertexColorBJ( GUI_T_Tile_Blue, 0,0,100,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Teal, 0,100,80,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Purple, 25,0,50,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Orange, 100,50,0,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Green, 0,100,0,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Pink, 100,30,70,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Brown, 25,15,0,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Enemy, 100,0,0,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Ally, 100,100,0,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Gray, 50,50,50,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Cyan, 50,75,100,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_DarkGreen, 5,38,25,0 )
set udg_GUI_Tile[1] = GUI_T_Tile_Enemy
set udg_GUI_Tile[5] = GUI_T_Tile_Ally
set udg_GUI_Tile[2] = GUI_T_Tile_Blue
set udg_GUI_Tile[3] = GUI_T_Tile_Teal
set udg_GUI_Tile[4] = GUI_T_Tile_Purple
set udg_GUI_Tile[6] = GUI_T_Tile_Orange
set udg_GUI_Tile[7] = GUI_T_Tile_Green
set udg_GUI_Tile[8] = GUI_T_Tile_Pink
set udg_GUI_Tile[12] = GUI_T_Tile_Brown
set udg_GUI_Tile[9] = GUI_T_Tile_Gray
set udg_GUI_Tile[10] = GUI_T_Tile_Cyan
set udg_GUI_Tile[11] = GUI_T_Tile_DarkGreen
call GroupAddUnitSimple( GUI_T_Tile_Enemy, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_Ally, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_Blue, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_Teal, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_Purple, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_Orange, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_Green, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_Pink, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_Brown, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_Gray, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_Cyan, udg_GUI_Tile_Group )
call GroupAddUnitSimple( GUI_T_Tile_DarkGreen, udg_GUI_Tile_Group )
//pointers
//set udg_GUI_Pointer_Loc[9] = GetUnitLoc(gg_unit_E000_0147)
//set udg_GUI_Pointer_Loc[10] = GetUnitLoc(gg_unit_E000_0148)
//set udg_GUI_Pointer_Loc[11] = GetUnitLoc(gg_unit_E000_0149)
call SetUnitInvulnerable( gg_unit_E000_0147, true )
call SetUnitInvulnerable( gg_unit_E000_0148, true )
call SetUnitInvulnerable( gg_unit_E000_0149, true )
//sliders
//call CreateNUnitsAtLoc( 1, 'E001', ConvertedPlayer(9), GetRectCenter(gg_rct_Slider9), bj_UNIT_FACING )
//set udg_GUI_Slider_Ref[9] = GetLastCreatedUnit()
//call CreateNUnitsAtLoc( 1, 'E001', ConvertedPlayer(10), GetRectCenter(gg_rct_Slider10), bj_UNIT_FACING )
//set udg_GUI_Slider_Ref[10] = GetLastCreatedUnit()
//call CreateNUnitsAtLoc( 1, 'E001', ConvertedPlayer(11), GetRectCenter(gg_rct_Slider11), bj_UNIT_FACING )
//set udg_GUI_Slider_Ref[11] = GetLastCreatedUnit()
//call SetUnitInvulnerable( udg_GUI_Slider_Ref[9], true )
//call SetUnitInvulnerable( udg_GUI_Slider_Ref[10], true )
//call SetUnitInvulnerable( udg_GUI_Slider_Ref[11], true )
endfunction
function Init_Create takes nothing returns nothing
call TriggerSleepAction(0)
call DoGUIAnims()
call ForForce( udg_Force[2], function InitGUIDM )
endfunction
function InitTrig_Create takes nothing returns nothing
set gg_trg_Create = CreateTrigger()
call TriggerAddAction(gg_trg_Create, function Init_Create)
endfunction
function HoldPosEnumUnit takes nothing returns nothing
call IssueImmediateOrderBJ( GetEnumUnit(), "holdposition" )
call PauseUnitBJ( true, GetEnumUnit() )
endfunction
function onGUIUnitsClick takes nothing returns nothing
//rereference items (makes it easier to program):
//Units
local unit GUI_Units = gg_unit_n000_0001
local unit GUI_U_Create = gg_unit_n000_0002
local unit GUI_U_Kill = gg_unit_n000_0003
local unit GUI_U_Remove = gg_unit_n000_0004
local unit GUI_U_Side = gg_unit_n000_0005
local unit GUI_U_Move = gg_unit_n000_0006
local unit GUI_U_Give = gg_unit_n000_0007
local unit GUI_U_Size = gg_unit_n000_0009
local unit GUI_U_Revive = gg_unit_n000_0010
local unit GUI_U_Tint = gg_unit_n000_0011
local unit GUI_U_Tint_Invis = gg_unit_n000_0016
local unit GUI_U_Tint_White = gg_unit_n000_0017
local unit GUI_U_Tint_Yellow = gg_unit_n000_0018
local unit GUI_U_Tint_Green = gg_unit_n000_0021
local unit GUI_U_Tint_Red = gg_unit_n000_0020
local unit GUI_U_Tint_Blue = gg_unit_n000_0019
local unit GUI_U_Invincible = gg_unit_n000_0012
local integer i = 0
local integer i2 = 0
local integer id = 0
local player pl
local force fp
local string typename = ""
local real x
local real xc
local real y
local real yc
local real w
local real h
local real t = 8 * 64 / 2 //town hall size half pathing
local real b = 6 * 64 / 2 //big size half pathing
local real f = 4 * 64 / 2 //four size half pathing
local real m = 3 * 64 / 2 //medium size half pathing
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if (GetTriggerUnit() == GUI_U_Create) then
//creating units
call CameraSetupApplyForPlayer( true, gg_cam_Palette, pl, 0 )
call PanCameraToTimedLocForPlayer( GetTriggerPlayer(), GetRectCenter(gg_rct_Unit_Palette), 0 )
set udg_Status[id] = "unit_create"
set udg_DM_UnitType[id] = 0
set udg_DM_Player[id] = ConvertedPlayer(1)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFCreating Units...|r" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Unit Creation mode.|r" )
call DisplayTextToForce( fp, " Click the type of unit you would like to create." )
// call DisplayTextToForce( fp, " Click a coloured tile in the Toolbox to select the owner of the new unit.")
// call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_U_Kill) then
//killing units
set udg_Status[id] = "unit_kill"
call GUIApplyCamForDM(pl)
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFKilling Units|r" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Killing mode.|r" )
call DisplayTextToForce( fp, " Left click, box-select, or group-recall units to kill them." )
call DisplayTextToForce( fp, " |cFFFF0000Be careful; you can also kill heroes!|r" )
call DisplayTextToForce( fp, " Right click to kill all NPC units in a small area (and detonate explosives)." )
call DisplayTextToForce( fp, " Issue a move order (|c00FFFF00M|r) to your pointer to also kill players." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_U_Remove) then
//removing units
set udg_Status[id] = "unit_remove"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFRemoving Units|r" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Unit Removal mode.|r" )
call DisplayTextToForce( fp, " Left click, box-select, or group-recall NPC units to remove them." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_U_Side) then
//side-switching units
set udg_Status[id] = "unit_side"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFSide-Switching Units|r" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Side-Switching mode.|r" )
call DisplayTextToForce( fp, " Left click, box-select, or group-recall NPC units to toggle their allegiance." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
// call DisplayTextToForce( fp, " |cFF4444FFFor more advanced ownership options, use the Give function.|r" )
elseif (GetTriggerUnit() == GUI_U_Move) then
//moving units
set udg_Status[id] = "unit_move"
call GUIApplyCamForDM(pl)
set udg_DM_Destination[id] = Location(0, 0)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFMoving Units...|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to set the destination point." )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Unit Movement mode.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|c00FFFF00F1|r), then right click to set the destination point." )
// call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_U_Revive) then
//reviving player heros (NOW DISABLED)
//set udg_Status[id] = "unit_revive"
//call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFReviving Heros|r" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Revival mode.|r" )
//call DisplayTextToForce( fp, " Click a coloured tile in the Toolbox to revive that player's hero.")
//palette unit clicked
elseif RectContainsUnit(gg_rct_Unit_Palette, GetTriggerUnit()) then
if (id == 9) then
set x = GetRectMinX(gg_rct_Unit_DM1_Create)
set y = GetRectMinY(gg_rct_Unit_DM1_Create)
set w = GetRectWidthBJ(gg_rct_Unit_DM1_Create)
set h = GetRectHeightBJ(gg_rct_Unit_DM1_Create)
call ForGroupBJ( GetUnitsInRectAll(gg_rct_Unit_DM1_Zone), function RemoveEnumUnit )
elseif (id == 10) then
set x = GetRectMinX(gg_rct_Unit_DM2_Create)
set y = GetRectMinY(gg_rct_Unit_DM2_Create)
set w = GetRectWidthBJ(gg_rct_Unit_DM2_Create)
set h = GetRectHeightBJ(gg_rct_Unit_DM2_Create)
call ForGroupBJ( GetUnitsInRectAll(gg_rct_Unit_DM2_Zone), function RemoveEnumUnit )
elseif (id == 11) then
set x = GetRectMinX(gg_rct_Unit_DM3_Create)
set y = GetRectMinY(gg_rct_Unit_DM3_Create)
set w = GetRectWidthBJ(gg_rct_Unit_DM3_Create)
set h = GetRectHeightBJ(gg_rct_Unit_DM3_Create)
call ForGroupBJ( GetUnitsInRectAll(gg_rct_Unit_DM3_Zone), function RemoveEnumUnit )
endif
set xc = x+w/2
set yc = y+h/2
if (GetUnitTypeId(GetTriggerUnit()) == 'hwtw' ) then //Tower
set typename = "Human Building"
call CreateNUnitsAtLoc( 1, 'hwtw', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-384, yc+4*64/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hgtw', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-256, yc+4*64/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hctw', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-128, yc+4*64/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hatw', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc, yc+4*64/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hlum', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-288, yc-64), 270.00 )
call CreateNUnitsAtLoc( 1, 'hbla', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc, yc-96), 270.00 )
call CreateNUnitsAtLoc( 1, 'halt', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+288, yc+5*64/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hhou', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+256, yc-96-64), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'htow' ) then //Town Hall
set typename = "Human Building"
call CreateNUnitsAtLoc( 1, 'htow', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-t, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'hbar', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'hars' ) then //Arcane Sanctum
set typename = "Human Building"
call CreateNUnitsAtLoc( 1, 'hars', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-b-f, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'hgra', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'harm', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b+f, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nheb' ) then //Campaign
set typename = "Human Building"
call CreateNUnitsAtLoc( 1, 'nheb', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-b, yc), 270.00 )
// call CreateNUnitsAtLoc( 1, 'hshy', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'etol' ) then //
set typename = "Night Elf Building"
call CreateNUnitsAtLoc( 1, 'etol', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'eaom', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nctl' ) then //
set typename = "Night Elf Building"
call CreateNUnitsAtLoc( 1, 'nctl', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncaw', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'eaoe' ) then //
set typename = "Night Elf Building"
call CreateNUnitsAtLoc( 1, 'eaoe', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'eaow', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'edob' ) then //
set typename = "Night Elf Building"
call CreateNUnitsAtLoc( 1, 'edob', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-f-f, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbwd', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'edos', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+f+f, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'etrp' ) then //
set typename = "Night Elf Building"
call CreateNUnitsAtLoc( 1, 'emow', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-m*3, yc-m), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncmw', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-m*3, yc+m), 270.00 )
call CreateNUnitsAtLoc( 1, 'etrp', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-m, yc-m), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncap', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-m, yc+m), 270.00 )
call CreateNUnitsAtLoc( 1, 'eate', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'unpl' ) then //
set typename = "Undead Building"
call CreateNUnitsAtLoc( 1, 'unpl', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-t, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'usep', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ugrv' ) then //
set typename = "Undead Building"
call CreateNUnitsAtLoc( 1, 'ugrv', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'uslh', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'utod' ) then //
set typename = "Undead Building"
call CreateNUnitsAtLoc( 1, 'utod', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'usap', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ubon' ) then //
set typename = "Undead Building"
call CreateNUnitsAtLoc( 1, 'ubon', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-5*64, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndmg', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+3*64, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'uzig' ) then //
set typename = "Undead Building"
call CreateNUnitsAtLoc( 1, 'uzig', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-m*3-64, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'uzg1', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-m-64, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'uzg2', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+m-64, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'uaod', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+m*2+b-64, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ogre' ) then //
set typename = "Orc Building"
call CreateNUnitsAtLoc( 1, 'ogre', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-t, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'obea', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'osld' ) then //
set typename = "Orc Building"
call CreateNUnitsAtLoc( 1, 'osld', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'otto', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'owtw' ) then //
set typename = "Orc Building"
call CreateNUnitsAtLoc( 1, 'ofor', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-m, yc+m), 270.00 )
call CreateNUnitsAtLoc( 1, 'otrb', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-3*m, yc+m), 270.00 )
call CreateNUnitsAtLoc( 1, 'owtw', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-128, yc-64), 270.00 )
call CreateNUnitsAtLoc( 1, 'npgf', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-3*m, yc-m), 270.00 )
call CreateNUnitsAtLoc( 1, 'oalt', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nntt' ) then //
set typename = "Naga Building"
call CreateNUnitsAtLoc( 1, 'nntt', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-t, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnsg', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nntg' ) then //
set typename = "Naga Building"
call CreateNUnitsAtLoc( 1, 'nnsa', Player(PLAYER_NEUTRAL_PASSIVE), Location(64+xc-160-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnad', Player(PLAYER_NEUTRAL_PASSIVE), Location(64+xc, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nntg', Player(PLAYER_NEUTRAL_PASSIVE), Location(64+xc+160+96, yc+96), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnfm', Player(PLAYER_NEUTRAL_PASSIVE), Location(64+xc+160+m, yc-128), 270.00 )
// elseif (GetUnitTypeId(GetTriggerUnit()) == '' ) then //
// set typename = ""
// call CreateNUnitsAtLoc( 1, '', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-b, yc), 270.00 )
// call CreateNUnitsAtLoc( 1, '', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
// elseif (GetUnitTypeId(GetTriggerUnit()) == '' ) then //
// set typename = ""
// call CreateNUnitsAtLoc( 1, '', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc-b, yc), 270.00 )
// call CreateNUnitsAtLoc( 1, '', Player(PLAYER_NEUTRAL_PASSIVE), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nvil' ) then //Villagers
set typename = "Villager"
call CreateNUnitsAtLoc( 1, 'nvil', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvl2', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvlw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhef', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvlk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvk2', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'h002', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'h003', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'h004', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/2), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'hfoo' ) then //Humans
set typename = "Human"
call CreateNUnitsAtLoc( 1, 'nhem', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'hhes', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'hsor', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nemi', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'hmil', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hmpr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hrif', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhea', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hpea', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hfoo', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hmtm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hspt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hhdl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'hkni', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'hmtt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/2), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ogru' ) then //Orcs
set typename = "Orc"
call CreateNUnitsAtLoc( 1, 'opeo', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ogru', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'orai', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ocat', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'okod', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'oshm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nw2w', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'owar', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'otau', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ospw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'earc' ) then //Night Elf
set typename = "Night Elf"
call CreateNUnitsAtLoc( 1, 'ewsp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'edoc', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'esen', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'emtg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ebal', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'edot', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'earc', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwat', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nssn', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'edry', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ugho' ) then //Undead
set typename = "Undead"
call CreateNUnitsAtLoc( 1, 'uaco', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ugho', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ucry', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'uabo', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'umtw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ucs3', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'unec', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'uske', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'uskm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nzom', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'n002' ) then //TownStores
set typename = "Store"
call CreateNUnitsAtLoc( 1, 'n002', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'n003', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'n001', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00B', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Hpal' ) then //Human Heroes
set typename = "Human Hero"
call CreateNUnitsAtLoc( 1, 'Hamg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hpal', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hblm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hmkg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hart', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Harf', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hapm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Huth', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hvwd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hjai', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hlgr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hant', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hgam', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Obla' ) then //Orc Heroes
set typename = "Orc Hero"
call CreateNUnitsAtLoc( 1, 'Ofar', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Obla', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Otch', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Oshd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Orex', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ogld', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nbbc', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Othr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Orkn', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Opgh', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ogrh', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/3), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Udre' ) then //Undead Heroes
set typename = "Undead Hero"
call CreateNUnitsAtLoc( 1, 'Udea', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ulic', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ucrl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Udre', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Uear', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nklj', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Usyl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nman', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ubal', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Npld', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Uwar', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Edem' ) then //Night Elf Heroes
set typename = "Night Elf Hero"
call CreateNUnitsAtLoc( 1, 'Ekee', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Edem', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Emoo', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ewar', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Emfr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Emns', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Efur', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ecen', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ekgg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Eevi', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Eill', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/3), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Ntin' ) then //Neutral Heroes
set typename = "Neutral Hero"
call CreateNUnitsAtLoc( 1, 'Nalc', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nngs', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nplh', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nbst', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nfir', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nbrn', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Npbm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ntin', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'H005' ) then //
set typename = "Human/NightElf Custom Hero"
call CreateNUnitsAtLoc( 1, 'H007', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'H000', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+1*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'H001', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'H005', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+1*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'H008', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'H009', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+1*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'E005', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'E004', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'E006', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'H00A', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'E003', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'E001', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'U003' ) then //
set typename = "Orc/Undead Custom Hero"
call CreateNUnitsAtLoc( 1, 'O001', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'O004', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+1*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'O000', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'O006', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+1*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'O002', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'O003', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+1*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'U002', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'U000', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'N004', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'N005', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'U001', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'U003', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
//********************************************************
//********************************************************
// CREEPS
//********************************************************
//********************************************************
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nspb' ) then //
set typename = "Spider"
call CreateNUnitsAtLoc( 1, 'nspr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nspg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nspb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nssp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsbm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nspd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnwa', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnwl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnwr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnws', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnwq', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nfrl' ) then //
set typename = "Furbolg"
call CreateNUnitsAtLoc( 1, 'nfrp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfpl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfps', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfpt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfpc', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfpe', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfpu', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrs', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfre', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfra', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nsqt' ) then //
set typename = "Jungle Stalker, Sasquatch, or Wendigo"
call CreateNUnitsAtLoc( 1, 'njg1', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'njga', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'njgb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsqt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsqe', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsqo', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsqa', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/3, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwna', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/3, y+h*2/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwen', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwns', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwnr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nenf' ) then //
set typename = "Bandit, Wizard or Centaur"
call CreateNUnitsAtLoc( 1, 'nban', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbrg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrog', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nass', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/7, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nenf', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/7, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbld', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/7, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwiz', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/7, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwzr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/7, y+h*2/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwzg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/7, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwzd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/7, y+h*2/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncea', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+6*w/7, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncer', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+6*w/7, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncim', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+6*w/7, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncen', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncks', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncnk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nbzk' ) then //
set typename = "Dragon"
call CreateNUnitsAtLoc( 1, 'nnht', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nndk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nndr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngrw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngdk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngrd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbzw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbzk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/5, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbzd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nadw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nadk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nadr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbdr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbdk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbwm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrdk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrdr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrwm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nitr' ) then //
set typename = "Troll"
call CreateNUnitsAtLoc( 1, 'ohun', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'odoc', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'otbr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nits', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nith', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nftr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfsp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nftt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nftb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfsp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nftk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndtr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+5*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndtp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+5*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndtt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+5*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndtb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndth', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndtw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nmrr' ) then //
set typename = "Murloc or Mur'gul"
call CreateNUnitsAtLoc( 1, 'nmrl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmrr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmrm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmpg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmfs', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmmu', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmcf', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmbg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmtw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmsn', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmrv', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmsc', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nogr' ) then //
set typename = "Ogre"
call CreateNUnitsAtLoc( 1, 'nogr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nomg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nogm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nogl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nogo', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nogn', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'noga', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ngnb' ) then //
set typename = "Gnoll, Razormane or Kobold"
call CreateNUnitsAtLoc( 1, 'ngno', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngna', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngns', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngnb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngnw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngnv', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrzt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrzs', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nqbh', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrzb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrzm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrzg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nkob', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nkog', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nkot', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nkol', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ngst' ) then //
set typename = "Golem, Infernal or Doom Guard"
call CreateNUnitsAtLoc( 1, 'ngrk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngst', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nggr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'narg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwrg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfgl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/3, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ninf', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbal', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+3*h/4), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nltl' ) then //
set typename = "Lizard or Salamander"
call CreateNUnitsAtLoc( 1, 'nltl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nthl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nstw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nslh', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndsa', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/3, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nslr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nslv', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsll', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+3*h/4), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ntrt' ) then //
set typename = "Water Beast"
call CreateNUnitsAtLoc( 1, 'ntrh', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntrs', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntrt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntrg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntrd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgn', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgh', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhyh', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhyd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nehy', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nahy', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+3*h/4), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ntks' ) then //
set typename = "Polar Beast"
call CreateNUnitsAtLoc( 1, 'ntkf', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntka', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntkh', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntkt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntkw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntks', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntkc', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nplb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nplg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmgw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmgr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmgd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmam', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmit', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmdr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nfor' ) then //
set typename = "Mutant"
call CreateNUnitsAtLoc( 1, 'nslm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nslf', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsln', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrj', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfor', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfot', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfod', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nubk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nubr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nubw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsra', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsrh', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsrn', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsrw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nsoc' ) then //
set typename = "Skeleton"
call CreateNUnitsAtLoc( 1, 'nske', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/5), 270.00 )
call CreateNUnitsAtLoc( 1, 'nskg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+3*h/5), 270.00 )
call CreateNUnitsAtLoc( 1, 'nska', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/6, y+h/5), 270.00 )
call CreateNUnitsAtLoc( 1, 'nskf', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/6, y+3*h/5), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsko', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsog', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsoc', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrvf', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrvs', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrvl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+4*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrvi', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+5*w/6, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrvd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+5*w/6, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntrv', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsrv', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrv', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nlrv', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nfgb' ) then //
set typename = "Dungeon Creep"
call CreateNUnitsAtLoc( 1, 'npfl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfel', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'npfm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ners', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nerd', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nerw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfgu', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfgb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfov', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndqn', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndqv', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndqt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndqp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndqs', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+3*h/4), 270.00 )
else
set udg_Status[id] = "unit_create"
set udg_DM_UnitType[id] = GetUnitTypeId(GetTriggerUnit())
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r" + ColorName(TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])), GetConvertedPlayerId(udg_DM_Player[id])) + "|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|cFFFF0000" + TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
call DisplayTextToForce( fp, " Click a unit in the Palette to create a different unit type." )
call DisplayTextToForce( fp, " Click a tile in the Toolbox to select the owner of the new unit.")
return
endif
call CameraSetupApplyForPlayer( true, gg_cam_Palette_2, pl, 0 )
call PanCameraToTimedLocForPlayer( pl, Location(xc, yc), 0 )
call DisplayTextToForce( fp, " Click the |c0000FF00" + typename + "|r you would like to create." )
// call DisplayTextToForce( fp, " Click a coloured tile in the Toolbox to select the owner of the new unit.")
call TriggerSleepAction(0)
call ForGroupBJ( GetUnitsInRectAll(gg_rct_Unit_DM_Zone), function HoldPosEnumUnit )
//second palette unit clicked
elseif RectContainsUnit(gg_rct_Unit_DM_Zone, GetTriggerUnit()) then
// if udg_Status[id] == "unit_create" then
set udg_Status[id] = "unit_create"
set udg_DM_UnitType[id] = GetUnitTypeId(GetTriggerUnit())
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r" + ColorName(TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])), GetConvertedPlayerId(udg_DM_Player[id])) + "|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|cFFFF0000" + TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
call DisplayTextToForce( fp, " Click a unit in the Palette to create a different unit type." )
call DisplayTextToForce( fp, " Click a tile in the Toolbox to select the owner of the new unit.")
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|cFF00FF00You have selected '|r|cFFFF0000" + UnitId2StringBJ(udg_DM_UnitType[id]) + "|r|cFF00FF00'.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to create a '|cFFFF0000" + UnitId2StringBJ(udg_DM_UnitType[id]) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
// call DisplayTextToForce( fp, " Click a unit in the Palette to select a different unit type." )
// call DisplayTextToForce( fp, " Click a coloured tile in the Toolbox to select the owner of the new unit.")
// call DisplayTextToForce( fp, " Press |cFFFFFF00ESC|r to exit." )
// endif
endif
endfunction
function ForGUIUnitsInit takes nothing returns nothing
call TriggerRegisterPlayerSelectionEventBJ( udg_GUI_Units_Click, GetEnumPlayer(), true )
endfunction
function InitUnits takes nothing returns nothing
set udg_GUI_Units_Click = CreateTrigger()
call TriggerAddAction(udg_GUI_Units_Click, function onGUIUnitsClick)
call ForForce( udg_Force[2], function ForGUIUnitsInit )
endfunction
function InitTrig_Units takes nothing returns nothing
set gg_trg_Units = CreateTrigger( )
call TriggerAddAction( gg_trg_Units, function InitUnits )
endfunction
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nitr' ) then //Trolls
set typename = "Troll"
call CreateNUnitsAtLoc( 1, 'nitr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nits', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nith', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ohun', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/8, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'odoc', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+3*w/8, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'otbk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+5*w/8, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+7*w/8, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ngst' ) then //Golem
set typename = "Golem"
call CreateNUnitsAtLoc( 1, 'ngrk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngst', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nggr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/3, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'ninf', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/2), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nfrl' ) then //Furbolg
set typename = "Furbolg"
call CreateNUnitsAtLoc( 1, 'nfrl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrs', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfre', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfra', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nowb' ) then //Wildkin
set typename = "Wildkin"
call CreateNUnitsAtLoc( 1, 'nowb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nowe', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nowk', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/2), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit ()) == 'nogr' ) then //Ogres
set typename = "Ogre"
call CreateNUnitsAtLoc( 1, 'nogr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nomg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/3, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nogm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+2*w/3, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nogl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h/2), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nspb' ) then //Spiders
set typename = "Spider"
call CreateNUnitsAtLoc( 1, 'nspb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nspg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nspr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nssp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgt', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsbm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nmrl' ) then //Murloc
set typename = "Murloc"
call CreateNUnitsAtLoc( 1, 'nmrl', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmrr', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmrm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmpg', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmfs', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmmu', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ngnb' ) then //Gnolls
set typename = "Gnoll"
call CreateNUnitsAtLoc( 1, 'ngna', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngno', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngns', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngnb', Player(PLAYER_NEUTRAL_PASSIVE), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngnw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngnv', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'hwtw' ) then //Towers
set typename = "Tower"
call CreateNUnitsAtLoc( 1, 'hwtw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2-192, y+h/2-96), 270.00 )
call CreateNUnitsAtLoc( 1, 'hgtw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y+h/2-96), 270.00 )
call CreateNUnitsAtLoc( 1, 'hctw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2+192, y+h/2-96), 270.00 )
call CreateNUnitsAtLoc( 1, 'owtw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2-192, y+h/2+96), 270.00 )
call CreateNUnitsAtLoc( 1, 'etrp', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2, y+h/2+96), 270.00 )
call CreateNUnitsAtLoc( 1, 'hatw', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2+192, y+h/2+96), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'hhou' ) then //Farms
set typename = "Farm"
call CreateNUnitsAtLoc( 1, 'hhou', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2-192-96, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nefm', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2-96, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfv2', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2+96, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'npgf', Player(PLAYER_NEUTRAL_PASSIVE), Location(x+w/2+96+192, y+h/2), 270.00 )
function ClearItemsPtEnum takes nothing returns nothing
call RemoveItem( GetEnumItem() )
endfunction
function ClearItemsPt takes location pt returns nothing
call EnumItemsInRectBJ( RectFromCenterSizeBJ(pt, 500.00, 500.00), function ClearItemsPtEnum )
endfunction
function ClearExplosivesPtEnum takes nothing returns nothing
if GetItemTypeId(GetEnumItem()) == 'I00O' then
call AddSpecialEffectLocBJ(GetItemLoc(GetEnumItem()), "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveItem( GetEnumItem() )
endif
endfunction
function ClearExplosivesPt takes location pt returns nothing
call EnumItemsInRectBJ( RectFromCenterSizeBJ(pt, 650.00, 650.00), function ClearExplosivesPtEnum )
endfunction
function ClearExplosivesPtSmall takes location pt returns nothing
call EnumItemsInRectBJ( RectFromCenterSizeBJ(pt, 350.00, 350.00), function ClearExplosivesPtEnum )
endfunction
function KillNPCEnum takes nothing returns nothing
if IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3]) then
call KillUnit( GetEnumUnit() )
endif
endfunction
function KillUnitEnum takes nothing returns nothing
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1])) then
call KillUnit( GetEnumUnit() )
endif
endfunction
function DoodadRestoreLife takes nothing returns nothing
// if IsBridge(GetEnumDestructable()) then
// call ShowDestructableBJ( true, GetEnumDestructable() )
// endif
// call DestructableRestoreLife( GetEnumDestructable(), GetDestructableMaxLife(GetEnumDestructable()), true)
if not(IsBridge(GetEnumDestructable())) then
call DestructableRestoreLife( GetEnumDestructable(), GetDestructableMaxLife(GetEnumDestructable()), true)
endif
endfunction
function DoodadKill takes nothing returns nothing
local integer i
if GetBooleanAnd(IsBridge(GetEnumDestructable()), IsDestructableAliveBJ(GetEnumDestructable())) then
set i = 1
loop
exitwhen i > 15
//yay locleaks
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetDestructableLoc(GetEnumDestructable()), GetRandomReal(100,450), GetRandomReal(0,360)), "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
set i = i + 1
endloop
endif
call KillDestructable( GetEnumDestructable() )
endfunction
function DoodadRemove takes nothing returns nothing
if IsBridge(GetEnumDestructable()) then
call KillDestructable( GetEnumDestructable() )
call ShowDestructableBJ( false, GetEnumDestructable() )
else
call RemoveDestructable( GetEnumDestructable() )
endif
endfunction
//EVENT HANDLERS FOR POINTER
function OnPointerSmart takes location pt, player pl, boolean isunit returns nothing
local integer id = 0
local force fp
local location loc
local location loc2
local integer dt
local integer goldleft
local integer junk
local group grp
local unit GUI_D_P_Gate = gg_unit_n00G_0136
local unit GUI_D_P_ElvenGate = gg_unit_n00H_0137
local unit GUI_D_P_DemonicGate = gg_unit_n00F_0138
local unit GUI_D_P_StoneWall = gg_unit_n00O_0164
local unit GUI_D_P_Line1 = gg_unit_n00P_0183
set id = GetConvertedPlayerId(pl)
set fp = bj_FORCE_PLAYER[id-1]
if not(RectContainsLoc(gg_rct_DMarea, pt)) then
//UNITS
if GetBooleanAnd(udg_Status[id] == "unit_create", udg_DM_UnitType[id] != 0) then
if udg_DM_UnitType[id] == 'n001' then
//New Rejuv Fountain
call CreateNUnitsAtLoc( 1, udg_DM_UnitType[id], ConvertedPlayer(5), pt, bj_UNIT_FACING )
call GroupAddUnitSimple( GetLastCreatedUnit(), udg_MISC_Fountains )
set loc = GetUnitLoc(GetLastCreatedUnit())
call AddSpecialEffectLocBJ( loc, "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveLocation(loc)
elseif udg_DM_UnitType[id] == 'h00B' then
//New Training Room
call CreateNUnitsAtLoc( 1, udg_DM_UnitType[id], ConvertedPlayer(1), pt, 270.00 )
call GroupAddUnitSimple( GetLastCreatedUnit(), udg_TRAIN_Rooms )
else
if GetBooleanAnd(IsUnitIdType(udg_DM_UnitType[id], UNIT_TYPE_HERO), IsPlayerInForce(udg_DM_Player[id], udg_Force[1])) then
call DisplayTextToForce( fp, " |c00FF0000Cannot create heroes for players.|r" )
else
call CreateNUnitsAtLoc( 1, udg_DM_UnitType[id], udg_DM_Player[id], pt, bj_UNIT_FACING )
call RemoveGuardPosition( GetLastCreatedUnit() )
if not(IsUnitType(GetLastCreatedUnit(), UNIT_TYPE_STRUCTURE)) then
call SetUnitAnimation( GetLastCreatedUnit(), "birth" )
call SetUnitFacingTimed( GetLastCreatedUnit(), GetRandomDirectionDeg(), 0 )
endif
//cast spell
if not(isShop(udg_DM_UnitType[id])) and IsPlayerInForce(udg_DM_Player[id], udg_Force[3]) then
call UnitAddAbilityBJ( 'A03N', GetLastCreatedUnit() )
endif
set loc = GetUnitLoc(GetLastCreatedUnit())
call AddSpecialEffectLocBJ( loc, "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveLocation(loc)
if udg_DM_UnitType[id] == 'ngol' then
//New Gold Mine
call SetResourceAmount( GetLastCreatedUnit(), 99999999 )
endif
endif
endif
elseif udg_Status[id] == "unit_move" then
call RemoveLocation(udg_DM_Destination[id])
set udg_DM_Destination[id] = pt
call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You have selected |r(" + I2S(R2I(GetLocationX(pt))) + "," + I2S(R2I(GetLocationY(pt))) + ")|c0000FF00.|r" )
call DisplayTextToForce( fp, " Left click, box-select, or group-recall units to move them to (" + I2S(R2I(GetLocationX(pt))) + "," + I2S(R2I(GetLocationY(pt))) + ")." )
// call DisplayTextToForce( fp, " Select your Pointer (|c00FFFF00F1|r), then right click to set a new destination point." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif udg_Status[id] == "unit_kill" then
set grp = GetUnitsInRectAll(RectFromCenterSizeBJ(pt, 600.00, 600.00))
call ForGroupBJ(grp, function KillNPCEnum )
call DestroyGroup(grp)
call ClearExplosivesPtSmall(pt)
//DOODADS
elseif udg_Status[id] == "doodad_create" then
if udg_DM_SubType[id] == "grove" then
call DoodadFillArea(RectFromCenterSizeBJ(pt, 700.00, 700.00), true)
elseif udg_DM_SubType[id] == "tree" then
set dt = GetDoodadTypeAtPT(pt)
call CreateDestructableLoc( dt, pt, GetRandomDirectionDeg(), 1, GetDoodadVariation(dt) )
call KillDestructable( GetLastCreatedDestructable() )
call DestructableRestoreLife( GetLastCreatedDestructable(), GetDestructableMaxLife(GetLastCreatedDestructable()), true )
elseif udg_DM_SubType[id] == "blight" then
call SetBlightRadiusLocBJ( true, Player(0), pt, 800.00 )
elseif udg_DM_SubType[id] == "dispel" then
call SetBlightRadiusLocBJ( false, Player(0), pt, 1000.00 )
elseif udg_DM_SubType[id] == "woodenbridge" then
if MakeBridge(0,pt) == -1 then
call DisplayTextToForce( fp, "|c00FF0000Could not create a bridge here.|r Click closer to a deep river." )
endif
elseif udg_DM_SubType[id] == "stonebridge" then
if MakeBridge(1,pt) == -1 then
call DisplayTextToForce( fp, "|c00FF0000Could not create a bridge here.|r Right click closer to a deep river." )
endif
elseif GetBooleanOr(udg_DM_SubType[id] == "gate" or udg_DM_SubType[id] == "wall", udg_DM_SubType[id] == "elvengate" or udg_DM_SubType[id] == "demonicgate") then
set udg_Status[id] = "doodad_create_target"
set udg_DM_DoodPt[id] = pt
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to set the facing of the new '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
call DisplayTextToForce( fp, " (The new '|c0000FF00" + udg_DM_SubType[id] + "|r' will face where you right click.)" )
elseif udg_DM_SubType[id] == "line" then
set udg_Status[id] = "doodad_create_target"
set udg_DM_DoodPt[id] = pt
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at the other end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' of walls." )
endif
elseif udg_Status[id] == "doodad_create_target" then
if udg_DM_SubType[id] == "gate" then
call MakeGate(udg_DM_DoodPt[id], 1, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_Gate, pl )
elseif udg_DM_SubType[id] == "elvengate" then
call MakeGate(udg_DM_DoodPt[id], 2, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_ElvenGate, pl )
elseif udg_DM_SubType[id] == "demonicgate" then
call MakeGate(udg_DM_DoodPt[id], 3, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_DemonicGate, pl )
elseif udg_DM_SubType[id] == "wall" then
call MakeWall(udg_DM_DoodPt[id], 1, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_StoneWall, pl )
elseif udg_DM_SubType[id] == "line" then
call DrawWallLine(udg_DM_DoodPt[id], pt)
call SelectUnitForPlayerSingle( GUI_D_P_Line1, pl )
endif
elseif udg_Status[id] == "doodad_remove" then
call EnumDestructablesInCircleBJ( 350.00, pt, function DoodadRemove )
elseif udg_Status[id] == "doodad_kill" then
call EnumDestructablesInCircleBJ( 350.00, pt, function DoodadKill )
call ClearExplosivesPt(pt)
elseif udg_Status[id] == "doodad_revive" then
call EnumDestructablesInCircleBJ( 375.00, pt, function DoodadRestoreLife )
elseif udg_Status[id] == "doodad_open" then
call ModifyGateBJ( bj_GATEOPERATION_OPEN, FindNearbyGate(pt) )
set udg_Status[id] = "doodad_close"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFClosing Gates|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a gate to close it." )
elseif udg_Status[id] == "doodad_close" then
call ModifyGateBJ( bj_GATEOPERATION_CLOSE, FindNearbyGate(pt) )
set udg_Status[id] = "doodad_open"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFOpening Gates|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a gate to open it." )
//ITEMS
elseif udg_Status[id] == "item_create" then
if udg_DM_SubType[id] == "riches" then
set goldleft = 475
loop
exitwhen goldleft < 0
set junk = GetRandomInt(1,10)
set loc = PolarProjectionBJ(pt, GetRandomReal(25,150), GetRandomReal(0,360))
call DropCoin(loc, junk)
call RemoveLocation(loc)
set goldleft = goldleft - junk * 5
endloop
set loc = PolarProjectionBJ(pt, GetRandomReal(25,150), GetRandomReal(0,360))
call CreateItemLoc( RandomItemDrop(0), loc )
call RemoveLocation(loc)
set loc = PolarProjectionBJ(pt, GetRandomReal(25,150), GetRandomReal(0,360))
call CreateItemLoc( RandomItemDrop(0), loc )
call RemoveLocation(loc)
set loc = PolarProjectionBJ(pt, GetRandomReal(25,150), GetRandomReal(0,360))
call CreateItemLoc( RandomItemDrop(0), loc )
call RemoveLocation(loc)
elseif udg_DM_SubType[id] == "gold" then
set goldleft = 475
loop
exitwhen goldleft < 0
set junk = GetRandomInt(1,10)
set loc = PolarProjectionBJ(pt, GetRandomReal(25,150), GetRandomReal(0,360))
call DropCoin(loc, junk)
call RemoveLocation(loc)
set goldleft = goldleft - junk * 5
endloop
elseif udg_DM_SubType[id] == "goldcoin" then
call DropCoin(pt, GetRandomInt(1,3))
endif
elseif udg_Status[id] == "item_remove" then
call ClearItemsPt(pt)
//MISC
//accept ground targets only, can't right-click a unit
elseif GetBooleanAnd(udg_Status[id] == "misc_portal_source", not(isunit)) then
//create a source
call CreateNUnitsAtLoc( 1, 'nwgt', ConvertedPlayer(5), pt, bj_UNIT_FACING )
set udg_Status[id] = "misc_portal_dest"
set udg_DM_Unit[id] = GetLastCreatedUnit()
call GUIApplyCamForDM(pl)
call WaygateActivateBJ( false, udg_DM_Unit[id] )
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFWay Gate Link...|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "Left click a Way Gate to link it to this one." )
call DisplayTextToForce( fp, "Right click the ground to create a linking Way Gate." )
//accept ground targets only, can't right-click a unit
elseif GetBooleanAnd(udg_Status[id] == "misc_portal_dest", not(isunit)) then
//create a destination
call CreateNUnitsAtLoc( 1, 'nwgt', ConvertedPlayer(5), pt, bj_UNIT_FACING )
call WaygateSetDestinationLocBJ( GetLastCreatedUnit(), GetUnitLoc(udg_DM_Unit[id]) )
call WaygateSetDestinationLocBJ( udg_DM_Unit[id], GetUnitLoc(GetLastCreatedUnit()) )
call WaygateActivateBJ( true, GetLastCreatedUnit() )
call WaygateActivateBJ( true, udg_DM_Unit[id] )
set udg_Status[id] = "none"
set udg_DM_Unit[id] = null
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "The two Way Gates are now linked." )
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|c00FFFFFFNo Active Mode|r" )
endif
endif
endfunction
function OnPointerMove takes location pt, player pl, boolean isunit returns nothing
local integer id = 0
local force fp
local location loc
local location loc2
local integer dt
local integer goldleft
local integer junk
local group grp
local unit GUI_D_P_Gate = gg_unit_n00G_0136
local unit GUI_D_P_ElvenGate = gg_unit_n00H_0137
local unit GUI_D_P_DemonicGate = gg_unit_n00F_0138
set id = GetConvertedPlayerId(pl)
set fp = bj_FORCE_PLAYER[id-1]
if not(RectContainsLoc(gg_rct_DMarea, pt)) then
//call DisplayTextToForce( fp, " POINTMOVE!" )
if udg_Status[id] == "unit_kill" then
set grp = GetUnitsInRectAll(RectFromCenterSizeBJ(pt, 600.00, 600.00))
call ForGroupBJ(grp, function KillUnitEnum )
call DestroyGroup(grp)
call ClearExplosivesPtSmall(pt)
endif
endif
endfunction
function OnPointerAttack takes location pt, player pl, boolean isunit returns nothing
local integer id = 0
local force fp
set id = GetConvertedPlayerId(pl)
set fp = bj_FORCE_PLAYER[id-1]
if not(RectContainsLoc(gg_rct_DMarea, pt)) then
//call DisplayTextToForce( fp, " POINTATTACK!" )
endif
endfunction
function OnPointerPatrol takes location pt, player pl returns nothing
local integer id = 0
local force fp
set id = GetConvertedPlayerId(pl)
set fp = bj_FORCE_PLAYER[id-1]
if not(RectContainsLoc(gg_rct_DMarea, pt)) then
//call DisplayTextToForce( fp, " POINTPATROL!" )
endif
endfunction
//CONSTRUCTOR & INTERFACE FOR POINTER EVENT HANDLERS
function OnPointerPoint takes location pt, player pl, integer order, boolean isunit returns nothing
//call DisplayTextToForce( bj_FORCE_PLAYER[GetConvertedPlayerId(pl) - 1], "POINTPOINT: (" + I2S(R2I(GetLocationX(pt))) + "," + I2S(R2I(GetLocationY(pt))) + ")" )
if not(RectContainsLoc(gg_rct_DMarea, pt)) then
//call DisplayTextToForce( bj_FORCE_PLAYER[GetConvertedPlayerId(pl) - 1], "POINTPOINTRECT!" )
//call DisplayTextToForce( bj_FORCE_PLAYER[GetConvertedPlayerId(pl) - 1], "Order: " + I2S(order) + " Name: " + OrderId2StringBJ(order))
if order == String2OrderIdBJ("smart") then
call OnPointerSmart(pt,pl,isunit)
elseif order == String2OrderIdBJ("move") then
call OnPointerMove(pt,pl,isunit)
elseif order == String2OrderIdBJ("attack") then
call OnPointerAttack(pt,pl,isunit)
elseif order == String2OrderIdBJ("patrol") then
call OnPointerSmart(pt,pl,isunit)
endif
endif
//call TriggerSleepAction(1)
//call IssuePointOrderLocBJ( null, "move", udg_GUI_Pointer_Loc[0] )
endfunction
function OnGUIPointOrder takes nothing returns nothing
call OnPointerPoint( GetOrderPointLoc(), GetOwningPlayer(GetOrderedUnit()), GetIssuedOrderIdBJ(), false )
endfunction
function OnGUIUnitOrder takes nothing returns nothing
if GetOrderTargetUnit() == null then
if GetOrderTargetItem() == null then
call OnPointerPoint( GetDestructableLoc(GetOrderTargetDestructable()), GetOwningPlayer(GetOrderedUnit()), GetIssuedOrderIdBJ(), true )
else
call OnPointerPoint( GetItemLoc(GetOrderTargetItem()), GetOwningPlayer(GetOrderedUnit()), GetIssuedOrderIdBJ(), true )
endif
else
call OnPointerPoint( GetUnitLoc(GetOrderTargetUnit()), GetOwningPlayer(GetOrderedUnit()), GetIssuedOrderIdBJ(), true )
endif
endfunction
function InitTrig_Pointer takes nothing returns nothing
set udg_GUI_Pointer[9] = gg_unit_E000_0147
set udg_GUI_Pointer[10] = gg_unit_E000_0148
set udg_GUI_Pointer[11] = gg_unit_E000_0149
set udg_GUI_Pointer_Point = CreateTrigger( )
call TriggerRegisterUnitEvent( udg_GUI_Pointer_Point, gg_unit_E000_0147, EVENT_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterUnitEvent( udg_GUI_Pointer_Point, gg_unit_E000_0148, EVENT_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterUnitEvent( udg_GUI_Pointer_Point, gg_unit_E000_0149, EVENT_UNIT_ISSUED_POINT_ORDER )
call TriggerAddAction( udg_GUI_Pointer_Point, function OnGUIPointOrder )
set udg_GUI_Pointer_Unit = CreateTrigger( )
call TriggerRegisterUnitEvent( udg_GUI_Pointer_Unit, gg_unit_E000_0147, EVENT_UNIT_ISSUED_TARGET_ORDER )
call TriggerRegisterUnitEvent( udg_GUI_Pointer_Unit, gg_unit_E000_0148, EVENT_UNIT_ISSUED_TARGET_ORDER )
call TriggerRegisterUnitEvent( udg_GUI_Pointer_Unit, gg_unit_E000_0149, EVENT_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddAction( udg_GUI_Pointer_Unit, function OnGUIUnitOrder )
endfunction
//sub to ItemGlob, ItemBoard, ItemList
function InitItemsPalette takes nothing returns nothing
local string Weapon_Tag_Sword = "Upgrade First"
local string Weapon_Tag_Maul = "Upgrade Second"
local string Shield_Tag_Plated = "Upgrade First"
local string Shield_Tag_Buckler = "Upgrade Second"
local string Armor_Tag_Plated = ""
local unit Weapon_Random = gg_unit_h001_0096
local unit Weapon_Sword = gg_unit_h001_0107
local unit Weapon_Maul = gg_unit_h001_0145
local unit Shield_Random = gg_unit_h002_0150
local unit Shield_Buckler = gg_unit_h002_0151
local unit Shield_Plated = gg_unit_h002_0152
local unit Armor_Plate = gg_unit_h003_0146
call AddSpecialEffectTargetUnitBJ( "origin", Weapon_Random, "Vuen\\DMLand\\QuestionMark.mdl" )
call AddUnitAnimationPropertiesBJ( true, Weapon_Tag_Sword, Weapon_Sword )
call AddUnitAnimationPropertiesBJ( true, Weapon_Tag_Maul, Weapon_Maul )
call AddSpecialEffectTargetUnitBJ( "origin", Shield_Random, "Vuen\\DMLand\\QuestionMark.mdl" )
call AddUnitAnimationPropertiesBJ( true, Shield_Tag_Buckler, Shield_Buckler )
call AddUnitAnimationPropertiesBJ( true, Shield_Tag_Plated, Shield_Plated )
endfunction
function onGUIItemsClick takes nothing returns nothing
local unit GUI_Items = gg_unit_n000_0033
local unit GUI_I_Create = gg_unit_n000_0034
local unit GUI_I_Remove = gg_unit_n000_0035
local unit GUI_I_Move = gg_unit_n000_0036
local unit Weapon_Random = gg_unit_h001_0096
local unit Weapon_Sword = gg_unit_h001_0107
local unit Weapon_Maul = gg_unit_h001_0145
local unit Shield_Random = gg_unit_h002_0150
local unit Shield_Buckler = gg_unit_h002_0151
local unit Shield_Plated = gg_unit_h002_0152
local unit Armor_Plate = gg_unit_h003_0146
local integer WEAPON = 1
local integer WEAPON_SWORD = 1
local integer WEAPON_MAUL = 2
local integer WEAPON_SICKLE = 3
local integer WEAPON_STAFF = 4
local integer WEAPON_AXE = 5
local integer WEAPON_CLUB = 6
local integer WEAPON_BLADE = 7
local integer SHIELD = 2
local integer SHIELD_BUCKLER = 1
local integer SHIELD_PLATED = 2
local integer SHIELD_WOODEN = 3
local integer SHIELD_KITE = 4
local integer SHIELD_ELVEN = 5
local integer ARMOR = 3
local integer ARMOR_PLATE = 1
local integer ARMOR_MAIL = 2
local integer ARMOR_SPLINT = 3
local integer ARMOR_CAPE = 4
local integer i = 0
local integer i2 = 0
local integer id = 0
local player pl
local force fp
local unit un
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set un = GetTriggerUnit()
if un == GUI_I_Create then
call CameraSetupApplyForPlayer( true, gg_cam_Item_Palette, pl, 0 )
set udg_Status[id] = "item_create"
set udg_DM_Misc[id] = 0
set udg_DM_MiscSub[id] = 0
set udg_DM_MiscBool[id] = false
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFCreating Items...|r" )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "|c0000FF00You are now in Item Creation mode.|r" )
call DisplayTextToForce( fp, " Left click the type of item you would like to create." )
call DisplayTextToForce( fp, " Use the slider (|c00FFFF00F2|r) to set the level of the item." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif un == GUI_I_Remove then
call GUIApplyCamForDM(pl)
set udg_Status[id] = "item_remove"
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFRemoving Items|r" )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "|c0000FF00You are now in Item Removal mode.|r" )
call DisplayTextToForce( fp, " Left click the items you would like to remove." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif un == GUI_I_Move then
call GUIApplyCamForDM(pl)
set udg_Status[id] = "item_move"
set udg_DM_MiscBool[id] = false
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFMoving Items...|r" )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "|c0000FF00You are now in Item Movement mode.|r" )
call DisplayTextToForce( fp, " Select your Pointer (|c00FFFF00F1|r), then right click to set the destination point." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif RectContainsUnit(gg_rct_Item_Palette, un) then
//palette item
if udg_Status[id] == "item_create" then
if un == Weapon_Random then
set udg_DM_Misc[id] = WEAPON
set udg_DM_MiscSub[id] = 0
elseif un == Weapon_Sword then
set udg_DM_Misc[id] = WEAPON
set udg_DM_MiscSub[id] = WEAPON_SWORD
elseif un == Weapon_Maul then
set udg_DM_Misc[id] = WEAPON
set udg_DM_MiscSub[id] = WEAPON_MAUL
elseif un == Shield_Random then
set udg_DM_Misc[id] = SHIELD
set udg_DM_MiscSub[id] = 0
elseif un == Shield_Buckler then
set udg_DM_Misc[id] = SHIELD
set udg_DM_MiscSub[id] = SHIELD_BUCKLER
elseif un == Shield_Plated then
set udg_DM_Misc[id] = SHIELD
set udg_DM_MiscSub[id] = SHIELD_PLATED
elseif un == Armor_Plate then
set udg_DM_Misc[id] = ARMOR
set udg_DM_MiscSub[id] = ARMOR_PLATE
endif
call GUIApplyCamForDM(pl)
set udg_DM_MiscBool[id] = true
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFCreating Items...|r" )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "|c0000FF00You have selected '|r" + GetItemMainName(udg_DM_Misc[id], udg_DM_MiscSub[id]) + "|c00FFFFFF'.|r" )
if GetSliderVal(id) < 0.1 then
call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to create a |c0000FFFF0%|r |cFFFF0000" + GetItemMainName(udg_DM_Misc[id], udg_DM_MiscSub[id]) + "|r." )
else
call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to create a |c0000FFFF" + I2S(R2I(GetSliderVal(id) * 100)) + "%|r |cFFFF0000" + GetItemMainName(udg_DM_Misc[id], udg_DM_MiscSub[id]) + "|r." )
endif
call DisplayTextToForce( fp, " Left click an item in the Item Palette to select a different item type." )
call DisplayTextToForce( fp, " Use the slider (|c00FFFF00F2|r) to set the level of the item." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
endif
//elseif GetBooleanAnd(udg_Status[id] == "item_remove", GetBooleanAnd(GetOwningPlayer(un) == Player(PLAYER_NEUTRAL_PASSIVE), not(RectContainsUnit(gg_rct_DMarea, un)))) then
elseif GetBooleanAnd(udg_Status[id] == "item_remove", isItem(un)) then
call RemoveCustomItem(un)
elseif GetBooleanAnd(udg_Status[id] == "item_move", isItem(un)) then
//call SetUnitPositionLoc( un, udg_DM_Destination[id] )
call MoveItemToPt(un, udg_DM_Destination[id], GetRandomDirectionDeg())
endif
endfunction
function ForGUIItemsInit takes nothing returns nothing
call TriggerRegisterPlayerSelectionEventBJ( udg_GUI_Items_Click, GetEnumPlayer(), true )
endfunction
function InitGUIItems takes nothing returns nothing
set udg_GUI_Items_Click = CreateTrigger()
call TriggerAddAction(udg_GUI_Items_Click, function onGUIItemsClick)
call ForForce( udg_Force[1], function ForGUIItemsInit )
call InitItemsPalette()
endfunction
function InitTrig_ItemsOLD takes nothing returns nothing
set gg_trg_ItemsOLD = CreateTrigger( )
call TriggerAddAction( gg_trg_ItemsOLD, function InitGUIItems )
endfunction
function onGUIItemsClick takes nothing returns nothing
local unit GUI_Items = gg_unit_n000_0033
local unit GUI_I_Create = gg_unit_n000_0034
local unit GUI_I_Remove = gg_unit_n000_0035
local unit GUI_I_Move = gg_unit_n000_0036
local unit GUI_I_P_GoldPile = gg_unit_n000_0132
local unit GUI_I_P_GoldCoin = gg_unit_n000_0133
local unit GUI_I_P_PileOfRiches = gg_unit_n000_0079
local integer id = 0
local player pl
local force fp
local unit un
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set un = GetTriggerUnit()
if un == GUI_I_Create then
call CameraSetupApplyForPlayer( true, gg_cam_Item_Palette, pl, 0 )
set udg_Status[id] = "item_create"
set udg_DM_SubType[id] = ""
set udg_DM_MiscBool[id] = false
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFCreating Items...|r" )
call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Item Creation mode.|r" )
call DisplayTextToForce( fp, " Left click the item or shop you would like to create." )
// call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif un == GUI_I_Remove then
call GUIApplyCamForDM(pl)
set udg_Status[id] = "item_remove"
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFRemoving Items|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Item Removal mode.|r" )
// call DisplayTextToForce( fp, " Left click the items you would like to remove." )
call DisplayTextToForce( fp, " Right click to remove all items in a small area." )
// call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif un == GUI_I_Move then
// call GUIApplyCamForDM(pl)
// set udg_Status[id] = "item_move"
// set udg_DM_MiscBool[id] = false
// call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFMoving Items...|r" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Item Movement mode.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|c00FFFF00F1|r), then right click to set the destination point." )
// call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif un == GUI_I_P_PileOfRiches then
set udg_Status[id] = "item_create"
set udg_DM_SubType[id] = "riches"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a pile of '|c0000FF00" + udg_DM_SubType[id] + "|r' (500 gold + 3 tomes)." )
elseif un == GUI_I_P_GoldPile then
set udg_Status[id] = "item_create"
set udg_DM_SubType[id] = "gold"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a pile of '|c0000FF00" + udg_DM_SubType[id] + "|r' (500 gold)." )
elseif un == GUI_I_P_GoldCoin then
set udg_Status[id] = "item_create"
set udg_DM_SubType[id] = "goldcoin"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif RectContainsUnit(gg_rct_Item_Palette, un) then
//go into unit creation mode, since we're making shops
set udg_Status[id] = "unit_create"
set udg_DM_UnitType[id] = GetUnitTypeId(GetTriggerUnit())
set udg_DM_Player[id] = ConvertedPlayer(5)
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r" + ColorName(TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])), GetConvertedPlayerId(udg_DM_Player[id])) + "|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|cFFFF0000" + TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
//elseif GetBooleanAnd(udg_Status[id] == "item_remove", isItem(un)) then
// call RemoveCustomItem(un)
endif
endfunction
function ForGUIItemsInit takes nothing returns nothing
call TriggerRegisterPlayerSelectionEventBJ( udg_GUI_Items_Click, GetEnumPlayer(), true )
endfunction
function InitGUIItems takes nothing returns nothing
set udg_GUI_Items_Click = CreateTrigger()
call TriggerAddAction(udg_GUI_Items_Click, function onGUIItemsClick)
call ForForce( udg_Force[2], function ForGUIItemsInit )
endfunction
function InitTrig_Items takes nothing returns nothing
set gg_trg_Items = CreateTrigger( )
call TriggerAddAction( gg_trg_Items, function InitGUIItems )
endfunction
function onGUIDoodadsClick takes nothing returns nothing
local unit GUI_Doodads = gg_unit_n000_0037
local unit GUI_D_Create = gg_unit_n000_0038
local unit GUI_D_Remove = gg_unit_n000_0039
local unit GUI_D_Kill = gg_unit_n000_0040
local unit GUI_D_Revive = gg_unit_n000_0041
local unit GUI_D_Toggle = gg_unit_n000_0042
local unit GUI_D_P_Grove = gg_unit_n000_0123
local unit GUI_D_P_Tree = gg_unit_n000_0124
local unit GUI_D_P_Blight = gg_unit_n000_0125
local unit GUI_D_P_Dispel = gg_unit_n000_0131
local unit GUI_D_P_WoodenBridge = gg_unit_n008_0127
local unit GUI_D_P_StoneBridge = gg_unit_n009_0128
local unit GUI_D_P_Gate = gg_unit_n00G_0136
local unit GUI_D_P_ElvenGate = gg_unit_n00H_0137
local unit GUI_D_P_DemonicGate = gg_unit_n00F_0138
local unit GUI_D_P_StoneWall = gg_unit_n00O_0164
local unit GUI_D_P_Line1 = gg_unit_n00P_0183
local unit GUI_D_P_Line2 = gg_unit_n00P_0182
local integer i = 0
local integer i2 = 0
local integer id = 0
local player pl
local force fp
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if (GetTriggerUnit() == GUI_D_Create) then
//creating doodads
call CameraSetupApplyForPlayer( true, gg_cam_DoodadPalette, pl, 0 )
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = ""
set udg_DM_Player[id] = ConvertedPlayer(1)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFCreating Doodads|r" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Unit Creation mode.|r" )
call DisplayTextToForce( fp, " Click the type of doodad you would like to create." )
// call DisplayTextToForce( fp, " Click a coloured tile in the Toolbox to select the owner of the new unit.")
// call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_D_Remove) then
//removing doodads
set udg_Status[id] = "doodad_remove"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFRemoving Doodads|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to remove doodads." )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Doodad Removal mode.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to remove a patch of trees." )
// call DisplayTextToForce( fp, " Press |cFFFFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_D_Kill) then
//killing doodads
set udg_Status[id] = "doodad_kill"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFKilling Doodads|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to kill doodads." )
call DisplayTextToForce( fp, " (This will also detonate explosives.)" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Doodad Killing mode.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to kill a patch of trees." )
// call DisplayTextToForce( fp, " Press |cFFFFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_D_Revive) then
//reviving doodads
set udg_Status[id] = "doodad_revive"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFReviving Doodads|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to revive doodads." )
call DisplayTextToForce( fp, " (To revive a bridge, create it again.)" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Doodad Revival mode.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to create a patch of trees." )
// call DisplayTextToForce( fp, " Press |cFFFFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_D_Toggle) then
//toggling gates
set udg_Status[id] = "doodad_open"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFFOpening Gates|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a gate to open it." )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Doodad Killing mode.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to kill a patch of trees." )
// call DisplayTextToForce( fp, " Press |cFFFFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_D_P_Grove) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "grove"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Tree) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "tree"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
call DisplayTextToForce( fp, " |c00FF0000Single trees should only be created under special circumstances.|r" )
call DisplayTextToForce( fp, " |c00FF0000To build a path, use groves.|r" )
elseif (GetTriggerUnit() == GUI_D_P_Blight) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "blight"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Dispel) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "dispel"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to '|c0000FF00" + udg_DM_SubType[id] + "|r' blight." )
elseif (GetTriggerUnit() == GUI_D_P_WoodenBridge) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "woodenbridge"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a deep river to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_StoneBridge) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "stonebridge"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a deep river to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Gate) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "gate"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_ElvenGate) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "elvengate"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_DemonicGate) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "demonicgate"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_StoneWall) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "wall"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Line1 or GetTriggerUnit() == GUI_D_P_Line2) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "line"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(4), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' of walls you wish to create." )
endif
endfunction
function ForGUIDoodadsInit takes nothing returns nothing
call TriggerRegisterPlayerSelectionEventBJ( udg_GUI_Doodads_Click, GetEnumPlayer(), true )
endfunction
function InitDoodads takes nothing returns nothing
set udg_GUI_Doodads_Click = CreateTrigger()
call TriggerAddAction(udg_GUI_Doodads_Click, function onGUIDoodadsClick)
call ForForce( udg_Force[2], function ForGUIDoodadsInit )
//call DoodadFillArea(gg_rct_Blend_Middle, false)
//call DoodadFillArea(gg_rct_Blend_Desert_Snow, false)
//call DoodadFillArea(gg_rct_Blend_Forest_Snow, false)
//call DoodadFillArea(gg_rct_Blend_Snow_Dungeon, false)
//call DoodadFillArea(gg_rct_Blend_Desert_Forest, false)
//call DoodadFillArea(gg_rct_Desert, false)
//call DoodadFillArea(gg_rct_Forest, false)
//call DoodadFillArea(gg_rct_Snow, false)
//call DoodadFillArea(gg_rct_Dungeon, false)
endfunction
function InitTrig_Doodads takes nothing returns nothing
set gg_trg_Doodads = CreateTrigger( )
call TriggerAddAction( gg_trg_Doodads, function InitDoodads )
endfunction
function Trig_FireWall_Actions takes nothing returns nothing
local integer lvl = GetUnitAbilityLevelSwapped('A011', GetSpellAbilityUnit())
local integer i
local location p
local unit un
local integer id = 0
local player pl
local force fp
set un = GetSpellAbilityUnit()
set id = GetConvertedPlayerId(GetOwningPlayer(un))
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set i = -lvl-1
loop
exitwhen i > lvl+1
set p = PolarProjectionBJ(GetSpellTargetLoc(), i*100, AngleBetweenPoints(GetUnitLoc(GetSpellAbilityUnit()), GetSpellTargetLoc()) + 90)
call MakeFirePatch( pl, lvl, p, 20.00 )
set i = i + 1
endloop
endfunction
function Trig_FireWall_Conditions takes nothing returns boolean
//call DisplayTextToForce( GetPlayersAll(), "spellcast" )
if ( not ( GetSpellAbilityId() == 'A011' ) ) then
return false
endif
//call DisplayTextToForce( GetPlayersAll(), "firewallcast" )
return true
endfunction
function InitTrig_FireWall takes nothing returns nothing
set gg_trg_FireWall = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_FireWall, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_FireWall, Condition( function Trig_FireWall_Conditions ) )
call TriggerAddAction( gg_trg_FireWall, function Trig_FireWall_Actions )
endfunction
function Trig_FireWall_Item_Actions takes nothing returns nothing
local integer lvl = 2
local integer i
local location p
local unit un
local integer id = 0
local player pl
local force fp
set un = GetSpellAbilityUnit()
set id = GetConvertedPlayerId(GetOwningPlayer(un))
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set i = -lvl-1
loop
exitwhen i > lvl+1
set p = PolarProjectionBJ(GetSpellTargetLoc(), i*100, AngleBetweenPoints(GetUnitLoc(GetSpellAbilityUnit()), GetSpellTargetLoc()) + 90)
call MakeFirePatch( pl, lvl, p, 20.00 )
set i = i + 1
endloop
endfunction
function Trig_FireWall_Item_Conditions takes nothing returns boolean
//call DisplayTextToForce( GetPlayersAll(), "spellcast" )
if ( not ( GetSpellAbilityId() == 'A03B' ) ) then
return false
endif
//call DisplayTextToForce( GetPlayersAll(), "firewallcast" )
return true
endfunction
function InitTrig_FireWall_Item takes nothing returns nothing
set gg_trg_FireWall_Item = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_FireWall_Item, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_FireWall_Item, Condition( function Trig_FireWall_Item_Conditions ) )
call TriggerAddAction( gg_trg_FireWall_Item, function Trig_FireWall_Item_Actions )
endfunction
function Trig_FireWall_Unit_Actions takes nothing returns nothing
local integer lvl = 2
local integer i
local location p
local unit un
local integer id = 0
local player pl
local force fp
set un = GetSpellAbilityUnit()
set id = GetConvertedPlayerId(GetOwningPlayer(un))
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set i = -lvl-1
loop
exitwhen i > lvl+1
set p = PolarProjectionBJ(GetSpellTargetLoc(), i*100, AngleBetweenPoints(GetUnitLoc(GetSpellAbilityUnit()), GetSpellTargetLoc()) + 90)
call MakeFirePatch( pl, lvl, p, 20.00 )
set i = i + 1
endloop
endfunction
function Trig_FireWall_Unit_Conditions takes nothing returns boolean
//call DisplayTextToForce( GetPlayersAll(), "spellcast" )
if ( not ( GetSpellAbilityId() == 'A03F' ) ) then
return false
endif
//call DisplayTextToForce( GetPlayersAll(), "firewallcast" )
return true
endfunction
function InitTrig_FireWall_Unit takes nothing returns nothing
set gg_trg_FireWall_Unit = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_FireWall_Unit, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_FireWall_Unit, Condition( function Trig_FireWall_Unit_Conditions ) )
call TriggerAddAction( gg_trg_FireWall_Unit, function Trig_FireWall_Unit_Actions )
endfunction
function ApocalypseEnum takes nothing returns nothing
local unit un
local integer id = 0
local player pl
local force fp
set un = GetSpellAbilityUnit()
set id = GetConvertedPlayerId(GetOwningPlayer(un))
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if GetBooleanAnd(IsPlayerEnemy(GetOwningPlayer(GetEnumUnit()), pl), IsUnitAliveBJ(GetEnumUnit())) then
call MakeFirePatch( pl, 3, GetUnitLoc(GetEnumUnit()), 30.00 )
endif
endfunction
function Trig_Apocalypse_Actions takes nothing returns nothing
//local integer lvl = GetUnitAbilityLevelSwapped('A00U', GetSpellAbilityUnit())
local unit un
local integer id = 0
local player pl
local force fp
set un = GetSpellAbilityUnit()
set id = GetConvertedPlayerId(GetOwningPlayer(un))
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
call ForGroupBJ( GetUnitsInRangeOfLocAll(800.00, GetUnitLoc(un)), function ApocalypseEnum)
call AddSpecialEffectLocBJ( GetUnitLoc(un), "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endfunction
function Trig_Apocalypse_Conditions takes nothing returns boolean
//call DisplayTextToForce( GetPlayersAll(), "spellcast" )
if ( not ( GetSpellAbilityId() == 'A00U' ) ) then
return false
endif
//call DisplayTextToForce( GetPlayersAll(), "apoccast" )
return true
endfunction
function InitTrig_Apocalypse takes nothing returns nothing
set gg_trg_Apocalypse = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Apocalypse, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Apocalypse, Condition( function Trig_Apocalypse_Conditions ) )
call TriggerAddAction( gg_trg_Apocalypse, function Trig_Apocalypse_Actions )
endfunction
function ApocalypseEnum_Item takes nothing returns nothing
local unit un
local integer id = 0
local player pl
local force fp
set un = GetSpellAbilityUnit()
set id = GetConvertedPlayerId(GetOwningPlayer(un))
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if GetBooleanAnd(IsPlayerEnemy(GetOwningPlayer(GetEnumUnit()), pl), IsUnitAliveBJ(GetEnumUnit())) then
call MakeFirePatch( pl, 2, GetUnitLoc(GetEnumUnit()), 20.00 )
endif
endfunction
function Trig_Apocalypse_Item_Actions takes nothing returns nothing
//local integer lvl = GetUnitAbilityLevelSwapped('A00W', GetSpellAbilityUnit())
local unit un
local integer id = 0
local player pl
local force fp
set un = GetSpellAbilityUnit()
set id = GetConvertedPlayerId(GetOwningPlayer(un))
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
call ForGroupBJ( GetUnitsInRangeOfLocAll(800.00, GetUnitLoc(un)), function ApocalypseEnum_Item)
call AddSpecialEffectLocBJ( GetUnitLoc(un), "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endfunction
function Trig_Apocalypse_Item_Conditions takes nothing returns boolean
//call DisplayTextToForce( GetPlayersAll(), "spellcast" )
if ( not ( GetSpellAbilityId() == 'A00W' ) ) then
return false
endif
//call DisplayTextToForce( GetPlayersAll(), "apoccast" )
return true
endfunction
function InitTrig_Apocalypse_Item takes nothing returns nothing
set gg_trg_Apocalypse_Item = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Apocalypse_Item, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Apocalypse_Item, Condition( function Trig_Apocalypse_Item_Conditions ) )
call TriggerAddAction( gg_trg_Apocalypse_Item, function Trig_Apocalypse_Item_Actions )
endfunction
function ApocalypseEnum_Unit takes nothing returns nothing
local unit un
local integer id = 0
local player pl
local force fp
set un = GetSpellAbilityUnit()
set id = GetConvertedPlayerId(GetOwningPlayer(un))
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if GetBooleanAnd(IsPlayerEnemy(GetOwningPlayer(GetEnumUnit()), pl), IsUnitAliveBJ(GetEnumUnit())) then
call MakeFirePatch( pl, 2, GetUnitLoc(GetEnumUnit()), 20.00 )
endif
endfunction
function Trig_Apocalypse_Unit_Actions takes nothing returns nothing
//local integer lvl = GetUnitAbilityLevelSwapped('A00W', GetSpellAbilityUnit())
local unit un
local integer id = 0
local player pl
local force fp
set un = GetSpellAbilityUnit()
set id = GetConvertedPlayerId(GetOwningPlayer(un))
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
call ForGroupBJ( GetUnitsInRangeOfLocAll(800.00, GetUnitLoc(un)), function ApocalypseEnum_Unit)
call AddSpecialEffectLocBJ( GetUnitLoc(un), "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endfunction
function Trig_Apocalypse_Unit_Conditions takes nothing returns boolean
//call DisplayTextToForce( GetPlayersAll(), "spellcast" )
if ( not ( GetSpellAbilityId() == 'A03G' ) ) then
return false
endif
//call DisplayTextToForce( GetPlayersAll(), "apoccast" )
return true
endfunction
function InitTrig_Apocalypse_Unit takes nothing returns nothing
set gg_trg_Apocalypse_Unit = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Apocalypse_Unit, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Apocalypse_Unit, Condition( function Trig_Apocalypse_Unit_Conditions ) )
call TriggerAddAction( gg_trg_Apocalypse_Unit, function Trig_Apocalypse_Unit_Actions )
endfunction
function Trig_LearnBlink_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A00O' ) ) then
return false
endif
return true
endfunction
function Trig_LearnBlink_Actions takes nothing returns nothing
set udg_SPELL_BlinkLearnCount[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))] = udg_SPELL_BlinkLearnCount[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))] + 1
endfunction
//===========================================================================
function InitTrig_BlinkLearn takes nothing returns nothing
set gg_trg_BlinkLearn = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_BlinkLearn, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_BlinkLearn, Condition( function Trig_LearnBlink_Conditions ) )
call TriggerAddAction( gg_trg_BlinkLearn, function Trig_LearnBlink_Actions )
endfunction
function Trig_NPC_Dies_Actions takes nothing returns nothing
local unit un
set un = GetDyingUnit()
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
call RemoveKeepAliveUnit(GetDyingUnit())
//drop items
if GetBooleanAnd(not(IsUnitIllusionBJ(GetDyingUnit())), not(IsUnitType(GetDyingUnit(), UNIT_TYPE_SUMMONED))) then
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call UnitRemoveItemFromSlotSwapped( GetForLoopIndexA(), un )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endif
//revive hero
if IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) then
call PolledWait( 8.00 )
call ReviveHeroLoc( un, GetRandomLocInRect(gg_rct_NPCHeroRevive), false )
call PauseUnitBJ( true, un )
endif
set un = null
endfunction
//===========================================================================
function InitTrig_NPC_Dies takes nothing returns nothing
set gg_trg_NPC_Dies = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_NPC_Dies, Player(0), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_NPC_Dies, Player(4), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_NPC_Dies, function Trig_NPC_Dies_Actions )
endfunction
//this leaks effects. i'm not too concerned.
//update: removed effect entirely. it looks dumb.
function Trig_KeepAlive_Periodic_Actions takes nothing returns nothing
local integer i
local integer tot
// local effect array junk
// local integer junktot
set tot = CountUnitsInGroup(udg_KA_Group)
// set junktot = 0
if tot > 0 then
set i = 1
loop
exitwhen i > 1000
if not(udg_KA_Unit[i] == null) then
if IsUnitInGroup(udg_KA_Unit[i], udg_KA_Group) then //dont think this does anything, just trying to make sure it doesnt break
if IsUnitAliveBJ(udg_KA_Unit[i]) then
call SetTextTagPosUnitBJ( udg_KA_Text[i], udg_KA_Unit[i], 0 )
if GetUnitLifePercent(udg_KA_Unit[i]) < 30.00 then
// if not(IsUnitType(udg_KA_Unit[i], UNIT_TYPE_STRUCTURE)) then
// call AddSpecialEffectTargetUnitBJ( "chest", udg_KA_Unit[i], "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl" )
// endif
// set junktot = junktot + 1
// set junk[junktot] = GetLastCreatedEffectBJ()
call SetUnitLifePercentBJ( udg_KA_Unit[i], GetRandomReal(60.00, 85.00) )
endif
else
call KeepAliveUnit(udg_KA_Unit[i]) //remove KA
endif
set tot = tot - 1
if tot == 0 then
set i = 1000
endif
endif
endif
set i = i + 1
endloop
endif
// call TriggerSleepAction(0)
// set i = 1
// loop
// exitwhen i > junktot
// call DestroyEffectBJ(junk[i])
// set i = i + 1
// endloop
endfunction
function InitTrig_KeepAlive_Periodic takes nothing returns nothing
set gg_trg_KeepAlive_Periodic = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_KeepAlive_Periodic, 0.20 )
call TriggerAddAction( gg_trg_KeepAlive_Periodic, function Trig_KeepAlive_Periodic_Actions )
endfunction
function Trig_Hide_Bridges_Func001A takes nothing returns nothing
if IsBridge(GetEnumDestructable()) then
call KillDestructable( GetEnumDestructable() )
call ShowDestructableBJ( false, GetEnumDestructable() )
endif
endfunction
function Trig_Hide_Bridges_Actions takes nothing returns nothing
call EnumDestructablesInRectAll( GetEntireMapRect(), function Trig_Hide_Bridges_Func001A )
endfunction
//===========================================================================
function InitTrig_Hide_Bridges takes nothing returns nothing
set gg_trg_Hide_Bridges = CreateTrigger( )
call TriggerAddAction( gg_trg_Hide_Bridges, function Trig_Hide_Bridges_Actions )
endfunction
function RejuvPollUnitEnum takes nothing returns nothing
call FillVial(GetEnumUnit())
if IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[1]) then
call SetUnitManaPercentBJ( GetEnumUnit(), 100 )
call SetUnitLifePercentBJ( GetEnumUnit(), 100 )
endif
endfunction
function RejuvPollEnum takes nothing returns nothing
call ForGroupBJ( GetUnitsInRectAll(RectFromCenterSizeBJ(GetUnitLoc(GetEnumUnit()), 600.00, 600.00)), function RejuvPollUnitEnum )
endfunction
function RejuvPoll takes nothing returns nothing
call ForGroupBJ( udg_MISC_Fountains, function RejuvPollEnum )
endfunction
function InitTrig_Rejuvenation_Fountains takes nothing returns nothing
set gg_trg_Rejuvenation_Fountains = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Rejuvenation_Fountains, 1.00 )
call TriggerAddAction( gg_trg_Rejuvenation_Fountains, function RejuvPoll )
endfunction
function SetupUnitPaletteEnum takes nothing returns nothing
local real x
local real y
set x = GetLocationX(GetUnitLoc(GetEnumUnit()))
set y = GetLocationY(GetUnitLoc(GetEnumUnit()))
//straighten units
//call SetUnitPositionLoc( GetEnumUnit(), Location(I2R(R2I(x/64))*64, I2R(R2I(y/64))*64) )
call PauseUnitBJ( true, GetEnumUnit() )
endfunction
function SetupUnitPalette takes nothing returns nothing
call TriggerSleepAction(0)
call ForGroupBJ( GetUnitsInRectAll(gg_rct_Unit_Palette), function SetupUnitPaletteEnum )
endfunction
function InitTrig_Setup_Unit_Palette takes nothing returns nothing
set gg_trg_Setup_Unit_Palette = CreateTrigger( )
call TriggerAddAction( gg_trg_Setup_Unit_Palette, function SetupUnitPalette )
endfunction
function Trig_Gold_Lumber_Actions takes nothing returns nothing
call SetMapFlag( MAP_RESOURCE_TRADING_ALLIES_ONLY, false )
call SetMapFlag( MAP_LOCK_RESOURCE_TRADING, false )
call SetPlayerStateBJ( ConvertedPlayer(1), PLAYER_STATE_RESOURCE_GOLD, 9999999 )
call SetPlayerStateBJ( ConvertedPlayer(1), PLAYER_STATE_RESOURCE_LUMBER, 9999999 )
call SetPlayerStateBJ( ConvertedPlayer(5), PLAYER_STATE_RESOURCE_GOLD, 9999999 )
call SetPlayerStateBJ( ConvertedPlayer(5), PLAYER_STATE_RESOURCE_LUMBER, 9999999 )
call SetPlayerStateBJ( ConvertedPlayer(9), PLAYER_STATE_RESOURCE_GOLD, 9999999 )
call SetPlayerStateBJ( ConvertedPlayer(9), PLAYER_STATE_RESOURCE_LUMBER, 9999999 )
call SetPlayerStateBJ( ConvertedPlayer(10), PLAYER_STATE_RESOURCE_GOLD, 9999999 )
call SetPlayerStateBJ( ConvertedPlayer(10), PLAYER_STATE_RESOURCE_LUMBER, 9999999 )
call SetPlayerStateBJ( ConvertedPlayer(11), PLAYER_STATE_RESOURCE_GOLD, 9999999 )
call SetPlayerStateBJ( ConvertedPlayer(11), PLAYER_STATE_RESOURCE_LUMBER, 9999999 )
endfunction
//===========================================================================
function InitTrig_Gold_Lumber takes nothing returns nothing
set gg_trg_Gold_Lumber = CreateTrigger( )
call TriggerAddAction( gg_trg_Gold_Lumber, function Trig_Gold_Lumber_Actions )
endfunction
function Trig_coinrefs_Copy_Actions takes nothing returns nothing
call CreateItemLoc( 'I002', GetRectCenter(GetPlayableMapRect()) )
call CreateItemLoc( 'I003', GetRectCenter(GetPlayableMapRect()) )
call CreateItemLoc( 'I004', GetRectCenter(GetPlayableMapRect()) )
call CreateItemLoc( 'I005', GetRectCenter(GetPlayableMapRect()) )
call CreateItemLoc( 'I006', GetRectCenter(GetPlayableMapRect()) )
call CreateItemLoc( 'I007', GetRectCenter(GetPlayableMapRect()) )
call CreateItemLoc( 'I008', GetRectCenter(GetPlayableMapRect()) )
call CreateItemLoc( 'I009', GetRectCenter(GetPlayableMapRect()) )
call CreateItemLoc( 'I00A', GetRectCenter(GetPlayableMapRect()) )
call CreateItemLoc( 'I00B', GetRectCenter(GetPlayableMapRect()) )
endfunction
//===========================================================================
function InitTrig_coinrefs_Copy takes nothing returns nothing
set gg_trg_coinrefs_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_coinrefs_Copy, function Trig_coinrefs_Copy_Actions )
endfunction
function Trig_level_1_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'nspb', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nspg', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ngna', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ngno', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nmrl', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsty', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsat', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nban', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nwiz', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_level_1_Copy takes nothing returns nothing
set gg_trg_level_1_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_level_1_Copy, function Trig_level_1_Copy_Actions )
endfunction
function Trig_level_2_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'nftr', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nfsp', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ngrk', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nmrr', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nltl', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nwlt', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nbrg', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nfgu', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ndmu', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_level_2_Copy takes nothing returns nothing
set gg_trg_level_2_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_level_2_Copy, function Trig_level_2_Copy_Actions )
endfunction
function Trig_level_3_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'nbdr', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nftt', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ngns', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ngnb', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ngnw', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nmrm', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nogr', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nrog', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsc2', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_level_3_Copy takes nothing returns nothing
set gg_trg_level_3_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_level_3_Copy, function Trig_level_3_Copy_Actions )
endfunction
function Trig_level_4_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'nftb', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nfsh', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nfrl', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nfrs', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsgt', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nwlg', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nowb', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nass', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nfgb', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_level_4_Copy takes nothing returns nothing
set gg_trg_level_4_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_level_4_Copy, function Trig_level_4_Copy_Actions )
endfunction
function Trig_level_5_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'ngnv', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nomg', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nogm', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nstl', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nkol', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsln', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nslr', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nenf', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nwzg', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_level_5_Copy takes nothing returns nothing
set gg_trg_level_5_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_level_5_Copy, function Trig_level_5_Copy_Actions )
endfunction
function Trig_level_6_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'nrdr', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nftk', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ngst', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsqe', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nthl', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nowe', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nfrb', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsbm', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nmmu', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_level_6_Copy takes nothing returns nothing
set gg_trg_level_6_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_level_6_Copy, function Trig_level_6_Copy_Actions )
endfunction
function Trig_level_7_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'nogl', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nfrg', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nfre', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nhrq', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nrzg', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nslv', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nbld', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'npfm', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nehy', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_level_7_Copy takes nothing returns nothing
set gg_trg_level_7_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_level_7_Copy, function Trig_level_7_Copy_Actions )
endfunction
function Trig_level_8_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'nfra', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ncnk', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nowk', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ninm', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ndqp', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nbal', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'ninf', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nwzd', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nelb', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_level_8_Copy takes nothing returns nothing
set gg_trg_level_8_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_level_8_Copy, function Trig_level_8_Copy_Actions )
endfunction
function Trig_level_9_10_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'nggr', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nrwm', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nstw', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsth', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsgg', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsll', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nerw', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nsqa', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'nahy', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_level_9_10_Copy takes nothing returns nothing
set gg_trg_level_9_10_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_level_9_10_Copy, function Trig_level_9_10_Copy_Actions )
endfunction
function Trig_bla_Copy_10_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'ngst' ) ) then
return false
endif
return true
endfunction
function Trig_bla_Copy_10_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'nitr', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitp', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitt', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nits', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nith', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'ohun', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'odoc', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'otbk', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitw', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_trolls takes nothing returns nothing
set gg_trg_trolls = CreateTrigger( )
call TriggerAddCondition( gg_trg_trolls, Condition( function Trig_bla_Copy_10_Conditions ) )
call TriggerAddAction( gg_trg_trolls, function Trig_bla_Copy_10_Actions )
endfunction
function Trig_bla_Copy_10_Copy_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'ngst' ) ) then
return false
endif
return true
endfunction
function Trig_bla_Copy_10_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'nvil', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvl2', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvlw', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhef', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvlk', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvk2', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'h002', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'h003', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'h004', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_villagers takes nothing returns nothing
set gg_trg_villagers = CreateTrigger( )
call TriggerAddCondition( gg_trg_villagers, Condition( function Trig_bla_Copy_10_Copy_Conditions ) )
call TriggerAddAction( gg_trg_villagers, function Trig_bla_Copy_10_Copy_Actions )
endfunction
function Trig_orcs_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'ogru' ) ) then
return false
endif
return true
endfunction
function Trig_orcs_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'opeo', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'ogru', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'orai', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'ocat', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'okod', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'oshm', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nw2w', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'owar', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'otau', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'ospw', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_orcs takes nothing returns nothing
set gg_trg_orcs = CreateTrigger( )
call TriggerAddCondition( gg_trg_orcs, Condition( function Trig_orcs_Conditions ) )
call TriggerAddAction( gg_trg_orcs, function Trig_orcs_Actions )
endfunction
function Trig_nightelf_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'earc' ) ) then
return false
endif
return true
endfunction
function Trig_nightelf_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'ewsp', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'edoc', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'esen', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'emtg', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'ebal', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'edot', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'earc', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwat', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nssn', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'edry', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_nightelf takes nothing returns nothing
set gg_trg_nightelf = CreateTrigger( )
call TriggerAddCondition( gg_trg_nightelf, Condition( function Trig_nightelf_Conditions ) )
call TriggerAddAction( gg_trg_nightelf, function Trig_nightelf_Actions )
endfunction
function Trig_undead_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'ngst' ) ) then
return false
endif
return true
endfunction
function Trig_undead_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'uaco', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'ugho', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'ucry', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'uabo', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'umtw', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'ucs3', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'unec', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'uske', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'uskm', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'nzom', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_undead takes nothing returns nothing
set gg_trg_undead = CreateTrigger( )
call TriggerAddCondition( gg_trg_undead, Condition( function Trig_undead_Conditions ) )
call TriggerAddAction( gg_trg_undead, function Trig_undead_Actions )
endfunction
function Trig_stores_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'n002' ) ) then
return false
endif
return true
endfunction
function Trig_stores_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'n002', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'n003', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'n001', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'h006', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_stores takes nothing returns nothing
set gg_trg_stores = CreateTrigger( )
call TriggerAddCondition( gg_trg_stores, Condition( function Trig_stores_Conditions ) )
call TriggerAddAction( gg_trg_stores, function Trig_stores_Actions )
endfunction
function Trig_human_heroes_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'Hamg', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hpal', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hblm', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hmkg', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hart', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Harf', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hapm', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Huth', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hvwd', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hjai', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hlgr', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hant', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hgam', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_human_heroes takes nothing returns nothing
set gg_trg_human_heroes = CreateTrigger( )
call TriggerAddAction( gg_trg_human_heroes, function Trig_human_heroes_Actions )
endfunction
function Trig_orc_heroes_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'Ofar', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Obla', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Otch', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Oshd', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Orex', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ogld', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nbbc', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Othr', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Orkn', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Opgh', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ogrh', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_orc_heroes takes nothing returns nothing
set gg_trg_orc_heroes = CreateTrigger( )
call TriggerAddAction( gg_trg_orc_heroes, function Trig_orc_heroes_Actions )
endfunction
function Trig_undead_heroes_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'Udea', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ulic', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ucrl', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Udre', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Uear', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nklj', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Usyl', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nman', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ubal', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Npld', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Uwar', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_undead_heroes takes nothing returns nothing
set gg_trg_undead_heroes = CreateTrigger( )
call TriggerAddAction( gg_trg_undead_heroes, function Trig_undead_heroes_Actions )
endfunction
function Trig_nightelf_heroes_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'Ekee', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Edem', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Emoo', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ewar', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Emfr', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Emns', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Efur', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ecen', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ekgg', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Eevi', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Eill', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_nightelf_heroes takes nothing returns nothing
set gg_trg_nightelf_heroes = CreateTrigger( )
call TriggerAddAction( gg_trg_nightelf_heroes, function Trig_nightelf_heroes_Actions )
endfunction
function Trig_neutral_heroes_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'Nalc', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nngs', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nplh', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nbst', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nfir', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nbrn', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Npbm', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ntin', Player(PLAYER_NEUTRAL_PASSIVE), Location(0, 0), 270.00 )
endfunction
//===========================================================================
function InitTrig_neutral_heroes takes nothing returns nothing
set gg_trg_neutral_heroes = CreateTrigger( )
call TriggerAddAction( gg_trg_neutral_heroes, function Trig_neutral_heroes_Actions )
endfunction