//TESH.scrollpos=12
//TESH.alwaysfold=0
globals
constant integer CREEPS_ID = 'h00C'
constant integer TAX_COLLECTOR_ID = 'h005'
constant integer COLLECTOR_ID = 'h007'
constant integer GOLD_REWARD_AMOUNT = 700
constant integer GOLD_REWARD_PERIODICALLY = 1
constant integer GOLD_REWARD_HERO_KILL_AMOUNT = 100
constant real CREEPS_SPAWN_DELAY = 40.00
constant real GOLD_REWARD_DELAY = 2
// Store Is Hero Alive for each players
unit array PlayerHero
rect array RevivePoint
// To store gold from Collector
// To store collectors
integer array TeamGoldCollected
// To store created units
// 6 elements (top, mid, btm)(good, evil)
group array Creeps
unit array TaxCollectors
unit array Collectors
fogmodifier array FogModifiers
integer array HeroKills
integer array HeroDeaths
endglobals
Name | Type | is_array | initial_value |
//TESH.scrollpos=0
//TESH.alwaysfold=0
library IsPlayerPlaying
function IsPlayerIdPlaying takes integer whoIsPlaying returns boolean
return ( GetPlayerSlotState( Player( whoIsPlaying ) ) == PLAYER_SLOT_STATE_PLAYING )
endfunction
function IsPlayerPlaying takes player whoIsPlaying returns boolean
return ( GetPlayerSlotState( whoIsPlaying ) == PLAYER_SLOT_STATE_PLAYING )
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Table /* made by Bribe, special thanks to Vexorian & Nestharus, version 3.1.0.1
One map, one hashtable. Welcome to NewTable 3.1
This library was originally called NewTable so it didn't conflict with
the API of Table by Vexorian. However, the damage is done and it's too
late to change the library name now. To help with damage control, I
have provided an extension library called TableBC, which bridges all
the functionality of Vexorian's Table except for 2-D string arrays &
the ".flush(integer)" method. I use ".flush()" to flush a child hash-
table, because I wanted the API in NewTable to reflect the API of real
hashtables (I thought this would be more intuitive).
API
------------
struct Table
| static method create takes nothing returns Table
| create a new Table
|
| method destroy takes nothing returns nothing
| destroy it
|
| method flush takes nothing returns nothing
| flush all stored values inside of it
|
| method remove takes integer key returns nothing
| remove the value at index "key"
|
| method operator []= takes integer key, $TYPE$ value returns nothing
| assign "value" to index "key"
|
| method operator [] takes integer key returns $TYPE$
| load the value at index "key"
|
| method has takes integer key returns boolean
| whether or not the key was assigned
|
----------------
struct TableArray
| static method operator [] takes integer array_size returns TableArray
| create a new array of Tables of size "array_size"
|
| method destroy takes nothing returns nothing
| destroy it
|
| method flush takes nothing returns nothing
| flush and destroy it
|
| method operator size takes nothing returns integer
| returns the size of the TableArray
|
| method operator [] takes integer key returns Table
| returns a Table accessible exclusively to index "key"
*/
globals
private integer less = 0 //Index generation for TableArrays (below 0).
private integer more = 8190 //Index generation for Tables.
//Configure it if you use more than 8190 "key" variables in your map (this will never happen though).
private hashtable ht = InitHashtable()
private key sizeK
private key listK
endglobals
private struct dex extends array
static method operator size takes nothing returns Table
return sizeK
endmethod
static method operator list takes nothing returns Table
return listK
endmethod
endstruct
private struct handles extends array
method has takes integer key returns boolean
return HaveSavedHandle(ht, this, key)
endmethod
method remove takes integer key returns nothing
call RemoveSavedHandle(ht, this, key)
endmethod
endstruct
private struct agents extends array
method operator []= takes integer key, agent value returns nothing
call SaveAgentHandle(ht, this, key, value)
endmethod
endstruct
//! textmacro NEW_ARRAY_BASIC takes SUPER, FUNC, TYPE
private struct $TYPE$s extends array
method operator [] takes integer key returns $TYPE$
return Load$FUNC$(ht, this, key)
endmethod
method operator []= takes integer key, $TYPE$ value returns nothing
call Save$FUNC$(ht, this, key, value)
endmethod
method has takes integer key returns boolean
return HaveSaved$SUPER$(ht, this, key)
endmethod
method remove takes integer key returns nothing
call RemoveSaved$SUPER$(ht, this, key)
endmethod
endstruct
private module $TYPE$m
method operator $TYPE$ takes nothing returns $TYPE$s
return this
endmethod
endmodule
//! endtextmacro
//! textmacro NEW_ARRAY takes FUNC, TYPE
private struct $TYPE$s extends array
method operator [] takes integer key returns $TYPE$
return Load$FUNC$Handle(ht, this, key)
endmethod
method operator []= takes integer key, $TYPE$ value returns nothing
call Save$FUNC$Handle(ht, this, key, value)
endmethod
endstruct
private module $TYPE$m
method operator $TYPE$ takes nothing returns $TYPE$s
return this
endmethod
endmodule
//! endtextmacro
//Run these textmacros to include the entire hashtable API as wrappers.
//Don't be intimidated by the number of macros - Vexorian's map optimizer is
//supposed to kill functions which inline (all of these functions inline).
//! runtextmacro NEW_ARRAY_BASIC("Real", "Real", "real")
//! runtextmacro NEW_ARRAY_BASIC("Boolean", "Boolean", "boolean")
//! runtextmacro NEW_ARRAY_BASIC("String", "Str", "string")
//! runtextmacro NEW_ARRAY("Player", "player")
//! runtextmacro NEW_ARRAY("Widget", "widget")
//! runtextmacro NEW_ARRAY("Destructable", "destructable")
//! runtextmacro NEW_ARRAY("Item", "item")
//! runtextmacro NEW_ARRAY("Unit", "unit")
//! runtextmacro NEW_ARRAY("Ability", "ability")
//! runtextmacro NEW_ARRAY("Timer", "timer")
//! runtextmacro NEW_ARRAY("Trigger", "trigger")
//! runtextmacro NEW_ARRAY("TriggerCondition", "triggercondition")
//! runtextmacro NEW_ARRAY("TriggerAction", "triggeraction")
//! runtextmacro NEW_ARRAY("TriggerEvent", "event")
//! runtextmacro NEW_ARRAY("Force", "force")
//! runtextmacro NEW_ARRAY("Group", "group")
//! runtextmacro NEW_ARRAY("Location", "location")
//! runtextmacro NEW_ARRAY("Rect", "rect")
//! runtextmacro NEW_ARRAY("BooleanExpr", "boolexpr")
//! runtextmacro NEW_ARRAY("Sound", "sound")
//! runtextmacro NEW_ARRAY("Effect", "effect")
//! runtextmacro NEW_ARRAY("UnitPool", "unitpool")
//! runtextmacro NEW_ARRAY("ItemPool", "itempool")
//! runtextmacro NEW_ARRAY("Quest", "quest")
//! runtextmacro NEW_ARRAY("QuestItem", "questitem")
//! runtextmacro NEW_ARRAY("DefeatCondition", "defeatcondition")
//! runtextmacro NEW_ARRAY("TimerDialog", "timerdialog")
//! runtextmacro NEW_ARRAY("Leaderboard", "leaderboard")
//! runtextmacro NEW_ARRAY("Multiboard", "multiboard")
//! runtextmacro NEW_ARRAY("MultiboardItem", "multiboarditem")
//! runtextmacro NEW_ARRAY("Trackable", "trackable")
//! runtextmacro NEW_ARRAY("Dialog", "dialog")
//! runtextmacro NEW_ARRAY("Button", "button")
//! runtextmacro NEW_ARRAY("TextTag", "texttag")
//! runtextmacro NEW_ARRAY("Lightning", "lightning")
//! runtextmacro NEW_ARRAY("Image", "image")
//! runtextmacro NEW_ARRAY("Ubersplat", "ubersplat")
//! runtextmacro NEW_ARRAY("Region", "region")
//! runtextmacro NEW_ARRAY("FogState", "fogstate")
//! runtextmacro NEW_ARRAY("FogModifier", "fogmodifier")
//! runtextmacro NEW_ARRAY("Hashtable", "hashtable")
struct Table extends array
// Implement modules for intuitive syntax (tb.handle; tb.unit; etc.)
implement realm
implement booleanm
implement stringm
implement playerm
implement widgetm
implement destructablem
implement itemm
implement unitm
implement abilitym
implement timerm
implement triggerm
implement triggerconditionm
implement triggeractionm
implement eventm
implement forcem
implement groupm
implement locationm
implement rectm
implement boolexprm
implement soundm
implement effectm
implement unitpoolm
implement itempoolm
implement questm
implement questitemm
implement defeatconditionm
implement timerdialogm
implement leaderboardm
implement multiboardm
implement multiboarditemm
implement trackablem
implement dialogm
implement buttonm
implement texttagm
implement lightningm
implement imagem
implement ubersplatm
implement regionm
implement fogstatem
implement fogmodifierm
implement hashtablem
method operator handle takes nothing returns handles
return this
endmethod
method operator agent takes nothing returns agents
return this
endmethod
//set this = tb[GetSpellAbilityId()]
method operator [] takes integer key returns Table
return LoadInteger(ht, this, key)
endmethod
//set tb[389034] = 8192
method operator []= takes integer key, Table tb returns nothing
call SaveInteger(ht, this, key, tb)
endmethod
//set b = tb.has(2493223)
method has takes integer key returns boolean
return HaveSavedInteger(ht, this, key)
endmethod
//call tb.remove(294080)
method remove takes integer key returns nothing
call RemoveSavedInteger(ht, this, key)
endmethod
//Remove all data from a Table instance
method flush takes nothing returns nothing
call FlushChildHashtable(ht, this)
endmethod
//local Table tb = Table.create()
static method create takes nothing returns Table
local Table this = dex.list[0]
if this == 0 then
set this = more + 1
set more = this
else
set dex.list[0] = dex.list[this]
call dex.list.remove(this) //Clear hashed memory
endif
debug set dex.list[this] = -1
return this
endmethod
// Removes all data from a Table instance and recycles its index.
//
// call tb.destroy()
//
method destroy takes nothing returns nothing
debug if dex.list[this] != -1 then
debug call BJDebugMsg("Table Error: Tried to double-free instance: " + I2S(this))
debug return
debug endif
call this.flush()
set dex.list[this] = dex.list[0]
set dex.list[0] = this
endmethod
//! runtextmacro optional TABLE_BC_METHODS()
endstruct
//! runtextmacro optional TABLE_BC_STRUCTS()
struct TableArray extends array
//Returns a new TableArray to do your bidding. Simply use:
//
// local TableArray ta = TableArray[array_size]
//
static method operator [] takes integer array_size returns TableArray
local Table tb = dex.size[array_size] //Get the unique recycle list for this array size
local TableArray this = tb[0] //The last-destroyed TableArray that had this array size
debug if array_size <= 0 then
debug call BJDebugMsg("TypeError: Invalid specified TableArray size: " + I2S(array_size))
debug return 0
debug endif
if this == 0 then
set this = less - array_size
set less = this
else
set tb[0] = tb[this] //Set the last destroyed to the last-last destroyed
call tb.remove(this) //Clear hashed memory
endif
set dex.size[this] = array_size //This remembers the array size
return this
endmethod
//Returns the size of the TableArray
method operator size takes nothing returns integer
return dex.size[this]
endmethod
//This magic method enables two-dimensional[array][syntax] for Tables,
//similar to the two-dimensional utility provided by hashtables them-
//selves.
//
//ta[integer a].unit[integer b] = unit u
//ta[integer a][integer c] = integer d
//
//Inline-friendly when not running in debug mode
//
method operator [] takes integer key returns Table
static if DEBUG_MODE then
local integer i = this.size
if i == 0 then
call BJDebugMsg("IndexError: Tried to get key from invalid TableArray instance: " + I2S(this))
return 0
elseif key < 0 or key >= i then
call BJDebugMsg("IndexError: Tried to get key [" + I2S(key) + "] from outside TableArray bounds: " + I2S(i))
return 0
endif
endif
return this + key
endmethod
//Destroys a TableArray without flushing it; I assume you call .flush()
//if you want it flushed too. This is a public method so that you don't
//have to loop through all TableArray indices to flush them if you don't
//need to (ie. if you were flushing all child-keys as you used them).
//
method destroy takes nothing returns nothing
local Table tb = dex.size[this.size]
debug if this.size == 0 then
debug call BJDebugMsg("TypeError: Tried to destroy an invalid TableArray: " + I2S(this))
debug return
debug endif
if tb == 0 then
//Create a Table to index recycled instances with their array size
set tb = Table.create()
set dex.size[this.size] = tb
endif
call dex.size.remove(this) //Clear the array size from hash memory
set tb[this] = tb[0]
set tb[0] = this
endmethod
private static Table tempTable
private static integer tempEnd
//Avoids hitting the op limit
private static method clean takes nothing returns nothing
local Table tb = .tempTable
local integer end = tb + 0x1000
if end < .tempEnd then
set .tempTable = end
call ForForce(bj_FORCE_PLAYER[0], function thistype.clean)
else
set end = .tempEnd
endif
loop
call tb.flush()
set tb = tb + 1
exitwhen tb == end
endloop
endmethod
//Flushes the TableArray and also destroys it. Doesn't get any more
//similar to the FlushParentHashtable native than this.
//
method flush takes nothing returns nothing
debug if this.size == 0 then
debug call BJDebugMsg("TypeError: Tried to flush an invalid TableArray instance: " + I2S(this))
debug return
debug endif
set .tempTable = this
set .tempEnd = this + this.size
call ForForce(bj_FORCE_PLAYER[0], function thistype.clean)
call this.destroy()
endmethod
endstruct
endlibrary
//TESH.scrollpos=192
//TESH.alwaysfold=0
library Multiboard /* v2.0.0.1
*************************************************************************************
*
* Multiboard Struct API that actually works and is actually easy to use.
*
*************************************************************************************
*
* */uses/*
*
* */ Table /* hiveworkshop.com/forums/jass-functions-413/snippet-new-table-188084/
*
************************************************************************************
*
* struct Multiboard
*
* string title
* boolean display
* boolean minimize
* boolean suppress
*
* real width= (set only)
* string icon= (set only)
* string text= (set only)
*
* readonly MultiboardRow row
* readonly MultiboardColumn column
*
* this[row][column] -> MultiboardItem
*
* static method create takes integer rowCount, integer columnCount returns Multiboard
* method destroy takes nothing returns nothing
*
* method clear takes nothing returns nothing
*
* method setTitleColor takes integer red, integer green, integer blue, integer alpha returns nothing
* method setColor takes integer red, integer green, integer blue, integer alpha returns nothing
* method setStyle takes boolean showValues, boolean showIcons returns nothing
*
************************************************************************************
*
* struct MultiboardRow extends array
* struct MultiboardColumn extends array
*
* integer count
* - row.count
*
* string text
* string icon=
* real width=
* - row[0].width
*
* method setColor takes integer red, integer green, integer blue, integer alpha returns nothing
* method setStyle takes boolean showValue, boolean showIcon returns nothing
* - row[0].setStyle
*
************************************************************************************
*
* struct MultiboardItem extends array
*
* string text= (set only)
* string icon= (set only)
* real width= (set only)
*
* method setColor takes integer red, integer green, integer blue, integer alpha returns nothing
* method setStyle takes boolean showValue, boolean showIcon returns nothing
*
************************************************************************************/
globals
private Table table
private Table table2
private integer array r
private integer ic = 0
private multiboard array boardp
private integer array rc
private integer array cc
private boolean array suppressed
endglobals
private module Init
private static method onInit takes nothing returns nothing
set table = Table.create()
set table2 = Table.create()
endmethod
endmodule
struct MultiboardItem extends array
method operator text= takes string value returns nothing
call MultiboardSetItemValue(table.multiboarditem[this], value)
endmethod
method setColor takes integer red, integer green, integer blue, integer alpha returns nothing
call MultiboardSetItemValueColor(table.multiboarditem[this], red, green, blue, alpha)
endmethod
method setStyle takes boolean showValue, boolean showIcon returns nothing
call MultiboardSetItemStyle(table.multiboarditem[this], showValue, showIcon)
endmethod
method operator icon= takes string str returns nothing
call MultiboardSetItemIcon(table.multiboarditem[this], str)
endmethod
method operator width= takes real percent returns nothing
call MultiboardSetItemWidth(table.multiboarditem[this], percent)
endmethod
implement Init
endstruct
//! textmacro MULTIBOARD_LOOPER takes ROW, TABLE, CODE
local multiboarditem mb
loop
exitwhen 0 == $ROW$
set mb = $TABLE$.multiboarditem[this]
call $CODE$
set this = this + 1
set $ROW$ = $ROW$ - 1
endloop
set mb = null
//! endtextmacro
private keyword Multiboard2D
private keyword getItems
private keyword clearItems
struct Multiboard extends array
method getItems takes nothing returns nothing
local integer row = rc[this]
local integer column
local multiboarditem mb
loop
set column = cc[this]
loop
set mb = MultiboardGetItem(boardp[this], row, column)
set table.multiboarditem[(this*500+row)*500+column] = mb
set table2.multiboarditem[(this*500+column)*500+row] = mb
exitwhen 0 == column
set column = column - 1
endloop
exitwhen 0 == row
set row = row - 1
endloop
set mb = null
endmethod
method clearItems takes nothing returns nothing
local integer row = rc[this]
local integer column
loop
set column = cc[this]
loop
call MultiboardReleaseItem(table.multiboarditem[(this*500+row)*500+column])
call table.handle.remove((this*500+row)*500+column)
call table2.handle.remove((this*500+column)*500+row)
exitwhen 0 == column
set column = column - 1
endloop
exitwhen 0 == row
set row = row - 1
endloop
endmethod
static method create takes integer rowCount, integer columnCount returns thistype
local thistype this = r[0]
if (0 == this) then
set this = ic + 1
set ic = this
else
set suppressed[this] = false
set r[0] = r[this]
endif
set boardp[this] = CreateMultiboard()
call MultiboardSetColumnCount(boardp[this], columnCount)
call MultiboardSetRowCount(boardp[this], rowCount)
set rc[this] = rowCount
set cc[this] = columnCount
call getItems()
return this
endmethod
method destroy takes nothing returns nothing
set r[this] = r[0]
set r[0] = this
call clearItems()
call DestroyMultiboard(boardp[this])
set boardp[this] = null
endmethod
method clear takes nothing returns nothing
call MultiboardClear(boardp[this])
endmethod
method operator display takes nothing returns boolean
return IsMultiboardDisplayed(boardp[this])
endmethod
method operator display= takes boolean b returns nothing
call MultiboardDisplay(boardp[this], b)
endmethod
method operator minimize takes nothing returns boolean
return IsMultiboardMinimized(boardp[this])
endmethod
method operator minimize= takes boolean b returns nothing
call MultiboardMinimize(boardp[this], b)
endmethod
method operator title takes nothing returns string
return MultiboardGetTitleText(boardp[this])
endmethod
method operator title= takes string txt returns nothing
call MultiboardSetTitleText(boardp[this], txt)
endmethod
method setTitleColor takes integer red, integer green, integer blue, integer alpha returns nothing
call MultiboardSetTitleTextColor(boardp[this], red, green, blue, alpha)
endmethod
method operator suppress takes nothing returns boolean
return suppressed[this]
endmethod
method operator suppress= takes boolean b returns nothing
set suppressed[this] = b
call MultiboardSuppressDisplay(b)
endmethod
method operator width= takes real percent returns nothing
call MultiboardSetItemsWidth(boardp[this], percent)
endmethod
method operator row takes nothing returns MultiboardRow
return this
endmethod
method operator column takes nothing returns MultiboardColumn
return this
endmethod
method operator [] takes integer row returns Multiboard2D
return this*500+row
endmethod
method setColor takes integer red, integer green, integer blue, integer alpha returns nothing
call MultiboardSetItemsValueColor(boardp[this], red, green, blue, alpha)
endmethod
method setStyle takes boolean showValues, boolean showIcons returns nothing
call MultiboardSetItemsStyle(boardp[this], showValues, showIcons)
endmethod
method operator icon= takes string txt returns nothing
call MultiboardSetItemsIcon(boardp[this], txt)
endmethod
method operator text= takes string txt returns nothing
call MultiboardSetItemsValue(boardp[this], txt)
endmethod
endstruct
private struct MultiboardSet extends array
method text takes string v, integer c, Table t returns nothing
//! runtextmacro MULTIBOARD_LOOPER("c", "t", "MultiboardSetItemValue(mb, v)")
endmethod
method color takes integer red, integer green, integer blue, integer alpha, integer c, Table t returns nothing
//! runtextmacro MULTIBOARD_LOOPER("c", "t", "MultiboardSetItemValueColor(mb, red, green, blue, alpha)")
endmethod
method style takes boolean v, boolean i, integer c, Table t returns nothing
//! runtextmacro MULTIBOARD_LOOPER("c", "t", "MultiboardSetItemStyle(mb, v, i)")
endmethod
method icon takes string s, integer c, Table t returns nothing
//! runtextmacro MULTIBOARD_LOOPER("c", "t", "MultiboardSetItemIcon(mb, s)")
endmethod
method width takes real p, integer c, Table t returns nothing
//! runtextmacro MULTIBOARD_LOOPER("c", "t", "MultiboardSetItemWidth(mb, p)")
endmethod
endstruct
struct MultiboardColumn extends array
method operator count takes nothing returns integer
return MultiboardGetColumnCount(boardp[this])
endmethod
method operator count= takes integer columns returns nothing
call Multiboard(this).clearItems()
call MultiboardSetColumnCount(boardp[this], columns)
set cc[this] = columns
call Multiboard(this).getItems()
endmethod
method operator text= takes string value returns nothing
call MultiboardSet(this).text(value, rc[this/250000], table2)
endmethod
method setColor takes integer red, integer green, integer blue, integer alpha returns nothing
call MultiboardSet(this).color(red, green, blue, alpha, rc[this/250000], table2)
endmethod
method setStyle takes boolean showValue, boolean showIcon returns nothing
call MultiboardSet(this).style(showValue, showIcon, rc[this/250000], table2)
endmethod
method operator icon= takes string str returns nothing
call MultiboardSet(this).icon(str, rc[this/250000], table2)
endmethod
method operator width= takes real percent returns nothing
call MultiboardSet(this).width(percent, rc[this/250000], table2)
endmethod
method operator [] takes integer column returns thistype
return (this*500+column)*500
endmethod
endstruct
struct MultiboardRow extends array
method operator count takes nothing returns integer
return MultiboardGetRowCount(boardp[this])
endmethod
method operator count= takes integer rows returns nothing
call Multiboard(this).clearItems()
call MultiboardSetRowCount(boardp[this], rows)
set rc[this] = rows
call Multiboard(this).getItems()
endmethod
method operator text= takes string value returns nothing
call MultiboardSet(this).text(value, cc[this/250000], table)
endmethod
method setColor takes integer red, integer green, integer blue, integer alpha returns nothing
call MultiboardSet(this).color(red, green, blue, alpha, cc[this/250000], table)
endmethod
method setStyle takes boolean showValue, boolean showIcon returns nothing
call MultiboardSet(this).style(showValue, showIcon, cc[this/250000], table)
endmethod
method operator icon= takes string str returns nothing
call MultiboardSet(this).icon(str, cc[this/250000], table)
endmethod
method operator width= takes real percent returns nothing
call MultiboardSet(this).width(percent,cc[this/250000], table)
endmethod
method operator [] takes integer row returns thistype
return (this*500+row)*500
endmethod
endstruct
private struct Multiboard2D extends array
method operator [] takes integer column returns MultiboardItem
return this*500+column
endmethod
endstruct
endlibrary
//TESH.scrollpos=30
//TESH.alwaysfold=0
struct Tester extends array
private static method GetPlayerColorString takes player p returns string
//Credits to Andrewgosu from TH for the color codes//
local playercolor c = GetPlayerColor(p)
if c == PLAYER_COLOR_RED then
return "|cffFF0202"
elseif c == PLAYER_COLOR_BLUE then
return "|cff0041FF"
elseif c == PLAYER_COLOR_CYAN then
return "|cff1BE5B8"
elseif c == PLAYER_COLOR_PURPLE then
return "|cff530080"
elseif c == PLAYER_COLOR_YELLOW then
return "|cffFFFC00"
elseif c == PLAYER_COLOR_ORANGE then
return "|cffFE890D"
elseif c == PLAYER_COLOR_GREEN then
return "|cff1FBF00"
elseif c == PLAYER_COLOR_PINK then
return "|cffE45AAF"
elseif c == PLAYER_COLOR_LIGHT_GRAY then
return "|cff949596"
elseif c == PLAYER_COLOR_LIGHT_BLUE then
return "|cff7DBEF1"
elseif c == PLAYER_COLOR_AQUA then
return "|cff0F6145"
elseif c == PLAYER_COLOR_BROWN then
return "|cff4D2903"
else
return "|cffFFFFFF"
endif
endmethod
private static method init takes nothing returns nothing
local integer i = 1
local integer x = 0
local Multiboard board = Multiboard.create(12,3)
call board.setStyle(true, false)
set board.title = "Scoreboard"
set board.column[1].text = "|cffffcc00Kills"
set board.column[2].text = "|cffffcc00Deaths"
for i = 1 to 12
if (i != 6 and i != 12 and IsPlayerPlaying( Player(i - 1) ) ) then
set board[i][0].text = GetPlayerColorString(Player(i - 1)) + GetPlayerName(Player(i - 1))
set board[i][1].text = I2S( HeroKills[i - 1] )
set board[i][2].text = I2S( HeroDeaths[i - 1] )
else
set board[i][1].text = ""
set board[i][2].text = ""
endif
endfor
set board.column[0].width = .07
set board.column[1].width = .05
set board.column[2].width = .05
set board.display = true
call TimerStart( GetExpiredTimer( ), 1, false, function thistype.init )
endmethod
private static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(),0,false,function thistype.init)
endmethod
endstruct
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TaxCollectorDied initializer TriggerInitialize
globals
endglobals
private function TriggerActions takes nothing returns nothing
// awesome way to get 0 or 1 wakakaka
local integer Index = ( GetPlayerId( GetOwningPlayer( GetDyingUnit( ) ) ) + 1 ) / 6 - 1
call BJDebugMsg( R2S( Index ) )
// kill the collector (the car)
call KillUnit( Collectors[ Index ] )
set TaxCollectors[Index] = null
// spawn the flag
endfunction
private function TriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetDyingUnit( ) ) == TAX_COLLECTOR_ID )
endfunction
// Trigger initializer
private function TriggerInitialize takes nothing returns nothing
local trigger Trigger = CreateTrigger( )
// Trigger Add Action
call TriggerRegisterAnyUnitEventBJ( Trigger, EVENT_PLAYER_UNIT_DEATH )
// Trigger Add Condition
call TriggerAddCondition( Trigger, Condition( function TriggerConditions ) )
// Trigger Add Action
call TriggerAddAction( Trigger, function TriggerActions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Untitled_Trigger_008_Actions takes nothing returns nothing
set TaxCollectors[5] = gg_unit_h005_0009
set TaxCollectors[11] = gg_unit_h005_0022
endfunction
//===========================================================================
function InitTrig_Set_Tax_Collector_Sides takes nothing returns nothing
set gg_trg_Set_Tax_Collector_Sides = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Set_Tax_Collector_Sides, 1.00 )
call TriggerAddAction( gg_trg_Set_Tax_Collector_Sides, function Trig_Untitled_Trigger_008_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CollectorDied initializer TriggerInitialize
globals
endglobals
private function TriggerActions takes nothing returns nothing
local integer Index = GetPlayerId ( GetOwningPlayer ( GetDyingUnit( ) ) )
//call BJDebugMsg("Index is " + I2S(Index))
if IsUnitAliveBJ( TaxCollectors[Index] ) then
//call BJDebugMsg("Collector death detected; tax collector alive")
call CollectorRespawn( GetDyingUnit( ) )
endif
endfunction
private function TriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetDyingUnit( ) ) == COLLECTOR_ID )
endfunction
// Trigger initializer
private function TriggerInitialize takes nothing returns nothing
local trigger Trigger = CreateTrigger( )
// Trigger Add Action
call TriggerRegisterAnyUnitEventBJ( Trigger, EVENT_PLAYER_UNIT_DEATH )
// Trigger Add Condition
call TriggerAddCondition( Trigger, Condition( function TriggerConditions ) )
// Trigger Add Action
call TriggerAddAction( Trigger, function TriggerActions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library CollectorRespawn
globals
// change when needed in seconds
private integer COLLECTOR_RESPAWN_TIME = 25
integer gwhichCollector
endglobals
function CollectorRespawnHandle takes nothing returns nothing
local integer whichCollector = gwhichCollector
local integer whichPlayerId = whichCollector
local location whichSpawnPoint
// spawn only if the collector dead
if IsUnitAliveBJ( Collectors[whichCollector] ) == false then
// which spawn point? o.O
if whichCollector == 5 then
set whichSpawnPoint = GetRectCenter(gg_rct_CreepSpawnBottom1)
else
set whichSpawnPoint = GetRectCenter(gg_rct_CreepSpawnBottom2)
endif
//call PingMinimap( GetLocationX(whichSpawnPoint), GetLocationY(whichSpawnPoint), 5 )
// respawn the car
//call BJDebugMsg("ReSpawning car now for " + I2S(whichPlayerId))
set Collectors[whichCollector] = CreateUnitAtLoc( Player( whichPlayerId ), COLLECTOR_ID, whichSpawnPoint, 0 )
call IssuePointOrderLoc(Collectors[whichCollector], "move" , GetRectCenter(gg_rct_GoldMine) )
else
call DestroyTimer( GetExpiredTimer( ) )
endif
endfunction
function CollectorRespawn takes unit whichCollector returns nothing
set gwhichCollector = GetPlayerId( GetOwningPlayer( whichCollector ) )
//call BJDebugMsg("which collector is " + I2S(gwhichCollector))
call TimerStart( CreateTimer( ), COLLECTOR_RESPAWN_TIME, false, function CollectorRespawnHandle )
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope CollectorRetrieveGold initializer TriggerInitialize
globals
endglobals
private function TriggerActions takes nothing returns nothing
local integer PlayerId = GetPlayerId( GetOwningPlayer( GetEnteringUnit( ) ) )
local integer TeamGoldCollectedIndex = ( PlayerId + 1 ) / 6 - 1
if PlayerId == 5 then
set TeamGoldCollected[TeamGoldCollectedIndex] = GOLD_REWARD_AMOUNT
call IssuePointOrderLoc( GetEnteringUnit( ), "move", GetRectCenter( gg_rct_GoldMineRetrieve1 ) )
else
set TeamGoldCollected[TeamGoldCollectedIndex] = GOLD_REWARD_AMOUNT
call IssuePointOrderLoc( GetEnteringUnit( ), "move", GetRectCenter( gg_rct_GoldMineRetrieve2 ) )
endif
endfunction
private function TriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetEnteringUnit( ) ) == COLLECTOR_ID )
endfunction
// Trigger initializer
private function TriggerInitialize takes nothing returns nothing
local trigger Trigger = CreateTrigger( )
// Trigger Add Action
call TriggerRegisterEnterRectSimple( Trigger, gg_rct_GoldMine )
// Trigger Add Condition
call TriggerAddCondition( Trigger, Condition( function TriggerConditions ) )
// Trigger Add Action
call TriggerAddAction( Trigger, function TriggerActions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CollectorReturnGold initializer TriggerInitialize
globals
endglobals
private function TriggerActions2 takes nothing returns nothing
local integer i
local integer CurrentGold
local unit Collector = GetEnteringUnit( )
local player TempPlayer
// give the gold to all players in the team
for i = 6 to 10
set TempPlayer = Player(i)
set CurrentGold = GetPlayerState( TempPlayer, PLAYER_STATE_RESOURCE_GOLD )
call SetPlayerStateBJ( TempPlayer, PLAYER_STATE_RESOURCE_GOLD, CurrentGold + TeamGoldCollected[1] )
endfor
// order to move to gold mine
call IssueTargetOrder( Collector, "move", gg_unit_n005_0011 )
// null values
set Collector = null
set TempPlayer = null
endfunction
private function TriggerConditions2 takes nothing returns boolean
return ( GetUnitTypeId( GetEnteringUnit( ) ) == COLLECTOR_ID ) and ( GetPlayerId( GetOwningPlayer( GetEnteringUnit( ) ) ) == 11 )
endfunction
private function TriggerActions1 takes nothing returns nothing
local integer i
local integer CurrentGold
local unit Collector = GetEnteringUnit( )
local player TempPlayer
// call BJDebugMsg(I2S(TeamGoldCollected[0]))
// give the gold to all players in the team
for i = 0 to 4
set TempPlayer = Player(i)
set CurrentGold = GetPlayerState( TempPlayer, PLAYER_STATE_RESOURCE_GOLD )
call SetPlayerStateBJ( TempPlayer, PLAYER_STATE_RESOURCE_GOLD, CurrentGold + TeamGoldCollected[0] )
endfor
// order to move to gold mine
call IssueTargetOrder( Collector, "move", gg_unit_n005_0011 )
// null values
set Collector = null
set TempPlayer = null
endfunction
private function TriggerConditions1 takes nothing returns boolean
return ( GetUnitTypeId( GetEnteringUnit( ) ) == COLLECTOR_ID ) and ( GetPlayerId( GetOwningPlayer( GetEnteringUnit( ) ) ) == 5 )
endfunction
// Trigger initializer
private function TriggerInitialize takes nothing returns nothing
local trigger Trigger1 = CreateTrigger( )
local trigger Trigger2 = CreateTrigger( )
// Trigger Add Action
call TriggerRegisterEnterRectSimple( Trigger1, gg_rct_GoldMineRetrieve1 )
call TriggerRegisterEnterRectSimple( Trigger2, gg_rct_GoldMineRetrieve2 )
// Trigger Add Condition
call TriggerAddCondition( Trigger1, Condition( function TriggerConditions1 ) )
call TriggerAddCondition( Trigger2, Condition( function TriggerConditions2 ) )
// Trigger Add Action
call TriggerAddAction( Trigger1, function TriggerActions1 )
call TriggerAddAction( Trigger2, function TriggerActions2 )
// Issue order to collector on map initialize
call IssuePointOrderLoc( gg_unit_h007_0031, "move", GetUnitLoc(gg_unit_n005_0011) )
call IssuePointOrderLoc( gg_unit_h007_0043, "move", GetUnitLoc(gg_unit_n005_0011) )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope LastHit initializer TriggerInitialize
globals
private texttag TempTextTag
endglobals
private function DestroyTextTag takes nothing returns nothing
local texttag TextTag = TempTextTag
call DestroyTextTagBJ( TextTag )
endfunction
private function TriggerActions takes nothing returns nothing
local unit DyingUnit = GetDyingUnit( )
local unit KillingUnit = GetKillingUnit( )
local player DyingUnitPlayer = GetOwningPlayer( DyingUnit )
local player KillerUnitPlayer = GetOwningPlayer( KillingUnit )
// this is to fucking set the gold
local integer CurrentKillGold = GetPlayerState(KillerUnitPlayer, PLAYER_STATE_RESOURCE_GOLD)
call SetPlayerState(KillerUnitPlayer, PLAYER_STATE_RESOURCE_GOLD, CurrentKillGold + GOLD_REWARD_KILL_AMOUNT)
// add floating text to show the gold
//if GetLocalPlayer( ) == KillerUnitPlayer then
// set TempTextTag = CreateTextTagUnitBJ( "+" + I2S(GOLD_REWARD_KILL_AMOUNT), DyingUnit, 0, 10, 100, 100, 100, 0 )
// call TimerStart( CreateTimer( ), 1, false, function DestroyTextTag )
//endif
endfunction
private function TriggerConditions takes nothing returns boolean
return true
endfunction
// Trigger initializer
private function TriggerInitialize takes nothing returns nothing
local trigger Trigger = CreateTrigger( )
// Trigger Add Action
call TriggerRegisterAnyUnitEventBJ( Trigger, EVENT_PLAYER_UNIT_DEATH )
// Trigger Add Condition
call TriggerAddCondition( Trigger, Condition( function TriggerConditions ) )
// Trigger Add Action
call TriggerAddAction( Trigger, function TriggerActions )
endfunction
endscope
//TESH.scrollpos=39
//TESH.alwaysfold=0
scope HeroKilled initializer Init
// Trigger globals
globals
private Table table
endglobals
// Trigger Action
private function ReviveHero takes nothing returns nothing
local timer Timer = GetExpiredTimer( )
local unit DyingUnit = table.unit[GetHandleId(Timer)]
local player DyingUnitPlayer = GetOwningPlayer( DyingUnit )
local integer PlayerId = GetPlayerId( DyingUnitPlayer )
local integer randomize
if PlayerId >= 0 and PlayerId <= 5 then
set randomize = GetRandomInt(0, 2)
else
set randomize = GetRandomInt(3, 5)
endif
if PlayerHero[PlayerId] != null then
call ReviveHeroLoc( PlayerHero[PlayerId], GetRectCenter( RevivePoint[randomize] ), true )
call PanCameraToTimedLocForPlayer( DyingUnitPlayer, GetUnitLoc(PlayerHero[PlayerId]), 1 )
call SelectUnitForPlayerSingle(PlayerHero[PlayerId], DyingUnitPlayer)
endif
set table.unit[GetHandleId( Timer )] = null
set DyingUnitPlayer = null
set DyingUnit = null
set Timer = null
endfunction
private function TriggerActions takes nothing returns nothing
local unit DyingUnit = GetDyingUnit()
local unit KillingUnit = GetKillingUnit()
local player DyingUnitPlayer = GetOwningPlayer( DyingUnit )
local player KillingUnitPlayer = GetOwningPlayer( KillingUnit )
local integer CurrentKillGold
local integer i
local timer ReviveTimer = CreateTimer( )
set HeroDeaths[ GetPlayerId( DyingUnitPlayer ) ] = HeroDeaths[ GetPlayerId( DyingUnitPlayer ) ] + 1
if GetPlayerId( KillingUnitPlayer ) != 5 and GetPlayerId( KillingUnitPlayer ) != 11 then
// give gold to enemy who kill the hero
set CurrentKillGold = GetPlayerState(KillingUnitPlayer, PLAYER_STATE_RESOURCE_GOLD)
call SetPlayerState(KillingUnitPlayer, PLAYER_STATE_RESOURCE_GOLD, CurrentKillGold + GOLD_REWARD_HERO_KILL_AMOUNT)
if ( KillingUnitPlayer != null ) then
set HeroKills[ GetPlayerId( KillingUnitPlayer ) ] = HeroKills[ GetPlayerId( KillingUnitPlayer ) ] + 1
endif
// show text "(PLAYER WHO KILLED THIS HERO) just killed (THIS HERO) for (GOLD)" to every player
for i = 0 to 11
if ( KillingUnitPlayer == null ) then
call DisplayTextToPlayer( Player( i ), 0, 0, GetPlayerName( DyingUnitPlayer ) + " just killed himself!" )
else
call DisplayTextToPlayer( Player( i ), 0, 0, GetPlayerName( KillingUnitPlayer ) + " just killed " + GetPlayerName( DyingUnitPlayer ) + " for +" + I2S( GOLD_REWARD_HERO_KILL_AMOUNT ) )
endif
endfor
endif
// Revive
set table.unit[GetHandleId(ReviveTimer)] = DyingUnit
call TimerStart( ReviveTimer, 10, false, function ReviveHero )
call DisplayTextToPlayer( DyingUnitPlayer, 0, 0, "Your hero will revive in 10 seconds" )
set DyingUnit = null
set KillingUnit = null
set DyingUnitPlayer = null
set KillingUnitPlayer = null
set ReviveTimer = null
// wait for revive (10 sec)
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetDyingUnit( ) ) == 'H009' )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
// when the player's hero got killed
call TriggerRegisterAnyUnitEventBJ( Trg, EVENT_PLAYER_UNIT_DEATH )
// Register Trigger Condition
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
// Register Trigger Action
call TriggerAddAction( Trg, function TriggerActions )
// initialize table
set table = Table.create( )
endfunction
endscope
//TESH.scrollpos=7
//TESH.alwaysfold=0
scope HeroInitialize initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local integer i = 0
local integer randomize
set RevivePoint[0] = gg_rct_CreepSpawnTop1
set RevivePoint[1] = gg_rct_CreepsSpawnMiddle1
set RevivePoint[2] = gg_rct_CreepSpawnBottom1
set RevivePoint[3] = gg_rct_CreepSpawnTop2
set RevivePoint[4] = gg_rct_CreepsSpawnMiddle2
set RevivePoint[5] = gg_rct_CreepSpawnBottom2
set Collectors[0] = gg_unit_h007_0031
set Collectors[1] = gg_unit_h007_0043
loop
exitwhen i > 4
set randomize = GetRandomInt(0, 2)
if IsPlayerPlaying( Player(i) ) then
set PlayerHero[i] = CreateUnitAtLoc( Player(i), 'H009', GetRectCenter( RevivePoint[randomize] ), bj_UNIT_FACING )
call PanCameraToTimedLocForPlayer( Player(i), GetUnitLoc(PlayerHero[i]), 1 )
call SelectUnitForPlayerSingle( PlayerHero[i], Player(i) )
endif
set i = i + 1
endloop
set i = i + 1
loop
exitwhen i > 10
set randomize = GetRandomInt(3, 5)
if IsPlayerPlaying( Player(i) ) then
set PlayerHero[i] = CreateUnitAtLoc( Player(i), 'H009', GetRectCenter( RevivePoint[randomize] ), bj_UNIT_FACING )
call PanCameraToTimedLocForPlayer( Player(i), GetUnitLoc(PlayerHero[i]), 1 )
call SelectUnitForPlayerSingle(PlayerHero[i], Player(i))
endif
set i = i + 1
endloop
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return true
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
// call TriggerRegisterTimerEventSingle( Trg, 5 )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
call TriggerExecute( Trg )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope HeroRevive initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local integer i = 0
local integer randomize
loop
exitwhen i > 5
if IsUnitDeadBJ( PlayerHero[i] ) then
set randomize = GetRandomInt(0, 2)
if PlayerHero[i] != null and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
call ReviveHeroLoc( PlayerHero[i], GetRectCenter( RevivePoint[randomize] ), true )
endif
endif
set i = i + 1
endloop
loop
exitwhen i > 11
if IsUnitDeadBJ( PlayerHero[i] ) then
set randomize = GetRandomInt(3, 5)
if PlayerHero[i] != null and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
call ReviveHeroLoc( PlayerHero[i], GetRectCenter( RevivePoint[randomize] ), true )
endif
endif
set i = i + 1
endloop
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return true
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( Trg, 0.5 )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope RadarCheckGoodTeam initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local integer i = 0
for i = 0 to 5
call FogModifierStop( FogModifiers[i] )
call DestroyFogModifier( FogModifiers[i] )
set FogModifiers[i] = CreateFogModifierRectBJ( true, Player( i ), FOG_OF_WAR_FOGGED, GetPlayableMapRect() )
endfor
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return true
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterUnitEvent( Trg, gg_unit_h006_0024, EVENT_UNIT_DEATH )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope RadarCheckEvilTeam initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local integer i = 6
for i = 6 to 11
call FogModifierStop( FogModifiers[i] )
call DestroyFogModifier( FogModifiers[i] )
set FogModifiers[i] = CreateFogModifierRectBJ( true, Player( i ), FOG_OF_WAR_FOGGED, GetPlayableMapRect() )
endfor
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return true
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterUnitEvent( Trg, gg_unit_h006_0025, EVENT_UNIT_DEATH )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
// setting globals
// preloading effects
endfunction
endscope
function Trig_Untitled_Trigger_007_Actions takes nothing returns nothing
call KillUnit( gg_unit_h002_0004 )
call KillUnit( gg_unit_h002_0016 )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_007 takes nothing returns nothing
set gg_trg_Untitled_Trigger_007 = CreateTrigger( )
call TriggerAddAction( gg_trg_Untitled_Trigger_007, function Trig_Untitled_Trigger_007_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SCOPE initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return true
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
call BJDebugMsg( "zzz" )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Test_001_Actions takes nothing returns nothing
call BJDebugMsg( "UNIT SPELL EFFECT STARTED" )
endfunction
//===========================================================================
function InitTrig_Test_001 takes nothing returns nothing
set gg_trg_Test_001 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Test_001, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Test_001, function Trig_Test_001_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DebugGiveSuperBlink initializer TriggerInitialize
globals
endglobals
private function TriggerActions takes nothing returns nothing
call UnitAddAbility( PlayerHero[GetPlayerId( GetTriggerPlayer( ) )], 'SBLK' )
endfunction
private function TriggerConditions takes nothing returns boolean
return true
endfunction
// Trigger initializer
private function TriggerInitialize takes nothing returns nothing
local trigger Trigger = CreateTrigger( )
local integer i
// Trigger Add Action
for i = 0 to 7
call TriggerRegisterPlayerChatEvent( Trigger, Player(i), "-givesuperblink", true )
endfor
// Trigger Add Condition
call TriggerAddCondition( Trigger, Condition( function TriggerConditions ) )
// Trigger Add Action
call TriggerAddAction( Trigger, function TriggerActions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Movement_Speed_Func001A takes nothing returns nothing
local string s = ""
if GetLocalPlayer( ) == Player(0) then
set s = "Unit Movement Speed = " + R2S( GetUnitMoveSpeed( GetEnumUnit( ) ) )
endif
call BJDebugMsg(s)
endfunction
function Trig_Movement_Speed_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsSelectedAll(Player(0)), function Trig_Movement_Speed_Func001A )
endfunction
//===========================================================================
function InitTrig_Movement_Speed takes nothing returns nothing
set gg_trg_Movement_Speed = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Movement_Speed, Player(0), "-debugms", true )
call TriggerAddAction( gg_trg_Movement_Speed, function Trig_Movement_Speed_Actions )
endfunction
function Trig_TopAttackGood_Copy_Actions takes nothing returns nothing
call FogEnableOn( )
endfunction
//===========================================================================
function InitTrig_TopAttackGood_Copy takes nothing returns nothing
set gg_trg_TopAttackGood_Copy = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_TopAttackGood_Copy, 5 )
call TriggerAddAction( gg_trg_TopAttackGood_Copy, function Trig_TopAttackGood_Copy_Actions )
endfunction
//TESH.scrollpos=13
//TESH.alwaysfold=0
scope WinningAndLosing initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local integer i = 0
call DisableTrigger( GetTriggeringTrigger() )
call BJDebugMsg("enter la shit")
if IsUnitDeadBJ ( gg_unit_h000_0014 ) then
loop
exitwhen i > 5
call CustomVictoryBJ( Player(i), true, true )
set i = i + 1
endloop
loop
exitwhen i > 11
call CustomDefeatBJ( Player(i), "The Good team has been defeated" )
set i = i + 1
endloop
elseif IsUnitDeadBJ ( gg_unit_h000_0046 ) then
loop
exitwhen i > 5
call CustomDefeatBJ( Player(i), "The Evil team has been defeated" )
set i = i + 1
endloop
loop
exitwhen i > 11
call CustomVictoryBJ( Player(i), true, true )
set i = i + 1
endloop
endif
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return IsUnitDeadBJ( gg_unit_h000_0014 ) or IsUnitDeadBJ ( gg_unit_h000_0046 )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trg, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope CreepsSpawnTop initializer Init
// Trigger Action
private function TriggerActions takes nothing returns nothing
local unit Unit
local group spawnedUnits = CreateGroup( )
local integer i
// spawn the god damn units
// ask the god damn units to move by following the proper path to the pool first
// team good
set spawnedUnits = CreateGroup( )
if IsUnitAliveBJ( gg_unit_h001_0005 ) then
for i = 1 to 3
set Unit = CreateUnitAtLoc( Player(5), CREEPS_ID, GetRectCenter(gg_rct_CreepSpawnTop1), bj_UNIT_FACING )
call RemoveGuardPosition( Unit )
call GroupAddUnit( spawnedUnits, Unit )
endfor
call GroupPointOrderLocBJ( spawnedUnits, "attack", GetRectCenter(gg_rct_TopAttack) )
endif
// team evil
set spawnedUnits = CreateGroup( )
if IsUnitAliveBJ( gg_unit_h001_0020 ) then
for i = 1 to 3
set Unit = CreateUnitAtLoc( Player(11), CREEPS_ID, GetRectCenter(gg_rct_CreepSpawnTop2), bj_UNIT_FACING )
call GroupAddUnit( spawnedUnits, Unit )
call RemoveGuardPosition( Unit )
endfor
call GroupPointOrderLocBJ( spawnedUnits, "attack", GetRectCenter(gg_rct_TopAttack) )
endif
// null used values
set spawnedUnits = null
set Unit = null
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return true
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( Trg, CREEPS_SPAWN_DELAY )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
call TriggerExecute( Trg )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope CreepsSpawnMiddle initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local unit Unit
local group spawnedUnits = CreateGroup( )
local integer i
// spawn the god damn units
// ask the god damn units to move by following the proper path to the pool first
// team good
set spawnedUnits = CreateGroup( )
if IsUnitAliveBJ( gg_unit_h001_0002 ) then
for i = 1 to 3
set Unit = CreateUnitAtLoc( Player(5), CREEPS_ID, GetRectCenter(gg_rct_CreepsSpawnMiddle1), bj_UNIT_FACING )
call RemoveGuardPosition( Unit )
call GroupAddUnit( spawnedUnits, Unit )
endfor
call GroupPointOrderLocBJ( spawnedUnits, "attack", GetRectCenter(gg_rct_Pool) )
endif
// team evil
set spawnedUnits = CreateGroup( )
if IsUnitAliveBJ( gg_unit_h001_0032 ) then
for i = 1 to 3
set Unit = CreateUnitAtLoc( Player(11), CREEPS_ID, GetRectCenter(gg_rct_CreepsSpawnMiddle2), bj_UNIT_FACING )
call GroupAddUnit( spawnedUnits, Unit )
call RemoveGuardPosition( Unit )
endfor
call GroupPointOrderLocBJ( spawnedUnits, "attack", GetRectCenter(gg_rct_Pool) )
endif
// null used values
set spawnedUnits = null
set Unit = null
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return true
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( Trg, CREEPS_SPAWN_DELAY )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
call TriggerExecute( Trg )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope CreepsSpawnBottom initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local unit Unit
local group spawnedUnits = CreateGroup( )
local integer i
// spawn the god damn units
// ask the god damn units to move by following the proper path to the pool first
// team good
set spawnedUnits = CreateGroup( )
if IsUnitAliveBJ( gg_unit_h001_0062 ) then
for i = 1 to 3
set Unit = CreateUnitAtLoc( Player(5), CREEPS_ID, GetRectCenter(gg_rct_CreepSpawnBottom1), bj_UNIT_FACING )
call RemoveGuardPosition( Unit )
call GroupAddUnit( spawnedUnits, Unit )
endfor
call GroupPointOrderLocBJ( spawnedUnits, "attack", GetRectCenter(gg_rct_BottomAttack) )
endif
// team evil
set spawnedUnits = CreateGroup( )
if IsUnitAliveBJ( gg_unit_h001_0018 ) then
for i = 1 to 3
set Unit = CreateUnitAtLoc( Player(11), CREEPS_ID, GetRectCenter(gg_rct_CreepSpawnBottom2), bj_UNIT_FACING )
call GroupAddUnit( spawnedUnits, Unit )
call RemoveGuardPosition( Unit )
endfor
call GroupPointOrderLocBJ( spawnedUnits, "attack", GetRectCenter(gg_rct_BottomAttack) )
endif
// null used values
set spawnedUnits = null
set Unit = null
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return true
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( Trg, CREEPS_SPAWN_DELAY )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
call TriggerExecute( Trg )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CreepsTopAttack initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local unit EnteringUnit = GetEnteringUnit()
// order entering unit to attack the core
// entering unit will attack core depends on which team
if GetOwningPlayer( EnteringUnit ) == Player(5) then
call IssuePointOrderLocBJ( EnteringUnit, "attack", GetRectCenter( gg_rct_CreepsAttackMiddleFromTopEvil ) )
else
call IssuePointOrderLocBJ( EnteringUnit, "attack", GetRectCenter( gg_rct_CreepsAttackMiddleFromTopGood ) )
endif
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return ( GetUnitTypeId(GetEnteringUnit()) == CREEPS_ID )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterEnterRectSimple( Trg, gg_rct_TopAttack )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CreepsMiddleAttackCore initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local unit EnteringUnit = GetEnteringUnit()
// order entering unit to attack the core
// entering unit will attack core depends on which team
if GetOwningPlayer( EnteringUnit ) == Player(5) then
call IssuePointOrderLocBJ( EnteringUnit, "attack", GetUnitLoc( gg_unit_h000_0014 ) )
else
call IssuePointOrderLocBJ( EnteringUnit, "attack", GetUnitLoc( gg_unit_h000_0046 ) )
endif
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return ( GetUnitTypeId(GetEnteringUnit()) == CREEPS_ID )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterEnterRectSimple( Trg, gg_rct_Pool )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CreepsBottomAttack initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local unit EnteringUnit = GetEnteringUnit()
// order entering unit to attack the core
// entering unit will attack core depends on which team
if GetOwningPlayer( EnteringUnit ) == Player(5) then
call IssuePointOrderLocBJ( EnteringUnit, "attack", GetRectCenter( gg_rct_CreepsAttackMiddleFromBottomEvil ) )
else
call IssuePointOrderLocBJ( EnteringUnit, "attack", GetRectCenter( gg_rct_CreepsAttackMiddleFromBottomGood ) )
endif
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return ( GetUnitTypeId(GetEnteringUnit()) == CREEPS_ID )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterEnterRectSimple( Trg, gg_rct_BottomAttack )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CreepsTopBottomAttackMiddle initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function AllyPlayer6 takes nothing returns boolean
return IsPlayerAlly( GetOwningPlayer( GetFilterUnit( ) ), Player( 5 ) ) and ( GetUnitTypeId(GetFilterUnit()) == CREEPS_ID )
endfunction
private function AllyPlayer12 takes nothing returns boolean
return IsPlayerAlly( GetOwningPlayer( GetFilterUnit( ) ), Player( 11 ) ) and ( GetUnitTypeId(GetFilterUnit()) == CREEPS_ID )
endfunction
private function TriggerActions takes nothing returns nothing
local group Units
// order entering unit to attack the core
// entering unit will attack core depends on which team
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( Trg, 0.5 )
call TriggerAddAction( Trg, function TriggerActions )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=18
//TESH.alwaysfold=0
scope CreepsTopAttackMiddle initializer Init
// Trigger globals
globals
private integer id = 0
endglobals
// Trigger Action
private function AllyPlayer6 takes nothing returns boolean
return GetOwningPlayer( GetFilterUnit( ) ) == Player( 5 ) and ( GetUnitTypeId(GetFilterUnit()) == CREEPS_ID )
endfunction
private function AllyPlayer12 takes nothing returns boolean
return GetOwningPlayer( GetFilterUnit( ) ) == Player( 11 ) and ( GetUnitTypeId(GetFilterUnit()) == CREEPS_ID )
endfunction
private function TriggerActions takes nothing returns nothing
local group Units = CreateGroup( )
// order entering unit to attack the core
// entering unit will attack core depends on which team
set id = id + 1
if IsUnitDeadBJ( gg_unit_h006_0024 ) then
call GroupEnumUnitsInRect( Units, gg_rct_CreepsAttackMiddleFromTopGood, Condition( function AllyPlayer12 ) )
if CountUnitsInGroup( Units ) > 0 then
call GroupPointOrderLoc( Units, "attack", GetRectCenter( gg_rct_CreepsAttackCoreFromTopBottomGood ) )
endif
endif
call GroupClear( Units )
if IsUnitDeadBJ( gg_unit_h006_0025 ) then
call GroupEnumUnitsInRect( Units, gg_rct_CreepsAttackMiddleFromTopEvil, Condition( function AllyPlayer6 ) )
if CountUnitsInGroup( Units ) > 0 then
call GroupPointOrderLoc( Units, "attack", GetRectCenter( gg_rct_CreepsAttackCoreFromTopEvil ) )
endif
endif
call GroupClear( Units )
if IsUnitDeadBJ( gg_unit_h005_0009 ) then
call GroupEnumUnitsInRect( Units, gg_rct_CreepsAttackMiddleFromBottomGood, Condition( function AllyPlayer12 ) )
if CountUnitsInGroup( Units ) > 0 then
call GroupPointOrderLoc( Units, "attack", GetRectCenter( gg_rct_CreepsAttackCoreFromTopBottomGood ) )
endif
endif
call GroupClear( Units )
if IsUnitDeadBJ( gg_unit_h005_0022 ) then
call GroupEnumUnitsInRect( Units, gg_rct_CreepsAttackMiddleFromBottomEvil, Condition( function AllyPlayer6 ) )
if CountUnitsInGroup( Units ) > 0 then
call GroupPointOrderLoc( Units, "attack", GetRectCenter( gg_rct_CreepsAttackCoreFromBottomEvil ) )
endif
endif
call DestroyGroup( Units )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( Trg, 1 )
call TriggerAddAction( Trg, function TriggerActions )
set Trg = null
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CreepsAttackMiddleFromTopAndBottom initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions2 takes nothing returns nothing
local unit EnteringUnit = GetEnteringUnit()
// order entering unit to attack the core
// entering unit will attack core depends on which team
if GetOwningPlayer( EnteringUnit ) == Player(11) then
call IssuePointOrderLocBJ( EnteringUnit, "attack", GetUnitLoc( gg_unit_h005_0009 ) )
endif
set EnteringUnit = null
endfunction
private function TriggerActions1 takes nothing returns nothing
local unit EnteringUnit = GetEnteringUnit()
// order entering unit to attack the core
// entering unit will attack core depends on which team
if GetOwningPlayer( EnteringUnit ) == Player(5) then
call IssuePointOrderLocBJ( EnteringUnit, "attack", GetUnitLoc( gg_unit_h005_0022 ) )
endif
set EnteringUnit = null
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return ( GetUnitTypeId(GetEnteringUnit()) == CREEPS_ID )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg1 = CreateTrigger()
local trigger Trg2 = CreateTrigger()
local trigger Trg3 = CreateTrigger()
call TriggerRegisterEnterRectSimple( Trg1, gg_rct_CreepsAttackCoreFromTopBottomGood )
call TriggerAddCondition( Trg1, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg1, function TriggerActions2 )
call TriggerRegisterEnterRectSimple( Trg2, gg_rct_CreepsAttackCoreFromTopEvil )
call TriggerAddCondition( Trg2, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg2, function TriggerActions1 )
call TriggerRegisterEnterRectSimple( Trg3, gg_rct_CreepsAttackCoreFromBottomEvil )
call TriggerAddCondition( Trg3, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg3, function TriggerActions1 )
set Trg1 = null
set Trg2 = null
set Trg3 = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Initialization_Actions takes nothing returns nothing
local integer i = 0
call UnitAddAbilityBJ( 'Avul', gg_unit_h000_0046 )
call UnitAddAbilityBJ( 'Avul', gg_unit_h000_0014 )
//call CameraSetupApplyForPlayer( false, gg_cam_Camera, Player(0), 0 )
//call FogEnableOff( )
//call FogMaskEnableOff( )
for i = 0 to 11
set FogModifiers[i] = CreateFogModifierRectBJ( true, Player( i ), FOG_OF_WAR_VISIBLE, GetPlayableMapRect() )
endfor
endfunction
//===========================================================================
function InitTrig_Initialization takes nothing returns nothing
set gg_trg_Initialization = CreateTrigger( )
call TriggerAddAction( gg_trg_Initialization, function Trig_Initialization_Actions )
endfunction
//TESH.scrollpos=95
//TESH.alwaysfold=0
library Grenade
globals
private Table table
endglobals
struct Grenade
unit Caster
integer WhichUnitWillDie
player Owner
location BoomLocation
location CasterLocation
boolean IsHeal
real array radius[10]
real array damage[10]
private trigger Trigger
private group array Groups[10]
private integer GroupIndex
integer MissileSpeed
integer RadiusLength
string aftereffect
static method Create takes nothing returns Grenade
local Grenade this = Grenade.allocate( )
set table = Table.create( )
return this
endmethod
/*
private static method DamageGroups takes nothing returns nothing
call UnitDamageTargetBJ( this.Caster, GetEnumUnit(), this.damage[this.GroupIndex], ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endmethod
private static method FilterGroups takes nothing returns boolean
local Grenade this = Grenade.tThis
if GroupIndex > 0 then
return ( not IsUnitInGroup( GetFilterUnit(), this.Groups[this.GroupIndex - 1] ) ) and ( not IsPlayerAlly( GetOwningPlayer( GetDyingUnit( ) ), GetOwningPlayer( GetFilterUnit( ) ) ) )
else
return not IsPlayerAlly( GetOwningPlayer( GetDyingUnit( ) ), GetOwningPlayer( GetFilterUnit( ) ) )
endif
endmethod
*/
private static method DestroyUnitEffect takes nothing returns nothing
local effect whichEffect = table.effect[GetHandleId( GetExpiredTimer( ) )]
call DestroyEffect( whichEffect )
call DestroyTimer( GetExpiredTimer( ) )
set table.effect[GetHandleId( GetExpiredTimer( ) )] = null
set whichEffect = null
endmethod
private method IsUnitInEarlierGroups takes unit whichUnit, integer index returns boolean
local integer i
if index == 0 then
return false
endif
for i = 0 to index - 1
if ( IsUnitInGroup(whichUnit, this.Groups[i]) ) then
return true
endif
endfor
return false
endmethod
private method UnitIsNotMyDyingUnit takes unit whichUnit returns boolean
return ( GetUnitTypeId( whichUnit ) != this.WhichUnitWillDie )
endmethod
private method castex takes nothing returns nothing
local integer i
local unit EnumUnit
local group array tempGroups
local timer Timer
for i = 0 to this.RadiusLength - 1
set tempGroups[i] = CreateGroup( )
set this.Groups[i] = CreateGroup( )
call GroupClear( tempGroups[i] )
call GroupClear( this.Groups[i] )
call GroupEnumUnitsInRangeOfLoc( tempGroups[i], this.BoomLocation, this.radius[i], null )
for EnumUnit in tempGroups[i]
if this.IsHeal then
if ( not this.IsUnitInEarlierGroups( EnumUnit, i ) ) and ( IsPlayerAlly( GetOwningPlayer( EnumUnit ), this.Owner ) ) and this.UnitIsNotMyDyingUnit( EnumUnit ) then
call GroupAddUnit( this.Groups[i], EnumUnit )
endif
else
if ( not this.IsUnitInEarlierGroups( EnumUnit, i ) ) and ( not IsPlayerAlly( GetOwningPlayer( EnumUnit ), this.Owner ) ) then
call GroupAddUnit( this.Groups[i], EnumUnit )
endif
endif
endfor
endfor
for i = 0 to this.RadiusLength - 1
for EnumUnit in this.Groups[i]
if this.IsHeal then
set Timer = CreateTimer( )
call SetWidgetLife( EnumUnit, GetWidgetLife( EnumUnit ) + this.damage[this.GroupIndex] )
set table.effect[GetHandleId( Timer )] = AddSpecialEffectTarget( "Abilities\\Spells\\Items\\HealingSalve\\HealingSalveTarget.mdl", EnumUnit, "origin" )
call TimerStart( Timer, 1, false, function thistype.DestroyUnitEffect )
else
call UnitDamageTargetBJ( this.Caster, EnumUnit, this.damage[this.GroupIndex], ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
endfor
endfor
if (this.aftereffect != null) then
call AddSpecialEffectLoc( this.aftereffect, this.BoomLocation )
endif
// Nulls
for i = 0 to this.RadiusLength - 1
call DestroyGroup( this.Groups[i] )
endfor
call this.destroy( )
set Timer = null
set EnumUnit = null
for i = 0 to this.RadiusLength - 1
set tempGroups[i] = null
endfor
endmethod
method cast takes nothing returns nothing
// call BJDebugMsg( "bomb activate for player " + GetPlayerName( GetOwningPlayer( this.Caster ) ) )
set Owner = GetOwningPlayer( this.Caster )
// call BJDebugMsg( R2S( DistanceBetweenPoints( this.BoomLocation, this.CasterLocation ) / 1000 + 0.2 ) )
if ( this.MissileSpeed > 0 ) then
call PolledWait( DistanceBetweenPoints( this.BoomLocation, this.CasterLocation ) / this.MissileSpeed )
endif
call this.castex( )
endmethod
method destroy takes nothing returns nothing
// nulling
call this.deallocate()
endmethod
endstruct
/*
function DoThrowGrenade takes integer whichUnitWillDie, real radius01, real radius02, real radius03, real damage01, real damage02, real damage03 returns nothing
local trigger SpellFinishedTrigger = CreateTrigger( )
set gwhichUnitWillDie = whichUnitWillDie
set BoomLocation = GetSpellTargetLoc( )
set caster = GetSpellAbilityUnit( )
set owner = GetOwningPlayer( caster )
set gdamage01 = damage01
set gdamage02 = damage02
set gdamage03 = damage03
set gradius01 = radius01
set gradius02 = radius02
set gradius03 = radius03
set gtrigger = SpellFinishedTrigger
call TriggerRegisterAnyUnitEventBJ( SpellFinishedTrigger, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( SpellFinishedTrigger, Condition( function SpellFinishedTriggerCondition ) )
call TriggerAddAction( SpellFinishedTrigger, function SpellFinishedTriggerAction )
set SpellFinishedTrigger = null
endfunction
*/
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Grenade
struct Grenade extends array
unit Caster
unit WhichUnitWillDie
player Owner
location boomLoc
real array radius
real array damage
private trigger Trigger
private array group Groups
private GroupIndex
integer GroupLength
private method DamageGroups takes nothing returns nothing
call UnitDamageTargetBJ( Caster, GetEnumUnit(), damage[GroupIndex], ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endmethod
private method FilterGroups takes nothing returns boolean
if GroupIndex > 0 then
return ( not IsUnitInGroup( GetFilterUnit(), Groups[GroupIndex - 1] ) ) and ( not IsPlayerAlly( GetOwningPlayer( Caster ), GetOwningPlayer( GetFilterUnit( ) ) ) )
else
return not IsPlayerAlly( GetOwningPlayer( Caster ), GetOwningPlayer( GetFilterUnit( ) ) )
endif
endmethod
method cast takes nothing returns nothing
local integer i
for i = 0 to GroupLength
set Groups[i] = CreateGroup( )
set GroupIndex = i
call GroupEnumUnitsInRangeOfLoc( Groups[i], boomLoc, radius[i], Condition ( function FilterGroups ) )
endfor
for i = 0 to GroupLength
set GroupIndex = i
call ForGroup( Groups[i], function DamageGroups )
endfor
for i = 0 to GroupLength
call DestroyGroup( Groups[i] )
endfor
endmethod
endstruct
private function DamageGroup03 takes nothing returns nothing
call UnitDamageTargetBJ( caster, GetEnumUnit(), gdamage03, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction
private function DamageGroup02 takes nothing returns nothing
call UnitDamageTargetBJ( caster, GetEnumUnit(), gdamage02, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction
private function DamageGroup01 takes nothing returns nothing
call UnitDamageTargetBJ( caster, GetEnumUnit(), gdamage01, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction
private function FilterGroup03 takes nothing returns boolean
return not IsUnitInGroup( GetFilterUnit(), group02 ) and ( not IsPlayerAlly( GetOwningPlayer( caster ), GetOwningPlayer( GetFilterUnit( ) ) ) )
endfunction
private function FilterGroup02 takes nothing returns boolean
return not ( GetOwningPlayer( GetFilterUnit() ) == owner ) and ( not IsPlayerAlly( GetOwningPlayer( caster ), GetOwningPlayer( GetFilterUnit( ) ) ) )
endfunction
private function FilterGroup01 takes nothing returns boolean
return not ( GetOwningPlayer( GetFilterUnit() ) == owner ) and ( not IsPlayerAlly( GetOwningPlayer( caster ), GetOwningPlayer( GetFilterUnit( ) ) ) )
endfunction
private function SpellFinishedTriggerAction takes nothing returns nothing
call DestroyTrigger( gtrigger )
set group01 = CreateGroup( )
set group02 = CreateGroup( )
set group03 = CreateGroup( )
call GroupEnumUnitsInRangeOfLoc( group01, BoomLocation, gradius01, Condition ( function FilterGroup01 ) )
call GroupEnumUnitsInRangeOfLoc( group02, BoomLocation, gradius02, Condition ( function FilterGroup02 ) )
call GroupEnumUnitsInRangeOfLoc( group03, BoomLocation, gradius03, Condition ( function FilterGroup03 ) )
call ForGroup( group01, function DamageGroup01 )
call ForGroup( group02, function DamageGroup02 )
call ForGroup( group03, function DamageGroup03 )
call DestroyGroup( group01 )
call DestroyGroup( group02 )
call DestroyGroup( group03 )
set BoomLocation = null
set caster = null
set owner = null
endfunction
private function SpellFinishedTriggerCondition takes nothing returns boolean
return ( GetUnitTypeId(GetDyingUnit()) == gwhichUnitWillDie )
endfunction
function DoThrowGrenade takes integer whichUnitWillDie, real radius01, real radius02, real radius03, real damage01, real damage02, real damage03 returns nothing
local trigger SpellFinishedTrigger = CreateTrigger( )
set gwhichUnitWillDie = whichUnitWillDie
set BoomLocation = GetSpellTargetLoc( )
set caster = GetSpellAbilityUnit( )
set owner = GetOwningPlayer( caster )
set gdamage01 = damage01
set gdamage02 = damage02
set gdamage03 = damage03
set gradius01 = radius01
set gradius02 = radius02
set gradius03 = radius03
set gtrigger = SpellFinishedTrigger
call TriggerRegisterAnyUnitEventBJ( SpellFinishedTrigger, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( SpellFinishedTrigger, Condition( function SpellFinishedTriggerCondition ) )
call TriggerAddAction( SpellFinishedTrigger, function SpellFinishedTriggerAction )
set SpellFinishedTrigger = null
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope KamikazeDetonator initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local Grenade grenade = Grenade.Create( )
// set grenade values
set grenade.Caster = GetSpellAbilityUnit( )
set grenade.BoomLocation = GetUnitLoc( grenade.Caster )
set grenade.CasterLocation = GetUnitLoc( grenade.Caster )
set grenade.RadiusLength = 1
set grenade.radius[0] = 500
set grenade.damage[0] = 1850
set grenade.MissileSpeed = 0
set grenade.aftereffect = "NuclearExplosion.mdx"
set grenade.IsHeal = false
// call the grenade casting mechanism
call grenade.cast( )
call KillUnit( grenade.Caster )
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'KEDA' )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trg, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
set Trg = null
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope TNT initializer Init
// Trigger globals
globals
private constant integer UNITID = 'tBLU'
private constant real EXPLODE_DELAY = 2
private constant real EXPLODE_DAMAGE = 2500
private constant real EXPLODE_RADIUS = 1000
private Table table
endglobals
private function UnitIsNotMine takes nothing returns boolean
return ( GetUnitTypeId( GetFilterUnit( ) ) != UNITID )
endfunction
private function GetEnemyUnitsNearby takes player MinePlayer, location MineLocation returns group
local group TempNearbyUnits = CreateGroup( )
local group NearbyUnits = CreateGroup( )
local player UnitPlayer
local unit Unit
call GroupEnumUnitsInRangeOfLoc( TempNearbyUnits, MineLocation, EXPLODE_RADIUS, Condition( function UnitIsNotMine ) )
for Unit in TempNearbyUnits
set UnitPlayer = GetOwningPlayer( Unit )
if not IsPlayerAlly( UnitPlayer, MinePlayer ) then
call GroupAddUnit( NearbyUnits, Unit )
endif
endfor
set TempNearbyUnits = null
set UnitPlayer = null
set Unit = null
return NearbyUnits
endfunction
private function CountEnemyUnitsNearby takes player MinePlayer, location MineLocation returns integer
return CountUnitsInGroup( GetEnemyUnitsNearby( MinePlayer, MineLocation ) )
endfunction
// Trigger Action
private function MineDiedTriggerActions takes nothing returns nothing
local trigger TrgMineDied = GetTriggeringTrigger( )
local trigger TrgEnterRegion = table.trigger[GetHandleId( TrgMineDied )]
call table.remove(GetHandleId( TrgMineDied ))
call table.remove(GetHandleId( TrgEnterRegion ))
call table.remove(GetHandleId( TrgEnterRegion ) + 1)
call TriggerClearActions( TrgMineDied )
call TriggerClearActions( TrgEnterRegion )
set TrgMineDied = null
set TrgEnterRegion = null
endfunction
private function EnterRegionTriggerActions takes nothing returns nothing
local trigger TrgEnterRegion = GetTriggeringTrigger( )
local trigger TrgMineDied = table.trigger[GetHandleId( TrgEnterRegion )]
local unit Mine = table.unit[GetHandleId( TrgEnterRegion ) + 1]
local location MineLocation = GetUnitLoc( Mine )
local player MinePlayer = GetOwningPlayer( Mine )
local group NearbyUnits = CreateGroup( )
local unit Unit
local location UnitLocation
local player UnitPlayer
local real UnitsDistance = 0
local real damage = 0
local boolean IsDestroyTrigger = false
call DisableTrigger( TrgEnterRegion )
if CountEnemyUnitsNearby( MinePlayer, MineLocation ) > 0 then
call PolledWait( EXPLODE_DELAY )
set NearbyUnits = GetEnemyUnitsNearby( MinePlayer, MineLocation )
for Unit in NearbyUnits
set UnitLocation = GetUnitLoc( Unit )
set UnitsDistance = DistanceBetweenPoints( UnitLocation, MineLocation )
if ( UnitsDistance <= EXPLODE_RADIUS ) then
set damage = ( EXPLODE_RADIUS - UnitsDistance ) / EXPLODE_RADIUS * EXPLODE_DAMAGE
call UnitDamageTargetBJ( Mine, Unit, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
endfor
call AddSpecialEffectLoc( "NuclearExplosion.mdx", MineLocation )
call KillUnit( Mine )
set IsDestroyTrigger = true
endif
// nulls
call DestroyGroup( NearbyUnits )
set UnitPlayer = null
set UnitLocation = null
set Unit = null
set MinePlayer = null
set MineLocation = null
set Mine = null
if not IsDestroyTrigger then
call EnableTrigger( TrgEnterRegion )
endif
set TrgEnterRegion = null
endfunction
// Trigger Condition
private function EnterRegionTriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetEnteringUnit( ) ) != UNITID ) and ( not IsPlayerAlly( GetOwningPlayer( table.unit[GetHandleId( GetTriggeringTrigger( ) )] ), GetOwningPlayer( GetEnteringUnit( ) ) ) )
endfunction
// Trigger Action
private function SummonTriggerActions takes nothing returns nothing
local unit SummonUnit = GetSummonedUnit( )
local trigger TrgEnterRegion = CreateTrigger( )
local trigger TrgMineDied = CreateTrigger( )
local rect r = GetRectFromCircleBJ( GetUnitLoc( SummonUnit ), EXPLODE_RADIUS )
// this is so we can access TrgMineDied table from TrgEnterRegion and viceversa
set table.trigger[GetHandleId( TrgEnterRegion )] = TrgMineDied
set table.trigger[GetHandleId( TrgMineDied )] = TrgEnterRegion
set table.unit[GetHandleId( TrgEnterRegion ) + 1] = SummonUnit
// mine death event
call TriggerRegisterUnitEvent( TrgMineDied, SummonUnit, EVENT_UNIT_DEATH )
call TriggerAddAction( TrgMineDied, function MineDiedTriggerActions )
// unit enter region event
call TriggerRegisterEnterRectSimple( TrgEnterRegion, r )
if CountEnemyUnitsNearby( GetOwningPlayer( SummonUnit ), GetUnitLoc( SummonUnit ) ) > 0 then
call TriggerAddAction( TrgEnterRegion, function EnterRegionTriggerActions )
call TriggerExecute( TrgEnterRegion )
else
call TriggerAddCondition( TrgEnterRegion, Condition ( function EnterRegionTriggerConditions ) )
call TriggerAddAction( TrgEnterRegion, function EnterRegionTriggerActions )
endif
set TrgEnterRegion = null
set TrgMineDied = null
set SummonUnit = null
set r = null
endfunction
// Trigger Condition
private function SummonTriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetSummonedUnit( ) ) == UNITID )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Trg, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( Trg, Condition( function SummonTriggerConditions ) )
call TriggerAddAction( Trg, function SummonTriggerActions )
set table = Table.create( )
set Trg = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ParalyzeMine initializer Init
// Trigger globals
globals
private constant integer STUNABILID = 'PMSA'
private constant integer UNITID = 'pEMU'
private constant real EXPLODE_DELAY = 1.2
private constant real EXPLODE_RADIUS = 500
private Table table
endglobals
private function UnitIsNotMine takes nothing returns boolean
return ( GetUnitTypeId( GetFilterUnit( ) ) != UNITID )
endfunction
private function GetEnemyUnitsNearby takes player MinePlayer, location MineLocation returns group
local group TempNearbyUnits = CreateGroup( )
local group NearbyUnits = CreateGroup( )
local player UnitPlayer
local unit Unit
call GroupEnumUnitsInRangeOfLoc( TempNearbyUnits, MineLocation, EXPLODE_RADIUS, Condition( function UnitIsNotMine ) )
for Unit in TempNearbyUnits
set UnitPlayer = GetOwningPlayer( Unit )
if not IsPlayerAlly( UnitPlayer, MinePlayer ) then
call GroupAddUnit( NearbyUnits, Unit )
endif
endfor
set TempNearbyUnits = null
set UnitPlayer = null
set Unit = null
return NearbyUnits
endfunction
private function CountEnemyUnitsNearby takes player MinePlayer, location MineLocation returns integer
return CountUnitsInGroup( GetEnemyUnitsNearby( MinePlayer, MineLocation ) )
endfunction
// Trigger Action
private function MineDiedTriggerActions takes nothing returns nothing
local trigger TrgMineDied = GetTriggeringTrigger( )
local trigger TrgEnterRegion = table.trigger[GetHandleId( TrgMineDied )]
call table.remove(GetHandleId( TrgMineDied ))
call table.remove(GetHandleId( TrgEnterRegion ))
call table.remove(GetHandleId( TrgEnterRegion ) + 1)
call TriggerClearActions( TrgMineDied )
call TriggerClearActions( TrgEnterRegion )
set TrgMineDied = null
set TrgEnterRegion = null
endfunction
private function EnterRegionTriggerActions takes nothing returns nothing
local trigger TrgEnterRegion = GetTriggeringTrigger( )
local trigger TrgMineDied = table.trigger[GetHandleId( TrgEnterRegion )]
local unit Mine = table.unit[GetHandleId( TrgEnterRegion ) + 1]
local location MineLocation = GetUnitLoc( Mine )
local player MinePlayer = GetOwningPlayer( Mine )
local group TempNearbyUnits = CreateGroup( )
local group NearbyUnits = CreateGroup( )
local unit Unit
local location UnitLocation
local player UnitPlayer
local boolean IsDestroyTrigger = false
local unit Dummy
call DisableTrigger( TrgEnterRegion )
if CountEnemyUnitsNearby( MinePlayer, MineLocation ) > 0 then
//call BJDebugMsg("Paralize mine will explode in 1 seconds ")
call PolledWait( EXPLODE_DELAY )
//call BJDebugMsg("Paralize mine will now explode. ")
set NearbyUnits = GetEnemyUnitsNearby( MinePlayer, MineLocation )
for Unit in NearbyUnits
set UnitLocation = GetUnitLoc( Unit )
set UnitPlayer = GetOwningPlayer( Unit )
set Dummy = CreateUnitAtLoc( MinePlayer, 'dMMY', UnitLocation, 0 )
call UnitAddAbility( Dummy, STUNABILID )
call UnitApplyTimedLifeBJ( 0.10, 'BTLF', Dummy )
call IssueTargetOrder( Dummy, "thunderbolt", Unit )
endfor
call KillUnit( Mine )
set IsDestroyTrigger = true
endif
// nulls
call DestroyGroup( NearbyUnits )
call DestroyGroup( TempNearbyUnits )
set Dummy = null
set UnitPlayer = null
set UnitLocation = null
set Unit = null
set MinePlayer = null
set MineLocation = null
set Mine = null
if not IsDestroyTrigger then
call EnableTrigger( TrgEnterRegion )
endif
set TrgEnterRegion = null
endfunction
// Trigger Condition
private function EnterRegionTriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetEnteringUnit( ) ) != UNITID ) and ( not IsPlayerAlly( GetOwningPlayer( table.unit[GetHandleId( GetTriggeringTrigger( ) )] ), GetOwningPlayer( GetEnteringUnit( ) ) ) )
endfunction
// Trigger Action
private function SummonTriggerActions takes nothing returns nothing
local unit SummonUnit = GetSummonedUnit( )
local trigger TrgEnterRegion = CreateTrigger( )
local trigger TrgMineDied = CreateTrigger( )
local rect r = GetRectFromCircleBJ( GetUnitLoc( SummonUnit ), EXPLODE_RADIUS )
// this is so we can access TrgMineDied table from TrgEnterRegion and viceversa
set table.trigger[GetHandleId( TrgEnterRegion )] = TrgMineDied
set table.trigger[GetHandleId( TrgMineDied )] = TrgEnterRegion
set table.unit[GetHandleId( TrgEnterRegion ) + 1] = SummonUnit
call TriggerRegisterEnterRectSimple( TrgEnterRegion, r )
call TriggerAddCondition( TrgEnterRegion, Condition ( function EnterRegionTriggerConditions ) )
call TriggerAddAction( TrgEnterRegion, function EnterRegionTriggerActions )
call TriggerRegisterUnitEvent( TrgMineDied, SummonUnit, EVENT_UNIT_DEATH )
call TriggerAddAction( TrgMineDied, function MineDiedTriggerActions )
set TrgEnterRegion = null
set TrgMineDied = null
set SummonUnit = null
set r = null
endfunction
// Trigger Condition
private function SummonTriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetSummonedUnit( ) ) == UNITID )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Trg, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( Trg, Condition( function SummonTriggerConditions ) )
call TriggerAddAction( Trg, function SummonTriggerActions )
set table = Table.create( )
set Trg = null
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope SuperBlink initializer TriggerInitialize
globals
private constant integer SPELL_ID = 'SBLK'
endglobals
private function TriggerActions takes nothing returns nothing
local unit Caster = GetSpellAbilityUnit( )
local location TargetLoc = GetSpellTargetLoc( )
call SetUnitX( Caster, GetLocationX( TargetLoc ) )
call SetUnitY( Caster, GetLocationY( TargetLoc ) )
set Caster = null
set TargetLoc = null
endfunction
private function TriggerConditions takes nothing returns boolean
return ( GetSpellAbilityId() == SPELL_ID )
endfunction
// Trigger initializer
private function TriggerInitialize takes nothing returns nothing
local trigger Trigger = CreateTrigger( )
// Trigger Add Action
call TriggerRegisterAnyUnitEventBJ( Trigger, EVENT_PLAYER_UNIT_SPELL_CAST )
// Trigger Add Condition
call TriggerAddCondition( Trigger, Condition( function TriggerConditions ) )
// Trigger Add Action
call TriggerAddAction( Trigger, function TriggerActions )
set Trigger = null
endfunction
endscope
//TESH.scrollpos=54
//TESH.alwaysfold=0
scope TNT initializer Init
// Trigger globals
globals
private constant real RADIUS_1 = 200
private constant real RADIUS_2 = 400
private constant real RADIUS_3 = 600
private constant real RADIUS_4 = 800
private constant real RADIUS_5 = 1000
private constant real DAMAGE_1 = 500
private constant real DAMAGE_2 = 400
private constant real DAMAGE_3 = 300
private constant real DAMAGE_4 = 200
private constant real DAMAGE_5 = 100
private constant integer UNIT_ID = 'tBLU'
private constant real TNT_EXPLOSION_DELAY = 3
endglobals
private function GetOnlyUnits takes nothing returns boolean
return ( GetUnitTypeId( GetFilterUnit( ) ) != UNIT_ID )
endfunction
private function GetOnlyMines takes nothing returns boolean
return ( GetUnitTypeId( GetFilterUnit( ) ) == UNIT_ID )
endfunction
private function TriggerActions takes nothing returns nothing
local group Mines = CreateGroup( )
local unit Mine
local group UnitsNearby = CreateGroup( )
local group TempUnitsNearby = CreateGroup( )
local unit UnitNearby
local integer EnemyNearbyCount = 0
local real damage = 0
call GroupEnumUnitsInRect( Mines, GetPlayableMapRect( ), Condition( function GetOnlyMines ) )
for Mine in Mines
set EnemyNearbyCount = 0
call GroupEnumUnitsInRect( TempUnitsNearby, GetRectFromCircleBJ( GetUnitLoc( Mine ), RADIUS_5 ), Condition( function GetOnlyUnits ) )
for UnitNearby in TempUnitsNearby
if ( not IsPlayerAlly( GetOwningPlayer( UnitNearby ), GetOwningPlayer( Mine ) ) ) then
call GroupAddUnit( UnitsNearby, UnitNearby )
set EnemyNearbyCount = EnemyNearbyCount + 1
endif
endfor
if EnemyNearbyCount > 0 then
for UnitNearby in UnitsNearby
if ( DistanceBetweenPoints( GetUnitLoc( UnitNearby ), GetUnitLoc( Mine ) ) <= RADIUS_1 ) then
set damage = DAMAGE_1
elseif ( DistanceBetweenPoints( GetUnitLoc( UnitNearby ), GetUnitLoc( Mine ) ) <= RADIUS_2 ) then
set damage = DAMAGE_2
elseif ( DistanceBetweenPoints( GetUnitLoc( UnitNearby ), GetUnitLoc( Mine ) ) <= RADIUS_3 ) then
set damage = DAMAGE_3
elseif ( DistanceBetweenPoints( GetUnitLoc( UnitNearby ), GetUnitLoc( Mine ) ) <= RADIUS_4 ) then
set damage = DAMAGE_4
elseif ( DistanceBetweenPoints( GetUnitLoc( UnitNearby ), GetUnitLoc( Mine ) ) <= RADIUS_5 ) then
set damage = DAMAGE_5
endif
call UnitDamageTargetBJ( Mine, UnitNearby, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfor
call AddSpecialEffectLoc( "NuclearExplosion.mdx", GetUnitLoc( Mine ) )
call KillUnit( Mine )
endif
endfor
set UnitsNearby = null
set TempUnitsNearby = null
set Mines = null
call TimerStart( GetExpiredTimer(), 0.5, false, function TriggerActions )
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetSummonedUnit( ) ) == UNIT_ID )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
call TimerStart( CreateTimer( ), 0.5, false, function TriggerActions )
// preloading effects
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope GoblinLandMine initializer Init
// Trigger globals
globals
private constant integer UNITID = 'gLMU'
private constant real EXPLODE_DELAY = 0.5
private constant real EXPLODE_DAMAGE = 350
private constant real EXPLODE_RADIUS = 225
private Table table
endglobals
private function UnitIsNotMine takes nothing returns boolean
return ( GetUnitTypeId( GetFilterUnit( ) ) != UNITID )
endfunction
private function GetEnemyUnitsNearby takes player MinePlayer, location MineLocation returns group
local group TempNearbyUnits = CreateGroup( )
local group NearbyUnits = CreateGroup( )
local player UnitPlayer
local unit Unit
call GroupEnumUnitsInRangeOfLoc( TempNearbyUnits, MineLocation, EXPLODE_RADIUS, Condition( function UnitIsNotMine ) )
for Unit in TempNearbyUnits
set UnitPlayer = GetOwningPlayer( Unit )
if not IsPlayerAlly( UnitPlayer, MinePlayer ) then
call GroupAddUnit( NearbyUnits, Unit )
endif
endfor
set TempNearbyUnits = null
set UnitPlayer = null
set Unit = null
return NearbyUnits
endfunction
private function CountEnemyUnitsNearby takes player MinePlayer, location MineLocation returns integer
return CountUnitsInGroup( GetEnemyUnitsNearby( MinePlayer, MineLocation ) )
endfunction
// Trigger Action
private function MineDiedTriggerActions takes nothing returns nothing
local trigger TrgMineDied = GetTriggeringTrigger( )
local trigger TrgEnterRegion = table.trigger[GetHandleId( TrgMineDied )]
call table.remove(GetHandleId( TrgMineDied ))
call table.remove(GetHandleId( TrgEnterRegion ))
call table.remove(GetHandleId( TrgEnterRegion ) + 1)
call TriggerClearActions( TrgMineDied )
call TriggerClearActions( TrgEnterRegion )
set TrgMineDied = null
set TrgEnterRegion = null
endfunction
private function EnterRegionTriggerActions takes nothing returns nothing
local trigger TrgEnterRegion = GetTriggeringTrigger( )
local trigger TrgMineDied = table.trigger[GetHandleId( TrgEnterRegion )]
local unit Mine = table.unit[GetHandleId( TrgEnterRegion ) + 1]
local location MineLocation = GetUnitLoc( Mine )
local player MinePlayer = GetOwningPlayer( Mine )
local group NearbyUnits = CreateGroup( )
local unit Unit
local location UnitLocation
local player UnitPlayer
local real UnitsDistance = 0
local real damage = 0
local boolean IsDestroyTrigger = false
call DisableTrigger( TrgEnterRegion )
if CountEnemyUnitsNearby( MinePlayer, MineLocation ) > 0 then
call PolledWait( EXPLODE_DELAY )
set NearbyUnits = GetEnemyUnitsNearby( MinePlayer, MineLocation )
for Unit in NearbyUnits
set UnitLocation = GetUnitLoc( Unit )
set UnitsDistance = DistanceBetweenPoints( UnitLocation, MineLocation )
if ( UnitsDistance <= EXPLODE_RADIUS ) then
set damage = ( EXPLODE_RADIUS - UnitsDistance ) / EXPLODE_RADIUS * EXPLODE_DAMAGE
call UnitDamageTargetBJ( Mine, Unit, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
endfor
call AddSpecialEffectLoc( "Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl", MineLocation )
call KillUnit( Mine )
set IsDestroyTrigger = true
endif
// nulls
call DestroyGroup( NearbyUnits )
set UnitPlayer = null
set UnitLocation = null
set Unit = null
set MinePlayer = null
set MineLocation = null
set Mine = null
if not IsDestroyTrigger then
call EnableTrigger( TrgEnterRegion )
endif
set TrgEnterRegion = null
endfunction
// Trigger Condition
private function EnterRegionTriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetEnteringUnit( ) ) != UNITID ) and ( not IsPlayerAlly( GetOwningPlayer( table.unit[GetHandleId( GetTriggeringTrigger( ) )] ), GetOwningPlayer( GetEnteringUnit( ) ) ) )
endfunction
// Trigger Action
private function SummonTriggerActions takes nothing returns nothing
local unit SummonUnit = GetSummonedUnit( )
local trigger TrgEnterRegion = CreateTrigger( )
local trigger TrgMineDied = CreateTrigger( )
local rect r = GetRectFromCircleBJ( GetUnitLoc( SummonUnit ), EXPLODE_RADIUS )
// this is so we can access TrgMineDied table from TrgEnterRegion and viceversa
set table.trigger[GetHandleId( TrgEnterRegion )] = TrgMineDied
set table.trigger[GetHandleId( TrgMineDied )] = TrgEnterRegion
set table.unit[GetHandleId( TrgEnterRegion ) + 1] = SummonUnit
// mine death event
call TriggerRegisterUnitEvent( TrgMineDied, SummonUnit, EVENT_UNIT_DEATH )
call TriggerAddAction( TrgMineDied, function MineDiedTriggerActions )
// unit enter region event
call TriggerRegisterEnterRectSimple( TrgEnterRegion, r )
if CountEnemyUnitsNearby( GetOwningPlayer( SummonUnit ), GetUnitLoc( SummonUnit ) ) > 0 then
call TriggerAddAction( TrgEnterRegion, function EnterRegionTriggerActions )
call TriggerExecute( TrgEnterRegion )
else
call TriggerAddCondition( TrgEnterRegion, Condition ( function EnterRegionTriggerConditions ) )
call TriggerAddAction( TrgEnterRegion, function EnterRegionTriggerActions )
endif
set TrgEnterRegion = null
set TrgMineDied = null
set SummonUnit = null
set r = null
endfunction
// Trigger Condition
private function SummonTriggerConditions takes nothing returns boolean
return ( GetUnitTypeId( GetSummonedUnit( ) ) == UNITID )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Trg, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( Trg, Condition( function SummonTriggerConditions ) )
call TriggerAddAction( Trg, function SummonTriggerActions )
set table = Table.create( )
set Trg = null
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
function Trig_Pinapple_Grenade_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A001' )
endfunction
function Trig_Pinapple_Grenade_Actions takes nothing returns nothing
local Grenade grenade = Grenade.Create( )
// set grenade values
set grenade.Caster = GetSpellAbilityUnit( )
set grenade.WhichUnitWillDie = 'n001'
set grenade.BoomLocation = GetSpellTargetLoc( )
set grenade.CasterLocation = GetUnitLoc( grenade.Caster )
set grenade.RadiusLength = 3
set grenade.radius[0] = 40
set grenade.radius[1] = 100
set grenade.radius[2] = 225
set grenade.damage[0] = 250
set grenade.damage[1] = 90
set grenade.damage[2] = 10
set grenade.MissileSpeed = 1150
set grenade.IsHeal = false
set grenade.aftereffect = null
// call the grenade casting mechanism
call grenade.cast( )
// doThrowGrenade( whichUnitWillDie, range01, range02, range03, damage01, damage02, damage03 )
// call DoThrowGrenade( 'n001', 100, 200, 300, 300, 200, 100 )
endfunction
function InitTrig_Pinapple_Grenade takes nothing returns nothing
set gg_trg_Pinapple_Grenade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Pinapple_Grenade, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Pinapple_Grenade, Condition( function Trig_Pinapple_Grenade_Conditions ) )
call TriggerAddAction( gg_trg_Pinapple_Grenade, function Trig_Pinapple_Grenade_Actions )
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=0
scope HEGrenade initializer Init
// Trigger globals
globals
endglobals
// Trigger Action
private function TriggerActions takes nothing returns nothing
local Grenade grenade = Grenade.Create( )
// set grenade values
set grenade.Caster = GetSpellAbilityUnit( )
set grenade.WhichUnitWillDie = 'hEGU'
set grenade.BoomLocation = GetSpellTargetLoc( )
set grenade.CasterLocation = GetUnitLoc( grenade.Caster )
set grenade.RadiusLength = 5
set grenade.radius[0] = 110
set grenade.radius[1] = 220
set grenade.radius[2] = 330
set grenade.radius[3] = 440
set grenade.radius[4] = 550
set grenade.damage[0] = 1700
set grenade.damage[1] = 1440
set grenade.damage[2] = 780
set grenade.damage[3] = 420
set grenade.damage[4] = 260
set grenade.MissileSpeed = 240
set grenade.IsHeal = false
set grenade.aftereffect = "NuclearExplosion.mdx"
// call the grenade casting mechanism
call grenade.cast( )
endfunction
// Trigger Condition
private function TriggerConditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'HEGA' )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trg, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( Trg, Condition( function TriggerConditions ) )
call TriggerAddAction( Trg, function TriggerActions )
set Trg = null
endfunction
endscope
/*
function Trig_Pinapple_Grenade_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A001' )
endfunction
function Trig_Pinapple_Grenade_Actions takes nothing returns nothing
local Grenade grenade = Grenade.Create( )
// set grenade values
set grenade.Caster = GetSpellAbilityUnit( )
set grenade.WhichUnitWillDie = 'n001'
set grenade.BoomLocation = GetSpellTargetLoc( )
set grenade.CasterLocation = GetUnitLoc( grenade.Caster )
set grenade.RadiusLength = 3
set grenade.radius[0] = 100
set grenade.radius[1] = 200
set grenade.radius[2] = 300
set grenade.damage[0] = 300
set grenade.damage[1] = 200
set grenade.damage[2] = 100
set grenade.MissileSpeed = 1000
// call the grenade casting mechanism
call grenade.cast( )
// doThrowGrenade( whichUnitWillDie, range01, range02, range03, damage01, damage02, damage03 )
// call DoThrowGrenade( 'n001', 100, 200, 300, 300, 200, 100 )
endfunction
function InitTrig_Pinapple_Grenade takes nothing returns nothing
set gg_trg_Pinapple_Grenade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Pinapple_Grenade, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Pinapple_Grenade, Condition( function Trig_Pinapple_Grenade_Conditions ) )
call TriggerAddAction( gg_trg_Pinapple_Grenade, function Trig_Pinapple_Grenade_Actions )
endfunction
*/
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Health_Grenade_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'HGEA' )
endfunction
function Trig_Health_Grenade_Actions takes nothing returns nothing
local Grenade grenade = Grenade.Create( )
//call BJDebugMsg("enter")
// set grenade values
set grenade.Caster = GetSpellAbilityUnit( )
set grenade.WhichUnitWillDie = 'n002'
set grenade.BoomLocation = GetSpellTargetLoc( )
set grenade.CasterLocation = GetUnitLoc( grenade.Caster )
set grenade.RadiusLength = 1
set grenade.radius[0] = 330
set grenade.damage[0] = 1500
set grenade.IsHeal = true
set grenade.MissileSpeed = 1200
set grenade.aftereffect = null
// call the grenade casting mechanism
call grenade.cast( )
endfunction
function InitTrig_Health_Grenade takes nothing returns nothing
set gg_trg_Health_Grenade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Health_Grenade, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Health_Grenade, Condition( function Trig_Health_Grenade_Conditions ) )
call TriggerAddAction( gg_trg_Health_Grenade, function Trig_Health_Grenade_Actions )
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope StickyGrenade initializer Init
globals
private constant integer SPELL_ID = 'A001'
endglobals
private function DamageGroup03 takes nothing returns nothing
endfunction
private function DamageGroup02 takes nothing returns nothing
endfunction
private function DamageGroup01 takes nothing returns nothing
endfunction
private function TriggerActions takes nothing returns nothing
// add the actions of your spell here
endfunction
private function TriggerConditions takes nothing returns boolean
return ( GetSpellAbilityId( ) == SPELL_ID )
endfunction
private function Init takes nothing returns nothing
local trigger StickyGrenadeTrg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(StickyGrenadeTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(StickyGrenadeTrg, Condition( function TriggerConditions ) )
call TriggerAddAction( StickyGrenadeTrg, function TriggerActions )
// setting globals
// preloading effects
endfunction
endscope
//TESH.scrollpos=27
//TESH.alwaysfold=0
scope GoldRewardPeriodically initializer Init
// Trigger Action
private function TriggerActions2 takes nothing returns nothing
local integer i
local integer CurrentGold
local player whichPlayer
for i = 6 to 10
set whichPlayer = Player( i )
set CurrentGold = GetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_GOLD)
call SetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_GOLD, CurrentGold + GOLD_REWARD_PERIODICALLY)
endfor
set whichPlayer = null
endfunction
// Trigger Condition
private function TriggerConditions2 takes nothing returns boolean
return IsUnitAliveBJ( gg_unit_h002_0016 )
endfunction
// Trigger Action
private function TriggerActions1 takes nothing returns nothing
local integer i
local integer CurrentGold
local player whichPlayer
for i = 0 to 4
set whichPlayer = Player( i )
set CurrentGold = GetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_GOLD)
call SetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_GOLD, CurrentGold + GOLD_REWARD_PERIODICALLY)
endfor
set whichPlayer = null
endfunction
// Trigger Condition
private function TriggerConditions1 takes nothing returns boolean
return IsUnitAliveBJ( gg_unit_h002_0004 )
endfunction
// Trigger Initializer
private function Init takes nothing returns nothing
local trigger Trg1 = CreateTrigger()
local trigger Trg2 = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( Trg1, GOLD_REWARD_DELAY )
call TriggerAddCondition( Trg1, Condition ( function TriggerConditions1 ) )
call TriggerAddAction( Trg1, function TriggerActions1 )
call TriggerRegisterTimerEventPeriodic( Trg2, GOLD_REWARD_DELAY )
call TriggerAddCondition( Trg2, Condition ( function TriggerConditions2 ) )
call TriggerAddAction( Trg2, function TriggerActions2 )
set Trg1 = null
set Trg2 = null
endfunction
endscope