// ****************************************************************
// * *
// * *
// * DMITRY's SPELL CAST SYSTEM *
// * *
// * Version 1.1 *
// * *
// ****************************************************************
function dm takes string s returns nothing
call DisplayTextToForce( GetPlayersAll(), s )
endfunction
function B2S takes boolean b returns string
if b then
return "true"
endif
return "false"
endfunction
function DistanceBetweenUnits takes unit uA, unit uB returns real
local real dx = GetUnitX(uB) - GetUnitX(uA)
local real dy = GetUnitY(uB) - GetUnitY(uA)
return SquareRoot(dx * dx + dy * dy)
endfunction
//================ Return Bug Functions ===================
function HandleToIntegerRB takes handle h returns integer
return h
return 0
endfunction
function ReturnUnitRB takes integer i returns unit
return i
return null
endfunction
function ReturnEffectRB takes integer i returns effect
return i
return null
endfunction
function ReturnItemRB takes integer i returns item
return i
return null
endfunction
function ReturnVMRB takes integer i returns fogmodifier
return i
return null
endfunction
function ReturnPlayerRB takes integer i returns player
return i
return null
endfunction
function ReturnLocationRB takes integer i returns location
return i
return null
endfunction
function ReturnRectRB takes integer i returns rect
return i
return null
endfunction
function ReturnTriggerRB takes integer i returns trigger
return i
return null
endfunction
function ReturnFtextRB takes integer i returns texttag
return i
return null
endfunction
function ReturnLightningRB takes integer i returns lightning
return i
return null
endfunction
function ReturnTimerRB takes integer i returns timer
return i
return null
endfunction
function ReturnGroupRB takes integer i returns group
return i
return null
endfunction
//================= Super Custom Value ==================================
function StoreIntegerSCV takes handle h, string key, integer val returns nothing
call StoreInteger(udg_cache, I2S(HandleToIntegerRB(h)), key, val)
endfunction
function StoreRealSCV takes handle h, string key, real val returns nothing
call StoreReal(udg_cache, I2S(HandleToIntegerRB(h)), key, val)
endfunction
function StoreObjectSCV takes handle h, string key, handle h2 returns nothing
call StoreInteger(udg_cache, I2S(HandleToIntegerRB(h)), key, HandleToIntegerRB(h2))
endfunction
function LoadValueSCV takes handle h, string key returns integer
return GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key)
endfunction
function LoadItemSCV takes handle h, string key returns item
return ReturnItemRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function LoadGroupSCV takes handle h, string key returns group
return ReturnGroupRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function LoadVMSCV takes handle h, string key returns fogmodifier
return ReturnVMRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function LoadRealSCV takes handle h, string key returns real
return GetStoredReal(udg_cache, I2S(HandleToIntegerRB(h)), key)
endfunction
function LoadUnitSCV takes handle h, string key returns unit
return ReturnUnitRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function LoadEffectSCV takes handle h, string key returns effect
return ReturnEffectRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function LoadPlayerSCV takes handle h, string key returns player
return ReturnPlayerRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function LoadLocationSCV takes handle h, string key returns location
return ReturnLocationRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function LoadRectSCV takes handle h, string key returns rect
return ReturnRectRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function LoadTriggerSCV takes handle h, string key returns trigger
return ReturnTriggerRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function LoadLightningSCV takes handle h, string key returns lightning
return ReturnLightningRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function LoadTimerSCV takes handle h, string key returns timer
return ReturnTimerRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function FlushObjectSCV takes handle h returns nothing
call FlushStoredMission(udg_cache, I2S(HandleToIntegerRB(h)))
endfunction
//================ Buffs & Damage ==================
function IsUnitInvulnerable takes unit u returns boolean
return GetUnitAbilityLevel(u,'Avul') > 0 or UnitHasBuffBJ(u, 'Bvul') or UnitHasBuffBJ(u, 'BHds') or UnitHasBuffBJ(u, 'BOvd') or GetUnitAbilityLevel(u,'Aloc') > 0
endfunction
function IsEmpty takes group gr returns boolean
return (FirstOfGroup(gr) == null)
endfunction
//Initialization of Celebrate Spell Cast System
function InitializeCSCS takes integer dummy_caster_id, rect casters_place returns nothing
local integer i = 1
local player p = Player(PLAYER_NEUTRAL_PASSIVE)
set udg_cache = InitGameCache("MapName.w3v")
set udg_cs_DummyCasterType = dummy_caster_id
set udg_cs_FreeCastersPlace = GetRectCenter(casters_place)
loop
exitwhen i > 20
call GroupAddUnit(udg_cs_FreeCasters, CreateUnitAtLoc(p, udg_cs_DummyCasterType, udg_cs_FreeCastersPlace, 0))
set i = i + 1
endloop
set udg_RessurectionsPayed[10] = 0
set p = null
endfunction
function FindFreeCaster takes nothing returns unit
local unit tunit = FirstOfGroup(udg_cs_FreeCasters)
if tunit != null then
call GroupRemoveUnit(udg_cs_FreeCasters, tunit)
return tunit
endif
return CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), udg_cs_DummyCasterType, udg_cs_FreeCastersPlace, 0)
endfunction
function MakeFree takes unit cstr returns nothing
call SetUnitPositionLoc(cstr, udg_cs_FreeCastersPlace)
call SetUnitOwner( cstr, Player(PLAYER_NEUTRAL_PASSIVE), true )
call GroupAddUnit(udg_cs_FreeCasters, cstr)
endfunction
function RemCstr_tactions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string hndl = I2S(HandleToIntegerRB(t))
local unit caster = ReturnUnitRB(GetStoredInteger(udg_cache, hndl, "cstr"))
local integer abil_id = LoadValueSCV(t, "a_i")
call UnitRemoveAbility(caster, abil_id)
call MakeFree(caster)
call FlushObjectSCV(t)
call DestroyTimer(t)
set caster = null
set t = null
endfunction
function AddBuffNoTarget takes unit target, integer abil_id, string order, player p returns nothing
local unit caster = FindFreeCaster()
local timer t = CreateTimer()
local string hndl = I2S(HandleToIntegerRB(t))
call SetUnitX(caster, GetUnitX(target))
call SetUnitY(caster, GetUnitY(target))
call SetUnitOwner(caster, p, true)
call UnitAddAbility(caster, abil_id)
call StoreInteger(udg_cache, hndl, "cstr", HandleToIntegerRB(caster))
call IssueImmediateOrder(caster, order)
call TimerStart(t, 0.5, false, function RemCstr_tactions)
set t = null
set caster = null
endfunction
function AddBuffUnit takes unit target, integer abil_id, string order, player p returns nothing
local unit caster = FindFreeCaster()
local timer t = CreateTimer()
local string hndl = I2S(HandleToIntegerRB(t))
call SetUnitX(caster, GetUnitX(target))
call SetUnitY(caster, GetUnitY(target))
call SetUnitOwner(caster, p, true)
call UnitAddAbility(caster, abil_id)
call StoreInteger(udg_cache, hndl, "cstr", HandleToIntegerRB(caster))
call StoreInteger(udg_cache, hndl, "a_i", abil_id)
if not IsUnitDeadBJ(caster) then
call IssueTargetOrder(caster, order, target)
endif
call TimerStart(t, 0.3, false, function RemCstr_tactions)
set t = null
set caster = null
endfunction
function AddBuffUnitXY takes unit target, integer abil_id, string order, player p, integer level, real X, real Y returns nothing
local unit caster = FindFreeCaster()
local timer t = CreateTimer()
local string hndl = I2S(HandleToIntegerRB(t))
call SetUnitX(caster, X)
call SetUnitY(caster, Y)
call SetUnitOwner(caster, p, true)
call UnitAddAbility(caster, abil_id)
call SetUnitAbilityLevel(caster, abil_id, level)
call StoreInteger(udg_cache, hndl, "cstr", HandleToIntegerRB(caster))
call IssueTargetOrder(caster, order, target)
call TimerStart(t, 0.3, false, function RemCstr_tactions)
set t = null
set caster = null
endfunction
function AddBuffUnitAdv takes unit target, integer abil_id, string order, player p, integer level returns nothing
call AddBuffUnitXY(target, abil_id, order, p, level, GetUnitX(target), GetUnitY(target))
endfunction
function LFT_timeout takes nothing returns nothing
local timer t = GetExpiredTimer()
local string s = I2S(HandleToIntegerRB(t))
local timer tt = ReturnTimerRB(GetStoredInteger(udg_cache, s, "tt"))
local string str = I2S(HandleToIntegerRB(tt))
local texttag ttag = ReturnFtextRB(GetStoredInteger(udg_cache, str, "ttag"))
call FlushStoredMission(udg_cache, str)
call FlushStoredMission(udg_cache, s)
call SetTextTagPermanentBJ(ttag, false)
call DestroyTextTag(ttag)
call DestroyTimer(tt)
call DestroyTimer(t)
set ttag = null
set tt = null
set t = null
endfunction
function LFT_taction takes nothing returns nothing
local timer t = GetExpiredTimer()
local string s = I2S(HandleToIntegerRB(t))
local texttag ttag = ReturnFtextRB(GetStoredInteger(udg_cache, s, "ttag"))
local real X = GetStoredReal(udg_cache, s, "X")
local real Y = GetStoredReal(udg_cache, s, "Y")
local real heightOffset = GetStoredReal(udg_cache, s, "hO") + 2 // 2 = dz
call SetTextTagPos(ttag, X, Y, heightOffset)
call StoreReal(udg_cache, s, "hO", heightOffset)
set t = null
set ttag = null
endfunction
function LaunchFloatingText takes string s, real X, real Y, real heightOffset, real height, integer red, integer green, integer blue, real timeout returns nothing
local texttag t = CreateTextTag()
local timer tt = CreateTimer()
local string str = I2S(HandleToIntegerRB(tt))
local integer ti = HandleToIntegerRB(tt)
call SetTextTagText(t, s, TextTagSize2Height(height))
call SetTextTagPos(t, X, Y, heightOffset)
call SetTextTagColor(t, red, green, blue, 255)
call SetTextTagVisibility(t, true)
call StoreInteger(udg_cache, str, "ttag", HandleToIntegerRB(t))
call StoreReal(udg_cache, str, "X", X)
call StoreReal(udg_cache, str, "Y", Y)
call StoreReal(udg_cache, str, "hO", heightOffset)
call TimerStart(tt, 0.03, true, function LFT_taction)
set tt = CreateTimer()
set str = I2S(HandleToIntegerRB(tt))
call StoreInteger(udg_cache, str, "tt", ti)
call TimerStart(tt, timeout, false, function LFT_timeout)
set t = null
set tt = null
endfunction
function DamageUnit takes unit target, real damage, player p, boolean ShowTtag returns nothing
local real X = GetUnitX(target)
local real Y = GetUnitY(target)
local unit atkr = null
if not IsUnitInvulnerable(target) then
set atkr = CreateUnit(p, udg_cs_DummyCasterType, X, Y, 270)
call UnitDamageTargetBJ( atkr, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call RemoveUnit(atkr)
set atkr = null
if ShowTtag then
call LaunchFloatingText("- " + I2S(R2I(damage)) + "!", X, Y, 60, 10, 255, 0, 0, 3)
endif
endif
endfunction
function DamageMana takes unit target, real damage, boolean ShowTTag returns nothing
local real mana = GetUnitStateSwap(UNIT_STATE_MANA, target)
local real X = GetUnitX(target)
local real Y = GetUnitY(target)
local real manaloss = RMinBJ(mana, damage)
if not IsUnitInvulnerable(target) then
call SetUnitState(target, UNIT_STATE_MANA, mana - manaloss)
if ShowTTag then
call LaunchFloatingText(" - " + I2S(R2I(manaloss)), X, Y, 60, 10, 105, 255, 255, 3)
endif
endif
endfunction
//================ Special Effect functions ====================
function destroy_effect takes nothing returns nothing
local timer t = GetExpiredTimer()
call DestroyEffect(ReturnEffectRB(LoadValueSCV(t, "fx")))
call FlushObjectSCV(t)
call DestroyTimer(t)
endfunction
function LaunchEffectLoc takes string modelfile, location loc, real timeout returns nothing
local timer t = CreateTimer()
call TimerStart(t, timeout, false, function destroy_effect)
call StoreIntegerSCV(t, "fx", HandleToIntegerRB(AddSpecialEffectLoc(modelfile, loc)))
set t = null
endfunction
function LaunchEffectUnit takes string modelfile, unit target, string attachpoint, real timeout returns nothing
local timer t = CreateTimer()
call TimerStart(t, timeout, false, function destroy_effect)
call StoreIntegerSCV(t, "fx", HandleToIntegerRB(AddSpecialEffectTarget(modelfile, target, attachpoint)))
set t = null
endfunction
function DrawCircleTimed takes string modelfile, location centre, real timeout, real radius, real angle, real waitTime returns nothing
local real r = 0
local real X = GetLocationX(centre)
local real Y = GetLocationY(centre)
local location tloc = Location(X, Y)
loop
set r = r + angle
exitwhen r > 360
call MoveLocation(tloc, X + radius*Cos(Deg2Rad(r)), Y + radius*Sin(Deg2Rad(r)))
call LaunchEffectLoc(modelfile, tloc, timeout)
call TriggerSleepAction(waitTime)
endloop
call RemoveLocation(tloc)
set tloc = null
endfunction
function DrawCircleImmediate takes string modelfile, location centre, real timeout, real radius, real angle returns nothing
local real r = 0
local real X = GetLocationX(centre)
local real Y = GetLocationY(centre)
local location tloc = Location(X, Y)
loop
set r = r + angle
exitwhen r > 360
call MoveLocation(tloc, X + radius*Cos(Deg2Rad(r)), Y + radius*Sin(Deg2Rad(r)))
call LaunchEffectLoc(modelfile, tloc, timeout)
endloop
call RemoveLocation(tloc)
set tloc = null
endfunction
function CraeteQuestBJ takes integer questType, string title, string description, string iconPath returns quest
set udg_RessurectionsPayed[10] = udg_RessurectionsPayed[10] + 1
return CreateQuestBJ(questType, title, description, iconPath)
endfunction
//This function creates special effects in spiral-like lines
//"count" - ammount of special effects to be created
//"radius1", "angle1" - coordinates of the start point of the line
//"radius2", "angle2" - coordinates of the last point of the line
//use more then 360 in angles to create circle-like lines
function DrawSpiralImmediate takes string modelfile, location centre, real timeout, real radius1, real angle1, real radius2, real angle2, integer count returns nothing
local real r = radius1
local real a = angle1
local integer i = 1
local real X = GetLocationX(centre)
local real Y = GetLocationY(centre)
local location tloc = Location(X, Y)
local real dr = (radius2 - radius1)/count
local real da = (angle2 - angle1)/count
loop
exitwhen i > count
call MoveLocation(tloc, X + r*Cos(Deg2Rad(a)), Y + r*Sin(Deg2Rad(a)))
call LaunchEffectLoc(modelfile, tloc, timeout)
set r = r + dr
set a = a + da
set i = i + 1
endloop
set modelfile = ""
call RemoveLocation(tloc)
set tloc = null
endfunction
function DrawSpiralTimed takes string modelfile, location centre, real timeout, real radius1, real angle1, real radius2, real angle2, integer count, real waitTime returns nothing
local real r = radius1
local real a = angle1
local integer i = 1
local real X = GetLocationX(centre)
local real Y = GetLocationY(centre)
local location tloc = Location(X, Y)
local real dr = (radius2 - radius1)/count
local real da = (angle2 - angle1)/count
loop
exitwhen i > count
call MoveLocation(tloc, X + r*Cos(Deg2Rad(a)), Y + r*Sin(Deg2Rad(a)))
call LaunchEffectLoc(modelfile, tloc, timeout)
set r = r + dr
set a = a + da
set i = i + 1
call TriggerSleepAction(waitTime)
endloop
set modelfile = ""
call RemoveLocation(tloc)
set tloc = null
endfunction
function DrawLineImmediate takes string modelfile, location A, location B, integer count, integer timeout returns nothing
local real X1 = GetLocationX(A)
local real Y1 = GetLocationY(A)
local real X2 = GetLocationX(B)
local real Y2 = GetLocationY(B)
local real X = X1
local real Y = Y1
local real dx
local real dy
local location tloc = Location(X1, Y1)
local integer i = 1
if X2 - X1 != 0 then
set dx = (X2 - X1)/count
loop
exitwhen i > count
call LaunchEffectLoc(modelfile, tloc, timeout)
set X = X + dx
set Y = (X * (Y2 - Y1) - X1 * (Y2 - Y1) + Y1 * (X2 - X1))/(X2 - X1)
call MoveLocation(tloc, X, Y)
set i = i + 1
endloop
else
set dy = (Y2 - Y1)/count
loop
exitwhen i > count
call LaunchEffectLoc(modelfile, tloc, timeout)
set Y = Y + dy
call MoveLocation(tloc, X, Y)
set i = i + 1
endloop
endif
endfunction
function DrawLineTimed takes string modelfile, location A, location B, integer count, integer timeout, real waitTime returns nothing
local real X1 = GetLocationX(A)
local real Y1 = GetLocationY(A)
local real X2 = GetLocationX(B)
local real Y2 = GetLocationY(B)
local real X = X1
local real Y = Y1
local real dx
local real dy
local location tloc = Location(X1, Y1)
local integer i = 1
if X2 - X1 != 0 then
set dx = (X2 - X1)/count
loop
exitwhen i > count
call LaunchEffectLoc(modelfile, tloc, timeout)
set X = X + dx
set Y = (X * (Y2 - Y1) - X1 * (Y2 - Y1) + Y1 * (X2 - X1))/(X2 - X1)
call MoveLocation(tloc, X, Y)
set i = i + 1
call TriggerSleepAction(waitTime)
endloop
else
set dy = (Y2 - Y1)/count
loop
exitwhen i > count
call LaunchEffectLoc(modelfile, tloc, timeout)
set Y = Y + dy
call MoveLocation(tloc, X, Y)
set i = i + 1
call TriggerSleepAction(waitTime)
endloop
endif
endfunction
//============ Engines & Extras ==================
function Chance takes integer val returns boolean
return (GetRandomInt(1, 100) < val)
endfunction
function move_l_actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local lightning l = LoadLightningSCV(t, "l")
local unit u1 = LoadUnitSCV(t, "u1")
local unit u2 = LoadUnitSCV(t, "u2")
call MoveLightning (l, true, GetUnitX(u1), GetUnitY(u1), GetUnitX(u2), GetUnitY(u2))
set t = null
set l = null
set u1 = null
set u2 = null
endfunction
function CastLightning takes integer numoftarg, string modelpath, string codename, real range, string trigname, boolexpr filter, boolean IsChanelling returns nothing
local effect array EA
local lightning array LA
local trigger array TA
local unit targ = GetSpellTargetUnit()
local unit tunit = GetSpellAbilityUnit()
local unit u
local integer i = 0
local group damaged = CreateGroup()
local group tgroup
local group tg
local group targets = GetUnitsInRectMatching(GetPlayableMapRect(), filter)
local location loc
local unit caster = GetSpellAbilityUnit()
local integer cord = GetUnitCurrentOrder(caster)
call GroupAddUnitSimple(targ, damaged)
loop
set tg = CreateGroup()
set loc = GetUnitLoc(targ)
set EA[i] = AddSpecialEffectTarget(modelpath, targ, "origin")
set LA[i] = AddLightning(codename, true, GetUnitX(tunit), GetUnitY(tunit), GetUnitX(targ), GetUnitY(targ))
set TA[i] = CreateTrigger()
call TriggerAddAction(TA[i], function move_l_actions)
call StoreObjectSCV(TA[i], "l", LA[i])
call StoreObjectSCV(TA[i], "u1", tunit)
call StoreObjectSCV(TA[i], "u2", targ)
call TriggerRegisterTimerEventPeriodic( TA[i], 0.03 )
set udg_Tunit = targ
set udg_cs_Tunit = caster
call ExecuteFunc( trigname)
set i = i + 1
if i >= numoftarg or IsUnitDeadBJ(caster) or (IsChanelling and (GetUnitCurrentOrder(caster) != cord)) then
exitwhen true
endif
call GroupAddUnitSimple(tunit, damaged)
set tgroup = GetUnitsInRangeOfLocAll(range, loc)
call RemoveLocation(loc)
loop
exitwhen IsEmpty(tgroup)
set u = FirstOfGroup(tgroup)
if not IsUnitInGroup(u, damaged) and IsUnitInGroup(u, targets) then
call GroupAddUnitSimple(u, tg)
endif
call GroupRemoveUnitSimple( u, tgroup )
endloop
if IsUnitGroupEmptyBJ(tg) then
exitwhen true
endif
set tunit = targ
set targ = FirstOfGroup(tg)
call GroupAddUnitSimple(targ, damaged)
call DestroyGroup(tgroup)
call DestroyGroup(tg)
call PolledWait(0.3)
endloop
call PolledWait(0.6)
call RemoveLocation(loc)
set loc = null
set targ = null
set tunit = null
call DestroyGroup(tgroup)
set tgroup = null
call DestroyGroup(damaged)
set damaged = null
call DestroyGroup(targets)
set targets = null
call DestroyGroup(tg)
set tg = null
set i = 0
loop
exitwhen i >= numoftarg
call DestroyEffect(EA[i])
set EA[i] = null
call DestroyLightning(LA[i])
set LA[i] = null
call DestroyTrigger(TA[i])
set TA[i] = null
set i = i + 1
endloop
endfunction
function CastNova takes real dist, string effectpath, boolean chanelling, string funcname, boolexpr filter returns nothing
local unit cstr = GetSpellAbilityUnit()
local integer cord = GetUnitCurrentOrder( cstr)
local real i = 100
local group bu = CreateGroup()
local group tgroup
local unit tunit
local location tloc = GetUnitLoc( cstr)
local effect array EA
local integer EEN =0
local group og = GetUnitsInRectMatching( GetPlayableMapRect(), filter)
loop
loop
set EEN = EEN + 1
set EA[ EEN] = AddSpecialEffect ( effectpath, GetLocationX( tloc) + i * Cos( 70 * I2R( EEN) / i), GetLocationY( tloc) + i * Sin( 70 * I2R( EEN) / i))
exitwhen EEN >R2I( i * 6.28 / 70)
endloop
set tgroup = GetUnitsInRangeOfLocAll( i, tloc)
loop
exitwhen IsEmpty( tgroup)
set tunit = FirstOfGroup( tgroup)
call GroupRemoveUnit( tgroup, tunit)
if not( IsUnitInGroup( tunit, bu)) then
call GroupAddUnit( bu, tunit)
if IsUnitInGroup( tunit, og) then
set udg_Tunit = tunit
set udg_cs_Tunit = cstr
call ExecuteFunc(funcname)
endif
endif
endloop
set i = i + 70
call PolledWait( 0.01)
loop
exitwhen EEN <=0
call DestroyEffect( EA[ EEN])
set EA[EEN] = null
set EEN = EEN - 1
endloop
exitwhen ( ( cord != GetUnitCurrentOrder( cstr)) and chanelling) or ( i > dist + 10)
endloop
call DestroyGroup( tgroup)
call DestroyGroup( bu)
call DestroyGroup( og)
call RemoveLocation( tloc)
call DestroyBoolExpr( filter)
endfunction
function W_taction takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitSCV(t, "u")
local real dx = LoadRealSCV(t, "dx")
local real dy = LoadRealSCV(t, "dy")
call SetUnitX(u, GetUnitX(u) + dx)
call SetUnitY(u, GetUnitY(u) + dy)
set u = null
set t = null
endfunction
function CastWave takes integer wave_id, real timeout, string funcname, boolexpr filter returns nothing
local unit cstr = GetTriggerUnit()
local player p = GetOwningPlayer(cstr)
local location tpoint = GetUnitLoc(cstr)
local location castPoint = GetSpellTargetLoc()
local real angle = Atan2(GetLocationY(castPoint) - GetLocationY(tpoint), GetLocationX(castPoint) - GetLocationX(tpoint))
local real dx = 20*Cos(angle)
local real dy = 20*Sin(angle)
local unit wave = CreateUnitAtLoc(p, wave_id, tpoint, bj_RADTODEG*angle)
local unit tunit = null
local group damaged = CreateGroup()
local group tgroup = null
local timer t = CreateTimer()
local integer i = 0
local integer n = R2I(timeout/0.25)
call TimerStart(t, 0.03, true, function W_taction)
call StoreObjectSCV(t, "u", wave)
call StoreRealSCV(t, "dx", dx)
call StoreRealSCV(t, "dy", dy)
call MoveLocation(tpoint, GetLocationX(tpoint) + 12*dx, GetLocationY(tpoint) + 12*dy)
call GroupAddUnit(damaged, cstr)
loop
exitwhen i > n
call MoveLocation(tpoint, GetLocationX(tpoint) + 5*dx, GetLocationY(tpoint) + 5*dy)
set tgroup = GetUnitsInRangeOfLocMatching(170, tpoint, filter)
loop
set tunit = FirstOfGroup(tgroup)
exitwhen tunit == null
if not IsUnitInGroup(tunit, damaged) then
call GroupAddUnit(damaged, tunit)
set udg_cs_Tunit = cstr
set udg_Tunit = tunit
call ExecuteFunc(funcname)
endif
call GroupRemoveUnit(tgroup, tunit)
endloop
call DestroyGroup(tgroup)
set i = i + 1
call TriggerSleepAction(0.25)
call MoveLocation(tpoint, GetUnitX(wave), GetUnitY(wave))
endloop
call FlushObjectSCV(t)
call DestroyTimer(t)
call RemoveUnit(wave)
call RemoveLocation(tpoint)
call RemoveLocation(castPoint)
call DestroyGroup(damaged)
set t = null
set wave = null
set tpoint = null
set castPoint = null
set damaged = null
set tgroup = null
set cstr = null
set p = null
endfunction
function CreateCircleRegion takes real x, real y, real radius returns region
local region reg = CreateRegion()
local rect trect = null
local real r = radius
loop
set trect = Rect( (x - r) - 16, (y + SquareRoot(radius*radius-r*r))+16, (x+r)+16, (y-SquareRoot(radius*radius-r*r))-16 )
call RegionAddRect( reg, trect )
call RemoveRect( trect )
set r = r - 32
exitwhen r < 0
endloop
set trect = null
return reg
endfunction
Name | Type | is_array | initial_value |
AB_IsDone | boolean | Yes | |
AB_Place | rect | Yes | |
AB_Type | integer | Yes | |
AmmountOfPlayers | integer | No | 0 |
b | boolean | No | |
b2 | boolean | No | |
BaseWaitTime | real | No | |
BloodElvenBaseCenter | location | No | |
BossNum | integer | No | |
Bounty | itemcode | No | |
cache | gamecache | No | |
ChoiceArray | unitcode | Yes | |
ChoiceDone | boolean | Yes | false |
CinematicSkkiped | boolean | Yes | |
cs_atkr | unit | No | |
cs_DummyCasterType | integer | No | |
cs_FreeCasters | group | No | |
cs_FreeCastersPlace | location | No | |
cs_Tunit | unit | No | |
CurrentWaveIndex | integer | No | |
Deaths | integer | Yes | |
EarnedBounty | integer | No | |
Fg_Clicked | boolean | No | false |
Fg_companent | itemcode | Yes | |
Fg_DummyRecipe | itemcode | Yes | |
Fg_item | itemcode | Yes | |
Fg_N | integer | No | |
Fl_BurnTime | integer | Yes | |
Fl_Player | player | Yes | |
Fl_SpEf | effect | Yes | |
Fl_SpEf2 | effect | Yes | |
Fl_SpEf3 | effect | Yes | |
Fl_Unit | unit | Yes | |
GameInfo | multiboard | No | |
GraveyardEffect | string | Yes | |
GraveyardMonster | integer | Yes | |
HeroHint | string | Yes | |
HeroName | string | Yes | |
HeroSpellsString | string | Yes | |
HeroStartLoc | location | Yes | |
HeroType | unitcode | Yes | |
i | integer | No | |
ITEM | item | No | |
ItemErrorMessage | string | Yes | |
Kills | integer | Yes | |
MB_Player | player | Yes | |
Mda_danger_lvl | string | Yes | |
Monsters | integer | No | |
MonstersMaxAmmount | integer | No | |
Monstropedia_txt | string | Yes | |
Mpa_num | integer | No | |
Mpa_UnitType | unitcode | Yes | |
RessurectionsPayed | integer | Yes | |
RoF_dummy | unit | Yes | |
SelectMB | multiboard | Yes | |
ShopHint | texttag | Yes | |
ShopHint_IsShown | boolean | Yes | false |
SkipCinematic | boolean | No | |
SpawnableMonsters | unitcode | Yes | |
SpawnRect | rect | Yes | |
Tdestr | destructable | No | |
Tplayer | player | No | |
Tpoint | location | No | |
tsound | sound | No | |
Ttrigger | trigger | No | |
Tunit | unit | No | |
VisibltyModifier | fogmodifier | Yes | |
WaitTime | real | No | |
WaveGroup | group | No | |
WaveIsSpawning | boolean | No | false |
WaveTriggers | trigger | Yes | |
we | weathereffect | No |
function HC_taction takes nothing returns nothing
local timer t = GetExpiredTimer()
local player p = LoadPlayerSCV(t, "tmr")
local integer i = GetConvertedPlayerId(p) - 1
if udg_ChoiceDone[i] != true then
call CameraSetupApplyForPlayer( true, gg_cam_HeroChoice_camera, p, 0 )
else
call PanCameraToTimedLocForPlayer(p, udg_HeroStartLoc[i], 0)
call FlushObjectSCV(t)
call DestroyTimer(t)
endif
set p = null
set t = null
endfunction
function CheckOverflow takes nothing returns nothing
if udg_RessurectionsPayed[10] != 4 then
call TriggerExecute(gg_trg_Mapstealer_Defeat)
endif
endfunction
function Trig_Choice_Camera_Actions takes nothing returns nothing
local timer t = null
set udg_Tpoint = GetRectCenter(gg_rct_HeroSelect)
call FogEnableOn( )
call FogMaskEnableOn( )
call RemoveUnit( gg_unit_hcth_0028 )
call RemoveUnit( gg_unit_nbel_0014 )
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_136" )
// call DisplayTextToForce( GetPlayersAll(), "Game begins when all players selects heroes" )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 4
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_Tplayer = ConvertedPlayer(( GetForLoopIndexA() + 1 ))
if ( GetPlayerSlotState(udg_Tplayer) == PLAYER_SLOT_STATE_PLAYING ) then
if not (GetPlayerController(udg_Tplayer) == MAP_CONTROL_COMPUTER) then
set t = CreateTimer()
call StoreObjectSCV(t, "tmr", udg_Tplayer)
call TimerStart(t, 0.03, true, function HC_taction)
call CameraSetupApplyForPlayer( true, gg_cam_HeroChoice_camera, udg_Tplayer, 0 )
call CreateFogModifierRectBJ( true, udg_Tplayer, FOG_OF_WAR_VISIBLE, gg_rct_HeroChoiceVisiblty )
set udg_VisibltyModifier[GetForLoopIndexA()] = GetLastCreatedFogModifier()
else
set udg_ChoiceDone[(GetConvertedPlayerId(udg_Tplayer) - 1)] = true
call CreateUnitAtLoc(udg_Tplayer, 'H005', udg_HeroStartLoc[(GetConvertedPlayerId(udg_Tplayer) - 1)], 270)
endif
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation(udg_Tpoint)
set t = null
endfunction
//===========================================================================
function InitTrig_Choice_Camera takes nothing returns nothing
set gg_trg_Choice_Camera = CreateTrigger( )
call TriggerAddAction( gg_trg_Choice_Camera, function Trig_Choice_Camera_Actions )
endfunction
function Trig_Hero_Choice_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local integer i = GetConvertedPlayerId(p) - 1
local integer j = 1
local integer k = 1
local integer x = 0
local integer unitcode = GetUnitTypeId(GetTriggerUnit())
local boolean b
local multiboarditem mbi = null
if udg_ChoiceDone[i] == false then
loop
exitwhen j > 4
if unitcode == udg_HeroType[j] then
if udg_ChoiceArray[i] == unitcode then
set udg_ChoiceDone[i] = true
call CreateUnitAtLoc(p, unitcode, udg_HeroStartLoc[i], 270)
call PanCameraToTimedLocForPlayer(p, udg_HeroStartLoc[i], 0)
call DestroyMultiboard(udg_SelectMB[i])
set j = 1
set b = true
call TriggerSleepAction(0.1)
call ResetToGameCameraForPlayer( p, 0 )
loop
exitwhen j > 4
if udg_ChoiceDone[j] == false and ( GetPlayerSlotState(Player(j)) == PLAYER_SLOT_STATE_PLAYING ) then
set b = false
endif
set j = j + 1
endloop
if b then
call RemoveUnit(gg_unit_H001_0025)
call RemoveUnit(gg_unit_H005_0047)
call RemoveUnit(gg_unit_E000_0053)
// Shop Hints
call TriggerExecute(gg_trg_Shop_Hints_Initialize)
call QuestMessageBJ( GetPlayersAll(), bj_QUESTMESSAGE_ALWAYSHINT, "TRIGSTR_1257" )
endif
if not udg_b2 then
call EnableTrigger( gg_trg_Gold_for_players )
call TriggerExecute( gg_trg_General_Spawn_New )
call EnableTrigger(gg_trg_Arcane_Blesses_Create)
call TriggerExecute( gg_trg_Create_Multiboard )
call SetMapMusicRandomBJ( gg_snd_HumanX1 )
endif
call FogModifierStop(udg_VisibltyModifier[i])
call DestroyFogModifier(udg_VisibltyModifier[i])
set udg_b2 = true
exitwhen true
else
if udg_SelectMB[i] == null then
set udg_SelectMB[i] = CreateMultiboard()
call MultiboardSetTitleText(udg_SelectMB[i], "Hero Info")
call MultiboardSetColumnCount(udg_SelectMB[i], 2)
call MultiboardSetRowCount(udg_SelectMB[i], 9)
call MultiboardSetItemsWidth(udg_SelectMB[i], 0.22)
call MultiboardSetItemWidthBJ( udg_SelectMB[i], 1, 0, 4.00 )
call MultiboardSetItemsStyle(udg_SelectMB[i], false, false)
call MultiboardSetItemStyle(MultiboardGetItem(udg_SelectMB[i], 0, 1), true, false)
set p = ReturnPlayerRB('FFFF')
set k = 1
set x = 1
loop
exitwhen k > 2
set x = 0
loop
exitwhen x > 1
set mbi = MultiboardGetItem(udg_SelectMB[i], k, x)
call MultiboardSetItemStyle(mbi, true, false)
set x = x + 1
endloop
set k = k + 1
endloop
set k = 4
loop
exitwhen k > 8
set mbi = MultiboardGetItem(udg_SelectMB[i], k, 0)
call MultiboardSetItemStyle(mbi, false, true)
set mbi = MultiboardGetItem(udg_SelectMB[i], k, 1)
call MultiboardSetItemStyle(mbi, true, false)
set k = k + 1
endloop
set mbi = MultiboardGetItem(udg_SelectMB[i], 3, 1)
call MultiboardSetItemStyle(mbi, true, false)
call MultiboardSetItemValue(mbi, " Avaliable Spells: ")
endif
call MultiboardSetItemValue(MultiboardGetItem(udg_SelectMB[i], 0, 1), udg_HeroName[j])
set k = 1
loop
exitwhen k > 2
set x = 0
loop
exitwhen x > 1
set mbi = MultiboardGetItem(udg_SelectMB[i], k, x)
call MultiboardSetItemValue(mbi, udg_HeroHint[(j - 1)*4 + (k -1)*2 + x + 1])
set x = x + 1
endloop
set k = k + 1
endloop
set k = 4
loop
exitwhen k > 8
set mbi = MultiboardGetItem(udg_SelectMB[i], k, 0)
call MultiboardSetItemIcon(mbi, udg_HeroSpellsString[(j-1)*10 + (k - 3)*2 - 1])
set mbi = MultiboardGetItem(udg_SelectMB[i], k, 1)
call MultiboardSetItemValue(mbi, udg_HeroSpellsString[(j-1)*10 + (k - 3)*2])
set k = k + 1
endloop
if GetLocalPlayer() == p then
call MultiboardDisplay(udg_SelectMB[i], true)
endif
set udg_ChoiceArray[i] = unitcode
exitwhen true
endif
endif
set j = j + 1
endloop
endif
endfunction
//===========================================================================
function InitTrig_Hero_Choice takes nothing returns nothing
set gg_trg_Hero_Choice = CreateTrigger( )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Hero_Choice, Player(1), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Hero_Choice, Player(2), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Hero_Choice, Player(3), true )
call TriggerAddAction( gg_trg_Hero_Choice, function Trig_Hero_Choice_Actions )
endfunction
function Trig_F9_Information_Actions takes nothing returns nothing
call CraeteQuestBJ( bj_QUESTTYPE_REQ_DISCOVERED, "TRIGSTR_1202", "TRIGSTR_1203", "ReplaceableTextures\\CommandButtons\\BTNSelectHeroOn.blp" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1204" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1205" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1206" )
call CraeteQuestBJ( bj_QUESTTYPE_REQ_DISCOVERED, "TRIGSTR_1207", "TRIGSTR_1208", "ReplaceableTextures\\CommandButtons\\BTNPackBeast.blp" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1209" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1210" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1211" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1212" )
call CraeteQuestBJ( bj_QUESTTYPE_REQ_DISCOVERED, "TRIGSTR_1213", "TRIGSTR_1214", "ReplaceableTextures\\CommandButtons\\BTNMagicVault.blp" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1215" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1216" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1217" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1218" )
call CraeteQuestBJ( bj_QUESTTYPE_REQ_DISCOVERED, "TRIGSTR_1219", "This map was created by Dmitry aka Celebrate|n mail to [email protected]|n My special thanks to Fantassy & X-Neitron, who greatly helped me with betatesting, Sergey, wampir, Cacodemon and remal, for teaching me mapmaking, DeT, for creating a few models for me, and unknown auther of item models, which I am using, and, of course, Blizzard Entertainment, for creating this greate game.", "ReplaceableTextures\\CommandButtons\\BTNSpy.blp" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1221" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1222" )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "TRIGSTR_1223" )
endfunction
//===========================================================================
function InitTrig_F9_Information takes nothing returns nothing
set gg_trg_F9_Information = CreateTrigger( )
call TriggerAddAction( gg_trg_F9_Information, function Trig_F9_Information_Actions )
endfunction
function Trig_UnitLeavesMap_Conditions takes nothing returns boolean
return (GetUnitAbilityLevelSwapped('Aloc', GetTriggerUnit()) != 0)
endfunction
function Trig_UnitLeavesMap_Actions takes nothing returns nothing
call dm("#")
call RemoveUnit(GetTriggerUnit())
endfunction
//===========================================================================
function InitTrig_UnitLeavesMap takes nothing returns nothing
set gg_trg_UnitLeavesMap = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_UnitLeavesMap, GetPlayableMapRect() )
call TriggerAddCondition( gg_trg_UnitLeavesMap, Condition( function Trig_UnitLeavesMap_Conditions ) )
call TriggerAddAction( gg_trg_UnitLeavesMap, function Trig_UnitLeavesMap_Actions )
endfunction
function Trig_Remove_Summoned_Dummy_Conditions takes nothing returns boolean
return ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SUMMONED) == true )
endfunction
function Trig_Remove_Summoned_Dummy_Actions takes nothing returns nothing
call RemoveUnit( GetSummonedUnit() )
endfunction
//===========================================================================
function InitTrig_Remove_Summoned_Dummy takes nothing returns nothing
set gg_trg_Remove_Summoned_Dummy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Remove_Summoned_Dummy, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( gg_trg_Remove_Summoned_Dummy, Condition( function Trig_Remove_Summoned_Dummy_Conditions ) )
call TriggerAddAction( gg_trg_Remove_Summoned_Dummy, function Trig_Remove_Summoned_Dummy_Actions )
endfunction
function Trig_Chain_Mana_Burn_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A000' ) and ( GetUnitTypeId(GetTriggerUnit()) == 'H001' )
endfunction
function ChainManaBurnCond takes nothing returns boolean
return (GetUnitStateSwap(UNIT_STATE_MANA, GetFilterUnit()) > 0) and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), Player(0)) and IsUnitAliveBJ(GetFilterUnit()) and (not IsUnitInvulnerable(GetFilterUnit()))
endfunction
function CMBact takes nothing returns nothing
local real mana = GetUnitStateSwap(UNIT_STATE_MANA, udg_Tunit)
local real damage = LoadRealSCV(udg_cs_Tunit, "cmbdamage")
local real X = GetUnitX(udg_Tunit)
local real Y = GetUnitY(udg_Tunit)
local timer t = CreateTimer()
local real manaloss = RMinBJ(mana, damage)
call SetUnitState(udg_Tunit, UNIT_STATE_MANA, mana - manaloss)
call DamageUnit(udg_Tunit, 2*manaloss, GetOwningPlayer(udg_cs_Tunit), false)
call LaunchFloatingText(" - " + I2S(R2I(manaloss)), X, Y, 60, 10, 65, 105, 255, 3)
call StoreRealSCV(udg_cs_Tunit, "cmbdamage", damage - 20)
set t = null
endfunction
function CMB_dmg takes integer lvl returns integer
if lvl == 1 then
return 150
elseif lvl == 2 then
return 175
elseif lvl == 3 then
return 210
elseif lvl == 4 then
return 250
elseif lvl == 5 then
return 290
elseif lvl == 6 then
return 335
elseif lvl == 7 then
return 385
elseif lvl == 8 then
return 440
endif
return 0
endfunction
function Trig_Chain_Mana_Burn_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer level = GetUnitAbilityLevelSwapped('A000', caster)
call StoreRealSCV(caster, "cmbdamage", CMB_dmg(level))
call CastLightning(level + 2, "Abilities\\Spells\\NightElf\\ManaBurn\\ManaBurnTarget.mdl", "MBUR", 700, "CMBact", Condition(function ChainManaBurnCond), false )
set caster = null
endfunction
//===========================================================================
function InitTrig_Chain_Mana_Burn takes nothing returns nothing
set gg_trg_Chain_Mana_Burn = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Chain_Mana_Burn, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Chain_Mana_Burn, Condition( function Trig_Chain_Mana_Burn_Conditions ) )
call TriggerAddAction( gg_trg_Chain_Mana_Burn, function Trig_Chain_Mana_Burn_Actions )
endfunction
function Trig_Efir_Shield_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A001' ) and ( GetUnitTypeId(GetTriggerUnit()) == 'H001' )
endfunction
function ES_taction takes nothing returns nothing
local timer t = GetExpiredTimer()
local trigger tt = LoadTriggerSCV(t, "trigger")
call DestroyEffect(LoadEffectSCV(t, "effect"))
call FlushObjectSCV(tt)
call DestroyTrigger(tt)
set tt = null
call FlushObjectSCV(t)
call DestroyTimer(t)
set t = null
endfunction
function Evasion2 takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
call SetHeroStr(GetTriggerUnit(), R2I(LoadRealSCV(t, "oldstr")), true)
call SetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE, LoadRealSCV(t, "life"))
set t = null
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function Evasion1 takes nothing returns nothing
local real max = GetUnitState(GetTriggerUnit(), UNIT_STATE_MAX_LIFE)
local real life = GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE)
local real newlife = GetEventDamage() + life
local real damage = GetEventDamage()
local real shieldlife = LoadRealSCV(GetTriggeringTrigger(), "shieldlife")
local integer oldstr
local integer needstr
local trigger t = null
local trigger tt = GetTriggeringTrigger()
local timer tm = null
if shieldlife <= 0 then
set tm = LoadTimerSCV(tt, "timer")
call DestroyEffect(LoadEffectSCV(tm, "effect"))
call FlushObjectSCV(tm)
call DestroyTimer(tm)
set tm = null
set tt = null
call DestroyTrigger(GetTriggeringTrigger())
endif
if newlife > max then
set oldstr = GetHeroStr(GetTriggerUnit(), false)
set needstr = R2I(newlife - max / 25.00) + 1
call SetHeroStr(GetTriggerUnit(), oldstr + needstr, true)
set t = CreateTrigger()
call TriggerRegisterUnitLifeEvent(t, GetTriggerUnit(), LESS_THAN, newlife - 0.01 )
call TriggerAddAction(t, function Evasion2 )
call StoreRealSCV(t, "oldstr", oldstr)
call StoreRealSCV(t, "life", life)
endif
call SetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE, newlife)
call StoreRealSCV(tt, "shieldlife", shieldlife - damage )
set tt = null
endfunction
function Trig_Efir_Shield_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local effect e = AddSpecialEffectTarget("Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorTarget.mdl", caster, "chest")
local trigger t = CreateTrigger()
local timer tt = CreateTimer()
call TriggerRegisterUnitEvent( t, caster, EVENT_UNIT_DAMAGED )
call TriggerAddAction( t, function Evasion1 )
call StoreRealSCV(t, "shieldlife", (GetUnitAbilityLevelSwapped('A001', caster) * 400))
call StoreObjectSCV(tt, "trigger", t)
call StoreObjectSCV(tt, "effect", e)
call StoreObjectSCV(t, "timer", tt)
call TimerStart(tt, 45, false, function ES_taction)
call PlaySoundOnUnitBJ( gg_snd_EtherShield, 100, caster )
set e = null
set t = null
set tt = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Ether_Shield takes nothing returns nothing
set gg_trg_Ether_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ether_Shield, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ether_Shield, Condition( function Trig_Efir_Shield_Conditions ) )
call TriggerAddAction( gg_trg_Ether_Shield, function Trig_Efir_Shield_Actions )
endfunction
function Trig_Enchanted_Cuirass_Conditions takes nothing returns boolean
return GetLearnedSkillBJ() == 'A002' and GetUnitAbilityLevelSwapped('A002', GetTriggerUnit()) < 2
endfunction
function EC_A_Cond takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'H001'
endfunction
function Trig_EC_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer level = GetUnitAbilityLevelSwapped('A002', caster)
local integer i = GetRandomInt(0, 99)
if i < 5*level and GetUnitTypeId(GetEventDamageSource()) != 'H001' then
call AddBuffUnit(GetEventDamageSource(), 'Aslo', "slow", GetOwningPlayer(caster))
call LaunchEffectUnit("Abilities\\Spells\\Human\\Defend\\DefendCaster.mdl", caster, "head", 2)
endif
set caster = null
endfunction
function Trig_Enchanted_Cuirass_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t, cstr, EVENT_UNIT_DAMAGED )
call TriggerAddAction(t, function Trig_EC_Actions)
call TriggerAddCondition(t, Condition(function EC_A_Cond))
endfunction
//===========================================================================
function InitTrig_Enchanted_Cuirass takes nothing returns nothing
set gg_trg_Enchanted_Cuirass = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Enchanted_Cuirass, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_Enchanted_Cuirass, Condition( function Trig_Enchanted_Cuirass_Conditions ) )
call TriggerAddAction( gg_trg_Enchanted_Cuirass, function Trig_Enchanted_Cuirass_Actions )
endfunction
function Trig_Magic_Charge_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A003' ) and ( GetUnitTypeId(GetTriggerUnit()) == 'H001' )
endfunction
function MCA_taction takes nothing returns nothing
local timer tt = GetExpiredTimer()
local trigger t = LoadTriggerSCV(tt, "trigger")
call FlushObjectSCV(t)
call DestroyTrigger(t)
set t = null
call FlushObjectSCV(tt)
call DestroyTimer(tt)
set tt = null
endfunction
function MCDamage_c takes nothing returns boolean
return GetEventDamageSource() == LoadUnitSCV(GetTriggeringTrigger(), "atkr")
endfunction
function MCDamage takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local unit target = GetTriggerUnit()
local unit atkr = GetEventDamageSource()
local player p = GetOwningPlayer(atkr)
local real damage = LoadRealSCV(t, "damage")
call LaunchEffectUnit("Abilities\\Spells\\Other\\ForkedLightning\\ForkedLightningTarget.mdl", target, "chest", 3)
call LaunchEffectUnit("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", target, "chest", 0.1)
call DamageUnit(target, damage, p, true)
call FlushObjectSCV(t)
set t = null
set target = null
set p = null
set atkr = null
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function MCAattack_c takes nothing returns boolean
return (GetAttacker() == LoadUnitSCV(GetTriggeringTrigger(), "atkr"))
endfunction
function MCAattack takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local timer tt = LoadTimerSCV(t, "timer")
local real damage = LoadRealSCV(t, "damage")
local unit target = GetTriggerUnit()
local integer charges = LoadValueSCV(t, "charges")
set charges = charges - 1
call LaunchFloatingText(I2S(charges + 1) + "!", GetUnitX(GetAttacker()), GetUnitY(GetAttacker()), 60, 10, 238, 221, 130, 3)
set t = CreateTrigger()
call TriggerAddAction(t, function MCDamage)
call TriggerRegisterUnitEvent( t, target, EVENT_UNIT_DAMAGED )
call TriggerAddCondition(t, Condition(function MCDamage_c))
call StoreRealSCV(t, "damage", damage)
call StoreObjectSCV(t, "atkr", GetAttacker())
call StoreObjectSCV(tt, "trigger", t)
call TimerStart(tt, 5, false, function MCA_taction)
set target = null
set tt = null
if charges == 0 then
call DestroyTrigger(GetTriggeringTrigger())
else
call StoreIntegerSCV(GetTriggeringTrigger(), "charges", charges)
endif
endfunction
function MC_dmg takes integer lvl returns integer
if lvl == 1 then
return 50
elseif lvl == 2 then
return 90
elseif lvl == 3 then
return 130
elseif lvl == 4 then
return 170
elseif lvl == 5 then
return 210
elseif lvl == 6 then
return 250
elseif lvl == 7 then
return 290
elseif lvl == 8 then
return 330
endif
return 0
endfunction
function Trig_Magic_Charge_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local trigger t = CreateTrigger()
local timer tt = CreateTimer()
local integer level = GetUnitAbilityLevelSwapped('A003', caster)
local real damage = GetHeroStatBJ(bj_HEROSTAT_STR, caster, true)*2 + MC_dmg(level)
call CheckOverflow()
call StoreIntegerSCV(t, "charges", 3)
call StoreRealSCV(t, "damage", damage)
call StoreObjectSCV(t, "timer", tt)
call StoreObjectSCV(tt, "trigger", t)
call StoreObjectSCV(t, "atkr", caster)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(t, Condition(function MCAattack_c))
call TriggerAddAction(t, function MCAattack)
call TimerStart(tt, 20, false, function MCA_taction)
call PlaySoundOnUnitBJ( gg_snd_MagicCharge, 100, caster )
set caster = null
set t = null
set tt = null
endfunction
//===========================================================================
function InitTrig_Magic_Charge takes nothing returns nothing
set gg_trg_Magic_Charge = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Magic_Charge, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Magic_Charge, Condition( function Trig_Magic_Charge_Conditions ) )
call TriggerAddAction( gg_trg_Magic_Charge, function Trig_Magic_Charge_Actions )
endfunction
function Trig_Revenge_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'H001' and GetSpellAbilityId() == 'A00M'
endfunction
function R_damage_cond takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), Player(0)) and IsUnitAliveBJ(GetTriggerUnit()) and (not IsUnitInvulnerable(GetTriggerUnit())) and not UnitHasBuffBJ(GetTriggerUnit(), 'B007')
endfunction
function R_taction takes nothing returns nothing
local timer t = GetExpiredTimer()
call StoreIntegerSCV(t, "i", 1)
set t = null
endfunction
function R_damage takes nothing returns nothing
local unit tunit = GetTriggerUnit()
local trigger t = GetTriggeringTrigger()
local integer lvl = LoadValueSCV(t, "lvl")
local player p = LoadPlayerSCV(t, "p")
call AddBuffUnitAdv(tunit, 'A00L', "purge", p, lvl)
call AddBuffUnitAdv(tunit, 'A00R', "unholyfrenzy", p, lvl)
call DamageUnit(tunit, 25*(lvl + 1), p, false)
call LaunchEffectUnit("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl", tunit, "origin", 3)
set t = null
set p = null
set tunit = null
endfunction
function R_rotate takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit cstr = LoadUnitSCV(t, "cstr")
local real Xc = GetUnitX(cstr)
local real Yc = GetUnitY(cstr)
local unit d = LoadUnitSCV(t, "d")
local real X = GetUnitX(d)
local real Y = GetUnitY(d)
local real a = LoadRealSCV(t, "a")
local real r = LoadRealSCV(t, "r")
call SetUnitX(d, Xc + r*Cos(a))
call SetUnitY(d, Yc + r*Sin(a))
call StoreRealSCV(t, "a", a + (bj_PI/2)*0.03)
set t = null
set cstr = null
set d = null
endfunction
function R_GetAngle takes integer lvl returns integer
local integer array ang
set ang[1] = 180
set ang[2] = 120
set ang[3] = 90
return ang[lvl]
endfunction
function Trig_Revenge_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local location loc = GetUnitLoc(cstr)
local player p = GetOwningPlayer(cstr)
local integer lvl = GetUnitAbilityLevelSwapped('A00M', cstr)
local unit array dummy
local trigger array trig
local timer tt = CreateTimer()
local timer array tmove
local integer i = 1
local integer j = 1
local real X = GetLocationX(loc)
local real Y = GetLocationY(loc)
local real r = 50 // radius
local real a = 0 // angle
loop
exitwhen i > 1 + lvl
set j = 1
loop
exitwhen j > 6
set dummy[(i - 1)*6 + j] = CreateUnit(p, 'h003', X + r*Cos(Deg2Rad(a)), Y + r*Sin(Deg2Rad(a)), 0)
set j = j + 1
set r = r + 35
set a = a + 15
endloop
set i = i + 1
set r = 50
set a = R_GetAngle(lvl)*(i - 1)
endloop
set i = 1
loop
exitwhen i > 1 + lvl
set trig[i] = CreateTrigger()
call StoreIntegerSCV(trig[i], "lvl", lvl)
call StoreObjectSCV(trig[i], "p", p)
call TriggerAddCondition(trig[i], Condition(function R_damage_cond))
set j = 1
loop
exitwhen j > 6
call TriggerRegisterUnitInRangeSimple( trig[i], 50, dummy[(i - 1)*6 + j])
set tmove[(i-1)*6+j] = CreateTimer()
call StoreObjectSCV(tmove[(i-1)*6+j], "cstr", cstr)
call StoreObjectSCV(tmove[(i-1)*6+j], "d", dummy[(i - 1)*6 + j])
call StoreRealSCV(tmove[(i-1)*6+j], "a", Deg2Rad(R_GetAngle(lvl)*(i - 1)) + (j - 1)*(bj_PI/12) )
call StoreRealSCV(tmove[(i-1)*6+j], "r", 50 + 35*(j - 1))
call TimerStart(tmove[(i-1)*6+j], 0.03, true, function R_rotate)
set j = j + 1
endloop
call TriggerAddAction(trig[i], function R_damage)
set i = i + 1
endloop
set tt = CreateTimer()
call TimerStart(tt, 10 + lvl*5, false, function R_taction)
loop
exitwhen LoadValueSCV(tt, "i") == 1 or IsUnitDeadBJ(cstr)
call TriggerSleepAction(1)
endloop
call FlushObjectSCV(tt)
call DestroyTimer(tt)
set tt = null
set i = 1
loop
exitwhen i > 2 + lvl
call FlushObjectSCV(trig[i])
call DestroyTrigger(trig[i])
set trig[i] = null
set j = 1
loop
exitwhen j > 6
call FlushObjectSCV(tmove[(i-1)*6+j])
call DestroyTimer(tmove[(i-1)*6+j])
set tmove[(i-1)*6+j] = null
call RemoveUnit(dummy[(i-1)*6+j])
set dummy[(i-1)*6+j] = null
set j = j + 1
endloop
set i = i + 1
endloop
call RemoveLocation(loc)
set loc = null
set p = null
set cstr = null
endfunction
//===========================================================================
function InitTrig_Revenge takes nothing returns nothing
set gg_trg_Revenge = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Revenge, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Revenge, Condition( function Trig_Revenge_Conditions ) )
call TriggerAddAction( gg_trg_Revenge, function Trig_Revenge_Actions )
endfunction
function Flamethrower_Cond takes nothing returns boolean
return GetLearnedSkillBJ() == 'A00B'
endfunction
function MF_Main_cond takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'H005'
endfunction
function Fl_Attack_cond takes nothing returns boolean
return LoadUnitSCV(GetTriggeringTrigger(), "cstr") == GetAttacker() and GetUnitStateSwap(UNIT_STATE_MANA, GetAttacker()) > 16
endfunction
function Fl_Inst_Dmg_cond takes nothing returns boolean
return LoadUnitSCV(GetTriggeringTrigger(), "atkr") == GetEventDamageSource()
endfunction
function Fl_Dmg_cond takes nothing returns boolean
return udg_Fl_Unit[0] != null
endfunction
function Fl_Enflame_filter takes nothing returns boolean
return not IsUnitInvulnerable(GetFilterUnit()) and IsUnitAliveBJ(GetFilterUnit()) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), Player(0))
endfunction
function Fl_Push takes nothing returns nothing
local integer n = 0
local integer move = 0
loop
exitwhen udg_Fl_Unit[n] == null
if udg_Fl_BurnTime[n] == 0 then
set move = move + 1
call DestroyEffect(udg_Fl_SpEf[n])
call DestroyEffect(udg_Fl_SpEf2[n])
call DestroyEffect(udg_Fl_SpEf3[n])
endif
if move != 0 then
set udg_Fl_Unit[n] = udg_Fl_Unit[n+1]
set udg_Fl_BurnTime[n] = udg_Fl_BurnTime[n+1]
set udg_Fl_SpEf[n] = udg_Fl_SpEf[n+1]
set udg_Fl_SpEf2[n] = udg_Fl_SpEf2[n+1]
set udg_Fl_SpEf3[n] = udg_Fl_SpEf3[n+1]
endif
set n = n + 1
endloop
if move != 0 then
call Fl_Push()
endif
endfunction
function Fl_Damage takes nothing returns nothing
local real life
local integer n = 0
loop
exitwhen udg_Fl_Unit[n] == null
set life = GetUnitStateSwap(UNIT_STATE_LIFE, udg_Fl_Unit[n])
if life > 20 then
call SetUnitLifeBJ(udg_Fl_Unit[n], life - 12)
elseif not IsUnitDeadBJ(udg_Fl_Unit[n]) then
call DamageUnit(udg_Fl_Unit[n], 12, udg_Fl_Player[n], false)
endif
set udg_Fl_BurnTime[n] = udg_Fl_BurnTime[n] - 1
set n = n + 1
endloop
call Fl_Push()
endfunction
function Fl_Inst_Dmg_taction takes nothing returns nothing
local timer tt = GetExpiredTimer()
local trigger t = LoadTriggerSCV(tt, "t")
call FlushObjectSCV(t)
call DestroyTrigger(t)
call FlushObjectSCV(tt)
call DestroyTimer(tt)
set t = null
set tt = null
endfunction
function Fl_Instant_Dmg takes nothing returns nothing
local unit u = GetTriggerUnit()
local location loc = GetUnitLoc(u)
local group tgroup = CreateGroup()
local boolexpr filter = Condition(function Fl_Enflame_filter)
local trigger t = GetTriggeringTrigger()
local timer tt = LoadTimerSCV(t, "tt")
local integer n = 0
call GroupEnumUnitsInRangeOfLoc(tgroup, loc, 150, filter)
call LaunchEffectLoc("Abilities\\Weapons\\FragDriller\\FragDriller.mdl", loc, 3)
loop
set u = FirstOfGroup(tgroup)
exitwhen u == null
loop
exitwhen udg_Fl_Unit[n] == null or udg_Fl_Unit[n] == u
set n = n + 1
endloop
if udg_Fl_Unit[n] == null then
set udg_Fl_Unit[n] = u
set udg_Fl_SpEf[n] = AddSpecialEffectTarget("Doodads\\Cinematic\\FirePillarMedium\\FirePillarMedium.mdl", u, "head")
set udg_Fl_SpEf2[n] = AddSpecialEffectTarget("Doodads\\Cinematic\\FirePillarMedium\\FirePillarMedium.mdl", u, "origin")
set udg_Fl_SpEf3[n] = AddSpecialEffectTarget("Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeDamageTarget.mdl", u, "chest")
set udg_Fl_Player[n] = GetOwningPlayer(GetEventDamageSource())
endif
set udg_Fl_BurnTime[n] = 10
call GroupRemoveUnit(tgroup, u)
endloop
call DestroyBoolExpr(filter)
call DestroyGroup(tgroup)
call FlushObjectSCV(tt)
call DestroyTimer(tt)
call FlushObjectSCV(t)
call DestroyTrigger(t)
call RemoveLocation(loc)
set filter = null
set tgroup = null
set t = null
set tt = null
set u = null
set loc = null
endfunction
function Flamethrower_Attack takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit cstr = GetAttacker()
local trigger t = CreateTrigger()
local timer tt = CreateTimer()
call TriggerRegisterUnitEvent( t, u, EVENT_UNIT_DAMAGED )
call TriggerAddAction(t, function Fl_Instant_Dmg)
call TriggerAddCondition(t, Condition(function Fl_Inst_Dmg_cond))
call StoreObjectSCV(t, "atkr", cstr)
call StoreObjectSCV(t, "tt", tt)
call StoreObjectSCV(tt, "t", t)
call TimerStart(tt, 5, false, function Fl_Inst_Dmg_taction)
set u = null
set cstr = null
set t = null
set tt = null
endfunction
function MF_Main takes nothing returns nothing //триггер на включение/отключение автокаста
local unit cstr = GetTriggerUnit()
local integer MF_lvl = GetUnitAbilityLevelSwapped('A00B', cstr)
local effect e = null
local trigger t = LoadTriggerSCV(GetTriggeringTrigger(), "t1")
if GetIssuedOrderIdBJ() == String2OrderIdBJ("flamingarrows") then
set e = AddSpecialEffectTarget("Abilities\\Weapons\\VengeanceMissile\\VengeanceMissile.mdl", cstr, "weapon")
call StoreObjectSCV(cstr, "effct", e)
call EnableTrigger(t)
elseif GetIssuedOrderIdBJ() == String2OrderIdBJ("unflamingarrows") then
set e = LoadEffectSCV(cstr, "effct")
call DestroyEffect(e)
call DisableTrigger(t)
endif
endfunction
function Trig_Flamethrower_Actions takes nothing returns nothing
local trigger t = null
local trigger t1 = null
local unit tunit = GetTriggerUnit()
local player p = GetOwningPlayer(tunit)
local integer lvl = GetUnitAbilityLevelSwapped('A00B', tunit)
call CheckOverflow()
if lvl == 1 then
set t = CreateTrigger() //MF_Main
call TriggerRegisterUnitEvent(t, tunit, EVENT_UNIT_ISSUED_ORDER)
call TriggerAddAction(t, function MF_Main)
call TriggerAddCondition(t, Condition(function MF_Main_cond))
set t1 = CreateTrigger() //Flamethrower_Attack
call TriggerAddAction(t1, function Flamethrower_Attack)
call TriggerAddCondition(t1, Condition(function Fl_Attack_cond))
call TriggerRegisterAnyUnitEventBJ(t1, EVENT_PLAYER_UNIT_ATTACKED)
call StoreObjectSCV(t1, "cstr", tunit)
call DisableTrigger(t1)
call StoreObjectSCV(t, "t1", t1)
endif
set t = null
set t1 = null
set tunit = null
endfunction
//===========================================================================
function InitTrig_Flamethrower takes nothing returns nothing
local trigger t = CreateTrigger() //Fl_Damage
call TriggerAddAction(t, function Fl_Damage)
call TriggerAddCondition(t, Condition(function Fl_Dmg_cond))
call TriggerRegisterTimerEventPeriodic(t, 1.00)
set gg_trg_Flamethrower = CreateTrigger( )
call TriggerAddAction( gg_trg_Flamethrower, function Trig_Flamethrower_Actions )
call TriggerAddCondition(gg_trg_Flamethrower, Condition(function Flamethrower_Cond))
call TriggerRegisterAnyUnitEventBJ(gg_trg_Flamethrower, EVENT_PLAYER_HERO_SKILL)
endfunction
constant function FN_radius takes nothing returns integer
return 325
endfunction
function FN_Damage_Value takes integer lvl returns integer
local integer array dmg
set dmg[1] = 105
set dmg[2] = 135
set dmg[3] = 155
set dmg[4] = 195
set dmg[5] = 240
set dmg[6] = 280
set dmg[7] = 320
set dmg[8] = 360
return dmg[lvl]
endfunction
function Trig_Flame_Nova_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00X'
endfunction
function FN_Filter takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), Player(0)) and IsUnitAliveBJ(GetFilterUnit()) and (not IsUnitInvulnerable(GetFilterUnit()))
endfunction
function FN_Damage takes nothing returns nothing
local unit target = udg_Tunit
local unit cstr = udg_cs_Tunit
local player p = GetOwningPlayer(cstr)
local real dmg = FN_Damage_Value(LoadValueSCV(cstr, "FN_lvl"))
local real life = GetUnitStateSwap(UNIT_STATE_LIFE, target)
local integer n = 0
call LaunchEffectUnit("Abilities\\Spells\\Orc\\EtherealForm\\SpiritWalkerChange.mdl", target, "chest", 2)
if life > dmg + 10 then
call SetUnitLifeBJ(target, life - dmg)
else
call DamageUnit(target, dmg, p, false)
endif
if not IsUnitDeadBJ(target) then
loop
exitwhen udg_Fl_Unit[n] == null or udg_Fl_Unit[n] == target
set n = n + 1
endloop
if udg_Fl_Unit[n] == null then
set udg_Fl_Unit[n] = target
set udg_Fl_SpEf[n] = AddSpecialEffectTarget("Doodads\\Cinematic\\FirePillarMedium\\FirePillarMedium.mdl", target, "head")
set udg_Fl_SpEf2[n] = AddSpecialEffectTarget("Doodads\\Cinematic\\FirePillarMedium\\FirePillarMedium.mdl", target, "origin")
set udg_Fl_SpEf3[n] = AddSpecialEffectTarget("Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeDamageTarget.mdl", target, "chest")
set udg_Fl_Player[n] = GetOwningPlayer(cstr)
endif
set udg_Fl_BurnTime[n] = 10
endif
set target = null
set cstr = null
set p = null
endfunction
function Trig_Flame_Nova_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevelSwapped('A00X', cstr)
call StoreIntegerSCV(cstr, "FN_lvl", lvl)
call CastNova(FN_radius(), "Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl", false, "FN_Damage", Condition (function FN_Filter))
endfunction
//===========================================================================
function InitTrig_Flame_Nova takes nothing returns nothing
set gg_trg_Flame_Nova = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Flame_Nova, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Flame_Nova, Condition( function Trig_Flame_Nova_Conditions ) )
call TriggerAddAction( gg_trg_Flame_Nova, function Trig_Flame_Nova_Actions )
endfunction
function Trig_Mental_Domination_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00Z' and GetUnitTypeId(GetTriggerUnit()) == 'H005'
endfunction
function MD_filter takes nothing returns boolean
return not IsUnitInvulnerable(GetFilterUnit()) and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), Player(0))
endfunction
function Trig_Mental_Domination_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevelSwapped('A00Z', cstr)
local group tgroup = null
local location loc = null
local player p = null
local integer i = 0
loop
set i = i + 1
exitwhen UnitHasBuffBJ(target, 'B00B') or i == 80
call TriggerSleepAction(0.1)
endloop
if i != 8 then
set loc = GetUnitLoc(target)
set p = GetOwningPlayer(cstr)
call LaunchEffectLoc("Abilities\\Spells\\Undead\\RegenerationAura\\ObsidianRegenAura.mdl", loc, 7 + 3*lvl)
set tgroup = GetUnitsInRangeOfLocMatching(lvl*25 + 100, loc, Condition(function MD_filter))
call GroupRemoveUnit(tgroup, target)
loop
set target = FirstOfGroup(tgroup)
exitwhen target == null
call AddBuffUnitAdv(target, 'A00Z', "entanglingroots", p, lvl)
call GroupRemoveUnit(tgroup, target)
endloop
call DestroyGroup(tgroup)
call RemoveLocation(loc)
set tgroup = null
set loc = null
set p = null
endif
set cstr = null
set target = null
endfunction
//===========================================================================
function InitTrig_Mental_Domination takes nothing returns nothing
set gg_trg_Mental_Domination = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mental_Domination, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Mental_Domination, Condition( function Trig_Mental_Domination_Conditions ) )
call TriggerAddAction( gg_trg_Mental_Domination, function Trig_Mental_Domination_Actions )
endfunction
constant function ECA_Radius takes nothing returns integer
return 450
endfunction
function Trig_Ether_Controll_Aura_Conditions takes nothing returns boolean
return GetLearnedSkillBJ() == 'A011'
endfunction
function ECA_Cond takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), Player(0)) and DistanceBetweenUnits(GetTriggerUnit(), LoadUnitSCV(GetTriggeringTrigger(), "cstr")) <= ECA_Radius()
endfunction
function manabonus takes integer i returns integer
local integer array mb
set mb[1] = 8
set mb[2] = 15
set mb[3] = 22
set mb[4] = 30
set mb[4] = 38
return mb[i]
endfunction
function ECA_Bonus takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local unit cstr = LoadUnitSCV(t, "cstr")
local unit tunit = GetTriggerUnit()
local location loc = GetUnitLoc(tunit)
local integer lvl = LoadValueSCV(cstr, "ECA_lvl")
call SetUnitState(cstr, UNIT_STATE_MANA, GetUnitStateSwap(UNIT_STATE_MANA, cstr) + manabonus(lvl))
call LaunchEffectLoc("Abilities\\Spells\\Other\\Drain\\ManaDrainTarget.mdl", loc, 2)
call LaunchEffectUnit("Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCasterOverhead.mdl", cstr, "overhead", 2)
set cstr = null
set t = null
endfunction
function Trig_Ether_Controll_Aura_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local player p = GetOwningPlayer(cstr)
local integer lvl = GetUnitAbilityLevelSwapped('A011', cstr)
local trigger t = null
if lvl == 1 then
set t = CreateTrigger()
call StoreObjectSCV(t, "cstr", cstr)
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(t, Condition(function ECA_Cond))
call TriggerAddAction(t, function ECA_Bonus)
endif
call StoreIntegerSCV(cstr, "ECA_lvl", lvl)
set cstr = null
set p = null
endfunction
//===========================================================================
function InitTrig_Ether_Controll_Aura takes nothing returns nothing
set gg_trg_Ether_Controll_Aura = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ether_Controll_Aura, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_Ether_Controll_Aura, Condition( function Trig_Ether_Controll_Aura_Conditions ) )
call TriggerAddAction( gg_trg_Ether_Controll_Aura, function Trig_Ether_Controll_Aura_Actions )
endfunction
function ThB_Damage takes integer lvl returns integer
if lvl == 1 then
return 90
elseif lvl == 3 then
return 210
endif
return 150
endfunction
function Trig_Thunderball_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A013'
endfunction
function ThB_damage_cond takes nothing returns boolean
return not IsUnitInvulnerable(GetFilterUnit()) and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), Player(0))
endfunction
function ThB_Jump takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitSCV(t, "u")
local real a = LoadRealSCV(t, "a")
local real b = LoadRealSCV(t, "b")
local real ang = LoadRealSCV(t, "ang")
local real r = LoadRealSCV(t, "r")
local group tgroup = null
local location loc = null
local player p = null
local real height = GetUnitFlyHeight(u)
local real X = GetUnitX(u)
local real Y = GetUnitY(u)
local real dx = Cos(ang)*15
local real dy = Sin(ang)*15
local real dh = a*r*r + b*r
if height >= 19 then
call SetUnitX(u, X + dx)
call SetUnitY(u, Y + dy)
call SetUnitFlyHeight(u, dh + 20, 0)
call StoreRealSCV(t, "r", r + 15)
else
set loc = GetUnitLoc(u)
call LaunchEffectLoc("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", loc, 3)
set tgroup = GetUnitsInRangeOfLocMatching(200, loc, Condition(function ThB_damage_cond))
set p = GetOwningPlayer(u)
call KillUnit(u)
set r = LoadRealSCV(t, "dmg")
loop
set u = FirstOfGroup(tgroup)
exitwhen u == null
call DamageUnit(u, r, p, false)
call GroupRemoveUnit(tgroup, u)
endloop
call FlushObjectSCV(t)
call DestroyTimer(t)
call RemoveLocation(loc)
call DestroyGroup(tgroup)
set loc = null
set tgroup = null
endif
set t = null
set u = null
endfunction
function ThB_Explode takes nothing returns nothing
local unit u = GetTriggerUnit()
local trigger tt = GetTriggeringTrigger()
local timer t = null
local location cloc = GetUnitLoc(u)
local location loc = GetUnitLoc(u)
local player p = GetOwningPlayer(u)
local real ang = GetRandomReal(0, 30)
local integer i = 0
local real X = GetUnitX(u)
local real Y = GetUnitY(u)
local real dist
local integer h = GetRandomInt(150, 400)
local real dmg = LoadRealSCV(tt, "dmg")
loop
exitwhen i > 7
call MoveLocation(loc, X + GetRandomInt(100, 500)*Cos(ang), Y + GetRandomInt(100, 500)*Sin(ang))
set u = CreateUnitAtLoc(p, 'h006', cloc, 0)
set dist = DistanceBetweenPoints(cloc, loc)
set t = CreateTimer()
call StoreRealSCV(t, "a", (-4*h)/(dist*dist))
call StoreRealSCV(t, "b", (4*h)/(dist))
call StoreRealSCV(t, "r", 0.3)
call StoreRealSCV(t, "ang", bj_DEGTORAD*ang)
call StoreObjectSCV(t, "u", u)
call SetUnitFlyHeight(u, 20, 0)
call SetUnitScalePercent(u, 90, 90, 90)
call StoreRealSCV(t, "dmg", dmg)
call TimerStart(t, 0.04, true, function ThB_Jump)
set i = i + 1
set ang = ang + 45
endloop
call DestroyTrigger(tt)
call RemoveLocation(loc)
call RemoveLocation(cloc)
set t = null
set tt = null
set loc = null
set cloc = null
set u = null
endfunction
function Trig_Thunderball_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local location cloc = GetUnitLoc(cstr)
local location loc = GetSpellTargetLoc()
local real angle = AngleBetweenPoints(cloc, loc)
local player p = GetOwningPlayer(cstr)
local unit u = CreateUnit(p, 'h006', GetUnitX(cstr), GetUnitY(cstr), 0)
local real h = 300
local real dist = DistanceBetweenPoints(cloc, loc)
local real a = (-4*h)/(dist*dist)
local real b = (4*h)/(dist)
local timer t = CreateTimer()
local trigger tt = CreateTrigger()
call CheckOverflow()
call StoreRealSCV(t, "a", a)
call StoreRealSCV(t, "b", b)
call StoreRealSCV(t, "r", 15)
call StoreRealSCV(t, "ang", bj_DEGTORAD*angle)
call StoreObjectSCV(t, "u", u)
call StoreRealSCV(t, "dmg", ThB_Damage(GetUnitAbilityLevelSwapped('A013', u)))
call StoreRealSCV(tt, "dmg", ThB_Damage(GetUnitAbilityLevelSwapped('A013', u)))
call SetUnitFlyHeight(u, 20, 0)
call SetUnitScalePercent(u, 180, 180, 180)
//call dm("a = " + R2S(a))
//call dm("b = " + R2S(b))
//call dm("dist = " + R2S(dist))
call TimerStart(t, 0.03, true, function ThB_Jump)
call TriggerAddAction(tt, function ThB_Explode)
call TriggerRegisterUnitEvent(tt, u, EVENT_UNIT_DEATH )
call RemoveLocation(loc)
call RemoveLocation(cloc)
set loc = null
set cloc = null
set cstr = null
set u = null
set t = null
set tt = null
endfunction
//===========================================================================
function InitTrig_Thunderball takes nothing returns nothing
set gg_trg_Thunderball = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Thunderball, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Thunderball, Condition( function Trig_Thunderball_Conditions ) )
call TriggerAddAction( gg_trg_Thunderball, function Trig_Thunderball_Actions )
endfunction
function Trig_Frost_Shield_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A01M' and GetUnitTypeId(GetTriggerUnit()) == 'H005'
endfunction
function Trig_Frost_Shield_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call LaunchEffectUnit("Abilities\\Weapons\\ZigguratFrostMissile\\ZigguratFrostMissile.mdl", u, "weapon", 3)
call AddBuffUnit(u, 'AUfa', "frostarmor", GetOwningPlayer(u))
set u = null
endfunction
//===========================================================================
function InitTrig_Frost_Shield takes nothing returns nothing
set gg_trg_Frost_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Frost_Shield, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Frost_Shield, Condition( function Trig_Frost_Shield_Conditions ) )
call TriggerAddAction( gg_trg_Frost_Shield, function Trig_Frost_Shield_Actions )
endfunction
function fltr_on_enemy takes nothing returns boolean
local boolean b = (not IsUnitInvulnerable(GetFilterUnit())) and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), Player(0)) and (not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) and (IsUnitAliveBJ(GetFilterUnit()))
// call dm(B2S(b))
return b
endfunction
function RAwav takes integer i returns integer
local integer array W
set W[1] = 4
set W[2] = 4
set W[3] = 5
set W[4] = 5
set W[5] = 6
set W[6] = 6
set W[7] = 7
set W[8] = 7
return W[i]
endfunction
function RAdmg takes integer i returns real
local real array dmg
set dmg[1] = 45
set dmg[2] = 70
set dmg[3] = 90
set dmg[4] = 125
set dmg[5] = 165
set dmg[6] = 205
set dmg[7] = 250
set dmg[8] = 305
return dmg[i]
endfunction
function Trig_Rain_of_Arrows_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A01R') and (GetUnitTypeId(GetSpellAbilityUnit()) == 'E000')
endfunction
function RAeffect takes location loc returns nothing
local unit dmmatkr = CreateUnit(Player(0), 'e006', GetLocationX(loc), GetLocationY(loc), 0)
local integer i = GetRandomInt(0, 3)
if i == 0 then
call SetUnitX(dmmatkr, GetUnitX(dmmatkr) + 20)
elseif i == 1 then
call SetUnitX(dmmatkr, GetUnitX(dmmatkr) - 20)
elseif i == 2 then
call SetUnitY(dmmatkr, GetUnitY(dmmatkr) + 20)
elseif i == 3 then
call SetUnitY(dmmatkr, GetUnitY(dmmatkr) - 20)
endif
call IssuePointOrderLocBJ(dmmatkr, "attackground", loc)
set udg_Tunit = dmmatkr
set dmmatkr = null
endfunction
function RAarrows takes nothing returns nothing
local real X = GetLocationX(udg_Tpoint)
local real Y = GetLocationY(udg_Tpoint)
local location loc = Location(X, Y)
local real ang = 0
local real rad = 50
local integer k = 0
local unit array DA //dummy attackers
loop
call RAeffect(loc)
set DA[k] = udg_Tunit
set ang = GetRandomReal(30, 50) + ang
if ang > 360 then
set ang = ang - 360
endif
set rad = GetRandomReal(10, 40) + rad
if rad > 200 then
set rad = rad - 170
endif
if rad < 30 then
set rad = 50
endif
call MoveLocation(loc, X + rad*Cos(Deg2Rad(ang)), Y + rad*Sin(Deg2Rad(ang)))
exitwhen k == 20
set k = k + 1
call PolledWait(0.1)
endloop
loop
call RemoveUnit(DA[k])
set DA[k] = null
exitwhen k == 0
set k = k - 1
endloop
call RemoveLocation(loc)
set loc = null
endfunction
//range == 200
function Trig_Rain_of_Arrows_Actions takes nothing returns nothing
local location tpnt = GetSpellTargetLoc()
local real X = GetLocationX(tpnt)
local real Y = GetLocationY(tpnt)
local unit cstr = GetTriggerUnit()
local player p = GetOwningPlayer(cstr)
local integer cord = GetUnitCurrentOrder(cstr)
local integer lvl = GetUnitAbilityLevelSwapped('A01R', cstr)
local integer w = RAwav(lvl)
local real dmg = RAdmg(lvl)
local group tgroup = null
local integer i = 1
local unit u = null
loop
exitwhen (i > w) or IsUnitDeadBJ(cstr) or (GetUnitCurrentOrder(cstr) != cord)
set udg_Tpoint = tpnt
call ExecuteFunc("RAarrows")
call PolledWait(1)
set tgroup = GetUnitsInRangeOfLocMatching(200, tpnt, Condition(function fltr_on_enemy))
loop
set u = FirstOfGroup(tgroup)
exitwhen u == null
call DamageUnit(u, dmg, p, false)
call GroupRemoveUnit(tgroup, u)
endloop
call DestroyGroup(tgroup)
set i = i + 1
endloop
//call dm("!")
loop
exitwhen (i > w + 2)
call PolledWait(1)
set tgroup = GetUnitsInRangeOfLocMatching(200, tpnt, Condition(function fltr_on_enemy))
loop
set u = FirstOfGroup(tgroup)
exitwhen u == null
call DamageUnit(u, dmg, p, false)
call GroupRemoveUnit(tgroup, u)
endloop
call DestroyGroup(tgroup)
set i = i + 1
endloop
//call dm("&")
call IssueImmediateOrderBJ( cstr, "stop" )
set tgroup = null
call RemoveLocation(tpnt)
set tpnt = null
set p = null
set cstr = null
endfunction
//===========================================================================
function InitTrig_Rain_of_Arrows takes nothing returns nothing
set gg_trg_Rain_of_Arrows = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Rain_of_Arrows, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Rain_of_Arrows, Condition( function Trig_Rain_of_Arrows_Conditions ) )
call TriggerAddAction( gg_trg_Rain_of_Arrows, function Trig_Rain_of_Arrows_Actions )
endfunction
function Trig_Horn_of_the_Hunter_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A029') and (GetUnitTypeId(GetTriggerUnit()) == 'E000')
endfunction
function HHtime takes integer i returns real
local real array T
set T[1] = 0.5
set T[2] = 0.75
set T[3] = 1
set T[4] = 1.25
set T[5] = 1.5
set T[6] = 1.75
set T[7] = 2
set T[8] = 2.5
return T[i]
endfunction
function HHdamage takes integer i returns real
local real array D
set D[1] = 50
set D[2] = 75
set D[3] = 100
set D[4] = 125
set D[4] = 150
set D[5] = 175
set D[6] = 200
set D[8] = 225
return D[i]
endfunction
function HHmove_timed_line takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local unit tunit = LoadUnitSCV(t, "trg")
local real x = GetUnitX(tunit)
local real y = GetUnitY(tunit)
local real dx = LoadRealSCV(t, "dx")
local real dy = LoadRealSCV(t, "dy")
local real x1 = LoadRealSCV(t, "x1")
local real y1 = LoadRealSCV(t, "y1")
local real x0 = x + dx
local real y0 = y + dy
local integer i = LoadValueSCV(t, "i")
if i > 0 then
if RAbsBJ( x - x1 ) > 0.01 or RAbsBJ( y - y1 ) > 0.01 then
call SetUnitX(tunit, x)
call SetUnitY(tunit, y)
set tunit = null
call FlushObjectSCV(t)
set t = null
call DestroyTrigger(GetTriggeringTrigger())
endif
endif
call StoreIntegerSCV(t, "i", i + 1)
call StoreRealSCV(t, "x1", x0)
call StoreRealSCV(t, "y1", y0)
call SetUnitX(tunit, x0)
call SetUnitY(tunit, y0)
set tunit = null
set t = null
endfunction
function HHMoveUnitLineTimed takes unit target, real angle, real dist returns trigger
local trigger t = CreateTrigger()
call StoreObjectSCV(t, "trg", target)
call StoreRealSCV(t, "dx", (dist * Cos(Deg2Rad(angle))) )
call StoreRealSCV(t, "dy", (dist * Sin(Deg2Rad(angle))) )
call StoreIntegerSCV(t, "i", 0)
call TriggerAddAction(t, function HHmove_timed_line)
call TriggerRegisterTimerEventPeriodic( t, 0.03 )
return t
endfunction
function Trig_Horn_of_the_Hunter_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local location tpnt = GetUnitLoc(cstr)
local location loc = Location(0, 0)
local player p = GetOwningPlayer(cstr)
local group tgroup = GetUnitsInRangeOfLocMatching(200, tpnt, Condition(function fltr_on_enemy))
local integer lvl = GetUnitAbilityLevelSwapped('A029', cstr)
local unit tunit = null
local real ang
local trigger array T
local integer i = 0
call PlaySoundAtPointBJ( gg_snd_HornOfTheHunter, 100, tpnt, 0 )
loop
set tunit = FirstOfGroup(tgroup)
exitwhen tunit == null
call MoveLocation(loc, GetUnitX(tunit), GetUnitY(tunit))
set ang = AngleBetweenPoints(tpnt, loc)
set T[i] = HHMoveUnitLineTimed(tunit, ang, 15)
call AddBuffUnitAdv(tunit, 'A02J', "thunderbolt", p, lvl)
call DamageUnit(tunit, HHdamage(lvl), p, false)
call GroupRemoveUnit(tgroup, tunit)
set i = i + 1
endloop
call PolledWait(HHtime(lvl))
loop
exitwhen i < 0
if T[i] != null then
call FlushObjectSCV(T[i])
call DestroyTrigger(T[i])
set T[i] = null
endif
set i = i - 1
endloop
call DestroyGroup(tgroup)
call RemoveLocation(tpnt)
call RemoveLocation(loc)
set tgroup = null
set tunit = null
set cstr = null
set p = null
set loc = null
set tpnt = null
endfunction
//===========================================================================
function InitTrig_Horn_of_the_Hunter takes nothing returns nothing
set gg_trg_Horn_of_the_Hunter = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Horn_of_the_Hunter, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Horn_of_the_Hunter, Condition( function Trig_Horn_of_the_Hunter_Conditions ) )
call TriggerAddAction( gg_trg_Horn_of_the_Hunter, function Trig_Horn_of_the_Hunter_Actions )
endfunction
function Trig_Ray_of_Weakness_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A02L') and (GetUnitTypeId(GetTriggerUnit()) == 'E000')
endfunction
function RoWbuff takes nothing returns nothing
call UnitRemoveAbilityBJ( 'B000', udg_Tunit)
call UnitRemoveAbilityBJ( 'Bblo', udg_Tunit)
call UnitRemoveAbilityBJ( 'B002', udg_Tunit)
call AddBuffUnitAdv(udg_Tunit, 'A02K', "bloodlust", GetOwningPlayer(udg_cs_Tunit), LoadValueSCV(udg_cs_Tunit, "Rolvl"))
endfunction
function Trig_Ray_of_Weakness_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevelSwapped('A02L', cstr)
call StoreIntegerSCV(cstr, "Rolvl", lvl)
call CastWave('h00B', 2, "RoWbuff", Condition(function fltr_on_enemy))
endfunction
//===========================================================================
function InitTrig_Ray_of_Weakness takes nothing returns nothing
set gg_trg_Ray_of_Weakness = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ray_of_Weakness, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ray_of_Weakness, Condition( function Trig_Ray_of_Weakness_Conditions ) )
call TriggerAddAction( gg_trg_Ray_of_Weakness, function Trig_Ray_of_Weakness_Actions )
endfunction
function WS_move takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer lvl = LoadValueSCV(t, "lvl")
local unit tunit
local unit cstr = LoadUnitSCV(t, "cstr")
local real X = GetUnitX(cstr)
local real Y = GetUnitY(cstr)
local real a
local integer i = 1
loop
exitwhen i > lvl
set tunit = LoadUnitSCV(t, "d" + I2S(i))
set a = LoadRealSCV(t, "a" + I2S(i))
set a = a + (bj_PI/2)*0.04
call SetUnitX(tunit, X + 100*Cos(a))
call SetUnitY(tunit, Y + 100*Sin(a))
call StoreRealSCV(t, "a" + I2S(i), a)
set i = i + 1
endloop
set t = null
set tunit = null
set cstr = null
endfunction
function ST takes integer lvl returns integer
local integer array TT
set TT[1] = 'A02U'
set TT[2] = 'A02R'
set TT[3] = 'A02S'
set TT[4] = 'A02T'
set TT[5] = 'A02V'
return TT[lvl]
endfunction
function Trig_Wind_Shield_Conditions takes nothing returns boolean
return (GetUnitTypeId(GetTriggerUnit()) == 'E000') and (GetSpellAbilityId() == 'A02P')
endfunction
function Trig_Wind_Shield_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local player p = GetOwningPlayer(cstr)
local real X = GetUnitX(cstr)
local real Y = GetUnitY(cstr)
local integer lvl = GetUnitAbilityLevelSwapped('A02P', cstr)
local unit array dummy
local timer t = CreateTimer()
local real a = 360/lvl
local effect array e
local integer i = 1
call UnitAddAbilityBJ(ST(lvl), cstr)
call SetUnitAbilityLevelSwapped('A02Q', cstr, lvl)
call StoreIntegerSCV(t, "lvl", lvl)
call StoreObjectSCV(t, "cstr", cstr)
loop
exitwhen i > lvl
set dummy[i] = CreateUnit(p, 'h000', X + 100*Cos(Deg2Rad(a*i)), Y + 100*Sin(Deg2Rad(a*i)), 270)
call SetUnitScalePercent(dummy[i], 35, 35, 35)
set e[i] = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Tornado\\TornadoElemental.mdl", dummy[i], "overhead")
call StoreObjectSCV(t, "d" + I2S(i), dummy[i])
call StoreRealSCV(t, "a" + I2S(i), Deg2Rad(a*i))
set i = i + 1
endloop
call TimerStart(t, 0.03, true, function WS_move)
call PolledWait(25)
call FlushObjectSCV(t)
call DestroyTimer(t)
set t = null
set p = null
loop
set i = i - 1
exitwhen e[i] == null
call DestroyEffect(e[i])
set e[i] = null
call RemoveUnit(dummy[i])
set dummy[i] = null
endloop
call UnitRemoveAbilityBJ(ST(lvl), cstr)
set cstr = null
endfunction
//===========================================================================
function InitTrig_Wind_Shield takes nothing returns nothing
set gg_trg_Wind_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Wind_Shield, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Wind_Shield, Condition( function Trig_Wind_Shield_Conditions ) )
call TriggerAddAction( gg_trg_Wind_Shield, function Trig_Wind_Shield_Actions )
endfunction
function Trig_Venom_Grove_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A02M') and (GetUnitTypeId(GetTriggerUnit()) == 'E000')
endfunction
function VGenter_cond takes nothing returns boolean
return (not IsUnitInvulnerable(GetTriggerUnit())) and IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), Player(0)) and (not IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE)) and (IsUnitAliveBJ(GetTriggerUnit()))
endfunction
function IS_ULeaveCond takes nothing returns boolean
return (GetUnitAbilityLevelSwapped('B00I', GetTriggerUnit()) > 0)
endfunction
function IS_ULeaveActions takes nothing returns nothing
call UnitRemoveAbilityBJ( 'B00I', GetTriggerUnit())
endfunction
function IS_UEnterActions takes nothing returns nothing
// local unit u = GetTriggerUnit()
// if (not IsUnitInvulnerable(u)) and IsPlayerEnemy(GetOwningPlayer(u), Player(0)) and (not IsUnitType(u, UNIT_TYPE_STRUCTURE)) and (IsUnitAliveBJ(u)) then
// call dm("@")
call AddBuffUnitAdv(GetTriggerUnit(), 'A02O', "shadowstrike", GetOwningPlayer(GetTriggerUnit()), LoadValueSCV(GetTriggeringTrigger(), "lvl"))
// endif
endfunction
function Trig_Venom_Grove_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local integer level = GetUnitAbilityLevelSwapped('A02M', cstr)
local player p = GetOwningPlayer(cstr)
local group tgroup = GetUnitsInRangeOfLocMatching( 300 , loc, Condition(function fltr_on_enemy))
local unit tunit = null
local rect Fzone = RectFromCenterSizeBJ(loc, 400.00, 400.00)
local region Cold = CreateCircleRegion(GetLocationX(loc), GetLocationY(loc), 300)
local trigger Uenter = CreateTrigger()
local trigger Uleave = CreateTrigger()
local weathereffect fog = null
local unit dmy = CreateUnit(p, 'h000', GetLocationX(loc), GetLocationY(loc), 0)
local unit dmy1 = CreateUnit(p, 'h000', GetLocationX(loc), GetLocationY(loc), 0)
call PolledWait(0.5)
call SetUnitScalePercent(dmy, 290, 290, 290)
call SetUnitFlyHeight(dmy, 0, 0)
call LaunchEffectUnit("Abilities\\Spells\\NightElf\\EntangleMine\\Roots.mdl", dmy, "origin", level*3 + 9)
call SetUnitScalePercent(dmy1, 150, 150, 150)
call SetUnitFlyHeight(dmy1, 0, 0)
call LaunchEffectUnit("Abilities\\Spells\\NightElf\\EntangleMine\\Roots.mdl", dmy1, "origin", level*3 + 9)
call DrawCircleImmediate("Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl", loc, level*3 + 9, 300, 45)
call DrawCircleImmediate("Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl", loc, level*3 + 9, 150, 80)
set fog = AddWeatherEffect(Fzone, 'FDgh')
call EnableWeatherEffect(fog, true)
set tgroup = GetUnitsInRangeOfLocMatching(290, loc, Condition(function fltr_on_enemy))
loop
exitwhen IsUnitGroupEmptyBJ(tgroup)
set tunit = FirstOfGroup(tgroup)
call AddBuffUnitAdv(tunit, 'A02O', "shadowstrike", p, level)
call GroupRemoveUnit(tgroup, tunit)
endloop
call DestroyGroup(tgroup)
call TriggerAddCondition(Uenter, Condition(function VGenter_cond))
call TriggerAddAction(Uenter, function IS_UEnterActions)
call TriggerRegisterEnterRegion(Uenter, Cold, null)
call TriggerAddAction(Uleave, function IS_ULeaveActions)
call TriggerAddCondition(Uleave, Condition(function IS_ULeaveCond))
call TriggerRegisterLeaveRegion(Uleave, Cold, null)
call StoreIntegerSCV(Uenter, "lvl", level)
call PolledWait(level*3 + 9)
call FlushObjectSCV(Uenter)
call RemoveWeatherEffect(fog)
call DestroyTrigger(Uenter)
call DestroyTrigger(Uleave)
set tgroup = GetUnitsInRangeOfLocMatching(350, loc, Condition(function fltr_on_enemy))
loop
exitwhen IsUnitGroupEmptyBJ(tgroup)
set tunit = FirstOfGroup(tgroup)
call UnitRemoveAbilityBJ( 'B00I', tunit)
call GroupRemoveUnit(tgroup, tunit)
endloop
call DestroyGroup(tgroup)
call RemoveRect(Fzone)
call RemoveRegion(Cold)
call RemoveUnit(dmy)
call RemoveUnit(dmy1)
call RemoveLocation(loc)
set dmy = null
set dmy1 = null
set Uenter = null
set Uleave = null
set tgroup = null
set tunit = null
set p = null
set Fzone = null
set loc = null
set fog = null
set Cold = null
endfunction
//===========================================================================
function InitTrig_Venom_Grove takes nothing returns nothing
set gg_trg_Venom_Grove = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Venom_Grove, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Venom_Grove, Condition( function Trig_Venom_Grove_Conditions ) )
call TriggerAddAction( gg_trg_Venom_Grove, function Trig_Venom_Grove_Actions )
endfunction
//0000EE - 2
//00CDCD - 3
//551A8B - 4
//EEEE00 - 5
//912CEE - purple
function MakePlayerColor takes string playername, integer i returns string
if i == 1 then
return ("|cff0000EE" + playername + "|r")
elseif i == 2 then
return ("|cff00CDCD" + playername + "|r")
elseif i == 3 then
return ("|cff551A8B" + playername + "|r")
elseif i == 4 then
return ("|cffEEEE00" + playername + "|r")
endif
return playername
endfunction
function Trig_Create_Multiboard_Actions takes nothing returns nothing
local integer i
local integer j
set udg_GameInfo = CreateMultiboard()
call MultiboardSetTitleText(udg_GameInfo, "|cff8B0000Hellfire Defence 2007|r v1.0")
call MultiboardSetColumnCount(udg_GameInfo, 4)
call MultiboardSetRowCount(udg_GameInfo, 2 + udg_AmmountOfPlayers)
call MultiboardSetItemsWidth(udg_GameInfo, 0.05)
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, 0, 1), "Kills")
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, 0, 2), "Deaths")
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, 0, 3), "Ressurections")
call MultiboardSetItemsStyle(udg_GameInfo, true, false)
set i = 1
set j = 1
loop
exitwhen j > 4
if ( GetPlayerSlotState(Player(j)) == PLAYER_SLOT_STATE_PLAYING ) then
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, i, 0), MakePlayerColor(GetPlayerName(Player(j)), j) )
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, i, 1), I2S(udg_Kills[j]))
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, i, 2), I2S(udg_Deaths[j]))
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, i, 3), I2S(udg_RessurectionsPayed[j]))
set udg_MB_Player[i] = Player(j)
call MultiboardSetItemWidth(MultiboardGetItem(udg_GameInfo, i, 0), 0.12)
set udg_RessurectionsPayed[i] = udg_RessurectionsPayed[j]
set i = i + 1
endif
set j = j + 1
endloop
call MultiboardSetItemWidth(MultiboardGetItem(udg_GameInfo, 0, 0), 0.12)
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, 0, 0), "Round № 0")
call MultiboardDisplay(udg_GameInfo, true)
endfunction
//native MultiboardGetItem takes multiboard lb, integer row, integer column returns multiboarditem
//===========================================================================
function InitTrig_Create_Multiboard takes nothing returns nothing
set gg_trg_Create_Multiboard = CreateTrigger( )
call TriggerAddAction( gg_trg_Create_Multiboard, function Trig_Create_Multiboard_Actions )
endfunction
function MB_SortByK takes nothing returns nothing
local integer i = 1
local integer k = 1
local integer nmax = 1
local integer temp
local player tplayer
loop
exitwhen k > 4
set i = k
loop
exitwhen i > 4
if udg_Kills[i] > udg_Kills[nmax] then
set nmax = i
endif
set i = i + 1
endloop
set tplayer = udg_MB_Player[k]
set udg_MB_Player[k] = udg_MB_Player[nmax]
set udg_MB_Player[nmax] = tplayer
set temp = udg_Kills[k]
set udg_Kills[k] = udg_Kills[nmax]
set udg_Kills[nmax] = temp
set temp = udg_Deaths[k]
set udg_Deaths[k] = udg_Deaths[nmax]
set udg_Deaths[nmax] = temp
set temp = udg_RessurectionsPayed[k]
set udg_RessurectionsPayed[k] = udg_RessurectionsPayed[nmax]
set udg_RessurectionsPayed[nmax] = temp
set k = k + 1
endloop
endfunction
function Trig_Multiboard_Update_Actions takes nothing returns nothing
local integer i = 1
local integer j = 1
// call MB_SortByK()
loop
exitwhen j > 4
if ( GetPlayerSlotState(Player(j)) == PLAYER_SLOT_STATE_PLAYING ) then
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, i, 0), MakePlayerColor(GetPlayerName(udg_MB_Player[i]), j) )
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, i, 1), I2S(udg_Kills[i]))
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, i, 2), I2S(udg_Deaths[i]))
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, i, 3), I2S(udg_RessurectionsPayed[i]))
set i = i + 1
endif
set j = j + 1
endloop
call MultiboardSetItemValue(MultiboardGetItem(udg_GameInfo, 0, 0), "Round № " + I2S(udg_CurrentWaveIndex))
endfunction
//===========================================================================
function InitTrig_Multiboard_Update takes nothing returns nothing
set gg_trg_Multiboard_Update = CreateTrigger( )
call TriggerAddAction( gg_trg_Multiboard_Update, function Trig_Multiboard_Update_Actions )
endfunction
function Trig_Pay_for_Ressurection_Conditions takes nothing returns boolean
return ( GetItemTypeId(GetSoldItem()) == 'I00D' ) and ( GetUnitTypeId(GetSellingUnit()) == 'nheb' )
endfunction
function Trig_Pay_for_Ressurection_Actions takes nothing returns nothing
local unit Tunit = GetBuyingUnit()
local player p = GetOwningPlayer(Tunit)
local integer i = 1
loop
exitwhen i > 4
exitwhen p == udg_MB_Player[i]
set i = i + 1
endloop
call LaunchEffectUnit("Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl", Tunit, "origin", 3)
set udg_RessurectionsPayed[i] = ( udg_RessurectionsPayed[i] + 1 )
call TriggerExecute(gg_trg_Multiboard_Update)
endfunction
//===========================================================================
function InitTrig_Pay_for_Ressurection takes nothing returns nothing
set gg_trg_Pay_for_Ressurection = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Pay_for_Ressurection, EVENT_PLAYER_UNIT_SELL_ITEM )
call TriggerAddCondition( gg_trg_Pay_for_Ressurection, Condition( function Trig_Pay_for_Ressurection_Conditions ) )
call TriggerAddAction( gg_trg_Pay_for_Ressurection, function Trig_Pay_for_Ressurection_Actions )
endfunction
function Trig_Hero_Dies_Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and GetOwningPlayer(GetTriggerUnit()) != Player(5)
endfunction
function Trig_Hero_Dies_Actions takes nothing returns nothing
local unit u = null
local unit u1 = null
local location Tpoint = null
local player p = GetOwningPlayer(GetTriggerUnit())
local integer i = 1
loop
exitwhen i > 4
exitwhen p == udg_MB_Player[i]
set i = i + 1
endloop
//call dm(I2S(i))
if udg_RessurectionsPayed[i] > 0 then
set udg_RessurectionsPayed[i] = udg_RessurectionsPayed[i] - 1
set udg_Deaths[i] = udg_Deaths[i] + 1
set u = GetTriggerUnit()
set Tpoint = GetUnitLoc(u)
set u1 = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), GetUnitTypeId(u), Tpoint, 270)
call SetUnitAnimation( u1, "death" )
call SetUnitVertexColorBJ( u1, 50.00, 50.00, 50.00, 50.00 )
call TriggerSleepAction( 3.00 )
call RemoveUnit(u1)
call ReviveHeroLoc( u, Tpoint, true )
call RemoveLocation(Tpoint)
set Tpoint = null
set u = null
set u1 = null
set p = null
call TriggerExecute(gg_trg_Multiboard_Update)
else
call KillUnit( gg_unit_nheb_0004 )
call DestroyTrigger(GetTriggeringTrigger())
endif
endfunction
//===========================================================================
function InitTrig_Hero_Dies takes nothing returns nothing
set gg_trg_Hero_Dies = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Hero_Dies, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Hero_Dies, Condition( function Trig_Hero_Dies_Conditions ) )
call TriggerAddAction( gg_trg_Hero_Dies, function Trig_Hero_Dies_Actions )
endfunction
function Trig_Monstropedia_Update_Actions takes nothing returns nothing
call QuestMessageBJ( GetPlayersAll(), bj_QUESTMESSAGE_UPDATED, "Monstropedia updated. Press F9 for details." )
set udg_Mpa_num = ( udg_Mpa_num + 1 )
call CreateQuestBJ( bj_QUESTTYPE_OPT_DISCOVERED, udg_Monstropedia_txt[( ( udg_Mpa_num - 1 ) * 6 )], "|cff9B30FFDescription|r: " + udg_Monstropedia_txt[( ( ( udg_Mpa_num - 1 ) * 6 ) + 5 )], udg_Monstropedia_txt[( ( ( udg_Mpa_num - 1 ) * 6 ) + 1 )] )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "|cffFFD700Level|r: " + udg_Monstropedia_txt[( ( ( udg_Mpa_num - 1 ) * 6 ) + 2 )] )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "|cff32CD32Bounty|r: " + udg_Monstropedia_txt[( ( ( udg_Mpa_num - 1 ) * 6 ) + 3 )] )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "|cffFF4500Danger Level|r: " + udg_Mda_danger_lvl[udg_Mpa_num] )
call CreateQuestItemBJ( GetLastCreatedQuestBJ(), "|cffDCDCDCSpecial Abilities|r: " + udg_Monstropedia_txt[( ( ( udg_Mpa_num - 1 ) * 6 ) + 4 )] )
endfunction
//===========================================================================
function InitTrig_Monstropedia_Update takes nothing returns nothing
set gg_trg_Monstropedia_Update = CreateTrigger( )
call TriggerAddAction( gg_trg_Monstropedia_Update, function Trig_Monstropedia_Update_Actions )
endfunction
function Trig_General_Spawn_New_Conditions takes nothing returns boolean
local unit tunit = GetTriggerUnit()
if IsUnitInGroup(tunit, udg_WaveGroup) then
set udg_Monsters = ( udg_Monsters - 1 )
call GroupRemoveUnitSimple( tunit, udg_WaveGroup )
endif
set tunit = null
//call dm(I2S(CountUnitsInGroup(udg_WaveGroup)))
return udg_WaveIsSpawning == false and FirstOfGroup(udg_WaveGroup) == null
endfunction
function CreateBonus takes nothing returns nothing
local unit victim = GetTriggerUnit()
local trigger t = GetTriggeringTrigger()
call CreateItem(udg_Bounty, GetUnitX(victim), GetUnitY(victim))
call DestroyTrigger(t)
set t = null
set victim = null
endfunction
function Trig_General_Spawn_New_Actions takes nothing returns nothing
local integer a = 1
local integer b = 1
local location loc = null
local unit tunit = null
local trigger t = null
local integer bonus = R2I(udg_EarnedBounty/udg_AmmountOfPlayers)
if udg_CurrentWaveIndex != 0 then
// call DisplayTextToForce( GetPlayersAll(), "You earned |cffFFD700" + I2S(bonus) + "|r gold for round #" + I2S(udg_CurrentWaveIndex) )
loop
exitwhen a > udg_AmmountOfPlayers
call SetPlayerStateBJ( ConvertedPlayer(a + 1), PLAYER_STATE_RESOURCE_GOLD, (GetPlayerState(ConvertedPlayer(a + 1), PLAYER_STATE_RESOURCE_GOLD) + bonus))
set a = a + 1
endloop
endif
set udg_CurrentWaveIndex = ( udg_CurrentWaveIndex + 1 )
if udg_WaveTriggers[udg_CurrentWaveIndex] == null then
call TriggerExecute(gg_trg_Victory_Cinematic_Preset)
call DestroyTrigger(GetTriggeringTrigger())
return
endif
set udg_WaveIsSpawning = true
call CheckOverflow()
call PolledWait(10)
if udg_CurrentWaveIndex == 5 then
call TriggerExecute( gg_trg_Goblin_Cinematic_Preset )
loop
exitwhen udg_CinematicSkkiped[0] == true
call TriggerSleepAction(0.5)
endloop
endif
if udg_CurrentWaveIndex == 25 then
call TriggerExecute( gg_trg_KJ_Cinematic_Preset )
loop
exitwhen udg_CinematicSkkiped[0] == true
call TriggerSleepAction(0.5)
endloop
endif
call PolledWait(20)
call TriggerExecute( udg_WaveTriggers[udg_CurrentWaveIndex] )
call SetUnitAnimation(gg_unit_ndke_0012, "stand work")
call SetUnitAnimation(gg_unit_ndke_0007, "stand work")
call SetUnitAnimation(gg_unit_ndke_0013, "stand work")
call SetUnitAnimation(gg_unit_ndkw_0029, "stand work")
set a = 1
loop
exitwhen b + 12*(a-1) > udg_MonstersMaxAmmount + 1
set b = 1
loop
exitwhen b > 12
set loc = GetRectCenter(udg_SpawnRect[b])
set tunit = CreateUnitAtLoc(Player(5), udg_SpawnableMonsters[b + 12*(a-1)], loc, 0)
if b + 12*(a-1) == udg_BossNum then
set t = CreateTrigger()
call TriggerAddAction(t, function CreateBonus)
call TriggerRegisterUnitEvent( t, tunit, EVENT_UNIT_DEATH )
endif
call SetUnitUserData( tunit, 0 )
call LaunchEffectLoc("Abilities\\Spells\\Demon\\ReviveDemon\\ReviveDemon.mdl", loc, 5)
set udg_Monsters = udg_Monsters + 1
call GroupAddUnitSimple( tunit, udg_WaveGroup )
call IssuePointOrderLocBJ( tunit, "attack", udg_BloodElvenBaseCenter )
call RemoveLocation(loc)
set b = b + 1
call TriggerExecute( gg_trg_Multiboard_Update )
endloop
set a = a + 1
call PolledWait(udg_WaitTime)
endloop
call SetUnitAnimation(gg_unit_ndke_0012, "stand")
call SetUnitAnimation(gg_unit_ndke_0007, "stand")
call SetUnitAnimation(gg_unit_ndke_0013, "stand")
call SetUnitAnimation(gg_unit_ndkw_0029, "stand")
if udg_CurrentWaveIndex == 25 then
call SetUnitPositionLoc( gg_unit_n00U_0054, GetRectCenter(gg_rct_Kiljaedin_Appear) )
call IssuePointOrderLocBJ( gg_unit_n00U_0054, "attack", udg_BloodElvenBaseCenter)
set udg_Monsters = udg_Monsters + 1
call GroupAddUnitSimple(gg_unit_n00U_0054, udg_WaveGroup )
endif
set udg_WaveIsSpawning = false
set loc = null
set tunit = null
endfunction
//===========================================================================
function InitTrig_General_Spawn_New takes nothing returns nothing
set gg_trg_General_Spawn_New = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_General_Spawn_New, Player(5), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_General_Spawn_New, Condition( function Trig_General_Spawn_New_Conditions ) )
call TriggerAddAction( gg_trg_General_Spawn_New, function Trig_General_Spawn_New_Actions )
endfunction
function Trig_Anti_runner_Conditions takes nothing returns boolean
return GetOwningPlayer(GetTriggerUnit()) == Player(5)
endfunction
function Trig_Anti_runner_Actions takes nothing returns nothing
call IssuePointOrderLocBJ( GetTriggerUnit(), "attack", udg_BloodElvenBaseCenter )
endfunction
//===========================================================================
function InitTrig_Anti_runner takes nothing returns nothing
set gg_trg_Anti_runner = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Anti_runner, gg_rct_Move11 )
call TriggerRegisterEnterRectSimple( gg_trg_Anti_runner, gg_rct_Move21 )
call TriggerRegisterEnterRectSimple( gg_trg_Anti_runner, gg_rct_Move31 )
call TriggerRegisterEnterRectSimple( gg_trg_Anti_runner, gg_rct_Move41 )
call TriggerAddCondition( gg_trg_Anti_runner, Condition( function Trig_Anti_runner_Conditions ) )
call TriggerAddAction( gg_trg_Anti_runner, function Trig_Anti_runner_Actions )
endfunction
function TBA_Cond takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'n001' or GetUnitTypeId(GetTriggerUnit()) == 'n004' or GetUnitTypeId(GetTriggerUnit()) == 'n00E'
endfunction
function FindBeastmaster takes nothing returns boolean
call dm("@")
return GetUnitTypeId(GetFilterUnit()) == 'n00F'
endfunction
function Trig_Upgrade_Thorny_Beast_Auraa_Actions takes nothing returns nothing
local unit tunit = GetTriggerUnit()
local location tpoint = GetUnitLoc(tunit)
local group tgroup // = GetUnitsInRangeOfLocMatching(900, tpoint, Condition(function FindBeastmaster))
local unit cstr // = FirstOfGroup(tgroup)
local integer i = GetUnitTypeId(tunit)
call dm("!")
if cstr != null and Chance(50) then
call dm("#")
if i == 'n001' then //lesser thorny beast
call dm("$")
call GroupRemoveUnit(udg_WaveGroup, tunit)
set tunit = ReplaceUnitBJ(tunit, 'n004', bj_UNIT_STATE_METHOD_RELATIVE )
call LaunchEffectUnit("Abilities\\Spells\\Other\\Awaken\\Awaken.mdl", tunit, "origin", 2)
elseif i == 'n004' then //thorny beast
call GroupRemoveUnit(udg_WaveGroup, tunit)
set tunit = ReplaceUnitBJ(tunit, 'n00E', bj_UNIT_STATE_METHOD_RELATIVE )
call LaunchEffectUnit("Abilities\\Spells\\Other\\Awaken\\Awaken.mdl", tunit, "origin", 2)
elseif i == 'n00E' and udg_CurrentWaveIndex >= 7 then
call GroupRemoveUnit(udg_WaveGroup, tunit)
set tunit = ReplaceUnitBJ(tunit, 'n007', bj_UNIT_STATE_METHOD_RELATIVE )
call LaunchEffectUnit("Abilities\\Spells\\Other\\Awaken\\Awaken.mdl", tunit, "origin", 2)//greater thorny beast
endif
endif
if tunit != GetTriggerUnit() then
call GroupAddUnit(udg_WaveGroup, tunit)
endif
call DestroyGroup(tgroup)
call RemoveLocation(tpoint)
set tgroup = null
set tpoint = null
endfunction
//===========================================================================
function InitTrig_Upgrade_Thorny_Beast_Auraa takes nothing returns nothing
set gg_trg_Upgrade_Thorny_Beast_Auraa = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Upgrade_Thorny_Beast_Auraa, Player(5), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_Upgrade_Thorny_Beast_Auraa, function Trig_Upgrade_Thorny_Beast_Auraa_Actions )
/// call TriggerAddCondition(gg_trg_Upgrade_Thorny_Beast_Auraa, Condition(function TBA_Cond))
endfunction
function UpgradeThornyCondition takes nothing returns boolean
return (GetOwningPlayer(GetTriggerUnit()) == Player(5)) and (GetUnitTypeId(GetTriggerUnit()) == 'n001' or GetUnitTypeId(GetTriggerUnit()) == 'n004' or GetUnitTypeId(GetTriggerUnit()) == 'n00E')
endfunction
function BMCondition takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'n00F' and IsUnitAliveBJ(GetFilterUnit())
endfunction
function Trig_UpgradeThornyBeast_Actions takes nothing returns nothing
local unit tunit = GetTriggerUnit()
local location tloc = GetUnitLoc(tunit)
local integer i = GetUnitTypeId(tunit)
local boolexpr filter = Condition(function BMCondition)
local group tgroup = GetUnitsInRangeOfLocMatching(900, tloc, filter)
local unit bm = FirstOfGroup(tgroup)
if bm != null and Chance(25) then
if i == 'n001' then //lesser thorny beast
call GroupRemoveUnit(udg_WaveGroup, tunit)
set tunit = ReplaceUnitBJ(tunit, 'n004', bj_UNIT_STATE_METHOD_RELATIVE )
call LaunchEffectUnit("Abilities\\Spells\\Other\\Awaken\\Awaken.mdl", tunit, "origin", 2)
elseif i == 'n004' then //thorny beast
call GroupRemoveUnit(udg_WaveGroup, tunit)
set tunit = ReplaceUnitBJ(tunit, 'n00E', bj_UNIT_STATE_METHOD_RELATIVE )
call LaunchEffectUnit("Abilities\\Spells\\Other\\Awaken\\Awaken.mdl", tunit, "origin", 2)
elseif i == 'n00E' and udg_CurrentWaveIndex >= 7 then
call GroupRemoveUnit(udg_WaveGroup, tunit)
set tunit = ReplaceUnitBJ(tunit, 'n007', bj_UNIT_STATE_METHOD_RELATIVE )
call LaunchEffectUnit("Abilities\\Spells\\Other\\Awaken\\Awaken.mdl", tunit, "origin", 2)//greater thorny beast
endif
endif
if tunit != GetTriggerUnit() then
call GroupAddUnit(udg_WaveGroup, tunit)
endif
call DestroyBoolExpr(filter)
call DestroyGroup(tgroup)
call RemoveLocation(tloc)
set filter = null
set tgroup = null
set tloc = null
set tunit = null
set bm = null
endfunction
//===========================================================================
function InitTrig_UpgradeThornyBeast takes nothing returns nothing
set gg_trg_UpgradeThornyBeast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_UpgradeThornyBeast, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_UpgradeThornyBeast, function Trig_UpgradeThornyBeast_Actions )
call TriggerAddCondition(gg_trg_UpgradeThornyBeast, Condition(function UpgradeThornyCondition))
endfunction
function FSDE_Filter takes nothing returns boolean
return IsUnitAliveBJ(GetFilterUnit()) and (not IsUnitInvulnerable(GetFilterUnit())) and GetOwningPlayer(GetFilterUnit()) != Player(5)
endfunction
function Trig_Frost_Spirit_Death_Explode_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'n005'
endfunction
function Trig_Frost_Spirit_Death_Explode_Actions takes nothing returns nothing
local unit tunit = GetTriggerUnit()
local location tpoint = GetUnitLoc(tunit)
local group tgroup = GetUnitsInRangeOfLocMatching(200, tpoint, Condition (function FSDE_Filter))
local player p = GetOwningPlayer(tunit)
call LaunchEffectLoc("Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl", tpoint, 3)
call RemoveLocation(tpoint)
loop
set tunit = FirstOfGroup(tgroup)
exitwhen tunit == null
set tpoint = GetUnitLoc(tunit)
call LaunchEffectLoc("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", tpoint, 3)
call DamageUnit(tunit, 125, p, false)
call GroupRemoveUnit(tgroup, tunit)
call RemoveLocation(tpoint)
endloop
call DestroyGroup(tgroup)
set tgroup = null
set p = null
set tunit = null
set tpoint = null
endfunction
//===========================================================================
function InitTrig_Frost_Spirit_Death_Explode takes nothing returns nothing
set gg_trg_Frost_Spirit_Death_Explode = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Frost_Spirit_Death_Explode, Player(5), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Frost_Spirit_Death_Explode, Condition( function Trig_Frost_Spirit_Death_Explode_Conditions ) )
call TriggerAddAction( gg_trg_Frost_Spirit_Death_Explode, function Trig_Frost_Spirit_Death_Explode_Actions )
endfunction
function Trig_Bloodfiend_Lava_Shield_Conditions takes nothing returns boolean
return (GetUnitTypeId(GetTriggerUnit()) == 'n00G' or GetUnitTypeId(GetTriggerUnit()) == 'n00K') and GetUnitStateSwap(UNIT_STATE_MANA, GetTriggerUnit()) >= 40.00
endfunction
function BLS_damage_cond takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), Player(5)) and IsUnitAliveBJ(GetTriggerUnit()) and (not IsUnitInvulnerable(GetTriggerUnit())) and not UnitHasBuffBJ(GetTriggerUnit(), 'B007')
endfunction
function BLS_damage takes nothing returns nothing
local unit tunit = GetTriggerUnit()
local trigger t = GetTriggeringTrigger()
local player p = LoadPlayerSCV(t, "p")
local unit dummy = LoadUnitSCV(t, "dummy")
call DamageUnit(tunit, 125, p, false)
call LaunchEffectUnit("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl", tunit, "origin", 3)
call KillUnit(dummy)
set t = null
set p = null
set tunit = null
set dummy = null
endfunction
function BLS_move takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit tunit = LoadUnitSCV(t, "dummy")
local unit cstr = LoadUnitSCV(t, "cstr")
local real X = GetUnitX(cstr)
local real Y = GetUnitY(cstr)
local real a = LoadRealSCV(tunit, "angle")
local location loc = GetUnitLoc(cstr)
set a = a + (bj_PI/2)*0.08
call SetUnitX(tunit, X + 150*Cos(a))
call SetUnitY(tunit, Y + 150*Sin(a))
call StoreRealSCV(tunit, "angle", a)
call SetUnitFacingToFaceLocTimed(tunit, loc,0)
set t = null
set tunit = null
set cstr = null
endfunction
function Trig_Bloodfiend_Lava_Shield_Actions takes nothing returns nothing
local unit cstr = GetTriggerUnit()
local player p = GetOwningPlayer(cstr)
local real X = GetUnitX(cstr)
local real Y = GetUnitY(cstr)
local timer t = CreateTimer()
local trigger trig = CreateTrigger()
local unit dummy = CreateUnit(p, 'h004', X, Y, 270)
call TriggerRegisterUnitInRangeSimple(trig, 75, dummy)
call TriggerAddAction(trig, function BLS_damage)
call TriggerAddCondition(trig, Condition(function BLS_damage))
call StoreObjectSCV(trig, "p", p)
call StoreObjectSCV(trig, "dummy", dummy)
call StoreObjectSCV(t, "dummy", dummy)
call StoreObjectSCV(t, "cstr", cstr)
call StoreRealSCV(dummy, "angle", 0)
call TimerStart(t, 0.03, true, function BLS_move)
call SetUnitManaBJ( cstr, ( GetUnitStateSwap(UNIT_STATE_MANA, cstr) - 40.00 ) )
loop
exitwhen IsUnitDeadBJ(cstr) or IsUnitDeadBJ(dummy)
call TriggerSleepAction(1)
endloop
call FlushObjectSCV(trig)
call DestroyTrigger(trig)
call FlushObjectSCV(t)
call DestroyTimer(t)
call FlushObjectSCV(dummy)
call RemoveUnit(dummy)
set trig = null
set t = null
set dummy = null
endfunction
//===========================================================================
function InitTrig_Bloodfiend_Lava_Shield takes nothing returns nothing
set gg_trg_Bloodfiend_Lava_Shield = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Bloodfiend_Lava_Shield, Player(5), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Bloodfiend_Lava_Shield, Condition( function Trig_Bloodfiend_Lava_Shield_Conditions ) )
call TriggerAddAction( gg_trg_Bloodfiend_Lava_Shield, function Trig_Bloodfiend_Lava_Shield_Actions )
endfunction
function LSDE_Filter takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), Player(5)) and IsUnitAliveBJ(GetFilterUnit()) and (not IsUnitInvulnerable(GetFilterUnit()))
endfunction
function Trig_L_Spirit_Death_Explode_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'n00H'
endfunction
function Trig_L_Spirit_Death_Explode_Actions takes nothing returns nothing
local unit tunit = GetTriggerUnit()
local location tpoint = GetUnitLoc(tunit)
local group tgroup = GetUnitsInRangeOfLocMatching(200, tpoint, Condition (function LSDE_Filter))
local player p = GetOwningPlayer(tunit)
call LaunchEffectLoc("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", tpoint, 3)
call RemoveLocation(tpoint)
loop
set tunit = FirstOfGroup(tgroup)
exitwhen tunit == null
set tpoint = GetUnitLoc(tunit)
call LaunchEffectLoc("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl", tpoint, 3)
call DamageUnit(tunit, 185, p, false)
call GroupRemoveUnit(tgroup, tunit)
call RemoveLocation(tpoint)
endloop
call DestroyGroup(tgroup)
set tgroup = null
set p = null
set tunit = null
set tpoint = null
endfunction
//===========================================================================
function InitTrig_Lightning_Spirit_Death_Explode takes nothing returns nothing
set gg_trg_Lightning_Spirit_Death_Explode = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Lightning_Spirit_Death_Explode, Player(5), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Lightning_Spirit_Death_Explode, Condition( function Trig_L_Spirit_Death_Explode_Conditions ) )
call TriggerAddAction( gg_trg_Lightning_Spirit_Death_Explode, function Trig_L_Spirit_Death_Explode_Actions )
endfunction
function GraveyardConditions takes nothing returns boolean
return (GetUnitTypeId(GetTriggerUnit()) != 'n002') and (GetUnitTypeId(GetTriggerUnit()) != 'n005') and (GetUnitTypeId(GetTriggerUnit()) != 'n00H') and (GetUnitTypeId(GetTriggerUnit()) != 'n009') and (GetUnitTypeId(GetTriggerUnit()) != 'n00X') and (GetUnitTypeId(GetTriggerUnit()) != 'n00W') and (GetUnitTypeId(GetTriggerUnit()) != 'n00V')
endfunction
function WarlockFilter takes nothing returns boolean
return IsUnitAliveBJ(GetFilterUnit()) and (GetUnitTypeId(GetFilterUnit()) == 'o000')
endfunction
function Trig_Warlock_Graveyard_Aura_Actions takes nothing returns nothing
local unit corpse = GetTriggerUnit()
local location loc = GetUnitLoc(corpse)
local boolexpr filter = Condition(function WarlockFilter)
local group tgroup = GetUnitsInRangeOfLocMatching(700, loc, filter)
local integer i = GetRandomInt(0, 9)
if not IsEmpty(tgroup) and Chance(50) then
set corpse = CreateUnitAtLoc(Player(5), udg_GraveyardMonster[i], loc, 0)
call IssuePointOrderLocBJ( corpse, "attack", udg_BloodElvenBaseCenter )
call SetUnitAnimation( corpse, "birth" )
call LaunchEffectUnit(udg_GraveyardEffect[i], corpse, "origin", 2)
call GroupAddUnit(udg_WaveGroup, corpse)
endif
call RemoveLocation(loc)
call DestroyGroup(tgroup)
call DestroyBoolExpr(filter)
set loc = null
set tgroup = null
set filter = null
set corpse = null
endfunction
//===========================================================================
function InitTrig_Graveyard_Aura takes nothing returns nothing
set gg_trg_Graveyard_Aura = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Graveyard_Aura, Player(5), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Graveyard_Aura, function Trig_Warlock_Graveyard_Aura_Actions )
call TriggerAddCondition(gg_trg_Graveyard_Aura, Condition(function GraveyardConditions))
set udg_GraveyardMonster[0] = 'n00X'
set udg_GraveyardMonster[1] = 'n00X'
set udg_GraveyardMonster[2] = 'n00X'
set udg_GraveyardMonster[3] = 'n00W'
set udg_GraveyardMonster[4] = 'n00W'
set udg_GraveyardMonster[5] = 'n00W'
set udg_GraveyardMonster[6] = 'n00V'
set udg_GraveyardMonster[7] = 'n00V'
set udg_GraveyardMonster[8] = 'n00V'
set udg_GraveyardMonster[9] = 'n00V'
set udg_GraveyardEffect[0] = "Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl"
set udg_GraveyardEffect[1] = "Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl"
set udg_GraveyardEffect[2] = "Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl"
set udg_GraveyardEffect[3] = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
set udg_GraveyardEffect[4] = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
set udg_GraveyardEffect[5] = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
set udg_GraveyardEffect[6] = "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl"
set udg_GraveyardEffect[7] = "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl"
set udg_GraveyardEffect[8] = "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl"
set udg_GraveyardEffect[9] = "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl"
endfunction
function Trig_Darkness_Spirit_Death_Explode_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'n009'
endfunction
function Trig_Darkness_Spirit_Death_Explode_Actions takes nothing returns nothing
local unit tunit = GetTriggerUnit()
local location tpoint = GetUnitLoc(tunit)
local group tgroup = GetUnitsInRangeOfLocMatching(200, tpoint, Condition (function LSDE_Filter))
local player p = GetOwningPlayer(tunit)
call LaunchEffectLoc("Objects\\Spawnmodels\\Undead\\UCancelDeath\\UCancelDeath.mdl", tpoint, 3)
call RemoveLocation(tpoint)
loop
set tunit = FirstOfGroup(tgroup)
exitwhen tunit == null
set tpoint = GetUnitLoc(tunit)
call LaunchEffectLoc("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl", tpoint, 3)
call DamageUnit(tunit, 255, p, false)
if not IsUnitDeadBJ(tunit) then
call AddBuffUnit(tunit, 'A009', "unholyfrenzy", p)
endif
call GroupRemoveUnit(tgroup, tunit)
call RemoveLocation(tpoint)
endloop
call DestroyGroup(tgroup)
set tgroup = null
set p = null
set tunit = null
set tpoint = null
endfunction
//===========================================================================
function InitTrig_Darkness_Spirit_Death_Explode takes nothing returns nothing
set gg_trg_Darkness_Spirit_Death_Explode = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Darkness_Spirit_Death_Explode, Player(5), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Darkness_Spirit_Death_Explode, Condition( function Trig_Darkness_Spirit_Death_Explode_Conditions ) )
call TriggerAddAction( gg_trg_Darkness_Spirit_Death_Explode, function Trig_Darkness_Spirit_Death_Explode_Actions )
endfunction
function Trig_Abyss_Machine_Inferno_Flame_Conditions takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) == 'n00C' and IsPlayerAlly(GetOwningPlayer(GetAttackedUnitBJ()), Player(0)) and not UnitHasBuffBJ(GetAttackedUnitBJ(), 'B003')
endfunction
function AM_filter takes nothing returns boolean
return not IsUnitInvulnerable(GetFilterUnit()) and IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), Player(0)) and not IsUnitDeadBJ(GetFilterUnit())
endfunction
function Trig_Abyss_Machine_Inferno_Flame_Actions takes nothing returns nothing
local group tgroup = null
local location loc = null
local unit u = null
local player p = GetOwningPlayer(GetAttacker())
call PolledWait(DistanceBetweenUnits(GetTriggerUnit(), GetAttacker())/700)
set loc = GetUnitLoc(GetTriggerUnit())
set tgroup = GetUnitsInRangeOfLocMatching(200, loc, Condition(function AM_filter))
loop
set u = FirstOfGroup(tgroup)
exitwhen u == null
call AddBuffUnit(u, 'A009', "unholyfrenzy", p)
call GroupRemoveUnit(tgroup, u)
endloop
call DestroyGroup(tgroup)
call RemoveLocation(loc)
set tgroup = null
set u = null
set p = null
set loc = null
endfunction
//===========================================================================
function InitTrig_Abyss_Machine_Inferno_Flame takes nothing returns nothing
set gg_trg_Abyss_Machine_Inferno_Flame = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Abyss_Machine_Inferno_Flame, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Abyss_Machine_Inferno_Flame, Condition( function Trig_Abyss_Machine_Inferno_Flame_Conditions ) )
call TriggerAddAction( gg_trg_Abyss_Machine_Inferno_Flame, function Trig_Abyss_Machine_Inferno_Flame_Actions )
endfunction
function UFA_Cond takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'n008' or GetUnitTypeId(GetTriggerUnit()) == 'n00G'
endfunction
function FindOverlord takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'n00K'
endfunction
function Trig_Overlord_Upgrade_fiend_aura_Actions takes nothing returns nothing
local unit tunit = GetTriggerUnit()
local location tpoint = GetUnitLoc(tunit)
local group tgroup = GetUnitsInRangeOfLocMatching(900, tpoint, Condition(function FindOverlord))
local unit cstr = FirstOfGroup(tgroup)
local integer i = GetUnitTypeId(tunit)
if cstr != null and Chance(20) then
if i == 'n008' then //Felguard
call GroupRemoveUnit(udg_WaveGroup, tunit)
set tunit = ReplaceUnitBJ(tunit, 'n00G', bj_UNIT_STATE_METHOD_RELATIVE )
call LaunchEffectUnit("Abilities\\Spells\\Other\\Awaken\\Awaken.mdl", tunit, "origin", 2)
elseif i == 'n00G' then //Bloodfiend
call GroupRemoveUnit(udg_WaveGroup, tunit)
set tunit = ReplaceUnitBJ(tunit, 'n00K', bj_UNIT_STATE_METHOD_RELATIVE )
call LaunchEffectUnit("Abilities\\Spells\\Other\\Awaken\\Awaken.mdl", tunit, "origin", 2)
endif
endif
if tunit != GetTriggerUnit() then
call GroupAddUnit(udg_WaveGroup, tunit)
endif
call DestroyGroup(tgroup)
set tgroup = null
endfunction
//===========================================================================
function InitTrig_Overlord_Upgrade_fiend_aura takes nothing returns nothing
set gg_trg_Overlord_Upgrade_fiend_aura = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Overlord_Upgrade_fiend_aura, Player(5), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_Overlord_Upgrade_fiend_aura, function Trig_Overlord_Upgrade_fiend_aura_Actions )
call TriggerAddCondition(gg_trg_Upgrade_Thorny_Beast_Auraa, Condition(function UFA_Cond))
endfunction
function Trig_RedHissing_Cage_Conditions takes nothing returns boolean
return (GetUnitTypeId(GetAttacker()) == 'n00B') and (GetUnitStateSwap(UNIT_STATE_MANA, GetAttacker()) >= 80.00) and (GetUnitUserData(GetAttacker()) != 1)
endfunction
function Trig_RedHissing_Cage_Actions takes nothing returns nothing
local destructable Tdestr
local location tpoint = GetUnitLoc(GetTriggerUnit())
local real X = GetLocationX(tpoint)
local real Y = GetLocationY(tpoint)
local player p = GetOwningPlayer(GetAttacker())
call SetUnitUserData( GetAttacker(), 1 )
call CreateDestructableLoc( 'B000', tpoint, GetRandomDirectionDeg(), 1, 0 )
set Tdestr = GetLastCreatedDestructable()
call SetUnitManaBJ( GetAttacker(), ( GetUnitStateSwap(UNIT_STATE_MANA, GetAttacker()) - 80.00 ) )
call RemoveLocation(tpoint)
set tpoint = null
call CreateUnit(p, 'n00Y', X + 100, Y + 100, 270)
call CreateUnit(p, 'n00Y', X - 100, Y - 100, 270)
call CreateUnit(p, 'n00Y', X - 100, Y + 100, 270)
call CreateUnit(p, 'n00Y', X + 100, Y - 100, 270)
call TriggerSleepAction( 10.00 )
call RemoveDestructable( Tdestr )
set Tdestr = null
call SetUnitUserData( GetAttacker(), 0 )
endfunction
//===========================================================================
function InitTrig_RedHissing_Cage takes nothing returns nothing
set gg_trg_RedHissing_Cage = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_RedHissing_Cage, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_RedHissing_Cage, Condition( function Trig_RedHissing_Cage_Conditions ) )
call TriggerAddAction( gg_trg_RedHissing_Cage, function Trig_RedHissing_Cage_Actions )
endfunction
function Trig_Flesh_Golem_Plague_Cloud_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'h000', Player(0), GetRectCenter(gg_rct_AI_work), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_Flesh_Golem_Plague_Cloud takes nothing returns nothing
set gg_trg_Flesh_Golem_Plague_Cloud = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Flesh_Golem_Plague_Cloud, gg_rct_AI_work )
call TriggerAddAction( gg_trg_Flesh_Golem_Plague_Cloud, function Trig_Flesh_Golem_Plague_Cloud_Actions )
endfunction
function Trig_Lava_Golem_Magma_Strike_Conditions takes nothing returns boolean
return ( GetUnitStateSwap(UNIT_STATE_MANA, GetTriggerUnit()) >= 50.00 ) and (DistanceBetweenUnits(GetTriggerUnit(), GetAttacker()) < 250) and ((GetUnitTypeId(GetTriggerUnit()) == 'n00M') or (GetUnitTypeId(GetTriggerUnit()) == 'n00P'))
endfunction
function LGMSfltr takes nothing returns boolean
return not IsUnitInvulnerable(GetFilterUnit()) and IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), Player(0)) and not IsUnitDeadBJ(GetFilterUnit()) and not UnitHasBuffBJ(GetFilterUnit(), 'BPSE')
endfunction
function Trig_Lava_Golem_Magma_Strike_Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local unit cstr = GetTriggerUnit()
local player p = GetOwningPlayer(cstr)
local location tloc = GetUnitLoc(cstr)
local boolexpr filter = Condition(function LGMSfltr)
local group tgroup = GetUnitsInRangeOfLocMatching(359, tloc, filter)
local integer i = 0
local unit tunit = FirstOfGroup(tgroup)
call DisableTrigger(t)
call SetUnitManaBJ( cstr, ( GetUnitStateSwap(UNIT_STATE_MANA, cstr) - 50.00 ) )
call DrawCircleImmediate("Abilities\\Spells\\Demon\\RainOfFire\\RainOfFireTarget.mdl", tloc, 3, 350, 15)
loop
exitwhen tunit == null
call LaunchEffectUnit("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", tunit, "chest", 3)
call AddBuffUnit(tunit, 'A00W', "thunderbolt", p)
call GroupRemoveUnit(tgroup, tunit)
set tunit = FirstOfGroup(tgroup)
endloop
call DestroyGroup(tgroup)
call DestroyBoolExpr(filter)
call RemoveLocation(tloc)
call TriggerSleepAction(10)
call EnableTrigger(t)
set tgroup = null
set filter = null
set tloc = null
set cstr = null
set tunit = null
endfunction
//===========================================================================
function InitTrig_Lava_Golem_Magma_Strike takes nothing returns nothing
set gg_trg_Lava_Golem_Magma_Strike = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Lava_Golem_Magma_Strike, Player(5), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Lava_Golem_Magma_Strike, Condition( function Trig_Lava_Golem_Magma_Strike_Conditions ) )
call TriggerAddAction( gg_trg_Lava_Golem_Magma_Strike, function Trig_Lava_Golem_Magma_Strike_Actions )
endfunction
function Trig_Vampire_Life_Steal_Conditions takes nothing returns boolean
return (GetUnitTypeId(GetAttacker()) == 'n00N') and IsPlayerAlly(GetOwningPlayer(GetAttackedUnitBJ()), Player(0)) == true and GetUnitUserData(GetAttacker()) == 0
endfunction
function move_l_actions2 takes nothing returns nothing
local timer t = GetExpiredTimer()
local lightning l = LoadLightningSCV(t, "l")
local unit u1 = LoadUnitSCV(t, "u1")
local unit u2 = LoadUnitSCV(t, "u2")
call MoveLightning (l, true, GetUnitX(u1), GetUnitY(u1), GetUnitX(u2), GetUnitY(u2))
set t = null
set l = null
set u1 = null
set u2 = null
endfunction
function VLS_Damage takes nothing returns nothing
local timer tt = GetExpiredTimer()
local timer t = null
local unit cstr = LoadUnitSCV(tt, "u1")
local unit victim = LoadUnitSCV(tt, "u2")
local effect e = null
local real r = GetUnitStateSwap(UNIT_STATE_LIFE, victim)
local integer i = LoadValueSCV(tt, "i")
local lightning l = null
if not IsUnitDeadBJ(cstr) and i < 10 and not IsUnitDeadBJ(victim) then
call SetUnitLifeBJ(victim, r - 20)
set r = GetUnitStateSwap(UNIT_STATE_LIFE, cstr)
call SetUnitLifeBJ(cstr, r + 20)
call StoreIntegerSCV(tt, "i", i + 1)
else
set e = LoadEffectSCV(tt, "e")
call DestroyEffect(e)
set e = LoadEffectSCV(tt, "e2")
call DestroyEffect(e)
set t = LoadTimerSCV(tt, "t")
set l = LoadLightningSCV(t, "l")
call DestroyLightning(l)
call FlushObjectSCV(t)
call DestroyTimer(t)
call FlushObjectSCV(tt)
call DestroyTimer(tt)
set e = null
set l = null
set t = null
endif
set tt = null
set cstr = null
set victim = null
endfunction
function Trig_Vampire_Life_Steal_Actions takes nothing returns nothing
local unit victim = GetTriggerUnit()
local unit cstr = GetAttacker()
local timer t = CreateTimer()
local timer tt = CreateTimer()
local lightning l = AddLightning("DRAL", true, GetUnitX(cstr), GetUnitY(cstr), GetUnitX(cstr), GetUnitY(cstr))
local effect e = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Drain\\DrainTarget.mdl", victim, "chest")
local effect e2 = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Drain\\DrainCaster.mdl", cstr, "chest")
call SetUnitUserData(cstr, 1)
call StoreObjectSCV(t, "l", l)
call StoreObjectSCV(t, "u1", cstr)
call StoreObjectSCV(t, "u2", victim)
call TimerStart(t, 0.03, true, function move_l_actions2)
call StoreObjectSCV(tt, "u1", cstr)
call StoreObjectSCV(tt, "u2", victim)
call StoreObjectSCV(tt, "t", t)
call StoreObjectSCV(tt, "e", e)
call StoreObjectSCV(tt, "e2", e2)
call StoreIntegerSCV(tt, "i", 0)
call TimerStart(tt, 0.5, true, function VLS_Damage)
set cstr = null
set victim = null
set t = null
set tt = null
set e = null
set e2 = null
endfunction
//===========================================================================
function InitTrig_Vampire_Life_Steal takes nothing returns nothing
set gg_trg_Vampire_Life_Steal = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Vampire_Life_Steal, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Vampire_Life_Steal, Condition( function Trig_Vampire_Life_Steal_Conditions ) )
call TriggerAddAction( gg_trg_Vampire_Life_Steal, function Trig_Vampire_Life_Steal_Actions )
endfunction
function CryptAuraConditions takes nothing returns boolean
return (GetUnitTypeId(GetTriggerUnit()) != 'n002') and (GetUnitTypeId(GetTriggerUnit()) != 'n005') and (GetUnitTypeId(GetTriggerUnit()) != 'n00H') and (GetUnitTypeId(GetTriggerUnit()) != 'n009') and (GetUnitTypeId(GetTriggerUnit()) != 'n010') and (GetUnitTypeId(GetTriggerUnit()) != 'n00Z')
endfunction
function EredarSFilter takes nothing returns boolean
return IsUnitAliveBJ(GetFilterUnit()) and (GetUnitTypeId(GetFilterUnit()) == 'n00O')
endfunction
function Trig_Crypt_Aura_Actions takes nothing returns nothing
local unit corpse = GetTriggerUnit()
local location loc = GetUnitLoc(corpse)
local boolexpr filter = Condition(function EredarSFilter)
local group tgroup = GetUnitsInRangeOfLocMatching(700, loc, filter)
local integer i = GetRandomInt(10, 15)
if not IsEmpty(tgroup) and Chance(50) then
set corpse = CreateUnitAtLoc(Player(5), udg_GraveyardMonster[i], loc, 0)
call IssuePointOrderLocBJ( corpse, "attack", udg_BloodElvenBaseCenter )
call SetUnitAnimation( corpse, "birth" )
call LaunchEffectUnit(udg_GraveyardEffect[i], corpse, "origin", 2)
call GroupAddUnit(udg_WaveGroup, corpse)
endif
call RemoveLocation(loc)
call DestroyGroup(tgroup)
call DestroyBoolExpr(filter)
set loc = null
set tgroup = null
set filter = null
set corpse = null
endfunction
//===========================================================================
function InitTrig_Crypt_Aura takes nothing returns nothing
set gg_trg_Crypt_Aura = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Crypt_Aura, Player(5), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Crypt_Aura, function Trig_Crypt_Aura_Actions )
call TriggerAddCondition(gg_trg_Crypt_Aura, Condition(function CryptAuraConditions))
set udg_GraveyardMonster[10] = 'n00Z'
set udg_GraveyardMonster[11] = 'n00Z'
set udg_GraveyardMonster[12] = 'n00Z'
set udg_GraveyardMonster[13] = 'n010'
set udg_GraveyardMonster[14] = 'n010'
set udg_GraveyardMonster[15] = 'n010'
set udg_GraveyardEffect[10] = "Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl"
set udg_GraveyardEffect[11] = "Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl"
set udg_GraveyardEffect[12] = "Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl"
set udg_GraveyardEffect[13] = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
set udg_GraveyardEffect[14] = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
set udg_GraveyardEffect[15] = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
endfunction
function InfJugExpMis_Conditions takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) == 'n00Q' and IsPlayerAlly(GetOwningPlayer(GetAttackedUnitBJ()), Player(0))
endfunction
function IJEM_filter takes nothing returns boolean
return not IsUnitInvulnerable(GetFilterUnit()) and IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), Player(0)) and not IsUnitDeadBJ(GetFilterUnit()) and not UnitHasBuffBJ(GetFilterUnit(), 'BPSE')
endfunction
function Trig_InfJugExpMis_Actions takes nothing returns nothing
local group tgroup = null
local unit u = GetTriggerUnit()
local location loc = GetUnitLoc(u)
local player p = GetOwningPlayer(GetAttacker())
call PolledWait(DistanceBetweenUnits(GetTriggerUnit(), GetAttacker())/1500)
// set loc = GetUnitLoc(GetTriggerUnit())
set tgroup = GetUnitsInRangeOfLocMatching(120, loc, Condition(function IJEM_filter))
call LaunchEffectLoc("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", loc, 3)
loop
set u = FirstOfGroup(tgroup)
exitwhen u == null
if Chance(30) then
call AddBuffUnit(u, 'A00W', "thunderbolt", p)
call GroupRemoveUnit(tgroup, u)
endif
endloop
call DestroyGroup(tgroup)
call RemoveLocation(loc)
set tgroup = null
set u = null
set p = null
set loc = null
endfunction
//===========================================================================
function InitTrig_Infernal_Juggernaut_Explosive_Missels takes nothing returns nothing
set gg_trg_Infernal_Juggernaut_Explosive_Missels = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Infernal_Juggernaut_Explosive_Missels, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Infernal_Juggernaut_Explosive_Missels, Condition( function InfJugExpMis_Conditions ) )
call TriggerAddAction( gg_trg_Infernal_Juggernaut_Explosive_Missels, function Trig_InfJugExpMis_Actions )
endfunction
function Trig_Butchers_Poison_Nova_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'n00R' and GetUnitUserData(GetTriggerUnit()) == 0 and DistanceBetweenUnits(GetTriggerUnit(), GetAttacker()) < 400
endfunction
function Trig_Butchers_Poison_Nova_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call SetUnitUserData(u, 1 )
call IssueImmediateOrderBJ(u, "waterelemental")
set u = null
endfunction
//===========================================================================
function InitTrig_Butchers_Meat_Nova takes nothing returns nothing
set gg_trg_Butchers_Meat_Nova = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Butchers_Meat_Nova, Player(5), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Butchers_Meat_Nova, Condition( function Trig_Butchers_Poison_Nova_Conditions ) )
call TriggerAddAction( gg_trg_Butchers_Meat_Nova, function Trig_Butchers_Poison_Nova_Actions )
endfunction
function Trig_Poison_Nova_Cast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A01O' and GetUnitTypeId(GetTriggerUnit()) == 'n00R'
endfunction
function BPN_filter takes nothing returns boolean
return not IsUnitDeadBJ(GetFilterUnit()) and not IsUnitInvulnerable(GetFilterUnit()) and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), Player(5))
endfunction
function PoisonNovaDamage takes nothing returns nothing
call DamageUnit(udg_Tunit, 400, Player(5), false)
call LaunchEffectUnit("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl", udg_Tunit, "chest", 2)
call AddBuffUnit(udg_Tunit, 'A022', "cripple", GetOwningPlayer(udg_cs_Tunit))
endfunction
function Trig_Poison_Nova_Cast_Actions takes nothing returns nothing
call CastNova(500, "Abilities\\Weapons\\MeatwagonMissile\\MeatwagonMissile.mdl", false, "PoisonNovaDamage", Condition(function BPN_filter))
endfunction
//===========================================================================
function InitTrig_Meat_Nova_Cast takes nothing returns nothing
set gg_trg_Meat_Nova_Cast = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Meat_Nova_Cast, Player(5), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Meat_Nova_Cast, Condition( function Trig_Poison_Nova_Cast_Conditions ) )
call TriggerAddAction( gg_trg_Meat_Nova_Cast, function Trig_Poison_Nova_Cast_Actions )
endfunction
function Trig_Vampire_Lord_Life_Steal_Conditions takes nothing returns boolean
return (GetUnitTypeId(GetAttacker()) == 'n00S') and IsPlayerAlly(GetOwningPlayer(GetAttackedUnitBJ()), Player(0)) == true and GetUnitUserData(GetAttacker()) == 0
endfunction
function VLLS_Damage takes nothing returns nothing
local timer tt = GetExpiredTimer()
local timer t = null
local unit cstr = LoadUnitSCV(tt, "u1")
local unit victim = LoadUnitSCV(tt, "u2")
local effect e = null
local real r = GetUnitStateSwap(UNIT_STATE_LIFE, victim)
local integer i = LoadValueSCV(tt, "i")
local lightning l = null
if not IsUnitDeadBJ(cstr) and i < 20 and not IsUnitDeadBJ(victim) then
call SetUnitLifeBJ(victim, r - 40)
set r = GetUnitStateSwap(UNIT_STATE_LIFE, cstr)
call SetUnitLifeBJ(cstr, r + 40)
call StoreIntegerSCV(tt, "i", i + 1)
else
set e = LoadEffectSCV(tt, "e")
call DestroyEffect(e)
set e = LoadEffectSCV(tt, "e2")
call DestroyEffect(e)
set t = LoadTimerSCV(tt, "t")
set l = LoadLightningSCV(t, "l")
call DestroyLightning(l)
call FlushObjectSCV(t)
call DestroyTimer(t)
call FlushObjectSCV(tt)
call DestroyTimer(tt)
set e = null
set l = null
set t = null
endif
set tt = null
set cstr = null
set victim = null
endfunction
function Trig_Vampire_Lord_Life_Steal_Actions takes nothing returns nothing
local unit victim = GetTriggerUnit()
local unit cstr = GetAttacker()
local timer t = CreateTimer()
local timer tt = CreateTimer()
local lightning l = AddLightning("DRAL", true, GetUnitX(cstr), GetUnitY(cstr), GetUnitX(cstr), GetUnitY(cstr))
local effect e = AddSpecialEffectTarget("Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl", victim, "origin")
local effect e2 = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Drain\\DrainCaster.mdl", cstr, "chest")
call SetLightningColor(l, 0, 1, 0.5, 0.5)
call SetUnitUserData(cstr, 1)
call StoreObjectSCV(t, "l", l)
call StoreObjectSCV(t, "u1", cstr)
call StoreObjectSCV(t, "u2", victim)
call TimerStart(t, 0.03, true, function move_l_actions2)
call StoreObjectSCV(tt, "u1", cstr)
call StoreObjectSCV(tt, "u2", victim)
call StoreObjectSCV(tt, "t", t)
call StoreObjectSCV(tt, "e", e)
call StoreObjectSCV(tt, "e2", e2)
call StoreIntegerSCV(tt, "i", 0)
call TimerStart(tt, 0.5, true, function VLLS_Damage)
set cstr = null
set victim = null
set t = null
set tt = null
set e = null
set e2 = null
endfunction
//===========================================================================
function InitTrig_Vampire_Lord_Life_Steal takes nothing returns nothing
set gg_trg_Vampire_Lord_Life_Steal = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Vampire_Lord_Life_Steal, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Vampire_Lord_Life_Steal, Condition( function Trig_Vampire_Lord_Life_Steal_Conditions ) )
call TriggerAddAction( gg_trg_Vampire_Lord_Life_Steal, function Trig_Vampire_Lord_Life_Steal_Actions )
endfunction
function IS_Cond takes nothing returns boolean
return ( GetUnitStateSwap(UNIT_STATE_MANA, GetTriggerUnit()) >= 60.00 ) and (DistanceBetweenUnits(GetTriggerUnit(), GetAttacker()) < 400) and (GetUnitTypeId(GetTriggerUnit()) == 'n00U')
endfunction
function ISfltr takes nothing returns boolean
return not IsUnitInvulnerable(GetFilterUnit()) and IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), Player(0)) and not IsUnitDeadBJ(GetFilterUnit()) and not UnitHasBuffBJ(GetFilterUnit(), 'BPSE')
endfunction
function DrawStar takes real CX, real CY, real r, string modelfile, integer c returns nothing
local real a
local location tloc1 = Location(CX, CY)
local location tloc2 = Location(CX, CY)
set a = 90
call MoveLocation(tloc1, CX + r*Cos(Deg2Rad(a)), CY + r*Sin(Deg2Rad(a)))
set a = 230
call MoveLocation(tloc2, CX + r*Cos(Deg2Rad(a)), CY + r*Sin(Deg2Rad(a)))
call DrawLineImmediate(modelfile, tloc1, tloc2, c, 3)
set a = 310
call MoveLocation(tloc2, CX + r*Cos(Deg2Rad(a)), CY + r*Sin(Deg2Rad(a)))
call DrawLineImmediate(modelfile, tloc2, tloc1, c, 3)
set a = 150
call MoveLocation(tloc1, CX + r*Cos(Deg2Rad(a)), CY + r*Sin(Deg2Rad(a)))
call DrawLineImmediate(modelfile, tloc1, tloc2, c, 3)
set a = 30
call MoveLocation(tloc2, CX + r*Cos(Deg2Rad(a)), CY + r*Sin(Deg2Rad(a)))
call DrawLineImmediate(modelfile, tloc1, tloc2, c, 3)
set a = 230
call MoveLocation(tloc1, CX + r*Cos(Deg2Rad(a)), CY + r*Sin(Deg2Rad(a)))
call DrawLineImmediate(modelfile, tloc1, tloc2, c, 3)
call RemoveLocation(tloc1)
call RemoveLocation(tloc2)
set tloc1 = null
set tloc2 = null
endfunction
function Inferno_Strike takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local player p = Player(5)
local location tloc = GetUnitLoc(gg_unit_n00U_0054)
local boolexpr filter = Condition(function ISfltr)
local group tgroup = GetUnitsInRangeOfLocMatching(500, tloc, filter)
local integer i = 0
local unit tunit = FirstOfGroup(tgroup)
call DisableTrigger(t)
call SetUnitAnimation( gg_unit_n00U_0054, "spell slam" )
call SetUnitManaBJ( gg_unit_n00U_0054, ( GetUnitStateSwap(UNIT_STATE_MANA, gg_unit_n00U_0054) - 60.00 ) )
call DrawCircleImmediate("Units\\Demon\\Infernal\\InfernalBirth.mdl", tloc, 3, 500, 15)
call DrawStar(GetLocationX(tloc), GetLocationY(tloc), 500, "Abilities\\Spells\\Demon\\RainOfFire\\RainOfFireTarget.mdl", 17)
loop
exitwhen tunit == null
call AddBuffUnit(tunit, 'A00W', "thunderbolt", p)
call GroupRemoveUnit(tgroup, tunit)
set tunit = FirstOfGroup(tgroup)
endloop
call DestroyGroup(tgroup)
call DestroyBoolExpr(filter)
call PolledWait(2)
call DrawCircleImmediate("Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl", tloc, 3, 500, 15)
loop
exitwhen i > 3
set i = i + 1
call DrawStar(GetLocationX(tloc), GetLocationY(tloc), 500, "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl", 10)
call PolledWait(1.5)
endloop
call RemoveLocation(tloc)
call TriggerSleepAction(5)
call EnableTrigger(t)
set tgroup = null
set filter = null
set tloc = null
set tunit = null
endfunction
//===========================================================================
function InitTrig_Inferno_Strike takes nothing returns nothing
set gg_trg_Inferno_Strike = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Inferno_Strike, Player(5), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Inferno_Strike, Condition( function IS_Cond ) )
call TriggerAddAction( gg_trg_Inferno_Strike, function Inferno_Strike )
endfunction
function AS_Cond takes nothing returns boolean
return ( GetUnitStateSwap(UNIT_STATE_MANA, gg_unit_n00U_0054) >= 100.00 ) and not IsPlayerAlly(Player(5), GetOwningPlayer(GetTriggerUnit()))
endfunction
function AS_damage_cond takes nothing returns boolean
return not IsUnitInvulnerable(GetFilterUnit()) and IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), Player(0)) and not IsUnitDeadBJ(GetFilterUnit()) and not UnitHasBuffBJ(GetFilterUnit(), 'BPSE')
endfunction
function AS_Jump takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitSCV(t, "u")
local real a = LoadRealSCV(t, "a")
local real b = LoadRealSCV(t, "b")
local real ang = LoadRealSCV(t, "ang")
local real r = LoadRealSCV(t, "r")
local group tgroup = null
local location loc = null
local player p = null
local real height = GetUnitFlyHeight(u)
local real X = GetUnitX(u)
local real Y = GetUnitY(u)
local real dx = Cos(ang)*40
local real dy = Sin(ang)*40
local real dh = a*r*r + b*r
if height >= 19 then
call SetUnitX(u, X + dx)
call SetUnitY(u, Y + dy)
call SetUnitFlyHeight(u, dh + 20, 0)
call StoreRealSCV(t, "r", r + 40)
else
set loc = GetUnitLoc(u)
set tgroup = GetUnitsInRangeOfLocMatching(400, loc, Condition(function AS_damage_cond))
set p = GetOwningPlayer(u)
call KillUnit(u)
set r = LoadRealSCV(t, "dmg")
loop
set u = FirstOfGroup(tgroup)
exitwhen u == null
call DamageUnit(u, r, p, false)
call GroupRemoveUnit(tgroup, u)
endloop
set u = CreateUnit(p, 'h000', GetLocationX(loc), GetLocationY(loc), 0)
call SetUnitScalePercent(u, 200, 200, 200)
call LaunchEffectUnit("Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath.mdl", u, "overhead", 5)
call TerrainDeformationCraterBJ( 5.00, false, loc, 400.00, 150.00 )
call UnitAddAbility(u, 'ACsi')
call IssuePointOrderLocBJ( u, "silence", loc )
call FlushObjectSCV(t)
call DestroyTimer(t)
call RemoveLocation(loc)
call DestroyGroup(tgroup)
set loc = null
set tgroup = null
call TriggerSleepAction(5)
call RemoveUnit(u)
endif
set t = null
set u = null
endfunction
function Trig_Abyss_Sphere_Actions takes nothing returns nothing
local unit cstr = gg_unit_n00U_0054
local location cloc = GetUnitLoc(cstr)
local location loc = GetUnitLoc(GetTriggerUnit())
local real angle = AngleBetweenPoints(cloc, loc)
local player p = GetOwningPlayer(cstr)
local unit u = CreateUnit(p, 'h00A', GetUnitX(cstr), GetUnitY(cstr), 0)
local real h = 300
local real dist = DistanceBetweenPoints(cloc, loc)
local real a = (-4*h)/(dist*dist)
local real b = (4*h)/(dist)
local timer t = CreateTimer()
call SetUnitAnimation( gg_unit_n00U_0054, "spell" )
call StoreRealSCV(t, "a", a)
call StoreRealSCV(t, "b", b)
call StoreRealSCV(t, "r", 15)
call StoreRealSCV(t, "ang", bj_DEGTORAD*angle)
call StoreObjectSCV(t, "u", u)
call StoreRealSCV(t, "dmg", 600)
call SetUnitFlyHeight(u, 20, 0)
call SetUnitScalePercent(u, 180, 180, 180)
call TimerStart(t, 0.03, true, function AS_Jump)
call RemoveLocation(loc)
call RemoveLocation(cloc)
set loc = null
set cloc = null
set cstr = null
set u = null
set t = null
endfunction
//===========================================================================
function InitTrig_Abyss_Sphere takes nothing returns nothing
set gg_trg_Abyss_Sphere = CreateTrigger( )
call TriggerRegisterUnitInRangeSimple( gg_trg_Abyss_Sphere, 800.00, gg_unit_n00U_0054 )
call TriggerAddAction( gg_trg_Abyss_Sphere, function Trig_Abyss_Sphere_Actions )
endfunction
function ml_rest takes nothing returns nothing
local timer t = GetExpiredTimer()
local lightning l = LoadLightningSCV(t, "l")
call MoveLightning(l, true, GetUnitX(gg_unit_n00U_0054), GetUnitY(gg_unit_n00U_0054), GetLocationX(udg_cs_FreeCastersPlace), GetLocationY(udg_cs_FreeCastersPlace))
set l = null
set t = null
endfunction
function Trig_Restoration_Actions takes nothing returns nothing
local lightning l = AddLightning("HWPB", true, GetUnitX(gg_unit_n00U_0054), GetUnitY(gg_unit_n00U_0054), GetLocationX(udg_cs_FreeCastersPlace), GetLocationY(udg_cs_FreeCastersPlace))
local timer t = CreateTimer()
local effect e = AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\Rejuvenation\\RejuvenationTarget.mdl", gg_unit_n00U_0054, "chest")
call DisableTrigger(GetTriggeringTrigger())
call StoreObjectSCV(t, "l", l)
call TimerStart(t, 0.03, true, function ml_rest)
loop
exitwhen (GetUnitStateSwap(UNIT_STATE_LIFE, gg_unit_n00U_0054) >= 4500)
call SetUnitState(gg_unit_n00U_0054, UNIT_STATE_LIFE, GetUnitStateSwap(UNIT_STATE_LIFE, gg_unit_n00U_0054) + 200)
call PolledWait(0.25)
endloop
call DestroyEffect(e)
call FlushObjectSCV(t)
call DestroyTimer(t)
call DestroyLightning(l)
set t = null
set l = null
endfunction
//===========================================================================
function InitTrig_Restoration takes nothing returns nothing
set gg_trg_Restoration = CreateTrigger( )
call TriggerRegisterUnitLifeEvent( gg_trg_Restoration, gg_unit_n00U_0054, LESS_THAN, 1000.00 )
call TriggerAddAction( gg_trg_Restoration, function Trig_Restoration_Actions )
endfunction
function Trig_Chargeble_Potions_Conditions takes nothing returns boolean
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00H' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00G' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00I' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'phea' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'pman' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'pres' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'pghe' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'pgma' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'hlst' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'mnst' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'pnvu' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'stwp' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I01F' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I01G' ) ) then
return true
endif
return false
endfunction
function Trig_Chargeble_Potions_Actions takes nothing returns nothing
local item Titem = GetManipulatedItem()
local integer TitemType = GetItemTypeId(Titem)
local integer i = 0
local integer j = 1
loop
exitwhen j > 6
if GetItemTypeId(UnitItemInSlotBJ(GetTriggerUnit(), j)) == TitemType then
set i = ( i + 1 )
endif
set j = j + 1
endloop
if i >= 2 then
set i = GetItemCharges(Titem)
call RemoveItem( Titem )
set Titem = GetItemOfTypeFromUnitBJ(GetTriggerUnit(), TitemType)
call SetItemCharges( Titem, ( GetItemCharges(Titem) + i ) )
endif
endfunction
//===========================================================================
function InitTrig_Chargeble_Potions takes nothing returns nothing
set gg_trg_Chargeble_Potions = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Chargeble_Potions, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Chargeble_Potions, Condition( function Trig_Chargeble_Potions_Conditions ) )
call TriggerAddAction( gg_trg_Chargeble_Potions, function Trig_Chargeble_Potions_Actions )
endfunction
function Trig_Item_Classes_Conditions takes nothing returns boolean
return GetOwningPlayer(GetTriggerUnit()) != Player(5) and GetOwningPlayer(GetTriggerUnit()) != Player(0)
endfunction
function FindItemClass takes item titem, integer ItemClass, boolean IsArtifact returns nothing
local real l = GetItemLifeBJ(titem)
set IsArtifact = false
if (l - 1000) > 0 then
set l = l - 1000
set IsArtifact = true
endif
set ItemClass = R2I(l/100)
set udg_i = ItemClass
set udg_b = IsArtifact
endfunction
function Trig_Item_Classes_Actions takes nothing returns nothing
local boolean IsArtifact = false
local boolean TIsA = false
local integer ItemClass = 0
local item Titem = GetManipulatedItem()
local integer Index = 1
local integer TitemClass = 0
local item Titem2 = null
local unit tunit = GetTriggerUnit()
local location tpoint = null
local boolean ac_num = false
call CheckOverflow()
call FindItemClass(Titem, ItemClass, IsArtifact)
set ItemClass = udg_i
set IsArtifact = udg_b
loop
exitwhen Index > 6
set Titem2 = UnitItemInSlotBJ(tunit, Index)
call FindItemClass(Titem2, TitemClass, TIsA)
if ((IsArtifact and udg_b and IsArtifact == true) or (ItemClass == udg_i and ItemClass != 0)) and Titem != Titem2 and ItemClass < 5 then
if ItemClass != 3 or ac_num then
set tpoint = GetUnitLoc(tunit)
call UnitDropItemPointLoc(tunit, Titem2, tpoint)
call DisplayTextToForce( GetForceOfPlayer (GetOwningPlayer(tunit)) , udg_ItemErrorMessage[ItemClass] )
call RemoveLocation(tpoint)
set tpoint = null
exitwhen true
else
set ac_num = true
endif
endif
set Index = Index + 1
endloop
set tunit = null
set Titem = null
set Titem2 = null
endfunction
//===========================================================================
function InitTrig_Item_Classes takes nothing returns nothing
set gg_trg_Item_Classes = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Item_Classes, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Item_Classes, Condition( function Trig_Item_Classes_Conditions ) )
call TriggerAddAction( gg_trg_Item_Classes, function Trig_Item_Classes_Actions )
endfunction
function Trig_Elves_Scantum_Conditions takes nothing returns boolean
return GetUnitTypeId(GetSellingUnit()) == 'nheb'
endfunction
function Trig_Elves_Scantum_Actions takes nothing returns nothing
local unit Tunit = GetBuyingUnit()
local integer itemType = GetItemTypeId(GetSoldItem())
if itemType == 'I000' then
call SetUnitLifeBJ( Tunit, ( GetUnitStateSwap(UNIT_STATE_LIFE, Tunit) + 600.00 ) )
call LaunchEffectUnit("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", Tunit, "origin", 3)
elseif itemType == 'I001' then
call SetUnitManaBJ( Tunit, ( GetUnitStateSwap(UNIT_STATE_MANA, Tunit) + 300.00 ) )
call LaunchEffectUnit("Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl", Tunit, "origin", 3)
elseif itemType == 'I002' then
call UnitRemoveBuffsBJ( bj_REMOVEBUFFS_NEGATIVE, Tunit )
call LaunchEffectUnit("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", Tunit, "origin", 3)
elseif itemType == 'I003' then
call AddBuffUnit(Tunit, 'A007', "innerfire", GetOwningPlayer(GetTriggerUnit()))
call LaunchEffectUnit("Abilities\\Spells\\Human\\Resurrect\\ResurrectCaster.mdl", Tunit, "chest", 3)
elseif itemType == 'I00C' then
call UnitResetCooldown( Tunit )
call LaunchEffectUnit("Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl", Tunit, "chest", 3)
elseif itemType == 'I00E' then
call AddBuffUnit(Tunit, 'A004', "antimagicshell", GetOwningPlayer(GetTriggerUnit()))
elseif itemType == 'I00F' then
call UnitAddAbilityBJ( 'Adts', Tunit )
call LaunchEffectUnit("Abilities\\Spells\\Human\\MagicSentry\\MagicSentryCaster.mdl", Tunit, "overhead", 45)
call PolledWait(45)
call UnitRemoveAbilityBJ( 'Adts', Tunit )
endif
set Tunit = null
endfunction
//===========================================================================
function InitTrig_Elves_Scantum takes nothing returns nothing
set gg_trg_Elves_Scantum = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Elves_Scantum, EVENT_PLAYER_UNIT_SELL_ITEM )
call TriggerAddCondition( gg_trg_Elves_Scantum, Condition( function Trig_Elves_Scantum_Conditions ) )
call TriggerAddAction( gg_trg_Elves_Scantum, function Trig_Elves_Scantum_Actions )
endfunction
function Trig_Perverted_Improvement_Sound_Conditions takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == 'I01G'
endfunction
function Trig_Perverted_Improvement_Sound_Actions takes nothing returns nothing
local location tpoint = GetUnitLoc(GetTriggerUnit())
call PlaySoundAtPointBJ(gg_snd_Perverted_Improvement, 100, tpoint, 0)
call RemoveLocation(tpoint)
set tpoint = null
endfunction
//===========================================================================
function InitTrig_Perverted_Improvement_Sound takes nothing returns nothing
set gg_trg_Perverted_Improvement_Sound = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Perverted_Improvement_Sound, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( gg_trg_Perverted_Improvement_Sound, Condition( function Trig_Perverted_Improvement_Sound_Conditions ) )
call TriggerAddAction( gg_trg_Perverted_Improvement_Sound, function Trig_Perverted_Improvement_Sound_Actions )
endfunction
function Trig_Minimize_Clockwerk_Goblin_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A01F' and GetUnitTypeId(GetTriggerUnit()) == 'ncgb'
endfunction
function Trig_Minimize_Clockwerk_Goblin_Actions takes nothing returns nothing
local location tpoint = GetUnitLoc(GetTriggerUnit())
call CreateItemLoc('I01E', tpoint)
call SetItemUserData(bj_lastCreatedItem, R2I(GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit())))
call RemoveUnit(GetTriggerUnit())
call RemoveLocation(tpoint)
set tpoint = null
endfunction
//===========================================================================
function InitTrig_Minimize_Clockwerk_Goblin takes nothing returns nothing
set gg_trg_Minimize_Clockwerk_Goblin = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Minimize_Clockwerk_Goblin, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Minimize_Clockwerk_Goblin, Condition( function Trig_Minimize_Clockwerk_Goblin_Conditions ) )
call TriggerAddAction( gg_trg_Minimize_Clockwerk_Goblin, function Trig_Minimize_Clockwerk_Goblin_Actions )
endfunction
function Trig_Force_field_generator_antibug_Conditions takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == 'I01B'
endfunction
function Trig_Force_field_generator_antibug_Actions takes nothing returns nothing
call RemoveItem( GetManipulatedItem() )
call UnitAddItemByIdSwapped( 'I01B', GetTriggerUnit() )
endfunction
//===========================================================================
function InitTrig_Force_field_generator_antibug takes nothing returns nothing
set gg_trg_Force_field_generator_antibug = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Force_field_generator_antibug, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( gg_trg_Force_field_generator_antibug, Condition( function Trig_Force_field_generator_antibug_Conditions ) )
call TriggerAddAction( gg_trg_Force_field_generator_antibug, function Trig_Force_field_generator_antibug_Actions )
endfunction
function Trig_Arcane_Blesses_Initialize_Actions takes nothing returns nothing
set udg_AB_Type[1] = 'rspd'
set udg_AB_Type[2] = 'rsps'
set udg_AB_Type[3] = 'rhe1'
set udg_AB_Type[4] = 'I00T'
set udg_AB_Type[5] = 'rhe1'
set udg_AB_Place[1] = gg_rct_ArcaneBlessing1
set udg_AB_Place[2] = gg_rct_ArcaneBlessing2
set udg_AB_Place[3] = gg_rct_ArcaneBlessing3
endfunction
//===========================================================================
function InitTrig_Arcane_Blesses_Initialize takes nothing returns nothing
set gg_trg_Arcane_Blesses_Initialize = CreateTrigger( )
call TriggerAddAction( gg_trg_Arcane_Blesses_Initialize, function Trig_Arcane_Blesses_Initialize_Actions )
endfunction
function AB_ItemPicked_Cond takes nothing returns boolean
return GetManipulatedItem() == LoadItemSCV(GetTriggeringTrigger(), "item")
endfunction
function AB_ItemPicked takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local integer i = LoadValueSCV(t, "i")
set udg_AB_IsDone[i] = false
call SetDoodadAnimationRectBJ( "stand", 'XOmr', udg_AB_Place[i] )
call FlushObjectSCV(t)
call DestroyTrigger(t)
set t = null
endfunction
function Trig_Arcane_Blesses_Create_Actions takes nothing returns nothing
local integer i = 1
local item titem = null
local location tloc = null
local trigger t = null
loop
exitwhen not udg_AB_IsDone[i]
set i = i + 1
if i > 3 then
return
endif
endloop
set tloc = GetRectCenter(udg_AB_Place[i])
call SetDoodadAnimationRectBJ( "stand alternate", 'XOmr', udg_AB_Place[i] )
call LaunchEffectLoc("Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl", tloc, 2)
set titem = CreateItem(udg_AB_Type[GetRandomInt(1, 5)], GetRectCenterX(udg_AB_Place[i]), GetRectCenterY(udg_AB_Place[i]))
set udg_AB_IsDone[i] = true
set t = CreateTrigger()
call TriggerAddAction(t, function AB_ItemPicked)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(t, Condition(function AB_ItemPicked_Cond))
call StoreObjectSCV(t, "item", titem)
call StoreIntegerSCV(t, "i", i)
call RemoveLocation(tloc)
set tloc = null
set t = null
endfunction
//===========================================================================
function InitTrig_Arcane_Blesses_Create takes nothing returns nothing
set gg_trg_Arcane_Blesses_Create = CreateTrigger( )
call DisableTrigger( gg_trg_Arcane_Blesses_Create )
call TriggerAddAction( gg_trg_Arcane_Blesses_Create, function Trig_Arcane_Blesses_Create_Actions )
endfunction
function Is2RecipesInForge takes nothing returns boolean
local integer i = 1
local integer j = 0
local item titem = null
local itemtype ttype
loop
exitwhen i > 6
set titem = UnitItemInSlotBJ(gg_unit_h008_0050, i)
if titem != null then
set ttype = GetItemType(titem)
endif
if titem != null then
if ttype == ITEM_TYPE_CAMPAIGN then
set j = j + 1
endif
endif
set i = i + 1
endloop
if j == 1 then
return false
endif
return true
endfunction
function GetRecipeRowNum takes integer ttype returns integer
local integer i = 1
loop
exitwhen i > udg_Fg_N
if ttype == udg_Fg_companent[(i - 1)*4] then
exitwhen true
endif
set i = i + 1
endloop
return i
endfunction
function FindRecipe takes nothing returns integer
local integer i = 1
local itemtype class
local item titem = UnitItemInSlotBJ(gg_unit_h008_0050, i)
loop
exitwhen i > 6
set titem = UnitItemInSlotBJ(gg_unit_h008_0050, i)
set class = GetItemType(titem)
if class == ITEM_TYPE_CAMPAIGN then
return GetItemTypeId(titem)
endif
set i = i + 1
endloop
return 0
endfunction
function IsForgeItemCollected takes integer row_num returns boolean
local integer i = 0
loop
exitwhen i > 3
if not UnitHasItemOfTypeBJ(gg_unit_h008_0050, udg_Fg_companent[(row_num - 1)*4 + i]) then
//call dm("i = " + I2S(i))
//call dm("not UnitHasItemOfTyoeBJ")
if udg_Fg_companent[(row_num - 1)*4 + i] != 'I01O' then
//call dm("udg_FG_companent != 'DUMMY ITEM'")
return false
endif
endif
set i = i + 1
endloop
return true
endfunction
function CreateForgeItem takes integer row_num returns item
local integer i = 0
loop
exitwhen i > 3
call RemoveItem(GetItemOfTypeFromUnitBJ(gg_unit_h008_0050, udg_Fg_companent[(row_num - 1)*4 + i]))
set i = i + 1
endloop
return UnitAddItemByIdSwapped(udg_Fg_item[row_num], gg_unit_h008_0050)
endfunction
function Trig_Forge_Work_Actions takes nothing returns nothing
local unit forge = GetTriggerUnit()
local item titem = GetManipulatedItem()
local integer ttype = GetItemTypeId(titem)
local itemtype class = GetItemType(titem)
local integer Recipe_row
if class == ITEM_TYPE_CAMPAIGN then
if Is2RecipesInForge() then
call UnitRemoveItemSwapped(titem, forge)
return
endif
set Recipe_row = GetRecipeRowNum(ttype)
//call dm("Recipe_row = " + I2S(Recipe_row))
else
set ttype = FindRecipe()
if ttype == 0 then
return
endif
set Recipe_row = GetRecipeRowNum(ttype)
endif
//call dm("!")
if IsForgeItemCollected(Recipe_row) then
//call dm("*")
set titem = CreateForgeItem(Recipe_row)
call UnitRemoveItemSwapped(titem, forge)
endif
set forge = null
set titem = null
endfunction
//===========================================================================
function InitTrig_Forge_Work takes nothing returns nothing
set gg_trg_Forge_Work = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Forge_Work, gg_unit_h008_0050, EVENT_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_Forge_Work, function Trig_Forge_Work_Actions )
endfunction
function Fg_Click_Reset takes nothing returns nothing
call PolledWait(1)
set udg_Fg_Clicked = false
endfunction
function Trig_Forge_Throw_Items_Actions takes nothing returns nothing
local integer i
if not udg_Fg_Clicked then
set udg_Fg_Clicked = true
call ExecuteFunc("Fg_Click_Reset")
else
set i = 1
loop
exitwhen i > 6
call UnitRemoveItemFromSlotSwapped(i, gg_unit_h008_0050)
set i = i + 1
endloop
endif
endfunction
//===========================================================================
function InitTrig_Forge_Throw_Items takes nothing returns nothing
set gg_trg_Forge_Throw_Items = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Forge_Throw_Items, gg_unit_h008_0050, EVENT_UNIT_SELECTED )
call TriggerAddAction( gg_trg_Forge_Throw_Items, function Trig_Forge_Throw_Items_Actions )
endfunction
function Trig_Dummy_Recipe_2_Recipe_Conditions takes nothing returns boolean
return GetItemType(GetManipulatedItem()) == ITEM_TYPE_CAMPAIGN
endfunction
function Trig_Dummy_Recipe_2_Recipe_Actions takes nothing returns nothing
local integer i = 1
local item titem = GetManipulatedItem()
local integer ttype = GetItemTypeId(titem)
loop
exitwhen udg_Fg_DummyRecipe[i] == null or udg_Fg_DummyRecipe[i] == ttype
set i = i + 1
endloop
if udg_Fg_DummyRecipe[i] != null then
call RemoveItem(titem)
call UnitAddItemByIdSwapped(udg_Fg_companent[(i-1)*4], GetTriggerUnit())
endif
set titem = null
endfunction
//===========================================================================
function InitTrig_Dummy_Recipe_2_Recipe takes nothing returns nothing
set gg_trg_Dummy_Recipe_2_Recipe = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Dummy_Recipe_2_Recipe, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Dummy_Recipe_2_Recipe, Condition( function Trig_Dummy_Recipe_2_Recipe_Conditions ) )
call TriggerAddAction( gg_trg_Dummy_Recipe_2_Recipe, function Trig_Dummy_Recipe_2_Recipe_Actions )
endfunction
function Trig_Monster_Killed_Actions takes nothing returns nothing
local unit tunit = GetTriggerUnit()
local integer i = 1
local player p = GetOwningPlayer(GetKillingUnitBJ())
loop
exitwhen i > 4
exitwhen p == udg_MB_Player[i]
set i = i + 1
endloop
set udg_Kills[i] = ( udg_Kills[i] + 1 )
call TriggerExecute(gg_trg_Multiboard_Update)
call TriggerSleepAction( 15.00 )
call RemoveUnit( tunit )
endfunction
//===========================================================================
function InitTrig_Monster_Killed takes nothing returns nothing
set gg_trg_Monster_Killed = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Monster_Killed, Player(5), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Monster_Killed, function Trig_Monster_Killed_Actions )
endfunction
function Trig_Shop_Hints_Initialize_Actions takes nothing returns nothing
local location tpoint = null
local texttag tt
local integer i = 1
local player p = Player(i)
loop
exitwhen i > udg_AmmountOfPlayers
if GetLocalPlayer() == p then
set tpoint = GetUnitLoc(gg_unit_nheb_0004)
set udg_ShopHint[(i - 1)*4 + 0] = CreateTextTagLocBJ( "Rune Shop", tpoint, 180.00, 10, 100, 100, 100, 0 )
call SetTextTagPos(bj_lastCreatedTextTag, GetLocationX(tpoint) - 70, GetLocationY(tpoint), 230)
call RemoveLocation(tpoint)
set tpoint = GetUnitLoc(gg_unit_hdhw_0006)
set udg_ShopHint[(i - 1)*4 + 1] = CreateTextTagLocBJ( "Accesories Shop", tpoint, 230.00, 10, 100, 100, 100, 0 )
call SetTextTagPos(bj_lastCreatedTextTag, GetLocationX(tpoint) - 100, GetLocationY(tpoint), 280)
call RemoveLocation(tpoint)
set tpoint = GetUnitLoc(gg_unit_hwtw_0005)
set udg_ShopHint[(i - 1)*4 + 2] = CreateTextTagLocBJ( "Armor & Weapon Shop", tpoint, 230.00, 10, 100, 100, 100, 0 )
call SetTextTagPos(bj_lastCreatedTextTag, GetLocationX(tpoint) - 100, GetLocationY(tpoint), 300)
call RemoveLocation(tpoint)
set tpoint = GetUnitLoc(gg_unit_h009_0052)
set udg_ShopHint[(i - 1)*4 + 3] = CreateTextTagLocBJ( "Recipies Shop", tpoint, 150.00, 10, 100, 100, 100, 0 )
call SetTextTagPos(bj_lastCreatedTextTag, GetLocationX(tpoint) - 100, GetLocationY(tpoint), 200)
call RemoveLocation(tpoint)
endif
set udg_ShopHint_IsShown[i] = true
set i = i + 1
set p = Player(i)
endloop
set tpoint = null
endfunction
//===========================================================================
function InitTrig_Shop_Hints_Initialize takes nothing returns nothing
set gg_trg_Shop_Hints_Initialize = CreateTrigger( )
call TriggerAddAction( gg_trg_Shop_Hints_Initialize, function Trig_Shop_Hints_Initialize_Actions )
endfunction
function Trig_Hide_Show_Shop_Hints_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local integer i = 1
local integer j = 1
loop
exitwhen p == Player(i)
set i = i + 1
endloop
loop
exitwhen j > 1
set udg_ShopHint_IsShown[i] = not udg_ShopHint_IsShown[i]
if GetLocalPlayer() == p then
call SetTextTagVisibility(udg_ShopHint[(i -1)*4 + 0], udg_ShopHint_IsShown[i])
call SetTextTagVisibility(udg_ShopHint[(i -1)*4 + 1], udg_ShopHint_IsShown[i])
call SetTextTagVisibility(udg_ShopHint[(i -1)*4 + 2], udg_ShopHint_IsShown[i])
call SetTextTagVisibility(udg_ShopHint[(i -1)*4 + 3], udg_ShopHint_IsShown[i])
endif
set j = j + 1
endloop
endfunction
//===========================================================================
function InitTrig_Hide_Show_Shop_Hints takes nothing returns nothing
set gg_trg_Hide_Show_Shop_Hints = CreateTrigger( )
call DisableTrigger( gg_trg_Hide_Show_Shop_Hints )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hide_Show_Shop_Hints, Player(1) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hide_Show_Shop_Hints, Player(2) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hide_Show_Shop_Hints, Player(3) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Hide_Show_Shop_Hints, Player(4) )
call TriggerAddAction( gg_trg_Hide_Show_Shop_Hints, function Trig_Hide_Show_Shop_Hints_Actions )
endfunction
function Trig_Gold_for_players_Actions takes nothing returns nothing
local integer i = 1
loop
exitwhen i > 4
if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
call SetPlayerStateBJ( ConvertedPlayer(i + 1), PLAYER_STATE_RESOURCE_GOLD, ( GetPlayerState(ConvertedPlayer( i + 1 ), PLAYER_STATE_RESOURCE_GOLD) + 20 ) )
endif
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_Gold_for_players takes nothing returns nothing
set gg_trg_Gold_for_players = CreateTrigger( )
call DisableTrigger( gg_trg_Gold_for_players )
call TriggerRegisterTimerEventPeriodic( gg_trg_Gold_for_players, 20.00 )
call TriggerAddAction( gg_trg_Gold_for_players, function Trig_Gold_for_players_Actions )
endfunction
function Gold_Earn_Cond takes nothing returns boolean
return GetOwningPlayer(GetKillingUnitBJ()) != Player(5)
endfunction
function Trig_Gold_Earn_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer utype = GetUnitTypeId(u)
local integer i = 1
loop
exitwhen udg_Mpa_UnitType[i] == null or udg_Mpa_UnitType[i] == utype
set i = i + 1
endloop
if udg_Mpa_UnitType[i] != null then
set udg_EarnedBounty = udg_EarnedBounty + S2I(udg_Monstropedia_txt[(((i - 1) * 6) + 3)])
call LaunchEffectUnit("UI\\Feedback\\GoldCredit\\GoldCredit.mdl", u, "overhead", 2)
call LaunchFloatingText("+"+udg_Monstropedia_txt[(((i - 1) * 6) + 3)], GetUnitX(u), GetUnitY(u), 60, 10, 255, 215, 0, 3)
endif
set u = null
endfunction
//===========================================================================
function InitTrig_Gold_Earn takes nothing returns nothing
set gg_trg_Gold_Earn = CreateTrigger( )
call TriggerAddCondition(gg_trg_Gold_Earn, Condition(function Gold_Earn_Cond))
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Gold_Earn, Player(5), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Gold_Earn, function Trig_Gold_Earn_Actions )
endfunction
function Trig_Cthulchu_Actions takes nothing returns nothing
call PolledWait(3)
call PlaySoundOnUnitBJ( gg_snd_Cthulhu_Laugh, 100, gg_unit_n00I_0057 )
call CameraSetupApplyForceDuration(gg_cam_Cthulchu, true, 0 )
call PolledWait(1)
call CustomDefeatBJ( Player(1), "Greate Cthulhu ate your brains!" )
call CustomDefeatBJ( Player(2), "Greate Cthulhu ate your brains!" )
call CustomDefeatBJ( Player(3), "Greate Cthulhu ate your brains!" )
call CustomDefeatBJ( Player(4), "Greate Cthulhu ate your brains!" )
endfunction
//===========================================================================
function InitTrig_Greate_Cthulhu takes nothing returns nothing
set gg_trg_Greate_Cthulhu = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Greate_Cthulhu, gg_unit_n00I_0057, EVENT_UNIT_SELECTED )
call TriggerAddAction( gg_trg_Greate_Cthulhu, function Trig_Cthulchu_Actions )
endfunction
function Trig_Mapstealer_Defeat_Actions takes nothing returns nothing
call PolledWait(1)
call CustomDefeatBJ( Player(1), "Die, mapstealer!" )
call CustomDefeatBJ( Player(2), "Die, mapstealer!" )
call CustomDefeatBJ( Player(3), "Die, mapstealer!" )
call CustomDefeatBJ( Player(4), "Die, mapstealer!" )
endfunction
//===========================================================================
function InitTrig_Mapstealer_Defeat takes nothing returns nothing
set gg_trg_Mapstealer_Defeat = CreateTrigger( )
call TriggerAddAction( gg_trg_Mapstealer_Defeat, function Trig_Mapstealer_Defeat_Actions )
endfunction
function SkipCinematic takes nothing returns nothing
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 2, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call ShowInterface(true, 1.00 )
call TriggerSleepAction(1)
call TriggerExecute( gg_trg_Choice_Camera )
call StopMusicBJ( false )
call EnableTrigger( gg_trg_Hide_Show_Shop_Hints )
endfunction
function SkipCinematic2 takes nothing returns nothing
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call ShowInterface(true, 1)
call ResetToGameCamera(0)
call PanCameraToTimed(GetLocationX(GetRectCenter(gg_rct_Blood_Elven_Base)), GetLocationY(GetRectCenter(gg_rct_Blood_Elven_Base)), 0 )
call FogEnableOn()
call FogMaskEnableOn()
set udg_CinematicSkkiped[0] = true
call PolledWait(1)
call EnableTrigger( gg_trg_Hide_Show_Shop_Hints )
endfunction
function Trig_Cinematic_Skipped_Actions takes nothing returns nothing
local integer i = 1
local player p = GetTriggerPlayer()
loop
exitwhen i > 4
exitwhen p == Player(i)
set i = i + 1
endloop
set udg_CinematicSkkiped[i] = true
set udg_SkipCinematic = true
set bj_forLoopAIndex = 1
loop
exitwhen bj_forLoopAIndex > 4
if udg_CinematicSkkiped[GetForLoopIndexA()] == false and (GetPlayerSlotState(Player(bj_forLoopAIndex)) == PLAYER_SLOT_STATE_PLAYING) then
set udg_SkipCinematic = false
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set p = null
endfunction
//===========================================================================
function InitTrig_Cinematic_Skipped takes nothing returns nothing
set gg_trg_Cinematic_Skipped = CreateTrigger( )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Cinematic_Skipped, Player(1) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Cinematic_Skipped, Player(2) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Cinematic_Skipped, Player(3) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Cinematic_Skipped, Player(4) )
call TriggerAddAction( gg_trg_Cinematic_Skipped, function Trig_Cinematic_Skipped_Actions )
endfunction
function Trig_Start_Cinematic_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'h000', Player(0), GetRectCenter(gg_rct_AI_work), bj_UNIT_FACING )
call StopMusicBJ( false )
call ClearMapMusicBJ( )
call PlayMusicBJ( gg_snd_BloodElfTheme )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call ShowInterface(false, 0.00 )
call CameraSetupApplyForceDuration(gg_cam_C1_Start, true, 0 )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_2, true, 3.00 )
call DisplayTextToForce( GetPlayersAll(), "To skip cinematic all players must press 'ESC'" )
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_127" )
if udg_SkipCinematic == true then
call SkipCinematic()
return
endif
call TriggerSleepAction( 3.00 )
if udg_SkipCinematic == true then
call SkipCinematic()
return
endif
call SetUnitAnimation( gg_unit_ndke_0012, "stand" )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_3, true, 2.00 )
call TriggerSleepAction( 0.50 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 1.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call TriggerSleepAction( 1.50 )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_4, true, 0 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_5, true, 3.00 )
call TriggerSleepAction( 3.00 )
if udg_SkipCinematic == true then
call SkipCinematic()
return
endif
call SetUnitAnimation( gg_unit_ndke_0007, "stand" )
call SetUnitAnimation( gg_unit_ndke_0013, "stand" )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_6, true, 2.00 )
call TriggerSleepAction( 1.00 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 1.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call TriggerSleepAction( 1.00 )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_7, true, 0.00 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_8, true, 2.00 )
call TriggerSleepAction( 2.00 )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_9, true, 2.00 )
call TriggerSleepAction( 1.00 )
if udg_SkipCinematic == true then
call SkipCinematic()
return
endif
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), gg_unit_nbel_0014, "TRIGSTR_128", null, "TRIGSTR_129", bj_TIMETYPE_ADD, 0, false )
call TriggerSleepAction( 1.50 )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_10, true, 0.00 )
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), gg_unit_nbel_0014, "TRIGSTR_130", null, "TRIGSTR_131", bj_TIMETYPE_ADD, 0, false )
call TriggerSleepAction( 1.00 )
call IssuePointOrderLocBJ( gg_unit_nbel_0014, "move", GetRectCenter(gg_rct_Blood_Elven_Base) )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 1.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call TriggerSleepAction( 1.50 )
if udg_SkipCinematic == true then
call SkipCinematic()
return
endif
call SetUnitPositionLoc( gg_unit_nbel_0014, GetRectCenter(gg_rct_Guard_Pos) )
call IssuePointOrderLocBJ( gg_unit_nbel_0014, "move", GetRectCenter(gg_rct_HeroStart3) )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_11, true, 0.00 )
call CameraSetupApplyForceDuration(gg_cam_C1_camera_12, true, 3.00 )
call TriggerSleepAction( 3.00 )
if udg_SkipCinematic == true then
call SkipCinematic()
return
endif
call CameraSetupApplyForceDuration(gg_cam_C1_camera_13, true, 4.00 )
call TriggerSleepAction( 4.00 )
if udg_SkipCinematic == true then
call SkipCinematic()
return
endif
call CameraSetupApplyForceDuration(gg_cam_C1_camera_14, true, 0.00 )
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), gg_unit_nbel_0014, "TRIGSTR_132", null, "TRIGSTR_133", bj_TIMETYPE_ADD, 0, false )
call TriggerSleepAction( 3.00 )
if udg_SkipCinematic == true then
call SkipCinematic()
return
endif
call CameraSetupApplyForceDuration(gg_cam_C1_camera_15, true, 0.00 )
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), gg_unit_hcth_0028, "TRIGSTR_134", null, "TRIGSTR_135", bj_TIMETYPE_ADD, 0, false )
call TriggerSleepAction( 1.50 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 1.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call TriggerSleepAction( 1.50 )
call FogEnableOn( )
call FogMaskEnableOn( )
call ShowInterface( true, 1.00 )
call TriggerExecute( gg_trg_Choice_Camera )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call EnableTrigger( gg_trg_Hide_Show_Shop_Hints )
endfunction
//===========================================================================
function InitTrig_Start_Cinematic takes nothing returns nothing
set gg_trg_Start_Cinematic = CreateTrigger( )
call TriggerAddAction( gg_trg_Start_Cinematic, function Trig_Start_Cinematic_Actions )
endfunction
function Trig_Defeat_Cinematic_Actions takes nothing returns nothing
call ShowInterface(false, 0.00 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 8.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call CameraSetupApplyForceDuration(gg_cam_Defeat1, true, 0.00 )
call CameraSetupApplyForceDuration(gg_cam_Defeat2, true, 3.00 )
call TriggerSleepAction( 3.00 )
call CameraSetupApplyForceDuration(gg_cam_Defeat3, true, 2.50 )
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_418" )
call TriggerSleepAction( 2.50 )
call CameraSetupApplyForceDuration(gg_cam_Defeat4, true, 3.00 )
call TriggerSleepAction( 3.00 )
endfunction
//===========================================================================
function InitTrig_Defeat_Cinematic takes nothing returns nothing
set gg_trg_Defeat_Cinematic = CreateTrigger( )
call TriggerAddAction( gg_trg_Defeat_Cinematic, function Trig_Defeat_Cinematic_Actions )
endfunction
function Trig_Goblin_Cinematic_Actions takes nothing returns nothing
local unit tunit
local location loc = GetRectCenter(gg_rct_Goblin_move)
set tunit = CreateUnitAtLoc(Player(0), 'hsor', loc, 0)
call RemoveUnit(tunit)
call RemoveLocation(loc)
set loc = GetRectCenter(gg_rct_Goblin_Appear)
call CreateNUnitsAtLoc( 1, 'Ntin', Player(PLAYER_NEUTRAL_PASSIVE), loc, 80.00 )
set tunit = GetLastCreatedUnit()
// call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
// call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call ShowInterface(false, 1.00 )
call CameraSetupApplyForceDuration(gg_cam_C2_camera_1, true, 0 )
call CameraSetupApplyForceDuration(gg_cam_C2_camera_2, true, 2.00 )
call TriggerSleepAction( 1.00 )
call DisplayTextToForce( GetPlayersAll(), "To skip cinematic all players must press 'ESC'" )
if udg_SkipCinematic == true then
call SkipCinematic2()
call RemoveUnit(tunit)
return
endif
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), tunit, "TRIGSTR_1036", null, "TRIGSTR_1037", bj_TIMETYPE_ADD, 0, false)
call TriggerSleepAction( 3.00 )
if udg_SkipCinematic == true then
call SkipCinematic2()
call RemoveUnit(tunit)
return
endif
call IssuePointOrderLocBJ( tunit, "move", GetRectCenter(gg_rct_Goblin_move) )
call CameraSetupApplyForceDuration(gg_cam_C2_camera_3, true, 2.00 )
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), tunit, "TRIGSTR_1038", null, "TRIGSTR_1039", bj_TIMETYPE_ADD, 0, false)
call TriggerSleepAction( 2 )
if udg_SkipCinematic == true then
call SkipCinematic2()
call RemoveUnit(tunit)
return
endif
call CameraSetupApplyForceDuration(gg_cam_C2_camera_4, true, 2.00 )
call TriggerSleepAction( 2.00 )
if udg_SkipCinematic == true then
call SkipCinematic2()
call RemoveUnit(tunit)
return
endif
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), tunit, "TRIGSTR_1040", null, "TRIGSTR_1041", bj_TIMETYPE_ADD, 0, false)
call CameraSetupApplyForceDuration(gg_cam_C2_camera_5, true, 3.00 )
call TriggerSleepAction( 3.00 )
if udg_SkipCinematic == true then
call SkipCinematic2()
call RemoveUnit(tunit)
return
endif
call CameraSetupApplyForceDuration(gg_cam_C2_camera_6, true, 2.00 )
call TriggerSleepAction( 2.0 )
if udg_SkipCinematic == true then
call SkipCinematic2()
call RemoveUnit(tunit)
return
endif
call CameraSetupApplyForceDuration(gg_cam_C2_camera_7, true, 1.50 )
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), tunit, "TRIGSTR_1042", null, "TRIGSTR_1043", bj_TIMETYPE_ADD, 0, false)
call TriggerSleepAction( 3.0 )
if udg_SkipCinematic == true then
call SkipCinematic2()
call RemoveUnit(tunit)
return
endif
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), tunit, "TRIGSTR_1042", null, "You can use our teleport to return to your base quicker!", bj_TIMETYPE_ADD, 0, false)
call TriggerSleepAction(3)
call RemoveUnit(tunit)
call ResetToGameCamera(0)
call PanCameraToTimed(GetLocationX(GetRectCenter(gg_rct_Blood_Elven_Base)), GetLocationY(GetRectCenter(gg_rct_Blood_Elven_Base)), 0 )
call FogEnableOn()
call FogMaskEnableOn()
call ShowInterface(true, 1.00)
set udg_CinematicSkkiped[0] = true
call RemoveLocation(loc)
set loc = null
call EnableTrigger( gg_trg_Hide_Show_Shop_Hints )
endfunction
//===========================================================================
function InitTrig_Goblin_Cinematic takes nothing returns nothing
set gg_trg_Goblin_Cinematic = CreateTrigger( )
call TriggerAddAction( gg_trg_Goblin_Cinematic, function Trig_Goblin_Cinematic_Actions )
endfunction
function Trig_KJ_Cinematic_Actions takes nothing returns nothing
call StopMusicBJ(false)
call ClearMapMusicBJ()
call PlayThematicMusicBJ( "Sound\\Music\\mp3Music\\Doom.mp3" )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call ShowInterface(false, 0.00 )
call CameraSetupApplyForceDuration(gg_cam_KJ_camera_1, true, 0 )
call CameraSetupApplyForceDuration(gg_cam_KJ_camera_2, true, 3 )
call TriggerSleepAction(1)
call DisplayTextToForce( GetPlayersAll(), "To skip cinematic all players must press 'ESC'" )
if udg_SkipCinematic == true then
call SkipCinematic2()
return
endif
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), gg_unit_n00U_0054, "Kil'Jaedin Incarnate", null, "Ha ha ha... immortal fools. You dares to think you can defeat me?", bj_TIMETYPE_ADD, 0, false)
call TriggerSleepAction(2)
if udg_SkipCinematic == true then
call SkipCinematic2()
call SetUnitPositionLoc( gg_unit_n00U_0054, GetRectCenter(gg_rct_KJ_Place) )
return
endif
call CameraSetupApplyForceDuration(gg_cam_KJ_camera_3, true, 3 )
call TriggerSleepAction(3)
if udg_SkipCinematic == true then
call SkipCinematic2()
call SetUnitPositionLoc( gg_unit_n00U_0054, GetRectCenter(gg_rct_KJ_Place) )
return
endif
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), gg_unit_n00U_0054, "Kil'Jaedin Incarnate", null, "I will lead final assault on your base myself.", bj_TIMETYPE_ADD, 0, false)
call CameraSetupApplyForceDuration(gg_cam_KJ_camera_4, true, 0)
call CameraSetupApplyForceDuration(gg_cam_KJ_camera_5, true, 5)
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 5, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call IssuePointOrderLocBJ( gg_unit_n00U_0054, "move", udg_BloodElvenBaseCenter)
call TriggerSleepAction(5)
call ResetToGameCamera(0)
call PanCameraToTimed(GetLocationX(GetRectCenter(gg_rct_Blood_Elven_Base)), GetLocationY(GetRectCenter(gg_rct_Blood_Elven_Base)), 0 )
call FogEnableOn()
call FogMaskEnableOn()
call ShowInterface(true, 1.00)
set udg_CinematicSkkiped[0] = true
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call SetUnitPositionLoc( gg_unit_n00U_0054, GetRectCenter(gg_rct_KJ_Place) )
endfunction
//===========================================================================
function InitTrig_KJ_Cinematic takes nothing returns nothing
set gg_trg_KJ_Cinematic = CreateTrigger( )
call TriggerAddAction( gg_trg_KJ_Cinematic, function Trig_KJ_Cinematic_Actions )
endfunction
function VictoryCinematicSkip takes nothing returns nothing
call SetUserControlForceOn( GetPlayersAll() )
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN, 1, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0)
call ShowInterface(true, 1.00)
call PolledWait(1)
call TriggerExecute( gg_trg_Victory )
endfunction
function Trig_Victory_Cinematic_Actions takes nothing returns nothing
local location loc = GetRectCenter(gg_rct_V_Kael_appear)
local unit tunit
local effect e
call StopMusicBJ(false)
call ClearMapMusicBJ()
call PlayMusicBJ(gg_snd_BloodElfTheme)
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUT, 0.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0)
call ShowInterface(false, 1.00)
call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_FIRE, 0.00 )
call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_AMBIENTSOUNDS, 0.00 )
call VolumeGroupSetVolumeBJ(SOUND_VOLUMEGROUP_SPELLS, 0.00)
call PolledWait(2)
if udg_SkipCinematic == true then
call VictoryCinematicSkip()
return
endif
call DisplayTextToForce( GetPlayersAll(), "To skip cinematic all players must press 'ESC'" )
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN, 1.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0)
call CameraSetupApplyForceDuration(gg_cam_V01, true, 0)
set e = AddSpecialEffectLoc("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl", loc)
call PolledWait(3)
if udg_SkipCinematic == true then
call VictoryCinematicSkip()
return
endif
call DestroyEffect(e)
set e = AddSpecialEffectLoc("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", loc)
set tunit = CreateUnitAtLoc(Player(0), 'Hkal', loc, 0)
call TransmissionFromUnitWithNameBJ(GetPlayersAll(), tunit, "Prince Kael", null, "And who here needs help after all?", bj_TIMETYPE_ADD, 0, false)
call PolledWait(2)
call CameraSetupApplyForceDuration(gg_cam_V1, true, 0)
call CameraSetupApplyForceDuration(gg_cam_V2, true, 6)
call PolledWait(6)
call DisplayTextToForce( GetPlayersAll(), "This map was created by Dmitry aka Celebrate" )
call DisplayTextToForce( GetPlayersAll(), "mail to [email protected]" )
if udg_SkipCinematic == true then
call VictoryCinematicSkip()
return
endif
call CameraSetupApplyForceDuration(gg_cam_V3, true, 6)
call DisplayTextToForce( GetPlayersAll(), "My special thanks to Fantassy & X-Neitron, who greatly helped me with betatesting," )
call DisplayTextToForce( GetPlayersAll(), "Sergey, wampir, Cacodemon and remal for teaching me mapmaking" )
call DisplayTextToForce( GetPlayersAll(), "DeT for creating a few models for me, and to unknown auther of item models, which I am using," )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 8.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call PolledWait(6)
if udg_SkipCinematic == true then
call VictoryCinematicSkip()
return
endif
call CameraSetupApplyForceDuration(gg_cam_V4, true, 4)
call DisplayTextToForce( GetPlayersAll(), "and, of course, Blizzard Entertainment, for creating this greate game" )
call PolledWait(6)
call SetUserControlForceOn( GetPlayersAll() )
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN, 1, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0)
call ShowInterface(true, 1.00)
call PolledWait(1.5)
call TriggerExecute( gg_trg_Victory )
endfunction
//===========================================================================
function InitTrig_Victory_Cinematic takes nothing returns nothing
set gg_trg_Victory_Cinematic = CreateTrigger( )
call TriggerAddAction( gg_trg_Victory_Cinematic, function Trig_Victory_Cinematic_Actions )
endfunction