//TESH.scrollpos=574
//TESH.alwaysfold=0
function GetHost takes nothing returns nothing
local gamecache g = InitGameCache("Map.w3v")
call StoreInteger ( g, "Map", "Host", GetPlayerId(GetLocalPlayer ())+1)
call TriggerSyncStart ()
call SyncStoredInteger ( g, "Map", "Host" )
call TriggerSyncReady ()
set udg_Host = Player( GetStoredInteger ( g, "Map", "Host" )-1)
call FlushGameCache( g )
set g = null
endfunction
globals
hashtable abc = InitHashtable()
endglobals
// ##########///#########################################
// ######################################################
// ### THEMERION'S SCRIPTS BEGIN HERE
// ######################################################
// #############################***######################
library MS
function MS_ItemTest2 takes real x, real y, item i returns boolean
local real dx
local real dy
local boolean wantDestroy=false
if(i==null) then
set i=CreateItem('rde1',x,y)
set wantDestroy=true
else
call SetItemPosition(i,x,y)
endif
set dx=x-GetItemX(i)
set dy=y-GetItemY(i)
if(wantDestroy) then
call RemoveItem(i)
endif
if(dx*dx+dy*dy>100) then
return false
endif
return true
endfunction
function MS_GetClearDistanceForFloat1 takes real x, real y, real distance_max, real angle returns real
local item itm=CreateItem('rde1',0,0)
local real dx=10*CosBJ(angle)
local real dy=10*SinBJ(angle)
local real x_start=x
local real y_start=y
local real r2=distance_max*distance_max
loop
set x=x+dx
set y=y+dy
if r2<=(x-x_start)*(x-x_start)+(y-y_start)*(y-y_start) or MS_ItemTest2(x,y,itm)==false then
set x=x-dx
set y=y-dy
exitwhen true
endif
endloop
call RemoveItem(itm)
set itm=null
return SquareRoot((x-x_start)*(x-x_start)+(y-y_start)*(y-y_start))
endfunction
endlibrary
//===================================================================
// #####
// ## FINISH SYSTEM
// #####
function FinishConditions takes nothing returns boolean
local real hp = GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit())
local real hp_minus_dmg = ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) - GetEventDamage() )
if(hp_minus_dmg > 0.5) then
if(GetUnitUserData( GetTriggerUnit() ) == 8) then
if(hp_minus_dmg < 80.0) then
return true
endif
endif
endif
return false
endfunction
function FinishAction takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer pid = GetConvertedPlayerId(GetOwningPlayer(u))
local trigger trg = GetTriggeringTrigger()
local texttag tt
call DisableTrigger(trg)
call TriggerExecute(gg_trg_Finish_HimHer)
call TriggerSleepAction(0.02)
set tt = udg_FinishHimText
call TriggerSleepAction(4.98)
call DestroyTextTagBJ(tt)
set tt = null
if(udg_IsUnderFinishEffect[pid]) then
call SetUnitMoveSpeed( u, GetUnitDefaultMoveSpeed(u) )
set udg_IsUnderFinishEffect[pid]=false
endif
call TriggerSleepAction(10)
call EnableTrigger(trg)
set trg = null
set u = null
endfunction
function RegisterUnitForFinishSystem takes unit u returns trigger
local trigger trg = CreateTrigger()
local integer trgi
call SetUnitUserData( u, 8 )
call TriggerRegisterUnitEvent( trg, u, EVENT_UNIT_DAMAGED )
call TriggerAddCondition( trg, Condition( function FinishConditions ) )
call TriggerAddAction( trg, function FinishAction )
set trgi = GetHandleId(trg)
return trg
endfunction
//#####
//## GOLD SYSTEM
//#####
function GGTG_loop takes nothing returns nothing
call AdjustPlayerStateBJ( udg_GoldAmount, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD )
endfunction
function GiveGoldToForce takes integer gold, force f returns nothing
local integer players_count = CountPlayersInForceBJ(f)
if(players_count > 0) then
set udg_GoldAmount = ( gold / players_count)
call ForForce( f, function GGTG_loop )
endif
endfunction
function ShowGoldTextOnUnit takes integer gold, force f, unit u returns nothing
local texttag tt = CreateTextTagUnitBJ( ( "+" + I2S(gold) ) , u, 0.00, 10.00, 100.00, 90.00, 0.00, 0.00 )
call ShowTextTagForceBJ( false, tt, GetPlayersAll() )
call ShowTextTagForceBJ( true, tt, f )
call SetTextTagPermanentBJ( tt, false )
call SetTextTagVelocityBJ( tt, 90.00, 90 )
call SetTextTagLifespanBJ( tt, 2.00 )
call SetTextTagFadepointBJ( tt, 1.00 )
set tt = null
endfunction
function GiveGoldToForceStaticShowText takes integer gold, force f, unit u returns nothing
local integer players_count = CountPlayersInForceBJ(f)
if(players_count > 0) then
set udg_GoldAmount = gold
call ForForce( f, function GGTG_loop )
call ShowGoldTextOnUnit(udg_GoldAmount,f,u)
endif
endfunction
function GiveGoldToForceShowText takes integer gold, force f, unit u returns nothing
call GiveGoldToForce(gold,f)
call ShowGoldTextOnUnit(udg_GoldAmount,f,u)
endfunction
// ######################################################
// ######################################################
// ### Skripte von AL_Murder_X beginnen hier ############
// ######################################################
// ######################################################
//===================================================================
///////////////////////////////////////////////////////////////
///////////// Effekte über eine Zeit erstellen //////////////
///////////////////////////////////////////////////////////////
library Effect //uses TimerUtils
//untested
globals
private hashtable my_hash=InitHashtable()
endglobals
private function child takes nothing returns nothing
local timer t=GetExpiredTimer()
local effect e=LoadEffectHandle(my_hash, GetHandleId(t), 0)
call RemoveSavedHandle(my_hash, GetHandleId(t), 0)
call DestroyEffect(e)
call PauseTimer(t)
call DestroyTimer(t)
set t=null
set e=null
endfunction
function AddEffectToLocTimed takes string sfx, real x, real y, real time returns nothing
local timer t=CreateTimer()
call SaveEffectHandle(my_hash, GetHandleId(t), 0, AddSpecialEffect(sfx, x, y))
call TimerStart(t, time, false, function child)
endfunction
function AddEffectToUnitTimed takes string e, string a, unit u, real time returns nothing
local timer t=CreateTimer()
call SaveEffectHandle(my_hash, GetHandleId(t), 0, AddSpecialEffectTargetUnitBJ( a, u, e ))
call TimerStart(t, time, false, function child)
endfunction
function CircleOfEffectTimed takes integer r , integer n , real x , real y , string e , real t returns nothing
local location l
local integer c = 1
local integer cEnd = n
local real x1
local real y1
loop
exitwhen c > cEnd
set l = PolarProjectionBJ(Location(x, y), r, ( I2R(c) * (360.00 / I2R(n)) ))
set x1 = GetLocationX(l)
set y1 = GetLocationY(l)
call AddEffectToLocTimed(e,x1,y1,t)
set l = null
call RemoveLocation(l)
set c = c + 1
endloop
endfunction
endlibrary
///////////////////////////////////////////////////////////////
///////////// Fähigkeit hinzufügen über Zeit //////////////
///////////////////////////////////////////////////////////////
library Ability
globals
private hashtable ab_hash=InitHashtable()
endglobals
private function child takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer ab = LoadInteger(ab_hash, GetHandleId(t), 0)
local unit u = LoadUnitHandle(ab_hash, GetHandleId(t), 1)
call UnitRemoveAbility( u, ab )
call RemoveSavedHandle(ab_hash, GetHandleId(t), 0)
call RemoveSavedHandle(ab_hash, GetHandleId(t), 1)
call PauseTimer(t)
call DestroyTimer(t)
set t=null
endfunction
function AddAbilityToUnitTimed takes integer a , unit u, integer i returns nothing
local timer t=CreateTimer()
call UnitAddAbility( u, a )
call SaveInteger(ab_hash, GetHandleId(t), 0, a)
call SaveUnitHandle(ab_hash, GetHandleId(t), 1, u)
call TimerStart(t, i, false, function child)
endfunction
function AddAbilityToUnitTimedLevel takes integer a , unit u, integer i, integer l returns nothing
local timer t=CreateTimer()
call UnitAddAbility( u, a )
call SetUnitAbilityLevelSwapped( a, u, l )
call SaveInteger(ab_hash, GetHandleId(t), 0, a)
call SaveUnitHandle(ab_hash, GetHandleId(t), 1, u)
call TimerStart(t, i, false, function child)
endfunction
endlibrary
///////////////////////////////////////////////////////////////
/////////////Substring aus einem String entfernen//////////////
///////////////////////////////////////////////////////////////
function Deletesubstring takes string a, string b returns string
local string c = ""
local integer i = 1
loop
exitwhen i > StringLength(a)
if ( b == SubStringBJ(a, i, ( i + (StringLength(b) -1) )) ) then
set i = ( i + (StringLength(b) -1) )
else
set c = ( c + SubStringBJ(a, i, i) )
endif
set i = i + 1
endloop
return c
endfunction
///////////////////////////////////////////////////////////////
///////////// Random Hero Functions //////////////
///////////////////////////////////////////////////////////////
// Random Light Melee erzeugen
function createrandomLM takes player p, integer team returns nothing
local integer i
local integer m
local unit u
local string s
local real x1 = GetLocationX(GetRectCenter(gg_rct_SentinelReselectHeroArea))
local real y1 = GetLocationY(GetRectCenter(gg_rct_SentinelReselectHeroArea))
local real x2 = GetLocationX(GetRectCenter(gg_rct_DF_Hero_Spawn))
local real y2 = GetLocationY(GetRectCenter(gg_rct_DF_Hero_Spawn))
if team == 2 then
set i = GetRandomInt(1, StringLength(udg_List_Heroes_Scourge[1]))
else
set i = GetRandomInt(1, StringLength(udg_List_Heroes_Sentinels[1]))
endif
set m = ModuloInteger(i, 2)
if m == 0 then
if team == 2 then
set s = SubStringBJ(udg_List_Heroes_Scourge[1], (i - 1), i)
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Scourge_LM[i], x2, y2, 270 )
set udg_List_Heroes_Scourge[1] = (Deletesubstring(udg_List_Heroes_Scourge[1],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Scourge_LM[i], gg_unit_e00M_0018 )
else
set s = SubStringBJ(udg_List_Heroes_Sentinels[1], (i - 1), i)
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Sent_Lightmelee[i], x1, y1, 270 )
set udg_List_Heroes_Sentinels[1] = (Deletesubstring(udg_List_Heroes_Sentinels[1],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Sent_Lightmelee[i], gg_unit_e00I_0201 )
endif
else
if team == 2 then
set s = SubStringBJ(udg_List_Heroes_Scourge[1], i, (i + 1))
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Scourge_LM[i], x2, y2, 270 )
set udg_List_Heroes_Scourge[1] = (Deletesubstring(udg_List_Heroes_Scourge[1],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Scourge_LM[i], gg_unit_e00M_0018 )
else
set s = SubStringBJ(udg_List_Heroes_Sentinels[1], i, (i + 1))
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Sent_Lightmelee[i], x1, y1, 270 )
set udg_List_Heroes_Sentinels[1] = (Deletesubstring(udg_List_Heroes_Sentinels[1],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Sent_Lightmelee[i], gg_unit_e00I_0201 )
endif
endif
set udg_FinishTriggers[GetConvertedPlayerId(GetOwningPlayer(u))] = RegisterUnitForFinishSystem(u)
set udg_Player_Hero[GetConvertedPlayerId(p)] = u
call UnitAddItemByIdSwapped( 'I04J', u )
call UnitAddItemByIdSwapped( 'I04K', u )
call SetHeroLevelBJ( u, udg_GM_Start_Level, false )
endfunction
// Random Melee erzeugen
function createrandomM takes player p, integer team returns nothing
local integer i
local integer m
local unit u
local string s
local real x1 = GetLocationX(GetRectCenter(gg_rct_SentinelReselectHeroArea))
local real y1 = GetLocationY(GetRectCenter(gg_rct_SentinelReselectHeroArea))
local real x2 = GetLocationX(GetRectCenter(gg_rct_DF_Hero_Spawn))
local real y2 = GetLocationY(GetRectCenter(gg_rct_DF_Hero_Spawn))
if team == 2 then
set i = GetRandomInt(1, StringLength(udg_List_Heroes_Scourge[2]))
else
set i = GetRandomInt(1, StringLength(udg_List_Heroes_Sentinels[2]))
endif
set m = ModuloInteger(i, 2)
if m == 0 then
if team == 2 then
set s = SubStringBJ(udg_List_Heroes_Scourge[2], (i - 1), i)
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Scourge_M[i], x2, y2, 270 )
set udg_List_Heroes_Scourge[2] = (Deletesubstring(udg_List_Heroes_Scourge[2],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Scourge_M[i], gg_unit_e004_0015 )
else
set s = SubStringBJ(udg_List_Heroes_Sentinels[2], (i - 1), i)
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Sent_Melee[i], x1, y1, 270 )
set udg_List_Heroes_Sentinels[2] = (Deletesubstring(udg_List_Heroes_Sentinels[2],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Sent_Melee[i], gg_unit_e000_0193 )
endif
else
if team == 2 then
set s = SubStringBJ(udg_List_Heroes_Scourge[2], i, (i + 1))
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Scourge_M[i], x2, y2, 270 )
set udg_List_Heroes_Scourge[2] = (Deletesubstring(udg_List_Heroes_Scourge[2],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Scourge_M[i], gg_unit_e004_0015 )
else
set s = SubStringBJ(udg_List_Heroes_Sentinels[2], i, (i + 1))
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Sent_Melee[i], x1, y1, 270 )
set udg_List_Heroes_Sentinels[2] = (Deletesubstring(udg_List_Heroes_Sentinels[2],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Sent_Melee[i], gg_unit_e000_0193 )
endif
endif
set udg_FinishTriggers[GetConvertedPlayerId(GetOwningPlayer(u))] = RegisterUnitForFinishSystem(u)
set udg_Player_Hero[GetConvertedPlayerId(p)] = u
call UnitAddItemByIdSwapped( 'I04J', u )
call UnitAddItemByIdSwapped( 'I04K', u )
call SetHeroLevelBJ( u, udg_GM_Start_Level, false )
endfunction
// Random Heavy Melee erzeugen
function createrandomHM takes player p, integer team returns nothing
local integer i
local integer m
local unit u
local string s
local real x1 = GetLocationX(GetRectCenter(gg_rct_SentinelReselectHeroArea))
local real y1 = GetLocationY(GetRectCenter(gg_rct_SentinelReselectHeroArea))
local real x2 = GetLocationX(GetRectCenter(gg_rct_DF_Hero_Spawn))
local real y2 = GetLocationY(GetRectCenter(gg_rct_DF_Hero_Spawn))
if team == 2 then
set i = GetRandomInt(1, StringLength(udg_List_Heroes_Scourge[3]))
else
set i = GetRandomInt(1, StringLength(udg_List_Heroes_Sentinels[3]))
endif
set m = ModuloInteger(i, 2)
if m == 0 then
if team == 2 then
set s = SubStringBJ(udg_List_Heroes_Scourge[3], (i - 1), i)
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Scourge_HM[i], x2, y2, 270 )
set udg_List_Heroes_Scourge[3] = (Deletesubstring(udg_List_Heroes_Scourge[3],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Scourge_HM[i], gg_unit_e004_0015 )
else
set s = SubStringBJ(udg_List_Heroes_Sentinels[3], (i - 1), i)
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Sent_Heavy_Melee[i], x1, y1, 270 )
set udg_List_Heroes_Sentinels[3] = (Deletesubstring(udg_List_Heroes_Sentinels[3],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Sent_Heavy_Melee[i], gg_unit_e000_0193 )
endif
else
if team == 2 then
set s = SubStringBJ(udg_List_Heroes_Scourge[3], i, (i + 1))
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Scourge_HM[i], x2, y2, 270 )
set udg_List_Heroes_Scourge[3] = (Deletesubstring(udg_List_Heroes_Scourge[3],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Scourge_HM[i], gg_unit_e004_0015 )
else
set s = SubStringBJ(udg_List_Heroes_Sentinels[3], i, (i + 1))
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Sent_Heavy_Melee[i], x1, y1, 270 )
set udg_List_Heroes_Sentinels[3] = (Deletesubstring(udg_List_Heroes_Sentinels[3],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Sent_Heavy_Melee[i], gg_unit_e000_0193 )
endif
endif
set udg_FinishTriggers[GetConvertedPlayerId(GetOwningPlayer(u))] = RegisterUnitForFinishSystem(u)
set udg_Player_Hero[GetConvertedPlayerId(p)] = u
call UnitAddItemByIdSwapped( 'I04J', u )
call UnitAddItemByIdSwapped( 'I04K', u )
call SetHeroLevelBJ( u, udg_GM_Start_Level, false )
endfunction
// Random Ranger erzeugen
function createrandomR takes player p, integer team returns nothing
local integer i
local integer m
local unit u
local string s
local real x1 = GetLocationX(GetRectCenter(gg_rct_SentinelReselectHeroArea))
local real y1 = GetLocationY(GetRectCenter(gg_rct_SentinelReselectHeroArea))
local real x2 = GetLocationX(GetRectCenter(gg_rct_DF_Hero_Spawn))
local real y2 = GetLocationY(GetRectCenter(gg_rct_DF_Hero_Spawn))
if team == 2 then
set i = GetRandomInt(1, StringLength(udg_List_Heroes_Scourge[4]))
else
set i = GetRandomInt(1, StringLength(udg_List_Heroes_Sentinels[4]))
endif
set m = ModuloInteger(i, 2)
if m == 0 then
if team == 2 then
set s = SubStringBJ(udg_List_Heroes_Scourge[4], (i - 1), i)
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Scourge_R[i], x2, y2, 270 )
set udg_List_Heroes_Scourge[4] = (Deletesubstring(udg_List_Heroes_Scourge[4],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Scourge_R[i], gg_unit_e003_0016 )
else
set s = SubStringBJ(udg_List_Heroes_Sentinels[4], (i - 1), i)
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Sent_Ranger[i], x1, y1, 270 )
set udg_List_Heroes_Sentinels[4] = (Deletesubstring(udg_List_Heroes_Sentinels[4],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Sent_Ranger[i], gg_unit_e006_0203 )
endif
else
if team == 2 then
set s = SubStringBJ(udg_List_Heroes_Scourge[4], i, (i + 1))
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Scourge_R[i], x2, y2, 270 )
set udg_List_Heroes_Scourge[4] = (Deletesubstring(udg_List_Heroes_Scourge[4],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Scourge_R[i], gg_unit_e003_0016 )
else
set s = SubStringBJ(udg_List_Heroes_Sentinels[4], i, (i + 1))
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Sent_Ranger[i], x1, y1, 270 )
set udg_List_Heroes_Sentinels[4] = (Deletesubstring(udg_List_Heroes_Sentinels[4],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Sent_Ranger[i], gg_unit_e006_0203 )
endif
endif
set udg_FinishTriggers[GetConvertedPlayerId(GetOwningPlayer(u))] = RegisterUnitForFinishSystem(u)
set udg_Player_Hero[GetConvertedPlayerId(p)] = u
call UnitAddItemByIdSwapped( 'I04J', u )
call UnitAddItemByIdSwapped( 'I04K', u )
call SetHeroLevelBJ( u, udg_GM_Start_Level, false )
endfunction
// Random Caster erzeugen
function createrandomC takes player p, integer team returns nothing
local integer i
local integer m
local unit u
local string s
local real x1 = GetLocationX(GetRectCenter(gg_rct_SentinelReselectHeroArea))
local real y1 = GetLocationY(GetRectCenter(gg_rct_SentinelReselectHeroArea))
local real x2 = GetLocationX(GetRectCenter(gg_rct_DF_Hero_Spawn))
local real y2 = GetLocationY(GetRectCenter(gg_rct_DF_Hero_Spawn))
if team == 2 then
set i = GetRandomInt(1, StringLength(udg_List_Heroes_Scourge[5]))
else
set i = GetRandomInt(1, StringLength(udg_List_Heroes_Sentinels[5]))
endif
set m = ModuloInteger(i, 2)
if m == 0 then
if team == 2 then
set s = SubStringBJ(udg_List_Heroes_Scourge[5], (i - 1), i)
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Scourge_C[i], x2, y2, 270 )
set udg_List_Heroes_Scourge[5] = (Deletesubstring(udg_List_Heroes_Scourge[5],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Scourge_C[i], gg_unit_e007_0017 )
else
set s = SubStringBJ(udg_List_Heroes_Sentinels[5], (i - 1), i)
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Sent_Caster[i], x1, y1, 270 )
set udg_List_Heroes_Sentinels[5] = (Deletesubstring(udg_List_Heroes_Sentinels[5],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Sent_Caster[i], gg_unit_e001_0202 )
endif
else
if team == 2 then
set s = SubStringBJ(udg_List_Heroes_Scourge[5], i, (i + 1))
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Scourge_C[i], x2, y2, 270 )
set udg_List_Heroes_Scourge[5] = (Deletesubstring(udg_List_Heroes_Scourge[5],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Scourge_C[i], gg_unit_e007_0017 )
else
set s = SubStringBJ(udg_List_Heroes_Sentinels[5], i, (i + 1))
set i = S2I(s)
set u = CreateUnit ( p, udg_List_Hero_Sent_Caster[i], x1, y1, 270 )
set udg_List_Heroes_Sentinels[5] = (Deletesubstring(udg_List_Heroes_Sentinels[5],s))
call RemoveUnitFromStockBJ( udg_List_Hero_Sent_Caster[i], gg_unit_e001_0202 )
endif
endif
set udg_Player_Hero[GetConvertedPlayerId(p)] = u
set udg_FinishTriggers[GetConvertedPlayerId(GetOwningPlayer(u))] = RegisterUnitForFinishSystem(u)
call UnitAddItemByIdSwapped( 'I04J', u )
call UnitAddItemByIdSwapped( 'I04K', u )
call SetHeroLevelBJ( u, udg_GM_Start_Level, false )
endfunction
Name | Type | is_array | initial_value |
Abb_UnholyStrength_Level | integer | No | |
Ability_Cache | gamecache | No | |
Ability_ChaosStrike | unit | No | |
Ability_Charged_Arrow_Casting | boolean | No | |
Ability_Charged_Arrow_Dummy | unit | Yes | |
Ability_Charged_Arrow_Int | integer | No | |
Ability_Charged_Arrow_Loc | location | No | |
Ability_Charged_Arrow_Unit | unit | No | |
Ability_ColorSpray | unit | Yes | |
Ability_Divine_Soul_Item | itemcode | Yes | |
Ability_Focused_Shot_Caster | unit | No | |
Ability_Focused_Shot_Channel | boolean | No | |
Ability_Focused_Shot_Target | unit | No | |
Ability_Frost_Death_DummySpell | abilcode | Yes | |
Ability_Frostpfeil | unit | No | |
Ability_IcePrison | unit | No | |
Ability_Level_Chainexplosion | integer | Yes | |
Ability_Level_Fireblast | integer | Yes | |
Ability_Level_Firespray | integer | Yes | |
Ability_Shadowform | abilcode | Yes | |
Ability_Soul_Lance_Dummy | abilcode | Yes | |
Ability_Strafe | unit | No | |
Ability_Strafe_Bone | unit | No | |
Ability_Strafe_ON | boolean | No | |
Ability_Strafe_ON_Bone | boolean | No | |
Ability_Tremor_Level | integer | No | |
Ability_Unholy_Protection | itemcode | Yes | |
Ability_Unholy_Strength_Dummy | abilcode | Yes | |
Ability_Wisp_Dummyunit | unit | Yes | |
Ability_Wisp_Unit | unit | Yes | |
Aktueller_Pfeiltyp | abilcode | No | |
Aktueller_Pfeiltyp_Dummy | abilcode | No | |
Aktueller_Pfeiltyp_Multishot_A | abilcode | No | |
Aktueller_Pfeiltyp_Multishot_U | unitcode | No | |
All_Skeletons | group | No | |
ArcaneFeedback_Caster | unit | No | |
Ass_Hero_Taken_Group | force | Yes | |
Ass_Punkte | integer | Yes | |
AttackLocations | location | Yes | |
BountyLevelFactor | integer | No | |
cache | gamecache | No | |
Caster_AbsorbFire | unit | No | |
Caster_Blooddrain | unit | No | |
Caster_BloodOmen | unit | No | |
Caster_ChaosGolem | unit | No | |
Caster_Cleric | unit | No | |
Caster_CorpseEater | unit | No | |
Caster_Deathbringer | unit | No | |
Caster_Deathknight | unit | No | |
Caster_Demonlord | unit | No | |
Caster_Fleshgolem | unit | No | |
Caster_Frostbat | unit | No | |
Caster_MoonShadow | unit | No | |
Caster_Multishot | unit | No | |
Caster_Myrmidon | unit | No | |
Caster_Necromancer | unit | No | |
Caster_ShadowDancer | unit | No | |
Caster_ShadowFiend | unit | No | |
Caster_Stormcaller | unit | No | |
Caster_Tremor | unit | No | |
clockstring | string | No | |
CorpseBombTarget | unit | No | |
Creep_X | real | Yes | |
Creep_Y | real | Yes | |
CreepGroup | group | Yes | |
CreepGroup1 | group | No | |
CreepGroup10 | group | No | |
CreepGroup11 | group | No | |
CreepGroup12 | group | No | |
CreepGroup13 | group | No | |
CreepGroup2 | group | No | |
CreepGroup3 | group | No | |
CreepGroup4 | group | No | |
CreepGroup5 | group | No | |
CreepGroup6 | group | No | |
CreepGroup7 | group | No | |
CreepGroup8 | group | No | |
CreepGroup9 | group | No | |
CreepGroup_Count | integer | Yes | |
CreepGroup_Point | location | Yes | |
CreepGroup_UnitLevel | integer | Yes | |
CreepsColor | string | No | |
Damage_Indicator | unit | Yes | |
Dash_Ability | abilcode | Yes | |
Deathclaw_target | unit | No | |
DeathMatchCondition | boolean | No | |
Deaths | integer | Yes | |
DoubleKills | integer | Yes | |
DoubleKillsTimer | integer | Yes | |
Dryad_Caster | unit | No | |
Dummy_IcePrison | unit | No | |
Dummy_PoisonNova | unit | No | |
Effect_Tremor | effect | No | |
Einheitengruppe | group | No | |
Einheitengruppe_Copy | group | No | |
FeebleMind | unit | No | |
FeebleMind_Intdrain | integer | No | |
FinishHimText | texttag | No | |
FinishTriggers | trigger | Yes | |
FrostMaidensWearers | group | No | |
GameMode_Custom_1 | dialog | No | |
GameMode_Custom_2 | dialog | No | |
GameMode_Custom_3 | dialog | No | |
GameMode_Custom_4 | dialog | No | |
GameMode_Main | dialog | No | |
GameStarted | boolean | No | |
Gletscharius | unit | No | |
GM_Custom_1_Level | button | Yes | |
GM_Custom_2_Gold | button | Yes | |
GM_Custom_3_Selection | button | Yes | |
GM_Custom_4_Bounty | button | Yes | |
GM_Main_CustomGame | button | No | |
GM_Main_SmartRandom | button | No | |
GM_Main_Standard | button | No | |
GM_Main_XCash | button | No | |
GM_Start_Gold | integer | No | 2500 |
GM_Start_Level | integer | No | 1 |
GoldAmount | integer | No | |
Hamstring_Target | unit | No | |
HasRandomized | boolean | Yes | |
Hero_Tod | boolean | Yes | |
HeroLevel | integer | Yes | |
Host | player | No | |
hours | integer | No | |
IceSorm_Caster | unit | No | |
Icons_Scourge | string | Yes | |
Icons_Sentinel | string | Yes | |
IsUnderFinishEffect | boolean | Yes | |
Item_Drops | itemcode | Yes | |
ItemLoc | location | No | |
Kill_Killer | player | No | |
Kill_Killer_Unit | unit | No | |
Kill_Messages | string | Yes | |
Kill_Victem | player | No | |
Kill_Victem_Unit | unit | No | |
KillingSpree | integer | Yes | |
KillingSpreeDyingColor | string | No | |
KillingSpreeKillerColor | string | No | |
Kills | integer | Yes | |
List_Ability_Moonshadow | abilcode | Yes | |
List_Hero_Scourge_C | unitcode | Yes | |
List_Hero_Scourge_HM | unitcode | Yes | |
List_Hero_Scourge_LM | unitcode | Yes | |
List_Hero_Scourge_M | unitcode | Yes | |
List_Hero_Scourge_R | unitcode | Yes | |
List_Hero_Sent_Caster | unitcode | Yes | |
List_Hero_Sent_Heavy_Melee | unitcode | Yes | |
List_Hero_Sent_Lightmelee | unitcode | Yes | |
List_Hero_Sent_Melee | unitcode | Yes | |
List_Hero_Sent_Ranger | unitcode | Yes | |
List_Heroes_Scourge | string | Yes | |
List_Heroes_Sentinels | string | Yes | |
List_Scourgel_HeroAltar | unit | Yes | |
List_Sentinel_HeroAltar | unit | Yes | |
Local_Caster_Unit | unit | No | |
Local_Dummy_Unit | unit | No | |
Local_Location | location | No | |
Local_Target | unit | No | |
Lvl_Blooddrain | integer | No | |
ManaBomb_Caster | unit | No | |
ManaBomb_Damage | integer | No | |
ManaBomb_Target | unit | No | |
ManaControl_Sorceress | unit | No | |
ManaSwap_CasterMana | integer | No | |
ManaSwap_TargetMana | integer | No | |
MB_String_Health | string | Yes | |
MB_String_Mana | string | Yes | |
Megatonstrike_target | unit | No | |
Mindblast | unit | No | |
minutes | integer | No | |
MultiB_1 | multiboard | No | |
MultiB_2_T1 | multiboard | No | |
MultiB_2_T2 | multiboard | No | |
MultiBoard | multiboard | No | |
Multishot_Target | unit | No | |
MummyDust | unit | No | |
Nerethar | unit | No | |
Owner_Tremor | player | No | |
Player10Color | string | No | |
Player11Color | string | No | |
Player12Color | string | No | |
Player1Color | string | No | |
Player2Color | string | No | |
Player3Color | string | No | |
Player4Color | string | No | |
Player5Color | string | No | |
Player6Color | string | No | |
Player7Color | string | No | |
Player8Color | string | No | |
Player9Color | string | No | |
Player_Hero | unit | Yes | |
Player_Names | string | Yes | |
PlayerColors | string | Yes | |
PlayersScourge | force | No | |
PlayersSentinel | force | No | |
R_Scourge_Hydra | boolean | No | |
R_Scourge_Khessu | boolean | No | |
R_Sentinel_Hydra | boolean | No | |
R_Sentinel_Khessu | boolean | No | |
RandomElementSkel | unitcode | Yes | |
RandomItemDrop | itemcode | Yes | |
RepickingPlayer | player | No | |
RevivalTimer | integer | Yes | |
RevivalTimerTrigger | trigger | Yes | |
Scourge_Citadel | boolean | No | |
ScourgeForcesDeaths | integer | No | |
ScourgeForcesKills | integer | No | |
ScourgeMeleeStruct | group | No | |
ScourgeRangedStruct | group | No | |
seconds | integer | No | |
Sentinel_Citadel | boolean | No | |
SentinelForcesDeaths | integer | No | |
SentinelForcesKills | integer | No | |
SentinelMeleeStruct | group | No | |
SentinelRangedStruct | group | No | |
ShadowDancer | unit | Yes | |
Shaman_Shield | boolean | No | |
SinglePlayer | boolean | No | |
Sinister_Strike | unit | No | |
Snipe | unit | No | |
Sniper_Hero | unit | No | |
Soul_Lance | unit | No | |
Soul_Lance_lvl | integer | No | |
Soul_Lance_Steal | unit | No | |
SoulDrain | unit | No | |
SpawnLocations | location | Yes | |
StoneForm | unit | No | |
Stored_Unit | unit | Yes | |
Summon_Auto_Walk | boolean | Yes | true |
SwapNELeft | unit | No | |
SwapNERight | unit | No | |
SwapUSLeft | unit | No | |
SwapUSRight | unit | No | |
Target_AbsorbFire | unit | No | |
Target_Blooddrain | unit | No | |
Target_BloodOmen | unit | No | |
Temp_RandomPlayer | player | No | |
TempAbi | abilcode | No | |
TempAbi2 | abilcode | No | |
TempBool | boolean | No | |
TempEffect | effect | No | |
TempForce | force | No | |
TempForce2 | force | No | |
TempGroup | group | No | |
TempInt | integer | No | |
TempInt2 | integer | No | |
TempInt3 | integer | No | |
TempIntegerArray | integer | Yes | |
TempItem | item | No | |
TempItem2 | item | No | |
TempLoc | location | No | |
TempMath | integer | Yes | |
TempPlayer | player | No | |
TempPoint | location | No | |
TempRandom | integer | No | |
TempRandom2 | integer | Yes | |
TempReal | real | No | |
tempRect | rect | No | |
TempString | string | Yes | |
tempUnit | unit | No | |
TempUnit1 | unit | No | |
TempUnit2 | unit | No | |
Tempunit_SpellshieldTarget | unit | No | |
TempUnitType | unitcode | No | |
Test | heroskillcode | No | |
Timer_Spawntimer | timer | No | |
Tod_Held | unit | No | |
TouchOfDoom_Target | unit | No | |
Towers | group | No | |
Unholy_Strenght | unit | No | |
Unholy_Strenght_lvl | integer | No | |
Unholy_Strenght_Steal | unit | No | |
UnholyStrength | unit | No |
//TESH.scrollpos=108
//TESH.alwaysfold=0
// CREEP RESPAWN SYSTEM v2.6
// Made by Themerion
// http://www.wc3campaigns.net/showthread.php?t=90302
//
// The creep respawn system automates the creation of respawning creep groups.
// (when there are no creeps left in the group, the group will respawn after X seconds)
//
// Needs AutoIndex (by grim001)
// http://www.wc3c.net/showthread.php?t=105643
// -----------------------------------------------------------------------------------------
//
// - Very simple to use.
// - Respawning creeps will remember their original position, facing and acquisition range.
// - Supports randomly spawning a group from a list of pre-defined setups.
// - Has the possibility to suspend respawn if certain units are too close to the spawn point.
// - The respawn will detect unit death, changed ownership, RemoveUnit and ReplaceUnit.
//
// -----------------------------------------------------------------------------------------
//##### BASIC USAGE #####
//#
//# -----------------------------------------------------------------------------------------
//# function CRS_CreateGroup takes rect r returns crsGroupSimple
//# -----------------------------------------------------------------------------------------
//# * Setups all units in the region/rect to respawn as a group.
//# * If the units in the group have campaign acquisition range,
//# they will remember it on respawn.
//######
//##### SPAWN DIFFERENT UNITS #####
//#
//# -----------------------------------------------------------------------------------------
//# function CRS_CreateSetup takes rect r returns crsSetup
//# -----------------------------------------------------------------------------------------
//# * Creates a setup of the units in the rect/region.
//# * Recently created Setups are stored in a list.
//# * Calling CRS_ClearSetups() will empty the list.
//#
//# -----------------------------------------------------------------------------------------
//# function CRS_CreateListGroup takes rect r, boolean random, boolean campaginRange returns crsListGroup
//# function CRS_CreateListGroupXY takes real x, real y, boolean random, boolean campaginRange returns crsListGroup
//# -----------------------------------------------------------------------------------------
//# * Creates a list group, which automatically is assigned the last created setup list.
//# * The group spawns instantly.
//# * random determines whether to spawn a random setup from the list, or spawn them in order.
//# * If campaignRange is true the units will spawn with campaign acquisition range.
//#
//#
//######
//##### IMPORTANT UNITS #####
//#
//# -----------------------------------------------------------------------------------------
//# function CRS_AddImportantUnit takes unit u returns nothing
//# function CRS_RemoveImportantUnit takes unit u returns nothing
//# -----------------------------------------------------------------------------------------
//# * Creep groups' respawn will be suspended if an important unit is too close.
//#####
//##### CUSTOM RESPAWN TIME #####
//#
//# -----------------------------------------------------------------------------------------
//# integer crsGroup.respawnTime
//# -----------------------------------------------------------------------------------------
//# * Sets a group's respawn time (defaults to CRS_DEFAULT_RESPAWN_TIME).
//#####
//##### MISC #####
//#
//# -----------------------------------------------------------------------------------------
//# method crsGroup.spawn()
//# -----------------------------------------------------------------------------------------
//#
//# * Instantly spawns the group. Calling it when the group is not dead
//# will cause the group to be larger until killed off.
//#
//# -----------------------------------------------------------------------------------------
//# group crsGroup.units
//# -----------------------------------------------------------------------------------------
//#
//# * Returns all the units still in the group.
//# * DO NOT alter this group.
//#
//# -----------------------------------------------------------------------------------------
//# integer crsGroup.count
//# -----------------------------------------------------------------------------------------
//#
//# * Is basically CountUnitsInGroup(crsGroup.unit), but faster.
//# * DO NOT alter this number.
//######
library CreepRespawn initializer Init needs AutoIndex
globals
//=================================================================
// SETUP
//=================================================================
// Default respawn time for creep groups (seconds).
private constant integer CRS_DEFAULT_RESPAWN_TIME=60
// If you use important units.
// How far away must all important units be for the group to respawn?
// ( If you press 'G' in the terrain editor; 512 is the width/height of a yellow square. )
private constant real CRS_IMPORTANT_DISTANCE=1000
// Campaign acquire range for creeps.
constant integer CRS_CAMPAIGN_ACQUIRE_RANGE=200
// Well, if you for some reason would not like to respawn Neutral Hostile,
// change this into the player you want to respawn.
constant integer CRS_RESPAWNING_PLAYER=PLAYER_NEUTRAL_AGGRESSIVE
// PS. The setup-funtions will only detect the player chosen here.
// Neutral Passive = PLAYER_NEUTRAL_PASSIVE
// Neutral Hostile = PLAYER_NEUTRAL_AGRESSIVE
// Neutral Extra = bj_PLAYER_NEUTARL_EXTRA
// Neutral Victim = bj_PLAYER_NEUTARL_VICTIM
//=================================================================
// END OF SETUP
//=================================================================
private trigger trg
private boolexpr setupFilter
private crsGroup first=0
private timer respawn_timer
private group important_group
endglobals
// ====================== For the unit attaching =======================
globals
crsGroup array CRS_groupOfUnit
endglobals
//! textmacro CRS_AttachGroupToUnit takes GROUP, UNIT
set CRS_groupOfUnit[GetUnitId($UNIT$)]=$GROUP$
//! endtextmacro
//! textmacro CRS_GetGroupOfUnit takes GROUP, UNIT
set $GROUP$=CRS_groupOfUnit[GetUnitId($UNIT$)]
//! endtextmacro
//! textmacro CRS_CleanData takes UNIT
set CRS_groupOfUnit[GetUnitId($UNIT$)]=0
//! endtextmacro
// ===================================================================
//! textmacro crs_DestroyGroup
call ForGroup(.units,function EnumClean)
call DestroyGroup(.units)
call CRS_RemoveFromSpawnList(this)
//! endtextmacro
//! textmacro CRS_InitGroup takes A
set $A$.respawnTime=CRS_DEFAULT_RESPAWN_TIME
set $A$.time=-1
set $A$.units=CreateGroup()
//! endtextmacro
globals
private real rect_x
private real rect_y
private boolean temp_b
endglobals
private function CheckForImportantUnitsEnum takes nothing returns nothing
local real x=GetUnitX(GetEnumUnit())-rect_x
local real y=GetUnitY(GetEnumUnit())-rect_y
if GetWidgetLife(GetEnumUnit())>.405 and x*x+y*y<CRS_IMPORTANT_DISTANCE*CRS_IMPORTANT_DISTANCE then
set temp_b=false
return
endif
endfunction
private function CheckForImportantUnits takes real x, real y returns boolean
set rect_x=x
set rect_y=y
set temp_b=true
call ForGroup(important_group,function CheckForImportantUnitsEnum)
return temp_b
endfunction
private function RespawnTix takes nothing returns nothing
local crsGroup cd=first
local crsGroup prev=0
loop
exitwhen cd==0
if cd.time<=0 then
// Respawn...
if CheckForImportantUnits(cd.x,cd.y) then
if prev==0 then
set first=cd.next
else
set prev.next=cd.next
endif
call cd.spawn()
endif
else
// Count down...
set cd.time=cd.time-1
set prev=cd
endif
set cd=cd.next
endloop
endfunction
private function EnumClean takes nothing returns nothing
//! runtextmacro CRS_CleanData("GetEnumUnit()")
endfunction
function CRS_RemoveFromSpawnList takes crsGroup g returns nothing
local crsGroup prev=0
local crsGroup cg=first
loop
exitwhen cg==0
if cg==g then
// Remove g
if prev==0 then
set first=g.next
else
set prev.next=g.next
endif
exitwhen true
endif
set prev=cg
set cg=cg.next
endloop
endfunction
// ====================================================================================
struct crsUnitData
real x
real y
real face
integer uid
crsUnitData next=0
static method create takes integer unitid, real x, real y, real face returns crsUnitData
local crsUnitData c=crsUnitData.allocate()
set c.uid=unitid
set c.x=x
set c.y=y
set c.face=face
return c
endmethod
endstruct
// =====================================================================================
// struct crsSetup
globals
private crsGroup tempGroup
private crsUnitData setupUnitData
private crsUnitData setupTempData
private real tempX
private real tempY
private group emptyGroup
endglobals
private function SetupFilter takes nothing returns boolean
local unit u = GetFilterUnit()
if GetOwningPlayer(u)==Player(CRS_RESPAWNING_PLAYER) and GetWidgetLife(u)>.405 then
// Create a new data instance, and put it first in the list.
set setupUnitData=crsUnitData.create(GetUnitTypeId(u),GetUnitX(u)-tempX,GetUnitY(u)-tempY,GetUnitFacing(u))
set setupUnitData.next=setupTempData
set setupTempData=setupUnitData
// If we're initializing a single group, make it respawnable.
if tempGroup!=0 then
//! runtextmacro CRS_AttachGroupToUnit("tempGroup","u")
call GroupAddUnit(tempGroup.units,u)
set tempGroup.count=tempGroup.count+1
set u=null
return true
endif
endif
set u=null
return false
endfunction
struct crsSetup
// How many groups are using this setup?
integer refcount=0
// If no groups use the setup, should it be destroyed?
boolean destroyOnZero=true
crsSetup next=0
crsUnitData unitData=0
static method create takes rect r, crsGroup cg returns crsSetup
local crsSetup cs=crsSetup.allocate()
// Loops through all the units in the rect,
// adding them to the setup.
set tempX=GetRectCenterX(r)
set tempY=GetRectCenterY(r)
set tempGroup = cg
set setupTempData = 0
// If we're creating a setup for a single group.
// Do the group a favor and fill the unit group up!
if cg!=0 then
call GroupEnumUnitsInRect(cg.units,r,setupFilter)
else
call GroupEnumUnitsInRect(emptyGroup,r,setupFilter)
endif
set cs.unitData=setupUnitData
return cs
endmethod
method release takes nothing returns nothing
if .destroyOnZero and .refcount<=1 then
call .destroy()
else
set .refcount=.refcount-1
endif
endmethod
method onDestroy takes nothing returns nothing
local crsUnitData cud=.unitData
local crsUnitData temp
loop
exitwhen cud==0
set temp=cud.next
call cud.destroy()
set cud=temp
endloop
endmethod
endstruct
// =====================================================================================
interface crsGroup
real x
real y
integer time
integer respawnTime
integer count=0
group units
boolean longAcquireRange=true
crsSetup setup=0
crsGroup next=0
method spawn takes nothing returns nothing
endinterface
private function crsGroup_Spawn takes crsGroup cg, crsSetup cs returns nothing
local crsUnitData ud=cs.unitData
local unit u
// If the group is in the respawn list,
// that is, the .spawn()-call was manually triggered by the user
// remove it from the list.
if cg.time>0 then
call CRS_RemoveFromSpawnList(cg)
endif
loop
exitwhen ud==0
set u=CreateUnit(Player(CRS_RESPAWNING_PLAYER),ud.uid,ud.x+cg.x,ud.y+cg.y,ud.face)
//! runtextmacro CRS_AttachGroupToUnit("cg","u")
call GroupAddUnit(cg.units,u)
set cg.count=cg.count+1
if cg.longAcquireRange==false then
call SetUnitAcquireRange(u,CRS_CAMPAIGN_ACQUIRE_RANGE)
endif
set ud=ud.next
endloop
set u=null
endfunction
// =====================================================================================
struct crsListGroup extends crsGroup
crsSetup listPointer
integer length=0
static method create takes real x, real y, crsSetup setup, integer listPointer returns crsListGroup
local crsListGroup cg=crsListGroup.allocate()
local crsSetup cs=setup
set cg.x=x
set cg.y=y
set cg.setup=setup
set cg.listPointer=listPointer
loop
exitwhen cs==0
set cs.refcount=cs.refcount+1
set cg.length=cg.length+1
set cs=cs.next
endloop
//! runtextmacro CRS_InitGroup("cg")
return cg
endmethod
method spawn takes nothing returns nothing
local integer i=1
local crsSetup pickedSetup=.setup
if .listPointer==0 then
// random-spawn
set i=GetRandomInt(1,.length)
loop
exitwhen i==1
set pickedSetup=pickedSetup.next
set i=i-1
endloop
else
// linear spawn
set .listPointer=.listPointer.next
if .listPointer==0 then
set .listPointer=.setup
endif
set pickedSetup=.listPointer
endif
call crsGroup_Spawn(this,pickedSetup)
endmethod
method onDestroy takes nothing returns nothing
local crsSetup cs=.setup
local crsSetup temp
//! runtextmacro crs_DestroyGroup()
loop
exitwhen cs==0
set temp=cs.next
call cs.release()
set cs=temp
endloop
endmethod
endstruct
// =====================================================================================
struct crsGroupSimple extends crsGroup
static method create takes real x, real y, crsSetup setup returns crsGroupSimple
local crsGroupSimple cd=crsGroupSimple.allocate()
set cd.x=x
set cd.y=y
set cd.setup=setup
set setup.refcount=setup.refcount+1
//! runtextmacro CRS_InitGroup("cd")
return cd
endmethod
static method createStub takes nothing returns crsGroupSimple
local crsGroupSimple cd=crsGroupSimple.allocate()
//! runtextmacro CRS_InitGroup("cd")
return cd
endmethod
method spawn takes nothing returns nothing
call crsGroup_Spawn(this,this.setup)
endmethod
method onDestroy takes nothing returns nothing
//! runtextmacro crs_DestroyGroup()
call .setup.release()
endmethod
endstruct
// =====================================================================================
// On leave may also called by AutoIndex, detecting RemoveUnits.
public function OnLeave takes unit u returns nothing
local crsGroup d
//! runtextmacro CRS_GetGroupOfUnit("d","u")
if d!=0 then
//! runtextmacro CRS_CleanData("u")
call GroupRemoveUnit(d.units,u)
set d.count=d.count-1
if d.count<=0 then
set d.time=d.respawnTime
// Add to respawn list
set d.next=first
set first=d
endif
endif
endfunction
private function Action takes nothing returns boolean
// This isn't really needed for AutoIndex.
// I decided to leave it, in case someone wants to port CRS to a less awesome attachment system.
if GetChangingUnit()==null or GetChangingUnitPrevOwner()==Player(CRS_RESPAWNING_PLAYER) then
call OnLeave(GetTriggerUnit())
endif
return false
endfunction
private function Init takes nothing returns nothing
local integer i=0
set important_group=CreateGroup()
set trg=CreateTrigger()
set setupFilter=Condition(function SetupFilter)
set emptyGroup=CreateGroup()
// The trigger which checks if units leaves a creep group.
// CHANGE_OWNER is fired for the new owner, so all players must be considered in the event.
call TriggerAddCondition(trg,Condition(function Action))
call TriggerRegisterPlayerUnitEvent(trg, Player(CRS_RESPAWNING_PLAYER), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterAnyUnitEventBJ(trg, EVENT_PLAYER_UNIT_CHANGE_OWNER)
// Start the respawn-timer.
// This timer keep track of all dead groups' respawn time.
set respawn_timer=CreateTimer()
call TimerStart(respawn_timer,1,true,function RespawnTix)
// For detecting Remove / ReplaceUnit
// Needs AutoIndex
call OnUnitDeindexed(OnLeave)
endfunction
// ============================================================================================
function CRS_AddImportantUnit takes unit u returns nothing
call GroupAddUnit(important_group,u)
endfunction
function CRS_RemoveImportantUnit takes unit u returns nothing
call GroupRemoveUnit(important_group,u)
endfunction
// ============================================================================================
globals
crsSetup CRS_lastCreatedSetup=0
endglobals
// ---------------------------------------------------------------------------------
function CRS_CreateGroup takes rect r returns crsGroupSimple
local crsGroupSimple gs=crsGroupSimple.createStub()
local crsSetup cs = crsSetup.create(r,gs)
// Check acquisition-range
local unit u = FirstOfGroup(gs.units)
if u!=null and GetUnitAcquireRange(u)<=CRS_CAMPAIGN_ACQUIRE_RANGE then
set gs.longAcquireRange=false
endif
set gs.x=GetRectCenterX(r)
set gs.y=GetRectCenterY(r)
set gs.setup=cs
set u=null
return gs
endfunction
// ---------------------------------------------------------------------------------
function CRS_CreateSetup takes rect r returns crsSetup
local crsSetup cset=crsSetup.create(r,0)
// Link with previously created setups.
set cset.next=CRS_lastCreatedSetup
set CRS_lastCreatedSetup=cset
return cset
endfunction
// ---------------------------------------------------------------------------------
function CRS_ClearSetups takes nothing returns nothing
set CRS_lastCreatedSetup=0
endfunction
// ---------------------------------------------------------------------------------
function CRS_CreateListGroupXY takes real x, real y, boolean random, boolean campaignRange returns crsListGroup
local integer i=1
local crsListGroup cr
if random then
set i=0
endif
set cr=crsListGroup.create(x,y,CRS_lastCreatedSetup,i)
set cr.longAcquireRange=not(campaignRange)
call cr.spawn()
return cr
endfunction
// ---------------------------------------------------------------------------------
function CRS_CreateListGroup takes rect r, boolean random, boolean campaignRange returns crsListGroup
return CRS_CreateListGroupXY(GetRectCenterX(r),GetRectCenterY(r),random,campaignRange)
endfunction
endlibrary
//TESH.scrollpos=621
//TESH.alwaysfold=0
library AutoIndex
//===========================================================================
// Information:
//==============
//
// AutoIndex is a very simple script to utilize. Just call GetUnitId(unit) to
// get get the unique value assigned to a particular unit. AutoIndex differs from
// other unit indexing libraries because it automatically assigns an ID to each
// unit as it enters the map, and automatically frees that ID as the unit leaves
// the map. This gives you several advantages as the user:
// -The GetUnitId function inlines directly to a GetUnitUserData call (or a
// LoadInteger call if the UseUnitUserData constant is set to false.)
// -You don't need to manually free IDs as units leave the map.
// -Detecting removing units to free their indexes is O(1), and less costly
// performance-wise than a timer scanning the map for removed units.
//
// If you turn on debug mode, AutoIndex will become slower, but it will be able
// to display several helpful error messages. It can detect the following issues:
// -Passing a removed or decayed unit to GetUnitId
// -Code outside of AutoIndex has overwritten a unit's UserData value.
// -GetUnitId was used on a filtered unit (a unit you don't want indexed).
//
// AutoIndex uses UnitUserData by default. If something else in your map
// would conflict with that, you can set the UseUnitUserData configuration
// constant to false, and a hashtable will be used instead. Note that hash-
// tables are about 60% slower.
//
// AutoIndex provides events upon indexing or deindexing units. This
// effectively allows you to notice when units enter or leave the game, and
// handle the creation or destruction of attached data or other things. Also
// included is the AutoStruct module, which automatically creates and destroys
// struct instances associated with units as they enter and leave the game.
//
//===========================================================================
// How to install AutoIndex:
//===========================
//
// 1.) Copy and paste this script into your map.
// 2.) Save it to allow the ObjectMerger macro to generate the "Leave Detect"
// ability for you. Close and re-open the map. After that, disable the macro
// to prevent the save delay.
//
//===========================================================================
// How to use AutoIndex:
//=======================
//
// So you can get a unique integer for each unit, but how do you use that to
// attach data to a unit? GetUnitId will always return a number in the range of
// 1-8190. This means it can be used as an array index, as demonstrated below:
/*
globals
integer array IntegerData
real array RealData
SomeStruct array SomeStructData
englobals
function Example takes nothing returns nothing
local unit u = CreateUnit(...)
local integer id = GetUnitId(u)
//You now have a unique index for the unit, so you can
//attach or retrieve data about the unit using arrays.
set IntegerData[id] = 5
set RealData[id] = 25.0
set SomeStructData[id] = SomeStruct.create()
//If you have access to the same unit in another function, you can
//retrieve the data by using GetUnitId() and reading the arrays.
endfunction
*/
// The UnitFilter function in the configuration section is provided so that
// you can make AutoIndex completely ignore certain unit-types. Ignored units
// won't be indexed or fire indexed/deindexed events. You may want to filter out
// dummy casters or system-private units, especially ones that use UnitUserData
// internally. xe dummy units are automatically filtered.
//
//===========================================================================
// How to use OnUnitIndexed / OnUnitDeindexed:
//=============================================
//
// AutoIndex will fire the OnUnitIndexed event when a unit enters the map,
// and the OnUnitDeindexed event when a unit leaves the map. Functions used
// as events must take a unit and return nothing. An example is given below:
/*
function UnitEntersMap takes unit u returns nothing
call BJDebugMsg(GetUnitName(u)+" was indexed with the ID "+I2S(GetUnitId(u)))
endfunction
function UnitLeavesMap takes unit u returns nothing
call BJDebugMsg(GetUnitName(u)+" was deindexed with the ID "+I2S(GetUnitId(u)))
endfunction
function Init takes nothing returns nothing
call OnUnitIndexed(UnitEntersMap)
call OnUnitDeindexed(UnitLeavesMap)
endfunction
*/
// As you can see, it works perfectly fine to call GetUnitId() on a unit
// during either of these events.
//
// If you call OnUnitIndexed during map initialization, every existing
// unit will be considered as entering the map. This saves you from needing
// to manually enumerate preplaced units (or units created by initialization
// code that ran before OnUnitIndexed was called).
//
// OnUnitDeindexed runs while a unit still exists, which means you can
// still do things such as destroy special effects attached to the unit.
// The unit will cease to exist immediately after the event is over.
//
//===========================================================================
// AutoIndex API:
//================
//
// GetUnitId(unit) -> integer
// This function returns a unique ID in the range of 1-8190 for the
// specified unit. Ruturns 0 if a null unit was passed. This function
// inlines directly to GetUnitUserData or LoadInteger if debug mode
// is disabled. If debug mode is enabled, this function will print
// an error message when passed a decayed or filtered unit.
//
// IsUnitIndexed(unit) -> boolean
// This function returns a boolean indicating whether the specified
// unit has been indexed. The only time this will return false is
// for units you have filtered using the UnitFilter function, or
// for xe dummy units. You can use this function to easily detect
// dummy units and avoid performing certain actions on them.
//
// OnUnitIndexed(IndexFunc)
// This function accepts an IndexFunc, which must take a unit and
// return nothing. The IndexFunc will be fired instantly whenever
// a unit enters the map. You may use GetUnitId on the unit. When
// you call this function during map initialization, every existing
// unit will be considered as entering the map.
//
// OnUnitDeindexed(IndexFunc)
// Same as above, but runs whenever a unit is leaving the map. When
// this event runs, the unit still exists, but it will cease to exist
// as soon as the event ends. You may use GetUnitId on the unit.
//
//===========================================================================
// How to use the AutoStruct module:
//===================================
//
// The AutoStruct module allows you to automatically create and destroy
// struct instances as units enter and leave the game. An instance of the
// implementing struct will be created each time a unit enters the game,
// and destroyed when that unit leaves the game. (You cannot create or dest-
// roy instances manually.) This means that you should consider each inst-
// ance of an AutoStruct to be "owned by" a specific unit.
//
// AutoStruct restrictions:
// -You may not implement AutoStruct in any struct that declares its
// own create, destroy, or operator[] methods.
// -You may not manually create or destroy structs implementing AutoStruct.
// -AutoStruct may be implemented in structs that extend interfaces or
// other structs, but only if the allocate() method takes no parameters.
// (The restriction of allocate() taking no parameters may be changed soon.)
// -AutoStruct will not work with structs that extend array, since they
// can't be created or destroyed.
//
// AutoStruct features:
// -An instance of the implementing struct will be created each time a
// unit enters the game. That instance will be destroyed when that unit
// leaves the game. The struct will always exist while the unit does.
// -You can retrieve an AutoStruct from a unit by using the syntax:
// local StructName mystruct = StructName[unit]
// //This inlines to a GetUnitId() call + array lookup.
// -You can refer to the unit that owns the instance by the member "me":
// //Outside of the struct: call BJDebugMsg(GetUnitName(mystruct.me))
// //From within the struct: call BJDebugMsg(GetUnitName(me))
// -You can use the optional methods onCreate and onDestroy to notice when
// instances of a struct implementing AutoStruct are created and destroyed.
// This is equivalent to detecting a unit entering and leaving the game.
/*
struct Example
private method onCreate takes nothing returns nothing
call BJDebugMsg(GetUnitName(me)+" has entered the game!")
endmethod
private method onDestroy takes nothing returns nothing
call BJDebugMsg(GetUnitName(me)+" has left the game!")
endmethod
implement AutoStruct
endstruct
*/
// -You can filter which units will recieve an AutoStruct by using the
// optional static method createFilter. The createFiler method must take
// a unit parameter and return a boolean (true if created, false if not).
/*
struct Example
private static method createFiler takes unit u returns boolean
return GetUnitTypeId(u) == 'hfoo' //Only Footmen will recieve this AutoStruct.
endmethod
implement AutoStruct
endstruct
*/
//
//===========================================================================
// Configuration:
//================
// external ObjectMerger w3a Adef lvdt anam "Leave Detect" aart "" arac 0
//Save your map with this Object Merger call enabled, then close and reopen your
//map. Disable it by removing the exclamation to remove the delay while saving.
globals
private constant integer LeaveDetectAbilityID = 'lvdt'
//This rawcode must match the parameter after "Adef" in the
//ObjectMergermacro above. You can change both if you want.
private constant boolean UseUnitUserData = false
//If this is set to true, UnitUserData will be used. You should only set
//this to false if something else in your map already uses UnitUserData.
//A hashtable will be used instead, but it is about 60% slower.
endglobals
private function UnitFilter takes unit u returns boolean
return true
endfunction
//Make this function return false for any unit-types you wish to be ignored.
//Ignored units won't be indexed or fire OnUnitIndexed/OnUnitDeindexed
//events. Use the unit u parameter to refer to the unit being filtered.
//You do not need to filter out xe dummy units; they are already filtered.
//===========================================================================
// AutoStruct module:
//====================
function interface AutoStructCreator takes unit u returns integer
function interface AutoStructDestroyer takes unit u returns nothing
module AutoStruct
private static thistype array data
unit me //The unit that "owns" this struct instance is referred to as "me".
static method operator [] takes unit u returns thistype
return data[GetUnitId(u)] //Return the struct instance associated with the unit.
endmethod
private static method create takes unit u returns thistype
local thistype this
static if thistype.createFilter.exists then //If the createFiler exists...
if not createFilter(u) then //If the unit fails the createFilter...
return 0 //Don't allocate a struct for this unit.
endif
endif
set this = allocate() //Allocate the struct.
set me = u //Assign the "me" unit of this struct to the entering unit.
set data[GetUnitId(u)] = this //Attach this instance to the unit.
static if thistype.onCreate.exists then //If onCreate exists...
call onCreate() //Call the onCreate() method for this struct.
endif
return this
endmethod
//create is private; the user doesn't create AutoStructs. They are created
//automatically when a unit enters the game and passes the createFilter.
private method destroy takes nothing returns nothing
endmethod
//destroy is private; the user doesn't destroy AutoStructs. They are destroyed
//automatically when their corresponding units leave the game.
private static method destroyer takes unit u returns nothing
local thistype this = thistype[u] //Get the instance of the struct for this unit.
if this != 0 then //If it has an instance...
call deallocate() //Deallocate it, calling onDestroy.
set .data[GetUnitId(me)] = 0 //Null the unit's associated struct instance.
set me = null //Null the unit reference.
endif
endmethod
private static method onInit takes nothing returns nothing
call AutoIndex.addAutoStruct(thistype.create, thistype.destroyer)
//Pass pointers to the create and destroyer functions to AutoIndex, so
//that it can create/destroy instances as units are indexed/deindexed.
endmethod
endmodule
//===========================================================================
// AutoIndex struct:
//===================
function interface IndexFunc takes unit u returns nothing
hook RemoveUnit AutoIndex.hook_RemoveUnit
hook ReplaceUnitBJ AutoIndex.hook_ReplaceUnitBJ
debug hook SetUnitUserData AutoIndex.hook_SetUnitUserData
private keyword getIndex
private keyword getIndexDebug
private keyword isUnitIndexed
private keyword onUnitIndexed
private keyword onUnitDeindexed
struct AutoIndex
private static trigger enter = CreateTrigger()
private static trigger order = CreateTrigger()
private static trigger creepdeath = CreateTrigger()
private static group preplaced = CreateGroup()
private static timer allowdecay = CreateTimer()
private static hashtable ht
private static boolean array dead
private static boolean array summoned
private static boolean array animated
private static boolean array nodecay
private static boolean array removing
private static IndexFunc array indexfuncs
private static integer indexfuncs_n = -1
private static IndexFunc array deindexfuncs
private static integer deindexfuncs_n = -1
private static IndexFunc indexfunc
private static AutoStructCreator array creators
private static AutoStructDestroyer array destroyers
private static integer autostructs_n = -1
private static unit array allowdecayunit
private static integer allowdecay_n = -1
private static boolean duringinit = true
private static boolean array altered
private static unit array idunit
//===========================================================================
static method getIndex takes unit u returns integer
static if UseUnitUserData then
return GetUnitUserData(u)
else
return LoadInteger(ht, 0, GetHandleId(u))
endif
endmethod
//Resolves to an inlinable one-liner after the static if.
static method getIndexDebug takes unit u returns integer
if u == null then
return 0
elseif GetUnitTypeId(u) == 0 then
call BJDebugMsg("AutoIndex error: Removed or decayed unit passed to GetUnitId.")
elseif idunit[getIndex(u)] != u and GetIssuedOrderId() != 852056 then
call BJDebugMsg("AutoIndex error: "+GetUnitName(u)+" is a filtered unit.")
endif
return getIndex(u)
endmethod
//If debug mode is enabled, use the getIndex method that shows errors.
private static method setIndex takes unit u, integer index returns nothing
static if UseUnitUserData then
call SetUnitUserData(u, index)
else
call SaveInteger(ht, 0, GetHandleId(u), index)
endif
endmethod
//Resolves to an inlinable one-liner after the static if.
static method isUnitIndexed takes unit u returns boolean
return u != null and idunit[getIndex(u)] == u
endmethod
static method isUnitAnimateDead takes unit u returns boolean
return animated[getIndex(u)]
endmethod
//Don't use this; use IsUnitAnimateDead from AutoEvents instead.
//===========================================================================
private static method onUnitIndexed_sub takes nothing returns nothing
call indexfunc.evaluate(GetEnumUnit())
endmethod
static method onUnitIndexed takes IndexFunc func returns nothing
set indexfuncs_n = indexfuncs_n + 1
set indexfuncs[indexfuncs_n] = func
if duringinit then
set indexfunc = func
//During initialization, evaluate the indexfunc for every preplaced unit.
call ForGroup(preplaced, function AutoIndex.onUnitIndexed_sub)
endif
endmethod
static method onUnitDeindexed takes IndexFunc func returns nothing
set deindexfuncs_n = deindexfuncs_n + 1
set deindexfuncs[deindexfuncs_n] = func
endmethod
static method addAutoStruct takes AutoStructCreator creator, AutoStructDestroyer destroyer returns nothing
set autostructs_n = autostructs_n + 1
set creators[autostructs_n] = creator
set destroyers[autostructs_n] = destroyer
endmethod
//===========================================================================
private static method hook_RemoveUnit takes unit whichUnit returns nothing
set removing[getIndex(whichUnit)] = true
endmethod
private static method hook_ReplaceUnitBJ takes unit whichUnit, integer newUnitId, integer unitStateMethod returns nothing
set removing[getIndex(whichUnit)] = true
endmethod
//Intercepts whenever RemoveUnit or ReplaceUnitBJ is called and sets a flag.
private static method hook_SetUnitUserData takes unit whichUnit, integer data returns nothing
static if UseUnitUserData then
if idunit[getIndex(whichUnit)] == whichUnit then
if getIndex(whichUnit) == data then
call BJDebugMsg("AutoIndex error: Code outside AutoIndex attempted to alter "+GetUnitName(whichUnit)+"'s index.")
else
call BJDebugMsg("AutoIndex error: Code outside AutoIndex altered "+GetUnitName(whichUnit)+"'s index.")
if idunit[data] != null then
call BJDebugMsg("AutoIndex error: "+GetUnitName(whichUnit)+" and "+GetUnitName(idunit[data])+" now have the same index.")
endif
set altered[data] = true
endif
endif
endif
endmethod
//In debug mode, intercepts whenever SetUnitUserData is used on an indexed unit.
//Displays an error message if outside code tries to alter a unit's index.
//===========================================================================
private static method allowDecay takes nothing returns nothing
local integer n = allowdecay_n
loop
exitwhen n < 0
set nodecay[getIndex(allowdecayunit[n])] = false
set allowdecayunit[n] = null
set n = n - 1
endloop
set allowdecay_n = -1
endmethod
//Iterate through all the units in the stack and allow them to decay again.
private static method detectStatus takes nothing returns boolean
local unit u = GetTriggerUnit()
local integer index = getIndex(u)
local integer n
if idunit[index] == u then //Ignore non-indexed units.
if not IsUnitType(u, UNIT_TYPE_DEAD) then
if dead[index] then //The unit was dead, but now it's alive.
set dead[index] = false //The unit has been resurrected.
//! runtextmacro optional RunAutoEvent("Resurrect")
//If AutoEvents is in the map, run the resurrection events.
if IsUnitType(u, UNIT_TYPE_SUMMONED) and not summoned[index] then
set summoned[index] = true //If the unit gained the summoned flag,
set animated[index] = true //it's been raised with Animate Dead.
//! runtextmacro optional RunAutoEvent("AnimateDead")
//If AutoEvents is in the map, run the Animate Dead events.
endif
endif
else
if not removing[index] and not dead[index] and not animated[index] then
set dead[index] = true //The unit was alive, but now it's dead.
set nodecay[index] = true //A dead unit can't decay for at least 0. seconds.
set allowdecay_n = allowdecay_n + 1 //Add the unit to a stack. After the timer
set allowdecayunit[allowdecay_n] = u //expires, allow the unit to decay again.
call TimerStart(allowdecay, 0., false, function AutoIndex.allowDecay)
//! runtextmacro optional RunAutoEvent("Death")
//If AutoEvents is in the map, run the Death events.
//! runtextmacro optional TransportUnload()
//If TransportEvents is in the map, remove the dead unit from whatever transport it's in.
elseif removing[index] or (dead[index] and not nodecay[index]) or (not dead[index] and animated[index]) then
//If .nodecay was false and the unit is dead and was previously dead, the unit decayed.
//If .animated was true and the unit is dead, the unit died and exploded.
//If .removing was true, the unit is being removed or replaced.
//! runtextmacro optional TransportUnload()
//If TransportEvents is in the map, remove the leaving unit from whatever transport it's in.
set n = deindexfuncs_n
loop //Run the OnUnitDeindexed events.
exitwhen n < 0
call deindexfuncs[n].evaluate(u)
set n = n - 1
endloop
//! runtextmacro optional DestroyUnitLists()
//If UnitListModule is in the map, destroy all of the UnitLists associated with the leaving unit.
set n = autostructs_n
loop //Destroy AutoStructs for the leaving unit.
exitwhen n < 0
call destroyers[n].evaluate(u)
set n = n - 1
endloop
//! runtextmacro optional TransportClean()
//If TransportEvents is in the map, and the leaving unit is a
//transport, clean the transport- related data from the unit.
call AutoIndex(index).destroy() //Free the index by destroying the AutoIndex struct.
set idunit[index] = null //Null this unit reference to prevent a leak.
endif
endif
endif
set u = null
return false
endmethod
//===========================================================================
private static method unitEntersMap takes unit u returns nothing
local integer index
local integer n = 0
if getIndex(u) != 0 then
return //Don't index a unit that already has an ID.
endif
static if LIBRARY_xebasic then
if GetUnitTypeId(u) == XE_DUMMY_UNITID then
return //Don't index xe dummy units.
endif
endif
if not UnitFilter(u) then
return //Don't index units that fail the unit filter.
endif
set index = create()
call setIndex(u, index) //Assign an index to the entering unit.
call UnitAddAbility(u, LeaveDetectAbilityID) //Add the leave detect ability to the entering unit.
call UnitMakeAbilityPermanent(u, true, LeaveDetectAbilityID) //Prevent it from disappearing on morph.
set dead[index] = IsUnitType(u, UNIT_TYPE_DEAD) //Reset all of the flags for the entering
set summoned[index] = IsUnitType(u, UNIT_TYPE_SUMMONED) //unit. These flags are necessary to detect
set animated[index] = false //when the unit leaves the map.
set nodecay[index] = false
set removing[index] = false
debug set altered[index] = false //In debug mode, this flag tracks wheter a unit's index was altered.
set idunit[index] = u //Attach the unit that is supposed to have this index to the index.
if duringinit then
call GroupAddUnit(preplaced, u) //Add units that are created during initialization to the preplaced
//units group. This ensures that all units are noticed by OnUnitIndexed during initialization.
endif
loop //Create AutoStructs for the entering unit.
exitwhen n > autostructs_n
call creators[n].evaluate(u)
set n = n + 1
endloop
set n = 0
loop //Run the OnUnitIndexed events.
exitwhen n > indexfuncs_n
call indexfuncs[n].evaluate(u)
set n = n + 1
endloop
endmethod
private static method onIssuedOrder takes nothing returns boolean
if getIndex(GetTriggerUnit()) == 0 then
call unitEntersMap(GetTriggerUnit())
endif //If the unit doesn't have an index at this point, assign it one.
//This is necessary to catch units with default-on autocast abilities
//when using GetUnitId on a newly created unit within an order event.
//! runtextmacro optional TransportUnloadCheck()
//If TransportEvents is in the map, check whether a unit is unloading.
return GetIssuedOrderId() == 852056 //If the order is Undefend, allow detectStatus to run.
endmethod
private static method initEnteringUnit takes nothing returns boolean
call unitEntersMap(GetFilterUnit())
return false
endmethod
//===========================================================================
private static method afterInit takes nothing returns nothing
set duringinit = false //Initialization is over; set a flag.
call DestroyTimer(GetExpiredTimer()) //Destroy the timer.
call GroupClear(preplaced) //The preplaced units group is
call DestroyGroup(preplaced) //no longer needed, so clean it.
set preplaced = null
endmethod
private static method onInit takes nothing returns nothing
local region maparea = CreateRegion()
local rect bounds = GetWorldBounds()
local group g = CreateGroup()
local integer i = 15
static if not UseUnitUserData then
set ht = InitHashtable() //Only create a hashtable if it will be used.
endif
loop
exitwhen i < 0
call SetPlayerAbilityAvailable(Player(i), LeaveDetectAbilityID, false)
//Make the LeaveDetect ability unavailable so that it doesn't show up on the command card of every unit.
call TriggerRegisterPlayerUnitEvent(order, Player(i), EVENT_PLAYER_UNIT_ISSUED_ORDER, null)
//Register the "EVENT_PLAYER_UNIT_ISSUED_ORDER" event for each player.
call GroupEnumUnitsOfPlayer(g, Player(i), function AutoIndex.initEnteringUnit)
//Enum every non-filtered unit on the map during initialization and assign it a unique
//index. By using GroupEnumUnitsOfPlayer, even units with Locust can be detected.
set i = i - 1
endloop
call TriggerAddCondition(order, And(function AutoIndex.onIssuedOrder, function AutoIndex.detectStatus))
//The detectStatus method will fire every time a non-filtered unit recieves an undefend order.
//And() is used here to avoid using a trigger action, which starts a new thread and is slower.
call TriggerRegisterPlayerUnitEvent(creepdeath, Player(12), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(creepdeath, function AutoIndex.detectStatus)
//The detectStatus method must also fire when a neutral hostile creep dies, in case it was
//sleeping. Sleeping creeps don't fire undefend orders on non-damaging deaths.
call RegionAddRect(maparea, bounds) //GetWorldBounds() includes the shaded boundry areas.
call TriggerRegisterEnterRegion(enter, maparea, function AutoIndex.initEnteringUnit)
//The filter function of an EnterRegion trigger runs instantly when a unit is created.
call TimerStart(CreateTimer(), 0., false, function AutoIndex.afterInit)
//After any time elapses, perform after-initialization actions.
call GroupClear(g)
call DestroyGroup(g)
call RemoveRect(bounds)
set g = null
set bounds = null
endmethod
endstruct
//===========================================================================
// User functions:
//=================
function GetUnitId takes unit u returns integer
static if DEBUG_MODE then
return AutoIndex.getIndexDebug(u)
else
return AutoIndex.getIndex(u)
endif
endfunction
function IsUnitIndexed takes unit u returns boolean
return AutoIndex.isUnitIndexed(u)
endfunction
function OnUnitIndexed takes IndexFunc func returns nothing
call AutoIndex.onUnitIndexed(func)
endfunction
function OnUnitDeindexed takes IndexFunc func returns nothing
call AutoIndex.onUnitDeindexed(func)
endfunction
endlibrary
//TESH.scrollpos=5
//TESH.alwaysfold=0
function Trig_Shieldbreak40_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetSpellAbilityUnit(), GetOwningPlayer(GetSpellTargetUnit())) == true ) ) then
return false
endif
if ( not ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B02J') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetSpellTargetUnit(), 'I03T') == true ) ) then
return false
endif
return true
endfunction
function Trig_Shieldbreak40_Actions takes nothing returns nothing
local unit u = GetSpellTargetUnit()
call UnitRemoveAbilityBJ( 'A0H2', u )
call UnitRemoveBuffBJ( 'B02J', u )
call UnitAddAbilityBJ( 'A0H3', u )
if ( GetUnitTypeId(u) == 'N00D' ) or ( GetUnitTypeId(u) == 'N007' ) then
set udg_Shaman_Shield = false
endif
call TriggerSleepAction( 40.00 )
call UnitRemoveAbilityBJ( 'A0H3', u )
call UnitRemoveBuffBJ( 'B02K', u )
if UnitHasItemOfTypeBJ(u, 'I03T') == true or UnitHasItemOfTypeBJ(u, 'I033') == true or UnitHasItemOfTypeBJ(u, 'I011') == true or UnitHasItemOfTypeBJ(u, 'I01N') == true or UnitHasItemOfTypeBJ(u, 'I04Z') == true then
call UnitAddAbilityBJ( 'A0H2', u )
if ( GetUnitTypeId(u) == 'N00D' ) or ( GetUnitTypeId(u) == 'N007' ) then
set udg_Shaman_Shield = true
endif
endif
endfunction
//===========================================================================
function InitTrig_Shieldbreak_Greater_Spell_Shield takes nothing returns nothing
set gg_trg_Shieldbreak_Greater_Spell_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shieldbreak_Greater_Spell_Shield, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Shieldbreak_Greater_Spell_Shield, Condition( function Trig_Shieldbreak40_Conditions ) )
call TriggerAddAction( gg_trg_Shieldbreak_Greater_Spell_Shield, function Trig_Shieldbreak40_Actions )
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
function Trig_ShieldbreakAM_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetSpellAbilityUnit(), GetOwningPlayer(GetSpellTargetUnit())) == true ) ) then
return false
endif
if ( not ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B02J') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetSpellTargetUnit(), 'I01N') == true ) ) then
return false
endif
return true
endfunction
function Trig_ShieldbreakAM_Actions takes nothing returns nothing
local unit u = GetSpellTargetUnit()
call UnitRemoveAbilityBJ( 'A0H2', u )
call UnitRemoveBuffBJ( 'B02J', u )
call UnitAddAbilityBJ( 'A0H3', u )
if ( GetUnitTypeId(u) == 'N00D' ) or ( GetUnitTypeId(u) == 'N007' ) then
set udg_Shaman_Shield = false
endif
call TriggerSleepAction( 40.00 )
call UnitRemoveAbilityBJ( 'A0H3', u )
call UnitRemoveBuffBJ( 'B02K', u )
if UnitHasItemOfTypeBJ(u, 'I03T') == true or UnitHasItemOfTypeBJ(u, 'I033') == true or UnitHasItemOfTypeBJ(u, 'I011') == true or UnitHasItemOfTypeBJ(u, 'I01N') == true or UnitHasItemOfTypeBJ(u, 'I04Z') == true then
call UnitAddAbilityBJ( 'A0H2', u )
if ( GetUnitTypeId(u) == 'N00D' ) or ( GetUnitTypeId(u) == 'N007' ) then
set udg_Shaman_Shield = true
endif
endif
endfunction
//===========================================================================
function InitTrig_Shieldbreak_Robe_of_Anti_magic takes nothing returns nothing
set gg_trg_Shieldbreak_Robe_of_Anti_magic = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shieldbreak_Robe_of_Anti_magic, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Shieldbreak_Robe_of_Anti_magic, Condition( function Trig_ShieldbreakAM_Conditions ) )
call TriggerAddAction( gg_trg_Shieldbreak_Robe_of_Anti_magic, function Trig_ShieldbreakAM_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ShieldbreakMoN_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetSpellAbilityUnit(), GetOwningPlayer(GetSpellTargetUnit())) == true ) ) then
return false
endif
if ( not ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B02J') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetSpellTargetUnit(), 'I033') == true ) ) then
return false
endif
return true
endfunction
function Trig_ShieldbreakMoN_Actions takes nothing returns nothing
local unit u = GetSpellTargetUnit()
call UnitRemoveAbilityBJ( 'A0H2', u )
call UnitRemoveBuffBJ( 'B02J', u )
call UnitAddAbilityBJ( 'A0H3', u )
call TriggerSleepAction( 45.00 )
call UnitRemoveAbilityBJ( 'A0H3', u )
call UnitRemoveBuffBJ( 'B02K', u )
if UnitHasItemOfTypeBJ(u, 'I03T') == true or UnitHasItemOfTypeBJ(u, 'I033') == true or UnitHasItemOfTypeBJ(u, 'I011') == true or UnitHasItemOfTypeBJ(u, 'I01N') == true or UnitHasItemOfTypeBJ(u, 'I04Z') == true then
call UnitAddAbilityBJ( 'A0H2', u )
endif
endfunction
//===========================================================================
function InitTrig_Shieldbreak_Splint_Mail_of_Negation takes nothing returns nothing
set gg_trg_Shieldbreak_Splint_Mail_of_Negation = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shieldbreak_Splint_Mail_of_Negation, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Shieldbreak_Splint_Mail_of_Negation, Condition( function Trig_ShieldbreakMoN_Conditions ) )
call TriggerAddAction( gg_trg_Shieldbreak_Splint_Mail_of_Negation, function Trig_ShieldbreakMoN_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Shieldbreak60_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetSpellAbilityUnit(), GetOwningPlayer(GetSpellTargetUnit())) == true ) ) then
return false
endif
if ( not ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B02J') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetSpellTargetUnit(), 'I011') == true ) ) then
return false
endif
return true
endfunction
function Trig_Shieldbreak60_Actions takes nothing returns nothing
local unit u = GetSpellTargetUnit()
call UnitRemoveAbilityBJ( 'A0H2', u )
call UnitRemoveBuffBJ( 'B02J', u )
call UnitAddAbilityBJ( 'A0H3', u )
if ( GetUnitTypeId(u) == 'N00D' ) or ( GetUnitTypeId(u) == 'N007' ) then
set udg_Shaman_Shield = false
endif
call TriggerSleepAction( 60.00 )
call UnitRemoveAbilityBJ( 'A0H3', u )
call UnitRemoveBuffBJ( 'B02K', u )
if UnitHasItemOfTypeBJ(u, 'I03T') == true or UnitHasItemOfTypeBJ(u, 'I033') == true or UnitHasItemOfTypeBJ(u, 'I011') == true or UnitHasItemOfTypeBJ(u, 'I01N') == true or UnitHasItemOfTypeBJ(u, 'I04Z') == true then
call UnitAddAbilityBJ( 'A0H2', u )
if ( GetUnitTypeId(u) == 'N00D' ) or ( GetUnitTypeId(u) == 'N007' ) then
set udg_Shaman_Shield = true
endif
endif
endfunction
//===========================================================================
function InitTrig_Shieldbreak_Spell_Shield takes nothing returns nothing
set gg_trg_Shieldbreak_Spell_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shieldbreak_Spell_Shield, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Shieldbreak_Spell_Shield, Condition( function Trig_Shieldbreak60_Conditions ) )
call TriggerAddAction( gg_trg_Shieldbreak_Spell_Shield, function Trig_Shieldbreak60_Actions )
endfunction
function Trig_Untitled_Trigger_005_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetSpellTargetUnit()) == 'N007' ) ) then
return false
endif
if ( not ( GetUnitTypeId(GetSpellTargetUnit()) == 'N00D' ) ) then
return false
endif
return true
endfunction
function Trig_Untitled_Trigger_005_Actions takes nothing returns nothing
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_005 takes nothing returns nothing
set gg_trg_Untitled_Trigger_005 = CreateTrigger( )
call TriggerAddCondition( gg_trg_Untitled_Trigger_005, Condition( function Trig_Untitled_Trigger_005_Conditions ) )
call TriggerAddAction( gg_trg_Untitled_Trigger_005, function Trig_Untitled_Trigger_005_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Power_Bashing_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A03G' ) ) then
return false
endif
return true
endfunction
function Trig_Power_Bashing_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local integer ab = 'A01I'
local integer l = GetUnitAbilityLevelSwapped('A03G', c)
call SetUnitScalePercent( c, 150.00, 150.00, 150.00 )
call AddEffectToUnitTimed("Abilities\\Spells\\Human\\Avatar\\AvatarCaster.mdl","origin",c,10)
call AddAbilityToUnitTimedLevel(ab,c,15,l)
call PolledWait( 15.00 )
call SetUnitScalePercent( c, 100.00, 100.00, 100.00 )
endfunction
//===========================================================================
function InitTrig_Power_Bashing takes nothing returns nothing
set gg_trg_Power_Bashing = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Power_Bashing, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Power_Bashing, Condition( function Trig_Power_Bashing_Conditions ) )
call TriggerAddAction( gg_trg_Power_Bashing, function Trig_Power_Bashing_Actions )
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
function Trig_Blur_Image_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0CE' ) ) then
return false
endif
return true
endfunction
function Trig_Blur_Image_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local integer ab = 'A0CC'
local integer i = GetUnitAbilityLevelSwapped('A0CE', c)
call AddEffectToUnitTimed("Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl","origin",c,1.5)
call SetUnitVertexColorBJ( c, 100, 100, 100, 50.00 )
call AddAbilityToUnitTimedLevel(ab,c,15,i)
call PolledWait(15.00)
call AddEffectToUnitTimed("Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl","origin",c,1.5)
call SetUnitVertexColorBJ( c, 100, 100, 100, 0.00 )
endfunction
//===========================================================================
function InitTrig_Blur_Image takes nothing returns nothing
set gg_trg_Blur_Image = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Blur_Image, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Blur_Image, Condition( function Trig_Blur_Image_Conditions ) )
call TriggerAddAction( gg_trg_Blur_Image, function Trig_Blur_Image_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Raging_Claws_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A08J' ) ) then
return false
endif
return true
endfunction
function Trig_Raging_Claws_Actions takes nothing returns nothing
local integer i = GetUnitAbilityLevelSwapped('A08J', GetSpellAbilityUnit())*4
local integer ab = 'ACce'
local unit c = GetSpellAbilityUnit()
call AddAbilityToUnitTimed(ab,c,i)
endfunction
//===========================================================================
function InitTrig_Raging_Claws takes nothing returns nothing
set gg_trg_Raging_Claws = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Raging_Claws, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Raging_Claws, Condition( function Trig_Raging_Claws_Conditions ) )
call TriggerAddAction( gg_trg_Raging_Claws, function Trig_Raging_Claws_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Imprison uses Effect, Ability
//@name: Imprison
//@author: Themerion
//@changed by: Murder X
//@version: 1.5 (compatibel with Patch 1.24)
//================================================================
constant function Imprison_SpellId takes nothing returns integer
return 'A0E1'
endfunction
globals
private hashtable abhash = InitHashtable()
endglobals
//================================================================
function Imprison_Distance takes integer level returns integer
return 400
endfunction
function Imprison_UnitCount takes integer level returns integer
return 20
endfunction
function Imprison_Duration takes integer level returns real
return 5.0+I2R(level)*1.5
endfunction
function Imprison_CasterAbilityLevel takes integer level returns integer
return level
endfunction
//================================================================
constant function Imprison_UnitId takes nothing returns integer
return 'ogru'
endfunction
constant function Imprison_UnitHeight takes nothing returns integer
return 200
endfunction
constant function Imprison_RiseSpeed takes nothing returns integer
return 90
endfunction
constant function Imprison_CenterOffset takes nothing returns integer
// If you manage to display spell slam properly use this line instead.
// return 80
return 0
endfunction
constant function Imprison_CasterAbilityId takes nothing returns integer
return 'A0E2'
endfunction
constant function Imprison_CasterOrder takes nothing returns string
return "Locustswarm"
endfunction
constant function Imprison_FX takes nothing returns string
return "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
endfunction
//========================= Fixes =================================
constant function Imprison_DisplayDeathAnimation takes nothing returns boolean
return false
endfunction
constant function Imprison_DeathFX takes nothing returns string
// Set to "" to not display any effect.
return "Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl"
endfunction
function Imprison_End takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit c = LoadUnitHandle(abhash, GetHandleId(t), 0)
local group g = LoadGroupHandle(abhash, GetHandleId(t), 2)
local effect e = LoadEffectHandle(abhash, GetHandleId(t), 1)
local unit u
call DestroyEffect(e)
call IssueImmediateOrder(c,"stop")
call RemoveUnit(c)
set c=null
loop
set u=FirstOfGroup(g)
exitwhen u==null
if(Imprison_DeathFX()!="") then
call AddEffectToLocTimed(Imprison_DeathFX(),GetUnitX(u),GetUnitY(u),4 )
endif
if(Imprison_DisplayDeathAnimation()) then
call UnitApplyTimedLifeBJ(0.001,'BTLF',u)
else
call RemoveUnit(u)
endif
call GroupRemoveUnit(g,u)
endloop
set u=null
call DestroyGroup(g)
set g=null
call RemoveSavedHandle(abhash, GetHandleId(t), 0)
call RemoveSavedHandle(abhash, GetHandleId(t), 1)
call RemoveSavedHandle(abhash, GetHandleId(t), 2)
call PauseTimerBJ( true, t )
call DestroyTimer(t)
set t = null
endfunction
function Imprison_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local integer l = GetUnitAbilityLevel(c,Imprison_SpellId())
local integer n = Imprison_UnitCount(l)
local real a = 0
local real da = 2*bj_PI/n
local integer distance = Imprison_Distance(l)
local integer speed = Imprison_RiseSpeed()
local real fa = GetUnitFacing(c)
local real x = GetUnitX(c)+Imprison_CenterOffset()*CosBJ(fa)
local real y = GetUnitY(c)+Imprison_CenterOffset()*SinBJ(fa)
local unit caster
local integer i = 0
local group g = CreateGroup()
local unit u
local timer t = CreateTimer()
local real face
local effect fx = AddSpecialEffect(Imprison_FX(),x,y)
local location loc=Location(x,y)
call TerrainDeformationRippleBJ(2.00,false,loc,distance*1.5,distance*1.5,92,4,256)
call RemoveLocation(loc)
set loc=null
loop
exitwhen i==n
set face = 180+a*360/(2*bj_PI)
set u = CreateUnit(GetOwningPlayer(c),Imprison_UnitId(),x+Cos(a)*distance,y+Sin(a)*distance,face)
call PauseUnit(u,true)
call UnitAddAbility(u,'Amrf')
call UnitRemoveAbility(u,'Amrf')
call SetUnitFlyHeight(u,0,speed)
call GroupAddUnit(g,u)
set a=a+da
set i=i+1
endloop
set caster = CreateUnit( GetOwningPlayer(c), 'e008', x ,y ,0)
call SetUnitX(caster, x)
call SetUnitY(caster, y)
call UnitAddAbility(caster,Imprison_CasterAbilityId())
call SetUnitAbilityLevel(caster,Imprison_CasterAbilityId(),Imprison_CasterAbilityLevel(l))
call IssueImmediateOrder(caster,Imprison_CasterOrder())
call SaveUnitHandle(abhash, GetHandleId(t), 0, caster)
call SaveEffectHandle(abhash, GetHandleId(t), 1, fx)
call SaveGroupHandle(abhash, GetHandleId(t), 2, g)
call TimerStart(t,Imprison_Duration(l),false,function Imprison_End)
set fx=null
set t=null
set g=null
set u=null
set c=null
endfunction
//===========================================================================
function Imprison_Conditions takes nothing returns boolean
if ( GetSpellAbilityId() == Imprison_SpellId() ) then
return true
endif
return false
endfunction
function InitTrig_Imprison takes nothing returns nothing
set gg_trg_Imprison = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Imprison, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Imprison, Condition( function Imprison_Conditions ) )
call TriggerAddAction( gg_trg_Imprison, function Imprison_Actions )
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Dash_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0HI' ) ) then
return false
endif
return true
endfunction
function Trig_Dash_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local player p = GetOwningPlayer(c)
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local location l = GetSpellTargetLoc()
local unit d
call ShowUnitHide( c )
set d = CreateUnit(p, 'h01H', x, y, GetUnitFacing(c))
call SetUnitAbilityLevelSwapped( 'A0HK', d, GetUnitAbilityLevelSwapped('A0HI', c) )
call IssueImmediateOrderBJ( d, "immolation" )
call IssuePointOrderLocBJ( d, "move", l )
loop
exitwhen ( DistanceBetweenPoints(GetUnitLoc(d), l) < 50 )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.25))
endloop
call RemoveUnit( d )
call ShowUnitShow( c )
call SelectUnitForPlayerSingle( c, p )
set l = null
endfunction
//===========================================================================
function InitTrig_Dash takes nothing returns nothing
set gg_trg_Dash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Dash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Dash, Condition( function Trig_Dash_Conditions ) )
call TriggerAddAction( gg_trg_Dash, function Trig_Dash_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Disarm_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0E6' ) ) then
return false
endif
return true
endfunction
function Trig_Disarm_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local location l = GetUnitLoc(c)
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local player p = GetOwningPlayer(c)
local integer ab = 'A0E4'
local unit d = CreateUnit(p, 'e008', x, y, GetUnitFacing(c))
call UnitAddAbilityBJ( ab, d )
call IssuePointOrderLocBJ( d, "silence", l )
set l = null
endfunction
//===========================================================================
function InitTrig_Disarm takes nothing returns nothing
set gg_trg_Disarm = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Disarm, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Disarm, Condition( function Trig_Disarm_Conditions ) )
call TriggerAddAction( gg_trg_Disarm, function Trig_Disarm_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
//@name: Judgement
//@author: Murder X
//@version: 1.0
//================================================================
constant function Judgement_SpellId takes nothing returns integer
return 'A0B5'
endfunction
//================================================================
function Judgement_Damage takes integer level returns integer
return level*60+210
endfunction
//================================================================
function Judgement_Conditions takes nothing returns boolean
return GetBooleanAnd( (IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true), ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == true ) )
endfunction
//================================================================
function Trig_Judgement_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local unit u
local integer level = GetUnitAbilityLevel(c,Judgement_SpellId())
local group g = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Judgement_Conditions))
loop
set u=FirstOfGroup(g)
exitwhen u==null
call AddEffectToUnitTimed("Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl","origin",u,2.5)
call UnitDamageTargetBJ( c, u, Judgement_Damage(level), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DIVINE )
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
function Trig_Judgement_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == Judgement_SpellId() ) ) then
return false
endif
return true
endfunction
function InitTrig_Judgement takes nothing returns nothing
set gg_trg_Judgement = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Judgement, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Judgement, Condition( function Trig_Judgement_Conditions ) )
call TriggerAddAction( gg_trg_Judgement, function Trig_Judgement_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Holy_Seal_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0FP' ) ) then
return false
endif
return true
endfunction
function Trig_Holy_Seal_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local integer ab = 'A0FO'
call AddAbilityToUnitTimedLevel(ab,c,10,1)
endfunction
//===========================================================================
function InitTrig_Holy_Seal takes nothing returns nothing
set gg_trg_Holy_Seal = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Holy_Seal, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Holy_Seal, Condition( function Trig_Holy_Seal_Conditions ) )
call TriggerAddAction( gg_trg_Holy_Seal, function Trig_Holy_Seal_Actions )
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
function Trig_Holy_Stormbolt_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0HT' ) ) then
return false
endif
return true
endfunction
function Trig_Holy_Stormbolt_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local player p = GetOwningPlayer(c)
local unit t = GetSpellTargetUnit()
local unit d = CreateUnit(p, 'h01I', x, y, GetUnitFacing(c))
if ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B02J') == false ) then
call UnitAddAbilityBJ( 'A0FM', d )
call SetUnitAbilityLevelSwapped( 'A0FM', d, GetUnitAbilityLevelSwapped('A0HT', c) )
call IssueTargetOrderBJ( d, "thunderbolt", t )
else
endif
call PolledWait(2)
call RemoveUnit(d)
endfunction
//===========================================================================
function InitTrig_Holy_Stormbolt takes nothing returns nothing
set gg_trg_Holy_Stormbolt = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Holy_Stormbolt, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Holy_Stormbolt, Condition( function Trig_Holy_Stormbolt_Conditions ) )
call TriggerAddAction( gg_trg_Holy_Stormbolt, function Trig_Holy_Stormbolt_Actions )
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
function Trig_Holy_Bolt_v2_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0HS' ) ) then
return false
endif
return true
endfunction
function Trig_Holy_Bolt_v2_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local player p = GetOwningPlayer(c)
local unit t = GetSpellTargetUnit()
local unit d = CreateUnit(p, 'h01I', x, y, GetUnitFacing(c))
local integer i = GetUnitAbilityLevelSwapped('A0HS', c)
call UnitAddAbilityBJ( 'A0HO', d )
call SetUnitAbilityLevelSwapped( 'A0HO', d, i )
call PolledWait(0.25)
call IssueTargetOrderBJ( d, "acidbomb", t )
call PolledWait(0.25)
call AddAbilityToUnitTimedLevel('A0HR', t, 10, i)
call AddAbilityToUnitTimedLevel('A0HP', t, 10, i)
call AddAbilityToUnitTimed('A0HQ', t, 10)
call AddEffectToUnitTimed("Abilities\\Spells\\Items\\StaffOfSanctuary\\Staff_Sanctuary_Target.mdl","head",t,10)
call PolledWait(2)
call RemoveUnit(d)
endfunction
//===========================================================================
function InitTrig_Holy_Bolt_v2 takes nothing returns nothing
set gg_trg_Holy_Bolt_v2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Holy_Bolt_v2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Holy_Bolt_v2, Condition( function Trig_Holy_Bolt_v2_Conditions ) )
call TriggerAddAction( gg_trg_Holy_Bolt_v2, function Trig_Holy_Bolt_v2_Actions )
endfunction
//TESH.scrollpos=38
//TESH.alwaysfold=0
function Trig_Storm_Bolt_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0HS' ) ) then
return false
endif
return true
endfunction
function HB_H2I takes handle h returns integer
return h
return 0
endfunction
function HB_I2U takes integer i returns unit
return i
return null
endfunction
function Move takes nothing returns nothing
local string s = I2S(H2I(GetExpiredTimer()))
local timer t = GetExpiredTimer()
local gamecache gc = udg_Ability_Cache
local real x = GetStoredReal(gc, s, "x")
local real y = GetStoredReal(gc, s, "y")
local integer i = GetStoredInteger(gc, s, "Geschoss")
local integer ii = GetStoredInteger(gc, s, "Target")
local integer i3 = GetStoredInteger(gc, s, "caster")
local unit Stormbolt = HB_I2U(i)
local unit target = HB_I2U(ii)
local unit caster = HB_I2U(i3)
local location l = GetUnitLoc( Stormbolt )
local location l2 = GetUnitLoc( target )
call SetUnitPositionLocFacingLocBJ( Stormbolt, l, l2 )
set l = PolarProjectionBJ(GetUnitLoc( Stormbolt ), 20.00, GetUnitFacing( Stormbolt ))
call SetUnitX(Stormbolt, GetLocationX(l))
call SetUnitY(Stormbolt, GetLocationY(l))
if ( ( DistanceBetweenPoints(l, l2) <= 50.00 ) ) then
call AddAbilityToUnitTimedLevel('A0HR', target, 10, GetUnitAbilityLevelSwapped('A0HS', caster))
call AddAbilityToUnitTimedLevel('A0HP', target, 10, GetUnitAbilityLevelSwapped('A0HS', caster))
call AddAbilityToUnitTimed('A0HQ', target, 10)
call AddEffectToUnitTimed("Abilities\\Spells\\Items\\StaffOfSanctuary\\Staff_Sanctuary_Target.mdl","head",target,10)
call KillUnit(Stormbolt)
call PauseTimer(t)
call FlushStoredMission(gc, s)
call DestroyTimer(t)
set t = null
set target = null
set Stormbolt = null
set gc = null
set l = null
set l2 = null
else
set l = null
set l2 = null
endif
endfunction
function Trig_Storm_Bolt_Actions takes nothing returns nothing
local gamecache gc = udg_Ability_Cache
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local location targetl = GetUnitLoc(target)
local location casterl = GetUnitLoc(caster)
local player p = GetOwningPlayer ( caster )
local real x = GetUnitX ( caster )
local real y = GetUnitY ( caster )
local timer t = CreateTimer()
local real f = AngleBetweenPoints(casterl, (targetl))
local unit Stormbolt = CreateUnit ( p, 'h01J', x, y, f )
local string s = I2S(H2I(t))
local integer i = HB_H2I(Stormbolt)
local integer ii = HB_H2I(target)
local integer i3 = HB_H2I(caster)
call StoreInteger(gc, s, "Geschoss", i)
call StoreInteger(gc, s, "Target", ii)
call StoreInteger(gc, s, "caster", i3)
call StoreReal(gc, s, "x", x)
call StoreReal(gc, s, "y", y)
call TimerStart(t, 0.04, true, function Move)
call TriggerSleepAction( 2 )
endfunction
//===========================================================================
function InitTrig_Holy_Bolt takes nothing returns nothing
set gg_trg_Holy_Bolt = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Holy_Bolt, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Holy_Bolt, Condition( function Trig_Storm_Bolt_Conditions ) )
call TriggerAddAction( gg_trg_Holy_Bolt, function Trig_Storm_Bolt_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library HealingAura uses Effect, Ability
//@name: HealingAura (vJASS)
//@author: Themerion
//@changed by: Murder X
//@version: 1.5
//========================================================================
constant function HealingAura_SpellId takes nothing returns integer
return 'A0AV'
endfunction
globals
private hashtable abhash = InitHashtable()
endglobals
//========================================================================
function HealingAura_Heal takes integer level returns integer
return level*40+100
endfunction
function HealingAura_Damage takes integer level returns integer
return (HealingAura_Heal(level)/2)
endfunction
function HealingAura_Range takes integer level returns integer
return 800
endfunction
function HealingAura_Interval takes integer level returns real
return 3.0
endfunction
function HealingAura_LoopCount takes integer level returns integer
return 7
endfunction
//============================ EFFECTS ===================================
function HealingAura_HealFX takes nothing returns string
return "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl"
endfunction
function HealingAura_DamageFX takes nothing returns string
return HealingAura_HealFX()
endfunction
//========================================================================
function HealingAura_Loop takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit c = LoadUnitHandle(abhash, GetHandleId(t), 0)
local integer level = LoadInteger(abhash, GetHandleId(t), 1)
local integer n = (LoadInteger(abhash, GetHandleId(t), 2)+1)
local location l=GetUnitLoc(c)
local group g = GetUnitsInRangeOfLocAll(HealingAura_Range(level), l)
local unit u
call RemoveLocation(l)
if(IsUnitDeadBJ(c)) then
set n=HealingAura_LoopCount(level)
else
loop
set u=FirstOfGroup(g)
exitwhen u==null
if(IsUnitAliveBJ(u)) then
if(IsUnitAlly(u, GetOwningPlayer(c))) then
call SetUnitLifeBJ( u, ( GetUnitStateSwap(UNIT_STATE_LIFE, u) + HealingAura_Heal(level) ) )
call AddEffectToUnitTimed("Abilities\\Spells\\Human\\Heal\\HealTarget.mdl","origin",u,1.5)
elseif(IsUnitType(u, UNIT_TYPE_UNDEAD)) then
call UnitDamageTargetBJ( c, u, HealingAura_Damage(level), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_ENHANCED )
call AddEffectToUnitTimed("Abilities\\Spells\\Human\\Heal\\HealTarget.mdl","origin",u,1.5)
endif
endif
call GroupRemoveUnit(g,u)
endloop
endif
call DestroyGroup(g)
if(n>=HealingAura_LoopCount(level)) then
call RemoveSavedHandle(abhash, GetHandleId(t), 0)
call RemoveSavedHandle(abhash, GetHandleId(t), 1)
call RemoveSavedHandle(abhash, GetHandleId(t), 2)
call PauseTimerBJ( true, t )
call DestroyTimer(t)
else
call SaveInteger(abhash, GetHandleId(t), 2, n)
endif
set u=null
set g=null
set l=null
set c=null
set t=null
endfunction
function HealingAura_Actions takes nothing returns nothing
local unit c=GetSpellAbilityUnit()
local timer t = CreateTimer()
local integer level=GetUnitAbilityLevel(c,HealingAura_SpellId())
call SaveUnitHandle(abhash, GetHandleId(t), 0, c)
call SaveInteger(abhash, GetHandleId(t), 1, level)
call TimerStart(t,HealingAura_Interval(level),true,function HealingAura_Loop)
set t=null
set c=null
endfunction
//===========================================================================
function HealingAura_Conditions takes nothing returns boolean
if (GetSpellAbilityId() == HealingAura_SpellId()) then
return true
endif
return false
endfunction
function InitTrig_HealingAura takes nothing returns nothing
set gg_trg_HealingAura = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_HealingAura, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_HealingAura, Condition( function HealingAura_Conditions ) )
call TriggerAddAction( gg_trg_HealingAura, function HealingAura_Actions )
endfunction
endlibrary
//TESH.scrollpos=8
//TESH.alwaysfold=0
function Trig_Shadow_form_M_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0CF' ) ) then
return false
endif
return true
endfunction
function Trig_Shadow_form_M_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local integer l = GetUnitAbilityLevelSwapped('A0CF', c)
call SetUnitVertexColorBJ( c, 0.00, 0.00, 0.00, 0 )
call UnitAddAbilityBJ( 'Agho', c )
call AddEffectToUnitTimed("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl","chest",c,1.00)
call UnitAddAbilityBJ( udg_List_Ability_Moonshadow[l], c )
call TriggerSleepAction( I2R(( 20 + ( l * 3 ) )) )
call UnitRemoveAbilityBJ( udg_List_Ability_Moonshadow[l], c )
call UnitRemoveAbilityBJ( 'Agho', c )
call AddEffectToUnitTimed("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl","chest",c,1.00)
call SetUnitVertexColorBJ( c, 100.00, 100.00, 100.00, 0 )
endfunction
//===========================================================================
function InitTrig_Shadow_form_M takes nothing returns nothing
set gg_trg_Shadow_form_M = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shadow_form_M, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Shadow_form_M, Condition( function Trig_Shadow_form_M_Conditions ) )
call TriggerAddAction( gg_trg_Shadow_form_M, function Trig_Shadow_form_M_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Comand_Focus_Fire_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0G0' ) ) then
return false
endif
return true
endfunction
function Trig_Comand_Focus_Fire_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local group g = CreateGroup()
local group g2 = CreateGroup()
local location l = GetUnitLoc(c)
local unit u
local integer i = 0
local unit array units
local string array orders
set g = GetUnitsInRangeOfLocAll(500, l)
loop
set u = FirstOfGroup(g)
exitwhen u == null
if IsUnitAliveBJ(u) then
if GetOwningPlayer(u) == Player(0) then
set i = i+1
set units[i]= u
set orders[i]= OrderId2StringBJ(GetUnitCurrentOrder(u))
call IssueTargetOrderBJ( u, "attack", target )
call GroupRemoveUnit(g,u)
call GroupAddUnitSimple( u, g2 )
else
call GroupRemoveUnit(g,u)
endif
else
call GroupRemoveUnit(g,u)
endif
endloop
loop
exitwhen CountUnitsInGroup(g2) == 0 or IsUnitDeadBJ(target)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = i
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if (IsUnitDeadBJ(units[bj_forLoopAIndex]) == true ) then
call GroupRemoveUnit(g2,units[bj_forLoopAIndex])
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 1))
endloop
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = i
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call IssuePointOrderLocBJ( units[bj_forLoopAIndex], "attack", udg_AttackLocations[GetUnitUserData(units[bj_forLoopAIndex])] )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call DestroyGroup(g)
call DestroyGroup(g2)
set l = null
set g = null
set g2 = null
endfunction
//===========================================================================
function InitTrig_Comand_Focus_Fire takes nothing returns nothing
set gg_trg_Comand_Focus_Fire = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Comand_Focus_Fire, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Comand_Focus_Fire, Condition( function Trig_Comand_Focus_Fire_Conditions ) )
call TriggerAddAction( gg_trg_Comand_Focus_Fire, function Trig_Comand_Focus_Fire_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Wisp_Dies_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'N02J' ) ) then
return false
endif
return true
endfunction
function Trig_Wisp_Dies_Actions takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
//call CreateNUnitsAtLoc( 1, 'h01R', GetOwningPlayer(GetSpellAbilityUnit()), GetRectCenter(gg_rct_SentinelReselectHeroArea), bj_UNIT_FACING )
//set udg_Ability_Wisp_Dummyunit[p] = GetLastCreatedUnit()
call SetUnitLifeBJ( udg_Player_Hero[GetConvertedPlayerId(p)], ( GetUnitStateSwap(UNIT_STATE_LIFE, udg_Player_Hero[GetConvertedPlayerId(p)]) - ( GetUnitStateSwap(UNIT_STATE_MAX_LIFE, udg_Player_Hero[GetConvertedPlayerId(p)]) * 0.20 ) ) )
call AddEffectToUnitTimed("Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl","chest",udg_Player_Hero[GetConvertedPlayerId(p)],2)
call UnitRemoveAbilityBJ( 'A0J6', udg_Player_Hero[GetConvertedPlayerId(p)] )
call UnitAddAbilityBJ( 'A0J7', udg_Player_Hero[GetConvertedPlayerId(p)] )
call IssueImmediateOrderBJ( udg_Player_Hero[GetConvertedPlayerId(p)], "roar" )
call TriggerSleepAction( 120.00 )
call UnitRemoveAbilityBJ( 'A0J7', udg_Player_Hero[GetConvertedPlayerId(p)] )
if GetUnitTypeId(udg_Player_Hero[GetConvertedPlayerId(p)]) == 'N00U' then
call UnitAddAbilityBJ( 'A0J5', udg_Player_Hero[GetConvertedPlayerId(p)] )
call SetUnitAbilityLevelSwapped( 'A0J5', udg_Player_Hero[GetConvertedPlayerId(p)], GetHeroLevel(udg_Player_Hero[GetConvertedPlayerId(p)]))
endif
endfunction
//===========================================================================
function InitTrig_Wisp_Dies takes nothing returns nothing
set gg_trg_Wisp_Dies = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Wisp_Dies, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Wisp_Dies, Condition( function Trig_Wisp_Dies_Conditions ) )
call TriggerAddAction( gg_trg_Wisp_Dies, function Trig_Wisp_Dies_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Flame_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0IO' ) ) then
return false
endif
return true
endfunction
function Trig_Flame_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local player p = GetOwningPlayer(c)
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local location l = GetSpellTargetLoc()
local unit d
call AddEffectToLocTimed("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl",x ,y ,1.5)
call ShowUnitHide( c )
set d = CreateUnit(p, 'h01P', x, y, GetUnitFacing(c))
call IssuePointOrderLocBJ( d, "move", l )
loop
exitwhen ( DistanceBetweenPoints(GetUnitLoc(d), l) < 50 )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.25))
endloop
call RemoveUnit( d )
call ShowUnitShow( c )
call SelectUnitForPlayerSingle( c, p )
set l = null
endfunction
//===========================================================================
function InitTrig_Item_Flamecloak takes nothing returns nothing
set gg_trg_Item_Flamecloak = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Item_Flamecloak, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Item_Flamecloak, Condition( function Trig_Flame_Conditions ) )
call TriggerAddAction( gg_trg_Item_Flamecloak, function Trig_Flame_Actions )
endfunction
//TESH.scrollpos=4
//TESH.alwaysfold=0
function Trig_Frozen_Death_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0C9' ) ) then
return false
endif
return true
endfunction
function Trig_Frozen_Death_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local player p = GetOwningPlayer(c)
local unit nd = CreateUnit(Player(13), 'h01L', x, y, GetUnitFacing(c))
local unit pd
local integer l = GetUnitAbilityLevelSwapped('A0C9',c)
local integer i = 0
loop
exitwhen i >= (l+3)
set pd = CreateUnit(p, 'h01I', x, y, GetUnitFacing(c))
call UnitAddAbilityBJ( udg_Ability_Frost_Death_DummySpell[l], pd )
call SetUnitAbilityLevelSwapped( udg_Ability_Frost_Death_DummySpell[l], pd, i )
call IssueTargetOrderBJ( pd, "frostnova", nd )
call CircleOfEffectTimed((75*i),16,x,y,"Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl",2.5)
call PolledWait(0.35)
set i = i + 1
call RemoveUnit(pd)
endloop
call PolledWait(0.5)
call RemoveUnit(nd)
endfunction
//===========================================================================
function InitTrig_Frozen_Death takes nothing returns nothing
set gg_trg_Frozen_Death = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Frozen_Death, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Frozen_Death, Condition( function Trig_Frozen_Death_Conditions ) )
call TriggerAddAction( gg_trg_Frozen_Death, function Trig_Frozen_Death_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Orb uses Ability, Effect
function Trig_Frozen_Orb_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0IM' ) ) then
return false
endif
return true
endfunction
globals
private hashtable ab_hash = InitHashtable()
endglobals
function Orbtimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(ab_hash, GetHandleId(t), 0)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local player p = GetOwningPlayer(u)
local unit orb = CreateUnit(p, 'h01N', x, y, GetUnitFacing(u))
//call PolledWait(0.25)
//call DisplayTimedTextToForce( GetPlayersAll(), 5, GetUnitName(orb) )
//call DisplayTimedTextToForce( GetPlayersAll(), 5, GetUnitName(u) )
call IssueImmediateOrderBJ( orb, "locustswarm" )
call UnitApplyTimedLifeBJ( 2.50, 'BTLF', orb )
if (IsUnitAliveBJ(u) == false) then
call PauseTimerBJ( true, t )
call DestroyTimer(t)
endif
endfunction
function Trig_Frozen_Orb_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit dummy
local location l = GetSpellTargetLoc()
local location lc = GetUnitLoc(caster)
local unit orb
local timer t = CreateTimer()
call CreateNUnitsAtLoc( 1, 'H01B', GetOwningPlayer(caster), lc, GetUnitFacing(caster) )
set dummy = GetLastCreatedUnit()
call SelectHeroSkill( dummy, 'A0G4' )
call SetUnitAbilityLevelSwapped( 'A0G4', dummy, GetUnitAbilityLevelSwapped('A0IM', caster) )
call TriggerSleepAction( 0.15 )
call IssuePointOrderLocBJ( dummy, "impale", l )
call CreateNUnitsAtLocFacingLocBJ( 1, 'h01M', GetOwningPlayer(caster), lc, l )
set orb = GetLastCreatedUnit()
call SaveUnitHandle(ab_hash, GetHandleId(t), 0, orb)
call IssuePointOrderLocBJ( orb, "move", PolarProjectionBJ(lc, 1000.00, GetUnitFacing(orb)) )
call TimerStart(t, 0.5, true, function Orbtimer)
call TriggerSleepAction( 2.50 )
call RemoveUnit( dummy )
call RemoveUnit( orb )
set lc = null
set l = null
call PauseTimerBJ( true, t )
call DestroyTimer(t)
endfunction
//===========================================================================
function InitTrig_Frozen_Orb takes nothing returns nothing
set gg_trg_Frozen_Orb = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Frozen_Orb, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Frozen_Orb, Condition( function Trig_Frozen_Orb_Conditions ) )
call TriggerAddAction( gg_trg_Frozen_Orb, function Trig_Frozen_Orb_Actions )
endfunction
endlibrary
function Trig_Frozen_Orb_Copy_Copy_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0CB' ) ) then
return false
endif
return true
endfunction
function Trig_Frozen_Orb_Copy_Copy_Actions takes nothing returns nothing
local unit udg_local_caster_unit
local unit udg_local_dummy_unit
set udg_Local_Caster_Unit = GetTriggerUnit()
set udg_Local_Location = GetSpellTargetLoc()
call CreateNUnitsAtLoc( 1, 'H01B', GetOwningPlayer(udg_Local_Caster_Unit), GetUnitLoc(udg_Local_Caster_Unit), GetUnitFacing(udg_Local_Caster_Unit) )
set udg_Local_Dummy_Unit = GetLastCreatedUnit()
call SelectHeroSkill( udg_Local_Dummy_Unit, 'A0G4' )
call SetUnitAbilityLevelSwapped( 'A0G4', udg_Local_Dummy_Unit, GetUnitAbilityLevelSwapped('A0CB', udg_Local_Caster_Unit) )
call TriggerSleepAction( 0.15 )
call IssuePointOrderLocBJ( udg_Local_Dummy_Unit, "impale", udg_Local_Location )
call CreateNUnitsAtLocFacingLocBJ( 1, 'h01M', GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(udg_Local_Caster_Unit), udg_Local_Location )
set udg_Ability_Frostpfeil = GetLastCreatedUnit()
call IssueImmediateOrderBJ( GetLastCreatedUnit(), "locustswarm" )
call IssuePointOrderLocBJ( udg_Ability_Frostpfeil, "move", PolarProjectionBJ(GetUnitLoc(udg_Local_Caster_Unit), 1000.00, GetUnitFacing(udg_Ability_Frostpfeil)) )
call TriggerSleepAction( 2.00 )
call RemoveUnit( udg_Local_Dummy_Unit )
call RemoveUnit( udg_Ability_Frostpfeil )
endfunction
//===========================================================================
function InitTrig_Frozen_Orb_Copy_Copy takes nothing returns nothing
set gg_trg_Frozen_Orb_Copy_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Frozen_Orb_Copy_Copy, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Frozen_Orb_Copy_Copy, Condition( function Trig_Frozen_Orb_Copy_Copy_Conditions ) )
call TriggerAddAction( gg_trg_Frozen_Orb_Copy_Copy, function Trig_Frozen_Orb_Copy_Copy_Actions )
endfunction
//TESH.scrollpos=151
//TESH.alwaysfold=0
library Toss uses Ability, Effect, MS
//*****************************************************************************
//* *
//* **Toss spell** *
//* - A tornado lifts a target unit into the air and *
//* chucks it in a random angle *
//* *
//* Change any of these next values to change details of what *
//* happens in the spell *
//* *
//* Made by Bobo_The_Kodo@Azeroth *
//* Adapted to MovementSystem and CasterSystem by Themerion *
//* (not optimized)
//* Got Rid of the CasterSystem and Adapted for Patch 1.24
//* by Murder X
//*****************************************************************************
globals
private hashtable ab_hash = InitHashtable()
endglobals
//ValueList
//=====================================================================
constant function Toss_SpellId takes nothing returns integer
return 'A0ET'
//Change this to the rawcode of the Toss spell //To find the rawcode of the spell, go to it in the object editor and press Ctrl + D when you are looking at your spell
endfunction
//======================================================================
constant function Toss_Damage takes integer level returns real
return 70 + level * 30.
//Change this to change the damage to the tossed unit
endfunction
constant function Toss_Distance takes integer level returns real
return level * 0 + 500.
//Change this to change the distance the unit is thrown
endfunction
constant function Toss_ThrowDuration takes integer level returns real
return level * 0 + .65
//Change this to change the duration it takes to toss from the air to the ground
endfunction
constant function Toss_Height takes integer level returns real
return level * 0 + 400.
// Change this to change the height the target is brought up to by the tornado
endfunction
constant function Toss_TornadoDuration takes integer level returns real
return level * 0 + .8
//Change this to change the time that the unit is in the air for before it gets thrown
endfunction
constant function Toss_TimerInterval takes nothing returns real
return .03
//Change this to change the interval between moving the target unit //.01 is 100 times per second
endfunction
// 0=height-(gravity*time^2)/2
// 2*height=gravity*time^2
// 2*height/time^2=gravity
constant function Toss_Gravity takes real duration, integer lvl returns real
return 2*Toss_Height(lvl)/(duration*duration)*Toss_TimerInterval()*Toss_TimerInterval()
endfunction
//EndValueList
//=====================================================================
function Toss_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer Level = LoadInteger(ab_hash, GetHandleId(t), 2)
local unit Tossed = LoadUnitHandle(ab_hash, GetHandleId(t), 1)
local real TimeLeft = (I2R(LoadInteger(ab_hash, GetHandleId(t), 7))/100) - Toss_TimerInterval()
local real MaxTime = Toss_ThrowDuration( Level )
local real Distance = (I2R(LoadInteger(ab_hash, GetHandleId(t), 4))/100)
local real Angle = (I2R(LoadInteger(ab_hash, GetHandleId(t), 5))/100)
local real x = GetUnitX( Tossed ) + ( Toss_TimerInterval()*Distance/MaxTime ) * Cos( bj_DEGTORAD * Angle )
local real y = GetUnitY( Tossed ) + ( Toss_TimerInterval()*Distance/MaxTime ) * Sin( bj_DEGTORAD * Angle )
local effect e
local unit Tosser = LoadUnitHandle(ab_hash, GetHandleId(t), 0)
local integer Current = (LoadInteger(ab_hash, GetHandleId(t), 3)) + 1
call SetUnitX( Tossed, x )
call SetUnitY( Tossed, y )
call SetUnitFlyHeight( Tossed, GetUnitFlyHeight(Tossed)-Toss_Gravity(MaxTime,Level)*Current, 0 )
if TimeLeft <= .01 then
call SetUnitInvulnerable( Tossed, false )
call DestroyEffect( AddSpecialEffect( "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", x, y ) )
call PauseTimer( t )
// cs_FlyingHeightHack='Amrf'
call UnitRemoveAbility(Tossed,'Amrf')
call PauseUnit( Tossed, false )
call SetUnitInvulnerable( Tossed, false )
call SetUnitTimeScale( Tossed, 1 )
call UnitDamageTarget( Tosser, Tossed, Toss_Damage( Level ), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, null )
//call CleanAttachedVars( t )
//call DestroyTimer( t )
call PauseTimerBJ( true, t )
call DestroyTimer(t)
call RemoveSavedHandle(ab_hash, GetHandleId(t), 0)
call RemoveSavedHandle(ab_hash, GetHandleId(t), 1)
call RemoveSavedHandle(ab_hash, GetHandleId(t), 2)
call RemoveSavedHandle(ab_hash, GetHandleId(t), 3)
call RemoveSavedHandle(ab_hash, GetHandleId(t), 4)
call RemoveSavedHandle(ab_hash, GetHandleId(t), 5)
call RemoveSavedHandle(ab_hash, GetHandleId(t), 6)
call RemoveSavedHandle(ab_hash, GetHandleId(t), 7)
call RemoveSavedHandle(ab_hash, GetHandleId(t), 8)
else
call SaveInteger(ab_hash, GetHandleId(t), 7, R2I(TimeLeft*100))
//call AttachReal( t, "time", TimeLeft )
call SaveInteger(ab_hash, GetHandleId(t), 3, Current)
//call AttachInt( t, "Current", Current )
endif
set t = null
set Tossed = null
set Tosser = null
endfunction
function Toss_StartThrow takes unit Caster, unit Target, integer lvl returns nothing
local timer t = CreateTimer()
local integer count = 0
local integer distance = R2I((MS_GetClearDistanceForFloat1(GetUnitX(Target),GetUnitY(Target),Toss_Distance(lvl),GetUnitFacing(Target))) * 100)
local integer angle = R2I(GetUnitFacing(Target) * 100)
local integer maxtime = R2I(Toss_ThrowDuration( lvl ) * 100)
local integer time = R2I(Toss_ThrowDuration( lvl ) * 100)
local integer hight = R2I(Toss_Height( lvl ) * 100)
call SaveUnitHandle(ab_hash, GetHandleId(t), 0, Caster)
call SaveUnitHandle(ab_hash, GetHandleId(t), 1, Target)
call SaveInteger(ab_hash, GetHandleId(t), 2, lvl)
call SaveInteger(ab_hash, GetHandleId(t), 3, count)
call SaveInteger(ab_hash, GetHandleId(t), 4, distance)
call SaveInteger(ab_hash, GetHandleId(t), 5, angle)
call SaveInteger(ab_hash, GetHandleId(t), 6, maxtime)
call SaveInteger(ab_hash, GetHandleId(t), 7, time)
call SaveInteger(ab_hash, GetHandleId(t), 8, hight)
//--call AttachInt( t, "Current", 0 )
//--call AttachInt( t, "Level", lvl )
//--call AttachObject( t, "Tossed", Target )
//call AttachReal(t,"Distance",MS_GetClearDistanceForFloat1(GetUnitX(Target),GetUnitY(Target),Toss_Distance(lvl),GetUnitFacing(Target)))
//call AttachReal(t,"Angle",GetUnitFacing( Target ))
//--call AttachObject( t, "Tosser", Caster )
//call AttachReal( t, "maxtime", Toss_ThrowDuration( lvl ) )
//call AttachReal( t, "time", Toss_ThrowDuration( lvl ) )
//call AttachReal( t, "Height", Toss_Height( lvl ) )
call TimerStart( t, Toss_TimerInterval(), true, function Toss_Timer )
set t = null
endfunction
function Toss_SpinTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(ab_hash, GetHandleId(t), 1)
local integer i = LoadInteger(ab_hash, GetHandleId(t), 3) +1
local real r = GetUnitFacing( u ) + 12 + .25 * i
local integer lvl = LoadInteger(ab_hash, GetHandleId(t), 2)
local unit c = LoadUnitHandle(ab_hash, GetHandleId(t), 0)
if r > 359 then
set r = r - 360
endif
call SetUnitFacingTimed( u, r, 0.0001 )
call SetUnitX( u, GetUnitX( u ) + ( 1.5 + .005 * i ) * CosBJ(r) )
call SetUnitY( u, GetUnitY( u ) + ( 1.5 + .005 * i ) * SinBJ(r) )
if i > Toss_TornadoDuration( lvl )/.0025 then
call SetUnitFacing( u, GetUnitFacing( u ) )
//call DestroyEffect( GetAttachedEffect( t, "effect" ) )
call Toss_StartThrow( c, u, lvl )
call PauseTimerBJ( true, t )
call DestroyTimer(t)
else
call SaveInteger(ab_hash, GetHandleId(t), 3, i)
endif
set t = null
set u = null
endfunction
function Toss takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local unit Target = GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevel( Caster, Toss_SpellId() )
local timer t = CreateTimer()
local integer count = 0
call PolledWait(0)
call SaveUnitHandle(ab_hash, GetHandleId(t), 0, Caster)
call SaveUnitHandle(ab_hash, GetHandleId(t), 1, Target)
call SaveInteger(ab_hash, GetHandleId(t), 2, lvl)
call SaveInteger(ab_hash, GetHandleId(t), 3, count)
call AddEffectToLocTimed("Abilities\\Spells\\Other\\Tornado\\TornadoElemental.mdl",GetUnitX(Target), GetUnitY(Target),0.8)
//call AttachObject( t, "effect", AddSpecialEffect( "Abilities\\Spells\\Other\\Tornado\\TornadoElemental.mdl", GetUnitX( Target ), GetUnitY( Target ) ) )
//call AttachInt( t, "i", 0 )
//call AttachObject( t, "Caster", Caster )
//call AttachObject( t, "Target", Target )
//call AttachInt( t, "lvl", lvl )
call TimerStart( t, .005, true, function Toss_SpinTimer )
call UnitAddAbility( Target, 'Amrf' )
call SetUnitFlyHeight( Target, Toss_Height( lvl ), Toss_Height( lvl ) / .8 )
call SetUnitInvulnerable( Target, false )
call PauseUnit( Target, true )
set Target = null
set Caster = null
endfunction
//==============================================================================
function Toss_Condition takes nothing returns boolean
return GetSpellAbilityId()==Toss_SpellId()
endfunction
function InitTrig_Toss takes nothing returns nothing
set gg_trg_Toss = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Toss,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Toss,Condition(function Toss_Condition))
call TriggerAddAction(gg_trg_Toss, function Toss)
endfunction
endlibrary
//TESH.scrollpos=3
//TESH.alwaysfold=0
function Trig_Deadly_Sting_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A04X' ) ) then
return false
endif
return true
endfunction
function Trig_Deadly_Sting_Actions takes nothing returns nothing
local integer i=0
local unit target = GetSpellTargetUnit()
local unit caster = GetSpellAbilityUnit()
local real damage = ( ( 6.43 * I2R(GetUnitAbilityLevelSwapped('A04X', caster)) ) + 6.42 )
// ---
call PolledWait( 1.00 )
call AddEffectToUnitTimed("Abilities\\Weapons\\PoisonSting\\PoisonStingTarget.mdl","hand, left",target,35.00)
call AddEffectToUnitTimed("Abilities\\Weapons\\PoisonSting\\PoisonStingTarget.mdl","hand, right",target,35.00)
call AddEffectToUnitTimed("Abilities\\Weapons\\PoisonSting\\PoisonStingTarget.mdl","chest",target,35.00)
call AddEffectToUnitTimed("Abilities\\Weapons\\PoisonSting\\PoisonStingTarget.mdl","head",target,35.00)
// ---
loop
set i=i+1
exitwhen i>35 or IsUnitType(target,UNIT_TYPE_DEAD)
call PolledWait( 1.02 )
call UnitDamageTargetBJ( caster, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_POISON )
endloop
// ---
set target=null
set caster=null
endfunction
//===========================================================================
function InitTrig_Deadly_Sting takes nothing returns nothing
set gg_trg_Deadly_Sting = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Deadly_Sting, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Deadly_Sting, Condition( function Trig_Deadly_Sting_Conditions ) )
call TriggerAddAction( gg_trg_Deadly_Sting, function Trig_Deadly_Sting_Actions )
endfunction
//TESH.scrollpos=18
//TESH.alwaysfold=0
function Trig_Shadow_form_S_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0CG' ) ) then
return false
endif
return true
endfunction
function Trig_Shadow_form_S_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local integer l = GetUnitAbilityLevelSwapped('A0CG', c)
local real r = ( 17 + ( GetUnitAbilityLevelSwapped('A0CG', c) * 3 ) )
call AddEffectToUnitTimed("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl","chest",c,1)
call SetUnitVertexColorBJ( c, 0.00, 0.00, 0.00, 80.00 )
//Effekte Adden
call AddEffectToUnitTimed("Doodads\\LordaeronSummer\\Props\\SmokeSmudge\\SmokeSmudge2.mdl","chest",c,r)
call AddEffectToUnitTimed("Doodads\\LordaeronSummer\\Props\\SmokeSmudge\\SmokeSmudge1.mdl","chest",c,r)
call AddEffectToUnitTimed("Doodads\\LordaeronSummer\\Props\\SmokeSmudge\\SmokeSmudge0.mdl","chest",c,r)
call AddEffectToUnitTimed("Doodads\\LordaeronSummer\\Props\\SmokeSmudge\\SmokeSmudge2.mdl","hand, right",c,r)
call AddEffectToUnitTimed("Doodads\\LordaeronSummer\\Props\\SmokeSmudge\\SmokeSmudge1.mdl","hand, right",c,r)
call AddEffectToUnitTimed("Doodads\\LordaeronSummer\\Props\\SmokeSmudge\\SmokeSmudge0.mdl","hand, right",c,r)
call AddEffectToUnitTimed("Doodads\\LordaeronSummer\\Props\\SmokeSmudge\\SmokeSmudge2.mdl","hand, left",c,r)
call AddEffectToUnitTimed("Doodads\\LordaeronSummer\\Props\\SmokeSmudge\\SmokeSmudge1.mdl","hand, left",c,r)
call AddEffectToUnitTimed("Doodads\\LordaeronSummer\\Props\\SmokeSmudge\\SmokeSmudge0.mdl","hand, left",c,r)
//End Effekte Adden
call UnitAddAbilityBJ( 'Agho', c )
call UnitAddAbilityBJ( udg_Ability_Shadowform[l], c )
call PolledWait( I2R(( 17 + ( GetUnitAbilityLevelSwapped('A0CG', udg_Caster_ShadowFiend) * 3 ) )) )
call UnitRemoveAbilityBJ( udg_Ability_Shadowform[l], c )
call UnitRemoveAbilityBJ( 'Agho', c )
call SetUnitVertexColorBJ( c, 100, 100, 100, 0.00 )
call AddEffectToUnitTimed("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl","chest",c,1)
endfunction
//===========================================================================
function InitTrig_Shadow_form_S takes nothing returns nothing
set gg_trg_Shadow_form_S = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shadow_form_S, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Shadow_form_S, Condition( function Trig_Shadow_form_S_Conditions ) )
call TriggerAddAction( gg_trg_Shadow_form_S, function Trig_Shadow_form_S_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Chaos_Strike_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0EM' ) ) then
return false
endif
return true
endfunction
function Trig_Chaos_Strike_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local unit d
local location l = GetSpellTargetLoc()
//call AddEffectToLocTimed("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",GetUnitX(GetDyingUnit()),GetUnitY(GetDyingUnit()),2)
call SetUnitVertexColorBJ( c, 100, 100, 100, 100.00 )
call CreateNUnitsAtLoc( 1, 'n005', GetTriggerPlayer(), l, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
set d = GetLastCreatedUnit()
call PolledWait( 0.25 )
call PauseUnitBJ( true, c )
call SetUnitInvulnerable( c, true )
call TriggerSleepAction( 0.75 )
call SetUnitPositionLoc( c, l )
call ResetUnitAnimation( c )
call SetUnitAnimation( c, "birth" )
call SetUnitVertexColorBJ( c, 100, 100, 100, 0.00 )
call SetUnitInvulnerable( c, false )
call PolledWait( 1.00 )
call PauseUnitBJ( false, c )
set l = null
endfunction
//===========================================================================
function InitTrig_Chaos_Strike takes nothing returns nothing
set gg_trg_Chaos_Strike = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Chaos_Strike, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Chaos_Strike, Condition( function Trig_Chaos_Strike_Conditions ) )
call TriggerAddAction( gg_trg_Chaos_Strike, function Trig_Chaos_Strike_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Paralysing_Claw_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A042' ) ) then
return false
endif
return true
endfunction
function Trig_Paralysing_Claw_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local unit t = GetSpellTargetUnit()
local integer l = GetUnitAbilityLevelSwapped('A042', c)*2
local string add = "Strength +" + I2S(l)
local string sub = "Strength -" + I2S(l)
call ModifyHeroStat( bj_HEROSTAT_STR, t, bj_MODIFYMETHOD_SUB, l )
call ModifyHeroStat( bj_HEROSTAT_STR, c, bj_MODIFYMETHOD_ADD, l )
call AddEffectToUnitTimed("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl","over head",t,0.6)
call AddEffectToUnitTimed("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl","over head",c,0.6)
call CreateTextTagUnitBJ( sub, t, 0.00, 9.00, 100.00, 100.00, 100.00, 0.00 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 150.00, 90 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
call CreateTextTagUnitBJ( add, c, 0.00, 9.00, 100.00, 100.00, 100.00, 0.00 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 150.00, 90 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
call PolledWait(10)
call ModifyHeroStat( bj_HEROSTAT_STR, t, bj_MODIFYMETHOD_ADD, l )
call ModifyHeroStat( bj_HEROSTAT_STR, c, bj_MODIFYMETHOD_SUB, l )
call AddEffectToUnitTimed("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl","over head",c,0.6)
call AddEffectToUnitTimed("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl","over head",t,0.6)
call CreateTextTagUnitBJ( sub, c, 0.00, 9.00, 100.00, 100.00, 100.00, 0.00 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 150.00, 90 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
call CreateTextTagUnitBJ( add, t, 0.00, 9.00, 100.00, 100.00, 100.00, 0.00 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 150.00, 90 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
endfunction
//===========================================================================
function InitTrig_Paralysing_Claw takes nothing returns nothing
set gg_trg_Paralysing_Claw = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Paralysing_Claw, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Paralysing_Claw, Condition( function Trig_Paralysing_Claw_Conditions ) )
call TriggerAddAction( gg_trg_Paralysing_Claw, function Trig_Paralysing_Claw_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Touch_of_Doom_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A079' ) ) then
return false
endif
if ( not ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B02J') == false ) ) then
return false
endif
return true
endfunction
function Trig_Touch_of_Doom_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local unit t = GetSpellTargetUnit()
local real d = 150
local integer l = GetUnitAbilityLevelSwapped('A079', c)
local string ss = "Strength -" + I2S(l)
local string sa = "Strength +" + I2S(l)
call AddEffectToUnitTimed("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl","weapon",t,0.50)
call AddEffectToUnitTimed("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl","head",t,0.50)
call AddEffectToUnitTimed("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl","chest",t,0.50)
call AddEffectToUnitTimed("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl","hand, left",t,0.50)
call AddEffectToUnitTimed("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl","hand, right",t,0.50)
call AddEffectToUnitTimed("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl","foot, left",t,0.50)
call AddEffectToUnitTimed("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl","foot, right",t,0.50)
call UnitAddAbilityBJ( 'A0GD', t )
call ModifyHeroStat( bj_HEROSTAT_STR, t, bj_MODIFYMETHOD_SUB, l )
call CreateTextTagUnitBJ( ss, t, 0.00, 10.00, 100.00, 0.00, 0.00, 0.00 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 150.00, 90 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
call ModifyHeroStat( bj_HEROSTAT_STR, c, bj_MODIFYMETHOD_ADD, 1 )
call CreateTextTagUnitBJ( sa, c, 0.00, 10.00, 100.00, 0.00, 0.00, 0.00 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 150.00, 90 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
call PolledWait( d )
call UnitRemoveAbilityBJ( 'A0GD', t )
call ModifyHeroStat( bj_HEROSTAT_STR, t, bj_MODIFYMETHOD_ADD, l )
call CreateTextTagUnitBJ( sa, t, 0.00, 10.00, 100.00, 0.00, 0.00, 0.00 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 150.00, 90 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
endfunction
//===========================================================================
function InitTrig_Touch_of_Doom takes nothing returns nothing
set gg_trg_Touch_of_Doom = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Touch_of_Doom, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Touch_of_Doom, Condition( function Trig_Touch_of_Doom_Conditions ) )
call TriggerAddAction( gg_trg_Touch_of_Doom, function Trig_Touch_of_Doom_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Whirlwind_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A05R' ) ) then
return false
endif
return true
endfunction
function Trig_Whirlwind_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
call UnitAddAbilityBJ( 'AId0', c )
call PolledWait( 3.00 )
call UnitRemoveAbilityBJ( 'AId0', c )
endfunction
//===========================================================================
function InitTrig_Whirlwind takes nothing returns nothing
set gg_trg_Whirlwind = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Whirlwind, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Whirlwind, Condition( function Trig_Whirlwind_Conditions ) )
call TriggerAddAction( gg_trg_Whirlwind, function Trig_Whirlwind_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Lower_Resist_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A03E' ) ) then
return false
endif
return true
endfunction
function Trig_Lower_Resist_Actions takes nothing returns nothing
local unit u = GetSpellTargetUnit()
call UnitAddAbilityBJ( 'A0JC', u )
call PolledWait( 10.00 )
call UnitRemoveAbilityBJ( 'A0JC', u )
endfunction
//===========================================================================
function InitTrig_Lower_Resist takes nothing returns nothing
set gg_trg_Lower_Resist = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Lower_Resist, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Lower_Resist, Condition( function Trig_Lower_Resist_Conditions ) )
call TriggerAddAction( gg_trg_Lower_Resist, function Trig_Lower_Resist_Actions )
endfunction