//TESH.scrollpos=0
//TESH.alwaysfold=0
Name | Type | is_array | initial_value |
//TESH.scrollpos=24
//TESH.alwaysfold=0
library DestructableDestroy initializer DestInit
//Since several spells use this function I placed it into a library
//Make sure you set destructables that you cannot afford to get destroyed to be invulnerable using the function DestInvu
function Dest takes nothing returns nothing
local destructable d = GetEnumDestructable()
if not IsDestructableInvulnerable(d) then
call KillDestructable(d)
endif
set d = null
endfunction
//This function makes the default pathing blockers invulnerable
//If you want a destructable that is used more than once in your map to be invulnerable
//just make another if-then statement and change the rawcode into the rawcode of that destructable
function DestInvu takes nothing returns nothing
local destructable d = GetEnumDestructable()
local integer ID = GetDestructableTypeId(d)
if ID == 'YTab' then
call SetDestructableInvulnerable(d, true)
endif
if ID == 'YTac' then
call SetDestructableInvulnerable(d, true)
endif
if ID == 'YTfb' then
call SetDestructableInvulnerable(d, true)
endif
if ID == 'YTfc' then
call SetDestructableInvulnerable(d, true)
endif
if ID == 'YTpb' then
call SetDestructableInvulnerable(d, true)
endif
if ID == 'YTpc' then
call SetDestructableInvulnerable(d, true)
endif
set d = null
endfunction
function DestInit takes nothing returns nothing
call EnumDestructablesInRect(GetPlayableMapRect(), null, function DestInvu)
endfunction
endlibrary
//TESH.scrollpos=27
//TESH.alwaysfold=0
///////////////////////////////////////////////////
// Meteor Storm
// by: Adiktuz
///////////////////////////////////////////////////
scope MeteorStorm initializer S_Init
//configurables
globals
private constant integer FLY = 'Amrf' //Rawcode of Medivh's raven form
private constant integer DUMMY = 'h000' //Rawcode of the dummy unit(vertical)
private constant integer SPELL = 'A000' //Rawcode of the spell
private constant integer MAX = 4 //Base number of meteors created
private constant integer MAX_I = 2 //Increment in the number of meteors created per level
private constant real DAMAGE = 30 //Damage dealt by each meteor per spell level
private constant boolean RANDOM = false //If set to true, the meteors will have different fall speeds
private constant real SPEED = 20 //The rate at which the meteors fall, higher number = faster fall
private constant real SPEEDMAX = 25 //The max rate at which the meteor will fall if RANDOM = true
private constant real SPEEDMIN = 5 //The min rate at which the meteor will fall if RANDOM = true
private constant real MAXHEIGHT = 800 //The max height of each meteor upon creation
private constant real MINHEIGHT = 500 //The min height of each meteor upon creation
private constant real AOE = 0 //The base radius of the spell
private constant real AOE_I = 100 //Bonus radius of the spell per level
private constant real RADIUS = 150 //The radius of the meteor's damage
private constant string EFFECT = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" //The effect when the meteor explodes
private constant string METEOR = "Abilities\\Weapons\\LordofFlameMissile\\LordofFlameMissile.mdl" //The effect of the meteor
private attacktype ATYPE = ATTACK_TYPE_MAGIC //The attack type of the spell
private damagetype DTYPE = DAMAGE_TYPE_FIRE //The damage type of the spell
private boolean TREE = true //If set to true, meteors will also destroy destructibles: if you use the normal bridges make them invulnerable or the spell will also destroy them.
//End of configurables
private integer array Data
private integer Total = 0
private timer t = CreateTimer()
private group Temp = CreateGroup()
endglobals
private struct S
real x
real y
unit u
player owner
real height
effect meteor
real damage
method onDestroy takes nothing returns nothing
local unit a
local rect r = Rect(this.x - RADIUS, this.y - RADIUS, this.x + RADIUS, this.y + RADIUS)
call DestroyEffect(AddSpecialEffect(EFFECT, this.x, this.y))
if TREE then
call EnumDestructablesInRect(r, null, function Dest)
endif
call GroupEnumUnitsInRange(Temp, this.x, this.y, RADIUS, null)
loop
set a = FirstOfGroup(Temp)
exitwhen a == null
if (IsPlayerEnemy(GetOwningPlayer(a), this.owner) and GetWidgetLife(a) > .405) then
call UnitDamageTarget(this.u, a, this.damage, false, false , ATYPE, DTYPE, WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(Temp, a)
endloop
set a = null
call DestroyEffect(this.meteor)
call UnitApplyTimedLife(this.u, 'BTLF', 1.00)
call RemoveRect(r)
set this.u = null
set this.owner = null
set this.meteor = null
endmethod
static method Screate takes real x, real y, player p, integer level returns nothing
local S dat = S.create()
set Data[Total] = dat
set dat.owner = p
set dat.x = x + GetRandomReal(-(AOE + AOE_I*level), (AOE + AOE_I*level))
set dat.y = y + GetRandomReal(-(AOE + AOE_I*level), (AOE + AOE_I*level))
set dat.u = CreateUnit(dat.owner, DUMMY, dat.x, dat.y, 0.00)
set dat.height = GetRandomReal(MINHEIGHT, MAXHEIGHT)
set dat.damage = DAMAGE*level
call UnitAddAbility(dat.u, FLY)
call UnitRemoveAbility(dat.u, FLY)
call SetUnitFlyHeight(dat.u, dat.height, 0.0)
set dat.meteor = AddSpecialEffectTarget(METEOR, dat.u, "origin")
set Total = Total + 1
if Total == 1 then
call TimerStart(t, .03, true, function S.move)
endif
set p = null
endmethod
static method move takes nothing returns nothing
local S dat
local integer i = 0
loop
exitwhen i == Total
set dat = Data[i]
if RANDOM then
set dat.height = dat.height - GetRandomReal(SPEEDMIN, SPEEDMAX)
else
set dat.height = dat.height - SPEED
endif
call SetUnitFlyHeight(dat.u, dat.height, 0.00)
if dat.height < 1 then
call dat.destroy()
set Total = Total - 1
set Data[i] = Data[Total]
set i = i - 1
endif
set i = i + 1
endloop
if Total == 0 then
call PauseTimer(t)
endif
endmethod
static method Start takes nothing returns nothing
local integer i = 0
local unit a = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local integer level = GetUnitAbilityLevel(a, GetSpellAbilityId())
loop
exitwhen i > (MAX + MAX_I*level)
call S.Screate(x,y,GetOwningPlayer(a),level)
set i = i + 1
endloop
set a = null
endmethod
endstruct
private function SCheck takes nothing returns boolean
return GetSpellAbilityId() == SPELL
endfunction
private function S_Init takes nothing returns nothing
local trigger Meteor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(Meteor, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Meteor, function SCheck)
call TriggerAddAction(Meteor, function S.Start)
set Meteor = null
endfunction
endscope
//TESH.scrollpos=139
//TESH.alwaysfold=0
///////////////////////////////////////////////////
// Aqua Crush
// by: Adiktuz
///////////////////////////////////////////////////
scope AquaCrush initializer Aqua_Init
//configurables
globals
private constant integer FLY = 'Amrf' //Rawcode of Medivh's raven form
private constant integer DUMMY = 'h001' //Rawcode of the dummy unit(horizontal)
private constant integer SPELL = 'A001' //Rawcode of the spell
private constant real DAMAGE = .833 //Explosion damage per level (multiply this value by 12)
private constant real DAMAGER = 4.17 //Impact damage per level (multiply this by 12)
private constant real HEIGHT = 600 //The maximum height that units will be thrown up to
private constant string WAVE = "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveMissile.mdl" //The path to the wave effect
//Note: Using WATER and SPLASH can cause a little lag on some PCs
private boolean SE = false //If true, there will be an explosion effect
private boolean SPE = false //If true, there will be a splashdown effect
private constant string WATER = "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl" //The path to the explosion effect
private constant string SPLASH = "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl" //The path to the splashdown effect
private constant real AOE = 100 //The base radius of the spell
private constant real AOE_B = 50 //The bonus radius of the spell per level
private constant real RANGE = 500 //The distance of the waves from the target point
private constant real SPEED = 20 //The rate at which the waves move
private attacktype ATYPE = ATTACK_TYPE_MAGIC //The attack type of the spell
private damagetype DTYPE = DAMAGE_TYPE_COLD //The damage type of the spell
private constant boolean TREE = true //If set to true, the explosion will also destroy destructibles: if you use the normal bridges make them invulnerable or the spell will also destroy them.
private constant boolean FLYING = false //If set to true, flying units will also get lifted
//End of configurables
private integer array Data
private integer array Datax
private integer Total = 0
private integer Totalx = 0
private timer t = CreateTimer()
private timer tx = CreateTimer()
private group Temp = CreateGroup()
private constant real ACCELERATION = 3 //The increase in rate at which units get thrown up/down
endglobals
private struct AC
real x
real y
real distance
real facing
unit u
real height
effect wave
player owner
unit v
real time
integer level
boolean direction = false
static method create takes real x, real y, player p, real facing, integer level, unit caster returns AC
local AC dat = AC.allocate()
set Data[Total] = dat
set dat.x = x - RANGE*Cos(facing)
set dat.y = y - RANGE*Sin(facing)
set dat.u = CreateUnit(p, DUMMY, dat.x, dat.y, facing*bj_RADTODEG)
set dat.distance = RANGE
set dat.owner = p
set dat.level = level
set dat.facing = facing
set dat.v = caster
set dat.wave = AddSpecialEffectTarget(WAVE, dat.u, "chest")
if Total == 0 then
call TimerStart(t, .03, true, function AC.move)
endif
set Total = Total + 1
set p = null
return dat
endmethod
method onDestroy takes nothing returns nothing
local rect r = Rect(this.x - AOE - AOE_B*this.level, this.y - AOE - AOE_B*this.level, this.x + AOE + AOE_B*this.level, this.y + AOE + AOE_B*this.level)
if TREE then
call EnumDestructablesInRect(r, null, function Dest)
endif
call DestroyEffect(this.wave)
set this.u = null
set this.wave = null
set this.owner = null
set this.v = null
call RemoveRect(r)
set r = null
endmethod
static method move takes nothing returns nothing
local AC dat
local integer i = 0
local unit u
local unit x
loop
exitwhen i == Total
set dat = Data[i]
set dat.x = dat.x + SPEED*Cos(dat.facing)
set dat.y = dat.y + SPEED*Sin(dat.facing)
call SetUnitPosition(dat.u, dat.x, dat.y)
set dat.distance = dat.distance - SPEED
if dat.distance == 0 then
call GroupEnumUnitsInRange(Temp, dat.x, dat.y, AOE + AOE_B*dat.level, null)
loop
set u = FirstOfGroup(Temp)
exitwhen u == null
if (IsPlayerEnemy(GetOwningPlayer(u), dat.owner) and GetWidgetLife(u) > .405) then
call AC.LiftStart(u,dat.v, dat.level)
call UnitDamageTarget(dat.u,u, dat.level*DAMAGE, false, false, ATYPE, DTYPE, WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(Temp, u)
endloop
if SE then
call DestroyEffect(AddSpecialEffectTarget(WATER, dat.u, "origin"))
endif
call UnitApplyTimedLife(dat.u, 'BTLF', 1.00)
call dat.destroy()
set Total = Total - 1
set Data[i] = Data[Total]
set i = i - 1
endif
set i = i + 1
endloop
if Total == 0 then
call PauseTimer(t)
endif
set x = null
set u = null
endmethod
static method LiftStart takes unit u,unit x, integer level returns nothing
local AC dat = AC.allocate()
if FLYING then
set dat.x = GetUnitX(u)
set dat.y = GetUnitY(u)
call UnitAddAbility(u, FLY)
call UnitRemoveAbility(u, FLY)
call SetUnitFlyHeight(u, 10.00, 0)
set dat.v = u
set dat.u = x
set dat.level = level
set dat.time = 0
else
if IsUnitType(u, UNIT_TYPE_FLYING) == false then
set dat.x = GetUnitX(u)
set dat.y = GetUnitY(u)
call UnitAddAbility(u, FLY)
call UnitRemoveAbility(u, FLY)
call SetUnitFlyHeight(u, 10.00, 0)
set dat.v = u
set dat.u = x
set dat.level = level
set dat.time = 0
else
set dat.v = null
set dat.u = null
set dat.direction = true
endif
endif
set Datax[Totalx] = dat
if Totalx == 0 then
call TimerStart(tx, .03, true, function AC.Lift)
endif
set Totalx = Totalx + 1
set u = null
set x = null
endmethod
static method Lift takes nothing returns nothing
local AC dat
local integer i = 0
loop
exitwhen i == Totalx
set dat = Datax[i]
set dat.time = dat.time + 1
if dat.direction then
set dat.height = dat.height - ACCELERATION*dat.time
call SetUnitPosition(dat.v,dat.x,dat.y)
call SetUnitFlyHeight(dat.v,dat.height,0)
else
set dat.height = dat.height + ACCELERATION*(20.00 - dat.time)
call SetUnitPosition(dat.v,dat.x,dat.y)
call SetUnitFlyHeight(dat.v,dat.height,0)
if dat.height >= 600 then
set dat.direction = true
set dat.time = 0
endif
endif
if dat.height <= 0 then
if SPE then
call DestroyEffect(AddSpecialEffect(SPLASH, GetUnitX(dat.v), GetUnitY(dat.v)))
endif
call UnitDamageTarget(dat.u,dat.v, dat.level*DAMAGER, false, false, ATYPE, DTYPE, WEAPON_TYPE_WHOKNOWS)
set dat.u = null
set dat.v = null
call dat.destroy()
set Totalx = Totalx - 1
set Datax[i] = Datax[Totalx]
set i = i - 1
endif
set i = i + 1
endloop
if Totalx == 0 then
call PauseTimer(tx)
endif
endmethod
endstruct
private function Aqua_Check takes nothing returns boolean
return GetSpellAbilityId() == SPELL
endfunction
private function Aqua_Start takes nothing returns nothing
local integer i = 0
local unit a = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
loop
exitwhen i == 12
call AC.create(x,y,GetOwningPlayer(a), i*30*.017453292, GetUnitAbilityLevel(a, SPELL), a)
set i = i + 1
endloop
set a = null
endfunction
private function Aqua_Init takes nothing returns nothing
local trigger Aqua = CreateTrigger( )
call TriggerAddAction( Aqua, function Aqua_Start )
call TriggerAddCondition(Aqua, function Aqua_Check)
call TriggerRegisterAnyUnitEventBJ(Aqua, EVENT_PLAYER_UNIT_SPELL_EFFECT)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
///////////////////////////////////////////////////
// Holy Sanctuary
// by: Adiktuz
///////////////////////////////////////////////////
scope Holy initializer HolyInit
//configurables
globals
private constant integer SPELL = 'A002' //Rawcode of the spell
private constant real POWER = 100 //The amount healed/damaged per level of ability
private constant real RADIUS = 300 //The base radius of the spell
private constant real RADIUS_B = 100 //The radius bonus per level
private constant boolean SELF = true //Determines whether the spell will affect the caster or not
private constant string CEFFECT = "Abilities\\Spells\\Human\\Resurrect\\ResurrectCaster.mdl" //The path to the caster effect
private constant string TEFFECT = "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl" //The path to the target effect
//End of Configurables
private group Holy_Group = CreateGroup()
endglobals
private function HolySanctuary_Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL
endfunction
private function HolySanctuary_Filter takes nothing returns boolean
return IsUnit(GetFilterUnit(), GetTriggerUnit()) != true
endfunction
private function HolySanctuary_Effect takes nothing returns nothing
local unit u = GetEnumUnit()
local real damage = POWER*I2R(GetUnitAbilityLevel(GetTriggerUnit(),SPELL))
if GetWidgetLife(u) > .405 then
if IsUnitType(u, UNIT_TYPE_UNDEAD) then
call UnitDamageTarget(GetTriggerUnit(), u, damage, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_DIVINE, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget(TEFFECT, u, "origin"))
else
call SetWidgetLife(u, GetWidgetLife(u) + damage)
call DestroyEffect(AddSpecialEffectTarget(TEFFECT, u, "origin"))
endif
endif
set u = null
endfunction
private function HolySanctuary_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
if SELF != true then
call GroupEnumUnitsInRange(Holy_Group, GetUnitX(u), GetUnitY(u), RADIUS + RADIUS_B*GetUnitAbilityLevel(GetTriggerUnit(),SPELL), Condition(function HolySanctuary_Filter))
else
call GroupEnumUnitsInRange(Holy_Group, GetUnitX(u), GetUnitY(u), RADIUS + RADIUS_B*GetUnitAbilityLevel(GetTriggerUnit(),SPELL), null)
endif
call ForGroup(Holy_Group, function HolySanctuary_Effect)
call DestroyEffect(AddSpecialEffectTarget(CEFFECT, u, "origin"))
set u = null
endfunction
private function HolyInit takes nothing returns nothing
set gg_trg_HolySanctuary = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_HolySanctuary, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_HolySanctuary, function HolySanctuary_Actions )
call TriggerAddCondition( gg_trg_HolySanctuary, function HolySanctuary_Conditions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Revive_Actions takes nothing returns nothing
local unit a = GetTriggerUnit()
local real x = GetUnitX(a)
local real y = GetUnitY(a)
local integer z = GetUnitTypeId(a)
call RemoveUnit(a)
set a = null
call TriggerSleepAction(10.00)
call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), z, x,y, GetRandomReal(0, 360))
endfunction
//===========================================================================
function InitTrig_Revive takes nothing returns nothing
set gg_trg_Revive = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Revive, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Revive, function Trig_Revive_Actions )
endfunction