// A note from Admiral-Kelly
//
//This map is unprotected so others may edit it and make their own version under the following conditions:
//
// 1) Credit to me (Admiral-Kelly) must be given.
//
// 2) As this map was baed off of CattleBruiser's Onslaught map, plase respect his wishes wich follow after mine.
//
// 3) Please do not call your map "Onslaught Cinch 1.9", 2.0, etc. as this will create confusion.
//
// 4) Do give this map a new name if you make any changes to it.
//
//
// © 2004 by Brian Uri!, CattleBruiser of www.nohunters.com
//
// This is an unprotected copy of Onslaught 1.2. It has some undocumented changes which were intended to be incorporated
// into 1.3 but which were never published.
//
// This map is released without warranty and I do not plan on supporting or answering questions about it. The Blizzard Map
// Forum is an excellent resource if you are having trouble understanding how this map works.
//
// You may use this map as the basis for your own Onslaught-style game. Please respect the work I have done by following
// these guidelines:
//
// 1) Please leave the line on the loading screen which says:
// The original version of CattleBruiser's Onslaught map can be downloaded at www.nohunters.com.
//
// 2) Please do not call your map "Onslaught 1.3", as 1.2 will be the last OFFICIAL version of my map. Feel free to add
// some adjectives to differentiate your map, like Ruby Onslaught or Onslaught of Tides: Chaos of Frenzy Footmen Heroes.
//
// 3) Please respect the integrity of this map. Don't release a derivative which you know to be a horrible waste of time.
//
// Thank you.
//
// CattleBruiser
// www.nohunters.com
//
// ###########
// # ACTIONS #
// ###########
//*
//* Kills a Tower unit.
//*
function actionKillTower takes nothing returns nothing
call KillUnit(GetEnumUnit())
call PlaySoundBJ(gg_snd_GlueScreenMeteorHit1)
endfunction
//*
//* Pans camera at startup
//*
function actionPanCamera takes rect zone returns nothing
local location tempLoc
set tempLoc = GetRectCenter(zone)
call PanCameraToTimedLocForPlayer(GetEnumPlayer(), tempLoc, 0.25)
call RemoveLocation(tempLoc)
endfunction
//*
//* Kills the picked unit
//*
function actionPickedKill takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
//*
//* Removes the picked unit
//*
function actionPickedRemove takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
endfunction
//*
//* Pings the minimap
//*
function actionPingMap takes rect zone returns nothing
local location tempLoc
set tempLoc = GetRectCenter(zone)
call PingMinimapLocForForce(GetPlayersAll(), tempLoc, 2)
call RemoveLocation(tempLoc)
endfunction
//*
//* Reveals a zone for picked player
//*
function actionRevealZone takes rect zone returns nothing
call CreateFogModifierRectBJ(true, GetEnumPlayer(), FOG_OF_WAR_VISIBLE, zone)
endfunction
//*
//* Sets player's exp rate
//*
function actionSetExpRate takes nothing returns nothing
call SetPlayerHandicapXPBJ(GetEnumPlayer(), udg_experienceCap)
endfunction
//*
//* Shows the defeat message
//*
function actionShowDefeat takes nothing returns nothing
call CustomDefeatBJ(GetEnumPlayer(), udg_MSG_DEFEAT)
endfunction
//*
//* Shows the victory message
//*
function actionShowVictory takes nothing returns nothing
call CustomVictoryBJ(GetEnumPlayer(), false, true)
endfunction
//*
//* Helps Revive Trees
//*
function SetTreesToRevive takes nothing returns nothing
call TriggerRegisterDeathEvent( gg_trg_Revive_Trees, GetEnumDestructable() )
endfunction
// ##############
// # CONDITIONS #
// ##############
//*
//* Checks if the dying unit is an idol
//*
function conditionDyingIdol takes nothing returns boolean
return (GetDyingUnit() == udg_IDOLS[udg_FLAME] or GetDyingUnit() == udg_IDOLS[udg_FROST])
endfunction
//*
//* Checks if the dying unit is a structure.
//*
function conditionDyingStructure takes nothing returns boolean
return (IsUnitType(GetDyingUnit(), UNIT_TYPE_STRUCTURE))
endfunction
//*
//* Checks if the entering unit is a hero.
//*
function conditionEnteringHero takes nothing returns boolean
return (IsUnitType(GetEnteringUnit(), UNIT_TYPE_HERO))
endfunction
//*
//* Checks if the matching unit is a living Flame Tower
//*
function conditionMatchingFlame takes nothing returns boolean
return (GetUnitTypeId(GetFilterUnit()) == udg_TOWERS[udg_FLAME] and IsUnitAliveBJ(GetFilterUnit()))
endfunction
//*
//* Checks if the matching unit is a living Frost Tower
//*
function conditionMatchingFrost takes nothing returns boolean
return (GetUnitTypeId(GetFilterUnit()) == udg_TOWERS[udg_FROST] and IsUnitAliveBJ(GetFilterUnit()))
endfunction
//*
//* Checks if matching unit is a hero
//*
function conditionMatchingHero takes nothing returns boolean
return (IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO))
endfunction
//*
//* Checks if matching unit is a hero on the given team
//*
function conditionMatchingHeroTeam takes nothing returns boolean
return (conditionMatchingHero() and IsPlayerInForce(GetOwningPlayer(GetFilterUnit()), udg_TEAM[udg_experienceTeam]))
endfunction
//*
//* Checks if matching unit is a spawned army unit
//*
function conditionMatchingSpawn takes nothing returns boolean
return (IsUnitAliveBJ(GetFilterUnit()) and (not (IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE))) and (not (IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO))) and (not (GetUnitTypeId(GetFilterUnit()) != 'n011' ) ) and (not (IsUnitType(GetFilterUnit(), UNIT_TYPE_PEON))))
endfunction
//*
//* Checks if the matching unit is a living structure.
//*
function conditionMatchingStructure takes nothing returns boolean
return (IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) and IsUnitAliveBJ(GetFilterUnit()))
endfunction
//*
//* Checks if the matching unit is a non-idol living structure.
//*
function conditionMatchingNonIdol takes nothing returns boolean
return (conditionMatchingStructure() and GetFilterUnit() != udg_IDOLS[udg_FLAME] and GetFilterUnit() != udg_IDOLS[udg_FROST])
endfunction
//*
//* Checks to see if the picked unit has a rally unit.
//*
function NoRallyUnit takes nothing returns boolean
if ( GetUnitRallyUnit(GetEnumUnit()) == null ) then
return true
else
return false
endif
endfunction
//*
//* Checks to see if the picked unit is it's own rally unit.
//*
function PickedUnitIsNOTRallyUnit takes nothing returns boolean
if ( GetUnitRallyUnit(GetEnumUnit()) == GetEnumUnit() ) then
return false
else
return true
endif
endfunction
// ##################
// # TEXT FUNCTIONS #
// ##################
//*
//* Displays a message to everyone
//*
function msgAll takes string message returns nothing
call DisplayTextToForce(GetPlayersAll(), message)
endfunction
//*
//* Displays a message to a Team
//*
function msgTeam takes integer team, string message returns nothing
call DisplayTextToForce(udg_TEAM[team], message)
endfunction
//*
//* Displays a message to a Player
//*
function msgPlayer takes player target, string message returns nothing
local force tempForce
set tempForce = GetForceOfPlayer(target)
call DisplayTextToForce(tempForce, message)
call DestroyForce(tempForce)
endfunction
// #######################
// # REFERENCE FUNCTIONS #
// #######################
//*
//* Returns the angle for a link graphic doodad based on a zones constant
//*
function getAngleFor takes integer zones returns integer
local integer angle
set angle = -90
if (zones == udg_rFLAME_NW) then
return (angle + 25)
elseif (zones == udg_rNW_NE) then
return (angle - 22)
elseif (zones == udg_rNW_SW) then
return (angle - 70)
elseif (zones == udg_rFROST_SE) then
return (angle + 205)
elseif (zones == udg_rSE_SW) then
return (angle + 158)
else // SE_NE
return (angle + 110)
endif
endfunction
//*
//* Returns the zone farthest from a team base
//*
function getAwayZoneFor takes integer team returns rect
if (team == udg_FLAME) then
return (gg_rct_Circle_SE)
else
return (gg_rct_Circle_NW)
endif
endfunction
function getDyingCircle takes nothing returns rect
if (RectContainsUnit(gg_rct_Circle_NW, GetDyingUnit())) then
return (gg_rct_Circle_NW)
elseif (RectContainsUnit(gg_rct_Circle_NE, GetDyingUnit())) then
return (gg_rct_Circle_NE)
elseif (RectContainsUnit(gg_rct_Circle_SW, GetDyingUnit())) then
return (gg_rct_Circle_SW)
elseif (RectContainsUnit(gg_rct_Circle_SE, GetDyingUnit())) then
return (gg_rct_Circle_SE)
endif
return null
endfunction
//*
//* Returns a team constant for a team's enemy.
//*
function getEnemyFor takes integer team returns integer
if (team == udg_FLAME) then
return (udg_FROST)
endif
return (udg_FLAME)
endfunction
//*
//* Returns the team base closest to a zone
//*
function getHomeTeamFor takes rect zone returns integer
if (zone == gg_rct_Circle_NW) then
return (udg_FLAME)
else
return (udg_FROST)
endif
endfunction
//*
//* Returns the zone closest to a team base
//*
function getHomeZoneFor takes integer team returns rect
if (team == udg_FLAME) then
return (gg_rct_Circle_NW)
else
return (gg_rct_Circle_SE)
endif
endfunction
//*
//* Returns the amount of life a tower should have, based on zone and team
//*
function getLifeFor takes rect zone, integer team returns integer
if ((zone == gg_rct_Circle_NW and team == udg_FLAME) or (zone == gg_rct_Circle_SE and team == udg_FROST)) then
return (15)
elseif (zone == gg_rct_Circle_NE or zone == gg_rct_Circle_SW) then
return (10)
else
return (5)
endif
endfunction
//*
//* Returns the lock number for a zone
//*
function getLockFor takes rect zone returns integer
if (zone == gg_rct_Circle_NW) then
return (udg_LOCK_NW)
elseif (zone == gg_rct_Circle_NE) then
return (udg_LOCK_NE)
elseif (zone == gg_rct_Circle_SW) then
return (udg_LOCK_SW)
else // SE
return (udg_LOCK_SE)
endif
endfunction
//*
//* Returns the opposite zone (NE for SW or SW for NE)
//*
function getOppositeZoneFor takes rect zone returns rect
if (zone == gg_rct_Circle_NE) then
return (gg_rct_Circle_SW)
else
return (gg_rct_Circle_NE)
endif
endfunction
//*
//* Returns a random player from a team to own the Idol
//*
function getOwnerFor takes integer team returns player
local player owner
if (CountPlayersInForceBJ(udg_TEAM[team]) == 0) then
return (Player(PLAYER_NEUTRAL_PASSIVE))
else
return (ForcePickRandomPlayer(udg_TEAM[team]))
endif
endfunction
//*
//* Returns a team constant for a player number.
//*
function getTeamFor takes integer playerNum returns integer
if (IsPlayerInForce(ConvertedPlayer(playerNum), udg_TEAM[udg_FLAME])) then
return (udg_FLAME)
endif
return (udg_FROST)
endfunction
//*
//* Checks if a region is considered to be filled with a decaying tower.
//*
function isLocked takes rect zone returns boolean
return (IsUnitAliveBJ(udg_LOCKS[getLockFor(zone)]))
endfunction
//*
//* Checks if a specific team has a Link Tower in a zone.
//*
function teamControls takes rect zone, integer team returns boolean
if (team == udg_FLAME) then
return (CountUnitsInGroup(GetUnitsInRectMatching(zone, Condition(function conditionMatchingFlame))) > 0)
endif
return (CountUnitsInGroup(GetUnitsInRectMatching(zone, Condition(function conditionMatchingFrost))) > 0)
endfunction
//*
//* Checks if any towers at all exist in this zone.
//*
function isControlled takes rect zone returns boolean
return (teamControls(zone, udg_FLAME) or teamControls(zone, udg_FROST))
endfunction
//*
//* Checks if a zone is open for new towers based on passed in criteria, as well as locked or out of order criteria
//*
function isOpen takes rect zone, integer team, player enteringPlayer, boolean isValidLink returns boolean
if (isControlled(zone)) then
return (false)
elseif (isLocked(zone)) then
call msgPlayer(enteringPlayer, udg_MSG_LOCK)
return (false)
elseif (not isValidLink) then
call msgPlayer(enteringPlayer, udg_MSG_LINK)
return (false)
endif
return (true)
endfunction
// #####################
// # UTILITY FUNCTIONS #
// #####################
//*
//* Blinks a unit away by some horizontal offset
//*
function blinkUnit takes real offset returns nothing
call PlaySoundOnUnitBJ(gg_snd_BlinkArrival1, 100, GetEnteringUnit())
call AddSpecialEffectLocBJ(GetUnitLoc(GetEnteringUnit()), "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl")
call SetUnitPositionLoc(GetEnteringUnit(), OffsetLocation(GetUnitLoc(GetEnteringUnit()), offset, 0))
call DestroyEffectBJ(GetLastCreatedEffectBJ())
endfunction
//*
//* Creates the graphical doodads for a team between two zones.
//*
function createLink takes integer team, integer zones returns nothing
local location tempLoc
set tempLoc = GetRectCenter(udg_rLINK_FROM[zones])
call CreateNUnitsAtLoc(1, udg_LINKS[team], Player(PLAYER_NEUTRAL_PASSIVE), tempLoc, getAngleFor(zones))
set udg_uLINK_FROM[zones] = GetLastCreatedUnit()
set tempLoc = GetRectCenter(udg_rLINK_TO[zones])
call CreateNUnitsAtLoc(1, udg_LINKS[team], Player(PLAYER_NEUTRAL_PASSIVE), tempLoc, getAngleFor(zones) - 180)
set udg_uLINK_TO[zones] = GetLastCreatedUnit()
call RemoveLocation(tempLoc)
endfunction
//*
//* Initializes arrays on startup
//*
function initArrays takes nothing returns nothing
// Message Arrays
set udg_MSG_CALM[udg_FROST] = "The Frost Idol is no longer vulnerable."
set udg_MSG_CALM[udg_FLAME] = "The Flame Idol is no longer vulnerable."
set udg_MSG_DANGER[udg_FLAME] = "|cffff0000The Flame Idol is vulnerable!|r"
set udg_MSG_DANGER[udg_FROST] = "|cff9999ffThe Frost Idol is vulnerable!|r"
set udg_MSG_DESTROY[udg_FLAME] = "|cffff0000The Flame Idol was destroyed!|r"
set udg_MSG_DESTROY[udg_FROST] = "|cff9999ffThe Frost Idol was destroyed!|r"
set udg_MSG_IDOL[udg_FLAME] = "Flame Idol"
set udg_MSG_IDOL[udg_FROST] = "Frost Idol"
// Links
set udg_TOWERS[udg_FLAME] = 'n001'
set udg_TOWERS[udg_FROST] = 'n000'
set udg_LINKS[udg_FLAME] = 'u000'
set udg_LINKS[udg_FROST] = 'u001'
// Link Arrays
set udg_rLINK_FROM[udg_rFLAME_NW] = gg_rct_Flame_Idol
set udg_rLINK_TO[udg_rFLAME_NW] = gg_rct_Circle_NW
set udg_rLINK_FROM[udg_rNW_NE] = gg_rct_Circle_NW
set udg_rLINK_TO[udg_rNW_NE] = gg_rct_Circle_NE
set udg_rLINK_FROM[udg_rNW_SW] = gg_rct_Circle_NW
set udg_rLINK_TO[udg_rNW_SW] = gg_rct_Circle_SW
set udg_rLINK_FROM[udg_rSE_NE] = gg_rct_Circle_SE
set udg_rLINK_TO[udg_rSE_NE] = gg_rct_Circle_NE
set udg_rLINK_FROM[udg_rSE_SW] = gg_rct_Circle_SE
set udg_rLINK_TO[udg_rSE_SW] = gg_rct_Circle_SW
set udg_rLINK_FROM[udg_rFROST_SE] = gg_rct_Frost_Idol
set udg_rLINK_TO[udg_rFROST_SE] = gg_rct_Circle_SE
// Teams
call ForceAddPlayerSimple(Player(0), udg_TEAM[udg_FLAME])
call ForceAddPlayerSimple(Player(1), udg_TEAM[udg_FLAME])
call ForceAddPlayerSimple(Player(2), udg_TEAM[udg_FLAME])
call ForceAddPlayerSimple(Player(3), udg_TEAM[udg_FLAME])
call ForceAddPlayerSimple(Player(4), udg_TEAM[udg_FLAME])
call ForceAddPlayerSimple(Player(5), udg_TEAM[udg_FLAME])
call ForceAddPlayerSimple(Player(6), udg_TEAM[udg_FROST])
call ForceAddPlayerSimple(Player(7), udg_TEAM[udg_FROST])
call ForceAddPlayerSimple(Player(8), udg_TEAM[udg_FROST])
call ForceAddPlayerSimple(Player(9), udg_TEAM[udg_FROST])
call ForceAddPlayerSimple(Player(10), udg_TEAM[udg_FROST])
call ForceAddPlayerSimple(Player(11), udg_TEAM[udg_FROST])
// Player colors
set udg_COLORS[1] = "|cffff0303"
set udg_COLORS[2] = "|cff0042ff"
set udg_COLORS[3] = "|cff1ce6b9"
set udg_COLORS[4] = "|cff540081"
set udg_COLORS[5] = "|cfffffc01"
set udg_COLORS[6] = "|cfffe8a01"
set udg_COLORS[7] = "|cff20c000"
set udg_COLORS[8] = "|cffe55bb0"
set udg_COLORS[9] = "|cff959697"
set udg_COLORS[10] = "|cff7ebff1"
set udg_COLORS[11] = "|cff106246"
set udg_COLORS[12] = "|cff4e2a04"
// Tips
set udg_MSG_TIPS[1] = "You can train new tower repairmen at your Altar."
set udg_MSG_TIPS[2] = "Weapons and armor upgrades at your Base apply to all army units."
set udg_MSG_TIPS[3] = "Upgrades at your Base will apply across tiers."
set udg_MSG_TIPS[4] = "Your Altar restores the life of nearby allied heroes."
set udg_MSG_TIPS[5] = "You can buy new heroes later in the game."
set udg_MSG_TIPS[6] = "If a teammate leaves, your team will gain shared control of his or her army and buildings. Visit their Altar to borrow gold from them."
set udg_MSG_TIPS[7] = "Flying units' attacks are weak against Link Towers and the Idol."
set udg_MSG_TIPS[8] = "Backpackers can be trained at the Altar. They purchase items from shops and deliver them to your Hero."
set udg_MSG_TIPS[9] = "The Fountains of Mana restore mana to both units and Heroes."
set udg_MSG_TIPS[10] = "The Charlatan is a spellcaster trained at your Altar that grows stronger as you upgrade to higher tiers."
set udg_MSG_TIPS[11] = "If you destroy the first tower in an enemy's chain, every tower will fall simultaneously."
set udg_MAX_TIPS = 11
//Other
set udg_LocalPlayer = GetLocalPlayer()
endfunction
//*
//* Destroys the graphical doodads between two zones.
//*
function removeLink takes integer zones returns nothing
call RemoveUnit(udg_uLINK_FROM[zones])
call RemoveUnit(udg_uLINK_TO[zones])
endfunction
//*
//* Checks all tower zones for hanging links.
//*
function removeLinks takes nothing returns nothing
if (not isControlled(gg_rct_Circle_NW)) then
call removeLink(udg_rFLAME_NW)
call removeLink(udg_rNW_NE)
call removeLink(udg_rNW_SW)
endif
if (not isControlled(gg_rct_Circle_SE)) then
call removeLink(udg_rFROST_SE)
call removeLink(udg_rSE_NE)
call removeLink(udg_rSE_SW)
endif
if (not isControlled(gg_rct_Circle_NE)) then
call removeLink(udg_rNW_NE)
call removeLink(udg_rSE_NE)
endif
if (not isControlled(gg_rct_Circle_SW)) then
call removeLink(udg_rNW_SW)
call removeLink(udg_rSE_SW)
endif
endfunction
//*
//* Helper function for shopProtection triggers
//*
function shopProtectHelper takes rect zone returns nothing
local real offset
local integer team
set team = getTeamFor(GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit())))
if (zone == gg_rct_Flame_Shops) then
set offset = -256.0
else
set offset = 256.0
endif
if ((zone == gg_rct_Flame_Shops and team == udg_FROST) or (zone == gg_rct_Frost_Shops and team == udg_FLAME)) and ((GetUnitTypeId(GetEnteringUnit()) != 'uloc')) then
call blinkUnit(offset)
endif
endfunction
//*
//* Shows the tip of the day.
//*
function showTip takes nothing returns nothing
call PlaySoundBJ(gg_snd_Hint)
call msgAll(udg_MSG_TIP + udg_MSG_TIPS[GetRandomInt(1, udg_MAX_TIPS)])
endfunction
//*
//* Spawns a unit at some location
//*
function spawnHelper takes integer unitId returns nothing
local location tempLoc
if (IsUnitAliveBJ(GetEnumUnit()) == true) then
set tempLoc = GetUnitLoc(GetEnumUnit())
call CreateNUnitsAtLoc(1, unitId, GetOwningPlayer(GetEnumUnit()), tempLoc, bj_UNIT_FACING)
call RemoveLocation(tempLoc)
if (PickedUnitIsNOTRallyUnit()) then
if (NoRallyUnit()) then
set tempLoc = GetUnitRallyPoint(GetEnumUnit())
call IssuePointOrderLocBJ(GetLastCreatedUnit(), "attack", tempLoc)
call RemoveLocation(tempLoc)
else
call IssueTargetOrderBJ( GetLastCreatedUnit(), "patrol", GetUnitRallyUnit(GetEnumUnit()) )
endif
endif
endif
endfunction
// ########################
// # LINK TOWER FUNCTIONS #
// ########################
//*
//* Creates a new tower in a zone for some player
//*
function createTower takes rect zone, player enteringPlayer returns nothing
local integer team
local location tempLoc
set team = getTeamFor(GetConvertedPlayerId(enteringPlayer))
set tempLoc = GetRectCenter(zone)
call CreateNUnitsAtLoc(1, udg_TOWERS[team], enteringPlayer, tempLoc, bj_UNIT_FACING)
call PingMinimapLocForForce(GetPlayersAll(), tempLoc, 1)
call PlaySoundBJ(gg_snd_Warning)
call RemoveLocation(tempLoc)
endfunction
//*
//* Runs to decay an idol during sudden death
//*
function decayIdol takes integer team returns nothing
local real health
set health = GetUnitStateSwap(UNIT_STATE_LIFE, udg_IDOLS[team])
if (health > 17.0) then
call SetUnitLifeBJ(udg_IDOLS[team], health - 16.00)
endif
endfunction
//*
//* Runs when an idol is destroyed.
//*
function destroyIdolHelper takes nothing returns nothing
call DisableTrigger( gg_trg_spawn0 )
call DisableTrigger( gg_trg_spawn1 )
call DisableTrigger( gg_trg_spawn2 )
call DisableTrigger( gg_trg_spawn3 )
call DisableTrigger( gg_trg_spawn4 )
call DisableTrigger( gg_trg_spawn5 )
call PauseAllUnitsBJ(true)
call PlaySoundBJ(gg_snd_UtherReturns)
if (GetDyingUnit() == udg_IDOLS[udg_FLAME]) then
call msgAll(udg_MSG_DESTROY[udg_FLAME])
else
call msgAll(udg_MSG_DESTROY[udg_FROST])
endif
call TriggerSleepAction(15.00)
if (GetDyingUnit() == udg_IDOLS[udg_FLAME]) then
call ForForce(udg_TEAM[udg_FROST], function actionShowVictory)
call ForForce(udg_TEAM[udg_FLAME], function actionShowDefeat)
else
call ForForce(udg_TEAM[udg_FLAME], function actionShowVictory)
call ForForce(udg_TEAM[udg_FROST], function actionShowDefeat)
endif
endfunction
//*
//* Called to force the destruction of a tower
//*
function destroyTower takes rect zone, integer team, boolean isCascade returns nothing
local location tempLoc
if (isCascade) then
if (not teamControls(zone, team)) then
return
endif
call ForGroupBJ(GetUnitsInRectMatching(zone, Condition(function conditionMatchingStructure)), function actionKillTower)
endif
call removeLinks()
// Mark this region as decaying
if (not IsUnitAliveBJ(udg_LOCKS[getLockFor(zone)])) then
set tempLoc = GetRectCenter(gg_rct_Locks)
call CreateNUnitsAtLoc(1, 'u00A', Player(PLAYER_NEUTRAL_PASSIVE), tempLoc, bj_UNIT_FACING)
call UnitApplyTimedLifeBJ(10.00, 'BTLF', GetLastCreatedUnit())
set udg_LOCKS[getLockFor(zone)] = GetLastCreatedUnit()
call RemoveLocation(tempLoc)
endif
endfunction
//*
//* Called when a tower is physically destroyed by players
//*
function destroyTowerHelper takes nothing returns nothing
local rect zone
local integer team
local rect oppositeZone
set zone = getDyingCircle()
set team = getTeamFor(GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit())))
call destroyTower(zone, team, false)
// Cascade Tower Destructions
if ((zone == gg_rct_Circle_NW and team == udg_FLAME) or (zone == gg_rct_Circle_SE and team == udg_FROST)) then
call destroyTower(gg_rct_Circle_NE, team, true)
call destroyTower(gg_rct_Circle_SW, team, true)
call destroyTower(getAwayZoneFor(team), team, true)
return
elseif ((zone == gg_rct_Circle_SE and team == udg_FLAME) or (zone == gg_rct_Circle_NW and team == udg_FROST)) then
call SetUnitInvulnerable(udg_IDOLS[getEnemyFor(team)], true)
call msgAll(udg_MSG_CALM[getEnemyFor(team)])
return
endif
// Cascade Tower Destructions, inner circles
if (not teamControls(getOppositeZoneFor(zone), team)) then
if (team == udg_FLAME) then
call destroyTower(gg_rct_Circle_SE, team, true)
else // Frost
call destroyTower(gg_rct_Circle_NW, team, true)
endif
endif
endfunction
//*
//* Helper function for the heroEnters triggers in end zones, NW and SE
//*
function heroEntersEndHelper takes rect zone returns nothing
local player enteringPlayer
local integer team
local integer homeTeam
local boolean isValidLink
set enteringPlayer = GetOwningPlayer(GetEnteringUnit())
set team = getTeamFor(GetConvertedPlayerId(enteringPlayer))
set homeTeam = getHomeTeamFor(zone)
// Home team taking home node
set isValidLink = (team == homeTeam and zone == getHomeZoneFor(team))
// Away team taking away node, already controls NE or SW
set isValidLink = isValidLink or (team == getEnemyFor(homeTeam) and (teamControls(gg_rct_Circle_NE, team) or teamControls(gg_rct_Circle_SW, team)))
if (not isOpen(zone, team, enteringPlayer, isValidLink)) then
return
endif
call createTower(zone, enteringPlayer)
if (zone == gg_rct_Circle_NW) then
call createLink(team, udg_rFLAME_NW)
if (teamControls(gg_rct_Circle_NE, team)) then
call createLink(team, udg_rNW_NE)
endif
if (teamControls(gg_rct_Circle_SW, team)) then
call createLink(team, udg_rNW_SW)
endif
else // SE
call createLink(team, udg_rFROST_SE)
if (teamControls(gg_rct_Circle_NE, team)) then
call createLink(team, udg_rSE_NE)
endif
if (teamControls(gg_rct_Circle_SW, team)) then
call createLink(team, udg_rSE_SW)
endif
endif
if (team == getEnemyFor(homeTeam)) then
call PlaySoundBJ(gg_snd_CreepAggroWhat1)
call SetUnitInvulnerable(udg_IDOLS[homeTeam], false)
call msgAll(udg_MSG_DANGER[homeTeam])
endif
endfunction
//*
//* Helper function for the heroEnters triggers in middle zones, NE and SW
//*
function heroEntersMidHelper takes rect zone returns nothing
local player enteringPlayer
local integer team
local boolean isValidLink
set enteringPlayer = GetOwningPlayer(GetEnteringUnit())
set team = getTeamFor(GetConvertedPlayerId(enteringPlayer))
set isValidLink = ((team == udg_FLAME and teamControls(gg_rct_Circle_NW, team)) or (team == udg_FROST and teamControls(gg_rct_Circle_SE, team)))
if (not isOpen(zone, team, enteringPlayer, isValidLink)) then
return
endif
call createTower(zone, enteringPlayer)
if (zone == gg_rct_Circle_NE) then
if (teamControls(gg_rct_Circle_NW, team)) then
call createLink(team, udg_rNW_NE)
endif
if (teamControls(gg_rct_Circle_SE, team)) then
call createLink(team, udg_rSE_NE)
endif
else // SW
if (teamControls(gg_rct_Circle_NW, team)) then
call createLink(team, udg_rNW_SW)
endif
if (teamControls(gg_rct_Circle_SE, team)) then
call createLink(team, udg_rSE_SW)
endif
endif
endfunction
Name | Type | is_array | initial_value |
AbilityLoc | location | Yes | |
Bash | abilcode | Yes | |
Cache | gamecache | No | |
COLORS | string | Yes | |
CrtStrike | abilcode | Yes | |
CurrentBash | abilcode | Yes | |
CurrentCrtStrike | abilcode | Yes | |
CurrentEvasion | abilcode | Yes | |
CurrentFeedback | abilcode | Yes | |
Evasion | abilcode | Yes | |
experienceCap | real | No | |
experienceTeam | integer | No | |
ExpHandicap | real | No | |
Feedback | abilcode | Yes | |
FLAME | integer | No | 0 |
FLYERS | integer | No | 2 |
FROST | integer | No | 1 |
HEROES | unitcode | Yes | |
IDOLS | unit | Yes | |
JumpDistance | integer | Yes | |
LINKS | integer | Yes | |
LocalPlayer | player | No | |
LOCK_NE | integer | No | 1 |
LOCK_NW | integer | No | 0 |
LOCK_SE | integer | No | 3 |
LOCK_SW | integer | No | 2 |
LOCKS | unit | Yes | |
MAX_HEROES | integer | No | 12 |
MAX_TIPS | integer | No | |
MELEE | integer | No | 0 |
MSG_BEGIN | string | No | |cffffff00The Onslaught has begun!|r |
MSG_CALM | string | Yes | |
MSG_DANGER | string | Yes | |
MSG_DEFEAT | string | No | |cffffff00Your idol has fallen!|r |
MSG_DESTROY | string | Yes | |
MSG_GOLD | string | No | |cffffff00Your teammate's base does not have enough gold for a withdrawal.|r |
MSG_IDOL | string | Yes | |
MSG_LINK | string | No | |cffffff00Cannot link circles out of order!|r |
MSG_LOCK | string | No | |cffffff00Cannot summon a new tower until the old one has decayed.|r |
MSG_SUDDEN_DEATH | string | No | |cffffff00The Idols are decaying!|r |
MSG_TIP | string | No | |cffffff00Tip of the Day:|r |
MSG_TIPS | string | Yes | |
NextBash | abilcode | Yes | |
NextCrtStrike | abilcode | Yes | |
NextEvasion | abilcode | Yes | |
NextFeedback | abilcode | Yes | |
playersLeft | integer | Yes | |
Rally | location | Yes | |
RANGED | integer | No | 1 |
rFLAME_NW | integer | No | 0 |
rFROST_SE | integer | No | 1 |
rLINK_FROM | rect | Yes | |
rLINK_TO | rect | Yes | |
rNW_NE | integer | No | 2 |
rNW_SW | integer | No | 3 |
rSE_NE | integer | No | 4 |
rSE_SW | integer | No | 5 |
suddenDeath | boolean | No | false |
TEAM | force | Yes | |
Temp1 | location | No | |
Temp2 | location | No | |
TempBoolean | boolean | No | |
tmpGroup | group | No | |
TmpPlayer | player | No | |
TOWERS | integer | Yes | |
uLINK_FROM | unit | Yes | |
uLINK_TO | unit | Yes | |
UnitTarget | unit | Yes | |
Withdraw | integer | No |
// A note from Admiral-Kelly
//
//This map is unprotected so others may edit it and make their own version under the following conditions:
//
// 1) Credit to me (Admiral-Kelly) must be given.
//
// 2) As this map was baed off of CattleBruiser's Onslaught map, plase respect his wishes wich follow after mine.
//
// 3) Please do not call your map "Onslaught Cinch 1.9", 2.0, etc. as this will create confusion.
//
// 4) Do give this map a new name if you make any changes to it.
//
//
// © 2004 by Brian Uri!, CattleBruiser of www.nohunters.com
//
// This is an unprotected copy of Onslaught 1.2. It has some undocumented changes which were intended to be incorporated
// into 1.3 but which were never published.
//
// This map is released without warranty and I do not plan on supporting or answering questions about it. The Blizzard Map
// Forum is an excellent resource if you are having trouble understanding how this map works.
//
// You may use this map as the basis for your own Onslaught-style game. Please respect the work I have done by following
// these guidelines:
//
// 1) Please leave the line on the loading screen which says:
// The original version of CattleBruiser's Onslaught map can be downloaded at www.nohunters.com.
//
// 2) Please do not call your map "Onslaught 1.3", as 1.2 will be the last OFFICIAL version of my map. Feel free to add
// some adjectives to differentiate your map, like Ruby Onslaught or Onslaught of Tides: Chaos of Frenzy Footmen Heroes.
//
// 3) Please respect the integrity of this map. Don't release a derivative which you know to be a horrible waste of time.
//
// Thank you.
//
// CattleBruiser
// www.nohunters.com
//
//*
//* Map Initialization
//*
function subRevealFlameBase takes nothing returns nothing
call actionRevealZone(gg_rct_Flame_Base)
endfunction
function subRevealFrostBase takes nothing returns nothing
call actionRevealZone(gg_rct_Frost_Base)
endfunction
function subInitPlayers takes nothing returns nothing
call SetPlayerMaxHeroesAllowed(1, GetEnumPlayer())
call SetPlayerStateBJ(GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD, 1500)
call SetPlayerTechMaxAllowedSwap( 'u003', 3, GetEnumPlayer() )
call SetPlayerFlagBJ(PLAYER_STATE_GIVES_BOUNTY, true, GetEnumPlayer())
call EnumDestructablesInRectAll( GetEntireMapRect(), function SetTreesToRevive )
call actionRevealZone(gg_rct_Flame_Idol)
call actionRevealZone(gg_rct_Frost_Idol)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 12
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set bj_forLoopBIndex = 2
set bj_forLoopBIndexEnd = 5
loop
exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
call SetPlayerAbilityAvailableBJ( false, udg_Bash[GetForLoopIndexB()], ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, udg_Evasion[GetForLoopIndexB()], ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, udg_Feedback[GetForLoopIndexB()], ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, udg_CrtStrike[GetForLoopIndexB()], ConvertedPlayer(GetForLoopIndexA()) )
set bj_forLoopBIndex = bj_forLoopBIndex + 1
endloop
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
function mapSetupAction takes nothing returns nothing
local location tempLoc
local player loopPlayer
call initArrays()
call MeleeStartingVisibility()
// Remove not playing players
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 12
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set loopPlayer = ConvertedPlayer(GetForLoopIndexA())
if (GetPlayerSlotState(loopPlayer) != PLAYER_SLOT_STATE_PLAYING) or (GetPlayerController(ConvertedPlayer(GetForLoopIndexA())) == MAP_CONTROL_COMPUTER) then
call ForceRemovePlayerSimple(loopPlayer, GetPlayersAll())
call ForceRemovePlayerSimple(loopPlayer, udg_TEAM[udg_FLAME])
call ForceRemovePlayerSimple(loopPlayer, udg_TEAM[udg_FROST])
call ForGroupBJ(GetUnitsOfPlayerAll(loopPlayer), function actionPickedRemove)
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
// Set up remaining players
call ForForce(GetPlayersAll(), function subInitPlayers)
call ForForce(udg_TEAM[udg_FLAME], function subRevealFlameBase)
call ForForce(udg_TEAM[udg_FROST], function subRevealFrostBase)
set udg_playersLeft[udg_FLAME] = CountPlayersInForceBJ(udg_TEAM[udg_FLAME])
set udg_playersLeft[udg_FROST] = CountPlayersInForceBJ(udg_TEAM[udg_FROST])
// Place Idols
set tempLoc = GetRectCenter(gg_rct_Flame_Idol)
call CreateNUnitsAtLoc(1, 'n002', getOwnerFor(udg_FLAME), tempLoc, 22.00)
call SetUnitInvulnerable(GetLastCreatedUnit(), true)
set udg_IDOLS[udg_FLAME] = GetLastCreatedUnit()
set tempLoc = GetRectCenter(gg_rct_Frost_Idol)
call CreateNUnitsAtLoc(1, 'n003', getOwnerFor(udg_FROST), tempLoc, 202.00)
call SetUnitInvulnerable(GetLastCreatedUnit(), true)
set udg_IDOLS[udg_FROST] = GetLastCreatedUnit()
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function InitTrig_mapSetup takes nothing returns nothing
set gg_trg_mapSetup = CreateTrigger()
call TriggerAddAction(gg_trg_mapSetup, function mapSetupAction)
endfunction
//*
//* Game Begins
//*
function subFlameShop takes nothing returns nothing
call actionPanCamera(gg_rct_Flame_Hero_Tarven)
endfunction
function subFrostShop takes nothing returns nothing
call actionPanCamera(gg_rct_Frost_Hero_Tarven)
endfunction
function gameBeginsAction takes nothing returns nothing
// Create Leaderboard
call CreateLeaderboardBJ(GetPlayersAll(), "TRIGSTR_3001")
call LeaderboardAddItemBJ(Player(0), GetLastCreatedLeaderboard(), udg_MSG_IDOL[udg_FLAME], R2I(GetUnitStateSwap(UNIT_STATE_LIFE, udg_IDOLS[udg_FLAME])))
call LeaderboardAddItemBJ(Player(1), GetLastCreatedLeaderboard(), udg_MSG_IDOL[udg_FROST], R2I(GetUnitStateSwap(UNIT_STATE_LIFE, udg_IDOLS[udg_FROST])))
call LeaderboardDisplayBJ(true, GetLastCreatedLeaderboard())
set udg_tmpGroup = GetUnitsOfPlayerMatching(Player(PLAYER_NEUTRAL_PASSIVE), Condition(function conditionMatchingHero))
call ForGroupBJ(udg_tmpGroup, function actionPickedRemove)
call DestroyGroup(udg_tmpGroup)
call TriggerSleepAction(1.00)
// call ForForce(udg_TEAM[udg_FLAME], function subFlameShop)
// call ForForce(udg_TEAM[udg_FROST], function subFrostShop)
call PlaySoundBJ(gg_snd_GameFound)
call actionPingMap(gg_rct_Circle_NE)
call actionPingMap(gg_rct_Circle_NW)
call actionPingMap(gg_rct_Circle_SE)
call actionPingMap(gg_rct_Circle_SW)
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function InitTrig_gameBegin takes nothing returns nothing
set gg_trg_gameBegin = CreateTrigger()
call TriggerRegisterTimerEventSingle(gg_trg_gameBegin, 0.00)
call TriggerAddAction(gg_trg_gameBegin, function gameBeginsAction)
endfunction
//*
//* Hero Enters NW Circle
//*
function heroEntersNWAction takes nothing returns nothing
call heroEntersEndHelper(gg_rct_Circle_NW)
endfunction
function InitTrig_heroEntersNW takes nothing returns nothing
set gg_trg_heroEntersNW = CreateTrigger()
call TriggerRegisterEnterRectSimple(gg_trg_heroEntersNW, gg_rct_Circle_NW)
call TriggerAddCondition(gg_trg_heroEntersNW, Condition(function conditionEnteringHero))
call TriggerAddAction(gg_trg_heroEntersNW, function heroEntersNWAction)
endfunction
//*
//* Hero Enters SE Circle
//*
function heroEntersSEAction takes nothing returns nothing
call heroEntersEndHelper(gg_rct_Circle_SE)
endfunction
function InitTrig_heroEntersSE takes nothing returns nothing
set gg_trg_heroEntersSE = CreateTrigger()
call TriggerRegisterEnterRectSimple(gg_trg_heroEntersSE, gg_rct_Circle_SE)
call TriggerAddCondition(gg_trg_heroEntersSE, Condition(function conditionEnteringHero))
call TriggerAddAction(gg_trg_heroEntersSE, function heroEntersSEAction)
endfunction
//*
//* Hero Enters NE Circle
//*
function heroEntersNEAction takes nothing returns nothing
call heroEntersMidHelper(gg_rct_Circle_NE)
endfunction
function InitTrig_heroEntersNE takes nothing returns nothing
set gg_trg_heroEntersNE = CreateTrigger()
call TriggerRegisterEnterRectSimple(gg_trg_heroEntersNE, gg_rct_Circle_NE)
call TriggerAddCondition(gg_trg_heroEntersNE, Condition(function conditionEnteringHero))
call TriggerAddAction(gg_trg_heroEntersNE, function heroEntersNEAction)
endfunction
//*
//* Hero Enters SW Circle
//*
function heroEntersSWAction takes nothing returns nothing
call heroEntersMidHelper(gg_rct_Circle_SW)
endfunction
function InitTrig_heroEntersSW takes nothing returns nothing
set gg_trg_heroEntersSW = CreateTrigger()
call TriggerRegisterEnterRectSimple(gg_trg_heroEntersSW, gg_rct_Circle_SW)
call TriggerAddCondition(gg_trg_heroEntersSW, Condition(function conditionEnteringHero))
call TriggerAddAction(gg_trg_heroEntersSW, function heroEntersSWAction)
endfunction
//*
//* A tower is destroyed by players
//*
function destroyTowerAction takes nothing returns nothing
call destroyTowerHelper()
endfunction
function InitTrig_destroyTower takes nothing returns nothing
set gg_trg_destroyTower = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_destroyTower, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(gg_trg_destroyTower, Condition(function conditionDyingStructure))
call TriggerAddAction(gg_trg_destroyTower, function destroyTowerAction)
endfunction
//*
//* Handles victory and defeat conditions
//*
function destroyIdolAction takes nothing returns nothing
call destroyIdolHelper()
endfunction
function InitTrig_destroyIdol takes nothing returns nothing
set gg_trg_destroyIdol = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_destroyIdol, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(gg_trg_destroyIdol, Condition(function conditionDyingIdol))
call TriggerAddAction(gg_trg_destroyIdol, function destroyIdolAction)
endfunction
function spawn0Sub takes nothing returns nothing
call spawnHelper('h00A')
endfunction
function spawn0Action takes nothing returns nothing
call ForGroupBJ(GetUnitsOfTypeIdAll('h00E'), function spawn0Sub)
endfunction
function InitTrig_spawn0 takes nothing returns nothing
set gg_trg_spawn0 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(gg_trg_spawn0, 10.00)
call TriggerAddAction(gg_trg_spawn0, function spawn0Action)
endfunction
function spawn1mSub takes nothing returns nothing
call spawnHelper('u004')
endfunction
function spawn1rSub takes nothing returns nothing
call spawnHelper('e009')
endfunction
function spawn1fSub takes nothing returns nothing
call spawnHelper('e00A')
endfunction
function spawn1Action takes nothing returns nothing
call ForGroupBJ(GetUnitsOfTypeIdAll('h00D'), function spawn1mSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00R'), function spawn1mSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h010'), function spawn1rSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00C'), function spawn1rSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00F'), function spawn1fSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h016'), function spawn1fSub)
endfunction
function InitTrig_spawn1 takes nothing returns nothing
set gg_trg_spawn1 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(gg_trg_spawn1, 11.00)
call TriggerAddAction(gg_trg_spawn1, function spawn1Action)
endfunction
function spawn2mSub takes nothing returns nothing
call spawnHelper('o005')
endfunction
function spawn2rSub takes nothing returns nothing
call spawnHelper('o007')
endfunction
function spawn2fSub takes nothing returns nothing
call spawnHelper('u005')
endfunction
function spawn2Action takes nothing returns nothing
call ForGroupBJ(GetUnitsOfTypeIdAll('h00Z'), function spawn2mSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00H'), function spawn2mSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h014'), function spawn2rSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00B'), function spawn2rSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00Y'), function spawn2fSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00G'), function spawn2fSub)
endfunction
function InitTrig_spawn2 takes nothing returns nothing
set gg_trg_spawn2 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(gg_trg_spawn2, 12.00)
call TriggerAddAction(gg_trg_spawn2, function spawn2Action)
endfunction
function spawn3mSub takes nothing returns nothing
call spawnHelper('o006')
endfunction
function spawn3rSub takes nothing returns nothing
call spawnHelper('u007')
endfunction
function spawn3fSub takes nothing returns nothing
call spawnHelper('o008')
endfunction
function spawn3Action takes nothing returns nothing
call ForGroupBJ(GetUnitsOfTypeIdAll('h012'), function spawn3mSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00J'), function spawn3mSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h013'), function spawn3rSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00I'), function spawn3rSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00K'), function spawn3fSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h011'), function spawn3fSub)
endfunction
function InitTrig_spawn3 takes nothing returns nothing
set gg_trg_spawn3 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(gg_trg_spawn3, 13.00)
call TriggerAddAction(gg_trg_spawn3, function spawn3Action)
endfunction
function spawn4mSub takes nothing returns nothing
call spawnHelper('h01B')
endfunction
function spawn4rSub takes nothing returns nothing
call spawnHelper('e00C')
endfunction
function spawn4fSub takes nothing returns nothing
call spawnHelper('u009')
endfunction
function spawn4Action takes nothing returns nothing
call ForGroupBJ(GetUnitsOfTypeIdAll('h00W'), function spawn4mSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00N'), function spawn4mSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00X'), function spawn4rSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00M'), function spawn4rSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00V'), function spawn4fSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00L'), function spawn4fSub)
endfunction
function InitTrig_spawn4 takes nothing returns nothing
set gg_trg_spawn4 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(gg_trg_spawn4, 14.00)
call TriggerAddAction(gg_trg_spawn4, function spawn4Action)
endfunction
function spawn5mSub takes nothing returns nothing
call spawnHelper('o009')
endfunction
function spawn5rSub takes nothing returns nothing
call spawnHelper('h017')
endfunction
function spawn5fSub takes nothing returns nothing
call spawnHelper('e00E')
endfunction
function spawn5Action takes nothing returns nothing
call ForGroupBJ(GetUnitsOfTypeIdAll('h00T'), function spawn5mSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00P'), function spawn5mSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00U'), function spawn5rSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00O'), function spawn5rSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00S'), function spawn5fSub)
call ForGroupBJ(GetUnitsOfTypeIdAll('h00Q'), function spawn5fSub)
endfunction
function InitTrig_spawn5 takes nothing returns nothing
set gg_trg_spawn5 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(gg_trg_spawn5, 15.00)
call TriggerAddAction(gg_trg_spawn5, function spawn5Action)
endfunction
//*
//* Starts sudden death
//*
function suddenDeathAction takes nothing returns nothing
set udg_suddenDeath = true
call PlaySoundBJ(gg_snd_TheHornOfCenarius)
call DisplayTextToForce(GetPlayersAll(), udg_MSG_SUDDEN_DEATH)
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function InitTrig_suddenDeath takes nothing returns nothing
set gg_trg_suddenDeath = CreateTrigger()
call TriggerRegisterTimerEventSingle(gg_trg_suddenDeath, 2700.00)
call TriggerAddAction(gg_trg_suddenDeath, function suddenDeathAction)
endfunction
//*
//* Restore unit to full life when someone casts Conversion
//*
function castConversionAction takes nothing returns nothing
call SetUnitLifePercentBJ(GetChangingUnit(), 100.00)
call SetUnitManaPercentBJ(GetChangingUnit(), 100)
endfunction
function InitTrig_castConversion takes nothing returns nothing
set gg_trg_castConversion = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_castConversion, EVENT_PLAYER_UNIT_CHANGE_OWNER)
call TriggerAddAction(gg_trg_castConversion, function castConversionAction)
endfunction
//*
//* Manages leaving players.
//*
function subAddAbilities takes nothing returns nothing
call UnitAddAbilityBJ('A02X', GetEnumUnit())
endfunction
function playersLeaveAction takes nothing returns nothing
local integer playerNum
local integer team
local player loopPlayer
set playerNum = GetConvertedPlayerId(GetTriggerPlayer())
set team = getTeamFor(playerNum)
call msgAll(udg_COLORS[playerNum] + GetPlayerName(GetTriggerPlayer()) + "|r has left the game.")
call ShareEverythingWithTeam(GetTriggerPlayer())
call ForGroupBJ(GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), 'h01A'), function subAddAbilities)
set udg_playersLeft[team] = udg_playersLeft[team] - 1
//Remove idol if whole team has quit
if (udg_playersLeft[team] == 0) then
call KillUnit(udg_IDOLS[team])
endif
endfunction
function InitTrig_playersLeave takes nothing returns nothing
set gg_trg_playersLeave = CreateTrigger()
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(0))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(1))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(2))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(3))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(4))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(5))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(6))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(7))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(8))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(9))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(10))
call TriggerRegisterPlayerEventLeave(gg_trg_playersLeave, Player(11))
call TriggerAddAction(gg_trg_playersLeave, function playersLeaveAction)
endfunction
//*
//* Protects the Frost shops
//*
function shopFrostProtectAction takes nothing returns nothing
call shopProtectHelper(gg_rct_Frost_Shops)
endfunction
function InitTrig_shopFrostProtect takes nothing returns nothing
set gg_trg_shopFrostProtect = CreateTrigger()
call TriggerRegisterEnterRectSimple(gg_trg_shopFrostProtect, gg_rct_Frost_Shops)
call TriggerAddAction(gg_trg_shopFrostProtect, function shopFrostProtectAction)
endfunction
//*
//* Protects the Flame shops
//*
function shopFlameProtectAction takes nothing returns nothing
call shopProtectHelper(gg_rct_Flame_Shops)
endfunction
function InitTrig_shopFlameProtect takes nothing returns nothing
set gg_trg_shopFlameProtect = CreateTrigger()
call TriggerRegisterEnterRectSimple(gg_trg_shopFlameProtect, gg_rct_Flame_Shops)
call TriggerAddAction(gg_trg_shopFlameProtect, function shopFlameProtectAction)
endfunction
//*
//* Updates the idol health and leaderboard
//*
function updateIdolsAction takes nothing returns nothing
if (udg_suddenDeath) then
call decayIdol(udg_FLAME)
call decayIdol(udg_FROST)
endif
call LeaderboardSetPlayerItemValueBJ(Player(0), GetLastCreatedLeaderboard(), R2I(GetUnitStateSwap(UNIT_STATE_LIFE, udg_IDOLS[udg_FLAME])))
call LeaderboardSetPlayerItemValueBJ(Player(1), GetLastCreatedLeaderboard(), R2I(GetUnitStateSwap(UNIT_STATE_LIFE, udg_IDOLS[udg_FROST])))
endfunction
function InitTrig_updateIdols takes nothing returns nothing
set gg_trg_updateIdols = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(gg_trg_updateIdols, 4.00)
call TriggerAddAction(gg_trg_updateIdols, function updateIdolsAction)
endfunction
//*
//* Adds bonus armor to idols over time
//*
function subUpgradeIdols takes nothing returns nothing
call SetPlayerTechResearchedSwap('R001', (GetPlayerTechCountSimple('R001', GetEnumPlayer()) + 1), GetEnumPlayer())
endfunction
function upgradeIdolsAction takes nothing returns nothing
call ForForce(GetPlayersAll(), function subUpgradeIdols)
endfunction
function InitTrig_upgradeIdols takes nothing returns nothing
set gg_trg_upgradeIdols = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(gg_trg_upgradeIdols, 240.00)
call TriggerAddAction(gg_trg_upgradeIdols, function upgradeIdolsAction)
endfunction
//*
//* Withdraws gold from an abandoned base
//*
function withdrawGoldAction takes nothing returns nothing
local player owner
if (GetSpellAbilityId() == 'A04P') then
set owner = GetOwningPlayer(GetSpellAbilityUnit())
if (GetPlayerState(owner, PLAYER_STATE_RESOURCE_GOLD) >= 400) then
call CreateItemLoc('I00V', GetUnitLoc(GetSpellAbilityUnit()))
call SetPlayerStateBJ(owner, PLAYER_STATE_RESOURCE_GOLD, (GetPlayerState(owner, PLAYER_STATE_RESOURCE_GOLD) - 400))
else
call msgTeam(getTeamFor(GetConvertedPlayerId(owner)), udg_MSG_GOLD)
endif
endif
endfunction
function InitTrig_withdrawGold takes nothing returns nothing
set gg_trg_withdrawGold = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_withdrawGold, EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddAction(gg_trg_withdrawGold, function withdrawGoldAction)
endfunction