//TESH.scrollpos=6
//TESH.alwaysfold=0
scope Map initializer Initialization
globals
private constant timer TIMER_SPAWN = CreateTimer()
private constant timer TIMER_TREES = CreateTimer()
private constant boolean Esca = false
private constant timer TIMERESC = CreateTimer()
private constant group TEMP_GROUP = CreateGroup()
private unit TEMP_UNIT
endglobals
private function trees takes nothing returns nothing
local location loc = Location(0, 0)
set udg_FFT_Point_TargetPoint = loc
set udg_FFT_Real_AreaOfEffect = 999999
call ExecuteFunc("FFT_Revive")
call RemoveLocation(loc)
endfunction
private function Spawn takes nothing returns nothing
local integer i = 0
local unit u
loop
exitwhen i >= 6
set i = i + 1
set u = CreateUnit(Player(5), 'h000', -896, -256, 0)
call IssuePointOrder(u, "attack", 896, -256)
set u = CreateUnit(Player(6), 'h001', 896, -256, 180)
call IssuePointOrder(u, "attack", -896, -256)
endloop
set u = CreateUnit(Player(5), 'h002', -896, -256, 0)
call IssuePointOrder(u, "attack", 896, -256)
set u = CreateUnit(Player(6), 'h003', 896, -256, 180)
call IssuePointOrder(u, "attack", -896, -256)
set u = null
endfunction
private function Death takes nothing returns boolean
local unit u
if not IsUnitType(u, UNIT_TYPE_HERO) then
call RemoveUnit(u)
else
call ReviveHero(u, 0, 640, false)
endif
return false
endfunction
private function Esc takes nothing returns nothing
call GroupEnumUnitsInRect(TEMP_GROUP, bj_mapInitialPlayableArea, null)
loop
set TEMP_UNIT = FirstOfGroup(TEMP_GROUP)
exitwhen TEMP_UNIT == null
call GroupRemoveUnit(TEMP_GROUP, TEMP_UNIT)
if GetOwningPlayer(TEMP_UNIT) == Player(0) then
call SetUnitState(TEMP_UNIT, UNIT_STATE_LIFE, GetUnitState(TEMP_UNIT, UNIT_STATE_MAX_LIFE))
call SetUnitState(TEMP_UNIT, UNIT_STATE_MANA, GetUnitState(TEMP_UNIT, UNIT_STATE_MAX_MANA))
call UnitResetCooldown(TEMP_UNIT)
endif
endloop
endfunction
private function TimerEsc takes nothing returns boolean
if Esca then
call PauseTimer(TIMERESC)
call BJDebugMsg("WTF mode disabled")
else
call TimerStart(TIMERESC, 0.03125, true, function Esc)
call BJDebugMsg("WTF mode enabled")
endif
return false
endfunction
private function Initialization takes nothing returns nothing
local group tg = CreateGroup()
local unit j
local trigger t = CreateTrigger()
call TriggerRegisterPlayerEventEndCinematic(t, Player(0))
call TriggerAddCondition(t, Condition(function TimerEsc))
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(t, Condition(function Death))
call BJDebugMsg("Press 'ESC' without the quotes to enable/disable WTF mode!")
call FogModifierStart(CreateFogModifierRect(Player(0), FOG_OF_WAR_VISIBLE, bj_mapInitialPlayableArea, true, false))
call GroupEnumUnitsInRect(tg, bj_mapInitialPlayableArea, null)
loop
set j = FirstOfGroup(tg)
exitwhen j == null
call GroupRemoveUnit(tg, j)
if GetUnitTypeId(j) == 'hprt' then
call SetUnitTimeScale(j, .8)
call SetUnitAnimation(j, "birth")
endif
endloop
call DestroyGroup(tg)
call TimerStart(TIMER_SPAWN, 30, true, function Spawn)
call TimerStart(TIMER_TREES, 5, true, function trees)
call Spawn()
set t = null
endfunction
endscope
Name | Type | is_array | initial_value |
FFT_Point_TargetPoint | location | No | |
FFT_Real_AreaOfEffect | real | No | |
FFT_String_Order | string | No | |
FFT_String_SpecialEffect | modelfile | No | |
FFT_Unit_Destroyer | unit | No | |
TempDestructible | destructable | No | |
TempPoint | location | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Explosions initializer Initialization
globals
private constant integer SPELL_ID = 'A000'//Spell rawcode
private constant string EFFECT_AOE = "abilities\\weapons\\catapult\\catapultmissile.mdl"//Special effect of the explosion
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL//Attack type
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL//Damage type
private constant boolean KILL_TREES = true//Requires FFTSystem by KhaosMachine
private constant boolean TERRAIN_DEFORMATION = true//If you want enable/disable the terrain deformations
private constant boolean PRELOAD = true//Preload special effect
endglobals
function GetExplosions takes integer level returns integer
return 3 + level//Total of explosions each level
endfunction
function GetDamage takes integer level returns real
return 15. + 15. * level//Damage of each explosion each level
endfunction
private constant function GetAreaOfEffect takes integer level returns real
return 120. + 20. * level//Area of effect of the explosions each level
endfunction
private constant function GetTargetType takes unit target, player owner returns boolean
if /*
*/not IsUnitType(target, UNIT_TYPE_DEAD) /*//Target isn't dead
*/and not IsUnitType(target, UNIT_TYPE_STRUCTURE) /*//Target isn't a structure
*/and not IsUnitType(target, UNIT_TYPE_MAGIC_IMMUNE) /*//Target isn't magic immune
*/and IsUnitEnemy(target, owner) /*//Target is enemy of caster
*/then
return true
endif
return false
endfunction
globals
private constant group TempGroup = CreateGroup()
endglobals
function Actions takes nothing returns boolean
local unit caster
local integer level
local integer i = 0
local integer explosions
local real damage
local real aoe
local real aoeoe
local real x
local real y
local unit j
local unit du
local location loc
if GetSpellAbilityId() == SPELL_ID then
set caster = GetTriggerUnit()
set level = GetUnitAbilityLevel(caster, SPELL_ID)
set explosions = GetExplosions(level)
set damage = GetDamage(level)
set aoeoe = GetAreaOfEffect(level)
set aoe = aoeoe * 1.2
loop
exitwhen i >= explosions
set x = (GetUnitX(caster) + aoe / 1.25 * Cos(GetUnitFacing(caster) * bj_DEGTORAD)) + GetRandomReal(0, aoe) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD)
set y = (GetUnitY(caster) + aoe / 1.25 * Sin(GetUnitFacing(caster) * bj_DEGTORAD)) + GetRandomReal(0, aoe) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD)
call GroupEnumUnitsInRange(TempGroup, x, y, aoeoe, null)
loop
set j = FirstOfGroup(TempGroup)
exitwhen j == null
call GroupRemoveUnit(TempGroup, j)
if GetTargetType(j, GetTriggerPlayer()) then
call UnitDamageTarget(caster, j, damage, true, false, ATTACK_TYPE, DAMAGE_TYPE, null)
endif
endloop
call DestroyEffect(AddSpecialEffect(EFFECT_AOE, x, y))
if TERRAIN_DEFORMATION then
call TerrainDeformWave(x, y, x, y, 3, 500, aoeoe, 20, 100, 3)
endif
if KILL_TREES then
set loc = Location(x, y)
set udg_FFT_Real_AreaOfEffect = aoeoe
set udg_FFT_Point_TargetPoint = loc
call ExecuteFunc("FFT_Kill")
call RemoveLocation(loc)
endif
set i = i + 1
endloop
set caster = null
endif
return false
endfunction
public function PreloadSpell takes nothing returns nothing
call Preload(EFFECT_AOE)
endfunction
function Initialization takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Actions))
if PRELOAD then
call PreloadSpell()
endif
set t = null
endfunction
endscope