//TESH.scrollpos=0
//TESH.alwaysfold=0
function FilterIsEnemy takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), bj_groupEnumOwningPlayer)
endfunction
function DamageEnemiesArea takes unit whichUnit, real radius, real x, real y, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns nothing
local group g = CreateGroup()
local boolexpr b = Condition(function FilterIsEnemy)
local unit t
set bj_groupEnumOwningPlayer = GetOwningPlayer(whichUnit)
call GroupEnumUnitsInRange(g, x, y, radius, b)
call DestroyBoolExpr(b)
loop
set t = FirstOfGroup(g)
exitwhen t == null
call GroupRemoveUnit(g,t)
call UnitDamageTarget(whichUnit,t,amount,attack, ranged,attackType,damageType,weaponType)
endloop
call DestroyGroup(g)
set g = null
set b = null
endfunction
Name | Type | is_array | initial_value |
As_Point | location | Yes | |
AstaraelCaster | unit | No | |
AstaraelGroup | group | No | |
AstaraelGroup2 | group | No | |
AStarPoints | location | Yes | |
Backstabbed | unit | Yes | |
Backstabber | unit | Yes | |
Backstabtrig | trigger | Yes | |
Blind_Dummy | unit | No | |
Blind_Target | unit | No | |
Blind_TargetPoint | location | No | |
Blinker_Point | location | No | |
BoltPoint | location | No | |
Carl | player | No | |
CasterPoint1 | location | No | |
CCCaster | unit | No | |
CCTarget | unit | No | |
CF | player | No | |
CircleDoomPNTS | location | Yes | |
CircleDoomSE | effect | Yes | |
Damage | integer | No | |
David | player | No | |
DC_Caster | unit | No | |
DC_CasterLoc | location | No | |
DC_Damage | real | No | |
DC_Heal | real | No | |
DC_Target | unit | No | |
DC_TargetLoc | location | No | |
Dud | unit | No | |
Dying_Hero | unit | Yes | |
Earthquake_Dummy | unit | No | |
EarthReal | real | No | |
Eldrazor | player | No | |
Endtag | string | No | |
ER_Dummy | unit | No | |
ER_Point | location | No | |
ER_Targets | group | No | |
Eskil | player | No | |
ExilePoint | location | No | |
ExtraWave | integer | No | 1 |
Field | unit | No | |
FireType | unitcode | Yes | |
Firewall_Left | integer | No | |
Firewall_Right | integer | No | |
FirstBloodIsDrawn | boolean | No | |
Force | force | Yes | |
ForcePlayerCount | integer | No | |
Gate_Open | boolean | No | |
Gold | string | No | |
GreenLines | lightning | Yes | |
Hero | unit | No | |
HeroGroup | group | No | |
HeroInt | integer | No | |
HeroKills | integer | Yes | |
HeroLevel | integer | Yes | |
HeroPoint | location | Yes | |
HeroPoint2 | location | No | |
HeroSelector | unit | Yes | |
IO2_AddGroup | group | No | |
IO2_Caster | unit | No | |
IO2_Caster_Loc | location | No | |
IO2_Distance_Counter | integer | No | |
IO2_Dummy | unit | No | |
IO2_Dummy_Loc | location | No | |
IO2_Facing | real | No | |
IO2_Group | group | No | |
IO2_Offset | location | No | |
IO2_TargetPoint | location | No | |
IO2_Timer | timer | No | |
IO_AddGroup | group | No | |
IO_Caster | unit | No | |
IO_Caster_Loc | location | No | |
IO_Distance_Counter | integer | No | |
IO_Dummy | unit | No | |
IO_Dummy_Loc | location | No | |
IO_Facing | real | No | |
IO_Group | group | No | |
IO_Offset | location | No | |
IO_TargetPoint | location | No | |
IO_Timer | timer | No | |
IO_TransportCaster | unit | No | |
JackDialog | dialog | No | |
JackDialogButtonNO | button | No | |
JackDialogButtonYES | button | No | |
KickDialog | dialog | No | |
KickDialogButton | button | Yes | |
KillBoard | multiboard | No | |
LeavingGold | integer | No | |
LeavingLumber | integer | No | |
LeavingPlayersHero | group | Yes | |
LocPoint1 | location | No | |
LocPoint2 | location | No | |
LocPoint3 | location | No | |
LocReal | real | No | |
Meteor_Caster | unit | No | |
Meteor_Point | location | No | |
MH_Dummy | unit | No | |
MH_Point | location | No | |
MH_Targets | group | No | |
Mist_Caster | unit | No | |
Mist_CasterLoc | location | No | |
Mist_TargetPoint | location | No | |
MK_AoE | real | No | |
MK_Buff | buffcode | No | |
MK_Caster | unit | No | |
MK_Counter | integer | No | |
MK_Group | group | Yes | |
MK_Point | location | No | |
MK_Target | unit | No | |
Picked_Unit_Point | location | No | |
player_color | integer | No | |
PlayerColor | string | Yes | |
PlayerLeft | boolean | Yes | |
PlayerRow | integer | No | 1 |
PlayingPlayers | force | No | |
Point_Firewall | location | No | |
Random_Integer | integer | No | |
RemoveUnitGroup | group | Yes | |
Repicked | boolean | Yes | |
ReviveTimer | timer | Yes | |
ReviveTimerWindow | timerdialog | Yes | |
RuneAir | unit | No | |
S_CasterLoc | location | No | |
SE | effect | Yes | |
SEpoint | location | No | |
SkeletonType | unitcode | Yes | |
SliceSound | sound | Yes | |
Slot | integervar | No | |
Soul | unit | Yes | |
SoulType | unitcode | Yes | |
SpecialEffect | effect | Yes | |
TB_ManaCost | real | No | |
TB_Point | location | Yes | |
Temp_PlayerGroup | force | No | |
Temp_Point | location | No | |
Temp_UnitGroup | group | No | |
TempUnitGroup | group | Yes | |
ThunderBoltDamage | real | No | |
Trap | unit | Yes | |
Trap_count | integer | No | |
Trap_Used | boolean | No | |
TrapDummy | unit | No | |
TrapPlayer | player | No | |
TrapType | unitcode | Yes | |
Treants | integer | No | |
Unit | unit | No | |
Unit_Group | group | No | |
Upgrade_Timer | timer | No | |
Upgrade_TimerWindow | timerdialog | No | |
UpgradeTimerBoolean | boolean | No | true |
WaveSendingPoint | location | Yes |
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Upgrade initializer Init
globals
private timer T = CreateTimer()
private timerdialog T_WINDOW
private boolean UPGRADE_FIRST = false
private real INTERVAL = 210.
private unit array UNITS
private integer array TECH_IDS
endglobals
private function onTick takes nothing returns nothing
local integer i = 0
loop
exitwhen UNITS[i] == null
if UPGRADE_FIRST then
call IssueImmediateOrderById(UNITS[i],TECH_IDS[1])
call IssueImmediateOrderById(UNITS[i],TECH_IDS[3])
call IssueImmediateOrderById(UNITS[i],TECH_IDS[4])
else
call IssueImmediateOrderById(UNITS[i],TECH_IDS[0])
call IssueImmediateOrderById(UNITS[i],TECH_IDS[1])
call IssueImmediateOrderById(UNITS[i],TECH_IDS[2])
call IssueImmediateOrderById(UNITS[i],TECH_IDS[3])
call IssueImmediateOrderById(UNITS[i],TECH_IDS[4])
endif
set i = i+1
endloop
if UPGRADE_FIRST then
set UPGRADE_FIRST = false
else
set UPGRADE_FIRST = true
endif
endfunction
private function Actions takes nothing returns nothing
set T_WINDOW = CreateTimerDialog(T)
call TimerDialogDisplay(T_WINDOW,true)
call TimerStart(T,INTERVAL,true,function onTick)
endfunction
private function Init takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterTimerEvent(trig,.1,false)
call TriggerAddAction(trig,function Actions)
set UNITS[0] = gg_unit_h000_0001
set UNITS[1] = gg_unit_h001_0126
set TECH_IDS[0] = 'R000'
set TECH_IDS[1] = 'R001'
set TECH_IDS[2] = 'R002'
set TECH_IDS[3] = 'R003'
set TECH_IDS[4] = 'R004'
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Enter initializer InitEnter
private function Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true
endfunction
private function Actions takes nothing returns nothing
local location Blinker_Point = GetRectCenter(gg_rct_PunishmentIsland)
local location LOC = GetUnitLoc(GetTriggerUnit())
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", Blinker_Point))
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", LOC))
call PolledWait(0.10)
call PanCameraToLocForPlayer(GetOwningPlayer(GetTriggerUnit()), Blinker_Point)
call SetUnitPositionLoc( GetTriggerUnit(), Blinker_Point )
call RemoveLocation (Blinker_Point)
call RemoveLocation (LOC)
set Blinker_Point = null
set LOC = null
endfunction
private function InitEnter takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_Life_Pick )
call TriggerRegisterEnterRectSimple( t, gg_rct_Warsong_Pick )
call TriggerAddCondition(t, Condition(function Conditions ))
call TriggerAddAction( t, function Actions )
endfunction
endscope
//TESH.scrollpos=79
//TESH.alwaysfold=0
scope Spawns initializer InitSpawns
globals
private real w = 0.5
private integer ExtraWave = 1
endglobals
private function LifeSpawn1 takes nothing returns nothing
local location SpawnLoc = GetRectCenter(gg_rct_LifeSpawn)
local location SendLoc = GetRectCenter(gg_rct_Region_028)
local unit u
if ExtraWave == 3 then
set u = CreateUnitAtLoc(Player(10), 'n00A', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
endif
set u = CreateUnitAtLoc(Player(10), 'n001', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(10), 'n001', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(10), 'n002', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(10), 'n007', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call RemoveLocation(SpawnLoc)
call RemoveLocation(SendLoc)
set SpawnLoc = null
set SendLoc = null
set u = null
endfunction
private function LifeSpawn2 takes nothing returns nothing
local location SpawnLoc = GetRectCenter(gg_rct_LifeSpawn2)
local location SendLoc = GetRectCenter(gg_rct_Region_052)
local unit u
if ExtraWave == 3 then
set u = CreateUnitAtLoc(Player(10), 'n00A', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
endif
set u = CreateUnitAtLoc(Player(10), 'n001', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(10), 'n001', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(10), 'n002', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(10), 'n007', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call RemoveLocation(SpawnLoc)
call RemoveLocation(SendLoc)
set SpawnLoc = null
set SendLoc = null
set u = null
endfunction
private function OrcSpawn1 takes nothing returns nothing
local location SpawnLoc = GetRectCenter(gg_rct_OrcSpawn)
local location SendLoc = GetRectCenter(gg_rct_Region_029)
local unit u
if ExtraWave == 3 then
set u = CreateUnitAtLoc(Player(11), 'o00D', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
endif
set u = CreateUnitAtLoc(Player(11), 'o004', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(11), 'o004', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(11), 'o005', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(11), 'o008', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call RemoveLocation(SpawnLoc)
call RemoveLocation(SendLoc)
set SpawnLoc = null
set SendLoc = null
set u = null
endfunction
private function OrcSpawn2 takes nothing returns nothing
local location SpawnLoc = GetRectCenter(gg_rct_OrcSpawn2)
local location SendLoc = GetRectCenter(gg_rct_Region_011)
local unit u
call TriggerSleepAction(0.5)
if ExtraWave == 3 then
set u = CreateUnitAtLoc(Player(11), 'o00D', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
set ExtraWave = 1
call TriggerSleepAction(w)
else
set ExtraWave = ExtraWave + 1
endif
set u = CreateUnitAtLoc(Player(11), 'o004', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(11), 'o004', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(11), 'o005', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call TriggerSleepAction(w)
set u = CreateUnitAtLoc(Player(11), 'o008', SpawnLoc, bj_UNIT_FACING)
call IssuePointOrderLoc(u, "attack", SendLoc)
call RemoveLocation(SpawnLoc)
call RemoveLocation(SendLoc)
set SpawnLoc = null
set SendLoc = null
set u = null
endfunction
private function InitSpawns takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 30, true)
call TriggerAddAction(t, function LifeSpawn1)
call TriggerAddAction(t, function LifeSpawn2)
call TriggerAddAction(t, function OrcSpawn1)
call TriggerAddAction(t, function OrcSpawn2)
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
function Trig_Staff_Func001C takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetKillingUnitBJ(), 'B00K') == true ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) != true ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) != true ) ) then
return false
endif
return true
endfunction
function Trig_Staff_Conditions takes nothing returns boolean
return Trig_Staff_Func001C()
endfunction
function Trig_Staff_Func003C takes nothing returns boolean
return udg_Random_Integer >= 10
endfunction
function Trig_Staff_Actions takes nothing returns nothing
local location unitloc
set unitloc = GetUnitLoc(GetTriggerUnit())
set udg_Random_Integer = GetRandomInt(1, 15)
if ( Trig_Staff_Func003C() ) then
call PolledWait( 0.50 )
call AddSpecialEffectLocBJ( unitloc, "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call CreateNUnitsAtLoc( 1, GetUnitTypeId(GetTriggerUnit()), GetOwningPlayer(GetKillingUnitBJ()), unitloc, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 40.00, 'BTLF', GetLastCreatedUnit() )
call RemoveLocation (unitloc)
set unitloc = null
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_Staff takes nothing returns nothing
set gg_trg_Staff = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Staff, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Staff, Condition( function Trig_Staff_Conditions ) )
call TriggerAddAction( gg_trg_Staff, function Trig_Staff_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Nature_Sword_Conditions takes nothing returns boolean
return UnitHasBuffBJ(GetKillingUnitBJ(), 'B00L') == true
endfunction
function Trig_Nature_Sword_Func002C takes nothing returns boolean
return udg_Random_Integer <= 2
endfunction
function Trig_Nature_Sword_Actions takes nothing returns nothing
local location unitloc
set udg_Random_Integer = GetRandomInt(1, 10)
if ( Trig_Nature_Sword_Func002C() ) then
set unitloc = GetUnitLoc(GetTriggerUnit())
call PolledWait( 0.50 )
call AddSpecialEffectLocBJ( unitloc, "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call CreateNUnitsAtLoc( 1, 'e007', GetOwningPlayer(GetKillingUnitBJ()), unitloc, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 40.00, 'BTLF', GetLastCreatedUnit() )
call RemoveLocation (unitloc)
set unitloc = null
else
endif
endfunction
//===========================================================================
function InitTrig_Nature_Sword takes nothing returns nothing
set gg_trg_Nature_Sword = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Nature_Sword, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Nature_Sword, Condition( function Trig_Nature_Sword_Conditions ) )
call TriggerAddAction( gg_trg_Nature_Sword, function Trig_Nature_Sword_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Darkness_Sword_Conditions takes nothing returns boolean
return UnitHasBuffBJ(GetKillingUnitBJ(), 'B00M') == true
endfunction
function Trig_Darkness_Sword_Func002C takes nothing returns boolean
return udg_Random_Integer <= 2
endfunction
function Trig_Darkness_Sword_Actions takes nothing returns nothing
local location unitloc
set udg_Random_Integer = GetRandomInt(1, 10)
if ( Trig_Darkness_Sword_Func002C() ) then
set unitloc = GetUnitLoc (GetTriggerUnit())
call PolledWait( 0.50 )
call AddSpecialEffectLocBJ( unitloc, "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call CreateNUnitsAtLoc( 1, 'n00C', GetOwningPlayer(GetKillingUnitBJ()), unitloc, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 40.00, 'BTLF', GetLastCreatedUnit() )
call RemoveLocation (unitloc)
set unitloc = null
else
endif
endfunction
//===========================================================================
function InitTrig_Darkness_Sword takes nothing returns nothing
set gg_trg_Darkness_Sword = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Darkness_Sword, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Darkness_Sword, Condition( function Trig_Darkness_Sword_Conditions ) )
call TriggerAddAction( gg_trg_Darkness_Sword, function Trig_Darkness_Sword_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Improved_Nature_Sword_Conditions takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetKillingUnitBJ(), 'B017') == true ) ) then
return false
endif
if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_STRUCTURE) != true ) ) then
return false
endif
return true
endfunction
function Trig_Improved_Nature_Sword_Func001C takes nothing returns boolean
return GetRandomInt(1, 10) <= 4
endfunction
function Trig_Improved_Nature_Sword_Actions takes nothing returns nothing
local location unitloc
if ( Trig_Improved_Nature_Sword_Func001C() ) then
set unitloc = GetUnitLoc(GetTriggerUnit())
call PolledWait( 0.50 )
call AddSpecialEffectLocBJ( unitloc, "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call CreateNUnitsAtLoc( 1, 'e007', GetOwningPlayer(GetKillingUnitBJ()), unitloc, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 50.00, 'BTLF', GetLastCreatedUnit() )
call RemoveLocation (unitloc)
set unitloc = null
else
endif
endfunction
//===========================================================================
function InitTrig_Improved_Nature_Sword takes nothing returns nothing
set gg_trg_Improved_Nature_Sword = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Improved_Nature_Sword, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Improved_Nature_Sword, Condition( function Trig_Improved_Nature_Sword_Conditions ) )
call TriggerAddAction( gg_trg_Improved_Nature_Sword, function Trig_Improved_Nature_Sword_Actions )
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
function Trig_Improved_Darkness_Sword_Conditions takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetKillingUnitBJ(), 'B018') == true ) ) then
return false
endif
if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_STRUCTURE) != true ) ) then
return false
endif
return true
endfunction
function Trig_Improved_Darkness_Sword_Func001C takes nothing returns boolean
return GetRandomInt(1, 10) <= 4
endfunction
function Trig_Improved_Darkness_Sword_Actions takes nothing returns nothing
local location unitloc
if ( Trig_Improved_Darkness_Sword_Func001C() ) then
set unitloc = GetUnitLoc(GetTriggerUnit())
call PolledWait( 0.50 )
call AddSpecialEffectLocBJ( unitloc, "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call CreateNUnitsAtLoc( 1, 'n00C', GetOwningPlayer(GetKillingUnitBJ()), unitloc, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 50.00, 'BTLF', GetLastCreatedUnit() )
call RemoveLocation (unitloc)
set unitloc = null
else
endif
endfunction
//===========================================================================
function InitTrig_Improved_Darkness_Sword takes nothing returns nothing
set gg_trg_Improved_Darkness_Sword = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Improved_Darkness_Sword, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Improved_Darkness_Sword, Condition( function Trig_Improved_Darkness_Sword_Conditions ) )
call TriggerAddAction( gg_trg_Improved_Darkness_Sword, function Trig_Improved_Darkness_Sword_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TrueStrength initializer TSInit
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00X'
endfunction
private function Actions takes nothing returns nothing
call ModifyHeroStat( bj_HEROSTAT_STR, GetTriggerUnit(), bj_MODIFYMETHOD_ADD, ( 1 + ( GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetTriggerUnit()) * 1 ) ) )
endfunction
private function TSInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Etheriality initializer EInit
private function Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A018')
endfunction
function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit u2 = GetSpellTargetUnit()
local location u2L = GetUnitLoc(u2)
local player p = GetOwningPlayer(u)
local player p2 = GetOwningPlayer(u2)
if IsPlayerAlly(p, p2) == true then
call UnitDamageTargetBJ(u, u2, (-150.00 + (-50.00 * I2R (GetUnitAbilityLevel(u, 'A018')))), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC)
else
call UnitDamageTargetBJ(u, u2, (150.00 + (50.00 * I2R (GetUnitAbilityLevel(u, 'A018')))), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC)
endif
call DestroyEffect(AddSpecialEffectLoc( "Units\\NightElf\\Wisp\\WispExplode.mdl", u2L))
call RemoveLocation (u2L)
set u = null
set u2 = null
set u2L = null
endfunction
private function EInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition (function Conditions))
call TriggerAddAction(t, function Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SpiritualState initializer SSInit
private function Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A014' )
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real r = GetUnitAbilityLevel(u, 'A014')
call UnitAddAbility(u, 'Abun')
call SetUnitVertexColorBJ(u, 100, 100, 100, 40)
call SetUnitPathing(u, false)
call PolledWait(4 * (r))
call UnitRemoveAbility(u, 'Abun')
call SetUnitVertexColorBJ(u, 100, 100, 100, 0)
call SetUnitPathing(u, true)
endfunction
private function SSInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MassEnsnare initializer EnsnareInit
globals
private integer MAIN_ABILITY = 'A024'
private integer DUMMY_ABILITY = 'A023'
private integer DUMMY_UNIT = 'h00J'
private group UnitGroup = CreateGroup()
private unit u
endglobals
private function DetectSpell takes nothing returns boolean
return GetSpellAbilityId() == MAIN_ABILITY
endfunction
private function FilterUnits takes nothing returns boolean
local unit ta = GetFilterUnit()
return GetWidgetLife(ta) > .405 and IsUnitOwnedByPlayer(ta, GetOwningPlayer(u)) == false and IsPlayerAlly(GetOwningPlayer(ta), GetOwningPlayer(u)) == false
endfunction
private function DoThis takes nothing returns nothing
local unit dummy = CreateUnitAtLoc(GetOwningPlayer(u), DUMMY_UNIT, GetUnitLoc(u), bj_UNIT_FACING)
call UnitAddAbility(dummy, DUMMY_ABILITY)
call SetUnitAbilityLevel(dummy, DUMMY_ABILITY, (GetUnitAbilityLevel(u, MAIN_ABILITY)))
call UnitApplyTimedLife(dummy, 'BTLF', 1.00)
call IssueTargetOrder(dummy, "hex", GetEnumUnit())
set dummy = null
endfunction
private function Actions takes nothing returns nothing
local location UL
local location LOC = GetSpellTargetLoc()
set u = GetTriggerUnit()
set UL = GetUnitLoc(u)
call GroupEnumUnitsInRangeOfLoc(UnitGroup, LOC, 300.00, Condition(function FilterUnits))
call ForGroup(UnitGroup, function DoThis)
call GroupClear(UnitGroup)
endfunction
private function EnsnareInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function DetectSpell))
call TriggerAddAction(t, function Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HellCall2 initializer Init
private function Conditions takes nothing returns boolean
if (GetSpellAbilityId() == 'A01P' ) then
return true
endif
return false
endfunction
private function Actions takes nothing returns nothing
local unit u = (GetTriggerUnit())
local location loc = (GetUnitLoc(u))
if ( GetUnitAbilityLevelSwapped('A01P', GetTriggerUnit()) == 1 ) then
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
call PolledWait(0.5)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
call PolledWait(0.5)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
call PolledWait(0.5)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
call PolledWait(0.5)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
call PolledWait(0.5)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
call PolledWait(0.5)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
else
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
call PolledWait(0.5)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
call PolledWait(0.5)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
call PolledWait(0.5)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
call PolledWait(0.5)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", loc))
endif
call RemoveLocation(loc)
set loc = null
set u = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
//*************************************************************************
//* Name: Backstab *
//* Author: Edwardswolentoe *
//* Descript: Deals critical damage to units from behind. *
//* Variables: 3. udg_Backstabtrig , udg_Backstabber , udg_Backstabbed *
//*************************************************************************
//-------------------------------------------------------------------------------
//Conditions:
//-------------------------------------------------------------------------------
constant function Backstab_Dmg takes nothing returns real
return 20.00 // Damage the backstab will do (20.00 * level of spell + 25)
endfunction
//-------------------------------------------------------------------------------
function backstabability takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A03K', GetAttacker()) >= 1 ) and IsUnitType(GetAttackedUnitBJ(), UNIT_TYPE_STRUCTURE) == false) then // change 'A000' to the spell id of your ability
return false
endif
return true
endfunction
//-------------------------------------------------------------------------------
//Actions:
//-------------------------------------------------------------------------------
function PushData takes nothing returns integer
local integer i = 0
loop
exitwhen i > 8192
if(udg_Backstabtrig[i]== null) then
return i
endif
set i= i + 1
endloop
return -1
endfunction
function getIndex takes trigger t returns integer
local integer i = 0
loop
exitwhen i > 8192
if (t == udg_Backstabtrig[i]) then
return i
endif
set i= i + 1
endloop
return -1
endfunction
function backstabber takes nothing returns nothing
local texttag dmgtext
local location x
local real face1
local real face2
local real damage
local unit attacker
local integer idx = getIndex(GetTriggeringTrigger())
if(idx != -1) then
call DestroyTrigger(udg_Backstabtrig[idx])
set udg_Backstabtrig[idx] = null
set attacker = udg_Backstabber[idx]
set face1 = GetUnitFacing(GetEventDamageSource())
set face2 = GetUnitFacing(GetTriggerUnit())
if (face1 <= ( face2 + 60.00 ) ) then
if (face1 >= ( face2 - 60.00 ) ) then
set x = GetUnitLoc(GetTriggerUnit())
if ( GetEventDamageSource() == attacker ) then
call UnitDamageTargetBJ( attacker, GetTriggerUnit(), ( Backstab_Dmg()*GetUnitAbilityLevelSwapped('A03K', attacker)+25 ), ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )
// Change the damage types to suit your unit, this is currently set to hero damage.
set damage = (Backstab_Dmg()*GetUnitAbilityLevelSwapped('A03K', attacker)+25 )
call CreateTextTagUnitBJ((I2S(R2I(damage)) + "!" ), GetTriggerUnit(), 10.00, 10, 100, 0.00, 0.00, 0 )
set dmgtext = GetLastCreatedTextTag()
call SetTextTagVelocityBJ( dmgtext, 64, 90 )
call PolledWait(1.5)
call DestroyTextTag(dmgtext)
else
return
endif
endif
endif
endif
call RemoveLocation(x)
endfunction
function unitattack takes nothing returns nothing
local integer i = PushData()
if(i!= -1)then
set udg_Backstabtrig[i] = CreateTrigger()
set udg_Backstabber[i] = GetAttacker()
set udg_Backstabbed[i] = GetAttackedUnitBJ()
call UnitRemoveBuffBJ( 'B001', GetAttacker() ) // This is to remove stealth, so does not need to be imported into your map.
call TriggerRegisterUnitEvent(udg_Backstabtrig[i], udg_Backstabbed[i], EVENT_UNIT_DAMAGED)
call TriggerAddAction(udg_Backstabtrig[i], function backstabber)
endif
endfunction
//===========================================================================
function InitTrig_backstab takes nothing returns nothing
set gg_trg_backstab = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_backstab, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_backstab, Condition( function backstabability ) )
call TriggerAddAction( gg_trg_backstab, function unitattack )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Stealth initializer Init
private function Actions takes nothing returns nothing
if (GetLearnedSkill() == 'A03I') then
call UnitAddAbility(GetTriggerUnit(), 'A03J')
endif
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction(t, function Actions)
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
function Trig_Raise_Dead_JASS_Conditions takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetKillingUnit(), 'B00X') == true ) ) then
return false
endif
if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_STRUCTURE) != true ) ) then
return false
endif
return true
endfunction
function Trig_Raise_Dead_JASS_Func001Func005Func001C takes nothing returns boolean
if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_RANGED_ATTACKER) == true ) ) then
return false
endif
return true
endfunction
function Trig_Raise_Dead_JASS_Func001Func005C takes nothing returns boolean
if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_MELEE_ATTACKER) == true ) ) then
return false
endif
return true
endfunction
function Trig_Raise_Dead_JASS_Func001C takes nothing returns boolean
if ( not ( GetRandomInt(1, 10) <= ( 2 + GetUnitAbilityLevelSwapped('A032', GetKillingUnit()) ) ) ) then
return false
endif
return true
endfunction
function Trig_Raise_Dead_JASS_Actions takes nothing returns nothing
local location u
if ( Trig_Raise_Dead_JASS_Func001C() ) then
set u = GetUnitLoc(GetDyingUnit())
call PolledWait( 0.50 )
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl", u))
if ( Trig_Raise_Dead_JASS_Func001Func005C() ) then
call CreateUnitAtLoc(GetOwningPlayer(GetKillingUnit()), 'u001', u, bj_UNIT_FACING)
else
if ( Trig_Raise_Dead_JASS_Func001Func005Func001C() ) then
call CreateUnitAtLoc( GetOwningPlayer(GetKillingUnit()),'N001', u, bj_UNIT_FACING )
else
call CreateUnitAtLoc(GetOwningPlayer(GetKillingUnit()), 'u002', u, bj_UNIT_FACING )
endif
endif
else
endif
call RemoveLocation (u)
set u = null
endfunction
//===========================================================================
function InitTrig_Raise_Dead_JASS takes nothing returns nothing
set gg_trg_Raise_Dead_JASS = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Raise_Dead_JASS, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Raise_Dead_JASS, Condition( function Trig_Raise_Dead_JASS_Conditions ) )
call TriggerAddAction( gg_trg_Raise_Dead_JASS, function Trig_Raise_Dead_JASS_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library LHV
globals
private gamecache GameCache = InitGameCache("jasslocalvars.w3v")
endglobals
function H2I takes handle h returns integer
return GetHandleId(h)
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(GameCache, I2S(H2I(subject)), name)
else
call StoreInteger(GameCache, I2S(H2I(subject)), name, value)
endif
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(GameCache, I2S(H2I(subject)), name)
endfunction
function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(GameCache, I2S(H2I(subject)) )
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Omnislash
globals
private constant integer Spell_ID = 'A011' //The Raw Code of the ability "Omnislash" (might need to be changed in your map)
private constant integer Slash_Times_Base = 3 //The base amount of blinking/slashing (formula = Slash_Times_Base * lvl)
private constant real Damage_Base = 35 //The base damage for the spell (formula = Damage_Base + (lvl * 25)) [note that damage is dealt as a random value between Damage_Base and Damage_Base + (lvl * 25)]
private constant real Slash_Interval = 0.3 //The delay between each slash/attack/blink
private constant real Blink_Offset = 105 //The base offset range in which the caster is moved to when blinking to targets
private constant real AoE = 475 //The area-of-effect of the spell
private constant string Animation = "attack" //The animation that is played during each blink/slash
private constant string Caster_SFX_Attach_Point = "weapon" //The attachment point for the special effect "Caster_SFX"
private constant string Caster_SFX = "Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl" //The Special Effect that is created on the caster's "Caster_SFX_Attach_Point"
private constant string Caster_SFX2 = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" //The Special Effect that is created on the caster's chest during each blink/slash
endglobals
private struct dat
unit u
integer i
effect e
real dmgmax
endstruct
private function Omnislash_Filter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(bj_ghoul[5])) and GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) != true and IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING) != true and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) != true and IsUnitHidden(GetFilterUnit()) != true
endfunction
private function Slash takes nothing returns nothing
local timer t = GetExpiredTimer()
local dat d = dat(GetHandleInt(t, "d"))
local boolexpr b = Condition(function Omnislash_Filter)
local group g = CreateGroup()
local real ang = GetRandomReal(1, 360) * bj_DEGTORAD
local real ofst = GetRandomReal(0, 85)
local unit p
set bj_ghoul[5] = d.u
call GroupEnumUnitsInRange(g, GetUnitX(d.u), GetUnitY(d.u), AoE, b)
if CountUnitsInGroup(g) > 0 and d.i > 0 then
set d.i = d.i - 1
set p = GroupPickRandomUnit(g)
call SelectUnit(d.u, false)
call SetUnitPosition(d.u, GetUnitX(p) + (Blink_Offset + ofst) * Cos(ang), GetUnitY(p) + (Blink_Offset + ofst) * Sin(ang))
call DestroyEffect(AddSpecialEffectTarget(Caster_SFX2, d.u, "chest"))
call UnitDamageTarget(d.u, p, GetRandomReal(Damage_Base, d.dmgmax), false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
call SetUnitAnimation(d.u, Animation)
set p = null
else
call DestroyEffect(d.e)
call SetUnitInvulnerable(d.u, false)
call SetUnitVertexColor(d.u, 255, 255, 255, 255)
if GetLocalPlayer() == GetOwningPlayer(d.u) then
call SelectUnit(d.u, true)
endif
call d.destroy()
call FlushHandleLocals(t)
call PauseTimer(t)
call DestroyTimer(t)
endif
call DestroyBoolExpr(b)
call DestroyGroup(g)
set t = null
set b = null
set g = null
endfunction
private function Cast takes nothing returns nothing
local dat d = dat.create()
local timer t = CreateTimer()
local unit T = GetSpellTargetUnit()
local real ang = GetRandomReal(1, 360) * bj_DEGTORAD
local real ofst = GetRandomReal(0, 85)
set d.u = GetTriggerUnit()
set d.e = AddSpecialEffectTarget(Caster_SFX, d.u, Caster_SFX_Attach_Point)
set d.i = GetUnitAbilityLevel(d.u, Spell_ID) * Slash_Times_Base - 1
set d.dmgmax = GetUnitAbilityLevel(d.u, Spell_ID) * 25 + Damage_Base
call SetUnitInvulnerable(d.u, true)
call SetUnitVertexColor(d.u, 255, 255, 255, 100)
call SelectUnit(d.u, false)
call SetUnitPosition(d.u, GetUnitX(T) + (Blink_Offset + ofst) * Cos(ang), GetUnitY(T) + (Blink_Offset + ofst) * Sin(ang))
call DestroyEffect(AddSpecialEffectTarget(Caster_SFX2, d.u, "chest"))
call UnitDamageTarget(d.u, T, GetRandomReal(Damage_Base, d.dmgmax), false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
call SetHandleInt(t, "d", d)
call TimerStart(t, Slash_Interval, true, function Slash)
set t = null
set T = null
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == Spell_ID
endfunction
function InitTrig_Omnislash takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition( function Conditions ) )
call TriggerAddAction(t, function Cast )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Zombie_kills_unit_Copy_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetKillingUnit()) == 'n00J' ) ) then
return false
endif
return true
endfunction
function Trig_Zombie_kills_unit_Copy_Actions takes nothing returns nothing
local location dying_loc = GetUnitLoc(GetDyingUnit())
call PolledWait( 0.50 )
call AddSpecialEffectLocBJ( dying_loc, "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call CreateNUnitsAtLoc( 1, 'u001', GetOwningPlayer(GetKillingUnitBJ()), dying_loc, bj_UNIT_FACING )
call RemoveLocation (dying_loc)
set dying_loc = null
endfunction
//===========================================================================
function InitTrig_Skeleton_kills_unit takes nothing returns nothing
set gg_trg_Skeleton_kills_unit = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Skeleton_kills_unit, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Skeleton_kills_unit, Condition( function Trig_Zombie_kills_unit_Copy_Conditions ) )
call TriggerAddAction( gg_trg_Skeleton_kills_unit, function Trig_Zombie_kills_unit_Copy_Actions )
endfunction
//TESH.scrollpos=18
//TESH.alwaysfold=0
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//* ~Spell Factory~ *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// *
// *
// *
// *
// *
//Dont forget to credit Dynasti and Paladon for the work. *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//===================================================================
// Holy Wave - v1.2 ~Dynasti
// * * * * * * * * * * * * * *
// How to import:
// 1. Copy this trigger and the Knockback trigger into your map
// 2. Export the Dummy.mdx model then import to you map
// 3. Copy the dummy unit in the object editor to your map( remember to check the rawcode for the dummy and set it to the dummy raw in the globals)
// 3. Make an ability, when finished press Ctrl+D to reveal the Rawcode. Remember that rawcode and copy it into the constant integer AID
// 4. Enjoy
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
scope HolyWave initializer Init
globals
// Generic Globals
private constant integer AID = 'A01K' // The rawcode for the casting spell
private constant integer DID = 'n00K' // The rawcode for the dummy
// Beam Globals
// To make the things easier to explain i'l call the Beams that appear for a Beam or Beams
private constant real BEAM_TICK = 0.035 // The tick interval for the moving of the Beam
private constant real BEAM_SPEED = 25 // The speed of the Beam
private constant real BEAM_AOE = 80 // The Area Of Effect, the AOE of the enemy units that are affected
private constant real BEAM_DAMAGE = 155. // The damage that the Beam does
private constant real BEAM_DAMAGE_INCREASE = 100. // The damage increasement per level
private constant integer BEAM_AMOUNT = 18 // The amount of Beams that are spawned
private constant integer BEAM_AMOUNT_INCREASE = 6 // The amount of waves increasement per level
private constant real BEAM_DISTANCE = 425. // Defines how long the Beam will travel
private constant real BEAM_DISTANCE_INCREASE = 125. // The Beam's distance increasement per level
private constant string BEAM_EFFECT = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" // How the Beam looks
private constant string BEAM_EFFECT_ATTACH = "origin" // Only one that works for the dummy model is "origin"
private constant string CAST_EFFECT = "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl" // The casting effect that appears at the caster when he casts the spell
private constant string CAST_EFFECT_ATTACH = "origin" // The attachment point for CAST_EFFECT
private constant string HIT_EFFECT = "Abilities\\Spells\\Other\\HealingSpray\\HealBottleMissile.mdl" // The effect that appears on the undead enemy when hit by the Beam
private constant string HIT_EFFECT_ATTACH = "origin" // The Attachment point for the HIT_EFFECT
private constant integer BEAM_EFFECT_ANGLE_OF_ATTACK = 90 // From 90 to 180 ( This is something that you can do with this special dummy model )
private constant attacktype AT = ATTACK_TYPE_MAGIC // The attacktype for doing damage to the target
private constant damagetype DT = DAMAGE_TYPE_DIVINE // The damagetype for doing damage to the target
private constant real KNOCKBACK_DISTANCE = 225 // The distance the enemy is knocked back
private constant real KNOCKBACK_TIME = 0.7 // The time it takes to knock the enemy backwards
private constant unittype UT = UNIT_TYPE_UNDEAD // The unit types that are affected by the Beam, current is Undead
// If you dont know what you are doing then i would not recommend to change anything below this line
//==================================================================================================
private boolexpr Bool // A boolexpr variable used to filter units
private group tmpG=CreateGroup() // a Group that is used to filter units
private group tmpG2=null // A second group that is also used to filter units
private player tmpP=null // Needed to check if the filtered unit is an enemy of the casting unit
private unit tmpU=null // A unit used to save a few lines
private real tmpR=0.0 // A real that is used to do damage with, saves a few lines
endglobals
private function GetDamage takes integer lvl returns real // A function for getting the damage for each level
return BEAM_DAMAGE + ( BEAM_DAMAGE_INCREASE * ( lvl - 1 ) )
endfunction
private function GetAmount takes integer lvl returns integer // A function for getting the amount of beams that are spawned for each level
return BEAM_AMOUNT + ( BEAM_AMOUNT_INCREASE * ( lvl - 1 ) )
endfunction
private function GetDistance takes integer lvl returns real // A function for getting the distance that the beams travel in
return BEAM_DISTANCE + ( BEAM_DISTANCE_INCREASE * ( lvl - 1 ) )
endfunction
private function GroupFilter takes nothing returns boolean // This is the groupfilter function, where non structure and enemies are filtered
return IsUnitEnemy(GetFilterUnit(), tmpP) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) and GetWidgetLife(GetFilterUnit())>.405 and not IsUnitInGroup(GetFilterUnit(), tmpG2)
endfunction
struct Wave
unit u // The caster
unit m // The beam
player p // The player
real d=0 // The distance ( since this is a variable that only grows, the variable is set to '0' when the struct is created
real md // The maximum distance that the beam can travel
real cos // Storing a real value for less calculations
real sin // Storing a real value for less calculations
real a // The angle that the beams are traveling in ( In RADIANS )
integer l // Storing the level of the ability
effect e // The Effect that is the Beam
group g=CreateGroup() // Group used to prevent dubble damage
// Theese 3 variables are used for moving multiple beams. Instead of using some fancy Timer Utils setup
// this system uses this indexing system for moving the beams
static integer array Index
static integer Total=0
static timer Tim=CreateTimer()
static method Loop takes nothing returns nothing // The loop that is running to move the beams
local Wave dat // Setting the struct as a local
local integer i=0 // Integer used to count the running structs
loop // Looping the movement
exitwhen i >= dat.Total // Will exit when there are no more beams to move
set dat = dat.Index[i] // Getting the struct value from the indexing system
if dat.d < dat.md then // Checks that if the distance isn't reached this will happen
call SetUnitX(dat.m, GetUnitX(dat.m) + BEAM_SPEED * dat.cos) // Moving the beam to it's next X location
call SetUnitY(dat.m, GetUnitY(dat.m) + BEAM_SPEED * dat.sin) // Moving the beam to it's next Y location
set tmpP = dat.p // Setting the tmpP to the owner of the casting unit, or dat.p
set tmpG2 = dat.g // Setting the tmpG2 to the group that is used to prevent dubble damage
call GroupEnumUnitsInRange(tmpG, GetUnitX(dat.m), GetUnitY(dat.m), BEAM_AOE, Bool) // Getting the units filtered in-range
set tmpR = GetDamage(dat.l) // Setting the variable tmpR to the damage that the beam does, used this variable instead of having to do the call for each unit
loop // Loop for doing stuff to units in the filtered group
set tmpU = FirstOfGroup(tmpG) // Getting the first unit of the group tmpG
exitwhen tmpU == null // If the group is empty then the loop will end
call UnitDamageTarget(dat.u, tmpU, tmpR, true, false, AT, DT, null) // Doing damage to the filtered unit
call GroupAddUnit(dat.g, tmpU) // adding the filtered unit to the struct group, to prevent dubble damage etc.
call DestroyEffect(AddSpecialEffectTarget(HIT_EFFECT, tmpU, HIT_EFFECT_ATTACH)) // Creating the HIT_EFFECt, found in the globals
call Knockback(tmpU, KNOCKBACK_DISTANCE, dat.a, KNOCKBACK_TIME) // Knocking back the filtered unit by using a Knockback system
call GroupRemoveUnit(tmpG, tmpU) // Removing the filtered unit from the group tmpG
set tmpU = null // nulling the unit tmpU
endloop // End of the loop for doing stuff to units in the filtered group
set dat.d = dat.d + BEAM_SPEED // Here is where we add up the distance. If we dont have this the beams would just fly away and never stop
else // Else if it has traveled it's distance this happens
// This is for the indexing system.
set dat.Total = dat.Total - 1 // Setting the total amount of Structs used to - 1 of what it is
set dat.Index[i] = dat.Index[dat.Total] // Recycling the structs
call DestroyEffect(dat.e) // Destroying the Beam Effect
call KillUnit(dat.m) // Killing the Beam
call DestroyGroup(dat.g) // Destroying the group that prevent dubble damage etc.
// Nulling variables
set dat.g=null
set dat.e=null
set dat.p=null
set dat.m=null
set dat.u=null
// - - - - - - - - -
// Destroying the struct
call dat.destroy()
// If we skip this there will be some beams that will not be runned after this, more easely said: It gets skipped
set i = i - 1
endif
set i = i + 1 // Counting the 'i'
endloop
if dat.Total == 0 then // If number of beams equal to 0 then the periodic loop will pause
call PauseTimer(dat.Tim)
endif
endmethod
static method create takes unit u, real x, real y, real a, real d, player p, integer l returns Wave // Here is the create method, it is called in the private function Actions
local Wave dat = Wave.allocate() // allocating the struct
set dat.a = a // Setting the struct's angle(in radians) to the given angle
set dat.u = u // Setting the struct's caster to the given unit
set dat.p = p // Setting the struct's player to the given player
set dat.l = l // Setting the struct's level integer to the given integer
set dat.cos = Cos(dat.a) // Calculating the Cos value here to decrease the calculations done in the loop
set dat.sin = Sin(dat.a) // Calculating the Sin value here to decrease the calculations done in the loop
set dat.md = d // Setting the struct's Max Distance to the given real 'd'
set dat.m = CreateUnit(p, DID, x, y, dat.a * bj_RADTODEG) // Creating the Beam
call SetUnitAnimationByIndex(dat.m, BEAM_EFFECT_ANGLE_OF_ATTACK) // Setting the beam's angle of attack
if BEAM_EFFECT != "" then // If the globals string BEAM_EFFECT is not equal to "" then it will create the Beam Effect
set dat.e = AddSpecialEffectTarget(BEAM_EFFECT, dat.m, BEAM_EFFECT_ATTACH) // Creating the Beam Effect
endif
if dat.Total == 0 then // If total amount of beams that are moving is equal to 0 then it will start the timer
call TimerStart(dat.Tim, BEAM_TICK, true, function Wave.Loop) // Starting the timer
endif
// Here is the indexing system in use again
set dat.Index[dat.Total] = dat // Setting the struct to the index array
set dat.Total = dat.Total + 1 // Setting the total amount of beams to + 1
return dat // Returning the struct
endmethod
endstruct
private function Conditions takes nothing returns boolean // This func is the condition filter for the spell
if GetTimeOfDay() > 6 and GetTimeOfDay() < 18 and GetSpellAbilityId()==AID then
return true
else
return false // Checks if the casting ability is the one needed to run the spell
endif
endfunction
private function Actions takes nothing returns nothing // This is the trigger that is run every time the spell is casted
local unit u = GetTriggerUnit() // Storing the Trigger unit
local player p = GetOwningPlayer(u) // Getting the casting units owner
local real x = GetUnitX(u) // Getting the unit u's x location
local real y = GetUnitY(u) // Getting the unit u's y location
local real a = 0 // This is the angle used a bit down, currently at 0
local integer l = GetUnitAbilityLevel(u, AID) // Getting the unit u's ability Level
local integer i = 1 // Integer used in loop
local integer e = GetAmount(l) // This integer is how many "Beams" there will be created
local real n = 360/e // Needed calculation to get the setup exact
local real d = GetDistance(l) // Getting the max distance the beams can travel
loop // Loop
exitwhen i>e // Will exit when integer 'i' is greater than integer 'e'
set a = (i * n) * bj_DEGTORAD // Here we set the real a to an Angle calculated real
call Wave.create(u, x, y, a, d, p, l) // Here we create the Beam using a struct
set i=i+1 // Setting the integer 'i' to + 1
endloop // End of loop
// if the global string CAST_EFFECT is set to "", the effect will not be created.
if CAST_EFFECT != "" then
call DestroyEffect(AddSpecialEffectTarget(CAST_EFFECT, u, CAST_EFFECT_ATTACH))
endif
// Nulling the variables
set u = null
set p = null
endfunction
private function Init takes nothing returns nothing // The initializer function
// Setting up the triggers
local trigger trg = CreateTrigger() // Creating the trigger
local integer i=0 // an integer that is used as a counter
local player p=null // A temporary player variable
loop // loop for trigger setup
set p=Player(i) // Setting variable 'p' to the integer 'i' 's value
call TriggerRegisterPlayerUnitEvent(trg, p, EVENT_PLAYER_UNIT_SPELL_EFFECT, null) // Register the event
set p=null // Nulling the player variable
set i=i+1 // setting the variable 'i' to 'i' + 1
exitwhen i == bj_MAX_PLAYER_SLOTS // This loop will end when it has done the trigger setup for every player
endloop
// Adding actions to the trigger
call TriggerAddAction(trg, function Actions)
call TriggerAddCondition(trg, Condition(function Conditions))
// nulling the trigger
set trg = null
// Setting up the group filter
set Bool = Condition(function GroupFilter)
// preloading stuff
call Preload(BEAM_EFFECT)
call Preload(HIT_EFFECT)
call Preload(CAST_EFFECT)
call PreloadStart()
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
library Knockback initializer Init
// **************************************************************************
// ** **
// ** Knockback(Ex) **
// ** ————————————— **
// ** **
// ** A function made for efficient knockbacking **
// ** **
// ** By: Silvenon **
// ** **
// **************************************************************************
//=======================================//
//Credits to PitzerMike for this function//
//=======================================//
globals
private constant integer DUMMY_ID = 'h000'
endglobals
private function TreeFilter takes nothing returns boolean
local destructable d = GetFilterDestructable()
local boolean i = IsDestructableInvulnerable(d)
local unit u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID, GetWidgetX(d), GetWidgetY(d), 0)
local boolean result = false
call UnitAddAbility(u, 'Ahrl')
if i then
call SetDestructableInvulnerable(d, false)
endif
set result = IssueTargetOrder(u, "harvest", d)
call RemoveUnit(u)
if i then
call SetDestructableInvulnerable(d, true)
endif
set u = null
set d = null
return result
endfunction
//===========================================================================
globals
private timer Tim = CreateTimer()
private integer Total = 0
private boolexpr Cond = null
private integer array Ar
private boolean array BoolAr
private real MAX_X
private real MAX_Y
private real MIN_X
private real MIN_Y
endglobals
private constant function Interval takes nothing returns real
return 0.04
endfunction
private function KillTree takes nothing returns nothing
if BoolAr[0] then
call KillDestructable(GetEnumDestructable())
else
set BoolAr[1] = true
endif
endfunction
public struct Data
unit u
real d1
real d2
real sin
real cos
real r
string s = ""
effect e = null
static method create takes unit u, integer q, real d, real a, real r, integer t, string s, string p returns Data
local Data dat = Data.allocate()
set dat.u = u
set dat.d1 = 2 * d / (q + 1)
set dat.d2 = dat.d1 / q
set dat.sin = Sin(a)
set dat.cos = Cos(a)
set dat.r = r
if s != "" and s != null then
if t == 2 then
if p != "" and p != null then
set dat.e = AddSpecialEffectTarget(s, u, p)
else
set dat.e = AddSpecialEffectTarget(s, u, "chest")
endif
elseif t == 1 then
set dat.s = s
endif
endif
call SetUnitPosition(u, GetUnitX(u), GetUnitY(u))
//call PauseUnit(u, true)
if Total == 0 then
call TimerStart(Tim, Interval(), true, function Data.Execute)
endif
set Total = Total + 1
set Ar[Total - 1] = dat
return dat
endmethod
static method Execute takes nothing returns nothing
local Data dat
local integer i = 0
local real x
local real y
local rect r
local real rad
loop
exitwhen i >= Total
set dat = Ar[i]
if dat.s != "" and dat.s != null then
set x = GetUnitX(dat.u)
set y = GetUnitY(dat.u)
call DestroyEffect(AddSpecialEffect(dat.s, x, y))
set x = x + dat.d1 * dat.cos
set y = y + dat.d1 * dat.sin
else
set x = GetUnitX(dat.u) + dat.d1 * dat.cos
set y = GetUnitY(dat.u) + dat.d1 * dat.sin
endif
if dat.r != 0 then
set BoolAr[0] = dat.r > 0
set rad = dat.r
if not BoolAr[0] then
set rad = rad * (-1)
endif
set r = Rect(x - rad, y - rad, x + rad, y + rad)
call EnumDestructablesInRect(r, Cond, function KillTree)
call RemoveRect(r)
set r = null
endif
if (x < MAX_X and y < MAX_Y and x > MIN_X and y > MIN_Y) and not BoolAr[1] then
call SetUnitX(dat.u, x)
call SetUnitY(dat.u, y)
endif
set dat.d1 = dat.d1 - dat.d2
if dat.d1 <= 0 or (x > MAX_X or y > MAX_Y or x < MIN_X or y < MIN_Y) or BoolAr[1] then
set Ar[i] = Ar[Total - 1]
set Total = Total - 1
call dat.destroy()
endif
set i = i + 1
endloop
if Total == 0 then
call PauseTimer(Tim)
endif
endmethod
method onDestroy takes nothing returns nothing
if .e != null then
call DestroyEffect(.e)
endif
//call PauseUnit(.u, false)
set BoolAr[0] = false
set BoolAr[1] = false
endmethod
endstruct
function KnockbackEx takes unit u, real d, real a, real w, real r, integer t, string s, string p returns nothing
call Data.create(u, R2I(w / Interval()), d, a, r, t, s, p)
endfunction
function Knockback takes unit u, real d, real a, real w returns nothing
call Data.create(u, R2I(w / Interval()), d, a, 0, 0, "", "")
endfunction
private function Init takes nothing returns nothing
set Cond = Filter(function TreeFilter)
set BoolAr[0] = false
set BoolAr[1] = false
set MAX_X = GetRectMaxX(bj_mapInitialPlayableArea) - 64
set MAX_Y = GetRectMaxY(bj_mapInitialPlayableArea) - 64
set MIN_X = GetRectMinX(bj_mapInitialPlayableArea) + 64
set MIN_Y = GetRectMinY(bj_mapInitialPlayableArea) + 64
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope KillCommand initializer InitKill
globals
private group KILLGROUP = CreateGroup()
endglobals
private function TypeComparison takes nothing returns boolean
local unit u = GetFilterUnit()
return IsUnitType(u, UNIT_TYPE_HERO) == true and IsUnitAliveBJ(u) == true and GetOwningPlayer(u) == GetTriggerPlayer()
endfunction
private function KillCommandActions takes nothing returns nothing
call UnitDamageTargetBJ(GetEnumUnit(), GetEnumUnit(), 100000000.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
endfunction
private function Actions takes nothing returns nothing
call AdjustPlayerStateBJ(-300, GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD)
call GroupEnumUnitsInRect(KILLGROUP, GetPlayableMapRect(), Condition (function TypeComparison))
call ForGroup(KILLGROUP, function KillCommandActions)
call GroupClear(KILLGROUP)
// Removed the group destroy/nulling since its a global group that will be reused and just cleared it from all units so it can be reused without picking wierd units or bugging up.
endfunction
private function InitKill takes nothing returns nothing
local integer k = 0
local trigger t = CreateTrigger()
loop
exitwhen k == 11
call TriggerRegisterPlayerChatEvent(t, Player(k), "-kill", true)
set k = k+1
endloop
call TriggerAddAction(t, function Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MSCommand initializer InitMS
globals
private group MSGROUP = CreateGroup()
endglobals
private function TypeComparisons takes nothing returns boolean
local unit u = GetFilterUnit()
return IsUnitType(u, UNIT_TYPE_HERO) == true and IsUnitAliveBJ(u) == true and GetOwningPlayer(u) == GetTriggerPlayer()
endfunction
private function DoThis takes nothing returns nothing
call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), ( "|c00ff8000Movement Speed: " + ( R2S(GetUnitMoveSpeed(GetEnumUnit())) + udg_Endtag ) ) )
endfunction
private function Actions takes nothing returns nothing
call GroupEnumUnitsInRect(MSGROUP, GetPlayableMapRect(), Condition (function TypeComparisons))
call ForGroup(MSGROUP, function DoThis)
call GroupClear(MSGROUP)
endfunction
private function InitMS takes nothing returns nothing
local integer i = 0
local trigger t = CreateTrigger()
loop
exitwhen i == 11
call TriggerRegisterPlayerChatEvent(t, Player(i), "-ms", true)
set i = i+1
endloop
call TriggerAddAction(t, function Actions)
endfunction
endscope